Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(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.AFRAME = 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(_dereq_,module,exports){
"use strict";module.exports={createLink:function(e,t){var a=document.head||document.getElementsByTagName("head")[0],n=document.createElement("link");n.href=e,n.rel="stylesheet";for(var d in t)if(t.hasOwnProperty(d)){var r=t[d];n.setAttribute("data-"+d,r)}a.appendChild(n)},createStyle:function(e,t){var a=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css";for(var d in t)if(t.hasOwnProperty(d)){var r=t[d];n.setAttribute("data-"+d,r)}n.sheet?(n.innerHTML=e,n.sheet.cssText=e,a.appendChild(n)):n.styleSheet?(a.appendChild(n),n.styleSheet.cssText=e):(n.appendChild(document.createTextNode(e)),a.appendChild(n))}};
},{}],2:[function(_dereq_,module,exports){
function runTimeout(e){if(cachedSetTimeout===setTimeout)return setTimeout(e,0);try{return cachedSetTimeout(e,0)}catch(r){try{return cachedSetTimeout.call(null,e,0)}catch(r){return cachedSetTimeout.call(this,e,0)}}}function runClearTimeout(e){if(cachedClearTimeout===clearTimeout)return clearTimeout(e);try{return cachedClearTimeout(e)}catch(r){try{return cachedClearTimeout.call(null,e)}catch(r){return cachedClearTimeout.call(this,e)}}}function cleanUpNextTick(){draining&&currentQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var e=runTimeout(cleanUpNextTick);draining=!0;for(var r=queue.length;r;){for(currentQueue=queue,queue=[];++queueIndex<r;)currentQueue&&currentQueue[queueIndex].run();queueIndex=-1,r=queue.length}currentQueue=null,draining=!1,runClearTimeout(e)}}function Item(e,r){this.fun=e,this.array=r}function noop(){}var process=module.exports={},cachedSetTimeout,cachedClearTimeout;!function(){try{cachedSetTimeout=setTimeout}catch(e){cachedSetTimeout=function(){throw new Error("setTimeout is not defined")}}try{cachedClearTimeout=clearTimeout}catch(e){cachedClearTimeout=function(){throw new Error("clearTimeout is not defined")}}}();var queue=[],draining=!1,currentQueue,queueIndex=-1;process.nextTick=function(e){var r=new Array(arguments.length-1);if(arguments.length>1)for(var u=1;u<arguments.length;u++)r[u-1]=arguments[u];queue.push(new Item(e,r)),1!==queue.length||draining||runTimeout(drainQueue)},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};
},{}],3:[function(_dereq_,module,exports){
function useColors(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function formatArgs(){var o=arguments,e=this.useColors;if(o[0]=(e?"%c":"")+this.namespace+(e?" %c":" ")+o[0]+(e?"%c ":" ")+"+"+exports.humanize(this.diff),!e)return o;var r="color: "+this.color;o=[o[0],r,"color: inherit"].concat(Array.prototype.slice.call(o,1));var t=0,s=0;return o[0].replace(/%[a-z%]/g,function(o){"%%"!==o&&(t++,"%c"===o&&(s=t))}),o.splice(s,0,r),o}function log(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function save(o){try{null==o?exports.storage.removeItem("debug"):exports.storage.debug=o}catch(o){}}function load(){var o;try{o=exports.storage.debug}catch(o){}return o}function localstorage(){try{return window.localStorage}catch(o){}}exports=module.exports=_dereq_("./debug"),exports.log=log,exports.formatArgs=formatArgs,exports.save=save,exports.load=load,exports.useColors=useColors,exports.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:localstorage(),exports.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],exports.formatters.j=function(o){return JSON.stringify(o)},exports.enable(load());
},{"./debug":4}],4:[function(_dereq_,module,exports){
function selectColor(){return exports.colors[prevColor++%exports.colors.length]}function debug(e){function r(){}function o(){var e=o,r=+new Date,s=r-(prevTime||r);e.diff=s,e.prev=prevTime,e.curr=r,prevTime=r,null==e.useColors&&(e.useColors=exports.useColors()),null==e.color&&e.useColors&&(e.color=selectColor());var t=Array.prototype.slice.call(arguments);t[0]=exports.coerce(t[0]),"string"!=typeof t[0]&&(t=["%o"].concat(t));var n=0;t[0]=t[0].replace(/%([a-z%])/g,function(r,o){if("%%"===r)return r;n++;var s=exports.formatters[o];if("function"==typeof s){var p=t[n];r=s.call(e,p),t.splice(n,1),n--}return r}),"function"==typeof exports.formatArgs&&(t=exports.formatArgs.apply(e,t));var p=o.log||exports.log||console.log.bind(console);p.apply(e,t)}r.enabled=!1,o.enabled=!0;var s=exports.enabled(e)?o:r;return s.namespace=e,s}function enable(e){exports.save(e);for(var r=(e||"").split(/[\s,]+/),o=r.length,s=0;s<o;s++)r[s]&&(e=r[s].replace(/\*/g,".*?"),"-"===e[0]?exports.skips.push(new RegExp("^"+e.substr(1)+"$")):exports.names.push(new RegExp("^"+e+"$")))}function disable(){exports.enable("")}function enabled(e){var r,o;for(r=0,o=exports.skips.length;r<o;r++)if(exports.skips[r].test(e))return!1;for(r=0,o=exports.names.length;r<o;r++)if(exports.names[r].test(e))return!0;return!1}function coerce(e){return e instanceof Error?e.stack||e.message:e}exports=module.exports=debug,exports.coerce=coerce,exports.disable=disable,exports.enable=enable,exports.enabled=enabled,exports.humanize=_dereq_("ms"),exports.names=[],exports.skips=[],exports.formatters={};var prevColor=0,prevTime;
},{"ms":5}],5:[function(_dereq_,module,exports){
function parse(e){if(e=""+e,!(e.length>1e4)){var a=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(a){var r=parseFloat(a[1]),c=(a[2]||"ms").toLowerCase();switch(c){case"years":case"year":case"yrs":case"yr":case"y":return r*y;case"days":case"day":case"d":return r*d;case"hours":case"hour":case"hrs":case"hr":case"h":return r*h;case"minutes":case"minute":case"mins":case"min":case"m":return r*m;case"seconds":case"second":case"secs":case"sec":case"s":return r*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r}}}}function short(e){return e>=d?Math.round(e/d)+"d":e>=h?Math.round(e/h)+"h":e>=m?Math.round(e/m)+"m":e>=s?Math.round(e/s)+"s":e+"ms"}function long(e){return plural(e,d,"day")||plural(e,h,"hour")||plural(e,m,"minute")||plural(e,s,"second")||e+" ms"}function plural(s,e,a){if(!(s<e))return s<1.5*e?Math.floor(s/e)+" "+a:Math.ceil(s/e)+" "+a+"s"}var s=1e3,m=60*s,h=60*m,d=24*h,y=365.25*d;module.exports=function(s,e){return e=e||{},"string"==typeof s?parse(s):e.long?long(s):short(s)};
},{}],6:[function(_dereq_,module,exports){
"use strict";function toObject(r){if(null===r||void 0===r)throw new TypeError("Sources cannot be null or undefined");return Object(r)}function assignKey(r,e,n){var t=e[n];if(void 0!==t&&null!==t){if(hasOwnProperty.call(r,n)&&(void 0===r[n]||null===r[n]))throw new TypeError("Cannot convert undefined or null to object ("+n+")");hasOwnProperty.call(r,n)&&isObj(t)?r[n]=assign(Object(r[n]),e[n]):r[n]=t}}function assign(r,e){if(r===e)return r;e=Object(e);for(var n in e)hasOwnProperty.call(e,n)&&assignKey(r,e,n);if(Object.getOwnPropertySymbols)for(var t=Object.getOwnPropertySymbols(e),o=0;o<t.length;o++)propIsEnumerable.call(e,t[o])&&assignKey(r,e,t[o]);return r}var isObj=_dereq_("is-obj"),hasOwnProperty=Object.prototype.hasOwnProperty,propIsEnumerable=Object.prototype.propertyIsEnumerable;module.exports=function(r){r=toObject(r);for(var e=1;e<arguments.length;e++)assign(r,arguments[e]);return r};
},{"is-obj":7}],7:[function(_dereq_,module,exports){
"use strict";module.exports=function(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)};
},{}],8:[function(_dereq_,module,exports){
!function(t,r,n,a){"use strict";function l(e,t){for(var r=0,n=e.length;r<n;r++)m(e[r],t)}function i(e){for(var t,r=0,n=e.length;r<n;r++)t=e[r],y(t,H[u(t)])}function o(e){return function(t){ae(t)&&(m(t,e),l(t.querySelectorAll(x),e))}}function u(e){var t=oe.call(e,"is"),r=e.nodeName.toUpperCase(),n=G.call(U,t?k+t.toUpperCase():_+r);return t&&-1<n&&!c(r,t)?-1:n}function c(e,t){return-1<x.indexOf(e+'[is="'+t+'"]')}function s(e){var t=e.currentTarget,r=e.attrChange,n=e.attrName,a=e.target;me&&(!a||a===t)&&t.attributeChangedCallback&&"style"!==n&&e.prevValue!==e.newValue&&t.attributeChangedCallback(n,r===e[F]?null:e.prevValue,r===e[I]?null:e.newValue)}function d(e){var t=o(e);return function(e){g.push(t,e.target)}}function f(e){be&&(be=!1,e.currentTarget.removeEventListener(P,f)),l((e.target||r).querySelectorAll(x),e.detail===T?T:L),ne&&p()}function h(e,t){var r=this;ue.call(r,e,t),C.call(r,{target:r})}function v(e,t){ee(e,t),O?O.observe(e,de):(pe&&(e.setAttribute=h,e[w]=E(e),e.addEventListener(R,C)),e.addEventListener(D,s)),e.createdCallback&&me&&(e.created=!0,e.createdCallback(),e.created=!1)}function p(){for(var e,t=0,r=le.length;t<r;t++)e=le[t],Z.contains(e)||(r--,le.splice(t--,1),m(e,T))}function b(e){throw new Error("A "+e+" type is already registered")}function m(e,t){var r,n=u(e);-1<n&&(N(e,H[n]),n=0,t!==L||e[L]?t===T&&!e[T]&&(e[L]=!1,e[T]=!0,n=1):(e[T]=!1,e[L]=!0,n=1,ne&&G.call(le,e)<0&&le.push(e)),n&&(r=e[t+"Callback"])&&r.call(e))}if(!(a in r)){var g,C,A,E,O,N,y,w="__"+a+(1e5*Math.random()>>0),L="attached",T="detached",M="extends",F="ADDITION",V="MODIFICATION",I="REMOVAL",D="DOMAttrModified",P="DOMContentLoaded",R="DOMSubtreeModified",_="<",k="=",q=/^[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)+$/,S=["ANNOTATION-XML","COLOR-PROFILE","FONT-FACE","FONT-FACE-SRC","FONT-FACE-URI","FONT-FACE-FORMAT","FONT-FACE-NAME","MISSING-GLYPH"],U=[],H=[],x="",Z=r.documentElement,G=U.indexOf||function(e){for(var t=this.length;t--&&this[t]!==e;);return t},j=n.prototype,z=j.hasOwnProperty,K=j.isPrototypeOf,W=n.defineProperty,X=n.getOwnPropertyDescriptor,Y=n.getOwnPropertyNames,$=n.getPrototypeOf,B=n.setPrototypeOf,J=!!n.__proto__,Q=n.create||function e(t){return t?(e.prototype=t,new e):this},ee=B||(J?function(e,t){return e.__proto__=t,e}:Y&&X?function(){function e(e,t){for(var r,n=Y(t),a=0,l=n.length;a<l;a++)r=n[a],z.call(e,r)||W(e,r,X(t,r))}return function(t,r){do e(t,r);while((r=$(r))&&!K.call(r,t));return t}}():function(e,t){for(var r in t)e[r]=t[r];return e}),te=t.MutationObserver||t.WebKitMutationObserver,re=(t.HTMLElement||t.Element||t.Node).prototype,ne=!K.call(re,Z),ae=ne?function(e){return 1===e.nodeType}:function(e){return K.call(re,e)},le=ne&&[],ie=re.cloneNode,oe=re.getAttribute,ue=re.setAttribute,ce=re.removeAttribute,se=r.createElement,de=te&&{attributes:!0,characterData:!0,attributeOldValue:!0},fe=te||function(e){pe=!1,Z.removeEventListener(D,fe)},he=t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.msRequestAnimationFrame||function(e){setTimeout(e,10)},ve=!1,pe=!0,be=!0,me=!0;B||J?(N=function(e,t){K.call(t,e)||v(e,t)},y=v):(N=function(e,t){e[w]||(e[w]=n(!0),v(e,t))},y=N),ne?(pe=!1,function(){var t=X(re,"addEventListener"),r=t.value,n=function(e){var t=new CustomEvent(D,{bubbles:!0});t.attrName=e,t.prevValue=oe.call(this,e),t.newValue=null,t[I]=t.attrChange=2,ce.call(this,e),this.dispatchEvent(t)},a=function(t,r){var n=this.hasAttribute(t),a=n&&oe.call(this,t);e=new CustomEvent(D,{bubbles:!0}),ue.call(this,t,r),e.attrName=t,e.prevValue=n?a:null,e.newValue=r,n?e[V]=e.attrChange=1:e[F]=e.attrChange=0,this.dispatchEvent(e)},l=function(e){var t,r=e.currentTarget,n=r[w],a=e.propertyName;n.hasOwnProperty(a)&&(n=n[a],t=new CustomEvent(D,{bubbles:!0}),t.attrName=n.name,t.prevValue=n.value||null,t.newValue=n.value=r[a]||null,null==t.prevValue?t[F]=t.attrChange=0:t[V]=t.attrChange=1,r.dispatchEvent(t))};t.value=function(e,t,i){e===D&&this.attributeChangedCallback&&this.setAttribute!==a&&(this[w]={className:{name:"class",value:this.className}},this.setAttribute=a,this.removeAttribute=n,r.call(this,"propertychange",l)),r.call(this,e,t,i)},W(re,"addEventListener",t)}()):te||(Z.addEventListener(D,fe),Z.setAttribute(w,1),Z.removeAttribute(w),pe&&(C=function(e){var t,r,n,a=this;if(a===e.target){t=a[w],a[w]=r=E(a);for(n in r){if(!(n in t))return A(0,a,n,t[n],r[n],F);if(r[n]!==t[n])return A(1,a,n,t[n],r[n],V)}for(n in t)if(!(n in r))return A(2,a,n,t[n],r[n],I)}},A=function(e,t,r,n,a,l){var i={attrChange:e,currentTarget:t,attrName:r,prevValue:n,newValue:a};i[l]=e,s(i)},E=function(e){for(var t,r,n={},a=e.attributes,l=0,i=a.length;l<i;l++)t=a[l],r=t.name,"setAttribute"!==r&&(n[r]=t.value);return n})),r[a]=function(e,t){if(n=e.toUpperCase(),ve||(ve=!0,te?(O=function(e,t){function r(e,t){for(var r=0,n=e.length;r<n;t(e[r++]));}return new te(function(n){for(var a,l,i,o=0,u=n.length;o<u;o++)a=n[o],"childList"===a.type?(r(a.addedNodes,e),r(a.removedNodes,t)):(l=a.target,me&&l.attributeChangedCallback&&"style"!==a.attributeName&&(i=oe.call(l,a.attributeName),i!==a.oldValue&&l.attributeChangedCallback(a.attributeName,a.oldValue,i)))})}(o(L),o(T)),O.observe(r,{childList:!0,subtree:!0})):(g=[],he(function e(){for(;g.length;)g.shift().call(null,g.shift());he(e)}),r.addEventListener("DOMNodeInserted",d(L)),r.addEventListener("DOMNodeRemoved",d(T))),r.addEventListener(P,f),r.addEventListener("readystatechange",f),r.createElement=function(e,t){var n=se.apply(r,arguments),a=""+e,l=G.call(U,(t?k:_)+(t||a).toUpperCase()),i=-1<l;return t&&(n.setAttribute("is",t=t.toLowerCase()),i&&(i=c(a.toUpperCase(),t))),me=!r.createElement.innerHTMLHelper,i&&y(n,H[l]),n},re.cloneNode=function(e){var t=ie.call(this,!!e),r=u(t);return-1<r&&y(t,H[r]),e&&i(t.querySelectorAll(x)),t}),-2<G.call(U,k+n)+G.call(U,_+n)&&b(e),!q.test(n)||-1<G.call(S,n))throw new Error("The type "+e+" is invalid");var n,a,s=function(){return v?r.createElement(p,n):r.createElement(p)},h=t||j,v=z.call(h,M),p=v?t[M].toUpperCase():n;return v&&-1<G.call(U,_+p)&&b(p),a=U.push((v?k:_)+n)-1,x=x.concat(x.length?",":"",v?p+'[is="'+e.toLowerCase()+'"]':p),s.prototype=H[a]=z.call(h,"prototype")?h.prototype:Q(re),l(r.querySelectorAll(x),L),s}}}(window,document,Object,"registerElement");
},{}],9:[function(_dereq_,module,exports){
"use strict";function toObject(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var hasOwnProperty=Object.prototype.hasOwnProperty,propIsEnumerable=Object.prototype.propertyIsEnumerable;module.exports=Object.assign||function(e,r){for(var t,o,n=toObject(e),l=1;l<arguments.length;l++){t=Object(arguments[l]);for(var c in t)hasOwnProperty.call(t,c)&&(n[c]=t[c]);if(Object.getOwnPropertySymbols){o=Object.getOwnPropertySymbols(t);for(var p=0;p<o.length;p++)propIsEnumerable.call(t,o[p])&&(n[o[p]]=t[o[p]])}}return n};
},{}],10:[function(_dereq_,module,exports){
(function (global){
var performance=global.performance||{},present=function(){for(var e=["now","webkitNow","msNow","mozNow","oNow"];e.length;){var n=e.shift();if(n in performance)return performance[n].bind(performance)}var r=Date.now||function(){return(new Date).getTime()},o=(performance.timing||{}).navigationStart||r();return function(){return r()-o}}();present.performanceNow=performance.now,present.noConflict=function(){performance.now=present.performanceNow},present.conflict=function(){performance.now=present},present.conflict(),module.exports=present;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}],11:[function(_dereq_,module,exports){
!function(t){function e(t,e){return function(){t.apply(e,arguments)}}function n(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],f(t,e(r,this),e(i,this))}function o(t){var e=this;return null===this._state?void this._deferreds.push(t):void l(function(){var n=e._state?t.onFulfilled:t.onRejected;if(null===n)return void(e._state?t.resolve:t.reject)(e._value);var o;try{o=n(e._value)}catch(e){return void t.reject(e)}t.resolve(o)})}function r(t){try{if(t===this)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if("function"==typeof n)return void f(e(n,t),e(r,this),e(i,this))}this._state=!0,this._value=t,u.call(this)}catch(t){i.call(this,t)}}function i(t){this._state=!1,this._value=t,u.call(this)}function u(){for(var t=0,e=this._deferreds.length;t<e;t++)o.call(this,this._deferreds[t]);this._deferreds=null}function c(t,e,n,o){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.resolve=n,this.reject=o}function f(t,e,n){var o=!1;try{t(function(t){o||(o=!0,e(t))},function(t){o||(o=!0,n(t))})}catch(t){if(o)return;o=!0,n(t)}}var s=setTimeout,l="function"==typeof setImmediate&&setImmediate||function(t){s(t,1)},h=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};n.prototype.catch=function(t){return this.then(null,t)},n.prototype.then=function(t,e){var r=this;return new n(function(n,i){o.call(r,new c(t,e,n,i))})},n.all=function(){var t=Array.prototype.slice.call(1===arguments.length&&h(arguments[0])?arguments[0]:arguments);return new n(function(e,n){function o(i,u){try{if(u&&("object"==typeof u||"function"==typeof u)){var c=u.then;if("function"==typeof c)return void c.call(u,function(t){o(i,t)},n)}t[i]=u,0===--r&&e(t)}catch(t){n(t)}}if(0===t.length)return e([]);for(var r=t.length,i=0;i<t.length;i++)o(i,t[i])})},n.resolve=function(t){return t&&"object"==typeof t&&t.constructor===n?t:new n(function(e){e(t)})},n.reject=function(t){return new n(function(e,n){n(t)})},n.race=function(t){return new n(function(e,n){for(var o=0,r=t.length;o<r;o++)t[o].then(e,n)})},n._setImmediateFn=function(t){l=t},"undefined"!=typeof module&&module.exports?module.exports=n:t.Promise||(t.Promise=n)}(this);
},{}],12:[function(_dereq_,module,exports){
function parse(r){var n=function(r){return r.trim()},e={};return getKeyValueChunks(r).map(n).filter(Boolean).forEach(function(r){var n=r.indexOf(":"),t=r.substr(0,n).trim(),i=r.substr(n+1).trim();e[t]=i}),e}function getKeyValueChunks(r){for(var n,e=[],t=0,i=";",u=/url\([^\)]+$/,s="";t<r.length;)n=r.indexOf(i,t),n===-1&&(n=r.length),s+=r.substring(t,n),u.test(s)?(s+=";",t=n+1):(e.push(s),s="",t=n+1);return e}function stringify(r){return Object.keys(r).map(function(n){return n+":"+r[n]}).join(";")}function normalize(r){return stringify(parse(r))}module.exports.parse=parse,module.exports.stringify=stringify,module.exports.normalize=normalize;
},{}],13:[function(_dereq_,module,exports){
THREE.BlendCharacter=function(){this.weightSchedule=[],this.warpSchedule=[],this.load=function(t,e){var i=this,n=new THREE.ObjectLoader;n.load(t,function(n){if(n.traverse(function(t){t instanceof THREE.SkinnedMesh&&(i.skinnedMesh=t)}),THREE.SkinnedMesh.call(i,i.skinnedMesh.geometry,i.skinnedMesh.material),void 0==i.skinnedMesh)return void console.log("unable to find skinned mesh in "+t);i.material.skinning=!0,i.mixer=new THREE.AnimationMixer(i),i.mixer=i.mixer;for(var s=0;s<i.geometry.animations.length;++s)i.mixer.clipAction(i.geometry.animations[s]);void 0!==e&&e()})},this.update=function(t){this.mixer.update(t)},this.play=function(t,e){return this.mixer.clipAction(t).setEffectiveWeight(e).play()},this.crossfade=function(t,e,i){this.mixer.stopAllAction();var n=this.play(t,1),s=this.play(e,1);n.crossFadeTo(s,i,!1)},this.warp=function(t,e,i){this.mixer.stopAllAction();var n=this.play(t,1),s=this.play(e,1);n.crossFadeTo(s,i,!0)},this.applyWeight=function(t,e){this.mixer.clipAction(t).setEffectiveWeight(e)},this.getWeight=function(t){return this.mixer.clipAction(t).getEffectiveWeight()},this.pauseAll=function(){this.mixer.timeScale=0},this.unPauseAll=function(){this.mixer.timeScale=1},this.stopAll=function(){this.mixer.stopAllAction()},this.showModel=function(t){this.visible=t}},THREE.BlendCharacter.prototype=Object.create(THREE.SkinnedMesh.prototype),THREE.BlendCharacter.prototype.constructor=THREE.BlendCharacter,THREE.BlendCharacter.prototype.getForward=function(){var t=new THREE.Vector3;return function(){return t.set(-this.matrix.elements[8],-this.matrix.elements[9],-this.matrix.elements[10]),t}};
},{}],14:[function(_dereq_,module,exports){
THREE.ColladaLoader=function(){function e(e,i,s,r){var a=0;if(document.implementation&&document.implementation.createDocument){var n=new XMLHttpRequest;n.onreadystatechange=function(){4===n.readyState?0===n.status||200===n.status?n.response?(Xe=i,t(n.response,void 0,e)):r?r({type:"error",url:e}):console.error("ColladaLoader: Empty or non-existing file ("+e+")"):r?r({type:"error",url:e}):console.error("ColladaLoader: Couldn't load \""+e+'" ('+n.status+")"):3===n.readyState&&s&&(0===a&&(a=n.getResponseHeader("Content-Length")),s({total:a,loaded:n.responseText.length}))},n.open("GET",e,!0),n.send(null)}else alert("Don't know how to parse XML!")}function t(e,t,i){if(qe=(new DOMParser).parseFromString(e,"text/xml"),t=t||Xe,void 0!==i){var h=i.split("/");h.pop(),Oe=(h.length<1?".":h.join("/"))+"/"}s(),we(),Ye=r("library_images image",R,"image"),Be=r("library_materials material",U,"material"),De=r("library_effects effect",Q,"effect"),Fe=r("library_geometries geometry",q,"geometry"),Ue=r("library_cameras camera",se,"camera"),Pe=r("library_lights light",ae,"light"),ze=r("library_controllers controller",_,"controller"),Ze=r("library_animations animation",K,"animation"),He=r("library_visual_scenes visual_scene",j,"visual_scene"),Me=r("library_kinematics_models kinematics_model",oe,"kinematics_model"),Se=[],Ie=[],_e=a(),Ve=new THREE.Group;for(var l=0;l<_e.nodes.length;l++)Ve.add(v(_e.nodes[l]));Ve.scale.multiplyScalar(We),o(),Ae=n(),g();var c={scene:Ve,morphs:Se,skins:Ie,animations:Ce,kinematics:je,dae:{images:Ye,materials:Be,cameras:Ue,lights:Pe,effects:De,geometries:Fe,controllers:ze,animations:Ze,visualScenes:He,visualScene:_e,scene:_e,kinematicsModels:Me,kinematicsModel:Ae}};return t&&t(c),c}function i(e){Ge=e}function s(){var e=qe.querySelectorAll("asset"),t=e[0];if(t&&t.childNodes)for(var i=0;i<t.childNodes.length;i++){var s=t.childNodes[i];switch(s.nodeName){case"unit":var r=s.getAttribute("meter");r&&(We=parseFloat(r));break;case"up_axis":Qe=s.textContent.charAt(0)}}}function r(e,t,i){for(var s=qe.querySelectorAll(e),r={},a=0,n=s.length,o=0;o<n;o++){var h=s[o],l=(new t).parse(h);l.id&&0!==l.id.length||(l.id=i+a++),r[l.id]=l}return r}function a(){var e=qe.querySelectorAll("scene instance_visual_scene")[0];if(e){var t=e.getAttribute("url").replace(/^#/,"");return He[t.length>0?t:"visual_scene0"]}return null}function n(){var e=qe.querySelectorAll("instance_kinematics_model")[0];if(e){var t=e.getAttribute("url").replace(/^#/,"");return Me[t.length>0?t:"kinematics_model0"]}return null}function o(){Ce=[],h(Ve)}function h(e){var t=_e.getChildById(e.colladaId,!0),i=null;if(t&&t.keys){i={fps:60,hierarchy:[{node:t,keys:t.keys,sids:t.sids}],node:e,name:"animation_"+e.name,length:0},Ce.push(i);for(var s=0,r=t.keys.length;s<r;s++)i.length=Math.max(i.length,t.keys[s].time)}else i={hierarchy:[{keys:[],sids:[]}]};for(var s=0,r=e.children.length;s<r;s++)for(var a=h(e.children[s]),n=0,o=a.hierarchy.length;n<o;n++)i.hierarchy.push({keys:[],sids:[]});return i}function l(){var e,t=1e6,i=-t,s=0;for(var r in Ze){var a=Ze[r];e=e||a.id;for(var n=0;n<a.sampler.length;n++){var o=a.sampler[n];o.create(),t=Math.min(t,o.startTime),i=Math.max(i,o.endTime),s=Math.max(s,o.input.length)}}return{start:t,end:i,frames:s,ID:e}}function c(e,t){var i=t instanceof O?ze[t.url]:t;if(!i||!i.morph)return void console.log("could not find morph controller!");for(var s=i.morph,r=0;r<s.targets.length;r++){var a=s.targets[r],n=Fe[a];if(n.mesh&&n.mesh.primitives&&n.mesh.primitives.length){var o=n.mesh.primitives[0].geometry;o.vertices.length===e.vertices.length&&e.morphTargets.push({name:"target_1",vertices:o.vertices})}}e.morphTargets.push({name:"target_Z",vertices:e.vertices})}function d(e,t,i,s){if(e.world=e.world||new THREE.Matrix4,e.localworld=e.localworld||new THREE.Matrix4,e.world.copy(e.matrix),e.localworld.copy(e.matrix),e.channels&&e.channels.length){var r=e.channels[0],a=r.sampler.output[i];a instanceof THREE.Matrix4&&(e.world.copy(a),e.localworld.copy(a),0===i&&e.matrix.copy(a))}s&&e.world.multiplyMatrices(s,e.world),t.push(e);for(var n=0;n<e.nodes.length;n++)d(e.nodes[n],t,i,e.world)}function p(e,t){for(var i=0;i<e.length;i++){var s=e[i],r=-1;if("JOINT"==s.type){for(var a=0;a<t.joints.length;a++)if(s.sid===t.joints[a]){r=a;break}if(r>=0){var n=t.invBindMatrices[r];s.invBindMatrix=n,s.skinningMatrix=new THREE.Matrix4,s.skinningMatrix.multiplyMatrices(s.world,n),s.animatrix=new THREE.Matrix4,s.animatrix.copy(s.localworld),s.weights=[];for(var a=0;a<t.weights.length;a++)for(var o=0;o<t.weights[a].length;o++){var h=t.weights[a][o];h.joint===r&&s.weights.push(h)}}else console.warn("ColladaLoader: Could not find joint '"+s.sid+"'."),s.skinningMatrix=new THREE.Matrix4,s.weights=[]}}}function u(e){var t=[],i=function(e,t,s){var r={};r.name=t.sid,r.parent=e,r.matrix=t.matrix;var a=[new THREE.Vector3,new THREE.Quaternion,new THREE.Vector3];r.matrix.decompose(a[0],a[1],a[2]),r.pos=[a[0].x,a[0].y,a[0].z],r.scl=[a[2].x,a[2].y,a[2].z],r.rotq=[a[1].x,a[1].y,a[1].z,a[1].w],s.push(r);for(var n in t.nodes)i(t.sid,t.nodes[n],s)};return i(-1,e,t),t}function f(e,t,i){var s=[];d(t,s,-1),p(s,i.skin);for(var r=new THREE.Vector3,a=[],n=0;n<e.vertices.length;n++)a.push(new THREE.Vector3);for(n=0;n<s.length;n++)if("JOINT"==s[n].type)for(var o=0;o<s[n].weights.length;o++){var h=s[n].weights[o],l=h.index,c=h.weight,u=e.vertices[l],f=a[l];r.x=u.x,r.y=u.y,r.z=u.z,r.applyMatrix4(s[n].skinningMatrix),f.x+=r.x*c,f.y+=r.y*c,f.z+=r.z*c}for(var n=0;n<e.vertices.length;n++)e.vertices[n]=a[n]}function m(e,t,i){var s=ze[t.url];if(i=void 0!==i?i:40,!s||!s.skin)return void console.log("ColladaLoader: Could not find skin controller.");if(!t.skeleton||!t.skeleton.length)return void console.log("ColladaLoader: Could not find the skeleton for the skin. ");for(var r=l(),a=_e.getChildById(t.skeleton[0],!0)||_e.getChildBySid(t.skeleton[0],!0),n=u(a),o=s.skin.joints,h=[],c=0;c<o.length;c++)for(var m=0;m<n.length;m++)n[m].name===o[c]&&(h[c]=n[m]);for(var c=0;c<h.length;c++)for(var m=0;m<h.length;m++)h[c].parent===h[m].name&&(h[c].parent=m);var c,m,g;new THREE.Vector3;for(c=0;c<e.vertices.length;c++)e.vertices[c].applyMatrix4(s.skin.bindShapeMatrix);for(var v=[],y=[],b=s.skin.weights,c=0;c<b.length;c++){var w=new THREE.Vector4(b[c][0]?b[c][0].joint:0,b[c][1]?b[c][1].joint:0,b[c][2]?b[c][2].joint:0,b[c][3]?b[c][3].joint:0),g=new THREE.Vector4(b[c][0]?b[c][0].weight:0,b[c][1]?b[c][1].weight:0,b[c][2]?b[c][2].weight:0,b[c][3]?b[c][3].weight:0);v.push(w),y.push(g)}e.skinIndices=v,e.skinWeights=y,e.bones=h;for(var x={name:r.ID,fps:30,length:r.frames/30,hierarchy:[]},m=0;m<h.length;m++)x.hierarchy.push({parent:h[m].parent,name:h[m].name,keys:[]});for(console.log("ColladaLoader:",r.ID+" has "+h.length+" bones."),f(e,a,s),i=0;i<r.frames;i++){var N=[];d(a,N,i),p(N,s.skin);for(var c=0;c<N.length;c++)for(var m=0;m<x.hierarchy.length;m++)if(x.hierarchy[m].name===N[c].sid){var k={};k.time=i/30,k.matrix=N[c].animatrix,0===i&&(N[c].matrix=k.matrix);var T=[new THREE.Vector3,new THREE.Quaternion,new THREE.Vector3];k.matrix.decompose(T[0],T[1],T[2]),k.pos=[T[0].x,T[0].y,T[0].z],k.scl=[T[2].x,T[2].y,T[2].z],k.rot=T[1],x.hierarchy[m].keys.push(k)}e.animation=x}}function g(){if(Ae&&0===Ae.joints.length)return void(je=void 0);var e={},t=function(t,i){var s=i.getAttribute("id"),r=_e.getChildById(s,!0),a=Ae.joints[t];Ve.traverse(function(i){i.colladaId==s&&(e[t]={node:i,transforms:r.transforms,joint:a,position:a.zeroPosition})})};je={joints:Ae&&Ae.joints,getJointValue:function(t){var i=e[t];return i?i.position:void console.log("getJointValue: joint "+t+" doesn't exist")},setJointValue:function(t,i){var r=e[t];if(r){var a=r.joint;if(i>a.limits.max||i<a.limits.min)console.log("setJointValue: joint "+t+" value "+i+" outside of limits (min: "+a.limits.min+", max: "+a.limits.max+")");else if(a.static)console.log("setJointValue: joint "+t+" is static");else{var n=r.node,o=a.axis,h=r.transforms,l=new THREE.Matrix4;for(s=0;s<h.length;s++){var c=h[s];if(c.sid&&c.sid.indexOf("joint"+t)!==-1)switch(a.type){case"revolute":l.multiply(d.makeRotationAxis(o,THREE.Math.degToRad(i)));break;case"prismatic":l.multiply(d.makeTranslation(o.x*i,o.y*i,o.z*i));break;default:console.warn("setJointValue: unknown joint type: "+a.type)}else{var d=new THREE.Matrix4;switch(c.type){case"matrix":l.multiply(c.obj);break;case"translate":l.multiply(d.makeTranslation(c.obj.x,c.obj.y,c.obj.z));break;case"rotate":l.multiply(d.makeRotationAxis(c.obj,c.angle))}}}var p=l.elements,u=Array.prototype.slice.call(p),f=[u[0],u[4],u[8],u[12],u[1],u[5],u[9],u[13],u[2],u[6],u[10],u[14],u[3],u[7],u[11],u[15]];n.matrix.set.apply(n.matrix,f),n.matrix.decompose(n.position,n.quaternion,n.scale)}}else console.log("setJointValue: joint "+t+" doesn't exist")}};var i=qe.querySelector("scene instance_kinematics_scene");if(i)for(var s=0;s<i.childNodes.length;s++){var r=i.childNodes[s];if(1==r.nodeType)switch(r.nodeName){case"bind_joint_axis":var a=r.getAttribute("target").split("/").pop(),n=r.querySelector("axis param").textContent,o=parseInt(n.split("joint").pop().split(".")[0]),h=qe.querySelector('[sid="'+a+'"]');if(h){var l=h.parentElement;t(o,l)}}}}function v(e,t){var i,s,r,a,n=new THREE.Object3D,o=!1;for(r=0;r<e.controllers.length;r++){var h=ze[e.controllers[r].url];switch(h.type){case"skin":if(Fe[h.skin.source]){var l=new I;l.url=h.skin.source,l.instance_material=e.controllers[r].instance_material,e.geometries.push(l),o=!0,i=e.controllers[r]}else if(ze[h.skin.source]){var d=ze[h.skin.source];if(s=d,d.morph&&Fe[d.morph.source]){var l=new I;l.url=d.morph.source,l.instance_material=e.controllers[r].instance_material,e.geometries.push(l)}}break;case"morph":if(Fe[h.morph.source]){var l=new I;l.url=h.morph.source,l.instance_material=e.controllers[r].instance_material,e.geometries.push(l),s=e.controllers[r]}console.log("ColladaLoader: Morph-controller partially supported.")}}var p={};for(r=0;r<e.geometries.length;r++){var u,f=e.geometries[r],g=f.instance_material,y=Fe[f.url],b={},w=[],x=0;if(y){if(!y.mesh||!y.mesh.primitives)continue;if(0===n.name.length&&(n.name=y.id),g)for(a=0;a<g.length;a++){var N=g[a],k=Be[N.target],T=k.instance_effect.url,E=De[T].shader,R=E.material;if(y.doubleSided){if(!(N.symbol in p)){var _=R.clone();_.side=THREE.DoubleSide,p[N.symbol]=_}R=p[N.symbol]}R.opacity=R.opacity?R.opacity:1,b[N.symbol]=x,w.push(R),u=R,u.name=null===k.name||""===k.name?k.id:k.name,x++}var A,C=u||new THREE.MeshLambertMaterial({color:14540253,side:y.doubleSided?THREE.DoubleSide:THREE.FrontSide}),j=y.mesh.geometry3js;if(x>1)for(C=new THREE.MultiMaterial(w),a=0;a<j.faces.length;a++){var H=j.faces[a];H.materialIndex=b[H.daeMaterial]}void 0!==i?(m(j,i),j.morphTargets.length>0?(C.morphTargets=!0,C.skinning=!1):(C.morphTargets=!1,C.skinning=!0),A=new THREE.SkinnedMesh(j,C,(!1)),A.name="skin_"+Ie.length,Ie.push(A)):void 0!==s?(c(j,s),C.morphTargets=!0,A=new THREE.Mesh(j,C),A.name="morph_"+Se.length,Se.push(A)):A=j.isLineStrip===!0?new THREE.Line(j):new THREE.Mesh(j,C),n.add(A)}}for(r=0;r<e.cameras.length;r++){var M=e.cameras[r],O=Ue[M.url],S=new THREE.PerspectiveCamera(O.yfov,parseFloat(O.aspect_ratio),parseFloat(O.znear),parseFloat(O.zfar));n.add(S)}for(r=0;r<e.lights.length;r++){var q=null,V=e.lights[r],X=Pe[V.url];if(X&&X.technique){var L=X.color.getHex(),Y=X.intensity,Z=X.distance,z=X.falloff_angle;switch(X.technique){case"directional":q=new THREE.DirectionalLight(L,Y,Z),q.position.set(0,0,1);break;case"point":q=new THREE.PointLight(L,Y,Z);break;case"spot":q=new THREE.SpotLight(L,Y,Z,z),q.position.set(0,0,1);break;case"ambient":q=new THREE.AmbientLight(L)}}q&&n.add(q)}if(n.name=e.name||e.id||"",n.colladaId=e.id||"",n.layer=e.layer||"",n.matrix=e.matrix,n.matrix.decompose(n.position,n.quaternion,n.scale),Je.centerGeometry&&n.geometry){var F=n.geometry.center();F.multiply(n.scale),F.applyQuaternion(n.quaternion),n.position.sub(F)}for(r=0;r<e.nodes.length;r++)n.add(v(e.nodes[r],e));return n}function y(e){for(var t=qe.querySelectorAll("library_nodes node"),i=0;i<t.length;i++){var s=t[i].attributes.getNamedItem("id");if(s&&s.value===e)return t[i]}}function b(e){var t=[],i=1e6,s=-1e6;for(var r in Ze)for(var a=Ze[r],n=0;n<a.channel.length;n++){var o=a.channel[n],h=a.sampler[n],r=o.target.split("/")[0];r==e.id&&(h.create(),o.sampler=h,i=Math.min(i,h.startTime),s=Math.max(s,h.endTime),t.push(o))}return t.length&&(e.startTime=i,e.endTime=s),t}function w(e){if(e.channels&&e.channels.length){for(var t=[],i=[],s=0,r=e.channels.length;s<r;s++){var a,n=e.channels[s],o=n.fullSid,h=n.sampler,l=h.input,c=e.getTransformBySid(n.sid);if(n.arrIndices){a=[];for(var d=0,p=n.arrIndices.length;d<p;d++)a[d]=Ee(n.arrIndices[d])}else a=Re(n.member);if(c){i.indexOf(o)===-1&&i.push(o);for(var d=0,p=l.length;d<p;d++){var u=l[d],f=h.getData(c.type,d,a),m=x(t,u);if(!m){m=new ie(u);var g=N(t,u);t.splice(g===-1?t.length:g,0,m)}m.addTarget(o,c,a,f)}}else console.log('Could not find transform "'+n.sid+'" in node '+e.id)}for(var s=0;s<i.length;s++)for(var v=i[s],d=0;d<t.length;d++){var m=t[d];m.hasTarget(v)||k(t,m,d,v)}e.keys=t,e.sids=i}}function x(e,t){for(var i=null,s=0,r=e.length;s<r&&null===i;s++){var a=e[s];if(a.time===t)i=a;else if(a.time>t)break}return i}function N(e,t){for(var i=-1,s=0,r=e.length;s<r&&i===-1;s++){var a=e[s];a.time>=t&&(i=s)}return i}function k(e,t,i,s){var r=E(e,s,i?i-1:0),a=T(e,s,i+1);if(r&&a){var n,o=(t.time-r.time)/(a.time-r.time),h=r.getTarget(s),l=a.getTarget(s).data,c=h.data;if("matrix"===h.type)n=c;else if(c.length){n=[];for(var d=0;d<c.length;++d)n[d]=c[d]+(l[d]-c[d])*o}else n=c+(l-c)*o;t.addTarget(s,h.transform,h.member,n)}}function T(e,t,i){for(;i<e.length;i++){var s=e[i];if(s.hasTarget(t))return s}return null}function E(e,t,i){for(i=i>=0?i:i+e.length;i>=0;i--){var s=e[i];if(s.hasTarget(t))return s}return null}function R(){this.id="",this.init_from=""}function _(){this.id="",this.name="",this.type="",this.skin=null,this.morph=null}function A(){this.method=null,this.source=null,this.targets=null,this.weights=null}function C(){this.source="",this.bindShapeMatrix=null,this.invBindMatrices=[],this.joints=[],this.weights=[]}function j(){this.id="",this.name="",this.nodes=[],this.scene=new THREE.Group}function H(){this.id="",this.name="",this.sid="",this.nodes=[],this.controllers=[],this.transforms=[],this.geometries=[],this.channels=[],this.matrix=new THREE.Matrix4}function M(){this.sid="",this.type="",this.data=[],this.obj=null}function O(){this.url="",this.skeleton=[],this.instance_material=[]}function S(){this.symbol="",this.target=""}function I(){this.url="",this.instance_material=[]}function q(){this.id="",this.mesh=null}function V(e){this.geometry=e.id,this.primitives=[],this.vertices=null,this.geometry3js=null}function X(){this.material="",this.count=0,this.inputs=[],this.vcount=null,this.p=[],this.geometry=new THREE.Geometry}function L(){X.call(this),this.vcount=[]}function Y(){X.call(this),this.vcount=1}function Z(){X.call(this),this.vcount=3}function z(){this.source="",this.count=0,this.stride=0,this.params=[]}function F(){this.input={}}function B(){this.semantic="",this.offset=0,this.source="",this.set=0}function D(e){this.id=e,this.type=null}function U(){this.id="",this.name="",this.instance_effect=null}function P(){this.color=new THREE.Color,this.color.setRGB(Math.random(),Math.random(),Math.random()),this.color.a=1,this.texture=null,this.texcoord=null,this.texOpts=null}function G(e,t){this.type=e,this.effect=t,this.material=null}function J(e){this.effect=e,this.init_from=null,this.format=null}function W(e){this.effect=e,this.source=null,this.wrap_s=null,this.wrap_t=null,this.minfilter=null,this.magfilter=null,this.mipfilter=null}function Q(){this.id="",this.name="",this.shader=null,this.surface={},this.sampler={}}function $(){this.url=""}function K(){this.id="",this.name="",this.source={},this.sampler=[],this.channel=[]}function ee(e){this.animation=e,this.source="",this.target="",this.fullSid=null,this.sid=null,this.dotSyntax=null,this.arrSyntax=null,this.arrIndices=null,this.member=null}function te(e){this.id="",this.animation=e,this.inputs=[],this.input=null,this.output=null,this.strideOut=null,this.interpolation=null,this.startTime=null,this.endTime=null,this.duration=0}function ie(e){this.targets=[],this.time=e}function se(){this.id="",this.name="",this.technique=""}function re(){this.url=""}function ae(){this.id="",this.name="",this.technique=""}function ne(){this.url=""}function oe(){this.id="",this.name="",this.joints=[],this.links=[]}function he(){this.sid="",this.name="",this.axis=new THREE.Vector3,this.limits={min:0,max:0},this.type="",this.static=!1,this.zeroPosition=0,this.middlePosition=0}function le(){this.sid="",this.name="",this.transforms=[],this.attachments=[]}function ce(){this.joint="",this.transforms=[],this.links=[]}function de(e){var t=e.getAttribute("id");return void 0!=Le[t]?Le[t]:(Le[t]=new D(t).parse(e),Le[t])}function pe(e){for(var t=me(e),i=[],s=0,r=t.length;s<r;s++)i.push("true"===t[s]||"1"===t[s]);return i}function ue(e){for(var t=me(e),i=[],s=0,r=t.length;s<r;s++)i.push(parseFloat(t[s]));return i}function fe(e){for(var t=me(e),i=[],s=0,r=t.length;s<r;s++)i.push(parseInt(t[s],10));return i}function me(e){return e.length>0?ge(e).split(/\s+/):[]}function ge(e){return e.replace(/^\s+/,"").replace(/\s+$/,"")}function ve(e,t,i){return e.hasAttribute(t)?parseInt(e.getAttribute(t),10):i}function ye(e,t){var i=new THREE.ImageLoader;i.load(t,function(t){e.image=t,e.needsUpdate=!0})}function be(e,t){e.doubleSided=!1;var i=t.querySelectorAll("extra double_sided")[0];i&&i&&1===parseInt(i.textContent,10)&&(e.doubleSided=!0)}function we(){if(Je.convertUpAxis!==!0||Qe===Je.upAxis)$e=null;else switch(Qe){case"X":$e="Y"===Je.upAxis?"XtoY":"XtoZ";break;case"Y":$e="X"===Je.upAxis?"YtoX":"YtoZ";break;case"Z":$e="X"===Je.upAxis?"ZtoX":"ZtoY"}}function xe(e,t){if(Je.convertUpAxis===!0&&Qe!==Je.upAxis)switch($e){case"XtoY":var i=e[0];e[0]=t*e[1],e[1]=i;break;case"XtoZ":var i=e[2];e[2]=e[1],e[1]=e[0],e[0]=i;break;case"YtoX":var i=e[0];e[0]=e[1],e[1]=t*i;break;case"YtoZ":var i=e[1];e[1]=t*e[2],e[2]=i;break;case"ZtoX":var i=e[0];e[0]=e[1],e[1]=e[2],e[2]=i;break;case"ZtoY":var i=e[1];e[1]=e[2],e[2]=t*i}}function Ne(e,t){if(Je.convertUpAxis!==!0||Qe===Je.upAxis)return t;switch(e){case"X":t="XtoY"===$e?t*-1:t;break;case"Y":t="YtoZ"===$e||"YtoX"===$e?t*-1:t;break;case"Z":t="ZtoY"===$e?t*-1:t}return t}function ke(e,t){var i=[e[t],e[t+1],e[t+2]];return xe(i,-1),new THREE.Vector3(i[0],i[1],i[2])}function Te(e){if(Je.convertUpAxis){var t=[e[0],e[4],e[8]];xe(t,-1),e[0]=t[0],e[4]=t[1],e[8]=t[2],t=[e[1],e[5],e[9]],xe(t,-1),e[1]=t[0],e[5]=t[1],e[9]=t[2],t=[e[2],e[6],e[10]],xe(t,-1),e[2]=t[0],e[6]=t[1],e[10]=t[2],t=[e[0],e[1],e[2]],xe(t,-1),e[0]=t[0],e[1]=t[1],e[2]=t[2],t=[e[4],e[5],e[6]],xe(t,-1),e[4]=t[0],e[5]=t[1],e[6]=t[2],t=[e[8],e[9],e[10]],xe(t,-1),e[8]=t[0],e[9]=t[1],e[10]=t[2],t=[e[3],e[7],e[11]],xe(t,-1),e[3]=t[0],e[7]=t[1],e[11]=t[2]}return(new THREE.Matrix4).set(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}function Ee(e){if(e>-1&&e<3){var t=["X","Y","Z"],i={X:0,Y:1,Z:2};e=Re(t[e]),e=i[e]}return e}function Re(e){if(Je.convertUpAxis)switch(e){case"X":switch($e){case"XtoY":case"XtoZ":case"YtoX":e="Y";break;case"ZtoX":e="Z"}break;case"Y":switch($e){case"XtoY":case"YtoX":case"ZtoX":e="X";break;case"XtoZ":case"YtoZ":case"ZtoY":e="Z"}break;case"Z":switch($e){case"XtoZ":e="X";break;case"YtoZ":case"ZtoX":case"ZtoY":e="Y"}}return e}var _e,Ae,Ce,je,He,Me,Oe,Se,Ie,qe=null,Ve=null,Xe=null,Le={},Ye={},Ze={},ze={},Fe={},Be={},De={},Ue={},Pe={},Ge=THREE.SmoothShading,Je={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y",defaultEnvMap:null},We=1,Qe="Y",$e=null;return R.prototype.parse=function(e){this.id=e.getAttribute("id");for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];"init_from"===i.nodeName&&(this.init_from=i.textContent)}return this},_.prototype.parse=function(e){this.id=e.getAttribute("id"),this.name=e.getAttribute("name"),this.type="none";for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];switch(i.nodeName){case"skin":this.skin=(new C).parse(i),this.type=i.nodeName;break;case"morph":this.morph=(new A).parse(i),this.type=i.nodeName}}return this},A.prototype.parse=function(e){var t,i={},s=[];for(this.method=e.getAttribute("method"),this.source=e.getAttribute("source").replace(/^#/,""),t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];if(1==r.nodeType)switch(r.nodeName){case"source":var a=(new D).parse(r);i[a.id]=a;break;case"targets":s=this.parseInputs(r);break;default:console.log(r.nodeName)}}for(t=0;t<s.length;t++){var n=s[t],a=i[n.source];switch(n.semantic){case"MORPH_TARGET":this.targets=a.read();break;case"MORPH_WEIGHT":this.weights=a.read()}}return this},A.prototype.parseInputs=function(e){for(var t=[],i=0;i<e.childNodes.length;i++){var s=e.childNodes[i];if(1==s.nodeType)switch(s.nodeName){case"input":t.push((new B).parse(s))}}return t},C.prototype.parse=function(e){var t,i,s={};this.source=e.getAttribute("source").replace(/^#/,""),this.invBindMatrices=[],this.joints=[],this.weights=[];for(var r=0;r<e.childNodes.length;r++){var a=e.childNodes[r];if(1==a.nodeType)switch(a.nodeName){case"bind_shape_matrix":var n=ue(a.textContent);this.bindShapeMatrix=Te(n);break;case"source":var o=(new D).parse(a);s[o.id]=o;break;case"joints":t=a;break;case"vertex_weights":i=a;break;default:console.log(a.nodeName)}}return this.parseJoints(t,s),this.parseWeights(i,s),this},C.prototype.parseJoints=function(e,t){for(var i=0;i<e.childNodes.length;i++){var s=e.childNodes[i];if(1==s.nodeType)switch(s.nodeName){case"input":var r=(new B).parse(s),a=t[r.source];"JOINT"===r.semantic?this.joints=a.read():"INV_BIND_MATRIX"===r.semantic&&(this.invBindMatrices=a.read())}}},C.prototype.parseWeights=function(e,t){for(var i,s,r=[],a=0;a<e.childNodes.length;a++){var n=e.childNodes[a];if(1==n.nodeType)switch(n.nodeName){case"input":r.push((new B).parse(n));break;case"v":i=fe(n.textContent);break;case"vcount":s=fe(n.textContent)}}for(var o=0,a=0;a<s.length;a++){for(var h=s[a],l=[],c=0;c<h;c++){for(var d={},p=0;p<r.length;p++){var u=r[p],f=i[o+u.offset];switch(u.semantic){case"JOINT":d.joint=f;break;case"WEIGHT":d.weight=t[u.source].data[f]}}l.push(d),o+=r.length}for(var c=0;c<l.length;c++)l[c].index=a;this.weights.push(l)}},j.prototype.getChildById=function(e,t){for(var i=0;i<this.nodes.length;i++){var s=this.nodes[i].getChildById(e,t);if(s)return s}return null},j.prototype.getChildBySid=function(e,t){for(var i=0;i<this.nodes.length;i++){var s=this.nodes[i].getChildBySid(e,t);if(s)return s}return null},j.prototype.parse=function(e){this.id=e.getAttribute("id"),this.name=e.getAttribute("name"),this.nodes=[];for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"node":this.nodes.push((new H).parse(i))}}return this},H.prototype.getChannelForTransform=function(e){for(var t=0;t<this.channels.length;t++){var i,s,r=this.channels[t],a=r.target.split("/"),n=(a.shift(),a.shift()),o=n.indexOf(".")>=0,h=n.indexOf("(")>=0;if(o)a=n.split("."),n=a.shift(),s=a.shift();else if(h){i=n.split("("),n=i.shift();for(var l=0;l<i.length;l++)i[l]=parseInt(i[l].replace(/\)/,""))}if(n===e)return r.info={sid:n,dotSyntax:o,arrSyntax:h,arrIndices:i},r}return null},H.prototype.getChildById=function(e,t){if(this.id===e)return this;if(t)for(var i=0;i<this.nodes.length;i++){var s=this.nodes[i].getChildById(e,t);if(s)return s}return null},H.prototype.getChildBySid=function(e,t){if(this.sid===e)return this;if(t)for(var i=0;i<this.nodes.length;i++){var s=this.nodes[i].getChildBySid(e,t);if(s)return s}return null},H.prototype.getTransformBySid=function(e){for(var t=0;t<this.transforms.length;t++)if(this.transforms[t].sid===e)return this.transforms[t];return null},H.prototype.parse=function(e){var t;this.id=e.getAttribute("id"),this.sid=e.getAttribute("sid"),this.name=e.getAttribute("name"),this.type=e.getAttribute("type"),this.layer=e.getAttribute("layer"),this.type="JOINT"===this.type?this.type:"NODE",this.nodes=[],this.transforms=[],this.geometries=[],this.cameras=[],this.lights=[],this.controllers=[],this.matrix=new THREE.Matrix4;for(var i=0;i<e.childNodes.length;i++){var s=e.childNodes[i];if(1==s.nodeType)switch(s.nodeName){case"node":this.nodes.push((new H).parse(s));break;case"instance_camera":this.cameras.push((new re).parse(s));break;case"instance_controller":this.controllers.push((new O).parse(s));break;case"instance_geometry":this.geometries.push((new I).parse(s));break;case"instance_light":this.lights.push((new ne).parse(s));break;case"instance_node":t=s.getAttribute("url").replace(/^#/,"");var r=y(t);r&&this.nodes.push((new H).parse(r));break;case"rotate":case"translate":case"scale":case"matrix":case"lookat":case"skew":this.transforms.push((new M).parse(s));break;case"extra":break;default:console.log(s.nodeName)}}return this.channels=b(this),w(this),this.updateMatrix(),this},H.prototype.updateMatrix=function(){this.matrix.identity();for(var e=0;e<this.transforms.length;e++)this.transforms[e].apply(this.matrix)},M.prototype.parse=function(e){return this.sid=e.getAttribute("sid"),this.type=e.nodeName,this.data=ue(e.textContent),this.convert(),this},M.prototype.convert=function(){switch(this.type){case"matrix":this.obj=Te(this.data);break;case"rotate":this.angle=THREE.Math.degToRad(this.data[3]);case"translate":xe(this.data,-1),this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case"scale":xe(this.data,1),this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}},M.prototype.apply=function(){var e=new THREE.Matrix4;return function(t){switch(this.type){case"matrix":t.multiply(this.obj);break;case"translate":t.multiply(e.makeTranslation(this.obj.x,this.obj.y,this.obj.z));break;case"rotate":t.multiply(e.makeRotationAxis(this.obj,this.angle));break;case"scale":t.scale(this.obj)}}}(),M.prototype.update=function(e,t){var i=["X","Y","Z","ANGLE"];switch(this.type){case"matrix":if(t)if(1===t.length)switch(t[0]){case 0:this.obj.n11=e[0],this.obj.n21=e[1],this.obj.n31=e[2],this.obj.n41=e[3];break;case 1:this.obj.n12=e[0],this.obj.n22=e[1],this.obj.n32=e[2],this.obj.n42=e[3];break;case 2:this.obj.n13=e[0],this.obj.n23=e[1],this.obj.n33=e[2],this.obj.n43=e[3];break;case 3:this.obj.n14=e[0],this.obj.n24=e[1],this.obj.n34=e[2],this.obj.n44=e[3]}else if(2===t.length){var s="n"+(t[0]+1)+(t[1]+1);this.obj[s]=e}else console.log("Incorrect addressing of matrix in transform.");else this.obj.copy(e);break;case"translate":case"scale":switch("[object Array]"===Object.prototype.toString.call(t)&&(t=i[t[0]]),t){case"X":this.obj.x=e;break;case"Y":this.obj.y=e;break;case"Z":this.obj.z=e;break;default:this.obj.x=e[0],this.obj.y=e[1],this.obj.z=e[2]}break;case"rotate":switch("[object Array]"===Object.prototype.toString.call(t)&&(t=i[t[0]]),t){case"X":this.obj.x=e;break;case"Y":this.obj.y=e;break;case"Z":this.obj.z=e;break;case"ANGLE":this.angle=THREE.Math.degToRad(e);break;default:this.obj.x=e[0],this.obj.y=e[1],this.obj.z=e[2],this.angle=THREE.Math.degToRad(e[3])}}},O.prototype.parse=function(e){this.url=e.getAttribute("url").replace(/^#/,""),this.skeleton=[],this.instance_material=[];for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1===i.nodeType)switch(i.nodeName){case"skeleton":this.skeleton.push(i.textContent.replace(/^#/,""));break;case"bind_material":for(var s=i.querySelectorAll("instance_material"),r=0;r<s.length;r++){var a=s[r];this.instance_material.push((new S).parse(a))}break;case"extra":}}return this},S.prototype.parse=function(e){return this.symbol=e.getAttribute("symbol"),this.target=e.getAttribute("target").replace(/^#/,""),this},I.prototype.parse=function(e){this.url=e.getAttribute("url").replace(/^#/,""),this.instance_material=[];for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType&&"bind_material"===i.nodeName){for(var s=i.querySelectorAll("instance_material"),r=0;r<s.length;r++){var a=s[r];this.instance_material.push((new S).parse(a))}break}}return this},q.prototype.parse=function(e){this.id=e.getAttribute("id"),be(this,e);for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];switch(i.nodeName){case"mesh":this.mesh=new V(this).parse(i);break;case"extra":}}return this},V.prototype.parse=function(e){this.primitives=[];for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];switch(i.nodeName){case"source":de(i);break;case"vertices":this.vertices=(new F).parse(i);break;case"linestrips":this.primitives.push((new Y).parse(i));break;case"triangles":this.primitives.push((new Z).parse(i));break;case"polygons":this.primitives.push((new X).parse(i));break;case"polylist":this.primitives.push((new L).parse(i))}}if(this.geometry3js=new THREE.Geometry,null===this.vertices)return this;for(var s=Le[this.vertices.input.POSITION.source].data,t=0;t<s.length;t+=3)this.geometry3js.vertices.push(ke(s,t).clone());for(var t=0;t<this.primitives.length;t++){var r=this.primitives[t];r.setVertices(this.vertices),this.handlePrimitive(r,this.geometry3js)}return this.geometry3js.calcNormals&&(this.geometry3js.computeVertexNormals(),delete this.geometry3js.calcNormals),this},V.prototype.handlePrimitive=function(e,t){if(e instanceof Y)return void(t.isLineStrip=!0);var i,s,r,a,n,o,h,l=e.p,c=e.inputs,d=0,p=3,u=0,f=[];for(i=0;i<c.length;i++){r=c[i];var m=r.offset+1;switch(u=u<m?m:u,r.semantic){case"TEXCOORD":f.push(r.set)}}for(var g=0;g<l.length;++g)for(var v=l[g],y=0;y<v.length;){var b=[],w=[],x=null,N=[];for(p=e.vcount?e.vcount.length?e.vcount[d++]:e.vcount:v.length/u,i=0;i<p;i++)for(s=0;s<c.length;s++)switch(r=c[s],o=Le[r.source],a=v[y+i*u+r.offset],h=o.accessor.params.length,n=a*h,r.semantic){case"VERTEX":b.push(a);break;case"NORMAL":w.push(ke(o.data,n));break;case"TEXCOORD":x=x||{},void 0===x[r.set]&&(x[r.set]=[]),x[r.set].push(new THREE.Vector2(o.data[n],o.data[n+1]));break;case"COLOR":N.push((new THREE.Color).setRGB(o.data[n],o.data[n+1],o.data[n+2]))}if(0===w.length)if(r=this.vertices.input.NORMAL){o=Le[r.source],h=o.accessor.params.length;for(var k=0,T=b.length;k<T;k++)w.push(ke(o.data,b[k]*h))}else t.calcNormals=!0;if(!x&&(x={},r=this.vertices.input.TEXCOORD)){f.push(r.set),o=Le[r.source],h=o.accessor.params.length;for(var k=0,T=b.length;k<T;k++)n=b[k]*h,void 0===x[r.set]&&(x[r.set]=[]),x[r.set].push(new THREE.Vector2(o.data[n],1-o.data[n+1]))}if(0===N.length&&(r=this.vertices.input.COLOR)){o=Le[r.source],h=o.accessor.params.length;for(var k=0,T=b.length;k<T;k++)n=b[k]*h,N.push((new THREE.Color).setRGB(o.data[n],o.data[n+1],o.data[n+2]))}var E,R,_=null,A=[];if(3===p)A.push(new THREE.Face3(b[0],b[1],b[2],w,N.length?N:new THREE.Color));else if(4===p)A.push(new THREE.Face3(b[0],b[1],b[3],w.length?[w[0].clone(),w[1].clone(),w[3].clone()]:[],N.length?[N[0],N[1],N[3]]:new THREE.Color)),A.push(new THREE.Face3(b[1],b[2],b[3],w.length?[w[1].clone(),w[2].clone(),w[3].clone()]:[],N.length?[N[1],N[2],N[3]]:new THREE.Color));else if(p>4&&Je.subdivideFaces){var C=N.length?N:new THREE.Color;for(s=1;s<p-1;)A.push(new THREE.Face3(b[0],b[s],b[s+1],w.length?[w[0].clone(),w[s++].clone(),w[s].clone()]:[],C))}if(A.length)for(var k=0,T=A.length;k<T;k++)for(_=A[k],_.daeMaterial=e.material,t.faces.push(_),s=0;s<f.length;s++)E=x[f[s]],R=p>4?[E[0],E[k+1],E[k+2]]:4===p?0===k?[E[0],E[1],E[3]]:[E[1].clone(),E[2],E[3].clone()]:[E[0],E[1],E[2]],void 0===t.faceVertexUvs[s]&&(t.faceVertexUvs[s]=[]),t.faceVertexUvs[s].push(R);else console.log("dropped face with vcount "+p+" for geometry with id: "+t.id);y+=u*p}},X.prototype.setVertices=function(e){for(var t=0;t<this.inputs.length;t++)this.inputs[t].source===e.id&&(this.inputs[t].source=e.input.POSITION.source)},X.prototype.parse=function(e){this.material=e.getAttribute("material"),this.count=ve(e,"count",0);for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];switch(i.nodeName){case"input":this.inputs.push((new B).parse(e.childNodes[t]));break;case"vcount":
this.vcount=fe(i.textContent);break;case"p":this.p.push(fe(i.textContent));break;case"ph":console.warn("polygon holes not yet supported!")}}return this},L.prototype=Object.create(X.prototype),L.prototype.constructor=L,Y.prototype=Object.create(X.prototype),Y.prototype.constructor=Y,Z.prototype=Object.create(X.prototype),Z.prototype.constructor=Z,z.prototype.parse=function(e){this.params=[],this.source=e.getAttribute("source"),this.count=ve(e,"count",0),this.stride=ve(e,"stride",0);for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if("param"===i.nodeName){var s={};s.name=i.getAttribute("name"),s.type=i.getAttribute("type"),this.params.push(s)}}return this},F.prototype.parse=function(e){this.id=e.getAttribute("id");for(var t=0;t<e.childNodes.length;t++)if("input"===e.childNodes[t].nodeName){var i=(new B).parse(e.childNodes[t]);this.input[i.semantic]=i}return this},B.prototype.parse=function(e){return this.semantic=e.getAttribute("semantic"),this.source=e.getAttribute("source").replace(/^#/,""),this.set=ve(e,"set",-1),this.offset=ve(e,"offset",0),"TEXCOORD"===this.semantic&&this.set<0&&(this.set=0),this},D.prototype.parse=function(e){this.id=e.getAttribute("id");for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];switch(i.nodeName){case"bool_array":this.data=pe(i.textContent),this.type=i.nodeName;break;case"float_array":this.data=ue(i.textContent),this.type=i.nodeName;break;case"int_array":this.data=fe(i.textContent),this.type=i.nodeName;break;case"IDREF_array":case"Name_array":this.data=me(i.textContent),this.type=i.nodeName;break;case"technique_common":for(var s=0;s<i.childNodes.length;s++)if("accessor"===i.childNodes[s].nodeName){this.accessor=(new z).parse(i.childNodes[s]);break}}}return this},D.prototype.read=function(){var e=[],t=this.accessor.params[0];switch(t.type){case"IDREF":case"Name":case"name":case"float":return this.data;case"float4x4":for(var i=0;i<this.data.length;i+=16){var s=this.data.slice(i,i+16),r=Te(s);e.push(r)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+t.type+".")}return e},U.prototype.parse=function(e){this.id=e.getAttribute("id"),this.name=e.getAttribute("name");for(var t=0;t<e.childNodes.length;t++)if("instance_effect"===e.childNodes[t].nodeName){this.instance_effect=(new $).parse(e.childNodes[t]);break}return this},P.prototype.isColor=function(){return null===this.texture},P.prototype.isTexture=function(){return null!=this.texture},P.prototype.parse=function(e){"transparent"===e.nodeName&&(this.opaque=e.getAttribute("opaque"));for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"color":var s=ue(i.textContent);this.color=new THREE.Color,this.color.setRGB(s[0],s[1],s[2]),this.color.a=s[3];break;case"texture":this.texture=i.getAttribute("texture"),this.texcoord=i.getAttribute("texcoord"),this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1},this.parseTexture(i)}}return this},P.prototype.parseTexture=function(e){if(!e.childNodes)return this;e.childNodes[1]&&"extra"===e.childNodes[1].nodeName&&(e=e.childNodes[1],e.childNodes[1]&&"technique"===e.childNodes[1].nodeName&&(e=e.childNodes[1]));for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];switch(i.nodeName){case"offsetU":case"offsetV":case"repeatU":case"repeatV":this.texOpts[i.nodeName]=parseFloat(i.textContent);break;case"wrapU":case"wrapV":"TRUE"===i.textContent.toUpperCase()?this.texOpts[i.nodeName]=1:this.texOpts[i.nodeName]=parseInt(i.textContent);break;default:this.texOpts[i.nodeName]=i.textContent}}return this},G.prototype.parse=function(e){for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"emission":case"diffuse":case"specular":case"transparent":this[i.nodeName]=(new P).parse(i);break;case"bump":var s=i.getAttribute("bumptype");s?"heightfield"===s.toLowerCase()?this.bump=(new P).parse(i):"normalmap"===s.toLowerCase()?this.normal=(new P).parse(i):(console.error("Shader.prototype.parse: Invalid value for attribute 'bumptype' ("+s+") - valid bumptypes are 'HEIGHTFIELD' and 'NORMALMAP' - defaulting to 'HEIGHTFIELD'"),this.bump=(new P).parse(i)):(console.warn("Shader.prototype.parse: Attribute 'bumptype' missing from bump node - defaulting to 'HEIGHTFIELD'"),this.bump=(new P).parse(i));break;case"shininess":case"reflectivity":case"index_of_refraction":case"transparency":var r=i.querySelectorAll("float");r.length>0&&(this[i.nodeName]=parseFloat(r[0].textContent))}}return this.create(),this},G.prototype.create=function(){var e={},t=!1;if(void 0!==this.transparency&&void 0!==this.transparent){var i=(this.transparent,(this.transparent.color.r+this.transparent.color.g+this.transparent.color.b)/3*this.transparency);i>0&&(t=!0,e.transparent=!0,e.opacity=1-i)}var s={diffuse:"map",ambient:"lightMap",specular:"specularMap",emission:"emissionMap",bump:"bumpMap",normal:"normalMap"};for(var r in this)switch(r){case"ambient":case"emission":case"diffuse":case"specular":case"bump":case"normal":var a=this[r];if(a instanceof P)if(a.isTexture()){var n=a.texture,o=this.effect.sampler[n];if(void 0!==o&&void 0!==o.source){var h=this.effect.surface[o.source];if(void 0!==h){var l=Ye[h.init_from];if(l){var c,d=Oe+l.init_from,p=THREE.Loader.Handlers.get(d);null!==p?c=p.load(d):(c=new THREE.Texture,ye(c,d)),c.wrapS=a.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,c.wrapT=a.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,c.offset.x=a.texOpts.offsetU,c.offset.y=a.texOpts.offsetV,c.repeat.x=a.texOpts.repeatU,c.repeat.y=a.texOpts.repeatV,e[s[r]]=c,"emission"===r&&(e.emissive=16777215)}}}}else"diffuse"!==r&&t||("emission"===r?e.emissive=a.color.getHex():e[r]=a.color.getHex());break;case"shininess":e[r]=this[r];break;case"reflectivity":e[r]=this[r],e[r]>0&&(e.envMap=Je.defaultEnvMap),e.combine=THREE.MixOperation;break;case"index_of_refraction":e.refractionRatio=this[r],1!==this[r]&&(e.envMap=Je.defaultEnvMap);break;case"transparency":}switch(e.shading=Ge,e.side=this.effect.doubleSided?THREE.DoubleSide:THREE.FrontSide,void 0!==e.diffuse&&(e.color=e.diffuse,delete e.diffuse),this.type){case"constant":void 0!=e.emissive&&(e.color=e.emissive),this.material=new THREE.MeshBasicMaterial(e);break;case"phong":case"blinn":this.material=new THREE.MeshPhongMaterial(e);break;case"lambert":default:this.material=new THREE.MeshLambertMaterial(e)}return this.material},J.prototype.parse=function(e){for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"init_from":this.init_from=i.textContent;break;case"format":this.format=i.textContent;break;default:console.log("unhandled Surface prop: "+i.nodeName)}}return this},W.prototype.parse=function(e){for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"source":this.source=i.textContent;break;case"minfilter":this.minfilter=i.textContent;break;case"magfilter":this.magfilter=i.textContent;break;case"mipfilter":this.mipfilter=i.textContent;break;case"wrap_s":this.wrap_s=i.textContent;break;case"wrap_t":this.wrap_t=i.textContent;break;default:console.log("unhandled Sampler2D prop: "+i.nodeName)}}return this},Q.prototype.create=function(){if(null===this.shader)return null},Q.prototype.parse=function(e){this.id=e.getAttribute("id"),this.name=e.getAttribute("name"),be(this,e),this.shader=null;for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(i))}}return this},Q.prototype.parseNewparam=function(e){for(var t=e.getAttribute("sid"),i=0;i<e.childNodes.length;i++){var s=e.childNodes[i];if(1==s.nodeType)switch(s.nodeName){case"surface":this.surface[t]=new J(this).parse(s);break;case"sampler2D":this.sampler[t]=new W(this).parse(s);break;case"extra":break;default:console.log(s.nodeName)}}},Q.prototype.parseProfileCOMMON=function(e){for(var t,i=0;i<e.childNodes.length;i++){var s=e.childNodes[i];if(1==s.nodeType)switch(s.nodeName){case"profile_COMMON":this.parseProfileCOMMON(s);break;case"technique":t=s;break;case"newparam":this.parseNewparam(s);break;case"image":var r=(new R).parse(s);Ye[r.id]=r;break;case"extra":break;default:console.log(s.nodeName)}}return t},Q.prototype.parseTechnique=function(e){for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"constant":case"lambert":case"blinn":case"phong":this.shader=new G(i.nodeName,this).parse(i);break;case"extra":this.parseExtra(i)}}},Q.prototype.parseExtra=function(e){for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"technique":this.parseExtraTechnique(i)}}},Q.prototype.parseExtraTechnique=function(e){for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"bump":this.shader.parse(e)}}},$.prototype.parse=function(e){return this.url=e.getAttribute("url").replace(/^#/,""),this},K.prototype.parse=function(e){this.id=e.getAttribute("id"),this.name=e.getAttribute("name"),this.source={};for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"animation":var s=(new K).parse(i);for(var r in s.source)this.source[r]=s.source[r];for(var a=0;a<s.channel.length;a++)this.channel.push(s.channel[a]),this.sampler.push(s.sampler[a]);break;case"source":var r=(new D).parse(i);this.source[r.id]=r;break;case"sampler":this.sampler.push(new te(this).parse(i));break;case"channel":this.channel.push(new ee(this).parse(i))}}return this},ee.prototype.parse=function(e){this.source=e.getAttribute("source").replace(/^#/,""),this.target=e.getAttribute("target");var t=this.target.split("/"),i=(t.shift(),t.shift()),s=i.indexOf(".")>=0,r=i.indexOf("(")>=0;if(s)t=i.split("."),this.sid=t.shift(),this.member=t.shift();else if(r){var a=i.split("(");this.sid=a.shift();for(var n=0;n<a.length;n++)a[n]=parseInt(a[n].replace(/\)/,""));this.arrIndices=a}else this.sid=i;return this.fullSid=i,this.dotSyntax=s,this.arrSyntax=r,this},te.prototype.parse=function(e){this.id=e.getAttribute("id"),this.inputs=[];for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"input":this.inputs.push((new B).parse(i))}}return this},te.prototype.create=function(){for(var e=0;e<this.inputs.length;e++){var t=this.inputs[e],i=this.animation.source[t.source];switch(t.semantic){case"INPUT":this.input=i.read();break;case"OUTPUT":this.output=i.read(),this.strideOut=i.accessor.stride;break;case"INTERPOLATION":this.interpolation=i.read();break;case"IN_TANGENT":break;case"OUT_TANGENT":break;default:console.log(t.semantic)}}if(this.startTime=0,this.endTime=0,this.duration=0,this.input.length){this.startTime=1e8,this.endTime=-1e8;for(var e=0;e<this.input.length;e++)this.startTime=Math.min(this.startTime,this.input[e]),this.endTime=Math.max(this.endTime,this.input[e]);this.duration=this.endTime-this.startTime}},te.prototype.getData=function(e,t,i){var s;if("matrix"===e&&16===this.strideOut)s=this.output[t];else if(this.strideOut>1){s=[],t*=this.strideOut;for(var r=0;r<this.strideOut;++r)s[r]=this.output[t+r];if(3===this.strideOut)switch(e){case"rotate":case"translate":xe(s,-1);break;case"scale":xe(s,1)}else 4===this.strideOut&&"matrix"===e&&xe(s,-1)}else s=this.output[t],i&&"translate"===e&&(s=Ne(i,s));return s},ie.prototype.addTarget=function(e,t,i,s){this.targets.push({sid:e,member:i,transform:t,data:s})},ie.prototype.apply=function(e){for(var t=0;t<this.targets.length;++t){var i=this.targets[t];e&&i.sid!==e||i.transform.update(i.data,i.member)}},ie.prototype.getTarget=function(e){for(var t=0;t<this.targets.length;++t)if(this.targets[t].sid===e)return this.targets[t];return null},ie.prototype.hasTarget=function(e){for(var t=0;t<this.targets.length;++t)if(this.targets[t].sid===e)return!0;return!1},ie.prototype.interpolate=function(e,t){for(var i=0,s=this.targets.length;i<s;i++){var r,a=this.targets[i],n=e.getTarget(a.sid);if("matrix"!==a.transform.type&&n){var o=(t-this.time)/(e.time-this.time),h=n.data,l=a.data;if(o<0&&(o=0),o>1&&(o=1),l.length){r=[];for(var c=0;c<l.length;++c)r[c]=l[c]+(h[c]-l[c])*o}else r=l+(h-l)*o}else r=a.data;a.transform.update(r,a.member)}},se.prototype.parse=function(e){this.id=e.getAttribute("id"),this.name=e.getAttribute("name");for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"optics":this.parseOptics(i)}}return this},se.prototype.parseOptics=function(e){for(var t=0;t<e.childNodes.length;t++)if("technique_common"===e.childNodes[t].nodeName)for(var i=e.childNodes[t],s=0;s<i.childNodes.length;s++)if(this.technique=i.childNodes[s].nodeName,"perspective"===this.technique)for(var r=i.childNodes[s],a=0;a<r.childNodes.length;a++){var n=r.childNodes[a];switch(n.nodeName){case"yfov":this.yfov=n.textContent;break;case"xfov":this.xfov=n.textContent;break;case"znear":this.znear=n.textContent;break;case"zfar":this.zfar=n.textContent;break;case"aspect_ratio":this.aspect_ratio=n.textContent}}else if("orthographic"===this.technique)for(var o=i.childNodes[s],a=0;a<o.childNodes.length;a++){var n=o.childNodes[a];switch(n.nodeName){case"xmag":this.xmag=n.textContent;break;case"ymag":this.ymag=n.textContent;break;case"znear":this.znear=n.textContent;break;case"zfar":this.zfar=n.textContent;break;case"aspect_ratio":this.aspect_ratio=n.textContent}}return this},re.prototype.parse=function(e){return this.url=e.getAttribute("url").replace(/^#/,""),this},ae.prototype.parse=function(e){this.id=e.getAttribute("id"),this.name=e.getAttribute("name");for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"technique_common":this.parseCommon(i);break;case"technique":this.parseTechnique(i)}}return this},ae.prototype.parseCommon=function(e){for(var t=0;t<e.childNodes.length;t++)switch(e.childNodes[t].nodeName){case"directional":case"point":case"spot":case"ambient":this.technique=e.childNodes[t].nodeName;for(var i=e.childNodes[t],s=0;s<i.childNodes.length;s++){var r=i.childNodes[s];switch(r.nodeName){case"color":var a=ue(r.textContent);this.color=new THREE.Color(0),this.color.setRGB(a[0],a[1],a[2]),this.color.a=a[3];break;case"falloff_angle":this.falloff_angle=parseFloat(r.textContent);break;case"quadratic_attenuation":var n=parseFloat(r.textContent);this.distance=n?Math.sqrt(1/n):0}}}return this},ae.prototype.parseTechnique=function(e){this.profile=e.getAttribute("profile");for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];switch(i.nodeName){case"intensity":this.intensity=parseFloat(i.textContent)}}return this},ne.prototype.parse=function(e){return this.url=e.getAttribute("url").replace(/^#/,""),this},oe.prototype.parse=function(e){this.id=e.getAttribute("id"),this.name=e.getAttribute("name"),this.joints=[],this.links=[];for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"technique_common":this.parseCommon(i)}}return this},oe.prototype.parseCommon=function(e){for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(e.childNodes[t].nodeName){case"joint":this.joints.push((new he).parse(i));break;case"link":this.links.push((new le).parse(i))}}return this},he.prototype.parse=function(e){this.sid=e.getAttribute("sid"),this.name=e.getAttribute("name"),this.axis=new THREE.Vector3,this.limits={min:0,max:0},this.type="",this.static=!1,this.zeroPosition=0,this.middlePosition=0;var t=e.querySelector("axis"),i=ue(t.textContent);this.axis=ke(i,0);var s=e.querySelector("limits min")?parseFloat(e.querySelector("limits min").textContent):-360,r=e.querySelector("limits max")?parseFloat(e.querySelector("limits max").textContent):360;this.limits={min:s,max:r};for(var a=["prismatic","revolute"],n=0;n<a.length;n++){var o=a[n],h=e.querySelector(o);h&&(this.type=o)}return this.limits.min>=this.limits.max&&(this.static=!0),this.middlePosition=(this.limits.min+this.limits.max)/2,this},le.prototype.parse=function(e){this.sid=e.getAttribute("sid"),this.name=e.getAttribute("name"),this.transforms=[],this.attachments=[];for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"attachment_full":this.attachments.push((new ce).parse(i));break;case"rotate":case"translate":case"matrix":this.transforms.push((new M).parse(i))}}return this},ce.prototype.parse=function(e){this.joint=e.getAttribute("joint").split("/").pop(),this.links=[];for(var t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"link":this.links.push((new le).parse(i));break;case"rotate":case"translate":case"matrix":this.transforms.push((new M).parse(i))}}return this},{load:e,parse:t,setPreferredShading:i,applySkin:m,geometries:Fe,options:Je}};
},{}],15:[function(_dereq_,module,exports){
THREE.MTLLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager},THREE.MTLLoader.prototype={constructor:THREE.MTLLoader,load:function(a,t,r,s){var i=this,e=new THREE.XHRLoader(this.manager);e.setPath(this.path),e.load(a,function(a){t(i.parse(a))},r,s)},setPath:function(a){this.path=a},setBaseUrl:function(a){this.baseUrl=a},setCrossOrigin:function(a){this.crossOrigin=a},setMaterialOptions:function(a){this.materialOptions=a},parse:function(a){for(var t=a.split("\n"),r={},s=/\s+/,i={},e=0;e<t.length;e++){var o=t[e];if(o=o.trim(),0!==o.length&&"#"!==o.charAt(0)){var n=o.indexOf(" "),h=n>=0?o.substring(0,n):o;h=h.toLowerCase();var p=n>=0?o.substring(n+1):"";if(p=p.trim(),"newmtl"===h)r={name:p},i[p]=r;else if(r)if("ka"===h||"kd"===h||"ks"===h){var l=p.split(s,3);r[h]=[parseFloat(l[0]),parseFloat(l[1]),parseFloat(l[2])]}else r[h]=p}}var c=new THREE.MTLLoader.MaterialCreator(this.baseUrl,this.materialOptions);return c.setCrossOrigin(this.crossOrigin),c.setManager(this.manager),c.setMaterials(i),c}},THREE.MTLLoader.MaterialCreator=function(a,t){this.baseUrl=a,this.options=t,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.side=this.options&&this.options.side?this.options.side:THREE.FrontSide,this.wrap=this.options&&this.options.wrap?this.options.wrap:THREE.RepeatWrapping},THREE.MTLLoader.MaterialCreator.prototype={constructor:THREE.MTLLoader.MaterialCreator,setCrossOrigin:function(a){this.crossOrigin=a},setManager:function(a){this.manager=a},setMaterials:function(a){this.materialsInfo=this.convert(a),this.materials={},this.materialsArray=[],this.nameLookup={}},convert:function(a){if(!this.options)return a;var t={};for(var r in a){var s=a[r],i={};t[r]=i;for(var e in s){var o=!0,n=s[e],h=e.toLowerCase();switch(h){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(n=[n[0]/255,n[1]/255,n[2]/255]),this.options&&this.options.ignoreZeroRGBs&&0===n[0]&&0===n[1]&&0===n[1]&&(o=!1)}o&&(i[h]=n)}}return t},preload:function(){for(var a in this.materialsInfo)this.create(a)},getIndex:function(a){return this.nameLookup[a]},getAsArray:function(){var a=0;for(var t in this.materialsInfo)this.materialsArray[a]=this.create(t),this.nameLookup[t]=a,a++;return this.materialsArray},create:function(a){return void 0===this.materials[a]&&this.createMaterial_(a),this.materials[a]},createMaterial_:function(a){var t=this.materialsInfo[a],r={name:a,side:this.side};for(var s in t){var i=t[s];if(""!==i)switch(s.toLowerCase()){case"kd":r.color=(new THREE.Color).fromArray(i);break;case"ks":r.specular=(new THREE.Color).fromArray(i);break;case"map_kd":r.map=this.loadTexture(this.baseUrl+i),r.map.wrapS=this.wrap,r.map.wrapT=this.wrap;break;case"ns":r.shininess=parseFloat(i);break;case"d":i<1&&(r.opacity=i,r.transparent=!0);break;case"Tr":i>0&&(r.opacity=1-i,r.transparent=!0);break;case"map_bump":case"bump":if(r.bumpMap)break;r.bumpMap=this.loadTexture(this.baseUrl+i),r.bumpMap.wrapS=this.wrap,r.bumpMap.wrapT=this.wrap}}return this.materials[a]=new THREE.MeshPhongMaterial(r),this.materials[a]},loadTexture:function(a,t,r,s,i){var e,o=THREE.Loader.Handlers.get(a),n=void 0!==this.manager?this.manager:THREE.DefaultLoadingManager;return null===o&&(o=new THREE.TextureLoader(n)),o.setCrossOrigin&&o.setCrossOrigin(this.crossOrigin),e=o.load(a,r,s,i),void 0!==t&&(e.mapping=t),e}},THREE.EventDispatcher.prototype.apply(THREE.MTLLoader.prototype);
},{}],16:[function(_dereq_,module,exports){
THREE.OBJLoader=function(e){this.manager=void 0!==e?e:THREE.DefaultLoadingManager,this.materials=null,this.regexp={vertex_pattern:/^v\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)/,normal_pattern:/^vn\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)/,uv_pattern:/^vt\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)/,face_vertex:/^f\s+(-?\d+)\s+(-?\d+)\s+(-?\d+)(?:\s+(-?\d+))?/,face_vertex_uv:/^f\s+(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)(?:\s+(-?\d+)\/(-?\d+))?/,face_vertex_uv_normal:/^f\s+(-?\d+)\/(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\/(-?\d+)(?:\s+(-?\d+)\/(-?\d+)\/(-?\d+))?/,face_vertex_normal:/^f\s+(-?\d+)\/\/(-?\d+)\s+(-?\d+)\/\/(-?\d+)\s+(-?\d+)\/\/(-?\d+)(?:\s+(-?\d+)\/\/(-?\d+))?/,object_pattern:/^[og]\s*(.+)?/,smoothing_pattern:/^s\s+(\d+|on|off)/,material_library_pattern:/^mtllib /,material_use_pattern:/^usemtl /}},THREE.OBJLoader.prototype={constructor:THREE.OBJLoader,load:function(e,t,r,a){var s=this,i=new THREE.XHRLoader(s.manager);i.setPath(this.path),i.load(e,function(e){t(s.parse(e))},r,a)},setPath:function(e){this.path=e},setMaterials:function(e){this.materials=e},_createParserState:function(){var e={objects:[],object:{},vertices:[],normals:[],uvs:[],materialLibraries:[],startObject:function(e,t){return this.object&&this.object.fromDeclaration===!1?(this.object.name=e,void(this.object.fromDeclaration=t!==!1)):(this.object={name:e||"",geometry:{vertices:[],normals:[],uvs:[]},material:{name:"",smooth:!0},fromDeclaration:t!==!1},void this.objects.push(this.object))},parseVertexIndex:function(e,t){var r=parseInt(e,10);return 3*(r>=0?r-1:r+t/3)},parseNormalIndex:function(e,t){var r=parseInt(e,10);return 3*(r>=0?r-1:r+t/3)},parseUVIndex:function(e,t){var r=parseInt(e,10);return 2*(r>=0?r-1:r+t/2)},addVertex:function(e,t,r){var a=this.vertices,s=this.object.geometry.vertices;s.push(a[e+0]),s.push(a[e+1]),s.push(a[e+2]),s.push(a[t+0]),s.push(a[t+1]),s.push(a[t+2]),s.push(a[r+0]),s.push(a[r+1]),s.push(a[r+2])},addVertexLine:function(e){var t=this.vertices,r=this.object.geometry.vertices;r.push(t[e+0]),r.push(t[e+1]),r.push(t[e+2])},addNormal:function(e,t,r){var a=this.normals,s=this.object.geometry.normals;s.push(a[e+0]),s.push(a[e+1]),s.push(a[e+2]),s.push(a[t+0]),s.push(a[t+1]),s.push(a[t+2]),s.push(a[r+0]),s.push(a[r+1]),s.push(a[r+2])},addUV:function(e,t,r){var a=this.uvs,s=this.object.geometry.uvs;s.push(a[e+0]),s.push(a[e+1]),s.push(a[t+0]),s.push(a[t+1]),s.push(a[r+0]),s.push(a[r+1])},addUVLine:function(e){var t=this.uvs,r=this.object.geometry.uvs;r.push(t[e+0]),r.push(t[e+1])},addFace:function(e,t,r,a,s,i,n,o,d,h,l,u){var p,c=this.vertices.length,m=this.parseVertexIndex(e,c),v=this.parseVertexIndex(t,c),f=this.parseVertexIndex(r,c);if(void 0===a?this.addVertex(m,v,f):(p=this.parseVertexIndex(a,c),this.addVertex(m,v,p),this.addVertex(v,f,p)),void 0!==s){var x=this.uvs.length;m=this.parseUVIndex(s,x),v=this.parseUVIndex(i,x),f=this.parseUVIndex(n,x),void 0===a?this.addUV(m,v,f):(p=this.parseUVIndex(o,x),this.addUV(m,v,p),this.addUV(v,f,p))}if(void 0!==d){var g=this.normals.length;m=this.parseNormalIndex(d,g),v=d===h?m:this.parseNormalIndex(h,g),f=d===l?m:this.parseNormalIndex(l,g),void 0===a?this.addNormal(m,v,f):(p=this.parseNormalIndex(u,g),this.addNormal(m,v,p),this.addNormal(v,f,p))}},addLineGeometry:function(e,t){this.object.geometry.type="Line";for(var r=this.vertices.length,a=this.uvs.length,s=0,i=e.length;s<i;s++)this.addVertexLine(this.parseVertexIndex(e[s],r));for(var n=0,i=t.length;n<i;n++)this.addUVLine(this.parseUVIndex(t[n],a))}};return e.startObject("",!1),e},parse:function(e){console.time("OBJLoader");var t=this._createParserState();e.indexOf("\r\n")!==-1&&(e=e.replace("\r\n","\n"));for(var r=e.split("\n"),a="",s="",i="",n=0,o=[],d="function"==typeof"".trimLeft,h=0,l=r.length;h<l;h++)if(a=r[h],a=d?a.trimLeft():a.trim(),n=a.length,0!==n&&(s=a.charAt(0),"#"!==s))if("v"===s)if(i=a.charAt(1)," "===i&&null!==(o=this.regexp.vertex_pattern.exec(a)))t.vertices.push(parseFloat(o[1]),parseFloat(o[2]),parseFloat(o[3]));else if("n"===i&&null!==(o=this.regexp.normal_pattern.exec(a)))t.normals.push(parseFloat(o[1]),parseFloat(o[2]),parseFloat(o[3]));else{if("t"!==i||null===(o=this.regexp.uv_pattern.exec(a)))throw new Error("Unexpected vertex/normal/uv line: '"+a+"'");t.uvs.push(parseFloat(o[1]),parseFloat(o[2]))}else if("f"===s)if(null!==(o=this.regexp.face_vertex_uv_normal.exec(a)))t.addFace(o[1],o[4],o[7],o[10],o[2],o[5],o[8],o[11],o[3],o[6],o[9],o[12]);else if(null!==(o=this.regexp.face_vertex_uv.exec(a)))t.addFace(o[1],o[3],o[5],o[7],o[2],o[4],o[6],o[8]);else if(null!==(o=this.regexp.face_vertex_normal.exec(a)))t.addFace(o[1],o[3],o[5],o[7],void 0,void 0,void 0,void 0,o[2],o[4],o[6],o[8]);else{if(null===(o=this.regexp.face_vertex.exec(a)))throw new Error("Unexpected face line: '"+a+"'");t.addFace(o[1],o[2],o[3],o[4])}else if("l"===s){var u=a.substring(1).trim().split(" "),p=[],c=[];if(a.indexOf("/")===-1)p=u;else for(var m=0,v=u.length;m<v;m++){var f=u[m].split("/");""!==f[0]&&p.push(f[0]),""!==f[1]&&c.push(f[1])}t.addLineGeometry(p,c)}else if(null!==(o=this.regexp.object_pattern.exec(a))){var x=o[0].substr(1).trim();t.startObject(x)}else if(this.regexp.material_use_pattern.test(a))t.object.material.name=a.substring(7).trim();else if(this.regexp.material_library_pattern.test(a))t.materialLibraries.push(a.substring(7).trim());else{if(null===(o=this.regexp.smoothing_pattern.exec(a))){if("\0"===a)continue;throw new Error("Unexpected line: '"+a+"'")}var g=o[1].trim().toLowerCase();t.object.material.smooth="1"===g||"on"===g}var E=new THREE.Group;E.materialLibraries=[].concat(t.materialLibraries);for(var h=0,l=t.objects.length;h<l;h++){var b=t.objects[h],_=b.geometry,L="Line"===_.type;if(0!==_.vertices.length){var V=new THREE.BufferGeometry;V.addAttribute("position",new THREE.BufferAttribute(new Float32Array(_.vertices),3)),_.normals.length>0?V.addAttribute("normal",new THREE.BufferAttribute(new Float32Array(_.normals),3)):V.computeVertexNormals(),_.uvs.length>0&&V.addAttribute("uv",new THREE.BufferAttribute(new Float32Array(_.uvs),2));var j;if(null!==this.materials&&(j=this.materials.create(b.material.name),L&&j&&!(j instanceof THREE.LineBasicMaterial))){var w=new THREE.LineBasicMaterial;w.copy(j),j=w}j||(j=L?new THREE.LineBasicMaterial:new THREE.MeshPhongMaterial,j.name=b.material.name),j.shading=b.material.smooth?THREE.SmoothShading:THREE.FlatShading;var y=L?new THREE.Line(V,j):new THREE.Mesh(V,j);y.name=b.name,E.add(y)}}return console.timeEnd("OBJLoader"),E}};
},{}],17:[function(_dereq_,module,exports){
var self=self||{},THREE={REVISION:"76"};"function"==typeof define&&define.amd?define("three",THREE):"undefined"!=typeof exports&&"undefined"!=typeof module&&(module.exports=THREE),void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t}),void 0===Function.prototype.name&&void 0!==Object.defineProperty&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}}),void 0===Object.assign&&Object.defineProperty(Object,"assign",{writable:!0,configurable:!0,value:function(t){"use strict";if(void 0===t||null===t)throw new TypeError("Cannot convert first argument to object");for(var e=Object(t),r=1,i=arguments.length;r!==i;++r){var n=arguments[r];if(void 0!==n&&null!==n){n=Object(n);for(var a=Object.keys(n),o=0,s=a.length;o!==s;++o){var c=a[o],h=Object.getOwnPropertyDescriptor(n,c);void 0!==h&&h.enumerable&&(e[c]=n[c])}}}return e}}),THREE.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},THREE.CullFaceNone=0,THREE.CullFaceBack=1,THREE.CullFaceFront=2,THREE.CullFaceFrontBack=3,THREE.FrontFaceDirectionCW=0,THREE.FrontFaceDirectionCCW=1,THREE.BasicShadowMap=0,THREE.PCFShadowMap=1,THREE.PCFSoftShadowMap=2,THREE.FrontSide=0,THREE.BackSide=1,THREE.DoubleSide=2,THREE.FlatShading=1,THREE.SmoothShading=2,THREE.NoColors=0,THREE.FaceColors=1,THREE.VertexColors=2,THREE.NoBlending=0,THREE.NormalBlending=1,THREE.AdditiveBlending=2,THREE.SubtractiveBlending=3,THREE.MultiplyBlending=4,THREE.CustomBlending=5,THREE.AddEquation=100,THREE.SubtractEquation=101,THREE.ReverseSubtractEquation=102,THREE.MinEquation=103,THREE.MaxEquation=104,THREE.ZeroFactor=200,THREE.OneFactor=201,THREE.SrcColorFactor=202,THREE.OneMinusSrcColorFactor=203,THREE.SrcAlphaFactor=204,THREE.OneMinusSrcAlphaFactor=205,THREE.DstAlphaFactor=206,THREE.OneMinusDstAlphaFactor=207,THREE.DstColorFactor=208,THREE.OneMinusDstColorFactor=209,THREE.SrcAlphaSaturateFactor=210,THREE.NeverDepth=0,THREE.AlwaysDepth=1,THREE.LessDepth=2,THREE.LessEqualDepth=3,THREE.EqualDepth=4,THREE.GreaterEqualDepth=5,THREE.GreaterDepth=6,THREE.NotEqualDepth=7,THREE.MultiplyOperation=0,THREE.MixOperation=1,THREE.AddOperation=2,THREE.NoToneMapping=0,THREE.LinearToneMapping=1,THREE.ReinhardToneMapping=2,THREE.Uncharted2ToneMapping=3,THREE.CineonToneMapping=4,THREE.UVMapping=300,THREE.CubeReflectionMapping=301,THREE.CubeRefractionMapping=302,THREE.EquirectangularReflectionMapping=303,THREE.EquirectangularRefractionMapping=304,THREE.SphericalReflectionMapping=305,THREE.CubeUVReflectionMapping=306,THREE.CubeUVRefractionMapping=307,THREE.RepeatWrapping=1e3,THREE.ClampToEdgeWrapping=1001,THREE.MirroredRepeatWrapping=1002,THREE.NearestFilter=1003,THREE.NearestMipMapNearestFilter=1004,THREE.NearestMipMapLinearFilter=1005,THREE.LinearFilter=1006,THREE.LinearMipMapNearestFilter=1007,THREE.LinearMipMapLinearFilter=1008,THREE.UnsignedByteType=1009,THREE.ByteType=1010,THREE.ShortType=1011,THREE.UnsignedShortType=1012,THREE.IntType=1013,THREE.UnsignedIntType=1014,THREE.FloatType=1015,THREE.HalfFloatType=1025,THREE.UnsignedShort4444Type=1016,THREE.UnsignedShort5551Type=1017,THREE.UnsignedShort565Type=1018,THREE.AlphaFormat=1019,THREE.RGBFormat=1020,THREE.RGBAFormat=1021,THREE.LuminanceFormat=1022,THREE.LuminanceAlphaFormat=1023,THREE.RGBEFormat=THREE.RGBAFormat,THREE.DepthFormat=1026,THREE.RGB_S3TC_DXT1_Format=2001,THREE.RGBA_S3TC_DXT1_Format=2002,THREE.RGBA_S3TC_DXT3_Format=2003,THREE.RGBA_S3TC_DXT5_Format=2004,THREE.RGB_PVRTC_4BPPV1_Format=2100,THREE.RGB_PVRTC_2BPPV1_Format=2101,THREE.RGBA_PVRTC_4BPPV1_Format=2102,THREE.RGBA_PVRTC_2BPPV1_Format=2103,THREE.RGB_ETC1_Format=2151,THREE.LoopOnce=2200,THREE.LoopRepeat=2201,THREE.LoopPingPong=2202,THREE.InterpolateDiscrete=2300,THREE.InterpolateLinear=2301,THREE.InterpolateSmooth=2302,THREE.ZeroCurvatureEnding=2400,THREE.ZeroSlopeEnding=2401,THREE.WrapAroundEnding=2402,THREE.TrianglesDrawMode=0,THREE.TriangleStripDrawMode=1,THREE.TriangleFanDrawMode=2,THREE.LinearEncoding=3e3,THREE.sRGBEncoding=3001,THREE.GammaEncoding=3007,THREE.RGBEEncoding=3002,THREE.LogLuvEncoding=3003,THREE.RGBM7Encoding=3004,THREE.RGBM16Encoding=3005,THREE.RGBDEncoding=3006,THREE.BasicDepthPacking=3200,THREE.RGBADepthPacking=3201,THREE.Color=function(t){return 3===arguments.length?this.fromArray(arguments):this.set(t)},THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,set:function(t){return t instanceof THREE.Color?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){this.r=t,this.g=t,this.b=t},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,r){return this.r=t,this.g=e,this.b=r,this},setHSL:function(){function t(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+6*(e-t)*(2/3-r):t}return function(e,r,i){if(e=THREE.Math.euclideanModulo(e,1),r=THREE.Math.clamp(r,0,1),i=THREE.Math.clamp(i,0,1),0===r)this.r=this.g=this.b=i;else{var n=i<=.5?i*(1+r):i+r-i*r,a=2*i-n;this.r=t(a,n,e+1/3),this.g=t(a,n,e),this.b=t(a,n,e-1/3)}return this}}(),setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var r;if(r=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var i,n=r[1],a=r[2];switch(n){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,e(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(