(window.webpackJsonp=window.webpackJsonp||[]).push([[6],{"/UnV":function(t,e,i){"use strict";i.d(e,"a",(function(){return r}));const s=i("rwco").c.get("core/data_formats/parsing/afs"),n=5457473;function r(t){if(t.u32()!==n)return s.error("Not an AFS archive."),[];const e=t.u16();t.seek(2);const i=[];for(let s=0;st.bytes_left)break;e.push({type:i,data:t.take(s)})}return e}i.d(e,"a",(function(){return s}))},"9dYx":function(t,e,i){"use strict";var s=i("bcBH");class n{constructor(t,e){this._position=0,this.endianness=t,this.offset=e}get position(){return this._position}get endianness(){return this.little_endian?s.a.Little:s.a.Big}set endianness(t){this.little_endian=t===s.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 n{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 s=0;si)throw new Error(`${t} Bytes required but only ${i} available.`)}}},NRxM:function(t,e,i){"use strict";i.d(e,"a",(function(){return n}));var s=i("9dYx");class n extends s.a{constructor(t,e,i=0,s=t.byteLength-i){super(e,i),this._size=s,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 n(this.backing_buffer,this.endianness,e,t);return this._position+=t,i}}},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 s=i("kwt4");const n=1296321870;var r,o;function a(t,e){return t.u32()===n?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 s=t.u32();return t.seek_start(s),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 s=t.u32(),n=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=s}return n}function c(t,e){const i=[];for(let n=0;n{if(!e)throw new Error(`Couldn't load body for player class ${t.name}.`);return this.load_body_part_geometry(t.name,"Head",0).then(i=>{if(!i)return e;let s=1+t.body_tex_ids.length;return this.shift_texture_ids(i,s),this.add_to_bone(e,i,59),0===t.hair_style_count?e:this.load_body_part_geometry(t.name,"Hair",0).then(n=>n?(s+=t.head_tex_ids.length,this.shift_texture_ids(n,s),this.add_to_bone(i,n,0),t.hair_styles_with_accessory.has(0)?this.load_body_part_geometry(t.name,"Accessory",0).then(i=>(i&&(s+=t.hair_tex_ids.length,this.shift_texture_ids(i,s),this.add_to_bone(n,i,0)),e)):e):e)})})}load_body_part_geometry(t,e,i){return this.http_client.get(function(t,e,i){return`/player/${t}${e}${null==i?"":i}.nj`}(t,e,i)).array_buffer().then(t=>Object(s.c)(new n.a(t,r.a.Little))[0])}shift_texture_ids(t,e){if(t.model)for(const i of t.model.meshes)null!=i.texture_id&&(i.texture_id+=e);for(const i of t.children)this.shift_texture_ids(i,e)}add_to_bone(t,e,i){const s=t.get_bone(i);s&&(s.evaluation_flags.hidden=!1,s.evaluation_flags.break_child_trace=!1,s.add_child(e))}load_textures(t){let e=this.xvr_texture_cache.get(t.name);return e||(e=this.http_client.get(`/player/${t.name}Tex.afs`).array_buffer().then(t=>{const e=Object(_.a)(new n.a(t,r.a.Little)),i=[];for(const t of e){const e=Object(a.a)(new n.a(t,r.a.Little));i.push(...e.textures)}return i})),e}load_animation(t,e){let i=this.nj_motion_cache.get(t);return i||(i=this.http_client.get(`/player/animation/animation_${t.toString().padStart(3,"0")}.njm`).array_buffer().then(t=>Object(o.c)(new n.a(t,r.a.Little),e))),i}}},bcBH:function(t,e,i){"use strict";var s;i.d(e,"a",(function(){return s})),function(t){t[t.Little=0]="Little",t[t.Big=1]="Big"}(s||(s={}))},kwt4:function(t,e,i){"use strict";var s=i("9Ykw"),n=i("rwco");const r=n.c.get("core/data_formats/parsing/ninja/njcm");var o;function a(t,e){const i=t.u32(),s=t.u32(),n=t.vec3_f32(),r=t.f32(),a=[],h=[];if(i){t.seek_start(i);for(const i of _(t,e,!0))if(i.type===o.Vertex)for(const t of i.vertices)a[t.index]={position:t.position,normal:t.normal,bone_weight:t.bone_weight,bone_weight_status:t.bone_weight_status,calc_continue:t.calc_continue}}if(s){t.seek_start(s);let i=void 0;for(const s of _(t,e,!1))if(s.type===o.Tiny)i=s.texture_id;else if(s.type===o.Strip){for(const t of s.triangle_strips)t.texture_id=i;h.push(...s.triangle_strips)}}return{type:"njcm",vertices:a,meshes:h,collision_sphere_center:n,collision_sphere_radius:r}}function _(t,e,i){const s=[];let n=!0;for(;n;){const a=t.u8(),c=t.u8(),f=t.position;let l=0;if(0===a)s.push({type:o.Null,type_id:a});else if(1<=a&&a<=3)s.push({type:o.Bits,type_id:a});else if(4===a){const i=c,r=t.position;s.push({type:o.CachePolygonList,type_id:a,cache_index:i,offset:r}),e[i]=r,n=!1}else if(5===a){const n=c,r=e[n];null!=r&&(t.seek_start(r),s.push(..._(t,e,i))),s.push({type:o.DrawPolygonList,type_id:a,cache_index:n})}else if(8<=a&&a<=9){l=2;const e=t.u16();s.push({type:o.Tiny,type_id:a,flip_u:0!=(128&a),flip_v:0!=(64&a),clamp_u:0!=(32&a),clamp_v:0!=(16&a),mipmap_d_adjust:15&a,filter_mode:e>>>14,super_sample:0!=(64&e),texture_id:8191&e})}else 17<=a&&a<=31?(l=2+2*t.u16(),s.push({type:o.Material,type_id:a})):32<=a&&a<=50?(l=2+4*t.u16(),s.push({type:o.Vertex,type_id:a,vertices:h(t,a,c)})):56<=a&&a<=58?(l=2+2*t.u16(),s.push({type:o.Volume,type_id:a})):64<=a&&a<=75?(l=2+2*t.u16(),s.push({type:o.Strip,type_id:a,triangle_strips:u(t,a,c)})):255===a?(l=i?2:0,s.push({type:o.End,type_id:a}),n=!1):(l=2+2*t.u16(),s.push({type:o.Unknown,type_id:a}),r.warn(`Unknown chunk type ${a} at offset ${f}.`));t.seek_start(f+l)}return s}function h(t,e,i){if(e<32||e>50)return r.warn(`Unknown vertex chunk type ${e}.`),[];const s=3&i,n=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 u(t,e,i){const s={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)},n=t.u16(),r=n>>>14,o=16383&n;let a=!1,_=!1,h=!1,u=!1;switch(e){case 64:break;case 65:case 66:a=!0;break;case 67:h=!0;break;case 68:case 69:a=!0,h=!0;break;case 70:_=!0;break;case 71:case 72:a=!0,_=!0;break;case 73:break;case 74:case 75:u=!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({},s),{clockwise_winding:i,has_tex_coords:a,has_normal:h,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=n.c.get("core/data_formats/parsing/ninja/xj");function f(t){t.seek(4);const e=t.u32(),i=t.u32(),s=t.u32(),n=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 s=t.u32(),n=t.u32(),r=t.u32(),o=[];for(let e=0;et.type===w),r=[];for(const t of n)r.push(...x(t.data,e,i));return r}function x(t,e,i){const s=t.u32(),n=0!=(1&s),r=0!=(2&s),o=0!=(4&s),a=0!=(8&s),_=0!=(16&s),h=0!=(32&s),u=0!=(64&s),c=0!=(128&s),f=t.u32(),l=t.vec3_f32(),p={x:t.i32()*d,y:t.i32()*d,z:t.i32()*d},w=t.vec3_f32(),y=t.u32(),b=t.u32();let k,v,m;return f&&(t.seek_start(f),k=e(t,i)),y?(t.seek_start(y),v=x(t,e,i)):v=[],b?(t.seek_start(b),m=x(t,e,i)):m=[],[new g({no_translate:n,no_rotate:r,no_scale:o,hidden:a,break_child_trace:_,zxy_rotation_order:h,skip:u,shape_skip:c},k,l,p,w,v),...m]}},yub1:function(t,e,i){"use strict";i.d(e,"a",(function(){return a}));var s=i("9Ykw");const n=i("rwco").c.get("core/data_formats/parsing/ninja/texture"),r=1213027928,o=1414682200;function a(t){const e=Object(s.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(),s=t.u32(),n=t.u16(),r=t.u16(),o=t.u32();return t.seek(36),{id:s,format:[e,i],width:n,height:r,size:o,data:t.array_buffer(o)}})(t.data));return a&&a.texture_count!==_.length&&n.warn(`Found ${_.length} textures instead of ${a.texture_count} as defined in the header.`),{textures:_}}}}]);