PageSourceSearch

https://paper2gal.com/assets/Character-B0Yj0W_Y.js

js paper2gal.com collected 2026-10-09 22:39:28 UTC 5,150 bytes, 7 lines download raw bytes

1import{r as u,j as b}from"./react-vendor-CHQL15iE.js";import{f as W,j as Y,h as g,p as k,c as z}from"./main-Dck1T9BT.js";import{r as J}from"./characterPerformance-Dba8tDt6.js";import{a as K,r as H,G as P,L as Q,g as X}from"./gameCharacterLayout-CKtvG8H9.js";import"./lucide-BFLOpGdB.js";import"./pdfjs-ji3DqnKJ.js";import"./markdown-W-rE_H7s.js";import"./katex-math-BxKHCrdI.js";const v=()=>new DOMException("Image load aborted","AbortError"),Z=(r,n)=>new Promise((t,e)=>{if(n!=null&&n.aborted)return e(v());const o=setTimeout(t,r);n==null||n.addEventListener("abort",()=>{clearTimeout(o),e(v())},{once:!0})}),M=(r,n)=>{try{const t=new URL(n),e=new URL(r,t);return/^https?:$/.test(e.protocol)&&e.origin===t.origin}catch{return!1}},tt=(r,n)=>{const t=r.indexOf("#"),e=t>=0?r.slice(0,t):r,o=t>=0?r.slice(t):"";return`${e}${e.includes("?")?"&":"?"}p2g_retry=${encodeURIComponent(n)}${o}`},et=(r,n,t,e)=>new Promise((o,f)=>{if(e!=null&&e.aborted)return f(v());const s=t();let E=!1;const m=i=>{E||(E=!0,s.onload=null,s.onerror=null,e==null||e.removeEventListener("abort",c),i())},c=()=>m(()=>f(v()));s.decoding="async",s.onload=async()=>{try{if(typeof s.decode=="function"&&await s.decode(),e!=null&&e.aborted)throw v();if(s.naturalWidth<=0||s.naturalHeight<=0)throw new Error("Image has no decoded pixels");m(()=>o({sourceUrl:r,displayUrl:n,width:s.naturalWidth,height:s.naturalHeight}))}catch(i){m(()=>f(i))}},s.onerror=()=>m(()=>f(new Error(`Image load failed: ${r}`))),e==null||e.addEventListener("abort",c,{once:!0}),s.src=n}),rt=async(r,n={})=>{const{signal:t,attempts:e=3,retryDelayMs:o=250,createImage:f=()=>new Image,retryToken:s=()=>`${Date.now()}-${Math.random().toString(36).slice(2)}`,baseUrl:E=typeof window>"u"?"http://localhost/":window.location.href}=n,m=Math.max(1,Math.floor(e));let c=new Error(`Image load failed: ${r}`);for(let i=0;i<m;i+=1){if(t!=null&&t.aborted)throw v();const L=i>0&&M(r,E)?tt(r,`${s()}-${i}`):r;try{return await et(r,L,f,t)}catch(d){if(t!=null&&t.aborted||d instanceof DOMException&&d.name==="AbortError")throw d;c=d,i+1<m&&o>=0&&await Z(o,t)}}throw c},mt=({emotion:r,visible:n,characterId:t,customCharacters:e=[],charMetadata:o,defaultSkinId:f,shiftLeft:s=!1,voiceAudio:E=null,action:m="none",actionKey:c})=>{var B;const{chars:i}=W(),[F,L]=u.useState(!1),[d,_]=u.useState(null),[O,I]=u.useState({key:void 0,action:"none"}),w=u.useRef(null),S=J(m,{hasBlackboard:s}),V=n&&Object.is(O.key,c)&&O.action===S?O.action:"none";let p=((B=i[0])==null?void 0:B.avatarUrl)??"";const A=i.find(a=>a.id===t),y=e.find(a=>a.id===t),h=Y(A||y||o,!!A),U=!!(h!=null&&h.modelUrl)&&!F,N=X(t,U),T=K(t,f||(o==null?void 0:o.defaultSkinId)),l=(y==null?void 0:y.layout)||(o==null?void 0:o.layout),[j,R]=u.useState(()=>H(T,l));u.useEffect(()=>{L(!1)},[t,h==null?void 0:h.modelUrl]),u.useEffect(()=>{if(w.current!==null&&(window.cancelAnimationFrame(w.current),w.current=null),I({key:c,action:"none"}),!(!n||S==="none"))return w.current=window.requestAnimationFrame(()=>{w.current=null,I({key:c,action:S})}),()=>{w.current!==null&&(window.cancelAnimationFrame(w.current),w.current=null)}},[c,t,S,n]),u.useEffect(()=>{R(H(T,l));const a=x=>{const $=x.detail;($==null?void 0:$.layoutKey)===T&&$.layout&&R($.layout)};return window.addEventListener(P,a),()=>window.removeEventListener(P,a)},[T,l==null?void 0:l.x,l==null?void 0:l.y,l==null?void 0:l.scale]);const q=u.useCallback(()=>{L(!0)},[]);if(A){const a=g(A,f||(o==null?void 0:o.defaultSkinId));p=k(a==null?void 0:a.expressions,r,(a==null?void 0:a.avatarUrl)||A.avatarUrl)}else y?p=k(y.expressions,r,y.avatarUrl):o&&(p=k(o.expressions,r,o.avatarUrl));const D=z(p);u.useEffect(()=>{if(!p||U||D)return;const a=new AbortController;return rt(p,{signal:a.signal}).then(x=>_({...x,characterId:t})).catch(x=>{x instanceof DOMException&&x.name==="AbortError"||console.warn("Character sprite load failed:",p,x)}),()=>a.abort()},[t,D,p,U]);const C=(d==null?void 0:d.characterId)===t?d:null,G=(C?C.height/C.width>=1.9:!1)&&N.boostTallSprite?{transform:"translateY(6%) scale(1.2)",transformOrigin:"bottom center"}:void 0;return b.jsx("div",{className:`
2        absolute transform -translate-x-1/2 max-w-[50%] transition-[left] duration-700 ease-out z-20 
3        ${s?"left-[30%]":"left-1/2"}
4        ${n?"opacity-100 translate-y-0":"opacity-0 translate-y-20"}
5        w-[min(50vw,720px)]
6        ${N.frameClass}
7      `,style:{filter:"drop-shadow(0 0 15px rgba(255, 255, 255, 0.3))"},children:b.jsx("div",{className:"relative h-full transition-transform duration-500",style:{transform:`translate3d(${j.x}px, ${j.y}px, 0) scale(${j.scale})`,transformOrigin:"bottom center"},children:b.jsx("div",{className:"character-performance-motion h-full w-full","data-character-action":V,children:U&&h?b.jsx(Q,{config:h,emotion:r,mouthAudio:E,onError:q}
7):D?b.jsx("video",{src:p,autoPlay:!0,loop:!0,muted:!0,playsInline:!0,className:"h-full w-auto object-contain transition-all duration-500 ease-in-out",style:G,"aria-label":`${t} - ${r}`}):C?b.jsx("img",{src:C.displayUrl,alt:`${t} - ${r}`,className:"h-full w-full object-contain transition-all duration-500 ease-in-out",style:G}):null})})})};export{mt 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.