@ttmg/cli 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -1
- package/dist/index.js +564 -272
- package/dist/index.js.map +1 -1
- package/dist/public/assets/index-3dSJcSdI.js +67 -0
- package/dist/public/assets/index-3dSJcSdI.js.br +0 -0
- package/dist/public/assets/index-B9XS0oB-.css +1 -0
- package/dist/public/assets/index-B9XS0oB-.css.br +0 -0
- package/dist/public/assets/index-BBms5OYm.css +1 -0
- package/dist/public/assets/index-BBms5OYm.css.br +0 -0
- package/dist/public/assets/index-BLeuZX1W.css +1 -0
- package/dist/public/assets/index-BLeuZX1W.css.br +0 -0
- package/dist/public/assets/index-BQeetFTy.css +1 -0
- package/dist/public/assets/index-BQeetFTy.css.br +0 -0
- package/dist/public/assets/index-B_Qh1IFA.js +67 -0
- package/dist/public/assets/index-B_Qh1IFA.js.br +0 -0
- package/dist/public/assets/index-BcvpKJpv.js +12 -0
- package/dist/public/assets/index-BcvpKJpv.js.br +0 -0
- package/dist/public/assets/index-BjfplLoJ.js +67 -0
- package/dist/public/assets/index-BjfplLoJ.js.br +0 -0
- package/dist/public/assets/index-Bw6Q4Jbr.js +67 -0
- package/dist/public/assets/index-Bw6Q4Jbr.js.br +0 -0
- package/dist/public/assets/index-BzM7ZRWT.js +67 -0
- package/dist/public/assets/index-CEfsFr9q.js +67 -0
- package/dist/public/assets/index-CEfsFr9q.js.br +0 -0
- package/dist/public/assets/index-CNGNW4V0.css +1 -0
- package/dist/public/assets/index-CNGNW4V0.css.br +0 -0
- package/dist/public/assets/index-CPKWZ0lk.js +67 -0
- package/dist/public/assets/index-CPKWZ0lk.js.br +0 -0
- package/dist/public/assets/index-CYjeGeW3.js +67 -0
- package/dist/public/assets/index-CYjeGeW3.js.br +0 -0
- package/dist/public/assets/index-CieLbLV3.js +67 -0
- package/dist/public/assets/index-CieLbLV3.js.br +0 -0
- package/dist/public/assets/index-CkfGcO9X.js +67 -0
- package/dist/public/assets/index-CkfGcO9X.js.br +0 -0
- package/dist/public/assets/index-CvRRmiYm.js +67 -0
- package/dist/public/assets/index-CvRRmiYm.js.br +0 -0
- package/dist/public/assets/index-D92wLRBC.css +1 -0
- package/dist/public/assets/index-D92wLRBC.css.br +0 -0
- package/dist/public/assets/index-DF19Ik_I.js +67 -0
- package/dist/public/assets/index-DF19Ik_I.js.br +0 -0
- package/dist/public/assets/index-DL6K0uau.css +1 -0
- package/dist/public/assets/index-DL6K0uau.css.br +0 -0
- package/dist/public/assets/index-DOZ9HWK0.js +67 -0
- package/dist/public/assets/index-DOZ9HWK0.js.br +0 -0
- package/dist/public/assets/index-DPSI2SAJ.js +67 -0
- package/dist/public/assets/index-DPSI2SAJ.js.br +0 -0
- package/dist/public/assets/index-DTOwOuUY.js +67 -0
- package/dist/public/assets/index-DTOwOuUY.js.br +0 -0
- package/dist/public/assets/index-DewGL4pl.js +12 -0
- package/dist/public/assets/index-DiaqC69h.js +67 -0
- package/dist/public/assets/index-DiaqC69h.js.br +0 -0
- package/dist/public/assets/index-Dsnf7n5I.css +1 -0
- package/dist/public/assets/index-DxEOIplv.js +67 -0
- package/dist/public/assets/index-DxEOIplv.js.br +0 -0
- package/dist/public/assets/index-VKaSrbK1.js +67 -0
- package/dist/public/assets/index-Wp-ZSjKf.css +1 -0
- package/dist/public/assets/index-a4bDRD38.js +67 -0
- package/dist/public/assets/index-a4bDRD38.js.br +0 -0
- package/dist/public/assets/index-nhTk4P_h.js +67 -0
- package/dist/public/assets/index-wkPXet9W.js +67 -0
- package/dist/public/assets/index-wkPXet9W.js.br +0 -0
- package/dist/public/assets/react-dom-B7KT1F-k.js +32 -0
- package/dist/public/assets/react-l0sNRNKZ.js +1 -0
- package/dist/public/assets/semi-ui-3SIY-ze1.js +25 -0
- package/dist/public/assets/semi-ui-BgfPE7Mt.css +1 -0
- package/dist/public/assets/vendor-BgfPE7Mt.css +1 -0
- package/dist/public/assets/vendor-BgfPE7Mt.css.br +0 -0
- package/dist/public/assets/vendor-CP79f9j0.js +56 -0
- package/dist/public/assets/vendor-CP79f9j0.js.br +0 -0
- package/dist/public/index.html +2 -2
- package/dist/template/open_context.html.hbs +0 -1
- package/package.json +6 -2
|
Binary file
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{r as f,j as p,R as U,a as ht,P as Wt,c as pt,T as Ae,A as zt,D as Qt,S as mt,b as $e,F as z,d as se,B as H,e as Kt,C as qt,N as Vt,f as we,g as Jt,h as Yt}from"./semi-ui-3SIY-ze1.js";import{a as Xt,r as gt,g as Zt}from"./react-dom-B7KT1F-k.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();var ne={},ze;function en(){if(ze)return ne;ze=1;var e=Xt();return ne.createRoot=e.createRoot,ne.hydrateRoot=e.hydrateRoot,ne}var tn=en();const Ie=f.createContext(void 0),K=()=>{const e=f.useContext(Ie);if(!e)throw new Error("useAppContext must be used within ContextProvider");return e},nn="TTMG DevTool",rn="Connected",an="Disconnected",on="Switch Current Debugging Device",sn="Use TikTok Scan QR Code to Debug",ln="Client connection disconnected, please scan the QR code to reconnect",cn="Node service connection disconnected, please restart the debugging service in the terminal",un="Start Debug",dn="Welcome to the TikTok Mini Game Debugging Environment. Press F12 or Ctrl+Shift+I to open the browser console to view more debugging information.",fn="Upload Game Package",hn="Uploading game resource...",pn="Uploading game resource, current progress:",mn="Game resource package uploaded successfully, client is loading the game...",gn="Game resource package upload failed, please check the current environment",vn="Initializing game environment...",yn="Game environment initialization failed, please check the current environment",Cn="Getting game debugging environment configuration",wn="Game environment configuration obtained successfully",Sn="Failed to get game environment configuration",xn="Getting game scripts",En="Game scripts run successfully",bn="Game environment runtime environment initialization successful, uploading game resources to the client...",Rn="Uploading game package to the client...",Pn="Upload game package to the client successfully, client is loading the game...",kn="Upload game package to the client failed",Ln="Upload content is empty, please select the game file directory to upload",Dn="Re-upload mini game",Tn="Re-launch mini game",Nn="Close debugging",Bn="Launching...",Mn="Connection to CLI debugging service failed, please check if ttmg dev is running in the game root directory",_n="Connection to local Node debugging service failed",jn="Connecting to local Node debugging service...",On="Connected to local Node debugging service successfully",An="Connection to local Node debugging service failed, please check if ttmg dev is running in the game root directory",$n="Node debugging service disconnected",In="Connected to client debugging service successfully",Fn="Connection to client debugging service failed",Un="Client debugging service disconnected",Hn="Failed to start client debugging service, please check if ttmg dev is running in the game root directory",Gn="Failed to get game scripts",Wn="Do you want to refresh the current page or re-upload the game resource to debug?",zn="Game resource updated!",Qn="Yes,upload.",Kn="No,close.",qn="Upload to platform",Vn="Scanning QR code...",Jn={title:nn,deviceConnected:rn,deviceDisconnected:an,switchDevice:on,scanQRCode:sn,clientDisconnected:ln,nodeDisconnected:cn,startDebug:un,welcome:dn,uploadBtn:fn,uploadStart:hn,uploadProcess:pn,uploadSuccess:mn,uploadError:gn,setupDevEnv:vn,devEnvSetupError:yn,getDevEnvStart:Cn,getDevEnvSuccess:wn,getDevEnvFailed:Sn,getDevScriptsStart:xn,getDevScriptsSuccess:En,devEnvSetupSuccess:bn,uploadGameStart:Rn,uploadGameSuccess:Pn,uploadGameFailed:kn,uploadEmpty:Ln,reUploadGame:Dn,relaunchGame:Tn,closeGame:Nn,loading:Bn,localDevServerError:Mn,nodeServerConnectedFailed:_n,nodeServerStartConnect:jn,nodeServerConnectedSuccess:On,nodeServerStartError:An,nodeServerDisconnect:$n,clientConnectedSuccess:In,clientServerStartError:Fn,clientServerDisconnected:Un,startDebugFailed:Hn,getDevScriptsFailed:Gn,gameResourceChange:Wn,gameResourceUpdated:zn,uploadToClient:Qn,notUpload:Kn,uploadToPlatform:qn,scanning:Vn},Yn="DevTool",Xn="设备已连接",Zn="设备未连接",er="客户端连接已断开,请重新扫码连接",tr="Node 服务连接已断开,请在终端重新启动调试",nr="切换当前调试设备",rr="TikTok 扫码调试",ar="启动调试",or="欢迎来到 TikTok 小游戏调试环境,按 F12 或 Ctrl+Shift+I 打开浏览器控制台,查看更多调试信息。",ir="重新上传代码包到客户端",sr="游戏资源包上传中...",lr="游戏资源包上传中,当前进度:",cr="游戏资源包上传成功,客户端开始加载游戏...",ur="游戏资源包上传失败,请检查当前环境",dr="正在初始化游戏环境...",fr="当前游戏资源已更新,是否刷新当前页面或重新上传游戏资源进行调试?",hr="游戏资源已更新!",pr="游戏环境初始化失败,请检查当前环境",mr="获取游戏调试环境配置",gr="获取游戏环境配置成功",vr="获取游戏环境配置失败",yr="获取游戏脚本",Cr="游戏脚本运行成功",wr="游戏环境运行环境初始化成功,正在上传游戏资源至客户端",Sr="开始上传游戏包至客户端",xr="上传游戏包至客户端成功, 客户端开始加载游戏...",Er="上传游戏包至客户端失败",br="上传内容为空,请选择要上传的游戏文件目录",Rr="重新上传小游戏",Pr="重新启动小游戏",kr="关闭调试",Lr="启动中...",Dr="连接 CLI 调试服务出错,请检查是否在游戏根目录下运行 ttmg dev",Tr="连接本地 Node 调试服务失败",Nr="正在连接本地 Node 调试服务...",Br="连接本地 Node 调试服务成功",Mr="连接本地 Node 调试服务失败,请检查是否在游戏根目录下运行 ttmg dev",_r="Node 调试服务已断开",jr="链接客户端调试服务成功",Or="链接客户端调试服务失败",Ar="客户端调试服务已断开",$r="客户端启动调试环境失败,请重新扫码开启调试服务",Ir="加载游戏脚本失败",Fr="开始上传",Ur="暂不上传",Hr="上传到平台",Gr="正在扫描二维码...",Wr={title:Yn,deviceConnected:Xn,deviceDisconnected:Zn,clientDisconnected:er,nodeDisconnected:tr,switchDevice:nr,scanQRCode:rr,startDebug:ar,welcome:or,uploadBtn:ir,uploadStart:sr,uploadProcess:lr,uploadSuccess:cr,uploadError:ur,setupDevEnv:dr,gameResourceChange:fr,gameResourceUpdated:hr,devEnvSetupError:pr,getDevEnvStart:mr,getDevEnvSuccess:gr,getDevEnvFailed:vr,getDevScriptsStart:yr,getDevScriptsSuccess:Cr,devEnvSetupSuccess:wr,uploadGameStart:Sr,uploadGameSuccess:xr,uploadGameFailed:Er,uploadEmpty:br,reUploadGame:Rr,relaunchGame:Pr,closeGame:kr,loading:Lr,localDevServerError:Dr,nodeServerConnectedFailed:Tr,nodeServerStartConnect:Nr,nodeServerConnectedSuccess:Br,nodeServerStartError:Mr,nodeServerDisconnect:_r,clientConnectedSuccess:jr,clientServerStartError:Or,clientServerDisconnected:Ar,startDebugFailed:$r,getDevScriptsFailed:Ir,uploadToClient:Fr,notUpload:Ur,uploadToPlatform:Hr,scanning:Gr},vt="en-US",Be={"en-US":Jn,"zh-CN":Wr};function zr(){const e=navigator.language;return e in Be?e:e.split("-")[0]==="zh"?"zh-CN":vt}const Qr=zr(),S=e=>Be[Qr][e]??Be[vt][e],Kr={isConnected:!1,schema:"",feature:{upload:!1,loginStatus:!1,sidebar:{enable:!1,info:!1,launch:!1,setting:!1,log:!1,code:!1}},launchOptions:[{label:"启动模式 - 普通模式",value:"normal",config:{}}],selectedLaunchMode:"normal",loading:{visible:!1,text:S("loading")},message:{theme:"warning",text:"",visible:!1}};function qr(e,t){switch(t.type){case"SHOW_LOADING":return{...e,loading:{visible:!0,text:t.payload??S("loading")}};case"HIDE_LOADING":return{...e,loading:{...e.loading,visible:!1}};case"SHOW_MESSAGE":return{...e,message:{...t.payload,visible:!0}};case"HIDE_MESSAGE":return{...e,message:{...e.message,visible:!1}};case"SET_IS_CONNECTED":return{...e,isConnected:t.payload};case"SET_SCHEMA":return{...e,schema:t.payload};default:return e}}const Vr=({children:e})=>{const[t,n]=f.useReducer(qr,Kr),r=f.useCallback(u=>{n({type:"SET_IS_CONNECTED",payload:u})},[]),a=f.useCallback(u=>{n({type:"SHOW_LOADING",payload:u})},[]),o=f.useCallback(()=>{setTimeout(()=>{n({type:"HIDE_LOADING"})},500)},[]),l=f.useCallback(({theme:u,text:d})=>{n({type:"SHOW_MESSAGE",payload:{theme:u,text:d,timeStamp:Date.now()}})},[]),c=f.useCallback(()=>{n({type:"HIDE_MESSAGE"})},[]),s=f.useCallback(u=>{n({type:"SET_SCHEMA",payload:u})},[]),i=f.useMemo(()=>({state:t,showLoading:a,hideLoading:o,showMessage:l,hideMessage:c,setIsConnected:r,setSchema:s}),[t,a,o,l,c,r,s]);return p.jsx(Ie.Provider,{value:i,children:e})};/**
|
|
2
|
+
* react-router v7.8.2
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) Remix Software Inc.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/var Qe="popstate";function Jr(e={}){function t(r,a){let{pathname:o,search:l,hash:c}=r.location;return Me("",{pathname:o,search:l,hash:c},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function n(r,a){return typeof a=="string"?a:X(a)}return Xr(t,n,null,e)}function b(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function B(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Yr(){return Math.random().toString(36).substring(2,10)}function Ke(e,t){return{usr:e.state,key:e.key,idx:t}}function Me(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?q(t):t,state:n,key:t&&t.key||r||Yr()}}function X({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function q(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function Xr(e,t,n,r={}){let{window:a=document.defaultView,v5Compat:o=!1}=r,l=a.history,c="POP",s=null,i=u();i==null&&(i=0,l.replaceState({...l.state,idx:i},""));function u(){return(l.state||{idx:null}).idx}function d(){c="POP";let C=u(),v=C==null?null:C-i;i=C,s&&s({action:c,location:y.location,delta:v})}function h(C,v){c="PUSH";let w=Me(y.location,C,v);i=u()+1;let x=Ke(w,i),R=y.createHref(w);try{l.pushState(x,"",R)}catch(k){if(k instanceof DOMException&&k.name==="DataCloneError")throw k;a.location.assign(R)}o&&s&&s({action:c,location:y.location,delta:1})}function g(C,v){c="REPLACE";let w=Me(y.location,C,v);i=u();let x=Ke(w,i),R=y.createHref(w);l.replaceState(x,"",R),o&&s&&s({action:c,location:y.location,delta:0})}function m(C){return Zr(C)}let y={get action(){return c},get location(){return e(a,l)},listen(C){if(s)throw new Error("A history only accepts one active listener");return a.addEventListener(Qe,d),s=C,()=>{a.removeEventListener(Qe,d),s=null}},createHref(C){return t(a,C)},createURL:m,encodeLocation(C){let v=m(C);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:h,replace:g,go(C){return l.go(C)}};return y}function Zr(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),b(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:X(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function yt(e,t,n="/"){return ea(e,t,n,!1)}function ea(e,t,n,r){let a=typeof t=="string"?q(t):t,o=A(a.pathname||"/",n);if(o==null)return null;let l=Ct(e);ta(l);let c=null;for(let s=0;c==null&&s<l.length;++s){let i=fa(o);c=ua(l[s],i,r)}return c}function Ct(e,t=[],n=[],r="",a=!1){let o=(l,c,s=a,i)=>{let u={relativePath:i===void 0?l.path||"":i,caseSensitive:l.caseSensitive===!0,childrenIndex:c,route:l};if(u.relativePath.startsWith("/")){if(!u.relativePath.startsWith(r)&&s)return;b(u.relativePath.startsWith(r),`Absolute route path "${u.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),u.relativePath=u.relativePath.slice(r.length)}let d=O([r,u.relativePath]),h=n.concat(u);l.children&&l.children.length>0&&(b(l.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${d}".`),Ct(l.children,t,h,d,s)),!(l.path==null&&!l.index)&&t.push({path:d,score:la(d,l.index),routesMeta:h})};return e.forEach((l,c)=>{if(l.path===""||!l.path?.includes("?"))o(l,c);else for(let s of wt(l.path))o(l,c,!0,s)}),t}function wt(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,a=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return a?[o,""]:[o];let l=wt(r.join("/")),c=[];return c.push(...l.map(s=>s===""?o:[o,s].join("/"))),a&&c.push(...l),c.map(s=>e.startsWith("/")&&s===""?"/":s)}function ta(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:ca(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var na=/^:[\w-]+$/,ra=3,aa=2,oa=1,ia=10,sa=-2,qe=e=>e==="*";function la(e,t){let n=e.split("/"),r=n.length;return n.some(qe)&&(r+=sa),t&&(r+=aa),n.filter(a=>!qe(a)).reduce((a,o)=>a+(na.test(o)?ra:o===""?oa:ia),r)}function ca(e,t){return e.length===t.length&&e.slice(0,-1).every((r,a)=>r===t[a])?e[e.length-1]-t[t.length-1]:0}function ua(e,t,n=!1){let{routesMeta:r}=e,a={},o="/",l=[];for(let c=0;c<r.length;++c){let s=r[c],i=c===r.length-1,u=o==="/"?t:t.slice(o.length)||"/",d=le({path:s.relativePath,caseSensitive:s.caseSensitive,end:i},u),h=s.route;if(!d&&i&&n&&!r[r.length-1].route.index&&(d=le({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},u)),!d)return null;Object.assign(a,d.params),l.push({params:a,pathname:O([o,d.pathname]),pathnameBase:ga(O([o,d.pathnameBase])),route:h}),d.pathnameBase!=="/"&&(o=O([o,d.pathnameBase]))}return l}function le(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=da(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;let o=a[0],l=o.replace(/(.)\/+$/,"$1"),c=a.slice(1);return{params:r.reduce((i,{paramName:u,isOptional:d},h)=>{if(u==="*"){let m=c[h]||"";l=o.slice(0,o.length-m.length).replace(/(.)\/+$/,"$1")}const g=c[h];return d&&!g?i[u]=void 0:i[u]=(g||"").replace(/%2F/g,"/"),i},{}),pathname:o,pathnameBase:l,pattern:e}}function da(e,t=!1,n=!0){B(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,c,s)=>(r.push({paramName:c,isOptional:s!=null}),s?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}function fa(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return B(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function A(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function ha(e,t="/"){let{pathname:n,search:r="",hash:a=""}=typeof e=="string"?q(e):e;return{pathname:n?n.startsWith("/")?n:pa(n,t):t,search:va(r),hash:ya(a)}}function pa(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function Se(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function ma(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function St(e){let t=ma(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function xt(e,t,n,r=!1){let a;typeof e=="string"?a=q(e):(a={...e},b(!a.pathname||!a.pathname.includes("?"),Se("?","pathname","search",a)),b(!a.pathname||!a.pathname.includes("#"),Se("#","pathname","hash",a)),b(!a.search||!a.search.includes("#"),Se("#","search","hash",a)));let o=e===""||a.pathname==="",l=o?"/":a.pathname,c;if(l==null)c=n;else{let d=t.length-1;if(!r&&l.startsWith("..")){let h=l.split("/");for(;h[0]==="..";)h.shift(),d-=1;a.pathname=h.join("/")}c=d>=0?t[d]:"/"}let s=ha(a,c),i=l&&l!=="/"&&l.endsWith("/"),u=(o||l===".")&&n.endsWith("/");return!s.pathname.endsWith("/")&&(i||u)&&(s.pathname+="/"),s}var O=e=>e.join("/").replace(/\/\/+/g,"/"),ga=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),va=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,ya=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Ca(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}var Et=["POST","PUT","PATCH","DELETE"];new Set(Et);var wa=["GET",...Et];new Set(wa);var V=f.createContext(null);V.displayName="DataRouter";var de=f.createContext(null);de.displayName="DataRouterState";f.createContext(!1);var bt=f.createContext({isTransitioning:!1});bt.displayName="ViewTransition";var Sa=f.createContext(new Map);Sa.displayName="Fetchers";var xa=f.createContext(null);xa.displayName="Await";var M=f.createContext(null);M.displayName="Navigation";var Z=f.createContext(null);Z.displayName="Location";var $=f.createContext({outlet:null,matches:[],isDataRoute:!1});$.displayName="Route";var Fe=f.createContext(null);Fe.displayName="RouteError";function Ea(e,{relative:t}={}){b(ee(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=f.useContext(M),{hash:a,pathname:o,search:l}=te(e,{relative:t}),c=o;return n!=="/"&&(c=o==="/"?n:O([n,o])),r.createHref({pathname:c,search:l,hash:a})}function ee(){return f.useContext(Z)!=null}function G(){return b(ee(),"useLocation() may be used only in the context of a <Router> component."),f.useContext(Z).location}var Rt="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Pt(e){f.useContext(M).static||f.useLayoutEffect(e)}function ba(){let{isDataRoute:e}=f.useContext($);return e?Aa():Ra()}function Ra(){b(ee(),"useNavigate() may be used only in the context of a <Router> component.");let e=f.useContext(V),{basename:t,navigator:n}=f.useContext(M),{matches:r}=f.useContext($),{pathname:a}=G(),o=JSON.stringify(St(r)),l=f.useRef(!1);return Pt(()=>{l.current=!0}),f.useCallback((s,i={})=>{if(B(l.current,Rt),!l.current)return;if(typeof s=="number"){n.go(s);return}let u=xt(s,JSON.parse(o),a,i.relative==="path");e==null&&t!=="/"&&(u.pathname=u.pathname==="/"?t:O([t,u.pathname])),(i.replace?n.replace:n.push)(u,i.state,i)},[t,n,o,a,e])}f.createContext(null);function te(e,{relative:t}={}){let{matches:n}=f.useContext($),{pathname:r}=G(),a=JSON.stringify(St(n));return f.useMemo(()=>xt(e,JSON.parse(a),r,t==="path"),[e,a,r,t])}function Pa(e,t){return kt(e,t)}function kt(e,t,n,r,a){b(ee(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=f.useContext(M),{matches:l}=f.useContext($),c=l[l.length-1],s=c?c.params:{},i=c?c.pathname:"/",u=c?c.pathnameBase:"/",d=c&&c.route;{let w=d&&d.path||"";Lt(i,!d||w.endsWith("*")||w.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${i}" (under <Route path="${w}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
11
|
+
|
|
12
|
+
Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let h=G(),g;if(t){let w=typeof t=="string"?q(t):t;b(u==="/"||w.pathname?.startsWith(u),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${u}" but pathname "${w.pathname}" was given in the \`location\` prop.`),g=w}else g=h;let m=g.pathname||"/",y=m;if(u!=="/"){let w=u.replace(/^\//,"").split("/");y="/"+m.replace(/^\//,"").split("/").slice(w.length).join("/")}let C=yt(e,{pathname:y});B(d||C!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),B(C==null||C[C.length-1].route.element!==void 0||C[C.length-1].route.Component!==void 0||C[C.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let v=Na(C&&C.map(w=>Object.assign({},w,{params:Object.assign({},s,w.params),pathname:O([u,o.encodeLocation?o.encodeLocation(w.pathname).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?u:O([u,o.encodeLocation?o.encodeLocation(w.pathnameBase).pathname:w.pathnameBase])})),l,n,r,a);return t&&v?f.createElement(Z.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...g},navigationType:"POP"}},v):v}function ka(){let e=Oa(),t=Ca(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:r},o={padding:"2px 4px",backgroundColor:r},l=null;return console.error("Error handled by React Router default ErrorBoundary:",e),l=f.createElement(f.Fragment,null,f.createElement("p",null,"💿 Hey developer 👋"),f.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",f.createElement("code",{style:o},"ErrorBoundary")," or"," ",f.createElement("code",{style:o},"errorElement")," prop on your route.")),f.createElement(f.Fragment,null,f.createElement("h2",null,"Unexpected Application Error!"),f.createElement("h3",{style:{fontStyle:"italic"}},t),n?f.createElement("pre",{style:a},n):null,l)}var La=f.createElement(ka,null),Da=class extends f.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.unstable_onError?this.props.unstable_onError(e,t):console.error("React Router caught the following error during render",e)}render(){return this.state.error!==void 0?f.createElement($.Provider,{value:this.props.routeContext},f.createElement(Fe.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function Ta({routeContext:e,match:t,children:n}){let r=f.useContext(V);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),f.createElement($.Provider,{value:e},n)}function Na(e,t=[],n=null,r=null,a=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,l=n?.errors;if(l!=null){let i=o.findIndex(u=>u.route.id&&l?.[u.route.id]!==void 0);b(i>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),o=o.slice(0,Math.min(o.length,i+1))}let c=!1,s=-1;if(n)for(let i=0;i<o.length;i++){let u=o[i];if((u.route.HydrateFallback||u.route.hydrateFallbackElement)&&(s=i),u.route.id){let{loaderData:d,errors:h}=n,g=u.route.loader&&!d.hasOwnProperty(u.route.id)&&(!h||h[u.route.id]===void 0);if(u.route.lazy||g){c=!0,s>=0?o=o.slice(0,s+1):o=[o[0]];break}}}return o.reduceRight((i,u,d)=>{let h,g=!1,m=null,y=null;n&&(h=l&&u.route.id?l[u.route.id]:void 0,m=u.route.errorElement||La,c&&(s<0&&d===0?(Lt("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),g=!0,y=null):s===d&&(g=!0,y=u.route.hydrateFallbackElement||null)));let C=t.concat(o.slice(0,d+1)),v=()=>{let w;return h?w=m:g?w=y:u.route.Component?w=f.createElement(u.route.Component,null):u.route.element?w=u.route.element:w=i,f.createElement(Ta,{match:u,routeContext:{outlet:i,matches:C,isDataRoute:n!=null},children:w})};return n&&(u.route.ErrorBoundary||u.route.errorElement||d===0)?f.createElement(Da,{location:n.location,revalidation:n.revalidation,component:m,error:h,children:v(),routeContext:{outlet:null,matches:C,isDataRoute:!0},unstable_onError:r}):v()},null)}function Ue(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ba(e){let t=f.useContext(V);return b(t,Ue(e)),t}function Ma(e){let t=f.useContext(de);return b(t,Ue(e)),t}function _a(e){let t=f.useContext($);return b(t,Ue(e)),t}function He(e){let t=_a(e),n=t.matches[t.matches.length-1];return b(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function ja(){return He("useRouteId")}function Oa(){let e=f.useContext(Fe),t=Ma("useRouteError"),n=He("useRouteError");return e!==void 0?e:t.errors?.[n]}function Aa(){let{router:e}=Ba("useNavigate"),t=He("useNavigate"),n=f.useRef(!1);return Pt(()=>{n.current=!0}),f.useCallback(async(a,o={})=>{B(n.current,Rt),n.current&&(typeof a=="number"?e.navigate(a):await e.navigate(a,{fromRouteId:t,...o}))},[e,t])}var Ve={};function Lt(e,t,n){!t&&!Ve[e]&&(Ve[e]=!0,B(!1,n))}f.memo($a);function $a({routes:e,future:t,state:n,unstable_onError:r}){return kt(e,void 0,n,r,t)}function Dt(e){b(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function Ia({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:a,static:o=!1}){b(!ee(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),c=f.useMemo(()=>({basename:l,navigator:a,static:o,future:{}}),[l,a,o]);typeof n=="string"&&(n=q(n));let{pathname:s="/",search:i="",hash:u="",state:d=null,key:h="default"}=n,g=f.useMemo(()=>{let m=A(s,l);return m==null?null:{location:{pathname:m,search:i,hash:u,state:d,key:h},navigationType:r}},[l,s,i,u,d,h,r]);return B(g!=null,`<Router basename="${l}"> is not able to match the URL "${s}${i}${u}" because it does not start with the basename, so the <Router> won't render anything.`),g==null?null:f.createElement(M.Provider,{value:c},f.createElement(Z.Provider,{children:t,value:g}))}function Fa({children:e,location:t}){return Pa(_e(e),t)}function _e(e,t=[]){let n=[];return f.Children.forEach(e,(r,a)=>{if(!f.isValidElement(r))return;let o=[...t,a];if(r.type===f.Fragment){n.push.apply(n,_e(r.props.children,o));return}b(r.type===Dt,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),b(!r.props.index||!r.props.children,"An index route cannot have child routes.");let l={id:r.props.id||o.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(l.children=_e(r.props.children,o)),n.push(l)}),n}var oe="get",ie="application/x-www-form-urlencoded";function fe(e){return e!=null&&typeof e.tagName=="string"}function Ua(e){return fe(e)&&e.tagName.toLowerCase()==="button"}function Ha(e){return fe(e)&&e.tagName.toLowerCase()==="form"}function Ga(e){return fe(e)&&e.tagName.toLowerCase()==="input"}function Wa(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function za(e,t){return e.button===0&&(!t||t==="_self")&&!Wa(e)}var re=null;function Qa(){if(re===null)try{new FormData(document.createElement("form"),0),re=!1}catch{re=!0}return re}var Ka=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function xe(e){return e!=null&&!Ka.has(e)?(B(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ie}"`),null):e}function qa(e,t){let n,r,a,o,l;if(Ha(e)){let c=e.getAttribute("action");r=c?A(c,t):null,n=e.getAttribute("method")||oe,a=xe(e.getAttribute("enctype"))||ie,o=new FormData(e)}else if(Ua(e)||Ga(e)&&(e.type==="submit"||e.type==="image")){let c=e.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||c.getAttribute("action");if(r=s?A(s,t):null,n=e.getAttribute("formmethod")||c.getAttribute("method")||oe,a=xe(e.getAttribute("formenctype"))||xe(c.getAttribute("enctype"))||ie,o=new FormData(c,e),!Qa()){let{name:i,type:u,value:d}=e;if(u==="image"){let h=i?`${i}.`:"";o.append(`${h}x`,"0"),o.append(`${h}y`,"0")}else i&&o.append(i,d)}}else{if(fe(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=oe,r=null,a=ie,l=e}return o&&a==="text/plain"&&(l=o,o=void 0),{action:r,method:n.toLowerCase(),encType:a,formData:o,body:l}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Ge(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Va(e,t,n){let r=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r.pathname==="/"?r.pathname=`_root.${n}`:t&&A(r.pathname,t)==="/"?r.pathname=`${t.replace(/\/$/,"")}/_root.${n}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${n}`,r}async function Ja(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Ya(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function Xa(e,t,n){let r=await Promise.all(e.map(async a=>{let o=t.routes[a.route.id];if(o){let l=await Ja(o,n);return l.links?l.links():[]}return[]}));return no(r.flat(1).filter(Ya).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function Je(e,t,n,r,a,o){let l=(s,i)=>n[i]?s.route.id!==n[i].route.id:!0,c=(s,i)=>n[i].pathname!==s.pathname||n[i].route.path?.endsWith("*")&&n[i].params["*"]!==s.params["*"];return o==="assets"?t.filter((s,i)=>l(s,i)||c(s,i)):o==="data"?t.filter((s,i)=>{let u=r.routes[s.route.id];if(!u||!u.hasLoader)return!1;if(l(s,i)||c(s,i))return!0;if(s.route.shouldRevalidate){let d=s.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:s.params,defaultShouldRevalidate:!0});if(typeof d=="boolean")return d}return!0}):[]}function Za(e,t,{includeHydrateFallback:n}={}){return eo(e.map(r=>{let a=t.routes[r.route.id];if(!a)return[];let o=[a.module];return a.clientActionModule&&(o=o.concat(a.clientActionModule)),a.clientLoaderModule&&(o=o.concat(a.clientLoaderModule)),n&&a.hydrateFallbackModule&&(o=o.concat(a.hydrateFallbackModule)),a.imports&&(o=o.concat(a.imports)),o}).flat(1))}function eo(e){return[...new Set(e)]}function to(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function no(e,t){let n=new Set;return new Set(t),e.reduce((r,a)=>{let o=JSON.stringify(to(a));return n.has(o)||(n.add(o),r.push({key:o,link:a})),r},[])}function Tt(){let e=f.useContext(V);return Ge(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function ro(){let e=f.useContext(de);return Ge(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var We=f.createContext(void 0);We.displayName="FrameworkContext";function Nt(){let e=f.useContext(We);return Ge(e,"You must render this element inside a <HydratedRouter> element"),e}function ao(e,t){let n=f.useContext(We),[r,a]=f.useState(!1),[o,l]=f.useState(!1),{onFocus:c,onBlur:s,onMouseEnter:i,onMouseLeave:u,onTouchStart:d}=t,h=f.useRef(null);f.useEffect(()=>{if(e==="render"&&l(!0),e==="viewport"){let y=v=>{v.forEach(w=>{l(w.isIntersecting)})},C=new IntersectionObserver(y,{threshold:.5});return h.current&&C.observe(h.current),()=>{C.disconnect()}}},[e]),f.useEffect(()=>{if(r){let y=setTimeout(()=>{l(!0)},100);return()=>{clearTimeout(y)}}},[r]);let g=()=>{a(!0)},m=()=>{a(!1),l(!1)};return n?e!=="intent"?[o,h,{}]:[o,h,{onFocus:J(c,g),onBlur:J(s,m),onMouseEnter:J(i,g),onMouseLeave:J(u,m),onTouchStart:J(d,g)}]:[!1,h,{}]}function J(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function oo({page:e,...t}){let{router:n}=Tt(),r=f.useMemo(()=>yt(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?f.createElement(so,{page:e,matches:r,...t}):null}function io(e){let{manifest:t,routeModules:n}=Nt(),[r,a]=f.useState([]);return f.useEffect(()=>{let o=!1;return Xa(e,t,n).then(l=>{o||a(l)}),()=>{o=!0}},[e,t,n]),r}function so({page:e,matches:t,...n}){let r=G(),{manifest:a,routeModules:o}=Nt(),{basename:l}=Tt(),{loaderData:c,matches:s}=ro(),i=f.useMemo(()=>Je(e,t,s,a,r,"data"),[e,t,s,a,r]),u=f.useMemo(()=>Je(e,t,s,a,r,"assets"),[e,t,s,a,r]),d=f.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let m=new Set,y=!1;if(t.forEach(v=>{let w=a.routes[v.route.id];!w||!w.hasLoader||(!i.some(x=>x.route.id===v.route.id)&&v.route.id in c&&o[v.route.id]?.shouldRevalidate||w.hasClientLoader?y=!0:m.add(v.route.id))}),m.size===0)return[];let C=Va(e,l,"data");return y&&m.size>0&&C.searchParams.set("_routes",t.filter(v=>m.has(v.route.id)).map(v=>v.route.id).join(",")),[C.pathname+C.search]},[l,c,r,a,i,t,e,o]),h=f.useMemo(()=>Za(u,a),[u,a]),g=io(u);return f.createElement(f.Fragment,null,d.map(m=>f.createElement("link",{key:m,rel:"prefetch",as:"fetch",href:m,...n})),h.map(m=>f.createElement("link",{key:m,rel:"modulepreload",href:m,...n})),g.map(({key:m,link:y})=>f.createElement("link",{key:m,nonce:n.nonce,...y})))}function lo(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var Bt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Bt&&(window.__reactRouterVersion="7.8.2")}catch{}function co({basename:e,children:t,window:n}){let r=f.useRef();r.current==null&&(r.current=Jr({window:n,v5Compat:!0}));let a=r.current,[o,l]=f.useState({action:a.action,location:a.location}),c=f.useCallback(s=>{f.startTransition(()=>l(s))},[l]);return f.useLayoutEffect(()=>a.listen(c),[a,c]),f.createElement(Ia,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a})}var Mt=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_t=f.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:a,reloadDocument:o,replace:l,state:c,target:s,to:i,preventScrollReset:u,viewTransition:d,...h},g){let{basename:m}=f.useContext(M),y=typeof i=="string"&&Mt.test(i),C,v=!1;if(typeof i=="string"&&y&&(C=i,Bt))try{let L=new URL(window.location.href),F=i.startsWith("//")?new URL(L.protocol+i):new URL(i),W=A(F.pathname,m);F.origin===L.origin&&W!=null?i=W+F.search+F.hash:v=!0}catch{B(!1,`<Link to="${i}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let w=Ea(i,{relative:a}),[x,R,k]=ao(r,h),_=po(i,{replace:l,state:c,target:s,preventScrollReset:u,relative:a,viewTransition:d});function T(L){t&&t(L),L.defaultPrevented||_(L)}let j=f.createElement("a",{...h,...k,href:C||w,onClick:v||o?t:T,ref:lo(g,R),target:s,"data-discover":!y&&n==="render"?"true":void 0});return x&&!y?f.createElement(f.Fragment,null,j,f.createElement(oo,{page:w})):j});_t.displayName="Link";var uo=f.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:a=!1,style:o,to:l,viewTransition:c,children:s,...i},u){let d=te(l,{relative:i.relative}),h=G(),g=f.useContext(de),{navigator:m,basename:y}=f.useContext(M),C=g!=null&&Co(d)&&c===!0,v=m.encodeLocation?m.encodeLocation(d).pathname:d.pathname,w=h.pathname,x=g&&g.navigation&&g.navigation.location?g.navigation.location.pathname:null;n||(w=w.toLowerCase(),x=x?x.toLowerCase():null,v=v.toLowerCase()),x&&y&&(x=A(x,y)||x);const R=v!=="/"&&v.endsWith("/")?v.length-1:v.length;let k=w===v||!a&&w.startsWith(v)&&w.charAt(R)==="/",_=x!=null&&(x===v||!a&&x.startsWith(v)&&x.charAt(v.length)==="/"),T={isActive:k,isPending:_,isTransitioning:C},j=k?t:void 0,L;typeof r=="function"?L=r(T):L=[r,k?"active":null,_?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let F=typeof o=="function"?o(T):o;return f.createElement(_t,{...i,"aria-current":j,className:L,ref:u,style:F,to:l,viewTransition:c},typeof s=="function"?s(T):s)});uo.displayName="NavLink";var fo=f.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:a,state:o,method:l=oe,action:c,onSubmit:s,relative:i,preventScrollReset:u,viewTransition:d,...h},g)=>{let m=vo(),y=yo(c,{relative:i}),C=l.toLowerCase()==="get"?"get":"post",v=typeof c=="string"&&Mt.test(c),w=x=>{if(s&&s(x),x.defaultPrevented)return;x.preventDefault();let R=x.nativeEvent.submitter,k=R?.getAttribute("formmethod")||l;m(R||x.currentTarget,{fetcherKey:t,method:k,navigate:n,replace:a,state:o,relative:i,preventScrollReset:u,viewTransition:d})};return f.createElement("form",{ref:g,method:C,action:y,onSubmit:r?s:w,...h,"data-discover":!v&&e==="render"?"true":void 0})});fo.displayName="Form";function ho(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function jt(e){let t=f.useContext(V);return b(t,ho(e)),t}function po(e,{target:t,replace:n,state:r,preventScrollReset:a,relative:o,viewTransition:l}={}){let c=ba(),s=G(),i=te(e,{relative:o});return f.useCallback(u=>{if(za(u,t)){u.preventDefault();let d=n!==void 0?n:X(s)===X(i);c(e,{replace:d,state:r,preventScrollReset:a,relative:o,viewTransition:l})}},[s,c,i,n,r,t,e,a,o,l])}var mo=0,go=()=>`__${String(++mo)}__`;function vo(){let{router:e}=jt("useSubmit"),{basename:t}=f.useContext(M),n=ja();return f.useCallback(async(r,a={})=>{let{action:o,method:l,encType:c,formData:s,body:i}=qa(r,t);if(a.navigate===!1){let u=a.fetcherKey||go();await e.fetch(u,n,a.action||o,{preventScrollReset:a.preventScrollReset,formData:s,body:i,formMethod:a.method||l,formEncType:a.encType||c,flushSync:a.flushSync})}else await e.navigate(a.action||o,{preventScrollReset:a.preventScrollReset,formData:s,body:i,formMethod:a.method||l,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[e,t,n])}function yo(e,{relative:t}={}){let{basename:n}=f.useContext(M),r=f.useContext($);b(r,"useFormAction must be used inside a RouteContext");let[a]=r.matches.slice(-1),o={...te(e||".",{relative:t})},l=G();if(e==null){o.search=l.search;let c=new URLSearchParams(o.search),s=c.getAll("index");if(s.some(u=>u==="")){c.delete("index"),s.filter(d=>d).forEach(d=>c.append("index",d));let u=c.toString();o.search=u?`?${u}`:""}}return(!e||e===".")&&a.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:O([n,o.pathname])),X(o)}function Co(e,{relative:t}={}){let n=f.useContext(bt);b(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=jt("useViewTransitionState"),a=te(e,{relative:t});if(!n.isTransitioning)return!1;let o=A(n.currentLocation.pathname,r)||n.currentLocation.pathname,l=A(n.nextLocation.pathname,r)||n.nextLocation.pathname;return le(a.pathname,l)!=null||le(a.pathname,o)!=null}const wo=({size:e=24,color:t="#000",style:n,className:r})=>p.jsx("div",{style:{display:"flex",alignItems:"center",position:"relative"},children:p.jsxs("svg",{fill:"currentColor",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",width:e,height:e,children:[p.jsx("path",{d:"M37.86 17.82c.14.24.14.67.14 1.53v9.5c0 1.14 0 1.72-.2 2.26-.16.49-.43.96-.77 1.34-.37.44-.87.73-1.86 1.3l-7.84 4.53c-.74.43-1.11.64-1.4.64a.66.66 0 0 1-.58-.34c-.14-.24-.14-.67-.14-1.53v-9.5c0-1.14 0-1.71.2-2.26.16-.48.43-.95.76-1.34.38-.44.88-.73 1.87-1.3l7.84-4.52c.74-.43 1.11-.65 1.4-.64.25 0 .45.12.58.33Z"}),p.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m27.54 1.99 7 3.93 6.89 4a7.23 7.23 0 0 1 3.59 6.2l.06 7.88-.06 7.88a7.23 7.23 0 0 1-3.6 6.2l-6.88 4-7 3.93a7.23 7.23 0 0 1-7.08 0l-7-3.93-6.9-4a7.23 7.23 0 0 1-3.58-6.2L2.9 24l.07-7.88a7.23 7.23 0 0 1 3.59-6.2l6.89-4 7-3.93a7.23 7.23 0 0 1 7.08 0Zm-2.07 3.67 6.98 3.92 6.86 3.99a3.01 3.01 0 0 1 1.5 2.58l.06 7.85-.07 7.85c0 1.06-.57 2.04-1.5 2.58l-6.85 4-6.98 3.9c-.91.52-2.03.52-2.95 0l-6.97-3.9-6.86-4a3.01 3.01 0 0 1-1.5-2.58L7.13 24l.06-7.85c.01-1.06.58-2.04 1.5-2.58l6.86-4 6.97-3.9a3.01 3.01 0 0 1 2.95 0Z"})]})}),So=()=>p.jsxs("div",{className:"logo-container",children:[p.jsx(wo,{size:48}),p.jsx("div",{className:"logo-title",children:S("title")})]});var Ot={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Ye=U.createContext&&U.createContext(Ot),xo=["attr","size","title"];function Eo(e,t){if(e==null)return{};var n=bo(e,t),r,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)r=o[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function bo(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function ce(){return ce=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ce.apply(this,arguments)}function Xe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ue(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Xe(Object(n),!0).forEach(function(r){Ro(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xe(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ro(e,t,n){return t=Po(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Po(e){var t=ko(e,"string");return typeof t=="symbol"?t:t+""}function ko(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function At(e){return e&&e.map((t,n)=>U.createElement(t.tag,ue({key:n},t.attr),At(t.child)))}function I(e){return t=>U.createElement(Lo,ce({attr:ue({},e.attr)},t),At(e.child))}function Lo(e){var t=n=>{var{attr:r,size:a,title:o}=e,l=Eo(e,xo),c=a||n.size||"1em",s;return n.className&&(s=n.className),e.className&&(s=(s?s+" ":"")+e.className),U.createElement("svg",ce({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,l,{className:s,style:ue(ue({color:e.color||n.color},n.style),e.style),height:c,width:c,xmlns:"http://www.w3.org/2000/svg"}),o&&U.createElement("title",null,o),e.children)};return Ye!==void 0?U.createElement(Ye.Consumer,null,n=>t(n)):t(Ot)}function Do(e){return I({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M13 19v-4h3l-4-5-4 5h3v4z"},child:[]},{tag:"path",attr:{d:"M7 19h2v-2H7c-1.654 0-3-1.346-3-3 0-1.404 1.199-2.756 2.673-3.015l.581-.102.192-.558C8.149 8.274 9.895 7 12 7c2.757 0 5 2.243 5 5v1h1c1.103 0 2 .897 2 2s-.897 2-2 2h-3v2h3c2.206 0 4-1.794 4-4a4.01 4.01 0 0 0-3.056-3.888C18.507 7.67 15.56 5 12 5 9.244 5 6.85 6.611 5.757 9.15 3.609 9.792 2 11.82 2 14c0 2.757 2.243 5 5 5z"},child:[]}]})(e)}const To=()=>p.jsxs("div",{className:"uploader",children:[p.jsx(Do,{className:"uploader-icon",color:"#000",size:24}),p.jsx("div",{className:"uploader-text",children:S("uploadToPlatform")})]});class No{listeners=new Map;on(t,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),()=>this.off(t,n)}off(t,n){const r=this.listeners.get(t);r&&(r.delete(n),r.size===0&&this.listeners.delete(t))}emit(t,n){const r=this.listeners.get(t);r&&r.forEach(a=>{try{a(n)}catch(o){console.error(`Error in listener for event "${String(t)}":`,o)}})}removeAllListeners(t){this.listeners.delete(t)}clearAll(){this.listeners.clear()}}const E=new No;function he(e){const{url:t,method:n="GET",data:r=void 0,headers:a={},timeout:o=1e4}=e;let l=t;const c={method:n,headers:{"Content-Type":"application/json",...a}};if(n.toUpperCase()==="GET"&&r){const s=new URLSearchParams(r).toString();l+=(l.includes("?")?"&":"?")+s}else r&&(c.body=JSON.stringify(r));return Promise.race([fetch(l,c).then(async s=>{if(!s.ok)return{isSuccess:!1,msg:s.statusText};const i=s.headers.get("content-type");if(i&&i.includes("application/json"))try{const u=await s.text();return u.trim()?JSON.parse(u):{isSuccess:!0,data:{}}}catch(u){throw new Error(`Failed to parse JSON response: ${u instanceof Error?u.message:"Unknown error"}`)}else return s.text()}),new Promise((s,i)=>setTimeout(()=>i(new Error("Request timeout")),o))])}function Bo(e){return new URLSearchParams(window.location.search).get(e)}function pe(e,...t){Number(Bo("enableLog"))&&console[e](...t)}const D=(...e)=>pe("log",...e);D.info=(...e)=>pe("info",...e);D.warn=(...e)=>pe("warn",...e);D.error=(...e)=>pe("error",...e);const Y={isNodeWSConnected:!1,isClientWSConnected:!1,clientHost:null,clientWsPort:null,clientHttpPort:null,clientKey:"",isResourcesReady:!1,isScriptsReady:!1,packages:{}};class Mo{data;constructor(t){this.data={...Y,...t}}get(t){return this.data[t]}set(t,n){this.data[t]=n,this.logUpdate({[t]:n})}setMultiple(t){this.data={...this.data,...t},this.logUpdate(t)}getMultiple(t){return t.reduce((n,r)=>(n[r]=this.data[r],n),{})}getAll(){return{...this.data}}resetField(t){this.data[t]=Y[t],this.logUpdate({[t]:Y[t]})}clear(){this.data={...Y},this.logUpdate(Y,!0)}init(t){this.data=t,this.logUpdate(t,!0)}logUpdate(t,n=!1){n?D("Store has been reset/initialized."):D("Store updated with batch:",t)}}const P=new Mo,$t=()=>`http://${P.get("clientHost")}:${P.get("clientHttpPort")}`,_o={allowed_domains:[],app_version:"",client_key_type:0,description:"TTMG Dev Game",entity:"--",icon_big_url:"https://connect.tiktok-minis.com/assets/icon.png",icon_url:"https://connect.tiktok-minis.com/assets/icon.png",minis_category:"mini_game",minis_status:1,minis_tech_type:0,minis_type:2,name:"TTMG Dev Game",privacy_url:"--",scopes:["user.info.open_id","user.info.basic"],tos_url:"--",update_time:Date.now(),status_code:0,status_msg:""};async function jo(){const e=$t(),t=P.get("clientKey");if(!t)return;const n={..._o,client_key:t,minis_url:`https://minis-${t}-vdebug-minigame.tiktok-minis.us/`,package_config:JSON.stringify({packages:P.get("packages")})};return await he({url:`${e}/game/meta`,method:"POST",data:n,headers:{"Content-Type":"application/json"}})}async function Oo(){const e=document.getElementById("dev-iframe");return new Promise(t=>{e.onload=()=>{e.onload=null,t(e)},e.contentWindow?.location.reload()})}var Q={},Ee,Ze;function It(){return Ze||(Ze=1,Ee={L:1,M:0,Q:3,H:2}),Ee}var be,et;function Ft(){return et||(et=1,be={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}),be}var Re,tt;function Ao(){if(tt)return Re;tt=1;var e=Ft();function t(n){this.mode=e.MODE_8BIT_BYTE,this.data=n}return t.prototype={getLength:function(n){return this.data.length},write:function(n){for(var r=0;r<this.data.length;r++)n.put(this.data.charCodeAt(r),8)}},Re=t,Re}var Pe,nt;function $o(){if(nt)return Pe;nt=1;var e=It();function t(n,r){this.totalCount=n,this.dataCount=r}return t.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],t.getRSBlocks=function(n,r){var a=t.getRsBlockTable(n,r);if(a==null)throw new Error("bad rs block @ typeNumber:"+n+"/errorCorrectLevel:"+r);for(var o=a.length/3,l=new Array,c=0;c<o;c++)for(var s=a[c*3+0],i=a[c*3+1],u=a[c*3+2],d=0;d<s;d++)l.push(new t(i,u));return l},t.getRsBlockTable=function(n,r){switch(r){case e.L:return t.RS_BLOCK_TABLE[(n-1)*4+0];case e.M:return t.RS_BLOCK_TABLE[(n-1)*4+1];case e.Q:return t.RS_BLOCK_TABLE[(n-1)*4+2];case e.H:return t.RS_BLOCK_TABLE[(n-1)*4+3];default:return}},Pe=t,Pe}var ke,rt;function Io(){if(rt)return ke;rt=1;function e(){this.buffer=new Array,this.length=0}return e.prototype={get:function(t){var n=Math.floor(t/8);return(this.buffer[n]>>>7-t%8&1)==1},put:function(t,n){for(var r=0;r<n;r++)this.putBit((t>>>n-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(t){var n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),t&&(this.buffer[n]|=128>>>this.length%8),this.length++}},ke=e,ke}var Le,at;function Ut(){if(at)return Le;at=1;for(var e={glog:function(n){if(n<1)throw new Error("glog("+n+")");return e.LOG_TABLE[n]},gexp:function(n){for(;n<0;)n+=255;for(;n>=256;)n-=255;return e.EXP_TABLE[n]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},t=0;t<8;t++)e.EXP_TABLE[t]=1<<t;for(var t=8;t<256;t++)e.EXP_TABLE[t]=e.EXP_TABLE[t-4]^e.EXP_TABLE[t-5]^e.EXP_TABLE[t-6]^e.EXP_TABLE[t-8];for(var t=0;t<255;t++)e.LOG_TABLE[e.EXP_TABLE[t]]=t;return Le=e,Le}var De,ot;function Ht(){if(ot)return De;ot=1;var e=Ut();function t(n,r){if(n.length==null)throw new Error(n.length+"/"+r);for(var a=0;a<n.length&&n[a]==0;)a++;this.num=new Array(n.length-a+r);for(var o=0;o<n.length-a;o++)this.num[o]=n[o+a]}return t.prototype={get:function(n){return this.num[n]},getLength:function(){return this.num.length},multiply:function(n){for(var r=new Array(this.getLength()+n.getLength()-1),a=0;a<this.getLength();a++)for(var o=0;o<n.getLength();o++)r[a+o]^=e.gexp(e.glog(this.get(a))+e.glog(n.get(o)));return new t(r,0)},mod:function(n){if(this.getLength()-n.getLength()<0)return this;for(var r=e.glog(this.get(0))-e.glog(n.get(0)),a=new Array(this.getLength()),o=0;o<this.getLength();o++)a[o]=this.get(o);for(var o=0;o<n.getLength();o++)a[o]^=e.gexp(e.glog(n.get(o))+r);return new t(a,0).mod(n)}},De=t,De}var Te,it;function Fo(){if(it)return Te;it=1;var e=Ft(),t=Ht(),n=Ut(),r={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},a={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(o){for(var l=o<<10;a.getBCHDigit(l)-a.getBCHDigit(a.G15)>=0;)l^=a.G15<<a.getBCHDigit(l)-a.getBCHDigit(a.G15);return(o<<10|l)^a.G15_MASK},getBCHTypeNumber:function(o){for(var l=o<<12;a.getBCHDigit(l)-a.getBCHDigit(a.G18)>=0;)l^=a.G18<<a.getBCHDigit(l)-a.getBCHDigit(a.G18);return o<<12|l},getBCHDigit:function(o){for(var l=0;o!=0;)l++,o>>>=1;return l},getPatternPosition:function(o){return a.PATTERN_POSITION_TABLE[o-1]},getMask:function(o,l,c){switch(o){case r.PATTERN000:return(l+c)%2==0;case r.PATTERN001:return l%2==0;case r.PATTERN010:return c%3==0;case r.PATTERN011:return(l+c)%3==0;case r.PATTERN100:return(Math.floor(l/2)+Math.floor(c/3))%2==0;case r.PATTERN101:return l*c%2+l*c%3==0;case r.PATTERN110:return(l*c%2+l*c%3)%2==0;case r.PATTERN111:return(l*c%3+(l+c)%2)%2==0;default:throw new Error("bad maskPattern:"+o)}},getErrorCorrectPolynomial:function(o){for(var l=new t([1],0),c=0;c<o;c++)l=l.multiply(new t([1,n.gexp(c)],0));return l},getLengthInBits:function(o,l){if(1<=l&&l<10)switch(o){case e.MODE_NUMBER:return 10;case e.MODE_ALPHA_NUM:return 9;case e.MODE_8BIT_BYTE:return 8;case e.MODE_KANJI:return 8;default:throw new Error("mode:"+o)}else if(l<27)switch(o){case e.MODE_NUMBER:return 12;case e.MODE_ALPHA_NUM:return 11;case e.MODE_8BIT_BYTE:return 16;case e.MODE_KANJI:return 10;default:throw new Error("mode:"+o)}else if(l<41)switch(o){case e.MODE_NUMBER:return 14;case e.MODE_ALPHA_NUM:return 13;case e.MODE_8BIT_BYTE:return 16;case e.MODE_KANJI:return 12;default:throw new Error("mode:"+o)}else throw new Error("type:"+l)},getLostPoint:function(o){for(var l=o.getModuleCount(),c=0,s=0;s<l;s++)for(var i=0;i<l;i++){for(var u=0,d=o.isDark(s,i),h=-1;h<=1;h++)if(!(s+h<0||l<=s+h))for(var g=-1;g<=1;g++)i+g<0||l<=i+g||h==0&&g==0||d==o.isDark(s+h,i+g)&&u++;u>5&&(c+=3+u-5)}for(var s=0;s<l-1;s++)for(var i=0;i<l-1;i++){var m=0;o.isDark(s,i)&&m++,o.isDark(s+1,i)&&m++,o.isDark(s,i+1)&&m++,o.isDark(s+1,i+1)&&m++,(m==0||m==4)&&(c+=3)}for(var s=0;s<l;s++)for(var i=0;i<l-6;i++)o.isDark(s,i)&&!o.isDark(s,i+1)&&o.isDark(s,i+2)&&o.isDark(s,i+3)&&o.isDark(s,i+4)&&!o.isDark(s,i+5)&&o.isDark(s,i+6)&&(c+=40);for(var i=0;i<l;i++)for(var s=0;s<l-6;s++)o.isDark(s,i)&&!o.isDark(s+1,i)&&o.isDark(s+2,i)&&o.isDark(s+3,i)&&o.isDark(s+4,i)&&!o.isDark(s+5,i)&&o.isDark(s+6,i)&&(c+=40);for(var y=0,i=0;i<l;i++)for(var s=0;s<l;s++)o.isDark(s,i)&&y++;var C=Math.abs(100*y/l/l-50)/5;return c+=C*10,c}};return Te=a,Te}var Ne,st;function Uo(){if(st)return Ne;st=1;var e=Ao(),t=$o(),n=Io(),r=Fo(),a=Ht();function o(c,s){this.typeNumber=c,this.errorCorrectLevel=s,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var l=o.prototype;return l.addData=function(c){var s=new e(c);this.dataList.push(s),this.dataCache=null},l.isDark=function(c,s){if(c<0||this.moduleCount<=c||s<0||this.moduleCount<=s)throw new Error(c+","+s);return this.modules[c][s]},l.getModuleCount=function(){return this.moduleCount},l.make=function(){if(this.typeNumber<1){var c=1;for(c=1;c<40;c++){for(var s=t.getRSBlocks(c,this.errorCorrectLevel),i=new n,u=0,d=0;d<s.length;d++)u+=s[d].dataCount;for(var d=0;d<this.dataList.length;d++){var h=this.dataList[d];i.put(h.mode,4),i.put(h.getLength(),r.getLengthInBits(h.mode,c)),h.write(i)}if(i.getLengthInBits()<=u*8)break}this.typeNumber=c}this.makeImpl(!1,this.getBestMaskPattern())},l.makeImpl=function(c,s){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var i=0;i<this.moduleCount;i++){this.modules[i]=new Array(this.moduleCount);for(var u=0;u<this.moduleCount;u++)this.modules[i][u]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(c,s),this.typeNumber>=7&&this.setupTypeNumber(c),this.dataCache==null&&(this.dataCache=o.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,s)},l.setupPositionProbePattern=function(c,s){for(var i=-1;i<=7;i++)if(!(c+i<=-1||this.moduleCount<=c+i))for(var u=-1;u<=7;u++)s+u<=-1||this.moduleCount<=s+u||(0<=i&&i<=6&&(u==0||u==6)||0<=u&&u<=6&&(i==0||i==6)||2<=i&&i<=4&&2<=u&&u<=4?this.modules[c+i][s+u]=!0:this.modules[c+i][s+u]=!1)},l.getBestMaskPattern=function(){for(var c=0,s=0,i=0;i<8;i++){this.makeImpl(!0,i);var u=r.getLostPoint(this);(i==0||c>u)&&(c=u,s=i)}return s},l.createMovieClip=function(c,s,i){var u=c.createEmptyMovieClip(s,i),d=1;this.make();for(var h=0;h<this.modules.length;h++)for(var g=h*d,m=0;m<this.modules[h].length;m++){var y=m*d,C=this.modules[h][m];C&&(u.beginFill(0,100),u.moveTo(y,g),u.lineTo(y+d,g),u.lineTo(y+d,g+d),u.lineTo(y,g+d),u.endFill())}return u},l.setupTimingPattern=function(){for(var c=8;c<this.moduleCount-8;c++)this.modules[c][6]==null&&(this.modules[c][6]=c%2==0);for(var s=8;s<this.moduleCount-8;s++)this.modules[6][s]==null&&(this.modules[6][s]=s%2==0)},l.setupPositionAdjustPattern=function(){for(var c=r.getPatternPosition(this.typeNumber),s=0;s<c.length;s++)for(var i=0;i<c.length;i++){var u=c[s],d=c[i];if(this.modules[u][d]==null)for(var h=-2;h<=2;h++)for(var g=-2;g<=2;g++)h==-2||h==2||g==-2||g==2||h==0&&g==0?this.modules[u+h][d+g]=!0:this.modules[u+h][d+g]=!1}},l.setupTypeNumber=function(c){for(var s=r.getBCHTypeNumber(this.typeNumber),i=0;i<18;i++){var u=!c&&(s>>i&1)==1;this.modules[Math.floor(i/3)][i%3+this.moduleCount-8-3]=u}for(var i=0;i<18;i++){var u=!c&&(s>>i&1)==1;this.modules[i%3+this.moduleCount-8-3][Math.floor(i/3)]=u}},l.setupTypeInfo=function(c,s){for(var i=this.errorCorrectLevel<<3|s,u=r.getBCHTypeInfo(i),d=0;d<15;d++){var h=!c&&(u>>d&1)==1;d<6?this.modules[d][8]=h:d<8?this.modules[d+1][8]=h:this.modules[this.moduleCount-15+d][8]=h}for(var d=0;d<15;d++){var h=!c&&(u>>d&1)==1;d<8?this.modules[8][this.moduleCount-d-1]=h:d<9?this.modules[8][15-d-1+1]=h:this.modules[8][15-d-1]=h}this.modules[this.moduleCount-8][8]=!c},l.mapData=function(c,s){for(var i=-1,u=this.moduleCount-1,d=7,h=0,g=this.moduleCount-1;g>0;g-=2)for(g==6&&g--;;){for(var m=0;m<2;m++)if(this.modules[u][g-m]==null){var y=!1;h<c.length&&(y=(c[h]>>>d&1)==1);var C=r.getMask(s,u,g-m);C&&(y=!y),this.modules[u][g-m]=y,d--,d==-1&&(h++,d=7)}if(u+=i,u<0||this.moduleCount<=u){u-=i,i=-i;break}}},o.PAD0=236,o.PAD1=17,o.createData=function(c,s,i){for(var u=t.getRSBlocks(c,s),d=new n,h=0;h<i.length;h++){var g=i[h];d.put(g.mode,4),d.put(g.getLength(),r.getLengthInBits(g.mode,c)),g.write(d)}for(var m=0,h=0;h<u.length;h++)m+=u[h].dataCount;if(d.getLengthInBits()>m*8)throw new Error("code length overflow. ("+d.getLengthInBits()+">"+m*8+")");for(d.getLengthInBits()+4<=m*8&&d.put(0,4);d.getLengthInBits()%8!=0;)d.putBit(!1);for(;!(d.getLengthInBits()>=m*8||(d.put(o.PAD0,8),d.getLengthInBits()>=m*8));)d.put(o.PAD1,8);return o.createBytes(d,u)},o.createBytes=function(c,s){for(var i=0,u=0,d=0,h=new Array(s.length),g=new Array(s.length),m=0;m<s.length;m++){var y=s[m].dataCount,C=s[m].totalCount-y;u=Math.max(u,y),d=Math.max(d,C),h[m]=new Array(y);for(var v=0;v<h[m].length;v++)h[m][v]=255&c.buffer[v+i];i+=y;var w=r.getErrorCorrectPolynomial(C),x=new a(h[m],w.getLength()-1),R=x.mod(w);g[m]=new Array(w.getLength()-1);for(var v=0;v<g[m].length;v++){var k=v+R.getLength()-g[m].length;g[m][v]=k>=0?R.get(k):0}}for(var _=0,v=0;v<s.length;v++)_+=s[v].totalCount;for(var T=new Array(_),j=0,v=0;v<u;v++)for(var m=0;m<s.length;m++)v<h[m].length&&(T[j++]=h[m][v]);for(var v=0;v<d;v++)for(var m=0;m<s.length;m++)v<g[m].length&&(T[j++]=g[m][v]);return T},Ne=o,Ne}var ae={},lt;function Ho(){if(lt)return ae;lt=1,Object.defineProperty(ae,"__esModule",{value:!0});var e=Object.assign||function(i){for(var u=1;u<arguments.length;u++){var d=arguments[u];for(var h in d)Object.prototype.hasOwnProperty.call(d,h)&&(i[h]=d[h])}return i},t=ht(),n=o(t),r=gt(),a=o(r);function o(i){return i&&i.__esModule?i:{default:i}}function l(i,u){var d={};for(var h in i)u.indexOf(h)>=0||Object.prototype.hasOwnProperty.call(i,h)&&(d[h]=i[h]);return d}var c={bgColor:n.default.oneOfType([n.default.object,n.default.string]).isRequired,bgD:n.default.string.isRequired,fgColor:n.default.oneOfType([n.default.object,n.default.string]).isRequired,fgD:n.default.string.isRequired,size:n.default.number.isRequired,title:n.default.string,viewBoxSize:n.default.number.isRequired,xmlns:n.default.string},s=(0,r.forwardRef)(function(i,u){var d=i.bgColor,h=i.bgD,g=i.fgD,m=i.fgColor,y=i.size,C=i.title,v=i.viewBoxSize,w=i.xmlns,x=w===void 0?"http://www.w3.org/2000/svg":w,R=l(i,["bgColor","bgD","fgD","fgColor","size","title","viewBoxSize","xmlns"]);return a.default.createElement("svg",e({},R,{height:y,ref:u,viewBox:"0 0 "+v+" "+v,width:y,xmlns:x}),C?a.default.createElement("title",null,C):null,a.default.createElement("path",{d:h,fill:d}),a.default.createElement("path",{d:g,fill:m}))});return s.displayName="QRCodeSvg",s.propTypes=c,ae.default=s,ae}var ct;function Go(){if(ct)return Q;ct=1,Object.defineProperty(Q,"__esModule",{value:!0}),Q.QRCode=void 0;var e=Object.assign||function(y){for(var C=1;C<arguments.length;C++){var v=arguments[C];for(var w in v)Object.prototype.hasOwnProperty.call(v,w)&&(y[w]=v[w])}return y},t=ht(),n=d(t),r=It(),a=d(r),o=Uo(),l=d(o),c=gt(),s=d(c),i=Ho(),u=d(i);function d(y){return y&&y.__esModule?y:{default:y}}function h(y,C){var v={};for(var w in y)C.indexOf(w)>=0||Object.prototype.hasOwnProperty.call(y,w)&&(v[w]=y[w]);return v}var g={bgColor:n.default.oneOfType([n.default.object,n.default.string]),fgColor:n.default.oneOfType([n.default.object,n.default.string]),level:n.default.string,size:n.default.number,value:n.default.string.isRequired},m=(0,c.forwardRef)(function(y,C){var v=y.bgColor,w=v===void 0?"#FFFFFF":v,x=y.fgColor,R=x===void 0?"#000000":x,k=y.level,_=k===void 0?"L":k,T=y.size,j=T===void 0?256:T,L=y.value,F=h(y,["bgColor","fgColor","level","size","value"]),W=new l.default(-1,a.default[_]);W.addData(L),W.make();var me=W.modules;return s.default.createElement(u.default,e({},F,{bgColor:w,bgD:me.map(function(ge,ve){return ge.map(function(ye,Ce){return ye?"":"M "+Ce+" "+ve+" l 1 0 0 1 -1 0 Z"}).join(" ")}).join(" "),fgColor:R,fgD:me.map(function(ge,ve){return ge.map(function(ye,Ce){return ye?"M "+Ce+" "+ve+" l 1 0 0 1 -1 0 Z":""}).join(" ")}).join(" "),ref:C,size:j,viewBoxSize:me.length}))});return Q.QRCode=m,m.displayName="QRCode",m.propTypes=g,Q.default=m,Q}var Wo=Go();const Gt=Zt(Wo),zo=()=>{const{state:{isConnected:e,schema:t},setIsConnected:n,showMessage:r}=K(),a=({client:o,node:l,isClientDisconnected:c,isNodeDisconnected:s})=>{D.info("connectionChange",o,l),c&&r({theme:"error",text:S("clientDisconnected")}),s&&r({theme:"error",text:S("nodeDisconnected")}),n(o&&l)};return f.useEffect(()=>(E.on("connectionChange",a),()=>{E.off("connectionChange",a)}),[n]),p.jsx(Wt,{trigger:"hover",showArrow:!0,content:p.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:[p.jsx(Ae.Text,{style:{marginBottom:10},children:S(e?"switchDevice":"scanQRCode")}),p.jsx(Gt,{value:t,size:150})]}),children:p.jsx("div",{className:pt("status-tag",{"status-tag-default":!e,"status-tag-success":e}),children:S(e?"deviceConnected":"deviceDisconnected")})})},Qo=()=>p.jsx(zt,{color:"red",style:{marginLeft:"8px"},size:"small",children:"RS"}),Ko=()=>{const{state:{feature:e}}=K();return p.jsxs("div",{className:"header-wrapper",children:[p.jsxs("div",{className:"header-content",children:[p.jsxs("div",{className:"header-content-left",children:[p.jsx(So,{}),p.jsx(zo,{})]}),p.jsxs("div",{className:"header-content-right",children:[e.upload&&p.jsx(To,{}),e.loginStatus&&p.jsx(Qo,{})]})]}),p.jsx(Qt,{})]})},qo=document.getElementById("dev-iframe"),ut=qo.contentWindow;class Vo{ws;init(t){const n=new WebSocket(`ws://${t.clientHost}:${t.clientWsPort||t.clientHttpPort-1}`);n.onclose=()=>{console.error(S("clientServerDisconnected")),P.set("isClientWSConnected",!1),E.emit("connectionChange",{node:P.get("isNodeWSConnected"),client:!1,isClientDisconnected:!0})},n.onerror=()=>{const r=S("clientServerStartError");console.error(r)},this.ws=n,n.onopen=function(){console.log(S("clientConnectedSuccess")),P.set("isClientWSConnected",!0),E.emit("connectionChange",{node:P.get("isNodeWSConnected"),client:!0,isClientDisconnected:!1}),n.send(JSON.stringify({stage:"connecting",status:"success",message:"Browser connected to Client Server Successfully"}))},n.onmessage=function(r){try{const a=JSON.parse(r.data);switch(a?.method){case"subscribeHandler":ut.__DEV__?.subscribeHandler?.(a?.payload?.event,a?.payload?.data);break;case"invokeHandler":ut.__DEV__?.invokeHandler?.(a?.payload?.callbackId,a?.payload?.data);break;default:break}}catch(a){console.error(a)}}}send(t){t.from="browser",this.ws?.send(JSON.stringify(t))}close(){this.ws?.close(),this.ws=void 0}}const je=new Vo,Jo={start:{msgKey:"uploadGameStart"},success:{msgKey:"uploadGameSuccess",handle:e=>{const{packages:t,clientKey:n}=e||{};P.setMultiple({packages:t,clientKey:n,isResourcesReady:!0}),E.emit("setupStatusChange",{isScriptsReady:P.get("isScriptsReady"),isResourcesReady:!0})}},process:{msgKey:"uploadProcess"},error:{msgKey:"uploadError"},restart:{msgKey:"uploadGameRestart"}};function Yo(e){const{status:t,payload:n}=e,r=Jo[t];if(!r){console.warn(`Unknown upload status: ${t}`);return}const a=S(r.msgKey);E.emit("uploadGame",{status:t,msg:a,progress:n?.progress}),r.handle&&r.handle(n)}class Xo{ws;init(t){return t({isConnected:!1,msg:S("nodeServerStartConnect")}),he({url:"/game/config",method:"GET"}).then(n=>{const{nodeWsPort:r}=n;console.log(S("nodeServerStartConnect")),this.ws=new WebSocket(`ws://localhost:${r}`),this.ws.onclose=()=>{console.error(S("nodeServerDisconnect")),P.set("isNodeWSConnected",!1),E.emit("connectionChange",{node:!1,client:P.get("isClientWSConnected"),isNodeDisconnected:!0})},this.ws.onerror=()=>{const a=S("nodeServerStartError");t({isConnected:!1,msg:a}),console.error(a)},this.ws.onopen=()=>{console.log(S("nodeServerConnectedSuccess")),t({isConnected:!0,msg:S("nodeServerConnectedSuccess")}),P.set("isNodeWSConnected",!0),E.emit("connectionChange",{node:!0,client:P.get("isClientWSConnected"),isNodeDisconnected:!1}),this.ws?.send(JSON.stringify({event:"connected",method:"connected",from:"browser"}))},this.ws.onmessage=a=>{if(a.data){const o=JSON.parse(a.data);switch(o.method){case"uploadStatus":{Yo(o);break}case"resourceChange":{D.info("Node WS resourceChange",o?.payload),E.emit("resourceChange",{});break}case"clientDebugInfo":{const{clientWsPort:c,clientHost:s,clientHttpPort:i}=o.payload;P.setMultiple({clientWsPort:c,clientHost:s,clientHttpPort:i}),je.init({clientWsPort:c,clientHost:s,clientHttpPort:i});break}case"scanQRCodeSuccess":{const{clientWsPort:c,clientHost:s,clientHttpPort:i}=o.payload;P.setMultiple({clientHost:s,clientWsPort:c,clientHttpPort:i}),je.init({clientWsPort:c,clientHost:s,clientHttpPort:i}),E.emit("scanQRCode",{status:"success"});break}case"scanQRCodeFailed":{const{msg:c}=o.payload;E.emit("scanQRCode",{status:"failed",msg:c});break}case"scanQRCodeStart":{E.emit("scanQRCode",{status:"start"});break}}}}}),!0}send(t){t.from="browser",this.ws?.send(JSON.stringify(t))}close(){this.ws?.close(),this.ws=void 0}}const Oe=new Xo,Zo=["krypton.js","ttmg-core.js"];async function dt(){const e=$t();await Oo();try{console.log(S("startDebug"));const t=await he({url:`${e}/game/cwd`,method:"POST",data:{command:"start"}});D.info("客户端启动调试环境成功"),Oe.send({method:"startUpload"})}catch(t){throw console.log(S("startDebugFailed"),t?.message??t),new Error(S("startDebugFailed"))}try{console.log(S("getDevEnvStart"));const n=await(await fetch(`${e}/game/env`)).json();D.info("获取游戏环境配置成功",n);const a=document.getElementById("dev-iframe").contentWindow;globalThis.__DEV__={isEnable:!0,server:e},a.__DEV__={isEnable:!0,server:e},await ei(a,Zo,e),D.info("加载游戏脚本成功"),P.set("isScriptsReady",!0),E.emit("setupStatusChange",{isScriptsReady:!0,isResourcesReady:P.get("isResourcesReady")}),console.log(S("getDevScriptsSuccess"))}catch(t){throw console.log(S("getDevEnvFailed"),t),new Error(S("getDevEnvFailed"))}}async function ei(e,t,n){for(const r of t){const o=await(await fetch(`${n}/game/scripts/${r}`)).text(),l=e.document.createElement("script");l.id=r,l.innerHTML=o,e.document.body.appendChild(l)}}const ti=()=>{const[e,t]=f.useState(!1),[n,r]=f.useState("");return f.useEffect(()=>(Oe.init(a=>{t(a.isConnected),r(a.msg)}),()=>{Oe.close()}),[]),e?null:p.jsx("div",{className:"connection-container",children:p.jsxs("div",{className:"connection-content",children:[p.jsx(mt,{size:"large"}),p.jsx("div",{className:"connection-msg",children:n})]})})};function ni(e){return I({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M8.75 5.5h11.5a.75.75 0 0 1 0 1.5H8.75a.75.75 0 0 1 0-1.5Zm0 6h11.5a.75.75 0 0 1 0 1.5H8.75a.75.75 0 0 1 0-1.5Zm0 6h11.5a.75.75 0 0 1 0 1.5H8.75a.75.75 0 0 1 0-1.5ZM5 12a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM4 7a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 12a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"},child:[]}]})(e)}function ri(e){return I({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeMiterlimit:"10",strokeWidth:"32",d:"M248 64C146.39 64 64 146.39 64 248s82.39 184 184 184 184-82.39 184-184S349.61 64 248 64z"},child:[]},{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32",d:"M220 220h32v116"},child:[]},{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"32",d:"M208 340h88"},child:[]},{tag:"path",attr:{d:"M248 130a26 26 0 1 0 26 26 26 26 0 0 0-26-26z"},child:[]}]})(e)}function ai(e){return I({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32",d:"M262.29 192.31a64 64 0 1 0 57.4 57.4 64.13 64.13 0 0 0-57.4-57.4zM416.39 256a154.34 154.34 0 0 1-1.53 20.79l45.21 35.46a10.81 10.81 0 0 1 2.45 13.75l-42.77 74a10.81 10.81 0 0 1-13.14 4.59l-44.9-18.08a16.11 16.11 0 0 0-15.17 1.75A164.48 164.48 0 0 1 325 400.8a15.94 15.94 0 0 0-8.82 12.14l-6.73 47.89a11.08 11.08 0 0 1-10.68 9.17h-85.54a11.11 11.11 0 0 1-10.69-8.87l-6.72-47.82a16.07 16.07 0 0 0-9-12.22 155.3 155.3 0 0 1-21.46-12.57 16 16 0 0 0-15.11-1.71l-44.89 18.07a10.81 10.81 0 0 1-13.14-4.58l-42.77-74a10.8 10.8 0 0 1 2.45-13.75l38.21-30a16.05 16.05 0 0 0 6-14.08c-.36-4.17-.58-8.33-.58-12.5s.21-8.27.58-12.35a16 16 0 0 0-6.07-13.94l-38.19-30A10.81 10.81 0 0 1 49.48 186l42.77-74a10.81 10.81 0 0 1 13.14-4.59l44.9 18.08a16.11 16.11 0 0 0 15.17-1.75A164.48 164.48 0 0 1 187 111.2a15.94 15.94 0 0 0 8.82-12.14l6.73-47.89A11.08 11.08 0 0 1 213.23 42h85.54a11.11 11.11 0 0 1 10.69 8.87l6.72 47.82a16.07 16.07 0 0 0 9 12.22 155.3 155.3 0 0 1 21.46 12.57 16 16 0 0 0 15.11 1.71l44.89-18.07a10.81 10.81 0 0 1 13.14 4.58l42.77 74a10.8 10.8 0 0 1-2.45 13.75l-38.21 30a16.05 16.05 0 0 0-6.05 14.08c.33 4.14.55 8.3.55 12.47z"},child:[]}]})(e)}function oi(e){return I({attr:{fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.59 14.37a6 6 0 0 1-5.84 7.38v-4.8m5.84-2.58a14.98 14.98 0 0 0 6.16-12.12A14.98 14.98 0 0 0 9.631 8.41m5.96 5.96a14.926 14.926 0 0 1-5.841 2.58m-.119-8.54a6 6 0 0 0-7.381 5.84h4.8m2.581-5.84a14.927 14.927 0 0 0-2.58 5.84m2.699 2.7c-.103.021-.207.041-.311.06a15.09 15.09 0 0 1-2.448-2.448 14.9 14.9 0 0 1 .06-.312m-2.24 2.39a4.493 4.493 0 0 0-1.757 4.306 4.493 4.493 0 0 0 4.306-1.758M16.5 9a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Z"},child:[]}]})(e)}const ii=e=>{const{open:t,onClose:n}=e,[r,a]=f.useState({modeName:"调试模式1",launchMode:"main",scene:"1000",launchParams:""}),o=[{label:"主包",value:"main"},{label:"独立分包",value:"independent"}],l=[{value:"1000",label:"扫码打开"},{value:"1011",label:"推荐流视频「广告锚点」"},{value:"1001",label:"个人中心发现栏小程序主入口,「最近使用」列表"},{value:"1005",label:"个人中心顶部「用户搜索」小游戏入口"},{value:"1007",label:"单人聊天会话中的小程序「消息卡片」"},{value:"1008",label:"......"}],c=[{label:"独立分包1",value:"independent1"},{label:"独立分包2",value:"independent2"}],s=()=>e.onClose(),i=()=>{console.log("启动模式设置:",r),e.onClose()},u=d=>{a(d)};return p.jsx($e,{title:"启动模式设置",visible:t,onCancel:s,size:"medium",footer:p.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:p.jsxs(se,{children:[p.jsx(H,{onClick:s,children:"取消"}),p.jsx(H,{theme:"solid",type:"primary",onClick:i,children:"确定"})]})}),children:p.jsxs(z,{initValues:r,onValueChange:u,style:{padding:"4px 24px"},children:[p.jsx(z.Input,{required:!0,field:"modeName",label:"模式名称",style:{width:"100%"}}),p.jsx(z.Select,{field:"launchMode",label:"选择启动包",optionList:o,style:{width:"100%"}}),r.launchMode!=="main"&&p.jsx(z.Select,{field:"independentPackage",label:"选择独立分包",optionList:c,style:{width:"100%"}}),p.jsx(z.Select,{field:"scene",label:"选择进入场景",placeholder:"请选择进入场景",optionList:l,style:{width:"100%"},filter:!0}),p.jsx(z.Input,{field:"launchParams",label:"启动参数",placeholder:"如:path=home&color=red",style:{width:"100%"}})]})})},N={name:"小游戏 Demo",appId:"sb1234567890abcdef",developer:"张三",createdAt:"2024-08-15",description:"这是一个用于演示的小程序项目,包含基础的页面和功能。",version:"1.0.3",status:"开发中",domains:["https://api.example.com","https://static.example.com"],mainPackageSize:"1.5MB(未超过包大小限制 4MB)",totalPackageSize:"2.8MB(未超过包大小限制 30MB)",independentPackageSize:"1.5MB(未超过包大小限制 4MB)"},si=e=>{const{open:t,onClose:n}=e,r=()=>n(),a=[{key:"项目名称",value:N.name},{key:"AppID",value:N.appId},{key:"开发者",value:N.developer},{key:"创建时间",value:N.createdAt},{key:"项目描述",value:N.description},{key:"版本号",value:N.version},{key:"当前状态",value:N.status},{key:"请求域名",value:p.jsx(se,{vertical:!0,align:"start",spacing:2,children:N.domains.map((o,l)=>p.jsx(Ae.Text,{type:"tertiary",children:o},l))})},{key:"主包大小",value:N.mainPackageSize},{key:"整个包大小",value:N.totalPackageSize},{key:"独立分包大小",value:N.independentPackageSize}];return p.jsx($e,{title:"小游戏项目详情",visible:t,onCancel:r,size:"medium",footer:p.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:p.jsx(H,{onClick:r,children:"关闭"})}),children:p.jsx("div",{style:{padding:"20px 24px"},children:p.jsx(Kt,{data:a,align:"left",size:"small"})})})},li=e=>{const{open:t,onClose:n}=e,[r,a]=f.useState(!1),[o,l]=f.useState(!1),[c,s]=f.useState(!1),[i,u]=f.useState(!1),d=()=>{console.log("保存的调试设置:",{domainCheckEnabled:r,adMockEnabled:o,iapMockEnabled:c,disableCache:i}),n()},h=()=>{n()},g=[{label:"是否开启域名校验",description:"开启后,客户端将校验所有请求的域名是否合法,建议开发环境关闭以便调试。",checked:r,onChange:a},{label:"是否开启 IAA Mock",description:"启用后,广告相关接口将返回模拟数据,方便开发和测试广告逻辑。",checked:o,onChange:l},{label:"是否开启 IAP Mock",description:"启用后,内购相关流程将使用模拟支付,避免真实扣费。",checked:c,onChange:s}];return p.jsx($e,{title:"自定义调试设置",visible:t,onCancel:h,size:"medium",footer:p.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:p.jsxs(se,{children:[p.jsx(H,{onClick:h,children:"取消"}),p.jsx(H,{theme:"solid",type:"primary",onClick:d,children:"保存"})]})}),children:p.jsx("div",{style:{padding:"0 24px"},children:p.jsx(se,{vertical:!0,align:"start",spacing:"loose",children:g.map((m,y)=>p.jsxs("div",{children:[p.jsx(qt,{checked:m.checked,onChange:C=>m.onChange(C.target.checked),children:m.label}),p.jsx(Ae.Text,{type:"tertiary",style:{display:"block",marginTop:4},children:m.description})]},y))})})})},ft=[{itemKey:"project_info",text:"项目信息",icon:p.jsx(ni,{color:"#000",size:20}),module:si},{itemKey:"launch_mode",text:"启动模式",icon:p.jsx(oi,{color:"#000",size:20}),module:ii},{itemKey:"debug_set",icon:p.jsx(ai,{color:"#000",size:20}),text:"调试设置",module:li},{itemKey:"logs",text:"实时日志",icon:p.jsx(ri,{color:"#000",size:20}),path:"/logs"}],ci=()=>{const[e,t]=f.useState(""),n=a=>{console.log(a),t(a.itemKey)},r=()=>{t("")};return p.jsxs(p.Fragment,{children:[p.jsx(Vt,{bodyStyle:{height:"100vh",paddingLeft:"12px"},items:ft,selectedKeys:[e],onSelect:n}),ft.filter(a=>a.module).map(a=>p.jsx(a.module,{open:a.itemKey===e,onClose:r},a.itemKey))]})};function ui(e){return I({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M10.29 3.86L1.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"},child:[]},{tag:"line",attr:{x1:"12",y1:"9",x2:"12",y2:"13"},child:[]},{tag:"line",attr:{x1:"12",y1:"17",x2:"12.01",y2:"17"},child:[]}]})(e)}function di(e){return I({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"},child:[]},{tag:"polyline",attr:{points:"22 4 12 14.01 9 11.01"},child:[]}]})(e)}function fi(e){return I({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"10"},child:[]},{tag:"line",attr:{x1:"12",y1:"16",x2:"12",y2:"12"},child:[]},{tag:"line",attr:{x1:"12",y1:"8",x2:"12.01",y2:"8"},child:[]}]})(e)}function hi(e){return I({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"10"},child:[]},{tag:"line",attr:{x1:"15",y1:"9",x2:"9",y2:"15"},child:[]},{tag:"line",attr:{x1:"9",y1:"9",x2:"15",y2:"15"},child:[]}]})(e)}const pi={success:{color:"#43a047",icon:di,className:"message-success"},error:{color:"#e53935",icon:hi,className:"message-error"},warning:{color:"#f57c00",icon:ui,className:"message-warning"},info:{color:"#1e88e5",icon:fi,className:"message-info"}},mi=()=>{const{state:e}=K(),t=e.message;if(!t.text)return null;const{text:n,theme:r="info"}=t,a=pi[r];if(!a)return null;const o=pt("message-wrapper",a.className,{hide:!t.text}),l=a.icon;return p.jsxs("div",{className:o,children:[p.jsx(l,{className:"message-icon"}),p.jsx("span",{children:n})]})};function gi(){const e=()=>typeof document<"u"?document.hidden:!1,[t,n]=f.useState(e);return f.useEffect(()=>{const r=()=>{n(document.hidden),je.send({method:"sendPageVisibility",payload:{isHidden:document.hidden}})};return document.addEventListener("visibilitychange",r),()=>{document.removeEventListener("visibilitychange",r)}},[]),t}const vi=()=>{const[e,t]=f.useState("");gi();const[n,r]=f.useState({node:!1,client:!1}),{showMessage:a,hideLoading:o}=K(),l=f.useCallback(({status:i,msg:u,progress:d})=>{switch(i){case"start":a({theme:"info",text:S("uploadStart")});break;case"success":a({theme:"success",text:S("uploadSuccess")});break;case"error":a({theme:"error",text:S("uploadError")});break;case"restart":break;case"process":a({theme:"info",text:`${S("uploadProcess")} ${(d*100).toFixed(0)}%`});break}},[]),c=f.useCallback(({isScriptsReady:i,isResourcesReady:u})=>{i&&u&&(D.info("scripts and resources are ready, send meta"),jo())},[]),s=f.useCallback(()=>{const i=we.warning({position:"top",duration:1e4,title:S("gameResourceUpdated"),id:e,onClose:()=>{t("")},content:p.jsxs(p.Fragment,{children:[p.jsx("p",{children:S("gameResourceChange")}),p.jsxs("div",{className:"banner-footer",children:[p.jsx(H,{type:"tertiary",onClick:()=>{we.close(i)},children:S("notUpload")}),p.jsx(H,{style:{marginLeft:12},type:"warning",onClick:()=>{D.info("upload"),D.info("upload iframe onload, 开始重新初始化"),dt(),we.close(i)},children:S("uploadToClient")})]})]})});t(i)},[]);return f.useEffect(()=>(E.on("connectionChange",r),()=>{E.off("connectionChange",r)}),[]),f.useEffect(()=>(E.on("resourceChange",s),E.on("uploadGame",l),E.on("setupStatusChange",c),()=>{E.off("resourceChange",s),E.off("setupStatusChange",c),E.off("uploadGame",l)}),[c,l]),f.useEffect(()=>{const i=async()=>{o(),a({theme:"success",text:S("setupDevEnv")});try{await dt(),a({theme:"success",text:S("devEnvSetupSuccess")})}catch(u){console.error("Setup failed:",u),a({theme:"error",text:S("devEnvSetupError")})}};n.client&&n.node&&i()},[n,o,a]),null},yi=()=>{const{state:{schema:e,launchOptions:t}}=K(),[n,r]=f.useState(!1),a=o=>{o.status==="success"&&r(!1),o.status==="failed"&&r(!1),o.status==="start"&&r(!0)};return f.useEffect(()=>(E.on("scanQRCode",a),()=>{E.off("scanQRCode",a)}),[]),p.jsxs("div",{className:"qr-code-container",children:[p.jsxs("div",{className:"qr-code-content",onClick:()=>{},children:[p.jsx("div",{className:"qr-code-title",children:S("scanQRCode")}),p.jsxs("div",{className:"qr-code-schema",children:[p.jsx(Gt,{value:e}),n&&p.jsxs("div",{className:"qr-code-spin",children:[p.jsx(mt,{size:"large"}),p.jsx("div",{className:"qr-code-text",children:S("scanning")})]})]})]}),t.length>1&&p.jsx(Jt,{defaultValue:"normal",style:{width:"auto",marginTop:"12px"},optionList:t})]})},Ci=()=>{const{state:{isConnected:e}}=f.useContext(Ie);return p.jsxs("div",{className:"home-container",children:[p.jsx(mi,{}),!e&&p.jsx(yi,{}),p.jsx(vi,{})]})};function wi(){const{state:{feature:e},setSchema:t}=K();return f.useEffect(()=>{he({url:"/game/schema"}).then(n=>{t(n.schema)})},[]),p.jsxs(co,{children:[p.jsx(ti,{}),p.jsxs("div",{className:"main-layout",children:[p.jsx(Ko,{}),p.jsxs("div",{className:"content-wrapper",children:[e.sidebar.enable&&p.jsx(ci,{}),p.jsx("div",{className:"routes-container",children:p.jsx(Fa,{children:p.jsx(Dt,{path:"/",element:p.jsx(Ci,{})})})})]})]})]})}tn.createRoot(document.getElementById("root")).render(p.jsx(Yt,{children:p.jsx(Vr,{children:p.jsx(wi,{})})}));
|