//# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/base.js
//# sourceURL=build:/external/com_google_javascript_closure_library/closure/goog/deps.js
//# sourceURL=build://security.html.js
window.Polymer={strictTemplatePolicy:!0};

// Copyright 2014 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
//     You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//     See the License for the specific language governing permissions and
// limitations under the License.

!function(a,b){var c={},d={},e={},f=null;!function(a,b){function c(a){if("number"==typeof a)return a;var b={};for(var c in a)b[c]=a[c];return b}function d(){this._delay=0,this._endDelay=0,this._fill="none",this._iterationStart=0,this._iterations=1,this._duration=0,this._playbackRate=1,this._direction="normal",this._easing="linear",this._easingFunction=w}function e(){return a.isDeprecated("Invalid timing inputs","2016-03-02","TypeError exceptions will be thrown instead.",!0)}function f(b,c,e){var f=new d;return c&&(f.fill="both",f.duration="auto"),"number"!=typeof b||isNaN(b)?void 0!==b&&Object.getOwnPropertyNames(b).forEach(function(c){if("auto"!=b[c]){if(("number"==typeof f[c]||"duration"==c)&&("number"!=typeof b[c]||isNaN(b[c])))return;if("fill"==c&&-1==u.indexOf(b[c]))return;if("direction"==c&&-1==v.indexOf(b[c]))return;if("playbackRate"==c&&1!==b[c]&&a.isDeprecated("AnimationEffectTiming.playbackRate","2014-11-28","Use Animation.playbackRate instead."))return;f[c]=b[c]}}):f.duration=b,f}function g(a){return"number"==typeof a&&(a=isNaN(a)?{duration:0}:{duration:a}),a}function h(b,c){return b=a.numericTimingToObject(b),f(b,c)}function i(a,b,c,d){return 0>a||a>1||0>c||c>1?w:function(e){function f(a,b,c){return 3*a*(1-c)*(1-c)*c+3*b*(1-c)*c*c+c*c*c}if(0==e||1==e)return e;for(var g=0,h=1;;){var i=(g+h)/2,j=f(a,c,i);if(Math.abs(e-j)<1e-4)return f(b,d,i);e>j?g=i:h=i}}}function j(a,b){return function(c){if(c>=1)return 1;var d=1/a;return c+=b*d,c-c%d}}function k(a){B||(B=document.createElement("div").style),B.animationTimingFunction="",B.animationTimingFunction=a;var b=B.animationTimingFunction;if(""==b&&e())throw new TypeError(a+" is not a valid value for easing");var c=D.exec(b);if(c)return i.apply(this,c.slice(1).map(Number));var d=E.exec(b);if(d)return j(Number(d[1]),{start:x,middle:y,end:z}[d[2]]);var f=A[b];return f?f:w}function l(a){return Math.abs(m(a)/a.playbackRate)}function m(a){return a.duration*a.iterations}function n(a,b,c){return null==b?F:b<c.delay?G:b>=c.delay+a?H:I}function o(a,b,c,d,e){switch(d){case G:return"backwards"==b||"both"==b?0:null;case I:return c-e;case H:return"forwards"==b||"both"==b?a:null;case F:return null}}function p(a,b,c,d){return(d.playbackRate<0?b-a:b)*d.playbackRate+c}function q(a,b,c,d,e){return c===1/0||c===-(1/0)||c-d==b&&e.iterations&&(e.iterations+e.iterationStart)%1==0?a:c%a}function r(a,b,c,d){return 0===c?0:b==a?d.iterationStart+d.iterations-1:Math.floor(c/a)}function s(a,b,c,d){var e=a%2>=1,f="normal"==d.direction||d.direction==(e?"alternate-reverse":"alternate"),g=f?c:b-c,h=g/b;return b*d._easingFunction(h)}function t(a,b,c){var d=n(a,b,c),e=o(a,c.fill,b,d,c.delay);if(null===e)return null;if(0===a)return d===G?0:1;var f=c.iterationStart*c.duration,g=p(a,e,f,c),h=q(c.duration,m(c),g,f,c),i=r(c.duration,h,g,c);return s(i,c.duration,h,c)/c.duration}var u="backwards|forwards|both|none".split("|"),v="reverse|alternate|alternate-reverse".split("|"),w=function(a){return a};d.prototype={_setMember:function(b,c){this["_"+b]=c,this._effect&&(this._effect._timingInput[b]=c,this._effect._timing=a.normalizeTimingInput(this._effect._timingInput),this._effect.activeDuration=a.calculateActiveDuration(this._effect._timing),this._effect._animation&&this._effect._animation._rebuildUnderlyingAnimation())},get playbackRate(){return this._playbackRate},set delay(a){this._setMember("delay",a)},get delay(){return this._delay},set endDelay(a){this._setMember("endDelay",a)},get endDelay(){return this._endDelay},set fill(a){this._setMember("fill",a)},get fill(){return this._fill},set iterationStart(a){if((isNaN(a)||0>a)&&e())throw new TypeError("iterationStart must be a non-negative number, received: "+timing.iterationStart);this._setMember("iterationStart",a)},get iterationStart(){return this._iterationStart},set duration(a){if("auto"!=a&&(isNaN(a)||0>a)&&e())throw new TypeError("duration must be non-negative or auto, received: "+a);this._setMember("duration",a)},get duration(){return this._duration},set direction(a){this._setMember("direction",a)},get direction(){return this._direction},set easing(a){this._easingFunction=k(a),this._setMember("easing",a)},get easing(){return this._easing},set iterations(a){if((isNaN(a)||0>a)&&e())throw new TypeError("iterations must be non-negative, received: "+a);this._setMember("iterations",a)},get iterations(){return this._iterations}};var x=1,y=.5,z=0,A={ease:i(.25,.1,.25,1),"ease-in":i(.42,0,1,1),"ease-out":i(0,0,.58,1),"ease-in-out":i(.42,0,.58,1),"step-start":j(1,x),"step-middle":j(1,y),"step-end":j(1,z)},B=null,C="\\s*(-?\\d+\\.?\\d*|-?\\.\\d+)\\s*",D=new RegExp("cubic-bezier\\("+C+","+C+","+C+","+C+"\\)"),E=/steps\(\s*(\d+)\s*,\s*(start|middle|end)\s*\)/,F=0,G=1,H=2,I=3;a.cloneTimingInput=c,a.makeTiming=f,a.numericTimingToObject=g,a.normalizeTimingInput=h,a.calculateActiveDuration=l,a.calculateTimeFraction=t,a.calculatePhase=n,a.toTimingFunction=k}(c,f),function(a,b){function c(a,b){return a in j?j[a][b]||b:b}function d(a,b,d){var e=g[a];if(e){h.style[a]=b;for(var f in e){var i=e[f],j=h.style[i];d[i]=c(i,j)}}else d[a]=c(a,b)}function e(a){var b=[];for(var c in a)if(!(c in["easing","offset","composite"])){var d=a[c];Array.isArray(d)||(d=[d]);for(var e,f=d.length,g=0;f>g;g++)e={},"offset"in a?e.offset=a.offset:1==f?e.offset=1:e.offset=g/(f-1),"easing"in a&&(e.easing=a.easing),"composite"in a&&(e.composite=a.composite),e[c]=d[g],b.push(e)}return b.sort(function(a,b){return a.offset-b.offset}),b}function f(a){function b(){var a=c.length;null==c[a-1].offset&&(c[a-1].offset=1),a>1&&null==c[0].offset&&(c[0].offset=0);for(var b=0,d=c[0].offset,e=1;a>e;e++){var f=c[e].offset;if(null!=f){for(var g=1;e-b>g;g++)c[b+g].offset=d+(f-d)*g/(e-b);b=e,d=f}}}if(null==a)return[];window.Symbol&&Symbol.iterator&&Array.prototype.from&&a[Symbol.iterator]&&(a=Array.from(a)),Array.isArray(a)||(a=e(a));for(var c=a.map(function(a){var b={};for(var c in a){var e=a[c];if("offset"==c){if(null!=e&&(e=Number(e),!isFinite(e)))throw new TypeError("keyframe offsets must be numbers.")}else{if("composite"==c)throw{type:DOMException.NOT_SUPPORTED_ERR,name:"NotSupportedError",message:"add compositing is not supported"};e=""+e}d(c,e,b)}return void 0==b.offset&&(b.offset=null),b}),f=!0,g=-(1/0),h=0;h<c.length;h++){var i=c[h].offset;if(null!=i){if(g>i)throw{code:DOMException.INVALID_MODIFICATION_ERR,name:"InvalidModificationError",message:"Keyframes are not loosely sorted by offset. Sort or specify offsets."};g=i}else f=!1}return c=c.filter(function(a){return a.offset>=0&&a.offset<=1}),f||b(),c}var g={background:["backgroundImage","backgroundPosition","backgroundSize","backgroundRepeat","backgroundAttachment","backgroundOrigin","backgroundClip","backgroundColor"],border:["borderTopColor","borderTopStyle","borderTopWidth","borderRightColor","borderRightStyle","borderRightWidth","borderBottomColor","borderBottomStyle","borderBottomWidth","borderLeftColor","borderLeftStyle","borderLeftWidth"],borderBottom:["borderBottomWidth","borderBottomStyle","borderBottomColor"],borderColor:["borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"],borderLeft:["borderLeftWidth","borderLeftStyle","borderLeftColor"],borderRadius:["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"],borderRight:["borderRightWidth","borderRightStyle","borderRightColor"],borderTop:["borderTopWidth","borderTopStyle","borderTopColor"],borderWidth:["borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth"],flex:["flexGrow","flexShrink","flexBasis"],font:["fontFamily","fontSize","fontStyle","fontVariant","fontWeight","lineHeight"],margin:["marginTop","marginRight","marginBottom","marginLeft"],outline:["outlineColor","outlineStyle","outlineWidth"],padding:["paddingTop","paddingRight","paddingBottom","paddingLeft"]},h=document.createElementNS("http://www.w3.org/1999/xhtml","div"),i={thin:"1px",medium:"3px",thick:"5px"},j={borderBottomWidth:i,borderLeftWidth:i,borderRightWidth:i,borderTopWidth:i,fontSize:{"xx-small":"60%","x-small":"75%",small:"89%",medium:"100%",large:"120%","x-large":"150%","xx-large":"200%"},fontWeight:{normal:"400",bold:"700"},outlineWidth:i,textShadow:{none:"0px 0px 0px transparent"},boxShadow:{none:"0px 0px 0px 0px transparent"}};a.convertToArrayForm=e,a.normalizeKeyframes=f}(c,f),function(a){var b={};a.isDeprecated=function(a,c,d,e){var f=e?"are":"is",g=new Date,h=new Date(c);return h.setMonth(h.getMonth()+3),h>g?(a in b||console.warn("Web Animations: "+a+" "+f+" deprecated and will stop working on "+h.toDateString()+". "+d),b[a]=!0,!1):!0},a.deprecated=function(b,c,d,e){var f=e?"are":"is";if(a.isDeprecated(b,c,d,e))throw new Error(b+" "+f+" no longer supported. "+d)}}(c),function(){if(document.documentElement.animate){var a=document.documentElement.animate([],0),b=!0;if(a&&(b=!1,"play|currentTime|pause|reverse|playbackRate|cancel|finish|startTime|playState".split("|").forEach(function(c){void 0===a[c]&&(b=!0)})),!b)return}!function(a,b,c){function d(a){for(var b={},c=0;c<a.length;c++)for(var d in a[c])if("offset"!=d&&"easing"!=d&&"composite"!=d){var e={offset:a[c].offset,easing:a[c].easing,value:a[c][d]};b[d]=b[d]||[],b[d].push(e)}for(var f in b){var g=b[f];if(0!=g[0].offset||1!=g[g.length-1].offset)throw{type:DOMException.NOT_SUPPORTED_ERR,name:"NotSupportedError",message:"Partial keyframes are not supported"}}return b}function e(c){var d=[];for(var e in c)for(var f=c[e],g=0;g<f.length-1;g++){var h=f[g].offset,i=f[g+1].offset,j=f[g].value,k=f[g+1].value,l=f[g].easing;h==i&&(1==i?j=k:k=j),d.push({startTime:h,endTime:i,easing:a.toTimingFunction(l?l:"linear"),property:e,interpolation:b.propertyInterpolation(e,j,k)})}return d.sort(function(a,b){return a.startTime-b.startTime}),d}b.convertEffectInput=function(c){var f=a.normalizeKeyframes(c),g=d(f),h=e(g);return function(a,c){if(null!=c)h.filter(function(a){return 0>=c&&0==a.startTime||c>=1&&1==a.endTime||c>=a.startTime&&c<=a.endTime}).forEach(function(d){var e=c-d.startTime,f=d.endTime-d.startTime,g=0==f?0:d.easing(e/f);b.apply(a,d.property,d.interpolation(g))});else for(var d in g)"offset"!=d&&"easing"!=d&&"composite"!=d&&b.clear(a,d)}}}(c,d,f),function(a,b,c){function d(a){return a.replace(/-(.)/g,function(a,b){return b.toUpperCase()})}function e(a,b,c){h[c]=h[c]||[],h[c].push([a,b])}function f(a,b,c){for(var f=0;f<c.length;f++){var g=c[f];e(a,b,d(g))}}function g(c,e,f){var g=c;/-/.test(c)&&!a.isDeprecated("Hyphenated property names","2016-03-22","Use camelCase instead.",!0)&&(g=d(c)),"initial"!=e&&"initial"!=f||("initial"==e&&(e=i[g]),"initial"==f&&(f=i[g]));for(var j=e==f?[]:h[g],k=0;j&&k<j.length;k++){var l=j[k][0](e),m=j[k][0](f);if(void 0!==l&&void 0!==m){var n=j[k][1](l,m);if(n){var o=b.Interpolation.apply(null,n);return function(a){return 0==a?e:1==a?f:o(a)}}}}return b.Interpolation(!1,!0,function(a){return a?f:e})}var h={};b.addPropertiesHandler=f;var i={backgroundColor:"transparent",backgroundPosition:"0% 0%",borderBottomColor:"currentColor",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",borderBottomWidth:"3px",borderLeftColor:"currentColor",borderLeftWidth:"3px",borderRightColor:"currentColor",borderRightWidth:"3px",borderSpacing:"2px",borderTopColor:"currentColor",borderTopLeftRadius:"0px",borderTopRightRadius:"0px",borderTopWidth:"3px",bottom:"auto",clip:"rect(0px, 0px, 0px, 0px)",color:"black",fontSize:"100%",fontWeight:"400",height:"auto",left:"auto",letterSpacing:"normal",lineHeight:"120%",marginBottom:"0px",marginLeft:"0px",marginRight:"0px",marginTop:"0px",maxHeight:"none",maxWidth:"none",minHeight:"0px",minWidth:"0px",opacity:"1.0",outlineColor:"invert",outlineOffset:"0px",outlineWidth:"3px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",paddingTop:"0px",right:"auto",textIndent:"0px",textShadow:"0px 0px 0px transparent",top:"auto",transform:"",verticalAlign:"0px",visibility:"visible",width:"auto",wordSpacing:"normal",zIndex:"auto"};b.propertyInterpolation=g}(c,d,f),function(a,b,c){function d(b){var c=a.calculateActiveDuration(b),d=function(d){return a.calculateTimeFraction(c,d,b)};return d._totalDuration=b.delay+c+b.endDelay,d._isCurrent=function(d){var e=a.calculatePhase(c,d,b);return e===PhaseActive||e===PhaseBefore},d}b.KeyframeEffect=function(c,e,f,g){var h,i=d(a.normalizeTimingInput(f)),j=b.convertEffectInput(e),k=function(){j(c,h)};return k._update=function(a){return h=i(a),null!==h},k._clear=function(){j(c,null)},k._hasSameTarget=function(a){return c===a},k._isCurrent=i._isCurrent,k._totalDuration=i._totalDuration,k._id=g,k},b.NullEffect=function(a){var b=function(){a&&(a(),a=null)};return b._update=function(){return null},b._totalDuration=0,b._isCurrent=function(){return!1},b._hasSameTarget=function(){return!1},b}}(c,d,f),function(a,b){a.apply=function(b,c,d){b.style[a.propertyName(c)]=d},a.clear=function(b,c){b.style[a.propertyName(c)]=""}}(d,f),function(a){window.Element.prototype.animate=function(b,c){var d="";return c&&c.id&&(d=c.id),a.timeline._play(a.KeyframeEffect(this,b,c,d))}}(d),function(a,b){function c(a,b,d){if("number"==typeof a&&"number"==typeof b)return a*(1-d)+b*d;if("boolean"==typeof a&&"boolean"==typeof b)return.5>d?a:b;if(a.length==b.length){for(var e=[],f=0;f<a.length;f++)e.push(c(a[f],b[f],d));return e}throw"Mismatched interpolation arguments "+a+":"+b}a.Interpolation=function(a,b,d){return function(e){return d(c(a,b,e))}}}(d,f),function(a,b,c){a.sequenceNumber=0;var d=function(a,b,c){this.target=a,this.currentTime=b,this.timelineTime=c,this.type="finish",this.bubbles=!1,this.cancelable=!1,this.currentTarget=a,this.defaultPrevented=!1,this.eventPhase=Event.AT_TARGET,this.timeStamp=Date.now()};b.Animation=function(b){this.id="",b&&b._id&&(this.id=b._id),this._sequenceNumber=a.sequenceNumber++,this._currentTime=0,this._startTime=null,this._paused=!1,this._playbackRate=1,this._inTimeline=!0,this._finishedFlag=!0,this.onfinish=null,this._finishHandlers=[],this._effect=b,this._inEffect=this._effect._update(0),this._idle=!0,this._currentTimePending=!1},b.Animation.prototype={_ensureAlive:function(){this.playbackRate<0&&0===this.currentTime?this._inEffect=this._effect._update(-1):this._inEffect=this._effect._update(this.currentTime),this._inTimeline||!this._inEffect&&this._finishedFlag||(this._inTimeline=!0,b.timeline._animations.push(this))},_tickCurrentTime:function(a,b){a!=this._currentTime&&(this._currentTime=a,this._isFinished&&!b&&(this._currentTime=this._playbackRate>0?this._totalDuration:0),this._ensureAlive())},get currentTime(){return this._idle||this._currentTimePending?null:this._currentTime},set currentTime(a){a=+a,isNaN(a)||(b.restart(),this._paused||null==this._startTime||(this._startTime=this._timeline.currentTime-a/this._playbackRate),this._currentTimePending=!1,this._currentTime!=a&&(this._tickCurrentTime(a,!0),b.invalidateEffects()))},get startTime(){return this._startTime},set startTime(a){a=+a,isNaN(a)||this._paused||this._idle||(this._startTime=a,this._tickCurrentTime((this._timeline.currentTime-this._startTime)*this.playbackRate),b.invalidateEffects())},get playbackRate(){return this._playbackRate},set playbackRate(a){if(a!=this._playbackRate){var b=this.currentTime;this._playbackRate=a,this._startTime=null,"paused"!=this.playState&&"idle"!=this.playState&&this.play(),null!=b&&(this.currentTime=b)}},get _isFinished(){return!this._idle&&(this._playbackRate>0&&this._currentTime>=this._totalDuration||this._playbackRate<0&&this._currentTime<=0)},get _totalDuration(){return this._effect._totalDuration},get playState(){return this._idle?"idle":null==this._startTime&&!this._paused&&0!=this.playbackRate||this._currentTimePending?"pending":this._paused?"paused":this._isFinished?"finished":"running"},play:function(){this._paused=!1,(this._isFinished||this._idle)&&(this._currentTime=this._playbackRate>0?0:this._totalDuration,this._startTime=null),this._finishedFlag=!1,this._idle=!1,this._ensureAlive(),b.invalidateEffects()},pause:function(){this._isFinished||this._paused||this._idle||(this._currentTimePending=!0),this._startTime=null,this._paused=!0},finish:function(){this._idle||(this.currentTime=this._playbackRate>0?this._totalDuration:0,this._startTime=this._totalDuration-this.currentTime,this._currentTimePending=!1,b.invalidateEffects())},cancel:function(){this._inEffect&&(this._inEffect=!1,this._idle=!0,this._finishedFlag=!0,this.currentTime=0,this._startTime=null,this._effect._update(null),b.invalidateEffects())},reverse:function(){this.playbackRate*=-1,this.play()},addEventListener:function(a,b){"function"==typeof b&&"finish"==a&&this._finishHandlers.push(b)},removeEventListener:function(a,b){if("finish"==a){var c=this._finishHandlers.indexOf(b);c>=0&&this._finishHandlers.splice(c,1)}},_fireEvents:function(a){if(this._isFinished){if(!this._finishedFlag){var b=new d(this,this._currentTime,a),c=this._finishHandlers.concat(this.onfinish?[this.onfinish]:[]);setTimeout(function(){c.forEach(function(a){a.call(b.target,b)})},0),this._finishedFlag=!0}}else this._finishedFlag=!1},_tick:function(a,b){this._idle||this._paused||(null==this._startTime?b&&(this.startTime=a-this._currentTime/this.playbackRate):this._isFinished||this._tickCurrentTime((a-this._startTime)*this.playbackRate)),b&&(this._currentTimePending=!1,this._fireEvents(a))},get _needsTick(){return this.playState in{pending:1,running:1}||!this._finishedFlag}}}(c,d,f),function(a,b,c){function d(a){var b=j;j=[],a<p.currentTime&&(a=p.currentTime),h(a,!0),b.forEach(function(b){b[1](a)}),g(),l=void 0}function e(a,b){return a._sequenceNumber-b._sequenceNumber}function f(){this._animations=[],this.currentTime=window.performance&&performance.now?performance.now():0}function g(){o.forEach(function(a){a()}),o.length=0}function h(a,c){n=!1;var d=b.timeline;d.currentTime=a,d._animations.sort(e),m=!1;var f=d._animations;d._animations=[];var g=[],h=[];f=f.filter(function(b){b._tick(a,c),b._inEffect?h.push(b._effect):g.push(b._effect),b._needsTick&&(m=!0);var d=b._inEffect||b._needsTick;return b._inTimeline=d,d}),o.push.apply(o,g),o.push.apply(o,h),d._animations.push.apply(d._animations,f),m&&requestAnimationFrame(function(){})}var i=window.requestAnimationFrame,j=[],k=0;window.requestAnimationFrame=function(a){var b=k++;return 0==j.length&&i(d),j.push([b,a]),b},window.cancelAnimationFrame=function(a){j.forEach(function(b){b[0]==a&&(b[1]=function(){})})},f.prototype={_play:function(c){c._timing=a.normalizeTimingInput(c.timing);var d=new b.Animation(c);return d._idle=!1,d._timeline=this,this._animations.push(d),b.restart(),b.invalidateEffects(),d}};var l=void 0,m=!1,n=!1;b.restart=function(){return m||(m=!0,requestAnimationFrame(function(){}),n=!0),n},b.invalidateEffects=function(){h(b.timeline.currentTime,!1),g()};var o=[],p=new f;b.timeline=p}(c,d,f),function(a){function b(a,b){var c=a.exec(b);return c?(c=a.ignoreCase?c[0].toLowerCase():c[0],[c,b.substr(c.length)]):void 0}function c(a,b){b=b.replace(/^\s*/,"");var c=a(b);return c?[c[0],c[1].replace(/^\s*/,"")]:void 0}function d(a,d,e){a=c.bind(null,a);for(var f=[];;){var g=a(e);if(!g)return[f,e];if(f.push(g[0]),e=g[1],g=b(d,e),!g||""==g[1])return[f,e];e=g[1]}}function e(a,b){for(var c=0,d=0;d<b.length&&(!/\s|,/.test(b[d])||0!=c);d++)if("("==b[d])c++;else if(")"==b[d]&&(c--,0==c&&d++,0>=c))break;var e=a(b.substr(0,d));return void 0==e?void 0:[e,b.substr(d)]}function f(a,b){for(var c=a,d=b;c&&d;)c>d?c%=d:d%=c;return c=a*b/(c+d)}function g(a){return function(b){var c=a(b);return c&&(c[0]=void 0),c}}function h(a,b){return function(c){var d=a(c);return d?d:[b,c]}}function i(b,c){for(var d=[],e=0;e<b.length;e++){var f=a.consumeTrimmed(b[e],c);if(!f||""==f[0])return;void 0!==f[0]&&d.push(f[0]),c=f[1]}return""==c?d:void 0}function j(a,b,c,d,e){for(var g=[],h=[],i=[],j=f(d.length,e.length),k=0;j>k;k++){var l=b(d[k%d.length],e[k%e.length]);if(!l)return;g.push(l[0]),h.push(l[1]),i.push(l[2])}return[g,h,function(b){var d=b.map(function(a,b){return i[b](a)}).join(c);return a?a(d):d}]}function k(a,b,c){for(var d=[],e=[],f=[],g=0,h=0;h<c.length;h++)if("function"==typeof c[h]){var i=c[h](a[g],b[g++]);d.push(i[0]),e.push(i[1]),f.push(i[2])}else!function(a){d.push(!1),e.push(!1),f.push(function(){return c[a]})}(h);return[d,e,function(a){for(var b="",c=0;c<a.length;c++)b+=f[c](a[c]);return b}]}a.consumeToken=b,a.consumeTrimmed=c,a.consumeRepeated=d,a.consumeParenthesised=e,a.ignore=g,a.optional=h,a.consumeList=i,a.mergeNestedRepeated=j.bind(null,null),a.mergeWrappedNestedRepeated=j,a.mergeList=k}(d),function(a){function b(b){function c(b){var c=a.consumeToken(/^inset/i,b);if(c)return d.inset=!0,c;var c=a.consumeLengthOrPercent(b);if(c)return d.lengths.push(c[0]),c;var c=a.consumeColor(b);return c?(d.color=c[0],c):void 0}var d={inset:!1,lengths:[],color:null},e=a.consumeRepeated(c,/^/,b);return e&&e[0].length?[d,e[1]]:void 0}function c(c){var d=a.consumeRepeated(b,/^,/,c);return d&&""==d[1]?d[0]:void 0}function d(b,c){for(;b.lengths.length<Math.max(b.lengths.length,c.lengths.length);)b.lengths.push({px:0});for(;c.lengths.length<Math.max(b.lengths.length,c.lengths.length);)c.lengths.push({px:0});if(b.inset==c.inset&&!!b.color==!!c.color){for(var d,e=[],f=[[],0],g=[[],0],h=0;h<b.lengths.length;h++){var i=a.mergeDimensions(b.lengths[h],c.lengths[h],2==h);f[0].push(i[0]),g[0].push(i[1]),e.push(i[2])}if(b.color&&c.color){var j=a.mergeColors(b.color,c.color);f[1]=j[0],g[1]=j[1],d=j[2]}return[f,g,function(a){for(var c=b.inset?"inset ":" ",f=0;f<e.length;f++)c+=e[f](a[0][f])+" ";return d&&(c+=d(a[1])),c}]}}function e(b,c,d,e){function f(a){return{inset:a,color:[0,0,0,0],lengths:[{px:0},{px:0},{px:0},{px:0}]}}for(var g=[],h=[],i=0;i<d.length||i<e.length;i++){var j=d[i]||f(e[i].inset),k=e[i]||f(d[i].inset);g.push(j),h.push(k)}return a.mergeNestedRepeated(b,c,g,h)}var f=e.bind(null,d,", ");a.addPropertiesHandler(c,f,["box-shadow","text-shadow"])}(d),function(a,b){function c(a){return a.toFixed(3).replace(".000","")}function d(a,b,c){return Math.min(b,Math.max(a,c))}function e(a){return/^\s*[-+]?(\d*\.)?\d+\s*$/.test(a)?Number(a):void 0}function f(a,b){return[a,b,c]}function g(a,b){return 0!=a?i(0,1/0)(a,b):void 0}function h(a,b){return[a,b,function(a){return Math.round(d(1,1/0,a))}]}function i(a,b){return function(e,f){return[e,f,function(e){return c(d(a,b,e))}]}}function j(a,b){return[a,b,Math.round]}a.clamp=d,a.addPropertiesHandler(e,i(0,1/0),["border-image-width","line-height"]),a.addPropertiesHandler(e,i(0,1),["opacity","shape-image-threshold"]),a.addPropertiesHandler(e,g,["flex-grow","flex-shrink"]),a.addPropertiesHandler(e,h,["orphans","widows"]),a.addPropertiesHandler(e,j,["z-index"]),a.parseNumber=e,a.mergeNumbers=f,a.numberToString=c}(d,f),function(a,b){function c(a,b){return"visible"==a||"visible"==b?[0,1,function(c){return 0>=c?a:c>=1?b:"visible"}]:void 0}a.addPropertiesHandler(String,c,["visibility"])}(d),function(a,b){function c(a){a=a.trim(),f.fillStyle="#000",f.fillStyle=a;var b=f.fillStyle;if(f.fillStyle="#fff",f.fillStyle=a,b==f.fillStyle){f.fillRect(0,0,1,1);var c=f.getImageData(0,0,1,1).data;f.clearRect(0,0,1,1);var d=c[3]/255;return[c[0]*d,c[1]*d,c[2]*d,d]}}function d(b,c){return[b,c,function(b){function c(a){return Math.max(0,Math.min(255,a))}if(b[3])for(var d=0;3>d;d++)b[d]=Math.round(c(b[d]/b[3]));return b[3]=a.numberToString(a.clamp(0,1,b[3])),"rgba("+b.join(",")+")"}]}var e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");e.width=e.height=1;var f=e.getContext("2d");a.addPropertiesHandler(c,d,["background-color","border-bottom-color","border-left-color","border-right-color","border-top-color","color","outline-color","text-decoration-color"]),a.consumeColor=a.consumeParenthesised.bind(null,c),a.mergeColors=d}(d,f),function(a,b){function c(a,b){if(b=b.trim().toLowerCase(),"0"==b&&"px".search(a)>=0)return{px:0};if(/^[^(]*$|^calc/.test(b)){b=b.replace(/calc\(/g,"(");var c={};b=b.replace(a,function(a){return c[a]=null,"U"+a});for(var d="U("+a.source+")",e=b.replace(/[-+]?(\d*\.)?\d+/g,"N").replace(new RegExp("N"+d,"g"),"D").replace(/\s[+-]\s/g,"O").replace(/\s/g,""),f=[/N\*(D)/g,/(N|D)[*\/]N/g,/(N|D)O\1/g,/\((N|D)\)/g],g=0;g<f.length;)f[g].test(e)?(e=e.replace(f[g],"$1"),g=0):g++;if("D"==e){for(var h in c){var i=eval(b.replace(new RegExp("U"+h,"g"),"").replace(new RegExp(d,"g"),"*0"));if(!isFinite(i))return;c[h]=i}return c}}}function d(a,b){return e(a,b,!0)}function e(b,c,d){var e,f=[];for(e in b)f.push(e);for(e in c)f.indexOf(e)<0&&f.push(e);return b=f.map(function(a){return b[a]||0}),c=f.map(function(a){return c[a]||0}),[b,c,function(b){var c=b.map(function(c,e){return 1==b.length&&d&&(c=Math.max(c,0)),a.numberToString(c)+f[e]}).join(" + ");return b.length>1?"calc("+c+")":c}]}var f="px|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc",g=c.bind(null,new RegExp(f,"g")),h=c.bind(null,new RegExp(f+"|%","g")),i=c.bind(null,/deg|rad|grad|turn/g);a.parseLength=g,a.parseLengthOrPercent=h,a.consumeLengthOrPercent=a.consumeParenthesised.bind(null,h),a.parseAngle=i,a.mergeDimensions=e;var j=a.consumeParenthesised.bind(null,g),k=a.consumeRepeated.bind(void 0,j,/^/),l=a.consumeRepeated.bind(void 0,k,/^,/);a.consumeSizePairList=l;var m=function(a){var b=l(a);return b&&""==b[1]?b[0]:void 0},n=a.mergeNestedRepeated.bind(void 0,d," "),o=a.mergeNestedRepeated.bind(void 0,n,",");a.mergeNonNegativeSizePair=n,a.addPropertiesHandler(m,o,["background-size"]),a.addPropertiesHandler(h,d,["border-bottom-width","border-image-width","border-left-width","border-right-width","border-top-width","flex-basis","font-size","height","line-height","max-height","max-width","outline-width","width"]),a.addPropertiesHandler(h,e,["border-bottom-left-radius","border-bottom-right-radius","border-top-left-radius","border-top-right-radius","bottom","left","letter-spacing","margin-bottom","margin-left","margin-right","margin-top","min-height","min-width","outline-offset","padding-bottom","padding-left","padding-right","padding-top","perspective","right","shape-margin","text-indent","top","vertical-align","word-spacing"])}(d,f),function(a,b){function c(b){return a.consumeLengthOrPercent(b)||a.consumeToken(/^auto/,b)}function d(b){var d=a.consumeList([a.ignore(a.consumeToken.bind(null,/^rect/)),a.ignore(a.consumeToken.bind(null,/^\(/)),a.consumeRepeated.bind(null,c,/^,/),a.ignore(a.consumeToken.bind(null,/^\)/))],b);return d&&4==d[0].length?d[0]:void 0}function e(b,c){return"auto"==b||"auto"==c?[!0,!1,function(d){var e=d?b:c;if("auto"==e)return"auto";var f=a.mergeDimensions(e,e);return f[2](f[0])}]:a.mergeDimensions(b,c)}function f(a){return"rect("+a+")"}var g=a.mergeWrappedNestedRepeated.bind(null,f,e,", ");a.parseBox=d,a.mergeBoxes=g,a.addPropertiesHandler(d,g,["clip"])}(d,f),function(a,b){function c(a){return function(b){var c=0;return a.map(function(a){return a===k?b[c++]:a})}}function d(a){return a}function e(b){if(b=b.toLowerCase().trim(),"none"==b)return[];for(var c,d=/\s*(\w+)\(([^)]*)\)/g,e=[],f=0;c=d.exec(b);){if(c.index!=f)return;f=c.index+c[0].length;var g=c[1],h=n[g];if(!h)return;var i=c[2].split(","),j=h[0];if(j.length<i.length)return;for(var k=[],o=0;o<j.length;o++){var p,q=i[o],r=j[o];if(p=q?{A:function(b){return"0"==b.trim()?m:a.parseAngle(b)},N:a.parseNumber,T:a.parseLengthOrPercent,L:a.parseLength}[r.toUpperCase()](q):{a:m,n:k[0],t:l}[r],void 0===p)return;k.push(p)}if(e.push({t:g,d:k}),d.lastIndex==b.length)return e}}function f(a){return a.toFixed(6).replace(".000000","")}function g(b,c){if(b.decompositionPair!==c){b.decompositionPair=c;var d=a.makeMatrixDecomposition(b)}if(c.decompositionPair!==b){c.decompositionPair=b;var e=a.makeMatrixDecomposition(c)}return null==d[0]||null==e[0]?[[!1],[!0],function(a){return a?c[0].d:b[0].d}]:(d[0].push(0),e[0].push(1),[d,e,function(b){var c=a.quat(d[0][3],e[0][3],b[5]),g=a.composeMatrix(b[0],b[1],b[2],c,b[4]),h=g.map(f).join(",");return h}])}function h(a){return a.replace(/[xy]/,"")}function i(a){return a.replace(/(x|y|z|3d)?$/,"3d")}function j(b,c){var d=a.makeMatrixDecomposition&&!0,e=!1;if(!b.length||!c.length){b.length||(e=!0,b=c,c=[]);for(var f=0;f<b.length;f++){var j=b[f].t,k=b[f].d,l="scale"==j.substr(0,5)?1:0;c.push({t:j,d:k.map(function(a){if("number"==typeof a)return l;var b={};for(var c in a)b[c]=l;return b})})}}var m=function(a,b){return"perspective"==a&&"perspective"==b||("matrix"==a||"matrix3d"==a)&&("matrix"==b||"matrix3d"==b)},o=[],p=[],q=[];if(b.length!=c.length){if(!d)return;var r=g(b,c);o=[r[0]],p=[r[1]],q=[["matrix",[r[2]]]]}else for(var f=0;f<b.length;f++){var j,s=b[f].t,t=c[f].t,u=b[f].d,v=c[f].d,w=n[s],x=n[t];if(m(s,t)){if(!d)return;var r=g([b[f]],[c[f]]);o.push(r[0]),p.push(r[1]),q.push(["matrix",[r[2]]])}else{if(s==t)j=s;else if(w[2]&&x[2]&&h(s)==h(t))j=h(s),u=w[2](u),v=x[2](v);else{if(!w[1]||!x[1]||i(s)!=i(t)){if(!d)return;var r=g(b,c);o=[r[0]],p=[r[1]],q=[["matrix",[r[2]]]];break}j=i(s),u=w[1](u),v=x[1](v)}for(var y=[],z=[],A=[],B=0;B<u.length;B++){var C="number"==typeof u[B]?a.mergeNumbers:a.mergeDimensions,r=C(u[B],v[B]);y[B]=r[0],z[B]=r[1],A.push(r[2])}o.push(y),p.push(z),q.push([j,A])}}if(e){var D=o;o=p,p=D}return[o,p,function(a){return a.map(function(a,b){var c=a.map(function(a,c){return q[b][1][c](a)}).join(",");return"matrix"==q[b][0]&&16==c.split(",").length&&(q[b][0]="matrix3d"),q[b][0]+"("+c+")"}).join(" ")}]}var k=null,l={px:0},m={deg:0},n={matrix:["NNNNNN",[k,k,0,0,k,k,0,0,0,0,1,0,k,k,0,1],d],matrix3d:["NNNNNNNNNNNNNNNN",d],rotate:["A"],rotatex:["A"],rotatey:["A"],rotatez:["A"],rotate3d:["NNNA"],perspective:["L"],scale:["Nn",c([k,k,1]),d],scalex:["N",c([k,1,1]),c([k,1])],scaley:["N",c([1,k,1]),c([1,k])],scalez:["N",c([1,1,k])],scale3d:["NNN",d],skew:["Aa",null,d],skewx:["A",null,c([k,m])],skewy:["A",null,c([m,k])],translate:["Tt",c([k,k,l]),d],translatex:["T",c([k,l,l]),c([k,l])],translatey:["T",c([l,k,l]),c([l,k])],translatez:["L",c([l,l,k])],translate3d:["TTL",d]};a.addPropertiesHandler(e,j,["transform"])}(d,f),function(a,b){function c(a,b){b.concat([a]).forEach(function(b){b in document.documentElement.style&&(d[a]=b)})}var d={};c("transform",["webkitTransform","msTransform"]),c("transformOrigin",["webkitTransformOrigin"]),c("perspective",["webkitPerspective"]),c("perspectiveOrigin",["webkitPerspectiveOrigin"]),a.propertyName=function(a){return d[a]||a}}(d,f)}(),!function(){if(void 0===document.createElement("div").animate([]).oncancel){var a;if(window.performance&&performance.now)var a=function(){return performance.now()};else var a=function(){return Date.now()};var b=function(a,b,c){this.target=a,this.currentTime=b,this.timelineTime=c,this.type="cancel",this.bubbles=!1,this.cancelable=!1,this.currentTarget=a,this.defaultPrevented=!1,this.eventPhase=Event.AT_TARGET,this.timeStamp=Date.now()},c=window.Element.prototype.animate;window.Element.prototype.animate=function(d,e){var f=c.call(this,d,e);f._cancelHandlers=[],f.oncancel=null;var g=f.cancel;f.cancel=function(){g.call(this);var c=new b(this,null,a()),d=this._cancelHandlers.concat(this.oncancel?[this.oncancel]:[]);setTimeout(function(){d.forEach(function(a){a.call(c.target,c)})},0)};var h=f.addEventListener;f.addEventListener=function(a,b){"function"==typeof b&&"cancel"==a?this._cancelHandlers.push(b):h.call(this,a,b)};var i=f.removeEventListener;return f.removeEventListener=function(a,b){if("cancel"==a){var c=this._cancelHandlers.indexOf(b);c>=0&&this._cancelHandlers.splice(c,1)}else i.call(this,a,b)},f}}}(),function(a){var b=document.documentElement,c=null,d=!1;try{var e=getComputedStyle(b).getPropertyValue("opacity"),f="0"==e?"1":"0";c=b.animate({opacity:[f,f]},{duration:1}),c.currentTime=0,d=getComputedStyle(b).getPropertyValue("opacity")==f}catch(g){}finally{c&&c.cancel()}if(!d){var h=window.Element.prototype.animate;window.Element.prototype.animate=function(b,c){return window.Symbol&&Symbol.iterator&&Array.prototype.from&&b[Symbol.iterator]&&(b=Array.from(b)),Array.isArray(b)||null===b||(b=a.convertToArrayForm(b)),h.call(this,b,c)}}}(c),!function(a,b,c){function d(a){var b=window.document.timeline;b.currentTime=a,b._discardAnimations(),0==b._animations.length?f=!1:requestAnimationFrame(d);
}var e=window.requestAnimationFrame;window.requestAnimationFrame=function(a){return e(function(b){window.document.timeline._updateAnimationsPromises(),a(b),window.document.timeline._updateAnimationsPromises()})},b.AnimationTimeline=function(){this._animations=[],this.currentTime=void 0},b.AnimationTimeline.prototype={getAnimations:function(){return this._discardAnimations(),this._animations.slice()},_updateAnimationsPromises:function(){b.animationsWithPromises=b.animationsWithPromises.filter(function(a){return a._updatePromises()})},_discardAnimations:function(){this._updateAnimationsPromises(),this._animations=this._animations.filter(function(a){return"finished"!=a.playState&&"idle"!=a.playState})},_play:function(a){var c=new b.Animation(a,this);return this._animations.push(c),b.restartWebAnimationsNextTick(),c._updatePromises(),c._animation.play(),c._updatePromises(),c},play:function(a){return a&&a.remove(),this._play(a)}};var f=!1;b.restartWebAnimationsNextTick=function(){f||(f=!0,requestAnimationFrame(d))};var g=new b.AnimationTimeline;b.timeline=g;try{Object.defineProperty(window.document,"timeline",{configurable:!0,get:function(){return g}})}catch(h){}try{window.document.timeline=g}catch(h){}}(c,e,f),function(a,b,c){b.animationsWithPromises=[],b.Animation=function(b,c){if(this.id="",b&&b._id&&(this.id=b._id),this.effect=b,b&&(b._animation=this),!c)throw new Error("Animation with null timeline is not supported");this._timeline=c,this._sequenceNumber=a.sequenceNumber++,this._holdTime=0,this._paused=!1,this._isGroup=!1,this._animation=null,this._childAnimations=[],this._callback=null,this._oldPlayState="idle",this._rebuildUnderlyingAnimation(),this._animation.cancel(),this._updatePromises()},b.Animation.prototype={_updatePromises:function(){var a=this._oldPlayState,b=this.playState;return this._readyPromise&&b!==a&&("idle"==b?(this._rejectReadyPromise(),this._readyPromise=void 0):"pending"==a?this._resolveReadyPromise():"pending"==b&&(this._readyPromise=void 0)),this._finishedPromise&&b!==a&&("idle"==b?(this._rejectFinishedPromise(),this._finishedPromise=void 0):"finished"==b?this._resolveFinishedPromise():"finished"==a&&(this._finishedPromise=void 0)),this._oldPlayState=this.playState,this._readyPromise||this._finishedPromise},_rebuildUnderlyingAnimation:function(){this._updatePromises();var a,c,d,e,f=!!this._animation;f&&(a=this.playbackRate,c=this._paused,d=this.startTime,e=this.currentTime,this._animation.cancel(),this._animation._wrapper=null,this._animation=null),(!this.effect||this.effect instanceof window.KeyframeEffect)&&(this._animation=b.newUnderlyingAnimationForKeyframeEffect(this.effect),b.bindAnimationForKeyframeEffect(this)),(this.effect instanceof window.SequenceEffect||this.effect instanceof window.GroupEffect)&&(this._animation=b.newUnderlyingAnimationForGroup(this.effect),b.bindAnimationForGroup(this)),this.effect&&this.effect._onsample&&b.bindAnimationForCustomEffect(this),f&&(1!=a&&(this.playbackRate=a),null!==d?this.startTime=d:null!==e?this.currentTime=e:null!==this._holdTime&&(this.currentTime=this._holdTime),c&&this.pause()),this._updatePromises()},_updateChildren:function(){if(this.effect&&"idle"!=this.playState){var a=this.effect._timing.delay;this._childAnimations.forEach(function(c){this._arrangeChildren(c,a),this.effect instanceof window.SequenceEffect&&(a+=b.groupChildDuration(c.effect))}.bind(this))}},_setExternalAnimation:function(a){if(this.effect&&this._isGroup)for(var b=0;b<this.effect.children.length;b++)this.effect.children[b]._animation=a,this._childAnimations[b]._setExternalAnimation(a)},_constructChildAnimations:function(){if(this.effect&&this._isGroup){var a=this.effect._timing.delay;this._removeChildAnimations(),this.effect.children.forEach(function(c){var d=window.document.timeline._play(c);this._childAnimations.push(d),d.playbackRate=this.playbackRate,this._paused&&d.pause(),c._animation=this.effect._animation,this._arrangeChildren(d,a),this.effect instanceof window.SequenceEffect&&(a+=b.groupChildDuration(c))}.bind(this))}},_arrangeChildren:function(a,b){null===this.startTime?a.currentTime=this.currentTime-b/this.playbackRate:a.startTime!==this.startTime+b/this.playbackRate&&(a.startTime=this.startTime+b/this.playbackRate)},get timeline(){return this._timeline},get playState(){return this._animation?this._animation.playState:"idle"},get finished(){return window.Promise?(this._finishedPromise||(-1==b.animationsWithPromises.indexOf(this)&&b.animationsWithPromises.push(this),this._finishedPromise=new Promise(function(a,b){this._resolveFinishedPromise=function(){a(this)},this._rejectFinishedPromise=function(){b({type:DOMException.ABORT_ERR,name:"AbortError"})}}.bind(this)),"finished"==this.playState&&this._resolveFinishedPromise()),this._finishedPromise):(console.warn("Animation Promises require JavaScript Promise constructor"),null)},get ready(){return window.Promise?(this._readyPromise||(-1==b.animationsWithPromises.indexOf(this)&&b.animationsWithPromises.push(this),this._readyPromise=new Promise(function(a,b){this._resolveReadyPromise=function(){a(this)},this._rejectReadyPromise=function(){b({type:DOMException.ABORT_ERR,name:"AbortError"})}}.bind(this)),"pending"!==this.playState&&this._resolveReadyPromise()),this._readyPromise):(console.warn("Animation Promises require JavaScript Promise constructor"),null)},get onfinish(){return this._animation.onfinish},set onfinish(a){"function"==typeof a?this._animation.onfinish=function(b){b.target=this,a.call(this,b)}.bind(this):this._animation.onfinish=a},get oncancel(){return this._animation.oncancel},set oncancel(a){"function"==typeof a?this._animation.oncancel=function(b){b.target=this,a.call(this,b)}.bind(this):this._animation.oncancel=a},get currentTime(){this._updatePromises();var a=this._animation.currentTime;return this._updatePromises(),a},set currentTime(a){this._updatePromises(),this._animation.currentTime=isFinite(a)?a:Math.sign(a)*Number.MAX_VALUE,this._register(),this._forEachChild(function(b,c){b.currentTime=a-c}),this._updatePromises()},get startTime(){return this._animation.startTime},set startTime(a){this._updatePromises(),this._animation.startTime=isFinite(a)?a:Math.sign(a)*Number.MAX_VALUE,this._register(),this._forEachChild(function(b,c){b.startTime=a+c}),this._updatePromises()},get playbackRate(){return this._animation.playbackRate},set playbackRate(a){this._updatePromises();var b=this.currentTime;this._animation.playbackRate=a,this._forEachChild(function(b){b.playbackRate=a}),"paused"!=this.playState&&"idle"!=this.playState&&this.play(),null!==b&&(this.currentTime=b),this._updatePromises()},play:function(){this._updatePromises(),this._paused=!1,this._animation.play(),-1==this._timeline._animations.indexOf(this)&&this._timeline._animations.push(this),this._register(),b.awaitStartTime(this),this._forEachChild(function(a){var b=a.currentTime;a.play(),a.currentTime=b}),this._updatePromises()},pause:function(){this._updatePromises(),this.currentTime&&(this._holdTime=this.currentTime),this._animation.pause(),this._register(),this._forEachChild(function(a){a.pause()}),this._paused=!0,this._updatePromises()},finish:function(){this._updatePromises(),this._animation.finish(),this._register(),this._updatePromises()},cancel:function(){this._updatePromises(),this._animation.cancel(),this._register(),this._removeChildAnimations(),this._updatePromises()},reverse:function(){this._updatePromises();var a=this.currentTime;this._animation.reverse(),this._forEachChild(function(a){a.reverse()}),null!==a&&(this.currentTime=a),this._updatePromises()},addEventListener:function(a,b){var c=b;"function"==typeof b&&(c=function(a){a.target=this,b.call(this,a)}.bind(this),b._wrapper=c),this._animation.addEventListener(a,c)},removeEventListener:function(a,b){this._animation.removeEventListener(a,b&&b._wrapper||b)},_removeChildAnimations:function(){for(;this._childAnimations.length;)this._childAnimations.pop().cancel()},_forEachChild:function(b){var c=0;if(this.effect.children&&this._childAnimations.length<this.effect.children.length&&this._constructChildAnimations(),this._childAnimations.forEach(function(a){b.call(this,a,c),this.effect instanceof window.SequenceEffect&&(c+=a.effect.activeDuration)}.bind(this)),"pending"!=this.playState){var d=this.effect._timing,e=this.currentTime;null!==e&&(e=a.calculateTimeFraction(a.calculateActiveDuration(d),e,d)),(null==e||isNaN(e))&&this._removeChildAnimations()}}},window.Animation=b.Animation}(c,e,f),function(a,b,c){function d(b){this._frames=a.normalizeKeyframes(b)}function e(){for(var a=!1;i.length;){var b=i.shift();b._updateChildren(),a=!0}return a}var f=function(a){if(a._animation=void 0,a instanceof window.SequenceEffect||a instanceof window.GroupEffect)for(var b=0;b<a.children.length;b++)f(a.children[b])};b.removeMulti=function(a){for(var b=[],c=0;c<a.length;c++){var d=a[c];d._parent?(-1==b.indexOf(d._parent)&&b.push(d._parent),d._parent.children.splice(d._parent.children.indexOf(d),1),d._parent=null,f(d)):d._animation&&d._animation.effect==d&&(d._animation.cancel(),d._animation.effect=new KeyframeEffect(null,[]),d._animation._callback&&(d._animation._callback._animation=null),d._animation._rebuildUnderlyingAnimation(),f(d))}for(c=0;c<b.length;c++)b[c]._rebuild()},b.KeyframeEffect=function(b,c,e,f){return this.target=b,this._parent=null,e=a.numericTimingToObject(e),this._timingInput=a.cloneTimingInput(e),this._timing=a.normalizeTimingInput(e),this.timing=a.makeTiming(e,!1,this),this.timing._effect=this,"function"==typeof c?(a.deprecated("Custom KeyframeEffect","2015-06-22","Use KeyframeEffect.onsample instead."),this._normalizedKeyframes=c):this._normalizedKeyframes=new d(c),this._keyframes=c,this.activeDuration=a.calculateActiveDuration(this._timing),this._id=f,this},b.KeyframeEffect.prototype={getFrames:function(){return"function"==typeof this._normalizedKeyframes?this._normalizedKeyframes:this._normalizedKeyframes._frames},set onsample(a){if("function"==typeof this.getFrames())throw new Error("Setting onsample on custom effect KeyframeEffect is not supported.");this._onsample=a,this._animation&&this._animation._rebuildUnderlyingAnimation()},get parent(){return this._parent},clone:function(){if("function"==typeof this.getFrames())throw new Error("Cloning custom effects is not supported.");var b=new KeyframeEffect(this.target,[],a.cloneTimingInput(this._timingInput),this._id);return b._normalizedKeyframes=this._normalizedKeyframes,b._keyframes=this._keyframes,b},remove:function(){b.removeMulti([this])}};var g=Element.prototype.animate;Element.prototype.animate=function(a,c){var d="";return c&&c.id&&(d=c.id),b.timeline._play(new b.KeyframeEffect(this,a,c,d))};var h=document.createElementNS("http://www.w3.org/1999/xhtml","div");b.newUnderlyingAnimationForKeyframeEffect=function(a){if(a){var b=a.target||h,c=a._keyframes;"function"==typeof c&&(c=[]);var d=a._timingInput;d.id=a._id}else var b=h,c=[],d=0;return g.apply(b,[c,d])},b.bindAnimationForKeyframeEffect=function(a){a.effect&&"function"==typeof a.effect._normalizedKeyframes&&b.bindAnimationForCustomEffect(a)};var i=[];b.awaitStartTime=function(a){null===a.startTime&&a._isGroup&&(0==i.length&&requestAnimationFrame(e),i.push(a))};var j=window.getComputedStyle;Object.defineProperty(window,"getComputedStyle",{configurable:!0,enumerable:!0,value:function(){window.document.timeline._updateAnimationsPromises();var a=j.apply(this,arguments);return e()&&(a=j.apply(this,arguments)),window.document.timeline._updateAnimationsPromises(),a}}),window.KeyframeEffect=b.KeyframeEffect,window.Element.prototype.getAnimations=function(){return document.timeline.getAnimations().filter(function(a){return null!==a.effect&&a.effect.target==this}.bind(this))}}(c,e,f),function(a,b,c){function d(a){a._registered||(a._registered=!0,g.push(a),h||(h=!0,requestAnimationFrame(e)))}function e(a){var b=g;g=[],b.sort(function(a,b){return a._sequenceNumber-b._sequenceNumber}),b=b.filter(function(a){a();var b=a._animation?a._animation.playState:"idle";return"running"!=b&&"pending"!=b&&(a._registered=!1),a._registered}),g.push.apply(g,b),g.length?(h=!0,requestAnimationFrame(e)):h=!1}var f=(document.createElementNS("http://www.w3.org/1999/xhtml","div"),0);b.bindAnimationForCustomEffect=function(b){var c,e=b.effect.target,g="function"==typeof b.effect.getFrames();c=g?b.effect.getFrames():b.effect._onsample;var h=b.effect.timing,i=null;h=a.normalizeTimingInput(h);var j=function(){var d=j._animation?j._animation.currentTime:null;null!==d&&(d=a.calculateTimeFraction(a.calculateActiveDuration(h),d,h),isNaN(d)&&(d=null)),d!==i&&(g?c(d,e,b.effect):c(d,b.effect,b.effect._animation)),i=d};j._animation=b,j._registered=!1,j._sequenceNumber=f++,b._callback=j,d(j)};var g=[],h=!1;b.Animation.prototype._register=function(){this._callback&&d(this._callback)}}(c,e,f),function(a,b,c){function d(a){return a._timing.delay+a.activeDuration+a._timing.endDelay}function e(b,c,d){this._id=d,this._parent=null,this.children=b||[],this._reparent(this.children),c=a.numericTimingToObject(c),this._timingInput=a.cloneTimingInput(c),this._timing=a.normalizeTimingInput(c,!0),this.timing=a.makeTiming(c,!0,this),this.timing._effect=this,"auto"===this._timing.duration&&(this._timing.duration=this.activeDuration)}window.SequenceEffect=function(){e.apply(this,arguments)},window.GroupEffect=function(){e.apply(this,arguments)},e.prototype={_isAncestor:function(a){for(var b=this;null!==b;){if(b==a)return!0;b=b._parent}return!1},_rebuild:function(){for(var a=this;a;)"auto"===a.timing.duration&&(a._timing.duration=a.activeDuration),a=a._parent;this._animation&&this._animation._rebuildUnderlyingAnimation()},_reparent:function(a){b.removeMulti(a);for(var c=0;c<a.length;c++)a[c]._parent=this},_putChild:function(a,b){for(var c=b?"Cannot append an ancestor or self":"Cannot prepend an ancestor or self",d=0;d<a.length;d++)if(this._isAncestor(a[d]))throw{type:DOMException.HIERARCHY_REQUEST_ERR,name:"HierarchyRequestError",message:c};for(var d=0;d<a.length;d++)b?this.children.push(a[d]):this.children.unshift(a[d]);this._reparent(a),this._rebuild()},append:function(){this._putChild(arguments,!0)},prepend:function(){this._putChild(arguments,!1)},get parent(){return this._parent},get firstChild(){return this.children.length?this.children[0]:null},get lastChild(){return this.children.length?this.children[this.children.length-1]:null},clone:function(){for(var b=a.cloneTimingInput(this._timingInput),c=[],d=0;d<this.children.length;d++)c.push(this.children[d].clone());return this instanceof GroupEffect?new GroupEffect(c,b):new SequenceEffect(c,b)},remove:function(){b.removeMulti([this])}},window.SequenceEffect.prototype=Object.create(e.prototype),Object.defineProperty(window.SequenceEffect.prototype,"activeDuration",{get:function(){var a=0;return this.children.forEach(function(b){a+=d(b)}),Math.max(a,0)}}),window.GroupEffect.prototype=Object.create(e.prototype),Object.defineProperty(window.GroupEffect.prototype,"activeDuration",{get:function(){var a=0;return this.children.forEach(function(b){a=Math.max(a,d(b))}),a}}),b.newUnderlyingAnimationForGroup=function(c){var d,e=null,f=function(b){var c=d._wrapper;return c&&"pending"!=c.playState&&c.effect?null==b?void c._removeChildAnimations():0==b&&c.playbackRate<0&&(e||(e=a.normalizeTimingInput(c.effect.timing)),b=a.calculateTimeFraction(a.calculateActiveDuration(e),-1,e),isNaN(b)||null==b)?(c._forEachChild(function(a){a.currentTime=-1}),void c._removeChildAnimations()):void 0:void 0},g=new KeyframeEffect(null,[],c._timing,c._id);return g.onsample=f,d=b.timeline._play(g)},b.bindAnimationForGroup=function(a){a._animation._wrapper=a,a._isGroup=!0,b.awaitStartTime(a),a._constructChildAnimations(),a._setExternalAnimation(a)},b.groupChildDuration=d}(c,e,f),b["true"]=a}({},function(){return this}());

/**
@license @nocompile
Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
(function(){/*

 Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
 This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
 The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
 Code distributed by Google as part of the polymer project is also
 subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
'use strict';var n,p="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this,aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};function ba(){ba=function(){};p.Symbol||(p.Symbol=ca)}var ca=function(){var a=0;return function(b){return"jscomp_symbol_"+(b||"")+a++}}();
function da(){ba();var a=p.Symbol.iterator;a||(a=p.Symbol.iterator=p.Symbol("iterator"));"function"!=typeof Array.prototype[a]&&aa(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return ea(this)}});da=function(){}}function ea(a){var b=0;return fa(function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}})}function fa(a){da();a={next:a};a[p.Symbol.iterator]=function(){return this};return a}function ia(a){da();var b=a[Symbol.iterator];return b?b.call(a):ea(a)}
function ja(a){for(var b,c=[];!(b=a.next()).done;)c.push(b.value);return c}
(function(){if(!function(){var a=document.createEvent("Event");a.initEvent("foo",!0,!0);a.preventDefault();return a.defaultPrevented}()){var a=Event.prototype.preventDefault;Event.prototype.preventDefault=function(){this.cancelable&&(a.call(this),Object.defineProperty(this,"defaultPrevented",{get:function(){return!0},configurable:!0}))}}var b=/Trident/.test(navigator.userAgent);if(!window.CustomEvent||b&&"function"!==typeof window.CustomEvent)window.CustomEvent=function(a,b){b=b||{};var c=document.createEvent("CustomEvent");
c.initCustomEvent(a,!!b.bubbles,!!b.cancelable,b.detail);return c},window.CustomEvent.prototype=window.Event.prototype;if(!window.Event||b&&"function"!==typeof window.Event){var c=window.Event;window.Event=function(a,b){b=b||{};var c=document.createEvent("Event");c.initEvent(a,!!b.bubbles,!!b.cancelable);return c};if(c)for(var d in c)window.Event[d]=c[d];window.Event.prototype=c.prototype}if(!window.MouseEvent||b&&"function"!==typeof window.MouseEvent){b=window.MouseEvent;window.MouseEvent=function(a,
b){b=b||{};var c=document.createEvent("MouseEvent");c.initMouseEvent(a,!!b.bubbles,!!b.cancelable,b.view||window,b.detail,b.screenX,b.screenY,b.clientX,b.clientY,b.ctrlKey,b.altKey,b.shiftKey,b.metaKey,b.button,b.relatedTarget);return c};if(b)for(d in b)window.MouseEvent[d]=b[d];window.MouseEvent.prototype=b.prototype}Array.from||(Array.from=function(a){return[].slice.call(a)});Object.assign||(Object.assign=function(a,b){for(var c=[].slice.call(arguments,1),d=0,e;d<c.length;d++)if(e=c[d])for(var f=
a,m=e,q=Object.getOwnPropertyNames(m),x=0;x<q.length;x++)e=q[x],f[e]=m[e];return a})})(window.WebComponents);(function(){function a(){}function b(a,b){if(!a.childNodes.length)return[];switch(a.nodeType){case Node.DOCUMENT_NODE:return ua.call(a,b);case Node.DOCUMENT_FRAGMENT_NODE:return lb.call(a,b);default:return U.call(a,b)}}var c="undefined"===typeof HTMLTemplateElement,d=!(document.createDocumentFragment().cloneNode()instanceof DocumentFragment),e=!1;/Trident/.test(navigator.userAgent)&&function(){function a(a,b){if(a instanceof DocumentFragment)for(var d;d=a.firstChild;)c.call(this,d,b);else c.call(this,
a,b);return a}e=!0;var b=Node.prototype.cloneNode;Node.prototype.cloneNode=function(a){a=b.call(this,a);this instanceof DocumentFragment&&(a.__proto__=DocumentFragment.prototype);return a};DocumentFragment.prototype.querySelectorAll=HTMLElement.prototype.querySelectorAll;DocumentFragment.prototype.querySelector=HTMLElement.prototype.querySelector;Object.defineProperties(DocumentFragment.prototype,{nodeType:{get:function(){return Node.DOCUMENT_FRAGMENT_NODE},configurable:!0},localName:{get:function(){},
configurable:!0},nodeName:{get:function(){return"#document-fragment"},configurable:!0}});var c=Node.prototype.insertBefore;Node.prototype.insertBefore=a;var d=Node.prototype.appendChild;Node.prototype.appendChild=function(b){b instanceof DocumentFragment?a.call(this,b,null):d.call(this,b);return b};var f=Node.prototype.removeChild,g=Node.prototype.replaceChild;Node.prototype.replaceChild=function(b,c){b instanceof DocumentFragment?(a.call(this,b,c),f.call(this,c)):g.call(this,b,c);return c};Document.prototype.createDocumentFragment=
function(){var a=this.createElement("df");a.__proto__=DocumentFragment.prototype;return a};var h=Document.prototype.importNode;Document.prototype.importNode=function(a,b){b=h.call(this,a,b||!1);a instanceof DocumentFragment&&(b.__proto__=DocumentFragment.prototype);return b}}();var f=Node.prototype.cloneNode,g=Document.prototype.createElement,h=Document.prototype.importNode,k=Node.prototype.removeChild,l=Node.prototype.appendChild,m=Node.prototype.replaceChild,q=DOMParser.prototype.parseFromString,
x=Object.getOwnPropertyDescriptor(window.HTMLElement.prototype,"innerHTML")||{get:function(){return this.innerHTML},set:function(a){this.innerHTML=a}},M=Object.getOwnPropertyDescriptor(window.Node.prototype,"childNodes")||{get:function(){return this.childNodes}},U=Element.prototype.querySelectorAll,ua=Document.prototype.querySelectorAll,lb=DocumentFragment.prototype.querySelectorAll,mb=function(){if(!c){var a=document.createElement("template"),b=document.createElement("template");b.content.appendChild(document.createElement("div"));
a.content.appendChild(b);a=a.cloneNode(!0);return 0===a.content.childNodes.length||0===a.content.firstChild.content.childNodes.length||d}}();if(c){var S=document.implementation.createHTMLDocument("template"),C=!0,V=document.createElement("style");V.textContent="template{display:none;}";var ha=document.head;ha.insertBefore(V,ha.firstElementChild);a.prototype=Object.create(HTMLElement.prototype);var va=!document.createElement("div").hasOwnProperty("innerHTML");a.G=function(b){if(!b.content&&b.namespaceURI===
document.documentElement.namespaceURI){b.content=S.createDocumentFragment();for(var c;c=b.firstChild;)l.call(b.content,c);if(va)b.__proto__=a.prototype;else if(b.cloneNode=function(b){return a.a(this,b)},C)try{P(b),W(b)}catch(Tg){C=!1}a.C(b.content)}};var X={option:["select"],thead:["table"],col:["colgroup","table"],tr:["tbody","table"],th:["tr","tbody","table"],td:["tr","tbody","table"]},P=function(b){Object.defineProperty(b,"innerHTML",{get:function(){return nb(this)},set:function(b){var c=X[(/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(b)||
["",""])[1].toLowerCase()];if(c)for(var d=0;d<c.length;d++)b="<"+c[d]+">"+b+"</"+c[d]+">";S.body.innerHTML=b;for(a.C(S);this.content.firstChild;)k.call(this.content,this.content.firstChild);b=S.body;if(c)for(d=0;d<c.length;d++)b=b.lastChild;for(;b.firstChild;)l.call(this.content,b.firstChild)},configurable:!0})},W=function(a){Object.defineProperty(a,"outerHTML",{get:function(){return"<template>"+this.innerHTML+"</template>"},set:function(a){if(this.parentNode){S.body.innerHTML=a;for(a=this.ownerDocument.createDocumentFragment();S.body.firstChild;)l.call(a,
S.body.firstChild);m.call(this.parentNode,a,this)}else throw Error("Failed to set the 'outerHTML' property on 'Element': This element has no parent node.");},configurable:!0})};P(a.prototype);W(a.prototype);a.C=function(c){c=b(c,"template");for(var d=0,e=c.length,f;d<e&&(f=c[d]);d++)a.G(f)};document.addEventListener("DOMContentLoaded",function(){a.C(document)});Document.prototype.createElement=function(){var b=g.apply(this,arguments);"template"===b.localName&&a.G(b);return b};DOMParser.prototype.parseFromString=
function(){var b=q.apply(this,arguments);a.C(b);return b};Object.defineProperty(HTMLElement.prototype,"innerHTML",{get:function(){return nb(this)},set:function(b){x.set.call(this,b);a.C(this)},configurable:!0,enumerable:!0});var Ve=/[&\u00A0"]/g,yc=/[&\u00A0<>]/g,zc=function(a){switch(a){case "&":return"&amp;";case "<":return"&lt;";case ">":return"&gt;";case '"':return"&quot;";case "\u00a0":return"&nbsp;"}};V=function(a){for(var b={},c=0;c<a.length;c++)b[a[c]]=!0;return b};var We=V("area base br col command embed hr img input keygen link meta param source track wbr".split(" ")),
Xe=V("style script xmp iframe noembed noframes plaintext noscript".split(" ")),nb=function(a,b){"template"===a.localName&&(a=a.content);for(var c="",d=b?b(a):M.get.call(a),e=0,f=d.length,g;e<f&&(g=d[e]);e++){a:{var h=g;var k=a;var l=b;switch(h.nodeType){case Node.ELEMENT_NODE:for(var P=h.localName,m="<"+P,W=h.attributes,q=0;k=W[q];q++)m+=" "+k.name+'="'+k.value.replace(Ve,zc)+'"';m+=">";h=We[P]?m:m+nb(h,l)+"</"+P+">";break a;case Node.TEXT_NODE:h=h.data;h=k&&Xe[k.localName]?h:h.replace(yc,zc);break a;
case Node.COMMENT_NODE:h="\x3c!--"+h.data+"--\x3e";break a;default:throw window.console.error(h),Error("not implemented");}}c+=h}return c}}if(c||mb){a.a=function(a,b){var c=f.call(a,!1);this.G&&this.G(c);b&&(l.call(c.content,f.call(a.content,!0)),ob(c.content,a.content));return c};var ob=function(c,d){if(d.querySelectorAll&&(d=b(d,"template"),0!==d.length)){c=b(c,"template");for(var e=0,f=c.length,g,h;e<f;e++)h=d[e],g=c[e],a&&a.G&&a.G(h),m.call(g.parentNode,Ye.call(h,!0),g)}},Ye=Node.prototype.cloneNode=
function(b){if(!e&&d&&this instanceof DocumentFragment)if(b)var c=Ze.call(this.ownerDocument,this,!0);else return this.ownerDocument.createDocumentFragment();else this.nodeType===Node.ELEMENT_NODE&&"template"===this.localName&&this.namespaceURI==document.documentElement.namespaceURI?c=a.a(this,b):c=f.call(this,b);b&&ob(c,this);return c},Ze=Document.prototype.importNode=function(c,d){d=d||!1;if("template"===c.localName)return a.a(c,d);var e=h.call(this,c,d);if(d){ob(e,c);c=b(e,'script:not([type]),script[type="application/javascript"],script[type="text/javascript"]');
for(var f,k=0;k<c.length;k++){f=c[k];d=g.call(document,"script");d.textContent=f.textContent;for(var l=f.attributes,P=0,W;P<l.length;P++)W=l[P],d.setAttribute(W.name,W.value);m.call(f.parentNode,d,f)}}return e}}c&&(window.HTMLTemplateElement=a)})();var ka=setTimeout;function la(){}function ma(a,b){return function(){a.apply(b,arguments)}}function r(a){if(!(this instanceof r))throw new TypeError("Promises must be constructed via new");if("function"!==typeof a)throw new TypeError("not a function");this.u=0;this.ma=!1;this.h=void 0;this.I=[];na(a,this)}
function oa(a,b){for(;3===a.u;)a=a.h;0===a.u?a.I.push(b):(a.ma=!0,pa(function(){var c=1===a.u?b.Na:b.Oa;if(null===c)(1===a.u?qa:ra)(b.ga,a.h);else{try{var d=c(a.h)}catch(e){ra(b.ga,e);return}qa(b.ga,d)}}))}function qa(a,b){try{if(b===a)throw new TypeError("A promise cannot be resolved with itself.");if(b&&("object"===typeof b||"function"===typeof b)){var c=b.then;if(b instanceof r){a.u=3;a.h=b;sa(a);return}if("function"===typeof c){na(ma(c,b),a);return}}a.u=1;a.h=b;sa(a)}catch(d){ra(a,d)}}
function ra(a,b){a.u=2;a.h=b;sa(a)}function sa(a){2===a.u&&0===a.I.length&&pa(function(){a.ma||"undefined"!==typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",a.h)});for(var b=0,c=a.I.length;b<c;b++)oa(a,a.I[b]);a.I=null}function ta(a,b,c){this.Na="function"===typeof a?a:null;this.Oa="function"===typeof b?b:null;this.ga=c}function na(a,b){var c=!1;try{a(function(a){c||(c=!0,qa(b,a))},function(a){c||(c=!0,ra(b,a))})}catch(d){c||(c=!0,ra(b,d))}}
r.prototype["catch"]=function(a){return this.then(null,a)};r.prototype.then=function(a,b){var c=new this.constructor(la);oa(this,new ta(a,b,c));return c};r.prototype["finally"]=function(a){var b=this.constructor;return this.then(function(c){return b.resolve(a()).then(function(){return c})},function(c){return b.resolve(a()).then(function(){return b.reject(c)})})};
function wa(a){return new r(function(b,c){function d(a,g){try{if(g&&("object"===typeof g||"function"===typeof g)){var h=g.then;if("function"===typeof h){h.call(g,function(b){d(a,b)},c);return}}e[a]=g;0===--f&&b(e)}catch(m){c(m)}}if(!a||"undefined"===typeof a.length)throw new TypeError("Promise.all accepts an array");var e=Array.prototype.slice.call(a);if(0===e.length)return b([]);for(var f=e.length,g=0;g<e.length;g++)d(g,e[g])})}
function xa(a){return a&&"object"===typeof a&&a.constructor===r?a:new r(function(b){b(a)})}function ya(a){return new r(function(b,c){c(a)})}function za(a){return new r(function(b,c){for(var d=0,e=a.length;d<e;d++)a[d].then(b,c)})}var pa="function"===typeof setImmediate&&function(a){setImmediate(a)}||function(a){ka(a,0)};/*

Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
if(!window.Promise){window.Promise=r;r.prototype.then=r.prototype.then;r.all=wa;r.race=za;r.resolve=xa;r.reject=ya;var Aa=document.createTextNode(""),Ba=[];(new MutationObserver(function(){for(var a=Ba.length,b=0;b<a;b++)Ba[b]();Ba.splice(0,a)})).observe(Aa,{characterData:!0});pa=function(a){Ba.push(a);Aa.textContent=0<Aa.textContent.length?"":"a"}};(function(a){function b(a,b){if("function"===typeof window.CustomEvent)return new CustomEvent(a,b);var c=document.createEvent("CustomEvent");c.initCustomEvent(a,!!b.bubbles,!!b.cancelable,b.detail);return c}function c(a){if(M)return a.ownerDocument!==document?a.ownerDocument:null;var b=a.__importDoc;if(!b&&a.parentNode){b=a.parentNode;if("function"===typeof b.closest)b=b.closest("link[rel=import]");else for(;!h(b)&&(b=b.parentNode););a.__importDoc=b}return b}function d(a){var b=m(document,"link[rel=import]:not([import-dependency])"),
c=b.length;c?q(b,function(b){return g(b,function(){0===--c&&a()})}):a()}function e(a){function b(){"loading"!==document.readyState&&document.body&&(document.removeEventListener("readystatechange",b),a())}document.addEventListener("readystatechange",b);b()}function f(a){e(function(){return d(function(){return a&&a()})})}function g(a,b){if(a.__loaded)b&&b();else if("script"===a.localName&&!a.src||"style"===a.localName&&!a.firstChild)a.__loaded=!0,b&&b();else{var c=function(d){a.removeEventListener(d.type,
c);a.__loaded=!0;b&&b()};a.addEventListener("load",c);ha&&"style"===a.localName||a.addEventListener("error",c)}}function h(a){return a.nodeType===Node.ELEMENT_NODE&&"link"===a.localName&&"import"===a.rel}function k(){var a=this;this.a={};this.b=0;this.c=new MutationObserver(function(b){return a.Ja(b)});this.c.observe(document.head,{childList:!0,subtree:!0});this.loadImports(document)}function l(a){q(m(a,"template"),function(a){q(m(a.content,'script:not([type]),script[type="application/javascript"],script[type="text/javascript"],script[type="module"]'),
function(a){var b=document.createElement("script");q(a.attributes,function(a){return b.setAttribute(a.name,a.value)});b.textContent=a.textContent;a.parentNode.replaceChild(b,a)});l(a.content)})}function m(a,b){return a.childNodes.length?a.querySelectorAll(b):U}function q(a,b,c){var d=a?a.length:0,e=c?-1:1;for(c=c?d-1:0;c<d&&0<=c;c+=e)b(a[c],c)}var x=document.createElement("link"),M="import"in x,U=x.querySelectorAll("*"),ua=null;!1==="currentScript"in document&&Object.defineProperty(document,"currentScript",
{get:function(){return ua||("complete"!==document.readyState?document.scripts[document.scripts.length-1]:null)},configurable:!0});var lb=/(url\()([^)]*)(\))/g,mb=/(@import[\s]+(?!url\())([^;]*)(;)/g,S=/(<link[^>]*)(rel=['|"]?stylesheet['|"]?[^>]*>)/g,C={Ea:function(a,b){a.href&&a.setAttribute("href",C.X(a.getAttribute("href"),b));a.src&&a.setAttribute("src",C.X(a.getAttribute("src"),b));if("style"===a.localName){var c=C.qa(a.textContent,b,lb);a.textContent=C.qa(c,b,mb)}},qa:function(a,b,c){return a.replace(c,
function(a,c,d,e){a=d.replace(/["']/g,"");b&&(a=C.X(a,b));return c+"'"+a+"'"+e})},X:function(a,b){if(void 0===C.aa){C.aa=!1;try{var c=new URL("b","http://a");c.pathname="c%20d";C.aa="http://a/c%20d"===c.href}catch(yc){}}if(C.aa)return(new URL(a,b)).href;c=C.xa;c||(c=document.implementation.createHTMLDocument("temp"),C.xa=c,c.ja=c.createElement("base"),c.head.appendChild(c.ja),c.ia=c.createElement("a"));c.ja.href=b;c.ia.href=a;return c.ia.href||a}},V={async:!0,load:function(a,b,c){if(a)if(a.match(/^data:/)){a=
a.split(",");var d=a[1];d=-1<a[0].indexOf(";base64")?atob(d):decodeURIComponent(d);b(d)}else{var e=new XMLHttpRequest;e.open("GET",a,V.async);e.onload=function(){var a=e.responseURL||e.getResponseHeader("Location");a&&0===a.indexOf("/")&&(a=(location.origin||location.protocol+"//"+location.host)+a);var d=e.response||e.responseText;304===e.status||0===e.status||200<=e.status&&300>e.status?b(d,a):c(d)};e.send()}else c("error: href must be specified")}},ha=/Trident/.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent);
k.prototype.loadImports=function(a){var b=this;a=m(a,"link[rel=import]");q(a,function(a){return b.g(a)})};k.prototype.g=function(a){var b=this,c=a.href;if(void 0!==this.a[c]){var d=this.a[c];d&&d.__loaded&&(a.__import=d,this.f(a))}else this.b++,this.a[c]="pending",V.load(c,function(a,d){a=b.Ka(a,d||c);b.a[c]=a;b.b--;b.loadImports(a);b.l()},function(){b.a[c]=null;b.b--;b.l()})};k.prototype.Ka=function(a,b){if(!a)return document.createDocumentFragment();ha&&(a=a.replace(S,function(a,b,c){return-1===
a.indexOf("type=")?b+" type=import-disable "+c:a}));var c=document.createElement("template");c.innerHTML=a;if(c.content)a=c.content,l(a);else for(a=document.createDocumentFragment();c.firstChild;)a.appendChild(c.firstChild);if(c=a.querySelector("base"))b=C.X(c.getAttribute("href"),b),c.removeAttribute("href");c=m(a,'link[rel=import],link[rel=stylesheet][href][type=import-disable],style:not([type]),link[rel=stylesheet][href]:not([type]),script:not([type]),script[type="application/javascript"],script[type="text/javascript"],script[type="module"]');
var d=0;q(c,function(a){g(a);C.Ea(a,b);a.setAttribute("import-dependency","");if("script"===a.localName&&!a.src&&a.textContent){if("module"===a.type)throw Error("Inline module scripts are not supported in HTML Imports.");a.setAttribute("src","data:text/javascript;charset=utf-8,"+encodeURIComponent(a.textContent+("\n//# sourceURL="+b+(d?"-"+d:"")+".js\n")));a.textContent="";d++}});return a};k.prototype.l=function(){var a=this;if(!this.b){this.c.disconnect();this.flatten(document);var b=!1,c=!1,d=function(){c&&
b&&(a.loadImports(document),a.b||(a.c.observe(document.head,{childList:!0,subtree:!0}),a.da()))};this.Ma(function(){c=!0;d()});this.La(function(){b=!0;d()})}};k.prototype.flatten=function(a){var b=this;a=m(a,"link[rel=import]");q(a,function(a){var c=b.a[a.href];(a.__import=c)&&c.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&(b.a[a.href]=a,a.readyState="loading",a.__import=a,b.flatten(c),a.appendChild(c))})};k.prototype.La=function(a){function b(e){if(e<d){var f=c[e],h=document.createElement("script");f.removeAttribute("import-dependency");
q(f.attributes,function(a){return h.setAttribute(a.name,a.value)});ua=h;f.parentNode.replaceChild(h,f);g(h,function(){ua=null;b(e+1)})}else a()}var c=m(document,"script[import-dependency]"),d=c.length;b(0)};k.prototype.Ma=function(a){var b=m(document,"style[import-dependency],link[rel=stylesheet][import-dependency]"),d=b.length;if(d){var e=ha&&!!document.querySelector("link[rel=stylesheet][href][type=import-disable]");q(b,function(b){g(b,function(){b.removeAttribute("import-dependency");0===--d&&
a()});if(e&&b.parentNode!==document.head){var f=document.createElement(b.localName);f.__appliedElement=b;f.setAttribute("type","import-placeholder");b.parentNode.insertBefore(f,b.nextSibling);for(f=c(b);f&&c(f);)f=c(f);f.parentNode!==document.head&&(f=null);document.head.insertBefore(b,f);b.removeAttribute("type")}})}else a()};k.prototype.da=function(){var a=this,b=m(document,"link[rel=import]");q(b,function(b){return a.f(b)},!0)};k.prototype.f=function(a){a.__loaded||(a.__loaded=!0,a.import&&(a.import.readyState=
"complete"),a.dispatchEvent(b(a.import?"load":"error",{bubbles:!1,cancelable:!1,detail:void 0})))};k.prototype.Ja=function(a){var b=this;q(a,function(a){return q(a.addedNodes,function(a){a&&a.nodeType===Node.ELEMENT_NODE&&(h(a)?b.g(a):b.loadImports(a))})})};var va=null;if(M)x=m(document,"link[rel=import]"),q(x,function(a){a.import&&"loading"===a.import.readyState||(a.__loaded=!0)}),x=function(a){a=a.target;h(a)&&(a.__loaded=!0)},document.addEventListener("load",x,!0),document.addEventListener("error",
x,!0);else{var X=Object.getOwnPropertyDescriptor(Node.prototype,"baseURI");Object.defineProperty((!X||X.configurable?Node:Element).prototype,"baseURI",{get:function(){var a=h(this)?this:c(this);return a?a.href:X&&X.get?X.get.call(this):(document.querySelector("base")||window.location).href},configurable:!0,enumerable:!0});Object.defineProperty(HTMLLinkElement.prototype,"import",{get:function(){return this.__import||null},configurable:!0,enumerable:!0});e(function(){va=new k})}f(function(){return document.dispatchEvent(b("HTMLImportsLoaded",
{cancelable:!0,bubbles:!0,detail:void 0}))});a.useNative=M;a.whenReady=f;a.importForElement=c;a.loadImports=function(a){va&&va.loadImports(a)}})(window.HTMLImports=window.HTMLImports||{});/*

 Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
 This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
 The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
 Code distributed by Google as part of the polymer project is also
 subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
window.WebComponents=window.WebComponents||{flags:{}};var Ca=document.querySelector('script[src*="webcomponents-lite.js"]'),Da=/wc-(.+)/,t={};if(!t.noOpts){location.search.slice(1).split("&").forEach(function(a){a=a.split("=");var b;a[0]&&(b=a[0].match(Da))&&(t[b[1]]=a[1]||!0)});if(Ca)for(var Ea=0,Fa=void 0;Fa=Ca.attributes[Ea];Ea++)"src"!==Fa.name&&(t[Fa.name]=Fa.value||!0);if(t.log&&t.log.split){var Ga=t.log.split(",");t.log={};Ga.forEach(function(a){t.log[a]=!0})}else t.log={}}
window.WebComponents.flags=t;var Ha=t.shadydom;Ha&&(window.ShadyDOM=window.ShadyDOM||{},window.ShadyDOM.force=Ha);var Ia=t.register||t.ce;Ia&&window.customElements&&(window.customElements.forcePolyfill=Ia);/*

Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
function Ja(){this.pa=this.root=null;this.T=!1;this.D=this.P=this.ca=this.assignedSlot=this.assignedNodes=this.H=null;this.childNodes=this.nextSibling=this.previousSibling=this.lastChild=this.firstChild=this.parentNode=this.K=void 0;this.ka=this.la=!1;this.O={}}Ja.prototype.toJSON=function(){return{}};function u(a){a.__shady||(a.__shady=new Ja);return a.__shady}function v(a){return a&&a.__shady};var w=window.ShadyDOM||{};w.Ga=!(!Element.prototype.attachShadow||!Node.prototype.getRootNode);var Ka=Object.getOwnPropertyDescriptor(Node.prototype,"firstChild");w.m=!!(Ka&&Ka.configurable&&Ka.get);w.ea=w.force||!w.Ga;w.J=w.noPatch||!1;w.oa=w.preferPerformance;function y(a){return(a=v(a))&&void 0!==a.firstChild}function z(a){return"ShadyRoot"===a.za}function La(a){return(a=(a=v(a))&&a.root)&&Ma(a)}
var Na=Element.prototype,Oa=Na.matches||Na.matchesSelector||Na.mozMatchesSelector||Na.msMatchesSelector||Na.oMatchesSelector||Na.webkitMatchesSelector,Pa=document.createTextNode(""),Qa=0,Ra=[];(new MutationObserver(function(){for(;Ra.length;)try{Ra.shift()()}catch(a){throw Pa.textContent=Qa++,a;}})).observe(Pa,{characterData:!0});function Sa(a){Ra.push(a);Pa.textContent=Qa++}var Ta=!!document.contains;function Ua(a,b){for(;b;){if(b==a)return!0;b=b.__shady_parentNode}return!1}
function Va(a){for(var b=a.length-1;0<=b;b--){var c=a[b],d=c.getAttribute("id")||c.getAttribute("name");d&&"length"!==d&&isNaN(d)&&(a[d]=c)}a.item=function(b){return a[b]};a.namedItem=function(b){if("length"!==b&&isNaN(b)&&a[b])return a[b];for(var c=ia(a),d=c.next();!d.done;d=c.next())if(d=d.value,(d.getAttribute("id")||d.getAttribute("name"))==b)return d;return null};return a}
function A(a,b,c,d){c=void 0===c?"":c;for(var e in b){var f=b[e];if(!(d&&0<=d.indexOf(e))){f.configurable=!0;var g=c+e;if(f.value)a[g]=f.value;else try{Object.defineProperty(a,g,f)}catch(h){}}}}function B(a){var b={};Object.getOwnPropertyNames(a).forEach(function(c){b[c]=Object.getOwnPropertyDescriptor(a,c)});return b};var Wa=[],Xa;function Ya(a){Xa||(Xa=!0,Sa(Za));Wa.push(a)}function Za(){Xa=!1;for(var a=!!Wa.length;Wa.length;)Wa.shift()();return a}Za.list=Wa;function $a(){this.a=!1;this.addedNodes=[];this.removedNodes=[];this.S=new Set}function ab(a){a.a||(a.a=!0,Sa(function(){a.flush()}))}$a.prototype.flush=function(){if(this.a){this.a=!1;var a=this.takeRecords();a.length&&this.S.forEach(function(b){b(a)})}};$a.prototype.takeRecords=function(){if(this.addedNodes.length||this.removedNodes.length){var a=[{addedNodes:this.addedNodes,removedNodes:this.removedNodes}];this.addedNodes=[];this.removedNodes=[];return a}return[]};
function bb(a,b){var c=u(a);c.H||(c.H=new $a);c.H.S.add(b);var d=c.H;return{ya:b,F:d,Aa:a,takeRecords:function(){return d.takeRecords()}}}function cb(a){var b=a&&a.F;b&&(b.S.delete(a.ya),b.S.size||(u(a.Aa).H=null))}
function db(a,b){var c=b.getRootNode();return a.map(function(a){var b=c===a.target.getRootNode();if(b&&a.addedNodes){if(b=Array.from(a.addedNodes).filter(function(a){return c===a.getRootNode()}),b.length)return a=Object.create(a),Object.defineProperty(a,"addedNodes",{value:b,configurable:!0}),a}else if(b)return a}).filter(function(a){return a})};var eb=/[&\u00A0"]/g,fb=/[&\u00A0<>]/g;function gb(a){switch(a){case "&":return"&amp;";case "<":return"&lt;";case ">":return"&gt;";case '"':return"&quot;";case "\u00a0":return"&nbsp;"}}function hb(a){for(var b={},c=0;c<a.length;c++)b[a[c]]=!0;return b}var ib=hb("area base br col command embed hr img input keygen link meta param source track wbr".split(" ")),jb=hb("style script xmp iframe noembed noframes plaintext noscript".split(" "));
function kb(a,b){"template"===a.localName&&(a=a.content);for(var c="",d=b?b(a):a.childNodes,e=0,f=d.length,g=void 0;e<f&&(g=d[e]);e++){a:{var h=g;var k=a,l=b;switch(h.nodeType){case Node.ELEMENT_NODE:k=h.localName;for(var m="<"+k,q=h.attributes,x=0,M;M=q[x];x++)m+=" "+M.name+'="'+M.value.replace(eb,gb)+'"';m+=">";h=ib[k]?m:m+kb(h,l)+"</"+k+">";break a;case Node.TEXT_NODE:h=h.data;h=k&&jb[k.localName]?h:h.replace(fb,gb);break a;case Node.COMMENT_NODE:h="\x3c!--"+h.data+"--\x3e";break a;default:throw window.console.error(h),
Error("not implemented");}}c+=h}return c};var pb=w.m,qb={querySelector:function(a){return this.__shady_native_querySelector(a)},querySelectorAll:function(a){return this.__shady_native_querySelectorAll(a)}},rb={};function sb(a){rb[a]=function(b){return b["__shady_native_"+a]}}function tb(a,b){A(a,b,"__shady_native_");for(var c in b)sb(c)}function D(a,b){b=void 0===b?[]:b;for(var c=0;c<b.length;c++){var d=b[c],e=Object.getOwnPropertyDescriptor(a,d);e&&(Object.defineProperty(a,"__shady_native_"+d,e),e.value?qb[d]||(qb[d]=e.value):sb(d))}}
var E=document.createTreeWalker(document,NodeFilter.SHOW_ALL,null,!1),F=document.createTreeWalker(document,NodeFilter.SHOW_ELEMENT,null,!1),ub=document.implementation.createHTMLDocument("inert");function vb(a){for(var b;b=a.__shady_native_firstChild;)a.__shady_native_removeChild(b)}var wb=["firstElementChild","lastElementChild","children","childElementCount"],xb=["querySelector","querySelectorAll"];
function yb(){var a=["dispatchEvent","addEventListener","removeEventListener"];window.EventTarget?D(window.EventTarget.prototype,a):(D(Node.prototype,a),D(Window.prototype,a));pb?D(Node.prototype,"parentNode firstChild lastChild previousSibling nextSibling childNodes parentElement textContent".split(" ")):tb(Node.prototype,{parentNode:{get:function(){E.currentNode=this;return E.parentNode()}},firstChild:{get:function(){E.currentNode=this;return E.firstChild()}},lastChild:{get:function(){E.currentNode=
this;return E.lastChild()}},previousSibling:{get:function(){E.currentNode=this;return E.previousSibling()}},nextSibling:{get:function(){E.currentNode=this;return E.nextSibling()}},childNodes:{get:function(){var a=[];E.currentNode=this;for(var c=E.firstChild();c;)a.push(c),c=E.nextSibling();return a}},parentElement:{get:function(){F.currentNode=this;return F.parentNode()}},textContent:{get:function(){switch(this.nodeType){case Node.ELEMENT_NODE:case Node.DOCUMENT_FRAGMENT_NODE:for(var a=document.createTreeWalker(this,
NodeFilter.SHOW_TEXT,null,!1),c="",d;d=a.nextNode();)c+=d.nodeValue;return c;default:return this.nodeValue}},set:function(a){if("undefined"===typeof a||null===a)a="";switch(this.nodeType){case Node.ELEMENT_NODE:case Node.DOCUMENT_FRAGMENT_NODE:vb(this);(0<a.length||this.nodeType===Node.ELEMENT_NODE)&&this.__shady_native_insertBefore(document.createTextNode(a),void 0);break;default:this.nodeValue=a}}}});D(Node.prototype,"appendChild insertBefore removeChild replaceChild cloneNode contains".split(" "));
a={firstElementChild:{get:function(){F.currentNode=this;return F.firstChild()}},lastElementChild:{get:function(){F.currentNode=this;return F.lastChild()}},children:{get:function(){var a=[];F.currentNode=this;for(var c=F.firstChild();c;)a.push(c),c=F.nextSibling();return Va(a)}},childElementCount:{get:function(){return this.children?this.children.length:0}}};pb?(D(Element.prototype,wb),D(Element.prototype,["previousElementSibling","nextElementSibling","innerHTML"]),Object.getOwnPropertyDescriptor(HTMLElement.prototype,
"children")&&D(HTMLElement.prototype,["children"]),Object.getOwnPropertyDescriptor(HTMLElement.prototype,"innerHTML")&&D(HTMLElement.prototype,["innerHTML"])):(tb(Element.prototype,a),tb(Element.prototype,{previousElementSibling:{get:function(){F.currentNode=this;return F.previousSibling()}},nextElementSibling:{get:function(){F.currentNode=this;return F.nextSibling()}},innerHTML:{get:function(){return kb(this,function(a){return a.__shady_native_childNodes})},set:function(a){var b="template"===this.localName?
this.content:this;vb(b);var d=this.localName||"div";d=this.namespaceURI&&this.namespaceURI!==ub.namespaceURI?ub.createElementNS(this.namespaceURI,d):ub.createElement(d);d.innerHTML=a;for(a="template"===this.localName?d.content:d;d=a.__shady_native_firstChild;)b.__shady_native_insertBefore(d,void 0)}}}));D(Element.prototype,"setAttribute getAttribute hasAttribute removeAttribute focus blur".split(" "));D(Element.prototype,xb);D(HTMLElement.prototype,["focus","blur","contains"]);pb&&D(HTMLElement.prototype,
["parentElement","children","innerHTML"]);window.HTMLTemplateElement&&D(window.HTMLTemplateElement.prototype,["innerHTML"]);pb?D(DocumentFragment.prototype,wb):tb(DocumentFragment.prototype,a);D(DocumentFragment.prototype,xb);pb?(D(Document.prototype,wb),D(Document.prototype,["activeElement"])):tb(Document.prototype,a);D(Document.prototype,["importNode","getElementById"]);D(Document.prototype,xb)};var zb=B({get childNodes(){return this.__shady_childNodes},get firstChild(){return this.__shady_firstChild},get lastChild(){return this.__shady_lastChild},get textContent(){return this.__shady_textContent},set textContent(a){this.__shady_textContent=a},get childElementCount(){return this.__shady_childElementCount},get children(){return this.__shady_children},get firstElementChild(){return this.__shady_firstElementChild},get lastElementChild(){return this.__shady_lastElementChild},get innerHTML(){return this.__shady_innerHTML},
set innerHTML(a){return this.__shady_innerHTML=a},get shadowRoot(){return this.__shady_shadowRoot}}),Ab=B({get parentElement(){return this.__shady_parentElement},get parentNode(){return this.__shady_parentNode},get nextSibling(){return this.__shady_nextSibling},get previousSibling(){return this.__shady_previousSibling},get nextElementSibling(){return this.__shady_nextElementSibling},get previousElementSibling(){return this.__shady_previousElementSibling},get className(){return this.__shady_className},
set className(a){return this.__shady_className=a}}),Bb;for(Bb in zb)zb[Bb].enumerable=!1;for(var Cb in Ab)Ab[Cb].enumerable=!1;var Db=w.m||w.J,Eb=Db?function(){}:function(a){var b=u(a);b.la||(b.la=!0,A(a,Ab))},Fb=Db?function(){}:function(a){var b=u(a);b.ka||(b.ka=!0,A(a,zb))};var Gb="__eventWrappers"+Date.now(),Hb=function(){var a=Object.getOwnPropertyDescriptor(Event.prototype,"composed");return a?function(b){return a.get.call(b)}:null}(),Ib={blur:!0,focus:!0,focusin:!0,focusout:!0,click:!0,dblclick:!0,mousedown:!0,mouseenter:!0,mouseleave:!0,mousemove:!0,mouseout:!0,mouseover:!0,mouseup:!0,wheel:!0,beforeinput:!0,input:!0,keydown:!0,keyup:!0,compositionstart:!0,compositionupdate:!0,compositionend:!0,touchstart:!0,touchend:!0,touchmove:!0,touchcancel:!0,pointerover:!0,
pointerenter:!0,pointerdown:!0,pointermove:!0,pointerup:!0,pointercancel:!0,pointerout:!0,pointerleave:!0,gotpointercapture:!0,lostpointercapture:!0,dragstart:!0,drag:!0,dragenter:!0,dragleave:!0,dragover:!0,drop:!0,dragend:!0,DOMActivate:!0,DOMFocusIn:!0,DOMFocusOut:!0,keypress:!0},Jb={DOMAttrModified:!0,DOMAttributeNameChanged:!0,DOMCharacterDataModified:!0,DOMElementNameChanged:!0,DOMNodeInserted:!0,DOMNodeInsertedIntoDocument:!0,DOMNodeRemoved:!0,DOMNodeRemovedFromDocument:!0,DOMSubtreeModified:!0};
function Kb(a){return a instanceof Node?a.__shady_getRootNode():a}function Lb(a,b){var c=[],d=a;for(a=Kb(a);d;)c.push(d),d.__shady_assignedSlot?d=d.__shady_assignedSlot:d.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&d.host&&(b||d!==a)?d=d.host:d=d.__shady_parentNode;c[c.length-1]===document&&c.push(window);return c}function Mb(a){a.__composedPath||(a.__composedPath=Lb(a.target,!0));return a.__composedPath}
function Nb(a,b){if(!z)return a;a=Lb(a,!0);for(var c=0,d,e=void 0,f,g=void 0;c<b.length;c++)if(d=b[c],f=Kb(d),f!==e&&(g=a.indexOf(f),e=f),!z(f)||-1<g)return d}function Ob(a){function b(b,d){b=new a(b,d);b.__composed=d&&!!d.composed;return b}b.__proto__=a;b.prototype=a.prototype;return b}var Pb={focus:!0,blur:!0};function Qb(a){return a.__target!==a.target||a.__relatedTarget!==a.relatedTarget}
function Rb(a,b,c){if(c=b.__handlers&&b.__handlers[a.type]&&b.__handlers[a.type][c])for(var d=0,e;(e=c[d])&&(!Qb(a)||a.target!==a.relatedTarget)&&(e.call(b,a),!a.__immediatePropagationStopped);d++);}
function Sb(a){var b=a.composedPath();Object.defineProperty(a,"currentTarget",{get:function(){return d},configurable:!0});for(var c=b.length-1;0<=c;c--){var d=b[c];Rb(a,d,"capture");if(a.Z)return}Object.defineProperty(a,"eventPhase",{get:function(){return Event.AT_TARGET}});var e;for(c=0;c<b.length;c++){d=b[c];var f=v(d);f=f&&f.root;if(0===c||f&&f===e)if(Rb(a,d,"bubble"),d!==window&&(e=d.__shady_getRootNode()),a.Z)break}}
function Tb(a,b,c,d,e,f){for(var g=0;g<a.length;g++){var h=a[g],k=h.type,l=h.capture,m=h.once,q=h.passive;if(b===h.node&&c===k&&d===l&&e===m&&f===q)return g}return-1}
function Ub(a,b,c){if(b){var d=typeof b;if("function"===d||"object"===d)if("object"!==d||b.handleEvent&&"function"===typeof b.handleEvent){if(Jb[a])return this.__shady_native_addEventListener(a,b,c);if(c&&"object"===typeof c){var e=!!c.capture;var f=!!c.once;var g=!!c.passive}else e=!!c,g=f=!1;var h=c&&c.$||this,k=b[Gb];if(k){if(-1<Tb(k,h,a,e,f,g))return}else b[Gb]=[];k=function(e){f&&this.__shady_removeEventListener(a,b,c);e.__target||Vb(e);if(h!==this){var g=Object.getOwnPropertyDescriptor(e,"currentTarget");
Object.defineProperty(e,"currentTarget",{get:function(){return h},configurable:!0})}e.__previousCurrentTarget=e.currentTarget;if(!z(h)||-1!=e.composedPath().indexOf(h))if(e.composed||-1<e.composedPath().indexOf(h))if(Qb(e)&&e.target===e.relatedTarget)e.eventPhase===Event.BUBBLING_PHASE&&e.stopImmediatePropagation();else if(e.eventPhase===Event.CAPTURING_PHASE||e.bubbles||e.target===h||h instanceof Window){var k="function"===d?b.call(h,e):b.handleEvent&&b.handleEvent(e);h!==this&&(g?(Object.defineProperty(e,
"currentTarget",g),g=null):delete e.currentTarget);return k}};b[Gb].push({node:h,type:a,capture:e,once:f,passive:g,Ya:k});Pb[a]?(this.__handlers=this.__handlers||{},this.__handlers[a]=this.__handlers[a]||{capture:[],bubble:[]},this.__handlers[a][e?"capture":"bubble"].push(k)):this.__shady_native_addEventListener(a,k,c)}}}
function Wb(a,b,c){if(b){if(Jb[a])return this.__shady_native_removeEventListener(a,b,c);if(c&&"object"===typeof c){var d=!!c.capture;var e=!!c.once;var f=!!c.passive}else d=!!c,f=e=!1;var g=c&&c.$||this,h=void 0;var k=null;try{k=b[Gb]}catch(l){}k&&(e=Tb(k,g,a,d,e,f),-1<e&&(h=k.splice(e,1)[0].Ya,k.length||(b[Gb]=void 0)));this.__shady_native_removeEventListener(a,h||b,c);h&&Pb[a]&&this.__handlers&&this.__handlers[a]&&(a=this.__handlers[a][d?"capture":"bubble"],h=a.indexOf(h),-1<h&&a.splice(h,1))}}
function Xb(){for(var a in Pb)window.__shady_native_addEventListener(a,function(a){a.__target||(Vb(a),Sb(a))},!0)}
var Yb=B({get composed(){void 0===this.__composed&&(Hb?this.__composed="focusin"===this.type||"focusout"===this.type||Hb(this):!1!==this.isTrusted&&(this.__composed=Ib[this.type]));return this.__composed||!1},composedPath:function(){this.__composedPath||(this.__composedPath=Lb(this.__target,this.composed));return this.__composedPath},get target(){return Nb(this.currentTarget||this.__previousCurrentTarget,this.composedPath())},get relatedTarget(){if(!this.__relatedTarget)return null;this.__relatedTargetComposedPath||
(this.__relatedTargetComposedPath=Lb(this.__relatedTarget,!0));return Nb(this.currentTarget||this.__previousCurrentTarget,this.__relatedTargetComposedPath)},stopPropagation:function(){Event.prototype.stopPropagation.call(this);this.Z=!0},stopImmediatePropagation:function(){Event.prototype.stopImmediatePropagation.call(this);this.Z=this.__immediatePropagationStopped=!0}});
function Vb(a){a.__target=a.target;a.__relatedTarget=a.relatedTarget;if(w.m){var b=Object.getPrototypeOf(a);if(!Object.hasOwnProperty(b,"__shady_patchedProto")){var c=Object.create(b);c.__shady_sourceProto=b;A(c,Yb);b.__shady_patchedProto=c}a.__proto__=b.__shady_patchedProto}else A(a,Yb)}var Zb=Ob(Event),$b=Ob(CustomEvent),ac=Ob(MouseEvent);
function bc(){if(!Hb&&Object.getOwnPropertyDescriptor(Event.prototype,"isTrusted")){var a=function(){var a=new MouseEvent("click",{bubbles:!0,cancelable:!0,composed:!0});this.__shady_dispatchEvent(a)};Element.prototype.click?Element.prototype.click=a:HTMLElement.prototype.click&&(HTMLElement.prototype.click=a)}}var cc=Object.getOwnPropertyNames(Document.prototype).filter(function(a){return"on"===a.substring(0,2)});function dc(a,b){return{index:a,L:[],R:b}}
function ec(a,b,c,d){var e=0,f=0,g=0,h=0,k=Math.min(b-e,d-f);if(0==e&&0==f)a:{for(g=0;g<k;g++)if(a[g]!==c[g])break a;g=k}if(b==a.length&&d==c.length){h=a.length;for(var l=c.length,m=0;m<k-g&&fc(a[--h],c[--l]);)m++;h=m}e+=g;f+=g;b-=h;d-=h;if(0==b-e&&0==d-f)return[];if(e==b){for(b=dc(e,0);f<d;)b.L.push(c[f++]);return[b]}if(f==d)return[dc(e,b-e)];k=e;g=f;d=d-g+1;h=b-k+1;b=Array(d);for(l=0;l<d;l++)b[l]=Array(h),b[l][0]=l;for(l=0;l<h;l++)b[0][l]=l;for(l=1;l<d;l++)for(m=1;m<h;m++)if(a[k+m-1]===c[g+l-1])b[l][m]=
b[l-1][m-1];else{var q=b[l-1][m]+1,x=b[l][m-1]+1;b[l][m]=q<x?q:x}k=b.length-1;g=b[0].length-1;d=b[k][g];for(a=[];0<k||0<g;)0==k?(a.push(2),g--):0==g?(a.push(3),k--):(h=b[k-1][g-1],l=b[k-1][g],m=b[k][g-1],q=l<m?l<h?l:h:m<h?m:h,q==h?(h==d?a.push(0):(a.push(1),d=h),k--,g--):q==l?(a.push(3),k--,d=l):(a.push(2),g--,d=m));a.reverse();b=void 0;k=[];for(g=0;g<a.length;g++)switch(a[g]){case 0:b&&(k.push(b),b=void 0);e++;f++;break;case 1:b||(b=dc(e,0));b.R++;e++;b.L.push(c[f]);f++;break;case 2:b||(b=dc(e,0));
b.R++;e++;break;case 3:b||(b=dc(e,0)),b.L.push(c[f]),f++}b&&k.push(b);return k}function fc(a,b){return a===b};function gc(a,b,c){Eb(a);c=c||null;var d=u(a),e=u(b),f=c?u(c):null;d.previousSibling=c?f.previousSibling:b.__shady_lastChild;if(f=v(d.previousSibling))f.nextSibling=a;if(f=v(d.nextSibling=c))f.previousSibling=a;d.parentNode=b;c?c===e.firstChild&&(e.firstChild=a):(e.lastChild=a,e.firstChild||(e.firstChild=a));e.childNodes=null}
function hc(a,b,c){Fb(b);var d=u(b);void 0!==d.firstChild&&(d.childNodes=null);if(a.nodeType===Node.DOCUMENT_FRAGMENT_NODE){d=a.__shady_childNodes;for(var e=0;e<d.length;e++)gc(d[e],b,c);a=u(a);b=void 0!==a.firstChild?null:void 0;a.firstChild=a.lastChild=b;a.childNodes=b}else gc(a,b,c)}
function ic(a,b){var c=u(a);b=u(b);a===b.firstChild&&(b.firstChild=c.nextSibling);a===b.lastChild&&(b.lastChild=c.previousSibling);a=c.previousSibling;var d=c.nextSibling;a&&(u(a).nextSibling=d);d&&(u(d).previousSibling=a);c.parentNode=c.previousSibling=c.nextSibling=void 0;void 0!==b.childNodes&&(b.childNodes=null)}
function jc(a){var b=u(a);if(void 0===b.firstChild){b.childNodes=null;var c=b.firstChild=a.__shady_native_firstChild||null;b.lastChild=a.__shady_native_lastChild||null;Fb(a);b=c;for(c=void 0;b;b=b.__shady_native_nextSibling){var d=u(b);d.parentNode=a;d.nextSibling=b.__shady_native_nextSibling||null;d.previousSibling=c||null;c=b;Eb(b)}}};var kc=null;function G(){kc||(kc=window.ShadyCSS&&window.ShadyCSS.ScopingShim);return kc||null}function lc(a,b){var c=G();c&&c.unscopeNode(a,b)}function mc(a,b){var c=G();if(!c)return!0;if(a.nodeType===Node.DOCUMENT_FRAGMENT_NODE){c=!0;a=a.__shady_childNodes;for(var d=0;c&&d<a.length;d++)c=c&&mc(a[d],b);return c}return a.nodeType!==Node.ELEMENT_NODE?!0:c.currentScopeForNode(a)===b}function nc(a){if(a.nodeType!==Node.ELEMENT_NODE)return"";var b=G();return b?b.currentScopeForNode(a):""}
function oc(a,b){if(a){a.nodeType===Node.ELEMENT_NODE&&b(a);a=a.__shady_childNodes;for(var c=0,d;c<a.length;c++)d=a[c],d.nodeType===Node.ELEMENT_NODE&&oc(d,b)}};var pc=window.document,qc=w.oa,rc=Object.getOwnPropertyDescriptor(Node.prototype,"isConnected"),sc=rc&&rc.get;function tc(a){for(var b;b=a.__shady_firstChild;)a.__shady_removeChild(b)}function uc(a){var b=v(a);if(b&&void 0!==b.K){b=a.__shady_childNodes;for(var c=0,d=b.length,e=void 0;c<d&&(e=b[c]);c++)uc(e)}if(a=v(a))a.K=void 0}function vc(a){var b=a;a&&"slot"===a.localName&&(b=(b=(b=v(a))&&b.D)&&b.length?b[0]:vc(a.__shady_nextSibling));return b}
function wc(a,b,c){if(a=(a=v(a))&&a.H)b&&a.addedNodes.push(b),c&&a.removedNodes.push(c),ab(a)}
var Cc=B({get parentNode(){var a=v(this);a=a&&a.parentNode;return void 0!==a?a:this.__shady_native_parentNode},get firstChild(){var a=v(this);a=a&&a.firstChild;return void 0!==a?a:this.__shady_native_firstChild},get lastChild(){var a=v(this);a=a&&a.lastChild;return void 0!==a?a:this.__shady_native_lastChild},get nextSibling(){var a=v(this);a=a&&a.nextSibling;return void 0!==a?a:this.__shady_native_nextSibling},get previousSibling(){var a=v(this);a=a&&a.previousSibling;return void 0!==a?a:this.__shady_native_previousSibling},
get childNodes(){if(y(this)){var a=v(this);if(!a.childNodes){a.childNodes=[];for(var b=this.__shady_firstChild;b;b=b.__shady_nextSibling)a.childNodes.push(b)}var c=a.childNodes}else c=this.__shady_native_childNodes;c.item=function(a){return c[a]};return c},get parentElement(){var a=v(this);(a=a&&a.parentNode)&&a.nodeType!==Node.ELEMENT_NODE&&(a=null);return void 0!==a?a:this.__shady_native_parentElement},get isConnected(){if(sc&&sc.call(this))return!0;if(this.nodeType==Node.DOCUMENT_FRAGMENT_NODE)return!1;
var a=this.ownerDocument;if(Ta){if(a.__shady_native_contains(this))return!0}else if(a.documentElement&&a.documentElement.__shady_native_contains(this))return!0;for(a=this;a&&!(a instanceof Document);)a=a.__shady_parentNode||(z(a)?a.host:void 0);return!!(a&&a instanceof Document)},get textContent(){if(y(this)){for(var a=[],b=0,c=this.__shady_childNodes,d;d=c[b];b++)d.nodeType!==Node.COMMENT_NODE&&a.push(d.__shady_textContent);return a.join("")}return this.__shady_native_textContent},set textContent(a){if("undefined"===
typeof a||null===a)a="";switch(this.nodeType){case Node.ELEMENT_NODE:case Node.DOCUMENT_FRAGMENT_NODE:if(!y(this)&&w.m){var b=this.__shady_firstChild;(b!=this.__shady_lastChild||b&&b.nodeType!=Node.TEXT_NODE)&&tc(this);this.__shady_native_textContent=a}else tc(this),(0<a.length||this.nodeType===Node.ELEMENT_NODE)&&this.__shady_insertBefore(document.createTextNode(a));break;default:this.nodeValue=a}},insertBefore:function(a,b){if(this.ownerDocument!==pc&&a.ownerDocument!==pc)return this.__shady_native_insertBefore(a,
b),a;if(a===this)throw Error("Failed to execute 'appendChild' on 'Node': The new child element contains the parent.");if(b){var c=v(b);c=c&&c.parentNode;if(void 0!==c&&c!==this||void 0===c&&b.__shady_native_parentNode!==this)throw Error("Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.");}if(b===a)return a;var d=[],e=(c=xc(this))?c.host.localName:nc(this),f=a.__shady_parentNode;if(f){var g=nc(a);f.__shady_removeChild(a,!!c||
!xc(a))}f=!0;var h=(!qc||void 0===a.__noInsertionPoint)&&!mc(a,e),k=c&&!a.__noInsertionPoint&&(!qc||a.nodeType===Node.DOCUMENT_FRAGMENT_NODE);if(k||h)h&&(g=g||nc(a)),oc(a,function(a){k&&"slot"===a.localName&&d.push(a);if(h){var b=g;G()&&(b&&lc(a,b),(b=G())&&b.scopeNode(a,e))}});if("slot"===this.localName||d.length)d.length&&(c.c=c.c||[],c.a=c.a||[],c.b=c.b||{},c.c.push.apply(c.c,d instanceof Array?d:ja(ia(d)))),c&&Ac(c);y(this)&&(hc(a,this,b),c=v(this),La(this)?(Ac(c.root),f=!1):c.root&&(f=!1));f?
(c=z(this)?this.host:this,b?(b=vc(b),c.__shady_native_insertBefore(a,b)):c.__shady_native_appendChild(a)):a.ownerDocument!==this.ownerDocument&&this.ownerDocument.adoptNode(a);wc(this,a);return a},appendChild:function(a){return this.__shady_insertBefore(a)},removeChild:function(a,b){b=void 0===b?!1:b;if(this.ownerDocument!==pc)return this.__shady_native_removeChild(a);if(a.__shady_parentNode!==this)throw Error("The node to be removed is not a child of this node: "+a);var c=xc(a),d=c&&Bc(c,a),e=v(this);
if(y(this)&&(ic(a,this),La(this))){Ac(e.root);var f=!0}if(G()&&!b&&c){var g=nc(a);oc(a,function(a){lc(a,g)})}uc(a);c&&((b=this&&"slot"===this.localName)&&(f=!0),(d||b)&&Ac(c));f||(f=z(this)?this.host:this,(!e.root&&"slot"!==a.localName||f===a.__shady_native_parentNode)&&f.__shady_native_removeChild(a));wc(this,null,a);return a},replaceChild:function(a,b){this.__shady_insertBefore(a,b);this.__shady_removeChild(b);return a},cloneNode:function(a){if("template"==this.localName)return this.__shady_native_cloneNode(a);
var b=this.__shady_native_cloneNode(!1);if(a&&b.nodeType!==Node.ATTRIBUTE_NODE){a=this.__shady_childNodes;for(var c=0,d;c<a.length;c++)d=a[c].__shady_cloneNode(!0),b.__shady_appendChild(d)}return b},getRootNode:function(a){if(this&&this.nodeType){var b=u(this),c=b.K;void 0===c&&(z(this)?(c=this,b.K=c):(c=(c=this.__shady_parentNode)?c.__shady_getRootNode(a):this,document.documentElement.__shady_native_contains(this)&&(b.K=c)));return c}},contains:function(a){return Ua(this,a)}});function Dc(a,b,c){var d=[];Ec(a.__shady_childNodes,b,c,d);return d}function Ec(a,b,c,d){for(var e=0,f=a.length,g=void 0;e<f&&(g=a[e]);e++){var h;if(h=g.nodeType===Node.ELEMENT_NODE){h=g;var k=b,l=c,m=d,q=k(h);q&&m.push(h);l&&l(q)?h=q:(Ec(h.__shady_childNodes,k,l,m),h=void 0)}if(h)break}}
var Fc=B({get firstElementChild(){var a=v(this);if(a&&void 0!==a.firstChild){for(a=this.__shady_firstChild;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.__shady_nextSibling;return a}return this.__shady_native_firstElementChild},get lastElementChild(){var a=v(this);if(a&&void 0!==a.lastChild){for(a=this.__shady_lastChild;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.__shady_previousSibling;return a}return this.__shady_native_lastElementChild},get children(){return y(this)?Va(Array.prototype.filter.call(this.__shady_childNodes,
function(a){return a.nodeType===Node.ELEMENT_NODE})):this.__shady_native_children},get childElementCount(){var a=this.__shady_children;return a?a.length:0}}),Gc=B({querySelector:function(a){return Dc(this,function(b){return Oa.call(b,a)},function(a){return!!a})[0]||null},querySelectorAll:function(a,b){if(b){b=Array.prototype.slice.call(this.__shady_native_querySelectorAll(a));var c=this.__shady_getRootNode();return b.filter(function(a){return a.__shady_getRootNode()==c})}return Dc(this,function(b){return Oa.call(b,
a)})}}),Hc=w.oa?Object.assign({},Fc):Fc;Object.assign(Fc,Gc);var Ic=B({getElementById:function(a){return""===a?null:Dc(this,function(b){return b.id==a},function(a){return!!a})[0]||null}});var Jc=B({get activeElement(){var a=w.m?document.__shady_native_activeElement:document.activeElement;if(!a||!a.nodeType)return null;var b=!!z(this);if(!(this===document||b&&this.host!==a&&this.host.__shady_native_contains(a)))return null;for(b=xc(a);b&&b!==this;)a=b.host,b=xc(a);return this===document?b?null:a:b===this?a:null}});var Kc=document.implementation.createHTMLDocument("inert"),Lc=B({get innerHTML(){return y(this)?kb("template"===this.localName?this.content:this,function(a){return a.__shady_childNodes}):this.__shady_native_innerHTML},set innerHTML(a){if("template"===this.localName)this.__shady_native_innerHTML=a;else{tc(this);var b=this.localName||"div";b=this.namespaceURI&&this.namespaceURI!==Kc.namespaceURI?Kc.createElementNS(this.namespaceURI,b):Kc.createElement(b);for(w.m?b.__shady_native_innerHTML=a:b.innerHTML=
a;a=b.__shady_firstChild;)this.__shady_insertBefore(a)}}});var Mc=B({addEventListener:function(a,b,c){"object"!==typeof c&&(c={capture:!!c});c.$=this;this.host.__shady_addEventListener(a,b,c)},removeEventListener:function(a,b,c){"object"!==typeof c&&(c={capture:!!c});c.$=this;this.host.__shady_removeEventListener(a,b,c)}});function Nc(a,b){A(a,Mc,b);A(a,Jc,b);A(a,Lc,b);A(a,Fc,b);w.J&&!b?(A(a,Cc,b),A(a,Ic,b)):w.m||(A(a,Ab),A(a,zb))};var Oc={},Pc=w.deferConnectionCallbacks&&"loading"===document.readyState,Qc;function Rc(a){var b=[];do b.unshift(a);while(a=a.__shady_parentNode);return b}
function Sc(a,b,c){if(a!==Oc)throw new TypeError("Illegal constructor");this.za="ShadyRoot";this.host=b;this.mode=c&&c.mode;jc(b);a=u(b);a.root=this;a.pa="closed"!==this.mode?this:null;a=u(this);a.firstChild=a.lastChild=a.parentNode=a.nextSibling=a.previousSibling=null;a.childNodes=[];this.ba=this.B=!1;this.c=this.b=this.a=null;if(w.preferPerformance)for(;a=b.__shady_native_firstChild;)b.__shady_native_removeChild(a);else Ac(this)}function Ac(a){a.B||(a.B=!0,Ya(function(){return Tc(a)}))}
function Tc(a){var b;if(b=a.B){for(var c;a;)a:{a.B&&(c=a),b=a;a=b.host.__shady_getRootNode();if(z(a)&&(b=v(b.host))&&0<b.N)break a;a=void 0}b=c}(c=b)&&c._renderSelf()}
Sc.prototype._renderSelf=function(){var a=Pc;Pc=!0;this.B=!1;if(this.a){Uc(this);for(var b=0,c;b<this.a.length;b++){c=this.a[b];var d=v(c),e=d.assignedNodes;d.assignedNodes=[];d.D=[];if(d.ca=e)for(d=0;d<e.length;d++){var f=v(e[d]);f.P=f.assignedSlot;f.assignedSlot===c&&(f.assignedSlot=null)}}for(b=this.host.__shady_firstChild;b;b=b.__shady_nextSibling)Vc(this,b);for(b=0;b<this.a.length;b++){c=this.a[b];e=v(c);if(!e.assignedNodes.length)for(d=c.__shady_firstChild;d;d=d.__shady_nextSibling)Vc(this,
d,c);(d=(d=v(c.__shady_parentNode))&&d.root)&&(Ma(d)||d.B)&&d._renderSelf();Wc(this,e.D,e.assignedNodes);if(d=e.ca){for(f=0;f<d.length;f++)v(d[f]).P=null;e.ca=null;d.length>e.assignedNodes.length&&(e.T=!0)}e.T&&(e.T=!1,Xc(this,c))}c=this.a;b=[];for(e=0;e<c.length;e++)d=c[e].__shady_parentNode,(f=v(d))&&f.root||!(0>b.indexOf(d))||b.push(d);for(c=0;c<b.length;c++){f=b[c];e=f===this?this.host:f;d=[];f=f.__shady_childNodes;for(var g=0;g<f.length;g++){var h=f[g];if("slot"==h.localName){h=v(h).D;for(var k=
0;k<h.length;k++)d.push(h[k])}else d.push(h)}f=Array.prototype.slice.call(e.__shady_native_childNodes);g=ec(d,d.length,f,f.length);k=h=0;for(var l=void 0;h<g.length&&(l=g[h]);h++){for(var m=0,q=void 0;m<l.L.length&&(q=l.L[m]);m++)q.__shady_native_parentNode===e&&e.__shady_native_removeChild(q),f.splice(l.index+k,1);k-=l.R}k=0;for(l=void 0;k<g.length&&(l=g[k]);k++)for(h=f[l.index],m=l.index;m<l.index+l.R;m++)q=d[m],e.__shady_native_insertBefore(q,h),f.splice(m,0,q)}}if(!w.preferPerformance&&!this.ba)for(b=
this.host.__shady_childNodes,c=0,e=b.length;c<e;c++)d=b[c],f=v(d),d.__shady_native_parentNode!==this.host||"slot"!==d.localName&&f.assignedSlot||this.host.__shady_native_removeChild(d);this.ba=!0;Pc=a;Qc&&Qc()};function Vc(a,b,c){var d=u(b),e=d.P;d.P=null;c||(c=(a=a.b[b.__shady_slot||"__catchall"])&&a[0]);c?(u(c).assignedNodes.push(b),d.assignedSlot=c):d.assignedSlot=void 0;e!==d.assignedSlot&&d.assignedSlot&&(u(d.assignedSlot).T=!0)}
function Wc(a,b,c){for(var d=0,e=void 0;d<c.length&&(e=c[d]);d++)if("slot"==e.localName){var f=v(e).assignedNodes;f&&f.length&&Wc(a,b,f)}else b.push(c[d])}function Xc(a,b){b.__shady_native_dispatchEvent(new Event("slotchange"));b=v(b);b.assignedSlot&&Xc(a,b.assignedSlot)}
function Uc(a){if(a.c&&a.c.length){for(var b=a.c,c,d=0;d<b.length;d++){var e=b[d];jc(e);var f=e.__shady_parentNode;jc(f);f=v(f);f.N=(f.N||0)+1;f=Yc(e);a.b[f]?(c=c||{},c[f]=!0,a.b[f].push(e)):a.b[f]=[e];a.a.push(e)}if(c)for(var g in c)a.b[g]=Zc(a.b[g]);a.c=[]}}function Yc(a){var b=a.name||a.getAttribute("name")||"__catchall";return a.wa=b}
function Zc(a){return a.sort(function(a,c){a=Rc(a);for(var b=Rc(c),e=0;e<a.length;e++){c=a[e];var f=b[e];if(c!==f)return a=Array.from(c.__shady_parentNode.__shady_childNodes),a.indexOf(c)-a.indexOf(f)}})}
function Bc(a,b){if(a.a){Uc(a);var c=a.b,d;for(d in c)for(var e=c[d],f=0;f<e.length;f++){var g=e[f];if(Ua(b,g)){e.splice(f,1);var h=a.a.indexOf(g);0<=h&&(a.a.splice(h,1),(h=v(g.__shady_parentNode))&&h.N&&h.N--);f--;g=v(g);if(h=g.D)for(var k=0;k<h.length;k++){var l=h[k],m=l.__shady_native_parentNode;m&&m.__shady_native_removeChild(l)}g.D=[];g.assignedNodes=[];h=!0}}return h}}function Ma(a){Uc(a);return!(!a.a||!a.a.length)}
(function(a){a.__proto__=DocumentFragment.prototype;Nc(a,"__shady_");Nc(a);Object.defineProperties(a,{nodeType:{value:Node.DOCUMENT_FRAGMENT_NODE,configurable:!0},nodeName:{value:"#document-fragment",configurable:!0},nodeValue:{value:null,configurable:!0}});["localName","namespaceURI","prefix"].forEach(function(b){Object.defineProperty(a,b,{value:void 0,configurable:!0})});["ownerDocument","baseURI","isConnected"].forEach(function(b){Object.defineProperty(a,b,{get:function(){return this.host[b]},
configurable:!0})})})(Sc.prototype);
if(window.customElements&&w.ea&&!w.preferPerformance){var $c=new Map;Qc=function(){var a=[];$c.forEach(function(b,c){a.push([c,b])});$c.clear();for(var b=0;b<a.length;b++){var c=a[b][0];a[b][1]?c.ua():c.va()}};Pc&&document.addEventListener("readystatechange",function(){Pc=!1;Qc()},{once:!0});var ad=function(a,b,c){var d=0,e="__isConnected"+d++;if(b||c)a.prototype.connectedCallback=a.prototype.ua=function(){Pc?$c.set(this,!0):this[e]||(this[e]=!0,b&&b.call(this))},a.prototype.disconnectedCallback=
a.prototype.va=function(){Pc?this.isConnected||$c.set(this,!1):this[e]&&(this[e]=!1,c&&c.call(this))};return a},bd=window.customElements.define;Object.defineProperty(window.CustomElementRegistry.prototype,"define",{value:function(a,b){var c=b.prototype.connectedCallback,d=b.prototype.disconnectedCallback;bd.call(window.customElements,a,ad(b,c,d));b.prototype.connectedCallback=c;b.prototype.disconnectedCallback=d}})}function xc(a){a=a.__shady_getRootNode();if(z(a))return a};function cd(a){this.node=a}n=cd.prototype;n.addEventListener=function(a,b,c){return this.node.__shady_addEventListener(a,b,c)};n.removeEventListener=function(a,b,c){return this.node.__shady_removeEventListener(a,b,c)};n.appendChild=function(a){return this.node.__shady_appendChild(a)};n.insertBefore=function(a,b){return this.node.__shady_insertBefore(a,b)};n.removeChild=function(a){return this.node.__shady_removeChild(a)};n.replaceChild=function(a,b){return this.node.__shady_replaceChild(a,b)};
n.cloneNode=function(a){return this.node.__shady_cloneNode(a)};n.getRootNode=function(a){return this.node.__shady_getRootNode(a)};n.contains=function(a){return this.node.__shady_contains(a)};n.dispatchEvent=function(a){return this.node.__shady_dispatchEvent(a)};n.setAttribute=function(a,b){this.node.__shady_setAttribute(a,b)};n.getAttribute=function(a){return this.node.__shady_native_getAttribute(a)};n.hasAttribute=function(a){return this.node.__shady_native_hasAttribute(a)};n.removeAttribute=function(a){this.node.__shady_removeAttribute(a)};
n.attachShadow=function(a){return this.node.__shady_attachShadow(a)};n.focus=function(){this.node.__shady_native_focus()};n.blur=function(){this.node.__shady_blur()};n.importNode=function(a,b){if(this.node.nodeType===Node.DOCUMENT_NODE)return this.node.__shady_importNode(a,b)};n.getElementById=function(a){if(this.node.nodeType===Node.DOCUMENT_NODE)return this.node.__shady_getElementById(a)};n.querySelector=function(a){return this.node.__shady_querySelector(a)};
n.querySelectorAll=function(a,b){return this.node.__shady_querySelectorAll(a,b)};n.assignedNodes=function(a){if("slot"===this.node.localName)return this.node.__shady_assignedNodes(a)};
p.Object.defineProperties(cd.prototype,{activeElement:{configurable:!0,enumerable:!0,get:function(){if(z(this.node)||this.node.nodeType===Node.DOCUMENT_NODE)return this.node.__shady_activeElement}},_activeElement:{configurable:!0,enumerable:!0,get:function(){return this.activeElement}},host:{configurable:!0,enumerable:!0,get:function(){if(z(this.node))return this.node.host}},parentNode:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_parentNode}},firstChild:{configurable:!0,
enumerable:!0,get:function(){return this.node.__shady_firstChild}},lastChild:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_lastChild}},nextSibling:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_nextSibling}},previousSibling:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_previousSibling}},childNodes:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_childNodes}},parentElement:{configurable:!0,enumerable:!0,
get:function(){return this.node.__shady_parentElement}},firstElementChild:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_firstElementChild}},lastElementChild:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_lastElementChild}},nextElementSibling:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_nextElementSibling}},previousElementSibling:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_previousElementSibling}},
children:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_children}},childElementCount:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_childElementCount}},shadowRoot:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_shadowRoot}},assignedSlot:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_assignedSlot}},isConnected:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_isConnected}},innerHTML:{configurable:!0,
enumerable:!0,get:function(){return this.node.__shady_innerHTML},set:function(a){this.node.__shady_innerHTML=a}},textContent:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_textContent},set:function(a){this.node.__shady_textContent=a}},slot:{configurable:!0,enumerable:!0,get:function(){return this.node.__shady_slot},set:function(a){this.node.__shady_slot=a}}});
cc.forEach(function(a){Object.defineProperty(cd.prototype,a,{get:function(){return this.node["__shady_"+a]},set:function(b){this.node["__shady_"+a]=b},configurable:!0})});var dd=new WeakMap;function ed(a){if(z(a)||a instanceof cd)return a;var b=dd.get(a);b||(b=new cd(a),dd.set(a,b));return b};var fd=B({dispatchEvent:function(a){Za();return this.__shady_native_dispatchEvent(a)},addEventListener:Ub,removeEventListener:Wb});var gd=B({get assignedSlot(){var a=this.__shady_parentNode;(a=a&&a.__shady_shadowRoot)&&Tc(a);return(a=v(this))&&a.assignedSlot||null}});var hd=window.document;function id(a,b){if("slot"===b)a=a.__shady_parentNode,La(a)&&Ac(v(a).root);else if("slot"===a.localName&&"name"===b&&(b=xc(a))){if(b.a){Uc(b);var c=a.wa,d=Yc(a);if(d!==c){c=b.b[c];var e=c.indexOf(a);0<=e&&c.splice(e,1);c=b.b[d]||(b.b[d]=[]);c.push(a);1<c.length&&(b.b[d]=Zc(c))}}Ac(b)}}
var jd=B({get previousElementSibling(){var a=v(this);if(a&&void 0!==a.previousSibling){for(a=this.__shady_previousSibling;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.__shady_previousSibling;return a}return this.__shady_native_previousElementSibling},get nextElementSibling(){var a=v(this);if(a&&void 0!==a.nextSibling){for(a=this.__shady_nextSibling;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.__shady_nextSibling;return a}return this.__shady_native_nextElementSibling},get slot(){return this.getAttribute("slot")},
set slot(a){this.__shady_setAttribute("slot",a)},get shadowRoot(){var a=v(this);return a&&a.pa||null},get className(){return this.getAttribute("class")||""},set className(a){this.__shady_setAttribute("class",a)},setAttribute:function(a,b){if(this.ownerDocument!==hd)this.__shady_native_setAttribute(a,b);else{var c;(c=G())&&"class"===a?(c.setElementClass(this,b),c=!0):c=!1;c||(this.__shady_native_setAttribute(a,b),id(this,a))}},removeAttribute:function(a){this.__shady_native_removeAttribute(a);id(this,
a)},attachShadow:function(a){if(!this)throw Error("Must provide a host.");if(!a)throw Error("Not enough arguments.");return new Sc(Oc,this,a)}});var kd=B({blur:function(){var a=v(this);(a=(a=a&&a.root)&&a.activeElement)?a.__shady_blur():this.__shady_native_blur()}});cc.forEach(function(a){kd[a]={set:function(b){var c=u(this),d=a.substring(2);c.O[a]&&this.removeEventListener(d,c.O[a]);this.__shady_addEventListener(d,b);c.O[a]=b},get:function(){var b=v(this);return b&&b.O[a]},configurable:!0}});var ld=B({assignedNodes:function(a){if("slot"===this.localName){var b=this.__shady_getRootNode();b&&z(b)&&Tc(b);return(b=v(this))?(a&&a.flatten?b.D:b.assignedNodes)||[]:[]}}});var md=window.document,nd=B({importNode:function(a,b){if(a.ownerDocument!==md||"template"===a.localName)return this.__shady_native_importNode(a,b);var c=this.__shady_native_importNode(a,!1);if(b){a=a.__shady_childNodes;b=0;for(var d;b<a.length;b++)d=this.__shady_importNode(a[b],!0),c.__shady_appendChild(d)}return c}});var od=B({addEventListener:Ub.bind(window),removeEventListener:Wb.bind(window)});var pd={};Object.getOwnPropertyDescriptor(HTMLElement.prototype,"parentElement")&&(pd.parentElement=Cc.parentElement);Object.getOwnPropertyDescriptor(HTMLElement.prototype,"contains")&&(pd.contains=Cc.contains);Object.getOwnPropertyDescriptor(HTMLElement.prototype,"children")&&(pd.children=Fc.children);Object.getOwnPropertyDescriptor(HTMLElement.prototype,"innerHTML")&&(pd.innerHTML=Lc.innerHTML);Object.getOwnPropertyDescriptor(HTMLElement.prototype,"className")&&(pd.className=jd.className);
var qd={EventTarget:[fd],Node:[Cc,window.EventTarget?null:fd],Text:[gd],Element:[jd,Fc,gd,!w.m||"innerHTML"in Element.prototype?Lc:null,window.HTMLSlotElement?null:ld],HTMLElement:[kd,pd],HTMLSlotElement:[ld],DocumentFragment:[Hc,Ic],Document:[nd,Hc,Ic,Jc],Window:[od]},rd=w.m?null:["innerHTML","textContent"];function sd(a){var b=a?null:rd,c={},d;for(d in qd)c.W=window[d]&&window[d].prototype,qd[d].forEach(function(c){return function(d){return c.W&&d&&A(c.W,d,a,b)}}(c)),c={W:c.W}};if(w.ea){var ShadyDOM={inUse:w.ea,patch:function(a){Fb(a);Eb(a);return a},isShadyRoot:z,enqueue:Ya,flush:Za,flushInitial:function(a){!a.ba&&a.B&&Tc(a)},settings:w,filterMutations:db,observeChildren:bb,unobserveChildren:cb,deferConnectionCallbacks:w.deferConnectionCallbacks,preferPerformance:w.preferPerformance,handlesDynamicScoping:!0,wrap:w.J?ed:function(a){return a},Wrapper:cd,composedPath:Mb,noPatch:w.J,nativeMethods:qb,nativeTree:rb};window.ShadyDOM=ShadyDOM;yb();sd("__shady_");Object.defineProperty(document,
"_activeElement",Jc.activeElement);A(Window.prototype,od,"__shady_");w.J||(sd(),bc());Xb();window.Event=Zb;window.CustomEvent=$b;window.MouseEvent=ac;window.ShadowRoot=Sc};var td=new Set("annotation-xml color-profile font-face font-face-src font-face-uri font-face-format font-face-name missing-glyph".split(" "));function ud(a){var b=td.has(a);a=/^[a-z][.0-9_a-z]*-[\-.0-9_a-z]*$/.test(a);return!b&&a}function H(a){var b=a.isConnected;if(void 0!==b)return b;for(;a&&!(a.__CE_isImportDocument||a instanceof Document);)a=a.parentNode||(window.ShadowRoot&&a instanceof ShadowRoot?a.host:void 0);return!(!a||!(a.__CE_isImportDocument||a instanceof Document))}
function vd(a,b){for(;b&&b!==a&&!b.nextSibling;)b=b.parentNode;return b&&b!==a?b.nextSibling:null}
function wd(a,b,c){c=void 0===c?new Set:c;for(var d=a;d;){if(d.nodeType===Node.ELEMENT_NODE){var e=d;b(e);var f=e.localName;if("link"===f&&"import"===e.getAttribute("rel")){d=e.import;if(d instanceof Node&&!c.has(d))for(c.add(d),d=d.firstChild;d;d=d.nextSibling)wd(d,b,c);d=vd(a,e);continue}else if("template"===f){d=vd(a,e);continue}if(e=e.__CE_shadowRoot)for(e=e.firstChild;e;e=e.nextSibling)wd(e,b,c)}d=d.firstChild?d.firstChild:vd(a,d)}}function I(a,b,c){a[b]=c};function xd(){this.a=new Map;this.g=new Map;this.f=[];this.c=!1}function yd(a,b,c){a.a.set(b,c);a.g.set(c.constructorFunction,c)}function zd(a,b){a.c=!0;a.f.push(b)}function Ad(a,b){a.c&&wd(b,function(b){return a.b(b)})}xd.prototype.b=function(a){if(this.c&&!a.__CE_patched){a.__CE_patched=!0;for(var b=0;b<this.f.length;b++)this.f[b](a)}};function J(a,b){var c=[];wd(b,function(a){return c.push(a)});for(b=0;b<c.length;b++){var d=c[b];1===d.__CE_state?a.connectedCallback(d):Bd(a,d)}}
function K(a,b){var c=[];wd(b,function(a){return c.push(a)});for(b=0;b<c.length;b++){var d=c[b];1===d.__CE_state&&a.disconnectedCallback(d)}}
function L(a,b,c){c=void 0===c?{}:c;var d=c.Xa||new Set,e=c.Y||function(b){return Bd(a,b)},f=[];wd(b,function(b){if("link"===b.localName&&"import"===b.getAttribute("rel")){var c=b.import;c instanceof Node&&(c.__CE_isImportDocument=!0,c.__CE_hasRegistry=!0);c&&"complete"===c.readyState?c.__CE_documentLoadHandled=!0:b.addEventListener("load",function(){var c=b.import;if(!c.__CE_documentLoadHandled){c.__CE_documentLoadHandled=!0;var f=new Set(d);f.delete(c);L(a,c,{Xa:f,Y:e})}})}else f.push(b)},d);if(a.c)for(b=
0;b<f.length;b++)a.b(f[b]);for(b=0;b<f.length;b++)e(f[b])}
function Bd(a,b){if(void 0===b.__CE_state){var c=b.ownerDocument;if(c.defaultView||c.__CE_isImportDocument&&c.__CE_hasRegistry)if(c=a.a.get(b.localName)){c.constructionStack.push(b);var d=c.constructorFunction;try{try{if(new d!==b)throw Error("The custom element constructor did not produce the element being upgraded.");}finally{c.constructionStack.pop()}}catch(g){throw b.__CE_state=2,g;}b.__CE_state=1;b.__CE_definition=c;if(c.attributeChangedCallback)for(c=c.observedAttributes,d=0;d<c.length;d++){var e=
c[d],f=b.getAttribute(e);null!==f&&a.attributeChangedCallback(b,e,null,f,null)}H(b)&&a.connectedCallback(b)}}}xd.prototype.connectedCallback=function(a){var b=a.__CE_definition;b.connectedCallback&&b.connectedCallback.call(a)};xd.prototype.disconnectedCallback=function(a){var b=a.__CE_definition;b.disconnectedCallback&&b.disconnectedCallback.call(a)};
xd.prototype.attributeChangedCallback=function(a,b,c,d,e){var f=a.__CE_definition;f.attributeChangedCallback&&-1<f.observedAttributes.indexOf(b)&&f.attributeChangedCallback.call(a,b,c,d,e)};function Cd(a){var b=document;this.b=a;this.a=b;this.F=void 0;L(this.b,this.a);"loading"===this.a.readyState&&(this.F=new MutationObserver(this.c.bind(this)),this.F.observe(this.a,{childList:!0,subtree:!0}))}function Dd(a){a.F&&a.F.disconnect()}Cd.prototype.c=function(a){var b=this.a.readyState;"interactive"!==b&&"complete"!==b||Dd(this);for(b=0;b<a.length;b++)for(var c=a[b].addedNodes,d=0;d<c.length;d++)L(this.b,c[d])};function Ed(){var a=this;this.a=this.h=void 0;this.b=new Promise(function(b){a.a=b;a.h&&b(a.h)})}Ed.prototype.resolve=function(a){if(this.h)throw Error("Already resolved.");this.h=a;this.a&&this.a(a)};function N(a){this.c=!1;this.a=a;this.l=new Map;this.f=function(a){return a()};this.b=!1;this.g=[];this.da=new Cd(a)}n=N.prototype;
n.sa=function(a,b){var c=this;if(!(b instanceof Function))throw new TypeError("Custom element constructors must be functions.");if(!ud(a))throw new SyntaxError("The element name '"+a+"' is not valid.");if(this.a.a.get(a))throw Error("A custom element with name '"+a+"' has already been defined.");if(this.c)throw Error("A custom element is already being defined.");this.c=!0;try{var d=function(a){var b=e[a];if(void 0!==b&&!(b instanceof Function))throw Error("The '"+a+"' callback must be a function.");
return b},e=b.prototype;if(!(e instanceof Object))throw new TypeError("The custom element constructor's prototype is not an object.");var f=d("connectedCallback");var g=d("disconnectedCallback");var h=d("adoptedCallback");var k=d("attributeChangedCallback");var l=b.observedAttributes||[]}catch(m){return}finally{this.c=!1}b={localName:a,constructorFunction:b,connectedCallback:f,disconnectedCallback:g,adoptedCallback:h,attributeChangedCallback:k,observedAttributes:l,constructionStack:[]};yd(this.a,
a,b);this.g.push(b);this.b||(this.b=!0,this.f(function(){return Fd(c)}))};n.Y=function(a){L(this.a,a)};
function Fd(a){if(!1!==a.b){a.b=!1;for(var b=a.g,c=[],d=new Map,e=0;e<b.length;e++)d.set(b[e].localName,[]);L(a.a,document,{Y:function(b){if(void 0===b.__CE_state){var e=b.localName,f=d.get(e);f?f.push(b):a.a.a.get(e)&&c.push(b)}}});for(e=0;e<c.length;e++)Bd(a.a,c[e]);for(;0<b.length;){var f=b.shift();e=f.localName;f=d.get(f.localName);for(var g=0;g<f.length;g++)Bd(a.a,f[g]);(e=a.l.get(e))&&e.resolve(void 0)}}}n.get=function(a){if(a=this.a.a.get(a))return a.constructorFunction};
n.ta=function(a){if(!ud(a))return Promise.reject(new SyntaxError("'"+a+"' is not a valid custom element name."));var b=this.l.get(a);if(b)return b.b;b=new Ed;this.l.set(a,b);this.a.a.get(a)&&!this.g.some(function(b){return b.localName===a})&&b.resolve(void 0);return b.b};n.Pa=function(a){Dd(this.da);var b=this.f;this.f=function(c){return a(function(){return b(c)})}};window.CustomElementRegistry=N;N.prototype.define=N.prototype.sa;N.prototype.upgrade=N.prototype.Y;N.prototype.get=N.prototype.get;
N.prototype.whenDefined=N.prototype.ta;N.prototype.polyfillWrapFlushCallback=N.prototype.Pa;var Gd=window.Document.prototype.createElement,Hd=window.Document.prototype.createElementNS,Id=window.Document.prototype.importNode,Jd=window.Document.prototype.prepend,Kd=window.Document.prototype.append,Ld=window.DocumentFragment.prototype.prepend,Md=window.DocumentFragment.prototype.append,Nd=window.Node.prototype.cloneNode,Od=window.Node.prototype.appendChild,Pd=window.Node.prototype.insertBefore,Qd=window.Node.prototype.removeChild,Rd=window.Node.prototype.replaceChild,Sd=Object.getOwnPropertyDescriptor(window.Node.prototype,
"textContent"),Td=window.Element.prototype.attachShadow,Ud=Object.getOwnPropertyDescriptor(window.Element.prototype,"innerHTML"),Vd=window.Element.prototype.getAttribute,Wd=window.Element.prototype.setAttribute,Xd=window.Element.prototype.removeAttribute,Yd=window.Element.prototype.getAttributeNS,Zd=window.Element.prototype.setAttributeNS,$d=window.Element.prototype.removeAttributeNS,ae=window.Element.prototype.insertAdjacentElement,be=window.Element.prototype.insertAdjacentHTML,ce=window.Element.prototype.prepend,
de=window.Element.prototype.append,ee=window.Element.prototype.before,fe=window.Element.prototype.after,ge=window.Element.prototype.replaceWith,he=window.Element.prototype.remove,ie=window.HTMLElement,je=Object.getOwnPropertyDescriptor(window.HTMLElement.prototype,"innerHTML"),ke=window.HTMLElement.prototype.insertAdjacentElement,le=window.HTMLElement.prototype.insertAdjacentHTML;var me=new function(){};function ne(){var a=oe;window.HTMLElement=function(){function b(){var b=this.constructor,d=a.g.get(b);if(!d)throw Error("The custom element being constructed was not registered with `customElements`.");var e=d.constructionStack;if(0===e.length)return e=Gd.call(document,d.localName),Object.setPrototypeOf(e,b.prototype),e.__CE_state=1,e.__CE_definition=d,a.b(e),e;d=e.length-1;var f=e[d];if(f===me)throw Error("The HTMLElement constructor was either called reentrantly for this constructor or called multiple times.");
e[d]=me;Object.setPrototypeOf(f,b.prototype);a.b(f);return f}b.prototype=ie.prototype;Object.defineProperty(b.prototype,"constructor",{writable:!0,configurable:!0,enumerable:!1,value:b});return b}()};function pe(a,b,c){function d(b){return function(c){for(var d=[],e=0;e<arguments.length;++e)d[e]=arguments[e];e=[];for(var f=[],l=0;l<d.length;l++){var m=d[l];m instanceof Element&&H(m)&&f.push(m);if(m instanceof DocumentFragment)for(m=m.firstChild;m;m=m.nextSibling)e.push(m);else e.push(m)}b.apply(this,d);for(d=0;d<f.length;d++)K(a,f[d]);if(H(this))for(d=0;d<e.length;d++)f=e[d],f instanceof Element&&J(a,f)}}void 0!==c.V&&(b.prepend=d(c.V));void 0!==c.append&&(b.append=d(c.append))};function qe(){var a=oe;I(Document.prototype,"createElement",function(b){if(this.__CE_hasRegistry){var c=a.a.get(b);if(c)return new c.constructorFunction}b=Gd.call(this,b);a.b(b);return b});I(Document.prototype,"importNode",function(b,c){b=Id.call(this,b,!!c);this.__CE_hasRegistry?L(a,b):Ad(a,b);return b});I(Document.prototype,"createElementNS",function(b,c){if(this.__CE_hasRegistry&&(null===b||"http://www.w3.org/1999/xhtml"===b)){var d=a.a.get(c);if(d)return new d.constructorFunction}b=Hd.call(this,
b,c);a.b(b);return b});pe(a,Document.prototype,{V:Jd,append:Kd})};function re(){function a(a,d){Object.defineProperty(a,"textContent",{enumerable:d.enumerable,configurable:!0,get:d.get,set:function(a){if(this.nodeType===Node.TEXT_NODE)d.set.call(this,a);else{var c=void 0;if(this.firstChild){var e=this.childNodes,h=e.length;if(0<h&&H(this)){c=Array(h);for(var k=0;k<h;k++)c[k]=e[k]}}d.set.call(this,a);if(c)for(a=0;a<c.length;a++)K(b,c[a])}}})}var b=oe;I(Node.prototype,"insertBefore",function(a,d){if(a instanceof DocumentFragment){var c=Array.prototype.slice.apply(a.childNodes);
a=Pd.call(this,a,d);if(H(this))for(d=0;d<c.length;d++)J(b,c[d]);return a}c=H(a);d=Pd.call(this,a,d);c&&K(b,a);H(this)&&J(b,a);return d});I(Node.prototype,"appendChild",function(a){if(a instanceof DocumentFragment){var c=Array.prototype.slice.apply(a.childNodes);a=Od.call(this,a);if(H(this))for(var e=0;e<c.length;e++)J(b,c[e]);return a}c=H(a);e=Od.call(this,a);c&&K(b,a);H(this)&&J(b,a);return e});I(Node.prototype,"cloneNode",function(a){a=Nd.call(this,!!a);this.ownerDocument.__CE_hasRegistry?L(b,a):
Ad(b,a);return a});I(Node.prototype,"removeChild",function(a){var c=H(a),e=Qd.call(this,a);c&&K(b,a);return e});I(Node.prototype,"replaceChild",function(a,d){if(a instanceof DocumentFragment){var c=Array.prototype.slice.apply(a.childNodes);a=Rd.call(this,a,d);if(H(this))for(K(b,d),d=0;d<c.length;d++)J(b,c[d]);return a}c=H(a);var f=Rd.call(this,a,d),g=H(this);g&&K(b,d);c&&K(b,a);g&&J(b,a);return f});Sd&&Sd.get?a(Node.prototype,Sd):zd(b,function(b){a(b,{enumerable:!0,configurable:!0,get:function(){for(var a=
[],b=0;b<this.childNodes.length;b++)a.push(this.childNodes[b].textContent);return a.join("")},set:function(a){for(;this.firstChild;)Qd.call(this,this.firstChild);Od.call(this,document.createTextNode(a))}})})};function se(a){function b(b){return function(c){for(var d=[],e=0;e<arguments.length;++e)d[e]=arguments[e];e=[];for(var h=[],k=0;k<d.length;k++){var l=d[k];l instanceof Element&&H(l)&&h.push(l);if(l instanceof DocumentFragment)for(l=l.firstChild;l;l=l.nextSibling)e.push(l);else e.push(l)}b.apply(this,d);for(d=0;d<h.length;d++)K(a,h[d]);if(H(this))for(d=0;d<e.length;d++)h=e[d],h instanceof Element&&J(a,h)}}var c=Element.prototype;void 0!==ee&&(c.before=b(ee));void 0!==ee&&(c.after=b(fe));void 0!==ge&&
I(c,"replaceWith",function(b){for(var c=[],d=0;d<arguments.length;++d)c[d]=arguments[d];d=[];for(var g=[],h=0;h<c.length;h++){var k=c[h];k instanceof Element&&H(k)&&g.push(k);if(k instanceof DocumentFragment)for(k=k.firstChild;k;k=k.nextSibling)d.push(k);else d.push(k)}h=H(this);ge.apply(this,c);for(c=0;c<g.length;c++)K(a,g[c]);if(h)for(K(a,this),c=0;c<d.length;c++)g=d[c],g instanceof Element&&J(a,g)});void 0!==he&&I(c,"remove",function(){var b=H(this);he.call(this);b&&K(a,this)})};function te(){function a(a,b){Object.defineProperty(a,"innerHTML",{enumerable:b.enumerable,configurable:!0,get:b.get,set:function(a){var c=this,e=void 0;H(this)&&(e=[],wd(this,function(a){a!==c&&e.push(a)}));b.set.call(this,a);if(e)for(var f=0;f<e.length;f++){var g=e[f];1===g.__CE_state&&d.disconnectedCallback(g)}this.ownerDocument.__CE_hasRegistry?L(d,this):Ad(d,this);return a}})}function b(a,b){I(a,"insertAdjacentElement",function(a,c){var e=H(c);a=b.call(this,a,c);e&&K(d,c);H(a)&&J(d,c);return a})}
function c(a,b){function c(a,b){for(var c=[];a!==b;a=a.nextSibling)c.push(a);for(b=0;b<c.length;b++)L(d,c[b])}I(a,"insertAdjacentHTML",function(a,d){a=a.toLowerCase();if("beforebegin"===a){var e=this.previousSibling;b.call(this,a,d);c(e||this.parentNode.firstChild,this)}else if("afterbegin"===a)e=this.firstChild,b.call(this,a,d),c(this.firstChild,e);else if("beforeend"===a)e=this.lastChild,b.call(this,a,d),c(e||this.firstChild,null);else if("afterend"===a)e=this.nextSibling,b.call(this,a,d),c(this.nextSibling,
e);else throw new SyntaxError("The value provided ("+String(a)+") is not one of 'beforebegin', 'afterbegin', 'beforeend', or 'afterend'.");})}var d=oe;Td&&I(Element.prototype,"attachShadow",function(a){return this.__CE_shadowRoot=a=Td.call(this,a)});Ud&&Ud.get?a(Element.prototype,Ud):je&&je.get?a(HTMLElement.prototype,je):zd(d,function(b){a(b,{enumerable:!0,configurable:!0,get:function(){return Nd.call(this,!0).innerHTML},set:function(a){var b="template"===this.localName,c=b?this.content:this,d=Hd.call(document,
this.namespaceURI,this.localName);for(d.innerHTML=a;0<c.childNodes.length;)Qd.call(c,c.childNodes[0]);for(a=b?d.content:d;0<a.childNodes.length;)Od.call(c,a.childNodes[0])}})});I(Element.prototype,"setAttribute",function(a,b){if(1!==this.__CE_state)return Wd.call(this,a,b);var c=Vd.call(this,a);Wd.call(this,a,b);b=Vd.call(this,a);d.attributeChangedCallback(this,a,c,b,null)});I(Element.prototype,"setAttributeNS",function(a,b,c){if(1!==this.__CE_state)return Zd.call(this,a,b,c);var e=Yd.call(this,a,
b);Zd.call(this,a,b,c);c=Yd.call(this,a,b);d.attributeChangedCallback(this,b,e,c,a)});I(Element.prototype,"removeAttribute",function(a){if(1!==this.__CE_state)return Xd.call(this,a);var b=Vd.call(this,a);Xd.call(this,a);null!==b&&d.attributeChangedCallback(this,a,b,null,null)});I(Element.prototype,"removeAttributeNS",function(a,b){if(1!==this.__CE_state)return $d.call(this,a,b);var c=Yd.call(this,a,b);$d.call(this,a,b);var e=Yd.call(this,a,b);c!==e&&d.attributeChangedCallback(this,b,c,e,a)});ke?b(HTMLElement.prototype,
ke):ae?b(Element.prototype,ae):console.warn("Custom Elements: `Element#insertAdjacentElement` was not patched.");le?c(HTMLElement.prototype,le):be?c(Element.prototype,be):console.warn("Custom Elements: `Element#insertAdjacentHTML` was not patched.");pe(d,Element.prototype,{V:ce,append:de});se(d)};var ue=window.customElements;if(!ue||ue.forcePolyfill||"function"!=typeof ue.define||"function"!=typeof ue.get){var oe=new xd;ne();qe();pe(oe,DocumentFragment.prototype,{V:Ld,append:Md});re();te();document.__CE_hasRegistry=!0;var customElements=new N(oe);Object.defineProperty(window,"customElements",{configurable:!0,enumerable:!0,value:customElements})};function ve(){this.end=this.start=0;this.rules=this.parent=this.previous=null;this.cssText=this.parsedCssText="";this.atRule=!1;this.type=0;this.parsedSelector=this.selector=this.keyframesName=""}
function we(a){a=a.replace(xe,"").replace(ye,"");var b=ze,c=a,d=new ve;d.start=0;d.end=c.length;for(var e=d,f=0,g=c.length;f<g;f++)if("{"===c[f]){e.rules||(e.rules=[]);var h=e,k=h.rules[h.rules.length-1]||null;e=new ve;e.start=f+1;e.parent=h;e.previous=k;h.rules.push(e)}else"}"===c[f]&&(e.end=f+1,e=e.parent||d);return b(d,a)}
function ze(a,b){var c=b.substring(a.start,a.end-1);a.parsedCssText=a.cssText=c.trim();a.parent&&(c=b.substring(a.previous?a.previous.end:a.parent.start,a.start-1),c=Ae(c),c=c.replace(Be," "),c=c.substring(c.lastIndexOf(";")+1),c=a.parsedSelector=a.selector=c.trim(),a.atRule=0===c.indexOf("@"),a.atRule?0===c.indexOf("@media")?a.type=Ce:c.match(De)&&(a.type=Ee,a.keyframesName=a.selector.split(Be).pop()):a.type=0===c.indexOf("--")?Fe:Ge);if(c=a.rules)for(var d=0,e=c.length,f=void 0;d<e&&(f=c[d]);d++)ze(f,
b);return a}function Ae(a){return a.replace(/\\([0-9a-f]{1,6})\s/gi,function(a,c){a=c;for(c=6-a.length;c--;)a="0"+a;return"\\"+a})}
function He(a,b,c){c=void 0===c?"":c;var d="";if(a.cssText||a.rules){var e=a.rules,f;if(f=e)f=e[0],f=!(f&&f.selector&&0===f.selector.indexOf("--"));if(f){f=0;for(var g=e.length,h=void 0;f<g&&(h=e[f]);f++)d=He(h,b,d)}else b?b=a.cssText:(b=a.cssText,b=b.replace(Ie,"").replace(Je,""),b=b.replace(Ke,"").replace(Le,"")),(d=b.trim())&&(d="  "+d+"\n")}d&&(a.selector&&(c+=a.selector+" {\n"),c+=d,a.selector&&(c+="}\n\n"));return c}
var Ge=1,Ee=7,Ce=4,Fe=1E3,xe=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,ye=/@import[^;]*;/gim,Ie=/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,Je=/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,Ke=/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,Le=/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,De=/^@[^\s]*keyframes/,Be=/\s+/g;var O=!(window.ShadyDOM&&window.ShadyDOM.inUse),Me;function Ne(a){Me=a&&a.shimcssproperties?!1:O||!(navigator.userAgent.match(/AppleWebKit\/601|Edge\/15/)||!window.CSS||!CSS.supports||!CSS.supports("box-shadow","0 0 0 var(--foo)"))}var Oe;window.ShadyCSS&&void 0!==window.ShadyCSS.cssBuild&&(Oe=window.ShadyCSS.cssBuild);var Pe=!(!window.ShadyCSS||!window.ShadyCSS.disableRuntime);
window.ShadyCSS&&void 0!==window.ShadyCSS.nativeCss?Me=window.ShadyCSS.nativeCss:window.ShadyCSS?(Ne(window.ShadyCSS),window.ShadyCSS=void 0):Ne(window.WebComponents&&window.WebComponents.flags);var Q=Me,Qe=Oe;var Re=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gi,Se=/(?:^|\W+)@apply\s*\(?([^);\n]*)\)?/gi,Te=/(--[\w-]+)\s*([:,;)]|$)/gi,Ue=/(animation\s*:)|(animation-name\s*:)/,$e=/@media\s(.*)/,af=/\{[^}]*\}/g;var bf=new Set;function cf(a,b){if(!a)return"";"string"===typeof a&&(a=we(a));b&&df(a,b);return He(a,Q)}function ef(a){!a.__cssRules&&a.textContent&&(a.__cssRules=we(a.textContent));return a.__cssRules||null}function ff(a){return!!a.parent&&a.parent.type===Ee}function df(a,b,c,d){if(a){var e=!1,f=a.type;if(d&&f===Ce){var g=a.selector.match($e);g&&(window.matchMedia(g[1]).matches||(e=!0))}f===Ge?b(a):c&&f===Ee?c(a):f===Fe&&(e=!0);if((a=a.rules)&&!e)for(e=0,f=a.length,g=void 0;e<f&&(g=a[e]);e++)df(g,b,c,d)}}
function gf(a,b,c,d){var e=document.createElement("style");b&&e.setAttribute("scope",b);e.textContent=a;hf(e,c,d);return e}var jf=null;function kf(a){a=document.createComment(" Shady DOM styles for "+a+" ");var b=document.head;b.insertBefore(a,(jf?jf.nextSibling:null)||b.firstChild);return jf=a}function hf(a,b,c){b=b||document.head;b.insertBefore(a,c&&c.nextSibling||b.firstChild);jf?a.compareDocumentPosition(jf)===Node.DOCUMENT_POSITION_PRECEDING&&(jf=a):jf=a}
function lf(a,b){for(var c=0,d=a.length;b<d;b++)if("("===a[b])c++;else if(")"===a[b]&&0===--c)return b;return-1}function mf(a,b){var c=a.indexOf("var(");if(-1===c)return b(a,"","","");var d=lf(a,c+3),e=a.substring(c+4,d);c=a.substring(0,c);a=mf(a.substring(d+1),b);d=e.indexOf(",");return-1===d?b(c,e.trim(),"",a):b(c,e.substring(0,d).trim(),e.substring(d+1).trim(),a)}function nf(a,b){O?a.setAttribute("class",b):window.ShadyDOM.nativeMethods.setAttribute.call(a,"class",b)}
var of=window.ShadyDOM&&window.ShadyDOM.wrap||function(a){return a};function pf(a){var b=a.localName,c="";b?-1<b.indexOf("-")||(c=b,b=a.getAttribute&&a.getAttribute("is")||""):(b=a.is,c=a.extends);return{is:b,M:c}}function qf(a){for(var b=[],c="",d=0;0<=d&&d<a.length;d++)if("("===a[d]){var e=lf(a,d);c+=a.slice(d,e+1);d=e}else","===a[d]?(b.push(c),c=""):c+=a[d];c&&b.push(c);return b}
function rf(a){if(void 0!==Qe)return Qe;if(void 0===a.__cssBuild){var b=a.getAttribute("css-build");if(b)a.__cssBuild=b;else{a:{b="template"===a.localName?a.content.firstChild:a.firstChild;if(b instanceof Comment&&(b=b.textContent.trim().split(":"),"css-build"===b[0])){b=b[1];break a}b=""}if(""!==b){var c="template"===a.localName?a.content.firstChild:a.firstChild;c.parentNode.removeChild(c)}a.__cssBuild=b}}return a.__cssBuild||""}
function sf(a){a=void 0===a?"":a;return""!==a&&Q?O?"shadow"===a:"shady"===a:!1};function tf(){}function uf(a,b){vf(R,a,function(a){wf(a,b||"")})}function vf(a,b,c){b.nodeType===Node.ELEMENT_NODE&&c(b);var d;"template"===b.localName?d=(b.content||b._content||b).childNodes:d=b.children||b.childNodes;if(d)for(b=0;b<d.length;b++)vf(a,d[b],c)}
function wf(a,b,c){if(b)if(a.classList)c?(a.classList.remove("style-scope"),a.classList.remove(b)):(a.classList.add("style-scope"),a.classList.add(b));else if(a.getAttribute){var d=a.getAttribute("class");c?d&&(b=d.replace("style-scope","").replace(b,""),nf(a,b)):nf(a,(d?d+" ":"")+"style-scope "+b)}}function xf(a,b,c){vf(R,a,function(a){wf(a,b,!0);wf(a,c)})}function yf(a,b){vf(R,a,function(a){wf(a,b||"",!0)})}
function zf(a,b,c,d,e){var f=R;e=void 0===e?"":e;""===e&&(O||"shady"===(void 0===d?"":d)?e=cf(b,c):(a=pf(a),e=Af(f,b,a.is,a.M,c)+"\n\n"));return e.trim()}function Af(a,b,c,d,e){var f=Bf(c,d);c=c?"."+c:"";return cf(b,function(b){b.c||(b.selector=b.j=Cf(a,b,a.b,c,f),b.c=!0);e&&e(b,c,f)})}function Bf(a,b){return b?"[is="+a+"]":a}
function Cf(a,b,c,d,e){var f=qf(b.selector);if(!ff(b)){b=0;for(var g=f.length,h=void 0;b<g&&(h=f[b]);b++)f[b]=c.call(a,h,d,e)}return f.filter(function(a){return!!a}).join(",")}function Df(a){return a.replace(Ef,function(a,c,d){-1<d.indexOf("+")?d=d.replace(/\+/g,"___"):-1<d.indexOf("___")&&(d=d.replace(/___/g,"+"));return":"+c+"("+d+")"})}
function Ff(a){for(var b=[],c;c=a.match(Gf);){var d=c.index,e=lf(a,d);if(-1===e)throw Error(c.input+" selector missing ')'");c=a.slice(d,e+1);a=a.replace(c,"\ue000");b.push(c)}return{ha:a,matches:b}}function Hf(a,b){var c=a.split("\ue000");return b.reduce(function(a,b,f){return a+b+c[f+1]},c[0])}
tf.prototype.b=function(a,b,c){var d=!1;a=a.trim();var e=Ef.test(a);e&&(a=a.replace(Ef,function(a,b,c){return":"+b+"("+c.replace(/\s/g,"")+")"}),a=Df(a));var f=Gf.test(a);if(f){var g=Ff(a);a=g.ha;g=g.matches}a=a.replace(If,":host $1");a=a.replace(Jf,function(a,e,f){d||(a=Kf(f,e,b,c),d=d||a.stop,e=a.Ca,f=a.value);return e+f});f&&(a=Hf(a,g));e&&(a=Df(a));return a};
function Kf(a,b,c,d){var e=a.indexOf("::slotted");0<=a.indexOf(":host")?a=Lf(a,d):0!==e&&(a=c?Mf(a,c):a);c=!1;0<=e&&(b="",c=!0);if(c){var f=!0;c&&(a=a.replace(Nf,function(a,b){return" > "+b}))}a=a.replace(Of,function(a,b,c){return'[dir="'+c+'"] '+b+", "+b+'[dir="'+c+'"]'});return{value:a,Ca:b,stop:f}}
function Mf(a,b){a=a.split(/(\[.+?\])/);for(var c=[],d=0;d<a.length;d++)if(1===d%2)c.push(a[d]);else{var e=a[d];if(""!==e||d!==a.length-1)e=e.split(":"),e[0]+=b,c.push(e.join(":"))}return c.join("")}function Lf(a,b){var c=a.match(Pf);return(c=c&&c[2].trim()||"")?c[0].match(Qf)?a.replace(Pf,function(a,c,f){return b+f}):c.split(Qf)[0]===b?c:"should_not_match":a.replace(":host",b)}function Rf(a){":root"===a.selector&&(a.selector="html")}
tf.prototype.c=function(a){return a.match(":host")?"":a.match("::slotted")?this.b(a,":not(.style-scope)"):Mf(a.trim(),":not(.style-scope)")};p.Object.defineProperties(tf.prototype,{a:{configurable:!0,enumerable:!0,get:function(){return"style-scope"}}});
var Ef=/:(nth[-\w]+)\(([^)]+)\)/,Jf=/(^|[\s>+~]+)((?:\[.+?\]|[^\s>+~=[])+)/g,Qf=/[[.:#*]/,If=/^(::slotted)/,Pf=/(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,Nf=/(?:::slotted)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,Of=/(.*):dir\((?:(ltr|rtl))\)/,Gf=/:(?:matches|any|-(?:webkit|moz)-any)/,R=new tf;function Sf(a,b,c,d,e){this.A=a||null;this.b=b||null;this.fa=c||[];this.o=null;this.cssBuild=e||"";this.M=d||"";this.a=this.s=this.w=null}function T(a){return a?a.__styleInfo:null}function Tf(a,b){return a.__styleInfo=b}Sf.prototype.c=function(){return this.A};Sf.prototype._getStyleRules=Sf.prototype.c;function Uf(a){var b=this.matches||this.matchesSelector||this.mozMatchesSelector||this.msMatchesSelector||this.oMatchesSelector||this.webkitMatchesSelector;return b&&b.call(this,a)}var Vf=navigator.userAgent.match("Trident");function Wf(){}function Xf(a){var b={},c=[],d=0;df(a,function(a){Yf(a);a.index=d++;a=a.i.cssText;for(var c;c=Te.exec(a);){var e=c[1];":"!==c[2]&&(b[e]=!0)}},function(a){c.push(a)});a.b=c;a=[];for(var e in b)a.push(e);return a}
function Yf(a){if(!a.i){var b={},c={};Zf(a,c)&&(b.v=c,a.rules=null);b.cssText=a.parsedCssText.replace(af,"").replace(Re,"");a.i=b}}function Zf(a,b){var c=a.i;if(c){if(c.v)return Object.assign(b,c.v),!0}else{c=a.parsedCssText;for(var d;a=Re.exec(c);){d=(a[2]||a[3]).trim();if("inherit"!==d||"unset"!==d)b[a[1].trim()]=d;d=!0}return d}}
function $f(a,b,c){b&&(b=0<=b.indexOf(";")?ag(a,b,c):mf(b,function(b,e,f,g){if(!e)return b+g;(e=$f(a,c[e],c))&&"initial"!==e?"apply-shim-inherit"===e&&(e="inherit"):e=$f(a,c[f]||f,c)||f;return b+(e||"")+g}));return b&&b.trim()||""}
function ag(a,b,c){b=b.split(";");for(var d=0,e,f;d<b.length;d++)if(e=b[d]){Se.lastIndex=0;if(f=Se.exec(e))e=$f(a,c[f[1]],c);else if(f=e.indexOf(":"),-1!==f){var g=e.substring(f);g=g.trim();g=$f(a,g,c)||g;e=e.substring(0,f)+g}b[d]=e&&e.lastIndexOf(";")===e.length-1?e.slice(0,-1):e||""}return b.join(";")}
function bg(a,b){var c={},d=[];df(a,function(a){a.i||Yf(a);var e=a.j||a.parsedSelector;b&&a.i.v&&e&&Uf.call(b,e)&&(Zf(a,c),a=a.index,e=parseInt(a/32,10),d[e]=(d[e]||0)|1<<a%32)},null,!0);return{v:c,key:d}}
function cg(a,b,c,d){b.i||Yf(b);if(b.i.v){var e=pf(a);a=e.is;e=e.M;e=a?Bf(a,e):"html";var f=b.parsedSelector,g=":host > *"===f||"html"===f,h=0===f.indexOf(":host")&&!g;"shady"===c&&(g=f===e+" > *."+e||-1!==f.indexOf("html"),h=!g&&0===f.indexOf(e));if(g||h)c=e,h&&(b.j||(b.j=Cf(R,b,R.b,a?"."+a:"",e)),c=b.j||e),d({ha:c,Ia:h,Za:g})}}function dg(a,b,c){var d={},e={};df(b,function(b){cg(a,b,c,function(c){Uf.call(a._element||a,c.ha)&&(c.Ia?Zf(b,d):Zf(b,e))})},null,!0);return{Ra:e,Ha:d}}
function eg(a,b,c,d){var e=pf(b),f=Bf(e.is,e.M),g=new RegExp("(?:^|[^.#[:])"+(b.extends?"\\"+f.slice(0,-1)+"\\]":f)+"($|[.:[\\s>+~])"),h=T(b);e=h.A;h=h.cssBuild;var k=fg(e,d);return zf(b,e,function(b){var e="";b.i||Yf(b);b.i.cssText&&(e=ag(a,b.i.cssText,c));b.cssText=e;if(!O&&!ff(b)&&b.cssText){var h=e=b.cssText;null==b.na&&(b.na=Ue.test(e));if(b.na)if(null==b.U){b.U=[];for(var l in k)h=k[l],h=h(e),e!==h&&(e=h,b.U.push(l))}else{for(l=0;l<b.U.length;++l)h=k[b.U[l]],e=h(e);h=e}b.cssText=h;b.j=b.j||
b.selector;e="."+d;l=qf(b.j);h=0;for(var M=l.length,U=void 0;h<M&&(U=l[h]);h++)l[h]=U.match(g)?U.replace(f,e):e+" "+U;b.selector=l.join(",")}},h)}function fg(a,b){a=a.b;var c={};if(!O&&a)for(var d=0,e=a[d];d<a.length;e=a[++d]){var f=e,g=b;f.f=new RegExp("\\b"+f.keyframesName+"(?!\\B|-)","g");f.a=f.keyframesName+"-"+g;f.j=f.j||f.selector;f.selector=f.j.replace(f.keyframesName,f.a);c[e.keyframesName]=gg(e)}return c}function gg(a){return function(b){return b.replace(a.f,a.a)}}
function hg(a,b){var c=ig,d=ef(a);a.textContent=cf(d,function(a){var d=a.cssText=a.parsedCssText;a.i&&a.i.cssText&&(d=d.replace(Ie,"").replace(Je,""),a.cssText=ag(c,d,b))})}p.Object.defineProperties(Wf.prototype,{a:{configurable:!0,enumerable:!0,get:function(){return"x-scope"}}});var ig=new Wf;var jg={},kg=window.customElements;if(kg&&!O&&!Pe){var lg=kg.define;kg.define=function(a,b,c){jg[a]||(jg[a]=kf(a));lg.call(kg,a,b,c)}};function mg(){this.cache={}}mg.prototype.store=function(a,b,c,d){var e=this.cache[a]||[];e.push({v:b,styleElement:c,s:d});100<e.length&&e.shift();this.cache[a]=e};function ng(){}var og=new RegExp(R.a+"\\s*([^\\s]*)");function pg(a){return(a=(a.classList&&a.classList.value?a.classList.value:a.getAttribute("class")||"").match(og))?a[1]:""}function qg(a){var b=of(a).getRootNode();return b===a||b===a.ownerDocument?"":(a=b.host)?pf(a).is:""}
function rg(a){for(var b=0;b<a.length;b++){var c=a[b];if(c.target!==document.documentElement&&c.target!==document.head)for(var d=0;d<c.addedNodes.length;d++){var e=c.addedNodes[d];if(e.nodeType===Node.ELEMENT_NODE){var f=e.getRootNode(),g=pg(e);if(g&&f===e.ownerDocument&&("style"!==e.localName&&"template"!==e.localName||""===rf(e)))yf(e,g);else if(f instanceof ShadowRoot)for(f=qg(e),f!==g&&xf(e,g,f),e=window.ShadyDOM.nativeMethods.querySelectorAll.call(e,":not(."+R.a+")"),g=0;g<e.length;g++){f=e[g];
var h=qg(f);h&&wf(f,h)}}}}}
if(!(O||window.ShadyDOM&&window.ShadyDOM.handlesDynamicScoping)){var sg=new MutationObserver(rg),tg=function(a){sg.observe(a,{childList:!0,subtree:!0})};if(window.customElements&&!window.customElements.polyfillWrapFlushCallback)tg(document);else{var ug=function(){tg(document.body)};window.HTMLImports?window.HTMLImports.whenReady(ug):requestAnimationFrame(function(){if("loading"===document.readyState){var a=function(){ug();document.removeEventListener("readystatechange",a)};document.addEventListener("readystatechange",
a)}else ug()})}ng=function(){rg(sg.takeRecords())}}var vg=ng;var wg={};var xg=Promise.resolve();function yg(a){if(a=wg[a])a._applyShimCurrentVersion=a._applyShimCurrentVersion||0,a._applyShimValidatingVersion=a._applyShimValidatingVersion||0,a._applyShimNextVersion=(a._applyShimNextVersion||0)+1}function zg(a){return a._applyShimCurrentVersion===a._applyShimNextVersion}function Ag(a){a._applyShimValidatingVersion=a._applyShimNextVersion;a._validating||(a._validating=!0,xg.then(function(){a._applyShimCurrentVersion=a._applyShimNextVersion;a._validating=!1}))};var Bg={},Cg=new mg;function Y(){this.l={};this.c=document.documentElement;var a=new ve;a.rules=[];this.f=Tf(this.c,new Sf(a));this.g=!1;this.b=this.a=null}n=Y.prototype;n.flush=function(){vg()};n.Fa=function(a){return ef(a)};n.Va=function(a){return cf(a)};n.prepareTemplate=function(a,b,c){this.prepareTemplateDom(a,b);this.prepareTemplateStyles(a,b,c)};
n.prepareTemplateStyles=function(a,b,c){if(!a._prepared&&!Pe){O||jg[b]||(jg[b]=kf(b));a._prepared=!0;a.name=b;a.extends=c;wg[b]=a;var d=rf(a),e=sf(d);c={is:b,extends:c};for(var f=[],g=a.content.querySelectorAll("style"),h=0;h<g.length;h++){var k=g[h];if(k.hasAttribute("shady-unscoped")){if(!O){var l=k.textContent;bf.has(l)||(bf.add(l),l=k.cloneNode(!0),document.head.appendChild(l));k.parentNode.removeChild(k)}}else f.push(k.textContent),k.parentNode.removeChild(k)}f=f.join("").trim()+(Bg[b]||"");
Dg(this);if(!e){if(g=!d)g=Se.test(f)||Re.test(f),Se.lastIndex=0,Re.lastIndex=0;h=we(f);g&&Q&&this.a&&this.a.transformRules(h,b);a._styleAst=h}g=[];Q||(g=Xf(a._styleAst));if(!g.length||Q)h=O?a.content:null,b=jg[b]||null,d=zf(c,a._styleAst,null,d,e?f:""),d=d.length?gf(d,c.is,h,b):null,a._style=d;a.a=g}};n.Qa=function(a,b){Bg[b]=a.join(" ")};n.prepareTemplateDom=function(a,b){if(!Pe){var c=rf(a);O||"shady"===c||a._domPrepared||(a._domPrepared=!0,uf(a.content,b))}};
function Eg(a){var b=pf(a),c=b.is;b=b.M;var d=jg[c]||null,e=wg[c];if(e){c=e._styleAst;var f=e.a;e=rf(e);b=new Sf(c,d,f,b,e);Tf(a,b);return b}}function Fg(a){!a.b&&window.ShadyCSS&&window.ShadyCSS.CustomStyleInterface&&(a.b=window.ShadyCSS.CustomStyleInterface,a.b.transformCallback=function(b){a.ra(b)},a.b.validateCallback=function(){requestAnimationFrame(function(){(a.b.enqueued||a.g)&&a.flushCustomStyles()})})}
function Dg(a){!a.a&&window.ShadyCSS&&window.ShadyCSS.ApplyShim&&(a.a=window.ShadyCSS.ApplyShim,a.a.invalidCallback=yg);Fg(a)}
n.flushCustomStyles=function(){if(!Pe&&(Dg(this),this.b)){var a=this.b.processStyles();if(this.b.enqueued&&!sf(this.f.cssBuild)){if(Q){if(!this.f.cssBuild)for(var b=0;b<a.length;b++){var c=this.b.getStyleForCustomStyle(a[b]);if(c&&Q&&this.a){var d=ef(c);Dg(this);this.a.transformRules(d);c.textContent=cf(d)}}}else{Gg(this,this.c,this.f);for(b=0;b<a.length;b++)(c=this.b.getStyleForCustomStyle(a[b]))&&hg(c,this.f.w);this.g&&this.styleDocument()}this.b.enqueued=!1}}};
n.styleElement=function(a,b){if(Pe){if(b){T(a)||Tf(a,new Sf(null));var c=T(a);c.o=c.o||{};Object.assign(c.o,b);Hg(this,a,c)}}else if(c=T(a)||Eg(a))if(a!==this.c&&(this.g=!0),b&&(c.o=c.o||{},Object.assign(c.o,b)),Q)Hg(this,a,c);else if(this.flush(),Gg(this,a,c),c.fa&&c.fa.length){b=pf(a).is;var d;a:{if(d=Cg.cache[b])for(var e=d.length-1;0<=e;e--){var f=d[e];b:{var g=c.fa;for(var h=0;h<g.length;h++){var k=g[h];if(f.v[k]!==c.w[k]){g=!1;break b}}g=!0}if(g){d=f;break a}}d=void 0}g=d?d.styleElement:null;
e=c.s;(f=d&&d.s)||(f=this.l[b]=(this.l[b]||0)+1,f=b+"-"+f);c.s=f;f=c.s;h=ig;h=g?g.textContent||"":eg(h,a,c.w,f);k=T(a);var l=k.a;l&&!O&&l!==g&&(l._useCount--,0>=l._useCount&&l.parentNode&&l.parentNode.removeChild(l));O?k.a?(k.a.textContent=h,g=k.a):h&&(g=gf(h,f,a.shadowRoot,k.b)):g?g.parentNode||(Vf&&-1<h.indexOf("@media")&&(g.textContent=h),hf(g,null,k.b)):h&&(g=gf(h,f,null,k.b));g&&(g._useCount=g._useCount||0,k.a!=g&&g._useCount++,k.a=g);f=g;O||(g=c.s,k=h=a.getAttribute("class")||"",e&&(k=h.replace(new RegExp("\\s*x-scope\\s*"+
e+"\\s*","g")," ")),k+=(k?" ":"")+"x-scope "+g,h!==k&&nf(a,k));d||Cg.store(b,c.w,f,c.s)}};
function Hg(a,b,c){var d=pf(b).is;if(c.o){var e=c.o,f;for(f in e)null===f?b.style.removeProperty(f):b.style.setProperty(f,e[f])}e=wg[d];if(!(!e&&b!==a.c||e&&""!==rf(e))&&e&&e._style&&!zg(e)){if(zg(e)||e._applyShimValidatingVersion!==e._applyShimNextVersion)Dg(a),a.a&&a.a.transformRules(e._styleAst,d),e._style.textContent=zf(b,c.A),Ag(e);O&&(a=b.shadowRoot)&&(a=a.querySelector("style"))&&(a.textContent=zf(b,c.A));c.A=e._styleAst}}
function Ig(a,b){return(b=of(b).getRootNode().host)?T(b)||Eg(b)?b:Ig(a,b):a.c}function Gg(a,b,c){var d=Ig(a,b),e=T(d),f=e.w;d===a.c||f||(Gg(a,d,e),f=e.w);a=Object.create(f||null);d=dg(b,c.A,c.cssBuild);b=bg(e.A,b).v;Object.assign(a,d.Ha,b,d.Ra);b=c.o;for(var g in b)if((e=b[g])||0===e)a[g]=e;g=ig;b=Object.getOwnPropertyNames(a);for(e=0;e<b.length;e++)d=b[e],a[d]=$f(g,a[d],a);c.w=a}n.styleDocument=function(a){this.styleSubtree(this.c,a)};
n.styleSubtree=function(a,b){var c=of(a),d=c.shadowRoot;(d||a===this.c)&&this.styleElement(a,b);if(a=d&&(d.children||d.childNodes))for(c=0;c<a.length;c++)this.styleSubtree(a[c]);else if(c=c.children||c.childNodes)for(a=0;a<c.length;a++)this.styleSubtree(c[a])};
n.ra=function(a){var b=this,c=rf(a);c!==this.f.cssBuild&&(this.f.cssBuild=c);if(!sf(c)){var d=ef(a);df(d,function(a){if(O)Rf(a);else{var d=R;a.selector=a.parsedSelector;Rf(a);a.selector=a.j=Cf(d,a,d.c,void 0,void 0)}Q&&""===c&&(Dg(b),b.a&&b.a.transformRule(a))});Q?a.textContent=cf(d):this.f.A.rules.push(d)}};n.getComputedStyleValue=function(a,b){var c;Q||(c=(T(a)||T(Ig(this,a))).w[b]);return(c=c||window.getComputedStyle(a).getPropertyValue(b))?c.trim():""};
n.Ua=function(a,b){var c=of(a).getRootNode();b=b?b.split(/\s/):[];c=c.host&&c.host.localName;if(!c){var d=a.getAttribute("class");if(d){d=d.split(/\s/);for(var e=0;e<d.length;e++)if(d[e]===R.a){c=d[e+1];break}}}c&&b.push(R.a,c);Q||(c=T(a))&&c.s&&b.push(ig.a,c.s);nf(a,b.join(" "))};n.Ba=function(a){return T(a)};n.Ta=function(a,b){wf(a,b)};n.Wa=function(a,b){wf(a,b,!0)};n.Sa=function(a){return qg(a)};n.Da=function(a){return pg(a)};Y.prototype.flush=Y.prototype.flush;Y.prototype.prepareTemplate=Y.prototype.prepareTemplate;
Y.prototype.styleElement=Y.prototype.styleElement;Y.prototype.styleDocument=Y.prototype.styleDocument;Y.prototype.styleSubtree=Y.prototype.styleSubtree;Y.prototype.getComputedStyleValue=Y.prototype.getComputedStyleValue;Y.prototype.setElementClass=Y.prototype.Ua;Y.prototype._styleInfoForNode=Y.prototype.Ba;Y.prototype.transformCustomStyleForDocument=Y.prototype.ra;Y.prototype.getStyleAst=Y.prototype.Fa;Y.prototype.styleAstToString=Y.prototype.Va;Y.prototype.flushCustomStyles=Y.prototype.flushCustomStyles;
Y.prototype.scopeNode=Y.prototype.Ta;Y.prototype.unscopeNode=Y.prototype.Wa;Y.prototype.scopeForNode=Y.prototype.Sa;Y.prototype.currentScopeForNode=Y.prototype.Da;Y.prototype.prepareAdoptedCssText=Y.prototype.Qa;Object.defineProperties(Y.prototype,{nativeShadow:{get:function(){return O}},nativeCss:{get:function(){return Q}}});var Z=new Y,Jg,Kg;window.ShadyCSS&&(Jg=window.ShadyCSS.ApplyShim,Kg=window.ShadyCSS.CustomStyleInterface);
window.ShadyCSS={ScopingShim:Z,prepareTemplate:function(a,b,c){Z.flushCustomStyles();Z.prepareTemplate(a,b,c)},prepareTemplateDom:function(a,b){Z.prepareTemplateDom(a,b)},prepareTemplateStyles:function(a,b,c){Z.flushCustomStyles();Z.prepareTemplateStyles(a,b,c)},styleSubtree:function(a,b){Z.flushCustomStyles();Z.styleSubtree(a,b)},styleElement:function(a){Z.flushCustomStyles();Z.styleElement(a)},styleDocument:function(a){Z.flushCustomStyles();Z.styleDocument(a)},flushCustomStyles:function(){Z.flushCustomStyles()},
getComputedStyleValue:function(a,b){return Z.getComputedStyleValue(a,b)},nativeCss:Q,nativeShadow:O,cssBuild:Qe,disableRuntime:Pe};Jg&&(window.ShadyCSS.ApplyShim=Jg);Kg&&(window.ShadyCSS.CustomStyleInterface=Kg);var Lg=window.customElements,Mg=window.HTMLImports,Ng=window.HTMLTemplateElement;window.WebComponents=window.WebComponents||{};if(Lg&&Lg.polyfillWrapFlushCallback){var Og,Pg=function(){if(Og){Ng.C&&Ng.C(window.document);var a=Og;Og=null;a();return!0}},Qg=Mg.whenReady;Lg.polyfillWrapFlushCallback(function(a){Og=a;Qg(Pg)});Mg.whenReady=function(a){Qg(function(){Pg()?Mg.whenReady(a):a()})}}
Mg.whenReady(function(){requestAnimationFrame(function(){window.WebComponents.ready=!0;document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})});var Rg=document.createElement("style");Rg.textContent="body {transition: opacity ease-in 0.2s; } \nbody[unresolved] {opacity: 0; display: block; overflow: hidden; position: relative; } \n";var Sg=document.querySelector("head");Sg.insertBefore(Rg,Sg.firstChild);}).call(this);



(function(){/*

Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
'use strict';var l=!(window.ShadyDOM&&window.ShadyDOM.inUse),p;function r(a){p=a&&a.shimcssproperties?!1:l||!(navigator.userAgent.match(/AppleWebKit\/601|Edge\/15/)||!window.CSS||!CSS.supports||!CSS.supports("box-shadow","0 0 0 var(--foo)"))}var t;window.ShadyCSS&&void 0!==window.ShadyCSS.cssBuild&&(t=window.ShadyCSS.cssBuild);var aa=!(!window.ShadyCSS||!window.ShadyCSS.disableRuntime);
window.ShadyCSS&&void 0!==window.ShadyCSS.nativeCss?p=window.ShadyCSS.nativeCss:window.ShadyCSS?(r(window.ShadyCSS),window.ShadyCSS=void 0):r(window.WebComponents&&window.WebComponents.flags);var u=p,v=t;function w(){this.end=this.start=0;this.rules=this.parent=this.previous=null;this.cssText=this.parsedCssText="";this.atRule=!1;this.type=0;this.parsedSelector=this.selector=this.keyframesName=""}
function x(a){a=a.replace(ba,"").replace(ca,"");var b=y,c=a,e=new w;e.start=0;e.end=c.length;for(var d=e,f=0,g=c.length;f<g;f++)if("{"===c[f]){d.rules||(d.rules=[]);var h=d,k=h.rules[h.rules.length-1]||null;d=new w;d.start=f+1;d.parent=h;d.previous=k;h.rules.push(d)}else"}"===c[f]&&(d.end=f+1,d=d.parent||e);return b(e,a)}
function y(a,b){var c=b.substring(a.start,a.end-1);a.parsedCssText=a.cssText=c.trim();a.parent&&(c=b.substring(a.previous?a.previous.end:a.parent.start,a.start-1),c=da(c),c=c.replace(z," "),c=c.substring(c.lastIndexOf(";")+1),c=a.parsedSelector=a.selector=c.trim(),a.atRule=0===c.indexOf("@"),a.atRule?0===c.indexOf("@media")?a.type=A:c.match(ea)&&(a.type=B,a.keyframesName=a.selector.split(z).pop()):a.type=0===c.indexOf("--")?C:D);if(c=a.rules)for(var e=0,d=c.length,f=void 0;e<d&&(f=c[e]);e++)y(f,b);
return a}function da(a){return a.replace(/\\([0-9a-f]{1,6})\s/gi,function(a,c){a=c;for(c=6-a.length;c--;)a="0"+a;return"\\"+a})}
function E(a,b,c){c=void 0===c?"":c;var e="";if(a.cssText||a.rules){var d=a.rules,f;if(f=d)f=d[0],f=!(f&&f.selector&&0===f.selector.indexOf("--"));if(f){f=0;for(var g=d.length,h=void 0;f<g&&(h=d[f]);f++)e=E(h,b,e)}else b?b=a.cssText:(b=a.cssText,b=b.replace(fa,"").replace(ha,""),b=b.replace(ia,"").replace(ja,"")),(e=b.trim())&&(e="  "+e+"\n")}e&&(a.selector&&(c+=a.selector+" {\n"),c+=e,a.selector&&(c+="}\n\n"));return c}
var D=1,B=7,A=4,C=1E3,ba=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,ca=/@import[^;]*;/gim,fa=/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,ha=/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,ia=/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,ja=/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,ea=/^@[^\s]*keyframes/,z=/\s+/g;var G=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gi,H=/(?:^|\W+)@apply\s*\(?([^);\n]*)\)?/gi,ka=/@media\s(.*)/;var I=new Set;function J(a){if(!a)return"";"string"===typeof a&&(a=x(a));return E(a,u)}function K(a){!a.__cssRules&&a.textContent&&(a.__cssRules=x(a.textContent));return a.__cssRules||null}function L(a,b,c,e){if(a){var d=!1,f=a.type;if(e&&f===A){var g=a.selector.match(ka);g&&(window.matchMedia(g[1]).matches||(d=!0))}f===D?b(a):c&&f===B?c(a):f===C&&(d=!0);if((a=a.rules)&&!d)for(d=0,f=a.length,g=void 0;d<f&&(g=a[d]);d++)L(g,b,c,e)}}
function M(a,b){var c=a.indexOf("var(");if(-1===c)return b(a,"","","");a:{var e=0;var d=c+3;for(var f=a.length;d<f;d++)if("("===a[d])e++;else if(")"===a[d]&&0===--e)break a;d=-1}e=a.substring(c+4,d);c=a.substring(0,c);a=M(a.substring(d+1),b);d=e.indexOf(",");return-1===d?b(c,e.trim(),"",a):b(c,e.substring(0,d).trim(),e.substring(d+1).trim(),a)}
function N(a){if(void 0!==v)return v;if(void 0===a.__cssBuild){var b=a.getAttribute("css-build");if(b)a.__cssBuild=b;else{a:{b="template"===a.localName?a.content.firstChild:a.firstChild;if(b instanceof Comment&&(b=b.textContent.trim().split(":"),"css-build"===b[0])){b=b[1];break a}b=""}if(""!==b){var c="template"===a.localName?a.content.firstChild:a.firstChild;c.parentNode.removeChild(c)}a.__cssBuild=b}}return a.__cssBuild||""};var la=/;\s*/m,ma=/^\s*(initial)|(inherit)\s*$/,O=/\s*!important/;function P(){this.a={}}P.prototype.set=function(a,b){a=a.trim();this.a[a]={h:b,i:{}}};P.prototype.get=function(a){a=a.trim();return this.a[a]||null};var Q=null;function R(){this.b=this.c=null;this.a=new P}R.prototype.o=function(a){a=H.test(a)||G.test(a);H.lastIndex=0;G.lastIndex=0;return a};
R.prototype.m=function(a,b){if(void 0===a._gatheredStyle){var c=[];for(var e=a.content.querySelectorAll("style"),d=0;d<e.length;d++){var f=e[d];if(f.hasAttribute("shady-unscoped")){if(!l){var g=f.textContent;I.has(g)||(I.add(g),g=f.cloneNode(!0),document.head.appendChild(g));f.parentNode.removeChild(f)}}else c.push(f.textContent),f.parentNode.removeChild(f)}(c=c.join("").trim())?(e=document.createElement("style"),e.textContent=c,a.content.insertBefore(e,a.content.firstChild),c=e):c=null;a._gatheredStyle=
c}return(a=a._gatheredStyle)?this.j(a,b):null};R.prototype.j=function(a,b){b=void 0===b?"":b;var c=K(a);this.l(c,b);a.textContent=J(c);return c};R.prototype.f=function(a){var b=this,c=K(a);L(c,function(a){":root"===a.selector&&(a.selector="html");b.g(a)});a.textContent=J(c);return c};R.prototype.l=function(a,b){var c=this;this.c=b;L(a,function(a){c.g(a)});this.c=null};R.prototype.g=function(a){a.cssText=na(this,a.parsedCssText,a);":root"===a.selector&&(a.selector=":host > *")};
function na(a,b,c){b=b.replace(G,function(b,d,f,g){return oa(a,b,d,f,g,c)});return S(a,b,c)}function pa(a,b){for(var c=b;c.parent;)c=c.parent;var e={},d=!1;L(c,function(c){(d=d||c===b)||c.selector===b.selector&&Object.assign(e,T(a,c.parsedCssText))});return e}
function S(a,b,c){for(var e;e=H.exec(b);){var d=e[0],f=e[1];e=e.index;var g=b.slice(0,e+d.indexOf("@apply"));b=b.slice(e+d.length);var h=c?pa(a,c):{};Object.assign(h,T(a,g));d=void 0;var k=a;f=f.replace(la,"");var n=[];var m=k.a.get(f);m||(k.a.set(f,{}),m=k.a.get(f));if(m){k.c&&(m.i[k.c]=!0);var q=m.h;for(d in q)k=h&&h[d],m=[d,": var(",f,"_-_",d],k&&m.push(",",k.replace(O,"")),m.push(")"),O.test(q[d])&&m.push(" !important"),n.push(m.join(""))}d=n.join("; ");b=g+d+b;H.lastIndex=e+d.length}return b}
function T(a,b,c){c=void 0===c?!1:c;b=b.split(";");for(var e,d,f={},g=0,h;g<b.length;g++)if(e=b[g])if(h=e.split(":"),1<h.length){e=h[0].trim();d=h.slice(1).join(":");if(c){var k=a;h=e;var n=ma.exec(d);n&&(n[1]?(k.b||(k.b=document.createElement("meta"),k.b.setAttribute("apply-shim-measure",""),k.b.style.all="initial",document.head.appendChild(k.b)),h=window.getComputedStyle(k.b).getPropertyValue(h)):h="apply-shim-inherit",d=h)}f[e]=d}return f}function qa(a,b){if(Q)for(var c in b.i)c!==a.c&&Q(c)}
function oa(a,b,c,e,d,f){e&&M(e,function(b,c){c&&a.a.get(c)&&(d="@apply "+c+";")});if(!d)return b;var g=S(a,""+d,f);f=b.slice(0,b.indexOf("--"));var h=g=T(a,g,!0),k=a.a.get(c),n=k&&k.h;n?h=Object.assign(Object.create(n),g):a.a.set(c,h);var m=[],q,Z=!1;for(q in h){var F=g[q];void 0===F&&(F="initial");!n||q in n||(Z=!0);m.push(c+"_-_"+q+": "+F)}Z&&qa(a,k);k&&(k.h=h);e&&(f=b+";"+f);return f+m.join("; ")+";"}R.prototype.detectMixin=R.prototype.o;R.prototype.transformStyle=R.prototype.j;
R.prototype.transformCustomStyle=R.prototype.f;R.prototype.transformRules=R.prototype.l;R.prototype.transformRule=R.prototype.g;R.prototype.transformTemplate=R.prototype.m;R.prototype._separator="_-_";Object.defineProperty(R.prototype,"invalidCallback",{get:function(){return Q},set:function(a){Q=a}});var U={};var ra=Promise.resolve();function sa(a){if(a=U[a])a._applyShimCurrentVersion=a._applyShimCurrentVersion||0,a._applyShimValidatingVersion=a._applyShimValidatingVersion||0,a._applyShimNextVersion=(a._applyShimNextVersion||0)+1}function ta(a){return a._applyShimCurrentVersion===a._applyShimNextVersion}function ua(a){a._applyShimValidatingVersion=a._applyShimNextVersion;a._validating||(a._validating=!0,ra.then(function(){a._applyShimCurrentVersion=a._applyShimNextVersion;a._validating=!1}))};var V=new R;function W(){this.a=null;V.invalidCallback=sa}function X(a){!a.a&&window.ShadyCSS.CustomStyleInterface&&(a.a=window.ShadyCSS.CustomStyleInterface,a.a.transformCallback=function(a){V.f(a)},a.a.validateCallback=function(){requestAnimationFrame(function(){a.a.enqueued&&a.flushCustomStyles()})})}W.prototype.prepareTemplate=function(a,b){X(this);""===N(a)&&(U[b]=a,b=V.m(a,b),a._styleAst=b)};
W.prototype.flushCustomStyles=function(){X(this);if(this.a){var a=this.a.processStyles();if(this.a.enqueued){for(var b=0;b<a.length;b++){var c=this.a.getStyleForCustomStyle(a[b]);c&&V.f(c)}this.a.enqueued=!1}}};
W.prototype.styleSubtree=function(a,b){X(this);if(b)for(var c in b)null===c?a.style.removeProperty(c):a.style.setProperty(c,b[c]);if(a.shadowRoot)for(this.styleElement(a),a=a.shadowRoot.children||a.shadowRoot.childNodes,b=0;b<a.length;b++)this.styleSubtree(a[b]);else for(a=a.children||a.childNodes,b=0;b<a.length;b++)this.styleSubtree(a[b])};
W.prototype.styleElement=function(a){X(this);var b=a.localName,c;b?-1<b.indexOf("-")?c=b:c=a.getAttribute&&a.getAttribute("is")||"":c=a.is;b=U[c];if(!(b&&""!==N(b)||!b||ta(b))){if(ta(b)||b._applyShimValidatingVersion!==b._applyShimNextVersion)this.prepareTemplate(b,c),ua(b);if(a=a.shadowRoot)if(a=a.querySelector("style"))a.__cssRules=b._styleAst,a.textContent=J(b._styleAst)}};W.prototype.styleDocument=function(a){X(this);this.styleSubtree(document.body,a)};
if(!window.ShadyCSS||!window.ShadyCSS.ScopingShim){var Y=new W,va=window.ShadyCSS&&window.ShadyCSS.CustomStyleInterface;window.ShadyCSS={prepareTemplate:function(a,b){Y.flushCustomStyles();Y.prepareTemplate(a,b)},prepareTemplateStyles:function(a,b,c){window.ShadyCSS.prepareTemplate(a,b,c)},prepareTemplateDom:function(){},styleSubtree:function(a,b){Y.flushCustomStyles();Y.styleSubtree(a,b)},styleElement:function(a){Y.flushCustomStyles();Y.styleElement(a)},styleDocument:function(a){Y.flushCustomStyles();
Y.styleDocument(a)},getComputedStyleValue:function(a,b){return(a=window.getComputedStyle(a).getPropertyValue(b))?a.trim():""},flushCustomStyles:function(){Y.flushCustomStyles()},nativeCss:u,nativeShadow:l,cssBuild:v,disableRuntime:aa};va&&(window.ShadyCSS.CustomStyleInterface=va)}window.ShadyCSS.ApplyShim=V;}).call(this);




(function() {
  'use strict';

  const userPolymer = window.Polymer;

  /**
   * @namespace Polymer
   * @summary Polymer is a lightweight library built on top of the web
   *   standards-based Web Components API's, and makes it easy to build your
   *   own custom HTML elements.
   * @param {!PolymerInit} info Prototype for the custom element. It must contain
   *   an `is` property to specify the element name. Other properties populate
   *   the element prototype. The `properties`, `observers`, `hostAttributes`,
   *   and `listeners` properties are processed to create element features.
   * @return {!Object} Returns a custom element class for the given provided
   *   prototype `info` object. The name of the element if given by `info.is`.
   */
  window.Polymer = function(info) {
    return window.Polymer._polymerFn(info);
  };

  // support user settings on the Polymer object
  if (userPolymer) {
    Object.assign(Polymer, userPolymer);
  }

  // To be plugged by legacy implementation if loaded
  /* eslint-disable valid-jsdoc */
  /**
   * @param {!PolymerInit} info Prototype for the custom element. It must contain
   *   an `is` property to specify the element name. Other properties populate
   *   the element prototype. The `properties`, `observers`, `hostAttributes`,
   *   and `listeners` properties are processed to create element features.
   * @return {!Object} Returns a custom element class for the given provided
   *   prototype `info` object. The name of the element if given by `info.is`.
   */
  window.Polymer._polymerFn = function(info) { // eslint-disable-line no-unused-vars
    throw new Error('Load polymer.html to use the Polymer() function.');
  };
  /* eslint-enable */

  window.Polymer.version = '2.7.0';

  /* eslint-disable no-unused-vars */
  /*
  When using Closure Compiler, JSCompiler_renameProperty(property, object) is replaced by the munged name for object[property]
  We cannot alias this function, so we have to use a small shim that has the same behavior when not compiling.
  */
  window.JSCompiler_renameProperty = function(prop, obj) {
    return prop;
  };
  /* eslint-enable */

})();



  (function() {
    'use strict';

    let CSS_URL_RX = /(url\()([^)]*)(\))/g;
    let ABS_URL = /(^\/)|(^#)|(^[\w-\d]*:)/;
    let workingURL;
    let resolveDoc;
    /**
     * Resolves the given URL against the provided `baseUri'.
     * 
     * Note that this function performs no resolution for URLs that start
     * with `/` (absolute URLs) or `#` (hash identifiers).  For general purpose
     * URL resolution, use `window.URL`.
     *
     * @memberof Polymer.ResolveUrl
     * @param {string} url Input URL to resolve
     * @param {?string=} baseURI Base URI to resolve the URL against
     * @return {string} resolved URL
     */
    function resolveUrl(url, baseURI) {
      if (url && ABS_URL.test(url)) {
        return url;
      }
      // Lazy feature detection.
      if (workingURL === undefined) {
        workingURL = false;
        try {
          const u = new URL('b', 'http://a');
          u.pathname = 'c%20d';
          workingURL = (u.href === 'http://a/c%20d');
        } catch (e) {
          // silently fail
        }
      }
      if (!baseURI) {
        baseURI = document.baseURI || window.location.href;
      }
      if (workingURL) {
        return (new URL(url, baseURI)).href;
      }
      // Fallback to creating an anchor into a disconnected document.
      if (!resolveDoc) {
        resolveDoc = document.implementation.createHTMLDocument('temp');
        resolveDoc.base = resolveDoc.createElement('base');
        resolveDoc.head.appendChild(resolveDoc.base);
        resolveDoc.anchor = resolveDoc.createElement('a');
        resolveDoc.body.appendChild(resolveDoc.anchor);
      }
      resolveDoc.base.href = baseURI;
      resolveDoc.anchor.href = url;
      return resolveDoc.anchor.href || url;

    }

    /**
     * Resolves any relative URL's in the given CSS text against the provided
     * `ownerDocument`'s `baseURI`.
     *
     * @memberof Polymer.ResolveUrl
     * @param {string} cssText CSS text to process
     * @param {string} baseURI Base URI to resolve the URL against
     * @return {string} Processed CSS text with resolved URL's
     */
    function resolveCss(cssText, baseURI) {
      return cssText.replace(CSS_URL_RX, function(m, pre, url, post) {
        return pre + '\'' +
          resolveUrl(url.replace(/["']/g, ''), baseURI) +
          '\'' + post;
      });
    }

    /**
     * Returns a path from a given `url`. The path includes the trailing
     * `/` from the url.
     *
     * @memberof Polymer.ResolveUrl
     * @param {string} url Input URL to transform
     * @return {string} resolved path
     */
    function pathFromUrl(url) {
      return url.substring(0, url.lastIndexOf('/') + 1);
    }

    /**
     * Module with utilities for resolving relative URL's.
     *
     * @namespace
     * @memberof Polymer
     * @summary Module with utilities for resolving relative URL's.
     */
    Polymer.ResolveUrl = {
      resolveCss: resolveCss,
      resolveUrl: resolveUrl,
      pathFromUrl: pathFromUrl
    };

  })();



/** @suppress {deprecated} */
(function() {
  'use strict';

  /**
   * Sets the global, legacy settings.
   *
   * @deprecated
   * @namespace
   * @memberof Polymer
   */
  Polymer.Settings = Polymer.Settings || {};

  Polymer.Settings.useShadow = !(window.ShadyDOM);
  Polymer.Settings.useNativeCSSProperties =
    Boolean(!window.ShadyCSS || window.ShadyCSS.nativeCss);
  Polymer.Settings.useNativeCustomElements =
    !(window.customElements.polyfillWrapFlushCallback);


  /**
   * Globally settable property that is automatically assigned to
   * `Polymer.ElementMixin` instances, useful for binding in templates to
   * make URL's relative to an application's root.  Defaults to the main
   * document URL, but can be overridden by users.  It may be useful to set
   * `Polymer.rootPath` to provide a stable application mount path when
   * using client side routing.
   *
   * @memberof Polymer
   */
  Polymer.rootPath = Polymer.rootPath ||
    Polymer.ResolveUrl.pathFromUrl(document.baseURI || window.location.href);

  /**
   * Sets the global rootPath property used by `Polymer.ElementMixin` and
   * available via `Polymer.rootPath`.
   *
   * @memberof Polymer
   * @param {string} path The new root path
   * @return {void}
   */
  Polymer.setRootPath = function(path) {
    Polymer.rootPath = path;
  };

  /**
   * A global callback used to sanitize any value before inserting it into the DOM. The callback signature is:
   *
   *     Polymer = {
   *       sanitizeDOMValue: function(value, name, type, node) { ... }
   *     }
   *
   * Where:
   *
   * `value` is the value to sanitize.
   * `name` is the name of an attribute or property (for example, href).
   * `type` indicates where the value is being inserted: one of property, attribute, or text.
   * `node` is the node where the value is being inserted.
   *
   * @type {(function(*,string,string,Node):*)|undefined}
   * @memberof Polymer
   */
  Polymer.sanitizeDOMValue = Polymer.sanitizeDOMValue || null;

  /**
   * Sets the global sanitizeDOMValue available via `Polymer.sanitizeDOMValue`.
   *
   * @memberof Polymer
   * @param {(function(*,string,string,Node):*)|undefined} newSanitizeDOMValue the global sanitizeDOMValue callback
   * @return {void}
   */
  Polymer.setSanitizeDOMValue = function(newSanitizeDOMValue) {
    Polymer.sanitizeDOMValue = newSanitizeDOMValue;
  };

  /**
   * Globally settable property to make Polymer Gestures use passive TouchEvent listeners when recognizing gestures.
   * When set to `true`, gestures made from touch will not be able to prevent scrolling, allowing for smoother
   * scrolling performance.
   * Defaults to `false` for backwards compatibility.
   *
   * @memberof Polymer
   */
  Polymer.passiveTouchGestures = Polymer.passiveTouchGestures || false;

  /**
   * Sets `passiveTouchGestures` globally for all elements using Polymer Gestures.
   *
   * @memberof Polymer
   * @param {boolean} usePassive enable or disable passive touch gestures globally
   * @return {void}
   */
  Polymer.setPassiveTouchGestures = function(usePassive) {
    Polymer.passiveTouchGestures = usePassive;
  };

  Polymer.legacyOptimizations = Polymer.legacyOptimizations ||
      window.PolymerSettings && window.PolymerSettings.legacyOptimizations || false;

  /**
   * Sets `legacyOptimizations` globally for all elements. Enables
   * optimizations when only legacy Polymer() style elements are used.
   *
   * @memberof Polymer
   * @param {boolean} useLegacyOptimizations enable or disable legacy optimizations globally.
   * @return {void}
   */
  Polymer.setLegacyOptimizations = function(useLegacyOptimizations) {
    Polymer.legacyOptimizations = useLegacyOptimizations;
  };
})();



(function() {

  'use strict';

  // unique global id for deduping mixins.
  let dedupeId = 0;

  /**
   * @constructor
   * @extends {Function}
   * @private
   */
  function MixinFunction(){}
  /** @type {(WeakMap | undefined)} */
  MixinFunction.prototype.__mixinApplications;
  /** @type {(Object | undefined)} */
  MixinFunction.prototype.__mixinSet;

  /* eslint-disable valid-jsdoc */
  /**
   * Wraps an ES6 class expression mixin such that the mixin is only applied
   * if it has not already been applied its base argument. Also memoizes mixin
   * applications.
   *
   * @memberof Polymer
   * @template T
   * @param {T} mixin ES6 class expression mixin to wrap
   * @return {T}
   * @suppress {invalidCasts}
   */
  Polymer.dedupingMixin = function(mixin) {
    let mixinApplications = /** @type {!MixinFunction} */(mixin).__mixinApplications;
    if (!mixinApplications) {
      mixinApplications = new WeakMap();
      /** @type {!MixinFunction} */(mixin).__mixinApplications = mixinApplications;
    }
    // maintain a unique id for each mixin
    let mixinDedupeId = dedupeId++;
    function dedupingMixin(base) {
      let baseSet = /** @type {!MixinFunction} */(base).__mixinSet;
      if (baseSet && baseSet[mixinDedupeId]) {
        return base;
      }
      let map = mixinApplications;
      let extended = map.get(base);
      if (!extended) {
        extended = /** @type {!Function} */(mixin)(base);
        map.set(base, extended);
      }
      // copy inherited mixin set from the extended class, or the base class
      // NOTE: we avoid use of Set here because some browser (IE11)
      // cannot extend a base Set via the constructor.
      let mixinSet = Object.create(/** @type {!MixinFunction} */(extended).__mixinSet || baseSet || null);
      mixinSet[mixinDedupeId] = true;
      /** @type {!MixinFunction} */(extended).__mixinSet = mixinSet;
      return extended;
    }

    return /** @type {T} */ (dedupingMixin);
  };
  /* eslint-enable valid-jsdoc */

})();



(function() {
  'use strict';

  const MODULE_STYLE_LINK_SELECTOR = 'link[rel=import][type~=css]';
  const INCLUDE_ATTR = 'include';
  const SHADY_UNSCOPED_ATTR = 'shady-unscoped';

  function importModule(moduleId) {
    const /** Polymer.DomModule */ PolymerDomModule = customElements.get('dom-module');
    if (!PolymerDomModule) {
      return null;
    }
    return PolymerDomModule.import(moduleId);
  }

  function styleForImport(importDoc) {
    // NOTE: polyfill affordance.
    // under the HTMLImports polyfill, there will be no 'body',
    // but the import pseudo-doc can be used directly.
    let container = importDoc.body ? importDoc.body : importDoc;
    const importCss = Polymer.ResolveUrl.resolveCss(container.textContent,
      importDoc.baseURI);
    const style = document.createElement('style');
    style.textContent = importCss;
    return style;
  }

  /** @typedef {{assetpath: string}} */
  let templateWithAssetPath; // eslint-disable-line no-unused-vars

  /**
   * Module with utilities for collection CSS text from `<templates>`, external
   * stylesheets, and `dom-module`s.
   *
   * @namespace
   * @memberof Polymer
   * @summary Module with utilities for collection CSS text from various sources.
   */
  const StyleGather = {

    /**
     * Returns a list of <style> elements in a space-separated list of `dom-module`s.
     *
     * @memberof Polymer.StyleGather
     * @param {string} moduleIds List of dom-module id's within which to
     * search for css.
     * @return {!Array<!HTMLStyleElement>} Array of contained <style> elements
     * @this {StyleGather}
     */
     stylesFromModules(moduleIds) {
      const modules = moduleIds.trim().split(/\s+/);
      const styles = [];
      for (let i=0; i < modules.length; i++) {
        styles.push(...this.stylesFromModule(modules[i]));
      }
      return styles;
    },

    /**
     * Returns a list of <style> elements in a given `dom-module`.
     * Styles in a `dom-module` can come either from `<style>`s within the
     * first `<template>`, or else from one or more
     * `<link rel="import" type="css">` links outside the template.
     *
     * @memberof Polymer.StyleGather
     * @param {string} moduleId dom-module id to gather styles from
     * @return {!Array<!HTMLStyleElement>} Array of contained styles.
     * @this {StyleGather}
     */
    stylesFromModule(moduleId) {
      const m = importModule(moduleId);

      if (!m) {
        console.warn('Could not find style data in module named', moduleId);
        return [];
      }

      if (m._styles === undefined) {
        const styles = [];
        // module imports: <link rel="import" type="css">
        styles.push(...this._stylesFromModuleImports(m));
        // include css from the first template in the module
        const template = m.querySelector('template');
        if (template) {
          styles.push(...this.stylesFromTemplate(template,
            /** @type {templateWithAssetPath} */(m).assetpath));
        }

        m._styles = styles;
      }

      return m._styles;
    },

    /**
     * Returns the `<style>` elements within a given template.
     *
     * @memberof Polymer.StyleGather
     * @param {!HTMLTemplateElement} template Template to gather styles from
     * @param {string} baseURI baseURI for style content
     * @return {!Array<!HTMLStyleElement>} Array of styles
     * @this {StyleGather}
     */
    stylesFromTemplate(template, baseURI) {
      if (!template._styles) {
        const styles = [];
        // if element is a template, get content from its .content
        const e$ = template.content.querySelectorAll('style');
        for (let i=0; i < e$.length; i++) {
          let e = e$[i];
          // support style sharing by allowing styles to "include"
          // other dom-modules that contain styling
          let include = e.getAttribute(INCLUDE_ATTR);
          if (include) {
            styles.push(...this.stylesFromModules(include).filter(function(item, index, self) {
              return self.indexOf(item) === index;
            }));
          }
          if (baseURI) {
            e.textContent = Polymer.ResolveUrl.resolveCss(e.textContent, baseURI);
          }
          styles.push(e);
        }
        template._styles = styles;
      }
      return template._styles;
    },

    /**
     * Returns a list of <style> elements  from stylesheets loaded via `<link rel="import" type="css">` links within the specified `dom-module`.
     *
     * @memberof Polymer.StyleGather
     * @param {string} moduleId Id of `dom-module` to gather CSS from
     * @return {!Array<!HTMLStyleElement>} Array of contained styles.
     * @this {StyleGather}
     */
     stylesFromModuleImports(moduleId) {
      let m = importModule(moduleId);
      return m ? this._stylesFromModuleImports(m) : [];
    },

    /**
     * @memberof Polymer.StyleGather
     * @this {StyleGather}
     * @param {!HTMLElement} module dom-module element that could contain `<link rel="import" type="css">` styles
     * @return {!Array<!HTMLStyleElement>} Array of contained styles
     */
    _stylesFromModuleImports(module) {
      const styles = [];
      const p$ = module.querySelectorAll(MODULE_STYLE_LINK_SELECTOR);
      for (let i=0; i < p$.length; i++) {
        let p = p$[i];
        if (p.import) {
          const importDoc = p.import;
          const unscoped = p.hasAttribute(SHADY_UNSCOPED_ATTR);
          if (unscoped && !importDoc._unscopedStyle) {
            const style = styleForImport(importDoc);
            style.setAttribute(SHADY_UNSCOPED_ATTR, '');
            importDoc._unscopedStyle = style;
          } else if (!importDoc._style) {
            importDoc._style = styleForImport(importDoc);
          }
          styles.push(unscoped ? importDoc._unscopedStyle : importDoc._style);
        }
      }
      return styles;
    },

    /**
     *
     * Returns CSS text of styles in a space-separated list of `dom-module`s.
     * Note: This method is deprecated, use `stylesFromModules` instead.
     *
     * @deprecated
     * @memberof Polymer.StyleGather
     * @param {string} moduleIds List of dom-module id's within which to
     * search for css.
     * @return {string} Concatenated CSS content from specified `dom-module`s
     * @this {StyleGather}
     */
     cssFromModules(moduleIds) {
      let modules = moduleIds.trim().split(/\s+/);
      let cssText = '';
      for (let i=0; i < modules.length; i++) {
        cssText += this.cssFromModule(modules[i]);
      }
      return cssText;
    },

    /**
     * Returns CSS text of styles in a given `dom-module`.  CSS in a `dom-module`
     * can come either from `<style>`s within the first `<template>`, or else
     * from one or more `<link rel="import" type="css">` links outside the
     * template.
     *
     * Any `<styles>` processed are removed from their original location.
     * Note: This method is deprecated, use `styleFromModule` instead.
     *
     * @deprecated
     * @memberof Polymer.StyleGather
     * @param {string} moduleId dom-module id to gather styles from
     * @return {string} Concatenated CSS content from specified `dom-module`
     * @this {StyleGather}
     */
    cssFromModule(moduleId) {
      let m = importModule(moduleId);
      if (m && m._cssText === undefined) {
        // module imports: <link rel="import" type="css">
        let cssText = this._cssFromModuleImports(m);
        // include css from the first template in the module
        let t = m.querySelector('template');
        if (t) {
          cssText += this.cssFromTemplate(t,
            /** @type {templateWithAssetPath} */(m).assetpath);
        }
        m._cssText = cssText || null;
      }
      if (!m) {
        console.warn('Could not find style data in module named', moduleId);
      }
      return m && m._cssText || '';
    },

    /**
     * Returns CSS text of `<styles>` within a given template.
     *
     * Any `<styles>` processed are removed from their original location.
     * Note: This method is deprecated, use `styleFromTemplate` instead.
     *
     * @deprecated
     * @memberof Polymer.StyleGather
     * @param {!HTMLTemplateElement} template Template to gather styles from
     * @param {string} baseURI Base URI to resolve the URL against
     * @return {string} Concatenated CSS content from specified template
     * @this {StyleGather}
     */
    cssFromTemplate(template, baseURI) {
      let cssText = '';
      const e$ = this.stylesFromTemplate(template, baseURI);
      // if element is a template, get content from its .content
      for (let i=0; i < e$.length; i++) {
        let e = e$[i];
        if (e.parentNode) {
          e.parentNode.removeChild(e);
        }
        cssText += e.textContent;
      }
      return cssText;
    },

    /**
     * Returns CSS text from stylesheets loaded via `<link rel="import" type="css">`
     * links within the specified `dom-module`.
     *
     * Note: This method is deprecated, use `stylesFromModuleImports` instead.
     *
     * @deprecated
     *
     * @memberof Polymer.StyleGather
     * @param {string} moduleId Id of `dom-module` to gather CSS from
     * @return {string} Concatenated CSS content from links in specified `dom-module`
     * @this {StyleGather}
     */
    cssFromModuleImports(moduleId) {
      let m = importModule(moduleId);
      return m ? this._cssFromModuleImports(m) : '';
    },

    /**
     * @deprecated
     * @memberof Polymer.StyleGather
     * @this {StyleGather}
     * @param {!HTMLElement} module dom-module element that could contain `<link rel="import" type="css">` styles
     * @return {string} Concatenated CSS content from links in the dom-module
     */
     _cssFromModuleImports(module) {
      let cssText = '';
      let styles = this._stylesFromModuleImports(module);
      for (let i=0; i < styles.length; i++) {
        cssText += styles[i].textContent;
      }
      return cssText;
    }
  };

  Polymer.StyleGather = StyleGather;
})();


(function() {
  'use strict';

  let modules = {};
  let lcModules = {};
  function setModule(id, module) {
    // store id separate from lowercased id so that
    // in all cases mixedCase id will stored distinctly
    // and lowercase version is a fallback
    modules[id] = lcModules[id.toLowerCase()] = module;
  }
  function findModule(id) {
    return modules[id] || lcModules[id.toLowerCase()];
  }

  function styleOutsideTemplateCheck(inst) {
    if (inst.querySelector('style')) {
      console.warn('dom-module %s has style outside template', inst.id);
    }
  }

  /**
   * The `dom-module` element registers the dom it contains to the name given
   * by the module's id attribute. It provides a unified database of dom
   * accessible via its static `import` API.
   *
   * A key use case of `dom-module` is for providing custom element `<template>`s
   * via HTML imports that are parsed by the native HTML parser, that can be
   * relocated during a bundling pass and still looked up by `id`.
   *
   * Example:
   *
   *     <dom-module id="foo">
   *       <img src="stuff.png">
   *     </dom-module>
   *
   * Then in code in some other location that cannot access the dom-module above
   *
   *     let img = customElements.get('dom-module').import('foo', 'img');
   *
   * @customElement
   * @extends HTMLElement
   * @memberof Polymer
   * @summary Custom element that provides a registry of relocatable DOM content
   *   by `id` that is agnostic to bundling.
   * @unrestricted
   */
  class DomModule extends HTMLElement {

    static get observedAttributes() { return ['id']; }

    /**
     * Retrieves the element specified by the css `selector` in the module
     * registered by `id`. For example, this.import('foo', 'img');
     * @param {string} id The id of the dom-module in which to search.
     * @param {string=} selector The css selector by which to find the element.
     * @return {Element} Returns the element which matches `selector` in the
     * module registered at the specified `id`.
     */
    static import(id, selector) {
      if (id) {
        let m = findModule(id);
        if (m && selector) {
          return m.querySelector(selector);
        }
        return m;
      }
      return null;
    }

    /* eslint-disable no-unused-vars */
    /**
     * @param {string} name Name of attribute.
     * @param {?string} old Old value of attribute.
     * @param {?string} value Current value of attribute.
     * @param {?string} namespace Attribute namespace.
     * @return {void}
     */
    attributeChangedCallback(name, old, value, namespace) {
      if (old !== value) {
        this.register();
      }
    }
    /* eslint-enable no-unused-args */

    /**
     * The absolute URL of the original location of this `dom-module`.
     *
     * This value will differ from this element's `ownerDocument` in the
     * following ways:
     * - Takes into account any `assetpath` attribute added during bundling
     *   to indicate the original location relative to the bundled location
     * - Uses the HTMLImports polyfill's `importForElement` API to ensure
     *   the path is relative to the import document's location since
     *   `ownerDocument` is not currently polyfilled
     */
    get assetpath() {
      // Don't override existing assetpath.
      if (!this.__assetpath) {
        // note: assetpath set via an attribute must be relative to this
        // element's location; accomodate polyfilled HTMLImports
        const owner = window.HTMLImports && HTMLImports.importForElement ?
          HTMLImports.importForElement(this) || document : this.ownerDocument;
        const url = Polymer.ResolveUrl.resolveUrl(
          this.getAttribute('assetpath') || '', owner.baseURI);
        this.__assetpath = Polymer.ResolveUrl.pathFromUrl(url);
      }
      return this.__assetpath;
    }

    /**
     * Registers the dom-module at a given id. This method should only be called
     * when a dom-module is imperatively created. For
     * example, `document.createElement('dom-module').register('foo')`.
     * @param {string=} id The id at which to register the dom-module.
     * @return {void}
     */
    register(id) {
      id = id || this.id;
      if (id) {
        // Under strictTemplatePolicy, reject and null out any re-registered
        // dom-module since it is ambiguous whether first-in or last-in is trusted 
        if (Polymer.strictTemplatePolicy && findModule(id) !== undefined) {
          setModule(id, null);
          throw new Error(`strictTemplatePolicy: dom-module ${id} re-registered`);
        }
        this.id = id;
        setModule(id, this);
        styleOutsideTemplateCheck(this);
      }
    }
  }

  DomModule.prototype['modules'] = modules;

  customElements.define('dom-module', DomModule);

  /** @const */
  Polymer.DomModule = DomModule;

})();


(function() {
  'use strict';

  /**
   * Module with utilities for manipulating structured data path strings.
   *
   * @namespace
   * @memberof Polymer
   * @summary Module with utilities for manipulating structured data path strings.
   */
  const Path = {

    /**
     * Returns true if the given string is a structured data path (has dots).
     *
     * Example:
     *
     * ```
     * Polymer.Path.isPath('foo.bar.baz') // true
     * Polymer.Path.isPath('foo')         // false
     * ```
     *
     * @memberof Polymer.Path
     * @param {string} path Path string
     * @return {boolean} True if the string contained one or more dots
     */
    isPath: function(path) {
      return path.indexOf('.') >= 0;
    },

    /**
     * Returns the root property name for the given path.
     *
     * Example:
     *
     * ```
     * Polymer.Path.root('foo.bar.baz') // 'foo'
     * Polymer.Path.root('foo')         // 'foo'
     * ```
     *
     * @memberof Polymer.Path
     * @param {string} path Path string
     * @return {string} Root property name
     */
    root: function(path) {
      let dotIndex = path.indexOf('.');
      if (dotIndex === -1) {
        return path;
      }
      return path.slice(0, dotIndex);
    },

    /**
     * Given `base` is `foo.bar`, `foo` is an ancestor, `foo.bar` is not
     * Returns true if the given path is an ancestor of the base path.
     *
     * Example:
     *
     * ```
     * Polymer.Path.isAncestor('foo.bar', 'foo')         // true
     * Polymer.Path.isAncestor('foo.bar', 'foo.bar')     // false
     * Polymer.Path.isAncestor('foo.bar', 'foo.bar.baz') // false
     * ```
     *
     * @memberof Polymer.Path
     * @param {string} base Path string to test against.
     * @param {string} path Path string to test.
     * @return {boolean} True if `path` is an ancestor of `base`.
     */
    isAncestor: function(base, path) {
      //     base.startsWith(path + '.');
      return base.indexOf(path + '.') === 0;
    },

    /**
     * Given `base` is `foo.bar`, `foo.bar.baz` is an descendant
     *
     * Example:
     *
     * ```
     * Polymer.Path.isDescendant('foo.bar', 'foo.bar.baz') // true
     * Polymer.Path.isDescendant('foo.bar', 'foo.bar')     // false
     * Polymer.Path.isDescendant('foo.bar', 'foo')         // false
     * ```
     *
     * @memberof Polymer.Path
     * @param {string} base Path string to test against.
     * @param {string} path Path string to test.
     * @return {boolean} True if `path` is a descendant of `base`.
     */
    isDescendant: function(base, path) {
      //     path.startsWith(base + '.');
      return path.indexOf(base + '.') === 0;
    },

    /**
     * Replaces a previous base path with a new base path, preserving the
     * remainder of the path.
     *
     * User must ensure `path` has a prefix of `base`.
     *
     * Example:
     *
     * ```
     * Polymer.Path.translate('foo.bar', 'zot', 'foo.bar.baz') // 'zot.baz'
     * ```
     *
     * @memberof Polymer.Path
     * @param {string} base Current base string to remove
     * @param {string} newBase New base string to replace with
     * @param {string} path Path to translate
     * @return {string} Translated string
     */
    translate: function(base, newBase, path) {
      return newBase + path.slice(base.length);
    },

    /**
     * @param {string} base Path string to test against
     * @param {string} path Path string to test
     * @return {boolean} True if `path` is equal to `base`
     * @this {Path}
     */
    matches: function(base, path) {
      return (base === path) ||
             this.isAncestor(base, path) ||
             this.isDescendant(base, path);
    },

    /**
     * Converts array-based paths to flattened path.  String-based paths
     * are returned as-is.
     *
     * Example:
     *
     * ```
     * Polymer.Path.normalize(['foo.bar', 0, 'baz'])  // 'foo.bar.0.baz'
     * Polymer.Path.normalize('foo.bar.0.baz')        // 'foo.bar.0.baz'
     * ```
     *
     * @memberof Polymer.Path
     * @param {string | !Array<string|number>} path Input path
     * @return {string} Flattened path
     */
    normalize: function(path) {
      if (Array.isArray(path)) {
        let parts = [];
        for (let i=0; i<path.length; i++) {
          let args = path[i].toString().split('.');
          for (let j=0; j<args.length; j++) {
            parts.push(args[j]);
          }
        }
        return parts.join('.');
      } else {
        return path;
      }
    },

    /**
     * Splits a path into an array of property names. Accepts either arrays
     * of path parts or strings.
     *
     * Example:
     *
     * ```
     * Polymer.Path.split(['foo.bar', 0, 'baz'])  // ['foo', 'bar', '0', 'baz']
     * Polymer.Path.split('foo.bar.0.baz')        // ['foo', 'bar', '0', 'baz']
     * ```
     *
     * @memberof Polymer.Path
     * @param {string | !Array<string|number>} path Input path
     * @return {!Array<string>} Array of path parts
     * @this {Path}
     * @suppress {checkTypes}
     */
    split: function(path) {
      if (Array.isArray(path)) {
        return this.normalize(path).split('.');
      }
      return path.toString().split('.');
    },

    /**
     * Reads a value from a path.  If any sub-property in the path is `undefined`,
     * this method returns `undefined` (will never throw.
     *
     * @memberof Polymer.Path
     * @param {Object} root Object from which to dereference path from
     * @param {string | !Array<string|number>} path Path to read
     * @param {Object=} info If an object is provided to `info`, the normalized
     *  (flattened) path will be set to `info.path`.
     * @return {*} Value at path, or `undefined` if the path could not be
     *  fully dereferenced.
     * @this {Path}
     */
    get: function(root, path, info) {
      let prop = root;
      let parts = this.split(path);
      // Loop over path parts[0..n-1] and dereference
      for (let i=0; i<parts.length; i++) {
        if (!prop) {
          return;
        }
        let part = parts[i];
        prop = prop[part];
      }
      if (info) {
        info.path = parts.join('.');
      }
      return prop;
    },

    /**
     * Sets a value to a path.  If any sub-property in the path is `undefined`,
     * this method will no-op.
     *
     * @memberof Polymer.Path
     * @param {Object} root Object from which to dereference path from
     * @param {string | !Array<string|number>} path Path to set
     * @param {*} value Value to set to path
     * @return {string | undefined} The normalized version of the input path
     * @this {Path}
     */
    set: function(root, path, value) {
      let prop = root;
      let parts = this.split(path);
      let last = parts[parts.length-1];
      if (parts.length > 1) {
        // Loop over path parts[0..n-2] and dereference
        for (let i=0; i<parts.length-1; i++) {
          let part = parts[i];
          prop = prop[part];
          if (!prop) {
            return;
          }
        }
        // Set value to object at end of path
        prop[last] = value;
      } else {
        // Simple property set
        prop[path] = value;
      }
      return parts.join('.');
    }

  };

  /**
   * Returns true if the given string is a structured data path (has dots).
   *
   * This function is deprecated.  Use `Polymer.Path.isPath` instead.
   *
   * Example:
   *
   * ```
   * Polymer.Path.isDeep('foo.bar.baz') // true
   * Polymer.Path.isDeep('foo')         // false
   * ```
   *
   * @deprecated
   * @memberof Polymer.Path
   * @param {string} path Path string
   * @return {boolean} True if the string contained one or more dots
   */
  Path.isDeep = Path.isPath;

  Polymer.Path = Path;

})();


(function() {
  'use strict';

  const caseMap = {};
  const DASH_TO_CAMEL = /-[a-z]/g;
  const CAMEL_TO_DASH = /([A-Z])/g;

  /**
   * Module with utilities for converting between "dash-case" and "camelCase"
   * identifiers.
   *
   * @namespace
   * @memberof Polymer
   * @summary Module that provides utilities for converting between "dash-case"
   *   and "camelCase".
   */
  const CaseMap = {

    /**
     * Converts "dash-case" identifier (e.g. `foo-bar-baz`) to "camelCase"
     * (e.g. `fooBarBaz`).
     *
     * @memberof Polymer.CaseMap
     * @param {string} dash Dash-case identifier
     * @return {string} Camel-case representation of the identifier
     */
    dashToCamelCase(dash) {
      return caseMap[dash] || (
        caseMap[dash] = dash.indexOf('-') < 0 ? dash : dash.replace(DASH_TO_CAMEL,
          (m) => m[1].toUpperCase()
        )
      );
    },

    /**
     * Converts "camelCase" identifier (e.g. `fooBarBaz`) to "dash-case"
     * (e.g. `foo-bar-baz`).
     *
     * @memberof Polymer.CaseMap
     * @param {string} camel Camel-case identifier
     * @return {string} Dash-case representation of the identifier
     */
    camelToDashCase(camel) {
      return caseMap[camel] || (
        caseMap[camel] = camel.replace(CAMEL_TO_DASH, '-$1').toLowerCase()
      );
    }

  };

  Polymer.CaseMap = CaseMap;
})();


(function() {

  'use strict';

  // Microtask implemented using Mutation Observer
  let microtaskCurrHandle = 0;
  let microtaskLastHandle = 0;
  let microtaskCallbacks = [];
  let microtaskNodeContent = 0;
  let microtaskNode = document.createTextNode('');
  new window.MutationObserver(microtaskFlush).observe(microtaskNode, {characterData: true});

  function microtaskFlush() {
    const len = microtaskCallbacks.length;
    for (let i = 0; i < len; i++) {
      let cb = microtaskCallbacks[i];
      if (cb) {
        try {
          cb();
        } catch (e) {
          setTimeout(() => { throw e; });
        }
      }
    }
    microtaskCallbacks.splice(0, len);
    microtaskLastHandle += len;
  }

  /**
   * Module that provides a number of strategies for enqueuing asynchronous
   * tasks.  Each sub-module provides a standard `run(fn)` interface that returns a
   * handle, and a `cancel(handle)` interface for canceling async tasks before
   * they run.
   *
   * @namespace
   * @memberof Polymer
   * @summary Module that provides a number of strategies for enqueuing asynchronous
   * tasks.
   */
  Polymer.Async = {

    /**
     * Async interface wrapper around `setTimeout`.
     *
     * @namespace
     * @memberof Polymer.Async
     * @summary Async interface wrapper around `setTimeout`.
     */
    timeOut: {
      /**
       * Returns a sub-module with the async interface providing the provided
       * delay.
       *
       * @memberof Polymer.Async.timeOut
       * @param {number=} delay Time to wait before calling callbacks in ms
       * @return {!AsyncInterface} An async timeout interface
       */
      after(delay) {
        return {
          run(fn) { return window.setTimeout(fn, delay); },
          cancel(handle) {
            window.clearTimeout(handle);
          }
        };
      },
      /**
       * Enqueues a function called in the next task.
       *
       * @memberof Polymer.Async.timeOut
       * @param {!Function} fn Callback to run
       * @param {number=} delay Delay in milliseconds
       * @return {number} Handle used for canceling task
       */
      run(fn, delay) {
        return window.setTimeout(fn, delay);
      },
      /**
       * Cancels a previously enqueued `timeOut` callback.
       *
       * @memberof Polymer.Async.timeOut
       * @param {number} handle Handle returned from `run` of callback to cancel
       * @return {void}
       */
      cancel(handle) {
        window.clearTimeout(handle);
      }
    },

    /**
     * Async interface wrapper around `requestAnimationFrame`.
     *
     * @namespace
     * @memberof Polymer.Async
     * @summary Async interface wrapper around `requestAnimationFrame`.
     */
    animationFrame: {
      /**
       * Enqueues a function called at `requestAnimationFrame` timing.
       *
       * @memberof Polymer.Async.animationFrame
       * @param {function(number):void} fn Callback to run
       * @return {number} Handle used for canceling task
       */
      run(fn) {
        return window.requestAnimationFrame(fn);
      },
      /**
       * Cancels a previously enqueued `animationFrame` callback.
       *
       * @memberof Polymer.Async.animationFrame
       * @param {number} handle Handle returned from `run` of callback to cancel
       * @return {void}
       */
      cancel(handle) {
        window.cancelAnimationFrame(handle);
      }
    },

    /**
     * Async interface wrapper around `requestIdleCallback`.  Falls back to
     * `setTimeout` on browsers that do not support `requestIdleCallback`.
     *
     * @namespace
     * @memberof Polymer.Async
     * @summary Async interface wrapper around `requestIdleCallback`.
     */
    idlePeriod: {
      /**
       * Enqueues a function called at `requestIdleCallback` timing.
       *
       * @memberof Polymer.Async.idlePeriod
       * @param {function(!IdleDeadline):void} fn Callback to run
       * @return {number} Handle used for canceling task
       */
      run(fn) {
        return window.requestIdleCallback ?
          window.requestIdleCallback(fn) :
          window.setTimeout(fn, 16);
      },
      /**
       * Cancels a previously enqueued `idlePeriod` callback.
       *
       * @memberof Polymer.Async.idlePeriod
       * @param {number} handle Handle returned from `run` of callback to cancel
       * @return {void}
       */
      cancel(handle) {
        window.cancelIdleCallback ?
          window.cancelIdleCallback(handle) :
          window.clearTimeout(handle);
      }
    },

    /**
     * Async interface for enqueuing callbacks that run at microtask timing.
     *
     * Note that microtask timing is achieved via a single `MutationObserver`,
     * and thus callbacks enqueued with this API will all run in a single
     * batch, and not interleaved with other microtasks such as promises.
     * Promises are avoided as an implementation choice for the time being
     * due to Safari bugs that cause Promises to lack microtask guarantees.
     *
     * @namespace
     * @memberof Polymer.Async
     * @summary Async interface for enqueuing callbacks that run at microtask
     *   timing.
     */
    microTask: {

      /**
       * Enqueues a function called at microtask timing.
       *
       * @memberof Polymer.Async.microTask
       * @param {!Function=} callback Callback to run
       * @return {number} Handle used for canceling task
       */
      run(callback) {
        microtaskNode.textContent = microtaskNodeContent++;
        microtaskCallbacks.push(callback);
        return microtaskCurrHandle++;
      },

      /**
       * Cancels a previously enqueued `microTask` callback.
       *
       * @memberof Polymer.Async.microTask
       * @param {number} handle Handle returned from `run` of callback to cancel
       * @return {void}
       */
      cancel(handle) {
        const idx = handle - microtaskLastHandle;
        if (idx >= 0) {
          if (!microtaskCallbacks[idx]) {
            throw new Error('invalid async handle: ' + handle);
          }
          microtaskCallbacks[idx] = null;
        }
      }

    }
  };

})();


  (function () {

    'use strict';

    /** @const {!AsyncInterface} */
    const microtask = Polymer.Async.microTask;

    /**
     * Element class mixin that provides basic meta-programming for creating one
     * or more property accessors (getter/setter pair) that enqueue an async
     * (batched) `_propertiesChanged` callback.
     *
     * For basic usage of this mixin, call `MyClass.createProperties(props)`
     * once at class definition time to create property accessors for properties
     * named in props, implement `_propertiesChanged` to react as desired to
     * property changes, and implement `static get observedAttributes()` and
     * include lowercase versions of any property names that should be set from
     * attributes. Last, call `this._enableProperties()` in the element's
     * `connectedCallback` to enable the accessors.
     *
     * @mixinFunction
     * @polymer
     * @memberof Polymer
     * @summary Element class mixin for reacting to property changes from
     *   generated property accessors.
     */
    Polymer.PropertiesChanged = Polymer.dedupingMixin(superClass => {

      /**
       * @polymer
       * @mixinClass
       * @extends {superClass}
       * @implements {Polymer_PropertiesChanged}
       * @unrestricted
       */
      class PropertiesChanged extends superClass {

        /**
         * Creates property accessors for the given property names.
         * @param {!Object} props Object whose keys are names of accessors.
         * @return {void}
         * @protected
         */
        static createProperties(props) {
          const proto = this.prototype;
          for (let prop in props) {
            // don't stomp an existing accessor
            if (!(prop in proto)) {
              proto._createPropertyAccessor(prop);
            }
          }
        }

        /**
         * Returns an attribute name that corresponds to the given property.
         * The attribute name is the lowercased property name. Override to
         * customize this mapping.
         * @param {string} property Property to convert
         * @return {string} Attribute name corresponding to the given property.
         *
         * @protected
         */
        static attributeNameForProperty(property) {
          return property.toLowerCase();
        }

        /**
         * Override point to provide a type to which to deserialize a value to
         * a given property.
         * @param {string} name Name of property
         *
         * @protected
         */
        static typeForProperty(name) { } //eslint-disable-line no-unused-vars

        /**
         * Creates a setter/getter pair for the named property with its own
         * local storage.  The getter returns the value in the local storage,
         * and the setter calls `_setProperty`, which updates the local storage
         * for the property and enqueues a `_propertiesChanged` callback.
         *
         * This method may be called on a prototype or an instance.  Calling
         * this method may overwrite a property value that already exists on
         * the prototype/instance by creating the accessor.
         *
         * @param {string} property Name of the property
         * @param {boolean=} readOnly When true, no setter is created; the
         *   protected `_setProperty` function must be used to set the property
         * @return {void}
         * @protected
         */
        _createPropertyAccessor(property, readOnly) {
          this._addPropertyToAttributeMap(property);
          if (!this.hasOwnProperty('__dataHasAccessor')) {
            this.__dataHasAccessor = Object.assign({}, this.__dataHasAccessor);
          }
          if (!this.__dataHasAccessor[property]) {
            this.__dataHasAccessor[property] = true;
            this._definePropertyAccessor(property, readOnly);
          }
        }

        /**
         * Adds the given `property` to a map matching attribute names
         * to property names, using `attributeNameForProperty`. This map is
         * used when deserializing attribute values to properties.
         *
         * @param {string} property Name of the property
         */
        _addPropertyToAttributeMap(property) {
          if (!this.hasOwnProperty('__dataAttributes')) {
            this.__dataAttributes = Object.assign({}, this.__dataAttributes);
          }
          if (!this.__dataAttributes[property]) {
            const attr = this.constructor.attributeNameForProperty(property);
            this.__dataAttributes[attr] = property;
          }
        }

        /**
         * Defines a property accessor for the given property.
         * @param {string} property Name of the property
         * @param {boolean=} readOnly When true, no setter is created
         * @return {void}
         */
         _definePropertyAccessor(property, readOnly) {
          Object.defineProperty(this, property, {
            /* eslint-disable valid-jsdoc */
            /** @this {PropertiesChanged} */
            get() {
              return this._getProperty(property);
            },
            /** @this {PropertiesChanged} */
            set: readOnly ? function () {} : function (value) {
              this._setProperty(property, value);
            }
            /* eslint-enable */
          });
        }

        constructor() {
          super();
          this.__dataEnabled = false;
          this.__dataReady = false;
          this.__dataInvalid = false;
          this.__data = {};
          this.__dataPending = null;
          this.__dataOld = null;
          this.__dataInstanceProps = null;
          this.__serializing = false;
          this._initializeProperties();
        }

        /**
         * Lifecycle callback called when properties are enabled via
         * `_enableProperties`.
         *
         * Users may override this function to implement behavior that is
         * dependent on the element having its property data initialized, e.g.
         * from defaults (initialized from `constructor`, `_initializeProperties`),
         * `attributeChangedCallback`, or values propagated from host e.g. via
         * bindings.  `super.ready()` must be called to ensure the data system
         * becomes enabled.
         *
         * @return {void}
         * @public
         */
        ready() {
          this.__dataReady = true;
          this._flushProperties();
        }

        /**
         * Initializes the local storage for property accessors.
         *
         * Provided as an override point for performing any setup work prior
         * to initializing the property accessor system.
         *
         * @return {void}
         * @protected
         */
        _initializeProperties() {
          // Capture instance properties; these will be set into accessors
          // during first flush. Don't set them here, since we want
          // these to overwrite defaults/constructor assignments
          for (let p in this.__dataHasAccessor) {
            if (this.hasOwnProperty(p)) {
              this.__dataInstanceProps = this.__dataInstanceProps || {};
              this.__dataInstanceProps[p] = this[p];
              delete this[p];
            }
          }
        }

        /**
         * Called at ready time with bag of instance properties that overwrote
         * accessors when the element upgraded.
         *
         * The default implementation sets these properties back into the
         * setter at ready time.  This method is provided as an override
         * point for customizing or providing more efficient initialization.
         *
         * @param {Object} props Bag of property values that were overwritten
         *   when creating property accessors.
         * @return {void}
         * @protected
         */
        _initializeInstanceProperties(props) {
          Object.assign(this, props);
        }

        /**
         * Updates the local storage for a property (via `_setPendingProperty`)
         * and enqueues a `_proeprtiesChanged` callback.
         *
         * @param {string} property Name of the property
         * @param {*} value Value to set
         * @return {void}
         * @protected
         */
        _setProperty(property, value) {
          if (this._setPendingProperty(property, value)) {
            this._invalidateProperties();
          }
        }

        /**
         * Returns the value for the given property.
         * @param {string} property Name of property
         * @return {*} Value for the given property
         * @protected
         */
        _getProperty(property) {
          return this.__data[property];
        }

        /* eslint-disable no-unused-vars */
        /**
         * Updates the local storage for a property, records the previous value,
         * and adds it to the set of "pending changes" that will be passed to the
         * `_propertiesChanged` callback.  This method does not enqueue the
         * `_propertiesChanged` callback.
         *
         * @param {string} property Name of the property
         * @param {*} value Value to set
         * @param {boolean=} ext Not used here; affordance for closure
         * @return {boolean} Returns true if the property changed
         * @protected
         */
        _setPendingProperty(property, value, ext) {
          let old = this.__data[property];
          let changed = this._shouldPropertyChange(property, value, old);
          if (changed) {
            if (!this.__dataPending) {
              this.__dataPending = {};
              this.__dataOld = {};
            }
            // Ensure old is captured from the last turn
            if (this.__dataOld && !(property in this.__dataOld)) {
              this.__dataOld[property] = old;
            }
            this.__data[property] = value;
            this.__dataPending[property] = value;
          }
          return changed;
        }
        /* eslint-enable */

        /**
         * Marks the properties as invalid, and enqueues an async
         * `_propertiesChanged` callback.
         *
         * @return {void}
         * @protected
         */
        _invalidateProperties() {
          if (!this.__dataInvalid && this.__dataReady) {
            this.__dataInvalid = true;
            microtask.run(() => {
              if (this.__dataInvalid) {
                this.__dataInvalid = false;
                this._flushProperties();
              }
            });
          }
        }

        /**
         * Call to enable property accessor processing. Before this method is
         * called accessor values will be set but side effects are
         * queued. When called, any pending side effects occur immediately.
         * For elements, generally `connectedCallback` is a normal spot to do so.
         * It is safe to call this method multiple times as it only turns on
         * property accessors once.
         *
         * @return {void}
         * @protected
         */
        _enableProperties() {
          if (!this.__dataEnabled) {
            this.__dataEnabled = true;
            if (this.__dataInstanceProps) {
              this._initializeInstanceProperties(this.__dataInstanceProps);
              this.__dataInstanceProps = null;
            }
            this.ready();
          }
        }

        /**
         * Calls the `_propertiesChanged` callback with the current set of
         * pending changes (and old values recorded when pending changes were
         * set), and resets the pending set of changes. Generally, this method
         * should not be called in user code.
         *
         * @return {void}
         * @protected
         */
        _flushProperties() {
          const props = this.__data;
          const changedProps = this.__dataPending;
          const old = this.__dataOld;
          if (this._shouldPropertiesChange(props, changedProps, old)) {
            this.__dataPending = null;
            this.__dataOld = null;
            this._propertiesChanged(props, changedProps, old);
          }
        }

        /**
         * Called in `_flushProperties` to determine if `_propertiesChanged`
         * should be called. The default implementation returns true if
         * properties are pending. Override to customize when
         * `_propertiesChanged` is called.
         * @param {!Object} currentProps Bag of all current accessor values
         * @param {!Object} changedProps Bag of properties changed since the last
         *   call to `_propertiesChanged`
         * @param {!Object} oldProps Bag of previous values for each property
         *   in `changedProps`
         * @return {boolean} true if changedProps is truthy
         */
        _shouldPropertiesChange(currentProps, changedProps, oldProps) { // eslint-disable-line no-unused-vars
          return Boolean(changedProps);
        }

        /**
         * Callback called when any properties with accessors created via
         * `_createPropertyAccessor` have been set.
         *
         * @param {!Object} currentProps Bag of all current accessor values
         * @param {!Object} changedProps Bag of properties changed since the last
         *   call to `_propertiesChanged`
         * @param {!Object} oldProps Bag of previous values for each property
         *   in `changedProps`
         * @return {void}
         * @protected
         */
        _propertiesChanged(currentProps, changedProps, oldProps) { // eslint-disable-line no-unused-vars
        }

        /**
         * Method called to determine whether a property value should be
         * considered as a change and cause the `_propertiesChanged` callback
         * to be enqueued.
         *
         * The default implementation returns `true` if a strict equality
         * check fails. The method always returns false for `NaN`.
         *
         * Override this method to e.g. provide stricter checking for
         * Objects/Arrays when using immutable patterns.
         *
         * @param {string} property Property name
         * @param {*} value New property value
         * @param {*} old Previous property value
         * @return {boolean} Whether the property should be considered a change
         *   and enqueue a `_proeprtiesChanged` callback
         * @protected
         */
        _shouldPropertyChange(property, value, old) {
          return (
            // Strict equality check
            (old !== value &&
              // This ensures (old==NaN, value==NaN) always returns false
              (old === old || value === value))
          );
        }

        /**
         * Implements native Custom Elements `attributeChangedCallback` to
         * set an attribute value to a property via `_attributeToProperty`.
         *
         * @param {string} name Name of attribute that changed
         * @param {?string} old Old attribute value
         * @param {?string} value New attribute value
         * @param {?string} namespace Attribute namespace.
         * @return {void}
         * @suppress {missingProperties} Super may or may not implement the callback
         */
        attributeChangedCallback(name, old, value, namespace) {
          if (old !== value) {
            this._attributeToProperty(name, value);
          }
          if (super.attributeChangedCallback) {
            super.attributeChangedCallback(name, old, value, namespace);
          }
        }

        /**
         * Deserializes an attribute to its associated property.
         *
         * This method calls the `_deserializeValue` method to convert the string to
         * a typed value.
         *
         * @param {string} attribute Name of attribute to deserialize.
         * @param {?string} value of the attribute.
         * @param {*=} type type to deserialize to, defaults to the value
         * returned from `typeForProperty`
         * @return {void}
         */
        _attributeToProperty(attribute, value, type) {
          if (!this.__serializing) {
            const map = this.__dataAttributes;
            const property = map && map[attribute] || attribute;
            this[property] = this._deserializeValue(value, type ||
              this.constructor.typeForProperty(property));
          }
        }

        /**
         * Serializes a property to its associated attribute.
         *
         * @suppress {invalidCasts} Closure can't figure out `this` is an element.
         *
         * @param {string} property Property name to reflect.
         * @param {string=} attribute Attribute name to reflect to.
         * @param {*=} value Property value to refect.
         * @return {void}
         */
        _propertyToAttribute(property, attribute, value) {
          this.__serializing = true;
          value = (arguments.length < 3) ? this[property] : value;
          this._valueToNodeAttribute(/** @type {!HTMLElement} */(this), value,
            attribute || this.constructor.attributeNameForProperty(property));
          this.__serializing = false;
        }

        /**
         * Sets a typed value to an HTML attribute on a node.
         *
         * This method calls the `_serializeValue` method to convert the typed
         * value to a string.  If the `_serializeValue` method returns `undefined`,
         * the attribute will be removed (this is the default for boolean
         * type `false`).
         *
         * @param {Element} node Element to set attribute to.
         * @param {*} value Value to serialize.
         * @param {string} attribute Attribute name to serialize to.
         * @return {void}
         */
        _valueToNodeAttribute(node, value, attribute) {
          const str = this._serializeValue(value);
          if (str === undefined) {
            node.removeAttribute(attribute);
          } else {
            node.setAttribute(attribute, str);
          }
        }

        /**
         * Converts a typed JavaScript value to a string.
         *
         * This method is called when setting JS property values to
         * HTML attributes.  Users may override this method to provide
         * serialization for custom types.
         *
         * @param {*} value Property value to serialize.
         * @return {string | undefined} String serialized from the provided
         * property  value.
         */
        _serializeValue(value) {
          switch (typeof value) {
            case 'boolean':
              return value ? '' : undefined;
            default:
              return value != null ? value.toString() : undefined;
          }
        }

        /**
         * Converts a string to a typed JavaScript value.
         *
         * This method is called when reading HTML attribute values to
         * JS properties.  Users may override this method to provide
         * deserialization for custom `type`s. Types for `Boolean`, `String`,
         * and `Number` convert attributes to the expected types.
         *
         * @param {?string} value Value to deserialize.
         * @param {*=} type Type to deserialize the string to.
         * @return {*} Typed value deserialized from the provided string.
         */
        _deserializeValue(value, type) {
          switch (type) {
            case Boolean:
              return (value !== null);
            case Number:
              return Number(value);
            default:
              return value;
          }
        }

      }

      return PropertiesChanged;
    });


  })();



(function() {

  'use strict';

  let caseMap = Polymer.CaseMap;

  // Save map of native properties; this forms a blacklist or properties
  // that won't have their values "saved" by `saveAccessorValue`, since
  // reading from an HTMLElement accessor from the context of a prototype throws
  const nativeProperties = {};
  let proto = HTMLElement.prototype;
  while (proto) {
    let props = Object.getOwnPropertyNames(proto);
    for (let i=0; i<props.length; i++) {
      nativeProperties[props[i]] = true;
    }
    proto = Object.getPrototypeOf(proto);
  }

  /**
   * Used to save the value of a property that will be overridden with
   * an accessor. If the `model` is a prototype, the values will be saved
   * in `__dataProto`, and it's up to the user (or downstream mixin) to
   * decide how/when to set these values back into the accessors.
   * If `model` is already an instance (it has a `__data` property), then
   * the value will be set as a pending property, meaning the user should
   * call `_invalidateProperties` or `_flushProperties` to take effect
   *
   * @param {Object} model Prototype or instance
   * @param {string} property Name of property
   * @return {void}
   * @private
   */
  function saveAccessorValue(model, property) {
    // Don't read/store value for any native properties since they could throw
    if (!nativeProperties[property]) {
      let value = model[property];
      if (value !== undefined) {
        if (model.__data) {
          // Adding accessor to instance; update the property
          // It is the user's responsibility to call _flushProperties
          model._setPendingProperty(property, value);
        } else {
          // Adding accessor to proto; save proto's value for instance-time use
          if (!model.__dataProto) {
            model.__dataProto = {};
          } else if (!model.hasOwnProperty(JSCompiler_renameProperty('__dataProto', model))) {
            model.__dataProto = Object.create(model.__dataProto);
          }
          model.__dataProto[property] = value;
        }
      }
    }
  }

  /**
   * Element class mixin that provides basic meta-programming for creating one
   * or more property accessors (getter/setter pair) that enqueue an async
   * (batched) `_propertiesChanged` callback.
   *
   * For basic usage of this mixin:
   * 
   * -   Declare attributes to observe via the standard `static get observedAttributes()`. Use
   *     `dash-case` attribute names to represent `camelCase` property names. 
   * -   Implement the `_propertiesChanged` callback on the class.
   * -   Call `MyClass.createPropertiesForAttributes()` **once** on the class to generate 
   *     property accessors for each observed attribute. This must be called before the first 
   *     instance is created, for example, by calling it before calling `customElements.define`.
   *     It can also be called lazily from the element's `constructor`, as long as it's guarded so
   *     that the call is only made once, when the first instance is created.
   * -   Call `this._enableProperties()` in the element's `connectedCallback` to enable 
   *     the accessors.
   *
   * Any `observedAttributes` will automatically be
   * deserialized via `attributeChangedCallback` and set to the associated
   * property using `dash-case`-to-`camelCase` convention.
   *
   * @mixinFunction
   * @polymer
   * @appliesMixin Polymer.PropertiesChanged
   * @memberof Polymer
   * @summary Element class mixin for reacting to property changes from
   *   generated property accessors.
   */
  Polymer.PropertyAccessors = Polymer.dedupingMixin(superClass => {

    /**
     * @constructor
     * @extends {superClass}
     * @implements {Polymer_PropertiesChanged}
     * @unrestricted
     * @private
     */
     const base = Polymer.PropertiesChanged(superClass);

    /**
     * @polymer
     * @mixinClass
     * @implements {Polymer_PropertyAccessors}
     * @extends {base}
     * @unrestricted
     */
    class PropertyAccessors extends base {

      /**
       * Generates property accessors for all attributes in the standard
       * static `observedAttributes` array.
       *
       * Attribute names are mapped to property names using the `dash-case` to
       * `camelCase` convention
       *
       * @return {void}
       */
      static createPropertiesForAttributes() {
        let a$ = this.observedAttributes;
        for (let i=0; i < a$.length; i++) {
          this.prototype._createPropertyAccessor(caseMap.dashToCamelCase(a$[i]));
        }
      }

      /**
       * Returns an attribute name that corresponds to the given property.
       * By default, converts camel to dash case, e.g. `fooBar` to `foo-bar`.
       * @param {string} property Property to convert
       * @return {string} Attribute name corresponding to the given property.
       *
       * @protected
       */
      static attributeNameForProperty(property) {
        return caseMap.camelToDashCase(property);
      }

      /**
       * Overrides PropertiesChanged implementation to initialize values for
       * accessors created for values that already existed on the element
       * prototype.
       *
       * @return {void}
       * @protected
       */
      _initializeProperties() {
        if (this.__dataProto) {
          this._initializeProtoProperties(this.__dataProto);
          this.__dataProto = null;
        }
        super._initializeProperties();
      }

      /**
       * Called at instance time with bag of properties that were overwritten
       * by accessors on the prototype when accessors were created.
       *
       * The default implementation sets these properties back into the
       * setter at instance time.  This method is provided as an override
       * point for customizing or providing more efficient initialization.
       *
       * @param {Object} props Bag of property values that were overwritten
       *   when creating property accessors.
       * @return {void}
       * @protected
       */
      _initializeProtoProperties(props) {
        for (let p in props) {
          this._setProperty(p, props[p]);
        }
      }

      /**
       * Ensures the element has the given attribute. If it does not,
       * assigns the given value to the attribute.
       *
       * @suppress {invalidCasts} Closure can't figure out `this` is infact an element
       *
       * @param {string} attribute Name of attribute to ensure is set.
       * @param {string} value of the attribute.
       * @return {void}
       */
      _ensureAttribute(attribute, value) {
        const el = /** @type {!HTMLElement} */(this);
        if (!el.hasAttribute(attribute)) {
          this._valueToNodeAttribute(el, value, attribute);
        }
      }

      /**
       * Overrides PropertiesChanged implemention to serialize objects as JSON.
       *
       * @param {*} value Property value to serialize.
       * @return {string | undefined} String serialized from the provided property value.
       */
      _serializeValue(value) {
        /* eslint-disable no-fallthrough */
        switch (typeof value) {
          case 'object':
            if (value instanceof Date) {
              return value.toString();
            } else if (value) {
              try {
                return JSON.stringify(value);
              } catch(x) {
                return '';
              }
            }

          default:
            return super._serializeValue(value);
        }
      }

      /**
       * Converts a string to a typed JavaScript value.
       *
       * This method is called by Polymer when reading HTML attribute values to
       * JS properties.  Users may override this method on Polymer element
       * prototypes to provide deserialization for custom `type`s.  Note,
       * the `type` argument is the value of the `type` field provided in the
       * `properties` configuration object for a given property, and is
       * by convention the constructor for the type to deserialize.
       *
       *
       * @param {?string} value Attribute value to deserialize.
       * @param {*=} type Type to deserialize the string to.
       * @return {*} Typed value deserialized from the provided string.
       */
      _deserializeValue(value, type) {
        /**
         * @type {*}
         */
        let outValue;
        switch (type) {
          case Object:
            try {
              outValue = JSON.parse(/** @type {string} */(value));
            } catch(x) {
              // allow non-JSON literals like Strings and Numbers
              outValue = value;
            }
            break;
          case Array:
            try {
              outValue = JSON.parse(/** @type {string} */(value));
            } catch(x) {
              outValue = null;
              console.warn(`Polymer::Attributes: couldn't decode Array as JSON: ${value}`);
            }
            break;
          case Date:
            outValue = isNaN(value) ? String(value) : Number(value);
            outValue = new Date(outValue);
            break;
          default:
            outValue = super._deserializeValue(value, type);
            break;
        }
        return outValue;
      }
      /* eslint-enable no-fallthrough */

      /**
       * Overrides PropertiesChanged implementation to save existing prototype
       * property value so that it can be reset.
       * @param {string} property Name of the property
       * @param {boolean=} readOnly When true, no setter is created
       *
       * When calling on a prototype, any overwritten values are saved in
       * `__dataProto`, and it is up to the subclasser to decide how/when
       * to set those properties back into the accessor.  When calling on an
       * instance, the overwritten value is set via `_setPendingProperty`,
       * and the user should call `_invalidateProperties` or `_flushProperties`
       * for the values to take effect.
       * @protected
       * @return {void}
       */
      _definePropertyAccessor(property, readOnly) {
        saveAccessorValue(this, property);
        super._definePropertyAccessor(property, readOnly);
      }

      /**
       * Returns true if this library created an accessor for the given property.
       *
       * @param {string} property Property name
       * @return {boolean} True if an accessor was created
       */
      _hasAccessor(property) {
        return this.__dataHasAccessor && this.__dataHasAccessor[property];
      }

      /**
       * Returns true if the specified property has a pending change.
       *
       * @param {string} prop Property name
       * @return {boolean} True if property has a pending change
       * @protected
       */
      _isPropertyPending(prop) {
        return Boolean(this.__dataPending && (prop in this.__dataPending));
      }

    }

    return PropertyAccessors;

  });

})();


(function() {

  'use strict';

  const walker = document.createTreeWalker(document, NodeFilter.SHOW_ALL,
      null, false);

  // 1.x backwards-compatible auto-wrapper for template type extensions
  // This is a clear layering violation and gives favored-nation status to
  // dom-if and dom-repeat templates.  This is a conceit we're choosing to keep
  // a.) to ease 1.x backwards-compatibility due to loss of `is`, and
  // b.) to maintain if/repeat capability in parser-constrained elements
  //     (e.g. table, select) in lieu of native CE type extensions without
  //     massive new invention in this space (e.g. directive system)
  const templateExtensions = {
    'dom-if': true,
    'dom-repeat': true
  };
  function wrapTemplateExtension(node) {
    let is = node.getAttribute('is');
    if (is && templateExtensions[is]) {
      let t = node;
      t.removeAttribute('is');
      node = t.ownerDocument.createElement(is);
      t.parentNode.replaceChild(node, t);
      node.appendChild(t);
      while(t.attributes.length) {
        node.setAttribute(t.attributes[0].name, t.attributes[0].value);
        t.removeAttribute(t.attributes[0].name);
      }
    }
    return node;
  }

  function findTemplateNode(root, nodeInfo) {
    // recursively ascend tree until we hit root
    let parent = nodeInfo.parentInfo && findTemplateNode(root, nodeInfo.parentInfo);
    // unwind the stack, returning the indexed node at each level
    if (parent) {
      // note: marginally faster than indexing via childNodes
      // (http://jsperf.com/childnodes-lookup)
      walker.currentNode = parent;
      for (let n=walker.firstChild(), i=0; n; n=walker.nextSibling()) {
        if (nodeInfo.parentIndex === i++) {
          return n;
        }
      }
    } else {
      return root;
    }
  }

  // construct `$` map (from id annotations)
  function applyIdToMap(inst, map, node, nodeInfo) {
    if (nodeInfo.id) {
      map[nodeInfo.id] = node;
    }
  }

  // install event listeners (from event annotations)
  function applyEventListener(inst, node, nodeInfo) {
    if (nodeInfo.events && nodeInfo.events.length) {
      for (let j=0, e$=nodeInfo.events, e; (j<e$.length) && (e=e$[j]); j++) {
        inst._addMethodEventListenerToNode(node, e.name, e.value, inst);
      }
    }
  }

  // push configuration references at configure time
  function applyTemplateContent(inst, node, nodeInfo) {
    if (nodeInfo.templateInfo) {
      node._templateInfo = nodeInfo.templateInfo;
    }
  }

  function createNodeEventHandler(context, eventName, methodName) {
    // Instances can optionally have a _methodHost which allows redirecting where
    // to find methods. Currently used by `templatize`.
    context = context._methodHost || context;
    let handler = function(e) {
      if (context[methodName]) {
        context[methodName](e, e.detail);
      } else {
        console.warn('listener method `' + methodName + '` not defined');
      }
    };
    return handler;
  }

  /**
   * Element mixin that provides basic template parsing and stamping, including
   * the following template-related features for stamped templates:
   *
   * - Declarative event listeners (`on-eventname="listener"`)
   * - Map of node id's to stamped node instances (`this.$.id`)
   * - Nested template content caching/removal and re-installation (performance
   *   optimization)
   *
   * @mixinFunction
   * @polymer
   * @memberof Polymer
   * @summary Element class mixin that provides basic template parsing and stamping
   */
  Polymer.TemplateStamp = Polymer.dedupingMixin(superClass => {

    /**
     * @polymer
     * @mixinClass
     * @implements {Polymer_TemplateStamp}
     */
    class TemplateStamp extends superClass {

      /**
       * Scans a template to produce template metadata.
       *
       * Template-specific metadata are stored in the object returned, and node-
       * specific metadata are stored in objects in its flattened `nodeInfoList`
       * array.  Only nodes in the template that were parsed as nodes of
       * interest contain an object in `nodeInfoList`.  Each `nodeInfo` object
       * contains an `index` (`childNodes` index in parent) and optionally
       * `parent`, which points to node info of its parent (including its index).
       *
       * The template metadata object returned from this method has the following
       * structure (many fields optional):
       *
       * ```js
       *   {
       *     // Flattened list of node metadata (for nodes that generated metadata)
       *     nodeInfoList: [
       *       {
       *         // `id` attribute for any nodes with id's for generating `$` map
       *         id: {string},
       *         // `on-event="handler"` metadata
       *         events: [
       *           {
       *             name: {string},   // event name
       *             value: {string},  // handler method name
       *           }, ...
       *         ],
       *         // Notes when the template contained a `<slot>` for shady DOM
       *         // optimization purposes
       *         hasInsertionPoint: {boolean},
       *         // For nested `<template>`` nodes, nested template metadata
       *         templateInfo: {object}, // nested template metadata
       *         // Metadata to allow efficient retrieval of instanced node
       *         // corresponding to this metadata
       *         parentInfo: {number},   // reference to parent nodeInfo>
       *         parentIndex: {number},  // index in parent's `childNodes` collection
       *         infoIndex: {number},    // index of this `nodeInfo` in `templateInfo.nodeInfoList`
       *       },
       *       ...
       *     ],
       *     // When true, the template had the `strip-whitespace` attribute
       *     // or was nested in a template with that setting
       *     stripWhitespace: {boolean},
       *     // For nested templates, nested template content is moved into
       *     // a document fragment stored here; this is an optimization to
       *     // avoid the cost of nested template cloning
       *     content: {DocumentFragment}
       *   }
       * ```
       *
       * This method kicks off a recursive treewalk as follows:
       *
       * ```
       *    _parseTemplate <---------------------+
       *      _parseTemplateContent              |
       *        _parseTemplateNode  <------------|--+
       *          _parseTemplateNestedTemplate --+  |
       *          _parseTemplateChildNodes ---------+
       *          _parseTemplateNodeAttributes
       *            _parseTemplateNodeAttribute
       *
       * ```
       *
       * These methods may be overridden to add custom metadata about templates
       * to either `templateInfo` or `nodeInfo`.
       *
       * Note that this method may be destructive to the template, in that
       * e.g. event annotations may be removed after being noted in the
       * template metadata.
       *
       * @param {!HTMLTemplateElement} template Template to parse
       * @param {TemplateInfo=} outerTemplateInfo Template metadata from the outer
       *   template, for parsing nested templates
       * @return {!TemplateInfo} Parsed template metadata
       */
      static _parseTemplate(template, outerTemplateInfo) {
        // since a template may be re-used, memo-ize metadata
        if (!template._templateInfo) {
          let templateInfo = template._templateInfo = {};
          templateInfo.nodeInfoList = [];
          templateInfo.stripWhiteSpace = Polymer.legacyOptimizations ||
            (outerTemplateInfo && outerTemplateInfo.stripWhiteSpace) ||
            template.hasAttribute('strip-whitespace');
          this._parseTemplateContent(template, templateInfo, {parent: null});
        }
        return template._templateInfo;
      }

      static _parseTemplateContent(template, templateInfo, nodeInfo) {
        return this._parseTemplateNode(template.content, templateInfo, nodeInfo);
      }

      /**
       * Parses template node and adds template and node metadata based on
       * the current node, and its `childNodes` and `attributes`.
       *
       * This method may be overridden to add custom node or template specific
       * metadata based on this node.
       *
       * @param {Node} node Node to parse
       * @param {!TemplateInfo} templateInfo Template metadata for current template
       * @param {!NodeInfo} nodeInfo Node metadata for current template.
       * @return {boolean} `true` if the visited node added node-specific
       *   metadata to `nodeInfo`
       */
      static _parseTemplateNode(node, templateInfo, nodeInfo) {
        let noted;
        let element = /** @type {Element} */(node);
        if (element.localName == 'template' && !element.hasAttribute('preserve-content')) {
          noted = this._parseTemplateNestedTemplate(element, templateInfo, nodeInfo) || noted;
        } else if (element.localName === 'slot') {
          // For ShadyDom optimization, indicating there is an insertion point
          templateInfo.hasInsertionPoint = true;
        }
        walker.currentNode = element;
        if (walker.firstChild()) {
          noted = this._parseTemplateChildNodes(element, templateInfo, nodeInfo) || noted;
        }
        if (element.hasAttributes && element.hasAttributes()) {
          noted = this._parseTemplateNodeAttributes(element, templateInfo, nodeInfo) || noted;
        }
        return noted;
      }

      /**
       * Parses template child nodes for the given root node.
       *
       * This method also wraps whitelisted legacy template extensions
       * (`is="dom-if"` and `is="dom-repeat"`) with their equivalent element
       * wrappers, collapses text nodes, and strips whitespace from the template
       * if the `templateInfo.stripWhitespace` setting was provided.
       *
       * @param {Node} root Root node whose `childNodes` will be parsed
       * @param {!TemplateInfo} templateInfo Template metadata for current template
       * @param {!NodeInfo} nodeInfo Node metadata for current template.
       * @return {void}
       */
      static _parseTemplateChildNodes(root, templateInfo, nodeInfo) {
        if (root.localName === 'script' || root.localName === 'style') {
          return;
        }
        walker.currentNode = root;
        for (let node=walker.firstChild(), parentIndex=0, next; node; node=next) {
          // Wrap templates
          if (node.localName == 'template') {
            node = wrapTemplateExtension(node);
          }
          // collapse adjacent textNodes: fixes an IE issue that can cause
          // text nodes to be inexplicably split =(
          // note that root.normalize() should work but does not so we do this
          // manually.
          walker.currentNode = node;
          next = walker.nextSibling();
          if (node.nodeType === Node.TEXT_NODE) {
            let /** Node */ n = next;
            while (n && (n.nodeType === Node.TEXT_NODE)) {
              node.textContent += n.textContent;
              next = walker.nextSibling();
              root.removeChild(n);
              n = next;
            }
            // optionally strip whitespace
            if (templateInfo.stripWhiteSpace && !node.textContent.trim()) {
              root.removeChild(node);
              continue;
            }
          }
          let childInfo = { parentIndex, parentInfo: nodeInfo };
          if (this._parseTemplateNode(node, templateInfo, childInfo)) {
            childInfo.infoIndex = templateInfo.nodeInfoList.push(/** @type {!NodeInfo} */(childInfo)) - 1;
          }
          // Increment if not removed
          walker.currentNode = node;
          if (walker.parentNode()) {
            parentIndex++;
          }
        }
      }

      /**
       * Parses template content for the given nested `<template>`.
       *
       * Nested template info is stored as `templateInfo` in the current node's
       * `nodeInfo`. `template.content` is removed and stored in `templateInfo`.
       * It will then be the responsibility of the host to set it back to the
       * template and for users stamping nested templates to use the
       * `_contentForTemplate` method to retrieve the content for this template
       * (an optimization to avoid the cost of cloning nested template content).
       *
       * @param {HTMLTemplateElement} node Node to parse (a <template>)
       * @param {TemplateInfo} outerTemplateInfo Template metadata for current template
       *   that includes the template `node`
       * @param {!NodeInfo} nodeInfo Node metadata for current template.
       * @return {boolean} `true` if the visited node added node-specific
       *   metadata to `nodeInfo`
       */
      static _parseTemplateNestedTemplate(node, outerTemplateInfo, nodeInfo) {
        let templateInfo = this._parseTemplate(node, outerTemplateInfo);
        let content = templateInfo.content =
          node.content.ownerDocument.createDocumentFragment();
        content.appendChild(node.content);
        nodeInfo.templateInfo = templateInfo;
        return true;
      }

      /**
       * Parses template node attributes and adds node metadata to `nodeInfo`
       * for nodes of interest.
       *
       * @param {Element} node Node to parse
       * @param {TemplateInfo} templateInfo Template metadata for current template
       * @param {NodeInfo} nodeInfo Node metadata for current template.
       * @return {boolean} `true` if the visited node added node-specific
       *   metadata to `nodeInfo`
       */
      static _parseTemplateNodeAttributes(node, templateInfo, nodeInfo) {
        // Make copy of original attribute list, since the order may change
        // as attributes are added and removed
        let noted = false;
        let attrs = Array.from(node.attributes);
        for (let i=attrs.length-1, a; (a=attrs[i]); i--) {
          noted = this._parseTemplateNodeAttribute(node, templateInfo, nodeInfo, a.name, a.value) || noted;
        }
        return noted;
      }

      /**
       * Parses a single template node attribute and adds node metadata to
       * `nodeInfo` for attributes of interest.
       *
       * This implementation adds metadata for `on-event="handler"` attributes
       * and `id` attributes.
       *
       * @param {Element} node Node to parse
       * @param {!TemplateInfo} templateInfo Template metadata for current template
       * @param {!NodeInfo} nodeInfo Node metadata for current template.
       * @param {string} name Attribute name
       * @param {string} value Attribute value
       * @return {boolean} `true` if the visited node added node-specific
       *   metadata to `nodeInfo`
       */
      static _parseTemplateNodeAttribute(node, templateInfo, nodeInfo, name, value) {
        // events (on-*)
        if (name.slice(0, 3) === 'on-') {
          node.removeAttribute(name);
          nodeInfo.events = nodeInfo.events || [];
          nodeInfo.events.push({
            name: name.slice(3),
            value
          });
          return true;
        }
        // static id
        else if (name === 'id') {
          nodeInfo.id = value;
          return true;
        }
        return false;
      }

      /**
       * Returns the `content` document fragment for a given template.
       *
       * For nested templates, Polymer performs an optimization to cache nested
       * template content to avoid the cost of cloning deeply nested templates.
       * This method retrieves the cached content for a given template.
       *
       * @param {HTMLTemplateElement} template Template to retrieve `content` for
       * @return {DocumentFragment} Content fragment
       */
      static _contentForTemplate(template) {
        let templateInfo = /** @type {HTMLTemplateElementWithInfo} */ (template)._templateInfo;
        return (templateInfo && templateInfo.content) || template.content;
      }

      /**
       * Clones the provided template content and returns a document fragment
       * containing the cloned dom.
       *
       * The template is parsed (once and memoized) using this library's
       * template parsing features, and provides the following value-added
       * features:
       * * Adds declarative event listeners for `on-event="handler"` attributes
       * * Generates an "id map" for all nodes with id's under `$` on returned
       *   document fragment
       * * Passes template info including `content` back to templates as
       *   `_templateInfo` (a performance optimization to avoid deep template
       *   cloning)
       *
       * Note that the memoized template parsing process is destructive to the
       * template: attributes for bindings and declarative event listeners are
       * removed after being noted in notes, and any nested `<template>.content`
       * is removed and stored in notes as well.
       *
       * @param {!HTMLTemplateElement} template Template to stamp
       * @return {!StampedTemplate} Cloned template content
       */
      _stampTemplate(template) {
        // Polyfill support: bootstrap the template if it has not already been
        if (template && !template.content &&
            window.HTMLTemplateElement && HTMLTemplateElement.decorate) {
          HTMLTemplateElement.decorate(template);
        }
        let templateInfo = this.constructor._parseTemplate(template);
        let nodeInfo = templateInfo.nodeInfoList;
        let content = templateInfo.content || template.content;
        let dom = /** @type {DocumentFragment} */ (document.importNode(content, true));
        // NOTE: ShadyDom optimization indicating there is an insertion point
        dom.__noInsertionPoint = !templateInfo.hasInsertionPoint;
        let nodes = dom.nodeList = new Array(nodeInfo.length);
        dom.$ = {};
        for (let i=0, l=nodeInfo.length, info; (i<l) && (info=nodeInfo[i]); i++) {
          let node = nodes[i] = findTemplateNode(dom, info);
          applyIdToMap(this, dom.$, node, info);
          applyTemplateContent(this, node, info);
          applyEventListener(this, node, info);
        }
        dom = /** @type {!StampedTemplate} */(dom); // eslint-disable-line no-self-assign
        return dom;
      }

      /**
       * Adds an event listener by method name for the event provided.
       *
       * This method generates a handler function that looks up the method
       * name at handling time.
       *
       * @param {!Node} node Node to add listener on
       * @param {string} eventName Name of event
       * @param {string} methodName Name of method
       * @param {*=} context Context the method will be called on (defaults
       *   to `node`)
       * @return {Function} Generated handler function
       */
      _addMethodEventListenerToNode(node, eventName, methodName, context) {
        context = context || node;
        let handler = createNodeEventHandler(context, eventName, methodName);
        this._addEventListenerToNode(node, eventName, handler);
        return handler;
      }

      /**
       * Override point for adding custom or simulated event handling.
       *
       * @param {!Node} node Node to add event listener to
       * @param {string} eventName Name of event
       * @param {function(!Event):void} handler Listener function to add
       * @return {void}
       */
      _addEventListenerToNode(node, eventName, handler) {
        node.addEventListener(eventName, handler);
      }

      /**
       * Override point for adding custom or simulated event handling.
       *
       * @param {!Node} node Node to remove event listener from
       * @param {string} eventName Name of event
       * @param {function(!Event):void} handler Listener function to remove
       * @return {void}
       */
      _removeEventListenerFromNode(node, eventName, handler) {
        node.removeEventListener(eventName, handler);
      }

    }

    return TemplateStamp;

  });

})();


(function() {

  'use strict';

  /** @const {Object} */
  const CaseMap = Polymer.CaseMap;

  // Monotonically increasing unique ID used for de-duping effects triggered
  // from multiple properties in the same turn
  let dedupeId = 0;

  /**
   * Property effect types; effects are stored on the prototype using these keys
   * @enum {string}
   */
  const TYPES = {
    COMPUTE: '__computeEffects',
    REFLECT: '__reflectEffects',
    NOTIFY: '__notifyEffects',
    PROPAGATE: '__propagateEffects',
    OBSERVE: '__observeEffects',
    READ_ONLY: '__readOnly'
  };

  /** @const {RegExp} */
  const capitalAttributeRegex = /[A-Z]/;

  /**
   * @typedef {{
   * name: (string | undefined),
   * structured: (boolean | undefined),
   * wildcard: (boolean | undefined)
   * }}
   */
  let DataTrigger; //eslint-disable-line no-unused-vars

  /**
   * @typedef {{
   * info: ?,
   * trigger: (!DataTrigger | undefined),
   * fn: (!Function | undefined)
   * }}
   */
  let DataEffect; //eslint-disable-line no-unused-vars

  let PropertyEffectsType; //eslint-disable-line no-unused-vars

  /**
   * Ensures that the model has an own-property map of effects for the given type.
   * The model may be a prototype or an instance.
   *
   * Property effects are stored as arrays of effects by property in a map,
   * by named type on the model. e.g.
   *
   *   __computeEffects: {
   *     foo: [ ... ],
   *     bar: [ ... ]
   *   }
   *
   * If the model does not yet have an effect map for the type, one is created
   * and returned.  If it does, but it is not an own property (i.e. the
   * prototype had effects), the the map is deeply cloned and the copy is
   * set on the model and returned, ready for new effects to be added.
   *
   * @param {Object} model Prototype or instance
   * @param {string} type Property effect type
   * @return {Object} The own-property map of effects for the given type
   * @private
   */
  function ensureOwnEffectMap(model, type) {
    let effects = model[type];
    if (!effects) {
      effects = model[type] = {};
    } else if (!model.hasOwnProperty(type)) {
      effects = model[type] = Object.create(model[type]);
      for (let p in effects) {
        let protoFx = effects[p];
        let instFx = effects[p] = Array(protoFx.length);
        for (let i=0; i<protoFx.length; i++) {
          instFx[i] = protoFx[i];
        }
      }
    }
    return effects;
  }

  // -- effects ----------------------------------------------

  /**
   * Runs all effects of a given type for the given set of property changes
   * on an instance.
   *
   * @param {!PropertyEffectsType} inst The instance with effects to run
   * @param {Object} effects Object map of property-to-Array of effects
   * @param {Object} props Bag of current property changes
   * @param {Object=} oldProps Bag of previous values for changed properties
   * @param {boolean=} hasPaths True with `props` contains one or more paths
   * @param {*=} extraArgs Additional metadata to pass to effect function
   * @return {boolean} True if an effect ran for this property
   * @private
   */
  function runEffects(inst, effects, props, oldProps, hasPaths, extraArgs) {
    if (effects) {
      let ran = false;
      let id = dedupeId++;
      for (let prop in props) {
        if (runEffectsForProperty(inst, effects, id, prop, props, oldProps, hasPaths, extraArgs)) {
          ran = true;
        }
      }
      return ran;
    }
    return false;
  }

  /**
   * Runs a list of effects for a given property.
   *
   * @param {!PropertyEffectsType} inst The instance with effects to run
   * @param {Object} effects Object map of property-to-Array of effects
   * @param {number} dedupeId Counter used for de-duping effects
   * @param {string} prop Name of changed property
   * @param {*} props Changed properties
   * @param {*} oldProps Old properties
   * @param {boolean=} hasPaths True with `props` contains one or more paths
   * @param {*=} extraArgs Additional metadata to pass to effect function
   * @return {boolean} True if an effect ran for this property
   * @private
   */
  function runEffectsForProperty(inst, effects, dedupeId, prop, props, oldProps, hasPaths, extraArgs) {
    let ran = false;
    let rootProperty = hasPaths ? Polymer.Path.root(prop) : prop;
    let fxs = effects[rootProperty];
    if (fxs) {
      for (let i=0, l=fxs.length, fx; (i<l) && (fx=fxs[i]); i++) {
        if ((!fx.info || fx.info.lastRun !== dedupeId) &&
            (!hasPaths || pathMatchesTrigger(prop, fx.trigger))) {
          if (fx.info) {
            fx.info.lastRun = dedupeId;
          }
          fx.fn(inst, prop, props, oldProps, fx.info, hasPaths, extraArgs);
          ran = true;
        }
      }
    }
    return ran;
  }

  /**
   * Determines whether a property/path that has changed matches the trigger
   * criteria for an effect.  A trigger is a descriptor with the following
   * structure, which matches the descriptors returned from `parseArg`.
   * e.g. for `foo.bar.*`:
   * ```
   * trigger: {
   *   name: 'a.b',
   *   structured: true,
   *   wildcard: true
   * }
   * ```
   * If no trigger is given, the path is deemed to match.
   *
   * @param {string} path Path or property that changed
   * @param {DataTrigger} trigger Descriptor
   * @return {boolean} Whether the path matched the trigger
   */
  function pathMatchesTrigger(path, trigger) {
    if (trigger) {
      let triggerPath = trigger.name;
      return (triggerPath == path) ||
        (trigger.structured && Polymer.Path.isAncestor(triggerPath, path)) ||
        (trigger.wildcard && Polymer.Path.isDescendant(triggerPath, path));
    } else {
      return true;
    }
  }

  /**
   * Implements the "observer" effect.
   *
   * Calls the method with `info.methodName` on the instance, passing the
   * new and old values.
   *
   * @param {!PropertyEffectsType} inst The instance the effect will be run on
   * @param {string} property Name of property
   * @param {Object} props Bag of current property changes
   * @param {Object} oldProps Bag of previous values for changed properties
   * @param {?} info Effect metadata
   * @return {void}
   * @private
   */
  function runObserverEffect(inst, property, props, oldProps, info) {
    let fn = typeof info.method === "string" ? inst[info.method] : info.method;
    let changedProp = info.property;
    if (fn) {
      fn.call(inst, inst.__data[changedProp], oldProps[changedProp]);
    } else if (!info.dynamicFn) {
      console.warn('observer method `' + info.method + '` not defined');
    }
  }

  /**
   * Runs "notify" effects for a set of changed properties.
   *
   * This method differs from the generic `runEffects` method in that it
   * will dispatch path notification events in the case that the property
   * changed was a path and the root property for that path didn't have a
   * "notify" effect.  This is to maintain 1.0 behavior that did not require
   * `notify: true` to ensure object sub-property notifications were
   * sent.
   *
   * @param {!PropertyEffectsType} inst The instance with effects to run
   * @param {Object} notifyProps Bag of properties to notify
   * @param {Object} props Bag of current property changes
   * @param {Object} oldProps Bag of previous values for changed properties
   * @param {boolean} hasPaths True with `props` contains one or more paths
   * @return {void}
   * @private
   */
  function runNotifyEffects(inst, notifyProps, props, oldProps, hasPaths) {
    // Notify
    let fxs = inst[TYPES.NOTIFY];
    let notified;
    let id = dedupeId++;
    // Try normal notify effects; if none, fall back to try path notification
    for (let prop in notifyProps) {
      if (notifyProps[prop]) {
        if (fxs && runEffectsForProperty(inst, fxs, id, prop, props, oldProps, hasPaths)) {
          notified = true;
        } else if (hasPaths && notifyPath(inst, prop, props)) {
          notified = true;
        }
      }
    }
    // Flush host if we actually notified and host was batching
    // And the host has already initialized clients; this prevents
    // an issue with a host observing data changes before clients are ready.
    let host;
    if (notified && (host = inst.__dataHost) && host._invalidateProperties) {
      host._invalidateProperties();
    }
  }

  /**
   * Dispatches {property}-changed events with path information in the detail
   * object to indicate a sub-path of the property was changed.
   *
   * @param {!PropertyEffectsType} inst The element from which to fire the event
   * @param {string} path The path that was changed
   * @param {Object} props Bag of current property changes
   * @return {boolean} Returns true if the path was notified
   * @private
   */
  function notifyPath(inst, path, props) {
    let rootProperty = Polymer.Path.root(path);
    if (rootProperty !== path) {
      let eventName = Polymer.CaseMap.camelToDashCase(rootProperty) + '-changed';
      dispatchNotifyEvent(inst, eventName, props[path], path);
      return true;
    }
    return false;
  }

  /**
   * Dispatches {property}-changed events to indicate a property (or path)
   * changed.
   *
   * @param {!PropertyEffectsType} inst The element from which to fire the event
   * @param {string} eventName The name of the event to send ('{property}-changed')
   * @param {*} value The value of the changed property
   * @param {string | null | undefined} path If a sub-path of this property changed, the path
   *   that changed (optional).
   * @return {void}
   * @private
   * @suppress {invalidCasts}
   */
  function dispatchNotifyEvent(inst, eventName, value, path) {
    let detail = {
      value: value,
      queueProperty: true
    };
    if (path) {
      detail.path = path;
    }
    /** @type {!HTMLElement} */(inst).dispatchEvent(new CustomEvent(eventName, { detail }));
  }

  /**
   * Implements the "notify" effect.
   *
   * Dispatches a non-bubbling event named `info.eventName` on the instance
   * with a detail object containing the new `value`.
   *
   * @param {!PropertyEffectsType} inst The instance the effect will be run on
   * @param {string} property Name of property
   * @param {Object} props Bag of current property changes
   * @param {Object} oldProps Bag of previous values for changed properties
   * @param {?} info Effect metadata
   * @param {boolean} hasPaths True with `props` contains one or more paths
   * @return {void}
   * @private
   */
  function runNotifyEffect(inst, property, props, oldProps, info, hasPaths) {
    let rootProperty = hasPaths ? Polymer.Path.root(property) : property;
    let path = rootProperty != property ? property : null;
    let value = path ? Polymer.Path.get(inst, path) : inst.__data[property];
    if (path && value === undefined) {
      value = props[property];  // specifically for .splices
    }
    dispatchNotifyEvent(inst, info.eventName, value, path);
  }

  /**
   * Handler function for 2-way notification events. Receives context
   * information captured in the `addNotifyListener` closure from the
   * `__notifyListeners` metadata.
   *
   * Sets the value of the notified property to the host property or path.  If
   * the event contained path information, translate that path to the host
   * scope's name for that path first.
   *
   * @param {CustomEvent} event Notification event (e.g. '<property>-changed')
   * @param {!PropertyEffectsType} inst Host element instance handling the notification event
   * @param {string} fromProp Child element property that was bound
   * @param {string} toPath Host property/path that was bound
   * @param {boolean} negate Whether the binding was negated
   * @return {void}
   * @private
   */
  function handleNotification(event, inst, fromProp, toPath, negate) {
    let value;
    let detail = /** @type {Object} */(event.detail);
    let fromPath = detail && detail.path;
    if (fromPath) {
      toPath = Polymer.Path.translate(fromProp, toPath, fromPath);
      value = detail && detail.value;
    } else {
      value = event.currentTarget[fromProp];
    }
    value = negate ? !value : value;
    if (!inst[TYPES.READ_ONLY] || !inst[TYPES.READ_ONLY][toPath]) {
      if (inst._setPendingPropertyOrPath(toPath, value, true, Boolean(fromPath))
        && (!detail || !detail.queueProperty)) {
        inst._invalidateProperties();
      }
    }
  }

  /**
   * Implements the "reflect" effect.
   *
   * Sets the attribute named `info.attrName` to the given property value.
   *
   * @param {!PropertyEffectsType} inst The instance the effect will be run on
   * @param {string} property Name of property
   * @param {Object} props Bag of current property changes
   * @param {Object} oldProps Bag of previous values for changed properties
   * @param {?} info Effect metadata
   * @return {void}
   * @private
   */
  function runReflectEffect(inst, property, props, oldProps, info) {
    let value = inst.__data[property];
    if (Polymer.sanitizeDOMValue) {
      value = Polymer.sanitizeDOMValue(value, info.attrName, 'attribute', /** @type {Node} */(inst));
    }
    inst._propertyToAttribute(property, info.attrName, value);
  }

  /**
   * Runs "computed" effects for a set of changed properties.
   *
   * This method differs from the generic `runEffects` method in that it
   * continues to run computed effects based on the output of each pass until
   * there are no more newly computed properties.  This ensures that all
   * properties that will be computed by the initial set of changes are
   * computed before other effects (binding propagation, observers, and notify)
   * run.
   *
   * @param {!PropertyEffectsType} inst The instance the effect will be run on
   * @param {!Object} changedProps Bag of changed properties
   * @param {!Object} oldProps Bag of previous values for changed properties
   * @param {boolean} hasPaths True with `props` contains one or more paths
   * @return {void}
   * @private
   */
  function runComputedEffects(inst, changedProps, oldProps, hasPaths) {
    let computeEffects = inst[TYPES.COMPUTE];
    if (computeEffects) {
      let inputProps = changedProps;
      while (runEffects(inst, computeEffects, inputProps, oldProps, hasPaths)) {
        Object.assign(oldProps, inst.__dataOld);
        Object.assign(changedProps, inst.__dataPending);
        inputProps = inst.__dataPending;
        inst.__dataPending = null;
      }
    }
  }

  /**
   * Implements the "computed property" effect by running the method with the
   * values of the arguments specified in the `info` object and setting the
   * return value to the computed property specified.
   *
   * @param {!PropertyEffectsType} inst The instance the effect will be run on
   * @param {string} property Name of property
   * @param {Object} props Bag of current property changes
   * @param {Object} oldProps Bag of previous values for changed properties
   * @param {?} info Effect metadata
   * @return {void}
   * @private
   */
  function runComputedEffect(inst, property, props, oldProps, info) {
    let result = runMethodEffect(inst, property, props, oldProps, info);
    let computedProp = info.methodInfo;
    if (inst.__dataHasAccessor && inst.__dataHasAccessor[computedProp]) {
      inst._setPendingProperty(computedProp, result, true);
    } else {
      inst[computedProp] = result;
    }
  }

  /**
   * Computes path changes based on path links set up using the `linkPaths`
   * API.
   *
   * @param {!PropertyEffectsType} inst The instance whose props are changing
   * @param {string | !Array<(string|number)>} path Path that has changed
   * @param {*} value Value of changed path
   * @return {void}
   * @private
   */
  function computeLinkedPaths(inst, path, value) {
    let links = inst.__dataLinkedPaths;
    if (links) {
      let link;
      for (let a in links) {
        let b = links[a];
        if (Polymer.Path.isDescendant(a, path)) {
          link = Polymer.Path.translate(a, b, path);
          inst._setPendingPropertyOrPath(link, value, true, true);
        } else if (Polymer.Path.isDescendant(b, path)) {
          link = Polymer.Path.translate(b, a, path);
          inst._setPendingPropertyOrPath(link, value, true, true);
        }
      }
    }
  }

  // -- bindings ----------------------------------------------

  /**
   * Adds binding metadata to the current `nodeInfo`, and binding effects
   * for all part dependencies to `templateInfo`.
   *
   * @param {Function} constructor Class that `_parseTemplate` is currently
   *   running on
   * @param {TemplateInfo} templateInfo Template metadata for current template
   * @param {NodeInfo} nodeInfo Node metadata for current template node
   * @param {string} kind Binding kind, either 'property', 'attribute', or 'text'
   * @param {string} target Target property name
   * @param {!Array<!BindingPart>} parts Array of binding part metadata
   * @param {string=} literal Literal text surrounding binding parts (specified
   *   only for 'property' bindings, since these must be initialized as part
   *   of boot-up)
   * @return {void}
   * @private
   */
  function addBinding(constructor, templateInfo, nodeInfo, kind, target, parts, literal) {
    // Create binding metadata and add to nodeInfo
    nodeInfo.bindings = nodeInfo.bindings || [];
    let /** Binding */ binding = { kind, target, parts, literal, isCompound: (parts.length !== 1) };
    nodeInfo.bindings.push(binding);
    // Add listener info to binding metadata
    if (shouldAddListener(binding)) {
      let {event, negate} = binding.parts[0];
      binding.listenerEvent = event || (CaseMap.camelToDashCase(target) + '-changed');
      binding.listenerNegate = negate;
    }
    // Add "propagate" property effects to templateInfo
    let index = templateInfo.nodeInfoList.length;
    for (let i=0; i<binding.parts.length; i++) {
      let part = binding.parts[i];
      part.compoundIndex = i;
      addEffectForBindingPart(constructor, templateInfo, binding, part, index);
    }
  }

  /**
   * Adds property effects to the given `templateInfo` for the given binding
   * part.
   *
   * @param {Function} constructor Class that `_parseTemplate` is currently
   *   running on
   * @param {TemplateInfo} templateInfo Template metadata for current template
   * @param {!Binding} binding Binding metadata
   * @param {!BindingPart} part Binding part metadata
   * @param {number} index Index into `nodeInfoList` for this node
   * @return {void}
   */
  function addEffectForBindingPart(constructor, templateInfo, binding, part, index) {
    if (!part.literal) {
      if (binding.kind === 'attribute' && binding.target[0] === '-') {
        console.warn('Cannot set attribute ' + binding.target +
          ' because "-" is not a valid attribute starting character');
      } else {
        let dependencies = part.dependencies;
        let info = { index, binding, part, evaluator: constructor };
        for (let j=0; j<dependencies.length; j++) {
          let trigger = dependencies[j];
          if (typeof trigger == 'string') {
            trigger = parseArg(trigger);
            trigger.wildcard = true;
          }
          constructor._addTemplatePropertyEffect(templateInfo, trigger.rootProperty, {
            fn: runBindingEffect,
            info, trigger
          });
        }
      }
    }
  }

  /**
   * Implements the "binding" (property/path binding) effect.
   *
   * Note that binding syntax is overridable via `_parseBindings` and
   * `_evaluateBinding`.  This method will call `_evaluateBinding` for any
   * non-literal parts returned from `_parseBindings`.  However,
   * there is no support for _path_ bindings via custom binding parts,
   * as this is specific to Polymer's path binding syntax.
   *
   * @param {!PropertyEffectsType} inst The instance the effect will be run on
   * @param {string} path Name of property
   * @param {Object} props Bag of current property changes
   * @param {Object} oldProps Bag of previous values for changed properties
   * @param {?} info Effect metadata
   * @param {boolean} hasPaths True with `props` contains one or more paths
   * @param {Array} nodeList List of nodes associated with `nodeInfoList` template
   *   metadata
   * @return {void}
   * @private
   */
  function runBindingEffect(inst, path, props, oldProps, info, hasPaths, nodeList) {
    let node = nodeList[info.index];
    let binding = info.binding;
    let part = info.part;
    // Subpath notification: transform path and set to client
    // e.g.: foo="{{obj.sub}}", path: 'obj.sub.prop', set 'foo.prop'=obj.sub.prop
    if (hasPaths && part.source && (path.length > part.source.length) &&
        (binding.kind == 'property') && !binding.isCompound &&
        node.__isPropertyEffectsClient &&
        node.__dataHasAccessor && node.__dataHasAccessor[binding.target]) {
      let value = props[path];
      path = Polymer.Path.translate(part.source, binding.target, path);
      if (node._setPendingPropertyOrPath(path, value, false, true)) {
        inst._enqueueClient(node);
      }
    } else {
      let value = info.evaluator._evaluateBinding(inst, part, path, props, oldProps, hasPaths);
      // Propagate value to child
      applyBindingValue(inst, node, binding, part, value);
    }
  }

  /**
   * Sets the value for an "binding" (binding) effect to a node,
   * either as a property or attribute.
   *
   * @param {!PropertyEffectsType} inst The instance owning the binding effect
   * @param {Node} node Target node for binding
   * @param {!Binding} binding Binding metadata
   * @param {!BindingPart} part Binding part metadata
   * @param {*} value Value to set
   * @return {void}
   * @private
   */
  function applyBindingValue(inst, node, binding, part, value) {
    value = computeBindingValue(node, value, binding, part);
    if (Polymer.sanitizeDOMValue) {
      value = Polymer.sanitizeDOMValue(value, binding.target, binding.kind, node);
    }
    if (binding.kind == 'attribute') {
      // Attribute binding
      inst._valueToNodeAttribute(/** @type {Element} */(node), value, binding.target);
    } else {
      // Property binding
      let prop = binding.target;
      if (node.__isPropertyEffectsClient &&
          node.__dataHasAccessor && node.__dataHasAccessor[prop]) {
        if (!node[TYPES.READ_ONLY] || !node[TYPES.READ_ONLY][prop]) {
          if (node._setPendingProperty(prop, value)) {
            inst._enqueueClient(node);
          }
        }
      } else  {
        inst._setUnmanagedPropertyToNode(node, prop, value);
      }
    }
  }

  /**
   * Transforms an "binding" effect value based on compound & negation
   * effect metadata, as well as handling for special-case properties
   *
   * @param {Node} node Node the value will be set to
   * @param {*} value Value to set
   * @param {!Binding} binding Binding metadata
   * @param {!BindingPart} part Binding part metadata
   * @return {*} Transformed value to set
   * @private
   */
  function computeBindingValue(node, value, binding, part) {
    if (binding.isCompound) {
      let storage = node.__dataCompoundStorage[binding.target];
      storage[part.compoundIndex] = value;
      value = storage.join('');
    }
    if (binding.kind !== 'attribute') {
      // Some browsers serialize `undefined` to `"undefined"`
      if (binding.target === 'textContent' ||
          (binding.target === 'value' &&
            (node.localName === 'input' || node.localName === 'textarea'))) {
        value = value == undefined ? '' : value;
      }
    }
    return value;
  }

  /**
   * Returns true if a binding's metadata meets all the requirements to allow
   * 2-way binding, and therefore a `<property>-changed` event listener should be
   * added:
   * - used curly braces
   * - is a property (not attribute) binding
   * - is not a textContent binding
   * - is not compound
   *
   * @param {!Binding} binding Binding metadata
   * @return {boolean} True if 2-way listener should be added
   * @private
   */
  function shouldAddListener(binding) {
    return Boolean(binding.target) &&
           binding.kind != 'attribute' &&
           binding.kind != 'text' &&
           !binding.isCompound &&
           binding.parts[0].mode === '{';
  }

  /**
   * Setup compound binding storage structures, notify listeners, and dataHost
   * references onto the bound nodeList.
   *
   * @param {!PropertyEffectsType} inst Instance that bas been previously bound
   * @param {TemplateInfo} templateInfo Template metadata
   * @return {void}
   * @private
   */
  function setupBindings(inst, templateInfo) {
    // Setup compound storage, dataHost, and notify listeners
    let {nodeList, nodeInfoList} = templateInfo;
    if (nodeInfoList.length) {
      for (let i=0; i < nodeInfoList.length; i++) {
        let info = nodeInfoList[i];
        let node = nodeList[i];
        let bindings = info.bindings;
        if (bindings) {
          for (let i=0; i<bindings.length; i++) {
            let binding = bindings[i];
            setupCompoundStorage(node, binding);
            addNotifyListener(node, inst, binding);
          }
        }
        node.__dataHost = inst;
      }
    }
  }

  /**
   * Initializes `__dataCompoundStorage` local storage on a bound node with
   * initial literal data for compound bindings, and sets the joined
   * literal parts to the bound property.
   *
   * When changes to compound parts occur, they are first set into the compound
   * storage array for that property, and then the array is joined to result in
   * the final value set to the property/attribute.
   *
   * @param {Node} node Bound node to initialize
   * @param {Binding} binding Binding metadata
   * @return {void}
   * @private
   */
  function setupCompoundStorage(node, binding) {
    if (binding.isCompound) {
      // Create compound storage map
      let storage = node.__dataCompoundStorage ||
        (node.__dataCompoundStorage = {});
      let parts = binding.parts;
      // Copy literals from parts into storage for this binding
      let literals = new Array(parts.length);
      for (let j=0; j<parts.length; j++) {
        literals[j] = parts[j].literal;
      }
      let target = binding.target;
      storage[target] = literals;
      // Configure properties with their literal parts
      if (binding.literal && binding.kind == 'property') {
        node[target] = binding.literal;
      }
    }
  }

  /**
   * Adds a 2-way binding notification event listener to the node specified
   *
   * @param {Object} node Child element to add listener to
   * @param {!PropertyEffectsType} inst Host element instance to handle notification event
   * @param {Binding} binding Binding metadata
   * @return {void}
   * @private
   */
  function addNotifyListener(node, inst, binding) {
    if (binding.listenerEvent) {
      let part = binding.parts[0];
      node.addEventListener(binding.listenerEvent, function(e) {
        handleNotification(e, inst, binding.target, part.source, part.negate);
      });
    }
  }

  // -- for method-based effects (complexObserver & computed) --------------

  /**
   * Adds property effects for each argument in the method signature (and
   * optionally, for the method name if `dynamic` is true) that calls the
   * provided effect function.
   *
   * @param {Element | Object} model Prototype or instance
   * @param {!MethodSignature} sig Method signature metadata
   * @param {string} type Type of property effect to add
   * @param {Function} effectFn Function to run when arguments change
   * @param {*=} methodInfo Effect-specific information to be included in
   *   method effect metadata
   * @param {boolean|Object=} dynamicFn Boolean or object map indicating whether
   *   method names should be included as a dependency to the effect. Note,
   *   defaults to true if the signature is static (sig.static is true).
   * @return {void}
   * @private
   */
  function createMethodEffect(model, sig, type, effectFn, methodInfo, dynamicFn) {
    dynamicFn = sig.static || (dynamicFn &&
      (typeof dynamicFn !== 'object' || dynamicFn[sig.methodName]));
    let info = {
      methodName: sig.methodName,
      args: sig.args,
      methodInfo,
      dynamicFn
    };
    for (let i=0, arg; (i<sig.args.length) && (arg=sig.args[i]); i++) {
      if (!arg.literal) {
        model._addPropertyEffect(arg.rootProperty, type, {
          fn: effectFn, info: info, trigger: arg
        });
      }
    }
    if (dynamicFn) {
      model._addPropertyEffect(sig.methodName, type, {
        fn: effectFn, info: info
      });
    }
  }

  /**
   * Calls a method with arguments marshaled from properties on the instance
   * based on the method signature contained in the effect metadata.
   *
   * Multi-property observers, computed properties, and inline computing
   * functions call this function to invoke the method, then use the return
   * value accordingly.
   *
   * @param {!PropertyEffectsType} inst The instance the effect will be run on
   * @param {string} property Name of property
   * @param {Object} props Bag of current property changes
   * @param {Object} oldProps Bag of previous values for changed properties
   * @param {?} info Effect metadata
   * @return {*} Returns the return value from the method invocation
   * @private
   */
  function runMethodEffect(inst, property, props, oldProps, info) {
    // Instances can optionally have a _methodHost which allows redirecting where
    // to find methods. Currently used by `templatize`.
    let context = inst._methodHost || inst;
    let fn = context[info.methodName];
    if (fn) {
      let args = inst._marshalArgs(info.args, property, props);
      return fn.apply(context, args);
    } else if (!info.dynamicFn) {
      console.warn('method `' + info.methodName + '` not defined');
    }
  }

  const emptyArray = [];

  // Regular expressions used for binding
  const IDENT  = '(?:' + '[a-zA-Z_$][\\w.:$\\-*]*' + ')';
  const NUMBER = '(?:' + '[-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?' + ')';
  const SQUOTE_STRING = '(?:' + '\'(?:[^\'\\\\]|\\\\.)*\'' + ')';
  const DQUOTE_STRING = '(?:' + '"(?:[^"\\\\]|\\\\.)*"' + ')';
  const STRING = '(?:' + SQUOTE_STRING + '|' + DQUOTE_STRING + ')';
  const ARGUMENT = '(?:(' + IDENT + '|' + NUMBER + '|' +  STRING + ')\\s*' + ')';
  const ARGUMENTS = '(?:' + ARGUMENT + '(?:,\\s*' + ARGUMENT + ')*' + ')';
  const ARGUMENT_LIST = '(?:' + '\\(\\s*' +
                                '(?:' + ARGUMENTS + '?' + ')' +
                              '\\)\\s*' + ')';
  const BINDING = '(' + IDENT + '\\s*' + ARGUMENT_LIST + '?' + ')'; // Group 3
  const OPEN_BRACKET = '(\\[\\[|{{)' + '\\s*';
  const CLOSE_BRACKET = '(?:]]|}})';
  const NEGATE = '(?:(!)\\s*)?'; // Group 2
  const EXPRESSION = OPEN_BRACKET + NEGATE + BINDING + CLOSE_BRACKET;
  const bindingRegex = new RegExp(EXPRESSION, "g");

  /**
   * Create a string from binding parts of all the literal parts
   *
   * @param {!Array<BindingPart>} parts All parts to stringify
   * @return {string} String made from the literal parts
   */
  function literalFromParts(parts) {
    let s = '';
    for (let i=0; i<parts.length; i++) {
      let literal = parts[i].literal;
      s += literal || '';
    }
    return s;
  }

  /**
   * Parses an expression string for a method signature, and returns a metadata
   * describing the method in terms of `methodName`, `static` (whether all the
   * arguments are literals), and an array of `args`
   *
   * @param {string} expression The expression to parse
   * @return {?MethodSignature} The method metadata object if a method expression was
   *   found, otherwise `undefined`
   * @private
   */
  function parseMethod(expression) {
    // tries to match valid javascript property names
    let m = expression.match(/([^\s]+?)\(([\s\S]*)\)/);
    if (m) {
      let methodName = m[1];
      let sig = { methodName, static: true, args: emptyArray };
      if (m[2].trim()) {
        // replace escaped commas with comma entity, split on un-escaped commas
        let args = m[2].replace(/\\,/g, '&comma;').split(',');
        return parseArgs(args, sig);
      } else {
        return sig;
      }
    }
    return null;
  }

  /**
   * Parses an array of arguments and sets the `args` property of the supplied
   * signature metadata object. Sets the `static` property to false if any
   * argument is a non-literal.
   *
   * @param {!Array<string>} argList Array of argument names
   * @param {!MethodSignature} sig Method signature metadata object
   * @return {!MethodSignature} The updated signature metadata object
   * @private
   */
  function parseArgs(argList, sig) {
    sig.args = argList.map(function(rawArg) {
      let arg = parseArg(rawArg);
      if (!arg.literal) {
        sig.static = false;
      }
      return arg;
    }, this);
    return sig;
  }

  /**
   * Parses an individual argument, and returns an argument metadata object
   * with the following fields:
   *
   *   {
   *     value: 'prop',        // property/path or literal value
   *     literal: false,       // whether argument is a literal
   *     structured: false,    // whether the property is a path
   *     rootProperty: 'prop', // the root property of the path
   *     wildcard: false       // whether the argument was a wildcard '.*' path
   *   }
   *
   * @param {string} rawArg The string value of the argument
   * @return {!MethodArg} Argument metadata object
   * @private
   */
  function parseArg(rawArg) {
    // clean up whitespace
    let arg = rawArg.trim()
      // replace comma entity with comma
      .replace(/&comma;/g, ',')
      // repair extra escape sequences; note only commas strictly need
      // escaping, but we allow any other char to be escaped since its
      // likely users will do this
      .replace(/\\(.)/g, '\$1')
      ;
    // basic argument descriptor
    let a = {
      name: arg,
      value: '',
      literal: false
    };
    // detect literal value (must be String or Number)
    let fc = arg[0];
    if (fc === '-') {
      fc = arg[1];
    }
    if (fc >= '0' && fc <= '9') {
      fc = '#';
    }
    switch(fc) {
      case "'":
      case '"':
        a.value = arg.slice(1, -1);
        a.literal = true;
        break;
      case '#':
        a.value = Number(arg);
        a.literal = true;
        break;
    }
    // if not literal, look for structured path
    if (!a.literal) {
      a.rootProperty = Polymer.Path.root(arg);
      // detect structured path (has dots)
      a.structured = Polymer.Path.isPath(arg);
      if (a.structured) {
        a.wildcard = (arg.slice(-2) == '.*');
        if (a.wildcard) {
          a.name = arg.slice(0, -2);
        }
      }
    }
    return a;
  }

  // data api

  /**
   * Sends array splice notifications (`.splices` and `.length`)
   *
   * Note: this implementation only accepts normalized paths
   *
   * @param {!PropertyEffectsType} inst Instance to send notifications to
   * @param {Array} array The array the mutations occurred on
   * @param {string} path The path to the array that was mutated
   * @param {Array} splices Array of splice records
   * @return {void}
   * @private
   */
  function notifySplices(inst, array, path, splices) {
    let splicesPath = path + '.splices';
    inst.notifyPath(splicesPath, { indexSplices: splices });
    inst.notifyPath(path + '.length', array.length);
    // Null here to allow potentially large splice records to be GC'ed.
    inst.__data[splicesPath] = {indexSplices: null};
  }

  /**
   * Creates a splice record and sends an array splice notification for
   * the described mutation
   *
   * Note: this implementation only accepts normalized paths
   *
   * @param {!PropertyEffectsType} inst Instance to send notifications to
   * @param {Array} array The array the mutations occurred on
   * @param {string} path The path to the array that was mutated
   * @param {number} index Index at which the array mutation occurred
   * @param {number} addedCount Number of added items
   * @param {Array} removed Array of removed items
   * @return {void}
   * @private
   */
  function notifySplice(inst, array, path, index, addedCount, removed) {
    notifySplices(inst, array, path, [{
      index: index,
      addedCount: addedCount,
      removed: removed,
      object: array,
      type: 'splice'
    }]);
  }

  /**
   * Returns an upper-cased version of the string.
   *
   * @param {string} name String to uppercase
   * @return {string} Uppercased string
   * @private
   */
  function upper(name) {
    return name[0].toUpperCase() + name.substring(1);
  }

  /**
   * Element class mixin that provides meta-programming for Polymer's template
   * binding and data observation (collectively, "property effects") system.
   *
   * This mixin uses provides the following key static methods for adding
   * property effects to an element class:
   * - `addPropertyEffect`
   * - `createPropertyObserver`
   * - `createMethodObserver`
   * - `createNotifyingProperty`
   * - `createReadOnlyProperty`
   * - `createReflectedProperty`
   * - `createComputedProperty`
   * - `bindTemplate`
   *
   * Each method creates one or more property accessors, along with metadata
   * used by this mixin's implementation of `_propertiesChanged` to perform
   * the property effects.
   *
   * Underscored versions of the above methods also exist on the element
   * prototype for adding property effects on instances at runtime.
   *
   * Note that this mixin overrides several `PropertyAccessors` methods, in
   * many cases to maintain guarantees provided by the Polymer 1.x features;
   * notably it changes property accessors to be synchronous by default
   * whereas the default when using `PropertyAccessors` standalone is to be
   * async by default.
   *
   * @mixinFunction
   * @polymer
   * @appliesMixin Polymer.TemplateStamp
   * @appliesMixin Polymer.PropertyAccessors
   * @memberof Polymer
   * @summary Element class mixin that provides meta-programming for Polymer's
   * template binding and data observation system.
   */
  Polymer.PropertyEffects = Polymer.dedupingMixin(superClass => {

    /**
     * @constructor
     * @extends {superClass}
     * @implements {Polymer_PropertyAccessors}
     * @implements {Polymer_TemplateStamp}
     * @unrestricted
     * @private
     */
    const propertyEffectsBase = Polymer.TemplateStamp(Polymer.PropertyAccessors(superClass));

    /**
     * @polymer
     * @mixinClass
     * @implements {Polymer_PropertyEffects}
     * @extends {propertyEffectsBase}
     * @unrestricted
     */
    class PropertyEffects extends propertyEffectsBase {

      constructor() {
        super();
        /** @type {boolean} */
        // Used to identify users of this mixin, ala instanceof
        this.__isPropertyEffectsClient = true;
        /** @type {number} */
        // NOTE: used to track re-entrant calls to `_flushProperties`
        // path changes dirty check against `__dataTemp` only during one "turn"
        // and are cleared when `__dataCounter` returns to 0.
        this.__dataCounter = 0;
        /** @type {boolean} */
        this.__dataClientsReady;
        /** @type {Array} */
        this.__dataPendingClients;
        /** @type {Object} */
        this.__dataToNotify;
        /** @type {Object} */
        this.__dataLinkedPaths;
        /** @type {boolean} */
        this.__dataHasPaths;
        /** @type {Object} */
        this.__dataCompoundStorage;
        /** @type {Polymer_PropertyEffects} */
        this.__dataHost;
        /** @type {!Object} */
        this.__dataTemp;
        /** @type {boolean} */
        this.__dataClientsInitialized;
        /** @type {!Object} */
        this.__data;
        /** @type {!Object} */
        this.__dataPending;
        /** @type {!Object} */
        this.__dataOld;
        /** @type {Object} */
        this.__computeEffects;
        /** @type {Object} */
        this.__reflectEffects;
        /** @type {Object} */
        this.__notifyEffects;
        /** @type {Object} */
        this.__propagateEffects;
        /** @type {Object} */
        this.__observeEffects;
        /** @type {Object} */
        this.__readOnly;
        /** @type {!TemplateInfo} */
        this.__templateInfo;
      }

      get PROPERTY_EFFECT_TYPES() {
        return TYPES;
      }

      /**
       * @return {void}
       */
      _initializeProperties() {
        super._initializeProperties();
        hostStack.registerHost(this);
        this.__dataClientsReady = false;
        this.__dataPendingClients = null;
        this.__dataToNotify = null;
        this.__dataLinkedPaths = null;
        this.__dataHasPaths = false;
        // May be set on instance prior to upgrade
        this.__dataCompoundStorage = this.__dataCompoundStorage || null;
        this.__dataHost = this.__dataHost || null;
        this.__dataTemp = {};
        this.__dataClientsInitialized = false;
      }

      /**
       * Overrides `Polymer.PropertyAccessors` implementation to provide a
       * more efficient implementation of initializing properties from
       * the prototype on the instance.
       *
       * @override
       * @param {Object} props Properties to initialize on the prototype
       * @return {void}
       */
      _initializeProtoProperties(props) {
        this.__data = Object.create(props);
        this.__dataPending = Object.create(props);
        this.__dataOld = {};
      }

      /**
       * Overrides `Polymer.PropertyAccessors` implementation to avoid setting
       * `_setProperty`'s `shouldNotify: true`.
       *
       * @override
       * @param {Object} props Properties to initialize on the instance
       * @return {void}
       */
      _initializeInstanceProperties(props) {
        let readOnly = this[TYPES.READ_ONLY];
        for (let prop in props) {
          if (!readOnly || !readOnly[prop]) {
            this.__dataPending = this.__dataPending || {};
            this.__dataOld = this.__dataOld || {};
            this.__data[prop] = this.__dataPending[prop] = props[prop];
          }
        }
      }

      // Prototype setup ----------------------------------------

      /**
       * Equivalent to static `addPropertyEffect` API but can be called on
       * an instance to add effects at runtime.  See that method for
       * full API docs.
       *
       * @param {string} property Property that should trigger the effect
       * @param {string} type Effect type, from this.PROPERTY_EFFECT_TYPES
       * @param {Object=} effect Effect metadata object
       * @return {void}
       * @protected
       */
      _addPropertyEffect(property, type, effect) {
        this._createPropertyAccessor(property, type == TYPES.READ_ONLY);
        // effects are accumulated into arrays per property based on type
        let effects = ensureOwnEffectMap(this, type)[property];
        if (!effects) {
          effects = this[type][property] = [];
        }
        effects.push(effect);
      }

      /**
       * Removes the given property effect.
       *
       * @param {string} property Property the effect was associated with
       * @param {string} type Effect type, from this.PROPERTY_EFFECT_TYPES
       * @param {Object=} effect Effect metadata object to remove
       * @return {void}
       */
      _removePropertyEffect(property, type, effect) {
        let effects = ensureOwnEffectMap(this, type)[property];
        let idx = effects.indexOf(effect);
        if (idx >= 0) {
          effects.splice(idx, 1);
        }
      }

      /**
       * Returns whether the current prototype/instance has a property effect
       * of a certain type.
       *
       * @param {string} property Property name
       * @param {string=} type Effect type, from this.PROPERTY_EFFECT_TYPES
       * @return {boolean} True if the prototype/instance has an effect of this type
       * @protected
       */
      _hasPropertyEffect(property, type) {
        let effects = this[type];
        return Boolean(effects && effects[property]);
      }

      /**
       * Returns whether the current prototype/instance has a "read only"
       * accessor for the given property.
       *
       * @param {string} property Property name
       * @return {boolean} True if the prototype/instance has an effect of this type
       * @protected
       */
      _hasReadOnlyEffect(property) {
        return this._hasPropertyEffect(property, TYPES.READ_ONLY);
      }

      /**
       * Returns whether the current prototype/instance has a "notify"
       * property effect for the given property.
       *
       * @param {string} property Property name
       * @return {boolean} True if the prototype/instance has an effect of this type
       * @protected
       */
      _hasNotifyEffect(property) {
        return this._hasPropertyEffect(property, TYPES.NOTIFY);
      }

      /**
       * Returns whether the current prototype/instance has a "reflect to attribute"
       * property effect for the given property.
       *
       * @param {string} property Property name
       * @return {boolean} True if the prototype/instance has an effect of this type
       * @protected
       */
      _hasReflectEffect(property) {
        return this._hasPropertyEffect(property, TYPES.REFLECT);
      }

      /**
       * Returns whether the current prototype/instance has a "computed"
       * property effect for the given property.
       *
       * @param {string} property Property name
       * @return {boolean} True if the prototype/instance has an effect of this type
       * @protected
       */
      _hasComputedEffect(property) {
        return this._hasPropertyEffect(property, TYPES.COMPUTE);
      }

      // Runtime ----------------------------------------

      /**
       * Sets a pending property or path.  If the root property of the path in
       * question had no accessor, the path is set, otherwise it is enqueued
       * via `_setPendingProperty`.
       *
       * This function isolates relatively expensive functionality necessary
       * for the public API (`set`, `setProperties`, `notifyPath`, and property
       * change listeners via {{...}} bindings), such that it is only done
       * when paths enter the system, and not at every propagation step.  It
       * also sets a `__dataHasPaths` flag on the instance which is used to
       * fast-path slower path-matching code in the property effects host paths.
       *
       * `path` can be a path string or array of path parts as accepted by the
       * public API.
       *
       * @param {string | !Array<number|string>} path Path to set
       * @param {*} value Value to set
       * @param {boolean=} shouldNotify Set to true if this change should
       *  cause a property notification event dispatch
       * @param {boolean=} isPathNotification If the path being set is a path
       *   notification of an already changed value, as opposed to a request
       *   to set and notify the change.  In the latter `false` case, a dirty
       *   check is performed and then the value is set to the path before
       *   enqueuing the pending property change.
       * @return {boolean} Returns true if the property/path was enqueued in
       *   the pending changes bag.
       * @protected
       */
      _setPendingPropertyOrPath(path, value, shouldNotify, isPathNotification) {
        if (isPathNotification ||
            Polymer.Path.root(Array.isArray(path) ? path[0] : path) !== path) {
          // Dirty check changes being set to a path against the actual object,
          // since this is the entry point for paths into the system; from here
          // the only dirty checks are against the `__dataTemp` cache to prevent
          // duplicate work in the same turn only. Note, if this was a notification
          // of a change already set to a path (isPathNotification: true),
          // we always let the change through and skip the `set` since it was
          // already dirty checked at the point of entry and the underlying
          // object has already been updated
          if (!isPathNotification) {
            let old = Polymer.Path.get(this, path);
            path = /** @type {string} */ (Polymer.Path.set(this, path, value));
            // Use property-accessor's simpler dirty check
            if (!path || !super._shouldPropertyChange(path, value, old)) {
              return false;
            }
          }
          this.__dataHasPaths = true;
          if (this._setPendingProperty(/**@type{string}*/(path), value, shouldNotify)) {
            computeLinkedPaths(this, path, value);
            return true;
          }
        } else {
          if (this.__dataHasAccessor && this.__dataHasAccessor[path]) {
            return this._setPendingProperty(/**@type{string}*/(path), value, shouldNotify);
          } else {
            this[path] = value;
          }
        }
        return false;
      }

      /**
       * Applies a value to a non-Polymer element/node's property.
       *
       * The implementation makes a best-effort at binding interop:
       * Some native element properties have side-effects when
       * re-setting the same value (e.g. setting `<input>.value` resets the
       * cursor position), so we do a dirty-check before setting the value.
       * However, for better interop with non-Polymer custom elements that
       * accept objects, we explicitly re-set object changes coming from the
       * Polymer world (which may include deep object changes without the
       * top reference changing), erring on the side of providing more
       * information.
       *
       * Users may override this method to provide alternate approaches.
       *
       * @param {!Node} node The node to set a property on
       * @param {string} prop The property to set
       * @param {*} value The value to set
       * @return {void}
       * @protected
       */
      _setUnmanagedPropertyToNode(node, prop, value) {
        // It is a judgment call that resetting primitives is
        // "bad" and resettings objects is also "good"; alternatively we could
        // implement a whitelist of tag & property values that should never
        // be reset (e.g. <input>.value && <select>.value)
        if (value !== node[prop] || typeof value == 'object') {
          node[prop] = value;
        }
      }

      /**
       * Overrides the `PropertiesChanged` implementation to introduce special
       * dirty check logic depending on the property & value being set:
       *
       * 1. Any value set to a path (e.g. 'obj.prop': 42 or 'obj.prop': {...})
       *    Stored in `__dataTemp`, dirty checked against `__dataTemp`
       * 2. Object set to simple property (e.g. 'prop': {...})
       *    Stored in `__dataTemp` and `__data`, dirty checked against
       *    `__dataTemp` by default implementation of `_shouldPropertyChange`
       * 3. Primitive value set to simple property (e.g. 'prop': 42)
       *    Stored in `__data`, dirty checked against `__data`
       *
       * The dirty-check is important to prevent cycles due to two-way
       * notification, but paths and objects are only dirty checked against any
       * previous value set during this turn via a "temporary cache" that is
       * cleared when the last `_propertiesChanged` exits. This is so:
       * a. any cached array paths (e.g. 'array.3.prop') may be invalidated
       *    due to array mutations like shift/unshift/splice; this is fine
       *    since path changes are dirty-checked at user entry points like `set`
       * b. dirty-checking for objects only lasts one turn to allow the user
       *    to mutate the object in-place and re-set it with the same identity
       *    and have all sub-properties re-propagated in a subsequent turn.
       *
       * The temp cache is not necessarily sufficient to prevent invalid array
       * paths, since a splice can happen during the same turn (with pathological
       * user code); we could introduce a "fixup" for temporarily cached array
       * paths if needed: https://github.com/Polymer/polymer/issues/4227
       *
       * @override
       * @param {string} property Name of the property
       * @param {*} value Value to set
       * @param {boolean=} shouldNotify True if property should fire notification
       *   event (applies only for `notify: true` properties)
       * @return {boolean} Returns true if the property changed
       */
      _setPendingProperty(property, value, shouldNotify) {
        let isPath = this.__dataHasPaths && Polymer.Path.isPath(property);
        let prevProps = isPath ? this.__dataTemp : this.__data;
        if (this._shouldPropertyChange(property, value, prevProps[property])) {
          if (!this.__dataPending) {
            this.__dataPending = {};
            this.__dataOld = {};
          }
          // Ensure old is captured from the last turn
          if (!(property in this.__dataOld)) {
            this.__dataOld[property] = this.__data[property];
          }
          // Paths are stored in temporary cache (cleared at end of turn),
          // which is used for dirty-checking, all others stored in __data
          if (isPath) {
            this.__dataTemp[property] = value;
          } else {
            this.__data[property] = value;
          }
          // All changes go into pending property bag, passed to _propertiesChanged
          this.__dataPending[property] = value;
          // Track properties that should notify separately
          if (isPath || (this[TYPES.NOTIFY] && this[TYPES.NOTIFY][property])) {
            this.__dataToNotify = this.__dataToNotify || {};
            this.__dataToNotify[property] = shouldNotify;
          }
          return true;
        }
        return false;
      }

      /**
       * Overrides base implementation to ensure all accessors set `shouldNotify`
       * to true, for per-property notification tracking.
       *
       * @override
       * @param {string} property Name of the property
       * @param {*} value Value to set
       * @return {void}
       */
      _setProperty(property, value) {
        if (this._setPendingProperty(property, value, true)) {
          this._invalidateProperties();
        }
      }

      /**
       * Overrides `PropertyAccessor`'s default async queuing of
       * `_propertiesChanged`: if `__dataReady` is false (has not yet been
       * manually flushed), the function no-ops; otherwise flushes
       * `_propertiesChanged` synchronously.
       *
       * @override
       * @return {void}
       */
      _invalidateProperties() {
        if (this.__dataReady) {
          this._flushProperties();
        }
      }

      /**
       * Enqueues the given client on a list of pending clients, whose
       * pending property changes can later be flushed via a call to
       * `_flushClients`.
       *
       * @param {Object} client PropertyEffects client to enqueue
       * @return {void}
       * @protected
       */
      _enqueueClient(client) {
        this.__dataPendingClients = this.__dataPendingClients || [];
        if (client !== this) {
          this.__dataPendingClients.push(client);
        }
      }

      /**
       * Overrides superclass implementation.
       *
       * @return {void}
       * @protected
       */
      _flushProperties() {
        this.__dataCounter++;
        super._flushProperties();
        this.__dataCounter--;
      }

      /**
       * Flushes any clients previously enqueued via `_enqueueClient`, causing
       * their `_flushProperties` method to run.
       *
       * @return {void}
       * @protected
       */
      _flushClients() {
        if (!this.__dataClientsReady) {
          this.__dataClientsReady = true;
          this._readyClients();
          // Override point where accessors are turned on; importantly,
          // this is after clients have fully readied, providing a guarantee
          // that any property effects occur only after all clients are ready.
          this.__dataReady = true;
        } else {
          this.__enableOrFlushClients();
        }
      }

      // NOTE: We ensure clients either enable or flush as appropriate. This
      // handles two corner cases:
      // (1) clients flush properly when connected/enabled before the host
      // enables; e.g.
      //   (a) Templatize stamps with no properties and does not flush and
      //   (b) the instance is inserted into dom and
      //   (c) then the instance flushes.
      // (2) clients enable properly when not connected/enabled when the host
      // flushes; e.g.
      //   (a) a template is runtime stamped and not yet connected/enabled
      //   (b) a host sets a property, causing stamped dom to flush
      //   (c) the stamped dom enables.
      __enableOrFlushClients() {
        let clients = this.__dataPendingClients;
        if (clients) {
          this.__dataPendingClients = null;
          for (let i=0; i < clients.length; i++) {
            let client = clients[i];
            if (!client.__dataEnabled) {
              client._enableProperties();
            } else if (client.__dataPending) {
              client._flushProperties();
            }
          }
        }
      }

      /**
       * Perform any initial setup on client dom. Called before the first
       * `_flushProperties` call on client dom and before any element
       * observers are called.
       *
       * @return {void}
       * @protected
       */
      _readyClients() {
        this.__enableOrFlushClients();
      }

      /**
       * Sets a bag of property changes to this instance, and
       * synchronously processes all effects of the properties as a batch.
       *
       * Property names must be simple properties, not paths.  Batched
       * path propagation is not supported.
       *
       * @param {Object} props Bag of one or more key-value pairs whose key is
       *   a property and value is the new value to set for that property.
       * @param {boolean=} setReadOnly When true, any private values set in
       *   `props` will be set. By default, `setProperties` will not set
       *   `readOnly: true` root properties.
       * @return {void}
       * @public
       */
      setProperties(props, setReadOnly) {
        for (let path in props) {
          if (setReadOnly || !this[TYPES.READ_ONLY] || !this[TYPES.READ_ONLY][path]) {
            //TODO(kschaaf): explicitly disallow paths in setProperty?
            // wildcard observers currently only pass the first changed path
            // in the `info` object, and you could do some odd things batching
            // paths, e.g. {'foo.bar': {...}, 'foo': null}
            this._setPendingPropertyOrPath(path, props[path], true);
          }
        }
        this._invalidateProperties();
      }

      /**
       * Overrides `PropertyAccessors` so that property accessor
       * side effects are not enabled until after client dom is fully ready.
       * Also calls `_flushClients` callback to ensure client dom is enabled
       * that was not enabled as a result of flushing properties.
       *
       * @override
       * @return {void}
       */
      ready() {
        // It is important that `super.ready()` is not called here as it
        // immediately turns on accessors. Instead, we wait until `readyClients`
        // to enable accessors to provide a guarantee that clients are ready
        // before processing any accessors side effects.
        this._flushProperties();
        // If no data was pending, `_flushProperties` will not `flushClients`
        // so ensure this is done.
        if (!this.__dataClientsReady) {
          this._flushClients();
        }
        // Before ready, client notifications do not trigger _flushProperties.
        // Therefore a flush is necessary here if data has been set.
        if (this.__dataPending) {
          this._flushProperties();
        }
      }

      /**
       * Implements `PropertyAccessors`'s properties changed callback.
       *
       * Runs each class of effects for the batch of changed properties in
       * a specific order (compute, propagate, reflect, observe, notify).
       *
       * @param {!Object} currentProps Bag of all current accessor values
       * @param {!Object} changedProps Bag of properties changed since the last
       *   call to `_propertiesChanged`
       * @param {!Object} oldProps Bag of previous values for each property
       *   in `changedProps`
       * @return {void}
       */
      _propertiesChanged(currentProps, changedProps, oldProps) {
        // ----------------------------
        // let c = Object.getOwnPropertyNames(changedProps || {});
        // window.debug && console.group(this.localName + '#' + this.id + ': ' + c);
        // if (window.debug) { debugger; }
        // ----------------------------
        let hasPaths = this.__dataHasPaths;
        this.__dataHasPaths = false;
        // Compute properties
        runComputedEffects(this, changedProps, oldProps, hasPaths);
        // Clear notify properties prior to possible reentry (propagate, observe),
        // but after computing effects have a chance to add to them
        let notifyProps = this.__dataToNotify;
        this.__dataToNotify = null;
        // Propagate properties to clients
        this._propagatePropertyChanges(changedProps, oldProps, hasPaths);
        // Flush clients
        this._flushClients();
        // Reflect properties
        runEffects(this, this[TYPES.REFLECT], changedProps, oldProps, hasPaths);
        // Observe properties
        runEffects(this, this[TYPES.OBSERVE], changedProps, oldProps, hasPaths);
        // Notify properties to host
        if (notifyProps) {
          runNotifyEffects(this, notifyProps, changedProps, oldProps, hasPaths);
        }
        // Clear temporary cache at end of turn
        if (this.__dataCounter == 1) {
          this.__dataTemp = {};
        }
        // ----------------------------
        // window.debug && console.groupEnd(this.localName + '#' + this.id + ': ' + c);
        // ----------------------------
      }

      /**
       * Called to propagate any property changes to stamped template nodes
       * managed by this element.
       *
       * @param {Object} changedProps Bag of changed properties
       * @param {Object} oldProps Bag of previous values for changed properties
       * @param {boolean} hasPaths True with `props` contains one or more paths
       * @return {void}
       * @protected
       */
      _propagatePropertyChanges(changedProps, oldProps, hasPaths) {
        if (this[TYPES.PROPAGATE]) {
          runEffects(this, this[TYPES.PROPAGATE], changedProps, oldProps, hasPaths);
        }
        let templateInfo = this.__templateInfo;
        while (templateInfo) {
          runEffects(this, templateInfo.propertyEffects, changedProps, oldProps,
            hasPaths, templateInfo.nodeList);
          templateInfo = templateInfo.nextTemplateInfo;
        }
      }

      /**
       * Aliases one data path as another, such that path notifications from one
       * are routed to the other.
       *
       * @param {string | !Array<string|number>} to Target path to link.
       * @param {string | !Array<string|number>} from Source path to link.
       * @return {void}
       * @public
       */
      linkPaths(to, from) {
        to = Polymer.Path.normalize(to);
        from = Polymer.Path.normalize(from);
        this.__dataLinkedPaths = this.__dataLinkedPaths || {};
        this.__dataLinkedPaths[to] = from;
      }

      /**
       * Removes a data path alias previously established with `_linkPaths`.
       *
       * Note, the path to unlink should be the target (`to`) used when
       * linking the paths.
       *
       * @param {string | !Array<string|number>} path Target path to unlink.
       * @return {void}
       * @public
       */
      unlinkPaths(path) {
        path = Polymer.Path.normalize(path);
        if (this.__dataLinkedPaths) {
          delete this.__dataLinkedPaths[path];
        }
      }

      /**
       * Notify that an array has changed.
       *
       * Example:
       *
       *     this.items = [ {name: 'Jim'}, {name: 'Todd'}, {name: 'Bill'} ];
       *     ...
       *     this.items.splice(1, 1, {name: 'Sam'});
       *     this.items.push({name: 'Bob'});
       *     this.notifySplices('items', [
       *       { index: 1, removed: [{name: 'Todd'}], addedCount: 1, object: this.items, type: 'splice' },
       *       { index: 3, removed: [], addedCount: 1, object: this.items, type: 'splice'}
       *     ]);
       *
       * @param {string} path Path that should be notified.
       * @param {Array} splices Array of splice records indicating ordered
       *   changes that occurred to the array. Each record should have the
       *   following fields:
       *    * index: index at which the change occurred
       *    * removed: array of items that were removed from this index
       *    * addedCount: number of new items added at this index
       *    * object: a reference to the array in question
       *    * type: the string literal 'splice'
       *
       *   Note that splice records _must_ be normalized such that they are
       *   reported in index order (raw results from `Object.observe` are not
       *   ordered and must be normalized/merged before notifying).
       * @return {void}
       * @public
      */
      notifySplices(path, splices) {
        let info = {path: ''};
        let array = /** @type {Array} */(Polymer.Path.get(this, path, info));
        notifySplices(this, array, info.path, splices);
      }

      /**
       * Convenience method for reading a value from a path.
       *
       * Note, if any part in the path is undefined, this method returns
       * `undefined` (this method does not throw when dereferencing undefined
       * paths).
       *
       * @param {(string|!Array<(string|number)>)} path Path to the value
       *   to read.  The path may be specified as a string (e.g. `foo.bar.baz`)
       *   or an array of path parts (e.g. `['foo.bar', 'baz']`).  Note that
       *   bracketed expressions are not supported; string-based path parts
       *   *must* be separated by dots.  Note that when dereferencing array
       *   indices, the index may be used as a dotted part directly
       *   (e.g. `users.12.name` or `['users', 12, 'name']`).
       * @param {Object=} root Root object from which the path is evaluated.
       * @return {*} Value at the path, or `undefined` if any part of the path
       *   is undefined.
       * @public
       */
      get(path, root) {
        return Polymer.Path.get(root || this, path);
      }

      /**
       * Convenience method for setting a value to a path and notifying any
       * elements bound to the same path.
       *
       * Note, if any part in the path except for the last is undefined,
       * this method does nothing (this method does not throw when
       * dereferencing undefined paths).
       *
       * @param {(string|!Array<(string|number)>)} path Path to the value
       *   to write.  The path may be specified as a string (e.g. `'foo.bar.baz'`)
       *   or an array of path parts (e.g. `['foo.bar', 'baz']`).  Note that
       *   bracketed expressions are not supported; string-based path parts
       *   *must* be separated by dots.  Note that when dereferencing array
       *   indices, the index may be used as a dotted part directly
       *   (e.g. `'users.12.name'` or `['users', 12, 'name']`).
       * @param {*} value Value to set at the specified path.
       * @param {Object=} root Root object from which the path is evaluated.
       *   When specified, no notification will occur.
       * @return {void}
       * @public
      */
      set(path, value, root) {
        if (root) {
          Polymer.Path.set(root, path, value);
        } else {
          if (!this[TYPES.READ_ONLY] || !this[TYPES.READ_ONLY][/** @type {string} */(path)]) {
            if (this._setPendingPropertyOrPath(path, value, true)) {
              this._invalidateProperties();
            }
          }
        }
      }

      /**
       * Adds items onto the end of the array at the path specified.
       *
       * The arguments after `path` and return value match that of
       * `Array.prototype.push`.
       *
       * This method notifies other paths to the same array that a
       * splice occurred to the array.
       *
       * @param {string | !Array<string|number>} path Path to array.
       * @param {...*} items Items to push onto array
       * @return {number} New length of the array.
       * @public
       */
      push(path, ...items) {
        let info = {path: ''};
        let array = /** @type {Array}*/(Polymer.Path.get(this, path, info));
        let len = array.length;
        let ret = array.push(...items);
        if (items.length) {
          notifySplice(this, array, info.path, len, items.length, []);
        }
        return ret;
      }

      /**
       * Removes an item from the end of array at the path specified.
       *
       * The arguments after `path` and return value match that of
       * `Array.prototype.pop`.
       *
       * This method notifies other paths to the same array that a
       * splice occurred to the array.
       *
       * @param {string | !Array<string|number>} path Path to array.
       * @return {*} Item that was removed.
       * @public
       */
      pop(path) {
        let info = {path: ''};
        let array = /** @type {Array} */(Polymer.Path.get(this, path, info));
        let hadLength = Boolean(array.length);
        let ret = array.pop();
        if (hadLength) {
          notifySplice(this, array, info.path, array.length, 0, [ret]);
        }
        return ret;
      }

      /**
       * Starting from the start index specified, removes 0 or more items
       * from the array and inserts 0 or more new items in their place.
       *
       * The arguments after `path` and return value match that of
       * `Array.prototype.splice`.
       *
       * This method notifies other paths to the same array that a
       * splice occurred to the array.
       *
       * @param {string | !Array<string|number>} path Path to array.
       * @param {number} start Index from which to start removing/inserting.
       * @param {number} deleteCount Number of items to remove.
       * @param {...*} items Items to insert into array.
       * @return {Array} Array of removed items.
       * @public
       */
      splice(path, start, deleteCount, ...items) {
        let info = {path : ''};
        let array = /** @type {Array} */(Polymer.Path.get(this, path, info));
        // Normalize fancy native splice handling of crazy start values
        if (start < 0) {
          start = array.length - Math.floor(-start);
        } else if (start) {
          start = Math.floor(start);
        }
        // array.splice does different things based on the number of arguments
        // you pass in. Therefore, array.splice(0) and array.splice(0, undefined)
        // do different things. In the former, the whole array is cleared. In the
        // latter, no items are removed.
        // This means that we need to detect whether 1. one of the arguments
        // is actually passed in and then 2. determine how many arguments
        // we should pass on to the native array.splice
        //
        let ret;
        // Omit any additional arguments if they were not passed in
        if (arguments.length === 2) {
          ret = array.splice(start);
        // Either start was undefined and the others were defined, but in this
        // case we can safely pass on all arguments
        //
        // Note: this includes the case where none of the arguments were passed in,
        // e.g. this.splice('array'). However, if both start and deleteCount
        // are undefined, array.splice will not modify the array (as expected)
        } else {
          ret = array.splice(start, deleteCount, ...items);
        }
        // At the end, check whether any items were passed in (e.g. insertions)
        // or if the return array contains items (e.g. deletions).
        // Only notify if items were added or deleted.
        if (items.length || ret.length) {
          notifySplice(this, array, info.path, start, items.length, ret);
        }
        return ret;
      }

      /**
       * Removes an item from the beginning of array at the path specified.
       *
       * The arguments after `path` and return value match that of
       * `Array.prototype.pop`.
       *
       * This method notifies other paths to the same array that a
       * splice occurred to the array.
       *
       * @param {string | !Array<string|number>} path Path to array.
       * @return {*} Item that was removed.
       * @public
       */
      shift(path) {
        let info = {path: ''};
        let array = /** @type {Array} */(Polymer.Path.get(this, path, info));
        let hadLength = Boolean(array.length);
        let ret = array.shift();
        if (hadLength) {
          notifySplice(this, array, info.path, 0, 0, [ret]);
        }
        return ret;
      }

      /**
       * Adds items onto the beginning of the array at the path specified.
       *
       * The arguments after `path` and return value match that of
       * `Array.prototype.push`.
       *
       * This method notifies other paths to the same array that a
       * splice occurred to the array.
       *
       * @param {string | !Array<string|number>} path Path to array.
       * @param {...*} items Items to insert info array
       * @return {number} New length of the array.
       * @public
       */
      unshift(path, ...items) {
        let info = {path: ''};
        let array = /** @type {Array} */(Polymer.Path.get(this, path, info));
        let ret = array.unshift(...items);
        if (items.length) {
          notifySplice(this, array, info.path, 0, items.length, []);
        }
        return ret;
      }

      /**
       * Notify that a path has changed.
       *
       * Example:
       *
       *     this.item.user.name = 'Bob';
       *     this.notifyPath('item.user.name');
       *
       * @param {string} path Path that should be notified.
       * @param {*=} value Value at the path (optional).
       * @return {void}
       * @public
      */
      notifyPath(path, value) {
        /** @type {string} */
        let propPath;
        if (arguments.length == 1) {
          // Get value if not supplied
          let info = {path: ''};
          value = Polymer.Path.get(this, path, info);
          propPath = info.path;
        } else if (Array.isArray(path)) {
          // Normalize path if needed
          propPath = Polymer.Path.normalize(path);
        } else {
          propPath = /** @type{string} */(path);
        }
        if (this._setPendingPropertyOrPath(propPath, value, true, true)) {
          this._invalidateProperties();
        }
      }

      /**
       * Equivalent to static `createReadOnlyProperty` API but can be called on
       * an instance to add effects at runtime.  See that method for
       * full API docs.
       *
       * @param {string} property Property name
       * @param {boolean=} protectedSetter Creates a custom protected setter
       *   when `true`.
       * @return {void}
       * @protected
       */
      _createReadOnlyProperty(property, protectedSetter) {
        this._addPropertyEffect(property, TYPES.READ_ONLY);
        if (protectedSetter) {
          this['_set' + upper(property)] = /** @this {PropertyEffects} */function(value) {
            this._setProperty(property, value);
          };
        }
      }

      /**
       * Equivalent to static `createPropertyObserver` API but can be called on
       * an instance to add effects at runtime.  See that method for
       * full API docs.
       *
       * @param {string} property Property name
       * @param {string|function(*,*)} method Function or name of observer method to call
       * @param {boolean=} dynamicFn Whether the method name should be included as
       *   a dependency to the effect.
       * @return {void}
       * @protected
       */
      _createPropertyObserver(property, method, dynamicFn) {
        let info = { property, method, dynamicFn: Boolean(dynamicFn) };
        this._addPropertyEffect(property, TYPES.OBSERVE, {
          fn: runObserverEffect, info, trigger: {name: property}
        });
        if (dynamicFn) {
          this._addPropertyEffect(/** @type {string} */(method), TYPES.OBSERVE, {
            fn: runObserverEffect, info, trigger: {name: method}
          });
        }
      }

      /**
       * Equivalent to static `createMethodObserver` API but can be called on
       * an instance to add effects at runtime.  See that method for
       * full API docs.
       *
       * @param {string} expression Method expression
       * @param {boolean|Object=} dynamicFn Boolean or object map indicating
       *   whether method names should be included as a dependency to the effect.
       * @return {void}
       * @protected
       */
      _createMethodObserver(expression, dynamicFn) {
        let sig = parseMethod(expression);
        if (!sig) {
          throw new Error("Malformed observer expression '" + expression + "'");
        }
        createMethodEffect(this, sig, TYPES.OBSERVE, runMethodEffect, null, dynamicFn);
      }

      /**
       * Equivalent to static `createNotifyingProperty` API but can be called on
       * an instance to add effects at runtime.  See that method for
       * full API docs.
       *
       * @param {string} property Property name
       * @return {void}
       * @protected
       */
      _createNotifyingProperty(property) {
        this._addPropertyEffect(property, TYPES.NOTIFY, {
          fn: runNotifyEffect,
          info: {
            eventName: CaseMap.camelToDashCase(property) + '-changed',
            property: property
          }
        });
      }

      /**
       * Equivalent to static `createReflectedProperty` API but can be called on
       * an instance to add effects at runtime.  See that method for
       * full API docs.
       *
       * @param {string} property Property name
       * @return {void}
       * @protected
       */
      _createReflectedProperty(property) {
        let attr = this.constructor.attributeNameForProperty(property);
        if (attr[0] === '-') {
          console.warn('Property ' + property + ' cannot be reflected to attribute ' +
            attr + ' because "-" is not a valid starting attribute name. Use a lowercase first letter for the property instead.');
        } else {
          this._addPropertyEffect(property, TYPES.REFLECT, {
            fn: runReflectEffect,
            info: {
              attrName: attr
            }
          });
        }
      }

      /**
       * Equivalent to static `createComputedProperty` API but can be called on
       * an instance to add effects at runtime.  See that method for
       * full API docs.
       *
       * @param {string} property Name of computed property to set
       * @param {string} expression Method expression
       * @param {boolean|Object=} dynamicFn Boolean or object map indicating
       *   whether method names should be included as a dependency to the effect.
       * @return {void}
       * @protected
       */
      _createComputedProperty(property, expression, dynamicFn) {
        let sig = parseMethod(expression);
        if (!sig) {
          throw new Error("Malformed computed expression '" + expression + "'");
        }
        createMethodEffect(this, sig, TYPES.COMPUTE, runComputedEffect, property, dynamicFn);
      }

      /**
       * Gather the argument values for a method specified in the provided array
       * of argument metadata.
       *
       * The `path` and `value` arguments are used to fill in wildcard descriptor
       * when the method is being called as a result of a path notification.
       *
       * @param {!Array<!MethodArg>} args Array of argument metadata
       * @param {string} path Property/path name that triggered the method effect
       * @param {Object} props Bag of current property changes
       * @return {Array<*>} Array of argument values
       * @private
       */
      _marshalArgs(args, path, props) {
        const data = this.__data;
        let values = [];
        for (let i=0, l=args.length; i<l; i++) {
          let arg = args[i];
          let name = arg.name;
          let v;
          if (arg.literal) {
            v = arg.value;
          } else {
            if (arg.structured) {
              v = Polymer.Path.get(data, name);
              // when data is not stored e.g. `splices`
              if (v === undefined) {
                v = props[name];
              }
            } else {
              v = data[name];
            }
          }
          if (arg.wildcard) {
            // Only send the actual path changed info if the change that
            // caused the observer to run matched the wildcard
            let baseChanged = (name.indexOf(path + '.') === 0);
            let matches = (path.indexOf(name) === 0 && !baseChanged);
            values[i] = {
              path: matches ? path : name,
              value: matches ? props[path] : v,
              base: v
            };
          } else {
            values[i] = v;
          }
        }
        return values;
      }

      // -- static class methods ------------

      /**
       * Ensures an accessor exists for the specified property, and adds
       * to a list of "property effects" that will run when the accessor for
       * the specified property is set.  Effects are grouped by "type", which
       * roughly corresponds to a phase in effect processing.  The effect
       * metadata should be in the following form:
       *
       *     {
       *       fn: effectFunction, // Reference to function to call to perform effect
       *       info: { ... }       // Effect metadata passed to function
       *       trigger: {          // Optional triggering metadata; if not provided
       *         name: string      // the property is treated as a wildcard
       *         structured: boolean
       *         wildcard: boolean
       *       }
       *     }
       *
       * Effects are called from `_propertiesChanged` in the following order by
       * type:
       *
       * 1. COMPUTE
       * 2. PROPAGATE
       * 3. REFLECT
       * 4. OBSERVE
       * 5. NOTIFY
       *
       * Effect functions are called with the following signature:
       *
       *     effectFunction(inst, path, props, oldProps, info, hasPaths)
       *
       * @param {string} property Property that should trigger the effect
       * @param {string} type Effect type, from this.PROPERTY_EFFECT_TYPES
       * @param {Object=} effect Effect metadata object
       * @return {void}
       * @protected
       */
      static addPropertyEffect(property, type, effect) {
        this.prototype._addPropertyEffect(property, type, effect);
      }

      /**
       * Creates a single-property observer for the given property.
       *
       * @param {string} property Property name
       * @param {string|function(*,*)} method Function or name of observer method to call
       * @param {boolean=} dynamicFn Whether the method name should be included as
       *   a dependency to the effect.
       * @return {void}
       * @protected
       */
      static createPropertyObserver(property, method, dynamicFn) {
        this.prototype._createPropertyObserver(property, method, dynamicFn);
      }

      /**
       * Creates a multi-property "method observer" based on the provided
       * expression, which should be a string in the form of a normal JavaScript
       * function signature: `'methodName(arg1, [..., argn])'`.  Each argument
       * should correspond to a property or path in the context of this
       * prototype (or instance), or may be a literal string or number.
       *
       * @param {string} expression Method expression
       * @param {boolean|Object=} dynamicFn Boolean or object map indicating
       * @return {void}
       *   whether method names should be included as a dependency to the effect.
       * @protected
       */
      static createMethodObserver(expression, dynamicFn) {
        this.prototype._createMethodObserver(expression, dynamicFn);
      }

      /**
       * Causes the setter for the given property to dispatch `<property>-changed`
       * events to notify of changes to the property.
       *
       * @param {string} property Property name
       * @return {void}
       * @protected
       */
      static createNotifyingProperty(property) {
        this.prototype._createNotifyingProperty(property);
      }

      /**
       * Creates a read-only accessor for the given property.
       *
       * To set the property, use the protected `_setProperty` API.
       * To create a custom protected setter (e.g. `_setMyProp()` for
       * property `myProp`), pass `true` for `protectedSetter`.
       *
       * Note, if the property will have other property effects, this method
       * should be called first, before adding other effects.
       *
       * @param {string} property Property name
       * @param {boolean=} protectedSetter Creates a custom protected setter
       *   when `true`.
       * @return {void}
       * @protected
       */
      static createReadOnlyProperty(property, protectedSetter) {
        this.prototype._createReadOnlyProperty(property, protectedSetter);
      }

      /**
       * Causes the setter for the given property to reflect the property value
       * to a (dash-cased) attribute of the same name.
       *
       * @param {string} property Property name
       * @return {void}
       * @protected
       */
      static createReflectedProperty(property) {
        this.prototype._createReflectedProperty(property);
      }

      /**
       * Creates a computed property whose value is set to the result of the
       * method described by the given `expression` each time one or more
       * arguments to the method changes.  The expression should be a string
       * in the form of a normal JavaScript function signature:
       * `'methodName(arg1, [..., argn])'`
       *
       * @param {string} property Name of computed property to set
       * @param {string} expression Method expression
       * @param {boolean|Object=} dynamicFn Boolean or object map indicating whether
       *   method names should be included as a dependency to the effect.
       * @return {void}
       * @protected
       */
      static createComputedProperty(property, expression, dynamicFn) {
        this.prototype._createComputedProperty(property, expression, dynamicFn);
      }

      /**
       * Parses the provided template to ensure binding effects are created
       * for them, and then ensures property accessors are created for any
       * dependent properties in the template.  Binding effects for bound
       * templates are stored in a linked list on the instance so that
       * templates can be efficiently stamped and unstamped.
       *
       * @param {!HTMLTemplateElement} template Template containing binding
       *   bindings
       * @return {!TemplateInfo} Template metadata object
       * @protected
       */
      static bindTemplate(template) {
        return this.prototype._bindTemplate(template);
      }

      // -- binding ----------------------------------------------

      /**
       * Equivalent to static `bindTemplate` API but can be called on
       * an instance to add effects at runtime.  See that method for
       * full API docs.
       *
       * This method may be called on the prototype (for prototypical template
       * binding, to avoid creating accessors every instance) once per prototype,
       * and will be called with `runtimeBinding: true` by `_stampTemplate` to
       * create and link an instance of the template metadata associated with a
       * particular stamping.
       *
       * @param {!HTMLTemplateElement} template Template containing binding
       *   bindings
       * @param {boolean=} instanceBinding When false (default), performs
       *   "prototypical" binding of the template and overwrites any previously
       *   bound template for the class. When true (as passed from
       *   `_stampTemplate`), the template info is instanced and linked into
       *   the list of bound templates.
       * @return {!TemplateInfo} Template metadata object; for `runtimeBinding`,
       *   this is an instance of the prototypical template info
       * @protected
       */
      _bindTemplate(template, instanceBinding) {
        let templateInfo = this.constructor._parseTemplate(template);
        let wasPreBound = this.__templateInfo == templateInfo;
        // Optimization: since this is called twice for proto-bound templates,
        // don't attempt to recreate accessors if this template was pre-bound
        if (!wasPreBound) {
          for (let prop in templateInfo.propertyEffects) {
            this._createPropertyAccessor(prop);
          }
        }
        if (instanceBinding) {
          // For instance-time binding, create instance of template metadata
          // and link into list of templates if necessary
          templateInfo = /** @type {!TemplateInfo} */(Object.create(templateInfo));
          templateInfo.wasPreBound = wasPreBound;
          if (!wasPreBound && this.__templateInfo) {
            let last = this.__templateInfoLast || this.__templateInfo;
            this.__templateInfoLast = last.nextTemplateInfo = templateInfo;
            templateInfo.previousTemplateInfo = last;
            return templateInfo;
          }
        }
        return this.__templateInfo = templateInfo;
      }

      /**
       * Adds a property effect to the given template metadata, which is run
       * at the "propagate" stage of `_propertiesChanged` when the template
       * has been bound to the element via `_bindTemplate`.
       *
       * The `effect` object should match the format in `_addPropertyEffect`.
       *
       * @param {Object} templateInfo Template metadata to add effect to
       * @param {string} prop Property that should trigger the effect
       * @param {Object=} effect Effect metadata object
       * @return {void}
       * @protected
       */
      static _addTemplatePropertyEffect(templateInfo, prop, effect) {
        let hostProps = templateInfo.hostProps = templateInfo.hostProps || {};
        hostProps[prop] = true;
        let effects = templateInfo.propertyEffects = templateInfo.propertyEffects || {};
        let propEffects = effects[prop] = effects[prop] || [];
        propEffects.push(effect);
      }

      /**
       * Stamps the provided template and performs instance-time setup for
       * Polymer template features, including data bindings, declarative event
       * listeners, and the `this.$` map of `id`'s to nodes.  A document fragment
       * is returned containing the stamped DOM, ready for insertion into the
       * DOM.
       *
       * This method may be called more than once; however note that due to
       * `shadycss` polyfill limitations, only styles from templates prepared
       * using `ShadyCSS.prepareTemplate` will be correctly polyfilled (scoped
       * to the shadow root and support CSS custom properties), and note that
       * `ShadyCSS.prepareTemplate` may only be called once per element. As such,
       * any styles required by in runtime-stamped templates must be included
       * in the main element template.
       *
       * @param {!HTMLTemplateElement} template Template to stamp
       * @return {!StampedTemplate} Cloned template content
       * @override
       * @protected
       */
      _stampTemplate(template) {
        // Ensures that created dom is `_enqueueClient`'d to this element so
        // that it can be flushed on next call to `_flushProperties`
        hostStack.beginHosting(this);
        let dom = super._stampTemplate(template);
        hostStack.endHosting(this);
        let templateInfo = /** @type {!TemplateInfo} */(this._bindTemplate(template, true));
        // Add template-instance-specific data to instanced templateInfo
        templateInfo.nodeList = dom.nodeList;
        // Capture child nodes to allow unstamping of non-prototypical templates
        if (!templateInfo.wasPreBound) {
          let nodes = templateInfo.childNodes = [];
          for (let n=dom.firstChild; n; n=n.nextSibling) {
            nodes.push(n);
          }
        }
        dom.templateInfo = templateInfo;
        // Setup compound storage, 2-way listeners, and dataHost for bindings
        setupBindings(this, templateInfo);
        // Flush properties into template nodes if already booted
        if (this.__dataReady) {
          runEffects(this, templateInfo.propertyEffects, this.__data, null,
            false, templateInfo.nodeList);
        }
        return dom;
      }

      /**
       * Removes and unbinds the nodes previously contained in the provided
       * DocumentFragment returned from `_stampTemplate`.
       *
       * @param {!StampedTemplate} dom DocumentFragment previously returned
       *   from `_stampTemplate` associated with the nodes to be removed
       * @return {void}
       * @protected
       */
      _removeBoundDom(dom) {
        // Unlink template info
        let templateInfo = dom.templateInfo;
        if (templateInfo.previousTemplateInfo) {
          templateInfo.previousTemplateInfo.nextTemplateInfo =
            templateInfo.nextTemplateInfo;
        }
        if (templateInfo.nextTemplateInfo) {
          templateInfo.nextTemplateInfo.previousTemplateInfo =
            templateInfo.previousTemplateInfo;
        }
        if (this.__templateInfoLast == templateInfo) {
          this.__templateInfoLast = templateInfo.previousTemplateInfo;
        }
        templateInfo.previousTemplateInfo = templateInfo.nextTemplateInfo = null;
        // Remove stamped nodes
        let nodes = templateInfo.childNodes;
        for (let i=0; i<nodes.length; i++) {
          let node = nodes[i];
          node.parentNode.removeChild(node);
        }
      }

      /**
       * Overrides default `TemplateStamp` implementation to add support for
       * parsing bindings from `TextNode`'s' `textContent`.  A `bindings`
       * array is added to `nodeInfo` and populated with binding metadata
       * with information capturing the binding target, and a `parts` array
       * with one or more metadata objects capturing the source(s) of the
       * binding.
       *
       * @override
       * @param {Node} node Node to parse
       * @param {TemplateInfo} templateInfo Template metadata for current template
       * @param {NodeInfo} nodeInfo Node metadata for current template node
       * @return {boolean} `true` if the visited node added node-specific
       *   metadata to `nodeInfo`
       * @protected
       * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do
       */
      static _parseTemplateNode(node, templateInfo, nodeInfo) {
        let noted = super._parseTemplateNode(node, templateInfo, nodeInfo);
        if (node.nodeType === Node.TEXT_NODE) {
          let parts = this._parseBindings(node.textContent, templateInfo);
          if (parts) {
            // Initialize the textContent with any literal parts
            // NOTE: default to a space here so the textNode remains; some browsers
            // (IE) omit an empty textNode following cloneNode/importNode.
            node.textContent = literalFromParts(parts) || ' ';
            addBinding(this, templateInfo, nodeInfo, 'text', 'textContent', parts);
            noted = true;
          }
        }
        return noted;
      }

      /**
       * Overrides default `TemplateStamp` implementation to add support for
       * parsing bindings from attributes.  A `bindings`
       * array is added to `nodeInfo` and populated with binding metadata
       * with information capturing the binding target, and a `parts` array
       * with one or more metadata objects capturing the source(s) of the
       * binding.
       *
       * @override
       * @param {Element} node Node to parse
       * @param {TemplateInfo} templateInfo Template metadata for current template
       * @param {NodeInfo} nodeInfo Node metadata for current template node
       * @param {string} name Attribute name
       * @param {string} value Attribute value
       * @return {boolean} `true` if the visited node added node-specific
       *   metadata to `nodeInfo`
       * @protected
       * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do
       */
      static _parseTemplateNodeAttribute(node, templateInfo, nodeInfo, name, value) {
        let parts = this._parseBindings(value, templateInfo);
        if (parts) {
          // Attribute or property
          let origName = name;
          let kind = 'property';
          // The only way we see a capital letter here is if the attr has
          // a capital letter in it per spec. In this case, to make sure
          // this binding works, we go ahead and make the binding to the attribute.
          if (capitalAttributeRegex.test(name)) {
            kind = 'attribute';
          } else if (name[name.length-1] == '$') {
            name = name.slice(0, -1);
            kind = 'attribute';
          }
          // Initialize attribute bindings with any literal parts
          let literal = literalFromParts(parts);
          if (literal && kind == 'attribute') {
            // Ensure a ShadyCSS template scoped style is not removed
            // when a class$ binding's initial literal value is set.
            if (name == 'class' && node.hasAttribute('class')) {
              literal += ' ' + node.getAttribute(name);
            }
            node.setAttribute(name, literal);
          }
          // Clear attribute before removing, since IE won't allow removing
          // `value` attribute if it previously had a value (can't
          // unconditionally set '' before removing since attributes with `$`
          // can't be set using setAttribute)
          if (node.localName === 'input' && origName === 'value') {
            node.setAttribute(origName, '');
          }
          // Remove annotation
          node.removeAttribute(origName);
          // Case hackery: attributes are lower-case, but bind targets
          // (properties) are case sensitive. Gambit is to map dash-case to
          // camel-case: `foo-bar` becomes `fooBar`.
          // Attribute bindings are excepted.
          if (kind === 'property') {
            name = Polymer.CaseMap.dashToCamelCase(name);
          }
          addBinding(this, templateInfo, nodeInfo, kind, name, parts, literal);
          return true;
        } else {
          return super._parseTemplateNodeAttribute(node, templateInfo, nodeInfo, name, value);
        }
      }

      /**
       * Overrides default `TemplateStamp` implementation to add support for
       * binding the properties that a nested template depends on to the template
       * as `_host_<property>`.
       *
       * @override
       * @param {Node} node Node to parse
       * @param {TemplateInfo} templateInfo Template metadata for current template
       * @param {NodeInfo} nodeInfo Node metadata for current template node
       * @return {boolean} `true` if the visited node added node-specific
       *   metadata to `nodeInfo`
       * @protected
       * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do
       */
      static _parseTemplateNestedTemplate(node, templateInfo, nodeInfo) {
        let noted = super._parseTemplateNestedTemplate(node, templateInfo, nodeInfo);
        // Merge host props into outer template and add bindings
        let hostProps = nodeInfo.templateInfo.hostProps;
        let mode = '{';
        for (let source in hostProps) {
          let parts = [{ mode, source, dependencies: [source] }];
          addBinding(this, templateInfo, nodeInfo, 'property', '_host_' + source, parts);
        }
        return noted;
      }

      /**
       * Called to parse text in a template (either attribute values or
       * textContent) into binding metadata.
       *
       * Any overrides of this method should return an array of binding part
       * metadata  representing one or more bindings found in the provided text
       * and any "literal" text in between.  Any non-literal parts will be passed
       * to `_evaluateBinding` when any dependencies change.  The only required
       * fields of each "part" in the returned array are as follows:
       *
       * - `dependencies` - Array containing trigger metadata for each property
       *   that should trigger the binding to update
       * - `literal` - String containing text if the part represents a literal;
       *   in this case no `dependencies` are needed
       *
       * Additional metadata for use by `_evaluateBinding` may be provided in
       * each part object as needed.
       *
       * The default implementation handles the following types of bindings
       * (one or more may be intermixed with literal strings):
       * - Property binding: `[[prop]]`
       * - Path binding: `[[object.prop]]`
       * - Negated property or path bindings: `[[!prop]]` or `[[!object.prop]]`
       * - Two-way property or path bindings (supports negation):
       *   `{{prop}}`, `{{object.prop}}`, `{{!prop}}` or `{{!object.prop}}`
       * - Inline computed method (supports negation):
       *   `[[compute(a, 'literal', b)]]`, `[[!compute(a, 'literal', b)]]`
       *
       * The default implementation uses a regular expression for best
       * performance. However, the regular expression uses a white-list of
       * allowed characters in a data-binding, which causes problems for
       * data-bindings that do use characters not in this white-list.
       *
       * Instead of updating the white-list with all allowed characters,
       * there is a StrictBindingParser (see lib/mixins/strict-binding-parser)
       * that uses a state machine instead. This state machine is able to handle
       * all characters. However, it is slightly less performant, therefore we
       * extracted it into a separate optional mixin.
       *
       * @param {string} text Text to parse from attribute or textContent
       * @param {Object} templateInfo Current template metadata
       * @return {Array<!BindingPart>} Array of binding part metadata
       * @protected
       */
      static _parseBindings(text, templateInfo) {
        let parts = [];
        let lastIndex = 0;
        let m;
        // Example: "literal1{{prop}}literal2[[!compute(foo,bar)]]final"
        // Regex matches:
        //        Iteration 1:  Iteration 2:
        // m[1]: '{{'          '[['
        // m[2]: ''            '!'
        // m[3]: 'prop'        'compute(foo,bar)'
        while ((m = bindingRegex.exec(text)) !== null) {
          // Add literal part
          if (m.index > lastIndex) {
            parts.push({literal: text.slice(lastIndex, m.index)});
          }
          // Add binding part
          let mode = m[1][0];
          let negate = Boolean(m[2]);
          let source = m[3].trim();
          let customEvent = false, notifyEvent = '', colon = -1;
          if (mode == '{' && (colon = source.indexOf('::')) > 0) {
            notifyEvent = source.substring(colon + 2);
            source = source.substring(0, colon);
            customEvent = true;
          }
          let signature = parseMethod(source);
          let dependencies = [];
          if (signature) {
            // Inline computed function
            let {args, methodName} = signature;
            for (let i=0; i<args.length; i++) {
              let arg = args[i];
              if (!arg.literal) {
                dependencies.push(arg);
              }
            }
            let dynamicFns = templateInfo.dynamicFns;
            if (dynamicFns && dynamicFns[methodName] || signature.static) {
              dependencies.push(methodName);
              signature.dynamicFn = true;
            }
          } else {
            // Property or path
            dependencies.push(source);
          }
          parts.push({
            source, mode, negate, customEvent, signature, dependencies,
            event: notifyEvent
          });
          lastIndex = bindingRegex.lastIndex;
        }
        // Add a final literal part
        if (lastIndex && lastIndex < text.length) {
          let literal = text.substring(lastIndex);
          if (literal) {
            parts.push({
              literal: literal
            });
          }
        }
        if (parts.length) {
          return parts;
        } else {
          return null;
        }
      }

      /**
       * Called to evaluate a previously parsed binding part based on a set of
       * one or more changed dependencies.
       *
       * @param {this} inst Element that should be used as scope for
       *   binding dependencies
       * @param {BindingPart} part Binding part metadata
       * @param {string} path Property/path that triggered this effect
       * @param {Object} props Bag of current property changes
       * @param {Object} oldProps Bag of previous values for changed properties
       * @param {boolean} hasPaths True with `props` contains one or more paths
       * @return {*} Value the binding part evaluated to
       * @protected
       */
      static _evaluateBinding(inst, part, path, props, oldProps, hasPaths) {
        let value;
        if (part.signature) {
          value = runMethodEffect(inst, path, props, oldProps, part.signature);
        } else if (path != part.source) {
          value = Polymer.Path.get(inst, part.source);
        } else {
          if (hasPaths && Polymer.Path.isPath(path)) {
            value = Polymer.Path.get(inst, path);
          } else {
            value = inst.__data[path];
          }
        }
        if (part.negate) {
          value = !value;
        }
        return value;
      }

    }

    // make a typing for closure :P
    PropertyEffectsType = PropertyEffects;

    return PropertyEffects;
  });

  /**
   * Helper api for enqueuing client dom created by a host element.
   *
   * By default elements are flushed via `_flushProperties` when
   * `connectedCallback` is called. Elements attach their client dom to
   * themselves at `ready` time which results from this first flush.
   * This provides an ordering guarantee that the client dom an element
   * creates is flushed before the element itself (i.e. client `ready`
   * fires before host `ready`).
   *
   * However, if `_flushProperties` is called *before* an element is connected,
   * as for example `Templatize` does, this ordering guarantee cannot be
   * satisfied because no elements are connected. (Note: Bound elements that
   * receive data do become enqueued clients and are properly ordered but
   * unbound elements are not.)
   *
   * To maintain the desired "client before host" ordering guarantee for this
   * case we rely on the "host stack. Client nodes registers themselves with
   * the creating host element when created. This ensures that all client dom
   * is readied in the proper order, maintaining the desired guarantee.
   *
   * @private
   */
  let hostStack = {

    stack: [],

    /**
     * @param {*} inst Instance to add to hostStack
     * @return {void}
     * @this {hostStack}
     */
    registerHost(inst) {
      if (this.stack.length) {
        let host = this.stack[this.stack.length-1];
        host._enqueueClient(inst);
      }
    },

    /**
     * @param {*} inst Instance to begin hosting
     * @return {void}
     * @this {hostStack}
     */
    beginHosting(inst) {
      this.stack.push(inst);
    },

    /**
     * @param {*} inst Instance to end hosting
     * @return {void}
     * @this {hostStack}
     */
    endHosting(inst) {
      let stackLen = this.stack.length;
      if (stackLen && this.stack[stackLen-1] == inst) {
        this.stack.pop();
      }
    }

  };

})();


(function() {
  'use strict';

  /**
   * Provides basic tracking of element definitions (registrations) and
   * instance counts.
   *
   * @namespace
   * @summary Provides basic tracking of element definitions (registrations) and
   * instance counts.
   */
  Polymer.telemetry = {
    /**
     * Total number of Polymer element instances created.
     * @type {number}
     */
    instanceCount: 0,
    /**
     * Array of Polymer element classes that have been finalized.
     * @type {Array<Polymer.Element>}
     */
    registrations: [],
    /**
     * @param {!PolymerElementConstructor} prototype Element prototype to log
     * @this {this}
     * @private
     */
    _regLog: function(prototype) {
      console.log('[' + prototype.is + ']: registered');
    },
    /**
     * Registers a class prototype for telemetry purposes.
     * @param {HTMLElement} prototype Element prototype to register
     * @this {this}
     * @protected
     */
    register: function(prototype) {
      this.registrations.push(prototype);
      Polymer.log && this._regLog(prototype);
    },
    /**
     * Logs all elements registered with an `is` to the console.
     * @public
     * @this {this}
     */
    dumpRegistrations: function() {
      this.registrations.forEach(this._regLog);
    }
  };

})();


(function() {
  'use strict';

  /**
   * Creates a copy of `props` with each property normalized such that
   * upgraded it is an object with at least a type property { type: Type}.
   *
   * @param {Object} props Properties to normalize
   * @return {Object} Copy of input `props` with normalized properties that
   * are in the form {type: Type}
   * @private
   */
  function normalizeProperties(props) {
    const output = {};
    for (let p in props) {
      const o = props[p];
      output[p] = (typeof o === 'function') ? {type: o} : o;
    }
    return output;
  }

  /**
   * Mixin that provides a minimal starting point to using the PropertiesChanged
   * mixin by providing a mechanism to declare properties in a static
   * getter (e.g. static get properties() { return { foo: String } }). Changes
   * are reported via the `_propertiesChanged` method.
   *
   * This mixin provides no specific support for rendering. Users are expected
   * to create a ShadowRoot and put content into it and update it in whatever
   * way makes sense. This can be done in reaction to properties changing by
   * implementing `_propertiesChanged`.
   *
   * @mixinFunction
   * @polymer
   * @appliesMixin Polymer.PropertiesChanged
   * @memberof Polymer
   * @summary Mixin that provides a minimal starting point for using
   * the PropertiesChanged mixin by providing a declarative `properties` object.
   */
   Polymer.PropertiesMixin = Polymer.dedupingMixin(superClass => {

    /**
     * @constructor
     * @extends {superClass}
     * @implements {Polymer_PropertiesChanged}
     * @private
     */
    const base = Polymer.PropertiesChanged(superClass);

    /**
     * Returns the super class constructor for the given class, if it is an
     * instance of the PropertiesMixin.
     *
     * @param {!PropertiesMixinConstructor} constructor PropertiesMixin constructor
     * @return {PropertiesMixinConstructor} Super class constructor
     */
    function superPropertiesClass(constructor) {
      const superCtor = Object.getPrototypeOf(constructor);

      // Note, the `PropertiesMixin` class below only refers to the class
      // generated by this call to the mixin; the instanceof test only works
      // because the mixin is deduped and guaranteed only to apply once, hence
      // all constructors in a proto chain will see the same `PropertiesMixin`
      return (superCtor.prototype instanceof PropertiesMixin) ?
        /** @type {PropertiesMixinConstructor} */ (superCtor) : null;
    }

    /**
     * Returns a memoized version of the `properties` object for the
     * given class. Properties not in object format are converted to at
     * least {type}.
     *
     * @param {PropertiesMixinConstructor} constructor PropertiesMixin constructor
     * @return {Object} Memoized properties object
     */
    function ownProperties(constructor) {
      if (!constructor.hasOwnProperty(JSCompiler_renameProperty('__ownProperties', constructor))) {
        let props = null;

        if (constructor.hasOwnProperty(JSCompiler_renameProperty('properties', constructor))) {
          const properties = constructor.properties;
          
          if (properties) {
            props = normalizeProperties(properties);
          }
        }

        constructor.__ownProperties = props;
      }
      return constructor.__ownProperties;
    }

    /**
     * @polymer
     * @mixinClass
     * @extends {base}
     * @implements {Polymer_PropertiesMixin}
     * @unrestricted
     */
    class PropertiesMixin extends base {

      /**
       * Implements standard custom elements getter to observes the attributes
       * listed in `properties`.
       * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do
       */
      static get observedAttributes() {
        if (!this.hasOwnProperty('__observedAttributes')) {
          Polymer.telemetry.register(this.prototype);
          const props = this._properties;
          this.__observedAttributes = props ? Object.keys(props).map(p => this.attributeNameForProperty(p)) : [];
        }
        return this.__observedAttributes;
      }

      /**
       * Finalizes an element definition, including ensuring any super classes
       * are also finalized. This includes ensuring property
       * accessors exist on the element prototype. This method calls
       * `_finalizeClass` to finalize each constructor in the prototype chain.
       * @return {void}
       */
      static finalize() {
        if (!this.hasOwnProperty(JSCompiler_renameProperty('__finalized', this))) {
          const superCtor = superPropertiesClass(/** @type {PropertiesMixinConstructor} */(this));
          if (superCtor) {
            superCtor.finalize();
          }
          this.__finalized = true;
          this._finalizeClass();
        }
      }

      /**
       * Finalize an element class. This includes ensuring property
       * accessors exist on the element prototype. This method is called by
       * `finalize` and finalizes the class constructor.
       *
       * @protected
       */
      static _finalizeClass() {
        const props = ownProperties(/** @type {PropertiesMixinConstructor} */(this));
        if (props) {
          this.createProperties(props);
        }
      }

      /**
       * Returns a memoized version of all properties, including those inherited
       * from super classes. Properties not in object format are converted to
       * at least {type}.
       *
       * @return {Object} Object containing properties for this class
       * @protected
       */
      static get _properties() {
        if (!this.hasOwnProperty(
          JSCompiler_renameProperty('__properties', this))) {
          const superCtor = superPropertiesClass(/** @type {PropertiesMixinConstructor} */(this));
          this.__properties = Object.assign({},
            superCtor && superCtor._properties,
            ownProperties(/** @type {PropertiesMixinConstructor} */(this)));
        }
        return this.__properties;
      }

      /**
       * Overrides `PropertiesChanged` method to return type specified in the
       * static `properties` object for the given property.
       * @param {string} name Name of property
       * @return {*} Type to which to deserialize attribute
       *
       * @protected
       */
      static typeForProperty(name) {
        const info = this._properties[name];
        return info && info.type;
      }

      /**
       * Overrides `PropertiesChanged` method and adds a call to
       * `finalize` which lazily configures the element's property accessors.
       * @override
       * @return {void}
       */
      _initializeProperties() {
        Polymer.telemetry.instanceCount++;
        this.constructor.finalize();
        super._initializeProperties();
      }

      /**
       * Called when the element is added to a document.
       * Calls `_enableProperties` to turn on property system from
       * `PropertiesChanged`.
       * @suppress {missingProperties} Super may or may not implement the callback
       * @return {void}
       */
      connectedCallback() {
        if (super.connectedCallback) {
          super.connectedCallback();
        }
        this._enableProperties();
      }

      /**
       * Called when the element is removed from a document
       * @suppress {missingProperties} Super may or may not implement the callback
       * @return {void}
       */
      disconnectedCallback() {
        if (super.disconnectedCallback) {
          super.disconnectedCallback();
        }
      }

    }

    return PropertiesMixin;

  });

})();



(function() {
  'use strict';

  const builtCSS = window.ShadyCSS && window.ShadyCSS['cssBuild'];

  /**
   * Element class mixin that provides the core API for Polymer's meta-programming
   * features including template stamping, data-binding, attribute deserialization,
   * and property change observation.
   *
   * Subclassers may provide the following static getters to return metadata
   * used to configure Polymer's features for the class:
   *
   * - `static get is()`: When the template is provided via a `dom-module`,
   *   users should return the `dom-module` id from a static `is` getter.  If
   *   no template is needed or the template is provided directly via the
   *   `template` getter, there is no need to define `is` for the element.
   *
   * - `static get template()`: Users may provide the template directly (as
   *   opposed to via `dom-module`) by implementing a static `template` getter.
   *   The getter may return an `HTMLTemplateElement` or a string, which will
   *   automatically be parsed into a template.
   *
   * - `static get properties()`: Should return an object describing
   *   property-related metadata used by Polymer features (key: property name
   *   value: object containing property metadata). Valid keys in per-property
   *   metadata include:
   *   - `type` (String|Number|Object|Array|...): Used by
   *     `attributeChangedCallback` to determine how string-based attributes
   *     are deserialized to JavaScript property values.
   *   - `notify` (boolean): Causes a change in the property to fire a
   *     non-bubbling event called `<property>-changed`. Elements that have
   *     enabled two-way binding to the property use this event to observe changes.
   *   - `readOnly` (boolean): Creates a getter for the property, but no setter.
   *     To set a read-only property, use the private setter method
   *     `_setProperty(property, value)`.
   *   - `observer` (string): Observer method name that will be called when
   *     the property changes. The arguments of the method are
   *     `(value, previousValue)`.
   *   - `computed` (string): String describing method and dependent properties
   *     for computing the value of this property (e.g. `'computeFoo(bar, zot)'`).
   *     Computed properties are read-only by default and can only be changed
   *     via the return value of the computing method.
   *
   * - `static get observers()`: Array of strings describing multi-property
   *   observer methods and their dependent properties (e.g.
   *   `'observeABC(a, b, c)'`).
   *
   * The base class provides default implementations for the following standard
   * custom element lifecycle callbacks; users may override these, but should
   * call the super method to ensure
   * - `constructor`: Run when the element is created or upgraded
   * - `connectedCallback`: Run each time the element is connected to the
   *   document
   * - `disconnectedCallback`: Run each time the element is disconnected from
   *   the document
   * - `attributeChangedCallback`: Run each time an attribute in
   *   `observedAttributes` is set or removed (note: this element's default
   *   `observedAttributes` implementation will automatically return an array
   *   of dash-cased attributes based on `properties`)
   *
   * @mixinFunction
   * @polymer
   * @appliesMixin Polymer.PropertyEffects
   * @appliesMixin Polymer.PropertiesMixin
   * @memberof Polymer
   * @property rootPath {string} Set to the value of `Polymer.rootPath`,
   *   which defaults to the main document path
   * @property importPath {string} Set to the value of the class's static
   *   `importPath` property, which defaults to the path of this element's
   *   `dom-module` (when `is` is used), but can be overridden for other
   *   import strategies.
   * @summary Element class mixin that provides the core API for Polymer's
   * meta-programming features.
   */
  Polymer.ElementMixin = Polymer.dedupingMixin(base => {

    /**
     * @constructor
     * @extends {base}
     * @implements {Polymer_PropertyEffects}
     * @implements {Polymer_PropertiesMixin}
     * @private
     */
    const polymerElementBase = Polymer.PropertiesMixin(Polymer.PropertyEffects(base));

    /**
     * Returns a list of properties with default values.
     * This list is created as an optimization since it is a subset of
     * the list returned from `_properties`.
     * This list is used in `_initializeProperties` to set property defaults.
     *
     * @param {PolymerElementConstructor} constructor Element class
     * @return {PolymerElementProperties} Flattened properties for this class
     *   that have default values
     * @private
     */
    function propertyDefaults(constructor) {
      if (!constructor.hasOwnProperty(
        JSCompiler_renameProperty('__propertyDefaults', constructor))) {
        constructor.__propertyDefaults = null;
        let props = constructor._properties;
        for (let p in props) {
          let info = props[p];
          if ('value' in info) {
            constructor.__propertyDefaults = constructor.__propertyDefaults || {};
            constructor.__propertyDefaults[p] = info;
          }
        }
      }
      return constructor.__propertyDefaults;
    }

    /**
     * Returns a memoized version of the `observers` array.
     * @param {PolymerElementConstructor} constructor Element class
     * @return {Array} Array containing own observers for the given class
     * @protected
     */
    function ownObservers(constructor) {
      if (!constructor.hasOwnProperty(
        JSCompiler_renameProperty('__ownObservers', constructor))) {
          constructor.__ownObservers =
          constructor.hasOwnProperty(JSCompiler_renameProperty('observers', constructor)) ?
          /** @type {PolymerElementConstructor} */ (constructor).observers : null;
      }
      return constructor.__ownObservers;
    }

    /**
     * Creates effects for a property.
     *
     * Note, once a property has been set to
     * `readOnly`, `computed`, `reflectToAttribute`, or `notify`
     * these values may not be changed. For example, a subclass cannot
     * alter these settings. However, additional `observers` may be added
     * by subclasses.
     *
     * The info object should contain property metadata as follows:
     *
     * * `type`: {function} type to which an attribute matching the property
     * is deserialized. Note the property is camel-cased from a dash-cased
     * attribute. For example, 'foo-bar' attribute is deserialized to a
     * property named 'fooBar'.
     *
     * * `readOnly`: {boolean} creates a readOnly property and
     * makes a private setter for the private of the form '_setFoo' for a
     * property 'foo',
     *
     * * `computed`: {string} creates a computed property. A computed property
     * is also automatically set to `readOnly: true`. The value is calculated
     * by running a method and arguments parsed from the given string. For
     * example 'compute(foo)' will compute a given property when the
     * 'foo' property changes by executing the 'compute' method. This method
     * must return the computed value.
     *
     * * `reflectToAttribute`: {boolean} If true, the property value is reflected
     * to an attribute of the same name. Note, the attribute is dash-cased
     * so a property named 'fooBar' is reflected as 'foo-bar'.
     *
     * * `notify`: {boolean} sends a non-bubbling notification event when
     * the property changes. For example, a property named 'foo' sends an
     * event named 'foo-changed' with `event.detail` set to the value of
     * the property.
     *
     * * observer: {string} name of a method that runs when the property
     * changes. The arguments of the method are (value, previousValue).
     *
     * Note: Users may want control over modifying property
     * effects via subclassing. For example, a user might want to make a
     * reflectToAttribute property not do so in a subclass. We've chosen to
     * disable this because it leads to additional complication.
     * For example, a readOnly effect generates a special setter. If a subclass
     * disables the effect, the setter would fail unexpectedly.
     * Based on feedback, we may want to try to make effects more malleable
     * and/or provide an advanced api for manipulating them.
     * Also consider adding warnings when an effect cannot be changed.
     *
     * @param {!PolymerElement} proto Element class prototype to add accessors
     *   and effects to
     * @param {string} name Name of the property.
     * @param {Object} info Info object from which to create property effects.
     * Supported keys:
     * @param {Object} allProps Flattened map of all properties defined in this
     *   element (including inherited properties)
     * @return {void}
     * @private
     */
    function createPropertyFromConfig(proto, name, info, allProps) {
      // computed forces readOnly...
      if (info.computed) {
        info.readOnly = true;
      }
      // Note, since all computed properties are readOnly, this prevents
      // adding additional computed property effects (which leads to a confusing
      // setup where multiple triggers for setting a property)
      // While we do have `hasComputedEffect` this is set on the property's
      // dependencies rather than itself.
      if (info.computed && !proto._hasReadOnlyEffect(name)) {
        proto._createComputedProperty(name, info.computed, allProps);
      }
      if (info.readOnly && !proto._hasReadOnlyEffect(name)) {
        proto._createReadOnlyProperty(name, !info.computed);
      }
      if (info.reflectToAttribute && !proto._hasReflectEffect(name)) {
        proto._createReflectedProperty(name);
      }
      if (info.notify && !proto._hasNotifyEffect(name)) {
        proto._createNotifyingProperty(name);
      }
      // always add observer
      if (info.observer) {
        proto._createPropertyObserver(name, info.observer, allProps[info.observer]);
      }
      // always create the mapping from attribute back to property for deserialization.
      proto._addPropertyToAttributeMap(name);
    }

    /**
     * Process all style elements in the element template. Styles with the
     * `include` attribute are processed such that any styles in
     * the associated "style modules" are included in the element template.
     * @param {PolymerElementConstructor} klass Element class
     * @param {!HTMLTemplateElement} template Template to process
     * @param {string} is Name of element
     * @param {string} baseURI Base URI for element
     * @private
     */
    function processElementStyles(klass, template, is, baseURI) {
      if (!builtCSS) {
        const templateStyles = template.content.querySelectorAll('style');
        const stylesWithImports = Polymer.StyleGather.stylesFromTemplate(template);
        // insert styles from <link rel="import" type="css"> at the top of the template
        const linkedStyles = Polymer.StyleGather.stylesFromModuleImports(is);
        const firstTemplateChild = template.content.firstElementChild;
        for (let idx = 0; idx < linkedStyles.length; idx++) {
          let s = linkedStyles[idx];
          s.textContent = klass._processStyleText(s.textContent, baseURI);
          template.content.insertBefore(s, firstTemplateChild);
        }
        // keep track of the last "concrete" style in the template we have encountered
        let templateStyleIndex = 0;
        // ensure all gathered styles are actually in this template.
        for (let i = 0; i < stylesWithImports.length; i++) {
          let s = stylesWithImports[i];
          let templateStyle = templateStyles[templateStyleIndex];
          // if the style is not in this template, it's been "included" and
          // we put a clone of it in the template before the style that included it
          if (templateStyle !== s) {
            s = s.cloneNode(true);
            templateStyle.parentNode.insertBefore(s, templateStyle);
          } else {
            templateStyleIndex++;
          }
          s.textContent = klass._processStyleText(s.textContent, baseURI);
        }
      }
      if (window.ShadyCSS) {
        window.ShadyCSS.prepareTemplate(template, is);
      }
    }

    /**
     * Look up template from dom-module for element
     *
     * @param {!string} is Element name to look up
     * @return {!HTMLTemplateElement} Template found in dom module, or
     *   undefined if not found
     * @protected
     */
    function getTemplateFromDomModule(is) {
      let template = null;
      if (is && Polymer.DomModule) {
        template = Polymer.DomModule.import(is, 'template');
        // Under strictTemplatePolicy, require any element with an `is`
        // specified to have a dom-module
        if (Polymer.strictTemplatePolicy && !template) {
          throw new Error(`strictTemplatePolicy: expecting dom-module or null template for ${is}`);
        }
      }
      return template;
    }

  /**
     * @polymer
     * @mixinClass
     * @unrestricted
     * @implements {Polymer_ElementMixin}
     */
    class PolymerElement extends polymerElementBase {

      /**
       * Override of PropertiesMixin _finalizeClass to create observers and
       * find the template.
       * @return {void}
       * @protected
       * @override
       * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do
       */
      static _finalizeClass() {
        super._finalizeClass();
        const observers = ownObservers(this);
        if (observers) {
          this.createObservers(observers, this._properties);
        }
        this._prepareTemplate();
      }

      static _prepareTemplate() {
        // note: create "working" template that is finalized at instance time
        let template = /** @type {PolymerElementConstructor} */ (this).template;
        if (template) {
          if (typeof template === 'string') {
            let t = document.createElement('template');
            t.innerHTML = template;
            template = t;
          } else if (!Polymer.legacyOptimizations) {
             template = template.cloneNode(true);
          }
        }

        this.prototype._template = template;
      }

      /**
       * Override of PropertiesChanged createProperties to create accessors
       * and property effects for all of the properties.
       * @return {void}
       * @protected
       * @override
       */
      static createProperties(props) {
        for (let p in props) {
          createPropertyFromConfig(this.prototype, p, props[p], props);
        }
      }

      /**
       * Creates observers for the given `observers` array.
       * Leverages `PropertyEffects` to create observers.
       * @param {Object} observers Array of observer descriptors for
       *   this class
       * @param {Object} dynamicFns Object containing keys for any properties
       *   that are functions and should trigger the effect when the function
       *   reference is changed
       * @return {void}
       * @protected
       */
      static createObservers(observers, dynamicFns) {
        const proto = this.prototype;
        for (let i=0; i < observers.length; i++) {
          proto._createMethodObserver(observers[i], dynamicFns);
        }
      }

      /**
       * Returns the template that will be stamped into this element's shadow root.
       *
       * If a `static get is()` getter is defined, the default implementation
       * will return the first `<template>` in a `dom-module` whose `id`
       * matches this element's `is`.
       *
       * Users may override this getter to return an arbitrary template
       * (in which case the `is` getter is unnecessary). The template returned
       * may be either an `HTMLTemplateElement` or a string that will be
       * automatically parsed into a template.
       *
       * Note that when subclassing, if the super class overrode the default
       * implementation and the subclass would like to provide an alternate
       * template via a `dom-module`, it should override this getter and
       * return `Polymer.DomModule.import(this.is, 'template')`.
       *
       * If a subclass would like to modify the super class template, it should
       * clone it rather than modify it in place.  If the getter does expensive
       * work such as cloning/modifying a template, it should memoize the
       * template for maximum performance:
       *
       *   let memoizedTemplate;
       *   class MySubClass extends MySuperClass {
       *     static get template() {
       *       if (!memoizedTemplate) {
       *         memoizedTemplate = MySuperClass.template.cloneNode(true);
       *         let subContent = document.createElement('div');
       *         subContent.textContent = 'This came from MySubClass';
       *         memoizedTemplate.content.appendChild(subContent);
       *       }
       *       return memoizedTemplate;
       *     }
       *   }
       *
       * @return {HTMLTemplateElement|string} Template to be stamped
       */
      static get template() {
        // Explanation of template-related properties:
        // - constructor.template (this getter): the template for the class.
        //     This can come from the prototype (for legacy elements), from a
        //     dom-module, or from the super class's template (or can be overridden
        //     altogether by the user)
        // - constructor._template: memoized version of constructor.template
        // - prototype._template: working template for the element, which will be
        //     parsed and modified in place. It is a cloned version of
        //     constructor.template, saved in _finalizeClass(). Note that before
        //     this getter is called, for legacy elements this could be from a
        //     _template field on the info object passed to Polymer(), a behavior,
        //     or set in registered(); once the static getter runs, a clone of it
        //     will overwrite it on the prototype as the working template.
        if (!this.hasOwnProperty(JSCompiler_renameProperty('_template', this))) {
          this._template =
            // If user has put template on prototype (e.g. in legacy via registered
            // callback or info object), prefer that first
            this.prototype.hasOwnProperty(JSCompiler_renameProperty('_template', this.prototype)) ?
            this.prototype._template :
            // Look in dom-module associated with this element's is
            (getTemplateFromDomModule(/** @type {PolymerElementConstructor}*/ (this).is) ||
            // Next look for superclass template (call the super impl this
            // way so that `this` points to the superclass)
            Object.getPrototypeOf(/** @type {PolymerElementConstructor}*/ (this).prototype).constructor.template);
        }
        return this._template;
      }

      /**
       * Set the template.
       *
       * @param {!HTMLTemplateElement|string} value Template to set.
       */
      static set template(value) {
        this._template = value;
      }

      /**
       * Path matching the url from which the element was imported.
       *
       * This path is used to resolve url's in template style cssText.
       * The `importPath` property is also set on element instances and can be
       * used to create bindings relative to the import path.
       *
       * For elements defined in ES modules, users should implement
       * `static get importMeta() { return import.meta; }`, and the default
       * implementation of `importPath` will  return `import.meta.url`'s path.
       * For elements defined in HTML imports, this getter will return the path
       * to the document containing a `dom-module` element matching this
       * element's static `is` property.
       *
       * Note, this path should contain a trailing `/`.
       *
       * @return {string} The import path for this element class
       * @suppress {missingProperties}
       */
      static get importPath() {
        if (!this.hasOwnProperty(JSCompiler_renameProperty('_importPath', this))) {
          const meta = this.importMeta;
          if (meta) {
            this._importPath = Polymer.ResolveUrl.pathFromUrl(meta.url);
          } else {
            const module = Polymer.DomModule && Polymer.DomModule.import(/** @type {PolymerElementConstructor} */ (this).is);
            this._importPath = (module && module.assetpath) ||
              Object.getPrototypeOf(/** @type {PolymerElementConstructor}*/ (this).prototype).constructor.importPath;
          }
        }
        return this._importPath;
      }

      constructor() {
        super();
        /** @type {HTMLTemplateElement} */
        this._template;
        /** @type {string} */
        this._importPath;
        /** @type {string} */
        this.rootPath;
        /** @type {string} */
        this.importPath;
        /** @type {StampedTemplate | HTMLElement | ShadowRoot} */
        this.root;
        /** @type {!Object<string, !Element>} */
        this.$;
      }

      /**
       * Overrides the default `Polymer.PropertyAccessors` to ensure class
       * metaprogramming related to property accessors and effects has
       * completed (calls `finalize`).
       *
       * It also initializes any property defaults provided via `value` in
       * `properties` metadata.
       *
       * @return {void}
       * @override
       * @suppress {invalidCasts}
       */
      _initializeProperties() {
        this.constructor.finalize();
        // note: finalize template when we have access to `localName` to
        // avoid dependence on `is` for polyfilling styling.
        this.constructor._finalizeTemplate(/** @type {!HTMLElement} */(this).localName);
        super._initializeProperties();
        // set path defaults
        this.rootPath = Polymer.rootPath;
        this.importPath = this.constructor.importPath;
        // apply property defaults...
        let p$ = propertyDefaults(this.constructor);
        if (!p$) {
          return;
        }
        for (let p in p$) {
          let info = p$[p];
          // Don't set default value if there is already an own property, which
          // happens when a `properties` property with default but no effects had
          // a property set (e.g. bound) by its host before upgrade
          if (!this.hasOwnProperty(p)) {
            let value = typeof info.value == 'function' ?
              info.value.call(this) :
              info.value;
            // Set via `_setProperty` if there is an accessor, to enable
            // initializing readOnly property defaults
            if (this._hasAccessor(p)) {
              this._setPendingProperty(p, value, true);
            } else {
              this[p] = value;
            }
          }
        }
      }

      /**
       * Gather style text for a style element in the template.
       *
       * @param {string} cssText Text containing styling to process
       * @param {string} baseURI Base URI to rebase CSS paths against
       * @return {string} The processed CSS text
       * @protected
       */
      static _processStyleText(cssText, baseURI) {
        return Polymer.ResolveUrl.resolveCss(cssText, baseURI);
      }

      /**
      * Configures an element `proto` to function with a given `template`.
      * The element name `is` and extends `ext` must be specified for ShadyCSS
      * style scoping.
      *
      * @param {string} is Tag name (or type extension name) for this element
      * @return {void}
      * @protected
      */
      static _finalizeTemplate(is) {
        /** @const {HTMLTemplateElement} */
        const template = this.prototype._template;
        if (template && !template.__polymerFinalized) {
          template.__polymerFinalized = true;
          const importPath = this.importPath;
          const baseURI = importPath ? Polymer.ResolveUrl.resolveUrl(importPath) : '';
          // e.g. support `include="module-name"`, and ShadyCSS
          processElementStyles(this, template, is, baseURI);
          this.prototype._bindTemplate(template);
        }
      }

      /**
       * Provides a default implementation of the standard Custom Elements
       * `connectedCallback`.
       *
       * The default implementation enables the property effects system and
       * flushes any pending properties, and updates shimmed CSS properties
       * when using the ShadyCSS scoping/custom properties polyfill.
       *
       * @suppress {missingProperties, invalidCasts} Super may or may not implement the callback
       * @return {void}
       */
      connectedCallback() {
        if (window.ShadyCSS && this._template) {
          window.ShadyCSS.styleElement(/** @type {!HTMLElement} */(this));
        }
        super.connectedCallback();
      }

      /**
       * Stamps the element template.
       *
       * @return {void}
       * @override
       */
      ready() {
        if (this._template) {
          this.root = this._stampTemplate(this._template);
          this.$ = this.root.$;
        }
        super.ready();
      }

      /**
       * Implements `PropertyEffects`'s `_readyClients` call. Attaches
       * element dom by calling `_attachDom` with the dom stamped from the
       * element's template via `_stampTemplate`. Note that this allows
       * client dom to be attached to the element prior to any observers
       * running.
       *
       * @return {void}
       * @override
       */
      _readyClients() {
        if (this._template) {
          this.root = this._attachDom(/** @type {StampedTemplate} */(this.root));
        }
        // The super._readyClients here sets the clients initialized flag.
        // We must wait to do this until after client dom is created/attached
        // so that this flag can be checked to prevent notifications fired
        // during this process from being handled before clients are ready.
        super._readyClients();
      }


      /**
       * Attaches an element's stamped dom to itself. By default,
       * this method creates a `shadowRoot` and adds the dom to it.
       * However, this method may be overridden to allow an element
       * to put its dom in another location.
       *
       * @throws {Error}
       * @suppress {missingReturn}
       * @param {StampedTemplate} dom to attach to the element.
       * @return {ShadowRoot} node to which the dom has been attached.
       */
      _attachDom(dom) {
        if (this.attachShadow) {
          if (dom) {
            if (!this.shadowRoot) {
              this.attachShadow({mode: 'open'});
            }
            this.shadowRoot.appendChild(dom);
            return this.shadowRoot;
          }
          return null;
        } else {
          throw new Error('ShadowDOM not available. ' +
            // TODO(sorvell): move to compile-time conditional when supported
          'Polymer.Element can create dom as children instead of in ' +
          'ShadowDOM by setting `this.root = this;\` before \`ready\`.');
        }
      }

      /**
       * When using the ShadyCSS scoping and custom property shim, causes all
       * shimmed styles in this element (and its subtree) to be updated
       * based on current custom property values.
       *
       * The optional parameter overrides inline custom property styles with an
       * object of properties where the keys are CSS properties, and the values
       * are strings.
       *
       * Example: `this.updateStyles({'--color': 'blue'})`
       *
       * These properties are retained unless a value of `null` is set.
       *
       * Note: This function does not support updating CSS mixins.
       * You can not dynamically change the value of an `@apply`.
       *
       * @param {Object=} properties Bag of custom property key/values to
       *   apply to this element.
       * @return {void}
       * @suppress {invalidCasts}
       */
      updateStyles(properties) {
        if (window.ShadyCSS) {
          window.ShadyCSS.styleSubtree(/** @type {!HTMLElement} */(this), properties);
        }
      }

      /**
       * Rewrites a given URL relative to a base URL. The base URL defaults to
       * the original location of the document containing the `dom-module` for
       * this element. This method will return the same URL before and after
       * bundling.
       *
       * Note that this function performs no resolution for URLs that start
       * with `/` (absolute URLs) or `#` (hash identifiers).  For general purpose
       * URL resolution, use `window.URL`.
       *
       * @param {string} url URL to resolve.
       * @param {string=} base Optional base URL to resolve against, defaults
       * to the element's `importPath`
       * @return {string} Rewritten URL relative to base
       */
      resolveUrl(url, base) {
        if (!base && this.importPath) {
          base = Polymer.ResolveUrl.resolveUrl(this.importPath);
        }
        return Polymer.ResolveUrl.resolveUrl(url, base);
      }

      /**
       * Overrides `PropertyAccessors` to add map of dynamic functions on
       * template info, for consumption by `PropertyEffects` template binding
       * code. This map determines which method templates should have accessors
       * created for them.
       *
       * @override
       * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do
       */
      static _parseTemplateContent(template, templateInfo, nodeInfo) {
        templateInfo.dynamicFns = templateInfo.dynamicFns || this._properties;
        return super._parseTemplateContent(template, templateInfo, nodeInfo);
      }

    }

    return PolymerElement;
  });

  /**
   * When using the ShadyCSS scoping and custom property shim, causes all
   * shimmed `styles` (via `custom-style`) in the document (and its subtree)
   * to be updated based on current custom property values.
   *
   * The optional parameter overrides inline custom property styles with an
   * object of properties where the keys are CSS properties, and the values
   * are strings.
   *
   * Example: `Polymer.updateStyles({'--color': 'blue'})`
   *
   * These properties are retained unless a value of `null` is set.
   *
   * @param {Object=} props Bag of custom property key/values to
   *   apply to the document.
   * @return {void}
   */
  Polymer.updateStyles = function(props) {
    if (window.ShadyCSS) {
      window.ShadyCSS.styleDocument(props);
    }
  };

})();


(function() {
  'use strict';

  /**
   * @summary Collapse multiple callbacks into one invocation after a timer.
   * @memberof Polymer
   */
  class Debouncer {
    constructor() {
      this._asyncModule = null;
      this._callback = null;
      this._timer = null;
    }
    /**
     * Sets the scheduler; that is, a module with the Async interface,
     * a callback and optional arguments to be passed to the run function
     * from the async module.
     *
     * @param {!AsyncInterface} asyncModule Object with Async interface.
     * @param {function()} callback Callback to run.
     * @return {void}
     */
    setConfig(asyncModule, callback) {
      this._asyncModule = asyncModule;
      this._callback = callback;
      this._timer = this._asyncModule.run(() => {
        this._timer = null;
        this._callback();
      });
    }
    /**
     * Cancels an active debouncer and returns a reference to itself.
     *
     * @return {void}
     */
    cancel() {
      if (this.isActive()) {
        this._asyncModule.cancel(this._timer);
        this._timer = null;
      }
    }
    /**
     * Flushes an active debouncer and returns a reference to itself.
     *
     * @return {void}
     */
    flush() {
      if (this.isActive()) {
        this.cancel();
        this._callback();
      }
    }
    /**
     * Returns true if the debouncer is active.
     *
     * @return {boolean} True if active.
     */
    isActive() {
      return this._timer != null;
    }
    /**
     * Creates a debouncer if no debouncer is passed as a parameter
     * or it cancels an active debouncer otherwise. The following
     * example shows how a debouncer can be called multiple times within a
     * microtask and "debounced" such that the provided callback function is
     * called once. Add this method to a custom element:
     *
     * _debounceWork() {
     *   this._debounceJob = Polymer.Debouncer.debounce(this._debounceJob,
     *       Polymer.Async.microTask, () => {
     *     this._doWork();
     *   });
     * }
     *
     * If the `_debounceWork` method is called multiple times within the same
     * microtask, the `_doWork` function will be called only once at the next
     * microtask checkpoint.
     *
     * Note: In testing it is often convenient to avoid asynchrony. To accomplish
     * this with a debouncer, you can use `Polymer.enqueueDebouncer` and
     * `Polymer.flush`. For example, extend the above example by adding
     * `Polymer.enqueueDebouncer(this._debounceJob)` at the end of the
     * `_debounceWork` method. Then in a test, call `Polymer.flush` to ensure
     * the debouncer has completed.
     *
     * @param {Debouncer?} debouncer Debouncer object.
     * @param {!AsyncInterface} asyncModule Object with Async interface
     * @param {function()} callback Callback to run.
     * @return {!Debouncer} Returns a debouncer object.
     */
    static debounce(debouncer, asyncModule, callback) {
      if (debouncer instanceof Debouncer) {
        debouncer.cancel();
      } else {
        debouncer = new Debouncer();
      }
      debouncer.setConfig(asyncModule, callback);
      return debouncer;
    }
  }

  /** @const */
  Polymer.Debouncer = Debouncer;
})();


(function() {

  'use strict';

  // detect native touch action support
  let HAS_NATIVE_TA = typeof document.head.style.touchAction === 'string';
  let GESTURE_KEY = '__polymerGestures';
  let HANDLED_OBJ = '__polymerGesturesHandled';
  let TOUCH_ACTION = '__polymerGesturesTouchAction';
  // radius for tap and track
  let TAP_DISTANCE = 25;
  let TRACK_DISTANCE = 5;
  // number of last N track positions to keep
  let TRACK_LENGTH = 2;

  // Disabling "mouse" handlers for 2500ms is enough
  let MOUSE_TIMEOUT = 2500;
  let MOUSE_EVENTS = ['mousedown', 'mousemove', 'mouseup', 'click'];
  // an array of bitmask values for mapping MouseEvent.which to MouseEvent.buttons
  let MOUSE_WHICH_TO_BUTTONS = [0, 1, 4, 2];
  let MOUSE_HAS_BUTTONS = (function() {
    try {
      return new MouseEvent('test', {buttons: 1}).buttons === 1;
    } catch (e) {
      return false;
    }
  })();

  /**
   * @param {string} name Possible mouse event name
   * @return {boolean} true if mouse event, false if not
   */
  function isMouseEvent(name) {
    return MOUSE_EVENTS.indexOf(name) > -1;
  }

  /* eslint no-empty: ["error", { "allowEmptyCatch": true }] */
  // check for passive event listeners
  let SUPPORTS_PASSIVE = false;
  (function() {
    try {
      let opts = Object.defineProperty({}, 'passive', {get() {SUPPORTS_PASSIVE = true;}});
      window.addEventListener('test', null, opts);
      window.removeEventListener('test', null, opts);
    } catch(e) {}
  })();

  /**
   * Generate settings for event listeners, dependant on `Polymer.passiveTouchGestures`
   *
   * @param {string} eventName Event name to determine if `{passive}` option is needed
   * @return {{passive: boolean} | undefined} Options to use for addEventListener and removeEventListener
   */
  function PASSIVE_TOUCH(eventName) {
    if (isMouseEvent(eventName) || eventName === 'touchend') {
      return;
    }
    if (HAS_NATIVE_TA && SUPPORTS_PASSIVE && Polymer.passiveTouchGestures) {
      return {passive: true};
    } else {
      return;
    }
  }

  // Check for touch-only devices
  let IS_TOUCH_ONLY = navigator.userAgent.match(/iP(?:[oa]d|hone)|Android/);

  let GestureRecognizer = function(){}; // eslint-disable-line no-unused-vars
  /** @type {function(): void} */
  GestureRecognizer.prototype.reset;
  /** @type {function(MouseEvent): void | undefined} */
  GestureRecognizer.prototype.mousedown;
  /** @type {(function(MouseEvent): void | undefined)} */
  GestureRecognizer.prototype.mousemove;
  /** @type {(function(MouseEvent): void | undefined)} */
  GestureRecognizer.prototype.mouseup;
  /** @type {(function(TouchEvent): void | undefined)} */
  GestureRecognizer.prototype.touchstart;
  /** @type {(function(TouchEvent): void | undefined)} */
  GestureRecognizer.prototype.touchmove;
  /** @type {(function(TouchEvent): void | undefined)} */
  GestureRecognizer.prototype.touchend;
  /** @type {(function(MouseEvent): void | undefined)} */
  GestureRecognizer.prototype.click;

  // keep track of any labels hit by the mouseCanceller
  /** @type {!Array<!HTMLLabelElement>} */
  const clickedLabels = [];

  /** @type {!Object<boolean>} */
  const labellable = {
    'button': true,
    'input': true,
    'keygen': true,
    'meter': true,
    'output': true,
    'textarea': true,
    'progress': true,
    'select': true
  };

  // Defined at https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#enabling-and-disabling-form-controls:-the-disabled-attribute
  /** @type {!Object<boolean>} */
  const canBeDisabled = {
    'button': true,
    'command': true,
    'fieldset': true,
    'input': true,
    'keygen': true,
    'optgroup': true,
    'option': true,
    'select': true,
    'textarea': true
  };

  /**
   * @param {HTMLElement} el Element to check labelling status
   * @return {boolean} element can have labels
   */
  function canBeLabelled(el) {
    return labellable[el.localName] || false;
  }

  /**
   * @param {HTMLElement} el Element that may be labelled.
   * @return {!Array<!HTMLLabelElement>} Relevant label for `el`
   */
  function matchingLabels(el) {
    let labels = Array.from(/** @type {HTMLInputElement} */(el).labels || []);
    // IE doesn't have `labels` and Safari doesn't populate `labels`
    // if element is in a shadowroot.
    // In this instance, finding the non-ancestor labels is enough,
    // as the mouseCancellor code will handle ancstor labels
    if (!labels.length) {
      labels = [];
      let root = el.getRootNode();
      // if there is an id on `el`, check for all labels with a matching `for` attribute
      if (el.id) {
        let matching = root.querySelectorAll(`label[for = ${el.id}]`);
        for (let i = 0; i < matching.length; i++) {
          labels.push(/** @type {!HTMLLabelElement} */(matching[i]));
        }
      }
    }
    return labels;
  }

  // touch will make synthetic mouse events
  // `preventDefault` on touchend will cancel them,
  // but this breaks `<input>` focus and link clicks
  // disable mouse handlers for MOUSE_TIMEOUT ms after
  // a touchend to ignore synthetic mouse events
  let mouseCanceller = function(mouseEvent) {
    // Check for sourceCapabilities, used to distinguish synthetic events
    // if mouseEvent did not come from a device that fires touch events,
    // it was made by a real mouse and should be counted
    // http://wicg.github.io/InputDeviceCapabilities/#dom-inputdevicecapabilities-firestouchevents
    let sc = mouseEvent.sourceCapabilities;
    if (sc && !sc.firesTouchEvents) {
      return;
    }
    // skip synthetic mouse events
    mouseEvent[HANDLED_OBJ] = {skip: true};
    // disable "ghost clicks"
    if (mouseEvent.type === 'click') {
      let clickFromLabel = false;
      let path = mouseEvent.composedPath && mouseEvent.composedPath();
      if (path) {
        for (let i = 0; i < path.length; i++) {
          if (path[i].nodeType === Node.ELEMENT_NODE) {
            if (path[i].localName === 'label') {
              clickedLabels.push(path[i]);
            } else if (canBeLabelled(path[i])) {
              let ownerLabels = matchingLabels(path[i]);
              // check if one of the clicked labels is labelling this element
              for (let j = 0; j < ownerLabels.length; j++) {
                clickFromLabel = clickFromLabel || clickedLabels.indexOf(ownerLabels[j]) > -1;
              }
            }
          }
          if (path[i] === POINTERSTATE.mouse.target) {
            return;
          }
        }
      }
      // if one of the clicked labels was labelling the target element,
      // this is not a ghost click
      if (clickFromLabel) {
        return;
      }
      mouseEvent.preventDefault();
      mouseEvent.stopPropagation();
    }
  };

  /**
   * @param {boolean=} setup True to add, false to remove.
   * @return {void}
   */
  function setupTeardownMouseCanceller(setup) {
    let events = IS_TOUCH_ONLY ? ['click'] : MOUSE_EVENTS;
    for (let i = 0, en; i < events.length; i++) {
      en = events[i];
      if (setup) {
        // reset clickLabels array
        clickedLabels.length = 0;
        document.addEventListener(en, mouseCanceller, true);
      } else {
        document.removeEventListener(en, mouseCanceller, true);
      }
    }
  }

  function ignoreMouse(e) {
    if (!POINTERSTATE.mouse.mouseIgnoreJob) {
      setupTeardownMouseCanceller(true);
    }
    let unset = function() {
      setupTeardownMouseCanceller();
      POINTERSTATE.mouse.target = null;
      POINTERSTATE.mouse.mouseIgnoreJob = null;
    };
    POINTERSTATE.mouse.target = e.composedPath()[0];
    POINTERSTATE.mouse.mouseIgnoreJob = Polymer.Debouncer.debounce(
          POINTERSTATE.mouse.mouseIgnoreJob
        , Polymer.Async.timeOut.after(MOUSE_TIMEOUT)
        , unset);
  }

  /**
   * @param {MouseEvent} ev event to test for left mouse button down
   * @return {boolean} has left mouse button down
   */
  function hasLeftMouseButton(ev) {
    let type = ev.type;
    // exit early if the event is not a mouse event
    if (!isMouseEvent(type)) {
      return false;
    }
    // ev.button is not reliable for mousemove (0 is overloaded as both left button and no buttons)
    // instead we use ev.buttons (bitmask of buttons) or fall back to ev.which (deprecated, 0 for no buttons, 1 for left button)
    if (type === 'mousemove') {
      // allow undefined for testing events
      let buttons = ev.buttons === undefined ? 1 : ev.buttons;
      if ((ev instanceof window.MouseEvent) && !MOUSE_HAS_BUTTONS) {
        buttons = MOUSE_WHICH_TO_BUTTONS[ev.which] || 0;
      }
      // buttons is a bitmask, check that the left button bit is set (1)
      return Boolean(buttons & 1);
    } else {
      // allow undefined for testing events
      let button = ev.button === undefined ? 0 : ev.button;
      // ev.button is 0 in mousedown/mouseup/click for left button activation
      return button === 0;
    }
  }

  function isSyntheticClick(ev) {
    if (ev.type === 'click') {
      // ev.detail is 0 for HTMLElement.click in most browsers
      if (ev.detail === 0) {
        return true;
      }
      // in the worst case, check that the x/y position of the click is within
      // the bounding box of the target of the event
      // Thanks IE 10 >:(
      let t = Gestures._findOriginalTarget(ev);
      // make sure the target of the event is an element so we can use getBoundingClientRect,
      // if not, just assume it is a synthetic click
      if (!t.nodeType || /** @type {Element} */(t).nodeType !== Node.ELEMENT_NODE) {
        return true;
      }
      let bcr = /** @type {Element} */(t).getBoundingClientRect();
      // use page x/y to account for scrolling
      let x = ev.pageX, y = ev.pageY;
      // ev is a synthetic click if the position is outside the bounding box of the target
      return !((x >= bcr.left && x <= bcr.right) && (y >= bcr.top && y <= bcr.bottom));
    }
    return false;
  }

  let POINTERSTATE = {
    mouse: {
      target: null,
      mouseIgnoreJob: null
    },
    touch: {
      x: 0,
      y: 0,
      id: -1,
      scrollDecided: false
    }
  };

  function firstTouchAction(ev) {
    let ta = 'auto';
    let path = ev.composedPath && ev.composedPath();
    if (path) {
      for (let i = 0, n; i < path.length; i++) {
        n = path[i];
        if (n[TOUCH_ACTION]) {
          ta = n[TOUCH_ACTION];
          break;
        }
      }
    }
    return ta;
  }

  function trackDocument(stateObj, movefn, upfn) {
    stateObj.movefn = movefn;
    stateObj.upfn = upfn;
    document.addEventListener('mousemove', movefn);
    document.addEventListener('mouseup', upfn);
  }

  function untrackDocument(stateObj) {
    document.removeEventListener('mousemove', stateObj.movefn);
    document.removeEventListener('mouseup', stateObj.upfn);
    stateObj.movefn = null;
    stateObj.upfn = null;
  }

  // use a document-wide touchend listener to start the ghost-click prevention mechanism
  // Use passive event listeners, if supported, to not affect scrolling performance
  document.addEventListener('touchend', ignoreMouse, SUPPORTS_PASSIVE ? {passive: true} : false);

  /**
   * Module for adding listeners to a node for the following normalized
   * cross-platform "gesture" events:
   * - `down` - mouse or touch went down
   * - `up` - mouse or touch went up
   * - `tap` - mouse click or finger tap
   * - `track` - mouse drag or touch move
   *
   * @namespace
   * @memberof Polymer
   * @summary Module for adding cross-platform gesture event listeners.
   */
  const Gestures = {
    gestures: {},
    recognizers: [],

    /**
     * Finds the element rendered on the screen at the provided coordinates.
     *
     * Similar to `document.elementFromPoint`, but pierces through
     * shadow roots.
     *
     * @memberof Polymer.Gestures
     * @param {number} x Horizontal pixel coordinate
     * @param {number} y Vertical pixel coordinate
     * @return {Element} Returns the deepest shadowRoot inclusive element
     * found at the screen position given.
     */
    deepTargetFind: function(x, y) {
      let node = document.elementFromPoint(x, y);
      let next = node;
      // this code path is only taken when native ShadowDOM is used
      // if there is a shadowroot, it may have a node at x/y
      // if there is not a shadowroot, exit the loop
      while (next && next.shadowRoot && !window.ShadyDOM) {
        // if there is a node at x/y in the shadowroot, look deeper
        let oldNext = next;
        next = next.shadowRoot.elementFromPoint(x, y);
        // on Safari, elementFromPoint may return the shadowRoot host
        if (oldNext === next) {
          break;
        }
        if (next) {
          node = next;
        }
      }
      return node;
    },
    /**
     * a cheaper check than ev.composedPath()[0];
     *
     * @private
     * @param {Event} ev Event.
     * @return {EventTarget} Returns the event target.
     */
    _findOriginalTarget: function(ev) {
      // shadowdom
      if (ev.composedPath) {
        const targets = /** @type {!Array<!EventTarget>} */(ev.composedPath());
        // It shouldn't be, but sometimes targets is empty (window on Safari).
        return targets.length > 0 ? targets[0] : ev.target;
      }
      // shadydom
      return ev.target;
    },

    /**
     * @private
     * @param {Event} ev Event.
     * @return {void}
     */
    _handleNative: function(ev) {
      let handled;
      let type = ev.type;
      let node = ev.currentTarget;
      let gobj = node[GESTURE_KEY];
      if (!gobj) {
        return;
      }
      let gs = gobj[type];
      if (!gs) {
        return;
      }
      if (!ev[HANDLED_OBJ]) {
        ev[HANDLED_OBJ] = {};
        if (type.slice(0, 5) === 'touch') {
          ev = /** @type {TouchEvent} */(ev); // eslint-disable-line no-self-assign
          let t = ev.changedTouches[0];
          if (type === 'touchstart') {
            // only handle the first finger
            if (ev.touches.length === 1) {
              POINTERSTATE.touch.id = t.identifier;
            }
          }
          if (POINTERSTATE.touch.id !== t.identifier) {
            return;
          }
          if (!HAS_NATIVE_TA) {
            if (type === 'touchstart' || type === 'touchmove') {
              Gestures._handleTouchAction(ev);
            }
          }
        }
      }
      handled = ev[HANDLED_OBJ];
      // used to ignore synthetic mouse events
      if (handled.skip) {
        return;
      }
      // reset recognizer state
      for (let i = 0, r; i < Gestures.recognizers.length; i++) {
        r = Gestures.recognizers[i];
        if (gs[r.name] && !handled[r.name]) {
          if (r.flow && r.flow.start.indexOf(ev.type) > -1 && r.reset) {
            r.reset();
          }
        }
      }
      // enforce gesture recognizer order
      for (let i = 0, r; i < Gestures.recognizers.length; i++) {
        r = Gestures.recognizers[i];
        if (gs[r.name] && !handled[r.name]) {
          handled[r.name] = true;
          r[type](ev);
        }
      }
    },

    /**
     * @private
     * @param {TouchEvent} ev Event.
     * @return {void}
     */
    _handleTouchAction: function(ev) {
      let t = ev.changedTouches[0];
      let type = ev.type;
      if (type === 'touchstart') {
        POINTERSTATE.touch.x = t.clientX;
        POINTERSTATE.touch.y = t.clientY;
        POINTERSTATE.touch.scrollDecided = false;
      } else if (type === 'touchmove') {
        if (POINTERSTATE.touch.scrollDecided) {
          return;
        }
        POINTERSTATE.touch.scrollDecided = true;
        let ta = firstTouchAction(ev);
        let prevent = false;
        let dx = Math.abs(POINTERSTATE.touch.x - t.clientX);
        let dy = Math.abs(POINTERSTATE.touch.y - t.clientY);
        if (!ev.cancelable) {
          // scrolling is happening
        } else if (ta === 'none') {
          prevent = true;
        } else if (ta === 'pan-x') {
          prevent = dy > dx;
        } else if (ta === 'pan-y') {
          prevent = dx > dy;
        }
        if (prevent) {
          ev.preventDefault();
        } else {
          Gestures.prevent('track');
        }
      }
    },

    /**
     * Adds an event listener to a node for the given gesture type.
     *
     * @memberof Polymer.Gestures
     * @param {!Node} node Node to add listener on
     * @param {string} evType Gesture type: `down`, `up`, `track`, or `tap`
     * @param {!function(!Event):void} handler Event listener function to call
     * @return {boolean} Returns true if a gesture event listener was added.
     * @this {Gestures}
     */
    addListener: function(node, evType, handler) {
      if (this.gestures[evType]) {
        this._add(node, evType, handler);
        return true;
      }
      return false;
    },

    /**
     * Removes an event listener from a node for the given gesture type.
     *
     * @memberof Polymer.Gestures
     * @param {!Node} node Node to remove listener from
     * @param {string} evType Gesture type: `down`, `up`, `track`, or `tap`
     * @param {!function(!Event):void} handler Event listener function previously passed to
     *  `addListener`.
     * @return {boolean} Returns true if a gesture event listener was removed.
     * @this {Gestures}
     */
    removeListener: function(node, evType, handler) {
      if (this.gestures[evType]) {
        this._remove(node, evType, handler);
        return true;
      }
      return false;
    },

    /**
     * automate the event listeners for the native events
     *
     * @private
     * @param {!HTMLElement} node Node on which to add the event.
     * @param {string} evType Event type to add.
     * @param {function(!Event)} handler Event handler function.
     * @return {void}
     * @this {Gestures}
     */
    _add: function(node, evType, handler) {
      let recognizer = this.gestures[evType];
      let deps = recognizer.deps;
      let name = recognizer.name;
      let gobj = node[GESTURE_KEY];
      if (!gobj) {
        node[GESTURE_KEY] = gobj = {};
      }
      for (let i = 0, dep, gd; i < deps.length; i++) {
        dep = deps[i];
        // don't add mouse handlers on iOS because they cause gray selection overlays
        if (IS_TOUCH_ONLY && isMouseEvent(dep) && dep !== 'click') {
          continue;
        }
        gd = gobj[dep];
        if (!gd) {
          gobj[dep] = gd = {_count: 0};
        }
        if (gd._count === 0) {
          node.addEventListener(dep, this._handleNative, PASSIVE_TOUCH(dep));
        }
        gd[name] = (gd[name] || 0) + 1;
        gd._count = (gd._count || 0) + 1;
      }
      node.addEventListener(evType, handler);
      if (recognizer.touchAction) {
        this.setTouchAction(node, recognizer.touchAction);
      }
    },

    /**
     * automate event listener removal for native events
     *
     * @private
     * @param {!HTMLElement} node Node on which to remove the event.
     * @param {string} evType Event type to remove.
     * @param {function(Event?)} handler Event handler function.
     * @return {void}
     * @this {Gestures}
     */
    _remove: function(node, evType, handler) {
      let recognizer = this.gestures[evType];
      let deps = recognizer.deps;
      let name = recognizer.name;
      let gobj = node[GESTURE_KEY];
      if (gobj) {
        for (let i = 0, dep, gd; i < deps.length; i++) {
          dep = deps[i];
          gd = gobj[dep];
          if (gd && gd[name]) {
            gd[name] = (gd[name] || 1) - 1;
            gd._count = (gd._count || 1) - 1;
            if (gd._count === 0) {
              node.removeEventListener(dep, this._handleNative, PASSIVE_TOUCH(dep));
            }
          }
        }
      }
      node.removeEventListener(evType, handler);
    },

    /**
     * Registers a new gesture event recognizer for adding new custom
     * gesture event types.
     *
     * @memberof Polymer.Gestures
     * @param {!GestureRecognizer} recog Gesture recognizer descriptor
     * @return {void}
     * @this {Gestures}
     */
    register: function(recog) {
      this.recognizers.push(recog);
      for (let i = 0; i < recog.emits.length; i++) {
        this.gestures[recog.emits[i]] = recog;
      }
    },

    /**
     * @private
     * @param {string} evName Event name.
     * @return {Object} Returns the gesture for the given event name.
     * @this {Gestures}
     */
    _findRecognizerByEvent: function(evName) {
      for (let i = 0, r; i < this.recognizers.length; i++) {
        r = this.recognizers[i];
        for (let j = 0, n; j < r.emits.length; j++) {
          n = r.emits[j];
          if (n === evName) {
            return r;
          }
        }
      }
      return null;
    },

    /**
     * Sets scrolling direction on node.
     *
     * This value is checked on first move, thus it should be called prior to
     * adding event listeners.
     *
     * @memberof Polymer.Gestures
     * @param {!Element} node Node to set touch action setting on
     * @param {string} value Touch action value
     * @return {void}
     */
    setTouchAction: function(node, value) {
      if (HAS_NATIVE_TA) {
        // NOTE: add touchAction async so that events can be added in
        // custom element constructors. Otherwise we run afoul of custom
        // elements restriction against settings attributes (style) in the
        // constructor.
        Polymer.Async.microTask.run(() => {
          node.style.touchAction = value;
        });
      }
      node[TOUCH_ACTION] = value;
    },

    /**
     * Dispatches an event on the `target` element of `type` with the given
     * `detail`.
     * @private
     * @param {!EventTarget} target The element on which to fire an event.
     * @param {string} type The type of event to fire.
     * @param {!Object=} detail The detail object to populate on the event.
     * @return {void}
     */
    _fire: function(target, type, detail) {
      let ev = new Event(type, { bubbles: true, cancelable: true, composed: true });
      ev.detail = detail;
      target.dispatchEvent(ev);
      // forward `preventDefault` in a clean way
      if (ev.defaultPrevented) {
        let preventer = detail.preventer || detail.sourceEvent;
        if (preventer && preventer.preventDefault) {
          preventer.preventDefault();
        }
      }
    },

    /**
     * Prevents the dispatch and default action of the given event name.
     *
     * @memberof Polymer.Gestures
     * @param {string} evName Event name.
     * @return {void}
     * @this {Gestures}
     */
    prevent: function(evName) {
      let recognizer = this._findRecognizerByEvent(evName);
      if (recognizer.info) {
        recognizer.info.prevent = true;
      }
    },

    /**
     * Reset the 2500ms timeout on processing mouse input after detecting touch input.
     *
     * Touch inputs create synthesized mouse inputs anywhere from 0 to 2000ms after the touch.
     * This method should only be called during testing with simulated touch inputs.
     * Calling this method in production may cause duplicate taps or other Gestures.
     *
     * @memberof Polymer.Gestures
     * @return {void}
     */
    resetMouseCanceller: function() {
      if (POINTERSTATE.mouse.mouseIgnoreJob) {
        POINTERSTATE.mouse.mouseIgnoreJob.flush();
      }
    }
  };

  /* eslint-disable valid-jsdoc */

  Gestures.register({
    name: 'downup',
    deps: ['mousedown', 'touchstart', 'touchend'],
    flow: {
      start: ['mousedown', 'touchstart'],
      end: ['mouseup', 'touchend']
    },
    emits: ['down', 'up'],

    info: {
      movefn: null,
      upfn: null
    },

    /**
     * @this {GestureRecognizer}
     * @return {void}
     */
    reset: function() {
      untrackDocument(this.info);
    },

    /**
     * @this {GestureRecognizer}
     * @param {MouseEvent} e
     * @return {void}
     */
    mousedown: function(e) {
      if (!hasLeftMouseButton(e)) {
        return;
      }
      let t = Gestures._findOriginalTarget(e);
      let self = this;
      let movefn = function movefn(e) {
        if (!hasLeftMouseButton(e)) {
          self._fire('up', t, e);
          untrackDocument(self.info);
        }
      };
      let upfn = function upfn(e) {
        if (hasLeftMouseButton(e)) {
          self._fire('up', t, e);
        }
        untrackDocument(self.info);
      };
      trackDocument(this.info, movefn, upfn);
      this._fire('down', t, e);
    },
    /**
     * @this {GestureRecognizer}
     * @param {TouchEvent} e
     * @return {void}
     */
    touchstart: function(e) {
      this._fire('down', Gestures._findOriginalTarget(e), e.changedTouches[0], e);
    },
    /**
     * @this {GestureRecognizer}
     * @param {TouchEvent} e
     * @return {void}
     */
    touchend: function(e) {
      this._fire('up', Gestures._findOriginalTarget(e), e.changedTouches[0], e);
    },
    /**
     * @param {string} type
     * @param {!EventTarget} target
     * @param {Event} event
     * @param {Function} preventer
     * @return {void}
     */
    _fire: function(type, target, event, preventer) {
      Gestures._fire(target, type, {
        x: event.clientX,
        y: event.clientY,
        sourceEvent: event,
        preventer: preventer,
        prevent: function(e) {
          return Gestures.prevent(e);
        }
      });
    }
  });

  Gestures.register({
    name: 'track',
    touchAction: 'none',
    deps: ['mousedown', 'touchstart', 'touchmove', 'touchend'],
    flow: {
      start: ['mousedown', 'touchstart'],
      end: ['mouseup', 'touchend']
    },
    emits: ['track'],

    info: {
      x: 0,
      y: 0,
      state: 'start',
      started: false,
      moves: [],
      /** @this {GestureRecognizer} */
      addMove: function(move) {
        if (this.moves.length > TRACK_LENGTH) {
          this.moves.shift();
        }
        this.moves.push(move);
      },
      movefn: null,
      upfn: null,
      prevent: false
    },

    /**
     * @this {GestureRecognizer}
     * @return {void}
     */
    reset: function() {
      this.info.state = 'start';
      this.info.started = false;
      this.info.moves = [];
      this.info.x = 0;
      this.info.y = 0;
      this.info.prevent = false;
      untrackDocument(this.info);
    },

    /**
     * @this {GestureRecognizer}
     * @param {number} x
     * @param {number} y
     * @return {boolean}
     */
    hasMovedEnough: function(x, y) {
      if (this.info.prevent) {
        return false;
      }
      if (this.info.started) {
        return true;
      }
      let dx = Math.abs(this.info.x - x);
      let dy = Math.abs(this.info.y - y);
      return (dx >= TRACK_DISTANCE || dy >= TRACK_DISTANCE);
    },
    /**
     * @this {GestureRecognizer}
     * @param {MouseEvent} e
     * @return {void}
     */
    mousedown: function(e) {
      if (!hasLeftMouseButton(e)) {
        return;
      }
      let t = Gestures._findOriginalTarget(e);
      let self = this;
      let movefn = function movefn(e) {
        let x = e.clientX, y = e.clientY;
        if (self.hasMovedEnough(x, y)) {
          // first move is 'start', subsequent moves are 'move', mouseup is 'end'
          self.info.state = self.info.started ? (e.type === 'mouseup' ? 'end' : 'track') : 'start';
          if (self.info.state === 'start') {
            // if and only if tracking, always prevent tap
            Gestures.prevent('tap');
          }
          self.info.addMove({x: x, y: y});
          if (!hasLeftMouseButton(e)) {
            // always _fire "end"
            self.info.state = 'end';
            untrackDocument(self.info);
          }
          self._fire(t, e);
          self.info.started = true;
        }
      };
      let upfn = function upfn(e) {
        if (self.info.started) {
          movefn(e);
        }

        // remove the temporary listeners
        untrackDocument(self.info);
      };
      // add temporary document listeners as mouse retargets
      trackDocument(this.info, movefn, upfn);
      this.info.x = e.clientX;
      this.info.y = e.clientY;
    },
    /**
     * @this {GestureRecognizer}
     * @param {TouchEvent} e
     * @return {void}
     */
    touchstart: function(e) {
      let ct = e.changedTouches[0];
      this.info.x = ct.clientX;
      this.info.y = ct.clientY;
    },
    /**
     * @this {GestureRecognizer}
     * @param {TouchEvent} e
     * @return {void}
     */
    touchmove: function(e) {
      let t = Gestures._findOriginalTarget(e);
      let ct = e.changedTouches[0];
      let x = ct.clientX, y = ct.clientY;
      if (this.hasMovedEnough(x, y)) {
        if (this.info.state === 'start') {
          // if and only if tracking, always prevent tap
          Gestures.prevent('tap');
        }
        this.info.addMove({x: x, y: y});
        this._fire(t, ct);
        this.info.state = 'track';
        this.info.started = true;
      }
    },
    /**
     * @this {GestureRecognizer}
     * @param {TouchEvent} e
     * @return {void}
     */
    touchend: function(e) {
      let t = Gestures._findOriginalTarget(e);
      let ct = e.changedTouches[0];
      // only trackend if track was started and not aborted
      if (this.info.started) {
        // reset started state on up
        this.info.state = 'end';
        this.info.addMove({x: ct.clientX, y: ct.clientY});
        this._fire(t, ct, e);
      }
    },

    /**
     * @this {GestureRecognizer}
     * @param {!EventTarget} target
     * @param {Touch} touch
     * @return {void}
     */
    _fire: function(target, touch) {
      let secondlast = this.info.moves[this.info.moves.length - 2];
      let lastmove = this.info.moves[this.info.moves.length - 1];
      let dx = lastmove.x - this.info.x;
      let dy = lastmove.y - this.info.y;
      let ddx, ddy = 0;
      if (secondlast) {
        ddx = lastmove.x - secondlast.x;
        ddy = lastmove.y - secondlast.y;
      }
      Gestures._fire(target, 'track', {
        state: this.info.state,
        x: touch.clientX,
        y: touch.clientY,
        dx: dx,
        dy: dy,
        ddx: ddx,
        ddy: ddy,
        sourceEvent: touch,
        hover: function() {
          return Gestures.deepTargetFind(touch.clientX, touch.clientY);
        }
      });
    }

  });

  Gestures.register({
    name: 'tap',
    deps: ['mousedown', 'click', 'touchstart', 'touchend'],
    flow: {
      start: ['mousedown', 'touchstart'],
      end: ['click', 'touchend']
    },
    emits: ['tap'],
    info: {
      x: NaN,
      y: NaN,
      prevent: false
    },
    /**
     * @this {GestureRecognizer}
     * @return {void}
     */
    reset: function() {
      this.info.x = NaN;
      this.info.y = NaN;
      this.info.prevent = false;
    },
    /**
     * @this {GestureRecognizer}
     * @param {MouseEvent} e
     * @return {void}
     */
    save: function(e) {
      this.info.x = e.clientX;
      this.info.y = e.clientY;
    },
    /**
     * @this {GestureRecognizer}
     * @param {MouseEvent} e
     * @return {void}
     */
    mousedown: function(e) {
      if (hasLeftMouseButton(e)) {
        this.save(e);
      }
    },
    /**
     * @this {GestureRecognizer}
     * @param {MouseEvent} e
     * @return {void}
     */
    click: function(e) {
      if (hasLeftMouseButton(e)) {
        this.forward(e);
      }
    },
    /**
     * @this {GestureRecognizer}
     * @param {TouchEvent} e
     * @return {void}
     */
    touchstart: function(e) {
      this.save(e.changedTouches[0], e);
    },
    /**
     * @this {GestureRecognizer}
     * @param {TouchEvent} e
     * @return {void}
     */
    touchend: function(e) {
      this.forward(e.changedTouches[0], e);
    },
    /**
     * @this {GestureRecognizer}
     * @param {Event | Touch} e
     * @param {Event=} preventer
     * @return {void}
     */
    forward: function(e, preventer) {
      let dx = Math.abs(e.clientX - this.info.x);
      let dy = Math.abs(e.clientY - this.info.y);
      // find original target from `preventer` for TouchEvents, or `e` for MouseEvents
      let t = Gestures._findOriginalTarget(/** @type {Event} */(preventer || e));
      if (!t || (canBeDisabled[/** @type {!HTMLElement} */(t).localName] && t.hasAttribute('disabled'))) {
        return;
      }
      // dx,dy can be NaN if `click` has been simulated and there was no `down` for `start`
      if (isNaN(dx) || isNaN(dy) || (dx <= TAP_DISTANCE && dy <= TAP_DISTANCE) || isSyntheticClick(e)) {
        // prevent taps from being generated if an event has canceled them
        if (!this.info.prevent) {
          Gestures._fire(t, 'tap', {
            x: e.clientX,
            y: e.clientY,
            sourceEvent: e,
            preventer: preventer
          });
        }
      }
    }
  });

  /* eslint-enable valid-jsdoc */

  /** @deprecated */
  Gestures.findOriginalTarget = Gestures._findOriginalTarget;

  /** @deprecated */
  Gestures.add = Gestures.addListener;

  /** @deprecated */
  Gestures.remove = Gestures.removeListener;

  Polymer.Gestures = Gestures;

})();


(function() {

  'use strict';

  /**
   * @const {Polymer.Gestures}
   */
  const gestures = Polymer.Gestures;

  /**
   * Element class mixin that provides API for adding Polymer's cross-platform
   * gesture events to nodes.
   *
   * The API is designed to be compatible with override points implemented
   * in `Polymer.TemplateStamp` such that declarative event listeners in
   * templates will support gesture events when this mixin is applied along with
   * `Polymer.TemplateStamp`.
   *
   * @mixinFunction
   * @polymer
   * @memberof Polymer
   * @summary Element class mixin that provides API for adding Polymer's cross-platform
   * gesture events to nodes
   */
  Polymer.GestureEventListeners = Polymer.dedupingMixin(superClass => {

    /**
     * @polymer
     * @mixinClass
     * @implements {Polymer_GestureEventListeners}
     */
    class GestureEventListeners extends superClass {

      /**
       * Add the event listener to the node if it is a gestures event.
       *
       * @param {!Node} node Node to add event listener to
       * @param {string} eventName Name of event
       * @param {function(!Event):void} handler Listener function to add
       * @return {void}
       */
      _addEventListenerToNode(node, eventName, handler) {
        if (!gestures.addListener(node, eventName, handler)) {
          super._addEventListenerToNode(node, eventName, handler);
        }
      }

      /**
       * Remove the event listener to the node if it is a gestures event.
       *
       * @param {!Node} node Node to remove event listener from
       * @param {string} eventName Name of event
       * @param {function(!Event):void} handler Listener function to remove
       * @return {void}
       */
      _removeEventListenerFromNode(node, eventName, handler) {
        if (!gestures.removeListener(node, eventName, handler)) {
          super._removeEventListenerFromNode(node, eventName, handler);
        }
      }

    }

    return GestureEventListeners;

  });

})();


  (function() {
    'use strict';

    const HOST_DIR = /:host\(:dir\((ltr|rtl)\)\)/g;
    const HOST_DIR_REPLACMENT = ':host([dir="$1"])';

    const EL_DIR = /([\s\w-#\.\[\]\*]*):dir\((ltr|rtl)\)/g;
    const EL_DIR_REPLACMENT = ':host([dir="$2"]) $1';

    const DIR_CHECK = /:dir\((?:ltr|rtl)\)/;
    
    const SHIM_SHADOW = Boolean(window['ShadyDOM'] && window['ShadyDOM']['inUse']);

    /**
     * @type {!Array<!Polymer_DirMixin>}
     */
    const DIR_INSTANCES = [];

    /** @type {MutationObserver} */
    let observer = null;

    let DOCUMENT_DIR = '';

    function getRTL() {
      DOCUMENT_DIR = document.documentElement.getAttribute('dir');
    }

    /**
     * @param {!Polymer_DirMixin} instance Instance to set RTL status on
     */
    function setRTL(instance) {
      if (!instance.__autoDirOptOut) {
        const el = /** @type {!HTMLElement} */(instance);
        el.setAttribute('dir', DOCUMENT_DIR);
      }
    }

    function updateDirection() {
      getRTL();
      DOCUMENT_DIR = document.documentElement.getAttribute('dir');
      for (let i = 0; i < DIR_INSTANCES.length; i++) {
        setRTL(DIR_INSTANCES[i]);
      }
    }

    function takeRecords() {
      if (observer && observer.takeRecords().length) {
        updateDirection();
      }
    }

    /**
     * Element class mixin that allows elements to use the `:dir` CSS Selector to have
     * text direction specific styling.
     *
     * With this mixin, any stylesheet provided in the template will transform `:dir` into
     * `:host([dir])` and sync direction with the page via the element's `dir` attribute.
     *
     * Elements can opt out of the global page text direction by setting the `dir` attribute
     * directly in `ready()` or in HTML.
     *
     * Caveats:
     * - Applications must set `<html dir="ltr">` or `<html dir="rtl">` to sync direction
     * - Automatic left-to-right or right-to-left styling is sync'd with the `<html>` element only.
     * - Changing `dir` at runtime is supported.
     * - Opting out of the global direction styling is permanent
     *
     * @mixinFunction
     * @polymer
     * @appliesMixin Polymer.PropertyAccessors
     * @memberof Polymer
     */
    Polymer.DirMixin = Polymer.dedupingMixin((base) => {

      if (!SHIM_SHADOW) {
        if (!observer) {
          getRTL();
          observer = new MutationObserver(updateDirection);
          observer.observe(document.documentElement, {attributes: true, attributeFilter: ['dir']});
        }
      }

      /**
       * @constructor
       * @extends {base}
       * @implements {Polymer_PropertyAccessors}
       * @private
       */
      const elementBase = Polymer.PropertyAccessors(base);

      /**
       * @polymer
       * @mixinClass
       * @implements {Polymer_DirMixin}
       */
      class Dir extends elementBase {

        /**
         * @override
         * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do
         */
        static _processStyleText(cssText, baseURI) {
          cssText = super._processStyleText(cssText, baseURI);
          if (!SHIM_SHADOW && DIR_CHECK.test(cssText)) {
            cssText = this._replaceDirInCssText(cssText);
            this.__activateDir = true;
          }
          return cssText;
        }

        /**
         * Replace `:dir` in the given CSS text
         *
         * @param {string} text CSS text to replace DIR
         * @return {string} Modified CSS
         */
        static _replaceDirInCssText(text) {
          let replacedText = text;
          replacedText = replacedText.replace(HOST_DIR, HOST_DIR_REPLACMENT);
          replacedText = replacedText.replace(EL_DIR, EL_DIR_REPLACMENT);
          return replacedText;
        }

        constructor() {
          super();
          /** @type {boolean} */
          this.__autoDirOptOut = false;
        }

        /**
         * @suppress {invalidCasts} Closure doesn't understand that `this` is an HTMLElement
         * @return {void}
         */
        ready() {
          super.ready();
          this.__autoDirOptOut = /** @type {!HTMLElement} */(this).hasAttribute('dir');
        }

        /**
         * @suppress {missingProperties} If it exists on elementBase, it can be super'd
         * @return {void}
         */
        connectedCallback() {
          if (elementBase.prototype.connectedCallback) {
            super.connectedCallback();
          }
          if (this.constructor.__activateDir) {
            takeRecords();
            DIR_INSTANCES.push(this);
            setRTL(this);
          }
        }

        /**
         * @suppress {missingProperties} If it exists on elementBase, it can be super'd
         * @return {void}
         */
        disconnectedCallback() {
          if (elementBase.prototype.disconnectedCallback) {
            super.disconnectedCallback();
          }
          if (this.constructor.__activateDir) {
            const idx = DIR_INSTANCES.indexOf(this);
            if (idx > -1) {
              DIR_INSTANCES.splice(idx, 1);
            }
          }
        }
      }

      Dir.__activateDir = false;

      return Dir;
    });
  })();



(function() {

  'use strict';

  // run a callback when HTMLImports are ready or immediately if
  // this api is not available.
  function whenImportsReady(cb) {
    if (window.HTMLImports) {
      HTMLImports.whenReady(cb);
    } else {
      cb();
    }
  }

  /**
   * Convenience method for importing an HTML document imperatively.
   *
   * This method creates a new `<link rel="import">` element with
   * the provided URL and appends it to the document to start loading.
   * In the `onload` callback, the `import` property of the `link`
   * element will contain the imported document contents.
   *
   * @memberof Polymer
   * @param {string} href URL to document to load.
   * @param {?function(!Event):void=} onload Callback to notify when an import successfully
   *   loaded.
   * @param {?function(!ErrorEvent):void=} onerror Callback to notify when an import
   *   unsuccessfully loaded.
   * @param {boolean=} optAsync True if the import should be loaded `async`.
   *   Defaults to `false`.
   * @return {!HTMLLinkElement} The link element for the URL to be loaded.
   */
  Polymer.importHref = function(href, onload, onerror, optAsync) {
    let link = /** @type {HTMLLinkElement} */
      (document.head.querySelector('link[href="' + href + '"][import-href]'));
    if (!link) {
      link = /** @type {HTMLLinkElement} */ (document.createElement('link'));
      link.rel = 'import';
      link.href = href;
      link.setAttribute('import-href', '');
    }
    // always ensure link has `async` attribute if user specified one,
    // even if it was previously not async. This is considered less confusing.
    if (optAsync) {
      link.setAttribute('async', '');
    }
    // NOTE: the link may now be in 3 states: (1) pending insertion,
    // (2) inflight, (3) already loaded. In each case, we need to add
    // event listeners to process callbacks.
    let cleanup = function() {
      link.removeEventListener('load', loadListener);
      link.removeEventListener('error', errorListener);
    };
    let loadListener = function(event) {
      cleanup();
      // In case of a successful load, cache the load event on the link so
      // that it can be used to short-circuit this method in the future when
      // it is called with the same href param.
      link.__dynamicImportLoaded = true;
      if (onload) {
        whenImportsReady(() => {
          onload(event);
        });
      }
    };
    let errorListener = function(event) {
      cleanup();
      // In case of an error, remove the link from the document so that it
      // will be automatically created again the next time `importHref` is
      // called.
      if (link.parentNode) {
        link.parentNode.removeChild(link);
      }
      if (onerror) {
        whenImportsReady(() => {
          onerror(event);
        });
      }
    };
    link.addEventListener('load', loadListener);
    link.addEventListener('error', errorListener);
    if (link.parentNode == null) {
      document.head.appendChild(link);
    // if the link already loaded, dispatch a fake load event
    // so that listeners are called and get a proper event argument.
    } else if (link.__dynamicImportLoaded) {
      link.dispatchEvent(new Event('load'));
    }
    return link;
  };

})();


(function() {

  'use strict';

  let scheduled = false;
  let beforeRenderQueue = [];
  let afterRenderQueue = [];

  function schedule() {
    scheduled = true;
    // before next render
    requestAnimationFrame(function() {
      scheduled = false;
      flushQueue(beforeRenderQueue);
      // after the render
      setTimeout(function() {
        runQueue(afterRenderQueue);
      });
    });
  }

  function flushQueue(queue) {
    while (queue.length) {
      callMethod(queue.shift());
    }
  }

  function runQueue(queue) {
    for (let i=0, l=queue.length; i < l; i++) {
      callMethod(queue.shift());
    }
  }

  function callMethod(info) {
    const context = info[0];
    const callback = info[1];
    const args = info[2];
    try {
      callback.apply(context, args);
    } catch(e) {
      setTimeout(() => {
        throw e;
      });
    }
  }

  function flush() {
    while (beforeRenderQueue.length || afterRenderQueue.length) {
      flushQueue(beforeRenderQueue);
      flushQueue(afterRenderQueue);
    }
    scheduled = false;
  }

  /**
   * Module for scheduling flushable pre-render and post-render tasks.
   *
   * @namespace
   * @memberof Polymer
   * @summary Module for scheduling flushable pre-render and post-render tasks.
   */
  Polymer.RenderStatus = {

    /**
     * Enqueues a callback which will be run before the next render, at
     * `requestAnimationFrame` timing.
     *
     * This method is useful for enqueuing work that requires DOM measurement,
     * since measurement may not be reliable in custom element callbacks before
     * the first render, as well as for batching measurement tasks in general.
     *
     * Tasks in this queue may be flushed by calling `Polymer.RenderStatus.flush()`.
     *
     * @memberof Polymer.RenderStatus
     * @param {*} context Context object the callback function will be bound to
     * @param {function(...*):void} callback Callback function
     * @param {!Array=} args An array of arguments to call the callback function with
     * @return {void}
     */
    beforeNextRender: function(context, callback, args) {
      if (!scheduled) {
        schedule();
      }
      beforeRenderQueue.push([context, callback, args]);
    },

    /**
     * Enqueues a callback which will be run after the next render, equivalent
     * to one task (`setTimeout`) after the next `requestAnimationFrame`.
     *
     * This method is useful for tuning the first-render performance of an
     * element or application by deferring non-critical work until after the
     * first paint.  Typical non-render-critical work may include adding UI
     * event listeners and aria attributes.
     *
     * @memberof Polymer.RenderStatus
     * @param {*} context Context object the callback function will be bound to
     * @param {function(...*):void} callback Callback function
     * @param {!Array=} args An array of arguments to call the callback function with
     * @return {void}
     */
    afterNextRender: function(context, callback, args) {
      if (!scheduled) {
        schedule();
      }
      afterRenderQueue.push([context, callback, args]);
    },

    /**
     * Flushes all `beforeNextRender` tasks, followed by all `afterNextRender`
     * tasks.
     *
     * @memberof Polymer.RenderStatus
     * @return {void}
     */
    flush: flush

  };

})();


(function() {
  'use strict';

  // unresolved

  function resolve() {
    document.body.removeAttribute('unresolved');
  }

  if (window.WebComponents) {
    window.addEventListener('WebComponentsReady', resolve);
  } else {
    if (document.readyState === 'interactive' || document.readyState === 'complete') {
      resolve();
    } else {
      window.addEventListener('DOMContentLoaded', resolve);
    }
  }

})();


(function() {

  'use strict';

  function newSplice(index, removed, addedCount) {
    return {
      index: index,
      removed: removed,
      addedCount: addedCount
    };
  }

  const EDIT_LEAVE = 0;
  const EDIT_UPDATE = 1;
  const EDIT_ADD = 2;
  const EDIT_DELETE = 3;

  // Note: This function is *based* on the computation of the Levenshtein
  // "edit" distance. The one change is that "updates" are treated as two
  // edits - not one. With Array splices, an update is really a delete
  // followed by an add. By retaining this, we optimize for "keeping" the
  // maximum array items in the original array. For example:
  //
  //   'xxxx123' -> '123yyyy'
  //
  // With 1-edit updates, the shortest path would be just to update all seven
  // characters. With 2-edit updates, we delete 4, leave 3, and add 4. This
  // leaves the substring '123' intact.
  function calcEditDistances(current, currentStart, currentEnd,
                              old, oldStart, oldEnd) {
    // "Deletion" columns
    let rowCount = oldEnd - oldStart + 1;
    let columnCount = currentEnd - currentStart + 1;
    let distances = new Array(rowCount);

    // "Addition" rows. Initialize null column.
    for (let i = 0; i < rowCount; i++) {
      distances[i] = new Array(columnCount);
      distances[i][0] = i;
    }

    // Initialize null row
    for (let j = 0; j < columnCount; j++)
      distances[0][j] = j;

    for (let i = 1; i < rowCount; i++) {
      for (let j = 1; j < columnCount; j++) {
        if (equals(current[currentStart + j - 1], old[oldStart + i - 1]))
          distances[i][j] = distances[i - 1][j - 1];
        else {
          let north = distances[i - 1][j] + 1;
          let west = distances[i][j - 1] + 1;
          distances[i][j] = north < west ? north : west;
        }
      }
    }

    return distances;
  }

  // This starts at the final weight, and walks "backward" by finding
  // the minimum previous weight recursively until the origin of the weight
  // matrix.
  function spliceOperationsFromEditDistances(distances) {
    let i = distances.length - 1;
    let j = distances[0].length - 1;
    let current = distances[i][j];
    let edits = [];
    while (i > 0 || j > 0) {
      if (i == 0) {
        edits.push(EDIT_ADD);
        j--;
        continue;
      }
      if (j == 0) {
        edits.push(EDIT_DELETE);
        i--;
        continue;
      }
      let northWest = distances[i - 1][j - 1];
      let west = distances[i - 1][j];
      let north = distances[i][j - 1];

      let min;
      if (west < north)
        min = west < northWest ? west : northWest;
      else
        min = north < northWest ? north : northWest;

      if (min == northWest) {
        if (northWest == current) {
          edits.push(EDIT_LEAVE);
        } else {
          edits.push(EDIT_UPDATE);
          current = northWest;
        }
        i--;
        j--;
      } else if (min == west) {
        edits.push(EDIT_DELETE);
        i--;
        current = west;
      } else {
        edits.push(EDIT_ADD);
        j--;
        current = north;
      }
    }

    edits.reverse();
    return edits;
  }

  /**
   * Splice Projection functions:
   *
   * A splice map is a representation of how a previous array of items
   * was transformed into a new array of items. Conceptually it is a list of
   * tuples of
   *
   *   <index, removed, addedCount>
   *
   * which are kept in ascending index order of. The tuple represents that at
   * the |index|, |removed| sequence of items were removed, and counting forward
   * from |index|, |addedCount| items were added.
   */

  /**
   * Lacking individual splice mutation information, the minimal set of
   * splices can be synthesized given the previous state and final state of an
   * array. The basic approach is to calculate the edit distance matrix and
   * choose the shortest path through it.
   *
   * Complexity: O(l * p)
   *   l: The length of the current array
   *   p: The length of the old array
   *
   * @param {!Array} current The current "changed" array for which to
   * calculate splices.
   * @param {number} currentStart Starting index in the `current` array for
   * which splices are calculated.
   * @param {number} currentEnd Ending index in the `current` array for
   * which splices are calculated.
   * @param {!Array} old The original "unchanged" array to compare `current`
   * against to determine splices.
   * @param {number} oldStart Starting index in the `old` array for
   * which splices are calculated.
   * @param {number} oldEnd Ending index in the `old` array for
   * which splices are calculated.
   * @return {!Array} Returns an array of splice record objects. Each of these
   * contains: `index` the location where the splice occurred; `removed`
   * the array of removed items from this location; `addedCount` the number
   * of items added at this location.
   */
  function calcSplices(current, currentStart, currentEnd,
                        old, oldStart, oldEnd) {
    let prefixCount = 0;
    let suffixCount = 0;
    let splice;

    let minLength = Math.min(currentEnd - currentStart, oldEnd - oldStart);
    if (currentStart == 0 && oldStart == 0)
      prefixCount = sharedPrefix(current, old, minLength);

    if (currentEnd == current.length && oldEnd == old.length)
      suffixCount = sharedSuffix(current, old, minLength - prefixCount);

    currentStart += prefixCount;
    oldStart += prefixCount;
    currentEnd -= suffixCount;
    oldEnd -= suffixCount;

    if (currentEnd - currentStart == 0 && oldEnd - oldStart == 0)
      return [];

    if (currentStart == currentEnd) {
      splice = newSplice(currentStart, [], 0);
      while (oldStart < oldEnd)
        splice.removed.push(old[oldStart++]);

      return [ splice ];
    } else if (oldStart == oldEnd)
      return [ newSplice(currentStart, [], currentEnd - currentStart) ];

    let ops = spliceOperationsFromEditDistances(
        calcEditDistances(current, currentStart, currentEnd,
                               old, oldStart, oldEnd));

    splice = undefined;
    let splices = [];
    let index = currentStart;
    let oldIndex = oldStart;
    for (let i = 0; i < ops.length; i++) {
      switch(ops[i]) {
        case EDIT_LEAVE:
          if (splice) {
            splices.push(splice);
            splice = undefined;
          }

          index++;
          oldIndex++;
          break;
        case EDIT_UPDATE:
          if (!splice)
            splice = newSplice(index, [], 0);

          splice.addedCount++;
          index++;

          splice.removed.push(old[oldIndex]);
          oldIndex++;
          break;
        case EDIT_ADD:
          if (!splice)
            splice = newSplice(index, [], 0);

          splice.addedCount++;
          index++;
          break;
        case EDIT_DELETE:
          if (!splice)
            splice = newSplice(index, [], 0);

          splice.removed.push(old[oldIndex]);
          oldIndex++;
          break;
      }
    }

    if (splice) {
      splices.push(splice);
    }
    return splices;
  }

  function sharedPrefix(current, old, searchLength) {
    for (let i = 0; i < searchLength; i++)
      if (!equals(current[i], old[i]))
        return i;
    return searchLength;
  }

  function sharedSuffix(current, old, searchLength) {
    let index1 = current.length;
    let index2 = old.length;
    let count = 0;
    while (count < searchLength && equals(current[--index1], old[--index2]))
      count++;

    return count;
  }

  function calculateSplices(current, previous) {
    return calcSplices(current, 0, current.length, previous, 0,
                            previous.length);
  }

  function equals(currentValue, previousValue) {
    return currentValue === previousValue;
  }

  /**
   * @namespace
   * @memberof Polymer
   * @summary Module that provides utilities for diffing arrays.
   */
  Polymer.ArraySplice = {
    /**
     * Returns an array of splice records indicating the minimum edits required
     * to transform the `previous` array into the `current` array.
     *
     * Splice records are ordered by index and contain the following fields:
     * - `index`: index where edit started
     * - `removed`: array of removed items from this index
     * - `addedCount`: number of items added at this index
     *
     * This function is based on the Levenshtein "minimum edit distance"
     * algorithm. Note that updates are treated as removal followed by addition.
     *
     * The worst-case time complexity of this algorithm is `O(l * p)`
     *   l: The length of the current array
     *   p: The length of the previous array
     *
     * However, the worst-case complexity is reduced by an `O(n)` optimization
     * to detect any shared prefix & suffix between the two arrays and only
     * perform the more expensive minimum edit distance calculation over the
     * non-shared portions of the arrays.
     *
     * @function
     * @memberof Polymer.ArraySplice
     * @param {!Array} current The "changed" array for which splices will be
     * calculated.
     * @param {!Array} previous The "unchanged" original array to compare
     * `current` against to determine the splices.
     * @return {!Array} Returns an array of splice record objects. Each of these
     * contains: `index` the location where the splice occurred; `removed`
     * the array of removed items from this location; `addedCount` the number
     * of items added at this location.
     */
    calculateSplices
  };

})();


(function() {
  'use strict';

  /**
   * Returns true if `node` is a slot element
   * @param {Node} node Node to test.
   * @return {boolean} Returns true if the given `node` is a slot
   * @private
   */
  function isSlot(node) {
    return (node.localName === 'slot');
  }

  /**
   * Class that listens for changes (additions or removals) to
   * "flattened nodes" on a given `node`. The list of flattened nodes consists
   * of a node's children and, for any children that are `<slot>` elements,
   * the expanded flattened list of `assignedNodes`.
   * For example, if the observed node has children `<a></a><slot></slot><b></b>`
   * and the `<slot>` has one `<div>` assigned to it, then the flattened
   * nodes list is `<a></a><div></div><b></b>`. If the `<slot>` has other
   * `<slot>` elements assigned to it, these are flattened as well.
   *
   * The provided `callback` is called whenever any change to this list
   * of flattened nodes occurs, where an addition or removal of a node is
   * considered a change. The `callback` is called with one argument, an object
   * containing an array of any `addedNodes` and `removedNodes`.
   *
   * Note: the callback is called asynchronous to any changes
   * at a microtask checkpoint. This is because observation is performed using
   * `MutationObserver` and the `<slot>` element's `slotchange` event which
   * are asynchronous.
   *
   * An example:
   * ```js
   * class TestSelfObserve extends Polymer.Element {
   *   static get is() { return 'test-self-observe';}
   *   connectedCallback() {
   *     super.connectedCallback();
   *     this._observer = new Polymer.FlattenedNodesObserver(this, (info) => {
   *       this.info = info;
   *     });
   *   }
   *   disconnectedCallback() {
   *     super.disconnectedCallback();
   *     this._observer.disconnect();
   *   }
   * }
   * customElements.define(TestSelfObserve.is, TestSelfObserve);
   * ```
   *
   * @memberof Polymer
   * @summary Class that listens for changes (additions or removals) to
   * "flattened nodes" on a given `node`.
   */
  class FlattenedNodesObserver {

    /**
     * Returns the list of flattened nodes for the given `node`.
     * This list consists of a node's children and, for any children
     * that are `<slot>` elements, the expanded flattened list of `assignedNodes`.
     * For example, if the observed node has children `<a></a><slot></slot><b></b>`
     * and the `<slot>` has one `<div>` assigned to it, then the flattened
     * nodes list is `<a></a><div></div><b></b>`. If the `<slot>` has other
     * `<slot>` elements assigned to it, these are flattened as well.
     *
     * @param {HTMLElement|HTMLSlotElement} node The node for which to return the list of flattened nodes.
     * @return {Array} The list of flattened nodes for the given `node`.
    */
    static getFlattenedNodes(node) {
      if (isSlot(node)) {
        node = /** @type {HTMLSlotElement} */(node); // eslint-disable-line no-self-assign
        return node.assignedNodes({flatten: true});
      } else {
        return Array.from(node.childNodes).map((node) => {
          if (isSlot(node)) {
            node = /** @type {HTMLSlotElement} */(node); // eslint-disable-line no-self-assign
            return node.assignedNodes({flatten: true});
          } else {
            return [node];
          }
        }).reduce((a, b) => a.concat(b), []);
      }
    }

    /**
     * @param {Element} target Node on which to listen for changes.
     * @param {?function(!Element, { target: !Element, addedNodes: !Array<!Element>, removedNodes: !Array<!Element> }):void} callback Function called when there are additions
     * or removals from the target's list of flattened nodes.
    */
    constructor(target, callback) {
      /**
       * @type {MutationObserver}
       * @private
       */
      this._shadyChildrenObserver = null;
      /**
       * @type {MutationObserver}
       * @private
       */
      this._nativeChildrenObserver = null;
      this._connected = false;
      /**
       * @type {Element}
       * @private
       */
      this._target = target;
      this.callback = callback;
      this._effectiveNodes = [];
      this._observer = null;
      this._scheduled = false;
      /**
       * @type {function()}
       * @private
       */
      this._boundSchedule = () => {
        this._schedule();
      };
      this.connect();
      this._schedule();
    }

    /**
     * Activates an observer. This method is automatically called when
     * a `FlattenedNodesObserver` is created. It should only be called to
     * re-activate an observer that has been deactivated via the `disconnect` method.
     *
     * @return {void}
     */
    connect() {
      if (isSlot(this._target)) {
        this._listenSlots([this._target]);
      } else if (this._target.children) {
        this._listenSlots(this._target.children);
        if (window.ShadyDOM) {
          this._shadyChildrenObserver =
            ShadyDOM.observeChildren(this._target, (mutations) => {
              this._processMutations(mutations);
            });
        } else {
          this._nativeChildrenObserver =
            new MutationObserver((mutations) => {
              this._processMutations(mutations);
            });
          this._nativeChildrenObserver.observe(this._target, {childList: true});
        }
      }
      this._connected = true;
    }

    /**
     * Deactivates the flattened nodes observer. After calling this method
     * the observer callback will not be called when changes to flattened nodes
     * occur. The `connect` method may be subsequently called to reactivate
     * the observer.
     *
     * @return {void}
     */
    disconnect() {
      if (isSlot(this._target)) {
        this._unlistenSlots([this._target]);
      } else if (this._target.children) {
        this._unlistenSlots(this._target.children);
        if (window.ShadyDOM && this._shadyChildrenObserver) {
          ShadyDOM.unobserveChildren(this._shadyChildrenObserver);
          this._shadyChildrenObserver = null;
        } else if (this._nativeChildrenObserver) {
          this._nativeChildrenObserver.disconnect();
          this._nativeChildrenObserver = null;
        }
      }
      this._connected = false;
    }

    /**
     * @return {void}
     * @private
     */
    _schedule() {
      if (!this._scheduled) {
        this._scheduled = true;
        Polymer.Async.microTask.run(() => this.flush());
      }
    }

    /**
     * @param {Array<MutationRecord>} mutations Mutations signaled by the mutation observer
     * @return {void}
     * @private
     */
    _processMutations(mutations) {
      this._processSlotMutations(mutations);
      this.flush();
    }

    /**
     * @param {Array<MutationRecord>} mutations Mutations signaled by the mutation observer
     * @return {void}
     * @private
     */
    _processSlotMutations(mutations) {
      if (mutations) {
        for (let i=0; i < mutations.length; i++) {
          let mutation = mutations[i];
          if (mutation.addedNodes) {
            this._listenSlots(mutation.addedNodes);
          }
          if (mutation.removedNodes) {
            this._unlistenSlots(mutation.removedNodes);
          }
        }
      }
    }

    /**
     * Flushes the observer causing any pending changes to be immediately
     * delivered the observer callback. By default these changes are delivered
     * asynchronously at the next microtask checkpoint.
     *
     * @return {boolean} Returns true if any pending changes caused the observer
     * callback to run.
     */
    flush() {
      if (!this._connected) {
        return false;
      }
      if (window.ShadyDOM) {
        ShadyDOM.flush();
      }
      if (this._nativeChildrenObserver) {
        this._processSlotMutations(this._nativeChildrenObserver.takeRecords());
      } else if (this._shadyChildrenObserver) {
        this._processSlotMutations(this._shadyChildrenObserver.takeRecords());
      }
      this._scheduled = false;
      let info = {
        target: this._target,
        addedNodes: [],
        removedNodes: []
      };
      let newNodes = this.constructor.getFlattenedNodes(this._target);
      let splices = Polymer.ArraySplice.calculateSplices(newNodes,
        this._effectiveNodes);
      // process removals
      for (let i=0, s; (i<splices.length) && (s=splices[i]); i++) {
        for (let j=0, n; (j < s.removed.length) && (n=s.removed[j]); j++) {
          info.removedNodes.push(n);
        }
      }
      // process adds
      for (let i=0, s; (i<splices.length) && (s=splices[i]); i++) {
        for (let j=s.index; j < s.index + s.addedCount; j++) {
          info.addedNodes.push(newNodes[j]);
        }
      }
      // update cache
      this._effectiveNodes = newNodes;
      let didFlush = false;
      if (info.addedNodes.length || info.removedNodes.length) {
        didFlush = true;
        this.callback.call(this._target, info);
      }
      return didFlush;
    }

    /**
     * @param {!Array<Element|Node>|!NodeList<Node>} nodeList Nodes that could change
     * @return {void}
     * @private
     */
    _listenSlots(nodeList) {
      for (let i=0; i < nodeList.length; i++) {
        let n = nodeList[i];
        if (isSlot(n)) {
          n.addEventListener('slotchange', this._boundSchedule);
        }
      }
    }

    /**
     * @param {!Array<Element|Node>|!NodeList<Node>} nodeList Nodes that could change
     * @return {void}
     * @private
     */
    _unlistenSlots(nodeList) {
      for (let i=0; i < nodeList.length; i++) {
        let n = nodeList[i];
        if (isSlot(n)) {
          n.removeEventListener('slotchange', this._boundSchedule);
        }
      }
    }

  }

  Polymer.FlattenedNodesObserver = FlattenedNodesObserver;

})();


(function() {
  'use strict';

  let debouncerQueue = [];

  /**
   * Adds a `Polymer.Debouncer` to a list of globally flushable tasks.
   *
   * @memberof Polymer
   * @param {!Polymer.Debouncer} debouncer Debouncer to enqueue
   * @return {void}
   */
  Polymer.enqueueDebouncer = function(debouncer) {
    debouncerQueue.push(debouncer);
  };

  function flushDebouncers() {
    const didFlush = Boolean(debouncerQueue.length);
    while (debouncerQueue.length) {
      try {
        debouncerQueue.shift().flush();
      } catch(e) {
        setTimeout(() => {
          throw e;
        });
      }
    }
    return didFlush;
  }

  /**
   * Forces several classes of asynchronously queued tasks to flush:
   * - Debouncers added via `enqueueDebouncer`
   * - ShadyDOM distribution
   *
   * @memberof Polymer
   * @return {void}
   */
  Polymer.flush = function() {
    let shadyDOM, debouncers;
    do {
      shadyDOM = window.ShadyDOM && ShadyDOM.flush();
      if (window.ShadyCSS && window.ShadyCSS.ScopingShim) {
        window.ShadyCSS.ScopingShim.flush();
      }
      debouncers = flushDebouncers();
    } while (shadyDOM || debouncers);
  };

})();


(function() {
  'use strict';

  const p = Element.prototype;
  /**
   * @const {function(this:Node, string): boolean}
   */
  const normalizedMatchesSelector = p.matches || p.matchesSelector ||
    p.mozMatchesSelector || p.msMatchesSelector ||
    p.oMatchesSelector || p.webkitMatchesSelector;

  /**
   * Cross-platform `element.matches` shim.
   *
   * @function matchesSelector
   * @memberof Polymer.dom
   * @param {!Node} node Node to check selector against
   * @param {string} selector Selector to match
   * @return {boolean} True if node matched selector
   */
  const matchesSelector = function(node, selector) {
    return normalizedMatchesSelector.call(node, selector);
  };

  /**
   * Node API wrapper class returned from `Polymer.dom.(target)` when
   * `target` is a `Node`.
   *
   * @memberof Polymer
   */
  class DomApi {

    /**
     * @param {Node} node Node for which to create a Polymer.dom helper object.
     */
    constructor(node) {
      this.node = node;
    }

    /**
     * Returns an instance of `Polymer.FlattenedNodesObserver` that
     * listens for node changes on this element.
     *
     * @param {function(!Element, { target: !Element, addedNodes: !Array<!Element>, removedNodes: !Array<!Element> }):void} callback Called when direct or distributed children
     *   of this element changes
     * @return {!Polymer.FlattenedNodesObserver} Observer instance
     */
    observeNodes(callback) {
      return new Polymer.FlattenedNodesObserver(this.node, callback);
    }

    /**
     * Disconnects an observer previously created via `observeNodes`
     *
     * @param {!Polymer.FlattenedNodesObserver} observerHandle Observer instance
     *   to disconnect.
     * @return {void}
     */
    unobserveNodes(observerHandle) {
      observerHandle.disconnect();
    }

    /**
     * Provided as a backwards-compatible API only.  This method does nothing.
     * @return {void}
     */
    notifyObserver() {}

    /**
     * Returns true if the provided node is contained with this element's
     * light-DOM children or shadow root, including any nested shadow roots
     * of children therein.
     *
     * @param {Node} node Node to test
     * @return {boolean} Returns true if the given `node` is contained within
     *   this element's light or shadow DOM.
     */
    deepContains(node) {
      if (this.node.contains(node)) {
        return true;
      }
      let n = node;
      let doc = node.ownerDocument;
      // walk from node to `this` or `document`
      while (n && n !== doc && n !== this.node) {
        // use logical parentnode, or native ShadowRoot host
        n = n.parentNode || n.host;
      }
      return n === this.node;
    }

    /**
     * Returns the root node of this node.  Equivalent to `getRoodNode()`.
     *
     * @return {Node} Top most element in the dom tree in which the node
     * exists. If the node is connected to a document this is either a
     * shadowRoot or the document; otherwise, it may be the node
     * itself or a node or document fragment containing it.
     */
    getOwnerRoot() {
      return this.node.getRootNode();
    }

    /**
     * For slot elements, returns the nodes assigned to the slot; otherwise
     * an empty array. It is equivalent to `<slot>.addignedNodes({flatten:true})`.
     *
     * @return {!Array<!Node>} Array of assigned nodes
     */
    getDistributedNodes() {
      return (this.node.localName === 'slot') ?
        this.node.assignedNodes({flatten: true}) :
        [];
    }

    /**
     * Returns an array of all slots this element was distributed to.
     *
     * @return {!Array<!HTMLSlotElement>} Description
     */
    getDestinationInsertionPoints() {
      let ip$ = [];
      let n = this.node.assignedSlot;
      while (n) {
        ip$.push(n);
        n = n.assignedSlot;
      }
      return ip$;
    }

    /**
     * Calls `importNode` on the `ownerDocument` for this node.
     *
     * @param {!Node} node Node to import
     * @param {boolean} deep True if the node should be cloned deeply during
     *   import
     * @return {Node} Clone of given node imported to this owner document
     */
    importNode(node, deep) {
      let doc = this.node instanceof Document ? this.node :
        this.node.ownerDocument;
      return doc.importNode(node, deep);
    }

    /**
     * @return {!Array<!Node>} Returns a flattened list of all child nodes and
     * nodes assigned to child slots.
     */
    getEffectiveChildNodes() {
      return Polymer.FlattenedNodesObserver.getFlattenedNodes(this.node);
    }

    /**
     * Returns a filtered list of flattened child elements for this element based
     * on the given selector.
     *
     * @param {string} selector Selector to filter nodes against
     * @return {!Array<!HTMLElement>} List of flattened child elements
     */
    queryDistributedElements(selector) {
      let c$ = this.getEffectiveChildNodes();
      let list = [];
      for (let i=0, l=c$.length, c; (i<l) && (c=c$[i]); i++) {
        if ((c.nodeType === Node.ELEMENT_NODE) &&
            matchesSelector(c, selector)) {
          list.push(c);
        }
      }
      return list;
    }

    /**
     * For shadow roots, returns the currently focused element within this
     * shadow root.
     *
     * @return {Node|undefined} Currently focused element
     */
    get activeElement() {
      let node = this.node;
      return node._activeElement !== undefined ? node._activeElement : node.activeElement;
    }
  }

  function forwardMethods(proto, methods) {
    for (let i=0; i < methods.length; i++) {
      let method = methods[i];
      /* eslint-disable valid-jsdoc */
      proto[method] = /** @this {DomApi} */ function() {
        return this.node[method].apply(this.node, arguments);
      };
      /* eslint-enable */
    }
  }

  function forwardReadOnlyProperties(proto, properties) {
    for (let i=0; i < properties.length; i++) {
      let name = properties[i];
      Object.defineProperty(proto, name, {
        get: function() {
          const domApi = /** @type {DomApi} */(this);
          return domApi.node[name];
        },
        configurable: true
      });
    }
  }

  function forwardProperties(proto, properties) {
    for (let i=0; i < properties.length; i++) {
      let name = properties[i];
      Object.defineProperty(proto, name, {
        get: function() {
          const domApi = /** @type {DomApi} */(this);
          return domApi.node[name];
        },
        set: function(value) {
          /** @type {DomApi} */ (this).node[name] = value;
        },
        configurable: true
      });
    }
  }

  forwardMethods(DomApi.prototype, [
    'cloneNode', 'appendChild', 'insertBefore', 'removeChild',
    'replaceChild', 'setAttribute', 'removeAttribute',
    'querySelector', 'querySelectorAll'
  ]);

  forwardReadOnlyProperties(DomApi.prototype, [
    'parentNode', 'firstChild', 'lastChild',
    'nextSibling', 'previousSibling', 'firstElementChild',
    'lastElementChild', 'nextElementSibling', 'previousElementSibling',
    'childNodes', 'children', 'classList'
  ]);

  forwardProperties(DomApi.prototype, [
    'textContent', 'innerHTML'
  ]);


  /**
   * Event API wrapper class returned from `Polymer.dom.(target)` when
   * `target` is an `Event`.
   */
  class EventApi {
    constructor(event) {
      this.event = event;
    }

    /**
     * Returns the first node on the `composedPath` of this event.
     *
     * @return {!EventTarget} The node this event was dispatched to
     */
    get rootTarget() {
      return this.event.composedPath()[0];
    }

    /**
     * Returns the local (re-targeted) target for this event.
     *
     * @return {!EventTarget} The local (re-targeted) target for this event.
     */
    get localTarget() {
      return this.event.target;
    }

    /**
     * Returns the `composedPath` for this event.
     * @return {!Array<!EventTarget>} The nodes this event propagated through
     */
    get path() {
      return this.event.composedPath();
    }
  }

  Polymer.DomApi = DomApi;

  /**
   * @function
   * @param {boolean=} deep
   * @return {!Node}
   */
  Polymer.DomApi.prototype.cloneNode;
  /**
   * @function
   * @param {!Node} node
   * @return {!Node}
   */
  Polymer.DomApi.prototype.appendChild;
  /**
   * @function
   * @param {!Node} newChild
   * @param {Node} refChild
   * @return {!Node}
   */
  Polymer.DomApi.prototype.insertBefore;
  /**
   * @function
   * @param {!Node} node
   * @return {!Node}
   */
  Polymer.DomApi.prototype.removeChild;
  /**
   * @function
   * @param {!Node} oldChild
   * @param {!Node} newChild
   * @return {!Node}
   */
  Polymer.DomApi.prototype.replaceChild;
  /**
   * @function
   * @param {string} name
   * @param {string} value
   * @return {void}
   */
  Polymer.DomApi.prototype.setAttribute;
  /**
   * @function
   * @param {string} name
   * @return {void}
   */
  Polymer.DomApi.prototype.removeAttribute;
  /**
   * @function
   * @param {string} selector
   * @return {?Element}
   */
  Polymer.DomApi.prototype.querySelector;
  /**
   * @function
   * @param {string} selector
   * @return {!NodeList<!Element>}
   */
  Polymer.DomApi.prototype.querySelectorAll;

  /**
   * Legacy DOM and Event manipulation API wrapper factory used to abstract
   * differences between native Shadow DOM and "Shady DOM" when polyfilling on
   * older browsers.
   *
   * Note that in Polymer 2.x use of `Polymer.dom` is no longer required and
   * in the majority of cases simply facades directly to the standard native
   * API.
   *
   * @namespace
   * @summary Legacy DOM and Event manipulation API wrapper factory used to
   * abstract differences between native Shadow DOM and "Shady DOM."
   * @memberof Polymer
   * @param {(Node|Event)=} obj Node or event to operate on
   * @return {!DomApi|!EventApi} Wrapper providing either node API or event API
   */
  Polymer.dom = function(obj) {
    obj = obj || document;
    if (!obj.__domApi) {
      let helper;
      if (obj instanceof Event) {
        helper = new EventApi(obj);
      } else {
        helper = new DomApi(obj);
      }
      obj.__domApi = helper;
    }
    return obj.__domApi;
  };

  Polymer.dom.matchesSelector = matchesSelector;

  /**
   * Forces several classes of asynchronously queued tasks to flush:
   * - Debouncers added via `Polymer.enqueueDebouncer`
   * - ShadyDOM distribution
   *
   * This method facades to `Polymer.flush`.
   *
   * @memberof Polymer.dom
   */
  Polymer.dom.flush = Polymer.flush;

  /**
   * Adds a `Polymer.Debouncer` to a list of globally flushable tasks.
   *
   * This method facades to `Polymer.enqueueDebouncer`.
   *
   * @memberof Polymer.dom
   * @param {!Polymer.Debouncer} debouncer Debouncer to enqueue
   */
  Polymer.dom.addDebouncer = Polymer.enqueueDebouncer;
})();


(function() {

  'use strict';

  let styleInterface = window.ShadyCSS;

  /**
   * Element class mixin that provides Polymer's "legacy" API intended to be
   * backward-compatible to the greatest extent possible with the API
   * found on the Polymer 1.x `Polymer.Base` prototype applied to all elements
   * defined using the `Polymer({...})` function.
   *
   * @mixinFunction
   * @polymer
   * @appliesMixin Polymer.ElementMixin
   * @appliesMixin Polymer.GestureEventListeners
   * @property isAttached {boolean} Set to `true` in this element's
   *   `connectedCallback` and `false` in `disconnectedCallback`
   * @memberof Polymer
   * @summary Element class mixin that provides Polymer's "legacy" API
   */
  Polymer.LegacyElementMixin = Polymer.dedupingMixin((base) => {

    /**
     * @constructor
     * @extends {base}
     * @implements {Polymer_ElementMixin}
     * @implements {Polymer_GestureEventListeners}
     * @implements {Polymer_DirMixin}
     * @private
     */
    const legacyElementBase = Polymer.DirMixin(Polymer.GestureEventListeners(Polymer.ElementMixin(base)));

    /**
     * Map of simple names to touch action names
     * @dict
     */
    const DIRECTION_MAP = {
      'x': 'pan-x',
      'y': 'pan-y',
      'none': 'none',
      'all': 'auto'
    };

    /**
     * @polymer
     * @mixinClass
     * @extends {legacyElementBase}
     * @implements {Polymer_LegacyElementMixin}
     * @unrestricted
     */
    class LegacyElement extends legacyElementBase {

      constructor() {
        super();
        /** @type {boolean} */
        this.isAttached;
        /** @type {WeakMap<!Element, !Object<string, !Function>>} */
        this.__boundListeners;
        /** @type {Object<string, Function>} */
        this._debouncers;
      }

      /**
       * Forwards `importMeta` from the prototype (i.e. from the info object
       * passed to `Polymer({...})`) to the static API.
       *
       * @return {!Object} The `import.meta` object set on the prototype
       * @suppress {missingProperties} `this` is always in the instance in
       *  closure for some reason even in a static method, rather than the class
       */
      static get importMeta() {
        return this.prototype.importMeta;
      }

      /**
       * Legacy callback called during the `constructor`, for overriding
       * by the user.
       * @return {void}
       */
      created() {}

      /**
       * Provides an implementation of `connectedCallback`
       * which adds Polymer legacy API's `attached` method.
       * @return {void}
       * @override
       */
      connectedCallback() {
        super.connectedCallback();
        this.isAttached = true;
        this.attached();
      }

      /**
       * Legacy callback called during `connectedCallback`, for overriding
       * by the user.
       * @return {void}
       */
      attached() {}

      /**
       * Provides an implementation of `disconnectedCallback`
       * which adds Polymer legacy API's `detached` method.
       * @return {void}
       * @override
       */
      disconnectedCallback() {
        super.disconnectedCallback();
        this.isAttached = false;
        this.detached();
      }

      /**
       * Legacy callback called during `disconnectedCallback`, for overriding
       * by the user.
       * @return {void}
       */
      detached() {}

      /**
       * Provides an override implementation of `attributeChangedCallback`
       * which adds the Polymer legacy API's `attributeChanged` method.
       * @param {string} name Name of attribute.
       * @param {?string} old Old value of attribute.
       * @param {?string} value Current value of attribute.
       * @param {?string} namespace Attribute namespace.
       * @return {void}
       * @override
       */
      attributeChangedCallback(name, old, value, namespace) {
        if (old !== value) {
          super.attributeChangedCallback(name, old, value, namespace);
          this.attributeChanged(name, old, value);
        }
      }

      /**
       * Legacy callback called during `attributeChangedChallback`, for overriding
       * by the user.
       * @param {string} name Name of attribute.
       * @param {?string} old Old value of attribute.
       * @param {?string} value Current value of attribute.
       * @return {void}
       */
      attributeChanged(name, old, value) {} // eslint-disable-line no-unused-vars

      /**
       * Overrides the default `Polymer.PropertyEffects` implementation to
       * add support for class initialization via the `_registered` callback.
       * This is called only when the first instance of the element is created.
       *
       * @return {void}
       * @override
       * @suppress {invalidCasts}
       */
      _initializeProperties() {
        let proto = Object.getPrototypeOf(this);
        if (!proto.hasOwnProperty('__hasRegisterFinished')) {
          this._registered();
          // backstop in case the `_registered` implementation does not set this
          proto.__hasRegisterFinished = true;
        }
        super._initializeProperties();
        this.root = /** @type {HTMLElement} */(this);
        this.created();
        // Ensure listeners are applied immediately so that they are
        // added before declarative event listeners. This allows an element to
        // decorate itself via an event prior to any declarative listeners
        // seeing the event. Note, this ensures compatibility with 1.x ordering.
        this._applyListeners();
      }

      /**
       * Called automatically when an element is initializing.
       * Users may override this method to perform class registration time
       * work. The implementation should ensure the work is performed
       * only once for the class.
       * @protected
       * @return {void}
       */
      _registered() {}

      /**
       * Overrides the default `Polymer.PropertyEffects` implementation to
       * add support for installing `hostAttributes` and `listeners`.
       *
       * @return {void}
       * @override
       */
      ready() {
        this._ensureAttributes();
        super.ready();
      }

      /**
       * Ensures an element has required attributes. Called when the element
       * is being readied via `ready`. Users should override to set the
       * element's required attributes. The implementation should be sure
       * to check and not override existing attributes added by
       * the user of the element. Typically, setting attributes should be left
       * to the element user and not done here; reasonable exceptions include
       * setting aria roles and focusability.
       * @protected
       * @return {void}
       */
      _ensureAttributes() {}

      /**
       * Adds element event listeners. Called when the element
       * is being readied via `ready`. Users should override to
       * add any required element event listeners.
       * In performance critical elements, the work done here should be kept
       * to a minimum since it is done before the element is rendered. In
       * these elements, consider adding listeners asynchronously so as not to
       * block render.
       * @protected
       * @return {void}
       */
      _applyListeners() {}

      /**
       * Converts a typed JavaScript value to a string.
       *
       * Note this method is provided as backward-compatible legacy API
       * only.  It is not directly called by any Polymer features. To customize
       * how properties are serialized to attributes for attribute bindings and
       * `reflectToAttribute: true` properties as well as this method, override
       * the `_serializeValue` method provided by `Polymer.PropertyAccessors`.
       *
       * @param {*} value Value to deserialize
       * @return {string | undefined} Serialized value
       */
      serialize(value) {
        return this._serializeValue(value);
      }

      /**
       * Converts a string to a typed JavaScript value.
       *
       * Note this method is provided as backward-compatible legacy API
       * only.  It is not directly called by any Polymer features.  To customize
       * how attributes are deserialized to properties for in
       * `attributeChangedCallback`, override `_deserializeValue` method
       * provided by `Polymer.PropertyAccessors`.
       *
       * @param {string} value String to deserialize
       * @param {*} type Type to deserialize the string to
       * @return {*} Returns the deserialized value in the `type` given.
       */
      deserialize(value, type) {
        return this._deserializeValue(value, type);
      }

      /**
       * Serializes a property to its associated attribute.
       *
       * Note this method is provided as backward-compatible legacy API
       * only.  It is not directly called by any Polymer features.
       *
       * @param {string} property Property name to reflect.
       * @param {string=} attribute Attribute name to reflect.
       * @param {*=} value Property value to reflect.
       * @return {void}
       */
      reflectPropertyToAttribute(property, attribute, value) {
        this._propertyToAttribute(property, attribute, value);
      }

      /**
       * Sets a typed value to an HTML attribute on a node.
       *
       * Note this method is provided as backward-compatible legacy API
       * only.  It is not directly called by any Polymer features.
       *
       * @param {*} value Value to serialize.
       * @param {string} attribute Attribute name to serialize to.
       * @param {Element} node Element to set attribute to.
       * @return {void}
       */
      serializeValueToAttribute(value, attribute, node) {
        this._valueToNodeAttribute(/** @type {Element} */ (node || this), value, attribute);
      }

      /**
       * Copies own properties (including accessor descriptors) from a source
       * object to a target object.
       *
       * @param {Object} prototype Target object to copy properties to.
       * @param {Object} api Source object to copy properties from.
       * @return {Object} prototype object that was passed as first argument.
       */
      extend(prototype, api) {
        if (!(prototype && api)) {
          return prototype || api;
        }
        let n$ = Object.getOwnPropertyNames(api);
        for (let i=0, n; (i<n$.length) && (n=n$[i]); i++) {
          let pd = Object.getOwnPropertyDescriptor(api, n);
          if (pd) {
            Object.defineProperty(prototype, n, pd);
          }
        }
        return prototype;
      }

      /**
       * Copies props from a source object to a target object.
       *
       * Note, this method uses a simple `for...in` strategy for enumerating
       * properties.  To ensure only `ownProperties` are copied from source
       * to target and that accessor implementations are copied, use `extend`.
       *
       * @param {!Object} target Target object to copy properties to.
       * @param {!Object} source Source object to copy properties from.
       * @return {!Object} Target object that was passed as first argument.
       */
      mixin(target, source) {
        for (let i in source) {
          target[i] = source[i];
        }
        return target;
      }

      /**
       * Sets the prototype of an object.
       *
       * Note this method is provided as backward-compatible legacy API
       * only.  It is not directly called by any Polymer features.
       * @param {Object} object The object on which to set the prototype.
       * @param {Object} prototype The prototype that will be set on the given
       * `object`.
       * @return {Object} Returns the given `object` with its prototype set
       * to the given `prototype` object.
       */
      chainObject(object, prototype) {
        if (object && prototype && object !== prototype) {
          object.__proto__ = prototype;
        }
        return object;
      }

      /* **** Begin Template **** */

      /**
       * Calls `importNode` on the `content` of the `template` specified and
       * returns a document fragment containing the imported content.
       *
       * @param {HTMLTemplateElement} template HTML template element to instance.
       * @return {!DocumentFragment} Document fragment containing the imported
       *   template content.
      */
      instanceTemplate(template) {
        let content = this.constructor._contentForTemplate(template);
        let dom = /** @type {!DocumentFragment} */
          (document.importNode(content, true));
        return dom;
      }

      /* **** Begin Events **** */



      /**
       * Dispatches a custom event with an optional detail value.
       *
       * @param {string} type Name of event type.
       * @param {*=} detail Detail value containing event-specific
       *   payload.
       * @param {{ bubbles: (boolean|undefined), cancelable: (boolean|undefined), composed: (boolean|undefined) }=}
       *  options Object specifying options.  These may include:
       *  `bubbles` (boolean, defaults to `true`),
       *  `cancelable` (boolean, defaults to false), and
       *  `node` on which to fire the event (HTMLElement, defaults to `this`).
       * @return {!Event} The new event that was fired.
       */
      fire(type, detail, options) {
        options = options || {};
        detail = (detail === null || detail === undefined) ? {} : detail;
        let event = new Event(type, {
          bubbles: options.bubbles === undefined ? true : options.bubbles,
          cancelable: Boolean(options.cancelable),
          composed: options.composed === undefined ? true: options.composed
        });
        event.detail = detail;
        let node = options.node || this;
        node.dispatchEvent(event);
        return event;
      }

      /**
       * Convenience method to add an event listener on a given element,
       * late bound to a named method on this element.
       *
       * @param {Element} node Element to add event listener to.
       * @param {string} eventName Name of event to listen for.
       * @param {string} methodName Name of handler method on `this` to call.
       * @return {void}
       */
      listen(node, eventName, methodName) {
        node = /** @type {!Element} */ (node || this);
        let hbl = this.__boundListeners ||
          (this.__boundListeners = new WeakMap());
        let bl = hbl.get(node);
        if (!bl) {
          bl = {};
          hbl.set(node, bl);
        }
        let key = eventName + methodName;
        if (!bl[key]) {
          bl[key] = this._addMethodEventListenerToNode(
            node, eventName, methodName, this);
        }
      }

      /**
       * Convenience method to remove an event listener from a given element,
       * late bound to a named method on this element.
       *
       * @param {Element} node Element to remove event listener from.
       * @param {string} eventName Name of event to stop listening to.
       * @param {string} methodName Name of handler method on `this` to not call
       anymore.
       * @return {void}
       */
      unlisten(node, eventName, methodName) {
        node = /** @type {!Element} */ (node || this);
        let bl = this.__boundListeners && this.__boundListeners.get(node);
        let key = eventName + methodName;
        let handler = bl && bl[key];
        if (handler) {
          this._removeEventListenerFromNode(node, eventName, handler);
          bl[key] = null;
        }
      }

      /**
       * Override scrolling behavior to all direction, one direction, or none.
       *
       * Valid scroll directions:
       *   - 'all': scroll in any direction
       *   - 'x': scroll only in the 'x' direction
       *   - 'y': scroll only in the 'y' direction
       *   - 'none': disable scrolling for this node
       *
       * @param {string=} direction Direction to allow scrolling
       * Defaults to `all`.
       * @param {Element=} node Element to apply scroll direction setting.
       * Defaults to `this`.
       * @return {void}
       */
      setScrollDirection(direction, node) {
        Polymer.Gestures.setTouchAction(/** @type {Element} */ (node || this), DIRECTION_MAP[direction] || 'auto');
      }
      /* **** End Events **** */

      /**
       * Convenience method to run `querySelector` on this local DOM scope.
       *
       * This function calls `Polymer.dom(this.root).querySelector(slctr)`.
       *
       * @param {string} slctr Selector to run on this local DOM scope
       * @return {Element} Element found by the selector, or null if not found.
       */
      $$(slctr) {
        return this.root.querySelector(slctr);
      }

      /**
       * Return the element whose local dom within which this element
       * is contained. This is a shorthand for
       * `this.getRootNode().host`.
       * @this {Element}
       */
      get domHost() {
        let root = this.getRootNode();
        return (root instanceof DocumentFragment) ? /** @type {ShadowRoot} */ (root).host : root;
      }

      /**
       * Force this element to distribute its children to its local dom.
       * This should not be necessary as of Polymer 2.0.2 and is provided only
       * for backwards compatibility.
       * @return {void}
       */
      distributeContent() {
        if (window.ShadyDOM && this.shadowRoot) {
          ShadyDOM.flush();
        }
      }

      /**
       * Returns a list of nodes that are the effective childNodes. The effective
       * childNodes list is the same as the element's childNodes except that
       * any `<content>` elements are replaced with the list of nodes distributed
       * to the `<content>`, the result of its `getDistributedNodes` method.
       * @return {!Array<!Node>} List of effective child nodes.
       * @suppress {invalidCasts} LegacyElementMixin must be applied to an HTMLElement
       */
      getEffectiveChildNodes() {
        const thisEl = /** @type {Element} */ (this);
        const domApi = /** @type {Polymer.DomApi} */(Polymer.dom(thisEl));
        return domApi.getEffectiveChildNodes();
      }

      /**
       * Returns a list of nodes distributed within this element that match
       * `selector`. These can be dom children or elements distributed to
       * children that are insertion points.
       * @param {string} selector Selector to run.
       * @return {!Array<!Node>} List of distributed elements that match selector.
       * @suppress {invalidCasts} LegacyElementMixin must be applied to an HTMLElement
       */
      queryDistributedElements(selector) {
        const thisEl = /** @type {Element} */ (this);
        const domApi = /** @type {Polymer.DomApi} */(Polymer.dom(thisEl));
        return domApi.queryDistributedElements(selector);
      }

      /**
       * Returns a list of elements that are the effective children. The effective
       * children list is the same as the element's children except that
       * any `<content>` elements are replaced with the list of elements
       * distributed to the `<content>`.
       *
       * @return {!Array<!Node>} List of effective children.
       */
      getEffectiveChildren() {
        let list = this.getEffectiveChildNodes();
        return list.filter(function(/** @type {!Node} */ n) {
          return (n.nodeType === Node.ELEMENT_NODE);
        });
      }

      /**
       * Returns a string of text content that is the concatenation of the
       * text content's of the element's effective childNodes (the elements
       * returned by <a href="#getEffectiveChildNodes>getEffectiveChildNodes</a>.
       *
       * @return {string} List of effective children.
       */
      getEffectiveTextContent() {
        let cn = this.getEffectiveChildNodes();
        let tc = [];
        for (let i=0, c; (c = cn[i]); i++) {
          if (c.nodeType !== Node.COMMENT_NODE) {
            tc.push(c.textContent);
          }
        }
        return tc.join('');
      }

      /**
       * Returns the first effective childNode within this element that
       * match `selector`. These can be dom child nodes or elements distributed
       * to children that are insertion points.
       * @param {string} selector Selector to run.
       * @return {Node} First effective child node that matches selector.
       */
      queryEffectiveChildren(selector) {
        let e$ = this.queryDistributedElements(selector);
        return e$ && e$[0];
      }

      /**
       * Returns a list of effective childNodes within this element that
       * match `selector`. These can be dom child nodes or elements distributed
       * to children that are insertion points.
       * @param {string} selector Selector to run.
       * @return {!Array<!Node>} List of effective child nodes that match selector.
       */
      queryAllEffectiveChildren(selector) {
        return this.queryDistributedElements(selector);
      }

      /**
       * Returns a list of nodes distributed to this element's `<slot>`.
       *
       * If this element contains more than one `<slot>` in its local DOM,
       * an optional selector may be passed to choose the desired content.
       *
       * @param {string=} slctr CSS selector to choose the desired
       *   `<slot>`.  Defaults to `content`.
       * @return {!Array<!Node>} List of distributed nodes for the `<slot>`.
       */
      getContentChildNodes(slctr) {
        let content = this.root.querySelector(slctr || 'slot');
        return content ? /** @type {Polymer.DomApi} */(Polymer.dom(content)).getDistributedNodes() : [];
      }

      /**
       * Returns a list of element children distributed to this element's
       * `<slot>`.
       *
       * If this element contains more than one `<slot>` in its
       * local DOM, an optional selector may be passed to choose the desired
       * content.  This method differs from `getContentChildNodes` in that only
       * elements are returned.
       *
       * @param {string=} slctr CSS selector to choose the desired
       *   `<content>`.  Defaults to `content`.
       * @return {!Array<!HTMLElement>} List of distributed nodes for the
       *   `<slot>`.
       * @suppress {invalidCasts}
       */
      getContentChildren(slctr) {
        let children = /** @type {!Array<!HTMLElement>} */(this.getContentChildNodes(slctr).filter(function(n) {
          return (n.nodeType === Node.ELEMENT_NODE);
        }));
        return children;
      }

      /**
       * Checks whether an element is in this element's light DOM tree.
       *
       * @param {?Node} node The element to be checked.
       * @return {boolean} true if node is in this element's light DOM tree.
       * @suppress {invalidCasts} LegacyElementMixin must be applied to an HTMLElement
       */
      isLightDescendant(node) {
        const thisNode = /** @type {Node} */ (this);
        return thisNode !== node && thisNode.contains(node) &&
          thisNode.getRootNode() === node.getRootNode();
      }

      /**
       * Checks whether an element is in this element's local DOM tree.
       *
       * @param {!Element} node The element to be checked.
       * @return {boolean} true if node is in this element's local DOM tree.
       */
      isLocalDescendant(node) {
        return this.root === node.getRootNode();
      }

      /**
       * No-op for backwards compatibility. This should now be handled by
       * ShadyCss library.
       * @param  {*} container Unused
       * @param  {*} shouldObserve Unused
       * @return {void}
       */
      scopeSubtree(container, shouldObserve) { // eslint-disable-line no-unused-vars
      }

      /**
       * Returns the computed style value for the given property.
       * @param {string} property The css property name.
       * @return {string} Returns the computed css property value for the given
       * `property`.
       * @suppress {invalidCasts} LegacyElementMixin must be applied to an HTMLElement
       */
      getComputedStyleValue(property) {
        return styleInterface.getComputedStyleValue(/** @type {!Element} */(this), property);
      }

      // debounce

      /**
       * Call `debounce` to collapse multiple requests for a named task into
       * one invocation which is made after the wait time has elapsed with
       * no new request.  If no wait time is given, the callback will be called
       * at microtask timing (guaranteed before paint).
       *
       *     debouncedClickAction(e) {
       *       // will not call `processClick` more than once per 100ms
       *       this.debounce('click', function() {
       *        this.processClick();
       *       } 100);
       *     }
       *
       * @param {string} jobName String to identify the debounce job.
       * @param {function():void} callback Function that is called (with `this`
       *   context) when the wait time elapses.
       * @param {number} wait Optional wait time in milliseconds (ms) after the
       *   last signal that must elapse before invoking `callback`
       * @return {!Object} Returns a debouncer object on which exists the
       * following methods: `isActive()` returns true if the debouncer is
       * active; `cancel()` cancels the debouncer if it is active;
       * `flush()` immediately invokes the debounced callback if the debouncer
       * is active.
       */
      debounce(jobName, callback, wait) {
        this._debouncers = this._debouncers || {};
        return this._debouncers[jobName] = Polymer.Debouncer.debounce(
              this._debouncers[jobName]
            , wait > 0 ? Polymer.Async.timeOut.after(wait) : Polymer.Async.microTask
            , callback.bind(this));
      }

      /**
       * Returns whether a named debouncer is active.
       *
       * @param {string} jobName The name of the debouncer started with `debounce`
       * @return {boolean} Whether the debouncer is active (has not yet fired).
       */
      isDebouncerActive(jobName) {
        this._debouncers = this._debouncers || {};
        let debouncer = this._debouncers[jobName];
        return !!(debouncer && debouncer.isActive());
      }

      /**
       * Immediately calls the debouncer `callback` and inactivates it.
       *
       * @param {string} jobName The name of the debouncer started with `debounce`
       * @return {void}
       */
      flushDebouncer(jobName) {
        this._debouncers = this._debouncers || {};
        let debouncer = this._debouncers[jobName];
        if (debouncer) {
          debouncer.flush();
        }
      }

      /**
       * Cancels an active debouncer.  The `callback` will not be called.
       *
       * @param {string} jobName The name of the debouncer started with `debounce`
       * @return {void}
       */
      cancelDebouncer(jobName) {
        this._debouncers = this._debouncers || {};
        let debouncer = this._debouncers[jobName];
        if (debouncer) {
          debouncer.cancel();
        }
      }

      /**
       * Runs a callback function asynchronously.
       *
       * By default (if no waitTime is specified), async callbacks are run at
       * microtask timing, which will occur before paint.
       *
       * @param {!Function} callback The callback function to run, bound to `this`.
       * @param {number=} waitTime Time to wait before calling the
       *   `callback`.  If unspecified or 0, the callback will be run at microtask
       *   timing (before paint).
       * @return {number} Handle that may be used to cancel the async job.
       */
      async(callback, waitTime) {
        return waitTime > 0 ? Polymer.Async.timeOut.run(callback.bind(this), waitTime) :
            ~Polymer.Async.microTask.run(callback.bind(this));
      }

      /**
       * Cancels an async operation started with `async`.
       *
       * @param {number} handle Handle returned from original `async` call to
       *   cancel.
       * @return {void}
       */
      cancelAsync(handle) {
        handle < 0 ? Polymer.Async.microTask.cancel(~handle) :
            Polymer.Async.timeOut.cancel(handle);
      }

      // other

      /**
       * Convenience method for creating an element and configuring it.
       *
       * @param {string} tag HTML element tag to create.
       * @param {Object=} props Object of properties to configure on the
       *    instance.
       * @return {!Element} Newly created and configured element.
       */
      create(tag, props) {
        let elt = document.createElement(tag);
        if (props) {
          if (elt.setProperties) {
            elt.setProperties(props);
          } else {
            for (let n in props) {
              elt[n] = props[n];
            }
          }
        }
        return elt;
      }

      /**
       * Convenience method for importing an HTML document imperatively.
       *
       * This method creates a new `<link rel="import">` element with
       * the provided URL and appends it to the document to start loading.
       * In the `onload` callback, the `import` property of the `link`
       * element will contain the imported document contents.
       *
       * @param {string} href URL to document to load.
       * @param {?function(!Event):void=} onload Callback to notify when an import successfully
       *   loaded.
       * @param {?function(!ErrorEvent):void=} onerror Callback to notify when an import
       *   unsuccessfully loaded.
       * @param {boolean=} optAsync True if the import should be loaded `async`.
       *   Defaults to `false`.
       * @return {!HTMLLinkElement} The link element for the URL to be loaded.
       */
      importHref(href, onload, onerror, optAsync) { // eslint-disable-line no-unused-vars
        let loadFn = onload ? onload.bind(this) : null;
        let errorFn = onerror ? onerror.bind(this) : null;
        return Polymer.importHref(href, loadFn, errorFn, optAsync);
      }

      /**
       * Polyfill for Element.prototype.matches, which is sometimes still
       * prefixed.
       *
       * @param {string} selector Selector to test.
       * @param {!Element=} node Element to test the selector against.
       * @return {boolean} Whether the element matches the selector.
       */
      elementMatches(selector, node) {
        return Polymer.dom.matchesSelector(/** @type {!Element} */ (node || this), selector);
      }

      /**
       * Toggles an HTML attribute on or off.
       *
       * @param {string} name HTML attribute name
       * @param {boolean=} bool Boolean to force the attribute on or off.
       *    When unspecified, the state of the attribute will be reversed.
       * @param {Element=} node Node to target.  Defaults to `this`.
       * @return {void}
       */
      toggleAttribute(name, bool, node) {
        node = /** @type {Element} */ (node || this);
        if (arguments.length == 1) {
          bool = !node.hasAttribute(name);
        }
        if (bool) {
          node.setAttribute(name, '');
        } else {
          node.removeAttribute(name);
        }
      }


      /**
       * Toggles a CSS class on or off.
       *
       * @param {string} name CSS class name
       * @param {boolean=} bool Boolean to force the class on or off.
       *    When unspecified, the state of the class will be reversed.
       * @param {Element=} node Node to target.  Defaults to `this`.
       * @return {void}
       */
      toggleClass(name, bool, node) {
        node = /** @type {Element} */ (node || this);
        if (arguments.length == 1) {
          bool = !node.classList.contains(name);
        }
        if (bool) {
          node.classList.add(name);
        } else {
          node.classList.remove(name);
        }
      }

      /**
       * Cross-platform helper for setting an element's CSS `transform` property.
       *
       * @param {string} transformText Transform setting.
       * @param {Element=} node Element to apply the transform to.
       * Defaults to `this`
       * @return {void}
       */
      transform(transformText, node) {
        node = /** @type {Element} */ (node || this);
        node.style.webkitTransform = transformText;
        node.style.transform = transformText;
      }

      /**
       * Cross-platform helper for setting an element's CSS `translate3d`
       * property.
       *
       * @param {number} x X offset.
       * @param {number} y Y offset.
       * @param {number} z Z offset.
       * @param {Element=} node Element to apply the transform to.
       * Defaults to `this`.
       * @return {void}
       */
      translate3d(x, y, z, node) {
        node = /** @type {Element} */ (node || this);
        this.transform('translate3d(' + x + ',' + y + ',' + z + ')', node);
      }

      /**
       * Removes an item from an array, if it exists.
       *
       * If the array is specified by path, a change notification is
       * generated, so that observers, data bindings and computed
       * properties watching that path can update.
       *
       * If the array is passed directly, **no change
       * notification is generated**.
       *
       * @param {string | !Array<number|string>} arrayOrPath Path to array from which to remove the item
       *   (or the array itself).
       * @param {*} item Item to remove.
       * @return {Array} Array containing item removed.
       */
      arrayDelete(arrayOrPath, item) {
        let index;
        if (Array.isArray(arrayOrPath)) {
          index = arrayOrPath.indexOf(item);
          if (index >= 0) {
            return arrayOrPath.splice(index, 1);
          }
        } else {
          let arr = Polymer.Path.get(this, arrayOrPath);
          index = arr.indexOf(item);
          if (index >= 0) {
            return this.splice(arrayOrPath, index, 1);
          }
        }
        return null;
      }

      // logging

      /**
       * Facades `console.log`/`warn`/`error` as override point.
       *
       * @param {string} level One of 'log', 'warn', 'error'
       * @param {Array} args Array of strings or objects to log
       * @return {void}
       */
      _logger(level, args) {
        // accept ['foo', 'bar'] and [['foo', 'bar']]
        if (Array.isArray(args) && args.length === 1 && Array.isArray(args[0])) {
          args = args[0];
        }
        switch(level) {
          case 'log':
          case 'warn':
          case 'error':
            console[level](...args);
        }
      }

      /**
       * Facades `console.log` as an override point.
       *
       * @param {...*} args Array of strings or objects to log
       * @return {void}
       */
      _log(...args) {
        this._logger('log', args);
      }

      /**
       * Facades `console.warn` as an override point.
       *
       * @param {...*} args Array of strings or objects to log
       * @return {void}
       */
      _warn(...args) {
        this._logger('warn', args);
      }

      /**
       * Facades `console.error` as an override point.
       *
       * @param {...*} args Array of strings or objects to log
       * @return {void}
       */
      _error(...args) {
        this._logger('error', args);
      }

      /**
       * Formats a message using the element type an a method name.
       *
       * @param {string} methodName Method name to associate with message
       * @param {...*} args Array of strings or objects to log
       * @return {Array} Array with formatting information for `console`
       *   logging.
       */
      _logf(methodName, ...args) {
        return ['[%s::%s]', this.is, methodName, ...args];
      }

    }

    LegacyElement.prototype.is = '';

    return LegacyElement;

  });

})();



  (function() {

    'use strict';

    const lifecycleProps = {
      attached: true,
      detached: true,
      ready: true,
      created: true,
      beforeRegister: true,
      registered: true,
      attributeChanged: true,
      listeners: true,
      hostAttributes: true
    };

    const excludeOnInfo = {
      attached: true,
      detached: true,
      ready: true,
      created: true,
      beforeRegister: true,
      registered: true,
      attributeChanged: true,
      behaviors: true,
      _noAccessors: true
    };

    const excludeOnBehaviors = Object.assign({
      listeners: true,
      hostAttributes: true,
      properties: true,
      observers: true,
    }, excludeOnInfo);

    function copyProperties(source, target, excludeProps) {
      const noAccessors = source._noAccessors;
      for (let p in source) {
        if (!(p in excludeProps)) {
          if (noAccessors) {
            target[p] = source[p];
          } else {
            let pd = Object.getOwnPropertyDescriptor(source, p);
            if (pd) {
              // ensure property is configurable so that a later behavior can
              // re-configure it.
              pd.configurable = true;
              Object.defineProperty(target, p, pd);
            }
          }
        }
      }
    }

    /**
     * Applies a "legacy" behavior or array of behaviors to the provided class.
     *
     * Note: this method will automatically also apply the `Polymer.LegacyElementMixin`
     * to ensure that any legacy behaviors can rely on legacy Polymer API on
     * the underlying element.
     *
     * @template T
     * @param {!Object|!Array<!Object>} behaviors Behavior object or array of behaviors.
     * @param {function(new:T)} klass Element class.
     * @return {function(new:T)} Returns a new Element class extended by the
     * passed in `behaviors` and also by `Polymer.LegacyElementMixin`.
     * @memberof Polymer
     * @suppress {invalidCasts, checkTypes}
     */
    function mixinBehaviors(behaviors, klass) {
      return GenerateClassFromInfo({}, Polymer.LegacyElementMixin(klass), behaviors);
    }

    // NOTE:
    // 1.x
    // Behaviors were mixed in *in reverse order* and de-duped on the fly.
    // The rule was that behavior properties were copied onto the element
    // prototype if and only if the property did not already exist.
    // Given: Polymer{ behaviors: [A, B, C, A, B]}, property copy order was:
    // (1), B, (2), A, (3) C. This means prototype properties win over
    // B properties win over A win over C. This mirrors what would happen
    // with inheritance if element extended B extended A extended C.
    //
    // Again given, Polymer{ behaviors: [A, B, C, A, B]}, the resulting
    // `behaviors` array was [C, A, B].
    // Behavior lifecycle methods were called in behavior array order
    // followed by the element, e.g. (1) C.created, (2) A.created,
    // (3) B.created, (4) element.created. There was no support for
    // super, and "super-behavior" methods were callable only by name).
    //
    // 2.x
    // Behaviors are made into proper mixins which live in the
    // element's prototype chain. Behaviors are placed in the element prototype
    // eldest to youngest and de-duped youngest to oldest:
    // So, first [A, B, C, A, B] becomes [C, A, B] then,
    // the element prototype becomes (oldest) (1) Polymer.Element, (2) class(C),
    // (3) class(A), (4) class(B), (5) class(Polymer({...})).
    // Result:
    // This means element properties win over B properties win over A win
    // over C. (same as 1.x)
    // If lifecycle is called (super then me), order is
    // (1) C.created, (2) A.created, (3) B.created, (4) element.created
    // (again same as 1.x)
    function applyBehaviors(proto, behaviors, lifecycle) {
      for (let i=0; i<behaviors.length; i++) {
        applyInfo(proto, behaviors[i], lifecycle, excludeOnBehaviors);
      }
    }

    function applyInfo(proto, info, lifecycle, excludeProps) {
      copyProperties(info, proto, excludeProps);
      for (let p in lifecycleProps) {
        if (info[p]) {
          lifecycle[p] = lifecycle[p] || [];
          lifecycle[p].push(info[p]);
        }
      }
    }

    /**
     * @param {Array} behaviors List of behaviors to flatten.
     * @param {Array=} list Target list to flatten behaviors into.
     * @param {Array=} exclude List of behaviors to exclude from the list.
     * @return {!Array} Returns the list of flattened behaviors.
     */
    function flattenBehaviors(behaviors, list, exclude) {
      list = list || [];
      for (let i=behaviors.length-1; i >= 0; i--) {
        let b = behaviors[i];
        if (b) {
          if (Array.isArray(b)) {
            flattenBehaviors(b, list);
          } else {
            // dedup
            if (list.indexOf(b) < 0 && (!exclude || exclude.indexOf(b) < 0)) {
              list.unshift(b);
            }
          }
        } else {
          console.warn('behavior is null, check for missing or 404 import');
        }
      }
      return list;
    }

    /* Note about construction and extension of legacy classes.
      [Changed in Q4 2018 to optimize performance.]

      When calling `Polymer` or `mixinBehaviors`, the generated class below is
      made. The list of behaviors was previously made into one generated class per
      behavior, but this is no longer the case as behaviors are now called
      manually. Note, there may *still* be multiple generated classes in the
      element's prototype chain if extension is used with `mixinBehaviors`.

      The generated class is directly tied to the info object and behaviors
      used to create it. That list of behaviors is filtered so it's only the
      behaviors not active on the superclass. In order to call through to the
      entire list of lifecycle methods, it's important to call `super`.

      The element's `properties` and `observers` are controlled via the finalization
      mechanism provided by `PropertiesMixin`. `Properties` and `observers` are
      collected by manually traversing the prototype chain and merging.

      To limit changes, the `_registered` method is called via `_initializeProperties`
      and not `_finalizeClass`.
    */
    /**
     * @param {!PolymerInit} info Polymer info object
     * @param {function(new:HTMLElement)} Base base class to extend with info object
     * @param {Object} behaviors behaviors to copy into the element
     * @return {function(new:HTMLElement)} Generated class
     * @suppress {checkTypes}
     * @private
     */
    function GenerateClassFromInfo(info, Base, behaviors) {

      // manages behavior and lifecycle processing (filled in after class definition)
      let behaviorList;
      const lifecycle = {};

      /** @private */
      class PolymerGenerated extends Base {

        // explicitly not calling super._finalizeClass
        static _finalizeClass() {
          // if calling via a subclass that hasn't been generated, pass through to super
          if (!this.hasOwnProperty(window.JSCompiler_renameProperty('generatedFrom', this))) {
            super._finalizeClass();
          } else {
            // interleave properties and observers per behavior and `info`
            if (behaviorList) {
              for (let i=0, b; i < behaviorList.length; i++) {
                b = behaviorList[i];
                if (b.properties) {
                  this.createProperties(b.properties);
                }
                if (b.observers) {
                  this.createObservers(b.observers, b.properties);
                }
              }
            }
            if (info.properties) {
              this.createProperties(info.properties);
            }
            if (info.observers) {
              this.createObservers(info.observers, info.properties);
            }
            // make sure to prepare the element template
            this._prepareTemplate();
          }
        }

        static get properties() {
          const properties = {};
          if (behaviorList) {
            for (let i=0; i < behaviorList.length; i++) {
              Object.assign(properties, behaviorList[i].properties);
            }
          }
          Object.assign(properties, info.properties);
          return properties;
        }

        static get observers() {
          let observers = [];
          if (behaviorList) {
            for (let i=0, b; i < behaviorList.length; i++) {
              b = behaviorList[i];
              if (b.observers) {
                observers = observers.concat(b.observers);
              }
            }
          }
          if (info.observers) {
            observers = observers.concat(info.observers);
          }
          return observers;
        }

        /**
         * @return {void}
         */
        created() {
          super.created();
          const list = lifecycle.created;
          if (list) {
            for (let i=0; i < list.length; i++) {
              list[i].call(this);
            }
          }
        }

        /**
         * @return {void}
         */
        _registered() {
          /* NOTE: `beforeRegister` is called here for bc, but the behavior
            is different than in 1.x. In 1.0, the method was called *after*
            mixing prototypes together but *before* processing of meta-objects.
            However, dynamic effects can still be set here and can be done either
            in `beforeRegister` or `registered`. It is no longer possible to set
            `is` in `beforeRegister` as you could in 1.x.
          */
          // only proceed if the generated class' prototype has not been registered.
          const generatedProto = PolymerGenerated.prototype;
          if (!generatedProto.hasOwnProperty('__hasRegisterFinished')) {
            generatedProto.__hasRegisterFinished = true;
            // ensure superclass is registered first.
            super._registered();
            // copy properties onto the generated class lazily if we're optimizing,
            if (Polymer.legacyOptimizations) {
              copyPropertiesToProto(generatedProto);
            }
            // make sure legacy lifecycle is called on the *element*'s prototype
            // and not the generated class prototype; if the element has been
            // extended, these are *not* the same.
            const proto = Object.getPrototypeOf(this);
            let list = lifecycle.beforeRegister;
            if (list) {
              for (let i=0; i < list.length; i++) {
                list[i].call(proto);
              }
            }
            list = lifecycle.registered;
            if (list) {
              for (let i=0; i < list.length; i++) {
                list[i].call(proto);
              }
            }
          }
        }

        /**
         * @return {void}
         */
        _applyListeners() {
          super._applyListeners();
          const list = lifecycle.listeners;
          if (list) {
            for (let i=0; i < list.length; i++) {
              const listeners = list[i];
              if (listeners) {
                for (let l in listeners) {
                  this._addMethodEventListenerToNode(this, l, listeners[l]);
                }
              }
            }
          }
        }

        // note: exception to "super then me" rule;
        // do work before calling super so that super attributes
        // only apply if not already set.
        /**
         * @return {void}
         */
        _ensureAttributes() {
          const list = lifecycle.hostAttributes;
          if (list) {
            for (let i=list.length-1; i >= 0; i--) {
              const hostAttributes = list[i];
              for (let a in hostAttributes) {
                  this._ensureAttribute(a, hostAttributes[a]);
                }
            }
          }
          super._ensureAttributes();
        }

        /**
         * @return {void}
         */
        ready() {
          super.ready();
          let list = lifecycle.ready;
          if (list) {
            for (let i=0; i < list.length; i++) {
              list[i].call(this);
            }
          }
        }

        /**
         * @return {void}
         */
        attached() {
          super.attached();
          let list = lifecycle.attached;
          if (list) {
            for (let i=0; i < list.length; i++) {
              list[i].call(this);
            }
          }
        }

        /**
         * @return {void}
         */
        detached() {
          super.detached();
          let list = lifecycle.detached;
          if (list) {
            for (let i=0; i < list.length; i++) {
              list[i].call(this);
            }
          }
        }

        /**
         * Implements native Custom Elements `attributeChangedCallback` to
         * set an attribute value to a property via `_attributeToProperty`.
         *
         * @param {string} name Name of attribute that changed
         * @param {?string} old Old attribute value
         * @param {?string} value New attribute value
         * @return {void}
         */
        attributeChanged(name, old, value) {
          super.attributeChanged();
          let list = lifecycle.attributeChanged;
          if (list) {
            for (let i=0; i < list.length; i++) {
              list[i].call(this, name, old, value);
            }
          }
        }
      }

      // apply behaviors, note actual copying is done lazily at first instance creation
      if (behaviors) {
        // NOTE: ensure the behavior is extending a class with
        // legacy element api. This is necessary since behaviors expect to be able
        // to access 1.x legacy api.
        if (!Array.isArray(behaviors)) {
          behaviors = [behaviors];
        }
        let superBehaviors = Base.prototype.behaviors;
        // get flattened, deduped list of behaviors *not* already on super class
        behaviorList = flattenBehaviors(behaviors, null, superBehaviors);
        PolymerGenerated.prototype.behaviors = superBehaviors ?
          superBehaviors.concat(behaviors) : behaviorList;
      }

      const copyPropertiesToProto = (proto) => {
        if (behaviorList) {
          applyBehaviors(proto, behaviorList, lifecycle);
        }
        applyInfo(proto, info, lifecycle, excludeOnInfo);
      };

      // copy properties if we're not optimizing
      if (!Polymer.legacyOptimizations) {
        copyPropertiesToProto(PolymerGenerated.prototype);
      }

      PolymerGenerated.generatedFrom = info;

      return PolymerGenerated;
    }

    /**
     * Generates a class that extends `Polymer.LegacyElement` based on the
     * provided info object.  Metadata objects on the `info` object
     * (`properties`, `observers`, `listeners`, `behaviors`, `is`) are used
     * for Polymer's meta-programming systems, and any functions are copied
     * to the generated class.
     *
     * Valid "metadata" values are as follows:
     *
     * `is`: String providing the tag name to register the element under. In
     * addition, if a `dom-module` with the same id exists, the first template
     * in that `dom-module` will be stamped into the shadow root of this element,
     * with support for declarative event listeners (`on-...`), Polymer data
     * bindings (`[[...]]` and `{{...}}`), and id-based node finding into
     * `this.$`.
     *
     * `properties`: Object describing property-related metadata used by Polymer
     * features (key: property names, value: object containing property metadata).
     * Valid keys in per-property metadata include:
     * - `type` (String|Number|Object|Array|...): Used by
     *   `attributeChangedCallback` to determine how string-based attributes
     *   are deserialized to JavaScript property values.
     * - `notify` (boolean): Causes a change in the property to fire a
     *   non-bubbling event called `<property>-changed`. Elements that have
     *   enabled two-way binding to the property use this event to observe changes.
     * - `readOnly` (boolean): Creates a getter for the property, but no setter.
     *   To set a read-only property, use the private setter method
     *   `_setProperty(property, value)`.
     * - `observer` (string): Observer method name that will be called when
     *   the property changes. The arguments of the method are
     *   `(value, previousValue)`.
     * - `computed` (string): String describing method and dependent properties
     *   for computing the value of this property (e.g. `'computeFoo(bar, zot)'`).
     *   Computed properties are read-only by default and can only be changed
     *   via the return value of the computing method.
     *
     * `observers`: Array of strings describing multi-property observer methods
     *  and their dependent properties (e.g. `'observeABC(a, b, c)'`).
     *
     * `listeners`: Object describing event listeners to be added to each
     *  instance of this element (key: event name, value: method name).
     *
     * `behaviors`: Array of additional `info` objects containing metadata
     * and callbacks in the same format as the `info` object here which are
     * merged into this element.
     *
     * `hostAttributes`: Object listing attributes to be applied to the host
     *  once created (key: attribute name, value: attribute value).  Values
     *  are serialized based on the type of the value.  Host attributes should
     *  generally be limited to attributes such as `tabIndex` and `aria-...`.
     *  Attributes in `hostAttributes` are only applied if a user-supplied
     *  attribute is not already present (attributes in markup override
     *  `hostAttributes`).
     *
     * In addition, the following Polymer-specific callbacks may be provided:
     * - `registered`: called after first instance of this element,
     * - `created`: called during `constructor`
     * - `attached`: called during `connectedCallback`
     * - `detached`: called during `disconnectedCallback`
     * - `ready`: called before first `attached`, after all properties of
     *   this element have been propagated to its template and all observers
     *   have run
     *
     * @param {!PolymerInit} info Object containing Polymer metadata and functions
     *   to become class methods.
     * @template T
     * @param {function(T):T} mixin Optional mixin to apply to legacy base class
     *   before extending with Polymer metaprogramming.
     * @return {function(new:HTMLElement)} Generated class
     * @memberof Polymer
     */
    Polymer.Class = function(info, mixin) {
      if (!info) {
        console.warn('Polymer.Class requires `info` argument');
      }
      let klass = mixin ? mixin(Polymer.LegacyElementMixin(HTMLElement)) :
          Polymer.LegacyElementMixin(HTMLElement);
      klass = GenerateClassFromInfo(info, klass, info.behaviors);
      if (info._enableDisableUpgrade) {
        klass = Polymer.DisableUpgradeMixin(klass);
      }
      // decorate klass with registration info
      klass.is = klass.prototype.is = info.is;
      return klass;
    };

    Polymer.mixinBehaviors = mixinBehaviors;

  })();




  (function() {
    'use strict';

    /**
     * Legacy class factory and registration helper for defining Polymer
     * elements.
     *
     * This method is equivalent to
     * `customElements.define(info.is, Polymer.Class(info));`
     *
     * See `Polymer.Class` for details on valid legacy metadata format for `info`.
     *
     * @global
     * @override
     * @function Polymer
     * @param {!PolymerInit} info Object containing Polymer metadata and functions
     *   to become class methods.
     * @return {function(new: HTMLElement)} Generated class
     * @suppress {duplicate, invalidCasts, checkTypes}
     */
    window.Polymer._polymerFn = function(info) {
      // if input is a `class` (aka a function with a prototype), use the prototype
      // remember that the `constructor` will never be called
      let klass;
      if (typeof info === 'function') {
        klass = info;
      } else {
        klass = Polymer.Class(info);
      }
      customElements.define(klass.is, /** @type {!HTMLElement} */(klass));
      return klass;
    };

  })();



(function() {
  'use strict';

  // Common implementation for mixin & behavior
  function mutablePropertyChange(inst, property, value, old, mutableData) {
    let isObject;
    if (mutableData) {
      isObject = (typeof value === 'object' && value !== null);
      // Pull `old` for Objects from temp cache, but treat `null` as a primitive
      if (isObject) {
        old = inst.__dataTemp[property];
      }
    }
    // Strict equality check, but return false for NaN===NaN
    let shouldChange = (old !== value && (old === old || value === value));
    // Objects are stored in temporary cache (cleared at end of
    // turn), which is used for dirty-checking
    if (isObject && shouldChange) {
      inst.__dataTemp[property] = value;
    }
    return shouldChange;
  }

  /**
   * Element class mixin to skip strict dirty-checking for objects and arrays
   * (always consider them to be "dirty"), for use on elements utilizing
   * `Polymer.PropertyEffects`
   *
   * By default, `Polymer.PropertyEffects` performs strict dirty checking on
   * objects, which means that any deep modifications to an object or array will
   * not be propagated unless "immutable" data patterns are used (i.e. all object
   * references from the root to the mutation were changed).
   *
   * Polymer also provides a proprietary data mutation and path notification API
   * (e.g. `notifyPath`, `set`, and array mutation API's) that allow efficient
   * mutation and notification of deep changes in an object graph to all elements
   * bound to the same object graph.
   *
   * In cases where neither immutable patterns nor the data mutation API can be
   * used, applying this mixin will cause Polymer to skip dirty checking for
   * objects and arrays (always consider them to be "dirty").  This allows a
   * user to make a deep modification to a bound object graph, and then either
   * simply re-set the object (e.g. `this.items = this.items`) or call `notifyPath`
   * (e.g. `this.notifyPath('items')`) to update the tree.  Note that all
   * elements that wish to be updated based on deep mutations must apply this
   * mixin or otherwise skip strict dirty checking for objects/arrays.
   * Specifically, any elements in the binding tree between the source of a
   * mutation and the consumption of it must apply this mixin or enable the
   * `Polymer.OptionalMutableData` mixin.
   *
   * In order to make the dirty check strategy configurable, see
   * `Polymer.OptionalMutableData`.
   *
   * Note, the performance characteristics of propagating large object graphs
   * will be worse as opposed to using strict dirty checking with immutable
   * patterns or Polymer's path notification API.
   *
   * @mixinFunction
   * @polymer
   * @memberof Polymer
   * @summary Element class mixin to skip strict dirty-checking for objects
   *   and arrays
   */
  Polymer.MutableData = Polymer.dedupingMixin(superClass => {

    /**
     * @polymer
     * @mixinClass
     * @implements {Polymer_MutableData}
     */
    class MutableData extends superClass {
      /**
       * Overrides `Polymer.PropertyEffects` to provide option for skipping
       * strict equality checking for Objects and Arrays.
       *
       * This method pulls the value to dirty check against from the `__dataTemp`
       * cache (rather than the normal `__data` cache) for Objects.  Since the temp
       * cache is cleared at the end of a turn, this implementation allows
       * side-effects of deep object changes to be processed by re-setting the
       * same object (using the temp cache as an in-turn backstop to prevent
       * cycles due to 2-way notification).
       *
       * @param {string} property Property name
       * @param {*} value New property value
       * @param {*} old Previous property value
       * @return {boolean} Whether the property should be considered a change
       * @protected
       */
      _shouldPropertyChange(property, value, old) {
        return mutablePropertyChange(this, property, value, old, true);
      }

    }

    return MutableData;

  });


  /**
   * Element class mixin to add the optional ability to skip strict
   * dirty-checking for objects and arrays (always consider them to be
   * "dirty") by setting a `mutable-data` attribute on an element instance.
   *
   * By default, `Polymer.PropertyEffects` performs strict dirty checking on
   * objects, which means that any deep modifications to an object or array will
   * not be propagated unless "immutable" data patterns are used (i.e. all object
   * references from the root to the mutation were changed).
   *
   * Polymer also provides a proprietary data mutation and path notification API
   * (e.g. `notifyPath`, `set`, and array mutation API's) that allow efficient
   * mutation and notification of deep changes in an object graph to all elements
   * bound to the same object graph.
   *
   * In cases where neither immutable patterns nor the data mutation API can be
   * used, applying this mixin will allow Polymer to skip dirty checking for
   * objects and arrays (always consider them to be "dirty").  This allows a
   * user to make a deep modification to a bound object graph, and then either
   * simply re-set the object (e.g. `this.items = this.items`) or call `notifyPath`
   * (e.g. `this.notifyPath('items')`) to update the tree.  Note that all
   * elements that wish to be updated based on deep mutations must apply this
   * mixin or otherwise skip strict dirty checking for objects/arrays.
   * Specifically, any elements in the binding tree between the source of a
   * mutation and the consumption of it must enable this mixin or apply the
   * `Polymer.MutableData` mixin.
   *
   * While this mixin adds the ability to forgo Object/Array dirty checking,
   * the `mutableData` flag defaults to false and must be set on the instance.
   *
   * Note, the performance characteristics of propagating large object graphs
   * will be worse by relying on `mutableData: true` as opposed to using
   * strict dirty checking with immutable patterns or Polymer's path notification
   * API.
   *
   * @mixinFunction
   * @polymer
   * @memberof Polymer
   * @summary Element class mixin to optionally skip strict dirty-checking
   *   for objects and arrays
   */
  Polymer.OptionalMutableData = Polymer.dedupingMixin(superClass => {

    /**
     * @mixinClass
     * @polymer
     * @implements {Polymer_OptionalMutableData}
     */
    class OptionalMutableData extends superClass {

      static get properties() {
        return {
          /**
           * Instance-level flag for configuring the dirty-checking strategy
           * for this element.  When true, Objects and Arrays will skip dirty
           * checking, otherwise strict equality checking will be used.
           */
          mutableData: Boolean
        };
      }

      /**
       * Overrides `Polymer.PropertyEffects` to provide option for skipping
       * strict equality checking for Objects and Arrays.
       *
       * When `this.mutableData` is true on this instance, this method
       * pulls the value to dirty check against from the `__dataTemp` cache
       * (rather than the normal `__data` cache) for Objects.  Since the temp
       * cache is cleared at the end of a turn, this implementation allows
       * side-effects of deep object changes to be processed by re-setting the
       * same object (using the temp cache as an in-turn backstop to prevent
       * cycles due to 2-way notification).
       *
       * @param {string} property Property name
       * @param {*} value New property value
       * @param {*} old Previous property value
       * @return {boolean} Whether the property should be considered a change
       * @protected
       */
      _shouldPropertyChange(property, value, old) {
        return mutablePropertyChange(this, property, value, old, this.mutableData);
      }
    }

    return OptionalMutableData;

  });

  // Export for use by legacy behavior
  Polymer.MutableData._mutablePropertyChange = mutablePropertyChange;

})();


  (function() {
    'use strict';

    // Base class for HTMLTemplateElement extension that has property effects
    // machinery for propagating host properties to children. This is an ES5
    // class only because Babel (incorrectly) requires super() in the class
    // constructor even though no `this` is used and it returns an instance.
    let newInstance = null;

    /**
     * @constructor
     * @extends {HTMLTemplateElement}
     * @private
     */
    function HTMLTemplateElementExtension() { return newInstance; }
    HTMLTemplateElementExtension.prototype = Object.create(HTMLTemplateElement.prototype, {
      constructor: {
        value: HTMLTemplateElementExtension,
        writable: true
      }
    });

    /**
     * @constructor
     * @implements {Polymer_PropertyEffects}
     * @extends {HTMLTemplateElementExtension}
     * @private
     */
    const DataTemplate = Polymer.PropertyEffects(HTMLTemplateElementExtension);

    /**
     * @constructor
     * @implements {Polymer_MutableData}
     * @extends {DataTemplate}
     * @private
     */
    const MutableDataTemplate = Polymer.MutableData(DataTemplate);

    // Applies a DataTemplate subclass to a <template> instance
    function upgradeTemplate(template, constructor) {
      newInstance = template;
      Object.setPrototypeOf(template, constructor.prototype);
      new constructor();
      newInstance = null;
    }

    /**
     * Base class for TemplateInstance.
     * @constructor
     * @implements {Polymer_PropertyEffects}
     * @private
     */
    const base = Polymer.PropertyEffects(class {});

    /**
     * @polymer
     * @customElement
     * @appliesMixin Polymer.PropertyEffects
     * @unrestricted
     */
    class TemplateInstanceBase extends base {
      constructor(props) {
        super();
        this._configureProperties(props);
        this.root = this._stampTemplate(this.__dataHost);
        // Save list of stamped children
        let children = this.children = [];
        for (let n = this.root.firstChild; n; n=n.nextSibling) {
          children.push(n);
          n.__templatizeInstance = this;
        }
        if (this.__templatizeOwner &&
          this.__templatizeOwner.__hideTemplateChildren__) {
          this._showHideChildren(true);
        }
        // Flush props only when props are passed if instance props exist
        // or when there isn't instance props.
        let options = this.__templatizeOptions;
        if ((props && options.instanceProps) || !options.instanceProps) {
          this._enableProperties();
        }
      }
      /**
       * Configure the given `props` by calling `_setPendingProperty`. Also
       * sets any properties stored in `__hostProps`.
       * @private
       * @param {Object} props Object of property name-value pairs to set.
       * @return {void}
       */
      _configureProperties(props) {
        let options = this.__templatizeOptions;
        if (options.forwardHostProp) {
          for (let hprop in this.__hostProps) {
            this._setPendingProperty(hprop, this.__dataHost['_host_' + hprop]);
          }
        }
        // Any instance props passed in the constructor will overwrite host props;
        // normally this would be a user error but we don't specifically filter them
        for (let iprop in props) {
          this._setPendingProperty(iprop, props[iprop]);
        }
      }
      /**
       * Forwards a host property to this instance.  This method should be
       * called on instances from the `options.forwardHostProp` callback
       * to propagate changes of host properties to each instance.
       *
       * Note this method enqueues the change, which are flushed as a batch.
       *
       * @param {string} prop Property or path name
       * @param {*} value Value of the property to forward
       * @return {void}
       */
      forwardHostProp(prop, value) {
        if (this._setPendingPropertyOrPath(prop, value, false, true)) {
          this.__dataHost._enqueueClient(this);
        }
      }

      /**
       * Override point for adding custom or simulated event handling.
       *
       * @param {!Node} node Node to add event listener to
       * @param {string} eventName Name of event
       * @param {function(!Event):void} handler Listener function to add
       * @return {void}
       */
      _addEventListenerToNode(node, eventName, handler) {
        if (this._methodHost && this.__templatizeOptions.parentModel) {
          // If this instance should be considered a parent model, decorate
          // events this template instance as `model`
          this._methodHost._addEventListenerToNode(node, eventName, (e) => {
            e.model = this;
            handler(e);
          });
        } else {
          // Otherwise delegate to the template's host (which could be)
          // another template instance
          let templateHost = this.__dataHost.__dataHost;
          if (templateHost) {
            templateHost._addEventListenerToNode(node, eventName, handler);
          }
        }
      }
      /**
       * Shows or hides the template instance top level child elements. For
       * text nodes, `textContent` is removed while "hidden" and replaced when
       * "shown."
       * @param {boolean} hide Set to true to hide the children;
       * set to false to show them.
       * @return {void}
       * @protected
       */
      _showHideChildren(hide) {
        let c = this.children;
        for (let i=0; i<c.length; i++) {
          let n = c[i];
          // Ignore non-changes
          if (Boolean(hide) != Boolean(n.__hideTemplateChildren__)) {
            if (n.nodeType === Node.TEXT_NODE) {
              if (hide) {
                n.__polymerTextContent__ = n.textContent;
                n.textContent = '';
              } else {
                n.textContent = n.__polymerTextContent__;
              }
            // remove and replace slot
            } else if (n.localName === 'slot') {
              if (hide) {
                n.__polymerReplaced__ = document.createComment('hidden-slot');
                n.parentNode.replaceChild(n.__polymerReplaced__, n);
              } else {
                const replace = n.__polymerReplaced__;
                if (replace) {
                  replace.parentNode.replaceChild(n, replace);
                }
              }
            }

            else if (n.style) {
              if (hide) {
                n.__polymerDisplay__ = n.style.display;
                n.style.display = 'none';
              } else {
                n.style.display = n.__polymerDisplay__;
              }
            }
          }
          n.__hideTemplateChildren__ = hide;
          if (n._showHideChildren) {
            n._showHideChildren(hide);
          }
        }
      }
      /**
       * Overrides default property-effects implementation to intercept
       * textContent bindings while children are "hidden" and cache in
       * private storage for later retrieval.
       *
       * @param {!Node} node The node to set a property on
       * @param {string} prop The property to set
       * @param {*} value The value to set
       * @return {void}
       * @protected
       */
      _setUnmanagedPropertyToNode(node, prop, value) {
        if (node.__hideTemplateChildren__ &&
            node.nodeType == Node.TEXT_NODE && prop == 'textContent') {
          node.__polymerTextContent__ = value;
        } else {
          super._setUnmanagedPropertyToNode(node, prop, value);
        }
      }
      /**
       * Find the parent model of this template instance.  The parent model
       * is either another templatize instance that had option `parentModel: true`,
       * or else the host element.
       *
       * @return {!Polymer_PropertyEffects} The parent model of this instance
       */
      get parentModel() {
        let model = this.__parentModel;
        if (!model) {
          let options;
          model = this;
          do {
            // A template instance's `__dataHost` is a <template>
            // `model.__dataHost.__dataHost` is the template's host
            model = model.__dataHost.__dataHost;
          } while ((options = model.__templatizeOptions) && !options.parentModel);
          this.__parentModel = model;
        }
        return model;
      }

      /**
       * Stub of HTMLElement's `dispatchEvent`, so that effects that may
       * dispatch events safely no-op.
       *
       * @param {Event} event Event to dispatch
       * @return {boolean} Always true.
       */
       dispatchEvent(event) { // eslint-disable-line no-unused-vars
         return true;
      }
    }

    /** @type {!DataTemplate} */
    TemplateInstanceBase.prototype.__dataHost;
    /** @type {!TemplatizeOptions} */
    TemplateInstanceBase.prototype.__templatizeOptions;
    /** @type {!Polymer_PropertyEffects} */
    TemplateInstanceBase.prototype._methodHost;
    /** @type {!Object} */
    TemplateInstanceBase.prototype.__templatizeOwner;
    /** @type {!Object} */
    TemplateInstanceBase.prototype.__hostProps;

    /**
     * @constructor
     * @extends {TemplateInstanceBase}
     * @implements {Polymer_MutableData}
     * @private
     */
    const MutableTemplateInstanceBase = Polymer.MutableData(TemplateInstanceBase);

    function findMethodHost(template) {
      // Technically this should be the owner of the outermost template.
      // In shadow dom, this is always getRootNode().host, but we can
      // approximate this via cooperation with our dataHost always setting
      // `_methodHost` as long as there were bindings (or id's) on this
      // instance causing it to get a dataHost.
      let templateHost = template.__dataHost;
      return templateHost && templateHost._methodHost || templateHost;
    }

    /* eslint-disable valid-jsdoc */
    /**
     * @suppress {missingProperties} class.prototype is not defined for some reason
     */
    function createTemplatizerClass(template, templateInfo, options) {
      // Anonymous class created by the templatize
      let base = options.mutableData ?
        MutableTemplateInstanceBase : TemplateInstanceBase;
      // Affordance for global mixins onto TemplatizeInstance
      if (Polymer.Templatize.mixin) {
        base = Polymer.Templatize.mixin(base);
      }
      /**
       * @constructor
       * @extends {base}
       * @private
       */
      let klass = class extends base { };
      klass.prototype.__templatizeOptions = options;
      klass.prototype._bindTemplate(template);
      addNotifyEffects(klass, template, templateInfo, options);
      return klass;
    }

    /**
     * @suppress {missingProperties} class.prototype is not defined for some reason
     */
    function addPropagateEffects(template, templateInfo, options) {
      let userForwardHostProp = options.forwardHostProp;
      if (userForwardHostProp) {
        // Provide data API and property effects on memoized template class
        let klass = templateInfo.templatizeTemplateClass;
        if (!klass) {
          let base = options.mutableData ? MutableDataTemplate : DataTemplate;
          /** @private */
          klass = templateInfo.templatizeTemplateClass =
            class TemplatizedTemplate extends base {};
          // Add template - >instances effects
          // and host <- template effects
          let hostProps = templateInfo.hostProps;
          for (let prop in hostProps) {
            klass.prototype._addPropertyEffect('_host_' + prop,
              klass.prototype.PROPERTY_EFFECT_TYPES.PROPAGATE,
              {fn: createForwardHostPropEffect(prop, userForwardHostProp)});
            klass.prototype._createNotifyingProperty('_host_' + prop);
          }
        }
        upgradeTemplate(template, klass);
        // Mix any pre-bound data into __data; no need to flush this to
        // instances since they pull from the template at instance-time
        if (template.__dataProto) {
          // Note, generally `__dataProto` could be chained, but it's guaranteed
          // to not be since this is a vanilla template we just added effects to
          Object.assign(template.__data, template.__dataProto);
        }
        // Clear any pending data for performance
        template.__dataTemp = {};
        template.__dataPending = null;
        template.__dataOld = null;
        template._enableProperties();
      }
    }
    /* eslint-enable valid-jsdoc */

    function createForwardHostPropEffect(hostProp, userForwardHostProp) {
      return function forwardHostProp(template, prop, props) {
        userForwardHostProp.call(template.__templatizeOwner,
          prop.substring('_host_'.length), props[prop]);
      };
    }

    function addNotifyEffects(klass, template, templateInfo, options) {
      let hostProps = templateInfo.hostProps || {};
      for (let iprop in options.instanceProps) {
        delete hostProps[iprop];
        let userNotifyInstanceProp = options.notifyInstanceProp;
        if (userNotifyInstanceProp) {
          klass.prototype._addPropertyEffect(iprop,
            klass.prototype.PROPERTY_EFFECT_TYPES.NOTIFY,
            {fn: createNotifyInstancePropEffect(iprop, userNotifyInstanceProp)});
        }
      }
      if (options.forwardHostProp && template.__dataHost) {
        for (let hprop in hostProps) {
          klass.prototype._addPropertyEffect(hprop,
            klass.prototype.PROPERTY_EFFECT_TYPES.NOTIFY,
            {fn: createNotifyHostPropEffect()});
        }
      }
    }

    function createNotifyInstancePropEffect(instProp, userNotifyInstanceProp) {
      return function notifyInstanceProp(inst, prop, props) {
        userNotifyInstanceProp.call(inst.__templatizeOwner,
          inst, prop, props[prop]);
      };
    }

    function createNotifyHostPropEffect() {
      return function notifyHostProp(inst, prop, props) {
        inst.__dataHost._setPendingPropertyOrPath('_host_' + prop, props[prop], true, true);
      };
    }

    /**
     * Module for preparing and stamping instances of templates that utilize
     * Polymer's data-binding and declarative event listener features.
     *
     * Example:
     *
     *     // Get a template from somewhere, e.g. light DOM
     *     let template = this.querySelector('template');
     *     // Prepare the template
     *     let TemplateClass = Polymer.Templatize.templatize(template);
     *     // Instance the template with an initial data model
     *     let instance = new TemplateClass({myProp: 'initial'});
     *     // Insert the instance's DOM somewhere, e.g. element's shadow DOM
     *     this.shadowRoot.appendChild(instance.root);
     *     // Changing a property on the instance will propagate to bindings
     *     // in the template
     *     instance.myProp = 'new value';
     *
     * The `options` dictionary passed to `templatize` allows for customizing
     * features of the generated template class, including how outer-scope host
     * properties should be forwarded into template instances, how any instance
     * properties added into the template's scope should be notified out to
     * the host, and whether the instance should be decorated as a "parent model"
     * of any event handlers.
     *
     *     // Customize property forwarding and event model decoration
     *     let TemplateClass = Polymer.Templatize.templatize(template, this, {
     *       parentModel: true,
     *       forwardHostProp(property, value) {...},
     *       instanceProps: {...},
     *       notifyInstanceProp(instance, property, value) {...},
     *     });
     *
     * @namespace
     * @memberof Polymer
     * @summary Module for preparing and stamping instances of templates
     *   utilizing Polymer templating features.
     */
    Polymer.Templatize = {

      /**
       * Returns an anonymous `Polymer.PropertyEffects` class bound to the
       * `<template>` provided.  Instancing the class will result in the
       * template being stamped into a document fragment stored as the instance's
       * `root` property, after which it can be appended to the DOM.
       *
       * Templates may utilize all Polymer data-binding features as well as
       * declarative event listeners.  Event listeners and inline computing
       * functions in the template will be called on the host of the template.
       *
       * The constructor returned takes a single argument dictionary of initial
       * property values to propagate into template bindings.  Additionally
       * host properties can be forwarded in, and instance properties can be
       * notified out by providing optional callbacks in the `options` dictionary.
       *
       * Valid configuration in `options` are as follows:
       *
       * - `forwardHostProp(property, value)`: Called when a property referenced
       *   in the template changed on the template's host. As this library does
       *   not retain references to templates instanced by the user, it is the
       *   templatize owner's responsibility to forward host property changes into
       *   user-stamped instances.  The `instance.forwardHostProp(property, value)`
       *    method on the generated class should be called to forward host
       *   properties into the template to prevent unnecessary property-changed
       *   notifications. Any properties referenced in the template that are not
       *   defined in `instanceProps` will be notified up to the template's host
       *   automatically.
       * - `instanceProps`: Dictionary of property names that will be added
       *   to the instance by the templatize owner.  These properties shadow any
       *   host properties, and changes within the template to these properties
       *   will result in `notifyInstanceProp` being called.
       * - `mutableData`: When `true`, the generated class will skip strict
       *   dirty-checking for objects and arrays (always consider them to be
       *   "dirty").
       * - `notifyInstanceProp(instance, property, value)`: Called when
       *   an instance property changes.  Users may choose to call `notifyPath`
       *   on e.g. the owner to notify the change.
       * - `parentModel`: When `true`, events handled by declarative event listeners
       *   (`on-event="handler"`) will be decorated with a `model` property pointing
       *   to the template instance that stamped it.  It will also be returned
       *   from `instance.parentModel` in cases where template instance nesting
       *   causes an inner model to shadow an outer model.
       *
       * All callbacks are called bound to the `owner`. Any context
       * needed for the callbacks (such as references to `instances` stamped)
       * should be stored on the `owner` such that they can be retrieved via
       * `this`.
       *
       * When `options.forwardHostProp` is declared as an option, any properties
       * referenced in the template will be automatically forwarded from the host of
       * the `<template>` to instances, with the exception of any properties listed in
       * the `options.instanceProps` object.  `instanceProps` are assumed to be
       * managed by the owner of the instances, either passed into the constructor
       * or set after the fact.  Note, any properties passed into the constructor will
       * always be set to the instance (regardless of whether they would normally
       * be forwarded from the host).
       *
       * Note that `templatize()` can be run only once for a given `<template>`.
       * Further calls will result in an error. Also, there is a special
       * behavior if the template was duplicated through a mechanism such as
       * `<dom-repeat>` or `<test-fixture>`. In this case, all calls to
       * `templatize()` return the same class for all duplicates of a template.
       * The class returned from `templatize()` is generated only once using
       * the `options` from the first call. This means that any `options`
       * provided to subsequent calls will be ignored. Therefore, it is very
       * important not to close over any variables inside the callbacks. Also,
       * arrow functions must be avoided because they bind the outer `this`.
       * Inside the callbacks, any contextual information can be accessed
       * through `this`, which points to the `owner`.
       *
       * @memberof Polymer.Templatize
       * @param {!HTMLTemplateElement} template Template to templatize
       * @param {Polymer_PropertyEffects=} owner Owner of the template instances;
       *   any optional callbacks will be bound to this owner.
       * @param {Object=} options Options dictionary (see summary for details)
       * @return {function(new:TemplateInstanceBase)} Generated class bound to the template
       *   provided
       * @suppress {invalidCasts}
       */
      templatize(template, owner, options) {
        // Under strictTemplatePolicy, the templatized element must be owned
        // by a (trusted) Polymer element, indicated by existence of _methodHost;
        // e.g. for dom-if & dom-repeat in main document, _methodHost is null
        if (Polymer.strictTemplatePolicy && !findMethodHost(template)) {
          throw new Error('strictTemplatePolicy: template owner not trusted');
        }
        options = /** @type {!TemplatizeOptions} */(options || {});
        if (template.__templatizeOwner) {
          throw new Error('A <template> can only be templatized once');
        }
        template.__templatizeOwner = owner;
        const ctor = owner ? owner.constructor : TemplateInstanceBase;
        let templateInfo = ctor._parseTemplate(template);
        // Get memoized base class for the prototypical template, which
        // includes property effects for binding template & forwarding
        let baseClass = templateInfo.templatizeInstanceClass;
        if (!baseClass) {
          baseClass = createTemplatizerClass(template, templateInfo, options);
          templateInfo.templatizeInstanceClass = baseClass;
        }
        // Host property forwarding must be installed onto template instance
        addPropagateEffects(template, templateInfo, options);
        // Subclass base class and add reference for this specific template
        /** @private */
        let klass = class TemplateInstance extends baseClass {};
        klass.prototype._methodHost = findMethodHost(template);
        klass.prototype.__dataHost = template;
        klass.prototype.__templatizeOwner = owner;
        klass.prototype.__hostProps = templateInfo.hostProps;
        klass = /** @type {function(new:TemplateInstanceBase)} */(klass); //eslint-disable-line no-self-assign
        return klass;
      },

      /**
       * Returns the template "model" associated with a given element, which
       * serves as the binding scope for the template instance the element is
       * contained in. A template model is an instance of
       * `TemplateInstanceBase`, and should be used to manipulate data
       * associated with this template instance.
       *
       * Example:
       *
       *   let model = modelForElement(el);
       *   if (model.index < 10) {
       *     model.set('item.checked', true);
       *   }
       *
       * @memberof Polymer.Templatize
       * @param {HTMLTemplateElement} template The model will be returned for
       *   elements stamped from this template
       * @param {Node=} node Node for which to return a template model.
       * @return {TemplateInstanceBase} Template instance representing the
       *   binding scope for the element
       */
      modelForElement(template, node) {
        let model;
        while (node) {
          // An element with a __templatizeInstance marks the top boundary
          // of a scope; walk up until we find one, and then ensure that
          // its __dataHost matches `this`, meaning this dom-repeat stamped it
          if ((model = node.__templatizeInstance)) {
            // Found an element stamped by another template; keep walking up
            // from its __dataHost
            if (model.__dataHost != template) {
              node = model.__dataHost;
            } else {
              return model;
            }
          } else {
            // Still in a template scope, keep going up until
            // a __templatizeInstance is found
            node = node.parentNode;
          }
        }
        return null;
      }
    };

    Polymer.TemplateInstanceBase = TemplateInstanceBase;

  })();



  (function() {
    'use strict';

    let TemplateInstanceBase = Polymer.TemplateInstanceBase; // eslint-disable-line

    /**
     * @typedef {{
     *   _templatizerTemplate: HTMLTemplateElement,
     *   _parentModel: boolean,
     *   _instanceProps: Object,
     *   _forwardHostPropV2: Function,
     *   _notifyInstancePropV2: Function,
     *   ctor: TemplateInstanceBase
     * }}
     */
    let TemplatizerUser; // eslint-disable-line

    /**
     * The `Polymer.Templatizer` behavior adds methods to generate instances of
     * templates that are each managed by an anonymous `Polymer.PropertyEffects`
     * instance where data-bindings in the stamped template content are bound to
     * accessors on itself.
     *
     * This behavior is provided in Polymer 2.x as a hybrid-element convenience
     * only.  For non-hybrid usage, the `Polymer.Templatize` library
     * should be used instead.
     *
     * Example:
     *
     *     // Get a template from somewhere, e.g. light DOM
     *     let template = this.querySelector('template');
     *     // Prepare the template
     *     this.templatize(template);
     *     // Instance the template with an initial data model
     *     let instance = this.stamp({myProp: 'initial'});
     *     // Insert the instance's DOM somewhere, e.g. light DOM
     *     Polymer.dom(this).appendChild(instance.root);
     *     // Changing a property on the instance will propagate to bindings
     *     // in the template
     *     instance.myProp = 'new value';
     *
     * Users of `Templatizer` may need to implement the following abstract
     * API's to determine how properties and paths from the host should be
     * forwarded into to instances:
     *
     *     _forwardHostPropV2: function(prop, value)
     *
     * Likewise, users may implement these additional abstract API's to determine
     * how instance-specific properties that change on the instance should be
     * forwarded out to the host, if necessary.
     *
     *     _notifyInstancePropV2: function(inst, prop, value)
     *
     * In order to determine which properties are instance-specific and require
     * custom notification via `_notifyInstanceProp`, define an `_instanceProps`
     * object containing keys for each instance prop, for example:
     *
     *     _instanceProps: {
     *       item: true,
     *       index: true
     *     }
     *
     * Any properties used in the template that are not defined in _instanceProp
     * will be forwarded out to the Templatize `owner` automatically.
     *
     * Users may also implement the following abstract function to show or
     * hide any DOM generated using `stamp`:
     *
     *     _showHideChildren: function(shouldHide)
     *
     * Note that some callbacks are suffixed with `V2` in the Polymer 2.x behavior
     * as the implementations will need to differ from the callbacks required
     * by the 1.x Templatizer API due to changes in the `TemplateInstance` API
     * between versions 1.x and 2.x.
     *
     * @polymerBehavior
     */
    Polymer.Templatizer = {

      /**
       * Generates an anonymous `TemplateInstance` class (stored as `this.ctor`)
       * for the provided template.  This method should be called once per
       * template to prepare an element for stamping the template, followed
       * by `stamp` to create new instances of the template.
       *
       * @param {!HTMLTemplateElement} template Template to prepare
       * @param {boolean=} mutableData When `true`, the generated class will skip
       *   strict dirty-checking for objects and arrays (always consider them to
       *   be "dirty"). Defaults to false.
       * @return {void}
       * @this {TemplatizerUser}
       */
      templatize(template, mutableData) {
        this._templatizerTemplate = template;
        this.ctor = Polymer.Templatize.templatize(template, this, {
          mutableData: Boolean(mutableData),
          parentModel: this._parentModel,
          instanceProps: this._instanceProps,
          forwardHostProp: this._forwardHostPropV2,
          notifyInstanceProp: this._notifyInstancePropV2
        });
      },

      /**
       * Creates an instance of the template prepared by `templatize`.  The object
       * returned is an instance of the anonymous class generated by `templatize`
       * whose `root` property is a document fragment containing newly cloned
       * template content, and which has property accessors corresponding to
       * properties referenced in template bindings.
       *
       * @param {Object=} model Object containing initial property values to
       *   populate into the template bindings.
       * @return {TemplateInstanceBase} Returns the created instance of
       * the template prepared by `templatize`.
       * @this {TemplatizerUser}
       */
      stamp(model) {
        return new this.ctor(model);
      },

      /**
       * Returns the template "model" (`TemplateInstance`) associated with
       * a given element, which serves as the binding scope for the template
       * instance the element is contained in.  A template model should be used
       * to manipulate data associated with this template instance.
       *
       * @param {HTMLElement} el Element for which to return a template model.
       * @return {TemplateInstanceBase} Model representing the binding scope for
       *   the element.
       * @this {TemplatizerUser}
       */
      modelForElement(el) {
        return Polymer.Templatize.modelForElement(this._templatizerTemplate, el);
      }
    };

  })();



  (function() {
    'use strict';

    /**
     * @constructor
     * @extends {HTMLElement}
     * @implements {Polymer_PropertyEffects}
     * @implements {Polymer_OptionalMutableData}
     * @implements {Polymer_GestureEventListeners}
     * @private
     */
    const domBindBase =
      Polymer.GestureEventListeners(
        Polymer.OptionalMutableData(
          Polymer.PropertyEffects(HTMLElement)));

    /**
     * Custom element to allow using Polymer's template features (data binding,
     * declarative event listeners, etc.) in the main document without defining
     * a new custom element.
     *
     * `<template>` tags utilizing bindings may be wrapped with the `<dom-bind>`
     * element, which will immediately stamp the wrapped template into the main
     * document and bind elements to the `dom-bind` element itself as the
     * binding scope.
     *
     * @polymer
     * @customElement
     * @appliesMixin Polymer.PropertyEffects
     * @appliesMixin Polymer.OptionalMutableData
     * @appliesMixin Polymer.GestureEventListeners
     * @extends {domBindBase}
     * @memberof Polymer
     * @summary Custom element to allow using Polymer's template features (data
     *   binding, declarative event listeners, etc.) in the main document.
     */
    class DomBind extends domBindBase {

      static get observedAttributes() { return ['mutable-data']; }

      constructor() {
        super();
        if (Polymer.strictTemplatePolicy) {
          throw new Error(`strictTemplatePolicy: dom-bind not allowed`);
        }
        this.root = null;
        this.$ = null;
        this.__children = null;
      }

      /** @return {void} */
      attributeChangedCallback() {
        // assumes only one observed attribute
        this.mutableData = true;
      }

      /** @return {void} */
      connectedCallback() {
        this.style.display = 'none';
        this.render();
      }

      /** @return {void} */
      disconnectedCallback() {
        this.__removeChildren();
      }

      __insertChildren() {
        this.parentNode.insertBefore(this.root, this);
      }

      __removeChildren() {
        if (this.__children) {
          for (let i=0; i<this.__children.length; i++) {
            this.root.appendChild(this.__children[i]);
          }
        }
      }

      /**
       * Forces the element to render its content. This is typically only
       * necessary to call if HTMLImports with the async attribute are used.
       * @return {void}
       */
      render() {
        let template;
        if (!this.__children) {
          template = /** @type {HTMLTemplateElement} */(template || this.querySelector('template'));
          if (!template) {
            // Wait until childList changes and template should be there by then
            let observer = new MutationObserver(() => {
              template = /** @type {HTMLTemplateElement} */(this.querySelector('template'));
              if (template) {
                observer.disconnect();
                this.render();
              } else {
                throw new Error('dom-bind requires a <template> child');
              }
            });
            observer.observe(this, {childList: true});
            return;
          }
          this.root = this._stampTemplate(template);
          this.$ = this.root.$;
          this.__children = [];
          for (let n=this.root.firstChild; n; n=n.nextSibling) {
            this.__children[this.__children.length] = n;
          }
          this._enableProperties();
        }
        this.__insertChildren();
        this.dispatchEvent(new CustomEvent('dom-change', {
          bubbles: true,
          composed: true
        }));
      }

    }

    customElements.define('dom-bind', DomBind);

    /** @const */
    Polymer.DomBind = DomBind;

  })();



  (function() {
    'use strict';

    /**
     * Class representing a static string value which can be used to filter
     * strings by asseting that they have been created via this class. The
     * `value` property returns the string passed to the constructor.
     */
    class LiteralString {
      constructor(string) {
        /** @type {string} */
        this.value = string.toString();
      }
      /**
       * @return {string} LiteralString string value
       */
      toString() {
        return this.value;
      }
    }

    /**
     * @param {*} value Object to stringify into HTML
     * @return {string} HTML stringified form of `obj`
     */
    function literalValue(value) {
      if (value instanceof LiteralString) {
        return /** @type {!LiteralString} */(value).value;
      } else {
        throw new Error(`non-literal value passed to Polymer.htmlLiteral: ${value}`);
      }
    }

    /**
     * @param {*} value Object to stringify into HTML
     * @return {string} HTML stringified form of `obj`
     */
    function htmlValue(value) {
      if (value instanceof HTMLTemplateElement) {
        return /** @type {!HTMLTemplateElement } */(value).innerHTML;
      } else if (value instanceof LiteralString) {
        return literalValue(value);
      } else {
        throw new Error(`non-template value passed to Polymer.html: ${value}`);
      }
    }

    /**
     * A template literal tag that creates an HTML <template> element from the
     * contents of the string.
     *
     * This allows you to write a Polymer Template in JavaScript.
     *
     * Templates can be composed by interpolating `HTMLTemplateElement`s in
     * expressions in the JavaScript template literal. The nested template's
     * `innerHTML` is included in the containing template.  The only other
     * values allowed in expressions are those returned from `Polymer.htmlLiteral`
     * which ensures only literal values from JS source ever reach the HTML, to
     * guard against XSS risks.
     *
     * All other values are disallowed in expressions to help prevent XSS
     * attacks; however, `Polymer.htmlLiteral` can be used to compose static
     * string values into templates. This is useful to compose strings into
     * places that do not accept html, like the css text of a `style`
     * element.
     *
     * Example:
     *
     *     static get template() {
     *       return Polymer.html`
     *         <style>:host{ content:"..." }</style>
     *         <div class="shadowed">${this.partialTemplate}</div>
     *         ${super.template}
     *       `;
     *     }
     *     static get partialTemplate() { return Polymer.html`<span>Partial!</span>`; }
     *
     * @memberof Polymer
     * @param {!ITemplateArray} strings Constant parts of tagged template literal
     * @param {...*} values Variable parts of tagged template literal
     * @return {!HTMLTemplateElement} Constructed HTMLTemplateElement
     */
    Polymer.html = function html(strings, ...values) {
      const template = /** @type {!HTMLTemplateElement} */(document.createElement('template'));
      template.innerHTML = values.reduce((acc, v, idx) =>
          acc + htmlValue(v) + strings[idx + 1], strings[0]);
      return template;
    };

    /**
     * An html literal tag that can be used with `Polymer.html` to compose.
     * a literal string.
     *
     * Example:
     *
     *     static get template() {
     *       return Polymer.html`
     *         <style>
     *           :host { display: block; }
     *           ${styleTemplate}
     *         </style>
     *         <div class="shadowed">${staticValue}</div>
     *         ${super.template}
     *       `;
     *     }
     *     static get styleTemplate() { return Polymer.htmlLiteral`.shadowed { background: gray; }`; }
     *
     * @memberof Polymer
     * @param {!ITemplateArray} strings Constant parts of tagged template literal
     * @param {...*} values Variable parts of tagged template literal
     * @return {!LiteralString} Constructed literal string
     */
    Polymer.htmlLiteral = function(strings, ...values) {
      return new LiteralString(values.reduce((acc, v, idx) =>
          acc + literalValue(v) + strings[idx + 1], strings[0]));
    };
  })();


(function() {
  'use strict';

  /**
   * Base class that provides the core API for Polymer's meta-programming
   * features including template stamping, data-binding, attribute deserialization,
   * and property change observation.
   *
   * @customElement
   * @memberof Polymer
   * @constructor
   * @implements {Polymer_ElementMixin}
   * @extends {HTMLElement}
   * @appliesMixin Polymer.ElementMixin
   * @summary Custom element base class that provides the core API for Polymer's
   *   key meta-programming features including template stamping, data-binding,
   *   attribute deserialization, and property change observation
   */
  Polymer.Element = Polymer.ElementMixin(HTMLElement);

  // NOTE: this is here for modulizer to export `html` for the module version of this file
  Polymer.html = Polymer.html;
})();


(function() {
  'use strict';

  let TemplateInstanceBase = Polymer.TemplateInstanceBase; // eslint-disable-line

  /**
   * @constructor
   * @implements {Polymer_OptionalMutableData}
   * @extends {Polymer.Element}
   * @private
   */
  const domRepeatBase = Polymer.OptionalMutableData(Polymer.Element);

  /**
   * The `<dom-repeat>` element will automatically stamp and binds one instance
   * of template content to each object in a user-provided array.
   * `dom-repeat` accepts an `items` property, and one instance of the template
   * is stamped for each item into the DOM at the location of the `dom-repeat`
   * element.  The `item` property will be set on each instance's binding
   * scope, thus templates should bind to sub-properties of `item`.
   *
   * Example:
   *
   * ```html
   * <dom-module id="employee-list">
   *
   *   <template>
   *
   *     <div> Employee list: </div>
   *     <dom-repeat items="{{employees}}">
   *       <template>
   *         <div>First name: <span>{{item.first}}</span></div>
   *         <div>Last name: <span>{{item.last}}</span></div>
   *       </template>
   *     </dom-repeat>
   *
   *   </template>
   *
   * </dom-module>
   * ```
   *
   * With the following custom element definition:
   *
   * ```js
   * class EmployeeList extends Polymer.Element {
   *   static get is() { return 'employee-list'; }
   *   static get properties() {
   *     return {
   *       employees: {
   *         value() {
   *           return [
   *             {first: 'Bob', last: 'Smith'},
   *             {first: 'Sally', last: 'Johnson'},
   *             ...
   *           ];
   *         }
   *       }
   *     };
   *   }
   * }
   * ```
   *
   * Notifications for changes to items sub-properties will be forwarded to template
   * instances, which will update via the normal structured data notification system.
   *
   * Mutations to the `items` array itself should be made using the Array
   * mutation API's on `Polymer.Base` (`push`, `pop`, `splice`, `shift`,
   * `unshift`), and template instances will be kept in sync with the data in the
   * array.
   *
   * Events caught by event handlers within the `dom-repeat` template will be
   * decorated with a `model` property, which represents the binding scope for
   * each template instance.  The model is an instance of Polymer.Base, and should
   * be used to manipulate data on the instance, for example
   * `event.model.set('item.checked', true);`.
   *
   * Alternatively, the model for a template instance for an element stamped by
   * a `dom-repeat` can be obtained using the `modelForElement` API on the
   * `dom-repeat` that stamped it, for example
   * `this.$.domRepeat.modelForElement(event.target).set('item.checked', true);`.
   * This may be useful for manipulating instance data of event targets obtained
   * by event handlers on parents of the `dom-repeat` (event delegation).
   *
   * A view-specific filter/sort may be applied to each `dom-repeat` by supplying a
   * `filter` and/or `sort` property.  This may be a string that names a function on
   * the host, or a function may be assigned to the property directly.  The functions
   * should implemented following the standard `Array` filter/sort API.
   *
   * In order to re-run the filter or sort functions based on changes to sub-fields
   * of `items`, the `observe` property may be set as a space-separated list of
   * `item` sub-fields that should cause a re-filter/sort when modified.  If
   * the filter or sort function depends on properties not contained in `items`,
   * the user should observe changes to those properties and call `render` to update
   * the view based on the dependency change.
   *
   * For example, for an `dom-repeat` with a filter of the following:
   *
   * ```js
   * isEngineer(item) {
   *   return item.type == 'engineer' || item.manager.type == 'engineer';
   * }
   * ```
   *
   * Then the `observe` property should be configured as follows:
   *
   * ```html
   * <dom-repeat items="{{employees}}" filter="isEngineer" observe="type manager.type">
   * ```
   *
   * @customElement
   * @polymer
   * @memberof Polymer
   * @extends {domRepeatBase}
   * @appliesMixin Polymer.OptionalMutableData
   * @summary Custom element for stamping instance of a template bound to
   *   items in an array.
   */
  class DomRepeat extends domRepeatBase {

    // Not needed to find template; can be removed once the analyzer
    // can find the tag name from customElements.define call
    static get is() { return 'dom-repeat'; }

    static get template() { return null; }

    static get properties() {

      /**
       * Fired whenever DOM is added or removed by this template (by
       * default, rendering occurs lazily).  To force immediate rendering, call
       * `render`.
       *
       * @event dom-change
       */
      return {

        /**
         * An array containing items determining how many instances of the template
         * to stamp and that that each template instance should bind to.
         */
        items: {
          type: Array
        },

        /**
         * The name of the variable to add to the binding scope for the array
         * element associated with a given template instance.
         */
        as: {
          type: String,
          value: 'item'
        },

        /**
         * The name of the variable to add to the binding scope with the index
         * of the instance in the sorted and filtered list of rendered items.
         * Note, for the index in the `this.items` array, use the value of the
         * `itemsIndexAs` property.
         */
        indexAs: {
          type: String,
          value: 'index'
        },

        /**
         * The name of the variable to add to the binding scope with the index
         * of the instance in the `this.items` array. Note, for the index of
         * this instance in the sorted and filtered list of rendered items,
         * use the value of the `indexAs` property.
         */
        itemsIndexAs: {
          type: String,
          value: 'itemsIndex'
        },

        /**
         * A function that should determine the sort order of the items.  This
         * property should either be provided as a string, indicating a method
         * name on the element's host, or else be an actual function.  The
         * function should match the sort function passed to `Array.sort`.
         * Using a sort function has no effect on the underlying `items` array.
         */
        sort: {
          type: Function,
          observer: '__sortChanged'
        },

        /**
         * A function that can be used to filter items out of the view.  This
         * property should either be provided as a string, indicating a method
         * name on the element's host, or else be an actual function.  The
         * function should match the sort function passed to `Array.filter`.
         * Using a filter function has no effect on the underlying `items` array.
         */
        filter: {
          type: Function,
          observer: '__filterChanged'
        },

        /**
         * When using a `filter` or `sort` function, the `observe` property
         * should be set to a space-separated list of the names of item
         * sub-fields that should trigger a re-sort or re-filter when changed.
         * These should generally be fields of `item` that the sort or filter
         * function depends on.
         */
        observe: {
          type: String,
          observer: '__observeChanged'
        },

        /**
         * When using a `filter` or `sort` function, the `delay` property
         * determines a debounce time in ms after a change to observed item
         * properties that must pass before the filter or sort is re-run.
         * This is useful in rate-limiting shuffling of the view when
         * item changes may be frequent.
         */
        delay: Number,

        /**
         * Count of currently rendered items after `filter` (if any) has been applied.
         * If "chunking mode" is enabled, `renderedItemCount` is updated each time a
         * set of template instances is rendered.
         *
         */
        renderedItemCount: {
          type: Number,
          notify: true,
          readOnly: true
        },

        /**
         * Defines an initial count of template instances to render after setting
         * the `items` array, before the next paint, and puts the `dom-repeat`
         * into "chunking mode".  The remaining items will be created and rendered
         * incrementally at each animation frame therof until all instances have
         * been rendered.
         */
        initialCount: {
          type: Number,
          observer: '__initializeChunking'
        },

        /**
         * When `initialCount` is used, this property defines a frame rate (in
         * fps) to target by throttling the number of instances rendered each
         * frame to not exceed the budget for the target frame rate.  The
         * framerate is effectively the number of `requestAnimationFrame`s that
         * it tries to allow to actually fire in a given second. It does this
         * by measuring the time between `rAF`s and continuously adjusting the
         * number of items created each `rAF` to maintain the target framerate.
         * Setting this to a higher number allows lower latency and higher
         * throughput for event handlers and other tasks, but results in a
         * longer time for the remaining items to complete rendering.
         */
        targetFramerate: {
          type: Number,
          value: 20
        },

        _targetFrameTime: {
          type: Number,
          computed: '__computeFrameTime(targetFramerate)'
        }

      };

    }

    static get observers() {
      return [ '__itemsChanged(items.*)' ];
    }

    constructor() {
      super();
      this.__instances = [];
      this.__limit = Infinity;
      this.__pool = [];
      this.__renderDebouncer = null;
      this.__itemsIdxToInstIdx = {};
      this.__chunkCount = null;
      this.__lastChunkTime = null;
      this.__sortFn = null;
      this.__filterFn = null;
      this.__observePaths = null;
      this.__ctor = null;
      this.__isDetached = true;
      this.template = null;
    }

    /**
     * @return {void}
     */
    disconnectedCallback() {
      super.disconnectedCallback();
      this.__isDetached = true;
      for (let i=0; i<this.__instances.length; i++) {
        this.__detachInstance(i);
      }
    }

    /**
     * @return {void}
     */
    connectedCallback() {
      super.connectedCallback();
      this.style.display = 'none';
      // only perform attachment if the element was previously detached.
      if (this.__isDetached) {
        this.__isDetached = false;
        let parent = this.parentNode;
        for (let i=0; i<this.__instances.length; i++) {
          this.__attachInstance(i, parent);
        }
      }
    }

    __ensureTemplatized() {
      // Templatizing (generating the instance constructor) needs to wait
      // until ready, since won't have its template content handed back to
      // it until then
      if (!this.__ctor) {
        let template = this.template = /** @type {HTMLTemplateElement} */(this.querySelector('template'));
        if (!template) {
          // // Wait until childList changes and template should be there by then
          let observer = new MutationObserver(() => {
            if (this.querySelector('template')) {
              observer.disconnect();
              this.__render();
            } else {
              throw new Error('dom-repeat requires a <template> child');
            }
          });
          observer.observe(this, {childList: true});
          return false;
        }
        // Template instance props that should be excluded from forwarding
        let instanceProps = {};
        instanceProps[this.as] = true;
        instanceProps[this.indexAs] = true;
        instanceProps[this.itemsIndexAs] = true;
        this.__ctor = Polymer.Templatize.templatize(template, this, {
          mutableData: this.mutableData,
          parentModel: true,
          instanceProps: instanceProps,
          /**
           * @this {this}
           * @param {string} prop Property to set
           * @param {*} value Value to set property to
           */
          forwardHostProp: function(prop, value) {
            let i$ = this.__instances;
            for (let i=0, inst; (i<i$.length) && (inst=i$[i]); i++) {
              inst.forwardHostProp(prop, value);
            }
          },
          /**
           * @this {this}
           * @param {Object} inst Instance to notify
           * @param {string} prop Property to notify
           * @param {*} value Value to notify
           */
          notifyInstanceProp: function(inst, prop, value) {
            if (Polymer.Path.matches(this.as, prop)) {
              let idx = inst[this.itemsIndexAs];
              if (prop == this.as) {
                this.items[idx] = value;
              }
              let path = Polymer.Path.translate(this.as, 'items.' + idx, prop);
              this.notifyPath(path, value);
            }
          }
        });
      }
      return true;
    }

    __getMethodHost() {
      // Technically this should be the owner of the outermost template.
      // In shadow dom, this is always getRootNode().host, but we can
      // approximate this via cooperation with our dataHost always setting
      // `_methodHost` as long as there were bindings (or id's) on this
      // instance causing it to get a dataHost.
      return this.__dataHost._methodHost || this.__dataHost;
    }

    __functionFromPropertyValue(functionOrMethodName) {
      if (typeof functionOrMethodName === 'string') {
        let methodName = functionOrMethodName;
        let obj = this.__getMethodHost();
        return function() { return obj[methodName].apply(obj, arguments); };
      }

      return functionOrMethodName;
    }

    __sortChanged(sort) {
      this.__sortFn = this.__functionFromPropertyValue(sort);
      if (this.items) { this.__debounceRender(this.__render); }
    }

    __filterChanged(filter) {
      this.__filterFn = this.__functionFromPropertyValue(filter);
      if (this.items) { this.__debounceRender(this.__render); }
    }

    __computeFrameTime(rate) {
      return Math.ceil(1000/rate);
    }

    __initializeChunking() {
      if (this.initialCount) {
        this.__limit = this.initialCount;
        this.__chunkCount = this.initialCount;
        this.__lastChunkTime = performance.now();
      }
    }

    __tryRenderChunk() {
      // Debounced so that multiple calls through `_render` between animation
      // frames only queue one new rAF (e.g. array mutation & chunked render)
      if (this.items && this.__limit < this.items.length) {
        this.__debounceRender(this.__requestRenderChunk);
      }
    }

    __requestRenderChunk() {
      requestAnimationFrame(()=>this.__renderChunk());
    }

    __renderChunk() {
      // Simple auto chunkSize throttling algorithm based on feedback loop:
      // measure actual time between frames and scale chunk count by ratio
      // of target/actual frame time
      let currChunkTime = performance.now();
      let ratio = this._targetFrameTime / (currChunkTime - this.__lastChunkTime);
      this.__chunkCount = Math.round(this.__chunkCount * ratio) || 1;
      this.__limit += this.__chunkCount;
      this.__lastChunkTime = currChunkTime;
      this.__debounceRender(this.__render);
    }

    __observeChanged() {
      this.__observePaths = this.observe &&
        this.observe.replace('.*', '.').split(' ');
    }

    __itemsChanged(change) {
      if (this.items && !Array.isArray(this.items)) {
        console.warn('dom-repeat expected array for `items`, found', this.items);
      }
      // If path was to an item (e.g. 'items.3' or 'items.3.foo'), forward the
      // path to that instance synchronously (returns false for non-item paths)
      if (!this.__handleItemPath(change.path, change.value)) {
        // Otherwise, the array was reset ('items') or spliced ('items.splices'),
        // so queue a full refresh
        this.__initializeChunking();
        this.__debounceRender(this.__render);
      }
    }

    __handleObservedPaths(path) {
      // Handle cases where path changes should cause a re-sort/filter
      if (this.__sortFn || this.__filterFn) {
        if (!path) {
          // Always re-render if the item itself changed
          this.__debounceRender(this.__render, this.delay);
        } else if (this.__observePaths) {
          // Otherwise, re-render if the path changed matches an observed path
          let paths = this.__observePaths;
          for (let i=0; i<paths.length; i++) {
            if (path.indexOf(paths[i]) === 0) {
              this.__debounceRender(this.__render, this.delay);
            }
          }
        }
      }
    }

    /**
     * @param {function(this:DomRepeat)} fn Function to debounce.
     * @param {number=} delay Delay in ms to debounce by.
     */
    __debounceRender(fn, delay = 0) {
      this.__renderDebouncer = Polymer.Debouncer.debounce(
            this.__renderDebouncer
          , delay > 0 ? Polymer.Async.timeOut.after(delay) : Polymer.Async.microTask
          , fn.bind(this));
      Polymer.enqueueDebouncer(this.__renderDebouncer);
    }

    /**
     * Forces the element to render its content. Normally rendering is
     * asynchronous to a provoking change. This is done for efficiency so
     * that multiple changes trigger only a single render. The render method
     * should be called if, for example, template rendering is required to
     * validate application state.
     * @return {void}
     */
    render() {
      // Queue this repeater, then flush all in order
      this.__debounceRender(this.__render);
      Polymer.flush();
    }

    __render() {
      if (!this.__ensureTemplatized()) {
        // No template found yet
        return;
      }
      this.__applyFullRefresh();
      // Reset the pool
      // TODO(kschaaf): Reuse pool across turns and nested templates
      // Now that objects/arrays are re-evaluated when set, we can safely
      // reuse pooled instances across turns, however we still need to decide
      // semantics regarding how long to hold, how many to hold, etc.
      this.__pool.length = 0;
      // Set rendered item count
      this._setRenderedItemCount(this.__instances.length);
      // Notify users
      this.dispatchEvent(new CustomEvent('dom-change', {
        bubbles: true,
        composed: true
      }));
      // Check to see if we need to render more items
      this.__tryRenderChunk();
    }

    __applyFullRefresh() {
      let items = this.items || [];
      let isntIdxToItemsIdx = new Array(items.length);
      for (let i=0; i<items.length; i++) {
        isntIdxToItemsIdx[i] = i;
      }
      // Apply user filter
      if (this.__filterFn) {
        isntIdxToItemsIdx = isntIdxToItemsIdx.filter((i, idx, array) =>
          this.__filterFn(items[i], idx, array));
      }
      // Apply user sort
      if (this.__sortFn) {
        isntIdxToItemsIdx.sort((a, b) => this.__sortFn(items[a], items[b]));
      }
      // items->inst map kept for item path forwarding
      const itemsIdxToInstIdx = this.__itemsIdxToInstIdx = {};
      let instIdx = 0;
      // Generate instances and assign items
      const limit = Math.min(isntIdxToItemsIdx.length, this.__limit);
      for (; instIdx<limit; instIdx++) {
        let inst = this.__instances[instIdx];
        let itemIdx = isntIdxToItemsIdx[instIdx];
        let item = items[itemIdx];
        itemsIdxToInstIdx[itemIdx] = instIdx;
        if (inst) {
          inst._setPendingProperty(this.as, item);
          inst._setPendingProperty(this.indexAs, instIdx);
          inst._setPendingProperty(this.itemsIndexAs, itemIdx);
          inst._flushProperties();
        } else {
          this.__insertInstance(item, instIdx, itemIdx);
        }
      }
      // Remove any extra instances from previous state
      for (let i=this.__instances.length-1; i>=instIdx; i--) {
        this.__detachAndRemoveInstance(i);
      }
    }

    __detachInstance(idx) {
      let inst = this.__instances[idx];
      for (let i=0; i<inst.children.length; i++) {
        let el = inst.children[i];
        inst.root.appendChild(el);
      }
      return inst;
    }

    __attachInstance(idx, parent) {
      let inst = this.__instances[idx];
      parent.insertBefore(inst.root, this);
    }

    __detachAndRemoveInstance(idx) {
      let inst = this.__detachInstance(idx);
      if (inst) {
        this.__pool.push(inst);
      }
      this.__instances.splice(idx, 1);
    }

    __stampInstance(item, instIdx, itemIdx) {
      let model = {};
      model[this.as] = item;
      model[this.indexAs] = instIdx;
      model[this.itemsIndexAs] = itemIdx;
      return new this.__ctor(model);
    }

    __insertInstance(item, instIdx, itemIdx) {
      let inst = this.__pool.pop();
      if (inst) {
        // TODO(kschaaf): If the pool is shared across turns, hostProps
        // need to be re-set to reused instances in addition to item
        inst._setPendingProperty(this.as, item);
        inst._setPendingProperty(this.indexAs, instIdx);
        inst._setPendingProperty(this.itemsIndexAs, itemIdx);
        inst._flushProperties();
      } else {
        inst = this.__stampInstance(item, instIdx, itemIdx);
      }
      let beforeRow = this.__instances[instIdx + 1];
      let beforeNode = beforeRow ? beforeRow.children[0] : this;
      this.parentNode.insertBefore(inst.root, beforeNode);
      this.__instances[instIdx] = inst;
      return inst;
    }

    // Implements extension point from Templatize mixin
    /**
     * Shows or hides the template instance top level child elements. For
     * text nodes, `textContent` is removed while "hidden" and replaced when
     * "shown."
     * @param {boolean} hidden Set to true to hide the children;
     * set to false to show them.
     * @return {void}
     * @protected
     */
    _showHideChildren(hidden) {
      for (let i=0; i<this.__instances.length; i++) {
        this.__instances[i]._showHideChildren(hidden);
      }
    }

    // Called as a side effect of a host items.<key>.<path> path change,
    // responsible for notifying item.<path> changes to inst for key
    __handleItemPath(path, value) {
      let itemsPath = path.slice(6); // 'items.'.length == 6
      let dot = itemsPath.indexOf('.');
      let itemsIdx = dot < 0 ? itemsPath : itemsPath.substring(0, dot);
      // If path was index into array...
      if (itemsIdx == parseInt(itemsIdx, 10)) {
        let itemSubPath = dot < 0 ? '' : itemsPath.substring(dot+1);
        // If the path is observed, it will trigger a full refresh
        this.__handleObservedPaths(itemSubPath);
        // Note, even if a rull refresh is triggered, always do the path
        // notification because unless mutableData is used for dom-repeat
        // and all elements in the instance subtree, a full refresh may
        // not trigger the proper update.
        let instIdx = this.__itemsIdxToInstIdx[itemsIdx];
        let inst = this.__instances[instIdx];
        if (inst) {
          let itemPath = this.as + (itemSubPath ? '.' + itemSubPath : '');
          // This is effectively `notifyPath`, but avoids some of the overhead
          // of the public API
          inst._setPendingPropertyOrPath(itemPath, value, false, true);
          inst._flushProperties();
        }
        return true;
      }
    }

    /**
     * Returns the item associated with a given element stamped by
     * this `dom-repeat`.
     *
     * Note, to modify sub-properties of the item,
     * `modelForElement(el).set('item.<sub-prop>', value)`
     * should be used.
     *
     * @param {!HTMLElement} el Element for which to return the item.
     * @return {*} Item associated with the element.
     */
    itemForElement(el) {
      let instance = this.modelForElement(el);
      return instance && instance[this.as];
    }

    /**
     * Returns the inst index for a given element stamped by this `dom-repeat`.
     * If `sort` is provided, the index will reflect the sorted order (rather
     * than the original array order).
     *
     * @param {!HTMLElement} el Element for which to return the index.
     * @return {?number} Row index associated with the element (note this may
     *   not correspond to the array index if a user `sort` is applied).
     */
    indexForElement(el) {
      let instance = this.modelForElement(el);
      return instance && instance[this.indexAs];
    }

    /**
     * Returns the template "model" associated with a given element, which
     * serves as the binding scope for the template instance the element is
     * contained in. A template model is an instance of `Polymer.Base`, and
     * should be used to manipulate data associated with this template instance.
     *
     * Example:
     *
     *   let model = modelForElement(el);
     *   if (model.index < 10) {
     *     model.set('item.checked', true);
     *   }
     *
     * @param {!HTMLElement} el Element for which to return a template model.
     * @return {TemplateInstanceBase} Model representing the binding scope for
     *   the element.
     */
    modelForElement(el) {
      return Polymer.Templatize.modelForElement(this.template, el);
    }

  }

  customElements.define(DomRepeat.is, DomRepeat);

  /** @const */
  Polymer.DomRepeat = DomRepeat;

})();




(function() {
  'use strict';

  /**
   * The `<dom-if>` element will stamp a light-dom `<template>` child when
   * the `if` property becomes truthy, and the template can use Polymer
   * data-binding and declarative event features when used in the context of
   * a Polymer element's template.
   *
   * When `if` becomes falsy, the stamped content is hidden but not
   * removed from dom. When `if` subsequently becomes truthy again, the content
   * is simply re-shown. This approach is used due to its favorable performance
   * characteristics: the expense of creating template content is paid only
   * once and lazily.
   *
   * Set the `restamp` property to true to force the stamped content to be
   * created / destroyed when the `if` condition changes.
   *
   * @customElement
   * @polymer
   * @extends Polymer.Element
   * @memberof Polymer
   * @summary Custom element that conditionally stamps and hides or removes
   *   template content based on a boolean flag.
   */
  class DomIf extends Polymer.Element {

    // Not needed to find template; can be removed once the analyzer
    // can find the tag name from customElements.define call
    static get is() { return 'dom-if'; }

    static get template() { return null; }

    static get properties() {

      return {

        /**
         * Fired whenever DOM is added or removed/hidden by this template (by
         * default, rendering occurs lazily).  To force immediate rendering, call
         * `render`.
         *
         * @event dom-change
         */

        /**
         * A boolean indicating whether this template should stamp.
         */
        if: {
          type: Boolean,
          observer: '__debounceRender'
        },

        /**
         * When true, elements will be removed from DOM and discarded when `if`
         * becomes false and re-created and added back to the DOM when `if`
         * becomes true.  By default, stamped elements will be hidden but left
         * in the DOM when `if` becomes false, which is generally results
         * in better performance.
         */
        restamp: {
          type: Boolean,
          observer: '__debounceRender'
        }

      };

    }

    constructor() {
      super();
      this.__renderDebouncer = null;
      this.__invalidProps = null;
      this.__instance = null;
      this._lastIf = false;
      this.__ctor = null;
    }

    __debounceRender() {
      // Render is async for 2 reasons:
      // 1. To eliminate dom creation trashing if user code thrashes `if` in the
      //    same turn. This was more common in 1.x where a compound computed
      //    property could result in the result changing multiple times, but is
      //    mitigated to a large extent by batched property processing in 2.x.
      // 2. To avoid double object propagation when a bag including values bound
      //    to the `if` property as well as one or more hostProps could enqueue
      //    the <dom-if> to flush before the <template>'s host property
      //    forwarding. In that scenario creating an instance would result in
      //    the host props being set once, and then the enqueued changes on the
      //    template would set properties a second time, potentially causing an
      //    object to be set to an instance more than once.  Creating the
      //    instance async from flushing data ensures this doesn't happen. If
      //    we wanted a sync option in the future, simply having <dom-if> flush
      //    (or clear) its template's pending host properties before creating
      //    the instance would also avoid the problem.
      this.__renderDebouncer = Polymer.Debouncer.debounce(
            this.__renderDebouncer
          , Polymer.Async.microTask
          , () => this.__render());
      Polymer.enqueueDebouncer(this.__renderDebouncer);
    }

    /**
     * @return {void}
     */
    disconnectedCallback() {
      super.disconnectedCallback();
      if (!this.parentNode ||
          (this.parentNode.nodeType == Node.DOCUMENT_FRAGMENT_NODE &&
           !this.parentNode.host)) {
        this.__teardownInstance();
      }
    }

    /**
     * @return {void}
     */
    connectedCallback() {
      super.connectedCallback();
      this.style.display = 'none';
      if (this.if) {
        this.__debounceRender();
      }
    }

    /**
     * Forces the element to render its content. Normally rendering is
     * asynchronous to a provoking change. This is done for efficiency so
     * that multiple changes trigger only a single render. The render method
     * should be called if, for example, template rendering is required to
     * validate application state.
     * @return {void}
     */
    render() {
      Polymer.flush();
    }

    __render() {
      if (this.if) {
        if (!this.__ensureInstance()) {
          // No template found yet
          return;
        }
        this._showHideChildren();
      } else if (this.restamp) {
        this.__teardownInstance();
      }
      if (!this.restamp && this.__instance) {
        this._showHideChildren();
      }
      if (this.if != this._lastIf) {
        this.dispatchEvent(new CustomEvent('dom-change', {
          bubbles: true,
          composed: true
        }));
        this._lastIf = this.if;
      }
    }

    __ensureInstance() {
      let parentNode = this.parentNode;
      // Guard against element being detached while render was queued
      if (parentNode) {
        if (!this.__ctor) {
          let template = /** @type {HTMLTemplateElement} */(this.querySelector('template'));
          if (!template) {
            // Wait until childList changes and template should be there by then
            let observer = new MutationObserver(() => {
              if (this.querySelector('template')) {
                observer.disconnect();
                this.__render();
              } else {
                throw new Error('dom-if requires a <template> child');
              }
            });
            observer.observe(this, {childList: true});
            return false;
          }
          this.__ctor = Polymer.Templatize.templatize(template, this, {
            // dom-if templatizer instances require `mutable: true`, as
            // `__syncHostProperties` relies on that behavior to sync objects
            mutableData: true,
            /**
             * @param {string} prop Property to forward
             * @param {*} value Value of property
             * @this {this}
             */
            forwardHostProp: function(prop, value) {
              if (this.__instance) {
                if (this.if) {
                  this.__instance.forwardHostProp(prop, value);
                } else {
                  // If we have an instance but are squelching host property
                  // forwarding due to if being false, note the invalidated
                  // properties so `__syncHostProperties` can sync them the next
                  // time `if` becomes true
                  this.__invalidProps = this.__invalidProps || Object.create(null);
                  this.__invalidProps[Polymer.Path.root(prop)] = true;
                }
              }
            }
          });
        }
        if (!this.__instance) {
          this.__instance = new this.__ctor();
          parentNode.insertBefore(this.__instance.root, this);
        } else {
          this.__syncHostProperties();
          let c$ = this.__instance.children;
          if (c$ && c$.length) {
            // Detect case where dom-if was re-attached in new position
            let lastChild = this.previousSibling;
            if (lastChild !== c$[c$.length-1]) {
              for (let i=0, n; (i<c$.length) && (n=c$[i]); i++) {
                parentNode.insertBefore(n, this);
              }
            }
          }
        }
      }
      return true;
    }

    __syncHostProperties() {
      let props = this.__invalidProps;
      if (props) {
        for (let prop in props) {
          this.__instance._setPendingProperty(prop, this.__dataHost[prop]);
        }
        this.__invalidProps = null;
        this.__instance._flushProperties();
      }
    }

    __teardownInstance() {
      if (this.__instance) {
        let c$ = this.__instance.children;
        if (c$ && c$.length) {
          // use first child parent, for case when dom-if may have been detached
          let parent = c$[0].parentNode;
          // Instance children may be disconnected from parents when dom-if
          // detaches if a tree was innerHTML'ed
          if (parent) {
            for (let i=0, n; (i<c$.length) && (n=c$[i]); i++) {
              parent.removeChild(n);
            }
          }
        }
        this.__instance = null;
        this.__invalidProps = null;
      }
    }

    /**
     * Shows or hides the template instance top level child elements. For
     * text nodes, `textContent` is removed while "hidden" and replaced when
     * "shown."
     * @return {void}
     * @protected
     */
    _showHideChildren() {
      let hidden = this.__hideTemplateChildren__ || !this.if;
      if (this.__instance) {
        this.__instance._showHideChildren(hidden);
      }
    }

  }

  customElements.define(DomIf.is, DomIf);

  /** @const */
  Polymer.DomIf = DomIf;

})();


(function() {
  'use strict';

  /**
   * Element mixin for recording dynamic associations between item paths in a
   * master `items` array and a `selected` array such that path changes to the
   * master array (at the host) element or elsewhere via data-binding) are
   * correctly propagated to items in the selected array and vice-versa.
   *
   * The `items` property accepts an array of user data, and via the
   * `select(item)` and `deselect(item)` API, updates the `selected` property
   * which may be bound to other parts of the application, and any changes to
   * sub-fields of `selected` item(s) will be kept in sync with items in the
   * `items` array.  When `multi` is false, `selected` is a property
   * representing the last selected item.  When `multi` is true, `selected`
   * is an array of multiply selected items.
   *
   * @polymer
   * @mixinFunction
   * @appliesMixin Polymer.ElementMixin
   * @memberof Polymer
   * @summary Element mixin for recording dynamic associations between item paths in a
   * master `items` array and a `selected` array
   */
  let ArraySelectorMixin = Polymer.dedupingMixin(superClass => {

    /**
     * @constructor
     * @extends {superClass}
     * @implements {Polymer_ElementMixin}
     * @private
     */
    let elementBase = Polymer.ElementMixin(superClass);

    /**
     * @polymer
     * @mixinClass
     * @implements {Polymer_ArraySelectorMixin}
     * @unrestricted
     */
    class ArraySelectorMixin extends elementBase {

      static get properties() {

        return {

          /**
           * An array containing items from which selection will be made.
           */
          items: {
            type: Array,
          },

          /**
           * When `true`, multiple items may be selected at once (in this case,
           * `selected` is an array of currently selected items).  When `false`,
           * only one item may be selected at a time.
           */
          multi: {
            type: Boolean,
            value: false,
          },

          /**
           * When `multi` is true, this is an array that contains any selected.
           * When `multi` is false, this is the currently selected item, or `null`
           * if no item is selected.
           * @type {?(Object|Array<!Object>)}
           */
          selected: {
            type: Object,
            notify: true
          },

          /**
           * When `multi` is false, this is the currently selected item, or `null`
           * if no item is selected.
           * @type {?Object}
           */
          selectedItem: {
            type: Object,
            notify: true
          },

          /**
           * When `true`, calling `select` on an item that is already selected
           * will deselect the item.
           */
          toggle: {
            type: Boolean,
            value: false
          }

        };
      }

      static get observers() {
        return ['__updateSelection(multi, items.*)'];
      }

      constructor() {
        super();
        this.__lastItems = null;
        this.__lastMulti = null;
        this.__selectedMap = null;
      }

      __updateSelection(multi, itemsInfo) {
        let path = itemsInfo.path;
        if (path == 'items') {
          // Case 1 - items array changed, so diff against previous array and
          // deselect any removed items and adjust selected indices
          let newItems = itemsInfo.base || [];
          let lastItems = this.__lastItems;
          let lastMulti = this.__lastMulti;
          if (multi !== lastMulti) {
            this.clearSelection();
          }
          if (lastItems) {
            let splices = Polymer.ArraySplice.calculateSplices(newItems, lastItems);
            this.__applySplices(splices);
          }
          this.__lastItems = newItems;
          this.__lastMulti = multi;
        } else if (itemsInfo.path == 'items.splices') {
          // Case 2 - got specific splice information describing the array mutation:
          // deselect any removed items and adjust selected indices
          this.__applySplices(itemsInfo.value.indexSplices);
        } else {
          // Case 3 - an array element was changed, so deselect the previous
          // item for that index if it was previously selected
          let part = path.slice('items.'.length);
          let idx = parseInt(part, 10);
          if ((part.indexOf('.') < 0) && part == idx) {
            this.__deselectChangedIdx(idx);
          }
        }
      }

      __applySplices(splices) {
        let selected = this.__selectedMap;
        // Adjust selected indices and mark removals
        for (let i=0; i<splices.length; i++) {
          let s = splices[i];
          selected.forEach((idx, item) => {
            if (idx < s.index) {
              // no change
            } else if (idx >= s.index + s.removed.length) {
              // adjust index
              selected.set(item, idx + s.addedCount - s.removed.length);
            } else {
              // remove index
              selected.set(item, -1);
            }
          });
          for (let j=0; j<s.addedCount; j++) {
            let idx = s.index + j;
            if (selected.has(this.items[idx])) {
              selected.set(this.items[idx], idx);
            }
          }
        }
        // Update linked paths
        this.__updateLinks();
        // Remove selected items that were removed from the items array
        let sidx = 0;
        selected.forEach((idx, item) => {
          if (idx < 0) {
            if (this.multi) {
              this.splice('selected', sidx, 1);
            } else {
              this.selected = this.selectedItem = null;
            }
            selected.delete(item);
          } else {
            sidx++;
          }
        });
      }

      __updateLinks() {
        this.__dataLinkedPaths = {};
        if (this.multi) {
          let sidx = 0;
          this.__selectedMap.forEach(idx => {
            if (idx >= 0) {
              this.linkPaths('items.' + idx, 'selected.' + sidx++);
            }
          });
        } else {
          this.__selectedMap.forEach(idx => {
            this.linkPaths('selected', 'items.' + idx);
            this.linkPaths('selectedItem', 'items.' + idx);
          });
        }
      }

      /**
       * Clears the selection state.
       * @return {void}
       */
      clearSelection() {
        // Unbind previous selection
        this.__dataLinkedPaths = {};
        // The selected map stores 3 pieces of information:
        // key: items array object
        // value: items array index
        // order: selected array index
        this.__selectedMap = new Map();
        // Initialize selection
        this.selected = this.multi ? [] : null;
        this.selectedItem = null;
      }

      /**
       * Returns whether the item is currently selected.
       *
       * @param {*} item Item from `items` array to test
       * @return {boolean} Whether the item is selected
       */
      isSelected(item) {
        return this.__selectedMap.has(item);
      }

      /**
       * Returns whether the item is currently selected.
       *
       * @param {number} idx Index from `items` array to test
       * @return {boolean} Whether the item is selected
       */
      isIndexSelected(idx) {
        return this.isSelected(this.items[idx]);
      }

      __deselectChangedIdx(idx) {
        let sidx = this.__selectedIndexForItemIndex(idx);
        if (sidx >= 0) {
          let i = 0;
          this.__selectedMap.forEach((idx, item) => {
            if (sidx == i++) {
              this.deselect(item);
            }
          });
        }
      }

      __selectedIndexForItemIndex(idx) {
        let selected = this.__dataLinkedPaths['items.' + idx];
        if (selected) {
          return parseInt(selected.slice('selected.'.length), 10);
        }
      }

      /**
       * Deselects the given item if it is already selected.
       *
       * @param {*} item Item from `items` array to deselect
       * @return {void}
       */
      deselect(item) {
        let idx = this.__selectedMap.get(item);
        if (idx >= 0) {
          this.__selectedMap.delete(item);
          let sidx;
          if (this.multi) {
            sidx = this.__selectedIndexForItemIndex(idx);
          }
          this.__updateLinks();
          if (this.multi) {
            this.splice('selected', sidx, 1);
          } else {
            this.selected = this.selectedItem = null;
          }
        }
      }

      /**
       * Deselects the given index if it is already selected.
       *
       * @param {number} idx Index from `items` array to deselect
       * @return {void}
       */
      deselectIndex(idx) {
        this.deselect(this.items[idx]);
      }

      /**
       * Selects the given item.  When `toggle` is true, this will automatically
       * deselect the item if already selected.
       *
       * @param {*} item Item from `items` array to select
       * @return {void}
       */
      select(item) {
        this.selectIndex(this.items.indexOf(item));
      }

      /**
       * Selects the given index.  When `toggle` is true, this will automatically
       * deselect the item if already selected.
       *
       * @param {number} idx Index from `items` array to select
       * @return {void}
       */
      selectIndex(idx) {
        let item = this.items[idx];
        if (!this.isSelected(item)) {
          if (!this.multi) {
            this.__selectedMap.clear();
          }
          this.__selectedMap.set(item, idx);
          this.__updateLinks();
          if (this.multi) {
            this.push('selected', item);
          } else {
            this.selected = this.selectedItem = item;
          }
        } else if (this.toggle) {
          this.deselectIndex(idx);
        }
      }

    }

    return ArraySelectorMixin;

  });

  // export mixin
  Polymer.ArraySelectorMixin = ArraySelectorMixin;

  /**
   * @constructor
   * @extends {Polymer.Element}
   * @implements {Polymer_ArraySelectorMixin}
   * @private
   */
  let baseArraySelector = ArraySelectorMixin(Polymer.Element);

  /**
   * Element implementing the `Polymer.ArraySelector` mixin, which records
   * dynamic associations between item paths in a master `items` array and a
   * `selected` array such that path changes to the master array (at the host)
   * element or elsewhere via data-binding) are correctly propagated to items
   * in the selected array and vice-versa.
   *
   * The `items` property accepts an array of user data, and via the
   * `select(item)` and `deselect(item)` API, updates the `selected` property
   * which may be bound to other parts of the application, and any changes to
   * sub-fields of `selected` item(s) will be kept in sync with items in the
   * `items` array.  When `multi` is false, `selected` is a property
   * representing the last selected item.  When `multi` is true, `selected`
   * is an array of multiply selected items.
   *
   * Example:
   *
   * ```html
   * <dom-module id="employee-list">
   *
   *   <template>
   *
   *     <div> Employee list: </div>
   *     <dom-repeat id="employeeList" items="{{employees}}">
   *       <template>
   *         <div>First name: <span>{{item.first}}</span></div>
   *           <div>Last name: <span>{{item.last}}</span></div>
   *           <button on-click="toggleSelection">Select</button>
   *       </template>
   *     </dom-repeat>
   *
   *     <array-selector id="selector" items="{{employees}}" selected="{{selected}}" multi toggle></array-selector>
   *
   *     <div> Selected employees: </div>
   *     <dom-repeat items="{{selected}}">
   *       <template>
   *         <div>First name: <span>{{item.first}}</span></div>
   *         <div>Last name: <span>{{item.last}}</span></div>
   *       </template>
   *     </dom-repeat>
   *
   *   </template>
   *
   * </dom-module>
   * ```
   *
   * ```js
   *class EmployeeList extends Polymer.Element {
   *  static get is() { return 'employee-list'; }
   *  static get properties() {
   *    return {
   *      employees: {
   *        value() {
   *          return [
   *            {first: 'Bob', last: 'Smith'},
   *            {first: 'Sally', last: 'Johnson'},
   *            ...
   *          ];
   *        }
   *      }
   *    };
   *  }
   *  toggleSelection(e) {
   *    let item = this.$.employeeList.itemForElement(e.target);
   *    this.$.selector.select(item);
   *  }
   *}
   * ```
   *
   * @polymer
   * @customElement
   * @extends {baseArraySelector}
   * @appliesMixin Polymer.ArraySelectorMixin
   * @memberof Polymer
   * @summary Custom element that links paths between an input `items` array and
   *   an output `selected` item or array based on calls to its selection API.
   */
  class ArraySelector extends baseArraySelector {
    // Not needed to find template; can be removed once the analyzer
    // can find the tag name from customElements.define call
    static get is() { return 'array-selector'; }
  }
  customElements.define(ArraySelector.is, ArraySelector);

  /** @const */
  Polymer.ArraySelector = ArraySelector;

})();


(function(){/*

Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
'use strict';var c=null,f=window.HTMLImports&&window.HTMLImports.whenReady||null,g;function h(a){requestAnimationFrame(function(){f?f(a):(c||(c=new Promise(function(a){g=a}),"complete"===document.readyState?g():document.addEventListener("readystatechange",function(){"complete"===document.readyState&&g()})),c.then(function(){a&&a()}))})};var k=null,l=null;function m(){this.customStyles=[];this.enqueued=!1;h(function(){window.ShadyCSS.flushCustomStyles&&window.ShadyCSS.flushCustomStyles()})}function n(a){!a.enqueued&&l&&(a.enqueued=!0,h(l))}m.prototype.c=function(a){a.__seenByShadyCSS||(a.__seenByShadyCSS=!0,this.customStyles.push(a),n(this))};m.prototype.b=function(a){if(a.__shadyCSSCachedStyle)return a.__shadyCSSCachedStyle;var b;a.getStyle?b=a.getStyle():b=a;return b};
m.prototype.a=function(){for(var a=this.customStyles,b=0;b<a.length;b++){var d=a[b];if(!d.__shadyCSSCachedStyle){var e=this.b(d);e&&(e=e.__appliedElement||e,k&&k(e),d.__shadyCSSCachedStyle=e)}}return a};m.prototype.addCustomStyle=m.prototype.c;m.prototype.getStyleForCustomStyle=m.prototype.b;m.prototype.processStyles=m.prototype.a;
Object.defineProperties(m.prototype,{transformCallback:{get:function(){return k},set:function(a){k=a}},validateCallback:{get:function(){return l},set:function(a){var b=!1;l||(b=!0);l=a;b&&n(this)}}});function p(a,b){for(var d in b)null===d?a.style.removeProperty(d):a.style.setProperty(d,b[d])};var q=!(window.ShadyDOM&&window.ShadyDOM.inUse),r;function t(a){r=a&&a.shimcssproperties?!1:q||!(navigator.userAgent.match(/AppleWebKit\/601|Edge\/15/)||!window.CSS||!CSS.supports||!CSS.supports("box-shadow","0 0 0 var(--foo)"))}var u;window.ShadyCSS&&void 0!==window.ShadyCSS.cssBuild&&(u=window.ShadyCSS.cssBuild);var v=!(!window.ShadyCSS||!window.ShadyCSS.disableRuntime);
window.ShadyCSS&&void 0!==window.ShadyCSS.nativeCss?r=window.ShadyCSS.nativeCss:window.ShadyCSS?(t(window.ShadyCSS),window.ShadyCSS=void 0):t(window.WebComponents&&window.WebComponents.flags);var w=r,x=u;var y=new m;window.ShadyCSS||(window.ShadyCSS={prepareTemplate:function(){},prepareTemplateDom:function(){},prepareTemplateStyles:function(){},styleSubtree:function(a,b){y.a();p(a,b)},styleElement:function(){y.a()},styleDocument:function(a){y.a();p(document.body,a)},getComputedStyleValue:function(a,b){return(a=window.getComputedStyle(a).getPropertyValue(b))?a.trim():""},flushCustomStyles:function(){},nativeCss:w,nativeShadow:q,cssBuild:x,disableRuntime:v});window.ShadyCSS.CustomStyleInterface=y;}).call(this);




(function() {
  'use strict';

  const attr = 'include';

  const CustomStyleInterface = window.ShadyCSS.CustomStyleInterface;

  /**
   * Custom element for defining styles in the main document that can take
   * advantage of [shady DOM](https://github.com/webcomponents/shadycss) shims
   * for style encapsulation, custom properties, and custom mixins.
   *
   * - Document styles defined in a `<custom-style>` are shimmed to ensure they
   *   do not leak into local DOM when running on browsers without native
   *   Shadow DOM.
   * - Custom properties can be defined in a `<custom-style>`. Use the `html` selector
   *   to define custom properties that apply to all custom elements.
   * - Custom mixins can be defined in a `<custom-style>`, if you import the optional
   *   [apply shim](https://github.com/webcomponents/shadycss#about-applyshim)
   *   (`shadycss/apply-shim.html`).
   *
   * To use:
   *
   * - Import `custom-style.html`.
   * - Place a `<custom-style>` element in the main document, wrapping an inline `<style>` tag that
   *   contains the CSS rules you want to shim.
   *
   * For example:
   *
   * ```html
   * <!-- import apply shim--only required if using mixins -->
   * <link rel="import" href="bower_components/shadycss/apply-shim.html">
   * <!-- import custom-style element -->
   * <link rel="import" href="bower_components/polymer/lib/elements/custom-style.html">
   *
   * <custom-style>
   *   <style>
   *     html {
   *       --custom-color: blue;
   *       --custom-mixin: {
   *         font-weight: bold;
   *         color: red;
   *       };
   *     }
   *   </style>
   * </custom-style>
   * ```
   *
   * @customElement
   * @extends HTMLElement
   * @memberof Polymer
   * @summary Custom element for defining styles in the main document that can
   *   take advantage of Polymer's style scoping and custom properties shims.
   */
  class CustomStyle extends HTMLElement {
    constructor() {
      super();
      this._style = null;
      CustomStyleInterface.addCustomStyle(this);
    }
    /**
     * Returns the light-DOM `<style>` child this element wraps.  Upon first
     * call any style modules referenced via the `include` attribute will be
     * concatenated to this element's `<style>`.
     *
     * @return {HTMLStyleElement} This element's light-DOM `<style>`
     */
    getStyle() {
      if (this._style) {
        return this._style;
      }
      const style = /** @type {HTMLStyleElement} */(this.querySelector('style'));
      if (!style) {
        return null;
      }
      this._style = style;
      const include = style.getAttribute(attr);
      if (include) {
        style.removeAttribute(attr);
        style.textContent = Polymer.StyleGather.cssFromModules(include) + style.textContent;
      }
      /*
      HTML Imports styling the main document are deprecated in Chrome
      https://crbug.com/523952

      If this element is not in the main document, then it must be in an HTML Import document.
      In that case, move the custom style to the main document.

      The ordering of `<custom-style>` should stay the same as when loaded by HTML Imports, but there may be odd
      cases of ordering w.r.t the main document styles.
      */
      if (this.ownerDocument !== window.document) {
        window.document.head.appendChild(this);
      }
      return this._style;
    }
  }

  window.customElements.define('custom-style', CustomStyle);

  /** @const */
  Polymer.CustomStyle = CustomStyle;
})();


(function() {
  'use strict';

  let mutablePropertyChange;
  /** @suppress {missingProperties} */
  (() => {
    mutablePropertyChange = Polymer.MutableData._mutablePropertyChange;
  })();

  /**
   * Legacy element behavior to skip strict dirty-checking for objects and arrays,
   * (always consider them to be "dirty") for use on legacy API Polymer elements.
   *
   * By default, `Polymer.PropertyEffects` performs strict dirty checking on
   * objects, which means that any deep modifications to an object or array will
   * not be propagated unless "immutable" data patterns are used (i.e. all object
   * references from the root to the mutation were changed).
   *
   * Polymer also provides a proprietary data mutation and path notification API
   * (e.g. `notifyPath`, `set`, and array mutation API's) that allow efficient
   * mutation and notification of deep changes in an object graph to all elements
   * bound to the same object graph.
   *
   * In cases where neither immutable patterns nor the data mutation API can be
   * used, applying this mixin will cause Polymer to skip dirty checking for
   * objects and arrays (always consider them to be "dirty").  This allows a
   * user to make a deep modification to a bound object graph, and then either
   * simply re-set the object (e.g. `this.items = this.items`) or call `notifyPath`
   * (e.g. `this.notifyPath('items')`) to update the tree.  Note that all
   * elements that wish to be updated based on deep mutations must apply this
   * mixin or otherwise skip strict dirty checking for objects/arrays.
   * Specifically, any elements in the binding tree between the source of a
   * mutation and the consumption of it must apply this behavior or enable the
   * `Polymer.OptionalMutableDataBehavior`.
   *
   * In order to make the dirty check strategy configurable, see
   * `Polymer.OptionalMutableDataBehavior`.
   *
   * Note, the performance characteristics of propagating large object graphs
   * will be worse as opposed to using strict dirty checking with immutable
   * patterns or Polymer's path notification API.
   *
   * @polymerBehavior
   * @memberof Polymer
   * @summary Behavior to skip strict dirty-checking for objects and
   *   arrays
   */
  Polymer.MutableDataBehavior = {

    /**
     * Overrides `Polymer.PropertyEffects` to provide option for skipping
     * strict equality checking for Objects and Arrays.
     *
     * This method pulls the value to dirty check against from the `__dataTemp`
     * cache (rather than the normal `__data` cache) for Objects.  Since the temp
     * cache is cleared at the end of a turn, this implementation allows
     * side-effects of deep object changes to be processed by re-setting the
     * same object (using the temp cache as an in-turn backstop to prevent
     * cycles due to 2-way notification).
     *
     * @param {string} property Property name
     * @param {*} value New property value
     * @param {*} old Previous property value
     * @return {boolean} Whether the property should be considered a change
     * @protected
     */
    _shouldPropertyChange(property, value, old) {
      return mutablePropertyChange(this, property, value, old, true);
    }
  };

  /**
   * Legacy element behavior to add the optional ability to skip strict
   * dirty-checking for objects and arrays (always consider them to be
   * "dirty") by setting a `mutable-data` attribute on an element instance.
   *
   * By default, `Polymer.PropertyEffects` performs strict dirty checking on
   * objects, which means that any deep modifications to an object or array will
   * not be propagated unless "immutable" data patterns are used (i.e. all object
   * references from the root to the mutation were changed).
   *
   * Polymer also provides a proprietary data mutation and path notification API
   * (e.g. `notifyPath`, `set`, and array mutation API's) that allow efficient
   * mutation and notification of deep changes in an object graph to all elements
   * bound to the same object graph.
   *
   * In cases where neither immutable patterns nor the data mutation API can be
   * used, applying this mixin will allow Polymer to skip dirty checking for
   * objects and arrays (always consider them to be "dirty").  This allows a
   * user to make a deep modification to a bound object graph, and then either
   * simply re-set the object (e.g. `this.items = this.items`) or call `notifyPath`
   * (e.g. `this.notifyPath('items')`) to update the tree.  Note that all
   * elements that wish to be updated based on deep mutations must apply this
   * mixin or otherwise skip strict dirty checking for objects/arrays.
   * Specifically, any elements in the binding tree between the source of a
   * mutation and the consumption of it must enable this behavior or apply the
   * `Polymer.OptionalMutableDataBehavior`.
   *
   * While this behavior adds the ability to forgo Object/Array dirty checking,
   * the `mutableData` flag defaults to false and must be set on the instance.
   *
   * Note, the performance characteristics of propagating large object graphs
   * will be worse by relying on `mutableData: true` as opposed to using
   * strict dirty checking with immutable patterns or Polymer's path notification
   * API.
   *
   * @polymerBehavior
   * @memberof Polymer
   * @summary Behavior to optionally skip strict dirty-checking for objects and
   *   arrays
   */
  Polymer.OptionalMutableDataBehavior = {

    properties: {
      /**
       * Instance-level flag for configuring the dirty-checking strategy
       * for this element.  When true, Objects and Arrays will skip dirty
       * checking, otherwise strict equality checking will be used.
       */
      mutableData: Boolean
    },

    /**
     * Overrides `Polymer.PropertyEffects` to skip strict equality checking
     * for Objects and Arrays.
     *
     * Pulls the value to dirty check against from the `__dataTemp` cache
     * (rather than the normal `__data` cache) for Objects.  Since the temp
     * cache is cleared at the end of a turn, this implementation allows
     * side-effects of deep object changes to be processed by re-setting the
     * same object (using the temp cache as an in-turn backstop to prevent
     * cycles due to 2-way notification).
     *
     * @param {string} property Property name
     * @param {*} value New property value
     * @param {*} old Previous property value
     * @return {boolean} Whether the property should be considered a change
     * @this {this}
     * @protected
     */
    _shouldPropertyChange(property, value, old) {
      return mutablePropertyChange(this, property, value, old, this.mutableData);
    }
  };

})();



  // bc
  Polymer.Base = Polymer.LegacyElementMixin(HTMLElement).prototype;

  // NOTE: this is here for modulizer to export `html` for the module version of this file
  Polymer.html = Polymer.html;

/*

 Lodash <https://lodash.com/>
 Copyright JS Foundation and other contributors <https://js.foundation/>
 Released under MIT license <https://lodash.com/license>
 Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
 Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
(function(){var undefined;var VERSION="4.17.5";var LARGE_ARRAY_SIZE=200;var CORE_ERROR_TEXT="Unsupported core-js use. Try https://npms.io/search?q\x3dponyfill.",FUNC_ERROR_TEXT="Expected a function";var HASH_UNDEFINED="__lodash_hash_undefined__";var MAX_MEMOIZE_SIZE=500;var PLACEHOLDER="__lodash_placeholder__";var CLONE_DEEP_FLAG=1,CLONE_FLAT_FLAG=2,CLONE_SYMBOLS_FLAG=4;var COMPARE_PARTIAL_FLAG=1,COMPARE_UNORDERED_FLAG=2;var WRAP_BIND_FLAG=1,WRAP_BIND_KEY_FLAG=2,WRAP_CURRY_BOUND_FLAG=4,WRAP_CURRY_FLAG=
8,WRAP_CURRY_RIGHT_FLAG=16,WRAP_PARTIAL_FLAG=32,WRAP_PARTIAL_RIGHT_FLAG=64,WRAP_ARY_FLAG=128,WRAP_REARG_FLAG=256,WRAP_FLIP_FLAG=512;var DEFAULT_TRUNC_LENGTH=30,DEFAULT_TRUNC_OMISSION="...";var HOT_COUNT=800,HOT_SPAN=16;var LAZY_FILTER_FLAG=1,LAZY_MAP_FLAG=2,LAZY_WHILE_FLAG=3;var INFINITY=1/0,MAX_SAFE_INTEGER=9007199254740991,MAX_INTEGER=1.7976931348623157E308,NAN=0/0;var MAX_ARRAY_LENGTH=4294967295,MAX_ARRAY_INDEX=MAX_ARRAY_LENGTH-1,HALF_MAX_ARRAY_LENGTH=MAX_ARRAY_LENGTH>>>1;var wrapFlags=[["ary",
WRAP_ARY_FLAG],["bind",WRAP_BIND_FLAG],["bindKey",WRAP_BIND_KEY_FLAG],["curry",WRAP_CURRY_FLAG],["curryRight",WRAP_CURRY_RIGHT_FLAG],["flip",WRAP_FLIP_FLAG],["partial",WRAP_PARTIAL_FLAG],["partialRight",WRAP_PARTIAL_RIGHT_FLAG],["rearg",WRAP_REARG_FLAG]];var argsTag="[object Arguments]",arrayTag="[object Array]",asyncTag="[object AsyncFunction]",boolTag="[object Boolean]",dateTag="[object Date]",domExcTag="[object DOMException]",errorTag="[object Error]",funcTag="[object Function]",genTag="[object GeneratorFunction]",
mapTag="[object Map]",numberTag="[object Number]",nullTag="[object Null]",objectTag="[object Object]",promiseTag="[object Promise]",proxyTag="[object Proxy]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",symbolTag="[object Symbol]",undefinedTag="[object Undefined]",weakMapTag="[object WeakMap]",weakSetTag="[object WeakSet]";var arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",
int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]";var reEmptyStringLeading=/\b__p \+= '';/g,reEmptyStringMiddle=/\b(__p \+=) '' \+/g,reEmptyStringTrailing=/(__e\(.*?\)|\b__t\)) \+\n'';/g;var reEscapedHtml=/&(?:amp|lt|gt|quot|#39);/g,reUnescapedHtml=/[&<>"']/g,reHasEscapedHtml=RegExp(reEscapedHtml.source),reHasUnescapedHtml=
RegExp(reUnescapedHtml.source);var reEscape=/<%-([\s\S]+?)%>/g,reEvaluate=/<%([\s\S]+?)%>/g,reInterpolate=/<%=([\s\S]+?)%>/g;var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;var reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reHasRegExpChar=RegExp(reRegExpChar.source);var reTrim=/^\s+|\s+$/g,reTrimStart=/^\s+/,reTrimEnd=/\s+$/;var reWrapComment=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
reWrapDetails=/\{\n\/\* \[wrapped with (.+)\] \*/,reSplitDetails=/,? & /;var reAsciiWord=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var reEscapeChar=/\\(\\)?/g;var reEsTemplate=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;var reFlags=/\w*$/;var reIsBadHex=/^[-+]0x[0-9a-f]+$/i;var reIsBinary=/^0b[01]+$/i;var reIsHostCtor=/^\[object .+?Constructor\]$/;var reIsOctal=/^0o[0-7]+$/i;var reIsUint=/^(?:0|[1-9]\d*)$/;var reLatin=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;var reNoMatch=/($^)/;var reUnescapedString=
/['\n\r\u2028\u2029\\]/g;var rsAstralRange="\\ud800-\\udfff",rsComboMarksRange="\\u0300-\\u036f",reComboHalfMarksRange="\\ufe20-\\ufe2f",rsComboSymbolsRange="\\u20d0-\\u20ff",rsComboRange=rsComboMarksRange+reComboHalfMarksRange+rsComboSymbolsRange,rsDingbatRange="\\u2700-\\u27bf",rsLowerRange="a-z\\xdf-\\xf6\\xf8-\\xff",rsMathOpRange="\\xac\\xb1\\xd7\\xf7",rsNonCharRange="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",rsPunctuationRange="\\u2000-\\u206f",rsSpaceRange=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",
rsUpperRange="A-Z\\xc0-\\xd6\\xd8-\\xde",rsVarRange="\\ufe0e\\ufe0f",rsBreakRange=rsMathOpRange+rsNonCharRange+rsPunctuationRange+rsSpaceRange;var rsApos="['\u2019]",rsAstral="["+rsAstralRange+"]",rsBreak="["+rsBreakRange+"]",rsCombo="["+rsComboRange+"]",rsDigits="\\d+",rsDingbat="["+rsDingbatRange+"]",rsLower="["+rsLowerRange+"]",rsMisc="[^"+rsAstralRange+rsBreakRange+rsDigits+rsDingbatRange+rsLowerRange+rsUpperRange+"]",rsFitz="\\ud83c[\\udffb-\\udfff]",rsModifier="(?:"+rsCombo+"|"+rsFitz+")",rsNonAstral=
"[^"+rsAstralRange+"]",rsRegional="(?:\\ud83c[\\udde6-\\uddff]){2}",rsSurrPair="[\\ud800-\\udbff][\\udc00-\\udfff]",rsUpper="["+rsUpperRange+"]",rsZWJ="\\u200d";var rsMiscLower="(?:"+rsLower+"|"+rsMisc+")",rsMiscUpper="(?:"+rsUpper+"|"+rsMisc+")",rsOptContrLower="(?:"+rsApos+"(?:d|ll|m|re|s|t|ve))?",rsOptContrUpper="(?:"+rsApos+"(?:D|LL|M|RE|S|T|VE))?",reOptMod=rsModifier+"?",rsOptVar="["+rsVarRange+"]?",rsOptJoin="(?:"+rsZWJ+"(?:"+[rsNonAstral,rsRegional,rsSurrPair].join("|")+")"+rsOptVar+reOptMod+
")*",rsOrdLower="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?\x3d\\b|[A-Z_])",rsOrdUpper="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?\x3d\\b|[a-z_])",rsSeq=rsOptVar+reOptMod+rsOptJoin,rsEmoji="(?:"+[rsDingbat,rsRegional,rsSurrPair].join("|")+")"+rsSeq,rsSymbol="(?:"+[rsNonAstral+rsCombo+"?",rsCombo,rsRegional,rsSurrPair,rsAstral].join("|")+")";var reApos=RegExp(rsApos,"g");var reComboMark=RegExp(rsCombo,"g");var reUnicode=RegExp(rsFitz+"(?\x3d"+rsFitz+")|"+rsSymbol+rsSeq,"g");var reUnicodeWord=RegExp([rsUpper+"?"+
rsLower+"+"+rsOptContrLower+"(?\x3d"+[rsBreak,rsUpper,"$"].join("|")+")",rsMiscUpper+"+"+rsOptContrUpper+"(?\x3d"+[rsBreak,rsUpper+rsMiscLower,"$"].join("|")+")",rsUpper+"?"+rsMiscLower+"+"+rsOptContrLower,rsUpper+"+"+rsOptContrUpper,rsOrdUpper,rsOrdLower,rsDigits,rsEmoji].join("|"),"g");var reHasUnicode=RegExp("["+rsZWJ+rsAstralRange+rsComboRange+rsVarRange+"]");var reHasUnicodeWord=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var contextProps=["Array","Buffer","DataView",
"Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"];var templateCounter=-1;var typedArrayTags={};typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=
typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=true;typedArrayTags[argsTag]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dataViewTag]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag]=typedArrayTags[mapTag]=typedArrayTags[numberTag]=typedArrayTags[objectTag]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag]=false;var cloneableTags={};cloneableTags[argsTag]=cloneableTags[arrayTag]=
cloneableTags[arrayBufferTag]=cloneableTags[dataViewTag]=cloneableTags[boolTag]=cloneableTags[dateTag]=cloneableTags[float32Tag]=cloneableTags[float64Tag]=cloneableTags[int8Tag]=cloneableTags[int16Tag]=cloneableTags[int32Tag]=cloneableTags[mapTag]=cloneableTags[numberTag]=cloneableTags[objectTag]=cloneableTags[regexpTag]=cloneableTags[setTag]=cloneableTags[stringTag]=cloneableTags[symbolTag]=cloneableTags[uint8Tag]=cloneableTags[uint8ClampedTag]=cloneableTags[uint16Tag]=cloneableTags[uint32Tag]=true;
cloneableTags[errorTag]=cloneableTags[funcTag]=cloneableTags[weakMapTag]=false;var deburredLetters={"\u00c0":"A","\u00c1":"A","\u00c2":"A","\u00c3":"A","\u00c4":"A","\u00c5":"A","\u00e0":"a","\u00e1":"a","\u00e2":"a","\u00e3":"a","\u00e4":"a","\u00e5":"a","\u00c7":"C","\u00e7":"c","\u00d0":"D","\u00f0":"d","\u00c8":"E","\u00c9":"E","\u00ca":"E","\u00cb":"E","\u00e8":"e","\u00e9":"e","\u00ea":"e","\u00eb":"e","\u00cc":"I","\u00cd":"I","\u00ce":"I","\u00cf":"I","\u00ec":"i","\u00ed":"i","\u00ee":"i",
"\u00ef":"i","\u00d1":"N","\u00f1":"n","\u00d2":"O","\u00d3":"O","\u00d4":"O","\u00d5":"O","\u00d6":"O","\u00d8":"O","\u00f2":"o","\u00f3":"o","\u00f4":"o","\u00f5":"o","\u00f6":"o","\u00f8":"o","\u00d9":"U","\u00da":"U","\u00db":"U","\u00dc":"U","\u00f9":"u","\u00fa":"u","\u00fb":"u","\u00fc":"u","\u00dd":"Y","\u00fd":"y","\u00ff":"y","\u00c6":"Ae","\u00e6":"ae","\u00de":"Th","\u00fe":"th","\u00df":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C","\u0108":"C",
"\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g","\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i","\u012b":"i",
"\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O","\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r","\u015a":"S",
"\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij","\u0152":"Oe",
"\u0153":"oe","\u0149":"'n","\u017f":"s"};var htmlEscapes={"\x26":"\x26amp;","\x3c":"\x26lt;","\x3e":"\x26gt;",'"':"\x26quot;","'":"\x26#39;"};var htmlUnescapes={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26quot;":'"',"\x26#39;":"'"};var stringEscapes={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};var freeParseFloat=parseFloat,freeParseInt=parseInt;var freeGlobal=typeof global=="object"&&global&&global.Object===Object&&global;var freeSelf=typeof self=="object"&&
self&&self.Object===Object&&self;var root=freeGlobal||freeSelf||Function("return this")();var freeExports=typeof exports=="object"&&exports&&!exports.nodeType&&exports;var freeModule=freeExports&&typeof module=="object"&&module&&!module.nodeType&&module;var moduleExports=freeModule&&freeModule.exports===freeExports;var freeProcess=moduleExports&&freeGlobal.process;var nodeUtil=function(){try{return freeProcess&&freeProcess.binding&&freeProcess.binding("util")}catch(e){}}();var nodeIsArrayBuffer=nodeUtil&&
nodeUtil.isArrayBuffer,nodeIsDate=nodeUtil&&nodeUtil.isDate,nodeIsMap=nodeUtil&&nodeUtil.isMap,nodeIsRegExp=nodeUtil&&nodeUtil.isRegExp,nodeIsSet=nodeUtil&&nodeUtil.isSet,nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray;function apply(func,thisArg,args){switch(args.length){case 0:return func.call(thisArg);case 1:return func.call(thisArg,args[0]);case 2:return func.call(thisArg,args[0],args[1]);case 3:return func.call(thisArg,args[0],args[1],args[2])}return func.apply(thisArg,args)}function arrayAggregator(array,
setter,iteratee,accumulator){var index=-1,length=array==null?0:array.length;while(++index<length){var value=array[index];setter(accumulator,value,iteratee(value),array)}return accumulator}function arrayEach(array,iteratee){var index=-1,length=array==null?0:array.length;while(++index<length)if(iteratee(array[index],index,array)===false)break;return array}function arrayEachRight(array,iteratee){var length=array==null?0:array.length;while(length--)if(iteratee(array[length],length,array)===false)break;
return array}function arrayEvery(array,predicate){var index=-1,length=array==null?0:array.length;while(++index<length)if(!predicate(array[index],index,array))return false;return true}function arrayFilter(array,predicate){var index=-1,length=array==null?0:array.length,resIndex=0,result=[];while(++index<length){var value=array[index];if(predicate(value,index,array))result[resIndex++]=value}return result}function arrayIncludes(array,value){var length=array==null?0:array.length;return!!length&&baseIndexOf(array,
value,0)>-1}function arrayIncludesWith(array,value,comparator){var index=-1,length=array==null?0:array.length;while(++index<length)if(comparator(value,array[index]))return true;return false}function arrayMap(array,iteratee){var index=-1,length=array==null?0:array.length,result=Array(length);while(++index<length)result[index]=iteratee(array[index],index,array);return result}function arrayPush(array,values){var index=-1,length=values.length,offset=array.length;while(++index<length)array[offset+index]=
values[index];return array}function arrayReduce(array,iteratee,accumulator,initAccum){var index=-1,length=array==null?0:array.length;if(initAccum&&length)accumulator=array[++index];while(++index<length)accumulator=iteratee(accumulator,array[index],index,array);return accumulator}function arrayReduceRight(array,iteratee,accumulator,initAccum){var length=array==null?0:array.length;if(initAccum&&length)accumulator=array[--length];while(length--)accumulator=iteratee(accumulator,array[length],length,array);
return accumulator}function arraySome(array,predicate){var index=-1,length=array==null?0:array.length;while(++index<length)if(predicate(array[index],index,array))return true;return false}var asciiSize=baseProperty("length");function asciiToArray(string){return string.split("")}function asciiWords(string){return string.match(reAsciiWord)||[]}function baseFindKey(collection,predicate,eachFunc){var result;eachFunc(collection,function(value,key,collection){if(predicate(value,key,collection)){result=key;
return false}});return result}function baseFindIndex(array,predicate,fromIndex,fromRight){var length=array.length,index=fromIndex+(fromRight?1:-1);while(fromRight?index--:++index<length)if(predicate(array[index],index,array))return index;return-1}function baseIndexOf(array,value,fromIndex){return value===value?strictIndexOf(array,value,fromIndex):baseFindIndex(array,baseIsNaN,fromIndex)}function baseIndexOfWith(array,value,fromIndex,comparator){var index=fromIndex-1,length=array.length;while(++index<
length)if(comparator(array[index],value))return index;return-1}function baseIsNaN(value){return value!==value}function baseMean(array,iteratee){var length=array==null?0:array.length;return length?baseSum(array,iteratee)/length:NAN}function baseProperty(key){return function(object){return object==null?undefined:object[key]}}function basePropertyOf(object){return function(key){return object==null?undefined:object[key]}}function baseReduce(collection,iteratee,accumulator,initAccum,eachFunc){eachFunc(collection,
function(value,index,collection){accumulator=initAccum?(initAccum=false,value):iteratee(accumulator,value,index,collection)});return accumulator}function baseSortBy(array,comparer){var length=array.length;array.sort(comparer);while(length--)array[length]=array[length].value;return array}function baseSum(array,iteratee){var result,index=-1,length=array.length;while(++index<length){var current=iteratee(array[index]);if(current!==undefined)result=result===undefined?current:result+current}return result}
function baseTimes(n,iteratee){var index=-1,result=Array(n);while(++index<n)result[index]=iteratee(index);return result}function baseToPairs(object,props){return arrayMap(props,function(key){return[key,object[key]]})}function baseUnary(func){return function(value){return func(value)}}function baseValues(object,props){return arrayMap(props,function(key){return object[key]})}function cacheHas(cache,key){return cache.has(key)}function charsStartIndex(strSymbols,chrSymbols){var index=-1,length=strSymbols.length;
while(++index<length&&baseIndexOf(chrSymbols,strSymbols[index],0)>-1);return index}function charsEndIndex(strSymbols,chrSymbols){var index=strSymbols.length;while(index--&&baseIndexOf(chrSymbols,strSymbols[index],0)>-1);return index}function countHolders(array,placeholder){var length=array.length,result=0;while(length--)if(array[length]===placeholder)++result;return result}var deburrLetter=basePropertyOf(deburredLetters);var escapeHtmlChar=basePropertyOf(htmlEscapes);function escapeStringChar(chr){return"\\"+
stringEscapes[chr]}function getValue(object,key){return object==null?undefined:object[key]}function hasUnicode(string){return reHasUnicode.test(string)}function hasUnicodeWord(string){return reHasUnicodeWord.test(string)}function iteratorToArray(iterator){var data,result=[];while(!(data=iterator.next()).done)result.push(data.value);return result}function mapToArray(map){var index=-1,result=Array(map.size);map.forEach(function(value,key){result[++index]=[key,value]});return result}function overArg(func,
transform){return function(arg){return func(transform(arg))}}function replaceHolders(array,placeholder){var index=-1,length=array.length,resIndex=0,result=[];while(++index<length){var value=array[index];if(value===placeholder||value===PLACEHOLDER){array[index]=PLACEHOLDER;result[resIndex++]=index}}return result}function safeGet(object,key){return key=="__proto__"?undefined:object[key]}function setToArray(set){var index=-1,result=Array(set.size);set.forEach(function(value){result[++index]=value});
return result}function setToPairs(set){var index=-1,result=Array(set.size);set.forEach(function(value){result[++index]=[value,value]});return result}function strictIndexOf(array,value,fromIndex){var index=fromIndex-1,length=array.length;while(++index<length)if(array[index]===value)return index;return-1}function strictLastIndexOf(array,value,fromIndex){var index=fromIndex+1;while(index--)if(array[index]===value)return index;return index}function stringSize(string){return hasUnicode(string)?unicodeSize(string):
asciiSize(string)}function stringToArray(string){return hasUnicode(string)?unicodeToArray(string):asciiToArray(string)}var unescapeHtmlChar=basePropertyOf(htmlUnescapes);function unicodeSize(string){var result=reUnicode.lastIndex=0;while(reUnicode.test(string))++result;return result}function unicodeToArray(string){return string.match(reUnicode)||[]}function unicodeWords(string){return string.match(reUnicodeWord)||[]}var runInContext=function runInContext(context){context=context==null?root:_.defaults(root.Object(),
context,_.pick(root,contextProps));var Array=context.Array,Date=context.Date,Error=context.Error,Function=context.Function,Math=context.Math,Object=context.Object,RegExp=context.RegExp,String=context.String,TypeError=context.TypeError;var arrayProto=Array.prototype,funcProto=Function.prototype,objectProto=Object.prototype;var coreJsData=context["__core-js_shared__"];var funcToString=funcProto.toString;var hasOwnProperty=objectProto.hasOwnProperty;var idCounter=0;var maskSrcKey=function(){var uid=
/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return uid?"Symbol(src)_1."+uid:""}();var nativeObjectToString=objectProto.toString;var objectCtorString=funcToString.call(Object);var oldDash=root._;var reIsNative=RegExp("^"+funcToString.call(hasOwnProperty).replace(reRegExpChar,"\\$\x26").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Buffer=moduleExports?context.Buffer:undefined,Symbol=context.Symbol,Uint8Array=context.Uint8Array,allocUnsafe=
Buffer?Buffer.allocUnsafe:undefined,getPrototype=overArg(Object.getPrototypeOf,Object),objectCreate=Object.create,propertyIsEnumerable=objectProto.propertyIsEnumerable,splice=arrayProto.splice,spreadableSymbol=Symbol?Symbol.isConcatSpreadable:undefined,symIterator=Symbol?Symbol.iterator:undefined,symToStringTag=Symbol?Symbol.toStringTag:undefined;var defineProperty=function(){try{var func=getNative(Object,"defineProperty");func({},"",{});return func}catch(e){}}();var ctxClearTimeout=context.clearTimeout!==
root.clearTimeout&&context.clearTimeout,ctxNow=Date&&Date.now!==root.Date.now&&Date.now,ctxSetTimeout=context.setTimeout!==root.setTimeout&&context.setTimeout;var nativeCeil=Math.ceil,nativeFloor=Math.floor,nativeGetSymbols=Object.getOwnPropertySymbols,nativeIsBuffer=Buffer?Buffer.isBuffer:undefined,nativeIsFinite=context.isFinite,nativeJoin=arrayProto.join,nativeKeys=overArg(Object.keys,Object),nativeMax=Math.max,nativeMin=Math.min,nativeNow=Date.now,nativeParseInt=context.parseInt,nativeRandom=
Math.random,nativeReverse=arrayProto.reverse;var DataView=getNative(context,"DataView"),Map=getNative(context,"Map"),Promise=getNative(context,"Promise"),Set=getNative(context,"Set"),WeakMap=getNative(context,"WeakMap"),nativeCreate=getNative(Object,"create");var metaMap=WeakMap&&new WeakMap;var realNames={};var dataViewCtorString=toSource(DataView),mapCtorString=toSource(Map),promiseCtorString=toSource(Promise),setCtorString=toSource(Set),weakMapCtorString=toSource(WeakMap);var symbolProto=Symbol?
Symbol.prototype:undefined,symbolValueOf=symbolProto?symbolProto.valueOf:undefined,symbolToString=symbolProto?symbolProto.toString:undefined;function lodash(value){if(isObjectLike(value)&&!isArray(value)&&!(value instanceof LazyWrapper)){if(value instanceof LodashWrapper)return value;if(hasOwnProperty.call(value,"__wrapped__"))return wrapperClone(value)}return new LodashWrapper(value)}var baseCreate=function(){function object(){}return function(proto){if(!isObject(proto))return{};if(objectCreate)return objectCreate(proto);
object.prototype=proto;var result=new object;object.prototype=undefined;return result}}();function baseLodash(){}function LodashWrapper(value,chainAll){this.__wrapped__=value;this.__actions__=[];this.__chain__=!!chainAll;this.__index__=0;this.__values__=undefined}lodash.templateSettings={"escape":reEscape,"evaluate":reEvaluate,"interpolate":reInterpolate,"variable":"","imports":{"_":lodash}};lodash.prototype=baseLodash.prototype;lodash.prototype.constructor=lodash;LodashWrapper.prototype=baseCreate(baseLodash.prototype);
LodashWrapper.prototype.constructor=LodashWrapper;function LazyWrapper(value){this.__wrapped__=value;this.__actions__=[];this.__dir__=1;this.__filtered__=false;this.__iteratees__=[];this.__takeCount__=MAX_ARRAY_LENGTH;this.__views__=[]}function lazyClone(){var result=new LazyWrapper(this.__wrapped__);result.__actions__=copyArray(this.__actions__);result.__dir__=this.__dir__;result.__filtered__=this.__filtered__;result.__iteratees__=copyArray(this.__iteratees__);result.__takeCount__=this.__takeCount__;
result.__views__=copyArray(this.__views__);return result}function lazyReverse(){if(this.__filtered__){var result=new LazyWrapper(this);result.__dir__=-1;result.__filtered__=true}else{result=this.clone();result.__dir__*=-1}return result}function lazyValue(){var array=this.__wrapped__.value(),dir=this.__dir__,isArr=isArray(array),isRight=dir<0,arrLength=isArr?array.length:0,view=getView(0,arrLength,this.__views__),start=view.start,end=view.end,length=end-start,index=isRight?end:start-1,iteratees=this.__iteratees__,
iterLength=iteratees.length,resIndex=0,takeCount=nativeMin(length,this.__takeCount__);if(!isArr||!isRight&&arrLength==length&&takeCount==length)return baseWrapperValue(array,this.__actions__);var result=[];outer:while(length--&&resIndex<takeCount){index+=dir;var iterIndex=-1,value=array[index];while(++iterIndex<iterLength){var data=iteratees[iterIndex],iteratee=data.iteratee,type=data.type,computed=iteratee(value);if(type==LAZY_MAP_FLAG)value=computed;else if(!computed)if(type==LAZY_FILTER_FLAG)continue outer;
else break outer}result[resIndex++]=value}return result}LazyWrapper.prototype=baseCreate(baseLodash.prototype);LazyWrapper.prototype.constructor=LazyWrapper;function Hash(entries){var index=-1,length=entries==null?0:entries.length;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1])}}function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{};this.size=0}function hashDelete(key){var result=this.has(key)&&delete this.__data__[key];this.size-=result?1:0;
return result}function hashGet(key){var data=this.__data__;if(nativeCreate){var result=data[key];return result===HASH_UNDEFINED?undefined:result}return hasOwnProperty.call(data,key)?data[key]:undefined}function hashHas(key){var data=this.__data__;return nativeCreate?data[key]!==undefined:hasOwnProperty.call(data,key)}function hashSet(key,value){var data=this.__data__;this.size+=this.has(key)?0:1;data[key]=nativeCreate&&value===undefined?HASH_UNDEFINED:value;return this}Hash.prototype.clear=hashClear;
Hash.prototype["delete"]=hashDelete;Hash.prototype.get=hashGet;Hash.prototype.has=hashHas;Hash.prototype.set=hashSet;function ListCache(entries){var index=-1,length=entries==null?0:entries.length;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1])}}function listCacheClear(){this.__data__=[];this.size=0}function listCacheDelete(key){var data=this.__data__,index=assocIndexOf(data,key);if(index<0)return false;var lastIndex=data.length-1;if(index==lastIndex)data.pop();
else splice.call(data,index,1);--this.size;return true}function listCacheGet(key){var data=this.__data__,index=assocIndexOf(data,key);return index<0?undefined:data[index][1]}function listCacheHas(key){return assocIndexOf(this.__data__,key)>-1}function listCacheSet(key,value){var data=this.__data__,index=assocIndexOf(data,key);if(index<0){++this.size;data.push([key,value])}else data[index][1]=value;return this}ListCache.prototype.clear=listCacheClear;ListCache.prototype["delete"]=listCacheDelete;ListCache.prototype.get=
listCacheGet;ListCache.prototype.has=listCacheHas;ListCache.prototype.set=listCacheSet;function MapCache(entries){var index=-1,length=entries==null?0:entries.length;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1])}}function mapCacheClear(){this.size=0;this.__data__={"hash":new Hash,"map":new (Map||ListCache),"string":new Hash}}function mapCacheDelete(key){var result=getMapData(this,key)["delete"](key);this.size-=result?1:0;return result}function mapCacheGet(key){return getMapData(this,
key).get(key)}function mapCacheHas(key){return getMapData(this,key).has(key)}function mapCacheSet(key,value){var data=getMapData(this,key),size=data.size;data.set(key,value);this.size+=data.size==size?0:1;return this}MapCache.prototype.clear=mapCacheClear;MapCache.prototype["delete"]=mapCacheDelete;MapCache.prototype.get=mapCacheGet;MapCache.prototype.has=mapCacheHas;MapCache.prototype.set=mapCacheSet;function SetCache(values){var index=-1,length=values==null?0:values.length;this.__data__=new MapCache;
while(++index<length)this.add(values[index])}function setCacheAdd(value){this.__data__.set(value,HASH_UNDEFINED);return this}function setCacheHas(value){return this.__data__.has(value)}SetCache.prototype.add=SetCache.prototype.push=setCacheAdd;SetCache.prototype.has=setCacheHas;function Stack(entries){var data=this.__data__=new ListCache(entries);this.size=data.size}function stackClear(){this.__data__=new ListCache;this.size=0}function stackDelete(key){var data=this.__data__,result=data["delete"](key);
this.size=data.size;return result}function stackGet(key){return this.__data__.get(key)}function stackHas(key){return this.__data__.has(key)}function stackSet(key,value){var data=this.__data__;if(data instanceof ListCache){var pairs=data.__data__;if(!Map||pairs.length<LARGE_ARRAY_SIZE-1){pairs.push([key,value]);this.size=++data.size;return this}data=this.__data__=new MapCache(pairs)}data.set(key,value);this.size=data.size;return this}Stack.prototype.clear=stackClear;Stack.prototype["delete"]=stackDelete;
Stack.prototype.get=stackGet;Stack.prototype.has=stackHas;Stack.prototype.set=stackSet;function arrayLikeKeys(value,inherited){var isArr=isArray(value),isArg=!isArr&&isArguments(value),isBuff=!isArr&&!isArg&&isBuffer(value),isType=!isArr&&!isArg&&!isBuff&&isTypedArray(value),skipIndexes=isArr||isArg||isBuff||isType,result=skipIndexes?baseTimes(value.length,String):[],length=result.length;for(var key in value)if((inherited||hasOwnProperty.call(value,key))&&!(skipIndexes&&(key=="length"||isBuff&&(key==
"offset"||key=="parent")||isType&&(key=="buffer"||key=="byteLength"||key=="byteOffset")||isIndex(key,length))))result.push(key);return result}function arraySample(array){var length=array.length;return length?array[baseRandom(0,length-1)]:undefined}function arraySampleSize(array,n){return shuffleSelf(copyArray(array),baseClamp(n,0,array.length))}function arrayShuffle(array){return shuffleSelf(copyArray(array))}function assignMergeValue(object,key,value){if(value!==undefined&&!eq(object[key],value)||
value===undefined&&!(key in object))baseAssignValue(object,key,value)}function assignValue(object,key,value){var objValue=object[key];if(!(hasOwnProperty.call(object,key)&&eq(objValue,value))||value===undefined&&!(key in object))baseAssignValue(object,key,value)}function assocIndexOf(array,key){var length=array.length;while(length--)if(eq(array[length][0],key))return length;return-1}function baseAggregator(collection,setter,iteratee,accumulator){baseEach(collection,function(value,key,collection){setter(accumulator,
value,iteratee(value),collection)});return accumulator}function baseAssign(object,source){return object&&copyObject(source,keys(source),object)}function baseAssignIn(object,source){return object&&copyObject(source,keysIn(source),object)}function baseAssignValue(object,key,value){if(key=="__proto__"&&defineProperty)defineProperty(object,key,{"configurable":true,"enumerable":true,"value":value,"writable":true});else object[key]=value}function baseAt(object,paths){var index=-1,length=paths.length,result=
Array(length),skip=object==null;while(++index<length)result[index]=skip?undefined:get(object,paths[index]);return result}function baseClamp(number,lower,upper){if(number===number){if(upper!==undefined)number=number<=upper?number:upper;if(lower!==undefined)number=number>=lower?number:lower}return number}function baseClone(value,bitmask,customizer,key,object,stack){var result,isDeep=bitmask&CLONE_DEEP_FLAG,isFlat=bitmask&CLONE_FLAT_FLAG,isFull=bitmask&CLONE_SYMBOLS_FLAG;if(customizer)result=object?
customizer(value,key,object,stack):customizer(value);if(result!==undefined)return result;if(!isObject(value))return value;var isArr=isArray(value);if(isArr){result=initCloneArray(value);if(!isDeep)return copyArray(value,result)}else{var tag=getTag(value),isFunc=tag==funcTag||tag==genTag;if(isBuffer(value))return cloneBuffer(value,isDeep);if(tag==objectTag||tag==argsTag||isFunc&&!object){result=isFlat||isFunc?{}:initCloneObject(value);if(!isDeep)return isFlat?copySymbolsIn(value,baseAssignIn(result,
value)):copySymbols(value,baseAssign(result,value))}else{if(!cloneableTags[tag])return object?value:{};result=initCloneByTag(value,tag,isDeep)}}stack||(stack=new Stack);var stacked=stack.get(value);if(stacked)return stacked;stack.set(value,result);if(isSet(value)){value.forEach(function(subValue){result.add(baseClone(subValue,bitmask,customizer,subValue,value,stack))});return result}if(isMap(value)){value.forEach(function(subValue,key){result.set(key,baseClone(subValue,bitmask,customizer,key,value,
stack))});return result}var keysFunc=isFull?isFlat?getAllKeysIn:getAllKeys:isFlat?keysIn:keys;var props=isArr?undefined:keysFunc(value);arrayEach(props||value,function(subValue,key){if(props){key=subValue;subValue=value[key]}assignValue(result,key,baseClone(subValue,bitmask,customizer,key,value,stack))});return result}function baseConforms(source){var props=keys(source);return function(object){return baseConformsTo(object,source,props)}}function baseConformsTo(object,source,props){var length=props.length;
if(object==null)return!length;object=Object(object);while(length--){var key=props[length],predicate=source[key],value=object[key];if(value===undefined&&!(key in object)||!predicate(value))return false}return true}function baseDelay(func,wait,args){if(typeof func!="function")throw new TypeError(FUNC_ERROR_TEXT);return setTimeout(function(){func.apply(undefined,args)},wait)}function baseDifference(array,values,iteratee,comparator){var index=-1,includes=arrayIncludes,isCommon=true,length=array.length,
result=[],valuesLength=values.length;if(!length)return result;if(iteratee)values=arrayMap(values,baseUnary(iteratee));if(comparator){includes=arrayIncludesWith;isCommon=false}else if(values.length>=LARGE_ARRAY_SIZE){includes=cacheHas;isCommon=false;values=new SetCache(values)}outer:while(++index<length){var value=array[index],computed=iteratee==null?value:iteratee(value);value=comparator||value!==0?value:0;if(isCommon&&computed===computed){var valuesIndex=valuesLength;while(valuesIndex--)if(values[valuesIndex]===
computed)continue outer;result.push(value)}else if(!includes(values,computed,comparator))result.push(value)}return result}var baseEach=createBaseEach(baseForOwn);var baseEachRight=createBaseEach(baseForOwnRight,true);function baseEvery(collection,predicate){var result=true;baseEach(collection,function(value,index,collection){result=!!predicate(value,index,collection);return result});return result}function baseExtremum(array,iteratee,comparator){var index=-1,length=array.length;while(++index<length){var value=
array[index],current=iteratee(value);if(current!=null&&(computed===undefined?current===current&&!isSymbol(current):comparator(current,computed)))var computed=current,result=value}return result}function baseFill(array,value,start,end){var length=array.length;start=toInteger(start);if(start<0)start=-start>length?0:length+start;end=end===undefined||end>length?length:toInteger(end);if(end<0)end+=length;end=start>end?0:toLength(end);while(start<end)array[start++]=value;return array}function baseFilter(collection,
predicate){var result=[];baseEach(collection,function(value,index,collection){if(predicate(value,index,collection))result.push(value)});return result}function baseFlatten(array,depth,predicate,isStrict,result){var index=-1,length=array.length;predicate||(predicate=isFlattenable);result||(result=[]);while(++index<length){var value=array[index];if(depth>0&&predicate(value))if(depth>1)baseFlatten(value,depth-1,predicate,isStrict,result);else arrayPush(result,value);else if(!isStrict)result[result.length]=
value}return result}var baseFor=createBaseFor();var baseForRight=createBaseFor(true);function baseForOwn(object,iteratee){return object&&baseFor(object,iteratee,keys)}function baseForOwnRight(object,iteratee){return object&&baseForRight(object,iteratee,keys)}function baseFunctions(object,props){return arrayFilter(props,function(key){return isFunction(object[key])})}function baseGet(object,path){path=castPath(path,object);var index=0,length=path.length;while(object!=null&&index<length)object=object[toKey(path[index++])];
return index&&index==length?object:undefined}function baseGetAllKeys(object,keysFunc,symbolsFunc){var result=keysFunc(object);return isArray(object)?result:arrayPush(result,symbolsFunc(object))}function baseGetTag(value){if(value==null)return value===undefined?undefinedTag:nullTag;return symToStringTag&&symToStringTag in Object(value)?getRawTag(value):objectToString(value)}function baseGt(value,other){return value>other}function baseHas(object,key){return object!=null&&hasOwnProperty.call(object,
key)}function baseHasIn(object,key){return object!=null&&key in Object(object)}function baseInRange(number,start,end){return number>=nativeMin(start,end)&&number<nativeMax(start,end)}function baseIntersection(arrays,iteratee,comparator){var includes=comparator?arrayIncludesWith:arrayIncludes,length=arrays[0].length,othLength=arrays.length,othIndex=othLength,caches=Array(othLength),maxLength=Infinity,result=[];while(othIndex--){var array=arrays[othIndex];if(othIndex&&iteratee)array=arrayMap(array,
baseUnary(iteratee));maxLength=nativeMin(array.length,maxLength);caches[othIndex]=!comparator&&(iteratee||length>=120&&array.length>=120)?new SetCache(othIndex&&array):undefined}array=arrays[0];var index=-1,seen=caches[0];outer:while(++index<length&&result.length<maxLength){var value=array[index],computed=iteratee?iteratee(value):value;value=comparator||value!==0?value:0;if(!(seen?cacheHas(seen,computed):includes(result,computed,comparator))){othIndex=othLength;while(--othIndex){var cache=caches[othIndex];
if(!(cache?cacheHas(cache,computed):includes(arrays[othIndex],computed,comparator)))continue outer}if(seen)seen.push(computed);result.push(value)}}return result}function baseInverter(object,setter,iteratee,accumulator){baseForOwn(object,function(value,key,object){setter(accumulator,iteratee(value),key,object)});return accumulator}function baseInvoke(object,path,args){path=castPath(path,object);object=parent(object,path);var func=object==null?object:object[toKey(last(path))];return func==null?undefined:
apply(func,object,args)}function baseIsArguments(value){return isObjectLike(value)&&baseGetTag(value)==argsTag}function baseIsArrayBuffer(value){return isObjectLike(value)&&baseGetTag(value)==arrayBufferTag}function baseIsDate(value){return isObjectLike(value)&&baseGetTag(value)==dateTag}function baseIsEqual(value,other,bitmask,customizer,stack){if(value===other)return true;if(value==null||other==null||!isObjectLike(value)&&!isObjectLike(other))return value!==value&&other!==other;return baseIsEqualDeep(value,
other,bitmask,customizer,baseIsEqual,stack)}function baseIsEqualDeep(object,other,bitmask,customizer,equalFunc,stack){var objIsArr=isArray(object),othIsArr=isArray(other),objTag=objIsArr?arrayTag:getTag(object),othTag=othIsArr?arrayTag:getTag(other);objTag=objTag==argsTag?objectTag:objTag;othTag=othTag==argsTag?objectTag:othTag;var objIsObj=objTag==objectTag,othIsObj=othTag==objectTag,isSameTag=objTag==othTag;if(isSameTag&&isBuffer(object)){if(!isBuffer(other))return false;objIsArr=true;objIsObj=
false}if(isSameTag&&!objIsObj){stack||(stack=new Stack);return objIsArr||isTypedArray(object)?equalArrays(object,other,bitmask,customizer,equalFunc,stack):equalByTag(object,other,objTag,bitmask,customizer,equalFunc,stack)}if(!(bitmask&COMPARE_PARTIAL_FLAG)){var objIsWrapped=objIsObj&&hasOwnProperty.call(object,"__wrapped__"),othIsWrapped=othIsObj&&hasOwnProperty.call(other,"__wrapped__");if(objIsWrapped||othIsWrapped){var objUnwrapped=objIsWrapped?object.value():object,othUnwrapped=othIsWrapped?other.value():
other;stack||(stack=new Stack);return equalFunc(objUnwrapped,othUnwrapped,bitmask,customizer,stack)}}if(!isSameTag)return false;stack||(stack=new Stack);return equalObjects(object,other,bitmask,customizer,equalFunc,stack)}function baseIsMap(value){return isObjectLike(value)&&getTag(value)==mapTag}function baseIsMatch(object,source,matchData,customizer){var index=matchData.length,length=index,noCustomizer=!customizer;if(object==null)return!length;object=Object(object);while(index--){var data=matchData[index];
if(noCustomizer&&data[2]?data[1]!==object[data[0]]:!(data[0]in object))return false}while(++index<length){data=matchData[index];var key=data[0],objValue=object[key],srcValue=data[1];if(noCustomizer&&data[2]){if(objValue===undefined&&!(key in object))return false}else{var stack=new Stack;if(customizer)var result=customizer(objValue,srcValue,key,object,source,stack);if(!(result===undefined?baseIsEqual(srcValue,objValue,COMPARE_PARTIAL_FLAG|COMPARE_UNORDERED_FLAG,customizer,stack):result))return false}}return true}
function baseIsNative(value){if(!isObject(value)||isMasked(value))return false;var pattern=isFunction(value)?reIsNative:reIsHostCtor;return pattern.test(toSource(value))}function baseIsRegExp(value){return isObjectLike(value)&&baseGetTag(value)==regexpTag}function baseIsSet(value){return isObjectLike(value)&&getTag(value)==setTag}function baseIsTypedArray(value){return isObjectLike(value)&&isLength(value.length)&&!!typedArrayTags[baseGetTag(value)]}function baseIteratee(value){if(typeof value=="function")return value;
if(value==null)return identity;if(typeof value=="object")return isArray(value)?baseMatchesProperty(value[0],value[1]):baseMatches(value);return property(value)}function baseKeys(object){if(!isPrototype(object))return nativeKeys(object);var result=[];for(var key in Object(object))if(hasOwnProperty.call(object,key)&&key!="constructor")result.push(key);return result}function baseKeysIn(object){if(!isObject(object))return nativeKeysIn(object);var isProto=isPrototype(object),result=[];for(var key in object)if(!(key==
"constructor"&&(isProto||!hasOwnProperty.call(object,key))))result.push(key);return result}function baseLt(value,other){return value<other}function baseMap(collection,iteratee){var index=-1,result=isArrayLike(collection)?Array(collection.length):[];baseEach(collection,function(value,key,collection){result[++index]=iteratee(value,key,collection)});return result}function baseMatches(source){var matchData=getMatchData(source);if(matchData.length==1&&matchData[0][2])return matchesStrictComparable(matchData[0][0],
matchData[0][1]);return function(object){return object===source||baseIsMatch(object,source,matchData)}}function baseMatchesProperty(path,srcValue){if(isKey(path)&&isStrictComparable(srcValue))return matchesStrictComparable(toKey(path),srcValue);return function(object){var objValue=get(object,path);return objValue===undefined&&objValue===srcValue?hasIn(object,path):baseIsEqual(srcValue,objValue,COMPARE_PARTIAL_FLAG|COMPARE_UNORDERED_FLAG)}}function baseMerge(object,source,srcIndex,customizer,stack){if(object===
source)return;baseFor(source,function(srcValue,key){if(isObject(srcValue)){stack||(stack=new Stack);baseMergeDeep(object,source,key,srcIndex,baseMerge,customizer,stack)}else{var newValue=customizer?customizer(safeGet(object,key),srcValue,key+"",object,source,stack):undefined;if(newValue===undefined)newValue=srcValue;assignMergeValue(object,key,newValue)}},keysIn)}function baseMergeDeep(object,source,key,srcIndex,mergeFunc,customizer,stack){var objValue=safeGet(object,key),srcValue=safeGet(source,
key),stacked=stack.get(srcValue);if(stacked){assignMergeValue(object,key,stacked);return}var newValue=customizer?customizer(objValue,srcValue,key+"",object,source,stack):undefined;var isCommon=newValue===undefined;if(isCommon){var isArr=isArray(srcValue),isBuff=!isArr&&isBuffer(srcValue),isTyped=!isArr&&!isBuff&&isTypedArray(srcValue);newValue=srcValue;if(isArr||isBuff||isTyped)if(isArray(objValue))newValue=objValue;else if(isArrayLikeObject(objValue))newValue=copyArray(objValue);else if(isBuff){isCommon=
false;newValue=cloneBuffer(srcValue,true)}else if(isTyped){isCommon=false;newValue=cloneTypedArray(srcValue,true)}else newValue=[];else if(isPlainObject(srcValue)||isArguments(srcValue)){newValue=objValue;if(isArguments(objValue))newValue=toPlainObject(objValue);else if(!isObject(objValue)||srcIndex&&isFunction(objValue))newValue=initCloneObject(srcValue)}else isCommon=false}if(isCommon){stack.set(srcValue,newValue);mergeFunc(newValue,srcValue,srcIndex,customizer,stack);stack["delete"](srcValue)}assignMergeValue(object,
key,newValue)}function baseNth(array,n){var length=array.length;if(!length)return;n+=n<0?length:0;return isIndex(n,length)?array[n]:undefined}function baseOrderBy(collection,iteratees,orders){var index=-1;iteratees=arrayMap(iteratees.length?iteratees:[identity],baseUnary(getIteratee()));var result=baseMap(collection,function(value,key,collection){var criteria=arrayMap(iteratees,function(iteratee){return iteratee(value)});return{"criteria":criteria,"index":++index,"value":value}});return baseSortBy(result,
function(object,other){return compareMultiple(object,other,orders)})}function basePick(object,paths){return basePickBy(object,paths,function(value,path){return hasIn(object,path)})}function basePickBy(object,paths,predicate){var index=-1,length=paths.length,result={};while(++index<length){var path=paths[index],value=baseGet(object,path);if(predicate(value,path))baseSet(result,castPath(path,object),value)}return result}function basePropertyDeep(path){return function(object){return baseGet(object,path)}}
function basePullAll(array,values,iteratee,comparator){var indexOf=comparator?baseIndexOfWith:baseIndexOf,index=-1,length=values.length,seen=array;if(array===values)values=copyArray(values);if(iteratee)seen=arrayMap(array,baseUnary(iteratee));while(++index<length){var fromIndex=0,value=values[index],computed=iteratee?iteratee(value):value;while((fromIndex=indexOf(seen,computed,fromIndex,comparator))>-1){if(seen!==array)splice.call(seen,fromIndex,1);splice.call(array,fromIndex,1)}}return array}function basePullAt(array,
indexes){var length=array?indexes.length:0,lastIndex=length-1;while(length--){var index=indexes[length];if(length==lastIndex||index!==previous){var previous=index;if(isIndex(index))splice.call(array,index,1);else baseUnset(array,index)}}return array}function baseRandom(lower,upper){return lower+nativeFloor(nativeRandom()*(upper-lower+1))}function baseRange(start,end,step,fromRight){var index=-1,length=nativeMax(nativeCeil((end-start)/(step||1)),0),result=Array(length);while(length--){result[fromRight?
length:++index]=start;start+=step}return result}function baseRepeat(string,n){var result="";if(!string||n<1||n>MAX_SAFE_INTEGER)return result;do{if(n%2)result+=string;n=nativeFloor(n/2);if(n)string+=string}while(n);return result}function baseRest(func,start){return setToString(overRest(func,start,identity),func+"")}function baseSample(collection){return arraySample(values(collection))}function baseSampleSize(collection,n){var array=values(collection);return shuffleSelf(array,baseClamp(n,0,array.length))}
function baseSet(object,path,value,customizer){if(!isObject(object))return object;path=castPath(path,object);var index=-1,length=path.length,lastIndex=length-1,nested=object;while(nested!=null&&++index<length){var key=toKey(path[index]),newValue=value;if(index!=lastIndex){var objValue=nested[key];newValue=customizer?customizer(objValue,key,nested):undefined;if(newValue===undefined)newValue=isObject(objValue)?objValue:isIndex(path[index+1])?[]:{}}assignValue(nested,key,newValue);nested=nested[key]}return object}
var baseSetData=!metaMap?identity:function(func,data){metaMap.set(func,data);return func};var baseSetToString=!defineProperty?identity:function(func,string){return defineProperty(func,"toString",{"configurable":true,"enumerable":false,"value":constant(string),"writable":true})};function baseShuffle(collection){return shuffleSelf(values(collection))}function baseSlice(array,start,end){var index=-1,length=array.length;if(start<0)start=-start>length?0:length+start;end=end>length?length:end;if(end<0)end+=
length;length=start>end?0:end-start>>>0;start>>>=0;var result=Array(length);while(++index<length)result[index]=array[index+start];return result}function baseSome(collection,predicate){var result;baseEach(collection,function(value,index,collection){result=predicate(value,index,collection);return!result});return!!result}function baseSortedIndex(array,value,retHighest){var low=0,high=array==null?low:array.length;if(typeof value=="number"&&value===value&&high<=HALF_MAX_ARRAY_LENGTH){while(low<high){var mid=
low+high>>>1,computed=array[mid];if(computed!==null&&!isSymbol(computed)&&(retHighest?computed<=value:computed<value))low=mid+1;else high=mid}return high}return baseSortedIndexBy(array,value,identity,retHighest)}function baseSortedIndexBy(array,value,iteratee,retHighest){value=iteratee(value);var low=0,high=array==null?0:array.length,valIsNaN=value!==value,valIsNull=value===null,valIsSymbol=isSymbol(value),valIsUndefined=value===undefined;while(low<high){var mid=nativeFloor((low+high)/2),computed=
iteratee(array[mid]),othIsDefined=computed!==undefined,othIsNull=computed===null,othIsReflexive=computed===computed,othIsSymbol=isSymbol(computed);if(valIsNaN)var setLow=retHighest||othIsReflexive;else if(valIsUndefined)setLow=othIsReflexive&&(retHighest||othIsDefined);else if(valIsNull)setLow=othIsReflexive&&othIsDefined&&(retHighest||!othIsNull);else if(valIsSymbol)setLow=othIsReflexive&&othIsDefined&&!othIsNull&&(retHighest||!othIsSymbol);else if(othIsNull||othIsSymbol)setLow=false;else setLow=
retHighest?computed<=value:computed<value;if(setLow)low=mid+1;else high=mid}return nativeMin(high,MAX_ARRAY_INDEX)}function baseSortedUniq(array,iteratee){var index=-1,length=array.length,resIndex=0,result=[];while(++index<length){var value=array[index],computed=iteratee?iteratee(value):value;if(!index||!eq(computed,seen)){var seen=computed;result[resIndex++]=value===0?0:value}}return result}function baseToNumber(value){if(typeof value=="number")return value;if(isSymbol(value))return NAN;return+value}
function baseToString(value){if(typeof value=="string")return value;if(isArray(value))return arrayMap(value,baseToString)+"";if(isSymbol(value))return symbolToString?symbolToString.call(value):"";var result=value+"";return result=="0"&&1/value==-INFINITY?"-0":result}function baseUniq(array,iteratee,comparator){var index=-1,includes=arrayIncludes,length=array.length,isCommon=true,result=[],seen=result;if(comparator){isCommon=false;includes=arrayIncludesWith}else if(length>=LARGE_ARRAY_SIZE){var set=
iteratee?null:createSet(array);if(set)return setToArray(set);isCommon=false;includes=cacheHas;seen=new SetCache}else seen=iteratee?[]:result;outer:while(++index<length){var value=array[index],computed=iteratee?iteratee(value):value;value=comparator||value!==0?value:0;if(isCommon&&computed===computed){var seenIndex=seen.length;while(seenIndex--)if(seen[seenIndex]===computed)continue outer;if(iteratee)seen.push(computed);result.push(value)}else if(!includes(seen,computed,comparator)){if(seen!==result)seen.push(computed);
result.push(value)}}return result}function baseUnset(object,path){path=castPath(path,object);object=parent(object,path);return object==null||delete object[toKey(last(path))]}function baseUpdate(object,path,updater,customizer){return baseSet(object,path,updater(baseGet(object,path)),customizer)}function baseWhile(array,predicate,isDrop,fromRight){var length=array.length,index=fromRight?length:-1;while((fromRight?index--:++index<length)&&predicate(array[index],index,array));return isDrop?baseSlice(array,
fromRight?0:index,fromRight?index+1:length):baseSlice(array,fromRight?index+1:0,fromRight?length:index)}function baseWrapperValue(value,actions){var result=value;if(result instanceof LazyWrapper)result=result.value();return arrayReduce(actions,function(result,action){return action.func.apply(action.thisArg,arrayPush([result],action.args))},result)}function baseXor(arrays,iteratee,comparator){var length=arrays.length;if(length<2)return length?baseUniq(arrays[0]):[];var index=-1,result=Array(length);
while(++index<length){var array=arrays[index],othIndex=-1;while(++othIndex<length)if(othIndex!=index)result[index]=baseDifference(result[index]||array,arrays[othIndex],iteratee,comparator)}return baseUniq(baseFlatten(result,1),iteratee,comparator)}function baseZipObject(props,values,assignFunc){var index=-1,length=props.length,valsLength=values.length,result={};while(++index<length){var value=index<valsLength?values[index]:undefined;assignFunc(result,props[index],value)}return result}function castArrayLikeObject(value){return isArrayLikeObject(value)?
value:[]}function castFunction(value){return typeof value=="function"?value:identity}function castPath(value,object){if(isArray(value))return value;return isKey(value,object)?[value]:stringToPath(toString(value))}var castRest=baseRest;function castSlice(array,start,end){var length=array.length;end=end===undefined?length:end;return!start&&end>=length?array:baseSlice(array,start,end)}var clearTimeout=ctxClearTimeout||function(id){return root.clearTimeout(id)};function cloneBuffer(buffer,isDeep){if(isDeep)return buffer.slice();
var length=buffer.length,result=allocUnsafe?allocUnsafe(length):new buffer.constructor(length);buffer.copy(result);return result}function cloneArrayBuffer(arrayBuffer){var result=new arrayBuffer.constructor(arrayBuffer.byteLength);(new Uint8Array(result)).set(new Uint8Array(arrayBuffer));return result}function cloneDataView(dataView,isDeep){var buffer=isDeep?cloneArrayBuffer(dataView.buffer):dataView.buffer;return new dataView.constructor(buffer,dataView.byteOffset,dataView.byteLength)}function cloneRegExp(regexp){var result=
new regexp.constructor(regexp.source,reFlags.exec(regexp));result.lastIndex=regexp.lastIndex;return result}function cloneSymbol(symbol){return symbolValueOf?Object(symbolValueOf.call(symbol)):{}}function cloneTypedArray(typedArray,isDeep){var buffer=isDeep?cloneArrayBuffer(typedArray.buffer):typedArray.buffer;return new typedArray.constructor(buffer,typedArray.byteOffset,typedArray.length)}function compareAscending(value,other){if(value!==other){var valIsDefined=value!==undefined,valIsNull=value===
null,valIsReflexive=value===value,valIsSymbol=isSymbol(value);var othIsDefined=other!==undefined,othIsNull=other===null,othIsReflexive=other===other,othIsSymbol=isSymbol(other);if(!othIsNull&&!othIsSymbol&&!valIsSymbol&&value>other||valIsSymbol&&othIsDefined&&othIsReflexive&&!othIsNull&&!othIsSymbol||valIsNull&&othIsDefined&&othIsReflexive||!valIsDefined&&othIsReflexive||!valIsReflexive)return 1;if(!valIsNull&&!valIsSymbol&&!othIsSymbol&&value<other||othIsSymbol&&valIsDefined&&valIsReflexive&&!valIsNull&&
!valIsSymbol||othIsNull&&valIsDefined&&valIsReflexive||!othIsDefined&&valIsReflexive||!othIsReflexive)return-1}return 0}function compareMultiple(object,other,orders){var index=-1,objCriteria=object.criteria,othCriteria=other.criteria,length=objCriteria.length,ordersLength=orders.length;while(++index<length){var result=compareAscending(objCriteria[index],othCriteria[index]);if(result){if(index>=ordersLength)return result;var order=orders[index];return result*(order=="desc"?-1:1)}}return object.index-
other.index}function composeArgs(args,partials,holders,isCurried){var argsIndex=-1,argsLength=args.length,holdersLength=holders.length,leftIndex=-1,leftLength=partials.length,rangeLength=nativeMax(argsLength-holdersLength,0),result=Array(leftLength+rangeLength),isUncurried=!isCurried;while(++leftIndex<leftLength)result[leftIndex]=partials[leftIndex];while(++argsIndex<holdersLength)if(isUncurried||argsIndex<argsLength)result[holders[argsIndex]]=args[argsIndex];while(rangeLength--)result[leftIndex++]=
args[argsIndex++];return result}function composeArgsRight(args,partials,holders,isCurried){var argsIndex=-1,argsLength=args.length,holdersIndex=-1,holdersLength=holders.length,rightIndex=-1,rightLength=partials.length,rangeLength=nativeMax(argsLength-holdersLength,0),result=Array(rangeLength+rightLength),isUncurried=!isCurried;while(++argsIndex<rangeLength)result[argsIndex]=args[argsIndex];var offset=argsIndex;while(++rightIndex<rightLength)result[offset+rightIndex]=partials[rightIndex];while(++holdersIndex<
holdersLength)if(isUncurried||argsIndex<argsLength)result[offset+holders[holdersIndex]]=args[argsIndex++];return result}function copyArray(source,array){var index=-1,length=source.length;array||(array=Array(length));while(++index<length)array[index]=source[index];return array}function copyObject(source,props,object,customizer){var isNew=!object;object||(object={});var index=-1,length=props.length;while(++index<length){var key=props[index];var newValue=customizer?customizer(object[key],source[key],
key,object,source):undefined;if(newValue===undefined)newValue=source[key];if(isNew)baseAssignValue(object,key,newValue);else assignValue(object,key,newValue)}return object}function copySymbols(source,object){return copyObject(source,getSymbols(source),object)}function copySymbolsIn(source,object){return copyObject(source,getSymbolsIn(source),object)}function createAggregator(setter,initializer){return function(collection,iteratee){var func=isArray(collection)?arrayAggregator:baseAggregator,accumulator=
initializer?initializer():{};return func(collection,setter,getIteratee(iteratee,2),accumulator)}}function createAssigner(assigner){return baseRest(function(object,sources){var index=-1,length=sources.length,customizer=length>1?sources[length-1]:undefined,guard=length>2?sources[2]:undefined;customizer=assigner.length>3&&typeof customizer=="function"?(length--,customizer):undefined;if(guard&&isIterateeCall(sources[0],sources[1],guard)){customizer=length<3?undefined:customizer;length=1}object=Object(object);
while(++index<length){var source=sources[index];if(source)assigner(object,source,index,customizer)}return object})}function createBaseEach(eachFunc,fromRight){return function(collection,iteratee){if(collection==null)return collection;if(!isArrayLike(collection))return eachFunc(collection,iteratee);var length=collection.length,index=fromRight?length:-1,iterable=Object(collection);while(fromRight?index--:++index<length)if(iteratee(iterable[index],index,iterable)===false)break;return collection}}function createBaseFor(fromRight){return function(object,
iteratee,keysFunc){var index=-1,iterable=Object(object),props=keysFunc(object),length=props.length;while(length--){var key=props[fromRight?length:++index];if(iteratee(iterable[key],key,iterable)===false)break}return object}}function createBind(func,bitmask,thisArg){var isBind=bitmask&WRAP_BIND_FLAG,Ctor=createCtor(func);function wrapper(){var fn=this&&this!==root&&this instanceof wrapper?Ctor:func;return fn.apply(isBind?thisArg:this,arguments)}return wrapper}function createCaseFirst(methodName){return function(string){string=
toString(string);var strSymbols=hasUnicode(string)?stringToArray(string):undefined;var chr=strSymbols?strSymbols[0]:string.charAt(0);var trailing=strSymbols?castSlice(strSymbols,1).join(""):string.slice(1);return chr[methodName]()+trailing}}function createCompounder(callback){return function(string){return arrayReduce(words(deburr(string).replace(reApos,"")),callback,"")}}function createCtor(Ctor){return function(){var args=arguments;switch(args.length){case 0:return new Ctor;case 1:return new Ctor(args[0]);
case 2:return new Ctor(args[0],args[1]);case 3:return new Ctor(args[0],args[1],args[2]);case 4:return new Ctor(args[0],args[1],args[2],args[3]);case 5:return new Ctor(args[0],args[1],args[2],args[3],args[4]);case 6:return new Ctor(args[0],args[1],args[2],args[3],args[4],args[5]);case 7:return new Ctor(args[0],args[1],args[2],args[3],args[4],args[5],args[6])}var thisBinding=baseCreate(Ctor.prototype),result=Ctor.apply(thisBinding,args);return isObject(result)?result:thisBinding}}function createCurry(func,
bitmask,arity){var Ctor=createCtor(func);function wrapper(){var length=arguments.length,args=Array(length),index=length,placeholder=getHolder(wrapper);while(index--)args[index]=arguments[index];var holders=length<3&&args[0]!==placeholder&&args[length-1]!==placeholder?[]:replaceHolders(args,placeholder);length-=holders.length;if(length<arity)return createRecurry(func,bitmask,createHybrid,wrapper.placeholder,undefined,args,holders,undefined,undefined,arity-length);var fn=this&&this!==root&&this instanceof
wrapper?Ctor:func;return apply(fn,this,args)}return wrapper}function createFind(findIndexFunc){return function(collection,predicate,fromIndex){var iterable=Object(collection);if(!isArrayLike(collection)){var iteratee=getIteratee(predicate,3);collection=keys(collection);predicate=function(key){return iteratee(iterable[key],key,iterable)}}var index=findIndexFunc(collection,predicate,fromIndex);return index>-1?iterable[iteratee?collection[index]:index]:undefined}}function createFlow(fromRight){return flatRest(function(funcs){var length=
funcs.length,index=length,prereq=LodashWrapper.prototype.thru;if(fromRight)funcs.reverse();while(index--){var func=funcs[index];if(typeof func!="function")throw new TypeError(FUNC_ERROR_TEXT);if(prereq&&!wrapper&&getFuncName(func)=="wrapper")var wrapper=new LodashWrapper([],true)}index=wrapper?index:length;while(++index<length){func=funcs[index];var funcName=getFuncName(func),data=funcName=="wrapper"?getData(func):undefined;if(data&&isLaziable(data[0])&&data[1]==(WRAP_ARY_FLAG|WRAP_CURRY_FLAG|WRAP_PARTIAL_FLAG|
WRAP_REARG_FLAG)&&!data[4].length&&data[9]==1)wrapper=wrapper[getFuncName(data[0])].apply(wrapper,data[3]);else wrapper=func.length==1&&isLaziable(func)?wrapper[funcName]():wrapper.thru(func)}return function(){var args=arguments,value=args[0];if(wrapper&&args.length==1&&isArray(value))return wrapper.plant(value).value();var index=0,result=length?funcs[index].apply(this,args):value;while(++index<length)result=funcs[index].call(this,result);return result}})}function createHybrid(func,bitmask,thisArg,
partials,holders,partialsRight,holdersRight,argPos,ary,arity){var isAry=bitmask&WRAP_ARY_FLAG,isBind=bitmask&WRAP_BIND_FLAG,isBindKey=bitmask&WRAP_BIND_KEY_FLAG,isCurried=bitmask&(WRAP_CURRY_FLAG|WRAP_CURRY_RIGHT_FLAG),isFlip=bitmask&WRAP_FLIP_FLAG,Ctor=isBindKey?undefined:createCtor(func);function wrapper(){var length=arguments.length,args=Array(length),index=length;while(index--)args[index]=arguments[index];if(isCurried)var placeholder=getHolder(wrapper),holdersCount=countHolders(args,placeholder);
if(partials)args=composeArgs(args,partials,holders,isCurried);if(partialsRight)args=composeArgsRight(args,partialsRight,holdersRight,isCurried);length-=holdersCount;if(isCurried&&length<arity){var newHolders=replaceHolders(args,placeholder);return createRecurry(func,bitmask,createHybrid,wrapper.placeholder,thisArg,args,newHolders,argPos,ary,arity-length)}var thisBinding=isBind?thisArg:this,fn=isBindKey?thisBinding[func]:func;length=args.length;if(argPos)args=reorder(args,argPos);else if(isFlip&&length>
1)args.reverse();if(isAry&&ary<length)args.length=ary;if(this&&this!==root&&this instanceof wrapper)fn=Ctor||createCtor(fn);return fn.apply(thisBinding,args)}return wrapper}function createInverter(setter,toIteratee){return function(object,iteratee){return baseInverter(object,setter,toIteratee(iteratee),{})}}function createMathOperation(operator,defaultValue){return function(value,other){var result;if(value===undefined&&other===undefined)return defaultValue;if(value!==undefined)result=value;if(other!==
undefined){if(result===undefined)return other;if(typeof value=="string"||typeof other=="string"){value=baseToString(value);other=baseToString(other)}else{value=baseToNumber(value);other=baseToNumber(other)}result=operator(value,other)}return result}}function createOver(arrayFunc){return flatRest(function(iteratees){iteratees=arrayMap(iteratees,baseUnary(getIteratee()));return baseRest(function(args){var thisArg=this;return arrayFunc(iteratees,function(iteratee){return apply(iteratee,thisArg,args)})})})}
function createPadding(length,chars){chars=chars===undefined?" ":baseToString(chars);var charsLength=chars.length;if(charsLength<2)return charsLength?baseRepeat(chars,length):chars;var result=baseRepeat(chars,nativeCeil(length/stringSize(chars)));return hasUnicode(chars)?castSlice(stringToArray(result),0,length).join(""):result.slice(0,length)}function createPartial(func,bitmask,thisArg,partials){var isBind=bitmask&WRAP_BIND_FLAG,Ctor=createCtor(func);function wrapper(){var argsIndex=-1,argsLength=
arguments.length,leftIndex=-1,leftLength=partials.length,args=Array(leftLength+argsLength),fn=this&&this!==root&&this instanceof wrapper?Ctor:func;while(++leftIndex<leftLength)args[leftIndex]=partials[leftIndex];while(argsLength--)args[leftIndex++]=arguments[++argsIndex];return apply(fn,isBind?thisArg:this,args)}return wrapper}function createRange(fromRight){return function(start,end,step){if(step&&typeof step!="number"&&isIterateeCall(start,end,step))end=step=undefined;start=toFinite(start);if(end===
undefined){end=start;start=0}else end=toFinite(end);step=step===undefined?start<end?1:-1:toFinite(step);return baseRange(start,end,step,fromRight)}}function createRelationalOperation(operator){return function(value,other){if(!(typeof value=="string"&&typeof other=="string")){value=toNumber(value);other=toNumber(other)}return operator(value,other)}}function createRecurry(func,bitmask,wrapFunc,placeholder,thisArg,partials,holders,argPos,ary,arity){var isCurry=bitmask&WRAP_CURRY_FLAG,newHolders=isCurry?
holders:undefined,newHoldersRight=isCurry?undefined:holders,newPartials=isCurry?partials:undefined,newPartialsRight=isCurry?undefined:partials;bitmask|=isCurry?WRAP_PARTIAL_FLAG:WRAP_PARTIAL_RIGHT_FLAG;bitmask&=~(isCurry?WRAP_PARTIAL_RIGHT_FLAG:WRAP_PARTIAL_FLAG);if(!(bitmask&WRAP_CURRY_BOUND_FLAG))bitmask&=~(WRAP_BIND_FLAG|WRAP_BIND_KEY_FLAG);var newData=[func,bitmask,thisArg,newPartials,newHolders,newPartialsRight,newHoldersRight,argPos,ary,arity];var result=wrapFunc.apply(undefined,newData);if(isLaziable(func))setData(result,
newData);result.placeholder=placeholder;return setWrapToString(result,func,bitmask)}function createRound(methodName){var func=Math[methodName];return function(number,precision){number=toNumber(number);precision=precision==null?0:nativeMin(toInteger(precision),292);if(precision){var pair=(toString(number)+"e").split("e"),value=func(pair[0]+"e"+(+pair[1]+precision));pair=(toString(value)+"e").split("e");return+(pair[0]+"e"+(+pair[1]-precision))}return func(number)}}var createSet=!(Set&&1/setToArray(new Set([,
-0]))[1]==INFINITY)?noop:function(values){return new Set(values)};function createToPairs(keysFunc){return function(object){var tag=getTag(object);if(tag==mapTag)return mapToArray(object);if(tag==setTag)return setToPairs(object);return baseToPairs(object,keysFunc(object))}}function createWrap(func,bitmask,thisArg,partials,holders,argPos,ary,arity){var isBindKey=bitmask&WRAP_BIND_KEY_FLAG;if(!isBindKey&&typeof func!="function")throw new TypeError(FUNC_ERROR_TEXT);var length=partials?partials.length:
0;if(!length){bitmask&=~(WRAP_PARTIAL_FLAG|WRAP_PARTIAL_RIGHT_FLAG);partials=holders=undefined}ary=ary===undefined?ary:nativeMax(toInteger(ary),0);arity=arity===undefined?arity:toInteger(arity);length-=holders?holders.length:0;if(bitmask&WRAP_PARTIAL_RIGHT_FLAG){var partialsRight=partials,holdersRight=holders;partials=holders=undefined}var data=isBindKey?undefined:getData(func);var newData=[func,bitmask,thisArg,partials,holders,partialsRight,holdersRight,argPos,ary,arity];if(data)mergeData(newData,
data);func=newData[0];bitmask=newData[1];thisArg=newData[2];partials=newData[3];holders=newData[4];arity=newData[9]=newData[9]===undefined?isBindKey?0:func.length:nativeMax(newData[9]-length,0);if(!arity&&bitmask&(WRAP_CURRY_FLAG|WRAP_CURRY_RIGHT_FLAG))bitmask&=~(WRAP_CURRY_FLAG|WRAP_CURRY_RIGHT_FLAG);if(!bitmask||bitmask==WRAP_BIND_FLAG)var result=createBind(func,bitmask,thisArg);else if(bitmask==WRAP_CURRY_FLAG||bitmask==WRAP_CURRY_RIGHT_FLAG)result=createCurry(func,bitmask,arity);else if((bitmask==
WRAP_PARTIAL_FLAG||bitmask==(WRAP_BIND_FLAG|WRAP_PARTIAL_FLAG))&&!holders.length)result=createPartial(func,bitmask,thisArg,partials);else result=createHybrid.apply(undefined,newData);var setter=data?baseSetData:setData;return setWrapToString(setter(result,newData),func,bitmask)}function customDefaultsAssignIn(objValue,srcValue,key,object){if(objValue===undefined||eq(objValue,objectProto[key])&&!hasOwnProperty.call(object,key))return srcValue;return objValue}function customDefaultsMerge(objValue,srcValue,
key,object,source,stack){if(isObject(objValue)&&isObject(srcValue)){stack.set(srcValue,objValue);baseMerge(objValue,srcValue,undefined,customDefaultsMerge,stack);stack["delete"](srcValue)}return objValue}function customOmitClone(value){return isPlainObject(value)?undefined:value}function equalArrays(array,other,bitmask,customizer,equalFunc,stack){var isPartial=bitmask&COMPARE_PARTIAL_FLAG,arrLength=array.length,othLength=other.length;if(arrLength!=othLength&&!(isPartial&&othLength>arrLength))return false;
var stacked=stack.get(array);if(stacked&&stack.get(other))return stacked==other;var index=-1,result=true,seen=bitmask&COMPARE_UNORDERED_FLAG?new SetCache:undefined;stack.set(array,other);stack.set(other,array);while(++index<arrLength){var arrValue=array[index],othValue=other[index];if(customizer)var compared=isPartial?customizer(othValue,arrValue,index,other,array,stack):customizer(arrValue,othValue,index,array,other,stack);if(compared!==undefined){if(compared)continue;result=false;break}if(seen){if(!arraySome(other,
function(othValue,othIndex){if(!cacheHas(seen,othIndex)&&(arrValue===othValue||equalFunc(arrValue,othValue,bitmask,customizer,stack)))return seen.push(othIndex)})){result=false;break}}else if(!(arrValue===othValue||equalFunc(arrValue,othValue,bitmask,customizer,stack))){result=false;break}}stack["delete"](array);stack["delete"](other);return result}function equalByTag(object,other,tag,bitmask,customizer,equalFunc,stack){switch(tag){case dataViewTag:if(object.byteLength!=other.byteLength||object.byteOffset!=
other.byteOffset)return false;object=object.buffer;other=other.buffer;case arrayBufferTag:if(object.byteLength!=other.byteLength||!equalFunc(new Uint8Array(object),new Uint8Array(other)))return false;return true;case boolTag:case dateTag:case numberTag:return eq(+object,+other);case errorTag:return object.name==other.name&&object.message==other.message;case regexpTag:case stringTag:return object==other+"";case mapTag:var convert=mapToArray;case setTag:var isPartial=bitmask&COMPARE_PARTIAL_FLAG;convert||
(convert=setToArray);if(object.size!=other.size&&!isPartial)return false;var stacked=stack.get(object);if(stacked)return stacked==other;bitmask|=COMPARE_UNORDERED_FLAG;stack.set(object,other);var result=equalArrays(convert(object),convert(other),bitmask,customizer,equalFunc,stack);stack["delete"](object);return result;case symbolTag:if(symbolValueOf)return symbolValueOf.call(object)==symbolValueOf.call(other)}return false}function equalObjects(object,other,bitmask,customizer,equalFunc,stack){var isPartial=
bitmask&COMPARE_PARTIAL_FLAG,objProps=getAllKeys(object),objLength=objProps.length,othProps=getAllKeys(other),othLength=othProps.length;if(objLength!=othLength&&!isPartial)return false;var index=objLength;while(index--){var key=objProps[index];if(!(isPartial?key in other:hasOwnProperty.call(other,key)))return false}var stacked=stack.get(object);if(stacked&&stack.get(other))return stacked==other;var result=true;stack.set(object,other);stack.set(other,object);var skipCtor=isPartial;while(++index<objLength){key=
objProps[index];var objValue=object[key],othValue=other[key];if(customizer)var compared=isPartial?customizer(othValue,objValue,key,other,object,stack):customizer(objValue,othValue,key,object,other,stack);if(!(compared===undefined?objValue===othValue||equalFunc(objValue,othValue,bitmask,customizer,stack):compared)){result=false;break}skipCtor||(skipCtor=key=="constructor")}if(result&&!skipCtor){var objCtor=object.constructor,othCtor=other.constructor;if(objCtor!=othCtor&&("constructor"in object&&"constructor"in
other)&&!(typeof objCtor=="function"&&objCtor instanceof objCtor&&typeof othCtor=="function"&&othCtor instanceof othCtor))result=false}stack["delete"](object);stack["delete"](other);return result}function flatRest(func){return setToString(overRest(func,undefined,flatten),func+"")}function getAllKeys(object){return baseGetAllKeys(object,keys,getSymbols)}function getAllKeysIn(object){return baseGetAllKeys(object,keysIn,getSymbolsIn)}var getData=!metaMap?noop:function(func){return metaMap.get(func)};
function getFuncName(func){var result=func.name+"",array=realNames[result],length=hasOwnProperty.call(realNames,result)?array.length:0;while(length--){var data=array[length],otherFunc=data.func;if(otherFunc==null||otherFunc==func)return data.name}return result}function getHolder(func){var object=hasOwnProperty.call(lodash,"placeholder")?lodash:func;return object.placeholder}function getIteratee(){var result=lodash.iteratee||iteratee;result=result===iteratee?baseIteratee:result;return arguments.length?
result(arguments[0],arguments[1]):result}function getMapData(map,key){var data=map.__data__;return isKeyable(key)?data[typeof key=="string"?"string":"hash"]:data.map}function getMatchData(object){var result=keys(object),length=result.length;while(length--){var key=result[length],value=object[key];result[length]=[key,value,isStrictComparable(value)]}return result}function getNative(object,key){var value=getValue(object,key);return baseIsNative(value)?value:undefined}function getRawTag(value){var isOwn=
hasOwnProperty.call(value,symToStringTag),tag=value[symToStringTag];try{value[symToStringTag]=undefined;var unmasked=true}catch(e){}var result=nativeObjectToString.call(value);if(unmasked)if(isOwn)value[symToStringTag]=tag;else delete value[symToStringTag];return result}var getSymbols=!nativeGetSymbols?stubArray:function(object){if(object==null)return[];object=Object(object);return arrayFilter(nativeGetSymbols(object),function(symbol){return propertyIsEnumerable.call(object,symbol)})};var getSymbolsIn=
!nativeGetSymbols?stubArray:function(object){var result=[];while(object){arrayPush(result,getSymbols(object));object=getPrototype(object)}return result};var getTag=baseGetTag;if(DataView&&getTag(new DataView(new ArrayBuffer(1)))!=dataViewTag||Map&&getTag(new Map)!=mapTag||Promise&&getTag(Promise.resolve())!=promiseTag||Set&&getTag(new Set)!=setTag||WeakMap&&getTag(new WeakMap)!=weakMapTag)getTag=function(value){var result=baseGetTag(value),Ctor=result==objectTag?value.constructor:undefined,ctorString=
Ctor?toSource(Ctor):"";if(ctorString)switch(ctorString){case dataViewCtorString:return dataViewTag;case mapCtorString:return mapTag;case promiseCtorString:return promiseTag;case setCtorString:return setTag;case weakMapCtorString:return weakMapTag}return result};function getView(start,end,transforms){var index=-1,length=transforms.length;while(++index<length){var data=transforms[index],size=data.size;switch(data.type){case "drop":start+=size;break;case "dropRight":end-=size;break;case "take":end=nativeMin(end,
start+size);break;case "takeRight":start=nativeMax(start,end-size);break}}return{"start":start,"end":end}}function getWrapDetails(source){var match=source.match(reWrapDetails);return match?match[1].split(reSplitDetails):[]}function hasPath(object,path,hasFunc){path=castPath(path,object);var index=-1,length=path.length,result=false;while(++index<length){var key=toKey(path[index]);if(!(result=object!=null&&hasFunc(object,key)))break;object=object[key]}if(result||++index!=length)return result;length=
object==null?0:object.length;return!!length&&isLength(length)&&isIndex(key,length)&&(isArray(object)||isArguments(object))}function initCloneArray(array){var length=array.length,result=new array.constructor(length);if(length&&typeof array[0]=="string"&&hasOwnProperty.call(array,"index")){result.index=array.index;result.input=array.input}return result}function initCloneObject(object){return typeof object.constructor=="function"&&!isPrototype(object)?baseCreate(getPrototype(object)):{}}function initCloneByTag(object,
tag,isDeep){var Ctor=object.constructor;switch(tag){case arrayBufferTag:return cloneArrayBuffer(object);case boolTag:case dateTag:return new Ctor(+object);case dataViewTag:return cloneDataView(object,isDeep);case float32Tag:case float64Tag:case int8Tag:case int16Tag:case int32Tag:case uint8Tag:case uint8ClampedTag:case uint16Tag:case uint32Tag:return cloneTypedArray(object,isDeep);case mapTag:return new Ctor;case numberTag:case stringTag:return new Ctor(object);case regexpTag:return cloneRegExp(object);
case setTag:return new Ctor;case symbolTag:return cloneSymbol(object)}}function insertWrapDetails(source,details){var length=details.length;if(!length)return source;var lastIndex=length-1;details[lastIndex]=(length>1?"\x26 ":"")+details[lastIndex];details=details.join(length>2?", ":" ");return source.replace(reWrapComment,"{\n/* [wrapped with "+details+"] */\n")}function isFlattenable(value){return isArray(value)||isArguments(value)||!!(spreadableSymbol&&value&&value[spreadableSymbol])}function isIndex(value,
length){var type=typeof value;length=length==null?MAX_SAFE_INTEGER:length;return!!length&&(type=="number"||type!="symbol"&&reIsUint.test(value))&&(value>-1&&value%1==0&&value<length)}function isIterateeCall(value,index,object){if(!isObject(object))return false;var type=typeof index;if(type=="number"?isArrayLike(object)&&isIndex(index,object.length):type=="string"&&index in object)return eq(object[index],value);return false}function isKey(value,object){if(isArray(value))return false;var type=typeof value;
if(type=="number"||type=="symbol"||type=="boolean"||value==null||isSymbol(value))return true;return reIsPlainProp.test(value)||!reIsDeepProp.test(value)||object!=null&&value in Object(object)}function isKeyable(value){var type=typeof value;return type=="string"||type=="number"||type=="symbol"||type=="boolean"?value!=="__proto__":value===null}function isLaziable(func){var funcName=getFuncName(func),other=lodash[funcName];if(typeof other!="function"||!(funcName in LazyWrapper.prototype))return false;
if(func===other)return true;var data=getData(other);return!!data&&func===data[0]}function isMasked(func){return!!maskSrcKey&&maskSrcKey in func}var isMaskable=coreJsData?isFunction:stubFalse;function isPrototype(value){var Ctor=value&&value.constructor,proto=typeof Ctor=="function"&&Ctor.prototype||objectProto;return value===proto}function isStrictComparable(value){return value===value&&!isObject(value)}function matchesStrictComparable(key,srcValue){return function(object){if(object==null)return false;
return object[key]===srcValue&&(srcValue!==undefined||key in Object(object))}}function memoizeCapped(func){var result=memoize(func,function(key){if(cache.size===MAX_MEMOIZE_SIZE)cache.clear();return key});var cache=result.cache;return result}function mergeData(data,source){var bitmask=data[1],srcBitmask=source[1],newBitmask=bitmask|srcBitmask,isCommon=newBitmask<(WRAP_BIND_FLAG|WRAP_BIND_KEY_FLAG|WRAP_ARY_FLAG);var isCombo=srcBitmask==WRAP_ARY_FLAG&&bitmask==WRAP_CURRY_FLAG||srcBitmask==WRAP_ARY_FLAG&&
bitmask==WRAP_REARG_FLAG&&data[7].length<=source[8]||srcBitmask==(WRAP_ARY_FLAG|WRAP_REARG_FLAG)&&source[7].length<=source[8]&&bitmask==WRAP_CURRY_FLAG;if(!(isCommon||isCombo))return data;if(srcBitmask&WRAP_BIND_FLAG){data[2]=source[2];newBitmask|=bitmask&WRAP_BIND_FLAG?0:WRAP_CURRY_BOUND_FLAG}var value=source[3];if(value){var partials=data[3];data[3]=partials?composeArgs(partials,value,source[4]):value;data[4]=partials?replaceHolders(data[3],PLACEHOLDER):source[4]}value=source[5];if(value){partials=
data[5];data[5]=partials?composeArgsRight(partials,value,source[6]):value;data[6]=partials?replaceHolders(data[5],PLACEHOLDER):source[6]}value=source[7];if(value)data[7]=value;if(srcBitmask&WRAP_ARY_FLAG)data[8]=data[8]==null?source[8]:nativeMin(data[8],source[8]);if(data[9]==null)data[9]=source[9];data[0]=source[0];data[1]=newBitmask;return data}function nativeKeysIn(object){var result=[];if(object!=null)for(var key in Object(object))result.push(key);return result}function objectToString(value){return nativeObjectToString.call(value)}
function overRest(func,start,transform){start=nativeMax(start===undefined?func.length-1:start,0);return function(){var args=arguments,index=-1,length=nativeMax(args.length-start,0),array=Array(length);while(++index<length)array[index]=args[start+index];index=-1;var otherArgs=Array(start+1);while(++index<start)otherArgs[index]=args[index];otherArgs[start]=transform(array);return apply(func,this,otherArgs)}}function parent(object,path){return path.length<2?object:baseGet(object,baseSlice(path,0,-1))}
function reorder(array,indexes){var arrLength=array.length,length=nativeMin(indexes.length,arrLength),oldArray=copyArray(array);while(length--){var index=indexes[length];array[length]=isIndex(index,arrLength)?oldArray[index]:undefined}return array}var setData=shortOut(baseSetData);var setTimeout=ctxSetTimeout||function(func,wait){return root.setTimeout(func,wait)};var setToString=shortOut(baseSetToString);function setWrapToString(wrapper,reference,bitmask){var source=reference+"";return setToString(wrapper,
insertWrapDetails(source,updateWrapDetails(getWrapDetails(source),bitmask)))}function shortOut(func){var count=0,lastCalled=0;return function(){var stamp=nativeNow(),remaining=HOT_SPAN-(stamp-lastCalled);lastCalled=stamp;if(remaining>0){if(++count>=HOT_COUNT)return arguments[0]}else count=0;return func.apply(undefined,arguments)}}function shuffleSelf(array,size){var index=-1,length=array.length,lastIndex=length-1;size=size===undefined?length:size;while(++index<size){var rand=baseRandom(index,lastIndex),
value=array[rand];array[rand]=array[index];array[index]=value}array.length=size;return array}var stringToPath=memoizeCapped(function(string){var result=[];if(string.charCodeAt(0)===46)result.push("");string.replace(rePropName,function(match,number,quote,subString){result.push(quote?subString.replace(reEscapeChar,"$1"):number||match)});return result});function toKey(value){if(typeof value=="string"||isSymbol(value))return value;var result=value+"";return result=="0"&&1/value==-INFINITY?"-0":result}
function toSource(func){if(func!=null){try{return funcToString.call(func)}catch(e){}try{return func+""}catch(e$0){}}return""}function updateWrapDetails(details,bitmask){arrayEach(wrapFlags,function(pair){var value="_."+pair[0];if(bitmask&pair[1]&&!arrayIncludes(details,value))details.push(value)});return details.sort()}function wrapperClone(wrapper){if(wrapper instanceof LazyWrapper)return wrapper.clone();var result=new LodashWrapper(wrapper.__wrapped__,wrapper.__chain__);result.__actions__=copyArray(wrapper.__actions__);
result.__index__=wrapper.__index__;result.__values__=wrapper.__values__;return result}function chunk(array,size,guard){if(guard?isIterateeCall(array,size,guard):size===undefined)size=1;else size=nativeMax(toInteger(size),0);var length=array==null?0:array.length;if(!length||size<1)return[];var index=0,resIndex=0,result=Array(nativeCeil(length/size));while(index<length)result[resIndex++]=baseSlice(array,index,index+=size);return result}function compact(array){var index=-1,length=array==null?0:array.length,
resIndex=0,result=[];while(++index<length){var value=array[index];if(value)result[resIndex++]=value}return result}function concat(){var length=arguments.length;if(!length)return[];var args=Array(length-1),array=arguments[0],index=length;while(index--)args[index-1]=arguments[index];return arrayPush(isArray(array)?copyArray(array):[array],baseFlatten(args,1))}var difference=baseRest(function(array,values){return isArrayLikeObject(array)?baseDifference(array,baseFlatten(values,1,isArrayLikeObject,true)):
[]});var differenceBy=baseRest(function(array,values){var iteratee=last(values);if(isArrayLikeObject(iteratee))iteratee=undefined;return isArrayLikeObject(array)?baseDifference(array,baseFlatten(values,1,isArrayLikeObject,true),getIteratee(iteratee,2)):[]});var differenceWith=baseRest(function(array,values){var comparator=last(values);if(isArrayLikeObject(comparator))comparator=undefined;return isArrayLikeObject(array)?baseDifference(array,baseFlatten(values,1,isArrayLikeObject,true),undefined,comparator):
[]});function drop(array,n,guard){var length=array==null?0:array.length;if(!length)return[];n=guard||n===undefined?1:toInteger(n);return baseSlice(array,n<0?0:n,length)}function dropRight(array,n,guard){var length=array==null?0:array.length;if(!length)return[];n=guard||n===undefined?1:toInteger(n);n=length-n;return baseSlice(array,0,n<0?0:n)}function dropRightWhile(array,predicate){return array&&array.length?baseWhile(array,getIteratee(predicate,3),true,true):[]}function dropWhile(array,predicate){return array&&
array.length?baseWhile(array,getIteratee(predicate,3),true):[]}function fill(array,value,start,end){var length=array==null?0:array.length;if(!length)return[];if(start&&typeof start!="number"&&isIterateeCall(array,value,start)){start=0;end=length}return baseFill(array,value,start,end)}function findIndex(array,predicate,fromIndex){var length=array==null?0:array.length;if(!length)return-1;var index=fromIndex==null?0:toInteger(fromIndex);if(index<0)index=nativeMax(length+index,0);return baseFindIndex(array,
getIteratee(predicate,3),index)}function findLastIndex(array,predicate,fromIndex){var length=array==null?0:array.length;if(!length)return-1;var index=length-1;if(fromIndex!==undefined){index=toInteger(fromIndex);index=fromIndex<0?nativeMax(length+index,0):nativeMin(index,length-1)}return baseFindIndex(array,getIteratee(predicate,3),index,true)}function flatten(array){var length=array==null?0:array.length;return length?baseFlatten(array,1):[]}function flattenDeep(array){var length=array==null?0:array.length;
return length?baseFlatten(array,INFINITY):[]}function flattenDepth(array,depth){var length=array==null?0:array.length;if(!length)return[];depth=depth===undefined?1:toInteger(depth);return baseFlatten(array,depth)}function fromPairs(pairs){var index=-1,length=pairs==null?0:pairs.length,result={};while(++index<length){var pair=pairs[index];result[pair[0]]=pair[1]}return result}function head(array){return array&&array.length?array[0]:undefined}function indexOf(array,value,fromIndex){var length=array==
null?0:array.length;if(!length)return-1;var index=fromIndex==null?0:toInteger(fromIndex);if(index<0)index=nativeMax(length+index,0);return baseIndexOf(array,value,index)}function initial(array){var length=array==null?0:array.length;return length?baseSlice(array,0,-1):[]}var intersection=baseRest(function(arrays){var mapped=arrayMap(arrays,castArrayLikeObject);return mapped.length&&mapped[0]===arrays[0]?baseIntersection(mapped):[]});var intersectionBy=baseRest(function(arrays){var iteratee=last(arrays),
mapped=arrayMap(arrays,castArrayLikeObject);if(iteratee===last(mapped))iteratee=undefined;else mapped.pop();return mapped.length&&mapped[0]===arrays[0]?baseIntersection(mapped,getIteratee(iteratee,2)):[]});var intersectionWith=baseRest(function(arrays){var comparator=last(arrays),mapped=arrayMap(arrays,castArrayLikeObject);comparator=typeof comparator=="function"?comparator:undefined;if(comparator)mapped.pop();return mapped.length&&mapped[0]===arrays[0]?baseIntersection(mapped,undefined,comparator):
[]});function join(array,separator){return array==null?"":nativeJoin.call(array,separator)}function last(array){var length=array==null?0:array.length;return length?array[length-1]:undefined}function lastIndexOf(array,value,fromIndex){var length=array==null?0:array.length;if(!length)return-1;var index=length;if(fromIndex!==undefined){index=toInteger(fromIndex);index=index<0?nativeMax(length+index,0):nativeMin(index,length-1)}return value===value?strictLastIndexOf(array,value,index):baseFindIndex(array,
baseIsNaN,index,true)}function nth(array,n){return array&&array.length?baseNth(array,toInteger(n)):undefined}var pull=baseRest(pullAll);function pullAll(array,values){return array&&array.length&&values&&values.length?basePullAll(array,values):array}function pullAllBy(array,values,iteratee){return array&&array.length&&values&&values.length?basePullAll(array,values,getIteratee(iteratee,2)):array}function pullAllWith(array,values,comparator){return array&&array.length&&values&&values.length?basePullAll(array,
values,undefined,comparator):array}var pullAt=flatRest(function(array,indexes){var length=array==null?0:array.length,result=baseAt(array,indexes);basePullAt(array,arrayMap(indexes,function(index){return isIndex(index,length)?+index:index}).sort(compareAscending));return result});function remove(array,predicate){var result=[];if(!(array&&array.length))return result;var index=-1,indexes=[],length=array.length;predicate=getIteratee(predicate,3);while(++index<length){var value=array[index];if(predicate(value,
index,array)){result.push(value);indexes.push(index)}}basePullAt(array,indexes);return result}function reverse(array){return array==null?array:nativeReverse.call(array)}function slice(array,start,end){var length=array==null?0:array.length;if(!length)return[];if(end&&typeof end!="number"&&isIterateeCall(array,start,end)){start=0;end=length}else{start=start==null?0:toInteger(start);end=end===undefined?length:toInteger(end)}return baseSlice(array,start,end)}function sortedIndex(array,value){return baseSortedIndex(array,
value)}function sortedIndexBy(array,value,iteratee){return baseSortedIndexBy(array,value,getIteratee(iteratee,2))}function sortedIndexOf(array,value){var length=array==null?0:array.length;if(length){var index=baseSortedIndex(array,value);if(index<length&&eq(array[index],value))return index}return-1}function sortedLastIndex(array,value){return baseSortedIndex(array,value,true)}function sortedLastIndexBy(array,value,iteratee){return baseSortedIndexBy(array,value,getIteratee(iteratee,2),true)}function sortedLastIndexOf(array,
value){var length=array==null?0:array.length;if(length){var index=baseSortedIndex(array,value,true)-1;if(eq(array[index],value))return index}return-1}function sortedUniq(array){return array&&array.length?baseSortedUniq(array):[]}function sortedUniqBy(array,iteratee){return array&&array.length?baseSortedUniq(array,getIteratee(iteratee,2)):[]}function tail(array){var length=array==null?0:array.length;return length?baseSlice(array,1,length):[]}function take(array,n,guard){if(!(array&&array.length))return[];
n=guard||n===undefined?1:toInteger(n);return baseSlice(array,0,n<0?0:n)}function takeRight(array,n,guard){var length=array==null?0:array.length;if(!length)return[];n=guard||n===undefined?1:toInteger(n);n=length-n;return baseSlice(array,n<0?0:n,length)}function takeRightWhile(array,predicate){return array&&array.length?baseWhile(array,getIteratee(predicate,3),false,true):[]}function takeWhile(array,predicate){return array&&array.length?baseWhile(array,getIteratee(predicate,3)):[]}var union=baseRest(function(arrays){return baseUniq(baseFlatten(arrays,
1,isArrayLikeObject,true))});var unionBy=baseRest(function(arrays){var iteratee=last(arrays);if(isArrayLikeObject(iteratee))iteratee=undefined;return baseUniq(baseFlatten(arrays,1,isArrayLikeObject,true),getIteratee(iteratee,2))});var unionWith=baseRest(function(arrays){var comparator=last(arrays);comparator=typeof comparator=="function"?comparator:undefined;return baseUniq(baseFlatten(arrays,1,isArrayLikeObject,true),undefined,comparator)});function uniq(array){return array&&array.length?baseUniq(array):
[]}function uniqBy(array,iteratee){return array&&array.length?baseUniq(array,getIteratee(iteratee,2)):[]}function uniqWith(array,comparator){comparator=typeof comparator=="function"?comparator:undefined;return array&&array.length?baseUniq(array,undefined,comparator):[]}function unzip(array){if(!(array&&array.length))return[];var length=0;array=arrayFilter(array,function(group){if(isArrayLikeObject(group)){length=nativeMax(group.length,length);return true}});return baseTimes(length,function(index){return arrayMap(array,
baseProperty(index))})}function unzipWith(array,iteratee){if(!(array&&array.length))return[];var result=unzip(array);if(iteratee==null)return result;return arrayMap(result,function(group){return apply(iteratee,undefined,group)})}var without=baseRest(function(array,values){return isArrayLikeObject(array)?baseDifference(array,values):[]});var xor=baseRest(function(arrays){return baseXor(arrayFilter(arrays,isArrayLikeObject))});var xorBy=baseRest(function(arrays){var iteratee=last(arrays);if(isArrayLikeObject(iteratee))iteratee=
undefined;return baseXor(arrayFilter(arrays,isArrayLikeObject),getIteratee(iteratee,2))});var xorWith=baseRest(function(arrays){var comparator=last(arrays);comparator=typeof comparator=="function"?comparator:undefined;return baseXor(arrayFilter(arrays,isArrayLikeObject),undefined,comparator)});var zip=baseRest(unzip);function zipObject(props,values){return baseZipObject(props||[],values||[],assignValue)}function zipObjectDeep(props,values){return baseZipObject(props||[],values||[],baseSet)}var zipWith=
baseRest(function(arrays){var length=arrays.length,iteratee=length>1?arrays[length-1]:undefined;iteratee=typeof iteratee=="function"?(arrays.pop(),iteratee):undefined;return unzipWith(arrays,iteratee)});function chain(value){var result=lodash(value);result.__chain__=true;return result}function tap(value,interceptor){interceptor(value);return value}function thru(value,interceptor){return interceptor(value)}var wrapperAt=flatRest(function(paths){var length=paths.length,start=length?paths[0]:0,value=
this.__wrapped__,interceptor=function(object){return baseAt(object,paths)};if(length>1||this.__actions__.length||!(value instanceof LazyWrapper)||!isIndex(start))return this.thru(interceptor);value=value.slice(start,+start+(length?1:0));value.__actions__.push({"func":thru,"args":[interceptor],"thisArg":undefined});return(new LodashWrapper(value,this.__chain__)).thru(function(array){if(length&&!array.length)array.push(undefined);return array})});function wrapperChain(){return chain(this)}function wrapperCommit(){return new LodashWrapper(this.value(),
this.__chain__)}function wrapperNext(){if(this.__values__===undefined)this.__values__=toArray(this.value());var done=this.__index__>=this.__values__.length,value=done?undefined:this.__values__[this.__index__++];return{"done":done,"value":value}}function wrapperToIterator(){return this}function wrapperPlant(value){var result,parent=this;while(parent instanceof baseLodash){var clone=wrapperClone(parent);clone.__index__=0;clone.__values__=undefined;if(result)previous.__wrapped__=clone;else result=clone;
var previous=clone;parent=parent.__wrapped__}previous.__wrapped__=value;return result}function wrapperReverse(){var value=this.__wrapped__;if(value instanceof LazyWrapper){var wrapped=value;if(this.__actions__.length)wrapped=new LazyWrapper(this);wrapped=wrapped.reverse();wrapped.__actions__.push({"func":thru,"args":[reverse],"thisArg":undefined});return new LodashWrapper(wrapped,this.__chain__)}return this.thru(reverse)}function wrapperValue(){return baseWrapperValue(this.__wrapped__,this.__actions__)}
var countBy=createAggregator(function(result,value,key){if(hasOwnProperty.call(result,key))++result[key];else baseAssignValue(result,key,1)});function every(collection,predicate,guard){var func=isArray(collection)?arrayEvery:baseEvery;if(guard&&isIterateeCall(collection,predicate,guard))predicate=undefined;return func(collection,getIteratee(predicate,3))}function filter(collection,predicate){var func=isArray(collection)?arrayFilter:baseFilter;return func(collection,getIteratee(predicate,3))}var find=
createFind(findIndex);var findLast=createFind(findLastIndex);function flatMap(collection,iteratee){return baseFlatten(map(collection,iteratee),1)}function flatMapDeep(collection,iteratee){return baseFlatten(map(collection,iteratee),INFINITY)}function flatMapDepth(collection,iteratee,depth){depth=depth===undefined?1:toInteger(depth);return baseFlatten(map(collection,iteratee),depth)}function forEach(collection,iteratee){var func=isArray(collection)?arrayEach:baseEach;return func(collection,getIteratee(iteratee,
3))}function forEachRight(collection,iteratee){var func=isArray(collection)?arrayEachRight:baseEachRight;return func(collection,getIteratee(iteratee,3))}var groupBy=createAggregator(function(result,value,key){if(hasOwnProperty.call(result,key))result[key].push(value);else baseAssignValue(result,key,[value])});function includes(collection,value,fromIndex,guard){collection=isArrayLike(collection)?collection:values(collection);fromIndex=fromIndex&&!guard?toInteger(fromIndex):0;var length=collection.length;
if(fromIndex<0)fromIndex=nativeMax(length+fromIndex,0);return isString(collection)?fromIndex<=length&&collection.indexOf(value,fromIndex)>-1:!!length&&baseIndexOf(collection,value,fromIndex)>-1}var invokeMap=baseRest(function(collection,path,args){var index=-1,isFunc=typeof path=="function",result=isArrayLike(collection)?Array(collection.length):[];baseEach(collection,function(value){result[++index]=isFunc?apply(path,value,args):baseInvoke(value,path,args)});return result});var keyBy=createAggregator(function(result,
value,key){baseAssignValue(result,key,value)});function map(collection,iteratee){var func=isArray(collection)?arrayMap:baseMap;return func(collection,getIteratee(iteratee,3))}function orderBy(collection,iteratees,orders,guard){if(collection==null)return[];if(!isArray(iteratees))iteratees=iteratees==null?[]:[iteratees];orders=guard?undefined:orders;if(!isArray(orders))orders=orders==null?[]:[orders];return baseOrderBy(collection,iteratees,orders)}var partition=createAggregator(function(result,value,
key){result[key?0:1].push(value)},function(){return[[],[]]});function reduce(collection,iteratee,accumulator){var func=isArray(collection)?arrayReduce:baseReduce,initAccum=arguments.length<3;return func(collection,getIteratee(iteratee,4),accumulator,initAccum,baseEach)}function reduceRight(collection,iteratee,accumulator){var func=isArray(collection)?arrayReduceRight:baseReduce,initAccum=arguments.length<3;return func(collection,getIteratee(iteratee,4),accumulator,initAccum,baseEachRight)}function reject(collection,
predicate){var func=isArray(collection)?arrayFilter:baseFilter;return func(collection,negate(getIteratee(predicate,3)))}function sample(collection){var func=isArray(collection)?arraySample:baseSample;return func(collection)}function sampleSize(collection,n,guard){if(guard?isIterateeCall(collection,n,guard):n===undefined)n=1;else n=toInteger(n);var func=isArray(collection)?arraySampleSize:baseSampleSize;return func(collection,n)}function shuffle(collection){var func=isArray(collection)?arrayShuffle:
baseShuffle;return func(collection)}function size(collection){if(collection==null)return 0;if(isArrayLike(collection))return isString(collection)?stringSize(collection):collection.length;var tag=getTag(collection);if(tag==mapTag||tag==setTag)return collection.size;return baseKeys(collection).length}function some(collection,predicate,guard){var func=isArray(collection)?arraySome:baseSome;if(guard&&isIterateeCall(collection,predicate,guard))predicate=undefined;return func(collection,getIteratee(predicate,
3))}var sortBy=baseRest(function(collection,iteratees){if(collection==null)return[];var length=iteratees.length;if(length>1&&isIterateeCall(collection,iteratees[0],iteratees[1]))iteratees=[];else if(length>2&&isIterateeCall(iteratees[0],iteratees[1],iteratees[2]))iteratees=[iteratees[0]];return baseOrderBy(collection,baseFlatten(iteratees,1),[])});var now=ctxNow||function(){return root.Date.now()};function after(n,func){if(typeof func!="function")throw new TypeError(FUNC_ERROR_TEXT);n=toInteger(n);
return function(){if(--n<1)return func.apply(this,arguments)}}function ary(func,n,guard){n=guard?undefined:n;n=func&&n==null?func.length:n;return createWrap(func,WRAP_ARY_FLAG,undefined,undefined,undefined,undefined,n)}function before(n,func){var result;if(typeof func!="function")throw new TypeError(FUNC_ERROR_TEXT);n=toInteger(n);return function(){if(--n>0)result=func.apply(this,arguments);if(n<=1)func=undefined;return result}}var bind=baseRest(function(func,thisArg,partials){var bitmask=WRAP_BIND_FLAG;
if(partials.length){var holders=replaceHolders(partials,getHolder(bind));bitmask|=WRAP_PARTIAL_FLAG}return createWrap(func,bitmask,thisArg,partials,holders)});var bindKey=baseRest(function(object,key,partials){var bitmask=WRAP_BIND_FLAG|WRAP_BIND_KEY_FLAG;if(partials.length){var holders=replaceHolders(partials,getHolder(bindKey));bitmask|=WRAP_PARTIAL_FLAG}return createWrap(key,bitmask,object,partials,holders)});function curry(func,arity,guard){arity=guard?undefined:arity;var result=createWrap(func,
WRAP_CURRY_FLAG,undefined,undefined,undefined,undefined,undefined,arity);result.placeholder=curry.placeholder;return result}function curryRight(func,arity,guard){arity=guard?undefined:arity;var result=createWrap(func,WRAP_CURRY_RIGHT_FLAG,undefined,undefined,undefined,undefined,undefined,arity);result.placeholder=curryRight.placeholder;return result}function debounce(func,wait,options){var lastArgs,lastThis,maxWait,result,timerId,lastCallTime,lastInvokeTime=0,leading=false,maxing=false,trailing=true;
if(typeof func!="function")throw new TypeError(FUNC_ERROR_TEXT);wait=toNumber(wait)||0;if(isObject(options)){leading=!!options.leading;maxing="maxWait"in options;maxWait=maxing?nativeMax(toNumber(options.maxWait)||0,wait):maxWait;trailing="trailing"in options?!!options.trailing:trailing}function invokeFunc(time){var args=lastArgs,thisArg=lastThis;lastArgs=lastThis=undefined;lastInvokeTime=time;result=func.apply(thisArg,args);return result}function leadingEdge(time){lastInvokeTime=time;timerId=setTimeout(timerExpired,
wait);return leading?invokeFunc(time):result}function remainingWait(time){var timeSinceLastCall=time-lastCallTime,timeSinceLastInvoke=time-lastInvokeTime,timeWaiting=wait-timeSinceLastCall;return maxing?nativeMin(timeWaiting,maxWait-timeSinceLastInvoke):timeWaiting}function shouldInvoke(time){var timeSinceLastCall=time-lastCallTime,timeSinceLastInvoke=time-lastInvokeTime;return lastCallTime===undefined||timeSinceLastCall>=wait||timeSinceLastCall<0||maxing&&timeSinceLastInvoke>=maxWait}function timerExpired(){var time=
now();if(shouldInvoke(time))return trailingEdge(time);timerId=setTimeout(timerExpired,remainingWait(time))}function trailingEdge(time){timerId=undefined;if(trailing&&lastArgs)return invokeFunc(time);lastArgs=lastThis=undefined;return result}function cancel(){if(timerId!==undefined)clearTimeout(timerId);lastInvokeTime=0;lastArgs=lastCallTime=lastThis=timerId=undefined}function flush(){return timerId===undefined?result:trailingEdge(now())}function debounced(){var time=now(),isInvoking=shouldInvoke(time);
lastArgs=arguments;lastThis=this;lastCallTime=time;if(isInvoking){if(timerId===undefined)return leadingEdge(lastCallTime);if(maxing){timerId=setTimeout(timerExpired,wait);return invokeFunc(lastCallTime)}}if(timerId===undefined)timerId=setTimeout(timerExpired,wait);return result}debounced.cancel=cancel;debounced.flush=flush;return debounced}var defer=baseRest(function(func,args){return baseDelay(func,1,args)});var delay=baseRest(function(func,wait,args){return baseDelay(func,toNumber(wait)||0,args)});
function flip(func){return createWrap(func,WRAP_FLIP_FLAG)}function memoize(func,resolver){if(typeof func!="function"||resolver!=null&&typeof resolver!="function")throw new TypeError(FUNC_ERROR_TEXT);var memoized=function(){var args=arguments,key=resolver?resolver.apply(this,args):args[0],cache=memoized.cache;if(cache.has(key))return cache.get(key);var result=func.apply(this,args);memoized.cache=cache.set(key,result)||cache;return result};memoized.cache=new (memoize.Cache||MapCache);return memoized}
memoize.Cache=MapCache;function negate(predicate){if(typeof predicate!="function")throw new TypeError(FUNC_ERROR_TEXT);return function(){var args=arguments;switch(args.length){case 0:return!predicate.call(this);case 1:return!predicate.call(this,args[0]);case 2:return!predicate.call(this,args[0],args[1]);case 3:return!predicate.call(this,args[0],args[1],args[2])}return!predicate.apply(this,args)}}function once(func){return before(2,func)}var overArgs=castRest(function(func,transforms){transforms=transforms.length==
1&&isArray(transforms[0])?arrayMap(transforms[0],baseUnary(getIteratee())):arrayMap(baseFlatten(transforms,1),baseUnary(getIteratee()));var funcsLength=transforms.length;return baseRest(function(args){var index=-1,length=nativeMin(args.length,funcsLength);while(++index<length)args[index]=transforms[index].call(this,args[index]);return apply(func,this,args)})});var partial=baseRest(function(func,partials){var holders=replaceHolders(partials,getHolder(partial));return createWrap(func,WRAP_PARTIAL_FLAG,
undefined,partials,holders)});var partialRight=baseRest(function(func,partials){var holders=replaceHolders(partials,getHolder(partialRight));return createWrap(func,WRAP_PARTIAL_RIGHT_FLAG,undefined,partials,holders)});var rearg=flatRest(function(func,indexes){return createWrap(func,WRAP_REARG_FLAG,undefined,undefined,undefined,indexes)});function rest(func,start){if(typeof func!="function")throw new TypeError(FUNC_ERROR_TEXT);start=start===undefined?start:toInteger(start);return baseRest(func,start)}
function spread(func,start){if(typeof func!="function")throw new TypeError(FUNC_ERROR_TEXT);start=start==null?0:nativeMax(toInteger(start),0);return baseRest(function(args){var array=args[start],otherArgs=castSlice(args,0,start);if(array)arrayPush(otherArgs,array);return apply(func,this,otherArgs)})}function throttle(func,wait,options){var leading=true,trailing=true;if(typeof func!="function")throw new TypeError(FUNC_ERROR_TEXT);if(isObject(options)){leading="leading"in options?!!options.leading:
leading;trailing="trailing"in options?!!options.trailing:trailing}return debounce(func,wait,{"leading":leading,"maxWait":wait,"trailing":trailing})}function unary(func){return ary(func,1)}function wrap(value,wrapper){return partial(castFunction(wrapper),value)}function castArray(){if(!arguments.length)return[];var value=arguments[0];return isArray(value)?value:[value]}function clone(value){return baseClone(value,CLONE_SYMBOLS_FLAG)}function cloneWith(value,customizer){customizer=typeof customizer==
"function"?customizer:undefined;return baseClone(value,CLONE_SYMBOLS_FLAG,customizer)}function cloneDeep(value){return baseClone(value,CLONE_DEEP_FLAG|CLONE_SYMBOLS_FLAG)}function cloneDeepWith(value,customizer){customizer=typeof customizer=="function"?customizer:undefined;return baseClone(value,CLONE_DEEP_FLAG|CLONE_SYMBOLS_FLAG,customizer)}function conformsTo(object,source){return source==null||baseConformsTo(object,source,keys(source))}function eq(value,other){return value===other||value!==value&&
other!==other}var gt=createRelationalOperation(baseGt);var gte=createRelationalOperation(function(value,other){return value>=other});var isArguments=baseIsArguments(function(){return arguments}())?baseIsArguments:function(value){return isObjectLike(value)&&hasOwnProperty.call(value,"callee")&&!propertyIsEnumerable.call(value,"callee")};var isArray=Array.isArray;var isArrayBuffer=nodeIsArrayBuffer?baseUnary(nodeIsArrayBuffer):baseIsArrayBuffer;function isArrayLike(value){return value!=null&&isLength(value.length)&&
!isFunction(value)}function isArrayLikeObject(value){return isObjectLike(value)&&isArrayLike(value)}function isBoolean(value){return value===true||value===false||isObjectLike(value)&&baseGetTag(value)==boolTag}var isBuffer=nativeIsBuffer||stubFalse;var isDate=nodeIsDate?baseUnary(nodeIsDate):baseIsDate;function isElement(value){return isObjectLike(value)&&value.nodeType===1&&!isPlainObject(value)}function isEmpty(value){if(value==null)return true;if(isArrayLike(value)&&(isArray(value)||typeof value==
"string"||typeof value.splice=="function"||isBuffer(value)||isTypedArray(value)||isArguments(value)))return!value.length;var tag=getTag(value);if(tag==mapTag||tag==setTag)return!value.size;if(isPrototype(value))return!baseKeys(value).length;for(var key in value)if(hasOwnProperty.call(value,key))return false;return true}function isEqual(value,other){return baseIsEqual(value,other)}function isEqualWith(value,other,customizer){customizer=typeof customizer=="function"?customizer:undefined;var result=
customizer?customizer(value,other):undefined;return result===undefined?baseIsEqual(value,other,undefined,customizer):!!result}function isError(value){if(!isObjectLike(value))return false;var tag=baseGetTag(value);return tag==errorTag||tag==domExcTag||typeof value.message=="string"&&typeof value.name=="string"&&!isPlainObject(value)}function isFinite(value){return typeof value=="number"&&nativeIsFinite(value)}function isFunction(value){if(!isObject(value))return false;var tag=baseGetTag(value);return tag==
funcTag||tag==genTag||tag==asyncTag||tag==proxyTag}function isInteger(value){return typeof value=="number"&&value==toInteger(value)}function isLength(value){return typeof value=="number"&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isObject(value){var type=typeof value;return value!=null&&(type=="object"||type=="function")}function isObjectLike(value){return value!=null&&typeof value=="object"}var isMap=nodeIsMap?baseUnary(nodeIsMap):baseIsMap;function isMatch(object,source){return object===
source||baseIsMatch(object,source,getMatchData(source))}function isMatchWith(object,source,customizer){customizer=typeof customizer=="function"?customizer:undefined;return baseIsMatch(object,source,getMatchData(source),customizer)}function isNaN(value){return isNumber(value)&&value!=+value}function isNative(value){if(isMaskable(value))throw new Error(CORE_ERROR_TEXT);return baseIsNative(value)}function isNull(value){return value===null}function isNil(value){return value==null}function isNumber(value){return typeof value==
"number"||isObjectLike(value)&&baseGetTag(value)==numberTag}function isPlainObject(value){if(!isObjectLike(value)||baseGetTag(value)!=objectTag)return false;var proto=getPrototype(value);if(proto===null)return true;var Ctor=hasOwnProperty.call(proto,"constructor")&&proto.constructor;return typeof Ctor=="function"&&Ctor instanceof Ctor&&funcToString.call(Ctor)==objectCtorString}var isRegExp=nodeIsRegExp?baseUnary(nodeIsRegExp):baseIsRegExp;function isSafeInteger(value){return isInteger(value)&&value>=
-MAX_SAFE_INTEGER&&value<=MAX_SAFE_INTEGER}var isSet=nodeIsSet?baseUnary(nodeIsSet):baseIsSet;function isString(value){return typeof value=="string"||!isArray(value)&&isObjectLike(value)&&baseGetTag(value)==stringTag}function isSymbol(value){return typeof value=="symbol"||isObjectLike(value)&&baseGetTag(value)==symbolTag}var isTypedArray=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray;function isUndefined(value){return value===undefined}function isWeakMap(value){return isObjectLike(value)&&
getTag(value)==weakMapTag}function isWeakSet(value){return isObjectLike(value)&&baseGetTag(value)==weakSetTag}var lt=createRelationalOperation(baseLt);var lte=createRelationalOperation(function(value,other){return value<=other});function toArray(value){if(!value)return[];if(isArrayLike(value))return isString(value)?stringToArray(value):copyArray(value);if(symIterator&&value[symIterator])return iteratorToArray(value[symIterator]());var tag=getTag(value),func=tag==mapTag?mapToArray:tag==setTag?setToArray:
values;return func(value)}function toFinite(value){if(!value)return value===0?value:0;value=toNumber(value);if(value===INFINITY||value===-INFINITY){var sign=value<0?-1:1;return sign*MAX_INTEGER}return value===value?value:0}function toInteger(value){var result=toFinite(value),remainder=result%1;return result===result?remainder?result-remainder:result:0}function toLength(value){return value?baseClamp(toInteger(value),0,MAX_ARRAY_LENGTH):0}function toNumber(value){if(typeof value=="number")return value;
if(isSymbol(value))return NAN;if(isObject(value)){var other=typeof value.valueOf=="function"?value.valueOf():value;value=isObject(other)?other+"":other}if(typeof value!="string")return value===0?value:+value;value=value.replace(reTrim,"");var isBinary=reIsBinary.test(value);return isBinary||reIsOctal.test(value)?freeParseInt(value.slice(2),isBinary?2:8):reIsBadHex.test(value)?NAN:+value}function toPlainObject(value){return copyObject(value,keysIn(value))}function toSafeInteger(value){return value?
baseClamp(toInteger(value),-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER):value===0?value:0}function toString(value){return value==null?"":baseToString(value)}var assign=createAssigner(function(object,source){if(isPrototype(source)||isArrayLike(source)){copyObject(source,keys(source),object);return}for(var key in source)if(hasOwnProperty.call(source,key))assignValue(object,key,source[key])});var assignIn=createAssigner(function(object,source){copyObject(source,keysIn(source),object)});var assignInWith=createAssigner(function(object,
source,srcIndex,customizer){copyObject(source,keysIn(source),object,customizer)});var assignWith=createAssigner(function(object,source,srcIndex,customizer){copyObject(source,keys(source),object,customizer)});var at=flatRest(baseAt);function create(prototype,properties){var result=baseCreate(prototype);return properties==null?result:baseAssign(result,properties)}var defaults=baseRest(function(object,sources){object=Object(object);var index=-1;var length=sources.length;var guard=length>2?sources[2]:
undefined;if(guard&&isIterateeCall(sources[0],sources[1],guard))length=1;while(++index<length){var source=sources[index];var props=keysIn(source);var propsIndex=-1;var propsLength=props.length;while(++propsIndex<propsLength){var key=props[propsIndex];var value=object[key];if(value===undefined||eq(value,objectProto[key])&&!hasOwnProperty.call(object,key))object[key]=source[key]}}return object});var defaultsDeep=baseRest(function(args){args.push(undefined,customDefaultsMerge);return apply(mergeWith,
undefined,args)});function findKey(object,predicate){return baseFindKey(object,getIteratee(predicate,3),baseForOwn)}function findLastKey(object,predicate){return baseFindKey(object,getIteratee(predicate,3),baseForOwnRight)}function forIn(object,iteratee){return object==null?object:baseFor(object,getIteratee(iteratee,3),keysIn)}function forInRight(object,iteratee){return object==null?object:baseForRight(object,getIteratee(iteratee,3),keysIn)}function forOwn(object,iteratee){return object&&baseForOwn(object,
getIteratee(iteratee,3))}function forOwnRight(object,iteratee){return object&&baseForOwnRight(object,getIteratee(iteratee,3))}function functions(object){return object==null?[]:baseFunctions(object,keys(object))}function functionsIn(object){return object==null?[]:baseFunctions(object,keysIn(object))}function get(object,path,defaultValue){var result=object==null?undefined:baseGet(object,path);return result===undefined?defaultValue:result}function has(object,path){return object!=null&&hasPath(object,
path,baseHas)}function hasIn(object,path){return object!=null&&hasPath(object,path,baseHasIn)}var invert=createInverter(function(result,value,key){if(value!=null&&typeof value.toString!="function")value=nativeObjectToString.call(value);result[value]=key},constant(identity));var invertBy=createInverter(function(result,value,key){if(value!=null&&typeof value.toString!="function")value=nativeObjectToString.call(value);if(hasOwnProperty.call(result,value))result[value].push(key);else result[value]=[key]},
getIteratee);var invoke=baseRest(baseInvoke);function keys(object){return isArrayLike(object)?arrayLikeKeys(object):baseKeys(object)}function keysIn(object){return isArrayLike(object)?arrayLikeKeys(object,true):baseKeysIn(object)}function mapKeys(object,iteratee){var result={};iteratee=getIteratee(iteratee,3);baseForOwn(object,function(value,key,object){baseAssignValue(result,iteratee(value,key,object),value)});return result}function mapValues(object,iteratee){var result={};iteratee=getIteratee(iteratee,
3);baseForOwn(object,function(value,key,object){baseAssignValue(result,key,iteratee(value,key,object))});return result}var merge=createAssigner(function(object,source,srcIndex){baseMerge(object,source,srcIndex)});var mergeWith=createAssigner(function(object,source,srcIndex,customizer){baseMerge(object,source,srcIndex,customizer)});var omit=flatRest(function(object,paths){var result={};if(object==null)return result;var isDeep=false;paths=arrayMap(paths,function(path){path=castPath(path,object);isDeep||
(isDeep=path.length>1);return path});copyObject(object,getAllKeysIn(object),result);if(isDeep)result=baseClone(result,CLONE_DEEP_FLAG|CLONE_FLAT_FLAG|CLONE_SYMBOLS_FLAG,customOmitClone);var length=paths.length;while(length--)baseUnset(result,paths[length]);return result});function omitBy(object,predicate){return pickBy(object,negate(getIteratee(predicate)))}var pick=flatRest(function(object,paths){return object==null?{}:basePick(object,paths)});function pickBy(object,predicate){if(object==null)return{};
var props=arrayMap(getAllKeysIn(object),function(prop){return[prop]});predicate=getIteratee(predicate);return basePickBy(object,props,function(value,path){return predicate(value,path[0])})}function result(object,path,defaultValue){path=castPath(path,object);var index=-1,length=path.length;if(!length){length=1;object=undefined}while(++index<length){var value=object==null?undefined:object[toKey(path[index])];if(value===undefined){index=length;value=defaultValue}object=isFunction(value)?value.call(object):
value}return object}function set(object,path,value){return object==null?object:baseSet(object,path,value)}function setWith(object,path,value,customizer){customizer=typeof customizer=="function"?customizer:undefined;return object==null?object:baseSet(object,path,value,customizer)}var toPairs=createToPairs(keys);var toPairsIn=createToPairs(keysIn);function transform(object,iteratee,accumulator){var isArr=isArray(object),isArrLike=isArr||isBuffer(object)||isTypedArray(object);iteratee=getIteratee(iteratee,
4);if(accumulator==null){var Ctor=object&&object.constructor;if(isArrLike)accumulator=isArr?new Ctor:[];else if(isObject(object))accumulator=isFunction(Ctor)?baseCreate(getPrototype(object)):{};else accumulator={}}(isArrLike?arrayEach:baseForOwn)(object,function(value,index,object){return iteratee(accumulator,value,index,object)});return accumulator}function unset(object,path){return object==null?true:baseUnset(object,path)}function update(object,path,updater){return object==null?object:baseUpdate(object,
path,castFunction(updater))}function updateWith(object,path,updater,customizer){customizer=typeof customizer=="function"?customizer:undefined;return object==null?object:baseUpdate(object,path,castFunction(updater),customizer)}function values(object){return object==null?[]:baseValues(object,keys(object))}function valuesIn(object){return object==null?[]:baseValues(object,keysIn(object))}function clamp(number,lower,upper){if(upper===undefined){upper=lower;lower=undefined}if(upper!==undefined){upper=
toNumber(upper);upper=upper===upper?upper:0}if(lower!==undefined){lower=toNumber(lower);lower=lower===lower?lower:0}return baseClamp(toNumber(number),lower,upper)}function inRange(number,start,end){start=toFinite(start);if(end===undefined){end=start;start=0}else end=toFinite(end);number=toNumber(number);return baseInRange(number,start,end)}function random(lower,upper,floating){if(floating&&typeof floating!="boolean"&&isIterateeCall(lower,upper,floating))upper=floating=undefined;if(floating===undefined)if(typeof upper==
"boolean"){floating=upper;upper=undefined}else if(typeof lower=="boolean"){floating=lower;lower=undefined}if(lower===undefined&&upper===undefined){lower=0;upper=1}else{lower=toFinite(lower);if(upper===undefined){upper=lower;lower=0}else upper=toFinite(upper)}if(lower>upper){var temp=lower;lower=upper;upper=temp}if(floating||lower%1||upper%1){var rand=nativeRandom();return nativeMin(lower+rand*(upper-lower+freeParseFloat("1e-"+((rand+"").length-1))),upper)}return baseRandom(lower,upper)}var camelCase=
createCompounder(function(result,word,index){word=word.toLowerCase();return result+(index?capitalize(word):word)});function capitalize(string){return upperFirst(toString(string).toLowerCase())}function deburr(string){string=toString(string);return string&&string.replace(reLatin,deburrLetter).replace(reComboMark,"")}function endsWith(string,target,position){string=toString(string);target=baseToString(target);var length=string.length;position=position===undefined?length:baseClamp(toInteger(position),
0,length);var end=position;position-=target.length;return position>=0&&string.slice(position,end)==target}function escape(string){string=toString(string);return string&&reHasUnescapedHtml.test(string)?string.replace(reUnescapedHtml,escapeHtmlChar):string}function escapeRegExp(string){string=toString(string);return string&&reHasRegExpChar.test(string)?string.replace(reRegExpChar,"\\$\x26"):string}var kebabCase=createCompounder(function(result,word,index){return result+(index?"-":"")+word.toLowerCase()});
var lowerCase=createCompounder(function(result,word,index){return result+(index?" ":"")+word.toLowerCase()});var lowerFirst=createCaseFirst("toLowerCase");function pad(string,length,chars){string=toString(string);length=toInteger(length);var strLength=length?stringSize(string):0;if(!length||strLength>=length)return string;var mid=(length-strLength)/2;return createPadding(nativeFloor(mid),chars)+string+createPadding(nativeCeil(mid),chars)}function padEnd(string,length,chars){string=toString(string);
length=toInteger(length);var strLength=length?stringSize(string):0;return length&&strLength<length?string+createPadding(length-strLength,chars):string}function padStart(string,length,chars){string=toString(string);length=toInteger(length);var strLength=length?stringSize(string):0;return length&&strLength<length?createPadding(length-strLength,chars)+string:string}function parseInt(string,radix,guard){if(guard||radix==null)radix=0;else if(radix)radix=+radix;return nativeParseInt(toString(string).replace(reTrimStart,
""),radix||0)}function repeat(string,n,guard){if(guard?isIterateeCall(string,n,guard):n===undefined)n=1;else n=toInteger(n);return baseRepeat(toString(string),n)}function replace(){var args=arguments,string=toString(args[0]);return args.length<3?string:string.replace(args[1],args[2])}var snakeCase=createCompounder(function(result,word,index){return result+(index?"_":"")+word.toLowerCase()});function split(string,separator,limit){if(limit&&typeof limit!="number"&&isIterateeCall(string,separator,limit))separator=
limit=undefined;limit=limit===undefined?MAX_ARRAY_LENGTH:limit>>>0;if(!limit)return[];string=toString(string);if(string&&(typeof separator=="string"||separator!=null&&!isRegExp(separator))){separator=baseToString(separator);if(!separator&&hasUnicode(string))return castSlice(stringToArray(string),0,limit)}return string.split(separator,limit)}var startCase=createCompounder(function(result,word,index){return result+(index?" ":"")+upperFirst(word)});function startsWith(string,target,position){string=
toString(string);position=position==null?0:baseClamp(toInteger(position),0,string.length);target=baseToString(target);return string.slice(position,position+target.length)==target}function template(string,options,guard){var settings=lodash.templateSettings;if(guard&&isIterateeCall(string,options,guard))options=undefined;string=toString(string);options=assignInWith({},options,settings,customDefaultsAssignIn);var imports=assignInWith({},options.imports,settings.imports,customDefaultsAssignIn),importsKeys=
keys(imports),importsValues=baseValues(imports,importsKeys);var isEscaping,isEvaluating,index=0,interpolate=options.interpolate||reNoMatch,source="__p +\x3d '";var reDelimiters=RegExp((options.escape||reNoMatch).source+"|"+interpolate.source+"|"+(interpolate===reInterpolate?reEsTemplate:reNoMatch).source+"|"+(options.evaluate||reNoMatch).source+"|$","g");var sourceURL="//# sourceURL\x3d"+("sourceURL"in options?options.sourceURL:"lodash.templateSources["+ ++templateCounter+"]")+"\n";string.replace(reDelimiters,
function(match,escapeValue,interpolateValue,esTemplateValue,evaluateValue,offset){interpolateValue||(interpolateValue=esTemplateValue);source+=string.slice(index,offset).replace(reUnescapedString,escapeStringChar);if(escapeValue){isEscaping=true;source+="' +\n__e("+escapeValue+") +\n'"}if(evaluateValue){isEvaluating=true;source+="';\n"+evaluateValue+";\n__p +\x3d '"}if(interpolateValue)source+="' +\n((__t \x3d ("+interpolateValue+")) \x3d\x3d null ? '' : __t) +\n'";index=offset+match.length;return match});
source+="';\n";var variable=options.variable;if(!variable)source="with (obj) {\n"+source+"\n}\n";source=(isEvaluating?source.replace(reEmptyStringLeading,""):source).replace(reEmptyStringMiddle,"$1").replace(reEmptyStringTrailing,"$1;");source="function("+(variable||"obj")+") {\n"+(variable?"":"obj || (obj \x3d {});\n")+"var __t, __p \x3d ''"+(isEscaping?", __e \x3d _.escape":"")+(isEvaluating?", __j \x3d Array.prototype.join;\n"+"function print() { __p +\x3d __j.call(arguments, '') }\n":";\n")+source+
"return __p\n}";var result=attempt(function(){return Function(importsKeys,sourceURL+"return "+source).apply(undefined,importsValues)});result.source=source;if(isError(result))throw result;return result}function toLower(value){return toString(value).toLowerCase()}function toUpper(value){return toString(value).toUpperCase()}function trim(string,chars,guard){string=toString(string);if(string&&(guard||chars===undefined))return string.replace(reTrim,"");if(!string||!(chars=baseToString(chars)))return string;
var strSymbols=stringToArray(string),chrSymbols=stringToArray(chars),start=charsStartIndex(strSymbols,chrSymbols),end=charsEndIndex(strSymbols,chrSymbols)+1;return castSlice(strSymbols,start,end).join("")}function trimEnd(string,chars,guard){string=toString(string);if(string&&(guard||chars===undefined))return string.replace(reTrimEnd,"");if(!string||!(chars=baseToString(chars)))return string;var strSymbols=stringToArray(string),end=charsEndIndex(strSymbols,stringToArray(chars))+1;return castSlice(strSymbols,
0,end).join("")}function trimStart(string,chars,guard){string=toString(string);if(string&&(guard||chars===undefined))return string.replace(reTrimStart,"");if(!string||!(chars=baseToString(chars)))return string;var strSymbols=stringToArray(string),start=charsStartIndex(strSymbols,stringToArray(chars));return castSlice(strSymbols,start).join("")}function truncate(string,options){var length=DEFAULT_TRUNC_LENGTH,omission=DEFAULT_TRUNC_OMISSION;if(isObject(options)){var separator="separator"in options?
options.separator:separator;length="length"in options?toInteger(options.length):length;omission="omission"in options?baseToString(options.omission):omission}string=toString(string);var strLength=string.length;if(hasUnicode(string)){var strSymbols=stringToArray(string);strLength=strSymbols.length}if(length>=strLength)return string;var end=length-stringSize(omission);if(end<1)return omission;var result=strSymbols?castSlice(strSymbols,0,end).join(""):string.slice(0,end);if(separator===undefined)return result+
omission;if(strSymbols)end+=result.length-end;if(isRegExp(separator)){if(string.slice(end).search(separator)){var match,substring=result;if(!separator.global)separator=RegExp(separator.source,toString(reFlags.exec(separator))+"g");separator.lastIndex=0;while(match=separator.exec(substring))var newEnd=match.index;result=result.slice(0,newEnd===undefined?end:newEnd)}}else if(string.indexOf(baseToString(separator),end)!=end){var index=result.lastIndexOf(separator);if(index>-1)result=result.slice(0,index)}return result+
omission}function unescape(string){string=toString(string);return string&&reHasEscapedHtml.test(string)?string.replace(reEscapedHtml,unescapeHtmlChar):string}var upperCase=createCompounder(function(result,word,index){return result+(index?" ":"")+word.toUpperCase()});var upperFirst=createCaseFirst("toUpperCase");function words(string,pattern,guard){string=toString(string);pattern=guard?undefined:pattern;if(pattern===undefined)return hasUnicodeWord(string)?unicodeWords(string):asciiWords(string);return string.match(pattern)||
[]}var attempt=baseRest(function(func,args){try{return apply(func,undefined,args)}catch(e){return isError(e)?e:new Error(e)}});var bindAll=flatRest(function(object,methodNames){arrayEach(methodNames,function(key){key=toKey(key);baseAssignValue(object,key,bind(object[key],object))});return object});function cond(pairs){var length=pairs==null?0:pairs.length,toIteratee=getIteratee();pairs=!length?[]:arrayMap(pairs,function(pair){if(typeof pair[1]!="function")throw new TypeError(FUNC_ERROR_TEXT);return[toIteratee(pair[0]),
pair[1]]});return baseRest(function(args){var index=-1;while(++index<length){var pair=pairs[index];if(apply(pair[0],this,args))return apply(pair[1],this,args)}})}function conforms(source){return baseConforms(baseClone(source,CLONE_DEEP_FLAG))}function constant(value){return function(){return value}}function defaultTo(value,defaultValue){return value==null||value!==value?defaultValue:value}var flow=createFlow();var flowRight=createFlow(true);function identity(value){return value}function iteratee(func){return baseIteratee(typeof func==
"function"?func:baseClone(func,CLONE_DEEP_FLAG))}function matches(source){return baseMatches(baseClone(source,CLONE_DEEP_FLAG))}function matchesProperty(path,srcValue){return baseMatchesProperty(path,baseClone(srcValue,CLONE_DEEP_FLAG))}var method=baseRest(function(path,args){return function(object){return baseInvoke(object,path,args)}});var methodOf=baseRest(function(object,args){return function(path){return baseInvoke(object,path,args)}});function mixin(object,source,options){var props=keys(source),
methodNames=baseFunctions(source,props);if(options==null&&!(isObject(source)&&(methodNames.length||!props.length))){options=source;source=object;object=this;methodNames=baseFunctions(source,keys(source))}var chain=!(isObject(options)&&"chain"in options)||!!options.chain,isFunc=isFunction(object);arrayEach(methodNames,function(methodName){var func=source[methodName];object[methodName]=func;if(isFunc)object.prototype[methodName]=function(){var chainAll=this.__chain__;if(chain||chainAll){var result=
object(this.__wrapped__),actions=result.__actions__=copyArray(this.__actions__);actions.push({"func":func,"args":arguments,"thisArg":object});result.__chain__=chainAll;return result}return func.apply(object,arrayPush([this.value()],arguments))}});return object}function noConflict(){if(root._===this)root._=oldDash;return this}function noop(){}function nthArg(n){n=toInteger(n);return baseRest(function(args){return baseNth(args,n)})}var over=createOver(arrayMap);var overEvery=createOver(arrayEvery);
var overSome=createOver(arraySome);function property(path){return isKey(path)?baseProperty(toKey(path)):basePropertyDeep(path)}function propertyOf(object){return function(path){return object==null?undefined:baseGet(object,path)}}var range=createRange();var rangeRight=createRange(true);function stubArray(){return[]}function stubFalse(){return false}function stubObject(){return{}}function stubString(){return""}function stubTrue(){return true}function times(n,iteratee){n=toInteger(n);if(n<1||n>MAX_SAFE_INTEGER)return[];
var index=MAX_ARRAY_LENGTH,length=nativeMin(n,MAX_ARRAY_LENGTH);iteratee=getIteratee(iteratee);n-=MAX_ARRAY_LENGTH;var result=baseTimes(length,iteratee);while(++index<n)iteratee(index);return result}function toPath(value){if(isArray(value))return arrayMap(value,toKey);return isSymbol(value)?[value]:copyArray(stringToPath(toString(value)))}function uniqueId(prefix){var id=++idCounter;return toString(prefix)+id}var add=createMathOperation(function(augend,addend){return augend+addend},0);var ceil=createRound("ceil");
var divide=createMathOperation(function(dividend,divisor){return dividend/divisor},1);var floor=createRound("floor");function max(array){return array&&array.length?baseExtremum(array,identity,baseGt):undefined}function maxBy(array,iteratee){return array&&array.length?baseExtremum(array,getIteratee(iteratee,2),baseGt):undefined}function mean(array){return baseMean(array,identity)}function meanBy(array,iteratee){return baseMean(array,getIteratee(iteratee,2))}function min(array){return array&&array.length?
baseExtremum(array,identity,baseLt):undefined}function minBy(array,iteratee){return array&&array.length?baseExtremum(array,getIteratee(iteratee,2),baseLt):undefined}var multiply=createMathOperation(function(multiplier,multiplicand){return multiplier*multiplicand},1);var round=createRound("round");var subtract=createMathOperation(function(minuend,subtrahend){return minuend-subtrahend},0);function sum(array){return array&&array.length?baseSum(array,identity):0}function sumBy(array,iteratee){return array&&
array.length?baseSum(array,getIteratee(iteratee,2)):0}lodash.after=after;lodash.ary=ary;lodash.assign=assign;lodash.assignIn=assignIn;lodash.assignInWith=assignInWith;lodash.assignWith=assignWith;lodash.at=at;lodash.before=before;lodash.bind=bind;lodash.bindAll=bindAll;lodash.bindKey=bindKey;lodash.castArray=castArray;lodash.chain=chain;lodash.chunk=chunk;lodash.compact=compact;lodash.concat=concat;lodash.cond=cond;lodash.conforms=conforms;lodash.constant=constant;lodash.countBy=countBy;lodash.create=
create;lodash.curry=curry;lodash.curryRight=curryRight;lodash.debounce=debounce;lodash.defaults=defaults;lodash.defaultsDeep=defaultsDeep;lodash.defer=defer;lodash.delay=delay;lodash.difference=difference;lodash.differenceBy=differenceBy;lodash.differenceWith=differenceWith;lodash.drop=drop;lodash.dropRight=dropRight;lodash.dropRightWhile=dropRightWhile;lodash.dropWhile=dropWhile;lodash.fill=fill;lodash.filter=filter;lodash.flatMap=flatMap;lodash.flatMapDeep=flatMapDeep;lodash.flatMapDepth=flatMapDepth;
lodash.flatten=flatten;lodash.flattenDeep=flattenDeep;lodash.flattenDepth=flattenDepth;lodash.flip=flip;lodash.flow=flow;lodash.flowRight=flowRight;lodash.fromPairs=fromPairs;lodash.functions=functions;lodash.functionsIn=functionsIn;lodash.groupBy=groupBy;lodash.initial=initial;lodash.intersection=intersection;lodash.intersectionBy=intersectionBy;lodash.intersectionWith=intersectionWith;lodash.invert=invert;lodash.invertBy=invertBy;lodash.invokeMap=invokeMap;lodash.iteratee=iteratee;lodash.keyBy=
keyBy;lodash.keys=keys;lodash.keysIn=keysIn;lodash.map=map;lodash.mapKeys=mapKeys;lodash.mapValues=mapValues;lodash.matches=matches;lodash.matchesProperty=matchesProperty;lodash.memoize=memoize;lodash.merge=merge;lodash.mergeWith=mergeWith;lodash.method=method;lodash.methodOf=methodOf;lodash.mixin=mixin;lodash.negate=negate;lodash.nthArg=nthArg;lodash.omit=omit;lodash.omitBy=omitBy;lodash.once=once;lodash.orderBy=orderBy;lodash.over=over;lodash.overArgs=overArgs;lodash.overEvery=overEvery;lodash.overSome=
overSome;lodash.partial=partial;lodash.partialRight=partialRight;lodash.partition=partition;lodash.pick=pick;lodash.pickBy=pickBy;lodash.property=property;lodash.propertyOf=propertyOf;lodash.pull=pull;lodash.pullAll=pullAll;lodash.pullAllBy=pullAllBy;lodash.pullAllWith=pullAllWith;lodash.pullAt=pullAt;lodash.range=range;lodash.rangeRight=rangeRight;lodash.rearg=rearg;lodash.reject=reject;lodash.remove=remove;lodash.rest=rest;lodash.reverse=reverse;lodash.sampleSize=sampleSize;lodash.set=set;lodash.setWith=
setWith;lodash.shuffle=shuffle;lodash.slice=slice;lodash.sortBy=sortBy;lodash.sortedUniq=sortedUniq;lodash.sortedUniqBy=sortedUniqBy;lodash.split=split;lodash.spread=spread;lodash.tail=tail;lodash.take=take;lodash.takeRight=takeRight;lodash.takeRightWhile=takeRightWhile;lodash.takeWhile=takeWhile;lodash.tap=tap;lodash.throttle=throttle;lodash.thru=thru;lodash.toArray=toArray;lodash.toPairs=toPairs;lodash.toPairsIn=toPairsIn;lodash.toPath=toPath;lodash.toPlainObject=toPlainObject;lodash.transform=
transform;lodash.unary=unary;lodash.union=union;lodash.unionBy=unionBy;lodash.unionWith=unionWith;lodash.uniq=uniq;lodash.uniqBy=uniqBy;lodash.uniqWith=uniqWith;lodash.unset=unset;lodash.unzip=unzip;lodash.unzipWith=unzipWith;lodash.update=update;lodash.updateWith=updateWith;lodash.values=values;lodash.valuesIn=valuesIn;lodash.without=without;lodash.words=words;lodash.wrap=wrap;lodash.xor=xor;lodash.xorBy=xorBy;lodash.xorWith=xorWith;lodash.zip=zip;lodash.zipObject=zipObject;lodash.zipObjectDeep=
zipObjectDeep;lodash.zipWith=zipWith;lodash.entries=toPairs;lodash.entriesIn=toPairsIn;lodash.extend=assignIn;lodash.extendWith=assignInWith;mixin(lodash,lodash);lodash.add=add;lodash.attempt=attempt;lodash.camelCase=camelCase;lodash.capitalize=capitalize;lodash.ceil=ceil;lodash.clamp=clamp;lodash.clone=clone;lodash.cloneDeep=cloneDeep;lodash.cloneDeepWith=cloneDeepWith;lodash.cloneWith=cloneWith;lodash.conformsTo=conformsTo;lodash.deburr=deburr;lodash.defaultTo=defaultTo;lodash.divide=divide;lodash.endsWith=
endsWith;lodash.eq=eq;lodash.escape=escape;lodash.escapeRegExp=escapeRegExp;lodash.every=every;lodash.find=find;lodash.findIndex=findIndex;lodash.findKey=findKey;lodash.findLast=findLast;lodash.findLastIndex=findLastIndex;lodash.findLastKey=findLastKey;lodash.floor=floor;lodash.forEach=forEach;lodash.forEachRight=forEachRight;lodash.forIn=forIn;lodash.forInRight=forInRight;lodash.forOwn=forOwn;lodash.forOwnRight=forOwnRight;lodash.get=get;lodash.gt=gt;lodash.gte=gte;lodash.has=has;lodash.hasIn=hasIn;
lodash.head=head;lodash.identity=identity;lodash.includes=includes;lodash.indexOf=indexOf;lodash.inRange=inRange;lodash.invoke=invoke;lodash.isArguments=isArguments;lodash.isArray=isArray;lodash.isArrayBuffer=isArrayBuffer;lodash.isArrayLike=isArrayLike;lodash.isArrayLikeObject=isArrayLikeObject;lodash.isBoolean=isBoolean;lodash.isBuffer=isBuffer;lodash.isDate=isDate;lodash.isElement=isElement;lodash.isEmpty=isEmpty;lodash.isEqual=isEqual;lodash.isEqualWith=isEqualWith;lodash.isError=isError;lodash.isFinite=
isFinite;lodash.isFunction=isFunction;lodash.isInteger=isInteger;lodash.isLength=isLength;lodash.isMap=isMap;lodash.isMatch=isMatch;lodash.isMatchWith=isMatchWith;lodash.isNaN=isNaN;lodash.isNative=isNative;lodash.isNil=isNil;lodash.isNull=isNull;lodash.isNumber=isNumber;lodash.isObject=isObject;lodash.isObjectLike=isObjectLike;lodash.isPlainObject=isPlainObject;lodash.isRegExp=isRegExp;lodash.isSafeInteger=isSafeInteger;lodash.isSet=isSet;lodash.isString=isString;lodash.isSymbol=isSymbol;lodash.isTypedArray=
isTypedArray;lodash.isUndefined=isUndefined;lodash.isWeakMap=isWeakMap;lodash.isWeakSet=isWeakSet;lodash.join=join;lodash.kebabCase=kebabCase;lodash.last=last;lodash.lastIndexOf=lastIndexOf;lodash.lowerCase=lowerCase;lodash.lowerFirst=lowerFirst;lodash.lt=lt;lodash.lte=lte;lodash.max=max;lodash.maxBy=maxBy;lodash.mean=mean;lodash.meanBy=meanBy;lodash.min=min;lodash.minBy=minBy;lodash.stubArray=stubArray;lodash.stubFalse=stubFalse;lodash.stubObject=stubObject;lodash.stubString=stubString;lodash.stubTrue=
stubTrue;lodash.multiply=multiply;lodash.nth=nth;lodash.noConflict=noConflict;lodash.noop=noop;lodash.now=now;lodash.pad=pad;lodash.padEnd=padEnd;lodash.padStart=padStart;lodash.parseInt=parseInt;lodash.random=random;lodash.reduce=reduce;lodash.reduceRight=reduceRight;lodash.repeat=repeat;lodash.replace=replace;lodash.result=result;lodash.round=round;lodash.runInContext=runInContext;lodash.sample=sample;lodash.size=size;lodash.snakeCase=snakeCase;lodash.some=some;lodash.sortedIndex=sortedIndex;lodash.sortedIndexBy=
sortedIndexBy;lodash.sortedIndexOf=sortedIndexOf;lodash.sortedLastIndex=sortedLastIndex;lodash.sortedLastIndexBy=sortedLastIndexBy;lodash.sortedLastIndexOf=sortedLastIndexOf;lodash.startCase=startCase;lodash.startsWith=startsWith;lodash.subtract=subtract;lodash.sum=sum;lodash.sumBy=sumBy;lodash.template=template;lodash.times=times;lodash.toFinite=toFinite;lodash.toInteger=toInteger;lodash.toLength=toLength;lodash.toLower=toLower;lodash.toNumber=toNumber;lodash.toSafeInteger=toSafeInteger;lodash.toString=
toString;lodash.toUpper=toUpper;lodash.trim=trim;lodash.trimEnd=trimEnd;lodash.trimStart=trimStart;lodash.truncate=truncate;lodash.unescape=unescape;lodash.uniqueId=uniqueId;lodash.upperCase=upperCase;lodash.upperFirst=upperFirst;lodash.each=forEach;lodash.eachRight=forEachRight;lodash.first=head;mixin(lodash,function(){var source={};baseForOwn(lodash,function(func,methodName){if(!hasOwnProperty.call(lodash.prototype,methodName))source[methodName]=func});return source}(),{"chain":false});lodash.VERSION=
VERSION;arrayEach(["bind","bindKey","curry","curryRight","partial","partialRight"],function(methodName){lodash[methodName].placeholder=lodash});arrayEach(["drop","take"],function(methodName,index){LazyWrapper.prototype[methodName]=function(n){n=n===undefined?1:nativeMax(toInteger(n),0);var result=this.__filtered__&&!index?new LazyWrapper(this):this.clone();if(result.__filtered__)result.__takeCount__=nativeMin(n,result.__takeCount__);else result.__views__.push({"size":nativeMin(n,MAX_ARRAY_LENGTH),
"type":methodName+(result.__dir__<0?"Right":"")});return result};LazyWrapper.prototype[methodName+"Right"]=function(n){return this.reverse()[methodName](n).reverse()}});arrayEach(["filter","map","takeWhile"],function(methodName,index){var type=index+1,isFilter=type==LAZY_FILTER_FLAG||type==LAZY_WHILE_FLAG;LazyWrapper.prototype[methodName]=function(iteratee){var result=this.clone();result.__iteratees__.push({"iteratee":getIteratee(iteratee,3),"type":type});result.__filtered__=result.__filtered__||
isFilter;return result}});arrayEach(["head","last"],function(methodName,index){var takeName="take"+(index?"Right":"");LazyWrapper.prototype[methodName]=function(){return this[takeName](1).value()[0]}});arrayEach(["initial","tail"],function(methodName,index){var dropName="drop"+(index?"":"Right");LazyWrapper.prototype[methodName]=function(){return this.__filtered__?new LazyWrapper(this):this[dropName](1)}});LazyWrapper.prototype.compact=function(){return this.filter(identity)};LazyWrapper.prototype.find=
function(predicate){return this.filter(predicate).head()};LazyWrapper.prototype.findLast=function(predicate){return this.reverse().find(predicate)};LazyWrapper.prototype.invokeMap=baseRest(function(path,args){if(typeof path=="function")return new LazyWrapper(this);return this.map(function(value){return baseInvoke(value,path,args)})});LazyWrapper.prototype.reject=function(predicate){return this.filter(negate(getIteratee(predicate)))};LazyWrapper.prototype.slice=function(start,end){start=toInteger(start);
var result=this;if(result.__filtered__&&(start>0||end<0))return new LazyWrapper(result);if(start<0)result=result.takeRight(-start);else if(start)result=result.drop(start);if(end!==undefined){end=toInteger(end);result=end<0?result.dropRight(-end):result.take(end-start)}return result};LazyWrapper.prototype.takeRightWhile=function(predicate){return this.reverse().takeWhile(predicate).reverse()};LazyWrapper.prototype.toArray=function(){return this.take(MAX_ARRAY_LENGTH)};baseForOwn(LazyWrapper.prototype,
function(func,methodName){var checkIteratee=/^(?:filter|find|map|reject)|While$/.test(methodName),isTaker=/^(?:head|last)$/.test(methodName),lodashFunc=lodash[isTaker?"take"+(methodName=="last"?"Right":""):methodName],retUnwrapped=isTaker||/^find/.test(methodName);if(!lodashFunc)return;lodash.prototype[methodName]=function(){var value=this.__wrapped__,args=isTaker?[1]:arguments,isLazy=value instanceof LazyWrapper,iteratee=args[0],useLazy=isLazy||isArray(value);var interceptor=function(value){var result=
lodashFunc.apply(lodash,arrayPush([value],args));return isTaker&&chainAll?result[0]:result};if(useLazy&&checkIteratee&&typeof iteratee=="function"&&iteratee.length!=1)isLazy=useLazy=false;var chainAll=this.__chain__,isHybrid=!!this.__actions__.length,isUnwrapped=retUnwrapped&&!chainAll,onlyLazy=isLazy&&!isHybrid;if(!retUnwrapped&&useLazy){value=onlyLazy?value:new LazyWrapper(this);var result=func.apply(value,args);result.__actions__.push({"func":thru,"args":[interceptor],"thisArg":undefined});return new LodashWrapper(result,
chainAll)}if(isUnwrapped&&onlyLazy)return func.apply(this,args);result=this.thru(interceptor);return isUnwrapped?isTaker?result.value()[0]:result.value():result}});arrayEach(["pop","push","shift","sort","splice","unshift"],function(methodName){var func=arrayProto[methodName],chainName=/^(?:push|sort|unshift)$/.test(methodName)?"tap":"thru",retUnwrapped=/^(?:pop|shift)$/.test(methodName);lodash.prototype[methodName]=function(){var args=arguments;if(retUnwrapped&&!this.__chain__){var value=this.value();
return func.apply(isArray(value)?value:[],args)}return this[chainName](function(value){return func.apply(isArray(value)?value:[],args)})}});baseForOwn(LazyWrapper.prototype,function(func,methodName){var lodashFunc=lodash[methodName];if(lodashFunc){var key=lodashFunc.name+"",names=realNames[key]||(realNames[key]=[]);names.push({"name":methodName,"func":lodashFunc})}});realNames[createHybrid(undefined,WRAP_BIND_KEY_FLAG).name]=[{"name":"wrapper","func":undefined}];LazyWrapper.prototype.clone=lazyClone;
LazyWrapper.prototype.reverse=lazyReverse;LazyWrapper.prototype.value=lazyValue;lodash.prototype.at=wrapperAt;lodash.prototype.chain=wrapperChain;lodash.prototype.commit=wrapperCommit;lodash.prototype.next=wrapperNext;lodash.prototype.plant=wrapperPlant;lodash.prototype.reverse=wrapperReverse;lodash.prototype.toJSON=lodash.prototype.valueOf=lodash.prototype.value=wrapperValue;lodash.prototype.first=lodash.prototype.head;if(symIterator)lodash.prototype[symIterator]=wrapperToIterator;return lodash};
var _=runInContext();if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){root._=_;define(function(){return _})}else if(freeModule){(freeModule.exports=_)._=_;freeExports._=_}else root._=_}).call(this);
//# sourceURL=build://vz-sorting/sorting.js
var Da;
(function(e){function r(p,v){let z;(function(t){t[t.NATURAL=0]="NATURAL";t[t.REAL=1]="REAL";t[t.EXPONENT_SIGN=2]="EXPONENT_SIGN";t[t.EXPONENT=3]="EXPONENT"})(z||(z={}));let E=z.NATURAL;for(;v<p.length;v++)if(E===z.NATURAL)if("."===p[v])E=z.REAL;else if("e"===p[v]||"E"===p[v])E=z.EXPONENT_SIGN;else{if(!k(p[v]))break}else if(E===z.REAL)if("e"===p[v]||"E"===p[v])E=z.EXPONENT_SIGN;else{if(!k(p[v]))break}else if(E===z.EXPONENT_SIGN)if(k(p[v])||"+"===p[v]||"-"===p[v])E=z.EXPONENT;else break;else if(E===z.EXPONENT&&
!k(p[v]))break;return v}function k(p){return"0"<=p&&"9">=p}function n(p){return"/"===p||"_"===p||k(p)}e.compareTagNames=function(p,v){let z=0,E=0;for(;;){if(z===p.length)return E===v.length?0:-1;if(E===v.length)return 1;if(k(p[z])&&k(v[E])){var t=z,x=E;z=r(p,z+1);E=r(v,E+1);t=parseFloat(p.slice(t,z));x=parseFloat(v.slice(x,E));if(t<x)return-1;if(t>x)return 1}else{if(n(p[z])){if(!n(v[E]))return-1}else{if(n(v[E]))return 1;if(p[z]<v[E])return-1;if(p[z]>v[E])return 1}z++;E++}}}})(Da||(Da={}));

//# sourceURL=build://tf-backend/requestManager.js
var Ab;
(function(e){function r(A,F,N,I){const aa=new XMLHttpRequest;aa.open(A,F);N&&(aa.withCredentials=N);I&&aa.setRequestHeader("Content-Type",I);return aa}function k(A){const F=new t;if(!A)return F.methodType=E.GET,F;F.methodType=E.POST;F.body=n(A);return F}function n(A){const F=new FormData;for(let N in A)N&&F.append(N,A[N]);return F}class p extends Error{constructor(){super(...arguments);this.name="RequestCancellationError"}}e.RequestCancellationError=p;class v extends Error{constructor(A){super(A);this.name=
"InvalidRequestOptionsError";Object.setPrototypeOf(this,v.prototype)}}e.InvalidRequestOptionsError=v;class z extends Error{constructor(A,F){super();this.message=`RequestNetworkError: ${A.status} at ${F}`;this.name="RequestNetworkError";this.req=A;this.url=F}}e.RequestNetworkError=z;let E;(function(A){A.GET="GET";A.POST="POST"})(E=e.HttpMethodType||(e.HttpMethodType={}));class t{validate(){if(this.methodType===E.GET&&this.body)throw new v("body must be missing for a GET request.");}}e.RequestOptions=
t;class x{constructor(A=1E3,F=3){this._queue=[];this._nActiveRequests=0;this._nSimultaneousRequests=A;this._maxRetries=F}request(A,F){F=k(F);return this.requestWithOptions(A,F)}requestWithOptions(A,F){F.validate();return(new Promise((N,I)=>{this._queue.push({resolve:N,reject:I});this.launchRequests()})).then(()=>this.promiseWithRetries(A,this._maxRetries,F)).then(N=>{this._nActiveRequests--;this.launchRequests();return N},N=>{"RequestNetworkError"===N.name&&(this._nActiveRequests--,this.launchRequests());
return Promise.reject(N)})}fetch(A,F){return(new Promise((N,I)=>{this._queue.push({resolve:N,reject:I});this.launchRequests()})).then(()=>{let N=1;return new Promise(I=>{const aa=()=>{fetch(A,F).then(G=>{!G.ok&&this._maxRetries>N?(N++,aa()):(I(G),this._nActiveRequests--,this.launchRequests())})};aa()})})}clearQueue(){for(;0<this._queue.length;)this._queue.pop().reject(new p("Request cancelled by clearQueue"))}activeRequests(){return this._nActiveRequests}outstandingRequests(){return this._nActiveRequests+
this._queue.length}launchRequests(){for(;this._nActiveRequests<this._nSimultaneousRequests&&0<this._queue.length;)this._nActiveRequests++,this._queue.pop().resolve()}promiseWithRetries(A,F,N){return this._promiseFromUrl(A,N).then(I=>I,I=>0<F?this.promiseWithRetries(A,F-1,N):Promise.reject(I))}_promiseFromUrl(A,F){return new Promise((N,I)=>{const aa=r(F.methodType,A,F.withCredentials,F.contentType);aa.onload=function(){200===aa.status?N(JSON.parse(aa.responseText)):I(new z(aa,A))};aa.onerror=function(){I(new z(aa,
A))};F.body?aa.send(F.body):aa.send()})}}e.RequestManager=x})(Ab||(Ab={}));

//# sourceURL=build://tf-backend/urlPathHelpers.js
(function(e){function r(k){return encodeURIComponent(k).replace(/\(/g,"%28").replace(/\)/g,"%29")}e.addParams=function(k,n){var p=Object.keys(n).sort().filter(z=>void 0!==n[z]);if(!p.length)return k;const v=-1!==k.indexOf("?")?"\x26":"?";p=[].concat(...p.map(z=>{const E=n[z];return(Array.isArray(E)?E:[E]).map(t=>`${z}=${r(t)}`)})).join("\x26");return k+v+p}})(Ab||(Ab={}));

//# sourceURL=build://tf-backend/router.js
(function(e){function r(v="data",z=new URLSearchParams(window.location.search)){"/"===v[v.length-1]&&(v=v.slice(0,v.length-1));return{environment:()=>k(v,"/environment"),experiments:()=>k(v,"/experiments"),pluginRoute:(E,t,x)=>k(v+"/plugin",`/${E}${t}`,x),pluginsListing:()=>k(v,"/plugins_listing",n({["experimentalPlugin"]:z.getAll("experimentalPlugin")})),runs:()=>k(v,"/runs"),runsForExperiment:E=>k(v,"/experiment_runs",n({experiment:String(E)}))}}function k(v,z,E=new URLSearchParams){v+=z;String(E)&&
(z=z.includes("?")?"\x26":"?",v+=z+String(E));return v}function n(v={}){const z=Object.keys(v).sort().filter(t=>v[t]),E=new URLSearchParams;z.forEach(t=>{const x=v[t];(Array.isArray(x)?x:[x]).forEach(A=>E.append(t,A))});return E}let p=r();e.createRouter=r;e.getRouter=function(){return p};e.setRouter=function(v){if(null==v)throw Error("Router required, but got: "+v);p=v};e.createSearchParam=n})(Ab||(Ab={}));

//# sourceURL=build://tf-backend/baseStore.js
(function(e){class r{constructor(n){this.listener=n}}e.ListenKey=r;class k{constructor(){this.requestManager=new e.RequestManager(1);this._listeners=new Set;this.initialized=!1}refresh(){return this.load().then(()=>{this.initialized=!0})}addListener(n){n=new r(n);this._listeners.add(n);return n}removeListenerByKey(n){this._listeners.delete(n)}emitChange(){this._listeners.forEach(n=>{try{n.listener()}catch(p){}})}}e.BaseStore=k})(Ab||(Ab={}));

//# sourceURL=build://tf-backend/environmentStore.js
(function(e){class r extends e.BaseStore{load(){const k=e.getRouter().environment();return this.requestManager.request(k).then(n=>{const p={dataLocation:n.data_location,windowTitle:n.window_title};void 0!==n.experiment_name&&(p.experimentName=n.experiment_name);void 0!==n.experiment_description&&(p.experimentDescription=n.experiment_description);void 0!==n.creation_time&&(p.creationTime=n.creation_time);_.isEqual(this.environment,p)||(this.environment=p,this.emitChange())})}getDataLocation(){return this.environment?
this.environment.dataLocation:""}getWindowTitle(){return this.environment?this.environment.windowTitle:""}getExperimentName(){return this.environment?this.environment.experimentName:""}getExperimentDescription(){return this.environment?this.environment.experimentDescription:""}getCreationTime(){return this.environment?this.environment.creationTime:null}}e.EnvironmentStore=r;e.environmentStore=new r})(Ab||(Ab={}));

//# sourceURL=build://tf-backend/experimentsStore.js
(function(e){class r extends e.BaseStore{constructor(){super(...arguments);this._experiments=[]}load(){const k=e.getRouter().experiments();return this.requestManager.request(k).then(n=>{_.isEqual(this._experiments,n)||(this._experiments=n,this.emitChange())})}getExperiments(){return this._experiments.slice()}}e.ExperimentsStore=r;e.experimentsStore=new r})(Ab||(Ab={}));

//# sourceURL=build://tf-backend/runsStore.js
(function(e){class r extends e.BaseStore{constructor(){super(...arguments);this._runs=[]}load(){const k=e.getRouter().runs();return this.requestManager.request(k).then(n=>{_.isEqual(this._runs,n)||(this._runs=n,this.emitChange())})}getRuns(){return this._runs.slice()}}e.RunsStore=r;e.runsStore=new r})(Ab||(Ab={}));

//# sourceURL=build://tf-backend/backend.js
(function(e){e.TYPES=[];e.getRunsNamed=function(r){return _.keys(r).sort(Da.compareTagNames)};e.getTags=function(r){return _.union.apply(null,_.values(r)).sort(Da.compareTagNames)};e.filterTags=function(r,k){let n=[];k.forEach(p=>n=n.concat(r[p]));return _.uniq(n).sort(Da.compareTagNames)}})(Ab||(Ab={}));

//# sourceURL=build://tf-backend/canceller.js
(function(e){class r{constructor(){this.cancellationCount=0}cancellable(k){const n=this.cancellationCount;return p=>k({value:p,cancelled:this.cancellationCount!==n})}cancelAll(){this.cancellationCount++}}e.Canceller=r})(Ab||(Ab={}));

//# sourceURL=build://tf-backend/tf-backend-polymer.js
(function(e){Polymer({is:"tf-backend",_template:null,tf_backend:e})})(Ab||(Ab={}));

//# sourceURL=build://tf-dashboard-common/tf-no-data-warning.html.js
Polymer({is:"tf-no-data-warning",properties:{dataType:String,showWarning:Boolean}});

//# sourceURL=build://tf-tensorboard/registry.js
var af;
(function(e){(function(r){r.NOT_LOADED="NOT_LOADED";r.LOADED="LOADED";r.FAILED="FAILED"})(e.ActiveDashboardsLoadState||(e.ActiveDashboardsLoadState={}));e.dashboardRegistry={};e.registerDashboard=function(r){if(!r.plugin)throw Error("Dashboard.plugin must be present");if(!r.elementName)throw Error("Dashboard.elementName must be present");if(r.plugin in e.dashboardRegistry)throw Error(`Plugin already registered: ${r.plugin}`);r.tabName||(r.tabName=r.plugin);e.dashboardRegistry[r.plugin]=r}})(af||(af=
{}));

//# sourceURL=build://iron-resizable-behavior/iron-resizable-behavior.html.js
Polymer.IronResizableBehavior={properties:{_parentResizable:{type:Object,observer:"_parentResizableChanged"},_notifyingDescendant:{type:Boolean,value:!1}},listeners:{"iron-request-resize-notifications":"_onIronRequestResizeNotifications"},created:function(){this._interestedResizables=[];this._boundNotifyResize=this.notifyResize.bind(this)},attached:function(){this._requestResizeNotifications()},detached:function(){this._parentResizable?this._parentResizable.stopResizeNotificationsFor(this):window.removeEventListener("resize",
this._boundNotifyResize);this._parentResizable=null},notifyResize:function(){this.isAttached&&(this._interestedResizables.forEach(function(e){this.resizerShouldNotify(e)&&this._notifyDescendant(e)},this),this._fireResize())},assignParentResizable:function(e){this._parentResizable=e},stopResizeNotificationsFor:function(e){var r=this._interestedResizables.indexOf(e);-1<r&&(this._interestedResizables.splice(r,1),this.unlisten(e,"iron-resize","_onDescendantIronResize"))},resizerShouldNotify:function(){return!0},
_onDescendantIronResize:function(e){this._notifyingDescendant?e.stopPropagation():Polymer.Settings.useShadow||this._fireResize()},_fireResize:function(){this.fire("iron-resize",null,{node:this,bubbles:!1})},_onIronRequestResizeNotifications:function(e){var r=Polymer.dom(e).rootTarget;r!==this&&(-1===this._interestedResizables.indexOf(r)&&(this._interestedResizables.push(r),this.listen(r,"iron-resize","_onDescendantIronResize")),r.assignParentResizable(this),this._notifyDescendant(r),e.stopPropagation())},
_parentResizableChanged:function(e){e&&window.removeEventListener("resize",this._boundNotifyResize)},_notifyDescendant:function(e){this.isAttached&&(this._notifyingDescendant=!0,e.notifyResize(),this._notifyingDescendant=!1)},_requestResizeNotifications:function(){if(this.isAttached)if("loading"===document.readyState){var e=this._requestResizeNotifications.bind(this);document.addEventListener("readystatechange",function k(){document.removeEventListener("readystatechange",k);e()})}else this.fire("iron-request-resize-notifications",
null,{node:this,bubbles:!0,cancelable:!0}),this._parentResizable||(window.addEventListener("resize",this._boundNotifyResize),this.notifyResize())}};

//# sourceURL=build://iron-collapse/iron-collapse.html.js
Polymer({is:"iron-collapse",behaviors:[Polymer.IronResizableBehavior],properties:{horizontal:{type:Boolean,value:!1,observer:"_horizontalChanged"},opened:{type:Boolean,value:!1,notify:!0,observer:"_openedChanged"},transitioning:{type:Boolean,notify:!0,readOnly:!0},noAnimation:{type:Boolean},_desiredSize:{type:String,value:""}},get dimension(){return this.horizontal?"width":"height"},get _dimensionMax(){return this.horizontal?"maxWidth":"maxHeight"},get _dimensionMaxCss(){return this.horizontal?"max-width":
"max-height"},hostAttributes:{role:"group","aria-hidden":"true"},listeners:{transitionend:"_onTransitionEnd"},toggle:function(){this.opened=!this.opened},show:function(){this.opened=!0},hide:function(){this.opened=!1},updateSize:function(e,r){e="auto"===e?"":e;r=r&&!this.noAnimation&&this.isAttached&&this._desiredSize!==e;this._desiredSize=e;this._updateTransition(!1);r&&(r=this._calcSize(),""===e&&(this.style[this._dimensionMax]="",e=this._calcSize()),this.style[this._dimensionMax]=r,this.scrollTop=
this.scrollTop,this._updateTransition(!0),r=e!==r);this.style[this._dimensionMax]=e;r||this._transitionEnd()},enableTransition:function(e){Polymer.Base._warn("`enableTransition()` is deprecated, use `noAnimation` instead.");this.noAnimation=!e},_updateTransition:function(e){this.style.transitionDuration=e&&!this.noAnimation?"":"0s"},_horizontalChanged:function(){this.style.transitionProperty=this._dimensionMaxCss;this.style["maxWidth"===this._dimensionMax?"maxHeight":"maxWidth"]="";this.updateSize(this.opened?
"auto":"0px",!1)},_openedChanged:function(){this.setAttribute("aria-hidden",!this.opened);this._setTransitioning(!0);this.toggleClass("iron-collapse-closed",!1);this.toggleClass("iron-collapse-opened",!1);this.updateSize(this.opened?"auto":"0px",!0);this.opened&&this.focus()},_transitionEnd:function(){this.style[this._dimensionMax]=this._desiredSize;this.toggleClass("iron-collapse-closed",!this.opened);this.toggleClass("iron-collapse-opened",this.opened);this._updateTransition(!1);this.notifyResize();
this._setTransitioning(!1)},_onTransitionEnd:function(e){Polymer.dom(e).rootTarget===this&&this._transitionEnd()},_calcSize:function(){return this.getBoundingClientRect()[this.dimension]+"px"}});

//# sourceURL=build://iron-meta/iron-meta.html.js
(function(){Polymer.IronMeta=function(r){Polymer.IronMeta[" "](r);this.type=r&&r.type||"default";this.key=r&&r.key;r&&"value"in r&&(this.value=r.value)};Polymer.IronMeta[" "]=function(){};Polymer.IronMeta.types={};Polymer.IronMeta.prototype={get value(){var r=this.type,k=this.key;if(r&&k)return Polymer.IronMeta.types[r]&&Polymer.IronMeta.types[r][k]},set value(r){var k=this.type,n=this.key;k&&n&&(k=Polymer.IronMeta.types[k]=Polymer.IronMeta.types[k]||{},null==r?delete k[n]:k[n]=r)},get list(){if(this.type){var r=
Polymer.IronMeta.types[this.type];return r?Object.keys(r).map(function(k){return e[this.type][k]},this):[]}},byKey:function(r){this.key=r;return this.value}};var e=Polymer.IronMeta.types;Polymer({is:"iron-meta",properties:{type:{type:String,value:"default"},key:{type:String},value:{type:String,notify:!0},self:{type:Boolean,observer:"_selfChanged"},__meta:{type:Boolean,computed:"__computeMeta(type, key, value)"}},hostAttributes:{hidden:!0},__computeMeta:function(r,k,n){r=new Polymer.IronMeta({type:r,
key:k});void 0!==n&&n!==r.value?r.value=n:this.value!==r.value&&(this.value=r.value);return r},get list(){return this.__meta&&this.__meta.list},_selfChanged:function(r){r&&(this.value=this)},byKey:function(r){return(new Polymer.IronMeta({type:this.type,key:r})).value}})})();

//# sourceURL=build://iron-flex-layout/iron-flex-layout.html.js
(function(){var e=document.createElement("style");e.textContent="[hidden] { display: none !important; }";document.head.appendChild(e)})();

//# sourceURL=build://iron-icon/iron-icon.html.js
Polymer({is:"iron-icon",properties:{icon:{type:String},theme:{type:String},src:{type:String},_meta:{value:Polymer.Base.create("iron-meta",{type:"iconset"})}},observers:["_updateIcon(_meta, isAttached)","_updateIcon(theme, isAttached)","_srcChanged(src, isAttached)","_iconChanged(icon, isAttached)"],_DEFAULT_ICONSET:"icons",_iconChanged:function(e){e=(e||"").split(":");this._iconName=e.pop();this._iconsetName=e.pop()||this._DEFAULT_ICONSET;this._updateIcon()},_srcChanged:function(){this._updateIcon()},
_usesIconset:function(){return this.icon||!this.src},_updateIcon:function(){this._usesIconset()?(this._img&&this._img.parentNode&&Polymer.dom(this.root).removeChild(this._img),""===this._iconName?this._iconset&&this._iconset.removeIcon(this):this._iconsetName&&this._meta&&((this._iconset=this._meta.byKey(this._iconsetName))?(this._iconset.applyIcon(this,this._iconName,this.theme),this.unlisten(window,"iron-iconset-added","_updateIcon")):this.listen(window,"iron-iconset-added","_updateIcon"))):(this._iconset&&
this._iconset.removeIcon(this),this._img||(this._img=document.createElement("img"),this._img.style.width="100%",this._img.style.height="100%",this._img.draggable=!1),this._img.src=this.src,Polymer.dom(this.root).appendChild(this._img))}});

//# sourceURL=build://iron-iconset-svg/iron-iconset-svg.html.js
Polymer({is:"iron-iconset-svg",properties:{name:{type:String,observer:"_nameChanged"},size:{type:Number,value:24},rtlMirroring:{type:Boolean,value:!1},useGlobalRtlAttribute:{type:Boolean,value:!1}},created:function(){this._meta=new Polymer.IronMeta({type:"iconset",key:null,value:null})},attached:function(){this.style.display="none"},getIconNames:function(){this._icons=this._createIconMap();return Object.keys(this._icons).map(function(e){return this.name+":"+e},this)},applyIcon:function(e,r){this.removeIcon(e);
if(r=this._cloneIcon(r,this.rtlMirroring&&this._targetIsRTL(e))){var k=Polymer.dom(e.root||e);k.insertBefore(r,k.childNodes[0]);return e._svgIcon=r}return null},removeIcon:function(e){e._svgIcon&&(Polymer.dom(e.root||e).removeChild(e._svgIcon),e._svgIcon=null)},_targetIsRTL:function(e){null==this.__targetIsRTL&&(this.useGlobalRtlAttribute?this.__targetIsRTL="rtl"===(document.body&&document.body.hasAttribute("dir")?document.body:document.documentElement).getAttribute("dir"):(e&&e.nodeType!==Node.ELEMENT_NODE&&
(e=e.host),this.__targetIsRTL=e&&"rtl"===window.getComputedStyle(e).direction));return this.__targetIsRTL},_nameChanged:function(){this._meta.value=null;this._meta.key=this.name;this._meta.value=this;this.async(function(){this.fire("iron-iconset-added",this,{node:window})})},_createIconMap:function(){var e=Object.create(null);Polymer.dom(this).querySelectorAll("[id]").forEach(function(r){e[r.id]=r});return e},_cloneIcon:function(e,r){this._icons=this._icons||this._createIconMap();return this._prepareSvgClone(this._icons[e],
this.size,r)},_prepareSvgClone:function(e,r,k){if(e){e=e.cloneNode(!0);var n=document.createElementNS("http://www.w3.org/2000/svg","svg");r=e.getAttribute("viewBox")||"0 0 "+r+" "+r;var p="pointer-events: none; display: block; width: 100%; height: 100%;";k&&e.hasAttribute("mirror-in-rtl")&&(p+="-webkit-transform:scale(-1,1);transform:scale(-1,1);transform-origin:center;");n.setAttribute("viewBox",r);n.setAttribute("preserveAspectRatio","xMidYMid meet");n.setAttribute("focusable","false");n.style.cssText=
p;n.appendChild(e).removeAttribute("id");return n}return null}});

//# sourceURL=build://iron-a11y-keys-behavior/iron-a11y-keys-behavior.html.js
(function(){function e(G,P){var U="";if(G)if(G=G.toLowerCase()," "===G||I.test(G))U="space";else if(aa.test(G))U="esc";else if(1==G.length){if(!P||A.test(G))U=G}else U=N.test(G)?G.replace("arrow",""):"multiply"==G?"*":G;return U}function r(G){var P="";G&&(G in E?P=E[G]:F.test(G)?(G=parseInt(G.replace("U+","0x"),16),P=String.fromCharCode(G).toLowerCase()):P=G.toLowerCase());return P}function k(G){var P="";Number(G)&&(P=65<=G&&90>=G?String.fromCharCode(32+G):112<=G&&123>=G?"f"+(G-112+1):48<=G&&57>=
G?String(G-48):96<=G&&105>=G?String(G-96):t[G]);return P}function n(G,P){return G.key?e(G.key,P):G.detail&&G.detail.key?e(G.detail.key,P):r(G.keyIdentifier)||k(G.keyCode)||""}function p(G,P){return n(P,G.hasModifiers)===G.key&&(!G.hasModifiers||!!P.shiftKey===!!G.shiftKey&&!!P.ctrlKey===!!G.ctrlKey&&!!P.altKey===!!G.altKey&&!!P.metaKey===!!G.metaKey)}function v(G){return 1===G.length?{combo:G,key:G,event:"keydown"}:G.split("+").reduce(function(P,U){var ba=U.split(":");U=ba[0];ba=ba[1];U in x?(P[x[U]]=
!0,P.hasModifiers=!0):(P.key=U,P.event=ba||"keydown");return P},{combo:G.split(":").shift()})}function z(G){return G.trim().split(" ").map(function(P){return v(P)})}var E={"U+0008":"backspace","U+0009":"tab","U+001B":"esc","U+0020":"space","U+007F":"del"},t={8:"backspace",9:"tab",13:"enter",27:"esc",33:"pageup",34:"pagedown",35:"end",36:"home",32:"space",37:"left",38:"up",39:"right",40:"down",46:"del",106:"*"},x={shift:"shiftKey",ctrl:"ctrlKey",alt:"altKey",meta:"metaKey"},A=/[a-z0-9*]/,F=/U\+/,N=
/^arrow/,I=/^space(bar)?/,aa=/^escape$/;Polymer.IronA11yKeysBehavior={properties:{keyEventTarget:{type:Object,value:function(){return this}},stopKeyboardEventPropagation:{type:Boolean,value:!1},_boundKeyHandlers:{type:Array,value:function(){return[]}},_imperativeKeyBindings:{type:Object,value:function(){return{}}}},observers:["_resetKeyEventListeners(keyEventTarget, _boundKeyHandlers)"],keyBindings:{},registered:function(){this._prepKeyBindings()},attached:function(){this._listenKeyEventListeners()},
detached:function(){this._unlistenKeyEventListeners()},addOwnKeyBinding:function(G,P){this._imperativeKeyBindings[G]=P;this._prepKeyBindings();this._resetKeyEventListeners()},removeOwnKeyBindings:function(){this._imperativeKeyBindings={};this._prepKeyBindings();this._resetKeyEventListeners()},keyboardEventMatchesKeys:function(G,P){P=z(P);for(var U=0;U<P.length;++U)if(p(P[U],G))return!0;return!1},_collectKeyBindings:function(){var G=this.behaviors.map(function(P){return P.keyBindings});-1===G.indexOf(this.keyBindings)&&
G.push(this.keyBindings);return G},_prepKeyBindings:function(){this._keyBindings={};this._collectKeyBindings().forEach(function(U){for(var ba in U)this._addKeyBinding(ba,U[ba])},this);for(var G in this._imperativeKeyBindings)this._addKeyBinding(G,this._imperativeKeyBindings[G]);for(var P in this._keyBindings)this._keyBindings[P].sort(function(U,ba){U=U[0].hasModifiers;return U===ba[0].hasModifiers?0:U?-1:1})},_addKeyBinding:function(G,P){z(G).forEach(function(U){this._keyBindings[U.event]=this._keyBindings[U.event]||
[];this._keyBindings[U.event].push([U,P])},this)},_resetKeyEventListeners:function(){this._unlistenKeyEventListeners();this.isAttached&&this._listenKeyEventListeners()},_listenKeyEventListeners:function(){this.keyEventTarget&&Object.keys(this._keyBindings).forEach(function(G){var P=this._onKeyBindingEvent.bind(this,this._keyBindings[G]);this._boundKeyHandlers.push([this.keyEventTarget,G,P]);this.keyEventTarget.addEventListener(G,P)},this)},_unlistenKeyEventListeners:function(){for(var G,P,U;this._boundKeyHandlers.length;)G=
this._boundKeyHandlers.pop(),P=G[0],U=G[1],G=G[2],P.removeEventListener(U,G)},_onKeyBindingEvent:function(G,P){this.stopKeyboardEventPropagation&&P.stopPropagation();if(!P.defaultPrevented)for(var U=0;U<G.length;U++){var ba=G[U][0],ja=G[U][1];if(p(ba,P)&&(this._triggerKeyHandler(ba,ja,P),P.defaultPrevented))break}},_triggerKeyHandler:function(G,P,U){var ba=Object.create(G);ba.keyboardEvent=U;G=new CustomEvent(G.event,{detail:ba,cancelable:!0});this[P].call(this,G);G.defaultPrevented&&U.preventDefault()}}})();

//# sourceURL=build://iron-behaviors/iron-control-state.html.js
Polymer.IronControlState={properties:{focused:{type:Boolean,value:!1,notify:!0,readOnly:!0,reflectToAttribute:!0},disabled:{type:Boolean,value:!1,notify:!0,observer:"_disabledChanged",reflectToAttribute:!0},_oldTabIndex:{type:String},_boundFocusBlurHandler:{type:Function,value:function(){return this._focusBlurHandler.bind(this)}},__handleEventRetargeting:{type:Boolean,value:function(){return!this.shadowRoot&&!Polymer.Element}}},observers:["_changedControlState(focused, disabled)"],ready:function(){this.addEventListener("focus",
this._boundFocusBlurHandler,!0);this.addEventListener("blur",this._boundFocusBlurHandler,!0)},_focusBlurHandler:function(e){if(Polymer.Element)this._setFocused("focus"===e.type);else if(e.target===this)this._setFocused("focus"===e.type);else if(this.__handleEventRetargeting){var r=Polymer.dom(e).localTarget;this.isLightDescendant(r)||this.fire(e.type,{sourceEvent:e},{node:this,bubbles:e.bubbles,cancelable:e.cancelable})}},_disabledChanged:function(e){this.setAttribute("aria-disabled",e?"true":"false");
this.style.pointerEvents=e?"none":"";e?(this._oldTabIndex=this.getAttribute("tabindex"),this._setFocused(!1),this.tabIndex=-1,this.blur()):void 0!==this._oldTabIndex&&(null===this._oldTabIndex?this.removeAttribute("tabindex"):this.setAttribute("tabindex",this._oldTabIndex))},_changedControlState:function(){this._controlStateChanged&&this._controlStateChanged()}};

//# sourceURL=build://iron-behaviors/iron-button-state.html.js
Polymer.IronButtonStateImpl={properties:{pressed:{type:Boolean,readOnly:!0,value:!1,reflectToAttribute:!0,observer:"_pressedChanged"},toggles:{type:Boolean,value:!1,reflectToAttribute:!0},active:{type:Boolean,value:!1,notify:!0,reflectToAttribute:!0},pointerDown:{type:Boolean,readOnly:!0,value:!1},receivedFocusFromKeyboard:{type:Boolean,readOnly:!0},ariaActiveAttribute:{type:String,value:"aria-pressed",observer:"_ariaActiveAttributeChanged"}},listeners:{down:"_downHandler",up:"_upHandler",tap:"_tapHandler"},
observers:["_focusChanged(focused)","_activeChanged(active, ariaActiveAttribute)"],keyBindings:{"enter:keydown":"_asyncClick","space:keydown":"_spaceKeyDownHandler","space:keyup":"_spaceKeyUpHandler"},_mouseEventRe:/^mouse/,_tapHandler:function(){this.toggles?this._userActivate(!this.active):this.active=!1},_focusChanged:function(e){this._detectKeyboardFocus(e);e||this._setPressed(!1)},_detectKeyboardFocus:function(e){this._setReceivedFocusFromKeyboard(!this.pointerDown&&e)},_userActivate:function(e){this.active!==
e&&(this.active=e,this.fire("change"))},_downHandler:function(){this._setPointerDown(!0);this._setPressed(!0);this._setReceivedFocusFromKeyboard(!1)},_upHandler:function(){this._setPointerDown(!1);this._setPressed(!1)},_spaceKeyDownHandler:function(e){e=e.detail.keyboardEvent;var r=Polymer.dom(e).localTarget;this.isLightDescendant(r)||(e.preventDefault(),e.stopImmediatePropagation(),this._setPressed(!0))},_spaceKeyUpHandler:function(e){e=Polymer.dom(e.detail.keyboardEvent).localTarget;this.isLightDescendant(e)||
(this.pressed&&this._asyncClick(),this._setPressed(!1))},_asyncClick:function(){this.async(function(){this.click()},1)},_pressedChanged:function(){this._changedButtonState()},_ariaActiveAttributeChanged:function(e,r){r&&r!=e&&this.hasAttribute(r)&&this.removeAttribute(r)},_activeChanged:function(e){this.toggles?this.setAttribute(this.ariaActiveAttribute,e?"true":"false"):this.removeAttribute(this.ariaActiveAttribute);this._changedButtonState()},_controlStateChanged:function(){this.disabled?this._setPressed(!1):
this._changedButtonState()},_changedButtonState:function(){this._buttonStateChanged&&this._buttonStateChanged()}};Polymer.IronButtonState=[Polymer.IronA11yKeysBehavior,Polymer.IronButtonStateImpl];

//# sourceURL=build://paper-ripple/paper-ripple.html.js
(function(){function e(n){this.element=n;this.width=this.boundingRect.width;this.height=this.boundingRect.height;this.size=Math.max(this.width,this.height)}function r(n){this.element=n;this.color=window.getComputedStyle(n).color;this.wave=document.createElement("div");this.waveContainer=document.createElement("div");this.wave.style.backgroundColor=this.color;this.wave.classList.add("wave");this.waveContainer.classList.add("wave-container");Polymer.dom(this.waveContainer).appendChild(this.wave);this.resetInteractionState()}
var k={distance:function(n,p,v,z){n-=v;p-=z;return Math.sqrt(n*n+p*p)},now:window.performance&&window.performance.now?window.performance.now.bind(window.performance):Date.now};e.prototype={get boundingRect(){return this.element.getBoundingClientRect()},furthestCornerDistanceFrom:function(n,p){var v=k.distance(n,p,0,0),z=k.distance(n,p,this.width,0),E=k.distance(n,p,0,this.height);n=k.distance(n,p,this.width,this.height);return Math.max(v,z,E,n)}};r.MAX_RADIUS=300;r.prototype={get recenters(){return this.element.recenters},
get center(){return this.element.center},get mouseDownElapsed(){if(!this.mouseDownStart)return 0;var n=k.now()-this.mouseDownStart;this.mouseUpStart&&(n-=this.mouseUpElapsed);return n},get mouseUpElapsed(){return this.mouseUpStart?k.now()-this.mouseUpStart:0},get mouseDownElapsedSeconds(){return this.mouseDownElapsed/1E3},get mouseUpElapsedSeconds(){return this.mouseUpElapsed/1E3},get mouseInteractionSeconds(){return this.mouseDownElapsedSeconds+this.mouseUpElapsedSeconds},get initialOpacity(){return this.element.initialOpacity},
get opacityDecayVelocity(){return this.element.opacityDecayVelocity},get radius(){var n=1.1*Math.min(Math.sqrt(this.containerMetrics.width*this.containerMetrics.width+this.containerMetrics.height*this.containerMetrics.height),r.MAX_RADIUS)+5;return Math.abs(n*(1-Math.pow(80,-(this.mouseInteractionSeconds/(1.1-n/r.MAX_RADIUS*.2)))))},get opacity(){return this.mouseUpStart?Math.max(0,this.initialOpacity-this.mouseUpElapsedSeconds*this.opacityDecayVelocity):this.initialOpacity},get outerOpacity(){return Math.max(0,
Math.min(.3*this.mouseUpElapsedSeconds,this.opacity))},get isOpacityFullyDecayed(){return.01>this.opacity&&this.radius>=Math.min(this.maxRadius,r.MAX_RADIUS)},get isRestingAtMaxRadius(){return this.opacity>=this.initialOpacity&&this.radius>=Math.min(this.maxRadius,r.MAX_RADIUS)},get isAnimationComplete(){return this.mouseUpStart?this.isOpacityFullyDecayed:this.isRestingAtMaxRadius},get translationFraction(){return Math.min(1,this.radius/this.containerMetrics.size*2/Math.sqrt(2))},get xNow(){return this.xEnd?
this.xStart+this.translationFraction*(this.xEnd-this.xStart):this.xStart},get yNow(){return this.yEnd?this.yStart+this.translationFraction*(this.yEnd-this.yStart):this.yStart},get isMouseDown(){return this.mouseDownStart&&!this.mouseUpStart},resetInteractionState:function(){this.slideDistance=this.yEnd=this.xEnd=this.yStart=this.xStart=this.mouseUpStart=this.mouseDownStart=this.maxRadius=0;this.containerMetrics=new e(this.element)},draw:function(){this.wave.style.opacity=this.opacity;var n=this.radius/
(this.containerMetrics.size/2);var p=this.xNow-this.containerMetrics.width/2;var v=this.yNow-this.containerMetrics.height/2;this.waveContainer.style.webkitTransform="translate("+p+"px, "+v+"px)";this.waveContainer.style.transform="translate3d("+p+"px, "+v+"px, 0)";this.wave.style.webkitTransform="scale("+n+","+n+")";this.wave.style.transform="scale3d("+n+","+n+",1)"},downAction:function(n){var p=this.containerMetrics.width/2,v=this.containerMetrics.height/2;this.resetInteractionState();this.mouseDownStart=
k.now();this.center?(this.xStart=p,this.yStart=v,this.slideDistance=k.distance(this.xStart,this.yStart,this.xEnd,this.yEnd)):(this.xStart=n?n.detail.x-this.containerMetrics.boundingRect.left:this.containerMetrics.width/2,this.yStart=n?n.detail.y-this.containerMetrics.boundingRect.top:this.containerMetrics.height/2);this.recenters&&(this.xEnd=p,this.yEnd=v,this.slideDistance=k.distance(this.xStart,this.yStart,this.xEnd,this.yEnd));this.maxRadius=this.containerMetrics.furthestCornerDistanceFrom(this.xStart,
this.yStart);this.waveContainer.style.top=(this.containerMetrics.height-this.containerMetrics.size)/2+"px";this.waveContainer.style.left=(this.containerMetrics.width-this.containerMetrics.size)/2+"px";this.waveContainer.style.width=this.containerMetrics.size+"px";this.waveContainer.style.height=this.containerMetrics.size+"px"},upAction:function(){this.isMouseDown&&(this.mouseUpStart=k.now())},remove:function(){Polymer.dom(this.waveContainer.parentNode).removeChild(this.waveContainer)}};Polymer({is:"paper-ripple",
behaviors:[Polymer.IronA11yKeysBehavior],properties:{initialOpacity:{type:Number,value:.25},opacityDecayVelocity:{type:Number,value:.8},recenters:{type:Boolean,value:!1},center:{type:Boolean,value:!1},ripples:{type:Array,value:function(){return[]}},animating:{type:Boolean,readOnly:!0,reflectToAttribute:!0,value:!1},holdDown:{type:Boolean,value:!1,observer:"_holdDownChanged"},noink:{type:Boolean,value:!1},_animating:{type:Boolean},_boundAnimate:{type:Function,value:function(){return this.animate.bind(this)}}},
get target(){return this.keyEventTarget},keyBindings:{"enter:keydown":"_onEnterKeydown","space:keydown":"_onSpaceKeydown","space:keyup":"_onSpaceKeyup"},attached:function(){var n=this.keyEventTarget=11==this.parentNode.nodeType?Polymer.dom(this).getOwnerRoot().host:this.parentNode;this.listen(n,"up","uiUpAction");this.listen(n,"down","uiDownAction")},detached:function(){this.unlisten(this.keyEventTarget,"up","uiUpAction");this.unlisten(this.keyEventTarget,"down","uiDownAction");this.keyEventTarget=
null},get shouldKeepAnimating(){for(var n=0;n<this.ripples.length;++n)if(!this.ripples[n].isAnimationComplete)return!0;return!1},simulatedRipple:function(){this.downAction(null);this.async(function(){this.upAction()},1)},uiDownAction:function(n){this.noink||this.downAction(n)},downAction:function(n){this.holdDown&&0<this.ripples.length||(this.addRipple().downAction(n),this._animating||(this._animating=!0,this.animate()))},uiUpAction:function(n){this.noink||this.upAction(n)},upAction:function(n){this.holdDown||
(this.ripples.forEach(function(p){p.upAction(n)}),this._animating=!0,this.animate())},onAnimationComplete:function(){this._animating=!1;this.$.background.style.backgroundColor=null;this.fire("transitionend")},addRipple:function(){var n=new r(this);Polymer.dom(this.$.waves).appendChild(n.waveContainer);this.$.background.style.backgroundColor=n.color;this.ripples.push(n);this._setAnimating(!0);return n},removeRipple:function(n){var p=this.ripples.indexOf(n);0>p||(this.ripples.splice(p,1),n.remove(),
this.ripples.length||this._setAnimating(!1))},animate:function(){if(this._animating){var n;for(n=0;n<this.ripples.length;++n){var p=this.ripples[n];p.draw();this.$.background.style.opacity=p.outerOpacity;p.isOpacityFullyDecayed&&!p.isRestingAtMaxRadius&&this.removeRipple(p)}if(this.shouldKeepAnimating||0!==this.ripples.length)window.requestAnimationFrame(this._boundAnimate);else this.onAnimationComplete()}},_onEnterKeydown:function(){this.uiDownAction();this.async(this.uiUpAction,1)},_onSpaceKeydown:function(){this.uiDownAction()},
_onSpaceKeyup:function(){this.uiUpAction()},_holdDownChanged:function(n,p){void 0!==p&&(n?this.downAction():this.upAction())}})})();

//# sourceURL=build://paper-behaviors/paper-ripple-behavior.html.js
Polymer.PaperRippleBehavior={properties:{noink:{type:Boolean,observer:"_noinkChanged"},_rippleContainer:{type:Object}},_buttonStateChanged:function(){this.focused&&this.ensureRipple()},_downHandler:function(e){Polymer.IronButtonStateImpl._downHandler.call(this,e);this.pressed&&this.ensureRipple(e)},ensureRipple:function(e){if(!this.hasRipple()){this._ripple=this._createRipple();this._ripple.noink=this.noink;var r=this._rippleContainer||this.root;r&&Polymer.dom(r).appendChild(this._ripple);if(e){r=
Polymer.dom(this._rippleContainer||this);var k=Polymer.dom(e).rootTarget;r.deepContains(k)&&this._ripple.uiDownAction(e)}}},getRipple:function(){this.ensureRipple();return this._ripple},hasRipple:function(){return!!this._ripple},_createRipple:function(){return document.createElement("paper-ripple")},_noinkChanged:function(e){this.hasRipple()&&(this._ripple.noink=e)}};

//# sourceURL=build://paper-behaviors/paper-button-behavior.html.js
Polymer.PaperButtonBehaviorImpl={properties:{elevation:{type:Number,reflectToAttribute:!0,readOnly:!0}},observers:["_calculateElevation(focused, disabled, active, pressed, receivedFocusFromKeyboard)","_computeKeyboardClass(receivedFocusFromKeyboard)"],hostAttributes:{role:"button",tabindex:"0",animated:!0},_calculateElevation:function(){var e=1;this.disabled?e=0:this.active||this.pressed?e=4:this.receivedFocusFromKeyboard&&(e=3);this._setElevation(e)},_computeKeyboardClass:function(e){this.toggleClass("keyboard-focus",
e)},_spaceKeyDownHandler:function(e){Polymer.IronButtonStateImpl._spaceKeyDownHandler.call(this,e);this.hasRipple()&&1>this.getRipple().ripples.length&&this._ripple.uiDownAction()},_spaceKeyUpHandler:function(e){Polymer.IronButtonStateImpl._spaceKeyUpHandler.call(this,e);this.hasRipple()&&this._ripple.uiUpAction()}};Polymer.PaperButtonBehavior=[Polymer.IronButtonState,Polymer.IronControlState,Polymer.PaperRippleBehavior,Polymer.PaperButtonBehaviorImpl];

//# sourceURL=build://paper-button/paper-button.html.js
Polymer({is:"paper-button",behaviors:[Polymer.PaperButtonBehavior],properties:{raised:{type:Boolean,reflectToAttribute:!0,value:!1,observer:"_calculateElevation"}},_calculateElevation:function(){this.raised?Polymer.PaperButtonBehaviorImpl._calculateElevation.apply(this):this._setElevation(0)}});

//# sourceURL=build://iron-validatable-behavior/iron-validatable-behavior.html.js
Polymer.IronValidatableBehaviorMeta=null;
Polymer.IronValidatableBehavior={properties:{validator:{type:String},invalid:{notify:!0,reflectToAttribute:!0,type:Boolean,value:!1,observer:"_invalidChanged"}},registered:function(){Polymer.IronValidatableBehaviorMeta=new Polymer.IronMeta({type:"validator"})},_invalidChanged:function(){this.invalid?this.setAttribute("aria-invalid","true"):this.removeAttribute("aria-invalid")},get _validator(){return Polymer.IronValidatableBehaviorMeta&&Polymer.IronValidatableBehaviorMeta.byKey(this.validator)},hasValidator:function(){return null!=
this._validator},validate:function(e){this.invalid=void 0===e&&void 0!==this.value?!this._getValidity(this.value):!this._getValidity(e);return!this.invalid},_getValidity:function(e){return this.hasValidator()?this._validator.validate(e):!0}};

//# sourceURL=build://iron-form-element-behavior/iron-form-element-behavior.html.js
Polymer.IronFormElementBehavior={properties:{name:{type:String},value:{notify:!0,type:String},required:{type:Boolean,value:!1},_parentForm:{type:Object}},attached:function(){Polymer.Element||this.fire("iron-form-element-register")},detached:function(){!Polymer.Element&&this._parentForm&&this._parentForm.fire("iron-form-element-unregister",{target:this})}};

//# sourceURL=build://iron-checked-element-behavior/iron-checked-element-behavior.html.js
Polymer.IronCheckedElementBehaviorImpl={properties:{checked:{type:Boolean,value:!1,reflectToAttribute:!0,notify:!0,observer:"_checkedChanged"},toggles:{type:Boolean,value:!0,reflectToAttribute:!0},value:{type:String,value:"on",observer:"_valueChanged"}},observers:["_requiredChanged(required)"],created:function(){this._hasIronCheckedElementBehavior=!0},_getValidity:function(){return this.disabled||!this.required||this.checked},_requiredChanged:function(){this.required?this.setAttribute("aria-required",
"true"):this.removeAttribute("aria-required")},_checkedChanged:function(){this.active=this.checked;this.fire("iron-change")},_valueChanged:function(){if(void 0===this.value||null===this.value)this.value="on"}};Polymer.IronCheckedElementBehavior=[Polymer.IronFormElementBehavior,Polymer.IronValidatableBehavior,Polymer.IronCheckedElementBehaviorImpl];

//# sourceURL=build://paper-behaviors/paper-inky-focus-behavior.html.js
Polymer.PaperInkyFocusBehaviorImpl={observers:["_focusedChanged(receivedFocusFromKeyboard)"],_focusedChanged:function(e){e&&this.ensureRipple();this.hasRipple()&&(this._ripple.holdDown=e)},_createRipple:function(){var e=Polymer.PaperRippleBehavior._createRipple();e.id="ink";e.setAttribute("center","");e.classList.add("circle");return e}};Polymer.PaperInkyFocusBehavior=[Polymer.IronButtonState,Polymer.IronControlState,Polymer.PaperRippleBehavior,Polymer.PaperInkyFocusBehaviorImpl];

//# sourceURL=build://paper-behaviors/paper-checked-element-behavior.html.js
Polymer.PaperCheckedElementBehaviorImpl={_checkedChanged:function(){Polymer.IronCheckedElementBehaviorImpl._checkedChanged.call(this);this.hasRipple()&&(this.checked?this._ripple.setAttribute("checked",""):this._ripple.removeAttribute("checked"))},_buttonStateChanged:function(){Polymer.PaperRippleBehavior._buttonStateChanged.call(this);!this.disabled&&this.isAttached&&(this.checked=this.active)}};
Polymer.PaperCheckedElementBehavior=[Polymer.PaperInkyFocusBehavior,Polymer.IronCheckedElementBehavior,Polymer.PaperCheckedElementBehaviorImpl];

//# sourceURL=build://paper-checkbox/paper-checkbox.html.js
Polymer({is:"paper-checkbox",behaviors:[Polymer.PaperCheckedElementBehavior],hostAttributes:{role:"checkbox","aria-checked":!1,tabindex:0},properties:{ariaActiveAttribute:{type:String,value:"aria-checked"}},attached:function(){Polymer.RenderStatus.afterNextRender(this,function(){if("-1px"===this.getComputedStyleValue("--calculated-paper-checkbox-ink-size").trim()){var e=this.getComputedStyleValue("--calculated-paper-checkbox-size").trim(),r="px",k=e.match(/[A-Za-z]+$/);null!==k&&(r=k[0]);e=parseFloat(e);
k=8/3*e;"px"===r&&(k=Math.floor(k),k%2!==e%2&&k++);this.updateStyles({"--paper-checkbox-ink-size":k+r})}})},_computeCheckboxClass:function(e,r){var k="";e&&(k+="checked ");r&&(k+="invalid");return k},_computeCheckmarkClass:function(e){return e?"":"hidden"},_createRipple:function(){this._rippleContainer=this.$.checkboxContainer;return Polymer.PaperInkyFocusBehaviorImpl._createRipple.call(this)}});

//# sourceURL=build://iron-fit-behavior/iron-fit-behavior.html.js
Polymer.IronFitBehavior={properties:{sizingTarget:{type:Object,value:function(){return this}},fitInto:{type:Object,value:window},noOverlap:{type:Boolean},positionTarget:{type:Element},horizontalAlign:{type:String},verticalAlign:{type:String},dynamicAlign:{type:Boolean},horizontalOffset:{type:Number,value:0,notify:!0},verticalOffset:{type:Number,value:0,notify:!0},autoFitOnAttach:{type:Boolean,value:!1},_fitInfo:{type:Object}},get _fitWidth(){return this.fitInto===window?this.fitInto.innerWidth:this.fitInto.getBoundingClientRect().width},
get _fitHeight(){return this.fitInto===window?this.fitInto.innerHeight:this.fitInto.getBoundingClientRect().height},get _fitLeft(){return this.fitInto===window?0:this.fitInto.getBoundingClientRect().left},get _fitTop(){return this.fitInto===window?0:this.fitInto.getBoundingClientRect().top},get _defaultPositionTarget(){var e=Polymer.dom(this).parentNode;e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&(e=e.host);return e},get _localeHorizontalAlign(){if(this._isRTL){if("right"===this.horizontalAlign)return"left";
if("left"===this.horizontalAlign)return"right"}return this.horizontalAlign},get __shouldPosition(){return(this.horizontalAlign||this.verticalAlign)&&this.positionTarget},attached:function(){"undefined"===typeof this._isRTL&&(this._isRTL="rtl"==window.getComputedStyle(this).direction);this.positionTarget=this.positionTarget||this._defaultPositionTarget;this.autoFitOnAttach&&("none"===window.getComputedStyle(this).display?setTimeout(function(){this.fit()}.bind(this)):(window.ShadyDOM&&ShadyDOM.flush(),
this.fit()))},detached:function(){this.__deferredFit&&(clearTimeout(this.__deferredFit),this.__deferredFit=null)},fit:function(){this.position();this.constrain();this.center()},_discoverInfo:function(){if(!this._fitInfo){var e=window.getComputedStyle(this),r=window.getComputedStyle(this.sizingTarget);this._fitInfo={inlineStyle:{top:this.style.top||"",left:this.style.left||"",position:this.style.position||""},sizerInlineStyle:{maxWidth:this.sizingTarget.style.maxWidth||"",maxHeight:this.sizingTarget.style.maxHeight||
"",boxSizing:this.sizingTarget.style.boxSizing||""},positionedBy:{vertically:"auto"!==e.top?"top":"auto"!==e.bottom?"bottom":null,horizontally:"auto"!==e.left?"left":"auto"!==e.right?"right":null},sizedBy:{height:"none"!==r.maxHeight,width:"none"!==r.maxWidth,minWidth:parseInt(r.minWidth,10)||0,minHeight:parseInt(r.minHeight,10)||0},margin:{top:parseInt(e.marginTop,10)||0,right:parseInt(e.marginRight,10)||0,bottom:parseInt(e.marginBottom,10)||0,left:parseInt(e.marginLeft,10)||0}}}},resetFit:function(){var e=
this._fitInfo||{},r;for(r in e.sizerInlineStyle)this.sizingTarget.style[r]=e.sizerInlineStyle[r];for(r in e.inlineStyle)this.style[r]=e.inlineStyle[r];this._fitInfo=null},refit:function(){var e=this.sizingTarget.scrollLeft,r=this.sizingTarget.scrollTop;this.resetFit();this.fit();this.sizingTarget.scrollLeft=e;this.sizingTarget.scrollTop=r},position:function(){if(this.__shouldPosition){this._discoverInfo();this.style.position="fixed";this.sizingTarget.style.boxSizing="border-box";this.style.left="0px";
this.style.top="0px";var e=this.getBoundingClientRect(),r=this.__getNormalizedRect(this.positionTarget),k=this.__getNormalizedRect(this.fitInto),n=this._fitInfo.margin,p=this.__getPosition(this._localeHorizontalAlign,this.verticalAlign,{width:e.width+n.left+n.right,height:e.height+n.top+n.bottom},e,r,k);r=p.left+n.left;p=p.top+n.top;var v=Math.min(k.right-n.right,r+e.width),z=Math.min(k.bottom-n.bottom,p+e.height);r=Math.max(k.left+n.left,Math.min(r,v-this._fitInfo.sizedBy.minWidth));p=Math.max(k.top+
n.top,Math.min(p,z-this._fitInfo.sizedBy.minHeight));this.sizingTarget.style.maxWidth=Math.max(v-r,this._fitInfo.sizedBy.minWidth)+"px";this.sizingTarget.style.maxHeight=Math.max(z-p,this._fitInfo.sizedBy.minHeight)+"px";this.style.left=r-e.left+"px";this.style.top=p-e.top+"px"}},constrain:function(){if(!this.__shouldPosition){this._discoverInfo();var e=this._fitInfo;e.positionedBy.vertically||(this.style.position="fixed",this.style.top="0px");e.positionedBy.horizontally||(this.style.position="fixed",
this.style.left="0px");this.sizingTarget.style.boxSizing="border-box";var r=this.getBoundingClientRect();e.sizedBy.height||this.__sizeDimension(r,e.positionedBy.vertically,"top","bottom","Height");e.sizedBy.width||this.__sizeDimension(r,e.positionedBy.horizontally,"left","right","Width")}},_sizeDimension:function(e,r,k,n,p){this.__sizeDimension(e,r,k,n,p)},__sizeDimension:function(e,r,k,n,p){var v=this._fitInfo,z=this.__getNormalizedRect(this.fitInto);z="Width"===p?z.width:z.height;r=r===n;var E=
"offset"+p;this.sizingTarget.style["max"+p]=z-v.margin[r?k:n]-(r?z-e[n]:e[k])-(this[E]-this.sizingTarget[E])+"px"},center:function(){if(!this.__shouldPosition){this._discoverInfo();var e=this._fitInfo.positionedBy;if(!e.vertically||!e.horizontally){this.style.position="fixed";e.vertically||(this.style.top="0px");e.horizontally||(this.style.left="0px");var r=this.getBoundingClientRect(),k=this.__getNormalizedRect(this.fitInto);e.vertically||(this.style.top=k.top-r.top+(k.height-r.height)/2+"px");e.horizontally||
(this.style.left=k.left-r.left+(k.width-r.width)/2+"px")}}},__getNormalizedRect:function(e){return e===document.documentElement||e===window?{top:0,left:0,width:window.innerWidth,height:window.innerHeight,right:window.innerWidth,bottom:window.innerHeight}:e.getBoundingClientRect()},__getOffscreenArea:function(e,r,k){return Math.abs(Math.min(0,e.top)+Math.min(0,k.bottom-(e.top+r.height)))*r.width+Math.abs(Math.min(0,e.left)+Math.min(0,k.right-(e.left+r.width)))*r.height},__getPosition:function(e,r,
k,n,p,v){var z=[{verticalAlign:"top",horizontalAlign:"left",top:p.top+this.verticalOffset,left:p.left+this.horizontalOffset},{verticalAlign:"top",horizontalAlign:"right",top:p.top+this.verticalOffset,left:p.right-k.width-this.horizontalOffset},{verticalAlign:"bottom",horizontalAlign:"left",top:p.bottom-k.height-this.verticalOffset,left:p.left+this.horizontalOffset},{verticalAlign:"bottom",horizontalAlign:"right",top:p.bottom-k.height-this.verticalOffset,left:p.right-k.width-this.horizontalOffset}];
if(this.noOverlap){for(var E=0,t=z.length;E<t;E++){var x={},A;for(A in z[E])x[A]=z[E][A];z.push(x)}z[0].top=z[1].top+=p.height;z[2].top=z[3].top-=p.height;z[4].left=z[6].left+=p.width;z[5].left=z[7].left-=p.width}r="auto"===r?null:r;e="auto"===e?null:e;e&&"center"!==e||(z.push({verticalAlign:"top",horizontalAlign:"center",top:p.top+this.verticalOffset+(this.noOverlap?p.height:0),left:p.left-n.width/2+p.width/2+this.horizontalOffset}),z.push({verticalAlign:"bottom",horizontalAlign:"center",top:p.bottom-
k.height-this.verticalOffset-(this.noOverlap?p.height:0),left:p.left-n.width/2+p.width/2+this.horizontalOffset}));r&&"middle"!==r||(z.push({verticalAlign:"middle",horizontalAlign:"left",top:p.top-n.height/2+p.height/2+this.verticalOffset,left:p.left+this.horizontalOffset+(this.noOverlap?p.width:0)}),z.push({verticalAlign:"middle",horizontalAlign:"right",top:p.top-n.height/2+p.height/2+this.verticalOffset,left:p.right-k.width-this.horizontalOffset-(this.noOverlap?p.width:0)}));"middle"===r&&"center"===
e&&z.push({verticalAlign:"middle",horizontalAlign:"center",top:p.top-n.height/2+p.height/2+this.verticalOffset,left:p.left-n.width/2+p.width/2+this.horizontalOffset});for(E=0;E<z.length;E++){n=z[E];p=n.verticalAlign===r;t=n.horizontalAlign===e;if(!this.dynamicAlign&&!this.noOverlap&&p&&t){var F=n;break}x=(!r||p)&&(!e||t);if(this.dynamicAlign||x){n.offscreenArea=this.__getOffscreenArea(n,k,v);if(0===n.offscreenArea&&x){F=n;break}F=F||n;x=n.offscreenArea-F.offscreenArea;if(0>x||0===x&&(p||t))F=n}}return F}};

//# sourceURL=build://iron-overlay-behavior/iron-overlay-backdrop.html.js
(function(){Polymer({is:"iron-overlay-backdrop",properties:{opened:{reflectToAttribute:!0,type:Boolean,value:!1,observer:"_openedChanged"}},listeners:{transitionend:"_onTransitionend"},created:function(){this.__openedRaf=null},attached:function(){this.opened&&this._openedChanged(this.opened)},prepare:function(){this.opened&&!this.parentNode&&Polymer.dom(document.body).appendChild(this)},open:function(){this.opened=!0},close:function(){this.opened=!1},complete:function(){this.opened||this.parentNode!==
document.body||Polymer.dom(this.parentNode).removeChild(this)},_onTransitionend:function(e){e&&e.target===this&&this.complete()},_openedChanged:function(e){e?this.prepare():(e=window.getComputedStyle(this),"0s"!==e.transitionDuration&&0!=e.opacity||this.complete());this.isAttached&&(this.__openedRaf&&(window.cancelAnimationFrame(this.__openedRaf),this.__openedRaf=null),this.scrollTop=this.scrollTop,this.__openedRaf=window.requestAnimationFrame(function(){this.__openedRaf=null;this.toggleClass("opened",
this.opened)}.bind(this)))}})})();

//# sourceURL=build://iron-overlay-behavior/iron-overlay-manager.html.js
Polymer.IronOverlayManagerClass=function(){this._overlays=[];this._minimumZ=101;this._backdropElement=null;Polymer.Gestures.add(document.documentElement,"tap",function(){});document.addEventListener("tap",this._onCaptureClick.bind(this),!0);document.addEventListener("focus",this._onCaptureFocus.bind(this),!0);document.addEventListener("keydown",this._onCaptureKeyDown.bind(this),!0)};
Polymer.IronOverlayManagerClass.prototype={constructor:Polymer.IronOverlayManagerClass,get backdropElement(){this._backdropElement||(this._backdropElement=document.createElement("iron-overlay-backdrop"));return this._backdropElement},get deepActiveElement(){var e=document.activeElement;e&&!1!==e instanceof Element||(e=document.body);for(;e.root&&Polymer.dom(e.root).activeElement;)e=Polymer.dom(e.root).activeElement;return e},_bringOverlayAtIndexToFront:function(e){var r=this._overlays[e];if(r){var k=
this._overlays.length-1,n=this._overlays[k];n&&this._shouldBeBehindOverlay(r,n)&&k--;if(!(e>=k)){n=Math.max(this.currentOverlayZ(),this._minimumZ);for(this._getZ(r)<=n&&this._applyOverlayZ(r,n);e<k;)this._overlays[e]=this._overlays[e+1],e++;this._overlays[k]=r}}},addOrRemoveOverlay:function(e){e.opened?this.addOverlay(e):this.removeOverlay(e)},addOverlay:function(e){var r=this._overlays.indexOf(e);if(0<=r)this._bringOverlayAtIndexToFront(r);else{r=this._overlays.length;var k=this._overlays[r-1],n=
Math.max(this._getZ(k),this._minimumZ),p=this._getZ(e);k&&this._shouldBeBehindOverlay(e,k)&&(this._applyOverlayZ(k,n),r--,n=Math.max(this._getZ(this._overlays[r-1]),this._minimumZ));p<=n&&this._applyOverlayZ(e,n);this._overlays.splice(r,0,e)}this.trackBackdrop()},removeOverlay:function(e){e=this._overlays.indexOf(e);-1!==e&&(this._overlays.splice(e,1),this.trackBackdrop())},currentOverlay:function(){return this._overlays[this._overlays.length-1]},currentOverlayZ:function(){return this._getZ(this.currentOverlay())},
ensureMinimumZ:function(e){this._minimumZ=Math.max(this._minimumZ,e)},focusOverlay:function(){var e=this.currentOverlay();e&&e._applyFocus()},trackBackdrop:function(){var e=this._overlayWithBackdrop();if(e||this._backdropElement)this.backdropElement.style.zIndex=this._getZ(e)-1,this.backdropElement.opened=!!e,this.backdropElement.prepare()},getBackdrops:function(){for(var e=[],r=0;r<this._overlays.length;r++)this._overlays[r].withBackdrop&&e.push(this._overlays[r]);return e},backdropZ:function(){return this._getZ(this._overlayWithBackdrop())-
1},_overlayWithBackdrop:function(){for(var e=this._overlays.length-1;0<=e;e--)if(this._overlays[e].withBackdrop)return this._overlays[e]},_getZ:function(e){var r=this._minimumZ;e&&(e=Number(e.style.zIndex||window.getComputedStyle(e).zIndex),e===e&&(r=e));return r},_setZ:function(e,r){e.style.zIndex=r},_applyOverlayZ:function(e,r){this._setZ(e,r+2)},_overlayInPath:function(e){e=e||[];for(var r=0;r<e.length;r++)if(e[r]._manager===this)return e[r]},_onCaptureClick:function(e){var r=this._overlays.length-
1;if(-1!==r)for(var k=Polymer.dom(e).path,n;(n=this._overlays[r])&&this._overlayInPath(k)!==n;)if(n._onCaptureClick(e),n.allowClickThrough)r--;else break},_onCaptureFocus:function(e){var r=this.currentOverlay();r&&r._onCaptureFocus(e)},_onCaptureKeyDown:function(e){var r=this.currentOverlay();r&&(Polymer.IronA11yKeysBehavior.keyboardEventMatchesKeys(e,"esc")?r._onCaptureEsc(e):Polymer.IronA11yKeysBehavior.keyboardEventMatchesKeys(e,"tab")&&r._onCaptureTab(e))},_shouldBeBehindOverlay:function(e,r){return!e.alwaysOnTop&&
r.alwaysOnTop}};Polymer.IronOverlayManager=new Polymer.IronOverlayManagerClass;

//# sourceURL=build://iron-overlay-behavior/iron-scroll-manager.html.js
(function(){var e=0,r=0,k=null,n=[],p=["wheel","mousewheel","DOMMouseScroll","touchstart","touchmove"];Polymer.IronScrollManager={get currentLockingElement(){return this._lockingElements[this._lockingElements.length-1]},elementIsScrollLocked:function(v){var z=this.currentLockingElement;if(void 0===z)return!1;if(this._hasCachedLockedElement(v))return!0;if(this._hasCachedUnlockedElement(v))return!1;(z=!!z&&z!==v&&!this._composedTreeContains(z,v))?this._lockedElementCache.push(v):this._unlockedElementCache.push(v);
return z},pushScrollLock:function(v){0<=this._lockingElements.indexOf(v)||(0===this._lockingElements.length&&this._lockScrollInteractions(),this._lockingElements.push(v),this._lockedElementCache=[],this._unlockedElementCache=[])},removeScrollLock:function(v){v=this._lockingElements.indexOf(v);-1!==v&&(this._lockingElements.splice(v,1),this._lockedElementCache=[],this._unlockedElementCache=[],0===this._lockingElements.length&&this._unlockScrollInteractions())},_lockingElements:[],_lockedElementCache:null,
_unlockedElementCache:null,_hasCachedLockedElement:function(v){return-1<this._lockedElementCache.indexOf(v)},_hasCachedUnlockedElement:function(v){return-1<this._unlockedElementCache.indexOf(v)},_composedTreeContains:function(v,z){var E,t;if(v.contains(z))return!0;v=Polymer.dom(v).querySelectorAll("content,slot");for(E=0;E<v.length;++E){var x=Polymer.dom(v[E]).getDistributedNodes();for(t=0;t<x.length;++t)if(x[t].nodeType===Node.ELEMENT_NODE&&this._composedTreeContains(x[t],z))return!0}return!1},_scrollInteractionHandler:function(v){v.cancelable&&
this._shouldPreventScrolling(v)&&v.preventDefault();v.targetTouches&&(v=v.targetTouches[0],e=v.pageX,r=v.pageY)},_lockScrollInteractions:function(){this._boundScrollHandler=this._boundScrollHandler||this._scrollInteractionHandler.bind(this);for(var v=0,z=p.length;v<z;v++)document.addEventListener(p[v],this._boundScrollHandler,{capture:!0,passive:!1})},_unlockScrollInteractions:function(){for(var v=0,z=p.length;v<z;v++)document.removeEventListener(p[v],this._boundScrollHandler,{capture:!0,passive:!1})},
_shouldPreventScrolling:function(v){var z=Polymer.dom(v).rootTarget;"touchmove"!==v.type&&k!==z&&(k=z,n=this._getScrollableNodes(Polymer.dom(v).path));if(!n.length)return!0;if("touchstart"===v.type)return!1;v=this._getScrollInfo(v);return!this._getScrollingNode(n,v.deltaX,v.deltaY)},_getScrollableNodes:function(v){for(var z=[],E=v.indexOf(this.currentLockingElement),t=0;t<=E;t++)if(v[t].nodeType===Node.ELEMENT_NODE){var x=v[t],A=x.style;"scroll"!==A.overflow&&"auto"!==A.overflow&&(A=window.getComputedStyle(x));
"scroll"!==A.overflow&&"auto"!==A.overflow||z.push(x)}return z},_getScrollingNode:function(v,z,E){if(z||E)for(var t=Math.abs(E)>=Math.abs(z),x=0;x<v.length;x++){var A=v[x];if(t?0>E?0<A.scrollTop:A.scrollTop<A.scrollHeight-A.clientHeight:0>z?0<A.scrollLeft:A.scrollLeft<A.scrollWidth-A.clientWidth)return A}},_getScrollInfo:function(v){var z={deltaX:v.deltaX,deltaY:v.deltaY};"deltaX"in v||("wheelDeltaX"in v&&"wheelDeltaY"in v?(z.deltaX=-v.wheelDeltaX,z.deltaY=-v.wheelDeltaY):"wheelDelta"in v?(z.deltaX=
0,z.deltaY=-v.wheelDelta):"axis"in v?(z.deltaX=1===v.axis?v.detail:0,z.deltaY=2===v.axis?v.detail:0):v.targetTouches&&(v=v.targetTouches[0],z.deltaX=e-v.pageX,z.deltaY=r-v.pageY));return z}}})();

//# sourceURL=build://iron-overlay-behavior/iron-focusables-helper.html.js
(function(){var e=Element.prototype,r=e.matches||e.matchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector;Polymer.IronFocusablesHelper={getTabbableNodes:function(k){var n=[];return this._collectTabbableNodes(k,n)?this._sortByTabIndex(n):n},isFocusable:function(k){return r.call(k,"input, select, textarea, button, object")?r.call(k,":not([disabled])"):r.call(k,"a[href], area[href], iframe, [tabindex], [contentEditable]")},isTabbable:function(k){return this.isFocusable(k)&&
r.call(k,':not([tabindex\x3d"-1"])')&&this._isVisible(k)},_normalizedTabIndex:function(k){return this.isFocusable(k)?(k=k.getAttribute("tabindex")||0,Number(k)):-1},_collectTabbableNodes:function(k,n){if(k.nodeType!==Node.ELEMENT_NODE||!this._isVisible(k))return!1;var p=this._normalizedTabIndex(k),v=0<p;0<=p&&n.push(k);k="content"===k.localName||"slot"===k.localName?Polymer.dom(k).getDistributedNodes():Polymer.dom(k.root||k).children;for(p=0;p<k.length;p++)v=this._collectTabbableNodes(k[p],n)||v;
return v},_isVisible:function(k){var n=k.style;return"hidden"!==n.visibility&&"none"!==n.display?(n=window.getComputedStyle(k),"hidden"!==n.visibility&&"none"!==n.display):!1},_sortByTabIndex:function(k){var n=k.length;if(2>n)return k;var p=Math.ceil(n/2);n=this._sortByTabIndex(k.slice(0,p));k=this._sortByTabIndex(k.slice(p));return this._mergeSortByTabIndex(n,k)},_mergeSortByTabIndex:function(k,n){for(var p=[];0<k.length&&0<n.length;)this._hasLowerTabOrder(k[0],n[0])?p.push(n.shift()):p.push(k.shift());
return p.concat(k,n)},_hasLowerTabOrder:function(k,n){k=Math.max(k.tabIndex,0);n=Math.max(n.tabIndex,0);return 0===k||0===n?n>k:k>n}}})();

//# sourceURL=build://iron-overlay-behavior/iron-overlay-behavior.html.js
(function(){Polymer.IronOverlayBehaviorImpl={properties:{opened:{observer:"_openedChanged",type:Boolean,value:!1,notify:!0},canceled:{observer:"_canceledChanged",readOnly:!0,type:Boolean,value:!1},withBackdrop:{observer:"_withBackdropChanged",type:Boolean},noAutoFocus:{type:Boolean,value:!1},noCancelOnEscKey:{type:Boolean,value:!1},noCancelOnOutsideClick:{type:Boolean,value:!1},closingReason:{type:Object},restoreFocusOnClose:{type:Boolean,value:!1},allowClickThrough:{type:Boolean},alwaysOnTop:{type:Boolean},
scrollAction:{type:String},_manager:{type:Object,value:Polymer.IronOverlayManager},_focusedChild:{type:Object}},listeners:{"iron-resize":"_onIronResize"},observers:["__updateScrollObservers(isAttached, opened, scrollAction)"],get backdropElement(){return this._manager.backdropElement},get _focusNode(){return this._focusedChild||Polymer.dom(this).querySelector("[autofocus]")||this},get _focusableNodes(){return Polymer.IronFocusablesHelper.getTabbableNodes(this)},ready:function(){this.__shouldRemoveTabIndex=
this.__isAnimating=!1;this.__firstFocusableNode=this.__lastFocusableNode=null;this.__rafs={};this.__scrollTop=this.__scrollLeft=this.__restoreFocusNode=null;this.__onCaptureScroll=this.__onCaptureScroll.bind(this);this.__rootNodes=null;this._ensureSetup()},attached:function(){this.opened&&this._openedChanged(this.opened);this._observer=Polymer.dom(this).observeNodes(this._onNodesChange)},detached:function(){Polymer.dom(this).unobserveNodes(this._observer);this._observer=null;for(var e in this.__rafs)null!==
this.__rafs[e]&&cancelAnimationFrame(this.__rafs[e]);this.__rafs={};this._manager.removeOverlay(this);this.__isAnimating&&(this.opened?this._finishRenderOpened():(this._applyFocus(),this._finishRenderClosed()))},toggle:function(){this._setCanceled(!1);this.opened=!this.opened},open:function(){this._setCanceled(!1);this.opened=!0},close:function(){this._setCanceled(!1);this.opened=!1},cancel:function(e){this.fire("iron-overlay-canceled",e,{cancelable:!0}).defaultPrevented||(this._setCanceled(!0),this.opened=
!1)},invalidateTabbables:function(){this.__firstFocusableNode=this.__lastFocusableNode=null},_ensureSetup:function(){this._overlaySetup||(this._overlaySetup=!0,this.style.outline="none",this.style.display="none")},_openedChanged:function(e){e?this.removeAttribute("aria-hidden"):this.setAttribute("aria-hidden","true");this.isAttached&&(this.__isAnimating=!0,this.__deraf("__openedChanged",this.__openedChanged))},_canceledChanged:function(){this.closingReason=this.closingReason||{};this.closingReason.canceled=
this.canceled},_withBackdropChanged:function(){this.withBackdrop&&!this.hasAttribute("tabindex")?(this.setAttribute("tabindex","-1"),this.__shouldRemoveTabIndex=!0):this.__shouldRemoveTabIndex&&(this.removeAttribute("tabindex"),this.__shouldRemoveTabIndex=!1);this.opened&&this.isAttached&&this._manager.trackBackdrop()},_prepareRenderOpened:function(){this.__restoreFocusNode=this._manager.deepActiveElement;this._preparePositioning();this.refit();this._finishPositioning();this.noAutoFocus&&document.activeElement===
this._focusNode&&(this._focusNode.blur(),this.__restoreFocusNode.focus())},_renderOpened:function(){this._finishRenderOpened()},_renderClosed:function(){this._finishRenderClosed()},_finishRenderOpened:function(){this.notifyResize();this.__isAnimating=!1;this.fire("iron-overlay-opened")},_finishRenderClosed:function(){this.style.display="none";this.style.zIndex="";this.notifyResize();this.__isAnimating=!1;this.fire("iron-overlay-closed",this.closingReason)},_preparePositioning:function(){this.style.transition=
this.style.webkitTransition="none";this.style.transform=this.style.webkitTransform="none";this.style.display=""},_finishPositioning:function(){this.style.display="none";this.scrollTop=this.scrollTop;this.style.transition=this.style.webkitTransition="";this.style.transform=this.style.webkitTransform="";this.style.display="";this.scrollTop=this.scrollTop},_applyFocus:function(){if(this.opened)this.noAutoFocus||this._focusNode.focus();else{this._focusNode.blur();this._focusedChild=null;if(this.restoreFocusOnClose&&
this.__restoreFocusNode){var e=this._manager.deepActiveElement;(e===document.body||Polymer.dom(this).deepContains(e))&&this.__restoreFocusNode.focus()}this.__restoreFocusNode=null;(e=this._manager.currentOverlay())&&this!==e&&e._applyFocus()}},_onCaptureClick:function(e){this.noCancelOnOutsideClick||this.cancel(e)},_onCaptureFocus:function(e){if(this.withBackdrop){var r=Polymer.dom(e).path;-1===r.indexOf(this)?(e.stopPropagation(),this._applyFocus()):this._focusedChild=r[0]}},_onCaptureEsc:function(e){this.noCancelOnEscKey||
this.cancel(e)},_onCaptureTab:function(e){if(this.withBackdrop){this.__ensureFirstLastFocusables();var r=e.shiftKey,k=r?this.__firstFocusableNode:this.__lastFocusableNode;r=r?this.__lastFocusableNode:this.__firstFocusableNode;if(k===r)k=!0;else{var n=this._manager.deepActiveElement;k=n===k||n===this}k&&(e.preventDefault(),this._focusedChild=r,this._applyFocus())}},_onIronResize:function(){this.opened&&!this.__isAnimating&&this.__deraf("refit",this.refit)},_onNodesChange:function(){this.opened&&!this.__isAnimating&&
(this.invalidateTabbables(),this.notifyResize())},__ensureFirstLastFocusables:function(){if(!this.__firstFocusableNode||!this.__lastFocusableNode){var e=this._focusableNodes;this.__firstFocusableNode=e[0];this.__lastFocusableNode=e[e.length-1]}},__openedChanged:function(){this.opened?(this._prepareRenderOpened(),this._manager.addOverlay(this),this._applyFocus(),this._renderOpened()):(this._manager.removeOverlay(this),this._applyFocus(),this._renderClosed())},__deraf:function(e,r){var k=this.__rafs;
null!==k[e]&&cancelAnimationFrame(k[e]);k[e]=requestAnimationFrame(function(){k[e]=null;r.call(this)}.bind(this))},__updateScrollObservers:function(e,r,k){e&&r&&this.__isValidScrollAction(k)?("lock"===k&&(this.__saveScrollPosition(),Polymer.IronScrollManager.pushScrollLock(this)),this.__addScrollListeners()):(Polymer.IronScrollManager.removeScrollLock(this),this.__removeScrollListeners())},__addScrollListeners:function(){if(!this.__rootNodes){this.__rootNodes=[];if(Polymer.Settings.useShadow)for(var e=
this;e;)e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.host&&this.__rootNodes.push(e),e=e.host||e.assignedSlot||e.parentNode;this.__rootNodes.push(document)}this.__rootNodes.forEach(function(r){r.addEventListener("scroll",this.__onCaptureScroll,{capture:!0,passive:!0})},this)},__removeScrollListeners:function(){this.__rootNodes&&this.__rootNodes.forEach(function(e){e.removeEventListener("scroll",this.__onCaptureScroll,{capture:!0,passive:!0})},this);this.isAttached||(this.__rootNodes=null)},__isValidScrollAction:function(e){return"lock"===
e||"refit"===e||"cancel"===e},__onCaptureScroll:function(e){if(!(this.__isAnimating||0<=Polymer.dom(e).path.indexOf(this)))switch(this.scrollAction){case "lock":this.__restoreScrollPosition();break;case "refit":this.__deraf("refit",this.refit);break;case "cancel":this.cancel(e)}},__saveScrollPosition:function(){document.scrollingElement?(this.__scrollTop=document.scrollingElement.scrollTop,this.__scrollLeft=document.scrollingElement.scrollLeft):(this.__scrollTop=Math.max(document.documentElement.scrollTop,
document.body.scrollTop),this.__scrollLeft=Math.max(document.documentElement.scrollLeft,document.body.scrollLeft))},__restoreScrollPosition:function(){document.scrollingElement?(document.scrollingElement.scrollTop=this.__scrollTop,document.scrollingElement.scrollLeft=this.__scrollLeft):(document.documentElement.scrollTop=document.body.scrollTop=this.__scrollTop,document.documentElement.scrollLeft=document.body.scrollLeft=this.__scrollLeft)}};Polymer.IronOverlayBehavior=[Polymer.IronFitBehavior,Polymer.IronResizableBehavior,
Polymer.IronOverlayBehaviorImpl]})();

//# sourceURL=build://paper-dialog-behavior/paper-dialog-behavior.html.js
(function(){Polymer.PaperDialogBehaviorImpl={hostAttributes:{role:"dialog",tabindex:"-1"},properties:{modal:{type:Boolean,value:!1},__readied:{type:Boolean,value:!1}},observers:["_modalChanged(modal, __readied)"],listeners:{tap:"_onDialogClick"},ready:function(){this.__prevNoCancelOnOutsideClick=this.noCancelOnOutsideClick;this.__prevNoCancelOnEscKey=this.noCancelOnEscKey;this.__prevWithBackdrop=this.withBackdrop;this.__readied=!0},_modalChanged:function(e,r){r&&(e?(this.__prevNoCancelOnOutsideClick=
this.noCancelOnOutsideClick,this.__prevNoCancelOnEscKey=this.noCancelOnEscKey,this.__prevWithBackdrop=this.withBackdrop,this.withBackdrop=this.noCancelOnEscKey=this.noCancelOnOutsideClick=!0):(this.noCancelOnOutsideClick=this.noCancelOnOutsideClick&&this.__prevNoCancelOnOutsideClick,this.noCancelOnEscKey=this.noCancelOnEscKey&&this.__prevNoCancelOnEscKey,this.withBackdrop=this.withBackdrop&&this.__prevWithBackdrop))},_updateClosingReasonConfirmed:function(e){this.closingReason=this.closingReason||
{};this.closingReason.confirmed=e},_onDialogClick:function(e){for(var r=Polymer.dom(e).path,k=0,n=r.indexOf(this);k<n;k++){var p=r[k];if(p.hasAttribute&&(p.hasAttribute("dialog-dismiss")||p.hasAttribute("dialog-confirm"))){this._updateClosingReasonConfirmed(p.hasAttribute("dialog-confirm"));this.close();e.stopPropagation();break}}}};Polymer.PaperDialogBehavior=[Polymer.IronOverlayBehavior,Polymer.PaperDialogBehaviorImpl]})();

//# sourceURL=build://paper-dialog-scrollable/paper-dialog-scrollable.html.js
Polymer({is:"paper-dialog-scrollable",properties:{dialogElement:{type:Object}},get scrollTarget(){return this.$.scrollable},ready:function(){this._ensureTarget();this.classList.add("no-padding")},attached:function(){this._ensureTarget();requestAnimationFrame(this.updateScrollState.bind(this))},updateScrollState:function(){this.toggleClass("is-scrolled",0<this.scrollTarget.scrollTop);this.toggleClass("can-scroll",this.scrollTarget.offsetHeight<this.scrollTarget.scrollHeight);this.toggleClass("scrolled-to-bottom",
this.scrollTarget.scrollTop+this.scrollTarget.offsetHeight>=this.scrollTarget.scrollHeight)},_ensureTarget:function(){(this.dialogElement=this.dialogElement||this.parentElement)&&this.dialogElement.behaviors&&0<=this.dialogElement.behaviors.indexOf(Polymer.PaperDialogBehaviorImpl)?(this.dialogElement.sizingTarget=this.scrollTarget,this.scrollTarget.classList.remove("fit")):this.dialogElement&&this.scrollTarget.classList.add("fit")}});

//# sourceURL=build://neon-animation/neon-animatable-behavior.html.js
Polymer.NeonAnimatableBehavior={properties:{animationConfig:{type:Object},entryAnimation:{observer:"_entryAnimationChanged",type:String},exitAnimation:{observer:"_exitAnimationChanged",type:String}},_entryAnimationChanged:function(){this.animationConfig=this.animationConfig||{};this.animationConfig.entry=[{name:this.entryAnimation,node:this}]},_exitAnimationChanged:function(){this.animationConfig=this.animationConfig||{};this.animationConfig.exit=[{name:this.exitAnimation,node:this}]},_copyProperties:function(e,
r){for(var k in r)e[k]=r[k]},_cloneConfig:function(e){var r={isClone:!0};this._copyProperties(r,e);return r},_getAnimationConfigRecursive:function(e,r,k){if(this.animationConfig)if(this.animationConfig.value&&"function"===typeof this.animationConfig.value)this._warn(this._logf("playAnimation","Please put 'animationConfig' inside of your components 'properties' object instead of outside of it."));else{var n=e?this.animationConfig[e]:this.animationConfig;Array.isArray(n)||(n=[n]);if(n)for(var p,v=0;p=
n[v];v++)if(p.animatable)p.animatable._getAnimationConfigRecursive(p.type||e,r,k);else if(p.id){var z=r[p.id];z?(z.isClone||(r[p.id]=this._cloneConfig(z),z=r[p.id]),this._copyProperties(z,p)):r[p.id]=p}else k.push(p)}},getAnimationConfig:function(e){var r={},k=[];this._getAnimationConfigRecursive(e,r,k);for(var n in r)k.push(r[n]);return k}};

//# sourceURL=build://neon-animation/neon-animation-runner-behavior.html.js
Polymer.NeonAnimationRunnerBehaviorImpl={_configureAnimations:function(e){var r=[],k=[];if(0<e.length)for(var n,p=0;n=e[p];p++){var v=document.createElement(n.name);if(v.isNeonAnimation){var z=null;v.configure||(v.configure=function(){return null});z=v.configure(n);k.push({result:z,config:n})}else console.warn(this.is+":",n.name,"not found!")}for(e=0;e<k.length;e++){z=k[e].result;n=k[e].config;try{"function"!=typeof z.cancel&&(z=document.timeline.play(z))}catch(E){z=null,console.warn("Couldnt play",
"(",n.name,").",E)}z&&r.push({neonAnimation:v,config:n,animation:z})}return r},_shouldComplete:function(e){for(var r=!0,k=0;k<e.length;k++)if("finished"!=e[k].animation.playState){r=!1;break}return r},_complete:function(e){for(var r=0;r<e.length;r++)e[r].neonAnimation.complete(e[r].config);for(r=0;r<e.length;r++)e[r].animation.cancel()},playAnimation:function(e,r){var k=this.getAnimationConfig(e);if(k){this._active=this._active||{};this._active[e]&&(this._complete(this._active[e]),delete this._active[e]);
var n=this._configureAnimations(k);if(0==n.length)this.fire("neon-animation-finish",r,{bubbles:!1});else for(this._active[e]=n,k=0;k<n.length;k++)n[k].animation.onfinish=function(){this._shouldComplete(n)&&(this._complete(n),delete this._active[e],this.fire("neon-animation-finish",r,{bubbles:!1}))}.bind(this)}},cancelAnimation:function(){for(var e in this._active){var r=this._active[e],k;for(k in r)r[k].animation.cancel()}this._active={}}};
Polymer.NeonAnimationRunnerBehavior=[Polymer.NeonAnimatableBehavior,Polymer.NeonAnimationRunnerBehaviorImpl];

//# sourceURL=build://paper-dialog/paper-dialog.html.js
Polymer({is:"paper-dialog",behaviors:[Polymer.PaperDialogBehavior,Polymer.NeonAnimationRunnerBehavior],listeners:{"neon-animation-finish":"_onNeonAnimationFinish"},_renderOpened:function(){this.cancelAnimation();this.playAnimation("entry")},_renderClosed:function(){this.cancelAnimation();this.playAnimation("exit")},_onNeonAnimationFinish:function(){this.opened?this._finishRenderOpened():this._finishRenderClosed()}});

//# sourceURL=build://paper-icon-button/paper-icon-button.html.js
Polymer({is:"paper-icon-button",hostAttributes:{role:"button",tabindex:"0"},behaviors:[Polymer.PaperInkyFocusBehavior],properties:{src:{type:String},icon:{type:String},alt:{type:String,observer:"_altChanged"}},_altChanged:function(e,r){var k=this.getAttribute("aria-label");k&&r!=k||this.setAttribute("aria-label",e)}});

//# sourceURL=build://iron-a11y-announcer/iron-a11y-announcer.html.js
(function(){Polymer.IronA11yAnnouncer=function(){};Polymer.IronA11yAnnouncer=Polymer({is:"iron-a11y-announcer",properties:{mode:{type:String,value:"polite"},_text:{type:String,value:""}},created:function(){Polymer.IronA11yAnnouncer.instance||(Polymer.IronA11yAnnouncer.instance=this);document.body.addEventListener("iron-announce",this._onIronAnnounce.bind(this))},announce:function(e){this._text="";this.async(function(){this._text=e},100)},_onIronAnnounce:function(e){e.detail&&e.detail.text&&this.announce(e.detail.text)}});
Polymer.IronA11yAnnouncer.instance=null;Polymer.IronA11yAnnouncer.requestAvailability=function(){Polymer.IronA11yAnnouncer.instance||(Polymer.IronA11yAnnouncer.instance=document.createElement("iron-a11y-announcer"));document.body.appendChild(Polymer.IronA11yAnnouncer.instance)}})();

//# sourceURL=build://iron-input/iron-input.html.js
Polymer({is:"iron-input",behaviors:[Polymer.IronValidatableBehavior],properties:{bindValue:{type:String,value:""},value:{type:String,computed:"_computeValue(bindValue)"},allowedPattern:{type:String},autoValidate:{type:Boolean,value:!1},_inputElement:Object},observers:["_bindValueChanged(bindValue, _inputElement)"],listeners:{input:"_onInput",keypress:"_onKeypress"},created:function(){Polymer.IronA11yAnnouncer.requestAvailability();this._previousValidInput="";this._patternAlreadyChecked=!1},attached:function(){this._observer=
Polymer.dom(this).observeNodes(function(){this._initSlottedInput()}.bind(this))},detached:function(){this._observer&&(Polymer.dom(this).unobserveNodes(this._observer),this._observer=null)},get inputElement(){return this._inputElement},_initSlottedInput:function(){this._inputElement=this.getEffectiveChildren()[0];this.inputElement&&this.inputElement.value&&(this.bindValue=this.inputElement.value);this.fire("iron-input-ready")},get _patternRegExp(){if(this.allowedPattern)var e=new RegExp(this.allowedPattern);
else switch(this.inputElement.type){case "number":e=/[0-9.,e-]/}return e},_bindValueChanged:function(e,r){r&&(void 0===e?r.value=null:e!==r.value&&(this.inputElement.value=e),this.autoValidate&&this.validate(),this.fire("bind-value-changed",{value:e}))},_onInput:function(){!this.allowedPattern||this._patternAlreadyChecked||this._checkPatternValidity()||(this._announceInvalidCharacter("Invalid string of characters not entered."),this.inputElement.value=this._previousValidInput);this.bindValue=this._previousValidInput=
this.inputElement.value;this._patternAlreadyChecked=!1},_isPrintable:function(e){var r=19==e.keyCode||20==e.keyCode||45==e.keyCode||46==e.keyCode||144==e.keyCode||145==e.keyCode||32<e.keyCode&&41>e.keyCode||111<e.keyCode&&124>e.keyCode;return!(8==e.keyCode||9==e.keyCode||13==e.keyCode||27==e.keyCode)&&!(0==e.charCode&&r)},_onKeypress:function(e){if(this.allowedPattern||"number"===this.inputElement.type){var r=this._patternRegExp;if(r&&!(e.metaKey||e.ctrlKey||e.altKey)){this._patternAlreadyChecked=
!0;var k=String.fromCharCode(e.charCode);this._isPrintable(e)&&!r.test(k)&&(e.preventDefault(),this._announceInvalidCharacter("Invalid character "+k+" not entered."))}}},_checkPatternValidity:function(){var e=this._patternRegExp;if(!e)return!0;for(var r=0;r<this.inputElement.value.length;r++)if(!e.test(this.inputElement.value[r]))return!1;return!0},validate:function(){if(!this.inputElement)return this.invalid=!1,!0;var e=this.inputElement.checkValidity();e&&(this.required&&""===this.bindValue?e=!1:
this.hasValidator()&&(e=Polymer.IronValidatableBehavior.validate.call(this,this.bindValue)));this.invalid=!e;this.fire("iron-input-validate");return e},_announceInvalidCharacter:function(e){this.fire("iron-announce",{text:e})},_computeValue:function(e){return e}});

//# sourceURL=build://paper-input/paper-input-behavior.html.js
Polymer.PaperInputHelper={};Polymer.PaperInputHelper.NextLabelID=1;Polymer.PaperInputHelper.NextAddonID=1;Polymer.PaperInputHelper.NextInputID=1;
Polymer.PaperInputBehaviorImpl={properties:{label:{type:String},value:{notify:!0,type:String},disabled:{type:Boolean,value:!1},invalid:{type:Boolean,value:!1,notify:!0},allowedPattern:{type:String},type:{type:String},list:{type:String},pattern:{type:String},required:{type:Boolean,value:!1},errorMessage:{type:String},charCounter:{type:Boolean,value:!1},noLabelFloat:{type:Boolean,value:!1},alwaysFloatLabel:{type:Boolean,value:!1},autoValidate:{type:Boolean,value:!1},validator:{type:String},autocomplete:{type:String,
value:"off"},autofocus:{type:Boolean,observer:"_autofocusChanged"},inputmode:{type:String},minlength:{type:Number},maxlength:{type:Number},min:{type:String},max:{type:String},step:{type:String},name:{type:String},placeholder:{type:String,value:""},readonly:{type:Boolean,value:!1},size:{type:Number},autocapitalize:{type:String,value:"none"},autocorrect:{type:String,value:"off"},autosave:{type:String},results:{type:Number},accept:{type:String},multiple:{type:Boolean},_ariaDescribedBy:{type:String,value:""},
_ariaLabelledBy:{type:String,value:""},_inputId:{type:String,value:""}},listeners:{"addon-attached":"_onAddonAttached"},keyBindings:{"shift+tab:keydown":"_onShiftTabDown"},hostAttributes:{tabindex:0},get inputElement(){this.$||(this.$={});this.$.input||(this._generateInputId(),this.$.input=this.$$("#"+this._inputId));return this.$.input},get _focusableElement(){return this.inputElement},created:function(){this._typesThatHaveText="date datetime datetime-local month time week file".split(" ")},attached:function(){this._updateAriaLabelledBy();
!Polymer.Element&&this.inputElement&&-1!==this._typesThatHaveText.indexOf(this.inputElement.type)&&(this.alwaysFloatLabel=!0)},_appendStringWithSpace:function(e,r){return e?e+" "+r:r},_onAddonAttached:function(e){e=Polymer.dom(e).rootTarget;if(e.id)this._ariaDescribedBy=this._appendStringWithSpace(this._ariaDescribedBy,e.id);else{var r="paper-input-add-on-"+Polymer.PaperInputHelper.NextAddonID++;e.id=r;this._ariaDescribedBy=this._appendStringWithSpace(this._ariaDescribedBy,r)}},validate:function(){return this.inputElement.validate()},
_focusBlurHandler:function(e){Polymer.IronControlState._focusBlurHandler.call(this,e);this.focused&&!this._shiftTabPressed&&this._focusableElement&&this._focusableElement.focus()},_onShiftTabDown:function(){var e=this.getAttribute("tabindex");this._shiftTabPressed=!0;this.setAttribute("tabindex","-1");this.async(function(){this.setAttribute("tabindex",e);this._shiftTabPressed=!1},1)},_handleAutoValidate:function(){this.autoValidate&&this.validate()},updateValueAndPreserveCaret:function(e){try{var r=
this.inputElement.selectionStart;this.value=e;this.inputElement.selectionStart=r;this.inputElement.selectionEnd=r}catch(k){this.value=e}},_computeAlwaysFloatLabel:function(e,r){return r||e},_updateAriaLabelledBy:function(){var e=Polymer.dom(this.root).querySelector("label");if(e){if(e.id)var r=e.id;else r="paper-input-label-"+Polymer.PaperInputHelper.NextLabelID++,e.id=r;this._ariaLabelledBy=r}else this._ariaLabelledBy=""},_generateInputId:function(){this._inputId&&""!==this._inputId||(this._inputId=
"input-"+Polymer.PaperInputHelper.NextInputID++)},_onChange:function(e){this.shadowRoot&&this.fire(e.type,{sourceEvent:e},{node:this,bubbles:e.bubbles,cancelable:e.cancelable})},_autofocusChanged:function(){if(this.autofocus&&this._focusableElement){var e=document.activeElement;e instanceof HTMLElement&&e!==document.body&&e!==document.documentElement||this._focusableElement.focus()}}};Polymer.PaperInputBehavior=[Polymer.IronControlState,Polymer.IronA11yKeysBehavior,Polymer.PaperInputBehaviorImpl];

//# sourceURL=build://paper-input/paper-input-addon-behavior.html.js
Polymer.PaperInputAddonBehavior={attached:function(){this.fire("addon-attached")},update:function(){}};

//# sourceURL=build://paper-input/paper-input-char-counter.html.js
Polymer({is:"paper-input-char-counter",behaviors:[Polymer.PaperInputAddonBehavior],properties:{_charCounterStr:{type:String,value:"0"}},update:function(e){if(e.inputElement){e.value=e.value||"";var r=e.value.toString().length.toString();e.inputElement.hasAttribute("maxlength")&&(r+="/"+e.inputElement.getAttribute("maxlength"));this._charCounterStr=r}}});

//# sourceURL=build://paper-input/paper-input-container.html.js
Polymer({is:"paper-input-container",properties:{noLabelFloat:{type:Boolean,value:!1},alwaysFloatLabel:{type:Boolean,value:!1},attrForValue:{type:String,value:"bind-value"},autoValidate:{type:Boolean,value:!1},invalid:{observer:"_invalidChanged",type:Boolean,value:!1},focused:{readOnly:!0,type:Boolean,value:!1,notify:!0},_addons:{type:Array},_inputHasContent:{type:Boolean,value:!1},_inputSelector:{type:String,value:"input,iron-input,textarea,.paper-input-input"},_boundOnFocus:{type:Function,value:function(){return this._onFocus.bind(this)}},
_boundOnBlur:{type:Function,value:function(){return this._onBlur.bind(this)}},_boundOnInput:{type:Function,value:function(){return this._onInput.bind(this)}},_boundValueChanged:{type:Function,value:function(){return this._onValueChanged.bind(this)}}},listeners:{"addon-attached":"_onAddonAttached","iron-input-validate":"_onIronInputValidate"},get _valueChangedEvent(){return this.attrForValue+"-changed"},get _propertyForValue(){return Polymer.CaseMap.dashToCamelCase(this.attrForValue)},get _inputElement(){return Polymer.dom(this).querySelector(this._inputSelector)},
get _inputElementValue(){return this._inputElement[this._propertyForValue]||this._inputElement.value},ready:function(){this.__isFirstValueUpdate=!0;this._addons||(this._addons=[]);this.addEventListener("focus",this._boundOnFocus,!0);this.addEventListener("blur",this._boundOnBlur,!0)},attached:function(){this.attrForValue?this._inputElement.addEventListener(this._valueChangedEvent,this._boundValueChanged):this.addEventListener("input",this._onInput);this._inputElementValue&&""!=this._inputElementValue?
this._handleValueAndAutoValidate(this._inputElement):this._handleValue(this._inputElement)},_onAddonAttached:function(e){this._addons||(this._addons=[]);e=e.target;-1===this._addons.indexOf(e)&&(this._addons.push(e),this.isAttached&&this._handleValue(this._inputElement))},_onFocus:function(){this._setFocused(!0)},_onBlur:function(){this._setFocused(!1);this._handleValueAndAutoValidate(this._inputElement)},_onInput:function(e){this._handleValueAndAutoValidate(e.target)},_onValueChanged:function(e){var r=
e.target;if(this.__isFirstValueUpdate&&(this.__isFirstValueUpdate=!1,void 0===r.value||""===r.value))return;this._handleValueAndAutoValidate(e.target)},_handleValue:function(e){var r=this._inputElementValue;r||0===r||"number"===e.type&&!e.checkValidity()?this._inputHasContent=!0:this._inputHasContent=!1;this.updateAddons({inputElement:e,value:r,invalid:this.invalid})},_handleValueAndAutoValidate:function(e){this.autoValidate&&e&&(this.invalid=!(e.validate?e.validate(this._inputElementValue):e.checkValidity()));
this._handleValue(e)},_onIronInputValidate:function(){this.invalid=this._inputElement.invalid},_invalidChanged:function(){this._addons&&this.updateAddons({invalid:this.invalid})},updateAddons:function(e){for(var r,k=0;r=this._addons[k];k++)r.update(e)},_computeInputContentClass:function(e,r,k,n,p){var v="input-content";e?(p&&(v+=" label-is-hidden"),n&&(v+=" is-invalid")):(e=this.querySelector("label"),r||p?(v+=" label-is-floating",this.$.labelAndInputContainer.style.position="static",n?v+=" is-invalid":
k&&(v+=" label-is-highlighted")):(e&&(this.$.labelAndInputContainer.style.position="relative"),n&&(v+=" is-invalid")));k&&(v+=" focused");return v},_computeUnderlineClass:function(e,r){var k="underline";r?k+=" is-invalid":e&&(k+=" is-highlighted");return k},_computeAddOnContentClass:function(e,r){var k="add-on-content";r?k+=" is-invalid":e&&(k+=" is-highlighted");return k}});

//# sourceURL=build://paper-input/paper-input-error.html.js
Polymer({is:"paper-input-error",behaviors:[Polymer.PaperInputAddonBehavior],properties:{invalid:{readOnly:!0,reflectToAttribute:!0,type:Boolean}},update:function(e){this._setInvalid(e.invalid)}});

//# sourceURL=build://paper-input/paper-input.html.js
Polymer({is:"paper-input",behaviors:[Polymer.PaperInputBehavior,Polymer.IronFormElementBehavior],properties:{value:{type:String}},beforeRegister:function(){var e="function"==typeof document.createElement("iron-input")._initSlottedInput?"v1":"v0",r=Polymer.DomModule.import("paper-input","template");e=Polymer.DomModule.import("paper-input","template#"+e);(r=r.content.querySelector("#template-placeholder"))&&r.parentNode.replaceChild(e.content,r)},get _focusableElement(){return Polymer.Element?this.inputElement._inputElement:
this.inputElement},listeners:{"iron-input-ready":"_onIronInputReady"},_onIronInputReady:function(){this.$.nativeInput||(this.$.nativeInput=this.$$("input"));this.inputElement&&-1!==this._typesThatHaveText.indexOf(this.$.nativeInput.type)&&(this.alwaysFloatLabel=!0);this.inputElement.bindValue&&this.$.container._handleValueAndAutoValidate(this.inputElement)}});

//# sourceURL=build://paper-item/paper-item-behavior.html.js
Polymer.PaperItemBehaviorImpl={hostAttributes:{role:"option",tabindex:"0"}};Polymer.PaperItemBehavior=[Polymer.IronButtonState,Polymer.IronControlState,Polymer.PaperItemBehaviorImpl];

//# sourceURL=build://paper-item/paper-item.html.js
Polymer({is:"paper-item",behaviors:[Polymer.PaperItemBehavior]});

//# sourceURL=build://iron-selector/iron-selection.html.js
Polymer.IronSelection=function(e){this.selection=[];this.selectCallback=e};
Polymer.IronSelection.prototype={get:function(){return this.multi?this.selection.slice():this.selection[0]},clear:function(e){this.selection.slice().forEach(function(r){(!e||0>e.indexOf(r))&&this.setItemSelected(r,!1)},this)},isSelected:function(e){return 0<=this.selection.indexOf(e)},setItemSelected:function(e,r){if(null!=e&&r!==this.isSelected(e)){if(r)this.selection.push(e);else{var k=this.selection.indexOf(e);0<=k&&this.selection.splice(k,1)}this.selectCallback&&this.selectCallback(e,r)}},select:function(e){this.multi?
this.toggle(e):this.get()!==e&&(this.setItemSelected(this.get(),!1),this.setItemSelected(e,!0))},toggle:function(e){this.setItemSelected(e,!this.isSelected(e))}};

//# sourceURL=build://iron-selector/iron-selectable.html.js
Polymer.IronSelectableBehavior={properties:{attrForSelected:{type:String,value:null},selected:{type:String,notify:!0},selectedItem:{type:Object,readOnly:!0,notify:!0},activateEvent:{type:String,value:"tap",observer:"_activateEventChanged"},selectable:String,selectedClass:{type:String,value:"iron-selected"},selectedAttribute:{type:String,value:null},fallbackSelection:{type:String,value:null},items:{type:Array,readOnly:!0,notify:!0,value:function(){return[]}},_excludedLocalNames:{type:Object,value:function(){return{template:1,
"dom-bind":1,"dom-if":1,"dom-repeat":1}}}},observers:["_updateAttrForSelected(attrForSelected)","_updateSelected(selected)","_checkFallback(fallbackSelection)"],created:function(){this._bindFilterItem=this._filterItem.bind(this);this._selection=new Polymer.IronSelection(this._applySelection.bind(this))},attached:function(){this._observer=this._observeItems(this);this._addListener(this.activateEvent)},detached:function(){this._observer&&Polymer.dom(this).unobserveNodes(this._observer);this._removeListener(this.activateEvent)},
indexOf:function(e){return this.items?this.items.indexOf(e):-1},select:function(e){this.selected=e},selectPrevious:function(){var e=this.items.length;e=(Number(this._valueToIndex(this.selected))-1+e)%e;this.selected=this._indexToValue(e)},selectNext:function(){var e=(Number(this._valueToIndex(this.selected))+1)%this.items.length;this.selected=this._indexToValue(e)},selectIndex:function(e){this.select(this._indexToValue(e))},forceSynchronousItemUpdate:function(){this._observer&&"function"===typeof this._observer.flush?
this._observer.flush():this._updateItems()},get _shouldUpdateSelection(){return null!=this.selected},_checkFallback:function(){this._updateSelected()},_addListener:function(e){this.listen(this,e,"_activateHandler")},_removeListener:function(e){this.unlisten(this,e,"_activateHandler")},_activateEventChanged:function(e,r){this._removeListener(r);this._addListener(e)},_updateItems:function(){var e=Polymer.dom(this).queryDistributedElements(this.selectable||"*");e=Array.prototype.filter.call(e,this._bindFilterItem);
this._setItems(e)},_updateAttrForSelected:function(){this.selectedItem&&(this.selected=this._valueForItem(this.selectedItem))},_updateSelected:function(){this._selectSelected(this.selected)},_selectSelected:function(){if(this.items){var e=this._valueToItem(this.selected);e?this._selection.select(e):this._selection.clear();this.fallbackSelection&&this.items.length&&void 0===this._selection.get()&&(this.selected=this.fallbackSelection)}},_filterItem:function(e){return!this._excludedLocalNames[e.localName]},
_valueToItem:function(e){return null==e?null:this.items[this._valueToIndex(e)]},_valueToIndex:function(e){if(this.attrForSelected)for(var r=0,k;k=this.items[r];r++){if(this._valueForItem(k)==e)return r}else return Number(e)},_indexToValue:function(e){if(this.attrForSelected){if(e=this.items[e])return this._valueForItem(e)}else return e},_valueForItem:function(e){if(!e)return null;if(!this.attrForSelected)return e=this.indexOf(e),-1===e?null:e;var r=e[Polymer.CaseMap.dashToCamelCase(this.attrForSelected)];
return void 0!=r?r:e.getAttribute(this.attrForSelected)},_applySelection:function(e,r){this.selectedClass&&this.toggleClass(this.selectedClass,r,e);this.selectedAttribute&&this.toggleAttribute(this.selectedAttribute,r,e);this._selectionChange();this.fire("iron-"+(r?"select":"deselect"),{item:e})},_selectionChange:function(){this._setSelectedItem(this._selection.get())},_observeItems:function(e){return Polymer.dom(e).observeNodes(function(r){this._updateItems();this._updateSelected();this.fire("iron-items-changed",
r,{bubbles:!1,cancelable:!1})})},_activateHandler:function(e){e=e.target;for(var r=this.items;e&&e!=this;){var k=r.indexOf(e);if(0<=k){r=this._indexToValue(k);this._itemActivate(r,e);break}e=e.parentNode}},_itemActivate:function(e,r){this.fire("iron-activate",{selected:e,item:r},{cancelable:!0}).defaultPrevented||this.select(e)}};

//# sourceURL=build://iron-selector/iron-multi-selectable.html.js
Polymer.IronMultiSelectableBehaviorImpl={properties:{multi:{type:Boolean,value:!1,observer:"multiChanged"},selectedValues:{type:Array,notify:!0,value:function(){return[]}},selectedItems:{type:Array,readOnly:!0,notify:!0,value:function(){return[]}}},observers:["_updateSelected(selectedValues.splices)"],select:function(e){this.multi?this._toggleSelected(e):this.selected=e},multiChanged:function(e){this._selection.multi=e;this._updateSelected()},get _shouldUpdateSelection(){return null!=this.selected||
null!=this.selectedValues&&this.selectedValues.length},_updateAttrForSelected:function(){this.multi?this.selectedItems&&0<this.selectedItems.length&&(this.selectedValues=this.selectedItems.map(function(e){return this._indexToValue(this.indexOf(e))},this).filter(function(e){return null!=e},this)):Polymer.IronSelectableBehavior._updateAttrForSelected.apply(this)},_updateSelected:function(){this.multi?this._selectMulti(this.selectedValues):this._selectSelected(this.selected)},_selectMulti:function(e){e=
e||[];e=(this._valuesToItems(e)||[]).filter(function(k){return null!==k&&void 0!==k});this._selection.clear(e);for(var r=0;r<e.length;r++)this._selection.setItemSelected(e[r],!0);this.fallbackSelection&&!this._selection.get().length&&this._valueToItem(this.fallbackSelection)&&this.select(this.fallbackSelection)},_selectionChange:function(){var e=this._selection.get();this.multi?(this._setSelectedItems(e),this._setSelectedItem(e.length?e[0]:null)):null!==e&&void 0!==e?(this._setSelectedItems([e]),
this._setSelectedItem(e)):(this._setSelectedItems([]),this._setSelectedItem(null))},_toggleSelected:function(e){var r=this.selectedValues.indexOf(e);0>r?this.push("selectedValues",e):this.splice("selectedValues",r,1)},_valuesToItems:function(e){return null==e?null:e.map(function(r){return this._valueToItem(r)},this)}};Polymer.IronMultiSelectableBehavior=[Polymer.IronSelectableBehavior,Polymer.IronMultiSelectableBehaviorImpl];

//# sourceURL=build://iron-menu-behavior/iron-menu-behavior.html.js
Polymer.IronMenuBehaviorImpl={properties:{focusedItem:{observer:"_focusedItemChanged",readOnly:!0,type:Object},attrForItemTitle:{type:String},disabled:{type:Boolean,value:!1,observer:"_disabledChanged"}},_MODIFIER_KEYS:"Alt AltGraph CapsLock Control Fn FnLock Hyper Meta NumLock OS ScrollLock Shift Super Symbol SymbolLock".split(" "),_SEARCH_RESET_TIMEOUT_MS:1E3,_previousTabIndex:0,hostAttributes:{role:"menu"},observers:["_updateMultiselectable(multi)"],listeners:{focus:"_onFocus",keydown:"_onKeydown",
"iron-items-changed":"_onIronItemsChanged"},keyBindings:{up:"_onUpKey",down:"_onDownKey",esc:"_onEscKey","shift+tab:keydown":"_onShiftTabDown"},attached:function(){this._resetTabindices()},select:function(e){this._defaultFocusAsync&&(this.cancelAsync(this._defaultFocusAsync),this._defaultFocusAsync=null);var r=this._valueToItem(e);r&&r.hasAttribute("disabled")||(this._setFocusedItem(r),Polymer.IronMultiSelectableBehaviorImpl.select.apply(this,arguments))},_resetTabindices:function(){var e=this.multi?
this.selectedItems&&this.selectedItems[0]:this.selectedItem;this.items.forEach(function(r){r.setAttribute("tabindex",r===e?"0":"-1")},this)},_updateMultiselectable:function(e){e?this.setAttribute("aria-multiselectable","true"):this.removeAttribute("aria-multiselectable")},_focusWithKeyboardEvent:function(e){if(-1===this._MODIFIER_KEYS.indexOf(e.key)){this.cancelDebouncer("_clearSearchText");var r=this._searchText||"";r+=(e.key&&1==e.key.length?e.key:String.fromCharCode(e.keyCode)).toLocaleLowerCase();
e=r.length;for(var k=0,n;n=this.items[k];k++)if(!n.hasAttribute("disabled")){var p=this.attrForItemTitle||"textContent";p=(n[p]||n.getAttribute(p)||"").trim();if(!(p.length<e)&&p.slice(0,e).toLocaleLowerCase()==r){this._setFocusedItem(n);break}}this._searchText=r;this.debounce("_clearSearchText",this._clearSearchText,this._SEARCH_RESET_TIMEOUT_MS)}},_clearSearchText:function(){this._searchText=""},_focusPrevious:function(){for(var e=this.items.length,r=Number(this.indexOf(this.focusedItem)),k=1;k<
e+1;k++){var n=this.items[(r-k+e)%e];if(!n.hasAttribute("disabled")){var p=Polymer.dom(n).getOwnerRoot()||document;this._setFocusedItem(n);if(Polymer.dom(p).activeElement==n)break}}},_focusNext:function(){for(var e=this.items.length,r=Number(this.indexOf(this.focusedItem)),k=1;k<e+1;k++){var n=this.items[(r+k)%e];if(!n.hasAttribute("disabled")){var p=Polymer.dom(n).getOwnerRoot()||document;this._setFocusedItem(n);if(Polymer.dom(p).activeElement==n)break}}},_applySelection:function(e,r){r?e.setAttribute("aria-selected",
"true"):e.removeAttribute("aria-selected");Polymer.IronSelectableBehavior._applySelection.apply(this,arguments)},_focusedItemChanged:function(e,r){r&&r.setAttribute("tabindex","-1");!e||e.hasAttribute("disabled")||this.disabled||(e.setAttribute("tabindex","0"),e.focus())},_onIronItemsChanged:function(e){e.detail.addedNodes.length&&this._resetTabindices()},_onShiftTabDown:function(){var e=this.getAttribute("tabindex");Polymer.IronMenuBehaviorImpl._shiftTabPressed=!0;this._setFocusedItem(null);this.setAttribute("tabindex",
"-1");this.async(function(){this.setAttribute("tabindex",e);Polymer.IronMenuBehaviorImpl._shiftTabPressed=!1},1)},_onFocus:function(e){!Polymer.IronMenuBehaviorImpl._shiftTabPressed&&(e=Polymer.dom(e).rootTarget,e===this||"undefined"===typeof e.tabIndex||this.isLightDescendant(e))&&(this._defaultFocusAsync=this.async(function(){var r=this.multi?this.selectedItems&&this.selectedItems[0]:this.selectedItem;this._setFocusedItem(null);r?this._setFocusedItem(r):this.items[0]&&this._focusNext()}))},_onUpKey:function(e){this._focusPrevious();
e.detail.keyboardEvent.preventDefault()},_onDownKey:function(e){this._focusNext();e.detail.keyboardEvent.preventDefault()},_onEscKey:function(){var e=this.focusedItem;e&&e.blur()},_onKeydown:function(e){this.keyboardEventMatchesKeys(e,"up down esc")||this._focusWithKeyboardEvent(e);e.stopPropagation()},_activateHandler:function(e){Polymer.IronSelectableBehavior._activateHandler.call(this,e);e.stopPropagation()},_disabledChanged:function(e){e?(this._previousTabIndex=this.hasAttribute("tabindex")?this.tabIndex:
0,this.removeAttribute("tabindex")):this.hasAttribute("tabindex")||this.setAttribute("tabindex",this._previousTabIndex)}};Polymer.IronMenuBehaviorImpl._shiftTabPressed=!1;Polymer.IronMenuBehavior=[Polymer.IronMultiSelectableBehavior,Polymer.IronA11yKeysBehavior,Polymer.IronMenuBehaviorImpl];

//# sourceURL=build://paper-listbox/paper-listbox.html.js
(function(){Polymer({is:"paper-listbox",behaviors:[Polymer.IronMenuBehavior],hostAttributes:{role:"listbox"}})})();

//# sourceURL=build://paper-spinner/paper-spinner-behavior.html.js
Polymer.PaperSpinnerBehavior={properties:{active:{type:Boolean,value:!1,reflectToAttribute:!0,observer:"__activeChanged"},alt:{type:String,value:"loading",observer:"__altChanged"},__coolingDown:{type:Boolean,value:!1}},__computeContainerClasses:function(e,r){return[e||r?"active":"",r?"cooldown":""].join(" ")},__activeChanged:function(e,r){this.__setAriaHidden(!e);this.__coolingDown=!e&&r},__altChanged:function(e){"loading"===e?this.alt=this.getAttribute("aria-label")||e:(this.__setAriaHidden(""===
e),this.setAttribute("aria-label",e))},__setAriaHidden:function(e){e?this.setAttribute("aria-hidden","true"):this.removeAttribute("aria-hidden")},__reset:function(){this.__coolingDown=this.active=!1}};

//# sourceURL=build://paper-spinner/paper-spinner-lite.html.js
Polymer({is:"paper-spinner-lite",behaviors:[Polymer.PaperSpinnerBehavior]});

//# sourceURL=build://paper-toast/paper-toast.html.js
(function(){var e=null;Polymer({is:"paper-toast",behaviors:[Polymer.IronOverlayBehavior],properties:{fitInto:{type:Object,value:window,observer:"_onFitIntoChanged"},horizontalAlign:{type:String,value:"left"},verticalAlign:{type:String,value:"bottom"},duration:{type:Number,value:3E3},text:{type:String,value:""},noCancelOnOutsideClick:{type:Boolean,value:!0},noAutoFocus:{type:Boolean,value:!0}},listeners:{transitionend:"__onTransitionEnd"},get visible(){Polymer.Base._warn("`visible` is deprecated, use `opened` instead");
return this.opened},get _canAutoClose(){return 0<this.duration&&Infinity!==this.duration},created:function(){this._autoClose=null;Polymer.IronA11yAnnouncer.requestAvailability()},show:function(r){"string"==typeof r&&(r={text:r});for(var k in r)0===k.indexOf("_")?Polymer.Base._warn('The property "'+k+'" is private and was not set.'):k in this?this[k]=r[k]:Polymer.Base._warn('The property "'+k+'" is not valid.');this.open()},hide:function(){this.close()},__onTransitionEnd:function(r){r&&r.target===
this&&"opacity"===r.propertyName&&(this.opened?this._finishRenderOpened():this._finishRenderClosed())},_openedChanged:function(){null!==this._autoClose&&(this.cancelAsync(this._autoClose),this._autoClose=null);this.opened?(e&&e!==this&&e.close(),e=this,this.fire("iron-announce",{text:this.text}),this._canAutoClose&&(this._autoClose=this.async(this.close,this.duration))):e===this&&(e=null);Polymer.IronOverlayBehaviorImpl._openedChanged.apply(this,arguments)},_renderOpened:function(){this.classList.add("paper-toast-open")},
_renderClosed:function(){this.classList.remove("paper-toast-open")},_onFitIntoChanged:function(r){this.positionTarget=r}})})();

//# sourceURL=build://paper-toggle-button/paper-toggle-button.html.js
Polymer({is:"paper-toggle-button",behaviors:[Polymer.PaperCheckedElementBehavior],hostAttributes:{role:"button","aria-pressed":"false",tabindex:0},properties:{},listeners:{track:"_ontrack"},attached:function(){Polymer.RenderStatus.afterNextRender(this,function(){Polymer.Gestures.setTouchAction(this,"pan-y")})},_ontrack:function(e){e=e.detail;"start"===e.state?this._trackStart(e):"track"===e.state?this._trackMove(e):"end"===e.state&&this._trackEnd(e)},_trackStart:function(){this._width=this.$.toggleBar.offsetWidth/
2;this._trackChecked=this.checked;this.$.toggleButton.classList.add("dragging")},_trackMove:function(e){e=e.dx;this._x=Math.min(this._width,Math.max(0,this._trackChecked?this._width+e:e));this.translate3d(this._x+"px",0,0,this.$.toggleButton);this._userActivate(this._x>this._width/2)},_trackEnd:function(){this.$.toggleButton.classList.remove("dragging");this.transform("",this.$.toggleButton)},_createRipple:function(){this._rippleContainer=this.$.toggleButton;var e=Polymer.PaperRippleBehavior._createRipple();
e.id="ink";e.setAttribute("recenters","");e.classList.add("circle","toggle-ink");return e}});

//# sourceURL=build://paper-tooltip/paper-tooltip.html.js
Polymer({is:"paper-tooltip",hostAttributes:{role:"tooltip",tabindex:-1},properties:{for:{type:String,observer:"_findTarget"},manualMode:{type:Boolean,value:!1,observer:"_manualModeChanged"},position:{type:String,value:"bottom"},fitToVisibleBounds:{type:Boolean,value:!1},offset:{type:Number,value:14},marginTop:{type:Number,value:14},animationDelay:{type:Number,value:500,observer:"_delayChange"},animationEntry:{type:String,value:""},animationExit:{type:String,value:""},animationConfig:{type:Object,
value:function(){return{entry:[{name:"fade-in-animation",node:this,timing:{delay:0}}],exit:[{name:"fade-out-animation",node:this}]}}},_showing:{type:Boolean,value:!1}},listeners:{webkitAnimationEnd:"_onAnimationEnd"},get target(){var e=Polymer.dom(this).parentNode,r=Polymer.dom(this).getOwnerRoot();return this.for?Polymer.dom(r).querySelector("#"+this.for):e.nodeType==Node.DOCUMENT_FRAGMENT_NODE?r.host:e},attached:function(){this._findTarget()},detached:function(){this.manualMode||this._removeListeners()},
playAnimation:function(e){"entry"===e?this.show():"exit"===e&&this.hide()},cancelAnimation:function(){this.$.tooltip.classList.add("cancel-animation")},show:function(){if(!this._showing){if(""===Polymer.dom(this).textContent.trim()){for(var e=!0,r=Polymer.dom(this).getEffectiveChildNodes(),k=0;k<r.length;k++)if(""!==r[k].textContent.trim()){e=!1;break}if(e)return}this._showing=!0;this.$.tooltip.classList.remove("hidden");this.$.tooltip.classList.remove("cancel-animation");this.$.tooltip.classList.remove(this._getAnimationType("exit"));
this.updatePosition();this._animationPlaying=!0;this.$.tooltip.classList.add(this._getAnimationType("entry"))}},hide:function(){this._showing&&(this._animationPlaying?(this._showing=!1,this._cancelAnimation()):(this._onAnimationFinish(),this._showing=!1,this._animationPlaying=!0))},updatePosition:function(){if(this._target&&this.offsetParent){var e=this.offset;14!=this.marginTop&&14==this.offset&&(e=this.marginTop);var r=this.offsetParent.getBoundingClientRect(),k=this._target.getBoundingClientRect(),
n=this.getBoundingClientRect(),p=(k.width-n.width)/2,v=(k.height-n.height)/2,z=k.left-r.left,E=k.top-r.top;switch(this.position){case "top":var t=z+p;var x=E-n.height-e;break;case "bottom":t=z+p;x=E+k.height+e;break;case "left":t=z-n.width-e;x=E+v;break;case "right":t=z+k.width+e,x=E+v}this.fitToVisibleBounds?(r.left+t+n.width>window.innerWidth?(this.style.right="0px",this.style.left="auto"):(this.style.left=Math.max(0,t)+"px",this.style.right="auto"),r.top+x+n.height>window.innerHeight?(this.style.bottom=
r.height+"px",this.style.top="auto"):(this.style.top=Math.max(-r.top,x)+"px",this.style.bottom="auto")):(this.style.left=t+"px",this.style.top=x+"px")}},_addListeners:function(){this._target&&(this.listen(this._target,"mouseenter","show"),this.listen(this._target,"focus","show"),this.listen(this._target,"mouseleave","hide"),this.listen(this._target,"blur","hide"),this.listen(this._target,"tap","hide"));this.listen(this.$.tooltip,"animationend","_onAnimationEnd");this.listen(this,"mouseenter","hide")},
_findTarget:function(){this.manualMode||this._removeListeners();this._target=this.target;this.manualMode||this._addListeners()},_delayChange:function(e){500!==e&&this.updateStyles({"--paper-tooltip-delay-in":e+"ms"})},_manualModeChanged:function(){this.manualMode?this._removeListeners():this._addListeners()},_cancelAnimation:function(){this.$.tooltip.classList.remove(this._getAnimationType("entry"));this.$.tooltip.classList.remove(this._getAnimationType("exit"));this.$.tooltip.classList.remove("cancel-animation");
this.$.tooltip.classList.add("hidden")},_onAnimationFinish:function(){this._showing&&(this.$.tooltip.classList.remove(this._getAnimationType("entry")),this.$.tooltip.classList.remove("cancel-animation"),this.$.tooltip.classList.add(this._getAnimationType("exit")))},_onAnimationEnd:function(){this._animationPlaying=!1;this._showing||(this.$.tooltip.classList.remove(this._getAnimationType("exit")),this.$.tooltip.classList.add("hidden"))},_getAnimationType:function(e){if("entry"===e&&""!==this.animationEntry)return this.animationEntry;
if("exit"===e&&""!==this.animationExit)return this.animationExit;if(this.animationConfig[e]&&"string"===typeof this.animationConfig[e][0].name){if(this.animationConfig[e][0].timing&&this.animationConfig[e][0].timing.delay&&0!==this.animationConfig[e][0].timing.delay){var r=this.animationConfig[e][0].timing.delay;"entry"===e?this.updateStyles({"--paper-tooltip-delay-in":r+"ms"}):"exit"===e&&this.updateStyles({"--paper-tooltip-delay-out":r+"ms"})}return this.animationConfig[e][0].name}},_removeListeners:function(){this._target&&
(this.unlisten(this._target,"mouseenter","show"),this.unlisten(this._target,"focus","show"),this.unlisten(this._target,"mouseleave","hide"),this.unlisten(this._target,"blur","hide"),this.unlisten(this._target,"tap","hide"));this.unlisten(this.$.tooltip,"animationend","_onAnimationEnd");this.unlisten(this,"mouseenter","hide")}});

//# sourceURL=build://tf-imports/three.js
(function(e,r){"object"===typeof exports&&"undefined"!==typeof module?r(exports):"function"===typeof define&&define.amd?define(["exports"],r):(e=e||self,r(e.THREE={}))})(this,function(e){function r(){}function k(a,b){this.x=a||0;this.y=b||0}function n(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._w=void 0!==d?d:1}function p(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0}function v(){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.")}
function z(a,b,c,d,f,g,h,l,m,q){Object.defineProperty(this,"id",{value:hk++});this.uuid=Qa.generateUUID();this.name="";this.image=void 0!==a?a:z.DEFAULT_IMAGE;this.mipmaps=[];this.mapping=void 0!==b?b:z.DEFAULT_MAPPING;this.wrapS=void 0!==c?c:1001;this.wrapT=void 0!==d?d:1001;this.magFilter=void 0!==f?f:1006;this.minFilter=void 0!==g?g:1008;this.anisotropy=void 0!==m?m:1;this.format=void 0!==h?h:1023;this.type=void 0!==l?l:1009;this.offset=new k(0,0);this.repeat=new k(1,1);this.center=new k(0,0);
this.rotation=0;this.matrixAutoUpdate=!0;this.matrix=new v;this.generateMipmaps=!0;this.premultiplyAlpha=!1;this.flipY=!0;this.unpackAlignment=4;this.encoding=void 0!==q?q:3E3;this.version=0;this.onUpdate=null}function E(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1}function t(a,b,c){this.width=a;this.height=b;this.scissor=new E(0,0,a,b);this.scissorTest=!1;this.viewport=new E(0,0,a,b);c=c||{};this.texture=new z(void 0,void 0,c.wrapS,c.wrapT,c.magFilter,c.minFilter,c.format,c.type,
c.anisotropy,c.encoding);this.texture.image={};this.texture.image.width=a;this.texture.image.height=b;this.texture.generateMipmaps=void 0!==c.generateMipmaps?c.generateMipmaps:!1;this.texture.minFilter=void 0!==c.minFilter?c.minFilter:1006;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.depthTexture=void 0!==c.depthTexture?c.depthTexture:null}function x(a,b,c){t.call(this,a,b,c);this.samples=4}function A(){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 F(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._order=d||F.DefaultOrder}function N(){this.mask=1}function I(){Object.defineProperty(this,"id",{value:ik++});this.uuid=Qa.generateUUID();this.name="";this.type="Object3D";this.parent=null;this.children=[];this.up=I.DefaultUp.clone();var a=new p,b=new F,c=new n,d=new p(1,1,1);b._onChange(function(){c.setFromEuler(b,
!1)});c._onChange(function(){b.setFromQuaternion(c,void 0,!1)});Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:a},rotation:{configurable:!0,enumerable:!0,value:b},quaternion:{configurable:!0,enumerable:!0,value:c},scale:{configurable:!0,enumerable:!0,value:d},modelViewMatrix:{value:new A},normalMatrix:{value:new v}});this.matrix=new A;this.matrixWorld=new A;this.matrixAutoUpdate=I.DefaultMatrixAutoUpdate;this.matrixWorldNeedsUpdate=!1;this.layers=new N;this.visible=!0;
this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this.renderOrder=0;this.userData={}}function aa(){I.call(this);this.type="Scene";this.overrideMaterial=this.fog=this.background=null;this.autoUpdate=!0;"undefined"!==typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function G(a,b){this.min=void 0!==a?a:new p(Infinity,Infinity,Infinity);this.max=void 0!==b?b:new p(-Infinity,-Infinity,-Infinity)}function P(a,b,c,d,f){var g;var h=0;for(g=
a.length-3;h<=g;h+=3){xd.fromArray(a,h);var l=f.x*Math.abs(xd.x)+f.y*Math.abs(xd.y)+f.z*Math.abs(xd.z),m=b.dot(xd),q=c.dot(xd),u=d.dot(xd);if(Math.max(-Math.max(m,q,u),Math.min(m,q,u))>l)return!1}return!0}function U(a,b){this.center=void 0!==a?a:new p;this.radius=void 0!==b?b:0}function ba(a,b){this.origin=void 0!==a?a:new p;this.direction=void 0!==b?b:new p}function ja(a,b,c){this.a=void 0!==a?a:new p;this.b=void 0!==b?b:new p;this.c=void 0!==c?c:new p}function ca(a,b,c){return void 0===b&&void 0===
c?this.set(a):this.setRGB(a,b,c)}function ya(a,b,c){0>c&&(c+=1);1<c&&--c;return c<1/6?a+6*(b-a)*c:.5>c?b:c<2/3?a+6*(b-a)*(2/3-c):a}function Na(a){return.04045>a?.0773993808*a:Math.pow(.9478672986*a+.0521327014,2.4)}function $a(a){return.0031308>a?12.92*a:1.055*Math.pow(a,.41666)-.055}function mb(a,b,c,d,f,g){this.a=a;this.b=b;this.c=c;this.normal=d&&d.isVector3?d:new p;this.vertexNormals=Array.isArray(d)?d:[];this.color=f&&f.isColor?f:new ca;this.vertexColors=Array.isArray(f)?f:[];this.materialIndex=
void 0!==g?g:0}function xa(){Object.defineProperty(this,"id",{value:jk++});this.uuid=Qa.generateUUID();this.name="";this.type="Material";this.lights=this.fog=!0;this.blending=1;this.side=0;this.vertexTangents=this.flatShading=!1;this.vertexColors=0;this.opacity=1;this.transparent=!1;this.blendSrc=204;this.blendDst=205;this.blendEquation=100;this.blendEquationAlpha=this.blendDstAlpha=this.blendSrcAlpha=null;this.depthFunc=3;this.depthWrite=this.depthTest=!0;this.stencilFunc=519;this.stencilRef=0;this.stencilMask=
255;this.stencilZPass=this.stencilZFail=this.stencilFail=7680;this.stencilWrite=!1;this.clippingPlanes=null;this.clipShadows=this.clipIntersection=!1;this.shadowSide=null;this.colorWrite=!0;this.precision=null;this.polygonOffset=!1;this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.dithering=!1;this.alphaTest=0;this.premultipliedAlpha=!1;this.toneMapped=this.visible=!0;this.userData={};this.needsUpdate=!0}function gb(a){xa.call(this);this.type="MeshBasicMaterial";this.color=new ca(16777215);
this.lightMap=this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.envMap=this.alphaMap=this.specularMap=null;this.combine=0;this.reflectivity=1;this.refractionRatio=.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.lights=this.morphTargets=this.skinning=!1;this.setValues(a)}function Ea(a,b,c){if(Array.isArray(a))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="";this.array=
a;this.itemSize=b;this.count=void 0!==a?a.length/b:0;this.normalized=!0===c;this.dynamic=!1;this.updateRange={offset:0,count:-1};this.version=0}function Eb(a,b,c){Ea.call(this,new Int8Array(a),b,c)}function nb(a,b,c){Ea.call(this,new Uint8Array(a),b,c)}function Mb(a,b,c){Ea.call(this,new Uint8ClampedArray(a),b,c)}function gc(a,b,c){Ea.call(this,new Int16Array(a),b,c)}function $b(a,b,c){Ea.call(this,new Uint16Array(a),b,c)}function Bc(a,b,c){Ea.call(this,new Int32Array(a),b,c)}function Cb(a,b,c){Ea.call(this,
new Uint32Array(a),b,c)}function ia(a,b,c){Ea.call(this,new Float32Array(a),b,c)}function ub(a,b,c){Ea.call(this,new Float64Array(a),b,c)}function S(){this.vertices=[];this.normals=[];this.colors=[];this.uvs=[];this.uvs2=[];this.groups=[];this.morphTargets={};this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.groupsNeedUpdate=this.uvsNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.verticesNeedUpdate=!1}function Qb(a){if(0===a.length)return-Infinity;
for(var b=a[0],c=1,d=a.length;c<d;++c)a[c]>b&&(b=a[c]);return b}function la(){Object.defineProperty(this,"id",{value:kk+=2});this.uuid=Qa.generateUUID();this.name="";this.type="BufferGeometry";this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;this.drawRange={start:0,count:Infinity};this.userData={}}function Oa(a,b){I.call(this);this.type="Mesh";this.geometry=void 0!==a?a:new la;this.material=void 0!==b?b:new gb({color:16777215*Math.random()});
this.drawMode=0;this.updateMorphTargets()}function Ra(a,b,c,d,f,g,h,l){if(null===(1===b.side?d.intersectTriangle(h,g,f,!0,l):d.intersectTriangle(f,g,h,2!==b.side,l)))return null;bg.copy(l);bg.applyMatrix4(a.matrixWorld);b=c.ray.origin.distanceTo(bg);return b<c.near||b>c.far?null:{distance:b,point:bg.clone(),object:a}}function fb(a,b,c,d,f,g,h,l,m,q,u){yd.fromBufferAttribute(f,m);zd.fromBufferAttribute(f,q);Ad.fromBufferAttribute(f,u);f=a.morphTargetInfluences;if(b.morphTargets&&g&&f){nh.set(0,0,0);
oh.set(0,0,0);ph.set(0,0,0);for(var w=0,y=g.length;w<y;w++){var C=f[w],D=g[w];0!==C&&(zi.fromBufferAttribute(D,m),Ai.fromBufferAttribute(D,q),Bi.fromBufferAttribute(D,u),nh.addScaledVector(zi.sub(yd),C),oh.addScaledVector(Ai.sub(zd),C),ph.addScaledVector(Bi.sub(Ad),C))}yd.add(nh);zd.add(oh);Ad.add(ph)}if(a=Ra(a,b,c,d,yd,zd,Ad,bf))h&&(ae.fromBufferAttribute(h,m),be.fromBufferAttribute(h,q),ce.fromBufferAttribute(h,u),a.uv=ja.getUV(bf,yd,zd,Ad,ae,be,ce,new k)),l&&(ae.fromBufferAttribute(l,m),be.fromBufferAttribute(l,
q),ce.fromBufferAttribute(l,u),a.uv2=ja.getUV(bf,yd,zd,Ad,ae,be,ce,new k)),h=new mb(m,q,u),ja.getNormal(yd,zd,Ad,h.normal),a.face=h;return a}function Ia(){Object.defineProperty(this,"id",{value:lk+=2});this.uuid=Qa.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.boundingSphere=this.boundingBox=null;this.groupsNeedUpdate=
this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=this.verticesNeedUpdate=this.elementsNeedUpdate=!1}function ob(a,b,c,d,f,g){Ia.call(this);this.type="BoxGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:f,depthSegments:g};this.fromBufferGeometry(new vb(a,b,c,d,f,g));this.mergeVertices()}function vb(a,b,c,d,f,g){function h(D,K,J,W,T,V,Z,R,Y,ea,za){var Aa=V/Y,fa=Z/ea,ma=V/2,ha=Z/2,ra=R/2;Z=Y+1;var Ma=ea+1,cb=V=0,pa,Ka,Ta=new p;
for(Ka=0;Ka<Ma;Ka++){var jb=Ka*fa-ha;for(pa=0;pa<Z;pa++)Ta[D]=(pa*Aa-ma)*W,Ta[K]=jb*T,Ta[J]=ra,q.push(Ta.x,Ta.y,Ta.z),Ta[D]=0,Ta[K]=0,Ta[J]=0<R?1:-1,u.push(Ta.x,Ta.y,Ta.z),w.push(pa/Y),w.push(1-Ka/ea),V+=1}for(Ka=0;Ka<ea;Ka++)for(pa=0;pa<Y;pa++)D=y+pa+Z*(Ka+1),K=y+(pa+1)+Z*(Ka+1),J=y+(pa+1)+Z*Ka,m.push(y+pa+Z*Ka,D,J),m.push(D,K,J),cb+=6;l.addGroup(C,cb,za);C+=cb;y+=V}la.call(this);this.type="BoxBufferGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:f,depthSegments:g};
var l=this;a=a||1;b=b||1;c=c||1;d=Math.floor(d)||1;f=Math.floor(f)||1;g=Math.floor(g)||1;var m=[],q=[],u=[],w=[],y=0,C=0;h("z","y","x",-1,-1,c,b,a,g,f,0);h("z","y","x",1,-1,c,b,-a,g,f,1);h("x","z","y",1,1,a,c,b,d,g,2);h("x","z","y",1,-1,a,c,-b,d,g,3);h("x","y","z",1,-1,a,b,c,d,f,4);h("x","y","z",-1,-1,a,b,-c,d,f,5);this.setIndex(m);this.addAttribute("position",new ia(q,3));this.addAttribute("normal",new ia(u,3));this.addAttribute("uv",new ia(w,2))}function hc(a){var b={},c;for(c in a){b[c]={};for(var d in a[c]){var f=
a[c][d];b[c][d]=f&&(f.isColor||f.isMatrix3||f.isMatrix4||f.isVector2||f.isVector3||f.isVector4||f.isTexture)?f.clone():Array.isArray(f)?f.slice():f}}return b}function xb(a){for(var b={},c=0;c<a.length;c++){var d=hc(a[c]),f;for(f in d)b[f]=d[f]}return b}function yb(a){xa.call(this);this.type="ShaderMaterial";this.defines={};this.uniforms={};this.vertexShader="void main() {\n\tgl_Position \x3d projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}";this.fragmentShader="void main() {\n\tgl_FragColor \x3d vec4( 1.0, 0.0, 0.0, 1.0 );\n}";
this.linewidth=1;this.wireframe=!1;this.wireframeLinewidth=1;this.morphNormals=this.morphTargets=this.skinning=this.clipping=this.lights=this.fog=!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!==a&&(void 0!==a.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(a))}
function Fb(){I.call(this);this.type="Camera";this.matrixWorldInverse=new A;this.projectionMatrix=new A;this.projectionMatrixInverse=new A}function kb(a,b,c,d){Fb.call(this);this.type="PerspectiveCamera";this.fov=void 0!==a?a:50;this.zoom=1;this.near=void 0!==c?c:.1;this.far=void 0!==d?d:2E3;this.focus=10;this.aspect=void 0!==b?b:1;this.view=null;this.filmGauge=35;this.filmOffset=0;this.updateProjectionMatrix()}function ac(a,b,c,d){I.call(this);this.type="CubeCamera";var f=new kb(90,1,a,b);f.up.set(0,
-1,0);f.lookAt(new p(1,0,0));this.add(f);var g=new kb(90,1,a,b);g.up.set(0,-1,0);g.lookAt(new p(-1,0,0));this.add(g);var h=new kb(90,1,a,b);h.up.set(0,0,1);h.lookAt(new p(0,1,0));this.add(h);var l=new kb(90,1,a,b);l.up.set(0,0,-1);l.lookAt(new p(0,-1,0));this.add(l);var m=new kb(90,1,a,b);m.up.set(0,-1,0);m.lookAt(new p(0,0,1));this.add(m);var q=new kb(90,1,a,b);q.up.set(0,-1,0);q.lookAt(new p(0,0,-1));this.add(q);d=d||{format:1022,magFilter:1006,minFilter:1006};this.renderTarget=new Nb(c,c,d);this.renderTarget.texture.name=
"CubeCamera";this.update=function(u,w){null===this.parent&&this.updateMatrixWorld();var y=u.getRenderTarget(),C=this.renderTarget,D=C.texture.generateMipmaps;C.texture.generateMipmaps=!1;u.setRenderTarget(C,0);u.render(w,f);u.setRenderTarget(C,1);u.render(w,g);u.setRenderTarget(C,2);u.render(w,h);u.setRenderTarget(C,3);u.render(w,l);u.setRenderTarget(C,4);u.render(w,m);C.texture.generateMipmaps=D;u.setRenderTarget(C,5);u.render(w,q);u.setRenderTarget(y)};this.clear=function(u,w,y,C){for(var D=u.getRenderTarget(),
K=this.renderTarget,J=0;6>J;J++)u.setRenderTarget(K,J),u.clear(w,y,C);u.setRenderTarget(D)}}function Nb(a,b,c){t.call(this,a,b,c)}function Rb(a,b,c,d,f,g,h,l,m,q,u,w){z.call(this,null,g,h,l,m,q,d,f,u,w);this.image={data:a,width:b,height:c};this.magFilter=void 0!==m?m:1003;this.minFilter=void 0!==q?q:1003;this.flipY=this.generateMipmaps=!1;this.unpackAlignment=1}function Hb(a,b){this.normal=void 0!==a?a:new p(1,0,0);this.constant=void 0!==b?b:0}function ic(a,b,c,d,f,g){this.planes=[void 0!==a?a:new Hb,
void 0!==b?b:new Hb,void 0!==c?c:new Hb,void 0!==d?d:new Hb,void 0!==f?f:new Hb,void 0!==g?g:new Hb]}function Cc(){function a(f,g){!1!==c&&(d(f,g),b.requestAnimationFrame(a))}var b=null,c=!1,d=null;return{start:function(){!0!==c&&null!==d&&(b.requestAnimationFrame(a),c=!0)},stop:function(){c=!1},setAnimationLoop:function(f){d=f},setContext:function(f){b=f}}}function Bd(a){function b(f,g){var h=f.array,l=f.dynamic?35048:35044,m=a.createBuffer();a.bindBuffer(g,m);a.bufferData(g,h,l);f.onUploadCallback();
g=5126;h instanceof Float32Array?g=5126:h instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):h instanceof Uint16Array?g=5123:h instanceof Int16Array?g=5122:h instanceof Uint32Array?g=5125:h instanceof Int32Array?g=5124:h instanceof Int8Array?g=5120:h instanceof Uint8Array&&(g=5121);return{buffer:m,type:g,bytesPerElement:h.BYTES_PER_ELEMENT,version:f.version}}function c(f,g,h){var l=g.array,m=g.updateRange;a.bindBuffer(h,f);!1===g.dynamic?a.bufferData(h,
l,35044):-1===m.count?a.bufferSubData(h,0,l):0===m.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."):(a.bufferSubData(h,m.offset*l.BYTES_PER_ELEMENT,l.subarray(m.offset,m.offset+m.count)),m.count=-1)}var d=new WeakMap;return{get:function(f){f.isInterleavedBufferAttribute&&(f=f.data);return d.get(f)},remove:function(f){f.isInterleavedBufferAttribute&&(f=f.data);
var g=d.get(f);g&&(a.deleteBuffer(g.buffer),d.delete(f))},update:function(f,g){f.isInterleavedBufferAttribute&&(f=f.data);var h=d.get(f);void 0===h?d.set(f,b(f,g)):h.version<f.version&&(c(h.buffer,f,g),h.version=f.version)}}}function fd(a,b,c,d){Ia.call(this);this.type="PlaneGeometry";this.parameters={width:a,height:b,widthSegments:c,heightSegments:d};this.fromBufferGeometry(new Dc(a,b,c,d));this.mergeVertices()}function Dc(a,b,c,d){la.call(this);this.type="PlaneBufferGeometry";this.parameters={width:a,
height:b,widthSegments:c,heightSegments:d};a=a||1;b=b||1;var f=a/2,g=b/2;c=Math.floor(c)||1;d=Math.floor(d)||1;var h=c+1,l=d+1,m=a/c,q=b/d,u=[],w=[],y=[],C=[];for(a=0;a<l;a++){var D=a*q-g;for(b=0;b<h;b++)w.push(b*m-f,-D,0),y.push(0,0,1),C.push(b/c),C.push(1-a/d)}for(a=0;a<d;a++)for(b=0;b<c;b++)f=b+h*(a+1),g=b+1+h*(a+1),l=b+1+h*a,u.push(b+h*a,f,l),u.push(f,g,l);this.setIndex(u);this.addAttribute("position",new ia(w,3));this.addAttribute("normal",new ia(y,3));this.addAttribute("uv",new ia(C,2))}function gd(a,
b,c,d){function f(w,y){b.buffers.color.setClear(w.r,w.g,w.b,y,d)}var g=new ca(0),h=0,l,m,q=null,u=0;return{getClearColor:function(){return g},setClearColor:function(w,y){g.set(w);h=void 0!==y?y:1;f(g,h)},getClearAlpha:function(){return h},setClearAlpha:function(w){h=w;f(g,h)},render:function(w,y,C,D){y=y.background;C=a.vr;(C=C.getSession&&C.getSession())&&"additive"===C.environmentBlendMode&&(y=null);null===y?(f(g,h),q=null,u=0):y&&y.isColor&&(f(y,1),D=!0,q=null,u=0);(a.autoClear||D)&&a.clear(a.autoClearColor,
a.autoClearDepth,a.autoClearStencil);if(y&&(y.isCubeTexture||y.isWebGLRenderTargetCube)){void 0===m&&(m=new Oa(new vb(1,1,1),new yb({type:"BackgroundCubeMaterial",uniforms:hc(Ec.cube.uniforms),vertexShader:Ec.cube.vertexShader,fragmentShader:Ec.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),m.geometry.removeAttribute("normal"),m.geometry.removeAttribute("uv"),m.onBeforeRender=function(K,J,W){this.matrixWorld.copyPosition(W.matrixWorld)},Object.defineProperty(m.material,"map",{get:function(){return this.uniforms.tCube.value}}),
c.update(m));D=y.isWebGLRenderTargetCube?y.texture:y;m.material.uniforms.tCube.value=D;m.material.uniforms.tFlip.value=y.isWebGLRenderTargetCube?1:-1;if(q!==y||u!==D.version)m.material.needsUpdate=!0,q=y,u=D.version;w.unshift(m,m.geometry,m.material,0,0,null)}else if(y&&y.isTexture){void 0===l&&(l=new Oa(new Dc(2,2),new yb({type:"BackgroundMaterial",uniforms:hc(Ec.background.uniforms),vertexShader:Ec.background.vertexShader,fragmentShader:Ec.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,
fog:!1})),l.geometry.removeAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),c.update(l));l.material.uniforms.t2D.value=y;!0===y.matrixAutoUpdate&&y.updateMatrix();l.material.uniforms.uvTransform.value.copy(y.matrix);if(q!==y||u!==y.version)l.material.needsUpdate=!0,q=y,u=y.version;w.unshift(l,l.geometry,l.material,0,0,null)}}}}function X(a,b,c,d){var f;this.setMode=function(g){f=g};this.render=function(g,h){a.drawArrays(f,g,h);c.update(h,
f)};this.renderInstances=function(g,h,l){if(d.isWebGL2){var m=a;var q="drawArraysInstanced"}else if(m=b.get("ANGLE_instanced_arrays"),q="drawArraysInstancedANGLE",null===m){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}m[q](f,h,l,g.maxInstancedCount);c.update(l,f,g.maxInstancedCount)}}function tb(a,b,c){function d(V){if("highp"===V){if(0<a.getShaderPrecisionFormat(35633,36338).precision&&0<a.getShaderPrecisionFormat(35632,
36338).precision)return"highp";V="mediump"}return"mediump"===V&&0<a.getShaderPrecisionFormat(35633,36337).precision&&0<a.getShaderPrecisionFormat(35632,36337).precision?"mediump":"lowp"}var f,g="undefined"!==typeof WebGL2RenderingContext&&a instanceof WebGL2RenderingContext,h=void 0!==c.precision?c.precision:"highp",l=d(h);l!==h&&(console.warn("THREE.WebGLRenderer:",h,"not supported, using",l,"instead."),h=l);c=!0===c.logarithmicDepthBuffer;l=a.getParameter(34930);var m=a.getParameter(35660),q=a.getParameter(3379),
u=a.getParameter(34076),w=a.getParameter(34921),y=a.getParameter(36347),C=a.getParameter(36348),D=a.getParameter(36349),K=0<m,J=g||!!b.get("OES_texture_float"),W=K&&J,T=g?a.getParameter(36183):0;return{isWebGL2:g,getMaxAnisotropy:function(){if(void 0!==f)return f;var V=b.get("EXT_texture_filter_anisotropic");return f=null!==V?a.getParameter(V.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:d,precision:h,logarithmicDepthBuffer:c,maxTextures:l,maxVertexTextures:m,maxTextureSize:q,maxCubemapSize:u,
maxAttributes:w,maxVertexUniforms:y,maxVaryings:C,maxFragmentUniforms:D,vertexTextures:K,floatFragmentTextures:J,floatVertexTextures:W,maxSamples:T}}function mc(){function a(){q.value!==d&&(q.value=d,q.needsUpdate=0<f);c.numPlanes=f;c.numIntersection=0}function b(u,w,y,C){var D=null!==u?u.length:0,K=null;if(0!==D){K=q.value;if(!0!==C||null===K){C=y+4*D;w=w.matrixWorldInverse;m.getNormalMatrix(w);if(null===K||K.length<C)K=new Float32Array(C);for(C=0;C!==D;++C,y+=4)l.copy(u[C]).applyMatrix4(w,m),l.normal.toArray(K,
y),K[y+3]=l.constant}q.value=K;q.needsUpdate=!0}c.numPlanes=D;return K}var c=this,d=null,f=0,g=!1,h=!1,l=new Hb,m=new v,q={value:null,needsUpdate:!1};this.uniform=q;this.numIntersection=this.numPlanes=0;this.init=function(u,w,y){var C=0!==u.length||w||0!==f||g;g=w;d=b(u,y,0);f=u.length;return C};this.beginShadows=function(){h=!0;b(null)};this.endShadows=function(){h=!1;a()};this.setState=function(u,w,y,C,D,K){if(!g||null===u||0===u.length||h&&!y)h?b(null):a();else{y=h?0:f;var J=4*y,W=D.clippingState||
null;q.value=W;W=b(u,C,J,K);for(u=0;u!==J;++u)W[u]=d[u];D.clippingState=W;this.numIntersection=w?this.numPlanes:0;this.numPlanes+=y}}}function Sc(a){var b={};return{get:function(c){if(void 0!==b[c])return b[c];switch(c){case "WEBGL_depth_texture":var d=a.getExtension("WEBGL_depth_texture")||a.getExtension("MOZ_WEBGL_depth_texture")||a.getExtension("WEBKIT_WEBGL_depth_texture");break;case "EXT_texture_filter_anisotropic":d=a.getExtension("EXT_texture_filter_anisotropic")||a.getExtension("MOZ_EXT_texture_filter_anisotropic")||
a.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case "WEBGL_compressed_texture_s3tc":d=a.getExtension("WEBGL_compressed_texture_s3tc")||a.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case "WEBGL_compressed_texture_pvrtc":d=a.getExtension("WEBGL_compressed_texture_pvrtc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:d=a.getExtension(c)}null===d&&console.warn("THREE.WebGLRenderer: "+c+" extension not supported.");
return b[c]=d}}}function hd(a,b,c){function d(l){var m=l.target;l=g.get(m);null!==l.index&&b.remove(l.index);for(var q in l.attributes)b.remove(l.attributes[q]);m.removeEventListener("dispose",d);g.delete(m);if(q=h.get(l))b.remove(q),h.delete(l);c.memory.geometries--}function f(l){var m=[],q=l.index,u=l.attributes.position;if(null!==q){var w=q.array;q=q.version;u=0;for(var y=w.length;u<y;u+=3){var C=w[u+0],D=w[u+1],K=w[u+2];m.push(C,D,D,K,K,C)}}else for(w=u.array,q=u.version,u=0,y=w.length/3-1;u<
y;u+=3)C=u+0,D=u+1,K=u+2,m.push(C,D,D,K,K,C);m=new (65535<Qb(m)?Cb:$b)(m,1);m.version=q;b.update(m,34963);(w=h.get(l))&&b.remove(w);h.set(l,m)}var g=new WeakMap,h=new WeakMap;return{get:function(l,m){var q=g.get(m);if(q)return q;m.addEventListener("dispose",d);m.isBufferGeometry?q=m:m.isGeometry&&(void 0===m._bufferGeometry&&(m._bufferGeometry=(new la).setFromObject(l)),q=m._bufferGeometry);g.set(m,q);c.memory.geometries++;return q},update:function(l){var m=l.index,q=l.attributes;null!==m&&b.update(m,
34963);for(var u in q)b.update(q[u],34962);l=l.morphAttributes;for(u in l){m=l[u];q=0;for(var w=m.length;q<w;q++)b.update(m[q],34962)}},getWireframeAttribute:function(l){var m=h.get(l);if(m){var q=l.index;null!==q&&m.version<q.version&&f(l)}else f(l);return h.get(l)}}}function cg(a,b,c,d){var f,g,h;this.setMode=function(l){f=l};this.setIndex=function(l){g=l.type;h=l.bytesPerElement};this.render=function(l,m){a.drawElements(f,m,g,l*h);c.update(m,f)};this.renderInstances=function(l,m,q){if(d.isWebGL2){var u=
a;var w="drawElementsInstanced"}else if(u=b.get("ANGLE_instanced_arrays"),w="drawElementsInstancedANGLE",null===u){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}u[w](f,q,g,m*h,l.maxInstancedCount);c.update(q,f,l.maxInstancedCount)}}function mk(){var a={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:a,programs:null,autoReset:!0,reset:function(){a.frame++;
a.calls=0;a.triangles=0;a.points=0;a.lines=0},update:function(b,c,d){d=d||1;a.calls++;switch(c){case 4:a.triangles+=b/3*d;break;case 5:case 6:a.triangles+=d*(b-2);break;case 1:a.lines+=b/2*d;break;case 3:a.lines+=d*(b-1);break;case 2:a.lines+=d*b;break;case 0:a.points+=d*b;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",c)}}}}function nk(a,b){return Math.abs(b[1])-Math.abs(a[1])}function ok(a){var b={},c=new Float32Array(8);return{update:function(d,f,g,h){var l=d.morphTargetInfluences,
m=l.length;d=b[f.id];if(void 0===d){d=[];for(var q=0;q<m;q++)d[q]=[q,0];b[f.id]=d}var u=g.morphTargets&&f.morphAttributes.position;g=g.morphNormals&&f.morphAttributes.normal;for(q=0;q<m;q++){var w=d[q];0!==w[1]&&(u&&f.removeAttribute("morphTarget"+q),g&&f.removeAttribute("morphNormal"+q))}for(q=0;q<m;q++)w=d[q],w[0]=q,w[1]=l[q];d.sort(nk);for(q=0;8>q;q++){if(w=d[q])if(l=w[0],m=w[1]){u&&f.addAttribute("morphTarget"+q,u[l]);g&&f.addAttribute("morphNormal"+q,g[l]);c[q]=m;continue}c[q]=0}h.getUniforms().setValue(a,
"morphTargetInfluences",c)}}}function pk(a,b){var c={};return{update:function(d){var f=b.render.frame,g=d.geometry,h=a.get(d,g);c[h.id]!==f&&(g.isGeometry&&h.updateFromObject(d),a.update(h),c[h.id]=f);return h},dispose:function(){c={}}}}function Tc(a,b,c,d,f,g,h,l,m,q){a=void 0!==a?a:[];z.call(this,a,void 0!==b?b:301,c,d,f,g,void 0!==h?h:1022,l,m,q);this.flipY=!1}function de(a,b,c,d){z.call(this,null);this.image={data:a,width:b,height:c,depth:d};this.minFilter=this.magFilter=1003;this.wrapR=1001;
this.flipY=this.generateMipmaps=!1}function ee(a,b,c,d){z.call(this,null);this.image={data:a,width:b,height:c,depth:d};this.minFilter=this.magFilter=1003;this.wrapR=1001;this.flipY=this.generateMipmaps=!1}function fe(a,b,c){var d=a[0];if(0>=d||0<d)return a;var f=b*c,g=Ci[f];void 0===g&&(g=new Float32Array(f),Ci[f]=g);if(0!==b)for(d.toArray(g,0),d=1,f=0;d!==b;++d)f+=c,a[d].toArray(g,f);return g}function jc(a,b){if(a.length!==b.length)return!1;for(var c=0,d=a.length;c<d;c++)if(a[c]!==b[c])return!1;
return!0}function bc(a,b){for(var c=0,d=b.length;c<d;c++)a[c]=b[c]}function Di(a,b){var c=Ei[b];void 0===c&&(c=new Int32Array(b),Ei[b]=c);for(var d=0;d!==b;++d)c[d]=a.allocateTextureUnit();return c}function qk(a,b){var c=this.cache;c[0]!==b&&(a.uniform1f(this.addr,b),c[0]=b)}function rk(a,b){var c=this.cache;if(void 0!==b.x){if(c[0]!==b.x||c[1]!==b.y)a.uniform2f(this.addr,b.x,b.y),c[0]=b.x,c[1]=b.y}else jc(c,b)||(a.uniform2fv(this.addr,b),bc(c,b))}function sk(a,b){var c=this.cache;if(void 0!==b.x){if(c[0]!==
b.x||c[1]!==b.y||c[2]!==b.z)a.uniform3f(this.addr,b.x,b.y,b.z),c[0]=b.x,c[1]=b.y,c[2]=b.z}else if(void 0!==b.r){if(c[0]!==b.r||c[1]!==b.g||c[2]!==b.b)a.uniform3f(this.addr,b.r,b.g,b.b),c[0]=b.r,c[1]=b.g,c[2]=b.b}else jc(c,b)||(a.uniform3fv(this.addr,b),bc(c,b))}function tk(a,b){var c=this.cache;if(void 0!==b.x){if(c[0]!==b.x||c[1]!==b.y||c[2]!==b.z||c[3]!==b.w)a.uniform4f(this.addr,b.x,b.y,b.z,b.w),c[0]=b.x,c[1]=b.y,c[2]=b.z,c[3]=b.w}else jc(c,b)||(a.uniform4fv(this.addr,b),bc(c,b))}function uk(a,
b){var c=this.cache,d=b.elements;void 0===d?jc(c,b)||(a.uniformMatrix2fv(this.addr,!1,b),bc(c,b)):jc(c,d)||(Fi.set(d),a.uniformMatrix2fv(this.addr,!1,Fi),bc(c,d))}function vk(a,b){var c=this.cache,d=b.elements;void 0===d?jc(c,b)||(a.uniformMatrix3fv(this.addr,!1,b),bc(c,b)):jc(c,d)||(Gi.set(d),a.uniformMatrix3fv(this.addr,!1,Gi),bc(c,d))}function wk(a,b){var c=this.cache,d=b.elements;void 0===d?jc(c,b)||(a.uniformMatrix4fv(this.addr,!1,b),bc(c,b)):jc(c,d)||(Hi.set(d),a.uniformMatrix4fv(this.addr,
!1,Hi),bc(c,d))}function xk(a,b,c){var d=this.cache,f=c.allocateTextureUnit();d[0]!==f&&(a.uniform1i(this.addr,f),d[0]=f);c.safeSetTexture2D(b||Ii,f)}function yk(a,b,c){var d=this.cache,f=c.allocateTextureUnit();d[0]!==f&&(a.uniform1i(this.addr,f),d[0]=f);c.setTexture2DArray(b||zk,f)}function Ak(a,b,c){var d=this.cache,f=c.allocateTextureUnit();d[0]!==f&&(a.uniform1i(this.addr,f),d[0]=f);c.setTexture3D(b||Bk,f)}function Ck(a,b,c){var d=this.cache,f=c.allocateTextureUnit();d[0]!==f&&(a.uniform1i(this.addr,
f),d[0]=f);c.safeSetTextureCube(b||Ji,f)}function Dk(a,b){var c=this.cache;c[0]!==b&&(a.uniform1i(this.addr,b),c[0]=b)}function Ek(a,b){var c=this.cache;jc(c,b)||(a.uniform2iv(this.addr,b),bc(c,b))}function Fk(a,b){var c=this.cache;jc(c,b)||(a.uniform3iv(this.addr,b),bc(c,b))}function Gk(a,b){var c=this.cache;jc(c,b)||(a.uniform4iv(this.addr,b),bc(c,b))}function Hk(a){switch(a){case 5126:return qk;case 35664:return rk;case 35665:return sk;case 35666:return tk;case 35674:return uk;case 35675:return vk;
case 35676:return wk;case 35678:case 36198:return xk;case 35679:return Ak;case 35680:return Ck;case 36289:return yk;case 5124:case 35670:return Dk;case 35667:case 35671:return Ek;case 35668:case 35672:return Fk;case 35669:case 35673:return Gk}}function Ik(a,b){a.uniform1fv(this.addr,b)}function Jk(a,b){a.uniform1iv(this.addr,b)}function Kk(a,b){a.uniform2iv(this.addr,b)}function Lk(a,b){a.uniform3iv(this.addr,b)}function Mk(a,b){a.uniform4iv(this.addr,b)}function Nk(a,b){b=fe(b,this.size,2);a.uniform2fv(this.addr,
b)}function Ok(a,b){b=fe(b,this.size,3);a.uniform3fv(this.addr,b)}function Pk(a,b){b=fe(b,this.size,4);a.uniform4fv(this.addr,b)}function Qk(a,b){b=fe(b,this.size,4);a.uniformMatrix2fv(this.addr,!1,b)}function Rk(a,b){b=fe(b,this.size,9);a.uniformMatrix3fv(this.addr,!1,b)}function Sk(a,b){b=fe(b,this.size,16);a.uniformMatrix4fv(this.addr,!1,b)}function Tk(a,b,c){var d=b.length,f=Di(c,d);a.uniform1iv(this.addr,f);for(a=0;a!==d;++a)c.safeSetTexture2D(b[a]||Ii,f[a])}function Uk(a,b,c){var d=b.length,
f=Di(c,d);a.uniform1iv(this.addr,f);for(a=0;a!==d;++a)c.safeSetTextureCube(b[a]||Ji,f[a])}function Vk(a){switch(a){case 5126:return Ik;case 35664:return Nk;case 35665:return Ok;case 35666:return Pk;case 35674:return Qk;case 35675:return Rk;case 35676:return Sk;case 35678:return Tk;case 35680:return Uk;case 5124:case 35670:return Jk;case 35667:case 35671:return Kk;case 35668:case 35672:return Lk;case 35669:case 35673:return Mk}}function Wk(a,b,c){this.id=a;this.addr=c;this.cache=[];this.setValue=Hk(b.type)}
function Ki(a,b,c){this.id=a;this.addr=c;this.cache=[];this.size=b.size;this.setValue=Vk(b.type)}function Li(a){this.id=a;this.seq=[];this.map={}}function Mi(a,b){a.seq.push(b);a.map[b.id]=b}function Xk(a,b,c){var d=a.name,f=d.length;for(qh.lastIndex=0;;){var g=qh.exec(d),h=qh.lastIndex,l=g[1],m=g[3];"]"===g[2]&&(l|=0);if(void 0===m||"["===m&&h+2===f){Mi(c,void 0===m?new Wk(l,a,b):new Ki(l,a,b));break}else g=c.map[l],void 0===g&&(g=new Li(l),Mi(c,g)),c=g}}function id(a,b){this.seq=[];this.map={};
for(var c=a.getProgramParameter(b,35718),d=0;d<c;++d){var f=a.getActiveUniform(b,d);Xk(f,a.getUniformLocation(b,f.name),this)}}function Ni(a,b,c){b=a.createShader(b);a.shaderSource(b,c);a.compileShader(b);return b}function Yk(a){a=a.split("\n");for(var b=0;b<a.length;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function Oi(a){switch(a){case 3E3:return["Linear","( value )"];case 3001:return["sRGB","( value )"];case 3002:return["RGBE","( value )"];case 3004:return["RGBM","( value, 7.0 )"];case 3005:return["RGBM",
"( value, 16.0 )"];case 3006:return["RGBD","( value, 256.0 )"];case 3007:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case 3003:return["LogLuv","( value )"];default:throw Error("unsupported encoding: "+a);}}function Pi(a,b,c){var d=a.getShaderParameter(b,35713),f=a.getShaderInfoLog(b).trim();return d&&""===f?"":"THREE.WebGLShader: gl.getShaderInfoLog() "+c+"\n"+f+Yk(a.getShaderSource(b))}function dg(a,b){b=Oi(b);return"vec4 "+a+"( vec4 value ) { return "+b[0]+"ToLinear"+b[1]+"; }"}function Zk(a,
b){b=Oi(b);return"vec4 "+a+"( vec4 value ) { return LinearTo"+b[0]+b[1]+"; }"}function $k(a,b){switch(b){case 1:b="Linear";break;case 2:b="Reinhard";break;case 3:b="Uncharted2";break;case 4:b="OptimizedCineon";break;case 5:b="ACESFilmic";break;default:throw Error("unsupported toneMapping: "+b);}return"vec3 "+a+"( vec3 color ) { return "+b+"ToneMapping( color ); }"}function al(a,b,c){a=a||{};return[a.derivatives||b.envMapCubeUV||b.bumpMap||b.tangentSpaceNormalMap||b.clearcoatNormalMap||b.flatShading?
"#extension GL_OES_standard_derivatives : enable":"",(a.fragDepth||b.logarithmicDepthBuffer)&&c.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",a.drawBuffers&&c.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(a.shaderTextureLOD||b.envMap)&&c.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(cf).join("\n")}function bl(a){var b=[],c;for(c in a){var d=a[c];!1!==d&&b.push("#define "+c+" "+d)}return b.join("\n")}function cl(a,
b){for(var c={},d=a.getProgramParameter(b,35721),f=0;f<d;f++){var g=a.getActiveAttrib(b,f).name;c[g]=a.getAttribLocation(b,g)}return c}function cf(a){return""!==a}function Qi(a,b){return a.replace(/NUM_DIR_LIGHTS/g,b.numDirLights).replace(/NUM_SPOT_LIGHTS/g,b.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,b.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,b.numPointLights).replace(/NUM_HEMI_LIGHTS/g,b.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,b.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,
b.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,b.numPointLightShadows)}function Ri(a,b){return a.replace(/NUM_CLIPPING_PLANES/g,b.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,b.numClippingPlanes-b.numClipIntersection)}function rh(a){return a.replace(/^[ \t]*#include +<([\w\d./]+)>/gm,function(b,c){b=ab[c];if(void 0===b)throw Error("Can not resolve #include \x3c"+c+"\x3e");return rh(b)})}function Si(a){return a.replace(/#pragma unroll_loop[\s]+?for \( int i = (\d+); i < (\d+); i \+\+ \) \{([\s\S]+?)(?=\})\}/g,
function(b,c,d,f){b="";for(c=parseInt(c);c<parseInt(d);c++)b+=f.replace(/\[ i \]/g,"[ "+c+" ]").replace(/UNROLLED_LOOP_INDEX/g,c);return b})}function dl(a,b,c,d,f,g,h){var l=a.getContext(),m=d.defines,q=f.vertexShader,u=f.fragmentShader,w="SHADOWMAP_TYPE_BASIC";1===g.shadowMapType?w="SHADOWMAP_TYPE_PCF":2===g.shadowMapType?w="SHADOWMAP_TYPE_PCF_SOFT":3===g.shadowMapType&&(w="SHADOWMAP_TYPE_VSM");var y="ENVMAP_TYPE_CUBE",C="ENVMAP_MODE_REFLECTION",D="ENVMAP_BLENDING_MULTIPLY";if(g.envMap){switch(d.envMap.mapping){case 301:case 302:y=
"ENVMAP_TYPE_CUBE";break;case 306:case 307:y="ENVMAP_TYPE_CUBE_UV";break;case 303:case 304:y="ENVMAP_TYPE_EQUIREC";break;case 305:y="ENVMAP_TYPE_SPHERE"}switch(d.envMap.mapping){case 302:case 304:C="ENVMAP_MODE_REFRACTION"}switch(d.combine){case 0:D="ENVMAP_BLENDING_MULTIPLY";break;case 1:D="ENVMAP_BLENDING_MIX";break;case 2:D="ENVMAP_BLENDING_ADD"}}var K=0<a.gammaFactor?a.gammaFactor:1,J=h.isWebGL2?"":al(d.extensions,g,b),W=bl(m),T=l.createProgram();d.isRawShaderMaterial?(m=[W].filter(cf).join("\n"),
0<m.length&&(m+="\n"),b=[J,W].filter(cf).join("\n"),0<b.length&&(b+="\n")):(m=["precision "+g.precision+" float;","precision "+g.precision+" int;","highp"===g.precision?"#define HIGH_PRECISION":"","#define SHADER_NAME "+f.name,W,g.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+K,"#define MAX_BONES "+g.maxBones,g.useFog&&g.fog?"#define USE_FOG":"",g.useFog&&g.fogExp2?"#define FOG_EXP2":"",g.map?"#define USE_MAP":"",g.envMap?"#define USE_ENVMAP":"",g.envMap?"#define "+C:
"",g.lightMap?"#define USE_LIGHTMAP":"",g.aoMap?"#define USE_AOMAP":"",g.emissiveMap?"#define USE_EMISSIVEMAP":"",g.bumpMap?"#define USE_BUMPMAP":"",g.normalMap?"#define USE_NORMALMAP":"",g.normalMap&&g.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",g.normalMap&&g.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",g.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",g.displacementMap&&g.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",g.specularMap?"#define USE_SPECULARMAP":
"",g.roughnessMap?"#define USE_ROUGHNESSMAP":"",g.metalnessMap?"#define USE_METALNESSMAP":"",g.alphaMap?"#define USE_ALPHAMAP":"",g.vertexTangents?"#define USE_TANGENT":"",g.vertexColors?"#define USE_COLOR":"",g.vertexUvs?"#define USE_UV":"",g.flatShading?"#define FLAT_SHADED":"",g.skinning?"#define USE_SKINNING":"",g.useVertexTexture?"#define BONE_TEXTURE":"",g.morphTargets?"#define USE_MORPHTARGETS":"",g.morphNormals&&!1===g.flatShading?"#define USE_MORPHNORMALS":"",g.doubleSided?"#define DOUBLE_SIDED":
"",g.flipSided?"#define FLIP_SIDED":"",g.shadowMapEnabled?"#define USE_SHADOWMAP":"",g.shadowMapEnabled?"#define "+w:"",g.sizeAttenuation?"#define USE_SIZEATTENUATION":"",g.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",g.logarithmicDepthBuffer&&(h.isWebGL2||b.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_TANGENT","\tattribute vec4 tangent;","#endif","#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(cf).join("\n"),b=[J,"precision "+g.precision+" float;","precision "+g.precision+" int;","highp"===g.precision?"#define HIGH_PRECISION":"","#define SHADER_NAME "+f.name,W,g.alphaTest?"#define ALPHATEST "+g.alphaTest+(g.alphaTest%
1?"":".0"):"","#define GAMMA_FACTOR "+K,g.useFog&&g.fog?"#define USE_FOG":"",g.useFog&&g.fogExp2?"#define FOG_EXP2":"",g.map?"#define USE_MAP":"",g.matcap?"#define USE_MATCAP":"",g.envMap?"#define USE_ENVMAP":"",g.envMap?"#define "+y:"",g.envMap?"#define "+C:"",g.envMap?"#define "+D:"",g.lightMap?"#define USE_LIGHTMAP":"",g.aoMap?"#define USE_AOMAP":"",g.emissiveMap?"#define USE_EMISSIVEMAP":"",g.bumpMap?"#define USE_BUMPMAP":"",g.normalMap?"#define USE_NORMALMAP":"",g.normalMap&&g.objectSpaceNormalMap?
"#define OBJECTSPACE_NORMALMAP":"",g.normalMap&&g.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",g.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",g.specularMap?"#define USE_SPECULARMAP":"",g.roughnessMap?"#define USE_ROUGHNESSMAP":"",g.metalnessMap?"#define USE_METALNESSMAP":"",g.alphaMap?"#define USE_ALPHAMAP":"",g.sheen?"#define USE_SHEEN":"",g.vertexTangents?"#define USE_TANGENT":"",g.vertexColors?"#define USE_COLOR":"",g.vertexUvs?"#define USE_UV":"",g.gradientMap?"#define USE_GRADIENTMAP":
"",g.flatShading?"#define FLAT_SHADED":"",g.doubleSided?"#define DOUBLE_SIDED":"",g.flipSided?"#define FLIP_SIDED":"",g.shadowMapEnabled?"#define USE_SHADOWMAP":"",g.shadowMapEnabled?"#define "+w:"",g.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",g.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",g.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",g.logarithmicDepthBuffer&&(h.isWebGL2||b.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"",(d.extensions&&d.extensions.shaderTextureLOD||
g.envMap)&&(h.isWebGL2||b.get("EXT_shader_texture_lod"))?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",0!==g.toneMapping?"#define TONE_MAPPING":"",0!==g.toneMapping?ab.tonemapping_pars_fragment:"",0!==g.toneMapping?$k("toneMapping",g.toneMapping):"",g.dithering?"#define DITHERING":"",g.outputEncoding||g.mapEncoding||g.matcapEncoding||g.envMapEncoding||g.emissiveMapEncoding?ab.encodings_pars_fragment:"",g.mapEncoding?dg("mapTexelToLinear",g.mapEncoding):"",
g.matcapEncoding?dg("matcapTexelToLinear",g.matcapEncoding):"",g.envMapEncoding?dg("envMapTexelToLinear",g.envMapEncoding):"",g.emissiveMapEncoding?dg("emissiveMapTexelToLinear",g.emissiveMapEncoding):"",g.outputEncoding?Zk("linearToOutputTexel",g.outputEncoding):"",g.depthPacking?"#define DEPTH_PACKING "+d.depthPacking:"","\n"].filter(cf).join("\n"));q=rh(q);q=Qi(q,g);q=Ri(q,g);u=rh(u);u=Qi(u,g);u=Ri(u,g);q=Si(q);u=Si(u);h.isWebGL2&&!d.isRawShaderMaterial&&(h=!1,w=/^\s*#version\s+300\s+es\s*\n/,
d.isShaderMaterial&&null!==q.match(w)&&null!==u.match(w)&&(h=!0,q=q.replace(w,""),u=u.replace(w,"")),m="#version 300 es\n\n#define attribute in\n#define varying out\n#define texture2D texture\n"+m,b=["#version 300 es\n\n#define varying in",h?"":"out highp vec4 pc_fragColor;",h?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad"].join("\n")+
"\n"+b);u=b+u;q=Ni(l,35633,m+q);u=Ni(l,35632,u);l.attachShader(T,q);l.attachShader(T,u);void 0!==d.index0AttributeName?l.bindAttribLocation(T,0,d.index0AttributeName):!0===g.morphTargets&&l.bindAttribLocation(T,0,"position");l.linkProgram(T);if(a.debug.checkShaderErrors){a=l.getProgramInfoLog(T).trim();g=l.getShaderInfoLog(q).trim();h=l.getShaderInfoLog(u).trim();y=w=!0;if(!1===l.getProgramParameter(T,35714))w=!1,C=Pi(l,q,"vertex"),D=Pi(l,u,"fragment"),console.error("THREE.WebGLProgram: shader error: ",
l.getError(),"35715",l.getProgramParameter(T,35715),"gl.getProgramInfoLog",a,C,D);else if(""!==a)console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",a);else if(""===g||""===h)y=!1;y&&(this.diagnostics={runnable:w,material:d,programLog:a,vertexShader:{log:g,prefix:m},fragmentShader:{log:h,prefix:b}})}l.deleteShader(q);l.deleteShader(u);var V;this.getUniforms=function(){void 0===V&&(V=new id(l,T));return V};var Z;this.getAttributes=function(){void 0===Z&&(Z=cl(l,T));return Z};this.destroy=function(){l.deleteProgram(T);
this.program=void 0};this.name=f.name;this.id=el++;this.code=c;this.usedTimes=1;this.program=T;this.vertexShader=q;this.fragmentShader=u;return this}function fl(a,b,c){function d(m){m=m.skeleton.bones;if(c.floatVertexTextures)return 1024;var q=Math.min(Math.floor((c.maxVertexUniforms-20)/4),m.length);return q<m.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+m.length+" bones. This GPU supports "+q+"."),0):q}function f(m,q){if(m)m.isTexture?u=m.encoding:m.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),
u=m.texture.encoding);else var u=3E3;3E3===u&&q&&(u=3007);return u}var g=[],h={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},l="precision supportsVertexTextures map mapEncoding matcap matcapEncoding envMap envMapMode envMapEncoding lightMap aoMap emissiveMap emissiveMapEncoding bumpMap normalMap objectSpaceNormalMap tangentSpaceNormalMap clearcoatNormalMap displacementMap specularMap roughnessMap metalnessMap gradientMap alphaMap combine vertexColors vertexTangents fog useFog fogExp2 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 sheen".split(" ");
this.getParameters=function(m,q,u,w,y,C,D){var K=h[m.type],J=D.isSkinnedMesh?d(D):0,W=c.precision;null!==m.precision&&(W=c.getMaxPrecision(m.precision),W!==m.precision&&console.warn("THREE.WebGLProgram.getParameters:",m.precision,"not supported, using",W,"instead."));var T=a.getRenderTarget();return{shaderID:K,precision:W,supportsVertexTextures:c.vertexTextures,outputEncoding:f(T?T.texture:null,a.gammaOutput),map:!!m.map,mapEncoding:f(m.map,a.gammaInput),matcap:!!m.matcap,matcapEncoding:f(m.matcap,
a.gammaInput),envMap:!!m.envMap,envMapMode:m.envMap&&m.envMap.mapping,envMapEncoding:f(m.envMap,a.gammaInput),envMapCubeUV:!!m.envMap&&(306===m.envMap.mapping||307===m.envMap.mapping),lightMap:!!m.lightMap,aoMap:!!m.aoMap,emissiveMap:!!m.emissiveMap,emissiveMapEncoding:f(m.emissiveMap,a.gammaInput),bumpMap:!!m.bumpMap,normalMap:!!m.normalMap,objectSpaceNormalMap:1===m.normalMapType,tangentSpaceNormalMap:0===m.normalMapType,clearcoatNormalMap:!!m.clearcoatNormalMap,displacementMap:!!m.displacementMap,
roughnessMap:!!m.roughnessMap,metalnessMap:!!m.metalnessMap,specularMap:!!m.specularMap,alphaMap:!!m.alphaMap,gradientMap:!!m.gradientMap,sheen:!!m.sheen,combine:m.combine,vertexTangents:m.normalMap&&m.vertexTangents,vertexColors:m.vertexColors,vertexUvs:!!m.map||!!m.bumpMap||!!m.normalMap||!!m.specularMap||!!m.alphaMap||!!m.emissiveMap||!!m.roughnessMap||!!m.metalnessMap||!!m.clearcoatNormalMap,fog:!!w,useFog:m.fog,fogExp2:w&&w.isFogExp2,flatShading:m.flatShading,sizeAttenuation:m.sizeAttenuation,
logarithmicDepthBuffer:c.logarithmicDepthBuffer,skinning:m.skinning&&0<J,maxBones:J,useVertexTexture:c.floatVertexTextures,morphTargets:m.morphTargets,morphNormals:m.morphNormals,maxMorphTargets:a.maxMorphTargets,maxMorphNormals:a.maxMorphNormals,numDirLights:q.directional.length,numPointLights:q.point.length,numSpotLights:q.spot.length,numRectAreaLights:q.rectArea.length,numHemiLights:q.hemi.length,numDirLightShadows:q.directionalShadowMap.length,numPointLightShadows:q.pointShadowMap.length,numSpotLightShadows:q.spotShadowMap.length,
numClippingPlanes:y,numClipIntersection:C,dithering:m.dithering,shadowMapEnabled:a.shadowMap.enabled&&D.receiveShadow&&0<u.length,shadowMapType:a.shadowMap.type,toneMapping:m.toneMapped?a.toneMapping:0,physicallyCorrectLights:a.physicallyCorrectLights,premultipliedAlpha:m.premultipliedAlpha,alphaTest:m.alphaTest,doubleSided:2===m.side,flipSided:1===m.side,depthPacking:void 0!==m.depthPacking?m.depthPacking:!1}};this.getProgramCode=function(m,q){var u=[];q.shaderID?u.push(q.shaderID):(u.push(m.fragmentShader),
u.push(m.vertexShader));if(void 0!==m.defines)for(var w in m.defines)u.push(w),u.push(m.defines[w]);for(w=0;w<l.length;w++)u.push(q[l[w]]);u.push(m.onBeforeCompile.toString());u.push(a.gammaOutput);u.push(a.gammaFactor);return u.join()};this.acquireProgram=function(m,q,u,w){for(var y,C=0,D=g.length;C<D;C++){var K=g[C];if(K.code===w){y=K;++y.usedTimes;break}}void 0===y&&(y=new dl(a,b,w,m,q,u,c),g.push(y));return y};this.releaseProgram=function(m){0===--m.usedTimes&&(g[g.indexOf(m)]=g[g.length-1],g.pop(),
m.destroy())};this.programs=g}function gl(){var a=new WeakMap;return{get:function(b){var c=a.get(b);void 0===c&&(c={},a.set(b,c));return c},remove:function(b){a.delete(b)},update:function(b,c,d){a.get(b)[c]=d},dispose:function(){a=new WeakMap}}}function hl(a,b){return a.groupOrder!==b.groupOrder?a.groupOrder-b.groupOrder:a.renderOrder!==b.renderOrder?a.renderOrder-b.renderOrder:a.program!==b.program?a.program.id-b.program.id:a.material.id!==b.material.id?a.material.id-b.material.id:a.z!==b.z?a.z-
b.z:a.id-b.id}function il(a,b){return a.groupOrder!==b.groupOrder?a.groupOrder-b.groupOrder:a.renderOrder!==b.renderOrder?a.renderOrder-b.renderOrder:a.z!==b.z?b.z-a.z:a.id-b.id}function Ti(){function a(h,l,m,q,u,w){var y=b[c];void 0===y?(y={id:h.id,object:h,geometry:l,material:m,program:m.program||g,groupOrder:q,renderOrder:h.renderOrder,z:u,group:w},b[c]=y):(y.id=h.id,y.object=h,y.geometry=l,y.material=m,y.program=m.program||g,y.groupOrder=q,y.renderOrder=h.renderOrder,y.z=u,y.group=w);c++;return y}
var b=[],c=0,d=[],f=[],g={id:-1};return{opaque:d,transparent:f,init:function(){c=0;d.length=0;f.length=0},push:function(h,l,m,q,u,w){h=a(h,l,m,q,u,w);(!0===m.transparent?f:d).push(h)},unshift:function(h,l,m,q,u,w){h=a(h,l,m,q,u,w);(!0===m.transparent?f:d).unshift(h)},sort:function(){1<d.length&&d.sort(hl);1<f.length&&f.sort(il)}}}function jl(){function a(c){c=c.target;c.removeEventListener("dispose",a);b.delete(c)}var b=new WeakMap;return{get:function(c,d){var f=b.get(c);if(void 0===f){var g=new Ti;
b.set(c,new WeakMap);b.get(c).set(d,g);c.addEventListener("dispose",a)}else g=f.get(d),void 0===g&&(g=new Ti,f.set(d,g));return g},dispose:function(){b=new WeakMap}}}function kl(){var a={};return{get:function(b){if(void 0!==a[b.id])return a[b.id];switch(b.type){case "DirectionalLight":var c={direction:new p,color:new ca,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new k};break;case "SpotLight":c={position:new p,direction:new p,color:new ca,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,
shadowBias:0,shadowRadius:1,shadowMapSize:new k};break;case "PointLight":c={position:new p,color:new ca,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new k,shadowCameraNear:1,shadowCameraFar:1E3};break;case "HemisphereLight":c={direction:new p,skyColor:new ca,groundColor:new ca};break;case "RectAreaLight":c={color:new ca,position:new p,halfWidth:new p,halfHeight:new p}}return a[b.id]=c}}}function ll(a,b){return(b.castShadow?1:0)-(a.castShadow?1:0)}function ml(){for(var a=
new kl,b={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},c=0;9>c;c++)b.probe.push(new p);var d=new p,f=new A,g=new A;return{setup:function(h,
l,m){for(var q=0,u=0,w=0,y=0;9>y;y++)b.probe[y].set(0,0,0);var C=l=0,D=0,K=0,J=0,W=0,T=0,V=0;m=m.matrixWorldInverse;h.sort(ll);y=0;for(var Z=h.length;y<Z;y++){var R=h[y],Y=R.color,ea=R.intensity,za=R.distance,Aa=R.shadow&&R.shadow.map?R.shadow.map.texture:null;if(R.isAmbientLight)q+=Y.r*ea,u+=Y.g*ea,w+=Y.b*ea;else if(R.isLightProbe)for(Aa=0;9>Aa;Aa++)b.probe[Aa].addScaledVector(R.sh.coefficients[Aa],ea);else if(R.isDirectionalLight){var fa=a.get(R);fa.color.copy(R.color).multiplyScalar(R.intensity);
fa.direction.setFromMatrixPosition(R.matrixWorld);d.setFromMatrixPosition(R.target.matrixWorld);fa.direction.sub(d);fa.direction.transformDirection(m);if(fa.shadow=R.castShadow)ea=R.shadow,fa.shadowBias=ea.bias,fa.shadowRadius=ea.radius,fa.shadowMapSize=ea.mapSize,b.directionalShadowMap[l]=Aa,b.directionalShadowMatrix[l]=R.shadow.matrix,W++;b.directional[l]=fa;l++}else if(R.isSpotLight){fa=a.get(R);fa.position.setFromMatrixPosition(R.matrixWorld);fa.position.applyMatrix4(m);fa.color.copy(Y).multiplyScalar(ea);
fa.distance=za;fa.direction.setFromMatrixPosition(R.matrixWorld);d.setFromMatrixPosition(R.target.matrixWorld);fa.direction.sub(d);fa.direction.transformDirection(m);fa.coneCos=Math.cos(R.angle);fa.penumbraCos=Math.cos(R.angle*(1-R.penumbra));fa.decay=R.decay;if(fa.shadow=R.castShadow)ea=R.shadow,fa.shadowBias=ea.bias,fa.shadowRadius=ea.radius,fa.shadowMapSize=ea.mapSize,b.spotShadowMap[D]=Aa,b.spotShadowMatrix[D]=R.shadow.matrix,V++;b.spot[D]=fa;D++}else if(R.isRectAreaLight)fa=a.get(R),fa.color.copy(Y).multiplyScalar(ea),
fa.position.setFromMatrixPosition(R.matrixWorld),fa.position.applyMatrix4(m),g.identity(),f.copy(R.matrixWorld),f.premultiply(m),g.extractRotation(f),fa.halfWidth.set(.5*R.width,0,0),fa.halfHeight.set(0,.5*R.height,0),fa.halfWidth.applyMatrix4(g),fa.halfHeight.applyMatrix4(g),b.rectArea[K]=fa,K++;else if(R.isPointLight){fa=a.get(R);fa.position.setFromMatrixPosition(R.matrixWorld);fa.position.applyMatrix4(m);fa.color.copy(R.color).multiplyScalar(R.intensity);fa.distance=R.distance;fa.decay=R.decay;
if(fa.shadow=R.castShadow)ea=R.shadow,fa.shadowBias=ea.bias,fa.shadowRadius=ea.radius,fa.shadowMapSize=ea.mapSize,fa.shadowCameraNear=ea.camera.near,fa.shadowCameraFar=ea.camera.far,b.pointShadowMap[C]=Aa,b.pointShadowMatrix[C]=R.shadow.matrix,T++;b.point[C]=fa;C++}else R.isHemisphereLight&&(fa=a.get(R),fa.direction.setFromMatrixPosition(R.matrixWorld),fa.direction.transformDirection(m),fa.direction.normalize(),fa.skyColor.copy(R.color).multiplyScalar(ea),fa.groundColor.copy(R.groundColor).multiplyScalar(ea),
b.hemi[J]=fa,J++)}b.ambient[0]=q;b.ambient[1]=u;b.ambient[2]=w;h=b.hash;if(h.directionalLength!==l||h.pointLength!==C||h.spotLength!==D||h.rectAreaLength!==K||h.hemiLength!==J||h.numDirectionalShadows!==W||h.numPointShadows!==T||h.numSpotShadows!==V)b.directional.length=l,b.spot.length=D,b.rectArea.length=K,b.point.length=C,b.hemi.length=J,b.directionalShadowMap.length=W,b.pointShadowMap.length=T,b.spotShadowMap.length=V,b.directionalShadowMatrix.length=W,b.pointShadowMatrix.length=T,b.spotShadowMatrix.length=
V,h.directionalLength=l,h.pointLength=C,h.spotLength=D,h.rectAreaLength=K,h.hemiLength=J,h.numDirectionalShadows=W,h.numPointShadows=T,h.numSpotShadows=V,b.version=nl++},state:b}}function Ui(){var a=new ml,b=[],c=[];return{init:function(){b.length=0;c.length=0},state:{lightsArray:b,shadowsArray:c,lights:a},setupLights:function(d){a.setup(b,c,d)},pushLight:function(d){b.push(d)},pushShadow:function(d){c.push(d)}}}function ol(){function a(c){c=c.target;c.removeEventListener("dispose",a);b.delete(c)}
var b=new WeakMap;return{get:function(c,d){if(!1===b.has(c)){var f=new Ui;b.set(c,new WeakMap);b.get(c).set(d,f);c.addEventListener("dispose",a)}else!1===b.get(c).has(d)?(f=new Ui,b.get(c).set(d,f)):f=b.get(c).get(d);return f},dispose:function(){b=new WeakMap}}}function jd(a){xa.call(this);this.type="MeshDepthMaterial";this.depthPacking=3200;this.morphTargets=this.skinning=!1;this.displacementMap=this.alphaMap=this.map=null;this.displacementScale=1;this.displacementBias=0;this.wireframe=!1;this.wireframeLinewidth=
1;this.lights=this.fog=!1;this.setValues(a)}function kd(a){xa.call(this);this.type="MeshDistanceMaterial";this.referencePosition=new p;this.nearDistance=1;this.farDistance=1E3;this.morphTargets=this.skinning=!1;this.displacementMap=this.alphaMap=this.map=null;this.displacementScale=1;this.displacementBias=0;this.lights=this.fog=!1;this.setValues(a)}function Vi(a,b,c){function d(Y,ea){var za=b.update(W);D.uniforms.shadow_pass.value=Y.map.texture;D.uniforms.resolution.value=Y.mapSize;D.uniforms.radius.value=
Y.radius;a.setRenderTarget(Y.mapPass);a.clear();a.renderBufferDirect(ea,null,za,D,W,null);K.uniforms.shadow_pass.value=Y.mapPass.texture;K.uniforms.resolution.value=Y.mapSize;K.uniforms.radius.value=Y.radius;a.setRenderTarget(Y.map);a.clear();a.renderBufferDirect(ea,null,za,K,W,null)}function f(Y,ea,za,Aa,fa,ma){var ha=Y.geometry;var ra=u;var Ma=Y.customDepthMaterial;za.isPointLight&&(ra=w,Ma=Y.customDistanceMaterial);Ma?ra=Ma:(Ma=!1,ea.morphTargets&&(ha&&ha.isBufferGeometry?Ma=ha.morphAttributes&&
ha.morphAttributes.position&&0<ha.morphAttributes.position.length:ha&&ha.isGeometry&&(Ma=ha.morphTargets&&0<ha.morphTargets.length)),Y.isSkinnedMesh&&!1===ea.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",Y),Y=Y.isSkinnedMesh&&ea.skinning,ha=0,Ma&&(ha|=1),Y&&(ha|=2),ra=ra[ha]);a.localClippingEnabled&&!0===ea.clipShadows&&0!==ea.clippingPlanes.length&&(ha=ra.uuid,Ma=ea.uuid,Y=y[ha],void 0===Y&&(Y={},y[ha]=Y),ha=Y[Ma],void 0===ha&&(ha=ra.clone(),
Y[Ma]=ha),ra=ha);ra.visible=ea.visible;ra.wireframe=ea.wireframe;ra.side=3===ma?null!=ea.shadowSide?ea.shadowSide:ea.side:null!=ea.shadowSide?ea.shadowSide:C[ea.side];ra.clipShadows=ea.clipShadows;ra.clippingPlanes=ea.clippingPlanes;ra.clipIntersection=ea.clipIntersection;ra.wireframeLinewidth=ea.wireframeLinewidth;ra.linewidth=ea.linewidth;za.isPointLight&&ra.isMeshDistanceMaterial&&(ra.referencePosition.setFromMatrixPosition(za.matrixWorld),ra.nearDistance=Aa,ra.farDistance=fa);return ra}function g(Y,
ea,za,Aa,fa){if(!1!==Y.visible){if(Y.layers.test(ea.layers)&&(Y.isMesh||Y.isLine||Y.isPoints)&&(Y.castShadow||Y.receiveShadow&&3===fa)&&(!Y.frustumCulled||h.intersectsObject(Y))){Y.modelViewMatrix.multiplyMatrices(za.matrixWorldInverse,Y.matrixWorld);var ma=b.update(Y),ha=Y.material;if(Array.isArray(ha))for(var ra=ma.groups,Ma=0,cb=ra.length;Ma<cb;Ma++){var pa=ra[Ma],Ka=ha[pa.materialIndex];Ka&&Ka.visible&&(Ka=f(Y,Ka,Aa,za.near,za.far,fa),a.renderBufferDirect(za,null,ma,Ka,Y,pa))}else ha.visible&&
(Ka=f(Y,ha,Aa,za.near,za.far,fa),a.renderBufferDirect(za,null,ma,Ka,Y,null))}Y=Y.children;ma=0;for(ha=Y.length;ma<ha;ma++)g(Y[ma],ea,za,Aa,fa)}}var h=new ic,l=new k,m=new k,q=new E,u=Array(4),w=Array(4),y={},C={0:1,1:0,2:2},D=new yb({defines:{SAMPLE_RATE:.25,HALF_SAMPLE_RATE:.125},uniforms:{shadow_pass:{value:null},resolution:{value:new k},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position \x3d vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \x3cpacking\x3e\nvoid main() {\n  float mean \x3d 0.0;\n  float squared_mean \x3d 0.0;\n  \n\tfloat depth \x3d unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy  ) / resolution ) );\n  for ( float i \x3d -1.0; i \x3c 1.0 ; i +\x3d SAMPLE_RATE) {\n    #ifdef HORIZONAL_PASS\n      vec2 distribution \x3d decodeHalfRGBA ( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n      mean +\x3d distribution.x;\n      squared_mean +\x3d distribution.y * distribution.y + distribution.x * distribution.x;\n    #else\n      float depth \x3d unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0,  i )  * radius ) / resolution ) );\n      mean +\x3d depth;\n      squared_mean +\x3d depth * depth;\n    #endif\n  }\n  mean \x3d mean * HALF_SAMPLE_RATE;\n  squared_mean \x3d squared_mean * HALF_SAMPLE_RATE;\n  float std_dev \x3d pow( squared_mean - mean * mean, 0.5 );\n  gl_FragColor \x3d encodeHalfRGBA( vec2( mean, std_dev ) );\n}"}),
K=D.clone();K.defines.HORIZONAL_PASS=1;var J=new la;J.addAttribute("position",new Ea(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var W=new Oa(J,D);for(J=0;4!==J;++J){var T=0!==(J&1),V=0!==(J&2),Z=new jd({depthPacking:3201,morphTargets:T,skinning:V});u[J]=Z;T=new kd({morphTargets:T,skinning:V});w[J]=T}var R=this;this.enabled=!1;this.autoUpdate=!0;this.needsUpdate=!1;this.type=1;this.render=function(Y,ea,za){if(!1!==R.enabled&&(!1!==R.autoUpdate||!1!==R.needsUpdate)&&0!==Y.length){var Aa=a.getRenderTarget(),
fa=a.getActiveCubeFace(),ma=a.getActiveMipmapLevel(),ha=a.state;ha.setBlending(0);ha.buffers.color.setClear(1,1,1,1);ha.buffers.depth.setTest(!0);ha.setScissorTest(!1);for(var ra=0,Ma=Y.length;ra<Ma;ra++){var cb=Y[ra],pa=cb.shadow;if(void 0===pa)console.warn("THREE.WebGLShadowMap:",cb,"has no shadow.");else{l.copy(pa.mapSize);var Ka=pa.getFrameExtents();l.multiply(Ka);m.copy(pa.mapSize);if(l.x>c||l.y>c)console.warn("THREE.WebGLShadowMap:",cb,"has shadow exceeding max texture size, reducing"),l.x>
c&&(m.x=Math.floor(c/Ka.x),l.x=m.x*Ka.x,pa.mapSize.x=m.x),l.y>c&&(m.y=Math.floor(c/Ka.y),l.y=m.y*Ka.y,pa.mapSize.y=m.y);null!==pa.map||pa.isPointLightShadow||3!==this.type||(Ka={minFilter:1006,magFilter:1006,format:1023},pa.map=new t(l.x,l.y,Ka),pa.map.texture.name=cb.name+".shadowMap",pa.mapPass=new t(l.x,l.y,Ka),pa.camera.updateProjectionMatrix());null===pa.map&&(Ka={minFilter:1003,magFilter:1003,format:1023},pa.map=new t(l.x,l.y,Ka),pa.map.texture.name=cb.name+".shadowMap",pa.camera.updateProjectionMatrix());
a.setRenderTarget(pa.map);a.clear();Ka=pa.getViewportCount();for(var Ta=0;Ta<Ka;Ta++){var jb=pa.getViewport(Ta);q.set(m.x*jb.x,m.y*jb.y,m.x*jb.z,m.y*jb.w);ha.viewport(q);pa.updateMatrices(cb,za,Ta);h=pa.getFrustum();g(ea,za,pa.camera,cb,this.type)}pa.isPointLightShadow||3!==this.type||d(pa,za)}}R.needsUpdate=!1;a.setRenderTarget(Aa,fa,ma)}}}function pl(a,b,c,d){function f(M,ka,qa){var Xa=new Uint8Array(4),Ba=a.createTexture();a.bindTexture(M,Ba);a.texParameteri(M,10241,9728);a.texParameteri(M,10240,
9728);for(M=0;M<qa;M++)a.texImage2D(ka+M,0,6408,1,1,0,6408,5121,Xa);return Ba}function g(M,ka){W[M]=1;0===T[M]&&(a.enableVertexAttribArray(M),T[M]=1);V[M]!==ka&&((d.isWebGL2?a:b.get("ANGLE_instanced_arrays"))[d.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](M,ka),V[M]=ka)}function h(M){!0!==Z[M]&&(a.enable(M),Z[M]=!0)}function l(M){!1!==Z[M]&&(a.disable(M),Z[M]=!1)}function m(M,ka,qa,Xa,Ba,Sa,Ua,ua){if(0===M)ea&&(l(3042),ea=!1);else if(ea||(h(3042),ea=!0),5!==M){if(M!==za||ua!==cb){if(100!==
Aa||100!==ha)a.blendEquation(32774),ha=Aa=100;if(ua)switch(M){case 1:a.blendFuncSeparate(1,771,1,771);break;case 2:a.blendFunc(1,1);break;case 3:a.blendFuncSeparate(0,0,769,771);break;case 4:a.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",M)}else switch(M){case 1:a.blendFuncSeparate(770,771,1,771);break;case 2:a.blendFunc(770,1);break;case 3:a.blendFunc(0,769);break;case 4:a.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",
M)}Ma=ra=ma=fa=null;za=M;cb=ua}}else{Ba=Ba||ka;Sa=Sa||qa;Ua=Ua||Xa;if(ka!==Aa||Ba!==ha)a.blendEquationSeparate(c.convert(ka),c.convert(Ba)),Aa=ka,ha=Ba;if(qa!==fa||Xa!==ma||Sa!==ra||Ua!==Ma)a.blendFuncSeparate(c.convert(qa),c.convert(Xa),c.convert(Sa),c.convert(Ua)),fa=qa,ma=Xa,ra=Sa,Ma=Ua;za=M;cb=null}}function q(M){pa!==M&&(M?a.frontFace(2304):a.frontFace(2305),pa=M)}function u(M){0!==M?(h(2884),M!==Ka&&(1===M?a.cullFace(1029):2===M?a.cullFace(1028):a.cullFace(1032))):l(2884);Ka=M}function w(M,
ka,qa){if(M){if(h(32823),jb!==ka||db!==qa)a.polygonOffset(ka,qa),jb=ka,db=qa}else l(32823)}function y(M){void 0===M&&(M=33984+L-1);da!==M&&(a.activeTexture(M),da=M)}var C=new function(){var M=!1,ka=new E,qa=null,Xa=new E(0,0,0,0);return{setMask:function(Ba){qa===Ba||M||(a.colorMask(Ba,Ba,Ba,Ba),qa=Ba)},setLocked:function(Ba){M=Ba},setClear:function(Ba,Sa,Ua,ua,Pa){!0===Pa&&(Ba*=ua,Sa*=ua,Ua*=ua);ka.set(Ba,Sa,Ua,ua);!1===Xa.equals(ka)&&(a.clearColor(Ba,Sa,Ua,ua),Xa.copy(ka))},reset:function(){M=!1;
qa=null;Xa.set(-1,0,0,0)}}},D=new function(){var M=!1,ka=null,qa=null,Xa=null;return{setTest:function(Ba){Ba?h(2929):l(2929)},setMask:function(Ba){ka===Ba||M||(a.depthMask(Ba),ka=Ba)},setFunc:function(Ba){if(qa!==Ba){if(Ba)switch(Ba){case 0:a.depthFunc(512);break;case 1:a.depthFunc(519);break;case 2:a.depthFunc(513);break;case 3:a.depthFunc(515);break;case 4:a.depthFunc(514);break;case 5:a.depthFunc(518);break;case 6:a.depthFunc(516);break;case 7:a.depthFunc(517);break;default:a.depthFunc(515)}else a.depthFunc(515);
qa=Ba}},setLocked:function(Ba){M=Ba},setClear:function(Ba){Xa!==Ba&&(a.clearDepth(Ba),Xa=Ba)},reset:function(){M=!1;Xa=qa=ka=null}}},K=new function(){var M=!1,ka=null,qa=null,Xa=null,Ba=null,Sa=null,Ua=null,ua=null,Pa=null;return{setTest:function(Wa){M||(Wa?h(2960):l(2960))},setMask:function(Wa){ka===Wa||M||(a.stencilMask(Wa),ka=Wa)},setFunc:function(Wa,Za,bb){if(qa!==Wa||Xa!==Za||Ba!==bb)a.stencilFunc(Wa,Za,bb),qa=Wa,Xa=Za,Ba=bb},setOp:function(Wa,Za,bb){if(Sa!==Wa||Ua!==Za||ua!==bb)a.stencilOp(Wa,
Za,bb),Sa=Wa,Ua=Za,ua=bb},setLocked:function(Wa){M=Wa},setClear:function(Wa){Pa!==Wa&&(a.clearStencil(Wa),Pa=Wa)},reset:function(){M=!1;Pa=ua=Ua=Sa=Ba=Xa=qa=ka=null}}},J=a.getParameter(34921),W=new Uint8Array(J),T=new Uint8Array(J),V=new Uint8Array(J),Z={},R=null,Y=null,ea=null,za=null,Aa=null,fa=null,ma=null,ha=null,ra=null,Ma=null,cb=!1,pa=null,Ka=null,Ta=null,jb=null,db=null,L=a.getParameter(35661),Q=!1;J=0;J=a.getParameter(7938);-1!==J.indexOf("WebGL")?(J=parseFloat(/^WebGL ([0-9])/.exec(J)[1]),
Q=1<=J):-1!==J.indexOf("OpenGL ES")&&(J=parseFloat(/^OpenGL ES ([0-9])/.exec(J)[1]),Q=2<=J);var da=null,oa={},Fa=new E,sa=new E,La={};La[3553]=f(3553,3553,1);La[34067]=f(34067,34069,6);C.setClear(0,0,0,1);D.setClear(1);K.setClear(0);h(2929);D.setFunc(3);q(!1);u(1);h(2884);m(0);return{buffers:{color:C,depth:D,stencil:K},initAttributes:function(){for(var M=0,ka=W.length;M<ka;M++)W[M]=0},enableAttribute:function(M){g(M,0)},enableAttributeAndDivisor:g,disableUnusedAttributes:function(){for(var M=0,ka=
T.length;M!==ka;++M)T[M]!==W[M]&&(a.disableVertexAttribArray(M),T[M]=0)},enable:h,disable:l,getCompressedTextureFormats:function(){if(null===R&&(R=[],b.get("WEBGL_compressed_texture_pvrtc")||b.get("WEBGL_compressed_texture_s3tc")||b.get("WEBGL_compressed_texture_etc1")||b.get("WEBGL_compressed_texture_astc")))for(var M=a.getParameter(34467),ka=0;ka<M.length;ka++)R.push(M[ka]);return R},useProgram:function(M){return Y!==M?(a.useProgram(M),Y=M,!0):!1},setBlending:m,setMaterial:function(M,ka){2===M.side?
l(2884):h(2884);var qa=1===M.side;ka&&(qa=!qa);q(qa);1===M.blending&&!1===M.transparent?m(0):m(M.blending,M.blendEquation,M.blendSrc,M.blendDst,M.blendEquationAlpha,M.blendSrcAlpha,M.blendDstAlpha,M.premultipliedAlpha);D.setFunc(M.depthFunc);D.setTest(M.depthTest);D.setMask(M.depthWrite);C.setMask(M.colorWrite);ka=M.stencilWrite;K.setTest(ka);ka&&(K.setFunc(M.stencilFunc,M.stencilRef,M.stencilMask),K.setOp(M.stencilFail,M.stencilZFail,M.stencilZPass));w(M.polygonOffset,M.polygonOffsetFactor,M.polygonOffsetUnits)},
setFlipSided:q,setCullFace:u,setLineWidth:function(M){M!==Ta&&(Q&&a.lineWidth(M),Ta=M)},setPolygonOffset:w,setScissorTest:function(M){M?h(3089):l(3089)},activeTexture:y,bindTexture:function(M,ka){null===da&&y();var qa=oa[da];void 0===qa&&(qa={type:void 0,texture:void 0},oa[da]=qa);if(qa.type!==M||qa.texture!==ka)a.bindTexture(M,ka||La[M]),qa.type=M,qa.texture=ka},compressedTexImage2D:function(){try{a.compressedTexImage2D.apply(a,arguments)}catch(M){console.error("THREE.WebGLState:",M)}},texImage2D:function(){try{a.texImage2D.apply(a,
arguments)}catch(M){console.error("THREE.WebGLState:",M)}},texImage3D:function(){try{a.texImage3D.apply(a,arguments)}catch(M){console.error("THREE.WebGLState:",M)}},scissor:function(M){!1===Fa.equals(M)&&(a.scissor(M.x,M.y,M.z,M.w),Fa.copy(M))},viewport:function(M){!1===sa.equals(M)&&(a.viewport(M.x,M.y,M.z,M.w),sa.copy(M))},reset:function(){for(var M=0;M<T.length;M++)1===T[M]&&(a.disableVertexAttribArray(M),T[M]=0);Z={};da=R=null;oa={};Ka=pa=za=Y=null;C.reset();D.reset();K.reset()}}}function ql(a,
b,c,d,f,g,h){function l(L,Q){return Ka?new OffscreenCanvas(L,Q):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function m(L,Q,da,oa){var Fa=1;if(L.width>oa||L.height>oa)Fa=oa/Math.max(L.width,L.height);if(1>Fa||!0===Q){if("undefined"!==typeof HTMLImageElement&&L instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&L instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&L instanceof ImageBitmap)return oa=Q?Qa.floorPowerOfTwo:Math.floor,Q=oa(Fa*L.width),
Fa=oa(Fa*L.height),void 0===pa&&(pa=l(Q,Fa)),da=da?l(Q,Fa):pa,da.width=Q,da.height=Fa,da.getContext("2d").drawImage(L,0,0,Q,Fa),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+L.width+"x"+L.height+") to ("+Q+"x"+Fa+")."),da;"data"in L&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+L.width+"x"+L.height+").")}return L}function q(L){return Qa.isPowerOfTwo(L.width)&&Qa.isPowerOfTwo(L.height)}function u(L){return f.isWebGL2?!1:1001!==L.wrapS||1001!==L.wrapT||
1003!==L.minFilter&&1006!==L.minFilter}function w(L,Q){return L.generateMipmaps&&Q&&1003!==L.minFilter&&1006!==L.minFilter}function y(L,Q,da,oa){a.generateMipmap(L);d.get(Q).__maxMipLevel=Math.log(Math.max(da,oa))*Math.LOG2E}function C(L,Q){if(!f.isWebGL2)return L;var da=L;6403===L&&(5126===Q&&(da=33326),5131===Q&&(da=33325),5121===Q&&(da=33321));6407===L&&(5126===Q&&(da=34837),5131===Q&&(da=34843),5121===Q&&(da=32849));6408===L&&(5126===Q&&(da=34836),5131===Q&&(da=34842),5121===Q&&(da=32856));33325===
da||33326===da||34842===da||34836===da?b.get("EXT_color_buffer_float"):(34843===da||34837===da)&&console.warn("THREE.WebGLRenderer: Floating point textures with RGB format not supported. Please use RGBA instead.");return da}function D(L){return 1003===L||1004===L||1005===L?9728:9729}function K(L){L=L.target;L.removeEventListener("dispose",K);W(L);L.isVideoTexture&&cb.delete(L);h.memory.textures--}function J(L){L=L.target;L.removeEventListener("dispose",J);T(L);h.memory.textures--}function W(L){var Q=
d.get(L);void 0!==Q.__webglInit&&(a.deleteTexture(Q.__webglTexture),d.remove(L))}function T(L){var Q=d.get(L),da=d.get(L.texture);if(L){void 0!==da.__webglTexture&&a.deleteTexture(da.__webglTexture);L.depthTexture&&L.depthTexture.dispose();if(L.isWebGLRenderTargetCube)for(da=0;6>da;da++)a.deleteFramebuffer(Q.__webglFramebuffer[da]),Q.__webglDepthbuffer&&a.deleteRenderbuffer(Q.__webglDepthbuffer[da]);else a.deleteFramebuffer(Q.__webglFramebuffer),Q.__webglDepthbuffer&&a.deleteRenderbuffer(Q.__webglDepthbuffer);
d.remove(L.texture);d.remove(L)}}function V(L,Q){var da=d.get(L);L.isVideoTexture&&Ma(L);if(0<L.version&&da.__version!==L.version){var oa=L.image;if(void 0===oa)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else if(!1===oa.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{za(da,L,Q);return}}c.activeTexture(33984+Q);c.bindTexture(3553,da.__webglTexture)}function Z(L,Q){if(6===L.image.length){var da=d.get(L);
if(0<L.version&&da.__version!==L.version){ea(da,L);c.activeTexture(33984+Q);c.bindTexture(34067,da.__webglTexture);a.pixelStorei(37440,L.flipY);var oa=L&&L.isCompressedTexture;Q=L.image[0]&&L.image[0].isDataTexture;for(var Fa=[],sa=0;6>sa;sa++)Fa[sa]=oa||Q?Q?L.image[sa].image:L.image[sa]:m(L.image[sa],!1,!0,f.maxCubemapSize);var La=Fa[0],M=q(La)||f.isWebGL2,ka=g.convert(L.format),qa=g.convert(L.type),Xa=C(ka,qa);Y(34067,L,M);if(oa){for(sa=0;6>sa;sa++){var Ba=Fa[sa].mipmaps;for(oa=0;oa<Ba.length;oa++){var Sa=
Ba[oa];1023!==L.format&&1022!==L.format?-1<c.getCompressedTextureFormats().indexOf(ka)?c.compressedTexImage2D(34069+sa,oa,Xa,Sa.width,Sa.height,0,Sa.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):c.texImage2D(34069+sa,oa,Xa,Sa.width,Sa.height,0,ka,qa,Sa.data)}}da.__maxMipLevel=Ba.length-1}else{Ba=L.mipmaps;for(sa=0;6>sa;sa++)if(Q)for(c.texImage2D(34069+sa,0,Xa,Fa[sa].width,Fa[sa].height,0,ka,qa,Fa[sa].data),oa=0;oa<Ba.length;oa++)Sa=
Ba[oa],Sa=Sa.image[sa].image,c.texImage2D(34069+sa,oa+1,Xa,Sa.width,Sa.height,0,ka,qa,Sa.data);else for(c.texImage2D(34069+sa,0,Xa,ka,qa,Fa[sa]),oa=0;oa<Ba.length;oa++)Sa=Ba[oa],c.texImage2D(34069+sa,oa+1,Xa,ka,qa,Sa.image[sa]);da.__maxMipLevel=Ba.length}w(L,M)&&y(34067,L,La.width,La.height);da.__version=L.version;if(L.onUpdate)L.onUpdate(L)}else c.activeTexture(33984+Q),c.bindTexture(34067,da.__webglTexture)}}function R(L,Q){c.activeTexture(33984+Q);c.bindTexture(34067,d.get(L).__webglTexture)}function Y(L,
Q,da){da?(a.texParameteri(L,10242,g.convert(Q.wrapS)),a.texParameteri(L,10243,g.convert(Q.wrapT)),32879!==L&&35866!==L||a.texParameteri(L,32882,g.convert(Q.wrapR)),a.texParameteri(L,10240,g.convert(Q.magFilter)),a.texParameteri(L,10241,g.convert(Q.minFilter))):(a.texParameteri(L,10242,33071),a.texParameteri(L,10243,33071),32879!==L&&35866!==L||a.texParameteri(L,32882,33071),1001===Q.wrapS&&1001===Q.wrapT||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),
a.texParameteri(L,10240,D(Q.magFilter)),a.texParameteri(L,10241,D(Q.minFilter)),1003!==Q.minFilter&&1006!==Q.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter."));!(da=b.get("EXT_texture_filter_anisotropic"))||1015===Q.type&&null===b.get("OES_texture_float_linear")||1016===Q.type&&null===(f.isWebGL2||b.get("OES_texture_half_float_linear"))||!(1<Q.anisotropy||d.get(Q).__currentAnisotropy)||(a.texParameterf(L,
da.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(Q.anisotropy,f.getMaxAnisotropy())),d.get(Q).__currentAnisotropy=Q.anisotropy)}function ea(L,Q){void 0===L.__webglInit&&(L.__webglInit=!0,Q.addEventListener("dispose",K),L.__webglTexture=a.createTexture(),h.memory.textures++)}function za(L,Q,da){var oa=3553;Q.isDataTexture2DArray&&(oa=35866);Q.isDataTexture3D&&(oa=32879);ea(L,Q);c.activeTexture(33984+da);c.bindTexture(oa,L.__webglTexture);a.pixelStorei(37440,Q.flipY);a.pixelStorei(37441,Q.premultiplyAlpha);a.pixelStorei(3317,
Q.unpackAlignment);da=u(Q)&&!1===q(Q.image);da=m(Q.image,da,!1,f.maxTextureSize);var Fa=q(da)||f.isWebGL2,sa=g.convert(Q.format),La=g.convert(Q.type),M=C(sa,La);Y(oa,Q,Fa);var ka=Q.mipmaps;if(Q.isDepthTexture){M=6402;if(1015===Q.type){if(!f.isWebGL2)throw Error("Float Depth Texture only supported in WebGL2.0");M=36012}else f.isWebGL2&&(M=33189);1026===Q.format&&6402===M&&1012!==Q.type&&1014!==Q.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),
Q.type=1012,La=g.convert(Q.type));1027===Q.format&&(M=34041,1020!==Q.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),Q.type=1020,La=g.convert(Q.type)));c.texImage2D(3553,0,M,da.width,da.height,0,sa,La,null)}else if(Q.isDataTexture)if(0<ka.length&&Fa){for(var qa=0,Xa=ka.length;qa<Xa;qa++)oa=ka[qa],c.texImage2D(3553,qa,M,oa.width,oa.height,0,sa,La,oa.data);Q.generateMipmaps=!1;L.__maxMipLevel=ka.length-1}else c.texImage2D(3553,0,M,da.width,da.height,
0,sa,La,da.data),L.__maxMipLevel=0;else if(Q.isCompressedTexture){qa=0;for(Xa=ka.length;qa<Xa;qa++)oa=ka[qa],1023!==Q.format&&1022!==Q.format?-1<c.getCompressedTextureFormats().indexOf(sa)?c.compressedTexImage2D(3553,qa,M,oa.width,oa.height,0,oa.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):c.texImage2D(3553,qa,M,oa.width,oa.height,0,sa,La,oa.data);L.__maxMipLevel=ka.length-1}else if(Q.isDataTexture2DArray)c.texImage3D(35866,0,
M,da.width,da.height,da.depth,0,sa,La,da.data),L.__maxMipLevel=0;else if(Q.isDataTexture3D)c.texImage3D(32879,0,M,da.width,da.height,da.depth,0,sa,La,da.data),L.__maxMipLevel=0;else if(0<ka.length&&Fa){qa=0;for(Xa=ka.length;qa<Xa;qa++)oa=ka[qa],c.texImage2D(3553,qa,M,sa,La,oa);Q.generateMipmaps=!1;L.__maxMipLevel=ka.length-1}else c.texImage2D(3553,0,M,sa,La,da),L.__maxMipLevel=0;w(Q,Fa)&&y(3553,Q,da.width,da.height);L.__version=Q.version;if(Q.onUpdate)Q.onUpdate(Q)}function Aa(L,Q,da,oa){var Fa=g.convert(Q.texture.format),
sa=g.convert(Q.texture.type),La=C(Fa,sa);c.texImage2D(oa,0,La,Q.width,Q.height,0,Fa,sa,null);a.bindFramebuffer(36160,L);a.framebufferTexture2D(36160,da,oa,d.get(Q.texture).__webglTexture,0);a.bindFramebuffer(36160,null)}function fa(L,Q,da){a.bindRenderbuffer(36161,L);if(Q.depthBuffer&&!Q.stencilBuffer)da?(da=ra(Q),a.renderbufferStorageMultisample(36161,da,33189,Q.width,Q.height)):a.renderbufferStorage(36161,33189,Q.width,Q.height),a.framebufferRenderbuffer(36160,36096,36161,L);else if(Q.depthBuffer&&
Q.stencilBuffer)da?(da=ra(Q),a.renderbufferStorageMultisample(36161,da,35056,Q.width,Q.height)):a.renderbufferStorage(36161,34041,Q.width,Q.height),a.framebufferRenderbuffer(36160,33306,36161,L);else{L=g.convert(Q.texture.format);var oa=g.convert(Q.texture.type);L=C(L,oa);da?(da=ra(Q),a.renderbufferStorageMultisample(36161,da,L,Q.width,Q.height)):a.renderbufferStorage(36161,L,Q.width,Q.height)}a.bindRenderbuffer(36161,null)}function ma(L,Q){if(Q&&Q.isWebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported");
a.bindFramebuffer(36160,L);if(!Q.depthTexture||!Q.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");d.get(Q.depthTexture).__webglTexture&&Q.depthTexture.image.width===Q.width&&Q.depthTexture.image.height===Q.height||(Q.depthTexture.image.width=Q.width,Q.depthTexture.image.height=Q.height,Q.depthTexture.needsUpdate=!0);V(Q.depthTexture,0);L=d.get(Q.depthTexture).__webglTexture;if(1026===Q.depthTexture.format)a.framebufferTexture2D(36160,
36096,3553,L,0);else if(1027===Q.depthTexture.format)a.framebufferTexture2D(36160,33306,3553,L,0);else throw Error("Unknown depthTexture format");}function ha(L){var Q=d.get(L),da=!0===L.isWebGLRenderTargetCube;if(L.depthTexture){if(da)throw Error("target.depthTexture not supported in Cube render targets");ma(Q.__webglFramebuffer,L)}else if(da)for(Q.__webglDepthbuffer=[],da=0;6>da;da++)a.bindFramebuffer(36160,Q.__webglFramebuffer[da]),Q.__webglDepthbuffer[da]=a.createRenderbuffer(),fa(Q.__webglDepthbuffer[da],
L);else a.bindFramebuffer(36160,Q.__webglFramebuffer),Q.__webglDepthbuffer=a.createRenderbuffer(),fa(Q.__webglDepthbuffer,L);a.bindFramebuffer(36160,null)}function ra(L){return f.isWebGL2&&L.isWebGLMultisampleRenderTarget?Math.min(f.maxSamples,L.samples):0}function Ma(L){var Q=h.render.frame;cb.get(L)!==Q&&(cb.set(L,Q),L.update())}var cb=new WeakMap,pa,Ka="undefined"!==typeof OffscreenCanvas,Ta=0,jb=!1,db=!1;this.allocateTextureUnit=function(){var L=Ta;L>=f.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+
L+" texture units while this GPU supports only "+f.maxTextures);Ta+=1;return L};this.resetTextureUnits=function(){Ta=0};this.setTexture2D=V;this.setTexture2DArray=function(L,Q){var da=d.get(L);0<L.version&&da.__version!==L.version?za(da,L,Q):(c.activeTexture(33984+Q),c.bindTexture(35866,da.__webglTexture))};this.setTexture3D=function(L,Q){var da=d.get(L);0<L.version&&da.__version!==L.version?za(da,L,Q):(c.activeTexture(33984+Q),c.bindTexture(32879,da.__webglTexture))};this.setTextureCube=Z;this.setTextureCubeDynamic=
R;this.setupRenderTarget=function(L){var Q=d.get(L),da=d.get(L.texture);L.addEventListener("dispose",J);da.__webglTexture=a.createTexture();h.memory.textures++;var oa=!0===L.isWebGLRenderTargetCube,Fa=!0===L.isWebGLMultisampleRenderTarget,sa=q(L)||f.isWebGL2;if(oa)for(Q.__webglFramebuffer=[],Fa=0;6>Fa;Fa++)Q.__webglFramebuffer[Fa]=a.createFramebuffer();else if(Q.__webglFramebuffer=a.createFramebuffer(),Fa)if(f.isWebGL2){Q.__webglMultisampledFramebuffer=a.createFramebuffer();Q.__webglColorRenderbuffer=
a.createRenderbuffer();a.bindRenderbuffer(36161,Q.__webglColorRenderbuffer);Fa=g.convert(L.texture.format);var La=g.convert(L.texture.type);Fa=C(Fa,La);La=ra(L);a.renderbufferStorageMultisample(36161,La,Fa,L.width,L.height);a.bindFramebuffer(36160,Q.__webglMultisampledFramebuffer);a.framebufferRenderbuffer(36160,36064,36161,Q.__webglColorRenderbuffer);a.bindRenderbuffer(36161,null);L.depthBuffer&&(Q.__webglDepthRenderbuffer=a.createRenderbuffer(),fa(Q.__webglDepthRenderbuffer,L,!0));a.bindFramebuffer(36160,
null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(oa){c.bindTexture(34067,da.__webglTexture);Y(34067,L.texture,sa);for(Fa=0;6>Fa;Fa++)Aa(Q.__webglFramebuffer[Fa],L,36064,34069+Fa);w(L.texture,sa)&&y(34067,L.texture,L.width,L.height);c.bindTexture(34067,null)}else c.bindTexture(3553,da.__webglTexture),Y(3553,L.texture,sa),Aa(Q.__webglFramebuffer,L,36064,3553),w(L.texture,sa)&&y(3553,L.texture,L.width,L.height),c.bindTexture(3553,null);L.depthBuffer&&
ha(L)};this.updateRenderTargetMipmap=function(L){var Q=L.texture,da=q(L)||f.isWebGL2;if(w(Q,da)){da=L.isWebGLRenderTargetCube?34067:3553;var oa=d.get(Q).__webglTexture;c.bindTexture(da,oa);y(da,Q,L.width,L.height);c.bindTexture(da,null)}};this.updateMultisampleRenderTarget=function(L){if(L.isWebGLMultisampleRenderTarget)if(f.isWebGL2){var Q=d.get(L);a.bindFramebuffer(36008,Q.__webglMultisampledFramebuffer);a.bindFramebuffer(36009,Q.__webglFramebuffer);Q=L.width;var da=L.height,oa=16384;L.depthBuffer&&
(oa|=256);L.stencilBuffer&&(oa|=1024);a.blitFramebuffer(0,0,Q,da,0,0,Q,da,oa,9728)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")};this.safeSetTexture2D=function(L,Q){L&&L.isWebGLRenderTarget&&(!1===jb&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),jb=!0),L=L.texture);V(L,Q)};this.safeSetTextureCube=function(L,Q){L&&L.isWebGLRenderTargetCube&&(!1===db&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),
db=!0),L=L.texture);L&&L.isCubeTexture||Array.isArray(L.image)&&6===L.image.length?Z(L,Q):R(L,Q)}}function Wi(a,b,c){return{convert:function(d){if(1E3===d)return 10497;if(1001===d)return 33071;if(1002===d)return 33648;if(1003===d)return 9728;if(1004===d)return 9984;if(1005===d)return 9986;if(1006===d)return 9729;if(1007===d)return 9985;if(1008===d)return 9987;if(1009===d)return 5121;if(1017===d)return 32819;if(1018===d)return 32820;if(1019===d)return 33635;if(1010===d)return 5120;if(1011===d)return 5122;
if(1012===d)return 5123;if(1013===d)return 5124;if(1014===d)return 5125;if(1015===d)return 5126;if(1016===d){if(c.isWebGL2)return 5131;var f=b.get("OES_texture_half_float");if(null!==f)return f.HALF_FLOAT_OES}if(1021===d)return 6406;if(1022===d)return 6407;if(1023===d)return 6408;if(1024===d)return 6409;if(1025===d)return 6410;if(1026===d)return 6402;if(1027===d)return 34041;if(1028===d)return 6403;if(100===d)return 32774;if(101===d)return 32778;if(102===d)return 32779;if(200===d)return 0;if(201===
d)return 1;if(202===d)return 768;if(203===d)return 769;if(204===d)return 770;if(205===d)return 771;if(206===d)return 772;if(207===d)return 773;if(208===d)return 774;if(209===d)return 775;if(210===d)return 776;if(33776===d||33777===d||33778===d||33779===d)if(f=b.get("WEBGL_compressed_texture_s3tc"),null!==f){if(33776===d)return f.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===d)return f.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===d)return f.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===d)return f.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===
d||35841===d||35842===d||35843===d)if(f=b.get("WEBGL_compressed_texture_pvrtc"),null!==f){if(35840===d)return f.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===d)return f.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===d)return f.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===d)return f.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===d&&(f=b.get("WEBGL_compressed_texture_etc1"),null!==f))return f.COMPRESSED_RGB_ETC1_WEBGL;if(37808===d||37809===d||37810===d||37811===d||37812===d||37813===d||37814===d||37815===d||37816===
d||37817===d||37818===d||37819===d||37820===d||37821===d)if(f=b.get("WEBGL_compressed_texture_astc"),null!==f)return d;if(103===d||104===d){if(c.isWebGL2){if(103===d)return 32775;if(104===d)return 32776}f=b.get("EXT_blend_minmax");if(null!==f){if(103===d)return f.MIN_EXT;if(104===d)return f.MAX_EXT}}if(1020===d){if(c.isWebGL2)return 34042;f=b.get("WEBGL_depth_texture");if(null!==f)return f.UNSIGNED_INT_24_8_WEBGL}return 0}}}function ge(){I.call(this);this.type="Group"}function df(a){kb.call(this);
this.cameras=a||[]}function Xi(a,b,c){Yi.setFromMatrixPosition(b.matrixWorld);Zi.setFromMatrixPosition(c.matrixWorld);var d=Yi.distanceTo(Zi),f=b.projectionMatrix.elements,g=c.projectionMatrix.elements,h=f[14]/(f[10]-1);c=f[14]/(f[10]+1);var l=(f[9]+1)/f[5],m=(f[9]-1)/f[5],q=(f[8]-1)/f[0],u=(g[8]+1)/g[0];f=h*q;g=h*u;u=d/(-q+u);q=u*-q;b.matrixWorld.decompose(a.position,a.quaternion,a.scale);a.translateX(q);a.translateZ(u);a.matrixWorld.compose(a.position,a.quaternion,a.scale);a.matrixWorldInverse.getInverse(a.matrixWorld);
b=h+u;h=c+u;a.projectionMatrix.makePerspective(f-q,g+(d-q),l*c/h*b,m*c/h*b,b,h)}function sh(a){function b(){return null!==q&&!0===q.isPresenting}function c(){if(b()){var ma=q.getEyeParameters("left");h=2*ma.renderWidth*K;l=ma.renderHeight*K;za=a.getPixelRatio();a.getSize(ea);a.setDrawingBufferSize(h,l,1);Z.viewport.set(0,0,h/2,l);R.viewport.set(h/2,0,h/2,l);fa.start();m.dispatchEvent({type:"sessionstart"})}else m.enabled&&a.setDrawingBufferSize(ea.width,ea.height,za),fa.stop(),m.dispatchEvent({type:"sessionend"})}
function d(ma){for(var ha=navigator.getGamepads&&navigator.getGamepads(),ra=0,Ma=0,cb=ha.length;ra<cb;ra++){var pa=ha[ra];if(pa&&("Daydream Controller"===pa.id||"Gear VR Controller"===pa.id||"Oculus Go Controller"===pa.id||"OpenVR Gamepad"===pa.id||pa.id.startsWith("Oculus Touch")||pa.id.startsWith("HTC Vive Focus")||pa.id.startsWith("Spatial Controller"))){if(Ma===ma)return pa;Ma++}}}function f(){for(var ma=0;ma<y.length;ma++){var ha=y[ma],ra=d(ma);if(void 0!==ra&&void 0!==ra.pose){if(null===ra.pose)break;
var Ma=ra.pose;!1===Ma.hasPosition&&ha.position.set(.2,-.6,-.05);null!==Ma.position&&ha.position.fromArray(Ma.position);null!==Ma.orientation&&ha.quaternion.fromArray(Ma.orientation);ha.matrix.compose(ha.position,ha.quaternion,ha.scale);ha.matrix.premultiply(C);ha.matrix.decompose(ha.position,ha.quaternion,ha.scale);ha.matrixWorldNeedsUpdate=!0;ha.visible=!0;Ma="Daydream Controller"===ra.id?0:1;void 0===Aa[ma]&&(Aa[ma]=!1);Aa[ma]!==ra.buttons[Ma].pressed&&(Aa[ma]=ra.buttons[Ma].pressed,!0===Aa[ma]?
ha.dispatchEvent({type:"selectstart"}):(ha.dispatchEvent({type:"selectend"}),ha.dispatchEvent({type:"select"})))}else ha.visible=!1}}function g(ma,ha){null!==ha&&4===ha.length&&ma.set(ha[0]*h,ha[1]*l,ha[2]*h,ha[3]*l)}var h,l,m=this,q=null,u=null,w=null,y=[],C=new A,D=new A,K=1,J="local-floor";"undefined"!==typeof window&&"VRFrameData"in window&&(u=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",c,!1));var W=new A,T=new n,V=new p,Z=new kb;Z.viewport=new E;Z.layers.enable(1);
var R=new kb;R.viewport=new E;R.layers.enable(2);var Y=new df([Z,R]);Y.layers.enable(1);Y.layers.enable(2);var ea=new k,za,Aa=[];this.enabled=!1;this.getController=function(ma){var ha=y[ma];void 0===ha&&(ha=new ge,ha.matrixAutoUpdate=!1,ha.visible=!1,y[ma]=ha);return ha};this.getDevice=function(){return q};this.setDevice=function(ma){void 0!==ma&&(q=ma);fa.setContext(ma)};this.setFramebufferScaleFactor=function(ma){K=ma};this.setReferenceSpaceType=function(ma){J=ma};this.setPoseTarget=function(ma){void 0!==
ma&&(w=ma)};this.getCamera=function(ma){var ha="local-floor"===J?1.6:0;if(!1===b())return ma.position.set(0,ha,0),ma.rotation.set(0,0,0),ma;q.depthNear=ma.near;q.depthFar=ma.far;q.getFrameData(u);if("local-floor"===J){var ra=q.stageParameters;ra?C.fromArray(ra.sittingToStandingTransform):C.makeTranslation(0,ha,0)}ha=u.pose;ra=null!==w?w:ma;ra.matrix.copy(C);ra.matrix.decompose(ra.position,ra.quaternion,ra.scale);null!==ha.orientation&&(T.fromArray(ha.orientation),ra.quaternion.multiply(T));null!==
ha.position&&(T.setFromRotationMatrix(C),V.fromArray(ha.position),V.applyQuaternion(T),ra.position.add(V));ra.updateMatrixWorld();Z.near=ma.near;R.near=ma.near;Z.far=ma.far;R.far=ma.far;Z.matrixWorldInverse.fromArray(u.leftViewMatrix);R.matrixWorldInverse.fromArray(u.rightViewMatrix);D.getInverse(C);"local-floor"===J&&(Z.matrixWorldInverse.multiply(D),R.matrixWorldInverse.multiply(D));ma=ra.parent;null!==ma&&(W.getInverse(ma.matrixWorld),Z.matrixWorldInverse.multiply(W),R.matrixWorldInverse.multiply(W));
Z.matrixWorld.getInverse(Z.matrixWorldInverse);R.matrixWorld.getInverse(R.matrixWorldInverse);Z.projectionMatrix.fromArray(u.leftProjectionMatrix);R.projectionMatrix.fromArray(u.rightProjectionMatrix);Xi(Y,Z,R);ma=q.getLayers();ma.length&&(ma=ma[0],g(Z.viewport,ma.leftBounds),g(R.viewport,ma.rightBounds));f();return Y};this.getStandingMatrix=function(){return C};this.isPresenting=b;var fa=new Cc;this.setAnimationLoop=function(ma){fa.setAnimationLoop(ma);b()&&fa.start()};this.submitFrame=function(){b()&&
q.submitFrame()};this.dispose=function(){"undefined"!==typeof window&&window.removeEventListener("vrdisplaypresentchange",c)};this.setFrameOfReferenceType=function(){console.warn("THREE.WebVRManager: setFrameOfReferenceType() has been deprecated.")}}function $i(a,b){function c(){return null!==m&&null!==q}function d(V){for(var Z=0;Z<y.length;Z++)C[Z]===V.inputSource&&y[Z].dispatchEvent({type:V.type})}function f(){a.setFramebuffer(null);a.setRenderTarget(a.getRenderTarget());T.stop();l.dispatchEvent({type:"sessionend"})}
function g(V){q=V;T.setContext(m);T.start();l.dispatchEvent({type:"sessionstart"})}function h(V,Z){null===Z?V.matrixWorld.copy(V.matrix):V.matrixWorld.multiplyMatrices(Z.matrixWorld,V.matrix);V.matrixWorldInverse.getInverse(V.matrixWorld)}var l=this,m=null,q=null,u="local-floor",w=null,y=[],C=[],D=new kb;D.layers.enable(1);D.viewport=new E;var K=new kb;K.layers.enable(2);K.viewport=new E;var J=new df([D,K]);J.layers.enable(1);J.layers.enable(2);this.enabled=!1;this.getController=function(V){var Z=
y[V];void 0===Z&&(Z=new ge,Z.matrixAutoUpdate=!1,Z.visible=!1,y[V]=Z);return Z};this.setFramebufferScaleFactor=function(){};this.setReferenceSpaceType=function(V){u=V};this.getSession=function(){return m};this.setSession=function(V){m=V;null!==m&&(m.addEventListener("select",d),m.addEventListener("selectstart",d),m.addEventListener("selectend",d),m.addEventListener("end",f),m.updateRenderState({baseLayer:new XRWebGLLayer(m,b)}),m.requestReferenceSpace(u).then(g),C=m.inputSources,m.addEventListener("inputsourceschange",
function(){C=m.inputSources;console.log(C);for(var Z=0;Z<y.length;Z++)y[Z].userData.inputSource=C[Z]}))};this.getCamera=function(V){if(c()){var Z=V.parent,R=J.cameras;h(J,Z);for(var Y=0;Y<R.length;Y++)h(R[Y],Z);V.matrixWorld.copy(J.matrixWorld);V=V.children;Y=0;for(Z=V.length;Y<Z;Y++)V[Y].updateMatrixWorld(!0);Xi(J,D,K);return J}return V};this.isPresenting=c;var W=null,T=new Cc;T.setAnimationLoop(function(V,Z){w=Z.getViewerPose(q);if(null!==w){var R=w.views,Y=m.renderState.baseLayer;a.setFramebuffer(Y.framebuffer);
for(var ea=0;ea<R.length;ea++){var za=R[ea],Aa=Y.getViewport(za),fa=J.cameras[ea];fa.matrix.fromArray(za.transform.inverse.matrix).getInverse(fa.matrix);fa.projectionMatrix.fromArray(za.projectionMatrix);fa.viewport.set(Aa.x,Aa.y,Aa.width,Aa.height);0===ea&&J.matrix.copy(fa.matrix)}}for(ea=0;ea<y.length;ea++){R=y[ea];if(Y=C[ea])if(Y=Z.getPose(Y.targetRaySpace,q),null!==Y){R.matrix.fromArray(Y.transform.matrix);R.matrix.decompose(R.position,R.rotation,R.scale);R.visible=!0;continue}R.visible=!1}W&&
W(V)});this.setAnimationLoop=function(V){W=V};this.dispose=function(){};this.getStandingMatrix=function(){console.warn("THREE.WebXRManager: getStandingMatrix() is no longer needed.");return new A};this.getDevice=function(){console.warn("THREE.WebXRManager: getDevice() has been deprecated.")};this.setDevice=function(){console.warn("THREE.WebXRManager: setDevice() has been deprecated.")};this.setFrameOfReferenceType=function(){console.warn("THREE.WebXRManager: setFrameOfReferenceType() has been deprecated.")};
this.submitFrame=function(){}}function th(a){var b;function c(){return null===Sa?Sb:1}function d(){sb=new Sc(va);Tb=new tb(va,sb,a);Tb.isWebGL2||(sb.get("WEBGL_depth_texture"),sb.get("OES_texture_float"),sb.get("OES_texture_half_float"),sb.get("OES_texture_half_float_linear"),sb.get("OES_standard_derivatives"),sb.get("OES_element_index_uint"),sb.get("ANGLE_instanced_arrays"));sb.get("OES_texture_float_linear");Fc=new Wi(va,sb,Tb);eb=new pl(va,sb,Fc,Tb);eb.scissor(Db.copy(he).multiplyScalar(Sb).floor());
eb.viewport(rb.copy(ie).multiplyScalar(Sb).floor());ld=new mk(va);Ub=new gl;Gc=new ql(va,sb,eb,Ub,Tb,Fc,ld);eg=new Bd(va);uh=new hd(va,eg,ld);je=new pk(uh,ld);aj=new ok(va);Cd=new fl(M,sb,Tb);fg=new jl;ke=new ol;md=new gd(M,eb,je,Q);bj=new X(va,sb,ld,Tb);cj=new cg(va,sb,ld,Tb);ld.programs=Cd.programs;M.capabilities=Tb;M.extensions=sb;M.properties=Ub;M.renderLists=fg;M.state=eb;M.info=ld}function f(B){B.preventDefault();console.log("THREE.WebGLRenderer: Context Lost.");ka=!0}function g(){console.log("THREE.WebGLRenderer: Context Restored.");
ka=!1;d()}function h(B){B=B.target;B.removeEventListener("dispose",h);l(B)}function l(B){m(B);Ub.remove(B)}function m(B){var H=Ub.get(B).program;B.program=void 0;void 0!==H&&Cd.releaseProgram(H)}function q(B,H){B.render(function(O){M.renderBufferImmediate(O,H)})}function u(B,H,O){if(O&&O.isInstancedBufferGeometry&&!Tb.isWebGL2&&null===sb.get("ANGLE_instanced_arrays"))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");
else{eb.initAttributes();var na=O.attributes;H=H.getAttributes();B=B.defaultAttributeValues;for(var ta in H){var Ja=H[ta];if(0<=Ja){var wa=na[ta];if(void 0!==wa){var Va=wa.normalized,hb=wa.itemSize,Ya=eg.get(wa);if(void 0!==Ya){var Ha=Ya.buffer,Hc=Ya.type;Ya=Ya.bytesPerElement;if(wa.isInterleavedBufferAttribute){var nc=wa.data,le=nc.stride;wa=wa.offset;nc&&nc.isInstancedInterleavedBuffer?(eb.enableAttributeAndDivisor(Ja,nc.meshPerAttribute),void 0===O.maxInstancedCount&&(O.maxInstancedCount=nc.meshPerAttribute*
nc.count)):eb.enableAttribute(Ja);va.bindBuffer(34962,Ha);va.vertexAttribPointer(Ja,hb,Hc,Va,le*Ya,wa*Ya)}else wa.isInstancedBufferAttribute?(eb.enableAttributeAndDivisor(Ja,wa.meshPerAttribute),void 0===O.maxInstancedCount&&(O.maxInstancedCount=wa.meshPerAttribute*wa.count)):eb.enableAttribute(Ja),va.bindBuffer(34962,Ha),va.vertexAttribPointer(Ja,hb,Hc,Va,0,0)}}else if(void 0!==B&&(Va=B[ta],void 0!==Va))switch(Va.length){case 2:va.vertexAttrib2fv(Ja,Va);break;case 3:va.vertexAttrib3fv(Ja,Va);break;
case 4:va.vertexAttrib4fv(Ja,Va);break;default:va.vertexAttrib1fv(Ja,Va)}}}eb.disableUnusedAttributes()}}function w(B,H,O,na){if(!1!==B.visible){if(B.layers.test(H.layers))if(B.isGroup)O=B.renderOrder;else if(B.isLOD)!0===B.autoUpdate&&B.update(H);else if(B.isLight)La.pushLight(B),B.castShadow&&La.pushShadow(B);else if(B.isSprite){if(!B.frustumCulled||vh.intersectsSprite(B)){na&&nd.setFromMatrixPosition(B.matrixWorld).applyMatrix4(ef);var ta=je.update(B),Ja=B.material;Ja.visible&&sa.push(B,ta,Ja,
O,nd.z,null)}}else if(B.isImmediateRenderObject)na&&nd.setFromMatrixPosition(B.matrixWorld).applyMatrix4(ef),sa.push(B,null,B.material,O,nd.z,null);else if(B.isMesh||B.isLine||B.isPoints)if(B.isSkinnedMesh&&B.skeleton.update(),!B.frustumCulled||vh.intersectsObject(B))if(na&&nd.setFromMatrixPosition(B.matrixWorld).applyMatrix4(ef),ta=je.update(B),Ja=B.material,Array.isArray(Ja))for(var wa=ta.groups,Va=0,hb=wa.length;Va<hb;Va++){var Ya=wa[Va],Ha=Ja[Ya.materialIndex];Ha&&Ha.visible&&sa.push(B,ta,Ha,
O,nd.z,Ya)}else Ja.visible&&sa.push(B,ta,Ja,O,nd.z,null);B=B.children;Va=0;for(hb=B.length;Va<hb;Va++)w(B[Va],H,O,na)}}function y(B,H,O,na){for(var ta=0,Ja=B.length;ta<Ja;ta++){var wa=B[ta],Va=wa.object,hb=wa.geometry,Ya=void 0===na?wa.material:na;wa=wa.group;if(O.isArrayCamera){bb=O;for(var Ha=O.cameras,Hc=0,nc=Ha.length;Hc<nc;Hc++){var le=Ha[Hc];Va.layers.test(le.layers)&&(eb.viewport(rb.copy(le.viewport)),La.setupLights(le),C(Va,H,le,hb,Ya,wa))}}else bb=null,C(Va,H,O,hb,Ya,wa)}}function C(B,H,
O,na,ta,Ja){B.onBeforeRender(M,H,O,na,ta,Ja);La=ke.get(H,bb||O);B.modelViewMatrix.multiplyMatrices(O.matrixWorldInverse,B.matrixWorld);B.normalMatrix.getNormalMatrix(B.modelViewMatrix);B.isImmediateRenderObject?(eb.setMaterial(ta),na=K(O,H.fog,ta,B),Pa=b=null,Wa=!1,q(B,na)):M.renderBufferDirect(O,H.fog,na,ta,B,Ja);La=ke.get(H,bb||O)}function D(B,H,O){var na=Ub.get(B),ta=La.state.lights,Ja=ta.state.version;O=Cd.getParameters(B,ta.state,La.state.shadowsArray,H,oc.numPlanes,oc.numIntersection,O);var wa=
Cd.getProgramCode(B,O),Va=na.program,hb=!0;if(void 0===Va)B.addEventListener("dispose",h);else if(Va.code!==wa)m(B);else{if(na.lightsStateVersion!==Ja)na.lightsStateVersion=Ja;else if(void 0!==O.shaderID)return;hb=!1}hb&&(O.shaderID?(wa=Ec[O.shaderID],na.shader={name:B.type,uniforms:hc(wa.uniforms),vertexShader:wa.vertexShader,fragmentShader:wa.fragmentShader}):na.shader={name:B.type,uniforms:B.uniforms,vertexShader:B.vertexShader,fragmentShader:B.fragmentShader},wa=Cd.getProgramCode(B,O),Va=Cd.acquireProgram(B,
na.shader,O,wa),na.program=Va,B.program=Va);O=Va.getAttributes();if(B.morphTargets)for(wa=B.numSupportedMorphTargets=0;wa<M.maxMorphTargets;wa++)0<=O["morphTarget"+wa]&&B.numSupportedMorphTargets++;if(B.morphNormals)for(wa=B.numSupportedMorphNormals=0;wa<M.maxMorphNormals;wa++)0<=O["morphNormal"+wa]&&B.numSupportedMorphNormals++;O=na.shader.uniforms;if(!B.isShaderMaterial&&!B.isRawShaderMaterial||!0===B.clipping)na.numClippingPlanes=oc.numPlanes,na.numIntersection=oc.numIntersection,O.clippingPlanes=
oc.uniform;na.fog=H;na.lightsStateVersion=Ja;B.lights&&(O.ambientLightColor.value=ta.state.ambient,O.lightProbe.value=ta.state.probe,O.directionalLights.value=ta.state.directional,O.spotLights.value=ta.state.spot,O.rectAreaLights.value=ta.state.rectArea,O.pointLights.value=ta.state.point,O.hemisphereLights.value=ta.state.hemi,O.directionalShadowMap.value=ta.state.directionalShadowMap,O.directionalShadowMatrix.value=ta.state.directionalShadowMatrix,O.spotShadowMap.value=ta.state.spotShadowMap,O.spotShadowMatrix.value=
ta.state.spotShadowMatrix,O.pointShadowMap.value=ta.state.pointShadowMap,O.pointShadowMatrix.value=ta.state.pointShadowMatrix);B=na.program.getUniforms();B=id.seqWithValue(B.seq,O);na.uniformsList=B}function K(B,H,O,na){Gc.resetTextureUnits();var ta=Ub.get(O),Ja=La.state.lights;gg&&(wh||B!==Za)&&oc.setState(O.clippingPlanes,O.clipIntersection,O.clipShadows,B,ta,B===Za&&O.id===ua);!1===O.needsUpdate&&(void 0===ta.program?O.needsUpdate=!0:O.fog&&ta.fog!==H?O.needsUpdate=!0:O.lights&&ta.lightsStateVersion!==
Ja.state.version?O.needsUpdate=!0:void 0===ta.numClippingPlanes||ta.numClippingPlanes===oc.numPlanes&&ta.numIntersection===oc.numIntersection||(O.needsUpdate=!0));O.needsUpdate&&(D(O,H,na),O.needsUpdate=!1);var wa=!1,Va=Ja=!1,hb=ta.program,Ya=hb.getUniforms(),Ha=ta.shader.uniforms;eb.useProgram(hb.program)&&(Va=Ja=wa=!0);O.id!==ua&&(ua=O.id,Ja=!0);if(wa||Za!==B){Ya.setValue(va,"projectionMatrix",B.projectionMatrix);Tb.logarithmicDepthBuffer&&Ya.setValue(va,"logDepthBufFC",2/(Math.log(B.far+1)/Math.LN2));
Za!==B&&(Za=B,Va=Ja=!0);if(O.isShaderMaterial||O.isMeshPhongMaterial||O.isMeshStandardMaterial||O.envMap)wa=Ya.map.cameraPosition,void 0!==wa&&wa.setValue(va,nd.setFromMatrixPosition(B.matrixWorld));(O.isMeshPhongMaterial||O.isMeshLambertMaterial||O.isMeshBasicMaterial||O.isMeshStandardMaterial||O.isShaderMaterial||O.skinning)&&Ya.setValue(va,"viewMatrix",B.matrixWorldInverse)}if(O.skinning&&(Ya.setOptional(va,na,"bindMatrix"),Ya.setOptional(va,na,"bindMatrixInverse"),B=na.skeleton))if(wa=B.bones,
Tb.floatVertexTextures){if(void 0===B.boneTexture){wa=Math.sqrt(4*wa.length);wa=Qa.ceilPowerOfTwo(wa);wa=Math.max(wa,4);var Hc=new Float32Array(wa*wa*4);Hc.set(B.boneMatrices);var nc=new Rb(Hc,wa,wa,1023,1015);nc.needsUpdate=!0;B.boneMatrices=Hc;B.boneTexture=nc;B.boneTextureSize=wa}Ya.setValue(va,"boneTexture",B.boneTexture,Gc);Ya.setValue(va,"boneTextureSize",B.boneTextureSize)}else Ya.setOptional(va,B,"boneMatrices");Ja&&(Ya.setValue(va,"toneMappingExposure",M.toneMappingExposure),Ya.setValue(va,
"toneMappingWhitePoint",M.toneMappingWhitePoint),O.lights&&cb(Ha,Va),H&&O.fog&&R(Ha,H),O.isMeshBasicMaterial?J(Ha,O):O.isMeshLambertMaterial?(J(Ha,O),Y(Ha,O)):O.isMeshPhongMaterial?(J(Ha,O),O.isMeshToonMaterial?za(Ha,O):ea(Ha,O)):O.isMeshStandardMaterial?(J(Ha,O),O.isMeshPhysicalMaterial?fa(Ha,O):Aa(Ha,O)):O.isMeshMatcapMaterial?(J(Ha,O),ma(Ha,O)):O.isMeshDepthMaterial?(J(Ha,O),ha(Ha,O)):O.isMeshDistanceMaterial?(J(Ha,O),ra(Ha,O)):O.isMeshNormalMaterial?(J(Ha,O),Ma(Ha,O)):O.isLineBasicMaterial?(W(Ha,
O),O.isLineDashedMaterial&&T(Ha,O)):O.isPointsMaterial?V(Ha,O):O.isSpriteMaterial?Z(Ha,O):O.isShadowMaterial&&(Ha.color.value.copy(O.color),Ha.opacity.value=O.opacity),void 0!==Ha.ltc_1&&(Ha.ltc_1.value=Ca.LTC_1),void 0!==Ha.ltc_2&&(Ha.ltc_2.value=Ca.LTC_2),id.upload(va,ta.uniformsList,Ha,Gc));O.isShaderMaterial&&!0===O.uniformsNeedUpdate&&(id.upload(va,ta.uniformsList,Ha,Gc),O.uniformsNeedUpdate=!1);O.isSpriteMaterial&&Ya.setValue(va,"center",na.center);Ya.setValue(va,"modelViewMatrix",na.modelViewMatrix);
Ya.setValue(va,"normalMatrix",na.normalMatrix);Ya.setValue(va,"modelMatrix",na.matrixWorld);return hb}function J(B,H){B.opacity.value=H.opacity;H.color&&B.diffuse.value.copy(H.color);H.emissive&&B.emissive.value.copy(H.emissive).multiplyScalar(H.emissiveIntensity);H.map&&(B.map.value=H.map);H.alphaMap&&(B.alphaMap.value=H.alphaMap);H.specularMap&&(B.specularMap.value=H.specularMap);H.envMap&&(B.envMap.value=H.envMap,B.flipEnvMap.value=H.envMap.isCubeTexture?-1:1,B.reflectivity.value=H.reflectivity,
B.refractionRatio.value=H.refractionRatio,B.maxMipLevel.value=Ub.get(H.envMap).__maxMipLevel);H.lightMap&&(B.lightMap.value=H.lightMap,B.lightMapIntensity.value=H.lightMapIntensity);H.aoMap&&(B.aoMap.value=H.aoMap,B.aoMapIntensity.value=H.aoMapIntensity);if(H.map)var O=H.map;else H.specularMap?O=H.specularMap:H.displacementMap?O=H.displacementMap:H.normalMap?O=H.normalMap:H.bumpMap?O=H.bumpMap:H.roughnessMap?O=H.roughnessMap:H.metalnessMap?O=H.metalnessMap:H.alphaMap?O=H.alphaMap:H.emissiveMap&&(O=
H.emissiveMap);void 0!==O&&(O.isWebGLRenderTarget&&(O=O.texture),!0===O.matrixAutoUpdate&&O.updateMatrix(),B.uvTransform.value.copy(O.matrix))}function W(B,H){B.diffuse.value.copy(H.color);B.opacity.value=H.opacity}function T(B,H){B.dashSize.value=H.dashSize;B.totalSize.value=H.dashSize+H.gapSize;B.scale.value=H.scale}function V(B,H){B.diffuse.value.copy(H.color);B.opacity.value=H.opacity;B.size.value=H.size*Sb;B.scale.value=.5*pc;B.map.value=H.map;null!==H.map&&(!0===H.map.matrixAutoUpdate&&H.map.updateMatrix(),
B.uvTransform.value.copy(H.map.matrix))}function Z(B,H){B.diffuse.value.copy(H.color);B.opacity.value=H.opacity;B.rotation.value=H.rotation;B.map.value=H.map;null!==H.map&&(!0===H.map.matrixAutoUpdate&&H.map.updateMatrix(),B.uvTransform.value.copy(H.map.matrix))}function R(B,H){B.fogColor.value.copy(H.color);H.isFog?(B.fogNear.value=H.near,B.fogFar.value=H.far):H.isFogExp2&&(B.fogDensity.value=H.density)}function Y(B,H){H.emissiveMap&&(B.emissiveMap.value=H.emissiveMap)}function ea(B,H){B.specular.value.copy(H.specular);
B.shininess.value=Math.max(H.shininess,1E-4);H.emissiveMap&&(B.emissiveMap.value=H.emissiveMap);H.bumpMap&&(B.bumpMap.value=H.bumpMap,B.bumpScale.value=H.bumpScale,1===H.side&&(B.bumpScale.value*=-1));H.normalMap&&(B.normalMap.value=H.normalMap,B.normalScale.value.copy(H.normalScale),1===H.side&&B.normalScale.value.negate());H.displacementMap&&(B.displacementMap.value=H.displacementMap,B.displacementScale.value=H.displacementScale,B.displacementBias.value=H.displacementBias)}function za(B,H){ea(B,
H);H.gradientMap&&(B.gradientMap.value=H.gradientMap)}function Aa(B,H){B.roughness.value=H.roughness;B.metalness.value=H.metalness;H.roughnessMap&&(B.roughnessMap.value=H.roughnessMap);H.metalnessMap&&(B.metalnessMap.value=H.metalnessMap);H.emissiveMap&&(B.emissiveMap.value=H.emissiveMap);H.bumpMap&&(B.bumpMap.value=H.bumpMap,B.bumpScale.value=H.bumpScale,1===H.side&&(B.bumpScale.value*=-1));H.normalMap&&(B.normalMap.value=H.normalMap,B.normalScale.value.copy(H.normalScale),1===H.side&&B.normalScale.value.negate());
H.displacementMap&&(B.displacementMap.value=H.displacementMap,B.displacementScale.value=H.displacementScale,B.displacementBias.value=H.displacementBias);H.envMap&&(B.envMapIntensity.value=H.envMapIntensity)}function fa(B,H){Aa(B,H);B.reflectivity.value=H.reflectivity;B.clearcoat.value=H.clearcoat;B.clearcoatRoughness.value=H.clearcoatRoughness;H.sheen&&B.sheen.value.copy(H.sheen);H.clearcoatNormalMap&&(B.clearcoatNormalScale.value.copy(H.clearcoatNormalScale),B.clearcoatNormalMap.value=H.clearcoatNormalMap,
1===H.side&&B.clearcoatNormalScale.value.negate());B.transparency.value=H.transparency}function ma(B,H){H.matcap&&(B.matcap.value=H.matcap);H.bumpMap&&(B.bumpMap.value=H.bumpMap,B.bumpScale.value=H.bumpScale,1===H.side&&(B.bumpScale.value*=-1));H.normalMap&&(B.normalMap.value=H.normalMap,B.normalScale.value.copy(H.normalScale),1===H.side&&B.normalScale.value.negate());H.displacementMap&&(B.displacementMap.value=H.displacementMap,B.displacementScale.value=H.displacementScale,B.displacementBias.value=
H.displacementBias)}function ha(B,H){H.displacementMap&&(B.displacementMap.value=H.displacementMap,B.displacementScale.value=H.displacementScale,B.displacementBias.value=H.displacementBias)}function ra(B,H){H.displacementMap&&(B.displacementMap.value=H.displacementMap,B.displacementScale.value=H.displacementScale,B.displacementBias.value=H.displacementBias);B.referencePosition.value.copy(H.referencePosition);B.nearDistance.value=H.nearDistance;B.farDistance.value=H.farDistance}function Ma(B,H){H.bumpMap&&
(B.bumpMap.value=H.bumpMap,B.bumpScale.value=H.bumpScale,1===H.side&&(B.bumpScale.value*=-1));H.normalMap&&(B.normalMap.value=H.normalMap,B.normalScale.value.copy(H.normalScale),1===H.side&&B.normalScale.value.negate());H.displacementMap&&(B.displacementMap.value=H.displacementMap,B.displacementScale.value=H.displacementScale,B.displacementBias.value=H.displacementBias)}function cb(B,H){B.ambientLightColor.needsUpdate=H;B.lightProbe.needsUpdate=H;B.directionalLights.needsUpdate=H;B.pointLights.needsUpdate=
H;B.spotLights.needsUpdate=H;B.rectAreaLights.needsUpdate=H;B.hemisphereLights.needsUpdate=H}a=a||{};var pa=void 0!==a.canvas?a.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),Ka=void 0!==a.context?a.context:null,Ta=void 0!==a.alpha?a.alpha:!1,jb=void 0!==a.depth?a.depth:!0,db=void 0!==a.stencil?a.stencil:!0,L=void 0!==a.antialias?a.antialias:!1,Q=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,da=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,oa=void 0!==
a.powerPreference?a.powerPreference:"default",Fa=void 0!==a.failIfMajorPerformanceCaveat?a.failIfMajorPerformanceCaveat:!1,sa=null,La=null;this.domElement=pa;this.debug={checkShaderErrors:!0};this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.clippingPlanes=[];this.localClippingEnabled=!1;this.gammaFactor=2;this.physicallyCorrectLights=this.gammaOutput=this.gammaInput=!1;this.toneMappingWhitePoint=this.toneMappingExposure=this.toneMapping=1;this.maxMorphTargets=
8;this.maxMorphNormals=4;var M=this,ka=!1,qa=null,Xa=0,Ba=0,Sa=null,Ua=null,ua=-1;var Pa=b=null;var Wa=!1;var Za=null,bb=null,rb=new E,Db=new E,cc=null,Ic=pa.width,pc=pa.height,Sb=1,ie=new E(0,0,Ic,pc),he=new E(0,0,Ic,pc),xh=!1,vh=new ic,oc=new mc,gg=!1,wh=!1,ef=new A,nd=new p;try{Ta={alpha:Ta,depth:jb,stencil:db,antialias:L,premultipliedAlpha:Q,preserveDrawingBuffer:da,powerPreference:oa,failIfMajorPerformanceCaveat:Fa,xrCompatible:!0};pa.addEventListener("webglcontextlost",f,!1);pa.addEventListener("webglcontextrestored",
g,!1);var va=Ka||pa.getContext("webgl",Ta)||pa.getContext("experimental-webgl",Ta);if(null===va){if(null!==pa.getContext("webgl"))throw Error("Error creating WebGL context with your selected attributes.");throw Error("Error creating WebGL context.");}void 0===va.getShaderPrecisionFormat&&(va.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(B){throw console.error("THREE.WebGLRenderer: "+B.message),B;}var sb,Tb,eb,ld,Ub,Gc,eg,uh,je,Cd,fg,ke,md,aj,bj,cj,Fc;d();var Uc=
"undefined"!==typeof navigator&&"xr"in navigator&&"supportsSession"in navigator.xr?new $i(M,va):new sh(M);this.vr=Uc;var dj=new Vi(M,je,Tb.maxTextureSize);this.shadowMap=dj;this.getContext=function(){return va};this.getContextAttributes=function(){return va.getContextAttributes()};this.forceContextLoss=function(){var B=sb.get("WEBGL_lose_context");B&&B.loseContext()};this.forceContextRestore=function(){var B=sb.get("WEBGL_lose_context");B&&B.restoreContext()};this.getPixelRatio=function(){return Sb};
this.setPixelRatio=function(){var B=window.devicePixelRatio||1;void 0!==B&&(Sb=B,this.setSize(Ic,pc,!1))};this.getSize=function(B){void 0===B&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),B=new k);return B.set(Ic,pc)};this.setSize=function(B,H,O){Uc.isPresenting()?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(Ic=B,pc=H,pa.width=Math.floor(B*Sb),pa.height=Math.floor(H*Sb),!1!==O&&(pa.style.width=B+"px",pa.style.height=H+"px"),
this.setViewport(B,H))};this.getDrawingBufferSize=function(B){void 0===B&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),B=new k);return B.set(Ic*Sb,pc*Sb).floor()};this.setDrawingBufferSize=function(B,H,O){Ic=B;pc=H;Sb=O;pa.width=Math.floor(B*O);pa.height=Math.floor(H*O);this.setViewport(B,H)};this.getCurrentViewport=function(B){void 0===B&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),B=new E);return B.copy(rb)};
this.getViewport=function(B){return B.copy(ie)};this.setViewport=function(B,H){(0).isVector4?ie.set((0).x,(0).y,(0).z,(0).w):ie.set(0,0,B,H);eb.viewport(rb.copy(ie).multiplyScalar(Sb).floor())};this.getScissor=function(B){return B.copy(he)};this.setScissor=function(B,H,O,na){B.isVector4?he.set(B.x,B.y,B.z,B.w):he.set(B,H,O,na);eb.scissor(Db.copy(he).multiplyScalar(Sb).floor())};this.getScissorTest=function(){return xh};this.setScissorTest=function(B){eb.setScissorTest(xh=B)};this.getClearColor=function(){return md.getClearColor()};
this.setClearColor=function(){md.setClearColor.apply(md,arguments)};this.getClearAlpha=function(){return md.getClearAlpha()};this.setClearAlpha=function(){md.setClearAlpha.apply(md,arguments)};this.clear=function(B,H,O){var na=0;if(void 0===B||B)na|=16384;if(void 0===H||H)na|=256;if(void 0===O||O)na|=1024;va.clear(na)};this.clearColor=function(){this.clear(!0,!1,!1)};this.clearDepth=function(){this.clear(!1,!0,!1)};this.clearStencil=function(){this.clear(!1,!1,!0)};this.dispose=function(){pa.removeEventListener("webglcontextlost",
f,!1);pa.removeEventListener("webglcontextrestored",g,!1);fg.dispose();ke.dispose();Ub.dispose();je.dispose();Uc.dispose();hg.stop()};this.renderBufferImmediate=function(B,H){eb.initAttributes();var O=Ub.get(B);B.hasPositions&&!O.position&&(O.position=va.createBuffer());B.hasNormals&&!O.normal&&(O.normal=va.createBuffer());B.hasUvs&&!O.uv&&(O.uv=va.createBuffer());B.hasColors&&!O.color&&(O.color=va.createBuffer());H=H.getAttributes();B.hasPositions&&(va.bindBuffer(34962,O.position),va.bufferData(34962,
B.positionArray,35048),eb.enableAttribute(H.position),va.vertexAttribPointer(H.position,3,5126,!1,0,0));B.hasNormals&&(va.bindBuffer(34962,O.normal),va.bufferData(34962,B.normalArray,35048),eb.enableAttribute(H.normal),va.vertexAttribPointer(H.normal,3,5126,!1,0,0));B.hasUvs&&(va.bindBuffer(34962,O.uv),va.bufferData(34962,B.uvArray,35048),eb.enableAttribute(H.uv),va.vertexAttribPointer(H.uv,2,5126,!1,0,0));B.hasColors&&(va.bindBuffer(34962,O.color),va.bufferData(34962,B.colorArray,35048),eb.enableAttribute(H.color),
va.vertexAttribPointer(H.color,3,5126,!1,0,0));eb.disableUnusedAttributes();va.drawArrays(4,0,B.count);B.count=0};this.renderBufferDirect=function(B,H,O,na,ta,Ja){eb.setMaterial(na,ta.isMesh&&0>ta.matrixWorld.determinant());var wa=K(B,H,na,ta),Va=!1;if(b!==O.id||Pa!==wa.id||Wa!==(!0===na.wireframe))b=O.id,Pa=wa.id,Wa=!0===na.wireframe,Va=!0;ta.morphTargetInfluences&&(aj.update(ta,O,na,wa),Va=!0);var hb=O.index,Ya=O.attributes.position;H=1;!0===na.wireframe&&(hb=uh.getWireframeAttribute(O),H=2);B=
bj;if(null!==hb){var Ha=eg.get(hb);B=cj;B.setIndex(Ha)}Va&&(u(na,wa,O),null!==hb&&va.bindBuffer(34963,Ha.buffer));Ha=Infinity;null!==hb?Ha=hb.count:void 0!==Ya&&(Ha=Ya.count);Ya=O.drawRange.start*H;wa=null!==Ja?Ja.start*H:0;hb=Math.max(Ya,wa);Ja=Math.max(0,Math.min(Ha,Ya+O.drawRange.count*H,wa+(null!==Ja?Ja.count*H:Infinity))-1-hb+1);if(0!==Ja){if(ta.isMesh)if(!0===na.wireframe)eb.setLineWidth(na.wireframeLinewidth*c()),B.setMode(1);else switch(ta.drawMode){case 0:B.setMode(4);break;case 1:B.setMode(5);
break;case 2:B.setMode(6)}else ta.isLine?(na=na.linewidth,void 0===na&&(na=1),eb.setLineWidth(na*c()),ta.isLineSegments?B.setMode(1):ta.isLineLoop?B.setMode(2):B.setMode(3)):ta.isPoints?B.setMode(0):ta.isSprite&&B.setMode(4);O&&O.isInstancedBufferGeometry?0<O.maxInstancedCount&&B.renderInstances(O,hb,Ja):B.render(hb,Ja)}};this.compile=function(B,H){La=ke.get(B,H);La.init();B.traverse(function(O){O.isLight&&(La.pushLight(O),O.castShadow&&La.pushShadow(O))});La.setupLights(H);B.traverse(function(O){if(O.material)if(Array.isArray(O.material))for(var na=
0;na<O.material.length;na++)D(O.material[na],B.fog,O);else D(O.material,B.fog,O)})};var yh=null,hg=new Cc;hg.setAnimationLoop(function(B){Uc.isPresenting()||yh&&yh(B)});"undefined"!==typeof window&&hg.setContext(window);this.setAnimationLoop=function(B){yh=B;Uc.setAnimationLoop(B);hg.start()};this.render=function(B,H,O,na){if(void 0!==O){console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead.");var ta=O}if(void 0!==na){console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead.");
var Ja=na}H&&H.isCamera?ka||(Pa=b=null,Wa=!1,ua=-1,Za=null,!0===B.autoUpdate&&B.updateMatrixWorld(),null===H.parent&&H.updateMatrixWorld(),Uc.enabled&&(H=Uc.getCamera(H)),La=ke.get(B,H),La.init(),B.onBeforeRender(M,B,H,ta||Sa),ef.multiplyMatrices(H.projectionMatrix,H.matrixWorldInverse),vh.setFromMatrix(ef),wh=this.localClippingEnabled,gg=oc.init(this.clippingPlanes,wh,H),sa=fg.get(B,H),sa.init(),w(B,H,0,M.sortObjects),!0===M.sortObjects&&sa.sort(),gg&&oc.beginShadows(),dj.render(La.state.shadowsArray,
B,H),La.setupLights(H),gg&&oc.endShadows(),this.info.autoReset&&this.info.reset(),void 0!==ta&&this.setRenderTarget(ta),md.render(sa,B,H,Ja),O=sa.opaque,na=sa.transparent,B.overrideMaterial?(ta=B.overrideMaterial,O.length&&y(O,B,H,ta),na.length&&y(na,B,H,ta)):(O.length&&y(O,B,H),na.length&&y(na,B,H)),null!==Sa&&(Gc.updateRenderTargetMipmap(Sa),Gc.updateMultisampleRenderTarget(Sa)),eb.buffers.depth.setTest(!0),eb.buffers.depth.setMask(!0),eb.buffers.color.setMask(!0),eb.setPolygonOffset(!1),Uc.enabled&&
Uc.submitFrame(),La=sa=null):console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")};this.setFramebuffer=function(B){qa!==B&&va.bindFramebuffer(36160,B);qa=B};this.getActiveCubeFace=function(){return Xa};this.getActiveMipmapLevel=function(){return Ba};this.getRenderTarget=function(){return Sa};this.setRenderTarget=function(B,H,O){Sa=B;Xa=H;Ba=O;B&&void 0===Ub.get(B).__webglFramebuffer&&Gc.setupRenderTarget(B);var na=qa,ta=!1;B?(na=Ub.get(B).__webglFramebuffer,B.isWebGLRenderTargetCube?
(na=na[H||0],ta=!0):na=B.isWebGLMultisampleRenderTarget?Ub.get(B).__webglMultisampledFramebuffer:na,rb.copy(B.viewport),Db.copy(B.scissor),cc=B.scissorTest):(rb.copy(ie).multiplyScalar(Sb).floor(),Db.copy(he).multiplyScalar(Sb).floor(),cc=xh);Ua!==na&&(va.bindFramebuffer(36160,na),Ua=na);eb.viewport(rb);eb.scissor(Db);eb.setScissorTest(cc);ta&&(B=Ub.get(B.texture),va.framebufferTexture2D(36160,36064,34069+(H||0),B.__webglTexture,O||0))};this.readRenderTargetPixels=function(B,H,O,na,ta,Ja){if(B&&B.isWebGLRenderTarget){var wa=
Ub.get(B).__webglFramebuffer;if(wa){var Va=!1;wa!==Ua&&(va.bindFramebuffer(36160,wa),Va=!0);try{var hb=B.texture,Ya=hb.format,Ha=hb.type;1023!==Ya&&Fc.convert(Ya)!==va.getParameter(35739)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):1009===Ha||Fc.convert(Ha)===va.getParameter(35738)||1015===Ha&&(Tb.isWebGL2||sb.get("OES_texture_float")||sb.get("WEBGL_color_buffer_float"))||1016===Ha&&(Tb.isWebGL2?sb.get("EXT_color_buffer_float"):
sb.get("EXT_color_buffer_half_float"))?36053===va.checkFramebufferStatus(36160)?0<=H&&H<=B.width-na&&0<=O&&O<=B.height-ta&&va.readPixels(H,O,na,ta,Fc.convert(Ya),Fc.convert(Ha),Ja):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."):console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.")}finally{Va&&va.bindFramebuffer(36160,Ua)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")};
this.copyFramebufferToTexture=function(B,H,O){var na=H.image.width,ta=H.image.height,Ja=Fc.convert(H.format);Gc.setTexture2D(H,0);va.copyTexImage2D(3553,O||0,Ja,B.x,B.y,na,ta,0)};this.copyTextureToTexture=function(B,H,O,na){var ta=H.image.width,Ja=H.image.height,wa=Fc.convert(O.format),Va=Fc.convert(O.type);Gc.setTexture2D(O,0);H.isDataTexture?va.texSubImage2D(3553,na||0,B.x,B.y,ta,Ja,wa,Va,H.image.data):va.texSubImage2D(3553,na||0,B.x,B.y,wa,Va,H.image)};"undefined"!==typeof __THREE_DEVTOOLS__&&
__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function ig(a,b){this.name="";this.color=new ca(a);this.density=void 0!==b?b:2.5E-4}function jg(a,b,c){this.name="";this.color=new ca(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3}function Dd(a,b){this.array=a;this.stride=b;this.count=void 0!==a?a.length/b:0;this.dynamic=!1;this.updateRange={offset:0,count:-1};this.version=0}function ff(a,b,c,d){this.data=a;this.itemSize=b;this.offset=c;this.normalized=!0===d}function od(a){xa.call(this);
this.type="SpriteMaterial";this.color=new ca(16777215);this.map=null;this.rotation=0;this.sizeAttenuation=!0;this.lights=!1;this.transparent=!0;this.setValues(a)}function gf(a){I.call(this);this.type="Sprite";if(void 0===me){me=new la;var b=new Dd(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);me.setIndex([0,1,2,0,2,3]);me.addAttribute("position",new ff(b,3,0,!1));me.addAttribute("uv",new ff(b,2,3,!1))}this.geometry=me;this.material=void 0!==a?a:new od;this.center=new k(.5,
.5)}function kg(a,b,c,d,f,g){ne.subVectors(a,c).addScalar(.5).multiply(d);void 0!==f?(hf.x=g*ne.x-f*ne.y,hf.y=f*ne.x+g*ne.y):hf.copy(ne);a.copy(b);a.x+=hf.x;a.y+=hf.y;a.applyMatrix4(ej)}function jf(){I.call(this);this.type="LOD";Object.defineProperties(this,{levels:{enumerable:!0,value:[]}});this.autoUpdate=!0}function kf(a,b){a&&a.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");Oa.call(this,a,b);this.type="SkinnedMesh";this.bindMode=
"attached";this.bindMatrix=new A;this.bindMatrixInverse=new A}function lg(a,b){a=a||[];this.bones=a.slice(0);this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===b)this.calculateInverses();else if(this.bones.length===b.length)this.boneInverses=b.slice(0);else for(console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[],a=0,b=this.bones.length;a<b;a++)this.boneInverses.push(new A)}function zh(){I.call(this);this.type="Bone"}function lb(a){xa.call(this);
this.type="LineBasicMaterial";this.color=new ca(16777215);this.linewidth=1;this.linejoin=this.linecap="round";this.lights=!1;this.setValues(a)}function Ib(a,b,c){1===c&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead.");I.call(this);this.type="Line";this.geometry=void 0!==a?a:new la;this.material=void 0!==b?b:new lb({color:16777215*Math.random()})}function pb(a,b){Ib.call(this,a,b);this.type="LineSegments"}function mg(a,b){Ib.call(this,a,b);
this.type="LineLoop"}function qc(a){xa.call(this);this.type="PointsMaterial";this.color=new ca(16777215);this.map=null;this.size=1;this.sizeAttenuation=!0;this.lights=this.morphTargets=!1;this.setValues(a)}function oe(a,b){I.call(this);this.type="Points";this.geometry=void 0!==a?a:new la;this.material=void 0!==b?b:new qc({color:16777215*Math.random()});this.updateMorphTargets()}function Ah(a,b,c,d,f,g,h){var l=Bh.distanceSqToPoint(a);l<c&&(c=new p,Bh.closestPointToPoint(a,c),c.applyMatrix4(d),a=f.ray.origin.distanceTo(c),
a<f.near||a>f.far||g.push({distance:a,distanceToRay:Math.sqrt(l),point:c,index:b,face:null,object:h}))}function Ch(a,b,c,d,f,g,h,l,m){z.call(this,a,b,c,d,f,g,h,l,m);this.format=void 0!==h?h:1022;this.minFilter=void 0!==g?g:1006;this.magFilter=void 0!==f?f:1006;this.generateMipmaps=!1}function pe(a,b,c,d,f,g,h,l,m,q,u,w){z.call(this,null,g,h,l,m,q,d,f,u,w);this.image={width:b,height:c};this.mipmaps=a;this.generateMipmaps=this.flipY=!1}function lf(a,b,c,d,f,g,h,l,m){z.call(this,a,b,c,d,f,g,h,l,m);this.needsUpdate=
!0}function mf(a,b,c,d,f,g,h,l,m,q){q=void 0!==q?q:1026;if(1026!==q&&1027!==q)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===c&&1026===q&&(c=1012);void 0===c&&1027===q&&(c=1020);z.call(this,null,d,f,g,h,l,q,c,m);this.image={width:a,height:b};this.magFilter=void 0!==h?h:1003;this.minFilter=void 0!==l?l:1003;this.generateMipmaps=this.flipY=!1}function qe(a){la.call(this);this.type="WireframeGeometry";var b=[],c,d,f,g=[0,0],h={},l=["a","b","c"];
if(a&&a.isGeometry){var m=a.faces;var q=0;for(d=m.length;q<d;q++){var u=m[q];for(c=0;3>c;c++){var w=u[l[c]];var y=u[l[(c+1)%3]];g[0]=Math.min(w,y);g[1]=Math.max(w,y);w=g[0]+","+g[1];void 0===h[w]&&(h[w]={index1:g[0],index2:g[1]})}}for(w in h)q=h[w],l=a.vertices[q.index1],b.push(l.x,l.y,l.z),l=a.vertices[q.index2],b.push(l.x,l.y,l.z)}else if(a&&a.isBufferGeometry)if(l=new p,null!==a.index){m=a.attributes.position;u=a.index;var C=a.groups;0===C.length&&(C=[{start:0,count:u.count,materialIndex:0}]);
a=0;for(f=C.length;a<f;++a)for(q=C[a],c=q.start,d=q.count,q=c,d=c+d;q<d;q+=3)for(c=0;3>c;c++)w=u.getX(q+c),y=u.getX(q+(c+1)%3),g[0]=Math.min(w,y),g[1]=Math.max(w,y),w=g[0]+","+g[1],void 0===h[w]&&(h[w]={index1:g[0],index2:g[1]});for(w in h)q=h[w],l.fromBufferAttribute(m,q.index1),b.push(l.x,l.y,l.z),l.fromBufferAttribute(m,q.index2),b.push(l.x,l.y,l.z)}else for(m=a.attributes.position,q=0,d=m.count/3;q<d;q++)for(c=0;3>c;c++)h=3*q+c,l.fromBufferAttribute(m,h),b.push(l.x,l.y,l.z),h=3*q+(c+1)%3,l.fromBufferAttribute(m,
h),b.push(l.x,l.y,l.z);this.addAttribute("position",new ia(b,3))}function nf(a,b,c){Ia.call(this);this.type="ParametricGeometry";this.parameters={func:a,slices:b,stacks:c};this.fromBufferGeometry(new re(a,b,c));this.mergeVertices()}function re(a,b,c){la.call(this);this.type="ParametricBufferGeometry";this.parameters={func:a,slices:b,stacks:c};var d=[],f=[],g=[],h=[],l=new p,m=new p,q=new p,u=new p,w=new p,y,C;3>a.length&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");
var D=b+1;for(y=0;y<=c;y++){var K=y/c;for(C=0;C<=b;C++){var J=C/b;a(J,K,m);f.push(m.x,m.y,m.z);0<=J-1E-5?(a(J-1E-5,K,q),u.subVectors(m,q)):(a(J+1E-5,K,q),u.subVectors(q,m));0<=K-1E-5?(a(J,K-1E-5,q),w.subVectors(m,q)):(a(J,K+1E-5,q),w.subVectors(q,m));l.crossVectors(u,w).normalize();g.push(l.x,l.y,l.z);h.push(J,K)}}for(y=0;y<c;y++)for(C=0;C<b;C++)a=y*D+C+1,l=(y+1)*D+C+1,m=(y+1)*D+C,d.push(y*D+C,a,m),d.push(a,l,m);this.setIndex(d);this.addAttribute("position",new ia(f,3));this.addAttribute("normal",
new ia(g,3));this.addAttribute("uv",new ia(h,2))}function of(a,b,c,d){Ia.call(this);this.type="PolyhedronGeometry";this.parameters={vertices:a,indices:b,radius:c,detail:d};this.fromBufferGeometry(new Xb(a,b,c,d));this.mergeVertices()}function Xb(a,b,c,d){function f(D,K,J,W){W=Math.pow(2,W);var T=[],V,Z;for(V=0;V<=W;V++){T[V]=[];var R=D.clone().lerp(J,V/W),Y=K.clone().lerp(J,V/W),ea=W-V;for(Z=0;Z<=ea;Z++)T[V][Z]=0===Z&&V===W?R:R.clone().lerp(Y,Z/ea)}for(V=0;V<W;V++)for(Z=0;Z<2*(W-V)-1;Z++)D=Math.floor(Z/
2),0===Z%2?(h(T[V][D+1]),h(T[V+1][D]),h(T[V][D])):(h(T[V][D+1]),h(T[V+1][D+1]),h(T[V+1][D]))}function g(){for(var D=0;D<C.length;D+=6){var K=C[D+0],J=C[D+2],W=C[D+4],T=Math.min(K,J,W);.9<Math.max(K,J,W)&&.1>T&&(.2>K&&(C[D+0]+=1),.2>J&&(C[D+2]+=1),.2>W&&(C[D+4]+=1))}}function h(D){y.push(D.x,D.y,D.z)}function l(D,K){D*=3;K.x=a[D+0];K.y=a[D+1];K.z=a[D+2]}function m(){for(var D=new p,K=new p,J=new p,W=new p,T=new k,V=new k,Z=new k,R=0,Y=0;R<y.length;R+=9,Y+=6){D.set(y[R+0],y[R+1],y[R+2]);K.set(y[R+3],
y[R+4],y[R+5]);J.set(y[R+6],y[R+7],y[R+8]);T.set(C[Y+0],C[Y+1]);V.set(C[Y+2],C[Y+3]);Z.set(C[Y+4],C[Y+5]);W.copy(D).add(K).add(J).divideScalar(3);var ea=u(W);q(T,Y+0,D,ea);q(V,Y+2,K,ea);q(Z,Y+4,J,ea)}}function q(D,K,J,W){0>W&&1===D.x&&(C[K]=D.x-1);0===J.x&&0===J.z&&(C[K]=W/2/Math.PI+.5)}function u(D){return Math.atan2(D.z,-D.x)}function w(D){return Math.atan2(-D.y,Math.sqrt(D.x*D.x+D.z*D.z))}la.call(this);this.type="PolyhedronBufferGeometry";this.parameters={vertices:a,indices:b,radius:c,detail:d};
c=c||1;d=d||0;var y=[],C=[];(function(D){for(var K=new p,J=new p,W=new p,T=0;T<b.length;T+=3)l(b[T+0],K),l(b[T+1],J),l(b[T+2],W),f(K,J,W,D)})(d);(function(D){for(var K=new p,J=0;J<y.length;J+=3)K.x=y[J+0],K.y=y[J+1],K.z=y[J+2],K.normalize().multiplyScalar(D),y[J+0]=K.x,y[J+1]=K.y,y[J+2]=K.z})(c);(function(){for(var D=new p,K=0;K<y.length;K+=3){D.x=y[K+0];D.y=y[K+1];D.z=y[K+2];var J=u(D)/2/Math.PI+.5,W=w(D)/Math.PI+.5;C.push(J,1-W)}m();g()})();this.addAttribute("position",new ia(y,3));this.addAttribute("normal",
new ia(y.slice(),3));this.addAttribute("uv",new ia(C,2));0===d?this.computeVertexNormals():this.normalizeNormals()}function pf(a,b){Ia.call(this);this.type="TetrahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new se(a,b));this.mergeVertices()}function se(a,b){Xb.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],a,b);this.type="TetrahedronBufferGeometry";this.parameters={radius:a,detail:b}}function qf(a,b){Ia.call(this);this.type="OctahedronGeometry";
this.parameters={radius:a,detail:b};this.fromBufferGeometry(new Ed(a,b));this.mergeVertices()}function Ed(a,b){Xb.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],a,b);this.type="OctahedronBufferGeometry";this.parameters={radius:a,detail:b}}function rf(a,b){Ia.call(this);this.type="IcosahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new te(a,b));this.mergeVertices()}function te(a,b){var c=(1+Math.sqrt(5))/2;Xb.call(this,
[-1,c,0,1,c,0,-1,-c,0,1,-c,0,0,-1,c,0,1,c,0,-1,-c,0,1,-c,c,0,-1,c,0,1,-c,0,-1,-c,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],a,b);this.type="IcosahedronBufferGeometry";this.parameters={radius:a,detail:b}}function sf(a,b){Ia.call(this);this.type="DodecahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new ue(a,b));this.mergeVertices()}function ue(a,b){var c=(1+Math.sqrt(5))/2,d=1/
c;Xb.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,-d,-c,0,-d,c,0,d,-c,0,d,c,-d,-c,0,-d,c,0,d,-c,0,d,c,0,-c,0,-d,c,0,-d,-c,0,d,c,0,d],[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],a,b);this.type="DodecahedronBufferGeometry";this.parameters={radius:a,detail:b}}
function uf(a,b,c,d,f,g){Ia.call(this);this.type="TubeGeometry";this.parameters={path:a,tubularSegments:b,radius:c,radialSegments:d,closed:f};void 0!==g&&console.warn("THREE.TubeGeometry: taper has been removed.");a=new Fd(a,b,c,d,f);this.tangents=a.tangents;this.normals=a.normals;this.binormals=a.binormals;this.fromBufferGeometry(a);this.mergeVertices()}function Fd(a,b,c,d,f){function g(V){y=a.getPointAt(V/b,y);var Z=m.normals[V];V=m.binormals[V];for(D=0;D<=d;D++){var R=D/d*Math.PI*2,Y=Math.sin(R);
R=-Math.cos(R);u.x=R*Z.x+Y*V.x;u.y=R*Z.y+Y*V.y;u.z=R*Z.z+Y*V.z;u.normalize();J.push(u.x,u.y,u.z);q.x=y.x+c*u.x;q.y=y.y+c*u.y;q.z=y.z+c*u.z;K.push(q.x,q.y,q.z)}}function h(){for(D=1;D<=b;D++)for(C=1;C<=d;C++){var V=(d+1)*D+(C-1),Z=(d+1)*D+C,R=(d+1)*(D-1)+C;T.push((d+1)*(D-1)+(C-1),V,R);T.push(V,Z,R)}}function l(){for(C=0;C<=b;C++)for(D=0;D<=d;D++)w.x=C/b,w.y=D/d,W.push(w.x,w.y)}la.call(this);this.type="TubeBufferGeometry";this.parameters={path:a,tubularSegments:b,radius:c,radialSegments:d,closed:f};
b=b||64;c=c||1;d=d||8;f=f||!1;var m=a.computeFrenetFrames(b,f);this.tangents=m.tangents;this.normals=m.normals;this.binormals=m.binormals;var q=new p,u=new p,w=new k,y=new p,C,D,K=[],J=[],W=[],T=[];(function(){for(C=0;C<b;C++)g(C);g(!1===f?b:0);l();h()})();this.setIndex(T);this.addAttribute("position",new ia(K,3));this.addAttribute("normal",new ia(J,3));this.addAttribute("uv",new ia(W,2))}function vf(a,b,c,d,f,g,h){Ia.call(this);this.type="TorusKnotGeometry";this.parameters={radius:a,tube:b,tubularSegments:c,
radialSegments:d,p:f,q:g};void 0!==h&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead.");this.fromBufferGeometry(new ve(a,b,c,d,f,g));this.mergeVertices()}function ve(a,b,c,d,f,g){function h(Y,ea,za,Aa,fa){var ma=Math.sin(Y);ea=za/ea*Y;za=Math.cos(ea);fa.x=Aa*(2+za)*.5*Math.cos(Y);fa.y=Aa*(2+za)*ma*.5;fa.z=Aa*Math.sin(ea)*.5}la.call(this);this.type="TorusKnotBufferGeometry";this.parameters={radius:a,tube:b,tubularSegments:c,radialSegments:d,p:f,
q:g};a=a||1;b=b||.4;c=Math.floor(c)||64;d=Math.floor(d)||8;f=f||2;g=g||3;var l=[],m=[],q=[],u=[],w,y=new p,C=new p,D=new p,K=new p,J=new p,W=new p,T=new p;for(w=0;w<=c;++w){var V=w/c*f*Math.PI*2;h(V,f,g,a,D);h(V+.01,f,g,a,K);W.subVectors(K,D);T.addVectors(K,D);J.crossVectors(W,T);T.crossVectors(J,W);J.normalize();T.normalize();for(V=0;V<=d;++V){var Z=V/d*Math.PI*2,R=-b*Math.cos(Z);Z=b*Math.sin(Z);y.x=D.x+(R*T.x+Z*J.x);y.y=D.y+(R*T.y+Z*J.y);y.z=D.z+(R*T.z+Z*J.z);m.push(y.x,y.y,y.z);C.subVectors(y,
D).normalize();q.push(C.x,C.y,C.z);u.push(w/c);u.push(V/d)}}for(V=1;V<=c;V++)for(w=1;w<=d;w++)a=(d+1)*V+(w-1),b=(d+1)*V+w,f=(d+1)*(V-1)+w,l.push((d+1)*(V-1)+(w-1),a,f),l.push(a,b,f);this.setIndex(l);this.addAttribute("position",new ia(m,3));this.addAttribute("normal",new ia(q,3));this.addAttribute("uv",new ia(u,2))}function wf(a,b,c,d,f){Ia.call(this);this.type="TorusGeometry";this.parameters={radius:a,tube:b,radialSegments:c,tubularSegments:d,arc:f};this.fromBufferGeometry(new we(a,b,c,d,f));this.mergeVertices()}
function we(a,b,c,d,f){la.call(this);this.type="TorusBufferGeometry";this.parameters={radius:a,tube:b,radialSegments:c,tubularSegments:d,arc:f};a=a||1;b=b||.4;c=Math.floor(c)||8;d=Math.floor(d)||6;f=f||2*Math.PI;var g=[],h=[],l=[],m=[],q=new p,u=new p,w=new p,y,C;for(y=0;y<=c;y++)for(C=0;C<=d;C++){var D=C/d*f,K=y/c*Math.PI*2;u.x=(a+b*Math.cos(K))*Math.cos(D);u.y=(a+b*Math.cos(K))*Math.sin(D);u.z=b*Math.sin(K);h.push(u.x,u.y,u.z);q.x=a*Math.cos(D);q.y=a*Math.sin(D);w.subVectors(u,q).normalize();l.push(w.x,
w.y,w.z);m.push(C/d);m.push(y/c)}for(y=1;y<=c;y++)for(C=1;C<=d;C++)a=(d+1)*(y-1)+C-1,b=(d+1)*(y-1)+C,f=(d+1)*y+C,g.push((d+1)*y+C-1,a,f),g.push(a,b,f);this.setIndex(g);this.addAttribute("position",new ia(h,3));this.addAttribute("normal",new ia(l,3));this.addAttribute("uv",new ia(m,2))}function fj(a,b,c,d,f){if(f===0<rl(a,b,c,d))for(f=b;f<c;f+=d)var g=gj(f,a[f],a[f+1],g);else for(f=c-d;f>=b;f-=d)g=gj(f,a[f],a[f+1],g);g&&Gd(g,g.next)&&(xf(g),g=g.next);return g}function yf(a,b){if(!a)return a;b||(b=
a);do{var c=!1;if(a.steiner||!Gd(a,a.next)&&0!==Jb(a.prev,a,a.next))a=a.next;else{xf(a);a=b=a.prev;if(a===a.next)break;c=!0}}while(c||a!==b);return b}function zf(a,b,c,d,f,g,h){if(a){!h&&g&&sl(a,d,f,g);for(var l=a,m,q;a.prev!==a.next;)if(m=a.prev,q=a.next,g?tl(a,d,f,g):ul(a))b.push(m.i/c),b.push(a.i/c),b.push(q.i/c),xf(a),l=a=q.next;else if(a=q,a===l){h?1===h?(a=vl(a,b,c),zf(a,b,c,d,f,g,2)):2===h&&wl(a,b,c,d,f,g):zf(yf(a),b,c,d,f,g,1);break}}}function ul(a){var b=a.prev,c=a.next;if(0<=Jb(b,a,c))return!1;
for(var d=a.next.next;d!==a.prev;){if(xe(b.x,b.y,a.x,a.y,c.x,c.y,d.x,d.y)&&0<=Jb(d.prev,d,d.next))return!1;d=d.next}return!0}function tl(a,b,c,d){var f=a.prev,g=a.next;if(0<=Jb(f,a,g))return!1;var h=f.x>a.x?f.x>g.x?f.x:g.x:a.x>g.x?a.x:g.x,l=f.y>a.y?f.y>g.y?f.y:g.y:a.y>g.y?a.y:g.y,m=Dh(f.x<a.x?f.x<g.x?f.x:g.x:a.x<g.x?a.x:g.x,f.y<a.y?f.y<g.y?f.y:g.y:a.y<g.y?a.y:g.y,b,c,d);b=Dh(h,l,b,c,d);c=a.prevZ;for(d=a.nextZ;c&&c.z>=m&&d&&d.z<=b;){if(c!==a.prev&&c!==a.next&&xe(f.x,f.y,a.x,a.y,g.x,g.y,c.x,c.y)&&0<=
Jb(c.prev,c,c.next))return!1;c=c.prevZ;if(d!==a.prev&&d!==a.next&&xe(f.x,f.y,a.x,a.y,g.x,g.y,d.x,d.y)&&0<=Jb(d.prev,d,d.next))return!1;d=d.nextZ}for(;c&&c.z>=m;){if(c!==a.prev&&c!==a.next&&xe(f.x,f.y,a.x,a.y,g.x,g.y,c.x,c.y)&&0<=Jb(c.prev,c,c.next))return!1;c=c.prevZ}for(;d&&d.z<=b;){if(d!==a.prev&&d!==a.next&&xe(f.x,f.y,a.x,a.y,g.x,g.y,d.x,d.y)&&0<=Jb(d.prev,d,d.next))return!1;d=d.nextZ}return!0}function vl(a,b,c){var d=a;do{var f=d.prev,g=d.next.next;!Gd(f,g)&&hj(f,d,d.next,g)&&Af(f,g)&&Af(g,f)&&
(b.push(f.i/c),b.push(d.i/c),b.push(g.i/c),xf(d),xf(d.next),d=a=g);d=d.next}while(d!==a);return d}function wl(a,b,c,d,f,g){var h=a;do{for(var l=h.next.next;l!==h.prev;){if(h.i!==l.i&&xl(h,l)){a=ij(h,l);h=yf(h,h.next);a=yf(a,a.next);zf(h,b,c,d,f,g);zf(a,b,c,d,f,g);return}l=l.next}h=h.next}while(h!==a)}function yl(a,b,c,d){var f=[],g;var h=0;for(g=b.length;h<g;h++){var l=b[h]*d;var m=h<g-1?b[h+1]*d:a.length;l=fj(a,l,m,d,!1);l===l.next&&(l.steiner=!0);f.push(zl(l))}f.sort(Al);for(h=0;h<f.length;h++)Bl(f[h],
c),c=yf(c,c.next);return c}function Al(a,b){return a.x-b.x}function Bl(a,b){if(b=Cl(a,b))a=ij(b,a),yf(a,a.next)}function Cl(a,b){var c=b,d=a.x,f=a.y,g=-Infinity;do{if(f<=c.y&&f>=c.next.y&&c.next.y!==c.y){var h=c.x+(f-c.y)*(c.next.x-c.x)/(c.next.y-c.y);if(h<=d&&h>g){g=h;if(h===d){if(f===c.y)return c;if(f===c.next.y)return c.next}var l=c.x<c.next.x?c:c.next}}c=c.next}while(c!==b);if(!l)return null;if(d===g)return l.prev;b=l;h=l.x;var m=l.y,q=Infinity;for(c=l.next;c!==b;){if(d>=c.x&&c.x>=h&&d!==c.x&&
xe(f<m?d:g,f,h,m,f<m?g:d,f,c.x,c.y)){var u=Math.abs(f-c.y)/(d-c.x);(u<q||u===q&&c.x>l.x)&&Af(c,a)&&(l=c,q=u)}c=c.next}return l}function sl(a,b,c,d){var f=a;do null===f.z&&(f.z=Dh(f.x,f.y,b,c,d)),f.prevZ=f.prev,f=f.nextZ=f.next;while(f!==a);f.prevZ.nextZ=null;f.prevZ=null;Dl(f)}function Dl(a){var b,c,d,f,g=1;do{var h=a;var l=a=null;for(c=0;h;){c++;var m=h;for(b=d=0;b<g&&(d++,m=m.nextZ,m);b++);for(f=g;0<d||0<f&&m;)0!==d&&(0===f||!m||h.z<=m.z)?(b=h,h=h.nextZ,d--):(b=m,m=m.nextZ,f--),l?l.nextZ=b:a=b,
b.prevZ=l,l=b;h=m}l.nextZ=null;g*=2}while(1<c);return a}function Dh(a,b,c,d,f){a=32767*(a-c)*f;b=32767*(b-d)*f;a=(a|a<<8)&16711935;a=(a|a<<4)&252645135;a=(a|a<<2)&858993459;b=(b|b<<8)&16711935;b=(b|b<<4)&252645135;b=(b|b<<2)&858993459;return(a|a<<1)&1431655765|((b|b<<1)&1431655765)<<1}function zl(a){var b=a,c=a;do{if(b.x<c.x||b.x===c.x&&b.y<c.y)c=b;b=b.next}while(b!==a);return c}function xe(a,b,c,d,f,g,h,l){return 0<=(f-h)*(b-l)-(a-h)*(g-l)&&0<=(a-h)*(d-l)-(c-h)*(b-l)&&0<=(c-h)*(g-l)-(f-h)*(d-l)}
function xl(a,b){return a.next.i!==b.i&&a.prev.i!==b.i&&!El(a,b)&&Af(a,b)&&Af(b,a)&&Fl(a,b)}function Jb(a,b,c){return(b.y-a.y)*(c.x-b.x)-(b.x-a.x)*(c.y-b.y)}function Gd(a,b){return a.x===b.x&&a.y===b.y}function hj(a,b,c,d){return Gd(a,c)&&Gd(b,d)||Gd(a,d)&&Gd(c,b)?!0:0<Jb(a,b,c)!==0<Jb(a,b,d)&&0<Jb(c,d,a)!==0<Jb(c,d,b)}function El(a,b){var c=a;do{if(c.i!==a.i&&c.next.i!==a.i&&c.i!==b.i&&c.next.i!==b.i&&hj(c,c.next,a,b))return!0;c=c.next}while(c!==a);return!1}function Af(a,b){return 0>Jb(a.prev,a,
a.next)?0<=Jb(a,b,a.next)&&0<=Jb(a,a.prev,b):0>Jb(a,b,a.prev)||0>Jb(a,a.next,b)}function Fl(a,b){var c=a,d=!1,f=(a.x+b.x)/2;b=(a.y+b.y)/2;do c.y>b!==c.next.y>b&&c.next.y!==c.y&&f<(c.next.x-c.x)*(b-c.y)/(c.next.y-c.y)+c.x&&(d=!d),c=c.next;while(c!==a);return d}function ij(a,b){var c=new Eh(a.i,a.x,a.y),d=new Eh(b.i,b.x,b.y),f=a.next,g=b.prev;a.next=b;b.prev=a;c.next=f;f.prev=c;d.next=c;c.prev=d;g.next=d;d.prev=g;return d}function gj(a,b,c,d){a=new Eh(a,b,c);d?(a.next=d.next,a.prev=d,d.next.prev=a,
d.next=a):(a.prev=a,a.next=a);return a}function xf(a){a.next.prev=a.prev;a.prev.next=a.next;a.prevZ&&(a.prevZ.nextZ=a.nextZ);a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function Eh(a,b,c){this.i=a;this.x=b;this.y=c;this.nextZ=this.prevZ=this.z=this.next=this.prev=null;this.steiner=!1}function rl(a,b,c,d){for(var f=0,g=c-d;b<c;b+=d)f+=(a[g]-a[b])*(a[b+1]+a[g+1]),g=b;return f}function jj(a){var b=a.length;2<b&&a[b-1].equals(a[0])&&a.pop()}function kj(a,b){for(var c=0;c<b.length;c++)a.push(b[c].x),a.push(b[c].y)}
function Hd(a,b){Ia.call(this);this.type="ExtrudeGeometry";this.parameters={shapes:a,options:b};this.fromBufferGeometry(new Jc(a,b));this.mergeVertices()}function Jc(a,b){function c(m){function q(ua,Pa,Wa){Pa||console.error("THREE.ExtrudeGeometry: vec does not exist");return Pa.clone().multiplyScalar(Wa).add(ua)}function u(ua,Pa,Wa){var Za=ua.x-Pa.x;var bb=ua.y-Pa.y;var rb=Wa.x-ua.x;var Db=Wa.y-ua.y,cc=Za*Za+bb*bb;if(Math.abs(Za*Db-bb*rb)>Number.EPSILON){var Ic=Math.sqrt(cc),pc=Math.sqrt(rb*rb+Db*
Db);cc=Pa.x-bb/Ic;Pa=Pa.y+Za/Ic;Db=((Wa.x-Db/pc-cc)*Db-(Wa.y+rb/pc-Pa)*rb)/(Za*Db-bb*rb);rb=cc+Za*Db-ua.x;Za=Pa+bb*Db-ua.y;bb=rb*rb+Za*Za;if(2>=bb)return new k(rb,Za);bb=Math.sqrt(bb/2)}else ua=!1,Za>Number.EPSILON?rb>Number.EPSILON&&(ua=!0):Za<-Number.EPSILON?rb<-Number.EPSILON&&(ua=!0):Math.sign(bb)===Math.sign(Db)&&(ua=!0),ua?(rb=-bb,bb=Math.sqrt(cc)):(rb=Za,Za=bb,bb=Math.sqrt(cc/2));return new k(rb/bb,Za/bb)}function w(ua,Pa){for(M=ua.length;0<=--M;){var Wa=M;var Za=M-1;0>Za&&(Za=ua.length-1);
var bb,rb=V+2*Aa;for(bb=0;bb<rb;bb++){var Db=Fa*bb,cc=Fa*(bb+1);D(Pa+Wa+Db,Pa+Za+Db,Pa+Za+cc,Pa+Wa+cc)}}}function y(ua,Pa,Wa){W.push(ua);W.push(Pa);W.push(Wa)}function C(ua,Pa,Wa){K(ua);K(Pa);K(Wa);ua=f.length/3;ua=ma.generateTopUV(d,f,ua-3,ua-2,ua-1);J(ua[0]);J(ua[1]);J(ua[2])}function D(ua,Pa,Wa,Za){K(ua);K(Pa);K(Za);K(Pa);K(Wa);K(Za);ua=f.length/3;ua=ma.generateSideWallUV(d,f,ua-6,ua-3,ua-2,ua-1);J(ua[0]);J(ua[1]);J(ua[3]);J(ua[1]);J(ua[2]);J(ua[3])}function K(ua){f.push(W[3*ua]);f.push(W[3*ua+
1]);f.push(W[3*ua+2])}function J(ua){g.push(ua.x);g.push(ua.y)}var W=[],T=void 0!==b.curveSegments?b.curveSegments:12,V=void 0!==b.steps?b.steps:1,Z=void 0!==b.depth?b.depth:100,R=void 0!==b.bevelEnabled?b.bevelEnabled:!0,Y=void 0!==b.bevelThickness?b.bevelThickness:6,ea=void 0!==b.bevelSize?b.bevelSize:Y-2,za=void 0!==b.bevelOffset?b.bevelOffset:0,Aa=void 0!==b.bevelSegments?b.bevelSegments:3,fa=b.extrudePath,ma=void 0!==b.UVGenerator?b.UVGenerator:Gl;void 0!==b.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),
Z=b.amount);var ha=!1;if(fa){var ra=fa.getSpacedPoints(V);ha=!0;R=!1;var Ma=fa.computeFrenetFrames(V,!1);var cb=new p;var pa=new p;var Ka=new p}R||(za=ea=Y=Aa=0);var Ta;T=m.extractPoints(T);m=T.shape;var jb=T.holes;if(!Vc.isClockWise(m)){m=m.reverse();var db=0;for(Ta=jb.length;db<Ta;db++){var L=jb[db];Vc.isClockWise(L)&&(jb[db]=L.reverse())}}var Q=Vc.triangulateShape(m,jb),da=m;db=0;for(Ta=jb.length;db<Ta;db++)L=jb[db],m=m.concat(L);var oa,Fa=m.length,sa,La=Q.length;T=[];var M=0;var ka=da.length;
var qa=ka-1;for(oa=M+1;M<ka;M++,qa++,oa++)qa===ka&&(qa=0),oa===ka&&(oa=0),T[M]=u(da[M],da[qa],da[oa]);fa=[];var Xa=T.concat();db=0;for(Ta=jb.length;db<Ta;db++){L=jb[db];var Ba=[];M=0;ka=L.length;qa=ka-1;for(oa=M+1;M<ka;M++,qa++,oa++)qa===ka&&(qa=0),oa===ka&&(oa=0),Ba[M]=u(L[M],L[qa],L[oa]);fa.push(Ba);Xa=Xa.concat(Ba)}for(qa=0;qa<Aa;qa++){ka=qa/Aa;var Sa=Y*Math.cos(ka*Math.PI/2);oa=ea*Math.sin(ka*Math.PI/2)+za;M=0;for(ka=da.length;M<ka;M++){var Ua=q(da[M],T[M],oa);y(Ua.x,Ua.y,-Sa)}db=0;for(Ta=jb.length;db<
Ta;db++)for(L=jb[db],Ba=fa[db],M=0,ka=L.length;M<ka;M++)Ua=q(L[M],Ba[M],oa),y(Ua.x,Ua.y,-Sa)}oa=ea+za;for(M=0;M<Fa;M++)Ua=R?q(m[M],Xa[M],oa):m[M],ha?(pa.copy(Ma.normals[0]).multiplyScalar(Ua.x),cb.copy(Ma.binormals[0]).multiplyScalar(Ua.y),Ka.copy(ra[0]).add(pa).add(cb),y(Ka.x,Ka.y,Ka.z)):y(Ua.x,Ua.y,0);for(ka=1;ka<=V;ka++)for(M=0;M<Fa;M++)Ua=R?q(m[M],Xa[M],oa):m[M],ha?(pa.copy(Ma.normals[ka]).multiplyScalar(Ua.x),cb.copy(Ma.binormals[ka]).multiplyScalar(Ua.y),Ka.copy(ra[ka]).add(pa).add(cb),y(Ka.x,
Ka.y,Ka.z)):y(Ua.x,Ua.y,Z/V*ka);for(qa=Aa-1;0<=qa;qa--){ka=qa/Aa;Sa=Y*Math.cos(ka*Math.PI/2);oa=ea*Math.sin(ka*Math.PI/2)+za;M=0;for(ka=da.length;M<ka;M++)Ua=q(da[M],T[M],oa),y(Ua.x,Ua.y,Z+Sa);db=0;for(Ta=jb.length;db<Ta;db++)for(L=jb[db],Ba=fa[db],M=0,ka=L.length;M<ka;M++)Ua=q(L[M],Ba[M],oa),ha?y(Ua.x,Ua.y+ra[V-1].y,ra[V-1].x+Sa):y(Ua.x,Ua.y,Z+Sa)}(function(){var ua=f.length/3;if(R){var Pa=0*Fa;for(M=0;M<La;M++)sa=Q[M],C(sa[2]+Pa,sa[1]+Pa,sa[0]+Pa);Pa=Fa*(V+2*Aa);for(M=0;M<La;M++)sa=Q[M],C(sa[0]+
Pa,sa[1]+Pa,sa[2]+Pa)}else{for(M=0;M<La;M++)sa=Q[M],C(sa[2],sa[1],sa[0]);for(M=0;M<La;M++)sa=Q[M],C(sa[0]+Fa*V,sa[1]+Fa*V,sa[2]+Fa*V)}d.addGroup(ua,f.length/3-ua,0)})();(function(){var ua=f.length/3,Pa=0;w(da,Pa);Pa+=da.length;db=0;for(Ta=jb.length;db<Ta;db++)L=jb[db],w(L,Pa),Pa+=L.length;d.addGroup(ua,f.length/3-ua,1)})()}la.call(this);this.type="ExtrudeBufferGeometry";this.parameters={shapes:a,options:b};a=Array.isArray(a)?a:[a];for(var d=this,f=[],g=[],h=0,l=a.length;h<l;h++)c(a[h]);this.addAttribute("position",
new ia(f,3));this.addAttribute("uv",new ia(g,2));this.computeVertexNormals()}function lj(a,b,c){c.shapes=[];if(Array.isArray(a))for(var d=0,f=a.length;d<f;d++)c.shapes.push(a[d].uuid);else c.shapes.push(a.uuid);void 0!==b.extrudePath&&(c.options.extrudePath=b.extrudePath.toJSON());return c}function Bf(a,b){Ia.call(this);this.type="TextGeometry";this.parameters={text:a,parameters:b};this.fromBufferGeometry(new ye(a,b));this.mergeVertices()}function ye(a,b){b=b||{};var c=b.font;if(!c||!c.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),
new Ia;a=c.generateShapes(a,b.size);b.depth=void 0!==b.height?b.height:50;void 0===b.bevelThickness&&(b.bevelThickness=10);void 0===b.bevelSize&&(b.bevelSize=8);void 0===b.bevelEnabled&&(b.bevelEnabled=!1);Jc.call(this,a,b);this.type="TextBufferGeometry"}function Cf(a,b,c,d,f,g,h){Ia.call(this);this.type="SphereGeometry";this.parameters={radius:a,widthSegments:b,heightSegments:c,phiStart:d,phiLength:f,thetaStart:g,thetaLength:h};this.fromBufferGeometry(new pd(a,b,c,d,f,g,h));this.mergeVertices()}
function pd(a,b,c,d,f,g,h){la.call(this);this.type="SphereBufferGeometry";this.parameters={radius:a,widthSegments:b,heightSegments:c,phiStart:d,phiLength:f,thetaStart:g,thetaLength:h};a=a||1;b=Math.max(3,Math.floor(b)||8);c=Math.max(2,Math.floor(c)||6);d=void 0!==d?d:0;f=void 0!==f?f:2*Math.PI;g=void 0!==g?g:0;h=void 0!==h?h:Math.PI;var l=Math.min(g+h,Math.PI),m,q,u=0,w=[],y=new p,C=new p,D=[],K=[],J=[],W=[];for(q=0;q<=c;q++){var T=[],V=q/c,Z=0;0==q&&0==g?Z=.5/b:q==c&&l==Math.PI&&(Z=-.5/b);for(m=
0;m<=b;m++){var R=m/b;y.x=-a*Math.cos(d+R*f)*Math.sin(g+V*h);y.y=a*Math.cos(g+V*h);y.z=a*Math.sin(d+R*f)*Math.sin(g+V*h);K.push(y.x,y.y,y.z);C.copy(y).normalize();J.push(C.x,C.y,C.z);W.push(R+Z,1-V);T.push(u++)}w.push(T)}for(q=0;q<c;q++)for(m=0;m<b;m++)a=w[q][m+1],d=w[q][m],f=w[q+1][m],h=w[q+1][m+1],(0!==q||0<g)&&D.push(a,d,h),(q!==c-1||l<Math.PI)&&D.push(d,f,h);this.setIndex(D);this.addAttribute("position",new ia(K,3));this.addAttribute("normal",new ia(J,3));this.addAttribute("uv",new ia(W,2))}function Df(a,
b,c,d,f,g){Ia.call(this);this.type="RingGeometry";this.parameters={innerRadius:a,outerRadius:b,thetaSegments:c,phiSegments:d,thetaStart:f,thetaLength:g};this.fromBufferGeometry(new ze(a,b,c,d,f,g));this.mergeVertices()}function ze(a,b,c,d,f,g){la.call(this);this.type="RingBufferGeometry";this.parameters={innerRadius:a,outerRadius:b,thetaSegments:c,phiSegments:d,thetaStart:f,thetaLength:g};a=a||.5;b=b||1;f=void 0!==f?f:0;g=void 0!==g?g:2*Math.PI;c=void 0!==c?Math.max(3,c):8;d=void 0!==d?Math.max(1,
d):1;var h=[],l=[],m=[],q=[],u=a,w=(b-a)/d,y=new p,C=new k,D,K;for(D=0;D<=d;D++){for(K=0;K<=c;K++)a=f+K/c*g,y.x=u*Math.cos(a),y.y=u*Math.sin(a),l.push(y.x,y.y,y.z),m.push(0,0,1),C.x=(y.x/b+1)/2,C.y=(y.y/b+1)/2,q.push(C.x,C.y);u+=w}for(D=0;D<d;D++)for(b=D*(c+1),K=0;K<c;K++)a=K+b,f=a+c+1,g=a+c+2,u=a+1,h.push(a,f,u),h.push(f,g,u);this.setIndex(h);this.addAttribute("position",new ia(l,3));this.addAttribute("normal",new ia(m,3));this.addAttribute("uv",new ia(q,2))}function Ef(a,b,c,d){Ia.call(this);this.type=
"LatheGeometry";this.parameters={points:a,segments:b,phiStart:c,phiLength:d};this.fromBufferGeometry(new Ae(a,b,c,d));this.mergeVertices()}function Ae(a,b,c,d){la.call(this);this.type="LatheBufferGeometry";this.parameters={points:a,segments:b,phiStart:c,phiLength:d};b=Math.floor(b)||12;c=c||0;d=d||2*Math.PI;d=Qa.clamp(d,0,2*Math.PI);var f=[],g=[],h=[],l=1/b,m=new p,q=new k,u;for(u=0;u<=b;u++){var w=c+u*l*d;var y=Math.sin(w),C=Math.cos(w);for(w=0;w<=a.length-1;w++)m.x=a[w].x*y,m.y=a[w].y,m.z=a[w].x*
C,g.push(m.x,m.y,m.z),q.x=u/b,q.y=w/(a.length-1),h.push(q.x,q.y)}for(u=0;u<b;u++)for(w=0;w<a.length-1;w++)c=w+u*a.length,l=c+a.length,m=c+a.length+1,q=c+1,f.push(c,l,q),f.push(l,m,q);this.setIndex(f);this.addAttribute("position",new ia(g,3));this.addAttribute("uv",new ia(h,2));this.computeVertexNormals();if(d===2*Math.PI)for(d=this.attributes.normal.array,f=new p,g=new p,h=new p,c=b*a.length*3,w=u=0;u<a.length;u++,w+=3)f.x=d[w+0],f.y=d[w+1],f.z=d[w+2],g.x=d[c+w+0],g.y=d[c+w+1],g.z=d[c+w+2],h.addVectors(f,
g).normalize(),d[w+0]=d[c+w+0]=h.x,d[w+1]=d[c+w+1]=h.y,d[w+2]=d[c+w+2]=h.z}function Id(a,b){Ia.call(this);this.type="ShapeGeometry";"object"===typeof b&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),b=b.curveSegments);this.parameters={shapes:a,curveSegments:b};this.fromBufferGeometry(new Jd(a,b));this.mergeVertices()}function Jd(a,b){function c(u){var w,y=f.length/3;u=u.extractPoints(b);var C=u.shape,D=u.holes;!1===Vc.isClockWise(C)&&(C=C.reverse());u=0;for(w=D.length;u<
w;u++){var K=D[u];!0===Vc.isClockWise(K)&&(D[u]=K.reverse())}var J=Vc.triangulateShape(C,D);u=0;for(w=D.length;u<w;u++)K=D[u],C=C.concat(K);u=0;for(w=C.length;u<w;u++)K=C[u],f.push(K.x,K.y,0),g.push(0,0,1),h.push(K.x,K.y);u=0;for(w=J.length;u<w;u++)C=J[u],d.push(C[0]+y,C[1]+y,C[2]+y),m+=3}la.call(this);this.type="ShapeBufferGeometry";this.parameters={shapes:a,curveSegments:b};b=b||12;var d=[],f=[],g=[],h=[],l=0,m=0;if(!1===Array.isArray(a))c(a);else for(var q=0;q<a.length;q++)c(a[q]),this.addGroup(l,
m,q),l+=m,m=0;this.setIndex(d);this.addAttribute("position",new ia(f,3));this.addAttribute("normal",new ia(g,3));this.addAttribute("uv",new ia(h,2))}function mj(a,b){b.shapes=[];if(Array.isArray(a))for(var c=0,d=a.length;c<d;c++)b.shapes.push(a[c].uuid);else b.shapes.push(a.uuid);return b}function Be(a,b){la.call(this);this.type="EdgesGeometry";this.parameters={thresholdAngle:b};var c=[];b=Math.cos(Qa.DEG2RAD*(void 0!==b?b:1));var d=[0,0],f={},g=["a","b","c"];if(a.isBufferGeometry){var h=new Ia;h.fromBufferGeometry(a)}else h=
a.clone();h.mergeVertices();h.computeFaceNormals();a=h.vertices;h=h.faces;for(var l=0,m=h.length;l<m;l++)for(var q=h[l],u=0;3>u;u++){var w=q[g[u]];var y=q[g[(u+1)%3]];d[0]=Math.min(w,y);d[1]=Math.max(w,y);w=d[0]+","+d[1];void 0===f[w]?f[w]={index1:d[0],index2:d[1],face1:l,face2:void 0}:f[w].face2=l}for(w in f)if(d=f[w],void 0===d.face2||h[d.face1].normal.dot(h[d.face2].normal)<=b)g=a[d.index1],c.push(g.x,g.y,g.z),g=a[d.index2],c.push(g.x,g.y,g.z);this.addAttribute("position",new ia(c,3))}function Kd(a,
b,c,d,f,g,h,l){Ia.call(this);this.type="CylinderGeometry";this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:f,openEnded:g,thetaStart:h,thetaLength:l};this.fromBufferGeometry(new Wc(a,b,c,d,f,g,h,l));this.mergeVertices()}function Wc(a,b,c,d,f,g,h,l){function m(T){var V,Z=new k,R=new p,Y=0,ea=!0===T?a:b,za=!0===T?1:-1;var Aa=D;for(V=1;V<=d;V++)w.push(0,J*za,0),y.push(0,za,0),C.push(.5,.5),D++;var fa=D;for(V=0;V<=d;V++){var ma=V/d*l+h,ha=Math.cos(ma);ma=Math.sin(ma);
R.x=ea*ma;R.y=J*za;R.z=ea*ha;w.push(R.x,R.y,R.z);y.push(0,za,0);Z.x=.5*ha+.5;Z.y=.5*ma*za+.5;C.push(Z.x,Z.y);D++}for(V=0;V<d;V++)Z=Aa+V,R=fa+V,!0===T?u.push(R,R+1,Z):u.push(R+1,R,Z),Y+=3;q.addGroup(W,Y,!0===T?1:2);W+=Y}la.call(this);this.type="CylinderBufferGeometry";this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:f,openEnded:g,thetaStart:h,thetaLength:l};var q=this;a=void 0!==a?a:1;b=void 0!==b?b:1;c=c||1;d=Math.floor(d)||8;f=Math.floor(f)||1;g=void 0!==g?g:!1;
h=void 0!==h?h:0;l=void 0!==l?l:2*Math.PI;var u=[],w=[],y=[],C=[],D=0,K=[],J=c/2,W=0;(function(){var T,V,Z=new p,R=new p,Y=0,ea=(b-a)/c;for(V=0;V<=f;V++){var za=[],Aa=V/f,fa=Aa*(b-a)+a;for(T=0;T<=d;T++){var ma=T/d,ha=ma*l+h,ra=Math.sin(ha);ha=Math.cos(ha);R.x=fa*ra;R.y=-Aa*c+J;R.z=fa*ha;w.push(R.x,R.y,R.z);Z.set(ra,ea,ha).normalize();y.push(Z.x,Z.y,Z.z);C.push(ma,1-Aa);za.push(D++)}K.push(za)}for(T=0;T<d;T++)for(V=0;V<f;V++)Z=K[V+1][T],R=K[V+1][T+1],ea=K[V][T+1],u.push(K[V][T],Z,ea),u.push(Z,R,ea),
Y+=6;q.addGroup(W,Y,0);W+=Y})();!1===g&&(0<a&&m(!0),0<b&&m(!1));this.setIndex(u);this.addAttribute("position",new ia(w,3));this.addAttribute("normal",new ia(y,3));this.addAttribute("uv",new ia(C,2))}function Ff(a,b,c,d,f,g,h){Kd.call(this,0,a,b,c,d,f,g,h);this.type="ConeGeometry";this.parameters={radius:a,height:b,radialSegments:c,heightSegments:d,openEnded:f,thetaStart:g,thetaLength:h}}function Gf(a,b,c,d,f,g,h){Wc.call(this,0,a,b,c,d,f,g,h);this.type="ConeBufferGeometry";this.parameters={radius:a,
height:b,radialSegments:c,heightSegments:d,openEnded:f,thetaStart:g,thetaLength:h}}function Hf(a,b,c,d){Ia.call(this);this.type="CircleGeometry";this.parameters={radius:a,segments:b,thetaStart:c,thetaLength:d};this.fromBufferGeometry(new Ce(a,b,c,d));this.mergeVertices()}function Ce(a,b,c,d){la.call(this);this.type="CircleBufferGeometry";this.parameters={radius:a,segments:b,thetaStart:c,thetaLength:d};a=a||1;b=void 0!==b?Math.max(3,b):8;c=void 0!==c?c:0;d=void 0!==d?d:2*Math.PI;var f=[],g=[],h=[],
l=[],m,q=new p,u=new k;g.push(0,0,0);h.push(0,0,1);l.push(.5,.5);var w=0;for(m=3;w<=b;w++,m+=3){var y=c+w/b*d;q.x=a*Math.cos(y);q.y=a*Math.sin(y);g.push(q.x,q.y,q.z);h.push(0,0,1);u.x=(g[m]/a+1)/2;u.y=(g[m+1]/a+1)/2;l.push(u.x,u.y)}for(m=1;m<=b;m++)f.push(m,m+1,0);this.setIndex(f);this.addAttribute("position",new ia(g,3));this.addAttribute("normal",new ia(h,3));this.addAttribute("uv",new ia(l,2))}function Ld(a){xa.call(this);this.type="ShadowMaterial";this.color=new ca(0);this.transparent=!0;this.setValues(a)}
function De(a){yb.call(this,a);this.type="RawShaderMaterial"}function Kc(a){xa.call(this);this.defines={STANDARD:""};this.type="MeshStandardMaterial";this.color=new ca(16777215);this.metalness=this.roughness=.5;this.lightMap=this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.emissive=new ca(0);this.emissiveIntensity=1;this.bumpMap=this.emissiveMap=null;this.bumpScale=1;this.normalMap=null;this.normalMapType=0;this.normalScale=new k(1,1);this.displacementMap=null;this.displacementScale=
1;this.displacementBias=0;this.envMap=this.alphaMap=this.metalnessMap=this.roughnessMap=null;this.envMapIntensity=1;this.refractionRatio=.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(a)}function Md(a){Kc.call(this);this.defines={STANDARD:"",PHYSICAL:""};this.type="MeshPhysicalMaterial";this.reflectivity=.5;this.clearcoatRoughness=this.clearcoat=0;this.sheen=null;this.clearcoatNormalScale=
new k(1,1);this.clearcoatNormalMap=null;this.transparency=0;this.setValues(a)}function rc(a){xa.call(this);this.type="MeshPhongMaterial";this.color=new ca(16777215);this.specular=new ca(1118481);this.shininess=30;this.lightMap=this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.emissive=new ca(0);this.emissiveIntensity=1;this.bumpMap=this.emissiveMap=null;this.bumpScale=1;this.normalMap=null;this.normalMapType=0;this.normalScale=new k(1,1);this.displacementMap=null;this.displacementScale=
1;this.displacementBias=0;this.envMap=this.alphaMap=this.specularMap=null;this.combine=0;this.reflectivity=1;this.refractionRatio=.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(a)}function Nd(a){rc.call(this);this.defines={TOON:""};this.type="MeshToonMaterial";this.gradientMap=null;this.setValues(a)}function Od(a){xa.call(this);this.type="MeshNormalMaterial";this.bumpMap=null;
this.bumpScale=1;this.normalMap=null;this.normalMapType=0;this.normalScale=new k(1,1);this.displacementMap=null;this.displacementScale=1;this.displacementBias=0;this.wireframe=!1;this.wireframeLinewidth=1;this.morphNormals=this.morphTargets=this.skinning=this.lights=this.fog=!1;this.setValues(a)}function Pd(a){xa.call(this);this.type="MeshLambertMaterial";this.color=new ca(16777215);this.lightMap=this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.emissive=new ca(0);
this.emissiveIntensity=1;this.envMap=this.alphaMap=this.specularMap=this.emissiveMap=null;this.combine=0;this.reflectivity=1;this.refractionRatio=.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(a)}function Qd(a){xa.call(this);this.defines={MATCAP:""};this.type="MeshMatcapMaterial";this.color=new ca(16777215);this.bumpMap=this.map=this.matcap=null;this.bumpScale=1;this.normalMap=
null;this.normalMapType=0;this.normalScale=new k(1,1);this.displacementMap=null;this.displacementScale=1;this.displacementBias=0;this.alphaMap=null;this.lights=this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(a)}function Rd(a){lb.call(this);this.type="LineDashedMaterial";this.scale=1;this.dashSize=3;this.gapSize=1;this.setValues(a)}function dc(a,b,c,d){this.parameterPositions=a;this._cachedIndex=0;this.resultBuffer=void 0!==d?d:new b.constructor(c);this.sampleValues=b;this.valueSize=
c}function ng(a,b,c,d){dc.call(this,a,b,c,d);this._offsetNext=this._weightNext=this._offsetPrev=this._weightPrev=-0}function If(a,b,c,d){dc.call(this,a,b,c,d)}function og(a,b,c,d){dc.call(this,a,b,c,d)}function Kb(a,b,c,d){if(void 0===a)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===b||0===b.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+a);this.name=a;this.times=Gb.convertArray(b,this.TimeBufferType);this.values=Gb.convertArray(c,this.ValueBufferType);
this.setInterpolation(d||this.DefaultInterpolation)}function pg(a,b,c){Kb.call(this,a,b,c)}function qg(a,b,c,d){Kb.call(this,a,b,c,d)}function Ee(a,b,c,d){Kb.call(this,a,b,c,d)}function rg(a,b,c,d){dc.call(this,a,b,c,d)}function Jf(a,b,c,d){Kb.call(this,a,b,c,d)}function sg(a,b,c,d){Kb.call(this,a,b,c,d)}function Fe(a,b,c,d){Kb.call(this,a,b,c,d)}function kc(a,b,c){this.name=a;this.tracks=c;this.duration=void 0!==b?b:-1;this.uuid=Qa.generateUUID();0>this.duration&&this.resetDuration()}function Hl(a){switch(a.toLowerCase()){case "scalar":case "double":case "float":case "number":case "integer":return Ee;
case "vector":case "vector2":case "vector3":case "vector4":return Fe;case "color":return qg;case "quaternion":return Jf;case "bool":case "boolean":return pg;case "string":return sg}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+a);}function Il(a){if(void 0===a.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");var b=Hl(a.type);if(void 0===a.times){var c=[],d=[];Gb.flattenJSON(a.keys,c,d,"value");a.times=c;a.values=d}return void 0!==b.parse?b.parse(a):new b(a.name,
a.times,a.values,a.interpolation)}function Fh(a,b,c){var d=this,f=!1,g=0,h=0,l=void 0;this.onStart=void 0;this.onLoad=a;this.onProgress=b;this.onError=c;this.itemStart=function(m){h++;if(!1===f&&void 0!==d.onStart)d.onStart(m,g,h);f=!0};this.itemEnd=function(m){g++;if(void 0!==d.onProgress)d.onProgress(m,g,h);if(g===h&&(f=!1,void 0!==d.onLoad))d.onLoad()};this.itemError=function(m){if(void 0!==d.onError)d.onError(m)};this.resolveURL=function(m){return l?l(m):m};this.setURLModifier=function(m){l=m;
return this}}function ib(a){this.manager=void 0!==a?a:nj;this.crossOrigin="anonymous";this.resourcePath=this.path=""}function lc(a){ib.call(this,a)}function Gh(a){ib.call(this,a)}function Hh(a){ib.call(this,a);this._parser=null}function tg(a){ib.call(this,a);this._parser=null}function Ge(a){ib.call(this,a)}function ug(a){ib.call(this,a)}function vg(a){ib.call(this,a)}function Ga(){this.type="Curve";this.arcLengthDivisions=200}function ec(a,b,c,d,f,g,h,l){Ga.call(this);this.type="EllipseCurve";this.aX=
a||0;this.aY=b||0;this.xRadius=c||1;this.yRadius=d||1;this.aStartAngle=f||0;this.aEndAngle=g||2*Math.PI;this.aClockwise=h||!1;this.aRotation=l||0}function He(a,b,c,d,f,g){ec.call(this,a,b,c,c,d,f,g);this.type="ArcCurve"}function Ih(){function a(g,h,l,m){b=g;c=l;d=-3*g+3*h-2*l-m;f=2*g-2*h+l+m}var b=0,c=0,d=0,f=0;return{initCatmullRom:function(g,h,l,m,q){a(h,l,q*(l-g),q*(m-h))},initNonuniformCatmullRom:function(g,h,l,m,q,u,w){a(h,l,((h-g)/q-(l-g)/(q+u)+(l-h)/u)*u,((l-h)/u-(m-h)/(u+w)+(m-l)/w)*u)},calc:function(g){var h=
g*g;return b+c*g+d*h+f*h*g}}}function Ob(a,b,c,d){Ga.call(this);this.type="CatmullRomCurve3";this.points=a||[];this.closed=b||!1;this.curveType=c||"centripetal";this.tension=d||.5}function oj(a,b,c,d,f){b=.5*(d-b);f=.5*(f-c);var g=a*a;return(2*c-2*d+b+f)*a*g+(-3*c+3*d-2*b-f)*g+b*a+c}function Jl(a,b){a=1-a;return a*a*b}function Kl(a,b){return 2*(1-a)*a*b}function Ll(a,b){return a*a*b}function Kf(a,b,c,d){return Jl(a,b)+Kl(a,c)+Ll(a,d)}function Ml(a,b){a=1-a;return a*a*a*b}function Nl(a,b){var c=1-
a;return 3*c*c*a*b}function Ol(a,b){return 3*(1-a)*a*a*b}function Pl(a,b){return a*a*a*b}function Lf(a,b,c,d,f){return Ml(a,b)+Nl(a,c)+Ol(a,d)+Pl(a,f)}function sc(a,b,c,d){Ga.call(this);this.type="CubicBezierCurve";this.v0=a||new k;this.v1=b||new k;this.v2=c||new k;this.v3=d||new k}function Lc(a,b,c,d){Ga.call(this);this.type="CubicBezierCurve3";this.v0=a||new p;this.v1=b||new p;this.v2=c||new p;this.v3=d||new p}function Yb(a,b){Ga.call(this);this.type="LineCurve";this.v1=a||new k;this.v2=b||new k}
function tc(a,b){Ga.call(this);this.type="LineCurve3";this.v1=a||new p;this.v2=b||new p}function uc(a,b,c){Ga.call(this);this.type="QuadraticBezierCurve";this.v0=a||new k;this.v1=b||new k;this.v2=c||new k}function Mc(a,b,c){Ga.call(this);this.type="QuadraticBezierCurve3";this.v0=a||new p;this.v1=b||new p;this.v2=c||new p}function vc(a){Ga.call(this);this.type="SplineCurve";this.points=a||[]}function Xc(){Ga.call(this);this.type="CurvePath";this.curves=[];this.autoClose=!1}function wc(a){Xc.call(this);
this.type="Path";this.currentPoint=new k;a&&this.setFromPoints(a)}function qd(a){wc.call(this,a);this.uuid=Qa.generateUUID();this.type="Shape";this.holes=[]}function qb(a,b){I.call(this);this.type="Light";this.color=new ca(a);this.intensity=void 0!==b?b:1;this.receiveShadow=void 0}function wg(a,b,c){qb.call(this,a,c);this.type="HemisphereLight";this.castShadow=void 0;this.position.copy(I.DefaultUp);this.updateMatrix();this.groundColor=new ca(b)}function Nc(a){this.camera=a;this.bias=0;this.radius=
1;this.mapSize=new k(512,512);this.mapPass=this.map=null;this.matrix=new A;this._frustum=new ic;this._frameExtents=new k(1,1);this._viewportCount=1;this._viewports=[new E(0,0,1,1)]}function xg(){Nc.call(this,new kb(50,1,.5,500))}function yg(a,b,c,d,f,g){qb.call(this,a,b);this.type="SpotLight";this.position.copy(I.DefaultUp);this.updateMatrix();this.target=new I;Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(h){this.intensity=h/Math.PI}});this.distance=
void 0!==c?c:0;this.angle=void 0!==d?d:Math.PI/3;this.penumbra=void 0!==f?f:0;this.decay=void 0!==g?g:1;this.shadow=new xg}function Jh(){Nc.call(this,new kb(90,1,.5,500));this._frameExtents=new k(4,2);this._viewportCount=6;this._viewports=[new E(2,1,1,1),new E(0,1,1,1),new E(3,1,1,1),new E(1,1,1,1),new E(3,0,1,1),new E(1,0,1,1)];this._cubeDirections=[new p(1,0,0),new p(-1,0,0),new p(0,0,1),new p(0,0,-1),new p(0,1,0),new p(0,-1,0)];this._cubeUps=[new p(0,1,0),new p(0,1,0),new p(0,1,0),new p(0,1,0),
new p(0,0,1),new p(0,0,-1)]}function zg(a,b,c,d){qb.call(this,a,b);this.type="PointLight";Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(f){this.intensity=f/(4*Math.PI)}});this.distance=void 0!==c?c:0;this.decay=void 0!==d?d:1;this.shadow=new Jh}function Mf(a,b,c,d,f,g){Fb.call(this);this.type="OrthographicCamera";this.zoom=1;this.view=null;this.left=void 0!==a?a:-1;this.right=void 0!==b?b:1;this.top=void 0!==c?c:1;this.bottom=void 0!==d?d:-1;this.near=
void 0!==f?f:.1;this.far=void 0!==g?g:2E3;this.updateProjectionMatrix()}function Ag(){Nc.call(this,new Mf(-5,5,5,-5,.5,500))}function Bg(a,b){qb.call(this,a,b);this.type="DirectionalLight";this.position.copy(I.DefaultUp);this.updateMatrix();this.target=new I;this.shadow=new Ag}function Cg(a,b){qb.call(this,a,b);this.type="AmbientLight";this.castShadow=void 0}function Dg(a,b,c,d){qb.call(this,a,b);this.type="RectAreaLight";this.width=void 0!==c?c:10;this.height=void 0!==d?d:10}function Eg(a){ib.call(this,
a);this.textures={}}function Fg(){la.call(this);this.type="InstancedBufferGeometry";this.maxInstancedCount=void 0}function Gg(a,b,c,d){"number"===typeof c&&(d=c,c=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument."));Ea.call(this,a,b,c);this.meshPerAttribute=d||1}function Hg(a){ib.call(this,a)}function Ig(a){ib.call(this,a)}function Kh(a){"undefined"===typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported.");
"undefined"===typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported.");ib.call(this,a);this.options=void 0}function Lh(){this.type="ShapePath";this.color=new ca;this.subPaths=[];this.currentPath=null}function Mh(a){this.type="Font";this.data=a}function Ql(a,b,c){a=Array.from?Array.from(a):String(a).split("");b/=c.resolution;for(var d=(c.boundingBox.yMax-c.boundingBox.yMin+c.underlineThickness)*b,f=[],g=0,h=0,l=0;l<a.length;l++){var m=a[l];"\n"===m?(g=0,h-=d):(m=Rl(m,b,g,h,c),
g+=m.offsetX,f.push(m.path))}return f}function Rl(a,b,c,d,f){var g=f.glyphs[a]||f.glyphs["?"];if(g){a=new Lh;if(g.o){f=g._cachedOutline||(g._cachedOutline=g.o.split(" "));for(var h=0,l=f.length;h<l;)switch(f[h++]){case "m":var m=f[h++]*b+c;var q=f[h++]*b+d;a.moveTo(m,q);break;case "l":m=f[h++]*b+c;q=f[h++]*b+d;a.lineTo(m,q);break;case "q":m=f[h++]*b+c;q=f[h++]*b+d;var u=f[h++]*b+c;var w=f[h++]*b+d;a.quadraticCurveTo(u,w,m,q);break;case "b":m=f[h++]*b+c;q=f[h++]*b+d;u=f[h++]*b+c;w=f[h++]*b+d;var y=
f[h++]*b+c;var C=f[h++]*b+d;a.bezierCurveTo(u,w,y,C,m,q)}}return{offsetX:g.ha*b,path:a}}console.error('THREE.Font: character "'+a+'" does not exists in font family '+f.familyName+".")}function Nh(a){ib.call(this,a)}function Jg(a){ib.call(this,a)}function Kg(){this.coefficients=[];for(var a=0;9>a;a++)this.coefficients.push(new p)}function xc(a,b){qb.call(this,void 0,b);this.sh=void 0!==a?a:new Kg}function Oh(a,b,c){xc.call(this,void 0,c);a=(new ca).set(a);c=(new ca).set(b);b=new p(a.r,a.g,a.b);a=new p(c.r,
c.g,c.b);c=Math.sqrt(Math.PI);var d=c*Math.sqrt(.75);this.sh.coefficients[0].copy(b).add(a).multiplyScalar(c);this.sh.coefficients[1].copy(b).sub(a).multiplyScalar(d)}function Ph(a,b){xc.call(this,void 0,b);a=(new ca).set(a);this.sh.coefficients[0].set(a.r,a.g,a.b).multiplyScalar(2*Math.sqrt(Math.PI))}function pj(){this.type="StereoCamera";this.aspect=1;this.eyeSep=.064;this.cameraL=new kb;this.cameraL.layers.enable(1);this.cameraL.matrixAutoUpdate=!1;this.cameraR=new kb;this.cameraR.layers.enable(2);
this.cameraR.matrixAutoUpdate=!1;this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}function Qh(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1}function Rh(){I.call(this);this.type="AudioListener";this.context=Sh.getContext();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null;this.timeDelta=0;this._clock=new Qh}function Ie(a){I.call(this);this.type="Audio";this.listener=
a;this.context=a.context;this.gain=this.context.createGain();this.gain.connect(a.getInput());this.autoplay=!1;this.buffer=null;this.detune=0;this.loop=!1;this.offset=this.startTime=0;this.duration=void 0;this.playbackRate=1;this.isPlaying=!1;this.hasPlaybackControl=!0;this.sourceType="empty";this.filters=[]}function Th(a){Ie.call(this,a);this.panner=this.context.createPanner();this.panner.panningModel="HRTF";this.panner.connect(this.gain)}function Uh(a,b){this.analyser=a.context.createAnalyser();
this.analyser.fftSize=void 0!==b?b:2048;this.data=new Uint8Array(this.analyser.frequencyBinCount);a.getOutput().connect(this.analyser)}function Vh(a,b,c){this.binding=a;this.valueSize=c;a=Float64Array;switch(b){case "quaternion":b=this._slerp;break;case "string":case "bool":a=Array;b=this._select;break;default:b=this._lerp}this.buffer=new a(4*c);this._mixBufferRegion=b;this.referenceCount=this.useCount=this.cumulativeWeight=0}function qj(a,b,c){c=c||Pb.parseTrackName(b);this._targetGroup=a;this._bindings=
a.subscribe_(b,c)}function Pb(a,b,c){this.path=b;this.parsedPath=c||Pb.parseTrackName(b);this.node=Pb.findNode(a,this.parsedPath.nodeName)||a;this.rootNode=a}function rj(){this.uuid=Qa.generateUUID();this._objects=Array.prototype.slice.call(arguments);this.nCachedObjects_=0;var a={};this._indicesByUUID=a;for(var b=0,c=arguments.length;b!==c;++b)a[arguments[b].uuid]=b;this._paths=[];this._parsedPaths=[];this._bindings=[];this._bindingsIndicesByPath={};var d=this;this.stats={objects:{get total(){return d._objects.length},
get inUse(){return this.total-d.nCachedObjects_}},get bindingsPerObject(){return d._bindings.length}}}function sj(a,b,c){this._mixer=a;this._clip=b;this._localRoot=c||null;a=b.tracks;b=a.length;c=Array(b);for(var d={endingStart:2400,endingEnd:2400},f=0;f!==b;++f){var g=a[f].createInterpolant(null);c[f]=g;g.settings=d}this._interpolantSettings=d;this._interpolants=c;this._propertyBindings=Array(b);this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null;this.loop=
2201;this._loopCount=-1;this._startTime=null;this.time=0;this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1;this.repetitions=Infinity;this.paused=!1;this.enabled=!0;this.clampWhenFinished=!1;this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0}function Wh(a){this._root=a;this._initMemoryManager();this.time=this._accuIndex=0;this.timeScale=1}function Lg(a,b){"string"===typeof a&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),a=b);this.value=a}function Xh(a,b,c){Dd.call(this,
a,b);this.meshPerAttribute=c||1}function tj(a,b,c,d){this.ray=new ba(a,b);this.near=c||0;this.far=d||Infinity;this.camera=null;this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}};Object.defineProperties(this.params,{PointCloud:{get:function(){console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points.");return this.Points}}})}function uj(a,b){return a.distance-b.distance}function Yh(a,b,c,d){if(!1!==a.visible&&(a.raycast(b,c),!0===d)){a=a.children;d=0;for(var f=
a.length;d<f;d++)Yh(a[d],b,c,!0)}}function vj(a,b,c){this.radius=void 0!==a?a:1;this.phi=void 0!==b?b:0;this.theta=void 0!==c?c:0;return this}function wj(a,b,c){this.radius=void 0!==a?a:1;this.theta=void 0!==b?b:0;this.y=void 0!==c?c:0;return this}function Zh(a,b){this.min=void 0!==a?a:new k(Infinity,Infinity);this.max=void 0!==b?b:new k(-Infinity,-Infinity)}function $h(a,b){this.start=void 0!==a?a:new p;this.end=void 0!==b?b:new p}function Nf(a){I.call(this);this.material=a;this.render=function(){}}
function Of(a,b,c,d){this.object=a;this.size=void 0!==b?b:1;a=void 0!==c?c:16711680;d=void 0!==d?d:1;b=0;(c=this.object.geometry)&&c.isGeometry?b=3*c.faces.length:c&&c.isBufferGeometry&&(b=c.attributes.normal.count);c=new la;b=new ia(6*b,3);c.addAttribute("position",b);pb.call(this,c,new lb({color:a,linewidth:d}));this.matrixAutoUpdate=!1;this.update()}function Je(a,b){I.call(this);this.light=a;this.light.updateMatrixWorld();this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;this.color=b;a=new la;
b=[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];for(var c=0,d=1;32>c;c++,d++){var f=c/32*Math.PI*2,g=d/32*Math.PI*2;b.push(Math.cos(f),Math.sin(f),1,Math.cos(g),Math.sin(g),1)}a.addAttribute("position",new ia(b,3));b=new lb({fog:!1});this.cone=new pb(a,b);this.add(this.cone);this.update()}function xj(a){var b=[];a&&a.isBone&&b.push(a);for(var c=0;c<a.children.length;c++)b.push.apply(b,xj(a.children[c]));return b}function Ke(a){for(var b=xj(a),c=new la,d=[],f=[],g=new ca(0,0,1),h=
new ca(0,1,0),l=0;l<b.length;l++){var m=b[l];m.parent&&m.parent.isBone&&(d.push(0,0,0),d.push(0,0,0),f.push(g.r,g.g,g.b),f.push(h.r,h.g,h.b))}c.addAttribute("position",new ia(d,3));c.addAttribute("color",new ia(f,3));d=new lb({vertexColors:2,depthTest:!1,depthWrite:!1,transparent:!0});pb.call(this,c,d);this.root=a;this.bones=b;this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1}function Le(a,b,c){this.light=a;this.light.updateMatrixWorld();this.color=c;a=new pd(b,4,2);b=new gb({wireframe:!0,fog:!1});
Oa.call(this,a,b);this.matrix=this.light.matrixWorld;this.matrixAutoUpdate=!1;this.update()}function Me(a,b){this.type="RectAreaLightHelper";this.light=a;this.color=b;a=new la;a.addAttribute("position",new ia([1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3));a.computeBoundingSphere();b=new lb({fog:!1});Ib.call(this,a,b);a=new la;a.addAttribute("position",new ia([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3));a.computeBoundingSphere();this.add(new Oa(a,new gb({side:1,fog:!1})));this.update()}function Ne(a,b,
c){I.call(this);this.light=a;this.light.updateMatrixWorld();this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;this.color=c;a=new Ed(b);a.rotateY(.5*Math.PI);this.material=new gb({wireframe:!0,fog:!1});void 0===this.color&&(this.material.vertexColors=2);b=a.getAttribute("position");a.addAttribute("color",new Ea(new Float32Array(3*b.count),3));this.add(new Oa(a,this.material));this.update()}function Oe(a,b){this.lightProbe=a;this.size=b;a=new yb({defines:{GAMMA_OUTPUT:""},uniforms:{sh:{value:this.lightProbe.sh.coefficients},
intensity:{value:this.lightProbe.intensity}},vertexShader:"varying vec3 vNormal;\nvoid main() {\n\tvNormal \x3d normalize( normalMatrix * normal );\n\tgl_Position \x3d projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"#define RECIPROCAL_PI 0.318309886\nvec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {\n\t// matrix is assumed to be orthogonal\n\treturn normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );\n}\nvec3 linearToOutput( in vec3 a ) {\n\t#ifdef GAMMA_OUTPUT\n\t\treturn pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );\n\t#else\n\t\treturn a;\n\t#endif\n}\n// source: https://graphics.stanford.edu/papers/envmap/envmap.pdf\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\t// normal is assumed to have unit length\n\tfloat x \x3d normal.x, y \x3d normal.y, z \x3d normal.z;\n\t// band 0\n\tvec3 result \x3d shCoefficients[ 0 ] * 0.886227;\n\t// band 1\n\tresult +\x3d shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult +\x3d shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult +\x3d shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\t// band 2\n\tresult +\x3d shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult +\x3d shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult +\x3d shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult +\x3d shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult +\x3d shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nuniform vec3 sh[ 9 ]; // sh coefficients\nuniform float intensity; // light probe intensity\nvarying vec3 vNormal;\nvoid main() {\n\tvec3 normal \x3d normalize( vNormal );\n\tvec3 worldNormal \x3d inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance \x3d shGetIrradianceAt( worldNormal, sh );\n\tvec3 outgoingLight \x3d RECIPROCAL_PI * irradiance * intensity;\n\toutgoingLight \x3d linearToOutput( outgoingLight );\n\tgl_FragColor \x3d vec4( outgoingLight, 1.0 );\n}"});
b=new pd(1,32,16);Oa.call(this,b,a);this.onBeforeRender()}function Mg(a,b,c,d){a=a||10;b=b||10;c=new ca(void 0!==c?c:4473924);d=new ca(void 0!==d?d:8947848);var f=b/2,g=a/b,h=a/2;a=[];for(var l=[],m=0,q=0,u=-h;m<=b;m++,u+=g){a.push(-h,0,u,h,0,u);a.push(u,0,-h,u,0,h);var w=m===f?c:d;w.toArray(l,q);q+=3;w.toArray(l,q);q+=3;w.toArray(l,q);q+=3;w.toArray(l,q);q+=3}b=new la;b.addAttribute("position",new ia(a,3));b.addAttribute("color",new ia(l,3));c=new lb({vertexColors:2});pb.call(this,b,c)}function Ng(a,
b,c,d,f,g){a=a||10;b=b||16;c=c||8;d=d||64;f=new ca(void 0!==f?f:4473924);g=new ca(void 0!==g?g:8947848);var h=[],l=[],m;for(m=0;m<=b;m++){var q=m/b*2*Math.PI;var u=Math.sin(q)*a;q=Math.cos(q)*a;h.push(0,0,0);h.push(u,0,q);var w=m&1?f:g;l.push(w.r,w.g,w.b);l.push(w.r,w.g,w.b)}for(m=0;m<=c;m++){w=m&1?f:g;var y=a-a/c*m;for(b=0;b<d;b++)q=b/d*2*Math.PI,u=Math.sin(q)*y,q=Math.cos(q)*y,h.push(u,0,q),l.push(w.r,w.g,w.b),q=(b+1)/d*2*Math.PI,u=Math.sin(q)*y,q=Math.cos(q)*y,h.push(u,0,q),l.push(w.r,w.g,w.b)}a=
new la;a.addAttribute("position",new ia(h,3));a.addAttribute("color",new ia(l,3));h=new lb({vertexColors:2});pb.call(this,a,h)}function Pe(a,b,c,d){this.audio=a;this.range=b||1;this.divisionsInnerAngle=c||16;this.divisionsOuterAngle=d||2;a=new la;a.addAttribute("position",new Ea(new Float32Array(3*(3*(this.divisionsInnerAngle+2*this.divisionsOuterAngle)+3)),3));b=new lb({color:65280});c=new lb({color:16776960});Ib.call(this,a,[c,b]);this.update()}function Pf(a,b,c,d){this.object=a;this.size=void 0!==
b?b:1;a=void 0!==c?c:16776960;d=void 0!==d?d:1;b=0;(c=this.object.geometry)&&c.isGeometry?b=c.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");c=new la;b=new ia(6*b,3);c.addAttribute("position",b);pb.call(this,c,new lb({color:a,linewidth:d}));this.matrixAutoUpdate=!1;this.update()}function Qe(a,b,c){I.call(this);this.light=a;this.light.updateMatrixWorld();this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;this.color=c;
void 0===b&&(b=1);a=new la;a.addAttribute("position",new ia([-b,b,0,b,b,0,b,-b,0,-b,-b,0,-b,b,0],3));b=new lb({fog:!1});this.lightPlane=new Ib(a,b);this.add(this.lightPlane);a=new la;a.addAttribute("position",new ia([0,0,0,0,0,1],3));this.targetLine=new Ib(a,b);this.add(this.targetLine);this.update()}function Qf(a){function b(C,D,K){c(C,K);c(D,K)}function c(C,D){g.push(0,0,0);h.push(D.r,D.g,D.b);void 0===l[C]&&(l[C]=[]);l[C].push(g.length/3-1)}var d=new la,f=new lb({color:16777215,vertexColors:1}),
g=[],h=[],l={},m=new ca(16755200),q=new ca(16711680),u=new ca(43775),w=new ca(16777215),y=new ca(3355443);b("n1","n2",m);b("n2","n4",m);b("n4","n3",m);b("n3","n1",m);b("f1","f2",m);b("f2","f4",m);b("f4","f3",m);b("f3","f1",m);b("n1","f1",m);b("n2","f2",m);b("n3","f3",m);b("n4","f4",m);b("p","n1",q);b("p","n2",q);b("p","n3",q);b("p","n4",q);b("u1","u2",u);b("u2","u3",u);b("u3","u1",u);b("c","t",w);b("p","c",y);b("cn1","cn2",y);b("cn3","cn4",y);b("cf1","cf2",y);b("cf3","cf4",y);d.addAttribute("position",
new ia(g,3));d.addAttribute("color",new ia(h,3));pb.call(this,d,f);this.camera=a;this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix();this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;this.pointMap=l;this.update()}function zb(a,b,c,d,f,g,h){Og.set(f,g,h).unproject(d);a=b[a];if(void 0!==a)for(c=c.getAttribute("position"),b=0,d=a.length;b<d;b++)c.setXYZ(a[b],Og.x,Og.y,Og.z)}function Yc(a,b){this.object=a;void 0===b&&(b=16776960);a=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]);var c=new Float32Array(24),d=new la;d.setIndex(new Ea(a,1));d.addAttribute("position",new Ea(c,3));pb.call(this,d,new lb({color:b}));this.matrixAutoUpdate=!1;this.update()}function Rf(a,b){this.type="Box3Helper";this.box=a;b=b||16776960;a=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]);var c=new la;c.setIndex(new Ea(a,1));c.addAttribute("position",new ia([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3));pb.call(this,c,new lb({color:b}));this.geometry.computeBoundingSphere()}
function Sf(a,b,c){this.type="PlaneHelper";this.plane=a;this.size=void 0===b?1:b;a=void 0!==c?c:16776960;b=new la;b.addAttribute("position",new ia([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],3));b.computeBoundingSphere();Ib.call(this,b,new lb({color:a}));b=new la;b.addAttribute("position",new ia([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3));b.computeBoundingSphere();this.add(new Oa(b,new gb({color:a,opacity:.2,transparent:!0,depthWrite:!1})))}function Zc(a,b,c,d,f,g){I.call(this);
void 0===a&&(a=new p(0,0,1));void 0===b&&(b=new p(0,0,0));void 0===c&&(c=1);void 0===d&&(d=16776960);void 0===f&&(f=.2*c);void 0===g&&(g=.2*f);void 0===Pg&&(Pg=new la,Pg.addAttribute("position",new ia([0,0,0,0,1,0],3)),ai=new Wc(0,.5,1,5,1),ai.translate(0,-.5,0));this.position.copy(b);this.line=new Ib(Pg,new lb({color:d}));this.line.matrixAutoUpdate=!1;this.add(this.line);this.cone=new Oa(ai,new gb({color:d}));this.cone.matrixAutoUpdate=!1;this.add(this.cone);this.setDirection(a);this.setLength(c,
f,g)}function Tf(a){a=a||1;var b=[0,0,0,a,0,0,0,0,0,0,a,0,0,0,0,0,0,a];a=new la;a.addAttribute("position",new ia(b,3));a.addAttribute("color",new ia([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));b=new lb({vertexColors:2});pb.call(this,a,b)}function yj(a){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.");Ob.call(this,a);this.type="catmullrom";this.closed=!0}function zj(a){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.");
Ob.call(this,a);this.type="catmullrom"}function bi(a){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead.");Ob.call(this,a);this.type="catmullrom"}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52));void 0===Number.isInteger&&(Number.isInteger=function(a){return"number"===typeof a&&isFinite(a)&&Math.floor(a)===a});void 0===Math.sign&&(Math.sign=function(a){return 0>a?-1:0<a?1:+a});!1==="name"in Function.prototype&&Object.defineProperty(Function.prototype,"name",
{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}});void 0===Object.assign&&(Object.assign=function(a){if(void 0===a||null===a)throw new TypeError("Cannot convert undefined or null to object");for(var b=Object(a),c=1;c<arguments.length;c++){var d=arguments[c];if(void 0!==d&&null!==d)for(var f in d)Object.prototype.hasOwnProperty.call(d,f)&&(b[f]=d[f])}return b});Object.assign(r.prototype,{addEventListener:function(a,b){void 0===this._listeners&&(this._listeners={});var c=
this._listeners;void 0===c[a]&&(c[a]=[]);-1===c[a].indexOf(b)&&c[a].push(b)},hasEventListener:function(a,b){if(void 0===this._listeners)return!1;var c=this._listeners;return void 0!==c[a]&&-1!==c[a].indexOf(b)},removeEventListener:function(a,b){void 0!==this._listeners&&(a=this._listeners[a],void 0!==a&&(b=a.indexOf(b),-1!==b&&a.splice(b,1)))},dispatchEvent:function(a){if(void 0!==this._listeners){var b=this._listeners[a.type];if(void 0!==b){a.target=this;b=b.slice(0);for(var c=0,d=b.length;c<d;c++)b[c].call(this,
a)}}}});for(var Lb=[],Uf=0;256>Uf;Uf++)Lb[Uf]=(16>Uf?"0":"")+Uf.toString(16);var Qa={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var a=4294967295*Math.random()|0,b=4294967295*Math.random()|0,c=4294967295*Math.random()|0,d=4294967295*Math.random()|0;return(Lb[a&255]+Lb[a>>8&255]+Lb[a>>16&255]+Lb[a>>24&255]+"-"+Lb[b&255]+Lb[b>>8&255]+"-"+Lb[b>>16&15|64]+Lb[b>>24&255]+"-"+Lb[c&63|128]+Lb[c>>8&255]+"-"+Lb[c>>16&255]+Lb[c>>24&255]+Lb[d&255]+Lb[d>>8&255]+Lb[d>>16&255]+Lb[d>>24&255]).toUpperCase()},
clamp:function(a,b,c){return Math.max(b,Math.min(c,a))},euclideanModulo:function(a,b){return(a%b+b)%b},mapLinear:function(a,b,c,d,f){return d+(a-b)*(f-d)/(c-b)},lerp:function(a,b,c){return(1-c)*a+c*b},smoothstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*(3-2*a)},smootherstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*a*(a*(6*a-15)+10)},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+
Math.random()*(b-a)},randFloatSpread:function(a){return a*(.5-Math.random())},degToRad:function(a){return a*Qa.DEG2RAD},radToDeg:function(a){return a*Qa.RAD2DEG},isPowerOfTwo:function(a){return 0===(a&a-1)&&0!==a},ceilPowerOfTwo:function(a){return Math.pow(2,Math.ceil(Math.log(a)/Math.LN2))},floorPowerOfTwo:function(a){return Math.pow(2,Math.floor(Math.log(a)/Math.LN2))}};Object.defineProperties(k.prototype,{width:{get:function(){return this.x},set:function(a){this.x=a}},height:{get:function(){return this.y},
set:function(a){this.y=a}}});Object.assign(k.prototype,{isVector2:!0,set:function(a,b){this.x=a;this.y=b;return this},setScalar:function(a){this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+
a);}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;return this},addScalar:function(a){this.x+=a;this.y+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;return this},
sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;return this},subScalar:function(a){this.x-=a;this.y-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiply:function(a){this.x*=a.x;this.y*=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},divide:function(a){this.x/=a.x;this.y/=a.y;return this},divideScalar:function(a){return this.multiplyScalar(1/
a)},applyMatrix3:function(a){var b=this.x,c=this.y;a=a.elements;this.x=a[0]*b+a[3]*c+a[6];this.y=a[1]*b+a[4]*c+a[7];return this},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);return this},clamp:function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));return this},clampScalar:function(a,b){this.x=Math.max(a,Math.min(b,this.x));this.y=Math.max(a,Math.min(b,
this.y));return this},clampLength:function(a,b){var c=this.length();return this.divideScalar(c||1).multiplyScalar(Math.max(a,Math.min(b,c)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);
return this},negate:function(){this.x=-this.x;this.y=-this.y;return this},dot:function(a){return this.x*a.x+this.y*a.y},cross:function(a){return this.x*a.y-this.y*a.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 a=Math.atan2(this.y,this.x);0>a&&(a+=2*Math.PI);return a},
distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x;a=this.y-a.y;return b*b+a*a},manhattanDistanceTo:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)},setLength:function(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;return this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y},
fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute().");this.x=a.getX(b);this.y=a.getY(b);return this},rotateAround:function(a,b){var c=Math.cos(b);b=Math.sin(b);var d=this.x-a.x,f=this.y-a.y;this.x=d*c-f*b+a.x;this.y=d*b+f*c+a.y;return this}});Object.assign(n,
{slerp:function(a,b,c,d){return c.copy(a).slerp(b,d)},slerpFlat:function(a,b,c,d,f,g,h){var l=c[d+0],m=c[d+1],q=c[d+2];c=c[d+3];d=f[g+0];var u=f[g+1],w=f[g+2];f=f[g+3];if(c!==f||l!==d||m!==u||q!==w){g=1-h;var y=l*d+m*u+q*w+c*f,C=0<=y?1:-1,D=1-y*y;D>Number.EPSILON&&(D=Math.sqrt(D),y=Math.atan2(D,y*C),g=Math.sin(g*y)/D,h=Math.sin(h*y)/D);C*=h;l=l*g+d*C;m=m*g+u*C;q=q*g+w*C;c=c*g+f*C;g===1-h&&(h=1/Math.sqrt(l*l+m*m+q*q+c*c),l*=h,m*=h,q*=h,c*=h)}a[b]=l;a[b+1]=m;a[b+2]=q;a[b+3]=c}});Object.defineProperties(n.prototype,
{x:{get:function(){return this._x},set:function(a){this._x=a;this._onChangeCallback()}},y:{get:function(){return this._y},set:function(a){this._y=a;this._onChangeCallback()}},z:{get:function(){return this._z},set:function(a){this._z=a;this._onChangeCallback()}},w:{get:function(){return this._w},set:function(a){this._w=a;this._onChangeCallback()}}});Object.assign(n.prototype,{isQuaternion:!0,set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._w=d;this._onChangeCallback();return this},clone:function(){return new this.constructor(this._x,
this._y,this._z,this._w)},copy:function(a){this._x=a.x;this._y=a.y;this._z=a.z;this._w=a.w;this._onChangeCallback();return this},setFromEuler:function(a,b){if(!a||!a.isEuler)throw Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var c=a._x,d=a._y,f=a._z;a=a.order;var g=Math.cos,h=Math.sin,l=g(c/2),m=g(d/2);g=g(f/2);c=h(c/2);d=h(d/2);f=h(f/2);"XYZ"===a?(this._x=c*m*g+l*d*f,this._y=l*d*g-c*m*f,this._z=l*m*f+c*d*g,this._w=l*m*g-c*d*f):"YXZ"===
a?(this._x=c*m*g+l*d*f,this._y=l*d*g-c*m*f,this._z=l*m*f-c*d*g,this._w=l*m*g+c*d*f):"ZXY"===a?(this._x=c*m*g-l*d*f,this._y=l*d*g+c*m*f,this._z=l*m*f+c*d*g,this._w=l*m*g-c*d*f):"ZYX"===a?(this._x=c*m*g-l*d*f,this._y=l*d*g+c*m*f,this._z=l*m*f-c*d*g,this._w=l*m*g+c*d*f):"YZX"===a?(this._x=c*m*g+l*d*f,this._y=l*d*g+c*m*f,this._z=l*m*f-c*d*g,this._w=l*m*g-c*d*f):"XZY"===a&&(this._x=c*m*g-l*d*f,this._y=l*d*g-c*m*f,this._z=l*m*f+c*d*g,this._w=l*m*g+c*d*f);!1!==b&&this._onChangeCallback();return this},setFromAxisAngle:function(a,
b){b/=2;var c=Math.sin(b);this._x=a.x*c;this._y=a.y*c;this._z=a.z*c;this._w=Math.cos(b);this._onChangeCallback();return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0];a=b[4];var d=b[8],f=b[1],g=b[5],h=b[9],l=b[2],m=b[6];b=b[10];var q=c+g+b;0<q?(c=.5/Math.sqrt(q+1),this._w=.25/c,this._x=(m-h)*c,this._y=(d-l)*c,this._z=(f-a)*c):c>g&&c>b?(c=2*Math.sqrt(1+c-g-b),this._w=(m-h)/c,this._x=.25*c,this._y=(a+f)/c,this._z=(d+l)/c):g>b?(c=2*Math.sqrt(1+g-c-b),this._w=(d-l)/c,this._x=(a+f)/c,
this._y=.25*c,this._z=(h+m)/c):(c=2*Math.sqrt(1+b-c-g),this._w=(f-a)/c,this._x=(d+l)/c,this._y=(h+m)/c,this._z=.25*c);this._onChangeCallback();return this},setFromUnitVectors:function(a,b){var c=a.dot(b)+1;1E-6>c?(c=0,Math.abs(a.x)>Math.abs(a.z)?(this._x=-a.y,this._y=a.x,this._z=0):(this._x=0,this._y=-a.z,this._z=a.y)):(this._x=a.y*b.z-a.z*b.y,this._y=a.z*b.x-a.x*b.z,this._z=a.x*b.y-a.y*b.x);this._w=c;return this.normalize()},angleTo:function(a){return 2*Math.acos(Math.abs(Qa.clamp(this.dot(a),-1,
1)))},rotateTowards:function(a,b){var c=this.angleTo(a);if(0===c)return this;this.slerp(a,Math.min(1,b/c));return this},inverse:function(){return this.conjugate()},conjugate:function(){this._x*=-1;this._y*=-1;this._z*=-1;this._onChangeCallback();return this},dot:function(a){return this._x*a._x+this._y*a._y+this._z*a._z+this._w*a._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 a=this.length();0===a?(this._z=this._y=this._x=0,this._w=1):(a=1/a,this._x*=a,this._y*=a,this._z*=a,this._w*=a);this._onChangeCallback();return this},multiply:function(a,b){return void 0!==b?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)},premultiply:function(a){return this.multiplyQuaternions(a,this)},multiplyQuaternions:function(a,
b){var c=a._x,d=a._y,f=a._z;a=a._w;var g=b._x,h=b._y,l=b._z;b=b._w;this._x=c*b+a*g+d*l-f*h;this._y=d*b+a*h+f*g-c*l;this._z=f*b+a*l+c*h-d*g;this._w=a*b-c*g-d*h-f*l;this._onChangeCallback();return this},slerp:function(a,b){if(0===b)return this;if(1===b)return this.copy(a);var c=this._x,d=this._y,f=this._z,g=this._w,h=g*a._w+c*a._x+d*a._y+f*a._z;0>h?(this._w=-a._w,this._x=-a._x,this._y=-a._y,this._z=-a._z,h=-h):this.copy(a);if(1<=h)return this._w=g,this._x=c,this._y=d,this._z=f,this;a=1-h*h;if(a<=Number.EPSILON)return h=
1-b,this._w=h*g+b*this._w,this._x=h*c+b*this._x,this._y=h*d+b*this._y,this._z=h*f+b*this._z,this.normalize(),this._onChangeCallback(),this;a=Math.sqrt(a);var l=Math.atan2(a,h);h=Math.sin((1-b)*l)/a;b=Math.sin(b*l)/a;this._w=g*h+this._w*b;this._x=c*h+this._x*b;this._y=d*h+this._y*b;this._z=f*h+this._z*b;this._onChangeCallback();return this},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._w===this._w},fromArray:function(a,b){void 0===b&&(b=0);this._x=a[b];this._y=a[b+1];
this._z=a[b+2];this._w=a[b+3];this._onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._w;return a},_onChange:function(a){this._onChangeCallback=a;return this},_onChangeCallback:function(){}});var ci=new p,Aj=new n;Object.assign(p.prototype,{isVector3:!0,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setScalar:function(a){this.z=this.y=this.x=a;return this},setX:function(a){this.x=a;return this},
setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(a){this.x=a.x;this.y=a.y;
this.z=a.z;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),
this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},subScalar:function(a){this.x-=a;this.y-=a;this.z-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},multiply:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(a,b);this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=
a;return this},multiplyVectors:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},applyEuler:function(a){a&&a.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.");return this.applyQuaternion(Aj.setFromEuler(a))},applyAxisAngle:function(a,b){return this.applyQuaternion(Aj.setFromAxisAngle(a,b))},applyMatrix3:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[3]*c+a[6]*d;this.y=a[1]*b+a[4]*c+a[7]*
d;this.z=a[2]*b+a[5]*c+a[8]*d;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;var f=1/(a[3]*b+a[7]*c+a[11]*d+a[15]);this.x=(a[0]*b+a[4]*c+a[8]*d+a[12])*f;this.y=(a[1]*b+a[5]*c+a[9]*d+a[13])*f;this.z=(a[2]*b+a[6]*c+a[10]*d+a[14])*f;return this},applyQuaternion:function(a){var b=this.x,c=this.y,d=this.z,f=a.x,g=a.y,h=a.z;a=a.w;var l=a*b+g*d-h*c,m=a*c+h*b-f*d,q=a*d+f*c-g*b;b=-f*b-g*c-h*d;this.x=l*a+b*-f+m*-h-q*-g;this.y=m*a+b*-g+q*-f-l*-h;this.z=q*a+b*-h+l*-g-m*-f;return this},
project:function(a){return this.applyMatrix4(a.matrixWorldInverse).applyMatrix4(a.projectionMatrix)},unproject:function(a){return this.applyMatrix4(a.projectionMatrixInverse).applyMatrix4(a.matrixWorld)},transformDirection:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d;this.y=a[1]*b+a[5]*c+a[9]*d;this.z=a[2]*b+a[6]*c+a[10]*d;return this.normalize()},divide:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){return this.multiplyScalar(1/
a)},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);this.z=Math.min(this.z,a.z);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z);return this},clamp:function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));this.z=Math.max(a.z,Math.min(b.z,this.z));return this},clampScalar:function(a,b){this.x=Math.max(a,Math.min(b,this.x));this.y=Math.max(a,Math.min(b,this.y));this.z=Math.max(a,
Math.min(b,this.z));return this},clampLength:function(a,b){var c=this.length();return this.divideScalar(c||1).multiplyScalar(Math.max(a,Math.min(b,c)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);return this},roundToZero:function(){this.x=
0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.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(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},cross:function(a,b){return void 0!==b?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(a,b)):this.crossVectors(this,
a)},crossVectors:function(a,b){var c=a.x,d=a.y;a=a.z;var f=b.x,g=b.y;b=b.z;this.x=d*b-a*g;this.y=a*f-c*b;this.z=c*g-d*f;return this},projectOnVector:function(a){var b=a.dot(this)/a.lengthSq();return this.copy(a).multiplyScalar(b)},projectOnPlane:function(a){ci.copy(this).projectOnVector(a);return this.sub(ci)},reflect:function(a){return this.sub(ci.copy(a).multiplyScalar(2*this.dot(a)))},angleTo:function(a){a=this.dot(a)/Math.sqrt(this.lengthSq()*a.lengthSq());return Math.acos(Qa.clamp(a,-1,1))},
distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},manhattanDistanceTo:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)+Math.abs(this.z-a.z)},setFromSpherical:function(a){return this.setFromSphericalCoords(a.radius,a.phi,a.theta)},setFromSphericalCoords:function(a,b,c){var d=Math.sin(b)*a;this.x=d*Math.sin(c);this.y=Math.cos(b)*a;this.z=d*Math.cos(c);return this},setFromCylindrical:function(a){return this.setFromCylindricalCoords(a.radius,
a.theta,a.y)},setFromCylindricalCoords:function(a,b,c){this.x=a*Math.sin(b);this.y=c;this.z=a*Math.cos(b);return this},setFromMatrixPosition:function(a){a=a.elements;this.x=a[12];this.y=a[13];this.z=a[14];return this},setFromMatrixScale:function(a){var b=this.setFromMatrixColumn(a,0).length(),c=this.setFromMatrixColumn(a,1).length();a=this.setFromMatrixColumn(a,2).length();this.x=b;this.y=c;this.z=a;return this},setFromMatrixColumn:function(a,b){return this.fromArray(a.elements,4*b)},equals:function(a){return a.x===
this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute().");this.x=a.getX(b);this.y=a.getY(b);this.z=a.getZ(b);return this}});var Sd=new p;Object.assign(v.prototype,{isMatrix3:!0,set:function(a,
b,c,d,f,g,h,l,m){var q=this.elements;q[0]=a;q[1]=d;q[2]=h;q[3]=b;q[4]=f;q[5]=l;q[6]=c;q[7]=g;q[8]=m;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(a){var b=this.elements;a=a.elements;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];return this},setFromMatrix4:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[1],a[5],a[9],a[2],a[6],a[10]);return this},
applyToBufferAttribute:function(a){for(var b=0,c=a.count;b<c;b++)Sd.x=a.getX(b),Sd.y=a.getY(b),Sd.z=a.getZ(b),Sd.applyMatrix3(this),a.setXYZ(b,Sd.x,Sd.y,Sd.z);return a},multiply:function(a){return this.multiplyMatrices(this,a)},premultiply:function(a){return this.multiplyMatrices(a,this)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements;b=this.elements;a=c[0];var f=c[3],g=c[6],h=c[1],l=c[4],m=c[7],q=c[2],u=c[5];c=c[8];var w=d[0],y=d[3],C=d[6],D=d[1],K=d[4],J=d[7],W=d[2],T=d[5];d=d[8];
b[0]=a*w+f*D+g*W;b[3]=a*y+f*K+g*T;b[6]=a*C+f*J+g*d;b[1]=h*w+l*D+m*W;b[4]=h*y+l*K+m*T;b[7]=h*C+l*J+m*d;b[2]=q*w+u*D+c*W;b[5]=q*y+u*K+c*T;b[8]=q*C+u*J+c*d;return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[3]*=a;b[6]*=a;b[1]*=a;b[4]*=a;b[7]*=a;b[2]*=a;b[5]*=a;b[8]*=a;return this},determinant:function(){var a=this.elements,b=a[0],c=a[1],d=a[2],f=a[3],g=a[4],h=a[5],l=a[6],m=a[7];a=a[8];return b*g*a-b*h*m-c*f*a+c*h*l+d*f*m-d*g*l},getInverse:function(a,b){a&&a.isMatrix4&&console.error("THREE.Matrix3: .getInverse() no longer takes a Matrix4 argument.");
var c=a.elements;a=this.elements;var d=c[0],f=c[1],g=c[2],h=c[3],l=c[4],m=c[5],q=c[6],u=c[7];c=c[8];var w=c*l-m*u,y=m*q-c*h,C=u*h-l*q,D=d*w+f*y+g*C;if(0===D){if(!0===b)throw Error("THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0");console.warn("THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0");return this.identity()}b=1/D;a[0]=w*b;a[1]=(g*u-c*f)*b;a[2]=(m*f-g*l)*b;a[3]=y*b;a[4]=(c*d-g*q)*b;a[5]=(g*h-m*d)*b;a[6]=C*b;a[7]=(f*q-u*d)*b;a[8]=(l*d-f*h)*b;return this},
transpose:function(){var a=this.elements;var b=a[1];a[1]=a[3];a[3]=b;b=a[2];a[2]=a[6];a[6]=b;b=a[5];a[5]=a[7];a[7]=b;return this},getNormalMatrix:function(a){return this.setFromMatrix4(a).getInverse(this).transpose()},transposeIntoArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this},setUvTransform:function(a,b,c,d,f,g,h){var l=Math.cos(f);f=Math.sin(f);this.set(c*l,c*f,-c*(l*g+f*h)+g+a,-d*f,d*l,-d*(-f*g+l*h)+h+
b,0,0,1)},scale:function(a,b){var c=this.elements;c[0]*=a;c[3]*=a;c[6]*=a;c[1]*=b;c[4]*=b;c[7]*=b;return this},rotate:function(a){var b=Math.cos(a);a=Math.sin(a);var c=this.elements,d=c[0],f=c[3],g=c[6],h=c[1],l=c[4],m=c[7];c[0]=b*d+a*h;c[3]=b*f+a*l;c[6]=b*g+a*m;c[1]=-a*d+b*h;c[4]=-a*f+b*l;c[7]=-a*g+b*m;return this},translate:function(a,b){var c=this.elements;c[0]+=a*c[2];c[3]+=a*c[5];c[6]+=a*c[8];c[1]+=b*c[2];c[4]+=b*c[5];c[7]+=b*c[8];return this},equals:function(a){var b=this.elements;a=a.elements;
for(var c=0;9>c;c++)if(b[c]!==a[c])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;9>c;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];return a}});var Re,rd={getDataURL:function(a){if("undefined"==typeof HTMLCanvasElement)return a.src;if(!(a instanceof HTMLCanvasElement)){void 0===Re&&(Re=document.createElementNS("http://www.w3.org/1999/xhtml",
"canvas"));Re.width=a.width;Re.height=a.height;var b=Re.getContext("2d");a instanceof ImageData?b.putImageData(a,0,0):b.drawImage(a,0,0,a.width,a.height);a=Re}return 2048<a.width||2048<a.height?a.toDataURL("image/jpeg",.6):a.toDataURL("image/png")}},hk=0;z.DEFAULT_IMAGE=void 0;z.DEFAULT_MAPPING=300;z.prototype=Object.assign(Object.create(r.prototype),{constructor:z,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(a){this.name=a.name;this.image=a.image;this.mipmaps=a.mipmaps.slice(0);this.mapping=a.mapping;this.wrapS=a.wrapS;this.wrapT=a.wrapT;this.magFilter=a.magFilter;this.minFilter=a.minFilter;this.anisotropy=a.anisotropy;this.format=a.format;this.type=a.type;this.offset.copy(a.offset);this.repeat.copy(a.repeat);this.center.copy(a.center);this.rotation=a.rotation;this.matrixAutoUpdate=a.matrixAutoUpdate;
this.matrix.copy(a.matrix);this.generateMipmaps=a.generateMipmaps;this.premultiplyAlpha=a.premultiplyAlpha;this.flipY=a.flipY;this.unpackAlignment=a.unpackAlignment;this.encoding=a.encoding;return this},toJSON:function(a){var b=void 0===a||"string"===typeof a;if(!b&&void 0!==a.textures[this.uuid])return a.textures[this.uuid];var c={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,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){var d=this.image;void 0===d.uuid&&(d.uuid=Qa.generateUUID());if(!b&&void 0===a.images[d.uuid]){if(Array.isArray(d)){var f=[];for(var g=0,h=d.length;g<
h;g++)f.push(rd.getDataURL(d[g]))}else f=rd.getDataURL(d);a.images[d.uuid]={uuid:d.uuid,url:f}}c.image=d.uuid}b||(a.textures[this.uuid]=c);return c},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(a){if(300!==this.mapping)return a;a.applyMatrix3(this.matrix);if(0>a.x||1<a.x)switch(this.wrapS){case 1E3:a.x-=Math.floor(a.x);break;case 1001:a.x=0>a.x?0:1;break;case 1002:a.x=1===Math.abs(Math.floor(a.x)%2)?Math.ceil(a.x)-a.x:a.x-Math.floor(a.x)}if(0>a.y||1<a.y)switch(this.wrapT){case 1E3:a.y-=
Math.floor(a.y);break;case 1001:a.y=0>a.y?0:1;break;case 1002:a.y=1===Math.abs(Math.floor(a.y)%2)?Math.ceil(a.y)-a.y:a.y-Math.floor(a.y)}this.flipY&&(a.y=1-a.y);return a}});Object.defineProperty(z.prototype,"needsUpdate",{set:function(a){!0===a&&this.version++}});Object.defineProperties(E.prototype,{width:{get:function(){return this.z},set:function(a){this.z=a}},height:{get:function(){return this.w},set:function(a){this.w=a}}});Object.assign(E.prototype,{isVector4:!0,set:function(a,b,c,d){this.x=
a;this.y=b;this.z=c;this.w=d;return this},setScalar:function(a){this.w=this.z=this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setW:function(a){this.w=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;case 3:this.w=b;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x;
case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=void 0!==a.w?a.w:1;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},
addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;this.w+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;this.w+=a.w*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},subScalar:function(a){this.x-=
a;this.y-=a;this.z-=a;this.w-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z,f=this.w;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12]*f;this.y=a[1]*b+a[5]*c+a[9]*d+a[13]*f;this.z=a[2]*b+a[6]*c+a[10]*d+a[14]*f;this.w=a[3]*b+a[7]*c+a[11]*d+a[15]*f;return this},divideScalar:function(a){return this.multiplyScalar(1/
a)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);1E-4>b?(this.x=1,this.z=this.y=0):(this.x=a.x/b,this.y=a.y/b,this.z=a.z/b);return this},setAxisAngleFromRotationMatrix:function(a){a=a.elements;var b=a[0];var c=a[4];var d=a[8],f=a[1],g=a[5],h=a[9];var l=a[2];var m=a[6];var q=a[10];if(.01>Math.abs(c-f)&&.01>Math.abs(d-l)&&.01>Math.abs(h-m)){if(.1>Math.abs(c+f)&&.1>Math.abs(d+l)&&.1>Math.abs(h+m)&&.1>Math.abs(b+g+q-3))return this.set(1,0,0,0),this;a=Math.PI;
b=(b+1)/2;g=(g+1)/2;q=(q+1)/2;c=(c+f)/4;d=(d+l)/4;h=(h+m)/4;b>g&&b>q?.01>b?(m=0,c=l=.707106781):(m=Math.sqrt(b),l=c/m,c=d/m):g>q?.01>g?(m=.707106781,l=0,c=.707106781):(l=Math.sqrt(g),m=c/l,c=h/l):.01>q?(l=m=.707106781,c=0):(c=Math.sqrt(q),m=d/c,l=h/c);this.set(m,l,c,a);return this}a=Math.sqrt((m-h)*(m-h)+(d-l)*(d-l)+(f-c)*(f-c));.001>Math.abs(a)&&(a=1);this.x=(m-h)/a;this.y=(d-l)/a;this.z=(f-c)/a;this.w=Math.acos((b+g+q-1)/2);return this},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,
a.y);this.z=Math.min(this.z,a.z);this.w=Math.min(this.w,a.w);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z);this.w=Math.max(this.w,a.w);return this},clamp:function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));this.z=Math.max(a.z,Math.min(b.z,this.z));this.w=Math.max(a.w,Math.min(b.w,this.w));return this},clampScalar:function(a,b){this.x=Math.max(a,Math.min(b,this.x));this.y=Math.max(a,Math.min(b,
this.y));this.z=Math.max(a,Math.min(b,this.z));this.w=Math.max(a,Math.min(b,this.w));return this},clampLength:function(a,b){var c=this.length();return this.divideScalar(c||1).multiplyScalar(Math.max(a,Math.min(b,c)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);this.w=Math.floor(this.w);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this},round:function(){this.x=
Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);this.w=Math.round(this.w);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*
a.z+this.w*a.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(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-
this.z)*b;this.w+=(a.w-this.w)*b;return this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];this.w=a[b+3];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;a[b+3]=this.w;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute().");
this.x=a.getX(b);this.y=a.getY(b);this.z=a.getZ(b);this.w=a.getW(b);return this}});t.prototype=Object.assign(Object.create(r.prototype),{constructor:t,isWebGLRenderTarget:!0,setSize:function(a,b){if(this.width!==a||this.height!==b)this.width=a,this.height=b,this.texture.image.width=a,this.texture.image.height=b,this.dispose();this.viewport.set(0,0,a,b);this.scissor.set(0,0,a,b)},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.width=a.width;this.height=a.height;this.viewport.copy(a.viewport);
this.texture=a.texture.clone();this.depthBuffer=a.depthBuffer;this.stencilBuffer=a.stencilBuffer;this.depthTexture=a.depthTexture;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});x.prototype=Object.assign(Object.create(t.prototype),{constructor:x,isWebGLMultisampleRenderTarget:!0,copy:function(a){t.prototype.copy.call(this,a);this.samples=a.samples;return this}});var fc=new p,Bb=new A,Sl=new p(0,0,0),Tl=new p(1,1,1),sd=new p,Qg=new p,Vb=new p;Object.assign(A.prototype,{isMatrix4:!0,
set:function(a,b,c,d,f,g,h,l,m,q,u,w,y,C,D,K){var J=this.elements;J[0]=a;J[4]=b;J[8]=c;J[12]=d;J[1]=f;J[5]=g;J[9]=h;J[13]=l;J[2]=m;J[6]=q;J[10]=u;J[14]=w;J[3]=y;J[7]=C;J[11]=D;J[15]=K;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},clone:function(){return(new A).fromArray(this.elements)},copy:function(a){var b=this.elements;a=a.elements;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11];
b[12]=a[12];b[13]=a[13];b[14]=a[14];b[15]=a[15];return this},copyPosition:function(a){var b=this.elements;a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractBasis:function(a,b,c){a.setFromMatrixColumn(this,0);b.setFromMatrixColumn(this,1);c.setFromMatrixColumn(this,2);return this},makeBasis:function(a,b,c){this.set(a.x,b.x,c.x,0,a.y,b.y,c.y,0,a.z,b.z,c.z,0,0,0,0,1);return this},extractRotation:function(a){var b=this.elements,c=a.elements,d=1/fc.setFromMatrixColumn(a,0).length(),
f=1/fc.setFromMatrixColumn(a,1).length();a=1/fc.setFromMatrixColumn(a,2).length();b[0]=c[0]*d;b[1]=c[1]*d;b[2]=c[2]*d;b[3]=0;b[4]=c[4]*f;b[5]=c[5]*f;b[6]=c[6]*f;b[7]=0;b[8]=c[8]*a;b[9]=c[9]*a;b[10]=c[10]*a;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},makeRotationFromEuler:function(a){a&&a.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var b=this.elements,c=a.x,d=a.y,f=a.z,g=Math.cos(c);c=Math.sin(c);var h=Math.cos(d);
d=Math.sin(d);var l=Math.cos(f);f=Math.sin(f);if("XYZ"===a.order){a=g*l;var m=g*f,q=c*l,u=c*f;b[0]=h*l;b[4]=-h*f;b[8]=d;b[1]=m+q*d;b[5]=a-u*d;b[9]=-c*h;b[2]=u-a*d;b[6]=q+m*d;b[10]=g*h}else"YXZ"===a.order?(a=h*l,m=h*f,q=d*l,u=d*f,b[0]=a+u*c,b[4]=q*c-m,b[8]=g*d,b[1]=g*f,b[5]=g*l,b[9]=-c,b[2]=m*c-q,b[6]=u+a*c,b[10]=g*h):"ZXY"===a.order?(a=h*l,m=h*f,q=d*l,u=d*f,b[0]=a-u*c,b[4]=-g*f,b[8]=q+m*c,b[1]=m+q*c,b[5]=g*l,b[9]=u-a*c,b[2]=-g*d,b[6]=c,b[10]=g*h):"ZYX"===a.order?(a=g*l,m=g*f,q=c*l,u=c*f,b[0]=h*l,
b[4]=q*d-m,b[8]=a*d+u,b[1]=h*f,b[5]=u*d+a,b[9]=m*d-q,b[2]=-d,b[6]=c*h,b[10]=g*h):"YZX"===a.order?(a=g*h,m=g*d,q=c*h,u=c*d,b[0]=h*l,b[4]=u-a*f,b[8]=q*f+m,b[1]=f,b[5]=g*l,b[9]=-c*l,b[2]=-d*l,b[6]=m*f+q,b[10]=a-u*f):"XZY"===a.order&&(a=g*h,m=g*d,q=c*h,u=c*d,b[0]=h*l,b[4]=-f,b[8]=d*l,b[1]=a*f+u,b[5]=g*l,b[9]=m*f-q,b[2]=q*f-m,b[6]=c*l,b[10]=u*f+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},makeRotationFromQuaternion:function(a){return this.compose(Sl,a,Tl)},lookAt:function(a,b,
c){var d=this.elements;Vb.subVectors(a,b);0===Vb.lengthSq()&&(Vb.z=1);Vb.normalize();sd.crossVectors(c,Vb);0===sd.lengthSq()&&(1===Math.abs(c.z)?Vb.x+=1E-4:Vb.z+=1E-4,Vb.normalize(),sd.crossVectors(c,Vb));sd.normalize();Qg.crossVectors(Vb,sd);d[0]=sd.x;d[4]=Qg.x;d[8]=Vb.x;d[1]=sd.y;d[5]=Qg.y;d[9]=Vb.y;d[2]=sd.z;d[6]=Qg.z;d[10]=Vb.z;return this},multiply:function(a,b){return void 0!==b?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),
this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},premultiply:function(a){return this.multiplyMatrices(a,this)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements;b=this.elements;a=c[0];var f=c[4],g=c[8],h=c[12],l=c[1],m=c[5],q=c[9],u=c[13],w=c[2],y=c[6],C=c[10],D=c[14],K=c[3],J=c[7],W=c[11];c=c[15];var T=d[0],V=d[4],Z=d[8],R=d[12],Y=d[1],ea=d[5],za=d[9],Aa=d[13],fa=d[2],ma=d[6],ha=d[10],ra=d[14],Ma=d[3],cb=d[7],pa=d[11];d=d[15];b[0]=a*T+f*Y+g*fa+h*Ma;b[4]=a*V+f*ea+g*ma+h*cb;b[8]=
a*Z+f*za+g*ha+h*pa;b[12]=a*R+f*Aa+g*ra+h*d;b[1]=l*T+m*Y+q*fa+u*Ma;b[5]=l*V+m*ea+q*ma+u*cb;b[9]=l*Z+m*za+q*ha+u*pa;b[13]=l*R+m*Aa+q*ra+u*d;b[2]=w*T+y*Y+C*fa+D*Ma;b[6]=w*V+y*ea+C*ma+D*cb;b[10]=w*Z+y*za+C*ha+D*pa;b[14]=w*R+y*Aa+C*ra+D*d;b[3]=K*T+J*Y+W*fa+c*Ma;b[7]=K*V+J*ea+W*ma+c*cb;b[11]=K*Z+J*za+W*ha+c*pa;b[15]=K*R+J*Aa+W*ra+c*d;return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=
a;b[11]*=a;b[15]*=a;return this},applyToBufferAttribute:function(a){for(var b=0,c=a.count;b<c;b++)fc.x=a.getX(b),fc.y=a.getY(b),fc.z=a.getZ(b),fc.applyMatrix4(this),a.setXYZ(b,fc.x,fc.y,fc.z);return a},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],f=a[12],g=a[1],h=a[5],l=a[9],m=a[13],q=a[2],u=a[6],w=a[10],y=a[14];return a[3]*(+f*l*u-d*m*u-f*h*w+c*m*w+d*h*y-c*l*y)+a[7]*(+b*l*y-b*m*w+f*g*w-d*g*y+d*m*q-f*l*q)+a[11]*(+b*m*u-b*h*y-f*g*u+c*g*y+f*h*q-c*m*q)+a[15]*(-d*h*q-b*l*u+b*h*w+d*
g*u-c*g*w+c*l*q)},transpose:function(){var a=this.elements;var b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},setPosition:function(a,b,c){var d=this.elements;a.isVector3?(d[12]=a.x,d[13]=a.y,d[14]=a.z):(d[12]=a,d[13]=b,d[14]=c);return this},getInverse:function(a,b){var c=this.elements,d=a.elements;a=d[0];var f=d[1],g=d[2],h=d[3],l=d[4],m=d[5],q=d[6],u=d[7],w=d[8],y=d[9],C=d[10],D=
d[11],K=d[12],J=d[13],W=d[14];d=d[15];var T=y*W*u-J*C*u+J*q*D-m*W*D-y*q*d+m*C*d,V=K*C*u-w*W*u-K*q*D+l*W*D+w*q*d-l*C*d,Z=w*J*u-K*y*u+K*m*D-l*J*D-w*m*d+l*y*d,R=K*y*q-w*J*q-K*m*C+l*J*C+w*m*W-l*y*W,Y=a*T+f*V+g*Z+h*R;if(0===Y){if(!0===b)throw Error("THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0");console.warn("THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0");return this.identity()}b=1/Y;c[0]=T*b;c[1]=(J*C*h-y*W*h-J*g*D+f*W*D+y*g*d-f*C*d)*b;c[2]=(m*W*h-J*q*h+J*g*
u-f*W*u-m*g*d+f*q*d)*b;c[3]=(y*q*h-m*C*h-y*g*u+f*C*u+m*g*D-f*q*D)*b;c[4]=V*b;c[5]=(w*W*h-K*C*h+K*g*D-a*W*D-w*g*d+a*C*d)*b;c[6]=(K*q*h-l*W*h-K*g*u+a*W*u+l*g*d-a*q*d)*b;c[7]=(l*C*h-w*q*h+w*g*u-a*C*u-l*g*D+a*q*D)*b;c[8]=Z*b;c[9]=(K*y*h-w*J*h-K*f*D+a*J*D+w*f*d-a*y*d)*b;c[10]=(l*J*h-K*m*h+K*f*u-a*J*u-l*f*d+a*m*d)*b;c[11]=(w*m*h-l*y*h-w*f*u+a*y*u+l*f*D-a*m*D)*b;c[12]=R*b;c[13]=(w*J*g-K*y*g+K*f*C-a*J*C-w*f*W+a*y*W)*b;c[14]=(K*m*g-l*J*g-K*f*q+a*J*q+l*f*W-a*m*W)*b;c[15]=(l*y*g-w*m*g+w*f*q-a*y*q-l*f*C+a*m*
C)*b;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y;a=a.z;b[0]*=c;b[4]*=d;b[8]*=a;b[1]*=c;b[5]*=d;b[9]*=a;b[2]*=c;b[6]*=d;b[10]*=a;b[3]*=c;b[7]*=d;b[11]*=a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10]))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},makeRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,
0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b);b=Math.sin(b);var d=1-c,f=a.x,g=a.y;a=a.z;var h=d*f,l=d*g;this.set(h*f+c,h*g-b*a,h*a+b*g,0,h*g+b*a,l*g+c,l*a-b*f,0,h*a-b*g,l*a+b*f,d*a*a+c,0,0,0,0,1);return this},makeScale:function(a,
b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeShear:function(a,b,c){this.set(1,b,c,0,a,1,c,0,a,b,1,0,0,0,0,1);return this},compose:function(a,b,c){var d=this.elements,f=b._x,g=b._y,h=b._z,l=b._w,m=f+f,q=g+g,u=h+h;b=f*m;var w=f*q;f*=u;var y=g*q;g*=u;h*=u;m*=l;q*=l;l*=u;u=c.x;var C=c.y;c=c.z;d[0]=(1-(y+h))*u;d[1]=(w+l)*u;d[2]=(f-q)*u;d[3]=0;d[4]=(w-l)*C;d[5]=(1-(b+h))*C;d[6]=(g+m)*C;d[7]=0;d[8]=(f+q)*c;d[9]=(g-m)*c;d[10]=(1-(b+y))*c;d[11]=0;d[12]=a.x;d[13]=a.y;d[14]=a.z;d[15]=1;return this},
decompose:function(a,b,c){var d=this.elements,f=fc.set(d[0],d[1],d[2]).length(),g=fc.set(d[4],d[5],d[6]).length(),h=fc.set(d[8],d[9],d[10]).length();0>this.determinant()&&(f=-f);a.x=d[12];a.y=d[13];a.z=d[14];Bb.copy(this);a=1/f;d=1/g;var l=1/h;Bb.elements[0]*=a;Bb.elements[1]*=a;Bb.elements[2]*=a;Bb.elements[4]*=d;Bb.elements[5]*=d;Bb.elements[6]*=d;Bb.elements[8]*=l;Bb.elements[9]*=l;Bb.elements[10]*=l;b.setFromRotationMatrix(Bb);c.x=f;c.y=g;c.z=h;return this},makePerspective:function(a,b,c,d,f,
g){void 0===g&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var h=this.elements;h[0]=2*f/(b-a);h[4]=0;h[8]=(b+a)/(b-a);h[12]=0;h[1]=0;h[5]=2*f/(c-d);h[9]=(c+d)/(c-d);h[13]=0;h[2]=0;h[6]=0;h[10]=-(g+f)/(g-f);h[14]=-2*g*f/(g-f);h[3]=0;h[7]=0;h[11]=-1;h[15]=0;return this},makeOrthographic:function(a,b,c,d,f,g){var h=this.elements,l=1/(b-a),m=1/(c-d),q=1/(g-f);h[0]=2*l;h[4]=0;h[8]=0;h[12]=-((b+a)*l);h[1]=0;h[5]=2*m;h[9]=0;h[13]=-((c+
d)*m);h[2]=0;h[6]=0;h[10]=-2*q;h[14]=-((g+f)*q);h[3]=0;h[7]=0;h[11]=0;h[15]=1;return this},equals:function(a){var b=this.elements;a=a.elements;for(var c=0;16>c;c++)if(b[c]!==a[c])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;16>c;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=
c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a}});var Bj=new A,Cj=new n;F.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" ");F.DefaultOrder="XYZ";Object.defineProperties(F.prototype,{x:{get:function(){return this._x},set:function(a){this._x=a;this._onChangeCallback()}},y:{get:function(){return this._y},set:function(a){this._y=a;this._onChangeCallback()}},z:{get:function(){return this._z},set:function(a){this._z=a;this._onChangeCallback()}},order:{get:function(){return this._order},
set:function(a){this._order=a;this._onChangeCallback()}}});Object.assign(F.prototype,{isEuler:!0,set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._order=d||this._order;this._onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(a){this._x=a._x;this._y=a._y;this._z=a._z;this._order=a._order;this._onChangeCallback();return this},setFromRotationMatrix:function(a,b,c){var d=Qa.clamp,f=a.elements;a=f[0];var g=f[4],h=f[8],
l=f[1],m=f[5],q=f[9],u=f[2],w=f[6];f=f[10];b=b||this._order;"XYZ"===b?(this._y=Math.asin(d(h,-1,1)),.9999999>Math.abs(h)?(this._x=Math.atan2(-q,f),this._z=Math.atan2(-g,a)):(this._x=Math.atan2(w,m),this._z=0)):"YXZ"===b?(this._x=Math.asin(-d(q,-1,1)),.9999999>Math.abs(q)?(this._y=Math.atan2(h,f),this._z=Math.atan2(l,m)):(this._y=Math.atan2(-u,a),this._z=0)):"ZXY"===b?(this._x=Math.asin(d(w,-1,1)),.9999999>Math.abs(w)?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-g,m)):(this._y=0,this._z=Math.atan2(l,
a))):"ZYX"===b?(this._y=Math.asin(-d(u,-1,1)),.9999999>Math.abs(u)?(this._x=Math.atan2(w,f),this._z=Math.atan2(l,a)):(this._x=0,this._z=Math.atan2(-g,m))):"YZX"===b?(this._z=Math.asin(d(l,-1,1)),.9999999>Math.abs(l)?(this._x=Math.atan2(-q,m),this._y=Math.atan2(-u,a)):(this._x=0,this._y=Math.atan2(h,f))):"XZY"===b?(this._z=Math.asin(-d(g,-1,1)),.9999999>Math.abs(g)?(this._x=Math.atan2(w,m),this._y=Math.atan2(h,a)):(this._x=Math.atan2(-q,f),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+
b);this._order=b;!1!==c&&this._onChangeCallback();return this},setFromQuaternion:function(a,b,c){Bj.makeRotationFromQuaternion(a);return this.setFromRotationMatrix(Bj,b,c)},setFromVector3:function(a,b){return this.set(a.x,a.y,a.z,b||this._order)},reorder:function(a){Cj.setFromEuler(this);return this.setFromQuaternion(Cj,a)},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},fromArray:function(a){this._x=a[0];this._y=a[1];this._z=a[2];void 0!==a[3]&&(this._order=
a[3]);this._onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._order;return a},toVector3:function(a){return a?a.set(this._x,this._y,this._z):new p(this._x,this._y,this._z)},_onChange:function(a){this._onChangeCallback=a;return this},_onChangeCallback:function(){}});Object.assign(N.prototype,{set:function(a){this.mask=1<<a|0},enable:function(a){this.mask=this.mask|1<<a|0},enableAll:function(){this.mask=
-1},toggle:function(a){this.mask^=1<<a|0},disable:function(a){this.mask&=~(1<<a|0)},disableAll:function(){this.mask=0},test:function(a){return 0!==(this.mask&a.mask)}});var ik=0,Dj=new p,Se=new n,$c=new A,Rg=new p,Vf=new p,Ul=new p,Vl=new n,Ej=new p(1,0,0),Fj=new p(0,1,0),Gj=new p(0,0,1),Wl={type:"added"},Xl={type:"removed"};I.DefaultUp=new p(0,1,0);I.DefaultMatrixAutoUpdate=!0;I.prototype=Object.assign(Object.create(r.prototype),{constructor:I,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},
applyMatrix:function(a){this.matrixAutoUpdate&&this.updateMatrix();this.matrix.premultiply(a);this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(a){this.quaternion.premultiply(a);return this},setRotationFromAxisAngle:function(a,b){this.quaternion.setFromAxisAngle(a,b)},setRotationFromEuler:function(a){this.quaternion.setFromEuler(a,!0)},setRotationFromMatrix:function(a){this.quaternion.setFromRotationMatrix(a)},setRotationFromQuaternion:function(a){this.quaternion.copy(a)},
rotateOnAxis:function(a,b){Se.setFromAxisAngle(a,b);this.quaternion.multiply(Se);return this},rotateOnWorldAxis:function(a,b){Se.setFromAxisAngle(a,b);this.quaternion.premultiply(Se);return this},rotateX:function(a){return this.rotateOnAxis(Ej,a)},rotateY:function(a){return this.rotateOnAxis(Fj,a)},rotateZ:function(a){return this.rotateOnAxis(Gj,a)},translateOnAxis:function(a,b){Dj.copy(a).applyQuaternion(this.quaternion);this.position.add(Dj.multiplyScalar(b));return this},translateX:function(a){return this.translateOnAxis(Ej,
a)},translateY:function(a){return this.translateOnAxis(Fj,a)},translateZ:function(a){return this.translateOnAxis(Gj,a)},localToWorld:function(a){return a.applyMatrix4(this.matrixWorld)},worldToLocal:function(a){return a.applyMatrix4($c.getInverse(this.matrixWorld))},lookAt:function(a,b,c){a.isVector3?Rg.copy(a):Rg.set(a,b,c);a=this.parent;this.updateWorldMatrix(!0,!1);Vf.setFromMatrixPosition(this.matrixWorld);this.isCamera||this.isLight?$c.lookAt(Vf,Rg,this.up):$c.lookAt(Rg,Vf,this.up);this.quaternion.setFromRotationMatrix($c);
a&&($c.extractRotation(a.matrixWorld),Se.setFromRotationMatrix($c),this.quaternion.premultiply(Se.inverse()))},add:function(a){if(1<arguments.length){for(var b=0;b<arguments.length;b++)this.add(arguments[b]);return this}if(a===this)return console.error("THREE.Object3D.add: object can't be added as a child of itself.",a),this;a&&a.isObject3D?(null!==a.parent&&a.parent.remove(a),a.parent=this,this.children.push(a),a.dispatchEvent(Wl)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",
a);return this},remove:function(a){if(1<arguments.length){for(var b=0;b<arguments.length;b++)this.remove(arguments[b]);return this}b=this.children.indexOf(a);-1!==b&&(a.parent=null,this.children.splice(b,1),a.dispatchEvent(Xl));return this},attach:function(a){this.updateWorldMatrix(!0,!1);$c.getInverse(this.matrixWorld);null!==a.parent&&(a.parent.updateWorldMatrix(!0,!1),$c.multiply(a.parent.matrixWorld));a.applyMatrix($c);a.updateWorldMatrix(!1,!1);this.add(a);return this},getObjectById:function(a){return this.getObjectByProperty("id",
a)},getObjectByName:function(a){return this.getObjectByProperty("name",a)},getObjectByProperty:function(a,b){if(this[a]===b)return this;for(var c=0,d=this.children.length;c<d;c++){var f=this.children[c].getObjectByProperty(a,b);if(void 0!==f)return f}},getWorldPosition:function(a){void 0===a&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),a=new p);this.updateMatrixWorld(!0);return a.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(a){void 0===a&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),
a=new n);this.updateMatrixWorld(!0);this.matrixWorld.decompose(Vf,a,Ul);return a},getWorldScale:function(a){void 0===a&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),a=new p);this.updateMatrixWorld(!0);this.matrixWorld.decompose(Vf,Vl,a);return a},getWorldDirection:function(a){void 0===a&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),a=new p);this.updateMatrixWorld(!0);var b=this.matrixWorld.elements;return a.set(b[8],b[9],b[10]).normalize()},
raycast:function(){},traverse:function(a){a(this);for(var b=this.children,c=0,d=b.length;c<d;c++)b[c].traverse(a)},traverseVisible:function(a){if(!1!==this.visible){a(this);for(var b=this.children,c=0,d=b.length;c<d;c++)b[c].traverseVisible(a)}},traverseAncestors:function(a){var b=this.parent;null!==b&&(a(b),b.traverseAncestors(a))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale);this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=this.children,c=0,d=b.length;c<d;c++)b[c].updateMatrixWorld(a)},updateWorldMatrix:function(a,b){var c=this.parent;!0===a&&null!==c&&c.updateWorldMatrix(!0,!1);this.matrixAutoUpdate&&this.updateMatrix();null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,
this.matrix);if(!0===b)for(a=this.children,b=0,c=a.length;b<c;b++)a[b].updateWorldMatrix(!1,!0)},toJSON:function(a){function b(u,w){void 0===u[w.uuid]&&(u[w.uuid]=w.toJSON(a));return w.uuid}function c(u){var w=[],y;for(y in u){var C=u[y];delete C.metadata;w.push(C)}return w}var d=void 0===a||"string"===typeof a,f={};d&&(a={geometries:{},materials:{},textures:{},images:{},shapes:{}},f.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var g={};g.uuid=this.uuid;g.type=this.type;""!==
this.name&&(g.name=this.name);!0===this.castShadow&&(g.castShadow=!0);!0===this.receiveShadow&&(g.receiveShadow=!0);!1===this.visible&&(g.visible=!1);!1===this.frustumCulled&&(g.frustumCulled=!1);0!==this.renderOrder&&(g.renderOrder=this.renderOrder);"{}"!==JSON.stringify(this.userData)&&(g.userData=this.userData);g.layers=this.layers.mask;g.matrix=this.matrix.toArray();!1===this.matrixAutoUpdate&&(g.matrixAutoUpdate=!1);this.isMesh&&0!==this.drawMode&&(g.drawMode=this.drawMode);if(this.isMesh||this.isLine||
this.isPoints){g.geometry=b(a.geometries,this.geometry);var h=this.geometry.parameters;if(void 0!==h&&void 0!==h.shapes)if(h=h.shapes,Array.isArray(h))for(var l=0,m=h.length;l<m;l++)b(a.shapes,h[l]);else b(a.shapes,h)}if(void 0!==this.material)if(Array.isArray(this.material)){h=[];l=0;for(m=this.material.length;l<m;l++)h.push(b(a.materials,this.material[l]));g.material=h}else g.material=b(a.materials,this.material);if(0<this.children.length)for(g.children=[],l=0;l<this.children.length;l++)g.children.push(this.children[l].toJSON(a).object);
if(d){d=c(a.geometries);l=c(a.materials);m=c(a.textures);var q=c(a.images);h=c(a.shapes);0<d.length&&(f.geometries=d);0<l.length&&(f.materials=l);0<m.length&&(f.textures=m);0<q.length&&(f.images=q);0<h.length&&(f.shapes=h)}f.object=g;return f},clone:function(a){return(new this.constructor).copy(this,a)},copy:function(a,b){void 0===b&&(b=!0);this.name=a.name;this.up.copy(a.up);this.position.copy(a.position);this.quaternion.copy(a.quaternion);this.scale.copy(a.scale);this.matrix.copy(a.matrix);this.matrixWorld.copy(a.matrixWorld);
this.matrixAutoUpdate=a.matrixAutoUpdate;this.matrixWorldNeedsUpdate=a.matrixWorldNeedsUpdate;this.layers.mask=a.layers.mask;this.visible=a.visible;this.castShadow=a.castShadow;this.receiveShadow=a.receiveShadow;this.frustumCulled=a.frustumCulled;this.renderOrder=a.renderOrder;this.userData=JSON.parse(JSON.stringify(a.userData));if(!0===b)for(b=0;b<a.children.length;b++)this.add(a.children[b].clone());return this}});aa.prototype=Object.assign(Object.create(I.prototype),{constructor:aa,isScene:!0,
copy:function(a,b){I.prototype.copy.call(this,a,b);null!==a.background&&(this.background=a.background.clone());null!==a.fog&&(this.fog=a.fog.clone());null!==a.overrideMaterial&&(this.overrideMaterial=a.overrideMaterial.clone());this.autoUpdate=a.autoUpdate;this.matrixAutoUpdate=a.matrixAutoUpdate;return this},toJSON:function(a){var b=I.prototype.toJSON.call(this,a);null!==this.background&&(b.object.background=this.background.toJSON(a));null!==this.fog&&(b.object.fog=this.fog.toJSON());return b},dispose:function(){this.dispatchEvent({type:"dispose"})}});
var ad=[new p,new p,new p,new p,new p,new p,new p,new p],Oc=new p,Te=new p,Ue=new p,Ve=new p,td=new p,ud=new p,Td=new p,Wf=new p,Sg=new p,Tg=new p,xd=new p;Object.assign(G.prototype,{isBox3:!0,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromArray:function(a){for(var b=Infinity,c=Infinity,d=Infinity,f=-Infinity,g=-Infinity,h=-Infinity,l=0,m=a.length;l<m;l+=3){var q=a[l],u=a[l+1],w=a[l+2];q<b&&(b=q);u<c&&(c=u);w<d&&(d=w);q>f&&(f=q);u>g&&(g=u);w>h&&(h=w)}this.min.set(b,c,d);this.max.set(f,
g,h);return this},setFromBufferAttribute:function(a){for(var b=Infinity,c=Infinity,d=Infinity,f=-Infinity,g=-Infinity,h=-Infinity,l=0,m=a.count;l<m;l++){var q=a.getX(l),u=a.getY(l),w=a.getZ(l);q<b&&(b=q);u<c&&(c=u);w<d&&(d=w);q>f&&(f=q);u>g&&(g=u);w>h&&(h=w)}this.min.set(b,c,d);this.max.set(f,g,h);return this},setFromPoints:function(a){this.makeEmpty();for(var b=0,c=a.length;b<c;b++)this.expandByPoint(a[b]);return this},setFromCenterAndSize:function(a,b){b=Oc.copy(b).multiplyScalar(.5);this.min.copy(a).sub(b);
this.max.copy(a).add(b);return this},setFromObject:function(a){this.makeEmpty();return this.expandByObject(a)},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.min.copy(a.min);this.max.copy(a.max);return this},makeEmpty:function(){this.min.x=this.min.y=this.min.z=Infinity;this.max.x=this.max.y=this.max.z=-Infinity;return this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(a){void 0===a&&(console.warn("THREE.Box3: .getCenter() target is now required"),
a=new p);return this.isEmpty()?a.set(0,0,0):a.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(a){void 0===a&&(console.warn("THREE.Box3: .getSize() target is now required"),a=new p);return this.isEmpty()?a.set(0,0,0):a.subVectors(this.max,this.min)},expandByPoint:function(a){this.min.min(a);this.max.max(a);return this},expandByVector:function(a){this.min.sub(a);this.max.add(a);return this},expandByScalar:function(a){this.min.addScalar(-a);this.max.addScalar(a);return this},expandByObject:function(a){var b;
a.updateWorldMatrix(!1,!1);var c=a.geometry;if(void 0!==c)if(c.isGeometry){var d=c.vertices;c=0;for(b=d.length;c<b;c++)Oc.copy(d[c]),Oc.applyMatrix4(a.matrixWorld),this.expandByPoint(Oc)}else if(c.isBufferGeometry&&(d=c.attributes.position,void 0!==d))for(c=0,b=d.count;c<b;c++)Oc.fromBufferAttribute(d,c).applyMatrix4(a.matrixWorld),this.expandByPoint(Oc);a=a.children;c=0;for(b=a.length;c<b;c++)this.expandByObject(a[c]);return this},containsPoint:function(a){return a.x<this.min.x||a.x>this.max.x||
a.y<this.min.y||a.y>this.max.y||a.z<this.min.z||a.z>this.max.z?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z},getParameter:function(a,b){void 0===b&&(console.warn("THREE.Box3: .getParameter() target is now required"),b=new p);return b.set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(a){return a.max.x<
this.min.x||a.min.x>this.max.x||a.max.y<this.min.y||a.min.y>this.max.y||a.max.z<this.min.z||a.min.z>this.max.z?!1:!0},intersectsSphere:function(a){this.clampPoint(a.center,Oc);return Oc.distanceToSquared(a.center)<=a.radius*a.radius},intersectsPlane:function(a){if(0<a.normal.x){var b=a.normal.x*this.min.x;var c=a.normal.x*this.max.x}else b=a.normal.x*this.max.x,c=a.normal.x*this.min.x;0<a.normal.y?(b+=a.normal.y*this.min.y,c+=a.normal.y*this.max.y):(b+=a.normal.y*this.max.y,c+=a.normal.y*this.min.y);
0<a.normal.z?(b+=a.normal.z*this.min.z,c+=a.normal.z*this.max.z):(b+=a.normal.z*this.max.z,c+=a.normal.z*this.min.z);return b<=-a.constant&&c>=-a.constant},intersectsTriangle:function(a){if(this.isEmpty())return!1;this.getCenter(Wf);Sg.subVectors(this.max,Wf);Te.subVectors(a.a,Wf);Ue.subVectors(a.b,Wf);Ve.subVectors(a.c,Wf);td.subVectors(Ue,Te);ud.subVectors(Ve,Ue);Td.subVectors(Te,Ve);a=[0,-td.z,td.y,0,-ud.z,ud.y,0,-Td.z,Td.y,td.z,0,-td.x,ud.z,0,-ud.x,Td.z,0,-Td.x,-td.y,td.x,0,-ud.y,ud.x,0,-Td.y,
Td.x,0];if(!P(a,Te,Ue,Ve,Sg))return!1;a=[1,0,0,0,1,0,0,0,1];if(!P(a,Te,Ue,Ve,Sg))return!1;Tg.crossVectors(td,ud);a=[Tg.x,Tg.y,Tg.z];return P(a,Te,Ue,Ve,Sg)},clampPoint:function(a,b){void 0===b&&(console.warn("THREE.Box3: .clampPoint() target is now required"),b=new p);return b.copy(a).clamp(this.min,this.max)},distanceToPoint:function(a){return Oc.copy(a).clamp(this.min,this.max).sub(a).length()},getBoundingSphere:function(a){void 0===a&&console.error("THREE.Box3: .getBoundingSphere() target is now required");
this.getCenter(a.center);a.radius=.5*this.getSize(Oc).length();return a},intersect:function(a){this.min.max(a.min);this.max.min(a.max);this.isEmpty()&&this.makeEmpty();return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},applyMatrix4:function(a){if(this.isEmpty())return this;ad[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(a);ad[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(a);ad[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(a);ad[3].set(this.min.x,
this.max.y,this.max.z).applyMatrix4(a);ad[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(a);ad[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(a);ad[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(a);ad[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(a);this.setFromPoints(ad);return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}});var Yl=new G;Object.assign(U.prototype,{set:function(a,
b){this.center.copy(a);this.radius=b;return this},setFromPoints:function(a,b){var c=this.center;void 0!==b?c.copy(b):Yl.setFromPoints(a).getCenter(c);for(var d=b=0,f=a.length;d<f;d++)b=Math.max(b,c.distanceToSquared(a[d]));this.radius=Math.sqrt(b);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.center.copy(a.center);this.radius=a.radius;return this},empty:function(){return 0>=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=
this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},intersectsBox:function(a){return a.intersectsSphere(this)},intersectsPlane:function(a){return Math.abs(a.distanceToPoint(this.center))<=this.radius},clampPoint:function(a,b){var c=this.center.distanceToSquared(a);void 0===b&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),
b=new p);b.copy(a);c>this.radius*this.radius&&(b.sub(this.center).normalize(),b.multiplyScalar(this.radius).add(this.center));return b},getBoundingBox:function(a){void 0===a&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),a=new G);a.set(this.center,this.center);a.expandByScalar(this.radius);return a},applyMatrix4:function(a){this.center.applyMatrix4(a);this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&
a.radius===this.radius}});var bd=new p,di=new p,Ug=new p,vd=new p,ei=new p,Vg=new p,fi=new p;Object.assign(ba.prototype,{set:function(a,b){this.origin.copy(a);this.direction.copy(b);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.origin.copy(a.origin);this.direction.copy(a.direction);return this},at:function(a,b){void 0===b&&(console.warn("THREE.Ray: .at() target is now required"),b=new p);return b.copy(this.direction).multiplyScalar(a).add(this.origin)},
lookAt:function(a){this.direction.copy(a).sub(this.origin).normalize();return this},recast:function(a){this.origin.copy(this.at(a,bd));return this},closestPointToPoint:function(a,b){void 0===b&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),b=new p);b.subVectors(a,this.origin);a=b.dot(this.direction);return 0>a?b.copy(this.origin):b.copy(this.direction).multiplyScalar(a).add(this.origin)},distanceToPoint:function(a){return Math.sqrt(this.distanceSqToPoint(a))},distanceSqToPoint:function(a){var b=
bd.subVectors(a,this.origin).dot(this.direction);if(0>b)return this.origin.distanceToSquared(a);bd.copy(this.direction).multiplyScalar(b).add(this.origin);return bd.distanceToSquared(a)},distanceSqToSegment:function(a,b,c,d){di.copy(a).add(b).multiplyScalar(.5);Ug.copy(b).sub(a).normalize();vd.copy(this.origin).sub(di);var f=.5*a.distanceTo(b),g=-this.direction.dot(Ug),h=vd.dot(this.direction),l=-vd.dot(Ug),m=vd.lengthSq(),q=Math.abs(1-g*g);if(0<q){a=g*l-h;b=g*h-l;var u=f*q;0<=a?b>=-u?b<=u?(f=1/q,
a*=f,b*=f,g=a*(a+g*b+2*h)+b*(g*a+b+2*l)+m):(b=f,a=Math.max(0,-(g*b+h)),g=-a*a+b*(b+2*l)+m):(b=-f,a=Math.max(0,-(g*b+h)),g=-a*a+b*(b+2*l)+m):b<=-u?(a=Math.max(0,-(-g*f+h)),b=0<a?-f:Math.min(Math.max(-f,-l),f),g=-a*a+b*(b+2*l)+m):b<=u?(a=0,b=Math.min(Math.max(-f,-l),f),g=b*(b+2*l)+m):(a=Math.max(0,-(g*f+h)),b=0<a?f:Math.min(Math.max(-f,-l),f),g=-a*a+b*(b+2*l)+m)}else b=0<g?-f:f,a=Math.max(0,-(g*b+h)),g=-a*a+b*(b+2*l)+m;c&&c.copy(this.direction).multiplyScalar(a).add(this.origin);d&&d.copy(Ug).multiplyScalar(b).add(di);
return g},intersectSphere:function(a,b){bd.subVectors(a.center,this.origin);var c=bd.dot(this.direction),d=bd.dot(bd)-c*c;a=a.radius*a.radius;if(d>a)return null;a=Math.sqrt(a-d);d=c-a;c+=a;return 0>d&&0>c?null:0>d?this.at(c,b):this.at(d,b)},intersectsSphere:function(a){return this.distanceSqToPoint(a.center)<=a.radius*a.radius},distanceToPlane:function(a){var b=a.normal.dot(this.direction);if(0===b)return 0===a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+a.constant)/b;return 0<=
a?a:null},intersectPlane:function(a,b){a=this.distanceToPlane(a);return null===a?null:this.at(a,b)},intersectsPlane:function(a){var b=a.distanceToPoint(this.origin);return 0===b||0>a.normal.dot(this.direction)*b?!0:!1},intersectBox:function(a,b){var c=1/this.direction.x;var d=1/this.direction.y;var f=1/this.direction.z,g=this.origin;if(0<=c){var h=(a.min.x-g.x)*c;c*=a.max.x-g.x}else h=(a.max.x-g.x)*c,c*=a.min.x-g.x;if(0<=d){var l=(a.min.y-g.y)*d;d*=a.max.y-g.y}else l=(a.max.y-g.y)*d,d*=a.min.y-g.y;
if(h>d||l>c)return null;if(l>h||h!==h)h=l;if(d<c||c!==c)c=d;0<=f?(l=(a.min.z-g.z)*f,a=(a.max.z-g.z)*f):(l=(a.max.z-g.z)*f,a=(a.min.z-g.z)*f);if(h>a||l>c)return null;if(l>h||h!==h)h=l;if(a<c||c!==c)c=a;return 0>c?null:this.at(0<=h?h:c,b)},intersectsBox:function(a){return null!==this.intersectBox(a,bd)},intersectTriangle:function(a,b,c,d,f){ei.subVectors(b,a);Vg.subVectors(c,a);fi.crossVectors(ei,Vg);b=this.direction.dot(fi);if(0<b){if(d)return null;d=1}else if(0>b)d=-1,b=-b;else return null;vd.subVectors(this.origin,
a);a=d*this.direction.dot(Vg.crossVectors(vd,Vg));if(0>a)return null;c=d*this.direction.dot(ei.cross(vd));if(0>c||a+c>b)return null;a=-d*vd.dot(fi);return 0>a?null:this.at(a/b,f)},applyMatrix4:function(a){this.origin.applyMatrix4(a);this.direction.transformDirection(a);return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)}});var yc=new p,cd=new p,gi=new p,dd=new p,We=new p,Xe=new p,Hj=new p,hi=new p,ii=new p,ji=new p;Object.assign(ja,{getNormal:function(a,
b,c,d){void 0===d&&(console.warn("THREE.Triangle: .getNormal() target is now required"),d=new p);d.subVectors(c,b);yc.subVectors(a,b);d.cross(yc);a=d.lengthSq();return 0<a?d.multiplyScalar(1/Math.sqrt(a)):d.set(0,0,0)},getBarycoord:function(a,b,c,d,f){yc.subVectors(d,b);cd.subVectors(c,b);gi.subVectors(a,b);a=yc.dot(yc);b=yc.dot(cd);c=yc.dot(gi);var g=cd.dot(cd);d=cd.dot(gi);var h=a*g-b*b;void 0===f&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),f=new p);if(0===h)return f.set(-2,
-1,-1);h=1/h;g=(g*c-b*d)*h;a=(a*d-b*c)*h;return f.set(1-g-a,a,g)},containsPoint:function(a,b,c,d){ja.getBarycoord(a,b,c,d,dd);return 0<=dd.x&&0<=dd.y&&1>=dd.x+dd.y},getUV:function(a,b,c,d,f,g,h,l){this.getBarycoord(a,b,c,d,dd);l.set(0,0);l.addScaledVector(f,dd.x);l.addScaledVector(g,dd.y);l.addScaledVector(h,dd.z);return l},isFrontFacing:function(a,b,c,d){yc.subVectors(c,b);cd.subVectors(a,b);return 0>yc.cross(cd).dot(d)?!0:!1}});Object.assign(ja.prototype,{set:function(a,b,c){this.a.copy(a);this.b.copy(b);
this.c.copy(c);return this},setFromPointsAndIndices:function(a,b,c,d){this.a.copy(a[b]);this.b.copy(a[c]);this.c.copy(a[d]);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this},getArea:function(){yc.subVectors(this.c,this.b);cd.subVectors(this.a,this.b);return.5*yc.cross(cd).length()},getMidpoint:function(a){void 0===a&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),a=new p);
return a.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(a){return ja.getNormal(this.a,this.b,this.c,a)},getPlane:function(a){void 0===a&&(console.warn("THREE.Triangle: .getPlane() target is now required"),a=new p);return a.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(a,b){return ja.getBarycoord(a,this.a,this.b,this.c,b)},getUV:function(a,b,c,d,f){return ja.getUV(a,this.a,this.b,this.c,b,c,d,f)},containsPoint:function(a){return ja.containsPoint(a,
this.a,this.b,this.c)},isFrontFacing:function(a){return ja.isFrontFacing(this.a,this.b,this.c,a)},intersectsBox:function(a){return a.intersectsTriangle(this)},closestPointToPoint:function(a,b){void 0===b&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),b=new p);var c=this.a,d=this.b,f=this.c;We.subVectors(d,c);Xe.subVectors(f,c);hi.subVectors(a,c);var g=We.dot(hi),h=Xe.dot(hi);if(0>=g&&0>=h)return b.copy(c);ii.subVectors(a,d);var l=We.dot(ii),m=Xe.dot(ii);if(0<=l&&m<=
l)return b.copy(d);var q=g*m-l*h;if(0>=q&&0<=g&&0>=l)return d=g/(g-l),b.copy(c).addScaledVector(We,d);ji.subVectors(a,f);a=We.dot(ji);var u=Xe.dot(ji);if(0<=u&&a<=u)return b.copy(f);g=a*h-g*u;if(0>=g&&0<=h&&0>=u)return q=h/(h-u),b.copy(c).addScaledVector(Xe,q);h=l*u-a*m;if(0>=h&&0<=m-l&&0<=a-u)return Hj.subVectors(f,d),q=(m-l)/(m-l+(a-u)),b.copy(d).addScaledVector(Hj,q);f=1/(h+g+q);d=g*f;q*=f;return b.copy(c).addScaledVector(We,d).addScaledVector(Xe,q)},equals:function(a){return a.a.equals(this.a)&&
a.b.equals(this.b)&&a.c.equals(this.c)}});var Zl={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},Zb={h:0,s:0,l:0},Wg={h:0,s:0,l:0};Object.assign(ca.prototype,{isColor:!0,r:1,g:1,b:1,set:function(a){a&&a.isColor?this.copy(a):"number"===typeof a?this.setHex(a):"string"===typeof a&&this.setStyle(a);return this},setScalar:function(a){this.b=this.g=this.r=a;return this},setHex:function(a){a=Math.floor(a);
this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSL:function(a,b,c){a=Qa.euclideanModulo(a,1);b=Qa.clamp(b,0,1);c=Qa.clamp(c,0,1);0===b?this.r=this.g=this.b=c:(b=.5>=c?c*(1+b):c+b-c*b,c=2*c-b,this.r=ya(c,b,a+1/3),this.g=ya(c,b,a),this.b=ya(c,b,a-1/3));return this},setStyle:function(a){function b(h){void 0!==h&&1>parseFloat(h)&&console.warn("THREE.Color: Alpha component of "+a+" will be ignored.")}var c;
if(c=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(a)){var d=c[2];switch(c[1]){case "rgb":case "rgba":if(c=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(255,parseInt(c[1],10))/255,this.g=Math.min(255,parseInt(c[2],10))/255,this.b=Math.min(255,parseInt(c[3],10))/255,b(c[5]),this;if(c=/^(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(100,parseInt(c[1],10))/100,this.g=Math.min(100,parseInt(c[2],10))/100,this.b=
Math.min(100,parseInt(c[3],10))/100,b(c[5]),this;break;case "hsl":case "hsla":if(c=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d)){d=parseFloat(c[1])/360;var f=parseInt(c[2],10)/100,g=parseInt(c[3],10)/100;b(c[5]);return this.setHSL(d,f,g)}}}else if(c=/^#([A-Fa-f0-9]+)$/.exec(a)){c=c[1];d=c.length;if(3===d)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;
if(6===d)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}a&&0<a.length&&(c=Zl[a],void 0!==c?this.setHex(c):console.warn("THREE.Color: Unknown color "+a));return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a,b){void 0===b&&(b=2);this.r=Math.pow(a.r,b);this.g=Math.pow(a.g,b);
this.b=Math.pow(a.b,b);return this},copyLinearToGamma:function(a,b){void 0===b&&(b=2);b=0<b?1/b:1;this.r=Math.pow(a.r,b);this.g=Math.pow(a.g,b);this.b=Math.pow(a.b,b);return this},convertGammaToLinear:function(a){this.copyGammaToLinear(this,a);return this},convertLinearToGamma:function(a){this.copyLinearToGamma(this,a);return this},copySRGBToLinear:function(a){this.r=Na(a.r);this.g=Na(a.g);this.b=Na(a.b);return this},copyLinearToSRGB:function(a){this.r=$a(a.r);this.g=$a(a.g);this.b=$a(a.b);return this},
convertSRGBToLinear:function(){this.copySRGBToLinear(this);return this},convertLinearToSRGB:function(){this.copyLinearToSRGB(this);return 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(a){void 0===a&&(console.warn("THREE.Color: .getHSL() target is now required"),a={h:0,s:0,l:0});var b=this.r,c=this.g,d=this.b,f=Math.max(b,c,d),g=Math.min(b,c,d),h,l=(g+f)/2;if(g===f)g=h=0;else{var m=
f-g;g=.5>=l?m/(f+g):m/(2-f-g);switch(f){case b:h=(c-d)/m+(c<d?6:0);break;case c:h=(d-b)/m+2;break;case d:h=(b-c)/m+4}h/=6}a.h=h;a.s=g;a.l=l;return a},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(a,b,c){this.getHSL(Zb);Zb.h+=a;Zb.s+=b;Zb.l+=c;this.setHSL(Zb.h,Zb.s,Zb.l);return this},add:function(a){this.r+=a.r;this.g+=a.g;this.b+=a.b;return this},addColors:function(a,b){this.r=a.r+b.r;this.g=a.g+b.g;this.b=a.b+b.b;return this},addScalar:function(a){this.r+=
a;this.g+=a;this.b+=a;return this},sub:function(a){this.r=Math.max(0,this.r-a.r);this.g=Math.max(0,this.g-a.g);this.b=Math.max(0,this.b-a.b);return this},multiply:function(a){this.r*=a.r;this.g*=a.g;this.b*=a.b;return this},multiplyScalar:function(a){this.r*=a;this.g*=a;this.b*=a;return this},lerp:function(a,b){this.r+=(a.r-this.r)*b;this.g+=(a.g-this.g)*b;this.b+=(a.b-this.b)*b;return this},lerpHSL:function(a,b){this.getHSL(Zb);a.getHSL(Wg);a=Qa.lerp(Zb.h,Wg.h,b);var c=Qa.lerp(Zb.s,Wg.s,b);b=Qa.lerp(Zb.l,
Wg.l,b);this.setHSL(a,c,b);return this},equals:function(a){return a.r===this.r&&a.g===this.g&&a.b===this.b},fromArray:function(a,b){void 0===b&&(b=0);this.r=a[b];this.g=a[b+1];this.b=a[b+2];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.r;a[b+1]=this.g;a[b+2]=this.b;return a},toJSON:function(){return this.getHex()}});Object.assign(mb.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.a=a.a;this.b=a.b;this.c=a.c;this.normal.copy(a.normal);
this.color.copy(a.color);this.materialIndex=a.materialIndex;for(var b=0,c=a.vertexNormals.length;b<c;b++)this.vertexNormals[b]=a.vertexNormals[b].clone();b=0;for(c=a.vertexColors.length;b<c;b++)this.vertexColors[b]=a.vertexColors[b].clone();return this}});var jk=0;xa.prototype=Object.assign(Object.create(r.prototype),{constructor:xa,isMaterial:!0,onBeforeCompile:function(){},setValues:function(a){if(void 0!==a)for(var b in a){var c=a[b];if(void 0===c)console.warn("THREE.Material: '"+b+"' parameter is undefined.");
else if("shading"===b)console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===c?!0:!1;else{var d=this[b];void 0===d?console.warn("THREE."+this.type+": '"+b+"' is not a property of this material."):d&&d.isColor?d.set(c):d&&d.isVector3&&c&&c.isVector3?d.copy(c):this[b]=c}}},toJSON:function(a){function b(f){var g=[],h;for(h in f){var l=f[h];delete l.metadata;g.push(l)}return g}var c=void 0===a||"string"===typeof a;c&&(a={textures:{},
images:{}});var d={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};d.uuid=this.uuid;d.type=this.type;""!==this.name&&(d.name=this.name);this.color&&this.color.isColor&&(d.color=this.color.getHex());void 0!==this.roughness&&(d.roughness=this.roughness);void 0!==this.metalness&&(d.metalness=this.metalness);this.emissive&&this.emissive.isColor&&(d.emissive=this.emissive.getHex());this.emissiveIntensity&&1!==this.emissiveIntensity&&(d.emissiveIntensity=this.emissiveIntensity);this.specular&&
this.specular.isColor&&(d.specular=this.specular.getHex());void 0!==this.shininess&&(d.shininess=this.shininess);void 0!==this.clearcoat&&(d.clearcoat=this.clearcoat);void 0!==this.clearcoatRoughness&&(d.clearcoatRoughness=this.clearcoatRoughness);this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(d.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(a).uuid,d.clearcoatNormalScale=this.clearcoatNormalScale.toArray());this.map&&this.map.isTexture&&(d.map=this.map.toJSON(a).uuid);this.matcap&&
this.matcap.isTexture&&(d.matcap=this.matcap.toJSON(a).uuid);this.alphaMap&&this.alphaMap.isTexture&&(d.alphaMap=this.alphaMap.toJSON(a).uuid);this.lightMap&&this.lightMap.isTexture&&(d.lightMap=this.lightMap.toJSON(a).uuid);this.aoMap&&this.aoMap.isTexture&&(d.aoMap=this.aoMap.toJSON(a).uuid,d.aoMapIntensity=this.aoMapIntensity);this.bumpMap&&this.bumpMap.isTexture&&(d.bumpMap=this.bumpMap.toJSON(a).uuid,d.bumpScale=this.bumpScale);this.normalMap&&this.normalMap.isTexture&&(d.normalMap=this.normalMap.toJSON(a).uuid,
d.normalMapType=this.normalMapType,d.normalScale=this.normalScale.toArray());this.displacementMap&&this.displacementMap.isTexture&&(d.displacementMap=this.displacementMap.toJSON(a).uuid,d.displacementScale=this.displacementScale,d.displacementBias=this.displacementBias);this.roughnessMap&&this.roughnessMap.isTexture&&(d.roughnessMap=this.roughnessMap.toJSON(a).uuid);this.metalnessMap&&this.metalnessMap.isTexture&&(d.metalnessMap=this.metalnessMap.toJSON(a).uuid);this.emissiveMap&&this.emissiveMap.isTexture&&
(d.emissiveMap=this.emissiveMap.toJSON(a).uuid);this.specularMap&&this.specularMap.isTexture&&(d.specularMap=this.specularMap.toJSON(a).uuid);this.envMap&&this.envMap.isTexture&&(d.envMap=this.envMap.toJSON(a).uuid,d.reflectivity=this.reflectivity,d.refractionRatio=this.refractionRatio,void 0!==this.combine&&(d.combine=this.combine),void 0!==this.envMapIntensity&&(d.envMapIntensity=this.envMapIntensity));this.gradientMap&&this.gradientMap.isTexture&&(d.gradientMap=this.gradientMap.toJSON(a).uuid);
void 0!==this.size&&(d.size=this.size);void 0!==this.sizeAttenuation&&(d.sizeAttenuation=this.sizeAttenuation);1!==this.blending&&(d.blending=this.blending);!0===this.flatShading&&(d.flatShading=this.flatShading);0!==this.side&&(d.side=this.side);0!==this.vertexColors&&(d.vertexColors=this.vertexColors);1>this.opacity&&(d.opacity=this.opacity);!0===this.transparent&&(d.transparent=this.transparent);d.depthFunc=this.depthFunc;d.depthTest=this.depthTest;d.depthWrite=this.depthWrite;d.stencilWrite=this.stencilWrite;
d.stencilFunc=this.stencilFunc;d.stencilRef=this.stencilRef;d.stencilMask=this.stencilMask;d.stencilFail=this.stencilFail;d.stencilZFail=this.stencilZFail;d.stencilZPass=this.stencilZPass;this.rotation&&0!==this.rotation&&(d.rotation=this.rotation);!0===this.polygonOffset&&(d.polygonOffset=!0);0!==this.polygonOffsetFactor&&(d.polygonOffsetFactor=this.polygonOffsetFactor);0!==this.polygonOffsetUnits&&(d.polygonOffsetUnits=this.polygonOffsetUnits);this.linewidth&&1!==this.linewidth&&(d.linewidth=this.linewidth);
void 0!==this.dashSize&&(d.dashSize=this.dashSize);void 0!==this.gapSize&&(d.gapSize=this.gapSize);void 0!==this.scale&&(d.scale=this.scale);!0===this.dithering&&(d.dithering=!0);0<this.alphaTest&&(d.alphaTest=this.alphaTest);!0===this.premultipliedAlpha&&(d.premultipliedAlpha=this.premultipliedAlpha);!0===this.wireframe&&(d.wireframe=this.wireframe);1<this.wireframeLinewidth&&(d.wireframeLinewidth=this.wireframeLinewidth);"round"!==this.wireframeLinecap&&(d.wireframeLinecap=this.wireframeLinecap);
"round"!==this.wireframeLinejoin&&(d.wireframeLinejoin=this.wireframeLinejoin);!0===this.morphTargets&&(d.morphTargets=!0);!0===this.morphNormals&&(d.morphNormals=!0);!0===this.skinning&&(d.skinning=!0);!1===this.visible&&(d.visible=!1);!1===this.toneMapped&&(d.toneMapped=!1);"{}"!==JSON.stringify(this.userData)&&(d.userData=this.userData);c&&(c=b(a.textures),a=b(a.images),0<c.length&&(d.textures=c),0<a.length&&(d.images=a));return d},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.name=
a.name;this.fog=a.fog;this.lights=a.lights;this.blending=a.blending;this.side=a.side;this.flatShading=a.flatShading;this.vertexColors=a.vertexColors;this.opacity=a.opacity;this.transparent=a.transparent;this.blendSrc=a.blendSrc;this.blendDst=a.blendDst;this.blendEquation=a.blendEquation;this.blendSrcAlpha=a.blendSrcAlpha;this.blendDstAlpha=a.blendDstAlpha;this.blendEquationAlpha=a.blendEquationAlpha;this.depthFunc=a.depthFunc;this.depthTest=a.depthTest;this.depthWrite=a.depthWrite;this.stencilWrite=
a.stencilWrite;this.stencilFunc=a.stencilFunc;this.stencilRef=a.stencilRef;this.stencilMask=a.stencilMask;this.stencilFail=a.stencilFail;this.stencilZFail=a.stencilZFail;this.stencilZPass=a.stencilZPass;this.colorWrite=a.colorWrite;this.precision=a.precision;this.polygonOffset=a.polygonOffset;this.polygonOffsetFactor=a.polygonOffsetFactor;this.polygonOffsetUnits=a.polygonOffsetUnits;this.dithering=a.dithering;this.alphaTest=a.alphaTest;this.premultipliedAlpha=a.premultipliedAlpha;this.visible=a.visible;
this.toneMapped=a.toneMapped;this.userData=JSON.parse(JSON.stringify(a.userData));this.clipShadows=a.clipShadows;this.clipIntersection=a.clipIntersection;var b=a.clippingPlanes,c=null;if(null!==b){var d=b.length;c=Array(d);for(var f=0;f!==d;++f)c[f]=b[f].clone()}this.clippingPlanes=c;this.shadowSide=a.shadowSide;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});gb.prototype=Object.create(xa.prototype);gb.prototype.constructor=gb;gb.prototype.isMeshBasicMaterial=!0;gb.prototype.copy=
function(a){xa.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=
a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;return this};Object.defineProperty(Ea.prototype,"needsUpdate",{set:function(a){!0===a&&this.version++}});Object.assign(Ea.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setArray:function(a){if(Array.isArray(a))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==a?a.length/this.itemSize:0;this.array=a;return this},setDynamic:function(a){this.dynamic=a;return this},
copy:function(a){this.name=a.name;this.array=new a.array.constructor(a.array);this.itemSize=a.itemSize;this.count=a.count;this.normalized=a.normalized;this.dynamic=a.dynamic;return this},copyAt:function(a,b,c){a*=this.itemSize;c*=b.itemSize;for(var d=0,f=this.itemSize;d<f;d++)this.array[a+d]=b.array[c+d];return this},copyArray:function(a){this.array.set(a);return this},copyColorsArray:function(a){for(var b=this.array,c=0,d=0,f=a.length;d<f;d++){var g=a[d];void 0===g&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",
d),g=new ca);b[c++]=g.r;b[c++]=g.g;b[c++]=g.b}return this},copyVector2sArray:function(a){for(var b=this.array,c=0,d=0,f=a.length;d<f;d++){var g=a[d];void 0===g&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",d),g=new k);b[c++]=g.x;b[c++]=g.y}return this},copyVector3sArray:function(a){for(var b=this.array,c=0,d=0,f=a.length;d<f;d++){var g=a[d];void 0===g&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",d),g=new p);b[c++]=g.x;b[c++]=g.y;
b[c++]=g.z}return this},copyVector4sArray:function(a){for(var b=this.array,c=0,d=0,f=a.length;d<f;d++){var g=a[d];void 0===g&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",d),g=new E);b[c++]=g.x;b[c++]=g.y;b[c++]=g.z;b[c++]=g.w}return this},set:function(a,b){void 0===b&&(b=0);this.array.set(a,b);return this},getX:function(a){return this.array[a*this.itemSize]},setX:function(a,b){this.array[a*this.itemSize]=b;return this},getY:function(a){return this.array[a*this.itemSize+
1]},setY:function(a,b){this.array[a*this.itemSize+1]=b;return this},getZ:function(a){return this.array[a*this.itemSize+2]},setZ:function(a,b){this.array[a*this.itemSize+2]=b;return this},getW:function(a){return this.array[a*this.itemSize+3]},setW:function(a,b){this.array[a*this.itemSize+3]=b;return this},setXY:function(a,b,c){a*=this.itemSize;this.array[a+0]=b;this.array[a+1]=c;return this},setXYZ:function(a,b,c,d){a*=this.itemSize;this.array[a+0]=b;this.array[a+1]=c;this.array[a+2]=d;return this},
setXYZW:function(a,b,c,d,f){a*=this.itemSize;this.array[a+0]=b;this.array[a+1]=c;this.array[a+2]=d;this.array[a+3]=f;return this},onUpload:function(a){this.onUploadCallback=a;return this},clone:function(){return(new this.constructor(this.array,this.itemSize)).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}});Eb.prototype=Object.create(Ea.prototype);Eb.prototype.constructor=Eb;nb.prototype=
Object.create(Ea.prototype);nb.prototype.constructor=nb;Mb.prototype=Object.create(Ea.prototype);Mb.prototype.constructor=Mb;gc.prototype=Object.create(Ea.prototype);gc.prototype.constructor=gc;$b.prototype=Object.create(Ea.prototype);$b.prototype.constructor=$b;Bc.prototype=Object.create(Ea.prototype);Bc.prototype.constructor=Bc;Cb.prototype=Object.create(Ea.prototype);Cb.prototype.constructor=Cb;ia.prototype=Object.create(Ea.prototype);ia.prototype.constructor=ia;ub.prototype=Object.create(Ea.prototype);
ub.prototype.constructor=ub;Object.assign(S.prototype,{computeGroups:function(a){var b=[],c=void 0;a=a.faces;for(var d=0;d<a.length;d++){var f=a[d];if(f.materialIndex!==c){c=f.materialIndex;void 0!==g&&(g.count=3*d-g.start,b.push(g));var g={start:3*d,materialIndex:c}}}void 0!==g&&(g.count=3*d-g.start,b.push(g));this.groups=b},fromGeometry:function(a){var b=a.faces,c=a.vertices,d=a.faceVertexUvs,f=d[0]&&0<d[0].length,g=d[1]&&0<d[1].length,h=a.morphTargets,l=h.length;if(0<l){var m=[];for(var q=0;q<
l;q++)m[q]={name:h[q].name,data:[]};this.morphTargets.position=m}var u=a.morphNormals,w=u.length;if(0<w){var y=[];for(q=0;q<w;q++)y[q]={name:u[q].name,data:[]};this.morphTargets.normal=y}var C=a.skinIndices,D=a.skinWeights,K=C.length===c.length,J=D.length===c.length;0<c.length&&0===b.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(q=0;q<b.length;q++){var W=b[q];this.vertices.push(c[W.a],c[W.b],c[W.c]);var T=W.vertexNormals;3===T.length?this.normals.push(T[0],
T[1],T[2]):(T=W.normal,this.normals.push(T,T,T));T=W.vertexColors;3===T.length?this.colors.push(T[0],T[1],T[2]):(T=W.color,this.colors.push(T,T,T));!0===f&&(T=d[0][q],void 0!==T?this.uvs.push(T[0],T[1],T[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",q),this.uvs.push(new k,new k,new k)));!0===g&&(T=d[1][q],void 0!==T?this.uvs2.push(T[0],T[1],T[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",q),this.uvs2.push(new k,new k,new k)));for(T=0;T<
l;T++){var V=h[T].vertices;m[T].data.push(V[W.a],V[W.b],V[W.c])}for(T=0;T<w;T++)V=u[T].vertexNormals[q],y[T].data.push(V.a,V.b,V.c);K&&this.skinIndices.push(C[W.a],C[W.b],C[W.c]);J&&this.skinWeights.push(D[W.a],D[W.b],D[W.c])}this.computeGroups(a);this.verticesNeedUpdate=a.verticesNeedUpdate;this.normalsNeedUpdate=a.normalsNeedUpdate;this.colorsNeedUpdate=a.colorsNeedUpdate;this.uvsNeedUpdate=a.uvsNeedUpdate;this.groupsNeedUpdate=a.groupsNeedUpdate;null!==a.boundingSphere&&(this.boundingSphere=a.boundingSphere.clone());
null!==a.boundingBox&&(this.boundingBox=a.boundingBox.clone());return this}});var kk=1,Pc=new A,ki=new I,Xg=new p,Ud=new G,li=new G,zc=new p;la.prototype=Object.assign(Object.create(r.prototype),{constructor:la,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(a){this.index=Array.isArray(a)?new (65535<Qb(a)?Cb:$b)(a,1):a},addAttribute:function(a,b,c){if(!(b&&b.isBufferAttribute||b&&b.isInterleavedBufferAttribute))return console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),
this.addAttribute(a,new Ea(b,c));if("index"===a)return console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(b),this;this.attributes[a]=b;return this},getAttribute:function(a){return this.attributes[a]},removeAttribute:function(a){delete this.attributes[a];return this},addGroup:function(a,b,c){this.groups.push({start:a,count:b,materialIndex:void 0!==c?c:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(a,b){this.drawRange.start=a;this.drawRange.count=
b},applyMatrix:function(a){var b=this.attributes.position;void 0!==b&&(a.applyToBufferAttribute(b),b.needsUpdate=!0);var c=this.attributes.normal;void 0!==c&&(b=(new v).getNormalMatrix(a),b.applyToBufferAttribute(c),c.needsUpdate=!0);c=this.attributes.tangent;void 0!==c&&(b=(new v).getNormalMatrix(a),b.applyToBufferAttribute(c),c.needsUpdate=!0);null!==this.boundingBox&&this.computeBoundingBox();null!==this.boundingSphere&&this.computeBoundingSphere();return this},rotateX:function(a){Pc.makeRotationX(a);
this.applyMatrix(Pc);return this},rotateY:function(a){Pc.makeRotationY(a);this.applyMatrix(Pc);return this},rotateZ:function(a){Pc.makeRotationZ(a);this.applyMatrix(Pc);return this},translate:function(a,b,c){Pc.makeTranslation(a,b,c);this.applyMatrix(Pc);return this},scale:function(a,b,c){Pc.makeScale(a,b,c);this.applyMatrix(Pc);return this},lookAt:function(a){ki.lookAt(a);ki.updateMatrix();this.applyMatrix(ki.matrix);return this},center:function(){this.computeBoundingBox();this.boundingBox.getCenter(Xg).negate();
this.translate(Xg.x,Xg.y,Xg.z);return this},setFromObject:function(a){var b=a.geometry;if(a.isPoints||a.isLine){a=new ia(3*b.vertices.length,3);var c=new ia(3*b.colors.length,3);this.addAttribute("position",a.copyVector3sArray(b.vertices));this.addAttribute("color",c.copyColorsArray(b.colors));b.lineDistances&&b.lineDistances.length===b.vertices.length&&(a=new ia(b.lineDistances.length,1),this.addAttribute("lineDistance",a.copyArray(b.lineDistances)));null!==b.boundingSphere&&(this.boundingSphere=
b.boundingSphere.clone());null!==b.boundingBox&&(this.boundingBox=b.boundingBox.clone())}else a.isMesh&&b&&b.isGeometry&&this.fromGeometry(b);return this},setFromPoints:function(a){for(var b=[],c=0,d=a.length;c<d;c++){var f=a[c];b.push(f.x,f.y,f.z||0)}this.addAttribute("position",new ia(b,3));return this},updateFromObject:function(a){var b=a.geometry;if(a.isMesh){var c=b.__directGeometry;!0===b.elementsNeedUpdate&&(c=void 0,b.elementsNeedUpdate=!1);if(void 0===c)return this.fromGeometry(b);c.verticesNeedUpdate=
b.verticesNeedUpdate;c.normalsNeedUpdate=b.normalsNeedUpdate;c.colorsNeedUpdate=b.colorsNeedUpdate;c.uvsNeedUpdate=b.uvsNeedUpdate;c.groupsNeedUpdate=b.groupsNeedUpdate;b.verticesNeedUpdate=!1;b.normalsNeedUpdate=!1;b.colorsNeedUpdate=!1;b.uvsNeedUpdate=!1;b.groupsNeedUpdate=!1;b=c}!0===b.verticesNeedUpdate&&(c=this.attributes.position,void 0!==c&&(c.copyVector3sArray(b.vertices),c.needsUpdate=!0),b.verticesNeedUpdate=!1);!0===b.normalsNeedUpdate&&(c=this.attributes.normal,void 0!==c&&(c.copyVector3sArray(b.normals),
c.needsUpdate=!0),b.normalsNeedUpdate=!1);!0===b.colorsNeedUpdate&&(c=this.attributes.color,void 0!==c&&(c.copyColorsArray(b.colors),c.needsUpdate=!0),b.colorsNeedUpdate=!1);b.uvsNeedUpdate&&(c=this.attributes.uv,void 0!==c&&(c.copyVector2sArray(b.uvs),c.needsUpdate=!0),b.uvsNeedUpdate=!1);b.lineDistancesNeedUpdate&&(c=this.attributes.lineDistance,void 0!==c&&(c.copyArray(b.lineDistances),c.needsUpdate=!0),b.lineDistancesNeedUpdate=!1);b.groupsNeedUpdate&&(b.computeGroups(a.geometry),this.groups=
b.groups,b.groupsNeedUpdate=!1);return this},fromGeometry:function(a){a.__directGeometry=(new S).fromGeometry(a);return this.fromDirectGeometry(a.__directGeometry)},fromDirectGeometry:function(a){this.addAttribute("position",(new Ea(new Float32Array(3*a.vertices.length),3)).copyVector3sArray(a.vertices));0<a.normals.length&&this.addAttribute("normal",(new Ea(new Float32Array(3*a.normals.length),3)).copyVector3sArray(a.normals));0<a.colors.length&&this.addAttribute("color",(new Ea(new Float32Array(3*
a.colors.length),3)).copyColorsArray(a.colors));0<a.uvs.length&&this.addAttribute("uv",(new Ea(new Float32Array(2*a.uvs.length),2)).copyVector2sArray(a.uvs));0<a.uvs2.length&&this.addAttribute("uv2",(new Ea(new Float32Array(2*a.uvs2.length),2)).copyVector2sArray(a.uvs2));this.groups=a.groups;for(var b in a.morphTargets){for(var c=[],d=a.morphTargets[b],f=0,g=d.length;f<g;f++){var h=d[f],l=new ia(3*h.data.length,3);l.name=h.name;c.push(l.copyVector3sArray(h.data))}this.morphAttributes[b]=c}0<a.skinIndices.length&&
(b=new ia(4*a.skinIndices.length,4),this.addAttribute("skinIndex",b.copyVector4sArray(a.skinIndices)));0<a.skinWeights.length&&(b=new ia(4*a.skinWeights.length,4),this.addAttribute("skinWeight",b.copyVector4sArray(a.skinWeights)));null!==a.boundingSphere&&(this.boundingSphere=a.boundingSphere.clone());null!==a.boundingBox&&(this.boundingBox=a.boundingBox.clone());return this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new G);var a=this.attributes.position,b=this.morphAttributes.position;
if(void 0!==a){if(this.boundingBox.setFromBufferAttribute(a),b){a=0;for(var c=b.length;a<c;a++)Ud.setFromBufferAttribute(b[a]),this.boundingBox.expandByPoint(Ud.min),this.boundingBox.expandByPoint(Ud.max)}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){null===
this.boundingSphere&&(this.boundingSphere=new U);var a=this.attributes.position,b=this.morphAttributes.position;if(a){var c=this.boundingSphere.center;Ud.setFromBufferAttribute(a);if(b)for(var d=0,f=b.length;d<f;d++){var g=b[d];li.setFromBufferAttribute(g);Ud.expandByPoint(li.min);Ud.expandByPoint(li.max)}Ud.getCenter(c);var h=0;d=0;for(f=a.count;d<f;d++)zc.fromBufferAttribute(a,d),h=Math.max(h,c.distanceToSquared(zc));if(b)for(d=0,f=b.length;d<f;d++){g=b[d];a=0;for(var l=g.count;a<l;a++)zc.fromBufferAttribute(g,
a),h=Math.max(h,c.distanceToSquared(zc))}this.boundingSphere.radius=Math.sqrt(h);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 a=this.index,b=this.attributes;if(b.position){var c=b.position.array;if(void 0===b.normal)this.addAttribute("normal",new Ea(new Float32Array(c.length),3));else for(var d=
b.normal.array,f=0,g=d.length;f<g;f++)d[f]=0;d=b.normal.array;var h=new p,l=new p,m=new p,q=new p,u=new p;if(a){var w=a.array;f=0;for(g=a.count;f<g;f+=3){a=3*w[f+0];var y=3*w[f+1];var C=3*w[f+2];h.fromArray(c,a);l.fromArray(c,y);m.fromArray(c,C);q.subVectors(m,l);u.subVectors(h,l);q.cross(u);d[a]+=q.x;d[a+1]+=q.y;d[a+2]+=q.z;d[y]+=q.x;d[y+1]+=q.y;d[y+2]+=q.z;d[C]+=q.x;d[C+1]+=q.y;d[C+2]+=q.z}}else for(f=0,g=c.length;f<g;f+=9)h.fromArray(c,f),l.fromArray(c,f+3),m.fromArray(c,f+6),q.subVectors(m,l),
u.subVectors(h,l),q.cross(u),d[f]=q.x,d[f+1]=q.y,d[f+2]=q.z,d[f+3]=q.x,d[f+4]=q.y,d[f+5]=q.z,d[f+6]=q.x,d[f+7]=q.y,d[f+8]=q.z;this.normalizeNormals();b.normal.needsUpdate=!0}},merge:function(a,b){if(a&&a.isBufferGeometry){void 0===b&&(b=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset\x3d0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));var c=this.attributes,d;for(d in c)if(void 0!==a.attributes[d]){var f=c[d].array,g=a.attributes[d],
h=g.array,l=g.itemSize*b;g=Math.min(h.length,f.length-l);for(var m=0;m<g;m++,l++)f[l]=h[m]}return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",a)},normalizeNormals:function(){for(var a=this.attributes.normal,b=0,c=a.count;b<c;b++)zc.x=a.getX(b),zc.y=a.getY(b),zc.z=a.getZ(b),zc.normalize(),a.setXYZ(b,zc.x,zc.y,zc.z)},toNonIndexed:function(){function a(u,w){var y=u.array;u=u.itemSize;for(var C=new y.constructor(w.length*u),D,K=0,J=0,W=w.length;J<
W;J++){D=w[J]*u;for(var T=0;T<u;T++)C[K++]=y[D++]}return new Ea(C,u)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var b=new la,c=this.index.array,d=this.attributes,f;for(f in d){var g=d[f];g=a(g,c);b.addAttribute(f,g)}var h=this.morphAttributes;for(f in h){var l=[],m=h[f];d=0;for(var q=m.length;d<q;d++)g=m[d],g=a(g,c),l.push(g);b.morphAttributes[f]=l}c=this.groups;d=0;for(f=c.length;d<f;d++)g=c[d],b.addGroup(g.start,g.count,
g.materialIndex);return b},toJSON:function(){var a={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};a.uuid=this.uuid;a.type=this.type;""!==this.name&&(a.name=this.name);0<Object.keys(this.userData).length&&(a.userData=this.userData);if(void 0!==this.parameters){var b=this.parameters;for(q in b)void 0!==b[q]&&(a[q]=b[q]);return a}a.data={attributes:{}};b=this.index;null!==b&&(a.data.index={type:b.array.constructor.name,array:Array.prototype.slice.call(b.array)});var c=
this.attributes;for(q in c){b=c[q];var d=b.toJSON();""!==b.name&&(d.name=b.name);a.data.attributes[q]=d}c={};var f=!1;for(q in this.morphAttributes){for(var g=this.morphAttributes[q],h=[],l=0,m=g.length;l<m;l++)b=g[l],d=b.toJSON(),""!==b.name&&(d.name=b.name),h.push(d);0<h.length&&(c[q]=h,f=!0)}f&&(a.data.morphAttributes=c);var q=this.groups;0<q.length&&(a.data.groups=JSON.parse(JSON.stringify(q)));q=this.boundingSphere;null!==q&&(a.data.boundingSphere={center:q.center.toArray(),radius:q.radius});
return a},clone:function(){return(new la).copy(this)},copy:function(a){var b;this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;this.name=a.name;var c=a.index;null!==c&&this.setIndex(c.clone());c=a.attributes;for(h in c)this.addAttribute(h,c[h].clone());var d=a.morphAttributes;for(h in d){var f=[],g=d[h];c=0;for(b=g.length;c<b;c++)f.push(g[c].clone());this.morphAttributes[h]=f}var h=a.groups;c=0;for(b=h.length;c<b;c++)d=h[c],this.addGroup(d.start,
d.count,d.materialIndex);h=a.boundingBox;null!==h&&(this.boundingBox=h.clone());h=a.boundingSphere;null!==h&&(this.boundingSphere=h.clone());this.drawRange.start=a.drawRange.start;this.drawRange.count=a.drawRange.count;this.userData=a.userData;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var Ij=new A,Vd=new ba,mi=new U,yd=new p,zd=new p,Ad=new p,zi=new p,Ai=new p,Bi=new p,nh=new p,oh=new p,ph=new p,ae=new k,be=new k,ce=new k,bf=new p,bg=new p;Oa.prototype=Object.assign(Object.create(I.prototype),
{constructor:Oa,isMesh:!0,setDrawMode:function(a){this.drawMode=a},copy:function(a){I.prototype.copy.call(this,a);this.drawMode=a.drawMode;void 0!==a.morphTargetInfluences&&(this.morphTargetInfluences=a.morphTargetInfluences.slice());void 0!==a.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},a.morphTargetDictionary));return this},updateMorphTargets:function(){var a=this.geometry;if(a.isBufferGeometry){a=a.morphAttributes;var b=Object.keys(a);if(0<b.length){var c=a[b[0]];if(void 0!==
c)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},a=0,b=c.length;a<b;a++){var d=c[a].name||String(a);this.morphTargetInfluences.push(0);this.morphTargetDictionary[d]=a}}}else a=a.morphTargets,void 0!==a&&0<a.length&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")},raycast:function(a,b){var c=this.geometry,d=this.material,f=this.matrixWorld;if(void 0!==d&&(null===c.boundingSphere&&c.computeBoundingSphere(),mi.copy(c.boundingSphere),
mi.applyMatrix4(f),!1!==a.ray.intersectsSphere(mi)&&(Ij.getInverse(f),Vd.copy(a.ray).applyMatrix4(Ij),null===c.boundingBox||!1!==Vd.intersectsBox(c.boundingBox))))if(c.isBufferGeometry){var g=c.index;f=c.attributes.position;var h=c.morphAttributes.position,l=c.attributes.uv,m=c.attributes.uv2,q=c.groups,u=c.drawRange,w,y;if(null!==g)if(Array.isArray(d)){var C=0;for(w=q.length;C<w;C++){var D=q[C];var K=d[D.materialIndex];var J=Math.max(D.start,u.start);for(y=c=Math.min(D.start+D.count,u.start+u.count);J<
y;J+=3){c=g.getX(J);var W=g.getX(J+1);var T=g.getX(J+2);if(c=fb(this,K,a,Vd,f,h,l,m,c,W,T))c.faceIndex=Math.floor(J/3),c.face.materialIndex=D.materialIndex,b.push(c)}}}else for(J=Math.max(0,u.start),c=Math.min(g.count,u.start+u.count),C=J,w=c;C<w;C+=3){if(c=g.getX(C),W=g.getX(C+1),T=g.getX(C+2),c=fb(this,d,a,Vd,f,h,l,m,c,W,T))c.faceIndex=Math.floor(C/3),b.push(c)}else if(void 0!==f)if(Array.isArray(d))for(C=0,w=q.length;C<w;C++)for(D=q[C],K=d[D.materialIndex],J=Math.max(D.start,u.start),y=c=Math.min(D.start+
D.count,u.start+u.count);J<y;J+=3){if(c=J,W=J+1,T=J+2,c=fb(this,K,a,Vd,f,h,l,m,c,W,T))c.faceIndex=Math.floor(J/3),c.face.materialIndex=D.materialIndex,b.push(c)}else for(J=Math.max(0,u.start),c=Math.min(f.count,u.start+u.count),C=J,w=c;C<w;C+=3)if(c=C,W=C+1,T=C+2,c=fb(this,d,a,Vd,f,h,l,m,c,W,T))c.faceIndex=Math.floor(C/3),b.push(c)}else if(c.isGeometry)for(f=Array.isArray(d),h=c.vertices,l=c.faces,c=c.faceVertexUvs[0],0<c.length&&(g=c),C=0,w=l.length;C<w;C++)if(D=l[C],c=f?d[D.materialIndex]:d,void 0!==
c&&(m=h[D.a],q=h[D.b],u=h[D.c],c=Ra(this,c,a,Vd,m,q,u,bf)))g&&g[C]&&(K=g[C],ae.copy(K[0]),be.copy(K[1]),ce.copy(K[2]),c.uv=ja.getUV(bf,m,q,u,ae,be,ce,new k)),c.face=D,c.faceIndex=C,b.push(c)},clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});var lk=0,Qc=new A,ni=new I,Yg=new p;Ia.prototype=Object.assign(Object.create(r.prototype),{constructor:Ia,isGeometry:!0,applyMatrix:function(a){for(var b=(new v).getNormalMatrix(a),c=0,d=this.vertices.length;c<d;c++)this.vertices[c].applyMatrix4(a);
c=0;for(d=this.faces.length;c<d;c++){a=this.faces[c];a.normal.applyMatrix3(b).normalize();for(var f=0,g=a.vertexNormals.length;f<g;f++)a.vertexNormals[f].applyMatrix3(b).normalize()}null!==this.boundingBox&&this.computeBoundingBox();null!==this.boundingSphere&&this.computeBoundingSphere();this.normalsNeedUpdate=this.verticesNeedUpdate=!0;return this},rotateX:function(a){Qc.makeRotationX(a);this.applyMatrix(Qc);return this},rotateY:function(a){Qc.makeRotationY(a);this.applyMatrix(Qc);return this},
rotateZ:function(a){Qc.makeRotationZ(a);this.applyMatrix(Qc);return this},translate:function(a,b,c){Qc.makeTranslation(a,b,c);this.applyMatrix(Qc);return this},scale:function(a,b,c){Qc.makeScale(a,b,c);this.applyMatrix(Qc);return this},lookAt:function(a){ni.lookAt(a);ni.updateMatrix();this.applyMatrix(ni.matrix);return this},fromBufferGeometry:function(a){function b(C,D,K,J){var W=void 0===l?[]:[c.colors[C].clone(),c.colors[D].clone(),c.colors[K].clone()],T=void 0===h?[]:[(new p).fromArray(h,3*C),
(new p).fromArray(h,3*D),(new p).fromArray(h,3*K)];J=new mb(C,D,K,T,W,J);c.faces.push(J);void 0!==m&&c.faceVertexUvs[0].push([(new k).fromArray(m,2*C),(new k).fromArray(m,2*D),(new k).fromArray(m,2*K)]);void 0!==q&&c.faceVertexUvs[1].push([(new k).fromArray(q,2*C),(new k).fromArray(q,2*D),(new k).fromArray(q,2*K)])}var c=this,d=null!==a.index?a.index.array:void 0,f=a.attributes,g=f.position.array,h=void 0!==f.normal?f.normal.array:void 0,l=void 0!==f.color?f.color.array:void 0,m=void 0!==f.uv?f.uv.array:
void 0,q=void 0!==f.uv2?f.uv2.array:void 0;void 0!==q&&(this.faceVertexUvs[1]=[]);for(f=0;f<g.length;f+=3)c.vertices.push((new p).fromArray(g,f)),void 0!==l&&c.colors.push((new ca).fromArray(l,f));var u=a.groups;if(0<u.length)for(f=0;f<u.length;f++){g=u[f];var w=g.start,y=w;for(w+=g.count;y<w;y+=3)void 0!==d?b(d[y],d[y+1],d[y+2],g.materialIndex):b(y,y+1,y+2,g.materialIndex)}else if(void 0!==d)for(f=0;f<d.length;f+=3)b(d[f],d[f+1],d[f+2]);else for(f=0;f<g.length/3;f+=3)b(f,f+1,f+2);this.computeFaceNormals();
null!==a.boundingBox&&(this.boundingBox=a.boundingBox.clone());null!==a.boundingSphere&&(this.boundingSphere=a.boundingSphere.clone());return this},center:function(){this.computeBoundingBox();this.boundingBox.getCenter(Yg).negate();this.translate(Yg.x,Yg.y,Yg.z);return this},normalize:function(){this.computeBoundingSphere();var a=this.boundingSphere.center,b=this.boundingSphere.radius;b=0===b?1:1/b;var c=new A;c.set(b,0,0,-b*a.x,0,b,0,-b*a.y,0,0,b,-b*a.z,0,0,0,1);this.applyMatrix(c);return this},
computeFaceNormals:function(){for(var a=new p,b=new p,c=0,d=this.faces.length;c<d;c++){var f=this.faces[c],g=this.vertices[f.a],h=this.vertices[f.b];a.subVectors(this.vertices[f.c],h);b.subVectors(g,h);a.cross(b);a.normalize();f.normal.copy(a)}},computeVertexNormals:function(a){void 0===a&&(a=!0);var b;var c=Array(this.vertices.length);var d=0;for(b=this.vertices.length;d<b;d++)c[d]=new p;if(a){var f=new p,g=new p;a=0;for(d=this.faces.length;a<d;a++){b=this.faces[a];var h=this.vertices[b.a];var l=
this.vertices[b.b];var m=this.vertices[b.c];f.subVectors(m,l);g.subVectors(h,l);f.cross(g);c[b.a].add(f);c[b.b].add(f);c[b.c].add(f)}}else for(this.computeFaceNormals(),a=0,d=this.faces.length;a<d;a++)b=this.faces[a],c[b.a].add(b.normal),c[b.b].add(b.normal),c[b.c].add(b.normal);d=0;for(b=this.vertices.length;d<b;d++)c[d].normalize();a=0;for(d=this.faces.length;a<d;a++)b=this.faces[a],h=b.vertexNormals,3===h.length?(h[0].copy(c[b.a]),h[1].copy(c[b.b]),h[2].copy(c[b.c])):(h[0]=c[b.a].clone(),h[1]=
c[b.b].clone(),h[2]=c[b.c].clone());0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var a;this.computeFaceNormals();var b=0;for(a=this.faces.length;b<a;b++){var c=this.faces[b];var d=c.vertexNormals;3===d.length?(d[0].copy(c.normal),d[1].copy(c.normal),d[2].copy(c.normal)):(d[0]=c.normal.clone(),d[1]=c.normal.clone(),d[2]=c.normal.clone())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var a,b;var c=0;for(b=this.faces.length;c<
b;c++){var d=this.faces[c];d.__originalFaceNormal?d.__originalFaceNormal.copy(d.normal):d.__originalFaceNormal=d.normal.clone();d.__originalVertexNormals||(d.__originalVertexNormals=[]);var f=0;for(a=d.vertexNormals.length;f<a;f++)d.__originalVertexNormals[f]?d.__originalVertexNormals[f].copy(d.vertexNormals[f]):d.__originalVertexNormals[f]=d.vertexNormals[f].clone()}var g=new Ia;g.faces=this.faces;f=0;for(a=this.morphTargets.length;f<a;f++){if(!this.morphNormals[f]){this.morphNormals[f]={};this.morphNormals[f].faceNormals=
[];this.morphNormals[f].vertexNormals=[];d=this.morphNormals[f].faceNormals;var h=this.morphNormals[f].vertexNormals;c=0;for(b=this.faces.length;c<b;c++){var l=new p;var m={a:new p,b:new p,c:new p};d.push(l);h.push(m)}}h=this.morphNormals[f];g.vertices=this.morphTargets[f].vertices;g.computeFaceNormals();g.computeVertexNormals();c=0;for(b=this.faces.length;c<b;c++)d=this.faces[c],l=h.faceNormals[c],m=h.vertexNormals[c],l.copy(d.normal),m.a.copy(d.vertexNormals[0]),m.b.copy(d.vertexNormals[1]),m.c.copy(d.vertexNormals[2])}c=
0;for(b=this.faces.length;c<b;c++)d=this.faces[c],d.normal=d.__originalFaceNormal,d.vertexNormals=d.__originalVertexNormals},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new G);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new U);this.boundingSphere.setFromPoints(this.vertices)},merge:function(a,b,c){if(a&&a.isGeometry){var d,f=this.vertices.length,g=this.vertices,h=a.vertices,l=this.faces,
m=a.faces,q=this.colors,u=a.colors;void 0===c&&(c=0);void 0!==b&&(d=(new v).getNormalMatrix(b));for(var w=0,y=h.length;w<y;w++){var C=h[w].clone();void 0!==b&&C.applyMatrix4(b);g.push(C)}w=0;for(y=u.length;w<y;w++)q.push(u[w].clone());w=0;for(y=m.length;w<y;w++){h=m[w];var D=h.vertexNormals;u=h.vertexColors;q=new mb(h.a+f,h.b+f,h.c+f);q.normal.copy(h.normal);void 0!==d&&q.normal.applyMatrix3(d).normalize();b=0;for(g=D.length;b<g;b++)C=D[b].clone(),void 0!==d&&C.applyMatrix3(d).normalize(),q.vertexNormals.push(C);
q.color.copy(h.color);b=0;for(g=u.length;b<g;b++)C=u[b],q.vertexColors.push(C.clone());q.materialIndex=h.materialIndex+c;l.push(q)}w=0;for(y=a.faceVertexUvs.length;w<y;w++)for(c=a.faceVertexUvs[w],void 0===this.faceVertexUvs[w]&&(this.faceVertexUvs[w]=[]),b=0,g=c.length;b<g;b++){d=c[b];f=[];l=0;for(m=d.length;l<m;l++)f.push(d[l].clone());this.faceVertexUvs[w].push(f)}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",a)},mergeMesh:function(a){a&&a.isMesh?(a.matrixAutoUpdate&&
a.updateMatrix(),this.merge(a.geometry,a.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",a)},mergeVertices:function(){var a={},b=[],c=[],d=Math.pow(10,4),f;var g=0;for(f=this.vertices.length;g<f;g++){var h=this.vertices[g];h=Math.round(h.x*d)+"_"+Math.round(h.y*d)+"_"+Math.round(h.z*d);void 0===a[h]?(a[h]=g,b.push(this.vertices[g]),c[g]=b.length-1):c[g]=c[a[h]]}a=[];g=0;for(f=this.faces.length;g<f;g++)for(d=this.faces[g],d.a=c[d.a],d.b=c[d.b],d.c=c[d.c],d=
[d.a,d.b,d.c],h=0;3>h;h++)if(d[h]===d[(h+1)%3]){a.push(g);break}for(g=a.length-1;0<=g;g--)for(d=a[g],this.faces.splice(d,1),c=0,f=this.faceVertexUvs.length;c<f;c++)this.faceVertexUvs[c].splice(d,1);g=this.vertices.length-b.length;this.vertices=b;return g},setFromPoints:function(a){this.vertices=[];for(var b=0,c=a.length;b<c;b++){var d=a[b];this.vertices.push(new p(d.x,d.y,d.z||0))}return this},sortFacesByMaterialIndex:function(){for(var a=this.faces,b=a.length,c=0;c<b;c++)a[c]._id=c;a.sort(function(m,
q){return m.materialIndex-q.materialIndex});var d=this.faceVertexUvs[0],f=this.faceVertexUvs[1],g,h;d&&d.length===b&&(g=[]);f&&f.length===b&&(h=[]);for(c=0;c<b;c++){var l=a[c]._id;g&&g.push(d[l]);h&&h.push(f[l])}g&&(this.faceVertexUvs[0]=g);h&&(this.faceVertexUvs[1]=h)},toJSON:function(){function a(R,Y,ea){return ea?R|1<<Y:R&~(1<<Y)}function b(R){var Y=R.x.toString()+R.y.toString()+R.z.toString();if(void 0!==q[Y])return q[Y];q[Y]=m.length/3;m.push(R.x,R.y,R.z);return q[Y]}function c(R){var Y=R.r.toString()+
R.g.toString()+R.b.toString();if(void 0!==w[Y])return w[Y];w[Y]=u.length;u.push(R.getHex());return w[Y]}function d(R){var Y=R.x.toString()+R.y.toString();if(void 0!==C[Y])return C[Y];C[Y]=y.length/2;y.push(R.x,R.y);return C[Y]}var f={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};f.uuid=this.uuid;f.type=this.type;""!==this.name&&(f.name=this.name);if(void 0!==this.parameters){var g=this.parameters,h;for(h in g)void 0!==g[h]&&(f[h]=g[h]);return f}g=[];for(h=0;h<this.vertices.length;h++){var l=
this.vertices[h];g.push(l.x,l.y,l.z)}l=[];var m=[],q={},u=[],w={},y=[],C={};for(h=0;h<this.faces.length;h++){var D=this.faces[h],K=void 0!==this.faceVertexUvs[0][h],J=0<D.normal.length(),W=0<D.vertexNormals.length,T=1!==D.color.r||1!==D.color.g||1!==D.color.b,V=0<D.vertexColors.length,Z=0;Z=a(Z,0,0);Z=a(Z,1,!0);Z=a(Z,2,!1);Z=a(Z,3,K);Z=a(Z,4,J);Z=a(Z,5,W);Z=a(Z,6,T);Z=a(Z,7,V);l.push(Z);l.push(D.a,D.b,D.c);l.push(D.materialIndex);K&&(K=this.faceVertexUvs[0][h],l.push(d(K[0]),d(K[1]),d(K[2])));J&&
l.push(b(D.normal));W&&(J=D.vertexNormals,l.push(b(J[0]),b(J[1]),b(J[2])));T&&l.push(c(D.color));V&&(D=D.vertexColors,l.push(c(D[0]),c(D[1]),c(D[2])))}f.data={};f.data.vertices=g;f.data.normals=m;0<u.length&&(f.data.colors=u);0<y.length&&(f.data.uvs=[y]);f.data.faces=l;return f},clone:function(){return(new Ia).copy(this)},copy:function(a){var b,c,d;this.vertices=[];this.colors=[];this.faces=[];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];
this.lineDistances=[];this.boundingSphere=this.boundingBox=null;this.name=a.name;var f=a.vertices;var g=0;for(b=f.length;g<b;g++)this.vertices.push(f[g].clone());f=a.colors;g=0;for(b=f.length;g<b;g++)this.colors.push(f[g].clone());f=a.faces;g=0;for(b=f.length;g<b;g++)this.faces.push(f[g].clone());g=0;for(b=a.faceVertexUvs.length;g<b;g++){var h=a.faceVertexUvs[g];void 0===this.faceVertexUvs[g]&&(this.faceVertexUvs[g]=[]);f=0;for(c=h.length;f<c;f++){var l=h[f],m=[];var q=0;for(d=l.length;q<d;q++)m.push(l[q].clone());
this.faceVertexUvs[g].push(m)}}q=a.morphTargets;g=0;for(b=q.length;g<b;g++){d={};d.name=q[g].name;if(void 0!==q[g].vertices)for(d.vertices=[],f=0,c=q[g].vertices.length;f<c;f++)d.vertices.push(q[g].vertices[f].clone());if(void 0!==q[g].normals)for(d.normals=[],f=0,c=q[g].normals.length;f<c;f++)d.normals.push(q[g].normals[f].clone());this.morphTargets.push(d)}q=a.morphNormals;g=0;for(b=q.length;g<b;g++){d={};if(void 0!==q[g].vertexNormals)for(d.vertexNormals=[],f=0,c=q[g].vertexNormals.length;f<c;f++)h=
q[g].vertexNormals[f],l={},l.a=h.a.clone(),l.b=h.b.clone(),l.c=h.c.clone(),d.vertexNormals.push(l);if(void 0!==q[g].faceNormals)for(d.faceNormals=[],f=0,c=q[g].faceNormals.length;f<c;f++)d.faceNormals.push(q[g].faceNormals[f].clone());this.morphNormals.push(d)}f=a.skinWeights;g=0;for(b=f.length;g<b;g++)this.skinWeights.push(f[g].clone());f=a.skinIndices;g=0;for(b=f.length;g<b;g++)this.skinIndices.push(f[g].clone());f=a.lineDistances;g=0;for(b=f.length;g<b;g++)this.lineDistances.push(f[g]);g=a.boundingBox;
null!==g&&(this.boundingBox=g.clone());g=a.boundingSphere;null!==g&&(this.boundingSphere=g.clone());this.elementsNeedUpdate=a.elementsNeedUpdate;this.verticesNeedUpdate=a.verticesNeedUpdate;this.uvsNeedUpdate=a.uvsNeedUpdate;this.normalsNeedUpdate=a.normalsNeedUpdate;this.colorsNeedUpdate=a.colorsNeedUpdate;this.lineDistancesNeedUpdate=a.lineDistancesNeedUpdate;this.groupsNeedUpdate=a.groupsNeedUpdate;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});ob.prototype=Object.create(Ia.prototype);
ob.prototype.constructor=ob;vb.prototype=Object.create(la.prototype);vb.prototype.constructor=vb;var $l={clone:hc,merge:xb};yb.prototype=Object.create(xa.prototype);yb.prototype.constructor=yb;yb.prototype.isShaderMaterial=!0;yb.prototype.copy=function(a){xa.prototype.copy.call(this,a);this.fragmentShader=a.fragmentShader;this.vertexShader=a.vertexShader;this.uniforms=hc(a.uniforms);this.defines=Object.assign({},a.defines);this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.lights=
a.lights;this.clipping=a.clipping;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;this.extensions=a.extensions;return this};yb.prototype.toJSON=function(a){var b=xa.prototype.toJSON.call(this,a);b.uniforms={};for(var c in this.uniforms){var d=this.uniforms[c].value;b.uniforms[c]=d&&d.isTexture?{type:"t",value:d.toJSON(a).uuid}:d&&d.isColor?{type:"c",value:d.getHex()}:d&&d.isVector2?{type:"v2",value:d.toArray()}:d&&d.isVector3?{type:"v3",value:d.toArray()}:
d&&d.isVector4?{type:"v4",value:d.toArray()}:d&&d.isMatrix3?{type:"m3",value:d.toArray()}:d&&d.isMatrix4?{type:"m4",value:d.toArray()}:{value:d}}0<Object.keys(this.defines).length&&(b.defines=this.defines);b.vertexShader=this.vertexShader;b.fragmentShader=this.fragmentShader;a={};for(var f in this.extensions)!0===this.extensions[f]&&(a[f]=!0);0<Object.keys(a).length&&(b.extensions=a);return b};Fb.prototype=Object.assign(Object.create(I.prototype),{constructor:Fb,isCamera:!0,copy:function(a,b){I.prototype.copy.call(this,
a,b);this.matrixWorldInverse.copy(a.matrixWorldInverse);this.projectionMatrix.copy(a.projectionMatrix);this.projectionMatrixInverse.copy(a.projectionMatrixInverse);return this},getWorldDirection:function(a){void 0===a&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),a=new p);this.updateMatrixWorld(!0);var b=this.matrixWorld.elements;return a.set(-b[8],-b[9],-b[10]).normalize()},updateMatrixWorld:function(a){I.prototype.updateMatrixWorld.call(this,a);this.matrixWorldInverse.getInverse(this.matrixWorld)},
clone:function(){return(new this.constructor).copy(this)}});kb.prototype=Object.assign(Object.create(Fb.prototype),{constructor:kb,isPerspectiveCamera:!0,copy:function(a,b){Fb.prototype.copy.call(this,a,b);this.fov=a.fov;this.zoom=a.zoom;this.near=a.near;this.far=a.far;this.focus=a.focus;this.aspect=a.aspect;this.view=null===a.view?null:Object.assign({},a.view);this.filmGauge=a.filmGauge;this.filmOffset=a.filmOffset;return this},setFocalLength:function(a){this.fov=2*Qa.RAD2DEG*Math.atan(.5*this.getFilmHeight()/
a);this.updateProjectionMatrix()},getFocalLength:function(){return.5*this.getFilmHeight()/Math.tan(.5*Qa.DEG2RAD*this.fov)},getEffectiveFOV:function(){return 2*Qa.RAD2DEG*Math.atan(Math.tan(.5*Qa.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(a,b,c,d,f,g){this.aspect=a/b;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=a;this.view.fullHeight=b;this.view.offsetX=c;this.view.offsetY=d;this.view.width=f;this.view.height=g;this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1);this.updateProjectionMatrix()},updateProjectionMatrix:function(){var a=this.near,b=a*Math.tan(.5*Qa.DEG2RAD*this.fov)/this.zoom,c=2*b,d=this.aspect*c,f=-.5*d,g=this.view;if(null!==this.view&&this.view.enabled){var h=g.fullWidth,l=g.fullHeight;
f+=g.offsetX*d/h;b-=g.offsetY*c/l;d*=g.width/h;c*=g.height/l}g=this.filmOffset;0!==g&&(f+=a*g/this.getFilmWidth());this.projectionMatrix.makePerspective(f,f+d,b,b-c,a,this.far);this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(a){a=I.prototype.toJSON.call(this,a);a.object.fov=this.fov;a.object.zoom=this.zoom;a.object.near=this.near;a.object.far=this.far;a.object.focus=this.focus;a.object.aspect=this.aspect;null!==this.view&&(a.object.view=Object.assign({},this.view));
a.object.filmGauge=this.filmGauge;a.object.filmOffset=this.filmOffset;return a}});ac.prototype=Object.create(I.prototype);ac.prototype.constructor=ac;Nb.prototype=Object.create(t.prototype);Nb.prototype.constructor=Nb;Nb.prototype.isWebGLRenderTargetCube=!0;Nb.prototype.fromEquirectangularTexture=function(a,b){this.texture.type=b.type;this.texture.format=b.format;this.texture.encoding=b.encoding;var c=new aa,d=new yb({type:"CubemapFromEquirect",uniforms:hc({tEquirect:{value:null}}),vertexShader:"varying vec3 vWorldDirection;\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvoid main() {\n\tvWorldDirection \x3d transformDirection( position, modelMatrix );\n\t#include \x3cbegin_vertex\x3e\n\t#include \x3cproject_vertex\x3e\n}",
fragmentShader:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\nvoid main() {\n\tvec3 direction \x3d normalize( vWorldDirection );\n\tvec2 sampleUV;\n\tsampleUV.y \x3d asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x \x3d atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor \x3d texture2D( tEquirect, sampleUV );\n}",side:1,blending:0});d.uniforms.tEquirect.value=b;
b=new Oa(new vb(5,5,5),d);c.add(b);d=new ac(1,10,1);d.renderTarget=this;d.renderTarget.texture.name="CubeCameraTexture";d.update(a,c);b.geometry.dispose();b.material.dispose();return this};Rb.prototype=Object.create(z.prototype);Rb.prototype.constructor=Rb;Rb.prototype.isDataTexture=!0;var oi=new p,am=new p,bm=new v;Object.assign(Hb.prototype,{isPlane:!0,set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},
setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(a,b,c){b=oi.subVectors(c,b).cross(am.subVectors(a,b)).normalize();this.setFromNormalAndCoplanarPoint(b,a);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;return this},normalize:function(){var a=1/this.normal.length();this.normal.multiplyScalar(a);this.constant*=a;return this},
negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(a){return this.normal.dot(a)+this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a,b){void 0===b&&(console.warn("THREE.Plane: .projectPoint() target is now required"),b=new p);return b.copy(this.normal).multiplyScalar(-this.distanceToPoint(a)).add(a)},intersectLine:function(a,b){void 0===b&&(console.warn("THREE.Plane: .intersectLine() target is now required"),
b=new p);var c=a.delta(oi),d=this.normal.dot(c);if(0===d){if(0===this.distanceToPoint(a.start))return b.copy(a.start)}else if(d=-(a.start.dot(this.normal)+this.constant)/d,!(0>d||1<d))return b.copy(c).multiplyScalar(d).add(a.start)},intersectsLine:function(a){var b=this.distanceToPoint(a.start);a=this.distanceToPoint(a.end);return 0>b&&0<a||0>a&&0<b},intersectsBox:function(a){return a.intersectsPlane(this)},intersectsSphere:function(a){return a.intersectsPlane(this)},coplanarPoint:function(a){void 0===
a&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),a=new p);return a.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(a,b){b=b||bm.getNormalMatrix(a);a=this.coplanarPoint(oi).applyMatrix4(a);b=this.normal.applyMatrix3(b).normalize();this.constant=-a.dot(b);return this},translate:function(a){this.constant-=a.dot(this.normal);return this},equals:function(a){return a.normal.equals(this.normal)&&a.constant===this.constant}});var Ye=new U,Zg=new p;Object.assign(ic.prototype,
{set:function(a,b,c,d,f,g){var h=this.planes;h[0].copy(a);h[1].copy(b);h[2].copy(c);h[3].copy(d);h[4].copy(f);h[5].copy(g);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],f=c[2],g=c[3],h=c[4],l=c[5],m=c[6],q=c[7],u=c[8],w=c[9],y=c[10],C=c[11],D=c[12],K=c[13],J=c[14];c=c[15];b[0].setComponents(g-a,q-h,C-u,c-D).normalize();
b[1].setComponents(g+a,q+h,C+u,c+D).normalize();b[2].setComponents(g+d,q+l,C+w,c+K).normalize();b[3].setComponents(g-d,q-l,C-w,c-K).normalize();b[4].setComponents(g-f,q-m,C-y,c-J).normalize();b[5].setComponents(g+f,q+m,C+y,c+J).normalize();return this},intersectsObject:function(a){var b=a.geometry;null===b.boundingSphere&&b.computeBoundingSphere();Ye.copy(b.boundingSphere).applyMatrix4(a.matrixWorld);return this.intersectsSphere(Ye)},intersectsSprite:function(a){Ye.center.set(0,0,0);Ye.radius=.7071067811865476;
Ye.applyMatrix4(a.matrixWorld);return this.intersectsSphere(Ye)},intersectsSphere:function(a){var b=this.planes,c=a.center;a=-a.radius;for(var d=0;6>d;d++)if(b[d].distanceToPoint(c)<a)return!1;return!0},intersectsBox:function(a){for(var b=this.planes,c=0;6>c;c++){var d=b[c];Zg.x=0<d.normal.x?a.max.x:a.min.x;Zg.y=0<d.normal.y?a.max.y:a.min.y;Zg.z=0<d.normal.z?a.max.z:a.min.z;if(0>d.distanceToPoint(Zg))return!1}return!0},containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;
return!0}});var ab={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *\x3d texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a \x3c ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion \x3d ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *\x3d ambientOcclusion;\n\t#if defined( USE_ENVMAP ) \x26\x26 defined( STANDARD )\n\t\tfloat dotNV \x3d saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *\x3d computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",
aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed \x3d vec3( position );",beginnormal_vertex:"vec3 objectNormal \x3d vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent \x3d vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 \x3d vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 \x3d vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r \x3d roughness * c0 + c1;\n\tfloat a004 \x3d min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff \x3d 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance \x3e 0.0 ) {\n\t\tdistanceFalloff *\x3d pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance \x3e 0.0 \x26\x26 decayExponent \x3e 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\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 \x3d exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel \x3d exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr \x3d max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 \x3d pow2( alpha );\n\tfloat gl \x3d dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv \x3d 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 \x3d pow2( alpha );\n\tfloat gv \x3d dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl \x3d 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 \x3d pow2( alpha );\n\tfloat denom \x3d 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 vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha \x3d pow2( roughness );\n\tvec3 halfDir \x3d normalize( incidentLight.direction + viewDir );\n\tfloat dotNL \x3d saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV \x3d saturate( dot( normal, viewDir ) );\n\tfloat dotNH \x3d saturate( dot( normal, halfDir ) );\n\tfloat dotLH \x3d saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F \x3d F_Schlick( specularColor, dotLH );\n\tfloat G \x3d G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D \x3d 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  \x3d 64.0;\n\tconst float LUT_SCALE \x3d ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS  \x3d 0.5 / LUT_SIZE;\n\tfloat dotNV \x3d saturate( dot( N, V ) );\n\tvec2 uv \x3d vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv \x3d uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l \x3d 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 \x3d dot( v1, v2 );\n\tfloat y \x3d abs( x );\n\tfloat a \x3d 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b \x3d 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v \x3d a / b;\n\tfloat theta_sintheta \x3d ( x \x3e 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 \x3d rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 \x3d rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal \x3d cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) \x3c 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 \x3d normalize( V - N * dot( V, N ) );\n\tT2 \x3d - cross( N, T1 );\n\tmat3 mat \x3d mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] \x3d mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] \x3d mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] \x3d mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] \x3d mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] \x3d normalize( coords[ 0 ] );\n\tcoords[ 1 ] \x3d normalize( coords[ 1 ] );\n\tcoords[ 2 ] \x3d normalize( coords[ 2 ] );\n\tcoords[ 3 ] \x3d normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor \x3d vec3( 0.0 );\n\tvectorFormFactor +\x3d LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor +\x3d LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor +\x3d LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor +\x3d LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result \x3d LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV \x3d saturate( dot( normal, viewDir ) );\n\tvec2 brdf \x3d integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV \x3d saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F \x3d F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf \x3d integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss \x3d F * brdf.x + brdf.y;\n\tfloat Ess \x3d brdf.x + brdf.y;\n\tfloat Ems \x3d 1.0 - Ess;\n\tvec3 Favg \x3d specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms \x3d FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter +\x3d FssEss;\n\tmultiScatter +\x3d Fms * Ems;\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 \x3d normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH \x3d saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH \x3d saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F \x3d F_Schlick( specularColor, dotLH );\n\tfloat G \x3d G_BlinnPhong_Implicit( );\n\tfloat D \x3d 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#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha  \x3d 1.0 / roughness;\n\tfloat cos2h \x3d NoH * NoH;\n\tfloat sin2h \x3d max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N \x3d geometry.normal;\n\tvec3 V \x3d geometry.viewDir;\n\tvec3 H \x3d normalize( V + L );\n\tfloat dotNH \x3d saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",
bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx \x3d dFdx( vUv );\n\t\tvec2 dSTdy \x3d dFdy( vUv );\n\t\tfloat Hll \x3d bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx \x3d bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy \x3d 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 \x3d vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY \x3d vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN \x3d surf_norm;\n\t\tvec3 R1 \x3d cross( vSigmaY, vN );\n\t\tvec3 R2 \x3d cross( vN, vSigmaX );\n\t\tfloat fDet \x3d dot( vSigmaX, R1 );\n\t\tfDet *\x3d ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad \x3d sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",
clipping_planes_fragment:"#if NUM_CLIPPING_PLANES \x3e 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane \x3d clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) \x3e plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES \x3c NUM_CLIPPING_PLANES\n\t\tbool clipped \x3d true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i \x3d UNION_CLIPPING_PLANES; i \x3c NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane \x3d clippingPlanes[ i ];\n\t\t\tclipped \x3d ( dot( vViewPosition, plane.xyz ) \x3e plane.w ) \x26\x26 clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",
clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES \x3e 0\n\t#if ! defined( STANDARD ) \x26\x26 ! defined( PHONG ) \x26\x26 ! defined( MATCAP )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES \x3e 0 \x26\x26 ! defined( STANDARD ) \x26\x26 ! defined( PHONG ) \x26\x26 ! defined( MATCAP )\n\tvarying vec3 vViewPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES \x3e 0 \x26\x26 ! defined( STANDARD ) \x26\x26 ! defined( PHONG ) \x26\x26 ! defined( MATCAP )\n\tvViewPosition \x3d - mvPosition.xyz;\n#endif",
color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *\x3d vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz \x3d 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 whiteComplement(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 \x3d 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 \x3d 12.9898, b \x3d 78.233, c \x3d 43758.5453;\n\thighp float dt \x3d dot( uv.xy, vec2( a,b ) ), sn \x3d mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent \x3d max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance \x3d 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 ] \x3d vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] \x3d vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] \x3d vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights \x3d vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}",
cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection \x3d abs(direction);\n\tint face \x3d -1;\n\tif( absDirection.x \x3e absDirection.z ) {\n\t\tif(absDirection.x \x3e absDirection.y )\n\t\t\tface \x3d direction.x \x3e 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface \x3d direction.y \x3e 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z \x3e absDirection.y )\n\t\t\tface \x3d direction.z \x3e 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface \x3d direction.y \x3e 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 \x3d exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness \x3d dFdx(roughness);\n\tfloat dyRoughness \x3d dFdy(roughness);\n\tvec3 dx \x3d dFdx( vec * scale * dxRoughness );\n\tvec3 dy \x3d dFdy( vec * scale * dyRoughness );\n\tfloat d \x3d max( dot( dx, dx ), dot( dy, dy ) );\n\td \x3d clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel \x3d 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 \x3d roughnessLevel \x3e cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a \x3d 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed \x3d exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed \x3d vec2( 1.0 ) / exp2_packed;\n\tfloat powScale \x3d exp2_packed.x * exp2_packed.y;\n\tfloat scale \x3d rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset \x3d 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes \x3d mipLevel \x3d\x3d 0.0;\n\tscale \x3d  bRes \x26\x26 (scale \x3c a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face \x3d getFaceFromDirection(direction);\n\tfloat rcpPowScale \x3d 1.0 / powScale;\n\tif( face \x3d\x3d 0) {\n\t\tr \x3d vec3(direction.x, -direction.z, direction.y);\n\t\toffset \x3d vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y \x3d bRes \x26\x26 (offset.y \x3c 2.0*a) ? a : offset.y;\n\t}\n\telse if( face \x3d\x3d 1) {\n\t\tr \x3d vec3(direction.y, direction.x, direction.z);\n\t\toffset \x3d vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y \x3d bRes \x26\x26 (offset.y \x3c 2.0*a) ? a : offset.y;\n\t}\n\telse if( face \x3d\x3d 2) {\n\t\tr \x3d vec3(direction.z, direction.x, direction.y);\n\t\toffset \x3d vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y \x3d bRes \x26\x26 (offset.y \x3c 2.0*a) ? a : offset.y;\n\t}\n\telse if( face \x3d\x3d 3) {\n\t\tr \x3d vec3(direction.x, direction.z, direction.y);\n\t\toffset \x3d vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y \x3d bRes \x26\x26 (offset.y \x3c 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face \x3d\x3d 4) {\n\t\tr \x3d vec3(direction.y, direction.x, -direction.z);\n\t\toffset \x3d vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y \x3d bRes \x26\x26 (offset.y \x3c 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr \x3d vec3(direction.z, -direction.x, direction.y);\n\t\toffset \x3d vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y \x3d bRes \x26\x26 (offset.y \x3c 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr \x3d normalize(r);\n\tfloat texelOffset \x3d 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s \x3d ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base \x3d 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 \x3d roughness* cubeUV_maxLods3;\n\tfloat r1 \x3d floor(roughnessVal);\n\tfloat r2 \x3d r1 + 1.0;\n\tfloat t \x3d fract(roughnessVal);\n\tvec2 mipInfo \x3d MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s \x3d mipInfo.y;\n\tfloat level0 \x3d mipInfo.x;\n\tfloat level1 \x3d level0 + 1.0;\n\tlevel1 \x3d level1 \x3e 5.0 ? 5.0 : level1;\n\tlevel0 +\x3d min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 \x3d getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 \x3d envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 \x3d getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 \x3d envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result \x3d mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif",
defaultnormal_vertex:"vec3 transformedNormal \x3d normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal \x3d - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent \x3d normalMatrix * objectTangent;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent \x3d - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed +\x3d normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif",
emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor \x3d texture2D( emissiveMap, vUv );\n\temissiveColor.rgb \x3d emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *\x3d emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor \x3d linearToOutputTexel( gl_FragColor );",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.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\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.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\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 \x3d max( max( value.r, value.g ), value.b );\n\tfloat fExp \x3d 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.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB \x3d max( value.r, max( value.g, value.b ) );\n\tfloat M \x3d clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM \x3d 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 \x3d max( value.r, max( value.g, value.b ) );\n\tfloat D \x3d max( maxRange / maxRGB, 1.0 );\n\tD \x3d min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM \x3d 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 \x3d cLogLuvM * value.rgb;\n\tXp_Y_XYZp \x3d max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy \x3d Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le \x3d 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w \x3d fract( Le );\n\tvResult.z \x3d ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM \x3d 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 \x3d value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y \x3d exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z \x3d Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x \x3d value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB \x3d cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",
envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToVertex \x3d normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal \x3d inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec \x3d reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec \x3d refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec \x3d vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor \x3d textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec \x3d normalize( reflectVec );\n\t\tsampleUV.y \x3d asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x \x3d atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor \x3d texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec \x3d normalize( reflectVec );\n\t\tvec3 reflectView \x3d normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor \x3d texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor \x3d vec4( 0.0 );\n\t#endif\n\tenvColor \x3d envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight \x3d mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight \x3d mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight +\x3d envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",
envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",
envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal \x3d inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec \x3d vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor \x3d textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor \x3d textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb \x3d envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec \x3d vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor \x3d textureCubeUV( envMap, queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor \x3d vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar \x3d float( maxMIPLevel );\n\t\tfloat sigma \x3d PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel \x3d maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t  vec3 reflectVec \x3d reflect( -viewDir, normal );\n\t\t  reflectVec \x3d normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t  vec3 reflectVec \x3d refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec \x3d inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel \x3d getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec \x3d vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor \x3d textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor \x3d textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb \x3d envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec \x3d vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor \x3d textureCubeUV( envMap, queryReflectVec, roughness );\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y \x3d asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x \x3d atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor \x3d texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor \x3d texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb \x3d envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView \x3d 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 \x3d texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor \x3d texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb \x3d envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",
envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition \x3d worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex \x3d normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal \x3d inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect \x3d reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect \x3d refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tfogDepth \x3d -mvPosition.z;\n#endif",
fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor \x3d 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor \x3d smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb \x3d mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",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",
gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL \x3d dot( normal, lightDirection );\n\t\tvec2 coord \x3d 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 \x3c 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse +\x3d PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif",
lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse \x3d vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position \x3d mvPosition.xyz;\ngeometry.normal \x3d normalize( transformedNormal );\ngeometry.viewDir \x3d normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position \x3d geometry.position;\nbackGeometry.normal \x3d -geometry.normal;\nbackGeometry.viewDir \x3d geometry.viewDir;\nvLightFront \x3d vec3( 0.0 );\nvIndirectFront \x3d vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack \x3d vec3( 0.0 );\n\tvIndirectBack \x3d vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS \x3e 0\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL \x3d dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse \x3d PI * directLight.color;\n\t\tvLightFront +\x3d saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack +\x3d saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS \x3e 0\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL \x3d dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse \x3d PI * directLight.color;\n\t\tvLightFront +\x3d saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack +\x3d saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS \x3e 0\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL \x3d dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse \x3d PI * directLight.color;\n\t\tvLightFront +\x3d saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack +\x3d saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS \x3e 0\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront +\x3d getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack +\x3d getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif",
lights_pars_begin:"uniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x \x3d normal.x, y \x3d normal.y, z \x3d normal.z;\n\tvec3 result \x3d shCoefficients[ 0 ] * 0.886227;\n\tresult +\x3d shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult +\x3d shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult +\x3d shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult +\x3d shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult +\x3d shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult +\x3d shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult +\x3d shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult +\x3d shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal \x3d inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance \x3d shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance \x3d ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *\x3d PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS \x3e 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 \x3d directionalLight.color;\n\t\tdirectLight.direction \x3d directionalLight.direction;\n\t\tdirectLight.visible \x3d true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS \x3e 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 \x3d pointLight.position - geometry.position;\n\t\tdirectLight.direction \x3d normalize( lVector );\n\t\tfloat lightDistance \x3d length( lVector );\n\t\tdirectLight.color \x3d pointLight.color;\n\t\tdirectLight.color *\x3d punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible \x3d ( directLight.color !\x3d vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS \x3e 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 \x3d spotLight.position - geometry.position;\n\t\tdirectLight.direction \x3d normalize( lVector );\n\t\tfloat lightDistance \x3d length( lVector );\n\t\tfloat angleCos \x3d dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos \x3e spotLight.coneCos ) {\n\t\t\tfloat spotEffect \x3d smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color \x3d spotLight.color;\n\t\t\tdirectLight.color *\x3d spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible \x3d true;\n\t\t} else {\n\t\t\tdirectLight.color \x3d vec3( 0.0 );\n\t\t\tdirectLight.visible \x3d false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS \x3e 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 \x3e 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 \x3d dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight \x3d 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance \x3d mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *\x3d PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",
lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor \x3d diffuseColor.rgb;\nmaterial.specularColor \x3d specular;\nmaterial.specularShininess \x3d shininess;\nmaterial.specularStrength \x3d specularStrength;",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 \x3d getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL \x3d saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance \x3d dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *\x3d PI;\n\t#endif\n\treflectedLight.directDiffuse +\x3d irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular +\x3d 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 +\x3d 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)",
lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor \x3d diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness \x3d clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor \x3d mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor \x3d mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat \x3d saturate( clearcoat );\tmaterial.clearcoatRoughness \x3d clamp( clearcoatRoughness, 0.04, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor \x3d sheen;\n#endif",
lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#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 \x3e 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 \x3d geometry.normal;\n\t\tvec3 viewDir \x3d geometry.viewDir;\n\t\tvec3 position \x3d geometry.position;\n\t\tvec3 lightPos \x3d rectAreaLight.position;\n\t\tvec3 halfWidth \x3d rectAreaLight.halfWidth;\n\t\tvec3 halfHeight \x3d rectAreaLight.halfHeight;\n\t\tvec3 lightColor \x3d rectAreaLight.color;\n\t\tfloat roughness \x3d material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] \x3d lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] \x3d lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] \x3d lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] \x3d lightPos + halfWidth + halfHeight;\n\t\tvec2 uv \x3d LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 \x3d texture2D( ltc_1, uv );\n\t\tvec4 t2 \x3d texture2D( ltc_2, uv );\n\t\tmat3 mInv \x3d 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 \x3d ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular +\x3d lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse +\x3d 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 \x3d saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance \x3d dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *\x3d PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL \x3d saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance \x3d ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *\x3d PI;\n\t\t#endif\n\t\tfloat clearcoatDHR \x3d material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular +\x3d ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR \x3d 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular +\x3d ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular +\x3d ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse +\x3d ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse +\x3d irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV \x3d saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular +\x3d clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL \x3d ccDotNV;\n\t\tfloat clearcoatDHR \x3d material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR \x3d 0.0;\n\t#endif\n\tfloat clearcoatInv \x3d 1.0 - clearcoatDHR;\n\tvec3 singleScattering \x3d vec3( 0.0 );\n\tvec3 multiScattering \x3d vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance \x3d irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse \x3d material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular +\x3d clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectDiffuse +\x3d multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse +\x3d diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",
lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position \x3d - vViewPosition;\ngeometry.normal \x3d normal;\ngeometry.viewDir \x3d normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal \x3d clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS \x3e 0 ) \x26\x26 defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight \x3d pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) \x26\x26 ( UNROLLED_LOOP_INDEX \x3c NUM_POINT_LIGHT_SHADOWS )\n\t\tdirectLight.color *\x3d 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 \x3e 0 ) \x26\x26 defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight \x3d spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) \x26\x26 ( UNROLLED_LOOP_INDEX \x3c NUM_SPOT_LIGHT_SHADOWS )\n\t\tdirectLight.color *\x3d 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 \x3e 0 ) \x26\x26 defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight \x3d directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) \x26\x26 ( UNROLLED_LOOP_INDEX \x3c NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectLight.color *\x3d 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 \x3e 0 ) \x26\x26 defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight \x3d rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance \x3d vec3( 0.0 );\n\tvec3 irradiance \x3d getAmbientLightIrradiance( ambientLightColor );\n\tirradiance +\x3d getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS \x3e 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i \x3d 0; i \x3c NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance +\x3d getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance \x3d vec3( 0.0 );\n\tvec3 clearcoatRadiance \x3d vec3( 0.0 );\n#endif",
lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance \x3d texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *\x3d PI;\n\t\t#endif\n\t\tirradiance +\x3d lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) \x26\x26 defined( STANDARD ) \x26\x26 defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance +\x3d getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) \x26\x26 defined( RE_IndirectSpecular )\n\tradiance +\x3d getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance +\x3d getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",
lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) \x26\x26 defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT \x3d log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) \x26\x26 defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n#endif",
logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth \x3d 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z \x3d log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\tgl_Position.z *\x3d gl_Position.w;\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor \x3d texture2D( map, vUv );\n\ttexelColor \x3d mapTexelToLinear( texelColor );\n\tdiffuseColor *\x3d texelColor;\n#endif",
map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\n\tvec2 uv \x3d ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\tvec4 mapTexel \x3d texture2D( map, uv );\n\tdiffuseColor *\x3d mapTexelToLinear( mapTexel );\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform mat3 uvTransform;\n\tuniform sampler2D map;\n#endif",metalnessmap_fragment:"float metalnessFactor \x3d metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness \x3d texture2D( metalnessMap, vUv );\n\tmetalnessFactor *\x3d texelMetalness.b;\n#endif",
metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal +\x3d ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal +\x3d ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal +\x3d ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal +\x3d ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif",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 +\x3d ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed +\x3d ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed +\x3d ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed +\x3d ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed +\x3d ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed +\x3d ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed +\x3d ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed +\x3d ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",
normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx \x3d vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy \x3d vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal \x3d normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal \x3d normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal \x3d normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent \x3d normalize( vTangent );\n\t\tvec3 bitangent \x3d normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent \x3d tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent \x3d bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal \x3d normal;",
normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal \x3d texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal \x3d - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal \x3d normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal \x3d normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\t#ifdef USE_TANGENT\n\t\tmat3 vTBN \x3d mat3( tangent, bitangent, normal );\n\t\tvec3 mapN \x3d texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy \x3d normalScale * mapN.xy;\n\t\tnormal \x3d normalize( vTBN * mapN );\n\t#else\n\t\tnormal \x3d perturbNormal2Arb( -vViewPosition, normal, normalScale, normalMap );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal \x3d perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",
normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) \x26\x26 ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec2 normalScale, in sampler2D normalMap ) {\n\t\tvec3 q0 \x3d vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 \x3d vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 \x3d dFdx( vUv.st );\n\t\tvec2 st1 \x3d dFdy( vUv.st );\n\t\tfloat scale \x3d sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S \x3d normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T \x3d normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N \x3d normalize( surf_norm );\n\t\tvec3 mapN \x3d texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy *\x3d normalScale;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvec3 NfromST \x3d cross( S, T );\n\t\t\tif( dot( NfromST, N ) \x3e 0.0 ) {\n\t\t\t\tS *\x3d -1.0;\n\t\t\t\tT *\x3d -1.0;\n\t\t\t}\n\t\t#else\n\t\t\tmapN.xy *\x3d ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\tmat3 tsn \x3d mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif",
clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal \x3d geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 vTBN \x3d mat3( tangent, bitangent, clearcoatNormal );\n\t\tvec3 mapN \x3d texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy \x3d clearcoatNormalScale * mapN.xy;\n\t\tclearcoatNormal \x3d normalize( vTBN * mapN );\n\t#else\n\t\tclearcoatNormal \x3d perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatNormalScale, clearcoatNormalMap );\n\t#endif\n#endif",
clearcoat_normalmap_pars_fragment:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",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 \x3d 256. / 255.;const float UnpackDownscale \x3d 255. / 256.;\nconst vec3 PackFactors \x3d vec3( 256. * 256. * 256., 256. * 256.,  256. );\nconst vec4 UnpackFactors \x3d UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 \x3d 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r \x3d vec4( fract( v * PackFactors ), v );\n\tr.yzw -\x3d r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 encodeHalfRGBA ( vec2 v ) {\n\tvec4 encoded \x3d vec4( 0.0 );\n\tconst vec2 offset \x3d vec2( 1.0 / 255.0, 0.0 );\n\tencoded.xy \x3d vec2( v.x, fract( v.x * 255.0 ) );\n\tencoded.xy \x3d encoded.xy - ( encoded.yy * offset );\n\tencoded.zw \x3d vec2( v.y, fract( v.y * 255.0 ) );\n\tencoded.zw \x3d encoded.zw - ( encoded.ww * offset );\n\treturn encoded;\n}\nvec2 decodeHalfRGBA( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",
premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *\x3d gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition \x3d modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position \x3d projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb \x3d dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position \x3d rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB \x3d vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB \x3d mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",
roughnessmap_fragment:"float roughnessFactor \x3d roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness \x3d texture2D( roughnessMap, vUv );\n\troughnessFactor *\x3d texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS \x3e 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS \x3e 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS \x3e 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn decodeHalfRGBA( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion \x3d 1.0;\n\t\tvec2 distribution \x3d texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow \x3d step( compare , distribution.x );\n\t\tif (hard_shadow !\x3d 1.0 ) {\n\t\t\tfloat distance \x3d compare - distribution.x ;\n\t\t\tfloat variance \x3d max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability \x3d variance / (variance + distance * distance );\t\t\tsoftness_probability \x3d clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion \x3d clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset \x3d vec2( 0.0, 1.0 );\n\t\tvec2 texelSize \x3d vec2( 1.0 ) / size;\n\t\tvec2 centroidUV \x3d ( floor( uv * size - 0.5 ) + 0.5 ) * texelSize;\n\t\tfloat lb \x3d texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt \x3d texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb \x3d texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt \x3d texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f \x3d fract( uv * size + 0.5 );\n\t\tfloat a \x3d mix( lb, lt, f.y );\n\t\tfloat b \x3d mix( rb, rt, f.y );\n\t\tfloat c \x3d 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 \x3d 1.0;\n\t\tshadowCoord.xyz /\x3d shadowCoord.w;\n\t\tshadowCoord.z +\x3d shadowBias;\n\t\tbvec4 inFrustumVec \x3d bvec4 ( shadowCoord.x \x3e\x3d 0.0, shadowCoord.x \x3c\x3d 1.0, shadowCoord.y \x3e\x3d 0.0, shadowCoord.y \x3c\x3d 1.0 );\n\t\tbool inFrustum \x3d all( inFrustumVec );\n\t\tbvec2 frustumTestVec \x3d bvec2( inFrustum, shadowCoord.z \x3c\x3d 1.0 );\n\t\tbool frustumTest \x3d all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize \x3d vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 \x3d - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 \x3d - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 \x3d + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 \x3d + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 \x3d dx0 / 2.0;\n\t\t\tfloat dy2 \x3d dy0 / 2.0;\n\t\t\tfloat dx3 \x3d dx1 / 2.0;\n\t\t\tfloat dy3 \x3d dy1 / 2.0;\n\t\t\tshadow \x3d (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize \x3d vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 \x3d - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 \x3d - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 \x3d + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 \x3d + texelSize.y * shadowRadius;\n\t\t\tshadow \x3d (\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#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow \x3d VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow \x3d 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 \x3d abs( v );\n\t\tfloat scaleToCube \x3d 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *\x3d scaleToCube;\n\t\tv *\x3d scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar \x3d v.xy;\n\t\tfloat almostATexel \x3d 1.5 * texelSizeY;\n\t\tfloat almostOne \x3d 1.0 - almostATexel;\n\t\tif ( absV.z \x3e\x3d almostOne ) {\n\t\t\tif ( v.z \x3e 0.0 )\n\t\t\t\tplanar.x \x3d 4.0 - v.x;\n\t\t} else if ( absV.x \x3e\x3d almostOne ) {\n\t\t\tfloat signX \x3d sign( v.x );\n\t\t\tplanar.x \x3d v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y \x3e\x3d almostOne ) {\n\t\t\tfloat signY \x3d sign( v.y );\n\t\t\tplanar.x \x3d v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y \x3d 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 \x3d vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition \x3d shadowCoord.xyz;\n\t\tfloat dp \x3d ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp +\x3d shadowBias;\n\t\tvec3 bd3D \x3d normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset \x3d vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",
shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS \x3e 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS \x3e 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS \x3e 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",
shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS \x3e 0\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] \x3d directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS \x3e 0\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] \x3d spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS \x3e 0\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tvPointShadowCoord[ i ] \x3d pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif",
shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow \x3d 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS \x3e 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight \x3d directionalLights[ i ];\n\t\tshadow *\x3d 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_LIGHT_SHADOWS \x3e 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight \x3d spotLights[ i ];\n\t\tshadow *\x3d 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_LIGHT_SHADOWS \x3e 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i \x3d 0; i \x3c NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight \x3d pointLights[ i ];\n\t\tshadow *\x3d 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}",
skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX \x3d getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY \x3d getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ \x3d getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW \x3d 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 highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j \x3d i * 4.0;\n\t\t\tfloat x \x3d mod( j, float( boneTextureSize ) );\n\t\t\tfloat y \x3d floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx \x3d 1.0 / float( boneTextureSize );\n\t\t\tfloat dy \x3d 1.0 / float( boneTextureSize );\n\t\t\ty \x3d dy * ( y + 0.5 );\n\t\t\tvec4 v1 \x3d texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 \x3d texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 \x3d texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 \x3d texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone \x3d 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 \x3d boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",
skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex \x3d bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned \x3d vec4( 0.0 );\n\tskinned +\x3d boneMatX * skinVertex * skinWeight.x;\n\tskinned +\x3d boneMatY * skinVertex * skinWeight.y;\n\tskinned +\x3d boneMatZ * skinVertex * skinWeight.z;\n\tskinned +\x3d boneMatW * skinVertex * skinWeight.w;\n\ttransformed \x3d ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix \x3d mat4( 0.0 );\n\tskinMatrix +\x3d skinWeight.x * boneMatX;\n\tskinMatrix +\x3d skinWeight.y * boneMatY;\n\tskinMatrix +\x3d skinWeight.z * boneMatZ;\n\tskinMatrix +\x3d skinWeight.w * boneMatW;\n\tskinMatrix  \x3d bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal \x3d vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent \x3d vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",
specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular \x3d texture2D( specularMap, vUv );\n\tspecularStrength \x3d texelSpecular.r;\n#else\n\tspecularStrength \x3d 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb \x3d toneMapping( gl_FragColor.rgb );\n#endif",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 *\x3d 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 *\x3d toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *\x3d toneMappingExposure;\n\tcolor \x3d max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *\x3d toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}",
uv_pars_fragment:"#ifdef USE_UV\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv \x3d ( 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 \x3d uv2;\n#endif",
worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition \x3d modelMatrix * vec4( transformed, 1.0 );\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor \x3d texture2D( t2D, vUv );\n\tgl_FragColor \x3d mapTexelToLinear( texColor );\n\t#include \x3ctonemapping_fragment\x3e\n\t#include \x3cencodings_fragment\x3e\n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv \x3d ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position \x3d vec4( position.xy, 1.0, 1.0 );\n}",
cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor \x3d textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor \x3d mapTexelToLinear( texColor );\n\tgl_FragColor.a *\x3d opacity;\n\t#include \x3ctonemapping_fragment\x3e\n\t#include \x3cencodings_fragment\x3e\n}",cube_vert:"varying vec3 vWorldDirection;\n#include \x3ccommon\x3e\nvoid main() {\n\tvWorldDirection \x3d transformDirection( position, modelMatrix );\n\t#include \x3cbegin_vertex\x3e\n\t#include \x3cproject_vertex\x3e\n\tgl_Position.z \x3d gl_Position.w;\n}",
depth_frag:"#if DEPTH_PACKING \x3d\x3d 3200\n\tuniform float opacity;\n#endif\n#include \x3ccommon\x3e\n#include \x3cpacking\x3e\n#include \x3cuv_pars_fragment\x3e\n#include \x3cmap_pars_fragment\x3e\n#include \x3calphamap_pars_fragment\x3e\n#include \x3clogdepthbuf_pars_fragment\x3e\n#include \x3cclipping_planes_pars_fragment\x3e\nvoid main() {\n\t#include \x3cclipping_planes_fragment\x3e\n\tvec4 diffuseColor \x3d vec4( 1.0 );\n\t#if DEPTH_PACKING \x3d\x3d 3200\n\t\tdiffuseColor.a \x3d opacity;\n\t#endif\n\t#include \x3cmap_fragment\x3e\n\t#include \x3calphamap_fragment\x3e\n\t#include \x3calphatest_fragment\x3e\n\t#include \x3clogdepthbuf_fragment\x3e\n\t#if DEPTH_PACKING \x3d\x3d 3200\n\t\tgl_FragColor \x3d vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING \x3d\x3d 3201\n\t\tgl_FragColor \x3d packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}",
depth_vert:"#include \x3ccommon\x3e\n#include \x3cuv_pars_vertex\x3e\n#include \x3cdisplacementmap_pars_vertex\x3e\n#include \x3cmorphtarget_pars_vertex\x3e\n#include \x3cskinning_pars_vertex\x3e\n#include \x3clogdepthbuf_pars_vertex\x3e\n#include \x3cclipping_planes_pars_vertex\x3e\nvoid main() {\n\t#include \x3cuv_vertex\x3e\n\t#include \x3cskinbase_vertex\x3e\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \x3cbeginnormal_vertex\x3e\n\t\t#include \x3cmorphnormal_vertex\x3e\n\t\t#include \x3cskinnormal_vertex\x3e\n\t#endif\n\t#include \x3cbegin_vertex\x3e\n\t#include \x3cmorphtarget_vertex\x3e\n\t#include \x3cskinning_vertex\x3e\n\t#include \x3cdisplacementmap_vertex\x3e\n\t#include \x3cproject_vertex\x3e\n\t#include \x3clogdepthbuf_vertex\x3e\n\t#include \x3cclipping_planes_vertex\x3e\n}",
distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \x3ccommon\x3e\n#include \x3cpacking\x3e\n#include \x3cuv_pars_fragment\x3e\n#include \x3cmap_pars_fragment\x3e\n#include \x3calphamap_pars_fragment\x3e\n#include \x3cclipping_planes_pars_fragment\x3e\nvoid main () {\n\t#include \x3cclipping_planes_fragment\x3e\n\tvec4 diffuseColor \x3d vec4( 1.0 );\n\t#include \x3cmap_fragment\x3e\n\t#include \x3calphamap_fragment\x3e\n\t#include \x3calphatest_fragment\x3e\n\tfloat dist \x3d length( vWorldPosition - referencePosition );\n\tdist \x3d ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist \x3d saturate( dist );\n\tgl_FragColor \x3d packDepthToRGBA( dist );\n}",
distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \x3ccommon\x3e\n#include \x3cuv_pars_vertex\x3e\n#include \x3cdisplacementmap_pars_vertex\x3e\n#include \x3cmorphtarget_pars_vertex\x3e\n#include \x3cskinning_pars_vertex\x3e\n#include \x3cclipping_planes_pars_vertex\x3e\nvoid main() {\n\t#include \x3cuv_vertex\x3e\n\t#include \x3cskinbase_vertex\x3e\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \x3cbeginnormal_vertex\x3e\n\t\t#include \x3cmorphnormal_vertex\x3e\n\t\t#include \x3cskinnormal_vertex\x3e\n\t#endif\n\t#include \x3cbegin_vertex\x3e\n\t#include \x3cmorphtarget_vertex\x3e\n\t#include \x3cskinning_vertex\x3e\n\t#include \x3cdisplacementmap_vertex\x3e\n\t#include \x3cproject_vertex\x3e\n\t#include \x3cworldpos_vertex\x3e\n\t#include \x3cclipping_planes_vertex\x3e\n\tvWorldPosition \x3d worldPosition.xyz;\n}",
equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \x3ccommon\x3e\nvoid main() {\n\tvec3 direction \x3d normalize( vWorldDirection );\n\tvec2 sampleUV;\n\tsampleUV.y \x3d asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x \x3d atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tvec4 texColor \x3d texture2D( tEquirect, sampleUV );\n\tgl_FragColor \x3d mapTexelToLinear( texColor );\n\t#include \x3ctonemapping_fragment\x3e\n\t#include \x3cencodings_fragment\x3e\n}",
equirect_vert:"varying vec3 vWorldDirection;\n#include \x3ccommon\x3e\nvoid main() {\n\tvWorldDirection \x3d transformDirection( position, modelMatrix );\n\t#include \x3cbegin_vertex\x3e\n\t#include \x3cproject_vertex\x3e\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \x3ccommon\x3e\n#include \x3ccolor_pars_fragment\x3e\n#include \x3cfog_pars_fragment\x3e\n#include \x3clogdepthbuf_pars_fragment\x3e\n#include \x3cclipping_planes_pars_fragment\x3e\nvoid main() {\n\t#include \x3cclipping_planes_fragment\x3e\n\tif ( mod( vLineDistance, totalSize ) \x3e dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight \x3d vec3( 0.0 );\n\tvec4 diffuseColor \x3d vec4( diffuse, opacity );\n\t#include \x3clogdepthbuf_fragment\x3e\n\t#include \x3ccolor_fragment\x3e\n\toutgoingLight \x3d diffuseColor.rgb;\n\tgl_FragColor \x3d vec4( outgoingLight, diffuseColor.a );\n\t#include \x3cpremultiplied_alpha_fragment\x3e\n\t#include \x3ctonemapping_fragment\x3e\n\t#include \x3cencodings_fragment\x3e\n\t#include \x3cfog_fragment\x3e\n}",
linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \x3ccommon\x3e\n#include \x3ccolor_pars_vertex\x3e\n#include \x3cfog_pars_vertex\x3e\n#include \x3clogdepthbuf_pars_vertex\x3e\n#include \x3cclipping_planes_pars_vertex\x3e\nvoid main() {\n\t#include \x3ccolor_vertex\x3e\n\tvLineDistance \x3d scale * lineDistance;\n\tvec4 mvPosition \x3d modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position \x3d projectionMatrix * mvPosition;\n\t#include \x3clogdepthbuf_vertex\x3e\n\t#include \x3cclipping_planes_vertex\x3e\n\t#include \x3cfog_vertex\x3e\n}",
meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \x3ccommon\x3e\n#include \x3ccolor_pars_fragment\x3e\n#include \x3cuv_pars_fragment\x3e\n#include \x3cuv2_pars_fragment\x3e\n#include \x3cmap_pars_fragment\x3e\n#include \x3calphamap_pars_fragment\x3e\n#include \x3caomap_pars_fragment\x3e\n#include \x3clightmap_pars_fragment\x3e\n#include \x3cenvmap_common_pars_fragment\x3e\n#include \x3cenvmap_pars_fragment\x3e\n#include \x3cfog_pars_fragment\x3e\n#include \x3cspecularmap_pars_fragment\x3e\n#include \x3clogdepthbuf_pars_fragment\x3e\n#include \x3cclipping_planes_pars_fragment\x3e\nvoid main() {\n\t#include \x3cclipping_planes_fragment\x3e\n\tvec4 diffuseColor \x3d vec4( diffuse, opacity );\n\t#include \x3clogdepthbuf_fragment\x3e\n\t#include \x3cmap_fragment\x3e\n\t#include \x3ccolor_fragment\x3e\n\t#include \x3calphamap_fragment\x3e\n\t#include \x3calphatest_fragment\x3e\n\t#include \x3cspecularmap_fragment\x3e\n\tReflectedLight reflectedLight \x3d ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse +\x3d texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse +\x3d vec3( 1.0 );\n\t#endif\n\t#include \x3caomap_fragment\x3e\n\treflectedLight.indirectDiffuse *\x3d diffuseColor.rgb;\n\tvec3 outgoingLight \x3d reflectedLight.indirectDiffuse;\n\t#include \x3cenvmap_fragment\x3e\n\tgl_FragColor \x3d vec4( outgoingLight, diffuseColor.a );\n\t#include \x3cpremultiplied_alpha_fragment\x3e\n\t#include \x3ctonemapping_fragment\x3e\n\t#include \x3cencodings_fragment\x3e\n\t#include \x3cfog_fragment\x3e\n}",
meshbasic_vert:"#include \x3ccommon\x3e\n#include \x3cuv_pars_vertex\x3e\n#include \x3cuv2_pars_vertex\x3e\n#include \x3cenvmap_pars_vertex\x3e\n#include \x3ccolor_pars_vertex\x3e\n#include \x3cfog_pars_vertex\x3e\n#include \x3cmorphtarget_pars_vertex\x3e\n#include \x3cskinning_pars_vertex\x3e\n#include \x3clogdepthbuf_pars_vertex\x3e\n#include \x3cclipping_planes_pars_vertex\x3e\nvoid main() {\n\t#include \x3cuv_vertex\x3e\n\t#include \x3cuv2_vertex\x3e\n\t#include \x3ccolor_vertex\x3e\n\t#include \x3cskinbase_vertex\x3e\n\t#ifdef USE_ENVMAP\n\t#include \x3cbeginnormal_vertex\x3e\n\t#include \x3cmorphnormal_vertex\x3e\n\t#include \x3cskinnormal_vertex\x3e\n\t#include \x3cdefaultnormal_vertex\x3e\n\t#endif\n\t#include \x3cbegin_vertex\x3e\n\t#include \x3cmorphtarget_vertex\x3e\n\t#include \x3cskinning_vertex\x3e\n\t#include \x3cproject_vertex\x3e\n\t#include \x3clogdepthbuf_vertex\x3e\n\t#include \x3cworldpos_vertex\x3e\n\t#include \x3cclipping_planes_vertex\x3e\n\t#include \x3cenvmap_vertex\x3e\n\t#include \x3cfog_vertex\x3e\n}",
meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \x3ccommon\x3e\n#include \x3cpacking\x3e\n#include \x3cdithering_pars_fragment\x3e\n#include \x3ccolor_pars_fragment\x3e\n#include \x3cuv_pars_fragment\x3e\n#include \x3cuv2_pars_fragment\x3e\n#include \x3cmap_pars_fragment\x3e\n#include \x3calphamap_pars_fragment\x3e\n#include \x3caomap_pars_fragment\x3e\n#include \x3clightmap_pars_fragment\x3e\n#include \x3cemissivemap_pars_fragment\x3e\n#include \x3cenvmap_common_pars_fragment\x3e\n#include \x3cenvmap_pars_fragment\x3e\n#include \x3cbsdfs\x3e\n#include \x3clights_pars_begin\x3e\n#include \x3cfog_pars_fragment\x3e\n#include \x3cshadowmap_pars_fragment\x3e\n#include \x3cshadowmask_pars_fragment\x3e\n#include \x3cspecularmap_pars_fragment\x3e\n#include \x3clogdepthbuf_pars_fragment\x3e\n#include \x3cclipping_planes_pars_fragment\x3e\nvoid main() {\n\t#include \x3cclipping_planes_fragment\x3e\n\tvec4 diffuseColor \x3d vec4( diffuse, opacity );\n\tReflectedLight reflectedLight \x3d ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance \x3d emissive;\n\t#include \x3clogdepthbuf_fragment\x3e\n\t#include \x3cmap_fragment\x3e\n\t#include \x3ccolor_fragment\x3e\n\t#include \x3calphamap_fragment\x3e\n\t#include \x3calphatest_fragment\x3e\n\t#include \x3cspecularmap_fragment\x3e\n\t#include \x3cemissivemap_fragment\x3e\n\treflectedLight.indirectDiffuse \x3d getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse +\x3d ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse +\x3d vIndirectFront;\n\t#endif\n\t#include \x3clightmap_fragment\x3e\n\treflectedLight.indirectDiffuse *\x3d BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse \x3d ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse \x3d vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *\x3d BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \x3caomap_fragment\x3e\n\tvec3 outgoingLight \x3d reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \x3cenvmap_fragment\x3e\n\tgl_FragColor \x3d vec4( outgoingLight, diffuseColor.a );\n\t#include \x3ctonemapping_fragment\x3e\n\t#include \x3cencodings_fragment\x3e\n\t#include \x3cfog_fragment\x3e\n\t#include \x3cpremultiplied_alpha_fragment\x3e\n\t#include \x3cdithering_fragment\x3e\n}",
meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \x3ccommon\x3e\n#include \x3cuv_pars_vertex\x3e\n#include \x3cuv2_pars_vertex\x3e\n#include \x3cenvmap_pars_vertex\x3e\n#include \x3cbsdfs\x3e\n#include \x3clights_pars_begin\x3e\n#include \x3ccolor_pars_vertex\x3e\n#include \x3cfog_pars_vertex\x3e\n#include \x3cmorphtarget_pars_vertex\x3e\n#include \x3cskinning_pars_vertex\x3e\n#include \x3cshadowmap_pars_vertex\x3e\n#include \x3clogdepthbuf_pars_vertex\x3e\n#include \x3cclipping_planes_pars_vertex\x3e\nvoid main() {\n\t#include \x3cuv_vertex\x3e\n\t#include \x3cuv2_vertex\x3e\n\t#include \x3ccolor_vertex\x3e\n\t#include \x3cbeginnormal_vertex\x3e\n\t#include \x3cmorphnormal_vertex\x3e\n\t#include \x3cskinbase_vertex\x3e\n\t#include \x3cskinnormal_vertex\x3e\n\t#include \x3cdefaultnormal_vertex\x3e\n\t#include \x3cbegin_vertex\x3e\n\t#include \x3cmorphtarget_vertex\x3e\n\t#include \x3cskinning_vertex\x3e\n\t#include \x3cproject_vertex\x3e\n\t#include \x3clogdepthbuf_vertex\x3e\n\t#include \x3cclipping_planes_vertex\x3e\n\t#include \x3cworldpos_vertex\x3e\n\t#include \x3cenvmap_vertex\x3e\n\t#include \x3clights_lambert_vertex\x3e\n\t#include \x3cshadowmap_vertex\x3e\n\t#include \x3cfog_vertex\x3e\n}",
meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \x3ccommon\x3e\n#include \x3cuv_pars_fragment\x3e\n#include \x3cmap_pars_fragment\x3e\n#include \x3calphamap_pars_fragment\x3e\n#include \x3cfog_pars_fragment\x3e\n#include \x3cbumpmap_pars_fragment\x3e\n#include \x3cnormalmap_pars_fragment\x3e\n#include \x3clogdepthbuf_pars_fragment\x3e\n#include \x3cclipping_planes_pars_fragment\x3e\nvoid main() {\n\t#include \x3cclipping_planes_fragment\x3e\n\tvec4 diffuseColor \x3d vec4( diffuse, opacity );\n\t#include \x3clogdepthbuf_fragment\x3e\n\t#include \x3cmap_fragment\x3e\n\t#include \x3calphamap_fragment\x3e\n\t#include \x3calphatest_fragment\x3e\n\t#include \x3cnormal_fragment_begin\x3e\n\t#include \x3cnormal_fragment_maps\x3e\n\tvec3 viewDir \x3d normalize( vViewPosition );\n\tvec3 x \x3d normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y \x3d cross( viewDir, x );\n\tvec2 uv \x3d vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor \x3d texture2D( matcap, uv );\n\t\tmatcapColor \x3d matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor \x3d vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight \x3d diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor \x3d vec4( outgoingLight, diffuseColor.a );\n\t#include \x3cpremultiplied_alpha_fragment\x3e\n\t#include \x3ctonemapping_fragment\x3e\n\t#include \x3cencodings_fragment\x3e\n\t#include \x3cfog_fragment\x3e\n}",
meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \x3ccommon\x3e\n#include \x3cuv_pars_vertex\x3e\n#include \x3cdisplacementmap_pars_vertex\x3e\n#include \x3cfog_pars_vertex\x3e\n#include \x3cmorphtarget_pars_vertex\x3e\n#include \x3cskinning_pars_vertex\x3e\n#include \x3clogdepthbuf_pars_vertex\x3e\n#include \x3cclipping_planes_pars_vertex\x3e\nvoid main() {\n\t#include \x3cuv_vertex\x3e\n\t#include \x3cbeginnormal_vertex\x3e\n\t#include \x3cmorphnormal_vertex\x3e\n\t#include \x3cskinbase_vertex\x3e\n\t#include \x3cskinnormal_vertex\x3e\n\t#include \x3cdefaultnormal_vertex\x3e\n\t#ifndef FLAT_SHADED\n\t\tvNormal \x3d normalize( transformedNormal );\n\t#endif\n\t#include \x3cbegin_vertex\x3e\n\t#include \x3cmorphtarget_vertex\x3e\n\t#include \x3cskinning_vertex\x3e\n\t#include \x3cdisplacementmap_vertex\x3e\n\t#include \x3cproject_vertex\x3e\n\t#include \x3clogdepthbuf_vertex\x3e\n\t#include \x3cclipping_planes_vertex\x3e\n\t#include \x3cfog_vertex\x3e\n\tvViewPosition \x3d - mvPosition.xyz;\n}",
meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \x3ccommon\x3e\n#include \x3cpacking\x3e\n#include \x3cdithering_pars_fragment\x3e\n#include \x3ccolor_pars_fragment\x3e\n#include \x3cuv_pars_fragment\x3e\n#include \x3cuv2_pars_fragment\x3e\n#include \x3cmap_pars_fragment\x3e\n#include \x3calphamap_pars_fragment\x3e\n#include \x3caomap_pars_fragment\x3e\n#include \x3clightmap_pars_fragment\x3e\n#include \x3cemissivemap_pars_fragment\x3e\n#include \x3cenvmap_common_pars_fragment\x3e\n#include \x3cenvmap_pars_fragment\x3e\n#include \x3cgradientmap_pars_fragment\x3e\n#include \x3cfog_pars_fragment\x3e\n#include \x3cbsdfs\x3e\n#include \x3clights_pars_begin\x3e\n#include \x3clights_phong_pars_fragment\x3e\n#include \x3cshadowmap_pars_fragment\x3e\n#include \x3cbumpmap_pars_fragment\x3e\n#include \x3cnormalmap_pars_fragment\x3e\n#include \x3cspecularmap_pars_fragment\x3e\n#include \x3clogdepthbuf_pars_fragment\x3e\n#include \x3cclipping_planes_pars_fragment\x3e\nvoid main() {\n\t#include \x3cclipping_planes_fragment\x3e\n\tvec4 diffuseColor \x3d vec4( diffuse, opacity );\n\tReflectedLight reflectedLight \x3d ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance \x3d emissive;\n\t#include \x3clogdepthbuf_fragment\x3e\n\t#include \x3cmap_fragment\x3e\n\t#include \x3ccolor_fragment\x3e\n\t#include \x3calphamap_fragment\x3e\n\t#include \x3calphatest_fragment\x3e\n\t#include \x3cspecularmap_fragment\x3e\n\t#include \x3cnormal_fragment_begin\x3e\n\t#include \x3cnormal_fragment_maps\x3e\n\t#include \x3cemissivemap_fragment\x3e\n\t#include \x3clights_phong_fragment\x3e\n\t#include \x3clights_fragment_begin\x3e\n\t#include \x3clights_fragment_maps\x3e\n\t#include \x3clights_fragment_end\x3e\n\t#include \x3caomap_fragment\x3e\n\tvec3 outgoingLight \x3d reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \x3cenvmap_fragment\x3e\n\tgl_FragColor \x3d vec4( outgoingLight, diffuseColor.a );\n\t#include \x3ctonemapping_fragment\x3e\n\t#include \x3cencodings_fragment\x3e\n\t#include \x3cfog_fragment\x3e\n\t#include \x3cpremultiplied_alpha_fragment\x3e\n\t#include \x3cdithering_fragment\x3e\n}",
meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \x3ccommon\x3e\n#include \x3cuv_pars_vertex\x3e\n#include \x3cuv2_pars_vertex\x3e\n#include \x3cdisplacementmap_pars_vertex\x3e\n#include \x3cenvmap_pars_vertex\x3e\n#include \x3ccolor_pars_vertex\x3e\n#include \x3cfog_pars_vertex\x3e\n#include \x3cmorphtarget_pars_vertex\x3e\n#include \x3cskinning_pars_vertex\x3e\n#include \x3cshadowmap_pars_vertex\x3e\n#include \x3clogdepthbuf_pars_vertex\x3e\n#include \x3cclipping_planes_pars_vertex\x3e\nvoid main() {\n\t#include \x3cuv_vertex\x3e\n\t#include \x3cuv2_vertex\x3e\n\t#include \x3ccolor_vertex\x3e\n\t#include \x3cbeginnormal_vertex\x3e\n\t#include \x3cmorphnormal_vertex\x3e\n\t#include \x3cskinbase_vertex\x3e\n\t#include \x3cskinnormal_vertex\x3e\n\t#include \x3cdefaultnormal_vertex\x3e\n#ifndef FLAT_SHADED\n\tvNormal \x3d normalize( transformedNormal );\n#endif\n\t#include \x3cbegin_vertex\x3e\n\t#include \x3cmorphtarget_vertex\x3e\n\t#include \x3cskinning_vertex\x3e\n\t#include \x3cdisplacementmap_vertex\x3e\n\t#include \x3cproject_vertex\x3e\n\t#include \x3clogdepthbuf_vertex\x3e\n\t#include \x3cclipping_planes_vertex\x3e\n\tvViewPosition \x3d - mvPosition.xyz;\n\t#include \x3cworldpos_vertex\x3e\n\t#include \x3cenvmap_vertex\x3e\n\t#include \x3cshadowmap_vertex\x3e\n\t#include \x3cfog_vertex\x3e\n}",
meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSPARENCY\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSPARENCY\n\tuniform float transparency;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \x3ccommon\x3e\n#include \x3cpacking\x3e\n#include \x3cdithering_pars_fragment\x3e\n#include \x3ccolor_pars_fragment\x3e\n#include \x3cuv_pars_fragment\x3e\n#include \x3cuv2_pars_fragment\x3e\n#include \x3cmap_pars_fragment\x3e\n#include \x3calphamap_pars_fragment\x3e\n#include \x3caomap_pars_fragment\x3e\n#include \x3clightmap_pars_fragment\x3e\n#include \x3cemissivemap_pars_fragment\x3e\n#include \x3cbsdfs\x3e\n#include \x3ccube_uv_reflection_fragment\x3e\n#include \x3cenvmap_common_pars_fragment\x3e\n#include \x3cenvmap_physical_pars_fragment\x3e\n#include \x3cfog_pars_fragment\x3e\n#include \x3clights_pars_begin\x3e\n#include \x3clights_physical_pars_fragment\x3e\n#include \x3cshadowmap_pars_fragment\x3e\n#include \x3cbumpmap_pars_fragment\x3e\n#include \x3cnormalmap_pars_fragment\x3e\n#include \x3cclearcoat_normalmap_pars_fragment\x3e\n#include \x3croughnessmap_pars_fragment\x3e\n#include \x3cmetalnessmap_pars_fragment\x3e\n#include \x3clogdepthbuf_pars_fragment\x3e\n#include \x3cclipping_planes_pars_fragment\x3e\nvoid main() {\n\t#include \x3cclipping_planes_fragment\x3e\n\tvec4 diffuseColor \x3d vec4( diffuse, opacity );\n\tReflectedLight reflectedLight \x3d ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance \x3d emissive;\n\t#include \x3clogdepthbuf_fragment\x3e\n\t#include \x3cmap_fragment\x3e\n\t#include \x3ccolor_fragment\x3e\n\t#include \x3calphamap_fragment\x3e\n\t#include \x3calphatest_fragment\x3e\n\t#include \x3croughnessmap_fragment\x3e\n\t#include \x3cmetalnessmap_fragment\x3e\n\t#include \x3cnormal_fragment_begin\x3e\n\t#include \x3cnormal_fragment_maps\x3e\n\t#include \x3cclearcoat_normal_fragment_begin\x3e\n\t#include \x3cclearcoat_normal_fragment_maps\x3e\n\t#include \x3cemissivemap_fragment\x3e\n\t#include \x3clights_physical_fragment\x3e\n\t#include \x3clights_fragment_begin\x3e\n\t#include \x3clights_fragment_maps\x3e\n\t#include \x3clights_fragment_end\x3e\n\t#include \x3caomap_fragment\x3e\n\tvec3 outgoingLight \x3d reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSPARENCY\n\t\tdiffuseColor.a *\x3d saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\n\t#endif\n\tgl_FragColor \x3d vec4( outgoingLight, diffuseColor.a );\n\t#include \x3ctonemapping_fragment\x3e\n\t#include \x3cencodings_fragment\x3e\n\t#include \x3cfog_fragment\x3e\n\t#include \x3cpremultiplied_alpha_fragment\x3e\n\t#include \x3cdithering_fragment\x3e\n}",
meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \x3ccommon\x3e\n#include \x3cuv_pars_vertex\x3e\n#include \x3cuv2_pars_vertex\x3e\n#include \x3cdisplacementmap_pars_vertex\x3e\n#include \x3ccolor_pars_vertex\x3e\n#include \x3cfog_pars_vertex\x3e\n#include \x3cmorphtarget_pars_vertex\x3e\n#include \x3cskinning_pars_vertex\x3e\n#include \x3cshadowmap_pars_vertex\x3e\n#include \x3clogdepthbuf_pars_vertex\x3e\n#include \x3cclipping_planes_pars_vertex\x3e\nvoid main() {\n\t#include \x3cuv_vertex\x3e\n\t#include \x3cuv2_vertex\x3e\n\t#include \x3ccolor_vertex\x3e\n\t#include \x3cbeginnormal_vertex\x3e\n\t#include \x3cmorphnormal_vertex\x3e\n\t#include \x3cskinbase_vertex\x3e\n\t#include \x3cskinnormal_vertex\x3e\n\t#include \x3cdefaultnormal_vertex\x3e\n#ifndef FLAT_SHADED\n\tvNormal \x3d normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent \x3d normalize( transformedTangent );\n\t\tvBitangent \x3d normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \x3cbegin_vertex\x3e\n\t#include \x3cmorphtarget_vertex\x3e\n\t#include \x3cskinning_vertex\x3e\n\t#include \x3cdisplacementmap_vertex\x3e\n\t#include \x3cproject_vertex\x3e\n\t#include \x3clogdepthbuf_vertex\x3e\n\t#include \x3cclipping_planes_vertex\x3e\n\tvViewPosition \x3d - mvPosition.xyz;\n\t#include \x3cworldpos_vertex\x3e\n\t#include \x3cshadowmap_vertex\x3e\n\t#include \x3cfog_vertex\x3e\n}",
normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \x3cpacking\x3e\n#include \x3cuv_pars_fragment\x3e\n#include \x3cbumpmap_pars_fragment\x3e\n#include \x3cnormalmap_pars_fragment\x3e\n#include \x3clogdepthbuf_pars_fragment\x3e\n#include \x3cclipping_planes_pars_fragment\x3e\nvoid main() {\n\t#include \x3cclipping_planes_fragment\x3e\n\t#include \x3clogdepthbuf_fragment\x3e\n\t#include \x3cnormal_fragment_begin\x3e\n\t#include \x3cnormal_fragment_maps\x3e\n\tgl_FragColor \x3d vec4( packNormalToRGB( normal ), opacity );\n}",
normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \x3cuv_pars_vertex\x3e\n#include \x3cdisplacementmap_pars_vertex\x3e\n#include \x3cmorphtarget_pars_vertex\x3e\n#include \x3cskinning_pars_vertex\x3e\n#include \x3clogdepthbuf_pars_vertex\x3e\n#include \x3cclipping_planes_pars_vertex\x3e\nvoid main() {\n\t#include \x3cuv_vertex\x3e\n\t#include \x3cbeginnormal_vertex\x3e\n\t#include \x3cmorphnormal_vertex\x3e\n\t#include \x3cskinbase_vertex\x3e\n\t#include \x3cskinnormal_vertex\x3e\n\t#include \x3cdefaultnormal_vertex\x3e\n#ifndef FLAT_SHADED\n\tvNormal \x3d normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent \x3d normalize( transformedTangent );\n\t\tvBitangent \x3d normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \x3cbegin_vertex\x3e\n\t#include \x3cmorphtarget_vertex\x3e\n\t#include \x3cskinning_vertex\x3e\n\t#include \x3cdisplacementmap_vertex\x3e\n\t#include \x3cproject_vertex\x3e\n\t#include \x3clogdepthbuf_vertex\x3e\n\t#include \x3cclipping_planes_vertex\x3e\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition \x3d - mvPosition.xyz;\n#endif\n}",
points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \x3ccommon\x3e\n#include \x3ccolor_pars_fragment\x3e\n#include \x3cmap_particle_pars_fragment\x3e\n#include \x3cfog_pars_fragment\x3e\n#include \x3clogdepthbuf_pars_fragment\x3e\n#include \x3cclipping_planes_pars_fragment\x3e\nvoid main() {\n\t#include \x3cclipping_planes_fragment\x3e\n\tvec3 outgoingLight \x3d vec3( 0.0 );\n\tvec4 diffuseColor \x3d vec4( diffuse, opacity );\n\t#include \x3clogdepthbuf_fragment\x3e\n\t#include \x3cmap_particle_fragment\x3e\n\t#include \x3ccolor_fragment\x3e\n\t#include \x3calphatest_fragment\x3e\n\toutgoingLight \x3d diffuseColor.rgb;\n\tgl_FragColor \x3d vec4( outgoingLight, diffuseColor.a );\n\t#include \x3cpremultiplied_alpha_fragment\x3e\n\t#include \x3ctonemapping_fragment\x3e\n\t#include \x3cencodings_fragment\x3e\n\t#include \x3cfog_fragment\x3e\n}",
points_vert:"uniform float size;\nuniform float scale;\n#include \x3ccommon\x3e\n#include \x3ccolor_pars_vertex\x3e\n#include \x3cfog_pars_vertex\x3e\n#include \x3cmorphtarget_pars_vertex\x3e\n#include \x3clogdepthbuf_pars_vertex\x3e\n#include \x3cclipping_planes_pars_vertex\x3e\nvoid main() {\n\t#include \x3ccolor_vertex\x3e\n\t#include \x3cbegin_vertex\x3e\n\t#include \x3cmorphtarget_vertex\x3e\n\t#include \x3cproject_vertex\x3e\n\tgl_PointSize \x3d size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective \x3d ( projectionMatrix[ 2 ][ 3 ] \x3d\x3d - 1.0 );\n\t\tif ( isPerspective ) gl_PointSize *\x3d ( scale / - mvPosition.z );\n\t#endif\n\t#include \x3clogdepthbuf_vertex\x3e\n\t#include \x3cclipping_planes_vertex\x3e\n\t#include \x3cworldpos_vertex\x3e\n\t#include \x3cfog_vertex\x3e\n}",
shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \x3ccommon\x3e\n#include \x3cpacking\x3e\n#include \x3cfog_pars_fragment\x3e\n#include \x3cbsdfs\x3e\n#include \x3clights_pars_begin\x3e\n#include \x3cshadowmap_pars_fragment\x3e\n#include \x3cshadowmask_pars_fragment\x3e\nvoid main() {\n\tgl_FragColor \x3d vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \x3cfog_fragment\x3e\n}",shadow_vert:"#include \x3cfog_pars_vertex\x3e\n#include \x3cshadowmap_pars_vertex\x3e\nvoid main() {\n\t#include \x3cbegin_vertex\x3e\n\t#include \x3cproject_vertex\x3e\n\t#include \x3cworldpos_vertex\x3e\n\t#include \x3cshadowmap_vertex\x3e\n\t#include \x3cfog_vertex\x3e\n}",
sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \x3ccommon\x3e\n#include \x3cuv_pars_fragment\x3e\n#include \x3cmap_pars_fragment\x3e\n#include \x3cfog_pars_fragment\x3e\n#include \x3clogdepthbuf_pars_fragment\x3e\n#include \x3cclipping_planes_pars_fragment\x3e\nvoid main() {\n\t#include \x3cclipping_planes_fragment\x3e\n\tvec3 outgoingLight \x3d vec3( 0.0 );\n\tvec4 diffuseColor \x3d vec4( diffuse, opacity );\n\t#include \x3clogdepthbuf_fragment\x3e\n\t#include \x3cmap_fragment\x3e\n\t#include \x3calphatest_fragment\x3e\n\toutgoingLight \x3d diffuseColor.rgb;\n\tgl_FragColor \x3d vec4( outgoingLight, diffuseColor.a );\n\t#include \x3ctonemapping_fragment\x3e\n\t#include \x3cencodings_fragment\x3e\n\t#include \x3cfog_fragment\x3e\n}",
sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \x3ccommon\x3e\n#include \x3cuv_pars_vertex\x3e\n#include \x3cfog_pars_vertex\x3e\n#include \x3clogdepthbuf_pars_vertex\x3e\n#include \x3cclipping_planes_pars_vertex\x3e\nvoid main() {\n\t#include \x3cuv_vertex\x3e\n\tvec4 mvPosition \x3d modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x \x3d length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y \x3d length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective \x3d ( projectionMatrix[ 2 ][ 3 ] \x3d\x3d - 1.0 );\n\t\tif ( isPerspective ) scale *\x3d - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition \x3d ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x \x3d cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y \x3d sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy +\x3d rotatedPosition;\n\tgl_Position \x3d projectionMatrix * mvPosition;\n\t#include \x3clogdepthbuf_vertex\x3e\n\t#include \x3cclipping_planes_vertex\x3e\n\t#include \x3cfog_vertex\x3e\n}"},
Ca={common:{diffuse:{value:new ca(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new v},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 k(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:2.5E-4},fogNear:{value:1},fogFar:{value:2E3},fogColor:{value:new ca(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{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 ca(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},uvTransform:{value:new v}},sprite:{diffuse:{value:new ca(15658734)},opacity:{value:1},center:{value:new k(.5,.5)},rotation:{value:0},map:{value:null},uvTransform:{value:new v}}},
Ec={basic:{uniforms:xb([Ca.common,Ca.specularmap,Ca.envmap,Ca.aomap,Ca.lightmap,Ca.fog]),vertexShader:ab.meshbasic_vert,fragmentShader:ab.meshbasic_frag},lambert:{uniforms:xb([Ca.common,Ca.specularmap,Ca.envmap,Ca.aomap,Ca.lightmap,Ca.emissivemap,Ca.fog,Ca.lights,{emissive:{value:new ca(0)}}]),vertexShader:ab.meshlambert_vert,fragmentShader:ab.meshlambert_frag},phong:{uniforms:xb([Ca.common,Ca.specularmap,Ca.envmap,Ca.aomap,Ca.lightmap,Ca.emissivemap,Ca.bumpmap,Ca.normalmap,Ca.displacementmap,Ca.gradientmap,
Ca.fog,Ca.lights,{emissive:{value:new ca(0)},specular:{value:new ca(1118481)},shininess:{value:30}}]),vertexShader:ab.meshphong_vert,fragmentShader:ab.meshphong_frag},standard:{uniforms:xb([Ca.common,Ca.envmap,Ca.aomap,Ca.lightmap,Ca.emissivemap,Ca.bumpmap,Ca.normalmap,Ca.displacementmap,Ca.roughnessmap,Ca.metalnessmap,Ca.fog,Ca.lights,{emissive:{value:new ca(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:ab.meshphysical_vert,fragmentShader:ab.meshphysical_frag},
matcap:{uniforms:xb([Ca.common,Ca.bumpmap,Ca.normalmap,Ca.displacementmap,Ca.fog,{matcap:{value:null}}]),vertexShader:ab.meshmatcap_vert,fragmentShader:ab.meshmatcap_frag},points:{uniforms:xb([Ca.points,Ca.fog]),vertexShader:ab.points_vert,fragmentShader:ab.points_frag},dashed:{uniforms:xb([Ca.common,Ca.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ab.linedashed_vert,fragmentShader:ab.linedashed_frag},depth:{uniforms:xb([Ca.common,Ca.displacementmap]),vertexShader:ab.depth_vert,
fragmentShader:ab.depth_frag},normal:{uniforms:xb([Ca.common,Ca.bumpmap,Ca.normalmap,Ca.displacementmap,{opacity:{value:1}}]),vertexShader:ab.normal_vert,fragmentShader:ab.normal_frag},sprite:{uniforms:xb([Ca.sprite,Ca.fog]),vertexShader:ab.sprite_vert,fragmentShader:ab.sprite_frag},background:{uniforms:{uvTransform:{value:new v},t2D:{value:null}},vertexShader:ab.background_vert,fragmentShader:ab.background_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ab.cube_vert,
fragmentShader:ab.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ab.equirect_vert,fragmentShader:ab.equirect_frag},distanceRGBA:{uniforms:xb([Ca.common,Ca.displacementmap,{referencePosition:{value:new p},nearDistance:{value:1},farDistance:{value:1E3}}]),vertexShader:ab.distanceRGBA_vert,fragmentShader:ab.distanceRGBA_frag},shadow:{uniforms:xb([Ca.lights,Ca.fog,{color:{value:new ca(0)},opacity:{value:1}}]),vertexShader:ab.shadow_vert,fragmentShader:ab.shadow_frag}};Ec.physical=
{uniforms:xb([Ec.standard.uniforms,{transparency:{value:0},clearcoat:{value:0},clearcoatRoughness:{value:0},sheen:{value:new ca(0)},clearcoatNormalScale:{value:new k(1,1)},clearcoatNormalMap:{value:null}}]),vertexShader:ab.meshphysical_vert,fragmentShader:ab.meshphysical_frag};fd.prototype=Object.create(Ia.prototype);fd.prototype.constructor=fd;Dc.prototype=Object.create(la.prototype);Dc.prototype.constructor=Dc;Tc.prototype=Object.create(z.prototype);Tc.prototype.constructor=Tc;Tc.prototype.isCubeTexture=
!0;Object.defineProperty(Tc.prototype,"images",{get:function(){return this.image},set:function(a){this.image=a}});de.prototype=Object.create(z.prototype);de.prototype.constructor=de;de.prototype.isDataTexture2DArray=!0;ee.prototype=Object.create(z.prototype);ee.prototype.constructor=ee;ee.prototype.isDataTexture3D=!0;var Ii=new z,zk=new de,Bk=new ee,Ji=new Tc,Ci=[],Ei=[],Hi=new Float32Array(16),Gi=new Float32Array(9),Fi=new Float32Array(4);Ki.prototype.updateCache=function(a){var b=this.cache;a instanceof
Float32Array&&b.length!==a.length&&(this.cache=new Float32Array(a.length));bc(b,a)};Li.prototype.setValue=function(a,b,c){for(var d=this.seq,f=0,g=d.length;f!==g;++f){var h=d[f];h.setValue(a,b[h.id],c)}};var qh=/([\w\d_]+)(\])?(\[|\.)?/g;id.prototype.setValue=function(a,b,c,d){b=this.map[b];void 0!==b&&b.setValue(a,c,d)};id.prototype.setOptional=function(a,b,c){b=b[c];void 0!==b&&this.setValue(a,c,b)};id.upload=function(a,b,c,d){for(var f=0,g=b.length;f!==g;++f){var h=b[f],l=c[h.id];!1!==l.needsUpdate&&
h.setValue(a,l.value,d)}};id.seqWithValue=function(a,b){for(var c=[],d=0,f=a.length;d!==f;++d){var g=a[d];g.id in b&&c.push(g)}return c};var el=0,nl=0;jd.prototype=Object.create(xa.prototype);jd.prototype.constructor=jd;jd.prototype.isMeshDepthMaterial=!0;jd.prototype.copy=function(a){xa.prototype.copy.call(this,a);this.depthPacking=a.depthPacking;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.map=a.map;this.alphaMap=a.alphaMap;this.displacementMap=a.displacementMap;this.displacementScale=
a.displacementScale;this.displacementBias=a.displacementBias;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;return this};kd.prototype=Object.create(xa.prototype);kd.prototype.constructor=kd;kd.prototype.isMeshDistanceMaterial=!0;kd.prototype.copy=function(a){xa.prototype.copy.call(this,a);this.referencePosition.copy(a.referencePosition);this.nearDistance=a.nearDistance;this.farDistance=a.farDistance;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.map=a.map;
this.alphaMap=a.alphaMap;this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;return this};ge.prototype=Object.assign(Object.create(I.prototype),{constructor:ge,isGroup:!0});df.prototype=Object.assign(Object.create(kb.prototype),{constructor:df,isArrayCamera:!0});var Yi=new p,Zi=new p;Object.assign(sh.prototype,r.prototype);Object.assign($i.prototype,r.prototype);Object.assign(ig.prototype,{isFogExp2:!0,clone:function(){return new ig(this.color,
this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}});Object.assign(jg.prototype,{isFog:!0,clone:function(){return new jg(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}});Object.defineProperty(Dd.prototype,"needsUpdate",{set:function(a){!0===a&&this.version++}});Object.assign(Dd.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setArray:function(a){if(Array.isArray(a))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");
this.count=void 0!==a?a.length/this.stride:0;this.array=a;return this},setDynamic:function(a){this.dynamic=a;return this},copy:function(a){this.array=new a.array.constructor(a.array);this.count=a.count;this.stride=a.stride;this.dynamic=a.dynamic;return this},copyAt:function(a,b,c){a*=this.stride;c*=b.stride;for(var d=0,f=this.stride;d<f;d++)this.array[a+d]=b.array[c+d];return this},set:function(a,b){void 0===b&&(b=0);this.array.set(a,b);return this},clone:function(){return(new this.constructor).copy(this)},
onUpload:function(a){this.onUploadCallback=a;return this}});Object.defineProperties(ff.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}});Object.assign(ff.prototype,{isInterleavedBufferAttribute:!0,setX:function(a,b){this.data.array[a*this.data.stride+this.offset]=b;return this},setY:function(a,b){this.data.array[a*this.data.stride+this.offset+1]=b;return this},setZ:function(a,b){this.data.array[a*this.data.stride+this.offset+2]=b;return this},
setW:function(a,b){this.data.array[a*this.data.stride+this.offset+3]=b;return this},getX:function(a){return this.data.array[a*this.data.stride+this.offset]},getY:function(a){return this.data.array[a*this.data.stride+this.offset+1]},getZ:function(a){return this.data.array[a*this.data.stride+this.offset+2]},getW:function(a){return this.data.array[a*this.data.stride+this.offset+3]},setXY:function(a,b,c){a=a*this.data.stride+this.offset;this.data.array[a+0]=b;this.data.array[a+1]=c;return this},setXYZ:function(a,
b,c,d){a=a*this.data.stride+this.offset;this.data.array[a+0]=b;this.data.array[a+1]=c;this.data.array[a+2]=d;return this},setXYZW:function(a,b,c,d,f){a=a*this.data.stride+this.offset;this.data.array[a+0]=b;this.data.array[a+1]=c;this.data.array[a+2]=d;this.data.array[a+3]=f;return this}});od.prototype=Object.create(xa.prototype);od.prototype.constructor=od;od.prototype.isSpriteMaterial=!0;od.prototype.copy=function(a){xa.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.rotation=
a.rotation;this.sizeAttenuation=a.sizeAttenuation;return this};var me,Xf=new p,Ze=new p,$e=new p,ne=new k,hf=new k,ej=new A,$g=new p,Yf=new p,ah=new p,Jj=new k,pi=new k,Kj=new k;gf.prototype=Object.assign(Object.create(I.prototype),{constructor:gf,isSprite:!0,raycast:function(a,b){null===a.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.');Ze.setFromMatrixScale(this.matrixWorld);ej.copy(a.camera.matrixWorld);this.modelViewMatrix.multiplyMatrices(a.camera.matrixWorldInverse,
this.matrixWorld);$e.setFromMatrixPosition(this.modelViewMatrix);a.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Ze.multiplyScalar(-$e.z);var c=this.material.rotation;if(0!==c){var d=Math.cos(c);var f=Math.sin(c)}c=this.center;kg($g.set(-.5,-.5,0),$e,c,Ze,f,d);kg(Yf.set(.5,-.5,0),$e,c,Ze,f,d);kg(ah.set(.5,.5,0),$e,c,Ze,f,d);Jj.set(0,0);pi.set(1,0);Kj.set(1,1);var g=a.ray.intersectTriangle($g,Yf,ah,!1,Xf);if(null===g&&(kg(Yf.set(-.5,.5,0),$e,c,Ze,f,d),pi.set(0,1),g=a.ray.intersectTriangle($g,
ah,Yf,!1,Xf),null===g))return;f=a.ray.origin.distanceTo(Xf);f<a.near||f>a.far||b.push({distance:f,point:Xf.clone(),uv:ja.getUV(Xf,$g,Yf,ah,Jj,pi,Kj,new k),face:null,object:this})},clone:function(){return(new this.constructor(this.material)).copy(this)},copy:function(a){I.prototype.copy.call(this,a);void 0!==a.center&&this.center.copy(a.center);return this}});var bh=new p,Lj=new p;jf.prototype=Object.assign(Object.create(I.prototype),{constructor:jf,isLOD:!0,copy:function(a){I.prototype.copy.call(this,
a,!1);a=a.levels;for(var b=0,c=a.length;b<c;b++){var d=a[b];this.addLevel(d.object.clone(),d.distance)}return this},addLevel:function(a,b){void 0===b&&(b=0);b=Math.abs(b);for(var c=this.levels,d=0;d<c.length&&!(b<c[d].distance);d++);c.splice(d,0,{distance:b,object:a});this.add(a);return this},getObjectForDistance:function(a){for(var b=this.levels,c=1,d=b.length;c<d&&!(a<b[c].distance);c++);return b[c-1].object},raycast:function(a,b){bh.setFromMatrixPosition(this.matrixWorld);this.getObjectForDistance(a.ray.origin.distanceTo(bh)).raycast(a,
b)},update:function(a){var b=this.levels;if(1<b.length){bh.setFromMatrixPosition(a.matrixWorld);Lj.setFromMatrixPosition(this.matrixWorld);a=bh.distanceTo(Lj);b[0].object.visible=!0;for(var c=1,d=b.length;c<d;c++)if(a>=b[c].distance)b[c-1].object.visible=!1,b[c].object.visible=!0;else break;for(;c<d;c++)b[c].object.visible=!1}},toJSON:function(a){a=I.prototype.toJSON.call(this,a);a.object.levels=[];for(var b=this.levels,c=0,d=b.length;c<d;c++){var f=b[c];a.object.levels.push({object:f.object.uuid,
distance:f.distance})}return a}});kf.prototype=Object.assign(Object.create(Oa.prototype),{constructor:kf,isSkinnedMesh:!0,bind:function(a,b){this.skeleton=a;void 0===b&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),b=this.matrixWorld);this.bindMatrix.copy(b);this.bindMatrixInverse.getInverse(b)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){for(var a=new E,b=this.geometry.attributes.skinWeight,c=0,d=b.count;c<d;c++){a.x=b.getX(c);a.y=b.getY(c);a.z=b.getZ(c);
a.w=b.getW(c);var f=1/a.manhattanLength();Infinity!==f?a.multiplyScalar(f):a.set(1,0,0,0);b.setXYZW(c,a.x,a.y,a.z,a.w)}},updateMatrixWorld:function(a){Oa.prototype.updateMatrixWorld.call(this,a);"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)}});
var Mj=new A,cm=new A;Object.assign(lg.prototype,{calculateInverses:function(){this.boneInverses=[];for(var a=0,b=this.bones.length;a<b;a++){var c=new A;this.bones[a]&&c.getInverse(this.bones[a].matrixWorld);this.boneInverses.push(c)}},pose:function(){var a,b;var c=0;for(b=this.bones.length;c<b;c++)(a=this.bones[c])&&a.matrixWorld.getInverse(this.boneInverses[c]);c=0;for(b=this.bones.length;c<b;c++)if(a=this.bones[c])a.parent&&a.parent.isBone?(a.matrix.getInverse(a.parent.matrixWorld),a.matrix.multiply(a.matrixWorld)):
a.matrix.copy(a.matrixWorld),a.matrix.decompose(a.position,a.quaternion,a.scale)},update:function(){for(var a=this.bones,b=this.boneInverses,c=this.boneMatrices,d=this.boneTexture,f=0,g=a.length;f<g;f++)Mj.multiplyMatrices(a[f]?a[f].matrixWorld:cm,b[f]),Mj.toArray(c,16*f);void 0!==d&&(d.needsUpdate=!0)},clone:function(){return new lg(this.bones,this.boneInverses)},getBoneByName:function(a){for(var b=0,c=this.bones.length;b<c;b++){var d=this.bones[b];if(d.name===a)return d}}});zh.prototype=Object.assign(Object.create(I.prototype),
{constructor:zh,isBone:!0});lb.prototype=Object.create(xa.prototype);lb.prototype.constructor=lb;lb.prototype.isLineBasicMaterial=!0;lb.prototype.copy=function(a){xa.prototype.copy.call(this,a);this.color.copy(a.color);this.linewidth=a.linewidth;this.linecap=a.linecap;this.linejoin=a.linejoin;return this};var Nj=new p,Oj=new p,Pj=new A,ch=new ba,Zf=new U;Ib.prototype=Object.assign(Object.create(I.prototype),{constructor:Ib,isLine:!0,computeLineDistances:function(){var a=this.geometry;if(a.isBufferGeometry)if(null===
a.index){for(var b=a.attributes.position,c=[0],d=1,f=b.count;d<f;d++)Nj.fromBufferAttribute(b,d-1),Oj.fromBufferAttribute(b,d),c[d]=c[d-1],c[d]+=Nj.distanceTo(Oj);a.addAttribute("lineDistance",new ia(c,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(a.isGeometry)for(b=a.vertices,c=a.lineDistances,c[0]=0,d=1,f=b.length;d<f;d++)c[d]=c[d-1],c[d]+=b[d-1].distanceTo(b[d]);return this},raycast:function(a,b){var c=a.linePrecision,
d=this.geometry,f=this.matrixWorld;null===d.boundingSphere&&d.computeBoundingSphere();Zf.copy(d.boundingSphere);Zf.applyMatrix4(f);Zf.radius+=c;if(!1!==a.ray.intersectsSphere(Zf)){Pj.getInverse(f);ch.copy(a.ray).applyMatrix4(Pj);c/=(this.scale.x+this.scale.y+this.scale.z)/3;c*=c;var g=new p,h=new p;f=new p;var l=new p,m=this&&this.isLineSegments?2:1;if(d.isBufferGeometry){var q=d.index,u=d.attributes.position.array;if(null!==q){q=q.array;d=0;for(var w=q.length-1;d<w;d+=m){var y=q[d+1];g.fromArray(u,
3*q[d]);h.fromArray(u,3*y);y=ch.distanceSqToSegment(g,h,l,f);y>c||(l.applyMatrix4(this.matrixWorld),y=a.ray.origin.distanceTo(l),y<a.near||y>a.far||b.push({distance:y,point:f.clone().applyMatrix4(this.matrixWorld),index:d,face:null,faceIndex:null,object:this}))}}else for(d=0,w=u.length/3-1;d<w;d+=m)g.fromArray(u,3*d),h.fromArray(u,3*d+3),y=ch.distanceSqToSegment(g,h,l,f),y>c||(l.applyMatrix4(this.matrixWorld),y=a.ray.origin.distanceTo(l),y<a.near||y>a.far||b.push({distance:y,point:f.clone().applyMatrix4(this.matrixWorld),
index:d,face:null,faceIndex:null,object:this}))}else if(d.isGeometry)for(g=d.vertices,h=g.length,d=0;d<h-1;d+=m)y=ch.distanceSqToSegment(g[d],g[d+1],l,f),y>c||(l.applyMatrix4(this.matrixWorld),y=a.ray.origin.distanceTo(l),y<a.near||y>a.far||b.push({distance:y,point:f.clone().applyMatrix4(this.matrixWorld),index:d,face:null,faceIndex:null,object:this}))}},clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});var dh=new p,eh=new p;pb.prototype=Object.assign(Object.create(Ib.prototype),
{constructor:pb,isLineSegments:!0,computeLineDistances:function(){var a=this.geometry;if(a.isBufferGeometry)if(null===a.index){for(var b=a.attributes.position,c=[],d=0,f=b.count;d<f;d+=2)dh.fromBufferAttribute(b,d),eh.fromBufferAttribute(b,d+1),c[d]=0===d?0:c[d-1],c[d+1]=c[d]+dh.distanceTo(eh);a.addAttribute("lineDistance",new ia(c,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(a.isGeometry)for(b=a.vertices,c=
a.lineDistances,d=0,f=b.length;d<f;d+=2)dh.copy(b[d]),eh.copy(b[d+1]),c[d]=0===d?0:c[d-1],c[d+1]=c[d]+dh.distanceTo(eh);return this}});mg.prototype=Object.assign(Object.create(Ib.prototype),{constructor:mg,isLineLoop:!0});qc.prototype=Object.create(xa.prototype);qc.prototype.constructor=qc;qc.prototype.isPointsMaterial=!0;qc.prototype.copy=function(a){xa.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.size=a.size;this.sizeAttenuation=a.sizeAttenuation;this.morphTargets=a.morphTargets;
return this};var Qj=new A,Bh=new ba,$f=new U,fh=new p;oe.prototype=Object.assign(Object.create(I.prototype),{constructor:oe,isPoints:!0,raycast:function(a,b){var c=this.geometry,d=this.matrixWorld,f=a.params.Points.threshold;null===c.boundingSphere&&c.computeBoundingSphere();$f.copy(c.boundingSphere);$f.applyMatrix4(d);$f.radius+=f;if(!1!==a.ray.intersectsSphere($f))if(Qj.getInverse(d),Bh.copy(a.ray).applyMatrix4(Qj),f/=(this.scale.x+this.scale.y+this.scale.z)/3,f*=f,c.isBufferGeometry){var g=c.index;
c=c.attributes.position.array;if(null!==g){var h=g.array;g=0;for(var l=h.length;g<l;g++){var m=h[g];fh.fromArray(c,3*m);Ah(fh,m,f,d,a,b,this)}}else for(g=0,h=c.length/3;g<h;g++)fh.fromArray(c,3*g),Ah(fh,g,f,d,a,b,this)}else for(c=c.vertices,g=0,h=c.length;g<h;g++)Ah(c[g],g,f,d,a,b,this)},updateMorphTargets:function(){var a=this.geometry;if(a.isBufferGeometry){a=a.morphAttributes;var b=Object.keys(a);if(0<b.length){var c=a[b[0]];if(void 0!==c)for(this.morphTargetInfluences=[],this.morphTargetDictionary=
{},a=0,b=c.length;a<b;a++){var d=c[a].name||String(a);this.morphTargetInfluences.push(0);this.morphTargetDictionary[d]=a}}}else a=a.morphTargets,void 0!==a&&0<a.length&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")},clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});Ch.prototype=Object.assign(Object.create(z.prototype),{constructor:Ch,isVideoTexture:!0,update:function(){var a=this.image;a.readyState>=
a.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}});pe.prototype=Object.create(z.prototype);pe.prototype.constructor=pe;pe.prototype.isCompressedTexture=!0;lf.prototype=Object.create(z.prototype);lf.prototype.constructor=lf;lf.prototype.isCanvasTexture=!0;mf.prototype=Object.create(z.prototype);mf.prototype.constructor=mf;mf.prototype.isDepthTexture=!0;qe.prototype=Object.create(la.prototype);qe.prototype.constructor=qe;nf.prototype=Object.create(Ia.prototype);nf.prototype.constructor=nf;re.prototype=Object.create(la.prototype);
re.prototype.constructor=re;of.prototype=Object.create(Ia.prototype);of.prototype.constructor=of;Xb.prototype=Object.create(la.prototype);Xb.prototype.constructor=Xb;pf.prototype=Object.create(Ia.prototype);pf.prototype.constructor=pf;se.prototype=Object.create(Xb.prototype);se.prototype.constructor=se;qf.prototype=Object.create(Ia.prototype);qf.prototype.constructor=qf;Ed.prototype=Object.create(Xb.prototype);Ed.prototype.constructor=Ed;rf.prototype=Object.create(Ia.prototype);rf.prototype.constructor=
rf;te.prototype=Object.create(Xb.prototype);te.prototype.constructor=te;sf.prototype=Object.create(Ia.prototype);sf.prototype.constructor=sf;ue.prototype=Object.create(Xb.prototype);ue.prototype.constructor=ue;uf.prototype=Object.create(Ia.prototype);uf.prototype.constructor=uf;Fd.prototype=Object.create(la.prototype);Fd.prototype.constructor=Fd;Fd.prototype.toJSON=function(){var a=la.prototype.toJSON.call(this);a.path=this.parameters.path.toJSON();return a};vf.prototype=Object.create(Ia.prototype);
vf.prototype.constructor=vf;ve.prototype=Object.create(la.prototype);ve.prototype.constructor=ve;wf.prototype=Object.create(Ia.prototype);wf.prototype.constructor=wf;we.prototype=Object.create(la.prototype);we.prototype.constructor=we;var dm={triangulate:function(a,b,c){c=c||2;var d=b&&b.length,f=d?b[0]*c:a.length,g=fj(a,0,f,c,!0),h=[];if(!g||g.next===g.prev)return h;d&&(g=yl(a,b,g,c));if(a.length>80*c){var l=b=a[0];var m=d=a[1];for(var q=c;q<f;q+=c){var u=a[q];var w=a[q+1];u<l&&(l=u);w<m&&(m=w);
u>b&&(b=u);w>d&&(d=w)}u=Math.max(b-l,d-m);u=0!==u?1/u:0}zf(g,h,c,l,m,u);return h}},Vc={area:function(a){for(var b=a.length,c=0,d=b-1,f=0;f<b;d=f++)c+=a[d].x*a[f].y-a[f].x*a[d].y;return.5*c},isClockWise:function(a){return 0>Vc.area(a)},triangulateShape:function(a,b){var c=[],d=[],f=[];jj(a);kj(c,a);var g=a.length;b.forEach(jj);for(a=0;a<b.length;a++)d.push(g),g+=b[a].length,kj(c,b[a]);b=dm.triangulate(c,d);for(a=0;a<b.length;a+=3)f.push(b.slice(a,a+3));return f}};Hd.prototype=Object.create(Ia.prototype);
Hd.prototype.constructor=Hd;Hd.prototype.toJSON=function(){var a=Ia.prototype.toJSON.call(this);return lj(this.parameters.shapes,this.parameters.options,a)};Jc.prototype=Object.create(la.prototype);Jc.prototype.constructor=Jc;Jc.prototype.toJSON=function(){var a=la.prototype.toJSON.call(this);return lj(this.parameters.shapes,this.parameters.options,a)};var Gl={generateTopUV:function(a,b,c,d,f){a=b[3*d];d=b[3*d+1];var g=b[3*f];f=b[3*f+1];return[new k(b[3*c],b[3*c+1]),new k(a,d),new k(g,f)]},generateSideWallUV:function(a,
b,c,d,f,g){a=b[3*c];var h=b[3*c+1];c=b[3*c+2];var l=b[3*d],m=b[3*d+1];d=b[3*d+2];var q=b[3*f],u=b[3*f+1];f=b[3*f+2];var w=b[3*g],y=b[3*g+1];b=b[3*g+2];return.01>Math.abs(h-m)?[new k(a,1-c),new k(l,1-d),new k(q,1-f),new k(w,1-b)]:[new k(h,1-c),new k(m,1-d),new k(u,1-f),new k(y,1-b)]}};Bf.prototype=Object.create(Ia.prototype);Bf.prototype.constructor=Bf;ye.prototype=Object.create(Jc.prototype);ye.prototype.constructor=ye;Cf.prototype=Object.create(Ia.prototype);Cf.prototype.constructor=Cf;pd.prototype=
Object.create(la.prototype);pd.prototype.constructor=pd;Df.prototype=Object.create(Ia.prototype);Df.prototype.constructor=Df;ze.prototype=Object.create(la.prototype);ze.prototype.constructor=ze;Ef.prototype=Object.create(Ia.prototype);Ef.prototype.constructor=Ef;Ae.prototype=Object.create(la.prototype);Ae.prototype.constructor=Ae;Id.prototype=Object.create(Ia.prototype);Id.prototype.constructor=Id;Id.prototype.toJSON=function(){var a=Ia.prototype.toJSON.call(this);return mj(this.parameters.shapes,
a)};Jd.prototype=Object.create(la.prototype);Jd.prototype.constructor=Jd;Jd.prototype.toJSON=function(){var a=la.prototype.toJSON.call(this);return mj(this.parameters.shapes,a)};Be.prototype=Object.create(la.prototype);Be.prototype.constructor=Be;Kd.prototype=Object.create(Ia.prototype);Kd.prototype.constructor=Kd;Wc.prototype=Object.create(la.prototype);Wc.prototype.constructor=Wc;Ff.prototype=Object.create(Kd.prototype);Ff.prototype.constructor=Ff;Gf.prototype=Object.create(Wc.prototype);Gf.prototype.constructor=
Gf;Hf.prototype=Object.create(Ia.prototype);Hf.prototype.constructor=Hf;Ce.prototype=Object.create(la.prototype);Ce.prototype.constructor=Ce;var Wb=Object.freeze({WireframeGeometry:qe,ParametricGeometry:nf,ParametricBufferGeometry:re,TetrahedronGeometry:pf,TetrahedronBufferGeometry:se,OctahedronGeometry:qf,OctahedronBufferGeometry:Ed,IcosahedronGeometry:rf,IcosahedronBufferGeometry:te,DodecahedronGeometry:sf,DodecahedronBufferGeometry:ue,PolyhedronGeometry:of,PolyhedronBufferGeometry:Xb,TubeGeometry:uf,
TubeBufferGeometry:Fd,TorusKnotGeometry:vf,TorusKnotBufferGeometry:ve,TorusGeometry:wf,TorusBufferGeometry:we,TextGeometry:Bf,TextBufferGeometry:ye,SphereGeometry:Cf,SphereBufferGeometry:pd,RingGeometry:Df,RingBufferGeometry:ze,PlaneGeometry:fd,PlaneBufferGeometry:Dc,LatheGeometry:Ef,LatheBufferGeometry:Ae,ShapeGeometry:Id,ShapeBufferGeometry:Jd,ExtrudeGeometry:Hd,ExtrudeBufferGeometry:Jc,EdgesGeometry:Be,ConeGeometry:Ff,ConeBufferGeometry:Gf,CylinderGeometry:Kd,CylinderBufferGeometry:Wc,CircleGeometry:Hf,
CircleBufferGeometry:Ce,BoxGeometry:ob,BoxBufferGeometry:vb});Ld.prototype=Object.create(xa.prototype);Ld.prototype.constructor=Ld;Ld.prototype.isShadowMaterial=!0;Ld.prototype.copy=function(a){xa.prototype.copy.call(this,a);this.color.copy(a.color);return this};De.prototype=Object.create(yb.prototype);De.prototype.constructor=De;De.prototype.isRawShaderMaterial=!0;Kc.prototype=Object.create(xa.prototype);Kc.prototype.constructor=Kc;Kc.prototype.isMeshStandardMaterial=!0;Kc.prototype.copy=function(a){xa.prototype.copy.call(this,
a);this.defines={STANDARD:""};this.color.copy(a.color);this.roughness=a.roughness;this.metalness=a.metalness;this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);
this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.roughnessMap=a.roughnessMap;this.metalnessMap=a.metalnessMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.envMapIntensity=a.envMapIntensity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=
a.morphTargets;this.morphNormals=a.morphNormals;return this};Md.prototype=Object.create(Kc.prototype);Md.prototype.constructor=Md;Md.prototype.isMeshPhysicalMaterial=!0;Md.prototype.copy=function(a){Kc.prototype.copy.call(this,a);this.defines={STANDARD:"",PHYSICAL:""};this.reflectivity=a.reflectivity;this.clearcoat=a.clearcoat;this.clearcoatRoughness=a.clearcoatRoughness;this.sheen=a.sheen?(this.sheen||new ca).copy(a.sheen):null;this.clearcoatNormalMap=a.clearcoatNormalMap;this.clearcoatNormalScale.copy(a.clearcoatNormalScale);
this.transparency=a.transparency;return this};rc.prototype=Object.create(xa.prototype);rc.prototype.constructor=rc;rc.prototype.isMeshPhongMaterial=!0;rc.prototype.copy=function(a){xa.prototype.copy.call(this,a);this.color.copy(a.color);this.specular.copy(a.specular);this.shininess=a.shininess;this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=
a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=
a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Nd.prototype=Object.create(rc.prototype);Nd.prototype.constructor=Nd;Nd.prototype.isMeshToonMaterial=!0;Nd.prototype.copy=function(a){rc.prototype.copy.call(this,a);this.gradientMap=a.gradientMap;return this};Od.prototype=Object.create(xa.prototype);Od.prototype.constructor=Od;Od.prototype.isMeshNormalMaterial=
!0;Od.prototype.copy=function(a){xa.prototype.copy.call(this,a);this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};
Pd.prototype=Object.create(xa.prototype);Pd.prototype.constructor=Pd;Pd.prototype.isMeshLambertMaterial=!0;Pd.prototype.copy=function(a){xa.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=
a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Qd.prototype=Object.create(xa.prototype);Qd.prototype.constructor=Qd;Qd.prototype.isMeshMatcapMaterial=!0;Qd.prototype.copy=function(a){xa.prototype.copy.call(this,
a);this.defines={MATCAP:""};this.color.copy(a.color);this.matcap=a.matcap;this.map=a.map;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.alphaMap=a.alphaMap;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Rd.prototype=
Object.create(lb.prototype);Rd.prototype.constructor=Rd;Rd.prototype.isLineDashedMaterial=!0;Rd.prototype.copy=function(a){lb.prototype.copy.call(this,a);this.scale=a.scale;this.dashSize=a.dashSize;this.gapSize=a.gapSize;return this};var em=Object.freeze({ShadowMaterial:Ld,SpriteMaterial:od,RawShaderMaterial:De,ShaderMaterial:yb,PointsMaterial:qc,MeshPhysicalMaterial:Md,MeshStandardMaterial:Kc,MeshPhongMaterial:rc,MeshToonMaterial:Nd,MeshNormalMaterial:Od,MeshLambertMaterial:Pd,MeshDepthMaterial:jd,
MeshDistanceMaterial:kd,MeshBasicMaterial:gb,MeshMatcapMaterial:Qd,LineDashedMaterial:Rd,LineBasicMaterial:lb,Material:xa}),Gb={arraySlice:function(a,b,c){return Gb.isTypedArray(a)?new a.constructor(a.subarray(b,void 0!==c?c:a.length)):a.slice(b,c)},convertArray:function(a,b,c){return!a||!c&&a.constructor===b?a:"number"===typeof b.BYTES_PER_ELEMENT?new b(a):Array.prototype.slice.call(a)},isTypedArray:function(a){return ArrayBuffer.isView(a)&&!(a instanceof DataView)},getKeyframeOrder:function(a){for(var b=
a.length,c=Array(b),d=0;d!==b;++d)c[d]=d;c.sort(function(f,g){return a[f]-a[g]});return c},sortedArray:function(a,b,c){for(var d=a.length,f=new a.constructor(d),g=0,h=0;h!==d;++g)for(var l=c[g]*b,m=0;m!==b;++m)f[h++]=a[l+m];return f},flattenJSON:function(a,b,c,d){for(var f=1,g=a[0];void 0!==g&&void 0===g[d];)g=a[f++];if(void 0!==g){var h=g[d];if(void 0!==h)if(Array.isArray(h)){do h=g[d],void 0!==h&&(b.push(g.time),c.push.apply(c,h)),g=a[f++];while(void 0!==g)}else if(void 0!==h.toArray){do h=g[d],
void 0!==h&&(b.push(g.time),h.toArray(c,c.length)),g=a[f++];while(void 0!==g)}else{do h=g[d],void 0!==h&&(b.push(g.time),c.push(h)),g=a[f++];while(void 0!==g)}}}};Object.assign(dc.prototype,{evaluate:function(a){var b=this.parameterPositions,c=this._cachedIndex,d=b[c],f=b[c-1];a:{b:{c:{d:if(!(a<d)){for(var g=c+2;;){if(void 0===d){if(a<f)break d;this._cachedIndex=c=b.length;return this.afterEnd_(c-1,a,f)}if(c===g)break;f=d;d=b[++c];if(a<d)break b}d=b.length;break c}if(a>=f)break a;else{g=b[1];a<g&&
(c=2,f=g);for(g=c-2;;){if(void 0===f)return this._cachedIndex=0,this.beforeStart_(0,a,d);if(c===g)break;d=f;f=b[--c-1];if(a>=f)break b}d=c;c=0}}for(;c<d;)f=c+d>>>1,a<b[f]?d=f:c=f+1;d=b[c];f=b[c-1];if(void 0===f)return this._cachedIndex=0,this.beforeStart_(0,a,d);if(void 0===d)return this._cachedIndex=c=b.length,this.afterEnd_(c-1,f,a)}this._cachedIndex=c;this.intervalChanged_(c,f,d)}return this.interpolate_(c,f,a,d)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||
this.DefaultSettings_},copySampleValue_:function(a){var b=this.resultBuffer,c=this.sampleValues,d=this.valueSize;a*=d;for(var f=0;f!==d;++f)b[f]=c[a+f];return b},interpolate_:function(){throw Error("call to abstract method");},intervalChanged_:function(){}});Object.assign(dc.prototype,{beforeStart_:dc.prototype.copySampleValue_,afterEnd_:dc.prototype.copySampleValue_});ng.prototype=Object.assign(Object.create(dc.prototype),{constructor:ng,DefaultSettings_:{endingStart:2400,endingEnd:2400},intervalChanged_:function(a,
b,c){var d=this.parameterPositions,f=a-2,g=a+1,h=d[f],l=d[g];if(void 0===h)switch(this.getSettings_().endingStart){case 2401:f=a;h=2*b-c;break;case 2402:f=d.length-2;h=b+d[f]-d[f+1];break;default:f=a,h=c}if(void 0===l)switch(this.getSettings_().endingEnd){case 2401:g=a;l=2*c-b;break;case 2402:g=1;l=c+d[1]-d[0];break;default:g=a-1,l=b}a=.5*(c-b);d=this.valueSize;this._weightPrev=a/(b-h);this._weightNext=a/(l-c);this._offsetPrev=f*d;this._offsetNext=g*d},interpolate_:function(a,b,c,d){var f=this.resultBuffer,
g=this.sampleValues,h=this.valueSize;a*=h;var l=a-h,m=this._offsetPrev,q=this._offsetNext,u=this._weightPrev,w=this._weightNext,y=(c-b)/(d-b);c=y*y;d=c*y;b=-u*d+2*u*c-u*y;u=(1+u)*d+(-1.5-2*u)*c+(-.5+u)*y+1;y=(-1-w)*d+(1.5+w)*c+.5*y;w=w*d-w*c;for(c=0;c!==h;++c)f[c]=b*g[m+c]+u*g[l+c]+y*g[a+c]+w*g[q+c];return f}});If.prototype=Object.assign(Object.create(dc.prototype),{constructor:If,interpolate_:function(a,b,c,d){var f=this.resultBuffer,g=this.sampleValues,h=this.valueSize;a*=h;var l=a-h;b=(c-b)/(d-
b);c=1-b;for(d=0;d!==h;++d)f[d]=g[l+d]*c+g[a+d]*b;return f}});og.prototype=Object.assign(Object.create(dc.prototype),{constructor:og,interpolate_:function(a){return this.copySampleValue_(a-1)}});Object.assign(Kb,{toJSON:function(a){var b=a.constructor;if(void 0!==b.toJSON)b=b.toJSON(a);else{b={name:a.name,times:Gb.convertArray(a.times,Array),values:Gb.convertArray(a.values,Array)};var c=a.getInterpolation();c!==a.DefaultInterpolation&&(b.interpolation=c)}b.type=a.ValueTypeName;return b}});Object.assign(Kb.prototype,
{constructor:Kb,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(a){return new og(this.times,this.values,this.getValueSize(),a)},InterpolantFactoryMethodLinear:function(a){return new If(this.times,this.values,this.getValueSize(),a)},InterpolantFactoryMethodSmooth:function(a){return new ng(this.times,this.values,this.getValueSize(),a)},setInterpolation:function(a){switch(a){case 2300:var b=this.InterpolantFactoryMethodDiscrete;
break;case 2301:b=this.InterpolantFactoryMethodLinear;break;case 2302:b=this.InterpolantFactoryMethodSmooth}if(void 0===b){b="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant)if(a!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(b);console.warn("THREE.KeyframeTrack:",b);return this}this.createInterpolant=b;return this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;
case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(a){if(0!==a)for(var b=this.times,c=0,d=b.length;c!==d;++c)b[c]+=a;return this},scale:function(a){if(1!==a)for(var b=this.times,c=0,d=b.length;c!==d;++c)b[c]*=a;return this},trim:function(a,b){for(var c=this.times,d=c.length,f=0,g=d-1;f!==d&&c[f]<a;)++f;for(;-1!==g&&c[g]>b;)--g;++g;if(0!==f||g!==d)f>=g&&(g=Math.max(g,
1),f=g-1),a=this.getValueSize(),this.times=Gb.arraySlice(c,f,g),this.values=Gb.arraySlice(this.values,f*a,g*a);return this},validate:function(){var a=!0,b=this.getValueSize();0!==b-Math.floor(b)&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),a=!1);var c=this.times;b=this.values;var d=c.length;0===d&&(console.error("THREE.KeyframeTrack: Track is empty.",this),a=!1);for(var f=null,g=0;g!==d;g++){var h=c[g];if("number"===typeof h&&isNaN(h)){console.error("THREE.KeyframeTrack: Time is not a valid number.",
this,g,h);a=!1;break}if(null!==f&&f>h){console.error("THREE.KeyframeTrack: Out of order keys.",this,g,h,f);a=!1;break}f=h}if(void 0!==b&&Gb.isTypedArray(b))for(g=0,c=b.length;g!==c;++g)if(d=b[g],isNaN(d)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,g,d);a=!1;break}return a},optimize:function(){for(var a=this.times,b=this.values,c=this.getValueSize(),d=2302===this.getInterpolation(),f=1,g=a.length-1,h=1;h<g;++h){var l=!1,m=a[h];if(m!==a[h+1]&&(1!==h||m!==m[0]))if(d)l=!0;
else{var q=h*c,u=q-c,w=q+c;for(m=0;m!==c;++m){var y=b[q+m];if(y!==b[u+m]||y!==b[w+m]){l=!0;break}}}if(l){if(h!==f)for(a[f]=a[h],l=h*c,q=f*c,m=0;m!==c;++m)b[q+m]=b[l+m];++f}}if(0<g){a[f]=a[g];l=g*c;q=f*c;for(m=0;m!==c;++m)b[q+m]=b[l+m];++f}f!==a.length&&(this.times=Gb.arraySlice(a,0,f),this.values=Gb.arraySlice(b,0,f*c));return this},clone:function(){var a=Gb.arraySlice(this.times,0),b=Gb.arraySlice(this.values,0);a=new this.constructor(this.name,a,b);a.createInterpolant=this.createInterpolant;return a}});
pg.prototype=Object.assign(Object.create(Kb.prototype),{constructor:pg,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0});qg.prototype=Object.assign(Object.create(Kb.prototype),{constructor:qg,ValueTypeName:"color"});Ee.prototype=Object.assign(Object.create(Kb.prototype),{constructor:Ee,ValueTypeName:"number"});rg.prototype=Object.assign(Object.create(dc.prototype),{constructor:rg,interpolate_:function(a,
b,c,d){var f=this.resultBuffer,g=this.sampleValues,h=this.valueSize;a*=h;b=(c-b)/(d-b);for(c=a+h;a!==c;a+=4)n.slerpFlat(f,0,g,a-h,g,a,b);return f}});Jf.prototype=Object.assign(Object.create(Kb.prototype),{constructor:Jf,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(a){return new rg(this.times,this.values,this.getValueSize(),a)},InterpolantFactoryMethodSmooth:void 0});sg.prototype=Object.assign(Object.create(Kb.prototype),{constructor:sg,ValueTypeName:"string",
ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0});Fe.prototype=Object.assign(Object.create(Kb.prototype),{constructor:Fe,ValueTypeName:"vector"});Object.assign(kc,{parse:function(a){for(var b=[],c=a.tracks,d=1/(a.fps||1),f=0,g=c.length;f!==g;++f)b.push(Il(c[f]).scale(d));return new kc(a.name,a.duration,b)},toJSON:function(a){var b=[],c=a.tracks;a={name:a.name,duration:a.duration,tracks:b,uuid:a.uuid};for(var d=0,f=c.length;d!==
f;++d)b.push(Kb.toJSON(c[d]));return a},CreateFromMorphTargetSequence:function(a,b,c,d){for(var f=b.length,g=[],h=0;h<f;h++){var l=[],m=[];l.push((h+f-1)%f,h,(h+1)%f);m.push(0,1,0);var q=Gb.getKeyframeOrder(l);l=Gb.sortedArray(l,1,q);m=Gb.sortedArray(m,1,q);d||0!==l[0]||(l.push(f),m.push(m[0]));g.push((new Ee(".morphTargetInfluences["+b[h].name+"]",l,m)).scale(1/c))}return new kc(a,-1,g)},findByName:function(a,b){var c=a;Array.isArray(a)||(c=a.geometry&&a.geometry.animations||a.animations);for(a=
0;a<c.length;a++)if(c[a].name===b)return c[a];return null},CreateClipsFromMorphTargetSequences:function(a,b,c){for(var d={},f=/^([\w-]*?)([\d]+)$/,g=0,h=a.length;g<h;g++){var l=a[g],m=l.name.match(f);if(m&&1<m.length){var q=m[1];(m=d[q])||(d[q]=m=[]);m.push(l)}}a=[];for(q in d)a.push(kc.CreateFromMorphTargetSequence(q,d[q],b,c));return a},parseAnimation:function(a,b){function c(K,J,W,T,V){if(0!==W.length){var Z=[],R=[];Gb.flattenJSON(W,Z,R,T);0!==Z.length&&V.push(new K(J,Z,R))}}if(!a)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),
null;var d=[],f=a.name||"default",g=a.length||-1,h=a.fps||30;a=a.hierarchy||[];for(var l=0;l<a.length;l++){var m=a[l].keys;if(m&&0!==m.length)if(m[0].morphTargets){g={};for(var q=0;q<m.length;q++)if(m[q].morphTargets)for(var u=0;u<m[q].morphTargets.length;u++)g[m[q].morphTargets[u]]=-1;for(var w in g){var y=[],C=[];for(u=0;u!==m[q].morphTargets.length;++u){var D=m[q];y.push(D.time);C.push(D.morphTarget===w?1:0)}d.push(new Ee(".morphTargetInfluence["+w+"]",y,C))}g=g.length*(h||1)}else q=".bones["+
b[l].name+"]",c(Fe,q+".position",m,"pos",d),c(Jf,q+".quaternion",m,"rot",d),c(Fe,q+".scale",m,"scl",d)}return 0===d.length?null:new kc(f,g,d)}});Object.assign(kc.prototype,{resetDuration:function(){for(var a=0,b=0,c=this.tracks.length;b!==c;++b){var d=this.tracks[b];a=Math.max(a,d.times[d.times.length-1])}this.duration=a;return this},trim:function(){for(var a=0;a<this.tracks.length;a++)this.tracks[a].trim(0,this.duration);return this},validate:function(){for(var a=!0,b=0;b<this.tracks.length;b++)a=
a&&this.tracks[b].validate();return a},optimize:function(){for(var a=0;a<this.tracks.length;a++)this.tracks[a].optimize();return this},clone:function(){for(var a=[],b=0;b<this.tracks.length;b++)a.push(this.tracks[b].clone());return new kc(this.name,this.duration,a)}});var Wd={enabled:!1,files:{},add:function(a,b){!1!==this.enabled&&(this.files[a]=b)},get:function(a){if(!1!==this.enabled)return this.files[a]},remove:function(a){delete this.files[a]},clear:function(){this.files={}}},nj=new Fh;Object.assign(ib.prototype,
{load:function(){},parse:function(){},setCrossOrigin:function(a){this.crossOrigin=a;return this},setPath:function(a){this.path=a;return this},setResourcePath:function(a){this.resourcePath=a;return this}});ib.Handlers={handlers:[],add:function(a,b){this.handlers.push(a,b)},get:function(a){for(var b=this.handlers,c=0,d=b.length;c<d;c+=2){var f=b[c+1];if(b[c].test(a))return f}return null}};var Ac={};lc.prototype=Object.assign(Object.create(ib.prototype),{constructor:lc,load:function(a,b,c,d){void 0===
a&&(a="");void 0!==this.path&&(a=this.path+a);a=this.manager.resolveURL(a);var f=this,g=Wd.get(a);if(void 0!==g)return f.manager.itemStart(a),setTimeout(function(){b&&b(g);f.manager.itemEnd(a)},0),g;if(void 0!==Ac[a])Ac[a].push({onLoad:b,onProgress:c,onError:d});else{var h=a.match(/^data:(.*?)(;base64)?,(.*)$/);if(h){c=h[1];var l=!!h[2];h=h[3];h=decodeURIComponent(h);l&&(h=atob(h));try{var m=(this.responseType||"").toLowerCase();switch(m){case "arraybuffer":case "blob":var q=new Uint8Array(h.length);
for(l=0;l<h.length;l++)q[l]=h.charCodeAt(l);var u="blob"===m?new Blob([q.buffer],{type:c}):q.buffer;break;case "document":u=(new DOMParser).parseFromString(h,c);break;case "json":u=JSON.parse(h);break;default:u=h}setTimeout(function(){b&&b(u);f.manager.itemEnd(a)},0)}catch(y){setTimeout(function(){d&&d(y);f.manager.itemError(a);f.manager.itemEnd(a)},0)}}else{Ac[a]=[];Ac[a].push({onLoad:b,onProgress:c,onError:d});var w=new XMLHttpRequest;w.open("GET",a,!0);w.addEventListener("load",function(y){var C=
this.response;Wd.add(a,C);var D=Ac[a];delete Ac[a];if(200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received.");for(var K=0,J=D.length;K<J;K++){var W=D[K];if(W.onLoad)W.onLoad(C)}}else{K=0;for(J=D.length;K<J;K++)if(W=D[K],W.onError)W.onError(y);f.manager.itemError(a)}f.manager.itemEnd(a)},!1);w.addEventListener("progress",function(y){for(var C=Ac[a],D=0,K=C.length;D<K;D++){var J=C[D];if(J.onProgress)J.onProgress(y)}},!1);w.addEventListener("error",
function(y){var C=Ac[a];delete Ac[a];for(var D=0,K=C.length;D<K;D++){var J=C[D];if(J.onError)J.onError(y)}f.manager.itemError(a);f.manager.itemEnd(a)},!1);w.addEventListener("abort",function(y){var C=Ac[a];delete Ac[a];for(var D=0,K=C.length;D<K;D++){var J=C[D];if(J.onError)J.onError(y)}f.manager.itemError(a);f.manager.itemEnd(a)},!1);void 0!==this.responseType&&(w.responseType=this.responseType);void 0!==this.withCredentials&&(w.withCredentials=this.withCredentials);w.overrideMimeType&&w.overrideMimeType(void 0!==
this.mimeType?this.mimeType:"text/plain");for(l in this.requestHeader)w.setRequestHeader(l,this.requestHeader[l]);w.send(null)}f.manager.itemStart(a);return w}},setResponseType:function(a){this.responseType=a;return this},setWithCredentials:function(a){this.withCredentials=a;return this},setMimeType:function(a){this.mimeType=a;return this},setRequestHeader:function(a){this.requestHeader=a;return this}});Gh.prototype=Object.assign(Object.create(ib.prototype),{constructor:Gh,load:function(a,b,c,d){var f=
this,g=new lc(f.manager);g.setPath(f.path);g.load(a,function(h){b(f.parse(JSON.parse(h)))},c,d)},parse:function(a){for(var b=[],c=0;c<a.length;c++){var d=kc.parse(a[c]);b.push(d)}return b}});Hh.prototype=Object.assign(Object.create(ib.prototype),{constructor:Hh,load:function(a,b,c,d){function f(y){m.load(a[y],function(C){C=g._parser(C,!0);h[y]={width:C.width,height:C.height,format:C.format,mipmaps:C.mipmaps};q+=1;6===q&&(1===C.mipmapCount&&(l.minFilter=1006),l.format=C.format,l.needsUpdate=!0,b&&
b(l))},c,d)}var g=this,h=[],l=new pe;l.image=h;var m=new lc(this.manager);m.setPath(this.path);m.setResponseType("arraybuffer");if(Array.isArray(a))for(var q=0,u=0,w=a.length;u<w;++u)f(u);else m.load(a,function(y){y=g._parser(y,!0);if(y.isCubemap)for(var C=y.mipmaps.length/y.mipmapCount,D=0;D<C;D++){h[D]={mipmaps:[]};for(var K=0;K<y.mipmapCount;K++)h[D].mipmaps.push(y.mipmaps[D*y.mipmapCount+K]),h[D].format=y.format,h[D].width=y.width,h[D].height=y.height}else l.image.width=y.width,l.image.height=
y.height,l.mipmaps=y.mipmaps;1===y.mipmapCount&&(l.minFilter=1006);l.format=y.format;l.needsUpdate=!0;b&&b(l)},c,d);return l}});tg.prototype=Object.assign(Object.create(ib.prototype),{constructor:tg,load:function(a,b,c,d){var f=this,g=new Rb,h=new lc(this.manager);h.setResponseType("arraybuffer");h.setPath(this.path);h.load(a,function(l){if(l=f._parser(l))void 0!==l.image?g.image=l.image:void 0!==l.data&&(g.image.width=l.width,g.image.height=l.height,g.image.data=l.data),g.wrapS=void 0!==l.wrapS?
l.wrapS:1001,g.wrapT=void 0!==l.wrapT?l.wrapT:1001,g.magFilter=void 0!==l.magFilter?l.magFilter:1006,g.minFilter=void 0!==l.minFilter?l.minFilter:1008,g.anisotropy=void 0!==l.anisotropy?l.anisotropy:1,void 0!==l.format&&(g.format=l.format),void 0!==l.type&&(g.type=l.type),void 0!==l.mipmaps&&(g.mipmaps=l.mipmaps),1===l.mipmapCount&&(g.minFilter=1006),g.needsUpdate=!0,b&&b(g,l)},c,d);return g}});Ge.prototype=Object.assign(Object.create(ib.prototype),{constructor:Ge,load:function(a,b,c,d){function f(){m.removeEventListener("load",
f,!1);m.removeEventListener("error",g,!1);Wd.add(a,this);b&&b(this);h.manager.itemEnd(a)}function g(q){m.removeEventListener("load",f,!1);m.removeEventListener("error",g,!1);d&&d(q);h.manager.itemError(a);h.manager.itemEnd(a)}void 0!==this.path&&(a=this.path+a);a=this.manager.resolveURL(a);var h=this,l=Wd.get(a);if(void 0!==l)return h.manager.itemStart(a),setTimeout(function(){b&&b(l);h.manager.itemEnd(a)},0),l;var m=document.createElementNS("http://www.w3.org/1999/xhtml","img");m.addEventListener("load",
f,!1);m.addEventListener("error",g,!1);"data:"!==a.substr(0,5)&&void 0!==this.crossOrigin&&(m.crossOrigin=this.crossOrigin);h.manager.itemStart(a);m.src=a;return m}});ug.prototype=Object.assign(Object.create(ib.prototype),{constructor:ug,load:function(a,b,c,d){function f(m){h.load(a[m],function(q){g.images[m]=q;l++;6===l&&(g.needsUpdate=!0,b&&b(g))},void 0,d)}var g=new Tc,h=new Ge(this.manager);h.setCrossOrigin(this.crossOrigin);h.setPath(this.path);var l=0;for(c=0;c<a.length;++c)f(c);return g}});
vg.prototype=Object.assign(Object.create(ib.prototype),{constructor:vg,load:function(a,b,c,d){var f=new z,g=new Ge(this.manager);g.setCrossOrigin(this.crossOrigin);g.setPath(this.path);g.load(a,function(h){f.image=h;h=0<a.search(/\.jpe?g($|\?)/i)||0===a.search(/^data:image\/jpeg/);f.format=h?1022:1023;f.needsUpdate=!0;void 0!==b&&b(f)},c,d);return f}});Object.assign(Ga.prototype,{getPoint:function(){console.warn("THREE.Curve: .getPoint() not implemented.");return null},getPointAt:function(a,b){a=
this.getUtoTmapping(a);return this.getPoint(a,b)},getPoints:function(a){void 0===a&&(a=5);for(var b=[],c=0;c<=a;c++)b.push(this.getPoint(c/a));return b},getSpacedPoints:function(a){void 0===a&&(a=5);for(var b=[],c=0;c<=a;c++)b.push(this.getPointAt(c/a));return b},getLength:function(){var a=this.getLengths();return a[a.length-1]},getLengths:function(a){void 0===a&&(a=this.arcLengthDivisions);if(this.cacheArcLengths&&this.cacheArcLengths.length===a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=
!1;var b=[],c=this.getPoint(0),d,f=0;b.push(0);for(d=1;d<=a;d++){var g=this.getPoint(d/a);f+=g.distanceTo(c);b.push(f);c=g}return this.cacheArcLengths=b},updateArcLengths:function(){this.needsUpdate=!0;this.getLengths()},getUtoTmapping:function(a,b){var c=this.getLengths(),d=c.length;b=b?b:a*c[d-1];for(var f=0,g=d-1,h;f<=g;)if(a=Math.floor(f+(g-f)/2),h=c[a]-b,0>h)f=a+1;else if(0<h)g=a-1;else{g=a;break}a=g;if(c[a]===b)return a/(d-1);f=c[a];return(a+(b-f)/(c[a+1]-f))/(d-1)},getTangent:function(a){var b=
a-1E-4;a+=1E-4;0>b&&(b=0);1<a&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().sub(b).normalize()},getTangentAt:function(a){a=this.getUtoTmapping(a);return this.getTangent(a)},computeFrenetFrames:function(a,b){var c=new p,d=[],f=[],g=[],h=new p,l=new A,m;for(m=0;m<=a;m++){var q=m/a;d[m]=this.getTangentAt(q);d[m].normalize()}f[0]=new p;g[0]=new p;m=Number.MAX_VALUE;q=Math.abs(d[0].x);var u=Math.abs(d[0].y),w=Math.abs(d[0].z);q<=m&&(m=q,c.set(1,0,0));u<=m&&(m=u,c.set(0,1,0));w<=m&&c.set(0,
0,1);h.crossVectors(d[0],c).normalize();f[0].crossVectors(d[0],h);g[0].crossVectors(d[0],f[0]);for(m=1;m<=a;m++)f[m]=f[m-1].clone(),g[m]=g[m-1].clone(),h.crossVectors(d[m-1],d[m]),h.length()>Number.EPSILON&&(h.normalize(),c=Math.acos(Qa.clamp(d[m-1].dot(d[m]),-1,1)),f[m].applyMatrix4(l.makeRotationAxis(h,c))),g[m].crossVectors(d[m],f[m]);if(!0===b)for(c=Math.acos(Qa.clamp(f[0].dot(f[a]),-1,1)),c/=a,0<d[0].dot(h.crossVectors(f[0],f[a]))&&(c=-c),m=1;m<=a;m++)f[m].applyMatrix4(l.makeRotationAxis(d[m],
c*m)),g[m].crossVectors(d[m],f[m]);return{tangents:d,normals:f,binormals:g}},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.arcLengthDivisions=a.arcLengthDivisions;return this},toJSON:function(){var a={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};a.arcLengthDivisions=this.arcLengthDivisions;a.type=this.type;return a},fromJSON:function(a){this.arcLengthDivisions=a.arcLengthDivisions;return this}});ec.prototype=Object.create(Ga.prototype);ec.prototype.constructor=
ec;ec.prototype.isEllipseCurve=!0;ec.prototype.getPoint=function(a,b){b=b||new k;for(var c=2*Math.PI,d=this.aEndAngle-this.aStartAngle,f=Math.abs(d)<Number.EPSILON;0>d;)d+=c;for(;d>c;)d-=c;d<Number.EPSILON&&(d=f?0:c);!0!==this.aClockwise||f||(d=d===c?-c:d-c);c=this.aStartAngle+a*d;a=this.aX+this.xRadius*Math.cos(c);var g=this.aY+this.yRadius*Math.sin(c);0!==this.aRotation&&(c=Math.cos(this.aRotation),d=Math.sin(this.aRotation),f=a-this.aX,g-=this.aY,a=f*c-g*d+this.aX,g=f*d+g*c+this.aY);return b.set(a,
g)};ec.prototype.copy=function(a){Ga.prototype.copy.call(this,a);this.aX=a.aX;this.aY=a.aY;this.xRadius=a.xRadius;this.yRadius=a.yRadius;this.aStartAngle=a.aStartAngle;this.aEndAngle=a.aEndAngle;this.aClockwise=a.aClockwise;this.aRotation=a.aRotation;return this};ec.prototype.toJSON=function(){var a=Ga.prototype.toJSON.call(this);a.aX=this.aX;a.aY=this.aY;a.xRadius=this.xRadius;a.yRadius=this.yRadius;a.aStartAngle=this.aStartAngle;a.aEndAngle=this.aEndAngle;a.aClockwise=this.aClockwise;a.aRotation=
this.aRotation;return a};ec.prototype.fromJSON=function(a){Ga.prototype.fromJSON.call(this,a);this.aX=a.aX;this.aY=a.aY;this.xRadius=a.xRadius;this.yRadius=a.yRadius;this.aStartAngle=a.aStartAngle;this.aEndAngle=a.aEndAngle;this.aClockwise=a.aClockwise;this.aRotation=a.aRotation;return this};He.prototype=Object.create(ec.prototype);He.prototype.constructor=He;He.prototype.isArcCurve=!0;var gh=new p,qi=new Ih,ri=new Ih,si=new Ih;Ob.prototype=Object.create(Ga.prototype);Ob.prototype.constructor=Ob;
Ob.prototype.isCatmullRomCurve3=!0;Ob.prototype.getPoint=function(a,b){b=b||new p;var c=this.points,d=c.length;a*=d-(this.closed?0:1);var f=Math.floor(a);a-=f;this.closed?f+=0<f?0:(Math.floor(Math.abs(f)/d)+1)*d:0===a&&f===d-1&&(f=d-2,a=1);if(this.closed||0<f)var g=c[(f-1)%d];else gh.subVectors(c[0],c[1]).add(c[0]),g=gh;var h=c[f%d];var l=c[(f+1)%d];this.closed||f+2<d?c=c[(f+2)%d]:(gh.subVectors(c[d-1],c[d-2]).add(c[d-1]),c=gh);if("centripetal"===this.curveType||"chordal"===this.curveType){var m=
"chordal"===this.curveType?.5:.25;d=Math.pow(g.distanceToSquared(h),m);f=Math.pow(h.distanceToSquared(l),m);m=Math.pow(l.distanceToSquared(c),m);1E-4>f&&(f=1);1E-4>d&&(d=f);1E-4>m&&(m=f);qi.initNonuniformCatmullRom(g.x,h.x,l.x,c.x,d,f,m);ri.initNonuniformCatmullRom(g.y,h.y,l.y,c.y,d,f,m);si.initNonuniformCatmullRom(g.z,h.z,l.z,c.z,d,f,m)}else"catmullrom"===this.curveType&&(qi.initCatmullRom(g.x,h.x,l.x,c.x,this.tension),ri.initCatmullRom(g.y,h.y,l.y,c.y,this.tension),si.initCatmullRom(g.z,h.z,l.z,
c.z,this.tension));b.set(qi.calc(a),ri.calc(a),si.calc(a));return b};Ob.prototype.copy=function(a){Ga.prototype.copy.call(this,a);this.points=[];for(var b=0,c=a.points.length;b<c;b++)this.points.push(a.points[b].clone());this.closed=a.closed;this.curveType=a.curveType;this.tension=a.tension;return this};Ob.prototype.toJSON=function(){var a=Ga.prototype.toJSON.call(this);a.points=[];for(var b=0,c=this.points.length;b<c;b++)a.points.push(this.points[b].toArray());a.closed=this.closed;a.curveType=this.curveType;
a.tension=this.tension;return a};Ob.prototype.fromJSON=function(a){Ga.prototype.fromJSON.call(this,a);this.points=[];for(var b=0,c=a.points.length;b<c;b++){var d=a.points[b];this.points.push((new p).fromArray(d))}this.closed=a.closed;this.curveType=a.curveType;this.tension=a.tension;return this};sc.prototype=Object.create(Ga.prototype);sc.prototype.constructor=sc;sc.prototype.isCubicBezierCurve=!0;sc.prototype.getPoint=function(a,b){b=b||new k;var c=this.v0,d=this.v1,f=this.v2,g=this.v3;b.set(Lf(a,
c.x,d.x,f.x,g.x),Lf(a,c.y,d.y,f.y,g.y));return b};sc.prototype.copy=function(a){Ga.prototype.copy.call(this,a);this.v0.copy(a.v0);this.v1.copy(a.v1);this.v2.copy(a.v2);this.v3.copy(a.v3);return this};sc.prototype.toJSON=function(){var a=Ga.prototype.toJSON.call(this);a.v0=this.v0.toArray();a.v1=this.v1.toArray();a.v2=this.v2.toArray();a.v3=this.v3.toArray();return a};sc.prototype.fromJSON=function(a){Ga.prototype.fromJSON.call(this,a);this.v0.fromArray(a.v0);this.v1.fromArray(a.v1);this.v2.fromArray(a.v2);
this.v3.fromArray(a.v3);return this};Lc.prototype=Object.create(Ga.prototype);Lc.prototype.constructor=Lc;Lc.prototype.isCubicBezierCurve3=!0;Lc.prototype.getPoint=function(a,b){b=b||new p;var c=this.v0,d=this.v1,f=this.v2,g=this.v3;b.set(Lf(a,c.x,d.x,f.x,g.x),Lf(a,c.y,d.y,f.y,g.y),Lf(a,c.z,d.z,f.z,g.z));return b};Lc.prototype.copy=function(a){Ga.prototype.copy.call(this,a);this.v0.copy(a.v0);this.v1.copy(a.v1);this.v2.copy(a.v2);this.v3.copy(a.v3);return this};Lc.prototype.toJSON=function(){var a=
Ga.prototype.toJSON.call(this);a.v0=this.v0.toArray();a.v1=this.v1.toArray();a.v2=this.v2.toArray();a.v3=this.v3.toArray();return a};Lc.prototype.fromJSON=function(a){Ga.prototype.fromJSON.call(this,a);this.v0.fromArray(a.v0);this.v1.fromArray(a.v1);this.v2.fromArray(a.v2);this.v3.fromArray(a.v3);return this};Yb.prototype=Object.create(Ga.prototype);Yb.prototype.constructor=Yb;Yb.prototype.isLineCurve=!0;Yb.prototype.getPoint=function(a,b){b=b||new k;1===a?b.copy(this.v2):(b.copy(this.v2).sub(this.v1),
b.multiplyScalar(a).add(this.v1));return b};Yb.prototype.getPointAt=function(a,b){return this.getPoint(a,b)};Yb.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()};Yb.prototype.copy=function(a){Ga.prototype.copy.call(this,a);this.v1.copy(a.v1);this.v2.copy(a.v2);return this};Yb.prototype.toJSON=function(){var a=Ga.prototype.toJSON.call(this);a.v1=this.v1.toArray();a.v2=this.v2.toArray();return a};Yb.prototype.fromJSON=function(a){Ga.prototype.fromJSON.call(this,a);this.v1.fromArray(a.v1);
this.v2.fromArray(a.v2);return this};tc.prototype=Object.create(Ga.prototype);tc.prototype.constructor=tc;tc.prototype.isLineCurve3=!0;tc.prototype.getPoint=function(a,b){b=b||new p;1===a?b.copy(this.v2):(b.copy(this.v2).sub(this.v1),b.multiplyScalar(a).add(this.v1));return b};tc.prototype.getPointAt=function(a,b){return this.getPoint(a,b)};tc.prototype.copy=function(a){Ga.prototype.copy.call(this,a);this.v1.copy(a.v1);this.v2.copy(a.v2);return this};tc.prototype.toJSON=function(){var a=Ga.prototype.toJSON.call(this);
a.v1=this.v1.toArray();a.v2=this.v2.toArray();return a};tc.prototype.fromJSON=function(a){Ga.prototype.fromJSON.call(this,a);this.v1.fromArray(a.v1);this.v2.fromArray(a.v2);return this};uc.prototype=Object.create(Ga.prototype);uc.prototype.constructor=uc;uc.prototype.isQuadraticBezierCurve=!0;uc.prototype.getPoint=function(a,b){b=b||new k;var c=this.v0,d=this.v1,f=this.v2;b.set(Kf(a,c.x,d.x,f.x),Kf(a,c.y,d.y,f.y));return b};uc.prototype.copy=function(a){Ga.prototype.copy.call(this,a);this.v0.copy(a.v0);
this.v1.copy(a.v1);this.v2.copy(a.v2);return this};uc.prototype.toJSON=function(){var a=Ga.prototype.toJSON.call(this);a.v0=this.v0.toArray();a.v1=this.v1.toArray();a.v2=this.v2.toArray();return a};uc.prototype.fromJSON=function(a){Ga.prototype.fromJSON.call(this,a);this.v0.fromArray(a.v0);this.v1.fromArray(a.v1);this.v2.fromArray(a.v2);return this};Mc.prototype=Object.create(Ga.prototype);Mc.prototype.constructor=Mc;Mc.prototype.isQuadraticBezierCurve3=!0;Mc.prototype.getPoint=function(a,b){b=b||
new p;var c=this.v0,d=this.v1,f=this.v2;b.set(Kf(a,c.x,d.x,f.x),Kf(a,c.y,d.y,f.y),Kf(a,c.z,d.z,f.z));return b};Mc.prototype.copy=function(a){Ga.prototype.copy.call(this,a);this.v0.copy(a.v0);this.v1.copy(a.v1);this.v2.copy(a.v2);return this};Mc.prototype.toJSON=function(){var a=Ga.prototype.toJSON.call(this);a.v0=this.v0.toArray();a.v1=this.v1.toArray();a.v2=this.v2.toArray();return a};Mc.prototype.fromJSON=function(a){Ga.prototype.fromJSON.call(this,a);this.v0.fromArray(a.v0);this.v1.fromArray(a.v1);
this.v2.fromArray(a.v2);return this};vc.prototype=Object.create(Ga.prototype);vc.prototype.constructor=vc;vc.prototype.isSplineCurve=!0;vc.prototype.getPoint=function(a,b){b=b||new k;var c=this.points,d=(c.length-1)*a;a=Math.floor(d);d-=a;var f=c[0===a?a:a-1],g=c[a],h=c[a>c.length-2?c.length-1:a+1];c=c[a>c.length-3?c.length-1:a+2];b.set(oj(d,f.x,g.x,h.x,c.x),oj(d,f.y,g.y,h.y,c.y));return b};vc.prototype.copy=function(a){Ga.prototype.copy.call(this,a);this.points=[];for(var b=0,c=a.points.length;b<
c;b++)this.points.push(a.points[b].clone());return this};vc.prototype.toJSON=function(){var a=Ga.prototype.toJSON.call(this);a.points=[];for(var b=0,c=this.points.length;b<c;b++)a.points.push(this.points[b].toArray());return a};vc.prototype.fromJSON=function(a){Ga.prototype.fromJSON.call(this,a);this.points=[];for(var b=0,c=a.points.length;b<c;b++){var d=a.points[b];this.points.push((new k).fromArray(d))}return this};var ti=Object.freeze({ArcCurve:He,CatmullRomCurve3:Ob,CubicBezierCurve:sc,CubicBezierCurve3:Lc,
EllipseCurve:ec,LineCurve:Yb,LineCurve3:tc,QuadraticBezierCurve:uc,QuadraticBezierCurve3:Mc,SplineCurve:vc});Xc.prototype=Object.assign(Object.create(Ga.prototype),{constructor:Xc,add:function(a){this.curves.push(a)},closePath:function(){var a=this.curves[0].getPoint(0),b=this.curves[this.curves.length-1].getPoint(1);a.equals(b)||this.curves.push(new Yb(b,a))},getPoint:function(a){var b=a*this.getLength(),c=this.getCurveLengths();for(a=0;a<c.length;){if(c[a]>=b)return b=c[a]-b,a=this.curves[a],c=
a.getLength(),a.getPointAt(0===c?0:1-b/c);a++}return null},getLength:function(){var a=this.getCurveLengths();return a[a.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 a=[],b=0,c=0,d=this.curves.length;c<d;c++)b+=this.curves[c].getLength(),a.push(b);return this.cacheLengths=a},getSpacedPoints:function(a){void 0===
a&&(a=40);for(var b=[],c=0;c<=a;c++)b.push(this.getPoint(c/a));this.autoClose&&b.push(b[0]);return b},getPoints:function(a){a=a||12;for(var b=[],c,d=0,f=this.curves;d<f.length;d++){var g=f[d];g=g.getPoints(g&&g.isEllipseCurve?2*a:g&&(g.isLineCurve||g.isLineCurve3)?1:g&&g.isSplineCurve?a*g.points.length:a);for(var h=0;h<g.length;h++){var l=g[h];c&&c.equals(l)||(b.push(l),c=l)}}this.autoClose&&1<b.length&&!b[b.length-1].equals(b[0])&&b.push(b[0]);return b},copy:function(a){Ga.prototype.copy.call(this,
a);this.curves=[];for(var b=0,c=a.curves.length;b<c;b++)this.curves.push(a.curves[b].clone());this.autoClose=a.autoClose;return this},toJSON:function(){var a=Ga.prototype.toJSON.call(this);a.autoClose=this.autoClose;a.curves=[];for(var b=0,c=this.curves.length;b<c;b++)a.curves.push(this.curves[b].toJSON());return a},fromJSON:function(a){Ga.prototype.fromJSON.call(this,a);this.autoClose=a.autoClose;this.curves=[];for(var b=0,c=a.curves.length;b<c;b++){var d=a.curves[b];this.curves.push((new ti[d.type]).fromJSON(d))}return this}});
wc.prototype=Object.assign(Object.create(Xc.prototype),{constructor:wc,setFromPoints:function(a){this.moveTo(a[0].x,a[0].y);for(var b=1,c=a.length;b<c;b++)this.lineTo(a[b].x,a[b].y)},moveTo:function(a,b){this.currentPoint.set(a,b)},lineTo:function(a,b){var c=new Yb(this.currentPoint.clone(),new k(a,b));this.curves.push(c);this.currentPoint.set(a,b)},quadraticCurveTo:function(a,b,c,d){a=new uc(this.currentPoint.clone(),new k(a,b),new k(c,d));this.curves.push(a);this.currentPoint.set(c,d)},bezierCurveTo:function(a,
b,c,d,f,g){a=new sc(this.currentPoint.clone(),new k(a,b),new k(c,d),new k(f,g));this.curves.push(a);this.currentPoint.set(f,g)},splineThru:function(a){var b=[this.currentPoint.clone()].concat(a);b=new vc(b);this.curves.push(b);this.currentPoint.copy(a[a.length-1])},arc:function(a,b,c,d,f,g){this.absarc(a+this.currentPoint.x,b+this.currentPoint.y,c,d,f,g)},absarc:function(a,b,c,d,f,g){this.absellipse(a,b,c,c,d,f,g)},ellipse:function(a,b,c,d,f,g,h,l){this.absellipse(a+this.currentPoint.x,b+this.currentPoint.y,
c,d,f,g,h,l)},absellipse:function(a,b,c,d,f,g,h,l){a=new ec(a,b,c,d,f,g,h,l);0<this.curves.length&&(b=a.getPoint(0),b.equals(this.currentPoint)||this.lineTo(b.x,b.y));this.curves.push(a);a=a.getPoint(1);this.currentPoint.copy(a)},copy:function(a){Xc.prototype.copy.call(this,a);this.currentPoint.copy(a.currentPoint);return this},toJSON:function(){var a=Xc.prototype.toJSON.call(this);a.currentPoint=this.currentPoint.toArray();return a},fromJSON:function(a){Xc.prototype.fromJSON.call(this,a);this.currentPoint.fromArray(a.currentPoint);
return this}});qd.prototype=Object.assign(Object.create(wc.prototype),{constructor:qd,getPointsHoles:function(a){for(var b=[],c=0,d=this.holes.length;c<d;c++)b[c]=this.holes[c].getPoints(a);return b},extractPoints:function(a){return{shape:this.getPoints(a),holes:this.getPointsHoles(a)}},copy:function(a){wc.prototype.copy.call(this,a);this.holes=[];for(var b=0,c=a.holes.length;b<c;b++)this.holes.push(a.holes[b].clone());return this},toJSON:function(){var a=wc.prototype.toJSON.call(this);a.uuid=this.uuid;
a.holes=[];for(var b=0,c=this.holes.length;b<c;b++)a.holes.push(this.holes[b].toJSON());return a},fromJSON:function(a){wc.prototype.fromJSON.call(this,a);this.uuid=a.uuid;this.holes=[];for(var b=0,c=a.holes.length;b<c;b++){var d=a.holes[b];this.holes.push((new wc).fromJSON(d))}return this}});qb.prototype=Object.assign(Object.create(I.prototype),{constructor:qb,isLight:!0,copy:function(a){I.prototype.copy.call(this,a);this.color.copy(a.color);this.intensity=a.intensity;return this},toJSON:function(a){a=
I.prototype.toJSON.call(this,a);a.object.color=this.color.getHex();a.object.intensity=this.intensity;void 0!==this.groundColor&&(a.object.groundColor=this.groundColor.getHex());void 0!==this.distance&&(a.object.distance=this.distance);void 0!==this.angle&&(a.object.angle=this.angle);void 0!==this.decay&&(a.object.decay=this.decay);void 0!==this.penumbra&&(a.object.penumbra=this.penumbra);void 0!==this.shadow&&(a.object.shadow=this.shadow.toJSON());return a}});wg.prototype=Object.assign(Object.create(qb.prototype),
{constructor:wg,isHemisphereLight:!0,copy:function(a){qb.prototype.copy.call(this,a);this.groundColor.copy(a.groundColor);return this}});Object.assign(Nc.prototype,{_projScreenMatrix:new A,_lightPositionWorld:new p,_lookTarget:new p,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(a){var b=this.camera,c=this.matrix,d=this._projScreenMatrix,f=this._lookTarget,g=this._lightPositionWorld;g.setFromMatrixPosition(a.matrixWorld);
b.position.copy(g);f.setFromMatrixPosition(a.target.matrixWorld);b.lookAt(f);b.updateMatrixWorld();d.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);this._frustum.setFromMatrix(d);c.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);c.multiply(b.projectionMatrix);c.multiply(b.matrixWorldInverse)},getViewport:function(a){return this._viewports[a]},getFrameExtents:function(){return this._frameExtents},copy:function(a){this.camera=a.camera.clone();this.bias=a.bias;this.radius=a.radius;this.mapSize.copy(a.mapSize);
return this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var a={};0!==this.bias&&(a.bias=this.bias);1!==this.radius&&(a.radius=this.radius);if(512!==this.mapSize.x||512!==this.mapSize.y)a.mapSize=this.mapSize.toArray();a.camera=this.camera.toJSON(!1).object;delete a.camera.matrix;return a}});xg.prototype=Object.assign(Object.create(Nc.prototype),{constructor:xg,isSpotLightShadow:!0,updateMatrices:function(a,b,c){var d=this.camera,f=2*Qa.RAD2DEG*a.angle,g=this.mapSize.width/
this.mapSize.height,h=a.distance||d.far;if(f!==d.fov||g!==d.aspect||h!==d.far)d.fov=f,d.aspect=g,d.far=h,d.updateProjectionMatrix();Nc.prototype.updateMatrices.call(this,a,b,c)}});yg.prototype=Object.assign(Object.create(qb.prototype),{constructor:yg,isSpotLight:!0,copy:function(a){qb.prototype.copy.call(this,a);this.distance=a.distance;this.angle=a.angle;this.penumbra=a.penumbra;this.decay=a.decay;this.target=a.target.clone();this.shadow=a.shadow.clone();return this}});Jh.prototype=Object.assign(Object.create(Nc.prototype),
{constructor:Jh,isPointLightShadow:!0,updateMatrices:function(a,b,c){b=this.camera;var d=this.matrix,f=this._lightPositionWorld,g=this._lookTarget,h=this._projScreenMatrix;f.setFromMatrixPosition(a.matrixWorld);b.position.copy(f);g.copy(b.position);g.add(this._cubeDirections[c]);b.up.copy(this._cubeUps[c]);b.lookAt(g);b.updateMatrixWorld();d.makeTranslation(-f.x,-f.y,-f.z);h.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);this._frustum.setFromMatrix(h)}});zg.prototype=Object.assign(Object.create(qb.prototype),
{constructor:zg,isPointLight:!0,copy:function(a){qb.prototype.copy.call(this,a);this.distance=a.distance;this.decay=a.decay;this.shadow=a.shadow.clone();return this}});Mf.prototype=Object.assign(Object.create(Fb.prototype),{constructor:Mf,isOrthographicCamera:!0,copy:function(a,b){Fb.prototype.copy.call(this,a,b);this.left=a.left;this.right=a.right;this.top=a.top;this.bottom=a.bottom;this.near=a.near;this.far=a.far;this.zoom=a.zoom;this.view=null===a.view?null:Object.assign({},a.view);return this},
setViewOffset:function(a,b,c,d,f,g){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=a;this.view.fullHeight=b;this.view.offsetX=c;this.view.offsetY=d;this.view.width=f;this.view.height=g;this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1);this.updateProjectionMatrix()},updateProjectionMatrix:function(){var a=(this.right-this.left)/(2*this.zoom),b=(this.top-
this.bottom)/(2*this.zoom),c=(this.right+this.left)/2,d=(this.top+this.bottom)/2,f=c-a;c+=a;a=d+b;b=d-b;if(null!==this.view&&this.view.enabled){c=this.zoom/(this.view.width/this.view.fullWidth);b=this.zoom/(this.view.height/this.view.fullHeight);var g=(this.right-this.left)/this.view.width;d=(this.top-this.bottom)/this.view.height;f+=this.view.offsetX/c*g;c=f+this.view.width/c*g;a-=this.view.offsetY/b*d;b=a-this.view.height/b*d}this.projectionMatrix.makeOrthographic(f,c,a,b,this.near,this.far);this.projectionMatrixInverse.getInverse(this.projectionMatrix)},
toJSON:function(a){a=I.prototype.toJSON.call(this,a);a.object.zoom=this.zoom;a.object.left=this.left;a.object.right=this.right;a.object.top=this.top;a.object.bottom=this.bottom;a.object.near=this.near;a.object.far=this.far;null!==this.view&&(a.object.view=Object.assign({},this.view));return a}});Ag.prototype=Object.assign(Object.create(Nc.prototype),{constructor:Ag,isDirectionalLightShadow:!0,updateMatrices:function(a,b,c){Nc.prototype.updateMatrices.call(this,a,b,c)}});Bg.prototype=Object.assign(Object.create(qb.prototype),
{constructor:Bg,isDirectionalLight:!0,copy:function(a){qb.prototype.copy.call(this,a);this.target=a.target.clone();this.shadow=a.shadow.clone();return this}});Cg.prototype=Object.assign(Object.create(qb.prototype),{constructor:Cg,isAmbientLight:!0});Dg.prototype=Object.assign(Object.create(qb.prototype),{constructor:Dg,isRectAreaLight:!0,copy:function(a){qb.prototype.copy.call(this,a);this.width=a.width;this.height=a.height;return this},toJSON:function(a){a=qb.prototype.toJSON.call(this,a);a.object.width=
this.width;a.object.height=this.height;return a}});Eg.prototype=Object.assign(Object.create(ib.prototype),{constructor:Eg,load:function(a,b,c,d){var f=this,g=new lc(f.manager);g.setPath(f.path);g.load(a,function(h){b(f.parse(JSON.parse(h)))},c,d)},parse:function(a){function b(l){void 0===c[l]&&console.warn("THREE.MaterialLoader: Undefined texture",l);return c[l]}var c=this.textures,d=new em[a.type];void 0!==a.uuid&&(d.uuid=a.uuid);void 0!==a.name&&(d.name=a.name);void 0!==a.color&&d.color.setHex(a.color);
void 0!==a.roughness&&(d.roughness=a.roughness);void 0!==a.metalness&&(d.metalness=a.metalness);void 0!==a.emissive&&d.emissive.setHex(a.emissive);void 0!==a.specular&&d.specular.setHex(a.specular);void 0!==a.shininess&&(d.shininess=a.shininess);void 0!==a.clearcoat&&(d.clearcoat=a.clearcoat);void 0!==a.clearcoatRoughness&&(d.clearcoatRoughness=a.clearcoatRoughness);void 0!==a.vertexColors&&(d.vertexColors=a.vertexColors);void 0!==a.fog&&(d.fog=a.fog);void 0!==a.flatShading&&(d.flatShading=a.flatShading);
void 0!==a.blending&&(d.blending=a.blending);void 0!==a.combine&&(d.combine=a.combine);void 0!==a.side&&(d.side=a.side);void 0!==a.opacity&&(d.opacity=a.opacity);void 0!==a.transparent&&(d.transparent=a.transparent);void 0!==a.alphaTest&&(d.alphaTest=a.alphaTest);void 0!==a.depthTest&&(d.depthTest=a.depthTest);void 0!==a.depthWrite&&(d.depthWrite=a.depthWrite);void 0!==a.colorWrite&&(d.colorWrite=a.colorWrite);void 0!==a.wireframe&&(d.wireframe=a.wireframe);void 0!==a.wireframeLinewidth&&(d.wireframeLinewidth=
a.wireframeLinewidth);void 0!==a.wireframeLinecap&&(d.wireframeLinecap=a.wireframeLinecap);void 0!==a.wireframeLinejoin&&(d.wireframeLinejoin=a.wireframeLinejoin);void 0!==a.rotation&&(d.rotation=a.rotation);1!==a.linewidth&&(d.linewidth=a.linewidth);void 0!==a.dashSize&&(d.dashSize=a.dashSize);void 0!==a.gapSize&&(d.gapSize=a.gapSize);void 0!==a.scale&&(d.scale=a.scale);void 0!==a.polygonOffset&&(d.polygonOffset=a.polygonOffset);void 0!==a.polygonOffsetFactor&&(d.polygonOffsetFactor=a.polygonOffsetFactor);
void 0!==a.polygonOffsetUnits&&(d.polygonOffsetUnits=a.polygonOffsetUnits);void 0!==a.skinning&&(d.skinning=a.skinning);void 0!==a.morphTargets&&(d.morphTargets=a.morphTargets);void 0!==a.morphNormals&&(d.morphNormals=a.morphNormals);void 0!==a.dithering&&(d.dithering=a.dithering);void 0!==a.visible&&(d.visible=a.visible);void 0!==a.toneMapped&&(d.toneMapped=a.toneMapped);void 0!==a.userData&&(d.userData=a.userData);if(void 0!==a.uniforms)for(var f in a.uniforms){var g=a.uniforms[f];d.uniforms[f]=
{};switch(g.type){case "t":d.uniforms[f].value=b(g.value);break;case "c":d.uniforms[f].value=(new ca).setHex(g.value);break;case "v2":d.uniforms[f].value=(new k).fromArray(g.value);break;case "v3":d.uniforms[f].value=(new p).fromArray(g.value);break;case "v4":d.uniforms[f].value=(new E).fromArray(g.value);break;case "m3":d.uniforms[f].value=(new v).fromArray(g.value);case "m4":d.uniforms[f].value=(new A).fromArray(g.value);break;default:d.uniforms[f].value=g.value}}void 0!==a.defines&&(d.defines=
a.defines);void 0!==a.vertexShader&&(d.vertexShader=a.vertexShader);void 0!==a.fragmentShader&&(d.fragmentShader=a.fragmentShader);if(void 0!==a.extensions)for(var h in a.extensions)d.extensions[h]=a.extensions[h];void 0!==a.shading&&(d.flatShading=1===a.shading);void 0!==a.size&&(d.size=a.size);void 0!==a.sizeAttenuation&&(d.sizeAttenuation=a.sizeAttenuation);void 0!==a.map&&(d.map=b(a.map));void 0!==a.matcap&&(d.matcap=b(a.matcap));void 0!==a.alphaMap&&(d.alphaMap=b(a.alphaMap),d.transparent=!0);
void 0!==a.bumpMap&&(d.bumpMap=b(a.bumpMap));void 0!==a.bumpScale&&(d.bumpScale=a.bumpScale);void 0!==a.normalMap&&(d.normalMap=b(a.normalMap));void 0!==a.normalMapType&&(d.normalMapType=a.normalMapType);void 0!==a.normalScale&&(f=a.normalScale,!1===Array.isArray(f)&&(f=[f,f]),d.normalScale=(new k).fromArray(f));void 0!==a.displacementMap&&(d.displacementMap=b(a.displacementMap));void 0!==a.displacementScale&&(d.displacementScale=a.displacementScale);void 0!==a.displacementBias&&(d.displacementBias=
a.displacementBias);void 0!==a.roughnessMap&&(d.roughnessMap=b(a.roughnessMap));void 0!==a.metalnessMap&&(d.metalnessMap=b(a.metalnessMap));void 0!==a.emissiveMap&&(d.emissiveMap=b(a.emissiveMap));void 0!==a.emissiveIntensity&&(d.emissiveIntensity=a.emissiveIntensity);void 0!==a.specularMap&&(d.specularMap=b(a.specularMap));void 0!==a.envMap&&(d.envMap=b(a.envMap));void 0!==a.envMapIntensity&&(d.envMapIntensity=a.envMapIntensity);void 0!==a.reflectivity&&(d.reflectivity=a.reflectivity);void 0!==a.refractionRatio&&
(d.refractionRatio=a.refractionRatio);void 0!==a.lightMap&&(d.lightMap=b(a.lightMap));void 0!==a.lightMapIntensity&&(d.lightMapIntensity=a.lightMapIntensity);void 0!==a.aoMap&&(d.aoMap=b(a.aoMap));void 0!==a.aoMapIntensity&&(d.aoMapIntensity=a.aoMapIntensity);void 0!==a.gradientMap&&(d.gradientMap=b(a.gradientMap));void 0!==a.clearcoatNormalMap&&(d.clearcoatNormalMap=b(a.clearcoatNormalMap));void 0!==a.clearcoatNormalScale&&(d.clearcoatNormalScale=(new k).fromArray(a.clearcoatNormalScale));return d},
setTextures:function(a){this.textures=a;return this}});var ui={decodeText:function(a){if("undefined"!==typeof TextDecoder)return(new TextDecoder).decode(a);for(var b="",c=0,d=a.length;c<d;c++)b+=String.fromCharCode(a[c]);try{return decodeURIComponent(escape(b))}catch(f){return b}},extractUrlBase:function(a){var b=a.lastIndexOf("/");return-1===b?"./":a.substr(0,b+1)}};Fg.prototype=Object.assign(Object.create(la.prototype),{constructor:Fg,isInstancedBufferGeometry:!0,copy:function(a){la.prototype.copy.call(this,
a);this.maxInstancedCount=a.maxInstancedCount;return this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var a=la.prototype.toJSON.call(this);a.maxInstancedCount=this.maxInstancedCount;a.isInstancedBufferGeometry=!0;return a}});Gg.prototype=Object.assign(Object.create(Ea.prototype),{constructor:Gg,isInstancedBufferAttribute:!0,copy:function(a){Ea.prototype.copy.call(this,a);this.meshPerAttribute=a.meshPerAttribute;return this},toJSON:function(){var a=Ea.prototype.toJSON.call(this);
a.meshPerAttribute=this.meshPerAttribute;a.isInstancedBufferAttribute=!0;return a}});Hg.prototype=Object.assign(Object.create(ib.prototype),{constructor:Hg,load:function(a,b,c,d){var f=this,g=new lc(f.manager);g.setPath(f.path);g.load(a,function(h){b(f.parse(JSON.parse(h)))},c,d)},parse:function(a){var b=a.isInstancedBufferGeometry?new Fg:new la,c=a.data.index;if(void 0!==c){var d=new vi[c.type](c.array);b.setIndex(new Ea(d,1))}c=a.data.attributes;for(var f in c){var g=c[f];d=new vi[g.type](g.array);
d=new (g.isInstancedBufferAttribute?Gg:Ea)(d,g.itemSize,g.normalized);void 0!==g.name&&(d.name=g.name);b.addAttribute(f,d)}var h=a.data.morphAttributes;if(h)for(f in h){var l=h[f],m=[];c=0;for(var q=l.length;c<q;c++)g=l[c],d=new vi[g.type](g.array),d=new Ea(d,g.itemSize,g.normalized),void 0!==g.name&&(d.name=g.name),m.push(d);b.morphAttributes[f]=m}f=a.data.groups||a.data.drawcalls||a.data.offsets;if(void 0!==f)for(c=0,g=f.length;c!==g;++c)d=f[c],b.addGroup(d.start,d.count,d.materialIndex);c=a.data.boundingSphere;
void 0!==c&&(f=new p,void 0!==c.center&&f.fromArray(c.center),b.boundingSphere=new U(f,c.radius));a.name&&(b.name=a.name);a.userData&&(b.userData=a.userData);return b}});var vi={Int8Array,Uint8Array,Uint8ClampedArray:"undefined"!==typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};Ig.prototype=Object.assign(Object.create(ib.prototype),{constructor:Ig,load:function(a,b,c,d){var f=this,g=""===this.path?ui.extractUrlBase(a):
this.path;this.resourcePath=this.resourcePath||g;g=new lc(f.manager);g.setPath(this.path);g.load(a,function(h){var l=null;try{l=JSON.parse(h)}catch(m){void 0!==d&&d(m);console.error("THREE:ObjectLoader: Can't parse "+a+".",m.message);return}h=l.metadata;void 0===h||void 0===h.type||"geometry"===h.type.toLowerCase()?console.error("THREE.ObjectLoader: Can't load "+a):f.parse(l,b)},c,d)},parse:function(a,b){var c=this.parseShape(a.shapes);c=this.parseGeometries(a.geometries,c);var d=this.parseImages(a.images,
function(){void 0!==b&&b(f)});d=this.parseTextures(a.textures,d);d=this.parseMaterials(a.materials,d);var f=this.parseObject(a.object,c,d);a.animations&&(f.animations=this.parseAnimations(a.animations));void 0!==a.images&&0!==a.images.length||void 0===b||b(f);return f},parseShape:function(a){var b={};if(void 0!==a)for(var c=0,d=a.length;c<d;c++){var f=(new qd).fromJSON(a[c]);b[f.uuid]=f}return b},parseGeometries:function(a,b){var c={};if(void 0!==a)for(var d=new Hg,f=0,g=a.length;f<g;f++){var h=a[f];
switch(h.type){case "PlaneGeometry":case "PlaneBufferGeometry":var l=new Wb[h.type](h.width,h.height,h.widthSegments,h.heightSegments);break;case "BoxGeometry":case "BoxBufferGeometry":case "CubeGeometry":l=new Wb[h.type](h.width,h.height,h.depth,h.widthSegments,h.heightSegments,h.depthSegments);break;case "CircleGeometry":case "CircleBufferGeometry":l=new Wb[h.type](h.radius,h.segments,h.thetaStart,h.thetaLength);break;case "CylinderGeometry":case "CylinderBufferGeometry":l=new Wb[h.type](h.radiusTop,
h.radiusBottom,h.height,h.radialSegments,h.heightSegments,h.openEnded,h.thetaStart,h.thetaLength);break;case "ConeGeometry":case "ConeBufferGeometry":l=new Wb[h.type](h.radius,h.height,h.radialSegments,h.heightSegments,h.openEnded,h.thetaStart,h.thetaLength);break;case "SphereGeometry":case "SphereBufferGeometry":l=new Wb[h.type](h.radius,h.widthSegments,h.heightSegments,h.phiStart,h.phiLength,h.thetaStart,h.thetaLength);break;case "DodecahedronGeometry":case "DodecahedronBufferGeometry":case "IcosahedronGeometry":case "IcosahedronBufferGeometry":case "OctahedronGeometry":case "OctahedronBufferGeometry":case "TetrahedronGeometry":case "TetrahedronBufferGeometry":l=
new Wb[h.type](h.radius,h.detail);break;case "RingGeometry":case "RingBufferGeometry":l=new Wb[h.type](h.innerRadius,h.outerRadius,h.thetaSegments,h.phiSegments,h.thetaStart,h.thetaLength);break;case "TorusGeometry":case "TorusBufferGeometry":l=new Wb[h.type](h.radius,h.tube,h.radialSegments,h.tubularSegments,h.arc);break;case "TorusKnotGeometry":case "TorusKnotBufferGeometry":l=new Wb[h.type](h.radius,h.tube,h.tubularSegments,h.radialSegments,h.p,h.q);break;case "TubeGeometry":case "TubeBufferGeometry":l=
new Wb[h.type]((new ti[h.path.type]).fromJSON(h.path),h.tubularSegments,h.radius,h.radialSegments,h.closed);break;case "LatheGeometry":case "LatheBufferGeometry":l=new Wb[h.type](h.points,h.segments,h.phiStart,h.phiLength);break;case "PolyhedronGeometry":case "PolyhedronBufferGeometry":l=new Wb[h.type](h.vertices,h.indices,h.radius,h.details);break;case "ShapeGeometry":case "ShapeBufferGeometry":l=[];for(var m=0,q=h.shapes.length;m<q;m++){var u=b[h.shapes[m]];l.push(u)}l=new Wb[h.type](l,h.curveSegments);
break;case "ExtrudeGeometry":case "ExtrudeBufferGeometry":l=[];m=0;for(q=h.shapes.length;m<q;m++)u=b[h.shapes[m]],l.push(u);m=h.options.extrudePath;void 0!==m&&(h.options.extrudePath=(new ti[m.type]).fromJSON(m));l=new Wb[h.type](l,h.options);break;case "BufferGeometry":case "InstancedBufferGeometry":l=d.parse(h);break;case "Geometry":"THREE"in window&&"LegacyJSONLoader"in THREE?l=(new THREE.LegacyJSONLoader).parse(h,this.resourcePath).geometry:console.error('THREE.ObjectLoader: You have to import LegacyJSONLoader in order load geometry data of type "Geometry".');
break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+h.type+'"');continue}l.uuid=h.uuid;void 0!==h.name&&(l.name=h.name);!0===l.isBufferGeometry&&void 0!==h.userData&&(l.userData=h.userData);c[h.uuid]=l}return c},parseMaterials:function(a,b){var c={},d={};if(void 0!==a){var f=new Eg;f.setTextures(b);b=0;for(var g=a.length;b<g;b++){var h=a[b];if("MultiMaterial"===h.type){for(var l=[],m=0;m<h.materials.length;m++){var q=h.materials[m];void 0===c[q.uuid]&&(c[q.uuid]=f.parse(q));
l.push(c[q.uuid])}d[h.uuid]=l}else void 0===c[h.uuid]&&(c[h.uuid]=f.parse(h)),d[h.uuid]=c[h.uuid]}}return d},parseAnimations:function(a){for(var b=[],c=0;c<a.length;c++){var d=a[c],f=kc.parse(d);void 0!==d.uuid&&(f.uuid=d.uuid);b.push(f)}return b},parseImages:function(a,b){function c(y){d.manager.itemStart(y);return g.load(y,function(){d.manager.itemEnd(y)},void 0,function(){d.manager.itemError(y);d.manager.itemEnd(y)})}var d=this,f={};if(void 0!==a&&0<a.length){b=new Fh(b);var g=new Ge(b);g.setCrossOrigin(this.crossOrigin);
b=0;for(var h=a.length;b<h;b++){var l=a[b],m=l.url;if(Array.isArray(m)){f[l.uuid]=[];for(var q=0,u=m.length;q<u;q++){var w=m[q];w=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(w)?w:d.resourcePath+w;f[l.uuid].push(c(w))}}else w=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l.url)?l.url:d.resourcePath+l.url,f[l.uuid]=c(w)}}return f},parseTextures:function(a,b){function c(m,q){if("number"===typeof m)return m;console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",m);return q[m]}var d={};if(void 0!==
a)for(var f=0,g=a.length;f<g;f++){var h=a[f];void 0===h.image&&console.warn('THREE.ObjectLoader: No "image" specified for',h.uuid);void 0===b[h.image]&&console.warn("THREE.ObjectLoader: Undefined image",h.image);var l=Array.isArray(b[h.image])?new Tc(b[h.image]):new z(b[h.image]);l.needsUpdate=!0;l.uuid=h.uuid;void 0!==h.name&&(l.name=h.name);void 0!==h.mapping&&(l.mapping=c(h.mapping,fm));void 0!==h.offset&&l.offset.fromArray(h.offset);void 0!==h.repeat&&l.repeat.fromArray(h.repeat);void 0!==h.center&&
l.center.fromArray(h.center);void 0!==h.rotation&&(l.rotation=h.rotation);void 0!==h.wrap&&(l.wrapS=c(h.wrap[0],Rj),l.wrapT=c(h.wrap[1],Rj));void 0!==h.format&&(l.format=h.format);void 0!==h.type&&(l.type=h.type);void 0!==h.encoding&&(l.encoding=h.encoding);void 0!==h.minFilter&&(l.minFilter=c(h.minFilter,Sj));void 0!==h.magFilter&&(l.magFilter=c(h.magFilter,Sj));void 0!==h.anisotropy&&(l.anisotropy=h.anisotropy);void 0!==h.flipY&&(l.flipY=h.flipY);void 0!==h.premultiplyAlpha&&(l.premultiplyAlpha=
h.premultiplyAlpha);void 0!==h.unpackAlignment&&(l.unpackAlignment=h.unpackAlignment);d[h.uuid]=l}return d},parseObject:function(a,b,c){function d(q){void 0===b[q]&&console.warn("THREE.ObjectLoader: Undefined geometry",q);return b[q]}function f(q){if(void 0!==q){if(Array.isArray(q)){for(var u=[],w=0,y=q.length;w<y;w++){var C=q[w];void 0===c[C]&&console.warn("THREE.ObjectLoader: Undefined material",C);u.push(c[C])}return u}void 0===c[q]&&console.warn("THREE.ObjectLoader: Undefined material",q);return c[q]}}
switch(a.type){case "Scene":var g=new aa;void 0!==a.background&&Number.isInteger(a.background)&&(g.background=new ca(a.background));void 0!==a.fog&&("Fog"===a.fog.type?g.fog=new jg(a.fog.color,a.fog.near,a.fog.far):"FogExp2"===a.fog.type&&(g.fog=new ig(a.fog.color,a.fog.density)));break;case "PerspectiveCamera":g=new kb(a.fov,a.aspect,a.near,a.far);void 0!==a.focus&&(g.focus=a.focus);void 0!==a.zoom&&(g.zoom=a.zoom);void 0!==a.filmGauge&&(g.filmGauge=a.filmGauge);void 0!==a.filmOffset&&(g.filmOffset=
a.filmOffset);void 0!==a.view&&(g.view=Object.assign({},a.view));break;case "OrthographicCamera":g=new Mf(a.left,a.right,a.top,a.bottom,a.near,a.far);void 0!==a.zoom&&(g.zoom=a.zoom);void 0!==a.view&&(g.view=Object.assign({},a.view));break;case "AmbientLight":g=new Cg(a.color,a.intensity);break;case "DirectionalLight":g=new Bg(a.color,a.intensity);break;case "PointLight":g=new zg(a.color,a.intensity,a.distance,a.decay);break;case "RectAreaLight":g=new Dg(a.color,a.intensity,a.width,a.height);break;
case "SpotLight":g=new yg(a.color,a.intensity,a.distance,a.angle,a.penumbra,a.decay);break;case "HemisphereLight":g=new wg(a.color,a.groundColor,a.intensity);break;case "SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case "Mesh":g=d(a.geometry);var h=f(a.material);g=g.bones&&0<g.bones.length?new kf(g,h):new Oa(g,h);void 0!==a.drawMode&&g.setDrawMode(a.drawMode);break;case "LOD":g=new jf;break;case "Line":g=new Ib(d(a.geometry),f(a.material),a.mode);
break;case "LineLoop":g=new mg(d(a.geometry),f(a.material));break;case "LineSegments":g=new pb(d(a.geometry),f(a.material));break;case "PointCloud":case "Points":g=new oe(d(a.geometry),f(a.material));break;case "Sprite":g=new gf(f(a.material));break;case "Group":g=new ge;break;default:g=new I}g.uuid=a.uuid;void 0!==a.name&&(g.name=a.name);void 0!==a.matrix?(g.matrix.fromArray(a.matrix),void 0!==a.matrixAutoUpdate&&(g.matrixAutoUpdate=a.matrixAutoUpdate),g.matrixAutoUpdate&&g.matrix.decompose(g.position,
g.quaternion,g.scale)):(void 0!==a.position&&g.position.fromArray(a.position),void 0!==a.rotation&&g.rotation.fromArray(a.rotation),void 0!==a.quaternion&&g.quaternion.fromArray(a.quaternion),void 0!==a.scale&&g.scale.fromArray(a.scale));void 0!==a.castShadow&&(g.castShadow=a.castShadow);void 0!==a.receiveShadow&&(g.receiveShadow=a.receiveShadow);a.shadow&&(void 0!==a.shadow.bias&&(g.shadow.bias=a.shadow.bias),void 0!==a.shadow.radius&&(g.shadow.radius=a.shadow.radius),void 0!==a.shadow.mapSize&&
g.shadow.mapSize.fromArray(a.shadow.mapSize),void 0!==a.shadow.camera&&(g.shadow.camera=this.parseObject(a.shadow.camera)));void 0!==a.visible&&(g.visible=a.visible);void 0!==a.frustumCulled&&(g.frustumCulled=a.frustumCulled);void 0!==a.renderOrder&&(g.renderOrder=a.renderOrder);void 0!==a.userData&&(g.userData=a.userData);void 0!==a.layers&&(g.layers.mask=a.layers);if(void 0!==a.children){h=a.children;for(var l=0;l<h.length;l++)g.add(this.parseObject(h[l],b,c))}if("LOD"===a.type)for(a=a.levels,h=
0;h<a.length;h++){l=a[h];var m=g.getObjectByProperty("uuid",l.object);void 0!==m&&g.addLevel(m,l.distance)}return g}});var fm={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,SphericalReflectionMapping:305,CubeUVReflectionMapping:306,CubeUVRefractionMapping:307},Rj={RepeatWrapping:1E3,ClampToEdgeWrapping:1001,MirroredRepeatWrapping:1002},Sj={NearestFilter:1003,NearestMipmapNearestFilter:1004,NearestMipmapLinearFilter:1005,
LinearFilter:1006,LinearMipmapNearestFilter:1007,LinearMipmapLinearFilter:1008};Kh.prototype=Object.assign(Object.create(ib.prototype),{constructor:Kh,setOptions:function(a){this.options=a;return this},load:function(a,b,c,d){void 0===a&&(a="");void 0!==this.path&&(a=this.path+a);a=this.manager.resolveURL(a);var f=this,g=Wd.get(a);if(void 0!==g)return f.manager.itemStart(a),setTimeout(function(){b&&b(g);f.manager.itemEnd(a)},0),g;fetch(a).then(function(h){return h.blob()}).then(function(h){return void 0===
f.options?createImageBitmap(h):createImageBitmap(h,f.options)}).then(function(h){Wd.add(a,h);b&&b(h);f.manager.itemEnd(a)}).catch(function(h){d&&d(h);f.manager.itemError(a);f.manager.itemEnd(a)});f.manager.itemStart(a)}});Object.assign(Lh.prototype,{moveTo:function(a,b){this.currentPath=new wc;this.subPaths.push(this.currentPath);this.currentPath.moveTo(a,b)},lineTo:function(a,b){this.currentPath.lineTo(a,b)},quadraticCurveTo:function(a,b,c,d){this.currentPath.quadraticCurveTo(a,b,c,d)},bezierCurveTo:function(a,
b,c,d,f,g){this.currentPath.bezierCurveTo(a,b,c,d,f,g)},splineThru:function(a){this.currentPath.splineThru(a)},toShapes:function(a,b){function c(J){for(var W=[],T=0,V=J.length;T<V;T++){var Z=J[T],R=new qd;R.curves=Z.curves;W.push(R)}return W}function d(J,W){for(var T=W.length,V=!1,Z=T-1,R=0;R<T;Z=R++){var Y=W[Z],ea=W[R],za=ea.x-Y.x,Aa=ea.y-Y.y;if(Math.abs(Aa)>Number.EPSILON){if(0>Aa&&(Y=W[R],za=-za,ea=W[Z],Aa=-Aa),!(J.y<Y.y||J.y>ea.y))if(J.y===Y.y){if(J.x===Y.x)return!0}else{Z=Aa*(J.x-Y.x)-za*(J.y-
Y.y);if(0===Z)return!0;0>Z||(V=!V)}}else if(J.y===Y.y&&(ea.x<=J.x&&J.x<=Y.x||Y.x<=J.x&&J.x<=ea.x))return!0}return V}var f=Vc.isClockWise,g=this.subPaths;if(0===g.length)return[];if(!0===b)return c(g);b=[];if(1===g.length){var h=g[0];var l=new qd;l.curves=h.curves;b.push(l);return b}var m=!f(g[0].getPoints());m=a?!m:m;l=[];var q=[],u=[],w=0;q[w]=void 0;u[w]=[];for(var y=0,C=g.length;y<C;y++){h=g[y];var D=h.getPoints();var K=f(D);(K=a?!K:K)?(!m&&q[w]&&w++,q[w]={s:new qd,p:D},q[w].s.curves=h.curves,
m&&w++,u[w]=[]):u[w].push({h,p:D[0]})}if(!q[0])return c(g);if(1<q.length){y=!1;a=[];f=0;for(g=q.length;f<g;f++)l[f]=[];f=0;for(g=q.length;f<g;f++)for(h=u[f],K=0;K<h.length;K++){m=h[K];w=!0;for(D=0;D<q.length;D++)d(m.p,q[D].p)&&(f!==D&&a.push({froms:f,tos:D,hole:K}),w?(w=!1,l[D].push(m)):y=!0);w&&l[f].push(m)}0<a.length&&(y||(u=l))}y=0;for(f=q.length;y<f;y++)for(l=q[y].s,b.push(l),a=u[y],g=0,h=a.length;g<h;g++)l.holes.push(a[g].h);return b}});Object.assign(Mh.prototype,{isFont:!0,generateShapes:function(a,
b){void 0===b&&(b=100);var c=[];a=Ql(a,b,this.data);b=0;for(var d=a.length;b<d;b++)Array.prototype.push.apply(c,a[b].toShapes());return c}});Nh.prototype=Object.assign(Object.create(ib.prototype),{constructor:Nh,load:function(a,b,c,d){var f=this,g=new lc(this.manager);g.setPath(this.path);g.load(a,function(h){try{var l=JSON.parse(h)}catch(m){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),l=JSON.parse(h.substring(65,h.length-2))}h=f.parse(l);b&&
b(h)},c,d)},parse:function(a){return new Mh(a)}});var hh,Sh={getContext:function(){void 0===hh&&(hh=new (window.AudioContext||window.webkitAudioContext));return hh},setContext:function(a){hh=a}};Jg.prototype=Object.assign(Object.create(ib.prototype),{constructor:Jg,load:function(a,b,c,d){var f=new lc(this.manager);f.setResponseType("arraybuffer");f.setPath(this.path);f.load(a,function(g){g=g.slice(0);Sh.getContext().decodeAudioData(g,function(h){b(h)})},c,d)}});Object.assign(Kg.prototype,{isSphericalHarmonics3:!0,
set:function(a){for(var b=0;9>b;b++)this.coefficients[b].copy(a[b]);return this},zero:function(){for(var a=0;9>a;a++)this.coefficients[a].set(0,0,0);return this},getAt:function(a,b){var c=a.x,d=a.y;a=a.z;var f=this.coefficients;b.copy(f[0]).multiplyScalar(.282095);b.addScale(f[1],.488603*d);b.addScale(f[2],.488603*a);b.addScale(f[3],.488603*c);b.addScale(f[4],1.092548*c*d);b.addScale(f[5],1.092548*d*a);b.addScale(f[6],.315392*(3*a*a-1));b.addScale(f[7],1.092548*c*a);b.addScale(f[8],.546274*(c*c-d*
d));return b},getIrradianceAt:function(a,b){var c=a.x,d=a.y;a=a.z;var f=this.coefficients;b.copy(f[0]).multiplyScalar(.886227);b.addScale(f[1],1.023328*d);b.addScale(f[2],1.023328*a);b.addScale(f[3],1.023328*c);b.addScale(f[4],.858086*c*d);b.addScale(f[5],.858086*d*a);b.addScale(f[6],.743125*a*a-.247708);b.addScale(f[7],.858086*c*a);b.addScale(f[8],.429043*(c*c-d*d));return b},add:function(a){for(var b=0;9>b;b++)this.coefficients[b].add(a.coefficients[b]);return this},scale:function(a){for(var b=
0;9>b;b++)this.coefficients[b].multiplyScalar(a);return this},lerp:function(a,b){for(var c=0;9>c;c++)this.coefficients[c].lerp(a.coefficients[c],b);return this},equals:function(a){for(var b=0;9>b;b++)if(!this.coefficients[b].equals(a.coefficients[b]))return!1;return!0},copy:function(a){return this.set(a.coefficients)},clone:function(){return(new this.constructor).copy(this)},fromArray:function(a,b){void 0===b&&(b=0);for(var c=this.coefficients,d=0;9>d;d++)c[d].fromArray(a,b+3*d);return this},toArray:function(a,
b){void 0===a&&(a=[]);void 0===b&&(b=0);for(var c=this.coefficients,d=0;9>d;d++)c[d].toArray(a,b+3*d);return a}});Object.assign(Kg,{getBasisAt:function(a,b){var c=a.x,d=a.y;a=a.z;b[0]=.282095;b[1]=.488603*d;b[2]=.488603*a;b[3]=.488603*c;b[4]=1.092548*c*d;b[5]=1.092548*d*a;b[6]=.315392*(3*a*a-1);b[7]=1.092548*c*a;b[8]=.546274*(c*c-d*d)}});xc.prototype=Object.assign(Object.create(qb.prototype),{constructor:xc,isLightProbe:!0,copy:function(a){qb.prototype.copy.call(this,a);this.sh.copy(a.sh);this.intensity=
a.intensity;return this},toJSON:function(a){return qb.prototype.toJSON.call(this,a)}});Oh.prototype=Object.assign(Object.create(xc.prototype),{constructor:Oh,isHemisphereLightProbe:!0,copy:function(a){xc.prototype.copy.call(this,a);return this},toJSON:function(a){return xc.prototype.toJSON.call(this,a)}});Ph.prototype=Object.assign(Object.create(xc.prototype),{constructor:Ph,isAmbientLightProbe:!0,copy:function(a){xc.prototype.copy.call(this,a);return this},toJSON:function(a){return xc.prototype.toJSON.call(this,
a)}});var Tj=new A,Uj=new A;Object.assign(pj.prototype,{update:function(a){var b=this._cache;if(b.focus!==a.focus||b.fov!==a.fov||b.aspect!==a.aspect*this.aspect||b.near!==a.near||b.far!==a.far||b.zoom!==a.zoom||b.eyeSep!==this.eyeSep){b.focus=a.focus;b.fov=a.fov;b.aspect=a.aspect*this.aspect;b.near=a.near;b.far=a.far;b.zoom=a.zoom;b.eyeSep=this.eyeSep;var c=a.projectionMatrix.clone(),d=b.eyeSep/2,f=d*b.near/b.focus,g=b.near*Math.tan(Qa.DEG2RAD*b.fov*.5)/b.zoom;Uj.elements[12]=-d;Tj.elements[12]=
d;d=-g*b.aspect+f;var h=g*b.aspect+f;c.elements[0]=2*b.near/(h-d);c.elements[8]=(h+d)/(h-d);this.cameraL.projectionMatrix.copy(c);d=-g*b.aspect-f;h=g*b.aspect-f;c.elements[0]=2*b.near/(h-d);c.elements[8]=(h+d)/(h-d);this.cameraR.projectionMatrix.copy(c)}this.cameraL.matrixWorld.copy(a.matrixWorld).multiply(Uj);this.cameraR.matrixWorld.copy(a.matrixWorld).multiply(Tj)}});Object.assign(Qh.prototype,{start:function(){this.oldTime=this.startTime=("undefined"===typeof performance?Date:performance).now();
this.elapsedTime=0;this.running=!0},stop:function(){this.getElapsedTime();this.autoStart=this.running=!1},getElapsedTime:function(){this.getDelta();return this.elapsedTime},getDelta:function(){var a=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var b=("undefined"===typeof performance?Date:performance).now();a=(b-this.oldTime)/1E3;this.oldTime=b;this.elapsedTime+=a}return a}});var Xd=new p,Vj=new n,gm=new p,Yd=new p;Rh.prototype=Object.assign(Object.create(I.prototype),
{constructor:Rh,getInput:function(){return this.gain},removeFilter:function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null);return this},getFilter:function(){return this.filter},setFilter:function(a){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination);this.filter=a;this.gain.connect(this.filter);
this.filter.connect(this.context.destination);return this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(a){this.gain.gain.setTargetAtTime(a,this.context.currentTime,.01);return this},updateMatrixWorld:function(a){I.prototype.updateMatrixWorld.call(this,a);a=this.context.listener;var b=this.up;this.timeDelta=this._clock.getDelta();this.matrixWorld.decompose(Xd,Vj,gm);Yd.set(0,0,-1).applyQuaternion(Vj);if(a.positionX){var c=this.context.currentTime+this.timeDelta;
a.positionX.linearRampToValueAtTime(Xd.x,c);a.positionY.linearRampToValueAtTime(Xd.y,c);a.positionZ.linearRampToValueAtTime(Xd.z,c);a.forwardX.linearRampToValueAtTime(Yd.x,c);a.forwardY.linearRampToValueAtTime(Yd.y,c);a.forwardZ.linearRampToValueAtTime(Yd.z,c);a.upX.linearRampToValueAtTime(b.x,c);a.upY.linearRampToValueAtTime(b.y,c);a.upZ.linearRampToValueAtTime(b.z,c)}else a.setPosition(Xd.x,Xd.y,Xd.z),a.setOrientation(Yd.x,Yd.y,Yd.z,b.x,b.y,b.z)}});Ie.prototype=Object.assign(Object.create(I.prototype),
{constructor:Ie,getOutput:function(){return this.gain},setNodeSource:function(a){this.hasPlaybackControl=!1;this.sourceType="audioNode";this.source=a;this.connect();return this},setMediaElementSource:function(a){this.hasPlaybackControl=!1;this.sourceType="mediaNode";this.source=this.context.createMediaElementSource(a);this.connect();return this},setBuffer:function(a){this.buffer=a;this.sourceType="buffer";this.autoplay&&this.play();return this},play:function(){if(!0===this.isPlaying)console.warn("THREE.Audio: Audio is already playing.");
else if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else{var a=this.context.createBufferSource();a.buffer=this.buffer;a.loop=this.loop;a.onended=this.onEnded.bind(this);this.startTime=this.context.currentTime;a.start(this.startTime,this.offset,this.duration);this.isPlaying=!0;this.source=a;this.setDetune(this.detune);this.setPlaybackRate(this.playbackRate);return this.connect()}},pause:function(){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");
else return!0===this.isPlaying&&(this.source.stop(),this.source.onended=null,this.offset+=(this.context.currentTime-this.startTime)*this.playbackRate,this.isPlaying=!1),this},stop:function(){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else return this.source.stop(),this.source.onended=null,this.offset=0,this.isPlaying=!1,this},connect:function(){if(0<this.filters.length){this.source.connect(this.filters[0]);for(var a=1,b=this.filters.length;a<b;a++)this.filters[a-
1].connect(this.filters[a]);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 a=1,b=this.filters.length;a<b;a++)this.filters[a-1].disconnect(this.filters[a]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(a){a||
(a=[]);!0===this.isPlaying?(this.disconnect(),this.filters=a,this.connect()):this.filters=a;return this},setDetune:function(a){this.detune=a;if(void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this},getDetune:function(){return this.detune},getFilter:function(){return this.getFilters()[0]},setFilter:function(a){return this.setFilters(a?[a]:[])},setPlaybackRate:function(a){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");
else return this.playbackRate=a,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this},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(a){if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else return this.loop=
a,!0===this.isPlaying&&(this.source.loop=this.loop),this},getVolume:function(){return this.gain.gain.value},setVolume:function(a){this.gain.gain.setTargetAtTime(a,this.context.currentTime,.01);return this}});var Zd=new p,Wj=new n,hm=new p,$d=new p;Th.prototype=Object.assign(Object.create(Ie.prototype),{constructor:Th,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(a){this.panner.refDistance=a;return this},getRolloffFactor:function(){return this.panner.rolloffFactor},
setRolloffFactor:function(a){this.panner.rolloffFactor=a;return this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(a){this.panner.distanceModel=a;return this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(a){this.panner.maxDistance=a;return this},setDirectionalCone:function(a,b,c){this.panner.coneInnerAngle=a;this.panner.coneOuterAngle=b;this.panner.coneOuterGain=c;return this},updateMatrixWorld:function(a){I.prototype.updateMatrixWorld.call(this,
a);if(!0!==this.hasPlaybackControl||!1!==this.isPlaying)if(this.matrixWorld.decompose(Zd,Wj,hm),$d.set(0,0,1).applyQuaternion(Wj),a=this.panner,a.positionX){var b=this.context.currentTime+this.listener.timeDelta;a.positionX.linearRampToValueAtTime(Zd.x,b);a.positionY.linearRampToValueAtTime(Zd.y,b);a.positionZ.linearRampToValueAtTime(Zd.z,b);a.orientationX.linearRampToValueAtTime($d.x,b);a.orientationY.linearRampToValueAtTime($d.y,b);a.orientationZ.linearRampToValueAtTime($d.z,b)}else a.setPosition(Zd.x,
Zd.y,Zd.z),a.setOrientation($d.x,$d.y,$d.z)}});Object.assign(Uh.prototype,{getFrequencyData:function(){this.analyser.getByteFrequencyData(this.data);return this.data},getAverageFrequency:function(){for(var a=0,b=this.getFrequencyData(),c=0;c<b.length;c++)a+=b[c];return a/b.length}});Object.assign(Vh.prototype,{accumulate:function(a,b){var c=this.buffer,d=this.valueSize;a=a*d+d;var f=this.cumulativeWeight;if(0===f){for(f=0;f!==d;++f)c[a+f]=c[f];f=b}else f+=b,this._mixBufferRegion(c,a,0,b/f,d);this.cumulativeWeight=
f},apply:function(a){var b=this.valueSize,c=this.buffer;a=a*b+b;var d=this.cumulativeWeight,f=this.binding;this.cumulativeWeight=0;1>d&&this._mixBufferRegion(c,a,3*b,1-d,b);d=b;for(var g=b+b;d!==g;++d)if(c[d]!==c[d+b]){f.setValue(c,a);break}},saveOriginalState:function(){var a=this.buffer,b=this.valueSize,c=3*b;this.binding.getValue(a,c);for(var d=b;d!==c;++d)a[d]=a[c+d%b];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(a,
b,c,d,f){if(.5<=d)for(d=0;d!==f;++d)a[b+d]=a[c+d]},_slerp:function(a,b,c,d){n.slerpFlat(a,b,a,b,a,c,d)},_lerp:function(a,b,c,d,f){for(var g=1-d,h=0;h!==f;++h){var l=b+h;a[l]=a[l]*g+a[c+h]*d}}});var im=/[\[\]\.:\/]/g,jm="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",km=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),lm=/(WCOD+)?/.source.replace("WCOD",jm),mm=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),nm=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),om=
new RegExp("^"+km+lm+mm+nm+"$"),pm=["material","materials","bones"];Object.assign(qj.prototype,{getValue:function(a,b){this.bind();var c=this._bindings[this._targetGroup.nCachedObjects_];void 0!==c&&c.getValue(a,b)},setValue:function(a,b){for(var c=this._bindings,d=this._targetGroup.nCachedObjects_,f=c.length;d!==f;++d)c[d].setValue(a,b)},bind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,c=a.length;b!==c;++b)a[b].bind()},unbind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,
c=a.length;b!==c;++b)a[b].unbind()}});Object.assign(Pb,{Composite:qj,create:function(a,b,c){return a&&a.isAnimationObjectGroup?new Pb.Composite(a,b,c):new Pb(a,b,c)},sanitizeNodeName:function(a){return a.replace(/\s/g,"_").replace(im,"")},parseTrackName:function(a){var b=om.exec(a);if(!b)throw Error("PropertyBinding: Cannot parse trackName: "+a);b={nodeName:b[2],objectName:b[3],objectIndex:b[4],propertyName:b[5],propertyIndex:b[6]};var c=b.nodeName&&b.nodeName.lastIndexOf(".");if(void 0!==c&&-1!==
c){var d=b.nodeName.substring(c+1);-1!==pm.indexOf(d)&&(b.nodeName=b.nodeName.substring(0,c),b.objectName=d)}if(null===b.propertyName||0===b.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+a);return b},findNode:function(a,b){if(!b||""===b||"root"===b||"."===b||-1===b||b===a.name||b===a.uuid)return a;if(a.skeleton){var c=a.skeleton.getBoneByName(b);if(void 0!==c)return c}if(a.children){var d=function(f){for(var g=0;g<f.length;g++){var h=f[g];if(h.name===
b||h.uuid===b)return h;if(h=d(h.children))return h}return null};if(a=d(a.children))return a}return null}});Object.assign(Pb.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(a,b){a[b]=this.node[this.propertyName]},function(a,b){for(var c=this.resolvedProperty,d=0,f=c.length;d!==f;++d)a[b++]=c[d]},function(a,b){a[b]=
this.resolvedProperty[this.propertyIndex]},function(a,b){this.resolvedProperty.toArray(a,b)}],SetterByBindingTypeAndVersioning:[[function(a,b){this.targetObject[this.propertyName]=a[b]},function(a,b){this.targetObject[this.propertyName]=a[b];this.targetObject.needsUpdate=!0},function(a,b){this.targetObject[this.propertyName]=a[b];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(a,b){for(var c=this.resolvedProperty,d=0,f=c.length;d!==f;++d)c[d]=a[b++]},function(a,b){for(var c=this.resolvedProperty,
d=0,f=c.length;d!==f;++d)c[d]=a[b++];this.targetObject.needsUpdate=!0},function(a,b){for(var c=this.resolvedProperty,d=0,f=c.length;d!==f;++d)c[d]=a[b++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(a,b){this.resolvedProperty[this.propertyIndex]=a[b]},function(a,b){this.resolvedProperty[this.propertyIndex]=a[b];this.targetObject.needsUpdate=!0},function(a,b){this.resolvedProperty[this.propertyIndex]=a[b];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(a,b){this.resolvedProperty.fromArray(a,
b)},function(a,b){this.resolvedProperty.fromArray(a,b);this.targetObject.needsUpdate=!0},function(a,b){this.resolvedProperty.fromArray(a,b);this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(a,b){this.bind();this.getValue(a,b)},setValue:function(a,b){this.bind();this.setValue(a,b)},bind:function(){var a=this.node,b=this.parsedPath,c=b.objectName,d=b.propertyName,f=b.propertyIndex;a||(this.node=a=Pb.findNode(this.rootNode,b.nodeName)||this.rootNode);this.getValue=this._getValue_unavailable;
this.setValue=this._setValue_unavailable;if(a){if(c){var g=b.objectIndex;switch(c){case "materials":if(!a.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!a.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}a=a.material.materials;break;case "bones":if(!a.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",
this);return}a=a.skeleton.bones;for(c=0;c<a.length;c++)if(a[c].name===g){g=c;break}break;default:if(void 0===a[c]){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}a=a[c]}if(void 0!==g){if(void 0===a[g]){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,a);return}a=a[g]}}g=a[d];if(void 0===g)console.error("THREE.PropertyBinding: Trying to update property for track: "+b.nodeName+"."+d+" but it wasn't found.",
a);else{b=this.Versioning.None;this.targetObject=a;void 0!==a.needsUpdate?b=this.Versioning.NeedsUpdate:void 0!==a.matrixWorldNeedsUpdate&&(b=this.Versioning.MatrixWorldNeedsUpdate);c=this.BindingType.Direct;if(void 0!==f){if("morphTargetInfluences"===d){if(!a.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(a.geometry.isBufferGeometry){if(!a.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",
this);return}for(c=0;c<this.node.geometry.morphAttributes.position.length;c++)if(a.geometry.morphAttributes.position[c].name===f){f=c;break}}else{if(!a.geometry.morphTargets){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphTargets.",this);return}for(c=0;c<this.node.geometry.morphTargets.length;c++)if(a.geometry.morphTargets[c].name===f){f=c;break}}}c=this.BindingType.ArrayElement;this.resolvedProperty=g;this.propertyIndex=f}else void 0!==
g.fromArray&&void 0!==g.toArray?(c=this.BindingType.HasFromToArray,this.resolvedProperty=g):Array.isArray(g)?(c=this.BindingType.EntireArray,this.resolvedProperty=g):this.propertyName=d;this.getValue=this.GetterByBindingType[c];this.setValue=this.SetterByBindingTypeAndVersioning[c][b]}}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(Pb.prototype,{_getValue_unbound:Pb.prototype.getValue,_setValue_unbound:Pb.prototype.setValue});Object.assign(rj.prototype,{isAnimationObjectGroup:!0,add:function(){for(var a=this._objects,b=a.length,c=this.nCachedObjects_,d=this._indicesByUUID,f=this._paths,g=this._parsedPaths,h=this._bindings,l=h.length,m=void 0,q=0,u=arguments.length;q!==u;++q){var w=arguments[q],y=w.uuid,C=d[y];if(void 0===C){C=b++;d[y]=C;a.push(w);y=0;for(var D=l;y!==D;++y)h[y].push(new Pb(w,f[y],g[y]))}else if(C<
c){m=a[C];var K=--c;D=a[K];d[D.uuid]=C;a[C]=D;d[y]=K;a[K]=w;y=0;for(D=l;y!==D;++y){var J=h[y],W=J[C];J[C]=J[K];void 0===W&&(W=new Pb(w,f[y],g[y]));J[K]=W}}else a[C]!==m&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c},remove:function(){for(var a=this._objects,b=this.nCachedObjects_,c=this._indicesByUUID,d=this._bindings,f=d.length,g=0,h=arguments.length;g!==h;++g){var l=
arguments[g],m=l.uuid,q=c[m];if(void 0!==q&&q>=b){var u=b++,w=a[u];c[w.uuid]=q;a[q]=w;c[m]=u;a[u]=l;l=0;for(m=f;l!==m;++l){w=d[l];var y=w[q];w[q]=w[u];w[u]=y}}}this.nCachedObjects_=b},uncache:function(){for(var a=this._objects,b=a.length,c=this.nCachedObjects_,d=this._indicesByUUID,f=this._bindings,g=f.length,h=0,l=arguments.length;h!==l;++h){var m=arguments[h].uuid,q=d[m];if(void 0!==q)if(delete d[m],q<c){m=--c;var u=a[m],w=--b,y=a[w];d[u.uuid]=q;a[q]=u;d[y.uuid]=m;a[m]=y;a.pop();u=0;for(y=g;u!==
y;++u){var C=f[u],D=C[w];C[q]=C[m];C[m]=D;C.pop()}}else for(w=--b,y=a[w],d[y.uuid]=q,a[q]=y,a.pop(),u=0,y=g;u!==y;++u)C=f[u],C[q]=C[w],C.pop()}this.nCachedObjects_=c},subscribe_:function(a,b){var c=this._bindingsIndicesByPath,d=c[a],f=this._bindings;if(void 0!==d)return f[d];var g=this._paths,h=this._parsedPaths,l=this._objects,m=this.nCachedObjects_,q=Array(l.length);d=f.length;c[a]=d;g.push(a);h.push(b);f.push(q);c=m;for(d=l.length;c!==d;++c)q[c]=new Pb(l[c],a,b);return q},unsubscribe_:function(a){var b=
this._bindingsIndicesByPath,c=b[a];if(void 0!==c){var d=this._paths,f=this._parsedPaths,g=this._bindings,h=g.length-1,l=g[h];b[a[h]]=c;g[c]=l;g.pop();f[c]=f[h];f.pop();d[c]=d[h];d.pop()}}});Object.assign(sj.prototype,{play:function(){this._mixer._activateAction(this);return this},stop:function(){this._mixer._deactivateAction(this);return this.reset()},reset:function(){this.paused=!1;this.enabled=!0;this.time=0;this._loopCount=-1;this._startTime=null;return 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(a){this._startTime=a;return this},setLoop:function(a,b){this.loop=a;this.repetitions=b;return this},setEffectiveWeight:function(a){this.weight=a;this._effectiveWeight=this.enabled?a:0;return this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(a){return this._scheduleFading(a,0,1)},fadeOut:function(a){return this._scheduleFading(a,
1,0)},crossFadeFrom:function(a,b,c){a.fadeOut(b);this.fadeIn(b);if(c){c=this._clip.duration;var d=a._clip.duration,f=c/d;a.warp(1,d/c,b);this.warp(f,1,b)}return this},crossFadeTo:function(a,b,c){return a.crossFadeFrom(this,b,c)},stopFading:function(){var a=this._weightInterpolant;null!==a&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(a));return this},setEffectiveTimeScale:function(a){this.timeScale=a;this._effectiveTimeScale=this.paused?0:a;return this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},
setDuration:function(a){this.timeScale=this._clip.duration/a;return this.stopWarping()},syncWith:function(a){this.time=a.time;this.timeScale=a.timeScale;return this.stopWarping()},halt:function(a){return this.warp(this._effectiveTimeScale,0,a)},warp:function(a,b,c){var d=this._mixer,f=d.time,g=this._timeScaleInterpolant,h=this.timeScale;null===g&&(this._timeScaleInterpolant=g=d._lendControlInterpolant());d=g.parameterPositions;g=g.sampleValues;d[0]=f;d[1]=f+c;g[0]=a/h;g[1]=b/h;return this},stopWarping:function(){var a=
this._timeScaleInterpolant;null!==a&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(a));return this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(a,b,c,d){if(this.enabled){var f=this._startTime;if(null!==f){b=(a-f)*c;if(0>b||0===c)return;this._startTime=null;b*=c}b*=this._updateTimeScale(a);c=this._updateTime(b);a=this._updateWeight(a);if(0<a){b=this._interpolants;
f=this._propertyBindings;for(var g=0,h=b.length;g!==h;++g)b[g].evaluate(c),f[g].accumulate(d,a)}}else this._updateWeight(a)},_updateWeight:function(a){var b=0;if(this.enabled){b=this.weight;var c=this._weightInterpolant;if(null!==c){var d=c.evaluate(a)[0];b*=d;a>c.parameterPositions[1]&&(this.stopFading(),0===d&&(this.enabled=!1))}}return this._effectiveWeight=b},_updateTimeScale:function(a){var b=0;if(!this.paused){b=this.timeScale;var c=this._timeScaleInterpolant;if(null!==c){var d=c.evaluate(a)[0];
b*=d;a>c.parameterPositions[1]&&(this.stopWarping(),0===b?this.paused=!0:this.timeScale=b)}}return this._effectiveTimeScale=b},_updateTime:function(a){var b=this.time+a,c=this._clip.duration,d=this.loop,f=this._loopCount,g=2202===d;if(0===a)return-1===f?b:g&&1===(f&1)?c-b:b;if(2200===d)a:{if(-1===f&&(this._loopCount=0,this._setEndings(!0,!0,!1)),b>=c)b=c;else if(0>b)b=0;else{this.time=b;break a}this.clampWhenFinished?this.paused=!0:this.enabled=!1;this.time=b;this._mixer.dispatchEvent({type:"finished",
action:this,direction:0>a?-1:1})}else{-1===f&&(0<=a?(f=0,this._setEndings(!0,0===this.repetitions,g)):this._setEndings(0===this.repetitions,!0,g));if(b>=c||0>b){d=Math.floor(b/c);b-=c*d;f+=Math.abs(d);var h=this.repetitions-f;0>=h?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=b=0<a?c:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:0<a?1:-1})):(1===h?(a=0>a,this._setEndings(a,!a,g)):this._setEndings(!1,!1,g),this._loopCount=f,this.time=b,this._mixer.dispatchEvent({type:"loop",
action:this,loopDelta:d}))}else this.time=b;if(g&&1===(f&1))return c-b}return b},_setEndings:function(a,b,c){var d=this._interpolantSettings;c?(d.endingStart=2401,d.endingEnd=2401):(d.endingStart=a?this.zeroSlopeAtStart?2401:2400:2402,d.endingEnd=b?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(a,b,c){var d=this._mixer,f=d.time,g=this._weightInterpolant;null===g&&(this._weightInterpolant=g=d._lendControlInterpolant());d=g.parameterPositions;g=g.sampleValues;d[0]=f;g[0]=b;d[1]=f+a;g[1]=
c;return this}});Wh.prototype=Object.assign(Object.create(r.prototype),{constructor:Wh,_bindAction:function(a,b){var c=a._localRoot||this._root,d=a._clip.tracks,f=d.length,g=a._propertyBindings;a=a._interpolants;var h=c.uuid,l=this._bindingsByRootAndName,m=l[h];void 0===m&&(m={},l[h]=m);for(l=0;l!==f;++l){var q=d[l],u=q.name,w=m[u];if(void 0===w){w=g[l];if(void 0!==w){null===w._cacheIndex&&(++w.referenceCount,this._addInactiveBinding(w,h,u));continue}w=new Vh(Pb.create(c,u,b&&b._propertyBindings[l].binding.parsedPath),
q.ValueTypeName,q.getValueSize());++w.referenceCount;this._addInactiveBinding(w,h,u)}g[l]=w;a[l].resultBuffer=w.buffer}},_activateAction:function(a){if(!this._isActiveAction(a)){if(null===a._cacheIndex){var b=(a._localRoot||this._root).uuid,c=a._clip.uuid,d=this._actionsByClip[c];this._bindAction(a,d&&d.knownActions[0]);this._addInactiveAction(a,c,b)}b=a._propertyBindings;c=0;for(d=b.length;c!==d;++c){var f=b[c];0===f.useCount++&&(this._lendBinding(f),f.saveOriginalState())}this._lendAction(a)}},
_deactivateAction:function(a){if(this._isActiveAction(a)){for(var b=a._propertyBindings,c=0,d=b.length;c!==d;++c){var f=b[c];0===--f.useCount&&(f.restoreOriginalState(),this._takeBackBinding(f))}this._takeBackAction(a)}},_initMemoryManager:function(){this._actions=[];this._nActiveActions=0;this._actionsByClip={};this._bindings=[];this._nActiveBindings=0;this._bindingsByRootAndName={};this._controlInterpolants=[];this._nActiveControlInterpolants=0;var a=this;this.stats={actions:{get total(){return a._actions.length},
get inUse(){return a._nActiveActions}},bindings:{get total(){return a._bindings.length},get inUse(){return a._nActiveBindings}},controlInterpolants:{get total(){return a._controlInterpolants.length},get inUse(){return a._nActiveControlInterpolants}}}},_isActiveAction:function(a){a=a._cacheIndex;return null!==a&&a<this._nActiveActions},_addInactiveAction:function(a,b,c){var d=this._actions,f=this._actionsByClip,g=f[b];void 0===g?(g={knownActions:[a],actionByRoot:{}},a._byClipCacheIndex=0,f[b]=g):(b=
g.knownActions,a._byClipCacheIndex=b.length,b.push(a));a._cacheIndex=d.length;d.push(a);g.actionByRoot[c]=a},_removeInactiveAction:function(a){var b=this._actions,c=b[b.length-1],d=a._cacheIndex;c._cacheIndex=d;b[d]=c;b.pop();a._cacheIndex=null;b=a._clip.uuid;c=this._actionsByClip;d=c[b];var f=d.knownActions,g=f[f.length-1],h=a._byClipCacheIndex;g._byClipCacheIndex=h;f[h]=g;f.pop();a._byClipCacheIndex=null;delete d.actionByRoot[(a._localRoot||this._root).uuid];0===f.length&&delete c[b];this._removeInactiveBindingsForAction(a)},
_removeInactiveBindingsForAction:function(a){a=a._propertyBindings;for(var b=0,c=a.length;b!==c;++b){var d=a[b];0===--d.referenceCount&&this._removeInactiveBinding(d)}},_lendAction:function(a){var b=this._actions,c=a._cacheIndex,d=this._nActiveActions++,f=b[d];a._cacheIndex=d;b[d]=a;f._cacheIndex=c;b[c]=f},_takeBackAction:function(a){var b=this._actions,c=a._cacheIndex,d=--this._nActiveActions,f=b[d];a._cacheIndex=d;b[d]=a;f._cacheIndex=c;b[c]=f},_addInactiveBinding:function(a,b,c){var d=this._bindingsByRootAndName,
f=d[b],g=this._bindings;void 0===f&&(f={},d[b]=f);f[c]=a;a._cacheIndex=g.length;g.push(a)},_removeInactiveBinding:function(a){var b=this._bindings,c=a.binding,d=c.rootNode.uuid;c=c.path;var f=this._bindingsByRootAndName,g=f[d],h=b[b.length-1];a=a._cacheIndex;h._cacheIndex=a;b[a]=h;b.pop();delete g[c];0===Object.keys(g).length&&delete f[d]},_lendBinding:function(a){var b=this._bindings,c=a._cacheIndex,d=this._nActiveBindings++,f=b[d];a._cacheIndex=d;b[d]=a;f._cacheIndex=c;b[c]=f},_takeBackBinding:function(a){var b=
this._bindings,c=a._cacheIndex,d=--this._nActiveBindings,f=b[d];a._cacheIndex=d;b[d]=a;f._cacheIndex=c;b[c]=f},_lendControlInterpolant:function(){var a=this._controlInterpolants,b=this._nActiveControlInterpolants++,c=a[b];void 0===c&&(c=new If(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),c.__cacheIndex=b,a[b]=c);return c},_takeBackControlInterpolant:function(a){var b=this._controlInterpolants,c=a.__cacheIndex,d=--this._nActiveControlInterpolants,f=b[d];a.__cacheIndex=
d;b[d]=a;f.__cacheIndex=c;b[c]=f},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(a,b){var c=b||this._root,d=c.uuid;c="string"===typeof a?kc.findByName(c,a):a;a=null!==c?c.uuid:a;var f=this._actionsByClip[a],g=null;if(void 0!==f){g=f.actionByRoot[d];if(void 0!==g)return g;g=f.knownActions[0];null===c&&(c=g._clip)}if(null===c)return null;b=new sj(this,c,b);this._bindAction(b,g);this._addInactiveAction(b,a,d);return b},existingAction:function(a,b){var c=b||this._root;b=c.uuid;
c="string"===typeof a?kc.findByName(c,a):a;a=this._actionsByClip[c?c.uuid:a];return void 0!==a?a.actionByRoot[b]||null:null},stopAllAction:function(){for(var a=this._actions,b=this._nActiveActions,c=this._bindings,d=this._nActiveBindings,f=this._nActiveBindings=this._nActiveActions=0;f!==b;++f)a[f].reset();for(f=0;f!==d;++f)c[f].useCount=0;return this},update:function(a){a*=this.timeScale;for(var b=this._actions,c=this._nActiveActions,d=this.time+=a,f=Math.sign(a),g=this._accuIndex^=1,h=0;h!==c;++h)b[h]._update(d,
a,f,g);a=this._bindings;b=this._nActiveBindings;for(h=0;h!==b;++h)a[h].apply(g);return this},getRoot:function(){return this._root},uncacheClip:function(a){var b=this._actions;a=a.uuid;var c=this._actionsByClip,d=c[a];if(void 0!==d){d=d.knownActions;for(var f=0,g=d.length;f!==g;++f){var h=d[f];this._deactivateAction(h);var l=h._cacheIndex,m=b[b.length-1];h._cacheIndex=null;h._byClipCacheIndex=null;m._cacheIndex=l;b[l]=m;b.pop();this._removeInactiveBindingsForAction(h)}delete c[a]}},uncacheRoot:function(a){a=
a.uuid;var b=this._actionsByClip;for(d in b){var c=b[d].actionByRoot[a];void 0!==c&&(this._deactivateAction(c),this._removeInactiveAction(c))}var d=this._bindingsByRootAndName[a];if(void 0!==d)for(var f in d)a=d[f],a.restoreOriginalState(),this._removeInactiveBinding(a)},uncacheAction:function(a,b){a=this.existingAction(a,b);null!==a&&(this._deactivateAction(a),this._removeInactiveAction(a))}});Lg.prototype.clone=function(){return new Lg(void 0===this.value.clone?this.value:this.value.clone())};Xh.prototype=
Object.assign(Object.create(Dd.prototype),{constructor:Xh,isInstancedInterleavedBuffer:!0,copy:function(a){Dd.prototype.copy.call(this,a);this.meshPerAttribute=a.meshPerAttribute;return this}});Object.assign(tj.prototype,{linePrecision:1,set:function(a,b){this.ray.set(a,b)},setFromCamera:function(a,b){b&&b.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(b.matrixWorld),this.ray.direction.set(a.x,a.y,.5).unproject(b).sub(this.ray.origin).normalize(),this.camera=b):b&&b.isOrthographicCamera?
(this.ray.origin.set(a.x,a.y,(b.near+b.far)/(b.near-b.far)).unproject(b),this.ray.direction.set(0,0,-1).transformDirection(b.matrixWorld),this.camera=b):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(a,b,c){c=c||[];Yh(a,this,c,b);c.sort(uj);return c},intersectObjects:function(a,b,c){c=c||[];if(!1===Array.isArray(a))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),c;for(var d=0,f=a.length;d<f;d++)Yh(a[d],this,c,b);c.sort(uj);return c}});
Object.assign(vj.prototype,{set:function(a,b,c){this.radius=a;this.phi=b;this.theta=c;return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.radius=a.radius;this.phi=a.phi;this.theta=a.theta;return this},makeSafe:function(){this.phi=Math.max(1E-6,Math.min(Math.PI-1E-6,this.phi));return this},setFromVector3:function(a){return this.setFromCartesianCoords(a.x,a.y,a.z)},setFromCartesianCoords:function(a,b,c){this.radius=Math.sqrt(a*a+b*b+c*c);0===this.radius?this.phi=
this.theta=0:(this.theta=Math.atan2(a,c),this.phi=Math.acos(Qa.clamp(b/this.radius,-1,1)));return this}});Object.assign(wj.prototype,{set:function(a,b,c){this.radius=a;this.theta=b;this.y=c;return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.radius=a.radius;this.theta=a.theta;this.y=a.y;return this},setFromVector3:function(a){return this.setFromCartesianCoords(a.x,a.y,a.z)},setFromCartesianCoords:function(a,b,c){this.radius=Math.sqrt(a*a+c*c);this.theta=Math.atan2(a,
c);this.y=b;return this}});var Xj=new k;Object.assign(Zh.prototype,{set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromPoints:function(a){this.makeEmpty();for(var b=0,c=a.length;b<c;b++)this.expandByPoint(a[b]);return this},setFromCenterAndSize:function(a,b){b=Xj.copy(b).multiplyScalar(.5);this.min.copy(a).sub(b);this.max.copy(a).add(b);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.min.copy(a.min);this.max.copy(a.max);return this},
makeEmpty:function(){this.min.x=this.min.y=Infinity;this.max.x=this.max.y=-Infinity;return this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(a){void 0===a&&(console.warn("THREE.Box2: .getCenter() target is now required"),a=new k);return this.isEmpty()?a.set(0,0):a.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(a){void 0===a&&(console.warn("THREE.Box2: .getSize() target is now required"),a=new k);return this.isEmpty()?a.set(0,0):a.subVectors(this.max,
this.min)},expandByPoint:function(a){this.min.min(a);this.max.max(a);return this},expandByVector:function(a){this.min.sub(a);this.max.add(a);return this},expandByScalar:function(a){this.min.addScalar(-a);this.max.addScalar(a);return this},containsPoint:function(a){return a.x<this.min.x||a.x>this.max.x||a.y<this.min.y||a.y>this.max.y?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y},getParameter:function(a,b){void 0===b&&(console.warn("THREE.Box2: .getParameter() target is now required"),
b=new k);return b.set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(a){return a.max.x<this.min.x||a.min.x>this.max.x||a.max.y<this.min.y||a.min.y>this.max.y?!1:!0},clampPoint:function(a,b){void 0===b&&(console.warn("THREE.Box2: .clampPoint() target is now required"),b=new k);return b.copy(a).clamp(this.min,this.max)},distanceToPoint:function(a){return Xj.copy(a).clamp(this.min,this.max).sub(a).length()},intersect:function(a){this.min.max(a.min);
this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}});var Yj=new p,ih=new p;Object.assign($h.prototype,{set:function(a,b){this.start.copy(a);this.end.copy(b);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.start.copy(a.start);this.end.copy(a.end);return this},getCenter:function(a){void 0===
a&&(console.warn("THREE.Line3: .getCenter() target is now required"),a=new p);return a.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(a){void 0===a&&(console.warn("THREE.Line3: .delta() target is now required"),a=new p);return a.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(a,b){void 0===b&&(console.warn("THREE.Line3: .at() target is now required"),b=
new p);return this.delta(b).multiplyScalar(a).add(this.start)},closestPointToPointParameter:function(a,b){Yj.subVectors(a,this.start);ih.subVectors(this.end,this.start);a=ih.dot(ih);a=ih.dot(Yj)/a;b&&(a=Qa.clamp(a,0,1));return a},closestPointToPoint:function(a,b,c){a=this.closestPointToPointParameter(a,b);void 0===c&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),c=new p);return this.delta(c).multiplyScalar(a).add(this.start)},applyMatrix4:function(a){this.start.applyMatrix4(a);
this.end.applyMatrix4(a);return this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)}});Nf.prototype=Object.create(I.prototype);Nf.prototype.constructor=Nf;Nf.prototype.isImmediateRenderObject=!0;var Rc=new p,ed=new p,wi=new v,qm=["a","b","c"];Of.prototype=Object.create(pb.prototype);Of.prototype.constructor=Of;Of.prototype.update=function(){this.object.updateMatrixWorld(!0);wi.getNormalMatrix(this.object.matrixWorld);var a=this.object.matrixWorld,b=this.geometry.attributes.position,
c=this.object.geometry;if(c&&c.isGeometry)for(var d=c.vertices,f=c.faces,g=c=0,h=f.length;g<h;g++)for(var l=f[g],m=0,q=l.vertexNormals.length;m<q;m++){var u=l.vertexNormals[m];Rc.copy(d[l[qm[m]]]).applyMatrix4(a);ed.copy(u).applyMatrix3(wi).normalize().multiplyScalar(this.size).add(Rc);b.setXYZ(c,Rc.x,Rc.y,Rc.z);c+=1;b.setXYZ(c,ed.x,ed.y,ed.z);c+=1}else if(c&&c.isBufferGeometry)for(d=c.attributes.position,f=c.attributes.normal,m=c=0,q=d.count;m<q;m++)Rc.set(d.getX(m),d.getY(m),d.getZ(m)).applyMatrix4(a),
ed.set(f.getX(m),f.getY(m),f.getZ(m)),ed.applyMatrix3(wi).normalize().multiplyScalar(this.size).add(Rc),b.setXYZ(c,Rc.x,Rc.y,Rc.z),c+=1,b.setXYZ(c,ed.x,ed.y,ed.z),c+=1;b.needsUpdate=!0};var Zj=new p;Je.prototype=Object.create(I.prototype);Je.prototype.constructor=Je;Je.prototype.dispose=function(){this.cone.geometry.dispose();this.cone.material.dispose()};Je.prototype.update=function(){this.light.updateMatrixWorld();var a=this.light.distance?this.light.distance:1E3,b=a*Math.tan(this.light.angle);
this.cone.scale.set(b,b,a);Zj.setFromMatrixPosition(this.light.target.matrixWorld);this.cone.lookAt(Zj);void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)};var wd=new p,jh=new A,xi=new A;Ke.prototype=Object.create(pb.prototype);Ke.prototype.constructor=Ke;Ke.prototype.updateMatrixWorld=function(a){var b=this.bones,c=this.geometry,d=c.getAttribute("position");xi.getInverse(this.root.matrixWorld);for(var f=0,g=0;f<b.length;f++){var h=b[f];h.parent&&
h.parent.isBone&&(jh.multiplyMatrices(xi,h.matrixWorld),wd.setFromMatrixPosition(jh),d.setXYZ(g,wd.x,wd.y,wd.z),jh.multiplyMatrices(xi,h.parent.matrixWorld),wd.setFromMatrixPosition(jh),d.setXYZ(g+1,wd.x,wd.y,wd.z),g+=2)}c.getAttribute("position").needsUpdate=!0;I.prototype.updateMatrixWorld.call(this,a)};Le.prototype=Object.create(Oa.prototype);Le.prototype.constructor=Le;Le.prototype.dispose=function(){this.geometry.dispose();this.material.dispose()};Le.prototype.update=function(){void 0!==this.color?
this.material.color.set(this.color):this.material.color.copy(this.light.color)};Me.prototype=Object.create(Ib.prototype);Me.prototype.constructor=Me;Me.prototype.update=function(){this.scale.set(.5*this.light.width,.5*this.light.height,1);if(void 0!==this.color)this.material.color.set(this.color),this.children[0].material.color.set(this.color);else{this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);var a=this.material.color,b=Math.max(a.r,a.g,a.b);1<b&&a.multiplyScalar(1/
b);this.children[0].material.color.copy(this.material.color)}};Me.prototype.dispose=function(){this.geometry.dispose();this.material.dispose();this.children[0].geometry.dispose();this.children[0].material.dispose()};var rm=new p,ak=new ca,bk=new ca;Ne.prototype=Object.create(I.prototype);Ne.prototype.constructor=Ne;Ne.prototype.dispose=function(){this.children[0].geometry.dispose();this.children[0].material.dispose()};Ne.prototype.update=function(){var a=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);
else{var b=a.geometry.getAttribute("color");ak.copy(this.light.color);bk.copy(this.light.groundColor);for(var c=0,d=b.count;c<d;c++){var f=c<d/2?ak:bk;b.setXYZ(c,f.r,f.g,f.b)}b.needsUpdate=!0}a.lookAt(rm.setFromMatrixPosition(this.light.matrixWorld).negate())};Oe.prototype=Object.create(Oa.prototype);Oe.prototype.constructor=Oe;Oe.prototype.dispose=function(){this.geometry.dispose();this.material.dispose()};Oe.prototype.onBeforeRender=function(){this.position.copy(this.lightProbe.position);this.scale.set(1,
1,1).multiplyScalar(this.size);this.material.uniforms.intensity.value=this.lightProbe.intensity};Mg.prototype=Object.assign(Object.create(pb.prototype),{constructor:Mg,copy:function(a){pb.prototype.copy.call(this,a);this.geometry.copy(a.geometry);this.material.copy(a.material);return this},clone:function(){return(new this.constructor).copy(this)}});Ng.prototype=Object.create(pb.prototype);Ng.prototype.constructor=Ng;Pe.prototype=Object.create(Ib.prototype);Pe.prototype.constructor=Pe;Pe.prototype.update=
function(){function a(D,K,J,W){J=(K-D)/J;C.setXYZ(m,0,0,0);q++;for(u=D;u<K;u+=J)w=m+q,C.setXYZ(w,Math.sin(u)*c,0,Math.cos(u)*c),C.setXYZ(w+1,Math.sin(Math.min(u+J,K))*c,0,Math.cos(Math.min(u+J,K))*c),C.setXYZ(w+2,0,0,0),q+=3;y.addGroup(m,q,W);m+=q;q=0}var b=this.audio,c=this.range,d=this.divisionsInnerAngle,f=this.divisionsOuterAngle,g=Qa.degToRad(b.panner.coneInnerAngle);b=Qa.degToRad(b.panner.coneOuterAngle);var h=g/2,l=b/2,m=0,q=0,u,w,y=this.geometry,C=y.attributes.position;y.clearGroups();a(-l,
-h,f,0);a(-h,h,d,1);a(h,l,f,0);C.needsUpdate=!0;g===b&&(this.material[0].visible=!1)};Pe.prototype.dispose=function(){this.geometry.dispose();this.material[0].dispose();this.material[1].dispose()};var ag=new p,kh=new p,ck=new v;Pf.prototype=Object.create(pb.prototype);Pf.prototype.constructor=Pf;Pf.prototype.update=function(){this.object.updateMatrixWorld(!0);ck.getNormalMatrix(this.object.matrixWorld);var a=this.object.matrixWorld,b=this.geometry.attributes.position,c=this.object.geometry,d=c.vertices;
c=c.faces;for(var f=0,g=0,h=c.length;g<h;g++){var l=c[g],m=l.normal;ag.copy(d[l.a]).add(d[l.b]).add(d[l.c]).divideScalar(3).applyMatrix4(a);kh.copy(m).applyMatrix3(ck).normalize().multiplyScalar(this.size).add(ag);b.setXYZ(f,ag.x,ag.y,ag.z);f+=1;b.setXYZ(f,kh.x,kh.y,kh.z);f+=1}b.needsUpdate=!0};var dk=new p,lh=new p,ek=new p;Qe.prototype=Object.create(I.prototype);Qe.prototype.constructor=Qe;Qe.prototype.dispose=function(){this.lightPlane.geometry.dispose();this.lightPlane.material.dispose();this.targetLine.geometry.dispose();
this.targetLine.material.dispose()};Qe.prototype.update=function(){dk.setFromMatrixPosition(this.light.matrixWorld);lh.setFromMatrixPosition(this.light.target.matrixWorld);ek.subVectors(lh,dk);this.lightPlane.lookAt(lh);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(lh);this.targetLine.scale.z=ek.length()};
var Og=new p,wb=new Fb;Qf.prototype=Object.create(pb.prototype);Qf.prototype.constructor=Qf;Qf.prototype.update=function(){var a=this.geometry,b=this.pointMap;wb.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse);zb("c",b,a,wb,0,0,-1);zb("t",b,a,wb,0,0,1);zb("n1",b,a,wb,-1,-1,-1);zb("n2",b,a,wb,1,-1,-1);zb("n3",b,a,wb,-1,1,-1);zb("n4",b,a,wb,1,1,-1);zb("f1",b,a,wb,-1,-1,1);zb("f2",b,a,wb,1,-1,1);zb("f3",b,a,wb,-1,1,1);zb("f4",b,a,wb,1,1,1);zb("u1",b,a,wb,.7,1.1,-1);zb("u2",b,a,wb,-.7,
1.1,-1);zb("u3",b,a,wb,0,2,-1);zb("cf1",b,a,wb,-1,0,1);zb("cf2",b,a,wb,1,0,1);zb("cf3",b,a,wb,0,-1,1);zb("cf4",b,a,wb,0,1,1);zb("cn1",b,a,wb,-1,0,-1);zb("cn2",b,a,wb,1,0,-1);zb("cn3",b,a,wb,0,-1,-1);zb("cn4",b,a,wb,0,1,-1);a.getAttribute("position").needsUpdate=!0};var mh=new G;Yc.prototype=Object.create(pb.prototype);Yc.prototype.constructor=Yc;Yc.prototype.update=function(a){void 0!==a&&console.warn("THREE.BoxHelper: .update() has no longer arguments.");void 0!==this.object&&mh.setFromObject(this.object);
if(!mh.isEmpty()){a=mh.min;var b=mh.max,c=this.geometry.attributes.position,d=c.array;d[0]=b.x;d[1]=b.y;d[2]=b.z;d[3]=a.x;d[4]=b.y;d[5]=b.z;d[6]=a.x;d[7]=a.y;d[8]=b.z;d[9]=b.x;d[10]=a.y;d[11]=b.z;d[12]=b.x;d[13]=b.y;d[14]=a.z;d[15]=a.x;d[16]=b.y;d[17]=a.z;d[18]=a.x;d[19]=a.y;d[20]=a.z;d[21]=b.x;d[22]=a.y;d[23]=a.z;c.needsUpdate=!0;this.geometry.computeBoundingSphere()}};Yc.prototype.setFromObject=function(a){this.object=a;this.update();return this};Yc.prototype.copy=function(a){pb.prototype.copy.call(this,
a);this.object=a.object;return this};Yc.prototype.clone=function(){return(new this.constructor).copy(this)};Rf.prototype=Object.create(pb.prototype);Rf.prototype.constructor=Rf;Rf.prototype.updateMatrixWorld=function(a){var b=this.box;b.isEmpty()||(b.getCenter(this.position),b.getSize(this.scale),this.scale.multiplyScalar(.5),I.prototype.updateMatrixWorld.call(this,a))};Sf.prototype=Object.create(Ib.prototype);Sf.prototype.constructor=Sf;Sf.prototype.updateMatrixWorld=function(a){var b=-this.plane.constant;
1E-8>Math.abs(b)&&(b=1E-8);this.scale.set(.5*this.size,.5*this.size,b);this.children[0].material.side=0>b?1:0;this.lookAt(this.plane.normal);I.prototype.updateMatrixWorld.call(this,a)};var fk=new p,Pg,ai;Zc.prototype=Object.create(I.prototype);Zc.prototype.constructor=Zc;Zc.prototype.setDirection=function(a){.99999<a.y?this.quaternion.set(0,0,0,1):-.99999>a.y?this.quaternion.set(1,0,0,0):(fk.set(a.z,0,-a.x).normalize(),this.quaternion.setFromAxisAngle(fk,Math.acos(a.y)))};Zc.prototype.setLength=function(a,
b,c){void 0===b&&(b=.2*a);void 0===c&&(c=.2*b);this.line.scale.set(1,Math.max(0,a-b),1);this.line.updateMatrix();this.cone.scale.set(c,b,c);this.cone.position.y=a;this.cone.updateMatrix()};Zc.prototype.setColor=function(a){this.line.material.color.set(a);this.cone.material.color.set(a)};Zc.prototype.copy=function(a){I.prototype.copy.call(this,a,!1);this.line.copy(a.line);this.cone.copy(a.cone);return this};Zc.prototype.clone=function(){return(new this.constructor).copy(this)};Tf.prototype=Object.create(pb.prototype);
Tf.prototype.constructor=Tf;Ga.create=function(a,b){console.log("THREE.Curve.create() has been deprecated");a.prototype=Object.create(Ga.prototype);a.prototype.constructor=a;a.prototype.getPoint=b;return a};Object.assign(Xc.prototype,{createPointsGeometry:function(a){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");a=this.getPoints(a);return this.createGeometry(a)},createSpacedPointsGeometry:function(a){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");
a=this.getSpacedPoints(a);return this.createGeometry(a)},createGeometry:function(a){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var b=new Ia,c=0,d=a.length;c<d;c++){var f=a[c];b.vertices.push(new p(f.x,f.y,f.z||0))}return b}});Object.assign(wc.prototype,{fromPoints:function(a){console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints().");this.setFromPoints(a)}});yj.prototype=Object.create(Ob.prototype);
zj.prototype=Object.create(Ob.prototype);bi.prototype=Object.create(Ob.prototype);Object.assign(bi.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.")}});Mg.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};
Ke.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};Object.assign(ib.prototype,{extractUrlBase:function(a){console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead.");return ui.extractUrlBase(a)}});Object.assign(Ig.prototype,{setTexturePath:function(a){console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath().");return this.setResourcePath(a)}});Object.assign(Zh.prototype,
{center:function(a){console.warn("THREE.Box2: .center() has been renamed to .getCenter().");return this.getCenter(a)},empty:function(){console.warn("THREE.Box2: .empty() has been renamed to .isEmpty().");return this.isEmpty()},isIntersectionBox:function(a){console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().");return this.intersectsBox(a)},size:function(a){console.warn("THREE.Box2: .size() has been renamed to .getSize().");return this.getSize(a)}});Object.assign(G.prototype,
{center:function(a){console.warn("THREE.Box3: .center() has been renamed to .getCenter().");return this.getCenter(a)},empty:function(){console.warn("THREE.Box3: .empty() has been renamed to .isEmpty().");return this.isEmpty()},isIntersectionBox:function(a){console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox().");return this.intersectsBox(a)},isIntersectionSphere:function(a){console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().");return this.intersectsSphere(a)},
size:function(a){console.warn("THREE.Box3: .size() has been renamed to .getSize().");return this.getSize(a)}});$h.prototype.center=function(a){console.warn("THREE.Line3: .center() has been renamed to .getCenter().");return this.getCenter(a)};Object.assign(Qa,{random16:function(){console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead.");return Math.random()},nearestPowerOfTwo:function(a){console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo().");
return Qa.floorPowerOfTwo(a)},nextPowerOfTwo:function(a){console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo().");return Qa.ceilPowerOfTwo(a)}});Object.assign(v.prototype,{flattenToArrayOffset:function(a,b){console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.");return this.toArray(a,b)},multiplyVector3:function(a){console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.");return a.applyMatrix3(this)},
multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBuffer:function(a){console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.");return this.applyToBufferAttribute(a)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}});Object.assign(A.prototype,{extractPosition:function(a){console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().");
return this.copyPosition(a)},flattenToArrayOffset:function(a,b){console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.");return this.toArray(a,b)},getPosition:function(){console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");return(new p).setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(a){console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().");
return this.makeRotationFromQuaternion(a)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(a){console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector4:function(a){console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},
rotateAxis:function(a){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");a.transformDirection(this)},crossVector:function(a){console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.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(a){console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.");return this.applyToBufferAttribute(a)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(a,b,c,d,f,g){console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead.");
return this.makePerspective(a,b,d,c,f,g)}});Hb.prototype.isIntersectionLine=function(a){console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().");return this.intersectsLine(a)};n.prototype.multiplyVector3=function(a){console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.");return a.applyQuaternion(this)};Object.assign(ba.prototype,{isIntersectionBox:function(a){console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox().");
return this.intersectsBox(a)},isIntersectionPlane:function(a){console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane().");return this.intersectsPlane(a)},isIntersectionSphere:function(a){console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere().");return this.intersectsSphere(a)}});Object.assign(ja.prototype,{area:function(){console.warn("THREE.Triangle: .area() has been renamed to .getArea().");return this.getArea()},barycoordFromPoint:function(a,
b){console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().");return this.getBarycoord(a,b)},midpoint:function(a){console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint().");return this.getMidpoint(a)},normal:function(a){console.warn("THREE.Triangle: .normal() has been renamed to .getNormal().");return this.getNormal(a)},plane:function(a){console.warn("THREE.Triangle: .plane() has been renamed to .getPlane().");return this.getPlane(a)}});Object.assign(ja,
{barycoordFromPoint:function(a,b,c,d,f){console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().");return ja.getBarycoord(a,b,c,d,f)},normal:function(a,b,c,d){console.warn("THREE.Triangle: .normal() has been renamed to .getNormal().");return ja.getNormal(a,b,c,d)}});Object.assign(qd.prototype,{extractAllPoints:function(a){console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead.");return this.extractPoints(a)},extrude:function(a){console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead.");
return new Hd(this,a)},makeGeometry:function(a){console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead.");return new Id(this,a)}});Object.assign(k.prototype,{fromAttribute:function(a,b,c){console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute().");return this.fromBufferAttribute(a,b,c)},distanceToManhattan:function(a){console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo().");return this.manhattanDistanceTo(a)},
lengthManhattan:function(){console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength().");return this.manhattanLength()}});Object.assign(p.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(a){console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().");
return this.setFromMatrixPosition(a)},getScaleFromMatrix:function(a){console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().");return this.setFromMatrixScale(a)},getColumnFromMatrix:function(a,b){console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().");return this.setFromMatrixColumn(b,a)},applyProjection:function(a){console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead.");return this.applyMatrix4(a)},
fromAttribute:function(a,b,c){console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute().");return this.fromBufferAttribute(a,b,c)},distanceToManhattan:function(a){console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo().");return this.manhattanDistanceTo(a)},lengthManhattan:function(){console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength().");return this.manhattanLength()}});Object.assign(E.prototype,
{fromAttribute:function(a,b,c){console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute().");return this.fromBufferAttribute(a,b,c)},lengthManhattan:function(){console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength().");return this.manhattanLength()}});Object.assign(Ia.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(I.prototype,{getChildByName:function(a){console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().");return this.getObjectByName(a)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(a,b){console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.");return this.translateOnAxis(b,a)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")}});
Object.defineProperties(I.prototype,{eulerOrder:{get:function(){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order.");return this.rotation.order},set:function(a){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order.");this.rotation.order=a}},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(jf.prototype,{objects:{get:function(){console.warn("THREE.LOD: .objects has been renamed to .levels.");return this.levels}}});Object.defineProperty(lg.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}});kf.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")};Object.defineProperty(Ga.prototype,
"__arcLengthDivisions",{get:function(){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.");return this.arcLengthDivisions},set:function(a){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.");this.arcLengthDivisions=a}});kb.prototype.setLens=function(a,b){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup.");void 0!==b&&(this.filmGauge=b);this.setFocalLength(a)};Object.defineProperties(qb.prototype,
{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(a){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov.");this.shadow.camera.fov=a}},shadowCameraLeft:{set:function(a){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left.");this.shadow.camera.left=a}},shadowCameraRight:{set:function(a){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right.");this.shadow.camera.right=a}},shadowCameraTop:{set:function(a){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top.");
this.shadow.camera.top=a}},shadowCameraBottom:{set:function(a){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom.");this.shadow.camera.bottom=a}},shadowCameraNear:{set:function(a){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near.");this.shadow.camera.near=a}},shadowCameraFar:{set:function(a){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far.");this.shadow.camera.far=a}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},
shadowBias:{set:function(a){console.warn("THREE.Light: .shadowBias is now .shadow.bias.");this.shadow.bias=a}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(a){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width.");this.shadow.mapSize.width=a}},shadowMapHeight:{set:function(a){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height.");this.shadow.mapSize.height=a}}});Object.defineProperties(Ea.prototype,
{length:{get:function(){console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead.");return this.array.length}},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")}});Object.assign(la.prototype,{addIndex:function(a){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().");this.setIndex(a)},addDrawCall:function(a,b,c){void 0!==c&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset.");
console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup().");this.addGroup(a,b)},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(la.prototype,{drawcalls:{get:function(){console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups.");
return this.groups}},offsets:{get:function(){console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups.");return this.groups}}});Object.assign(Jc.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(Lg.prototype,
{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead.");return this}}});Object.defineProperties(xa.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},
set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){console.warn("THREE.Material: .wrapRGB has been removed.");return new ca}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(a){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.");this.flatShading=1===a}}});Object.defineProperties(rc.prototype,{metal:{get:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead.");
return!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}});Object.defineProperties(yb.prototype,{derivatives:{get:function(){console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives.");return this.extensions.derivatives},set:function(a){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives.");this.extensions.derivatives=a}}});Object.assign(th.prototype,
{clearTarget:function(a,b,c,d){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead.");this.setRenderTarget(a);this.clear(b,c,d)},animate:function(a){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop().");this.setAnimationLoop(a)},getCurrentRenderTarget:function(){console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget().");return this.getRenderTarget()},getMaxAnisotropy:function(){console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy().");
return this.capabilities.getMaxAnisotropy()},getPrecision:function(){console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision.");return this.capabilities.precision},resetGLState:function(){console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset().");return this.state.reset()},supportsFloatTextures:function(){console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' ).");return this.extensions.get("OES_texture_float")},
supportsHalfFloatTextures:function(){console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' ).");return this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' ).");return this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' ).");
return this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' ).");return this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' ).");return this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures.");
return this.capabilities.vertexTextures},supportsInstancedArrays:function(){console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' ).");return this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(a){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest().");this.setScissorTest(a)},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.")},allocTextureUnit:function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},setTexture:function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},setTexture2D:function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},
setTextureCube:function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},getActiveMipMapLevel:function(){console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel().");return this.getActiveMipmapLevel()}});Object.defineProperties(th.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.");this.shadowMap.enabled=a}},shadowMapType:{get:function(){return this.shadowMap.type},
set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.");this.shadowMap.type=a}},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.")}},context:{get:function(){console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead.");return this.getContext()}}});
Object.defineProperties(Vi.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(Nb.prototype,{activeCubeFace:{set:function(){console.warn("THREE.WebGLRenderTargetCube: .activeCubeFace has been removed. It is now the second parameter of WebGLRenderer.setRenderTarget().")}},
activeMipMapLevel:{set:function(){console.warn("THREE.WebGLRenderTargetCube: .activeMipMapLevel has been removed. It is now the third parameter of WebGLRenderer.setRenderTarget().")}}});Object.defineProperties(t.prototype,{wrapS:{get:function(){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.");return this.texture.wrapS},set:function(a){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.");this.texture.wrapS=a}},wrapT:{get:function(){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.");
return this.texture.wrapT},set:function(a){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.");this.texture.wrapT=a}},magFilter:{get:function(){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.");return this.texture.magFilter},set:function(a){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.");this.texture.magFilter=a}},minFilter:{get:function(){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.");return this.texture.minFilter},
set:function(a){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.");this.texture.minFilter=a}},anisotropy:{get:function(){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.");return this.texture.anisotropy},set:function(a){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.");this.texture.anisotropy=a}},offset:{get:function(){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset.");return this.texture.offset},
set:function(a){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset.");this.texture.offset=a}},repeat:{get:function(){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat.");return this.texture.repeat},set:function(a){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat.");this.texture.repeat=a}},format:{get:function(){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format.");return this.texture.format},set:function(a){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format.");
this.texture.format=a}},type:{get:function(){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type.");return this.texture.type},set:function(a){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type.");this.texture.type=a}},generateMipmaps:{get:function(){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.");return this.texture.generateMipmaps},set:function(a){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.");
this.texture.generateMipmaps=a}}});Object.defineProperties(sh.prototype,{standing:{set:function(){console.warn("THREE.WebVRManager: .standing has been removed.")}},userHeight:{set:function(){console.warn("THREE.WebVRManager: .userHeight has been removed.")}}});Ie.prototype.load=function(a){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var b=this;(new Jg).load(a,function(c){b.setBuffer(c)});return this};Uh.prototype.getData=function(){console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData().");
return this.getFrequencyData()};ac.prototype.updateCubeMap=function(a,b){console.warn("THREE.CubeCamera: .updateCubeMap() is now .update().");return this.update(a,b)};rd.crossOrigin=void 0;rd.loadTexture=function(a,b,c,d){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var f=new vg;f.setCrossOrigin(this.crossOrigin);a=f.load(a,c,void 0,d);b&&(a.mapping=b);return a};rd.loadTextureCube=function(a,b,c,d){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");
var f=new ug;f.setCrossOrigin(this.crossOrigin);a=f.load(a,c,void 0,d);b&&(a.mapping=b);return a};rd.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")};rd.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};e.ACESFilmicToneMapping=5;e.AddEquation=100;e.AddOperation=2;e.AdditiveBlending=2;e.AlphaFormat=1021;e.AlwaysDepth=
1;e.AlwaysStencilFunc=519;e.AmbientLight=Cg;e.AmbientLightProbe=Ph;e.AnimationClip=kc;e.AnimationLoader=Gh;e.AnimationMixer=Wh;e.AnimationObjectGroup=rj;e.AnimationUtils=Gb;e.ArcCurve=He;e.ArrayCamera=df;e.ArrowHelper=Zc;e.Audio=Ie;e.AudioAnalyser=Uh;e.AudioContext=Sh;e.AudioListener=Rh;e.AudioLoader=Jg;e.AxesHelper=Tf;e.AxisHelper=function(a){console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper.");return new Tf(a)};e.BackSide=1;e.BasicDepthPacking=3200;e.BasicShadowMap=0;e.BinaryTextureLoader=
function(a){console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader.");return new tg(a)};e.Bone=zh;e.BooleanKeyframeTrack=pg;e.BoundingBoxHelper=function(a,b){console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead.");return new Yc(a,b)};e.Box2=Zh;e.Box3=G;e.Box3Helper=Rf;e.BoxBufferGeometry=vb;e.BoxGeometry=ob;e.BoxHelper=Yc;e.BufferAttribute=Ea;e.BufferGeometry=la;e.BufferGeometryLoader=Hg;e.ByteType=1010;e.Cache=Wd;e.Camera=Fb;e.CameraHelper=
Qf;e.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been removed")};e.CanvasTexture=lf;e.CatmullRomCurve3=Ob;e.CineonToneMapping=4;e.CircleBufferGeometry=Ce;e.CircleGeometry=Hf;e.ClampToEdgeWrapping=1001;e.Clock=Qh;e.ClosedSplineCurve3=yj;e.Color=ca;e.ColorKeyframeTrack=qg;e.CompressedTexture=pe;e.CompressedTextureLoader=Hh;e.ConeBufferGeometry=Gf;e.ConeGeometry=Ff;e.CubeCamera=ac;e.CubeGeometry=ob;e.CubeReflectionMapping=301;e.CubeRefractionMapping=302;e.CubeTexture=Tc;e.CubeTextureLoader=
ug;e.CubeUVReflectionMapping=306;e.CubeUVRefractionMapping=307;e.CubicBezierCurve=sc;e.CubicBezierCurve3=Lc;e.CubicInterpolant=ng;e.CullFaceBack=1;e.CullFaceFront=2;e.CullFaceFrontBack=3;e.CullFaceNone=0;e.Curve=Ga;e.CurvePath=Xc;e.CustomBlending=5;e.CylinderBufferGeometry=Wc;e.CylinderGeometry=Kd;e.Cylindrical=wj;e.DataTexture=Rb;e.DataTexture2DArray=de;e.DataTexture3D=ee;e.DataTextureLoader=tg;e.DecrementStencilOp=7683;e.DecrementWrapStencilOp=34056;e.DefaultLoadingManager=nj;e.DepthFormat=1026;
e.DepthStencilFormat=1027;e.DepthTexture=mf;e.DirectionalLight=Bg;e.DirectionalLightHelper=Qe;e.DirectionalLightShadow=Ag;e.DiscreteInterpolant=og;e.DodecahedronBufferGeometry=ue;e.DodecahedronGeometry=sf;e.DoubleSide=2;e.DstAlphaFactor=206;e.DstColorFactor=208;e.DynamicBufferAttribute=function(a,b){console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead.");return(new Ea(a,b)).setDynamic(!0)};e.EdgesGeometry=Be;e.EdgesHelper=function(a,
b){console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead.");return new pb(new Be(a.geometry),new lb({color:void 0!==b?b:16777215}))};e.EllipseCurve=ec;e.EqualDepth=4;e.EqualStencilFunc=514;e.EquirectangularReflectionMapping=303;e.EquirectangularRefractionMapping=304;e.Euler=F;e.EventDispatcher=r;e.ExtrudeBufferGeometry=Jc;e.ExtrudeGeometry=Hd;e.Face3=mb;e.Face4=function(a,b,c,d,f,g,h){console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead.");
return new mb(a,b,c,f,g,h)};e.FaceColors=1;e.FaceNormalsHelper=Pf;e.FileLoader=lc;e.FlatShading=1;e.Float32Attribute=function(a,b){console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead.");return new ia(a,b)};e.Float32BufferAttribute=ia;e.Float64Attribute=function(a,b){console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead.");return new ub(a,b)};e.Float64BufferAttribute=ub;e.FloatType=1015;e.Fog=jg;e.FogExp2=
ig;e.Font=Mh;e.FontLoader=Nh;e.FrontFaceDirectionCCW=1;e.FrontFaceDirectionCW=0;e.FrontSide=0;e.Frustum=ic;e.GammaEncoding=3007;e.Geometry=Ia;e.GeometryUtils={merge:function(a,b,c){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");if(b.isMesh){b.matrixAutoUpdate&&b.updateMatrix();var d=b.matrix;b=b.geometry}a.merge(b,d,c)},center:function(a){console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead.");
return a.center()}};e.GreaterDepth=6;e.GreaterEqualDepth=5;e.GreaterEqualStencilFunc=518;e.GreaterStencilFunc=516;e.GridHelper=Mg;e.Group=ge;e.HalfFloatType=1016;e.HemisphereLight=wg;e.HemisphereLightHelper=Ne;e.HemisphereLightProbe=Oh;e.IcosahedronBufferGeometry=te;e.IcosahedronGeometry=rf;e.ImageBitmapLoader=Kh;e.ImageLoader=Ge;e.ImageUtils=rd;e.ImmediateRenderObject=Nf;e.IncrementStencilOp=7682;e.IncrementWrapStencilOp=34055;e.InstancedBufferAttribute=Gg;e.InstancedBufferGeometry=Fg;e.InstancedInterleavedBuffer=
Xh;e.Int16Attribute=function(a,b){console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead.");return new gc(a,b)};e.Int16BufferAttribute=gc;e.Int32Attribute=function(a,b){console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead.");return new Bc(a,b)};e.Int32BufferAttribute=Bc;e.Int8Attribute=function(a,b){console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead.");return new Eb(a,
b)};e.Int8BufferAttribute=Eb;e.IntType=1013;e.InterleavedBuffer=Dd;e.InterleavedBufferAttribute=ff;e.Interpolant=dc;e.InterpolateDiscrete=2300;e.InterpolateLinear=2301;e.InterpolateSmooth=2302;e.InvertStencilOp=5386;e.JSONLoader=function(){console.error("THREE.JSONLoader has been removed.")};e.KeepStencilOp=7680;e.KeyframeTrack=Kb;e.LOD=jf;e.LatheBufferGeometry=Ae;e.LatheGeometry=Ef;e.Layers=N;e.LensFlare=function(){console.error("THREE.LensFlare has been moved to /examples/js/objects/Lensflare.js")};
e.LessDepth=2;e.LessEqualDepth=3;e.LessEqualStencilFunc=515;e.LessStencilFunc=513;e.Light=qb;e.LightProbe=xc;e.LightProbeHelper=Oe;e.LightShadow=Nc;e.Line=Ib;e.Line3=$h;e.LineBasicMaterial=lb;e.LineCurve=Yb;e.LineCurve3=tc;e.LineDashedMaterial=Rd;e.LineLoop=mg;e.LinePieces=1;e.LineSegments=pb;e.LineStrip=0;e.LinearEncoding=3E3;e.LinearFilter=1006;e.LinearInterpolant=If;e.LinearMipMapLinearFilter=1008;e.LinearMipMapNearestFilter=1007;e.LinearMipmapLinearFilter=1008;e.LinearMipmapNearestFilter=1007;
e.LinearToneMapping=1;e.Loader=ib;e.LoaderUtils=ui;e.LoadingManager=Fh;e.LogLuvEncoding=3003;e.LoopOnce=2200;e.LoopPingPong=2202;e.LoopRepeat=2201;e.LuminanceAlphaFormat=1025;e.LuminanceFormat=1024;e.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2};e.Material=xa;e.MaterialLoader=Eg;e.Math=Qa;e.Matrix3=v;e.Matrix4=A;e.MaxEquation=104;e.Mesh=Oa;e.MeshBasicMaterial=gb;e.MeshDepthMaterial=jd;e.MeshDistanceMaterial=kd;e.MeshFaceMaterial=function(a){console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead.");
return a};e.MeshLambertMaterial=Pd;e.MeshMatcapMaterial=Qd;e.MeshNormalMaterial=Od;e.MeshPhongMaterial=rc;e.MeshPhysicalMaterial=Md;e.MeshStandardMaterial=Kc;e.MeshToonMaterial=Nd;e.MinEquation=103;e.MirroredRepeatWrapping=1002;e.MixOperation=1;e.MultiMaterial=function(a){void 0===a&&(a=[]);console.warn("THREE.MultiMaterial has been removed. Use an Array instead.");a.isMultiMaterial=!0;a.materials=a;a.clone=function(){return a.slice()};return a};e.MultiplyBlending=4;e.MultiplyOperation=0;e.NearestFilter=
1003;e.NearestMipMapLinearFilter=1005;e.NearestMipMapNearestFilter=1004;e.NearestMipmapLinearFilter=1005;e.NearestMipmapNearestFilter=1004;e.NeverDepth=0;e.NeverStencilFunc=512;e.NoBlending=0;e.NoColors=0;e.NoToneMapping=0;e.NormalBlending=1;e.NotEqualDepth=7;e.NotEqualStencilFunc=517;e.NumberKeyframeTrack=Ee;e.Object3D=I;e.ObjectLoader=Ig;e.ObjectSpaceNormalMap=1;e.OctahedronBufferGeometry=Ed;e.OctahedronGeometry=qf;e.OneFactor=201;e.OneMinusDstAlphaFactor=207;e.OneMinusDstColorFactor=209;e.OneMinusSrcAlphaFactor=
205;e.OneMinusSrcColorFactor=203;e.OrthographicCamera=Mf;e.PCFShadowMap=1;e.PCFSoftShadowMap=2;e.ParametricBufferGeometry=re;e.ParametricGeometry=nf;e.Particle=function(a){console.warn("THREE.Particle has been renamed to THREE.Sprite.");return new gf(a)};e.ParticleBasicMaterial=function(a){console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial.");return new qc(a)};e.ParticleSystem=function(a,b){console.warn("THREE.ParticleSystem has been renamed to THREE.Points.");return new oe(a,
b)};e.ParticleSystemMaterial=function(a){console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial.");return new qc(a)};e.Path=wc;e.PerspectiveCamera=kb;e.Plane=Hb;e.PlaneBufferGeometry=Dc;e.PlaneGeometry=fd;e.PlaneHelper=Sf;e.PointCloud=function(a,b){console.warn("THREE.PointCloud has been renamed to THREE.Points.");return new oe(a,b)};e.PointCloudMaterial=function(a){console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial.");return new qc(a)};e.PointLight=
zg;e.PointLightHelper=Le;e.Points=oe;e.PointsMaterial=qc;e.PolarGridHelper=Ng;e.PolyhedronBufferGeometry=Xb;e.PolyhedronGeometry=of;e.PositionalAudio=Th;e.PositionalAudioHelper=Pe;e.PropertyBinding=Pb;e.PropertyMixer=Vh;e.QuadraticBezierCurve=uc;e.QuadraticBezierCurve3=Mc;e.Quaternion=n;e.QuaternionKeyframeTrack=Jf;e.QuaternionLinearInterpolant=rg;e.REVISION="108";e.RGBADepthPacking=3201;e.RGBAFormat=1023;e.RGBA_ASTC_10x10_Format=37819;e.RGBA_ASTC_10x5_Format=37816;e.RGBA_ASTC_10x6_Format=37817;e.RGBA_ASTC_10x8_Format=
37818;e.RGBA_ASTC_12x10_Format=37820;e.RGBA_ASTC_12x12_Format=37821;e.RGBA_ASTC_4x4_Format=37808;e.RGBA_ASTC_5x4_Format=37809;e.RGBA_ASTC_5x5_Format=37810;e.RGBA_ASTC_6x5_Format=37811;e.RGBA_ASTC_6x6_Format=37812;e.RGBA_ASTC_8x5_Format=37813;e.RGBA_ASTC_8x6_Format=37814;e.RGBA_ASTC_8x8_Format=37815;e.RGBA_PVRTC_2BPPV1_Format=35843;e.RGBA_PVRTC_4BPPV1_Format=35842;e.RGBA_S3TC_DXT1_Format=33777;e.RGBA_S3TC_DXT3_Format=33778;e.RGBA_S3TC_DXT5_Format=33779;e.RGBDEncoding=3006;e.RGBEEncoding=3002;e.RGBEFormat=
1023;e.RGBFormat=1022;e.RGBM16Encoding=3005;e.RGBM7Encoding=3004;e.RGB_ETC1_Format=36196;e.RGB_PVRTC_2BPPV1_Format=35841;e.RGB_PVRTC_4BPPV1_Format=35840;e.RGB_S3TC_DXT1_Format=33776;e.RawShaderMaterial=De;e.Ray=ba;e.Raycaster=tj;e.RectAreaLight=Dg;e.RectAreaLightHelper=Me;e.RedFormat=1028;e.ReinhardToneMapping=2;e.RepeatWrapping=1E3;e.ReplaceStencilOp=7681;e.ReverseSubtractEquation=102;e.RingBufferGeometry=ze;e.RingGeometry=Df;e.Scene=aa;e.SceneUtils={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")}};e.ShaderChunk=ab;e.ShaderLib=Ec;e.ShaderMaterial=yb;e.ShadowMaterial=Ld;e.Shape=qd;e.ShapeBufferGeometry=Jd;e.ShapeGeometry=Id;e.ShapePath=Lh;e.ShapeUtils=Vc;e.ShortType=1011;e.Skeleton=lg;e.SkeletonHelper=Ke;e.SkinnedMesh=kf;e.SmoothShading=2;e.Sphere=U;e.SphereBufferGeometry=pd;e.SphereGeometry=
Cf;e.Spherical=vj;e.SphericalHarmonics3=Kg;e.SphericalReflectionMapping=305;e.Spline=bi;e.SplineCurve=vc;e.SplineCurve3=zj;e.SpotLight=yg;e.SpotLightHelper=Je;e.SpotLightShadow=xg;e.Sprite=gf;e.SpriteMaterial=od;e.SrcAlphaFactor=204;e.SrcAlphaSaturateFactor=210;e.SrcColorFactor=202;e.StereoCamera=pj;e.StringKeyframeTrack=sg;e.SubtractEquation=101;e.SubtractiveBlending=3;e.TOUCH={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3};e.TangentSpaceNormalMap=0;e.TetrahedronBufferGeometry=se;e.TetrahedronGeometry=
pf;e.TextBufferGeometry=ye;e.TextGeometry=Bf;e.Texture=z;e.TextureLoader=vg;e.TorusBufferGeometry=we;e.TorusGeometry=wf;e.TorusKnotBufferGeometry=ve;e.TorusKnotGeometry=vf;e.Triangle=ja;e.TriangleFanDrawMode=2;e.TriangleStripDrawMode=1;e.TrianglesDrawMode=0;e.TubeBufferGeometry=Fd;e.TubeGeometry=uf;e.UVMapping=300;e.Uint16Attribute=function(a,b){console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead.");return new $b(a,b)};e.Uint16BufferAttribute=$b;e.Uint32Attribute=
function(a,b){console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead.");return new Cb(a,b)};e.Uint32BufferAttribute=Cb;e.Uint8Attribute=function(a,b){console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead.");return new nb(a,b)};e.Uint8BufferAttribute=nb;e.Uint8ClampedAttribute=function(a,b){console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead.");return new Mb(a,
b)};e.Uint8ClampedBufferAttribute=Mb;e.Uncharted2ToneMapping=3;e.Uniform=Lg;e.UniformsLib=Ca;e.UniformsUtils=$l;e.UnsignedByteType=1009;e.UnsignedInt248Type=1020;e.UnsignedIntType=1014;e.UnsignedShort4444Type=1017;e.UnsignedShort5551Type=1018;e.UnsignedShort565Type=1019;e.UnsignedShortType=1012;e.VSMShadowMap=3;e.Vector2=k;e.Vector3=p;e.Vector4=E;e.VectorKeyframeTrack=Fe;e.Vertex=function(a,b,c){console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead.");return new p(a,b,c)};e.VertexColors=
2;e.VertexNormalsHelper=Of;e.VideoTexture=Ch;e.WebGLMultisampleRenderTarget=x;e.WebGLRenderTarget=t;e.WebGLRenderTargetCube=Nb;e.WebGLRenderer=th;e.WebGLUtils=Wi;e.WireframeGeometry=qe;e.WireframeHelper=function(a,b){console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead.");return new pb(new qe(a.geometry),new lb({color:void 0!==b?b:16777215}))};e.WrapAroundEnding=2402;e.XHRLoader=function(a){console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader.");
return new lc(a)};e.ZeroCurvatureEnding=2400;e.ZeroFactor=200;e.ZeroSlopeEnding=2401;e.ZeroStencilOp=0;e.sRGBEncoding=3001;Object.defineProperty(e,"__esModule",{value:!0})});

//# sourceURL=build://tf-imports/OrbitControls.js
THREE.OrbitControls=function(e,r){function k(){return 2*Math.PI/60/60*S.autoRotateSpeed}function n(){return Math.pow(.95,S.zoomSpeed)}function p(X){vb.theta-=X}function v(X){vb.phi-=X}function z(X){S.object.isPerspectiveCamera?hc/=X:S.object.isOrthographicCamera?(S.object.zoom=Math.max(S.minZoom,Math.min(S.maxZoom,S.object.zoom*X)),S.object.updateProjectionMatrix(),yb=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),S.enableZoom=!1)}function E(X){S.object.isPerspectiveCamera?
hc*=X:S.object.isOrthographicCamera?(S.object.zoom=Math.max(S.minZoom,Math.min(S.maxZoom,S.object.zoom/X)),S.object.updateProjectionMatrix(),yb=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),S.enableZoom=!1)}function t(X){Fb.set(X.clientX,X.clientY)}function x(X){ic.set(X.clientX,X.clientY)}function A(X){Nb.set(X.clientX,X.clientY)}function F(X){kb.set(X.clientX,X.clientY);ac.subVectors(kb,Fb).multiplyScalar(S.rotateSpeed);X=S.domElement===
document?S.domElement.body:S.domElement;p(2*Math.PI*ac.x/X.clientHeight);v(2*Math.PI*ac.y/X.clientHeight);Fb.copy(kb);S.update()}function N(X){Cc.set(X.clientX,X.clientY);Bd.subVectors(Cc,ic);0<Bd.y?z(n()):0>Bd.y&&E(n());ic.copy(Cc);S.update()}function I(X){Rb.set(X.clientX,X.clientY);Hb.subVectors(Rb,Nb).multiplyScalar(S.panSpeed);gd(Hb.x,Hb.y);Nb.copy(Rb);S.update()}function aa(){}function G(X){0>X.deltaY?E(n()):0<X.deltaY&&z(n());S.update()}function P(X){var tb=!1;switch(X.keyCode){case S.keys.UP:gd(0,
S.keyPanSpeed);tb=!0;break;case S.keys.BOTTOM:gd(0,-S.keyPanSpeed);tb=!0;break;case S.keys.LEFT:gd(S.keyPanSpeed,0);tb=!0;break;case S.keys.RIGHT:gd(-S.keyPanSpeed,0),tb=!0}tb&&(X.preventDefault(),S.update())}function U(X){1==X.touches.length?Fb.set(X.touches[0].pageX,X.touches[0].pageY):Fb.set(.5*(X.touches[0].pageX+X.touches[1].pageX),.5*(X.touches[0].pageY+X.touches[1].pageY))}function ba(X){1==X.touches.length?Nb.set(X.touches[0].pageX,X.touches[0].pageY):Nb.set(.5*(X.touches[0].pageX+X.touches[1].pageX),
.5*(X.touches[0].pageY+X.touches[1].pageY))}function ja(X){var tb=X.touches[0].pageX-X.touches[1].pageX;X=X.touches[0].pageY-X.touches[1].pageY;ic.set(0,Math.sqrt(tb*tb+X*X))}function ca(X){S.enableZoom&&ja(X);S.enablePan&&ba(X)}function ya(X){S.enableZoom&&ja(X);S.enableRotate&&U(X)}function Na(X){1==X.touches.length?kb.set(X.touches[0].pageX,X.touches[0].pageY):kb.set(.5*(X.touches[0].pageX+X.touches[1].pageX),.5*(X.touches[0].pageY+X.touches[1].pageY));ac.subVectors(kb,Fb).multiplyScalar(S.rotateSpeed);
X=S.domElement===document?S.domElement.body:S.domElement;p(2*Math.PI*ac.x/X.clientHeight);v(2*Math.PI*ac.y/X.clientHeight);Fb.copy(kb)}function $a(X){1==X.touches.length?Rb.set(X.touches[0].pageX,X.touches[0].pageY):Rb.set(.5*(X.touches[0].pageX+X.touches[1].pageX),.5*(X.touches[0].pageY+X.touches[1].pageY));Hb.subVectors(Rb,Nb).multiplyScalar(S.panSpeed);gd(Hb.x,Hb.y);Nb.copy(Rb)}function mb(X){var tb=X.touches[0].pageX-X.touches[1].pageX;X=X.touches[0].pageY-X.touches[1].pageY;Cc.set(0,Math.sqrt(tb*
tb+X*X));Bd.set(0,Math.pow(Cc.y/ic.y,S.zoomSpeed));z(Bd.y);ic.copy(Cc)}function xa(X){S.enableZoom&&mb(X);S.enablePan&&$a(X)}function gb(X){S.enableZoom&&mb(X);S.enableRotate&&Na(X)}function Ea(){}function Eb(X){if(!1!==S.enabled){X.preventDefault();S.domElement.focus?S.domElement.focus():window.focus();switch(X.button){case 0:switch(S.mouseButtons.LEFT){case THREE.MOUSE.ROTATE:if(X.ctrlKey||X.metaKey||X.shiftKey){if(!1===S.enablePan)return;A(X);fb=Ra.PAN}else{if(!1===S.enableRotate)return;t(X);fb=
Ra.ROTATE}break;case THREE.MOUSE.PAN:if(X.ctrlKey||X.metaKey||X.shiftKey){if(!1===S.enableRotate)return;t(X);fb=Ra.ROTATE}else{if(!1===S.enablePan)return;A(X);fb=Ra.PAN}break;default:fb=Ra.NONE}break;case 1:switch(S.mouseButtons.MIDDLE){case THREE.MOUSE.DOLLY:if(!1===S.enableZoom)return;x(X);fb=Ra.DOLLY;break;default:fb=Ra.NONE}break;case 2:switch(S.mouseButtons.RIGHT){case THREE.MOUSE.ROTATE:if(!1===S.enableRotate)return;t(X);fb=Ra.ROTATE;break;case THREE.MOUSE.PAN:if(!1===S.enablePan)return;A(X);
fb=Ra.PAN;break;default:fb=Ra.NONE}}fb!==Ra.NONE&&(document.addEventListener("mousemove",nb,!1),document.addEventListener("mouseup",Mb,!1),S.dispatchEvent(la))}}function nb(X){if(!1!==S.enabled)switch(X.preventDefault(),fb){case Ra.ROTATE:if(!1===S.enableRotate)break;F(X);break;case Ra.DOLLY:if(!1===S.enableZoom)break;N(X);break;case Ra.PAN:!1!==S.enablePan&&I(X)}}function Mb(X){!1!==S.enabled&&(aa(X),document.removeEventListener("mousemove",nb,!1),document.removeEventListener("mouseup",Mb,!1),S.dispatchEvent(Oa),
fb=Ra.NONE)}function gc(X){!1===S.enabled||!1===S.enableZoom||fb!==Ra.NONE&&fb!==Ra.ROTATE||(X.preventDefault(),X.stopPropagation(),S.dispatchEvent(la),G(X),S.dispatchEvent(Oa))}function $b(X){!1!==S.enabled&&!1!==S.enableKeys&&!1!==S.enablePan&&P(X)}function Bc(X){if(!1!==S.enabled){X.preventDefault();switch(X.touches.length){case 1:switch(S.touches.ONE){case THREE.TOUCH.ROTATE:if(!1===S.enableRotate)return;U(X);fb=Ra.TOUCH_ROTATE;break;case THREE.TOUCH.PAN:if(!1===S.enablePan)return;ba(X);fb=Ra.TOUCH_PAN;
break;default:fb=Ra.NONE}break;case 2:switch(S.touches.TWO){case THREE.TOUCH.DOLLY_PAN:if(!1===S.enableZoom&&!1===S.enablePan)return;ca(X);fb=Ra.TOUCH_DOLLY_PAN;break;case THREE.TOUCH.DOLLY_ROTATE:if(!1===S.enableZoom&&!1===S.enableRotate)return;ya(X);fb=Ra.TOUCH_DOLLY_ROTATE;break;default:fb=Ra.NONE}break;default:fb=Ra.NONE}fb!==Ra.NONE&&S.dispatchEvent(la)}}function Cb(X){if(!1!==S.enabled)switch(X.preventDefault(),X.stopPropagation(),fb){case Ra.TOUCH_ROTATE:if(!1===S.enableRotate)break;Na(X);
S.update();break;case Ra.TOUCH_PAN:if(!1===S.enablePan)break;$a(X);S.update();break;case Ra.TOUCH_DOLLY_PAN:if(!1===S.enableZoom&&!1===S.enablePan)break;xa(X);S.update();break;case Ra.TOUCH_DOLLY_ROTATE:if(!1===S.enableZoom&&!1===S.enableRotate)break;gb(X);S.update();break;default:fb=Ra.NONE}}function ia(X){!1!==S.enabled&&(Ea(X),S.dispatchEvent(Oa),fb=Ra.NONE)}function ub(X){!1!==S.enabled&&X.preventDefault()}this.object=e;this.domElement=void 0!==r?r:document;this.enabled=!0;this.target=new THREE.Vector3;
this.minDistance=0;this.maxDistance=Infinity;this.minZoom=0;this.maxZoom=Infinity;this.minPolarAngle=0;this.maxPolarAngle=Math.PI;this.minAzimuthAngle=-Infinity;this.maxAzimuthAngle=Infinity;this.enableDamping=!1;this.dampingFactor=.05;this.enableZoom=!0;this.zoomSpeed=1;this.enableRotate=!0;this.rotateSpeed=1;this.enablePan=!0;this.panSpeed=1;this.screenSpacePanning=!1;this.keyPanSpeed=7;this.autoRotate=!1;this.autoRotateSpeed=2;this.enableKeys=!0;this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40};this.mouseButtons=
{LEFT:THREE.MOUSE.ROTATE,MIDDLE:THREE.MOUSE.DOLLY,RIGHT:THREE.MOUSE.PAN};this.touches={ONE:THREE.TOUCH.ROTATE,TWO:THREE.TOUCH.DOLLY_PAN};this.target0=this.target.clone();this.position0=this.object.position.clone();this.zoom0=this.object.zoom;this.getPolarAngle=function(){return ob.phi};this.getAzimuthalAngle=function(){return ob.theta};this.saveState=function(){S.target0.copy(S.target);S.position0.copy(S.object.position);S.zoom0=S.object.zoom};this.reset=function(){S.target.copy(S.target0);S.object.position.copy(S.position0);
S.object.zoom=S.zoom0;S.object.updateProjectionMatrix();S.dispatchEvent(Qb);S.update();fb=Ra.NONE};this.update=function(){var X=new THREE.Vector3,tb=(new THREE.Quaternion).setFromUnitVectors(e.up,new THREE.Vector3(0,1,0)),mc=tb.clone().inverse(),Sc=new THREE.Vector3,hd=new THREE.Quaternion;return function(){var cg=S.object.position;X.copy(cg).sub(S.target);X.applyQuaternion(tb);ob.setFromVector3(X);S.autoRotate&&fb===Ra.NONE&&p(k());S.enableDamping?(ob.theta+=vb.theta*S.dampingFactor,ob.phi+=vb.phi*
S.dampingFactor):(ob.theta+=vb.theta,ob.phi+=vb.phi);ob.theta=Math.max(S.minAzimuthAngle,Math.min(S.maxAzimuthAngle,ob.theta));ob.phi=Math.max(S.minPolarAngle,Math.min(S.maxPolarAngle,ob.phi));ob.makeSafe();ob.radius*=hc;ob.radius=Math.max(S.minDistance,Math.min(S.maxDistance,ob.radius));!0===S.enableDamping?S.target.addScaledVector(xb,S.dampingFactor):S.target.add(xb);X.setFromSpherical(ob);X.applyQuaternion(mc);cg.copy(S.target).add(X);S.object.lookAt(S.target);!0===S.enableDamping?(vb.theta*=1-
S.dampingFactor,vb.phi*=1-S.dampingFactor,xb.multiplyScalar(1-S.dampingFactor)):(vb.set(0,0,0),xb.set(0,0,0));hc=1;return yb||Sc.distanceToSquared(S.object.position)>Ia||8*(1-hd.dot(S.object.quaternion))>Ia?(S.dispatchEvent(Qb),Sc.copy(S.object.position),hd.copy(S.object.quaternion),yb=!1,!0):!1}}();this.dispose=function(){S.domElement.removeEventListener("contextmenu",ub,!1);S.domElement.removeEventListener("mousedown",Eb,!1);S.domElement.removeEventListener("wheel",gc,!1);S.domElement.removeEventListener("touchstart",
Bc,!1);S.domElement.removeEventListener("touchend",ia,!1);S.domElement.removeEventListener("touchmove",Cb,!1);document.removeEventListener("mousemove",nb,!1);document.removeEventListener("mouseup",Mb,!1);window.removeEventListener("keydown",$b,!1)};var S=this,Qb={type:"change"},la={type:"start"},Oa={type:"end"},Ra={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},fb=Ra.NONE,Ia=1E-6,ob=new THREE.Spherical,vb=new THREE.Spherical,hc=1,xb=new THREE.Vector3,
yb=!1,Fb=new THREE.Vector2,kb=new THREE.Vector2,ac=new THREE.Vector2,Nb=new THREE.Vector2,Rb=new THREE.Vector2,Hb=new THREE.Vector2,ic=new THREE.Vector2,Cc=new THREE.Vector2,Bd=new THREE.Vector2,fd=function(){var X=new THREE.Vector3;return function(tb,mc){X.setFromMatrixColumn(mc,0);X.multiplyScalar(-tb);xb.add(X)}}(),Dc=function(){var X=new THREE.Vector3;return function(tb,mc){!0===S.screenSpacePanning?X.setFromMatrixColumn(mc,1):(X.setFromMatrixColumn(mc,0),X.crossVectors(S.object.up,X));X.multiplyScalar(tb);
xb.add(X)}}(),gd=function(){var X=new THREE.Vector3;return function(tb,mc){var Sc=S.domElement===document?S.domElement.body:S.domElement;if(S.object.isPerspectiveCamera){X.copy(S.object.position).sub(S.target);var hd=X.length();hd*=Math.tan(S.object.fov/2*Math.PI/180);fd(2*tb*hd/Sc.clientHeight,S.object.matrix);Dc(2*mc*hd/Sc.clientHeight,S.object.matrix)}else S.object.isOrthographicCamera?(fd(tb*(S.object.right-S.object.left)/S.object.zoom/Sc.clientWidth,S.object.matrix),Dc(mc*(S.object.top-S.object.bottom)/
S.object.zoom/Sc.clientHeight,S.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),S.enablePan=!1)}}();S.domElement.addEventListener("contextmenu",ub,!1);S.domElement.addEventListener("mousedown",Eb,!1);S.domElement.addEventListener("wheel",gc,!1);S.domElement.addEventListener("touchstart",Bc,!1);S.domElement.addEventListener("touchend",ia,!1);S.domElement.addEventListener("touchmove",Cb,!1);window.addEventListener("keydown",$b,!1);this.update()};
THREE.OrbitControls.prototype=Object.create(THREE.EventDispatcher.prototype);THREE.OrbitControls.prototype.constructor=THREE.OrbitControls;THREE.MapControls=function(e,r){THREE.OrbitControls.call(this,e,r);this.mouseButtons.LEFT=THREE.MOUSE.PAN;this.mouseButtons.RIGHT=THREE.MOUSE.ROTATE;this.touches.ONE=THREE.TOUCH.PAN;this.touches.TWO=THREE.TOUCH.DOLLY_ROTATE};THREE.MapControls.prototype=Object.create(THREE.EventDispatcher.prototype);THREE.MapControls.prototype.constructor=THREE.MapControls;

// https://d3js.org v5.7.0 Copyright 2018 Mike Bostock
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.d3=t.d3||{})}(this,function(t){"use strict";function n(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function e(t){var e;return 1===t.length&&(e=t,t=function(t,r){return n(e(t),r)}),{left:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r<i;){var o=r+i>>>1;t(n[o],e)<0?r=o+1:i=o}return r},right:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r<i;){var o=r+i>>>1;t(n[o],e)>0?i=o:r=o+1}return r}}}var r=e(n),i=r.right,o=r.left;function a(t,n){return[t,n]}function u(t){return null===t?NaN:+t}function f(t,n){var e,r,i=t.length,o=0,a=-1,f=0,c=0;if(null==n)for(;++a<i;)isNaN(e=u(t[a]))||(c+=(r=e-f)*(e-(f+=r/++o)));else for(;++a<i;)isNaN(e=u(n(t[a],a,t)))||(c+=(r=e-f)*(e-(f+=r/++o)));if(o>1)return c/(o-1)}function c(t,n){var e=f(t,n);return e?Math.sqrt(e):e}function s(t,n){var e,r,i,o=t.length,a=-1;if(null==n){for(;++a<o;)if(null!=(e=t[a])&&e>=e)for(r=i=e;++a<o;)null!=(e=t[a])&&(r>e&&(r=e),i<e&&(i=e))}else for(;++a<o;)if(null!=(e=n(t[a],a,t))&&e>=e)for(r=i=e;++a<o;)null!=(e=n(t[a],a,t))&&(r>e&&(r=e),i<e&&(i=e));return[r,i]}var l=Array.prototype,h=l.slice,d=l.map;function p(t){return function(){return t}}function v(t){return t}function g(t,n,e){t=+t,n=+n,e=(i=arguments.length)<2?(n=t,t=0,1):i<3?1:+e;for(var r=-1,i=0|Math.max(0,Math.ceil((n-t)/e)),o=new Array(i);++r<i;)o[r]=t+r*e;return o}var y=Math.sqrt(50),_=Math.sqrt(10),b=Math.sqrt(2);function m(t,n,e){var r,i,o,a,u=-1;if(e=+e,(t=+t)===(n=+n)&&e>0)return[t];if((r=n<t)&&(i=t,t=n,n=i),0===(a=x(t,n,e))||!isFinite(a))return[];if(a>0)for(t=Math.ceil(t/a),n=Math.floor(n/a),o=new Array(i=Math.ceil(n-t+1));++u<i;)o[u]=(t+u)*a;else for(t=Math.floor(t*a),n=Math.ceil(n*a),o=new Array(i=Math.ceil(t-n+1));++u<i;)o[u]=(t-u)/a;return r&&o.reverse(),o}function x(t,n,e){var r=(n-t)/Math.max(0,e),i=Math.floor(Math.log(r)/Math.LN10),o=r/Math.pow(10,i);return i>=0?(o>=y?10:o>=_?5:o>=b?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=y?10:o>=_?5:o>=b?2:1)}function w(t,n,e){var r=Math.abs(n-t)/Math.max(0,e),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=y?i*=10:o>=_?i*=5:o>=b&&(i*=2),n<t?-i:i}function M(t){return Math.ceil(Math.log(t.length)/Math.LN2)+1}function A(t,n,e){if(null==e&&(e=u),r=t.length){if((n=+n)<=0||r<2)return+e(t[0],0,t);if(n>=1)return+e(t[r-1],r-1,t);var r,i=(r-1)*n,o=Math.floor(i),a=+e(t[o],o,t);return a+(+e(t[o+1],o+1,t)-a)*(i-o)}}function T(t,n){var e,r,i=t.length,o=-1;if(null==n){for(;++o<i;)if(null!=(e=t[o])&&e>=e)for(r=e;++o<i;)null!=(e=t[o])&&e>r&&(r=e)}else for(;++o<i;)if(null!=(e=n(t[o],o,t))&&e>=e)for(r=e;++o<i;)null!=(e=n(t[o],o,t))&&e>r&&(r=e);return r}function N(t){for(var n,e,r,i=t.length,o=-1,a=0;++o<i;)a+=t[o].length;for(e=new Array(a);--i>=0;)for(n=(r=t[i]).length;--n>=0;)e[--a]=r[n];return e}function S(t,n){var e,r,i=t.length,o=-1;if(null==n){for(;++o<i;)if(null!=(e=t[o])&&e>=e)for(r=e;++o<i;)null!=(e=t[o])&&r>e&&(r=e)}else for(;++o<i;)if(null!=(e=n(t[o],o,t))&&e>=e)for(r=e;++o<i;)null!=(e=n(t[o],o,t))&&r>e&&(r=e);return r}function E(t){if(!(i=t.length))return[];for(var n=-1,e=S(t,k),r=new Array(e);++n<e;)for(var i,o=-1,a=r[n]=new Array(i);++o<i;)a[o]=t[o][n];return r}function k(t){return t.length}var C=Array.prototype.slice;function P(t){return t}var z=1,R=2,L=3,D=4,U=1e-6;function q(t){return"translate("+(t+.5)+",0)"}function O(t){return"translate(0,"+(t+.5)+")"}function Y(){return!this.__axis}function B(t,n){var e=[],r=null,i=null,o=6,a=6,u=3,f=t===z||t===D?-1:1,c=t===D||t===R?"x":"y",s=t===z||t===L?q:O;function l(l){var h=null==r?n.ticks?n.ticks.apply(n,e):n.domain():r,d=null==i?n.tickFormat?n.tickFormat.apply(n,e):P:i,p=Math.max(o,0)+u,v=n.range(),g=+v[0]+.5,y=+v[v.length-1]+.5,_=(n.bandwidth?function(t){var n=Math.max(0,t.bandwidth()-1)/2;return t.round()&&(n=Math.round(n)),function(e){return+t(e)+n}}:function(t){return function(n){return+t(n)}})(n.copy()),b=l.selection?l.selection():l,m=b.selectAll(".domain").data([null]),x=b.selectAll(".tick").data(h,n).order(),w=x.exit(),M=x.enter().append("g").attr("class","tick"),A=x.select("line"),T=x.select("text");m=m.merge(m.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),x=x.merge(M),A=A.merge(M.append("line").attr("stroke","currentColor").attr(c+"2",f*o)),T=T.merge(M.append("text").attr("fill","currentColor").attr(c,f*p).attr("dy",t===z?"0em":t===L?"0.71em":"0.32em")),l!==b&&(m=m.transition(l),x=x.transition(l),A=A.transition(l),T=T.transition(l),w=w.transition(l).attr("opacity",U).attr("transform",function(t){return isFinite(t=_(t))?s(t):this.getAttribute("transform")}),M.attr("opacity",U).attr("transform",function(t){var n=this.parentNode.__axis;return s(n&&isFinite(n=n(t))?n:_(t))})),w.remove(),m.attr("d",t===D||t==R?a?"M"+f*a+","+g+"H0.5V"+y+"H"+f*a:"M0.5,"+g+"V"+y:a?"M"+g+","+f*a+"V0.5H"+y+"V"+f*a:"M"+g+",0.5H"+y),x.attr("opacity",1).attr("transform",function(t){return s(_(t))}),A.attr(c+"2",f*o),T.attr(c,f*p).text(d),b.filter(Y).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===R?"start":t===D?"end":"middle"),b.each(function(){this.__axis=_})}return l.scale=function(t){return arguments.length?(n=t,l):n},l.ticks=function(){return e=C.call(arguments),l},l.tickArguments=function(t){return arguments.length?(e=null==t?[]:C.call(t),l):e.slice()},l.tickValues=function(t){return arguments.length?(r=null==t?null:C.call(t),l):r&&r.slice()},l.tickFormat=function(t){return arguments.length?(i=t,l):i},l.tickSize=function(t){return arguments.length?(o=a=+t,l):o},l.tickSizeInner=function(t){return arguments.length?(o=+t,l):o},l.tickSizeOuter=function(t){return arguments.length?(a=+t,l):a},l.tickPadding=function(t){return arguments.length?(u=+t,l):u},l}var F={value:function(){}};function I(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r)throw new Error("illegal type: "+t);r[t]=[]}return new H(r)}function H(t){this._=t}function j(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function X(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=F,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}H.prototype=I.prototype={constructor:H,on:function(t,n){var e,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map(function(t){var n="",e=t.indexOf(".");if(e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})),a=-1,u=o.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++a<u;)if(e=(t=o[a]).type)i[e]=X(i[e],t.name,n);else if(null==n)for(e in i)i[e]=X(i[e],t.name,null);return this}for(;++a<u;)if((e=(t=o[a]).type)&&(e=j(i[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new H(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};var G="http://www.w3.org/1999/xhtml",V={svg:"http://www.w3.org/2000/svg",xhtml:G,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function $(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),V.hasOwnProperty(n)?{space:V[n],local:t}:t}function W(t){var n=$(t);return(n.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===G&&n.documentElement.namespaceURI===G?n.createElement(t):n.createElementNS(e,t)}})(n)}function Z(){}function Q(t){return null==t?Z:function(){return this.querySelector(t)}}function J(){return[]}function K(t){return null==t?J:function(){return this.querySelectorAll(t)}}var tt=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var nt=document.documentElement;if(!nt.matches){var et=nt.webkitMatchesSelector||nt.msMatchesSelector||nt.mozMatchesSelector||nt.oMatchesSelector;tt=function(t){return function(){return et.call(this,t)}}}}var rt=tt;function it(t){return new Array(t.length)}function ot(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}ot.prototype={constructor:ot,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var at="$";function ut(t,n,e,r,i,o){for(var a,u=0,f=n.length,c=o.length;u<c;++u)(a=n[u])?(a.__data__=o[u],r[u]=a):e[u]=new ot(t,o[u]);for(;u<f;++u)(a=n[u])&&(i[u]=a)}function ft(t,n,e,r,i,o,a){var u,f,c,s={},l=n.length,h=o.length,d=new Array(l);for(u=0;u<l;++u)(f=n[u])&&(d[u]=c=at+a.call(f,f.__data__,u,n),c in s?i[u]=f:s[c]=f);for(u=0;u<h;++u)(f=s[c=at+a.call(t,o[u],u,o)])?(r[u]=f,f.__data__=o[u],s[c]=null):e[u]=new ot(t,o[u]);for(u=0;u<l;++u)(f=n[u])&&s[d[u]]===f&&(i[u]=f)}function ct(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function st(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function lt(t,n){return t.style.getPropertyValue(n)||st(t).getComputedStyle(t,null).getPropertyValue(n)}function ht(t){return t.trim().split(/^|\s+/)}function dt(t){return t.classList||new pt(t)}function pt(t){this._node=t,this._names=ht(t.getAttribute("class")||"")}function vt(t,n){for(var e=dt(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function gt(t,n){for(var e=dt(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function yt(){this.textContent=""}function _t(){this.innerHTML=""}function bt(){this.nextSibling&&this.parentNode.appendChild(this)}function mt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function xt(){return null}function wt(){var t=this.parentNode;t&&t.removeChild(this)}function Mt(){return this.parentNode.insertBefore(this.cloneNode(!1),this.nextSibling)}function At(){return this.parentNode.insertBefore(this.cloneNode(!0),this.nextSibling)}pt.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var Tt={};(t.event=null,"undefined"!=typeof document)&&("onmouseenter"in document.documentElement||(Tt={mouseenter:"mouseover",mouseleave:"mouseout"}));function Nt(t,n,e){return t=St(t,n,e),function(n){var e=n.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||t.call(this,n)}}function St(n,e,r){return function(i){var o=t.event;t.event=i;try{n.call(this,this.__data__,e,r)}finally{t.event=o}}}function Et(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r<o;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.capture);++i?n.length=i:delete this.__on}}}function kt(t,n,e){var r=Tt.hasOwnProperty(t.type)?Nt:St;return function(i,o,a){var u,f=this.__on,c=r(n,o,a);if(f)for(var s=0,l=f.length;s<l;++s)if((u=f[s]).type===t.type&&u.name===t.name)return this.removeEventListener(u.type,u.listener,u.capture),this.addEventListener(u.type,u.listener=c,u.capture=e),void(u.value=n);this.addEventListener(t.type,c,e),u={type:t.type,name:t.name,value:n,listener:c,capture:e},f?f.push(u):this.__on=[u]}}function Ct(n,e,r,i){var o=t.event;n.sourceEvent=t.event,t.event=n;try{return e.apply(r,i)}finally{t.event=o}}function Pt(t,n,e){var r=st(t),i=r.CustomEvent;"function"==typeof i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}var zt=[null];function Rt(t,n){this._groups=t,this._parents=n}function Lt(){return new Rt([[document.documentElement]],zt)}function Dt(t){return"string"==typeof t?new Rt([[document.querySelector(t)]],[document.documentElement]):new Rt([[t]],zt)}Rt.prototype=Lt.prototype={constructor:Rt,select:function(t){"function"!=typeof t&&(t=Q(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a,u=n[i],f=u.length,c=r[i]=new Array(f),s=0;s<f;++s)(o=u[s])&&(a=t.call(o,o.__data__,s,u))&&("__data__"in o&&(a.__data__=o.__data__),c[s]=a);return new Rt(r,this._parents)},selectAll:function(t){"function"!=typeof t&&(t=K(t));for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var a,u=n[o],f=u.length,c=0;c<f;++c)(a=u[c])&&(r.push(t.call(a,a.__data__,c,u)),i.push(a));return new Rt(r,i)},filter:function(t){"function"!=typeof t&&(t=rt(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a=n[i],u=a.length,f=r[i]=[],c=0;c<u;++c)(o=a[c])&&t.call(o,o.__data__,c,a)&&f.push(o);return new Rt(r,this._parents)},data:function(t,n){if(!t)return p=new Array(this.size()),s=-1,this.each(function(t){p[++s]=t}),p;var e,r=n?ft:ut,i=this._parents,o=this._groups;"function"!=typeof t&&(e=t,t=function(){return e});for(var a=o.length,u=new Array(a),f=new Array(a),c=new Array(a),s=0;s<a;++s){var l=i[s],h=o[s],d=h.length,p=t.call(l,l&&l.__data__,s,i),v=p.length,g=f[s]=new Array(v),y=u[s]=new Array(v);r(l,h,g,y,c[s]=new Array(d),p,n);for(var _,b,m=0,x=0;m<v;++m)if(_=g[m]){for(m>=x&&(x=m+1);!(b=y[x])&&++x<v;);_._next=b||null}}return(u=new Rt(u,i))._enter=f,u._exit=c,u},enter:function(){return new Rt(this._enter||this._groups.map(it),this._parents)},exit:function(){return new Rt(this._exit||this._groups.map(it),this._parents)},merge:function(t){for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),a=new Array(r),u=0;u<o;++u)for(var f,c=n[u],s=e[u],l=c.length,h=a[u]=new Array(l),d=0;d<l;++d)(f=c[d]||s[d])&&(h[d]=f);for(;u<r;++u)a[u]=n[u];return new Rt(a,this._parents)},order:function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,a=i[o];--o>=0;)(r=i[o])&&(a&&a!==r.nextSibling&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=ct);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var a,u=e[o],f=u.length,c=i[o]=new Array(f),s=0;s<f;++s)(a=u[s])&&(c[s]=a);c.sort(n)}return new Rt(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){var t=new Array(this.size()),n=-1;return this.each(function(){t[++n]=this}),t},node:function(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){var t=0;return this.each(function(){++t}),t},empty:function(){return!this.node()},each:function(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i,o=n[e],a=0,u=o.length;a<u;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,n){var e=$(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((null==n?e.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}}:"function"==typeof n?e.local?function(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}:function(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}:e.local?function(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}:function(t,n){return function(){this.setAttribute(t,n)}})(e,n))},style:function(t,n,e){return arguments.length>1?this.each((null==n?function(t){return function(){this.style.removeProperty(t)}}:"function"==typeof n?function(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}:function(t,n,e){return function(){this.style.setProperty(t,n,e)}})(t,n,null==e?"":e)):lt(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?function(t){return function(){delete this[t]}}:"function"==typeof n?function(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}:function(t,n){return function(){this[t]=n}})(t,n)):this.node()[t]},classed:function(t,n){var e=ht(t+"");if(arguments.length<2){for(var r=dt(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?function(t,n){return function(){(n.apply(this,arguments)?vt:gt)(this,t)}}:n?function(t){return function(){vt(this,t)}}:function(t){return function(){gt(this,t)}})(e,n))},text:function(t){return arguments.length?this.each(null==t?yt:("function"==typeof t?function(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}:function(t){return function(){this.textContent=t}})(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?_t:("function"==typeof t?function(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}:function(t){return function(){this.innerHTML=t}})(t)):this.node().innerHTML},raise:function(){return this.each(bt)},lower:function(){return this.each(mt)},append:function(t){var n="function"==typeof t?t:W(t);return this.select(function(){return this.appendChild(n.apply(this,arguments))})},insert:function(t,n){var e="function"==typeof t?t:W(t),r=null==n?xt:"function"==typeof n?n:Q(n);return this.select(function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(wt)},clone:function(t){return this.select(t?At:Mt)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,n,e){var r,i,o=function(t){return t.trim().split(/^|\s+/).map(function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}})}(t+""),a=o.length;if(!(arguments.length<2)){for(u=n?kt:Et,null==e&&(e=!1),r=0;r<a;++r)this.each(u(o[r],n,e));return this}var u=this.node().__on;if(u)for(var f,c=0,s=u.length;c<s;++c)for(r=0,f=u[c];r<a;++r)if((i=o[r]).type===f.type&&i.name===f.name)return f.value},dispatch:function(t,n){return this.each(("function"==typeof n?function(t,n){return function(){return Pt(this,t,n.apply(this,arguments))}}:function(t,n){return function(){return Pt(this,t,n)}})(t,n))}};var Ut=0;function qt(){return new Ot}function Ot(){this._="@"+(++Ut).toString(36)}function Yt(){for(var n,e=t.event;n=e.sourceEvent;)e=n;return e}function Bt(t,n){var e=t.ownerSVGElement||t;if(e.createSVGPoint){var r=e.createSVGPoint();return r.x=n.clientX,r.y=n.clientY,[(r=r.matrixTransform(t.getScreenCTM().inverse())).x,r.y]}var i=t.getBoundingClientRect();return[n.clientX-i.left-t.clientLeft,n.clientY-i.top-t.clientTop]}function Ft(t){var n=Yt();return n.changedTouches&&(n=n.changedTouches[0]),Bt(t,n)}function It(t,n,e){arguments.length<3&&(e=n,n=Yt().changedTouches);for(var r,i=0,o=n?n.length:0;i<o;++i)if((r=n[i]).identifier===e)return Bt(t,r);return null}function Ht(){t.event.stopImmediatePropagation()}function jt(){t.event.preventDefault(),t.event.stopImmediatePropagation()}function Xt(t){var n=t.document.documentElement,e=Dt(t).on("dragstart.drag",jt,!0);"onselectstart"in n?e.on("selectstart.drag",jt,!0):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function Gt(t,n){var e=t.document.documentElement,r=Dt(t).on("dragstart.drag",null);n&&(r.on("click.drag",jt,!0),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in e?r.on("selectstart.drag",null):(e.style.MozUserSelect=e.__noselect,delete e.__noselect)}function Vt(t){return function(){return t}}function $t(t,n,e,r,i,o,a,u,f,c){this.target=t,this.type=n,this.subject=e,this.identifier=r,this.active=i,this.x=o,this.y=a,this.dx=u,this.dy=f,this._=c}function Wt(){return!t.event.button}function Zt(){return this.parentNode}function Qt(n){return null==n?{x:t.event.x,y:t.event.y}:n}function Jt(){return"ontouchstart"in this}function Kt(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function tn(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function nn(){}Ot.prototype=qt.prototype={constructor:Ot,get:function(t){for(var n=this._;!(n in t);)if(!(t=t.parentNode))return;return t[n]},set:function(t,n){return t[this._]=n},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}},$t.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var en="\\s*([+-]?\\d+)\\s*",rn="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",on="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",an=/^#([0-9a-f]{3})$/,un=/^#([0-9a-f]{6})$/,fn=new RegExp("^rgb\\("+[en,en,en]+"\\)$"),cn=new RegExp("^rgb\\("+[on,on,on]+"\\)$"),sn=new RegExp("^rgba\\("+[en,en,en,rn]+"\\)$"),ln=new RegExp("^rgba\\("+[on,on,on,rn]+"\\)$"),hn=new RegExp("^hsl\\("+[rn,on,on]+"\\)$"),dn=new RegExp("^hsla\\("+[rn,on,on,rn]+"\\)$"),pn={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};function vn(t){var n;return t=(t+"").trim().toLowerCase(),(n=an.exec(t))?new mn((n=parseInt(n[1],16))>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):(n=un.exec(t))?gn(parseInt(n[1],16)):(n=fn.exec(t))?new mn(n[1],n[2],n[3],1):(n=cn.exec(t))?new mn(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=sn.exec(t))?yn(n[1],n[2],n[3],n[4]):(n=ln.exec(t))?yn(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=hn.exec(t))?wn(n[1],n[2]/100,n[3]/100,1):(n=dn.exec(t))?wn(n[1],n[2]/100,n[3]/100,n[4]):pn.hasOwnProperty(t)?gn(pn[t]):"transparent"===t?new mn(NaN,NaN,NaN,0):null}function gn(t){return new mn(t>>16&255,t>>8&255,255&t,1)}function yn(t,n,e,r){return r<=0&&(t=n=e=NaN),new mn(t,n,e,r)}function _n(t){return t instanceof nn||(t=vn(t)),t?new mn((t=t.rgb()).r,t.g,t.b,t.opacity):new mn}function bn(t,n,e,r){return 1===arguments.length?_n(t):new mn(t,n,e,null==r?1:r)}function mn(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function xn(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function wn(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new An(t,n,e,r)}function Mn(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof An)return new An(t.h,t.s,t.l,t.opacity);if(t instanceof nn||(t=vn(t)),!t)return new An;if(t instanceof An)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),a=NaN,u=o-i,f=(o+i)/2;return u?(a=n===o?(e-r)/u+6*(e<r):e===o?(r-n)/u+2:(n-e)/u+4,u/=f<.5?o+i:2-o-i,a*=60):u=f>0&&f<1?0:a,new An(a,u,f,t.opacity)}(t):new An(t,n,e,null==r?1:r)}function An(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Tn(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}Kt(nn,vn,{displayable:function(){return this.rgb().displayable()},hex:function(){return this.rgb().hex()},toString:function(){return this.rgb()+""}}),Kt(mn,bn,tn(nn,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new mn(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new mn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},hex:function(){return"#"+xn(this.r)+xn(this.g)+xn(this.b)},toString:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),Kt(An,Mn,tn(nn,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new An(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new An(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new mn(Tn(t>=240?t-240:t+120,i,r),Tn(t,i,r),Tn(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var Nn=Math.PI/180,Sn=180/Math.PI,En=.96422,kn=1,Cn=.82521,Pn=4/29,zn=6/29,Rn=3*zn*zn,Ln=zn*zn*zn;function Dn(t){if(t instanceof qn)return new qn(t.l,t.a,t.b,t.opacity);if(t instanceof jn){if(isNaN(t.h))return new qn(t.l,0,0,t.opacity);var n=t.h*Nn;return new qn(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}t instanceof mn||(t=_n(t));var e,r,i=Fn(t.r),o=Fn(t.g),a=Fn(t.b),u=On((.2225045*i+.7168786*o+.0606169*a)/kn);return i===o&&o===a?e=r=u:(e=On((.4360747*i+.3850649*o+.1430804*a)/En),r=On((.0139322*i+.0971045*o+.7141733*a)/Cn)),new qn(116*u-16,500*(e-u),200*(u-r),t.opacity)}function Un(t,n,e,r){return 1===arguments.length?Dn(t):new qn(t,n,e,null==r?1:r)}function qn(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function On(t){return t>Ln?Math.pow(t,1/3):t/Rn+Pn}function Yn(t){return t>zn?t*t*t:Rn*(t-Pn)}function Bn(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Fn(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function In(t){if(t instanceof jn)return new jn(t.h,t.c,t.l,t.opacity);if(t instanceof qn||(t=Dn(t)),0===t.a&&0===t.b)return new jn(NaN,0,t.l,t.opacity);var n=Math.atan2(t.b,t.a)*Sn;return new jn(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function Hn(t,n,e,r){return 1===arguments.length?In(t):new jn(t,n,e,null==r?1:r)}function jn(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}Kt(qn,Un,tn(nn,{brighter:function(t){return new qn(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new qn(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return new mn(Bn(3.1338561*(n=En*Yn(n))-1.6168667*(t=kn*Yn(t))-.4906146*(e=Cn*Yn(e))),Bn(-.9787684*n+1.9161415*t+.033454*e),Bn(.0719453*n-.2289914*t+1.4052427*e),this.opacity)}})),Kt(jn,Hn,tn(nn,{brighter:function(t){return new jn(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new jn(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return Dn(this).rgb()}}));var Xn=-.14861,Gn=1.78277,Vn=-.29227,$n=-.90649,Wn=1.97294,Zn=Wn*$n,Qn=Wn*Gn,Jn=Gn*Vn-$n*Xn;function Kn(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof te)return new te(t.h,t.s,t.l,t.opacity);t instanceof mn||(t=_n(t));var n=t.r/255,e=t.g/255,r=t.b/255,i=(Jn*r+Zn*n-Qn*e)/(Jn+Zn-Qn),o=r-i,a=(Wn*(e-i)-Vn*o)/$n,u=Math.sqrt(a*a+o*o)/(Wn*i*(1-i)),f=u?Math.atan2(a,o)*Sn-120:NaN;return new te(f<0?f+360:f,u,i,t.opacity)}(t):new te(t,n,e,null==r?1:r)}function te(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function ne(t,n,e,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*n+(4-6*o+3*a)*e+(1+3*t+3*o-3*a)*r+a*i)/6}function ee(t){var n=t.length-1;return function(e){var r=e<=0?e=0:e>=1?(e=1,n-1):Math.floor(e*n),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,u=r<n-1?t[r+2]:2*o-i;return ne((e-r/n)*n,a,i,o,u)}}function re(t){var n=t.length;return function(e){var r=Math.floor(((e%=1)<0?++e:e)*n),i=t[(r+n-1)%n],o=t[r%n],a=t[(r+1)%n],u=t[(r+2)%n];return ne((e-r/n)*n,i,o,a,u)}}function ie(t){return function(){return t}}function oe(t,n){return function(e){return t+e*n}}function ae(t,n){var e=n-t;return e?oe(t,e>180||e<-180?e-360*Math.round(e/360):e):ie(isNaN(t)?n:t)}function ue(t){return 1==(t=+t)?fe:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):ie(isNaN(n)?e:n)}}function fe(t,n){var e=n-t;return e?oe(t,e):ie(isNaN(t)?n:t)}Kt(te,Kn,tn(nn,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new te(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new te(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*Nn,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new mn(255*(n+e*(Xn*r+Gn*i)),255*(n+e*(Vn*r+$n*i)),255*(n+e*(Wn*r)),this.opacity)}}));var ce=function t(n){var e=ue(n);function r(t,n){var r=e((t=bn(t)).r,(n=bn(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),a=fe(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=a(n),t+""}}return r.gamma=t,r}(1);function se(t){return function(n){var e,r,i=n.length,o=new Array(i),a=new Array(i),u=new Array(i);for(e=0;e<i;++e)r=bn(n[e]),o[e]=r.r||0,a[e]=r.g||0,u[e]=r.b||0;return o=t(o),a=t(a),u=t(u),r.opacity=1,function(t){return r.r=o(t),r.g=a(t),r.b=u(t),r+""}}}var le=se(ee),he=se(re);function de(t,n){var e,r=n?n.length:0,i=t?Math.min(r,t.length):0,o=new Array(i),a=new Array(r);for(e=0;e<i;++e)o[e]=me(t[e],n[e]);for(;e<r;++e)a[e]=n[e];return function(t){for(e=0;e<i;++e)a[e]=o[e](t);return a}}function pe(t,n){var e=new Date;return n-=t=+t,function(r){return e.setTime(t+n*r),e}}function ve(t,n){return n-=t=+t,function(e){return t+n*e}}function ge(t,n){var e,r={},i={};for(e in null!==t&&"object"==typeof t||(t={}),null!==n&&"object"==typeof n||(n={}),n)e in t?r[e]=me(t[e],n[e]):i[e]=n[e];return function(t){for(e in r)i[e]=r[e](t);return i}}var ye=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,_e=new RegExp(ye.source,"g");function be(t,n){var e,r,i,o=ye.lastIndex=_e.lastIndex=0,a=-1,u=[],f=[];for(t+="",n+="";(e=ye.exec(t))&&(r=_e.exec(n));)(i=r.index)>o&&(i=n.slice(o,i),u[a]?u[a]+=i:u[++a]=i),(e=e[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,f.push({i:a,x:ve(e,r)})),o=_e.lastIndex;return o<n.length&&(i=n.slice(o),u[a]?u[a]+=i:u[++a]=i),u.length<2?f[0]?function(t){return function(n){return t(n)+""}}(f[0].x):function(t){return function(){return t}}(n):(n=f.length,function(t){for(var e,r=0;r<n;++r)u[(e=f[r]).i]=e.x(t);return u.join("")})}function me(t,n){var e,r=typeof n;return null==n||"boolean"===r?ie(n):("number"===r?ve:"string"===r?(e=vn(n))?(n=e,ce):be:n instanceof vn?ce:n instanceof Date?pe:Array.isArray(n)?de:"function"!=typeof n.valueOf&&"function"!=typeof n.toString||isNaN(n)?ge:ve)(t,n)}function xe(t,n){return n-=t=+t,function(e){return Math.round(t+n*e)}}var we,Me,Ae,Te,Ne=180/Math.PI,Se={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ee(t,n,e,r,i,o){var a,u,f;return(a=Math.sqrt(t*t+n*n))&&(t/=a,n/=a),(f=t*e+n*r)&&(e-=t*f,r-=n*f),(u=Math.sqrt(e*e+r*r))&&(e/=u,r/=u,f/=u),t*r<n*e&&(t=-t,n=-n,f=-f,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(n,t)*Ne,skewX:Math.atan(f)*Ne,scaleX:a,scaleY:u}}function ke(t,n,e,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var u=[],f=[];return o=t(o),a=t(a),function(t,r,i,o,a,u){if(t!==i||r!==o){var f=a.push("translate(",null,n,null,e);u.push({i:f-4,x:ve(t,i)},{i:f-2,x:ve(r,o)})}else(i||o)&&a.push("translate("+i+n+o+e)}(o.translateX,o.translateY,a.translateX,a.translateY,u,f),function(t,n,e,o){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:ve(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(o.rotate,a.rotate,u,f),function(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:ve(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(o.skewX,a.skewX,u,f),function(t,n,e,r,o,a){if(t!==e||n!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:ve(t,e)},{i:u-2,x:ve(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,u,f),o=a=null,function(t){for(var n,e=-1,r=f.length;++e<r;)u[(n=f[e]).i]=n.x(t);return u.join("")}}}var Ce=ke(function(t){return"none"===t?Se:(we||(we=document.createElement("DIV"),Me=document.documentElement,Ae=document.defaultView),we.style.transform=t,t=Ae.getComputedStyle(Me.appendChild(we),null).getPropertyValue("transform"),Me.removeChild(we),Ee(+(t=t.slice(7,-1).split(","))[0],+t[1],+t[2],+t[3],+t[4],+t[5]))},"px, ","px)","deg)"),Pe=ke(function(t){return null==t?Se:(Te||(Te=document.createElementNS("http://www.w3.org/2000/svg","g")),Te.setAttribute("transform",t),(t=Te.transform.baseVal.consolidate())?Ee((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):Se)},", ",")",")"),ze=Math.SQRT2,Re=2,Le=4,De=1e-12;function Ue(t){return((t=Math.exp(t))+1/t)/2}function qe(t,n){var e,r,i=t[0],o=t[1],a=t[2],u=n[0],f=n[1],c=n[2],s=u-i,l=f-o,h=s*s+l*l;if(h<De)r=Math.log(c/a)/ze,e=function(t){return[i+t*s,o+t*l,a*Math.exp(ze*t*r)]};else{var d=Math.sqrt(h),p=(c*c-a*a+Le*h)/(2*a*Re*d),v=(c*c-a*a-Le*h)/(2*c*Re*d),g=Math.log(Math.sqrt(p*p+1)-p),y=Math.log(Math.sqrt(v*v+1)-v);r=(y-g)/ze,e=function(t){var n,e=t*r,u=Ue(g),f=a/(Re*d)*(u*(n=ze*e+g,((n=Math.exp(2*n))-1)/(n+1))-function(t){return((t=Math.exp(t))-1/t)/2}(g));return[i+f*s,o+f*l,a*u/Ue(ze*e+g)]}}return e.duration=1e3*r,e}function Oe(t){return function(n,e){var r=t((n=Mn(n)).h,(e=Mn(e)).h),i=fe(n.s,e.s),o=fe(n.l,e.l),a=fe(n.opacity,e.opacity);return function(t){return n.h=r(t),n.s=i(t),n.l=o(t),n.opacity=a(t),n+""}}}var Ye=Oe(ae),Be=Oe(fe);function Fe(t){return function(n,e){var r=t((n=Hn(n)).h,(e=Hn(e)).h),i=fe(n.c,e.c),o=fe(n.l,e.l),a=fe(n.opacity,e.opacity);return function(t){return n.h=r(t),n.c=i(t),n.l=o(t),n.opacity=a(t),n+""}}}var Ie=Fe(ae),He=Fe(fe);function je(t){return function n(e){function r(n,r){var i=t((n=Kn(n)).h,(r=Kn(r)).h),o=fe(n.s,r.s),a=fe(n.l,r.l),u=fe(n.opacity,r.opacity);return function(t){return n.h=i(t),n.s=o(t),n.l=a(Math.pow(t,e)),n.opacity=u(t),n+""}}return e=+e,r.gamma=n,r}(1)}var Xe=je(ae),Ge=je(fe);var Ve,$e,We=0,Ze=0,Qe=0,Je=1e3,Ke=0,tr=0,nr=0,er="object"==typeof performance&&performance.now?performance:Date,rr="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function ir(){return tr||(rr(or),tr=er.now()+nr)}function or(){tr=0}function ar(){this._call=this._time=this._next=null}function ur(t,n,e){var r=new ar;return r.restart(t,n,e),r}function fr(){ir(),++We;for(var t,n=Ve;n;)(t=tr-n._time)>=0&&n._call.call(null,t),n=n._next;--We}function cr(){tr=(Ke=er.now())+nr,We=Ze=0;try{fr()}finally{We=0,function(){var t,n,e=Ve,r=1/0;for(;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Ve=n);$e=t,lr(r)}(),tr=0}}function sr(){var t=er.now(),n=t-Ke;n>Je&&(nr-=n,Ke=t)}function lr(t){We||(Ze&&(Ze=clearTimeout(Ze)),t-tr>24?(t<1/0&&(Ze=setTimeout(cr,t-er.now()-nr)),Qe&&(Qe=clearInterval(Qe))):(Qe||(Ke=er.now(),Qe=setInterval(sr,Je)),We=1,rr(cr)))}function hr(t,n,e){var r=new ar;return n=null==n?0:+n,r.restart(function(e){r.stop(),t(e+n)},n,e),r}ar.prototype=ur.prototype={constructor:ar,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?ir():+e)+(null==n?0:+n),this._next||$e===this||($e?$e._next=this:Ve=this,$e=this),this._call=t,this._time=e,lr()},stop:function(){this._call&&(this._call=null,this._time=1/0,lr())}};var dr=I("start","end","interrupt"),pr=[],vr=0,gr=1,yr=2,_r=3,br=4,mr=5,xr=6;function wr(t,n,e,r,i,o){var a=t.__transition;if(a){if(e in a)return}else t.__transition={};!function(t,n,e){var r,i=t.__transition;function o(f){var c,s,l,h;if(e.state!==gr)return u();for(c in i)if((h=i[c]).name===e.name){if(h.state===_r)return hr(o);h.state===br?(h.state=xr,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete i[c]):+c<n&&(h.state=xr,h.timer.stop(),delete i[c])}if(hr(function(){e.state===_r&&(e.state=br,e.timer.restart(a,e.delay,e.time),a(f))}),e.state=yr,e.on.call("start",t,t.__data__,e.index,e.group),e.state===yr){for(e.state=_r,r=new Array(l=e.tween.length),c=0,s=-1;c<l;++c)(h=e.tween[c].value.call(t,t.__data__,e.index,e.group))&&(r[++s]=h);r.length=s+1}}function a(n){for(var i=n<e.duration?e.ease.call(null,n/e.duration):(e.timer.restart(u),e.state=mr,1),o=-1,a=r.length;++o<a;)r[o].call(null,i);e.state===mr&&(e.on.call("end",t,t.__data__,e.index,e.group),u())}function u(){for(var r in e.state=xr,e.timer.stop(),delete i[n],i)return;delete t.__transition}i[n]=e,e.timer=ur(function(t){e.state=gr,e.timer.restart(o,e.delay,e.time),e.delay<=t&&o(t-e.delay)},0,e.time)}(t,e,{name:n,index:r,group:i,on:dr,tween:pr,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:vr})}function Mr(t,n){var e=Tr(t,n);if(e.state>vr)throw new Error("too late; already scheduled");return e}function Ar(t,n){var e=Tr(t,n);if(e.state>yr)throw new Error("too late; already started");return e}function Tr(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function Nr(t,n){var e,r,i,o=t.__transition,a=!0;if(o){for(i in n=null==n?null:n+"",o)(e=o[i]).name===n?(r=e.state>yr&&e.state<mr,e.state=xr,e.timer.stop(),r&&e.on.call("interrupt",t,t.__data__,e.index,e.group),delete o[i]):a=!1;a&&delete t.__transition}}function Sr(t,n,e){var r=t._id;return t.each(function(){var t=Ar(this,r);(t.value||(t.value={}))[n]=e.apply(this,arguments)}),function(t){return Tr(t,r).value[n]}}function Er(t,n){var e;return("number"==typeof n?ve:n instanceof vn?ce:(e=vn(n))?(n=e,ce):be)(t,n)}var kr=Lt.prototype.constructor;var Cr=0;function Pr(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function zr(t){return Lt().transition(t)}function Rr(){return++Cr}var Lr=Lt.prototype;function Dr(t){return((t*=2)<=1?t*t:--t*(2-t)+1)/2}function Ur(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}Pr.prototype=zr.prototype={constructor:Pr,select:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=Q(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var u,f,c=r[a],s=c.length,l=o[a]=new Array(s),h=0;h<s;++h)(u=c[h])&&(f=t.call(u,u.__data__,h,c))&&("__data__"in u&&(f.__data__=u.__data__),l[h]=f,wr(l[h],n,e,h,l,Tr(u,e)));return new Pr(o,this._parents,n,e)},selectAll:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=K(t));for(var r=this._groups,i=r.length,o=[],a=[],u=0;u<i;++u)for(var f,c=r[u],s=c.length,l=0;l<s;++l)if(f=c[l]){for(var h,d=t.call(f,f.__data__,l,c),p=Tr(f,e),v=0,g=d.length;v<g;++v)(h=d[v])&&wr(h,n,e,v,d,p);o.push(d),a.push(f)}return new Pr(o,a,n,e)},filter:function(t){"function"!=typeof t&&(t=rt(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a=n[i],u=a.length,f=r[i]=[],c=0;c<u;++c)(o=a[c])&&t.call(o,o.__data__,c,a)&&f.push(o);return new Pr(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),a=new Array(r),u=0;u<o;++u)for(var f,c=n[u],s=e[u],l=c.length,h=a[u]=new Array(l),d=0;d<l;++d)(f=c[d]||s[d])&&(h[d]=f);for(;u<r;++u)a[u]=n[u];return new Pr(a,this._parents,this._name,this._id)},selection:function(){return new kr(this._groups,this._parents)},transition:function(){for(var t=this._name,n=this._id,e=Rr(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a,u=r[o],f=u.length,c=0;c<f;++c)if(a=u[c]){var s=Tr(a,n);wr(a,t,e,c,u,{time:s.time+s.delay+s.duration,delay:0,duration:s.duration,ease:s.ease})}return new Pr(r,this._parents,t,e)},call:Lr.call,nodes:Lr.nodes,node:Lr.node,size:Lr.size,empty:Lr.empty,each:Lr.each,on:function(t,n){var e=this._id;return arguments.length<2?Tr(this.node(),e).on.on(t):this.each(function(t,n,e){var r,i,o=function(t){return(t+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||"start"===t})}(n)?Mr:Ar;return function(){var a=o(this,t),u=a.on;u!==r&&(i=(r=u).copy()).on(n,e),a.on=i}}(e,t,n))},attr:function(t,n){var e=$(t),r="transform"===e?Pe:Er;return this.attrTween(t,"function"==typeof n?(e.local?function(t,n,e){var r,i,o;return function(){var a,u=e(this);if(null!=u)return(a=this.getAttributeNS(t.space,t.local))===u?null:a===r&&u===i?o:o=n(r=a,i=u);this.removeAttributeNS(t.space,t.local)}}:function(t,n,e){var r,i,o;return function(){var a,u=e(this);if(null!=u)return(a=this.getAttribute(t))===u?null:a===r&&u===i?o:o=n(r=a,i=u);this.removeAttribute(t)}})(e,r,Sr(this,"attr."+t,n)):null==n?(e.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}})(e):(e.local?function(t,n,e){var r,i;return function(){var o=this.getAttributeNS(t.space,t.local);return o===e?null:o===r?i:i=n(r=o,e)}}:function(t,n,e){var r,i;return function(){var o=this.getAttribute(t);return o===e?null:o===r?i:i=n(r=o,e)}})(e,r,n+""))},attrTween:function(t,n){var e="attr."+t;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(null==n)return this.tween(e,null);if("function"!=typeof n)throw new Error;var r=$(t);return this.tween(e,(r.local?function(t,n){function e(){var e=this,r=n.apply(e,arguments);return r&&function(n){e.setAttributeNS(t.space,t.local,r(n))}}return e._value=n,e}:function(t,n){function e(){var e=this,r=n.apply(e,arguments);return r&&function(n){e.setAttribute(t,r(n))}}return e._value=n,e})(r,n))},style:function(t,n,e){var r="transform"==(t+="")?Ce:Er;return null==n?this.styleTween(t,function(t,n){var e,r,i;return function(){var o=lt(this,t),a=(this.style.removeProperty(t),lt(this,t));return o===a?null:o===e&&a===r?i:i=n(e=o,r=a)}}(t,r)).on("end.style."+t,function(t){return function(){this.style.removeProperty(t)}}(t)):this.styleTween(t,"function"==typeof n?function(t,n,e){var r,i,o;return function(){var a=lt(this,t),u=e(this);return null==u&&(this.style.removeProperty(t),u=lt(this,t)),a===u?null:a===r&&u===i?o:o=n(r=a,i=u)}}(t,r,Sr(this,"style."+t,n)):function(t,n,e){var r,i;return function(){var o=lt(this,t);return o===e?null:o===r?i:i=n(r=o,e)}}(t,r,n+""),e)},styleTween:function(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,function(t,n,e){function r(){var r=this,i=n.apply(r,arguments);return i&&function(n){r.style.setProperty(t,i(n),e)}}return r._value=n,r}(t,n,null==e?"":e))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var n=t(this);this.textContent=null==n?"":n}}(Sr(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},remove:function(){return this.on("end.remove",(t=this._id,function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}));var t},tween:function(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,i=Tr(this.node(),e).tween,o=0,a=i.length;o<a;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==n?function(t,n){var e,r;return function(){var i=Ar(this,t),o=i.tween;if(o!==e)for(var a=0,u=(r=e=o).length;a<u;++a)if(r[a].name===n){(r=r.slice()).splice(a,1);break}i.tween=r}}:function(t,n,e){var r,i;if("function"!=typeof e)throw new Error;return function(){var o=Ar(this,t),a=o.tween;if(a!==r){i=(r=a).slice();for(var u={name:n,value:e},f=0,c=i.length;f<c;++f)if(i[f].name===n){i[f]=u;break}f===c&&i.push(u)}o.tween=i}})(e,t,n))},delay:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?function(t,n){return function(){Mr(this,t).delay=+n.apply(this,arguments)}}:function(t,n){return n=+n,function(){Mr(this,t).delay=n}})(n,t)):Tr(this.node(),n).delay},duration:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?function(t,n){return function(){Ar(this,t).duration=+n.apply(this,arguments)}}:function(t,n){return n=+n,function(){Ar(this,t).duration=n}})(n,t)):Tr(this.node(),n).duration},ease:function(t){var n=this._id;return arguments.length?this.each(function(t,n){if("function"!=typeof n)throw new Error;return function(){Ar(this,t).ease=n}}(n,t)):Tr(this.node(),n).ease}};var qr=function t(n){function e(t){return Math.pow(t,n)}return n=+n,e.exponent=t,e}(3),Or=function t(n){function e(t){return 1-Math.pow(1-t,n)}return n=+n,e.exponent=t,e}(3),Yr=function t(n){function e(t){return((t*=2)<=1?Math.pow(t,n):2-Math.pow(2-t,n))/2}return n=+n,e.exponent=t,e}(3),Br=Math.PI,Fr=Br/2;function Ir(t){return(1-Math.cos(Br*t))/2}function Hr(t){return((t*=2)<=1?Math.pow(2,10*t-10):2-Math.pow(2,10-10*t))/2}function jr(t){return((t*=2)<=1?1-Math.sqrt(1-t*t):Math.sqrt(1-(t-=2)*t)+1)/2}var Xr=4/11,Gr=6/11,Vr=8/11,$r=.75,Wr=9/11,Zr=10/11,Qr=.9375,Jr=21/22,Kr=63/64,ti=1/Xr/Xr;function ni(t){return(t=+t)<Xr?ti*t*t:t<Vr?ti*(t-=Gr)*t+$r:t<Zr?ti*(t-=Wr)*t+Qr:ti*(t-=Jr)*t+Kr}var ei=function t(n){function e(t){return t*t*((n+1)*t-n)}return n=+n,e.overshoot=t,e}(1.70158),ri=function t(n){function e(t){return--t*t*((n+1)*t+n)+1}return n=+n,e.overshoot=t,e}(1.70158),ii=function t(n){function e(t){return((t*=2)<1?t*t*((n+1)*t-n):(t-=2)*t*((n+1)*t+n)+2)/2}return n=+n,e.overshoot=t,e}(1.70158),oi=2*Math.PI,ai=function t(n,e){var r=Math.asin(1/(n=Math.max(1,n)))*(e/=oi);function i(t){return n*Math.pow(2,10*--t)*Math.sin((r-t)/e)}return i.amplitude=function(n){return t(n,e*oi)},i.period=function(e){return t(n,e)},i}(1,.3),ui=function t(n,e){var r=Math.asin(1/(n=Math.max(1,n)))*(e/=oi);function i(t){return 1-n*Math.pow(2,-10*(t=+t))*Math.sin((t+r)/e)}return i.amplitude=function(n){return t(n,e*oi)},i.period=function(e){return t(n,e)},i}(1,.3),fi=function t(n,e){var r=Math.asin(1/(n=Math.max(1,n)))*(e/=oi);function i(t){return((t=2*t-1)<0?n*Math.pow(2,10*t)*Math.sin((r-t)/e):2-n*Math.pow(2,-10*t)*Math.sin((r+t)/e))/2}return i.amplitude=function(n){return t(n,e*oi)},i.period=function(e){return t(n,e)},i}(1,.3),ci={time:null,delay:0,duration:250,ease:Ur};function si(t,n){for(var e;!(e=t.__transition)||!(e=e[n]);)if(!(t=t.parentNode))return ci.time=ir(),ci;return e}Lt.prototype.interrupt=function(t){return this.each(function(){Nr(this,t)})},Lt.prototype.transition=function(t){var n,e;t instanceof Pr?(n=t._id,t=t._name):(n=Rr(),(e=ci).time=ir(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a,u=r[o],f=u.length,c=0;c<f;++c)(a=u[c])&&wr(a,t,n,c,u,e||si(a,n));return new Pr(r,this._parents,t,n)};var li=[null];function hi(t){return function(){return t}}function di(t,n,e){this.target=t,this.type=n,this.selection=e}function pi(){t.event.stopImmediatePropagation()}function vi(){t.event.preventDefault(),t.event.stopImmediatePropagation()}var gi={name:"drag"},yi={name:"space"},_i={name:"handle"},bi={name:"center"},mi={name:"x",handles:["e","w"].map(Ei),input:function(t,n){return t&&[[t[0],n[0][1]],[t[1],n[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},xi={name:"y",handles:["n","s"].map(Ei),input:function(t,n){return t&&[[n[0][0],t[0]],[n[1][0],t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},wi={name:"xy",handles:["n","e","s","w","nw","ne","se","sw"].map(Ei),input:function(t){return t},output:function(t){return t}},Mi={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Ai={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},Ti={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},Ni={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},Si={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function Ei(t){return{type:t}}function ki(){return!t.event.button}function Ci(){var t=this.ownerSVGElement||this;return[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function Pi(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function zi(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}function Ri(n){var e,r=Ci,i=ki,o=I(u,"start","brush","end"),a=6;function u(t){var e=t.property("__brush",h).selectAll(".overlay").data([Ei("overlay")]);e.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Mi.overlay).merge(e).each(function(){var t=Pi(this).extent;Dt(this).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1])}),t.selectAll(".selection").data([Ei("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Mi.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var r=t.selectAll(".handle").data(n.handles,function(t){return t.type});r.exit().remove(),r.enter().append("rect").attr("class",function(t){return"handle handle--"+t.type}).attr("cursor",function(t){return Mi[t.type]}),t.each(f).attr("fill","none").attr("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush touchstart.brush",l)}function f(){var t=Dt(this),n=Pi(this).selection;n?(t.selectAll(".selection").style("display",null).attr("x",n[0][0]).attr("y",n[0][1]).attr("width",n[1][0]-n[0][0]).attr("height",n[1][1]-n[0][1]),t.selectAll(".handle").style("display",null).attr("x",function(t){return"e"===t.type[t.type.length-1]?n[1][0]-a/2:n[0][0]-a/2}).attr("y",function(t){return"s"===t.type[0]?n[1][1]-a/2:n[0][1]-a/2}).attr("width",function(t){return"n"===t.type||"s"===t.type?n[1][0]-n[0][0]+a:a}).attr("height",function(t){return"e"===t.type||"w"===t.type?n[1][1]-n[0][1]+a:a})):t.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function c(t,n){return t.__brush.emitter||new s(t,n)}function s(t,n){this.that=t,this.args=n,this.state=t.__brush,this.active=0}function l(){if(t.event.touches){if(t.event.changedTouches.length<t.event.touches.length)return vi()}else if(e)return;if(i.apply(this,arguments)){var r,o,a,u,s,l,h,d,p,v,g,y,_,b=this,m=t.event.target.__data__.type,x="selection"===(t.event.metaKey?m="overlay":m)?gi:t.event.altKey?bi:_i,w=n===xi?null:Ni[m],M=n===mi?null:Si[m],A=Pi(b),T=A.extent,N=A.selection,S=T[0][0],E=T[0][1],k=T[1][0],C=T[1][1],P=w&&M&&t.event.shiftKey,z=Ft(b),R=z,L=c(b,arguments).beforestart();"overlay"===m?A.selection=N=[[r=n===xi?S:z[0],a=n===mi?E:z[1]],[s=n===xi?k:r,h=n===mi?C:a]]:(r=N[0][0],a=N[0][1],s=N[1][0],h=N[1][1]),o=r,u=a,l=s,d=h;var D=Dt(b).attr("pointer-events","none"),U=D.selectAll(".overlay").attr("cursor",Mi[m]);if(t.event.touches)D.on("touchmove.brush",O,!0).on("touchend.brush touchcancel.brush",B,!0);else{var q=Dt(t.event.view).on("keydown.brush",function(){switch(t.event.keyCode){case 16:P=w&&M;break;case 18:x===_i&&(w&&(s=l-p*w,r=o+p*w),M&&(h=d-v*M,a=u+v*M),x=bi,Y());break;case 32:x!==_i&&x!==bi||(w<0?s=l-p:w>0&&(r=o-p),M<0?h=d-v:M>0&&(a=u-v),x=yi,U.attr("cursor",Mi.selection),Y());break;default:return}vi()},!0).on("keyup.brush",function(){switch(t.event.keyCode){case 16:P&&(y=_=P=!1,Y());break;case 18:x===bi&&(w<0?s=l:w>0&&(r=o),M<0?h=d:M>0&&(a=u),x=_i,Y());break;case 32:x===yi&&(t.event.altKey?(w&&(s=l-p*w,r=o+p*w),M&&(h=d-v*M,a=u+v*M),x=bi):(w<0?s=l:w>0&&(r=o),M<0?h=d:M>0&&(a=u),x=_i),U.attr("cursor",Mi[m]),Y());break;default:return}vi()},!0).on("mousemove.brush",O,!0).on("mouseup.brush",B,!0);Xt(t.event.view)}pi(),Nr(b),f.call(b),L.start()}function O(){var t=Ft(b);!P||y||_||(Math.abs(t[0]-R[0])>Math.abs(t[1]-R[1])?_=!0:y=!0),R=t,g=!0,vi(),Y()}function Y(){var t;switch(p=R[0]-z[0],v=R[1]-z[1],x){case yi:case gi:w&&(p=Math.max(S-r,Math.min(k-s,p)),o=r+p,l=s+p),M&&(v=Math.max(E-a,Math.min(C-h,v)),u=a+v,d=h+v);break;case _i:w<0?(p=Math.max(S-r,Math.min(k-r,p)),o=r+p,l=s):w>0&&(p=Math.max(S-s,Math.min(k-s,p)),o=r,l=s+p),M<0?(v=Math.max(E-a,Math.min(C-a,v)),u=a+v,d=h):M>0&&(v=Math.max(E-h,Math.min(C-h,v)),u=a,d=h+v);break;case bi:w&&(o=Math.max(S,Math.min(k,r-p*w)),l=Math.max(S,Math.min(k,s+p*w))),M&&(u=Math.max(E,Math.min(C,a-v*M)),d=Math.max(E,Math.min(C,h+v*M)))}l<o&&(w*=-1,t=r,r=s,s=t,t=o,o=l,l=t,m in Ai&&U.attr("cursor",Mi[m=Ai[m]])),d<u&&(M*=-1,t=a,a=h,h=t,t=u,u=d,d=t,m in Ti&&U.attr("cursor",Mi[m=Ti[m]])),A.selection&&(N=A.selection),y&&(o=N[0][0],l=N[1][0]),_&&(u=N[0][1],d=N[1][1]),N[0][0]===o&&N[0][1]===u&&N[1][0]===l&&N[1][1]===d||(A.selection=[[o,u],[l,d]],f.call(b),L.brush())}function B(){if(pi(),t.event.touches){if(t.event.touches.length)return;e&&clearTimeout(e),e=setTimeout(function(){e=null},500),D.on("touchmove.brush touchend.brush touchcancel.brush",null)}else Gt(t.event.view,g),q.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);D.attr("pointer-events","all"),U.attr("cursor",Mi.overlay),A.selection&&(N=A.selection),zi(N)&&(A.selection=null,f.call(b)),L.end()}}function h(){var t=this.__brush||{selection:null};return t.extent=r.apply(this,arguments),t.dim=n,t}return u.move=function(t,e){t.selection?t.on("start.brush",function(){c(this,arguments).beforestart().start()}).on("interrupt.brush end.brush",function(){c(this,arguments).end()}).tween("brush",function(){var t=this,r=t.__brush,i=c(t,arguments),o=r.selection,a=n.input("function"==typeof e?e.apply(this,arguments):e,r.extent),u=me(o,a);function s(n){r.selection=1===n&&zi(a)?null:u(n),f.call(t),i.brush()}return o&&a?s:s(1)}):t.each(function(){var t=arguments,r=this.__brush,i=n.input("function"==typeof e?e.apply(this,t):e,r.extent),o=c(this,t).beforestart();Nr(this),r.selection=null==i||zi(i)?null:i,f.call(this),o.start().brush().end()})},s.prototype={beforestart:function(){return 1==++this.active&&(this.state.emitter=this,this.starting=!0),this},start:function(){return this.starting&&(this.starting=!1,this.emit("start")),this},brush:function(){return this.emit("brush"),this},end:function(){return 0==--this.active&&(delete this.state.emitter,this.emit("end")),this},emit:function(t){Ct(new di(u,t,n.output(this.state.selection)),o.apply,o,[t,this.that,this.args])}},u.extent=function(t){return arguments.length?(r="function"==typeof t?t:hi([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),u):r},u.filter=function(t){return arguments.length?(i="function"==typeof t?t:hi(!!t),u):i},u.handleSize=function(t){return arguments.length?(a=+t,u):a},u.on=function(){var t=o.on.apply(o,arguments);return t===o?u:t},u}var Li=Math.cos,Di=Math.sin,Ui=Math.PI,qi=Ui/2,Oi=2*Ui,Yi=Math.max;var Bi=Array.prototype.slice;function Fi(t){return function(){return t}}var Ii=Math.PI,Hi=2*Ii,ji=Hi-1e-6;function Xi(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function Gi(){return new Xi}function Vi(t){return t.source}function $i(t){return t.target}function Wi(t){return t.radius}function Zi(t){return t.startAngle}function Qi(t){return t.endAngle}Xi.prototype=Gi.prototype={constructor:Xi,moveTo:function(t,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,n){this._+="L"+(this._x1=+t)+","+(this._y1=+n)},quadraticCurveTo:function(t,n,e,r){this._+="Q"+ +t+","+ +n+","+(this._x1=+e)+","+(this._y1=+r)},bezierCurveTo:function(t,n,e,r,i,o){this._+="C"+ +t+","+ +n+","+ +e+","+ +r+","+(this._x1=+i)+","+(this._y1=+o)},arcTo:function(t,n,e,r,i){t=+t,n=+n,e=+e,r=+r,i=+i;var o=this._x1,a=this._y1,u=e-t,f=r-n,c=o-t,s=a-n,l=c*c+s*s;if(i<0)throw new Error("negative radius: "+i);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=n);else if(l>1e-6)if(Math.abs(s*u-f*c)>1e-6&&i){var h=e-o,d=r-a,p=u*u+f*f,v=h*h+d*d,g=Math.sqrt(p),y=Math.sqrt(l),_=i*Math.tan((Ii-Math.acos((p+l-v)/(2*g*y)))/2),b=_/y,m=_/g;Math.abs(b-1)>1e-6&&(this._+="L"+(t+b*c)+","+(n+b*s)),this._+="A"+i+","+i+",0,0,"+ +(s*h>c*d)+","+(this._x1=t+m*u)+","+(this._y1=n+m*f)}else this._+="L"+(this._x1=t)+","+(this._y1=n);else;},arc:function(t,n,e,r,i,o){t=+t,n=+n;var a=(e=+e)*Math.cos(r),u=e*Math.sin(r),f=t+a,c=n+u,s=1^o,l=o?r-i:i-r;if(e<0)throw new Error("negative radius: "+e);null===this._x1?this._+="M"+f+","+c:(Math.abs(this._x1-f)>1e-6||Math.abs(this._y1-c)>1e-6)&&(this._+="L"+f+","+c),e&&(l<0&&(l=l%Hi+Hi),l>ji?this._+="A"+e+","+e+",0,1,"+s+","+(t-a)+","+(n-u)+"A"+e+","+e+",0,1,"+s+","+(this._x1=f)+","+(this._y1=c):l>1e-6&&(this._+="A"+e+","+e+",0,"+ +(l>=Ii)+","+s+","+(this._x1=t+e*Math.cos(i))+","+(this._y1=n+e*Math.sin(i))))},rect:function(t,n,e,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +e+"v"+ +r+"h"+-e+"Z"},toString:function(){return this._}};function Ji(){}function Ki(t,n){var e=new Ji;if(t instanceof Ji)t.each(function(t,n){e.set(n,t)});else if(Array.isArray(t)){var r,i=-1,o=t.length;if(null==n)for(;++i<o;)e.set(i,t[i]);else for(;++i<o;)e.set(n(r=t[i],i,t),r)}else if(t)for(var a in t)e.set(a,t[a]);return e}function to(){return{}}function no(t,n,e){t[n]=e}function eo(){return Ki()}function ro(t,n,e){t.set(n,e)}function io(){}Ji.prototype=Ki.prototype={constructor:Ji,has:function(t){return"$"+t in this},get:function(t){return this["$"+t]},set:function(t,n){return this["$"+t]=n,this},remove:function(t){var n="$"+t;return n in this&&delete this[n]},clear:function(){for(var t in this)"$"===t[0]&&delete this[t]},keys:function(){var t=[];for(var n in this)"$"===n[0]&&t.push(n.slice(1));return t},values:function(){var t=[];for(var n in this)"$"===n[0]&&t.push(this[n]);return t},entries:function(){var t=[];for(var n in this)"$"===n[0]&&t.push({key:n.slice(1),value:this[n]});return t},size:function(){var t=0;for(var n in this)"$"===n[0]&&++t;return t},empty:function(){for(var t in this)if("$"===t[0])return!1;return!0},each:function(t){for(var n in this)"$"===n[0]&&t(this[n],n.slice(1),this)}};var oo=Ki.prototype;function ao(t,n){var e=new io;if(t instanceof io)t.each(function(t){e.add(t)});else if(t){var r=-1,i=t.length;if(null==n)for(;++r<i;)e.add(t[r]);else for(;++r<i;)e.add(n(t[r],r,t))}return e}io.prototype=ao.prototype={constructor:io,has:oo.has,add:function(t){return this["$"+(t+="")]=t,this},remove:oo.remove,clear:oo.clear,values:oo.keys,size:oo.size,empty:oo.empty,each:oo.each};var uo=Array.prototype.slice;function fo(t,n){return t-n}function co(t){return function(){return t}}function so(t,n){for(var e,r=-1,i=n.length;++r<i;)if(e=lo(t,n[r]))return e;return 0}function lo(t,n){for(var e=n[0],r=n[1],i=-1,o=0,a=t.length,u=a-1;o<a;u=o++){var f=t[o],c=f[0],s=f[1],l=t[u],h=l[0],d=l[1];if(ho(f,l,n))return 0;s>r!=d>r&&e<(h-c)*(r-s)/(d-s)+c&&(i=-i)}return i}function ho(t,n,e){var r,i,o,a;return function(t,n,e){return(n[0]-t[0])*(e[1]-t[1])==(e[0]-t[0])*(n[1]-t[1])}(t,n,e)&&(i=t[r=+(t[0]===n[0])],o=e[r],a=n[r],i<=o&&o<=a||a<=o&&o<=i)}function po(){}var vo=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function go(){var t=1,n=1,e=M,r=u;function i(t){var n=e(t);if(Array.isArray(n))n=n.slice().sort(fo);else{var r=s(t),i=r[0],a=r[1];n=w(i,a,n),n=g(Math.floor(i/n)*n,Math.floor(a/n)*n,n)}return n.map(function(n){return o(t,n)})}function o(e,i){var o=[],u=[];return function(e,r,i){var o,u,f,c,s,l,h=new Array,d=new Array;o=u=-1,c=e[0]>=r,vo[c<<1].forEach(p);for(;++o<t-1;)f=c,c=e[o+1]>=r,vo[f|c<<1].forEach(p);vo[c<<0].forEach(p);for(;++u<n-1;){for(o=-1,c=e[u*t+t]>=r,s=e[u*t]>=r,vo[c<<1|s<<2].forEach(p);++o<t-1;)f=c,c=e[u*t+t+o+1]>=r,l=s,s=e[u*t+o+1]>=r,vo[f|c<<1|s<<2|l<<3].forEach(p);vo[c|s<<3].forEach(p)}o=-1,s=e[u*t]>=r,vo[s<<2].forEach(p);for(;++o<t-1;)l=s,s=e[u*t+o+1]>=r,vo[s<<2|l<<3].forEach(p);function p(t){var n,e,r=[t[0][0]+o,t[0][1]+u],f=[t[1][0]+o,t[1][1]+u],c=a(r),s=a(f);(n=d[c])?(e=h[s])?(delete d[n.end],delete h[e.start],n===e?(n.ring.push(f),i(n.ring)):h[n.start]=d[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete d[n.end],n.ring.push(f),d[n.end=s]=n):(n=h[s])?(e=d[c])?(delete h[n.start],delete d[e.end],n===e?(n.ring.push(f),i(n.ring)):h[e.start]=d[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete h[n.start],n.ring.unshift(r),h[n.start=c]=n):h[c]=d[s]={start:c,end:s,ring:[r,f]}}vo[s<<3].forEach(p)}(e,i,function(t){r(t,e,i),function(t){for(var n=0,e=t.length,r=t[e-1][1]*t[0][0]-t[e-1][0]*t[0][1];++n<e;)r+=t[n-1][1]*t[n][0]-t[n-1][0]*t[n][1];return r}(t)>0?o.push([t]):u.push(t)}),u.forEach(function(t){for(var n,e=0,r=o.length;e<r;++e)if(-1!==so((n=o[e])[0],t))return void n.push(t)}),{type:"MultiPolygon",value:i,coordinates:o}}function a(n){return 2*n[0]+n[1]*(t+1)*4}function u(e,r,i){e.forEach(function(e){var o,a=e[0],u=e[1],f=0|a,c=0|u,s=r[c*t+f];a>0&&a<t&&f===a&&(o=r[c*t+f-1],e[0]=a+(i-o)/(s-o)-.5),u>0&&u<n&&c===u&&(o=r[(c-1)*t+f],e[1]=u+(i-o)/(s-o)-.5)})}return i.contour=o,i.size=function(e){if(!arguments.length)return[t,n];var r=Math.ceil(e[0]),o=Math.ceil(e[1]);if(!(r>0&&o>0))throw new Error("invalid size");return t=r,n=o,i},i.thresholds=function(t){return arguments.length?(e="function"==typeof t?t:Array.isArray(t)?co(uo.call(t)):co(t),i):e},i.smooth=function(t){return arguments.length?(r=t?u:po,i):r===u},i}function yo(t,n,e){for(var r=t.width,i=t.height,o=1+(e<<1),a=0;a<i;++a)for(var u=0,f=0;u<r+e;++u)u<r&&(f+=t.data[u+a*r]),u>=e&&(u>=o&&(f-=t.data[u-o+a*r]),n.data[u-e+a*r]=f/Math.min(u+1,r-1+o-u,o))}function _o(t,n,e){for(var r=t.width,i=t.height,o=1+(e<<1),a=0;a<r;++a)for(var u=0,f=0;u<i+e;++u)u<i&&(f+=t.data[a+u*r]),u>=e&&(u>=o&&(f-=t.data[a+(u-o)*r]),n.data[a+(u-e)*r]=f/Math.min(u+1,i-1+o-u,o))}function bo(t){return t[0]}function mo(t){return t[1]}function xo(){return 1}var wo={},Mo={},Ao=34,To=10,No=13;function So(t){return new Function("d","return {"+t.map(function(t,n){return JSON.stringify(t)+": d["+n+"]"}).join(",")+"}")}function Eo(t){var n=new RegExp('["'+t+"\n\r]"),e=t.charCodeAt(0);function r(t,n){var r,i=[],o=t.length,a=0,u=0,f=o<=0,c=!1;function s(){if(f)return Mo;if(c)return c=!1,wo;var n,r,i=a;if(t.charCodeAt(i)===Ao){for(;a++<o&&t.charCodeAt(a)!==Ao||t.charCodeAt(++a)===Ao;);return(n=a)>=o?f=!0:(r=t.charCodeAt(a++))===To?c=!0:r===No&&(c=!0,t.charCodeAt(a)===To&&++a),t.slice(i+1,n-1).replace(/""/g,'"')}for(;a<o;){if((r=t.charCodeAt(n=a++))===To)c=!0;else if(r===No)c=!0,t.charCodeAt(a)===To&&++a;else if(r!==e)continue;return t.slice(i,n)}return f=!0,t.slice(i,o)}for(t.charCodeAt(o-1)===To&&--o,t.charCodeAt(o-1)===No&&--o;(r=s())!==Mo;){for(var l=[];r!==wo&&r!==Mo;)l.push(r),r=s();n&&null==(l=n(l,u++))||i.push(l)}return i}function i(n){return n.map(o).join(t)}function o(t){return null==t?"":n.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,n){var e,i,o=r(t,function(t,r){if(e)return e(t,r-1);i=t,e=n?function(t,n){var e=So(t);return function(r,i){return n(e(r),i,t)}}(t,n):So(t)});return o.columns=i||[],o},parseRows:r,format:function(n,e){return null==e&&(e=function(t){var n=Object.create(null),e=[];return t.forEach(function(t){for(var r in t)r in n||e.push(n[r]=r)}),e}(n)),[e.map(o).join(t)].concat(n.map(function(n){return e.map(function(t){return o(n[t])}).join(t)})).join("\n")},formatRows:function(t){return t.map(i).join("\n")}}}var ko=Eo(","),Co=ko.parse,Po=ko.parseRows,zo=ko.format,Ro=ko.formatRows,Lo=Eo("\t"),Do=Lo.parse,Uo=Lo.parseRows,qo=Lo.format,Oo=Lo.formatRows;function Yo(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.blob()}function Bo(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.arrayBuffer()}function Fo(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}function Io(t,n){return fetch(t,n).then(Fo)}function Ho(t){return function(n,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=void 0),Io(n,e).then(function(n){return t(n,r)})}}var jo=Ho(Co),Xo=Ho(Do);function Go(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.json()}function Vo(t){return function(n,e){return Io(n,e).then(function(n){return(new DOMParser).parseFromString(n,t)})}}var $o=Vo("application/xml"),Wo=Vo("text/html"),Zo=Vo("image/svg+xml");function Qo(t){return function(){return t}}function Jo(){return 1e-6*(Math.random()-.5)}function Ko(t,n,e,r){if(isNaN(n)||isNaN(e))return t;var i,o,a,u,f,c,s,l,h,d=t._root,p={data:r},v=t._x0,g=t._y0,y=t._x1,_=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((c=n>=(o=(v+y)/2))?v=o:y=o,(s=e>=(a=(g+_)/2))?g=a:_=a,i=d,!(d=d[l=s<<1|c]))return i[l]=p,t;if(u=+t._x.call(null,d.data),f=+t._y.call(null,d.data),n===u&&e===f)return p.next=d,i?i[l]=p:t._root=p,t;do{i=i?i[l]=new Array(4):t._root=new Array(4),(c=n>=(o=(v+y)/2))?v=o:y=o,(s=e>=(a=(g+_)/2))?g=a:_=a}while((l=s<<1|c)==(h=(f>=a)<<1|u>=o));return i[h]=d,i[l]=p,t}function ta(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i}function na(t){return t[0]}function ea(t){return t[1]}function ra(t,n,e){var r=new ia(null==n?na:n,null==e?ea:e,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function ia(t,n,e,r,i,o){this._x=t,this._y=n,this._x0=e,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function oa(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}var aa=ra.prototype=ia.prototype;function ua(t){return t.x+t.vx}function fa(t){return t.y+t.vy}function ca(t){return t.index}function sa(t,n){var e=t.get(n);if(!e)throw new Error("missing: "+n);return e}function la(t){return t.x}function ha(t){return t.y}aa.copy=function(){var t,n,e=new ia(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return e;if(!r.length)return e._root=oa(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(4)}):r.target[i]=oa(n));return e},aa.add=function(t){var n=+this._x.call(null,t),e=+this._y.call(null,t);return Ko(this.cover(n,e),n,e,t)},aa.addAll=function(t){var n,e,r,i,o=t.length,a=new Array(o),u=new Array(o),f=1/0,c=1/0,s=-1/0,l=-1/0;for(e=0;e<o;++e)isNaN(r=+this._x.call(null,n=t[e]))||isNaN(i=+this._y.call(null,n))||(a[e]=r,u[e]=i,r<f&&(f=r),r>s&&(s=r),i<c&&(c=i),i>l&&(l=i));for(s<f&&(f=this._x0,s=this._x1),l<c&&(c=this._y0,l=this._y1),this.cover(f,c).cover(s,l),e=0;e<o;++e)Ko(this,a[e],u[e],t[e]);return this},aa.cover=function(t,n){if(isNaN(t=+t)||isNaN(n=+n))return this;var e=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(e))i=(e=Math.floor(t))+1,o=(r=Math.floor(n))+1;else{if(!(e>t||t>i||r>n||n>o))return this;var a,u,f=i-e,c=this._root;switch(u=(n<(r+o)/2)<<1|t<(e+i)/2){case 0:do{(a=new Array(4))[u]=c,c=a}while(o=r+(f*=2),t>(i=e+f)||n>o);break;case 1:do{(a=new Array(4))[u]=c,c=a}while(o=r+(f*=2),(e=i-f)>t||n>o);break;case 2:do{(a=new Array(4))[u]=c,c=a}while(r=o-(f*=2),t>(i=e+f)||r>n);break;case 3:do{(a=new Array(4))[u]=c,c=a}while(r=o-(f*=2),(e=i-f)>t||r>n)}this._root&&this._root.length&&(this._root=c)}return this._x0=e,this._y0=r,this._x1=i,this._y1=o,this},aa.data=function(){var t=[];return this.visit(function(n){if(!n.length)do{t.push(n.data)}while(n=n.next)}),t},aa.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},aa.find=function(t,n,e){var r,i,o,a,u,f,c,s=this._x0,l=this._y0,h=this._x1,d=this._y1,p=[],v=this._root;for(v&&p.push(new ta(v,s,l,h,d)),null==e?e=1/0:(s=t-e,l=n-e,h=t+e,d=n+e,e*=e);f=p.pop();)if(!(!(v=f.node)||(i=f.x0)>h||(o=f.y0)>d||(a=f.x1)<s||(u=f.y1)<l))if(v.length){var g=(i+a)/2,y=(o+u)/2;p.push(new ta(v[3],g,y,a,u),new ta(v[2],i,y,g,u),new ta(v[1],g,o,a,y),new ta(v[0],i,o,g,y)),(c=(n>=y)<<1|t>=g)&&(f=p[p.length-1],p[p.length-1]=p[p.length-1-c],p[p.length-1-c]=f)}else{var _=t-+this._x.call(null,v.data),b=n-+this._y.call(null,v.data),m=_*_+b*b;if(m<e){var x=Math.sqrt(e=m);s=t-x,l=n-x,h=t+x,d=n+x,r=v.data}}return r},aa.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var n,e,r,i,o,a,u,f,c,s,l,h,d=this._root,p=this._x0,v=this._y0,g=this._x1,y=this._y1;if(!d)return this;if(d.length)for(;;){if((c=o>=(u=(p+g)/2))?p=u:g=u,(s=a>=(f=(v+y)/2))?v=f:y=f,n=d,!(d=d[l=s<<1|c]))return this;if(!d.length)break;(n[l+1&3]||n[l+2&3]||n[l+3&3])&&(e=n,h=l)}for(;d.data!==t;)if(r=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,r?(i?r.next=i:delete r.next,this):n?(i?n[l]=i:delete n[l],(d=n[0]||n[1]||n[2]||n[3])&&d===(n[3]||n[2]||n[1]||n[0])&&!d.length&&(e?e[h]=d:this._root=d),this):(this._root=i,this)},aa.removeAll=function(t){for(var n=0,e=t.length;n<e;++n)this.remove(t[n]);return this},aa.root=function(){return this._root},aa.size=function(){var t=0;return this.visit(function(n){if(!n.length)do{++t}while(n=n.next)}),t},aa.visit=function(t){var n,e,r,i,o,a,u=[],f=this._root;for(f&&u.push(new ta(f,this._x0,this._y0,this._x1,this._y1));n=u.pop();)if(!t(f=n.node,r=n.x0,i=n.y0,o=n.x1,a=n.y1)&&f.length){var c=(r+o)/2,s=(i+a)/2;(e=f[3])&&u.push(new ta(e,c,s,o,a)),(e=f[2])&&u.push(new ta(e,r,s,c,a)),(e=f[1])&&u.push(new ta(e,c,i,o,s)),(e=f[0])&&u.push(new ta(e,r,i,c,s))}return this},aa.visitAfter=function(t){var n,e=[],r=[];for(this._root&&e.push(new ta(this._root,this._x0,this._y0,this._x1,this._y1));n=e.pop();){var i=n.node;if(i.length){var o,a=n.x0,u=n.y0,f=n.x1,c=n.y1,s=(a+f)/2,l=(u+c)/2;(o=i[0])&&e.push(new ta(o,a,u,s,l)),(o=i[1])&&e.push(new ta(o,s,u,f,l)),(o=i[2])&&e.push(new ta(o,a,l,s,c)),(o=i[3])&&e.push(new ta(o,s,l,f,c))}r.push(n)}for(;n=r.pop();)t(n.node,n.x0,n.y0,n.x1,n.y1);return this},aa.x=function(t){return arguments.length?(this._x=t,this):this._x},aa.y=function(t){return arguments.length?(this._y=t,this):this._y};var da=10,pa=Math.PI*(3-Math.sqrt(5));function va(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}function ga(t){return(t=va(Math.abs(t)))?t[1]:NaN}var ya,_a=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ba(t){return new ma(t)}function ma(t){if(!(n=_a.exec(t)))throw new Error("invalid format: "+t);var n;this.fill=n[1]||" ",this.align=n[2]||">",this.sign=n[3]||"-",this.symbol=n[4]||"",this.zero=!!n[5],this.width=n[6]&&+n[6],this.comma=!!n[7],this.precision=n[8]&&+n[8].slice(1),this.trim=!!n[9],this.type=n[10]||""}function xa(t,n){var e=va(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}ba.prototype=ma.prototype,ma.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var wa={"%":function(t,n){return(100*t).toFixed(n)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return xa(100*t,n)},r:xa,s:function(t,n){var e=va(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(ya=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+va(t,Math.max(0,n+o-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function Ma(t){return t}var Aa,Ta=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Na(t){var n,e,r=t.grouping&&t.thousands?(n=t.grouping,e=t.thousands,function(t,r){for(var i=t.length,o=[],a=0,u=n[0],f=0;i>0&&u>0&&(f+u+1>r&&(u=Math.max(1,r-f)),o.push(t.substring(i-=u,i+u)),!((f+=u+1)>r));)u=n[a=(a+1)%n.length];return o.reverse().join(e)}):Ma,i=t.currency,o=t.decimal,a=t.numerals?function(t){return function(n){return n.replace(/[0-9]/g,function(n){return t[+n]})}}(t.numerals):Ma,u=t.percent||"%";function f(t){var n=(t=ba(t)).fill,e=t.align,f=t.sign,c=t.symbol,s=t.zero,l=t.width,h=t.comma,d=t.precision,p=t.trim,v=t.type;"n"===v?(h=!0,v="g"):wa[v]||(null==d&&(d=12),p=!0,v="g"),(s||"0"===n&&"="===e)&&(s=!0,n="0",e="=");var g="$"===c?i[0]:"#"===c&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",y="$"===c?i[1]:/[%p]/.test(v)?u:"",_=wa[v],b=/[defgprs%]/.test(v);function m(t){var i,u,c,m=g,x=y;if("c"===v)x=_(t)+x,t="";else{var w=(t=+t)<0;if(t=_(Math.abs(t),d),p&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r<e;++r)switch(t[r]){case".":i=n=r;break;case"0":0===i&&(i=r),n=r;break;default:if(i>0){if(!+t[r])break t;i=0}}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),w&&0==+t&&(w=!1),m=(w?"("===f?f:"-":"-"===f||"("===f?"":f)+m,x=("s"===v?Ta[8+ya/3]:"")+x+(w&&"("===f?")":""),b)for(i=-1,u=t.length;++i<u;)if(48>(c=t.charCodeAt(i))||c>57){x=(46===c?o+t.slice(i+1):t.slice(i))+x,t=t.slice(0,i);break}}h&&!s&&(t=r(t,1/0));var M=m.length+t.length+x.length,A=M<l?new Array(l-M+1).join(n):"";switch(h&&s&&(t=r(A+t,A.length?l-x.length:1/0),A=""),e){case"<":t=m+t+x+A;break;case"=":t=m+A+t+x;break;case"^":t=A.slice(0,M=A.length>>1)+m+t+x+A.slice(M);break;default:t=A+m+t+x}return a(t)}return d=null==d?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,d)):Math.max(0,Math.min(20,d)),m.toString=function(){return t+""},m}return{format:f,formatPrefix:function(t,n){var e=f(((t=ba(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(ga(n)/3))),i=Math.pow(10,-r),o=Ta[8+r/3];return function(t){return e(i*t)+o}}}}function Sa(n){return Aa=Na(n),t.format=Aa.format,t.formatPrefix=Aa.formatPrefix,Aa}function Ea(t){return Math.max(0,-ga(Math.abs(t)))}function ka(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(ga(n)/3)))-ga(Math.abs(t)))}function Ca(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,ga(n)-ga(t))+1}function Pa(){return new za}function za(){this.reset()}Sa({decimal:".",thousands:",",grouping:[3],currency:["$",""]}),za.prototype={constructor:za,reset:function(){this.s=this.t=0},add:function(t){La(Ra,t,this.t),La(this,Ra.s,this.s),this.s?this.t+=Ra.t:this.s=Ra.t},valueOf:function(){return this.s}};var Ra=new za;function La(t,n,e){var r=t.s=n+e,i=r-n,o=r-i;t.t=n-o+(e-i)}var Da=1e-6,Ua=1e-12,qa=Math.PI,Oa=qa/2,Ya=qa/4,Ba=2*qa,Fa=180/qa,Ia=qa/180,Ha=Math.abs,ja=Math.atan,Xa=Math.atan2,Ga=Math.cos,Va=Math.ceil,$a=Math.exp,Wa=Math.log,Za=Math.pow,Qa=Math.sin,Ja=Math.sign||function(t){return t>0?1:t<0?-1:0},Ka=Math.sqrt,tu=Math.tan;function nu(t){return t>1?0:t<-1?qa:Math.acos(t)}function eu(t){return t>1?Oa:t<-1?-Oa:Math.asin(t)}function ru(t){return(t=Qa(t/2))*t}function iu(){}function ou(t,n){t&&uu.hasOwnProperty(t.type)&&uu[t.type](t,n)}var au={Feature:function(t,n){ou(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r<i;)ou(e[r].geometry,n)}},uu={Sphere:function(t,n){n.sphere()},Point:function(t,n){t=t.coordinates,n.point(t[0],t[1],t[2])},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)t=e[r],n.point(t[0],t[1],t[2])},LineString:function(t,n){fu(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)fu(e[r],n,0)},Polygon:function(t,n){cu(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)cu(e[r],n)},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,i=e.length;++r<i;)ou(e[r],n)}};function fu(t,n,e){var r,i=-1,o=t.length-e;for(n.lineStart();++i<o;)r=t[i],n.point(r[0],r[1],r[2]);n.lineEnd()}function cu(t,n){var e=-1,r=t.length;for(n.polygonStart();++e<r;)fu(t[e],n,1);n.polygonEnd()}function su(t,n){t&&au.hasOwnProperty(t.type)?au[t.type](t,n):ou(t,n)}var lu,hu,du,pu,vu,gu=Pa(),yu=Pa(),_u={point:iu,lineStart:iu,lineEnd:iu,polygonStart:function(){gu.reset(),_u.lineStart=bu,_u.lineEnd=mu},polygonEnd:function(){var t=+gu;yu.add(t<0?Ba+t:t),this.lineStart=this.lineEnd=this.point=iu},sphere:function(){yu.add(Ba)}};function bu(){_u.point=xu}function mu(){wu(lu,hu)}function xu(t,n){_u.point=wu,lu=t,hu=n,du=t*=Ia,pu=Ga(n=(n*=Ia)/2+Ya),vu=Qa(n)}function wu(t,n){var e=(t*=Ia)-du,r=e>=0?1:-1,i=r*e,o=Ga(n=(n*=Ia)/2+Ya),a=Qa(n),u=vu*a,f=pu*o+u*Ga(i),c=u*r*Qa(i);gu.add(Xa(c,f)),du=t,pu=o,vu=a}function Mu(t){return[Xa(t[1],t[0]),eu(t[2])]}function Au(t){var n=t[0],e=t[1],r=Ga(e);return[r*Ga(n),r*Qa(n),Qa(e)]}function Tu(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function Nu(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function Su(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function Eu(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function ku(t){var n=Ka(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}var Cu,Pu,zu,Ru,Lu,Du,Uu,qu,Ou,Yu,Bu,Fu,Iu,Hu,ju,Xu,Gu,Vu,$u,Wu,Zu,Qu,Ju,Ku,tf,nf,ef=Pa(),rf={point:of,lineStart:uf,lineEnd:ff,polygonStart:function(){rf.point=cf,rf.lineStart=sf,rf.lineEnd=lf,ef.reset(),_u.polygonStart()},polygonEnd:function(){_u.polygonEnd(),rf.point=of,rf.lineStart=uf,rf.lineEnd=ff,gu<0?(Cu=-(zu=180),Pu=-(Ru=90)):ef>Da?Ru=90:ef<-Da&&(Pu=-90),Yu[0]=Cu,Yu[1]=zu}};function of(t,n){Ou.push(Yu=[Cu=t,zu=t]),n<Pu&&(Pu=n),n>Ru&&(Ru=n)}function af(t,n){var e=Au([t*Ia,n*Ia]);if(qu){var r=Nu(qu,e),i=Nu([r[1],-r[0],0],r);ku(i),i=Mu(i);var o,a=t-Lu,u=a>0?1:-1,f=i[0]*Fa*u,c=Ha(a)>180;c^(u*Lu<f&&f<u*t)?(o=i[1]*Fa)>Ru&&(Ru=o):c^(u*Lu<(f=(f+360)%360-180)&&f<u*t)?(o=-i[1]*Fa)<Pu&&(Pu=o):(n<Pu&&(Pu=n),n>Ru&&(Ru=n)),c?t<Lu?hf(Cu,t)>hf(Cu,zu)&&(zu=t):hf(t,zu)>hf(Cu,zu)&&(Cu=t):zu>=Cu?(t<Cu&&(Cu=t),t>zu&&(zu=t)):t>Lu?hf(Cu,t)>hf(Cu,zu)&&(zu=t):hf(t,zu)>hf(Cu,zu)&&(Cu=t)}else Ou.push(Yu=[Cu=t,zu=t]);n<Pu&&(Pu=n),n>Ru&&(Ru=n),qu=e,Lu=t}function uf(){rf.point=af}function ff(){Yu[0]=Cu,Yu[1]=zu,rf.point=of,qu=null}function cf(t,n){if(qu){var e=t-Lu;ef.add(Ha(e)>180?e+(e>0?360:-360):e)}else Du=t,Uu=n;_u.point(t,n),af(t,n)}function sf(){_u.lineStart()}function lf(){cf(Du,Uu),_u.lineEnd(),Ha(ef)>Da&&(Cu=-(zu=180)),Yu[0]=Cu,Yu[1]=zu,qu=null}function hf(t,n){return(n-=t)<0?n+360:n}function df(t,n){return t[0]-n[0]}function pf(t,n){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:n<t[0]||t[1]<n}var vf={sphere:iu,point:gf,lineStart:_f,lineEnd:xf,polygonStart:function(){vf.lineStart=wf,vf.lineEnd=Mf},polygonEnd:function(){vf.lineStart=_f,vf.lineEnd=xf}};function gf(t,n){t*=Ia;var e=Ga(n*=Ia);yf(e*Ga(t),e*Qa(t),Qa(n))}function yf(t,n,e){Iu+=(t-Iu)/++Bu,Hu+=(n-Hu)/Bu,ju+=(e-ju)/Bu}function _f(){vf.point=bf}function bf(t,n){t*=Ia;var e=Ga(n*=Ia);Ku=e*Ga(t),tf=e*Qa(t),nf=Qa(n),vf.point=mf,yf(Ku,tf,nf)}function mf(t,n){t*=Ia;var e=Ga(n*=Ia),r=e*Ga(t),i=e*Qa(t),o=Qa(n),a=Xa(Ka((a=tf*o-nf*i)*a+(a=nf*r-Ku*o)*a+(a=Ku*i-tf*r)*a),Ku*r+tf*i+nf*o);Fu+=a,Xu+=a*(Ku+(Ku=r)),Gu+=a*(tf+(tf=i)),Vu+=a*(nf+(nf=o)),yf(Ku,tf,nf)}function xf(){vf.point=gf}function wf(){vf.point=Af}function Mf(){Tf(Qu,Ju),vf.point=gf}function Af(t,n){Qu=t,Ju=n,t*=Ia,n*=Ia,vf.point=Tf;var e=Ga(n);Ku=e*Ga(t),tf=e*Qa(t),nf=Qa(n),yf(Ku,tf,nf)}function Tf(t,n){t*=Ia;var e=Ga(n*=Ia),r=e*Ga(t),i=e*Qa(t),o=Qa(n),a=tf*o-nf*i,u=nf*r-Ku*o,f=Ku*i-tf*r,c=Ka(a*a+u*u+f*f),s=eu(c),l=c&&-s/c;$u+=l*a,Wu+=l*u,Zu+=l*f,Fu+=s,Xu+=s*(Ku+(Ku=r)),Gu+=s*(tf+(tf=i)),Vu+=s*(nf+(nf=o)),yf(Ku,tf,nf)}function Nf(t){return function(){return t}}function Sf(t,n){function e(e,r){return e=t(e,r),n(e[0],e[1])}return t.invert&&n.invert&&(e.invert=function(e,r){return(e=n.invert(e,r))&&t.invert(e[0],e[1])}),e}function Ef(t,n){return[t>qa?t-Ba:t<-qa?t+Ba:t,n]}function kf(t,n,e){return(t%=Ba)?n||e?Sf(Pf(t),zf(n,e)):Pf(t):n||e?zf(n,e):Ef}function Cf(t){return function(n,e){return[(n+=t)>qa?n-Ba:n<-qa?n+Ba:n,e]}}function Pf(t){var n=Cf(t);return n.invert=Cf(-t),n}function zf(t,n){var e=Ga(t),r=Qa(t),i=Ga(n),o=Qa(n);function a(t,n){var a=Ga(n),u=Ga(t)*a,f=Qa(t)*a,c=Qa(n),s=c*e+u*r;return[Xa(f*i-s*o,u*e-c*r),eu(s*i+f*o)]}return a.invert=function(t,n){var a=Ga(n),u=Ga(t)*a,f=Qa(t)*a,c=Qa(n),s=c*i-f*o;return[Xa(f*i+c*o,u*e+s*r),eu(s*e-u*r)]},a}function Rf(t){function n(n){return(n=t(n[0]*Ia,n[1]*Ia))[0]*=Fa,n[1]*=Fa,n}return t=kf(t[0]*Ia,t[1]*Ia,t.length>2?t[2]*Ia:0),n.invert=function(n){return(n=t.invert(n[0]*Ia,n[1]*Ia))[0]*=Fa,n[1]*=Fa,n},n}function Lf(t,n,e,r,i,o){if(e){var a=Ga(n),u=Qa(n),f=r*e;null==i?(i=n+r*Ba,o=n-f/2):(i=Df(a,i),o=Df(a,o),(r>0?i<o:i>o)&&(i+=r*Ba));for(var c,s=i;r>0?s>o:s<o;s-=f)c=Mu([a,-u*Ga(s),-u*Qa(s)]),t.point(c[0],c[1])}}function Df(t,n){(n=Au(n))[0]-=t,ku(n);var e=nu(-n[1]);return((-n[2]<0?-e:e)+Ba-Da)%Ba}function Uf(){var t,n=[];return{point:function(n,e){t.push([n,e])},lineStart:function(){n.push(t=[])},lineEnd:iu,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function qf(t,n){return Ha(t[0]-n[0])<Da&&Ha(t[1]-n[1])<Da}function Of(t,n,e,r){this.x=t,this.z=n,this.o=e,this.e=r,this.v=!1,this.n=this.p=null}function Yf(t,n,e,r,i){var o,a,u=[],f=[];if(t.forEach(function(t){if(!((n=t.length-1)<=0)){var n,e,r=t[0],a=t[n];if(qf(r,a)){for(i.lineStart(),o=0;o<n;++o)i.point((r=t[o])[0],r[1]);i.lineEnd()}else u.push(e=new Of(r,t,null,!0)),f.push(e.o=new Of(r,null,e,!1)),u.push(e=new Of(a,t,null,!1)),f.push(e.o=new Of(a,null,e,!0))}}),u.length){for(f.sort(n),Bf(u),Bf(f),o=0,a=f.length;o<a;++o)f[o].e=e=!e;for(var c,s,l=u[0];;){for(var h=l,d=!0;h.v;)if((h=h.n)===l)return;c=h.z,i.lineStart();do{if(h.v=h.o.v=!0,h.e){if(d)for(o=0,a=c.length;o<a;++o)i.point((s=c[o])[0],s[1]);else r(h.x,h.n.x,1,i);h=h.n}else{if(d)for(c=h.p.z,o=c.length-1;o>=0;--o)i.point((s=c[o])[0],s[1]);else r(h.x,h.p.x,-1,i);h=h.p}c=(h=h.o).z,d=!d}while(!h.v);i.lineEnd()}}}function Bf(t){if(n=t.length){for(var n,e,r=0,i=t[0];++r<n;)i.n=e=t[r],e.p=i,i=e;i.n=e=t[0],e.p=i}}Ef.invert=Ef;var Ff=Pa();function If(t,n){var e=n[0],r=n[1],i=Qa(r),o=[Qa(e),-Ga(e),0],a=0,u=0;Ff.reset(),1===i?r=Oa+Da:-1===i&&(r=-Oa-Da);for(var f=0,c=t.length;f<c;++f)if(l=(s=t[f]).length)for(var s,l,h=s[l-1],d=h[0],p=h[1]/2+Ya,v=Qa(p),g=Ga(p),y=0;y<l;++y,d=b,v=x,g=w,h=_){var _=s[y],b=_[0],m=_[1]/2+Ya,x=Qa(m),w=Ga(m),M=b-d,A=M>=0?1:-1,T=A*M,N=T>qa,S=v*x;if(Ff.add(Xa(S*A*Qa(T),g*w+S*Ga(T))),a+=N?M+A*Ba:M,N^d>=e^b>=e){var E=Nu(Au(h),Au(_));ku(E);var k=Nu(o,E);ku(k);var C=(N^M>=0?-1:1)*eu(k[2]);(r>C||r===C&&(E[0]||E[1]))&&(u+=N^M>=0?1:-1)}}return(a<-Da||a<Da&&Ff<-Da)^1&u}function Hf(t,n,e,r){return function(i){var o,a,u,f=n(i),c=Uf(),s=n(c),l=!1,h={point:d,lineStart:v,lineEnd:g,polygonStart:function(){h.point=y,h.lineStart=_,h.lineEnd=b,a=[],o=[]},polygonEnd:function(){h.point=d,h.lineStart=v,h.lineEnd=g,a=N(a);var t=If(o,r);a.length?(l||(i.polygonStart(),l=!0),Yf(a,Xf,t,e,i)):t&&(l||(i.polygonStart(),l=!0),i.lineStart(),e(null,null,1,i),i.lineEnd()),l&&(i.polygonEnd(),l=!1),a=o=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function d(n,e){t(n,e)&&i.point(n,e)}function p(t,n){f.point(t,n)}function v(){h.point=p,f.lineStart()}function g(){h.point=d,f.lineEnd()}function y(t,n){u.push([t,n]),s.point(t,n)}function _(){s.lineStart(),u=[]}function b(){y(u[0][0],u[0][1]),s.lineEnd();var t,n,e,r,f=s.clean(),h=c.result(),d=h.length;if(u.pop(),o.push(u),u=null,d)if(1&f){if((n=(e=h[0]).length-1)>0){for(l||(i.polygonStart(),l=!0),i.lineStart(),t=0;t<n;++t)i.point((r=e[t])[0],r[1]);i.lineEnd()}}else d>1&&2&f&&h.push(h.pop().concat(h.shift())),a.push(h.filter(jf))}return h}}function jf(t){return t.length>1}function Xf(t,n){return((t=t.x)[0]<0?t[1]-Oa-Da:Oa-t[1])-((n=n.x)[0]<0?n[1]-Oa-Da:Oa-n[1])}var Gf=Hf(function(){return!0},function(t){var n,e=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),n=1},point:function(o,a){var u=o>0?qa:-qa,f=Ha(o-e);Ha(f-qa)<Da?(t.point(e,r=(r+a)/2>0?Oa:-Oa),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),t.point(o,r),n=0):i!==u&&f>=qa&&(Ha(e-i)<Da&&(e-=i*Da),Ha(o-u)<Da&&(o-=u*Da),r=function(t,n,e,r){var i,o,a=Qa(t-e);return Ha(a)>Da?ja((Qa(n)*(o=Ga(r))*Qa(e)-Qa(r)*(i=Ga(n))*Qa(t))/(i*o*a)):(n+r)/2}(e,r,o,a),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),n=0),t.point(e=o,r=a),i=u},lineEnd:function(){t.lineEnd(),e=r=NaN},clean:function(){return 2-n}}},function(t,n,e,r){var i;if(null==t)i=e*Oa,r.point(-qa,i),r.point(0,i),r.point(qa,i),r.point(qa,0),r.point(qa,-i),r.point(0,-i),r.point(-qa,-i),r.point(-qa,0),r.point(-qa,i);else if(Ha(t[0]-n[0])>Da){var o=t[0]<n[0]?qa:-qa;i=e*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(n[0],n[1])},[-qa,-Oa]);function Vf(t){var n=Ga(t),e=6*Ia,r=n>0,i=Ha(n)>Da;function o(t,e){return Ga(t)*Ga(e)>n}function a(t,e,r){var i=[1,0,0],o=Nu(Au(t),Au(e)),a=Tu(o,o),u=o[0],f=a-u*u;if(!f)return!r&&t;var c=n*a/f,s=-n*u/f,l=Nu(i,o),h=Eu(i,c);Su(h,Eu(o,s));var d=l,p=Tu(h,d),v=Tu(d,d),g=p*p-v*(Tu(h,h)-1);if(!(g<0)){var y=Ka(g),_=Eu(d,(-p-y)/v);if(Su(_,h),_=Mu(_),!r)return _;var b,m=t[0],x=e[0],w=t[1],M=e[1];x<m&&(b=m,m=x,x=b);var A=x-m,T=Ha(A-qa)<Da;if(!T&&M<w&&(b=w,w=M,M=b),T||A<Da?T?w+M>0^_[1]<(Ha(_[0]-m)<Da?w:M):w<=_[1]&&_[1]<=M:A>qa^(m<=_[0]&&_[0]<=x)){var N=Eu(d,(-p+y)/v);return Su(N,h),[_,Mu(N)]}}}function u(n,e){var i=r?t:qa-t,o=0;return n<-i?o|=1:n>i&&(o|=2),e<-i?o|=4:e>i&&(o|=8),o}return Hf(o,function(t){var n,e,f,c,s;return{lineStart:function(){c=f=!1,s=1},point:function(l,h){var d,p=[l,h],v=o(l,h),g=r?v?0:u(l,h):v?u(l+(l<0?qa:-qa),h):0;if(!n&&(c=f=v)&&t.lineStart(),v!==f&&(!(d=a(n,p))||qf(n,d)||qf(p,d))&&(p[0]+=Da,p[1]+=Da,v=o(p[0],p[1])),v!==f)s=0,v?(t.lineStart(),d=a(p,n),t.point(d[0],d[1])):(d=a(n,p),t.point(d[0],d[1]),t.lineEnd()),n=d;else if(i&&n&&r^v){var y;g&e||!(y=a(p,n,!0))||(s=0,r?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1])))}!v||n&&qf(n,p)||t.point(p[0],p[1]),n=p,f=v,e=g},lineEnd:function(){f&&t.lineEnd(),n=null},clean:function(){return s|(c&&f)<<1}}},function(n,r,i,o){Lf(o,t,e,i,n,r)},r?[0,-t]:[-qa,t-qa])}var $f=1e9,Wf=-$f;function Zf(t,n,e,r){function i(i,o){return t<=i&&i<=e&&n<=o&&o<=r}function o(i,o,u,c){var s=0,l=0;if(null==i||(s=a(i,u))!==(l=a(o,u))||f(i,o)<0^u>0)do{c.point(0===s||3===s?t:e,s>1?r:n)}while((s=(s+u+4)%4)!==l);else c.point(o[0],o[1])}function a(r,i){return Ha(r[0]-t)<Da?i>0?0:3:Ha(r[0]-e)<Da?i>0?2:1:Ha(r[1]-n)<Da?i>0?1:0:i>0?3:2}function u(t,n){return f(t.x,n.x)}function f(t,n){var e=a(t,1),r=a(n,1);return e!==r?e-r:0===e?n[1]-t[1]:1===e?t[0]-n[0]:2===e?t[1]-n[1]:n[0]-t[0]}return function(a){var f,c,s,l,h,d,p,v,g,y,_,b=a,m=Uf(),x={point:w,lineStart:function(){x.point=M,c&&c.push(s=[]);y=!0,g=!1,p=v=NaN},lineEnd:function(){f&&(M(l,h),d&&g&&m.rejoin(),f.push(m.result()));x.point=w,g&&b.lineEnd()},polygonStart:function(){b=m,f=[],c=[],_=!0},polygonEnd:function(){var n=function(){for(var n=0,e=0,i=c.length;e<i;++e)for(var o,a,u=c[e],f=1,s=u.length,l=u[0],h=l[0],d=l[1];f<s;++f)o=h,a=d,l=u[f],h=l[0],d=l[1],a<=r?d>r&&(h-o)*(r-a)>(d-a)*(t-o)&&++n:d<=r&&(h-o)*(r-a)<(d-a)*(t-o)&&--n;return n}(),e=_&&n,i=(f=N(f)).length;(e||i)&&(a.polygonStart(),e&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&Yf(f,u,n,o,a),a.polygonEnd());b=a,f=c=s=null}};function w(t,n){i(t,n)&&b.point(t,n)}function M(o,a){var u=i(o,a);if(c&&s.push([o,a]),y)l=o,h=a,d=u,y=!1,u&&(b.lineStart(),b.point(o,a));else if(u&&g)b.point(o,a);else{var f=[p=Math.max(Wf,Math.min($f,p)),v=Math.max(Wf,Math.min($f,v))],m=[o=Math.max(Wf,Math.min($f,o)),a=Math.max(Wf,Math.min($f,a))];!function(t,n,e,r,i,o){var a,u=t[0],f=t[1],c=0,s=1,l=n[0]-u,h=n[1]-f;if(a=e-u,l||!(a>0)){if(a/=l,l<0){if(a<c)return;a<s&&(s=a)}else if(l>0){if(a>s)return;a>c&&(c=a)}if(a=i-u,l||!(a<0)){if(a/=l,l<0){if(a>s)return;a>c&&(c=a)}else if(l>0){if(a<c)return;a<s&&(s=a)}if(a=r-f,h||!(a>0)){if(a/=h,h<0){if(a<c)return;a<s&&(s=a)}else if(h>0){if(a>s)return;a>c&&(c=a)}if(a=o-f,h||!(a<0)){if(a/=h,h<0){if(a>s)return;a>c&&(c=a)}else if(h>0){if(a<c)return;a<s&&(s=a)}return c>0&&(t[0]=u+c*l,t[1]=f+c*h),s<1&&(n[0]=u+s*l,n[1]=f+s*h),!0}}}}}(f,m,t,n,e,r)?u&&(b.lineStart(),b.point(o,a),_=!1):(g||(b.lineStart(),b.point(f[0],f[1])),b.point(m[0],m[1]),u||b.lineEnd(),_=!1)}p=o,v=a,g=u}return x}}var Qf,Jf,Kf,tc=Pa(),nc={sphere:iu,point:iu,lineStart:function(){nc.point=rc,nc.lineEnd=ec},lineEnd:iu,polygonStart:iu,polygonEnd:iu};function ec(){nc.point=nc.lineEnd=iu}function rc(t,n){Qf=t*=Ia,Jf=Qa(n*=Ia),Kf=Ga(n),nc.point=ic}function ic(t,n){t*=Ia;var e=Qa(n*=Ia),r=Ga(n),i=Ha(t-Qf),o=Ga(i),a=r*Qa(i),u=Kf*e-Jf*r*o,f=Jf*e+Kf*r*o;tc.add(Xa(Ka(a*a+u*u),f)),Qf=t,Jf=e,Kf=r}function oc(t){return tc.reset(),su(t,nc),+tc}var ac=[null,null],uc={type:"LineString",coordinates:ac};function fc(t,n){return ac[0]=t,ac[1]=n,oc(uc)}var cc={Feature:function(t,n){return lc(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r<i;)if(lc(e[r].geometry,n))return!0;return!1}},sc={Sphere:function(){return!0},Point:function(t,n){return hc(t.coordinates,n)},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)if(hc(e[r],n))return!0;return!1},LineString:function(t,n){return dc(t.coordinates,n)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)if(dc(e[r],n))return!0;return!1},Polygon:function(t,n){return pc(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)if(pc(e[r],n))return!0;return!1},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,i=e.length;++r<i;)if(lc(e[r],n))return!0;return!1}};function lc(t,n){return!(!t||!sc.hasOwnProperty(t.type))&&sc[t.type](t,n)}function hc(t,n){return 0===fc(t,n)}function dc(t,n){var e=fc(t[0],t[1]);return fc(t[0],n)+fc(n,t[1])<=e+Da}function pc(t,n){return!!If(t.map(vc),gc(n))}function vc(t){return(t=t.map(gc)).pop(),t}function gc(t){return[t[0]*Ia,t[1]*Ia]}function yc(t,n,e){var r=g(t,n-Da,e).concat(n);return function(t){return r.map(function(n){return[t,n]})}}function _c(t,n,e){var r=g(t,n-Da,e).concat(n);return function(t){return r.map(function(n){return[n,t]})}}function bc(){var t,n,e,r,i,o,a,u,f,c,s,l,h=10,d=h,p=90,v=360,y=2.5;function _(){return{type:"MultiLineString",coordinates:b()}}function b(){return g(Va(r/p)*p,e,p).map(s).concat(g(Va(u/v)*v,a,v).map(l)).concat(g(Va(n/h)*h,t,h).filter(function(t){return Ha(t%p)>Da}).map(f)).concat(g(Va(o/d)*d,i,d).filter(function(t){return Ha(t%v)>Da}).map(c))}return _.lines=function(){return b().map(function(t){return{type:"LineString",coordinates:t}})},_.outline=function(){return{type:"Polygon",coordinates:[s(r).concat(l(a).slice(1),s(e).reverse().slice(1),l(u).reverse().slice(1))]}},_.extent=function(t){return arguments.length?_.extentMajor(t).extentMinor(t):_.extentMinor()},_.extentMajor=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],u=+t[0][1],a=+t[1][1],r>e&&(t=r,r=e,e=t),u>a&&(t=u,u=a,a=t),_.precision(y)):[[r,u],[e,a]]},_.extentMinor=function(e){return arguments.length?(n=+e[0][0],t=+e[1][0],o=+e[0][1],i=+e[1][1],n>t&&(e=n,n=t,t=e),o>i&&(e=o,o=i,i=e),_.precision(y)):[[n,o],[t,i]]},_.step=function(t){return arguments.length?_.stepMajor(t).stepMinor(t):_.stepMinor()},_.stepMajor=function(t){return arguments.length?(p=+t[0],v=+t[1],_):[p,v]},_.stepMinor=function(t){return arguments.length?(h=+t[0],d=+t[1],_):[h,d]},_.precision=function(h){return arguments.length?(y=+h,f=yc(o,i,90),c=_c(n,t,y),s=yc(u,a,90),l=_c(r,e,y),_):y},_.extentMajor([[-180,-90+Da],[180,90-Da]]).extentMinor([[-180,-80-Da],[180,80+Da]])}function mc(t){return t}var xc,wc,Mc,Ac,Tc=Pa(),Nc=Pa(),Sc={point:iu,lineStart:iu,lineEnd:iu,polygonStart:function(){Sc.lineStart=Ec,Sc.lineEnd=Pc},polygonEnd:function(){Sc.lineStart=Sc.lineEnd=Sc.point=iu,Tc.add(Ha(Nc)),Nc.reset()},result:function(){var t=Tc/2;return Tc.reset(),t}};function Ec(){Sc.point=kc}function kc(t,n){Sc.point=Cc,xc=Mc=t,wc=Ac=n}function Cc(t,n){Nc.add(Ac*t-Mc*n),Mc=t,Ac=n}function Pc(){Cc(xc,wc)}var zc=1/0,Rc=zc,Lc=-zc,Dc=Lc,Uc={point:function(t,n){t<zc&&(zc=t);t>Lc&&(Lc=t);n<Rc&&(Rc=n);n>Dc&&(Dc=n)},lineStart:iu,lineEnd:iu,polygonStart:iu,polygonEnd:iu,result:function(){var t=[[zc,Rc],[Lc,Dc]];return Lc=Dc=-(Rc=zc=1/0),t}};var qc,Oc,Yc,Bc,Fc=0,Ic=0,Hc=0,jc=0,Xc=0,Gc=0,Vc=0,$c=0,Wc=0,Zc={point:Qc,lineStart:Jc,lineEnd:ns,polygonStart:function(){Zc.lineStart=es,Zc.lineEnd=rs},polygonEnd:function(){Zc.point=Qc,Zc.lineStart=Jc,Zc.lineEnd=ns},result:function(){var t=Wc?[Vc/Wc,$c/Wc]:Gc?[jc/Gc,Xc/Gc]:Hc?[Fc/Hc,Ic/Hc]:[NaN,NaN];return Fc=Ic=Hc=jc=Xc=Gc=Vc=$c=Wc=0,t}};function Qc(t,n){Fc+=t,Ic+=n,++Hc}function Jc(){Zc.point=Kc}function Kc(t,n){Zc.point=ts,Qc(Yc=t,Bc=n)}function ts(t,n){var e=t-Yc,r=n-Bc,i=Ka(e*e+r*r);jc+=i*(Yc+t)/2,Xc+=i*(Bc+n)/2,Gc+=i,Qc(Yc=t,Bc=n)}function ns(){Zc.point=Qc}function es(){Zc.point=is}function rs(){os(qc,Oc)}function is(t,n){Zc.point=os,Qc(qc=Yc=t,Oc=Bc=n)}function os(t,n){var e=t-Yc,r=n-Bc,i=Ka(e*e+r*r);jc+=i*(Yc+t)/2,Xc+=i*(Bc+n)/2,Gc+=i,Vc+=(i=Bc*t-Yc*n)*(Yc+t),$c+=i*(Bc+n),Wc+=3*i,Qc(Yc=t,Bc=n)}function as(t){this._context=t}as.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,n){switch(this._point){case 0:this._context.moveTo(t,n),this._point=1;break;case 1:this._context.lineTo(t,n);break;default:this._context.moveTo(t+this._radius,n),this._context.arc(t,n,this._radius,0,Ba)}},result:iu};var us,fs,cs,ss,ls,hs=Pa(),ds={point:iu,lineStart:function(){ds.point=ps},lineEnd:function(){us&&vs(fs,cs),ds.point=iu},polygonStart:function(){us=!0},polygonEnd:function(){us=null},result:function(){var t=+hs;return hs.reset(),t}};function ps(t,n){ds.point=vs,fs=ss=t,cs=ls=n}function vs(t,n){ss-=t,ls-=n,hs.add(Ka(ss*ss+ls*ls)),ss=t,ls=n}function gs(){this._string=[]}function ys(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function _s(t){return function(n){var e=new bs;for(var r in t)e[r]=t[r];return e.stream=n,e}}function bs(){}function ms(t,n,e){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),su(e,t.stream(Uc)),n(Uc.result()),null!=r&&t.clipExtent(r),t}function xs(t,n,e){return ms(t,function(e){var r=n[1][0]-n[0][0],i=n[1][1]-n[0][1],o=Math.min(r/(e[1][0]-e[0][0]),i/(e[1][1]-e[0][1])),a=+n[0][0]+(r-o*(e[1][0]+e[0][0]))/2,u=+n[0][1]+(i-o*(e[1][1]+e[0][1]))/2;t.scale(150*o).translate([a,u])},e)}function ws(t,n,e){return xs(t,[[0,0],n],e)}function Ms(t,n,e){return ms(t,function(e){var r=+n,i=r/(e[1][0]-e[0][0]),o=(r-i*(e[1][0]+e[0][0]))/2,a=-i*e[0][1];t.scale(150*i).translate([o,a])},e)}function As(t,n,e){return ms(t,function(e){var r=+n,i=r/(e[1][1]-e[0][1]),o=-i*e[0][0],a=(r-i*(e[1][1]+e[0][1]))/2;t.scale(150*i).translate([o,a])},e)}gs.prototype={_radius:4.5,_circle:ys(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,n){switch(this._point){case 0:this._string.push("M",t,",",n),this._point=1;break;case 1:this._string.push("L",t,",",n);break;default:null==this._circle&&(this._circle=ys(this._radius)),this._string.push("M",t,",",n,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},bs.prototype={constructor:bs,point:function(t,n){this.stream.point(t,n)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Ts=16,Ns=Ga(30*Ia);function Ss(t,n){return+n?function(t,n){function e(r,i,o,a,u,f,c,s,l,h,d,p,v,g){var y=c-r,_=s-i,b=y*y+_*_;if(b>4*n&&v--){var m=a+h,x=u+d,w=f+p,M=Ka(m*m+x*x+w*w),A=eu(w/=M),T=Ha(Ha(w)-1)<Da||Ha(o-l)<Da?(o+l)/2:Xa(x,m),N=t(T,A),S=N[0],E=N[1],k=S-r,C=E-i,P=_*k-y*C;(P*P/b>n||Ha((y*k+_*C)/b-.5)>.3||a*h+u*d+f*p<Ns)&&(e(r,i,o,a,u,f,S,E,T,m/=M,x/=M,w,v,g),g.point(S,E),e(S,E,T,m,x,w,c,s,l,h,d,p,v,g))}}return function(n){var r,i,o,a,u,f,c,s,l,h,d,p,v={point:g,lineStart:y,lineEnd:b,polygonStart:function(){n.polygonStart(),v.lineStart=m},polygonEnd:function(){n.polygonEnd(),v.lineStart=y}};function g(e,r){e=t(e,r),n.point(e[0],e[1])}function y(){s=NaN,v.point=_,n.lineStart()}function _(r,i){var o=Au([r,i]),a=t(r,i);e(s,l,c,h,d,p,s=a[0],l=a[1],c=r,h=o[0],d=o[1],p=o[2],Ts,n),n.point(s,l)}function b(){v.point=g,n.lineEnd()}function m(){y(),v.point=x,v.lineEnd=w}function x(t,n){_(r=t,n),i=s,o=l,a=h,u=d,f=p,v.point=_}function w(){e(s,l,c,h,d,p,i,o,r,a,u,f,Ts,n),v.lineEnd=b,b()}return v}}(t,n):function(t){return _s({point:function(n,e){n=t(n,e),this.stream.point(n[0],n[1])}})}(t)}var Es=_s({point:function(t,n){this.stream.point(t*Ia,n*Ia)}});function ks(t,n,e,r){var i=Ga(r),o=Qa(r),a=i*t,u=o*t,f=i/t,c=o/t,s=(o*e-i*n)/t,l=(o*n+i*e)/t;function h(t,r){return[a*t-u*r+n,e-u*t-a*r]}return h.invert=function(t,n){return[f*t-c*n+s,l-c*t-f*n]},h}function Cs(t){return Ps(function(){return t})()}function Ps(t){var n,e,r,i,o,a,u,f,c,s,l=150,h=480,d=250,p=0,v=0,g=0,y=0,_=0,b=0,m=null,x=Gf,w=null,M=mc,A=.5;function T(t){return f(t[0]*Ia,t[1]*Ia)}function N(t){return(t=f.invert(t[0],t[1]))&&[t[0]*Fa,t[1]*Fa]}function S(){var t=ks(l,0,0,b).apply(null,n(p,v)),r=(b?ks:function(t,n,e){function r(r,i){return[n+t*r,e-t*i]}return r.invert=function(r,i){return[(r-n)/t,(e-i)/t]},r})(l,h-t[0],d-t[1],b);return e=kf(g,y,_),u=Sf(n,r),f=Sf(e,u),a=Ss(u,A),E()}function E(){return c=s=null,T}return T.stream=function(t){return c&&s===t?c:c=Es(function(t){return _s({point:function(n,e){var r=t(n,e);return this.stream.point(r[0],r[1])}})}(e)(x(a(M(s=t)))))},T.preclip=function(t){return arguments.length?(x=t,m=void 0,E()):x},T.postclip=function(t){return arguments.length?(M=t,w=r=i=o=null,E()):M},T.clipAngle=function(t){return arguments.length?(x=+t?Vf(m=t*Ia):(m=null,Gf),E()):m*Fa},T.clipExtent=function(t){return arguments.length?(M=null==t?(w=r=i=o=null,mc):Zf(w=+t[0][0],r=+t[0][1],i=+t[1][0],o=+t[1][1]),E()):null==w?null:[[w,r],[i,o]]},T.scale=function(t){return arguments.length?(l=+t,S()):l},T.translate=function(t){return arguments.length?(h=+t[0],d=+t[1],S()):[h,d]},T.center=function(t){return arguments.length?(p=t[0]%360*Ia,v=t[1]%360*Ia,S()):[p*Fa,v*Fa]},T.rotate=function(t){return arguments.length?(g=t[0]%360*Ia,y=t[1]%360*Ia,_=t.length>2?t[2]%360*Ia:0,S()):[g*Fa,y*Fa,_*Fa]},T.angle=function(t){return arguments.length?(b=t%360*Ia,S()):b*Fa},T.precision=function(t){return arguments.length?(a=Ss(u,A=t*t),E()):Ka(A)},T.fitExtent=function(t,n){return xs(T,t,n)},T.fitSize=function(t,n){return ws(T,t,n)},T.fitWidth=function(t,n){return Ms(T,t,n)},T.fitHeight=function(t,n){return As(T,t,n)},function(){return n=t.apply(this,arguments),T.invert=n.invert&&N,S()}}function zs(t){var n=0,e=qa/3,r=Ps(t),i=r(n,e);return i.parallels=function(t){return arguments.length?r(n=t[0]*Ia,e=t[1]*Ia):[n*Fa,e*Fa]},i}function Rs(t,n){var e=Qa(t),r=(e+Qa(n))/2;if(Ha(r)<Da)return function(t){var n=Ga(t);function e(t,e){return[t*n,Qa(e)/n]}return e.invert=function(t,e){return[t/n,eu(e*n)]},e}(t);var i=1+e*(2*r-e),o=Ka(i)/r;function a(t,n){var e=Ka(i-2*r*Qa(n))/r;return[e*Qa(t*=r),o-e*Ga(t)]}return a.invert=function(t,n){var e=o-n;return[Xa(t,Ha(e))/r*Ja(e),eu((i-(t*t+e*e)*r*r)/(2*r))]},a}function Ls(){return zs(Rs).scale(155.424).center([0,33.6442])}function Ds(){return Ls().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function Us(t){return function(n,e){var r=Ga(n),i=Ga(e),o=t(r*i);return[o*i*Qa(n),o*Qa(e)]}}function qs(t){return function(n,e){var r=Ka(n*n+e*e),i=t(r),o=Qa(i),a=Ga(i);return[Xa(n*o,r*a),eu(r&&e*o/r)]}}var Os=Us(function(t){return Ka(2/(1+t))});Os.invert=qs(function(t){return 2*eu(t/2)});var Ys=Us(function(t){return(t=nu(t))&&t/Qa(t)});function Bs(t,n){return[t,Wa(tu((Oa+n)/2))]}function Fs(t){var n,e,r,i=Cs(t),o=i.center,a=i.scale,u=i.translate,f=i.clipExtent,c=null;function s(){var o=qa*a(),u=i(Rf(i.rotate()).invert([0,0]));return f(null==c?[[u[0]-o,u[1]-o],[u[0]+o,u[1]+o]]:t===Bs?[[Math.max(u[0]-o,c),n],[Math.min(u[0]+o,e),r]]:[[c,Math.max(u[1]-o,n)],[e,Math.min(u[1]+o,r)]])}return i.scale=function(t){return arguments.length?(a(t),s()):a()},i.translate=function(t){return arguments.length?(u(t),s()):u()},i.center=function(t){return arguments.length?(o(t),s()):o()},i.clipExtent=function(t){return arguments.length?(null==t?c=n=e=r=null:(c=+t[0][0],n=+t[0][1],e=+t[1][0],r=+t[1][1]),s()):null==c?null:[[c,n],[e,r]]},s()}function Is(t){return tu((Oa+t)/2)}function Hs(t,n){var e=Ga(t),r=t===n?Qa(t):Wa(e/Ga(n))/Wa(Is(n)/Is(t)),i=e*Za(Is(t),r)/r;if(!r)return Bs;function o(t,n){i>0?n<-Oa+Da&&(n=-Oa+Da):n>Oa-Da&&(n=Oa-Da);var e=i/Za(Is(n),r);return[e*Qa(r*t),i-e*Ga(r*t)]}return o.invert=function(t,n){var e=i-n,o=Ja(r)*Ka(t*t+e*e);return[Xa(t,Ha(e))/r*Ja(e),2*ja(Za(i/o,1/r))-Oa]},o}function js(t,n){return[t,n]}function Xs(t,n){var e=Ga(t),r=t===n?Qa(t):(e-Ga(n))/(n-t),i=e/r+t;if(Ha(r)<Da)return js;function o(t,n){var e=i-n,o=r*t;return[e*Qa(o),i-e*Ga(o)]}return o.invert=function(t,n){var e=i-n;return[Xa(t,Ha(e))/r*Ja(e),i-Ja(r)*Ka(t*t+e*e)]},o}Ys.invert=qs(function(t){return t}),Bs.invert=function(t,n){return[t,2*ja($a(n))-Oa]},js.invert=js;var Gs=1.340264,Vs=-.081106,$s=893e-6,Ws=.003796,Zs=Ka(3)/2;function Qs(t,n){var e=eu(Zs*Qa(n)),r=e*e,i=r*r*r;return[t*Ga(e)/(Zs*(Gs+3*Vs*r+i*(7*$s+9*Ws*r))),e*(Gs+Vs*r+i*($s+Ws*r))]}function Js(t,n){var e=Ga(n),r=Ga(t)*e;return[e*Qa(t)/r,Qa(n)/r]}function Ks(t,n,e,r){return 1===t&&1===n&&0===e&&0===r?mc:_s({point:function(i,o){this.stream.point(i*t+e,o*n+r)}})}function tl(t,n){var e=n*n,r=e*e;return[t*(.8707-.131979*e+r*(r*(.003971*e-.001529*r)-.013791)),n*(1.007226+e*(.015085+r*(.028874*e-.044475-.005916*r)))]}function nl(t,n){return[Ga(n)*Qa(t),Qa(n)]}function el(t,n){var e=Ga(n),r=1+Ga(t)*e;return[e*Qa(t)/r,Qa(n)/r]}function rl(t,n){return[Wa(tu((Oa+n)/2)),-t]}function il(t,n){return t.parent===n.parent?1:2}function ol(t,n){return t+n.x}function al(t,n){return Math.max(t,n.y)}function ul(t){var n=0,e=t.children,r=e&&e.length;if(r)for(;--r>=0;)n+=e[r].value;else n=1;t.value=n}function fl(t,n){var e,r,i,o,a,u=new hl(t),f=+t.value&&(u.value=t.value),c=[u];for(null==n&&(n=cl);e=c.pop();)if(f&&(e.value=+e.data.value),(i=n(e.data))&&(a=i.length))for(e.children=new Array(a),o=a-1;o>=0;--o)c.push(r=e.children[o]=new hl(i[o])),r.parent=e,r.depth=e.depth+1;return u.eachBefore(ll)}function cl(t){return t.children}function sl(t){t.data=t.data.data}function ll(t){var n=0;do{t.height=n}while((t=t.parent)&&t.height<++n)}function hl(t){this.data=t,this.depth=this.height=0,this.parent=null}Qs.invert=function(t,n){for(var e,r=n,i=r*r,o=i*i*i,a=0;a<12&&(o=(i=(r-=e=(r*(Gs+Vs*i+o*($s+Ws*i))-n)/(Gs+3*Vs*i+o*(7*$s+9*Ws*i)))*r)*i*i,!(Ha(e)<Ua));++a);return[Zs*t*(Gs+3*Vs*i+o*(7*$s+9*Ws*i))/Ga(r),eu(Qa(r)/Zs)]},Js.invert=qs(ja),tl.invert=function(t,n){var e,r=n,i=25;do{var o=r*r,a=o*o;r-=e=(r*(1.007226+o*(.015085+a*(.028874*o-.044475-.005916*a)))-n)/(1.007226+o*(.045255+a*(.259866*o-.311325-.005916*11*a)))}while(Ha(e)>Da&&--i>0);return[t/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},nl.invert=qs(eu),el.invert=qs(function(t){return 2*ja(t)}),rl.invert=function(t,n){return[-n,2*ja($a(t))-Oa]},hl.prototype=fl.prototype={constructor:hl,count:function(){return this.eachAfter(ul)},each:function(t){var n,e,r,i,o=this,a=[o];do{for(n=a.reverse(),a=[];o=n.pop();)if(t(o),e=o.children)for(r=0,i=e.length;r<i;++r)a.push(e[r])}while(a.length);return this},eachAfter:function(t){for(var n,e,r,i=this,o=[i],a=[];i=o.pop();)if(a.push(i),n=i.children)for(e=0,r=n.length;e<r;++e)o.push(n[e]);for(;i=a.pop();)t(i);return this},eachBefore:function(t){for(var n,e,r=this,i=[r];r=i.pop();)if(t(r),n=r.children)for(e=n.length-1;e>=0;--e)i.push(n[e]);return this},sum:function(t){return this.eachAfter(function(n){for(var e=+t(n.data)||0,r=n.children,i=r&&r.length;--i>=0;)e+=r[i].value;n.value=e})},sort:function(t){return this.eachBefore(function(n){n.children&&n.children.sort(t)})},path:function(t){for(var n=this,e=function(t,n){if(t===n)return t;var e=t.ancestors(),r=n.ancestors(),i=null;for(t=e.pop(),n=r.pop();t===n;)i=t,t=e.pop(),n=r.pop();return i}(n,t),r=[n];n!==e;)n=n.parent,r.push(n);for(var i=r.length;t!==e;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,n=[t];t=t.parent;)n.push(t);return n},descendants:function(){var t=[];return this.each(function(n){t.push(n)}),t},leaves:function(){var t=[];return this.eachBefore(function(n){n.children||t.push(n)}),t},links:function(){var t=this,n=[];return t.each(function(e){e!==t&&n.push({source:e.parent,target:e})}),n},copy:function(){return fl(this).eachBefore(sl)}};var dl=Array.prototype.slice;function pl(t){for(var n,e,r=0,i=(t=function(t){for(var n,e,r=t.length;r;)e=Math.random()*r--|0,n=t[r],t[r]=t[e],t[e]=n;return t}(dl.call(t))).length,o=[];r<i;)n=t[r],e&&yl(e,n)?++r:(e=bl(o=vl(o,n)),r=0);return e}function vl(t,n){var e,r;if(_l(n,t))return[n];for(e=0;e<t.length;++e)if(gl(n,t[e])&&_l(ml(t[e],n),t))return[t[e],n];for(e=0;e<t.length-1;++e)for(r=e+1;r<t.length;++r)if(gl(ml(t[e],t[r]),n)&&gl(ml(t[e],n),t[r])&&gl(ml(t[r],n),t[e])&&_l(xl(t[e],t[r],n),t))return[t[e],t[r],n];throw new Error}function gl(t,n){var e=t.r-n.r,r=n.x-t.x,i=n.y-t.y;return e<0||e*e<r*r+i*i}function yl(t,n){var e=t.r-n.r+1e-6,r=n.x-t.x,i=n.y-t.y;return e>0&&e*e>r*r+i*i}function _l(t,n){for(var e=0;e<n.length;++e)if(!yl(t,n[e]))return!1;return!0}function bl(t){switch(t.length){case 1:return{x:(n=t[0]).x,y:n.y,r:n.r};case 2:return ml(t[0],t[1]);case 3:return xl(t[0],t[1],t[2])}var n}function ml(t,n){var e=t.x,r=t.y,i=t.r,o=n.x,a=n.y,u=n.r,f=o-e,c=a-r,s=u-i,l=Math.sqrt(f*f+c*c);return{x:(e+o+f/l*s)/2,y:(r+a+c/l*s)/2,r:(l+i+u)/2}}function xl(t,n,e){var r=t.x,i=t.y,o=t.r,a=n.x,u=n.y,f=n.r,c=e.x,s=e.y,l=e.r,h=r-a,d=r-c,p=i-u,v=i-s,g=f-o,y=l-o,_=r*r+i*i-o*o,b=_-a*a-u*u+f*f,m=_-c*c-s*s+l*l,x=d*p-h*v,w=(p*m-v*b)/(2*x)-r,M=(v*g-p*y)/x,A=(d*b-h*m)/(2*x)-i,T=(h*y-d*g)/x,N=M*M+T*T-1,S=2*(o+w*M+A*T),E=w*w+A*A-o*o,k=-(N?(S+Math.sqrt(S*S-4*N*E))/(2*N):E/S);return{x:r+w+M*k,y:i+A+T*k,r:k}}function wl(t,n,e){var r,i,o,a,u=t.x-n.x,f=t.y-n.y,c=u*u+f*f;c?(i=n.r+e.r,i*=i,a=t.r+e.r,i>(a*=a)?(r=(c+a-i)/(2*c),o=Math.sqrt(Math.max(0,a/c-r*r)),e.x=t.x-r*u-o*f,e.y=t.y-r*f+o*u):(r=(c+i-a)/(2*c),o=Math.sqrt(Math.max(0,i/c-r*r)),e.x=n.x+r*u-o*f,e.y=n.y+r*f+o*u)):(e.x=n.x+e.r,e.y=n.y)}function Ml(t,n){var e=t.r+n.r-1e-6,r=n.x-t.x,i=n.y-t.y;return e>0&&e*e>r*r+i*i}function Al(t){var n=t._,e=t.next._,r=n.r+e.r,i=(n.x*e.r+e.x*n.r)/r,o=(n.y*e.r+e.y*n.r)/r;return i*i+o*o}function Tl(t){this._=t,this.next=null,this.previous=null}function Nl(t){if(!(i=t.length))return 0;var n,e,r,i,o,a,u,f,c,s,l;if((n=t[0]).x=0,n.y=0,!(i>1))return n.r;if(e=t[1],n.x=-e.r,e.x=n.r,e.y=0,!(i>2))return n.r+e.r;wl(e,n,r=t[2]),n=new Tl(n),e=new Tl(e),r=new Tl(r),n.next=r.previous=e,e.next=n.previous=r,r.next=e.previous=n;t:for(u=3;u<i;++u){wl(n._,e._,r=t[u]),r=new Tl(r),f=e.next,c=n.previous,s=e._.r,l=n._.r;do{if(s<=l){if(Ml(f._,r._)){e=f,n.next=e,e.previous=n,--u;continue t}s+=f._.r,f=f.next}else{if(Ml(c._,r._)){(n=c).next=e,e.previous=n,--u;continue t}l+=c._.r,c=c.previous}}while(f!==c.next);for(r.previous=n,r.next=e,n.next=e.previous=e=r,o=Al(n);(r=r.next)!==e;)(a=Al(r))<o&&(n=r,o=a);e=n.next}for(n=[e._],r=e;(r=r.next)!==e;)n.push(r._);for(r=pl(n),u=0;u<i;++u)(n=t[u]).x-=r.x,n.y-=r.y;return r.r}function Sl(t){if("function"!=typeof t)throw new Error;return t}function El(){return 0}function kl(t){return function(){return t}}function Cl(t){return Math.sqrt(t.value)}function Pl(t){return function(n){n.children||(n.r=Math.max(0,+t(n)||0))}}function zl(t,n){return function(e){if(r=e.children){var r,i,o,a=r.length,u=t(e)*n||0;if(u)for(i=0;i<a;++i)r[i].r+=u;if(o=Nl(r),u)for(i=0;i<a;++i)r[i].r-=u;e.r=o+u}}}function Rl(t){return function(n){var e=n.parent;n.r*=t,e&&(n.x=e.x+t*n.x,n.y=e.y+t*n.y)}}function Ll(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function Dl(t,n,e,r,i){for(var o,a=t.children,u=-1,f=a.length,c=t.value&&(r-n)/t.value;++u<f;)(o=a[u]).y0=e,o.y1=i,o.x0=n,o.x1=n+=o.value*c}var Ul="$",ql={depth:-1},Ol={};function Yl(t){return t.id}function Bl(t){return t.parentId}function Fl(t,n){return t.parent===n.parent?1:2}function Il(t){var n=t.children;return n?n[0]:t.t}function Hl(t){var n=t.children;return n?n[n.length-1]:t.t}function jl(t,n,e){var r=e/(n.i-t.i);n.c-=r,n.s+=e,t.c+=r,n.z+=e,n.m+=e}function Xl(t,n,e){return t.a.parent===n.parent?t.a:e}function Gl(t,n){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=n}function Vl(t,n,e,r,i){for(var o,a=t.children,u=-1,f=a.length,c=t.value&&(i-e)/t.value;++u<f;)(o=a[u]).x0=n,o.x1=r,o.y0=e,o.y1=e+=o.value*c}Gl.prototype=Object.create(hl.prototype);var $l=(1+Math.sqrt(5))/2;function Wl(t,n,e,r,i,o){for(var a,u,f,c,s,l,h,d,p,v,g,y=[],_=n.children,b=0,m=0,x=_.length,w=n.value;b<x;){f=i-e,c=o-r;do{s=_[m++].value}while(!s&&m<x);for(l=h=s,g=s*s*(v=Math.max(c/f,f/c)/(w*t)),p=Math.max(h/g,g/l);m<x;++m){if(s+=u=_[m].value,u<l&&(l=u),u>h&&(h=u),g=s*s*v,(d=Math.max(h/g,g/l))>p){s-=u;break}p=d}y.push(a={value:s,dice:f<c,children:_.slice(b,m)}),a.dice?Dl(a,e,r,i,w?r+=c*s/w:o):Vl(a,e,r,w?e+=f*s/w:i,o),w-=s,b=m}return y}var Zl=function t(n){function e(t,e,r,i,o){Wl(n,t,e,r,i,o)}return e.ratio=function(n){return t((n=+n)>1?n:1)},e}($l);var Ql=function t(n){function e(t,e,r,i,o){if((a=t._squarify)&&a.ratio===n)for(var a,u,f,c,s,l=-1,h=a.length,d=t.value;++l<h;){for(f=(u=a[l]).children,c=u.value=0,s=f.length;c<s;++c)u.value+=f[c].value;u.dice?Dl(u,e,r,i,r+=(o-r)*u.value/d):Vl(u,e,r,e+=(i-e)*u.value/d,o),d-=u.value}else t._squarify=a=Wl(n,t,e,r,i,o),a.ratio=n}return e.ratio=function(n){return t((n=+n)>1?n:1)},e}($l);function Jl(t,n){return t[0]-n[0]||t[1]-n[1]}function Kl(t){for(var n,e,r,i=t.length,o=[0,1],a=2,u=2;u<i;++u){for(;a>1&&(n=t[o[a-2]],e=t[o[a-1]],r=t[u],(e[0]-n[0])*(r[1]-n[1])-(e[1]-n[1])*(r[0]-n[0])<=0);)--a;o[a++]=u}return o.slice(0,a)}function th(){return Math.random()}var nh=function t(n){function e(t,e){return t=null==t?0:+t,e=null==e?1:+e,1===arguments.length?(e=t,t=0):e-=t,function(){return n()*e+t}}return e.source=t,e}(th),eh=function t(n){function e(t,e){var r,i;return t=null==t?0:+t,e=null==e?1:+e,function(){var o;if(null!=r)o=r,r=null;else do{r=2*n()-1,o=2*n()-1,i=r*r+o*o}while(!i||i>1);return t+e*o*Math.sqrt(-2*Math.log(i)/i)}}return e.source=t,e}(th),rh=function t(n){function e(){var t=eh.source(n).apply(this,arguments);return function(){return Math.exp(t())}}return e.source=t,e}(th),ih=function t(n){function e(t){return function(){for(var e=0,r=0;r<t;++r)e+=n();return e}}return e.source=t,e}(th),oh=function t(n){function e(t){var e=ih.source(n)(t);return function(){return e()/t}}return e.source=t,e}(th),ah=function t(n){function e(t){return function(){return-Math.log(1-n())/t}}return e.source=t,e}(th),uh=Array.prototype,fh=uh.map,ch=uh.slice,sh={name:"implicit"};function lh(t){var n=Ki(),e=[],r=sh;function i(i){var o=i+"",a=n.get(o);if(!a){if(r!==sh)return r;n.set(o,a=e.push(i))}return t[(a-1)%t.length]}return t=null==t?[]:ch.call(t),i.domain=function(t){if(!arguments.length)return e.slice();e=[],n=Ki();for(var r,o,a=-1,u=t.length;++a<u;)n.has(o=(r=t[a])+"")||n.set(o,e.push(r));return i},i.range=function(n){return arguments.length?(t=ch.call(n),i):t.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return lh().domain(e).range(t).unknown(r)},i}function hh(){var t,n,e=lh().unknown(void 0),r=e.domain,i=e.range,o=[0,1],a=!1,u=0,f=0,c=.5;function s(){var e=r().length,s=o[1]<o[0],l=o[s-0],h=o[1-s];t=(h-l)/Math.max(1,e-u+2*f),a&&(t=Math.floor(t)),l+=(h-l-t*(e-u))*c,n=t*(1-u),a&&(l=Math.round(l),n=Math.round(n));var d=g(e).map(function(n){return l+t*n});return i(s?d.reverse():d)}return delete e.unknown,e.domain=function(t){return arguments.length?(r(t),s()):r()},e.range=function(t){return arguments.length?(o=[+t[0],+t[1]],s()):o.slice()},e.rangeRound=function(t){return o=[+t[0],+t[1]],a=!0,s()},e.bandwidth=function(){return n},e.step=function(){return t},e.round=function(t){return arguments.length?(a=!!t,s()):a},e.padding=function(t){return arguments.length?(u=f=Math.max(0,Math.min(1,t)),s()):u},e.paddingInner=function(t){return arguments.length?(u=Math.max(0,Math.min(1,t)),s()):u},e.paddingOuter=function(t){return arguments.length?(f=Math.max(0,Math.min(1,t)),s()):f},e.align=function(t){return arguments.length?(c=Math.max(0,Math.min(1,t)),s()):c},e.copy=function(){return hh().domain(r()).range(o).round(a).paddingInner(u).paddingOuter(f).align(c)},s()}function dh(t){return function(){return t}}function ph(t){return+t}var vh=[0,1];function gh(t,n){return(n-=t=+t)?function(e){return(e-t)/n}:dh(n)}function yh(t,n,e,r){var i=t[0],o=t[1],a=n[0],u=n[1];return o<i?(i=e(o,i),a=r(u,a)):(i=e(i,o),a=r(a,u)),function(t){return a(i(t))}}function _h(t,n,e,r){var o=Math.min(t.length,n.length)-1,a=new Array(o),u=new Array(o),f=-1;for(t[o]<t[0]&&(t=t.slice().reverse(),n=n.slice().reverse());++f<o;)a[f]=e(t[f],t[f+1]),u[f]=r(n[f],n[f+1]);return function(n){var e=i(t,n,1,o)-1;return u[e](a[e](n))}}function bh(t,n){return n.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp())}function mh(t,n){var e,r,i,o=vh,a=vh,u=me,f=!1;function c(){return e=Math.min(o.length,a.length)>2?_h:yh,r=i=null,s}function s(n){return(r||(r=e(o,a,f?function(t){return function(n,e){var r=t(n=+n,e=+e);return function(t){return t<=n?0:t>=e?1:r(t)}}}(t):t,u)))(+n)}return s.invert=function(t){return(i||(i=e(a,o,gh,f?function(t){return function(n,e){var r=t(n=+n,e=+e);return function(t){return t<=0?n:t>=1?e:r(t)}}}(n):n)))(+t)},s.domain=function(t){return arguments.length?(o=fh.call(t,ph),c()):o.slice()},s.range=function(t){return arguments.length?(a=ch.call(t),c()):a.slice()},s.rangeRound=function(t){return a=ch.call(t),u=xe,c()},s.clamp=function(t){return arguments.length?(f=!!t,c()):f},s.interpolate=function(t){return arguments.length?(u=t,c()):u},c()}function xh(n){var e=n.domain;return n.ticks=function(t){var n=e();return m(n[0],n[n.length-1],null==t?10:t)},n.tickFormat=function(n,r){return function(n,e,r){var i,o=n[0],a=n[n.length-1],u=w(o,a,null==e?10:e);switch((r=ba(null==r?",f":r)).type){case"s":var f=Math.max(Math.abs(o),Math.abs(a));return null!=r.precision||isNaN(i=ka(u,f))||(r.precision=i),t.formatPrefix(r,f);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=Ca(u,Math.max(Math.abs(o),Math.abs(a))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=Ea(u))||(r.precision=i-2*("%"===r.type))}return t.format(r)}(e(),n,r)},n.nice=function(t){null==t&&(t=10);var r,i=e(),o=0,a=i.length-1,u=i[o],f=i[a];return f<u&&(r=u,u=f,f=r,r=o,o=a,a=r),(r=x(u,f,t))>0?r=x(u=Math.floor(u/r)*r,f=Math.ceil(f/r)*r,t):r<0&&(r=x(u=Math.ceil(u*r)/r,f=Math.floor(f*r)/r,t)),r>0?(i[o]=Math.floor(u/r)*r,i[a]=Math.ceil(f/r)*r,e(i)):r<0&&(i[o]=Math.ceil(u*r)/r,i[a]=Math.floor(f*r)/r,e(i)),n},n}function wh(t,n){var e,r=0,i=(t=t.slice()).length-1,o=t[r],a=t[i];return a<o&&(e=r,r=i,i=e,e=o,o=a,a=e),t[r]=n.floor(o),t[i]=n.ceil(a),t}function Mh(t,n){return(n=Math.log(n/t))?function(e){return Math.log(e/t)/n}:dh(n)}function Ah(t,n){return t<0?function(e){return-Math.pow(-n,e)*Math.pow(-t,1-e)}:function(e){return Math.pow(n,e)*Math.pow(t,1-e)}}function Th(t){return isFinite(t)?+("1e"+t):t<0?0:t}function Nh(t){return 10===t?Th:t===Math.E?Math.exp:function(n){return Math.pow(t,n)}}function Sh(t){return t===Math.E?Math.log:10===t&&Math.log10||2===t&&Math.log2||(t=Math.log(t),function(n){return Math.log(n)/t})}function Eh(t){return function(n){return-t(-n)}}function kh(t,n){return t<0?-Math.pow(-t,n):Math.pow(t,n)}function Ch(){var t=1,n=mh(function(n,e){return(e=kh(e,t)-(n=kh(n,t)))?function(r){return(kh(r,t)-n)/e}:dh(e)},function(n,e){return e=kh(e,t)-(n=kh(n,t)),function(r){return kh(n+e*r,1/t)}}),e=n.domain;return n.exponent=function(n){return arguments.length?(t=+n,e(e())):t},n.copy=function(){return bh(n,Ch().exponent(t))},xh(n)}var Ph=new Date,zh=new Date;function Rh(t,n,e,r){function i(n){return t(n=new Date(+n)),n}return i.floor=i,i.ceil=function(e){return t(e=new Date(e-1)),n(e,1),t(e),e},i.round=function(t){var n=i(t),e=i.ceil(t);return t-n<e-t?n:e},i.offset=function(t,e){return n(t=new Date(+t),null==e?1:Math.floor(e)),t},i.range=function(e,r,o){var a,u=[];if(e=i.ceil(e),o=null==o?1:Math.floor(o),!(e<r&&o>0))return u;do{u.push(a=new Date(+e)),n(e,o),t(e)}while(a<e&&e<r);return u},i.filter=function(e){return Rh(function(n){if(n>=n)for(;t(n),!e(n);)n.setTime(n-1)},function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;n(t,-1),!e(t););else for(;--r>=0;)for(;n(t,1),!e(t););})},e&&(i.count=function(n,r){return Ph.setTime(+n),zh.setTime(+r),t(Ph),t(zh),Math.floor(e(Ph,zh))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(n){return r(n)%t==0}:function(n){return i.count(0,n)%t==0}):i:null}),i}var Lh=Rh(function(){},function(t,n){t.setTime(+t+n)},function(t,n){return n-t});Lh.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?Rh(function(n){n.setTime(Math.floor(n/t)*t)},function(n,e){n.setTime(+n+e*t)},function(n,e){return(e-n)/t}):Lh:null};var Dh=Lh.range,Uh=6e4,qh=6048e5,Oh=Rh(function(t){t.setTime(1e3*Math.floor(t/1e3))},function(t,n){t.setTime(+t+1e3*n)},function(t,n){return(n-t)/1e3},function(t){return t.getUTCSeconds()}),Yh=Oh.range,Bh=Rh(function(t){t.setTime(Math.floor(t/Uh)*Uh)},function(t,n){t.setTime(+t+n*Uh)},function(t,n){return(n-t)/Uh},function(t){return t.getMinutes()}),Fh=Bh.range,Ih=Rh(function(t){var n=t.getTimezoneOffset()*Uh%36e5;n<0&&(n+=36e5),t.setTime(36e5*Math.floor((+t-n)/36e5)+n)},function(t,n){t.setTime(+t+36e5*n)},function(t,n){return(n-t)/36e5},function(t){return t.getHours()}),Hh=Ih.range,jh=Rh(function(t){t.setHours(0,0,0,0)},function(t,n){t.setDate(t.getDate()+n)},function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Uh)/864e5},function(t){return t.getDate()-1}),Xh=jh.range;function Gh(t){return Rh(function(n){n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)},function(t,n){t.setDate(t.getDate()+7*n)},function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Uh)/qh})}var Vh=Gh(0),$h=Gh(1),Wh=Gh(2),Zh=Gh(3),Qh=Gh(4),Jh=Gh(5),Kh=Gh(6),td=Vh.range,nd=$h.range,ed=Wh.range,rd=Zh.range,id=Qh.range,od=Jh.range,ad=Kh.range,ud=Rh(function(t){t.setDate(1),t.setHours(0,0,0,0)},function(t,n){t.setMonth(t.getMonth()+n)},function(t,n){return n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear())},function(t){return t.getMonth()}),fd=ud.range,cd=Rh(function(t){t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,n){t.setFullYear(t.getFullYear()+n)},function(t,n){return n.getFullYear()-t.getFullYear()},function(t){return t.getFullYear()});cd.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Rh(function(n){n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)},function(n,e){n.setFullYear(n.getFullYear()+e*t)}):null};var sd=cd.range,ld=Rh(function(t){t.setUTCSeconds(0,0)},function(t,n){t.setTime(+t+n*Uh)},function(t,n){return(n-t)/Uh},function(t){return t.getUTCMinutes()}),hd=ld.range,dd=Rh(function(t){t.setUTCMinutes(0,0,0)},function(t,n){t.setTime(+t+36e5*n)},function(t,n){return(n-t)/36e5},function(t){return t.getUTCHours()}),pd=dd.range,vd=Rh(function(t){t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCDate(t.getUTCDate()+n)},function(t,n){return(n-t)/864e5},function(t){return t.getUTCDate()-1}),gd=vd.range;function yd(t){return Rh(function(n){n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)},function(t,n){t.setUTCDate(t.getUTCDate()+7*n)},function(t,n){return(n-t)/qh})}var _d=yd(0),bd=yd(1),md=yd(2),xd=yd(3),wd=yd(4),Md=yd(5),Ad=yd(6),Td=_d.range,Nd=bd.range,Sd=md.range,Ed=xd.range,kd=wd.range,Cd=Md.range,Pd=Ad.range,zd=Rh(function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCMonth(t.getUTCMonth()+n)},function(t,n){return n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear())},function(t){return t.getUTCMonth()}),Rd=zd.range,Ld=Rh(function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n)},function(t,n){return n.getUTCFullYear()-t.getUTCFullYear()},function(t){return t.getUTCFullYear()});Ld.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Rh(function(n){n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)},function(n,e){n.setUTCFullYear(n.getUTCFullYear()+e*t)}):null};var Dd=Ld.range;function Ud(t){if(0<=t.y&&t.y<100){var n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function qd(t){if(0<=t.y&&t.y<100){var n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Od(t){return{y:t,m:0,d:1,H:0,M:0,S:0,L:0}}function Yd(t){var n=t.dateTime,e=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,u=t.months,f=t.shortMonths,c=Vd(i),s=$d(i),l=Vd(o),h=$d(o),d=Vd(a),p=$d(a),v=Vd(u),g=$d(u),y=Vd(f),_=$d(f),b={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return f[t.getMonth()]},B:function(t){return u[t.getMonth()]},c:null,d:pp,e:pp,f:bp,H:vp,I:gp,j:yp,L:_p,m:mp,M:xp,p:function(t){return i[+(t.getHours()>=12)]},Q:Wp,s:Zp,S:wp,u:Mp,U:Ap,V:Tp,w:Np,W:Sp,x:null,X:null,y:Ep,Y:kp,Z:Cp,"%":$p},m={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return f[t.getUTCMonth()]},B:function(t){return u[t.getUTCMonth()]},c:null,d:Pp,e:Pp,f:Up,H:zp,I:Rp,j:Lp,L:Dp,m:qp,M:Op,p:function(t){return i[+(t.getUTCHours()>=12)]},Q:Wp,s:Zp,S:Yp,u:Bp,U:Fp,V:Ip,w:Hp,W:jp,x:null,X:null,y:Xp,Y:Gp,Z:Vp,"%":$p},x={a:function(t,n,e){var r=d.exec(n.slice(e));return r?(t.w=p[r[0].toLowerCase()],e+r[0].length):-1},A:function(t,n,e){var r=l.exec(n.slice(e));return r?(t.w=h[r[0].toLowerCase()],e+r[0].length):-1},b:function(t,n,e){var r=y.exec(n.slice(e));return r?(t.m=_[r[0].toLowerCase()],e+r[0].length):-1},B:function(t,n,e){var r=v.exec(n.slice(e));return r?(t.m=g[r[0].toLowerCase()],e+r[0].length):-1},c:function(t,e,r){return A(t,n,e,r)},d:ip,e:ip,f:sp,H:ap,I:ap,j:op,L:cp,m:rp,M:up,p:function(t,n,e){var r=c.exec(n.slice(e));return r?(t.p=s[r[0].toLowerCase()],e+r[0].length):-1},Q:hp,s:dp,S:fp,u:Zd,U:Qd,V:Jd,w:Wd,W:Kd,x:function(t,n,r){return A(t,e,n,r)},X:function(t,n,e){return A(t,r,n,e)},y:np,Y:tp,Z:ep,"%":lp};function w(t,n){return function(e){var r,i,o,a=[],u=-1,f=0,c=t.length;for(e instanceof Date||(e=new Date(+e));++u<c;)37===t.charCodeAt(u)&&(a.push(t.slice(f,u)),null!=(i=Fd[r=t.charAt(++u)])?r=t.charAt(++u):i="e"===r?" ":"0",(o=n[r])&&(r=o(e,i)),a.push(r),f=u+1);return a.push(t.slice(f,u)),a.join("")}}function M(t,n){return function(e){var r,i,o=Od(1900);if(A(o,t,e+="",0)!=e.length)return null;if("Q"in o)return new Date(o.Q);if("p"in o&&(o.H=o.H%12+12*o.p),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=qd(Od(o.y))).getUTCDay(),r=i>4||0===i?bd.ceil(r):bd(r),r=vd.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=n(Od(o.y))).getDay(),r=i>4||0===i?$h.ceil(r):$h(r),r=jh.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?qd(Od(o.y)).getUTCDay():n(Od(o.y)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,qd(o)):n(o)}}function A(t,n,e,r){for(var i,o,a=0,u=n.length,f=e.length;a<u;){if(r>=f)return-1;if(37===(i=n.charCodeAt(a++))){if(i=n.charAt(a++),!(o=x[i in Fd?n.charAt(a++):i])||(r=o(t,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}return b.x=w(e,b),b.X=w(r,b),b.c=w(n,b),m.x=w(e,m),m.X=w(r,m),m.c=w(n,m),{format:function(t){var n=w(t+="",b);return n.toString=function(){return t},n},parse:function(t){var n=M(t+="",Ud);return n.toString=function(){return t},n},utcFormat:function(t){var n=w(t+="",m);return n.toString=function(){return t},n},utcParse:function(t){var n=M(t,qd);return n.toString=function(){return t},n}}}var Bd,Fd={"-":"",_:" ",0:"0"},Id=/^\s*\d+/,Hd=/^%/,jd=/[\\^$*+?|[\]().{}]/g;function Xd(t,n,e){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<e?new Array(e-o+1).join(n)+i:i)}function Gd(t){return t.replace(jd,"\\$&")}function Vd(t){return new RegExp("^(?:"+t.map(Gd).join("|")+")","i")}function $d(t){for(var n={},e=-1,r=t.length;++e<r;)n[t[e].toLowerCase()]=e;return n}function Wd(t,n,e){var r=Id.exec(n.slice(e,e+1));return r?(t.w=+r[0],e+r[0].length):-1}function Zd(t,n,e){var r=Id.exec(n.slice(e,e+1));return r?(t.u=+r[0],e+r[0].length):-1}function Qd(t,n,e){var r=Id.exec(n.slice(e,e+2));return r?(t.U=+r[0],e+r[0].length):-1}function Jd(t,n,e){var r=Id.exec(n.slice(e,e+2));return r?(t.V=+r[0],e+r[0].length):-1}function Kd(t,n,e){var r=Id.exec(n.slice(e,e+2));return r?(t.W=+r[0],e+r[0].length):-1}function tp(t,n,e){var r=Id.exec(n.slice(e,e+4));return r?(t.y=+r[0],e+r[0].length):-1}function np(t,n,e){var r=Id.exec(n.slice(e,e+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),e+r[0].length):-1}function ep(t,n,e){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function rp(t,n,e){var r=Id.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function ip(t,n,e){var r=Id.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function op(t,n,e){var r=Id.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function ap(t,n,e){var r=Id.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function up(t,n,e){var r=Id.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function fp(t,n,e){var r=Id.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function cp(t,n,e){var r=Id.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function sp(t,n,e){var r=Id.exec(n.slice(e,e+6));return r?(t.L=Math.floor(r[0]/1e3),e+r[0].length):-1}function lp(t,n,e){var r=Hd.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function hp(t,n,e){var r=Id.exec(n.slice(e));return r?(t.Q=+r[0],e+r[0].length):-1}function dp(t,n,e){var r=Id.exec(n.slice(e));return r?(t.Q=1e3*+r[0],e+r[0].length):-1}function pp(t,n){return Xd(t.getDate(),n,2)}function vp(t,n){return Xd(t.getHours(),n,2)}function gp(t,n){return Xd(t.getHours()%12||12,n,2)}function yp(t,n){return Xd(1+jh.count(cd(t),t),n,3)}function _p(t,n){return Xd(t.getMilliseconds(),n,3)}function bp(t,n){return _p(t,n)+"000"}function mp(t,n){return Xd(t.getMonth()+1,n,2)}function xp(t,n){return Xd(t.getMinutes(),n,2)}function wp(t,n){return Xd(t.getSeconds(),n,2)}function Mp(t){var n=t.getDay();return 0===n?7:n}function Ap(t,n){return Xd(Vh.count(cd(t),t),n,2)}function Tp(t,n){var e=t.getDay();return t=e>=4||0===e?Qh(t):Qh.ceil(t),Xd(Qh.count(cd(t),t)+(4===cd(t).getDay()),n,2)}function Np(t){return t.getDay()}function Sp(t,n){return Xd($h.count(cd(t),t),n,2)}function Ep(t,n){return Xd(t.getFullYear()%100,n,2)}function kp(t,n){return Xd(t.getFullYear()%1e4,n,4)}function Cp(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+Xd(n/60|0,"0",2)+Xd(n%60,"0",2)}function Pp(t,n){return Xd(t.getUTCDate(),n,2)}function zp(t,n){return Xd(t.getUTCHours(),n,2)}function Rp(t,n){return Xd(t.getUTCHours()%12||12,n,2)}function Lp(t,n){return Xd(1+vd.count(Ld(t),t),n,3)}function Dp(t,n){return Xd(t.getUTCMilliseconds(),n,3)}function Up(t,n){return Dp(t,n)+"000"}function qp(t,n){return Xd(t.getUTCMonth()+1,n,2)}function Op(t,n){return Xd(t.getUTCMinutes(),n,2)}function Yp(t,n){return Xd(t.getUTCSeconds(),n,2)}function Bp(t){var n=t.getUTCDay();return 0===n?7:n}function Fp(t,n){return Xd(_d.count(Ld(t),t),n,2)}function Ip(t,n){var e=t.getUTCDay();return t=e>=4||0===e?wd(t):wd.ceil(t),Xd(wd.count(Ld(t),t)+(4===Ld(t).getUTCDay()),n,2)}function Hp(t){return t.getUTCDay()}function jp(t,n){return Xd(bd.count(Ld(t),t),n,2)}function Xp(t,n){return Xd(t.getUTCFullYear()%100,n,2)}function Gp(t,n){return Xd(t.getUTCFullYear()%1e4,n,4)}function Vp(){return"+0000"}function $p(){return"%"}function Wp(t){return+t}function Zp(t){return Math.floor(+t/1e3)}function Qp(n){return Bd=Yd(n),t.timeFormat=Bd.format,t.timeParse=Bd.parse,t.utcFormat=Bd.utcFormat,t.utcParse=Bd.utcParse,Bd}Qp({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var Jp=Date.prototype.toISOString?function(t){return t.toISOString()}:t.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ");var Kp=+new Date("2000-01-01T00:00:00.000Z")?function(t){var n=new Date(t);return isNaN(n)?null:n}:t.utcParse("%Y-%m-%dT%H:%M:%S.%LZ"),tv=1e3,nv=60*tv,ev=60*nv,rv=24*ev,iv=7*rv,ov=30*rv,av=365*rv;function uv(t){return new Date(t)}function fv(t){return t instanceof Date?+t:+new Date(+t)}function cv(t,n,r,i,o,a,u,f,c){var s=mh(gh,ve),l=s.invert,h=s.domain,d=c(".%L"),p=c(":%S"),v=c("%I:%M"),g=c("%I %p"),y=c("%a %d"),_=c("%b %d"),b=c("%B"),m=c("%Y"),x=[[u,1,tv],[u,5,5*tv],[u,15,15*tv],[u,30,30*tv],[a,1,nv],[a,5,5*nv],[a,15,15*nv],[a,30,30*nv],[o,1,ev],[o,3,3*ev],[o,6,6*ev],[o,12,12*ev],[i,1,rv],[i,2,2*rv],[r,1,iv],[n,1,ov],[n,3,3*ov],[t,1,av]];function M(e){return(u(e)<e?d:a(e)<e?p:o(e)<e?v:i(e)<e?g:n(e)<e?r(e)<e?y:_:t(e)<e?b:m)(e)}function A(n,r,i,o){if(null==n&&(n=10),"number"==typeof n){var a=Math.abs(i-r)/n,u=e(function(t){return t[2]}).right(x,a);u===x.length?(o=w(r/av,i/av,n),n=t):u?(o=(u=x[a/x[u-1][2]<x[u][2]/a?u-1:u])[1],n=u[0]):(o=Math.max(w(r,i,n),1),n=f)}return null==o?n:n.every(o)}return s.invert=function(t){return new Date(l(t))},s.domain=function(t){return arguments.length?h(fh.call(t,fv)):h().map(uv)},s.ticks=function(t,n){var e,r=h(),i=r[0],o=r[r.length-1],a=o<i;return a&&(e=i,i=o,o=e),e=(e=A(t,i,o,n))?e.range(i,o+1):[],a?e.reverse():e},s.tickFormat=function(t,n){return null==n?M:c(n)},s.nice=function(t,n){var e=h();return(t=A(t,e[0],e[e.length-1],n))?h(wh(e,t)):s},s.copy=function(){return bh(s,cv(t,n,r,i,o,a,u,f,c))},s}function sv(t){for(var n=t.length/6|0,e=new Array(n),r=0;r<n;)e[r]="#"+t.slice(6*r,6*++r);return e}var lv=sv("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),hv=sv("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),dv=sv("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),pv=sv("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),vv=sv("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),gv=sv("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"),yv=sv("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"),_v=sv("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),bv=sv("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");function mv(t){return le(t[t.length-1])}var xv=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(sv),wv=mv(xv),Mv=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(sv),Av=mv(Mv),Tv=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(sv),Nv=mv(Tv),Sv=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(sv),Ev=mv(Sv),kv=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(sv),Cv=mv(kv),Pv=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(sv),zv=mv(Pv),Rv=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(sv),Lv=mv(Rv),Dv=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(sv),Uv=mv(Dv),qv=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(sv),Ov=mv(qv),Yv=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(sv),Bv=mv(Yv),Fv=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(sv),Iv=mv(Fv),Hv=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(sv),jv=mv(Hv),Xv=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(sv),Gv=mv(Xv),Vv=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(sv),$v=mv(Vv),Wv=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(sv),Zv=mv(Wv),Qv=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(sv),Jv=mv(Qv),Kv=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(sv),tg=mv(Kv),ng=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(sv),eg=mv(ng),rg=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(sv),ig=mv(rg),og=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(sv),ag=mv(og),ug=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(sv),fg=mv(ug),cg=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(sv),sg=mv(cg),lg=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(sv),hg=mv(lg),dg=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(sv),pg=mv(dg),vg=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(sv),gg=mv(vg),yg=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(sv),_g=mv(yg),bg=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(sv),mg=mv(bg),xg=Ge(Kn(300,.5,0),Kn(-240,.5,1)),wg=Ge(Kn(-100,.75,.35),Kn(80,1.5,.8)),Mg=Ge(Kn(260,.75,.35),Kn(80,1.5,.8)),Ag=Kn();var Tg=bn(),Ng=Math.PI/3,Sg=2*Math.PI/3;function Eg(t){var n=t.length;return function(e){return t[Math.max(0,Math.min(n-1,Math.floor(e*n)))]}}var kg=Eg(sv("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),Cg=Eg(sv("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),Pg=Eg(sv("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),zg=Eg(sv("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function Rg(t){return function(){return t}}var Lg=Math.abs,Dg=Math.atan2,Ug=Math.cos,qg=Math.max,Og=Math.min,Yg=Math.sin,Bg=Math.sqrt,Fg=1e-12,Ig=Math.PI,Hg=Ig/2,jg=2*Ig;function Xg(t){return t>=1?Hg:t<=-1?-Hg:Math.asin(t)}function Gg(t){return t.innerRadius}function Vg(t){return t.outerRadius}function $g(t){return t.startAngle}function Wg(t){return t.endAngle}function Zg(t){return t&&t.padAngle}function Qg(t,n,e,r,i,o,a){var u=t-e,f=n-r,c=(a?o:-o)/Bg(u*u+f*f),s=c*f,l=-c*u,h=t+s,d=n+l,p=e+s,v=r+l,g=(h+p)/2,y=(d+v)/2,_=p-h,b=v-d,m=_*_+b*b,x=i-o,w=h*v-p*d,M=(b<0?-1:1)*Bg(qg(0,x*x*m-w*w)),A=(w*b-_*M)/m,T=(-w*_-b*M)/m,N=(w*b+_*M)/m,S=(-w*_+b*M)/m,E=A-g,k=T-y,C=N-g,P=S-y;return E*E+k*k>C*C+P*P&&(A=N,T=S),{cx:A,cy:T,x01:-s,y01:-l,x11:A*(i/x-1),y11:T*(i/x-1)}}function Jg(t){this._context=t}function Kg(t){return new Jg(t)}function ty(t){return t[0]}function ny(t){return t[1]}function ey(){var t=ty,n=ny,e=Rg(!0),r=null,i=Kg,o=null;function a(a){var u,f,c,s=a.length,l=!1;for(null==r&&(o=i(c=Gi())),u=0;u<=s;++u)!(u<s&&e(f=a[u],u,a))===l&&((l=!l)?o.lineStart():o.lineEnd()),l&&o.point(+t(f,u,a),+n(f,u,a));if(c)return o=null,c+""||null}return a.x=function(n){return arguments.length?(t="function"==typeof n?n:Rg(+n),a):t},a.y=function(t){return arguments.length?(n="function"==typeof t?t:Rg(+t),a):n},a.defined=function(t){return arguments.length?(e="function"==typeof t?t:Rg(!!t),a):e},a.curve=function(t){return arguments.length?(i=t,null!=r&&(o=i(r)),a):i},a.context=function(t){return arguments.length?(null==t?r=o=null:o=i(r=t),a):r},a}function ry(){var t=ty,n=null,e=Rg(0),r=ny,i=Rg(!0),o=null,a=Kg,u=null;function f(f){var c,s,l,h,d,p=f.length,v=!1,g=new Array(p),y=new Array(p);for(null==o&&(u=a(d=Gi())),c=0;c<=p;++c){if(!(c<p&&i(h=f[c],c,f))===v)if(v=!v)s=c,u.areaStart(),u.lineStart();else{for(u.lineEnd(),u.lineStart(),l=c-1;l>=s;--l)u.point(g[l],y[l]);u.lineEnd(),u.areaEnd()}v&&(g[c]=+t(h,c,f),y[c]=+e(h,c,f),u.point(n?+n(h,c,f):g[c],r?+r(h,c,f):y[c]))}if(d)return u=null,d+""||null}function c(){return ey().defined(i).curve(a).context(o)}return f.x=function(e){return arguments.length?(t="function"==typeof e?e:Rg(+e),n=null,f):t},f.x0=function(n){return arguments.length?(t="function"==typeof n?n:Rg(+n),f):t},f.x1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:Rg(+t),f):n},f.y=function(t){return arguments.length?(e="function"==typeof t?t:Rg(+t),r=null,f):e},f.y0=function(t){return arguments.length?(e="function"==typeof t?t:Rg(+t),f):e},f.y1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:Rg(+t),f):r},f.lineX0=f.lineY0=function(){return c().x(t).y(e)},f.lineY1=function(){return c().x(t).y(r)},f.lineX1=function(){return c().x(n).y(e)},f.defined=function(t){return arguments.length?(i="function"==typeof t?t:Rg(!!t),f):i},f.curve=function(t){return arguments.length?(a=t,null!=o&&(u=a(o)),f):a},f.context=function(t){return arguments.length?(null==t?o=u=null:u=a(o=t),f):o},f}function iy(t,n){return n<t?-1:n>t?1:n>=t?0:NaN}function oy(t){return t}Jg.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._context.lineTo(t,n)}}};var ay=fy(Kg);function uy(t){this._curve=t}function fy(t){function n(n){return new uy(t(n))}return n._curve=t,n}function cy(t){var n=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?n(fy(t)):n()._curve},t}function sy(){return cy(ey().curve(ay))}function ly(){var t=ry().curve(ay),n=t.curve,e=t.lineX0,r=t.lineX1,i=t.lineY0,o=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return cy(e())},delete t.lineX0,t.lineEndAngle=function(){return cy(r())},delete t.lineX1,t.lineInnerRadius=function(){return cy(i())},delete t.lineY0,t.lineOuterRadius=function(){return cy(o())},delete t.lineY1,t.curve=function(t){return arguments.length?n(fy(t)):n()._curve},t}function hy(t,n){return[(n=+n)*Math.cos(t-=Math.PI/2),n*Math.sin(t)]}uy.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,n){this._curve.point(n*Math.sin(t),n*-Math.cos(t))}};var dy=Array.prototype.slice;function py(t){return t.source}function vy(t){return t.target}function gy(t){var n=py,e=vy,r=ty,i=ny,o=null;function a(){var a,u=dy.call(arguments),f=n.apply(this,u),c=e.apply(this,u);if(o||(o=a=Gi()),t(o,+r.apply(this,(u[0]=f,u)),+i.apply(this,u),+r.apply(this,(u[0]=c,u)),+i.apply(this,u)),a)return o=null,a+""||null}return a.source=function(t){return arguments.length?(n=t,a):n},a.target=function(t){return arguments.length?(e=t,a):e},a.x=function(t){return arguments.length?(r="function"==typeof t?t:Rg(+t),a):r},a.y=function(t){return arguments.length?(i="function"==typeof t?t:Rg(+t),a):i},a.context=function(t){return arguments.length?(o=null==t?null:t,a):o},a}function yy(t,n,e,r,i){t.moveTo(n,e),t.bezierCurveTo(n=(n+r)/2,e,n,i,r,i)}function _y(t,n,e,r,i){t.moveTo(n,e),t.bezierCurveTo(n,e=(e+i)/2,r,e,r,i)}function by(t,n,e,r,i){var o=hy(n,e),a=hy(n,e=(e+i)/2),u=hy(r,e),f=hy(r,i);t.moveTo(o[0],o[1]),t.bezierCurveTo(a[0],a[1],u[0],u[1],f[0],f[1])}var my={draw:function(t,n){var e=Math.sqrt(n/Ig);t.moveTo(e,0),t.arc(0,0,e,0,jg)}},xy={draw:function(t,n){var e=Math.sqrt(n/5)/2;t.moveTo(-3*e,-e),t.lineTo(-e,-e),t.lineTo(-e,-3*e),t.lineTo(e,-3*e),t.lineTo(e,-e),t.lineTo(3*e,-e),t.lineTo(3*e,e),t.lineTo(e,e),t.lineTo(e,3*e),t.lineTo(-e,3*e),t.lineTo(-e,e),t.lineTo(-3*e,e),t.closePath()}},wy=Math.sqrt(1/3),My=2*wy,Ay={draw:function(t,n){var e=Math.sqrt(n/My),r=e*wy;t.moveTo(0,-e),t.lineTo(r,0),t.lineTo(0,e),t.lineTo(-r,0),t.closePath()}},Ty=Math.sin(Ig/10)/Math.sin(7*Ig/10),Ny=Math.sin(jg/10)*Ty,Sy=-Math.cos(jg/10)*Ty,Ey={draw:function(t,n){var e=Math.sqrt(.8908130915292852*n),r=Ny*e,i=Sy*e;t.moveTo(0,-e),t.lineTo(r,i);for(var o=1;o<5;++o){var a=jg*o/5,u=Math.cos(a),f=Math.sin(a);t.lineTo(f*e,-u*e),t.lineTo(u*r-f*i,f*r+u*i)}t.closePath()}},ky={draw:function(t,n){var e=Math.sqrt(n),r=-e/2;t.rect(r,r,e,e)}},Cy=Math.sqrt(3),Py={draw:function(t,n){var e=-Math.sqrt(n/(3*Cy));t.moveTo(0,2*e),t.lineTo(-Cy*e,-e),t.lineTo(Cy*e,-e),t.closePath()}},zy=Math.sqrt(3)/2,Ry=1/Math.sqrt(12),Ly=3*(Ry/2+1),Dy={draw:function(t,n){var e=Math.sqrt(n/Ly),r=e/2,i=e*Ry,o=r,a=e*Ry+e,u=-o,f=a;t.moveTo(r,i),t.lineTo(o,a),t.lineTo(u,f),t.lineTo(-.5*r-zy*i,zy*r+-.5*i),t.lineTo(-.5*o-zy*a,zy*o+-.5*a),t.lineTo(-.5*u-zy*f,zy*u+-.5*f),t.lineTo(-.5*r+zy*i,-.5*i-zy*r),t.lineTo(-.5*o+zy*a,-.5*a-zy*o),t.lineTo(-.5*u+zy*f,-.5*f-zy*u),t.closePath()}},Uy=[my,xy,Ay,ky,Ey,Py,Dy];function qy(){}function Oy(t,n,e){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+n)/6,(t._y0+4*t._y1+e)/6)}function Yy(t){this._context=t}function By(t){this._context=t}function Fy(t){this._context=t}function Iy(t,n){this._basis=new Yy(t),this._beta=n}Yy.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Oy(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Oy(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},By.prototype={areaStart:qy,areaEnd:qy,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x2=t,this._y2=n;break;case 1:this._point=2,this._x3=t,this._y3=n;break;case 2:this._point=3,this._x4=t,this._y4=n,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+n)/6);break;default:Oy(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},Fy.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var e=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break;case 3:this._point=4;default:Oy(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},Iy.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,n=this._y,e=t.length-1;if(e>0)for(var r,i=t[0],o=n[0],a=t[e]-i,u=n[e]-o,f=-1;++f<=e;)r=f/e,this._basis.point(this._beta*t[f]+(1-this._beta)*(i+r*a),this._beta*n[f]+(1-this._beta)*(o+r*u));this._x=this._y=null,this._basis.lineEnd()},point:function(t,n){this._x.push(+t),this._y.push(+n)}};var Hy=function t(n){function e(t){return 1===n?new Yy(t):new Iy(t,n)}return e.beta=function(n){return t(+n)},e}(.85);function jy(t,n,e){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-n),t._y2+t._k*(t._y1-e),t._x2,t._y2)}function Xy(t,n){this._context=t,this._k=(1-n)/6}Xy.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:jy(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2,this._x1=t,this._y1=n;break;case 2:this._point=3;default:jy(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Gy=function t(n){function e(t){return new Xy(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Vy(t,n){this._context=t,this._k=(1-n)/6}Vy.prototype={areaStart:qy,areaEnd:qy,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:jy(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var $y=function t(n){function e(t){return new Vy(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Wy(t,n){this._context=t,this._k=(1-n)/6}Wy.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:jy(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Zy=function t(n){function e(t){return new Wy(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Qy(t,n,e){var r=t._x1,i=t._y1,o=t._x2,a=t._y2;if(t._l01_a>Fg){var u=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,f=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*u-t._x0*t._l12_2a+t._x2*t._l01_2a)/f,i=(i*u-t._y0*t._l12_2a+t._y2*t._l01_2a)/f}if(t._l23_a>Fg){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,s=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*c+t._x1*t._l23_2a-n*t._l12_2a)/s,a=(a*c+t._y1*t._l23_2a-e*t._l12_2a)/s}t._context.bezierCurveTo(r,i,o,a,t._x2,t._y2)}function Jy(t,n){this._context=t,this._alpha=n}Jy.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3;default:Qy(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Ky=function t(n){function e(t){return n?new Jy(t,n):new Xy(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function t_(t,n){this._context=t,this._alpha=n}t_.prototype={areaStart:qy,areaEnd:qy,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Qy(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var n_=function t(n){function e(t){return n?new t_(t,n):new Vy(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function e_(t,n){this._context=t,this._alpha=n}e_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Qy(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var r_=function t(n){function e(t){return n?new e_(t,n):new Wy(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function i_(t){this._context=t}function o_(t){return t<0?-1:1}function a_(t,n,e){var r=t._x1-t._x0,i=n-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),a=(e-t._y1)/(i||r<0&&-0),u=(o*i+a*r)/(r+i);return(o_(o)+o_(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(u))||0}function u_(t,n){var e=t._x1-t._x0;return e?(3*(t._y1-t._y0)/e-n)/2:n}function f_(t,n,e){var r=t._x0,i=t._y0,o=t._x1,a=t._y1,u=(o-r)/3;t._context.bezierCurveTo(r+u,i+u*n,o-u,a-u*e,o,a)}function c_(t){this._context=t}function s_(t){this._context=new l_(t)}function l_(t){this._context=t}function h_(t){this._context=t}function d_(t){var n,e,r=t.length-1,i=new Array(r),o=new Array(r),a=new Array(r);for(i[0]=0,o[0]=2,a[0]=t[0]+2*t[1],n=1;n<r-1;++n)i[n]=1,o[n]=4,a[n]=4*t[n]+2*t[n+1];for(i[r-1]=2,o[r-1]=7,a[r-1]=8*t[r-1]+t[r],n=1;n<r;++n)e=i[n]/o[n-1],o[n]-=e,a[n]-=e*a[n-1];for(i[r-1]=a[r-1]/o[r-1],n=r-2;n>=0;--n)i[n]=(a[n]-i[n+1])/o[n];for(o[r-1]=(t[r]+i[r-1])/2,n=0;n<r-1;++n)o[n]=2*t[n+1]-i[n+1];return[i,o]}function p_(t,n){this._context=t,this._t=n}function v_(t,n){if((i=t.length)>1)for(var e,r,i,o=1,a=t[n[0]],u=a.length;o<i;++o)for(r=a,a=t[n[o]],e=0;e<u;++e)a[e][1]+=a[e][0]=isNaN(r[e][1])?r[e][0]:r[e][1]}function g_(t){for(var n=t.length,e=new Array(n);--n>=0;)e[n]=n;return e}function y_(t,n){return t[n]}function __(t){var n=t.map(b_);return g_(t).sort(function(t,e){return n[t]-n[e]})}function b_(t){for(var n,e=0,r=-1,i=t.length;++r<i;)(n=+t[r][1])&&(e+=n);return e}function m_(t){return function(){return t}}function x_(t){return t[0]}function w_(t){return t[1]}function M_(){this._=null}function A_(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function T_(t,n){var e=n,r=n.R,i=e.U;i?i.L===e?i.L=r:i.R=r:t._=r,r.U=i,e.U=r,e.R=r.L,e.R&&(e.R.U=e),r.L=e}function N_(t,n){var e=n,r=n.L,i=e.U;i?i.L===e?i.L=r:i.R=r:t._=r,r.U=i,e.U=r,e.L=r.R,e.L&&(e.L.U=e),r.R=e}function S_(t){for(;t.L;)t=t.L;return t}function E_(t,n,e,r){var i=[null,null],o=J_.push(i)-1;return i.left=t,i.right=n,e&&C_(i,t,n,e),r&&C_(i,n,t,r),Z_[t.index].halfedges.push(o),Z_[n.index].halfedges.push(o),i}function k_(t,n,e){var r=[n,e];return r.left=t,r}function C_(t,n,e,r){t[0]||t[1]?t.left===e?t[1]=r:t[0]=r:(t[0]=r,t.left=n,t.right=e)}function P_(t,n,e,r,i){var o,a=t[0],u=t[1],f=a[0],c=a[1],s=0,l=1,h=u[0]-f,d=u[1]-c;if(o=n-f,h||!(o>0)){if(o/=h,h<0){if(o<s)return;o<l&&(l=o)}else if(h>0){if(o>l)return;o>s&&(s=o)}if(o=r-f,h||!(o<0)){if(o/=h,h<0){if(o>l)return;o>s&&(s=o)}else if(h>0){if(o<s)return;o<l&&(l=o)}if(o=e-c,d||!(o>0)){if(o/=d,d<0){if(o<s)return;o<l&&(l=o)}else if(d>0){if(o>l)return;o>s&&(s=o)}if(o=i-c,d||!(o<0)){if(o/=d,d<0){if(o>l)return;o>s&&(s=o)}else if(d>0){if(o<s)return;o<l&&(l=o)}return!(s>0||l<1)||(s>0&&(t[0]=[f+s*h,c+s*d]),l<1&&(t[1]=[f+l*h,c+l*d]),!0)}}}}}function z_(t,n,e,r,i){var o=t[1];if(o)return!0;var a,u,f=t[0],c=t.left,s=t.right,l=c[0],h=c[1],d=s[0],p=s[1],v=(l+d)/2,g=(h+p)/2;if(p===h){if(v<n||v>=r)return;if(l>d){if(f){if(f[1]>=i)return}else f=[v,e];o=[v,i]}else{if(f){if(f[1]<e)return}else f=[v,i];o=[v,e]}}else if(u=g-(a=(l-d)/(p-h))*v,a<-1||a>1)if(l>d){if(f){if(f[1]>=i)return}else f=[(e-u)/a,e];o=[(i-u)/a,i]}else{if(f){if(f[1]<e)return}else f=[(i-u)/a,i];o=[(e-u)/a,e]}else if(h<p){if(f){if(f[0]>=r)return}else f=[n,a*n+u];o=[r,a*r+u]}else{if(f){if(f[0]<n)return}else f=[r,a*r+u];o=[n,a*n+u]}return t[0]=f,t[1]=o,!0}function R_(t,n){var e=t.site,r=n.left,i=n.right;return e===i&&(i=r,r=e),i?Math.atan2(i[1]-r[1],i[0]-r[0]):(e===r?(r=n[1],i=n[0]):(r=n[0],i=n[1]),Math.atan2(r[0]-i[0],i[1]-r[1]))}function L_(t,n){return n[+(n.left!==t.site)]}function D_(t,n){return n[+(n.left===t.site)]}i_.prototype={areaStart:qy,areaEnd:qy,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,n){t=+t,n=+n,this._point?this._context.lineTo(t,n):(this._point=1,this._context.moveTo(t,n))}},c_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:f_(this,this._t0,u_(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){var e=NaN;if(n=+n,(t=+t)!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,f_(this,u_(this,e=a_(this,t,n)),e);break;default:f_(this,this._t0,e=a_(this,t,n))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n,this._t0=e}}},(s_.prototype=Object.create(c_.prototype)).point=function(t,n){c_.prototype.point.call(this,n,t)},l_.prototype={moveTo:function(t,n){this._context.moveTo(n,t)},closePath:function(){this._context.closePath()},lineTo:function(t,n){this._context.lineTo(n,t)},bezierCurveTo:function(t,n,e,r,i,o){this._context.bezierCurveTo(n,t,r,e,o,i)}},h_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,n=this._y,e=t.length;if(e)if(this._line?this._context.lineTo(t[0],n[0]):this._context.moveTo(t[0],n[0]),2===e)this._context.lineTo(t[1],n[1]);else for(var r=d_(t),i=d_(n),o=0,a=1;a<e;++o,++a)this._context.bezierCurveTo(r[0][o],i[0][o],r[1][o],i[1][o],t[a],n[a]);(this._line||0!==this._line&&1===e)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,n){this._x.push(+t),this._y.push(+n)}},p_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,n),this._context.lineTo(t,n);else{var e=this._x*(1-this._t)+t*this._t;this._context.lineTo(e,this._y),this._context.lineTo(e,n)}}this._x=t,this._y=n}},M_.prototype={constructor:M_,insert:function(t,n){var e,r,i;if(t){if(n.P=t,n.N=t.N,t.N&&(t.N.P=n),t.N=n,t.R){for(t=t.R;t.L;)t=t.L;t.L=n}else t.R=n;e=t}else this._?(t=S_(this._),n.P=null,n.N=t,t.P=t.L=n,e=t):(n.P=n.N=null,this._=n,e=null);for(n.L=n.R=null,n.U=e,n.C=!0,t=n;e&&e.C;)e===(r=e.U).L?(i=r.R)&&i.C?(e.C=i.C=!1,r.C=!0,t=r):(t===e.R&&(T_(this,e),e=(t=e).U),e.C=!1,r.C=!0,N_(this,r)):(i=r.L)&&i.C?(e.C=i.C=!1,r.C=!0,t=r):(t===e.L&&(N_(this,e),e=(t=e).U),e.C=!1,r.C=!0,T_(this,r)),e=t.U;this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P),t.P&&(t.P.N=t.N),t.N=t.P=null;var n,e,r,i=t.U,o=t.L,a=t.R;if(e=o?a?S_(a):o:a,i?i.L===t?i.L=e:i.R=e:this._=e,o&&a?(r=e.C,e.C=t.C,e.L=o,o.U=e,e!==a?(i=e.U,e.U=t.U,t=e.R,i.L=t,e.R=a,a.U=e):(e.U=i,i=e,t=e.R)):(r=t.C,t=e),t&&(t.U=i),!r)if(t&&t.C)t.C=!1;else{do{if(t===this._)break;if(t===i.L){if((n=i.R).C&&(n.C=!1,i.C=!0,T_(this,i),n=i.R),n.L&&n.L.C||n.R&&n.R.C){n.R&&n.R.C||(n.L.C=!1,n.C=!0,N_(this,n),n=i.R),n.C=i.C,i.C=n.R.C=!1,T_(this,i),t=this._;break}}else if((n=i.L).C&&(n.C=!1,i.C=!0,N_(this,i),n=i.L),n.L&&n.L.C||n.R&&n.R.C){n.L&&n.L.C||(n.R.C=!1,n.C=!0,T_(this,n),n=i.L),n.C=i.C,i.C=n.L.C=!1,N_(this,i),t=this._;break}n.C=!0,t=i,i=i.U}while(!t.C);t&&(t.C=!1)}}};var U_,q_=[];function O_(){A_(this),this.x=this.y=this.arc=this.site=this.cy=null}function Y_(t){var n=t.P,e=t.N;if(n&&e){var r=n.site,i=t.site,o=e.site;if(r!==o){var a=i[0],u=i[1],f=r[0]-a,c=r[1]-u,s=o[0]-a,l=o[1]-u,h=2*(f*l-c*s);if(!(h>=-tb)){var d=f*f+c*c,p=s*s+l*l,v=(l*d-c*p)/h,g=(f*p-s*d)/h,y=q_.pop()||new O_;y.arc=t,y.site=i,y.x=v+a,y.y=(y.cy=g+u)+Math.sqrt(v*v+g*g),t.circle=y;for(var _=null,b=Q_._;b;)if(y.y<b.y||y.y===b.y&&y.x<=b.x){if(!b.L){_=b.P;break}b=b.L}else{if(!b.R){_=b;break}b=b.R}Q_.insert(_,y),_||(U_=y)}}}}function B_(t){var n=t.circle;n&&(n.P||(U_=n.N),Q_.remove(n),q_.push(n),A_(n),t.circle=null)}var F_=[];function I_(){A_(this),this.edge=this.site=this.circle=null}function H_(t){var n=F_.pop()||new I_;return n.site=t,n}function j_(t){B_(t),W_.remove(t),F_.push(t),A_(t)}function X_(t){var n=t.circle,e=n.x,r=n.cy,i=[e,r],o=t.P,a=t.N,u=[t];j_(t);for(var f=o;f.circle&&Math.abs(e-f.circle.x)<K_&&Math.abs(r-f.circle.cy)<K_;)o=f.P,u.unshift(f),j_(f),f=o;u.unshift(f),B_(f);for(var c=a;c.circle&&Math.abs(e-c.circle.x)<K_&&Math.abs(r-c.circle.cy)<K_;)a=c.N,u.push(c),j_(c),c=a;u.push(c),B_(c);var s,l=u.length;for(s=1;s<l;++s)c=u[s],f=u[s-1],C_(c.edge,f.site,c.site,i);f=u[0],(c=u[l-1]).edge=E_(f.site,c.site,null,i),Y_(f),Y_(c)}function G_(t){for(var n,e,r,i,o=t[0],a=t[1],u=W_._;u;)if((r=V_(u,a)-o)>K_)u=u.L;else{if(!((i=o-$_(u,a))>K_)){r>-K_?(n=u.P,e=u):i>-K_?(n=u,e=u.N):n=e=u;break}if(!u.R){n=u;break}u=u.R}!function(t){Z_[t.index]={site:t,halfedges:[]}}(t);var f=H_(t);if(W_.insert(n,f),n||e){if(n===e)return B_(n),e=H_(n.site),W_.insert(f,e),f.edge=e.edge=E_(n.site,f.site),Y_(n),void Y_(e);if(e){B_(n),B_(e);var c=n.site,s=c[0],l=c[1],h=t[0]-s,d=t[1]-l,p=e.site,v=p[0]-s,g=p[1]-l,y=2*(h*g-d*v),_=h*h+d*d,b=v*v+g*g,m=[(g*_-d*b)/y+s,(h*b-v*_)/y+l];C_(e.edge,c,p,m),f.edge=E_(c,t,null,m),e.edge=E_(t,p,null,m),Y_(n),Y_(e)}else f.edge=E_(n.site,f.site)}}function V_(t,n){var e=t.site,r=e[0],i=e[1],o=i-n;if(!o)return r;var a=t.P;if(!a)return-1/0;var u=(e=a.site)[0],f=e[1],c=f-n;if(!c)return u;var s=u-r,l=1/o-1/c,h=s/c;return l?(-h+Math.sqrt(h*h-2*l*(s*s/(-2*c)-f+c/2+i-o/2)))/l+r:(r+u)/2}function $_(t,n){var e=t.N;if(e)return V_(e,n);var r=t.site;return r[1]===n?r[0]:1/0}var W_,Z_,Q_,J_,K_=1e-6,tb=1e-12;function nb(t,n){return n[1]-t[1]||n[0]-t[0]}function eb(t,n){var e,r,i,o=t.sort(nb).pop();for(J_=[],Z_=new Array(t.length),W_=new M_,Q_=new M_;;)if(i=U_,o&&(!i||o[1]<i.y||o[1]===i.y&&o[0]<i.x))o[0]===e&&o[1]===r||(G_(o),e=o[0],r=o[1]),o=t.pop();else{if(!i)break;X_(i.arc)}if(function(){for(var t,n,e,r,i=0,o=Z_.length;i<o;++i)if((t=Z_[i])&&(r=(n=t.halfedges).length)){var a=new Array(r),u=new Array(r);for(e=0;e<r;++e)a[e]=e,u[e]=R_(t,J_[n[e]]);for(a.sort(function(t,n){return u[n]-u[t]}),e=0;e<r;++e)u[e]=n[a[e]];for(e=0;e<r;++e)n[e]=u[e]}}(),n){var a=+n[0][0],u=+n[0][1],f=+n[1][0],c=+n[1][1];!function(t,n,e,r){for(var i,o=J_.length;o--;)z_(i=J_[o],t,n,e,r)&&P_(i,t,n,e,r)&&(Math.abs(i[0][0]-i[1][0])>K_||Math.abs(i[0][1]-i[1][1])>K_)||delete J_[o]}(a,u,f,c),function(t,n,e,r){var i,o,a,u,f,c,s,l,h,d,p,v,g=Z_.length,y=!0;for(i=0;i<g;++i)if(o=Z_[i]){for(a=o.site,u=(f=o.halfedges).length;u--;)J_[f[u]]||f.splice(u,1);for(u=0,c=f.length;u<c;)p=(d=D_(o,J_[f[u]]))[0],v=d[1],l=(s=L_(o,J_[f[++u%c]]))[0],h=s[1],(Math.abs(p-l)>K_||Math.abs(v-h)>K_)&&(f.splice(u,0,J_.push(k_(a,d,Math.abs(p-t)<K_&&r-v>K_?[t,Math.abs(l-t)<K_?h:r]:Math.abs(v-r)<K_&&e-p>K_?[Math.abs(h-r)<K_?l:e,r]:Math.abs(p-e)<K_&&v-n>K_?[e,Math.abs(l-e)<K_?h:n]:Math.abs(v-n)<K_&&p-t>K_?[Math.abs(h-n)<K_?l:t,n]:null))-1),++c);c&&(y=!1)}if(y){var _,b,m,x=1/0;for(i=0,y=null;i<g;++i)(o=Z_[i])&&(m=(_=(a=o.site)[0]-t)*_+(b=a[1]-n)*b)<x&&(x=m,y=o);if(y){var w=[t,n],M=[t,r],A=[e,r],T=[e,n];y.halfedges.push(J_.push(k_(a=y.site,w,M))-1,J_.push(k_(a,M,A))-1,J_.push(k_(a,A,T))-1,J_.push(k_(a,T,w))-1)}}for(i=0;i<g;++i)(o=Z_[i])&&(o.halfedges.length||delete Z_[i])}(a,u,f,c)}this.edges=J_,this.cells=Z_,W_=Q_=J_=Z_=null}function rb(t){return function(){return t}}function ib(t,n,e){this.target=t,this.type=n,this.transform=e}function ob(t,n,e){this.k=t,this.x=n,this.y=e}eb.prototype={constructor:eb,polygons:function(){var t=this.edges;return this.cells.map(function(n){var e=n.halfedges.map(function(e){return L_(n,t[e])});return e.data=n.site.data,e})},triangles:function(){var t=[],n=this.edges;return this.cells.forEach(function(e,r){if(o=(i=e.halfedges).length)for(var i,o,a,u,f,c,s=e.site,l=-1,h=n[i[o-1]],d=h.left===s?h.right:h.left;++l<o;)a=d,d=(h=n[i[l]]).left===s?h.right:h.left,a&&d&&r<a.index&&r<d.index&&(f=a,c=d,((u=s)[0]-c[0])*(f[1]-u[1])-(u[0]-f[0])*(c[1]-u[1])<0)&&t.push([s.data,a.data,d.data])}),t},links:function(){return this.edges.filter(function(t){return t.right}).map(function(t){return{source:t.left.data,target:t.right.data}})},find:function(t,n,e){for(var r,i,o=this,a=o._found||0,u=o.cells.length;!(i=o.cells[a]);)if(++a>=u)return null;var f=t-i.site[0],c=n-i.site[1],s=f*f+c*c;do{i=o.cells[r=a],a=null,i.halfedges.forEach(function(e){var r=o.edges[e],u=r.left;if(u!==i.site&&u||(u=r.right)){var f=t-u[0],c=n-u[1],l=f*f+c*c;l<s&&(s=l,a=u.index)}})}while(null!==a);return o._found=r,null==e||s<=e*e?i.site:null}},ob.prototype={constructor:ob,scale:function(t){return 1===t?this:new ob(this.k*t,this.x,this.y)},translate:function(t,n){return 0===t&0===n?this:new ob(this.k,this.x+this.k*t,this.y+this.k*n)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ab=new ob(1,0,0);function ub(t){return t.__zoom||ab}function fb(){t.event.stopImmediatePropagation()}function cb(){t.event.preventDefault(),t.event.stopImmediatePropagation()}function sb(){return!t.event.button}function lb(){var t,n,e=this;return e instanceof SVGElement?(t=(e=e.ownerSVGElement||e).width.baseVal.value,n=e.height.baseVal.value):(t=e.clientWidth,n=e.clientHeight),[[0,0],[t,n]]}function hb(){return this.__zoom||ab}function db(){return-t.event.deltaY*(t.event.deltaMode?120:1)/500}function pb(){return"ontouchstart"in this}function vb(t,n,e){var r=t.invertX(n[0][0])-e[0][0],i=t.invertX(n[1][0])-e[1][0],o=t.invertY(n[0][1])-e[0][1],a=t.invertY(n[1][1])-e[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}ub.prototype=ob.prototype,t.version="5.7.0",t.bisect=i,t.bisectRight=i,t.bisectLeft=o,t.ascending=n,t.bisector=e,t.cross=function(t,n,e){var r,i,o,u,f=t.length,c=n.length,s=new Array(f*c);for(null==e&&(e=a),r=o=0;r<f;++r)for(u=t[r],i=0;i<c;++i,++o)s[o]=e(u,n[i]);return s},t.descending=function(t,n){return n<t?-1:n>t?1:n>=t?0:NaN},t.deviation=c,t.extent=s,t.histogram=function(){var t=v,n=s,e=M;function r(r){var o,a,u=r.length,f=new Array(u);for(o=0;o<u;++o)f[o]=t(r[o],o,r);var c=n(f),s=c[0],l=c[1],h=e(f,s,l);Array.isArray(h)||(h=w(s,l,h),h=g(Math.ceil(s/h)*h,l,h));for(var d=h.length;h[0]<=s;)h.shift(),--d;for(;h[d-1]>l;)h.pop(),--d;var p,v=new Array(d+1);for(o=0;o<=d;++o)(p=v[o]=[]).x0=o>0?h[o-1]:s,p.x1=o<d?h[o]:l;for(o=0;o<u;++o)s<=(a=f[o])&&a<=l&&v[i(h,a,0,d)].push(r[o]);return v}return r.value=function(n){return arguments.length?(t="function"==typeof n?n:p(n),r):t},r.domain=function(t){return arguments.length?(n="function"==typeof t?t:p([t[0],t[1]]),r):n},r.thresholds=function(t){return arguments.length?(e="function"==typeof t?t:Array.isArray(t)?p(h.call(t)):p(t),r):e},r},t.thresholdFreedmanDiaconis=function(t,e,r){return t=d.call(t,u).sort(n),Math.ceil((r-e)/(2*(A(t,.75)-A(t,.25))*Math.pow(t.length,-1/3)))},t.thresholdScott=function(t,n,e){return Math.ceil((e-n)/(3.5*c(t)*Math.pow(t.length,-1/3)))},t.thresholdSturges=M,t.max=T,t.mean=function(t,n){var e,r=t.length,i=r,o=-1,a=0;if(null==n)for(;++o<r;)isNaN(e=u(t[o]))?--i:a+=e;else for(;++o<r;)isNaN(e=u(n(t[o],o,t)))?--i:a+=e;if(i)return a/i},t.median=function(t,e){var r,i=t.length,o=-1,a=[];if(null==e)for(;++o<i;)isNaN(r=u(t[o]))||a.push(r);else for(;++o<i;)isNaN(r=u(e(t[o],o,t)))||a.push(r);return A(a.sort(n),.5)},t.merge=N,t.min=S,t.pairs=function(t,n){null==n&&(n=a);for(var e=0,r=t.length-1,i=t[0],o=new Array(r<0?0:r);e<r;)o[e]=n(i,i=t[++e]);return o},t.permute=function(t,n){for(var e=n.length,r=new Array(e);e--;)r[e]=t[n[e]];return r},t.quantile=A,t.range=g,t.scan=function(t,e){if(r=t.length){var r,i,o=0,a=0,u=t[a];for(null==e&&(e=n);++o<r;)(e(i=t[o],u)<0||0!==e(u,u))&&(u=i,a=o);return 0===e(u,u)?a:void 0}},t.shuffle=function(t,n,e){for(var r,i,o=(null==e?t.length:e)-(n=null==n?0:+n);o;)i=Math.random()*o--|0,r=t[o+n],t[o+n]=t[i+n],t[i+n]=r;return t},t.sum=function(t,n){var e,r=t.length,i=-1,o=0;if(null==n)for(;++i<r;)(e=+t[i])&&(o+=e);else for(;++i<r;)(e=+n(t[i],i,t))&&(o+=e);return o},t.ticks=m,t.tickIncrement=x,t.tickStep=w,t.transpose=E,t.variance=f,t.zip=function(){return E(arguments)},t.axisTop=function(t){return B(z,t)},t.axisRight=function(t){return B(R,t)},t.axisBottom=function(t){return B(L,t)},t.axisLeft=function(t){return B(D,t)},t.brush=function(){return Ri(wi)},t.brushX=function(){return Ri(mi)},t.brushY=function(){return Ri(xi)},t.brushSelection=function(t){var n=t.__brush;return n?n.dim.output(n.selection):null},t.chord=function(){var t=0,n=null,e=null,r=null;function i(i){var o,a,u,f,c,s,l=i.length,h=[],d=g(l),p=[],v=[],y=v.groups=new Array(l),_=new Array(l*l);for(o=0,c=-1;++c<l;){for(a=0,s=-1;++s<l;)a+=i[c][s];h.push(a),p.push(g(l)),o+=a}for(n&&d.sort(function(t,e){return n(h[t],h[e])}),e&&p.forEach(function(t,n){t.sort(function(t,r){return e(i[n][t],i[n][r])})}),f=(o=Yi(0,Oi-t*l)/o)?t:Oi/l,a=0,c=-1;++c<l;){for(u=a,s=-1;++s<l;){var b=d[c],m=p[b][s],x=i[b][m],w=a,M=a+=x*o;_[m*l+b]={index:b,subindex:m,startAngle:w,endAngle:M,value:x}}y[b]={index:b,startAngle:u,endAngle:a,value:h[b]},a+=f}for(c=-1;++c<l;)for(s=c-1;++s<l;){var A=_[s*l+c],T=_[c*l+s];(A.value||T.value)&&v.push(A.value<T.value?{source:T,target:A}:{source:A,target:T})}return r?v.sort(r):v}return i.padAngle=function(n){return arguments.length?(t=Yi(0,n),i):t},i.sortGroups=function(t){return arguments.length?(n=t,i):n},i.sortSubgroups=function(t){return arguments.length?(e=t,i):e},i.sortChords=function(t){return arguments.length?(null==t?r=null:(n=t,r=function(t,e){return n(t.source.value+t.target.value,e.source.value+e.target.value)})._=t,i):r&&r._;var n},i},t.ribbon=function(){var t=Vi,n=$i,e=Wi,r=Zi,i=Qi,o=null;function a(){var a,u=Bi.call(arguments),f=t.apply(this,u),c=n.apply(this,u),s=+e.apply(this,(u[0]=f,u)),l=r.apply(this,u)-qi,h=i.apply(this,u)-qi,d=s*Li(l),p=s*Di(l),v=+e.apply(this,(u[0]=c,u)),g=r.apply(this,u)-qi,y=i.apply(this,u)-qi;if(o||(o=a=Gi()),o.moveTo(d,p),o.arc(0,0,s,l,h),l===g&&h===y||(o.quadraticCurveTo(0,0,v*Li(g),v*Di(g)),o.arc(0,0,v,g,y)),o.quadraticCurveTo(0,0,d,p),o.closePath(),a)return o=null,a+""||null}return a.radius=function(t){return arguments.length?(e="function"==typeof t?t:Fi(+t),a):e},a.startAngle=function(t){return arguments.length?(r="function"==typeof t?t:Fi(+t),a):r},a.endAngle=function(t){return arguments.length?(i="function"==typeof t?t:Fi(+t),a):i},a.source=function(n){return arguments.length?(t=n,a):t},a.target=function(t){return arguments.length?(n=t,a):n},a.context=function(t){return arguments.length?(o=null==t?null:t,a):o},a},t.nest=function(){var t,n,e,r=[],i=[];function o(e,i,a,u){if(i>=r.length)return null!=t&&e.sort(t),null!=n?n(e):e;for(var f,c,s,l=-1,h=e.length,d=r[i++],p=Ki(),v=a();++l<h;)(s=p.get(f=d(c=e[l])+""))?s.push(c):p.set(f,[c]);return p.each(function(t,n){u(v,n,o(t,i,a,u))}),v}return e={object:function(t){return o(t,0,to,no)},map:function(t){return o(t,0,eo,ro)},entries:function(t){return function t(e,o){if(++o>r.length)return e;var a,u=i[o-1];return null!=n&&o>=r.length?a=e.entries():(a=[],e.each(function(n,e){a.push({key:e,values:t(n,o)})})),null!=u?a.sort(function(t,n){return u(t.key,n.key)}):a}(o(t,0,eo,ro),0)},key:function(t){return r.push(t),e},sortKeys:function(t){return i[r.length-1]=t,e},sortValues:function(n){return t=n,e},rollup:function(t){return n=t,e}}},t.set=ao,t.map=Ki,t.keys=function(t){var n=[];for(var e in t)n.push(e);return n},t.values=function(t){var n=[];for(var e in t)n.push(t[e]);return n},t.entries=function(t){var n=[];for(var e in t)n.push({key:e,value:t[e]});return n},t.color=vn,t.rgb=bn,t.hsl=Mn,t.lab=Un,t.hcl=Hn,t.lch=function(t,n,e,r){return 1===arguments.length?In(t):new jn(e,n,t,null==r?1:r)},t.gray=function(t,n){return new qn(t,0,0,null==n?1:n)},t.cubehelix=Kn,t.contours=go,t.contourDensity=function(){var t=bo,n=mo,e=xo,r=960,i=500,o=20,a=2,u=3*o,f=r+2*u>>a,c=i+2*u>>a,s=co(20);function l(r){var i=new Float32Array(f*c),l=new Float32Array(f*c);r.forEach(function(r,o,s){var l=+t(r,o,s)+u>>a,h=+n(r,o,s)+u>>a,d=+e(r,o,s);l>=0&&l<f&&h>=0&&h<c&&(i[l+h*f]+=d)}),yo({width:f,height:c,data:i},{width:f,height:c,data:l},o>>a),_o({width:f,height:c,data:l},{width:f,height:c,data:i},o>>a),yo({width:f,height:c,data:i},{width:f,height:c,data:l},o>>a),_o({width:f,height:c,data:l},{width:f,height:c,data:i},o>>a),yo({width:f,height:c,data:i},{width:f,height:c,data:l},o>>a),_o({width:f,height:c,data:l},{width:f,height:c,data:i},o>>a);var d=s(i);if(!Array.isArray(d)){var p=T(i);d=w(0,p,d),(d=g(0,Math.floor(p/d)*d,d)).shift()}return go().thresholds(d).size([f,c])(i).map(h)}function h(t){return t.value*=Math.pow(2,-2*a),t.coordinates.forEach(d),t}function d(t){t.forEach(p)}function p(t){t.forEach(v)}function v(t){t[0]=t[0]*Math.pow(2,a)-u,t[1]=t[1]*Math.pow(2,a)-u}function y(){return f=r+2*(u=3*o)>>a,c=i+2*u>>a,l}return l.x=function(n){return arguments.length?(t="function"==typeof n?n:co(+n),l):t},l.y=function(t){return arguments.length?(n="function"==typeof t?t:co(+t),l):n},l.weight=function(t){return arguments.length?(e="function"==typeof t?t:co(+t),l):e},l.size=function(t){if(!arguments.length)return[r,i];var n=Math.ceil(t[0]),e=Math.ceil(t[1]);if(!(n>=0||n>=0))throw new Error("invalid size");return r=n,i=e,y()},l.cellSize=function(t){if(!arguments.length)return 1<<a;if(!((t=+t)>=1))throw new Error("invalid cell size");return a=Math.floor(Math.log(t)/Math.LN2),y()},l.thresholds=function(t){return arguments.length?(s="function"==typeof t?t:Array.isArray(t)?co(uo.call(t)):co(t),l):s},l.bandwidth=function(t){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((t=+t)>=0))throw new Error("invalid bandwidth");return o=Math.round((Math.sqrt(4*t*t+1)-1)/2),y()},l},t.dispatch=I,t.drag=function(){var n,e,r,i,o=Wt,a=Zt,u=Qt,f=Jt,c={},s=I("start","drag","end"),l=0,h=0;function d(t){t.on("mousedown.drag",p).filter(f).on("touchstart.drag",y).on("touchmove.drag",_).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(){if(!i&&o.apply(this,arguments)){var u=m("mouse",a.apply(this,arguments),Ft,this,arguments);u&&(Dt(t.event.view).on("mousemove.drag",v,!0).on("mouseup.drag",g,!0),Xt(t.event.view),Ht(),r=!1,n=t.event.clientX,e=t.event.clientY,u("start"))}}function v(){if(jt(),!r){var i=t.event.clientX-n,o=t.event.clientY-e;r=i*i+o*o>h}c.mouse("drag")}function g(){Dt(t.event.view).on("mousemove.drag mouseup.drag",null),Gt(t.event.view,r),jt(),c.mouse("end")}function y(){if(o.apply(this,arguments)){var n,e,r=t.event.changedTouches,i=a.apply(this,arguments),u=r.length;for(n=0;n<u;++n)(e=m(r[n].identifier,i,It,this,arguments))&&(Ht(),e("start"))}}function _(){var n,e,r=t.event.changedTouches,i=r.length;for(n=0;n<i;++n)(e=c[r[n].identifier])&&(jt(),e("drag"))}function b(){var n,e,r=t.event.changedTouches,o=r.length;for(i&&clearTimeout(i),i=setTimeout(function(){i=null},500),n=0;n<o;++n)(e=c[r[n].identifier])&&(Ht(),e("end"))}function m(n,e,r,i,o){var a,f,h,p=r(e,n),v=s.copy();if(Ct(new $t(d,"beforestart",a,n,l,p[0],p[1],0,0,v),function(){return null!=(t.event.subject=a=u.apply(i,o))&&(f=a.x-p[0]||0,h=a.y-p[1]||0,!0)}))return function t(u){var s,g=p;switch(u){case"start":c[n]=t,s=l++;break;case"end":delete c[n],--l;case"drag":p=r(e,n),s=l}Ct(new $t(d,u,a,n,s,p[0]+f,p[1]+h,p[0]-g[0],p[1]-g[1],v),v.apply,v,[u,i,o])}}return d.filter=function(t){return arguments.length?(o="function"==typeof t?t:Vt(!!t),d):o},d.container=function(t){return arguments.length?(a="function"==typeof t?t:Vt(t),d):a},d.subject=function(t){return arguments.length?(u="function"==typeof t?t:Vt(t),d):u},d.touchable=function(t){return arguments.length?(f="function"==typeof t?t:Vt(!!t),d):f},d.on=function(){var t=s.on.apply(s,arguments);return t===s?d:t},d.clickDistance=function(t){return arguments.length?(h=(t=+t)*t,d):Math.sqrt(h)},d},t.dragDisable=Xt,t.dragEnable=Gt,t.dsvFormat=Eo,t.csvParse=Co,t.csvParseRows=Po,t.csvFormat=zo,t.csvFormatRows=Ro,t.tsvParse=Do,t.tsvParseRows=Uo,t.tsvFormat=qo,t.tsvFormatRows=Oo,t.easeLinear=function(t){return+t},t.easeQuad=Dr,t.easeQuadIn=function(t){return t*t},t.easeQuadOut=function(t){return t*(2-t)},t.easeQuadInOut=Dr,t.easeCubic=Ur,t.easeCubicIn=function(t){return t*t*t},t.easeCubicOut=function(t){return--t*t*t+1},t.easeCubicInOut=Ur,t.easePoly=Yr,t.easePolyIn=qr,t.easePolyOut=Or,t.easePolyInOut=Yr,t.easeSin=Ir,t.easeSinIn=function(t){return 1-Math.cos(t*Fr)},t.easeSinOut=function(t){return Math.sin(t*Fr)},t.easeSinInOut=Ir,t.easeExp=Hr,t.easeExpIn=function(t){return Math.pow(2,10*t-10)},t.easeExpOut=function(t){return 1-Math.pow(2,-10*t)},t.easeExpInOut=Hr,t.easeCircle=jr,t.easeCircleIn=function(t){return 1-Math.sqrt(1-t*t)},t.easeCircleOut=function(t){return Math.sqrt(1- --t*t)},t.easeCircleInOut=jr,t.easeBounce=ni,t.easeBounceIn=function(t){return 1-ni(1-t)},t.easeBounceOut=ni,t.easeBounceInOut=function(t){return((t*=2)<=1?1-ni(1-t):ni(t-1)+1)/2},t.easeBack=ii,t.easeBackIn=ei,t.easeBackOut=ri,t.easeBackInOut=ii,t.easeElastic=ui,t.easeElasticIn=ai,t.easeElasticOut=ui,t.easeElasticInOut=fi,t.blob=function(t,n){return fetch(t,n).then(Yo)},t.buffer=function(t,n){return fetch(t,n).then(Bo)},t.dsv=function(t,n,e,r){3===arguments.length&&"function"==typeof e&&(r=e,e=void 0);var i=Eo(t);return Io(n,e).then(function(t){return i.parse(t,r)})},t.csv=jo,t.tsv=Xo,t.image=function(t,n){return new Promise(function(e,r){var i=new Image;for(var o in n)i[o]=n[o];i.onerror=r,i.onload=function(){e(i)},i.src=t})},t.json=function(t,n){return fetch(t,n).then(Go)},t.text=Io,t.xml=$o,t.html=Wo,t.svg=Zo,t.forceCenter=function(t,n){var e;function r(){var r,i,o=e.length,a=0,u=0;for(r=0;r<o;++r)a+=(i=e[r]).x,u+=i.y;for(a=a/o-t,u=u/o-n,r=0;r<o;++r)(i=e[r]).x-=a,i.y-=u}return null==t&&(t=0),null==n&&(n=0),r.initialize=function(t){e=t},r.x=function(n){return arguments.length?(t=+n,r):t},r.y=function(t){return arguments.length?(n=+t,r):n},r},t.forceCollide=function(t){var n,e,r=1,i=1;function o(){for(var t,o,u,f,c,s,l,h=n.length,d=0;d<i;++d)for(o=ra(n,ua,fa).visitAfter(a),t=0;t<h;++t)u=n[t],s=e[u.index],l=s*s,f=u.x+u.vx,c=u.y+u.vy,o.visit(p);function p(t,n,e,i,o){var a=t.data,h=t.r,d=s+h;if(!a)return n>f+d||i<f-d||e>c+d||o<c-d;if(a.index>u.index){var p=f-a.x-a.vx,v=c-a.y-a.vy,g=p*p+v*v;g<d*d&&(0===p&&(g+=(p=Jo())*p),0===v&&(g+=(v=Jo())*v),g=(d-(g=Math.sqrt(g)))/g*r,u.vx+=(p*=g)*(d=(h*=h)/(l+h)),u.vy+=(v*=g)*d,a.vx-=p*(d=1-d),a.vy-=v*d)}}}function a(t){if(t.data)return t.r=e[t.data.index];for(var n=t.r=0;n<4;++n)t[n]&&t[n].r>t.r&&(t.r=t[n].r)}function u(){if(n){var r,i,o=n.length;for(e=new Array(o),r=0;r<o;++r)i=n[r],e[i.index]=+t(i,r,n)}}return"function"!=typeof t&&(t=Qo(null==t?1:+t)),o.initialize=function(t){n=t,u()},o.iterations=function(t){return arguments.length?(i=+t,o):i},o.strength=function(t){return arguments.length?(r=+t,o):r},o.radius=function(n){return arguments.length?(t="function"==typeof n?n:Qo(+n),u(),o):t},o},t.forceLink=function(t){var n,e,r,i,o,a=ca,u=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},f=Qo(30),c=1;function s(r){for(var i=0,a=t.length;i<c;++i)for(var u,f,s,l,h,d,p,v=0;v<a;++v)f=(u=t[v]).source,l=(s=u.target).x+s.vx-f.x-f.vx||Jo(),h=s.y+s.vy-f.y-f.vy||Jo(),l*=d=((d=Math.sqrt(l*l+h*h))-e[v])/d*r*n[v],h*=d,s.vx-=l*(p=o[v]),s.vy-=h*p,f.vx+=l*(p=1-p),f.vy+=h*p}function l(){if(r){var u,f,c=r.length,s=t.length,l=Ki(r,a);for(u=0,i=new Array(c);u<s;++u)(f=t[u]).index=u,"object"!=typeof f.source&&(f.source=sa(l,f.source)),"object"!=typeof f.target&&(f.target=sa(l,f.target)),i[f.source.index]=(i[f.source.index]||0)+1,i[f.target.index]=(i[f.target.index]||0)+1;for(u=0,o=new Array(s);u<s;++u)f=t[u],o[u]=i[f.source.index]/(i[f.source.index]+i[f.target.index]);n=new Array(s),h(),e=new Array(s),d()}}function h(){if(r)for(var e=0,i=t.length;e<i;++e)n[e]=+u(t[e],e,t)}function d(){if(r)for(var n=0,i=t.length;n<i;++n)e[n]=+f(t[n],n,t)}return null==t&&(t=[]),s.initialize=function(t){r=t,l()},s.links=function(n){return arguments.length?(t=n,l(),s):t},s.id=function(t){return arguments.length?(a=t,s):a},s.iterations=function(t){return arguments.length?(c=+t,s):c},s.strength=function(t){return arguments.length?(u="function"==typeof t?t:Qo(+t),h(),s):u},s.distance=function(t){return arguments.length?(f="function"==typeof t?t:Qo(+t),d(),s):f},s},t.forceManyBody=function(){var t,n,e,r,i=Qo(-30),o=1,a=1/0,u=.81;function f(r){var i,o=t.length,a=ra(t,la,ha).visitAfter(s);for(e=r,i=0;i<o;++i)n=t[i],a.visit(l)}function c(){if(t){var n,e,o=t.length;for(r=new Array(o),n=0;n<o;++n)e=t[n],r[e.index]=+i(e,n,t)}}function s(t){var n,e,i,o,a,u=0,f=0;if(t.length){for(i=o=a=0;a<4;++a)(n=t[a])&&(e=Math.abs(n.value))&&(u+=n.value,f+=e,i+=e*n.x,o+=e*n.y);t.x=i/f,t.y=o/f}else{(n=t).x=n.data.x,n.y=n.data.y;do{u+=r[n.data.index]}while(n=n.next)}t.value=u}function l(t,i,f,c){if(!t.value)return!0;var s=t.x-n.x,l=t.y-n.y,h=c-i,d=s*s+l*l;if(h*h/u<d)return d<a&&(0===s&&(d+=(s=Jo())*s),0===l&&(d+=(l=Jo())*l),d<o&&(d=Math.sqrt(o*d)),n.vx+=s*t.value*e/d,n.vy+=l*t.value*e/d),!0;if(!(t.length||d>=a)){(t.data!==n||t.next)&&(0===s&&(d+=(s=Jo())*s),0===l&&(d+=(l=Jo())*l),d<o&&(d=Math.sqrt(o*d)));do{t.data!==n&&(h=r[t.data.index]*e/d,n.vx+=s*h,n.vy+=l*h)}while(t=t.next)}}return f.initialize=function(n){t=n,c()},f.strength=function(t){return arguments.length?(i="function"==typeof t?t:Qo(+t),c(),f):i},f.distanceMin=function(t){return arguments.length?(o=t*t,f):Math.sqrt(o)},f.distanceMax=function(t){return arguments.length?(a=t*t,f):Math.sqrt(a)},f.theta=function(t){return arguments.length?(u=t*t,f):Math.sqrt(u)},f},t.forceRadial=function(t,n,e){var r,i,o,a=Qo(.1);function u(t){for(var a=0,u=r.length;a<u;++a){var f=r[a],c=f.x-n||1e-6,s=f.y-e||1e-6,l=Math.sqrt(c*c+s*s),h=(o[a]-l)*i[a]*t/l;f.vx+=c*h,f.vy+=s*h}}function f(){if(r){var n,e=r.length;for(i=new Array(e),o=new Array(e),n=0;n<e;++n)o[n]=+t(r[n],n,r),i[n]=isNaN(o[n])?0:+a(r[n],n,r)}}return"function"!=typeof t&&(t=Qo(+t)),null==n&&(n=0),null==e&&(e=0),u.initialize=function(t){r=t,f()},u.strength=function(t){return arguments.length?(a="function"==typeof t?t:Qo(+t),f(),u):a},u.radius=function(n){return arguments.length?(t="function"==typeof n?n:Qo(+n),f(),u):t},u.x=function(t){return arguments.length?(n=+t,u):n},u.y=function(t){return arguments.length?(e=+t,u):e},u},t.forceSimulation=function(t){var n,e=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,u=Ki(),f=ur(s),c=I("tick","end");function s(){l(),c.call("tick",n),e<r&&(f.stop(),c.call("end",n))}function l(){var n,r,f=t.length;for(e+=(o-e)*i,u.each(function(t){t(e)}),n=0;n<f;++n)null==(r=t[n]).fx?r.x+=r.vx*=a:(r.x=r.fx,r.vx=0),null==r.fy?r.y+=r.vy*=a:(r.y=r.fy,r.vy=0)}function h(){for(var n,e=0,r=t.length;e<r;++e){if((n=t[e]).index=e,isNaN(n.x)||isNaN(n.y)){var i=da*Math.sqrt(e),o=e*pa;n.x=i*Math.cos(o),n.y=i*Math.sin(o)}(isNaN(n.vx)||isNaN(n.vy))&&(n.vx=n.vy=0)}}function d(n){return n.initialize&&n.initialize(t),n}return null==t&&(t=[]),h(),n={tick:l,restart:function(){return f.restart(s),n},stop:function(){return f.stop(),n},nodes:function(e){return arguments.length?(t=e,h(),u.each(d),n):t},alpha:function(t){return arguments.length?(e=+t,n):e},alphaMin:function(t){return arguments.length?(r=+t,n):r},alphaDecay:function(t){return arguments.length?(i=+t,n):+i},alphaTarget:function(t){return arguments.length?(o=+t,n):o},velocityDecay:function(t){return arguments.length?(a=1-t,n):1-a},force:function(t,e){return arguments.length>1?(null==e?u.remove(t):u.set(t,d(e)),n):u.get(t)},find:function(n,e,r){var i,o,a,u,f,c=0,s=t.length;for(null==r?r=1/0:r*=r,c=0;c<s;++c)(a=(i=n-(u=t[c]).x)*i+(o=e-u.y)*o)<r&&(f=u,r=a);return f},on:function(t,e){return arguments.length>1?(c.on(t,e),n):c.on(t)}}},t.forceX=function(t){var n,e,r,i=Qo(.1);function o(t){for(var i,o=0,a=n.length;o<a;++o)(i=n[o]).vx+=(r[o]-i.x)*e[o]*t}function a(){if(n){var o,a=n.length;for(e=new Array(a),r=new Array(a),o=0;o<a;++o)e[o]=isNaN(r[o]=+t(n[o],o,n))?0:+i(n[o],o,n)}}return"function"!=typeof t&&(t=Qo(null==t?0:+t)),o.initialize=function(t){n=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:Qo(+t),a(),o):i},o.x=function(n){return arguments.length?(t="function"==typeof n?n:Qo(+n),a(),o):t},o},t.forceY=function(t){var n,e,r,i=Qo(.1);function o(t){for(var i,o=0,a=n.length;o<a;++o)(i=n[o]).vy+=(r[o]-i.y)*e[o]*t}function a(){if(n){var o,a=n.length;for(e=new Array(a),r=new Array(a),o=0;o<a;++o)e[o]=isNaN(r[o]=+t(n[o],o,n))?0:+i(n[o],o,n)}}return"function"!=typeof t&&(t=Qo(null==t?0:+t)),o.initialize=function(t){n=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:Qo(+t),a(),o):i},o.y=function(n){return arguments.length?(t="function"==typeof n?n:Qo(+n),a(),o):t},o},t.formatDefaultLocale=Sa,t.formatLocale=Na,t.formatSpecifier=ba,t.precisionFixed=Ea,t.precisionPrefix=ka,t.precisionRound=Ca,t.geoArea=function(t){return yu.reset(),su(t,_u),2*yu},t.geoBounds=function(t){var n,e,r,i,o,a,u;if(Ru=zu=-(Cu=Pu=1/0),Ou=[],su(t,rf),e=Ou.length){for(Ou.sort(df),n=1,o=[r=Ou[0]];n<e;++n)pf(r,(i=Ou[n])[0])||pf(r,i[1])?(hf(r[0],i[1])>hf(r[0],r[1])&&(r[1]=i[1]),hf(i[0],r[1])>hf(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,n=0,r=o[e=o.length-1];n<=e;r=i,++n)i=o[n],(u=hf(r[1],i[0]))>a&&(a=u,Cu=i[0],zu=r[1])}return Ou=Yu=null,Cu===1/0||Pu===1/0?[[NaN,NaN],[NaN,NaN]]:[[Cu,Pu],[zu,Ru]]},t.geoCentroid=function(t){Bu=Fu=Iu=Hu=ju=Xu=Gu=Vu=$u=Wu=Zu=0,su(t,vf);var n=$u,e=Wu,r=Zu,i=n*n+e*e+r*r;return i<Ua&&(n=Xu,e=Gu,r=Vu,Fu<Da&&(n=Iu,e=Hu,r=ju),(i=n*n+e*e+r*r)<Ua)?[NaN,NaN]:[Xa(e,n)*Fa,eu(r/Ka(i))*Fa]},t.geoCircle=function(){var t,n,e=Nf([0,0]),r=Nf(90),i=Nf(6),o={point:function(e,r){t.push(e=n(e,r)),e[0]*=Fa,e[1]*=Fa}};function a(){var a=e.apply(this,arguments),u=r.apply(this,arguments)*Ia,f=i.apply(this,arguments)*Ia;return t=[],n=kf(-a[0]*Ia,-a[1]*Ia,0).invert,Lf(o,u,f,1),a={type:"Polygon",coordinates:[t]},t=n=null,a}return a.center=function(t){return arguments.length?(e="function"==typeof t?t:Nf([+t[0],+t[1]]),a):e},a.radius=function(t){return arguments.length?(r="function"==typeof t?t:Nf(+t),a):r},a.precision=function(t){return arguments.length?(i="function"==typeof t?t:Nf(+t),a):i},a},t.geoClipAntimeridian=Gf,t.geoClipCircle=Vf,t.geoClipExtent=function(){var t,n,e,r=0,i=0,o=960,a=500;return e={stream:function(e){return t&&n===e?t:t=Zf(r,i,o,a)(n=e)},extent:function(u){return arguments.length?(r=+u[0][0],i=+u[0][1],o=+u[1][0],a=+u[1][1],t=n=null,e):[[r,i],[o,a]]}}},t.geoClipRectangle=Zf,t.geoContains=function(t,n){return(t&&cc.hasOwnProperty(t.type)?cc[t.type]:lc)(t,n)},t.geoDistance=fc,t.geoGraticule=bc,t.geoGraticule10=function(){return bc()()},t.geoInterpolate=function(t,n){var e=t[0]*Ia,r=t[1]*Ia,i=n[0]*Ia,o=n[1]*Ia,a=Ga(r),u=Qa(r),f=Ga(o),c=Qa(o),s=a*Ga(e),l=a*Qa(e),h=f*Ga(i),d=f*Qa(i),p=2*eu(Ka(ru(o-r)+a*f*ru(i-e))),v=Qa(p),g=p?function(t){var n=Qa(t*=p)/v,e=Qa(p-t)/v,r=e*s+n*h,i=e*l+n*d,o=e*u+n*c;return[Xa(i,r)*Fa,Xa(o,Ka(r*r+i*i))*Fa]}:function(){return[e*Fa,r*Fa]};return g.distance=p,g},t.geoLength=oc,t.geoPath=function(t,n){var e,r,i=4.5;function o(t){return t&&("function"==typeof i&&r.pointRadius(+i.apply(this,arguments)),su(t,e(r))),r.result()}return o.area=function(t){return su(t,e(Sc)),Sc.result()},o.measure=function(t){return su(t,e(ds)),ds.result()},o.bounds=function(t){return su(t,e(Uc)),Uc.result()},o.centroid=function(t){return su(t,e(Zc)),Zc.result()},o.projection=function(n){return arguments.length?(e=null==n?(t=null,mc):(t=n).stream,o):t},o.context=function(t){return arguments.length?(r=null==t?(n=null,new gs):new as(n=t),"function"!=typeof i&&r.pointRadius(i),o):n},o.pointRadius=function(t){return arguments.length?(i="function"==typeof t?t:(r.pointRadius(+t),+t),o):i},o.projection(t).context(n)},t.geoAlbers=Ds,t.geoAlbersUsa=function(){var t,n,e,r,i,o,a=Ds(),u=Ls().rotate([154,0]).center([-2,58.5]).parallels([55,65]),f=Ls().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(t,n){o=[t,n]}};function s(t){var n=t[0],a=t[1];return o=null,e.point(n,a),o||(r.point(n,a),o)||(i.point(n,a),o)}function l(){return t=n=null,s}return s.invert=function(t){var n=a.scale(),e=a.translate(),r=(t[0]-e[0])/n,i=(t[1]-e[1])/n;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?u:i>=.166&&i<.234&&r>=-.214&&r<-.115?f:a).invert(t)},s.stream=function(e){return t&&n===e?t:(r=[a.stream(n=e),u.stream(e),f.stream(e)],i=r.length,t={point:function(t,n){for(var e=-1;++e<i;)r[e].point(t,n)},sphere:function(){for(var t=-1;++t<i;)r[t].sphere()},lineStart:function(){for(var t=-1;++t<i;)r[t].lineStart()},lineEnd:function(){for(var t=-1;++t<i;)r[t].lineEnd()},polygonStart:function(){for(var t=-1;++t<i;)r[t].polygonStart()},polygonEnd:function(){for(var t=-1;++t<i;)r[t].polygonEnd()}});var r,i},s.precision=function(t){return arguments.length?(a.precision(t),u.precision(t),f.precision(t),l()):a.precision()},s.scale=function(t){return arguments.length?(a.scale(t),u.scale(.35*t),f.scale(t),s.translate(a.translate())):a.scale()},s.translate=function(t){if(!arguments.length)return a.translate();var n=a.scale(),o=+t[0],s=+t[1];return e=a.translate(t).clipExtent([[o-.455*n,s-.238*n],[o+.455*n,s+.238*n]]).stream(c),r=u.translate([o-.307*n,s+.201*n]).clipExtent([[o-.425*n+Da,s+.12*n+Da],[o-.214*n-Da,s+.234*n-Da]]).stream(c),i=f.translate([o-.205*n,s+.212*n]).clipExtent([[o-.214*n+Da,s+.166*n+Da],[o-.115*n-Da,s+.234*n-Da]]).stream(c),l()},s.fitExtent=function(t,n){return xs(s,t,n)},s.fitSize=function(t,n){return ws(s,t,n)},s.fitWidth=function(t,n){return Ms(s,t,n)},s.fitHeight=function(t,n){return As(s,t,n)},s.scale(1070)},t.geoAzimuthalEqualArea=function(){return Cs(Os).scale(124.75).clipAngle(179.999)},t.geoAzimuthalEqualAreaRaw=Os,t.geoAzimuthalEquidistant=function(){return Cs(Ys).scale(79.4188).clipAngle(179.999)},t.geoAzimuthalEquidistantRaw=Ys,t.geoConicConformal=function(){return zs(Hs).scale(109.5).parallels([30,30])},t.geoConicConformalRaw=Hs,t.geoConicEqualArea=Ls,t.geoConicEqualAreaRaw=Rs,t.geoConicEquidistant=function(){return zs(Xs).scale(131.154).center([0,13.9389])},t.geoConicEquidistantRaw=Xs,t.geoEqualEarth=function(){return Cs(Qs).scale(177.158)},t.geoEqualEarthRaw=Qs,t.geoEquirectangular=function(){return Cs(js).scale(152.63)},t.geoEquirectangularRaw=js,t.geoGnomonic=function(){return Cs(Js).scale(144.049).clipAngle(60)},t.geoGnomonicRaw=Js,t.geoIdentity=function(){var t,n,e,r,i,o,a=1,u=0,f=0,c=1,s=1,l=mc,h=null,d=mc;function p(){return r=i=null,o}return o={stream:function(t){return r&&i===t?r:r=l(d(i=t))},postclip:function(r){return arguments.length?(d=r,h=t=n=e=null,p()):d},clipExtent:function(r){return arguments.length?(d=null==r?(h=t=n=e=null,mc):Zf(h=+r[0][0],t=+r[0][1],n=+r[1][0],e=+r[1][1]),p()):null==h?null:[[h,t],[n,e]]},scale:function(t){return arguments.length?(l=Ks((a=+t)*c,a*s,u,f),p()):a},translate:function(t){return arguments.length?(l=Ks(a*c,a*s,u=+t[0],f=+t[1]),p()):[u,f]},reflectX:function(t){return arguments.length?(l=Ks(a*(c=t?-1:1),a*s,u,f),p()):c<0},reflectY:function(t){return arguments.length?(l=Ks(a*c,a*(s=t?-1:1),u,f),p()):s<0},fitExtent:function(t,n){return xs(o,t,n)},fitSize:function(t,n){return ws(o,t,n)},fitWidth:function(t,n){return Ms(o,t,n)},fitHeight:function(t,n){return As(o,t,n)}}},t.geoProjection=Cs,t.geoProjectionMutator=Ps,t.geoMercator=function(){return Fs(Bs).scale(961/Ba)},t.geoMercatorRaw=Bs,t.geoNaturalEarth1=function(){return Cs(tl).scale(175.295)},t.geoNaturalEarth1Raw=tl,t.geoOrthographic=function(){return Cs(nl).scale(249.5).clipAngle(90+Da)},t.geoOrthographicRaw=nl,t.geoStereographic=function(){return Cs(el).scale(250).clipAngle(142)},t.geoStereographicRaw=el,t.geoTransverseMercator=function(){var t=Fs(rl),n=t.center,e=t.rotate;return t.center=function(t){return arguments.length?n([-t[1],t[0]]):[(t=n())[1],-t[0]]},t.rotate=function(t){return arguments.length?e([t[0],t[1],t.length>2?t[2]+90:90]):[(t=e())[0],t[1],t[2]-90]},e([0,0,90]).scale(159.155)},t.geoTransverseMercatorRaw=rl,t.geoRotation=Rf,t.geoStream=su,t.geoTransform=function(t){return{stream:_s(t)}},t.cluster=function(){var t=il,n=1,e=1,r=!1;function i(i){var o,a=0;i.eachAfter(function(n){var e=n.children;e?(n.x=function(t){return t.reduce(ol,0)/t.length}(e),n.y=function(t){return 1+t.reduce(al,0)}(e)):(n.x=o?a+=t(n,o):0,n.y=0,o=n)});var u=function(t){for(var n;n=t.children;)t=n[0];return t}(i),f=function(t){for(var n;n=t.children;)t=n[n.length-1];return t}(i),c=u.x-t(u,f)/2,s=f.x+t(f,u)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*n,t.y=(i.y-t.y)*e}:function(t){t.x=(t.x-c)/(s-c)*n,t.y=(1-(i.y?t.y/i.y:1))*e})}return i.separation=function(n){return arguments.length?(t=n,i):t},i.size=function(t){return arguments.length?(r=!1,n=+t[0],e=+t[1],i):r?null:[n,e]},i.nodeSize=function(t){return arguments.length?(r=!0,n=+t[0],e=+t[1],i):r?[n,e]:null},i},t.hierarchy=fl,t.pack=function(){var t=null,n=1,e=1,r=El;function i(i){return i.x=n/2,i.y=e/2,t?i.eachBefore(Pl(t)).eachAfter(zl(r,.5)).eachBefore(Rl(1)):i.eachBefore(Pl(Cl)).eachAfter(zl(El,1)).eachAfter(zl(r,i.r/Math.min(n,e))).eachBefore(Rl(Math.min(n,e)/(2*i.r))),i}return i.radius=function(n){return arguments.length?(t=null==(e=n)?null:Sl(e),i):t;var e},i.size=function(t){return arguments.length?(n=+t[0],e=+t[1],i):[n,e]},i.padding=function(t){return arguments.length?(r="function"==typeof t?t:kl(+t),i):r},i},t.packSiblings=function(t){return Nl(t),t},t.packEnclose=pl,t.partition=function(){var t=1,n=1,e=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=e,i.x1=t,i.y1=n/o,i.eachBefore(function(t,n){return function(r){r.children&&Dl(r,r.x0,t*(r.depth+1)/n,r.x1,t*(r.depth+2)/n);var i=r.x0,o=r.y0,a=r.x1-e,u=r.y1-e;a<i&&(i=a=(i+a)/2),u<o&&(o=u=(o+u)/2),r.x0=i,r.y0=o,r.x1=a,r.y1=u}}(n,o)),r&&i.eachBefore(Ll),i}return i.round=function(t){return arguments.length?(r=!!t,i):r},i.size=function(e){return arguments.length?(t=+e[0],n=+e[1],i):[t,n]},i.padding=function(t){return arguments.length?(e=+t,i):e},i},t.stratify=function(){var t=Yl,n=Bl;function e(e){var r,i,o,a,u,f,c,s=e.length,l=new Array(s),h={};for(i=0;i<s;++i)r=e[i],u=l[i]=new hl(r),null!=(f=t(r,i,e))&&(f+="")&&(h[c=Ul+(u.id=f)]=c in h?Ol:u);for(i=0;i<s;++i)if(u=l[i],null!=(f=n(e[i],i,e))&&(f+="")){if(!(a=h[Ul+f]))throw new Error("missing: "+f);if(a===Ol)throw new Error("ambiguous: "+f);a.children?a.children.push(u):a.children=[u],u.parent=a}else{if(o)throw new Error("multiple roots");o=u}if(!o)throw new Error("no root");if(o.parent=ql,o.eachBefore(function(t){t.depth=t.parent.depth+1,--s}).eachBefore(ll),o.parent=null,s>0)throw new Error("cycle");return o}return e.id=function(n){return arguments.length?(t=Sl(n),e):t},e.parentId=function(t){return arguments.length?(n=Sl(t),e):n},e},t.tree=function(){var t=Fl,n=1,e=1,r=null;function i(i){var f=function(t){for(var n,e,r,i,o,a=new Gl(t,0),u=[a];n=u.pop();)if(r=n._.children)for(n.children=new Array(o=r.length),i=o-1;i>=0;--i)u.push(e=n.children[i]=new Gl(r[i],i)),e.parent=n;return(a.parent=new Gl(null,0)).children=[a],a}(i);if(f.eachAfter(o),f.parent.m=-f.z,f.eachBefore(a),r)i.eachBefore(u);else{var c=i,s=i,l=i;i.eachBefore(function(t){t.x<c.x&&(c=t),t.x>s.x&&(s=t),t.depth>l.depth&&(l=t)});var h=c===s?1:t(c,s)/2,d=h-c.x,p=n/(s.x+h+d),v=e/(l.depth||1);i.eachBefore(function(t){t.x=(t.x+d)*p,t.y=t.depth*v})}return i}function o(n){var e=n.children,r=n.parent.children,i=n.i?r[n.i-1]:null;if(e){!function(t){for(var n,e=0,r=0,i=t.children,o=i.length;--o>=0;)(n=i[o]).z+=e,n.m+=e,e+=n.s+(r+=n.c)}(n);var o=(e[0].z+e[e.length-1].z)/2;i?(n.z=i.z+t(n._,i._),n.m=n.z-o):n.z=o}else i&&(n.z=i.z+t(n._,i._));n.parent.A=function(n,e,r){if(e){for(var i,o=n,a=n,u=e,f=o.parent.children[0],c=o.m,s=a.m,l=u.m,h=f.m;u=Hl(u),o=Il(o),u&&o;)f=Il(f),(a=Hl(a)).a=n,(i=u.z+l-o.z-c+t(u._,o._))>0&&(jl(Xl(u,n,r),n,i),c+=i,s+=i),l+=u.m,c+=o.m,h+=f.m,s+=a.m;u&&!Hl(a)&&(a.t=u,a.m+=l-s),o&&!Il(f)&&(f.t=o,f.m+=c-h,r=n)}return r}(n,i,n.parent.A||r[0])}function a(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function u(t){t.x*=n,t.y=t.depth*e}return i.separation=function(n){return arguments.length?(t=n,i):t},i.size=function(t){return arguments.length?(r=!1,n=+t[0],e=+t[1],i):r?null:[n,e]},i.nodeSize=function(t){return arguments.length?(r=!0,n=+t[0],e=+t[1],i):r?[n,e]:null},i},t.treemap=function(){var t=Zl,n=!1,e=1,r=1,i=[0],o=El,a=El,u=El,f=El,c=El;function s(t){return t.x0=t.y0=0,t.x1=e,t.y1=r,t.eachBefore(l),i=[0],n&&t.eachBefore(Ll),t}function l(n){var e=i[n.depth],r=n.x0+e,s=n.y0+e,l=n.x1-e,h=n.y1-e;l<r&&(r=l=(r+l)/2),h<s&&(s=h=(s+h)/2),n.x0=r,n.y0=s,n.x1=l,n.y1=h,n.children&&(e=i[n.depth+1]=o(n)/2,r+=c(n)-e,s+=a(n)-e,(l-=u(n)-e)<r&&(r=l=(r+l)/2),(h-=f(n)-e)<s&&(s=h=(s+h)/2),t(n,r,s,l,h))}return s.round=function(t){return arguments.length?(n=!!t,s):n},s.size=function(t){return arguments.length?(e=+t[0],r=+t[1],s):[e,r]},s.tile=function(n){return arguments.length?(t=Sl(n),s):t},s.padding=function(t){return arguments.length?s.paddingInner(t).paddingOuter(t):s.paddingInner()},s.paddingInner=function(t){return arguments.length?(o="function"==typeof t?t:kl(+t),s):o},s.paddingOuter=function(t){return arguments.length?s.paddingTop(t).paddingRight(t).paddingBottom(t).paddingLeft(t):s.paddingTop()},s.paddingTop=function(t){return arguments.length?(a="function"==typeof t?t:kl(+t),s):a},s.paddingRight=function(t){return arguments.length?(u="function"==typeof t?t:kl(+t),s):u},s.paddingBottom=function(t){return arguments.length?(f="function"==typeof t?t:kl(+t),s):f},s.paddingLeft=function(t){return arguments.length?(c="function"==typeof t?t:kl(+t),s):c},s},t.treemapBinary=function(t,n,e,r,i){var o,a,u=t.children,f=u.length,c=new Array(f+1);for(c[0]=a=o=0;o<f;++o)c[o+1]=a+=u[o].value;!function t(n,e,r,i,o,a,f){if(n>=e-1){var s=u[n];return s.x0=i,s.y0=o,s.x1=a,void(s.y1=f)}for(var l=c[n],h=r/2+l,d=n+1,p=e-1;d<p;){var v=d+p>>>1;c[v]<h?d=v+1:p=v}h-c[d-1]<c[d]-h&&n+1<d&&--d;var g=c[d]-l,y=r-g;if(a-i>f-o){var _=(i*y+a*g)/r;t(n,d,g,i,o,_,f),t(d,e,y,_,o,a,f)}else{var b=(o*y+f*g)/r;t(n,d,g,i,o,a,b),t(d,e,y,i,b,a,f)}}(0,f,t.value,n,e,r,i)},t.treemapDice=Dl,t.treemapSlice=Vl,t.treemapSliceDice=function(t,n,e,r,i){(1&t.depth?Vl:Dl)(t,n,e,r,i)},t.treemapSquarify=Zl,t.treemapResquarify=Ql,t.interpolate=me,t.interpolateArray=de,t.interpolateBasis=ee,t.interpolateBasisClosed=re,t.interpolateDate=pe,t.interpolateDiscrete=function(t){var n=t.length;return function(e){return t[Math.max(0,Math.min(n-1,Math.floor(e*n)))]}},t.interpolateHue=function(t,n){var e=ae(+t,+n);return function(t){var n=e(t);return n-360*Math.floor(n/360)}},t.interpolateNumber=ve,t.interpolateObject=ge,t.interpolateRound=xe,t.interpolateString=be,t.interpolateTransformCss=Ce,t.interpolateTransformSvg=Pe,t.interpolateZoom=qe,t.interpolateRgb=ce,t.interpolateRgbBasis=le,t.interpolateRgbBasisClosed=he,t.interpolateHsl=Ye,t.interpolateHslLong=Be,t.interpolateLab=function(t,n){var e=fe((t=Un(t)).l,(n=Un(n)).l),r=fe(t.a,n.a),i=fe(t.b,n.b),o=fe(t.opacity,n.opacity);return function(n){return t.l=e(n),t.a=r(n),t.b=i(n),t.opacity=o(n),t+""}},t.interpolateHcl=Ie,t.interpolateHclLong=He,t.interpolateCubehelix=Xe,t.interpolateCubehelixLong=Ge,t.piecewise=function(t,n){for(var e=0,r=n.length-1,i=n[0],o=new Array(r<0?0:r);e<r;)o[e]=t(i,i=n[++e]);return function(t){var n=Math.max(0,Math.min(r-1,Math.floor(t*=r)));return o[n](t-n)}},t.quantize=function(t,n){for(var e=new Array(n),r=0;r<n;++r)e[r]=t(r/(n-1));return e},t.path=Gi,t.polygonArea=function(t){for(var n,e=-1,r=t.length,i=t[r-1],o=0;++e<r;)n=i,i=t[e],o+=n[1]*i[0]-n[0]*i[1];return o/2},t.polygonCentroid=function(t){for(var n,e,r=-1,i=t.length,o=0,a=0,u=t[i-1],f=0;++r<i;)n=u,u=t[r],f+=e=n[0]*u[1]-u[0]*n[1],o+=(n[0]+u[0])*e,a+=(n[1]+u[1])*e;return[o/(f*=3),a/f]},t.polygonHull=function(t){if((e=t.length)<3)return null;var n,e,r=new Array(e),i=new Array(e);for(n=0;n<e;++n)r[n]=[+t[n][0],+t[n][1],n];for(r.sort(Jl),n=0;n<e;++n)i[n]=[r[n][0],-r[n][1]];var o=Kl(r),a=Kl(i),u=a[0]===o[0],f=a[a.length-1]===o[o.length-1],c=[];for(n=o.length-1;n>=0;--n)c.push(t[r[o[n]][2]]);for(n=+u;n<a.length-f;++n)c.push(t[r[a[n]][2]]);return c},t.polygonContains=function(t,n){for(var e,r,i=t.length,o=t[i-1],a=n[0],u=n[1],f=o[0],c=o[1],s=!1,l=0;l<i;++l)e=(o=t[l])[0],(r=o[1])>u!=c>u&&a<(f-e)*(u-r)/(c-r)+e&&(s=!s),f=e,c=r;return s},t.polygonLength=function(t){for(var n,e,r=-1,i=t.length,o=t[i-1],a=o[0],u=o[1],f=0;++r<i;)n=a,e=u,n-=a=(o=t[r])[0],e-=u=o[1],f+=Math.sqrt(n*n+e*e);return f},t.quadtree=ra,t.randomUniform=nh,t.randomNormal=eh,t.randomLogNormal=rh,t.randomBates=oh,t.randomIrwinHall=ih,t.randomExponential=ah,t.scaleBand=hh,t.scalePoint=function(){return function t(n){var e=n.copy;return n.padding=n.paddingOuter,delete n.paddingInner,delete n.paddingOuter,n.copy=function(){return t(e())},n}(hh().paddingInner(1))},t.scaleIdentity=function t(){var n=[0,1];function e(t){return+t}return e.invert=e,e.domain=e.range=function(t){return arguments.length?(n=fh.call(t,ph),e):n.slice()},e.copy=function(){return t().domain(n)},xh(e)},t.scaleLinear=function t(){var n=mh(gh,ve);return n.copy=function(){return bh(n,t())},xh(n)},t.scaleLog=function n(){var e=mh(Mh,Ah).domain([1,10]),r=e.domain,i=10,o=Sh(10),a=Nh(10);function u(){return o=Sh(i),a=Nh(i),r()[0]<0&&(o=Eh(o),a=Eh(a)),e}return e.base=function(t){return arguments.length?(i=+t,u()):i},e.domain=function(t){return arguments.length?(r(t),u()):r()},e.ticks=function(t){var n,e=r(),u=e[0],f=e[e.length-1];(n=f<u)&&(h=u,u=f,f=h);var c,s,l,h=o(u),d=o(f),p=null==t?10:+t,v=[];if(!(i%1)&&d-h<p){if(h=Math.round(h)-1,d=Math.round(d)+1,u>0){for(;h<d;++h)for(s=1,c=a(h);s<i;++s)if(!((l=c*s)<u)){if(l>f)break;v.push(l)}}else for(;h<d;++h)for(s=i-1,c=a(h);s>=1;--s)if(!((l=c*s)<u)){if(l>f)break;v.push(l)}}else v=m(h,d,Math.min(d-h,p)).map(a);return n?v.reverse():v},e.tickFormat=function(n,r){if(null==r&&(r=10===i?".0e":","),"function"!=typeof r&&(r=t.format(r)),n===1/0)return r;null==n&&(n=10);var u=Math.max(1,i*n/e.ticks().length);return function(t){var n=t/a(Math.round(o(t)));return n*i<i-.5&&(n*=i),n<=u?r(t):""}},e.nice=function(){return r(wh(r(),{floor:function(t){return a(Math.floor(o(t)))},ceil:function(t){return a(Math.ceil(o(t)))}}))},e.copy=function(){return bh(e,n().base(i))},e},t.scaleOrdinal=lh,t.scaleImplicit=sh,t.scalePow=Ch,t.scaleSqrt=function(){return Ch().exponent(.5)},t.scaleQuantile=function t(){var e=[],r=[],o=[];function a(){var t=0,n=Math.max(1,r.length);for(o=new Array(n-1);++t<n;)o[t-1]=A(e,t/n);return u}function u(t){if(!isNaN(t=+t))return r[i(o,t)]}return u.invertExtent=function(t){var n=r.indexOf(t);return n<0?[NaN,NaN]:[n>0?o[n-1]:e[0],n<o.length?o[n]:e[e.length-1]]},u.domain=function(t){if(!arguments.length)return e.slice();e=[];for(var r,i=0,o=t.length;i<o;++i)null==(r=t[i])||isNaN(r=+r)||e.push(r);return e.sort(n),a()},u.range=function(t){return arguments.length?(r=ch.call(t),a()):r.slice()},u.quantiles=function(){return o.slice()},u.copy=function(){return t().domain(e).range(r)},u},t.scaleQuantize=function t(){var n=0,e=1,r=1,o=[.5],a=[0,1];function u(t){if(t<=t)return a[i(o,t,0,r)]}function f(){var t=-1;for(o=new Array(r);++t<r;)o[t]=((t+1)*e-(t-r)*n)/(r+1);return u}return u.domain=function(t){return arguments.length?(n=+t[0],e=+t[1],f()):[n,e]},u.range=function(t){return arguments.length?(r=(a=ch.call(t)).length-1,f()):a.slice()},u.invertExtent=function(t){var i=a.indexOf(t);return i<0?[NaN,NaN]:i<1?[n,o[0]]:i>=r?[o[r-1],e]:[o[i-1],o[i]]},u.copy=function(){return t().domain([n,e]).range(a)},xh(u)},t.scaleThreshold=function t(){var n=[.5],e=[0,1],r=1;function o(t){if(t<=t)return e[i(n,t,0,r)]}return o.domain=function(t){return arguments.length?(n=ch.call(t),r=Math.min(n.length,e.length-1),o):n.slice()},o.range=function(t){return arguments.length?(e=ch.call(t),r=Math.min(n.length,e.length-1),o):e.slice()},o.invertExtent=function(t){var r=e.indexOf(t);return[n[r-1],n[r]]},o.copy=function(){return t().domain(n).range(e)},o},t.scaleTime=function(){return cv(cd,ud,Vh,jh,Ih,Bh,Oh,Lh,t.timeFormat).domain([new Date(2e3,0,1),new Date(2e3,0,2)])},t.scaleUtc=function(){return cv(Ld,zd,_d,vd,dd,ld,Oh,Lh,t.utcFormat).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)])},t.scaleSequential=function t(n){var e=0,r=1,i=1,o=!1;function a(t){var r=(t-e)*i;return n(o?Math.max(0,Math.min(1,r)):r)}return a.domain=function(t){return arguments.length?(e=+t[0],r=+t[1],i=e===r?0:1/(r-e),a):[e,r]},a.clamp=function(t){return arguments.length?(o=!!t,a):o},a.interpolator=function(t){return arguments.length?(n=t,a):n},a.copy=function(){return t(n).domain([e,r]).clamp(o)},xh(a)},t.scaleDiverging=function t(n){var e=0,r=.5,i=1,o=1,a=1,u=!1;function f(t){var e=.5+((t=+t)-r)*(t<r?o:a);return n(u?Math.max(0,Math.min(1,e)):e)}return f.domain=function(t){return arguments.length?(e=+t[0],r=+t[1],i=+t[2],o=e===r?0:.5/(r-e),a=r===i?0:.5/(i-r),f):[e,r,i]},f.clamp=function(t){return arguments.length?(u=!!t,f):u},f.interpolator=function(t){return arguments.length?(n=t,f):n},f.copy=function(){return t(n).domain([e,r,i]).clamp(u)},xh(f)},t.schemeCategory10=lv,t.schemeAccent=hv,t.schemeDark2=dv,t.schemePaired=pv,t.schemePastel1=vv,t.schemePastel2=gv,t.schemeSet1=yv,t.schemeSet2=_v,t.schemeSet3=bv,t.interpolateBrBG=wv,t.schemeBrBG=xv,t.interpolatePRGn=Av,t.schemePRGn=Mv,t.interpolatePiYG=Nv,t.schemePiYG=Tv,t.interpolatePuOr=Ev,t.schemePuOr=Sv,t.interpolateRdBu=Cv,t.schemeRdBu=kv,t.interpolateRdGy=zv,t.schemeRdGy=Pv,t.interpolateRdYlBu=Lv,t.schemeRdYlBu=Rv,t.interpolateRdYlGn=Uv,t.schemeRdYlGn=Dv,t.interpolateSpectral=Ov,t.schemeSpectral=qv,t.interpolateBuGn=Bv,t.schemeBuGn=Yv,t.interpolateBuPu=Iv,t.schemeBuPu=Fv,t.interpolateGnBu=jv,t.schemeGnBu=Hv,t.interpolateOrRd=Gv,t.schemeOrRd=Xv,t.interpolatePuBuGn=$v,t.schemePuBuGn=Vv,t.interpolatePuBu=Zv,t.schemePuBu=Wv,t.interpolatePuRd=Jv,t.schemePuRd=Qv,t.interpolateRdPu=tg,t.schemeRdPu=Kv,t.interpolateYlGnBu=eg,t.schemeYlGnBu=ng,t.interpolateYlGn=ig,t.schemeYlGn=rg,t.interpolateYlOrBr=ag,t.schemeYlOrBr=og,t.interpolateYlOrRd=fg,t.schemeYlOrRd=ug,t.interpolateBlues=sg,t.schemeBlues=cg,t.interpolateGreens=hg,t.schemeGreens=lg,t.interpolateGreys=pg,t.schemeGreys=dg,t.interpolatePurples=gg,t.schemePurples=vg,t.interpolateReds=_g,t.schemeReds=yg,t.interpolateOranges=mg,t.schemeOranges=bg,t.interpolateCubehelixDefault=xg,t.interpolateRainbow=function(t){(t<0||t>1)&&(t-=Math.floor(t));var n=Math.abs(t-.5);return Ag.h=360*t-100,Ag.s=1.5-1.5*n,Ag.l=.8-.9*n,Ag+""},t.interpolateWarm=wg,t.interpolateCool=Mg,t.interpolateSinebow=function(t){var n;return t=(.5-t)*Math.PI,Tg.r=255*(n=Math.sin(t))*n,Tg.g=255*(n=Math.sin(t+Ng))*n,Tg.b=255*(n=Math.sin(t+Sg))*n,Tg+""},t.interpolateViridis=kg,t.interpolateMagma=Cg,t.interpolateInferno=Pg,t.interpolatePlasma=zg,t.create=function(t){return Dt(W(t).call(document.documentElement))},t.creator=W,t.local=qt,t.matcher=rt,t.mouse=Ft,t.namespace=$,t.namespaces=V,t.clientPoint=Bt,t.select=Dt,t.selectAll=function(t){return"string"==typeof t?new Rt([document.querySelectorAll(t)],[document.documentElement]):new Rt([null==t?[]:t],zt)},t.selection=Lt,t.selector=Q,t.selectorAll=K,t.style=lt,t.touch=It,t.touches=function(t,n){null==n&&(n=Yt().touches);for(var e=0,r=n?n.length:0,i=new Array(r);e<r;++e)i[e]=Bt(t,n[e]);return i},t.window=st,t.customEvent=Ct,t.arc=function(){var t=Gg,n=Vg,e=Rg(0),r=null,i=$g,o=Wg,a=Zg,u=null;function f(){var f,c,s,l=+t.apply(this,arguments),h=+n.apply(this,arguments),d=i.apply(this,arguments)-Hg,p=o.apply(this,arguments)-Hg,v=Lg(p-d),g=p>d;if(u||(u=f=Gi()),h<l&&(c=h,h=l,l=c),h>Fg)if(v>jg-Fg)u.moveTo(h*Ug(d),h*Yg(d)),u.arc(0,0,h,d,p,!g),l>Fg&&(u.moveTo(l*Ug(p),l*Yg(p)),u.arc(0,0,l,p,d,g));else{var y,_,b=d,m=p,x=d,w=p,M=v,A=v,T=a.apply(this,arguments)/2,N=T>Fg&&(r?+r.apply(this,arguments):Bg(l*l+h*h)),S=Og(Lg(h-l)/2,+e.apply(this,arguments)),E=S,k=S;if(N>Fg){var C=Xg(N/l*Yg(T)),P=Xg(N/h*Yg(T));(M-=2*C)>Fg?(x+=C*=g?1:-1,w-=C):(M=0,x=w=(d+p)/2),(A-=2*P)>Fg?(b+=P*=g?1:-1,m-=P):(A=0,b=m=(d+p)/2)}var z=h*Ug(b),R=h*Yg(b),L=l*Ug(w),D=l*Yg(w);if(S>Fg){var U=h*Ug(m),q=h*Yg(m),O=l*Ug(x),Y=l*Yg(x);if(v<Ig){var B=M>Fg?function(t,n,e,r,i,o,a,u){var f=e-t,c=r-n,s=a-i,l=u-o,h=(s*(n-o)-l*(t-i))/(l*f-s*c);return[t+h*f,n+h*c]}(z,R,O,Y,U,q,L,D):[L,D],F=z-B[0],I=R-B[1],H=U-B[0],j=q-B[1],X=1/Yg(((s=(F*H+I*j)/(Bg(F*F+I*I)*Bg(H*H+j*j)))>1?0:s<-1?Ig:Math.acos(s))/2),G=Bg(B[0]*B[0]+B[1]*B[1]);E=Og(S,(l-G)/(X-1)),k=Og(S,(h-G)/(X+1))}}A>Fg?k>Fg?(y=Qg(O,Y,z,R,h,k,g),_=Qg(U,q,L,D,h,k,g),u.moveTo(y.cx+y.x01,y.cy+y.y01),k<S?u.arc(y.cx,y.cy,k,Dg(y.y01,y.x01),Dg(_.y01,_.x01),!g):(u.arc(y.cx,y.cy,k,Dg(y.y01,y.x01),Dg(y.y11,y.x11),!g),u.arc(0,0,h,Dg(y.cy+y.y11,y.cx+y.x11),Dg(_.cy+_.y11,_.cx+_.x11),!g),u.arc(_.cx,_.cy,k,Dg(_.y11,_.x11),Dg(_.y01,_.x01),!g))):(u.moveTo(z,R),u.arc(0,0,h,b,m,!g)):u.moveTo(z,R),l>Fg&&M>Fg?E>Fg?(y=Qg(L,D,U,q,l,-E,g),_=Qg(z,R,O,Y,l,-E,g),u.lineTo(y.cx+y.x01,y.cy+y.y01),E<S?u.arc(y.cx,y.cy,E,Dg(y.y01,y.x01),Dg(_.y01,_.x01),!g):(u.arc(y.cx,y.cy,E,Dg(y.y01,y.x01),Dg(y.y11,y.x11),!g),u.arc(0,0,l,Dg(y.cy+y.y11,y.cx+y.x11),Dg(_.cy+_.y11,_.cx+_.x11),g),u.arc(_.cx,_.cy,E,Dg(_.y11,_.x11),Dg(_.y01,_.x01),!g))):u.arc(0,0,l,w,x,g):u.lineTo(L,D)}else u.moveTo(0,0);if(u.closePath(),f)return u=null,f+""||null}return f.centroid=function(){var e=(+t.apply(this,arguments)+ +n.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +o.apply(this,arguments))/2-Ig/2;return[Ug(r)*e,Yg(r)*e]},f.innerRadius=function(n){return arguments.length?(t="function"==typeof n?n:Rg(+n),f):t},f.outerRadius=function(t){return arguments.length?(n="function"==typeof t?t:Rg(+t),f):n},f.cornerRadius=function(t){return arguments.length?(e="function"==typeof t?t:Rg(+t),f):e},f.padRadius=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:Rg(+t),f):r},f.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:Rg(+t),f):i},f.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:Rg(+t),f):o},f.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:Rg(+t),f):a},f.context=function(t){return arguments.length?(u=null==t?null:t,f):u},f},t.area=ry,t.line=ey,t.pie=function(){var t=oy,n=iy,e=null,r=Rg(0),i=Rg(jg),o=Rg(0);function a(a){var u,f,c,s,l,h=a.length,d=0,p=new Array(h),v=new Array(h),g=+r.apply(this,arguments),y=Math.min(jg,Math.max(-jg,i.apply(this,arguments)-g)),_=Math.min(Math.abs(y)/h,o.apply(this,arguments)),b=_*(y<0?-1:1);for(u=0;u<h;++u)(l=v[p[u]=u]=+t(a[u],u,a))>0&&(d+=l);for(null!=n?p.sort(function(t,e){return n(v[t],v[e])}):null!=e&&p.sort(function(t,n){return e(a[t],a[n])}),u=0,c=d?(y-h*b)/d:0;u<h;++u,g=s)f=p[u],s=g+((l=v[f])>0?l*c:0)+b,v[f]={data:a[f],index:u,value:l,startAngle:g,endAngle:s,padAngle:_};return v}return a.value=function(n){return arguments.length?(t="function"==typeof n?n:Rg(+n),a):t},a.sortValues=function(t){return arguments.length?(n=t,e=null,a):n},a.sort=function(t){return arguments.length?(e=t,n=null,a):e},a.startAngle=function(t){return arguments.length?(r="function"==typeof t?t:Rg(+t),a):r},a.endAngle=function(t){return arguments.length?(i="function"==typeof t?t:Rg(+t),a):i},a.padAngle=function(t){return arguments.length?(o="function"==typeof t?t:Rg(+t),a):o},a},t.areaRadial=ly,t.radialArea=ly,t.lineRadial=sy,t.radialLine=sy,t.pointRadial=hy,t.linkHorizontal=function(){return gy(yy)},t.linkVertical=function(){return gy(_y)},t.linkRadial=function(){var t=gy(by);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t},t.symbol=function(){var t=Rg(my),n=Rg(64),e=null;function r(){var r;if(e||(e=r=Gi()),t.apply(this,arguments).draw(e,+n.apply(this,arguments)),r)return e=null,r+""||null}return r.type=function(n){return arguments.length?(t="function"==typeof n?n:Rg(n),r):t},r.size=function(t){return arguments.length?(n="function"==typeof t?t:Rg(+t),r):n},r.context=function(t){return arguments.length?(e=null==t?null:t,r):e},r},t.symbols=Uy,t.symbolCircle=my,t.symbolCross=xy,t.symbolDiamond=Ay,t.symbolSquare=ky,t.symbolStar=Ey,t.symbolTriangle=Py,t.symbolWye=Dy,t.curveBasisClosed=function(t){return new By(t)},t.curveBasisOpen=function(t){return new Fy(t)},t.curveBasis=function(t){return new Yy(t)},t.curveBundle=Hy,t.curveCardinalClosed=$y,t.curveCardinalOpen=Zy,t.curveCardinal=Gy,t.curveCatmullRomClosed=n_,t.curveCatmullRomOpen=r_,t.curveCatmullRom=Ky,t.curveLinearClosed=function(t){return new i_(t)},t.curveLinear=Kg,t.curveMonotoneX=function(t){return new c_(t)},t.curveMonotoneY=function(t){return new s_(t)},t.curveNatural=function(t){return new h_(t)},t.curveStep=function(t){return new p_(t,.5)},t.curveStepAfter=function(t){return new p_(t,1)},t.curveStepBefore=function(t){return new p_(t,0)},t.stack=function(){var t=Rg([]),n=g_,e=v_,r=y_;function i(i){var o,a,u=t.apply(this,arguments),f=i.length,c=u.length,s=new Array(c);for(o=0;o<c;++o){for(var l,h=u[o],d=s[o]=new Array(f),p=0;p<f;++p)d[p]=l=[0,+r(i[p],h,p,i)],l.data=i[p];d.key=h}for(o=0,a=n(s);o<c;++o)s[a[o]].index=o;return e(s,a),s}return i.keys=function(n){return arguments.length?(t="function"==typeof n?n:Rg(dy.call(n)),i):t},i.value=function(t){return arguments.length?(r="function"==typeof t?t:Rg(+t),i):r},i.order=function(t){return arguments.length?(n=null==t?g_:"function"==typeof t?t:Rg(dy.call(t)),i):n},i.offset=function(t){return arguments.length?(e=null==t?v_:t,i):e},i},t.stackOffsetExpand=function(t,n){if((r=t.length)>0){for(var e,r,i,o=0,a=t[0].length;o<a;++o){for(i=e=0;e<r;++e)i+=t[e][o][1]||0;if(i)for(e=0;e<r;++e)t[e][o][1]/=i}v_(t,n)}},t.stackOffsetDiverging=function(t,n){if((u=t.length)>1)for(var e,r,i,o,a,u,f=0,c=t[n[0]].length;f<c;++f)for(o=a=0,e=0;e<u;++e)(i=(r=t[n[e]][f])[1]-r[0])>=0?(r[0]=o,r[1]=o+=i):i<0?(r[1]=a,r[0]=a+=i):r[0]=o},t.stackOffsetNone=v_,t.stackOffsetSilhouette=function(t,n){if((e=t.length)>0){for(var e,r=0,i=t[n[0]],o=i.length;r<o;++r){for(var a=0,u=0;a<e;++a)u+=t[a][r][1]||0;i[r][1]+=i[r][0]=-u/2}v_(t,n)}},t.stackOffsetWiggle=function(t,n){if((i=t.length)>0&&(r=(e=t[n[0]]).length)>0){for(var e,r,i,o=0,a=1;a<r;++a){for(var u=0,f=0,c=0;u<i;++u){for(var s=t[n[u]],l=s[a][1]||0,h=(l-(s[a-1][1]||0))/2,d=0;d<u;++d){var p=t[n[d]];h+=(p[a][1]||0)-(p[a-1][1]||0)}f+=l,c+=h*l}e[a-1][1]+=e[a-1][0]=o,f&&(o-=c/f)}e[a-1][1]+=e[a-1][0]=o,v_(t,n)}},t.stackOrderAscending=__,t.stackOrderDescending=function(t){return __(t).reverse()},t.stackOrderInsideOut=function(t){var n,e,r=t.length,i=t.map(b_),o=g_(t).sort(function(t,n){return i[n]-i[t]}),a=0,u=0,f=[],c=[];for(n=0;n<r;++n)e=o[n],a<u?(a+=i[e],f.push(e)):(u+=i[e],c.push(e));return c.reverse().concat(f)},t.stackOrderNone=g_,t.stackOrderReverse=function(t){return g_(t).reverse()},t.timeInterval=Rh,t.timeMillisecond=Lh,t.timeMilliseconds=Dh,t.utcMillisecond=Lh,t.utcMilliseconds=Dh,t.timeSecond=Oh,t.timeSeconds=Yh,t.utcSecond=Oh,t.utcSeconds=Yh,t.timeMinute=Bh,t.timeMinutes=Fh,t.timeHour=Ih,t.timeHours=Hh,t.timeDay=jh,t.timeDays=Xh,t.timeWeek=Vh,t.timeWeeks=td,t.timeSunday=Vh,t.timeSundays=td,t.timeMonday=$h,t.timeMondays=nd,t.timeTuesday=Wh,t.timeTuesdays=ed,t.timeWednesday=Zh,t.timeWednesdays=rd,t.timeThursday=Qh,t.timeThursdays=id,t.timeFriday=Jh,t.timeFridays=od,t.timeSaturday=Kh,t.timeSaturdays=ad,t.timeMonth=ud,t.timeMonths=fd,t.timeYear=cd,t.timeYears=sd,t.utcMinute=ld,t.utcMinutes=hd,t.utcHour=dd,t.utcHours=pd,t.utcDay=vd,t.utcDays=gd,t.utcWeek=_d,t.utcWeeks=Td,t.utcSunday=_d,t.utcSundays=Td,t.utcMonday=bd,t.utcMondays=Nd,t.utcTuesday=md,t.utcTuesdays=Sd,t.utcWednesday=xd,t.utcWednesdays=Ed,t.utcThursday=wd,t.utcThursdays=kd,t.utcFriday=Md,t.utcFridays=Cd,t.utcSaturday=Ad,t.utcSaturdays=Pd,t.utcMonth=zd,t.utcMonths=Rd,t.utcYear=Ld,t.utcYears=Dd,t.timeFormatDefaultLocale=Qp,t.timeFormatLocale=Yd,t.isoFormat=Jp,t.isoParse=Kp,t.now=ir,t.timer=ur,t.timerFlush=fr,t.timeout=hr,t.interval=function(t,n,e){var r=new ar,i=n;return null==n?(r.restart(t,n,e),r):(n=+n,e=null==e?ir():+e,r.restart(function o(a){a+=i,r.restart(o,i+=n,e),t(a)},n,e),r)},t.transition=zr,t.active=function(t,n){var e,r,i=t.__transition;if(i)for(r in n=null==n?null:n+"",i)if((e=i[r]).state>gr&&e.name===n)return new Pr([[t]],li,n,+r);return null},t.interrupt=Nr,t.voronoi=function(){var t=x_,n=w_,e=null;function r(r){return new eb(r.map(function(e,i){var o=[Math.round(t(e,i,r)/K_)*K_,Math.round(n(e,i,r)/K_)*K_];return o.index=i,o.data=e,o}),e)}return r.polygons=function(t){return r(t).polygons()},r.links=function(t){return r(t).links()},r.triangles=function(t){return r(t).triangles()},r.x=function(n){return arguments.length?(t="function"==typeof n?n:m_(+n),r):t},r.y=function(t){return arguments.length?(n="function"==typeof t?t:m_(+t),r):n},r.extent=function(t){return arguments.length?(e=null==t?null:[[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]],r):e&&[[e[0][0],e[0][1]],[e[1][0],e[1][1]]]},r.size=function(t){return arguments.length?(e=null==t?null:[[0,0],[+t[0],+t[1]]],r):e&&[e[1][0]-e[0][0],e[1][1]-e[0][1]]},r},t.zoom=function(){var n,e,r=sb,i=lb,o=vb,a=db,u=pb,f=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],s=250,l=qe,h=[],d=I("start","zoom","end"),p=500,v=150,g=0;function y(t){t.property("__zoom",hb).on("wheel.zoom",A).on("mousedown.zoom",T).on("dblclick.zoom",N).filter(u).on("touchstart.zoom",S).on("touchmove.zoom",E).on("touchend.zoom touchcancel.zoom",k).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function _(t,n){return(n=Math.max(f[0],Math.min(f[1],n)))===t.k?t:new ob(n,t.x,t.y)}function b(t,n,e){var r=n[0]-e[0]*t.k,i=n[1]-e[1]*t.k;return r===t.x&&i===t.y?t:new ob(t.k,r,i)}function m(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function x(t,n,e){t.on("start.zoom",function(){w(this,arguments).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).end()}).tween("zoom",function(){var t=arguments,r=w(this,t),o=i.apply(this,t),a=e||m(o),u=Math.max(o[1][0]-o[0][0],o[1][1]-o[0][1]),f=this.__zoom,c="function"==typeof n?n.apply(this,t):n,s=l(f.invert(a).concat(u/f.k),c.invert(a).concat(u/c.k));return function(t){if(1===t)t=c;else{var n=s(t),e=u/n[2];t=new ob(e,a[0]-n[0]*e,a[1]-n[1]*e)}r.zoom(null,t)}})}function w(t,n){for(var e,r=0,i=h.length;r<i;++r)if((e=h[r]).that===t)return e;return new M(t,n)}function M(t,n){this.that=t,this.args=n,this.index=-1,this.active=0,this.extent=i.apply(t,n)}function A(){if(r.apply(this,arguments)){var t=w(this,arguments),n=this.__zoom,e=Math.max(f[0],Math.min(f[1],n.k*Math.pow(2,a.apply(this,arguments)))),i=Ft(this);if(t.wheel)t.mouse[0][0]===i[0]&&t.mouse[0][1]===i[1]||(t.mouse[1]=n.invert(t.mouse[0]=i)),clearTimeout(t.wheel);else{if(n.k===e)return;t.mouse=[i,n.invert(i)],Nr(this),t.start()}cb(),t.wheel=setTimeout(function(){t.wheel=null,t.end()},v),t.zoom("mouse",o(b(_(n,e),t.mouse[0],t.mouse[1]),t.extent,c))}}function T(){if(!e&&r.apply(this,arguments)){var n=w(this,arguments),i=Dt(t.event.view).on("mousemove.zoom",function(){if(cb(),!n.moved){var e=t.event.clientX-u,r=t.event.clientY-f;n.moved=e*e+r*r>g}n.zoom("mouse",o(b(n.that.__zoom,n.mouse[0]=Ft(n.that),n.mouse[1]),n.extent,c))},!0).on("mouseup.zoom",function(){i.on("mousemove.zoom mouseup.zoom",null),Gt(t.event.view,n.moved),cb(),n.end()},!0),a=Ft(this),u=t.event.clientX,f=t.event.clientY;Xt(t.event.view),fb(),n.mouse=[a,this.__zoom.invert(a)],Nr(this),n.start()}}function N(){if(r.apply(this,arguments)){var n=this.__zoom,e=Ft(this),a=n.invert(e),u=n.k*(t.event.shiftKey?.5:2),f=o(b(_(n,u),e,a),i.apply(this,arguments),c);cb(),s>0?Dt(this).transition().duration(s).call(x,f,e):Dt(this).call(y.transform,f)}}function S(){if(r.apply(this,arguments)){var e,i,o,a,u=w(this,arguments),f=t.event.changedTouches,c=f.length;for(fb(),i=0;i<c;++i)a=[a=It(this,f,(o=f[i]).identifier),this.__zoom.invert(a),o.identifier],u.touch0?u.touch1||(u.touch1=a):(u.touch0=a,e=!0);if(n&&(n=clearTimeout(n),!u.touch1))return u.end(),void((a=Dt(this).on("dblclick.zoom"))&&a.apply(this,arguments));e&&(n=setTimeout(function(){n=null},p),Nr(this),u.start())}}function E(){var e,r,i,a,u=w(this,arguments),f=t.event.changedTouches,s=f.length;for(cb(),n&&(n=clearTimeout(n)),e=0;e<s;++e)i=It(this,f,(r=f[e]).identifier),u.touch0&&u.touch0[2]===r.identifier?u.touch0[0]=i:u.touch1&&u.touch1[2]===r.identifier&&(u.touch1[0]=i);if(r=u.that.__zoom,u.touch1){var l=u.touch0[0],h=u.touch0[1],d=u.touch1[0],p=u.touch1[1],v=(v=d[0]-l[0])*v+(v=d[1]-l[1])*v,g=(g=p[0]-h[0])*g+(g=p[1]-h[1])*g;r=_(r,Math.sqrt(v/g)),i=[(l[0]+d[0])/2,(l[1]+d[1])/2],a=[(h[0]+p[0])/2,(h[1]+p[1])/2]}else{if(!u.touch0)return;i=u.touch0[0],a=u.touch0[1]}u.zoom("touch",o(b(r,i,a),u.extent,c))}function k(){var n,r,i=w(this,arguments),o=t.event.changedTouches,a=o.length;for(fb(),e&&clearTimeout(e),e=setTimeout(function(){e=null},p),n=0;n<a;++n)r=o[n],i.touch0&&i.touch0[2]===r.identifier?delete i.touch0:i.touch1&&i.touch1[2]===r.identifier&&delete i.touch1;i.touch1&&!i.touch0&&(i.touch0=i.touch1,delete i.touch1),i.touch0?i.touch0[1]=this.__zoom.invert(i.touch0[0]):i.end()}return y.transform=function(t,n){var e=t.selection?t.selection():t;e.property("__zoom",hb),t!==e?x(t,n):e.interrupt().each(function(){w(this,arguments).start().zoom(null,"function"==typeof n?n.apply(this,arguments):n).end()})},y.scaleBy=function(t,n){y.scaleTo(t,function(){return this.__zoom.k*("function"==typeof n?n.apply(this,arguments):n)})},y.scaleTo=function(t,n){y.transform(t,function(){var t=i.apply(this,arguments),e=this.__zoom,r=m(t),a=e.invert(r),u="function"==typeof n?n.apply(this,arguments):n;return o(b(_(e,u),r,a),t,c)})},y.translateBy=function(t,n,e){y.transform(t,function(){return o(this.__zoom.translate("function"==typeof n?n.apply(this,arguments):n,"function"==typeof e?e.apply(this,arguments):e),i.apply(this,arguments),c)})},y.translateTo=function(t,n,e){y.transform(t,function(){var t=i.apply(this,arguments),r=this.__zoom,a=m(t);return o(ab.translate(a[0],a[1]).scale(r.k).translate("function"==typeof n?-n.apply(this,arguments):-n,"function"==typeof e?-e.apply(this,arguments):-e),t,c)})},M.prototype={start:function(){return 1==++this.active&&(this.index=h.push(this)-1,this.emit("start")),this},zoom:function(t,n){return this.mouse&&"mouse"!==t&&(this.mouse[1]=n.invert(this.mouse[0])),this.touch0&&"touch"!==t&&(this.touch0[1]=n.invert(this.touch0[0])),this.touch1&&"touch"!==t&&(this.touch1[1]=n.invert(this.touch1[0])),this.that.__zoom=n,this.emit("zoom"),this},end:function(){return 0==--this.active&&(h.splice(this.index,1),this.index=-1,this.emit("end")),this},emit:function(t){Ct(new ib(y,t,this.that.__zoom),d.apply,d,[t,this.that,this.args])}},y.wheelDelta=function(t){return arguments.length?(a="function"==typeof t?t:rb(+t),y):a},y.filter=function(t){return arguments.length?(r="function"==typeof t?t:rb(!!t),y):r},y.touchable=function(t){return arguments.length?(u="function"==typeof t?t:rb(!!t),y):u},y.extent=function(t){return arguments.length?(i="function"==typeof t?t:rb([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),y):i},y.scaleExtent=function(t){return arguments.length?(f[0]=+t[0],f[1]=+t[1],y):[f[0],f[1]]},y.translateExtent=function(t){return arguments.length?(c[0][0]=+t[0][0],c[1][0]=+t[1][0],c[0][1]=+t[0][1],c[1][1]=+t[1][1],y):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},y.constrain=function(t){return arguments.length?(o=t,y):o},y.duration=function(t){return arguments.length?(s=+t,y):s},y.interpolate=function(t){return arguments.length?(l=t,y):l},y.on=function(){var t=d.on.apply(d,arguments);return t===d?y:t},y.clickDistance=function(t){return arguments.length?(g=(t=+t)*t,y):Math.sqrt(g)},y},t.zoomTransform=ub,t.zoomIdentity=ab,Object.defineProperty(t,"__esModule",{value:!0})});

var numeric=typeof exports==="undefined"?function numeric(){}:exports;if(typeof global!=="undefined")global.numeric=numeric;numeric.version="1.2.6";numeric.bench=function bench(f,interval){var t1,t2,n,i;if(typeof interval==="undefined")interval=15;n=.5;t1=new Date;while(1){n*=2;for(i=n;i>3;i-=4){f();f();f();f()}while(i>0){f();i--}t2=new Date;if(t2-t1>interval)break}for(i=n;i>3;i-=4){f();f();f();f()}while(i>0){f();i--}t2=new Date;return 1E3*(3*n-1)/(t2-t1)};
numeric._myIndexOf=function _myIndexOf(w){var n=this.length,k;for(k=0;k<n;++k)if(this[k]===w)return k;return-1};numeric.myIndexOf=Array.prototype.indexOf?Array.prototype.indexOf:numeric._myIndexOf;numeric.Function=Function;numeric.precision=4;numeric.largeArray=50;
numeric.prettyPrint=function prettyPrint(x){function fmtnum(x){if(x===0)return"0";if(isNaN(x))return"NaN";if(x<0)return"-"+fmtnum(-x);if(isFinite(x)){var scale=Math.floor(Math.log(x)/Math.log(10));var normalized=x/Math.pow(10,scale);var basic=normalized.toPrecision(numeric.precision);if(parseFloat(basic)===10){scale++;normalized=1;basic=normalized.toPrecision(numeric.precision)}return parseFloat(basic).toString()+"e"+scale.toString()}return"Infinity"}var ret=[];function foo(x){var k;if(typeof x===
"undefined"){ret.push(Array(numeric.precision+8).join(" "));return false}if(typeof x==="string"){ret.push('"'+x+'"');return false}if(typeof x==="boolean"){ret.push(x.toString());return false}if(typeof x==="number"){var a=fmtnum(x);var b=x.toPrecision(numeric.precision);var c=parseFloat(x.toString()).toString();var d=[a,b,c,parseFloat(b).toString(),parseFloat(c).toString()];for(k=1;k<d.length;k++)if(d[k].length<a.length)a=d[k];ret.push(Array(numeric.precision+8-a.length).join(" ")+a);return false}if(x===
null){ret.push("null");return false}if(typeof x==="function"){ret.push(x.toString());var flag=false;for(k in x)if(x.hasOwnProperty(k)){if(flag)ret.push(",\n");else ret.push("\n{");flag=true;ret.push(k);ret.push(": \n");foo(x[k])}if(flag)ret.push("}\n");return true}if(x instanceof Array){if(x.length>numeric.largeArray){ret.push("...Large Array...");return true}var flag=false;ret.push("[");for(k=0;k<x.length;k++){if(k>0){ret.push(",");if(flag)ret.push("\n ")}flag=foo(x[k])}ret.push("]");return true}ret.push("{");
var flag=false;for(k in x)if(x.hasOwnProperty(k)){if(flag)ret.push(",\n");flag=true;ret.push(k);ret.push(": \n");foo(x[k])}ret.push("}");return true}foo(x);return ret.join("")};numeric.parseDate=function parseDate(d){function foo(d){if(typeof d==="string")return Date.parse(d.replace(/-/g,"/"));if(!(d instanceof Array))throw new Error("parseDate: parameter must be arrays of strings");var ret=[],k;for(k=0;k<d.length;k++)ret[k]=foo(d[k]);return ret}return foo(d)};
numeric.parseFloat=function parseFloat_(d){function foo(d){if(typeof d==="string")return parseFloat(d);if(!(d instanceof Array))throw new Error("parseFloat: parameter must be arrays of strings");var ret=[],k;for(k=0;k<d.length;k++)ret[k]=foo(d[k]);return ret}return foo(d)};
numeric.parseCSV=function parseCSV(t){var foo=t.split("\n");var j,k;var ret=[];var pat=/(([^'",]*)|('[^']*')|("[^"]*")),/g;var patnum=/^\s*(([+-]?[0-9]+(\.[0-9]*)?(e[+-]?[0-9]+)?)|([+-]?[0-9]*(\.[0-9]+)?(e[+-]?[0-9]+)?))\s*$/;var stripper=function(n){return n.substr(0,n.length-1)};var count=0;for(k=0;k<foo.length;k++){var bar=(foo[k]+",").match(pat),baz;if(bar.length>0){ret[count]=[];for(j=0;j<bar.length;j++){baz=stripper(bar[j]);if(patnum.test(baz))ret[count][j]=parseFloat(baz);else ret[count][j]=
baz}count++}}return ret};numeric.toCSV=function toCSV(A){var s=numeric.dim(A);var i,j,m,n,row,ret;m=s[0];n=s[1];ret=[];for(i=0;i<m;i++){row=[];for(j=0;j<m;j++)row[j]=A[i][j].toString();ret[i]=row.join(", ")}return ret.join("\n")+"\n"};numeric.getURL=function getURL(url){var client=new XMLHttpRequest;client.open("GET",url,false);client.send();return client};
numeric.imageURL=function imageURL(img){function base64(A){var n=A.length,i,x,y,z,p,q,r,s;var key="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\x3d";var ret="";for(i=0;i<n;i+=3){x=A[i];y=A[i+1];z=A[i+2];p=x>>2;q=((x&3)<<4)+(y>>4);r=((y&15)<<2)+(z>>6);s=z&63;if(i+1>=n)r=s=64;else if(i+2>=n)s=64;ret+=key.charAt(p)+key.charAt(q)+key.charAt(r)+key.charAt(s)}return ret}function crc32Array(a,from,to){if(typeof from==="undefined")from=0;if(typeof to==="undefined")to=a.length;var table=
[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,
651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,
4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,
167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,
3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918E3,
2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];var crc=-1,y=0,n=a.length,i;for(i=from;i<to;i++){y=(crc^a[i])&255;crc=crc>>>8^table[y]}return crc^-1}var h=img[0].length,w=img[0][0].length,s1,s2,next,k,length,a,b,i,j,adler32,crc32;var stream=[137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,w>>24&255,w>>16&255,w>>8&255,w&255,h>>24&255,
h>>16&255,h>>8&255,h&255,8,2,0,0,0,-1,-2,-3,-4,-5,-6,-7,-8,73,68,65,84,8,29];crc32=crc32Array(stream,12,29);stream[29]=crc32>>24&255;stream[30]=crc32>>16&255;stream[31]=crc32>>8&255;stream[32]=crc32&255;s1=1;s2=0;for(i=0;i<h;i++){if(i<h-1)stream.push(0);else stream.push(1);a=3*w+1+(i===0)&255;b=3*w+1+(i===0)>>8&255;stream.push(a);stream.push(b);stream.push(~a&255);stream.push(~b&255);if(i===0)stream.push(0);for(j=0;j<w;j++)for(k=0;k<3;k++){a=img[k][i][j];if(a>255)a=255;else if(a<0)a=0;else a=Math.round(a);
s1=(s1+a)%65521;s2=(s2+s1)%65521;stream.push(a)}stream.push(0)}adler32=(s2<<16)+s1;stream.push(adler32>>24&255);stream.push(adler32>>16&255);stream.push(adler32>>8&255);stream.push(adler32&255);length=stream.length-41;stream[33]=length>>24&255;stream[34]=length>>16&255;stream[35]=length>>8&255;stream[36]=length&255;crc32=crc32Array(stream,37);stream.push(crc32>>24&255);stream.push(crc32>>16&255);stream.push(crc32>>8&255);stream.push(crc32&255);stream.push(0);stream.push(0);stream.push(0);stream.push(0);
stream.push(73);stream.push(69);stream.push(78);stream.push(68);stream.push(174);stream.push(66);stream.push(96);stream.push(130);return"data:image/png;base64,"+base64(stream)};numeric._dim=function _dim(x){var ret=[];while(typeof x==="object"){ret.push(x.length);x=x[0]}return ret};numeric.dim=function dim(x){var y,z;if(typeof x==="object"){y=x[0];if(typeof y==="object"){z=y[0];if(typeof z==="object")return numeric._dim(x);return[x.length,y.length]}return[x.length]}return[]};
numeric.mapreduce=function mapreduce(body,init){return Function("x","accum","_s","_k",'if(typeof accum \x3d\x3d\x3d "undefined") accum \x3d '+init+";\n"+'if(typeof x \x3d\x3d\x3d "number") { var xi \x3d x; '+body+"; return accum; }\n"+'if(typeof _s \x3d\x3d\x3d "undefined") _s \x3d numeric.dim(x);\n'+'if(typeof _k \x3d\x3d\x3d "undefined") _k \x3d 0;\n'+"var _n \x3d _s[_k];\n"+"var i,xi;\n"+"if(_k \x3c _s.length-1) {\n"+"    for(i\x3d_n-1;i\x3e\x3d0;i--) {\n"+"        accum \x3d arguments.callee(x[i],accum,_s,_k+1);\n"+
"    }"+"    return accum;\n"+"}\n"+"for(i\x3d_n-1;i\x3e\x3d1;i-\x3d2) { \n"+"    xi \x3d x[i];\n"+"    "+body+";\n"+"    xi \x3d x[i-1];\n"+"    "+body+";\n"+"}\n"+"if(i \x3d\x3d\x3d 0) {\n"+"    xi \x3d x[i];\n"+"    "+body+"\n"+"}\n"+"return accum;")};numeric.mapreduce2=function mapreduce2(body,setup){return Function("x","var n \x3d x.length;\n"+"var i,xi;\n"+setup+";\n"+"for(i\x3dn-1;i!\x3d\x3d-1;--i) { \n"+"    xi \x3d x[i];\n"+"    "+body+";\n"+"}\n"+"return accum;")};
numeric.same=function same(x,y){var i,n;if(!(x instanceof Array)||!(y instanceof Array))return false;n=x.length;if(n!==y.length)return false;for(i=0;i<n;i++){if(x[i]===y[i])continue;if(typeof x[i]==="object"){if(!same(x[i],y[i]))return false}else return false}return true};numeric.rep=function rep(s,v,k){if(typeof k==="undefined")k=0;var n=s[k],ret=Array(n),i;if(k===s.length-1){for(i=n-2;i>=0;i-=2){ret[i+1]=v;ret[i]=v}if(i===-1)ret[0]=v;return ret}for(i=n-1;i>=0;i--)ret[i]=numeric.rep(s,v,k+1);return ret};
numeric.dotMMsmall=function dotMMsmall(x,y){var i,j,k,p,q,r,ret,foo,bar,woo,i0,k0,p0,r0;p=x.length;q=y.length;r=y[0].length;ret=Array(p);for(i=p-1;i>=0;i--){foo=Array(r);bar=x[i];for(k=r-1;k>=0;k--){woo=bar[q-1]*y[q-1][k];for(j=q-2;j>=1;j-=2){i0=j-1;woo+=bar[j]*y[j][k]+bar[i0]*y[i0][k]}if(j===0)woo+=bar[0]*y[0][k];foo[k]=woo}ret[i]=foo}return ret};numeric._getCol=function _getCol(A,j,x){var n=A.length,i;for(i=n-1;i>0;--i){x[i]=A[i][j];--i;x[i]=A[i][j]}if(i===0)x[0]=A[0][j]};
numeric.dotMMbig=function dotMMbig(x,y){var gc=numeric._getCol,p=y.length,v=Array(p);var m=x.length,n=y[0].length,A=new Array(m),xj;var VV=numeric.dotVV;var i,j,k,z;--p;--m;for(i=m;i!==-1;--i)A[i]=Array(n);--n;for(i=n;i!==-1;--i){gc(y,i,v);for(j=m;j!==-1;--j){z=0;xj=x[j];A[j][i]=VV(xj,v)}}return A};numeric.dotMV=function dotMV(x,y){var p=x.length,q=y.length,i;var ret=Array(p),dotVV=numeric.dotVV;for(i=p-1;i>=0;i--)ret[i]=dotVV(x[i],y);return ret};
numeric.dotVM=function dotVM(x,y){var i,j,k,p,q,r,ret,foo,bar,woo,i0,k0,p0,r0,s1,s2,s3,baz,accum;p=x.length;q=y[0].length;ret=Array(q);for(k=q-1;k>=0;k--){woo=x[p-1]*y[p-1][k];for(j=p-2;j>=1;j-=2){i0=j-1;woo+=x[j]*y[j][k]+x[i0]*y[i0][k]}if(j===0)woo+=x[0]*y[0][k];ret[k]=woo}return ret};numeric.dotVV=function dotVV(x,y){var i,n=x.length,i1,ret=x[n-1]*y[n-1];for(i=n-2;i>=1;i-=2){i1=i-1;ret+=x[i]*y[i]+x[i1]*y[i1]}if(i===0)ret+=x[0]*y[0];return ret};
numeric.dot=function dot(x,y){var d=numeric.dim;switch(d(x).length*1E3+d(y).length){case 2002:if(y.length<10)return numeric.dotMMsmall(x,y);else return numeric.dotMMbig(x,y);case 2001:return numeric.dotMV(x,y);case 1002:return numeric.dotVM(x,y);case 1001:return numeric.dotVV(x,y);case 1E3:return numeric.mulVS(x,y);case 1:return numeric.mulSV(x,y);case 0:return x*y;default:throw new Error("numeric.dot only works on vectors and matrices");}};
numeric.diag=function diag(d){var i,i1,j,n=d.length,A=Array(n),Ai;for(i=n-1;i>=0;i--){Ai=Array(n);i1=i+2;for(j=n-1;j>=i1;j-=2){Ai[j]=0;Ai[j-1]=0}if(j>i)Ai[j]=0;Ai[i]=d[i];for(j=i-1;j>=1;j-=2){Ai[j]=0;Ai[j-1]=0}if(j===0)Ai[0]=0;A[i]=Ai}return A};numeric.getDiag=function(A){var n=Math.min(A.length,A[0].length),i,ret=Array(n);for(i=n-1;i>=1;--i){ret[i]=A[i][i];--i;ret[i]=A[i][i]}if(i===0)ret[0]=A[0][0];return ret};numeric.identity=function identity(n){return numeric.diag(numeric.rep([n],1))};
numeric.pointwise=function pointwise(params,body,setup){if(typeof setup==="undefined")setup="";var fun=[];var k;var avec=/\[i\]$/,p,thevec="";var haveret=false;for(k=0;k<params.length;k++){if(avec.test(params[k])){p=params[k].substring(0,params[k].length-3);thevec=p}else p=params[k];if(p==="ret")haveret=true;fun.push(p)}fun[params.length]="_s";fun[params.length+1]="_k";fun[params.length+2]='if(typeof _s \x3d\x3d\x3d "undefined") _s \x3d numeric.dim('+thevec+");\n"+'if(typeof _k \x3d\x3d\x3d "undefined") _k \x3d 0;\n'+
"var _n \x3d _s[_k];\n"+"var i"+(haveret?"":", ret \x3d Array(_n)")+";\n"+"if(_k \x3c _s.length-1) {\n"+"    for(i\x3d_n-1;i\x3e\x3d0;i--) ret[i] \x3d arguments.callee("+params.join(",")+",_s,_k+1);\n"+"    return ret;\n"+"}\n"+setup+"\n"+"for(i\x3d_n-1;i!\x3d\x3d-1;--i) {\n"+"    "+body+"\n"+"}\n"+"return ret;";return Function.apply(null,fun)};
numeric.pointwise2=function pointwise2(params,body,setup){if(typeof setup==="undefined")setup="";var fun=[];var k;var avec=/\[i\]$/,p,thevec="";var haveret=false;for(k=0;k<params.length;k++){if(avec.test(params[k])){p=params[k].substring(0,params[k].length-3);thevec=p}else p=params[k];if(p==="ret")haveret=true;fun.push(p)}fun[params.length]="var _n \x3d "+thevec+".length;\n"+"var i"+(haveret?"":", ret \x3d Array(_n)")+";\n"+setup+"\n"+"for(i\x3d_n-1;i!\x3d\x3d-1;--i) {\n"+body+"\n"+"}\n"+"return ret;";
return Function.apply(null,fun)};numeric._biforeach=function _biforeach(x,y,s,k,f){if(k===s.length-1){f(x,y);return}var i,n=s[k];for(i=n-1;i>=0;i--)_biforeach(typeof x==="object"?x[i]:x,typeof y==="object"?y[i]:y,s,k+1,f)};numeric._biforeach2=function _biforeach2(x,y,s,k,f){if(k===s.length-1)return f(x,y);var i,n=s[k],ret=Array(n);for(i=n-1;i>=0;--i)ret[i]=_biforeach2(typeof x==="object"?x[i]:x,typeof y==="object"?y[i]:y,s,k+1,f);return ret};
numeric._foreach=function _foreach(x,s,k,f){if(k===s.length-1){f(x);return}var i,n=s[k];for(i=n-1;i>=0;i--)_foreach(x[i],s,k+1,f)};numeric._foreach2=function _foreach2(x,s,k,f){if(k===s.length-1)return f(x);var i,n=s[k],ret=Array(n);for(i=n-1;i>=0;i--)ret[i]=_foreach2(x[i],s,k+1,f);return ret};
numeric.ops2={add:"+",sub:"-",mul:"*",div:"/",mod:"%",and:"\x26\x26",or:"||",eq:"\x3d\x3d\x3d",neq:"!\x3d\x3d",lt:"\x3c",gt:"\x3e",leq:"\x3c\x3d",geq:"\x3e\x3d",band:"\x26",bor:"|",bxor:"^",lshift:"\x3c\x3c",rshift:"\x3e\x3e",rrshift:"\x3e\x3e\x3e"};numeric.opseq={addeq:"+\x3d",subeq:"-\x3d",muleq:"*\x3d",diveq:"/\x3d",modeq:"%\x3d",lshifteq:"\x3c\x3c\x3d",rshifteq:"\x3e\x3e\x3d",rrshifteq:"\x3e\x3e\x3e\x3d",bandeq:"\x26\x3d",boreq:"|\x3d",bxoreq:"^\x3d"};
numeric.mathfuns=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan","isNaN","isFinite"];numeric.mathfuns2=["atan2","pow","max","min"];numeric.ops1={neg:"-",not:"!",bnot:"~",clone:""};
numeric.mapreducers={any:["if(xi) return true;","var accum \x3d false;"],all:["if(!xi) return false;","var accum \x3d true;"],sum:["accum +\x3d xi;","var accum \x3d 0;"],prod:["accum *\x3d xi;","var accum \x3d 1;"],norm2Squared:["accum +\x3d xi*xi;","var accum \x3d 0;"],norminf:["accum \x3d max(accum,abs(xi));","var accum \x3d 0, max \x3d Math.max, abs \x3d Math.abs;"],norm1:["accum +\x3d abs(xi)","var accum \x3d 0, abs \x3d Math.abs;"],sup:["accum \x3d max(accum,xi);","var accum \x3d -Infinity, max \x3d Math.max;"],
inf:["accum \x3d min(accum,xi);","var accum \x3d Infinity, min \x3d Math.min;"]};
(function(){var i,o;for(i=0;i<numeric.mathfuns2.length;++i){o=numeric.mathfuns2[i];numeric.ops2[o]=o}for(i in numeric.ops2)if(numeric.ops2.hasOwnProperty(i)){o=numeric.ops2[i];var code,codeeq,setup="";if(numeric.myIndexOf.call(numeric.mathfuns2,i)!==-1){setup="var "+o+" \x3d Math."+o+";\n";code=function(r,x,y){return r+" \x3d "+o+"("+x+","+y+")"};codeeq=function(x,y){return x+" \x3d "+o+"("+x+","+y+")"}}else{code=function(r,x,y){return r+" \x3d "+x+" "+o+" "+y};if(numeric.opseq.hasOwnProperty(i+"eq"))codeeq=
function(x,y){return x+" "+o+"\x3d "+y};else codeeq=function(x,y){return x+" \x3d "+x+" "+o+" "+y}}numeric[i+"VV"]=numeric.pointwise2(["x[i]","y[i]"],code("ret[i]","x[i]","y[i]"),setup);numeric[i+"SV"]=numeric.pointwise2(["x","y[i]"],code("ret[i]","x","y[i]"),setup);numeric[i+"VS"]=numeric.pointwise2(["x[i]","y"],code("ret[i]","x[i]","y"),setup);numeric[i]=Function("var n \x3d arguments.length, i, x \x3d arguments[0], y;\n"+"var VV \x3d numeric."+i+"VV, VS \x3d numeric."+i+"VS, SV \x3d numeric."+
i+"SV;\n"+"var dim \x3d numeric.dim;\n"+"for(i\x3d1;i!\x3d\x3dn;++i) { \n"+"  y \x3d arguments[i];\n"+'  if(typeof x \x3d\x3d\x3d "object") {\n'+'      if(typeof y \x3d\x3d\x3d "object") x \x3d numeric._biforeach2(x,y,dim(x),0,VV);\n'+"      else x \x3d numeric._biforeach2(x,y,dim(x),0,VS);\n"+'  } else if(typeof y \x3d\x3d\x3d "object") x \x3d numeric._biforeach2(x,y,dim(y),0,SV);\n'+"  else "+codeeq("x","y")+"\n"+"}\nreturn x;\n");numeric[o]=numeric[i];numeric[i+"eqV"]=numeric.pointwise2(["ret[i]",
"x[i]"],codeeq("ret[i]","x[i]"),setup);numeric[i+"eqS"]=numeric.pointwise2(["ret[i]","x"],codeeq("ret[i]","x"),setup);numeric[i+"eq"]=Function("var n \x3d arguments.length, i, x \x3d arguments[0], y;\n"+"var V \x3d numeric."+i+"eqV, S \x3d numeric."+i+"eqS\n"+"var s \x3d numeric.dim(x);\n"+"for(i\x3d1;i!\x3d\x3dn;++i) { \n"+"  y \x3d arguments[i];\n"+'  if(typeof y \x3d\x3d\x3d "object") numeric._biforeach(x,y,s,0,V);\n'+"  else numeric._biforeach(x,y,s,0,S);\n"+"}\nreturn x;\n")}for(i=0;i<numeric.mathfuns2.length;++i){o=
numeric.mathfuns2[i];delete numeric.ops2[o]}for(i=0;i<numeric.mathfuns.length;++i){o=numeric.mathfuns[i];numeric.ops1[o]=o}for(i in numeric.ops1)if(numeric.ops1.hasOwnProperty(i)){setup="";o=numeric.ops1[i];if(numeric.myIndexOf.call(numeric.mathfuns,i)!==-1)if(Math.hasOwnProperty(o))setup="var "+o+" \x3d Math."+o+";\n";numeric[i+"eqV"]=numeric.pointwise2(["ret[i]"],"ret[i] \x3d "+o+"(ret[i]);",setup);numeric[i+"eq"]=Function("x",'if(typeof x !\x3d\x3d "object") return '+o+"x\n"+"var i;\n"+"var V \x3d numeric."+
i+"eqV;\n"+"var s \x3d numeric.dim(x);\n"+"numeric._foreach(x,s,0,V);\n"+"return x;\n");numeric[i+"V"]=numeric.pointwise2(["x[i]"],"ret[i] \x3d "+o+"(x[i]);",setup);numeric[i]=Function("x",'if(typeof x !\x3d\x3d "object") return '+o+"(x)\n"+"var i;\n"+"var V \x3d numeric."+i+"V;\n"+"var s \x3d numeric.dim(x);\n"+"return numeric._foreach2(x,s,0,V);\n")}for(i=0;i<numeric.mathfuns.length;++i){o=numeric.mathfuns[i];delete numeric.ops1[o]}for(i in numeric.mapreducers)if(numeric.mapreducers.hasOwnProperty(i)){o=
numeric.mapreducers[i];numeric[i+"V"]=numeric.mapreduce2(o[0],o[1]);numeric[i]=Function("x","s","k",o[1]+'if(typeof x !\x3d\x3d "object") {'+"    xi \x3d x;\n"+o[0]+";\n"+"    return accum;\n"+"}"+'if(typeof s \x3d\x3d\x3d "undefined") s \x3d numeric.dim(x);\n'+'if(typeof k \x3d\x3d\x3d "undefined") k \x3d 0;\n'+"if(k \x3d\x3d\x3d s.length-1) return numeric."+i+"V(x);\n"+"var xi;\n"+"var n \x3d x.length, i;\n"+"for(i\x3dn-1;i!\x3d\x3d-1;--i) {\n"+"   xi \x3d arguments.callee(x[i]);\n"+o[0]+";\n"+
"}\n"+"return accum;\n")}})();numeric.truncVV=numeric.pointwise(["x[i]","y[i]"],"ret[i] \x3d round(x[i]/y[i])*y[i];","var round \x3d Math.round;");numeric.truncVS=numeric.pointwise(["x[i]","y"],"ret[i] \x3d round(x[i]/y)*y;","var round \x3d Math.round;");numeric.truncSV=numeric.pointwise(["x","y[i]"],"ret[i] \x3d round(x/y[i])*y[i];","var round \x3d Math.round;");
numeric.trunc=function trunc(x,y){if(typeof x==="object"){if(typeof y==="object")return numeric.truncVV(x,y);return numeric.truncVS(x,y)}if(typeof y==="object")return numeric.truncSV(x,y);return Math.round(x/y)*y};
numeric.inv=function inv(x){var s=numeric.dim(x),abs=Math.abs,m=s[0],n=s[1];var A=numeric.clone(x),Ai,Aj;var I=numeric.identity(m),Ii,Ij;var i,j,k,x;for(j=0;j<n;++j){var i0=-1;var v0=-1;for(i=j;i!==m;++i){k=abs(A[i][j]);if(k>v0){i0=i;v0=k}}Aj=A[i0];A[i0]=A[j];A[j]=Aj;Ij=I[i0];I[i0]=I[j];I[j]=Ij;x=Aj[j];for(k=j;k!==n;++k)Aj[k]/=x;for(k=n-1;k!==-1;--k)Ij[k]/=x;for(i=m-1;i!==-1;--i)if(i!==j){Ai=A[i];Ii=I[i];x=Ai[j];for(k=j+1;k!==n;++k)Ai[k]-=Aj[k]*x;for(k=n-1;k>0;--k){Ii[k]-=Ij[k]*x;--k;Ii[k]-=Ij[k]*
x}if(k===0)Ii[0]-=Ij[0]*x}}return I};
numeric.det=function det(x){var s=numeric.dim(x);if(s.length!==2||s[0]!==s[1])throw new Error("numeric: det() only works on square matrices");var n=s[0],ret=1,i,j,k,A=numeric.clone(x),Aj,Ai,alpha,temp,k1,k2,k3;for(j=0;j<n-1;j++){k=j;for(i=j+1;i<n;i++)if(Math.abs(A[i][j])>Math.abs(A[k][j]))k=i;if(k!==j){temp=A[k];A[k]=A[j];A[j]=temp;ret*=-1}Aj=A[j];for(i=j+1;i<n;i++){Ai=A[i];alpha=Ai[j]/Aj[j];for(k=j+1;k<n-1;k+=2){k1=k+1;Ai[k]-=Aj[k]*alpha;Ai[k1]-=Aj[k1]*alpha}if(k!==n)Ai[k]-=Aj[k]*alpha}if(Aj[j]===
0)return 0;ret*=Aj[j]}return ret*A[j][j]};numeric.transpose=function transpose(x){var i,j,m=x.length,n=x[0].length,ret=Array(n),A0,A1,Bj;for(j=0;j<n;j++)ret[j]=Array(m);for(i=m-1;i>=1;i-=2){A1=x[i];A0=x[i-1];for(j=n-1;j>=1;--j){Bj=ret[j];Bj[i]=A1[j];Bj[i-1]=A0[j];--j;Bj=ret[j];Bj[i]=A1[j];Bj[i-1]=A0[j]}if(j===0){Bj=ret[0];Bj[i]=A1[0];Bj[i-1]=A0[0]}}if(i===0){A0=x[0];for(j=n-1;j>=1;--j){ret[j][0]=A0[j];--j;ret[j][0]=A0[j]}if(j===0)ret[0][0]=A0[0]}return ret};
numeric.negtranspose=function negtranspose(x){var i,j,m=x.length,n=x[0].length,ret=Array(n),A0,A1,Bj;for(j=0;j<n;j++)ret[j]=Array(m);for(i=m-1;i>=1;i-=2){A1=x[i];A0=x[i-1];for(j=n-1;j>=1;--j){Bj=ret[j];Bj[i]=-A1[j];Bj[i-1]=-A0[j];--j;Bj=ret[j];Bj[i]=-A1[j];Bj[i-1]=-A0[j]}if(j===0){Bj=ret[0];Bj[i]=-A1[0];Bj[i-1]=-A0[0]}}if(i===0){A0=x[0];for(j=n-1;j>=1;--j){ret[j][0]=-A0[j];--j;ret[j][0]=-A0[j]}if(j===0)ret[0][0]=-A0[0]}return ret};
numeric._random=function _random(s,k){var i,n=s[k],ret=Array(n),rnd;if(k===s.length-1){rnd=Math.random;for(i=n-1;i>=1;i-=2){ret[i]=rnd();ret[i-1]=rnd()}if(i===0)ret[0]=rnd();return ret}for(i=n-1;i>=0;i--)ret[i]=_random(s,k+1);return ret};numeric.random=function random(s){return numeric._random(s,0)};numeric.norm2=function norm2(x){return Math.sqrt(numeric.norm2Squared(x))};
numeric.linspace=function linspace(a,b,n){if(typeof n==="undefined")n=Math.max(Math.round(b-a)+1,1);if(n<2)return n===1?[a]:[];var i,ret=Array(n);n--;for(i=n;i>=0;i--)ret[i]=(i*b+(n-i)*a)/n;return ret};numeric.getBlock=function getBlock(x,from,to){var s=numeric.dim(x);function foo(x,k){var i,a=from[k],n=to[k]-a,ret=Array(n);if(k===s.length-1){for(i=n;i>=0;i--)ret[i]=x[i+a];return ret}for(i=n;i>=0;i--)ret[i]=foo(x[i+a],k+1);return ret}return foo(x,0)};
numeric.setBlock=function setBlock(x,from,to,B){var s=numeric.dim(x);function foo(x,y,k){var i,a=from[k],n=to[k]-a;if(k===s.length-1)for(i=n;i>=0;i--)x[i+a]=y[i];for(i=n;i>=0;i--)foo(x[i+a],y[i],k+1)}foo(x,B,0);return x};numeric.getRange=function getRange(A,I,J){var m=I.length,n=J.length;var i,j;var B=Array(m),Bi,AI;for(i=m-1;i!==-1;--i){B[i]=Array(n);Bi=B[i];AI=A[I[i]];for(j=n-1;j!==-1;--j)Bi[j]=AI[J[j]]}return B};
numeric.blockMatrix=function blockMatrix(X){var s=numeric.dim(X);if(s.length<4)return numeric.blockMatrix([X]);var m=s[0],n=s[1],M,N,i,j,Xij;M=0;N=0;for(i=0;i<m;++i)M+=X[i][0].length;for(j=0;j<n;++j)N+=X[0][j][0].length;var Z=Array(M);for(i=0;i<M;++i)Z[i]=Array(N);var I=0,J,ZI,k,l,Xijk;for(i=0;i<m;++i){J=N;for(j=n-1;j!==-1;--j){Xij=X[i][j];J-=Xij[0].length;for(k=Xij.length-1;k!==-1;--k){Xijk=Xij[k];ZI=Z[I+k];for(l=Xijk.length-1;l!==-1;--l)ZI[J+l]=Xijk[l]}}I+=X[i][0].length}return Z};
numeric.tensor=function tensor(x,y){if(typeof x==="number"||typeof y==="number")return numeric.mul(x,y);var s1=numeric.dim(x),s2=numeric.dim(y);if(s1.length!==1||s2.length!==1)throw new Error("numeric: tensor product is only defined for vectors");var m=s1[0],n=s2[0],A=Array(m),Ai,i,j,xi;for(i=m-1;i>=0;i--){Ai=Array(n);xi=x[i];for(j=n-1;j>=3;--j){Ai[j]=xi*y[j];--j;Ai[j]=xi*y[j];--j;Ai[j]=xi*y[j];--j;Ai[j]=xi*y[j]}while(j>=0){Ai[j]=xi*y[j];--j}A[i]=Ai}return A};
numeric.T=function T(x,y){this.x=x;this.y=y};numeric.t=function t(x,y){return new numeric.T(x,y)};
numeric.Tbinop=function Tbinop(rr,rc,cr,cc,setup){var io=numeric.indexOf;if(typeof setup!=="string"){var k;setup="";for(k in numeric)if(numeric.hasOwnProperty(k)&&(rr.indexOf(k)>=0||rc.indexOf(k)>=0||cr.indexOf(k)>=0||cc.indexOf(k)>=0)&&k.length>1)setup+="var "+k+" \x3d numeric."+k+";\n"}return Function(["y"],"var x \x3d this;\n"+"if(!(y instanceof numeric.T)) { y \x3d new numeric.T(y); }\n"+setup+"\n"+"if(x.y) {"+"  if(y.y) {"+"    return new numeric.T("+cc+");\n"+"  }\n"+"  return new numeric.T("+
cr+");\n"+"}\n"+"if(y.y) {\n"+"  return new numeric.T("+rc+");\n"+"}\n"+"return new numeric.T("+rr+");\n")};numeric.T.prototype.add=numeric.Tbinop("add(x.x,y.x)","add(x.x,y.x),y.y","add(x.x,y.x),x.y","add(x.x,y.x),add(x.y,y.y)");numeric.T.prototype.sub=numeric.Tbinop("sub(x.x,y.x)","sub(x.x,y.x),neg(y.y)","sub(x.x,y.x),x.y","sub(x.x,y.x),sub(x.y,y.y)");numeric.T.prototype.mul=numeric.Tbinop("mul(x.x,y.x)","mul(x.x,y.x),mul(x.x,y.y)","mul(x.x,y.x),mul(x.y,y.x)","sub(mul(x.x,y.x),mul(x.y,y.y)),add(mul(x.x,y.y),mul(x.y,y.x))");
numeric.T.prototype.reciprocal=function reciprocal(){var mul=numeric.mul,div=numeric.div;if(this.y){var d=numeric.add(mul(this.x,this.x),mul(this.y,this.y));return new numeric.T(div(this.x,d),div(numeric.neg(this.y),d))}return new T(div(1,this.x))};numeric.T.prototype.div=function div(y){if(!(y instanceof numeric.T))y=new numeric.T(y);if(y.y)return this.mul(y.reciprocal());var div=numeric.div;if(this.y)return new numeric.T(div(this.x,y.x),div(this.y,y.x));return new numeric.T(div(this.x,y.x))};
numeric.T.prototype.dot=numeric.Tbinop("dot(x.x,y.x)","dot(x.x,y.x),dot(x.x,y.y)","dot(x.x,y.x),dot(x.y,y.x)","sub(dot(x.x,y.x),dot(x.y,y.y)),add(dot(x.x,y.y),dot(x.y,y.x))");numeric.T.prototype.transpose=function transpose(){var t=numeric.transpose,x=this.x,y=this.y;if(y)return new numeric.T(t(x),t(y));return new numeric.T(t(x))};numeric.T.prototype.transjugate=function transjugate(){var t=numeric.transpose,x=this.x,y=this.y;if(y)return new numeric.T(t(x),numeric.negtranspose(y));return new numeric.T(t(x))};
numeric.Tunop=function Tunop(r,c,s){if(typeof s!=="string")s="";return Function("var x \x3d this;\n"+s+"\n"+"if(x.y) {"+"  "+c+";\n"+"}\n"+r+";\n")};numeric.T.prototype.exp=numeric.Tunop("return new numeric.T(ex)","return new numeric.T(mul(cos(x.y),ex),mul(sin(x.y),ex))","var ex \x3d numeric.exp(x.x), cos \x3d numeric.cos, sin \x3d numeric.sin, mul \x3d numeric.mul;");numeric.T.prototype.conj=numeric.Tunop("return new numeric.T(x.x);","return new numeric.T(x.x,numeric.neg(x.y));");
numeric.T.prototype.neg=numeric.Tunop("return new numeric.T(neg(x.x));","return new numeric.T(neg(x.x),neg(x.y));","var neg \x3d numeric.neg;");numeric.T.prototype.sin=numeric.Tunop("return new numeric.T(numeric.sin(x.x))","return x.exp().sub(x.neg().exp()).div(new numeric.T(0,2));");numeric.T.prototype.cos=numeric.Tunop("return new numeric.T(numeric.cos(x.x))","return x.exp().add(x.neg().exp()).div(2);");
numeric.T.prototype.abs=numeric.Tunop("return new numeric.T(numeric.abs(x.x));","return new numeric.T(numeric.sqrt(numeric.add(mul(x.x,x.x),mul(x.y,x.y))));","var mul \x3d numeric.mul;");numeric.T.prototype.log=numeric.Tunop("return new numeric.T(numeric.log(x.x));","var theta \x3d new numeric.T(numeric.atan2(x.y,x.x)), r \x3d x.abs();\n"+"return new numeric.T(numeric.log(r.x),theta.x);");numeric.T.prototype.norm2=numeric.Tunop("return numeric.norm2(x.x);","var f \x3d numeric.norm2Squared;\n"+"return Math.sqrt(f(x.x)+f(x.y));");
numeric.T.prototype.inv=function inv(){var A=this;if(typeof A.y==="undefined")return new numeric.T(numeric.inv(A.x));var n=A.x.length,i,j,k;var Rx=numeric.identity(n),Ry=numeric.rep([n,n],0);var Ax=numeric.clone(A.x),Ay=numeric.clone(A.y);var Aix,Aiy,Ajx,Ajy,Rix,Riy,Rjx,Rjy;var i,j,k,d,d1,ax,ay,bx,by,temp;for(i=0;i<n;i++){ax=Ax[i][i];ay=Ay[i][i];d=ax*ax+ay*ay;k=i;for(j=i+1;j<n;j++){ax=Ax[j][i];ay=Ay[j][i];d1=ax*ax+ay*ay;if(d1>d){k=j;d=d1}}if(k!==i){temp=Ax[i];Ax[i]=Ax[k];Ax[k]=temp;temp=Ay[i];Ay[i]=
Ay[k];Ay[k]=temp;temp=Rx[i];Rx[i]=Rx[k];Rx[k]=temp;temp=Ry[i];Ry[i]=Ry[k];Ry[k]=temp}Aix=Ax[i];Aiy=Ay[i];Rix=Rx[i];Riy=Ry[i];ax=Aix[i];ay=Aiy[i];for(j=i+1;j<n;j++){bx=Aix[j];by=Aiy[j];Aix[j]=(bx*ax+by*ay)/d;Aiy[j]=(by*ax-bx*ay)/d}for(j=0;j<n;j++){bx=Rix[j];by=Riy[j];Rix[j]=(bx*ax+by*ay)/d;Riy[j]=(by*ax-bx*ay)/d}for(j=i+1;j<n;j++){Ajx=Ax[j];Ajy=Ay[j];Rjx=Rx[j];Rjy=Ry[j];ax=Ajx[i];ay=Ajy[i];for(k=i+1;k<n;k++){bx=Aix[k];by=Aiy[k];Ajx[k]-=bx*ax-by*ay;Ajy[k]-=by*ax+bx*ay}for(k=0;k<n;k++){bx=Rix[k];by=
Riy[k];Rjx[k]-=bx*ax-by*ay;Rjy[k]-=by*ax+bx*ay}}}for(i=n-1;i>0;i--){Rix=Rx[i];Riy=Ry[i];for(j=i-1;j>=0;j--){Rjx=Rx[j];Rjy=Ry[j];ax=Ax[j][i];ay=Ay[j][i];for(k=n-1;k>=0;k--){bx=Rix[k];by=Riy[k];Rjx[k]-=ax*bx-ay*by;Rjy[k]-=ax*by+ay*bx}}}return new numeric.T(Rx,Ry)};numeric.T.prototype.get=function get(i){var x=this.x,y=this.y,k=0,ik,n=i.length;if(y){while(k<n){ik=i[k];x=x[ik];y=y[ik];k++}return new numeric.T(x,y)}while(k<n){ik=i[k];x=x[ik];k++}return new numeric.T(x)};
numeric.T.prototype.set=function set(i,v){var x=this.x,y=this.y,k=0,ik,n=i.length,vx=v.x,vy=v.y;if(n===0){if(vy)this.y=vy;else if(y)this.y=undefined;this.x=x;return this}if(vy){if(y);else{y=numeric.rep(numeric.dim(x),0);this.y=y}while(k<n-1){ik=i[k];x=x[ik];y=y[ik];k++}ik=i[k];x[ik]=vx;y[ik]=vy;return this}if(y){while(k<n-1){ik=i[k];x=x[ik];y=y[ik];k++}ik=i[k];x[ik]=vx;if(vx instanceof Array)y[ik]=numeric.rep(numeric.dim(vx),0);else y[ik]=0;return this}while(k<n-1){ik=i[k];x=x[ik];k++}ik=i[k];x[ik]=
vx;return this};numeric.T.prototype.getRows=function getRows(i0,i1){var n=i1-i0+1,j;var rx=Array(n),ry,x=this.x,y=this.y;for(j=i0;j<=i1;j++)rx[j-i0]=x[j];if(y){ry=Array(n);for(j=i0;j<=i1;j++)ry[j-i0]=y[j];return new numeric.T(rx,ry)}return new numeric.T(rx)};
numeric.T.prototype.setRows=function setRows(i0,i1,A){var j;var rx=this.x,ry=this.y,x=A.x,y=A.y;for(j=i0;j<=i1;j++)rx[j]=x[j-i0];if(y){if(!ry){ry=numeric.rep(numeric.dim(rx),0);this.y=ry}for(j=i0;j<=i1;j++)ry[j]=y[j-i0]}else if(ry)for(j=i0;j<=i1;j++)ry[j]=numeric.rep([x[j-i0].length],0);return this};numeric.T.prototype.getRow=function getRow(k){var x=this.x,y=this.y;if(y)return new numeric.T(x[k],y[k]);return new numeric.T(x[k])};
numeric.T.prototype.setRow=function setRow(i,v){var rx=this.x,ry=this.y,x=v.x,y=v.y;rx[i]=x;if(y){if(!ry){ry=numeric.rep(numeric.dim(rx),0);this.y=ry}ry[i]=y}else if(ry)ry=numeric.rep([x.length],0);return this};numeric.T.prototype.getBlock=function getBlock(from,to){var x=this.x,y=this.y,b=numeric.getBlock;if(y)return new numeric.T(b(x,from,to),b(y,from,to));return new numeric.T(b(x,from,to))};
numeric.T.prototype.setBlock=function setBlock(from,to,A){if(!(A instanceof numeric.T))A=new numeric.T(A);var x=this.x,y=this.y,b=numeric.setBlock,Ax=A.x,Ay=A.y;if(Ay){if(!y){this.y=numeric.rep(numeric.dim(this),0);y=this.y}b(x,from,to,Ax);b(y,from,to,Ay);return this}b(x,from,to,Ax);if(y)b(y,from,to,numeric.rep(numeric.dim(Ax),0))};numeric.T.rep=function rep(s,v){var T=numeric.T;if(!(v instanceof T))v=new T(v);var x=v.x,y=v.y,r=numeric.rep;if(y)return new T(r(s,x),r(s,y));return new T(r(s,x))};
numeric.T.diag=function diag(d){if(!(d instanceof numeric.T))d=new numeric.T(d);var x=d.x,y=d.y,diag=numeric.diag;if(y)return new numeric.T(diag(x),diag(y));return new numeric.T(diag(x))};numeric.T.eig=function eig(){if(this.y)throw new Error("eig: not implemented for complex matrices.");return numeric.eig(this.x)};numeric.T.identity=function identity(n){return new numeric.T(numeric.identity(n))};
numeric.T.prototype.getDiag=function getDiag(){var n=numeric;var x=this.x,y=this.y;if(y)return new n.T(n.getDiag(x),n.getDiag(y));return new n.T(n.getDiag(x))};numeric.house=function house(x){var v=numeric.clone(x);var s=x[0]>=0?1:-1;var alpha=s*numeric.norm2(x);v[0]+=alpha;var foo=numeric.norm2(v);if(foo===0)throw new Error("eig: internal error");return numeric.div(v,foo)};
numeric.toUpperHessenberg=function toUpperHessenberg(me){var s=numeric.dim(me);if(s.length!==2||s[0]!==s[1])throw new Error("numeric: toUpperHessenberg() only works on square matrices");var m=s[0],i,j,k,x,v,A=numeric.clone(me),B,C,Ai,Ci,Q=numeric.identity(m),Qi;for(j=0;j<m-2;j++){x=Array(m-j-1);for(i=j+1;i<m;i++)x[i-j-1]=A[i][j];if(numeric.norm2(x)>0){v=numeric.house(x);B=numeric.getBlock(A,[j+1,j],[m-1,m-1]);C=numeric.tensor(v,numeric.dot(v,B));for(i=j+1;i<m;i++){Ai=A[i];Ci=C[i-j-1];for(k=j;k<m;k++)Ai[k]-=
2*Ci[k-j]}B=numeric.getBlock(A,[0,j+1],[m-1,m-1]);C=numeric.tensor(numeric.dot(B,v),v);for(i=0;i<m;i++){Ai=A[i];Ci=C[i];for(k=j+1;k<m;k++)Ai[k]-=2*Ci[k-j-1]}B=Array(m-j-1);for(i=j+1;i<m;i++)B[i-j-1]=Q[i];C=numeric.tensor(v,numeric.dot(v,B));for(i=j+1;i<m;i++){Qi=Q[i];Ci=C[i-j-1];for(k=0;k<m;k++)Qi[k]-=2*Ci[k]}}}return{H:A,Q:Q}};numeric.epsilon=2.220446049250313E-16;
numeric.QRFrancis=function(H,maxiter){if(typeof maxiter==="undefined")maxiter=1E4;H=numeric.clone(H);var H0=numeric.clone(H);var s=numeric.dim(H),m=s[0],x,v,a,b,c,d,det,tr,Hloc,Q=numeric.identity(m),Qi,Hi,B,C,Ci,i,j,k,iter;if(m<3)return{Q:Q,B:[[0,m-1]]};var epsilon=numeric.epsilon;for(iter=0;iter<maxiter;iter++){for(j=0;j<m-1;j++)if(Math.abs(H[j+1][j])<epsilon*(Math.abs(H[j][j])+Math.abs(H[j+1][j+1]))){var QH1=numeric.QRFrancis(numeric.getBlock(H,[0,0],[j,j]),maxiter);var QH2=numeric.QRFrancis(numeric.getBlock(H,
[j+1,j+1],[m-1,m-1]),maxiter);B=Array(j+1);for(i=0;i<=j;i++)B[i]=Q[i];C=numeric.dot(QH1.Q,B);for(i=0;i<=j;i++)Q[i]=C[i];B=Array(m-j-1);for(i=j+1;i<m;i++)B[i-j-1]=Q[i];C=numeric.dot(QH2.Q,B);for(i=j+1;i<m;i++)Q[i]=C[i-j-1];return{Q:Q,B:QH1.B.concat(numeric.add(QH2.B,j+1))}}a=H[m-2][m-2];b=H[m-2][m-1];c=H[m-1][m-2];d=H[m-1][m-1];tr=a+d;det=a*d-b*c;Hloc=numeric.getBlock(H,[0,0],[2,2]);if(tr*tr>=4*det){var s1,s2;s1=.5*(tr+Math.sqrt(tr*tr-4*det));s2=.5*(tr-Math.sqrt(tr*tr-4*det));Hloc=numeric.add(numeric.sub(numeric.dot(Hloc,
Hloc),numeric.mul(Hloc,s1+s2)),numeric.diag(numeric.rep([3],s1*s2)))}else Hloc=numeric.add(numeric.sub(numeric.dot(Hloc,Hloc),numeric.mul(Hloc,tr)),numeric.diag(numeric.rep([3],det)));x=[Hloc[0][0],Hloc[1][0],Hloc[2][0]];v=numeric.house(x);B=[H[0],H[1],H[2]];C=numeric.tensor(v,numeric.dot(v,B));for(i=0;i<3;i++){Hi=H[i];Ci=C[i];for(k=0;k<m;k++)Hi[k]-=2*Ci[k]}B=numeric.getBlock(H,[0,0],[m-1,2]);C=numeric.tensor(numeric.dot(B,v),v);for(i=0;i<m;i++){Hi=H[i];Ci=C[i];for(k=0;k<3;k++)Hi[k]-=2*Ci[k]}B=[Q[0],
Q[1],Q[2]];C=numeric.tensor(v,numeric.dot(v,B));for(i=0;i<3;i++){Qi=Q[i];Ci=C[i];for(k=0;k<m;k++)Qi[k]-=2*Ci[k]}var J;for(j=0;j<m-2;j++){for(k=j;k<=j+1;k++)if(Math.abs(H[k+1][k])<epsilon*(Math.abs(H[k][k])+Math.abs(H[k+1][k+1]))){var QH1=numeric.QRFrancis(numeric.getBlock(H,[0,0],[k,k]),maxiter);var QH2=numeric.QRFrancis(numeric.getBlock(H,[k+1,k+1],[m-1,m-1]),maxiter);B=Array(k+1);for(i=0;i<=k;i++)B[i]=Q[i];C=numeric.dot(QH1.Q,B);for(i=0;i<=k;i++)Q[i]=C[i];B=Array(m-k-1);for(i=k+1;i<m;i++)B[i-k-
1]=Q[i];C=numeric.dot(QH2.Q,B);for(i=k+1;i<m;i++)Q[i]=C[i-k-1];return{Q:Q,B:QH1.B.concat(numeric.add(QH2.B,k+1))}}J=Math.min(m-1,j+3);x=Array(J-j);for(i=j+1;i<=J;i++)x[i-j-1]=H[i][j];v=numeric.house(x);B=numeric.getBlock(H,[j+1,j],[J,m-1]);C=numeric.tensor(v,numeric.dot(v,B));for(i=j+1;i<=J;i++){Hi=H[i];Ci=C[i-j-1];for(k=j;k<m;k++)Hi[k]-=2*Ci[k-j]}B=numeric.getBlock(H,[0,j+1],[m-1,J]);C=numeric.tensor(numeric.dot(B,v),v);for(i=0;i<m;i++){Hi=H[i];Ci=C[i];for(k=j+1;k<=J;k++)Hi[k]-=2*Ci[k-j-1]}B=Array(J-
j);for(i=j+1;i<=J;i++)B[i-j-1]=Q[i];C=numeric.tensor(v,numeric.dot(v,B));for(i=j+1;i<=J;i++){Qi=Q[i];Ci=C[i-j-1];for(k=0;k<m;k++)Qi[k]-=2*Ci[k]}}}throw new Error("numeric: eigenvalue iteration does not converge -- increase maxiter?");};
numeric.eig=function eig(A,maxiter){var QH=numeric.toUpperHessenberg(A);var QB=numeric.QRFrancis(QH.H,maxiter);var T=numeric.T;var n=A.length,i,k,flag=false,B=QB.B,H=numeric.dot(QB.Q,numeric.dot(QH.H,numeric.transpose(QB.Q)));var Q=new T(numeric.dot(QB.Q,QH.Q)),Q0;var m=B.length,j;var a,b,c,d,p1,p2,disc,x,y,p,q,n1,n2;var sqrt=Math.sqrt;for(k=0;k<m;k++){i=B[k][0];if(i===B[k][1]);else{j=i+1;a=H[i][i];b=H[i][j];c=H[j][i];d=H[j][j];if(b===0&&c===0)continue;p1=-a-d;p2=a*d-b*c;disc=p1*p1-4*p2;if(disc>=
0){if(p1<0)x=-.5*(p1-sqrt(disc));else x=-.5*(p1+sqrt(disc));n1=(a-x)*(a-x)+b*b;n2=c*c+(d-x)*(d-x);if(n1>n2){n1=sqrt(n1);p=(a-x)/n1;q=b/n1}else{n2=sqrt(n2);p=c/n2;q=(d-x)/n2}Q0=new T([[q,-p],[p,q]]);Q.setRows(i,j,Q0.dot(Q.getRows(i,j)))}else{x=-.5*p1;y=.5*sqrt(-disc);n1=(a-x)*(a-x)+b*b;n2=c*c+(d-x)*(d-x);if(n1>n2){n1=sqrt(n1+y*y);p=(a-x)/n1;q=b/n1;x=0;y/=n1}else{n2=sqrt(n2+y*y);p=c/n2;q=(d-x)/n2;x=y/n2;y=0}Q0=new T([[q,-p],[p,q]],[[x,y],[y,-x]]);Q.setRows(i,j,Q0.dot(Q.getRows(i,j)))}}}var R=Q.dot(A).dot(Q.transjugate()),
n=A.length,E=numeric.T.identity(n);for(j=0;j<n;j++)if(j>0)for(k=j-1;k>=0;k--){var Rk=R.get([k,k]),Rj=R.get([j,j]);if(numeric.neq(Rk.x,Rj.x)||numeric.neq(Rk.y,Rj.y)){x=R.getRow(k).getBlock([k],[j-1]);y=E.getRow(j).getBlock([k],[j-1]);E.set([j,k],R.get([k,j]).neg().sub(x.dot(y)).div(Rk.sub(Rj)))}else{E.setRow(j,E.getRow(k));continue}}for(j=0;j<n;j++){x=E.getRow(j);E.setRow(j,x.div(x.norm2()))}E=E.transpose();E=Q.transjugate().dot(E);return{lambda:R.getDiag(),E:E}};
numeric.ccsSparse=function ccsSparse(A){var m=A.length,n,foo,i,j,counts=[];for(i=m-1;i!==-1;--i){foo=A[i];for(j in foo){j=parseInt(j);while(j>=counts.length)counts[counts.length]=0;if(foo[j]!==0)counts[j]++}}var n=counts.length;var Ai=Array(n+1);Ai[0]=0;for(i=0;i<n;++i)Ai[i+1]=Ai[i]+counts[i];var Aj=Array(Ai[n]),Av=Array(Ai[n]);for(i=m-1;i!==-1;--i){foo=A[i];for(j in foo)if(foo[j]!==0){counts[j]--;Aj[Ai[j]+counts[j]]=i;Av[Ai[j]+counts[j]]=foo[j]}}return[Ai,Aj,Av]};
numeric.ccsFull=function ccsFull(A){var Ai=A[0],Aj=A[1],Av=A[2],s=numeric.ccsDim(A),m=s[0],n=s[1],i,j,j0,j1,k;var B=numeric.rep([m,n],0);for(i=0;i<n;i++){j0=Ai[i];j1=Ai[i+1];for(j=j0;j<j1;++j)B[Aj[j]][i]=Av[j]}return B};
numeric.ccsTSolve=function ccsTSolve(A,b,x,bj,xj){var Ai=A[0],Aj=A[1],Av=A[2],m=Ai.length-1,max=Math.max,n=0;if(typeof bj==="undefined")x=numeric.rep([m],0);if(typeof bj==="undefined")bj=numeric.linspace(0,x.length-1);if(typeof xj==="undefined")xj=[];function dfs(j){var k;if(x[j]!==0)return;x[j]=1;for(k=Ai[j];k<Ai[j+1];++k)dfs(Aj[k]);xj[n]=j;++n}var i,j,j0,j1,k,l,l0,l1,a;for(i=bj.length-1;i!==-1;--i)dfs(bj[i]);xj.length=n;for(i=xj.length-1;i!==-1;--i)x[xj[i]]=0;for(i=bj.length-1;i!==-1;--i){j=bj[i];
x[j]=b[j]}for(i=xj.length-1;i!==-1;--i){j=xj[i];j0=Ai[j];j1=max(Ai[j+1],j0);for(k=j0;k!==j1;++k)if(Aj[k]===j){x[j]/=Av[k];break}a=x[j];for(k=j0;k!==j1;++k){l=Aj[k];if(l!==j)x[l]-=a*Av[k]}}return x};numeric.ccsDFS=function ccsDFS(n){this.k=Array(n);this.k1=Array(n);this.j=Array(n)};
numeric.ccsDFS.prototype.dfs=function dfs(J,Ai,Aj,x,xj,Pinv){var m=0,foo,n=xj.length;var k=this.k,k1=this.k1,j=this.j,km,k11;if(x[J]!==0)return;x[J]=1;j[0]=J;k[0]=km=Ai[J];k1[0]=k11=Ai[J+1];while(1)if(km>=k11){xj[n]=j[m];if(m===0)return;++n;--m;km=k[m];k11=k1[m]}else{foo=Pinv[Aj[km]];if(x[foo]===0){x[foo]=1;k[m]=km;++m;j[m]=foo;km=Ai[foo];k1[m]=k11=Ai[foo+1]}else++km}};
numeric.ccsLPSolve=function ccsLPSolve(A,B,x,xj,I,Pinv,dfs){var Ai=A[0],Aj=A[1],Av=A[2],m=Ai.length-1,n=0;var Bi=B[0],Bj=B[1],Bv=B[2];var i,i0,i1,j,J,j0,j1,k,l,l0,l1,a;i0=Bi[I];i1=Bi[I+1];xj.length=0;for(i=i0;i<i1;++i)dfs.dfs(Pinv[Bj[i]],Ai,Aj,x,xj,Pinv);for(i=xj.length-1;i!==-1;--i)x[xj[i]]=0;for(i=i0;i!==i1;++i){j=Pinv[Bj[i]];x[j]=Bv[i]}for(i=xj.length-1;i!==-1;--i){j=xj[i];j0=Ai[j];j1=Ai[j+1];for(k=j0;k<j1;++k)if(Pinv[Aj[k]]===j){x[j]/=Av[k];break}a=x[j];for(k=j0;k<j1;++k){l=Pinv[Aj[k]];if(l!==
j)x[l]-=a*Av[k]}}return x};
numeric.ccsLUP1=function ccsLUP1(A,threshold){var m=A[0].length-1;var L=[numeric.rep([m+1],0),[],[]],U=[numeric.rep([m+1],0),[],[]];var Li=L[0],Lj=L[1],Lv=L[2],Ui=U[0],Uj=U[1],Uv=U[2];var x=numeric.rep([m],0),xj=numeric.rep([m],0);var i,j,k,j0,j1,a,e,c,d,K;var sol=numeric.ccsLPSolve,max=Math.max,abs=Math.abs;var P=numeric.linspace(0,m-1),Pinv=numeric.linspace(0,m-1);var dfs=new numeric.ccsDFS(m);if(typeof threshold==="undefined")threshold=1;for(i=0;i<m;++i){sol(L,A,x,xj,i,Pinv,dfs);a=-1;e=-1;for(j=
xj.length-1;j!==-1;--j){k=xj[j];if(k<=i)continue;c=abs(x[k]);if(c>a){e=k;a=c}}if(abs(x[i])<threshold*a){j=P[i];a=P[e];P[i]=a;Pinv[a]=i;P[e]=j;Pinv[j]=e;a=x[i];x[i]=x[e];x[e]=a}a=Li[i];e=Ui[i];d=x[i];Lj[a]=P[i];Lv[a]=1;++a;for(j=xj.length-1;j!==-1;--j){k=xj[j];c=x[k];xj[j]=0;x[k]=0;if(k<=i){Uj[e]=k;Uv[e]=c;++e}else{Lj[a]=P[k];Lv[a]=c/d;++a}}Li[i+1]=a;Ui[i+1]=e}for(j=Lj.length-1;j!==-1;--j)Lj[j]=Pinv[Lj[j]];return{L:L,U:U,P:P,Pinv:Pinv}};
numeric.ccsDFS0=function ccsDFS0(n){this.k=Array(n);this.k1=Array(n);this.j=Array(n)};
numeric.ccsDFS0.prototype.dfs=function dfs(J,Ai,Aj,x,xj,Pinv,P){var m=0,foo,n=xj.length;var k=this.k,k1=this.k1,j=this.j,km,k11;if(x[J]!==0)return;x[J]=1;j[0]=J;k[0]=km=Ai[Pinv[J]];k1[0]=k11=Ai[Pinv[J]+1];while(1){if(isNaN(km))throw new Error("Ow!");if(km>=k11){xj[n]=Pinv[j[m]];if(m===0)return;++n;--m;km=k[m];k11=k1[m]}else{foo=Aj[km];if(x[foo]===0){x[foo]=1;k[m]=km;++m;j[m]=foo;foo=Pinv[foo];km=Ai[foo];k1[m]=k11=Ai[foo+1]}else++km}}};
numeric.ccsLPSolve0=function ccsLPSolve0(A,B,y,xj,I,Pinv,P,dfs){var Ai=A[0],Aj=A[1],Av=A[2],m=Ai.length-1,n=0;var Bi=B[0],Bj=B[1],Bv=B[2];var i,i0,i1,j,J,j0,j1,k,l,l0,l1,a;i0=Bi[I];i1=Bi[I+1];xj.length=0;for(i=i0;i<i1;++i)dfs.dfs(Bj[i],Ai,Aj,y,xj,Pinv,P);for(i=xj.length-1;i!==-1;--i){j=xj[i];y[P[j]]=0}for(i=i0;i!==i1;++i){j=Bj[i];y[j]=Bv[i]}for(i=xj.length-1;i!==-1;--i){j=xj[i];l=P[j];j0=Ai[j];j1=Ai[j+1];for(k=j0;k<j1;++k)if(Aj[k]===l){y[l]/=Av[k];break}a=y[l];for(k=j0;k<j1;++k)y[Aj[k]]-=a*Av[k];
y[l]=a}};
numeric.ccsLUP0=function ccsLUP0(A,threshold){var m=A[0].length-1;var L=[numeric.rep([m+1],0),[],[]],U=[numeric.rep([m+1],0),[],[]];var Li=L[0],Lj=L[1],Lv=L[2],Ui=U[0],Uj=U[1],Uv=U[2];var y=numeric.rep([m],0),xj=numeric.rep([m],0);var i,j,k,j0,j1,a,e,c,d,K;var sol=numeric.ccsLPSolve0,max=Math.max,abs=Math.abs;var P=numeric.linspace(0,m-1),Pinv=numeric.linspace(0,m-1);var dfs=new numeric.ccsDFS0(m);if(typeof threshold==="undefined")threshold=1;for(i=0;i<m;++i){sol(L,A,y,xj,i,Pinv,P,dfs);a=-1;e=-1;
for(j=xj.length-1;j!==-1;--j){k=xj[j];if(k<=i)continue;c=abs(y[P[k]]);if(c>a){e=k;a=c}}if(abs(y[P[i]])<threshold*a){j=P[i];a=P[e];P[i]=a;Pinv[a]=i;P[e]=j;Pinv[j]=e}a=Li[i];e=Ui[i];d=y[P[i]];Lj[a]=P[i];Lv[a]=1;++a;for(j=xj.length-1;j!==-1;--j){k=xj[j];c=y[P[k]];xj[j]=0;y[P[k]]=0;if(k<=i){Uj[e]=k;Uv[e]=c;++e}else{Lj[a]=P[k];Lv[a]=c/d;++a}}Li[i+1]=a;Ui[i+1]=e}for(j=Lj.length-1;j!==-1;--j)Lj[j]=Pinv[Lj[j]];return{L:L,U:U,P:P,Pinv:Pinv}};numeric.ccsLUP=numeric.ccsLUP0;
numeric.ccsDim=function ccsDim(A){return[numeric.sup(A[1])+1,A[0].length-1]};
numeric.ccsGetBlock=function ccsGetBlock(A,i,j){var s=numeric.ccsDim(A),m=s[0],n=s[1];if(typeof i==="undefined")i=numeric.linspace(0,m-1);else if(typeof i==="number")i=[i];if(typeof j==="undefined")j=numeric.linspace(0,n-1);else if(typeof j==="number")j=[j];var p,p0,p1,P=i.length,q,Q=j.length,r,jq,ip;var Bi=numeric.rep([n],0),Bj=[],Bv=[],B=[Bi,Bj,Bv];var Ai=A[0],Aj=A[1],Av=A[2];var x=numeric.rep([m],0),count=0,flags=numeric.rep([m],0);for(q=0;q<Q;++q){jq=j[q];var q0=Ai[jq];var q1=Ai[jq+1];for(p=q0;p<
q1;++p){r=Aj[p];flags[r]=1;x[r]=Av[p]}for(p=0;p<P;++p){ip=i[p];if(flags[ip]){Bj[count]=p;Bv[count]=x[i[p]];++count}}for(p=q0;p<q1;++p){r=Aj[p];flags[r]=0}Bi[q+1]=count}return B};
numeric.ccsDot=function ccsDot(A,B){var Ai=A[0],Aj=A[1],Av=A[2];var Bi=B[0],Bj=B[1],Bv=B[2];var sA=numeric.ccsDim(A),sB=numeric.ccsDim(B);var m=sA[0],n=sA[1],o=sB[1];var x=numeric.rep([m],0),flags=numeric.rep([m],0),xj=Array(m);var Ci=numeric.rep([o],0),Cj=[],Cv=[],C=[Ci,Cj,Cv];var i,j,k,j0,j1,i0,i1,l,p,a,b;for(k=0;k!==o;++k){j0=Bi[k];j1=Bi[k+1];p=0;for(j=j0;j<j1;++j){a=Bj[j];b=Bv[j];i0=Ai[a];i1=Ai[a+1];for(i=i0;i<i1;++i){l=Aj[i];if(flags[l]===0){xj[p]=l;flags[l]=1;p=p+1}x[l]=x[l]+Av[i]*b}}j0=Ci[k];
j1=j0+p;Ci[k+1]=j1;for(j=p-1;j!==-1;--j){b=j0+j;i=xj[j];Cj[b]=i;Cv[b]=x[i];flags[i]=0;x[i]=0}Ci[k+1]=Ci[k]+p}return C};
numeric.ccsLUPSolve=function ccsLUPSolve(LUP,B){var L=LUP.L,U=LUP.U,P=LUP.P;var Bi=B[0];var flag=false;if(typeof Bi!=="object"){B=[[0,B.length],numeric.linspace(0,B.length-1),B];Bi=B[0];flag=true}var Bj=B[1],Bv=B[2];var n=L[0].length-1,m=Bi.length-1;var x=numeric.rep([n],0),xj=Array(n);var b=numeric.rep([n],0),bj=Array(n);var Xi=numeric.rep([m+1],0),Xj=[],Xv=[];var sol=numeric.ccsTSolve;var i,j,j0,j1,k,J,N=0;for(i=0;i<m;++i){k=0;j0=Bi[i];j1=Bi[i+1];for(j=j0;j<j1;++j){J=LUP.Pinv[Bj[j]];bj[k]=J;b[J]=
Bv[j];++k}bj.length=k;sol(L,b,x,bj,xj);for(j=bj.length-1;j!==-1;--j)b[bj[j]]=0;sol(U,x,b,xj,bj);if(flag)return b;for(j=xj.length-1;j!==-1;--j)x[xj[j]]=0;for(j=bj.length-1;j!==-1;--j){J=bj[j];Xj[N]=J;Xv[N]=b[J];b[J]=0;++N}Xi[i+1]=N}return[Xi,Xj,Xv]};
numeric.ccsbinop=function ccsbinop(body,setup){if(typeof setup==="undefined")setup="";return Function("X","Y","var Xi \x3d X[0], Xj \x3d X[1], Xv \x3d X[2];\n"+"var Yi \x3d Y[0], Yj \x3d Y[1], Yv \x3d Y[2];\n"+"var n \x3d Xi.length-1,m \x3d Math.max(numeric.sup(Xj),numeric.sup(Yj))+1;\n"+"var Zi \x3d numeric.rep([n+1],0), Zj \x3d [], Zv \x3d [];\n"+"var x \x3d numeric.rep([m],0),y \x3d numeric.rep([m],0);\n"+"var xk,yk,zk;\n"+"var i,j,j0,j1,k,p\x3d0;\n"+setup+"for(i\x3d0;i\x3cn;++i) {\n"+"  j0 \x3d Xi[i]; j1 \x3d Xi[i+1];\n"+
"  for(j\x3dj0;j!\x3d\x3dj1;++j) {\n"+"    k \x3d Xj[j];\n"+"    x[k] \x3d 1;\n"+"    Zj[p] \x3d k;\n"+"    ++p;\n"+"  }\n"+"  j0 \x3d Yi[i]; j1 \x3d Yi[i+1];\n"+"  for(j\x3dj0;j!\x3d\x3dj1;++j) {\n"+"    k \x3d Yj[j];\n"+"    y[k] \x3d Yv[j];\n"+"    if(x[k] \x3d\x3d\x3d 0) {\n"+"      Zj[p] \x3d k;\n"+"      ++p;\n"+"    }\n"+"  }\n"+"  Zi[i+1] \x3d p;\n"+"  j0 \x3d Xi[i]; j1 \x3d Xi[i+1];\n"+"  for(j\x3dj0;j!\x3d\x3dj1;++j) x[Xj[j]] \x3d Xv[j];\n"+"  j0 \x3d Zi[i]; j1 \x3d Zi[i+1];\n"+"  for(j\x3dj0;j!\x3d\x3dj1;++j) {\n"+
"    k \x3d Zj[j];\n"+"    xk \x3d x[k];\n"+"    yk \x3d y[k];\n"+body+"\n"+"    Zv[j] \x3d zk;\n"+"  }\n"+"  j0 \x3d Xi[i]; j1 \x3d Xi[i+1];\n"+"  for(j\x3dj0;j!\x3d\x3dj1;++j) x[Xj[j]] \x3d 0;\n"+"  j0 \x3d Yi[i]; j1 \x3d Yi[i+1];\n"+"  for(j\x3dj0;j!\x3d\x3dj1;++j) y[Yj[j]] \x3d 0;\n"+"}\n"+"return [Zi,Zj,Zv];")};
(function(){var k,A,B,C;for(k in numeric.ops2){if(isFinite(eval("1"+numeric.ops2[k]+"0")))A="[Y[0],Y[1],numeric."+k+"(X,Y[2])]";else A="NaN";if(isFinite(eval("0"+numeric.ops2[k]+"1")))B="[X[0],X[1],numeric."+k+"(X[2],Y)]";else B="NaN";if(isFinite(eval("1"+numeric.ops2[k]+"0"))&&isFinite(eval("0"+numeric.ops2[k]+"1")))C="numeric.ccs"+k+"MM(X,Y)";else C="NaN";numeric["ccs"+k+"MM"]=numeric.ccsbinop("zk \x3d xk "+numeric.ops2[k]+"yk;");numeric["ccs"+k]=Function("X","Y",'if(typeof X \x3d\x3d\x3d "number") return '+
A+";\n"+'if(typeof Y \x3d\x3d\x3d "number") return '+B+";\n"+"return "+C+";\n")}})();numeric.ccsScatter=function ccsScatter(A){var Ai=A[0],Aj=A[1],Av=A[2];var n=numeric.sup(Aj)+1,m=Ai.length;var Ri=numeric.rep([n],0),Rj=Array(m),Rv=Array(m);var counts=numeric.rep([n],0),i;for(i=0;i<m;++i)counts[Aj[i]]++;for(i=0;i<n;++i)Ri[i+1]=Ri[i]+counts[i];var ptr=Ri.slice(0),k,Aii;for(i=0;i<m;++i){Aii=Aj[i];k=ptr[Aii];Rj[k]=Ai[i];Rv[k]=Av[i];ptr[Aii]=ptr[Aii]+1}return[Ri,Rj,Rv]};
numeric.ccsGather=function ccsGather(A){var Ai=A[0],Aj=A[1],Av=A[2];var n=Ai.length-1,m=Aj.length;var Ri=Array(m),Rj=Array(m),Rv=Array(m);var i,j,j0,j1,p;p=0;for(i=0;i<n;++i){j0=Ai[i];j1=Ai[i+1];for(j=j0;j!==j1;++j){Rj[p]=i;Ri[p]=Aj[j];Rv[p]=Av[j];++p}}return[Ri,Rj,Rv]};
numeric.sdim=function dim(A,ret,k){if(typeof ret==="undefined")ret=[];if(typeof A!=="object")return ret;if(typeof k==="undefined")k=0;if(!(k in ret))ret[k]=0;if(A.length>ret[k])ret[k]=A.length;var i;for(i in A)if(A.hasOwnProperty(i))dim(A[i],ret,k+1);return ret};
numeric.sclone=function clone(A,k,n){if(typeof k==="undefined")k=0;if(typeof n==="undefined")n=numeric.sdim(A).length;var i,ret=Array(A.length);if(k===n-1){for(i in A)if(A.hasOwnProperty(i))ret[i]=A[i];return ret}for(i in A)if(A.hasOwnProperty(i))ret[i]=clone(A[i],k+1,n);return ret};numeric.sdiag=function diag(d){var n=d.length,i,ret=Array(n),i1,i2,i3;for(i=n-1;i>=1;i-=2){i1=i-1;ret[i]=[];ret[i][i]=d[i];ret[i1]=[];ret[i1][i1]=d[i1]}if(i===0){ret[0]=[];ret[0][0]=d[i]}return ret};
numeric.sidentity=function identity(n){return numeric.sdiag(numeric.rep([n],1))};numeric.stranspose=function transpose(A){var ret=[],n=A.length,i,j,Ai;for(i in A){if(!A.hasOwnProperty(i))continue;Ai=A[i];for(j in Ai){if(!Ai.hasOwnProperty(j))continue;if(typeof ret[j]!=="object")ret[j]=[];ret[j][i]=Ai[j]}}return ret};numeric.sLUP=function LUP(A,tol){throw new Error("The function numeric.sLUP had a bug in it and has been removed. Please use the new numeric.ccsLUP function instead.");};
numeric.sdotMM=function dotMM(A,B){var p=A.length,q=B.length,BT=numeric.stranspose(B),r=BT.length,Ai,BTk;var i,j,k,accum;var ret=Array(p),reti;for(i=p-1;i>=0;i--){reti=[];Ai=A[i];for(k=r-1;k>=0;k--){accum=0;BTk=BT[k];for(j in Ai){if(!Ai.hasOwnProperty(j))continue;if(j in BTk)accum+=Ai[j]*BTk[j]}if(accum)reti[k]=accum}ret[i]=reti}return ret};
numeric.sdotMV=function dotMV(A,x){var p=A.length,Ai,i,j;var ret=Array(p),accum;for(i=p-1;i>=0;i--){Ai=A[i];accum=0;for(j in Ai){if(!Ai.hasOwnProperty(j))continue;if(x[j])accum+=Ai[j]*x[j]}if(accum)ret[i]=accum}return ret};numeric.sdotVM=function dotMV(x,A){var i,j,Ai,alpha;var ret=[],accum;for(i in x){if(!x.hasOwnProperty(i))continue;Ai=A[i];alpha=x[i];for(j in Ai){if(!Ai.hasOwnProperty(j))continue;if(!ret[j])ret[j]=0;ret[j]+=alpha*Ai[j]}}return ret};
numeric.sdotVV=function dotVV(x,y){var i,ret=0;for(i in x)if(x[i]&&y[i])ret+=x[i]*y[i];return ret};numeric.sdot=function dot(A,B){var m=numeric.sdim(A).length,n=numeric.sdim(B).length;var k=m*1E3+n;switch(k){case 0:return A*B;case 1001:return numeric.sdotVV(A,B);case 2001:return numeric.sdotMV(A,B);case 1002:return numeric.sdotVM(A,B);case 2002:return numeric.sdotMM(A,B);default:throw new Error("numeric.sdot not implemented for tensors of order "+m+" and "+n);}};
numeric.sscatter=function scatter(V){var n=V[0].length,Vij,i,j,m=V.length,A=[],Aj;for(i=n-1;i>=0;--i){if(!V[m-1][i])continue;Aj=A;for(j=0;j<m-2;j++){Vij=V[j][i];if(!Aj[Vij])Aj[Vij]=[];Aj=Aj[Vij]}Aj[V[j][i]]=V[j+1][i]}return A};
numeric.sgather=function gather(A,ret,k){if(typeof ret==="undefined")ret=[];if(typeof k==="undefined")k=[];var n,i,Ai;n=k.length;for(i in A)if(A.hasOwnProperty(i)){k[n]=parseInt(i);Ai=A[i];if(typeof Ai==="number"){if(Ai){if(ret.length===0)for(i=n+1;i>=0;--i)ret[i]=[];for(i=n;i>=0;--i)ret[i].push(k[i]);ret[n+1].push(Ai)}}else gather(Ai,ret,k)}if(k.length>n)k.pop();return ret};
numeric.cLU=function LU(A){var I=A[0],J=A[1],V=A[2];var p=I.length,m=0,i,j,k,a,b,c;for(i=0;i<p;i++)if(I[i]>m)m=I[i];m++;var L=Array(m),U=Array(m),left=numeric.rep([m],Infinity),right=numeric.rep([m],-Infinity);var Ui,Uj,alpha;for(k=0;k<p;k++){i=I[k];j=J[k];if(j<left[i])left[i]=j;if(j>right[i])right[i]=j}for(i=0;i<m-1;i++)if(right[i]>right[i+1])right[i+1]=right[i];for(i=m-1;i>=1;i--)if(left[i]<left[i-1])left[i-1]=left[i];var countL=0,countU=0;for(i=0;i<m;i++){U[i]=numeric.rep([right[i]-left[i]+1],
0);L[i]=numeric.rep([i-left[i]],0);countL+=i-left[i]+1;countU+=right[i]-i+1}for(k=0;k<p;k++){i=I[k];U[i][J[k]-left[i]]=V[k]}for(i=0;i<m-1;i++){a=i-left[i];Ui=U[i];for(j=i+1;left[j]<=i&&j<m;j++){b=i-left[j];c=right[i]-i;Uj=U[j];alpha=Uj[b]/Ui[a];if(alpha){for(k=1;k<=c;k++)Uj[k+b]-=alpha*Ui[k+a];L[j][i-left[j]]=alpha}}}var Ui=[],Uj=[],Uv=[],Li=[],Lj=[],Lv=[];var p,q,foo;p=0;q=0;for(i=0;i<m;i++){a=left[i];b=right[i];foo=U[i];for(j=i;j<=b;j++)if(foo[j-a]){Ui[p]=i;Uj[p]=j;Uv[p]=foo[j-a];p++}foo=L[i];for(j=
a;j<i;j++)if(foo[j-a]){Li[q]=i;Lj[q]=j;Lv[q]=foo[j-a];q++}Li[q]=i;Lj[q]=i;Lv[q]=1;q++}return{U:[Ui,Uj,Uv],L:[Li,Lj,Lv]}};numeric.cLUsolve=function LUsolve(lu,b){var L=lu.L,U=lu.U,ret=numeric.clone(b);var Li=L[0],Lj=L[1],Lv=L[2];var Ui=U[0],Uj=U[1],Uv=U[2];var p=Ui.length,q=Li.length;var m=ret.length,i,j,k;k=0;for(i=0;i<m;i++){while(Lj[k]<i){ret[i]-=Lv[k]*ret[Lj[k]];k++}k++}k=p-1;for(i=m-1;i>=0;i--){while(Uj[k]>i){ret[i]-=Uv[k]*ret[Uj[k]];k--}ret[i]/=Uv[k];k--}return ret};
numeric.cgrid=function grid(n,shape){if(typeof n==="number")n=[n,n];var ret=numeric.rep(n,-1);var i,j,count;if(typeof shape!=="function")switch(shape){case "L":shape=function(i,j){return i>=n[0]/2||j<n[1]/2};break;default:shape=function(i,j){return true};break}count=0;for(i=1;i<n[0]-1;i++)for(j=1;j<n[1]-1;j++)if(shape(i,j)){ret[i][j]=count;count++}return ret};
numeric.cdelsq=function delsq(g){var dir=[[-1,0],[0,-1],[0,1],[1,0]];var s=numeric.dim(g),m=s[0],n=s[1],i,j,k,p,q;var Li=[],Lj=[],Lv=[];for(i=1;i<m-1;i++)for(j=1;j<n-1;j++){if(g[i][j]<0)continue;for(k=0;k<4;k++){p=i+dir[k][0];q=j+dir[k][1];if(g[p][q]<0)continue;Li.push(g[i][j]);Lj.push(g[p][q]);Lv.push(-1)}Li.push(g[i][j]);Lj.push(g[i][j]);Lv.push(4)}return[Li,Lj,Lv]};
numeric.cdotMV=function dotMV(A,x){var ret,Ai=A[0],Aj=A[1],Av=A[2],k,p=Ai.length,N;N=0;for(k=0;k<p;k++)if(Ai[k]>N)N=Ai[k];N++;ret=numeric.rep([N],0);for(k=0;k<p;k++)ret[Ai[k]]+=Av[k]*x[Aj[k]];return ret};numeric.Spline=function Spline(x,yl,yr,kl,kr){this.x=x;this.yl=yl;this.yr=yr;this.kl=kl;this.kr=kr};
numeric.Spline.prototype._at=function _at(x1,p){var x=this.x;var yl=this.yl;var yr=this.yr;var kl=this.kl;var kr=this.kr;var x1,a,b,t;var add=numeric.add,sub=numeric.sub,mul=numeric.mul;a=sub(mul(kl[p],x[p+1]-x[p]),sub(yr[p+1],yl[p]));b=add(mul(kr[p+1],x[p]-x[p+1]),sub(yr[p+1],yl[p]));t=(x1-x[p])/(x[p+1]-x[p]);var s=t*(1-t);return add(add(add(mul(1-t,yl[p]),mul(t,yr[p+1])),mul(a,s*(1-t))),mul(b,s*t))};
numeric.Spline.prototype.at=function at(x0){if(typeof x0==="number"){var x=this.x;var n=x.length;var p,q,mid,floor=Math.floor,a,b,t;p=0;q=n-1;while(q-p>1){mid=floor((p+q)/2);if(x[mid]<=x0)p=mid;else q=mid}return this._at(x0,p)}var n=x0.length,i,ret=Array(n);for(i=n-1;i!==-1;--i)ret[i]=this.at(x0[i]);return ret};
numeric.Spline.prototype.diff=function diff(){var x=this.x;var yl=this.yl;var yr=this.yr;var kl=this.kl;var kr=this.kr;var n=yl.length;var i,dx,dy;var zl=kl,zr=kr,pl=Array(n),pr=Array(n);var add=numeric.add,mul=numeric.mul,div=numeric.div,sub=numeric.sub;for(i=n-1;i!==-1;--i){dx=x[i+1]-x[i];dy=sub(yr[i+1],yl[i]);pl[i]=div(add(mul(dy,6),mul(kl[i],-4*dx),mul(kr[i+1],-2*dx)),dx*dx);pr[i+1]=div(add(mul(dy,-6),mul(kl[i],2*dx),mul(kr[i+1],4*dx)),dx*dx)}return new numeric.Spline(x,zl,zr,pl,pr)};
numeric.Spline.prototype.roots=function roots(){function sqr(x){return x*x}function heval(y0,y1,k0,k1,x){var A=k0*2-(y1-y0);var B=-k1*2+(y1-y0);var t=(x+1)*.5;var s=t*(1-t);return(1-t)*y0+t*y1+A*s*(1-t)+B*s*t}var ret=[];var x=this.x,yl=this.yl,yr=this.yr,kl=this.kl,kr=this.kr;if(typeof yl[0]==="number"){yl=[yl];yr=[yr];kl=[kl];kr=[kr]}var m=yl.length,n=x.length-1,i,j,k,y,s,t;var ai,bi,ci,di,ret=Array(m),ri,k0,k1,y0,y1,A,B,D,dx,cx,stops,z0,z1,zm,t0,t1,tm;var sqrt=Math.sqrt;for(i=0;i!==m;++i){ai=yl[i];
bi=yr[i];ci=kl[i];di=kr[i];ri=[];for(j=0;j!==n;j++){if(j>0&&bi[j]*ai[j]<0)ri.push(x[j]);dx=x[j+1]-x[j];cx=x[j];y0=ai[j];y1=bi[j+1];k0=ci[j]/dx;k1=di[j+1]/dx;D=sqr(k0-k1+3*(y0-y1))+12*k1*y0;A=k1+3*y0+2*k0-3*y1;B=3*(k1+k0+2*(y0-y1));if(D<=0){z0=A/B;if(z0>x[j]&&z0<x[j+1])stops=[x[j],z0,x[j+1]];else stops=[x[j],x[j+1]]}else{z0=(A-sqrt(D))/B;z1=(A+sqrt(D))/B;stops=[x[j]];if(z0>x[j]&&z0<x[j+1])stops.push(z0);if(z1>x[j]&&z1<x[j+1])stops.push(z1);stops.push(x[j+1])}t0=stops[0];z0=this._at(t0,j);for(k=0;k<
stops.length-1;k++){t1=stops[k+1];z1=this._at(t1,j);if(z0===0){ri.push(t0);t0=t1;z0=z1;continue}if(z1===0||z0*z1>0){t0=t1;z0=z1;continue}var side=0;while(1){tm=(z0*t1-z1*t0)/(z0-z1);if(tm<=t0||tm>=t1)break;zm=this._at(tm,j);if(zm*z1>0){t1=tm;z1=zm;if(side===-1)z0*=.5;side=-1}else if(zm*z0>0){t0=tm;z0=zm;if(side===1)z1*=.5;side=1}else break}ri.push(tm);t0=stops[k+1];z0=this._at(t0,j)}if(z1===0)ri.push(t1)}ret[i]=ri}if(typeof this.yl[0]==="number")return ret[0];return ret};
numeric.spline=function spline(x,y,k1,kn){var n=x.length,b=[],dx=[],dy=[];var i;var sub=numeric.sub,mul=numeric.mul,add=numeric.add;for(i=n-2;i>=0;i--){dx[i]=x[i+1]-x[i];dy[i]=sub(y[i+1],y[i])}if(typeof k1==="string"||typeof kn==="string")k1=kn="periodic";var T=[[],[],[]];switch(typeof k1){case "undefined":b[0]=mul(3/(dx[0]*dx[0]),dy[0]);T[0].push(0,0);T[1].push(0,1);T[2].push(2/dx[0],1/dx[0]);break;case "string":b[0]=add(mul(3/(dx[n-2]*dx[n-2]),dy[n-2]),mul(3/(dx[0]*dx[0]),dy[0]));T[0].push(0,0,
0);T[1].push(n-2,0,1);T[2].push(1/dx[n-2],2/dx[n-2]+2/dx[0],1/dx[0]);break;default:b[0]=k1;T[0].push(0);T[1].push(0);T[2].push(1);break}for(i=1;i<n-1;i++){b[i]=add(mul(3/(dx[i-1]*dx[i-1]),dy[i-1]),mul(3/(dx[i]*dx[i]),dy[i]));T[0].push(i,i,i);T[1].push(i-1,i,i+1);T[2].push(1/dx[i-1],2/dx[i-1]+2/dx[i],1/dx[i])}switch(typeof kn){case "undefined":b[n-1]=mul(3/(dx[n-2]*dx[n-2]),dy[n-2]);T[0].push(n-1,n-1);T[1].push(n-2,n-1);T[2].push(1/dx[n-2],2/dx[n-2]);break;case "string":T[1][T[1].length-1]=0;break;
default:b[n-1]=kn;T[0].push(n-1);T[1].push(n-1);T[2].push(1);break}if(typeof b[0]!=="number")b=numeric.transpose(b);else b=[b];var k=Array(b.length);if(typeof k1==="string")for(i=k.length-1;i!==-1;--i){k[i]=numeric.ccsLUPSolve(numeric.ccsLUP(numeric.ccsScatter(T)),b[i]);k[i][n-1]=k[i][0]}else for(i=k.length-1;i!==-1;--i)k[i]=numeric.cLUsolve(numeric.cLU(T),b[i]);if(typeof y[0]==="number")k=k[0];else k=numeric.transpose(k);return new numeric.Spline(x,y,y,k,k)};
numeric.fftpow2=function fftpow2(x,y){var n=x.length;if(n===1)return;var cos=Math.cos,sin=Math.sin,i,j;var xe=Array(n/2),ye=Array(n/2),xo=Array(n/2),yo=Array(n/2);j=n/2;for(i=n-1;i!==-1;--i){--j;xo[j]=x[i];yo[j]=y[i];--i;xe[j]=x[i];ye[j]=y[i]}fftpow2(xe,ye);fftpow2(xo,yo);j=n/2;var t,k=-6.283185307179586/n,ci,si;for(i=n-1;i!==-1;--i){--j;if(j===-1)j=n/2-1;t=k*i;ci=cos(t);si=sin(t);x[i]=xe[j]+ci*xo[j]-si*yo[j];y[i]=ye[j]+ci*yo[j]+si*xo[j]}};
numeric._ifftpow2=function _ifftpow2(x,y){var n=x.length;if(n===1)return;var cos=Math.cos,sin=Math.sin,i,j;var xe=Array(n/2),ye=Array(n/2),xo=Array(n/2),yo=Array(n/2);j=n/2;for(i=n-1;i!==-1;--i){--j;xo[j]=x[i];yo[j]=y[i];--i;xe[j]=x[i];ye[j]=y[i]}_ifftpow2(xe,ye);_ifftpow2(xo,yo);j=n/2;var t,k=6.283185307179586/n,ci,si;for(i=n-1;i!==-1;--i){--j;if(j===-1)j=n/2-1;t=k*i;ci=cos(t);si=sin(t);x[i]=xe[j]+ci*xo[j]-si*yo[j];y[i]=ye[j]+ci*yo[j]+si*xo[j]}};
numeric.ifftpow2=function ifftpow2(x,y){numeric._ifftpow2(x,y);numeric.diveq(x,x.length);numeric.diveq(y,y.length)};numeric.convpow2=function convpow2(ax,ay,bx,by){numeric.fftpow2(ax,ay);numeric.fftpow2(bx,by);var i,n=ax.length,axi,bxi,ayi,byi;for(i=n-1;i!==-1;--i){axi=ax[i];ayi=ay[i];bxi=bx[i];byi=by[i];ax[i]=axi*bxi-ayi*byi;ay[i]=axi*byi+ayi*bxi}numeric.ifftpow2(ax,ay)};
numeric.T.prototype.fft=function fft(){var x=this.x,y=this.y;var n=x.length,log=Math.log,log2=log(2),p=Math.ceil(log(2*n-1)/log2),m=Math.pow(2,p);var cx=numeric.rep([m],0),cy=numeric.rep([m],0),cos=Math.cos,sin=Math.sin;var k,c=-3.141592653589793/n,t;var a=numeric.rep([m],0),b=numeric.rep([m],0),nhalf=Math.floor(n/2);for(k=0;k<n;k++)a[k]=x[k];if(typeof y!=="undefined")for(k=0;k<n;k++)b[k]=y[k];cx[0]=1;for(k=1;k<=m/2;k++){t=c*k*k;cx[k]=cos(t);cy[k]=sin(t);cx[m-k]=cos(t);cy[m-k]=sin(t)}var X=new numeric.T(a,
b),Y=new numeric.T(cx,cy);X=X.mul(Y);numeric.convpow2(X.x,X.y,numeric.clone(Y.x),numeric.neg(Y.y));X=X.mul(Y);X.x.length=n;X.y.length=n;return X};
numeric.T.prototype.ifft=function ifft(){var x=this.x,y=this.y;var n=x.length,log=Math.log,log2=log(2),p=Math.ceil(log(2*n-1)/log2),m=Math.pow(2,p);var cx=numeric.rep([m],0),cy=numeric.rep([m],0),cos=Math.cos,sin=Math.sin;var k,c=3.141592653589793/n,t;var a=numeric.rep([m],0),b=numeric.rep([m],0),nhalf=Math.floor(n/2);for(k=0;k<n;k++)a[k]=x[k];if(typeof y!=="undefined")for(k=0;k<n;k++)b[k]=y[k];cx[0]=1;for(k=1;k<=m/2;k++){t=c*k*k;cx[k]=cos(t);cy[k]=sin(t);cx[m-k]=cos(t);cy[m-k]=sin(t)}var X=new numeric.T(a,
b),Y=new numeric.T(cx,cy);X=X.mul(Y);numeric.convpow2(X.x,X.y,numeric.clone(Y.x),numeric.neg(Y.y));X=X.mul(Y);X.x.length=n;X.y.length=n;return X.div(n)};
numeric.gradient=function gradient(f,x){var n=x.length;var f0=f(x);if(isNaN(f0))throw new Error("gradient: f(x) is a NaN!");var max=Math.max;var i,x0=numeric.clone(x),f1,f2,J=Array(n);var div=numeric.div,sub=numeric.sub,errest,roundoff,max=Math.max,eps=.001,abs=Math.abs,min=Math.min;var t0,t1,t2,it=0,d1,d2,N;for(i=0;i<n;i++){var h=max(1E-6*f0,1E-8);while(1){++it;if(it>20)throw new Error("Numerical gradient fails");x0[i]=x[i]+h;f1=f(x0);x0[i]=x[i]-h;f2=f(x0);x0[i]=x[i];if(isNaN(f1)||isNaN(f2)){h/=
16;continue}J[i]=(f1-f2)/(2*h);t0=x[i]-h;t1=x[i];t2=x[i]+h;d1=(f1-f0)/h;d2=(f0-f2)/h;N=max(abs(J[i]),abs(f0),abs(f1),abs(f2),abs(t0),abs(t1),abs(t2),1E-8);errest=min(max(abs(d1-J[i]),abs(d2-J[i]),abs(d1-d2))/N,h/N);if(errest>eps)h/=16;else break}}return J};
numeric.uncmin=function uncmin(f,x0,tol,gradient,maxit,callback,options){var grad=numeric.gradient;if(typeof options==="undefined")options={};if(typeof tol==="undefined")tol=1E-8;if(typeof gradient==="undefined")gradient=function(x){return grad(f,x)};if(typeof maxit==="undefined")maxit=1E3;x0=numeric.clone(x0);var n=x0.length;var f0=f(x0),f1,df0;if(isNaN(f0))throw new Error("uncmin: f(x0) is a NaN!");var max=Math.max,norm2=numeric.norm2;tol=max(tol,numeric.epsilon);var step,g0,g1,H1=options.Hinv||
numeric.identity(n);var dot=numeric.dot,inv=numeric.inv,sub=numeric.sub,add=numeric.add,ten=numeric.tensor,div=numeric.div,mul=numeric.mul;var all=numeric.all,isfinite=numeric.isFinite,neg=numeric.neg;var it=0,i,s,x1,y,Hy,Hs,ys,i0,t,nstep,t1,t2;var msg="";g0=gradient(x0);while(it<maxit){if(typeof callback==="function")if(callback(it,x0,f0,g0,H1)){msg="Callback returned true";break}if(!all(isfinite(g0))){msg="Gradient has Infinity or NaN";break}step=neg(dot(H1,g0));if(!all(isfinite(step))){msg="Search direction has Infinity or NaN";
break}nstep=norm2(step);if(nstep<tol){msg="Newton step smaller than tol";break}t=1;df0=dot(g0,step);x1=x0;while(it<maxit){if(t*nstep<tol)break;s=mul(step,t);x1=add(x0,s);f1=f(x1);if(f1-f0>=.1*t*df0||isNaN(f1)){t*=.5;++it;continue}break}if(t*nstep<tol){msg="Line search step size smaller than tol";break}if(it===maxit){msg="maxit reached during line search";break}g1=gradient(x1);y=sub(g1,g0);ys=dot(y,s);Hy=dot(H1,y);H1=sub(add(H1,mul((ys+dot(y,Hy))/(ys*ys),ten(s,s))),div(add(ten(Hy,s),ten(s,Hy)),ys));
x0=x1;f0=f1;g0=g1;++it}return{solution:x0,f:f0,gradient:g0,invHessian:H1,iterations:it,message:msg}};numeric.Dopri=function Dopri(x,y,f,ymid,iterations,msg,events){this.x=x;this.y=y;this.f=f;this.ymid=ymid;this.iterations=iterations;this.events=events;this.message=msg};
numeric.Dopri.prototype._at=function _at(xi,j){function sqr(x){return x*x}var sol=this;var xs=sol.x;var ys=sol.y;var k1=sol.f;var ymid=sol.ymid;var n=xs.length;var x0,x1,xh,y0,y1,yh,xi;var floor=Math.floor,h;var c=.5;var add=numeric.add,mul=numeric.mul,sub=numeric.sub,p,q,w;x0=xs[j];x1=xs[j+1];y0=ys[j];y1=ys[j+1];h=x1-x0;xh=x0+c*h;yh=ymid[j];p=sub(k1[j],mul(y0,1/(x0-xh)+2/(x0-x1)));q=sub(k1[j+1],mul(y1,1/(x1-xh)+2/(x1-x0)));w=[sqr(xi-x1)*(xi-xh)/sqr(x0-x1)/(x0-xh),sqr(xi-x0)*sqr(xi-x1)/sqr(x0-xh)/
sqr(x1-xh),sqr(xi-x0)*(xi-xh)/sqr(x1-x0)/(x1-xh),(xi-x0)*sqr(xi-x1)*(xi-xh)/sqr(x0-x1)/(x0-xh),(xi-x1)*sqr(xi-x0)*(xi-xh)/sqr(x0-x1)/(x1-xh)];return add(add(add(add(mul(y0,w[0]),mul(yh,w[1])),mul(y1,w[2])),mul(p,w[3])),mul(q,w[4]))};
numeric.Dopri.prototype.at=function at(x){var i,j,k,floor=Math.floor;if(typeof x!=="number"){var n=x.length,ret=Array(n);for(i=n-1;i!==-1;--i)ret[i]=this.at(x[i]);return ret}var x0=this.x;i=0;j=x0.length-1;while(j-i>1){k=floor(.5*(i+j));if(x0[k]<=x)i=k;else j=k}return this._at(x,i)};
numeric.dopri=function dopri(x0,x1,y0,f,tol,maxit,event){if(typeof tol==="undefined")tol=1E-6;if(typeof maxit==="undefined")maxit=1E3;var xs=[x0],ys=[y0],k1=[f(x0,y0)],k2,k3,k4,k5,k6,k7,ymid=[];var A2=1/5;var A3=[3/40,9/40];var A4=[44/45,-56/15,32/9];var A5=[19372/6561,-25360/2187,64448/6561,-212/729];var A6=[9017/3168,-355/33,46732/5247,49/176,-5103/18656];var b=[35/384,0,500/1113,125/192,-2187/6784,11/84];var bm=[.5*6025192743/30085553152,0,.5*51252292925/65400821598,.5*-2691868925/45128329728,
.5*187940372067/1594534317056,.5*-1776094331/19743644256,.5*11237099/235043384];var c=[1/5,3/10,4/5,8/9,1,1];var e=[-71/57600,0,71/16695,-71/1920,17253/339200,-22/525,1/40];var i=0,er,j;var h=(x1-x0)/10;var it=0;var add=numeric.add,mul=numeric.mul,y1,erinf;var max=Math.max,min=Math.min,abs=Math.abs,norminf=numeric.norminf,pow=Math.pow;var any=numeric.any,lt=numeric.lt,and=numeric.and,sub=numeric.sub;var e0,e1,ev;var ret=new numeric.Dopri(xs,ys,k1,ymid,-1,"");if(typeof event==="function")e0=event(x0,
y0);while(x0<x1&&it<maxit){++it;if(x0+h>x1)h=x1-x0;k2=f(x0+c[0]*h,add(y0,mul(A2*h,k1[i])));k3=f(x0+c[1]*h,add(add(y0,mul(A3[0]*h,k1[i])),mul(A3[1]*h,k2)));k4=f(x0+c[2]*h,add(add(add(y0,mul(A4[0]*h,k1[i])),mul(A4[1]*h,k2)),mul(A4[2]*h,k3)));k5=f(x0+c[3]*h,add(add(add(add(y0,mul(A5[0]*h,k1[i])),mul(A5[1]*h,k2)),mul(A5[2]*h,k3)),mul(A5[3]*h,k4)));k6=f(x0+c[4]*h,add(add(add(add(add(y0,mul(A6[0]*h,k1[i])),mul(A6[1]*h,k2)),mul(A6[2]*h,k3)),mul(A6[3]*h,k4)),mul(A6[4]*h,k5)));y1=add(add(add(add(add(y0,mul(k1[i],
h*b[0])),mul(k3,h*b[2])),mul(k4,h*b[3])),mul(k5,h*b[4])),mul(k6,h*b[5]));k7=f(x0+h,y1);er=add(add(add(add(add(mul(k1[i],h*e[0]),mul(k3,h*e[2])),mul(k4,h*e[3])),mul(k5,h*e[4])),mul(k6,h*e[5])),mul(k7,h*e[6]));if(typeof er==="number")erinf=abs(er);else erinf=norminf(er);if(erinf>tol){h=.2*h*pow(tol/erinf,.25);if(x0+h===x0){ret.msg="Step size became too small";break}continue}ymid[i]=add(add(add(add(add(add(y0,mul(k1[i],h*bm[0])),mul(k3,h*bm[2])),mul(k4,h*bm[3])),mul(k5,h*bm[4])),mul(k6,h*bm[5])),mul(k7,
h*bm[6]));++i;xs[i]=x0+h;ys[i]=y1;k1[i]=k7;if(typeof event==="function"){var yi,xl=x0,xr=x0+.5*h,xi;e1=event(xr,ymid[i-1]);ev=and(lt(e0,0),lt(0,e1));if(!any(ev)){xl=xr;xr=x0+h;e0=e1;e1=event(xr,y1);ev=and(lt(e0,0),lt(0,e1))}if(any(ev)){var xc,yc,en,ei;var side=0,sl=1,sr=1;while(1){if(typeof e0==="number")xi=(sr*e1*xl-sl*e0*xr)/(sr*e1-sl*e0);else{xi=xr;for(j=e0.length-1;j!==-1;--j)if(e0[j]<0&&e1[j]>0)xi=min(xi,(sr*e1[j]*xl-sl*e0[j]*xr)/(sr*e1[j]-sl*e0[j]))}if(xi<=xl||xi>=xr)break;yi=ret._at(xi,i-1);
ei=event(xi,yi);en=and(lt(e0,0),lt(0,ei));if(any(en)){xr=xi;e1=ei;ev=en;sr=1;if(side===-1)sl*=.5;else sl=1;side=-1}else{xl=xi;e0=ei;sl=1;if(side===1)sr*=.5;else sr=1;side=1}}y1=ret._at(.5*(x0+xi),i-1);ret.f[i]=f(xi,yi);ret.x[i]=xi;ret.y[i]=yi;ret.ymid[i-1]=y1;ret.events=ev;ret.iterations=it;return ret}}x0+=h;y0=y1;e0=e1;h=min(.8*h*pow(tol/erinf,.25),4*h)}ret.iterations=it;return ret};
numeric.LU=function(A,fast){fast=fast||false;var abs=Math.abs;var i,j,k,absAjk,Akk,Ak,Pk,Ai;var max;var n=A.length,n1=n-1;var P=new Array(n);if(!fast)A=numeric.clone(A);for(k=0;k<n;++k){Pk=k;Ak=A[k];max=abs(Ak[k]);for(j=k+1;j<n;++j){absAjk=abs(A[j][k]);if(max<absAjk){max=absAjk;Pk=j}}P[k]=Pk;if(Pk!=k){A[k]=A[Pk];A[Pk]=Ak;Ak=A[k]}Akk=Ak[k];for(i=k+1;i<n;++i)A[i][k]/=Akk;for(i=k+1;i<n;++i){Ai=A[i];for(j=k+1;j<n1;++j){Ai[j]-=Ai[k]*Ak[j];++j;Ai[j]-=Ai[k]*Ak[j]}if(j===n1)Ai[j]-=Ai[k]*Ak[j]}}return{LU:A,
P:P}};numeric.LUsolve=function LUsolve(LUP,b){var i,j;var LU=LUP.LU;var n=LU.length;var x=numeric.clone(b);var P=LUP.P;var Pi,LUi,LUii,tmp;for(i=n-1;i!==-1;--i)x[i]=b[i];for(i=0;i<n;++i){Pi=P[i];if(P[i]!==i){tmp=x[i];x[i]=x[Pi];x[Pi]=tmp}LUi=LU[i];for(j=0;j<i;++j)x[i]-=x[j]*LUi[j]}for(i=n-1;i>=0;--i){LUi=LU[i];for(j=i+1;j<n;++j)x[i]-=x[j]*LUi[j];x[i]/=LUi[i]}return x};numeric.solve=function solve(A,b,fast){return numeric.LUsolve(numeric.LU(A,fast),b)};
numeric.echelonize=function echelonize(A){var s=numeric.dim(A),m=s[0],n=s[1];var I=numeric.identity(m);var P=Array(m);var i,j,k,l,Ai,Ii,Z,a;var abs=Math.abs;var diveq=numeric.diveq;A=numeric.clone(A);for(i=0;i<m;++i){k=0;Ai=A[i];Ii=I[i];for(j=1;j<n;++j)if(abs(Ai[k])<abs(Ai[j]))k=j;P[i]=k;diveq(Ii,Ai[k]);diveq(Ai,Ai[k]);for(j=0;j<m;++j)if(j!==i){Z=A[j];a=Z[k];for(l=n-1;l!==-1;--l)Z[l]-=Ai[l]*a;Z=I[j];for(l=m-1;l!==-1;--l)Z[l]-=Ii[l]*a}}return{I:I,A:A,P:P}};
numeric.__solveLP=function __solveLP(c,A,b,tol,maxit,x,flag){var sum=numeric.sum,log=numeric.log,mul=numeric.mul,sub=numeric.sub,dot=numeric.dot,div=numeric.div,add=numeric.add;var m=c.length,n=b.length,y;var unbounded=false,cb,i0=0;var alpha=1;var f0,df0,AT=numeric.transpose(A),svd=numeric.svd,transpose=numeric.transpose,leq=numeric.leq,sqrt=Math.sqrt,abs=Math.abs;var muleq=numeric.muleq;var norm=numeric.norminf,any=numeric.any,min=Math.min;var all=numeric.all,gt=numeric.gt;var p=Array(m),A0=Array(n),
e=numeric.rep([n],1),H;var solve=numeric.solve,z=sub(b,dot(A,x)),count;var dotcc=dot(c,c);var g;for(count=i0;count<maxit;++count){var i,j,d;for(i=n-1;i!==-1;--i)A0[i]=div(A[i],z[i]);var A1=transpose(A0);for(i=m-1;i!==-1;--i)p[i]=sum(A1[i]);alpha=.25*abs(dotcc/dot(c,p));var a1=100*sqrt(dotcc/dot(p,p));if(!isFinite(alpha)||alpha>a1)alpha=a1;g=add(c,mul(alpha,p));H=dot(A1,A0);for(i=m-1;i!==-1;--i)H[i][i]+=1;d=solve(H,div(g,alpha),true);var t0=div(z,dot(A,d));var t=1;for(i=n-1;i!==-1;--i)if(t0[i]<0)t=
min(t,-.999*t0[i]);y=sub(x,mul(d,t));z=sub(b,dot(A,y));if(!all(gt(z,0)))return{solution:x,message:"",iterations:count};x=y;if(alpha<tol)return{solution:y,message:"",iterations:count};if(flag){var s=dot(c,g),Ag=dot(A,g);unbounded=true;for(i=n-1;i!==-1;--i)if(s*Ag[i]<0){unbounded=false;break}}else if(x[m-1]>=0)unbounded=false;else unbounded=true;if(unbounded)return{solution:y,message:"Unbounded",iterations:count}}return{solution:x,message:"maximum iteration count exceeded",iterations:count}};
numeric._solveLP=function _solveLP(c,A,b,tol,maxit){var m=c.length,n=b.length,y;var sum=numeric.sum,log=numeric.log,mul=numeric.mul,sub=numeric.sub,dot=numeric.dot,div=numeric.div,add=numeric.add;var c0=numeric.rep([m],0).concat([1]);var J=numeric.rep([n,1],-1);var A0=numeric.blockMatrix([[A,J]]);var b0=b;var y=numeric.rep([m],0).concat(Math.max(0,numeric.sup(numeric.neg(b)))+1);var x0=numeric.__solveLP(c0,A0,b0,tol,maxit,y,false);var x=numeric.clone(x0.solution);x.length=m;var foo=numeric.inf(sub(b,
dot(A,x)));if(foo<0)return{solution:NaN,message:"Infeasible",iterations:x0.iterations};var ret=numeric.__solveLP(c,A,b,tol,maxit-x0.iterations,x,true);ret.iterations+=x0.iterations;return ret};
numeric.solveLP=function solveLP(c,A,b,Aeq,beq,tol,maxit){if(typeof maxit==="undefined")maxit=1E3;if(typeof tol==="undefined")tol=numeric.epsilon;if(typeof Aeq==="undefined")return numeric._solveLP(c,A,b,tol,maxit);var m=Aeq.length,n=Aeq[0].length,o=A.length;var B=numeric.echelonize(Aeq);var flags=numeric.rep([n],0);var P=B.P;var Q=[];var i;for(i=P.length-1;i!==-1;--i)flags[P[i]]=1;for(i=n-1;i!==-1;--i)if(flags[i]===0)Q.push(i);var g=numeric.getRange;var I=numeric.linspace(0,m-1),J=numeric.linspace(0,
o-1);var Aeq2=g(Aeq,I,Q),A1=g(A,J,P),A2=g(A,J,Q),dot=numeric.dot,sub=numeric.sub;var A3=dot(A1,B.I);var A4=sub(A2,dot(A3,Aeq2)),b4=sub(b,dot(A3,beq));var c1=Array(P.length),c2=Array(Q.length);for(i=P.length-1;i!==-1;--i)c1[i]=c[P[i]];for(i=Q.length-1;i!==-1;--i)c2[i]=c[Q[i]];var c4=sub(c2,dot(c1,dot(B.I,Aeq2)));var S=numeric._solveLP(c4,A4,b4,tol,maxit);var x2=S.solution;if(x2!==x2)return S;var x1=dot(B.I,sub(beq,dot(Aeq2,x2)));var x=Array(c.length);for(i=P.length-1;i!==-1;--i)x[P[i]]=x1[i];for(i=
Q.length-1;i!==-1;--i)x[Q[i]]=x2[i];return{solution:x,message:S.message,iterations:S.iterations}};
numeric.MPStoLP=function MPStoLP(MPS){if(MPS instanceof String)MPS.split("\n");var state=0;var states=["Initial state","NAME","ROWS","COLUMNS","RHS","BOUNDS","ENDATA"];var n=MPS.length;var i,j,z,N=0,rows={},sign=[],rl=0,vars={},nv=0;var name;var c=[],A=[],b=[];function err(e){throw new Error("MPStoLP: "+e+"\nLine "+i+": "+MPS[i]+"\nCurrent state: "+states[state]+"\n");}for(i=0;i<n;++i){z=MPS[i];var w0=z.match(/\S*/g);var w=[];for(j=0;j<w0.length;++j)if(w0[j]!=="")w.push(w0[j]);if(w.length===0)continue;
for(j=0;j<states.length;++j)if(z.substr(0,states[j].length)===states[j])break;if(j<states.length){state=j;if(j===1)name=w[1];if(j===6)return{name:name,c:c,A:numeric.transpose(A),b:b,rows:rows,vars:vars};continue}switch(state){case 0:case 1:err("Unexpected line");case 2:switch(w[0]){case "N":if(N===0)N=w[1];else err("Two or more N rows");break;case "L":rows[w[1]]=rl;sign[rl]=1;b[rl]=0;++rl;break;case "G":rows[w[1]]=rl;sign[rl]=-1;b[rl]=0;++rl;break;case "E":rows[w[1]]=rl;sign[rl]=0;b[rl]=0;++rl;break;
default:err("Parse error "+numeric.prettyPrint(w))}break;case 3:if(!vars.hasOwnProperty(w[0])){vars[w[0]]=nv;c[nv]=0;A[nv]=numeric.rep([rl],0);++nv}var p=vars[w[0]];for(j=1;j<w.length;j+=2){if(w[j]===N){c[p]=parseFloat(w[j+1]);continue}var q=rows[w[j]];A[p][q]=(sign[q]<0?-1:1)*parseFloat(w[j+1])}break;case 4:for(j=1;j<w.length;j+=2)b[rows[w[j]]]=(sign[rows[w[j]]]<0?-1:1)*parseFloat(w[j+1]);break;case 5:break;case 6:err("Internal error")}}err("Reached end of file without ENDATA")};
numeric.seedrandom={pow:Math.pow,random:Math.random};
(function(pool,math,width,chunks,significance,overflow,startdenom){math["seedrandom"]=function seedrandom(seed,use_entropy){var key=[];var arc4;seed=mixkey(flatten(use_entropy?[seed,pool]:arguments.length?seed:[(new Date).getTime(),pool,window],3),key);arc4=new ARC4(key);mixkey(arc4.S,pool);math["random"]=function random(){var n=arc4.g(chunks);var d=startdenom;var x=0;while(n<significance){n=(n+x)*width;d*=width;x=arc4.g(1)}while(n>=overflow){n/=2;d/=2;x>>>=1}return(n+x)/d};return seed};function ARC4(key){var t,
u,me=this,keylen=key.length;var i=0,j=me.i=me.j=me.m=0;me.S=[];me.c=[];if(!keylen)key=[keylen++];while(i<width)me.S[i]=i++;for(i=0;i<width;i++){t=me.S[i];j=lowbits(j+t+key[i%keylen]);u=me.S[j];me.S[i]=u;me.S[j]=t}me.g=function getnext(count){var s=me.S;var i=lowbits(me.i+1);var t=s[i];var j=lowbits(me.j+t);var u=s[j];s[i]=u;s[j]=t;var r=s[lowbits(t+u)];while(--count){i=lowbits(i+1);t=s[i];j=lowbits(j+t);u=s[j];s[i]=u;s[j]=t;r=r*width+s[lowbits(t+u)]}me.i=i;me.j=j;return r};me.g(width)}function flatten(obj,
depth,result,prop,typ){result=[];typ=typeof obj;if(depth&&typ=="object")for(prop in obj)if(prop.indexOf("S")<5)try{result.push(flatten(obj[prop],depth-1))}catch(e){}return result.length?result:obj+(typ!="string"?"\x00":"")}function mixkey(seed,key,smear,j){seed+="";smear=0;for(j=0;j<seed.length;j++)key[lowbits(j)]=lowbits((smear^=key[lowbits(j)]*19)+seed.charCodeAt(j));seed="";for(j in key)seed+=String.fromCharCode(key[j]);return seed}function lowbits(n){return n&width-1}startdenom=math.pow(width,
chunks);significance=math.pow(2,significance);overflow=significance*2;mixkey(math.random(),pool)})([],numeric.seedrandom,256,6,52);
(function(exports){function base0to1(A){if(typeof A!=="object")return A;var ret=[],i,n=A.length;for(i=0;i<n;i++)ret[i+1]=base0to1(A[i]);return ret}function base1to0(A){if(typeof A!=="object")return A;var ret=[],i,n=A.length;for(i=1;i<n;i++)ret[i-1]=base1to0(A[i]);return ret}function dpori(a,lda,n){var i,j,k,kp1,t;for(k=1;k<=n;k=k+1){a[k][k]=1/a[k][k];t=-a[k][k];for(i=1;i<k;i=i+1)a[i][k]=t*a[i][k];kp1=k+1;if(n<kp1)break;for(j=kp1;j<=n;j=j+1){t=a[k][j];a[k][j]=0;for(i=1;i<=k;i=i+1)a[i][j]=a[i][j]+t*
a[i][k]}}}function dposl(a,lda,n,b){var i,k,kb,t;for(k=1;k<=n;k=k+1){t=0;for(i=1;i<k;i=i+1)t=t+a[i][k]*b[i];b[k]=(b[k]-t)/a[k][k]}for(kb=1;kb<=n;kb=kb+1){k=n+1-kb;b[k]=b[k]/a[k][k];t=-b[k];for(i=1;i<k;i=i+1)b[i]=b[i]+t*a[i][k]}}function dpofa(a,lda,n,info){var i,j,jm1,k,t,s;for(j=1;j<=n;j=j+1){info[1]=j;s=0;jm1=j-1;if(jm1<1){s=a[j][j]-s;if(s<=0)break;a[j][j]=Math.sqrt(s)}else{for(k=1;k<=jm1;k=k+1){t=a[k][j];for(i=1;i<k;i=i+1)t=t-a[i][j]*a[i][k];t=t/a[k][k];a[k][j]=t;s=s+t*t}s=a[j][j]-s;if(s<=0)break;
a[j][j]=Math.sqrt(s)}info[1]=0}}function qpgen2(dmat,dvec,fddmat,n,sol,crval,amat,bvec,fdamat,q,meq,iact,nact,iter,work,ierr){var i,j,l,l1,info,it1,iwzv,iwrv,iwrm,iwsv,iwuv,nvl,r,iwnbv,temp,sum,t1,tt,gc,gs,nu,t1inf,t2min,vsmall,tmpa,tmpb,go;r=Math.min(n,q);l=2*n+r*(r+5)/2+2*q+1;vsmall=1E-60;do{vsmall=vsmall+vsmall;tmpa=1+.1*vsmall;tmpb=1+.2*vsmall}while(tmpa<=1||tmpb<=1);for(i=1;i<=n;i=i+1)work[i]=dvec[i];for(i=n+1;i<=l;i=i+1)work[i]=0;for(i=1;i<=q;i=i+1)iact[i]=0;info=[];if(ierr[1]===0){dpofa(dmat,
fddmat,n,info);if(info[1]!==0){ierr[1]=2;return}dposl(dmat,fddmat,n,dvec);dpori(dmat,fddmat,n)}else{for(j=1;j<=n;j=j+1){sol[j]=0;for(i=1;i<=j;i=i+1)sol[j]=sol[j]+dmat[i][j]*dvec[i]}for(j=1;j<=n;j=j+1){dvec[j]=0;for(i=j;i<=n;i=i+1)dvec[j]=dvec[j]+dmat[j][i]*sol[i]}}crval[1]=0;for(j=1;j<=n;j=j+1){sol[j]=dvec[j];crval[1]=crval[1]+work[j]*sol[j];work[j]=0;for(i=j+1;i<=n;i=i+1)dmat[i][j]=0}crval[1]=-crval[1]/2;ierr[1]=0;iwzv=n;iwrv=iwzv+n;iwuv=iwrv+r;iwrm=iwuv+r+1;iwsv=iwrm+r*(r+1)/2;iwnbv=iwsv+q;for(i=
1;i<=q;i=i+1){sum=0;for(j=1;j<=n;j=j+1)sum=sum+amat[j][i]*amat[j][i];work[iwnbv+i]=Math.sqrt(sum)}nact=0;iter[1]=0;iter[2]=0;function fn_goto_50(){iter[1]=iter[1]+1;l=iwsv;for(i=1;i<=q;i=i+1){l=l+1;sum=-bvec[i];for(j=1;j<=n;j=j+1)sum=sum+amat[j][i]*sol[j];if(Math.abs(sum)<vsmall)sum=0;if(i>meq)work[l]=sum;else{work[l]=-Math.abs(sum);if(sum>0){for(j=1;j<=n;j=j+1)amat[j][i]=-amat[j][i];bvec[i]=-bvec[i]}}}for(i=1;i<=nact;i=i+1)work[iwsv+iact[i]]=0;nvl=0;temp=0;for(i=1;i<=q;i=i+1)if(work[iwsv+i]<temp*
work[iwnbv+i]){nvl=i;temp=work[iwsv+i]/work[iwnbv+i]}if(nvl===0)return 999;return 0}function fn_goto_55(){for(i=1;i<=n;i=i+1){sum=0;for(j=1;j<=n;j=j+1)sum=sum+dmat[j][i]*amat[j][nvl];work[i]=sum}l1=iwzv;for(i=1;i<=n;i=i+1)work[l1+i]=0;for(j=nact+1;j<=n;j=j+1)for(i=1;i<=n;i=i+1)work[l1+i]=work[l1+i]+dmat[i][j]*work[j];t1inf=true;for(i=nact;i>=1;i=i-1){sum=work[i];l=iwrm+i*(i+3)/2;l1=l-i;for(j=i+1;j<=nact;j=j+1){sum=sum-work[l]*work[iwrv+j];l=l+j}sum=sum/work[l1];work[iwrv+i]=sum;if(iact[i]<meq)break;
if(sum<0)break;t1inf=false;it1=i}if(!t1inf){t1=work[iwuv+it1]/work[iwrv+it1];for(i=1;i<=nact;i=i+1){if(iact[i]<meq)break;if(work[iwrv+i]<0)break;temp=work[iwuv+i]/work[iwrv+i];if(temp<t1){t1=temp;it1=i}}}sum=0;for(i=iwzv+1;i<=iwzv+n;i=i+1)sum=sum+work[i]*work[i];if(Math.abs(sum)<=vsmall)if(t1inf){ierr[1]=1;return 999}else{for(i=1;i<=nact;i=i+1)work[iwuv+i]=work[iwuv+i]-t1*work[iwrv+i];work[iwuv+nact+1]=work[iwuv+nact+1]+t1;return 700}else{sum=0;for(i=1;i<=n;i=i+1)sum=sum+work[iwzv+i]*amat[i][nvl];
tt=-work[iwsv+nvl]/sum;t2min=true;if(!t1inf)if(t1<tt){tt=t1;t2min=false}for(i=1;i<=n;i=i+1){sol[i]=sol[i]+tt*work[iwzv+i];if(Math.abs(sol[i])<vsmall)sol[i]=0}crval[1]=crval[1]+tt*sum*(tt/2+work[iwuv+nact+1]);for(i=1;i<=nact;i=i+1)work[iwuv+i]=work[iwuv+i]-tt*work[iwrv+i];work[iwuv+nact+1]=work[iwuv+nact+1]+tt;if(t2min){nact=nact+1;iact[nact]=nvl;l=iwrm+(nact-1)*nact/2+1;for(i=1;i<=nact-1;i=i+1){work[l]=work[i];l=l+1}if(nact===n)work[l]=work[n];else{for(i=n;i>=nact+1;i=i-1){if(work[i]===0)break;gc=
Math.max(Math.abs(work[i-1]),Math.abs(work[i]));gs=Math.min(Math.abs(work[i-1]),Math.abs(work[i]));if(work[i-1]>=0)temp=Math.abs(gc*Math.sqrt(1+gs*gs/(gc*gc)));else temp=-Math.abs(gc*Math.sqrt(1+gs*gs/(gc*gc)));gc=work[i-1]/temp;gs=work[i]/temp;if(gc===1)break;if(gc===0){work[i-1]=gs*temp;for(j=1;j<=n;j=j+1){temp=dmat[j][i-1];dmat[j][i-1]=dmat[j][i];dmat[j][i]=temp}}else{work[i-1]=temp;nu=gs/(1+gc);for(j=1;j<=n;j=j+1){temp=gc*dmat[j][i-1]+gs*dmat[j][i];dmat[j][i]=nu*(dmat[j][i-1]+temp)-dmat[j][i];
dmat[j][i-1]=temp}}}work[l]=work[nact]}}else{sum=-bvec[nvl];for(j=1;j<=n;j=j+1)sum=sum+sol[j]*amat[j][nvl];if(nvl>meq)work[iwsv+nvl]=sum;else{work[iwsv+nvl]=-Math.abs(sum);if(sum>0){for(j=1;j<=n;j=j+1)amat[j][nvl]=-amat[j][nvl];bvec[nvl]=-bvec[nvl]}}return 700}}return 0}function fn_goto_797(){l=iwrm+it1*(it1+1)/2+1;l1=l+it1;if(work[l1]===0)return 798;gc=Math.max(Math.abs(work[l1-1]),Math.abs(work[l1]));gs=Math.min(Math.abs(work[l1-1]),Math.abs(work[l1]));if(work[l1-1]>=0)temp=Math.abs(gc*Math.sqrt(1+
gs*gs/(gc*gc)));else temp=-Math.abs(gc*Math.sqrt(1+gs*gs/(gc*gc)));gc=work[l1-1]/temp;gs=work[l1]/temp;if(gc===1)return 798;if(gc===0){for(i=it1+1;i<=nact;i=i+1){temp=work[l1-1];work[l1-1]=work[l1];work[l1]=temp;l1=l1+i}for(i=1;i<=n;i=i+1){temp=dmat[i][it1];dmat[i][it1]=dmat[i][it1+1];dmat[i][it1+1]=temp}}else{nu=gs/(1+gc);for(i=it1+1;i<=nact;i=i+1){temp=gc*work[l1-1]+gs*work[l1];work[l1]=nu*(work[l1-1]+temp)-work[l1];work[l1-1]=temp;l1=l1+i}for(i=1;i<=n;i=i+1){temp=gc*dmat[i][it1]+gs*dmat[i][it1+
1];dmat[i][it1+1]=nu*(dmat[i][it1]+temp)-dmat[i][it1+1];dmat[i][it1]=temp}}return 0}function fn_goto_798(){l1=l-it1;for(i=1;i<=it1;i=i+1){work[l1]=work[l];l=l+1;l1=l1+1}work[iwuv+it1]=work[iwuv+it1+1];iact[it1]=iact[it1+1];it1=it1+1;if(it1<nact)return 797;return 0}function fn_goto_799(){work[iwuv+nact]=work[iwuv+nact+1];work[iwuv+nact+1]=0;iact[nact]=0;nact=nact-1;iter[2]=iter[2]+1;return 0}go=0;while(true){go=fn_goto_50();if(go===999)return;while(true){go=fn_goto_55();if(go===0)break;if(go===999)return;
if(go===700)if(it1===nact)fn_goto_799();else{while(true){fn_goto_797();go=fn_goto_798();if(go!==797)break}fn_goto_799()}}}}function solveQP(Dmat,dvec,Amat,bvec,meq,factorized){Dmat=base0to1(Dmat);dvec=base0to1(dvec);Amat=base0to1(Amat);var i,n,q,nact,r,crval=[],iact=[],sol=[],work=[],iter=[],message;meq=meq||0;factorized=factorized?base0to1(factorized):[undefined,0];bvec=bvec?base0to1(bvec):[];n=Dmat.length-1;q=Amat[1].length-1;if(!bvec)for(i=1;i<=q;i=i+1)bvec[i]=0;for(i=1;i<=q;i=i+1)iact[i]=0;nact=
0;r=Math.min(n,q);for(i=1;i<=n;i=i+1)sol[i]=0;crval[1]=0;for(i=1;i<=2*n+r*(r+5)/2+2*q+1;i=i+1)work[i]=0;for(i=1;i<=2;i=i+1)iter[i]=0;qpgen2(Dmat,dvec,n,n,sol,crval,Amat,bvec,n,q,meq,iact,nact,iter,work,factorized);message="";if(factorized[1]===1)message="constraints are inconsistent, no solution!";if(factorized[1]===2)message="matrix D in quadratic function is not positive definite!";return{solution:base1to0(sol),value:base1to0(crval),unconstrained_solution:base1to0(dvec),iterations:base1to0(iter),
iact:base1to0(iact),message:message}}exports.solveQP=solveQP})(numeric);
numeric.svd=function svd(A){var temp;var prec=numeric.epsilon;var tolerance=1E-64/prec;var itmax=50;var c=0;var i=0;var j=0;var k=0;var l=0;var u=numeric.clone(A);var m=u.length;var n=u[0].length;if(m<n)throw"Need more rows than columns";var e=new Array(n);var q=new Array(n);for(i=0;i<n;i++)e[i]=q[i]=0;var v=numeric.rep([n,n],0);function pythag(a,b){a=Math.abs(a);b=Math.abs(b);if(a>b)return a*Math.sqrt(1+b*b/a/a);else if(b==0)return a;return b*Math.sqrt(1+a*a/b/b)}var f=0;var g=0;var h=0;var x=0;
var y=0;var z=0;var s=0;for(i=0;i<n;i++){e[i]=g;s=0;l=i+1;for(j=i;j<m;j++)s+=u[j][i]*u[j][i];if(s<=tolerance)g=0;else{f=u[i][i];g=Math.sqrt(s);if(f>=0)g=-g;h=f*g-s;u[i][i]=f-g;for(j=l;j<n;j++){s=0;for(k=i;k<m;k++)s+=u[k][i]*u[k][j];f=s/h;for(k=i;k<m;k++)u[k][j]+=f*u[k][i]}}q[i]=g;s=0;for(j=l;j<n;j++)s=s+u[i][j]*u[i][j];if(s<=tolerance)g=0;else{f=u[i][i+1];g=Math.sqrt(s);if(f>=0)g=-g;h=f*g-s;u[i][i+1]=f-g;for(j=l;j<n;j++)e[j]=u[i][j]/h;for(j=l;j<m;j++){s=0;for(k=l;k<n;k++)s+=u[j][k]*u[i][k];for(k=
l;k<n;k++)u[j][k]+=s*e[k]}}y=Math.abs(q[i])+Math.abs(e[i]);if(y>x)x=y}for(i=n-1;i!=-1;i+=-1){if(g!=0){h=g*u[i][i+1];for(j=l;j<n;j++)v[j][i]=u[i][j]/h;for(j=l;j<n;j++){s=0;for(k=l;k<n;k++)s+=u[i][k]*v[k][j];for(k=l;k<n;k++)v[k][j]+=s*v[k][i]}}for(j=l;j<n;j++){v[i][j]=0;v[j][i]=0}v[i][i]=1;g=e[i];l=i}for(i=n-1;i!=-1;i+=-1){l=i+1;g=q[i];for(j=l;j<n;j++)u[i][j]=0;if(g!=0){h=u[i][i]*g;for(j=l;j<n;j++){s=0;for(k=l;k<m;k++)s+=u[k][i]*u[k][j];f=s/h;for(k=i;k<m;k++)u[k][j]+=f*u[k][i]}for(j=i;j<m;j++)u[j][i]=
u[j][i]/g}else for(j=i;j<m;j++)u[j][i]=0;u[i][i]+=1}prec=prec*x;for(k=n-1;k!=-1;k+=-1)for(var iteration=0;iteration<itmax;iteration++){var test_convergence=false;for(l=k;l!=-1;l+=-1){if(Math.abs(e[l])<=prec){test_convergence=true;break}if(Math.abs(q[l-1])<=prec)break}if(!test_convergence){c=0;s=1;var l1=l-1;for(i=l;i<k+1;i++){f=s*e[i];e[i]=c*e[i];if(Math.abs(f)<=prec)break;g=q[i];h=pythag(f,g);q[i]=h;c=g/h;s=-f/h;for(j=0;j<m;j++){y=u[j][l1];z=u[j][i];u[j][l1]=y*c+z*s;u[j][i]=-y*s+z*c}}}z=q[k];if(l==
k){if(z<0){q[k]=-z;for(j=0;j<n;j++)v[j][k]=-v[j][k]}break}if(iteration>=itmax-1)throw"Error: no convergence.";x=q[l];y=q[k-1];g=e[k-1];h=e[k];f=((y-z)*(y+z)+(g-h)*(g+h))/(2*h*y);g=pythag(f,1);if(f<0)f=((x-z)*(x+z)+h*(y/(f-g)-h))/x;else f=((x-z)*(x+z)+h*(y/(f+g)-h))/x;c=1;s=1;for(i=l+1;i<k+1;i++){g=e[i];y=q[i];h=s*g;g=c*g;z=pythag(f,h);e[i-1]=z;c=f/z;s=h/z;f=x*c+g*s;g=-x*s+g*c;h=y*s;y=y*c;for(j=0;j<n;j++){x=v[j][i-1];z=v[j][i];v[j][i-1]=x*c+z*s;v[j][i]=-x*s+z*c}z=pythag(f,h);q[i-1]=z;c=f/z;s=h/z;f=
c*g+s*y;x=-s*g+c*y;for(j=0;j<m;j++){y=u[j][i-1];z=u[j][i];u[j][i-1]=y*c+z*s;u[j][i]=-y*s+z*c}}e[l]=0;e[k]=f;q[k]=x}for(i=0;i<q.length;i++)if(q[i]<prec)q[i]=0;for(i=0;i<n;i++)for(j=i-1;j>=0;j--)if(q[j]<q[i]){c=q[j];q[j]=q[i];q[i]=c;for(k=0;k<u.length;k++){temp=u[k][i];u[k][i]=u[k][j];u[k][j]=temp}for(k=0;k<v.length;k++){temp=v[k][i];v[k][i]=v[k][j];v[k][j]=temp}i=j}return{U:u,S:q,V:v}};
!function(t){var r={};function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var i in t)e.d(n,i,function(r){return t[r]}.bind(null,i));return n},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=5)}([function(t,r,e){"use strict";const n=Object.prototype.toString;t.exports=function(t){return n.call(t).endsWith("Array]")}},function(t,r,e){"use strict";var n=this&&this.__values||function(t){var r="function"==typeof Symbol&&t[Symbol.iterator],e=0;return r?r.call(t):{next:function(){return t&&e>=t.length&&(t=void 0),{value:t&&t[e++],done:!t}}}};function i(t,r){return void 0===r&&(r=Math.random),Math.floor(r()*t)}function o(t){return void 0===t&&(t=Math.random),t()}function s(t){for(var r=[],e=0;e<t;e++)r.push(void 0);return r}function a(t,r){return s(t).map(function(){return r})}function h(t){return a(t,0)}function u(t){return t.reduce(function(t,r){return t+r})}Object.defineProperty(r,"__esModule",{value:!0}),r.randomNormal2d=function(t,r,e,n){return void 0===t&&(t=0),void 0===r&&(r=1),void 0===e&&(e=[1,1]),void 0===n&&(n=Math.random),Array(e[0]).fill(0).map(function(){return Array(e[1]).fill(0).map(function(){return function(t,r,e){void 0===e&&(e=Math.random);var n=o(e),i=o(e);return Math.sqrt(-2*Math.log(n))*Math.cos(2*Math.PI*i)*r+t}(t,r,n)})})},r.tauRandInt=i,r.tauRand=o,r.norm=function(t){var r,e,i=0;try{for(var o=n(t),s=o.next();!s.done;s=o.next()){var a=s.value;i+=Math.pow(a,2)}}catch(t){r={error:t}}finally{try{s&&!s.done&&(e=o.return)&&e.call(o)}finally{if(r)throw r.error}}return Math.sqrt(i)},r.empty=s,r.range=function(t){return s(t).map(function(t,r){return r})},r.filled=a,r.zeros=h,r.ones=function(t){return a(t,1)},r.linear=function(t,r,e){return s(e).map(function(n,i){return t+i*((r-t)/(e-1))})},r.sum=u,r.mean=function(t){return u(t)/t.length},r.max=function(t){for(var r=0,e=0;e<t.length;e++)r=t[e]>r?t[e]:r;return r},r.max2d=function(t){for(var r=0,e=0;e<t.length;e++)for(var n=0;n<t[e].length;n++)r=t[e][n]>r?t[e][n]:r;return r},r.rejectionSample=function(t,r){for(var e=h(t),n=0;n<t;n++)for(var o=!0;o;){for(var s=i(r),a=!1,u=0;u<n;u++)if(s===e[u]){a=!0;break}a||(o=!1),e[n]=s}return e},r.reshape2d=function(t,r,e){var n=[],i=0;if(t.length!==r*e)throw new Error("Array dimensions must match input length.");for(var o=0;o<r;o++){for(var s=[],a=0;a<e;a++)s.push(t[i]),i+=1;n.push(s)}return n}},function(t,r,e){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var e in t)Object.hasOwnProperty.call(t,e)&&(r[e]=t[e]);return r.default=t,r};Object.defineProperty(r,"__esModule",{value:!0});var i=n(e(1));function o(t,r){var e=function(e){return i.empty(t).map(function(){return i.filled(r,e)})},n=[];return n.push(e(-1)),n.push(e(1/0)),n.push(e(0)),n}function s(t,r,e,n,i){r=Math.floor(r);var o=t[0][r],s=t[1][r];t[2][r];if(e>=s[0])return 0;for(var h=0;h<o.length;h++)if(n===o[h])return 0;return a(t,r,e,n,i)}function a(t,r,e,n,i){var o=t[0][r],s=t[1][r],a=t[2][r];if(e>=s[0])return 0;s[0]=e,o[0]=n,a[0]=i;for(var h=0,u=0;;){var l=2*h+1,c=l+1,f=t[0][0].length;if(l>=f)break;if(c>=f){if(!(s[l]>e))break;u=l}else if(s[l]>=s[c]){if(!(e<s[l]))break;u=l}else{if(!(e<s[c]))break;u=c}s[h]=s[u],o[h]=o[u],a[h]=a[u],h=u}return s[h]=e,o[h]=n,a[h]=i,1}function h(t,r,e,n){for(;2*n+1<e;){var i=2*n+1,o=i+1,s=n;if(t[s]<t[i]&&(s=i),o<e&&t[s]<t[o]&&(s=o),s===n)break;var a=t[n];t[n]=t[s],t[s]=a;var h=r[n];r[n]=r[s],r[s]=h,n=s}}r.makeHeap=o,r.rejectionSample=function(t,r,e){for(var n=i.zeros(t),o=0;o<t;o++){for(var s=!0,a=0;s;){a=i.tauRandInt(r,e);for(var h=!1,u=0;u<o;u++)if(a===n[u]){h=!0;break}h||(s=!1)}n[o]=a}return n},r.heapPush=s,r.uncheckedHeapPush=a,r.buildCandidates=function(t,r,e,n,a){for(var h=o(r,n),u=0;u<r;u++)for(var l=0;l<e;l++)if(!(t[0][u][l]<0)){var c=t[0][u][l],f=t[2][u][l],m=i.tauRand(a);s(h,u,m,c,f),s(h,c,m,u,f),t[2][u][l]=0}return h},r.deheapSort=function(t){for(var r=t[0],e=t[1],n=0;n<r.length;n++)for(var i=r[n],o=e[n],s=0;s<i.length-1;s++){var a=i.length-s-1,u=o.length-s-1,l=i[0];i[0]=i[a],i[a]=l;var c=o[0];o[0]=o[u],o[u]=c,h(o,i,u,0)}return{indices:r,weights:e}},r.smallestFlagged=function(t,r){for(var e=t[0][r],n=t[1][r],i=t[2][r],o=1/0,s=-1,a=0;a>e.length;a++)1===i[a]&&n[a]<o&&(o=n[a],s=a);return s>=0?(i[s]=0,Math.floor(e[s])):-1}},function(t,r,e){"use strict";var n,i=this&&this.__read||function(t,r){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var n,i,o=e.call(t),s=[];try{for(;(void 0===r||r-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(e=o.return)&&e.call(o)}finally{if(i)throw i.error}}return s},o=this&&this.__spread||function(){for(var t=[],r=0;r<arguments.length;r++)t=t.concat(i(arguments[r]));return t},s=this&&this.__values||function(t){var r="function"==typeof Symbol&&t[Symbol.iterator],e=0;return r?r.call(t):{next:function(){return t&&e>=t.length&&(t=void 0),{value:t&&t[e++],done:!t}}}},a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var e in t)Object.hasOwnProperty.call(t,e)&&(r[e]=t[e]);return r.default=t,r};Object.defineProperty(r,"__esModule",{value:!0});var h=a(e(1)),u=function(){function t(t,r,e,n){this.entries=new Map,this.nRows=0,this.nCols=0,this.rows=o(t),this.cols=o(r),this.values=o(e);for(var i=0;i<e.length;i++){var s=this.makeKey(this.rows[i],this.cols[i]);this.entries.set(s,i)}this.nRows=n[0],this.nCols=n[1]}return t.prototype.makeKey=function(t,r){return t+":"+r},t.prototype.checkDims=function(t,r){if(!(t<this.nRows&&r<this.nCols))throw new Error("array index out of bounds")},t.prototype.set=function(t,r,e){this.checkDims(t,r);var n=this.makeKey(t,r);if(this.entries.has(n)){var i=this.entries.get(n);this.values[i]=e}else this.rows.push(t),this.cols.push(r),this.values.push(e),this.entries.set(n,this.values.length-1)},t.prototype.get=function(t,r,e){void 0===e&&(e=0),this.checkDims(t,r);var n=this.makeKey(t,r);if(this.entries.has(n)){var i=this.entries.get(n);return this.values[i]}return e},t.prototype.getDims=function(){return[this.nRows,this.nCols]},t.prototype.getRows=function(){return o(this.rows)},t.prototype.getCols=function(){return o(this.cols)},t.prototype.getValues=function(){return o(this.values)},t.prototype.forEach=function(t){for(var r=0;r<this.values.length;r++)t(this.values[r],this.rows[r],this.cols[r])},t.prototype.map=function(r){for(var e=[],n=0;n<this.values.length;n++)e.push(r(this.values[n],this.rows[n],this.cols[n]));var i=[this.nRows,this.nCols];return new t(this.rows,this.cols,e,i)},t.prototype.toArray=function(){for(var t=this,r=h.empty(this.nRows).map(function(){return h.zeros(t.nCols)}),e=0;e<this.values.length;e++)r[this.rows[e]][this.cols[e]]=this.values[e];return r},t}();r.SparseMatrix=u,r.transpose=function(t){var r=[],e=[],n=[];t.forEach(function(t,i,o){r.push(i),e.push(o),n.push(t)});var i=[t.nCols,t.nRows];return new u(e,r,n,i)},r.identity=function(t){for(var r=i(t,1)[0],e=new u([],[],[],t),n=0;n<r;n++)e.set(n,n,1);return e},r.pairwiseMultiply=function(t,r){return c(t,r,function(t,r){return t*r})},r.add=function(t,r){return c(t,r,function(t,r){return t+r})},r.subtract=function(t,r){return c(t,r,function(t,r){return t-r})},r.maximum=function(t,r){return c(t,r,function(t,r){return t>r?t:r})},r.multiplyScalar=function(t,r){return t.map(function(t){return t*r})},r.eliminateZeros=function(t){for(var r=new Set,e=t.getValues(),n=t.getRows(),i=t.getCols(),o=0;o<e.length;o++)0===e[o]&&r.add(o);var s=function(t,e){return!r.has(e)},a=e.filter(s),h=n.filter(s),l=i.filter(s);return new u(h,l,a,t.getDims())},r.normalize=function(t,r){var e,n;void 0===r&&(r="l2");var i=l[r],o=new Map;t.forEach(function(t,r,e){var n=o.get(r)||[];n.push(e),o.set(r,n)});var a=new u([],[],[],t.getDims()),h=function(r){for(var e=o.get(r).sort(),n=e.map(function(e){return t.get(r,e)}),s=i(n),h=0;h<s.length;h++)a.set(r,e[h],s[h])};try{for(var c=s(o.keys()),f=c.next();!f.done;f=c.next())h(f.value)}catch(t){e={error:t}}finally{try{f&&!f.done&&(n=c.return)&&n.call(c)}finally{if(e)throw e.error}}return a};var l=((n={}).max=function(t){for(var r=-1/0,e=0;e<t.length;e++)r=t[e]>r?t[e]:r;return t.map(function(t){return t/r})},n.l1=function(t){for(var r=0,e=0;e<t.length;e++)r+=t[e];return t.map(function(t){return t/r})},n.l2=function(t){for(var r=0,e=0;e<t.length;e++)r+=Math.pow(t[e],2);return t.map(function(t){return Math.sqrt(Math.pow(t,2)/r)})},n);function c(t,r,e){for(var n=new Set,i=[],o=[],s=[],a=function(n,a){i.push(n),o.push(a);var h=e(t.get(n,a),r.get(n,a));s.push(h)},h=t.getValues(),l=t.getRows(),c=t.getCols(),f=0;f<h.length;f++){var m=(d=l[f])+":"+(w=c[f]);n.add(m),a(d,w)}var g=r.getValues(),p=r.getRows(),v=r.getCols();for(f=0;f<g.length;f++){var d,w;m=(d=p[f])+":"+(w=v[f]);n.has(m)||a(d,w)}var y=[t.nRows,t.nCols];return new u(i,o,s,y)}r.getCSR=function(t){var r=[];t.forEach(function(t,e,n){r.push({value:t,row:e,col:n})}),r.sort(function(t,r){return t.row===r.row?t.col-r.col:t.row-r.col});for(var e=[],n=[],i=[],o=-1,s=0;s<r.length;s++){var a=r[s],h=a.row,u=a.col,l=a.value;h!==o&&(o=h,i.push(s)),e.push(u),n.push(l)}return{indices:e,values:n,indptr:i}}},function(t,r,e){"use strict";var n=this&&this.__read||function(t,r){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var n,i,o=e.call(t),s=[];try{for(;(void 0===r||r-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(e=o.return)&&e.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spread||function(){for(var t=[],r=0;r<arguments.length;r++)t=t.concat(n(arguments[r]));return t},o=this&&this.__values||function(t){var r="function"==typeof Symbol&&t[Symbol.iterator],e=0;return r?r.call(t):{next:function(){return t&&e>=t.length&&(t=void 0),{value:t&&t[e++],done:!t}}}},s=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var e in t)Object.hasOwnProperty.call(t,e)&&(r[e]=t[e]);return r.default=t,r};Object.defineProperty(r,"__esModule",{value:!0});var a=s(e(1)),h=function(){return function(t,r,e,n){this.hyperplanes=t,this.offsets=r,this.children=e,this.indices=n}}();function u(t,r,e){for(var n=r,i=0;i<e.length;i++)n+=t[i]*e[i];return 0===n?a.tauRandInt(2):n>0?0:1}r.FlatTree=h,r.makeForest=function(t,r,e,n){var o=Math.max(10,r);return a.range(e).map(function(r,e){return function(t,r,e,n){void 0===r&&(r=30);var i=a.range(t.length);return function t(r,e,n,i,o){if(void 0===n&&(n=30),e.length>n){var s=function(t,r,e){var n=t[0].length,i=a.tauRandInt(r.length,e),o=a.tauRandInt(r.length,e);o=(o+=i===o?1:0)%r.length;for(var s=r[i],h=r[o],u=0,l=a.zeros(n),c=0;c<l.length;c++)l[c]=t[s][c]-t[h][c],u-=l[c]*(t[s][c]+t[h][c])/2;for(var f=0,m=0,g=a.zeros(r.length),c=0;c<r.length;c++){for(var p=u,v=0;v<n;v++)p+=l[v]*t[r[c]][v];0===p?(g[c]=a.tauRandInt(2,e),0===g[c]?f+=1:m+=1):p>0?(g[c]=0,f+=1):(g[c]=1,m+=1)}var d=a.zeros(f),w=a.zeros(m);for(var c in f=0,m=0,a.range(g.length))0===g[c]?(d[f]=r[c],f+=1):(w[m]=r[c],m+=1);return{indicesLeft:d,indicesRight:w,hyperplane:l,offset:u}}(r,e,o),h=s.indicesLeft,u=s.indicesRight,l=s.hyperplane,c=s.offset,f=t(r,h,n,i+1,o),m=t(r,u,n,i+1,o),g={leftChild:f,rightChild:m,isLeaf:!1,hyperplane:l,offset:c};return g}var g={indices:e,isLeaf:!0};return g}(t,i,r,e,n)}(t,o,e,n)}).map(function(t){return function(t,r){var e=function t(r){return r.isLeaf?1:1+t(r.leftChild)+t(r.rightChild)}(t),n=function t(r){return r.isLeaf?1:t(r.leftChild)+t(r.rightChild)}(t),o=a.range(e).map(function(){return a.zeros(t.hyperplane.length)}),s=a.zeros(e),u=a.range(e).map(function(){return[-1,-1]}),l=a.range(n).map(function(){return a.range(r).map(function(){return-1})});return function t(r,e,n,o,s,a,h){var u;if(r.isLeaf)return o[a][0]=-h,(u=s[h]).splice.apply(u,i([0,r.indices.length],r.indices)),{nodeNum:a,leafNum:h+=1};e[a]=r.hyperplane,n[a]=r.offset,o[a][0]=a+1;var l=a,c=t(r.leftChild,e,n,o,s,a+1,h);return a=c.nodeNum,h=c.leafNum,o[l][1]=a+1,{nodeNum:(c=t(r.rightChild,e,n,o,s,a+1,h)).nodeNum,leafNum:c.leafNum}}(t,o,s,u,l,0,0),new h(o,s,u,l)}(t,o)})},r.makeLeafArray=function(t){var r,e;if(t.length>0){var n=[];try{for(var s=o(t),a=s.next();!a.done;a=s.next()){var h=a.value;n.push.apply(n,i(h.indices))}}catch(t){r={error:t}}finally{try{a&&!a.done&&(e=s.return)&&e.call(s)}finally{if(r)throw r.error}}return n}return[[-1]]},r.searchFlatTree=function(t,r){for(var e=0;r.children[e][0]>0;)e=0===u(r.hyperplanes[e],r.offsets[e],t)?r.children[e][0]:r.children[e][1];var n=-1*r.children[e][0];return r.indices[n]}},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e(6);window.UMAP=n.UMAP},function(t,r,e){"use strict";var n=this&&this.__awaiter||function(t,r,e,n){return new(e||(e=Promise))(function(i,o){function s(t){try{h(n.next(t))}catch(t){o(t)}}function a(t){try{h(n.throw(t))}catch(t){o(t)}}function h(t){t.done?i(t.value):new e(function(r){r(t.value)}).then(s,a)}h((n=n.apply(t,r||[])).next())})},i=this&&this.__generator||function(t,r){var e,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(e)throw new TypeError("Generator is already executing.");for(;s;)try{if(e=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=r.call(t,s)}catch(t){o=[6,t],n=0}finally{e=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},o=this&&this.__read||function(t,r){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var n,i,o=e.call(t),s=[];try{for(;(void 0===r||r-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(e=o.return)&&e.call(o)}finally{if(i)throw i.error}}return s},s=this&&this.__spread||function(){for(var t=[],r=0;r<arguments.length;r++)t=t.concat(o(arguments[r]));return t},a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var e in t)Object.hasOwnProperty.call(t,e)&&(r[e]=t[e]);return r.default=t,r},h=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0});var u=a(e(2)),l=a(e(3)),c=a(e(7)),f=a(e(4)),m=a(e(1)),g=h(e(8)),p=function(){function t(t){void 0===t&&(t={});var r=this;this.learningRate=1,this.localConnectivity=1,this.minDist=.1,this.nComponents=2,this.nEpochs=0,this.nNeighbors=15,this.negativeSampleRate=5,this.random=Math.random,this.repulsionStrength=1,this.setOpMixRatio=1,this.spread=1,this.transformQueueSize=4,this.targetMetric="categorical",this.targetWeight=.5,this.targetNNeighbors=this.nNeighbors,this.distanceFn=v,this.isInitialized=!1,this.rpForest=[],this.embedding=[],this.optimizationState=new d;var e=function(e){void 0!==t[e]&&(r[e]=t[e])};e("learningRate"),e("localConnectivity"),e("minDist"),e("nComponents"),e("nEpochs"),e("nNeighbors"),e("negativeSampleRate"),e("random"),e("repulsionStrength"),e("setOpMixRatio"),e("spread"),e("transformQueueSize")}return t.prototype.fit=function(t){return this.initializeFit(t),this.optimizeLayout(),this.embedding},t.prototype.fitAsync=function(t,r){return void 0===r&&(r=function(){return!0}),n(this,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:return this.initializeFit(t),[4,this.optimizeLayoutAsync(r)];case 1:return e.sent(),[2,this.embedding]}})})},t.prototype.setSupervisedProjection=function(t,r){void 0===r&&(r={}),this.Y=t,this.targetMetric=r.targetMetric||this.targetMetric,this.targetWeight=r.targetWeight||this.targetWeight,this.targetNNeighbors=r.targetNNeighbors||this.targetNNeighbors},t.prototype.setPrecomputedKNN=function(t,r){this.knnIndices=t,this.knnDistances=r},t.prototype.initializeFit=function(t){if(this.X===t&&this.isInitialized)return this.getNEpochs();if(this.X=t,!this.knnIndices&&!this.knnDistances){var r=this.nearestNeighbors(t);this.knnIndices=r.knnIndices,this.knnDistances=r.knnDistances}this.graph=this.fuzzySimplicialSet(t,this.nNeighbors,this.setOpMixRatio),this.makeSearchFns(),this.searchGraph=this.makeSearchGraph(t),this.processGraphForSupervisedProjection();var e=this.initializeSimplicialSetEmbedding(),n=e.head,i=e.tail,o=e.epochsPerSample;return this.optimizationState.head=n,this.optimizationState.tail=i,this.optimizationState.epochsPerSample=o,this.initializeOptimization(),this.prepareForOptimizationLoop(),this.isInitialized=!0,this.getNEpochs()},t.prototype.makeSearchFns=function(){var t=c.makeInitializations(this.distanceFn),r=t.initFromTree,e=t.initFromRandom;this.initFromTree=r,this.initFromRandom=e,this.search=c.makeInitializedNNSearch(this.distanceFn)},t.prototype.makeSearchGraph=function(t){for(var r=this.knnIndices,e=this.knnDistances,n=[t.length,t.length],i=new l.SparseMatrix([],[],[],n),o=0;o<r.length;o++)for(var s=r[o],a=e[o],h=0;h<s.length;h++){var u=s[h],c=a[h];c>0&&i.set(o,u,c)}var f=l.transpose(i);return l.maximum(i,f)},t.prototype.transform=function(t){var r=this,e=this.X;if(void 0===e||0===e.length)throw new Error("No data has been fit.");var n=Math.floor(this.nNeighbors*this.transformQueueSize),i=c.initializeSearch(this.rpForest,e,t,n,this.initFromRandom,this.initFromTree),o=this.search(e,this.searchGraph,i,t),s=u.deheapSort(o),a=s.indices,h=s.weights;a=a.map(function(t){return t.slice(0,r.nNeighbors)}),h=h.map(function(t){return t.slice(0,r.nNeighbors)});var f=Math.max(0,this.localConnectivity-1),g=this.smoothKNNDistance(h,this.nNeighbors,f),p=g.sigmas,v=g.rhos,d=this.computeMembershipStrengths(a,h,p,v),w=d.rows,y=d.cols,b=d.vals,M=[t.length,e.length],x=new l.SparseMatrix(w,y,b,M),E=l.normalize(x,"l1"),R=l.getCSR(E),k=t.length,z=S(m.reshape2d(R.indices,k,this.nNeighbors),m.reshape2d(R.values,k,this.nNeighbors),this.embedding),N=this.nEpochs?this.nEpochs/3:x.nRows<=1e4?100:30,A=x.getValues().reduce(function(t,r){return r>t?r:t},0);x=x.map(function(t){return t<A/N?0:t}),x=l.eliminateZeros(x);var V=this.makeEpochsPerSample(x.getValues(),N),C=x.getRows(),_=x.getCols();return this.assignOptimizationStateParameters({headEmbedding:z,tailEmbedding:this.embedding,head:C,tail:_,currentEpoch:0,nEpochs:N,nVertices:x.getDims()[1],epochsPerSample:V}),this.prepareForOptimizationLoop(),this.optimizeLayout()},t.prototype.processGraphForSupervisedProjection=function(){var t=this.Y,r=this.X;if(t){if(t.length!==r.length)throw new Error("Length of X and y must be equal");if("categorical"===this.targetMetric){var e=this.targetWeight<1?1/(1-this.targetWeight)*2.5:1e12;this.graph=this.categoricalSimplicialSetIntersection(this.graph,t,e)}}},t.prototype.step=function(){var t=this.optimizationState.currentEpoch;return t<this.getNEpochs()&&this.optimizeLayoutStep(t),this.optimizationState.currentEpoch},t.prototype.getEmbedding=function(){return this.embedding},t.prototype.nearestNeighbors=function(t){var r,e=this.distanceFn,n=this.nNeighbors,i=c.makeNNDescent(e,this.random),o=5+Math.floor(.5===(r=Math.pow(t.length,.5)/20)?0:Math.round(r)),s=Math.max(5,Math.floor(Math.round(function(t){return Math.log(t)/Math.log(2)}(t.length))));this.rpForest=f.makeForest(t,n,o,this.random);var a=i(t,f.makeLeafArray(this.rpForest),n,s);return{knnIndices:a.indices,knnDistances:a.weights}},t.prototype.fuzzySimplicialSet=function(t,r,e){void 0===e&&(e=1);var n=this.knnIndices,i=void 0===n?[]:n,o=this.knnDistances,s=void 0===o?[]:o,a=this.localConnectivity,h=this.smoothKNNDistance(s,r,a),u=h.sigmas,c=h.rhos,f=this.computeMembershipStrengths(i,s,u,c),m=f.rows,g=f.cols,p=f.vals,v=[t.length,t.length],d=new l.SparseMatrix(m,g,p,v),w=l.transpose(d),y=l.pairwiseMultiply(d,w),b=l.subtract(l.add(d,w),y),M=l.multiplyScalar(b,e),x=l.multiplyScalar(y,1-e);return l.add(M,x)},t.prototype.categoricalSimplicialSetIntersection=function(t,r,e,n){void 0===n&&(n=1);var i=M(t,r,n,e);return x(i=l.eliminateZeros(i))},t.prototype.smoothKNNDistance=function(t,r,e,n,i){void 0===e&&(e=1),void 0===n&&(n=64),void 0===i&&(i=1);for(var o=Math.log(r)/Math.log(2)*i,s=m.zeros(t.length),a=m.zeros(t.length),h=0;h<t.length;h++){var u=0,l=1/0,c=1,f=t[h],g=f.filter(function(t){return t>0});if(g.length>=e){var p=Math.floor(e),v=e-p;p>0?(s[h]=g[p-1],v>1e-5&&(s[h]+=v*(g[p]-g[p-1]))):s[h]=v*g[0]}else g.length>0&&(s[h]=m.max(g));for(var d=0;d<n;d++){for(var w=0,y=1;y<t[h].length;y++){var b=t[h][y]-s[h];w+=b>0?Math.exp(-b/c):1}if(Math.abs(w-o)<1e-5)break;w>o?c=(u+(l=c))/2:(u=c,l===1/0?c*=2:c=(u+l)/2)}if(a[h]=c,s[h]>0){var M=m.mean(f);a[h]<.001*M&&(a[h]=.001*M)}else{var x=m.mean(t.map(m.mean));a[h]<.001*x&&(a[h]=.001*x)}}return{sigmas:a,rhos:s}},t.prototype.computeMembershipStrengths=function(t,r,e,n){for(var i=t.length,o=t[0].length,s=m.zeros(i*o),a=m.zeros(i*o),h=m.zeros(i*o),u=0;u<i;u++)for(var l=0;l<o;l++){var c=0;-1!==t[u][l]&&(c=t[u][l]===u?0:r[u][l]-n[u]<=0?1:Math.exp(-(r[u][l]-n[u])/e[u]),s[u*o+l]=u,a[u*o+l]=t[u][l],h[u*o+l]=c)}return{rows:s,cols:a,vals:h}},t.prototype.initializeSimplicialSetEmbedding=function(){for(var t=this,r=this.getNEpochs(),e=this.nComponents,n=this.graph.getValues(),i=0,o=0;o<n.length;o++){var s=n[o];i<n[o]&&(i=s)}var a=this.graph.map(function(t){return t<i/r?0:t});this.embedding=m.zeros(a.nRows).map(function(){return m.zeros(e).map(function(){return 20*m.tauRand(t.random)-10})});var h=[],u=[],l=[];for(o=0;o<a.nRows;o++)for(var c=0;c<a.nCols;c++){(s=a.get(o,c))&&(h.push(s),l.push(o),u.push(c))}return{head:u,tail:l,epochsPerSample:this.makeEpochsPerSample(h,r)}},t.prototype.makeEpochsPerSample=function(t,r){var e=m.filled(t.length,-1),n=m.max(t),i=t.map(function(t){return t/n*r});return i.forEach(function(t,n){t>0&&(e[n]=r/i[n])}),e},t.prototype.assignOptimizationStateParameters=function(t){Object.assign(this.optimizationState,t)},t.prototype.prepareForOptimizationLoop=function(){var t=this.repulsionStrength,r=this.learningRate,e=this.negativeSampleRate,n=this.optimizationState,i=n.epochsPerSample,o=n.headEmbedding,a=n.tailEmbedding,h=o[0].length,u=o.length===a.length,l=i.map(function(t){return t/e}),c=s(l),f=s(i);this.assignOptimizationStateParameters({epochOfNextSample:f,epochOfNextNegativeSample:c,epochsPerNegativeSample:l,moveOther:u,initialAlpha:r,alpha:r,gamma:t,dim:h})},t.prototype.initializeOptimization=function(){var t=this.embedding,r=this.embedding,e=this.optimizationState,n=e.head,i=e.tail,o=e.epochsPerSample,s=this.getNEpochs(),a=this.graph.nCols,h=b(this.spread,this.minDist),u=h.a,l=h.b;this.assignOptimizationStateParameters({headEmbedding:t,tailEmbedding:r,head:n,tail:i,epochsPerSample:o,a:u,b:l,nEpochs:s,nVertices:a})},t.prototype.optimizeLayoutStep=function(t){for(var r=this.optimizationState,e=r.head,n=r.tail,i=r.headEmbedding,o=r.tailEmbedding,s=r.epochsPerSample,a=r.epochOfNextSample,h=r.epochOfNextNegativeSample,u=r.epochsPerNegativeSample,l=r.moveOther,c=r.initialAlpha,f=r.alpha,g=r.gamma,p=r.a,v=r.b,d=r.dim,b=r.nEpochs,M=r.nVertices,x=0;x<s.length;x++)if(!(a[x]>t)){var S=e[x],E=n[x],R=i[S],k=o[E],z=y(R,k),N=0;z>0&&(N=-2*p*v*Math.pow(z,v-1),N/=p*Math.pow(z,v)+1);for(var A=0;A<d;A++){var V=w(N*(R[A]-k[A]),4);R[A]+=V*f,l&&(k[A]+=-V*f)}a[x]+=s[x];for(var C=Math.floor((t-h[x])/u[x]),_=0;_<C;_++){var P=m.tauRandInt(M,this.random),I=o[P],j=y(R,I),O=0;if(j>0)O=2*g*v,O/=(.001+j)*(p*Math.pow(j,v)+1);else if(S===P)continue;for(A=0;A<d;A++){V=4;O>0&&(V=w(O*(R[A]-I[A]),4)),R[A]+=V*f}}h[x]+=C*u[x]}return r.alpha=c*(1-t/b),r.currentEpoch+=1,i},t.prototype.optimizeLayoutAsync=function(t){var r=this;return void 0===t&&(t=function(){return!0}),new Promise(function(e,o){var s=function(){return n(r,void 0,void 0,function(){var r,n,a,h,u,l;return i(this,function(i){try{if(r=this.optimizationState,n=r.nEpochs,a=r.currentEpoch,this.embedding=this.optimizeLayoutStep(a),h=this.optimizationState.currentEpoch,u=!1===t(h),l=h===n,u||l)return[2,e(l)];s()}catch(t){o(t)}return[2]})})};s()})},t.prototype.optimizeLayout=function(t){void 0===t&&(t=function(){return!0});for(var r=!1,e=[];!r;){var n=this.optimizationState,i=n.nEpochs,o=n.currentEpoch;e=this.optimizeLayoutStep(o);var s=this.optimizationState.currentEpoch,a=!1===t(s);r=s===i||a}return e},t.prototype.getNEpochs=function(){var t=this.graph;if(this.nEpochs>0)return this.nEpochs;var r=t.nRows;return r<=2500?500:r<=5e3?400:r<=7500?300:200},t}();function v(t,r){for(var e=0,n=0;n<t.length;n++)e+=Math.pow(t[n]-r[n],2);return Math.sqrt(e)}r.UMAP=p,r.euclidean=v,r.cosine=function(t,r){for(var e=0,n=0,i=0,o=0;o<t.length;o++)e+=t[o]*r[o],n+=Math.pow(t[o],2),i+=Math.pow(r[o],2);return 0===n&&0===i?0:0===n||0===i?1:1-e/Math.sqrt(n*i)};var d=function(){return function(){this.currentEpoch=0,this.headEmbedding=[],this.tailEmbedding=[],this.head=[],this.tail=[],this.epochsPerSample=[],this.epochOfNextSample=[],this.epochOfNextNegativeSample=[],this.epochsPerNegativeSample=[],this.moveOther=!0,this.initialAlpha=1,this.alpha=1,this.gamma=1,this.a=1.5769434603113077,this.b=.8950608779109733,this.dim=2,this.nEpochs=500,this.nVertices=0}}();function w(t,r){return t>r?r:t<-r?-r:t}function y(t,r){for(var e=0,n=0;n<t.length;n++)e+=Math.pow(t[n]-r[n],2);return e}function b(t,r){var e=m.linear(0,3*t,300).map(function(t){return t<r?1:t}),n=m.zeros(e.length).map(function(n,i){return e[i]>=r?Math.exp(-(e[i]-r)/t):n}),i={x:e,y:n},s={damping:1.5,initialValues:[.5,.5],gradientDifference:.1,maxIterations:100,errorTolerance:.01},a=g.default(i,function(t){var r=o(t,2),e=r[0],n=r[1];return function(t){return 1/(1+e*Math.pow(t,2*n))}},s).parameterValues,h=o(a,2);return{a:h[0],b:h[1]}}function M(t,r,e,n){return void 0===e&&(e=1),void 0===n&&(n=5),t.map(function(t,i,o){return-1===r[i]||-1===r[o]?t*Math.exp(-e):r[i]!==r[o]?t*Math.exp(-n):t})}function x(t){t=l.normalize(t,"max");var r=l.transpose(t),e=l.pairwiseMultiply(r,t);return t=l.add(t,l.subtract(r,e)),l.eliminateZeros(t)}function S(t,r,e){for(var n=m.zeros(t.length).map(function(t){return m.zeros(e[0].length)}),i=0;i<t.length;i++)for(var o=0;o<t[0].length;o++)for(var s=0;s<e[0].length;s++){var a=t[i][o];n[i][s]+=r[i][o]*e[a][s]}return n}r.findABParams=b,r.fastIntersection=M,r.resetLocalConnectivity=x,r.initTransform=S},function(t,r,e){"use strict";var n=this&&this.__values||function(t){var r="function"==typeof Symbol&&t[Symbol.iterator],e=0;return r?r.call(t):{next:function(){return t&&e>=t.length&&(t=void 0),{value:t&&t[e++],done:!t}}}},i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var e in t)Object.hasOwnProperty.call(t,e)&&(r[e]=t[e]);return r.default=t,r};Object.defineProperty(r,"__esModule",{value:!0});var o=i(e(2)),s=i(e(3)),a=i(e(4)),h=i(e(1));r.makeNNDescent=function(t,r){return function(e,n,i,s,a,u,l,c){void 0===s&&(s=10),void 0===a&&(a=50),void 0===u&&(u=.001),void 0===l&&(l=.5),void 0===c&&(c=!0);for(var f=e.length,m=o.makeHeap(e.length,i),g=0;g<e.length;g++)for(var p=o.rejectionSample(i,e.length,r),v=0;v<p.length;v++){var d=t(e[g],e[p[v]]);o.heapPush(m,g,d,p[v],1),o.heapPush(m,p[v],d,g,1)}if(c)for(var w=0;w<n.length;w++)for(g=0;g<n[w].length&&!(n[w][g]<0);g++)for(v=g+1;v<n[w].length&&!(n[w][v]<0);v++)d=t(e[n[w][g]],e[n[w][v]]),o.heapPush(m,n[w][g],d,n[w][v],1),o.heapPush(m,n[w][v],d,n[w][g],1);for(w=0;w<s;w++){var y=o.buildCandidates(m,f,i,a,r),b=0;for(g=0;g<f;g++)for(v=0;v<a;v++){var M=Math.floor(y[0][g][v]);if(!(M<0||h.tauRand(r)<l))for(var x=0;x<a;x++){var S=Math.floor(y[0][g][x]),E=y[2][g][v],R=y[2][g][x];S<0||!E&&!R||(d=t(e[M],e[S]),b+=o.heapPush(m,M,d,S,1),b+=o.heapPush(m,S,d,M,1))}}if(b<=u*i*e.length)break}return o.deheapSort(m)}},r.makeInitializations=function(t){return{initFromRandom:function(r,e,n,i){for(var s=0;s<n.length;s++)for(var a=h.rejectionSample(r,e.length),u=0;u<a.length;u++)if(!(a[u]<0)){var l=t(e[a[u]],n[s]);o.heapPush(i,s,l,a[u],1)}},initFromTree:function(r,e,n,i){for(var s=0;s<n.length;s++)for(var h=a.searchFlatTree(n[s],r),u=0;u<h.length;u++){if(h[u]<0)return;var l=t(e[h[u]],n[s]);o.heapPush(i,s,l,h[u],1)}}}},r.makeInitializedNNSearch=function(t){return function(r,e,i,a){for(var h,u,l=s.getCSR(e),c=l.indices,f=l.indptr,m=0;m<a.length;m++)for(var g=new Set(i[0][m]);;){var p=o.smallestFlagged(i,m);if(-1===p)break;var v=c.slice(f[p],f[p+1]);try{for(var d=n(v),w=d.next();!w.done;w=d.next()){var y=w.value;if(y!==p&&-1!==y&&!g.has(y)){var b=t(r[y],a[m]);o.uncheckedHeapPush(i,m,b,y,1),g.add(y)}}}catch(t){h={error:t}}finally{try{w&&!w.done&&(u=d.return)&&u.call(d)}finally{if(h)throw h.error}}}return i}},r.initializeSearch=function(t,r,e,i,s,a){var h,u,l=o.makeHeap(e.length,i);if(s(i,r,e,l),t)try{for(var c=n(t),f=c.next();!f.done;f=c.next())a(f.value,r,e,l)}catch(t){h={error:t}}finally{try{f&&!f.done&&(u=c.return)&&u.call(c)}finally{if(h)throw h.error}}return l}},function(t,r,e){"use strict";var n=e(9);function i(t,r,e){var n=0;const i=e(r);for(var o=0;o<t.x.length;o++)n+=Math.abs(t.y[o]-i(t.x[o]));return n}function o(t,r,e,i,o){var s=n.Matrix.eye(r.length).mul(e*i*i),a=t.x.length,h=new Array(a);const u=o(r);for(var l=0;l<a;l++)h[l]=u(t.x[l]);var c=function(t,r,e,i,o){const s=e.length,a=t.x.length;for(var h=new Array(s),u=0;u<s;u++){h[u]=new Array(a);var l=e.concat();l[u]+=i;for(var c=o(l),f=0;f<a;f++)h[u][f]=r[f]-c(t.x[f])}return new n.Matrix(h)}(t,h,r,i,o),f=function(t,r){const e=t.x.length;for(var i=new Array(e),o=0;o<e;o++)i[o]=t.y[o]-r[o];return new n.Matrix([i])}(t,h).transposeView(),m=n.inverse(s.add(c.mmul(c.transposeView())));return(r=(r=new n.Matrix([r])).sub(m.mmul(c).mmul(f).mul(i).transposeView())).to1DArray()}t.exports=function(t,r,e={}){let{maxIterations:n=100,gradientDifference:s=.1,damping:a=0,errorTolerance:h=.01,initialValues:u}=e;if(a<=0)throw new Error("The damping option must be a positive number");if(!t.x||!t.y)throw new Error("The data parameter must have x and y elements");if(!Array.isArray(t.x)||t.x.length<2||!Array.isArray(t.y)||t.y.length<2)throw new Error("The data parameter elements must be an array with more than 2 points");if(t.x.length!==t.y.length)throw new Error("The data parameter elements must have the same size");var l=u||new Array(r.length).fill(1);if(!Array.isArray(l))throw new Error("initialValues must be an array");for(var c=i(t,l,r),f=c<=h,m=0;m<n&&!f;m++)f=(c=i(t,l=o(t,l,a,s,r),r))<=h;return{parameterValues:l,parameterError:c,iterations:m}}},function(t,r,e){"use strict";e.r(r);var n=e(0),i=e.n(n);var o=function(t){if(!i()(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");for(var r=t[0],e=1;e<t.length;e++)t[e]>r&&(r=t[e]);return r};var s=function(t){if(!i()(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");for(var r=t[0],e=1;e<t.length;e++)t[e]<r&&(r=t[e]);return r};var a=function(t){var r,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!i()(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");if(void 0!==e.output){if(!i()(e.output))throw new TypeError("output option must be an array if specified");r=e.output}else r=new Array(t.length);var n=s(t),a=o(t);if(n===a)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var h=e.min,u=void 0===h?e.autoMinMax?n:0:h,l=e.max,c=void 0===l?e.autoMinMax?a:1:l;if(u>=c)throw new RangeError("min option must be smaller than max option");for(var f=(c-u)/(a-n),m=0;m<t.length;m++)r[m]=(t[m]-n)*f+u;return r};class h{constructor(t){var r,e,n,i,o,s,a,h,u,l=(t=I.checkMatrix(t)).clone(),c=l.rows,f=l.columns,m=new Array(c),g=1;for(r=0;r<c;r++)m[r]=r;for(h=new Array(c),e=0;e<f;e++){for(r=0;r<c;r++)h[r]=l.get(r,e);for(r=0;r<c;r++){for(u=Math.min(r,e),o=0,n=0;n<u;n++)o+=l.get(r,n)*h[n];h[r]-=o,l.set(r,e,h[r])}for(i=e,r=e+1;r<c;r++)Math.abs(h[r])>Math.abs(h[i])&&(i=r);if(i!==e){for(n=0;n<f;n++)s=l.get(i,n),l.set(i,n,l.get(e,n)),l.set(e,n,s);a=m[i],m[i]=m[e],m[e]=a,g=-g}if(e<c&&0!==l.get(e,e))for(r=e+1;r<c;r++)l.set(r,e,l.get(r,e)/l.get(e,e))}this.LU=l,this.pivotVector=m,this.pivotSign=g}isSingular(){for(var t=this.LU,r=t.columns,e=0;e<r;e++)if(0===t[e][e])return!0;return!1}solve(t){t=_.checkMatrix(t);var r=this.LU;if(r.rows!==t.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");var e,n,i,o=t.columns,s=t.subMatrixRow(this.pivotVector,0,o-1),a=r.columns;for(i=0;i<a;i++)for(e=i+1;e<a;e++)for(n=0;n<o;n++)s[e][n]-=s[i][n]*r[e][i];for(i=a-1;i>=0;i--){for(n=0;n<o;n++)s[i][n]/=r[i][i];for(e=0;e<i;e++)for(n=0;n<o;n++)s[e][n]-=s[i][n]*r[e][i]}return s}get determinant(){var t=this.LU;if(!t.isSquare())throw new Error("Matrix must be square");for(var r=this.pivotSign,e=t.columns,n=0;n<e;n++)r*=t[n][n];return r}get lowerTriangularMatrix(){for(var t=this.LU,r=t.rows,e=t.columns,n=new _(r,e),i=0;i<r;i++)for(var o=0;o<e;o++)n[i][o]=i>o?t[i][o]:i===o?1:0;return n}get upperTriangularMatrix(){for(var t=this.LU,r=t.rows,e=t.columns,n=new _(r,e),i=0;i<r;i++)for(var o=0;o<e;o++)n[i][o]=i<=o?t[i][o]:0;return n}get pivotPermutationVector(){return this.pivotVector.slice()}}function u(t,r){var e=0;return Math.abs(t)>Math.abs(r)?(e=r/t,Math.abs(t)*Math.sqrt(1+e*e)):0!==r?(e=t/r,Math.abs(r)*Math.sqrt(1+e*e)):0}function l(t,r,e){for(var n=new Array(t),i=0;i<t;i++){n[i]=new Array(r);for(var o=0;o<r;o++)n[i][o]=e}return n}class c{constructor(t,r={}){var e=(t=I.checkMatrix(t)).rows,n=t.columns;const{computeLeftSingularVectors:i=!0,computeRightSingularVectors:o=!0,autoTranspose:s=!1}=r;var a,h=Boolean(i),c=Boolean(o),f=!1;if(e<n)if(s){e=(a=t.transpose()).rows,n=a.columns,f=!0;var m=h;h=c,c=m}else a=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else a=t.clone();var g=Math.min(e,n),p=Math.min(e+1,n),v=new Array(p),d=l(e,g,0),w=l(n,n,0),y=new Array(n),b=new Array(e),M=new Array(p);for(let t=0;t<p;t++)M[t]=t;var x=Math.min(e-1,n),S=Math.max(0,Math.min(n-2,e)),E=Math.max(x,S);for(let t=0;t<E;t++){if(t<x){v[t]=0;for(let r=t;r<e;r++)v[t]=u(v[t],a[r][t]);if(0!==v[t]){a[t][t]<0&&(v[t]=-v[t]);for(let r=t;r<e;r++)a[r][t]/=v[t];a[t][t]+=1}v[t]=-v[t]}for(let r=t+1;r<n;r++){if(t<x&&0!==v[t]){let n=0;for(let i=t;i<e;i++)n+=a[i][t]*a[i][r];n=-n/a[t][t];for(let i=t;i<e;i++)a[i][r]+=n*a[i][t]}y[r]=a[t][r]}if(h&&t<x)for(let r=t;r<e;r++)d[r][t]=a[r][t];if(t<S){y[t]=0;for(let r=t+1;r<n;r++)y[t]=u(y[t],y[r]);if(0!==y[t]){y[t+1]<0&&(y[t]=0-y[t]);for(let r=t+1;r<n;r++)y[r]/=y[t];y[t+1]+=1}if(y[t]=-y[t],t+1<e&&0!==y[t]){for(let r=t+1;r<e;r++)b[r]=0;for(let r=t+1;r<e;r++)for(let e=t+1;e<n;e++)b[r]+=y[e]*a[r][e];for(let r=t+1;r<n;r++){let n=-y[r]/y[t+1];for(let i=t+1;i<e;i++)a[i][r]+=n*b[i]}}if(c)for(let r=t+1;r<n;r++)w[r][t]=y[r]}}let R=Math.min(n,e+1);if(x<n&&(v[x]=a[x][x]),e<R&&(v[R-1]=0),S+1<R&&(y[S]=a[S][R-1]),y[R-1]=0,h){for(let t=x;t<g;t++){for(let r=0;r<e;r++)d[r][t]=0;d[t][t]=1}for(let t=x-1;t>=0;t--)if(0!==v[t]){for(let r=t+1;r<g;r++){let n=0;for(let i=t;i<e;i++)n+=d[i][t]*d[i][r];n=-n/d[t][t];for(let i=t;i<e;i++)d[i][r]+=n*d[i][t]}for(let r=t;r<e;r++)d[r][t]=-d[r][t];d[t][t]=1+d[t][t];for(let r=0;r<t-1;r++)d[r][t]=0}else{for(let r=0;r<e;r++)d[r][t]=0;d[t][t]=1}}if(c)for(let t=n-1;t>=0;t--){if(t<S&&0!==y[t])for(let r=t+1;r<n;r++){let e=0;for(let i=t+1;i<n;i++)e+=w[i][t]*w[i][r];e=-e/w[t+1][t];for(let i=t+1;i<n;i++)w[i][r]+=e*w[i][t]}for(let r=0;r<n;r++)w[r][t]=0;w[t][t]=1}for(var k=R-1,z=Number.EPSILON;R>0;){let t,r;for(t=R-2;t>=-1&&-1!==t;t--){const r=Number.MIN_VALUE+z*Math.abs(v[t]+Math.abs(v[t+1]));if(Math.abs(y[t])<=r||Number.isNaN(y[t])){y[t]=0;break}}if(t===R-2)r=4;else{let e;for(e=R-1;e>=t&&e!==t;e--){let r=(e!==R?Math.abs(y[e]):0)+(e!==t+1?Math.abs(y[e-1]):0);if(Math.abs(v[e])<=z*r){v[e]=0;break}}e===t?r=3:e===R-1?r=1:(r=2,t=e)}switch(t++,r){case 1:{let r=y[R-2];y[R-2]=0;for(let e=R-2;e>=t;e--){let i=u(v[e],r),o=v[e]/i,s=r/i;if(v[e]=i,e!==t&&(r=-s*y[e-1],y[e-1]=o*y[e-1]),c)for(let t=0;t<n;t++)i=o*w[t][e]+s*w[t][R-1],w[t][R-1]=-s*w[t][e]+o*w[t][R-1],w[t][e]=i}break}case 2:{let r=y[t-1];y[t-1]=0;for(let n=t;n<R;n++){let i=u(v[n],r),o=v[n]/i,s=r/i;if(v[n]=i,r=-s*y[n],y[n]=o*y[n],h)for(let r=0;r<e;r++)i=o*d[r][n]+s*d[r][t-1],d[r][t-1]=-s*d[r][n]+o*d[r][t-1],d[r][n]=i}break}case 3:{const r=Math.max(Math.abs(v[R-1]),Math.abs(v[R-2]),Math.abs(y[R-2]),Math.abs(v[t]),Math.abs(y[t])),i=v[R-1]/r,o=v[R-2]/r,s=y[R-2]/r,a=v[t]/r,l=y[t]/r,f=((o+i)*(o-i)+s*s)/2,m=i*s*(i*s);let g=0;0===f&&0===m||(g=m/(f+(g=f<0?0-Math.sqrt(f*f+m):Math.sqrt(f*f+m))));let p=(a+i)*(a-i)+g,b=a*l;for(let r=t;r<R-1;r++){let i=u(p,b);0===i&&(i=Number.MIN_VALUE);let o=p/i,s=b/i;if(r!==t&&(y[r-1]=i),p=o*v[r]+s*y[r],y[r]=o*y[r]-s*v[r],b=s*v[r+1],v[r+1]=o*v[r+1],c)for(let t=0;t<n;t++)i=o*w[t][r]+s*w[t][r+1],w[t][r+1]=-s*w[t][r]+o*w[t][r+1],w[t][r]=i;if(0===(i=u(p,b))&&(i=Number.MIN_VALUE),o=p/i,s=b/i,v[r]=i,p=o*y[r]+s*v[r+1],v[r+1]=-s*y[r]+o*v[r+1],b=s*y[r+1],y[r+1]=o*y[r+1],h&&r<e-1)for(let t=0;t<e;t++)i=o*d[t][r]+s*d[t][r+1],d[t][r+1]=-s*d[t][r]+o*d[t][r+1],d[t][r]=i}y[R-2]=p,1;break}case 4:if(v[t]<=0&&(v[t]=v[t]<0?-v[t]:0,c))for(let r=0;r<=k;r++)w[r][t]=-w[r][t];for(;t<k&&!(v[t]>=v[t+1]);){let r=v[t];if(v[t]=v[t+1],v[t+1]=r,c&&t<n-1)for(let e=0;e<n;e++)r=w[e][t+1],w[e][t+1]=w[e][t],w[e][t]=r;if(h&&t<e-1)for(let n=0;n<e;n++)r=d[n][t+1],d[n][t+1]=d[n][t],d[n][t]=r;t++}0,R--}}if(f){var N=w;w=d,d=N}this.m=e,this.n=n,this.s=v,this.U=d,this.V=w}solve(t){var r=t,e=this.threshold,n=this.s.length,i=_.zeros(n,n);for(let t=0;t<n;t++)Math.abs(this.s[t])<=e?i[t][t]=0:i[t][t]=1/this.s[t];var o=this.U,s=this.rightSingularVectors,a=s.mmul(i),h=s.rows,u=o.length,l=_.zeros(h,u);for(let t=0;t<h;t++)for(let r=0;r<u;r++){let e=0;for(let i=0;i<n;i++)e+=a[t][i]*o[r][i];l[t][r]=e}return l.mmul(r)}solveForDiagonal(t){return this.solve(_.diag(t))}inverse(){var t=this.V,r=this.threshold,e=t.length,n=t[0].length,i=new _(e,this.s.length);for(let o=0;o<e;o++)for(let e=0;e<n;e++)Math.abs(this.s[e])>r?i[o][e]=t[o][e]/this.s[e]:i[o][e]=0;var o=this.U,s=o.length,a=o[0].length,h=new _(e,s);for(let t=0;t<e;t++)for(let r=0;r<s;r++){let e=0;for(let n=0;n<a;n++)e+=i[t][n]*o[r][n];h[t][r]=e}return h}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){for(var t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,r=0,e=this.s,n=0,i=e.length;n<i;n++)e[n]>t&&r++;return r}get diagonal(){return this.s}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return _.isMatrix(this.U)||(this.U=new _(this.U)),this.U}get rightSingularVectors(){return _.isMatrix(this.V)||(this.V=new _(this.V)),this.V}get diagonalMatrix(){return _.diag(this.s)}}function f(t,r,e){var n=e?t.rows:t.rows-1;if(r<0||r>n)throw new RangeError("Row index out of range")}function m(t,r,e){var n=e?t.columns:t.columns-1;if(r<0||r>n)throw new RangeError("Column index out of range")}function g(t,r){if(r.to1DArray&&(r=r.to1DArray()),r.length!==t.columns)throw new RangeError("vector size must be the same as the number of columns");return r}function p(t,r){if(r.to1DArray&&(r=r.to1DArray()),r.length!==t.rows)throw new RangeError("vector size must be the same as the number of rows");return r}function v(t,r,e){return{row:d(t,r),column:w(t,e)}}function d(t,r){if("object"!=typeof r)throw new TypeError("unexpected type for row indices");if(r.some(r=>r<0||r>=t.rows))throw new RangeError("row indices are out of range");return Array.isArray(r)||(r=Array.from(r)),r}function w(t,r){if("object"!=typeof r)throw new TypeError("unexpected type for column indices");if(r.some(r=>r<0||r>=t.columns))throw new RangeError("column indices are out of range");return Array.isArray(r)||(r=Array.from(r)),r}function y(t,r,e,n,i){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(b("startRow",r),b("endRow",e),b("startColumn",n),b("endColumn",i),r>e||n>i||r<0||r>=t.rows||e<0||e>=t.rows||n<0||n>=t.columns||i<0||i>=t.columns)throw new RangeError("Submatrix indices are out of range")}function b(t,r){if("number"!=typeof r)throw new TypeError(`${t} must be a number`)}class M extends(C()){constructor(t,r,e){super(),this.matrix=t,this.rows=r,this.columns=e}static get[Symbol.species](){return _}}class x extends M{constructor(t){super(t,t.columns,t.rows)}set(t,r,e){return this.matrix.set(r,t,e),this}get(t,r){return this.matrix.get(r,t)}}class S extends M{constructor(t,r){super(t,1,t.columns),this.row=r}set(t,r,e){return this.matrix.set(this.row,r,e),this}get(t,r){return this.matrix.get(this.row,r)}}class E extends M{constructor(t,r,e,n,i){y(t,r,e,n,i),super(t,e-r+1,i-n+1),this.startRow=r,this.startColumn=n}set(t,r,e){return this.matrix.set(this.startRow+t,this.startColumn+r,e),this}get(t,r){return this.matrix.get(this.startRow+t,this.startColumn+r)}}class R extends M{constructor(t,r,e){var n=v(t,r,e);super(t,n.row.length,n.column.length),this.rowIndices=n.row,this.columnIndices=n.column}set(t,r,e){return this.matrix.set(this.rowIndices[t],this.columnIndices[r],e),this}get(t,r){return this.matrix.get(this.rowIndices[t],this.columnIndices[r])}}class k extends M{constructor(t,r){super(t,(r=d(t,r)).length,t.columns),this.rowIndices=r}set(t,r,e){return this.matrix.set(this.rowIndices[t],r,e),this}get(t,r){return this.matrix.get(this.rowIndices[t],r)}}class z extends M{constructor(t,r){r=w(t,r),super(t,t.rows,r.length),this.columnIndices=r}set(t,r,e){return this.matrix.set(t,this.columnIndices[r],e),this}get(t,r){return this.matrix.get(t,this.columnIndices[r])}}class N extends M{constructor(t,r){super(t,t.rows,1),this.column=r}set(t,r,e){return this.matrix.set(t,this.column,e),this}get(t){return this.matrix.get(t,this.column)}}class A extends M{constructor(t){super(t,t.rows,t.columns)}set(t,r,e){return this.matrix.set(this.rows-t-1,r,e),this}get(t,r){return this.matrix.get(this.rows-t-1,r)}}class V extends M{constructor(t){super(t,t.rows,t.columns)}set(t,r,e){return this.matrix.set(t,this.columns-r-1,e),this}get(t,r){return this.matrix.get(t,this.columns-r-1)}}function C(t){void 0===t&&(t=Object);class r extends t{static get[Symbol.species](){return this}static from1DArray(t,r,e){if(t*r!==e.length)throw new RangeError("Data length does not match given dimensions");for(var n=new this(t,r),i=0;i<t;i++)for(var o=0;o<r;o++)n.set(i,o,e[i*r+o]);return n}static rowVector(t){for(var r=new this(1,t.length),e=0;e<t.length;e++)r.set(0,e,t[e]);return r}static columnVector(t){for(var r=new this(t.length,1),e=0;e<t.length;e++)r.set(e,0,t[e]);return r}static empty(t,r){return new this(t,r)}static zeros(t,r){return this.empty(t,r).fill(0)}static ones(t,r){return this.empty(t,r).fill(1)}static rand(t,r,e){void 0===e&&(e=Math.random);for(var n=this.empty(t,r),i=0;i<t;i++)for(var o=0;o<r;o++)n.set(i,o,e());return n}static randInt(t,r,e,n){void 0===e&&(e=1e3),void 0===n&&(n=Math.random);for(var i=this.empty(t,r),o=0;o<t;o++)for(var s=0;s<r;s++){var a=Math.floor(n()*e);i.set(o,s,a)}return i}static eye(t,r,e){void 0===r&&(r=t),void 0===e&&(e=1);for(var n=Math.min(t,r),i=this.zeros(t,r),o=0;o<n;o++)i.set(o,o,e);return i}static diag(t,r,e){var n=t.length;void 0===r&&(r=n),void 0===e&&(e=r);for(var i=Math.min(n,r,e),o=this.zeros(r,e),s=0;s<i;s++)o.set(s,s,t[s]);return o}static min(t,r){t=this.checkMatrix(t),r=this.checkMatrix(r);for(var e=t.rows,n=t.columns,i=new this(e,n),o=0;o<e;o++)for(var s=0;s<n;s++)i.set(o,s,Math.min(t.get(o,s),r.get(o,s)));return i}static max(t,r){t=this.checkMatrix(t),r=this.checkMatrix(r);for(var e=t.rows,n=t.columns,i=new this(e,n),o=0;o<e;o++)for(var s=0;s<n;s++)i.set(o,s,Math.max(t.get(o,s),r.get(o,s)));return i}static checkMatrix(t){return r.isMatrix(t)?t:new this(t)}static isMatrix(t){return null!=t&&"Matrix"===t.klass}get size(){return this.rows*this.columns}apply(t){if("function"!=typeof t)throw new TypeError("callback must be a function");for(var r=this.rows,e=this.columns,n=0;n<r;n++)for(var i=0;i<e;i++)t.call(this,n,i);return this}to1DArray(){for(var t=new Array(this.size),r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)t[r*this.columns+e]=this.get(r,e);return t}to2DArray(){for(var t=new Array(this.rows),r=0;r<this.rows;r++){t[r]=new Array(this.columns);for(var e=0;e<this.columns;e++)t[r][e]=this.get(r,e)}return t}isRowVector(){return 1===this.rows}isColumnVector(){return 1===this.columns}isVector(){return 1===this.rows||1===this.columns}isSquare(){return this.rows===this.columns}isSymmetric(){if(this.isSquare()){for(var t=0;t<this.rows;t++)for(var r=0;r<=t;r++)if(this.get(t,r)!==this.get(r,t))return!1;return!0}return!1}set(t,r,e){throw new Error("set method is unimplemented")}get(t,r){throw new Error("get method is unimplemented")}repeat(t,r){t=t||1,r=r||1;for(var e=new this.constructor[Symbol.species](this.rows*t,this.columns*r),n=0;n<t;n++)for(var i=0;i<r;i++)e.setSubMatrix(this,this.rows*n,this.columns*i);return e}fill(t){for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,t);return this}neg(){return this.mulS(-1)}getRow(t){f(this,t);for(var r=new Array(this.columns),e=0;e<this.columns;e++)r[e]=this.get(t,e);return r}getRowVector(t){return this.constructor.rowVector(this.getRow(t))}setRow(t,r){f(this,t),r=g(this,r);for(var e=0;e<this.columns;e++)this.set(t,e,r[e]);return this}swapRows(t,r){f(this,t),f(this,r);for(var e=0;e<this.columns;e++){var n=this.get(t,e);this.set(t,e,this.get(r,e)),this.set(r,e,n)}return this}getColumn(t){m(this,t);for(var r=new Array(this.rows),e=0;e<this.rows;e++)r[e]=this.get(e,t);return r}getColumnVector(t){return this.constructor.columnVector(this.getColumn(t))}setColumn(t,r){m(this,t),r=p(this,r);for(var e=0;e<this.rows;e++)this.set(e,t,r[e]);return this}swapColumns(t,r){m(this,t),m(this,r);for(var e=0;e<this.rows;e++){var n=this.get(e,t);this.set(e,t,this.get(e,r)),this.set(e,r,n)}return this}addRowVector(t){t=g(this,t);for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)+t[e]);return this}subRowVector(t){t=g(this,t);for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)-t[e]);return this}mulRowVector(t){t=g(this,t);for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)*t[e]);return this}divRowVector(t){t=g(this,t);for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)/t[e]);return this}addColumnVector(t){t=p(this,t);for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)+t[r]);return this}subColumnVector(t){t=p(this,t);for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)-t[r]);return this}mulColumnVector(t){t=p(this,t);for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)*t[r]);return this}divColumnVector(t){t=p(this,t);for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)/t[r]);return this}mulRow(t,r){f(this,t);for(var e=0;e<this.columns;e++)this.set(t,e,this.get(t,e)*r);return this}mulColumn(t,r){m(this,t);for(var e=0;e<this.rows;e++)this.set(e,t,this.get(e,t)*r);return this}max(){for(var t=this.get(0,0),r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.get(r,e)>t&&(t=this.get(r,e));return t}maxIndex(){for(var t=this.get(0,0),r=[0,0],e=0;e<this.rows;e++)for(var n=0;n<this.columns;n++)this.get(e,n)>t&&(t=this.get(e,n),r[0]=e,r[1]=n);return r}min(){for(var t=this.get(0,0),r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.get(r,e)<t&&(t=this.get(r,e));return t}minIndex(){for(var t=this.get(0,0),r=[0,0],e=0;e<this.rows;e++)for(var n=0;n<this.columns;n++)this.get(e,n)<t&&(t=this.get(e,n),r[0]=e,r[1]=n);return r}maxRow(t){f(this,t);for(var r=this.get(t,0),e=1;e<this.columns;e++)this.get(t,e)>r&&(r=this.get(t,e));return r}maxRowIndex(t){f(this,t);for(var r=this.get(t,0),e=[t,0],n=1;n<this.columns;n++)this.get(t,n)>r&&(r=this.get(t,n),e[1]=n);return e}minRow(t){f(this,t);for(var r=this.get(t,0),e=1;e<this.columns;e++)this.get(t,e)<r&&(r=this.get(t,e));return r}minRowIndex(t){f(this,t);for(var r=this.get(t,0),e=[t,0],n=1;n<this.columns;n++)this.get(t,n)<r&&(r=this.get(t,n),e[1]=n);return e}maxColumn(t){m(this,t);for(var r=this.get(0,t),e=1;e<this.rows;e++)this.get(e,t)>r&&(r=this.get(e,t));return r}maxColumnIndex(t){m(this,t);for(var r=this.get(0,t),e=[0,t],n=1;n<this.rows;n++)this.get(n,t)>r&&(r=this.get(n,t),e[0]=n);return e}minColumn(t){m(this,t);for(var r=this.get(0,t),e=1;e<this.rows;e++)this.get(e,t)<r&&(r=this.get(e,t));return r}minColumnIndex(t){m(this,t);for(var r=this.get(0,t),e=[0,t],n=1;n<this.rows;n++)this.get(n,t)<r&&(r=this.get(n,t),e[0]=n);return e}diag(){for(var t=Math.min(this.rows,this.columns),r=new Array(t),e=0;e<t;e++)r[e]=this.get(e,e);return r}sum(t){switch(t){case"row":return function(t){for(var r=_.zeros(t.rows,1),e=0;e<t.rows;++e)for(var n=0;n<t.columns;++n)r.set(e,0,r.get(e,0)+t.get(e,n));return r}(this);case"column":return function(t){for(var r=_.zeros(1,t.columns),e=0;e<t.rows;++e)for(var n=0;n<t.columns;++n)r.set(0,n,r.get(0,n)+t.get(e,n));return r}(this);default:return function(t){for(var r=0,e=0;e<t.rows;e++)for(var n=0;n<t.columns;n++)r+=t.get(e,n);return r}(this)}}mean(){return this.sum()/this.size}prod(){for(var t=1,r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)t*=this.get(r,e);return t}norm(t="frobenius"){var r=0;if("max"===t)return this.max();if("frobenius"===t){for(var e=0;e<this.rows;e++)for(var n=0;n<this.columns;n++)r+=this.get(e,n)*this.get(e,n);return Math.sqrt(r)}throw new RangeError(`unknown norm type: ${t}`)}cumulativeSum(){for(var t=0,r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)t+=this.get(r,e),this.set(r,e,t);return this}dot(t){r.isMatrix(t)&&(t=t.to1DArray());var e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");for(var n=0,i=0;i<e.length;i++)n+=e[i]*t[i];return n}mmul(t){t=this.constructor.checkMatrix(t),this.columns!==t.rows&&console.warn("Number of columns of left matrix are not equal to number of rows of right matrix.");for(var r=this.rows,e=this.columns,n=t.columns,i=new this.constructor[Symbol.species](r,n),o=new Array(e),s=0;s<n;s++){for(var a=0;a<e;a++)o[a]=t.get(a,s);for(var h=0;h<r;h++){var u=0;for(a=0;a<e;a++)u+=this.get(h,a)*o[a];i.set(h,s,u)}}return i}strassen2x2(t){var r=new this.constructor[Symbol.species](2,2);const e=this.get(0,0),n=t.get(0,0),i=this.get(0,1),o=t.get(0,1),s=this.get(1,0),a=t.get(1,0),h=this.get(1,1),u=t.get(1,1),l=(e+h)*(n+u),c=(s+h)*n,f=e*(o-u),m=h*(a-n),g=(e+i)*u,p=l+m-g+(i-h)*(a+u),v=f+g,d=c+m,w=l-c+f+(s-e)*(n+o);return r.set(0,0,p),r.set(0,1,v),r.set(1,0,d),r.set(1,1,w),r}strassen3x3(t){var r=new this.constructor[Symbol.species](3,3);const e=this.get(0,0),n=this.get(0,1),i=this.get(0,2),o=this.get(1,0),s=this.get(1,1),a=this.get(1,2),h=this.get(2,0),u=this.get(2,1),l=this.get(2,2),c=t.get(0,0),f=t.get(0,1),m=t.get(0,2),g=t.get(1,0),p=t.get(1,1),v=t.get(1,2),d=t.get(2,0),w=t.get(2,1),y=t.get(2,2),b=(e-o)*(-f+p),M=(-e+o+s)*(c-f+p),x=(o+s)*(-c+f),S=e*c,E=(-e+h+u)*(c-m+v),R=(-e+h)*(m-v),k=(h+u)*(-c+m),z=(-i+u+l)*(p+d-w),N=(i-l)*(p-w),A=i*d,V=(u+l)*(-d+w),C=(-i+s+a)*(v+d-y),_=(i-a)*(v-y),P=(s+a)*(-d+y),I=S+A+n*g,j=(e+n+i-o-s-u-l)*p+M+x+S+z+A+V,O=S+E+k+(e+n+i-s-a-h-u)*v+A+C+P,D=b+s*(-c+f+g-p-v-d+y)+M+S+A+C+_,L=b+M+x+S+a*w,F=A+C+_+P+o*m,T=S+E+R+u*(-c+m+g-p-v-d+w)+z+N+A,q=z+N+A+V+h*f,U=S+E+R+k+l*y;return r.set(0,0,I),r.set(0,1,j),r.set(0,2,O),r.set(1,0,D),r.set(1,1,L),r.set(1,2,F),r.set(2,0,T),r.set(2,1,q),r.set(2,2,U),r}mmulStrassen(t){var e=this.clone(),n=e.rows,i=e.columns,o=t.rows,s=t.columns;function a(t,e,n){var i=t.rows,o=t.columns;if(i===e&&o===n)return t;var s=r.zeros(e,n);return s=s.setSubMatrix(t,0,0)}i!==o&&console.warn(`Multiplying ${n} x ${i} and ${o} x ${s} matrix: dimensions do not match.`);var h=Math.max(n,o),u=Math.max(i,s);return function t(e,n,i,o){if(i<=512||o<=512)return e.mmul(n);i%2==1&&o%2==1?(e=a(e,i+1,o+1),n=a(n,i+1,o+1)):i%2==1?(e=a(e,i+1,o),n=a(n,i+1,o)):o%2==1&&(e=a(e,i,o+1),n=a(n,i,o+1));var s=parseInt(e.rows/2,10),h=parseInt(e.columns/2,10),u=e.subMatrix(0,s-1,0,h-1),l=n.subMatrix(0,s-1,0,h-1),c=e.subMatrix(0,s-1,h,e.columns-1),f=n.subMatrix(0,s-1,h,n.columns-1),m=e.subMatrix(s,e.rows-1,0,h-1),g=n.subMatrix(s,n.rows-1,0,h-1),p=e.subMatrix(s,e.rows-1,h,e.columns-1),v=n.subMatrix(s,n.rows-1,h,n.columns-1),d=t(r.add(u,p),r.add(l,v),s,h),w=t(r.add(m,p),l,s,h),y=t(u,r.sub(f,v),s,h),b=t(p,r.sub(g,l),s,h),M=t(r.add(u,c),v,s,h),x=t(r.sub(m,u),r.add(l,f),s,h),S=t(r.sub(c,p),r.add(g,v),s,h),E=r.add(d,b);E.sub(M),E.add(S);var R=r.add(y,M),k=r.add(w,b),z=r.sub(d,w);z.add(y),z.add(x);var N=r.zeros(2*E.rows,2*E.columns);return(N=(N=(N=(N=N.setSubMatrix(E,0,0)).setSubMatrix(R,E.rows,0)).setSubMatrix(k,0,E.columns)).setSubMatrix(z,E.rows,E.columns)).subMatrix(0,i-1,0,o-1)}(e=a(e,h,u),t=a(t,h,u),h,u)}scaleRows(t,r){if((t=void 0===t?0:t)>=(r=void 0===r?1:r))throw new RangeError("min should be strictly smaller than max");for(var e=this.constructor.empty(this.rows,this.columns),n=0;n<this.rows;n++){var i=a(this.getRow(n),{min:t,max:r});e.setRow(n,i)}return e}scaleColumns(t,r){if((t=void 0===t?0:t)>=(r=void 0===r?1:r))throw new RangeError("min should be strictly smaller than max");for(var e=this.constructor.empty(this.rows,this.columns),n=0;n<this.columns;n++){var i=a(this.getColumn(n),{min:t,max:r});e.setColumn(n,i)}return e}kroneckerProduct(t){t=this.constructor.checkMatrix(t);for(var r=this.rows,e=this.columns,n=t.rows,i=t.columns,o=new this.constructor[Symbol.species](r*n,e*i),s=0;s<r;s++)for(var a=0;a<e;a++)for(var h=0;h<n;h++)for(var u=0;u<i;u++)o[n*s+h][i*a+u]=this.get(s,a)*t.get(h,u);return o}transpose(){for(var t=new this.constructor[Symbol.species](this.columns,this.rows),r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)t.set(e,r,this.get(r,e));return t}sortRows(t){void 0===t&&(t=e);for(var r=0;r<this.rows;r++)this.setRow(r,this.getRow(r).sort(t));return this}sortColumns(t){void 0===t&&(t=e);for(var r=0;r<this.columns;r++)this.setColumn(r,this.getColumn(r).sort(t));return this}subMatrix(t,r,e,n){y(this,t,r,e,n);for(var i=new this.constructor[Symbol.species](r-t+1,n-e+1),o=t;o<=r;o++)for(var s=e;s<=n;s++)i[o-t][s-e]=this.get(o,s);return i}subMatrixRow(t,r,e){if(void 0===r&&(r=0),void 0===e&&(e=this.columns-1),r>e||r<0||r>=this.columns||e<0||e>=this.columns)throw new RangeError("Argument out of range");for(var n=new this.constructor[Symbol.species](t.length,e-r+1),i=0;i<t.length;i++)for(var o=r;o<=e;o++){if(t[i]<0||t[i]>=this.rows)throw new RangeError(`Row index out of range: ${t[i]}`);n.set(i,o-r,this.get(t[i],o))}return n}subMatrixColumn(t,r,e){if(void 0===r&&(r=0),void 0===e&&(e=this.rows-1),r>e||r<0||r>=this.rows||e<0||e>=this.rows)throw new RangeError("Argument out of range");for(var n=new this.constructor[Symbol.species](e-r+1,t.length),i=0;i<t.length;i++)for(var o=r;o<=e;o++){if(t[i]<0||t[i]>=this.columns)throw new RangeError(`Column index out of range: ${t[i]}`);n.set(o-r,i,this.get(o,t[i]))}return n}setSubMatrix(t,r,e){y(this,r,r+(t=this.constructor.checkMatrix(t)).rows-1,e,e+t.columns-1);for(var n=0;n<t.rows;n++)for(var i=0;i<t.columns;i++)this[r+n][e+i]=t.get(n,i);return this}selection(t,r){for(var e=v(this,t,r),n=new this.constructor[Symbol.species](t.length,r.length),i=0;i<e.row.length;i++)for(var o=e.row[i],s=0;s<e.column.length;s++){var a=e.column[s];n[i][s]=this.get(o,a)}return n}trace(){for(var t=Math.min(this.rows,this.columns),r=0,e=0;e<t;e++)r+=this.get(e,e);return r}transposeView(){return new x(this)}rowView(t){return f(this,t),new S(this,t)}columnView(t){return m(this,t),new N(this,t)}flipRowView(){return new A(this)}flipColumnView(){return new V(this)}subMatrixView(t,r,e,n){return new E(this,t,r,e,n)}selectionView(t,r){return new R(this,t,r)}rowSelectionView(t){return new k(this,t)}columnSelectionView(t){return new z(this,t)}det(){var t,r,e,n,i,o;if(this.isSquare())return 2===this.columns?(t=this.get(0,0),r=this.get(0,1),e=this.get(1,0),t*this.get(1,1)-r*e):3===this.columns?(n=this.selectionView([1,2],[1,2]),i=this.selectionView([1,2],[0,2]),o=this.selectionView([1,2],[0,1]),t=this.get(0,0),r=this.get(0,1),e=this.get(0,2),t*n.det()-r*i.det()+e*o.det()):new h(this).determinant;throw Error("Determinant can only be calculated for a square matrix.")}pseudoInverse(t){void 0===t&&(t=Number.EPSILON);for(var r=new c(this,{autoTranspose:!0}),e=r.leftSingularVectors,n=r.rightSingularVectors,i=r.diagonal,o=0;o<i.length;o++)Math.abs(i[o])>t?i[o]=1/i[o]:i[o]=0;return i=this.constructor[Symbol.species].diag(i),n.mmul(i.mmul(e.transposeView()))}clone(){for(var t=new this.constructor[Symbol.species](this.rows,this.columns),r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)t.set(r,e,this.get(r,e));return t}}function e(t,r){return t-r}r.prototype.klass="Matrix",r.random=r.rand,r.diagonal=r.diag,r.prototype.diagonal=r.prototype.diag,r.identity=r.eye,r.prototype.negate=r.prototype.neg,r.prototype.tensorProduct=r.prototype.kroneckerProduct,r.prototype.determinant=r.prototype.det;var n,i="\n(function %name%(matrix, %args%) {\n    var newMatrix = new this[Symbol.species](matrix);\n    return newMatrix.%name%(%args%);\n})\n",o=eval;for(var s of[["+","add"],["-","sub","subtract"],["*","mul","multiply"],["/","div","divide"],["%","mod","modulus"],["&","and"],["|","or"],["^","xor"],["<<","leftShift"],[">>","signPropagatingRightShift"],[">>>","rightShift","zeroFillRightShift"]]){var u=o($("\n(function %name%(value) {\n    if (typeof value === 'number') return this.%name%S(value);\n    return this.%name%M(value);\n})\n",{name:s[1],op:s[0]})),l=o($("\n(function %name%S(value) {\n    for (var i = 0; i < this.rows; i++) {\n        for (var j = 0; j < this.columns; j++) {\n            this.set(i, j, this.get(i, j) %op% value);\n        }\n    }\n    return this;\n})\n",{name:`${s[1]}S`,op:s[0]})),d=o($("\n(function %name%M(matrix) {\n    matrix = this.constructor.checkMatrix(matrix);\n    if (this.rows !== matrix.rows ||\n        this.columns !== matrix.columns) {\n        throw new RangeError('Matrices dimensions must be equal');\n    }\n    for (var i = 0; i < this.rows; i++) {\n        for (var j = 0; j < this.columns; j++) {\n            this.set(i, j, this.get(i, j) %op% matrix.get(i, j));\n        }\n    }\n    return this;\n})\n",{name:`${s[1]}M`,op:s[0]})),w=o($("\n(function %name%(matrix, value) {\n    var newMatrix = new this[Symbol.species](matrix);\n    return newMatrix.%name%(value);\n})\n",{name:s[1]}));for(n=1;n<s.length;n++)r.prototype[s[n]]=u,r.prototype[`${s[n]}S`]=l,r.prototype[`${s[n]}M`]=d,r[s[n]]=w}var b=[["~","not"]];for(var M of(["abs","acos","acosh","asin","asinh","atan","atanh","cbrt","ceil","clz32","cos","cosh","exp","expm1","floor","fround","log","log1p","log10","log2","round","sign","sin","sinh","sqrt","tan","tanh","trunc"].forEach(function(t){b.push([`Math.${t}`,t])}),b)){var C=o($("\n(function %name%() {\n    for (var i = 0; i < this.rows; i++) {\n        for (var j = 0; j < this.columns; j++) {\n            this.set(i, j, %method%(this.get(i, j)));\n        }\n    }\n    return this;\n})\n",{name:M[1],method:M[0]})),P=o($("\n(function %name%(matrix) {\n    var newMatrix = new this[Symbol.species](matrix);\n    return newMatrix.%name%();\n})\n",{name:M[1]}));for(n=1;n<M.length;n++)r.prototype[M[n]]=C,r[M[n]]=P}for(var I of[["Math.pow",1,"pow"]]){var j="arg0";for(n=1;n<I[1];n++)j+=`, arg${n}`;if(1!==I[1]){var O=o($("\n(function %name%(%args%) {\n    for (var i = 0; i < this.rows; i++) {\n        for (var j = 0; j < this.columns; j++) {\n            this.set(i, j, %method%(this.get(i, j), %args%));\n        }\n    }\n    return this;\n})\n",{name:I[2],method:I[0],args:j})),D=o($(i,{name:I[2],args:j}));for(n=2;n<I.length;n++)r.prototype[I[n]]=O,r[I[n]]=D}else{var L={name:I[2],args:j,method:I[0]},F=o($("\n(function %name%(value) {\n    if (typeof value === 'number') return this.%name%S(value);\n    return this.%name%M(value);\n})\n",L)),T=o($("\n(function %name%S(value) {\n    for (var i = 0; i < this.rows; i++) {\n        for (var j = 0; j < this.columns; j++) {\n            this.set(i, j, %method%(this.get(i, j), value));\n        }\n    }\n    return this;\n})\n",L)),q=o($("\n(function %name%M(matrix) {\n    matrix = this.constructor.checkMatrix(matrix);\n    if (this.rows !== matrix.rows ||\n        this.columns !== matrix.columns) {\n        throw new RangeError('Matrices dimensions must be equal');\n    }\n    for (var i = 0; i < this.rows; i++) {\n        for (var j = 0; j < this.columns; j++) {\n            this.set(i, j, %method%(this.get(i, j), matrix.get(i, j)));\n        }\n    }\n    return this;\n})\n",L)),U=o($("\n(function %name%(matrix, %args%) {\n    var newMatrix = new this[Symbol.species](matrix);\n    return newMatrix.%name%(%args%);\n})\n",L));for(n=2;n<I.length;n++)r.prototype[I[n]]=F,r.prototype[`${I[n]}M`]=q,r.prototype[`${I[n]}S`]=T,r[I[n]]=U}}function $(t,r){for(var e in r)t=t.replace(new RegExp(`%${e}%`,"g"),r[e]);return t}return r}class _ extends(C(Array)){constructor(t,r){var e;if(1===arguments.length&&"number"==typeof t)return new Array(t);if(_.isMatrix(t))return t.clone();if(Number.isInteger(t)&&t>0){if(super(t),!(Number.isInteger(r)&&r>0))throw new TypeError("nColumns must be a positive integer");for(e=0;e<t;e++)this[e]=new Array(r)}else{if(!Array.isArray(t))throw new TypeError("First argument must be a positive number or an array");{const n=t;if(t=n.length,"number"!=typeof(r=n[0].length)||0===r)throw new TypeError("Data must be a 2D array with at least one element");for(super(t),e=0;e<t;e++){if(n[e].length!==r)throw new RangeError("Inconsistent array dimensions");this[e]=[].concat(n[e])}}}return this.rows=t,this.columns=r,this}set(t,r,e){return this[t][r]=e,this}get(t,r){return this[t][r]}removeRow(t){if(f(this,t),1===this.rows)throw new RangeError("A matrix cannot have less than one row");return this.splice(t,1),this.rows-=1,this}addRow(t,r){return void 0===r&&(r=t,t=this.rows),f(this,t,!0),r=g(this,r),this.splice(t,0,r),this.rows+=1,this}removeColumn(t){if(m(this,t),1===this.columns)throw new RangeError("A matrix cannot have less than one column");for(var r=0;r<this.rows;r++)this[r].splice(t,1);return this.columns-=1,this}addColumn(t,r){void 0===r&&(r=t,t=this.columns),m(this,t,!0),r=p(this,r);for(var e=0;e<this.rows;e++)this[e].splice(t,0,r[e]);return this.columns+=1,this}}class P extends(C()){constructor(t,r={}){const{rows:e=1}=r;if(t.length%e!=0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=e,this.columns=t.length/e,this.data=t}set(t,r,e){var n=this._calculateIndex(t,r);return this.data[n]=e,this}get(t,r){var e=this._calculateIndex(t,r);return this.data[e]}_calculateIndex(t,r){return t*this.columns+r}static get[Symbol.species](){return _}}class I extends(C()){constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,r,e){return this.data[t][r]=e,this}get(t,r){return this.data[t][r]}static get[Symbol.species](){return _}}function j(t,r){if(Array.isArray(t))return t[0]&&Array.isArray(t[0])?new I(t):new P(t,r);throw new Error("the argument is not an array")}class O{constructor(t){var r,e,n,i,o=(t=I.checkMatrix(t)).clone(),s=t.rows,a=t.columns,h=new Array(a);for(n=0;n<a;n++){var l=0;for(r=n;r<s;r++)l=u(l,o.get(r,n));if(0!==l){for(o.get(n,n)<0&&(l=-l),r=n;r<s;r++)o.set(r,n,o.get(r,n)/l);for(o.set(n,n,o.get(n,n)+1),e=n+1;e<a;e++){for(i=0,r=n;r<s;r++)i+=o.get(r,n)*o.get(r,e);for(i=-i/o.get(n,n),r=n;r<s;r++)o.set(r,e,o.get(r,e)+i*o.get(r,n))}}h[n]=-l}this.QR=o,this.Rdiag=h}solve(t){t=_.checkMatrix(t);var r=this.QR,e=r.rows;if(t.rows!==e)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");var n,i,o,s,a=t.columns,h=t.clone(),u=r.columns;for(o=0;o<u;o++)for(i=0;i<a;i++){for(s=0,n=o;n<e;n++)s+=r[n][o]*h[n][i];for(s=-s/r[o][o],n=o;n<e;n++)h[n][i]+=s*r[n][o]}for(o=u-1;o>=0;o--){for(i=0;i<a;i++)h[o][i]/=this.Rdiag[o];for(n=0;n<o;n++)for(i=0;i<a;i++)h[n][i]-=h[o][i]*r[n][o]}return h.subMatrix(0,u-1,0,a-1)}isFullRank(){for(var t=this.QR.columns,r=0;r<t;r++)if(0===this.Rdiag[r])return!1;return!0}get upperTriangularMatrix(){var t,r,e=this.QR,n=e.columns,i=new _(n,n);for(t=0;t<n;t++)for(r=0;r<n;r++)i[t][r]=t<r?e[t][r]:t===r?this.Rdiag[t]:0;return i}get orthogonalMatrix(){var t,r,e,n,i=this.QR,o=i.rows,s=i.columns,a=new _(o,s);for(e=s-1;e>=0;e--){for(t=0;t<o;t++)a[t][e]=0;for(a[e][e]=1,r=e;r<s;r++)if(0!==i[e][e]){for(n=0,t=e;t<o;t++)n+=i[t][e]*a[t][r];for(n=-n/i[e][e],t=e;t<o;t++)a[t][r]+=n*i[t][e]}}return a}}function D(t,r=!1){return t=I.checkMatrix(t),r?new c(t).inverse():L(t,_.eye(t.rows))}function L(t,r,e=!1){return t=I.checkMatrix(t),r=I.checkMatrix(r),e?new c(t).solve(r):t.isSquare()?new h(t).solve(r):new O(t).solve(r)}function F(t,r){for(var e=[],n=0;n<t;n++)n!==r&&e.push(n);return e}function T(t,r,e,n=1e-9,i=1e-9){if(t>i)return new Array(r.rows+1).fill(0);for(var o=r.addRow(e,[0]),s=0;s<o.rows;s++)Math.abs(o.get(s,0))<n&&o.set(s,0,0);return o.to1DArray()}function q(t,r={}){const{thresholdValue:e=1e-9,thresholdError:n=1e-9}=r;for(var i=t.rows,s=new _(i,i),a=0;a<i;a++){var h=_.columnVector(t.getRow(a)),u=t.subMatrixRow(F(i,a)).transposeView(),l=new c(u).solve(h),f=o(_.sub(h,u.mmul(l)).abs().to1DArray());s.setRow(a,T(f,l,a,e,n))}return s}class U{constructor(t,r={}){const{assumeSymmetric:e=!1}=r;if(!(t=I.checkMatrix(t)).isSquare())throw new Error("Matrix is not a square matrix");var n,i,o=t.columns,s=l(o,o,0),a=new Array(o),h=new Array(o),c=t;if(!!e||t.isSymmetric()){for(n=0;n<o;n++)for(i=0;i<o;i++)s[n][i]=c.get(n,i);!function(t,r,e,n){var i,o,s,a,h,u,l,c;for(h=0;h<t;h++)e[h]=n[t-1][h];for(a=t-1;a>0;a--){for(c=0,s=0,u=0;u<a;u++)c+=Math.abs(e[u]);if(0===c)for(r[a]=e[a-1],h=0;h<a;h++)e[h]=n[a-1][h],n[a][h]=0,n[h][a]=0;else{for(u=0;u<a;u++)e[u]/=c,s+=e[u]*e[u];for(i=e[a-1],o=Math.sqrt(s),i>0&&(o=-o),r[a]=c*o,s-=i*o,e[a-1]=i-o,h=0;h<a;h++)r[h]=0;for(h=0;h<a;h++){for(i=e[h],n[h][a]=i,o=r[h]+n[h][h]*i,u=h+1;u<=a-1;u++)o+=n[u][h]*e[u],r[u]+=n[u][h]*i;r[h]=o}for(i=0,h=0;h<a;h++)r[h]/=s,i+=r[h]*e[h];for(l=i/(s+s),h=0;h<a;h++)r[h]-=l*e[h];for(h=0;h<a;h++){for(i=e[h],o=r[h],u=h;u<=a-1;u++)n[u][h]-=i*r[u]+o*e[u];e[h]=n[a-1][h],n[a][h]=0}}e[a]=s}for(a=0;a<t-1;a++){if(n[t-1][a]=n[a][a],n[a][a]=1,0!==(s=e[a+1])){for(u=0;u<=a;u++)e[u]=n[u][a+1]/s;for(h=0;h<=a;h++){for(o=0,u=0;u<=a;u++)o+=n[u][a+1]*n[u][h];for(u=0;u<=a;u++)n[u][h]-=o*e[u]}}for(u=0;u<=a;u++)n[u][a+1]=0}for(h=0;h<t;h++)e[h]=n[t-1][h],n[t-1][h]=0;n[t-1][t-1]=1,r[0]=0}(o,h,a,s),function(t,r,e,n){var i,o,s,a,h,l,c,f,m,g,p,v,d,w,y,b;for(s=1;s<t;s++)r[s-1]=r[s];r[t-1]=0;var M=0,x=0,S=Number.EPSILON;for(l=0;l<t;l++){for(x=Math.max(x,Math.abs(e[l])+Math.abs(r[l])),c=l;c<t&&!(Math.abs(r[c])<=S*x);)c++;if(c>l){0;do{for(1,i=e[l],f=(e[l+1]-i)/(2*r[l]),m=u(f,1),f<0&&(m=-m),e[l]=r[l]/(f+m),e[l+1]=r[l]*(f+m),g=e[l+1],o=i-e[l],s=l+2;s<t;s++)e[s]-=o;for(M+=o,f=e[c],v=p=1,d=p,w=r[l+1],y=0,b=0,s=c-1;s>=l;s--)for(d=v,v=p,b=y,i=p*r[s],o=p*f,m=u(f,r[s]),r[s+1]=y*m,y=r[s]/m,f=(p=f/m)*e[s]-y*i,e[s+1]=o+y*(p*i+y*e[s]),h=0;h<t;h++)o=n[h][s+1],n[h][s+1]=y*n[h][s]+p*o,n[h][s]=p*n[h][s]-y*o;f=-y*b*d*w*r[l]/g,r[l]=y*f,e[l]=p*f}while(Math.abs(r[l])>S*x)}e[l]=e[l]+M,r[l]=0}for(s=0;s<t-1;s++){for(h=s,f=e[s],a=s+1;a<t;a++)e[a]<f&&(h=a,f=e[a]);if(h!==s)for(e[h]=e[s],e[s]=f,a=0;a<t;a++)f=n[a][s],n[a][s]=n[a][h],n[a][h]=f}}(o,h,a,s)}else{var f=l(o,o,0),m=new Array(o);for(i=0;i<o;i++)for(n=0;n<o;n++)f[n][i]=c.get(n,i);!function(t,r,e,n){var i,o,s,a,h,u,l,c=t-1;for(u=1;u<=c-1;u++){for(l=0,a=u;a<=c;a++)l+=Math.abs(r[a][u-1]);if(0!==l){for(s=0,a=c;a>=u;a--)e[a]=r[a][u-1]/l,s+=e[a]*e[a];for(o=Math.sqrt(s),e[u]>0&&(o=-o),s-=e[u]*o,e[u]=e[u]-o,h=u;h<t;h++){for(i=0,a=c;a>=u;a--)i+=e[a]*r[a][h];for(i/=s,a=u;a<=c;a++)r[a][h]-=i*e[a]}for(a=0;a<=c;a++){for(i=0,h=c;h>=u;h--)i+=e[h]*r[a][h];for(i/=s,h=u;h<=c;h++)r[a][h]-=i*e[h]}e[u]=l*e[u],r[u][u-1]=l*o}}for(a=0;a<t;a++)for(h=0;h<t;h++)n[a][h]=a===h?1:0;for(u=c-1;u>=1;u--)if(0!==r[u][u-1]){for(a=u+1;a<=c;a++)e[a]=r[a][u-1];for(h=u;h<=c;h++){for(o=0,a=u;a<=c;a++)o+=e[a]*n[a][h];for(o=o/e[u]/r[u][u-1],a=u;a<=c;a++)n[a][h]+=o*e[a]}}}(o,f,m,s),function(t,r,e,n,i){var o,s,a,h,u,l,c,f,m,g,p,v,d,w,y,b=t-1,M=t-1,x=Number.EPSILON,S=0,E=0,R=0,k=0,z=0,N=0,A=0,V=0;for(o=0;o<t;o++)for((o<0||o>M)&&(e[o]=i[o][o],r[o]=0),s=Math.max(o-1,0);s<t;s++)E+=Math.abs(i[o][s]);for(;b>=0;){for(h=b;h>0&&(0===(N=Math.abs(i[h-1][h-1])+Math.abs(i[h][h]))&&(N=E),!(Math.abs(i[h][h-1])<x*N));)h--;if(h===b)i[b][b]=i[b][b]+S,e[b]=i[b][b],r[b]=0,b--,V=0;else if(h===b-1){if(c=i[b][b-1]*i[b-1][b],R=(i[b-1][b-1]-i[b][b])/2,k=R*R+c,A=Math.sqrt(Math.abs(k)),i[b][b]=i[b][b]+S,i[b-1][b-1]=i[b-1][b-1]+S,f=i[b][b],k>=0){for(A=R>=0?R+A:R-A,e[b-1]=f+A,e[b]=e[b-1],0!==A&&(e[b]=f-c/A),r[b-1]=0,r[b]=0,f=i[b][b-1],N=Math.abs(f)+Math.abs(A),R=f/N,k=A/N,z=Math.sqrt(R*R+k*k),R/=z,k/=z,s=b-1;s<t;s++)A=i[b-1][s],i[b-1][s]=k*A+R*i[b][s],i[b][s]=k*i[b][s]-R*A;for(o=0;o<=b;o++)A=i[o][b-1],i[o][b-1]=k*A+R*i[o][b],i[o][b]=k*i[o][b]-R*A;for(o=0;o<=M;o++)A=n[o][b-1],n[o][b-1]=k*A+R*n[o][b],n[o][b]=k*n[o][b]-R*A}else e[b-1]=f+R,e[b]=f+R,r[b-1]=A,r[b]=-A;b-=2,V=0}else{if(f=i[b][b],m=0,c=0,h<b&&(m=i[b-1][b-1],c=i[b][b-1]*i[b-1][b]),10===V){for(S+=f,o=0;o<=b;o++)i[o][o]-=f;N=Math.abs(i[b][b-1])+Math.abs(i[b-1][b-2]),f=m=.75*N,c=-.4375*N*N}if(30===V&&(N=(N=(m-f)/2)*N+c)>0){for(N=Math.sqrt(N),m<f&&(N=-N),N=f-c/((m-f)/2+N),o=0;o<=b;o++)i[o][o]-=N;S+=N,f=m=c=.964}for(V+=1,u=b-2;u>=h&&(A=i[u][u],R=((z=f-A)*(N=m-A)-c)/i[u+1][u]+i[u][u+1],k=i[u+1][u+1]-A-z-N,z=i[u+2][u+1],N=Math.abs(R)+Math.abs(k)+Math.abs(z),R/=N,k/=N,z/=N,u!==h)&&!(Math.abs(i[u][u-1])*(Math.abs(k)+Math.abs(z))<x*(Math.abs(R)*(Math.abs(i[u-1][u-1])+Math.abs(A)+Math.abs(i[u+1][u+1]))));)u--;for(o=u+2;o<=b;o++)i[o][o-2]=0,o>u+2&&(i[o][o-3]=0);for(a=u;a<=b-1&&(w=a!==b-1,a!==u&&(R=i[a][a-1],k=i[a+1][a-1],z=w?i[a+2][a-1]:0,0!==(f=Math.abs(R)+Math.abs(k)+Math.abs(z))&&(R/=f,k/=f,z/=f)),0!==f);a++)if(N=Math.sqrt(R*R+k*k+z*z),R<0&&(N=-N),0!==N){for(a!==u?i[a][a-1]=-N*f:h!==u&&(i[a][a-1]=-i[a][a-1]),f=(R+=N)/N,m=k/N,A=z/N,k/=R,z/=R,s=a;s<t;s++)R=i[a][s]+k*i[a+1][s],w&&(R+=z*i[a+2][s],i[a+2][s]=i[a+2][s]-R*A),i[a][s]=i[a][s]-R*f,i[a+1][s]=i[a+1][s]-R*m;for(o=0;o<=Math.min(b,a+3);o++)R=f*i[o][a]+m*i[o][a+1],w&&(R+=A*i[o][a+2],i[o][a+2]=i[o][a+2]-R*z),i[o][a]=i[o][a]-R,i[o][a+1]=i[o][a+1]-R*k;for(o=0;o<=M;o++)R=f*n[o][a]+m*n[o][a+1],w&&(R+=A*n[o][a+2],n[o][a+2]=n[o][a+2]-R*z),n[o][a]=n[o][a]-R,n[o][a+1]=n[o][a+1]-R*k}}}if(0===E)return;for(b=t-1;b>=0;b--)if(R=e[b],0===(k=r[b]))for(h=b,i[b][b]=1,o=b-1;o>=0;o--){for(c=i[o][o]-R,z=0,s=h;s<=b;s++)z+=i[o][s]*i[s][b];if(r[o]<0)A=c,N=z;else if(h=o,0===r[o]?i[o][b]=0!==c?-z/c:-z/(x*E):(f=i[o][o+1],m=i[o+1][o],k=(e[o]-R)*(e[o]-R)+r[o]*r[o],l=(f*N-A*z)/k,i[o][b]=l,i[o+1][b]=Math.abs(f)>Math.abs(A)?(-z-c*l)/f:(-N-m*l)/A),l=Math.abs(i[o][b]),x*l*l>1)for(s=o;s<=b;s++)i[s][b]=i[s][b]/l}else if(k<0)for(h=b-1,Math.abs(i[b][b-1])>Math.abs(i[b-1][b])?(i[b-1][b-1]=k/i[b][b-1],i[b-1][b]=-(i[b][b]-R)/i[b][b-1]):(y=$(0,-i[b-1][b],i[b-1][b-1]-R,k),i[b-1][b-1]=y[0],i[b-1][b]=y[1]),i[b][b-1]=0,i[b][b]=1,o=b-2;o>=0;o--){for(g=0,p=0,s=h;s<=b;s++)g+=i[o][s]*i[s][b-1],p+=i[o][s]*i[s][b];if(c=i[o][o]-R,r[o]<0)A=c,z=g,N=p;else if(h=o,0===r[o]?(y=$(-g,-p,c,k),i[o][b-1]=y[0],i[o][b]=y[1]):(f=i[o][o+1],m=i[o+1][o],v=(e[o]-R)*(e[o]-R)+r[o]*r[o]-k*k,d=2*(e[o]-R)*k,0===v&&0===d&&(v=x*E*(Math.abs(c)+Math.abs(k)+Math.abs(f)+Math.abs(m)+Math.abs(A))),y=$(f*z-A*g+k*p,f*N-A*p-k*g,v,d),i[o][b-1]=y[0],i[o][b]=y[1],Math.abs(f)>Math.abs(A)+Math.abs(k)?(i[o+1][b-1]=(-g-c*i[o][b-1]+k*i[o][b])/f,i[o+1][b]=(-p-c*i[o][b]-k*i[o][b-1])/f):(y=$(-z-m*i[o][b-1],-N-m*i[o][b],A,k),i[o+1][b-1]=y[0],i[o+1][b]=y[1])),l=Math.max(Math.abs(i[o][b-1]),Math.abs(i[o][b])),x*l*l>1)for(s=o;s<=b;s++)i[s][b-1]=i[s][b-1]/l,i[s][b]=i[s][b]/l}for(o=0;o<t;o++)if(o<0||o>M)for(s=o;s<t;s++)n[o][s]=i[o][s];for(s=t-1;s>=0;s--)for(o=0;o<=M;o++){for(A=0,a=0;a<=Math.min(s,M);a++)A+=n[o][a]*i[a][s];n[o][s]=A}}(o,h,a,s,f)}this.n=o,this.e=h,this.d=a,this.V=s}get realEigenvalues(){return this.d}get imaginaryEigenvalues(){return this.e}get eigenvectorMatrix(){return _.isMatrix(this.V)||(this.V=new _(this.V)),this.V}get diagonalMatrix(){var t,r,e=this.n,n=this.e,i=this.d,o=new _(e,e);for(t=0;t<e;t++){for(r=0;r<e;r++)o[t][r]=0;o[t][t]=i[t],n[t]>0?o[t][t+1]=n[t]:n[t]<0&&(o[t][t-1]=n[t])}return o}}function $(t,r,e,n){var i,o;return Math.abs(e)>Math.abs(n)?[(t+(i=n/e)*r)/(o=e+i*n),(r-i*t)/o]:[((i=e/n)*t+r)/(o=n+i*e),(i*r-t)/o]}class Q{constructor(t){if(!(t=I.checkMatrix(t)).isSymmetric())throw new Error("Matrix is not symmetric");var r,e,n,i=t,o=i.rows,s=new _(o,o),a=!0;for(e=0;e<o;e++){var h=s[e],u=0;for(n=0;n<e;n++){var l=s[n],c=0;for(r=0;r<n;r++)c+=l[r]*h[r];h[n]=c=(i.get(e,n)-c)/s[n][n],u+=c*c}for(a&=(u=i.get(e,e)-u)>0,s[e][e]=Math.sqrt(Math.max(u,0)),n=e+1;n<o;n++)s[e][n]=0}if(!a)throw new Error("Matrix is not positive definite");this.L=s}solve(t){t=I.checkMatrix(t);var r=this.L,e=r.rows;if(t.rows!==e)throw new Error("Matrix dimensions do not match");var n,i,o,s=t.columns,a=t.clone();for(o=0;o<e;o++)for(i=0;i<s;i++){for(n=0;n<o;n++)a[o][i]-=a[n][i]*r[o][n];a[o][i]/=r[o][o]}for(o=e-1;o>=0;o--)for(i=0;i<s;i++){for(n=o+1;n<e;n++)a[o][i]-=a[n][i]*r[n][o];a[o][i]/=r[o][o]}return a}get lowerTriangularMatrix(){return this.L}}e.d(r,"default",function(){return _}),e.d(r,"Matrix",function(){return _}),e.d(r,"abstractMatrix",function(){return C}),e.d(r,"wrap",function(){return j}),e.d(r,"WrapperMatrix2D",function(){return I}),e.d(r,"WrapperMatrix1D",function(){return P}),e.d(r,"solve",function(){return L}),e.d(r,"inverse",function(){return D}),e.d(r,"linearDependencies",function(){return q}),e.d(r,"SingularValueDecomposition",function(){return c}),e.d(r,"SVD",function(){return c}),e.d(r,"EigenvalueDecomposition",function(){return U}),e.d(r,"EVD",function(){return U}),e.d(r,"CholeskyDecomposition",function(){return Q}),e.d(r,"CHO",function(){return Q}),e.d(r,"LuDecomposition",function(){return h}),e.d(r,"LU",function(){return h}),e.d(r,"QrDecomposition",function(){return O}),e.d(r,"QR",function(){return O})}]);
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.weblas = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
function sgemm(e,t,l,a,r,c,u,n){if(null!=n&&n.length!=t)throw new Error("Only vector C with length matching rows in A is currently supported.");var o,s=r,i=n;o=transpose(l,t,c);var g=gl.createDataTexture(e,l,s),p=gl.createDataTexture(t,l,o),x=null;null!=i&&(x=gl.createDataTexture(1,t,i));var d=gl.createOutputTexture(e,t);return sgemmcalculator.calculate(e,t,l,a,g,p,u,x,d),rawBuffer=gl.readData(e,t),gl.context.deleteTexture(g),gl.context.deleteTexture(p),null!=x&&gl.context.deleteTexture(x),gl.context.deleteTexture(d),new Float32Array(rawBuffer)}function saxpy(e,t,l,a){var r,c,u=l;isFloat32Array(a)?c=a:(c=new Float32Array(e),c.fill(a));var n=gl.createDataTexture(1,e,u),o=gl.createDataTexture(1,e,c),s=gl.createOutputTexture(1,e);return saxpycalculator.calculate(e,t,n,o,s),r=gl.readData(1,e),gl.context.deleteTexture(n),gl.context.deleteTexture(o),gl.context.deleteTexture(s),new Float32Array(r)}function isFloat32Array(e){return"[object Float32Array]"===Object.prototype.toString.call(e)}function sscal(e,t,l,a,r){var c,u=r,n=gl.createDataTexture(e,t,u),o=gl.createOutputTexture(e,t);return sscalcalculator.calculate(e,t,l,a,n,o),c=gl.readData(e,t),gl.context.deleteTexture(n),gl.context.deleteTexture(o),new Float32Array(c)}function sstd(e,t,l,a,r){var c,u=r,n=gl.createDataTexture(e,t,u),o=gl.createOutputTexture(e,t);return sscalcalculator.calculate(e,t,1/a,-1*l/a,n,o),c=gl.readData(e,t),gl.context.deleteTexture(n),gl.context.deleteTexture(o),new Float32Array(c)}function sdwns(e,t,l,a,r,c){var u=gl.createDataTexture(e,t*l,c),n=Math.floor((t-a)/r)+1,o=Math.floor((e-a)/r)+1,s=gl.createOutputTexture(o,n*l);return sdwnscalculator.calculate(e,t,l,a,r,u,s),rawBuffer=gl.readData(o,n*l),gl.context.deleteTexture(u),gl.context.deleteTexture(s),new Float32Array(rawBuffer)}function sclmp(e,t,l,a,r){l=null!=l?l:Number.MIN_VALUE,a=null!=a?a:Number.MAX_VALUE;var c,u=r,n=gl.createDataTexture(e,t,u),o=gl.createOutputTexture(e,t);return sclmpcalculator.calculate(e,t,l,a,n,o),c=gl.readData(e,t),gl.context.deleteTexture(n),gl.context.deleteTexture(o),new Float32Array(c)}function isNumeric(e){return e-parseFloat(e)+1>=0}function fromArray(e,t,l){var a,r,c=[];l?(c[1]=e.length,c[0]=e[0].length):(c[0]=e.length,c[1]=e[0].length),r=c[1],t=t||Float32Array,a=new t(c[0]*c[1]);for(var u=0;u<c[0];++u)for(var n=0;n<c[1];++n)l?a[u*r+n]=e[n][u]:a[u*r+n]=e[u][n];return a}function transpose(e,t,l){for(var a=new l.constructor(e*t),r=0;e>r;r++)for(var c=0;t>c;c++)a[c*e+r]=l[r*t+c];return a}var globals=require("./lib/globals"),pipeline=require("./lib/pipeline"),SGEMMCalculator=require("./lib/sgemmcalculator"),SAXPYCalculator=require("./lib/saxpycalculator"),SSCALCalculator=require("./lib/sscalcalculator"),SDWNSCalculator=require("./lib/sdwnscalculator"),SCLMPCalculator=require("./lib/sclmpcalculator"),test=require("./lib/test"),gl=globals.gl,sgemmcalculator=new SGEMMCalculator(gl),saxpycalculator=new SAXPYCalculator(gl),sscalcalculator=new SSCALCalculator(gl),sdwnscalculator=new SDWNSCalculator(gl),sclmpcalculator=new SCLMPCalculator(gl);module.exports={saxpy:saxpy,sscal:sscal,sgemm:sgemm,sstd:sstd,sdwns:sdwns,sclmp:sclmp,pipeline:pipeline,gpu:{gl:gl,sgemm:pipeline.sgemmcalculator.calculate.bind(pipeline.sgemmcalculator),sscal:pipeline.sscalcalculator.calculate.bind(pipeline.sscalcalculator),sclmp:pipeline.sclmpcalculator.calculate.bind(pipeline.sclmpcalculator),sdwns:pipeline.sdwnscalculator.calculate.bind(pipeline.sdwnscalculator),encode:gl.encode.bind(gl)},util:{fromArray:fromArray,transpose:transpose},test:test},String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,function(t,l){return"undefined"!=typeof e[l]?e[l]:t})});
},{"./lib/globals":2,"./lib/pipeline":3,"./lib/saxpycalculator":4,"./lib/sclmpcalculator":5,"./lib/sdwnscalculator":6,"./lib/sgemmcalculator":7,"./lib/sscalcalculator":8,"./lib/test":10}],2:[function(require,module,exports){
var WebGL=require("./webgl"),gl=new WebGL;module.exports={gl:gl};
},{"./webgl":11}],3:[function(require,module,exports){
function sscal(l,a,e){var r=e.shape[0],s=e.shape[1],c=new Tensor([r,s],null);return sscalcalculator.calculate(r,s,l,a,e.texture,c.texture),c}function sgemm(l,a,e,r,s){if(e.shape[1]!==a.shape[1])throw new Error("Second dimension must be of same size for input Tensors (second Tensor is transposed).");var c,t=a.shape[0],u=e.shape[0],o=a.shape[1];c=s?s.texture:null;var n=new Tensor([t,u],null);return sgemmcalculator.calculate(t,u,o,l,a.texture,e.texture,r,c,n.texture),n}function sdwns(l,a,e,r){if(r.shape[1]%l!==0)throw new Error("Second dimension of tensor must be a multiple of channels");var s=r.shape[0],c=r.shape[1]/l,t=Math.floor((s-a)/e)+1,u=Math.floor((c-a)/e)+1,o=new Tensor([t,u*l],null);return sdwnscalculator.calculate(s,c,l,a,e,r.texture,o.texture),o}function sclmp(l,a,e){l=null!=l?l:Number.MIN_VALUE,a=null!=a?a:Number.MAX_VALUE;var r=e.shape[0],s=e.shape[1],c=new Tensor([r,s],null);return sclmpcalculator.calculate(r,s,l,a,e.texture,c.texture),c}var globals=require("./globals"),SGEMMCalculator=require("./sgemmcalculator"),SAXPYCalculator=require("./saxpycalculator"),SSCALCalculator=require("./sscalcalculator"),SDWNSCalculator=require("./sdwnscalculator"),SCLMPCalculator=require("./sclmpcalculator"),Tensor=require("./tensor"),gl=globals.gl,sgemmcalculator=new SGEMMCalculator(gl,!1),saxpycalculator=new SAXPYCalculator(gl,!1),sscalcalculator=new SSCALCalculator(gl,!1),sdwnscalculator=new SDWNSCalculator(gl,!1),sclmpcalculator=new SCLMPCalculator(gl,!1);module.exports={Tensor:Tensor,sscal:sscal,sgemm:sgemm,sdwns:sdwns,sclmp:sclmp,sgemmcalculator:sgemmcalculator,saxpycalculator:saxpycalculator,sscalcalculator:sscalcalculator,sdwnscalculator:sdwnscalculator,sclmpcalculator:sclmpcalculator};
},{"./globals":2,"./saxpycalculator":4,"./sclmpcalculator":5,"./sdwnscalculator":6,"./sgemmcalculator":7,"./sscalcalculator":8,"./tensor":9}],4:[function(require,module,exports){
function SAXPYCalculator(t,n){this.webgl=t,this.standalone=n||!0;var e="#define GLSLIFY 1\nprecision highp float;\n\nvarying vec2      outTex;	// texture coords of row/column to calculate\nuniform sampler2D X;		// texture with data from padded A\nuniform sampler2D Y;		// texture with data from padded transpose of B\nuniform int       N;\nuniform float     a; 		// coefficient to multiplication\n\n// Render float to bytes according to IEEE 754 Floating Point\nvec4 encode_float_1540259130(float val) {\n\n	// TODO: correctly handle denormal numbers\n	// http://www.2ality.com/2012/04/number-encoding.html\n	float a = abs(val);                           // encode absolute value + sign\n	float exp = floor(log2(a));                 // number of powers of 2\n	float mant = pow(2.,log2(a)-exp) * pow(2.,23.);  // multiply to fill 24 bits (implied leading 1)\n	float mant1 = floor(mant / 256. / 256.);    // first 8 bits of mantissa\n	float mant2 = mod(floor(mant / 256.),256.); // second 8 bits\n	float mant3 = mod(mant,256.);               // third 8 bits\n\n	highp float sign = 128.-128.*(a/val);			// sign bit is 256 or 0\n	highp float e = (sign+exp+127.)/510.;		// exponent and sign\n	highp float m1 = (mant1-(128.*(1.-mod(exp+127.,2.))))/255.; // handle leading bit\n	highp float m2 = (mant2)/255.;				// middle part\n	highp float m3 = (mant3+.5)/255.;			// scale to 0 - 255\n\n	return vec4(m3,m2,m1,e);\n}\n\n// select an element from a vector based on index\nfloat select_index_1604150559(vec4 v, int index){\n	float val;\n	if (index == 0) {\n		val = v.r;\n	} else if(index == 1) {\n		val = v.g;\n	} else if(index == 2) {\n		val = v.b;\n	} else if(index == 3){\n		val = v.a;\n	} else {\n		// should never be here\n		val = 0.0;\n	}\n\n	return val;\n}\n\nvoid main(void) {\n\n	// get the implied row and column from .y and .x of passed (output)\n	// texture coordinate. These map directly to input texture space when\n	// the relevant dimensions are the same.\n 	float row = outTex.y;\n	float col = outTex.x;\n\n	// direct usage of col requires output be padded exactly like input\n	vec4 x = texture2D( X, vec2(col, row));\n	vec4 y = texture2D( Y, vec2(col, row));\n	vec4 sum_v = (a * x) + y;\n	int channel = int(mod(col * float(N), 4.0 ));\n	float sum = select_index_1604150559(sum_v, channel);\n\n	if (sum == 0.) {\n		gl_FragColor = vec4(0.,0.,0.,0.);\n		return;\n	}\n\n 	// output vec4 with bytes for an IEEE754 32-bit floating point number\n	gl_FragColor = encode_float_1540259130(sum);\n}\n";this.standalone?this.program=this.webgl.createProgram(e):this.program=this.webgl.createProgram(p)}var WebGL=require("./webgl");module.exports=SAXPYCalculator,SAXPYCalculator.TEXTURE_UNIFORM_NAME_0="X",SAXPYCalculator.TEXTURE_UNIFORM_NAME_1="Y",SAXPYCalculator.LENGTH_UNIFORM_NAME="N",SAXPYCalculator.COEFFICIENT_UNIFORM_NAME="a",SAXPYCalculator.prototype.calculate=function(t,n,e,o,a){var l=this.webgl.context;this.webgl.selectProgram(this.program),this.bindInputTexture(e,l.TEXTURE0,SAXPYCalculator.TEXTURE_UNIFORM_NAME_0),this.bindInputTexture(o,l.TEXTURE1,SAXPYCalculator.TEXTURE_UNIFORM_NAME_1);var i=this.webgl.getPad(t);this.bindUniforms(t+i,n),this.webgl.bindOutputTexture(1,t+i,a),l.drawElements(l.TRIANGLES,6,l.UNSIGNED_SHORT,0),this.webgl.unbindInputTexture(l.TEXTURE0),this.webgl.unbindInputTexture(l.TEXTURE1)},SAXPYCalculator.prototype.bindInputTexture=function(t,n,e){var o=this.webgl.context,a=this.program;o.activeTexture(n),o.bindTexture(o.TEXTURE_2D,t);var l=o.getUniformLocation(a,e);o.uniform1i(l,n-o.TEXTURE0)},SAXPYCalculator.prototype.bindUniforms=function(t,n){var e=this.webgl.context,o=e.getUniformLocation(this.program,SAXPYCalculator.LENGTH_UNIFORM_NAME),a=e.getUniformLocation(this.program,SAXPYCalculator.COEFFICIENT_UNIFORM_NAME);e.uniform1i(o,t),e.uniform1f(a,n)};
},{"./webgl":11}],5:[function(require,module,exports){
function SCLMPCalculator(n,t){this.webgl=n,this.standalone=null!=t?t:!0;var e="#define GLSLIFY 1\nprecision highp float;\n\nvarying vec2      outTex;	// texture coords of row/column to calculate\nuniform sampler2D X;		// texture with data from padded A\nuniform int       N;		// number of columns\nuniform int       pad;		// additional columns to nearest multiple of four\nuniform float     a; 		// lower bound\nuniform float     b; 		// upper bound\n\n// Render float to bytes according to IEEE 754 Floating Point\nvec4 encode_float_1540259130(float val) {\n\n	// TODO: correctly handle denormal numbers\n	// http://www.2ality.com/2012/04/number-encoding.html\n	float a = abs(val);                           // encode absolute value + sign\n	float exp = floor(log2(a));                 // number of powers of 2\n	float mant = pow(2.,log2(a)-exp) * pow(2.,23.);  // multiply to fill 24 bits (implied leading 1)\n	float mant1 = floor(mant / 256. / 256.);    // first 8 bits of mantissa\n	float mant2 = mod(floor(mant / 256.),256.); // second 8 bits\n	float mant3 = mod(mant,256.);               // third 8 bits\n\n	highp float sign = 128.-128.*(a/val);			// sign bit is 256 or 0\n	highp float e = (sign+exp+127.)/510.;		// exponent and sign\n	highp float m1 = (mant1-(128.*(1.-mod(exp+127.,2.))))/255.; // handle leading bit\n	highp float m2 = (mant2)/255.;				// middle part\n	highp float m3 = (mant3+.5)/255.;			// scale to 0 - 255\n\n	return vec4(m3,m2,m1,e);\n}\n\n// select an element from a vector based on index\nfloat select_index_1604150559(vec4 v, int index){\n	float val;\n	if (index == 0) {\n		val = v.r;\n	} else if(index == 1) {\n		val = v.g;\n	} else if(index == 2) {\n		val = v.b;\n	} else if(index == 3){\n		val = v.a;\n	} else {\n		// should never be here\n		val = 0.0;\n	}\n\n	return val;\n}\n\nvoid main(void) {\n\n	// get the implied row and column from .y and .x of passed (output)\n	// texture coordinate. These map directly to input texture space when\n	// the relevant dimensions are the same.\n	float row = outTex.y;\n	float col = outTex.x;\n\n	// return 0.0 if in padded region of output texture\n	if(col * float(N + pad) > float(N) ) {\n		gl_FragColor = vec4(0.,0.,0.,0.);\n		return;\n	}\n\n	// direct usage of col requires output be padded exactly like input\n	vec4 x = texture2D( X, vec2(col, row));\n	vec4 val = clamp(x, a, b);\n\n	// select and output channel (standalone version only)\n	int channel = int(mod(col * float(N + pad), 4.0));\n	float sum = select_index_1604150559(val, channel);\n\n	if (sum == 0.) {\n		gl_FragColor = vec4(0.,0.,0.,0.);\n		return;\n	}\n\n	// output vec4 with bytes for an IEEE754 32-bit floating point number\n	gl_FragColor = encode_float_1540259130(sum);\n}\n",o="#define GLSLIFY 1\nprecision highp float;\n\nvarying vec2      outTex;	// texture coords of row/column to calculate\nuniform sampler2D X;		// texture with data from padded A\nuniform int       N;		// number of columns\nuniform int       pad;		// additional columns to nearest multiple of four\nuniform float     a; 		// lower bound\nuniform float     b; 		// upper bound\n\n// set pad values to 0.0, if in padded region of output texture\nvoid fix_pad_1540259130(inout vec4 v, int pad){\n	v.a = 0.0;\n	if(pad == 2){\n		v.b = 0.0;\n	} else if(pad == 3){\n		v.b = 0.0;\n		v.g = 0.0;\n	}\n}\n\nvoid main(void) {\n\n	// get the implied row and column from .y and .x of passed (output)\n	// texture coordinate. These map directly to input texture space when\n	// the relevant dimensions are the same.\n	float row_t = outTex.y;\n	float col_t = outTex.x;\n	float col = (col_t * float(N + pad) - 2.0); // index of first element in pixel (matrix space)\n\n	// direct usage of col requires output be padded exactly like input\n	vec4 x = texture2D( X, vec2(col_t, row_t));\n	vec4 val_v = clamp(x, a, b);\n\n	// is last element in pixel past row length?\n	if(pad > 0 && (col + 4.0) > float(N) ) {\n		// fix elements in padded region\n		fix_pad_1540259130(val_v, pad);\n	}\n\n	gl_FragColor = val_v;\n}\n";this.standalone?this.program=this.webgl.createProgram(e):this.program=this.webgl.createProgram(o)}var WebGL=require("./webgl");module.exports=SCLMPCalculator,SCLMPCalculator.TEXTURE_UNIFORM_NAME_0="X",SCLMPCalculator.LENGTH_UNIFORM_NAME="N",SCLMPCalculator.LOWER_UNIFORM_NAME="a",SCLMPCalculator.UPPER_UNIFORM_NAME="b",SCLMPCalculator.prototype.calculate=function(n,t,e,o,a,l){e=null!=e?e:Number.MIN_VALUE,o=null!=o?o:Number.MAX_VALUE;var i=this.webgl.context;this.webgl.selectProgram(this.program),this.bindInputTexture(a,i.TEXTURE0,SCLMPCalculator.TEXTURE_UNIFORM_NAME_0);var r=this.webgl.getPad(t);this.bindUniforms(t,r,e,o),this.standalone?this.webgl.bindOutputTexture(n,t+r,l):this.webgl.bindOutputTexture(n,(t+r)/4,l),i.drawElements(i.TRIANGLES,6,i.UNSIGNED_SHORT,0),this.webgl.unbindInputTexture(i.TEXTURE0)},SCLMPCalculator.prototype.bindInputTexture=function(n,t,e){var o=this.webgl.context,a=this.program;o.activeTexture(t),o.bindTexture(o.TEXTURE_2D,n);var l=o.getUniformLocation(a,e);o.uniform1i(l,t-o.TEXTURE0)},SCLMPCalculator.prototype.bindUniforms=function(n,t,e,o){var a=this.webgl.context,l=a.getUniformLocation(this.program,SCLMPCalculator.LENGTH_UNIFORM_NAME),i=a.getUniformLocation(this.program,SCLMPCalculator.UPPER_UNIFORM_NAME),r=a.getUniformLocation(this.program,SCLMPCalculator.LOWER_UNIFORM_NAME),u=a.getUniformLocation(this.program,"pad");a.uniform1i(l,n),a.uniform1i(u,t),a.uniform1f(r,e),a.uniform1f(i,o)};
},{"./webgl":11}],6:[function(require,module,exports){
function DownsampleCalculator(n,o){this.webgl=n,this.standalone=null!=o?o:!0;var t="#define GLSLIFY 1\n// TODO: unroll loop for stride == factor and small values (2, 3)\nprecision highp float;\n\nvarying vec2      outTex;  // texture coords of row/column to calculate\nuniform sampler2D X;       // texture with data from padded A\nuniform int       factor;  // width of image patch\nuniform float     stride;  // width between image patches\nuniform float     C;       // number of channels\nuniform float     M;\nuniform float     N;\nuniform float     N_out;\nuniform float     M_out;\n\n// Render float to bytes according to IEEE 754 Floating Point\nvec4 encode_float_1540259130(float val) {\n\n	// TODO: correctly handle denormal numbers\n	// http://www.2ality.com/2012/04/number-encoding.html\n	float a = abs(val);                           // encode absolute value + sign\n	float exp = floor(log2(a));                 // number of powers of 2\n	float mant = pow(2.,log2(a)-exp) * pow(2.,23.);  // multiply to fill 24 bits (implied leading 1)\n	float mant1 = floor(mant / 256. / 256.);    // first 8 bits of mantissa\n	float mant2 = mod(floor(mant / 256.),256.); // second 8 bits\n	float mant3 = mod(mant,256.);               // third 8 bits\n\n	highp float sign = 128.-128.*(a/val);			// sign bit is 256 or 0\n	highp float e = (sign+exp+127.)/510.;		// exponent and sign\n	highp float m1 = (mant1-(128.*(1.-mod(exp+127.,2.))))/255.; // handle leading bit\n	highp float m2 = (mant2)/255.;				// middle part\n	highp float m3 = (mant3+.5)/255.;			// scale to 0 - 255\n\n	return vec4(m3,m2,m1,e);\n}\n\n// select an element from a vector based on index\nfloat select_index_1604150559(vec4 v, int index){\n	float val;\n	if (index == 0) {\n		val = v.r;\n	} else if(index == 1) {\n		val = v.g;\n	} else if(index == 2) {\n		val = v.b;\n	} else if(index == 3){\n		val = v.a;\n	} else {\n		// should never be here\n		val = 0.0;\n	}\n\n	return val;\n}\n\nvoid main(void) {\n\n	// get the implied row and column from .y and .x of passed (output)\n	// texture coordinate and translate to output pixel space.\n	float row = floor(outTex.y * M_out);   // row on output texture (matrix space)\n	float col = floor(outTex.x * N_out); // column on output texture (matrix space)\n	float vcol = floor(col / C);   // virtual column on output texture (matrix space)\n	float vchannel = floor(mod(col, C)); // virtual channel on output texture\n\n	const float min = -1.0e+08;\n	vec4 currentMax = vec4(min, min, min, min);\n\n	float deltaY = 1.0/M;\n	float deltaX = 1.0/N;\n	float y = ((row * stride) + 0.5)*deltaY; // texture position of input row\n	float x;\n	float z = vchannel * deltaX;\n	for (int i = 0; i < 100; i += 1) {\n		if (i >= factor) {\n			break;\n		}\n		x = ((vcol * stride * C) + 0.5) * deltaX; // texture position of input column\n\n		for (int j = 0; j < 100; j += 1) {\n			if (j >= factor) {\n				break;\n			}\n\n			vec2 coords = vec2(x + z, y);\n			vec4 x_v = texture2D(X, coords);\n			currentMax = max(currentMax, x_v);\n\n			x += (deltaX * C);\n		}\n		y += deltaY;\n	}\n	int chan = int(mod(outTex.x * N_out, 4.0 ));\n	float val = select_index_1604150559(currentMax, int(chan));\n	if (val == 0.) {\n		gl_FragColor = vec4(0.,0.,0.,0.);\n		return;\n	}\n\n	gl_FragColor = encode_float_1540259130(val);\n}\n";p="#define GLSLIFY 1\n// TODO: unroll loop for stride == factor and small values (2, 3)\nprecision highp float;\n\nvarying vec2      outTex;  // texture coords of row/column to calculate\nuniform sampler2D X;       // texture with data from padded A\nuniform int       factor;  // width of image patch\nuniform float     stride;  // width between image patches\nuniform float     C;       // number of channels\nuniform float     M;\nuniform float     N;\nuniform float     N_out;\nuniform float     M_out;\n\nvoid main(void) {\n\n	// get the implied row and column from .y and .x of passed (output)\n	// texture coordinate and translate to output pixel space.\n	float row = floor(outTex.y * M_out);   // row on output texture (pixel space)\n	float col = floor(outTex.x * N_out); // column on output texture (matrix space)\n	float vcol = floor(col / C);   // virtual column on output texture (matrix space)\n	float vchannel = floor(mod(col, C)); // virtual channel on output texture\n\n	const float min = -1.0e+08;\n	vec4 currentMax = vec4(min, min, min, min);\n\n	float deltaY = 1.0/M;\n	float deltaX = 1.0/N;\n	float y = ((row * stride) + 0.5)*deltaY; // texture position of input row\n	float x;\n	float z = vchannel * deltaX;\n	for (int i = 0; i < 100; i += 1) {\n		if (i >= factor) {\n			break;\n		}\n		x = ((vcol * stride * C) + 0.5) * deltaX; // texture position of input column\n\n		for (int j = 0; j < 100; j += 1) {\n			if (j >= factor) {\n				break;\n			}\n\n			vec2 coords = vec2(x + z, y);\n			vec4 x_v = texture2D(X, coords);\n			currentMax = max(currentMax, x_v);\n\n			x += (deltaX * C);\n		}\n		y += deltaY;\n	}\n\n	gl_FragColor = currentMax;\n}\n",this.standalone?this.program=this.webgl.createProgram(t):this.program=this.webgl.createProgram(p)}var WebGL=require("./webgl");module.exports=DownsampleCalculator,DownsampleCalculator.TEXTURE_UNIFORM_NAME_0="X",DownsampleCalculator.INPUT_ROW_COUNT_UNIFORM_NAME="M",DownsampleCalculator.INPUT_COLUMN_COUNT_UNIFORM_NAME="N",DownsampleCalculator.OUTPUT_ROW_COUNT_UNIFORM_NAME="M_out",DownsampleCalculator.OUTPUT_COLUMN_COUNT_UNIFORM_NAME="N_out",DownsampleCalculator.FACTOR_UNIFORM_NAME="factor",DownsampleCalculator.STRIDE_UNIFORM_NAME="stride",DownsampleCalculator.CHANNEL_COUNT_UNIFORM_NAME="C",DownsampleCalculator.prototype.calculate=function(n,o,t,a,e,l,r){if(t%WebGL.COMPONENTS_PER_TEXEL!=0)throw new Error("Channel count must be a multiple of "+WebGL.COMPONENTS_PER_TEXEL);var i=this.webgl.context,u=(Math.floor((o-a)/e)+1)*t,f=Math.floor((n-a)/e)+1;this.webgl.selectProgram(this.program),this.bindInputTexture(l,i.TEXTURE0,DownsampleCalculator.TEXTURE_UNIFORM_NAME_0),this.bindUniforms(n,o*t,f,u,a,e,t),this.standalone?this.webgl.bindOutputTexture(f,u,r):this.webgl.bindOutputTexture(f,u/WebGL.COMPONENTS_PER_TEXEL,r),i.drawElements(i.TRIANGLES,6,i.UNSIGNED_SHORT,0),this.webgl.unbindInputTexture(i.TEXTURE0)},DownsampleCalculator.prototype.bindInputTexture=function(n,o,t){var a=this.webgl.context,e=this.program;a.activeTexture(o),a.bindTexture(a.TEXTURE_2D,n);var l=a.getUniformLocation(e,t);a.uniform1i(l,o-a.TEXTURE0)},DownsampleCalculator.prototype.bindUniforms=function(n,o,t,a,e,l,r){var i=this.webgl.context,u=i.getUniformLocation(this.program,DownsampleCalculator.INPUT_ROW_COUNT_UNIFORM_NAME),f=i.getUniformLocation(this.program,DownsampleCalculator.INPUT_COLUMN_COUNT_UNIFORM_NAME),m=i.getUniformLocation(this.program,DownsampleCalculator.OUTPUT_ROW_COUNT_UNIFORM_NAME),c=i.getUniformLocation(this.program,DownsampleCalculator.OUTPUT_COLUMN_COUNT_UNIFORM_NAME),s=i.getUniformLocation(this.program,DownsampleCalculator.FACTOR_UNIFORM_NAME),p=i.getUniformLocation(this.program,DownsampleCalculator.STRIDE_UNIFORM_NAME),d=i.getUniformLocation(this.program,DownsampleCalculator.CHANNEL_COUNT_UNIFORM_NAME);i.uniform1f(u,n),i.uniform1f(f,o),i.uniform1f(m,t),i.uniform1f(c,a),i.uniform1i(s,e),i.uniform1f(p,l),i.uniform1f(d,r)};
},{"./webgl":11}],7:[function(require,module,exports){
function SGEMMCalculator(t,e){this.webgl=t,this.standalone=null!=e?e:!0;var n="#define GLSLIFY 1\n// fragment shader that calculates the matrix product and renders each\n// element to the bytes representing a 32-bit IEEE754 floating point in\n// the output RGBA canvas.\n// readPixel is used to read the bytes.\n\nprecision highp float;\n\nvarying vec2      outTex;	// texture coords of row/column to calculate\nuniform sampler2D A;		// texture with data from padded A\nuniform sampler2D B_t;		// texture with data from padded transpose of B\nuniform int       K;		// number of elements in shared dimension\nuniform int       N;		// number of columns in output\nuniform int       pad;		//\nuniform float     alpha; 	// coefficient to multiplication\n\n// sum of products between elements in row i (from A) x col j (from B)\n\n// Calculate the dot product between the row (from A) and column (from B)\n// identified by the passed indeces (output texture coordinate space).\n// We loop over elements in the row and column and sum the product\n// using the glsl `dot` function to process four elements at a time.\n// This four element optimization requires that the matrix B be\n// transposed before texel packing and that both matrices be padded\n// (with zeros) to a multiple of four (4) in their shared dimension.\nfloat dot_rowcol_1540259130(float y, float x, sampler2D A, sampler2D B_t, int K) {\n	float delta_t = 1./float(K);// space (on texture) between elements\n	float sum = 0.;			// sum for this row/column pair\n	float z = 0.5 * (4.0 * delta_t);// position for shared dimension on source textures\n\n	for (int l=0 ; l<4096 ; ++l) {\n		if(l >= K / 4) break;    // stop when we finish the row/column\n		// l is in pixel space, so we divide by four\n\n		// retrieve next four elements from each texture\n		vec4 a_ik = texture2D(  A, vec2(z, y));\n		vec4 b_kj = texture2D(B_t, vec2(z, x));\n\n	// use `dot` to process four elements at a time\n		sum +=  dot(a_ik, b_kj);\n		z += (4.0 * delta_t);      // (z + 0.5)*delta\n	}\n	return sum;\n}\n\n// Render float to bytes according to IEEE 754 Floating Point\nvec4 encode_float_1604150559(float val) {\n\n	// TODO: correctly handle denormal numbers\n	// http://www.2ality.com/2012/04/number-encoding.html\n	float a = abs(val);                           // encode absolute value + sign\n	float exp = floor(log2(a));                 // number of powers of 2\n	float mant = pow(2.,log2(a)-exp) * pow(2.,23.);  // multiply to fill 24 bits (implied leading 1)\n	float mant1 = floor(mant / 256. / 256.);    // first 8 bits of mantissa\n	float mant2 = mod(floor(mant / 256.),256.); // second 8 bits\n	float mant3 = mod(mant,256.);               // third 8 bits\n\n	highp float sign = 128.-128.*(a/val);			// sign bit is 256 or 0\n	highp float e = (sign+exp+127.)/510.;		// exponent and sign\n	highp float m1 = (mant1-(128.*(1.-mod(exp+127.,2.))))/255.; // handle leading bit\n	highp float m2 = (mant2)/255.;				// middle part\n	highp float m3 = (mant3+.5)/255.;			// scale to 0 - 255\n\n	return vec4(m3,m2,m1,e);\n}\n\nvoid main(void) {\n\n	// get the implied row and column from .y and .x of passed (output)\n	// texture coordinate. These map directly to input texture space when\n	// the relevant dimensions are the same.\n	float row_t = outTex.y;\n	float col_t = outTex.x;\n\n	// sum row x col for the passed pixel\n	float sum = alpha * dot_rowcol_1540259130(row_t, col_t * float(N + pad)/float(N), A, B_t, K);\n\n	if (sum == 0.) {\n		gl_FragColor = vec4(0.,0.,0.,0.);\n		return;\n	}\n\n	// output vec4 with bytes for an IEEE754 32-bit floating point number\n	gl_FragColor = encode_float_1604150559(sum);\n}\n",o="#define GLSLIFY 1\n// fragment shader that calculates the matrix product (with additive 'C' term)\n// and renders each element to the bytes representing a 32-bit IEEE754 floating\n// point in the output RGBA canvas.\n// readPixel is used to read the bytes.\n\nprecision highp float;\n\nvarying vec2      outTex;	// texture coords of row/column to calculate\nuniform sampler2D A;		// texture with data from padded A\nuniform sampler2D B_t;		// texture with data from padded transpose of B\nuniform sampler2D C;		// texture with data from C\nuniform int       K;		// number of elements in shared dimension\nuniform int       N;		// number of columns in output\nuniform int       pad;		//\nuniform float     alpha; 	// coefficient to multiplication\nuniform float     beta; 	// coefficient to additive term\n\n// sum of products between elements in row i (from A) x col j (from B)\n\n// Calculate the dot product between the row (from A) and column (from B)\n// identified by the passed indeces (output texture coordinate space).\n// We loop over elements in the row and column and sum the product\n// using the glsl `dot` function to process four elements at a time.\n// This four element optimization requires that the matrix B be\n// transposed before texel packing and that both matrices be padded\n// (with zeros) to a multiple of four (4) in their shared dimension.\nfloat dot_rowcol_1540259130(float y, float x, sampler2D A, sampler2D B_t, int K) {\n	float delta_t = 1./float(K);// space (on texture) between elements\n	float sum = 0.;			// sum for this row/column pair\n	float z = 0.5 * (4.0 * delta_t);// position for shared dimension on source textures\n\n	for (int l=0 ; l<4096 ; ++l) {\n		if(l >= K / 4) break;    // stop when we finish the row/column\n		// l is in pixel space, so we divide by four\n\n		// retrieve next four elements from each texture\n		vec4 a_ik = texture2D(  A, vec2(z, y));\n		vec4 b_kj = texture2D(B_t, vec2(z, x));\n\n	// use `dot` to process four elements at a time\n		sum +=  dot(a_ik, b_kj);\n		z += (4.0 * delta_t);      // (z + 0.5)*delta\n	}\n	return sum;\n}\n\n// Render float to bytes according to IEEE 754 Floating Point\nvec4 encode_float_1604150559(float val) {\n\n	// TODO: correctly handle denormal numbers\n	// http://www.2ality.com/2012/04/number-encoding.html\n	float a = abs(val);                           // encode absolute value + sign\n	float exp = floor(log2(a));                 // number of powers of 2\n	float mant = pow(2.,log2(a)-exp) * pow(2.,23.);  // multiply to fill 24 bits (implied leading 1)\n	float mant1 = floor(mant / 256. / 256.);    // first 8 bits of mantissa\n	float mant2 = mod(floor(mant / 256.),256.); // second 8 bits\n	float mant3 = mod(mant,256.);               // third 8 bits\n\n	highp float sign = 128.-128.*(a/val);			// sign bit is 256 or 0\n	highp float e = (sign+exp+127.)/510.;		// exponent and sign\n	highp float m1 = (mant1-(128.*(1.-mod(exp+127.,2.))))/255.; // handle leading bit\n	highp float m2 = (mant2)/255.;				// middle part\n	highp float m3 = (mant3+.5)/255.;			// scale to 0 - 255\n\n	return vec4(m3,m2,m1,e);\n}\n\n// select an element from a vector based on index\nfloat select_index_1117569599(vec4 v, int index){\n	float val;\n	if (index == 0) {\n		val = v.r;\n	} else if(index == 1) {\n		val = v.g;\n	} else if(index == 2) {\n		val = v.b;\n	} else if(index == 3){\n		val = v.a;\n	} else {\n		// should never be here\n		val = 0.0;\n	}\n\n	return val;\n}\n\nvoid main(void) {\n\n	// get the implied row and column from .y and .x of passed (output)\n	// texture coordinate. These map directly to input texture space when\n	// the relevant dimensions are the same.\n	float row_t = outTex.y;\n	float col_t = outTex.x;\n	vec4 c_vec = texture2D(C, vec2(col_t, 0.5));\n\n	// should be -0.5, but that subtly breaks at zero\n	float col = col_t * float(N + pad); // index of first element in pixel (matrix space)\n	int channel = int(mod(col, 4.0 ));\n	float c = select_index_1117569599(c_vec, channel);\n\n	// sum row x col for the passed pixel\n	float sum = alpha * dot_rowcol_1540259130(row_t, col_t * float(N + pad)/float(N), A, B_t, K);\n	sum += beta * c;\n\n	if (sum == 0.) {\n		gl_FragColor = vec4(0.,0.,0.,0.);\n		return;\n	}\n\n	// output vec4 with bytes for an IEEE754 32-bit floating point number\n	gl_FragColor = encode_float_1604150559(sum);\n}\n",a="#define GLSLIFY 1\n// fragment shader that calculates the matrix product and writes each\n// element to a pixel component in a floating point texture.\n// the output RGBA canvas.\n// readPixel is used to read the bytes.\n\nprecision highp float;\n\nvarying vec2      outTex;	// texture coords of row/column to calculate\nuniform sampler2D A;		// texture with data from padded A\nuniform sampler2D B_t;		// texture with data from padded transpose of B\nuniform int       K;		// number of elements in shared dimension\nuniform int       N;		// number of columns in output\nuniform int       pad;		//\nuniform float     alpha; 	// coefficient to multiplication\n\n// sum of products between elements in row i (from A) x col j (from B)\n\n// Calculate the dot product between the row (from A) and column (from B)\n// identified by the passed indeces (output texture coordinate space).\n// We loop over elements in the row and column and sum the product\n// using the glsl `dot` function to process four elements at a time.\n// This four element optimization requires that the matrix B be\n// transposed before texel packing and that both matrices be padded\n// (with zeros) to a multiple of four (4) in their shared dimension.\nfloat dot_rowcol_1540259130(float y, float x, sampler2D A, sampler2D B_t, int K) {\n	float delta_t = 1./float(K);// space (on texture) between elements\n	float sum = 0.;			// sum for this row/column pair\n	float z = 0.5 * (4.0 * delta_t);// position for shared dimension on source textures\n\n	for (int l=0 ; l<4096 ; ++l) {\n		if(l >= K / 4) break;    // stop when we finish the row/column\n		// l is in pixel space, so we divide by four\n\n		// retrieve next four elements from each texture\n		vec4 a_ik = texture2D(  A, vec2(z, y));\n		vec4 b_kj = texture2D(B_t, vec2(z, x));\n\n	// use `dot` to process four elements at a time\n		sum +=  dot(a_ik, b_kj);\n		z += (4.0 * delta_t);      // (z + 0.5)*delta\n	}\n	return sum;\n}\n\nvoid main(void) {\n\n	// get the implied row and column from .y and .x of passed (output)\n	// texture coordinate. These map directly to input texture space when\n	// the relevant dimensions are the same.\n	float row_t = outTex.y;\n	float col_t = outTex.x;\n\n	vec4 sum_v = vec4(0.0, 0.0, 0.0, 0.0);\n	float col = (col_t * float(N + pad) - 2.0); // index of first element in pixel (matrix space)\n	sum_v.r = alpha * dot_rowcol_1540259130(row_t, (col + 0.5)/float(N), A, B_t, K);\n	// is last element in pixel past row length?\n	if(pad > 0 && (col + 4.0) > float(N) ) {\n		// compute elements in padded region\n		if(pad < 3){\n			sum_v.g = alpha * dot_rowcol_1540259130(row_t, (col + 1.5)/float(N), A, B_t, K);\n		}\n		if(pad < 2){\n			sum_v.b = alpha * dot_rowcol_1540259130(row_t, (col + 2.5)/float(N), A, B_t, K);\n		}\n	} else {\n		sum_v.g = alpha * dot_rowcol_1540259130(row_t, (col + 1.5)/float(N), A, B_t, K);\n		sum_v.b = alpha * dot_rowcol_1540259130(row_t, (col + 2.5)/float(N), A, B_t, K);\n		sum_v.a = alpha * dot_rowcol_1540259130(row_t, (col + 3.5)/float(N), A, B_t, K);\n	}\n\n	gl_FragColor = sum_v;\n}\n",r="#define GLSLIFY 1\n// fragment shader that calculates the matrix product and writes each\n// element to a pixel component in a floating point texture.\n// the output RGBA canvas.\n// readPixel is used to read the bytes.\n\nprecision highp float;\n\nvarying vec2      outTex;	// texture coords of row/column to calculate\nuniform sampler2D A;		// texture with data from padded A\nuniform sampler2D B_t;		// texture with data from padded transpose of B\nuniform sampler2D C;		// texture with data from C\nuniform int       K;		// number of elements in shared dimension\nuniform int       N;		// number of columns in output\nuniform int       pad;		//\nuniform float     alpha; 	// coefficient to multiplication\nuniform float     beta; 	// coefficient to addition\n\n// sum of products between elements in row i (from A) x col j (from B)\n\n// Calculate the dot product between the row (from A) and column (from B)\n// identified by the passed indeces (output texture coordinate space).\n// We loop over elements in the row and column and sum the product\n// using the glsl `dot` function to process four elements at a time.\n// This four element optimization requires that the matrix B be\n// transposed before texel packing and that both matrices be padded\n// (with zeros) to a multiple of four (4) in their shared dimension.\nfloat dot_rowcol_1540259130(float y, float x, sampler2D A, sampler2D B_t, int K) {\n	float delta_t = 1./float(K);// space (on texture) between elements\n	float sum = 0.;			// sum for this row/column pair\n	float z = 0.5 * (4.0 * delta_t);// position for shared dimension on source textures\n\n	for (int l=0 ; l<4096 ; ++l) {\n		if(l >= K / 4) break;    // stop when we finish the row/column\n		// l is in pixel space, so we divide by four\n\n		// retrieve next four elements from each texture\n		vec4 a_ik = texture2D(  A, vec2(z, y));\n		vec4 b_kj = texture2D(B_t, vec2(z, x));\n\n	// use `dot` to process four elements at a time\n		sum +=  dot(a_ik, b_kj);\n		z += (4.0 * delta_t);      // (z + 0.5)*delta\n	}\n	return sum;\n}\n\nvoid main(void) {\n\n	// get the implied row and column from .y and .x of passed (output)\n	// texture coordinate. These map directly to input texture space when\n	// the relevant dimensions are the same.\n	float row_t = outTex.y;\n	float col_t = outTex.x;\n	vec4 c_v = texture2D(C, vec2(col_t, 0.5));\n\n	vec4 sum_v = vec4(0.0, 0.0, 0.0, 0.0);\n	float col = (col_t * float(N + pad) - 2.0); // index of first element in pixel (matrix space)\n	sum_v.r = alpha * dot_rowcol_1540259130(row_t, (col + 0.5)/float(N), A, B_t, K);\n	// in the padding region?\n	if(pad > 0 && (col + 4.0) > float(N) ) {\n		// pad\n		if(pad < 3){\n			sum_v.g = alpha * dot_rowcol_1540259130(row_t, (col + 1.5)/float(N), A, B_t, K);\n		}\n		if(pad < 2){\n			sum_v.b = alpha * dot_rowcol_1540259130(row_t, (col + 2.5)/float(N), A, B_t, K);\n		}\n	} else {\n		sum_v.g = alpha * dot_rowcol_1540259130(row_t, (col + 1.5)/float(N), A, B_t, K);\n		sum_v.b = alpha * dot_rowcol_1540259130(row_t, (col + 2.5)/float(N), A, B_t, K);\n		sum_v.a = alpha * dot_rowcol_1540259130(row_t, (col + 3.5)/float(N), A, B_t, K);\n	}\n\n	gl_FragColor = sum_v + beta*c_v;\n}\n";this.standalone?(this.program_=this.webgl.createProgram(n),this.program_c=this.webgl.createProgram(o)):(this.program_=this.webgl.createProgram(a),this.program_c=this.webgl.createProgram(r))}var WebGL=require("./webgl");module.exports=SGEMMCalculator,SGEMMCalculator.TEXTURE_UNIFORM_NAME_0="A",SGEMMCalculator.TEXTURE_UNIFORM_NAME_1="B_t",SGEMMCalculator.TEXTURE_UNIFORM_NAME_2="C",SGEMMCalculator.SHARED_LENGTH_UNIFORM_NAME="K",SGEMMCalculator.COLUMN_COUNT_UNIFORM_NAME="N",SGEMMCalculator.PAD_UNIFORM_NAME="pad",SGEMMCalculator.ALPHA_UNIFORM_NAME="alpha",SGEMMCalculator.BETA_UNIFORM_NAME="beta",SGEMMCalculator.prototype.calculate=function(t,e,n,o,a,r,i,l,s){var u=this.webgl.context;null!=l?this.program=this.program_c:(i=null,this.program=this.program_),this.webgl.selectProgram(this.program),this.bindInputTexture(a,u.TEXTURE0,SGEMMCalculator.TEXTURE_UNIFORM_NAME_0),this.bindInputTexture(r,u.TEXTURE1,SGEMMCalculator.TEXTURE_UNIFORM_NAME_1),null!=l&&this.bindInputTexture(l,u.TEXTURE2,SGEMMCalculator.TEXTURE_UNIFORM_NAME_2);var m=this.webgl.getPad(n),d=this.webgl.getPad(e);this.bindUniforms(e,n+m,d,o,i),this.standalone?this.webgl.bindOutputTexture(t,e+d,s):this.webgl.bindOutputTexture(t,(e+d)/4,s),u.drawElements(u.TRIANGLES,6,u.UNSIGNED_SHORT,0),this.webgl.unbindInputTexture(u.TEXTURE0),this.webgl.unbindInputTexture(u.TEXTURE1),this.webgl.unbindInputTexture(u.TEXTURE2)},SGEMMCalculator.prototype.bindInputTexture=function(t,e,n){var o=this.webgl.context,a=this.program;o.activeTexture(e),o.bindTexture(o.TEXTURE_2D,t);var r=o.getUniformLocation(a,n);o.uniform1i(r,e-o.TEXTURE0)},SGEMMCalculator.prototype.bindUniforms=function(t,e,n,o,a){var r=this.webgl.context,i=r.getUniformLocation(this.program,SGEMMCalculator.SHARED_LENGTH_UNIFORM_NAME),l=r.getUniformLocation(this.program,SGEMMCalculator.ALPHA_UNIFORM_NAME),s=r.getUniformLocation(this.program,SGEMMCalculator.BETA_UNIFORM_NAME),u=r.getUniformLocation(this.program,SGEMMCalculator.COLUMN_COUNT_UNIFORM_NAME),m=m=r.getUniformLocation(this.program,SGEMMCalculator.PAD_UNIFORM_NAME);r.uniform1f(s,a),r.uniform1i(u,t),r.uniform1i(m,n),r.uniform1i(i,e),r.uniform1f(l,o)};
},{"./webgl":11}],8:[function(require,module,exports){
function SSCALCalculator(n,t){this.webgl=n,this.standalone=null!=t?t:!0;var e="#define GLSLIFY 1\nprecision highp float;\n\nvarying vec2      outTex;	// texture coords of row/column to calculate\nuniform sampler2D X;		// texture with data from padded X\nuniform int       N;		// number of columns\nuniform int       pad;		// additional columns to nearest multiple of four\nuniform float     b; 		// additive term\nuniform float     a; 		// multiplicative term\n\n// Render float to bytes according to IEEE 754 Floating Point\nvec4 encode_float_1540259130(float val) {\n\n	// TODO: correctly handle denormal numbers\n	// http://www.2ality.com/2012/04/number-encoding.html\n	float a = abs(val);                           // encode absolute value + sign\n	float exp = floor(log2(a));                 // number of powers of 2\n	float mant = pow(2.,log2(a)-exp) * pow(2.,23.);  // multiply to fill 24 bits (implied leading 1)\n	float mant1 = floor(mant / 256. / 256.);    // first 8 bits of mantissa\n	float mant2 = mod(floor(mant / 256.),256.); // second 8 bits\n	float mant3 = mod(mant,256.);               // third 8 bits\n\n	highp float sign = 128.-128.*(a/val);			// sign bit is 256 or 0\n	highp float e = (sign+exp+127.)/510.;		// exponent and sign\n	highp float m1 = (mant1-(128.*(1.-mod(exp+127.,2.))))/255.; // handle leading bit\n	highp float m2 = (mant2)/255.;				// middle part\n	highp float m3 = (mant3+.5)/255.;			// scale to 0 - 255\n\n	return vec4(m3,m2,m1,e);\n}\n\n// select an element from a vector based on index\nfloat select_index_1604150559(vec4 v, int index){\n	float val;\n	if (index == 0) {\n		val = v.r;\n	} else if(index == 1) {\n		val = v.g;\n	} else if(index == 2) {\n		val = v.b;\n	} else if(index == 3){\n		val = v.a;\n	} else {\n		// should never be here\n		val = 0.0;\n	}\n\n	return val;\n}\n\nvoid main(void) {\n\n	// get the implied row and column from .y and .x of passed (output)\n	// texture coordinate. These map directly to input texture space when\n	// the relevant dimensions are the same.\n 	float row = outTex.y;\n	float col = outTex.x;\n\n	// direct usage of col requires output be padded exactly like input\n	vec4 x = texture2D( X, vec2(col, row));\n	vec4 sum_v = (a * x) + b;\n	int channel = int(mod(col * float(N + pad), 4.0 ));\n	float sum = select_index_1604150559(sum_v, channel);\n\n	if (sum == 0.) {\n		gl_FragColor = vec4(0.,0.,0.,0.);\n		return;\n	}\n\n 	// output vec4 with bytes for an IEEE754 32-bit floating point number\n	gl_FragColor = encode_float_1540259130(sum);\n}\n",o="#define GLSLIFY 1\nprecision highp float;\n\nvarying vec2      outTex;	// texture coords of row/column to calculate\nuniform sampler2D X;		// texture with data from padded X\nuniform int       N;		// number of columns\nuniform int       pad;		// additional columns to nearest multiple of four\nuniform float     b; 		// additive term\nuniform float     a; 		// multiplicative term\n\n// set pad values to 0.0, if in padded region of output texture\nvoid fix_pad_1540259130(inout vec4 v, int pad){\n	v.a = 0.0;\n	if(pad == 2){\n		v.b = 0.0;\n	} else if(pad == 3){\n		v.b = 0.0;\n		v.g = 0.0;\n	}\n}\n\nvoid main(void) {\n\n	// get the implied row and column from .y and .x of passed (output)\n	// texture coordinate. These map directly to input texture space when\n	// the relevant dimensions are the same.\n	float row_t = outTex.y;\n	float col_t = outTex.x;\n	float col = (col_t * float(N + pad) - 2.0); // index of first element in pixel (matrix space)\n\n	// direct usage of col requires output be padded exactly like input\n	vec4 x = texture2D( X, vec2(col_t, row_t));\n	vec4 sum_v = (a * x) + b;\n\n	// fix padded region\n	if(pad > 0 && col + 4.0 > float(N) ) {\n		fix_pad_1540259130(sum_v, pad);\n	}\n\n	gl_FragColor = sum_v;\n}\n";this.standalone?this.program=this.webgl.createProgram(e):this.program=this.webgl.createProgram(o)}var WebGL=require("./webgl");module.exports=SSCALCalculator,SSCALCalculator.TEXTURE_UNIFORM_NAME_0="X",SSCALCalculator.LENGTH_UNIFORM_NAME="N",SSCALCalculator.ADD_UNIFORM_NAME="b",SSCALCalculator.MUL_UNIFORM_NAME="a",SSCALCalculator.prototype.calculate=function(n,t,e,o,a,i){var l=this.webgl.context,r=t%WebGL.COMPONENTS_PER_TEXEL,u=0==r?0:WebGL.COMPONENTS_PER_TEXEL-r;this.webgl.selectProgram(this.program),this.bindInputTexture(a,l.TEXTURE0,SSCALCalculator.TEXTURE_UNIFORM_NAME_0),this.bindUniforms(t,u,e,o),this.standalone?this.webgl.bindOutputTexture(n,t+u,i):this.webgl.bindOutputTexture(n,(t+u)/4,i),l.drawElements(l.TRIANGLES,6,l.UNSIGNED_SHORT,0),this.webgl.unbindInputTexture(l.TEXTURE0)},SSCALCalculator.prototype.bindInputTexture=function(n,t,e){var o=this.webgl.context,a=this.program;o.activeTexture(t),o.bindTexture(o.TEXTURE_2D,n);var i=o.getUniformLocation(a,e);o.uniform1i(i,t-o.TEXTURE0)},SSCALCalculator.prototype.bindUniforms=function(n,t,e,o){var a=this.webgl.context,i=a.getUniformLocation(this.program,SSCALCalculator.LENGTH_UNIFORM_NAME),l=a.getUniformLocation(this.program,SSCALCalculator.ADD_UNIFORM_NAME),r=a.getUniformLocation(this.program,SSCALCalculator.MUL_UNIFORM_NAME),u=a.getUniformLocation(this.program,"pad");a.uniform1i(i,n),a.uniform1i(u,t),a.uniform1f(r,e),a.uniform1f(l,o)};
},{"./webgl":11}],9:[function(require,module,exports){
function Tensor(e,t){if(2!=e.length)throw new Error("Only Tensor of order two (matrix) is supported right now.");var r=e[0],s=e[1];this.texture=gl.createDataTexture(r,s,t),this.shape=[r,s]}var globals=require("./globals"),gl=globals.gl;module.exports=Tensor,Tensor.prototype["delete"]=function(){gl.context.deleteTexture(this.texture),this.texture=null,this.shape=null},Tensor.prototype.transfer=function(e){var t,r,s=this.shape[0],o=this.shape[1];return t=gl.createOutputTexture(s,o),gl.encode(s,o,this.texture,t),r=new Float32Array(gl.readData(s,o)),gl.context.deleteTexture(t),e||this["delete"](),r},Tensor.prototype.reshape=function(e,t){var r=this.shape[0],s=this.shape[1],o=e[0],n=e[1],l=new Tensor(e,null);return gl.reshape(r,s,o,n,this.texture,l.texture),t||this["delete"](),l},Tensor.prototype.transpose=function(e){var t=this.shape[0],r=this.shape[1],s=new Tensor([r,t],null);return gl.transpose(t,r,this.texture,s.texture),e||this["delete"](),s};
},{"./globals":2}],10:[function(require,module,exports){
var async=require("async"),loader=require("floader");test={},test.allclose=function(e,t,r,a){if(r=r||1e-5,a=a||1e-8,e.length!=t.length)return console.log("lengths not equal: "+e.length+", "+t.length),{result:!1,index:null};for(var n,l=0;l<e.length;l++)if(n=Math.abs(e[l]-t[l])<=a+r*Math.abs(t[l]),!n)return{result:!1,index:l};return{result:!0,index:l}},test.randomArray=function(e,t){for(var r=[],a=0;e>a;a++){for(var n=[],l=0;t>l;l++)n[l]=Math.random()/Math.sqrt(e);r.push(n)}return r},test.padData=function(e,t,r,a){for(var n=new Float32Array(e*(t+r)),l=0;e>l;l++)n.set(a.subarray(l*t,(l+1)*t),l*(t+r));return n},test.load=function(e,t,r){var a=t.map(function(t){return e+t});async.map(a,loader.load,function(e,t){if(e)return r(e);var a=t.map(JSON.parse);r(e,a)})},test.assert={},test.assert.allclose=function(e,t,r,a,n,l){var s=test.allclose(t,r,n,l),o="[",u="[";if(!s.result){s.index>1&&(o+="..., ",u+="..., "),s.index>0&&(o+=t[s.index-1]+", ",u+=r[s.index-1]+", "),o+="-->",u+="-->";for(var i=s.index;i<s.index+4&&i<t.length;i++)o+=t[i]+", ",u+=r[i]+", ";i<t.length?(o+="...]",u+="...]"):(o+="]",u+="]"),a=a||"should be allclose at "+s.index}e._assert(s.result,{message:a||"should be allclose",operator:"allclose",actual:o,expected:u,extra:null})},module.exports=test;
},{"async":12,"floader":13}],11:[function(require,module,exports){
function WebGL(e){var t,n;if(e=e||{},"undefined"==typeof e.canvas?this.canvas=document.createElement("canvas"):this.canvas=e.canvas,t={premultipliedAlpha:!1,preserveDrawingBuffer:!1},this.context=this.canvas.getContext("experimental-webgl",t),"undefined"==typeof this.context)throw new Error("No support for Webgl.");try{n=this.context.getExtension("OES_texture_float")}catch(o){}n?this.hasFloat=!0:(console.log("No support for OES_texture_float extension."),this.hasFloat=!1);var r=this.context.getShaderPrecisionFormat(this.context.FRAGMENT_SHADER,this.context.HIGH_FLOAT);this.hasHighPrecision=0!=r.precision,this.hasHighPrecision&&(this.highp=r);var i="#define GLSLIFY 1\n// vertex shader for a single quad\n// work is performed in the operation specific texture shader\n\nprecision highp float;\n\nattribute vec3 pos;\nattribute vec2 tex;\nvarying vec2   outTex;\nvoid main(void)\n{\n	// just pass the position and texture coords\n	gl_Position = vec4(pos, 1.0);\n	outTex = tex;\n}\n";this.vertexShader=this.context.createShader(this.context.VERTEX_SHADER),this.context.shaderSource(this.vertexShader,i),this.context.compileShader(this.vertexShader);var a="#define GLSLIFY 1\nprecision highp float;\n\nvarying vec2      outTex;	// texture coords of row/column to calculate\nuniform sampler2D A;		// texture with data from padded A\nuniform int       N;		// number of columns in output\nuniform int       pad;		//\n\n// Render float to bytes according to IEEE 754 Floating Point\nvec4 encode_float_1540259130(float val) {\n\n	// TODO: correctly handle denormal numbers\n	// http://www.2ality.com/2012/04/number-encoding.html\n	float a = abs(val);                           // encode absolute value + sign\n	float exp = floor(log2(a));                 // number of powers of 2\n	float mant = pow(2.,log2(a)-exp) * pow(2.,23.);  // multiply to fill 24 bits (implied leading 1)\n	float mant1 = floor(mant / 256. / 256.);    // first 8 bits of mantissa\n	float mant2 = mod(floor(mant / 256.),256.); // second 8 bits\n	float mant3 = mod(mant,256.);               // third 8 bits\n\n	highp float sign = 128.-128.*(a/val);			// sign bit is 256 or 0\n	highp float e = (sign+exp+127.)/510.;		// exponent and sign\n	highp float m1 = (mant1-(128.*(1.-mod(exp+127.,2.))))/255.; // handle leading bit\n	highp float m2 = (mant2)/255.;				// middle part\n	highp float m3 = (mant3+.5)/255.;			// scale to 0 - 255\n\n	return vec4(m3,m2,m1,e);\n}\n\n// select an element from a vector based on index\nfloat select_index_1604150559(vec4 v, int index){\n	float val;\n	if (index == 0) {\n		val = v.r;\n	} else if(index == 1) {\n		val = v.g;\n	} else if(index == 2) {\n		val = v.b;\n	} else if(index == 3){\n		val = v.a;\n	} else {\n		// should never be here\n		val = 0.0;\n	}\n\n	return val;\n}\n\nvoid main(void) {\n\n	// get the implied row and column from .y and .x of passed (output)\n	// texture coordinate. These map directly to input texture space when\n	// the relevant dimensions are the same.\n	float row_t = outTex.y;\n	float col_t = outTex.x;\n\n	vec4 val_v = texture2D(A, vec2(col_t * float(N)/float(N + pad), row_t));\n	int channel = int(mod(col_t * float(N), 4.0 ));\n	float val = select_index_1604150559(val_v, channel);\n\n	if (val == 0.) {\n		gl_FragColor = vec4(0.,0.,0.,0.);\n		return;\n	}\n\n 	// output vec4 with bytes for an IEEE754 32-bit floating point number\n	gl_FragColor = encode_float_1540259130(val);\n}\n",l="#define GLSLIFY 1\nprecision highp float;\n\nvarying vec2      outTex;	// texture coords of row/column to calculate\nuniform sampler2D A;		// texture with data from padded A\nuniform int       M;		// number of rows in output\nuniform int       N;		// number of columns in output\nuniform int       mpad;		//\nuniform int       npad;		//\n\n// select an element from a vector based on index\nfloat select_index_1540259130(vec4 v, int index){\n	float val;\n	if (index == 0) {\n		val = v.r;\n	} else if(index == 1) {\n		val = v.g;\n	} else if(index == 2) {\n		val = v.b;\n	} else if(index == 3){\n		val = v.a;\n	} else {\n		// should never be here\n		val = 0.0;\n	}\n\n	return val;\n}\n\nvoid main(void) {\n\n	// get the implied row and column from .y and .x of passed (output)\n	// texture coordinate. These map directly to input texture space when\n	// the relevant dimensions are the same.\n	float row_t = outTex.y;\n	float col_t = outTex.x;\n	float col = (col_t * float(N + npad) - 2.0); // index of first element in pixel (matrix space)\n\n	// get rows in the input, each containing one element in the output\n	vec4 row_1 = texture2D(A, vec2((row_t * float(M))/float(M + mpad), (col + 0.5)/float(N)));\n	vec4 row_2 = texture2D(A, vec2((row_t * float(M))/float(M + mpad), (col + 1.5)/float(N)));\n	vec4 row_3 = texture2D(A, vec2((row_t * float(M))/float(M + mpad), (col + 2.5)/float(N)));\n	vec4 row_4 = texture2D(A, vec2((row_t * float(M))/float(M + mpad), (col + 3.5)/float(N)));\n\n	// package into output vector\n	int channel = int(mod(row_t * float(M), 4.0 ));\n\n	vec4 col_v = vec4(0.0, 0.0, 0.0, 0.0); // vec4 representing four elements in a column in the input\n\n	// extract relevent element from each input row\n	col_v.r = select_index_1540259130(row_1, channel);\n	if(npad > 0 && (col + 4.0) > float(N) ) {\n		// compute elements in padded region\n		if(npad < 3){\n			col_v.g = select_index_1540259130(row_2, channel);\n		}\n		if(npad < 2){\n			col_v.b = select_index_1540259130(row_3, channel);\n		}\n	} else {\n		col_v.g = select_index_1540259130(row_2, channel);\n		col_v.b = select_index_1540259130(row_3, channel);\n		col_v.a = select_index_1540259130(row_4, channel);\n	}\n\n	gl_FragColor = col_v;\n}\n",s="#define GLSLIFY 1\nprecision highp float;\n\nvarying vec2      outTex;	// texture coords of row/column to calculate\nuniform sampler2D A;		// texture with data from padded A\nuniform float     M;		// number of rows in output\nuniform float     N;		// number of columns in output\nuniform float     pad;		// column padding in output\nuniform float     M_in;		// number of rows in input\nuniform float     N_in;		// number of columns in input\nuniform float     pad_in;	// column padding in input\n\n/* number of input pixels\n   origin index (channel) for each\n   termination index (channel) for each\n   destination origin index (channel) for each\n */\n// select an element from a vector based on index\nfloat select_index_1604150559(vec4 v, int index){\n	float val;\n	if (index == 0) {\n		val = v.r;\n	} else if(index == 1) {\n		val = v.g;\n	} else if(index == 2) {\n		val = v.b;\n	} else if(index == 3){\n		val = v.a;\n	} else {\n		// should never be here\n		val = 0.0;\n	}\n\n	return val;\n}\n\n// set pad values to 0.0, if in padded region of output texture\nvoid fix_pad_1540259130(inout vec4 v, int pad){\n	v.a = 0.0;\n	if(pad == 2){\n		v.b = 0.0;\n	} else if(pad == 3){\n		v.b = 0.0;\n		v.g = 0.0;\n	}\n}\n\n// translate a linear index into x, y coordinates for a matrix\nvec2 linear_index_coords(float linear_index, float row_length){\n	vec2 coords;\n\n	coords.x = floor(mod(linear_index + 0.5, row_length)); // column\n	coords.y = floor((linear_index + 0.5) / row_length); // row\n\n	return coords;\n}\n\nvoid main(void) {\n\n	// get the implied row and column from .y and .x of passed (output)\n	// texture coordinate. These map directly to input texture space when\n	// the relevant dimensions are the same.\n	float row_t = outTex.y;\n	float col_t = outTex.x;\n\n	float row = floor(row_t * M);\n	float col_0 = (col_t * (N + pad) - 2.0); // index of first element in pixel (matrix space)\n	//float col_0 = floor(col_t * (N + pad)/4.0)*4.0; // index of first element in pixel (matrix space)\n	float lin_index_0 = row * N + col_0; // linearized index of first element in pixel in output\n\n	vec4 pixel_in = vec4(0.0, 0.0, 0.0, 0.0);\n	vec4 result = vec4(0.0, 0.0, 0.0, 0.0);\n	vec2 coords = linear_index_coords(lin_index_0, N_in);\n	vec2 ncoords;\n	int current_pixel_index = int(mod(coords.x, 4.0));\n\n	pixel_in = texture2D(A, vec2((coords.x + 0.5)/(N_in + pad_in), (coords.y + 0.5)/M_in));\n\n	// go through channels for current output pixel\n	for(int i = 0; i < 4; i++){\n\n		// are we on a new input pixel?\n		ncoords = linear_index_coords(lin_index_0 + float(i), N_in);\n		if(floor(coords.x/4.0) != floor(ncoords.x/4.0) || coords.y != ncoords.y){\n			coords = ncoords;\n			pixel_in = texture2D(A, vec2((coords.x + 0.5)/(N_in + pad_in), (coords.y + 0.5)/M_in));\n			current_pixel_index = 0;\n		}\n\n		if(i == 0){\n			result.r = select_index_1604150559(pixel_in, current_pixel_index);\n		} else if(i == 1){\n			result.g = select_index_1604150559(pixel_in, current_pixel_index);\n		} else if(i == 2){\n			result.b = select_index_1604150559(pixel_in, current_pixel_index);\n		} else {\n			result.a = select_index_1604150559(pixel_in, current_pixel_index);\n		}\n\n		current_pixel_index++;\n	}\n\n	// are we in the padded (output) region?\n	if(pad > 0.0 && col_0 + 3.5 > N ) {\n		fix_pad_1540259130(result, int(pad));\n	}\n\n	gl_FragColor = result;\n}\n";this.encode_program=this.createProgram(a),this.transpose_program=this.createProgram(l),this.reshape_program=this.createProgram(s)}module.exports=WebGL,WebGL.COMPONENTS_PER_TEXEL=4,WebGL.POSITION_UNIFORM_NAME="pos",WebGL.TEXTURE_UNIFORM_NAME="tex",WebGL.prototype.encode=function(e,t,n,o){this.program=this.encode_program,this.selectProgram(this.program);var r=this.getPad(t),i=this.context.getUniformLocation(this.program,"N"),a=this.context.getUniformLocation(this.program,"pad");this.context.uniform1i(i,t),this.context.uniform1i(a,r),this.bindInputTexture(n,this.context.TEXTURE0,"A"),this.bindOutputTexture(e,t,o),this.context.drawElements(this.context.TRIANGLES,6,this.context.UNSIGNED_SHORT,0),this.unbindInputTexture(this.context.TEXTURE0)},WebGL.prototype.transpose=function(e,t,n,o){this.program=this.transpose_program,this.selectProgram(this.program);var r=this.getPad(t),i=this.getPad(e),a=this.context.getUniformLocation(this.program,"N"),l=this.context.getUniformLocation(this.program,"npad"),s=this.context.getUniformLocation(this.program,"M"),c=this.context.getUniformLocation(this.program,"mpad");this.context.uniform1i(a,e),this.context.uniform1i(l,i),this.context.uniform1i(s,t),this.context.uniform1i(c,r),this.bindInputTexture(n,this.context.TEXTURE0,"A"),this.bindOutputTexture(t,(e+i)/4,o),this.context.drawElements(this.context.TRIANGLES,6,this.context.UNSIGNED_SHORT,0),this.unbindInputTexture(this.context.TEXTURE0)},WebGL.prototype.reshape=function(e,t,n,o,r,i){this.program=this.reshape_program,this.selectProgram(this.program);var a=this.getPad(t),l=this.getPad(o),s=this.context.getUniformLocation(this.program,"M"),c=this.context.getUniformLocation(this.program,"N"),f=this.context.getUniformLocation(this.program,"pad"),u=this.context.getUniformLocation(this.program,"M_in"),d=this.context.getUniformLocation(this.program,"N_in"),x=this.context.getUniformLocation(this.program,"pad_in");this.context.uniform1f(s,n),this.context.uniform1f(c,o),this.context.uniform1f(f,l),this.context.uniform1f(u,e),this.context.uniform1f(d,t),this.context.uniform1f(x,a),this.bindInputTexture(r,this.context.TEXTURE0,"A"),this.bindOutputTexture(n,(o+l)/4,i),this.context.drawElements(this.context.TRIANGLES,6,this.context.UNSIGNED_SHORT,0),this.unbindInputTexture(this.context.TEXTURE0)},WebGL.prototype.bindInputTexture=function(e,t,n){var o=this.context,r=this.program;o.activeTexture(t),o.bindTexture(o.TEXTURE_2D,e);var i=o.getUniformLocation(r,n);o.uniform1i(i,t-o.TEXTURE0)},WebGL.prototype.createProgram=function(e){var t,n=this.context;if(t=n.createShader(n.FRAGMENT_SHADER),n.shaderSource(t,e),n.compileShader(t),0==n.getShaderParameter(t,n.COMPILE_STATUS))throw new Error(n.getShaderInfoLog(t));var o=n.createProgram();return n.attachShader(o,this.vertexShader),n.attachShader(o,t),n.linkProgram(o),o},WebGL.prototype.selectProgram=function(e){var t=this.context;t.useProgram(e),this.bindVertices(e)},WebGL.prototype.bindVertices=function(e){var t=this.context,n=e,o=t.getAttribLocation(n,WebGL.POSITION_UNIFORM_NAME),r=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,r);var i=[-1,-1,0,1,-1,0,1,1,0,-1,1,0];t.bufferData(t.ARRAY_BUFFER,new Float32Array(i),t.STATIC_DRAW),t.vertexAttribPointer(o,3,t.FLOAT,!1,0,0),t.enableVertexAttribArray(o);var a=t.getAttribLocation(n,WebGL.TEXTURE_UNIFORM_NAME),l=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,l);var s=[0,0,1,0,1,1,0,1];t.bufferData(t.ARRAY_BUFFER,new Float32Array(s),t.STATIC_DRAW),t.vertexAttribPointer(a,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(a);var c=t.createBuffer();t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,c);var f=[0,1,2,0,2,3];t.bufferData(t.ELEMENT_ARRAY_BUFFER,new Uint16Array(f),t.STATIC_DRAW)},WebGL.prototype.createDataTexture=function(e,t,n){var o=this.context,r=[0,0,0,0],i=t%WebGL.COMPONENTS_PER_TEXEL,a=0==i?0:WebGL.COMPONENTS_PER_TEXEL-i,l=o.createTexture();if(o.bindTexture(o.TEXTURE_2D,l),0==a||null==n||"undefined"==typeof n)o.texImage2D(o.TEXTURE_2D,0,o.RGBA,(t+a)/WebGL.COMPONENTS_PER_TEXEL,e,0,o.RGBA,o.FLOAT,n);else{o.texImage2D(o.TEXTURE_2D,0,o.RGBA,(t+a)/WebGL.COMPONENTS_PER_TEXEL,e,0,o.RGBA,o.FLOAT,null);for(var s,c,f=t-i,u=f/WebGL.COMPONENTS_PER_TEXEL,d=0,x=new Float32Array(r),_=0;e>_;_++)d=_*t,full_texel_row_end=d+f,s=new Float32Array(n.buffer,d*n.BYTES_PER_ELEMENT,f),f>0&&o.texSubImage2D(o.TEXTURE_2D,0,0,_,u,1,o.RGBA,o.FLOAT,s),c=new Float32Array(n.buffer,full_texel_row_end*n.BYTES_PER_ELEMENT,i),x.set(c),o.texSubImage2D(o.TEXTURE_2D,0,u,_,1,1,o.RGBA,o.FLOAT,x)}return o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.NEAREST),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.NEAREST),o.bindTexture(o.TEXTURE_2D,null),l},WebGL.prototype.createOutputTexture=function(e,t){var n=this.context,o=this.getPad(t),r=n.createTexture();return n.bindTexture(n.TEXTURE_2D,r),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,t+o,e,0,n.RGBA,n.UNSIGNED_BYTE,null),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.NEAREST),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.NEAREST),n.bindTexture(n.TEXTURE_2D,null),r},WebGL.prototype.bindOutputTexture=function(e,t,n){var o=this.context;if(this.canvas.height=e,this.canvas.width=t,o.viewport(0,0,t,e),this.framebuffer=this.framebuffer||o.createFramebuffer(),o.bindFramebuffer(o.FRAMEBUFFER,this.framebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,n,0),o.checkFramebufferStatus(o.FRAMEBUFFER)!=o.FRAMEBUFFER_COMPLETE)throw new Error("Bound framebuffer is not complete.");return this.framebuffer},WebGL.prototype.unbindInputTexture=function(e){var t=this.context;t.activeTexture(e),t.bindTexture(t.TEXTURE_2D,null)},WebGL.prototype.readData=function(e,t){var n=this.context;return rawbuffer=new ArrayBuffer(e*t*Float32Array.BYTES_PER_ELEMENT),prod=new Uint8Array(rawbuffer),n.readPixels(0,0,t,e,n.RGBA,n.UNSIGNED_BYTE,prod),rawbuffer},WebGL.prototype.getPad=function(e){var t=e%WebGL.COMPONENTS_PER_TEXEL,n=0==t?0:WebGL.COMPONENTS_PER_TEXEL-t;return n};
},{}],12:[function(require,module,exports){
(function (process,global){
!function(){function n(){}function t(n){return n}function e(n){return!!n}function r(n){return!n}function u(n){return function(){if(null===n)throw new Error("Callback was already called.");n.apply(this,arguments),n=null}}function i(n){return function(){null!==n&&(n.apply(this,arguments),n=null)}}function o(n){return M(n)||"number"==typeof n.length&&n.length>=0&&n.length%1===0}function c(n,t){for(var e=-1,r=n.length;++e<r;)t(n[e],e,n)}function a(n,t){for(var e=-1,r=n.length,u=Array(r);++e<r;)u[e]=t(n[e],e,n);return u}function f(n){return a(Array(n),function(n,t){return t})}function l(n,t,e){return c(n,function(n,r,u){e=t(e,n,r,u)}),e}function s(n,t){c(W(n),function(e){t(n[e],e)})}function p(n,t){for(var e=0;e<n.length;e++)if(n[e]===t)return e;return-1}function h(n){var t,e,r=-1;return o(n)?(t=n.length,function(){return r++,t>r?r:null}):(e=W(n),t=e.length,function(){return r++,t>r?e[r]:null})}function m(n,t){return t=null==t?n.length-1:+t,function(){for(var e=Math.max(arguments.length-t,0),r=Array(e),u=0;e>u;u++)r[u]=arguments[u+t];switch(t){case 0:return n.call(this,r);case 1:return n.call(this,arguments[0],r)}}}function y(n){return function(t,e,r){return n(t,r)}}function v(t){return function(e,r,o){o=i(o||n),e=e||[];var c=h(e);if(0>=t)return o(null);var a=!1,f=0,l=!1;!function s(){if(a&&0>=f)return o(null);for(;t>f&&!l;){var n=c();if(null===n)return a=!0,void(0>=f&&o(null));f+=1,r(e[n],n,u(function(n){f-=1,n?(o(n),l=!0):s()}))}}()}}function d(n){return function(t,e,r){return n(C.eachOf,t,e,r)}}function g(n){return function(t,e,r,u){return n(v(e),t,r,u)}}function k(n){return function(t,e,r){return n(C.eachOfSeries,t,e,r)}}function b(t,e,r,u){u=i(u||n),e=e||[];var c=o(e)?[]:{};t(e,function(n,t,e){r(n,function(n,r){c[t]=r,e(n)})},function(n){u(n,c)})}function w(n,t,e,r){var u=[];n(t,function(n,t,r){e(n,function(e){e&&u.push({index:t,value:n}),r()})},function(){r(a(u.sort(function(n,t){return n.index-t.index}),function(n){return n.value}))})}function O(n,t,e,r){w(n,t,function(n,t){e(n,function(n){t(!n)})},r)}function S(n,t,e){return function(r,u,i,o){function c(){o&&o(e(!1,void 0))}function a(n,r,u){return o?void i(n,function(r){o&&t(r)&&(o(e(!0,n)),o=i=!1),u()}):u()}arguments.length>3?n(r,u,a,c):(o=i,i=u,n(r,a,c))}}function E(n,t){return t}function L(t,e,r){r=r||n;var u=o(e)?[]:{};t(e,function(n,t,e){n(m(function(n,r){r.length<=1&&(r=r[0]),u[t]=r,e(n)}))},function(n){r(n,u)})}function I(n,t,e,r){var u=[];n(t,function(n,t,r){e(n,function(n,t){u=u.concat(t||[]),r(n)})},function(n){r(n,u)})}function x(t,e,r){function i(t,e,r,u){if(null!=u&&"function"!=typeof u)throw new Error("task callback must be a function");return t.started=!0,M(e)||(e=[e]),0===e.length&&t.idle()?C.setImmediate(function(){t.drain()}):(c(e,function(e){var i={data:e,callback:u||n};r?t.tasks.unshift(i):t.tasks.push(i),t.tasks.length===t.concurrency&&t.saturated()}),void C.setImmediate(t.process))}function o(n,t){return function(){f-=1;var e=!1,r=arguments;c(t,function(n){c(l,function(t,r){t!==n||e||(l.splice(r,1),e=!0)}),n.callback.apply(n,r)}),n.tasks.length+f===0&&n.drain(),n.process()}}if(null==e)e=1;else if(0===e)throw new Error("Concurrency must not be zero");var f=0,l=[],s={tasks:[],concurrency:e,payload:r,saturated:n,empty:n,drain:n,started:!1,paused:!1,push:function(n,t){i(s,n,!1,t)},kill:function(){s.drain=n,s.tasks=[]},unshift:function(n,t){i(s,n,!0,t)},process:function(){if(!s.paused&&f<s.concurrency&&s.tasks.length)for(;f<s.concurrency&&s.tasks.length;){var n=s.payload?s.tasks.splice(0,s.payload):s.tasks.splice(0,s.tasks.length),e=a(n,function(n){return n.data});0===s.tasks.length&&s.empty(),f+=1,l.push(n[0]);var r=u(o(s,n));t(e,r)}},length:function(){return s.tasks.length},running:function(){return f},workersList:function(){return l},idle:function(){return s.tasks.length+f===0},pause:function(){s.paused=!0},resume:function(){if(s.paused!==!1){s.paused=!1;for(var n=Math.min(s.concurrency,s.tasks.length),t=1;n>=t;t++)C.setImmediate(s.process)}}};return s}function j(n){return m(function(t,e){t.apply(null,e.concat([m(function(t,e){"object"==typeof console&&(t?console.error&&console.error(t):console[n]&&c(e,function(t){console[n](t)}))})]))})}function A(n){return function(t,e,r){n(f(t),e,r)}}function T(n){return m(function(t,e){var r=m(function(e){var r=this,u=e.pop();return n(t,function(n,t,u){n.apply(r,e.concat([u]))},u)});return e.length?r.apply(this,e):r})}function z(n){return m(function(t){var e=t.pop();t.push(function(){var n=arguments;r?C.setImmediate(function(){e.apply(null,n)}):e.apply(null,n)});var r=!0;n.apply(this,t),r=!1})}var q,C={},P="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||this;null!=P&&(q=P.async),C.noConflict=function(){return P.async=q,C};var H=Object.prototype.toString,M=Array.isArray||function(n){return"[object Array]"===H.call(n)},U=function(n){var t=typeof n;return"function"===t||"object"===t&&!!n},W=Object.keys||function(n){var t=[];for(var e in n)n.hasOwnProperty(e)&&t.push(e);return t},B="function"==typeof setImmediate&&setImmediate,D=B?function(n){B(n)}:function(n){setTimeout(n,0)};"object"==typeof process&&"function"==typeof process.nextTick?C.nextTick=process.nextTick:C.nextTick=D,C.setImmediate=B?D:C.nextTick,C.forEach=C.each=function(n,t,e){return C.eachOf(n,y(t),e)},C.forEachSeries=C.eachSeries=function(n,t,e){return C.eachOfSeries(n,y(t),e)},C.forEachLimit=C.eachLimit=function(n,t,e,r){return v(t)(n,y(e),r)},C.forEachOf=C.eachOf=function(t,e,r){function o(n){f--,n?r(n):null===c&&0>=f&&r(null)}r=i(r||n),t=t||[];for(var c,a=h(t),f=0;null!=(c=a());)f+=1,e(t[c],c,u(o));0===f&&r(null)},C.forEachOfSeries=C.eachOfSeries=function(t,e,r){function o(){var n=!0;return null===a?r(null):(e(t[a],a,u(function(t){if(t)r(t);else{if(a=c(),null===a)return r(null);n?C.setImmediate(o):o()}})),void(n=!1))}r=i(r||n),t=t||[];var c=h(t),a=c();o()},C.forEachOfLimit=C.eachOfLimit=function(n,t,e,r){v(t)(n,e,r)},C.map=d(b),C.mapSeries=k(b),C.mapLimit=g(b),C.inject=C.foldl=C.reduce=function(n,t,e,r){C.eachOfSeries(n,function(n,r,u){e(t,n,function(n,e){t=e,u(n)})},function(n){r(n,t)})},C.foldr=C.reduceRight=function(n,e,r,u){var i=a(n,t).reverse();C.reduce(i,e,r,u)},C.transform=function(n,t,e,r){3===arguments.length&&(r=e,e=t,t=M(n)?[]:{}),C.eachOf(n,function(n,r,u){e(t,n,r,u)},function(n){r(n,t)})},C.select=C.filter=d(w),C.selectLimit=C.filterLimit=g(w),C.selectSeries=C.filterSeries=k(w),C.reject=d(O),C.rejectLimit=g(O),C.rejectSeries=k(O),C.any=C.some=S(C.eachOf,e,t),C.someLimit=S(C.eachOfLimit,e,t),C.all=C.every=S(C.eachOf,r,r),C.everyLimit=S(C.eachOfLimit,r,r),C.detect=S(C.eachOf,t,E),C.detectSeries=S(C.eachOfSeries,t,E),C.detectLimit=S(C.eachOfLimit,t,E),C.sortBy=function(n,t,e){function r(n,t){var e=n.criteria,r=t.criteria;return r>e?-1:e>r?1:0}C.map(n,function(n,e){t(n,function(t,r){t?e(t):e(null,{value:n,criteria:r})})},function(n,t){return n?e(n):void e(null,a(t.sort(r),function(n){return n.value}))})},C.auto=function(t,e,r){function u(n){d.unshift(n)}function o(n){var t=p(d,n);t>=0&&d.splice(t,1)}function a(){h--,c(d.slice(0),function(n){n()})}r||(r=e,e=null),r=i(r||n);var f=W(t),h=f.length;if(!h)return r(null);e||(e=h);var y={},v=0,d=[];u(function(){h||r(null,y)}),c(f,function(n){function i(){return e>v&&l(g,function(n,t){return n&&y.hasOwnProperty(t)},!0)&&!y.hasOwnProperty(n)}function c(){i()&&(v++,o(c),h[h.length-1](d,y))}for(var f,h=M(t[n])?t[n]:[t[n]],d=m(function(t,e){if(v--,e.length<=1&&(e=e[0]),t){var u={};s(y,function(n,t){u[t]=n}),u[n]=e,r(t,u)}else y[n]=e,C.setImmediate(a)}),g=h.slice(0,h.length-1),k=g.length;k--;){if(!(f=t[g[k]]))throw new Error("Has inexistant dependency");if(M(f)&&p(f,n)>=0)throw new Error("Has cyclic dependencies")}i()?(v++,h[h.length-1](d,y)):u(c)})},C.retry=function(n,t,e){function r(n,t){if("number"==typeof t)n.times=parseInt(t,10)||i;else{if("object"!=typeof t)throw new Error("Unsupported argument type for 'times': "+typeof t);n.times=parseInt(t.times,10)||i,n.interval=parseInt(t.interval,10)||o}}function u(n,t){function e(n,e){return function(r){n(function(n,t){r(!n||e,{err:n,result:t})},t)}}function r(n){return function(t){setTimeout(function(){t(null)},n)}}for(;a.times;){var u=!(a.times-=1);c.push(e(a.task,u)),!u&&a.interval>0&&c.push(r(a.interval))}C.series(c,function(t,e){e=e[e.length-1],(n||a.callback)(e.err,e.result)})}var i=5,o=0,c=[],a={times:i,interval:o},f=arguments.length;if(1>f||f>3)throw new Error("Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)");return 2>=f&&"function"==typeof n&&(e=t,t=n),"function"!=typeof n&&r(a,n),a.callback=e,a.task=t,a.callback?u():u},C.waterfall=function(t,e){function r(n){return m(function(t,u){if(t)e.apply(null,[t].concat(u));else{var i=n.next();i?u.push(r(i)):u.push(e),z(n).apply(null,u)}})}if(e=i(e||n),!M(t)){var u=new Error("First argument to waterfall must be an array of functions");return e(u)}return t.length?void r(C.iterator(t))():e()},C.parallel=function(n,t){L(C.eachOf,n,t)},C.parallelLimit=function(n,t,e){L(v(t),n,e)},C.series=function(n,t){L(C.eachOfSeries,n,t)},C.iterator=function(n){function t(e){function r(){return n.length&&n[e].apply(null,arguments),r.next()}return r.next=function(){return e<n.length-1?t(e+1):null},r}return t(0)},C.apply=m(function(n,t){return m(function(e){return n.apply(null,t.concat(e))})}),C.concat=d(I),C.concatSeries=k(I),C.whilst=function(t,e,r){if(r=r||n,t()){var u=m(function(n,i){n?r(n):t.apply(this,i)?e(u):r(null)});e(u)}else r(null)},C.doWhilst=function(n,t,e){var r=0;return C.whilst(function(){return++r<=1||t.apply(this,arguments)},n,e)},C.until=function(n,t,e){return C.whilst(function(){return!n.apply(this,arguments)},t,e)},C.doUntil=function(n,t,e){return C.doWhilst(n,function(){return!t.apply(this,arguments)},e)},C.during=function(t,e,r){r=r||n;var u=m(function(n,e){n?r(n):(e.push(i),t.apply(this,e))}),i=function(n,t){n?r(n):t?e(u):r(null)};t(i)},C.doDuring=function(n,t,e){var r=0;C.during(function(n){r++<1?n(null,!0):t.apply(this,arguments)},n,e)},C.queue=function(n,t){var e=x(function(t,e){n(t[0],e)},t,1);return e},C.priorityQueue=function(t,e){function r(n,t){return n.priority-t.priority}function u(n,t,e){for(var r=-1,u=n.length-1;u>r;){var i=r+(u-r+1>>>1);e(t,n[i])>=0?r=i:u=i-1}return r}function i(t,e,i,o){if(null!=o&&"function"!=typeof o)throw new Error("task callback must be a function");return t.started=!0,M(e)||(e=[e]),0===e.length?C.setImmediate(function(){t.drain()}):void c(e,function(e){var c={data:e,priority:i,callback:"function"==typeof o?o:n};t.tasks.splice(u(t.tasks,c,r)+1,0,c),t.tasks.length===t.concurrency&&t.saturated(),C.setImmediate(t.process)})}var o=C.queue(t,e);return o.push=function(n,t,e){i(o,n,t,e)},delete o.unshift,o},C.cargo=function(n,t){return x(n,1,t)},C.log=j("log"),C.dir=j("dir"),C.memoize=function(n,e){var r={},u={};e=e||t;var i=m(function(t){var i=t.pop(),o=e.apply(null,t);o in r?C.setImmediate(function(){i.apply(null,r[o])}):o in u?u[o].push(i):(u[o]=[i],n.apply(null,t.concat([m(function(n){r[o]=n;var t=u[o];delete u[o];for(var e=0,i=t.length;i>e;e++)t[e].apply(null,n)})])))});return i.memo=r,i.unmemoized=n,i},C.unmemoize=function(n){return function(){return(n.unmemoized||n).apply(null,arguments)}},C.times=A(C.map),C.timesSeries=A(C.mapSeries),C.timesLimit=function(n,t,e,r){return C.mapLimit(f(n),t,e,r)},C.seq=function(){var t=arguments;return m(function(e){var r=this,u=e[e.length-1];"function"==typeof u?e.pop():u=n,C.reduce(t,e,function(n,t,e){t.apply(r,n.concat([m(function(n,t){e(n,t)})]))},function(n,t){u.apply(r,[n].concat(t))})})},C.compose=function(){return C.seq.apply(null,Array.prototype.reverse.call(arguments))},C.applyEach=T(C.eachOf),C.applyEachSeries=T(C.eachOfSeries),C.forever=function(t,e){function r(n){return n?i(n):void o(r)}var i=u(e||n),o=z(t);r()},C.ensureAsync=z,C.constant=m(function(n){var t=[null].concat(n);return function(n){return n.apply(this,t)}}),C.wrapSync=C.asyncify=function(n){return m(function(t){var e,r=t.pop();try{e=n.apply(this,t)}catch(u){return r(u)}U(e)&&"function"==typeof e.then?e.then(function(n){r(null,n)})["catch"](function(n){r(n.message?n:new Error(n))}):r(null,e)})},"object"==typeof module&&module.exports?module.exports=C:"function"==typeof define&&define.amd?define([],function(){return C}):P.async=C}();
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})

},{"_process":14}],13:[function(require,module,exports){
exports.load=function(e,t){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState)if(n.status>=200&&n.status<300)t(null,n.responseText);else{var r=new Error("failed to request file '"+e+"'");r.errno=34,t(r)}};try{n.open("GET",e,!0),n.send(null)}catch(r){t(r)}};
},{}],14:[function(require,module,exports){
function cleanUpNextTick(){draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue()}function drainQueue(){if(!draining){var e=setTimeout(cleanUpNextTick);draining=!0;for(var n=queue.length;n;){for(currentQueue=queue,queue=[];++queueIndex<n;)currentQueue&&currentQueue[queueIndex].run();queueIndex=-1,n=queue.length}currentQueue=null,draining=!1,clearTimeout(e)}}function Item(e,n){this.fun=e,this.array=n}function noop(){}var process=module.exports={},queue=[],draining=!1,currentQueue,queueIndex=-1;process.nextTick=function(e){var n=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)n[r-1]=arguments[r];queue.push(new Item(e,n)),1!==queue.length||draining||setTimeout(drainQueue,0)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.binding=function(e){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(e){throw new Error("process.chdir is not supported")},process.umask=function(){return 0};
},{}]},{},[1])(1)
});



//# sourceURL=build://vz-projector/heap.js
var yi;
(function(e){class r{constructor(){this.arr=[]}push(n,p){this.arr.push({key:n,value:p});this.bubbleUp(this.arr.length-1)}pop(){if(0===this.arr.length)throw Error("pop() called on empty binary heap");let n=this.arr[0],p=this.arr.length-1;this.arr[0]=this.arr[p];this.arr.pop();0<p&&this.bubbleDown(0);return n}peek(){return this.arr[0]}popPush(n,p){if(0===this.arr.length)throw Error("pop() called on empty binary heap");this.arr[0]={key:n,value:p};0<this.arr.length&&this.bubbleDown(0)}size(){return this.arr.length}items(){return this.arr}swap(n,p){let v=
this.arr[n];this.arr[n]=this.arr[p];this.arr[p]=v}bubbleDown(n){let p=(n<<1)+1,v=p+1,z=n;p<this.arr.length&&this.arr[p].key<this.arr[z].key&&(z=p);v<this.arr.length&&this.arr[v].key<this.arr[z].key&&(z=v);z!==n&&(this.swap(z,n),this.bubbleDown(z))}bubbleUp(n){if(!(0>=n)){var p=n-1>>1;this.arr[n].key<this.arr[p].key&&(this.swap(n,p),this.bubbleUp(p))}}}e.MinHeap=r;class k{constructor(n){this.maxHeap=new r;this.k=n}add(n,p){this.maxHeap.size()<this.k?this.maxHeap.push(-n,p):n<-this.maxHeap.peek().key&&
this.maxHeap.popPush(-n,p)}getMinKItems(){let n=this.maxHeap.items();n.sort((p,v)=>v.key-p.key);return n.map(p=>p.value)}getSize(){return this.maxHeap.size()}getLargestKey(){return 0===this.maxHeap.size()?null:-this.maxHeap.peek().key}}e.KMin=k})(yi||(yi={}));

//# sourceURL=build://vz-projector/label.js
(function(e){class r{constructor(k,n,p){this.bound=k;this.cellWidth=n;this.cellHeight=p;this.numHorizCells=Math.ceil(this.boundWidth(k)/n);this.numVertCells=Math.ceil(this.boundHeight(k)/p);this.grid=Array(this.numHorizCells*this.numVertCells)}boundWidth(k){return k.hiX-k.loX}boundHeight(k){return k.hiY-k.loY}boundsIntersect(k,n){return!(k.loX>n.hiX||k.loY>n.hiY||k.hiX<n.loX||k.hiY<n.loY)}insert(k,n=!1){if(k.hiX<this.bound.loX||k.loX>this.bound.hiX||k.hiY<this.bound.loY||k.loY>this.bound.hiY)return!1;
let p=this.getCellX(k.loX),v=this.getCellX(k.hiX);var z=this.getCellY(k.loY);let E=this.getCellY(k.hiY),t=z*this.numHorizCells+p,x=t;for(let A=z;A<=E;A++){for(let F=p;F<=v;F++){let N=this.grid[x++];if(N)for(let I=0;I<N.length;I++)if(this.boundsIntersect(k,N[I]))return!1}x+=this.numHorizCells-(v-p+1)}if(n)return!0;x=t;for(n=z;n<=E;n++){for(z=p;z<=v;z++)this.grid[x]?this.grid[x].push(k):this.grid[x]=[k],x++;x+=this.numHorizCells-(v-p+1)}return!0}getCellX(k){return Math.floor((k-this.bound.loX)/this.cellWidth)}getCellY(k){return Math.floor((k-
this.bound.loY)/this.cellHeight)}}e.CollisionGrid=r})(yi||(yi={}));

//# sourceURL=build://vz-projector/sptree.js
(function(e){function r(n,p){for(let v=0;v<n.length;++v)n[v]=p}class k{constructor(n){if(1>n.length)throw Error("There should be at least 1 data point");this.dim=n[0].length;this.masks=Array(Math.pow(2,this.dim));for(var p=0;p<this.masks.length;++p)this.masks[p]=1<<p;p=Array(this.dim);r(p,Number.POSITIVE_INFINITY);let v=Array(this.dim);r(v,Number.NEGATIVE_INFINITY);for(var z=0;z<n.length;++z)for(var E=0;E<this.dim;++E)p[E]=Math.min(p[E],n[z][E]),v[E]=Math.max(v[E],n[z][E]);z=Array(this.dim);E=0;for(let t=
0;t<this.dim;++t){let x=v[t]-p[t];z[t]=p[t]+x/2;E=Math.max(E,x/2)}this.root={box:{center:z,halfDim:E},point:n[0]};for(p=1;p<n.length;++p)this.insert(this.root,n[p])}visit(n,p=!1){this.visitNode(this.root,n,p)}visitNode(n,p,v){if(v)var z=p(n);else{z=Array(this.dim);var E=Array(this.dim);for(let t=0;t<this.dim;++t)z[t]=n.box.center[t]-n.box.halfDim,E[t]=n.box.center[t]+n.box.halfDim;z=p(n,z,E)}if(n.children&&!z)for(z=0;z<n.children.length;++z)(E=n.children[z])&&this.visitNode(E,p,v)}insert(n,p){null==
n.children&&(n.children=Array(this.masks.length));let v=0;for(let z=0;z<this.dim;++z)p[z]>n.box.center[z]&&(v|=this.masks[z]);null==n.children[v]?this.makeChild(n,v,p):this.insert(n.children[v],p)}makeChild(n,p,v){let z=n.box.center,E=n.box.halfDim/2,t=Array(this.dim);for(let x=0;x<this.dim;++x)t[x]=p&1<<x?z[x]+E:z[x]-E;n.children[p]={box:{center:t,halfDim:E},point:v}}}e.SPTree=k})(yi||(yi={}));

//# sourceURL=build://vz-projector/bh_tsne.js
(function(e){function r(G,P){let U=G[0]-P[0];G=G[1]-P[1];return U*U+G*G}function k(G,P){let U=G[0]-P[0],ba=G[1]-P[1];G=G[2]-P[2];return U*U+ba*ba+G*G}function n(G){if(N)return N=!1,I;let P=2*G()-1,U=2*G()-1,ba=P*P+U*U;if(0===ba||1<ba)return n(G);G=Math.sqrt(-2*Math.log(ba)/ba);I=U*G;N=!0;return P*G}function p(G,P,U){return P+n(G)*U}function v(G){return new Float64Array(G)}function z(G,P,U){G*=P;P=v(G);for(let ba=0;ba<G;++ba)P[ba]=p(U,0,1E-4);return P}function E(G,P,U){let ba=[];for(let ja=0;ja<G;++ja)ba.push(3===
P?[U,U,U]:[U,U]);return ba}function t(G,P,U){let ba=G.length;var ja=Math.log(P);P=v(ba*ba);var ca=Array(G[0].length);for(var ya=0;ya<ba;++ya){var Na=G[ya],$a=-Infinity;let gb=Infinity,Ea=1,Eb=0;for(;;){let nb=0;for(var mb=0;mb<Na.length;++mb){var xa=Na[mb];xa=ya===xa.index?0:Math.exp(-xa.dist*Ea);xa=Math.max(xa,1E-9);ca[mb]=xa;nb+=xa}mb=0;for(xa=0;xa<ca.length;++xa){ca[xa]/=nb;let Mb=ca[xa];1E-7<Mb&&(mb-=Mb*Math.log(Mb))}mb>ja?($a=Ea,Ea=Infinity===gb?2*Ea:(Ea+gb)/2):(gb=Ea,Ea=-Infinity===$a?Ea/2:
(Ea+$a)/2);Eb++;if(50<=Eb||Math.abs(mb-ja)<U)break}for($a=0;$a<ca.length;++$a)P[ya*ba+Na[$a].index]=ca[$a]}G=2*ba;for(U=0;U<ba;++U)for(ja=U+1;ja<ba;++ja)ca=U*ba+ja,ya=ja*ba+U,Na=(P[ca]+P[ya])/G,P[ca]=Na,P[ya]=Na;return P}function x(G){return 0<G?1:0>G?-1:0}function A(G,P,U,ba){G[0]+=P*(U[0]-ba[0]);G[1]+=P*(U[1]-ba[1])}function F(G,P,U,ba){G[0]+=P*(U[0]-ba[0]);G[1]+=P*(U[1]-ba[1]);G[2]+=P*(U[2]-ba[2])}let N=!1,I=0;e.dist2=function(G,P){if(G.length!==P.length)throw Error("Vectors a and b must be of same length");
let U=0;for(let ba=0;ba<G.length;++ba){let ja=G[ba]-P[ba];U+=ja*ja}return U};e.dist2_2D=r;e.dist2_3D=k;class aa{constructor(G){this.iter=0;G=G||{dim:2};this.perplexity=G.perplexity||30;this.epsilon=G.epsilon||10;this.rng=G.rng||Math.random;this.dim=G.dim;if(2===G.dim)this.dist2=r,this.computeForce=A;else if(3===G.dim)this.dist2=k,this.computeForce=F;else throw Error("Only 2D and 3D is supported");}initDataDist(G){let P=G.length;this.nearest=G;this.P=t(G,this.perplexity,1E-4);this.N=P;this.initSolution()}initSolution(){this.Y=
z(this.N,this.dim,this.rng);this.gains=E(this.N,this.dim,1);this.ystep=E(this.N,this.dim,0);this.iter=0}getDim(){return this.dim}getSolution(){return this.Y}perturb(){let G=this.N;var P=0;let U=3===this.dim?[0,0,0]:[0,0];for(var ba=0;ba<G;++ba){var ja=0;for(var ca=0;ca<this.dim;++ca)ja+=Math.pow(this.Y[ba*this.dim+ca],2);ja>P&&(P=ja)}ba=Math.pow(P,.5);for(ja=0;ja<G;++ja){for(ca=Array(this.dim);;){var ya=0;for(let Na=0;Na<this.dim;++Na)ca[Na]=.1*ba*(Math.random()-.5),ya+=Math.pow(this.Y[ja*this.dim+
Na]+ca[Na],2);if(ya<P)break}for(ya=0;ya<this.dim;++ya)this.Y[ja*this.dim+ya]+=ca[ya],U[ya]+=this.Y[ja*this.dim+ya]}for(P=0;P<G;++P)for(ba=0;ba<this.dim;++ba)this.Y[P*this.dim+ba]-=U[ba]/G}step(){this.iter+=1;let G=this.N;var P=this.costGrad(this.Y);let U=3===this.dim?[0,0,0]:[0,0];for(var ba=0;ba<G;++ba)for(let ya=0;ya<this.dim;++ya){var ja=this.ystep[ba][ya],ca=this.gains[ba][ya];ca=x(P[ba][ya])===x(ja)?.8*ca:ca+.2;.01>ca&&(ca=.01);this.gains[ba][ya]=ca;ja=(250>this.iter?.5:.8)*ja-this.epsilon*ca*
P[ba][ya];this.ystep[ba][ya]=ja;ca=ba*this.dim+ya;this.Y[ca]+=ja;U[ya]+=this.Y[ca]}for(P=0;P<G;++P)for(ba=0;ba<this.dim;++ba)this.Y[P*this.dim+ba]-=U[ba]/G}setSupervision(G,P){null!=G&&(this.labels=G,this.labelCounts={},Array.from(new Set(G)).forEach(U=>this.labelCounts[U]=0),G.forEach(U=>this.labelCounts[U]+=1));null!=P&&(this.unlabeledClass=P)}setSuperviseFactor(G){null!=G&&(this.superviseFactor=G)}costGrad(G){let P=this.N;var U=this.P,ba=100>this.iter?4:1,ja=this.superviseFactor/100,ca=this.unlabeledClass;
let ya=this.labels,Na=this.labelCounts;var $a=null!=ja&&0<ja&&null!=ya&&null!=Na;let mb=$a&&null!=ca&&""!==ca?Na[ca]:0,xa=Array(P);for(var gb=0;gb<P;++gb){var Ea=gb*this.dim,Eb=Array(this.dim);for(var nb=0;nb<this.dim;++nb)Eb[nb]=G[Ea+nb];xa[gb]=Eb}Eb=new e.SPTree(xa);let Mb=ia=>{let ub=1;if(null==ia.children)return ia.numCells=ub,ia.yCell=ia.point,{numCells:ub,yCell:ia.yCell};let S=ia.point.slice();for(let la=0;la<ia.children.length;++la){var Qb=ia.children[la];if(null!=Qb){Qb=Mb(Qb);ub+=Qb.numCells;
for(let Oa=0;Oa<this.dim;++Oa)S[Oa]+=Qb.yCell[Oa]}}ia.numCells=ub;ia.yCell=S.map(la=>la/ub);return{numCells:ub,yCell:S}};Mb(Eb.root);Eb.visit((ia,ub,S)=>{ia.rCell=S[0]-ub[0];return!1});G=[];let gc=0;Ea=0;gb=Array(P);for(nb=0;nb<P;++nb){let ia=xa[nb];if($a)var $b=Na[ya[nb]],Bc=P-$b-mb;let ub=3===this.dim?[0,0,0]:[0,0],S=this.nearest[nb];for(let la=0;la<S.length;++la){var Cb=S[la].index;let Oa=U[nb*P+Cb];$a&&(ya[nb]===ca||ya[Cb]===ca?Oa*=1/P:ya[nb]!==ya[Cb]?Oa*=Math.max(1/P-ja/Bc,1E-7):ya[nb]===ya[Cb]&&
(Oa*=Math.min(1/P+ja/$b,.9999999)),Ea+=Oa);Cb=xa[Cb];let Ra=this.dist2(ia,Cb);this.computeForce(ub,Oa/(1+Ra),ia,Cb)}let Qb=3===this.dim?[0,0,0]:[0,0];Eb.visit(la=>{var Oa=this.dist2(ia,la.yCell);if(null==la.children||0<Oa&&.8>la.rCell/Math.sqrt(Oa)){Oa=1/(1+Oa);let Ra=la.numCells*Oa;gc+=Ra;Ra*=Oa;this.computeForce(Qb,Ra,ia,la.yCell);return!0}Oa=1/(1+this.dist2(ia,la.point));gc+=Oa;this.computeForce(Qb,Oa*Oa,ia,la.point);return!1},!0);gb[nb]=[ub,Qb]}U=4*ba;$a&&(U/=Ea);$a=4/gc;for(ba=0;ba<P;++ba){let [ia,
ub]=gb[ba];ja=Array(this.dim);for(ca=0;ca<this.dim;++ca)ja[ca]=U*ia[ca]-$a*ub[ca];G.push(ja)}return G}}e.TSNE=aa})(yi||(yi={}));

//# sourceURL=build://vz-projector/logging.js
(function(e){(function(r){function k(z,E=null,t=null,x=!1){if(null==n)console.warn("Can't show modal message before the dom is initialized");else{null==E&&(E=(p++).toString());var A=n.shadowRoot.querySelector("#notification-dialog");A.querySelector(".close-button").style.display=x?null:"none";var F=A.querySelector(".progress");F.style.display=x?"none":null;F.active=x?null:!0;A.querySelector("#notification-title").innerHTML=t;t=A.querySelector("#notify-msgs");if(x)t.innerHTML="";else{F=t.querySelectorAll(".error");
for(var N=0;N<F.length;N++)t.removeChild(F[N])}F=`notify-msg-${E}`;N=A.querySelector("#"+F);null==N&&(N=document.createElement("div"),N.className="notify-msg "+(x?"error":""),N.id=F,t.insertBefore(N,t.firstChild),x?v=0:v++);null==z?(v--,0===v&&A.close(),N.remove()):(N.innerText=z,A.open());return E}}let n=null,p=0,v=0;r.setDomContainer=function(z){n=z};r.setModalMessage=k;r.setErrorMessage=function(z,E){k(z,null,"Error "+(null!=E?E:""),!0)};r.setWarningMessage=function(z){let E=n.shadowRoot.querySelector("#toast");
E.text=z;E.duration=1E4;E.open()}})(e.logging||(e.logging={}))})(yi||(yi={}));

//# sourceURL=build://vz-projector/renderContext.js
(function(e){class r{constructor(n,p,v,z,E,t,x){this.pointIndices=n;this.labelStrings=p;this.scaleFactors=v;this.useSceneOpacityFlags=z;this.defaultFontSize=E;this.fillColors=t;this.strokeColors=x}}e.LabelRenderParams=r;(function(n){n[n.Perspective=0]="Perspective";n[n.Orthographic=1]="Orthographic"})(e.CameraType||(e.CameraType={}));class k{constructor(n,p,v,z,E,t,x,A,F,N,I,aa,G,P){this.camera=n;this.cameraType=p;this.cameraTarget=v;this.screenWidth=z;this.screenHeight=E;this.nearestCameraSpacePointZ=
t;this.farthestCameraSpacePointZ=x;this.backgroundColor=A;this.pointColors=F;this.pointScaleFactors=N;this.labels=I;this.polylineColors=aa;this.polylineOpacities=G;this.polylineWidths=P}}e.RenderContext=k})(yi||(yi={}));

//# sourceURL=build://vz-projector/scatterPlotRectangleSelector.js
(function(e){class r{constructor(k,n){this.svgElement=k.querySelector("#selector");this.rectElement=document.createElementNS("http://www.w3.org/2000/svg","rect");this.rectElement.style.stroke="#aaaaaa";this.rectElement.style.strokeDasharray="10 5";this.rectElement.style.strokeWidth="2";this.rectElement.style.fill="#dddddd";this.rectElement.style.fillOpacity="0.2";this.svgElement.appendChild(this.rectElement);this.selectionCallback=n;this.isMouseDown=!1}onMouseDown(k,n){this.isMouseDown=!0;this.svgElement.style.display=
"block";this.startCoordinates=[k,n];this.lastBoundingBox={x:this.startCoordinates[0],y:this.startCoordinates[1],width:1,height:1}}onMouseMove(k,n){this.isMouseDown&&(this.lastBoundingBox.x=Math.min(k,this.startCoordinates[0]),this.lastBoundingBox.y=Math.max(n,this.startCoordinates[1]),this.lastBoundingBox.width=Math.max(k,this.startCoordinates[0])-this.lastBoundingBox.x,this.lastBoundingBox.height=this.lastBoundingBox.y-Math.min(n,this.startCoordinates[1]),this.rectElement.setAttribute("x",""+this.lastBoundingBox.x),
this.rectElement.setAttribute("y",""+(this.lastBoundingBox.y-this.lastBoundingBox.height)),this.rectElement.setAttribute("width",""+this.lastBoundingBox.width),this.rectElement.setAttribute("height",""+this.lastBoundingBox.height))}onMouseUp(){this.isMouseDown=!1;this.svgElement.style.display="none";this.rectElement.setAttribute("width","0");this.rectElement.setAttribute("height","0");this.selectionCallback(this.lastBoundingBox)}}e.ScatterPlotRectangleSelector=r})(yi||(yi={}));

//# sourceURL=build://vz-projector/analyticsLogger.js
(function(e){class r{constructor(k,n){"undefined"===typeof ga||null==ga?this.pageViewLogging=this.eventLogging=!1:(this.eventLogging=n,this.pageViewLogging=k)}logPageView(){this.pageViewLogging&&ga("send",{hitType:"pageview",page:"/v/embeddings"})}logProjectionChanged(k){this.eventLogging&&ga("send",{hitType:"event",eventCategory:"Projection",eventAction:"click",eventLabel:k})}logWebGLDisabled(){this.eventLogging&&ga("send",{hitType:"event",eventCategory:"Error",eventAction:"PageLoad",eventLabel:"WebGL_disabled"})}}
e.AnalyticsLogger=r})(yi||(yi={}));

//# sourceURL=build://vz-projector/util.js
(function(e){(function(r){r.shuffle=function(n){let p=n.length,v,z;for(;p;)z=Math.floor(Math.random()*p--),v=n[p],n[p]=n[z],n[z]=v;return n};r.range=function(n){const p=[];for(let v=0;v<n;v++)p.push(v);return p};r.classed=function(n,p,v){const z=n.className.split(" ");if(v){if(p in z)return;z.push(p)}else{p=z.indexOf(p);if(-1===p)return;z.splice(p,1)}n.className=z.join(" ")};r.vector3DToScreenCoords=function(n,p,v,z){let E=window.devicePixelRatio;n=(new THREE.Vector3).copy(z).project(n);return[(n.x+
1)/2*p*E,-((n.y-1)/2*v)*E]};r.vector3FromPackedArray=function(n,p){p*=3;return new THREE.Vector3(n[p],n[p+1],n[p+2])};r.getNearFarPoints=function(n,p,v){let z=Infinity,E=0;v=(new THREE.Vector3).copy(v).sub(p);v=(new THREE.Vector3).copy(v).normalize();const t=n.length/3;let x=0,A=new THREE.Vector3,F=new THREE.Vector3;for(let N=0;N<t;N++){A.x=n[x];A.y=n[x+1];A.z=n[x+2];x+=3;F.copy(A).sub(p);const I=v.dot(F);0>I||(E=I>E?I:E,z=I<z?I:z)}return[z,E]};r.createTexture=function(n){n=new THREE.Texture(n);n.needsUpdate=
!0;n.minFilter=THREE.LinearFilter;n.generateMipmaps=!1;n.flipY=!1;return n};r.assert=function(n,p){if(!n)throw Error(p||"Assertion failed");};r.getSearchPredicate=function(n,p,v){if(p){let z=new RegExp(n,"i");p=E=>z.test(E.metadata[v].toString())}else n=n.toLowerCase(),p=z=>0<=z.metadata[v].toString().toLowerCase().indexOf(n);return p};r.runAsyncTask=function(n,p,v=null,z=200){let E=null==v;v=e.logging.setModalMessage(n,v);return new Promise((t,x)=>{setTimeout(()=>{try{let A=p();E&&e.logging.setModalMessage(null,
v);t(A)}catch(A){x(A)}return!0},z)})};r.getURLParams=function(){var n=window.location.search;if(!n)return{};n=-1!==n.indexOf("?")?n.split("?")[1]:n;n.indexOf("#")&&(n=n.split("#")[0]);n=n.split("\x26");let p={};for(let v=0;v<n.length;v++){let z=n[v].split("\x3d");p[z[0].toLowerCase()]=decodeURIComponent(z[1])}return p};const k=["/Adagrad"];r.tensorIsGenerated=function(n){for(let p=0;p<k.length;p++)if(0<=n.indexOf(k[p]))return!0;return!1};r.xor=function(n,p){return(n||p)&&!(n&&p)};r.hasWebGLSupport=
function(){try{let n=document.createElement("canvas");return null!=(n.getContext("webgl")||n.getContext("experimental-webgl"))&&"undefined"!==typeof weblas}catch(n){return!1}}})(e.util||(e.util={}))})(yi||(yi={}));

//# sourceURL=build://vz-projector/vector.js
(function(e){(function(r){function k(t,x){e.util.assert(t.length===x.length,"Vectors a and b must be of same length");let A=0;for(let F=0;F<t.length;++F)A+=t[F]*x[F];return A}function n(t){let x=0;for(let A=0;A<t.length;++A)x+=t[A]*t[A];return x}function p(t,x){e.util.assert(t.length===x.length,"Vectors a and b must be of same length");let A=0;for(let F=0;F<t.length;++F){let N=t[F]-x[F];A+=N*N}return A}function v(t,x){let A=t[0]-x[0],F=t[1]-x[1];t=t[2]-x[2];return A*A+F*F+t*t}function z(t){const x=
d3.randomNormal();let A=new Float32Array(t);for(let F=0;F<t;++F)A[F]=x();return A}function E(t,x){return k(t,x)/Math.sqrt(n(t)*n(x))}r.dot=k;r.sum=function(t){let x=0;for(let A=0;A<t.length;++A)x+=t[A];return x};r.add=function(t,x){e.util.assert(t.length===x.length,"Vectors a and b must be of same length");let A=new Float32Array(t.length);for(let F=0;F<t.length;++F)A[F]=t[F]+x[F];return A};r.sub=function(t,x){e.util.assert(t.length===x.length,"Vectors a and b must be of same length");let A=new Float32Array(t.length);
for(let F=0;F<t.length;++F)A[F]=t[F]-x[F];return A};r.norm2=n;r.dist=function(t,x){return Math.sqrt(p(t,x))};r.dist2=p;r.dist2_2D=function(t,x){let A=t[0]-x[0];t=t[1]-x[1];return A*A+t*t};r.dist2_3D=v;r.dist_3D=function(t,x){return Math.sqrt(v(t,x))};r.dist2WithLimit=function(t,x,A){e.util.assert(t.length===x.length,"Vectors a and b must be of same length");let F=0;for(let N=0;N<t.length;++N){let I=t[N]-x[N];F+=I*I;if(F>=A)return-1}return F};r.dist22D=function(t,x){let A=t[0]-x[0];t=t[1]-x[1];return A*
A+t*t};r.unit=function(t){let x=Math.sqrt(n(t));e.util.assert(0<=x,"Norm of the vector must be \x3e 0");for(let A=0;A<t.length;++A)t[A]/=x};r.projectRandom=function(t,x){let A=t[0].length,F=t.length,N=Array(F);for(var I=0;I<F;++I)N[I]=new Float32Array(x);for(I=0;I<x;++I){let aa=z(A);for(let G=0;G<F;++G)N[G][I]=k(t[G],aa)}return N};r.project2d=function(t,x,A){return[k(t,x),k(t,A)]};r.centroid=function(t,x){if(0===t.length)return null;null==x&&(x=F=>F);e.util.assert(0<=t.length,"`vectors` must be of length \x3e\x3d 1");
let A=new Float32Array(x(t[0]).length);for(let F=0;F<t.length;++F){let N=x(t[F]);for(let I=0;I<A.length;++I)A[I]+=N[I]}for(x=0;x<A.length;++x)A[x]/=t.length;return A};r.rn=z;r.cosDistNorm=function(t,x){return 1-k(t,x)};r.cosDist=function(t,x){return 1-E(t,x)};r.cosSim=E;r.toTypedArray=function(t,x){let A=t.length,F=x(t[0]).length,N=new Float32Array(A*F);for(let I=0;I<A;++I){let aa=x(t[I]);for(let G=0;G<F;++G)N[I*F+G]=aa[G]}return N};r.transposeTypedArray=function(t,x,A){let F=new Float32Array(t*x);
for(let N=0;N<t;++N)for(let I=0;I<x;++I)F[I*t+N]=A[N*x+I];return F}})(e.vector||(e.vector={}))})(yi||(yi={}));

//# sourceURL=build://vz-projector/knn.js
(function(e){(function(r){function k(n,p,v,z){return e.util.runAsyncTask("Finding nearest neighbors...",()=>{let E=n.length,t=Array(E),x=Array(E);for(var A=0;A<E;A++)x[A]=new e.KMin(p);for(A=0;A<E;A++){let N=v(n[A]),I=x[A];for(let aa=A+1;aa<E;aa++){let G=x[aa];var F=I.getSize()===p?I.getLargestKey()||Number.MAX_VALUE:Number.MAX_VALUE;let P=G.getSize()===p?G.getLargestKey()||Number.MAX_VALUE:Number.MAX_VALUE;F=Math.max(F,P);F=z(N,v(n[aa]),F);0<=F&&(I.add(F,{index:aa,dist:F}),G.add(F,{index:A,dist:F}))}}for(A=
0;A<E;A++)t[A]=x[A].getMinKItems();return t})}r.findKNNGPUCosine=function(n,p,v){function z(ja){e.util.runAsyncTask("Finding nearest neighbors: "+(100*P).toFixed()+"%",()=>{let ca=ba<aa?I+1:I;var ya=new Float32Array(ca*t);for(var Na=0;Na<ca;++Na){var $a=v(n[G+Na]);for(var mb=0;mb<t;++mb)ya[Na*t+mb]=$a[mb]}Na=new weblas.pipeline.Tensor([ca,t],ya);$a=weblas.pipeline.sgemm(1,A,Na,null,null);ya=$a.transfer();Na.delete();$a.delete();P+=U;for(Na=0;Na<ca;Na++){$a=new e.KMin(p);mb=G+Na;for(let xa=0;xa<E;xa++){if(xa===
mb)continue;let gb=1-ya[xa*ca+Na];$a.add(gb,{index:xa,dist:gb})}F[mb]=$a.getMinKItems()}P+=U;G+=ca;ba++},"knn-gpu").then(()=>{ba<N?z(ja):(e.logging.setModalMessage(null,"knn-gpu"),A.delete(),ja(F))},()=>{e.logging.setModalMessage(null,"knn-gpu");k(n,p,v,(ca,ya)=>e.vector.cosDistNorm(ca,ya)).then(ca=>{ja(ca)})})}let E=n.length,t=v(n[0]).length,x=e.vector.toTypedArray(n,v),A=new weblas.pipeline.Tensor([E,t],x),F=Array(E),N=Math.ceil(E/256),I=Math.floor(E/N),aa=E%N,G=0,P=0,U=1/(2*N),ba=0;return new Promise(ja=>
z(ja))};r.findKNN=k;r.findKNNofPoint=function(n,p,v,z,E){v=new e.KMin(v);let t=z(n[p]);for(let A=0;A<n.length;++A)if(A!==p){var x=z(n[A]);x=E(t,x);v.add(x,{index:A,dist:x})}return v.getMinKItems()}})(e.knn||(e.knn={}))})(yi||(yi={}));

//# sourceURL=build://vz-projector/data.js
var gk=this&&this.__awaiter||function(e,r,k,n){return new (k||(k=Promise))(function(p,v){function z(x){try{t(n.next(x))}catch(A){v(A)}}function E(x){try{t(n["throw"](x))}catch(A){v(A)}}function t(x){x.done?p(x.value):(new k(function(A){A(x.value)})).then(z,E)}t((n=n.apply(e,r||[])).next())})};
(function(e){function r(t){let x=null;for(let A of p)if(A in t&&""!==t[A]){x=t[A];break}return null==x?null:+x}const k=0<=navigator.userAgent.toLowerCase().indexOf("firefox"),n=e.util.hasWebGLSupport()&&!k;e.TSNE_SAMPLE_SIZE=1E4;e.UMAP_SAMPLE_SIZE=5E3;e.PCA_SAMPLE_SIZE=5E4;e.PCA_SAMPLE_DIM=200;const p=["__next__","__seq_next__"];class v{constructor(t,x){this.shuffledDataIndices=[];this.projections={};this.tSNEIteration=0;this.tSNEShouldPause=!1;this.tSNEShouldStop=!0;this.superviseInput="";this.dim=
[0,0];this.hasUmapRun=this.hasTSNERun=!1;this.points=t;this.shuffledDataIndices=e.util.shuffle(e.util.range(this.points.length));this.sequences=this.computeSequences(t);this.dim=[this.points.length,this.points[0].vector.length];this.spriteAndMetadataInfo=x}computeSequences(t){let x=new Int8Array(t.length),A={},F=[];for(let aa=0;aa<t.length;aa++)if(!x[aa]){x[aa]=1;var N=r(t[aa].metadata);if(null!=N)if(N in A)N=A[N],N.pointIndices.unshift(aa),A[aa]=N;else{N={pointIndices:[]};A[aa]=N;F.push(N);for(var I=
aa;t[I];)N.pointIndices.push(I),I=r(t[I].metadata),null!=I?x[I]=1:I=-1}}return F}projectionCanBeRendered(t){return"tsne"!==t?!0:0<this.tSNEIteration}getSubset(t){t=(null!=t&&0<t.length?t.map(x=>this.points[x]):this.points).map(x=>({metadata:x.metadata,index:x.index,vector:x.vector.slice(),projections:{}}));return new v(t,this.spriteAndMetadataInfo)}normalize(){let t=e.vector.centroid(this.points,x=>x.vector);if(null==t)throw Error("centroid should not be null");for(let x=0;x<this.points.length;++x){let A=
this.points[x];A.vector=e.vector.sub(A.vector,t);0<e.vector.norm2(A.vector)&&e.vector.unit(A.vector)}}projectLinear(t,x){this.projections[x]=!0;this.points.forEach(A=>{A.projections[x]=e.vector.dot(A.vector,t)})}projectPCA(){return null!=this.projections["pca-0"]?Promise.resolve(null):e.util.runAsyncTask("Computing PCA...",()=>{var t=this.points[0].vector.length,x=this.shuffledDataIndices.map(G=>this.points[G].vector);t>e.PCA_SAMPLE_DIM&&(x=e.vector.projectRandom(x,e.PCA_SAMPLE_DIM));var A=x.slice(0,
e.PCA_SAMPLE_SIZE),F=numeric.dot;const N=numeric.transpose;t=numeric.svd;var I=numeric.div;F=F(N(A),A);A=I(F,A.length);t=t(A);A=t.S;I=0;for(F=0;F<A.length;++F)I+=A[F];for(F=0;F<A.length;++F)A[F]/=I;this.fracVariancesExplained=A;let aa=t.U;x=x.map(G=>{let P=new Float32Array(10);for(let U=0;10>U;U++){let ba=0;for(let ja=0;ja<G.length;ja++)ba+=G[ja]*aa[ja][U];P[U]=ba}return P});for(t=0;10>t;t++)for(A="pca-"+t,this.projections[A]=!0,I=0;I<x.length;I++)this.points[this.shuffledDataIndices[I]].projections[A]=
x[I][t]})}projectTSNE(t,x,A,F){this.hasTSNERun=!0;let N=Math.floor(3*t);this.tsne=new e.TSNE({epsilon:x,perplexity:t,dim:A});this.tsne.setSupervision(this.superviseLabels,this.superviseInput);this.tsne.setSuperviseFactor(this.superviseFactor);this.tSNEShouldStop=this.tSNEShouldPause=!1;this.tSNEIteration=0;let I=this.shuffledDataIndices.slice(0,e.TSNE_SAMPLE_SIZE),aa=()=>{if(this.tSNEShouldStop)this.projections.tsne=!1,F(null),this.tsne=null,this.hasTSNERun=!1;else{if(!this.tSNEShouldPause){this.tsne.step();
let G=this.tsne.getSolution();I.forEach((P,U)=>{P=this.points[P];P.projections["tsne-0"]=G[U*A];P.projections["tsne-1"]=G[U*A+1];3===A&&(P.projections["tsne-2"]=G[U*A+2])});this.projections.tsne=!0;this.tSNEIteration++;F(this.tSNEIteration)}requestAnimationFrame(aa)}};t=I.map(G=>this.points[G]);this.computeKnn(t,N).then(G=>{e.util.runAsyncTask("Initializing T-SNE...",()=>{this.tsne.initDataDist(G)}).then(aa)})}projectUmap(t,x,A){gk(this,void 0,void 0,function*(){this.hasUmapRun=!0;this.umap=new UMAP({nComponents:t,
nNeighbors:x});let F=0;const N=this.shuffledDataIndices.slice(0,e.UMAP_SAMPLE_SIZE),I=N.map(U=>this.points[U]),aa=I.map(U=>Array.from(U.vector)),G=yield this.computeKnn(I,x),P=yield e.util.runAsyncTask("Initializing UMAP...",()=>{const U=G.map(ja=>ja.map(ca=>ca.index)),ba=G.map(ja=>ja.map(ca=>ca.dist));this.umap.setPrecomputedKNN(U,ba);return this.umap.initializeFit(aa)},"umap-optimization");return new Promise((U,ba)=>{const ja=()=>{const ca=Math.min(10,P-F);for(let ya=0;ya<ca;ya++)F=this.umap.step();
e.util.runAsyncTask(`Optimizing UMAP (epoch ${F} of ${P})`,()=>{if(F<P)requestAnimationFrame(ja);else{const ya=this.umap.getEmbedding();N.forEach((Na,$a)=>{Na=this.points[Na];Na.projections["umap-0"]=ya[$a][0];Na.projections["umap-1"]=ya[$a][1];3===t&&(Na.projections["umap-2"]=ya[$a][2])});this.projections.umap=!0;e.logging.setModalMessage(null,"umap-optimization");this.hasUmapRun=!0;A(F);U()}},"umap-optimization",0).catch(ya=>{e.logging.setModalMessage(null,"umap-optimization");ba(ya)})};requestAnimationFrame(ja)})})}computeKnn(t,
x){return gk(this,void 0,void 0,function*(){var A=this.nearest&&this.nearest.length?this.nearest[0].length:0;if(null!=this.nearest&&A>=x)return Promise.resolve(this.nearest.map(F=>F.slice(0,x)));this.nearest=A=yield n?e.knn.findKNNGPUCosine(t,x,F=>F.vector):e.knn.findKNN(t,x,F=>F.vector,(F,N)=>e.vector.cosDistNorm(F,N));return Promise.resolve(A)})}perturbTsne(){if(this.hasTSNERun&&this.tsne){this.tsne.perturb();let t=this.tsne.getDim(),x=this.tsne.getSolution();this.shuffledDataIndices.slice(0,e.TSNE_SAMPLE_SIZE).forEach((A,
F)=>{A=this.points[A];A.projections["tsne-0"]=x[F*t];A.projections["tsne-1"]=x[F*t+1];3===t&&(A.projections["tsne-2"]=x[F*t+2])})}}setSupervision(t,x){null!=t&&(this.superviseLabels=this.shuffledDataIndices.slice(0,e.TSNE_SAMPLE_SIZE).map(A=>void 0!==this.points[A].metadata[t]?String(this.points[A].metadata[t]):`Unknown #${A}`));null!=x&&(this.superviseInput=x);this.tsne&&this.tsne.setSupervision(this.superviseLabels,this.superviseInput)}setSuperviseFactor(t){null!=t&&(this.superviseFactor=t,this.tsne&&
this.tsne.setSuperviseFactor(t))}mergeMetadata(t){if(t.pointsInfo.length!==this.points.length){let x=`Number of tensors (${this.points.length}) do not`+" match the number of lines in metadata"+` (${t.pointsInfo.length}).`;if(1===t.stats.length&&this.points.length+1===t.pointsInfo.length)return e.logging.setErrorMessage(x+" Single column metadata should not have a header row.","merging metadata"),!1;if(1<t.stats.length&&this.points.length-1===t.pointsInfo.length)return e.logging.setErrorMessage(x+
" Multi-column metadata should have a header row with column labels.","merging metadata"),!1;e.logging.setWarningMessage(x)}this.spriteAndMetadataInfo=t;t.pointsInfo.slice(0,this.points.length).forEach((x,A)=>this.points[A].metadata=x);return!0}stopTSNE(){this.tSNEShouldStop=!0}findNeighbors(t,x,A){return e.knn.findKNNofPoint(this.points,t,A,F=>F.vector,x).slice(0,A)}query(t,x,A){let F=e.util.getSearchPredicate(t,x,A),N=[];this.points.forEach((I,aa)=>{F(I)&&N.push(aa)});return N}}e.DataSet=v;class z{constructor(t,
x,A,F){this.projectionType=t;this.projectionComponents=x;this.dimensionality=A;this.dataSet=F}}e.Projection=z;class E{constructor(){this.label="";this.isSelected=!1;this.tSNELearningRate=this.tSNEPerplexity=this.tSNEIteration=0;this.umapIs3d=this.tSNEis3d=!0;this.umapNeighbors=15;this.pcaComponentDimensions=[];this.projections=[];this.selectedPoints=[]}}e.State=E;e.getProjectionComponents=function(t,x){if(3<x.length)throw new RangeError("components length must be \x3c\x3d 3");const A=[null,null,null];
t="custom"===t?"linear":t;for(let F=0;F<x.length;++F)null!=x[F]&&(A[F]=t+"-"+x[F]);return A};e.stateGetAccessorDimensions=function(t){let x;switch(t.selectedProjection){case "pca":x=t.pcaComponentDimensions.slice();break;case "tsne":x=[0,1];t.tSNEis3d&&x.push(2);break;case "umap":x=[0,1];t.umapIs3d&&x.push(2);break;case "custom":x=["x","y"];break;default:throw Error("Unexpected fallthrough");}return x}})(yi||(yi={}));

//# sourceURL=build://vz-projector/data-provider.js
(function(e){function r(E,t,x=1E6,A="\n"){return new Promise(F=>{function N(U){aa+=x;U=U.split(A);var ba=P+U[0];if(1===U.length)P=ba,I(aa,x);else{P=U[U.length-1];t(ba);for(ba=1;ba<U.length-1;ba++)t(U[ba]);aa>=G?(P&&t(P),F()):I(aa,x)}}function I(U,ba){U=new Blob([E.slice(U,U+ba)]);ba=new FileReader;ba.onload=ja=>N(ja.target.result);ba.readAsText(U)}let aa=0,G=E.byteLength-1,P="";I(aa,x)})}function k(E,t="\t"){e.logging.setModalMessage("Parsing tensors...",e.TENSORS_MSG_ID);return new Promise(x=>{const A=
[];let F;r(E,N=>{N=N.trim();if(""!==N){N=N.split(t);var I={metadata:{},vector:null,index:A.length,projections:null};isNaN(N[0])||F===N.length-1?(I.metadata.label=N[0],I.vector=new Float32Array(N.slice(1).map(Number))):I.vector=new Float32Array(N.map(Number));A.push(I);null==F&&(F=I.vector.length);if(F!==I.vector.length)throw e.logging.setModalMessage("Parsing failed. Vector dimensions do not match"),Error("Parsing failed");if(1>=F)throw e.logging.setModalMessage("Parsing failed. Found a vector with only one dimension?"),
Error("Parsing failed");}}).then(()=>{e.logging.setModalMessage(null,e.TENSORS_MSG_ID);x(A)})})}function n(E,t){return e.util.runAsyncTask("Parsing tensors...",()=>{const x=E.length/t,A=[];let F=0;for(let N=0;N<x;++N)A.push({metadata:{},vector:E.subarray(F,F+t),index:N,projections:null}),F+=t;return A},e.TENSORS_MSG_ID).then(x=>{e.logging.setModalMessage(null,e.TENSORS_MSG_ID);return x})}function p(E,t){const x=E.map(F=>({name:F,isNumeric:!0,tooManyUniqueValues:!1,min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY})),
A=E.map(()=>({}));t.forEach(F=>{E.forEach((N,I)=>{const aa=x[I];I=A[I];const G=F[N];null!=G&&(aa.tooManyUniqueValues||(G in I?I[G]++:I[G]=1,50<Object.keys(I).length&&(aa.tooManyUniqueValues=!0)),isNaN(G)?aa.isNumeric=!1:(F[N]=+G,aa.min=Math.min(aa.min,+G),aa.max=Math.max(aa.max,+G)))})});x.forEach((F,N)=>{F.uniqueEntries=Object.keys(A[N]).map(I=>({label:I,count:A[N][I]}))});return x}function v(E){e.logging.setModalMessage("Parsing metadata...",e.METADATA_MSG_ID);return new Promise(t=>{let x=[],A=
!1,F=0,N=["label"];r(E,I=>{if(0!==I.trim().length){if(0===F&&(A=0<=I.indexOf("\t"))){N=I.split("\t");F++;return}F++;var aa=I.split("\t"),G={};x.push(G);N.forEach((P,U)=>{U=aa[U];G[P]=""===U?null:U})}}).then(()=>{e.logging.setModalMessage(null,e.METADATA_MSG_ID);t({stats:p(N,x),pointsInfo:x})})})}function z(E){return new Promise((t,x)=>{let A=new Image;A.onload=()=>t(A);A.onerror=F=>x(F);A.crossOrigin="";A.src=E})}e.METADATA_MSG_ID="metadata";e.TENSORS_MSG_ID="tensors";e.retrieveTensorAsBytes=function(E,
t,x){e.logging.setModalMessage("Fetching tensor values...",e.TENSORS_MSG_ID);let A=new XMLHttpRequest;A.open("GET",t);A.responseType="arraybuffer";A.onprogress=F=>{F.lengthComputable&&e.logging.setModalMessage("Fetching tensor values: "+(100*F.loaded/F.total).toFixed(1)+"%",e.TENSORS_MSG_ID)};A.onload=()=>{if(200!==A.status){var F=String.fromCharCode.apply(null,new Uint8Array(A.response));e.logging.setErrorMessage(F,"fetching tensors")}else{try{F=new Float32Array(A.response)}catch(aa){e.logging.setErrorMessage(aa,
"parsing tensor bytes");return}var N=E.tensorShape[1],I=F.length/N;E.tensorShape[0]>I&&e.logging.setWarningMessage(`Showing the first ${I.toLocaleString()}`+` of ${E.tensorShape[0].toLocaleString()} data points`);n(F,N).then(aa=>{x(new e.DataSet(aa))})}};A.send()};e.parseRawTensors=function(E,t){k(E).then(x=>{t(new e.DataSet(x))})};e.parseRawMetadata=function(E,t){v(E).then(x=>t(x))};e.parseTensors=k;e.parseTensorsFromFloat32Array=n;e.analyzeMetadata=p;e.parseMetadata=v;e.fetchImage=z;e.retrieveSpriteAndMetadataInfo=
function(E,t,x,A){let F=Promise.resolve({});E&&(F=new Promise((aa,G)=>{e.logging.setModalMessage("Fetching metadata...",e.METADATA_MSG_ID);const P=new XMLHttpRequest;P.open("GET",E);P.responseType="arraybuffer";P.onreadystatechange=()=>{if(4===P.readyState)if(200===P.status)aa(v(P.response));else{const U=new FileReader;U.onload=()=>{e.logging.setErrorMessage(U.result,"fetching metadata");G()};U.readAsText(new Blob([P.response]))}};P.send(null)}));let N=null,I=null;t&&(N=e.logging.setModalMessage("Fetching sprite image..."),
I=z(t));Promise.all([F,I]).then(aa=>{N&&e.logging.setModalMessage(null,N);const [G,P]=aa;if(P&&(8192<P.height||8192<P.width))e.logging.setModalMessage(`Error: Sprite image of dimensions ${P.width}px x `+`${P.height}px exceeds maximum dimensions `+"8192px x 8192px");else{G.spriteImage=P;G.spriteMetadata=x;try{A(G)}catch(U){e.logging.setModalMessage(String(U))}}})}})(yi||(yi={}));

//# sourceURL=build://vz-projector/data-provider-demo.js
(function(e){class r{constructor(k){this.projectorConfigPath=k}getEmbeddingInfo(k){let n=this.projectorConfig.embeddings;for(let p=0;p<n.length;p++){let v=n[p];if(v.tensorName===k)return v}return null}retrieveRuns(k){k(["Demo"])}retrieveProjectorConfig(k,n){const p=e.logging.setModalMessage("Fetching projector config..."),v=new XMLHttpRequest;v.open("GET",this.projectorConfigPath);v.onerror=z=>{z=z.message;null!=v.responseText&&(z="Cannot fetch projector config, possibly a Cross-Origin request error.");
e.logging.setErrorMessage(z,"fetching projector config")};v.onload=()=>{const z=JSON.parse(v.responseText);e.logging.setModalMessage(null,p);this.projectorConfig=z;n(z)};v.send()}retrieveTensor(k,n,p){k=this.getEmbeddingInfo(n);let v=`${k.tensorPath}`;if(".bytes"===k.tensorPath.substr(-6))e.retrieveTensorAsBytes(this.getEmbeddingInfo(n),v,p);else{e.logging.setModalMessage("Fetching tensors...",e.TENSORS_MSG_ID);const z=new XMLHttpRequest;z.open("GET",v);z.responseType="arraybuffer";z.onerror=()=>
{e.logging.setErrorMessage(z.responseText,"fetching tensors")};z.onload=()=>{e.parseTensors(z.response).then(E=>{p(new e.DataSet(E))})};z.send()}}retrieveSpriteAndMetadata(k,n,p){k=this.getEmbeddingInfo(n);n=null;k.sprite&&k.sprite.imagePath&&(n=k.sprite.imagePath);e.retrieveSpriteAndMetadataInfo(k.metadataPath,n,k.sprite,p)}getBookmarks(k,n,p){k=this.getEmbeddingInfo(n);let v=e.logging.setModalMessage("Fetching bookmarks...");const z=new XMLHttpRequest;z.open("GET",k.bookmarksPath);z.onerror=()=>
{e.logging.setErrorMessage(z.responseText)};z.onload=()=>{const E=JSON.parse(z.responseText);e.logging.setModalMessage(null,v);p(E)};z.send()}}e.DemoDataProvider=r})(yi||(yi={}));

//# sourceURL=build://vz-projector/data-provider-proto.js
(function(e){class r{constructor(k){this.dataProto=k}retrieveRuns(k){k(["proto"])}retrieveProjectorConfig(k,n){n({modelCheckpointPath:"proto",embeddings:[{tensorName:"proto",tensorShape:this.dataProto.shape,metadataPath:"proto"}]})}retrieveTensor(k,n,p){p(this.flatArrayToDataset(this.dataProto.tensor))}retrieveSpriteAndMetadata(k,n,p){let v=this.dataProto.metadata.columns.map(t=>t.name),z=this.dataProto.shape[0],E=Array(z);this.dataProto.metadata.columns.forEach(t=>{let x=t.numericValues||t.stringValues;
for(let A=0;A<z;A++)E[A]=E[A]||{},E[A][t.name]=x[A]});k=Promise.resolve(null);null!=this.dataProto.metadata.sprite&&(k=new Promise((t,x)=>{const A=new Image;A.onload=()=>t(A);A.onerror=()=>x("Failed converting base64 to an image");A.src=this.dataProto.metadata.sprite.imageBase64}));k.then(t=>{const x={stats:e.analyzeMetadata(v,E),pointsInfo:E};null!=t&&(x.spriteImage=t,x.spriteMetadata={singleImageDim:this.dataProto.metadata.sprite.singleImageDim,imagePath:"proto"});p(x)})}getBookmarks(k,n,p){p([])}flatArrayToDataset(k){let n=
[],p=this.dataProto.shape[0],v=this.dataProto.shape[1];if(p*v!==k.length)throw"The shape doesn't match the length of the flattened array";for(let z=0;z<p;z++){let E=z*v;n.push({vector:new Float32Array(k.slice(E,E+v)),metadata:{},projections:null,index:z})}return new e.DataSet(n)}}e.ProtoDataProvider=r})(yi||(yi={}));

//# sourceURL=build://vz-projector/data-provider-server.js
(function(e){e.LIMIT_NUM_POINTS=1E5;class r{constructor(k){this.runProjectorConfigCache={};this.routePrefix=k}getEmbeddingInfo(k,n,p){this.retrieveProjectorConfig(k,v=>{v=v.embeddings;for(let z=0;z<v.length;z++){const E=v[z];if(E.tensorName===n){p(E);return}}p(null)})}retrieveRuns(k){const n=e.logging.setModalMessage("Fetching runs..."),p=new XMLHttpRequest;p.open("GET",`${this.routePrefix}/runs`);p.onerror=()=>{e.logging.setErrorMessage(p.responseText,"fetching runs")};p.onload=()=>{const v=JSON.parse(p.responseText);
e.logging.setModalMessage(null,n);k(v)};p.send()}retrieveProjectorConfig(k,n){if(k in this.runProjectorConfigCache)n(this.runProjectorConfigCache[k]);else{var p=e.logging.setModalMessage("Fetching projector config..."),v=new XMLHttpRequest;v.open("GET",`${this.routePrefix}/info?run=${k}`);v.onerror=()=>{e.logging.setErrorMessage(v.responseText,"fetching projector config")};v.onload=()=>{const z=JSON.parse(v.responseText);e.logging.setModalMessage(null,p);this.runProjectorConfigCache[k]=z;n(z)};v.send()}}retrieveTensor(k,
n,p){this.getEmbeddingInfo(k,n,v=>{e.retrieveTensorAsBytes(v,`${this.routePrefix}/tensor?run=${k}&name=${n}`+`&num_rows=${e.LIMIT_NUM_POINTS}`,p)})}retrieveSpriteAndMetadata(k,n,p){this.getEmbeddingInfo(k,n,v=>{let z=null;v.metadataPath&&(z=`${this.routePrefix}/metadata?`+`run=${k}&name=${n}&num_rows=${e.LIMIT_NUM_POINTS}`);let E=null;v.sprite&&v.sprite.imagePath&&(E=`${this.routePrefix}/sprite_image?run=${k}&name=${n}`);e.retrieveSpriteAndMetadataInfo(z,E,v.sprite,p)})}getBookmarks(k,n,p){const v=
e.logging.setModalMessage("Fetching bookmarks..."),z=new XMLHttpRequest;z.open("GET",`${this.routePrefix}/bookmarks?run=${k}&name=${n}`);z.onerror=()=>{e.logging.setErrorMessage(z.responseText,"fetching bookmarks")};z.onload=()=>{e.logging.setModalMessage(null,v);const E=JSON.parse(z.responseText);p(E)};z.send()}}e.ServerDataProvider=r})(yi||(yi={}));

//# sourceURL=build://vz-projector/projectorEventContext.js

//# sourceURL=build://vz-projector/scatterPlot.js
(function(e){const r=new THREE.Vector3(.45,.9,1.6),k=new THREE.Vector3(0,0,0),n=new THREE.Vector3(0,0,4),p=new THREE.Vector3(0,0,0);let v;(function(t){t[t.AREA_SELECT=0]="AREA_SELECT";t[t.CAMERA_AND_CLICK_SELECT=1]="CAMERA_AND_CLICK_SELECT"})(v=e.MouseMode||(e.MouseMode={}));class z{constructor(){this.orthographic=!1}}e.CameraDef=z;class E{constructor(t,x){this.container=t;this.projectorEventContext=x;this.visualizers=[];this.onCameraMoveListeners=[];this.backgroundColor=16777215;this.dimensionality=
3;this.cameraDef=null;this.isDragSequence=this.mouseIsDown=this.selecting=this.orbitAnimationOnNextCameraCreation=!1;this.getLayoutValues();this.scene=new THREE.Scene;this.renderer=new THREE.WebGLRenderer({alpha:!0,premultipliedAlpha:!1,antialias:!1});this.renderer.setClearColor(16777215,1);this.container.appendChild(this.renderer.domElement);this.light=new THREE.PointLight(16772287,1,0);this.scene.add(this.light);this.setDimensions(3);this.recreateCamera(this.makeDefaultCameraDef(this.dimensionality));
this.renderer.render(this.scene,this.camera);this.rectangleSelector=new e.ScatterPlotRectangleSelector(this.container,A=>this.selectBoundingBox(A));this.addInteractionListeners()}addInteractionListeners(){this.container.addEventListener("mousemove",this.onMouseMove.bind(this));this.container.addEventListener("mousedown",this.onMouseDown.bind(this));this.container.addEventListener("mouseup",this.onMouseUp.bind(this));this.container.addEventListener("click",this.onClick.bind(this));window.addEventListener("keydown",
this.onKeyDown.bind(this),!1);window.addEventListener("keyup",this.onKeyUp.bind(this),!1)}addCameraControlsEventListeners(t){t.addEventListener("start",()=>{this.stopOrbitAnimation();this.onCameraMoveListeners.forEach(x=>x(this.camera.position,t.target))});t.addEventListener("change",()=>{this.render()});t.addEventListener("end",()=>{})}makeOrbitControls(t,x,A){null!=this.orbitCameraControls&&this.orbitCameraControls.dispose();const F=new THREE.OrbitControls(t,this.renderer.domElement);F.target0=
new THREE.Vector3(x.target[0],x.target[1],x.target[2]);F.position0=(new THREE.Vector3).copy(t.position);F.zoom0=x.zoom;F.enableRotate=A;F.autoRotate=!1;F.rotateSpeed=1;A?(F.mouseButtons.ORBIT=THREE.MOUSE.LEFT,F.mouseButtons.PAN=THREE.MOUSE.RIGHT):(F.mouseButtons.ORBIT=null,F.mouseButtons.PAN=THREE.MOUSE.LEFT);F.reset();this.camera=t;this.orbitCameraControls=F;this.addCameraControlsEventListeners(this.orbitCameraControls)}makeCamera3D(t,x,A){x=new THREE.PerspectiveCamera(70,x/A,.01,100);x.position.set(t.position[0],
t.position[1],t.position[2]);A=new THREE.Vector3(t.target[0],t.target[1],t.target[2]);x.lookAt(A);x.zoom=t.zoom;x.updateProjectionMatrix();this.camera=x;this.makeOrbitControls(x,t,!0)}makeCamera2D(t,x,A){const F=new THREE.Vector3(t.target[0],t.target[1],t.target[2]);{x/=A;A=-1.2;let N=1.2,I=-1.2,aa=1.2;1<x?(A*=x,N*=x):(aa/=x,I/=x);x=new THREE.OrthographicCamera(A,N,aa,I,-1E3,1E3);x.position.set(t.position[0],t.position[1],t.position[2]);x.up=new THREE.Vector3(0,1,0);x.lookAt(F);x.zoom=t.zoom;x.updateProjectionMatrix()}this.camera=
x;this.makeOrbitControls(x,t,!1)}makeDefaultCameraDef(t){const x=new z;x.orthographic=2===t;x.zoom=1;x.orthographic?(x.position=[n.x,n.y,n.z],x.target=[p.x,p.y,p.z]):(x.position=[r.x,r.y,r.z],x.target=[k.x,k.y,k.z]);return x}recreateCamera(t){t.orthographic?this.makeCamera2D(t,this.width,this.height):this.makeCamera3D(t,this.width,this.height);this.orbitCameraControls.minDistance=.05;this.orbitCameraControls.maxDistance=10;this.orbitCameraControls.update();this.orbitAnimationOnNextCameraCreation&&
this.startOrbitAnimation()}onClick(t,x=!0){t&&this.selecting||(!this.isDragSequence&&x&&this.projectorEventContext.notifySelectionChanged(null!=this.nearestPoint?[this.nearestPoint]:[]),this.isDragSequence=!1,this.render())}onMouseDown(t){this.isDragSequence=!1;this.mouseIsDown=!0;this.selecting?(this.orbitCameraControls.enabled=!1,this.rectangleSelector.onMouseDown(t.offsetX,t.offsetY),this.setNearestPointToMouse(t)):!t.ctrlKey&&this.sceneIs3D()&&this.orbitCameraControls.mouseButtons.ORBIT===THREE.MOUSE.RIGHT?
(this.orbitCameraControls.mouseButtons.ORBIT=THREE.MOUSE.LEFT,this.orbitCameraControls.mouseButtons.PAN=THREE.MOUSE.RIGHT):t.ctrlKey&&this.sceneIs3D()&&this.orbitCameraControls.mouseButtons.ORBIT===THREE.MOUSE.LEFT&&(this.orbitCameraControls.mouseButtons.ORBIT=THREE.MOUSE.RIGHT,this.orbitCameraControls.mouseButtons.PAN=THREE.MOUSE.LEFT)}onMouseUp(){this.selecting&&(this.orbitCameraControls.enabled=!0,this.rectangleSelector.onMouseUp(),this.render());this.mouseIsDown=!1}onMouseMove(t){this.isDragSequence=
this.mouseIsDown;this.selecting&&this.mouseIsDown?(this.rectangleSelector.onMouseMove(t.offsetX,t.offsetY),this.render()):this.mouseIsDown||(this.setNearestPointToMouse(t),this.projectorEventContext.notifyHoverOverPoint(this.nearestPoint))}onKeyDown(t){17===t.keyCode&&this.sceneIs3D()&&(this.orbitCameraControls.mouseButtons.ORBIT=THREE.MOUSE.RIGHT,this.orbitCameraControls.mouseButtons.PAN=THREE.MOUSE.LEFT);16===t.keyCode&&(this.selecting=!0,this.container.style.cursor="crosshair")}onKeyUp(t){17===
t.keyCode&&this.sceneIs3D()&&(this.orbitCameraControls.mouseButtons.ORBIT=THREE.MOUSE.LEFT,this.orbitCameraControls.mouseButtons.PAN=THREE.MOUSE.RIGHT);16===t.keyCode&&(this.selecting=this.getMouseMode()===v.AREA_SELECT,this.selecting||(this.container.style.cursor="default"),this.render())}getPointIndicesFromPickingTexture(t){if(null==this.worldSpacePointPositions)return null;var x=this.worldSpacePointPositions.length/3,A=window.devicePixelRatio||1,F=Math.floor(t.width*A);const N=Math.floor(t.height*
A);let I=new Uint8Array(F*N*4);this.renderer.readRenderTargetPixels(this.pickingTexture,Math.floor(t.x*A),this.pickingTexture.height-Math.floor(t.y*A),F,N,I);t=new Uint8Array(this.worldSpacePointPositions.length);for(A=0;A<F*N;A++){const aa=I[4*A]<<16|I[4*A+1]<<8|I[4*A+2];16777215!==aa&&aa<x&&(t[aa]=1)}x=[];for(F=0;F<t.length;F++)1===t[F]&&x.push(F);return x}selectBoundingBox(t){t=this.getPointIndicesFromPickingTexture(t);this.projectorEventContext.notifySelectionChanged(t)}setNearestPointToMouse(t){null==
this.pickingTexture?this.nearestPoint=null:(t=this.getPointIndicesFromPickingTexture({x:t.offsetX,y:t.offsetY,width:1,height:1}),this.nearestPoint=null!=t?t[0]:null)}getLayoutValues(){this.width=this.container.offsetWidth;this.height=Math.max(1,this.container.offsetHeight);return[this.width,this.height]}sceneIs3D(){return 3===this.dimensionality}remove3dAxisFromScene(){const t=this.scene.getObjectByName("axes");null!=t&&this.scene.remove(t);return t}add3dAxis(){const t=new THREE.AxesHelper;t.name=
"axes";this.scene.add(t)}setDimensions(t){if(2!==t&&3!==t)throw new RangeError("dimensionality must be 2 or 3");this.dimensionality=t;const x=this.cameraDef||this.makeDefaultCameraDef(t);this.recreateCamera(x);this.remove3dAxisFromScene();3===t&&this.add3dAxis()}getCameraDef(){const t=new z,x=this.camera.position,A=this.orbitCameraControls.target;t.orthographic=!this.sceneIs3D();t.position=[x.x,x.y,x.z];t.target=[A.x,A.y,A.z];t.zoom=this.camera.zoom;return t}setCameraParametersForNextCameraCreation(t,
x){this.cameraDef=t;this.orbitAnimationOnNextCameraCreation=x}getCameraPosition(){const t=this.camera.position;return[t.x,t.y,t.z]}getCameraTarget(){let t=this.orbitCameraControls.target;return[t.x,t.y,t.z]}setCameraPositionAndTarget(t,x){this.stopOrbitAnimation();this.camera.position.set(t[0],t[1],t[2]);this.orbitCameraControls.target.set(x[0],x[1],x[2]);this.orbitCameraControls.update();this.render()}startOrbitAnimation(){this.sceneIs3D()&&(null!=this.orbitAnimationId&&this.stopOrbitAnimation(),
this.orbitCameraControls.autoRotate=!0,this.orbitCameraControls.rotateSpeed=7,this.updateOrbitAnimation())}updateOrbitAnimation(){this.orbitCameraControls.update();this.orbitAnimationId=requestAnimationFrame(()=>this.updateOrbitAnimation())}stopOrbitAnimation(){this.orbitCameraControls.autoRotate=!1;this.orbitCameraControls.rotateSpeed=1;null!=this.orbitAnimationId&&(cancelAnimationFrame(this.orbitAnimationId),this.orbitAnimationId=null)}addVisualizer(t){this.scene&&t.setScene(this.scene);t.onResize(this.width,
this.height);t.onPointPositionsChanged(this.worldSpacePointPositions);this.visualizers.push(t)}removeAllVisualizers(){this.visualizers.forEach(t=>t.dispose());this.visualizers=[]}setPointPositions(t){this.worldSpacePointPositions=t;this.visualizers.forEach(x=>x.onPointPositionsChanged(t))}render(){var t=this.camera.position.clone();t.x+=1;t.y+=1;this.light.position.set(t.x,t.y,t.z);t=this.camera instanceof THREE.PerspectiveCamera?e.CameraType.Perspective:e.CameraType.Orthographic;let x=[0,0];null!=
this.worldSpacePointPositions&&(x=e.util.getNearFarPoints(this.worldSpacePointPositions,this.camera.position,this.orbitCameraControls.target));const A=new e.RenderContext(this.camera,t,this.orbitCameraControls.target,this.width,this.height,x[0],x[1],this.backgroundColor,this.pointColors,this.pointScaleFactors,this.labels,this.polylineColors,this.polylineOpacities,this.polylineWidths);this.visualizers.forEach(F=>F.onPickingRender(A));t=this.remove3dAxisFromScene();this.pickingTexture?this.renderer.setRenderTarget(this.pickingTexture):
this.renderer.setRenderTarget(null);this.renderer.render(this.scene,this.camera);this.renderer.setRenderTarget(null);null!=t&&this.scene.add(t);this.visualizers.forEach(F=>F.onRender(A));this.renderer.render(this.scene,this.camera)}setMouseMode(t){this.mouseMode=t;t===v.AREA_SELECT?(this.selecting=!0,this.container.style.cursor="crosshair"):(this.selecting=!1,this.container.style.cursor="default")}setPointColors(t){this.pointColors=t}setPointScaleFactors(t){this.pointScaleFactors=t}setLabels(t){this.labels=
t}setPolylineColors(t){this.polylineColors=t}setPolylineOpacities(t){this.polylineOpacities=t}setPolylineWidths(t){this.polylineWidths=t}getMouseMode(){return this.mouseMode}resetZoom(){this.recreateCamera(this.makeDefaultCameraDef(this.dimensionality));this.render()}setDayNightMode(t){const x=this.container.querySelectorAll("canvas");t=t?"invert(100%)":null;for(let A=0;A<x.length;A++)x[A].style.filter=t}resize(t=!0){const [x,A]=[this.width,this.height],[F,N]=this.getLayoutValues();if(3===this.dimensionality){var I=
this.camera;I.aspect=F/N;I.updateProjectionMatrix()}else{I=this.camera;var aa=F/x*(I.right-I.left)/2;const G=N/A*(I.top-I.bottom)/2;I.top=G;I.bottom=-G;I.left=-aa;I.right=aa;I.updateProjectionMatrix()}this.renderer.setPixelRatio();this.renderer.setSize(F,N);I=new THREE.Vector2;this.renderer.getSize(I);aa=this.renderer.getPixelRatio();this.pickingTexture=new THREE.WebGLRenderTarget(I.width*aa,I.height*aa);this.pickingTexture.texture.minFilter=THREE.LinearFilter;this.visualizers.forEach(G=>G.onResize(F,
N));t&&this.render()}onCameraMove(t){this.onCameraMoveListeners.push(t)}clickOnPoint(t){this.nearestPoint=t;this.onClick(null,!1)}}e.ScatterPlot=E})(yi||(yi={}));

//# sourceURL=build://vz-projector/scatterPlotVisualizer3DLabels.js
(function(e){class r{createGlyphTexture(){let k=document.createElement("canvas");k.width=8192;k.height=80;let n=k.getContext("2d");n.font="bold 60px roboto";n.textBaseline="top";n.fillStyle="white";n.rect(0,0,k.width,k.height);n.fill();n.fillStyle="black";let p=n.measureText(" ").width,v=new Float32Array(256),z=new Float32Array(256),E=0;for(let t=0;256>t;t++){let x=" "+String.fromCharCode(t),A=n.measureText(x).width;v[t]=A-p;z[t]=E;n.fillText(x,E-p,0);E+=A}return{texture:e.util.createTexture(k),lengths:v,
offsets:z}}processLabelVerts(k){let n=0;this.labelVertexMap=[];for(let p=0;p<k;p++){const v=this.labelStrings[p];let z=[];for(let E=0;E<v.length;E++){for(let t=0;6>t;t++)z.push(6*n+t);n++}this.labelVertexMap.push(z)}this.totalVertexCount=6*n}createColorBuffers(k){this.pickingColors=new Float32Array(3*this.totalVertexCount);this.renderColors=new Float32Array(3*this.totalVertexCount);for(let n=0;n<k;n++){let p=new THREE.Color(n);this.labelVertexMap[n].forEach(v=>{this.pickingColors[3*v]=p.r;this.pickingColors[3*
v+1]=p.g;this.pickingColors[3*v+2]=p.b;this.renderColors[3*v]=1;this.renderColors[3*v+1]=1;this.renderColors[3*v+2]=1})}}createLabels(){if(null!=this.labelStrings&&null!=this.worldSpacePointPositions){var k=this.worldSpacePointPositions.length/3;if(k===this.labelStrings.length){this.glyphTexture=this.createGlyphTexture();this.uniforms={texture:{type:"t"},picking:{type:"bool"}};this.material=new THREE.ShaderMaterial({uniforms:this.uniforms,transparent:!0,vertexShader:"\n    attribute vec2 posObj;\n    attribute vec3 color;\n    varying vec2 vUv;\n    varying vec3 vColor;\n\n    void main() {\n      vUv \x3d uv;\n      vColor \x3d color;\n\n      // Rotate label to face camera.\n\n      vec4 vRight \x3d vec4(\n        modelViewMatrix[0][0], modelViewMatrix[1][0], modelViewMatrix[2][0], 0);\n\n      vec4 vUp \x3d vec4(\n        modelViewMatrix[0][1], modelViewMatrix[1][1], modelViewMatrix[2][1], 0);\n\n      vec4 vAt \x3d -vec4(\n        modelViewMatrix[0][2], modelViewMatrix[1][2], modelViewMatrix[2][2], 0);\n\n      mat4 pointToCamera \x3d mat4(vRight, vUp, vAt, vec4(0, 0, 0, 1));\n\n      vec2 scaledPos \x3d posObj * 0.0125 * 2.2;\n\n      vec4 posRotated \x3d pointToCamera * vec4(scaledPos, 0, 1);\n      vec4 mvPosition \x3d modelViewMatrix * (vec4(position, 0) + posRotated);\n      gl_Position \x3d projectionMatrix * mvPosition;\n    }",
fragmentShader:"\n    uniform sampler2D texture;\n    uniform bool picking;\n    varying vec2 vUv;\n    varying vec3 vColor;\n\n    void main() {\n      if (picking) {\n        gl_FragColor \x3d vec4(vColor, 1.0);\n      } else {\n        vec4 fromTexture \x3d texture2D(texture, vUv);\n        gl_FragColor \x3d vec4(vColor, 1.0) * fromTexture;\n      }\n    }"});this.processLabelVerts(k);this.createColorBuffers(k);this.positions=new THREE.BufferAttribute(new Float32Array(3*this.totalVertexCount),
3);var n=new Float32Array(2*this.totalVertexCount),p=new Float32Array(3*this.totalVertexCount),v=new THREE.BufferAttribute(new Float32Array(3*this.totalVertexCount),2);n=new THREE.BufferAttribute(n,2);p=new THREE.BufferAttribute(p,3);this.geometry=new THREE.BufferGeometry;this.geometry.addAttribute("posObj",v);this.geometry.addAttribute("position",this.positions);this.geometry.addAttribute("uv",n);this.geometry.addAttribute("color",p);p=0;for(let x=0;x<k;x++){const A=this.labelStrings[x];let F=0;
for(var z=0;z<A.length;z++)F+=this.glyphTexture.lengths[A.charCodeAt(z)];F/=-2;for(z=0;z<A.length;z++){var E=A.charCodeAt(z);let N=this.glyphTexture.lengths[E];var t=(F+N)/80;let I=F/80;v.setXY(6*p,I,0);v.setXY(6*p+1,t,0);v.setXY(6*p+2,I,1);v.setXY(6*p+3,I,1);v.setXY(6*p+4,t,0);v.setXY(6*p+5,t,1);t=this.glyphTexture.offsets[E];E=this.glyphTexture.offsets[E]+N;t/=8192;E/=8192;n.setXY(6*p,t,1);n.setXY(6*p+1,E,1);n.setXY(6*p+2,t,0);n.setXY(6*p+3,t,0);n.setXY(6*p+4,E,1);n.setXY(6*p+5,E,0);p++;F+=N}}for(v=
0;v<k;v++){const x=e.util.vector3FromPackedArray(this.worldSpacePointPositions,v);this.labelVertexMap[v].forEach(A=>{this.positions.setXYZ(A,x.x,x.y,x.z)})}this.labelsMesh=new THREE.Mesh(this.geometry,this.material);this.labelsMesh.frustumCulled=!1;this.scene.add(this.labelsMesh)}}}colorLabels(k){if(null!=this.labelStrings&&null!=this.geometry&&null!=k){var n=this.geometry.getAttribute("color");n.setArray(this.renderColors);var p=k.length/3,v=0;for(let z=0;z<p;++z){const E=new THREE.Color(k[v],k[v+
1],k[v+2]),t=this.labelVertexMap[z].length;for(let x=0;x<t;++x)n.setXYZ(this.labelVertexMap[z][x],E.r,E.g,E.b);v+=3}n.needsUpdate=!0}}setScene(k){this.scene=k}dispose(){this.labelsMesh&&(this.scene&&this.scene.remove(this.labelsMesh),this.labelsMesh=null);this.geometry&&(this.geometry.dispose(),this.geometry=null);null!=this.glyphTexture&&null!=this.glyphTexture.texture&&(this.glyphTexture.texture.dispose(),this.glyphTexture.texture=null)}onPickingRender(){null==this.geometry&&this.createLabels();
if(null!=this.geometry){this.material.uniforms.texture.value=this.glyphTexture.texture;this.material.uniforms.picking.value=!0;var k=this.geometry.getAttribute("color");k.setArray(this.pickingColors);k.needsUpdate=!0}}onRender(k){null==this.geometry&&this.createLabels();null!=this.geometry&&(this.colorLabels(k.pointColors),this.material.uniforms.texture.value=this.glyphTexture.texture,this.material.uniforms.picking.value=!1,k=this.geometry.getAttribute("color"),k.setArray(this.renderColors),k.needsUpdate=
!0)}onPointPositionsChanged(k){this.worldSpacePointPositions=k;this.dispose()}setLabelStrings(k){this.labelStrings=k;this.dispose()}onResize(){}}e.ScatterPlotVisualizer3DLabels=r})(yi||(yi={}));

//# sourceURL=build://vz-projector/scatterPlotVisualizerCanvasLabels.js
(function(e){class r{constructor(k){this.labelsActive=!0;this.canvas=document.createElement("canvas");k.appendChild(this.canvas);this.gc=this.canvas.getContext("2d");this.canvas.style.position="absolute";this.canvas.style.left="0";this.canvas.style.top="0";this.canvas.style.pointerEvents="none"}removeAllLabels(){this.gc.clearRect(0,0,this.canvas.width*window.devicePixelRatio,this.canvas.height*window.devicePixelRatio)}makeLabels(k){if(null!=k.labels&&0!==k.labels.pointIndices.length&&null!=this.worldSpacePointPositions){var n=
k.labels,p=k.cameraType===e.CameraType.Perspective,v=parseInt(this.gc.font,10),z=window.devicePixelRatio;var E=this.canvas.width*z;var t=this.canvas.height*z;E=new e.CollisionGrid({loX:0,hiX:E,loY:0,hiY:t},E/25,t/50);t=d3.scalePow().exponent(Math.E).domain([k.farthestCameraSpacePointZ,k.nearestCameraSpacePointZ]).range([.1,1]);var x=k.camera.position,A=x.clone().sub(k.cameraTarget),F=new THREE.Vector3;this.gc.textBaseline="middle";this.gc.miterLimit=2;var N=Math.min(1E4,n.pointIndices.length);for(let G=
0;G<N;++G){var I=e.util.vector3FromPackedArray(this.worldSpacePointPositions,n.pointIndices[G]);F.copy(x).sub(I);if(0>A.dot(F))continue;let [P,U]=e.util.vector3DToScreenCoords(k.camera,k.screenWidth,k.screenHeight,I);P+=4;var aa={loX:P-2,hiX:P+1+2,loY:U-v/2-2,hiY:U+v/2+2};E.insert(aa,!0)&&(I=n.labelStrings[G],this.gc.font=n.defaultFontSize*n.scaleFactors[G]*z+"px roboto",aa.hiX+=this.gc.measureText(I).width-1,E.insert(aa)&&(aa=1,p&&1===n.useSceneOpacityFlags[G]&&(aa=t(F.length())),this.gc.fillStyle=
this.styleStringFromPackedRgba(n.fillColors,G,aa),this.gc.strokeStyle=this.styleStringFromPackedRgba(n.strokeColors,G,aa),this.gc.lineWidth=3,this.gc.strokeText(I,P,U),this.gc.lineWidth=6,this.gc.fillText(I,P,U)))}}}styleStringFromPackedRgba(k,n,p){n*=3;return"rgba("+k[n]+","+k[n+1]+","+k[n+2]+","+p+")"}onResize(k,n){let p=window.devicePixelRatio;this.canvas.width=k*p;this.canvas.height=n*p;this.canvas.style.width=k+"px";this.canvas.style.height=n+"px"}dispose(){this.removeAllLabels();this.gc=this.canvas=
null}onPointPositionsChanged(k){this.worldSpacePointPositions=k;this.removeAllLabels()}onRender(k){this.labelsActive&&(this.removeAllLabels(),this.makeLabels(k))}setScene(){}onPickingRender(){}}e.ScatterPlotVisualizerCanvasLabels=r})(yi||(yi={}));

//# sourceURL=build://vz-projector/scatterPlotVisualizerPolylines.js
(function(e){class r{constructor(){this.polylinePositionBuffer={};this.polylineColorBuffer={}}updateSequenceIndicesInDataSet(k){for(let n=0;n<k.sequences.length;n++){const p=k.sequences[n];for(let v=0;v<p.pointIndices.length-1;v++)k.points[p.pointIndices[v]].sequenceIndex=n,k.points[p.pointIndices[v+1]].sequenceIndex=n}}createPolylines(k){if(this.dataSet&&this.dataSet.sequences){this.updateSequenceIndicesInDataSet(this.dataSet);this.polylines=[];for(let p=0;p<this.dataSet.sequences.length;p++){var n=
new THREE.BufferGeometry;n.addAttribute("position",this.polylinePositionBuffer[p]);n.addAttribute("color",this.polylineColorBuffer[p]);const v=new THREE.LineBasicMaterial({linewidth:1,opacity:1,transparent:!0,vertexColors:THREE.VertexColors});n=new THREE.LineSegments(n,v);n.frustumCulled=!1;this.polylines.push(n);k.add(n)}}}dispose(){if(null!=this.polylines){for(let k=0;k<this.polylines.length;k++)this.scene.remove(this.polylines[k]),this.polylines[k].geometry.dispose();this.polylines=null;this.polylinePositionBuffer=
{};this.polylineColorBuffer={}}}setScene(k){this.scene=k}setDataSet(k){this.dataSet=k}onPointPositionsChanged(k){null!=k&&null==this.polylines||this.dispose();if(null!=k&&null!=this.dataSet){for(var n=0;n<this.dataSet.sequences.length;n++){var p=2*(this.dataSet.sequences[n].pointIndices.length-1);this.polylinePositionBuffer[n]=new THREE.BufferAttribute(new Float32Array(3*p),3);this.polylineColorBuffer[n]=new THREE.BufferAttribute(new Float32Array(3*p),3)}for(n=0;n<this.dataSet.sequences.length;n++){p=
this.dataSet.sequences[n];let z=0;for(let E=0;E<p.pointIndices.length-1;E++){var v=p.pointIndices[E+1];const t=e.util.vector3FromPackedArray(k,p.pointIndices[E]);v=e.util.vector3FromPackedArray(k,v);this.polylinePositionBuffer[n].setXYZ(z,t.x,t.y,t.z);this.polylinePositionBuffer[n].setXYZ(z+1,v.x,v.y,v.z);z+=2}this.polylinePositionBuffer[n].needsUpdate=!0}null==this.polylines&&this.createPolylines(this.scene)}}onRender(k){if(null!=this.polylines)for(let n=0;n<this.polylines.length;n++)this.polylines[n].material.opacity=
k.polylineOpacities[n],this.polylines[n].material.linewidth=k.polylineWidths[n],this.polylineColorBuffer[n].setArray(k.polylineColors[n]),this.polylineColorBuffer[n].needsUpdate=!0}onPickingRender(){}onResize(){}}e.ScatterPlotVisualizerPolylines=r})(yi||(yi={}));

//# sourceURL=build://vz-projector/scatterPlotVisualizerSprites.js
(function(e){const r=`
  // Index of the specific vertex (passed in as bufferAttribute), and the
  // variable that will be used to pass it to the fragment shader.
  attribute float spriteIndex;
  attribute vec3 color;
  attribute float scaleFactor;

  varying vec2 xyIndex;
  varying vec3 vColor;

  uniform bool sizeAttenuation;
  uniform float pointSize;
  uniform float spritesPerRow;
  uniform float spritesPerColumn;

  ${THREE.ShaderChunk.fog_pars_vertex}

  void main() {
    // Pass index and color values to fragment shader.
    vColor = color;
    xyIndex = vec2(mod(spriteIndex, spritesPerRow),
              floor(spriteIndex / spritesPerColumn));

    // Transform current vertex by modelViewMatrix (model world position and
    // camera world position matrix).
    vec4 cameraSpacePos = modelViewMatrix * vec4(position, 1.0);

    // Project vertex in camera-space to screen coordinates using the camera's
    // projection matrix.
    gl_Position = projectionMatrix * cameraSpacePos;

    // Create size attenuation (if we're in 3D mode) by making the size of
    // each point inversly proportional to its distance to the camera.
    float outputPointSize = pointSize;
    if (sizeAttenuation) {
      outputPointSize = -pointSize / cameraSpacePos.z;
    } else {  // Create size attenuation (if we're in 2D mode)
      const float PI = 3.1415926535897932384626433832795;
      const float minScale = 0.1;  // minimum scaling factor
      const float outSpeed = 2.0;  // shrink speed when zooming out
      const float outNorm = (1. - minScale) / atan(outSpeed);
      const float maxScale = 15.0;  // maximum scaling factor
      const float inSpeed = 0.02;  // enlarge speed when zooming in
      const float zoomOffset = 0.3;  // offset zoom pivot
      float zoom = projectionMatrix[0][0] + zoomOffset;  // zoom pivot
      float scale = zoom < 1. ? 1. + outNorm * atan(outSpeed * (zoom - 1.)) :
                    1. + 2. / PI * (maxScale - 1.) * atan(inSpeed * (zoom - 1.));
      outputPointSize = pointSize * scale;
    }

    gl_PointSize =
      max(outputPointSize * scaleFactor, ${(5).toFixed(1)});
  }`,k=`
  varying vec2 xyIndex;
  varying vec3 vColor;

  uniform sampler2D texture;
  uniform float spritesPerRow;
  uniform float spritesPerColumn;
  uniform bool isImage;

  ${THREE.ShaderChunk.common}
  ${THREE.ShaderChunk.fog_pars_fragment}
  ${"\n  bool point_in_unit_circle(vec2 spriteCoord) {\n    vec2 centerToP \x3d spriteCoord - vec2(0.5, 0.5);\n    return dot(centerToP, centerToP) \x3c (0.5 * 0.5);\n  }\n\n  bool point_in_unit_equilateral_triangle(vec2 spriteCoord) {\n    vec3 v0 \x3d vec3(0, 1, 0);\n    vec3 v1 \x3d vec3(0.5, 0, 0);\n    vec3 v2 \x3d vec3(1, 1, 0);\n    vec3 p \x3d vec3(spriteCoord, 0);\n    float p_in_v0_v1 \x3d cross(v1 - v0, p - v0).z;\n    float p_in_v1_v2 \x3d cross(v2 - v1, p - v1).z;\n    return (p_in_v0_v1 \x3e 0.0) \x26\x26 (p_in_v1_v2 \x3e 0.0);\n  }\n\n  bool point_in_unit_square(vec2 spriteCoord) {\n    return true;\n  }\n"}

  void main() {
    if (isImage) {
      // Coordinates of the vertex within the entire sprite image.
      vec2 coords =
        (gl_PointCoord + xyIndex) / vec2(spritesPerRow, spritesPerColumn);
      gl_FragColor = vec4(vColor, 1.0) * texture2D(texture, coords);
    } else {
      bool inside = point_in_unit_circle(gl_PointCoord);
      if (!inside) {
        discard;
      }
      gl_FragColor = vec4(vColor, 1);
    }
    ${THREE.ShaderChunk.fog_fragment}
  }`;class n{constructor(){this.texture=null;this.standinTextureForPoints=e.util.createTexture(document.createElement("canvas"));this.renderMaterial=this.createRenderMaterial(!1);this.pickingMaterial=this.createPickingMaterial()}createTextureFromSpriteAtlas(p,v,z){this.texture=e.util.createTexture(p);this.spritesPerRow=p.width/v[0];this.spritesPerColumn=p.height/v[1];this.spriteDimensions=v;this.spriteIndexBufferAttribute=new THREE.BufferAttribute(z,1);null!=this.points&&this.points.geometry.addAttribute("spriteIndex",
this.spriteIndexBufferAttribute)}createUniforms(){return{texture:{type:"t"},spritesPerRow:{type:"f"},spritesPerColumn:{type:"f"},fogColor:{type:"c"},fogNear:{type:"f"},fogFar:{type:"f"},isImage:{type:"bool"},sizeAttenuation:{type:"bool"},pointSize:{type:"f"}}}createRenderMaterial(p){return new THREE.ShaderMaterial({uniforms:this.createUniforms(),vertexShader:r,fragmentShader:k,transparent:!p,depthTest:p,depthWrite:p,fog:!0,blending:THREE.MultiplyBlending})}createPickingMaterial(){return new THREE.ShaderMaterial({uniforms:this.createUniforms(),
vertexShader:r,fragmentShader:"\n  varying vec2 xyIndex;\n  varying vec3 vColor;\n  uniform bool isImage;\n\n  \n  bool point_in_unit_circle(vec2 spriteCoord) {\n    vec2 centerToP \x3d spriteCoord - vec2(0.5, 0.5);\n    return dot(centerToP, centerToP) \x3c (0.5 * 0.5);\n  }\n\n  bool point_in_unit_equilateral_triangle(vec2 spriteCoord) {\n    vec3 v0 \x3d vec3(0, 1, 0);\n    vec3 v1 \x3d vec3(0.5, 0, 0);\n    vec3 v2 \x3d vec3(1, 1, 0);\n    vec3 p \x3d vec3(spriteCoord, 0);\n    float p_in_v0_v1 \x3d cross(v1 - v0, p - v0).z;\n    float p_in_v1_v2 \x3d cross(v2 - v1, p - v1).z;\n    return (p_in_v0_v1 \x3e 0.0) \x26\x26 (p_in_v1_v2 \x3e 0.0);\n  }\n\n  bool point_in_unit_square(vec2 spriteCoord) {\n    return true;\n  }\n\n\n  void main() {\n    xyIndex; // Silence 'unused variable' warning.\n    if (isImage) {\n      gl_FragColor \x3d vec4(vColor, 1);\n    } else {\n      bool inside \x3d point_in_unit_circle(gl_PointCoord);\n      if (!inside) {\n        discard;\n      }\n      gl_FragColor \x3d vec4(vColor, 1);\n    }\n  }",
transparent:!0,depthTest:!0,depthWrite:!0,fog:!1,blending:THREE.NormalBlending})}createPointSprites(p,v){v=this.createGeometry(null!=v?v.length/3:0);this.fog=new THREE.Fog(16777215);this.points=new THREE.Points(v,this.renderMaterial);this.points.frustumCulled=!1;null!=this.spriteIndexBufferAttribute&&this.points.geometry.addAttribute("spriteIndex",this.spriteIndexBufferAttribute);p.add(this.points)}calculatePointSize(p){if(null!=this.texture)return p?30:this.spriteDimensions[0];const v=200/Math.log(null!=
this.worldSpacePointPositions?this.worldSpacePointPositions.length/3:1)/Math.log(8);return p?v:v/1.5}createGeometry(p){this.pickingColors=new Float32Array(3*p);{let v=0;for(let z=0;z<p;z++){const E=new THREE.Color(z);this.pickingColors[v++]=E.r;this.pickingColors[v++]=E.g;this.pickingColors[v++]=E.b}}p=new THREE.BufferGeometry;p.addAttribute("position",new THREE.BufferAttribute(void 0,3));p.addAttribute("color",new THREE.BufferAttribute(void 0,3));p.addAttribute("scaleFactor",new THREE.BufferAttribute(void 0,
1));return p}setFogDistances(p,v,z){p?(p=this.worldSpacePointPositions.length/3,this.fog.near=v,this.fog.far=z*(2-Math.min(p,5E3)/5E3)):(this.fog.near=Infinity,this.fog.far=Infinity)}dispose(){this.disposeGeometry();this.disposeTextureAtlas()}disposeGeometry(){null!=this.points&&(this.scene.remove(this.points),this.points.geometry.dispose(),this.worldSpacePointPositions=this.points=null)}disposeTextureAtlas(){null!=this.texture&&this.texture.dispose();this.pickingMaterial=this.renderMaterial=this.texture=
null}setScene(p){this.scene=p}setSpriteAtlas(p,v,z){this.disposeTextureAtlas();this.createTextureFromSpriteAtlas(p,v,z);this.renderMaterial=this.createRenderMaterial(!0);this.pickingMaterial=this.createPickingMaterial()}clearSpriteAtlas(){this.disposeTextureAtlas();this.renderMaterial=this.createRenderMaterial(!1);this.pickingMaterial=this.createPickingMaterial()}onPointPositionsChanged(p){if(null==p||0===p.length)this.dispose();else{null!=this.points&&this.worldSpacePointPositions.length!==p.length&&
this.disposeGeometry();this.worldSpacePointPositions=p;null==this.points&&this.createPointSprites(this.scene,p);var v=this.points.geometry.getAttribute("position");v.setArray(p);v.needsUpdate=!0}}onPickingRender(p){if(null!=this.points){var v=p.cameraType===e.CameraType.Perspective;this.pickingMaterial.uniforms.spritesPerRow.value=this.spritesPerRow;this.pickingMaterial.uniforms.spritesPerRow.value=this.spritesPerColumn;this.pickingMaterial.uniforms.sizeAttenuation.value=v;this.pickingMaterial.uniforms.pointSize.value=
this.calculatePointSize(v);this.points.material=this.pickingMaterial;v=this.points.geometry.getAttribute("color");v.setArray(this.pickingColors);v.needsUpdate=!0;v=this.points.geometry.getAttribute("scaleFactor");v.setArray(p.pointScaleFactors);v.needsUpdate=!0}}onRender(p){if(this.points){var v=p.camera instanceof THREE.PerspectiveCamera;this.setFogDistances(v,p.nearestCameraSpacePointZ,p.farthestCameraSpacePointZ);this.scene.fog=this.fog;this.scene.fog.color=new THREE.Color(p.backgroundColor);this.renderMaterial.uniforms.fogColor.value=
this.scene.fog.color;this.renderMaterial.uniforms.fogNear.value=this.fog.near;this.renderMaterial.uniforms.fogFar.value=this.fog.far;this.renderMaterial.uniforms.spritesPerRow.value=this.spritesPerRow;this.renderMaterial.uniforms.spritesPerColumn.value=this.spritesPerColumn;this.renderMaterial.uniforms.isImage.value=null!=this.texture;this.renderMaterial.uniforms.texture.value=null!=this.texture?this.texture:this.standinTextureForPoints;this.renderMaterial.uniforms.sizeAttenuation.value=v;this.renderMaterial.uniforms.pointSize.value=
this.calculatePointSize(v);this.points.material=this.renderMaterial;v=this.points.geometry.getAttribute("color");this.renderColors=p.pointColors;v.setArray(this.renderColors);v.needsUpdate=!0;v=this.points.geometry.getAttribute("scaleFactor");v.setArray(p.pointScaleFactors);v.needsUpdate=!0}}onResize(){}}e.ScatterPlotVisualizerSprites=n})(yi||(yi={}));

//# sourceURL=build://vz-projector/scatterPlotVisualizer.js

//# sourceURL=build://vz-projector/projectorScatterPlotAdapter.js
(function(e){function r(t,x,A,F,N){t[3*x]=A;t[3*x+1]=F;t[3*x+2]=N}function k(t){t=new THREE.Color(t);return[255*t.r|0,255*t.g|0,255*t.b|0]}function n(t,x){t=d3.hsl(60+300*t/x,1,.3).rgb();return new THREE.Color(t.r/255,t.g/255,t.b/255)}function p(t,x,A){return t===e.vector.dist?A/x:1-x}function v(t,x,A){return z(p(t,x,A))}const z=d3.scaleLinear().domain([1,.7,.4]).range(["hsl(285, 80%, 40%)","hsl(0, 80%, 65%)","hsl(40, 70%, 60%)"]).clamp(!0);class E{constructor(t,x){this.scatterPlotContainer=t;this.renderLabelsIn3D=
!1;this.scatterPlot=new e.ScatterPlot(t,x);x.registerProjectionChangedListener(A=>{this.projection=A;this.updateScatterPlotWithNewProjection(A)});x.registerSelectionChangedListener((A,F)=>{this.selectedPointIndices=A;this.neighborsOfFirstSelectedPoint=F;this.updateScatterPlotPositions();this.updateScatterPlotAttributes();this.scatterPlot.render()});x.registerHoverListener(A=>{this.hoverPointIndex=A;this.updateScatterPlotAttributes();this.scatterPlot.render()});x.registerDistanceMetricChangedListener(A=>
{this.distanceMetric=A;this.updateScatterPlotAttributes();this.scatterPlot.render()});this.createVisualizers(!1)}notifyProjectionPositionsUpdated(){this.updateScatterPlotPositions();this.scatterPlot.render()}setDataSet(t){null!=this.projection&&(this.projection.dataSet=t);null!=this.polylineVisualizer&&this.polylineVisualizer.setDataSet(t);null!=this.labels3DVisualizer&&this.labels3DVisualizer.setLabelStrings(this.generate3DLabelsArray(t,this.labelPointAccessor));if(null!=this.spriteVisualizer&&(this.spriteVisualizer.clearSpriteAtlas(),
null!=t&&null!=t.spriteAndMetadataInfo)){var x=t.spriteAndMetadataInfo;if(null!=x.spriteImage&&null!=x.spriteMetadata){var A=t.points.length,F=new Float32Array(A);for(let N=0;N<A;++N)F[N]=t.points[N].index;this.spriteVisualizer.setSpriteAtlas(x.spriteImage,x.spriteMetadata.singleImageDim,F)}}}set3DLabelMode(t){this.renderLabelsIn3D=t;this.createVisualizers(t);this.updateScatterPlotAttributes();this.scatterPlot.render()}setLegendPointColorer(t){this.legendPointColorer=t}setLabelPointAccessor(t){this.labelPointAccessor=
t;null!=this.labels3DVisualizer&&this.labels3DVisualizer.setLabelStrings(this.generate3DLabelsArray(null==this.projection?null:this.projection.dataSet,t))}resize(){this.scatterPlot.resize()}populateBookmarkFromUI(t){t.cameraDef=this.scatterPlot.getCameraDef()}restoreUIFromBookmark(t){this.scatterPlot.setCameraParametersForNextCameraCreation(t.cameraDef,!1)}updateScatterPlotPositions(){const t=this.generatePointPositionArray(null==this.projection?null:this.projection.dataSet,null==this.projection?
null:this.projection.projectionComponents);this.scatterPlot.setPointPositions(t)}updateScatterPlotAttributes(){if(null!=this.projection){var t=this.projection.dataSet,x=this.selectedPointIndices,A=this.hoverPointIndex,F=this.neighborsOfFirstSelectedPoint,N=this.legendPointColorer,I=this.generatePointColorArray(t,N,this.distanceMetric,x,F,A,this.renderLabelsIn3D,this.getSpriteImageMode()),aa=this.generatePointScaleFactorArray(t,x,F,A);A=this.generateVisibleLabelRenderParams(t,x,F,A);N=this.generateLineSegmentColorMap(t,
N);F=this.generateLineSegmentOpacityArray(t,x);t=this.generateLineSegmentWidthArray(t,x);this.scatterPlot.setPointColors(I);this.scatterPlot.setPointScaleFactors(aa);this.scatterPlot.setLabels(A);this.scatterPlot.setPolylineColors(N);this.scatterPlot.setPolylineOpacities(F);this.scatterPlot.setPolylineWidths(t)}}render(){this.scatterPlot.render()}generatePointPositionArray(t,x){if(null==t)return null;const A=d3.scaleLinear(),F=d3.scaleLinear();let N=null;{var I=d3.extent(t.points,(ba,ja)=>t.points[ja].projections[x[0]]);
const P=d3.extent(t.points,(ba,ja)=>t.points[ja].projections[x[1]]),U=[-1,1];A.domain(I).range(U);F.domain(P).range(U);null!=x[2]&&(I=d3.extent(t.points,(ba,ja)=>t.points[ja].projections[x[2]]),N=d3.scaleLinear(),N.domain(I).range(U))}const aa=new Float32Array(3*t.points.length);let G=0;t.points.forEach((P,U)=>{aa[G++]=A(t.points[U].projections[x[0]]);aa[G++]=F(t.points[U].projections[x[1]]);aa[G++]=0});N&&(G=2,t.points.forEach((P,U)=>{aa[G]=N(t.points[U].projections[x[2]]);G+=3}));return aa}generateVisibleLabelRenderParams(t,
x,A,F){if(null==t)return null;var N=null==x?0:x.length;const I=null==A?0:A.length;var aa=N+I+(null!=F?1:0);const G=new Uint32Array(aa),P=new Float32Array(aa),U=new Int8Array(aa),ba=new Uint8Array(3*aa);aa=new Uint8Array(3*aa);const ja=[];P.fill(1);U.fill(1);let ca=0;null!=F&&(ja.push(this.getLabelText(t,F,this.labelPointAccessor)),G[ca]=F,P[ca]=2,U[ca]=0,F=k(0),r(ba,ca,F[0],F[1],F[2]),F=k(16777215),r(aa,ca,F[0],F[1],F[1]),++ca);F=k(0);var ya=k(16777215);for(let Na=0;Na<N;++Na){const $a=x[Na];ja.push(this.getLabelText(t,
$a,this.labelPointAccessor));G[ca]=$a;P[ca]=2;U[ca]=1===N?0:1;r(ba,ca,F[0],F[1],F[2]);r(aa,ca,ya[0],ya[1],ya[2]);++ca}x=k(0);N=k(16777215);for(F=0;F<I;++F)ya=A[F].index,ja.push(this.getLabelText(t,ya,this.labelPointAccessor)),G[ca]=ya,r(ba,ca,x[0],x[1],x[2]),r(aa,ca,N[0],N[1],N[2]),++ca;return new e.LabelRenderParams(new Float32Array(G),ja,P,U,10,ba,aa)}generatePointScaleFactorArray(t,x,A,F){if(null==t)return new Float32Array(0);t=new Float32Array(t.points.length);t.fill(1);const N=null==A?0:A.length;
{const I=null==x?0:x.length;for(let aa=0;aa<I;++aa)t[x[aa]]=1.2}for(x=0;x<N;++x)t[A[x].index]=1.2;null!=F&&(t[F]=1.2);return t}generateLineSegmentColorMap(t,x){let A={};if(null==t)return A;for(let aa=0;aa<t.sequences.length;aa++){let G=t.sequences[aa],P=new Float32Array(6*(G.pointIndices.length-1)),U=0;if(x)for(var F=0;F<G.pointIndices.length-1;F++){var N=new THREE.Color(x(t,G.pointIndices[F])),I=new THREE.Color(x(t,G.pointIndices[F+1]));P[U++]=N.r;P[U++]=N.g;P[U++]=N.b;P[U++]=I.r;P[U++]=I.g;P[U++]=
I.b}else for(F=0;F<G.pointIndices.length-1;F++)N=n(F,G.pointIndices.length),I=n(F+1,G.pointIndices.length),P[U++]=N.r,P[U++]=N.g,P[U++]=N.b,P[U++]=I.r,P[U++]=I.g,P[U++]=I.b;A[aa]=P}return A}generateLineSegmentOpacityArray(t,x){if(null==t)return new Float32Array(0);const A=new Float32Array(t.sequences.length);0<(null==x?0:x.length)?(A.fill(.05),A[t.points[x[0]].sequenceIndex]=.9):A.fill(.2);return A}generateLineSegmentWidthArray(t,x){if(null==t)return new Float32Array(0);const A=new Float32Array(t.sequences.length);
A.fill(2);0<(null==x?0:x.length)&&(A[t.points[x[0]].sequenceIndex]=3);return A}generatePointColorArray(t,x,A,F,N,I,aa,G){if(null==t)return new Float32Array(0);var P=null==F?0:F.length;const U=null==N?0:N.length,ba=new Float32Array(3*t.points.length);var ja=14935011,ca=7697881;aa&&(ca=ja=16777215);G&&(ca=ja=16777215);aa=t.points.length;G=0;if(0<P)for(t=new THREE.Color(ja),x=0;x<aa;++x)ba[G++]=t.r,ba[G++]=t.g,ba[G++]=t.b;else if(null!=x)for(ja=0;ja<aa;++ja)ca=new THREE.Color(x(t,ja)),ba[G++]=ca.r,ba[G++]=
ca.g,ba[G++]=ca.b;else for(t=new THREE.Color(ca),x=0;x<aa;++x)ba[G++]=t.r,ba[G++]=t.g,ba[G++]=t.b;aa=new THREE.Color(16410214);for(G=0;G<P;++G)t=3*F[G],ba[t++]=aa.r,ba[t++]=aa.g,ba[t++]=aa.b;F=0<U?N[0].dist:0;for(P=0;P<U;++P)aa=new THREE.Color(v(A,N[P].dist,F)),G=3*N[P].index,ba[G++]=aa.r,ba[G++]=aa.g,ba[G++]=aa.b;null!=I&&(A=new THREE.Color(7736143),I*=3,ba[I++]=A.r,ba[I++]=A.g,ba[I++]=A.b);return ba}generate3DLabelsArray(t,x){if(null==t||null==x)return null;let A=[];const F=t.points.length;for(let N=
0;N<F;++N)A.push(this.getLabelText(t,N,x));return A}getLabelText(t,x,A){return void 0!==t.points[x].metadata[A]?String(t.points[x].metadata[A]):`Unknown #${x}`}updateScatterPlotWithNewProjection(t){null==t?(this.createVisualizers(this.renderLabelsIn3D),this.scatterPlot.render()):(this.setDataSet(t.dataSet),this.scatterPlot.setDimensions(t.dimensionality),t.dataSet.projectionCanBeRendered(t.projectionType)&&(this.updateScatterPlotAttributes(),this.notifyProjectionPositionsUpdated()),this.scatterPlot.setCameraParametersForNextCameraCreation(null,
!1))}createVisualizers(t){const x=null==this.projection?null:this.projection.dataSet,A=this.scatterPlot;A.removeAllVisualizers();this.polylineVisualizer=this.spriteVisualizer=this.canvasLabelsVisualizer=this.labels3DVisualizer=null;t?(this.labels3DVisualizer=new e.ScatterPlotVisualizer3DLabels,this.labels3DVisualizer.setLabelStrings(this.generate3DLabelsArray(x,this.labelPointAccessor))):(this.spriteVisualizer=new e.ScatterPlotVisualizerSprites,A.addVisualizer(this.spriteVisualizer),this.canvasLabelsVisualizer=
new e.ScatterPlotVisualizerCanvasLabels(this.scatterPlotContainer));this.polylineVisualizer=new e.ScatterPlotVisualizerPolylines;this.setDataSet(x);this.spriteVisualizer&&A.addVisualizer(this.spriteVisualizer);this.labels3DVisualizer&&A.addVisualizer(this.labels3DVisualizer);this.canvasLabelsVisualizer&&A.addVisualizer(this.canvasLabelsVisualizer);A.addVisualizer(this.polylineVisualizer)}getSpriteImageMode(){if(null==this.projection)return!1;const t=this.projection.dataSet;return null==t||null==t.spriteAndMetadataInfo?
!1:null!=t.spriteAndMetadataInfo.spriteImage}}e.ProjectorScatterPlotAdapter=E;e.normalizeDist=p;e.dist2color=v})(yi||(yi={}));

//# sourceURL=build://vz-projector/vz-projector-util.js
(function(e){e.PolymerElement=function(r){return Polymer.Class(r)}})(yi||(yi={}));

//# sourceURL=build://iron-autogrow-textarea/iron-autogrow-textarea.html.js
Polymer({is:"iron-autogrow-textarea",behaviors:[Polymer.IronValidatableBehavior,Polymer.IronControlState],properties:{value:{observer:"_valueChanged",type:String,notify:!0},bindValue:{observer:"_bindValueChanged",type:String,notify:!0},rows:{type:Number,value:1,observer:"_updateCached"},maxRows:{type:Number,value:0,observer:"_updateCached"},autocomplete:{type:String,value:"off"},autofocus:{type:Boolean,value:!1},inputmode:{type:String},placeholder:{type:String},readonly:{type:String},required:{type:Boolean},
minlength:{type:Number},maxlength:{type:Number},label:{type:String}},listeners:{input:"_onInput"},get textarea(){return this.$.textarea},get selectionStart(){return this.$.textarea.selectionStart},get selectionEnd(){return this.$.textarea.selectionEnd},set selectionStart(e){this.$.textarea.selectionStart=e},set selectionEnd(e){this.$.textarea.selectionEnd=e},attached:function(){navigator.userAgent.match(/iP(?:[oa]d|hone)/)&&(this.$.textarea.style.marginLeft="-3px")},validate:function(){var e=this.$.textarea.validity.valid;
e&&(this.required&&""===this.value?e=!1:this.hasValidator()&&(e=Polymer.IronValidatableBehavior.validate.call(this,this.value)));this.invalid=!e;this.fire("iron-input-validate");return e},_bindValueChanged:function(e){this.value=e},_valueChanged:function(e){var r=this.textarea;r&&(r.value!==e&&(r.value=e||0===e?e:""),this.bindValue=e,this.$.mirror.innerHTML=this._valueForMirror(),this.fire("bind-value-changed",{value:this.bindValue}))},_onInput:function(e){var r=Polymer.dom(e).path;this.value=r?r[0].value:
e.target.value},_constrain:function(e){e=e||[""];for(e=0<this.maxRows&&e.length>this.maxRows?e.slice(0,this.maxRows):e.slice(0);0<this.rows&&e.length<this.rows;)e.push("");return e.join("\x3cbr/\x3e")+"\x26#160;"},_valueForMirror:function(){var e=this.textarea;if(e)return this.tokens=e&&e.value?e.value.replace(/&/gm,"\x26amp;").replace(/"/gm,"\x26quot;").replace(/'/gm,"\x26#39;").replace(/</gm,"\x26lt;").replace(/>/gm,"\x26gt;").split("\n"):[""],this._constrain(this.tokens)},_updateCached:function(){this.$.mirror.innerHTML=
this._constrain(this.tokens)}});

//# sourceURL=build://paper-input/paper-textarea.html.js
Polymer({is:"paper-textarea",behaviors:[Polymer.PaperInputBehavior,Polymer.IronFormElementBehavior],properties:{_ariaLabelledBy:{observer:"_ariaLabelledByChanged",type:String},_ariaDescribedBy:{observer:"_ariaDescribedByChanged",type:String},value:{type:String},rows:{type:Number,value:1},maxRows:{type:Number,value:0}},get selectionStart(){return this.$.input.textarea.selectionStart},set selectionStart(e){this.$.input.textarea.selectionStart=e},get selectionEnd(){return this.$.input.textarea.selectionEnd},
set selectionEnd(e){this.$.input.textarea.selectionEnd=e},_ariaLabelledByChanged:function(e){this._focusableElement.setAttribute("aria-labelledby",e)},_ariaDescribedByChanged:function(e){this._focusableElement.setAttribute("aria-describedby",e)},get _focusableElement(){return this.inputElement.textarea}});

//# sourceURL=build://vz-projector/vz-projector-bookmark-panel.js
(function(e){e.BookmarkPanelPolymer=e.PolymerElement({is:"vz-projector-bookmark-panel",properties:{savedStates:Object,hasStates:{type:Boolean,value:!1},selectedState:Number}});class r extends e.BookmarkPanelPolymer{constructor(){super(...arguments);this.hasStates=!1}ready(){super.ready();this.savedStates=[];this.setupUploadButton();this.ignoreNextProjectionEvent=!1;this.expandLessButton=this.$$("#expand-less");this.expandMoreButton=this.$$("#expand-more")}initialize(k,n){this.projector=k;n.registerProjectionChangedListener(()=>
{this.ignoreNextProjectionEvent?this.ignoreNextProjectionEvent=!1:this.clearStateSelection()})}setSelectedTensor(k,n,p){this.addStates(null);n&&n.bookmarksPath?p.getBookmarks(k,n.tensorName,v=>{this.addStates(v);this._expandMore()}):this._expandLess()}_expandMore(){this.$.panel.show();this.expandMoreButton.style.display="none";this.expandLessButton.style.display=""}_expandLess(){this.$.panel.hide();this.expandMoreButton.style.display="";this.expandLessButton.style.display="none"}_addBookmark(){let k=
this.projector.getCurrentState();k.label="State "+this.savedStates.length;k.isSelected=!0;this.selectedState=this.savedStates.length;for(let n=0;n<this.savedStates.length;n++)this.savedStates[n].isSelected=!1,this.notifyPath("savedStates."+n+".isSelected",!1,!1);this.push("savedStates",k);this.updateHasStates()}_downloadFile(){var k=this.serializeAllSavedStates();k=window.URL.createObjectURL(new Blob([k],{type:"text/plain"}));let n=document.createElement("a");document.body.appendChild(n);n.style.display=
"none";n.href=k;n.download="state";n.click();document.body.removeChild(n);window.URL.revokeObjectURL(k)}_uploadFile(){this.$$("#state-file").click()}setupUploadButton(){const k=this.$$("#state-file");k.onchange=()=>{const n=k.files[0];k.value="";const p=new FileReader;p.onload=()=>{const v=JSON.parse(p.result);this.savedStatesValid(v)?(this.addStates(v),this.loadSavedState(0)):e.logging.setWarningMessage("Unable to load bookmarks: wrong dataset, expected dataset "+`with shape (${v[0].dataSetDimensions}).`)};
p.readAsText(n)}}addStates(k){if(null==k)this.savedStates=[];else for(let n=0;n<k.length;n++)k[n].isSelected=!1,this.push("savedStates",k[n]);this.updateHasStates()}clearStateSelection(){for(let k=0;k<this.savedStates.length;k++)this.setSelectionState(k,!1)}_radioButtonHandler(k){k=this.getParentDataIndex(k);this.loadSavedState(k);this.setSelectionState(k,!0)}loadSavedState(k){for(let n=0;n<this.savedStates.length;n++)this.savedStates[n].isSelected?this.setSelectionState(n,!1):k===n&&(this.setSelectionState(n,
!0),this.ignoreNextProjectionEvent=!0,this.projector.loadState(this.savedStates[n]))}setSelectionState(k,n){this.savedStates[k].isSelected=n;this.notifyPath("savedStates."+k+".isSelected",n,!1)}getParentDataIndex(k){for(let n=0;n<k.path.length;n++){let p=k.path[n].getAttribute("data-index");if(null!=p)return+p}return-1}_clearButtonHandler(k){k=this.getParentDataIndex(k);this.splice("savedStates",k,1);this.updateHasStates()}_labelChange(k){let n=this.getParentDataIndex(k);this.savedStates[n].label=
k.target.value}_isSelectedState(k){return k===this.selectedState}_isNotSelectedState(k){return k!==this.selectedState}serializeAllSavedStates(){return JSON.stringify(this.savedStates)}loadSavedStates(k){this.savedStates=JSON.parse(k);this.updateHasStates()}updateHasStates(){this.hasStates=0!==this.savedStates.length}savedStatesValid(k){for(let n=0;n<k.length;n++)if(k[n].dataSetDimensions[0]!==this.projector.dataSet.dim[0]||k[n].dataSetDimensions[1]!==this.projector.dataSet.dim[1])return!1;return!0}}
e.BookmarkPanel=r;customElements.define(r.prototype.is,r)})(yi||(yi={}));

//# sourceURL=build://iron-dropdown/iron-dropdown-scroll-manager.html.js
(function(){Polymer.IronDropdownScrollManager=Polymer.IronScrollManager})();

//# sourceURL=build://iron-dropdown/iron-dropdown.html.js
(function(){Polymer({is:"iron-dropdown",behaviors:[Polymer.IronControlState,Polymer.IronA11yKeysBehavior,Polymer.IronOverlayBehavior,Polymer.NeonAnimationRunnerBehavior],properties:{horizontalAlign:{type:String,value:"left",reflectToAttribute:!0},verticalAlign:{type:String,value:"top",reflectToAttribute:!0},openAnimationConfig:{type:Object},closeAnimationConfig:{type:Object},focusTarget:{type:Object},noAnimations:{type:Boolean,value:!1},allowOutsideScroll:{type:Boolean,value:!1,observer:"_allowOutsideScrollChanged"}},
listeners:{"neon-animation-finish":"_onNeonAnimationFinish"},observers:["_updateOverlayPosition(positionTarget, verticalAlign, horizontalAlign, verticalOffset, horizontalOffset)"],get containedElement(){for(var e=Polymer.dom(this.$.content).getDistributedNodes(),r=0,k=e.length;r<k;r++)if(e[r].nodeType===Node.ELEMENT_NODE)return e[r]},ready:function(){this.scrollAction||(this.scrollAction=this.allowOutsideScroll?"refit":"lock");this._readied=!0},attached:function(){this.sizingTarget&&this.sizingTarget!==
this||(this.sizingTarget=this.containedElement||this)},detached:function(){this.cancelAnimation()},_openedChanged:function(){this.opened&&this.disabled?this.cancel():(this.cancelAnimation(),this._updateAnimationConfig(),Polymer.IronOverlayBehaviorImpl._openedChanged.apply(this,arguments))},_renderOpened:function(){!this.noAnimations&&this.animationConfig.open?(this.$.contentWrapper.classList.add("animating"),this.playAnimation("open")):Polymer.IronOverlayBehaviorImpl._renderOpened.apply(this,arguments)},
_renderClosed:function(){!this.noAnimations&&this.animationConfig.close?(this.$.contentWrapper.classList.add("animating"),this.playAnimation("close")):Polymer.IronOverlayBehaviorImpl._renderClosed.apply(this,arguments)},_onNeonAnimationFinish:function(){this.$.contentWrapper.classList.remove("animating");this.opened?this._finishRenderOpened():this._finishRenderClosed()},_updateAnimationConfig:function(){for(var e=this.containedElement,r=[].concat(this.openAnimationConfig||[]).concat(this.closeAnimationConfig||
[]),k=0;k<r.length;k++)r[k].node=e;this.animationConfig={open:this.openAnimationConfig,close:this.closeAnimationConfig}},_updateOverlayPosition:function(){this.isAttached&&this.notifyResize()},_allowOutsideScrollChanged:function(e){this._readied&&(e?this.scrollAction&&"lock"!==this.scrollAction||(this.scrollAction="refit"):this.scrollAction="lock")},_applyFocus:function(){var e=this.focusTarget||this.containedElement;e&&this.opened&&!this.noAutoFocus?e.focus():Polymer.IronOverlayBehaviorImpl._applyFocus.apply(this,
arguments)}})})();

//# sourceURL=build://neon-animation/neon-animation-behavior.html.js
Polymer.NeonAnimationBehavior={properties:{animationTiming:{type:Object,value:function(){return{duration:500,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"both"}}}},isNeonAnimation:!0,created:function(){document.body.animate||console.warn("No web animations detected. This element will not function without a web animations polyfill.")},timingFromConfig:function(e){if(e.timing)for(var r in e.timing)this.animationTiming[r]=e.timing[r];return this.animationTiming},setPrefixedProperty:function(e,r,k){for(var n=
{transform:["webkitTransform"],transformOrigin:["mozTransformOrigin","webkitTransformOrigin"]}[r],p,v=0;p=n[v];v++)e.style[p]=k;e.style[r]=k},complete:function(){}};

//# sourceURL=build://neon-animation/animations/fade-in-animation.html.js
Polymer({is:"fade-in-animation",behaviors:[Polymer.NeonAnimationBehavior],configure:function(e){return this._effect=new KeyframeEffect(e.node,[{opacity:"0"},{opacity:"1"}],this.timingFromConfig(e))}});

//# sourceURL=build://neon-animation/animations/fade-out-animation.html.js
Polymer({is:"fade-out-animation",behaviors:[Polymer.NeonAnimationBehavior],configure:function(e){return this._effect=new KeyframeEffect(e.node,[{opacity:"1"},{opacity:"0"}],this.timingFromConfig(e))}});

//# sourceURL=build://paper-menu-button/paper-menu-button-animations.html.js
Polymer({is:"paper-menu-grow-height-animation",behaviors:[Polymer.NeonAnimationBehavior],configure:function(e){var r=e.node,k=r.getBoundingClientRect().height;return this._effect=new KeyframeEffect(r,[{height:k/2+"px"},{height:k+"px"}],this.timingFromConfig(e))}});Polymer({is:"paper-menu-grow-width-animation",behaviors:[Polymer.NeonAnimationBehavior],configure:function(e){var r=e.node,k=r.getBoundingClientRect().width;return this._effect=new KeyframeEffect(r,[{width:k/2+"px"},{width:k+"px"}],this.timingFromConfig(e))}});
Polymer({is:"paper-menu-shrink-width-animation",behaviors:[Polymer.NeonAnimationBehavior],configure:function(e){var r=e.node,k=r.getBoundingClientRect().width;return this._effect=new KeyframeEffect(r,[{width:k+"px"},{width:k-k/20+"px"}],this.timingFromConfig(e))}});
Polymer({is:"paper-menu-shrink-height-animation",behaviors:[Polymer.NeonAnimationBehavior],configure:function(e){var r=e.node,k=r.getBoundingClientRect().height;this.setPrefixedProperty(r,"transformOrigin","0 0");return this._effect=new KeyframeEffect(r,[{height:k+"px",transform:"translateY(0)"},{height:k/2+"px",transform:"translateY(-20px)"}],this.timingFromConfig(e))}});

//# sourceURL=build://paper-menu-button/paper-menu-button.html.js
(function(){var e={ANIMATION_CUBIC_BEZIER:"cubic-bezier(.3,.95,.5,1)",MAX_ANIMATION_TIME_MS:400};Polymer.PaperMenuButton=function(){};Polymer.PaperMenuButton.prototype.registered=function(){};Polymer.PaperMenuButton.prototype.addOwnKeyBinding=function(){};Polymer.PaperMenuButton.prototype.removeOwnKeyBindings=function(){};Polymer.PaperMenuButton.prototype.keyboardEventMatchesKeys=function(){};Polymer.PaperMenuButton.prototype._collectKeyBindings=function(){};Polymer.PaperMenuButton.prototype._prepKeyBindings=
function(){};Polymer.PaperMenuButton.prototype._addKeyBinding=function(){};Polymer.PaperMenuButton.prototype._resetKeyEventListeners=function(){};Polymer.PaperMenuButton.prototype._listenKeyEventListeners=function(){};Polymer.PaperMenuButton.prototype._unlistenKeyEventListeners=function(){};Polymer.PaperMenuButton.prototype._onKeyBindingEvent=function(){};Polymer.PaperMenuButton.prototype._triggerKeyHandler=function(){};Polymer.PaperMenuButton.prototype._focusBlurHandler=function(r){if(Polymer.Element)this._setFocused("focus"===
r.type);else if(r.target===this)this._setFocused("focus"===r.type);else if(this.__handleEventRetargeting){var k=Polymer.dom(r).localTarget;this.isLightDescendant(k)||this.fire(r.type,{sourceEvent:r},{node:this,bubbles:r.bubbles,cancelable:r.cancelable})}};Polymer.PaperMenuButton.prototype._changedControlState=function(){this._controlStateChanged&&this._controlStateChanged()};Polymer.PaperMenuButton.prototype._setFocused=function(){};Polymer.PaperMenuButton=Polymer({is:"paper-menu-button",behaviors:[Polymer.IronA11yKeysBehavior,
Polymer.IronControlState],properties:{opened:{type:Boolean,value:!1,notify:!0,observer:"_openedChanged"},horizontalAlign:{type:String,value:"left",reflectToAttribute:!0},verticalAlign:{type:String,value:"top",reflectToAttribute:!0},dynamicAlign:{type:Boolean},horizontalOffset:{type:Number,value:0,notify:!0},verticalOffset:{type:Number,value:0,notify:!0},noOverlap:{type:Boolean},noAnimations:{type:Boolean,value:!1},ignoreSelect:{type:Boolean,value:!1},closeOnActivate:{type:Boolean,value:!1},openAnimationConfig:{type:Object,
value:function(){return[{name:"fade-in-animation",timing:{delay:100,duration:200}},{name:"paper-menu-grow-width-animation",timing:{delay:100,duration:150,easing:e.ANIMATION_CUBIC_BEZIER}},{name:"paper-menu-grow-height-animation",timing:{delay:100,duration:275,easing:e.ANIMATION_CUBIC_BEZIER}}]}},closeAnimationConfig:{type:Object,value:function(){return[{name:"fade-out-animation",timing:{duration:150}},{name:"paper-menu-shrink-width-animation",timing:{delay:100,duration:50,easing:e.ANIMATION_CUBIC_BEZIER}},
{name:"paper-menu-shrink-height-animation",timing:{duration:200,easing:"ease-in"}}]}},allowOutsideScroll:{type:Boolean,value:!1},restoreFocusOnClose:{type:Boolean,value:!0},_dropdownContent:{type:Object}},hostAttributes:{role:"group","aria-haspopup":"true"},listeners:{"iron-activate":"_onIronActivate","iron-select":"_onIronSelect"},get contentElement(){for(var r=Polymer.dom(this.$.content).getDistributedNodes(),k=0,n=r.length;k<n;k++)if(r[k].nodeType===Node.ELEMENT_NODE)return r[k]},toggle:function(){this.opened?
this.close():this.open()},open:function(){this.disabled||this.$.dropdown.open()},close:function(){this.$.dropdown.close()},_onIronSelect:function(){this.ignoreSelect||this.close()},_onIronActivate:function(){this.closeOnActivate&&this.close()},_openedChanged:function(r,k){r?(this._dropdownContent=this.contentElement,this.fire("paper-dropdown-open")):null!=k&&this.fire("paper-dropdown-close")},_disabledChanged:function(r){Polymer.IronControlState._disabledChanged.apply(this,arguments);r&&this.opened&&
this.close()},__onIronOverlayCanceled:function(r){var k=this.$.trigger;-1<Polymer.dom(r.detail).path.indexOf(k)&&r.preventDefault()}});Object.keys(e).forEach(function(r){Polymer.PaperMenuButton[r]=e[r]})})();

//# sourceURL=build://paper-dropdown-menu/paper-dropdown-menu.html.js
(function(){Polymer({is:"paper-dropdown-menu",behaviors:[Polymer.IronButtonState,Polymer.IronControlState,Polymer.IronFormElementBehavior,Polymer.IronValidatableBehavior],properties:{selectedItemLabel:{type:String,notify:!0,readOnly:!0},selectedItem:{type:Object,notify:!0,readOnly:!0},value:{type:String,notify:!0},label:{type:String},placeholder:{type:String},errorMessage:{type:String},opened:{type:Boolean,notify:!0,value:!1,observer:"_openedChanged"},allowOutsideScroll:{type:Boolean,value:!1},noLabelFloat:{type:Boolean,
value:!1,reflectToAttribute:!0},alwaysFloatLabel:{type:Boolean,value:!1},noAnimations:{type:Boolean,value:!1},horizontalAlign:{type:String,value:"right"},verticalAlign:{type:String,value:"top"},verticalOffset:Number,dynamicAlign:{type:Boolean},restoreFocusOnClose:{type:Boolean,value:!0}},listeners:{tap:"_onTap"},keyBindings:{"up down":"open",esc:"close"},hostAttributes:{role:"combobox","aria-autocomplete":"none","aria-haspopup":"true"},observers:["_selectedItemChanged(selectedItem)"],attached:function(){var e=
this.contentElement;e&&e.selectedItem&&this._setSelectedItem(e.selectedItem)},get contentElement(){for(var e=Polymer.dom(this.$.content).getDistributedNodes(),r=0,k=e.length;r<k;r++)if(e[r].nodeType===Node.ELEMENT_NODE)return e[r]},open:function(){this.$.menuButton.open()},close:function(){this.$.menuButton.close()},_onIronSelect:function(e){this._setSelectedItem(e.detail.item)},_onIronDeselect:function(){this._setSelectedItem(null)},_onTap:function(e){Polymer.Gestures.findOriginalTarget(e)===this&&
this.open()},_selectedItemChanged:function(e){this.value=e=e?e.label||e.getAttribute("label")||e.textContent.trim():"";this._setSelectedItemLabel(e)},_computeMenuVerticalOffset:function(e,r){return r?r:e?-4:8},_getValidity:function(){return this.disabled||!this.required||this.required&&!!this.value},_openedChanged:function(){var e=this.opened?"true":"false",r=this.contentElement;r&&r.setAttribute("aria-expanded",e)}})})();

//# sourceURL=build://vz-projector/vz-projector-legend.js
(function(e){e.LegendPolymer=e.PolymerElement({is:"vz-projector-legend",properties:{renderInfo:{type:Object,observer:"_renderInfoChanged"}}});class r extends e.LegendPolymer{_renderInfoChanged(){null!=this.renderInfo&&this.renderInfo.thresholds&&this.async(()=>this.setupLinearGradient())}_getLastThreshold(){if(null!=this.renderInfo&&null!=this.renderInfo.thresholds)return this.renderInfo.thresholds[this.renderInfo.thresholds.length-1].value}getOffset(k){const n=this.renderInfo.thresholds[0].value;
return(100*(k-n)/(this.renderInfo.thresholds[this.renderInfo.thresholds.length-1].value-n)).toFixed(2)+"%"}setupLinearGradient(){const k=this.$$("#gradient"),n=this.$$("svg.gradient").clientWidth;this.$$("svg.gradient rect").style.width=n+"px";k.innerHTML="";this.renderInfo.thresholds.forEach(p=>{const v=document.createElementNS("http://www.w3.org/2000/svg","stop");v.setAttribute("offset",this.getOffset(p.value));v.setAttribute("stop-color",p.color)})}}e.Legend=r;customElements.define(r.prototype.is,
r)})(yi||(yi={}));

//# sourceURL=build://vz-projector/vz-projector-data-panel.js
(function(e){e.DataPanelPolymer=e.PolymerElement({is:"vz-projector-data-panel",properties:{selectedTensor:{type:String,observer:"_selectedTensorChanged"},selectedRun:String,selectedColorOptionName:{type:String,notify:!0,observer:"_selectedColorOptionNameChanged"},selectedLabelOption:{type:String,notify:!0,observer:"_selectedLabelOptionChanged"},normalizeData:Boolean,showForceCategoricalColorsCheckbox:Boolean,metadataEditorInput:{type:String},metadataEditorInputLabel:{type:String,value:"Tag selection as"},
metadataEditorInputChange:{type:Object},metadataEditorColumn:{type:String},metadataEditorColumnChange:{type:Object},metadataEditorButtonClicked:{type:Object},metadataEditorButtonDisabled:{type:Boolean},downloadMetadataClicked:{type:Boolean},superviseInput:{type:String},superviseInputTyping:{type:Object},superviseInputChange:{type:Object},superviseInputLabel:{type:String,value:"Ignored label"},superviseColumn:{type:String},superviseColumnChanged:{type:Object},showSuperviseSettings:{type:Boolean,value:!1}},
observers:["_generateUiForNewCheckpointForRun(selectedRun)"]});class r extends e.DataPanelPolymer{constructor(){super(...arguments);this.forceCategoricalColoring=!1}ready(){super.ready();this.normalizeData=!0;this.superviseInputSelected=""}initialize(k,n){this.projector=k;this.dataProvider=n;this.setupUploadButtons();this.$$("#normalize-data-checkbox").addEventListener("change",()=>{this.projector.setNormalizeData(this.normalizeData)});let p=this.$$("#force-categorical-checkbox");p.addEventListener("change",
()=>{this.setForceCategoricalColoring(p.checked)});this.dataProvider.retrieveRuns(v=>{this.runNames=v;0<this.runNames.length&&(this.selectedRun!=v[0]?this.selectedRun=v[0]:this._generateUiForNewCheckpointForRun(this.selectedRun))})}setForceCategoricalColoring(k){this.forceCategoricalColoring=k;this.$$("#force-categorical-checkbox").checked=this.forceCategoricalColoring;this.updateMetadataUI(this.spriteAndMetadata.stats,this.metadataFile);this._selectedColorOptionNameChanged()}getSeparatorClass(k){return k?
"separator":null}metadataChanged(k,n){this.spriteAndMetadata=k;null!=n&&(this.metadataFile=n);this.updateMetadataUI(this.spriteAndMetadata.stats,this.metadataFile);if(null==this.selectedColorOptionName||0===this.colorOptions.filter(v=>v.name===this.selectedColorOptionName).length)this.selectedColorOptionName=this.colorOptions[0].name;let p=-1;this.metadataFields=k.stats.map((v,z)=>{v.isNumeric||-1!==p||(p=z);return v.name});if(null==this.metadataEditorColumn||0===this.metadataFields.filter(v=>v===
this.metadataEditorColumn).length)this.metadataEditorColumn=this.metadataFields[Math.max(0,p)];if(null==this.superviseColumn||0===this.metadataFields.filter(v=>v===this.superviseColumn).length)this.superviseColumn=this.metadataFields[Math.max(0,p)],this.superviseInput="";this.superviseInputChange()}projectionChanged(k){if(k)switch(k.projectionType){case "tsne":this.set("showSuperviseSettings",!0);break;default:this.set("showSuperviseSettings",!1)}}onProjectorSelectionChanged(k,n){this.selectedPointIndices=
k;this.neighborsOfFirstPoint=n;this.metadataEditorInputChange()}addWordBreaks(k){return null==k?"":k.replace(/([\/=-_,])/g,"$1\x3cwbr\x3e")}updateMetadataUI(k,n){const p=this.$$("#metadata-file");p.innerHTML=this.addWordBreaks(n);p.title=n;let v=-1;this.labelOptions=k.map((z,E)=>{z.isNumeric||-1!==v||(v=E);return z.name});if(null==this.selectedLabelOption||0===this.labelOptions.filter(z=>z===this.selectedLabelOption).length)this.selectedLabelOption=this.labelOptions[Math.max(0,v)];if(null==this.metadataEditorColumn||
0===this.labelOptions.filter(z=>z===this.metadataEditorColumn).length)this.metadataEditorColumn=this.labelOptions[Math.max(0,v)];n=[{name:"No color map"}];k=k.filter(z=>!z.tooManyUniqueValues||z.isNumeric).map(z=>{let E,t;if(this.forceCategoricalColoring||!z.tooManyUniqueValues){var x=d3.scaleOrdinal(d3.schemeCategory10);let F=x.range();var A=F.map((N,I)=>F[3*I%F.length]);E=z.uniqueEntries;x.range(A).domain(E.map(N=>N.label));A=z.uniqueEntries.length;A=`${A} ${A>F.length?" non-unique":""} `+"colors"}else t=
[{color:"#ffffdd",value:z.min},{color:"#1f2d86",value:z.max}],x=d3.scaleLinear().domain(t.map(F=>F.value)).range(t.map(F=>F.color)),A="gradient";return{name:z.name,desc:A,map:x,items:E,thresholds:t,tooManyUniqueValues:z.tooManyUniqueValues}});0<k.length&&n.push({name:"Metadata",isSeparator:!0});this.colorOptions=n.concat(k)}metadataEditorContext(k){this.metadataEditorButtonDisabled=!k;this.projector&&this.projector.metadataEditorContext(k,this.metadataEditorColumn)}metadataEditorInputChange(){let k=
this.metadataEditorColumn,n=this.metadataEditorInput,p=this.selectedPointIndices.length+this.neighborsOfFirstPoint.length;0<p?null!=n&&""!==n.trim()?this.spriteAndMetadata.stats.filter(v=>v.name===k)[0].isNumeric&&isNaN(+n)?(this.metadataEditorInputLabel="Label must be numeric",this.metadataEditorContext(!1)):(0===this.projector.dataSet.points.filter(v=>v.metadata[k].toString()===n.trim()).length?this.metadataEditorInputLabel=`Tag ${p} with new label`:this.metadataEditorInputLabel=`Tag ${p} points as`,
this.metadataEditorContext(!0)):(this.metadataEditorInputLabel="Tag selection as",this.metadataEditorContext(!1)):(this.metadataEditorContext(!1),null!=n&&""!==n.trim()?this.metadataEditorInputLabel="Select points to tag":this.metadataEditorInputLabel="Tag selection as")}metadataEditorInputKeydown(k){13===k.keyCode&&this.metadataEditorButtonClicked();k.stopPropagation()}metadataEditorColumnChange(){this.metadataEditorInputChange()}metadataEditorButtonClicked(){if(!this.metadataEditorButtonDisabled){let k=
this.metadataEditorInput.trim(),n=this.selectedPointIndices.length+this.neighborsOfFirstPoint.length;this.projector.metadataEdit(this.metadataEditorColumn,k);this.projector.metadataEditorContext(!0,this.metadataEditorColumn);this.metadataEditorInputLabel=`${n} labeled as '${k}'`}}downloadMetadataClicked(){if(this.projector&&this.projector.dataSet&&this.projector.dataSet.spriteAndMetadataInfo){let k=this.projector.dataSet.spriteAndMetadataInfo.stats.map(p=>p.name).join("\t");this.projector.dataSet.spriteAndMetadataInfo.pointsInfo.forEach(p=>
{let v=[];for(const z in p)v.push(p[z]);k+="\n"+v.join("\t")});const n=new Blob([k],{type:"text/plain"});this.$.downloadMetadataLink.download="metadata-edited.tsv";this.$.downloadMetadataLink.href=window.URL.createObjectURL(n);this.$.downloadMetadataLink.click()}}superviseInputTyping(){let k=this.superviseInput.trim();if(null==k||""===k.trim())this.superviseInputLabel=""===this.superviseInputSelected?"No ignored label":`Supervising without '${this.superviseInputSelected}'`;else if(this.projector&&
this.projector.dataSet){let n=this.projector.dataSet.points.filter(p=>p.metadata[this.superviseColumn].toString().trim()===k).length;0===n?this.superviseInputLabel="Label not found":this.projector.dataSet.superviseInput!=k&&(this.superviseInputLabel=`Supervise without '${k}' [${n} points]`)}}superviseInputChange(){let k=this.superviseInput.trim();if(null==k||""===k.trim())this.superviseInputSelected="",this.superviseInputLabel="No ignored label",this.setSupervision(this.superviseColumn,"");else if(this.projector&&
this.projector.dataSet){let n=this.projector.dataSet.points.filter(p=>p.metadata[this.superviseColumn].toString().trim()===k).length;0===n?this.superviseInputLabel=`Supervising without '${this.superviseInputSelected}'`:(this.superviseInputSelected=k,this.superviseInputLabel=`Supervising without '${k}' [${n} points]`,this.setSupervision(this.superviseColumn,k))}}superviseColumnChanged(){this.superviseInput="";this.superviseInputChange()}setSupervision(k,n){this.projector&&this.projector.dataSet&&this.projector.dataSet.setSupervision(k,
n)}setNormalizeData(k){this.normalizeData=k}_selectedTensorChanged(){this.projector.updateDataSet(null,null,null);null!=this.selectedTensor&&(this.dataProvider.retrieveTensor(this.selectedRun,this.selectedTensor,k=>{let n=this.getEmbeddingInfoByName(this.selectedTensor).metadataPath;this.dataProvider.retrieveSpriteAndMetadata(this.selectedRun,this.selectedTensor,p=>{this.projector.updateDataSet(k,p,n)})}),this.projector.setSelectedTensor(this.selectedRun,this.getEmbeddingInfoByName(this.selectedTensor)))}_generateUiForNewCheckpointForRun(k){this.dataProvider.retrieveProjectorConfig(k,
n=>{this.projectorConfig=n;n=this.projectorConfig.embeddings.map(z=>z.tensorName).filter(z=>{z=this.getEmbeddingInfoByName(z).tensorShape;return 2===z.length&&1<z[0]&&1<z[1]}).sort((z,E)=>{var t=this.getEmbeddingInfoByName(z),x=this.getEmbeddingInfoByName(E);if(e.util.xor(!!t.metadataPath,!!x.metadataPath))return t.metadataPath?-1:1;let A=e.util.tensorIsGenerated(E);if(e.util.xor(e.util.tensorIsGenerated(z),A))return A?-1:1;t=t.tensorShape[0];x=x.tensorShape[0];return t!==x?x-t:z<=E?-1:1});this.tensorNames=
n.map(z=>({name:z,shape:this.getEmbeddingInfoByName(z).tensorShape}));const p=this.addWordBreaks(this.projectorConfig.modelCheckpointPath),v=this.$$("#checkpoint-file");v.innerHTML=p;v.title=this.projectorConfig.modelCheckpointPath;n="demo"===this.projector.servingMode?this.projectorConfig.embeddings[0].tensorName:n[0];this.selectedTensor===n?this._selectedTensorChanged():this.selectedTensor=n})}_selectedLabelOptionChanged(){this.projector.setSelectedLabelOption(this.selectedLabelOption)}_selectedColorOptionNameChanged(){let k;
for(let n=0;n<this.colorOptions.length;n++)if(this.colorOptions[n].name===this.selectedColorOptionName){k=this.colorOptions[n];break}k&&(this.showForceCategoricalColorsCheckbox=!!k.tooManyUniqueValues,this.colorLegendRenderInfo=null==k.map?null:k.items?{items:k.items.map(n=>({color:k.map(n.label),label:n.label,count:n.count})),thresholds:null}:{items:null,thresholds:k.thresholds},this.projector.setSelectedColorOption(k))}tensorWasReadFromFile(k,n){e.parseRawTensors(k,p=>{const v=this.$$("#checkpoint-file");
v.innerText=n;v.title=n;this.projector.updateDataSet(p)})}metadataWasReadFromFile(k,n){e.parseRawMetadata(k,p=>{this.projector.updateDataSet(this.projector.dataSet,p,n)})}getEmbeddingInfoByName(k){for(let n=0;n<this.projectorConfig.embeddings.length;n++){const p=this.projectorConfig.embeddings[n];if(p.tensorName===k)return p}}setupUploadButtons(){const k=this.$$("#file");k.onchange=()=>{const N=k.files[0];k.value="";const I=new FileReader;I.onload=()=>{this.tensorWasReadFromFile(I.result,N.name)};
I.readAsArrayBuffer(N)};this.$$("#upload-tensors").onclick=()=>{k.click()};const n=this.$$("#file-metadata");n.onchange=()=>{const N=n.files[0];n.value="";const I=new FileReader;I.onload=()=>{this.metadataWasReadFromFile(I.result,N.name)};I.readAsArrayBuffer(N)};this.$$("#upload-metadata").onclick=()=>{n.click()};"demo"!==this.projector.servingMode&&(this.$$("#publish-container").style.display="none",this.$$("#upload-tensors-step-container").style.display="none",this.$$("#upload-metadata-label").style.display=
"none");this.$$("#demo-data-buttons-container").style.display="flex";const p=this.$$("#projector-config-template"),v={embeddings:[{tensorName:"My tensor",tensorShape:[1E3,50],tensorPath:"https://raw.githubusercontent.com/.../tensors.tsv",metadataPath:"https://raw.githubusercontent.com/.../optional.metadata.tsv"}]};this.setProjectorConfigTemplateJson(p,v);const z=this.$$("#config-sprite-checkbox");z.onchange=()=>{z.checked?v.embeddings[0].sprite={imagePath:"https://github.com/.../optional.sprite.png",
singleImageDim:[32,32]}:delete v.embeddings[0].sprite;this.setProjectorConfigTemplateJson(p,v)};const E=this.$$("#config-bookmarks-checkbox");E.onchange=()=>{E.checked?v.embeddings[0].bookmarksPath="https://raw.githubusercontent.com/.../bookmarks.txt":delete v.embeddings[0].bookmarksPath;this.setProjectorConfigTemplateJson(p,v)};const t=this.$$("#config-metadata-checkbox");t.onchange=()=>{t.checked?v.embeddings[0].metadataPath="https://raw.githubusercontent.com/.../optional.metadata.tsv":delete v.embeddings[0].metadataPath;
this.setProjectorConfigTemplateJson(p,v)};const x=this.$$("#projector-config-url"),A=this.$$("#projector-share-url"),F=this.$$("#projector-share-url-link");x.onchange=()=>{let N=location.protocol+"//"+location.host+location.pathname+"?config\x3d"+x.value;A.value=N;F.href=N}}setProjectorConfigTemplateJson(k,n){k.value=JSON.stringify(n,null,2)}_getNumTensorsLabel(){return 1===this.tensorNames.length?"1 tensor":this.tensorNames.length+" tensors"}_getNumRunsLabel(){return 1===this.runNames.length?"1 run":
this.runNames.length+" runs"}_hasChoice(k){return 0<k.length}_hasChoices(k){return 1<k.length}_openDataDialog(){this.$.dataDialog.open()}_openConfigDialog(){this.$.projectorConfigDialog.open()}}e.DataPanel=r;customElements.define(r.prototype.is,r)})(yi||(yi={}));

//# sourceURL=build://vz-projector/vz-projector-input.js
(function(e){e.ProjectorInputPolymer=e.PolymerElement({is:"vz-projector-input",properties:{label:String,message:String}});class r extends e.ProjectorInputPolymer{registerInputChangedListener(k){this.textChangedListeners.push(k)}ready(){super.ready();this.inRegexMode=!1;this.textChangedListeners=[];this.paperInput=this.$$("paper-input");this.inRegexModeButton=this.$$("paper-button");this.paperInput.setAttribute("error-message","Invalid regex");this.paperInput.addEventListener("input",()=>{this.onTextChanged()});
this.paperInput.addEventListener("keydown",k=>{k.stopPropagation()});this.inRegexModeButton.addEventListener("click",()=>this.onClickRegexModeButton());this.updateRegexModeDisplaySlashes();this.onTextChanged()}onClickRegexModeButton(){this.inRegexMode=this.inRegexModeButton.active;this.updateRegexModeDisplaySlashes();this.onTextChanged()}notifyInputChanged(k,n){this.textChangedListeners.forEach(p=>p(k,n))}onTextChanged(){try{this.inRegexMode&&new RegExp(this.paperInput.value)}catch(k){this.paperInput.setAttribute("invalid",
"true");this.message="";this.notifyInputChanged(null,!0);return}this.paperInput.removeAttribute("invalid");this.notifyInputChanged(this.paperInput.value,this.inRegexMode)}updateRegexModeDisplaySlashes(){const k=this.paperInput.querySelectorAll(".slash"),n=this.inRegexMode?"":"none";for(let p=0;p<k.length;p++)k[p].style.display=n}getValue(){return this.paperInput.value}getInRegexMode(){return this.inRegexMode}setValue(k,n){this.inRegexModeButton.active=n;this.paperInput.value=k;this.onClickRegexModeButton()}}
e.ProjectorInput=r;customElements.define(r.prototype.is,r)})(yi||(yi={}));

//# sourceURL=build://iron-range-behavior/iron-range-behavior.html.js
Polymer.IronRangeBehavior={properties:{value:{type:Number,value:0,notify:!0,reflectToAttribute:!0},min:{type:Number,value:0,notify:!0},max:{type:Number,value:100,notify:!0},step:{type:Number,value:1,notify:!0},ratio:{type:Number,value:0,readOnly:!0,notify:!0}},observers:["_update(value, min, max, step)"],_calcRatio:function(e){return(this._clampValue(e)-this.min)/(this.max-this.min)},_clampValue:function(e){return Math.min(this.max,Math.max(this.min,this._calcStep(e)))},_calcStep:function(e){e=parseFloat(e);
if(!this.step)return e;e=Math.round((e-this.min)/this.step);return 1>this.step?e/(1/this.step)+this.min:e*this.step+this.min},_validateValue:function(){var e=this._clampValue(this.value);this.value=this.oldValue=isNaN(e)?this.oldValue:e;return this.value!==e},_update:function(){this._validateValue();this._setRatio(100*this._calcRatio(this.value))}};

//# sourceURL=build://paper-progress/paper-progress.html.js
Polymer({is:"paper-progress",behaviors:[Polymer.IronRangeBehavior],properties:{secondaryProgress:{type:Number,value:0},secondaryRatio:{type:Number,value:0,readOnly:!0},indeterminate:{type:Boolean,value:!1,observer:"_toggleIndeterminate"},disabled:{type:Boolean,value:!1,reflectToAttribute:!0,observer:"_disabledChanged"}},observers:["_progressChanged(secondaryProgress, value, min, max, indeterminate)"],hostAttributes:{role:"progressbar"},_toggleIndeterminate:function(e){this.toggleClass("indeterminate",
e,this.$.primaryProgress)},_transformProgress:function(e,r){e.style.transform=e.style.webkitTransform="scaleX("+r/100+")"},_mainRatioChanged:function(e){this._transformProgress(this.$.primaryProgress,e)},_progressChanged:function(e,r,k,n,p){e=this._clampValue(e);r=this._clampValue(r);var v=100*this._calcRatio(e),z=100*this._calcRatio(r);this._setSecondaryRatio(v);this._transformProgress(this.$.secondaryProgress,v);this._transformProgress(this.$.primaryProgress,z);this.secondaryProgress=e;p?this.removeAttribute("aria-valuenow"):
this.setAttribute("aria-valuenow",r);this.setAttribute("aria-valuemin",k);this.setAttribute("aria-valuemax",n)},_disabledChanged:function(e){this.setAttribute("aria-disabled",e?"true":"false")},_hideSecondaryProgress:function(e){return 0===e}});

//# sourceURL=build://paper-slider/paper-slider.html.js
Polymer({is:"paper-slider",behaviors:[Polymer.IronA11yKeysBehavior,Polymer.IronFormElementBehavior,Polymer.PaperInkyFocusBehavior,Polymer.IronRangeBehavior],properties:{snaps:{type:Boolean,value:!1,notify:!0},pin:{type:Boolean,value:!1,notify:!0},secondaryProgress:{type:Number,value:0,notify:!0,observer:"_secondaryProgressChanged"},editable:{type:Boolean,value:!1},immediateValue:{type:Number,value:0,readOnly:!0,notify:!0},maxMarkers:{type:Number,value:0,notify:!0},expand:{type:Boolean,value:!1,readOnly:!0},
ignoreBarTouch:{type:Boolean,value:!1},dragging:{type:Boolean,value:!1,readOnly:!0,notify:!0},transiting:{type:Boolean,value:!1,readOnly:!0},markers:{type:Array,readOnly:!0,value:function(){return[]}}},observers:["_updateKnob(value, min, max, snaps, step)","_valueChanged(value)","_immediateValueChanged(immediateValue)","_updateMarkers(maxMarkers, min, max, snaps)"],hostAttributes:{role:"slider",tabindex:0},keyBindings:{left:"_leftKey",right:"_rightKey","down pagedown home":"_decrementKey","up pageup end":"_incrementKey"},
ready:function(){this.ignoreBarTouch&&Polymer.Gestures.setTouchAction(this.$.sliderBar,"auto")},increment:function(){this.value=this._clampValue(this.value+this.step)},decrement:function(){this.value=this._clampValue(this.value-this.step)},_updateKnob:function(e,r,k){this.setAttribute("aria-valuemin",r);this.setAttribute("aria-valuemax",k);this.setAttribute("aria-valuenow",e);this._positionKnob(100*this._calcRatio(e))},_valueChanged:function(){this.fire("value-change",{composed:!0})},_immediateValueChanged:function(){this.dragging?
this.fire("immediate-value-change",{composed:!0}):this.value=this.immediateValue},_secondaryProgressChanged:function(){this.secondaryProgress=this._clampValue(this.secondaryProgress)},_expandKnob:function(){this._setExpand(!0)},_resetKnob:function(){this.cancelDebouncer("expandKnob");this._setExpand(!1)},_positionKnob:function(e){this._setImmediateValue(this._calcStep(this._calcKnobPosition(e)));this._setRatio(100*this._calcRatio(this.immediateValue));this.$.sliderKnob.style.left=this.ratio+"%";this.dragging&&
(this._knobstartx=this.ratio*this._w/100,this.translate3d(0,0,0,this.$.sliderKnob))},_calcKnobPosition:function(e){return(this.max-this.min)*e/100+this.min},_onTrack:function(e){e.stopPropagation();switch(e.detail.state){case "start":this._trackStart(e);break;case "track":this._trackX(e);break;case "end":this._trackEnd()}},_trackStart:function(){this._setTransiting(!1);this._w=this.$.sliderBar.offsetWidth;this._knobstartx=this._startx=this._x=this.ratio*this._w/100;this._minx=-this._startx;this._maxx=
this._w-this._startx;this.$.sliderKnob.classList.add("dragging");this._setDragging(!0)},_trackX:function(e){this.dragging||this._trackStart(e);this._x=this._startx+Math.min(this._maxx,Math.max(this._minx,e.detail.dx*(this._isRTL?-1:1)));this._setImmediateValue(this._calcStep(this._calcKnobPosition(this._x/this._w*100)));this.translate3d(this._calcRatio(this.immediateValue)*this._w-this._knobstartx+"px",0,0,this.$.sliderKnob)},_trackEnd:function(){var e=this.$.sliderKnob.style;this.$.sliderKnob.classList.remove("dragging");
this._setDragging(!1);this._resetKnob();this.value=this.immediateValue;e.transform=e.webkitTransform="";this.fire("change",{composed:!0})},_knobdown:function(e){this._expandKnob();e.preventDefault();this.focus()},_bartrack:function(e){this._allowBarEvent(e)&&this._onTrack(e)},_barclick:function(e){this._w=this.$.sliderBar.offsetWidth;var r=this.$.sliderBar.getBoundingClientRect();r=(e.detail.x-r.left)/this._w*100;this._isRTL&&(r=100-r);var k=this.ratio;this._setTransiting(!0);this._positionKnob(r);
k===this.ratio&&this._setTransiting(!1);this.async(function(){this.fire("change",{composed:!0})});e.preventDefault();this.focus()},_bardown:function(e){this._allowBarEvent(e)&&(this.debounce("expandKnob",this._expandKnob,60),this._barclick(e))},_knobTransitionEnd:function(e){e.target===this.$.sliderKnob&&this._setTransiting(!1)},_updateMarkers:function(e,r,k,n){n||this._setMarkers([]);r=Math.round((k-r)/this.step);r>e&&(r=e);if(0>r||!isFinite(r))r=0;this._setMarkers(Array(r))},_mergeClasses:function(e){return Object.keys(e).filter(function(r){return e[r]}).join(" ")},
_getClassNames:function(){return this._mergeClasses({disabled:this.disabled,pin:this.pin,snaps:this.snaps,ring:this.immediateValue<=this.min,expand:this.expand,dragging:this.dragging,transiting:this.transiting,editable:this.editable})},_allowBarEvent:function(e){return!this.ignoreBarTouch||e.detail.sourceEvent instanceof MouseEvent},get _isRTL(){void 0===this.__isRTL&&(this.__isRTL="rtl"===window.getComputedStyle(this).direction);return this.__isRTL},_leftKey:function(e){this._isRTL?this._incrementKey(e):
this._decrementKey(e)},_rightKey:function(e){this._isRTL?this._decrementKey(e):this._incrementKey(e)},_incrementKey:function(e){this.disabled||("end"===e.detail.key?this.value=this.max:this.increment(),this.fire("change"),e.preventDefault())},_decrementKey:function(e){this.disabled||("home"===e.detail.key?this.value=this.min:this.decrement(),this.fire("change"),e.preventDefault())},_changeValue:function(e){this.value=e.target.value;this.fire("change",{composed:!0})},_inputKeyDown:function(e){e.stopPropagation()},
_createRipple:function(){this._rippleContainer=this.$.sliderKnob;return Polymer.PaperInkyFocusBehaviorImpl._createRipple.call(this)},_focusedChanged:function(e){e&&this.ensureRipple();this.hasRipple()&&(this._ripple.style.display=e?"":"none",this._ripple.holdDown=e)}});

//# sourceURL=build://vz-projector/vz-projector-inspector-panel.js
(function(e){e.InspectorPanelPolymer=e.PolymerElement({is:"vz-projector-inspector-panel",properties:{selectedMetadataField:String,metadataFields:Array,metadataColumn:String,numNN:{type:Number,value:100},updateNumNN:Object,spriteMeta:Object,showNeighborImages:{type:Boolean,value:!0,observer:"_refreshNeighborsList"},spriteImagesAvailable:{type:Boolean,value:!0,observer:"_refreshNeighborsList"}}});class r extends e.InspectorPanelPolymer{ready(){super.ready();this.resetFilterButton=this.$$(".reset-filter");
this.setFilterButton=this.$$(".set-filter");this.clearSelectionButton=this.$$(".clear-selection");this.limitMessage=this.$$(".limit-msg");this.searchBox=this.$$("#search-box");this.displayContexts=[]}initialize(k,n){this.projector=k;this.projectorEventContext=n;this.setupUI(k);n.registerSelectionChangedListener((p,v)=>this.updateInspectorPane(p,v))}updateInspectorPane(k,n){this.neighborsOfFirstPoint=n;this.selectedPointIndices=k;this.updateFilterButtons(k.length+n.length);this.updateNeighborsList(n);
0===n.length?this.updateSearchResults(k):this.updateSearchResults([])}enableResetFilterButton(k){this.resetFilterButton.disabled=!k}restoreUIFromBookmark(k){this.enableResetFilterButton(null!=k.filteredPoints)}metadataChanged(k){let n=-1;this.metadataFields=k.stats.map((p,v)=>{p.isNumeric||-1!==n||(n=v);return p.name});if(k.spriteMetadata&&k.spriteMetadata.imagePath){const [p,v]=k.spriteMetadata.singleImageDim;this.spriteMeta={imagePath:k.spriteImage.src,aspectRatio:p/v,nCols:Math.floor(k.spriteImage.width/
p),singleImageDim:[p,v]}}else this.spriteMeta={};this.spriteImagesAvailable=!!this.spriteMeta.imagePath;if(null==this.selectedMetadataField||0===this.metadataFields.filter(p=>p===this.selectedMetadataField).length)this.selectedMetadataField=this.metadataFields[Math.max(0,n)];this.updateInspectorPane(this.selectedPointIndices,this.neighborsOfFirstPoint)}datasetChanged(){this.enableResetFilterButton(!1)}_refreshNeighborsList(){this.updateNeighborsList()}metadataEditorContext(k,n){if(this.projector&&
this.projector.dataSet){var p=this.projector.dataSet.spriteAndMetadataInfo.stats.filter(E=>E.name===n);if(!k||0===p.length||p[0].tooManyUniqueValues)this.removeContext(".metadata-info");else{this.metadataColumn=n;this.addContext(".metadata-info");var v=this.$$(".metadata-list");v.innerHTML="";k=p[0].uniqueEntries.sort((E,t)=>E.count-t.count);var z=k[k.length-1].count;k.forEach(E=>{const t=document.createElement("div");t.className="metadata";const x=document.createElement("a");x.className="metadata-link";
x.title=E.label;const A=document.createElement("div");A.className="label-and-value";var F=document.createElement("div");F.className="label";F.style.color=e.dist2color(this.distFunc,z,E.count);F.innerText=E.label;var N=document.createElement("div");N.className="value";N.innerText=E.count.toString();A.appendChild(F);A.appendChild(N);F=document.createElement("div");F.className="bar";N=document.createElement("div");N.className="fill";N.style.borderTopColor=e.dist2color(this.distFunc,z,E.count);N.style.width=
100*e.normalizeDist(this.distFunc,z,E.count)+"%";F.appendChild(N);for(N=1;4>N;N++){const I=document.createElement("div");I.className="tick";I.style.left=100*N/4+"%";F.appendChild(I)}x.appendChild(A);x.appendChild(F);t.appendChild(x);v.appendChild(t);x.onclick=()=>{this.projector.metadataEdit(n,E.label)}})}}}addContext(k){-1===this.displayContexts.indexOf(k)&&this.displayContexts.push(k);this.displayContexts.forEach(n=>{this.$$(n).style.display="none"});this.$$(k).style.display=null}removeContext(k){this.displayContexts=
this.displayContexts.filter(n=>n!==k);this.$$(k).style.display="none";0<this.displayContexts.length&&(this.$$(this.displayContexts[this.displayContexts.length-1]).style.display=null)}updateSearchResults(k){const n=this.$$(".matches-list").querySelector(".list");n.innerHTML="";if(0===k.length)this.removeContext(".matches-list");else{this.addContext(".matches-list");this.limitMessage.style.display=100>=k.length?"none":null;k=k.slice(0,100);for(let p=0;p<k.length;p++){const v=k[p],z=document.createElement("div");
z.className="row";const E=this.getLabelFromIndex(v),t=document.createElement("a");t.className="label";t.title=E;t.innerText=E;t.onmouseenter=()=>{this.projectorEventContext.notifyHoverOverPoint(v)};t.onmouseleave=()=>{this.projectorEventContext.notifyHoverOverPoint(null)};t.onclick=()=>{this.projectorEventContext.notifySelectionChanged([v])};z.appendChild(t);n.appendChild(z)}}}getLabelFromIndex(k){const n=this.projector.dataSet.points[k].metadata[this.selectedMetadataField];return void 0!==n?String(n):
`Unknown #${k}`}spriteImageRenderer(){const k=this.spriteMeta.nCols,n=100/this.spriteMeta.aspectRatio+"%",p=`${100*k}% ${100*k}%`,v=`url(${CSS.escape(this.spriteMeta.imagePath)})`;return z=>{const E=document.createElement("div");E.className="sprite-image";E.style.backgroundImage=v;E.style.paddingBottom=n;E.style.backgroundSize=p;const [t,x]=[Math.floor(z.index/k),z.index%k],[A,F]=[t/(k-1)*100,x/(k-1)*100];E.style.backgroundPosition=`${F}% ${A}%`;return E}}updateNeighborsList(k){this._currentNeighbors=
k=k||this._currentNeighbors;if(null!=k){var n=this.$$(".nn-list");n.innerHTML="";if(0===k.length)this.removeContext(".nn");else{this.addContext(".nn");this.searchBox.message="";var p=0<k.length?k[0].dist:0;if(this.spriteImagesAvailable&&this.showNeighborImages)var v=this.spriteImageRenderer();for(let t=0;t<k.length;t++){const x=k[t],A=document.createElement("div");A.className="neighbor";const F=document.createElement("a");F.className="neighbor-link";F.title=this.getLabelFromIndex(x.index);const N=
document.createElement("div");N.className="label-and-value";var z=document.createElement("div");z.className="label";z.style.color=e.dist2color(this.distFunc,x.dist,p);z.innerText=this.getLabelFromIndex(x.index);var E=document.createElement("div");E.className="value";E.innerText=x.dist.toFixed(3);N.appendChild(z);N.appendChild(E);z=document.createElement("div");z.className="bar";E=document.createElement("div");E.className="fill";E.style.borderTopColor=e.dist2color(this.distFunc,x.dist,p);E.style.width=
100*e.normalizeDist(this.distFunc,x.dist,p)+"%";z.appendChild(E);for(E=1;4>E;E++){const I=document.createElement("div");I.className="tick";I.style.left=100*E/4+"%";z.appendChild(I)}this.spriteImagesAvailable&&this.showNeighborImages&&(E=v(x),A.appendChild(E));F.appendChild(N);F.appendChild(z);A.appendChild(F);n.appendChild(A);F.onmouseenter=()=>{this.projectorEventContext.notifyHoverOverPoint(x.index)};F.onmouseleave=()=>{this.projectorEventContext.notifyHoverOverPoint(null)};F.onclick=()=>{this.projectorEventContext.notifySelectionChanged([x.index])}}}}}updateFilterButtons(k){1<
k?(this.setFilterButton.innerText=`Isolate ${k} points`,this.setFilterButton.disabled=null,this.clearSelectionButton.disabled=null):(this.setFilterButton.disabled=!0,this.clearSelectionButton.disabled=!0)}setupUI(k){this.distFunc=e.vector.cosDist;const n=this.$$(".distance a.euclidean");n.onclick=()=>{var z=this.root.querySelectorAll(".distance a");for(let E=0;E<z.length;E++)e.util.classed(z[E],"selected",!1);e.util.classed(n,"selected",!0);this.distFunc=e.vector.dist;this.projectorEventContext.notifyDistanceMetricChanged(this.distFunc);
z=k.dataSet.findNeighbors(this.selectedPointIndices[0],this.distFunc,this.numNN);this.updateNeighborsList(z)};const p=this.$$(".distance a.cosine");p.onclick=()=>{var z=this.root.querySelectorAll(".distance a");for(let E=0;E<z.length;E++)e.util.classed(z[E],"selected",!1);e.util.classed(p,"selected",!0);this.distFunc=e.vector.cosDist;this.projectorEventContext.notifyDistanceMetricChanged(this.distFunc);z=k.dataSet.findNeighbors(this.selectedPointIndices[0],this.distFunc,this.numNN);this.updateNeighborsList(z)};
const v=(z,E)=>{null==z||""===z.trim()?(this.searchBox.message="",this.projectorEventContext.notifySelectionChanged([])):(z=k.dataSet.query(z,E,this.selectedMetadataField),this.searchBox.message=0===z.length?"0 matches.":`${z.length} matches.`,this.projectorEventContext.notifySelectionChanged(z))};this.searchBox.registerInputChangedListener((z,E)=>{v(z,E)});this.setFilterButton.onclick=()=>{const z=this.selectedPointIndices.concat(this.neighborsOfFirstPoint.map(E=>E.index));k.filterDataset(z);this.enableResetFilterButton(!0);
this.updateFilterButtons(0)};this.resetFilterButton.onclick=()=>{k.resetFilterDataset();this.enableResetFilterButton(!1)};this.clearSelectionButton.onclick=()=>{k.adjustSelectionAndHover([])};this.enableResetFilterButton(!1)}updateNumNN(){null!=this.selectedPointIndices&&this.projectorEventContext.notifySelectionChanged([this.selectedPointIndices[0]])}}e.InspectorPanel=r;customElements.define(r.prototype.is,r)})(yi||(yi={}));

//# sourceURL=build://vz-projector/vz-projector-metadata-card.js
(function(e){e.MetadataCardPolymer=e.PolymerElement({is:"vz-projector-metadata-card",properties:{hasMetadata:{type:Boolean,value:!1},isCollapsed:{type:Boolean,value:!1},collapseIcon:{type:String,value:"expand-less"},metadata:{type:Array},label:String}});class r extends e.MetadataCardPolymer{_toggleMetadataContainer(){this.$$("#metadata-container").toggle();this.isCollapsed=!this.isCollapsed;this.set("collapseIcon",this.isCollapsed?"expand-more":"expand-less")}updateMetadata(k){this.pointMetadata=
k;this.hasMetadata=null!=k;if(k){let n=[];for(let p in k)k.hasOwnProperty(p)&&n.push({key:p,value:k[p]});this.metadata=n;this.label=""+this.pointMetadata[this.labelOption]}}setLabelOption(k){this.labelOption=k;this.pointMetadata&&(this.label=""+this.pointMetadata[this.labelOption])}}e.MetadataCard=r;customElements.define(r.prototype.is,r)})(yi||(yi={}));

//# sourceURL=build://vz-projector/vz-projector-projections-panel.js
(function(e){e.ProjectionsPanelPolymer=e.PolymerElement({is:"vz-projector-projections-panel",properties:{pcaIs3d:{type:Boolean,value:!0,observer:"_pcaDimensionToggleObserver"},tSNEis3d:{type:Boolean,value:!0,observer:"_tsneDimensionToggleObserver"},superviseFactor:{type:Number,value:0},umapIs3d:{type:Boolean,value:!0,observer:"_umapDimensionToggleObserver"},umapNeighbors:{type:Number,value:15},pcaComponents:Array,pcaX:{type:Number,value:0,observer:"showPCAIfEnabled"},pcaY:{type:Number,value:1,observer:"showPCAIfEnabled"},
pcaZ:{type:Number,value:2,observer:"showPCAIfEnabled"},customSelectedSearchByMetadataOption:{type:String,observer:"_customSelectedSearchByMetadataOptionChanged"}}});class r extends e.ProjectionsPanelPolymer{initialize(k){this.polymerChangesTriggerReprojection=!0;this.projector=k;this.perplexity=30;this.learningRate=10;this.centroidValues={xLeft:null,xRight:null,yUp:null,yDown:null};this.clearCentroids();this.setupUIControls()}ready(){super.ready();this.zDropdown=this.$$("#z-dropdown");this.runTsneButton=
this.$$(".run-tsne");this.pauseTsneButton=this.$$(".pause-tsne");this.perturbTsneButton=this.$$(".perturb-tsne");this.perplexitySlider=this.$$("#perplexity-slider");this.learningRateInput=this.$$("#learning-rate-slider");this.superviseFactorInput=this.$$("#supervise-factor-slider");this.iterationLabelTsne=this.$$(".run-tsne-iter");this.runUmapButton=this.$$("#run-umap")}disablePolymerChangesTriggerReprojection(){this.polymerChangesTriggerReprojection=!1}enablePolymerChangesTriggerReprojection(){this.polymerChangesTriggerReprojection=
!0}updateTSNEPerplexityFromSliderChange(){this.perplexitySlider&&(this.perplexity=+this.perplexitySlider.value);this.$$(".tsne-perplexity span").innerText=""+this.perplexity}updateTSNELearningRateFromUIChange(){this.learningRateInput&&(this.learningRate=Math.pow(10,+this.learningRateInput.value));this.$$(".tsne-learning-rate span").innerText=""+this.learningRate}updateTSNESuperviseFactorFromUIChange(){this.$$(".tsne-supervise-factor span").innerText=""+this.superviseFactor;this.dataSet&&this.dataSet.setSuperviseFactor(this.superviseFactor)}setupUIControls(){{const p=
this;var k=this.root.querySelectorAll(".ink-tab");for(var n=0;n<k.length;n++)k[n].addEventListener("click",function(){let v=this.getAttribute("data-tab");p.showTab(v)})}this.runTsneButton.addEventListener("click",()=>{this.dataSet.hasTSNERun?this.dataSet.stopTSNE():this.runTSNE()});this.pauseTsneButton.addEventListener("click",()=>{this.dataSet.tSNEShouldPause?(this.dataSet.tSNEShouldPause=!1,this.pauseTsneButton.innerText="Pause"):(this.dataSet.tSNEShouldPause=!0,this.pauseTsneButton.innerText="Resume")});
this.perturbTsneButton.addEventListener("mousedown",()=>{this.dataSet&&this.projector&&(this.dataSet.perturbTsne(),this.projector.notifyProjectionPositionsUpdated(),this.perturbInterval=setInterval(()=>{this.dataSet.perturbTsne();this.projector.notifyProjectionPositionsUpdated()},100))});this.perturbTsneButton.addEventListener("mouseup",()=>{clearInterval(this.perturbInterval)});this.perplexitySlider.value=this.perplexity.toString();this.perplexitySlider.addEventListener("change",()=>this.updateTSNEPerplexityFromSliderChange());
this.updateTSNEPerplexityFromSliderChange();this.learningRateInput.addEventListener("change",()=>this.updateTSNELearningRateFromUIChange());this.updateTSNELearningRateFromUIChange();this.superviseFactorInput.addEventListener("change",()=>this.updateTSNESuperviseFactorFromUIChange());this.updateTSNESuperviseFactorFromUIChange();this.setupCustomProjectionInputFields();k=this.root.querySelectorAll("paper-dropdown-menu paper-input input");for(n=0;n<k.length;n++)k[n].style.fontSize="14px"}restoreUIFromBookmark(k){this.disablePolymerChangesTriggerReprojection();
this.pcaX=k.pcaComponentDimensions[0];this.pcaY=k.pcaComponentDimensions[1];3===k.pcaComponentDimensions.length&&(this.pcaZ=k.pcaComponentDimensions[2]);this.pcaIs3d=3===k.pcaComponentDimensions.length;this.perplexitySlider&&(this.perplexitySlider.value=k.tSNEPerplexity.toString());this.learningRateInput&&(this.learningRateInput.value=k.tSNELearningRate.toString());this.tSNEis3d=k.tSNEis3d;this.umapIs3d=k.umapIs3d;this.umapNeighbors=k.umapNeighbors;this.customSelectedSearchByMetadataOption=k.customSelectedSearchByMetadataOption;
this.customProjectionXLeftInput&&this.customProjectionXLeftInput.set(k.customXLeftText,k.customXLeftRegex);this.customProjectionXRightInput&&this.customProjectionXRightInput.set(k.customXRightText,k.customXRightRegex);this.customProjectionYUpInput&&this.customProjectionYUpInput.set(k.customYUpText,k.customYUpRegex);this.customProjectionYDownInput&&this.customProjectionYDownInput.set(k.customYDownText,k.customYDownRegex);this.computeAllCentroids();this.setZDropdownEnabled(this.pcaIs3d);this.updateTSNEPerplexityFromSliderChange();
this.updateTSNELearningRateFromUIChange();this.iterationLabelTsne&&(this.iterationLabelTsne.innerText=k.tSNEIteration.toString());null!=k.selectedProjection&&this.showTab(k.selectedProjection);this.enablePolymerChangesTriggerReprojection()}populateBookmarkFromUI(k){this.disablePolymerChangesTriggerReprojection();k.pcaComponentDimensions=[this.pcaX,this.pcaY];this.pcaIs3d&&k.pcaComponentDimensions.push(this.pcaZ);null!=this.perplexitySlider&&(k.tSNEPerplexity=+this.perplexitySlider.value);null!=this.learningRateInput&&
(k.tSNELearningRate=+this.learningRateInput.value);k.tSNEis3d=this.tSNEis3d;k.umapIs3d=this.umapIs3d;k.customSelectedSearchByMetadataOption=this.customSelectedSearchByMetadataOption;null!=this.customProjectionXLeftInput&&(k.customXLeftText=this.customProjectionXLeftInput.getValue(),k.customXLeftRegex=this.customProjectionXLeftInput.getInRegexMode());null!=this.customProjectionXRightInput&&(k.customXRightText=this.customProjectionXRightInput.getValue(),k.customXRightRegex=this.customProjectionXRightInput.getInRegexMode());
null!=this.customProjectionYUpInput&&(k.customYUpText=this.customProjectionYUpInput.getValue(),k.customYUpRegex=this.customProjectionYUpInput.getInRegexMode());null!=this.customProjectionYDownInput&&(k.customYDownText=this.customProjectionYDownInput.getValue(),k.customYDownRegex=this.customProjectionYDownInput.getInRegexMode());this.enablePolymerChangesTriggerReprojection()}setZDropdownEnabled(k){this.zDropdown&&(k?this.zDropdown.removeAttribute("disabled"):this.zDropdown.setAttribute("disabled",
"true"))}dataSetUpdated(k,n,p){this.dataSet=k;this.originalDataSet=n;this.dim=p;n=null==k?0:k.points.length;this.perplexitySlider.value=Math.max(5,Math.ceil(Math.sqrt(n)/4)).toString();this.updateTSNEPerplexityFromSliderChange();this.clearCentroids();this.$$("#tsne-sampling").style.display=n>e.TSNE_SAMPLE_SIZE?null:"none";k=null==k?!1:k.dim[0]>e.PCA_SAMPLE_DIM||k.dim[1]>e.PCA_SAMPLE_DIM;this.$$("#pca-sampling").style.display=k?null:"none";this.showTab("pca")}_pcaDimensionToggleObserver(){this.setZDropdownEnabled(this.pcaIs3d);
this.beginProjection(this.currentProjection)}_tsneDimensionToggleObserver(){this.beginProjection(this.currentProjection)}_umapDimensionToggleObserver(){this.beginProjection(this.currentProjection)}metadataChanged(k){let n=-1;this.searchByMetadataOptions=k.stats.map((p,v)=>{p.isNumeric||-1!==n||(n=v);return p.name});this.customSelectedSearchByMetadataOption=this.searchByMetadataOptions[Math.max(0,n)]}showTab(k){this.currentProjection=k;var n=this.$$('.ink-tab[data-tab\x3d"'+k+'"]'),p=this.root.querySelectorAll(".ink-tab");
for(let v=0;v<p.length;v++)e.util.classed(p[v],"active",!1);e.util.classed(n,"active",!0);n=this.root.querySelectorAll(".ink-panel-content");for(p=0;p<n.length;p++)e.util.classed(n[p],"active",!1);e.util.classed(this.$$('.ink-panel-content[data-panel\x3d"'+k+'"]'),"active",!0);if(null!=this.$){const v=this.$.main;requestAnimationFrame(()=>{this.style.height=v.clientHeight+"px"})}this.beginProjection(k)}beginProjection(k){!1!==this.polymerChangesTriggerReprojection&&("pca"===k?(null!=this.dataSet&&
this.dataSet.stopTSNE(),this.showPCA()):"tsne"===k?this.showTSNE():"umap"===k?this.showUmap():"custom"===k&&(null!=this.dataSet&&this.dataSet.stopTSNE(),this.computeAllCentroids(),this.reprojectCustom()))}showTSNE(){var k=this.dataSet;if(null!=k){var n=e.getProjectionComponents("tsne",[0,1,this.tSNEis3d?2:null]);k=new e.Projection("tsne",n,this.tSNEis3d?3:2,k);this.projector.setProjection(k);this.dataSet.hasTSNERun?this.projector.notifyProjectionPositionsUpdated():this.runTSNE()}}runTSNE(){let k=
!1;this.runTsneButton.innerText="Stop";this.runTsneButton.disabled=!0;this.pauseTsneButton.innerText="Pause";this.pauseTsneButton.disabled=!0;this.perturbTsneButton.disabled=!1;this.dataSet.projectTSNE(this.perplexity,this.learningRate,this.tSNEis3d?3:2,n=>{null!=n?(this.runTsneButton.disabled=!1,this.pauseTsneButton.disabled=!1,this.iterationLabelTsne.innerText=""+n,this.projector.notifyProjectionPositionsUpdated(),!k&&this.dataSet.projections.tsne&&(this.projector.onProjectionChanged(),k=!0)):(this.runTsneButton.innerText=
"Re-run",this.runTsneButton.disabled=!1,this.pauseTsneButton.innerText="Pause",this.pauseTsneButton.disabled=!0,this.perturbTsneButton.disabled=!0,this.projector.onProjectionChanged())})}showUmap(){var k=this.dataSet;if(null!=k){var n=e.getProjectionComponents("umap",[0,1,this.umapIs3d?2:null]);k=new e.Projection("umap",n,this.umapIs3d?3:2,k);this.projector.setProjection(k);this.dataSet.hasUmapRun?this.projector.notifyProjectionPositionsUpdated():this.runUmap()}}runUmap(){let k=!1;this.runUmapButton.disabled=
!0;this.dataSet.projectUmap(this.umapIs3d?3:2,this.umapNeighbors,n=>{null!=n?(this.runUmapButton.disabled=!1,this.projector.notifyProjectionPositionsUpdated(),!k&&this.dataSet.projections.umap&&(this.projector.onProjectionChanged(),k=!0)):(this.runUmapButton.innerText="Re-run",this.runUmapButton.disabled=!1,this.projector.onProjectionChanged())})}showPCAIfEnabled(){this.polymerChangesTriggerReprojection&&this.showPCA()}updateTotalVarianceMessage(){var k=this.dataSet.fracVariancesExplained;let n=k[this.pcaX]+
k[this.pcaY];this.pcaIs3d&&(n+=k[this.pcaZ]);k="Total variance described: "+((100*n).toFixed(1)+"%.");this.$$("#total-variance").innerHTML=k}showPCA(){null!=this.dataSet&&this.dataSet.projectPCA().then(()=>{var k=e.getProjectionComponents("pca",[this.pcaX,this.pcaY,this.pcaZ]);k=new e.Projection("pca",k,this.pcaIs3d?3:2,this.dataSet);this.projector.setProjection(k);k=Math.min(10,this.dataSet.dim[1]);this.updateTotalVarianceMessage();this.pcaComponents=e.util.range(k).map(n=>({id:n,componentNumber:n+
1,percVariance:(100*this.dataSet.fracVariancesExplained[n]).toFixed(1)}))})}reprojectCustom(){if(null!=this.centroids&&null!=this.centroids.xLeft&&null!=this.centroids.xRight&&null!=this.centroids.yUp&&null!=this.centroids.yDown){var k=e.vector.sub(this.centroids.xRight,this.centroids.xLeft);this.dataSet.projectLinear(k,"linear-x");k=e.vector.sub(this.centroids.yUp,this.centroids.yDown);this.dataSet.projectLinear(k,"linear-y");k=e.getProjectionComponents("custom",["x","y"]);k=new e.Projection("custom",
k,2,this.dataSet);this.projector.setProjection(k)}}clearCentroids(){this.centroids={xLeft:null,xRight:null,yUp:null,yDown:null};this.allCentroid=null}_customSelectedSearchByMetadataOptionChanged(){!1!==this.polymerChangesTriggerReprojection&&"custom"===this.currentProjection&&(this.computeAllCentroids(),this.reprojectCustom())}setupCustomProjectionInputFields(){this.customProjectionXLeftInput=this.setupCustomProjectionInputField("xLeft");this.customProjectionXRightInput=this.setupCustomProjectionInputField("xRight");
this.customProjectionYUpInput=this.setupCustomProjectionInputField("yUp");this.customProjectionYDownInput=this.setupCustomProjectionInputField("yDown")}computeAllCentroids(){this.computeCentroid("xLeft");this.computeCentroid("xRight");this.computeCentroid("yUp");this.computeCentroid("yDown")}computeCentroid(k){const n=this.$$("#"+k);if(null!=n){var p=n.getValue();if(null!=p){var v=this.getCentroid(p,n.getInRegexMode());0===v.numMatches?(n.message="0 matches. Using a random vector.",v.centroid=e.vector.rn(this.dim)):
n.message=`${v.numMatches} matches.`;this.centroids[k]=v.centroid;this.centroidValues[k]=p}}}setupCustomProjectionInputField(k){let n=this.$$("#"+k);n.registerInputChangedListener(()=>{this.polymerChangesTriggerReprojection&&(this.computeCentroid(k),this.reprojectCustom())});return n}getCentroid(k,n){if(null==k||""===k)return{numMatches:0};k=this.originalDataSet.query(k,n,this.customSelectedSearchByMetadataOption);return{centroid:e.vector.centroid(k,p=>this.originalDataSet.points[p].vector),numMatches:k.length}}getPcaSampledDimText(){return e.PCA_SAMPLE_DIM.toLocaleString()}getPcaSampleSizeText(){return e.PCA_SAMPLE_SIZE.toLocaleString()}getTsneSampleSizeText(){return e.TSNE_SAMPLE_SIZE.toLocaleString()}getUmapSampleSizeText(){return e.UMAP_SAMPLE_SIZE.toLocaleString()}}
e.ProjectionsPanel=r;customElements.define(r.prototype.is,r)})(yi||(yi={}));

//# sourceURL=build://vz-projector/vz-projector.js
(function(e){e.ProjectorPolymer=e.PolymerElement({is:"vz-projector",properties:{routePrefix:String,dataProto:{type:String,observer:"_dataProtoChanged"},servingMode:String,projectorConfigJsonPath:String,pageViewLogging:Boolean,eventLogging:Boolean}});class r extends e.ProjectorPolymer{ready(){super.ready();e.logging.setDomContainer(this);this.analyticsLogger=new e.AnalyticsLogger(this.pageViewLogging,this.eventLogging);this.analyticsLogger.logPageView();e.util.hasWebGLSupport()?(this.selectionChangedListeners=
[],this.hoverListeners=[],this.projectionChangedListeners=[],this.distanceMetricChangedListeners=[],this.selectedPointIndices=[],this.neighborsOfFirstPoint=[],this.editMode=!1,this.dataPanel=this.$["data-panel"],this.inspectorPanel=this.$["inspector-panel"],this.projectionsPanel=this.$["projections-panel"],this.bookmarkPanel=this.$["bookmark-panel"],this.metadataCard=this.$["metadata-card"],this.statusBar=this.$$("#status-bar"),this.inspectorPanel.initialize(this,this),this.projectionsPanel.initialize(this),
this.bookmarkPanel.initialize(this,this),this.setupUIControls(),this.initializeDataProvider()):(this.analyticsLogger.logWebGLDisabled(),e.logging.setErrorMessage("Your browser or device does not have WebGL enabled. Please enable hardware acceleration, or use a browser that supports WebGL."))}setSelectedLabelOption(k){this.selectedLabelOption=k;this.metadataCard.setLabelOption(this.selectedLabelOption);this.projectorScatterPlotAdapter.setLabelPointAccessor(k);this.projectorScatterPlotAdapter.updateScatterPlotAttributes();
this.projectorScatterPlotAdapter.render()}setSelectedColorOption(k){this.selectedColorOption=k;this.projectorScatterPlotAdapter.setLegendPointColorer(this.getLegendPointColorer(k));this.projectorScatterPlotAdapter.updateScatterPlotAttributes();this.projectorScatterPlotAdapter.render()}setNormalizeData(k){this.normalizeData=k;this.setCurrentDataSet(this.originalDataSet.getSubset())}updateDataSet(k,n,p){this.dataSetFilterIndices=null;this.originalDataSet=k;if(null!=k){this.normalizeData=50<=this.originalDataSet.dim[1];
n=n||{};if(null==n.pointsInfo){let [v,z]=this.makeDefaultPointsInfoAndStats(k.points);n.pointsInfo=v;n.stats=z}if(!k.mergeMetadata(n))return}null!=this.projectorScatterPlotAdapter&&(null==k?(this.projectorScatterPlotAdapter.setLabelPointAccessor(null),this.setProjection(null)):(this.projectorScatterPlotAdapter.updateScatterPlotPositions(),this.projectorScatterPlotAdapter.updateScatterPlotAttributes(),this.projectorScatterPlotAdapter.resize(),this.projectorScatterPlotAdapter.render()));null!=k?(this.dataPanel.setNormalizeData(this.normalizeData),
this.setCurrentDataSet(k.getSubset()),this.projectorScatterPlotAdapter.setLabelPointAccessor(this.selectedLabelOption),this.inspectorPanel.datasetChanged(),this.inspectorPanel.metadataChanged(n),this.projectionsPanel.metadataChanged(n),this.dataPanel.metadataChanged(n,p)):this.setCurrentDataSet(null)}metadataEdit(k,n){this.selectedPointIndices.forEach(p=>this.dataSet.points[p].metadata[k]=n);this.neighborsOfFirstPoint.forEach(p=>this.dataSet.points[p.index].metadata[k]=n);this.dataSet.spriteAndMetadataInfo.stats=
e.analyzeMetadata(this.dataSet.spriteAndMetadataInfo.stats.map(p=>p.name),this.dataSet.points.map(p=>p.metadata));this.metadataChanged(this.dataSet.spriteAndMetadataInfo);this.metadataEditorContext(!0,k)}metadataChanged(k,n){null!=n&&(this.metadataFile=n);this.dataSet.spriteAndMetadataInfo=k;this.projectionsPanel.metadataChanged(k);this.inspectorPanel.metadataChanged(k);this.dataPanel.metadataChanged(k,this.metadataFile);0<this.selectedPointIndices.length?this.metadataCard.updateMetadata(this.dataSet.points[this.selectedPointIndices[0]].metadata):
this.metadataCard.updateMetadata(null);this.setSelectedLabelOption(this.selectedLabelOption)}metadataEditorContext(k,n){this.inspectorPanel&&this.inspectorPanel.metadataEditorContext(k,n)}setSelectedTensor(k,n){this.bookmarkPanel.setSelectedTensor(k,n,this.dataProvider)}registerSelectionChangedListener(k){this.selectionChangedListeners.push(k)}filterDataset(k){const n=this.selectedPointIndices.length;null==this.dataSetBeforeFilter&&(this.dataSetBeforeFilter=this.dataSet);this.setCurrentDataSet(this.dataSet.getSubset(k));
this.dataSetFilterIndices=k;this.projectorScatterPlotAdapter.updateScatterPlotPositions();this.projectorScatterPlotAdapter.updateScatterPlotAttributes();this.adjustSelectionAndHover(e.util.range(n))}resetFilterDataset(){const k=this.selectedPointIndices.map(n=>this.dataSet.points[n].index);this.setCurrentDataSet(this.dataSetBeforeFilter);null!=this.projection&&(this.projection.dataSet=this.dataSetBeforeFilter);this.dataSetBeforeFilter=null;this.projectorScatterPlotAdapter.updateScatterPlotPositions();
this.projectorScatterPlotAdapter.updateScatterPlotAttributes();this.dataSetFilterIndices=[];this.adjustSelectionAndHover(k)}notifySelectionChanged(k){let n=[];if(this.editMode&&0<k.length)if(1===this.selectedPointIndices.length){let p=this.dataSet.points[this.selectedPointIndices[0]].vector;n=this.neighborsOfFirstPoint.filter(v=>0==k.filter(z=>z==v.index).length);k.forEach(v=>{if(v!=this.selectedPointIndices[0]&&0==this.neighborsOfFirstPoint.filter(z=>z.index==v).length){let z=this.inspectorPanel.distFunc(p,
this.dataSet.points[v].vector),E=0;for(;E<n.length&&n[E].dist<z;)E+=1;n.splice(E,0,{index:v,dist:z})}})}else{let p=this.selectedPointIndices.filter(v=>0==k.filter(z=>z==v).length);k.forEach(v=>{0==this.selectedPointIndices.filter(z=>z==v).length&&p.push(v)});this.selectedPointIndices=p;0<this.selectedPointIndices.length?this.metadataCard.updateMetadata(this.dataSet.points[this.selectedPointIndices[0]].metadata):this.metadataCard.updateMetadata(null)}else this.selectedPointIndices=k,1===k.length?(n=
this.dataSet.findNeighbors(k[0],this.inspectorPanel.distFunc,this.inspectorPanel.numNN),this.metadataCard.updateMetadata(this.dataSet.points[k[0]].metadata)):this.metadataCard.updateMetadata(null);this.selectionChangedListeners.forEach(p=>p(this.selectedPointIndices,n))}registerHoverListener(k){this.hoverListeners.push(k)}notifyHoverOverPoint(k){this.hoverListeners.forEach(n=>n(k))}registerProjectionChangedListener(k){this.projectionChangedListeners.push(k)}notifyProjectionChanged(k){this.projectionChangedListeners.forEach(n=>
n(k))}registerDistanceMetricChangedListener(k){this.distanceMetricChangedListeners.push(k)}notifyDistanceMetricChanged(k){this.distanceMetricChangedListeners.forEach(n=>n(k))}_dataProtoChanged(k){k=k?JSON.parse(k):null;this.initializeDataProvider(k)}makeDefaultPointsInfoAndStats(k){let n=[];k.forEach(p=>{let v={};v.__index__=p.index;n.push(v)});return[n,[{name:"__index__",isNumeric:!1,tooManyUniqueValues:!0,min:0,max:n.length-1}]]}initializeDataProvider(k){if("demo"===this.servingMode)k=e.util.getURLParams(),
this.dataProvider=new e.DemoDataProvider("config"in k?k.config:this.projectorConfigJsonPath);else if("server"===this.servingMode){if(!this.routePrefix)throw"route-prefix is a required parameter";this.dataProvider=new e.ServerDataProvider(this.routePrefix)}else if("proto"===this.servingMode&&null!=k)this.dataProvider=new e.ProtoDataProvider(k);else return;this.dataPanel.initialize(this,this.dataProvider)}getLegendPointColorer(k){return null==k||null==k.map?null:(n,p)=>{n=n.points[p].metadata[this.selectedColorOption.name];
return null==n?"black":k.map(n)}}get3DLabelModeButton(){return this.$$("#labels3DMode")}get3DLabelMode(){return this.get3DLabelModeButton().active}adjustSelectionAndHover(k){this.notifySelectionChanged(k);this.notifyHoverOverPoint(void 0);this.setMouseMode(e.MouseMode.CAMERA_AND_CLICK_SELECT)}setMouseMode(k){this.$$("#selectMode").active=k===e.MouseMode.AREA_SELECT;this.projectorScatterPlotAdapter.scatterPlot.setMouseMode(k)}setCurrentDataSet(k){this.adjustSelectionAndHover([]);null!=this.dataSet&&
this.dataSet.stopTSNE();null!=k&&this.normalizeData&&k.normalize();this.dim=null==k?0:k.dim[1];this.$$("span.numDataPoints").innerText=null==k?"0":""+k.dim[0];this.$$("span.dim").innerText=null==k?"0":""+k.dim[1];this.dataSet=k;this.projectionsPanel.dataSetUpdated(this.dataSet,this.originalDataSet,this.dim);this.projectorScatterPlotAdapter.setDataSet(this.dataSet);this.projectorScatterPlotAdapter.scatterPlot.setCameraParametersForNextCameraCreation(null,!0)}setupUIControls(){this.$$("#reset-zoom").addEventListener("click",
()=>{this.projectorScatterPlotAdapter.scatterPlot.resetZoom();this.projectorScatterPlotAdapter.scatterPlot.startOrbitAnimation()});let k=this.$$("#selectMode");k.addEventListener("click",()=>{this.setMouseMode(k.active?e.MouseMode.AREA_SELECT:e.MouseMode.CAMERA_AND_CLICK_SELECT)});let n=this.$$("#nightDayMode");n.addEventListener("click",()=>{this.projectorScatterPlotAdapter.scatterPlot.setDayNightMode(n.active)});let p=this.$$("#editMode");p.addEventListener("click",()=>{this.editMode=p.active});
this.get3DLabelModeButton().addEventListener("click",()=>{this.projectorScatterPlotAdapter.set3DLabelMode(this.get3DLabelMode())});window.addEventListener("resize",()=>{this.projectorScatterPlotAdapter.resize()});this.projectorScatterPlotAdapter=new e.ProjectorScatterPlotAdapter(this.getScatterContainer(),this);this.projectorScatterPlotAdapter.setLabelPointAccessor(this.selectedLabelOption);this.projectorScatterPlotAdapter.scatterPlot.onCameraMove(()=>this.bookmarkPanel.clearStateSelection());this.registerHoverListener(v=>
this.onHover(v));this.registerProjectionChangedListener(v=>this.onProjectionChanged(v));this.registerSelectionChangedListener((v,z)=>this.onSelectionChanged(v,z))}onHover(k){this.hoverPointIndex=k;let n=null;null!=k&&(k=this.dataSet.points[k],k.metadata[this.selectedLabelOption]&&(n=k.metadata[this.selectedLabelOption].toString()));0===this.selectedPointIndices.length&&(this.statusBar.style.display=n?null:"none",this.statusBar.innerText=n)}getScatterContainer(){return this.$$("#scatter")}onSelectionChanged(k,
n){this.selectedPointIndices=k;this.neighborsOfFirstPoint=n;this.dataPanel.onProjectorSelectionChanged(k,n);k=this.selectedPointIndices.length+n.length;this.statusBar.innerText=`Selected ${k} points`;this.statusBar.style.display=0<k?null:"none"}onProjectionChanged(k){this.dataPanel.projectionChanged(k)}setProjection(k){this.projection=k;null!=k&&this.analyticsLogger.logProjectionChanged(k.projectionType);this.notifyProjectionChanged(k)}notifyProjectionPositionsUpdated(){this.projectorScatterPlotAdapter.notifyProjectionPositionsUpdated()}getCurrentState(){const k=
new e.State;k.projections=[];for(let n=0;n<this.dataSet.points.length;n++){const p=this.dataSet.points[n],v={},z=Object.keys(p.projections);for(let E=0;E<z.length;++E)v[z[E]]=p.projections[z[E]];k.projections.push(v)}k.selectedProjection=this.projection.projectionType;k.dataSetDimensions=this.dataSet.dim;k.tSNEIteration=this.dataSet.tSNEIteration;k.selectedPoints=this.selectedPointIndices;k.filteredPoints=this.dataSetFilterIndices;this.projectorScatterPlotAdapter.populateBookmarkFromUI(k);k.selectedColorOptionName=
this.dataPanel.selectedColorOptionName;k.forceCategoricalColoring=this.dataPanel.forceCategoricalColoring;k.selectedLabelOption=this.selectedLabelOption;this.projectionsPanel.populateBookmarkFromUI(k);return k}loadState(k){this.setProjection(null);this.projectionsPanel.disablePolymerChangesTriggerReprojection();null!=this.dataSetBeforeFilter&&this.resetFilterDataset();null!=k.filteredPoints&&this.filterDataset(k.filteredPoints);this.projectionsPanel.enablePolymerChangesTriggerReprojection();for(var n=
0;n<k.projections.length;n++){var p=this.dataSet.points[n];const v=k.projections[n],z=Object.keys(v);for(let E=0;E<z.length;++E)p.projections[z[E]]=v[z[E]]}this.dataSet.hasTSNERun="tsne"===k.selectedProjection;this.dataSet.tSNEIteration=k.tSNEIteration;this.projectionsPanel.restoreUIFromBookmark(k);this.inspectorPanel.restoreUIFromBookmark(k);this.dataPanel.selectedColorOptionName=k.selectedColorOptionName;this.dataPanel.setForceCategoricalColoring(!!k.forceCategoricalColoring);this.selectedLabelOption=
k.selectedLabelOption;this.projectorScatterPlotAdapter.restoreUIFromBookmark(k);n=e.stateGetAccessorDimensions(k);p=e.getProjectionComponents(k.selectedProjection,n);n=new e.Projection(k.selectedProjection,p,n.length,this.dataSet);this.setProjection(n);this.notifySelectionChanged(k.selectedPoints)}}e.Projector=r;customElements.define(r.prototype.is,r)})(yi||(yi={}));

//# sourceURL=build://vz-projector/vz-projector-dashboard.html.js
Polymer({is:"vz-projector-dashboard",properties:{dataNotFound:Boolean,_routePrefix:{type:String,value:"."},_initialized:Boolean},reload(){},attached(){if(!this._initialized){var e=new XMLHttpRequest;e.open("GET",this._routePrefix+"/runs");e.onload=()=>{this._initialized=!0;let r=JSON.parse(e.responseText);this.set("dataNotFound",0===r.length)};e.onerror=()=>{this.set("dataNotFound",!1)};e.send()}}});
