!function e(t,r,n){function i(a,s){if(!r[a]){if(!t[a]){var c="function"==typeof require&&require;if(!s&&c)return c(a,!0);if(o)return o(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var u=r[a]={exports:{}};t[a][0].call(u.exports,function(e){var r=t[a][1][e];return i(r||e)},u,u.exports,e,t,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;a0&&r.has(l[0].ID))i=r.get(l[0].ID);else if(void 0!==c&&"/"!==c[0]&&null===c.match(/^[a-zA-Z]:/))i=c;else{var u=s.split(/[\\\/]/);i=u.length>0?u[u.length-1]:s}var f=t.path;0!==i.indexOf("blob:")&&0!==i.indexOf("data:")||t.setPath(void 0);var p=t.load(i);p.name=a,p.FBX_ID=o;var h=e.properties.WrapModeU,d=e.properties.WrapModeV,m=void 0!==h?h.value:0,v=void 0!==d?d.value:0;return p.wrapS=0===m?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,p.wrapT=0===v?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,t.setPath(f),p}(o[a],t,r,n);i.set(parseInt(a),s)}}return i}function n(e,t,r){var n=new Map;if("Material"in e.Objects.subNodes){var i=e.Objects.subNodes.Material;for(var o in i){var a=function(e,t,r){var n=e.id,i=e.attrName,o=e.properties.ShadingModel;"object"==typeof o&&(o=o.value);if(!r.has(n))return null;var a,s=r.get(n).children,c=function(e,t,r){var n={};e.Diffuse&&(n.color=_(e.Diffuse));e.Specular&&(n.specular=_(e.Specular));e.Shininess&&(n.shininess=e.Shininess.value);e.Emissive&&(n.emissive=_(e.Emissive));e.EmissiveFactor&&(n.emissiveIntensity=e.EmissiveFactor.value);e.Opacity&&(n.opacity=e.Opacity.value);n.opacity<1&&(n.transparent=!0);for(var i=0,o=r.length;i4){x||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),x=!0);var S=[0,0,0,0],k=[0,0,0,0];F.forEach(function(e,t){var r=e,n=H[t];k.forEach(function(e,t,i){if(r>e){i[t]=r,r=e;var o=S[t];S[t]=n,n=o}})}),H=S,F=k}for(V=F.length;V<4;++V)F[V]=0,H[V]=0;L.skinWeights.fromArray(F),L.skinIndices.fromArray(H)}if(s&&L.normal.fromArray(a(N,_,A,s)),c&&L.uv.fromArray(a(N,_,A,c)),l&&L.color.fromArray(a(N,_,A,l)),R.push(L),B){var O=new d;if(O.genTrianglesFromVertices(R),void 0!==u){var j=a(N,_,A,u);O.materialIndex=j[0]}else O.materialIndex=0;r.faces.push(O),R=[],_++,B=!1}}var M=r.flattenToBuffers(),P=new THREE.BufferGeometry;P.name=e.name,P.addAttribute("position",new THREE.Float32BufferAttribute(M.vertexBuffer,3)),M.normalBuffer.length>0&&P.addAttribute("normal",new THREE.Float32BufferAttribute(M.normalBuffer,3));M.uvBuffer.length>0&&P.addAttribute("uv",new THREE.Float32BufferAttribute(M.uvBuffer,2));n.LayerElementColor&&P.addAttribute("color",new THREE.Float32BufferAttribute(M.colorBuffer,3));t&&(P.addAttribute("skinIndex",new THREE.Float32BufferAttribute(M.skinIndexBuffer,4)),P.addAttribute("skinWeight",new THREE.Float32BufferAttribute(M.skinWeightBuffer,4)),P.FBX_Deformer=t);for(var U=M.materialIndexBuffer,X=U[0],z=0,V=0;V1?_=N:N.length>0?_=N[0]:(_=new THREE.MeshStandardMaterial({color:3342591}),N.push(_)),"color"in b.attributes)for(var F=0,C=N.length;F-1){s[Y].add(v);break}}null===v.parent&&o.add(v)}o.updateMatrixWorld(!0);var G=e.Objects.subNodes.Pose;for(var p in G)if("BindPose"===G[p].attrType){G=G[p];break}if(G)for(var Z=G.subNodes.PoseNode,$=new Map,q=0,K=Z.length;q=0;--c){var l=B(n.skeleton.bones,function(e){return e.FBX_ID===s[c].ID});if(l>-1){o.containerBoneID=l,o.containerID=s[c].ID;var u=i[o.containerID.toString()];"PreRotation"in u.properties&&(o.preRotations=R(u.properties.PreRotation).multiplyScalar(Math.PI/180));break}}return o}(e,n[u],t,r);l.push(f)}for(var p=new Map,h=0;hF.min&&(s.stacks[u]={name:a[u].attrName,layers:H,length:F.max-F.min,frames:30*(F.max-F.min)})}return s}(e,t,o)),o}function c(e,t){e.x&&l(e.x,t),e.y&&l(e.y,t),e.z&&l(e.z,t)}function l(e,t){t.max=e.times[e.times.length-1]>t.max?e.times[e.times.length-1]:t.max,t.min=e.times[0]=t.length&&t===N(e,0,t.length)}(t))c=(new g).parse(t);else{var l=N(t);if(!function(e){function t(t){var r=e[t-1];return e=e.slice(n+t),n++,r}for(var r=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],n=0,i=0;i1&&(r=e[1].replace(/^(\w+)::/,""),n=e[2]),{id:t,name:r,type:n}},parseNodeProperty:function(e,t,r){var n=this.getCurrentNode(),i=n.name;if(void 0!==i){if(i.match(/Properties(\d)+/))return void this.parseNodeSpecialProperty(e,t,r)}if("C"===t){var o=r.split(",").slice(1),a=parseInt(o[0]),s=parseInt(o[1]),c=r.split(",").slice(3);t="connections",L(r=[a,s],c),void 0===n.properties[t]&&(n.properties[t]=[])}if("Node"===t){var l=parseInt(r);n.properties.id=l,n.id=l}t in n.properties?Array.isArray(n.properties[t])?n.properties[t].push(r):n.properties[t]+=r:Array.isArray(n.properties[t])?n.properties[t].push(r):n.properties[t]=r,this.setCurrentProp(n.properties,t)},parseNodePropertyContinued:function(e){this.currentProp[this.currentPropName]+=e},parseNodeSpecialProperty:function(e,t,r){for(var n=r.split('",'),i=0,o=n.length;i=e.size():e.getOffset()+160+16>=e.size()},parseNode:function(e,t){var r=t>=7500?e.getUint64():e.getUint32(),n=t>=7500?e.getUint64():e.getUint32(),i=(t>=7500?e.getUint64():e.getUint32(),e.getUint8()),o=e.getString(i);if(0===r)return null;for(var a=[],s=0;s0?a[0]:"",l=a.length>1?a[1]:"",u=a.length>2?a[2]:"",f={},p={},h=!1;for(1===n&&e.getOffset()===r&&(h=!0);r>e.getOffset();){var d=this.parseNode(e,t);if(null!==d)if(!0!==d.singleProperty)if("Connections"!==o||"C"!==d.name)if(d.name.match(/^Properties\d+$/))for(var m=Object.keys(d.properties),s=0,v=m.length;s0;){var r=this.getUint8();if(e--,0===r)break;t+=String.fromCharCode(r)}return this.skip(e),t}}),Object.assign(E.prototype,{add:function(e,t){this[e]=t},searchConnectionParent:function(e){if(void 0===this.__cache_search_connection_parent&&(this.__cache_search_connection_parent=[]),void 0!==this.__cache_search_connection_parent[e])return this.__cache_search_connection_parent[e];this.__cache_search_connection_parent[e]=[];for(var t=this.Connections.properties.connections,r=[],n=0;n0?(L(this.__cache_search_connection_parent[e],r),r):(this.__cache_search_connection_parent[e]=[-1],[-1])},searchConnectionChildren:function(e){if(void 0===this.__cache_search_connection_children&&(this.__cache_search_connection_children=[]),void 0!==this.__cache_search_connection_children[e])return this.__cache_search_connection_children[e];this.__cache_search_connection_children[e]=[];for(var t=this.Connections.properties.connections,r=[],n=0;n0?(L(this.__cache_search_connection_children[e],r),r):(this.__cache_search_connection_children[e]=[],[])},searchConnectionType:function(e,t){var r=e+","+t;if(void 0===this.__cache_search_connection_type&&(this.__cache_search_connection_type={}),void 0!==this.__cache_search_connection_type[r])return this.__cache_search_connection_type[r];this.__cache_search_connection_type[r]="";for(var n=this.Connections.properties.connections,i=0;i=n.elements[a].count&&(a++,s=0);var u=this.parseASCIIElement(n.elements[a].properties,l);this.handleElement(r,n.elements[a].name,u),s++}}return this.postProcess(r)},postProcess:function(e){if(e.useColor){for(var t=0;t