1import{r as i,j as s}from"./index-CJQpyVoF.js";import{d as p}from"./useUrlParam-CZ4aw4md.js";import{b as y,l as j}from"./bot-BWdGI-YI.js";import{g as I}from"./agentSquare-GbXD7O6h.js";import{d as w}from"./chat-BUHNDq8n.js";import{s as C}from"./inviteCode-D9rgtvJs.js";const R="_sharePages_8d5fv_1",S="_share_header_8d5fv_11",U="_botDetail_8d5fv_25",B="_botDetailCard_8d5fv_29",E="_botAvatar_8d5fv_37",k="_botName_8d5fv_43",A="_createName_8d5fv_50",P="_botDesc_8d5fv_57",$="_entryButton_8d5fv_65",t={sharePages:R,share_header:S,botDetail:U,botDetailCard:B,botAvatar:E,botName:k,createName:A,botDesc:P,entryButton:$},Y=()=>{const[o]=p(),_=o.get("botId"),f=o.get("sharekey")||"",[M,v]=i.useState(!0),[m,l]=i.useState(""),[e,x]=i.useState(null);i.useEffect(()=>{N(),h()},[o]);const h=async()=>{var a;try{const r=o.get("sharekey"),n=decodeURIComponent(o.get("botName")||""),c=o.get("botId");if(!r){l("缺å°å¿
è¦åæ°"),v(!1);return}if(b()&&!((a=y)!=null&&a[String(c)])){const d=u(r,n);window.location.href=d}else{const d=`${window.location.origin}/chat?sharekey=${r}&botId=${c}`;window.location.href=d}}catch(r){console.error("éå®å失败:",r),l((r==null?void 0:r.msg)||"æå¡å¨å¼å°å·®äº~请ç¨ååè¯")}},N=async()=>{try{const a=await w({shareAgentKey:f}),r=await I(a==null?void 0:a.botId),n=await _;x(r)}catch(a){C.error((a==null?void 0:a.msg)||"ç½ç»åºå°å·®å¦ï¼è¯·å·æ°éè¯~")}},b=()=>navigator.userAgent.toUpperCase().indexOf("MICROMESSENGER")>-1,u=(a,r)=>{const n={type:"bot",shareKey:a,title:r},c=Object.keys(n).map(g=>`${encodeURIComponent(g)}=${encodeURIComponent(n[g])}`).join("&");return`weixin://dl/business/?username=gh_f04ca92ae774&appid=wx16326d914fde65b8&path=pages/homepage/index&query=${encodeURIComponent(c)}`};return m?s.jsx("div",{className:t.container,children:s.jsxs("div",{className:t.error,children:[s.jsx("div",{className:t.errorIcon,children:"â ï¸"}),s.jsx("div",{className:t.errorText,children:m}),s.jsx("button",{className:t.retryBtn,onClick:()=>window.location.reload(),children:"éè¯"})]})}):s.jsxs("div",{className:t.sharePages,children:[s.jsx("div",{className:t.share_header,children:s.jsx("img",{src:j,alt:""})}),s.jsxs("div",{className:t.botDetail,children:[s.jsxs("div",{className:t.botDetailCard,children:[s.jsx("img",{src:(e==null?void 0:e.agentAvatar)??(e==null?void 0:e.avatar),alt:"",className:t.botAvatar}),s.jsx("div",{className:t.botName,children:(e==null?void 0:e.agentName)??(e==null?void 0:e.bot_name)}),s.jsxs("div",{className:t.createName,children:["@",(e==null?void 0:e.creatorName)??(e==null?void 0:e.creator_nickname)]}),s.jsx("div",{className:t.botDesc,children:(e==null?void 0:e.agentDesc)??(e==null?void 0:e.bot_desc)})]}),e!=null&&e.isDelete!==1&&s.jsx("div",{className:t.entryButton,onClick:()=>{h()},children:s.jsx("span",{children:"å¼å§è天"})})]})]})};export{Y as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.