playsout-web-sdk 1.0.62 → 1.0.63

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.
Files changed (102) hide show
  1. package/README.md +206 -366
  2. package/dist/arrow-DVB3ZH4I.png +0 -0
  3. package/dist/bofang-7CYHXAOR.png +0 -0
  4. package/dist/chunk-DXJDUM6W.js +2 -0
  5. package/dist/chunk-FQSZP2MS.cjs +2 -0
  6. package/dist/chunk-GZLJ3BX5.js +1929 -0
  7. package/dist/chunk-RBKA52ZP.cjs +1929 -0
  8. package/dist/chunk-VZ5ZVHY4.js +2 -0
  9. package/dist/chunk-ZWHQXIXN.cjs +2 -0
  10. package/dist/clock-UCOJBATJ.png +0 -0
  11. package/dist/comment-CYSCAN7M.png +0 -0
  12. package/dist/config.d.ts +2 -0
  13. package/dist/config.d.ts.map +1 -0
  14. package/{core → dist/core}/api.d.ts +1 -5
  15. package/dist/core/api.d.ts.map +1 -0
  16. package/{core → dist/core}/errors.d.ts +1 -4
  17. package/dist/core/errors.d.ts.map +1 -0
  18. package/{core → dist/core}/events.d.ts +1 -9
  19. package/{core → dist/core}/events.d.ts.map +1 -1
  20. package/{core → dist/core}/index.d.ts.map +1 -1
  21. package/{core → dist/core}/storage.d.ts +0 -1
  22. package/{core → dist/core}/storage.d.ts.map +1 -1
  23. package/{core → dist/core}/types.d.ts +2 -37
  24. package/dist/core/types.d.ts.map +1 -0
  25. package/dist/data/games.d.ts +3 -0
  26. package/dist/data/games.d.ts.map +1 -0
  27. package/dist/fenxiang-SHOVHZII.png +0 -0
  28. package/dist/index.cjs +1 -0
  29. package/{index.d.ts → dist/index.d.ts} +1 -1
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.global.js +1929 -0
  32. package/dist/index.iife.js +1929 -0
  33. package/{index.js → dist/index.js} +1 -1
  34. package/dist/like-UTHO5POC.png +0 -0
  35. package/dist/live-like-4WE6H52V.png +0 -0
  36. package/dist/next-T6TSGXOI.png +0 -0
  37. package/dist/react/PlaysoutVideoWidget.d.ts +16 -0
  38. package/dist/react/PlaysoutVideoWidget.d.ts.map +1 -0
  39. package/dist/react/index.cjs +1 -0
  40. package/{react → dist/react}/index.d.ts +2 -0
  41. package/dist/react/index.d.ts.map +1 -0
  42. package/dist/react/index.js +1 -0
  43. package/dist/share-2WNZMMZ6.png +0 -0
  44. package/dist/shoucang-CSI3UBYK.png +0 -0
  45. package/dist/shuqian-KOBOMTMJ.png +0 -0
  46. package/dist/shuqian1-VMWYGXP3.png +0 -0
  47. package/dist/vue/PlaysoutVideoWidget.d.ts +31 -0
  48. package/dist/vue/PlaysoutVideoWidget.d.ts.map +1 -0
  49. package/{vue → dist/vue}/composable.d.ts +4 -2
  50. package/{vue → dist/vue}/composable.d.ts.map +1 -1
  51. package/dist/vue/index.cjs +1 -0
  52. package/{vue → dist/vue}/index.d.ts +1 -0
  53. package/dist/vue/index.d.ts.map +1 -0
  54. package/dist/vue/index.js +1 -0
  55. package/dist/web-components/PlaysoutVideoWidget.d.ts +59 -0
  56. package/dist/web-components/PlaysoutVideoWidget.d.ts.map +1 -0
  57. package/{web-components → dist/web-components}/PlaysoutWidget.d.ts +6 -3
  58. package/dist/web-components/PlaysoutWidget.d.ts.map +1 -0
  59. package/dist/web-components/index.cjs +1 -0
  60. package/dist/web-components/index.d.ts +5 -0
  61. package/dist/web-components/index.d.ts.map +1 -0
  62. package/dist/web-components/index.js +1 -0
  63. package/package.json +77 -63
  64. package/chunk-EZLO3WY6.js +0 -2
  65. package/chunk-MDSUYVLI.cjs +0 -2
  66. package/chunk-Z2CIDSTP.cjs +0 -2
  67. package/chunk-Z5PDR5PA.js +0 -2
  68. package/core/api.d.ts.map +0 -1
  69. package/core/errors.d.ts.map +0 -1
  70. package/core/types.d.ts.map +0 -1
  71. package/data/games.d.ts +0 -30
  72. package/data/games.d.ts.map +0 -1
  73. package/index.cjs +0 -1
  74. package/index.d.ts.map +0 -1
  75. package/index.global.js +0 -1546
  76. package/index.iife.js +0 -1546
  77. package/react/index.cjs +0 -1
  78. package/react/index.d.ts.map +0 -1
  79. package/react/index.js +0 -1
  80. package/vue/index.cjs +0 -1
  81. package/vue/index.d.ts.map +0 -1
  82. package/vue/index.js +0 -1
  83. package/web-components/PlaysoutWidget.d.ts.map +0 -1
  84. package/web-components/imageCache.d.ts +0 -13
  85. package/web-components/imageCache.d.ts.map +0 -1
  86. package/web-components/index.cjs +0 -1546
  87. package/web-components/index.d.ts +0 -3
  88. package/web-components/index.d.ts.map +0 -1
  89. package/web-components/index.js +0 -1546
  90. /package/{core → dist/core}/index.d.ts +0 -0
  91. /package/{iife-entry.d.ts → dist/iife-entry.d.ts} +0 -0
  92. /package/{iife-entry.d.ts.map → dist/iife-entry.d.ts.map} +0 -0
  93. /package/{public-api.d.ts → dist/public-api.d.ts} +0 -0
  94. /package/{public-api.d.ts.map → dist/public-api.d.ts.map} +0 -0
  95. /package/{react → dist/react}/context.d.ts +0 -0
  96. /package/{react → dist/react}/context.d.ts.map +0 -0
  97. /package/{vue → dist/vue}/plugin.d.ts +0 -0
  98. /package/{vue → dist/vue}/plugin.d.ts.map +0 -0
  99. /package/{web-components → dist/web-components}/PrivyBridge.d.ts +0 -0
  100. /package/{web-components → dist/web-components}/PrivyBridge.d.ts.map +0 -0
  101. /package/{web-components → dist/web-components}/assetUrl.d.ts +0 -0
  102. /package/{web-components → dist/web-components}/assetUrl.d.ts.map +0 -0
