@eternalheart/react-file-preview 1.0.2 → 1.0.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"FilePreviewModal.d.ts","sourceRoot":"","sources":["../src/FilePreviewModal.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAe,gBAAgB,EAAY,cAAc,EAAE,MAAM,SAAS,CAAC;AAalF,UAAU,qBAAqB;IAC7B,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;CACpC;AA6CD,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA6T5D,CAAC"}
1
+ {"version":3,"file":"FilePreviewModal.d.ts","sourceRoot":"","sources":["../src/FilePreviewModal.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAe,gBAAgB,EAAY,cAAc,EAAE,MAAM,SAAS,CAAC;AAalF,UAAU,qBAAqB;IAC7B,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;CACpC;AA6CD,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA2W5D,CAAC"}
package/lib/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),_=require("react-dom"),D=require("framer-motion"),y=require("lucide-react"),T=require("react-pdf"),Z=require("mammoth"),I=require("xlsx"),W=require("pptx-preview"),G=require("video.js"),Y=require("react-markdown"),J=require("remark-gfm"),H=require("react-syntax-highlighter");function K(s){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const n in s)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(s,n);Object.defineProperty(r,n,a.get?a:{enumerable:!0,get:()=>s[n]})}}return r.default=s,Object.freeze(r)}const O=K(I),Q="1.0.2",ee={version:Q};function te(s){try{const a=new URL(s).pathname.split("/").pop()||"file";return decodeURIComponent(a)}catch{const r=s.split("/").pop()||"file";return decodeURIComponent(r)}}function $(s){var a;const r=((a=s.split(".").pop())==null?void 0:a.toLowerCase())||"";return{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",bmp:"image/bmp",ico:"image/x-icon",mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",ogv:"video/ogg",mov:"video/quicktime",avi:"video/x-msvideo",mkv:"video/x-matroska",m4v:"video/x-m4v","3gp":"video/3gpp",flv:"video/x-flv",mp3:"audio/mpeg",wav:"audio/wav",m4a:"audio/mp4",aac:"audio/aac",flac:"audio/flac",pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",ppt:"application/vnd.ms-powerpoint",txt:"text/plain",md:"text/markdown",markdown:"text/markdown",json:"application/json",xml:"application/xml",html:"text/html",css:"text/css",js:"text/javascript",ts:"text/typescript",jsx:"text/javascript",tsx:"text/typescript",py:"text/x-python",java:"text/x-java",cpp:"text/x-c++src",c:"text/x-csrc",cs:"text/x-csharp",php:"text/x-php",rb:"text/x-ruby",go:"text/x-go",rs:"text/x-rust",yaml:"text/yaml",yml:"text/yaml"}[r]||"application/octet-stream"}function B(s,r=0){if(s instanceof File)return{id:`file-${Date.now()}-${r}`,name:s.name,url:URL.createObjectURL(s),type:s.type||$(s.name),size:s.size};if(typeof s=="string"){const n=te(s);return{id:`url-${Date.now()}-${r}`,name:n,url:s,type:$(n)}}return{id:s.id||`link-${Date.now()}-${r}`,name:s.name,url:s.url,type:s.type||$(s.name),size:s.size}}function A(s){return s.map((r,n)=>B(r,n))}const se=({url:s,zoom:r,rotation:n,onZoomChange:a})=>{const[d,u]=t.useState(!1),[i,o]=t.useState(null),[c,w]=t.useState({x:0,y:0}),[f,x]=t.useState(!1),[b,h]=t.useState({x:0,y:0}),[l,p]=t.useState(1),m=t.useRef(null);t.useEffect(()=>{u(!1),o(null),w({x:0,y:0}),p(1)},[s]),t.useEffect(()=>{p(r)},[r]),t.useEffect(()=>{w({x:0,y:0})},[r,n]);const N=()=>{u(!0)},S=()=>{o("图片加载失败"),u(!0)},C=()=>{w({x:0,y:0})},M=t.useCallback(v=>{v.preventDefault(),v.stopPropagation();const E=v.deltaY>0?-.1:.1;p(R=>{const z=Math.max(.5,Math.min(5,R+E));return a&&a(z),z})},[a]),L=t.useCallback(v=>{v.button===0&&(x(!0),h({x:v.clientX-c.x,y:v.clientY-c.y}))},[c]),g=t.useCallback(v=>{f&&w({x:v.clientX-b.x,y:v.clientY-b.y})},[f,b]),k=t.useCallback(()=>{x(!1)},[]);return e.jsxs("div",{ref:m,className:"flex items-center justify-center w-full h-full overflow-hidden",onWheel:M,onMouseDown:L,onMouseMove:g,onMouseUp:k,onMouseLeave:k,style:{cursor:f?"grabbing":"grab"},children:[!d&&!i&&e.jsx("div",{className:"flex items-center justify-center",children:e.jsx("div",{className:"w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin"})}),i&&e.jsx("div",{className:"text-white/70 text-center",children:e.jsx("p",{className:"text-lg",children:i})}),e.jsx(D.motion.img,{src:s,alt:"Preview",className:`max-w-none select-none ${d?"":"hidden"}`,style:{transform:`translate(${c.x}px, ${c.y}px) scale(${l}) rotate(${n}deg)`,transformOrigin:"center",transition:f?"none":"transform 0.3s ease-out"},onLoad:N,onError:S,onDoubleClick:C,initial:{opacity:0},animate:{opacity:d?1:0},transition:{duration:.3},draggable:!1})]})};function U(s){if(typeof window>"u")return;const{workerSrc:r=`https://unpkg.com/pdfjs-dist@${T.pdfjs.version}/build/pdf.worker.min.mjs`,cMapUrl:n=`https://unpkg.com/pdfjs-dist@${T.pdfjs.version}/cmaps/`,cMapPacked:a=!0}=s||{};T.pdfjs.GlobalWorkerOptions.workerSrc=r,T.pdfjs.GlobalWorkerOptions.cMapUrl=n,T.pdfjs.GlobalWorkerOptions.cMapPacked=a}U();const re=({url:s,zoom:r,currentPage:n,onPageChange:a,onTotalPagesChange:d})=>{const[u,i]=t.useState(0),[o,c]=t.useState(null),w=t.useRef(null),f=t.useRef(new Map);t.useEffect(()=>{c(null)},[s]);const x=({numPages:p})=>{i(p),d(p),a(1)},b=p=>{console.error("PDF 加载错误:",p),c("PDF 文件加载失败")},h=t.useCallback(()=>{if(!w.current)return;const p=w.current,m=p.scrollTop,N=p.clientHeight,S=m+N/2;let C=1,M=1/0;f.current.forEach((L,g)=>{const k=L.getBoundingClientRect(),v=p.getBoundingClientRect(),E=k.top-v.top+k.height/2+m,R=Math.abs(E-S);R<M&&(M=R,C=g)}),C!==n&&a(C)},[n,a]);t.useEffect(()=>{const p=w.current;if(p)return p.addEventListener("scroll",h),()=>p.removeEventListener("scroll",h)},[h]);const l=t.useCallback((p,m)=>{m?f.current.set(p,m):f.current.delete(p)},[]);return e.jsxs("div",{ref:w,className:"flex flex-col items-center w-full h-full overflow-auto py-8 px-4",children:[o&&e.jsx("div",{className:"text-white/70 text-center",children:e.jsx("p",{className:"text-lg",children:o})}),!o&&e.jsx(T.Document,{file:s,onLoadSuccess:x,onLoadError:b,loading:e.jsx("div",{className:"flex items-center justify-center min-h-screen",children:e.jsx("div",{className:"w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin"})}),children:e.jsx("div",{className:"flex flex-col gap-4",children:Array.from(new Array(u),(p,m)=>{const N=m+1;return e.jsxs("div",{ref:S=>l(N,S),className:"relative",children:[e.jsx(T.Page,{pageNumber:N,scale:r,loading:e.jsx("div",{className:"flex items-center justify-center p-8 bg-white/5 rounded-lg min-h-[600px]",children:e.jsx("div",{className:"w-8 h-8 border-4 border-white/20 border-t-white rounded-full animate-spin"})}),renderTextLayer:!0,renderAnnotationLayer:!0,className:"shadow-2xl"}),e.jsx("div",{className:"absolute top-2 right-2 bg-black/60 backdrop-blur-sm text-white text-xs px-3 py-1 rounded-full",children:N})]},`page_${N}`)})})}),u>0&&e.jsxs("div",{className:"sticky bottom-4 mt-8 bg-black/60 backdrop-blur-xl text-white px-6 py-3 rounded-full text-sm font-medium shadow-2xl border border-white/10",children:["第 ",n," 页 / 共 ",u," 页"]})]})},oe=({url:s})=>{const[r,n]=t.useState(""),[a,d]=t.useState(!0),[u,i]=t.useState(null);return t.useEffect(()=>{(async()=>{d(!0),i(null),n("");try{const c=await fetch(s);if(!c.ok)throw new Error("文件加载失败");const w=await c.arrayBuffer(),f=await Z.convertToHtml({arrayBuffer:w});n(f.value)}catch(c){console.error("Docx 解析错误:",c),i("Word 文档解析失败")}finally{d(!1)}})()},[s]),a?e.jsx("div",{className:"flex items-center justify-center w-full h-full",children:e.jsx("div",{className:"w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin"})}):u?e.jsx("div",{className:"flex items-center justify-center w-full h-full",children:e.jsx("div",{className:"text-white/70 text-center",children:e.jsx("p",{className:"text-lg",children:u})})}):e.jsx("div",{className:"w-full h-full overflow-auto p-8",children:e.jsx("div",{className:"max-w-4xl mx-auto bg-white rounded-lg shadow-2xl p-12",dangerouslySetInnerHTML:{__html:r},style:{fontFamily:"system-ui, -apple-system, sans-serif",lineHeight:"1.6",color:"#333"}})})},ne=({url:s})=>{const[r,n]=t.useState([]),[a,d]=t.useState(0),[u,i]=t.useState(!0),[o,c]=t.useState(null);if(t.useEffect(()=>{(async()=>{i(!0),c(null),n([]);try{const x=await fetch(s);if(!x.ok)throw new Error("文件加载失败");const b=await x.arrayBuffer(),h=O.read(b,{type:"array"}),l=h.SheetNames.map(p=>{const m=h.Sheets[p],N=O.utils.sheet_to_json(m,{header:1});return{name:p,data:N}});n(l),d(0)}catch(x){console.error("Excel 解析错误:",x),c("Excel 文件解析失败")}finally{i(!1)}})()},[s]),u)return e.jsx("div",{className:"flex items-center justify-center w-full h-full",children:e.jsx("div",{className:"w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin"})});if(o)return e.jsx("div",{className:"flex items-center justify-center w-full h-full",children:e.jsx("div",{className:"text-white/70 text-center",children:e.jsx("p",{className:"text-lg",children:o})})});const w=r[a];return e.jsxs("div",{className:"w-full h-full flex flex-col overflow-hidden",children:[r.length>1&&e.jsx("div",{className:"flex gap-2 p-4 bg-black/20 backdrop-blur-sm overflow-x-auto border-b border-white/10",children:r.map((f,x)=>e.jsx("button",{onClick:()=>d(x),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${a===x?"bg-gradient-to-r from-purple-500 to-pink-500 text-white shadow-lg":"bg-white/10 text-white hover:bg-white/20"}`,children:f.name},x))}),e.jsx("div",{className:"flex-1 overflow-auto p-8",children:e.jsx("div",{className:"inline-block min-w-full bg-gradient-to-br from-gray-800/90 to-gray-900/90 backdrop-blur-xl rounded-2xl shadow-2xl overflow-hidden border border-white/10",children:e.jsx("table",{className:"min-w-full divide-y divide-white/10",children:e.jsx("tbody",{className:"divide-y divide-white/10",children:w==null?void 0:w.data.map((f,x)=>e.jsx("tr",{className:`transition-colors ${x===0?"bg-gradient-to-r from-purple-500/20 to-pink-500/20 font-semibold":"hover:bg-white/5"}`,children:f.map((b,h)=>e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-200 border-r border-white/10",children:String(b??"")},h))},x))})})})})]})},le=({url:s})=>{const[r,n]=t.useState(!0),[a,d]=t.useState(null),u=t.useRef(null),i=t.useRef(null),o=t.useRef(null),c=t.useRef(null),w=t.useRef(null),f=t.useRef({width:0,height:0}),x=t.useCallback(()=>{if(!u.current)return{width:960,height:540};const h=u.current.clientWidth,l=Math.floor(h*9/16);return console.log("计算尺寸:",{width:h,height:l}),{width:h,height:l}},[]),b=t.useCallback(async()=>{if(!(!u.current||!c.current)){console.log("重新初始化预览器...");try{if(i.current)try{i.current.destroy()}catch(p){console.error("销毁预览器失败:",p)}u.current.innerHTML="";const h=x();console.log("重新初始化使用尺寸:",h);const l=W.init(u.current,{width:h.width,height:h.height});i.current=l,await l.preview(c.current),console.log("重新初始化成功")}catch(h){console.error("重新初始化失败:",h)}}},[x]);return t.useEffect(()=>{if(!u.current)return;let h=!0;const l=()=>{if(h){h=!1;const C=x();f.current=C;return}const p=x(),m=f.current,N=Math.abs(m.width-p.width),S=Math.abs(m.height-p.height);if(N<10&&S<10){console.log("尺寸变化太小,忽略");return}console.log("检测到尺寸变化:",{old:m,new:p,diff:{width:N,height:S}}),f.current=p,w.current&&clearTimeout(w.current),w.current=window.setTimeout(()=>{i.current&&c.current&&(console.log("尺寸变化,准备重新初始化"),b())},800)};return o.current=new ResizeObserver(()=>{l()}),o.current.observe(u.current),()=>{o.current&&o.current.disconnect(),w.current&&clearTimeout(w.current)}},[x,b]),t.useEffect(()=>{let h=!0;const l=async()=>{if(!u.current){console.log("Container ref not ready");return}n(!0),d(null);try{console.log("开始加载 PPTX:",s);const m=await fetch(s);if(!m.ok)throw new Error("文件加载失败");const N=await m.arrayBuffer();if(c.current=N,console.log("文件加载成功,大小:",N.byteLength),!h)return;u.current&&(u.current.innerHTML="");const S=x();console.log("使用尺寸:",S),console.log("初始化预览器...");const C=W.init(u.current,{width:S.width,height:S.height});i.current=C,console.log("开始预览..."),C.preview(N).then(()=>{console.log("预览成功"),h&&n(!1)}).catch(M=>{console.error("预览失败:",M),h&&(d("PPT 文件预览失败"),n(!1))})}catch(m){console.error("PPTX 解析错误:",m),h&&(d(m instanceof Error?m.message:"PPT 文件解析失败"),n(!1))}},p=setTimeout(()=>{l()},100);return()=>{if(h=!1,clearTimeout(p),c.current=null,i.current)try{i.current.destroy()}catch(m){console.error("销毁预览器失败:",m)}i.current=null}},[s,x]),e.jsxs("div",{className:"relative flex flex-col items-center w-full h-full pt-[8px]",children:[r&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 backdrop-blur-sm z-10 rounded-2xl",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-12 h-12 mx-auto mb-3 border-4 border-white/20 border-t-white rounded-full animate-spin"}),e.jsx("p",{className:"text-sm text-white/70 font-medium",children:"加载 PPT 中..."})]})}),a&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 backdrop-blur-sm z-10 rounded-2xl",children:e.jsxs("div",{className:"text-center max-w-md",children:[e.jsx("div",{className:"w-32 h-32 mx-auto mb-6 rounded-3xl bg-gradient-to-br from-orange-500 via-red-500 to-pink-500 flex items-center justify-center shadow-2xl",children:e.jsx(y.Presentation,{className:"w-16 h-16 text-white"})}),e.jsx("p",{className:"text-xl text-white/90 mb-3 font-medium",children:"PPT 预览"}),e.jsx("p",{className:"text-sm text-white/60 mb-6",children:a||"浏览器暂不支持直接预览 PPT 文件"}),e.jsxs("a",{href:s,download:!0,className:"inline-flex items-center gap-2 px-6 py-3 bg-gradient-to-r from-purple-500 to-pink-500 text-white rounded-xl hover:scale-105 transition-all shadow-lg",children:[e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"下载文件"]}),e.jsx("p",{className:"text-xs text-white/40 mt-4",children:"提示:可以使用 Microsoft PowerPoint 或 WPS 打开"})]})}),e.jsx("div",{ref:u,className:"pptx-wrapper w-full max-w-6xl"})]})},ae=s=>{var a;const r=((a=s.split(".").pop())==null?void 0:a.toLowerCase().split("?")[0])||"";return{mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",ogv:"video/ogg",mov:"video/quicktime",avi:"video/x-msvideo",mkv:"video/x-matroska",m4v:"video/mp4","3gp":"video/3gpp",flv:"video/x-flv"}[r]||"video/mp4"},ce=({url:s})=>{const[r,n]=t.useState(null),[a,d]=t.useState(!0),u=t.useRef(null),i=t.useRef(null);return t.useEffect(()=>{if(!i.current&&u.current){const o=document.createElement("video-js");o.classList.add("vjs-big-play-centered","vjs-theme-apple"),u.current.appendChild(o);const c=ae(s),f=G(o,{controls:!0,responsive:!0,fluid:!0,preload:"auto",controlBar:{children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","remainingTimeDisplay","fullscreenToggle"],volumePanel:{inline:!1}},html5:{vhs:{overrideNative:!0},nativeVideoTracks:!1,nativeAudioTracks:!1,nativeTextTracks:!1},sources:c==="video/quicktime"?[{src:s,type:"video/quicktime"},{src:s,type:"video/mp4"}]:[{src:s,type:c}]});f.on("loadeddata",()=>{d(!1)}),f.on("error",()=>{const x=f.error();console.error("Video.js error:",x),n(`视频加载失败: ${(x==null?void 0:x.message)||"未知错误"}`),d(!1)}),i.current=f}},[s]),t.useEffect(()=>{const o=i.current;return()=>{o&&!o.isDisposed()&&(o.dispose(),i.current=null)}},[]),r?e.jsx("div",{className:"flex items-center justify-center w-full h-full",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-red-500/10 flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("p",{className:"text-lg font-medium text-white/90 mb-2",children:"视频加载失败"}),e.jsx("p",{className:"text-sm text-white/60",children:r})]})}):e.jsx("div",{className:"flex items-center justify-center w-full h-full p-8",children:e.jsxs("div",{className:"w-full max-w-5xl relative",children:[a&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/20 backdrop-blur-sm rounded-2xl z-10",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-12 h-12 mx-auto mb-3 border-3 border-white/20 border-t-white rounded-full animate-spin"}),e.jsx("p",{className:"text-sm text-white/70 font-medium",children:"加载视频中..."})]})}),e.jsx("div",{ref:u,className:"overflow-hidden",style:{boxShadow:"0 20px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05)"}})]})})},ie=({url:s,fileName:r})=>{const[n,a]=t.useState(null),[d,u]=t.useState(!1),[i,o]=t.useState(0),[c,w]=t.useState(0),[f,x]=t.useState(1),[b,h]=t.useState(!1),l=t.useRef(null);t.useEffect(()=>{const g=l.current;if(!g)return;const k=()=>{isNaN(g.currentTime)||o(g.currentTime)},v=()=>{!isNaN(g.duration)&&isFinite(g.duration)&&w(g.duration)},E=()=>u(!1),R=()=>v();return g.addEventListener("timeupdate",k),g.addEventListener("loadedmetadata",v),g.addEventListener("durationchange",v),g.addEventListener("canplay",R),g.addEventListener("ended",E),g.readyState>=1&&v(),()=>{g.removeEventListener("timeupdate",k),g.removeEventListener("loadedmetadata",v),g.removeEventListener("durationchange",v),g.removeEventListener("canplay",R),g.removeEventListener("ended",E)}},[]);const p=()=>{l.current&&(d?l.current.pause():l.current.play(),u(!d))},m=g=>{const k=parseFloat(g.target.value);o(k),l.current&&(l.current.currentTime=k)},N=g=>{const k=parseFloat(g.target.value);x(k),l.current&&(l.current.volume=k),k>0&&h(!1)},S=()=>{l.current&&(l.current.muted=!b,h(!b))},C=g=>{l.current&&(l.current.currentTime+=g)},M=g=>{if(!isFinite(g)||isNaN(g)||g<0)return"0:00";const k=Math.floor(g/60),v=Math.floor(g%60);return`${k}:${v.toString().padStart(2,"0")}`},L=()=>{a("音频加载失败")};return n?e.jsx("div",{className:"flex items-center justify-center w-full h-full",children:e.jsx("div",{className:"text-white/70 text-center",children:e.jsx("p",{className:"text-lg",children:n})})}):e.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full p-8 gap-8",children:[e.jsx("div",{className:"w-64 h-64 rounded-3xl bg-gradient-to-br from-purple-500 via-pink-500 to-rose-500 flex items-center justify-center shadow-2xl backdrop-blur-xl",children:e.jsx(y.Music,{className:"w-32 h-32 text-white"})}),e.jsxs("div",{className:"text-white text-center max-w-md",children:[e.jsx("p",{className:"text-2xl font-medium mb-1",children:r}),e.jsx("p",{className:"text-sm text-white/60",children:"音频文件"})]}),e.jsxs("div",{className:"w-full max-w-md bg-white/10 backdrop-blur-xl rounded-2xl p-6 border border-white/20",children:[e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"relative h-4 flex items-center",children:[e.jsx("div",{className:"absolute w-full h-[6px] bg-white/20 rounded-full"}),e.jsx("div",{className:"absolute h-[6px] bg-gradient-to-r from-purple-500 to-pink-500 rounded-full transition-all duration-100 ease-linear pointer-events-none",style:{width:`${c>0?i/c*100:i>100?100:i}%`}}),e.jsx("input",{type:"range",min:"0",max:c>0?c:100+(i>100?i%100:0),value:i,onChange:m,className:"audio-slider absolute w-full"})]}),e.jsxs("div",{className:"flex justify-between text-xs text-white/60 mt-3",children:[e.jsx("span",{children:M(i)}),e.jsx("span",{children:M(c)})]})]}),e.jsxs("div",{className:"flex items-center justify-center gap-4 mb-4",children:[e.jsx("button",{onClick:()=>C(-10),className:"w-10 h-10 rounded-full bg-white/10 hover:bg-white/20 flex items-center justify-center text-white transition-all",children:e.jsx(y.SkipBack,{className:"w-5 h-5"})}),e.jsx("button",{onClick:p,className:"w-14 h-14 rounded-full bg-gradient-to-br from-purple-500 to-pink-500 hover:scale-105 flex items-center justify-center text-white transition-all shadow-lg",children:d?e.jsx(y.Pause,{className:"w-6 h-6"}):e.jsx(y.Play,{className:"w-6 h-6 ml-1"})}),e.jsx("button",{onClick:()=>C(10),className:"w-10 h-10 rounded-full bg-white/10 hover:bg-white/20 flex items-center justify-center text-white transition-all",children:e.jsx(y.SkipForward,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:S,className:"text-white/80 hover:text-white transition-colors",children:b||f===0?e.jsx(y.VolumeX,{className:"w-5 h-5"}):e.jsx(y.Volume2,{className:"w-5 h-5"})}),e.jsxs("div",{className:"flex-1 relative h-3 flex items-center",children:[e.jsx("div",{className:"absolute w-full h-[4px] bg-white/20 rounded-full"}),e.jsx("div",{className:"absolute h-[4px] bg-purple-500 rounded-full transition-all duration-100 pointer-events-none",style:{width:`${(b?0:f)*100}%`}}),e.jsx("input",{type:"range",min:"0",max:"1",step:"0.01",value:b?0:f,onChange:N,className:"volume-slider absolute w-full"})]})]})]}),e.jsx("audio",{ref:l,src:s,onError:L,className:"hidden"})]})},X={'pre[class*="language-"]':{color:"#d4d4d4",fontSize:"13px",textShadow:"none",fontFamily:'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:".5em 0",overflow:"auto",background:"#1e1e1e"},'code[class*="language-"]':{color:"#d4d4d4",fontSize:"13px",textShadow:"none",fontFamily:'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]::selection':{textShadow:"none",background:"#264F78"},'code[class*="language-"]::selection':{textShadow:"none",background:"#264F78"},'pre[class*="language-"] *::selection':{textShadow:"none",background:"#264F78"},'code[class*="language-"] *::selection':{textShadow:"none",background:"#264F78"},':not(pre) > code[class*="language-"]':{padding:".1em .3em",borderRadius:".3em",color:"#db4c69",background:"#1e1e1e"},".namespace":{Opacity:".7"},"doctype.doctype-tag":{color:"#569CD6"},"doctype.name":{color:"#9cdcfe"},comment:{color:"#6a9955"},prolog:{color:"#6a9955"},punctuation:{color:"#d4d4d4"},".language-html .language-css .token.punctuation":{color:"#d4d4d4"},".language-html .language-javascript .token.punctuation":{color:"#d4d4d4"},property:{color:"#9cdcfe"},tag:{color:"#569cd6"},boolean:{color:"#569cd6"},number:{color:"#b5cea8"},constant:{color:"#9cdcfe"},symbol:{color:"#b5cea8"},inserted:{color:"#b5cea8"},unit:{color:"#b5cea8"},selector:{color:"#d7ba7d"},"attr-name":{color:"#9cdcfe"},string:{color:"#ce9178"},char:{color:"#ce9178"},builtin:{color:"#ce9178"},deleted:{color:"#ce9178"},".language-css .token.string.url":{textDecoration:"underline"},operator:{color:"#d4d4d4"},entity:{color:"#569cd6"},"operator.arrow":{color:"#569CD6"},atrule:{color:"#ce9178"},"atrule.rule":{color:"#c586c0"},"atrule.url":{color:"#9cdcfe"},"atrule.url.function":{color:"#dcdcaa"},"atrule.url.punctuation":{color:"#d4d4d4"},keyword:{color:"#569CD6"},"keyword.module":{color:"#c586c0"},"keyword.control-flow":{color:"#c586c0"},function:{color:"#dcdcaa"},"function.maybe-class-name":{color:"#dcdcaa"},regex:{color:"#d16969"},important:{color:"#569cd6"},italic:{fontStyle:"italic"},"class-name":{color:"#4ec9b0"},"maybe-class-name":{color:"#4ec9b0"},console:{color:"#9cdcfe"},parameter:{color:"#9cdcfe"},interpolation:{color:"#9cdcfe"},"punctuation.interpolation-punctuation":{color:"#569cd6"},variable:{color:"#9cdcfe"},"imports.maybe-class-name":{color:"#9cdcfe"},"exports.maybe-class-name":{color:"#9cdcfe"},escape:{color:"#d7ba7d"},"tag.punctuation":{color:"#808080"},cdata:{color:"#808080"},"attr-value":{color:"#ce9178"},"attr-value.punctuation":{color:"#ce9178"},"attr-value.punctuation.attr-equals":{color:"#d4d4d4"},namespace:{color:"#4ec9b0"},'pre[class*="language-javascript"]':{color:"#9cdcfe"},'code[class*="language-javascript"]':{color:"#9cdcfe"},'pre[class*="language-jsx"]':{color:"#9cdcfe"},'code[class*="language-jsx"]':{color:"#9cdcfe"},'pre[class*="language-typescript"]':{color:"#9cdcfe"},'code[class*="language-typescript"]':{color:"#9cdcfe"},'pre[class*="language-tsx"]':{color:"#9cdcfe"},'code[class*="language-tsx"]':{color:"#9cdcfe"},'pre[class*="language-css"]':{color:"#ce9178"},'code[class*="language-css"]':{color:"#ce9178"},'pre[class*="language-html"]':{color:"#d4d4d4"},'code[class*="language-html"]':{color:"#d4d4d4"},".language-regex .token.anchor":{color:"#dcdcaa"},".language-html .token.punctuation":{color:"#808080"},'pre[class*="language-"] > code[class*="language-"]':{position:"relative",zIndex:"1"},".line-highlight.line-highlight":{background:"#f7ebc6",boxShadow:"inset 5px 0 0 #f7d87c",zIndex:"0"}},de=({url:s})=>{const[r,n]=t.useState(""),[a,d]=t.useState(!0),[u,i]=t.useState(null);return t.useEffect(()=>{(async()=>{try{d(!0),i(null);const c=await fetch(s);if(!c.ok)throw new Error("加载失败");const w=await c.text();n(w)}catch(c){i("Markdown 文件加载失败"),console.error(c)}finally{d(!1)}})()},[s]),a?e.jsx("div",{className:"flex items-center justify-center w-full h-full",children:e.jsx("div",{className:"w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin"})}):u?e.jsx("div",{className:"flex items-center justify-center w-full h-full",children:e.jsx("div",{className:"text-white/70 text-center",children:e.jsx("p",{className:"text-lg",children:u})})}):e.jsx("div",{className:"w-full h-full overflow-auto p-8",children:e.jsx("div",{className:"max-w-4xl mx-auto bg-white/5 backdrop-blur-sm rounded-2xl p-8 border border-white/10",children:e.jsx("div",{className:"prose prose-invert prose-lg max-w-none",children:e.jsx(Y,{remarkPlugins:[J],components:{code({node:o,inline:c,className:w,children:f,...x}){const b=/language-(\w+)/.exec(w||"");return!c&&b?e.jsx(H.Prism,{style:X,language:b[1],PreTag:"div",className:"rounded-lg",...x,children:String(f).replace(/\n$/,"")}):e.jsx("code",{className:"bg-white/10 px-1.5 py-0.5 rounded text-sm",...x,children:f})},h1:({children:o})=>e.jsx("h1",{className:"text-4xl font-bold mb-4 text-white border-b border-white/20 pb-2",children:o}),h2:({children:o})=>e.jsx("h2",{className:"text-3xl font-bold mb-3 text-white mt-8",children:o}),h3:({children:o})=>e.jsx("h3",{className:"text-2xl font-bold mb-2 text-white mt-6",children:o}),p:({children:o})=>e.jsx("p",{className:"text-white/90 mb-4 leading-relaxed",children:o}),a:({href:o,children:c})=>e.jsx("a",{href:o,className:"text-blue-400 hover:text-blue-300 underline",target:"_blank",rel:"noopener noreferrer",children:c}),ul:({children:o})=>e.jsx("ul",{className:"list-disc list-inside mb-4 text-white/90",children:o}),ol:({children:o})=>e.jsx("ol",{className:"list-decimal list-inside mb-4 text-white/90",children:o}),li:({children:o})=>e.jsx("li",{className:"mb-1",children:o}),blockquote:({children:o})=>e.jsx("blockquote",{className:"border-l-4 border-blue-500 pl-4 italic text-white/80 my-4",children:o}),table:({children:o})=>e.jsx("div",{className:"overflow-x-auto my-4",children:e.jsx("table",{className:"min-w-full border border-white/20",children:o})}),th:({children:o})=>e.jsx("th",{className:"border border-white/20 px-4 py-2 bg-white/10 text-white font-semibold",children:o}),td:({children:o})=>e.jsx("td",{className:"border border-white/20 px-4 py-2 text-white/90",children:o}),hr:()=>e.jsx("hr",{className:"border-white/20 my-6"}),img:({src:o,alt:c})=>e.jsx("img",{src:o,alt:c,className:"rounded-lg max-w-full h-auto my-4"})},children:r})})})})},ue=s=>{var a;const r=((a=s.split(".").pop())==null?void 0:a.toLowerCase())||"";return{js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",java:"java",cpp:"cpp",c:"c",cs:"csharp",php:"php",rb:"ruby",go:"go",rs:"rust",swift:"swift",kt:"kotlin",scala:"scala",sh:"bash",bash:"bash",zsh:"bash",json:"json",xml:"xml",html:"html",css:"css",scss:"scss",sass:"sass",less:"less",sql:"sql",yaml:"yaml",yml:"yaml",toml:"toml",ini:"ini",conf:"nginx",md:"markdown",txt:"text"}[r]||"text"},me=({url:s,fileName:r})=>{const[n,a]=t.useState(""),[d,u]=t.useState(!0),[i,o]=t.useState(null),c=ue(r);return t.useEffect(()=>{(async()=>{try{u(!0),o(null);const f=await fetch(s);if(!f.ok)throw new Error("加载失败");const x=await f.text();a(x)}catch(f){o("文本文件加载失败"),console.error(f)}finally{u(!1)}})()},[s]),d?e.jsx("div",{className:"flex items-center justify-center w-full h-full",children:e.jsx("div",{className:"w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin"})}):i?e.jsx("div",{className:"flex items-center justify-center w-full h-full",children:e.jsx("div",{className:"text-white/70 text-center",children:e.jsx("p",{className:"text-lg",children:i})})}):e.jsx("div",{className:"w-full h-full overflow-auto p-8",children:e.jsxs("div",{className:"max-w-6xl mx-auto bg-white/5 backdrop-blur-sm rounded-2xl border border-white/10 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-3 px-6 py-4 bg-white/5 border-b border-white/10",children:[e.jsx(y.FileText,{className:"w-5 h-5 text-white/70"}),e.jsx("span",{className:"text-white font-medium",children:r}),e.jsx("span",{className:"ml-auto text-xs text-white/50 uppercase",children:c})]}),e.jsx("div",{className:"text-sm",children:c==="text"?e.jsx("pre",{className:"p-6 text-white/90 font-mono whitespace-pre-wrap break-words",children:n}):e.jsx(H.Prism,{language:c,style:X,showLineNumbers:!0,customStyle:{margin:0,padding:"1.5rem",background:"transparent",fontSize:"0.875rem"},lineNumberStyle:{minWidth:"3em",paddingRight:"1em",color:"rgba(255, 255, 255, 0.3)",userSelect:"none"},children:n})})]})})},xe=({fileName:s,fileType:r,onDownload:n})=>e.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full p-8 gap-6",children:[e.jsx("div",{className:"w-32 h-32 rounded-full bg-white/10 flex items-center justify-center",children:e.jsx(y.FileQuestion,{className:"w-16 h-16 text-white/70"})}),e.jsxs("div",{className:"text-white text-center",children:[e.jsx("p",{className:"text-xl font-medium mb-2",children:s}),e.jsxs("p",{className:"text-white/70",children:["不支持预览此文件类型 (",r,")"]})]}),e.jsxs("button",{onClick:n,className:"flex items-center gap-2 px-6 py-3 bg-white/10 hover:bg-white/20 backdrop-blur-sm rounded-lg text-white font-medium transition-all",children:[e.jsx(y.Download,{className:"w-5 h-5"}),"下载文件查看"]})]}),he=s=>{var d;const r=((d=s.name.split(".").pop())==null?void 0:d.toLowerCase())||"",n=s.type.toLowerCase();if(n.startsWith("image/")||["jpg","jpeg","png","gif","webp","svg"].includes(r))return"image";if(n.includes("pdf")||r==="pdf")return"pdf";if(n.includes("wordprocessingml")||r==="docx")return"docx";if(n.includes("spreadsheetml")||r==="xlsx")return"xlsx";if(n.includes("presentationml")||r==="pptx"||r==="ppt")return"pptx";if(n.startsWith("video/")||["mp4","webm","ogg","ogv","mov","avi","mkv","m4v","3gp","flv"].includes(r))return"video";if(n.startsWith("audio/")||["mp3","wav","ogg","m4a","flac","aac"].includes(r))return"audio";if(r==="md"||r==="markdown")return"markdown";const a=["txt","log","csv","js","jsx","ts","tsx","json","py","java","cpp","c","h","cs","php","rb","go","rs","swift","kt","html","css","scss","sass","less","xml","yaml","yml","toml","ini","conf","sh","bash","zsh","sql"];return n.startsWith("text/")||a.includes(r)?"text":"unsupported"},fe=({files:s,currentIndex:r,isOpen:n,onClose:a,onNavigate:d,customRenderers:u=[]})=>{const[i,o]=t.useState(1),[c,w]=t.useState(0),[f,x]=t.useState(1),[,b]=t.useState(1),h=t.useMemo(()=>A(s),[s]),l=h[r],p=t.useMemo(()=>l?u.find(j=>j.test(l)):null,[l,u]),m=l?he(l):"unsupported";t.useEffect(()=>{o(1),w(0),x(1),b(1)},[r]),t.useEffect(()=>{if(n){const j=document.body.style.overflow,F=document.body.style.paddingRight,q=window.innerWidth-document.documentElement.clientWidth;return document.body.style.overflow="hidden",q>0&&(document.body.style.paddingRight=`${q}px`),()=>{document.body.style.overflow=j,document.body.style.paddingRight=F}}},[n]),t.useEffect(()=>{if(!n)return;const j=F=>{F.key==="Escape"?a():F.key==="ArrowLeft"&&r>0?d==null||d(r-1):F.key==="ArrowRight"&&r<h.length-1&&(d==null||d(r+1))};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[n,r,h.length,a,d]);const N=t.useCallback(()=>{o(j=>Math.min(j+.25,5))},[]),S=t.useCallback(()=>{o(j=>Math.max(j-.25,.5))},[]),C=t.useCallback(()=>{w(j=>j+90)},[]),M=t.useCallback(()=>{w(j=>j-90)},[]),L=t.useCallback(()=>{o(1),w(0)},[]),g=t.useCallback(()=>{o(1)},[]),k=t.useCallback(j=>{o(j)},[]),v=t.useCallback(()=>{o(1),w(0)},[]),E=t.useCallback(()=>{if(!l)return;const j=document.createElement("a");j.href=l.url,j.download=l.name,j.click()},[l]);if(!n||!l)return null;const R=m==="image"||m==="pdf",z=m==="image",V=e.jsx(D.AnimatePresence,{children:n&&e.jsx(D.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/80 backdrop-blur-md overflow-hidden",onClick:a,onWheel:j=>j.stopPropagation(),children:e.jsxs("div",{className:"relative w-full h-full flex flex-col overflow-hidden",onClick:j=>j.stopPropagation(),children:[e.jsx(D.motion.div,{initial:{y:-100},animate:{y:0},exit:{y:-100},className:"absolute top-0 left-0 right-0 z-10 p-4",children:e.jsxs("div",{className:"max-w-7xl mx-auto flex items-center justify-between bg-black/40 backdrop-blur-xl rounded-2xl px-6 py-4 shadow-2xl border border-white/10",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h2",{className:"text-white font-medium text-lg truncate",children:l.name}),e.jsxs("p",{className:"text-white/60 text-sm",children:[r+1," / ",h.length]})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[R&&e.jsxs(e.Fragment,{children:[e.jsx(P,{icon:e.jsx(y.ZoomOut,{className:"w-5 h-5"}),label:"缩小",onClick:S,disabled:i<=.5}),e.jsxs("span",{className:"text-white/70 text-sm min-w-[4rem] text-center font-medium",children:[Math.round(i*100),"%"]}),e.jsx(P,{icon:e.jsx(y.ZoomIn,{className:"w-5 h-5"}),label:"放大",onClick:N,disabled:i>=5}),e.jsx("div",{className:"w-px h-6 bg-white/20 mx-2"}),e.jsx(P,{icon:e.jsx(y.Minimize2,{className:"w-5 h-5"}),label:"适应窗口",onClick:L}),e.jsx(P,{icon:e.jsx(y.Maximize2,{className:"w-5 h-5"}),label:"原始尺寸",onClick:g}),e.jsx("div",{className:"w-px h-6 bg-white/20 mx-2"})]}),z&&e.jsxs(e.Fragment,{children:[e.jsx(P,{icon:e.jsx(y.RotateCcw,{className:"w-5 h-5"}),label:"向左旋转",onClick:M}),e.jsx(P,{icon:e.jsx(y.RotateCw,{className:"w-5 h-5"}),label:"向右旋转",onClick:C}),e.jsx("div",{className:"w-px h-6 bg-white/20 mx-2"})]}),(R||z)&&e.jsxs(e.Fragment,{children:[e.jsx(P,{icon:e.jsx(y.RefreshCw,{className:"w-5 h-5"}),label:"复原",onClick:v}),e.jsx("div",{className:"w-px h-6 bg-white/20 mx-2"})]}),e.jsx(P,{icon:e.jsx(y.Download,{className:"w-5 h-5"}),label:"下载",onClick:E}),e.jsx("div",{className:"w-px h-6 bg-white/20 mx-2"}),e.jsx(P,{icon:e.jsx(y.X,{className:"w-5 h-5"}),label:"关闭",onClick:a})]})]})}),e.jsx("div",{className:"flex-1 flex items-center justify-center pt-24 pb-8 overflow-auto",children:p?p.render(l):e.jsxs(e.Fragment,{children:[m==="image"&&e.jsx(se,{url:l.url,zoom:i,rotation:c,onZoomChange:k}),m==="pdf"&&e.jsx(re,{url:l.url,zoom:i,currentPage:f,onPageChange:x,onTotalPagesChange:b}),m==="docx"&&e.jsx(oe,{url:l.url}),m==="xlsx"&&e.jsx(ne,{url:l.url}),m==="pptx"&&e.jsx(le,{url:l.url}),m==="video"&&e.jsx(ce,{url:l.url}),m==="audio"&&e.jsx(ie,{url:l.url,fileName:l.name}),m==="markdown"&&e.jsx(de,{url:l.url}),m==="text"&&e.jsx(me,{url:l.url,fileName:l.name}),m==="unsupported"&&e.jsx(xe,{fileName:l.name,fileType:l.type,onDownload:E})]})}),h.length>1&&e.jsxs(e.Fragment,{children:[r>0&&e.jsx(D.motion.button,{initial:{x:-100,opacity:0},animate:{x:0,opacity:1},exit:{x:-100,opacity:0},onClick:()=>d==null?void 0:d(r-1),className:"absolute left-4 top-1/2 -translate-y-1/2 w-12 h-12 rounded-full bg-black/40 backdrop-blur-xl border border-white/10 flex items-center justify-center text-white hover:bg-black/60 transition-all shadow-2xl",children:e.jsx(y.ChevronLeft,{className:"w-6 h-6"})}),r<h.length-1&&e.jsx(D.motion.button,{initial:{x:100,opacity:0},animate:{x:0,opacity:1},exit:{x:100,opacity:0},onClick:()=>d==null?void 0:d(r+1),className:"absolute right-4 top-1/2 -translate-y-1/2 w-12 h-12 rounded-full bg-black/40 backdrop-blur-xl border border-white/10 flex items-center justify-center text-white hover:bg-black/60 transition-all shadow-2xl",children:e.jsx(y.ChevronRight,{className:"w-6 h-6"})})]})]})})});return _.createPortal(V,document.body)},P=({icon:s,label:r,onClick:n,disabled:a})=>e.jsx("button",{onClick:n,disabled:a,title:r,className:`p-2 rounded-lg transition-all ${a?"text-white/30 cursor-not-allowed":"text-white hover:bg-white/10 active:bg-white/20"}`,children:s}),pe=ee.version;Object.defineProperty(exports,"pdfjs",{enumerable:!0,get:()=>T.pdfjs});exports.FilePreviewModal=fe;exports.VERSION=pe;exports.configurePdfjs=U;exports.normalizeFile=B;exports.normalizeFiles=A;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),ee=require("react-dom"),z=require("framer-motion"),S=require("lucide-react"),L=require("react-pdf"),te=require("mammoth"),se=require("xlsx"),B=require("pptx-preview"),re=require("video.js"),le=require("react-markdown"),oe=require("remark-gfm"),A=require("react-syntax-highlighter");function ne(r){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const o in r)if(o!=="default"){const a=Object.getOwnPropertyDescriptor(r,o);Object.defineProperty(s,o,a.get?a:{enumerable:!0,get:()=>r[o]})}}return s.default=r,Object.freeze(s)}const X=ne(se),ae="1.0.3",ce={version:ae};function ie(r){try{const a=new URL(r).pathname.split("/").pop()||"file";return decodeURIComponent(a)}catch{const s=r.split("/").pop()||"file";return decodeURIComponent(s)}}function q(r){var a;const s=((a=r.split(".").pop())==null?void 0:a.toLowerCase())||"";return{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",bmp:"image/bmp",ico:"image/x-icon",mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",ogv:"video/ogg",mov:"video/quicktime",avi:"video/x-msvideo",mkv:"video/x-matroska",m4v:"video/x-m4v","3gp":"video/3gpp",flv:"video/x-flv",mp3:"audio/mpeg",wav:"audio/wav",m4a:"audio/mp4",aac:"audio/aac",flac:"audio/flac",pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",ppt:"application/vnd.ms-powerpoint",txt:"text/plain",md:"text/markdown",markdown:"text/markdown",json:"application/json",xml:"application/xml",html:"text/html",css:"text/css",js:"text/javascript",ts:"text/typescript",jsx:"text/javascript",tsx:"text/typescript",py:"text/x-python",java:"text/x-java",cpp:"text/x-c++src",c:"text/x-csrc",cs:"text/x-csharp",php:"text/x-php",rb:"text/x-ruby",go:"text/x-go",rs:"text/x-rust",yaml:"text/yaml",yml:"text/yaml"}[s]||"application/octet-stream"}function U(r,s=0){if(r instanceof File)return{id:`file-${Date.now()}-${s}`,name:r.name,url:URL.createObjectURL(r),type:r.type||q(r.name),size:r.size};if(typeof r=="string"){const o=ie(r);return{id:`url-${Date.now()}-${s}`,name:o,url:r,type:q(o)}}return{id:r.id||`link-${Date.now()}-${s}`,name:r.name,url:r.url,type:r.type||q(r.name),size:r.size}}function V(r){return r.map((s,o)=>U(s,o))}const de=({url:r,zoom:s,rotation:o,onZoomChange:a})=>{const[n,d]=t.useState(!1),[i,l]=t.useState(null),[c,p]=t.useState({x:0,y:0}),[x,m]=t.useState(!1),[v,f]=t.useState({x:0,y:0}),[g,h]=t.useState(1),j=t.useRef(null);t.useEffect(()=>{d(!1),l(null),p({x:0,y:0}),h(1)},[r]),t.useEffect(()=>{h(s)},[s]),t.useEffect(()=>{p({x:0,y:0})},[s,o]);const y=()=>{d(!0)},k=()=>{l("图片加载失败"),d(!0)},u=()=>{p({x:0,y:0})},M=t.useCallback(N=>{N.preventDefault(),N.stopPropagation();const P=N.deltaY>0?-.1:.1;h(R=>{const F=Math.max(.5,Math.min(5,R+P));return a&&a(F),F})},[a]),C=t.useCallback(N=>{N.button===0&&(m(!0),f({x:N.clientX-c.x,y:N.clientY-c.y}))},[c]),w=t.useCallback(N=>{x&&p({x:N.clientX-v.x,y:N.clientY-v.y})},[x,v]),T=t.useCallback(()=>{m(!1)},[]);return e.jsxs("div",{ref:j,className:"flex items-center justify-center w-full h-full overflow-hidden",onWheel:M,onMouseDown:C,onMouseMove:w,onMouseUp:T,onMouseLeave:T,style:{cursor:x?"grabbing":"grab"},children:[!n&&!i&&e.jsx("div",{className:"flex items-center justify-center",children:e.jsx("div",{className:"w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin"})}),i&&e.jsx("div",{className:"text-white/70 text-center",children:e.jsx("p",{className:"text-lg",children:i})}),e.jsx(z.motion.img,{src:r,alt:"Preview",className:`max-w-none select-none ${n?"":"hidden"}`,style:{transform:`translate(${c.x}px, ${c.y}px) scale(${g}) rotate(${o}deg)`,transformOrigin:"center",transition:x?"none":"transform 0.3s ease-out"},onLoad:y,onError:k,onDoubleClick:u,initial:{opacity:0},animate:{opacity:n?1:0},transition:{duration:.3},draggable:!1})]})};function _(r){if(typeof window>"u")return;const{workerSrc:s=`https://unpkg.com/pdfjs-dist@${L.pdfjs.version}/build/pdf.worker.min.mjs`,cMapUrl:o=`https://unpkg.com/pdfjs-dist@${L.pdfjs.version}/cmaps/`,cMapPacked:a=!0}=r||{};L.pdfjs.GlobalWorkerOptions.workerSrc=s,L.pdfjs.GlobalWorkerOptions.cMapUrl=o,L.pdfjs.GlobalWorkerOptions.cMapPacked=a}_();const me=({url:r,zoom:s,currentPage:o,onPageChange:a,onTotalPagesChange:n})=>{const[d,i]=t.useState(0),[l,c]=t.useState(null),p=t.useRef(null),x=t.useRef(new Map);t.useEffect(()=>{c(null)},[r]);const m=({numPages:h})=>{i(h),n(h),a(1)},v=h=>{console.error("PDF 加载错误:",h),c("PDF 文件加载失败")},f=t.useCallback(()=>{if(!p.current)return;const h=p.current,j=h.scrollTop,y=h.clientHeight,k=j+y/2;let u=1,M=1/0;x.current.forEach((C,w)=>{const T=C.getBoundingClientRect(),N=h.getBoundingClientRect(),P=T.top-N.top+T.height/2+j,R=Math.abs(P-k);R<M&&(M=R,u=w)}),u!==o&&a(u)},[o,a]);t.useEffect(()=>{const h=p.current;if(h)return h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)},[f]);const g=t.useCallback((h,j)=>{j?x.current.set(h,j):x.current.delete(h)},[]);return e.jsxs("div",{ref:p,className:"flex flex-col items-center w-full h-full overflow-auto py-4 md:py-8 px-2 md:px-4",children:[l&&e.jsx("div",{className:"text-white/70 text-center",children:e.jsx("p",{className:"text-lg",children:l})}),!l&&e.jsx(L.Document,{file:r,onLoadSuccess:m,onLoadError:v,loading:e.jsx("div",{className:"flex items-center justify-center min-h-screen",children:e.jsx("div",{className:"w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin"})}),children:e.jsx("div",{className:"flex flex-col gap-4",children:Array.from(new Array(d),(h,j)=>{const y=j+1;return e.jsxs("div",{ref:k=>g(y,k),className:"relative",children:[e.jsx(L.Page,{pageNumber:y,scale:s,loading:e.jsx("div",{className:"flex items-center justify-center p-8 bg-white/5 rounded-lg min-h-[600px]",children:e.jsx("div",{className:"w-8 h-8 border-4 border-white/20 border-t-white rounded-full animate-spin"})}),renderTextLayer:!0,renderAnnotationLayer:!0,className:"shadow-2xl"}),e.jsx("div",{className:"absolute top-2 right-2 bg-black/60 backdrop-blur-sm text-white text-xs px-3 py-1 rounded-full",children:y})]},`page_${y}`)})})}),d>0&&e.jsxs("div",{className:"sticky bottom-2 md:bottom-4 mt-4 md:mt-8 bg-black/60 backdrop-blur-xl text-white px-4 py-2 md:px-6 md:py-3 rounded-full text-xs md:text-sm font-medium shadow-2xl border border-white/10",children:["第 ",o," 页 / 共 ",d," 页"]})]})},ue=({url:r})=>{const[s,o]=t.useState(""),[a,n]=t.useState(!0),[d,i]=t.useState(null);return t.useEffect(()=>{(async()=>{n(!0),i(null),o("");try{const c=await fetch(r);if(!c.ok)throw new Error("文件加载失败");const p=await c.arrayBuffer(),x=await te.convertToHtml({arrayBuffer:p});o(x.value)}catch(c){console.error("Docx 解析错误:",c),i("Word 文档解析失败")}finally{n(!1)}})()},[r]),a?e.jsx("div",{className:"flex items-center justify-center w-full h-full",children:e.jsx("div",{className:"w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin"})}):d?e.jsx("div",{className:"flex items-center justify-center w-full h-full",children:e.jsx("div",{className:"text-white/70 text-center",children:e.jsx("p",{className:"text-lg",children:d})})}):e.jsx("div",{className:"w-full h-full overflow-auto p-4 md:p-8",children:e.jsx("div",{className:"max-w-full md:max-w-4xl mx-auto bg-white rounded-lg shadow-2xl p-6 md:p-12",dangerouslySetInnerHTML:{__html:s},style:{fontFamily:"system-ui, -apple-system, sans-serif",lineHeight:"1.6",color:"#333"}})})},xe=({url:r})=>{const[s,o]=t.useState([]),[a,n]=t.useState(0),[d,i]=t.useState(!0),[l,c]=t.useState(null);if(t.useEffect(()=>{(async()=>{i(!0),c(null),o([]);try{const m=await fetch(r);if(!m.ok)throw new Error("文件加载失败");const v=await m.arrayBuffer(),f=X.read(v,{type:"array"}),g=f.SheetNames.map(h=>{const j=f.Sheets[h],y=X.utils.sheet_to_json(j,{header:1});return{name:h,data:y}});o(g),n(0)}catch(m){console.error("Excel 解析错误:",m),c("Excel 文件解析失败")}finally{i(!1)}})()},[r]),d)return e.jsx("div",{className:"flex items-center justify-center w-full h-full",children:e.jsx("div",{className:"w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin"})});if(l)return e.jsx("div",{className:"flex items-center justify-center w-full h-full",children:e.jsx("div",{className:"text-white/70 text-center",children:e.jsx("p",{className:"text-lg",children:l})})});const p=s[a];return e.jsxs("div",{className:"w-full h-full flex flex-col overflow-hidden",children:[s.length>1&&e.jsx("div",{className:"flex gap-1 md:gap-2 p-2 md:p-4 bg-black/20 backdrop-blur-sm overflow-x-auto border-b border-white/10 scrollbar-hide",children:s.map((x,m)=>e.jsx("button",{onClick:()=>n(m),className:`px-3 py-1.5 md:px-4 md:py-2 rounded-lg text-xs md:text-sm font-medium transition-all flex-shrink-0 ${a===m?"bg-gradient-to-r from-purple-500 to-pink-500 text-white shadow-lg":"bg-white/10 text-white hover:bg-white/20"}`,children:x.name},m))}),e.jsx("div",{className:"flex-1 overflow-auto p-2 md:p-8",children:e.jsx("div",{className:"inline-block min-w-full bg-gradient-to-br from-gray-800/90 to-gray-900/90 backdrop-blur-xl rounded-xl md:rounded-2xl shadow-2xl overflow-hidden border border-white/10",children:e.jsx("table",{className:"min-w-full divide-y divide-white/10",children:e.jsx("tbody",{className:"divide-y divide-white/10",children:p==null?void 0:p.data.map((x,m)=>e.jsx("tr",{className:`transition-colors ${m===0?"bg-gradient-to-r from-purple-500/20 to-pink-500/20 font-semibold":"hover:bg-white/5"}`,children:x.map((v,f)=>e.jsx("td",{className:"px-3 py-2 md:px-6 md:py-4 whitespace-nowrap text-xs md:text-sm text-gray-200 border-r border-white/10",children:String(v??"")},f))},m))})})})})]})},he=({url:r})=>{const[s,o]=t.useState(!0),[a,n]=t.useState(null),d=t.useRef(null),i=t.useRef(null),l=t.useRef(null),c=t.useRef(null),p=t.useRef(null),x=t.useRef({width:0,height:0}),m=t.useCallback(()=>{if(!d.current)return{width:960,height:540};const f=d.current.clientWidth,g=Math.floor(f*9/16);return console.log("计算尺寸:",{width:f,height:g}),{width:f,height:g}},[]),v=t.useCallback(async()=>{if(!(!d.current||!c.current)){console.log("重新初始化预览器...");try{if(i.current)try{i.current.destroy()}catch(h){console.error("销毁预览器失败:",h)}d.current.innerHTML="";const f=m();console.log("重新初始化使用尺寸:",f);const g=B.init(d.current,{width:f.width,height:f.height});i.current=g,await g.preview(c.current),console.log("重新初始化成功")}catch(f){console.error("重新初始化失败:",f)}}},[m]);return t.useEffect(()=>{if(!d.current)return;let f=!0;const g=()=>{if(f){f=!1;const u=m();x.current=u;return}const h=m(),j=x.current,y=Math.abs(j.width-h.width),k=Math.abs(j.height-h.height);if(y<10&&k<10){console.log("尺寸变化太小,忽略");return}console.log("检测到尺寸变化:",{old:j,new:h,diff:{width:y,height:k}}),x.current=h,p.current&&clearTimeout(p.current),p.current=window.setTimeout(()=>{i.current&&c.current&&(console.log("尺寸变化,准备重新初始化"),v())},800)};return l.current=new ResizeObserver(()=>{g()}),l.current.observe(d.current),()=>{l.current&&l.current.disconnect(),p.current&&clearTimeout(p.current)}},[m,v]),t.useEffect(()=>{let f=!0;const g=async()=>{if(!d.current){console.log("Container ref not ready");return}o(!0),n(null);try{console.log("开始加载 PPTX:",r);const j=await fetch(r);if(!j.ok)throw new Error("文件加载失败");const y=await j.arrayBuffer();if(c.current=y,console.log("文件加载成功,大小:",y.byteLength),!f)return;d.current&&(d.current.innerHTML="");const k=m();console.log("使用尺寸:",k),console.log("初始化预览器...");const u=B.init(d.current,{width:k.width,height:k.height});i.current=u,console.log("开始预览..."),u.preview(y).then(()=>{console.log("预览成功"),f&&o(!1)}).catch(M=>{console.error("预览失败:",M),f&&(n("PPT 文件预览失败"),o(!1))})}catch(j){console.error("PPTX 解析错误:",j),f&&(n(j instanceof Error?j.message:"PPT 文件解析失败"),o(!1))}},h=setTimeout(()=>{g()},100);return()=>{if(f=!1,clearTimeout(h),c.current=null,i.current)try{i.current.destroy()}catch(j){console.error("销毁预览器失败:",j)}i.current=null}},[r,m]),e.jsxs("div",{className:"relative flex flex-col items-center w-full h-full pt-2 px-2 md:px-4",children:[s&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 backdrop-blur-sm z-10 rounded-xl md:rounded-2xl",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-10 h-10 md:w-12 md:h-12 mx-auto mb-3 border-4 border-white/20 border-t-white rounded-full animate-spin"}),e.jsx("p",{className:"text-xs md:text-sm text-white/70 font-medium",children:"加载 PPT 中..."})]})}),a&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 backdrop-blur-sm z-10 rounded-xl md:rounded-2xl",children:e.jsxs("div",{className:"text-center max-w-sm md:max-w-md px-4",children:[e.jsx("div",{className:"w-24 h-24 md:w-32 md:h-32 mx-auto mb-4 md:mb-6 rounded-2xl md:rounded-3xl bg-gradient-to-br from-orange-500 via-red-500 to-pink-500 flex items-center justify-center shadow-2xl",children:e.jsx(S.Presentation,{className:"w-12 h-12 md:w-16 md:h-16 text-white"})}),e.jsx("p",{className:"text-lg md:text-xl text-white/90 mb-2 md:mb-3 font-medium",children:"PPT 预览"}),e.jsx("p",{className:"text-xs md:text-sm text-white/60 mb-4 md:mb-6",children:a||"浏览器暂不支持直接预览 PPT 文件"}),e.jsxs("a",{href:r,download:!0,className:"inline-flex items-center gap-2 px-4 py-2 md:px-6 md:py-3 bg-gradient-to-r from-purple-500 to-pink-500 text-white text-sm md:text-base rounded-lg md:rounded-xl hover:scale-105 transition-all shadow-lg",children:[e.jsx("svg",{className:"w-4 h-4 md:w-5 md:h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"下载文件"]}),e.jsx("p",{className:"text-xs text-white/40 mt-3 md:mt-4",children:"提示:可以使用 Microsoft PowerPoint 或 WPS 打开"})]})}),e.jsx("div",{ref:d,className:"pptx-wrapper w-full max-w-full md:max-w-6xl"})]})},fe=r=>{var a;const s=((a=r.split(".").pop())==null?void 0:a.toLowerCase().split("?")[0])||"";return{mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",ogv:"video/ogg",mov:"video/quicktime",avi:"video/x-msvideo",mkv:"video/x-matroska",m4v:"video/mp4","3gp":"video/3gpp",flv:"video/x-flv"}[s]||"video/mp4"},pe=({url:r})=>{const[s,o]=t.useState(null),[a,n]=t.useState(!0),d=t.useRef(null),i=t.useRef(null);return t.useEffect(()=>{if(!i.current&&d.current){const l=document.createElement("video-js");l.classList.add("vjs-big-play-centered","vjs-theme-apple"),d.current.appendChild(l);const c=fe(r),x=re(l,{controls:!0,responsive:!0,fluid:!0,preload:"auto",controlBar:{children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","remainingTimeDisplay","fullscreenToggle"],volumePanel:{inline:!1}},html5:{vhs:{overrideNative:!0},nativeVideoTracks:!1,nativeAudioTracks:!1,nativeTextTracks:!1},sources:c==="video/quicktime"?[{src:r,type:"video/quicktime"},{src:r,type:"video/mp4"}]:[{src:r,type:c}]});x.on("loadeddata",()=>{n(!1)}),x.on("error",()=>{const m=x.error();console.error("Video.js error:",m),o(`视频加载失败: ${(m==null?void 0:m.message)||"未知错误"}`),n(!1)}),i.current=x}},[r]),t.useEffect(()=>{const l=i.current;return()=>{l&&!l.isDisposed()&&(l.dispose(),i.current=null)}},[]),s?e.jsx("div",{className:"flex items-center justify-center w-full h-full",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-red-500/10 flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("p",{className:"text-lg font-medium text-white/90 mb-2",children:"视频加载失败"}),e.jsx("p",{className:"text-sm text-white/60",children:s})]})}):e.jsx("div",{className:"flex items-center justify-center w-full h-full p-4 md:p-8",children:e.jsxs("div",{className:"w-full max-w-full md:max-w-5xl relative",children:[a&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/20 backdrop-blur-sm rounded-2xl z-10",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-12 h-12 mx-auto mb-3 border-3 border-white/20 border-t-white rounded-full animate-spin"}),e.jsx("p",{className:"text-sm text-white/70 font-medium",children:"加载视频中..."})]})}),e.jsx("div",{ref:d,className:"overflow-hidden",style:{boxShadow:"0 20px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05)"}})]})})},we=({url:r,fileName:s})=>{const[o,a]=t.useState(null),[n,d]=t.useState(!1),[i,l]=t.useState(0),[c,p]=t.useState(0),[x,m]=t.useState(1),[v,f]=t.useState(!1),g=t.useRef(null);t.useEffect(()=>{const w=g.current;if(!w)return;const T=()=>{isNaN(w.currentTime)||l(w.currentTime)},N=()=>{!isNaN(w.duration)&&isFinite(w.duration)&&p(w.duration)},P=()=>d(!1),R=()=>N();return w.addEventListener("timeupdate",T),w.addEventListener("loadedmetadata",N),w.addEventListener("durationchange",N),w.addEventListener("canplay",R),w.addEventListener("ended",P),w.readyState>=1&&N(),()=>{w.removeEventListener("timeupdate",T),w.removeEventListener("loadedmetadata",N),w.removeEventListener("durationchange",N),w.removeEventListener("canplay",R),w.removeEventListener("ended",P)}},[]);const h=()=>{g.current&&(n?g.current.pause():g.current.play(),d(!n))},j=w=>{const T=parseFloat(w.target.value);l(T),g.current&&(g.current.currentTime=T)},y=w=>{const T=parseFloat(w.target.value);m(T),g.current&&(g.current.volume=T),T>0&&f(!1)},k=()=>{g.current&&(g.current.muted=!v,f(!v))},u=w=>{g.current&&(g.current.currentTime+=w)},M=w=>{if(!isFinite(w)||isNaN(w)||w<0)return"0:00";const T=Math.floor(w/60),N=Math.floor(w%60);return`${T}:${N.toString().padStart(2,"0")}`},C=()=>{a("音频加载失败")};return o?e.jsx("div",{className:"flex items-center justify-center w-full h-full",children:e.jsx("div",{className:"text-white/70 text-center",children:e.jsx("p",{className:"text-lg",children:o})})}):e.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full p-4 md:p-8 gap-4 md:gap-8",children:[e.jsx("div",{className:"w-48 h-48 md:w-64 md:h-64 rounded-3xl bg-gradient-to-br from-purple-500 via-pink-500 to-rose-500 flex items-center justify-center shadow-2xl backdrop-blur-xl",children:e.jsx(S.Music,{className:"w-24 h-24 md:w-32 md:h-32 text-white"})}),e.jsxs("div",{className:"text-white text-center max-w-sm md:max-w-md px-4",children:[e.jsx("p",{className:"text-xl md:text-2xl font-medium mb-1 truncate",children:s}),e.jsx("p",{className:"text-xs md:text-sm text-white/60",children:"音频文件"})]}),e.jsxs("div",{className:"w-full max-w-sm md:max-w-md bg-white/10 backdrop-blur-xl rounded-2xl p-4 md:p-6 border border-white/20",children:[e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"relative h-4 flex items-center",children:[e.jsx("div",{className:"absolute w-full h-[6px] bg-white/20 rounded-full"}),e.jsx("div",{className:"absolute h-[6px] bg-gradient-to-r from-purple-500 to-pink-500 rounded-full transition-all duration-100 ease-linear pointer-events-none",style:{width:`${c>0?i/c*100:i>100?100:i}%`}}),e.jsx("input",{type:"range",min:"0",max:c>0?c:100+(i>100?i%100:0),value:i,onChange:j,className:"audio-slider absolute w-full"})]}),e.jsxs("div",{className:"flex justify-between text-xs text-white/60 mt-3",children:[e.jsx("span",{children:M(i)}),e.jsx("span",{children:M(c)})]})]}),e.jsxs("div",{className:"flex items-center justify-center gap-4 mb-4",children:[e.jsx("button",{onClick:()=>u(-10),className:"w-10 h-10 rounded-full bg-white/10 hover:bg-white/20 flex items-center justify-center text-white transition-all",children:e.jsx(S.SkipBack,{className:"w-5 h-5"})}),e.jsx("button",{onClick:h,className:"w-14 h-14 rounded-full bg-gradient-to-br from-purple-500 to-pink-500 hover:scale-105 flex items-center justify-center text-white transition-all shadow-lg",children:n?e.jsx(S.Pause,{className:"w-6 h-6"}):e.jsx(S.Play,{className:"w-6 h-6 ml-1"})}),e.jsx("button",{onClick:()=>u(10),className:"w-10 h-10 rounded-full bg-white/10 hover:bg-white/20 flex items-center justify-center text-white transition-all",children:e.jsx(S.SkipForward,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:k,className:"text-white/80 hover:text-white transition-colors",children:v||x===0?e.jsx(S.VolumeX,{className:"w-5 h-5"}):e.jsx(S.Volume2,{className:"w-5 h-5"})}),e.jsxs("div",{className:"flex-1 relative h-3 flex items-center",children:[e.jsx("div",{className:"absolute w-full h-[4px] bg-white/20 rounded-full"}),e.jsx("div",{className:"absolute h-[4px] bg-purple-500 rounded-full transition-all duration-100 pointer-events-none",style:{width:`${(v?0:x)*100}%`}}),e.jsx("input",{type:"range",min:"0",max:"1",step:"0.01",value:v?0:x,onChange:y,className:"volume-slider absolute w-full"})]})]})]}),e.jsx("audio",{ref:g,src:r,onError:C,className:"hidden"})]})},Z={'pre[class*="language-"]':{color:"#d4d4d4",fontSize:"13px",textShadow:"none",fontFamily:'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:".5em 0",overflow:"auto",background:"#1e1e1e"},'code[class*="language-"]':{color:"#d4d4d4",fontSize:"13px",textShadow:"none",fontFamily:'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]::selection':{textShadow:"none",background:"#264F78"},'code[class*="language-"]::selection':{textShadow:"none",background:"#264F78"},'pre[class*="language-"] *::selection':{textShadow:"none",background:"#264F78"},'code[class*="language-"] *::selection':{textShadow:"none",background:"#264F78"},':not(pre) > code[class*="language-"]':{padding:".1em .3em",borderRadius:".3em",color:"#db4c69",background:"#1e1e1e"},".namespace":{Opacity:".7"},"doctype.doctype-tag":{color:"#569CD6"},"doctype.name":{color:"#9cdcfe"},comment:{color:"#6a9955"},prolog:{color:"#6a9955"},punctuation:{color:"#d4d4d4"},".language-html .language-css .token.punctuation":{color:"#d4d4d4"},".language-html .language-javascript .token.punctuation":{color:"#d4d4d4"},property:{color:"#9cdcfe"},tag:{color:"#569cd6"},boolean:{color:"#569cd6"},number:{color:"#b5cea8"},constant:{color:"#9cdcfe"},symbol:{color:"#b5cea8"},inserted:{color:"#b5cea8"},unit:{color:"#b5cea8"},selector:{color:"#d7ba7d"},"attr-name":{color:"#9cdcfe"},string:{color:"#ce9178"},char:{color:"#ce9178"},builtin:{color:"#ce9178"},deleted:{color:"#ce9178"},".language-css .token.string.url":{textDecoration:"underline"},operator:{color:"#d4d4d4"},entity:{color:"#569cd6"},"operator.arrow":{color:"#569CD6"},atrule:{color:"#ce9178"},"atrule.rule":{color:"#c586c0"},"atrule.url":{color:"#9cdcfe"},"atrule.url.function":{color:"#dcdcaa"},"atrule.url.punctuation":{color:"#d4d4d4"},keyword:{color:"#569CD6"},"keyword.module":{color:"#c586c0"},"keyword.control-flow":{color:"#c586c0"},function:{color:"#dcdcaa"},"function.maybe-class-name":{color:"#dcdcaa"},regex:{color:"#d16969"},important:{color:"#569cd6"},italic:{fontStyle:"italic"},"class-name":{color:"#4ec9b0"},"maybe-class-name":{color:"#4ec9b0"},console:{color:"#9cdcfe"},parameter:{color:"#9cdcfe"},interpolation:{color:"#9cdcfe"},"punctuation.interpolation-punctuation":{color:"#569cd6"},variable:{color:"#9cdcfe"},"imports.maybe-class-name":{color:"#9cdcfe"},"exports.maybe-class-name":{color:"#9cdcfe"},escape:{color:"#d7ba7d"},"tag.punctuation":{color:"#808080"},cdata:{color:"#808080"},"attr-value":{color:"#ce9178"},"attr-value.punctuation":{color:"#ce9178"},"attr-value.punctuation.attr-equals":{color:"#d4d4d4"},namespace:{color:"#4ec9b0"},'pre[class*="language-javascript"]':{color:"#9cdcfe"},'code[class*="language-javascript"]':{color:"#9cdcfe"},'pre[class*="language-jsx"]':{color:"#9cdcfe"},'code[class*="language-jsx"]':{color:"#9cdcfe"},'pre[class*="language-typescript"]':{color:"#9cdcfe"},'code[class*="language-typescript"]':{color:"#9cdcfe"},'pre[class*="language-tsx"]':{color:"#9cdcfe"},'code[class*="language-tsx"]':{color:"#9cdcfe"},'pre[class*="language-css"]':{color:"#ce9178"},'code[class*="language-css"]':{color:"#ce9178"},'pre[class*="language-html"]':{color:"#d4d4d4"},'code[class*="language-html"]':{color:"#d4d4d4"},".language-regex .token.anchor":{color:"#dcdcaa"},".language-html .token.punctuation":{color:"#808080"},'pre[class*="language-"] > code[class*="language-"]':{position:"relative",zIndex:"1"},".line-highlight.line-highlight":{background:"#f7ebc6",boxShadow:"inset 5px 0 0 #f7d87c",zIndex:"0"}},ge=({url:r})=>{const[s,o]=t.useState(""),[a,n]=t.useState(!0),[d,i]=t.useState(null);return t.useEffect(()=>{(async()=>{try{n(!0),i(null);const c=await fetch(r);if(!c.ok)throw new Error("加载失败");const p=await c.text();o(p)}catch(c){i("Markdown 文件加载失败"),console.error(c)}finally{n(!1)}})()},[r]),a?e.jsx("div",{className:"flex items-center justify-center w-full h-full",children:e.jsx("div",{className:"w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin"})}):d?e.jsx("div",{className:"flex items-center justify-center w-full h-full",children:e.jsx("div",{className:"text-white/70 text-center",children:e.jsx("p",{className:"text-lg",children:d})})}):e.jsx("div",{className:"w-full h-full overflow-auto p-4 md:p-8",children:e.jsx("div",{className:"max-w-full md:max-w-4xl mx-auto bg-white/5 backdrop-blur-sm rounded-2xl p-4 md:p-8 border border-white/10",children:e.jsx("div",{className:"prose prose-invert prose-sm md:prose-lg max-w-none",children:e.jsx(le,{remarkPlugins:[oe],components:{code({node:l,inline:c,className:p,children:x,...m}){const v=/language-(\w+)/.exec(p||"");return!c&&v?e.jsx(A.Prism,{style:Z,language:v[1],PreTag:"div",className:"rounded-lg",...m,children:String(x).replace(/\n$/,"")}):e.jsx("code",{className:"bg-white/10 px-1.5 py-0.5 rounded text-sm",...m,children:x})},h1:({children:l})=>e.jsx("h1",{className:"text-4xl font-bold mb-4 text-white border-b border-white/20 pb-2",children:l}),h2:({children:l})=>e.jsx("h2",{className:"text-3xl font-bold mb-3 text-white mt-8",children:l}),h3:({children:l})=>e.jsx("h3",{className:"text-2xl font-bold mb-2 text-white mt-6",children:l}),p:({children:l})=>e.jsx("p",{className:"text-white/90 mb-4 leading-relaxed",children:l}),a:({href:l,children:c})=>e.jsx("a",{href:l,className:"text-blue-400 hover:text-blue-300 underline",target:"_blank",rel:"noopener noreferrer",children:c}),ul:({children:l})=>e.jsx("ul",{className:"list-disc list-inside mb-4 text-white/90",children:l}),ol:({children:l})=>e.jsx("ol",{className:"list-decimal list-inside mb-4 text-white/90",children:l}),li:({children:l})=>e.jsx("li",{className:"mb-1",children:l}),blockquote:({children:l})=>e.jsx("blockquote",{className:"border-l-4 border-blue-500 pl-4 italic text-white/80 my-4",children:l}),table:({children:l})=>e.jsx("div",{className:"overflow-x-auto my-4",children:e.jsx("table",{className:"min-w-full border border-white/20",children:l})}),th:({children:l})=>e.jsx("th",{className:"border border-white/20 px-4 py-2 bg-white/10 text-white font-semibold",children:l}),td:({children:l})=>e.jsx("td",{className:"border border-white/20 px-4 py-2 text-white/90",children:l}),hr:()=>e.jsx("hr",{className:"border-white/20 my-6"}),img:({src:l,alt:c})=>e.jsx("img",{src:l,alt:c,className:"rounded-lg max-w-full h-auto my-4"})},children:s})})})})},be=r=>{var a;const s=((a=r.split(".").pop())==null?void 0:a.toLowerCase())||"";return{js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",java:"java",cpp:"cpp",c:"c",cs:"csharp",php:"php",rb:"ruby",go:"go",rs:"rust",swift:"swift",kt:"kotlin",scala:"scala",sh:"bash",bash:"bash",zsh:"bash",json:"json",xml:"xml",html:"html",css:"css",scss:"scss",sass:"sass",less:"less",sql:"sql",yaml:"yaml",yml:"yaml",toml:"toml",ini:"ini",conf:"nginx",md:"markdown",txt:"text"}[s]||"text"},je=({url:r,fileName:s})=>{const[o,a]=t.useState(""),[n,d]=t.useState(!0),[i,l]=t.useState(null),c=be(s);return t.useEffect(()=>{(async()=>{try{d(!0),l(null);const x=await fetch(r);if(!x.ok)throw new Error("加载失败");const m=await x.text();a(m)}catch(x){l("文本文件加载失败"),console.error(x)}finally{d(!1)}})()},[r]),n?e.jsx("div",{className:"flex items-center justify-center w-full h-full",children:e.jsx("div",{className:"w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin"})}):i?e.jsx("div",{className:"flex items-center justify-center w-full h-full",children:e.jsx("div",{className:"text-white/70 text-center",children:e.jsx("p",{className:"text-lg",children:i})})}):e.jsx("div",{className:"w-full h-full overflow-auto p-4 md:p-8",children:e.jsxs("div",{className:"max-w-full md:max-w-6xl mx-auto bg-white/5 backdrop-blur-sm rounded-2xl border border-white/10 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 md:gap-3 px-4 py-3 md:px-6 md:py-4 bg-white/5 border-b border-white/10",children:[e.jsx(S.FileText,{className:"w-4 h-4 md:w-5 md:h-5 text-white/70 flex-shrink-0"}),e.jsx("span",{className:"text-white font-medium text-sm md:text-base truncate",children:s}),e.jsx("span",{className:"ml-auto text-xs text-white/50 uppercase flex-shrink-0",children:c})]}),e.jsx("div",{className:"text-sm",children:c==="text"?e.jsx("pre",{className:"p-6 text-white/90 font-mono whitespace-pre-wrap break-words",children:o}):e.jsx(A.Prism,{language:c,style:Z,showLineNumbers:!0,customStyle:{margin:0,padding:"1.5rem",background:"transparent",fontSize:"0.875rem"},lineNumberStyle:{minWidth:"3em",paddingRight:"1em",color:"rgba(255, 255, 255, 0.3)",userSelect:"none"},children:o})})]})})},ve=({fileName:r,fileType:s,onDownload:o})=>e.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full p-8 gap-6",children:[e.jsx("div",{className:"w-32 h-32 rounded-full bg-white/10 flex items-center justify-center",children:e.jsx(S.FileQuestion,{className:"w-16 h-16 text-white/70"})}),e.jsxs("div",{className:"text-white text-center",children:[e.jsx("p",{className:"text-xl font-medium mb-2",children:r}),e.jsxs("p",{className:"text-white/70",children:["不支持预览此文件类型 (",s,")"]})]}),e.jsxs("button",{onClick:o,className:"flex items-center gap-2 px-6 py-3 bg-white/10 hover:bg-white/20 backdrop-blur-sm rounded-lg text-white font-medium transition-all",children:[e.jsx(S.Download,{className:"w-5 h-5"}),"下载文件查看"]})]}),ye=r=>{var n;const s=((n=r.name.split(".").pop())==null?void 0:n.toLowerCase())||"",o=r.type.toLowerCase();if(o.startsWith("image/")||["jpg","jpeg","png","gif","webp","svg"].includes(s))return"image";if(o.includes("pdf")||s==="pdf")return"pdf";if(o.includes("wordprocessingml")||s==="docx")return"docx";if(o.includes("spreadsheetml")||s==="xlsx")return"xlsx";if(o.includes("presentationml")||s==="pptx"||s==="ppt")return"pptx";if(o.startsWith("video/")||["mp4","webm","ogg","ogv","mov","avi","mkv","m4v","3gp","flv"].includes(s))return"video";if(o.startsWith("audio/")||["mp3","wav","ogg","m4a","flac","aac"].includes(s))return"audio";if(s==="md"||s==="markdown")return"markdown";const a=["txt","log","csv","js","jsx","ts","tsx","json","py","java","cpp","c","h","cs","php","rb","go","rs","swift","kt","html","css","scss","sass","less","xml","yaml","yml","toml","ini","conf","sh","bash","zsh","sql"];return o.startsWith("text/")||a.includes(s)?"text":"unsupported"},ke=({files:r,currentIndex:s,isOpen:o,onClose:a,onNavigate:n,customRenderers:d=[]})=>{const[i,l]=t.useState(1),[c,p]=t.useState(0),[x,m]=t.useState(1),[,v]=t.useState(1),[f,g]=t.useState(null),[h,j]=t.useState(null),y=50,k=t.useMemo(()=>V(r),[r]),u=k[s],M=t.useMemo(()=>u?d.find(b=>b.test(u)):null,[u,d]),C=u?ye(u):"unsupported";t.useEffect(()=>{l(1),p(0),m(1),v(1)},[s]),t.useEffect(()=>{if(o){const b=document.body.style.overflow,D=document.body.style.paddingRight,$=window.innerWidth-document.documentElement.clientWidth;return document.body.style.overflow="hidden",$>0&&(document.body.style.paddingRight=`${$}px`),()=>{document.body.style.overflow=b,document.body.style.paddingRight=D}}},[o]),t.useEffect(()=>{if(!o)return;const b=D=>{D.key==="Escape"?a():D.key==="ArrowLeft"&&s>0?n==null||n(s-1):D.key==="ArrowRight"&&s<k.length-1&&(n==null||n(s+1))};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[o,s,k.length,a,n]);const w=t.useCallback(()=>{l(b=>Math.min(b+.25,5))},[]),T=t.useCallback(()=>{l(b=>Math.max(b-.25,.5))},[]),N=t.useCallback(()=>{p(b=>b+90)},[]),P=t.useCallback(()=>{p(b=>b-90)},[]),R=t.useCallback(()=>{l(1),p(0)},[]),F=t.useCallback(()=>{l(1)},[]),G=t.useCallback(b=>{l(b)},[]),Y=t.useCallback(()=>{l(1),p(0)},[]),W=t.useCallback(()=>{if(!u)return;const b=document.createElement("a");b.href=u.url,b.download=u.name,b.click()},[u]),J=t.useCallback(b=>{j(null),g(b.targetTouches[0].clientX)},[]),K=t.useCallback(b=>{j(b.targetTouches[0].clientX)},[]),Q=t.useCallback(()=>{if(!f||!h)return;const b=f-h,D=b>y,$=b<-y;D&&s<k.length-1&&(n==null||n(s+1)),$&&s>0&&(n==null||n(s-1))},[f,h,y,s,k.length,n]);if(!o||!u)return null;const O=C==="image"||C==="pdf",H=C==="image",I=e.jsx(z.AnimatePresence,{children:o&&e.jsx(z.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/80 backdrop-blur-md overflow-hidden",onClick:a,onWheel:b=>b.stopPropagation(),children:e.jsxs("div",{className:"relative w-full h-full flex flex-col overflow-hidden",onClick:b=>b.stopPropagation(),children:[e.jsx(z.motion.div,{initial:{y:-100},animate:{y:0},exit:{y:-100},className:"absolute top-0 left-0 right-0 z-10 p-4",children:e.jsxs("div",{className:"max-w-7xl mx-auto flex flex-col md:flex-row md:items-center md:justify-between bg-black/40 backdrop-blur-xl rounded-2xl px-3 md:px-6 py-3 md:py-4 shadow-2xl border border-white/10 gap-2 md:gap-0",children:[e.jsxs("div",{className:"flex items-center justify-between md:flex-1 md:min-w-0 md:mr-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h2",{className:"text-white font-medium text-sm md:text-lg truncate",children:u.name}),e.jsxs("p",{className:"text-white/60 text-xs md:text-sm",children:[s+1," / ",k.length]})]}),e.jsx("div",{className:"md:hidden ml-2",children:e.jsx(E,{icon:e.jsx(S.X,{className:"w-5 h-5"}),label:"关闭",onClick:a})})]}),e.jsxs("div",{className:"flex items-center gap-1 md:gap-2 overflow-x-auto scrollbar-hide flex-shrink-0",children:[O&&e.jsxs(e.Fragment,{children:[e.jsx(E,{icon:e.jsx(S.ZoomOut,{className:"w-5 h-5"}),label:"缩小",onClick:T,disabled:i<=.5}),e.jsxs("span",{className:"text-white/70 text-sm min-w-[4rem] text-center font-medium",children:[Math.round(i*100),"%"]}),e.jsx(E,{icon:e.jsx(S.ZoomIn,{className:"w-5 h-5"}),label:"放大",onClick:w,disabled:i>=5}),e.jsx("div",{className:"w-px h-6 bg-white/20 mx-2"}),e.jsx(E,{icon:e.jsx(S.Minimize2,{className:"w-5 h-5"}),label:"适应窗口",onClick:R}),e.jsx(E,{icon:e.jsx(S.Maximize2,{className:"w-5 h-5"}),label:"原始尺寸",onClick:F}),e.jsx("div",{className:"w-px h-6 bg-white/20 mx-2"})]}),H&&e.jsxs(e.Fragment,{children:[e.jsx(E,{icon:e.jsx(S.RotateCcw,{className:"w-5 h-5"}),label:"向左旋转",onClick:P}),e.jsx(E,{icon:e.jsx(S.RotateCw,{className:"w-5 h-5"}),label:"向右旋转",onClick:N}),e.jsx("div",{className:"w-px h-6 bg-white/20 mx-2"})]}),(O||H)&&e.jsxs(e.Fragment,{children:[e.jsx(E,{icon:e.jsx(S.RefreshCw,{className:"w-5 h-5"}),label:"复原",onClick:Y}),e.jsx("div",{className:"w-px h-6 bg-white/20 mx-2"})]}),e.jsx(E,{icon:e.jsx(S.Download,{className:"w-5 h-5"}),label:"下载",onClick:W}),e.jsxs("div",{className:"hidden md:flex items-center",children:[e.jsx("div",{className:"w-px h-6 bg-white/20 mx-2"}),e.jsx(E,{icon:e.jsx(S.X,{className:"w-5 h-5"}),label:"关闭",onClick:a})]})]})]})}),e.jsx("div",{className:"flex-1 flex items-center justify-center pt-32 md:pt-24 pb-4 md:pb-8 overflow-auto",onTouchStart:J,onTouchMove:K,onTouchEnd:Q,children:M?M.render(u):e.jsxs(e.Fragment,{children:[C==="image"&&e.jsx(de,{url:u.url,zoom:i,rotation:c,onZoomChange:G}),C==="pdf"&&e.jsx(me,{url:u.url,zoom:i,currentPage:x,onPageChange:m,onTotalPagesChange:v}),C==="docx"&&e.jsx(ue,{url:u.url}),C==="xlsx"&&e.jsx(xe,{url:u.url}),C==="pptx"&&e.jsx(he,{url:u.url}),C==="video"&&e.jsx(pe,{url:u.url}),C==="audio"&&e.jsx(we,{url:u.url,fileName:u.name}),C==="markdown"&&e.jsx(ge,{url:u.url}),C==="text"&&e.jsx(je,{url:u.url,fileName:u.name}),C==="unsupported"&&e.jsx(ve,{fileName:u.name,fileType:u.type,onDownload:W})]})}),k.length>1&&e.jsxs(e.Fragment,{children:[s>0&&e.jsx(z.motion.button,{initial:{x:-100,opacity:0},animate:{x:0,opacity:1},exit:{x:-100,opacity:0},onClick:()=>n==null?void 0:n(s-1),className:"absolute left-2 md:left-4 top-1/2 -translate-y-1/2 w-10 h-10 md:w-12 md:h-12 rounded-full bg-black/40 backdrop-blur-xl border border-white/10 flex items-center justify-center text-white hover:bg-black/60 transition-all shadow-2xl",children:e.jsx(S.ChevronLeft,{className:"w-5 h-5 md:w-6 md:h-6"})}),s<k.length-1&&e.jsx(z.motion.button,{initial:{x:100,opacity:0},animate:{x:0,opacity:1},exit:{x:100,opacity:0},onClick:()=>n==null?void 0:n(s+1),className:"absolute right-2 md:right-4 top-1/2 -translate-y-1/2 w-10 h-10 md:w-12 md:h-12 rounded-full bg-black/40 backdrop-blur-xl border border-white/10 flex items-center justify-center text-white hover:bg-black/60 transition-all shadow-2xl",children:e.jsx(S.ChevronRight,{className:"w-5 h-5 md:w-6 md:h-6"})})]})]})})});return ee.createPortal(I,document.body)},E=({icon:r,label:s,onClick:o,disabled:a})=>e.jsx("button",{onClick:o,disabled:a,title:s,className:`p-2 rounded-lg transition-all ${a?"text-white/30 cursor-not-allowed":"text-white hover:bg-white/10 active:bg-white/20"}`,children:r}),Ne=ce.version;Object.defineProperty(exports,"pdfjs",{enumerable:!0,get:()=>L.pdfjs});exports.FilePreviewModal=ke;exports.VERSION=Ne;exports.configurePdfjs=_;exports.normalizeFile=U;exports.normalizeFiles=V;
2
2
  //# sourceMappingURL=index.cjs.map