(window.webpackJsonp=window.webpackJsonp||[]).push([[5],{"7CyS":function(t,e,i){"use strict";i.d(e,"a",(function(){return r})),i.d(e,"b",(function(){return o}));var n=i("Womt"),s=i("VwSi");const r=30;function o(t,e){const i=e.interpolation===s.a.Spline?n.InterpolateSmooth:n.InterpolateLinear,o=[];return e.motion_data.forEach((e,a)=>{const _=t.get_bone(a);_&&e.tracks.forEach(({type:t,keyframes:e})=>{const u=[],h=[];for(const i of e)if(u.push(i.frame/r),t===s.b.Rotation){const t=_.evaluation_flags.zxy_rotation_order?"ZXY":"ZYX",e=(new n.Quaternion).setFromEuler(new n.Euler(i.value.x,i.value.y,i.value.z,t));h.push(e.x,e.y,e.z,e.w)}else h.push(i.value.x,i.value.y,i.value.z);if(t===s.b.Rotation)o.push(new n.QuaternionKeyframeTrack(`.bones[${a}].quaternion`,u,h,i));else{const e=t===s.b.Position?`.bones[${a}].position`:`.bones[${a}].scale`;o.push(new n.VectorKeyframeTrack(e,u,h,i))}})}),new n.AnimationClip("Animation",(e.frame_count-1)/r,o).optimize()}},"9Ykw":function(t,e,i){"use strict";function n(t){const e=[];for(;t.bytes_left;){const i=t.u32(),n=t.u32();if(n>t.bytes_left)break;e.push({type:i,data:t.take(n)})}return e}i.d(e,"a",(function(){return n}))},"9dYx":function(t,e,i){"use strict";var n=i("bcBH");class s{constructor(t,e){this._position=0,this.endianness=t,this.offset=e}get position(){return this._position}get endianness(){return this.little_endian?n.a.Little:n.a.Big}set endianness(t){this.little_endian=t===n.a.Little}get bytes_left(){return this.size-this.position}seek(t){return this.seek_start(this.position+t)}seek_start(t){if(t<0||t>this.size)throw new Error(`Offset ${t} is out of bounds.`);return this._position=t,this}seek_end(t){if(t<0||t>this.size)throw new Error(`Offset ${t} is out of bounds.`);return this._position=this.size-t,this}u8(){return this.u8_at(this._position++)}u8_at(t){return this.check_offset(t,1),this.dv.getUint8(this.offset+t)}u16(){const t=this.u16_at(this.position);return this._position+=2,t}u16_at(t){return this.check_offset(t,2),this.dv.getUint16(this.offset+t,this.little_endian)}u32(){const t=this.u32_at(this.position);return this._position+=4,t}u32_at(t){return this.check_offset(t,4),this.dv.getUint32(this.offset+t,this.little_endian)}i8(){return this.i8_at(this._position++)}i8_at(t){return this.check_offset(t,1),this.dv.getInt8(this.offset+t)}i16(){const t=this.i16_at(this.position);return this._position+=2,t}i16_at(t){return this.check_offset(t,2),this.dv.getInt16(this.offset+t,this.little_endian)}i32(){const t=this.i32_at(this.position);return this._position+=4,t}i32_at(t){return this.check_offset(t,4),this.dv.getInt32(this.offset+t,this.little_endian)}f32(){const t=this.f32_at(this.position);return this._position+=4,t}f32_at(t){return this.check_offset(t,4),this.dv.getFloat32(this.offset+t,this.little_endian)}u8_array(t){this.check_size("n",t,t);const e=[];for(let i=0;ithis.size-this.position)throw new Error(`${t} ${e} is out of bounds.`)}check_offset(t,e){if(t<0||t+e>this.size)throw new Error(`Offset ${t} is out of bounds.`)}}i.d(e,"a",(function(){return r}));class r extends s{write_u8(t){return this.write_u8_at(this.position,t),this._position+=1,this}write_u16(t){return this.write_u16_at(this.position,t),this._position+=2,this}write_u32(t){return this.write_u32_at(this.position,t),this._position+=4,this}write_i8(t){return this.write_i8_at(this.position,t),this._position+=1,this}write_i16(t){return this.write_i16_at(this.position,t),this._position+=2,this}write_i32(t){return this.write_i32_at(this.position,t),this._position+=4,this}write_f32(t){return this.write_f32_at(this.position,t),this._position+=4,this}write_u8_array(t){return this.write_u8_array_at(this.position,t),this._position+=t.length,this}write_u16_array(t){return this.write_u16_array_at(this.position,t),this._position+=2*t.length,this}write_u32_array(t){return this.write_u32_array_at(this.position,t),this._position+=4*t.length,this}write_i32_array(t){return this.write_i32_array_at(this.position,t),this._position+=4*t.length,this}write_vec2_f32(t){return this.write_vec2_f32_at(this.position,t),this._position+=8,this}write_vec3_f32(t){return this.write_vec3_f32_at(this.position,t),this._position+=12,this}write_cursor(t){const e=t.size-t.position;return this.ensure_size(e),t.copy_to_uint8_array(new Uint8Array(this.backing_buffer,this.offset+this.position,e),e),this._position+=e,this}write_string_ascii(t,e){return this.write_string_ascii_at(this.position,t,e),this._position+=e,this}write_string_utf16(t,e){return this.write_string_utf16_at(this.position,t,e),this._position+=e,this}write_u8_at(t,e){return this.ensure_size(1,t),this.dv.setUint8(t,e),this}write_u16_at(t,e){return this.ensure_size(2,t),this.dv.setUint16(t,e,this.little_endian),this}write_u32_at(t,e){return this.ensure_size(4,t),this.dv.setUint32(t,e,this.little_endian),this}write_i8_at(t,e){return this.ensure_size(1,t),this.dv.setInt8(t,e),this}write_i16_at(t,e){return this.ensure_size(2,t),this.dv.setInt16(t,e,this.little_endian),this}write_i32_at(t,e){return this.ensure_size(4,t),this.dv.setInt32(t,e,this.little_endian),this}write_f32_at(t,e){return this.ensure_size(4,t),this.dv.setFloat32(t,e,this.little_endian),this}write_u8_array_at(t,e){return this.ensure_size(e.length,t),new Uint8Array(this.backing_buffer,this.offset+t).set(new Uint8Array(e)),this}write_u16_array_at(t,e){this.ensure_size(2*e.length,t);const i=e.length;for(let n=0;ni)throw new Error(`${t} Bytes required but only ${i} available.`)}}},NRxM:function(t,e,i){"use strict";i.d(e,"a",(function(){return s}));var n=i("9dYx");class s extends n.a{constructor(t,e,i=0,n=t.byteLength-i){super(e,i),this._size=n,this.backing_buffer=t,this.dv=new DataView(t,0,t.byteLength)}get size(){return this._size}set size(t){if(t>this.backing_buffer.byteLength-this.offset)throw new Error(`Size ${t} is out of bounds.`);this._size=t}take(t){const e=this.offset+this.position,i=new s(this.backing_buffer,this.endianness,e,t);return this._position+=t,i}}},"Sa3/":function(t,e,i){"use strict";i.d(e,"a",(function(){return s}));var n=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{_(n.next(t))}catch(t){r(t)}}function a(t){try{_(n.throw(t))}catch(t){r(t)}}function _(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}_((n=n.apply(t,e||[])).next())}))};function s(t){return n(this,void 0,void 0,(function*(){return new Promise((e,i)=>{const n=new FileReader;n.addEventListener("loadend",()=>{n.result instanceof ArrayBuffer?e(n.result):i(new Error("Couldn't read file."))}),n.readAsArrayBuffer(t)})}))}},VwSi:function(t,e,i){"use strict";i.d(e,"a",(function(){return r})),i.d(e,"b",(function(){return o})),i.d(e,"c",(function(){return a}));var n=i("kwt4");const s=1296321870;var r,o;function a(t,e){return t.u32()===s?function(t,e){const i=t.u32();return _(t.take(i),e)}(t,e):(t.seek_start(0),function(t,e){t.seek_end(16);const i=t.u32();t.seek_start(i);const n=t.u32();return t.seek_start(n),function(t,e){t.seek(4);const i=t.u32();return t.seek_start(i),_(t,e)}(t,e)}(t,e))}function _(t,e){let i=t.u32();const n=t.u32(),s=t.u16(),r=t.u16(),a=(192&r)>>6,_=15&r,c=[];for(let r=0;r=i)return t.seek_start(r),c(t,e);o=n}return s}function c(t,e){const i=[];for(let s=0;s>>14,super_sample:0!=(64&e),texture_id:8191&e})}else 17<=a&&a<=31?(l=2+2*t.u16(),n.push({type:o.Material,type_id:a})):32<=a&&a<=50?(l=2+4*t.u16(),n.push({type:o.Vertex,type_id:a,vertices:u(t,a,c)})):56<=a&&a<=58?(l=2+2*t.u16(),n.push({type:o.Volume,type_id:a})):64<=a&&a<=75?(l=2+2*t.u16(),n.push({type:o.Strip,type_id:a,triangle_strips:h(t,a,c)})):255===a?(l=i?2:0,n.push({type:o.End,type_id:a}),s=!1):(l=2+2*t.u16(),n.push({type:o.Unknown,type_id:a}),r.warn(`Unknown chunk type ${a} at offset ${f}.`));t.seek_start(f+l)}return n}function u(t,e,i){if(e<32||e>50)return r.warn(`Unknown vertex chunk type ${e}.`),[];const n=3&i,s=0!=(128&i),o=t.u16(),a=t.u16(),_=[];for(let i=0;i=42&&(44===e?(r.index=o+t.u16(),r.bone_weight=t.u16()/255):t.seek(4));else if(48<=e&&e<=50){const i=t.u32();r.normal={x:(i>>20&1023)/1023,y:(i>>10&1023)/1023,z:(1023&i)/1023},e>=49&&t.seek(4)}_.push(r)}return _}function h(t,e,i){const n={ignore_light:0!=(1&i),ignore_specular:0!=(2&i),ignore_ambient:0!=(4&i),use_alpha:0!=(8&i),double_side:0!=(16&i),flat_shading:0!=(32&i),environment_mapping:0!=(64&i)},s=t.u16(),r=s>>>14,o=16383&s;let a=!1,_=!1,u=!1,h=!1;switch(e){case 64:break;case 65:case 66:a=!0;break;case 67:u=!0;break;case 68:case 69:a=!0,u=!0;break;case 70:_=!0;break;case 71:case 72:a=!0,_=!0;break;case 73:break;case 74:case 75:h=!0;break;default:throw new Error(`Unexpected chunk type ID: ${e}.`)}const c=[];for(let e=0;e=2&&t.seek(2*r)}c.push(Object.assign(Object.assign({},n),{clockwise_winding:i,has_tex_coords:a,has_normal:u,vertices:o}))}return c}!function(t){t[t.Unknown=0]="Unknown",t[t.Null=1]="Null",t[t.Bits=2]="Bits",t[t.CachePolygonList=3]="CachePolygonList",t[t.DrawPolygonList=4]="DrawPolygonList",t[t.Tiny=5]="Tiny",t[t.Material=6]="Material",t[t.Vertex=7]="Vertex",t[t.Volume=8]="Volume",t[t.Strip=9]="Strip",t[t.End=10]="End"}(o||(o={}));const c=s.c.get("core/data_formats/parsing/ninja/xj");function f(t){t.seek(4);const e=t.u32(),i=t.u32(),n=t.u32(),s=t.u32(),r=t.u32(),o=t.u32(),a={type:"xj",vertices:[],meshes:[],collision_sphere_position:t.vec3_f32(),collision_sphere_radius:t.f32()};return i>=1&&(i>1&&c.warn(`Vertex info count of ${i} was larger than expected.`),a.vertices.push(...function(t,e){t.seek_start(e);const i=t.u16();t.seek(2);const n=t.u32(),s=t.u32(),r=t.u32(),o=[];for(let e=0;et.type===w),r=[];for(const t of s)r.push(...x(t.data,e,i));return r}function x(t,e,i){const n=t.u32(),s=0!=(1&n),r=0!=(2&n),o=0!=(4&n),a=0!=(8&n),_=0!=(16&n),u=0!=(32&n),h=0!=(64&n),c=0!=(128&n),f=t.u32(),l=t.vec3_f32(),d={x:t.i32()*p,y:t.i32()*p,z:t.i32()*p},w=t.vec3_f32(),m=t.u32(),y=t.u32();let k,b,g;return f&&(t.seek_start(f),k=e(t,i)),m?(t.seek_start(m),b=x(t,e,i)):b=[],y?(t.seek_start(y),g=x(t,e,i)):g=[],[new v({no_translate:s,no_rotate:r,no_scale:o,hidden:a,break_child_trace:_,zxy_rotation_order:u,skip:h,shape_skip:c},k,l,d,w,b),...g]}},tyuj:function(t,e,i){"use strict";i.r(e);var n=i("NRxM"),s=i("bcBH"),r=i("VwSi"),o=i("kwt4");class a{constructor(t,e,i,n){this.name=t,this.head_style_count=e,this.hair_styles_count=i,this.hair_styles_with_accessory=n}}class _{constructor(t,e){this.id=t,this.name=e}}var u=i("Sa3/"),h=i("ouMO"),c=i("7CyS"),f=i("yub1"),l=i("kcKQ"),d=i("rwco");i.d(e,"Model3DStore",(function(){return m}));var p=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{_(n.next(t))}catch(t){r(t)}}function a(t){try{_(n.throw(t))}catch(t){r(t)}}function _(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}_((n=n.apply(t,e||[])).next())}))};const w=d.c.get("viewer/stores/ModelStore");class m extends l.a{constructor(t){super(),this.asset_loader=t,this._current_model=Object(h.e)(void 0),this._current_nj_data=Object(h.e)(void 0),this._current_xvm=Object(h.e)(void 0),this._show_skeleton=Object(h.e)(!1),this._current_animation=Object(h.e)(void 0),this._current_nj_motion=Object(h.e)(void 0),this._animation_playing=Object(h.e)(!0),this._animation_frame_rate=Object(h.e)(c.a),this._animation_frame=Object(h.e)(0),this.models=[new a("HUmar",1,10,new Set([6])),new a("HUnewearl",1,10,new Set),new a("HUcast",5,0,new Set),new a("HUcaseal",5,0,new Set),new a("RAmar",1,10,new Set([0,1,2,3,4,5,6,7,8,9])),new a("RAmarl",1,10,new Set([0,1,2,3,4,5,6,7,8,9])),new a("RAcast",5,0,new Set),new a("RAcaseal",5,0,new Set),new a("FOmar",1,10,new Set([0,1,2,3,4,5,6,7,8,9])),new a("FOmarl",1,10,new Set([0,1,2,3,4,5,6,7,8,9])),new a("FOnewm",1,10,new Set([0,1,2,3,4,5,6,7,8,9])),new a("FOnewearl",1,10,new Set([0,1,2,3,4,5,6,7,8,9]))],this.animations=new Array(572).fill(void 0).map((t,e)=>new _(e,`Animation ${e+1}`)),this.current_model=this._current_model,this.current_nj_data=this._current_nj_data,this.current_xvm=this._current_xvm,this.show_skeleton=this._show_skeleton,this.current_animation=this._current_animation,this.current_nj_motion=this._current_nj_motion,this.animation_playing=this._animation_playing,this.animation_frame_rate=this._animation_frame_rate,this.animation_frame=this._animation_frame,this.animation_frame_count=this.current_nj_motion.map(t=>t?t.frame_count:0),this.set_current_model=t=>{this._current_model.val=t},this.clear_current_model=()=>{this._current_model.val=void 0},this.set_show_skeleton=t=>{this._show_skeleton.val=t},this.set_current_animation=t=>{this._current_animation.val=t},this.clear_current_animation=()=>{this._current_animation.val=void 0},this.set_animation_playing=t=>{this._animation_playing.val=t},this.set_animation_frame_rate=t=>{this._animation_frame_rate.val=t},this.set_animation_frame=t=>{this._animation_frame.val=t},this.load_file=t=>p(this,void 0,void 0,(function*(){try{const e=yield Object(u.a)(t),i=new n.a(e,s.a.Little);if(t.name.endsWith(".nj")){this.clear_current_model();const t=Object(o.c)(i)[0];this.set_current_nj_data({nj_object:t,bone_count:t.bone_count(),has_skeleton:!0})}else if(t.name.endsWith(".xj")){this.clear_current_model();const t=Object(o.d)(i)[0];this.set_current_nj_data({nj_object:t,bone_count:0,has_skeleton:!1})}else if(t.name.endsWith(".njm")){this.clear_current_animation(),this._current_nj_motion.val=void 0;const t=this.current_nj_data.val;t&&(this.set_animation_playing(!0),this._current_nj_motion.val=Object(r.c)(i,t.bone_count))}else t.name.endsWith(".xvm")?this.current_model&&(this._current_xvm.val=Object(f.a)(i)):w.error(`Unknown file extension in filename "${t.name}".`)}catch(t){w.error("Couldn't read file.",t)}})),this.load_model=t=>p(this,void 0,void 0,(function*(){if(this.clear_current_animation(),t)try{const e=yield this.asset_loader.load_geometry(t);this.set_current_nj_data({nj_object:e,bone_count:t?64:e.bone_count(),has_skeleton:!0})}catch(e){w.error(`Couldn't load model for ${t.name}.`),this._current_nj_data.val=void 0}else this._current_nj_data.val=void 0})),this.load_animation=t=>p(this,void 0,void 0,(function*(){const e=this.current_nj_data.val;if(e&&t)try{this._current_nj_motion.val=yield this.asset_loader.load_animation(t.id,e.bone_count),this.set_animation_playing(!0)}catch(e){w.error(`Couldn't load animation "${t.name}".`),this._current_nj_motion.val=void 0}else this._current_nj_motion.val=void 0})),this.disposables(this.current_model.observe(({value:t})=>this.load_model(t)),this.current_animation.observe(({value:t})=>this.load_animation(t)))}set_current_nj_data(t){this._current_xvm.val=void 0,this._current_nj_data.val=t}}},yub1:function(t,e,i){"use strict";i.d(e,"a",(function(){return a}));var n=i("9Ykw");const s=i("rwco").c.get("core/data_formats/parsing/ninja/texture"),r=1213027928,o=1414682200;function a(t){const e=Object(n.a)(t),i=e.find(t=>t.type===r),a=i&&function(t){return{texture_count:t.u16()}}(i.data),_=e.filter(t=>t.type===o).map(t=>(function(t){const e=t.u32(),i=t.u32(),n=t.u32(),s=t.u16(),r=t.u16(),o=t.u32();return t.seek(36),{id:n,format:[e,i],width:s,height:r,size:o,data:t.array_buffer(o)}})(t.data));return a&&a.texture_count!==_.length&&s.warn(`Found ${_.length} textures instead of ${a.texture_count} as defined in the header.`),{textures:_}}}}]);