PageSourceSearch

https://psicomeet.com.br/assets/UnderwaterGame-ClTwKUMl.js

js psicomeet.com.br collected 2026-10-06 04:38:19 UTC 11,058 bytes, 1 lines download raw bytes

1import{r as f,j as c}from"./react-vendor-CTonDsnR.js";import{Z as Ie,M as ze,W as Ee,p as Re,a as Fe}from"./mediapipe-detector-Dj9zLAjg.js";import{a as I}from"./AudioNarrator-CD8ryrxC.js";import{g as ge}from"./GameMusic-hwMBbJnX.js";import{g as Ae}from"./gameBiometricBridge-CNDraym8.js";import{F as Oe,y as Te,K as je}from"./index-DXYkVaVX.js";import{s as G,g as We}from"./childGameShell-Bgg1A6pH.js";import{_ as be,Z as ee}from"./index-hUiFL0ms.js";import"./agora-rtc-vendor-CXiD3fib.js";import"./vite-helpers-BNgm88M_.js";import"./devicePerformance-mpUqM5QU.js";import"./gameCatalog-CE8IEc1n.js";import"./charts-vendor-UIXnLpfR.js";const Le=ze,_e=Fe.selfieSegmenter,D=256,$=144,U=15;function ye(a,r,b){const S=r.vx>=0?1:-1,v=Math.sin(b*6+r.phase)*.5;a.save(),a.translate(r.x,r.y+Math.sin(b*1.8+r.phase)*6),a.scale(S,1),a.fillStyle=`hsl(${r.hue}, 75%, 55%)`,a.beginPath(),a.moveTo(-r.size*.8,0),a.lineTo(-r.size*1.35,-r.size*(.45+v*.2)),a.lineTo(-r.size*1.35,r.size*(.45-v*.2)),a.closePath(),a.fill();const y=a.createLinearGradient(0,-r.size/2,0,r.size/2);y.addColorStop(0,`hsl(${r.hue}, 85%, 65%)`),y.addColorStop(1,`hsl(${r.hue}, 75%, 45%)`),a.fillStyle=y,a.beginPath(),a.ellipse(0,0,r.size,r.size*.55,0,0,Math.PI*2),a.fill(),a.fillStyle=`hsla(${(r.hue+40)%360}, 80%, 70%, 0.7)`,a.beginPath(),a.ellipse(-r.size*.15,0,r.size*.16,r.size*.5,0,0,Math.PI*2),a.fill(),a.fillStyle="white",a.beginPath(),a.arc(r.size*.5,-r.size*.12,r.size*.16,0,Math.PI*2),a.fill(),a.fillStyle="#111",a.beginPath(),a.arc(r.size*.55,-r.size*.12,r.size*.08,0,Math.PI*2),a.fill(),a.restore()}function z(a,r,b,S,v,y){a.strokeStyle=`hsla(${v}, 60%, 32%, ${y})`,a.lineWidth=10,a.lineCap="round";const x=a.canvas.height;a.beginPath(),a.moveTo(r,x);const E=Math.sin(S*.9+r*.01)*24;a.bezierCurveTo(r-15,x-b*.4,r+15+E,x-b*.7,r+E,x-b),a.stroke()}const Je=({canvasWidth:a,canvasHeight:r,isActive:b,onScore:S,hands:v,videoElement:y})=>{const x=f.useRef(null),[E,q]=f.useState(!0),[Me,te]=f.useState(!1),[V,oe]=f.useState(!0),[ve,ae]=f.useState(0),[re,se]=f.useState(!1),ne=f.useRef(v);f.useEffect(()=>{ne.current=v},[v]);const X=f.useRef(S);f.useEffect(()=>{X.current=S},[S]);const ie=f.useRef(y);return f.useEffect(()=>{ie.current=y},[y]),f.useEffect(()=>{if(!b)return;const R=x.current,e=R?.getContext("2d");if(!R||!e)return;const n=R.width,l=R.height,F=document.createElement("canvas");F.width=D,F.height=$;const Se=F.getContext("2d",{willReadFrequently:!1}),A=document.createElement("canvas");A.width=D,A.height=$;const le=A.getContext("2d"),ce=le.createImageData(D,$),u=document.createElement("canvas"),P=u.getContext("2d");let de=!1,k=null,Y=!1;q(!0),te(!1),(async()=>{try{const m=await Ie.forVisionTasks(Le),s=await Ee.createFromOptions(m,{baseOptions:{modelAssetPath:_e,delegate:Re()},runningMode:"VIDEO",outputConfidenceMasks:!0,outputCategoryMask:!1});if(Y){s.close();return}k=s,q(!1),console.log("🐠 [Underwater] ImageSegmenter pronto")}catch(m){console.warn("⚠️ [Underwater] Segmentação indisponível — modo aquário translúcido:",m),Y||(te(!0),q(!1))}})();const N=Array.from({length:9},(m,s)=>{const d=s<5?"back":"front",M=80+Math.random()*(l-220);return{x:Math.random()*n,y:M,baseY:M,vx:(Math.random()<.5?-1:1)*(30+Math.random()*60)*(d==="front"?1.25:.8),size:d==="back"?16+Math.random()*14:26+Math.random()*22,hue:[15,35,190,280,330,50][s%6]+Math.random()*20,phase:Math.random()*Math.PI*2,layer:d}}),w=[],O=[],T=[];let j=0,W=!1,he=0,fe=0;I.speak("Mergulhamos no fundo do mar! Estoura as bolhas com a mão pra abrir o baú do tesouro!"),ge.start("calm");const xe=setTimeout(()=>oe(!1),6500);let H=0,pe=performance.now(),ue=!1;const me=m=>{if(ue)return;const s=Math.min(.05,(m-pe)/1e3);pe=m;const d=m/1e3,M=ie.current,C=M?.videoWidth||0,Z=M?.videoHeight||0,we=Te(C,Z,n,l);if(fe++,k&&M&&C>0&&fe%2===0)try{Se.drawImage(M,0,0,D,$);const t=k.segmentForVideo(F,Math.round(m)),o=t?.confidenceMasks,i=o&&o.length>1?o[1]:o?.[0];if(i){const h=i.getAsFloat32Array(),g=ce.data;for(let p=0;p<h.length;p++){const Q=h[p],Ce=Q<=.3?0:Q>=.75?255:(Q-.3)/.45*255,B=p*4;g[B]=255,g[B+1]=255,g[B+2]=255,g[B+3]=Ce}le.putImageData(ce,0,0),de=!0}t?.close?.()}catch{}const K=[];for(const t of ne.current.slice(0,2))if(t.landmarks&&t.landmarks.length>=21)for(const o of Oe(t.landmarks))K.push(we(o.x,o.y));const J=We();m-he>(J?1500:950)&&w.length<(J?6:9)&&(he=m,w.push({x:60+Math.random()*(n-120),y:l+40,r:20+Math.random()*18,vy:55+Math.random()*55,sway:Math.random()*Math.PI*2}));for(let t=w.length-1;t>=0;t--){const o=w[t];o.y-=o.vy*s,o.x+=Math.sin(d*2+o.sway)*18*s;let i=!1;for(const h of K)if(Math.hypot(h.x-o.x,h.y-o.y)<o.r+26){i=!0;break}if(i){if(w.splice(t,1),O.push({x:o.x,y:o.y,r:o.r,alpha:1}),j++,ae(j),X.current(5),I.playBubblePop(),Ae.emitEvent("correct_answer",{type:"underwater_bubble",count:j}),!W&&j>=U){W=!0,se(!0),X.current(100),I.playSuccess(),I.speak("O baú do tesouro abriu! Você é um mergulhador incrível!");for(let h=0;h<(J?24:60);h++){const g=Math.random()*Math.PI*2,p=80+Math.random()*280;T.push({x:n*.78,y:l-90,vx:Math.cos(g)*p,vy:Math.sin(g)*p-150,life:.8+Math.random()*.8,maxLife:1.4,hue:40+Math.random()*20})}}}else o.y<-50&&w.splice(t,1)}for(const t of N){for(const i of K){const h=t.x-i.x,g=t.y-i.y,p=Math.hypot(h,g);p<130&&p>1&&(t.vx+=h/p*320*s,t.y+=g/p*140*s)}const o=(t.vx>=0?1:-1)*(t.layer==="front"?55:38);t.vx+=(o-t.vx)*.6*s,t.y+=(t.baseY-t.y)*.4*s,t.x+=t.vx*s,t.x>n+80&&(t.x=-60,t.baseY=80+Math.random()*(l-220)),t.x<-80&&(t.x=n+60,t.baseY=80+Math.random()*(l-220))}const L=de&&!!k;e.clearRect(0,0,n,l);const _=e.createLinearGradient(0,0,0,l);_.addColorStop(0,L?"#0a5c8f":"rgba(10,92,143,0.55)"),_.addColorStop(.6,L?"#064066":"rgba(6,64,102,0.55)"),_.addColorStop(1,L?"#031f36":"rgba(3,31,54,0.6)"),e.fillStyle=_,e.fillRect(0,0,n,l),e.globalCompositeOperation="lighter";for(let t=0;t<3;t++){const o=n*(.2+t*.3)+Math.sin(d*.3+t)*60,i=e.createLinearGradient(o,0,o+120,l);i.addColorStop(0,"rgba(180,230,255,0.10)"),i.addColorStop(1,"rgba(180,230,255,0)"),e.fillStyle=i,e.beginPath(),e.moveTo(o-40,0),e.lineTo(o+60,0),e.lineTo(o+220,l),e.lineTo(o-140,l),e.closePath(),e.fill()}e.globalCompositeOperation="source-over",z(e,n*.08,180,d,150,.8),z(e,n*.16,130,d+1,140,.7),z(e,n*.9,160,d+2,155,.8);for(const t of N)t.layer==="back"&&ye(e,t,d);if(L&&M&&C>0){u.width!==640&&(u.width=640,u.height=Math.round(640*Z/C)||360),P.clearRect(0,0,u.width,u.height),P.drawImage(M,0,0,u.width,u.height),P.globalCompositeOperation="destination-in",P.imageSmoothingEnabled=!0,P.drawImage(A,0,0,u.width,u.height),P.globalCompositeOperation="source-over";const{dx:t,dy:o,dw:i,dh:h}=je(C,Z,n,l);e.save(),e.translate(n,0),e.scale(-1,1),e.drawImage(u,t,o,i,h),e.restore(
1)}const Pe=n*.78,ke=l-70;if(e.save(),e.translate(Pe,ke),e.fillStyle="#7c3f12",e.strokeStyle="#4a2409",e.lineWidth=4,e.beginPath(),e.roundRect(-55,-30,110,55,8),e.fill(),e.stroke(),e.save(),e.translate(0,-30),e.rotate(W?-.9:0),e.fillStyle="#8b4a16",e.beginPath(),e.roundRect(-55,-26,110,28,8),e.fill(),e.stroke(),e.restore(),W){e.globalCompositeOperation="lighter";const t=e.createRadialGradient(0,-30,0,0,-30,90);t.addColorStop(0,"rgba(255,215,80,0.8)"),t.addColorStop(1,"rgba(255,215,80,0)"),e.fillStyle=t,e.fillRect(-90,-120,180,140),e.globalCompositeOperation="source-over",e.font="26px sans-serif",e.textAlign="center",e.fillText("💰",0,-34)}else e.fillStyle="#fbbf24",e.beginPath(),e.arc(0,-14,7,0,Math.PI*2),e.fill();e.restore(),z(e,n*.28,110,d+3,145,.95),z(e,n*.68,140,d+4,150,.95);for(const t of N)t.layer==="front"&&ye(e,t,d);for(const t of w)e.strokeStyle="rgba(220,245,255,0.85)",e.lineWidth=2.5,e.fillStyle="rgba(190,235,255,0.16)",e.beginPath(),e.arc(t.x,t.y,t.r,0,Math.PI*2),e.fill(),e.stroke(),e.fillStyle="rgba(255,255,255,0.55)",e.beginPath(),e.arc(t.x-t.r*.35,t.y-t.r*.35,t.r*.22,0,Math.PI*2),e.fill();for(let t=O.length-1;t>=0;t--){const o=O[t];if(o.r+=220*s,o.alpha-=2.4*s,o.alpha<=0){O.splice(t,1);continue}e.strokeStyle=`rgba(220,245,255,${o.alpha})`,e.lineWidth=3,e.beginPath(),e.arc(o.x,o.y,o.r,0,Math.PI*2),e.stroke()}e.globalCompositeOperation="lighter";for(let t=T.length-1;t>=0;t--){const o=T[t];if(o.life-=s,o.life<=0){T.splice(t,1);continue}o.vy+=260*s,o.x+=o.vx*s,o.y+=o.vy*s;const i=o.life/o.maxLife;e.globalAlpha=i,e.fillStyle=`hsl(${o.hue}, 95%, 62%)`,e.beginPath(),e.arc(o.x,o.y,5*(.4+i),0,Math.PI*2),e.fill()}e.globalAlpha=1,e.globalCompositeOperation="source-over",H=requestAnimationFrame(me)};return H=requestAnimationFrame(me),()=>{ue=!0,Y=!0,cancelAnimationFrame(H),clearTimeout(xe);try{k?.close()}catch{}I.stop(),ge.stop(),oe(!0),ae(0),se(!1)}},[b]),c.jsxs("div",{style:{position:"relative",width:a,height:r,overflow:"hidden",zIndex:45},children:[c.jsx("canvas",{ref:x,width:a,height:r,style:{display:"block",pointerEvents:"none"}}),!V&&c.jsxs("div",{style:{position:"absolute",top:G.top(70),right:G.right(20),padding:"10px 18px",borderRadius:999,background:"rgba(3,31,54,0.7)",backdropFilter:"blur(10px)",border:"2px solid rgba(180,230,255,0.35)",fontFamily:"'Baloo 2', sans-serif",fontSize:18,fontWeight:800,color:"white"},children:["🫧 ",Math.min(ve,U),"/",U," ",re?"· 💰 aberto!":""]}),E&&c.jsx("div",{style:{position:"absolute",bottom:G.bottom(24),left:"50%",transform:"translateX(-50%)",padding:"8px 20px",borderRadius:999,background:"rgba(3,31,54,0.75)",fontFamily:"'Nunito', sans-serif",fontSize:14,fontWeight:700,color:"#bae6fd",pointerEvents:"none"},children:"🤿 Preparando o mergulho…"}),Me&&!V&&c.jsx("div",{style:{position:"absolute",bottom:G.bottom(24),left:"50%",transform:"translateX(-50%)",padding:"8px 20px",borderRadius:999,background:"rgba(3,31,54,0.75)",fontFamily:"'Nunito', sans-serif",fontSize:13,fontWeight:700,color:"#bae6fd",pointerEvents:"none"},children:"🌊 Modo aquário (sem recorte) — estoura as bolhas!"}),c.jsx(be,{children:V&&c.jsxs(ee.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},style:{position:"absolute",top:"22%",left:"50%",transform:"translateX(-50%)",padding:"16px 30px",borderRadius:26,background:"rgba(3,31,54,0.82)",border:"2px solid rgba(180,230,255,0.4)",backdropFilter:"blur(12px)",fontFamily:"'Baloo 2', sans-serif",fontSize:20,fontWeight:700,color:"white",textAlign:"center",maxWidth:460,pointerEvents:"none"},children:["🐠 Você mergulhou no oceano!",c.jsx("br",{}),c.jsxs("span",{style:{fontSize:15,color:"#bae6fd"},children:["Estoura ",U," bolhas com a mão 🫧",c.jsx("br",{}),"pra abrir o baú do tesouro 💰"]})]})}),c.jsx(be,{children:re&&c.jsxs(ee.div,{initial:{opacity:0,scale:.7},animate:{opacity:1,scale:1},exit:{opacity:0},transition:{type:"spring"},style:{position:"absolute",top:"28%",left:"50%",transform:"translateX(-50%)",textAlign:"center",pointerEvents:"none"},children:[c.jsx(ee.div,{animate:{y:[0,-12,0],rotate:[0,6,-6,0]},transition:{duration:1.6,repeat:1/0},style:{fontSize:76,filter:"drop-shadow(0 0 26px gold)"},children:"💰"}),c.jsx("div",{style:{fontFamily:"'Baloo 2', sans-serif",fontSize:28,fontWeight:900,color:"white",textShadow:"0 0 20px gold"},children:"Tesouro encontrado! +100"})]})})]})};export{Je as UnderwaterGame,Je as default};

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