@alwith/module-auth 0.1.9 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-w1z1g5c5.js → chunk-01py4vpp.js} +2 -2
- package/dist/chunk-1agdfzjz.js +2 -0
- package/dist/{chunk-4xk0z8t0.js → chunk-1mwjz4f1.js} +1 -1
- package/dist/chunk-1sf9m7x2.js +2 -0
- package/dist/{chunk-7xtvv8a7.js → chunk-2j5re92x.js} +2 -2
- package/dist/{chunk-npcgz51c.js → chunk-38vgcbpq.js} +2 -2
- package/dist/{chunk-21abksd2.js → chunk-3amxesw3.js} +1 -1
- package/dist/{chunk-vz0m347h.js → chunk-3q1e1ksh.js} +1 -1
- package/dist/{chunk-2aq8zkwb.js → chunk-3rpgxz1z.js} +2 -2
- package/dist/{chunk-44at74bw.js → chunk-41jxjz9n.js} +2 -2
- package/dist/{chunk-my19acdk.js → chunk-4mwvph27.js} +2 -2
- package/dist/chunk-5zpeb8cj.js +2 -0
- package/dist/{chunk-yjdj2mf9.js → chunk-6f02m6jw.js} +2 -2
- package/dist/{chunk-70nb6x0r.js → chunk-6t0bw1wy.js} +2 -2
- package/dist/{chunk-wcenmfkf.js → chunk-7pdpmxg2.js} +1 -1
- package/dist/{chunk-hk9j0kvg.js → chunk-7y7stqn0.js} +2 -2
- package/dist/chunk-8nzgysac.js +2 -0
- package/dist/{chunk-9tramdds.js → chunk-ax8zmvs0.js} +2 -2
- package/dist/chunk-b7v6g7a0.js +2 -0
- package/dist/{chunk-8xd6kn1b.js → chunk-bcyk6es8.js} +2 -2
- package/dist/{chunk-4h2756zy.js → chunk-ctvwa8d3.js} +2 -2
- package/dist/{chunk-1hxexf7n.js → chunk-d4ezh3c4.js} +2 -2
- package/dist/{chunk-sp65sdp3.js → chunk-e20z911q.js} +1 -1
- package/dist/chunk-enze3bpk.js +2 -0
- package/dist/{chunk-38y9615y.js → chunk-f0awr1g7.js} +2 -2
- package/dist/{chunk-z5nmdjb9.js → chunk-g8nah79y.js} +1 -1
- package/dist/{chunk-5w675j2g.js → chunk-gq64get1.js} +2 -2
- package/dist/{chunk-jjb1befc.js → chunk-gv5he3xg.js} +2 -2
- package/dist/{chunk-2skzpxsk.js → chunk-h994ssre.js} +1 -1
- package/dist/chunk-hscsc9kx.js +2 -0
- package/dist/{chunk-mandqn4e.js → chunk-j2922k42.js} +2 -2
- package/dist/{chunk-g47n16v3.js → chunk-jampyjt1.js} +2 -2
- package/dist/{chunk-2x5tzfgv.js → chunk-jppe84sk.js} +2 -2
- package/dist/chunk-kqsxaxk8.js +2 -0
- package/dist/{chunk-0ze5xzg5.js → chunk-m3e7wah7.js} +2 -2
- package/dist/{chunk-p1ywvmqa.js → chunk-mfrnyj0b.js} +2 -2
- package/dist/{chunk-5jz8vnk5.js → chunk-mjsqb1wk.js} +1 -1
- package/dist/{chunk-mmj02855.js → chunk-nbfhs21c.js} +2 -2
- package/dist/{chunk-1mq984ah.js → chunk-pe1mn10v.js} +2 -2
- package/dist/{chunk-m18rjmg2.js → chunk-pwsarey8.js} +2 -2
- package/dist/{chunk-37ctfsy1.js → chunk-qd5jhh2h.js} +1 -1
- package/dist/{chunk-xs0abxzp.js → chunk-qy364wgy.js} +1 -1
- package/dist/chunk-rfxpf1eq.js +2 -0
- package/dist/{chunk-wbvah1ty.js → chunk-rrhhytq1.js} +1 -1
- package/dist/{chunk-0x7ssxpn.js → chunk-t6snsees.js} +1 -1
- package/dist/{chunk-zhbj6cm5.js → chunk-t858h8ch.js} +2 -2
- package/dist/{chunk-2k8my1h9.js → chunk-tvmvzc41.js} +2 -2
- package/dist/{chunk-9zhxpvxw.js → chunk-v5akzbxg.js} +2 -2
- package/dist/{chunk-jf6z5rh7.js → chunk-v890qhc2.js} +1 -1
- package/dist/chunk-vt1sfk87.js +2 -0
- package/dist/chunk-wa475kmq.js +2 -0
- package/dist/{chunk-0gf7vwzk.js → chunk-wfsdbf7j.js} +2 -2
- package/dist/chunk-x61q358n.js +2 -0
- package/dist/{chunk-vnnyvrrd.js → chunk-zar89jcs.js} +2 -2
- package/dist/{chunk-vr4ye1z4.js → chunk-zkwggfj2.js} +2 -2
- package/dist/pets/assets.js +1 -1
- package/dist/pets/core/engine.js +1 -1
- package/dist/pets/core/index.js +1 -1
- package/dist/pets/core/lib/account-state.js +1 -1
- package/dist/pets/core/lib/bubble-outline.js +1 -1
- package/dist/pets/core/lib/draw-result.js +1 -1
- package/dist/pets/core/lib/endpoints.js +1 -1
- package/dist/pets/core/lib/gacha-pools.js +1 -1
- package/dist/pets/core/lib/pet-drag.js +1 -1
- package/dist/pets/core/lib/rarity.js +1 -1
- package/dist/pets/core/lib/recharge.js +1 -1
- package/dist/pets/core/lib/resource-sync.js +1 -1
- package/dist/pets/core/lib/settings.js +1 -1
- package/dist/pets/core/lib/vibemon-resources.js +1 -1
- package/dist/pets/core/lib/view-request.js +1 -1
- package/dist/pets/core/lib/window-frame.js +1 -1
- package/dist/pets/core/session-icon.js +1 -1
- package/dist/pets/core/types.js +1 -1
- package/dist/pets/index.js +1 -1
- package/dist/pets/react/assets.js +1 -1
- package/dist/pets/react/components/album-view.js +1 -1
- package/dist/pets/react/components/back-to-home.js +1 -1
- package/dist/pets/react/components/equip-view.js +1 -1
- package/dist/pets/react/components/gem-balance.js +1 -1
- package/dist/pets/react/components/home-view.js +1 -1
- package/dist/pets/react/components/insufficient-points-dialog.js +1 -1
- package/dist/pets/react/components/intro-overlay.js +1 -1
- package/dist/pets/react/components/loading-view.js +1 -1
- package/dist/pets/react/components/onboarding-guide.js +1 -1
- package/dist/pets/react/components/pet-bubble-background.js +1 -1
- package/dist/pets/react/components/pet-lounge.js +1 -1
- package/dist/pets/react/components/pet-mode-button.js +1 -1
- package/dist/pets/react/components/pet-window.js +1 -1
- package/dist/pets/react/components/pull-overlay.js +1 -1
- package/dist/pets/react/components/pull-video.js +1 -1
- package/dist/pets/react/components/pull-view.js +1 -1
- package/dist/pets/react/components/quick-reply.js +1 -1
- package/dist/pets/react/components/session-icon.js +1 -1
- package/dist/pets/react/components/single-pet-toast.js +1 -1
- package/dist/pets/react/components/sprite-renderer.js +1 -1
- package/dist/pets/react/components/vibemon-empty-state.js +1 -1
- package/dist/pets/react/components/vibemon-header.js +1 -1
- package/dist/pets/react/components/vibemon-page.js +1 -1
- package/dist/pets/react/components/video-fader.js +1 -1
- package/dist/pets/react/components/wish-button.js +1 -1
- package/dist/pets/react/index.js +1 -1
- package/dist/pets/react/lib/account-state.js +1 -1
- package/dist/pets/react/lib/card-image.js +1 -1
- package/dist/pets/react/lib/resource-sync.js +1 -1
- package/dist/pets/react/lib/season.js +1 -1
- package/dist/pets/react/lib/use-season.js +1 -1
- package/dist/pets/react/ui/button.js +1 -1
- package/dist/pets/react/ui/card.js +1 -1
- package/dist/pets/react/ui/input-group.js +1 -1
- package/dist/pets/react/ui/textarea.js +1 -1
- package/dist/pets/resource-package.js +1 -1
- package/dist/pets/resources.js +1 -1
- package/dist/pets/selection.js +1 -1
- package/package.json +3 -2
- package/dist/chunk-14dfwbk0.js +0 -2
- package/dist/chunk-5v4zm9s3.js +0 -2
- package/dist/chunk-8kcmwm3k.js +0 -2
- package/dist/chunk-9wqfns8y.js +0 -2
- package/dist/chunk-bgc7s9q5.js +0 -2
- package/dist/chunk-fkj53yw2.js +0 -2
- package/dist/chunk-hj17ea3j.js +0 -2
- package/dist/chunk-j3ez3fz2.js +0 -2
- package/dist/chunk-mnrtrr2j.js +0 -2
- package/dist/chunk-ms8jh9xz.js +0 -2
- package/dist/chunk-nbzm95mz.js +0 -2
- package/dist/chunk-q8ebj5e6.js +0 -2
- package/dist/chunk-vsxgxkg5.js +0 -0
- package/dist/pets/react/components/pet-lounge.css +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{e}from"./chunk-htw56xtp.js";var n={"vibemon.accounts":{},"vibemon.introSeen":{},"vibemon.albumHasUnseen":{},"vibemon.onboardingStep":{}},s=new Set,r=0;async function w(){let t=++r,o=e(),a=await Promise.all(Object.keys(n).map(async(i)=>[i,await o.storage.get(i)??{}]));if(r!==t)return;n=Object.fromEntries(a);for(let i of s)i()}async function
|
|
2
|
-
export{w,
|
|
1
|
+
import{e}from"./chunk-htw56xtp.js";var n={"vibemon.accounts":{},"vibemon.introSeen":{},"vibemon.albumHasUnseen":{},"vibemon.onboardingStep":{}},s=new Set,r=0;async function w(){let t=++r,o=e(),a=await Promise.all(Object.keys(n).map(async(i)=>[i,await o.storage.get(i)??{}]));if(r!==t)return;n=Object.fromEntries(a);for(let i of s)i()}async function Kt(){let t=e().subscribeStorage(()=>{w().catch(e().onError)});return await w(),()=>{r++,t()}}var Nt=(t)=>(s.add(t),()=>{s.delete(t)}),u=(t)=>n[t],be=(t)=>Promise.resolve(n[t]);function Mt(t,o){r++,n={...n,[t]:o};for(let a of s)a()}async function R(t,o){await e().storage.set(t,o),await w()}
|
|
2
|
+
export{w,Kt,Nt,u,be,Mt,R};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t}from"./chunk-
|
|
1
|
+
import{t}from"./chunk-mjsqb1wk.js";import{LoaderCircleIcon as a,Minimize2Icon as i}from"lucide-react";import{useTranslation as s}from"react-i18next";import{jsxDEV as o}from"react/jsx-dev-runtime";function $t({busy:e,onClick:r}){let{t:n}=s("common");return o(t,{variant:"ghost",size:"icon-xs",title:n("petMode.enter"),"aria-label":n("petMode.enter"),disabled:e,onClick:r,className:"group text-muted-foreground hover:text-muted-foreground shrink-0 hover:bg-transparent dark:hover:bg-transparent",children:e?o(a,{className:"size-4 animate-spin"},void 0,!1,void 0,this):o(i,{className:"size-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}
|
|
2
2
|
export{$t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{SolarTime as s}from"tyme4ts";var u={立春:"spring",雨水:"spring",惊蛰:"spring",春分:"spring",清明:"spring",谷雨:"spring",立夏:"summer",小满:"summer",芒种:"summer",夏至:"summer",小暑:"summer",大暑:"summer",立秋:"autumn",处暑:"autumn",白露:"autumn",秋分:"autumn",寒露:"autumn",霜降:"autumn",立冬:"winter",小雪:"winter",大雪:"winter",冬至:"winter",小寒:"winter",大寒:"winter"},o={spring:"autumn",summer:"winter",autumn:"spring",winter:"summer"};function
|
|
2
|
-
export{
|
|
1
|
+
import{SolarTime as s}from"tyme4ts";var u={立春:"spring",雨水:"spring",惊蛰:"spring",春分:"spring",清明:"spring",谷雨:"spring",立夏:"summer",小满:"summer",芒种:"summer",夏至:"summer",小暑:"summer",大暑:"summer",立秋:"autumn",处暑:"autumn",白露:"autumn",秋分:"autumn",寒露:"autumn",霜降:"autumn",立冬:"winter",小雪:"winter",大雪:"winter",冬至:"winter",小寒:"winter",大寒:"winter"},o={spring:"autumn",summer:"winter",autumn:"spring",winter:"summer"};function ke(n=new Date,m="north"){let e=new Date(n.getTime()+28800000),t=s.fromYmdHms(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds()).getTerm().getName(),r=u[t];if(!r)throw Error(`Unknown solar term: ${t}`);return m==="south"?o[r]:r}
|
|
2
|
+
export{ke};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{e}from"./chunk-htw56xtp.js";import{Bt,
|
|
2
|
-
export{
|
|
1
|
+
import{e}from"./chunk-htw56xtp.js";import{Bt,Ut,Dt}from"./chunk-f0awr1g7.js";import{useEffect as k,useEffectEvent as q,useState as x}from"react";import{jsxDEV as O}from"react/jsx-dev-runtime";var F=Promise.resolve();function d(c){let u=F,r;F=new Promise((n)=>{r=n}),(async()=>{await u;try{await c()}finally{r()}})()}function He({cardRef:c,opacity:u=0.65,radius:r=20,enabled:n=!0}){let t=e(),[B,R]=x([]),N=q(()=>{d(async()=>{await t.windows.call("bubble-blur",{enabled:!1,radius:1,path:null}).catch(t.onError)})});return k(()=>()=>N(),[]),k(()=>{let o=c.current;if(o===null)throw Error("Pet bubble background requires its card");let z={scaleFactor:()=>t.windows.call("scale")},b=!1,l=null,m=null,p=async()=>{if(b)return;let a=await z.scaleFactor();if(b)return;let i=o.getBoundingClientRect();if(i.width<=1||i.height<=1)return;let S=getComputedStyle(o),h=Number.parseFloat(S.borderTopLeftRadius);if(!Number.isFinite(h))throw Error("Pet bubble corner radius must resolve to pixels");let v=o.parentElement;if(v===null)throw Error("Pet bubble card requires its container");let g=Number.parseFloat(getComputedStyle(v).paddingBottom);if(!Number.isFinite(g))throw Error("Pet bubble tail spacing must resolve to pixels");let y=Bt(i.left+0.5,i.top+0.5,i.width-1,i.height-1,h-0.5,g);R(y);let E=n?Dt(y,window.devicePixelRatio/a):null,P=JSON.stringify([n,r,E]);if(P===m)return;await t.windows.call("bubble-blur",{enabled:n,radius:r,path:E}),m=P},s=()=>{if(b||l!==null)return;l=requestAnimationFrame(()=>{l=null,d(()=>p().catch(t.onError))})};d(()=>p().catch(t.onError));let f=new ResizeObserver(s);f.observe(o);let w=new MutationObserver(s);for(let a of[document.documentElement,document.body,o])w.observe(a,{attributes:!0,attributeFilter:["class","style"]});window.addEventListener("resize",s);let C=t.windows.geometry(s);return()=>{if(b=!0,l!==null)cancelAnimationFrame(l);f.disconnect(),w.disconnect(),window.removeEventListener("resize",s),C.then((a)=>a()).catch(t.onError)}},[c,n,r,t]),O("svg",{"aria-hidden":!0,"data-pet-bubble-background":!0,className:"pointer-events-none fixed inset-0 size-full overflow-visible",children:O("path",{d:Ut(B),fill:"var(--popover)",fillOpacity:u,stroke:"var(--border)",strokeOpacity:u,strokeWidth:1},void 0,!1,void 0,this)},void 0,!1,void 0,this)}
|
|
2
|
+
export{He};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n}from"./chunk-rerywpwe.js";import{m}from"./chunk-4gegjx79.js";import{y,ie,se,Pe,
|
|
1
|
+
import{n}from"./chunk-rerywpwe.js";import{m}from"./chunk-4gegjx79.js";import{y,ie,se,Pe,k,_e,qt}from"./chunk-nbfhs21c.js";var O=new TextEncoder,N=new TextDecoder;function re(r,d){let w=d.resource_package_format??0;return(r.format??0)===w&&r.version===(d.resource_version??null)&&(r.sourceUrl===void 0?w===0:r.sourceUrl===(w===1?d.resource_url:d.sheet_url))}function xe(r){let d=!1,w=new Map,S=new Map,M=new Map,R=new Map,E=new Set,A=Promise.resolve();function U(e){if(d)throw Error("Vibemon resources disposed");let s=r.account();if(s===null)throw Error("Sign in to load Vibemon resources");if(!/^[a-zA-Z0-9_-]+$/.test(e)||!/^[a-zA-Z0-9.-]+$/.test(s.apiHost))throw Error("Invalid resource identity");return`vibemon/catalog/${s.apiHost}/${e}`}function I(e){let s=r.account();if(s===null)return Promise.reject(Error("Sign in to load Vibemon resources"));let t=`${U(e)}/${s.userId}/${s.revision}`,i=S.get(t);if(i)return i;let o=H(e).finally(()=>{if(S.get(t)===o)S.delete(t)});return S.set(t,o),o}async function H(e){let s=r.account();if(s===null)throw Error("Sign in to load Vibemon resources");let t=U(e),i=await r.resources.read(`${t}/resource.json`);if(i===null){for(let l of[t,`vibemon/${s.apiHost}/${s.userId}/${e}`]){let f=await r.resources.read(`${l}/config.json`);if(f===null)continue;let a=JSON.parse(N.decode(f));if(!/^sprite-sheet\.(webp|png)$/.test(a.spritesheet))throw Error("Invalid legacy sprite filename");let v=m(JSON.stringify({frameWidth:a.frameSize,frameHeight:a.frameSize,states:a.states}));if(await r.resources.exists(`${l}/${a.spritesheet}`)){let b=await r.storage.get("vibemon.resourceVersion");return n(r,s),{directory:l,sheetName:a.spritesheet,layout:v,version:b?.[s.apiHost]?.[e]??0,config:a}}}return null}let o;try{o=JSON.parse(N.decode(i))}catch{return null}if(!o||o.format!==void 0&&o.format!==0&&o.format!==1)return null;if(o.format===1)try{let l=await r.resources.read(`${t}/manifest.json`),f=await r.resources.read(`${t}/resource.zip`);if(!l||!f||await se(f)!==o.archiveSha256)return null;let a=Pe(l),v=await _e(a,(b)=>r.resources.read(`${t}/${b}`));return n(r,s),{...o,directory:t,manifest:a,layout:v,sheetName:a.assets.sheet?.path??null}}catch{return n(r,s),null}let c=JSON.parse(N.decode(i));if(m(JSON.stringify(c.layout)),!/^sprite-sheet\.(webp|png)$/.test(c.sheet))throw Error("Invalid sprite filename");let u=await r.resources.exists(`${t}/${c.sheet}`);n(r,s);let h=await r.resources.read(`${t}/config.json`);return n(r,s),!u?null:{directory:t,sheetName:c.sheet,name:c.name,layout:c.layout,version:c.version,format:0,sourceUrl:o.sourceUrl,config:h===null?void 0:JSON.parse(N.decode(h))}}async function L(e){let s=r.account();if(s===null)throw Error("Sign in to load Vibemon resources");let t=await I(e);if(t===null)return null;if(t.sheetName===null)return{...t,sheet:null};let i=await r.resources.read(`${t.directory}/${t.sheetName}`);return n(r,s),i===null?null:{...t,sheet:i}}function J(e){let s=r.account();if(s===null)return Promise.reject(Error("Sign in to download Vibemon resources"));if(e.resource_package_format!=null&&(!Number.isInteger(e.resource_package_format)||e.resource_package_format<0))return Promise.reject(Error("Invalid Vibemon resource format"));if(e.resource_version!=null&&(!Number.isInteger(e.resource_version)||e.resource_version<0))return Promise.reject(Error("Invalid Vibemon resource version"));let t=U(e.uuid),i=JSON.stringify([s.revision,e.resource_package_format??0,e.resource_version??null,e.resource_url,e.sheet_url,e.layout]),o=w.get(t);if(o?.key===i)return o.work;let c=(M.get(t)??0)+1;M.set(t,c);let u=()=>{if(n(r,s),d||M.get(t)!==c)throw Error("Vibemon resource request superseded")},l=(async()=>{await o?.work.catch(()=>{}),u();let f=await L(e.uuid);if(n(r,s),f!==null&&re(f,e))return{...f,name:e.name};let a=e.resource_package_format??0;if(a!==0&&a!==1)throw Error(`Unsupported Vibemon resource format: ${a}`);if(a===1&&!e.resource_url)throw Error("Vibemon package URL is missing");if(a===0&&(!e.sheet_url||!e.layout))throw Error("Vibemon animation is unavailable");let v=a===0?m(e.layout):null,b=new URL(a===1?e.resource_url:e.sheet_url);if(b.protocol!=="https:")throw Error("Vibemon sprites require HTTPS");let C=b.pathname.toLowerCase().endsWith(".png")?"sprite-sheet.png":"sprite-sheet.webp",_=new AbortController;E.add(_);let g=`${t}.${crypto.randomUUID()}.tmp`;try{let P=await r.download(b.href,_.signal);if(u(),a===1){let p=await qt(P,r.validateImage);u();for(let[D,T]of p.files)await r.resources.write(`${g}/${D}`,T);await r.resources.write(`${g}/resource.zip`,P);let V={directory:t,format:1,sourceUrl:e.resource_url,version:e.resource_version??null,name:e.name,manifest:p.manifest,layout:p.layout,sheetName:p.manifest.assets.sheet?.path??null,archiveSha256:await se(P)};return await r.resources.write(`${g}/resource.json`,O.encode(JSON.stringify(V))),u(),_.signal.throwIfAborted(),await r.resources.replace(g,t),{...V,sheet:V.sheetName?p.files.get(V.sheetName):null}}if(P.byteLength===0)throw Error("Empty Vibemon spritesheet");await r.resources.write(`${g}/${C}`,P),await r.resources.write(`${g}/resource.json`,O.encode(JSON.stringify({layout:v,version:e.resource_version??null,sheet:C,name:e.name,sourceUrl:e.sheet_url}))),n(r,s),_.signal.throwIfAborted(),u(),await r.resources.replace(g,t),n(r,s);let x=A.catch(()=>{}).then(async()=>{n(r,s);let p=await r.storage.get("vibemon.resourceVersion")??{};n(r,s),await r.storage.set("vibemon.resourceVersion",{...p,[s.apiHost]:{...p[s.apiHost],[e.uuid]:e.resource_version??0}})});return A=x,await x,n(r,s),{directory:t,sheetName:C,sheet:P,name:e.name,layout:v,version:e.resource_version??null,format:0,sourceUrl:e.sheet_url}}finally{E.delete(_),await r.resources.remove(g)}})().finally(()=>{if(w.get(t)?.work===l)w.delete(t)});return w.set(t,{key:i,generation:c,work:l}),l}async function z(e){if(e.format!==1||!e.manifest)return{};let s=e.manifest,t={};return await Promise.all(y.map(async(i)=>{let o=s.assets[i];if(!o){t[i]=null;return}if(!ie(o.path))throw Error("Invalid cached Vibemon path");if(r.resources.url)t[i]=`${await r.resources.url(`${e.directory}/${o.path}`)}?v=${o.sha256}`;else{let c=`${e.directory}/${o.sha256}`,u=R.get(c);if(!u){let h=await r.resources.read(`${e.directory}/${o.path}`);if(h===null)throw Error("Cached Vibemon image is missing");u=URL.createObjectURL(new Blob([new Uint8Array(h).buffer],{type:k(h).mime})),R.set(c,u)}t[i]=u}})),t}function j(){for(let e of E)e.abort();E.clear()}return{inspect:I,visuals:z,async preview(e){let s=e.manifest?.assets.cover??e.manifest?.assets.icon;return s?r.resources.read(`${e.directory}/${s.path}`):null},cached:L,ensure:J,cancel:j,dispose(){d=!0,j();for(let e of R.values())URL.revokeObjectURL(e);R.clear()}}}
|
|
2
2
|
export{re,xe};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{_}from"./chunk-d4ezh3c4.js";import{jsxDEV as e}from"react/jsx-dev-runtime";function le({name:n,icons:s}){return e("span",{"aria-hidden":!0,className:"inline-flex size-[18px] items-center justify-center",dangerouslySetInnerHTML:{__html:_(n,s)}},void 0,!1,void 0,this)}
|
|
2
2
|
export{le};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{s,
|
|
2
|
-
export{
|
|
1
|
+
import{s,U}from"./chunk-tvmvzc41.js";import{t}from"./chunk-mjsqb1wk.js";import{A,Ce}from"./chunk-pwsarey8.js";import{useLayoutEffect as f,useRef as p,useState as u}from"react";import{jsxDEV as n}from"react/jsx-dev-runtime";var d=1.778723404255319,g="#120E18",h={x1:0.3,x2:0.8,y1:0.56,y2:1},v=h.x2-h.x1,w=h.y2-h.y1,y=(h.x1+h.x2)/2,x=0.8;function S(e,a){let c=Math.max(e,a*d),l=Math.min(e/v,a/w*d),o=Math.max(Math.min(c,l),x*c),i=o/d,r=o<=e?(e-o)/2:Math.min(0,Math.max(e-o,e/2-y*o)),b=i<=a?(a-i)/2:a-i;return{width:o,height:i,left:r,top:b}}function E(e){let[a,c]=u({width:0,height:0,left:0,top:0});return f(()=>{let l=e.current;if(!l)return;let o=new ResizeObserver(([i])=>{let{width:r,height:b}=i.contentRect;c(S(r,b))});return o.observe(l),()=>o.disconnect()},[e]),a}var R={vibemon:{box:{left:"15.75%",top:"68.40%",width:"16.60%"},label:{left:"30.80%",top:"88.00%",width:"9.2%"}},wish:{box:{left:"50.40%",top:"58.40%",width:"14.50%"},label:{left:"54.00%",top:"84.50%",width:"6.8%"}},album:{box:{left:"75.80%",top:"64.65%",width:"20.20%"},label:{left:"74.60%",top:"73.20%",width:"7.2%"}}};function m({assetKey:e,onClick:a,highlighted:c,disabled:l}){let[o,i]=u(!1),r=R[e];return n("div",{className:`pointer-events-none absolute inset-0 ${c?"z-30":""}`,children:[n(t,{variant:"ghost",className:"pointer-events-auto absolute h-auto p-0 hover:bg-transparent dark:hover:bg-transparent",style:r.box,"aria-label":e==="vibemon"?"Vibémon":e==="wish"?"Wish":"Album",disabled:l,onClick:a,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:[n("img",{src:s[e].icon,alt:"",className:"block w-full select-none",style:{opacity:o?0:1}},void 0,!1,void 0,this),n("img",{src:s[e].hover,alt:"","aria-hidden":!0,className:"absolute inset-0 h-full w-full select-none",style:{opacity:o?1:0}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),n("img",{src:s[e].text,alt:"","aria-hidden":!0,className:"pointer-events-none absolute transition-opacity duration-200 select-none",style:{...r.label}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Ie({onDraw:e,onBackpack:a,onEquip:c,guideActive:l}){let o=p(null),i=E(o);return n("div",{ref:o,className:"relative h-full w-full overflow-hidden",children:[n("div",{className:"absolute inset-0",style:{background:g}},void 0,!1,void 0,this),n("div",{"data-testid":"vibemon-home-stage",className:"[container-type:size] absolute",style:{width:i.width,height:i.height,left:i.left,top:i.top},children:[n("img",{src:U,alt:"",className:"block h-full w-full select-none"},void 0,!1,void 0,this),n("div",{className:"pointer-events-none absolute inset-0",children:[n(m,{assetKey:"vibemon",onClick:c,highlighted:!1,disabled:l},void 0,!1,void 0,this),n(m,{assetKey:"wish",onClick:e,highlighted:l,disabled:!1},void 0,!1,void 0,this),n(m,{assetKey:"album",onClick:a,highlighted:!1,disabled:l},void 0,!1,void 0,this)]},void 0,!0,void 0,this),l&&n(A,{},void 0,!1,void 0,this),l&&n(Ce,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}
|
|
2
|
+
export{Ie};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{k}from"./chunk-nbfhs21c.js";import{e}from"./chunk-htw56xtp.js";import{ne,oe}from"./chunk-v9czb1e6.js";async function Ot(r){return await e().assets.resources.inspect(r)!==null}async function v(r){let s=e().assets,t=await s.resources.cached(r)??await s.ensureResource(r);if(t.sheet===null){let i=await s.resources.preview(t),n=i?URL.createObjectURL(new Blob([new Uint8Array(i).buffer],{type:k(i).mime})):"";return{config:ne(t.name??r,"",{frameWidth:256,frameHeight:256,states:[{id:"static",row:0,frames:1}]}),spriteUrl:n,staticImage:!0,dispose:()=>{if(n)URL.revokeObjectURL(n)}}}let o=t.sheet,a=o[0]===137&&o[1]===80,c=URL.createObjectURL(new Blob([new Uint8Array(o).buffer],{type:a?"image/png":"image/webp"}));return{config:oe(r,t),spriteUrl:c,dispose:()=>URL.revokeObjectURL(c)}}
|
|
2
|
+
export{Ot,v};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{Q}from"./chunk-jppe84sk.js";import{Ot}from"./chunk-41jxjz9n.js";import{ht}from"./chunk-j03we9jz.js";import{tt,c,l}from"./chunk-tvmvzc41.js";import{Z,h}from"./chunk-6f02m6jw.js";import{d}from"./chunk-rfxpf1eq.js";import{i}from"./chunk-h994ssre.js";import{Ue}from"./chunk-1agdfzjz.js";import{t}from"./chunk-mjsqb1wk.js";import{Ge}from"./chunk-zkwggfj2.js";import{B}from"./chunk-t6snsees.js";import{T}from"./chunk-t858h8ch.js";import{p}from"./chunk-w5yer870.js";import{Loader2 as N}from"lucide-react";import{useCallback as D,useEffect as M,useState as k}from"react";import{useTranslation as j}from"react-i18next";import{toast as x}from"sonner";import{jsxDEV as e,Fragment as O}from"react/jsx-dev-runtime";async function L(o,a){let{pet:u}=await Z();if(!u){if(o.length!==1)return;let n=o.find((r)=>a[r.vibemon_uuid]);if(n)await h({pet:n.vibemon_uuid});return}if(a[u])return;let m=o.find((n)=>a[n.vibemon_uuid]);if(m)await h({pet:m.vibemon_uuid})}function z(o){if(o.icon_url===null)return l;return o.icon_url}function U(o){if(o.background_url===null)return l;return o.background_url}function W({item:o,isCurrent:a,isDownloaded:u,onSelectedClick:m,onEquip:n}){return e("div",{"data-testid":"equip-list-item",className:"relative h-[10.673cqw] w-full shrink-0",children:[e("div",{className:"absolute top-[10.302%] left-[4.878%] h-[78.079%] w-[94.309%]",children:[e("img",{src:U(o),alt:"","aria-hidden":!0,className:"absolute inset-0 h-full w-full max-w-none rounded-[1.667cqw] object-cover select-none"},void 0,!1,void 0,this),e("div",{className:"absolute top-[29.638%] left-[9.914%] w-[65.259%]",children:[e("div",{className:"truncate text-[1.875cqw] leading-[1.278] text-white",style:{fontFamily:"Outfit, system-ui, sans-serif",fontWeight:900},children:o.name},void 0,!1,void 0,this),e("div",{className:"mt-[0.104cqw] truncate text-[1.042cqw] leading-[1.25] font-medium text-white",style:{fontFamily:"Outfit, system-ui, sans-serif"},children:o.description??o.rarity_name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e(t,{"aria-label":a?"selected":"select",disabled:!u,onClick:a?m:n,style:{backgroundColor:"#5536CC"},className:"absolute top-[31.756%] left-[70.690%] h-[41.25%] w-[17.241%] overflow-hidden rounded-full border-0 p-0 shadow-none drop-shadow-[0_0.25cqh_0_rgba(0,0,0,0.5)] transition-none hover:brightness-105 active:translate-y-0 disabled:opacity-100",children:[e("img",{src:c,alt:"",className:"pointer-events-none absolute inset-0 size-full max-w-none rounded-[inherit] object-bottom opacity-5 mix-blend-difference select-none"},void 0,!1,void 0,this),a&&e("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 bg-[#5D508B]"},void 0,!1,void 0,this),e("span",{"aria-hidden":!0,className:"absolute inset-0 shadow-[inset_0_0.2cqh_0.07cqh_0_white]"},void 0,!1,void 0,this),e("span",{className:"relative text-[1.458cqw] leading-normal font-normal text-white",style:{fontFamily:'"Grow Year", system-ui, sans-serif'},children:a?"selected":"select"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),e("div",{className:"absolute top-0 left-0 size-[7.917cqw] overflow-hidden rounded-full",children:e("img",{src:i(z(o)),alt:`${o.name} portrait`,className:"h-full w-full object-cover select-none"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Xt({items:o,currentId:a,downloaded:u,onSelectedClick:m,onEquip:n}){return e("div",{className:"flex flex-col gap-[0.833cqw]",children:Q(o).map((r)=>e(W,{item:r,isCurrent:r.vibemon_uuid===a,isDownloaded:u[r.vibemon_uuid],onSelectedClick:m,onEquip:()=>n(r.vibemon_uuid)},r.vibemon_uuid,!1,void 0,this))},void 0,!1,void 0,this)}function Be({onBack:o,onWish:a,onAlbum:u,albumHasUnseen:m,ownedCards:n,ownedLoaded:r,availablePoints:V,pointsLoaded:S}){let{i18n:I}=j("common"),f=I.getFixedT("en","common"),{pet:E}=d(),v=Ue((s)=>s.status==="checking"||s.status==="updating"),[w,C]=k({}),[R,g]=k(0),y=D(()=>g(0),[]);M(()=>{let s=!1;return(async()=>{let b=await Promise.all(n.map(async(_)=>[_.vibemon_uuid,await Ot(_.vibemon_uuid)]));if(s)return;let q=Object.fromEntries(b);if(C(q),!v)await L(n,q)})(),()=>{s=!0}},[n,v]);let F=async(s)=>{y();try{if(await h({pet:s}),await ht({trusted:!0})==="unavailable")x.error(f("vibemon.actionFailed"))}catch(b){console.warn("[vibemon] equip failed",b),x.error(f("vibemon.actionFailed"))}},P=n.some((s)=>w[s.vibemon_uuid]);return e(p,{backdrop:e(O,{children:[e("img",{src:tt,alt:"","aria-hidden":!0,className:"pointer-events-none absolute inset-0 h-full w-full object-cover opacity-10 select-none"},void 0,!1,void 0,this),e("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0",style:{background:"linear-gradient(180deg, rgba(0,0,0,0.3) 0%, rgba(102,102,102,0) 100%)"}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),children:[e(T,{onBack:o,onWish:a,sectionAction:{kind:"album",onClick:u,hasUnseen:m},availablePoints:V,pointsLoaded:S},void 0,!1,void 0,this),!r?e("div",{"data-testid":"vibemon-owned-loading",className:"absolute inset-0 flex items-center justify-center text-[#DCC9FF]",children:e(N,{className:"size-8 animate-spin"},void 0,!1,void 0,this)},void 0,!1,void 0,this):n.length===0?e(B,{onWish:a},void 0,!1,void 0,this):v&&!P?e("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-3 text-[#DCC9FF]",children:[e(N,{className:"size-8 animate-spin"},void 0,!1,void 0,this),e("div",{className:"text-sm",children:f("vibemon.syncPreparing")},void 0,!1,void 0,this)]},void 0,!0,void 0,this):e("div",{className:"absolute top-[17.167%] left-[17.969%] h-[77.833%] w-[64.063%] [scrollbar-width:none] overflow-y-auto overscroll-y-contain [&::-webkit-scrollbar]:hidden",children:e(Xt,{items:n,currentId:E,downloaded:w,onSelectedClick:()=>g((s)=>s+1),onEquip:(s)=>void F(s)},void 0,!1,void 0,this)},void 0,!1,void 0,this),e(Ge,{requestId:R,onClose:y},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}
|
|
2
|
+
export{Xt,Be};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{e}from"./chunk-htw56xtp.js";import{v}from"./chunk-41jxjz9n.js";import{a}from"./chunk-6f02m6jw.js";import{d}from"./chunk-rfxpf1eq.js";import{Ee}from"./chunk-gq64get1.js";import{t}from"./chunk-mjsqb1wk.js";import{I}from"./chunk-8nzgysac.js";import{PlusIcon as K}from"lucide-react";import{useEffect as Q,useRef as C,useState as y}from"react";import{createPortal as k}from"react-dom";import{useTranslation as Z}from"react-i18next";import j from"@alwith/module-auth/assets/pets/lounge/autumn.png?url";import ee from"@alwith/module-auth/assets/pets/lounge/spring.png?url";import te from"@alwith/module-auth/assets/pets/lounge/summer.png?url";import re from"@alwith/module-auth/assets/pets/lounge/winter.png?url";import"@alwith/module-auth/pets/lounge-burst.css";import{jsxDEV as i,Fragment as oe}from"react/jsx-dev-runtime";var ne={spring:ee,summer:te,autumn:j,winter:re};function Ht({active:U,nest:c,onOpenCenter:H,onSend:O,dropTarget:q=!1}){let N=e(),s=d(),z=a(),{t:A}=Z("common"),F=Ee(),[P,B]=y(null),[T,x]=y(null),[G,W]=y(0),[M,V]=y(!1),[f,g]=y(null),[S,X]=y(null),b=C(null),R=C(!1),w=C(!1),m=P?.pet===s.pet&&P.scope===z?P.resource:null;Q(()=>{let r=!1,n=null;if(x(null),B(null),g(null),z!==null&&s.pet)(async()=>{if(!(await N.assets.getMyVibemons()).some((l)=>l.vibemon_uuid===s.pet))throw Error("This account does not own the selected Vibemon");if(r)return;if(n=await v(s.pet),r)n.dispose();else B({pet:s.pet,scope:z,resource:n})})().catch((o)=>{if(!r)x(o instanceof Error?o.message:String(o))});return()=>{r=!0,n?.dispose()}},[N,z,s.pet,G]);let D=async(r)=>{if(R.current)return;if(R.current=!0,V(!0),x(null),r)g({center:r,scale:2}),X(r);try{await O(s.pet,r)}catch(n){x(n instanceof Error?n.message:String(n))}finally{R.current=!1,V(!1),g(null)}},L=(r)=>m&&i(I,{config:m.config,spriteUrl:m.spriteUrl,staticImage:m.staticImage,stateId:m.config.behaviorMap.sleep,flipped:!1,active:U||r,onMouseDown:()=>{},onClick:()=>{},onRenderError:(n)=>x(n.message)},void 0,!1,void 0,this),E={insetInlineEnd:c.inlineEnd,bottom:c.bottom,width:c.size,height:c.size};return i(oe,{children:[i("img",{src:ne[F],alt:"",draggable:!1,className:"pointer-events-none absolute inset-x-0 bottom-0 z-10 w-full"},void 0,!1,void 0,this),(q||f!==null&&!M)&&i("div",{"data-testid":"pet-lounge-drop",className:"border-primary bg-primary/10 pointer-events-none absolute z-30 rounded-xl border-4 border-dashed",style:E},void 0,!1,void 0,this),!s.enabled&&!s.pet&&i(t,{"aria-label":"Vibémon",onClick:H,className:"border-primary bg-primary/10 text-primary absolute z-20 rounded-xl border-4 border-dashed p-0",style:E,children:i(K,{className:"size-16"},void 0,!1,void 0,this)},void 0,!1,void 0,this),!s.enabled&&m&&i("button",{type:"button","aria-label":"Vibémon",disabled:M,className:"vibemon-lounge-pet absolute z-20 cursor-grab touch-none border-0 bg-transparent p-0 disabled:cursor-wait",style:{...E,opacity:f?0:1},onPointerDown:(r)=>{if(r.button!==0||M)return;let n=r.currentTarget.getBoundingClientRect(),o=r.currentTarget.parentElement;if(!o)throw Error("Lounge requires its station");let l=getComputedStyle(o).direction==="rtl",p=o.getBoundingClientRect();w.current=!1,b.current={start:{x:r.clientX,y:r.clientY},origin:{x:n.left+n.width/2,y:n.top+n.height/2},rect:n,edge:l?p.right:p.left,rtl:l,pointer:r.pointerId},r.currentTarget.setPointerCapture(r.pointerId)},onPointerMove:(r)=>{let n=b.current;if(!n)return;let o=r.clientX-n.start.x,l=r.clientY-n.start.y,p=Math.hypot(o,l);if(p<=4&&!w.current)return;w.current=!0;let u={x:n.origin.x+o,y:n.origin.y+l},Y=1+Math.min(p/200,1);g({center:u,scale:Y});let h=c.size*Y/2,_=Math.max(0,Math.min(u.x+h,innerWidth)-Math.max(u.x-h,0)),J=Math.max(0,Math.min(u.y+h,innerHeight)-Math.max(u.y-h,0));if(_*J<h*h*2)b.current=null,r.currentTarget.releasePointerCapture(r.pointerId),D(u)},onPointerUp:(r)=>{let n=b.current;if(b.current=null,!n||!w.current)return;let o=r.clientX-n.start.x,l=r.clientY-n.start.y,p=r.clientX>=n.rect.left&&r.clientX<=n.rect.right&&r.clientY>=n.rect.top&&r.clientY<=n.rect.bottom,u=n.rtl?r.clientX>n.edge:r.clientX<n.edge;if(!p&&u&&Math.hypot(o,l)>=200)D({x:n.origin.x+o,y:n.origin.y+l});else g(null)},onPointerCancel:()=>{b.current=null,g(null),w.current=!0},children:L(!1)},void 0,!1,void 0,this),f&&m&&k(i("div",{className:"pointer-events-none fixed z-[9999]",style:{left:f.center.x-c.size/2,top:f.center.y-c.size/2,width:c.size,height:c.size,transform:`scale(${f.scale})`},children:L(!0)},void 0,!1,void 0,this),document.body),S&&k(i("div",{className:"alwith-vibemon-burst pointer-events-none fixed z-[10000]",style:{left:S.x,top:S.y,width:280,height:280,transform:"translate(-50%, -50%) scale(0.7142857)"},onAnimationEnd:()=>X(null)},void 0,!1,void 0,this),document.body),T&&i("div",{role:"alert",className:"bg-popover text-popover-foreground absolute inset-x-2 bottom-36 z-30 rounded-lg p-2 text-xs",children:[T,i(t,{size:"sm",variant:"outline",onClick:()=>W((r)=>r+1),children:A("vibemon.updateResources")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}
|
|
2
|
+
export{Ht};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r,n}from"./chunk-rerywpwe.js";import{e}from"./chunk-htw56xtp.js";import{w,u,
|
|
2
|
-
export{a,
|
|
1
|
+
import{r,n}from"./chunk-rerywpwe.js";import{e}from"./chunk-htw56xtp.js";import{w,u,Mt,R}from"./chunk-01py4vpp.js";var s={pet:"",enabled:!1,position:null};function a(){let t=e().account();return t===null?null:r(t)}function X(){let t=a();return t===null?s:u("vibemon.accounts")[t]??s}var Z=()=>Promise.try(()=>X());async function h(t){let o=e(),l=o.account(),c=a();if(l===null||c===null)throw Error("Sign in to use Vibemon");if(t.pet!==void 0){let i=u("vibemon.accounts");Mt("vibemon.accounts",{...i,[c]:{...i[c]??s,pet:t.pet}});try{await o.assets.selection.select(t.pet||null)}finally{await w()}}n(o,l);let{enabled:p,position:f}=t;if(p!==void 0||f!==void 0){let i=u("vibemon.accounts");await R("vibemon.accounts",{...i,[c]:{...i[c]??s,...p!==void 0?{enabled:p}:{},...f!==void 0?{position:f}:{}}})}n(o,l)}async function de(t,o){if(o||X().pet==="")await h({pet:t})}
|
|
2
|
+
export{a,X,Z,h,de};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var n=null,i=new Set;function
|
|
2
|
-
export{
|
|
1
|
+
var n=null,i=new Set;function Wt(e){n=e;for(let o of i)o(e)}function ft(){let e=n;return n=null,e}function gt(e){return i.add(e),()=>{i.delete(e)}}
|
|
2
|
+
export{Wt,ft,gt};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{me,Pt,St}from"./chunk-1mq984ah.js";import{I}from"./chunk-14dfwbk0.js";import{c,j,W,f,g,Z,l}from"./chunk-2k8my1h9.js";import{o}from"./chunk-xrw9s1th.js";import{t}from"./chunk-5jz8vnk5.js";import{C}from"./chunk-0gf7vwzk.js";import{U}from"./chunk-mandqn4e.js";import{Fe}from"./chunk-z5nmdjb9.js";import{k,Ne}from"./chunk-m18rjmg2.js";import{motion as H}from"motion/react";import{useEffect as R,useMemo as K,useState as y}from"react";import{jsxDEV as e}from"react/jsx-dev-runtime";var X="linear-gradient(180deg, #0C0C77 1.7234%, #171B6A 25.125%, #A67FFB 97.583%, #957FFB 116.28%)",Y=250,J={1:{default:"bg-[#82D6EB]",hover:"bg-[#A3E1F0]",press:"bg-[#5AC8E3]"},10:{default:"bg-[#FFD932]",hover:"bg-[#FFE46B]",press:"bg-[#FACE0B]"}};function V({drawCount:a,price:n,onClick:m,disabled:d,label:p}){let h=a===1,[P,b]=y(!1),[w,s]=y(!1),i=w?"press":P?"hover":"default",v=h?`X ${n}`:`X ${n}`;return e(t,{className:"relative h-[8.5cqh] w-full overflow-visible rounded-none border-0 bg-transparent p-0 shadow-none transition-none hover:bg-transparent active:translate-y-0 disabled:opacity-45","aria-label":p,disabled:d,"data-visual-state":i,onPointerEnter:()=>b(!0),onPointerLeave:()=>{b(!1),s(!1)},onPointerDown:()=>s(!0),onPointerUp:()=>s(!1),onPointerCancel:()=>s(!1),onKeyDown:(x)=>{if(x.key===" "||x.key==="Enter")s(!0)},onKeyUp:(x)=>{if(x.key===" "||x.key==="Enter")s(!1)},onBlur:()=>{b(!1),s(!1)},onClick:m,children:[e("span",{className:"absolute top-[2.092cqh] left-0 h-[6.408cqh] w-full overflow-hidden rounded-[6.25cqw] drop-shadow-[0_0.417cqh_0_rgba(0,0,0,0.51)]",children:[e("span",{"data-slot":"pull-button-surface",className:o("absolute inset-0",J[a][i])},void 0,!1,void 0,this),e("img",{src:c,alt:"",className:o("pointer-events-none absolute top-[-560.71%] left-[-20.34%] h-[741.76%] w-[160.31%] max-w-none select-none",h?"opacity-68 mix-blend-soft-light":"opacity-18 mix-blend-color-burn")},void 0,!1,void 0,this),e("span",{className:"absolute inset-0 shadow-[inset_0_0.2cqh_0.07cqh_0_white]"},void 0,!1,void 0,this),e("span",{"data-slot":"pull-button-label",className:"absolute inset-0 flex items-center justify-center text-[1.458cqw] leading-normal font-normal text-[#403C80]",style:{fontFamily:'"Grow Year", system-ui, sans-serif',WebkitTextStroke:"0.25cqw white",paintOrder:"stroke fill"},children:["PULL X",a]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),e("span",{className:"absolute top-0 left-1/2 flex h-[4.422cqh] -translate-x-1/2 items-center whitespace-nowrap",children:[e("span",{className:"me-[-0.375cqw] flex size-[2.763cqw] shrink-0 items-center justify-center",children:e("img",{"data-testid":"pull-button-gem",src:j,alt:"",className:"size-[1.682cqw] max-w-none -scale-y-100 rotate-[21.86deg] select-none"},void 0,!1,void 0,this)},void 0,!1,void 0,this),e("span",{"data-slot":"pull-button-price","data-text":v,className:"relative scale-y-98 -skew-x-10 text-[1cqw] leading-normal font-semibold tracking-[0.1cqw] text-transparent before:absolute before:inset-0 before:text-white before:content-[attr(data-text)] before:[-webkit-text-stroke:0.25cqw_#FFFFFF] after:absolute after:inset-0 after:bg-gradient-to-b after:from-[#9645CF] after:to-[#878FFF] after:bg-clip-text after:text-transparent after:content-[attr(data-text)]",style:{fontFamily:'"PingFang SC", sans-serif'},children:v},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var Q=["unselected","hover","selected"],ee=(a,n)=>n==="selected"?a.sidebarSelectedImageUrl:n==="hover"?a.sidebarHoverImageUrl:a.sidebarUnselectedImageUrl;function te({pool:a,selected:n,disabled:m,onSelect:d}){let[p,h]=y(!1),[P,b]=y(!1),w=n?"selected":p||P?"hover":"unselected";return e(t,{id:`pool-tab-${a.poolUuid}`,role:"tab","aria-selected":n,"aria-controls":"gacha-pool-banner","aria-label":a.name,disabled:m,onClick:d,onPointerEnter:()=>h(!0),onPointerLeave:()=>h(!1),onFocus:()=>b(!0),onBlur:()=>b(!1),"data-visual-state":w,className:o("relative h-[14.167cqh] w-full shrink-0 justify-start overflow-visible rounded-none border-0 bg-transparent p-0 shadow-none transition-none hover:bg-transparent active:translate-y-0 disabled:opacity-100",n?"z-20":"z-0"),children:Q.map((s)=>e("img",{src:ee(a,s)||l,alt:"","aria-hidden":!0,className:o("pointer-events-none absolute bottom-0 left-0 h-auto w-full max-w-none select-none",w===s?"opacity-100":"opacity-0")},s,!1,void 0,this))},void 0,!1,void 0,this)}function ae(a,n){if(n==="UPCOMING"){if(a.startsAt===null)throw Error(`Upcoming gacha pool ${a.poolUuid} is missing startsAt`);return{label:"Starts in",at:a.startsAt}}if(n==="ACTIVE"&&a.endsAt!==null)return{label:"Time remaining",at:a.endsAt};return null}function oe({pool:a,status:n,nowMs:m}){let d=ae(a,n);if(d===null)return null;let p=Math.floor((Date.parse(d.at)-m)/1000),h=Math.floor(p/86400),P=Math.floor(p%86400/3600),b=Math.floor(p%3600/60),w=p%60,s=[{value:h,unit:"d"},{value:P,unit:"h"},{value:b,unit:"m"},{value:w,unit:"s"}];return e("div",{role:"timer","aria-label":d.label,className:"absolute bottom-[6.8%] left-[4.4%] flex min-w-[28%] items-center gap-[1.5%] rounded-lg bg-black/24 px-[1.2%] py-[0.8%] text-white backdrop-blur-sm",children:s.map(({value:i,unit:v})=>e("span",{className:"flex items-center gap-[0.35em]",children:[e("span",{className:"min-w-[2.1em] rounded-md bg-black/28 px-[0.35em] py-[0.25em] text-center text-[clamp(9px,0.82cqw,16px)] leading-none font-bold tabular-nums",children:String(i).padStart(2,"0")},void 0,!1,void 0,this),e("span",{className:"text-[clamp(8px,0.58cqw,12px)] font-medium text-white/75",children:v},void 0,!1,void 0,this)]},v,!0,void 0,this))},void 0,!1,void 0,this)}function le(a,n){let m=a.find((d)=>d.poolUuid===n);if(m!==void 0)return m;return _(a)}function _(a){let n=a[0];if(n===void 0)throw Error("Gacha pool catalog has no visible pools");return n}function Ve({onBack:a,onAlbum:n,onEquip:m,isFirstDraw:d,onSingleDraw:p,onMultiDraw:h,drawDisabled:P,albumHasUnseen:b,availablePoints:w,pointsLoaded:s,guideActive:i,poolCatalog:v}){let[x,N]=y(!1),[D,z]=y(_(v.pools).poolUuid),[S,A]=y(Date.now);R(()=>{let u=window.setInterval(()=>A(Date.now()),1000);return()=>window.clearInterval(u)},[]);let F=K(()=>St(v.pools,S),[v.pools,S]),B=Pt(F),r=i?B:le(F,D),G=me(r,S),E=d&&r.poolUuid===B.poolUuid,M=r.singlePrice,T=P||!r.canDraw||G!=="ACTIVE",O=()=>{if(!E&&s&&w<M){N(!0);return}p(r.poolUuid)},L=()=>{if(s&&w<r.multiPrice){N(!0);return}h(r.poolUuid)};return e("div",{className:"[container-type:size] relative h-full w-full overflow-hidden",style:{background:X},children:[e("div",{className:"absolute inset-0 flex items-center justify-center",children:e("div",{"data-testid":"vibemon-pull-stage",className:"[container-type:size] relative",style:{width:"min(100cqw, 160cqh)",aspectRatio:"8 / 5"},children:[e("div",{"aria-hidden":!0,className:"pointer-events-none absolute top-[-51.213%] left-[48.958%] h-[172.145%] w-[143.454%] -translate-x-1/2",children:[e("img",{"data-testid":"vibemon-pool-page-background",src:W,alt:"",className:"absolute inset-0 h-full w-full max-w-none object-cover opacity-60 mix-blend-color-burn select-none"},void 0,!1,void 0,this),e("div",{className:"absolute inset-0 bg-black/40"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e(C,{onClick:a,disabled:i,label:"Back",iconSrc:f,className:"absolute top-[5%] left-[6.25%] z-10 gap-[0.729cqw] text-[#BCACE0] hover:text-[#BCACE0] [&_img]:size-[3.021cqw] [&_span]:text-[1.667cqw]"},void 0,!1,void 0,this),e("div",{className:"absolute top-[5%] right-[6.25%] z-10 flex h-[5.5cqh] items-center gap-[2.292cqw]",children:[e(t,{"aria-label":"Vibémon",disabled:i,onClick:m,className:"size-[3.333cqw] bg-transparent p-0 hover:bg-transparent",children:e("img",{src:g,alt:"",className:"size-full object-contain"},void 0,!1,void 0,this)},void 0,!1,void 0,this),e(t,{"aria-label":"Album",disabled:i,onClick:n,className:"relative size-[3.333cqw] bg-transparent p-0 hover:bg-transparent",children:[e("img",{src:Z,alt:"",className:"size-full object-contain"},void 0,!1,void 0,this),b&&e("span",{className:"absolute top-0 right-0 size-2 rounded-full bg-[#F74640]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e(U,{amount:w,onAdd:I,loaded:s,disabled:i,className:"h-[5.5cqh] min-w-0 rounded-[7.813cqw] py-0 pr-[0.417cqw] pl-[0.729cqw] [&_[data-slot=gem-balance-add-icon]]:size-[2.5cqw] [&>[data-slot=gem-balance-add]]:ms-[1.094cqw] [&>[data-slot=gem-balance-add]]:size-[2.5cqw] [&>[data-slot=gem-balance-amount]]:text-[1.563cqw] [&>[data-slot=gem-balance-icon]]:me-[0.156cqw] [&>[data-slot=gem-balance-icon]]:size-[2.5cqw]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e("div",{role:"tablist","aria-label":"Card pools",className:"absolute top-[19.816%] left-[6.25%] flex w-[12.5%] flex-col",children:F.map((u)=>e(te,{pool:u,selected:u.poolUuid===r.poolUuid,disabled:i||P,onSelect:()=>z(u.poolUuid)},u.poolUuid,!1,void 0,this))},void 0,!1,void 0,this),e("div",{id:"gacha-pool-banner",role:"tabpanel","aria-labelledby":`pool-tab-${r.poolUuid}`,className:"absolute top-[16.667%] left-[14.583%] z-10 h-[66.667%] w-[79.167%] overflow-hidden rounded-[1.042cqw]",children:[F.map((u)=>{let q=u.poolUuid===r.poolUuid;return e(H.img,{src:u.poolCardImageUrl||l,alt:q?`${u.name} pool`:"","aria-hidden":!q,className:"absolute inset-0 h-full w-full object-cover select-none",style:{zIndex:q?1:0},initial:!1,animate:{opacity:q?1:0},transition:{duration:Y/1000,ease:q?"easeOut":"easeIn"}},u.poolUuid,!1,void 0,this)}),e(oe,{pool:r,status:G,nowMs:S},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e("div",{className:"absolute top-[86.098%] left-[54.427%] flex gap-[2.24cqw]",children:[e("div",{className:o("w-[18.542cqw]",i&&"relative z-30"),children:e(V,{drawCount:1,price:M,label:"Pull once",disabled:T,onClick:O},void 0,!1,void 0,this)},void 0,!1,void 0,this),e("div",{className:"w-[18.542cqw]",children:e(V,{drawCount:10,price:r.multiPrice,label:"Pull ten times",disabled:i||E||T,onClick:L},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i&&e(k,{},void 0,!1,void 0,this),i&&e(Ne,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),x&&e(Fe,{onClose:()=>N(!1),onProceed:()=>{I(),N(!1)}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}
|
|
1
|
+
import{me,Pt,_t}from"./chunk-pe1mn10v.js";import{E}from"./chunk-wa475kmq.js";import{c,W,j,f,g,Y,l}from"./chunk-tvmvzc41.js";import{o}from"./chunk-xrw9s1th.js";import{t}from"./chunk-mjsqb1wk.js";import{M}from"./chunk-wfsdbf7j.js";import{N}from"./chunk-j2922k42.js";import{Fe}from"./chunk-g8nah79y.js";import{A,Te}from"./chunk-pwsarey8.js";import{motion as H}from"motion/react";import{useEffect as R,useMemo as K,useState as y}from"react";import{jsxDEV as e}from"react/jsx-dev-runtime";var X="linear-gradient(180deg, #0C0C77 1.7234%, #171B6A 25.125%, #A67FFB 97.583%, #957FFB 116.28%)",J=250,Q={1:{default:"bg-[#82D6EB]",hover:"bg-[#A3E1F0]",press:"bg-[#5AC8E3]"},10:{default:"bg-[#FFD932]",hover:"bg-[#FFE46B]",press:"bg-[#FACE0B]"}};function V({drawCount:a,price:n,onClick:m,disabled:d,label:p}){let h=a===1,[P,b]=y(!1),[w,s]=y(!1),i=w?"press":P?"hover":"default",v=h?`X ${n}`:`X ${n}`;return e(t,{className:"relative h-[8.5cqh] w-full overflow-visible rounded-none border-0 bg-transparent p-0 shadow-none transition-none hover:bg-transparent active:translate-y-0 disabled:opacity-45","aria-label":p,disabled:d,"data-visual-state":i,onPointerEnter:()=>b(!0),onPointerLeave:()=>{b(!1),s(!1)},onPointerDown:()=>s(!0),onPointerUp:()=>s(!1),onPointerCancel:()=>s(!1),onKeyDown:(x)=>{if(x.key===" "||x.key==="Enter")s(!0)},onKeyUp:(x)=>{if(x.key===" "||x.key==="Enter")s(!1)},onBlur:()=>{b(!1),s(!1)},onClick:m,children:[e("span",{className:"absolute top-[2.092cqh] left-0 h-[6.408cqh] w-full overflow-hidden rounded-[6.25cqw] drop-shadow-[0_0.417cqh_0_rgba(0,0,0,0.51)]",children:[e("span",{"data-slot":"pull-button-surface",className:o("absolute inset-0",Q[a][i])},void 0,!1,void 0,this),e("img",{src:c,alt:"",className:o("pointer-events-none absolute top-[-560.71%] left-[-20.34%] h-[741.76%] w-[160.31%] max-w-none select-none",h?"opacity-68 mix-blend-soft-light":"opacity-18 mix-blend-color-burn")},void 0,!1,void 0,this),e("span",{className:"absolute inset-0 shadow-[inset_0_0.2cqh_0.07cqh_0_white]"},void 0,!1,void 0,this),e("span",{"data-slot":"pull-button-label",className:"absolute inset-0 flex items-center justify-center text-[1.458cqw] leading-normal font-normal text-[#403C80]",style:{fontFamily:'"Grow Year", system-ui, sans-serif',WebkitTextStroke:"0.25cqw white",paintOrder:"stroke fill"},children:["PULL X",a]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),e("span",{className:"absolute top-0 left-1/2 flex h-[4.422cqh] -translate-x-1/2 items-center whitespace-nowrap",children:[e("span",{className:"me-[-0.375cqw] flex size-[2.763cqw] shrink-0 items-center justify-center",children:e("img",{"data-testid":"pull-button-gem",src:W,alt:"",className:"size-[1.682cqw] max-w-none -scale-y-100 rotate-[21.86deg] select-none"},void 0,!1,void 0,this)},void 0,!1,void 0,this),e("span",{"data-slot":"pull-button-price","data-text":v,className:"relative scale-y-98 -skew-x-10 text-[1cqw] leading-normal font-semibold tracking-[0.1cqw] text-transparent before:absolute before:inset-0 before:text-white before:content-[attr(data-text)] before:[-webkit-text-stroke:0.25cqw_#FFFFFF] after:absolute after:inset-0 after:bg-gradient-to-b after:from-[#9645CF] after:to-[#878FFF] after:bg-clip-text after:text-transparent after:content-[attr(data-text)]",style:{fontFamily:'"PingFang SC", sans-serif'},children:v},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var Z=["unselected","hover","selected"],ee=(a,n)=>n==="selected"?a.sidebarSelectedImageUrl:n==="hover"?a.sidebarHoverImageUrl:a.sidebarUnselectedImageUrl;function te({pool:a,selected:n,disabled:m,onSelect:d}){let[p,h]=y(!1),[P,b]=y(!1),w=n?"selected":p||P?"hover":"unselected";return e(t,{id:`pool-tab-${a.poolUuid}`,role:"tab","aria-selected":n,"aria-controls":"gacha-pool-banner","aria-label":a.name,disabled:m,onClick:d,onPointerEnter:()=>h(!0),onPointerLeave:()=>h(!1),onFocus:()=>b(!0),onBlur:()=>b(!1),"data-visual-state":w,className:o("relative h-[14.167cqh] w-full shrink-0 justify-start overflow-visible rounded-none border-0 bg-transparent p-0 shadow-none transition-none hover:bg-transparent active:translate-y-0 disabled:opacity-100",n?"z-20":"z-0"),children:Z.map((s)=>e("img",{src:ee(a,s)||l,alt:"","aria-hidden":!0,className:o("pointer-events-none absolute bottom-0 left-0 h-auto w-full max-w-none select-none",w===s?"opacity-100":"opacity-0")},s,!1,void 0,this))},void 0,!1,void 0,this)}function ae(a,n){if(n==="UPCOMING"){if(a.startsAt===null)throw Error(`Upcoming gacha pool ${a.poolUuid} is missing startsAt`);return{label:"Starts in",at:a.startsAt}}if(n==="ACTIVE"&&a.endsAt!==null)return{label:"Time remaining",at:a.endsAt};return null}function oe({pool:a,status:n,nowMs:m}){let d=ae(a,n);if(d===null)return null;let p=Math.floor((Date.parse(d.at)-m)/1000),h=Math.floor(p/86400),P=Math.floor(p%86400/3600),b=Math.floor(p%3600/60),w=p%60,s=[{value:h,unit:"d"},{value:P,unit:"h"},{value:b,unit:"m"},{value:w,unit:"s"}];return e("div",{role:"timer","aria-label":d.label,className:"absolute bottom-[6.8%] left-[4.4%] flex min-w-[28%] items-center gap-[1.5%] rounded-lg bg-black/24 px-[1.2%] py-[0.8%] text-white backdrop-blur-sm",children:s.map(({value:i,unit:v})=>e("span",{className:"flex items-center gap-[0.35em]",children:[e("span",{className:"min-w-[2.1em] rounded-md bg-black/28 px-[0.35em] py-[0.25em] text-center text-[clamp(9px,0.82cqw,16px)] leading-none font-bold tabular-nums",children:String(i).padStart(2,"0")},void 0,!1,void 0,this),e("span",{className:"text-[clamp(8px,0.58cqw,12px)] font-medium text-white/75",children:v},void 0,!1,void 0,this)]},v,!0,void 0,this))},void 0,!1,void 0,this)}function le(a,n){let m=a.find((d)=>d.poolUuid===n);if(m!==void 0)return m;return _(a)}function _(a){let n=a[0];if(n===void 0)throw Error("Gacha pool catalog has no visible pools");return n}function Ve({onBack:a,onAlbum:n,onEquip:m,isFirstDraw:d,onSingleDraw:p,onMultiDraw:h,drawDisabled:P,albumHasUnseen:b,availablePoints:w,pointsLoaded:s,guideActive:i,poolCatalog:v}){let[x,k]=y(!1),[D,z]=y(_(v.pools).poolUuid),[U,I]=y(Date.now);R(()=>{let u=window.setInterval(()=>I(Date.now()),1000);return()=>window.clearInterval(u)},[]);let C=K(()=>_t(v.pools,U),[v.pools,U]),S=Pt(C),r=i?S:le(C,D),F=me(r,U),B=d&&r.poolUuid===S.poolUuid,G=r.singlePrice,T=P||!r.canDraw||F!=="ACTIVE",O=()=>{if(!B&&s&&w<G){k(!0);return}p(r.poolUuid)},L=()=>{if(s&&w<r.multiPrice){k(!0);return}h(r.poolUuid)};return e("div",{className:"[container-type:size] relative h-full w-full overflow-hidden",style:{background:X},children:[e("div",{className:"absolute inset-0 flex items-center justify-center",children:e("div",{"data-testid":"vibemon-pull-stage",className:"[container-type:size] relative",style:{width:"min(100cqw, 160cqh)",aspectRatio:"8 / 5"},children:[e("div",{"aria-hidden":!0,className:"pointer-events-none absolute top-[-51.213%] left-[48.958%] h-[172.145%] w-[143.454%] -translate-x-1/2",children:[e("img",{"data-testid":"vibemon-pool-page-background",src:j,alt:"",className:"absolute inset-0 h-full w-full max-w-none object-cover opacity-60 mix-blend-color-burn select-none"},void 0,!1,void 0,this),e("div",{className:"absolute inset-0 bg-black/40"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e(M,{onClick:a,disabled:i,label:"Back",iconSrc:f,className:"absolute top-[5%] left-[6.25%] z-10 gap-[0.729cqw] text-[#BCACE0] hover:text-[#BCACE0] [&_img]:size-[3.021cqw] [&_span]:text-[1.667cqw]"},void 0,!1,void 0,this),e("div",{className:"absolute top-[5%] right-[6.25%] z-10 flex h-[5.5cqh] items-center gap-[2.292cqw]",children:[e(t,{"aria-label":"Vibémon",disabled:i,onClick:m,className:"size-[3.333cqw] bg-transparent p-0 hover:bg-transparent",children:e("img",{src:g,alt:"",className:"size-full object-contain"},void 0,!1,void 0,this)},void 0,!1,void 0,this),e(t,{"aria-label":"Album",disabled:i,onClick:n,className:"relative size-[3.333cqw] bg-transparent p-0 hover:bg-transparent",children:[e("img",{src:Y,alt:"",className:"size-full object-contain"},void 0,!1,void 0,this),b&&e("span",{className:"absolute top-0 right-0 size-2 rounded-full bg-[#F74640]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e(N,{amount:w,onAdd:E,loaded:s,disabled:i,className:"h-[5.5cqh] min-w-0 rounded-[7.813cqw] py-0 pr-[0.417cqw] pl-[0.729cqw] [&_[data-slot=gem-balance-add-icon]]:size-[2.5cqw] [&>[data-slot=gem-balance-add]]:ms-[1.094cqw] [&>[data-slot=gem-balance-add]]:size-[2.5cqw] [&>[data-slot=gem-balance-amount]]:text-[1.563cqw] [&>[data-slot=gem-balance-icon]]:me-[0.156cqw] [&>[data-slot=gem-balance-icon]]:size-[2.5cqw]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e("div",{role:"tablist","aria-label":"Card pools",className:"absolute top-[19.816%] left-[6.25%] flex w-[12.5%] flex-col",children:C.map((u)=>e(te,{pool:u,selected:u.poolUuid===r.poolUuid,disabled:i||P,onSelect:()=>z(u.poolUuid)},u.poolUuid,!1,void 0,this))},void 0,!1,void 0,this),e("div",{id:"gacha-pool-banner",role:"tabpanel","aria-labelledby":`pool-tab-${r.poolUuid}`,className:"absolute top-[16.667%] left-[14.583%] z-10 h-[66.667%] w-[79.167%] overflow-hidden rounded-[1.042cqw]",children:[C.map((u)=>{let q=u.poolUuid===r.poolUuid;return e(H.img,{src:u.poolCardImageUrl||l,alt:q?`${u.name} pool`:"","aria-hidden":!q,className:"absolute inset-0 h-full w-full object-cover select-none",style:{zIndex:q?1:0},initial:!1,animate:{opacity:q?1:0},transition:{duration:J/1000,ease:q?"easeOut":"easeIn"}},u.poolUuid,!1,void 0,this)}),e(oe,{pool:r,status:F,nowMs:U},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e("div",{className:"absolute top-[86.098%] left-[54.427%] flex gap-[2.24cqw]",children:[e("div",{className:o("w-[18.542cqw]",i&&"relative z-30"),children:e(V,{drawCount:1,price:G,label:"Pull once",disabled:T,onClick:O},void 0,!1,void 0,this)},void 0,!1,void 0,this),e("div",{className:"w-[18.542cqw]",children:e(V,{drawCount:10,price:r.multiPrice,label:"Pull ten times",disabled:i||B||T,onClick:L},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i&&e(A,{},void 0,!1,void 0,this),i&&e(Te,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),x&&e(Fe,{onClose:()=>k(!1),onProceed:()=>{E(),k(!1)}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}
|
|
2
2
|
export{Ve};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{e}from"./chunk-htw56xtp.js";var fe=()=>e().windows.call("monitors"),b=()=>({outerPosition:()=>e().windows.call("position"),outerSize:()=>e().windows.call("size"),scaleFactor:()=>e().windows.call("scale")}),
|
|
2
|
-
export{fe,b,
|
|
1
|
+
import{e}from"./chunk-htw56xtp.js";var fe=()=>e().windows.call("monitors"),b=()=>({outerPosition:()=>e().windows.call("position"),outerSize:()=>e().windows.call("size"),scaleFactor:()=>e().windows.call("scale")}),J=(o,n)=>e().windows.call("move",{x:o,y:n});
|
|
2
|
+
export{fe,b,J};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useCallback as G,useEffect as V,useRef as o,useState as Y}from"react";import{jsxDEV as q}from"react/jsx-dev-runtime";function I({config:e,spriteUrl:w,stateId:L,flipped:P,active:p,staticImage:a,animTick:z,onFirstFrame:C,onDrawFrame:E,onRenderError:g,onMouseDown:W,onClick:X}){let R=o(null),u=o(0),n=o(null),y=o(null),s=o(!1),[D,F]=Y(!1),c=e.states.find((r)=>r.id===L),S=c?.row??0,h=c?.frames??1,H=c?.fps??3,v=c?.loop??!0,M=o(C);M.current=C;let x=o(E);x.current=E;let k=o(g);k.current=g;let b=G((r,t)=>{let T=R.current,i=y.current;if(!T||!i)return;let l=T.getContext("2d");if(!l)return;l.imageSmoothingEnabled=!1,l.clearRect(0,0,e.renderSize,e.renderSize);let d=a?i.naturalWidth:e.cropW,f=a?i.naturalHeight:e.cropH,m=e.renderSize/Math.max(d,f);l.drawImage(i,a?0:r*e.frameSize+e.cropX,a?0:t*(e.frameHeight??e.frameSize)+e.cropY,d,f,(e.renderSize-d*m)/2,(e.renderSize-f*m)/2,d*m,f*m),x.current?.()},[e,a]);return V(()=>{let r=!1;s.current=!1,F(!1);let t=new Image;return t.onload=()=>{if(r)return;y.current=t,F(!0)},t.onerror=()=>{if(!r)k.current?.(Error("Vibemon spritesheet could not be decoded"))},t.src=w,()=>{r=!0,t.onload=null,t.onerror=null}},[w]),V(()=>{if(!D||!p&&s.current)return;let r=R.current;if(!r)return;if(r.dataset.animationGeneration=String(z??0),n.current)clearInterval(n.current);if(u.current=0,b(0,S),!s.current)s.current=!0,M.current?.();if(!p)return;return n.current=setInterval(()=>{if(u.current++,u.current>=h){if(u.current=v?0:h-1,!v&&n.current)clearInterval(n.current),n.current=null}b(u.current,S)},1000/H),()=>{if(n.current)clearInterval(n.current)}},[S,h,H,v,z,D,p,b]),q("canvas",{ref:R,width:e.renderSize,height:e.renderSize,onMouseDown:(r)=>{if(r.button!==0)return;r.preventDefault(),W()},onClick:(r)=>{if(r.button!==0)return;X()},style:{width:"100%",height:"100%",imageRendering:"pixelated",transform:P?"scaleX(-1)":void 0,cursor:"pointer",pointerEvents:"auto"}},void 0,!1,void 0,this)}
|
|
2
|
+
export{I};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r,n}from"./chunk-rerywpwe.js";function
|
|
2
|
-
export{
|
|
1
|
+
import{r,n}from"./chunk-rerywpwe.js";function Re(t,u){let s=Promise.resolve();return{get:async()=>{let e=t.account();if(e===null)return null;let o=await t.storage.get("vibemon.accounts");return n(t,e),o?.[r(e)]?.pet||null},async select(e){let o=t.account();if(o===null)throw Error("Sign in to select a Vibemon");if(e!==null&&!(await u(e)).some((c)=>c.vibemon_uuid===e))throw Error("This account does not own the selected Vibemon");n(t,o);let i=s.catch(()=>{}).then(async()=>{n(t,o);let c=await t.storage.get("vibemon.accounts")??{};n(t,o);let a=r(o);await t.storage.set("vibemon.accounts",{...c,[a]:{...c[a],pet:e??""}}),n(t,o)});s=i,await i}}}
|
|
2
|
+
export{Re};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{yt}from"./chunk-b5zfgr86.js";import{ot,rt}from"./chunk-
|
|
2
|
-
export{
|
|
1
|
+
import{yt}from"./chunk-b5zfgr86.js";import{ot,rt}from"./chunk-tvmvzc41.js";import{p}from"./chunk-w5yer870.js";import{useEffect as w,useRef as u,useState as b}from"react";import{jsxDEV as e}from"react/jsx-dev-runtime";var v=98.902;function ze({progress:o,onFinished:r}){let[i,f]=b(0),s=u(o);s.current=o;let l=u(r);l.current=r,w(()=>{let n=0,c=performance.now(),t=0,m=(d)=>{let g=Math.min((d-c)/1000,0.1);if(c=d,t=yt(t,s.current,g),f(t),t>=1){l.current();return}n=requestAnimationFrame(m)};return n=requestAnimationFrame(m),()=>cancelAnimationFrame(n)},[]);let a=Math.round(i*100);return e(p,{backdrop:e("img",{src:ot,alt:"","aria-hidden":!0,className:"pointer-events-none absolute inset-0 h-full w-full object-cover select-none"},void 0,!1,void 0,this),children:[e("img",{src:rt,alt:"Vibémon",className:"pointer-events-none absolute top-[17.140%] left-[22.049%] h-[56.559%] w-[55.903%] max-w-none select-none"},void 0,!1,void 0,this),e("div",{"data-testid":"vibemon-loading-progress",role:"progressbar","aria-label":`Loading ${a}%`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":a,className:"absolute top-[83.050%] left-1/2 flex w-[52.083%] -translate-x-1/2 flex-col gap-[0.625cqw]",children:[e("p",{className:"text-right text-[1.458cqw] leading-normal tracking-[0.08em] text-white",style:{fontFamily:'"Grow Year", system-ui, sans-serif'},children:"LOADING..."},void 0,!1,void 0,this),e("div",{className:"flex flex-col items-center gap-[0.625cqw]",children:[e("div",{className:"relative h-[2.292cqw] w-full rounded-full bg-[#3B138F] shadow-[inset_0_0.052cqw_0.365cqw_0_rgba(0,0,0,0.25)]",children:e("div",{"data-testid":"vibemon-loading-progress-fill",className:"absolute top-[9.091%] left-[0.549%] h-[81.818%] min-w-[3.6%] rounded-full bg-[linear-gradient(180deg,#FFE16C_0%,#FFB638_100%)] shadow-[inset_0_0.208cqw_0.156cqw_0_rgba(255,255,255,0.87)]",style:{width:`${i*v}%`}},void 0,!1,void 0,this)},void 0,!1,void 0,this),e("p",{className:"text-center text-[1.458cqw] leading-normal text-white",style:{fontFamily:'"Grow Year", system-ui, sans-serif'},children:[a,"%"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}
|
|
2
|
+
export{ze};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r}from"./chunk-rerywpwe.js";import{re}from"./chunk-
|
|
2
|
-
export{ee,
|
|
1
|
+
import{r}from"./chunk-rerywpwe.js";import{re}from"./chunk-3amxesw3.js";import{e}from"./chunk-htw56xtp.js";import{createStore as h}from"zustand/vanilla";var ee=h(()=>({status:"idle"})),jt=()=>ee.getState().status,Tt=(t)=>ee.setState({status:t}),Yt=(t)=>ee.subscribe((a)=>t(a.status)),i=null;async function te(){let t=e();if(t.synchronizeResources!==void 0)return t.synchronizeResources();let a=t.account();if(a===null)return;let p=`${r(a)}/${a.revision}`,n=()=>{let o=t.account();return o!==null&&`${r(o)}/${o.revision}`===p};if(i?.scope===p)return i.operation;let u=(o)=>{if(n())Tt(o)},y=(o,c)=>{if(!n())return;if(t.onResourceSyncError)t.onResourceSyncError(o,c);else console.warn("[vibemon] resource sync failed",c,o)},d=(async()=>{u("checking");try{let o=await t.assets.getVibemonCatalog();if(!n())return;let c=new Set,S=0,f=!1;if(await Promise.all(Array.from({length:Math.min(6,o.length)},async()=>{while(n()&&S<o.length){let s=o[S++];try{let l=await t.assets.resources.inspect(s.uuid);if(l&&re(l,s))continue;u("updating"),await t.assets.resources.ensure(s),c.add(s.uuid)}catch(l){f=!0,y(l,{phase:"resource",petId:s.uuid})}}})),n())try{await t.resourcesSynchronized?.(c)}catch(s){if(n())t.onError(s)}u(f?"error":c.size===0?"idle":"done")}catch(o){u("error"),y(o,{phase:"catalog"})}})();i={scope:p,operation:d};try{await d}finally{if(i?.operation===d)i=null}}
|
|
2
|
+
export{ee,jt,Tt,Yt,te};
|
|
@@ -2,5 +2,5 @@ var t={"app-window":`
|
|
|
2
2
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" viewBox="0 0 256 256"><path d="M224,56V200a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H216A8,8,0,0,1,224,56Z" opacity="0.2"/><path d="M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,160H40V56H216V200ZM80,84A12,12,0,1,1,68,72,12,12,0,0,1,80,84Zm40,0a12,12,0,1,1-12-12A12,12,0,0,1,120,84Z"/></svg>
|
|
3
3
|
`,"number-square-one":`
|
|
4
4
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" viewBox="0 0 256 256"><path d="M216,48V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V48a8,8,0,0,1,8-8H208A8,8,0,0,1,216,48Z" opacity="0.2"/><path d="M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm0,176H48V48H208V208ZM140,80v96a8,8,0,0,1-16,0V95l-11.56,7.71a8,8,0,1,1-8.88-13.32l24-16A8,8,0,0,1,140,80Z"/></svg>
|
|
5
|
-
`};function
|
|
6
|
-
export{
|
|
5
|
+
`};function _(n,a){return a?a[n]:t[n==="main"?"number-square-one":"app-window"]}
|
|
6
|
+
export{_};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t}from"./chunk-
|
|
1
|
+
import{t}from"./chunk-mjsqb1wk.js";import{qe}from"./chunk-v890qhc2.js";import{cva as s}from"class-variance-authority";import{cn as o}from"cn";import{jsxDEV as i}from"react/jsx-dev-runtime";function De({className:r,...a}){return i("div",{"data-slot":"input-group",role:"group",className:o("group/input-group border-input has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 relative flex h-9 w-full min-w-0 items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-3 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",r),...a},void 0,!1,void 0,this)}var p=s("text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-2 has-[>button]:-ml-1 has-[>kbd]:ml-[-0.15rem]","inline-end":"order-last pr-2 has-[>button]:-mr-1 has-[>kbd]:mr-[-0.15rem]","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function Le({className:r,align:a="inline-start",...e}){return i("div",{role:"group","data-slot":"input-group-addon","data-align":a,className:o(p({align:a}),r),onClick:(n)=>{if(n.target.closest("button"))return;n.currentTarget.parentElement?.querySelector("input")?.focus()},...e},void 0,!1,void 0,this)}var l=s("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",sm:"","icon-xs":"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function V({className:r,type:a="button",variant:e="ghost",size:n="xs",...u}){return i(t,{type:a,"data-size":n,variant:e,className:o(l({size:n}),r),...u},void 0,!1,void 0,this)}function Oe({className:r,...a}){return i(qe,{"data-slot":"input-group-control",className:o("flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent",r),...a},void 0,!1,void 0,this)}export{De,Le,V,Oe};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{e}from"./chunk-htw56xtp.js";import{Ct}from"./chunk-jampyjt1.js";import{Rt,pe,Et,kt,Vt}from"./chunk-vt1sfk87.js";import{xt,St}from"./chunk-pe1mn10v.js";import{ve}from"./chunk-9h4j75af.js";import{u,be,R}from"./chunk-01py4vpp.js";import{ft,gt}from"./chunk-6t0bw1wy.js";import{s,U,D,L,O,x,q,S,H,G,z,F,c,W,j,f,g,Y}from"./chunk-tvmvzc41.js";import{a,de}from"./chunk-6f02m6jw.js";import{i}from"./chunk-h994ssre.js";import{te}from"./chunk-ctvwa8d3.js";import{$e}from"./chunk-rrhhytq1.js";import{Be}from"./chunk-4mwvph27.js";import{Ie}from"./chunk-3rpgxz1z.js";import{ae,Ae}from"./chunk-hscsc9kx.js";import{ze}from"./chunk-bcyk6es8.js";import{Ne}from"./chunk-m3e7wah7.js";import{Ve}from"./chunk-7pdpmxg2.js";import{Loader2 as to}from"lucide-react";import{useCallback as C,useEffect as I,useRef as N,useState as t}from"react";import{useTranslation as ro}from"react-i18next";import{toast as io}from"sonner";import{jsxDEV as r}from"react/jsx-dev-runtime";var ao=30000,ue=[U,s.vibemon.icon,s.vibemon.hover,s.vibemon.text,s.wish.icon,s.wish.hover,s.wish.text,s.album.icon,s.album.hover,s.album.text,D,L,x],Te=[j,f,g,Y,c,W,z,F,O,q,S,H,x,G],ce=(l)=>{let m=a();return!!(m&&l[m])},me=(l,m)=>{let w=a();if(!w)return;R(l,{...u(l),[w]:m})},fe=(l)=>{let m=a();if(!m)return null;return l[m]??null},lo=(l)=>{let m=a();if(!m)return;R("vibemon.onboardingStep",{...u("vibemon.onboardingStep"),[m]:l})};function zt(){return r("div",{className:"contents",onContextMenu:(l)=>l.preventDefault(),children:r(so,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function so(){let{t:l}=ro("vibemon"),[m,w]=t(()=>{let o=fe(u("vibemon.onboardingStep"));return o==="free-draw"||o==="view-album"?"pull":"home"}),[M,v]=t("idle"),[h,We]=t(()=>fe(u("vibemon.onboardingStep"))),[y,we]=t(!1),[K,J]=t(!1),[A,je]=t([]),[Ke,ge]=t(null),[k,Je]=t(!1),[Q,he]=t(0),[X,Se]=t(!1),[Qe,Xe]=t([]),[Ye,ye]=t(!1),[Z,Ze]=t(null),[Pe,Ee]=t(null),[Re,De]=t({done:0,total:Te.length}),[Le,eo]=t(!1),[P,_]=t(()=>ce(u("vibemon.introSeen"))?"loading":"resolving-intro"),[_e,oo]=t({done:0,total:ue.length}),[Ce,no]=t(null),He=N(!1),T=C((o)=>{We(o),lo(o)},[]),b=C(()=>w("pull"),[]);I(()=>{if(P!=="loading"||He.current)return;He.current=!0,ve(ue,(o)=>{oo({done:o,total:ue.length})}).catch((o)=>{let n=o instanceof Error?o:Error(String(o));no(n)})},[P]);let Oe=N(0),xe=N(!1),ee=N(!1),V=C(async()=>{let o=++Oe.current;try{let n=await Rt();if(o===Oe.current)je(n),Je(!0),ge(null)}catch(n){ge(n instanceof Error?n:Error(String(n))),console.warn("[vibemon] getMyVibemons failed",n)}},[]),Me=N(!1),ke=N(!1),oe=C(async()=>{try{let o=await St();Ee(null);let n=[...new Set([...Te,...xt(o)])],p=!Me.current;if(p)De({done:0,total:n.length});if(await ve(n,(B)=>{if(p)De({done:B,total:n.length})}),Ze(o),p)Me.current=!0,eo(!0)}catch(o){let n=o instanceof Error?o:Error(String(o));console.error("[vibemon] loadGachaPoolCatalog failed",n),Ee(n)}},[]);I(()=>{if(P!=="loading"||ke.current)return;ke.current=!0,oe()},[P,oe]),I(()=>{let o=()=>{pe().then((p)=>{he(p.available_points),Se(!0)}).catch((p)=>console.warn("[vibemon] getPointAccount failed",p))};o();let n=setInterval(o,ao);return window.addEventListener("focus",o),()=>{clearInterval(n),window.removeEventListener("focus",o)}},[]),I(()=>{for(let o of A)new Image().src=i(o.gacha_url??o.cover_url)},[A]);let ne=()=>{if(K)me("vibemon.albumHasUnseen",!1),J(!1);V(),w("album")},E=C(()=>{V(),w("equip")},[V]);I(()=>{if(xe.current)return;xe.current=!0,V(),Promise.all([Et().catch((o)=>(console.warn("[vibemon] getGachaFirstDraw failed",o),{first_draw:!1})),be("vibemon.albumHasUnseen")]).then(([o,n])=>{if(we(o.first_draw),J(ce(n)),!o.first_draw)return;if(fe(u("vibemon.onboardingStep"))==="free-draw"){b();return}T("home-wish"),w("home")}),be("vibemon.introSeen").then((o)=>{if(ce(o)){_("loading");return}return kt().then(({first_visit:n})=>{if(me("vibemon.introSeen",!0),n)w("home"),v("intro"),_("intro");else _("loading")})}).catch((o)=>{console.warn("[vibemon] first-visit check failed",o),_("loading")})},[b,V,T]);let[Ue,qe]=t(!1),re=C((o)=>{if(y&&h==="home-wish")return;if(y&&h==="free-draw"){b();return}if(o==="pull")b();else if(o==="equip")E();else qe(!0)},[y,h,E,b]);if(I(()=>{let o=ft();if(o)re(o);return gt(re)},[re]),I(()=>{if(!Ue||!k)return;if(qe(!1),A.length===0)b();else E()},[Ue,k,A.length,E,b]),Ke!==null)return r("div",{role:"alert",className:"bg-background text-foreground flex h-full flex-col items-center justify-center gap-3 p-6",children:[r("p",{children:l("offline.title")},void 0,!1,void 0,this),r("p",{className:"text-muted-foreground text-sm",children:l("offline.description")},void 0,!1,void 0,this),r("button",{type:"button",className:"rounded-md border px-4 py-2",onClick:()=>void V(),children:l("offline.retry")},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(P==="resolving-intro")return r("div",{className:"relative flex h-full w-full items-center justify-center overflow-hidden bg-[#120E18]",children:[r("video",{src:ae,preload:"auto",muted:!0,playsInline:!0,"aria-hidden":!0,className:"pointer-events-none absolute top-0 left-0 h-px w-px opacity-0"},void 0,!1,void 0,this),r(to,{className:"size-10 animate-spin text-white"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(P==="intro")return r("div",{className:"relative h-full w-full overflow-hidden bg-[#120E18]",children:r(Ae,{onVideoStart:()=>v("intro"),onDone:()=>{v("idle"),_("loading")}},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(Ce!==null)throw Ce;if(Pe!==null)throw Pe;if(P==="loading"){let o=_e.done+Re.done+(Z===null?0:1)+(Le?1:0),n=_e.total+Re.total+2;return r("div",{className:"relative h-full w-full overflow-hidden",children:r(ze,{progress:o/n,onFinished:()=>_("ready")},void 0,!1,void 0,this)},void 0,!1,void 0,this)}if(m==="home")return r(Ie,{onDraw:()=>{if(h==="home-wish")T("free-draw");b()},onBackpack:ne,onEquip:E,guideActive:y&&h==="home-wish"},void 0,!1,void 0,this);if(m==="equip")return r(Be,{onBack:()=>w("home"),onWish:b,onAlbum:ne,albumHasUnseen:K,ownedCards:A,ownedLoaded:k,availablePoints:Q,pointsLoaded:X},void 0,!1,void 0,this);if(m==="album")return r($e,{onBack:()=>w("home"),onWish:b,onEquip:E,ownedCards:A,ownedLoaded:k,availablePoints:Q,pointsLoaded:X},void 0,!1,void 0,this);if(Z===null||!Le)throw Error("[vibemon] app entered ready state before gacha resources were loaded");let Ge=async(o,n)=>{if(ee.current||M!=="idle")return;ee.current=!0,ye(!0);try{let p;try{p=await Vt(o,n)}catch(d){console.warn("[vibemon] drawGachaPool failed",d),io.error(l("draw.failedNetwork"));return}let B=n==="SINGLE"?1:10;if(p.results.length!==B)throw Error(`[vibemon] ${n} draw response must contain ${B} results, received ${p.results.length}`);await Promise.all(p.results.map(async(d)=>{if(d.reward_type==="WHITE_CARD"||!d.vibemon_uuid)return;Object.assign(d,await e().assets.resolveImages(d.vibemon_uuid))}));let Fe=p.results.map(Ct),ie=[];for(let[d,le]of p.results.entries()){if(le.reward_type==="WHITE_CARD")continue;ie.push(le);let se=Fe[d];if(se?.kind!=="card")throw Error(`[vibemon] draw result ${le.draw_index} was not mapped to a Vibemon card`);new Image().src=i(n==="SINGLE"?se.singleImageUrl:se.multiImageUrl)}if(Xe(Fe),we(!1),h==="free-draw")T("view-album");if(v("video-waiting"),ie.length>0){let d=ie[0];if(d===void 0)throw Error("[vibemon] draw result lost its first Vibemon item");te(),de(d.vibemon_uuid,y),V()}oe(),pe().then((d)=>{he(d.available_points),Se(!0)}).catch((d)=>console.warn("[vibemon] getPointAccount failed",d))}finally{ee.current=!1,ye(!1)}};return r("div",{className:"relative h-full w-full",children:[r(Ve,{onBack:()=>w("home"),onAlbum:ne,onEquip:E,isFirstDraw:y,availablePoints:Q,pointsLoaded:X,onSingleDraw:(o)=>void Ge(o,"SINGLE"),onMultiDraw:(o)=>void Ge(o,"MULTI"),drawDisabled:Ye||M!=="idle",albumHasUnseen:K,guideActive:y&&h==="free-draw",poolCatalog:Z},void 0,!1,void 0,this),M!=="intro"&&r(Ne,{phase:M,drawnRewards:Qe,onVideoStarted:()=>v("video-playing"),onPullDone:()=>v("result"),onPullFailed:()=>v("result"),onResultConfirmed:(o)=>{if(o)me("vibemon.albumHasUnseen",!0),J(!0);v("idle")}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}
|
|
2
|
+
export{zt};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function Bt(n,o,x,u,r,k){let e=n+x,c=o+u,l=n+x/2;r=Math.min(r,x/2,u/2);let t=r*0.5522847498307936;return[{kind:"move",x:n+r,y:o},{kind:"line",x:e-r,y:o},{kind:"curve",control1X:e-r+t,control1Y:o,control2X:e,control2Y:o+r-t,x:e,y:o+r},{kind:"line",x:e,y:c-r},{kind:"curve",control1X:e,control1Y:c-r+t,control2X:e-r+t,control2Y:c,x:e-r,y:c},{kind:"line",x:l+k,y:c},{kind:"line",x:l+1,y:c+k-1},{kind:"curve",control1X:l+0.5,control1Y:c+k-0.5,control2X:l-0.5,control2Y:c+k-0.5,x:l-1,y:c+k-1},{kind:"line",x:l-k,y:c},{kind:"line",x:n+r,y:c},{kind:"curve",control1X:n+r-t,control1Y:c,control2X:n,control2Y:c-r+t,x:n,y:c-r},{kind:"line",x:n,y:o+r},{kind:"curve",control1X:n,control1Y:o+r-t,control2X:n+r-t,control2Y:o,x:n+r,y:o},{kind:"close"}]}function
|
|
2
|
-
export{Bt,
|
|
1
|
+
function Bt(n,o,x,u,r,k){let e=n+x,c=o+u,l=n+x/2;r=Math.min(r,x/2,u/2);let t=r*0.5522847498307936;return[{kind:"move",x:n+r,y:o},{kind:"line",x:e-r,y:o},{kind:"curve",control1X:e-r+t,control1Y:o,control2X:e,control2Y:o+r-t,x:e,y:o+r},{kind:"line",x:e,y:c-r},{kind:"curve",control1X:e,control1Y:c-r+t,control2X:e-r+t,control2Y:c,x:e-r,y:c},{kind:"line",x:l+k,y:c},{kind:"line",x:l+1,y:c+k-1},{kind:"curve",control1X:l+0.5,control1Y:c+k-0.5,control2X:l-0.5,control2Y:c+k-0.5,x:l-1,y:c+k-1},{kind:"line",x:l-k,y:c},{kind:"line",x:n+r,y:c},{kind:"curve",control1X:n+r-t,control1Y:c,control2X:n,control2Y:c-r+t,x:n,y:c-r},{kind:"line",x:n,y:o+r},{kind:"curve",control1X:n,control1Y:o+r-t,control2X:n+r-t,control2Y:o,x:n+r,y:o},{kind:"close"}]}function Ut(n){return n.map(y).join(" ")}function y(n){switch(n.kind){case"move":return`M${n.x},${n.y}`;case"line":return`L${n.x},${n.y}`;case"curve":return`C${n.control1X},${n.control1Y} ${n.control2X},${n.control2Y} ${n.x},${n.y}`;case"close":return"Z"}}function Dt(n,o){return n.map((x)=>b(x,o))}function b(n,o){switch(n.kind){case"move":case"line":return{kind:n.kind,x:n.x*o,y:n.y*o};case"curve":return{kind:"curve",control1X:n.control1X*o,control1Y:n.control1Y*o,control2X:n.control2X*o,control2Y:n.control2Y*o,x:n.x*o,y:n.y*o};case"close":return n}}
|
|
2
|
+
export{Bt,Ut,Dt};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Ye,ct,ut}from"./chunk-tvmvzc41.js";import{t}from"./chunk-mjsqb1wk.js";import{useState as a}from"react";import{jsxDEV as o}from"react/jsx-dev-runtime";function Fe({onClose:n,onProceed:s}){return o("div",{className:"absolute inset-0 z-50 flex cursor-default items-center justify-center bg-black/80 p-0",onClick:(e)=>{if(e.target===e.currentTarget)n()},onKeyDown:(e)=>{if(e.key==="Escape")n()},children:o("div",{className:"relative",children:[o("img",{src:ct,alt:"",className:"pointer-events-none max-w-none select-none",style:{width:326.24,height:201.03}},void 0,!1,void 0,this),o(t,{variant:"ghost",className:"absolute h-auto p-0 hover:bg-transparent",style:{top:-7.07,right:-11.3},onClick:n,children:o("img",{src:ut,alt:"",className:"max-w-none select-none",style:{width:26,height:26}},void 0,!1,void 0,this)},void 0,!1,void 0,this),o(i,{onClick:s},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function i({onClick:n}){let[s,e]=a("default");return o(t,{variant:"ghost",className:"absolute h-auto -translate-x-1/2 p-0 hover:bg-transparent",style:{bottom:30,left:"50%"},title:"",onClick:n,onMouseEnter:()=>e("hover"),onMouseLeave:()=>e("default"),onMouseDown:()=>e("active"),onMouseUp:()=>e("hover"),children:o("img",{src:Ye[s],alt:"",className:"max-w-none select-none",style:{width:144,height:36}},void 0,!1,void 0,this)},void 0,!1,void 0,this)}
|
|
2
2
|
export{Fe};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{ke}from"./chunk-2j5re92x.js";var i=new Set(["Antarctica","Australia","Pacific/Auckland","Pacific/Chatham","Pacific/Fiji","Pacific/Noumea","Pacific/Port_Moresby","Pacific/Guadalcanal","Pacific/Tongatapu","Pacific/Apia","Pacific/Tahiti","America/Sao_Paulo","America/Argentina","America/Santiago","America/Montevideo","America/Asuncion","America/La_Paz","America/Lima","America/Recife","America/Bahia","America/Cuiaba","America/Campo_Grande","Africa/Johannesburg","Africa/Maputo","Africa/Windhoek","Africa/Harare","Africa/Lusaka","Africa/Gaborone","Africa/Luanda","Africa/Dar_es_Salaam","Indian/Antananarivo","Indian/Mauritius","Indian/Reunion"]);function r(){let a=Intl.DateTimeFormat().resolvedOptions().timeZone;if(!a)return"north";let e=a.split("/")[0];if(i.has(a)||i.has(e))return"south";let n=a.split("/").slice(0,2).join("/");return i.has(n)?"south":"north"}function Ee(){return ke(new Date,r())}
|
|
2
|
+
export{Ee};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{fe,b,
|
|
2
|
-
export{
|
|
1
|
+
import{fe,b,J}from"./chunk-7y7stqn0.js";var o=60000,h=24,a=90;class K{currentBehavior="idle";flipped=!1;position={x:200,y:200};targetPosition=null;screenBounds={x:0,y:0,width:1920,height:1080};behaviorTimer=null;sleepTimer=null;moveTimerId=null;isDragging=!1;isPresenting=!1;isHatching=!1;destroyed=!1;suspended=!1;behaviorBeforeDrag="idle";working=!1;sessionAnimation=null;onStateChange;onNotification;config;constructor(i,e,t){this.config=i,this.onStateChange=e,this.onNotification=t}stateOf(i){return this.config.behaviorMap[i]??this.config.behaviorMap.idle}async start(i){if(await this.updateScreenBounds(),i===void 0){let e=await b().outerPosition();this.position={x:e.x,y:e.y}}else if(i){let e=await b().outerSize();if((await fe()).some((n)=>i.x+e.width>n.position.x&&i.x<n.position.x+n.size.width&&i.y+e.height>n.position.y&&i.y<n.position.y+n.size.height))this.position={x:i.x,y:i.y};else{let n=this.screenBounds.x+this.screenBounds.width-e.width,r=this.screenBounds.y+this.screenBounds.height-e.height;this.position={x:Math.min(Math.max(i.x,this.screenBounds.x),n),y:Math.min(Math.max(i.y,this.screenBounds.y),r)}}await J(this.position.x,this.position.y)}else{let e=await b().outerSize(),t=await b().scaleFactor(),s=Math.round(h*t),n=Math.round(a*t);this.position={x:this.screenBounds.x+this.screenBounds.width-e.width-s,y:this.screenBounds.y+this.screenBounds.height-e.height-n},await J(this.position.x,this.position.y)}if(this.setBehavior("idle"),this.sessionAnimation!==null)this.applySessionAnimation();this.resetSleepTimer()}destroy(){if(this.destroyed=!0,this.behaviorTimer)clearTimeout(this.behaviorTimer);if(this.sleepTimer)clearTimeout(this.sleepTimer);if(this.moveTimerId)clearInterval(this.moveTimerId)}suspend(){if(this.suspended=!0,this.cancelMovement(),this.targetPosition=null,this.sleepTimer)clearTimeout(this.sleepTimer);this.sleepTimer=null}resume(){if(this.destroyed)throw Error("Cannot resume a destroyed Vibemon engine");if(this.suspended=!1,this.sessionAnimation!==null)this.applySessionAnimation();else this.setBehavior(this.restBehavior());this.resetSleepTimer()}async presentAt(i){if(this.isDragging||this.isPresenting||this.destroyed)throw Error("Vibemon cannot be presented right now");this.isPresenting=!0,this.cancelMovement(),this.targetPosition=null;try{if(this.position=await i(),this.destroyed)throw Error("Vibemon engine changed during presentation")}finally{if(this.isPresenting=!1,!this.destroyed&&!this.suspended){if(this.sessionAnimation!==null)this.applySessionAnimation();else if(this.currentBehavior!=="wait"&&this.currentBehavior!=="error")this.setBehavior(this.restBehavior());this.resetSleepTimer()}}}restBehavior(){return this.working?"sit":"idle"}setWorking(i){if(this.working===i)return;if(this.working=i,this.destroyed||this.suspended||this.isDragging)return;let e=this.currentBehavior==="idle"||this.currentBehavior==="sit"||this.currentBehavior==="sleep",t=this.restBehavior();if(e&&t!==this.currentBehavior)this.setBehavior(t),this.resetSleepTimer()}setSessionState(i,e,t){let s=this.sessionAnimation;if(s!==null&&s.sessionId===i&&s.state===e&&s.failed===t)return;if(this.sessionAnimation={sessionId:i,state:e,failed:t},this.setWorking(e==="running"&&!t),s!==null&&s.sessionId===i&&s.state==="done"&&e==="idle"&&!t&&this.currentBehavior==="jump"&&this.behaviorTimer!==null)return;if(!this.destroyed&&!this.suspended&&!this.isDragging&&!this.isPresenting)this.applySessionAnimation()}applySessionAnimation(){let i=this.sessionAnimation;if(i===null)throw Error("Session animation requires a Runtime snapshot");let e=i.failed?"task-error":i.state==="running"?"running":i.state==="requires_action"?"info":i.state==="done"?"task-complete":"idle";this.handleNotification({type:e,message:"",sourceWindow:""})}handleNotification(i){if(this.suspended)return;if(this.isHatching)return;if(this.onNotification(i),this.resetSleepTimer(),this.behaviorTimer)clearTimeout(this.behaviorTimer);if(this.currentBehavior==="sleep"){this.setBehavior("scared"),this.behaviorTimer=setTimeout(()=>{if(!this.destroyed&&!this.isDragging&&!this.isPresenting)if(this.sessionAnimation!==null)this.applySessionAnimation();else this.handleNotification(i)},500);return}if(this.cancelMovement(),i.type==="info"){this.setBehavior("wait");return}if(i.type==="task-error"){this.setBehavior(this.config.behaviorMap.error?"error":"wait");return}if(i.type==="running"){this.setBehavior("sit");return}if(i.type==="task-complete"){this.setBehavior("jump");let e=this.config.states.find((s)=>s.id===this.stateOf("jump")),t=e?e.frames/e.fps*1000:800;this.behaviorTimer=setTimeout(()=>{if(!this.destroyed&&!this.isDragging)this.setBehavior(this.restBehavior())},t);return}this.setBehavior(this.restBehavior())}handleClick(){if(this.isHatching)return;this.resetSleepTimer()}dismissError(){if(this.currentBehavior!=="error")return;this.cancelMovement(),this.setBehavior(this.restBehavior()),this.resetSleepTimer()}flipForDirection(i){return this.config.facing==="left"?!i:i}handleDragStart(i){if(this.isPresenting)throw Error("Vibemon presentation is in progress");if(this.isHatching)return;if(this.behaviorBeforeDrag=this.currentBehavior,this.isDragging=!0,this.cancelMovement(),this.resetSleepTimer(),i!==void 0)this.flipped=this.flipForDirection(i);this.setBehavior("scared")}setFacing(i){let e=this.flipForDirection(i);if(this.flipped===e)return;this.flipped=e,this.onStateChange(this.stateOf(this.currentBehavior),this.flipped,!1)}handleDragEnd(){if(this.destroyed)return;if(this.isDragging=!1,this.cancelMovement(),this.flipped=!1,this.sessionAnimation!==null)this.applySessionAnimation();else if(this.behaviorBeforeDrag==="wait"||this.behaviorBeforeDrag==="error")this.setBehavior(this.behaviorBeforeDrag);else this.setBehavior(this.restBehavior());this.syncPositionFromWindow()}debugSpeed=8;setDebugSpeed(i){this.debugSpeed=i}stop(){this.cancelMovement(),this.setBehavior("idle")}debugSetBehavior(i){if(this.cancelMovement(),i in this.config.behaviorMap)this.setBehavior(i);else this.currentBehavior="idle",this.onStateChange(i,this.flipped,!0)}getDebugSpeed(){return this.debugSpeed}async debugRun(){this.cancelMovement(),await this.syncPositionFromWindow();let i=await b().outerSize(),e=[{x:this.screenBounds.x,y:this.screenBounds.y},{x:this.screenBounds.x+this.screenBounds.width-i.width,y:this.screenBounds.y},{x:this.screenBounds.x+this.screenBounds.width-i.width,y:this.screenBounds.y+this.screenBounds.height-i.height},{x:this.screenBounds.x,y:this.screenBounds.y+this.screenBounds.height-i.height}],t=0,s=()=>{if(this.destroyed)return;let n=e[t%e.length];t++;let r=n.x-this.position.x;if(Math.abs(r)>1)this.flipped=r<0;this.setBehavior("run"),this.startMovement(n,this.debugSpeed,s)};s()}setBehavior(i){this.currentBehavior=i,this.onStateChange(this.stateOf(i),this.flipped,!0)}async syncPositionFromWindow(){if(this.destroyed)return;let i;try{i=await b().outerPosition()}catch(e){if(this.destroyed)return;throw e}if(this.destroyed)return;this.position={x:i.x,y:i.y}}async updateScreenBounds(){let i=await fe();if(i.length>0){let e=i[0];this.screenBounds={x:e.position.x,y:e.position.y,width:e.size.width,height:e.size.height}}}startMovement(i,e,t){if(this.isPresenting||this.suspended)return;this.cancelMovement(),this.targetPosition=i,this.moveTimerId=setInterval(()=>{if(this.destroyed||this.isDragging||!this.targetPosition||this.currentBehavior!=="run"){if(this.moveTimerId)clearInterval(this.moveTimerId);this.moveTimerId=null;return}let s=this.targetPosition.x-this.position.x,n=this.targetPosition.y-this.position.y,r=Math.hypot(s,n);if(r<e){if(this.position={...this.targetPosition},this.targetPosition=null,this.moveTimerId)clearInterval(this.moveTimerId),this.moveTimerId=null;if(J(this.position.x,this.position.y),t)t();else this.setBehavior("idle");return}this.position.x+=s/r*e,this.position.y+=n/r*e,J(this.position.x,this.position.y)},16)}cancelMovement(){if(this.moveTimerId)clearInterval(this.moveTimerId),this.moveTimerId=null;if(this.behaviorTimer)clearTimeout(this.behaviorTimer),this.behaviorTimer=null}resetSleepTimer(){if(this.sleepTimer)clearTimeout(this.sleepTimer);if(this.suspended)return;this.sleepTimer=setTimeout(()=>{if(!this.destroyed&&!this.isDragging&&this.currentBehavior==="idle")this.cancelMovement(),this.setBehavior("sleep")},o)}}
|
|
2
|
+
export{K};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{l}from"./chunk-
|
|
1
|
+
import{l}from"./chunk-tvmvzc41.js";var e=["https://static.alwith.ai/","https://static-alwith-ai-dev.tos-ap-southeast-1.bytepluses.com/"],o="x-tos-process=image/format,webp",n=l;function i(t){if(!t)return n;if(!e.some((s)=>t.startsWith(s)))return t;if(t.includes("x-tos-process="))return t;return`${t}${t.includes("?")?"&":"?"}${o}`}
|
|
2
2
|
export{i};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Ke}from"./chunk-tvmvzc41.js";import{C}from"./chunk-x61q358n.js";import{jsxDEV as r}from"react/jsx-dev-runtime";var ae=Ke;function Ae({onVideoStart:e,onDone:o}){return r("div",{className:"absolute inset-0 z-50 overflow-hidden",children:r(C,{src:ae,onFirstFrame:e,onComplete:o,onError:o},void 0,!1,void 0,this)},void 0,!1,void 0,this)}
|
|
2
|
+
export{ae,Ae};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{z,F}from"./chunk-tvmvzc41.js";import{o}from"./chunk-xrw9s1th.js";import{t}from"./chunk-mjsqb1wk.js";import{je}from"./chunk-qd5jhh2h.js";import{Loader2 as r}from"lucide-react";import{jsxDEV as a}from"react/jsx-dev-runtime";function N({amount:e,onAdd:s,loaded:l=!0,disabled:n=!1,className:m}){return a(je,{className:o("flex h-11 w-fit min-w-[137px] flex-row items-center gap-0 rounded-full border-0 bg-[#F4EFFF] px-1.5 py-0 ring-0",m),children:[a("img",{"data-slot":"gem-balance-icon",src:z,alt:"",className:"me-0.5 size-8 shrink-0"},void 0,!1,void 0,this),a("span",{"data-slot":"gem-balance-amount",className:"flex-1 text-start text-xl leading-none font-bold text-[#2A3472] tabular-nums",children:l?e:a(r,{className:"size-4 animate-spin text-[#2A3472]/50"},void 0,!1,void 0,this)},void 0,!1,void 0,this),a(t,{"data-slot":"gem-balance-add",variant:"ghost",className:"ms-[14px] size-8 shrink-0 rounded-full p-0 hover:bg-transparent","aria-label":"Add gems",disabled:n,onClick:s,children:a("img",{"data-slot":"gem-balance-add-icon",src:F,alt:"",className:"size-8"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}
|
|
2
|
+
export{N};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var n=(r)=>{if(r==="R"||r==="SR"||r==="SSR")return r;throw Error(`[vibemon] unsupported draw rarity: ${r}`)},e=(r,a,i)=>{if(r===null)throw Error(`[vibemon] drawn white card at index ${a.draw_index} is missing ${i}`);return r},t=(r)=>({kind:"card",drawIndex:r.draw_index,vibemonUuid:r.vibemon_uuid,vibemonName:r.vibemon_name,singleImageUrl:r.gacha_url??"",multiImageUrl:r.multi_draw_url??"",rarity:n(r.rarity_code),isNew:!r.is_duplicate}),d=(r)=>{if(r==="UC"||r==="C")return r;throw Error(`[vibemon] unsupported white-card rarity: ${r}`)},
|
|
2
|
-
export{
|
|
1
|
+
var n=(r)=>{if(r==="R"||r==="SR"||r==="SSR")return r;throw Error(`[vibemon] unsupported draw rarity: ${r}`)},e=(r,a,i)=>{if(r===null)throw Error(`[vibemon] drawn white card at index ${a.draw_index} is missing ${i}`);return r},t=(r)=>({kind:"card",drawIndex:r.draw_index,vibemonUuid:r.vibemon_uuid,vibemonName:r.vibemon_name,singleImageUrl:r.gacha_url??"",multiImageUrl:r.multi_draw_url??"",rarity:n(r.rarity_code),isNew:!r.is_duplicate}),d=(r)=>{if(r==="UC"||r==="C")return r;throw Error(`[vibemon] unsupported white-card rarity: ${r}`)},Ct=(r)=>{if(r.reward_type!=="WHITE_CARD"){if(!r.vibemon_uuid)throw Error("Vibemon draw result is missing its ID");return t(r)}return{kind:"white-card",drawIndex:r.draw_index,rarity:d(r.rarity_code),exchangePoints:r.exchange_points,singleImageUrl:e(r.gacha_url,r,"gacha_url"),multiImageUrl:e(r.multi_draw_url,r,"multi_draw_url")}};
|
|
2
|
+
export{Ct};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var r=["SSR","SR","R","UC","C"],n=(e)=>{let t=r.indexOf(e);return t===-1?r.length:t};function
|
|
2
|
-
export{
|
|
1
|
+
var r=["SSR","SR","R","UC","C"],n=(e)=>{let t=r.indexOf(e);return t===-1?r.length:t};function Q(e){return[...e].toSorted((t,o)=>n(t.rarity_code)-n(o.rarity_code))}
|
|
2
|
+
export{Q};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{e}from"./chunk-htw56xtp.js";import{K}from"./chunk-gv5he3xg.js";import{he}from"./chunk-mdqxdcxh.js";import{ge}from"./chunk-3vpcfe38.js";import{Lt}from"./chunk-v5akzbxg.js";import{wt}from"./chunk-96emfz6b.js";import{ue}from"./chunk-kwq26qhs.js";import{v}from"./chunk-41jxjz9n.js";import{ce}from"./chunk-1sf9m7x2.js";import{l}from"./chunk-tvmvzc41.js";import{d}from"./chunk-rfxpf1eq.js";import{I}from"./chunk-8nzgysac.js";import{useEffect as x,useEffectEvent as W,useRef as y,useState as u}from"react";import"@alwith/module-auth/pets/lounge-burst.css";import{jsxDEV as E}from"react/jsx-dev-runtime";function Gt(){let i=e(),w=d(),[p,D]=u(null),b=p?.resource??null,[R,T]=u({state:"idle",flipped:!1,tick:0}),[C,S]=u(!0),[V,z]=u(!1),[M,A]=u(0),c=y(null),P=y(0),[o]=u(()=>new ue),[a]=u(()=>new he),[r]=u(()=>new ge((n)=>{i.windows.call("bubble",{visible:n}).catch(i.onError)})),N=W(()=>w.position);x(()=>{if(!w.pet)return;let n=w.pet,t=++P.current;o.begin(n,t),D(null);let f=!1,m=null;return(async()=>{if(m=await v(n),f){m.dispose();return}if(await i.windows.call("resize",{size:m.config.windowSize??ce}),f)return;let s=new K(m.config,(U,X,_)=>{if(f)return;T((O)=>({state:U,flipped:X,tick:O.tick+(_?1:0)}))},()=>{});if(c.current=s,a.attach(s),await s.start(N()),f){s.destroy();return}if(o.positioned(n,t,s),D({resource:m,petId:n,generation:t}),await o.wait(n,Date.now()+15000),!f)await i.windows.call("ready",{petId:n})})().catch((s)=>{if(f||P.current!==t)return;o.fail(n,t,s instanceof Error?s:Error(String(s))),i.onError(s)}),()=>{f=!0,o.invalidate(),a.attach(null),c.current?.destroy(),c.current=null,m?.dispose()}},[w.pet,i,o,a,M]),x(()=>{let n=(t)=>{if(t===null){a.bind(null,!1),r.bind(null,-1);return}a.bind(t.binding.sessionId,t.error!==null,t.binding.bindingRevision),a.update([{sessionId:t.binding.sessionId,state:t.state}],t.source),a.prompt(t.binding.sessionId,t.binding.bindingRevision,t.prompt!==null),r.bind(t.binding.sessionId,t.binding.bindingRevision),r.owner(t.owner),r.update(t.state,t.prompt?.token??null,t.surfaceVisible)};return n(i.sessions.snapshot()),i.sessions.subscribe(n)},[i,a,r]),x(()=>i.windows.commands(async(n)=>{if(n.type==="reload"){if(n.petId!==w.pet)throw Error("The selected pet changed");P.current++,o.reset(),A((t)=>t+1);return}if(n.type==="bubble-open"){r.open();return}if(n.type==="bubble-interact"){r.interact();return}if(n.type==="close"){c.current?.suspend(),S(!1),r.close(),z(!0);try{await i.windows.call("sound"),await new Promise((t)=>setTimeout(t,470)),await i.windows.call("hide")}finally{z(!1)}return}if(n.type==="bubble-close"){r.close();return}if(n.type==="suspend"){c.current?.suspend(),S(!1),r.close(),await i.windows.call("hide");return}S(!0),await wt(o,i.windows,n.petId)}),[i,r,o,w.pet]);let g=y(0),h=y(null);if(b===null)return null;let k=b.config.windowSize??ce;return E("div",{className:"relative flex h-full w-full items-end justify-center select-none",onPointerDown:(n)=>{if(n.button!==0)return;h.current={x:n.screenX,y:n.screenY}},onPointerMove:(n)=>{let t=h.current;if(t===null||Math.hypot(n.screenX-t.x,n.screenY-t.y)<4)return;if(h.current=null,c.current===null)throw Error("The pet engine is unavailable");Lt(i.windows,c.current,n.screenX<t.x).catch(i.onError)},onPointerUp:()=>{h.current=null},onContextMenu:(n)=>{n.preventDefault(),i.windows.call("menu").catch(i.onError)},children:[E("div",{style:{width:k,height:k,visibility:V?"hidden":"visible"},children:E(I,{config:b.config,spriteUrl:b.spriteUrl||l,staticImage:b.staticImage,stateId:R.state,flipped:R.flipped,animTick:R.tick,active:C&&!b.staticImage,onDrawFrame:()=>{if(p!==null)o.drawn(p.petId,p.generation)},onRenderError:(n)=>{if(p!==null)o.fail(p.petId,p.generation,n);i.onError(n)},onMouseDown:()=>{},onClick:()=>{c.current?.handleClick();let n=Date.now();if(n-g.current<350&&n-g.current>50)r.close(),i.sessions.activate().catch(i.onError),g.current=0;else g.current=n}},void 0,!1,void 0,this)},void 0,!1,void 0,this),V&&E("div",{className:"alwith-vibemon-burst pointer-events-none",style:{position:"fixed",left:"50%",bottom:0,width:280,height:280,transform:`translateX(-50%) scale(${k/280})`,transformOrigin:"center bottom",zIndex:20}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}
|
|
2
|
+
export{Gt};
|