@@ -0,0 +1,1929 @@
1
+ "use strict";var __PlaysoutBundle=(()=>{var H=Object.defineProperty;var Ge=Object.getOwnPropertyDescriptor;var $e=Object.getOwnPropertyNames;var He=Object.prototype.hasOwnProperty;var Ke=(o,t)=>{for(var e in t)H(o,e,{get:t[e],enumerable:!0})},je=(o,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of $e(t))!He.call(o,a)&&a!==e&&H(o,a,{get:()=>t[a],enumerable:!(i=Ge(t,a))||i.enumerable});return o};var Ve=o=>je(H({},"__esModule",{value:!0}),o);var ei={};Ke(ei,{Login:()=>Bt,PlaysoutSDKClass:()=>Jt,destroy:()=>zt,getCategories:()=>Ft,getGames:()=>qt,getLocale:()=>Vt,getToken:()=>$t,getUser:()=>Kt,getUserInfo:()=>Ht,init:()=>Nt,instance:()=>Xt,isInitialized:()=>Yt,isLoggedIn:()=>Qt,logout:()=>Gt,mount:()=>Ut,off:()=>Zt,on:()=>Wt,setLocale:()=>jt,unmount:()=>Ot});var y=class extends Error{constructor(e,i,a){super(i);this.code=e;this.details=a;this.name="SDKError"}toJSON(){return{name:this.name,code:this.code,message:this.message,details:this.details}}},qe={NOT_INITIALIZED:"SDK not initialized. Please call PlaysoutSDK.init() first.",ALREADY_INITIALIZED:"SDK already initialized. Please do not call init() more than once.",NOT_LOGGED_IN:"User not logged in. Please log in first.",TOKEN_EXPIRED:"Login token has expired. Please log in again.",NETWORK_ERROR:"Network connection failed. Please check your network.",TIMEOUT:"Request timed out. Please try again later.",SERVER_ERROR:"Server is busy. Please try again later.",API_ERROR:"API request failed.",INVALID_PARAMS:"Invalid parameter(s).",MISSING_PARAMS:"Missing required parameter(s).",FEATURE_NOT_SUPPORTED:"This feature is not supported in the current environment.",UNKNOWN:"An unknown error occurred."};function u(o,t){return new y(o,qe[o],t)}var A="playsout_",L=class{constructor(t){this.storage=t}get(t){try{return this.storage.getItem(A+t)}catch{return null}}set(t,e){try{this.storage.setItem(A+t,e)}catch(i){console.warn("[PlaysoutSDK] Storage set failed:",i)}}remove(t){try{this.storage.removeItem(A+t)}catch{}}clear(){try{let t=[];for(let e=0;e<this.storage.length;e++){let i=this.storage.key(e);i&&i.startsWith(A)&&t.push(i)}t.forEach(e=>this.storage.removeItem(e))}catch{}}},K=class{constructor(){this.store=new Map}get(t){return this.store.get(t)??null}set(t,e){this.store.set(t,e)}remove(t){this.store.delete(t)}clear(){this.store.clear()}};function ie(o="localStorage"){return typeof window>"u"||o==="memory"?new K:o==="sessionStorage"?new L(sessionStorage):new L(localStorage)}var v=ie(),p={get:o=>v.get(o),set:(o,t)=>{v.set(o,t)},remove:o=>{v.remove(o)},clear:()=>{v.clear()},getJSON:o=>{let t=v.get(o);if(!t)return null;try{return JSON.parse(t)}catch{return null}},setJSON:(o,t)=>{v.set(o,JSON.stringify(t))},configure(o){v=ie(o)}},m={TOKEN_DATA:"token_data",USER:"user",LOGIN_PARAMS:"login_params",LOCALE:"locale"};var j=class{constructor(){this.events=new Map}on(t,e){return this.events.has(t)||this.events.set(t,new Set),this.events.get(t).add(e),()=>{this.off(t,e)}}once(t,e){let i=a=>{e(a),this.off(t,i)};return this.on(t,i)}off(t,e){this.events.get(t)?.delete(e),this.events.get(t)?.size===0&&this.events.delete(t)}emit(t,e){this.events.get(t)?.forEach(i=>{try{i(e)}catch(a){console.error(`[PlaysoutSDK] Event handler error for "${t}":`,a)}})}clear(){this.events.clear()}},f=new j;var Fe="https://games.playsout.com/resources/icon/image";function l(o){if(!o||/^(data:|https?:|blob:)/i.test(o))return o;let t=o.replace(/^\.\//,"");return`${Fe}/${t}`}var We=o=>{if(!o)return o;try{let t=new URL(o);if(t.hostname==="games.playsout.com"){let e=t.pathname,i=e.endsWith("/"),a=/\.[a-z0-9]+$/i.test(e);!i&&!a&&(t.pathname=`${e}/`)}return t.toString()}catch{return o}},Ze=o=>o.map(t=>{if(!t.externalUrl)return t;let e=We(t.externalUrl);return e===t.externalUrl?t:{...t,externalUrl:e}}),Ye=[{id:"BlockCrushFun",title:"Block Crush Fun",category:"Puzzle",image:l("./games/BlockCrushFun.png"),isNew:!0,isHot:!0,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/BlockCrushFun/"},{id:"KittyEscape",title:"Kitty Escape",category:"Puzzle",image:l("./games/KittyEscape.jpg"),isNew:!0,isHot:!0,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/KittyEscape/"},{id:"ProjectGarden",title:"Project: Garden",category:"Adventure",image:l("./games/SimulatedAdventures.jpg"),isNew:!0,isHot:!1,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/simulated/"},{id:"ProjectIDLE",title:"Project: IDLE",category:"Simulation",image:l("./games/ProjectIDLE.jpg"),isNew:!0,isHot:!0,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/idle/"},{id:"SoccerDASH",title:"Soccer Dash",category:"Arcade",image:l("./games/Soccer Dash.jpg"),isNew:!0,isHot:!1,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/SoccerDASH/"},{id:"SoccerSurvivor",title:"Soccer Survivor",category:"Arcade",image:l("./games/SoccerSurvivor.jpg"),isNew:!0,isHot:!1,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/SoccerSurvivors/"},{id:"CulinaryStarWeb",title:"Culinary Star",category:"Casual",image:l("./games/CulinaryStar.webp"),description:"Cooking game",isNew:!1,isHot:!0,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/CulinaryStar/"},{id:"PickaxeQuest",title:"Pickaxe Quest",category:"Adventure",image:l("./games/PickaxeQuest.jpg"),description:"Mining and adventure game",isNew:!0,isHot:!1,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/PickaxeQuest/",apiGameId:73},{id:"MonsterSurvivors",title:"Monster Survivors",category:"Adventure",image:l("./games/MonsterSurvivors.jpg"),isNew:!1,isHot:!0,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/MonsterSurvivors/"},{id:"IdleTowerDefense",title:"Idle Tower Defense",category:"RPG",image:l("./games/IdleTowerDefense.jpg"),isNew:!0,isHot:!1,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/IdleTowerDefense/"},{id:"MushroomWarriors",title:"Mushroom Warriors",category:"RPG",image:l("./games/MushroomWarriors.jpg"),isNew:!0,isHot:!1,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/MushroomWarriors/"},{id:"FollowThePath",title:"Follow The Path",category:"Arcade",image:l("./games/FollowThePath.jpg"),isNew:!1,isHot:!0,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/FollowThePath/"},{id:"SoccerCascade",title:"Soccer Cascade",category:"Arcade",image:l("./games/Soccer Cascade.jpg"),isNew:!0,isHot:!1,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/SoccerCascade/"},{id:"CatDelta",title:"Cat Delta",category:"Adventure",image:l("./games/CatDelta.jpg"),isNew:!0,isHot:!1,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/CatDelta/"},{id:"ColorRun",title:"Color Run",category:"Arcade",image:l("./games/ColorRun.jpg"),isNew:!1,isHot:!1,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/ColorRun/"},{id:"SoccerZombies",title:"Soccer vs. Zombies",category:"Tower Defense",image:l("./games/Soccer vs. Zombies.jpg"),isNew:!0,isHot:!1,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/SoccerZombies/"},{id:"MiniSoccer",title:"Mini Soccer",category:"Arcade",image:l("./games/minisoccer.jpg"),isNew:!0,isHot:!1,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/minisoccer/"},{id:"SoccerMaze",title:"Soccer Maze",category:"Arcade",image:l("./games/Soccer Maze.jpg"),isNew:!0,isHot:!1,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/SoccerMaze/"},{id:"StupidArrow",title:"Stupid Arrow",category:"Arcade",image:l("./games/StupidArrow.jpg"),isNew:!1,isHot:!0,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/StupidArrow/"},{id:"ZigZag",title:"Zig Zag",category:"Arcade",image:l("./games/ZigZag.jpg"),isNew:!1,isHot:!0,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/ZigZag/"},{id:"SpikesEverywhere",title:"Spikes Everywhere",category:"Arcade",image:l("./games/SpikesEverywhere.jpg"),isNew:!0,isHot:!1,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/SpikesEverywhere/"},{id:"ArrowRacer",title:"Arrow Racer",category:"Arcade",image:l("./games/ArrowRacer.jpg"),isNew:!0,isHot:!1,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/ArrowRacer/"},{id:"CircleLeap",title:"Circle Leap",category:"Arcade",image:l("./games/CircleLeap.jpg"),isNew:!0,isHot:!1,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/CircleLeap/"},{id:"ColorMatcher",title:"Color Matcher",category:"Arcade",image:l("./games/ColorMatcher.jpg"),isNew:!1,isHot:!1,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/ColorMatcher/"},{id:"EndlessMaze",title:"Endless Maze",category:"Arcade",image:l("./games/EndlessMaze.jpg"),isNew:!0,isHot:!1,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/EndlessMaze/"},{id:"SpinningAround",title:"Spinning Around",category:"Arcade",image:l("./games/SpinningAround.jpg"),isNew:!0,isHot:!1,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/SpinningAround/"},{id:"BoomBallz",title:"Boom Ballz",category:"Arcade",image:l("./games/BoomBallz.jpg"),isNew:!1,isHot:!0,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/BoomBallz/"},{id:"CubeHead",title:"Cube Head",category:"Arcade",image:l("./games/CubeHead.jpg"),isNew:!1,isHot:!0,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/CubeHead/"},{id:"CapybaraLink",title:"Capybara Link",category:"Puzzle",image:l("./games/CapybaraLink.jpg"),isNew:!0,isHot:!1,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/CapybaraLink/"},{id:"Snake2048",title:"Snake 2048",category:"Puzzle",image:l("./games/Snake2048.jpg"),isNew:!0,isHot:!0,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/Snake2048/"},{id:"FishTankFury",title:"Fish Tank Fury",category:"Puzzle",image:l("./games/FishTankFury.jpg"),isNew:!0,isHot:!1,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/FishTankFury/"},{id:"ConnectBalls",title:"Connect Balls",category:"Arcade",image:l("./games/ConnectBalls.jpg"),isNew:!0,isHot:!1,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/ConnectBalls/"},{id:"CircularBreaker",title:"Circular Breaker",category:"Arcade",image:l("./games/CircularBreaker.jpg"),isNew:!0,isHot:!1,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/CircularBreaker/"},{id:"OneDoor",title:"One Door",category:"Arcade",image:l("./games/OneDoor.jpg"),isNew:!0,isHot:!1,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/OneDoor/"},{id:"CatchtheFruits",title:"Catch the Fruits",category:"Casual",image:l("./games/CatchtheFruits.jpg"),isNew:!0,isHot:!1,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/CatchtheFruits/"},{id:"Falling2048",title:"Falling 2048",category:"Casual",image:l("./games/Falling2048.jpg"),isNew:!0,isHot:!1,enable:!0,orientation:"portrait",externalUrl:"https://games.playsout.com/grab/Falling2048/"}],Qe=Ze(Ye),Xe=o=>o.enable!==!1&&o.isEnabled!==!1,R=()=>Qe.filter(Xe);var Y="https://api.playsout.com",Q=3e4;function et(o){let t=String(o?.platform||"").toLowerCase();if(t==="tiktok"){let e=o.authorizationCode;if(typeof e!="string"||!e.trim())throw u("MISSING_PARAMS","authorizationCode is required for TikTok login");return{platform:t,authorizationCode:e}}if(t==="grab"||t==="eros"){let e=o;if(typeof e.platformUserId!="string"||!e.platformUserId.trim())throw u("MISSING_PARAMS","platformUserId is required for Grab/Eros login");if(typeof e.platformToken!="string"||!e.platformToken.trim())throw u("MISSING_PARAMS","platformToken is required for Grab/Eros login");if(typeof e.username!="string"||!e.username.trim())throw u("MISSING_PARAMS","username is required for Grab/Eros login");return{platform:t,platformUserId:e.platformUserId,platformToken:e.platformToken,username:e.username,inviteCode:typeof e.inviteCode=="string"?e.inviteCode:void 0}}throw u("INVALID_PARAMS","Unsupported platform. Expected grab, eros, or tiktok")}var T=null,q=null,F=null,W=null;function ne(o){q=o}function se(o){F=o}function le(o){W=o}function ae(){if(W)try{W()}catch{}}async function tt(o){if(!F)throw ae(),o instanceof y?o:u("TOKEN_EXPIRED",o);try{return await F()}catch(t){throw ae(),t instanceof y?t:u("TOKEN_EXPIRED",t)}}async function re(o,t={},e,i=!1,a=i){let r=e?.apiBaseUrl||Y,n=o.startsWith("http")?o:`${r}${o}`,s=new AbortController,g=setTimeout(()=>s.abort(),Q);try{let c=p.getJSON(m.TOKEN_DATA),h={"Content-Type":"application/json",...t.headers};i&&c?.accessToken&&!h.token&&(h.token=c.accessToken);let b=await fetch(n,{...t,signal:s.signal,headers:h});if(clearTimeout(g),!b.ok){if(b.status===401&&i&&a)return await oe(o,t,e);throw u(b.status>=500?"SERVER_ERROR":"API_ERROR",`HTTP ${b.status}: ${b.statusText}`)}let E=await b.json();if(E.code!==1e4){if(i&&a)return await oe(o,t,e);throw u("API_ERROR",E.msg||"API request failed")}return E.data}catch(c){throw clearTimeout(g),c instanceof y?c:c instanceof Error?c.name==="AbortError"?u("TIMEOUT"):u("NETWORK_ERROR",c.message):u("UNKNOWN")}}async function oe(o,t,e){await de(e);let i=e?.apiBaseUrl||Y,a=o.startsWith("http")?o:`${i}${o}`,r=new AbortController,n=setTimeout(()=>r.abort(),Q);try{let s=p.getJSON(m.TOKEN_DATA),g={"Content-Type":"application/json",...t.headers};s?.accessToken&&(g.token=s.accessToken);let c=await fetch(a,{...t,signal:r.signal,headers:g});if(clearTimeout(n),!c.ok)throw u(c.status>=500?"SERVER_ERROR":"API_ERROR",`HTTP ${c.status}: ${c.statusText}`);let h=await c.json();if(h.code!==1e4)throw u("API_ERROR",h.msg||"API request failed");return h.data}catch(s){throw clearTimeout(n),s instanceof y?s:s instanceof Error&&s.name==="AbortError"?u("TIMEOUT"):u("NETWORK_ERROR",s?.message||"Request failed")}}async function de(o){if(T)return T;let t=(async()=>{try{let e=p.getJSON(m.TOKEN_DATA),i=Math.floor(Date.now()/1e3);if(!e?.refreshToken||e.refreshExpiresAt<=i)throw u("TOKEN_EXPIRED","Refresh token has expired");let a=o?.apiBaseUrl||Y,r=new AbortController,n=setTimeout(()=>r.abort(),Q);try{let s=await fetch(`${a}/platform/refreshToken`,{method:"POST",signal:r.signal,headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e.refreshToken})});if(clearTimeout(n),!s.ok)throw s.status>=500?u("SERVER_ERROR",`HTTP ${s.status}: ${s.statusText}`):u("TOKEN_EXPIRED",`HTTP ${s.status}: ${s.statusText}`);let g=await s.json();if(g.code!==1e4||!g.data)throw u("TOKEN_EXPIRED",g.msg||"Failed to refresh token");let c=g.data;if(p.setJSON(m.TOKEN_DATA,c),q)try{q(c)}catch{}return c}catch(s){throw clearTimeout(n),s instanceof y?s:s instanceof Error&&s.name==="AbortError"?u("TIMEOUT"):u("NETWORK_ERROR",s?.message||"Refresh token failed")}}catch(e){return await tt(e)}})();T=t;try{return await t}finally{T===t&&(T=null)}}var Z=class{constructor(){this.config=null}configure(t){this.config=t}async refreshToken(){return await de(this.config||void 0)}async loginOnly(t){let e=et(t);return await re("/platform/login",{method:"POST",body:JSON.stringify(e)},this.config??void 0)}async Login(t){let e=await this.loginOnly(t);p.setJSON(m.TOKEN_DATA,e);try{let i=await this.getUserInfo(!1);return{tokenData:e,user:i}}catch(i){throw p.remove(m.TOKEN_DATA),p.remove(m.USER),i}}async getUserInfo(t=!0){return await re("/platform/user",{method:"GET"},this.config??void 0,!0,t)}async getUser(){return p.getJSON(m.USER)}async validateToken(t){return!!t}},V=null;function D(){return V||(V=new Z),V}var at="https://api.playsout.com",ce="zh",S=class o{constructor(){this.config=null;this._isInitialized=!1;this._user=null;this._token=null;this._locale=ce;this._widget=null}clearAuthState(){let t=!!(this._token||p.get(m.TOKEN_DATA)||p.get(m.USER));return this._user=null,this._token=null,p.remove(m.TOKEN_DATA),p.remove(m.USER),p.remove(m.LOGIN_PARAMS),t}updateUser(t){this._user={userId:String(t.id),username:t.username},p.setJSON(m.USER,this._user)}saveLoginParams(t){if(t.platform==="grab"||t.platform==="eros"){p.setJSON(m.LOGIN_PARAMS,{...t});return}p.remove(m.LOGIN_PARAMS)}async performLogin(t,e){let i=D();i.configure(this.config);let a=await i.loginOnly(t);p.setJSON(m.TOKEN_DATA,a);let r=await i.getUserInfo(!1);return this._token=a.accessToken,this.updateUser(r),e&&this.saveLoginParams(t),f.emit("login",{user:this._user,token:this._token}),{tokenData:a,user:r}}async recoverAuthentication(){let t=p.getJSON(m.LOGIN_PARAMS);if(!t||t.platform!=="grab"&&t.platform!=="eros")throw u("TOKEN_EXPIRED","No reusable login parameters available");return(await this.performLogin(t,!1)).tokenData}handleAuthExpired(){this.clearAuthState()&&f.emit("authExpired"),this.config?.debug&&console.warn("[PlaysoutSDK] Auth expired, logged out")}static getInstance(){return o.instance||(o.instance=new o),o.instance}async init(t={}){if(this._isInitialized)throw u("ALREADY_INITIALIZED");this.config={apiBaseUrl:t.apiBaseUrl||at,debug:t.debug||!1,storage:t.storage||"localStorage",locale:t.locale||ce},p.configure(this.config.storage),ne(a=>{this._token=a.accessToken}),se(()=>this.recoverAuthentication()),le(()=>{this.handleAuthExpired()});let e=p.getJSON(m.TOKEN_DATA);this._user=p.getJSON(m.USER),this._locale=p.get(m.LOCALE)||this.config.locale;let i=Math.floor(Date.now()/1e3);if(e){let a=D();if(a.configure(this.config),e.accessToken&&e.expiresAt>i?this._token=e.accessToken:await a.refreshToken(),this._token&&!this._user){let r=await a.getUserInfo();this.updateUser(r)}}else this._user&&(this._user=null,p.remove(m.USER));this._isInitialized=!0,this.config.debug&&(console.log("[PlaysoutSDK] Initialized with config:",this.config),console.log("[PlaysoutSDK] Restored token:",this._token?this._token.substring(0,20)+"...":"(none)")),f.emit("initialized")}destroy(){this.config=null,this._isInitialized=!1,this._user=null,this._token=null,p.clear(),f.clear()}get isInitialized(){return this._isInitialized}get isLoggedIn(){return!!(this._token&&this._user)}get user(){return this._user}get token(){return this._token}get locale(){return this._locale}get sdkConfig(){return this.config}async Login(t){this.ensureInitialized(),this.config?.debug&&console.log("[PlaysoutSDK] Login with params:",t);try{let e=await this.performLogin(t,!0);return this.config?.debug&&console.log("[PlaysoutSDK] Login success, user:",e.user),e}catch(e){throw this.clearAuthState(),e}}async getUserInfo(){if(this.ensureInitialized(),!this.isLoggedIn)throw u("NOT_LOGGED_IN","Please login first");let t=D();t.configure(this.config);let e=await t.getUserInfo();return this.config?.debug&&console.log("[PlaysoutSDK] getUserInfo result:",e),e&&this.updateUser(e),e}logout(){this.clearAuthState(),f.emit("logout")}getToken(){return this.ensureInitialized(),this._token}getUser(){return this.ensureInitialized(),this._user}setLocale(t){if(this.ensureInitialized(),!["zh","en","ja","ko","vi","th","id","ms"].includes(t))throw u("INVALID_PARAMS",`Unsupported locale: ${t}`);this._locale=t,p.set(m.LOCALE,t),this.config?.debug&&console.log("[PlaysoutSDK] Locale changed to:",t);let e=this._widget||document.querySelector("playsout-widget");e&&e.getAttribute("locale")!==t&&e.setAttribute("locale",t),f.emit("localeChange",t)}getLocale(){return this.ensureInitialized(),this._locale}async getGames(t){this.ensureInitialized();let e=R();if(t?.category&&(e=e.filter(i=>i.category===t.category)),t?.search){let i=t.search.toLowerCase();e=e.filter(a=>a.title.toLowerCase().includes(i)||a.category.toLowerCase().includes(i)||a.description&&a.description.toLowerCase().includes(i))}if(t?.sortBy)switch(t.sortBy){case"newest":e=e.filter(i=>i.isNew).concat(e.filter(i=>!i.isNew));break;case"rating":e=e.filter(i=>i.isHot).concat(e.filter(i=>!i.isHot));break}if(t?.page&&t?.pageSize){let i=(t.page-1)*t.pageSize;e=e.slice(i,i+t.pageSize)}return e}async getCategories(){this.ensureInitialized();let t=R(),e=new Map;return t.forEach(i=>{if(!i.category)return;let a=e.get(i.category)||0;e.set(i.category,a+1)}),Array.from(e.entries()).map(([i,a])=>({id:i,name:i,count:a}))}async getGameById(t){return this.ensureInitialized(),R().find(e=>e.id===t)}mount(t,e){if(this.ensureInitialized(),typeof document>"u")throw u("FEATURE_NOT_SUPPORTED","mount requires DOM environment");let i=document.querySelector(t);if(!i)throw u("INVALID_PARAMS",`Container not found: ${t}`);let a=document.createElement("playsout-widget");a.setAttribute("locale",e?.locale||this._locale),e?.detailMode&&a.setAttribute("detail-mode",e.detailMode),this._widget=a,e?.onGameClick&&a.addEventListener("game-click",r=>{let n=r;e.onGameClick(n.detail)}),e?.onLoginRequired&&a.addEventListener("login-required",e.onLoginRequired),e?.onLocaleChange&&a.addEventListener("locale-change",r=>{let n=r;e.onLocaleChange(n.detail)}),i.appendChild(a),this.config?.debug&&console.log("[PlaysoutSDK] Widget mounted to:",t)}unmount(){let t=document.querySelector("playsout-widget");t&&t.remove(),this._widget=null}on(t,e){return this.ensureInitialized(),f.on(t,e)}off(t,e){this.ensureInitialized(),f.off(t,e)}ensureInitialized(){if(!this._isInitialized)throw u("NOT_INITIALIZED")}},d=S.getInstance();typeof window<"u"&&(window.__playsout_sdk_instance=d);var C=Object.freeze({init:d.init.bind(d),mount:d.mount.bind(d),unmount:d.unmount.bind(d),destroy:d.destroy.bind(d),Login:d.Login.bind(d),logout:d.logout.bind(d),getToken:d.getToken.bind(d),getUserInfo:d.getUserInfo.bind(d),getUser:d.getUser.bind(d),setLocale:d.setLocale.bind(d),getLocale:d.getLocale.bind(d),getGames:d.getGames.bind(d),getCategories:d.getCategories.bind(d),on:d.on.bind(d),off:d.off.bind(d),get isInitialized(){return d.isInitialized},get isLoggedIn(){return d.isLoggedIn},instance:d,PlaysoutSDKClass:S});var X="privy-bridge";var M="DIAMOND",rt="2025.01";var ot=()=>`host-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,x=o=>typeof o!="string"||o.length>128?"":o,nt=o=>{let t=Number(o);return!Number.isSafeInteger(t)||t<=0?0:t},_=class{constructor(t){this.orders=new Map;this.pendingPayment=null;this.attached=!1;this.options=t,this.handleMessage=this.handleMessage.bind(this)}attach(){this.attached||typeof window>"u"||(window.addEventListener("message",this.handleMessage),this.attached=!0)}detach(){!this.attached||typeof window>"u"||(window.removeEventListener("message",this.handleMessage),this.attached=!1,this.cancelPendingPayment({code:"USER_CANCELLED",message:"Host view closed"}))}cancelPendingPayment(t={code:"USER_CANCELLED",message:"Payment cancelled"}){if(!this.pendingPayment)return;let e=this.pendingPayment;this.pendingPayment=null,this.updateOrderStatus(e.order.hostOrderId,"cancelled"),this.sendError(e.request,t)}handleMessage(t){let e=this.options.getIframe();if(!e?.contentWindow||t.source!==e.contentWindow)return;let i=this.getGameOrigin();if(!i||t.origin!==i)return;let a=t.data;if(this.isValidRequest(a))switch(a.method){case"bridge.handshake":this.handleHandshake(a);return;case"auth.getUser":this.handleGetUser(a);return;case"pay.createOrder":this.handleCreateOrder(a);return;case"pay.request":this.handlePaymentRequest(a);return;case"pay.query":this.handlePaymentQuery(a);return;default:this.sendError(a,{code:"INVALID_METHOD",message:"Unsupported method"})}}isValidRequest(t){return!!(t&&t.channel===X&&t.type==="request"&&typeof t.id=="string"&&t.id.length>0&&t.id.length<=128&&typeof t.method=="string"&&t.method.length>0&&t.method.length<=128)}getGameOrigin(){let t=this.options.getGameUrl();if(!t||typeof window>"u")return"";try{return new URL(t,window.location.href).origin}catch{return""}}postToGame(t){let e=this.options.getIframe(),i=this.getGameOrigin();!e?.contentWindow||!i||e.contentWindow.postMessage(t,i)}sendResponse(t,e){this.postToGame({channel:X,version:"1.0",type:"response",id:t.id,method:t.method,payload:e})}sendError(t,e){this.postToGame({channel:X,version:"1.0",type:"response",id:t.id,method:t.method,error:e})}handleHandshake(t){this.sendResponse(t,{hostVersion:rt,capabilities:["auth.getUser","pay.createOrder","pay.request","pay.query"],capabilitiesDetail:{auth:{methods:["account"],scopes:["basic"]},pay:{methods:["balance"],currency:M,flow:["createOrder","request"]}},config:{currency:M}})}handleGetUser(t){let e=this.options.getUser();if(!e){this.sendError(t,{code:"AUTH_REQUIRED",message:"User not logged in"});return}this.sendResponse(t,{uid:e.uid,nickname:e.nickname,avatarUrl:e.avatarUrl||"",locale:this.options.getLocale(),roles:["player"]})}handleCreateOrder(t){let e=t.payload||{},i=x(e.orderId),a=x(e.productId),r=nt(e.amount);if(!i||!r){this.sendError(t,{code:"INVALID_REQUEST",message:"Invalid order payload"});return}let n=ot(),s=Math.floor((Date.now()+6e5)/1e3),g={orderId:i,hostOrderId:n,amount:r,currency:M,productId:a,status:"created",expiresAt:s};this.orders.set(n,g),this.sendResponse(t,{orderId:i,hostOrderId:n,amount:r,currency:M,productId:a,expiresAt:s})}async handlePaymentRequest(t){let e=t.payload||{},i=x(e.orderId),a=x(e.hostOrderId);if(!i||!a){this.sendError(t,{code:"INVALID_REQUEST",message:"Missing orderId or hostOrderId"});return}if(this.pendingPayment){this.sendError(t,{code:"PAYMENT_PENDING",message:"Payment already in progress"});return}let r=this.orders.get(a);if(!r||r.orderId!==i){this.sendError(t,{code:"INVALID_REQUEST",message:"Order not found"});return}if(r.status==="success"){this.sendError(t,{code:"ORDER_ALREADY_PAID",message:"Order already paid"});return}if(r.expiresAt<=Math.floor(Date.now()/1e3)){this.updateOrderStatus(a,"expired"),this.sendError(t,{code:"ORDER_EXPIRED",message:"Order expired"});return}this.updateOrderStatus(a,"pending"),this.pendingPayment={request:t,order:r};let n=await this.options.requestPayment({orderId:r.orderId,hostOrderId:r.hostOrderId,amount:r.amount,currency:r.currency,productId:r.productId});if(this.pendingPayment?.request.id===t.id){if(this.pendingPayment=null,n.status==="success"){this.updateOrderStatus(a,"success"),this.sendResponse(t,{success:!0,orderId:i,hostOrderId:a,balance:n.balance});return}this.updateOrderStatus(a,n.status==="insufficient"?"created":"cancelled"),this.sendError(t,{code:n.status==="insufficient"?"INSUFFICIENT_BALANCE":"USER_CANCELLED",message:n.status==="insufficient"?"Insufficient balance":"User cancelled payment"})}}handlePaymentQuery(t){let e=t.payload||{},i=x(e.hostOrderId),a=x(e.orderId),r;if(i?r=this.orders.get(i):a&&(r=Array.from(this.orders.values()).find(n=>n.orderId===a)),!r){this.sendError(t,{code:"INVALID_REQUEST",message:"Order not found"});return}this.sendResponse(t,{orderId:r.orderId,hostOrderId:r.hostOrderId,amount:r.amount,currency:r.currency,status:r.status,expiresAt:r.expiresAt})}updateOrderStatus(t,e){let i=this.orders.get(t);i&&this.orders.set(t,{...i,status:e})}};var N={home:{searchPlaceholder:"Search by title or category",noGames:"No games found"},profile:{title:"Profile",settings:"Settings",language:"Language",guest:"Guest",languages:{en:"English",zh:"\u4E2D\u6587",ja:"\u65E5\u672C\u8A9E",ko:"\uD55C\uAD6D\uC5B4",th:"\u0E44\u0E17\u0E22",vi:"Ti\u1EBFng Vi\u1EC7t",id:"Bahasa Indonesia",ms:"Bahasa Melayu",es:"Espa\xF1ol"}},categories:{All:"All",Adventure:"Adventure",Simulation:"Simulation",Casual:"Casual",Arcade:"Arcade",Moba:"Moba",Puzzle:"Puzzle",RPG:"RPG","Tower Defense":"Tower Defense"},game:{header:{back:"Back"}},store:{title:"Gem Store",hot:"HOT",buy:"BUY",cancel:"Cancel",unit:"Gems",successTitle:"Payment Successful",successMessage:"You received {amount} gems!"},payment:{title:"Confirm Purchase",description:"Spend {amount} gems for this in-game item?",amountLabel:"{amount} gems",balance:"Current balance: {balance} gems",insufficientTitle:"Insufficient Balance",insufficientMessage:"Current balance is {balance} gems. This purchase needs {amount} gems.",cancel:"Cancel",confirm:"Confirm",successTitle:"Payment Successful",successMessage:"{amount} gems have been deducted."},video:{title:"Micro Dramas",editorsChoice:"EDITOR'S CHOICE",popular:"Popular Releases",updatedToday:"Updated Today",liveAction:"Live-Action",motionComics:"AI Motion Comics",hot:"HOT",watch:"Watch",watchEpisode:"Watch Episode 1",episodes:"episodes",like:"Like",favorite:"Favorite",share:"Share",next:"NEXT",close:"Close",playVideo:"Play video",pauseVideo:"Pause video",videoProgress:"Video progress",unlockTitle:"Unlock Next Episode",adUnlockSubtitle:"Watch a short ad to unlock the next episode.",cancel:"Cancel",watchAd:"Watch Ad",loadingAd:"Loading ad...",adKeyMissing:"Add an AppLixir API key to enable ad unlocks.",adUnavailable:"No ad is available right now. Please try again later.",adIncomplete:"Watch the full ad to unlock this episode.",neonDreams:"Neon Dreams: City of Secrets",neonDreamsDescription:"A high-stakes thriller where digital shadows come to life",loveUnderStars:"Love Under Stars",loveUnderStarsDescription:"A chance meeting leads to a cosmic romance",ceoSecretHeir:"CEO's Secret Heir",ceoSecretHeirDescription:"Intrigue and power struggles in a corporate empire",neonShadows:"Neon Shadows",neonShadowsDescription:"A hacker steals a memory she was never meant to have",lastPercent:"The Last 0.1%",lastPercentDescription:"Every person is born with a survival percentage"}};var U={home:{searchPlaceholder:"\u6309\u6807\u9898\u6216\u7C7B\u522B\u641C\u7D22",noGames:"\u672A\u627E\u5230\u6E38\u620F"},profile:{title:"\u4E2A\u4EBA\u4E2D\u5FC3",settings:"\u8BBE\u7F6E",language:"\u8BED\u8A00",guest:"\u6E38\u5BA2",languages:{en:"English",zh:"\u4E2D\u6587",ja:"\u65E5\u672C\u8A9E",ko:"\uD55C\uAD6D\uC5B4",th:"\u0E44\u0E17\u0E22",vi:"Ti\u1EBFng Vi\u1EC7t",id:"Bahasa Indonesia",ms:"Bahasa Melayu",es:"Espa\xF1ol"}},categories:{All:"\u5168\u90E8",Adventure:"\u5192\u9669",Simulation:"\u6A21\u62DF",Casual:"\u4F11\u95F2",Arcade:"\u8857\u673A",Moba:"MOBA",Puzzle:"\u76CA\u667A",RPG:"\u89D2\u8272\u626E\u6F14","Tower Defense":"\u5854\u9632"},game:{header:{back:"\u8FD4\u56DE"}},store:{title:"\u5B9D\u77F3\u5546\u5E97",hot:"\u70ED\u95E8",buy:"\u8D2D\u4E70",cancel:"\u53D6\u6D88",unit:"\u5B9D\u77F3",successTitle:"\u652F\u4ED8\u6210\u529F",successMessage:"\u60A8\u83B7\u5F97\u4E86 {amount} \u5B9D\u77F3\uFF01"},payment:{title:"\u786E\u8BA4\u8D2D\u4E70",description:"\u662F\u5426\u6D88\u8017 {amount} \u5B9D\u77F3\u8D2D\u4E70\u8BE5\u6E38\u620F\u9053\u5177\uFF1F",amountLabel:"{amount} \u5B9D\u77F3",balance:"\u5F53\u524D\u4F59\u989D\uFF1A{balance} \u5B9D\u77F3",insufficientTitle:"\u4F59\u989D\u4E0D\u8DB3",insufficientMessage:"\u5F53\u524D\u4F59\u989D\u4E3A {balance} \u5B9D\u77F3\uFF0C\u672C\u6B21\u8D2D\u4E70\u9700\u8981 {amount} \u5B9D\u77F3\u3002",cancel:"\u53D6\u6D88",confirm:"\u786E\u8BA4",successTitle:"\u652F\u4ED8\u6210\u529F",successMessage:"\u5DF2\u6263\u9664 {amount} \u5B9D\u77F3\u3002"},video:{title:"\u7CBE\u5F69\u77ED\u5267",editorsChoice:"\u7F16\u8F91\u7CBE\u9009",popular:"\u70ED\u95E8\u4E0A\u7EBF",updatedToday:"\u4ECA\u65E5\u66F4\u65B0",liveAction:"\u771F\u4EBA\u77ED\u5267",motionComics:"AI \u52A8\u6001\u6F2B",hot:"\u70ED\u95E8",watch:"\u89C2\u770B",watchEpisode:"\u89C2\u770B\u7B2C 1 \u96C6",episodes:"\u96C6",like:"\u70B9\u8D5E",favorite:"\u6536\u85CF",share:"\u5206\u4EAB",next:"\u4E0B\u4E00\u96C6",close:"\u5173\u95ED",playVideo:"\u64AD\u653E\u89C6\u9891",pauseVideo:"\u6682\u505C\u89C6\u9891",videoProgress:"\u89C6\u9891\u8FDB\u5EA6",unlockTitle:"\u89E3\u9501\u4E0B\u4E00\u96C6",adUnlockSubtitle:"\u89C2\u770B\u4E00\u6BB5\u5E7F\u544A\u5373\u53EF\u89E3\u9501\u4E0B\u4E00\u96C6\u3002",cancel:"\u53D6\u6D88",watchAd:"\u89C2\u770B\u5E7F\u544A",loadingAd:"\u5E7F\u544A\u52A0\u8F7D\u4E2D...",adKeyMissing:"\u8BF7\u914D\u7F6E AppLixir API Key \u540E\u4F7F\u7528\u5E7F\u544A\u89E3\u9501\u3002",adUnavailable:"\u5F53\u524D\u6682\u65E0\u53EF\u7528\u5E7F\u544A\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",adIncomplete:"\u5B8C\u6574\u89C2\u770B\u5E7F\u544A\u540E\u624D\u80FD\u89E3\u9501\u672C\u96C6\u3002",neonDreams:"\u9713\u8679\u68A6\u5883\uFF1A\u79D8\u5BC6\u4E4B\u57CE",neonDreamsDescription:"\u6570\u5B57\u9634\u5F71\u82CF\u9192\uFF0C\u4E00\u573A\u9AD8\u98CE\u9669\u60CA\u609A\u6545\u4E8B\u5C31\u6B64\u5C55\u5F00",loveUnderStars:"\u661F\u7A7A\u4E0B\u7684\u7231\u604B",loveUnderStarsDescription:"\u4E00\u6B21\u5076\u7136\u76F8\u9047\uFF0C\u5F00\u542F\u8DE8\u8D8A\u661F\u6CB3\u7684\u6D6A\u6F2B",ceoSecretHeir:"\u603B\u88C1\u7684\u79D8\u5BC6\u7EE7\u627F\u4EBA",ceoSecretHeirDescription:"\u5546\u4E1A\u5E1D\u56FD\u4E2D\u7684\u9634\u8C0B\u4E0E\u6743\u529B\u4E89\u593A",neonShadows:"\u9713\u8679\u6697\u5F71",neonShadowsDescription:"\u4E00\u540D\u9ED1\u5BA2\u5077\u8D70\u4E86\u672C\u4E0D\u8BE5\u62E5\u6709\u7684\u8BB0\u5FC6",lastPercent:"\u6700\u540E\u7684 0.1%",lastPercentDescription:"\u6BCF\u4E2A\u4EBA\u51FA\u751F\u65F6\u90FD\u62E5\u6709\u4E00\u4E2A\u751F\u5B58\u6982\u7387"}};var ue={home:{searchPlaceholder:"\u30BF\u30A4\u30C8\u30EB\u307E\u305F\u306F\u30AB\u30C6\u30B4\u30EA\u3067\u691C\u7D22",noGames:"\u30B2\u30FC\u30E0\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093"},profile:{title:"\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB",settings:"\u8A2D\u5B9A",language:"\u8A00\u8A9E",guest:"\u30B2\u30B9\u30C8",languages:{en:"English",zh:"\u4E2D\u6587",ja:"\u65E5\u672C\u8A9E",ko:"\uD55C\uAD6D\uC5B4",th:"\u0E44\u0E17\u0E22",vi:"Ti\u1EBFng Vi\u1EC7t",id:"Bahasa Indonesia",ms:"Bahasa Melayu",es:"Espa\xF1ol"}},categories:{All:"\u3059\u3079\u3066",Adventure:"\u30A2\u30C9\u30D9\u30F3\u30C1\u30E3\u30FC",Simulation:"\u30B7\u30DF\u30E5\u30EC\u30FC\u30B7\u30E7\u30F3",Casual:"\u30AB\u30B8\u30E5\u30A2\u30EB",Arcade:"\u30A2\u30FC\u30B1\u30FC\u30C9",Moba:"MOBA",Puzzle:"\u30D1\u30BA\u30EB",RPG:"RPG","Tower Defense":"\u30BF\u30EF\u30FC\u30C7\u30A3\u30D5\u30A7\u30F3\u30B9"},game:{header:{back:"\u623B\u308B"}},store:{title:"\u30B8\u30A7\u30E0\u30B9\u30C8\u30A2",hot:"HOT",buy:"\u8CFC\u5165",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",unit:"\u30B8\u30A7\u30E0",successTitle:"\u652F\u6255\u3044\u5B8C\u4E86",successMessage:"{amount}\u30B8\u30A7\u30E0\u3092\u53D7\u3051\u53D6\u308A\u307E\u3057\u305F\uFF01"},payment:{title:"\u8CFC\u5165\u78BA\u8A8D",description:"\u3053\u306E\u30B2\u30FC\u30E0\u5185\u30A2\u30A4\u30C6\u30E0\u306B {amount} \u30B8\u30A7\u30E0\u3092\u4F7F\u7528\u3057\u307E\u3059\u304B\uFF1F",amountLabel:"{amount} \u30B8\u30A7\u30E0",balance:"\u73FE\u5728\u306E\u6B8B\u9AD8: {balance} \u30B8\u30A7\u30E0",insufficientTitle:"\u6B8B\u9AD8\u4E0D\u8DB3",insufficientMessage:"\u73FE\u5728\u306E\u6B8B\u9AD8\u306F {balance} \u30B8\u30A7\u30E0\u3067\u3059\u3002\u3053\u306E\u8CFC\u5165\u306B\u306F {amount} \u30B8\u30A7\u30E0\u304C\u5FC5\u8981\u3067\u3059\u3002",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",confirm:"\u78BA\u8A8D",successTitle:"\u652F\u6255\u3044\u5B8C\u4E86",successMessage:"{amount} \u30B8\u30A7\u30E0\u304C\u5DEE\u3057\u5F15\u304B\u308C\u307E\u3057\u305F\u3002"}};var ge={home:{searchPlaceholder:"\uC81C\uBAA9 \uB610\uB294 \uCE74\uD14C\uACE0\uB9AC\uB85C \uAC80\uC0C9",noGames:"\uAC8C\uC784\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4"},profile:{title:"\uD504\uB85C\uD544",settings:"\uC124\uC815",language:"\uC5B8\uC5B4",guest:"\uC190\uB2D8",languages:{en:"English",zh:"\u4E2D\u6587",ja:"\u65E5\u672C\u8A9E",ko:"\uD55C\uAD6D\uC5B4",th:"\u0E44\u0E17\u0E22",vi:"Ti\u1EBFng Vi\u1EC7t",id:"Bahasa Indonesia",ms:"Bahasa Melayu",es:"Espa\xF1ol"}},categories:{All:"\uC804\uCCB4",Adventure:"\uC5B4\uB4DC\uBCA4\uCC98",Simulation:"\uC2DC\uBBAC\uB808\uC774\uC158",Casual:"\uCE90\uC8FC\uC5BC",Arcade:"\uC544\uCF00\uC774\uB4DC",Moba:"MOBA",Puzzle:"\uD37C\uC990",RPG:"RPG","Tower Defense":"\uD0C0\uC6CC \uB514\uD39C\uC2A4"},game:{header:{back:"\uB4A4\uB85C"}},store:{title:"\uBCF4\uC11D \uC0C1\uC810",hot:"\uC778\uAE30",buy:"\uAD6C\uB9E4",cancel:"\uCDE8\uC18C",unit:"\uBCF4\uC11D",successTitle:"\uACB0\uC81C \uC131\uACF5",successMessage:"{amount}\uAC1C\uC758 \uBCF4\uC11D\uC744 \uBC1B\uC558\uC2B5\uB2C8\uB2E4!"},payment:{title:"\uAD6C\uB9E4 \uD655\uC778",description:"\uC774 \uAC8C\uC784 \uC544\uC774\uD15C\uC5D0 \uBCF4\uC11D {amount}\uAC1C\uB97C \uC0AC\uC6A9\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?",amountLabel:"\uBCF4\uC11D {amount}\uAC1C",balance:"\uD604\uC7AC \uC794\uC561: \uBCF4\uC11D {balance}\uAC1C",insufficientTitle:"\uC794\uC561 \uBD80\uC871",insufficientMessage:"\uD604\uC7AC \uC794\uC561\uC740 \uBCF4\uC11D {balance}\uAC1C\uC785\uB2C8\uB2E4. \uC774 \uAD6C\uB9E4\uC5D0\uB294 \uBCF4\uC11D {amount}\uAC1C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.",cancel:"\uCDE8\uC18C",confirm:"\uD655\uC778",successTitle:"\uACB0\uC81C \uC131\uACF5",successMessage:"\uBCF4\uC11D {amount}\uAC1C\uAC00 \uCC28\uAC10\uB418\uC5C8\uC2B5\uB2C8\uB2E4."}};var pe={home:{searchPlaceholder:"\u0E04\u0E49\u0E19\u0E2B\u0E32\u0E15\u0E32\u0E21\u0E0A\u0E37\u0E48\u0E2D\u0E2B\u0E23\u0E37\u0E2D\u0E2B\u0E21\u0E27\u0E14\u0E2B\u0E21\u0E39\u0E48",noGames:"\u0E44\u0E21\u0E48\u0E1E\u0E1A\u0E40\u0E01\u0E21"},profile:{title:"\u0E42\u0E1B\u0E23\u0E44\u0E1F\u0E25\u0E4C",settings:"\u0E01\u0E32\u0E23\u0E15\u0E31\u0E49\u0E07\u0E04\u0E48\u0E32",language:"\u0E20\u0E32\u0E29\u0E32",guest:"\u0E1C\u0E39\u0E49\u0E40\u0E22\u0E35\u0E48\u0E22\u0E21\u0E0A\u0E21",languages:{en:"English",zh:"\u4E2D\u6587",ja:"\u65E5\u672C\u8A9E",ko:"\uD55C\uAD6D\uC5B4",th:"\u0E44\u0E17\u0E22",vi:"Ti\u1EBFng Vi\u1EC7t",id:"Bahasa Indonesia",ms:"Bahasa Melayu",es:"Espa\xF1ol"}},categories:{All:"\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14",Adventure:"\u0E1C\u0E08\u0E0D\u0E20\u0E31\u0E22",Simulation:"\u0E08\u0E33\u0E25\u0E2D\u0E07\u0E2A\u0E16\u0E32\u0E19\u0E01\u0E32\u0E23\u0E13\u0E4C",Casual:"\u0E41\u0E04\u0E0A\u0E0A\u0E27\u0E25",Arcade:"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E04\u0E14",Moba:"\u0E42\u0E21\u0E1A\u0E32",Puzzle:"\u0E1B\u0E23\u0E34\u0E28\u0E19\u0E32",RPG:"RPG","Tower Defense":"\u0E1B\u0E49\u0E2D\u0E07\u0E01\u0E31\u0E19\u0E2B\u0E2D\u0E04\u0E2D\u0E22"},game:{header:{back:"\u0E01\u0E25\u0E31\u0E1A"}},store:{title:"\u0E23\u0E49\u0E32\u0E19\u0E04\u0E49\u0E32\u0E2D\u0E31\u0E0D\u0E21\u0E13\u0E35",hot:"\u0E21\u0E32\u0E41\u0E23\u0E07",buy:"\u0E0B\u0E37\u0E49\u0E2D",cancel:"\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01",unit:"\u0E2D\u0E31\u0E0D\u0E21\u0E13\u0E35",successTitle:"\u0E0A\u0E33\u0E23\u0E30\u0E40\u0E07\u0E34\u0E19\u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08",successMessage:"\u0E04\u0E38\u0E13\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A {amount} \u0E2D\u0E31\u0E0D\u0E21\u0E13\u0E35!"},payment:{title:"\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E01\u0E32\u0E23\u0E0B\u0E37\u0E49\u0E2D",description:"\u0E43\u0E0A\u0E49 {amount} \u0E2D\u0E31\u0E0D\u0E21\u0E13\u0E35\u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E0B\u0E37\u0E49\u0E2D\u0E44\u0E2D\u0E40\u0E17\u0E21\u0E43\u0E19\u0E40\u0E01\u0E21\u0E19\u0E35\u0E49\u0E2B\u0E23\u0E37\u0E2D\u0E44\u0E21\u0E48?",amountLabel:"{amount} \u0E2D\u0E31\u0E0D\u0E21\u0E13\u0E35",balance:"\u0E22\u0E2D\u0E14\u0E04\u0E07\u0E40\u0E2B\u0E25\u0E37\u0E2D\u0E1B\u0E31\u0E08\u0E08\u0E38\u0E1A\u0E31\u0E19: {balance} \u0E2D\u0E31\u0E0D\u0E21\u0E13\u0E35",insufficientTitle:"\u0E22\u0E2D\u0E14\u0E04\u0E07\u0E40\u0E2B\u0E25\u0E37\u0E2D\u0E44\u0E21\u0E48\u0E1E\u0E2D",insufficientMessage:"\u0E22\u0E2D\u0E14\u0E04\u0E07\u0E40\u0E2B\u0E25\u0E37\u0E2D\u0E1B\u0E31\u0E08\u0E08\u0E38\u0E1A\u0E31\u0E19\u0E04\u0E37\u0E2D {balance} \u0E2D\u0E31\u0E0D\u0E21\u0E13\u0E35 \u0E01\u0E32\u0E23\u0E0B\u0E37\u0E49\u0E2D\u0E19\u0E35\u0E49\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E0A\u0E49 {amount} \u0E2D\u0E31\u0E0D\u0E21\u0E13\u0E35",cancel:"\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01",confirm:"\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19",successTitle:"\u0E0A\u0E33\u0E23\u0E30\u0E40\u0E07\u0E34\u0E19\u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08",successMessage:"\u0E2B\u0E31\u0E01 {amount} \u0E2D\u0E31\u0E0D\u0E21\u0E13\u0E35\u0E41\u0E25\u0E49\u0E27"}};var me={home:{searchPlaceholder:"T\xECm ki\u1EBFm theo ti\xEAu \u0111\u1EC1 ho\u1EB7c danh m\u1EE5c",noGames:"Kh\xF4ng t\xECm th\u1EA5y tr\xF2 ch\u01A1i"},profile:{title:"H\u1ED3 s\u01A1",settings:"C\xE0i \u0111\u1EB7t",language:"Ng\xF4n ng\u1EEF",guest:"Kh\xE1ch",languages:{en:"English",zh:"\u4E2D\u6587",ja:"\u65E5\u672C\u8A9E",ko:"\uD55C\uAD6D\uC5B4",th:"\u0E44\u0E17\u0E22",vi:"Ti\u1EBFng Vi\u1EC7t",id:"Bahasa Indonesia",ms:"Bahasa Melayu",es:"Espa\xF1ol"}},categories:{All:"T\u1EA5t c\u1EA3",Adventure:"Phi\xEAu l\u01B0u",Simulation:"M\xF4 ph\u1ECFng",Casual:"Ph\u1ED5 th\xF4ng",Arcade:"Arcade",Moba:"Moba",Puzzle:"Gi\u1EA3i \u0111\u1ED1",RPG:"RPG","Tower Defense":"Th\u1EE7 th\xE0nh"},game:{header:{back:"Quay l\u1EA1i"}},store:{title:"C\u1EEDa h\xE0ng \u0110\xE1 qu\xFD",hot:"HOT",buy:"MUA",cancel:"H\u1EE7y",unit:"\u0110\xE1 qu\xFD",successTitle:"Thanh to\xE1n th\xE0nh c\xF4ng",successMessage:"B\u1EA1n \u0111\xE3 nh\u1EADn \u0111\u01B0\u1EE3c {amount} \u0111\xE1 qu\xFD!"},payment:{title:"X\xE1c nh\u1EADn mua",description:"D\xF9ng {amount} \u0111\xE1 qu\xFD \u0111\u1EC3 mua v\u1EADt ph\u1EA9m trong game n\xE0y?",amountLabel:"{amount} \u0111\xE1 qu\xFD",balance:"S\u1ED1 d\u01B0 hi\u1EC7n t\u1EA1i: {balance} \u0111\xE1 qu\xFD",insufficientTitle:"S\u1ED1 d\u01B0 kh\xF4ng \u0111\u1EE7",insufficientMessage:"S\u1ED1 d\u01B0 hi\u1EC7n t\u1EA1i l\xE0 {balance} \u0111\xE1 qu\xFD. Giao d\u1ECBch n\xE0y c\u1EA7n {amount} \u0111\xE1 qu\xFD.",cancel:"H\u1EE7y",confirm:"X\xE1c nh\u1EADn",successTitle:"Thanh to\xE1n th\xE0nh c\xF4ng",successMessage:"\u0110\xE3 tr\u1EEB {amount} \u0111\xE1 qu\xFD."}};var he={home:{searchPlaceholder:"Cari berdasarkan judul atau kategori",noGames:"Game tidak ditemukan"},profile:{title:"Profil",settings:"Pengaturan",language:"Bahasa",guest:"Tamu",languages:{en:"English",zh:"\u4E2D\u6587",ja:"\u65E5\u672C\u8A9E",ko:"\uD55C\uAD6D\uC5B4",th:"\u0E44\u0E17\u0E22",vi:"Ti\u1EBFng Vi\u1EC7t",id:"Bahasa Indonesia",ms:"Bahasa Melayu",es:"Espa\xF1ol"}},categories:{All:"Semua",Adventure:"Petualangan",Simulation:"Simulasi",Casual:"Kasual",Arcade:"Arcade",Moba:"Moba",Puzzle:"Teka-teki",RPG:"RPG","Tower Defense":"Pertahanan Menara"},game:{header:{back:"Kembali"}},store:{title:"Toko Permata",hot:"HOT",buy:"BELI",cancel:"Batal",unit:"Permata",successTitle:"Pembayaran Berhasil",successMessage:"Anda menerima {amount} permata!"},payment:{title:"Konfirmasi Pembelian",description:"Gunakan {amount} permata untuk membeli item game ini?",amountLabel:"{amount} permata",balance:"Saldo saat ini: {balance} permata",insufficientTitle:"Saldo Tidak Cukup",insufficientMessage:"Saldo saat ini {balance} permata. Pembelian ini membutuhkan {amount} permata.",cancel:"Batal",confirm:"Konfirmasi",successTitle:"Pembayaran Berhasil",successMessage:"{amount} permata telah dikurangi."}};var fe={home:{searchPlaceholder:"Cari mengikut tajuk atau kategori",noGames:"Tiada permainan dijumpai"},profile:{title:"Profil",settings:"Tetapan",language:"Bahasa",guest:"Pelawat",languages:{en:"English",zh:"\u4E2D\u6587",ja:"\u65E5\u672C\u8A9E",ko:"\uD55C\uAD6D\uC5B4",th:"\u0E44\u0E17\u0E22",vi:"Ti\u1EBFng Vi\u1EC7t",id:"Bahasa Indonesia",ms:"Bahasa Melayu",es:"Espa\xF1ol"}},categories:{All:"Semua",Adventure:"Pengembaraan",Simulation:"Simulasi",Casual:"Santai",Arcade:"Arked",Moba:"Moba",Puzzle:"Teka-teki",RPG:"RPG","Tower Defense":"Pertahanan Menara"},game:{header:{back:"Kembali"}},store:{title:"Kedai Permata",hot:"HOT",buy:"BELI",cancel:"Batal",unit:"Permata",successTitle:"Pembayaran Berjaya",successMessage:"Anda menerima {amount} permata!"},payment:{title:"Sahkan Pembelian",description:"Gunakan {amount} permata untuk membeli item permainan ini?",amountLabel:"{amount} permata",balance:"Baki semasa: {balance} permata",insufficientTitle:"Baki Tidak Mencukupi",insufficientMessage:"Baki semasa ialah {balance} permata. Pembelian ini memerlukan {amount} permata.",cancel:"Batal",confirm:"Sahkan",successTitle:"Pembayaran Berjaya",successMessage:"{amount} permata telah ditolak."}};var O=o=>typeof window>"u"?o:l(o),ht="https://games.playsout.com/resources/icon/fonts",z=o=>{if(typeof window>"u")return o;let t=o.replace(/^\.\//,"");return`${ht}/${t}`},I={en:N,zh:U,ja:ue,ko:ge,th:pe,vi:me,id:he,ms:fe};function J(o,t){let e=t.split("."),i=o;for(let a of e)if(i&&typeof i=="object"&&a in i)i=i[a];else return t;return typeof i=="string"?i:t}function be(o,t={}){return o.replace(/\{(\w+)\}/g,(e,i)=>String(t[i]??`{${i}}`))}var ye=`
2
+ :root {
3
+ --playsout-primary: #6366f1;
4
+ --playsout-bg: #0f1419;
5
+ --playsout-bg-card: #1e2a3a;
6
+ --playsout-text: #f8fafc;
7
+ --playsout-text-muted: #94a3b8;
8
+ --playsout-border: #334155;
9
+ --playsout-radius: 8px;
10
+ --playsout-padding: 12px;
11
+ }
12
+
13
+ /* Adelle Sans \u5B57\u4F53 */
14
+ @font-face {
15
+ font-family: "Adelle Sans";
16
+ src: url('${z("./AdelleSans-Regular.woff2")}') format('woff2'),
17
+ url('${z("./AdelleSans-Regular.woff")}') format('woff');
18
+ font-style: normal;
19
+ font-display: swap;
20
+ font-weight: 300;
21
+ }
22
+ @font-face {
23
+ font-family: "Adelle Sans";
24
+ src: url('${z("./AdelleSans-Semibold.woff2")}') format('woff2'),
25
+ url('${z("./AdelleSans-Semibold.woff")}') format('woff');
26
+ font-style: normal;
27
+ font-display: swap;
28
+ font-weight: 600;
29
+ }
30
+
31
+ /* \u5168\u5C40\u5B57\u4F53 + \u80CC\u666F */
32
+ * {
33
+ box-sizing: border-box;
34
+ margin: 0;
35
+ padding: 0;
36
+ font-family: "Adelle Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
37
+ }
38
+
39
+ /* \u684C\u9762\u7AEF\u5916\u5C42\u5BB9\u5668\uFF1A\u5C45\u4E2D + \u6E10\u53D8\u80CC\u666F */
40
+ @media (min-width: 769px) {
41
+ body {
42
+ background: linear-gradient(135deg, #1e3a8a 0%, #1e1b4b 50%, #0f1419 100%);
43
+ background-attachment: fixed;
44
+ }
45
+ }
46
+
47
+ /* \u79FB\u52A8\u7AEF\u6EDA\u52A8\u5BB9\u5668 */
48
+ .playsout-scroll-container {
49
+ min-height: 100vh;
50
+ overflow-y: auto;
51
+ -webkit-overflow-scrolling: touch;
52
+ scrollbar-width: none;
53
+ -ms-overflow-style: none;
54
+ }
55
+ .playsout-scroll-container::-webkit-scrollbar {
56
+ display: none;
57
+ }
58
+
59
+ /* mobile-container: \u4E0E demo \u5B8C\u5168\u4E00\u81F4 */
60
+ .mobile-container {
61
+ max-width: 414px; /* iPhone 13 Pro Max \u5BBD\u5EA6\uFF0C\u4E0E demo \u4E00\u81F4 */
62
+ margin: 0 auto;
63
+ background-color: #0f1419;
64
+ min-height: 100vh;
65
+ position: relative;
66
+ box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
67
+ border-radius: 0.25rem; /* rounded-md */
68
+ }
69
+
70
+ @media (max-width: 768px) {
71
+ .mobile-container {
72
+ max-width: none;
73
+ margin: 0;
74
+ box-shadow: none;
75
+ border-radius: 0;
76
+ }
77
+ }
78
+
79
+ .playsout-widget {
80
+ background: var(--playsout-bg);
81
+ color: var(--playsout-text);
82
+ min-height: 100vh;
83
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
84
+ }
85
+
86
+ /* Header */
87
+ .widget-header {
88
+ display: flex;
89
+ align-items: center;
90
+ justify-content: space-between;
91
+ padding: 1rem 1rem; /* py-4 px-4 */
92
+ background: var(--playsout-bg);
93
+ position: sticky;
94
+ top: 0;
95
+ z-index: 100;
96
+ }
97
+
98
+ .widget-logo {
99
+ display: flex;
100
+ align-items: center;
101
+ gap: 4px;
102
+ }
103
+
104
+ .widget-logo img {
105
+ width: 40px;
106
+ height: 32px;
107
+ object-fit: contain;
108
+ }
109
+
110
+ .widget-user {
111
+ display: flex;
112
+ align-items: center;
113
+ gap: 0.75rem; /* gap-3 */
114
+ }
115
+
116
+ /* Gems Button: demo \u98CE\u683C */
117
+ .widget-gems-btn {
118
+ display: flex;
119
+ align-items: center;
120
+ gap: 0.375rem; /* gap-1.5 */
121
+ padding: 0.375rem 0.75rem; /* py-1.5 px-3 */
122
+ border-radius: 9999px; /* rounded-full */
123
+ background: #1a1a1a;
124
+ border: 1px solid #2a2a2a;
125
+ color: #94a3b8;
126
+ cursor: pointer;
127
+ transition: background 0.15s;
128
+ }
129
+ .widget-gems-btn:hover {
130
+ background: #2a3b50;
131
+ }
132
+ .widget-gems-amount {
133
+ font-size: 0.875rem; /* text-sm */
134
+ font-weight: 700;
135
+ color: white;
136
+ }
137
+ .widget-gems-icon {
138
+ color: #a855f7; /* \u7D2B\u8272 */
139
+ width: 1rem;
140
+ height: 1rem;
141
+ fill: currentColor;
142
+ stroke: currentColor;
143
+ }
144
+
145
+ /* Profile Button: demo \u98CE\u683C */
146
+ .widget-profile-btn {
147
+ display: flex;
148
+ align-items: center;
149
+ justify-content: center;
150
+ width: 2.5rem; /* w-10 */
151
+ height: 2.5rem; /* h-10 */
152
+ border-radius: 50%;
153
+ background: #1e2a3a;
154
+ cursor: pointer;
155
+ transition: background 0.15s;
156
+ border: none;
157
+ }
158
+ .widget-profile-btn:hover {
159
+ background: #2a3b50;
160
+ }
161
+ .widget-profile-btn svg {
162
+ width: 1.25rem; /* w-5 h-5 */
163
+ height: 1.25rem;
164
+ color: #94a3b8;
165
+ }
166
+
167
+ /* Banner */
168
+ .widget-banner {
169
+ padding: 0 1rem 1.5rem; /* px-4 pb-6\uFF0C\u4E0E demo \u4E00\u81F4 */
170
+ }
171
+
172
+ .banner-image {
173
+ width: 100%;
174
+ height: auto;
175
+ aspect-ratio: 750 / 300;
176
+ object-fit: cover;
177
+ border-radius: 1rem; /* rounded-2xl */
178
+ border: 1px solid #1e2a3a; /* border-game-card */
179
+ background: #1e2a3a;
180
+ display: block;
181
+ user-select: none;
182
+ -webkit-user-drag: none;
183
+ }
184
+
185
+ /* Search */
186
+ .widget-search {
187
+ padding: 0 1rem 1.5rem; /* px-4 pb-6 */
188
+ position: relative;
189
+ }
190
+
191
+ .search-wrapper {
192
+ position: relative;
193
+ display: flex;
194
+ align-items: center;
195
+ }
196
+
197
+ .search-icon {
198
+ position: absolute;
199
+ left: 14px;
200
+ top: 50%;
201
+ transform: translateY(-50%);
202
+ color: #94a3b8;
203
+ pointer-events: none;
204
+ display: flex;
205
+ align-items: center;
206
+ }
207
+
208
+ .search-input {
209
+ width: 100%;
210
+ background: #1a1a1a;
211
+ color: white;
212
+ border: 1px solid #2a2a2a;
213
+ border-radius: 1rem; /* rounded-2xl */
214
+ padding: 0.875rem 1rem 0.875rem 2.75rem; /* py-3.5 pl-11 */
215
+ font-size: 0.875rem;
216
+ outline: none;
217
+ transition: border-color 0.2s;
218
+ -webkit-appearance: none;
219
+ }
220
+
221
+ .search-input:focus {
222
+ border-color: #06b6d4; /* focus:border-cyan-500 */
223
+ }
224
+
225
+ .search-input::placeholder {
226
+ color: #6b7280; /* placeholder-gray-500 */
227
+ }
228
+
229
+ /* \u53F3\u4FA7 Search \u6309\u94AE\uFF08\u4E0E demo \u4E00\u81F4\uFF09 */
230
+ .search-btn {
231
+ position: absolute;
232
+ right: 0.5rem; /* right-2 */
233
+ top: 50%;
234
+ transform: translateY(-50%);
235
+ width: 2.25rem; /* w-9 */
236
+ height: 2.25rem; /* h-9 */
237
+ border-radius: 0.75rem; /* rounded-xl */
238
+ background: #2a3b50;
239
+ border: none;
240
+ cursor: pointer;
241
+ display: flex;
242
+ align-items: center;
243
+ justify-content: center;
244
+ color: #22d3ee; /* text-cyan-400 */
245
+ transition: background 0.15s;
246
+ }
247
+ .search-btn:hover {
248
+ background: #374151;
249
+ }
250
+
251
+ /* Categories */
252
+ .widget-categories {
253
+ padding: 0 1rem 2rem; /* px-4 mb-8 */
254
+ }
255
+
256
+ .categories-wrapper {
257
+ display: flex;
258
+ flex-wrap: wrap;
259
+ gap: 0.75rem; /* gap-3 */
260
+ }
261
+
262
+ .category-btn {
263
+ flex-shrink: 0;
264
+ display: flex;
265
+ align-items: center;
266
+ gap: 0.5rem; /* gap-2 */
267
+ padding: 0.375rem 0.75rem; /* py-1.5 px-3 */
268
+ border-radius: 9999px; /* rounded-full */
269
+ border: 1px solid transparent;
270
+ font-size: 0.875rem; /* text-sm */
271
+ font-weight: 500;
272
+ cursor: pointer;
273
+ transition: all 0.15s;
274
+ background: #1E232F;
275
+ white-space: nowrap;
276
+ }
277
+
278
+ .category-btn:hover {
279
+ border-color: rgba(255, 255, 255, 0.1);
280
+ }
281
+
282
+ .category-btn.active {
283
+ background: #1E232F;
284
+ border-color: rgba(6, 182, 212, 0.5); /* border-cyan-500/50 */
285
+ }
286
+
287
+ .category-btn.active .category-label {
288
+ color: white;
289
+ }
290
+
291
+ .category-icon {
292
+ width: 1rem; /* w-4 */
293
+ height: 1rem; /* h-4 */
294
+ display: flex;
295
+ align-items: center;
296
+ justify-content: center;
297
+ }
298
+
299
+ .category-label {
300
+ color: #9ca3af; /* text-gray-400 */
301
+ transition: color 0.15s;
302
+ }
303
+
304
+ /* Games Section */
305
+ .widget-games {
306
+ padding: 0 1rem 1rem; /* px-4 pb-4 */
307
+ }
308
+
309
+ .section-title {
310
+ font-size: 1rem; /* text-base \u2248 16px */
311
+ font-weight: 600;
312
+ margin-bottom: 1rem; /* mb-4 */
313
+ color: #94a3b8; /* text-game-text */
314
+ }
315
+
316
+ .games-grid {
317
+ display: grid;
318
+ grid-template-columns: repeat(2, 1fr);
319
+ gap: 0.5rem; /* gap-2\uFF088px\uFF09\uFF0C\u4E0E demo \u4E00\u81F4 */
320
+ }
321
+
322
+ /* Game Card: \u4E0E demo globals.css \u4E00\u81F4 */
323
+ .game-card {
324
+ background: #1e2a3a; /* bg-game-card */
325
+ border-radius: 0.75rem; /* rounded-xl */
326
+ overflow: hidden;
327
+ cursor: pointer;
328
+ user-select: none;
329
+ -webkit-user-select: none;
330
+ transition: transform 0.2s;
331
+ display: flex;
332
+ flex-direction: column;
333
+ }
334
+
335
+ .game-card:hover {
336
+ transform: translateY(-2px); /* -translate-y-0.5 \u2248 2px */
337
+ }
338
+
339
+ .game-image-wrapper {
340
+ position: relative;
341
+ width: 100%;
342
+ aspect-ratio: 1; /* 1:1 \u65B9\u5F62\uFF0C\u4E0E demo \u4E00\u81F4 */
343
+ flex-shrink: 0;
344
+ overflow: hidden;
345
+ }
346
+
347
+ .game-image {
348
+ width: 100%;
349
+ height: 100%;
350
+ object-fit: cover;
351
+ background: #1e2a3a;
352
+ user-select: none;
353
+ -webkit-user-drag: none;
354
+ }
355
+
356
+ /* NEW/HOT \u5FBD\u6807\uFF1A\u4E0E\u6807\u9898\u540C\u4E00\u884C */
357
+ .title-row {
358
+ display: flex;
359
+ align-items: center;
360
+ gap: 0.5rem; /* gap-2 */
361
+ height: 1rem; /* height: 16px */
362
+ min-height: 1rem;
363
+ overflow: visible;
364
+ }
365
+
366
+ .game-tag {
367
+ font-size: 0.5rem; /* text-[8px] */
368
+ font-weight: 700;
369
+ padding: 2px 3px;
370
+ border-radius: 3px;
371
+ flex-shrink: 0;
372
+ text-transform: uppercase;
373
+ line-height: 1;
374
+ }
375
+
376
+ .game-tag.new {
377
+ background: #dc2626; /* \u7EA2\u8272\uFF0C\u4E0E demo \u4E00\u81F4 */
378
+ color: white;
379
+ }
380
+
381
+ .game-tag.hot {
382
+ background: #f59e0b; /* \u6A59\u8272\uFF0C\u4E0E demo \u4E00\u81F4 */
383
+ color: white;
384
+ }
385
+
386
+ .game-info {
387
+ padding: 6px;
388
+ flex-shrink: 0;
389
+ display: flex;
390
+ flex-direction: column;
391
+ background-color: rgba(30, 42, 58, 0.95); /* \u4E0E demo \u5B8C\u5168\u4E00\u81F4 */
392
+ }
393
+
394
+ .game-title {
395
+ font-size: 0.6875rem; /* text-[11px] */
396
+ font-weight: 600;
397
+ color: white;
398
+ margin: 0;
399
+ white-space: nowrap;
400
+ overflow: hidden;
401
+ text-overflow: ellipsis;
402
+ line-height: 1rem; /* line-height: 16px */
403
+ user-select: text;
404
+ -webkit-user-select: text;
405
+ }
406
+
407
+ .divider {
408
+ height: 1px;
409
+ background-color: #2a3b50; /* \u4E0E demo divider \u4E00\u81F4 */
410
+ margin: 4px 0;
411
+ }
412
+
413
+ .game-category {
414
+ font-size: 0.5625rem; /* text-[9px] */
415
+ color: #64748b;
416
+ margin: 0;
417
+ line-height: 0.75rem; /* line-height: 12px */
418
+ text-align: left;
419
+ user-select: text;
420
+ -webkit-user-select: text;
421
+ }
422
+
423
+ /* Empty State */
424
+ .empty-state {
425
+ text-align: center;
426
+ padding: 48px 16px;
427
+ color: var(--playsout-text-muted);
428
+ }
429
+
430
+ .empty-state-icon {
431
+ font-size: 48px;
432
+ margin-bottom: 16px;
433
+ }
434
+
435
+ /* Loading */
436
+ .loading {
437
+ display: flex;
438
+ align-items: center;
439
+ justify-content: center;
440
+ min-height: 200px;
441
+ color: var(--playsout-text-muted);
442
+ }
443
+
444
+ .loading-spinner {
445
+ width: 32px;
446
+ height: 32px;
447
+ border: 3px solid var(--playsout-border);
448
+ border-top-color: var(--playsout-primary);
449
+ border-radius: 50%;
450
+ animation: spin 1s linear infinite;
451
+ }
452
+
453
+ @keyframes spin {
454
+ to {
455
+ transform: rotate(360deg);
456
+ }
457
+ }
458
+
459
+ /* No Results */
460
+ .no-results {
461
+ text-align: center;
462
+ padding: 48px 16px;
463
+ color: var(--playsout-text-muted);
464
+ }
465
+
466
+ /* ========== Store Modal ========== */
467
+ .store-modal-overlay {
468
+ position: fixed;
469
+ inset: 0;
470
+ z-index: 1000;
471
+ background: rgba(0, 0, 0, 0.6);
472
+ backdrop-filter: blur(4px);
473
+ -webkit-backdrop-filter: blur(4px);
474
+ display: flex;
475
+ align-items: flex-end;
476
+ justify-content: center;
477
+ animation: modalFadeIn 0.2s ease-out;
478
+ }
479
+
480
+ /* ========== Profile Modal ========== */
481
+ .profile-modal-overlay {
482
+ position: fixed;
483
+ inset: 0;
484
+ z-index: 1000;
485
+ background: rgba(0, 0, 0, 0.6);
486
+ backdrop-filter: blur(4px);
487
+ -webkit-backdrop-filter: blur(4px);
488
+ display: flex;
489
+ align-items: flex-end;
490
+ justify-content: center;
491
+ animation: modalFadeIn 0.2s ease-out;
492
+ }
493
+
494
+ .profile-modal {
495
+ width: 100%;
496
+ max-width: 28rem;
497
+ background: #111827;
498
+ border-top: 1px solid #374151;
499
+ border-radius: 1.5rem 1.5rem 0 0;
500
+ box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
501
+ display: flex;
502
+ flex-direction: column;
503
+ max-height: 90vh;
504
+ animation: modalSlideUp 0.3s ease-out;
505
+ }
506
+
507
+ @media (min-width: 640px) {
508
+ .profile-modal {
509
+ border-radius: 1.5rem;
510
+ margin: 1rem;
511
+ }
512
+ }
513
+
514
+ .profile-modal-header {
515
+ display: flex;
516
+ align-items: center;
517
+ justify-content: space-between;
518
+ padding: 0.75rem 1rem;
519
+ border-bottom: 1px solid #374151;
520
+ }
521
+
522
+ .profile-modal-title {
523
+ font-size: 1.125rem;
524
+ font-weight: 700;
525
+ color: white;
526
+ }
527
+
528
+ .profile-modal-close {
529
+ background: none;
530
+ border: none;
531
+ color: #9ca3af;
532
+ font-size: 1.25rem;
533
+ cursor: pointer;
534
+ padding: 0.25rem;
535
+ line-height: 1;
536
+ }
537
+ .profile-modal-close:hover {
538
+ color: white;
539
+ }
540
+
541
+ .profile-modal-content {
542
+ flex: 1;
543
+ overflow-y: auto;
544
+ padding: 1rem;
545
+ display: flex;
546
+ flex-direction: column;
547
+ gap: 1.5rem;
548
+ }
549
+
550
+ .profile-section {
551
+ display: flex;
552
+ flex-direction: column;
553
+ gap: 0.75rem;
554
+ }
555
+
556
+ .profile-section-title {
557
+ font-size: 1rem;
558
+ font-weight: 600;
559
+ color: #e5e7eb;
560
+ border-left: 3px solid #06b6d4;
561
+ padding-left: 0.75rem;
562
+ }
563
+
564
+ /* \u7528\u6237\u4FE1\u606F\u5FBD\u7AE0\uFF08\u7B80\u6D01\u98CE\u683C\uFF09 */
565
+ .profile-user-badge {
566
+ display: inline-flex;
567
+ align-items: center;
568
+ gap: 0.5rem;
569
+ padding: 0.625rem 1rem;
570
+ background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
571
+ border: 1px solid rgba(99, 102, 241, 0.3);
572
+ border-radius: 2rem;
573
+ margin-bottom: 1.25rem;
574
+ }
575
+
576
+ .profile-user-icon {
577
+ width: 1.25rem;
578
+ height: 1.25rem;
579
+ color: #a5b4fc;
580
+ flex-shrink: 0;
581
+ }
582
+
583
+ .profile-username-text {
584
+ font-size: 0.9375rem;
585
+ font-weight: 600;
586
+ color: #e0e7ff;
587
+ }
588
+
589
+ .profile-settings {
590
+ background: #1a1a1a;
591
+ border-radius: 0.75rem;
592
+ border: 1px solid #2a2a2a;
593
+ overflow: hidden;
594
+ }
595
+
596
+ .profile-setting-item {
597
+ display: flex;
598
+ align-items: center;
599
+ justify-content: space-between;
600
+ padding: 1rem;
601
+ cursor: pointer;
602
+ transition: background 0.15s;
603
+ }
604
+
605
+ .profile-setting-item:hover {
606
+ background: #252525;
607
+ }
608
+
609
+ .profile-setting-label {
610
+ color: white;
611
+ font-weight: 500;
612
+ font-size: 0.875rem;
613
+ }
614
+
615
+ .profile-setting-value {
616
+ display: flex;
617
+ align-items: center;
618
+ gap: 0.5rem;
619
+ color: #9ca3af;
620
+ font-size: 0.875rem;
621
+ }
622
+
623
+ .profile-language-select {
624
+ background: transparent;
625
+ border: none;
626
+ color: #9ca3af;
627
+ font-size: 0.875rem;
628
+ cursor: pointer;
629
+ padding: 0.25rem;
630
+ }
631
+
632
+ .profile-language-select option {
633
+ background: #1a1a1a;
634
+ color: white;
635
+ }
636
+
637
+ /* ========== Language Select Modal ========== */
638
+ .language-modal-overlay {
639
+ position: fixed;
640
+ inset: 0;
641
+ z-index: 1001;
642
+ background: rgba(0, 0, 0, 0.5);
643
+ backdrop-filter: blur(4px);
644
+ -webkit-backdrop-filter: blur(4px);
645
+ display: flex;
646
+ align-items: flex-end;
647
+ justify-content: center;
648
+ animation: modalFadeIn 0.2s ease-out;
649
+ }
650
+
651
+ .language-modal {
652
+ width: 100%;
653
+ max-width: 28rem;
654
+ background: #1a1a1a;
655
+ border-radius: 1.5rem 1.5rem 0 0;
656
+ border: 1px solid #2a2a2a;
657
+ box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
658
+ max-height: 80vh;
659
+ display: flex;
660
+ flex-direction: column;
661
+ animation: modalSlideUp 0.3s ease-out;
662
+ }
663
+
664
+ @media (min-width: 640px) {
665
+ .language-modal {
666
+ border-radius: 1.5rem;
667
+ margin: 1rem;
668
+ }
669
+ }
670
+
671
+ .language-modal-header {
672
+ display: flex;
673
+ align-items: center;
674
+ justify-content: space-between;
675
+ padding: 1rem;
676
+ border-bottom: 1px solid #2a2a2a;
677
+ }
678
+
679
+ .language-modal-title {
680
+ font-size: 1rem;
681
+ font-weight: 700;
682
+ color: white;
683
+ }
684
+
685
+ .language-modal-close {
686
+ background: none;
687
+ border: none;
688
+ color: #9ca3af;
689
+ font-size: 1.25rem;
690
+ cursor: pointer;
691
+ padding: 0.25rem;
692
+ line-height: 1;
693
+ }
694
+ .language-modal-close:hover {
695
+ color: white;
696
+ }
697
+
698
+ .language-modal-list {
699
+ overflow-y: auto;
700
+ padding: 0.5rem;
701
+ max-height: 60vh;
702
+ }
703
+
704
+ .language-option {
705
+ width: 100%;
706
+ display: flex;
707
+ align-items: center;
708
+ justify-content: space-between;
709
+ padding: 1rem;
710
+ background: transparent;
711
+ border: none;
712
+ border-radius: 0.75rem;
713
+ cursor: pointer;
714
+ transition: all 0.15s;
715
+ color: #d1d5db;
716
+ }
717
+
718
+ .language-option:hover {
719
+ background: #252525;
720
+ }
721
+
722
+ .language-option.active {
723
+ background: rgba(6, 182, 212, 0.1);
724
+ color: #22d3ee;
725
+ border: 1px solid rgba(6, 182, 212, 0.5);
726
+ }
727
+
728
+ .language-option-label {
729
+ font-size: 1rem;
730
+ font-weight: 500;
731
+ }
732
+
733
+ .language-option-check {
734
+ font-size: 1rem;
735
+ }
736
+
737
+ .store-modal {
738
+ width: 100%;
739
+ max-width: 28rem; /* max-w-sm */
740
+ background: #111827; /* gray-900 */
741
+ border-top: 1px solid #374151;
742
+ border-radius: 1.5rem 1.5rem 0 0; /* rounded-t-3xl */
743
+ box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
744
+ display: flex;
745
+ flex-direction: column;
746
+ max-height: 90vh;
747
+ animation: modalSlideUp 0.3s ease-out;
748
+ }
749
+
750
+ @media (min-width: 640px) {
751
+ .store-modal {
752
+ border-radius: 1.5rem;
753
+ margin: 1rem;
754
+ }
755
+ }
756
+
757
+ .store-modal-header {
758
+ display: flex;
759
+ align-items: center;
760
+ justify-content: center;
761
+ padding: 0.75rem;
762
+ border-bottom: 1px solid #374151;
763
+ }
764
+
765
+ .store-modal-title {
766
+ font-size: 1.125rem; /* text-lg */
767
+ font-weight: 700;
768
+ color: white;
769
+ letter-spacing: 0.025em;
770
+ }
771
+
772
+ .store-modal-content {
773
+ flex: 1;
774
+ overflow-y: auto;
775
+ padding: 0.75rem;
776
+ display: flex;
777
+ flex-direction: column;
778
+ gap: 0.5rem;
779
+ }
780
+
781
+ .store-pack {
782
+ display: flex;
783
+ align-items: center;
784
+ justify-content: space-between;
785
+ padding: 0.75rem;
786
+ background: #1f2937; /* gray-800 */
787
+ border-radius: 0.75rem;
788
+ border: 1px solid #374151;
789
+ transition: background 0.15s;
790
+ position: relative;
791
+ }
792
+ .store-pack:hover {
793
+ background: #1a2233;
794
+ }
795
+
796
+ .store-pack-hot {
797
+ position: absolute;
798
+ top: 0;
799
+ right: 0;
800
+ background: linear-gradient(135deg, #ef4444, #ec4899); /* red-500 to pink-500 */
801
+ color: white;
802
+ font-size: 0.625rem;
803
+ font-weight: 700;
804
+ padding: 2px 8px;
805
+ border-radius: 0 0.75rem 0 0.5rem;
806
+ text-transform: uppercase;
807
+ letter-spacing: 0.05em;
808
+ }
809
+
810
+ .store-pack-left {
811
+ display: flex;
812
+ align-items: center;
813
+ gap: 0.75rem;
814
+ }
815
+
816
+ .store-pack-icon {
817
+ width: 2.5rem;
818
+ height: 2.5rem;
819
+ border-radius: 50%;
820
+ background: #374151;
821
+ display: flex;
822
+ align-items: center;
823
+ justify-content: center;
824
+ border: 1px solid #4b5563;
825
+ flex-shrink: 0;
826
+ }
827
+
828
+ .store-pack-icon svg {
829
+ color: #9333ea; /* purple-600 */
830
+ width: 1.25rem;
831
+ height: 1.25rem;
832
+ fill: rgba(147, 51, 234, 0.1);
833
+ stroke: currentColor;
834
+ }
835
+
836
+ .store-pack-info {
837
+ display: flex;
838
+ flex-direction: column;
839
+ }
840
+
841
+ .store-pack-amount {
842
+ font-size: 1rem;
843
+ font-weight: 700;
844
+ color: white;
845
+ }
846
+
847
+ .store-pack-amount span {
848
+ font-size: 0.75rem;
849
+ font-weight: 400;
850
+ color: #a78bfa; /* purple-400 */
851
+ }
852
+
853
+ .store-pack-price {
854
+ font-size: 0.75rem;
855
+ color: #9ca3af; /* gray-400 */
856
+ }
857
+
858
+ .store-buy-btn {
859
+ background: linear-gradient(135deg, #0891b2, #2563eb); /* cyan-600 to blue-600 */
860
+ color: white;
861
+ font-size: 0.75rem;
862
+ font-weight: 700;
863
+ padding: 0.375rem 1rem;
864
+ border-radius: 9999px;
865
+ border: none;
866
+ cursor: pointer;
867
+ transition: all 0.15s;
868
+ box-shadow: 0 10px 15px -3px rgba(6, 182, 212, 0.2);
869
+ }
870
+ .store-buy-btn:hover {
871
+ background: linear-gradient(135deg, #22d3ee, #3b82f6); /* cyan-500 to blue-500 */
872
+ transform: scale(0.97);
873
+ }
874
+
875
+ .store-modal-footer {
876
+ padding: 0.75rem;
877
+ padding-bottom: 1.5rem;
878
+ border-top: 1px solid #374151;
879
+ border-radius: 0 0 1.5rem 1.5rem;
880
+ background: #111827;
881
+ }
882
+
883
+ @media (min-width: 640px) {
884
+ .store-modal-footer {
885
+ padding-bottom: 0.75rem;
886
+ border-radius: 0 0 1.5rem 1.5rem;
887
+ }
888
+ }
889
+
890
+ .store-cancel-btn {
891
+ width: 100%;
892
+ text-align: center;
893
+ font-size: 1rem;
894
+ font-weight: 500;
895
+ color: #9ca3af;
896
+ background: none;
897
+ border: none;
898
+ cursor: pointer;
899
+ transition: color 0.15s;
900
+ padding: 0.25rem;
901
+ }
902
+ .store-cancel-btn:hover {
903
+ color: #e5e7eb;
904
+ }
905
+
906
+ /* ========== Payment Modal ========== */
907
+ .payment-modal-overlay {
908
+ position: fixed;
909
+ inset: 0;
910
+ z-index: 1500;
911
+ background: rgba(0, 0, 0, 0.6);
912
+ backdrop-filter: blur(4px);
913
+ -webkit-backdrop-filter: blur(4px);
914
+ display: flex;
915
+ align-items: flex-end;
916
+ justify-content: center;
917
+ animation: modalFadeIn 0.2s ease-out;
918
+ }
919
+
920
+ .payment-modal {
921
+ width: 100%;
922
+ max-width: 28rem;
923
+ background: #ffffff;
924
+ border-top: 1px solid #f3f4f6;
925
+ border-radius: 1.5rem 1.5rem 0 0;
926
+ box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
927
+ overflow: hidden;
928
+ animation: modalSlideUp 0.3s ease-out;
929
+ }
930
+
931
+ @media (min-width: 640px) {
932
+ .payment-modal {
933
+ max-width: 20rem;
934
+ border-radius: 1.5rem;
935
+ margin: 1rem;
936
+ }
937
+ }
938
+
939
+ .payment-modal-content {
940
+ padding: 1.5rem 1rem;
941
+ display: flex;
942
+ flex-direction: column;
943
+ align-items: center;
944
+ text-align: center;
945
+ }
946
+
947
+ .payment-modal-title {
948
+ font-size: 1.125rem;
949
+ font-weight: 700;
950
+ color: #111827;
951
+ margin-bottom: 0.5rem;
952
+ }
953
+
954
+ .payment-modal-desc {
955
+ font-size: 0.8125rem;
956
+ color: #6b7280;
957
+ line-height: 1.375;
958
+ margin-bottom: 1rem;
959
+ }
960
+
961
+ .payment-cost-card {
962
+ width: 100%;
963
+ display: flex;
964
+ align-items: center;
965
+ justify-content: center;
966
+ gap: 0.75rem;
967
+ background: #f9fafb;
968
+ border: 1px solid #f3f4f6;
969
+ border-radius: 1rem;
970
+ padding: 0.75rem 1rem;
971
+ margin-bottom: 0.75rem;
972
+ box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
973
+ }
974
+
975
+ .payment-cost-amount {
976
+ font-size: 1.875rem;
977
+ font-weight: 900;
978
+ color: #9333ea;
979
+ line-height: 1;
980
+ }
981
+
982
+ .payment-cost-icon {
983
+ width: 1.5rem;
984
+ height: 1.5rem;
985
+ color: #9333ea;
986
+ fill: rgba(147, 51, 234, 0.12);
987
+ stroke: currentColor;
988
+ }
989
+
990
+ .payment-balance {
991
+ width: 100%;
992
+ font-size: 0.75rem;
993
+ color: #6b7280;
994
+ margin-bottom: 1rem;
995
+ }
996
+
997
+ .payment-insufficient {
998
+ width: 100%;
999
+ background: #fef2f2;
1000
+ border: 1px solid #fee2e2;
1001
+ border-radius: 0.75rem;
1002
+ color: #dc2626;
1003
+ font-size: 0.75rem;
1004
+ font-weight: 600;
1005
+ padding: 0.625rem;
1006
+ margin-bottom: 1rem;
1007
+ }
1008
+
1009
+ .payment-actions {
1010
+ display: flex;
1011
+ gap: 0.75rem;
1012
+ width: 100%;
1013
+ }
1014
+
1015
+ .payment-action-btn {
1016
+ flex: 1;
1017
+ min-width: 0;
1018
+ border: none;
1019
+ border-radius: 0.75rem;
1020
+ padding: 0.75rem 0.5rem;
1021
+ font-size: 0.875rem;
1022
+ font-weight: 700;
1023
+ cursor: pointer;
1024
+ transition: transform 0.15s, background 0.15s;
1025
+ }
1026
+
1027
+ .payment-action-btn:active {
1028
+ transform: scale(0.97);
1029
+ }
1030
+
1031
+ .payment-cancel-btn {
1032
+ background: #f3f4f6;
1033
+ color: #4b5563;
1034
+ }
1035
+
1036
+ .payment-cancel-btn:hover {
1037
+ background: #e5e7eb;
1038
+ }
1039
+
1040
+ .payment-confirm-btn {
1041
+ background: linear-gradient(135deg, #22c55e, #059669);
1042
+ color: #ffffff;
1043
+ box-shadow: 0 10px 15px -3px rgba(5, 150, 105, 0.22);
1044
+ }
1045
+
1046
+ .payment-confirm-btn:hover {
1047
+ background: linear-gradient(135deg, #4ade80, #10b981);
1048
+ }
1049
+
1050
+ /* ========== Toast ========== */
1051
+ .toast-container {
1052
+ position: fixed;
1053
+ top: 1rem;
1054
+ left: 50%;
1055
+ transform: translateX(-50%);
1056
+ z-index: 2000;
1057
+ display: flex;
1058
+ flex-direction: column;
1059
+ align-items: center;
1060
+ gap: 0.5rem;
1061
+ pointer-events: none;
1062
+ width: 100%;
1063
+ max-width: 24rem;
1064
+ }
1065
+
1066
+ .toast {
1067
+ background: #ffffff;
1068
+ color: #0f172a;
1069
+ border: 1px solid #e2e8f0;
1070
+ border-radius: 1rem;
1071
+ padding: 0.75rem 1rem;
1072
+ font-size: 0.875rem;
1073
+ box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
1074
+ animation: toastIn 0.2s ease-out;
1075
+ max-width: 100%;
1076
+ text-align: center;
1077
+ display: flex;
1078
+ align-items: center;
1079
+ gap: 0.75rem;
1080
+ pointer-events: auto;
1081
+ }
1082
+
1083
+ .toast-icon {
1084
+ flex-shrink: 0;
1085
+ width: 2.5rem;
1086
+ height: 2.5rem;
1087
+ border-radius: 9999px;
1088
+ background: #dcfce7;
1089
+ border: 1px solid #bbf7d0;
1090
+ display: flex;
1091
+ align-items: center;
1092
+ justify-content: center;
1093
+ }
1094
+
1095
+ .toast-icon svg {
1096
+ width: 1.25rem;
1097
+ height: 1.25rem;
1098
+ color: #16a34a;
1099
+ }
1100
+
1101
+ .toast-warning .toast-icon {
1102
+ background: #fef3c7;
1103
+ border-color: #fde68a;
1104
+ }
1105
+
1106
+ .toast-warning .toast-icon svg {
1107
+ color: #d97706;
1108
+ }
1109
+
1110
+ .toast-content {
1111
+ flex: 1;
1112
+ min-width: 0;
1113
+ }
1114
+
1115
+ .toast-title {
1116
+ font-weight: 600;
1117
+ color: #0f172a;
1118
+ line-height: 1.375;
1119
+ }
1120
+
1121
+ .toast-message {
1122
+ color: #475569;
1123
+ font-size: 0.8125rem;
1124
+ margin-top: 0.125rem;
1125
+ line-height: 1.375;
1126
+ }
1127
+
1128
+ @keyframes modalFadeIn {
1129
+ from { opacity: 0; }
1130
+ to { opacity: 1; }
1131
+ }
1132
+
1133
+ @keyframes modalSlideUp {
1134
+ from { transform: translateY(100%); }
1135
+ to { transform: translateY(0); }
1136
+ }
1137
+
1138
+ @keyframes toastIn {
1139
+ from { opacity: 0; transform: translateY(-20px); }
1140
+ to { opacity: 1; transform: translateY(0); }
1141
+ }
1142
+
1143
+ /* \u767B\u5F55\u63D0\u793A Toast */
1144
+ .login-prompt-toast {
1145
+ background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(245, 158, 11, 0.15));
1146
+ border-color: rgba(251, 191, 36, 0.4);
1147
+ }
1148
+
1149
+ .login-prompt-toast .toast-icon {
1150
+ color: #fbbf24;
1151
+ }
1152
+
1153
+ .login-prompt-toast .toast-title {
1154
+ color: #fef3c7;
1155
+ }
1156
+
1157
+ /* ========== \u6E38\u620F\u8BE6\u60C5\u9875\u6837\u5F0F\uFF08iframe \u5D4C\u5165\u6A21\u5F0F\uFF09========== */
1158
+ .detail-nav {
1159
+ display: flex;
1160
+ align-items: center;
1161
+ padding: 0.75rem 0.5rem;
1162
+ background-color: #1a2332;
1163
+ border-bottom: 1px solid #1e2a3a;
1164
+ color: #ffffff;
1165
+ gap: 0.5rem;
1166
+ position: sticky;
1167
+ top: 0;
1168
+ z-index: 100;
1169
+ }
1170
+
1171
+ .detail-back-btn {
1172
+ display: flex;
1173
+ align-items: center;
1174
+ justify-content: center;
1175
+ gap: 0.125rem;
1176
+ padding: 0 0.5rem;
1177
+ height: 2rem;
1178
+ background: transparent;
1179
+ border: none;
1180
+ border-radius: 0.375rem;
1181
+ color: #ffffff;
1182
+ cursor: pointer;
1183
+ transition: color 0.2s, background 0.2s;
1184
+ flex-shrink: 0;
1185
+ }
1186
+
1187
+ .detail-back-btn:hover {
1188
+ color: #3b82f6;
1189
+ background-color: rgba(59, 130, 246, 0.1);
1190
+ }
1191
+
1192
+ .detail-back-btn:active {
1193
+ background-color: rgba(59, 130, 246, 0.2);
1194
+ }
1195
+
1196
+ .detail-back-text {
1197
+ font-size: 0.875rem;
1198
+ font-weight: 500;
1199
+ }
1200
+
1201
+ .detail-title {
1202
+ font-size: 1.125rem;
1203
+ font-weight: 600;
1204
+ flex: 1;
1205
+ white-space: nowrap;
1206
+ overflow: hidden;
1207
+ text-overflow: ellipsis;
1208
+ }
1209
+
1210
+ .detail-spacer {
1211
+ width: 2rem;
1212
+ flex-shrink: 0;
1213
+ }
1214
+
1215
+ .detail-iframe-container {
1216
+ flex: 1;
1217
+ width: 100%;
1218
+ overflow: hidden;
1219
+ background-color: #0f1419;
1220
+ }
1221
+
1222
+ .detail-iframe {
1223
+ width: 100%;
1224
+ height: calc(100vh - 4rem);
1225
+ border: none;
1226
+ display: block;
1227
+ }
1228
+ `,ve=`
1229
+ <svg xmlns="http://www.w3.org/2000/svg" style="display:none">
1230
+ <symbol id="icon-adventure" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
1231
+ <polyline points="14.5 17.5 3 6 3 3 6 3 17.5 14.5"/>
1232
+ <line x1="13" x2="19" y1="19" y2="13"/>
1233
+ <line x1="16" x2="20" y1="16" y2="20"/>
1234
+ <line x1="19" x2="21" y1="21" y2="19"/>
1235
+ </symbol>
1236
+ <symbol id="icon-simulation" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
1237
+ <path d="m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7"/>
1238
+ <path d="M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8"/>
1239
+ <path d="M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4"/>
1240
+ <path d="M2 7h20"/>
1241
+ <path d="M22 7v3a2 2 0 0 1-2 2 2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7"/>
1242
+ </symbol>
1243
+ <symbol id="icon-casual" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
1244
+ <line x1="6" x2="10" y1="11" y2="11"/>
1245
+ <line x1="8" x2="8" y1="9" y2="13"/>
1246
+ <line x1="15" x2="15.01" y1="12" y2="12"/>
1247
+ <line x1="18" x2="18.01" y1="10" y2="10"/>
1248
+ <path d="M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z"/>
1249
+ </symbol>
1250
+ <symbol id="icon-arcade" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
1251
+ <path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"/>
1252
+ </symbol>
1253
+ <symbol id="icon-moba" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
1254
+ <path d="M9 10h.01"/>
1255
+ <path d="M15 10h.01"/>
1256
+ <path d="M12 2a8 8 0 0 0-8 8v12l3-3 2.5 2.5L12 19l2.5 2.5L17 19l3 3V10a8 8 0 0 0-8-8z"/>
1257
+ </symbol>
1258
+ <symbol id="icon-puzzle" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
1259
+ <path d="M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z"/>
1260
+ <path d="M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z"/>
1261
+ <path d="M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4"/>
1262
+ <path d="M17.599 6.5a3 3 0 0 0 .399-1.375"/>
1263
+ <path d="M6.003 5.125A3 3 0 0 0 6.401 6.5"/>
1264
+ <path d="M3.477 10.896a4 4 0 0 1 .585-.396"/>
1265
+ <path d="M19.938 10.5a4 4 0 0 1 .585.396"/>
1266
+ <path d="M6 18a4 4 0 0 1-1.967-.516"/>
1267
+ <path d="M19.967 17.484A4 4 0 0 1 18 18"/>
1268
+ </symbol>
1269
+ <symbol id="icon-search" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
1270
+ <circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/>
1271
+ </symbol>
1272
+ <symbol id="icon-warning" viewBox="0 0 24 24" fill="currentColor">
1273
+ <path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"/>
1274
+ </symbol>
1275
+ <symbol id="icon-gem" viewBox="0 0 24 24">
1276
+ <path d="M10.5 3 8 9l4 13 4-13-2.5-6"/>
1277
+ <path d="M17 3a2 2 0 0 1 1.6.8l3 4a2 2 0 0 1 .013 2.382l-7.99 10.986a2 2 0 0 1-3.247 0l-7.99-10.986A2 2 0 0 1 2.4 7.8l2.998-3.997A2 2 0 0 1 7 3z"/>
1278
+ <path d="M2 9h20"/>
1279
+ </symbol>
1280
+ </svg>
1281
+ `,w="All",we="#22d3ee",xe="arcade",ke=["Doge OS","Adventure","Simulation","Casual","Arcade","Moba","Puzzle","RPG","Tower Defense"],ft={[w]:{name:"All",iconType:"icon",iconKey:"arcade",color:"#22d3ee"},"Doge OS":{name:"Doge OS",iconType:"image",iconSrc:"https://games.playsout.com/resources/icon/image/doge32.png",color:"#FBBF24"},Adventure:{name:"Adventure",iconType:"icon",iconKey:"adventure",color:"#FF7D54"},Simulation:{name:"Simulation",iconType:"icon",iconKey:"simulation",color:"#4ADE80"},Casual:{name:"Casual",iconType:"icon",iconKey:"casual",color:"#60A5FA"},Arcade:{name:"Arcade",iconType:"icon",iconKey:"arcade",color:"#A78BFA"},Moba:{name:"Moba",iconType:"icon",iconKey:"moba",color:"#FACC15"},Puzzle:{name:"Puzzle",iconType:"icon",iconKey:"puzzle",color:"#FB923C"},RPG:{name:"RPG",iconType:"icon",iconKey:"adventure",color:"#34d399"},"Tower Defense":{name:"Tower Defense",iconType:"icon",iconKey:"simulation",color:"#f97316"}},P=class extends HTMLElement{constructor(){super();this._locale="zh";this.games=[];this.filteredGames=[];this.selectedCategory=w;this.searchQuery="";this.bannerUrl="";this.userPoints=1e3;this._detailMode="iframe";this.currentView="list";this.currentGame=null;this.currentIframeSrc="";this.pendingPaymentResolver=null;this.gemPacks=[{amount:12,price:.99,hot:!1},{amount:60,price:4.99,hot:!0},{amount:180,price:14.99,hot:!1},{amount:360,price:29.99,hot:!1}];this.toastTimeout=null;this.shadow=this.attachShadow({mode:"open"}),this.bridge=new _({getIframe:()=>this.shadow.querySelector(".detail-iframe"),getGameUrl:()=>this.currentIframeSrc,getBalance:()=>this.userPoints,getUser:()=>this.getBridgeUser(),getLocale:()=>this._locale,requestPayment:()=>Promise.resolve({status:"cancelled",balance:this.userPoints})})}static get observedAttributes(){return["locale","banner-url","user-points","detail-mode"]}t(e,i){let a=I[this._locale]??I.en,r=J(a,e);if(r!==e)return be(r,i??{});let n=J(I.en,e);return be(n,i??{})}hasTranslation(e){let i=I[this._locale]??I.en;return J(i,e)!==e}getBridgeUser(){let e=window.__playsout_sdk_instance,i=typeof e?.isInitialized=="function"?e.isInitialized():e?.isInitialized,a=typeof e?.isLoggedIn=="function"?e.isLoggedIn():e?.isLoggedIn,r=i&&a&&typeof e?.getUser=="function"?e.getUser():null;return r?{uid:String(r.userId||r.id||r.username||"user"),nickname:String(r.username||r.name||"User"),avatarUrl:r.avatar||r.avatarUrl||""}:null}isGameEnabled(e){return e.enable!==!1&&e.isEnabled!==!1}getEnabledGames(){return this.games.filter(e=>this.isGameEnabled(e))}getVisibleCategories(){return Array.from(new Set(this.getEnabledGames().map(i=>i.category).filter(Boolean))).sort((i,a)=>{let r=ke.indexOf(i),n=ke.indexOf(a);return r===-1&&n===-1?0:r===-1?1:n===-1?-1:r-n})}getCategoryUi(e){return ft[e]??{name:e,iconType:"icon",iconKey:xe,color:we}}renderCategoryButton(e){let i=this.selectedCategory===e,a=this.getCategoryUi(e),r=a.color||we,n=a.iconType==="image"&&a.iconSrc?`<img src="${O(a.iconSrc)}" alt="" style="width:1rem;height:1rem;object-fit:contain;" />`:`<svg width="1rem" height="1rem" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" color="${r}" style="color:${r}"><use href="#icon-${a.iconKey||xe}"/></svg>`,s=a.name||e,g=this.hasTranslation(`categories.${e}`)?this.t(`categories.${e}`):s;return`
1282
+ <button class="category-btn${i?" active":""}" data-category="${e}">
1283
+ <span class="category-icon">${n}</span>
1284
+ <span class="category-label">${g}</span>
1285
+ </button>`}setUserPoints(e,i,a){let r=this.userPoints;this.userPoints=Math.max(0,Math.floor(e)),this.updateUI(),this.dispatchEvent(new CustomEvent("gem-balance-change",{bubbles:!0,composed:!0,detail:{balance:this.userPoints,previousBalance:r,delta:this.userPoints-r,reason:i,orderId:a}}))}connectedCallback(){this.bridge.attach(),this.render(),this.loadGames()}disconnectedCallback(){this.resolvePendingPayment({status:"cancelled",balance:this.userPoints}),this.bridge.detach(),this.toastTimeout&&(clearTimeout(this.toastTimeout),this.toastTimeout=null)}attributeChangedCallback(e,i,a){if(i!==a){switch(e){case"locale":this._locale=a||"zh";break;case"banner-url":this.bannerUrl=a||"";break;case"user-points":{let r=parseInt(a||"1000",10);this.userPoints=Number.isFinite(r)?r:1e3}break;case"detail-mode":this._detailMode=a||"link";break}this.shadow.innerHTML&&(e==="locale"?(this.resolvePendingPayment({status:"cancelled",balance:this.userPoints}),this.bridge.cancelPendingPayment(),this.render(),this.loadGames()):this.updateUI())}}async loadGames(){this.showLoading();let e=window.__playsout_sdk_instance;if(!e||!e.isInitialized){let i=()=>{e&&e.isInitialized&&(f.off("initialized",i),this.loadGames())};e?f.on("initialized",i):this.pollForSDK();return}this.doLoadGames(e)}pollForSDK(){let e=setInterval(()=>{let i=window.__playsout_sdk_instance;i&&i.isInitialized&&(clearInterval(e),this.loadGames())},100);setTimeout(()=>{clearInterval(e),this.games.length||(this.showError(),console.warn("[PlaysoutWidget] SDK initialization timeout"))},1e4)}async doLoadGames(e){try{this.games=await e.getGames(),this.updateFilteredGames(),this.render(),this.renderGames()}catch(i){console.error("[PlaysoutWidget] Failed to load games:",i),this.showError()}}filterGames(){this.updateFilteredGames(),this.renderGames()}updateFilteredGames(){let e=this.getVisibleCategories();this.selectedCategory!==w&&!e.includes(this.selectedCategory)&&(this.selectedCategory=w);let i=this.getEnabledGames();if(this.selectedCategory!==w&&(i=i.filter(a=>a.category===this.selectedCategory)),this.searchQuery){let a=this.searchQuery.toLowerCase();i=i.filter(r=>r.title.toLowerCase().includes(a)||r.category.toLowerCase().includes(a))}this.filteredGames=i}showLoading(){let e=this.shadow.querySelector(".widget-content");e&&(e.innerHTML=`
1286
+ <div class="loading">
1287
+ <div class="loading-spinner"></div>
1288
+ </div>
1289
+ `)}showError(){let e=this.shadow.querySelector(".widget-content");e&&(e.innerHTML=`
1290
+ <div class="empty-state">
1291
+ <div class="empty-state-icon">
1292
+ <svg width="48" height="48" viewBox="0 0 24 24" fill="currentColor">
1293
+ <use href="#icon-warning"/>
1294
+ </svg>
1295
+ </div>
1296
+ <p>Failed to load games</p>
1297
+ </div>
1298
+ `)}render(){let e=this.bannerUrl||l("./home-banner.webp"),i=this.getVisibleCategories(),a=i.length>0?[w,...i]:[];if(this.currentView==="detail"&&this.currentGame){this.renderGameDetail();return}this.shadow.innerHTML=`
1299
+ <style>${ye}</style>
1300
+ ${ve}
1301
+ <div class="playsout-scroll-container">
1302
+ <div class="mobile-container">
1303
+ <div class="playsout-widget">
1304
+ <!-- Header -->
1305
+ <header class="widget-header">
1306
+ <div class="widget-logo">
1307
+ <img src="${O("./logowhite.png")}" alt="Playsout" />
1308
+ </div>
1309
+ <div class="widget-user">
1310
+ <!-- Profile Button -->
1311
+ <button class="widget-profile-btn" id="profile-btn" aria-label="Profile">
1312
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
1313
+ <path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/>
1314
+ <circle cx="12" cy="7" r="4"/>
1315
+ </svg>
1316
+ </button>
1317
+ </div>
1318
+ </header>
1319
+
1320
+ <!-- Banner -->
1321
+ <div class="widget-banner">
1322
+ <img
1323
+ class="banner-image"
1324
+ src="${e?O(e):""}"
1325
+ alt="Playsout Games"
1326
+ />
1327
+ </div>
1328
+
1329
+ <!-- Search -->
1330
+ <div class="widget-search">
1331
+ <div class="search-wrapper">
1332
+ <span class="search-icon">
1333
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
1334
+ <circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/>
1335
+ </svg>
1336
+ </span>
1337
+ <input
1338
+ type="text"
1339
+ class="search-input"
1340
+ id="search-input"
1341
+ placeholder="${this.t("home.searchPlaceholder")}"
1342
+ />
1343
+ <button class="search-btn" id="search-btn" aria-label="Search">
1344
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
1345
+ <circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/>
1346
+ </svg>
1347
+ </button>
1348
+ </div>
1349
+ </div>
1350
+
1351
+ <!-- Categories -->
1352
+ <div class="widget-categories">
1353
+ <div class="categories-wrapper" id="categories">
1354
+ ${a.map(r=>this.renderCategoryButton(r)).join("")}
1355
+ </div>
1356
+ </div>
1357
+
1358
+ <!-- Games Content -->
1359
+ <div class="widget-content">
1360
+ <div class="loading">
1361
+ <div class="loading-spinner"></div>
1362
+ </div>
1363
+ </div>
1364
+ </div>
1365
+ </div>
1366
+ </div>
1367
+ `,this.attachEventListeners()}updateUI(){let e=this.shadow.querySelector(".banner-image");e&&this.bannerUrl&&(e.src=this.bannerUrl);let i=this.shadow.querySelector("#gems-amount");i&&(i.textContent=String(this.userPoints))}showStoreModal(){this.hideStoreModal();let e=document.createElement("div");e.className="store-modal-overlay",e.id="store-modal-overlay",e.innerHTML=`
1368
+ <div class="store-modal" id="store-modal">
1369
+ <div class="store-modal-header">
1370
+ <h2 class="store-modal-title">${this.t("store.title")}</h2>
1371
+ </div>
1372
+ <div class="store-modal-content">
1373
+ ${this.gemPacks.map(i=>`
1374
+ <div class="store-pack">
1375
+ ${i.hot?`<div class="store-pack-hot">${this.t("store.hot")}</div>`:""}
1376
+ <div class="store-pack-left">
1377
+ <div class="store-pack-icon">
1378
+ <svg viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
1379
+ <use href="#icon-gem"/>
1380
+ </svg>
1381
+ </div>
1382
+ <div class="store-pack-info">
1383
+ <span class="store-pack-amount">${i.amount} <span>${this.t("store.unit")}</span></span>
1384
+ <span class="store-pack-price">US$${i.price}</span>
1385
+ </div>
1386
+ </div>
1387
+ <button class="store-buy-btn" data-amount="${i.amount}">${this.t("store.buy")}</button>
1388
+ </div>
1389
+ `).join("")}
1390
+ </div>
1391
+ <div class="store-modal-footer">
1392
+ <button class="store-cancel-btn" id="store-cancel">${this.t("store.cancel")}</button>
1393
+ </div>
1394
+ </div>
1395
+ `,this.shadow.appendChild(e),e.querySelectorAll(".store-buy-btn").forEach(i=>{i.addEventListener("click",()=>{let a=parseInt(i.dataset.amount||"0",10);this.handleGemPurchase(a)})}),e.querySelector("#store-cancel")?.addEventListener("click",()=>{this.hideStoreModal()}),e.addEventListener("click",i=>{i.target===e&&this.hideStoreModal()})}hideStoreModal(){this.shadow.querySelector("#store-modal-overlay")?.remove()}showPaymentModal(e){return this.hidePaymentModal(),new Promise(i=>{this.pendingPaymentResolver=i;let a=document.createElement("div");a.className="payment-modal-overlay",a.id="payment-modal-overlay";let r=this.userPoints<e.amount;a.innerHTML=`
1396
+ <div class="payment-modal" role="dialog" aria-modal="true" aria-labelledby="payment-modal-title">
1397
+ <div class="payment-modal-content">
1398
+ <h2 class="payment-modal-title" id="payment-modal-title">${this.t("payment.title")}</h2>
1399
+ <p class="payment-modal-desc">${this.t("payment.description",{amount:e.amount})}</p>
1400
+ <div class="payment-cost-card" aria-label="${this.t("payment.amountLabel",{amount:e.amount})}">
1401
+ <span class="payment-cost-amount">${e.amount}</span>
1402
+ <svg class="payment-cost-icon" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
1403
+ <use href="#icon-gem"/>
1404
+ </svg>
1405
+ </div>
1406
+ <div class="payment-balance">${this.t("payment.balance",{balance:this.userPoints})}</div>
1407
+ ${r?`<div class="payment-insufficient">${this.t("payment.insufficientMessage",{balance:this.userPoints,amount:e.amount})}</div>`:""}
1408
+ <div class="payment-actions">
1409
+ <button class="payment-action-btn payment-cancel-btn" id="payment-cancel-btn">${this.t("payment.cancel")}</button>
1410
+ <button class="payment-action-btn payment-confirm-btn" id="payment-confirm-btn">${this.t("payment.confirm")}</button>
1411
+ </div>
1412
+ </div>
1413
+ </div>
1414
+ `,this.shadow.appendChild(a),a.querySelector("#payment-cancel-btn")?.addEventListener("click",()=>{this.resolvePendingPayment({status:"cancelled",balance:this.userPoints})}),a.querySelector("#payment-confirm-btn")?.addEventListener("click",()=>{if(this.userPoints<e.amount){this.showToast(this.t("payment.insufficientTitle"),this.t("payment.insufficientMessage",{balance:this.userPoints,amount:e.amount}),"warning"),this.resolvePendingPayment({status:"insufficient",balance:this.userPoints});return}this.setUserPoints(this.userPoints-e.amount,"payment",e.orderId),this.showToast(this.t("payment.successTitle"),this.t("payment.successMessage",{amount:e.amount})),this.resolvePendingPayment({status:"success",balance:this.userPoints})}),a.addEventListener("click",n=>{n.target===a&&this.resolvePendingPayment({status:"cancelled",balance:this.userPoints})})})}hidePaymentModal(){this.shadow.querySelector("#payment-modal-overlay")?.remove()}resolvePendingPayment(e){let i=this.pendingPaymentResolver;this.pendingPaymentResolver=null,this.hidePaymentModal(),i&&i(e)}showProfileModal(){this.hideProfileModal();let e=document.createElement("div");e.className="profile-modal-overlay",e.id="profile-modal-overlay";let i=window.__playsout_sdk_instance,n=((typeof i?.isInitialized=="function"?i.isInitialized():i?.isInitialized)?i.getUser():null)?.username||this.t("profile.guest");e.innerHTML=`
1415
+ <div class="profile-modal" id="profile-modal">
1416
+ <div class="profile-modal-header">
1417
+ <h2 class="profile-modal-title">${this.t("profile.title")}</h2>
1418
+ <button class="profile-modal-close" id="profile-close-btn">\u2715</button>
1419
+ </div>
1420
+ <div class="profile-modal-content">
1421
+ <!-- \u7528\u6237\u4FE1\u606F\u5FBD\u7AE0 -->
1422
+ <div class="profile-user-badge">
1423
+ <svg class="profile-user-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
1424
+ <path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
1425
+ <circle cx="12" cy="7" r="4"></circle>
1426
+ </svg>
1427
+ <span class="profile-username-text">${n}</span>
1428
+ </div>
1429
+
1430
+ <section class="profile-section">
1431
+ <h3 class="profile-section-title">${this.t("profile.settings")}</h3>
1432
+ <div class="profile-settings">
1433
+ <div class="profile-setting-item" id="profile-language-btn">
1434
+ <span class="profile-setting-label">${this.t("profile.language")}</span>
1435
+ <div class="profile-setting-value">
1436
+ <span id="profile-current-lang">${this.t(`profile.languages.${this._locale}`)}</span>
1437
+ <span>\u203A</span>
1438
+ </div>
1439
+ </div>
1440
+ </div>
1441
+ </section>
1442
+ </div>
1443
+ </div>
1444
+ `,this.shadow.appendChild(e),e.querySelector("#profile-close-btn")?.addEventListener("click",()=>{this.hideProfileModal()}),e.addEventListener("click",h=>{h.target===e&&this.hideProfileModal()});let s=()=>{let h=window.__playsout_sdk_instance,E=(h?.getUser?h.getUser():null)?.username||this.t("profile.guest"),te=this.shadow.querySelector(".profile-username-text");te&&(te.textContent=E)},g=()=>{let h=this.shadow.querySelector(".profile-username-text");h&&(h.textContent=this.t("profile.guest")),this.hideProfileModal()},c=window.__playsout_sdk_instance;c?.on&&(c.on("login",s),c.on("logout",s),c.on("authExpired",g)),e.querySelector("#profile-language-btn")?.addEventListener("click",()=>{this.showLanguageSelectModal()})}hideProfileModal(){this.shadow.querySelector("#profile-modal-overlay")?.remove(),this.shadow.querySelector("#language-modal-overlay")?.remove()}showLanguageSelectModal(){this.shadow.querySelector("#language-modal-overlay")?.remove();let e=document.createElement("div");e.className="language-modal-overlay",e.id="language-modal-overlay";let i=[{code:"en",label:"English"},{code:"zh",label:"\u4E2D\u6587"},{code:"ja",label:"\u65E5\u672C\u8A9E"},{code:"ko",label:"\uD55C\uAD6D\uC5B4"},{code:"th",label:"\u0E44\u0E17\u0E22"},{code:"vi",label:"Ti\u1EBFng Vi\u1EC7t"},{code:"id",label:"Bahasa Indonesia"},{code:"ms",label:"Bahasa Melayu"},{code:"es",label:"Espa\xF1ol"}];e.innerHTML=`
1445
+ <div class="language-modal">
1446
+ <div class="language-modal-header">
1447
+ <h3 class="language-modal-title">${this.t("profile.language")}</h3>
1448
+ <button class="language-modal-close" id="language-close-btn">\u2715</button>
1449
+ </div>
1450
+ <div class="language-modal-list">
1451
+ ${i.map(a=>`
1452
+ <button class="language-option${a.code===this._locale?" active":""}" data-lang="${a.code}">
1453
+ <span class="language-option-label">${a.label}</span>
1454
+ ${a.code===this._locale?'<span class="language-option-check">\u2713</span>':""}
1455
+ </button>
1456
+ `).join("")}
1457
+ </div>
1458
+ </div>
1459
+ `,this.shadow.appendChild(e),e.querySelector("#language-close-btn")?.addEventListener("click",()=>{this.shadow.querySelector("#language-modal-overlay")?.remove()}),e.addEventListener("click",a=>{a.target===e&&this.shadow.querySelector("#language-modal-overlay")?.remove()}),e.querySelectorAll(".language-option").forEach(a=>{a.addEventListener("click",()=>{let r=a.dataset.lang;if(r&&r!==this._locale){this._locale=r,this.setAttribute("locale",this._locale),this.dispatchEvent(new CustomEvent("locale-change",{bubbles:!0,composed:!0,detail:this._locale}));let n=this.shadow.querySelector("#profile-current-lang");n&&(n.textContent=this.t(`profile.languages.${this._locale}`)),this.shadow.querySelector("#language-modal-overlay")?.remove()}})})}handleGemPurchase(e){this.setUserPoints(this.userPoints+e,"store"),this.hideStoreModal(),this.showToast(this.t("store.successTitle"),this.t("store.successMessage",{amount:e}))}showToast(e,i="",a="success"){this.toastTimeout&&clearTimeout(this.toastTimeout),this.shadow.querySelector("#toast-container")?.remove();let r=document.createElement("div");r.className="toast-container",r.id="toast-container",r.innerHTML=`
1460
+ <div class="toast${a==="warning"?" toast-warning":""}">
1461
+ <div class="toast-icon">
1462
+ <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
1463
+ ${a==="warning"?'<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="M12 9v4m0 4h.01M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/>':'<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="M5 13l4 4L19 7"/>'}
1464
+ </svg>
1465
+ </div>
1466
+ <div class="toast-content">
1467
+ <div class="toast-title">${e}</div>
1468
+ ${i?`<div class="toast-message">${i}</div>`:""}
1469
+ </div>
1470
+ </div>
1471
+ `,this.shadow.appendChild(r),this.toastTimeout=window.setTimeout(()=>{r.style.opacity="0",r.style.transition="opacity 0.2s",setTimeout(()=>r.remove(),200)},3e3)}renderGames(){let e=this.shadow.querySelector(".widget-content");if(e){if(this.filteredGames.length===0){e.innerHTML=`
1472
+ <div class="widget-games">
1473
+ <div class="no-results">
1474
+ <p>${this.t("home.noGames")}</p>
1475
+ </div>
1476
+ </div>
1477
+ `;return}e.innerHTML=`
1478
+ <div class="widget-games">
1479
+ <div class="games-grid">
1480
+ ${this.filteredGames.map((i,a)=>this.renderGameCard(i,a)).join("")}
1481
+ </div>
1482
+ </div>
1483
+ `,e.querySelectorAll(".game-card").forEach(i=>{i.addEventListener("click",()=>{let a=i.getAttribute("data-game-id"),r=this.games.find(n=>n.id===a);if(r){let n=window.__playsout_sdk_instance,s=typeof n?.isInitialized=="function"?n.isInitialized():n?.isInitialized,g=typeof n?.isLoggedIn=="function"?n.isLoggedIn():n?.isLoggedIn;if(!s||!g){this.showLoginPrompt();return}if(this.dispatchEvent(new CustomEvent("game-click",{detail:r,bubbles:!0,composed:!0})),this._detailMode==="iframe"&&r.externalUrl)this.currentGame=r,this.currentView="detail",this.render();else{let c=r.externalUrl||`/games/${r.id}`;window.location.href=c}}})})}}showLoginPrompt(){this.toastTimeout&&clearTimeout(this.toastTimeout),this.shadow.querySelector("#toast-container")?.remove();let e=document.createElement("div");e.className="toast-container";let i=this.t.bind(this);e.innerHTML=`
1484
+ <div class="toast login-prompt-toast">
1485
+ <div class="toast-icon">
1486
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
1487
+ <circle cx="12" cy="12" r="10"></circle>
1488
+ <line x1="12" y1="8" x2="12" y2="12"></line>
1489
+ <line x1="12" y1="16" x2="12.01" y2="16"></line>
1490
+ </svg>
1491
+ </div>
1492
+ <div class="toast-content">
1493
+ <div class="toast-title">${i("auth.mustLogin")}</div>
1494
+ </div>
1495
+ </div>
1496
+ `,this.shadow.appendChild(e),this.toastTimeout=window.setTimeout(()=>{e.style.opacity="0",e.style.transform="translateY(10px)",e.style.transition="all 0.2s ease-out",setTimeout(()=>e.remove(),200)},1e3)}renderGameCard(e,i){let a=[];e.isNew&&a.push('<span class="game-tag new">NEW</span>'),e.isHot&&a.push('<span class="game-tag hot">HOT</span>');let r=i<8?"eager":"lazy";return`
1497
+ <div class="game-card" data-game-id="${e.id}">
1498
+ <div class="game-image-wrapper">
1499
+ <img
1500
+ class="game-image"
1501
+ src="${O(e.image)}"
1502
+ alt="${e.title}"
1503
+ loading="${r}"
1504
+ draggable="false"
1505
+ />
1506
+ </div>
1507
+ <div class="game-info">
1508
+ <div class="title-row">
1509
+ <h3 class="game-title">${e.title}</h3>
1510
+ ${a.length>0?a.join(""):""}
1511
+ </div>
1512
+ <div class="divider"></div>
1513
+ <p class="game-category">${this.hasTranslation(`categories.${e.category}`)?this.t(`categories.${e.category}`):e.category}</p>
1514
+ </div>
1515
+ </div>
1516
+ `}renderGameDetail(){if(!this.currentGame)return;let e=this.currentGame,i=e.externalUrl||`/games/${e.id}`;this.currentIframeSrc=i,this.shadow.innerHTML=`
1517
+ <style>${ye}</style>
1518
+ ${ve}
1519
+ <div class="playsout-scroll-container">
1520
+ <div class="mobile-container">
1521
+ <div class="playsout-widget">
1522
+ <!-- \u5BFC\u822A\u680F -->
1523
+ <header class="detail-nav">
1524
+ <button class="detail-back-btn" id="detail-back-btn" aria-label="${this.t("game.header.back")}">
1525
+ <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
1526
+ <path d="M15 18l-6-6 6-6"/>
1527
+ </svg>
1528
+ <span class="detail-back-text">${this.t("game.header.back")}</span>
1529
+ </button>
1530
+ <span class="detail-title">${e.title}</span>
1531
+ <div class="detail-spacer"></div>
1532
+ </header>
1533
+
1534
+ <!-- \u6E38\u620F iframe -->
1535
+ <div class="detail-iframe-container">
1536
+ <iframe
1537
+ src="${i}"
1538
+ class="detail-iframe"
1539
+ allow="fullscreen"
1540
+ sandbox="allow-scripts allow-same-origin allow-forms allow-popups"
1541
+ ></iframe>
1542
+ </div>
1543
+ </div>
1544
+ </div>
1545
+ </div>
1546
+ `,this.shadow.getElementById("detail-back-btn")?.addEventListener("click",()=>{this.resolvePendingPayment({status:"cancelled",balance:this.userPoints}),this.bridge.cancelPendingPayment(),this.currentView="list",this.currentGame=null,this.currentIframeSrc="",this.render(),this.loadGames()})}attachEventListeners(){this.shadow.getElementById("gems-btn")?.addEventListener("click",()=>{this.showStoreModal()}),this.shadow.getElementById("profile-btn")?.addEventListener("click",()=>{this.showProfileModal()});let e=this.shadow.getElementById("search-input");e?.addEventListener("input",a=>{let r=a.target;this.searchQuery=r.value,this.filterGames()}),this.shadow.getElementById("search-btn")?.addEventListener("click",()=>{e?.focus()});let i=this.shadow.getElementById("categories");i?.addEventListener("click",a=>{let n=a.target.closest(".category-btn");if(n){let s=n.getAttribute("data-category")||"";this.selectedCategory=s||w,i.querySelectorAll(".category-btn").forEach(g=>{g.classList.remove("active")}),n.classList.add("active"),this.filterGames()}})}};customElements.get("playsout-widget")||customElements.define("playsout-widget",P);var Ee="ae1f9827-86d2-4794-b5f7-b3414dd4a470";var Te="./arrow-DVB3ZH4I.png";var Se="./bofang-7CYHXAOR.png";var Ie="./clock-UCOJBATJ.png";var Pe="./comment-CYSCAN7M.png";var Ae="./fenxiang-SHOVHZII.png";var Le="./like-UTHO5POC.png";var Re="./live-like-4WE6H52V.png";var De="./next-T6TSGXOI.png";var Ce="./share-2WNZMMZ6.png";var Me="./shoucang-CSI3UBYK.png";var _e="./shuqian-KOBOMTMJ.png";var Ne="./shuqian1-VMWYGXP3.png";var Lt=30,Ue="https://cdn.applixir.com/applixir.app.v6.1.0.js",k="https://games.playsout.com/resources/icon/short-drama",Rt=`${k}/videos`,B=null,Dt=0,ee={id:2,type:"live",titleKey:"neonDreams",descriptionKey:"neonDreamsDescription",episodes:24,likes:"1.5M"},Be=[{id:4,type:"live",titleKey:"loveUnderStars",descriptionKey:"loveUnderStarsDescription",episodes:24,likes:"450K"},{id:3,type:"live",titleKey:"ceoSecretHeir",descriptionKey:"ceoSecretHeirDescription",episodes:50,likes:"1.2M"},{id:5,type:"motion",titleKey:"neonShadows",descriptionKey:"neonShadowsDescription",episodes:24,likes:"650K"},{id:6,type:"motion",titleKey:"lastPercent",descriptionKey:"lastPercentDescription",episodes:50,likes:"1.2M"}],G=[ee,...Be],Ct=`${k}/images/short-banner.png`,Mt={3:`${k}/images/covers/short-3.webp`,4:`${k}/images/covers/short-4.webp`,5:`${k}/images/covers/short-5.webp`,6:`${k}/images/covers/short-6.webp`},Oe={en:N,zh:U},ze=()=>{if(window.initializeAndOpenPlayer)return Promise.resolve();if(B)return B;let o=new Promise((t,e)=>{let i=document.querySelector(`script[src="${Ue}"]`),a=i??document.createElement("script");a.addEventListener("load",()=>window.initializeAndOpenPlayer?t():e(new Error("AppLixir SDK unavailable")),{once:!0}),a.addEventListener("error",()=>e(new Error("Failed to load AppLixir SDK")),{once:!0}),i||(a.src=Ue,a.async=!0,document.head.appendChild(a))}).catch(t=>{throw B=null,t});return B=o,o},_t=`
1547
+ :host {
1548
+ display: block;
1549
+ width: 100%;
1550
+ color: #fff;
1551
+ font-family: "Adelle Sans", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
1552
+ }
1553
+ * { box-sizing: border-box; }
1554
+ button { font: inherit; }
1555
+ .video-widget {
1556
+ position: relative;
1557
+ width: min(100%, 414px);
1558
+ height: 100dvh;
1559
+ margin: 0 auto;
1560
+ overflow: hidden;
1561
+ background: #030616;
1562
+ border-radius: 18px;
1563
+ }
1564
+ .scroll-area {
1565
+ height: 100%;
1566
+ overflow-y: auto;
1567
+ padding: 0 14px 28px;
1568
+ scrollbar-width: none;
1569
+ }
1570
+ .scroll-area::-webkit-scrollbar { display: none; }
1571
+ .header {
1572
+ display: flex;
1573
+ align-items: center;
1574
+ justify-content: space-between;
1575
+ min-height: 52px;
1576
+ font-size: 20px;
1577
+ font-weight: 900;
1578
+ }
1579
+ .balance {
1580
+ display: inline-flex;
1581
+ align-items: center;
1582
+ gap: 5px;
1583
+ padding: 6px 10px;
1584
+ border: 1px solid #292d48;
1585
+ border-radius: 999px;
1586
+ background: #11152a;
1587
+ font-size: 13px;
1588
+ }
1589
+ .balance img { width: 18px; height: 18px; object-fit: contain; }
1590
+ .featured {
1591
+ position: relative;
1592
+ height: 218px;
1593
+ overflow: hidden;
1594
+ border-radius: 18px;
1595
+ background: #171a31;
1596
+ }
1597
+ .featured::after {
1598
+ content: "";
1599
+ position: absolute;
1600
+ inset: 30% 0 0;
1601
+ background: linear-gradient(transparent, rgba(3, 6, 22, .94));
1602
+ }
1603
+ .featured-bg { width: 100%; height: 100%; object-fit: cover; }
1604
+ .featured-content { position: absolute; z-index: 1; inset: auto 16px 15px; }
1605
+ .badge {
1606
+ display: inline-flex;
1607
+ align-items: center;
1608
+ min-height: 22px;
1609
+ padding: 0 10px;
1610
+ border-radius: 4px;
1611
+ color: #080808;
1612
+ background: #e8a13b;
1613
+ font-size: 11px;
1614
+ font-weight: 800;
1615
+ }
1616
+ .featured h2 { margin: 9px 0 4px; font-size: 18px; line-height: 1.2; }
1617
+ .featured p { margin: 0 0 12px; max-width: 330px; color: #d5d8e8; font-size: 12px; line-height: 1.35; }
1618
+ .featured-actions { display: flex; gap: 8px; }
1619
+ .watch-primary, .watch-card {
1620
+ border: 0;
1621
+ color: #fff;
1622
+ background: #6268ef;
1623
+ cursor: pointer;
1624
+ }
1625
+ .watch-primary {
1626
+ display: inline-flex;
1627
+ flex: 1;
1628
+ align-items: center;
1629
+ justify-content: center;
1630
+ gap: 8px;
1631
+ height: 34px;
1632
+ border-radius: 9px;
1633
+ font-size: 13px;
1634
+ font-weight: 700;
1635
+ }
1636
+ .watch-primary img { width: 14px; height: 14px; }
1637
+ .icon-button {
1638
+ display: inline-flex;
1639
+ align-items: center;
1640
+ justify-content: center;
1641
+ width: 36px;
1642
+ height: 34px;
1643
+ border: 1px solid rgba(255,255,255,.15);
1644
+ border-radius: 9px;
1645
+ background: rgba(255,255,255,.12);
1646
+ }
1647
+ .icon-button img { width: 17px; height: 17px; object-fit: contain; }
1648
+ .section-heading { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 12px; }
1649
+ .section-heading h2 { margin: 0; font-size: 18px; }
1650
+ .section-heading span { color: #8991b2; font-size: 12px; }
1651
+ .tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 12px; }
1652
+ .tab {
1653
+ height: 34px;
1654
+ border: 1px solid #262b48;
1655
+ border-radius: 9px;
1656
+ color: #8f96b7;
1657
+ background: #11152a;
1658
+ cursor: pointer;
1659
+ }
1660
+ .tab.active { border-color: #6268ef; color: #fff; background: #262c66; }
1661
+ .cards { display: grid; gap: 11px; }
1662
+ .card {
1663
+ display: grid;
1664
+ grid-template-columns: 116px minmax(0, 1fr);
1665
+ min-height: 142px;
1666
+ overflow: hidden;
1667
+ border: 1px solid #202541;
1668
+ border-radius: 14px;
1669
+ background: #0d1126;
1670
+ }
1671
+ .thumbnail { position: relative; min-height: 142px; background: #171b32; }
1672
+ .thumbnail > img { width: 100%; height: 100%; object-fit: cover; }
1673
+ .hot {
1674
+ position: absolute;
1675
+ z-index: 1;
1676
+ top: 7px;
1677
+ left: 7px;
1678
+ padding: 3px 7px;
1679
+ border-radius: 4px;
1680
+ color: #fff;
1681
+ background: #f04467;
1682
+ font-size: 9px;
1683
+ font-weight: 900;
1684
+ }
1685
+ .card-content { display: flex; flex-direction: column; min-width: 0; padding: 11px; }
1686
+ .card h3 { overflow: hidden; margin: 0 0 7px; font-size: 15px; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
1687
+ .meta { display: flex; gap: 10px; color: #8f96b7; font-size: 10px; }
1688
+ .meta span { display: inline-flex; align-items: center; gap: 4px; }
1689
+ .meta img { width: 11px; height: 11px; object-fit: contain; }
1690
+ .description {
1691
+ display: -webkit-box;
1692
+ overflow: hidden;
1693
+ margin: 8px 0;
1694
+ color: #aab0ca;
1695
+ font-size: 11px;
1696
+ line-height: 1.35;
1697
+ -webkit-box-orient: vertical;
1698
+ -webkit-line-clamp: 2;
1699
+ }
1700
+ .card-actions { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
1701
+ .small-icons { display: flex; gap: 9px; }
1702
+ .small-icons img { width: 15px; height: 15px; object-fit: contain; }
1703
+ .watch-card { min-width: 70px; height: 29px; border-radius: 8px; font-size: 11px; font-weight: 700; }
1704
+ .player-overlay {
1705
+ position: absolute;
1706
+ z-index: 20;
1707
+ inset: 0;
1708
+ display: flex;
1709
+ align-items: center;
1710
+ justify-content: center;
1711
+ background: #000;
1712
+ }
1713
+ .player-overlay video { width: 100%; height: 100%; object-fit: contain; background: #000; }
1714
+ .player-top {
1715
+ position: absolute;
1716
+ z-index: 2;
1717
+ top: 0;
1718
+ right: 0;
1719
+ left: 0;
1720
+ display: flex;
1721
+ justify-content: flex-start;
1722
+ padding: 16px;
1723
+ background: linear-gradient(rgba(0,0,0,.72), transparent);
1724
+ }
1725
+ .round-button {
1726
+ display: grid;
1727
+ place-items: center;
1728
+ width: 38px;
1729
+ height: 38px;
1730
+ border: 0;
1731
+ border-radius: 50%;
1732
+ background: rgba(12,15,27,.7);
1733
+ cursor: pointer;
1734
+ }
1735
+ .round-button img { width: 18px; height: 18px; object-fit: contain; }
1736
+ .back img { transform: rotate(180deg); }
1737
+ .interactions {
1738
+ position: absolute;
1739
+ z-index: 2;
1740
+ right: 13px;
1741
+ bottom: 104px;
1742
+ display: grid;
1743
+ gap: 13px;
1744
+ }
1745
+ .interaction {
1746
+ display: grid;
1747
+ justify-items: center;
1748
+ gap: 3px;
1749
+ border: 0;
1750
+ color: #fff;
1751
+ background: transparent;
1752
+ font-size: 10px;
1753
+ cursor: default;
1754
+ }
1755
+ button.interaction { cursor: pointer; }
1756
+ .interaction img { width: 27px; height: 27px; object-fit: contain; filter: drop-shadow(0 2px 6px #000); }
1757
+ .interaction-toggle img {
1758
+ filter: brightness(0) invert(1) drop-shadow(0 2px 6px #000);
1759
+ transition: opacity .16s ease, filter .16s ease, transform .16s ease;
1760
+ }
1761
+ .interaction-toggle[aria-pressed="true"] img {
1762
+ opacity: 1;
1763
+ filter: drop-shadow(0 2px 6px #000);
1764
+ transform: scale(1.12);
1765
+ }
1766
+ .player-info {
1767
+ position: absolute;
1768
+ z-index: 2;
1769
+ right: 60px;
1770
+ bottom: 72px;
1771
+ left: 16px;
1772
+ text-shadow: 0 1px 4px #000;
1773
+ }
1774
+ .player-info h3 { margin: 0 0 5px; font-size: 17px; }
1775
+ .player-info p { margin: 0; color: #e0e3ef; font-size: 11px; line-height: 1.35; }
1776
+ .video-controls {
1777
+ position: absolute;
1778
+ z-index: 3;
1779
+ right: 12px;
1780
+ bottom: 12px;
1781
+ left: 12px;
1782
+ display: grid;
1783
+ grid-template-columns: 34px minmax(0, 1fr) auto;
1784
+ align-items: center;
1785
+ gap: 9px;
1786
+ min-height: 44px;
1787
+ padding: 6px 10px;
1788
+ border-radius: 14px;
1789
+ background: rgba(9,12,25,.78);
1790
+ backdrop-filter: blur(8px);
1791
+ }
1792
+ .video-play-button {
1793
+ width: 32px;
1794
+ height: 32px;
1795
+ padding: 0;
1796
+ border: 0;
1797
+ border-radius: 50%;
1798
+ color: #0b0e1b;
1799
+ background: #fff;
1800
+ font-size: 13px;
1801
+ font-weight: 900;
1802
+ cursor: pointer;
1803
+ }
1804
+ .video-play-button svg { display: block; width: 16px; height: 16px; margin: auto; fill: currentColor; }
1805
+ .video-play-button [data-pause-icon],
1806
+ .video-play-button[data-state="playing"] [data-play-icon] { display: none; }
1807
+ .video-play-button[data-state="playing"] [data-pause-icon] { display: block; }
1808
+ .video-progress { width: 100%; margin: 0; accent-color: #fff; cursor: pointer; }
1809
+ .video-time { min-width: 75px; color: #fff; font-size: 10px; font-variant-numeric: tabular-nums; text-align: right; }
1810
+ .modal-layer {
1811
+ position: absolute;
1812
+ z-index: 40;
1813
+ inset: 0;
1814
+ display: flex;
1815
+ align-items: flex-end;
1816
+ justify-content: center;
1817
+ background: rgba(0,0,0,.58);
1818
+ backdrop-filter: blur(2px);
1819
+ }
1820
+ .modal {
1821
+ width: 100%;
1822
+ max-width: 28rem;
1823
+ padding: 24px 18px 20px;
1824
+ border: 1px solid #31385b;
1825
+ border-radius: 22px 22px 0 0;
1826
+ color: #fff;
1827
+ background: #11162b;
1828
+ text-align: center;
1829
+ box-shadow: 0 -10px 36px rgba(0,0,0,.45);
1830
+ }
1831
+ .modal h2 { margin: 0 0 7px; font-size: 21px; }
1832
+ .modal-subtitle { margin: 0 0 18px; color: #929ab9; font-size: 13px; }
1833
+ .modal-error { min-height: 18px; margin: 6px 0 0; color: #fb7185; font-size: 12px; }
1834
+ .payment-actions { display: flex; gap: 10px; margin-top: 5px; }
1835
+ .payment-button {
1836
+ flex: 1;
1837
+ min-height: 43px;
1838
+ border: 0;
1839
+ border-radius: 11px;
1840
+ font-weight: 800;
1841
+ cursor: pointer;
1842
+ }
1843
+ .payment-button:disabled { opacity: .65; cursor: wait; }
1844
+ .payment-cancel { color: #fff; background: #262c45; }
1845
+ .payment-confirm { color: #fff; background: #625df2; }
1846
+ @media (max-width: 420px) {
1847
+ .video-widget { border-radius: 0; }
1848
+ }
1849
+ @media (min-width: 421px) {
1850
+ .modal-layer { align-items: center; padding: 22px; }
1851
+ .modal { border-radius: 22px; }
1852
+ }
1853
+ `,$=class extends HTMLElement{constructor(){super();this.currentTab="live";this.currentVideo=null;this.likedVideoIds=new Set;this.favoriteVideoIds=new Set;this.isCurrentVideoUnlocked=!1;this.pendingNextVideo=null;this.adContainer=null;this.shadow=this.attachShadow({mode:"open"}),this.handleClick=this.handleClick.bind(this)}static get observedAttributes(){return["locale","ad-api-key"]}connectedCallback(){this.shadow.addEventListener("click",this.handleClick),this.renderPage()}disconnectedCallback(){this.shadow.removeEventListener("click",this.handleClick),this.cleanupPlayer(),this.adContainer?.remove(),this.adContainer=null}attributeChangedCallback(e,i,a){i===a||!this.isConnected||e==="locale"&&(this.closeVideo(!1),this.renderPage())}get locale(){return this.getAttribute("locale")?.toLowerCase()==="zh"?"zh":"en"}get adApiKey(){return Ee.trim()||this.getAttribute("ad-api-key")?.trim()||""}t(e){let i=Oe[this.locale],a=Oe.en,r=n=>{let s=n.video;return typeof s?.[e]=="string"?s[e]:void 0};return r(i)??r(a)??e}renderPage(){this.shadow.innerHTML=`
1854
+ <style>${_t}</style>
1855
+ <div class="video-widget">
1856
+ <main class="scroll-area">
1857
+ <header class="header">
1858
+ <span>${this.t("title")}</span>
1859
+ </header>
1860
+ <section class="featured">
1861
+ <img class="featured-bg" src="${Ct}" alt="" />
1862
+ <div class="featured-content">
1863
+ <span class="badge">${this.t("editorsChoice")}</span>
1864
+ <h2>${this.t(ee.titleKey)}</h2>
1865
+ <p>${this.t(ee.descriptionKey)}</p>
1866
+ <div class="featured-actions">
1867
+ <button class="watch-primary" data-action="play" data-video-id="2"><img src="${Se}" alt="" />${this.t("watchEpisode")}</button>
1868
+ <span class="icon-button"><img src="${Ne}" alt="" /></span>
1869
+ </div>
1870
+ </div>
1871
+ </section>
1872
+ <section>
1873
+ <div class="section-heading"><h2>${this.t("popular")}</h2><span>${this.t("updatedToday")}</span></div>
1874
+ <div class="tabs">
1875
+ <button class="tab ${this.currentTab==="live"?"active":""}" data-action="tab" data-tab="live">${this.t("liveAction")}</button>
1876
+ <button class="tab ${this.currentTab==="motion"?"active":""}" data-action="tab" data-tab="motion">${this.t("motionComics")}</button>
1877
+ </div>
1878
+ <div class="cards">${this.renderCards()}</div>
1879
+ </section>
1880
+ </main>
1881
+ </div>
1882
+ `}renderCards(){return Be.filter(e=>e.type===this.currentTab).map(e=>`
1883
+ <article class="card">
1884
+ <div class="thumbnail"><span class="hot">${this.t("hot")}</span><img src="${Mt[e.id]}" alt="" /></div>
1885
+ <div class="card-content">
1886
+ <h3>${this.t(e.titleKey)}</h3>
1887
+ <div class="meta">
1888
+ <span><img src="${Ie}" alt="" />${e.episodes} ${this.t("episodes")}</span>
1889
+ <span><img src="${Le}" alt="" />${e.likes}</span>
1890
+ </div>
1891
+ <p class="description">${this.t(e.descriptionKey)}</p>
1892
+ <div class="card-actions">
1893
+ <span class="small-icons"><img src="${_e}" alt="" /><img src="${Ce}" alt="" /></span>
1894
+ <button class="watch-card" data-action="play" data-video-id="${e.id}">${this.t("watch")}</button>
1895
+ </div>
1896
+ </div>
1897
+ </article>
1898
+ `).join("")}handleClick(e){let i=e.target instanceof Element?e.target.closest("[data-action]"):null;if(!i)return;let a=i.dataset.action;if(a==="tab")this.currentTab=i.dataset.tab==="motion"?"motion":"live",this.renderPage();else if(a==="play"){let r=G.find(n=>n.id===Number(i.dataset.videoId));r&&this.openVideo(r)}else if(a==="close-video")this.closeVideo();else if(a==="toggle-play"){let r=this.shadow.querySelector("video");r?.paused?r.play().catch(()=>{}):r?.pause()}else a==="like"||a==="favorite"?this.toggleInteraction(a,i):a==="next"?(this.pendingNextVideo=this.getNextVideo(),this.showUnlockModal()):a==="close-unlock"?this.hideUnlockModal():a==="watch-ad"&&this.watchAd(i)}openVideo(e,i=!1){this.cleanupPlayer(),this.currentVideo=e,this.isCurrentVideoUnlocked=i,this.pendingNextVideo=null;let a=this.shadow.querySelector(".video-widget");if(!a)return;let r=document.createElement("section");r.className="player-overlay",r.innerHTML=`
1899
+ <video playsinline preload="metadata" disablepictureinpicture controlslist="nodownload noplaybackrate noremoteplayback"></video>
1900
+ <div class="player-top">
1901
+ <button class="round-button back" data-action="close-video" aria-label="${this.t("close")}"><img src="${Te}" alt="" /></button>
1902
+ </div>
1903
+ <div class="interactions">
1904
+ <button class="interaction interaction-toggle" data-action="like" aria-label="${this.t("like")}" aria-pressed="${this.likedVideoIds.has(e.id)}"><img src="${Re}" alt="" /><span>1.2M</span></button>
1905
+ <span class="interaction"><img src="${Pe}" alt="" /><span>45.8K</span></span>
1906
+ <button class="interaction interaction-toggle" data-action="favorite" aria-label="${this.t("favorite")}" aria-pressed="${this.favoriteVideoIds.has(e.id)}"><img src="${Me}" alt="" /><span>${this.t("favorite")}</span></button>
1907
+ <span class="interaction"><img src="${Ae}" alt="" /><span>${this.t("share")}</span></span>
1908
+ <button class="interaction" data-action="next"><img src="${De}" alt="" /><span>${this.t("next")}</span></button>
1909
+ </div>
1910
+ <div class="player-info"><h3>${this.t(e.titleKey)}</h3><p>${this.t(e.descriptionKey)}</p></div>
1911
+ <div class="video-controls">
1912
+ <button class="video-play-button" data-action="toggle-play" data-state="paused" aria-label="${this.t("playVideo")}">
1913
+ <svg data-play-icon viewBox="0 0 16 16" aria-hidden="true"><path d="M4.25 2.65a1 1 0 0 1 1.51-.85l7.25 4.85a1 1 0 0 1 0 1.7L5.76 13.2a1 1 0 0 1-1.51-.85z" /></svg>
1914
+ <svg data-pause-icon viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 2.5h3v11h-3zm6 0h3v11h-3z" /></svg>
1915
+ </button>
1916
+ <input class="video-progress" data-video-progress type="range" min="0" max="0" step="0.1" value="0" aria-label="${this.t("videoProgress")}" />
1917
+ <span class="video-time" data-video-time>0:00 / 0:00</span>
1918
+ </div>
1919
+ `,a.appendChild(r);let n=r.querySelector("video");if(!n)return;let s=r.querySelector('[data-action="toggle-play"]'),g=r.querySelector("[data-video-progress]"),c=r.querySelector("[data-video-time]"),h=()=>{let b=Number.isFinite(n.duration)?n.duration:0;g&&(g.max=String(b),g.value=String(Math.min(n.currentTime,b))),c&&(c.textContent=`${this.formatTime(n.currentTime)} / ${this.formatTime(b)}`),s&&(s.dataset.state=n.paused?"paused":"playing"),s?.setAttribute("aria-label",this.t(n.paused?"playVideo":"pauseVideo"))};n.src=this.videoUrl(e.id),n.addEventListener("loadedmetadata",h),n.addEventListener("durationchange",h),n.addEventListener("play",()=>{h(),this.emit("video-play",{id:e.id,title:this.t(e.titleKey)})}),n.addEventListener("pause",h),n.addEventListener("timeupdate",()=>{h(),!this.isCurrentVideoUnlocked&&n.currentTime>=Lt&&(this.pendingNextVideo=null,this.showUnlockModal())}),n.addEventListener("error",()=>this.emit("video-error",{id:e.id,title:this.t(e.titleKey),source:n.src})),g?.addEventListener("input",()=>{n.currentTime=Number(g.value),h()}),n.play().catch(()=>{})}formatTime(e){if(!Number.isFinite(e)||e<0)return"0:00";let i=Math.floor(e);return`${Math.floor(i/60)}:${String(i%60).padStart(2,"0")}`}toggleInteraction(e,i){if(!this.currentVideo)return;let a=e==="like"?this.likedVideoIds:this.favoriteVideoIds,r=!a.has(this.currentVideo.id);r?a.add(this.currentVideo.id):a.delete(this.currentVideo.id),i.setAttribute("aria-pressed",String(r))}videoUrl(e){return`${Rt}/${e}.mp4`}getNextVideo(){let e=G.findIndex(i=>i.id===this.currentVideo?.id);return G[(e+1)%G.length]}showUnlockModal(){if(!this.currentVideo||this.shadow.querySelector(".modal-layer"))return;this.shadow.querySelector("video")?.pause();let e=this.shadow.querySelector(".video-widget");if(!e)return;let i=document.createElement("div");i.className="modal-layer",i.innerHTML=`
1920
+ <div class="modal" role="dialog" aria-modal="true" aria-labelledby="video-unlock-title">
1921
+ <h2 id="video-unlock-title">${this.t("unlockTitle")}</h2>
1922
+ <p class="modal-subtitle">${this.t("adUnlockSubtitle")}</p>
1923
+ <p class="modal-error" aria-live="polite"></p>
1924
+ <div class="payment-actions">
1925
+ <button class="payment-button payment-cancel" data-action="close-unlock">${this.t("cancel")}</button>
1926
+ <button class="payment-button payment-confirm" data-action="watch-ad">${this.t("watchAd")}</button>
1927
+ </div>
1928
+ </div>
1929
+ `,e.appendChild(i),this.adApiKey&&ze().catch(()=>{})}async watchAd(e){let i=this.adApiKey;if(!i){this.showAdError("adKeyMissing");return}let a=this.currentVideo?.id;if(a){e.disabled=!0,e.textContent=this.t("loadingAd"),this.showAdError("");try{await ze();let r=window.initializeAndOpenPlayer;if(!r)throw new Error("AppLixir SDK unavailable");let n=!1,s=!1,g=c=>{n||(e.disabled=!1,e.textContent=this.t("watchAd"),this.showAdError(c))};r({apiKey:i,injectionElementId:this.ensureAdContainer().id,adStatusCallbackFn:c=>{c.type==="complete"?s=!0:c.type==="thankYouModalClosed"&&s?(n=!0,this.completeAdUnlock(a)):!s&&["skipped","adSkippedNoReward","manuallyEnded","allAdsCompleted","consentDeclined"].includes(c.type??"")&&g("adIncomplete")},adErrorCallbackFn:()=>g("adUnavailable")})}catch{e.disabled=!1,e.textContent=this.t("watchAd"),this.showAdError("adUnavailable")}}}ensureAdContainer(){return this.adContainer?.isConnected?this.adContainer:(this.adContainer=document.createElement("div"),this.adContainer.id=`playsout-applixir-ad-${++Dt}`,document.body.appendChild(this.adContainer),this.adContainer)}showAdError(e){let i=this.shadow.querySelector(".modal-error");i&&(i.textContent=e?this.t(e):"")}completeAdUnlock(e){if(this.currentVideo?.id!==e)return;let i=this.currentVideo;if(this.isCurrentVideoUnlocked=!0,this.hideUnlockModal(),this.emit("ad-complete",{id:i.id,title:this.t(i.titleKey)}),this.pendingNextVideo){let a=this.pendingNextVideo;this.pendingNextVideo=null,this.openVideo(a,!0)}else this.shadow.querySelector("video")?.play().catch(()=>{})}hideUnlockModal(){this.shadow.querySelector(".modal-layer")?.remove()}closeVideo(e=!0){let i=this.currentVideo;this.cleanupPlayer(),e&&i&&this.emit("video-close",{id:i.id,title:this.t(i.titleKey)})}cleanupPlayer(){let e=this.shadow.querySelector("video");e&&(e.pause(),e.removeAttribute("src"),e.load()),this.shadow.querySelector(".player-overlay")?.remove(),this.shadow.querySelector(".modal-layer")?.remove(),this.currentVideo=null,this.pendingNextVideo=null,this.isCurrentVideoUnlocked=!1}emit(e,i){this.dispatchEvent(new CustomEvent(e,{detail:i,bubbles:!0,composed:!0}))}};typeof customElements<"u"&&(customElements.get("playsout-widget")||customElements.define("playsout-widget",P),customElements.get("playsout-video-widget")||customElements.define("playsout-video-widget",$));var{init:Nt,mount:Ut,unmount:Ot,destroy:zt,Login:Bt,logout:Gt,getToken:$t,getUserInfo:Ht,getUser:Kt,setLocale:jt,getLocale:Vt,getGames:qt,getCategories:Ft,on:Wt,off:Zt,isInitialized:Yt,isLoggedIn:Qt,instance:Xt,PlaysoutSDKClass:Jt}=C;typeof window<"u"&&(window.Playsout=C,window.__playsout_sdk_instance=C.instance);return Ve(ei);})();