const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/cloudWorkspaceShares-Dkgf6OcS.js","assets/chunk-B3pr0VN8.js","assets/norm-CeclA1Tu.js","assets/appConfig-CuVl6yRs.js","assets/cloudWorkspaceClient-CMlIQBWi.js","assets/preload-helper-Dd-HcVz_.js","assets/authSession-CrP9lMPq.js"])))=>i.map(i=>d[i]);
import{i as e}from"./chunk-B3pr0VN8.js";import{n as t,t as n}from"./jsx-runtime-wTfS3W87.js";import{t as r}from"./preload-helper-Dd-HcVz_.js";import{p as i,r as a}from"./chunk-6CSD65Y2-Dj7xjS5D.js";import{r as o}from"./norm-CeclA1Tu.js";var s=e(t(),1),c=()=>r(()=>import(`./cloudWorkspaceShares-Dkgf6OcS.js`).then(e=>e.o),__vite__mapDeps([0,1,2,3,4,5,6])),l=`offer_lens_web_share_snapshots_v1`,u=async e=>new Promise(t=>{try{let n=globalThis?.chrome?.storage?.local;if(n?.get){n.get(e,n=>t({...e,...n}));return}}catch{}try{let n={...e};for(let e of Object.keys(n)){let t=localStorage.getItem(e);if(t!=null)try{n[e]=JSON.parse(t)}catch{}}t(n)}catch{t(e)}}),d=async()=>{let e=await u({[l]:[]});return(Array.isArray(e?.[l])?e[l]:[]).filter(e=>e&&typeof e==`object`&&o(e.id)).sort((e,t)=>Number(t.createdAt||0)-Number(e.createdAt||0))},f=async e=>{let t=o(e);if(!t)return null;try{let{cloudWorkspaceGetSharePublic:e}=await c(),n=await e(t);if(n.ok&&n.share){let e=n.share?.payload||{},r=o(e?.title)||`工作台摘要`,i=o(e?.summary),a=Number(e?.createdAt||0)||Date.parse(String(n.share?.created_at||``))||0,s=o(e?.createdBy)||o(n.share?.owner_id)||``,c=e?.kpi&&typeof e.kpi==`object`?e.kpi:{};return{id:o(n.share?.id)||t,title:r,summary:i,kpi:c,createdAt:a,createdBy:s,cloud:!0}}}catch{}return(await d()).find(e=>e.id===t)||null},p=n();function m(){let e=i(),[t,n]=(0,s.useState)(!0),[r,o]=(0,s.useState)(null);return(0,s.useEffect)(()=>{let t=!0;return(async()=>{let r=await f(String(e.id||``).trim());t&&(o(r),n(!1))})(),()=>{t=!1}},[e.id]),(0,p.jsx)(`div`,{className:`ui-page`,children:(0,p.jsx)(`div`,{className:`ui-container py-8`,children:(0,p.jsxs)(`div`,{className:`ui-card ui-card-md max-w-3xl mx-auto`,children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,p.jsx)(`div`,{className:`text-lg font-bold text-gray-900`,children:`工作台分享摘要`}),(0,p.jsx)(a,{to:`/web/workspace`,className:`ui-btn-outline`,children:`返回工作台`})]}),t?(0,p.jsx)(`div`,{className:`mt-3 text-sm text-gray-500`,children:`加载中...`}):null,!t&&!r?(0,p.jsx)(`div`,{className:`mt-3 text-sm text-gray-500`,children:`分享不存在或已失效。`}):null,!t&&r?(0,p.jsxs)(`div`,{className:`mt-4`,children:[(0,p.jsx)(`div`,{className:`text-sm font-semibold text-gray-900`,children:r.title||`-`}),(0,p.jsx)(`div`,{className:`mt-2 text-sm text-gray-700 whitespace-pre-wrap`,children:r.summary||`-`}),(0,p.jsx)(`div`,{className:`mt-3 text-xs text-gray-500`,children:`创建时间：${(()=>{let e=Number(r.createdAt||0)||0;if(!Number.isFinite(e)||e<=0)return`-`;try{return new Date(e).toLocaleString()}catch{return`-`}})()}`}),(0,p.jsx)(`div`,{className:`mt-1 text-xs text-gray-500`,children:`已脱敏，仅展示摘要与指标。`}),(0,p.jsx)(`div`,{className:`mt-4 grid grid-cols-3 gap-2`,children:Object.keys(r.kpi||{}).map(e=>(0,p.jsxs)(`div`,{className:`p-2 rounded-lg border border-gray-200`,children:[(0,p.jsx)(`div`,{className:`text-[11px] text-gray-500`,children:e}),(0,p.jsx)(`div`,{className:`text-sm font-bold text-gray-900 mt-1`,children:Number((r.kpi||{})[e]||0)})]},e))})]}):null]})})})}export{m as default};