PageSourceSearch

https://cybershoke.net/assets/Skin3DPreview-Bs6r6YoK.js

js cybershoke.net collected 2026-10-04 05:23:41 UTC 12,449 bytes, 141 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/scene-B4-Fy7Q9.js","assets/index-uear5Vpj.js","assets/vendor-react-BGN68_Lp.js","assets/vendor-socket-DSYo_sTV.js","assets/vendor-i18n-BWleq_Sd.js","assets/vendor-redux-D8sX5Eqv.js","assets/vendor-router-CYD8mbvC.js","assets/vendor-styled-pkIKgjgv.js","assets/index-BO7KhNsz.css","assets/alphabet-BgOmDc_X.js"])))=>i.map(i=>d[i]);
2import{gq as ae,gr as ce,gs as le,c7 as de,cH as fe,c8 as pe,bY as ue,gt as he,bO as me,ct as ge,cr as xe,cB as we,cC as ye,cs as be,bP as ke,bV as ve,gu as Se,ds as je,gv as Ee,cb as A,bT as $e,bR as H,bS as X,cE as Ie,z as De,bh as Ce,c0 as Ke,c1 as _e,c2 as Pe,c3 as Oe,c4 as Re,c5 as ze,b_ as Ae,gw as Fe}from"./index-uear5Vpj.js";import{r as i,j as r}from"./vendor-react-BGN68_Lp.js";import{a as Ne,u as m}from"./vendor-redux-D8sX5Eqv.js";import{g as y}from"./vendor-styled-pkIKgjgv.js";import{u as Le}from"./vendor-i18n-BWleq_Sd.js";import"./vendor-socket-DSYo_sTV.js";import"./vendor-router-CYD8mbvC.js";const U="skin3d-debug",Me=150,Te=y.div`
3    position: absolute;
4    z-index: 5;
5    right: 8px;
6    bottom: 8px;
7    display: flex;
8    flex-direction: column;
9    max-width: min(268px, calc(100% - 16px));
10    max-height: calc(100% - 16px);
11    border-radius: 10px;
12    /* the header and the scrollable body take the pointer, so a drag started
13       over them does not rotate the camera — collapse it to get the corner
14       back */
15    pointer-events: none;
16    background: rgba(9, 13, 21, 0.82);
17    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
18    color: #d7e2f2;
19    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
20    font-size: 10px;
21    line-height: 1.5;
22    user-select: none;
23`,Ye=y.button`
24    display: flex;
25    align-items: center;
26    justify-content: space-between;
27    gap: 10px;
28    width: 100%;
29    padding: 5px 8px;
30    border: 0;
31    background: rgba(159, 179, 255, 0.14);
32    color: #9fb3ff;
33    font: inherit;
34    font-weight: 700;
35    letter-spacing: 0.06em;
36    pointer-events: auto;
37    cursor: pointer;
38    text-transform: uppercase;
39
40    &:hover {
41        background: rgba(159, 179, 255, 0.24);
42    }
43`,Be=y.div`
44    overflow-y: auto;
45    padding: 6px 8px 8px;
46    pointer-events: auto;
47    user-select: text;
48`,ee=y.div`
49    & + & {
50        margin-top: 6px;
51        padding-top: 6px;
52        border-top: 1px solid rgba(255, 255, 255, 0.07);
53    }
54
55    h5 {
56        margin-bottom: 2px;
57        color: #7f8eaa;
58        font-size: 9px;
59        font-weight: 700;
60        letter-spacing: 0.08em;
61        text-transform: uppercase;
62    }
63
64    h5[data-copy] {
65        cursor: pointer;
66
67        &:hover {
68            color: #9fb3ff;
69        }
70    }
71`,te=y.div`
72    display: grid;
73    grid-template-columns: 74px 1fr;
74    gap: 0 8px;
75`,ne=y.span`
76    overflow: hidden;
77    color: #8995aa;
78    text-overflow: ellipsis;
79    white-space: nowrap;
80`,oe=y.span`
81    overflow: hidden;
82    color: #eef3ff;
83    text-overflow: ellipsis;
84    white-space: nowrap;
85    cursor: pointer;
86
87    &:hover {
88        color: #9fb3ff;
89    }
90
91    &.copied {
92        color: #6ee7a8;
93    }
94`,x=(t,a=2)=>Number.isFinite(t)?t.toFixed(a):"—",v=(t,a=2)=>Array.isArray(t)?t.map(u=>x(u,a)).join("  "):"—",d=t=>t==null||t===""?"—":String(t),q=t=>t?"yes":"no",J=t=>t?{id:t.id,...t.offset?{offset:t.offset}:{}}:{id:0},Q=t=>({stickerId:t.stickerId,offsetX:t.offset?.[0]??0,offsetY:t.offset?.[1]??0,rotation:t.rotation??0,wear:t.wear??0}),Ve=(t,a=3)=>typeof t=="number"?Number(t.toFixed(a)):t,O=t=>Array.isArray(t)?`[${t.map(O).join(", ")}]`:t&&typeof t=="object"?`{ ${Object.entries(t).map(([a,u])=>`${a}: ${O(u)}`).join(", ")} }`:typeof t=="string"?JSON.stringify(t):String(Ve(t)),I=({title:t,rows:a,copyAll:u})=>{const[b,g]=i.useState(null),j=i.useRef(null),e=(f,k)=>{navigator.clipboard?.writeText(k),g(f),clearTimeout(j.current),j.current=setTimeout(()=>g(null),700)};return r.jsxs(ee,{children:[r.jsx("h5",{"data-copy":u?"":void 0,title:u?"copy section":void 0,onClick:u?()=>e(t,O(u())):void 0,children:b===t?`${t} — copied`:t}),r.jsx(te,{children:a.map(([f,k,c])=>r.jsxs(i.Fragment,{children:[r.jsx(ne,{children:f}),r.jsx(oe,{className:b===f?"copied":"",title:"click to copy",onClick:()=>e(f,c===void 0?String(k):O(c)),children:b===f?"copied":k})]},f))})]})}
94,We=({viewerRef:t,status:a,itemdefindex:u,skinName:b})=>{const[g,j]=i.useState(()=>ae()[U]!=="off"),[e,f]=i.useState(null);i.useEffect(()=>{if(!g)return;const c=()=>f(t.current?.debugInfo()??null);c();const C=setInterval(c,Me);return()=>clearInterval(C)},[g,a,t]);const k=()=>{const c=!g;j(c),ce(U,c?"on":"off")};return r.jsxs(Te,{children:[r.jsxs(Ye,{type:"button",onClick:k,children:[r.jsx("span",{children:"3D debug"}),r.jsx("span",{children:g?"−":"+"})]}),g&&r.jsx(Be,{children:e?r.jsxs(r.Fragment,{children:[r.jsx(I,{title:"weapon",rows:[["slug",d(e.weapon.slug)],["defindex",d(u)],["category",d(e.weapon.category)],["variant",d(e.weapon.variant)],["legacy kit",q(e.weapon.legacyKit)],["model",d(e.weapon.model)],["meshes",`${e.weapon.meshes} (${e.weapon.paintedMeshes} painted)`],["tris",d(e.weapon.triangles)],["paint groups",d(e.weapon.paintGroups)],["stock slots",d(e.weapon.stockSlots.join(", "))],["sticker/charm",`${e.weapon.stickerSlots} / ${q(e.weapon.supportsCharm)}`]]}),r.jsx(I,{title:"finish",copyAll:()=>({paintKitId:e.finish.paintKitId,float:e.finish.float,seed:e.finish.seed}),rows:[["paint kit",d(e.finish.paintKitId),e.finish.paintKitId],["skin",d(b)],["kit name",d(e.finish.name)],["generation",d(e.finish.generation)],["style",d(e.finish.paintStyle)],["float",x(e.finish.float,4),e.finish.float],["seed",`${d(e.finish.seed)}${e.finish.seedPlacesPattern?"":" (noise only)"}`],["wear mask",d(e.finish.wearMask)]]}),r.jsx(I,{title:"camera",copyAll:()=>({azimuth:e.camera.azimuth,elevation:e.camera.elevation,distance:e.camera.distance,target:e.camera.target,fov:e.camera.fov,roll:0}),rows:[["pos xyz",v(e.camera.position),e.camera.position],["rot xyz°",v(e.camera.rotation,1),e.camera.rotation],["target",v(e.camera.target),e.camera.target],["distance",x(e.camera.distance),e.camera.distance],["azim/elev°",`${x(e.camera.azimuth,1)}  ${x(e.camera.elevation,1)}`,[e.camera.azimuth,e.camera.elevation]],["fov/aspect",`${x(e.camera.fov,1)}  ${x(e.camera.aspect,3)}`,e.camera.fov],["preset",`${d(e.view.preset)}${e.view.userMoved?" (moved)":""}`]]}),r.jsx(I,{title:"model",rows:[["rot xyz°",v(e.model.rotation,1),e.model.rotation],["scale",v(e.model.scale,3),e.model.scale],["size",v(e.model.size),e.model.size],["center",v(e.model.center),e.model.center]]}),r.jsx(I,{title:"render",rows:[["canvas",`${x(e.render.width,0)}×${x(e.render.height,0)} @${x(e.render.pixelRatio,1)}`],["draws/tris",`${e.render.calls} / ${e.render.triangles}`],["geo/tex/prg",`${e.render.geometries} / ${e.render.textures} / ${e.render.programs}`]]}),r.jsx(I,{title:"accessories",copyAll:()=>({stickers:Object.fromEntries(e.stickers.map(c=>[c.id,Q(c)])),charm:J(e.charm)}),rows:[...e.stickers.map(c=>[`slot ${c.id}`,`#${c.stickerId} ${v(c.offset,3)} ${x(c.rotation,1)}° w${x(c.wear,2)}`,Q(c)]),["charm",e.charm?`#${e.charm.id} ${e.charm.offset?v(e.charm.offset):"default"}`:"—",J(e.charm)],["hover/sel",`${d(e.hovered?.kind)}${e.hovered?.id==null?"":` ${e.hovered.id}`} / ${d(e.selected?.kind)}${e.selected?.id==null?"":` ${e.selected.id}`}`]]})]}):r.jsx(ee,{children:r.jsxs(te,{children:[r.jsx(ne,{children:"status"}),r.jsx(oe,{children:d(a)})]})})})]})},Ge=y.div`
95    position: absolute;
96    inset: 0;
97    display: flex;
98    align-items: center;
99    justify-content: center;
100    color: #7f8eaa;
101    font-size: 13px;
102    font-weight: 500;
103`,He=()=>r.jsx(Ge,{children:r.jsx(le,{})}),Xe=y.div`
104    position: relative;
105    width: 100%;
106    height: 100%;
107    overflow: hidden;
108
109    canvas {
110        display: block;
111        outline: none;
112        touch-action: none;
113        width: 100%;
114        height: 100%;
115    }
116`,Z=y.div`
117    position: absolute;
118    inset: 0;
119    display: flex;
120    flex-direction: column;
121    align-items: center;
122    justify-content: center;
123    gap: 10px;
124    color: #7f8eaa;
125    font-size: 13px;
126    font-weight: 500;
127    pointer-events: ${({$interactive:t})=>t?"auto":"none"};
128
129    button {
130        padding: 6px 16px;
131        border-radius: 6px;
132        background: rgba(93, 108, 146, 0.32);
133        color: #d3ddeb;
134        font-size: 13px;
135        transition: background 0.2s ease;
136
137        &:hover {
138            background: rgba(93, 108, 146, 0.5);
139        }
140    }
141`,nt=()=>{const{t}=Le(),a=Ne(),u=m(de),b=m(fe),g=m(pe),j=m(ue),e=m(he),f=m(me),k=m(ge),c=m(xe),C=m(we),F=m(ye),h=m(be),N=m(n=>ke(n,h)),L=m(ve).isForeignSkin,K=i.useRef(null),p=i.useRef(null),[E,$]=i.useState("booting"),[re,se]=i.useState(0),D=u?.itemdefindex,M=u?.paint_kit??0,T=!!u?.is_csgo_legacy,Y=i.useMemo(()=>{const n=f?.[1],l=o=>{const s=f?.[o];return!n||!s||!s.step?null:[(s.x-n.x)*s.step,(s.y-n.y)*s.step]};return Se(j,e,f).map(o=>{const s=je(o.stickerId,0);return s?{id:o.id,stickerId:o.stickerId,url:s,offsetX:o.offset_x||0,offsetY:o.offset_y||0,rotation:Ee(o.rotation||0),wear:o.quality,editorBaseDelta:l(o.id),locked:k?.[o.id]===!0}:null}
141).filter(Boolean)},[j,e,f,k]);i.useEffect(()=>{let n=!1;return(async()=>{const o=K.current;if(o){$("booting");try{const{WeaponViewer:s}=await Ce(async()=>{const{WeaponViewer:_}=await import("./scene-B4-Fy7Q9.js");return{WeaponViewer:_}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]));if(n||!K.current)return;const S=o.parentElement.getBoundingClientRect();p.current=new s(o,{orbit:!0,size:{width:Math.max(1,S.width),height:Math.max(1,S.height)}}),$("idle")}catch(s){if(n)return;console.error("[skin3d] init failed",s),$("error")}}})(),()=>{n=!0,p.current?.dispose(),p.current=null}},[re]),i.useEffect(()=>{const n=K.current;if(!n?.parentElement)return;const l=new ResizeObserver(([o])=>{const{width:s,height:S}=o.contentRect;s&&S&&p.current?.setSize(s,S)});return l.observe(n.parentElement),()=>l.disconnect()},[E]);const w=E!=="booting"&&E!=="error";i.useEffect(()=>{const n=p.current;if(!w||!n||!D)return;let l=!1;return $("loading"),(async()=>{try{if(await n.setWeapon({itemdefindex:D,legacy:T}),l||(await n.setFinish({paintKitId:M,float:b,seed:g}),l)||(await n.stickersSettled(),l)||(await n.charmSettled(),l))return;$("idle")}catch(o){if(l)return;console.error("[skin3d] load failed",o),$("error")}})(),()=>{l=!0}},[w,D,M,T]),i.useEffect(()=>{p.current?.setFloat(b)},[b]),i.useEffect(()=>{p.current?.setSeed(g)},[g]),i.useEffect(()=>{w&&p.current?.setStickers(Y)},[Y,w]),i.useEffect(()=>{w&&p.current?.setCharm(c?{id:c,offset:C,seed:F}:null)},[c,C,F,w]),i.useEffect(()=>{w&&p.current?.setSelection(h==null?null:h===A.KEYCHAIN_INDEX?{kind:"charm",id:null}:{kind:"sticker",id:h})},[h,w]);const B=i.useCallback(({kind:n,id:l})=>{a($e(n==="charm"?A.KEYCHAIN_INDEX:l))},[a]),V=i.useCallback(({id:n,offsetX:l,offsetY:o})=>{const s=f?.[n];s?.step&&a(H(n,X({id:n,x:s.x+l/s.step,y:s.y+o/s.step,rotation:e?.[n]?.rotation??0})))},[a,f,e]),W=i.useCallback(n=>a(Ie(n)),[a]);i.useEffect(()=>{if(h==null||N||L)return;const n=h!==A.KEYCHAIN_INDEX,l=o=>{if(o.target.tagName==="INPUT")return;if(Ke.includes(o.key)){o.preventDefault(),a(_e(h));return}if(!n)return;if(Pe.includes(o.code)&&(o.ctrlKey||o.metaKey)){o.preventDefault(),a(Oe());return}const s=Re[o.code.toLowerCase()]||0,[S,_]=ze[o.code.toLowerCase()]||[0,0];if(!s&&!S&&!_)return;o.preventDefault();const P=e?.[h]||f?.[h];if(!P)return;const z=o.shiftKey?Ae.KEYBOARD_MOVES_SHIFT_MULTIPLIER:1;a(H(h,X({id:h,x:P.x+S*z,y:P.y+_*z,rotation:(P.rotation??0)+s*z})))};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[h,N,L,e,f,a]),i.useEffect(()=>{const n=p.current;if(!(!w||!n))return n.onSelect=B,n.onStickerPlaced=V,n.onCharmPlaced=W,()=>{p.current&&(p.current.onSelect=null,p.current.onStickerPlaced=null,p.current.onCharmPlaced=null)}},[w,B,V,W]);const R=!!Fe(D),G=E==="booting"||E==="loading",ie=i.useMemo(()=>De(),[]);return r.jsxs(Xe,{children:[r.jsx("canvas",{ref:K,style:{visibility:G?"hidden":"visible"}}),!R&&r.jsx(Z,{children:t("skinchanger.3d.unsupported","3D preview is not available for this item")}),ie&&r.jsx(We,{viewerRef:p,status:E,itemdefindex:D,skinName:u?.name}),R&&G&&r.jsx(He,{}),R&&E==="error"&&r.jsxs(Z,{$interactive:!0,children:[t("skinchanger.3d.error","Could not load the 3D preview"),r.jsx("button",{type:"button",onClick:()=>se(n=>n+1),children:t("common.retry","Retry")})]})]})};export{nt as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.