/** * Minified by jsDelivr using Terser v5.19.2. * Original file: /npm/three-mmd-loader@0.0.11/dist/mmd-loader.js * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ module.exports=function(e){var t={};function r(a){if(t[a])return t[a].exports;var i=t[a]={i:a,l:!1,exports:{}};return e[a].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.i=function(e){return e},r.d=function(e,t,a){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:a})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=22)}([function(e,t,r){"use strict";let a;Object.defineProperty(t,"__esModule",{value:!0}),a="undefined"!=typeof window&&window.THREE?window.THREE:r(16),t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(0);class i extends a.default.Interpolant{constructor(e,t,r,a,i){super(e,t,r,a),this.params=i}interpolate_(e,t,r,i){var o=this.resultBuffer,s=this.sampleValues,n=this.valueSize,l=e*n,u=l-n,h=(r-t)/(i-t);if(4===n){var d=this.params[4*e+0],f=this.params[4*e+1],c=this.params[4*e+2],p=this.params[4*e+3],m=this._calculate(d,f,c,p,h);a.default.Quaternion.slerpFlat(o,0,s,u,s,l,m)}else if(3===n)for(var g=0;g!==n;++g){d=this.params[12*e+4*g+0],f=this.params[12*e+4*g+1],c=this.params[12*e+4*g+2],p=this.params[12*e+4*g+3],m=this._calculate(d,f,c,p,h);o[g]=s[u+g]*(1-m)+s[l+g]*m}else{d=this.params[4*e+0],f=this.params[4*e+1],c=this.params[4*e+2],p=this.params[4*e+3],m=this._calculate(d,f,c,p,h);o[0]=s[u]*(1-m)+s[l]*m}return o}_calculate(e,t,r,a,i){for(var o,s,n,l=.5,u=l,h=1-u,d=Math,f=0;f<15;f++){var c=(o=3*h*h*u)*e+(s=3*h*u*u)*t+(n=u*u*u)-i;if(d.abs(c)<1e-5)break;l/=2,h=1-(u+=c<0?l:-l)}return o*r+s*a+n}}t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(0);t.default=class{constructor(e){var t;this.update=(t=new a.default.Quaternion,function(){for(var e=0;e=this.duration;)this.currentTime-=this.duration;return!(this.currentTime=this.duration}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(0),i=r(3),o=r(8),s=r(2);t.default=class{constructor(){this.meshes=[],this.doAnimation=!0,this.doIk=!0,this.doGrant=!0,this.doPhysics=!0,this.doCameraAnimation=!0,this.sharedPhysics=!1,this.masterPhysics=null,this.audioManager=null,this.camera=null}add(e){if(!(e instanceof a.default.SkinnedMesh))throw new Error("THREE.MMDHelper.add() accepts only THREE.SkinnedMesh instance.");void 0===e.mixer&&(e.mixer=null),void 0===e.ikSolver&&(e.ikSolver=null),void 0===e.grantSolver&&(e.grantSolver=null),void 0===e.physics&&(e.physics=null),void 0===e.looped&&(e.looped=!1),this.meshes.push(e),this.initBackupBones(e)}setAudio(e,t,r){this.audioManager=new MMDAudioManager(e,t,r)}setCamera(e){e.mixer=null,this.camera=e}setPhysicses(e){for(var t=0;t0)}}setAnimations(){for(var e=0;ethis.loadVmd(e)));return this.mergeVmds(yield Promise.all(t))}))}loadAudio(e,t){return a(this,void 0,void 0,(function*(){var r=new i.default.AudioListener,a=new i.default.Audio(r),o=new i.default.AudioLoader(this.manager);return new Promise(((i,s)=>{o.load(e,(e=>{a.setBuffer(e),i([a,r])}),t,(e=>s(e.error)))}))}))}loadVpd(e,t,r){return a(this,void 0,void 0,(function*(){const a=(t&&"unicode"===t.charcode?this.loadFileAsText:this.loadFileAsShiftJISText).bind(this);return new Promise(((t,i)=>{a(e,(e=>t(this.parseVpd(e))),r,(e=>i(e.error)))}))}))}parseModel(e,t){switch(t.toLowerCase()){case"pmd":return this.parsePmd(e);case"pmx":return this.parsePmx(e);default:throw"extension "+t+" is not supported."}}parsePmd(e){return this.parser.parsePmd(e,!0)}parsePmx(e){return this.parser.parsePmx(e,!0)}parseVmd(e){return this.parser.parseVmd(e,!0)}parseVpd(e){return this.parser.parseVpd(e,!0)}mergeVmds(e){return this.parser.mergeVmds(e)}pourVmdIntoModel(e,t,r){this.createAnimation(e,t,r)}pourVmdIntoCamera(e,t,r){var a=new n.default;!function(){for(var o,s,n=a.createOrderedMotionArray(t.cameras),l=[],u=[],h=[],f=[],c=[],p=[],m=[],g=[],A=[],v=new i.default.Quaternion,y=new i.default.Euler,x=new i.default.Vector3,M=new i.default.Vector3,b=function(e,t){e.push(t.x),e.push(t.y),e.push(t.z)},w=function(e,t,r){e.push(t[4*r+0]/127),e.push(t[4*r+1]/127),e.push(t[4*r+2]/127),e.push(t[4*r+3]/127)},B=function(e,t,r,a,i){if(r.length>2){r=r.slice(),a=a.slice(),i=i.slice();let e=a.length/r.length,t=3===e?12:4,s=1;for(let n=2,l=r.length;ns){r[s]=r[n];for(var o=0;o0&&k{const n=new i.default.FileLoader(this.manager);null!=r&&n.setMimeType(r),n.setResponseType(t),n.load(e,(e=>o(e)),a,(e=>s(e.error)))}))}loadFileAsBuffer(e,t){return a(this,void 0,void 0,(function*(){return this.loadFile(e,"arraybuffer",null,t)}))}loadFileAsText(e,t){return a(this,void 0,void 0,(function*(){return this.loadFile(e,"text",null,t)}))}loadFileAsShiftJISText(e,t){return a(this,void 0,void 0,(function*(){return this.loadFile(e,"text","text/plain; charset=shift_jis",t)}))}createMesh(e,t,r){var a=this,o=new i.default.BufferGeometry,l=new i.default.MultiMaterial,u=(new n.default,{vertices:[],uvs:[],normals:[],skinIndices:[],skinWeights:[],indices:[]});return function(){for(var t=0;t=a?r.skinIndices[a]:0);for(a=0;a<4;a++)u.skinWeights.push(r.skinWeights.length-1>=a?r.skinWeights[a]:0)}}(),function(){for(var t=0;t=0&&(l.limitation=new i.default.Vector3(1,0,0)),n.links.push(l)}t.push(n)}else for(r=0;r=0?h:u);var c=l.load(s,(function(e){if(!0===o.isToonTexture){var t=e.image,r=t.width,a=t.height;d.width=r,d.height=a,f.clearRect(0,0,r,a),f.translate(r/2,a/2),f.rotate(.5*Math.PI),f.translate(-r/2,-a/2),f.drawImage(t,0,0),e.image=f.getImageData(0,0,r,a)}e.flipY=!1,e.wrapS=i.default.RepeatWrapping,e.wrapT=i.default.RepeatWrapping,!0===o.sphericalReflectionMapping&&(e.mapping=i.default.SphericalReflectionMapping);for(var s=0;s{throw e.error}));return c.readyCallbacks=[],n[s]=c,s}function g(e,t){return void 0===t[e]&&console.warn("THREE.MMDLoader: Undefined texture",e),t[e]}null!==a.textureCrossOrigin&&u.setCrossOrigin(a.textureCrossOrigin);for(var A=0;A=0?(M.push(x.slice(0,b)),M.push(x.slice(b+1))):M.push(x);for(var w=0;w=0||B.indexOf(".spa")>=0?(y.envMap=m(B,{sphericalReflectionMapping:!0}),B.indexOf(".sph")>=0?y.envMapType=i.default.MultiplyOperation:y.envMapType=i.default.AddOperation):y.map=m(B)}}}else{if(-1!==v.textureIndex){var B=e.textures[v.textureIndex];y.map=m(B)}if(-1!==v.envTextureIndex&&(1===v.envFlag||2==v.envFlag)){B=e.textures[v.envTextureIndex];y.envMap=m(B,{sphericalReflectionMapping:!0}),1===v.envFlag?y.envMapType=i.default.MultiplyOperation:y.envMapType=i.default.AddOperation}}var T=void 0===y.map?1:.2;y.emissive=new i.default.Color(v.ambient[0]*T,v.ambient[1]*T,v.ambient[2]*T),p.push(y)}for(A=0;A0,v.morphTargets=o.morphTargets.length>0,v.lights=!0,v.side="pmx"===e.metadata.format&&1==(1&k.flag)?i.default.DoubleSide:C.side,v.transparent=C.transparent,v.fog=!0,v.blending=i.default.CustomBlending,v.blendSrc=i.default.SrcAlphaFactor,v.blendDst=i.default.OneMinusSrcAlphaFactor,v.blendSrcAlpha=i.default.SrcAlphaFactor,v.blendDstAlpha=i.default.DstAlphaFactor,void 0!==C.map){function R(e){e.map.readyCallbacks.push((function(t){function r(e,t){var r=e.width,a=e.height,i=Math.round(t.x*r)%r,o=Math.round(t.y*a)%a;i<0&&(i+=r),o<0&&(o+=a);var s=o*r+i;return e.data[4*s+3]}var a=void 0!==t.image.data?t.image:function(e){var t=document.createElement("canvas");t.width=e.width,t.height=e.height;var r=t.getContext("2d");return r.drawImage(e,0,0),r.getImageData(0,0,t.width,t.height)}(t.image),i=o.index.array.slice(3*e.faceOffset,3*e.faceOffset+3*e.faceNum);(function(e,t,a){var i=e.width,o=e.height;if(e.data.length/(i*o)!=4)return!1;for(var s=0;s65535?i.default.Uint32BufferAttribute:i.default.Uint16BufferAttribute)(u.indices,1)),o.addAttribute("position",new i.default.Float32BufferAttribute(u.vertices,3)),o.addAttribute("normal",new i.default.Float32BufferAttribute(u.normals,3)),o.addAttribute("uv",new i.default.Float32BufferAttribute(u.uvs,2)),o.addAttribute("skinIndex",new i.default.Float32BufferAttribute(u.skinIndices,4)),o.addAttribute("skinWeight",new i.default.Float32BufferAttribute(u.skinWeights,4)),o.computeBoundingSphere(),o.mmdFormat=e.metadata.format,new i.default.SkinnedMesh(o,l)}createAnimation(e,t,r){var a=new n.default;!function(){if(0!==t.metadata.motionCount){for(var o=e.geometry.bones,s=a.createOrderedMotionArrays(o,t.motions,"boneName"),n=[],h=function(e,t,r){e.push(t[r+0]/127),e.push(t[r+8]/127),e.push(t[r+4]/127),e.push(t[r+12]/127)},d=0;d0?this.threeVector3s.pop():new a.default.Vector3}freeThreeVector3(e){this.threeVector3s.push(e)}allocThreeMatrix4(){return this.threeMatrix4s.length>0?this.threeMatrix4s.pop():new a.default.Matrix4}freeThreeMatrix4(e){this.threeMatrix4s.push(e)}allocThreeQuaternion(){return this.threeQuaternions.length>0?this.threeQuaternions.pop():new a.default.Quaternion}freeThreeQuaternion(e){this.threeQuaternions.push(e)}allocThreeEuler(){return this.threeEulers.length>0?this.threeEulers.pop():new a.default.Euler}freeThreeEuler(e){this.threeEulers.push(e)}allocTransform(){return this.transforms.length>0?this.transforms.pop():new i.btTransform}freeTransform(e){this.transforms.push(e)}allocQuaternion(){return this.quaternions.length>0?this.quaternions.pop():new i.btQuaternion}freeQuaternion(e){this.quaternions.push(e)}allocVector3(){return this.vector3s.length>0?this.vector3s.pop():new i.btVector3}freeVector3(e){this.vector3s.push(e)}setIdentity(e){e.setIdentity()}getBasis(e){var t=this.allocQuaternion();return e.getBasis().getRotation(t),t}getBasisAsMatrix3(e){var t=this.getBasis(e),r=this.quaternionToMatrix3(t);return this.freeQuaternion(t),r}getOrigin(e){return e.getOrigin()}setOrigin(e,t){e.getOrigin().setValue(t.x(),t.y(),t.z())}copyOrigin(e,t){var r=t.getOrigin();this.setOrigin(e,r)}setBasis(e,t){e.setRotation(t)}setBasisFromMatrix3(e,t){var r=this.matrix3ToQuaternion(t);this.setBasis(e,r),this.freeQuaternion(r)}setOriginFromArray3(e,t){e.getOrigin().setValue(t[0],t[1],t[2])}setBasisFromArray3(e,t){var r=this.allocThreeQuaternion(),a=this.allocThreeEuler();a.set(t[0],t[1],t[2]),this.setBasisFromArray4(e,r.setFromEuler(a).toArray()),this.freeThreeEuler(a),this.freeThreeQuaternion(r)}setBasisFromArray4(e,t){var r=this.array4ToQuaternion(t);this.setBasis(e,r),this.freeQuaternion(r)}array4ToQuaternion(e){var t=this.allocQuaternion();return t.setX(e[0]),t.setY(e[1]),t.setZ(e[2]),t.setW(e[3]),t}multiplyTransforms(e,t){var r=this.allocTransform();this.setIdentity(r);var a=this.getBasisAsMatrix3(e),i=this.getBasisAsMatrix3(t),o=this.getOrigin(e),s=this.getOrigin(t),n=this.multiplyMatrix3ByVector3(a,s),l=this.addVector3(n,o);this.setOrigin(r,l);var u=this.multiplyMatrices3(a,i);return this.setBasisFromMatrix3(r,u),this.freeVector3(n),this.freeVector3(l),r}inverseTransform(e){var t=this.allocTransform(),r=this.getBasisAsMatrix3(e),a=this.getOrigin(e),i=this.transposeMatrix3(r),o=this.negativeVector3(a),s=this.multiplyMatrix3ByVector3(i,o);return this.setOrigin(t,s),this.setBasisFromMatrix3(t,i),this.freeVector3(o),this.freeVector3(s),t}multiplyMatrices3(e,t){var r=[],a=this.rowOfMatrix3(e,0),i=this.rowOfMatrix3(e,1),o=this.rowOfMatrix3(e,2),s=this.columnOfMatrix3(t,0),n=this.columnOfMatrix3(t,1),l=this.columnOfMatrix3(t,2);return r[0]=this.dotVectors3(a,s),r[1]=this.dotVectors3(a,n),r[2]=this.dotVectors3(a,l),r[3]=this.dotVectors3(i,s),r[4]=this.dotVectors3(i,n),r[5]=this.dotVectors3(i,l),r[6]=this.dotVectors3(o,s),r[7]=this.dotVectors3(o,n),r[8]=this.dotVectors3(o,l),this.freeVector3(a),this.freeVector3(i),this.freeVector3(o),this.freeVector3(s),this.freeVector3(n),this.freeVector3(l),r}addVector3(e,t){var r=this.allocVector3();return r.setValue(e.x()+t.x(),e.y()+t.y(),e.z()+t.z()),r}dotVectors3(e,t){return e.x()*t.x()+e.y()*t.y()+e.z()*t.z()}rowOfMatrix3(e,t){var r=this.allocVector3();return r.setValue(e[3*t+0],e[3*t+1],e[3*t+2]),r}columnOfMatrix3(e,t){var r=this.allocVector3();return r.setValue(e[t+0],e[t+3],e[t+6]),r}negativeVector3(e){var t=this.allocVector3();return t.setValue(-e.x(),-e.y(),-e.z()),t}multiplyMatrix3ByVector3(e,t){var r=this.allocVector3(),a=this.rowOfMatrix3(e,0),i=this.rowOfMatrix3(e,1),o=this.rowOfMatrix3(e,2),s=this.dotVectors3(a,t),n=this.dotVectors3(i,t),l=this.dotVectors3(o,t);return r.setValue(s,n,l),this.freeVector3(a),this.freeVector3(i),this.freeVector3(o),r}transposeMatrix3(e){var t=[];return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t}quaternionToMatrix3(e){var t=[],r=e.x(),a=e.y(),i=e.z(),o=e.w(),s=r*r,n=a*a,l=i*i,u=r*a,h=a*i,d=i*r,f=r*o,c=a*o,p=i*o;return t[0]=1-2*(n+l),t[1]=2*(u-p),t[2]=2*(d+c),t[3]=2*(u+p),t[4]=1-2*(l+s),t[5]=2*(h-f),t[6]=2*(d-c),t[7]=2*(h+f),t[8]=1-2*(s+n),t}matrix3ToQuaternion(e){var t,r,a,i,o,s=e[0]+e[4]+e[8];s>0?(o=.25*(t=2*Math.sqrt(s+1)),r=(e[7]-e[5])/t,a=(e[2]-e[6])/t,i=(e[3]-e[1])/t):e[0]>e[4]&&e[0]>e[8]?(t=2*Math.sqrt(1+e[0]-e[4]-e[8]),o=(e[7]-e[5])/t,r=.25*t,a=(e[1]+e[3])/t,i=(e[2]+e[6])/t):e[4]>e[8]?(t=2*Math.sqrt(1+e[4]-e[0]-e[8]),o=(e[2]-e[6])/t,r=(e[1]+e[3])/t,a=.25*t,i=(e[5]+e[7])/t):(t=2*Math.sqrt(1+e[8]-e[0]-e[4]),o=(e[3]-e[1])/t,r=(e[2]+e[6])/t,a=(e[5]+e[7])/t,i=.25*t);var n=this.allocQuaternion();return n.setX(r),n.setY(a),n.setZ(i),n.setW(o),n}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(4);t.default=class{constructor(e,t,r,a){this.mesh=e,this.world=t,this.params=r,this.helper=a,this.body=null,this.bone=null,this.boneOffsetForm=null,this.boneOffsetFormInverse=null,this.init()}init(){var e=this.helper,t=this.params,r=this.mesh.skeleton.bones,i=-1===t.boneIndex?new THREE.Bone:r[t.boneIndex],o=function(e){switch(e.shapeType){case 0:return new a.btSphereShape(e.width);case 1:return new a.btBoxShape(new a.btVector3(e.width,e.height,e.depth));case 2:return new a.btCapsuleShape(e.width,e.height);default:throw"unknown shape type "+e.shapeType}}(t),s=0===t.type?0:t.weight,n=e.allocVector3();n.setValue(0,0,0),0!==s&&o.calculateLocalInertia(s,n);var l=e.allocTransform();e.setIdentity(l),e.setOriginFromArray3(l,t.position),e.setBasisFromArray3(l,t.rotation);var u=e.allocTransform();e.setIdentity(u),e.setOriginFromArray3(u,i.getWorldPosition().toArray());var h=e.multiplyTransforms(u,l),d=new a.btDefaultMotionState(h),f=new a.btRigidBodyConstructionInfo(s,d,o,n);f.set_m_friction(t.friction),f.set_m_restitution(t.restitution);var c=new a.btRigidBody(f);0===t.type&&(c.setCollisionFlags(2|c.getCollisionFlags()),c.setActivationState(4)),c.setDamping(t.positionDamping,t.rotationDamping),c.setSleepingThresholds(0,0),this.world.addRigidBody(c,1<1?k=1:k<-1&&(k=-1),!((k=c.acos(k))<1e-5)){if(void 0!==g.minAngle&&kg.maxAngle&&(k=g.maxAngle),h.crossVectors(s,i),h.normalize(),t.setFromAxisAngle(h,k),T.quaternion.multiply(t),void 0!==C){var I=T.quaternion.w;I>1&&(I=1);var V=c.sqrt(1-I*I);T.quaternion.set(C.x*V,C.y*V,C.z*V,I)}T.updateMatrixWorld(!0),b=!0}}if(!b)break}}this.mesh.updateMatrixWorld(!0)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(4),i=r(15);t.RigidBody=i.default;const o=r(13);t.Constraint=o.default;const s=r(14);t.ResourceHelper=s.default;t.default=class{constructor(e,t={}){this.mesh=e,this.helper=new s.default,this.unitStep=void 0!==t.unitStep?t.unitStep:1/65,this.maxStepNum=void 0!==t.maxStepNum?t.maxStepNum:3,this.world=void 0!==t.world?t.world:null,this.bodies=[],this.constraints=[],this.init(e)}init(e){const t=e.parent;null!==t&&t.remove(e);const r=e.position.clone(),a=e.rotation.clone(),i=e.scale.clone();e.position.set(0,0,0),e.rotation.set(0,0,0),e.scale.set(1,1,1),e.updateMatrixWorld(!0),null===this.world&&this.initWorld(),this.initRigidBodies(),this.initConstraints(),null!==t&&t.add(e),e.position.copy(r),e.rotation.copy(a),e.scale.copy(i),e.updateMatrixWorld(!0),this.reset()}initWorld(){var e=new a.btDefaultCollisionConfiguration,t=new a.btCollisionDispatcher(e),r=new a.btDbvtBroadphase,i=new a.btSequentialImpulseConstraintSolver,o=new a.btDiscreteDynamicsWorld(t,r,i,e);o.setGravity(new a.btVector3(0,-98,0)),this.world=o}initRigidBodies(){for(var e=this.mesh.geometry.rigidBodies,t=0;tthis.maxStepNum&&(a=this.maxStepNum),this.world.stepSimulation(r,a,t)}updateRigidBodies(){for(var e=0;e{o.image=this.parse(e),o.needsUpdate=!0,void 0!==t&&t(o)}),r,i),o}parse(e){var t=0,r=1,a=2,i=3,o=9,s=10,n=11,l=48,u=4,h=0,d=1,f=2,c=3;e.length<19&&console.error("TGALoader: Not enough data to contain header.");var p=new Uint8Array(e),m=0,g={id_length:p[m++],colormap_type:p[m++],image_type:p[m++],colormap_index:p[m++]|p[m++]<<8,colormap_length:p[m++]|p[m++]<<8,colormap_size:p[m++],origin:[p[m++]|p[m++]<<8,p[m++]|p[m++]<<8],width:p[m++]|p[m++]<<8,height:p[m++]|p[m++]<<8,pixel_size:p[m++],flags:p[m++]};!function(e){switch(e.image_type){case r:case o:(e.colormap_length>256||24!==e.colormap_size||1!==e.colormap_type)&&console.error("TGALoader: Invalid type colormap data for indexed type.");break;case a:case i:case s:case n:e.colormap_type&&console.error("TGALoader: Invalid type colormap data for colormap type.");break;case t:console.error("TGALoader: No data.");default:console.error('TGALoader: Invalid type "%s".',e.image_type)}(e.width<=0||e.height<=0)&&console.error("TGALoader: Invalid image size."),8!==e.pixel_size&&16!==e.pixel_size&&24!==e.pixel_size&&32!==e.pixel_size&&console.error('TGALoader: Invalid pixel size "%s".',e.pixel_size)}(g),g.id_length+m>e.length&&console.error("TGALoader: No data."),m+=g.id_length;var A=!1,v=!1,y=!1;switch(g.image_type){case o:A=!0,v=!0;break;case r:v=!0;break;case s:A=!0;break;case a:break;case n:A=!0,y=!0;break;case i:y=!0}var x=document.createElement("canvas");x.width=g.width,x.height=g.height;var M=x.getContext("2d"),b=M.createImageData(g.width,g.height),w=function(e,t,r,a,i){var o,s,n,l;if(s=r.pixel_size>>3,n=r.width*r.height*s,t&&(l=i.subarray(a,a+=r.colormap_length*(r.colormap_size>>3))),e){var u,h,d;o=new Uint8Array(n);for(var f=0,c=new Uint8Array(s);f>u){default:case f:o=0,n=1,m=t,s=0,p=1,A=r;break;case h:o=0,n=1,m=t,s=r-1,p=-1,A=-1;break;case c:o=t-1,n=-1,m=-1,s=0,p=1,A=r;break;case d:o=t-1,n=-1,m=-1,s=r-1,p=-1,A=-1}if(y)switch(g.pixel_size){case 8:!function(e,t,r,a,i,o,s,n){var l,u,h,d=0,f=g.width;for(h=t;h!==a;h+=r)for(u=i;u!==s;u+=o,d++)l=n[d],e[4*(u+f*h)+0]=l,e[4*(u+f*h)+1]=l,e[4*(u+f*h)+2]=l,e[4*(u+f*h)+3]=255}(e,s,p,A,o,n,m,a);break;case 16:!function(e,t,r,a,i,o,s,n){var l,u,h=0,d=g.width;for(u=t;u!==a;u+=r)for(l=i;l!==s;l+=o,h+=2)e[4*(l+d*u)+0]=n[h+0],e[4*(l+d*u)+1]=n[h+0],e[4*(l+d*u)+2]=n[h+0],e[4*(l+d*u)+3]=n[h+1]}(e,s,p,A,o,n,m,a);break;default:console.error("TGALoader: Format not supported.")}else switch(g.pixel_size){case 8:!function(e,t,r,a,i,o,s,n,l){var u,h,d,f=l,c=0,p=g.width;for(d=t;d!==a;d+=r)for(h=i;h!==s;h+=o,c++)u=n[c],e[4*(h+p*d)+3]=255,e[4*(h+p*d)+2]=f[3*u+0],e[4*(h+p*d)+1]=f[3*u+1],e[4*(h+p*d)+0]=f[3*u+2]}(e,s,p,A,o,n,m,a,i);break;case 16:!function(e,t,r,a,i,o,s,n){var l,u,h,d=0,f=g.width;for(h=t;h!==a;h+=r)for(u=i;u!==s;u+=o,d+=2)l=n[d+0]+(n[d+1]<<8),e[4*(u+f*h)+0]=(31744&l)>>7,e[4*(u+f*h)+1]=(992&l)>>2,e[4*(u+f*h)+2]=(31&l)>>3,e[4*(u+f*h)+3]=32768&l?0:255}(e,s,p,A,o,n,m,a);break;case 24:!function(e,t,r,a,i,o,s,n){var l,u,h=0,d=g.width;for(u=t;u!==a;u+=r)for(l=i;l!==s;l+=o,h+=3)e[4*(l+d*u)+3]=255,e[4*(l+d*u)+2]=n[h+0],e[4*(l+d*u)+1]=n[h+1],e[4*(l+d*u)+0]=n[h+2]}(e,s,p,A,o,n,m,a);break;case 32:!function(e,t,r,a,i,o,s,n){var l,u,h=0,d=g.width;for(u=t;u!==a;u+=r)for(l=i;l!==s;l+=o,h+=4)e[4*(l+d*u)+2]=n[h+0],e[4*(l+d*u)+1]=n[h+1],e[4*(l+d*u)+0]=n[h+2],e[4*(l+d*u)+3]=n[h+3]}(e,s,p,A,o,n,m,a);break;default:console.error("TGALoader: Format not supported.")}}(b.data,g.width,g.height,w.pixel_data,w.palettes);return M.putImageData(b,0,0),x}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(7),i=r(5),o=r(2),s=r(6),n=r(3);var l=r(7);t.MMDLoader=l.default;var u=r(5);t.MMDAudioManager=u.default;var h=r(2);t.MMDGrantSolver=h.default;var d=r(6);t.MMDHelper=d.default;var f=r(9);t.DataCreationHelper=f.default;var c=r(12);t.VectorKeyframeTrackEx=c.default;var p=r(11);t.QuaternionKeyframeTrackEx=p.default;var m=r(10);t.NumberKeyframeTrackEx=m.default;var g=r(1);t.CubicBezierInterpolation=g.default;var A=r(3);t.MMDPhysics=A.default;var v=r(8);t.CCDIKSolver=v.default,t.mixin=e=>{e.MMDLoader=a.default,e.MMDAudioManager=i.default,e.MMDGrantSolver=o.default,e.MMDHelper=s.default,e.MMDPhysics=n.default,e.CCDIKSolver=CCDIKSolver}},function(e,t){e.exports=require("mmd-parser")}]); //# sourceMappingURL=/sm/0dfc3f9662b95de68fc05aa4d0c277f2d3b083f59718cf8aae38fbe50195f52c.map