@ehfuse/file-viewer 0.2.9 → 0.2.10
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/dist/index.esm.js +4 -4
- package/dist/index.js +4 -4
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{useState as h,useEffect as R,useMemo as rr,useCallback as w,useRef as x}from"react";import{Dialog as go,DialogTitle as xo,DialogContent as yo,Drawer as bo,IconButton as L,Box as d,Typography as P,Tooltip as S,Button as or,Tabs as vo,Tab as wo,Snackbar as Mo,useMediaQuery as Co,useTheme as To}from"@mui/material";import Io from"@mui/icons-material/Close";import ko from"@mui/icons-material/Menu";import Lo from"@mui/icons-material/Share";import Eo from"@mui/icons-material/Download";import Fo from"@mui/icons-material/Add";import Ro from"@mui/icons-material/Remove";import Po from"@mui/icons-material/RotateLeft";import So from"@mui/icons-material/RotateRight";import Do from"@mui/icons-material/FitScreen";import st from"@mui/icons-material/KeyboardArrowLeft";import ct from"@mui/icons-material/KeyboardArrowRight";import Bo from"@mui/icons-material/TextSnippet";import zo from"@mui/icons-material/VideoFile";import Ho from"@mui/icons-material/AudioFile";import Vo from"@mui/icons-material/Description";import Ao from"@mui/icons-material/InsertDriveFile";import nr from"@mui/icons-material/Code";import Xo from"@mui/icons-material/TableView";import{Document as ir,Page as ar,pdfjs as Wo}from"react-pdf";import sr from"@monaco-editor/react";import _o from"react-spreadsheet";import*as pe from"xlsx";import{LoadingProgress as cr}from"@ehfuse/mui-fadeout-loading-progress";var ot=a=>{let c=a.split(".").pop()?.toLowerCase()||"";return["jpg","jpeg","png","gif","bmp","webp","svg"].includes(c)?"image":c==="pdf"?"pdf":["txt","json","xml","log","md","markdown"].includes(c)?"text":["csv","xls","xlsx"].includes(c)?"spreadsheet":["html","htm"].includes(c)?"html":["js","jsx","ts","tsx","css","scss","sass","less","php","py","java","c","cpp","h","hpp","cs","go","rs","rb","swift","kt","scala","sql","sh","bash","bat","ps1","yml","yaml","toml","ini","conf"].includes(c)?"code":["mp4","avi","mov","wmv","flv","webm"].includes(c)?"video":["mp3","wav","ogg","m4a","aac"].includes(c)?"audio":["doc","docx","ppt","pptx","hwp","hwpx"].includes(c)?"office":"unsupported"},Qt=a=>{let c=(a||"").toLowerCase().split(";")[0].trim();return c?c.startsWith("image/")?"image":c==="application/pdf"?"pdf":c.startsWith("video/")?"video":c.startsWith("audio/")?"audio":c==="text/html"?"html":c==="text/csv"||c==="application/vnd.ms-excel"||c==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"?"spreadsheet":c.startsWith("text/")||c==="application/json"||c==="application/xml"?"text":"unsupported":"unsupported"},T=(a,c)=>{let u=ot(a);return u!=="unsupported"?u:Qt(c)},co=new Set(["image","pdf","text","code","html","spreadsheet","video","audio"]),lo=a=>co.has(ot(a)),uo={"image/jpeg":"jpg","image/png":"png","image/gif":"gif","image/webp":"webp","image/bmp":"bmp","image/svg+xml":"svg","application/pdf":"pdf","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/vnd.ms-excel":"xls","text/csv":"csv","text/plain":"txt","application/json":"json","text/xml":"xml","application/xml":"xml","text/html":"html","video/mp4":"mp4","video/webm":"webm","audio/mpeg":"mp3","audio/wav":"wav"},mo=(a,c)=>{let u=(a??"").trim()||"\uCCA8\uBD80\uD30C\uC77C";if(/\.[a-z0-9]+$/i.test(u))return u;let m=(c??"").trim().toLowerCase().split(";")[0],j=uo[m]??"";return j?`${u}.${j}`:u},nt=a=>{let c=a.split(".").pop()?.toLowerCase()||"";return{js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",html:"html",htm:"html",css:"css",scss:"scss",sass:"scss",less:"less",json:"json",xml:"xml",php:"php",py:"python",java:"java",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",go:"go",rs:"rust",rb:"ruby",swift:"swift",kt:"kotlin",scala:"scala",sql:"sql",sh:"shell",bash:"shell",bat:"bat",ps1:"powershell",yml:"yaml",yaml:"yaml",toml:"toml",ini:"ini",conf:"ini",md:"markdown",markdown:"markdown",txt:"plaintext",log:"plaintext",csv:"plaintext"}[c]||"plaintext"};var po=a=>(a||"").replace(/[\\/:*?"<>|\r\n]/g,"_").trim()||"download",it=(a,c)=>{let u=URL.createObjectURL(a),m=document.createElement("a");m.href=u,m.download=po(c),m.rel="noopener",document.body.appendChild(m),m.click(),m.remove(),window.setTimeout(()=>URL.revokeObjectURL(u),6e4)};var Jt=async a=>{let c=URL.createObjectURL(a);try{let u=await new Promise((U,Q)=>{let B=new Image;B.onload=()=>U(B),B.onerror=()=>Q(new Error("\uC774\uBBF8\uC9C0\uB97C \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")),B.src=c}),m=document.createElement("canvas");m.width=u.naturalWidth||u.width||1024,m.height=u.naturalHeight||u.height||1024;let j=m.getContext("2d");if(!j)throw new Error("\uCE94\uBC84\uC2A4\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");return j.drawImage(u,0,0,m.width,m.height),await new Promise((U,Q)=>{m.toBlob(B=>B?U(B):Q(new Error("PNG \uBCC0\uD658 \uC2E4\uD328")),"image/png")})}finally{URL.revokeObjectURL(c)}};import{useMediaQuery as ho,useTheme as fo}from"@mui/material";function er(){let a=fo();return!ho(a.breakpoints.up("lg"))}import{jsx as ne,jsxs as tr}from"react/jsx-runtime";function ie(a){return tr("svg",{id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 501.551 501.551",xmlSpace:"preserve",width:a.width||"22px",...a,children:[ne("path",{style:{fill:"#F2F2F2"},d:"M480.653,0H20.898C9.404,0,0,9.404,0,20.898v459.755c0,11.494,9.404,20.898,20.898,20.898h459.755 c11.494,0,20.898-9.404,20.898-20.898V20.898C501.551,9.404,492.147,0,480.653,0z"}),ne("rect",{x:36.571,y:36.571,style:{fill:"#84DBFF"},width:428.408,height:345.861}),ne("path",{style:{fill:"#334A5E"},d:"M261.224,382.433H36.571v-87.771c17.763-5.224,37.616-7.314,57.469-7.314 c25.078,0,50.155,4.18,71.053,12.539c6.269,2.09,11.494,4.18,16.718,7.314C218.384,323.918,246.596,350.041,261.224,382.433z"}),ne("path",{style:{fill:"#40596B"},d:"M464.98,271.673v110.759H127.478c9.404-29.257,29.257-55.38,55.38-76.278 c42.841-34.482,103.445-55.38,172.408-55.38C393.927,250.776,432.588,258.09,464.98,271.673z"}),tr("g",{children:[ne("circle",{style:{fill:"#FFFFFF"},cx:122.253,cy:122.253,r:42.841}),ne("path",{style:{fill:"#FFFFFF"},d:"M433.633,101.355c1.045-3.135,1.045-6.269,1.045-9.404c0-16.718-13.584-31.347-31.347-31.347 c-11.494,0-21.943,6.269-27.167,15.673c-3.135-2.09-7.314-2.09-11.494-2.09c-14.629,0-26.122,10.449-28.212,24.033 c-8.359,2.09-14.629,9.404-14.629,17.763c0,10.449,8.359,18.808,18.808,18.808h82.547c10.449,0,18.808-8.359,18.808-18.808 C441.992,109.714,438.857,104.49,433.633,101.355z"})]})]})}import{jsx as D,jsxs as at}from"react/jsx-runtime";function ae(a){return D("svg",{id:"_x35_",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512",xmlSpace:"preserve",width:a.width||"28px",...a,children:at("g",{children:[D("polygon",{style:{fill:"#B12A27"},points:"475.435,117.825 475.435,512 47.791,512 47.791,0.002 357.613,0.002 412.491,54.881 "}),D("rect",{x:36.565,y:34.295,style:{fill:"#F2F2F2"},width:205.097,height:91.768}),at("g",{children:[at("g",{children:[D("path",{style:{fill:"#B12A27"},d:"M110.132,64.379c-0.905-2.186-2.111-4.146-3.769-5.804c-1.658-1.658-3.694-3.015-6.031-3.92 c-2.412-0.98-5.126-1.432-8.141-1.432H69.651v58.195h11.383V89.481h11.157c3.015,0,5.729-0.452,8.141-1.432 c2.337-0.905,4.372-2.261,6.031-3.92c1.659-1.658,2.865-3.543,3.769-5.804c0.829-2.186,1.282-4.523,1.282-6.935 C111.413,68.902,110.961,66.565,110.132,64.379z M97.844,77.118c-1.508,1.432-3.618,2.186-6.181,2.186H81.034V63.323h10.629 c2.563,0,4.674,0.754,6.181,2.261c1.432,1.432,2.186,3.392,2.186,5.804C100.031,73.726,99.277,75.686,97.844,77.118z"}),D("path",{style:{fill:"#B12A27"},d:"M164.558,75.761c-0.075-2.035-0.151-3.844-0.377-5.503c-0.226-1.659-0.603-3.166-1.131-4.598 c-0.528-1.357-1.206-2.714-2.111-3.92c-2.035-2.94-4.523-5.126-7.312-6.483c-2.865-1.357-6.257-2.035-10.252-2.035h-20.956 v58.195h20.956c3.995,0,7.387-0.678,10.252-2.035c2.789-1.357,5.277-3.543,7.312-6.483c0.905-1.206,1.583-2.563,2.111-3.92 c0.528-1.432,0.905-2.94,1.131-4.598c0.226-1.658,0.301-3.468,0.377-5.503c0.075-1.96,0.075-4.146,0.075-6.558 C164.633,79.908,164.633,77.721,164.558,75.761z M153.175,88.2c0,1.734-0.151,3.091-0.302,4.297 c-0.151,1.131-0.377,2.186-0.678,2.94c-0.301,0.829-0.754,1.583-1.281,2.261c-1.885,2.412-4.749,3.543-8.518,3.543h-8.669V63.323 h8.669c3.769,0,6.634,1.206,8.518,3.618c0.528,0.678,0.98,1.357,1.281,2.186s0.528,1.809,0.678,3.015 c0.151,1.131,0.302,2.563,0.302,4.221c0.075,1.659,0.075,3.694,0.075,5.955C153.251,84.581,153.251,86.541,153.175,88.2z"}),D("path",{style:{fill:"#B12A27"},d:"M213.18,63.323V53.222h-38.37v58.195h11.383V87.823h22.992V77.646h-22.992V63.323H213.18z"})]}),D("g",{children:D("path",{style:{fill:"#B12A27"},d:"M110.132,64.379c-0.905-2.186-2.111-4.146-3.769-5.804c-1.658-1.658-3.694-3.015-6.031-3.92 c-2.412-0.98-5.126-1.432-8.141-1.432H69.651v58.195h11.383V89.481h11.157c3.015,0,5.729-0.452,8.141-1.432 c2.337-0.905,4.372-2.261,6.031-3.92c1.659-1.658,2.865-3.543,3.769-5.804c0.829-2.186,1.282-4.523,1.282-6.935 C111.413,68.902,110.961,66.565,110.132,64.379z M97.844,77.118c-1.508,1.432-3.618,2.186-6.181,2.186H81.034V63.323h10.629 c2.563,0,4.674,0.754,6.181,2.261c1.432,1.432,2.186,3.392,2.186,5.804C100.031,73.726,99.277,75.686,97.844,77.118z"})})]}),D("polygon",{style:{opacity:.08,fill:"#040000"},points:"475.435,117.825 475.435,512 47.791,512 47.791,419.581 247.705,219.667 259.54,207.832 266.098,201.273 277.029,190.343 289.995,177.377 412.491,54.881 "}),D("polygon",{style:{fill:"#771B1B"},points:"475.435,117.836 357.599,117.836 357.599,0 "}),D("g",{children:D("path",{style:{fill:"#F2F2F2"},d:"M414.376,370.658c-2.488-4.372-5.88-8.518-10.101-12.287c-3.467-3.166-7.538-6.106-12.137-8.82 c-18.544-10.93-45.003-16.207-80.961-16.207h-3.618c-1.96-1.809-3.995-3.618-6.106-5.503 c-13.644-12.287-24.499-25.63-32.942-40.48c16.584-36.561,24.499-69.126,23.519-96.867c-0.151-4.674-0.829-9.046-2.035-13.117 c-1.809-6.558-4.824-12.363-9.046-17.112c-0.075-0.075-0.075-0.075-0.151-0.151c-6.709-7.538-16.056-11.835-25.555-11.835 c-9.574,0-18.393,4.146-24.801,11.76c-6.332,7.538-9.724,17.866-9.875,30.002c-0.226,18.544,1.281,36.108,4.448,52.315 c0.301,1.282,0.528,2.563,0.829,3.844c3.166,14.7,7.84,28.645,13.87,41.611c-7.086,14.398-14.247,26.836-19.223,35.279 c-3.769,6.408-7.915,13.117-12.212,19.826c-19.373,3.468-35.807,7.689-50.129,12.966c-19.373,7.011-34.902,16.056-46.059,26.836 c-7.237,6.935-12.137,14.323-14.549,22.012c-2.563,7.915-2.412,15.83,0.452,22.916c2.638,6.558,7.387,12.061,13.72,15.83 c1.508,0.905,3.091,1.658,4.749,2.337c4.825,1.96,10.101,3.015,15.604,3.015c12.74,0,25.856-5.503,36.937-15.378 c20.655-18.469,41.988-48.169,54.577-66.94c10.327-1.583,21.559-2.94,34.224-4.297c14.926-1.508,28.118-2.412,40.104-2.865 c3.694,3.317,7.237,6.483,10.629,9.498c18.846,16.81,33.168,28.947,46.134,37.465c0,0.075,0.075,0.075,0.151,0.075 c5.126,3.392,10.026,6.181,14.926,8.443c5.503,2.563,11.081,3.92,16.81,3.92c7.237,0,14.021-2.186,19.675-6.181 c5.729-4.146,9.875-10.101,11.76-16.81C420.18,387.694,418.899,378.724,414.376,370.658z M247.705,219.667 c-1.055-9.348-1.508-19.072-1.357-29.324c0.151-9.724,3.694-16.283,8.895-16.283c3.92,0,8.066,3.543,9.95,10.327 c0.528,2.035,0.905,4.372,0.98,7.01c0.151,3.166,0.075,6.483-0.075,9.875c-0.452,9.574-2.111,19.75-4.975,30.681 c-1.734,7.011-3.995,14.323-6.784,21.936C251.173,243.186,248.911,231.803,247.705,219.667z M121.967,418.073 c-1.282-3.166,0.151-9.272,7.991-16.81c11.986-11.458,30.756-20.504,56.914-27.364c-4.975,6.784-9.875,12.966-14.624,18.619 c-7.237,8.744-14.172,16.132-20.429,21.71c-5.352,4.824-11.232,7.84-16.81,8.594c-0.98,0.151-1.96,0.226-2.94,0.226 C127.168,423.049,123.173,421.089,121.967,418.073z M242.428,337.942l0.528-0.829l-0.829,0.151 c0.151-0.377,0.377-0.754,0.603-1.055c3.166-5.352,7.161-12.212,11.458-20.127l0.377,0.829l0.98-2.035 c3.166,4.523,6.634,8.971,10.252,13.267c1.734,2.035,3.543,3.995,5.352,5.955l-1.206,0.075l1.055,0.98 c-3.091,0.226-6.332,0.528-9.574,0.829c-2.035,0.226-4.146,0.377-6.257,0.603C250.796,337.037,246.499,337.49,242.428,337.942z M369.297,384.98c-8.971-5.729-18.996-13.795-31.359-24.575c17.564,1.809,31.359,5.654,41.159,11.383 c4.297,2.488,7.538,5.051,9.724,7.538c3.618,3.844,4.9,7.312,4.221,9.649c-0.603,2.337-3.241,3.92-6.483,3.92 c-1.885,0-3.844-0.452-5.88-1.432c-3.468-1.658-7.086-3.694-10.93-6.181C369.598,385.282,369.448,385.131,369.297,384.98z"})})]})})}import{Fragment as Re,jsx as o,jsxs as g}from"react/jsx-runtime";var Yo="/pdfjs",lr=32,dr=240,jo=8192,lt=.25,dt=8,ut=80,ur=80,Oo=a=>{switch(a){case"image":return o(ie,{});case"pdf":return o(ae,{});case"text":return o(Bo,{sx:{mr:1,color:"#66BB6A"}});case"spreadsheet":return o(Xo,{sx:{mr:1,color:"#4CAF50"}});case"html":return o(nr,{sx:{mr:1,color:"#E91E63"}});case"code":return o(nr,{sx:{mr:1,color:"#2196F3"}});case"video":return o(zo,{sx:{mr:1,color:"#AB47BC"}});case"audio":return o(Ho,{sx:{mr:1,color:"#FF7043"}});case"office":return o(Vo,{sx:{mr:1,color:"#FFA726"}});default:return o(Ao,{sx:{mr:1,color:"#78909C"}})}},mr=a=>typeof a?.rotate=="number"?a.rotate:typeof a?._pageInfo?.rotate=="number"?a._pageInfo.rotate:0,pr=({open:a,onClose:c,file:u,files:m=null,initialIndex:j=0,loadFile:U,onDownload:Q,onShare:B,pdfAssetBase:J=Yo})=>{let b=er(),gr=To(),$=Co(gr.breakpoints.down("sm")),v=rr(()=>m&&m.length>0?m:[],[m]),[ee,W]=h(0);R(()=>{a&&W(v.length>0?Math.min(Math.max(j,0),v.length-1):0)},[a,j,v]);let l=v.length>0?v[ee]??u:u,[Be,ze]=h(!0),[xr,mt]=h(!1),[C,He]=h(""),[I,A]=h(1),[O,se]=h(0),[pt,he]=h(""),[M,ht]=h(""),[ft,fe]=h(""),[ce,ge]=h(14),[Ve,xe]=h(""),[Ae,gt]=h("preview"),[Xe,le]=h([]),[xt,yt]=h([]),[yr,We]=h(""),[_e,bt]=h(null),[vt,ye]=h(!1),[br,Ye]=h(!0),[wt,be]=h(""),[E,Mt]=h(),[F,G]=h(1),[vr,je]=h(!1),[ve,Ct]=h("portrait"),[wr,Tt]=h(0),[Oe,It]=h(0),[de,kt]=h({width:0,height:0}),Lt=x([]),Ne=x(null),K=x(null),Ue=x(null),$e=x(null),Mr=w(e=>{if(Ue.current?.disconnect(),$e.current?.(),$e.current=null,K.current=e,!e){Ue.current=null;return}let t=i=>{i.touches.length>=2&&i.preventDefault()};e.addEventListener("touchmove",t,{passive:!1}),$e.current=()=>e.removeEventListener("touchmove",t);let r=new ResizeObserver(i=>{let s=i[0]?.contentRect;s&&kt({width:s.width,height:s.height})});r.observe(e),Ue.current=r;let n=e.getBoundingClientRect();kt({width:n.width,height:n.height})},[]),[we,Et]=h(!1),[Ge,Cr]=h({x:0,y:0}),[Ke,Tr]=h({x:0,y:0}),Ir=w(async(e,t)=>{let r=URL.createObjectURL(e);He(r),ht(e.type||"");let n=T(t,e.type||"");if(n==="text"||n==="code"){let s=await e.text();fe(s);return}if(n==="html"){let s=await e.text();xe(s);return}if(n!=="spreadsheet")return;let i=t.split(".").pop()?.toLowerCase()||"";if(i==="csv"){let p=(await e.text()).split(`
|
|
2
|
-
`).map(f=>f.split(",").map(H=>({value:H.trim()})));le(p);return}if(i==="xls"||i==="xlsx"){ye(!0),Ye(!0);let s=await e.arrayBuffer(),p=pe.read(s,{type:"array"});yt(p.SheetNames),bt(p);let f=p.SheetNames[0];We(f),et(p,f)}},[]),ue=x(null),qe=w(async e=>{if(e.blob)return e.blob;if(U)return await U(e);if(e.url){let t=await fetch(e.url);if(!t.ok)throw new Error("\uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");return await t.blob()}throw new Error("\uD30C\uC77C \uB370\uC774\uD130 \uC18C\uC2A4(blob/url/loadFile)\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.")},[U]);R(()=>(l&&a?Fr():(C&&URL.revokeObjectURL(C),ue.current=null,He(""),fe(""),xe(""),le([]),ge(14),A(1),se(0)),()=>{C&&URL.revokeObjectURL(C)}),[l,a]);let kr=({numPages:e})=>{Mt(e),G(1),Ee.current=!0},Lr=e=>{let{width:t,height:r}=Er(e);Tt(mr(e)),t>0&&r>0&&It(t/r);let n=t>r?"landscape":"portrait";Ct(n)},Er=e=>{let t=e?.width||0,r=e?.height||0,n=mr(e);try{if(typeof e?.getViewport=="function"){let i=e.getViewport({scale:1,rotation:n});t=i.width,r=i.height}}catch(i){console.warn("[FileViewer] getViewport \uC2E4\uD328 - \uAE30\uBCF8 width/height\uB85C \uB300\uCCB4",i)}return{width:t,height:r}},Me=w(()=>{G(e=>Math.max(e-1,1))},[]),Ce=w(()=>{G(e=>Math.min(e+1,E||1))},[E]),Ft=rr(()=>({cMapUrl:`${J}/cmaps/`,cMapPacked:!0,standardFontDataUrl:`${J}/standard_fonts/`,wasmUrl:`${J}/wasm/`}),[J]);R(()=>{typeof window>"u"||(Wo.GlobalWorkerOptions.workerSrc=`${J}/pdf.worker.min.mjs`)},[J]),R(()=>{if(!a||v.length<=1||T(l?.name||"",M)==="pdf")return;let e=t=>{t.key==="ArrowLeft"?(t.preventDefault(),W(r=>Math.max(r-1,0))):t.key==="ArrowRight"&&(t.preventDefault(),W(r=>Math.min(r+1,v.length-1)))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a,v.length,l?.name,M]),R(()=>{if(!a||v.length<=1||T(l?.name||"",M)==="pdf"||I>1)return;let e=0,t=0,r=i=>{e=i.touches[0]?.clientX??0,t=i.touches[0]?.clientY??0},n=i=>{let s=(i.changedTouches[0]?.clientX??0)-e,p=(i.changedTouches[0]?.clientY??0)-t;Math.abs(s)<60||Math.abs(p)>Math.abs(s)||(s<0?W(f=>Math.min(f+1,v.length-1)):W(f=>Math.max(f-1,0)))};return document.addEventListener("touchstart",r,{passive:!0}),document.addEventListener("touchend",n,{passive:!0}),()=>{document.removeEventListener("touchstart",r),document.removeEventListener("touchend",n)}},[a,v.length,l?.name,M,I]),R(()=>{if(!a||T(l?.name||"",M)!=="pdf")return;let e=r=>{switch(r.key){case"ArrowLeft":case"ArrowUp":r.preventDefault(),Me();break;case"ArrowRight":case"ArrowDown":r.preventDefault(),Ce();break;case"Home":r.preventDefault(),G(1);break;case"End":r.preventDefault(),E&&G(E);break}},t=r=>{r.ctrlKey||Math.abs(r.deltaY)>50&&(r.preventDefault(),r.deltaY>0?Ce():Me())};return document.addEventListener("keydown",e),document.addEventListener("wheel",t,{passive:!1}),()=>{document.removeEventListener("keydown",e),document.removeEventListener("wheel",t)}},[a,l,M,Me,Ce,E]),R(()=>{if(!E||!a||T(l?.name||"",M)!=="pdf")return;if(F===1&&Ne.current){Ne.current.scrollTo({top:0,behavior:"smooth"});return}let e=Lt.current[F-1];e&&e.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},[a,l,M,E,F]),R(()=>{if(Be){let e=window.setTimeout(()=>mt(!0),180);return()=>window.clearTimeout(e)}},[Be]);let Fr=async()=>{if(l){ze(!0),he(""),ht(""),fe(""),xe(""),le([]);try{let e=await qe(l);ue.current=e,await Ir(e,l.name)}catch(e){console.error("\uD30C\uC77C \uB85C\uB4DC \uC624\uB958:",e),he("\uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")}finally{ze(!1)}}},Rr=async()=>{if(l)try{if(Q){await Q(l);return}let e=ue.current??await qe(l);it(e,l.name)}catch(e){console.error("\uD30C\uC77C \uB2E4\uC6B4\uB85C\uB4DC \uC624\uB958:",e)}},Pr=typeof navigator<"u"&&typeof navigator.share=="function"&&typeof navigator.canShare=="function",Sr=!!B||Pr,Dr=async()=>{if(l)try{if(B){await B(l);return}let e=ue.current??await qe(l),t=e.type||(typeof l.mimeType=="string"?l.mimeType:"")||"application/octet-stream",r=new File([e],l.name,{type:t});navigator.canShare({files:[r]})?await navigator.share({files:[r],title:l.name}):console.warn("\uC774 \uAE30\uAE30\uB294 \uC774 \uD30C\uC77C \uD615\uC2DD\uC758 \uACF5\uC720\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.")}catch(e){if(e?.name==="AbortError")return;console.error("\uD30C\uC77C \uACF5\uC720 \uC624\uB958:",e)}},Br=()=>{let e=l?T(l.name,M):"";e==="text"||e==="html"||e==="code"||e==="spreadsheet"?ge(t=>Math.min(t+2,24)):A(e==="pdf"?t=>Math.min(t+.25,dt):t=>Math.min(t+.25,3))},zr=()=>{let e=l?T(l.name,M):"";e==="text"||e==="html"||e==="code"||e==="spreadsheet"?ge(t=>Math.max(t-2,10)):A(e==="pdf"?t=>Math.max(t-.25,lt):t=>Math.max(t-.25,.25))},y=x(new Map),Hr=e=>Math.min(Math.max(e,.25),3),Vr=e=>Math.min(Math.max(e,lt),dt),Ze=x(null),Te=x(null),_=x({scale:1,tx:0,ty:0,rotation:0}),N=x(0),te=x(null),Ie=x(null),ke=w((e,t,r,n)=>{let i=Ze.current,s=Te.current;if(!i||!s)return{tx:t,ty:r};let p=s.offsetWidth,f=s.offsetHeight,H=(Math.round(n/90)%4+4)%4;if(H===1||H===3){let so=p;p=f,f=so}let X=p*e,Kt=f*e,qt=X>i.clientWidth?(X+i.clientWidth)/2-ur:0,Zt=Kt>i.clientHeight?(Kt+i.clientHeight)/2-ur:0;return{tx:Math.min(qt,Math.max(-qt,t)),ty:Math.min(Zt,Math.max(-Zt,r))}},[]),Rt=w((e,t)=>{let r=Ze.current,n=Te.current;if(!r||!n)return e>1;let i=(Math.round(t/90)%4+4)%4,s=i===1||i===3,p=s?n.offsetHeight:n.offsetWidth,f=s?n.offsetWidth:n.offsetHeight;return p*e>r.clientWidth+1||f*e>r.clientHeight+1},[]),q=w(e=>{let t=Te.current;if(!t)return;let{scale:r,tx:n,ty:i,rotation:s}=_.current;t.style.transition=e?"transform 0.25s ease":"none",t.style.transform=`translate(${n}px, ${i}px) scale(${r}) rotate(${s}deg)`},[]),Pt=w(()=>{let e=_.current,t=ke(e.scale,e.tx,e.ty,e.rotation);e.tx=t.tx,e.ty=t.ty,!N.current&&(N.current=requestAnimationFrame(()=>{N.current=0,q(!1)}))},[q,ke]),St=w(()=>{N.current&&(cancelAnimationFrame(N.current),N.current=0),y.current.clear(),te.current=null,Ie.current=null},[]),Ar=w(e=>{Te.current=e,e&&(_.current={scale:1,tx:0,ty:0,rotation:0},q(!1))},[q]);R(()=>{if(T(l?.name||"",M)!=="image")return;let e=_.current;e.scale=I,e.rotation=O;let t=ke(e.scale,e.tx,e.ty,e.rotation);e.tx=t.tx,e.ty=t.ty,q(!0)},[I,O,l,M,C,q,ke]),R(()=>()=>{N.current&&cancelAnimationFrame(N.current)},[]);let Xr=e=>{e.currentTarget.setPointerCapture?.(e.pointerId),y.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=[...y.current.values()],r=_.current;if(t.length===2){te.current=null;let n=e.currentTarget.getBoundingClientRect();Ie.current={startDist:Math.hypot(t[0].x-t[1].x,t[0].y-t[1].y)||1,baseScale:r.scale,baseTx:r.tx,baseTy:r.ty,startMidX:(t[0].x+t[1].x)/2,startMidY:(t[0].y+t[1].y)/2,centerX:n.left+n.width/2,centerY:n.top+n.height/2}}else t.length===1&&Rt(r.scale,r.rotation)&&(te.current={startX:e.clientX,startY:e.clientY,baseTx:r.tx,baseTy:r.ty})},Wr=e=>{if(!y.current.has(e.pointerId))return;y.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=_.current,r=Ie.current,n=[...y.current.values()];if(r&&n.length>=2){let s=Math.hypot(n[0].x-n[1].x,n[0].y-n[1].y),p=(n[0].x+n[1].x)/2,f=(n[0].y+n[1].y)/2,H=Hr(r.baseScale*s/r.startDist),X=H/r.baseScale;t.scale=H,t.tx=p-r.centerX-X*(r.startMidX-r.centerX-r.baseTx),t.ty=f-r.centerY-X*(r.startMidY-r.centerY-r.baseTy),Pt();return}let i=te.current;i&&n.length===1&&(t.tx=i.baseTx+(e.clientX-i.startX),t.ty=i.baseTy+(e.clientY-i.startY),Pt())},Dt=e=>{if(!y.current.has(e.pointerId))return;y.current.delete(e.pointerId),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId);let t=_.current;if(y.current.size<2&&(Ie.current=null,Math.abs(t.scale-I)>.001&&A(t.scale)),y.current.size===0)te.current=null;else if(y.current.size===1&&Rt(t.scale,t.rotation)){let r=[...y.current.values()][0];te.current={startX:r.x,startY:r.y,baseTx:t.tx,baseTy:t.ty}}},Bt=w(async()=>{if(C)try{let t=await(await fetch(C)).blob(),r=t.type==="image/png"?t:await Jt(t);await navigator.clipboard.write([new ClipboardItem({"image/png":r})]),be("\uC774\uBBF8\uC9C0\uB97C \uD074\uB9BD\uBCF4\uB4DC\uC5D0 \uBCF5\uC0AC\uD588\uC2B5\uB2C8\uB2E4.")}catch(e){console.error("\uC774\uBBF8\uC9C0 \uBCF5\uC0AC \uC624\uB958:",e),be("\uC774\uBBF8\uC9C0\uB97C \uBCF5\uC0AC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")}},[C]);R(()=>{if(!a||T(l?.name||"",M)!=="image")return;let e=t=>{if(!(t.ctrlKey||t.metaKey)||t.key.toLowerCase()!=="c")return;let r=t.target,n=r?.tagName;n==="INPUT"||n==="TEXTAREA"||r?.isContentEditable||(t.preventDefault(),Bt())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a,l,M,Bt]);let re=x(null),z=x(0),me=x(null),oe=x(null),Z=()=>K.current?.querySelector(".react-pdf__Page")??null,Le=x(null),zt=x(null),_r=()=>{let e=zt.current,t=Z()?.querySelector("canvas");if(!e||!t||!t.width||!t.height)return!1;let r=document.createElement("canvas");r.width=t.width,r.height=t.height;let n=r.getContext("2d");if(!n)return!1;n.drawImage(t,0,0);let i=t.getBoundingClientRect(),s=e.getBoundingClientRect();return Object.assign(r.style,{position:"absolute",left:`${i.left-s.left}px`,top:`${i.top-s.top}px`,width:`${i.width}px`,height:`${i.height}px`,pointerEvents:"none",zIndex:"1"}),e.appendChild(r),Le.current=r,!0},Ht=()=>{Le.current?.remove(),Le.current=null;let e=Z();e&&(e.style.visibility="")},Yr=()=>{z.current||(z.current=requestAnimationFrame(()=>{z.current=0;let e=re.current,t=Z();!e||!t||(t.style.transition="none",t.style.transformOrigin="top left",t.style.transform=`translate(${e.tx}px, ${e.ty}px) scale(${e.k})`,me.current={k:e.k,tx:e.tx,ty:e.ty,midX:e.lastMidX,midY:e.lastMidY})}))},Vt=()=>{z.current&&(cancelAnimationFrame(z.current),z.current=0),re.current=null,oe.current=null,me.current=null,Ht();let e=Z();e&&(e.style.transform="",e.style.willChange="auto")},At=e=>{let t=Z(),r=K.current;if(!t||!r)return;t.style.transform&&(t.style.transform="");let n=t.getBoundingClientRect(),i=r.getBoundingClientRect(),s=(e[0].x+e[1].x)/2,p=(e[0].y+e[1].y)/2;re.current={startDist:Math.hypot(e[0].x-e[1].x,e[0].y-e[1].y)||1,rectLeft:n.left,rectTop:n.top,pageW:n.width,pageH:n.height,viewerL:i.left,viewerT:i.top,viewerR:i.right,viewerB:i.bottom,startMidX:s,startMidY:p,lastMidX:s,lastMidY:p,k:1,tx:0,ty:0},me.current={k:1,tx:0,ty:0,midX:s,midY:p},t.style.willChange="transform"},jr=e=>{if(e.pointerType!=="touch")return;y.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=[...y.current.values()];if(t.length===2){if(oe.current||Le.current)return;At(t)}},Or=e=>{if(!y.current.has(e.pointerId))return;y.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=re.current,r=[...y.current.values()];if(t&&r.length>=2){e.preventDefault();let n=Math.hypot(r[0].x-r[1].x,r[0].y-r[1].y),i=Math.min(Math.max(n/t.startDist,lt/(I||1)),dt/(I||1)),s=(r[0].x+r[1].x)/2,p=(r[0].y+r[1].y)/2,f=s-t.rectLeft-i*(t.startMidX-t.rectLeft),H=p-t.rectTop-i*(t.startMidY-t.rectTop),X=ut;f=Math.min(t.viewerR-X-t.rectLeft,Math.max(t.viewerL+X-t.rectLeft-i*t.pageW,f)),H=Math.min(t.viewerB-X-t.rectTop,Math.max(t.viewerT+X-t.rectTop-i*t.pageH,H)),t.k=i,t.tx=f,t.ty=H,t.lastMidX=s,t.lastMidY=p,Yr()}},Xt=e=>{if(y.current.delete(e.pointerId),y.current.size>=2)return;let t=re.current;if(re.current=null,!t)return;z.current&&(cancelAnimationFrame(z.current),z.current=0);let r=me.current??{k:1,tx:0,ty:0,midX:t.startMidX,midY:t.startMidY};me.current=null;let n=Vr(I*r.k);if(Math.abs(n-I)<.001){let s=K.current;Vt(),s&&(s.scrollLeft-=r.tx,s.scrollTop-=r.ty);return}let i=K.current;if(i){let s=i.getBoundingClientRect();oe.current={u:(r.midX-t.rectLeft-r.tx)/r.k,v:(r.midY-t.rectTop-r.ty)/r.k,offX:r.midX-s.left,offY:r.midY-s.top,factor:n/(I||1)}}if(_r()){let s=Z();s&&(s.style.transform="",s.style.visibility="hidden")}A(n),Math.round(Math.min(tt*n,Ut))===rt&&requestAnimationFrame(()=>_t())},Ee=x(!0),Qe=x(null),Wt=()=>{let e=K.current;e&&(e.scrollLeft=(e.scrollWidth-e.clientWidth)/2,e.scrollTop=(e.scrollHeight-e.clientHeight)/2)},_t=()=>{let e=oe.current;if(!e)return;oe.current=null;let t=K.current,r=Z();if(!t||!r)return;Ht(),r.style.transform="",r.style.willChange="auto";let n=r.getBoundingClientRect(),i=t.getBoundingClientRect();t.scrollLeft+=n.left-i.left+e.u*e.factor-e.offX,t.scrollTop+=n.top-i.top+e.v*e.factor-e.offY;let s=[...y.current.values()];s.length>=2&&At(s)},Yt=()=>{let e=`${F}:${O}`;if(oe.current){Qe.current=e,_t();return}(Ee.current||Qe.current!==e)&&(Ee.current=!1,Qe.current=e,Wt())};R(()=>()=>{z.current&&cancelAnimationFrame(z.current)},[]);let Nr=()=>{se(e=>e-90)},Ur=()=>{se(e=>e+90)},$r=()=>{let e=T(l?.name||"",M);Vt(),e==="text"||e==="html"||e==="code"||e==="spreadsheet"?ge(14):e==="pdf"?(A(1),I===1&&O===0?Wt():Ee.current=!0):(St(),_.current={scale:1,tx:0,ty:0,rotation:0},q(!0),A(1)),se(0)},jt=(e,t)=>{Et(!0),Cr({x:e.clientX,y:e.clientY}),Tr({x:t.scrollLeft,y:t.scrollTop}),e.preventDefault()},Ot=w((e,t)=>{if(!we)return;let r=e.clientX-Ge.x,n=e.clientY-Ge.y;t.scrollLeft=Ke.x-r,t.scrollTop=Ke.y-n,e.preventDefault()},[we,Ge,Ke]),Je=w(()=>{Et(!1),document.body.style.cursor="default"},[]);R(()=>{if(we){let e=t=>{document.querySelectorAll(".draggable-scroll").forEach(n=>{Ot(t,n)})};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",Je),document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",Je),document.body.style.userSelect="",document.body.style.webkitUserSelect=""}}},[we,Ot,Je]);let Gr=w(()=>{ze(!1),mt(!1)},[]),et=w(async(e,t)=>{ye(!0),Ye(!0);try{await new Promise(p=>setTimeout(p,500));let r=e.Sheets[t],n=pe.utils.decode_range(r["!ref"]||"A1");console.debug("Excel range:",n);let s=pe.utils.sheet_to_json(r,{header:1,range:n,defval:""}).map(p=>p.map(f=>({value:f!=null?String(f):""})));le(s),await new Promise(p=>setTimeout(p,200))}catch(r){console.error("\uC6CC\uD06C\uC2DC\uD2B8 \uB85C\uB4DC \uC624\uB958:",r)}finally{Ye(!1)}},[]),Kr=w(()=>{ye(!1)},[]),qr=w(e=>{_e&&(We(e),et(_e,e))},[_e,et]),Nt=()=>{St(),_.current={scale:1,tx:0,ty:0,rotation:0},be(""),C&&URL.revokeObjectURL(C),ue.current=null,He(""),fe(""),xe(""),le([]),yt([]),We(""),bt(null),ye(!1),A(1),se(0),he(""),Mt(void 0),G(1),Ct("portrait"),Tt(0),It(0),c()};if(!l)return null;let k=T(l.name,M),Zr=((wr+O)%360+360)%360,Fe=O%180===0?Oe:Oe>0?1/Oe:0,Qr=Math.max(de.width-lr,dr),Jr=Math.max(de.height-lr,dr),tt=de.width>0&&Fe>0?Math.min(Qr,Jr*Fe):ve==="portrait"?600:800,eo=typeof window<"u"&&window.devicePixelRatio||1,Ut=jo/eo*(Fe>0?Math.min(1,Fe):1),rt=Math.round(Math.min(tt*I,Ut)),$t=Math.round(tt*I),to=$t>rt,ro=Math.max(16,Math.round(de.width)-ut),oo=Math.max(16,Math.round(de.height)-ut),no=ve==="landscape"?"200px":"150px",io=ve==="landscape"?.18:.17,Gt=()=>E?o(d,{ref:Ne,sx:{width:no,height:"100%",backgroundColor:"grey.200",borderRight:"1px solid",borderColor:"grey.300",overflow:"auto",p:2},children:Array.from({length:E},(e,t)=>g(d,{ref:r=>{Lt.current[t]=r},children:[o(d,{sx:{mb:0,p:1,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",border:F===t+1?"2px solid":"1px solid",borderColor:F===t+1?"primary.main":"grey.400",borderRadius:1,overflow:"hidden",backgroundColor:"white","&:hover":{borderColor:"primary.main"},aspectRatio:ve==="landscape"?"4 / 3":"3 / 4"},onClick:()=>{G(t+1),b&&je(!1)},children:o(ir,{file:C,options:Ft,loading:o("div",{style:{display:"none"}}),children:o(ar,{pageNumber:t+1,scale:io,loading:o("div",{style:{display:"none"}}),renderAnnotationLayer:!1,renderTextLayer:!1})})}),o(P,{variant:"caption",sx:{display:"block",textAlign:"center",p:.5,mb:1,color:F===t+1?"primary.main":"",fontWeight:F===t+1?"bold":"normal"},children:t+1})]},t+1))}):null,ao=()=>{let e=T(l?.name||"",M);if(xr&&!(e==="spreadsheet"))return o(d,{sx:{display:"flex",height:"100%",width:"100%",alignItems:"center",justifyContent:"center"},children:o(cr,{visible:Be,exitDelay:100,onComplete:Gr})});if(pt)return g(d,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column",children:[o(P,{color:"error",variant:"h6",children:pt}),o(P,{color:"text.secondary",variant:"body2",sx:{mt:1},children:"\uD30C\uC77C\uC744 \uB2E4\uC6B4\uB85C\uB4DC\uD558\uC5EC \uD655\uC778\uD574\uC8FC\uC138\uC694."})]});if(!C)return null;switch(e){case"image":return o(d,{ref:Ze,"data-allow-pinch":"true",onPointerDown:Xr,onPointerMove:Wr,onPointerUp:Dt,onPointerCancel:Dt,sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,overflow:"hidden",height:"100%",backgroundColor:"grey.100",p:2,touchAction:"none",overscrollBehavior:"contain",userSelect:"none","&:active":{cursor:"grabbing"}},children:o("img",{ref:Ar,src:C,alt:l.name,draggable:!1,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",display:"block",transform:"translate(0px, 0px) scale(1) rotate(0deg)",transformOrigin:"center center",pointerEvents:"none"}})});case"pdf":return g(Re,{children:[g(d,{ref:zt,sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",backgroundColor:"grey.100",position:"relative",overflow:"hidden"},children:[!b&&Gt(),o(d,{ref:Mr,className:"draggable-scroll",onMouseDown:r=>{let n=r.currentTarget;jt(r,n)},"data-allow-pinch":"true",onPointerDown:jr,onPointerMove:Or,onPointerUp:Xt,onPointerCancel:Xt,sx:{flex:1,display:"flex",flexDirection:"column",overflow:"auto",height:"100%",py:b?0:2,overflowAnchor:"none",touchAction:"pan-x pan-y","& > .react-pdf__Document":{m:"auto",...b&&{px:`${ro}px`,py:`${oo}px`},...to&&{"& .react-pdf__Page__canvas":{width:`${$t}px !important`,height:"auto !important"}}}},children:o(ir,{file:C,onLoadSuccess:kr,onLoadError:r=>{console.error("PDF \uB85C\uB4DC \uC624\uB958:",r),he("PDF \uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")},loading:o("div",{style:{display:"none"}}),error:g(d,{sx:{textAlign:"center",p:4},children:[o(P,{color:"error",variant:"h6",sx:{mb:2},children:"PDF\uB97C \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."}),o(P,{color:"text.secondary",variant:"body2",children:"\uD30C\uC77C\uC744 \uB2E4\uC6B4\uB85C\uB4DC\uD558\uC5EC \uD655\uC778\uD574\uC8FC\uC138\uC694."})]}),options:Ft,children:o(ar,{pageNumber:F,width:rt,rotate:O===0?void 0:Zr,loading:o("div",{style:{display:"none"}}),renderAnnotationLayer:!1,renderTextLayer:!1,onLoadSuccess:Lr,onRenderSuccess:Yt,onRenderError:Yt})})})]}),b&&o(bo,{anchor:"left",open:vr,onClose:()=>je(!1),sx:{zIndex:r=>r.zIndex.modal+2},children:Gt()})]});case"text":case"code":return o(d,{sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",flexDirection:"column"},children:ft?o(d,{sx:{flex:1,height:"100%",overflow:"hidden"},children:o(sr,{height:"100%",language:nt(l.name),value:ft,theme:"vs-dark",loading:!1,options:{readOnly:!0,domReadOnly:!0,minimap:{enabled:!0},scrollBeyondLastLine:!1,automaticLayout:!0,folding:!0,foldingHighlight:!1,formatOnPaste:!0,formatOnType:!0,wordWrap:"on",lineNumbers:"on",lineNumbersMinChars:4,glyphMargin:!1,renderLineHighlight:"none",renderWhitespace:"selection",fontFamily:"'Roboto', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace",fontSize:ce,lineHeight:Math.round(ce*1.5),scrollbar:{vertical:"auto",horizontal:"auto"},lineDecorationsWidth:10},onMount:(r,n)=>{r.onDidAttemptReadOnlyEdit(()=>{});let i=r.getDomNode();if(i){let s=document.createElement("style");s.textContent=`
|
|
1
|
+
import{useState as h,useEffect as R,useMemo as oo,useCallback as w,useRef as x}from"react";import{Dialog as gr,DialogTitle as xr,DialogContent as yr,Drawer as br,IconButton as L,Box as d,Typography as P,Tooltip as S,Button as ro,Tabs as vr,Tab as wr,Snackbar as Mr,useMediaQuery as Cr,useTheme as Tr}from"@mui/material";import Ir from"@mui/icons-material/Close";import kr from"@mui/icons-material/Menu";import Lr from"@mui/icons-material/Share";import Er from"@mui/icons-material/Download";import Fr from"@mui/icons-material/Add";import Rr from"@mui/icons-material/Remove";import Pr from"@mui/icons-material/RotateLeft";import Sr from"@mui/icons-material/RotateRight";import Br from"@mui/icons-material/FitScreen";import st from"@mui/icons-material/KeyboardArrowLeft";import ct from"@mui/icons-material/KeyboardArrowRight";import Dr from"@mui/icons-material/TextSnippet";import zr from"@mui/icons-material/VideoFile";import Hr from"@mui/icons-material/AudioFile";import Vr from"@mui/icons-material/Description";import Ar from"@mui/icons-material/InsertDriveFile";import no from"@mui/icons-material/Code";import Xr from"@mui/icons-material/TableView";import{Document as io,Page as ao,pdfjs as Wr}from"react-pdf";import so from"@monaco-editor/react";import _r from"react-spreadsheet";import*as pe from"xlsx";import{LoadingProgress as co}from"@ehfuse/mui-fadeout-loading-progress";var rt=a=>{let c=a.split(".").pop()?.toLowerCase()||"";return["jpg","jpeg","png","gif","bmp","webp","svg"].includes(c)?"image":c==="pdf"?"pdf":["txt","json","xml","log","md","markdown"].includes(c)?"text":["csv","xls","xlsx"].includes(c)?"spreadsheet":["html","htm"].includes(c)?"html":["js","jsx","ts","tsx","css","scss","sass","less","php","py","java","c","cpp","h","hpp","cs","go","rs","rb","swift","kt","scala","sql","sh","bash","bat","ps1","yml","yaml","toml","ini","conf"].includes(c)?"code":["mp4","avi","mov","wmv","flv","webm"].includes(c)?"video":["mp3","wav","ogg","m4a","aac"].includes(c)?"audio":["doc","docx","ppt","pptx","hwp","hwpx"].includes(c)?"office":"unsupported"},Qt=a=>{let c=(a||"").toLowerCase().split(";")[0].trim();return c?c.startsWith("image/")?"image":c==="application/pdf"?"pdf":c.startsWith("video/")?"video":c.startsWith("audio/")?"audio":c==="text/html"?"html":c==="text/csv"||c==="application/vnd.ms-excel"||c==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"?"spreadsheet":c.startsWith("text/")||c==="application/json"||c==="application/xml"?"text":"unsupported":"unsupported"},T=(a,c)=>{let u=rt(a);return u!=="unsupported"?u:Qt(c)},lr=new Set(["image","pdf","text","code","html","spreadsheet","video","audio"]),dr=a=>lr.has(rt(a)),ur={"image/jpeg":"jpg","image/png":"png","image/gif":"gif","image/webp":"webp","image/bmp":"bmp","image/svg+xml":"svg","application/pdf":"pdf","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/vnd.ms-excel":"xls","text/csv":"csv","text/plain":"txt","application/json":"json","text/xml":"xml","application/xml":"xml","text/html":"html","video/mp4":"mp4","video/webm":"webm","audio/mpeg":"mp3","audio/wav":"wav"},mr=(a,c)=>{let u=(a??"").trim()||"\uCCA8\uBD80\uD30C\uC77C";if(/\.[a-z0-9]+$/i.test(u))return u;let m=(c??"").trim().toLowerCase().split(";")[0],j=ur[m]??"";return j?`${u}.${j}`:u},nt=a=>{let c=a.split(".").pop()?.toLowerCase()||"";return{js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",html:"html",htm:"html",css:"css",scss:"scss",sass:"scss",less:"less",json:"json",xml:"xml",php:"php",py:"python",java:"java",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",go:"go",rs:"rust",rb:"ruby",swift:"swift",kt:"kotlin",scala:"scala",sql:"sql",sh:"shell",bash:"shell",bat:"bat",ps1:"powershell",yml:"yaml",yaml:"yaml",toml:"toml",ini:"ini",conf:"ini",md:"markdown",markdown:"markdown",txt:"plaintext",log:"plaintext",csv:"plaintext"}[c]||"plaintext"};var pr=a=>(a||"").replace(/[\\/:*?"<>|\r\n]/g,"_").trim()||"download",it=(a,c)=>{let u=URL.createObjectURL(a),m=document.createElement("a");m.href=u,m.download=pr(c),m.rel="noopener",document.body.appendChild(m),m.click(),m.remove(),window.setTimeout(()=>URL.revokeObjectURL(u),6e4)};var Jt=async a=>{let c=URL.createObjectURL(a);try{let u=await new Promise((U,Q)=>{let D=new Image;D.onload=()=>U(D),D.onerror=()=>Q(new Error("\uC774\uBBF8\uC9C0\uB97C \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")),D.src=c}),m=document.createElement("canvas");m.width=u.naturalWidth||u.width||1024,m.height=u.naturalHeight||u.height||1024;let j=m.getContext("2d");if(!j)throw new Error("\uCE94\uBC84\uC2A4\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");return j.drawImage(u,0,0,m.width,m.height),await new Promise((U,Q)=>{m.toBlob(D=>D?U(D):Q(new Error("PNG \uBCC0\uD658 \uC2E4\uD328")),"image/png")})}finally{URL.revokeObjectURL(c)}};import{useMediaQuery as hr,useTheme as fr}from"@mui/material";function eo(){let a=fr();return!hr(a.breakpoints.up("lg"))}import{jsx as ne,jsxs as to}from"react/jsx-runtime";function ie(a){return to("svg",{id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 501.551 501.551",xmlSpace:"preserve",width:a.width||"22px",...a,children:[ne("path",{style:{fill:"#F2F2F2"},d:"M480.653,0H20.898C9.404,0,0,9.404,0,20.898v459.755c0,11.494,9.404,20.898,20.898,20.898h459.755 c11.494,0,20.898-9.404,20.898-20.898V20.898C501.551,9.404,492.147,0,480.653,0z"}),ne("rect",{x:36.571,y:36.571,style:{fill:"#84DBFF"},width:428.408,height:345.861}),ne("path",{style:{fill:"#334A5E"},d:"M261.224,382.433H36.571v-87.771c17.763-5.224,37.616-7.314,57.469-7.314 c25.078,0,50.155,4.18,71.053,12.539c6.269,2.09,11.494,4.18,16.718,7.314C218.384,323.918,246.596,350.041,261.224,382.433z"}),ne("path",{style:{fill:"#40596B"},d:"M464.98,271.673v110.759H127.478c9.404-29.257,29.257-55.38,55.38-76.278 c42.841-34.482,103.445-55.38,172.408-55.38C393.927,250.776,432.588,258.09,464.98,271.673z"}),to("g",{children:[ne("circle",{style:{fill:"#FFFFFF"},cx:122.253,cy:122.253,r:42.841}),ne("path",{style:{fill:"#FFFFFF"},d:"M433.633,101.355c1.045-3.135,1.045-6.269,1.045-9.404c0-16.718-13.584-31.347-31.347-31.347 c-11.494,0-21.943,6.269-27.167,15.673c-3.135-2.09-7.314-2.09-11.494-2.09c-14.629,0-26.122,10.449-28.212,24.033 c-8.359,2.09-14.629,9.404-14.629,17.763c0,10.449,8.359,18.808,18.808,18.808h82.547c10.449,0,18.808-8.359,18.808-18.808 C441.992,109.714,438.857,104.49,433.633,101.355z"})]})]})}import{jsx as B,jsxs as at}from"react/jsx-runtime";function ae(a){return B("svg",{id:"_x35_",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512",xmlSpace:"preserve",width:a.width||"28px",...a,children:at("g",{children:[B("polygon",{style:{fill:"#B12A27"},points:"475.435,117.825 475.435,512 47.791,512 47.791,0.002 357.613,0.002 412.491,54.881 "}),B("rect",{x:36.565,y:34.295,style:{fill:"#F2F2F2"},width:205.097,height:91.768}),at("g",{children:[at("g",{children:[B("path",{style:{fill:"#B12A27"},d:"M110.132,64.379c-0.905-2.186-2.111-4.146-3.769-5.804c-1.658-1.658-3.694-3.015-6.031-3.92 c-2.412-0.98-5.126-1.432-8.141-1.432H69.651v58.195h11.383V89.481h11.157c3.015,0,5.729-0.452,8.141-1.432 c2.337-0.905,4.372-2.261,6.031-3.92c1.659-1.658,2.865-3.543,3.769-5.804c0.829-2.186,1.282-4.523,1.282-6.935 C111.413,68.902,110.961,66.565,110.132,64.379z M97.844,77.118c-1.508,1.432-3.618,2.186-6.181,2.186H81.034V63.323h10.629 c2.563,0,4.674,0.754,6.181,2.261c1.432,1.432,2.186,3.392,2.186,5.804C100.031,73.726,99.277,75.686,97.844,77.118z"}),B("path",{style:{fill:"#B12A27"},d:"M164.558,75.761c-0.075-2.035-0.151-3.844-0.377-5.503c-0.226-1.659-0.603-3.166-1.131-4.598 c-0.528-1.357-1.206-2.714-2.111-3.92c-2.035-2.94-4.523-5.126-7.312-6.483c-2.865-1.357-6.257-2.035-10.252-2.035h-20.956 v58.195h20.956c3.995,0,7.387-0.678,10.252-2.035c2.789-1.357,5.277-3.543,7.312-6.483c0.905-1.206,1.583-2.563,2.111-3.92 c0.528-1.432,0.905-2.94,1.131-4.598c0.226-1.658,0.301-3.468,0.377-5.503c0.075-1.96,0.075-4.146,0.075-6.558 C164.633,79.908,164.633,77.721,164.558,75.761z M153.175,88.2c0,1.734-0.151,3.091-0.302,4.297 c-0.151,1.131-0.377,2.186-0.678,2.94c-0.301,0.829-0.754,1.583-1.281,2.261c-1.885,2.412-4.749,3.543-8.518,3.543h-8.669V63.323 h8.669c3.769,0,6.634,1.206,8.518,3.618c0.528,0.678,0.98,1.357,1.281,2.186s0.528,1.809,0.678,3.015 c0.151,1.131,0.302,2.563,0.302,4.221c0.075,1.659,0.075,3.694,0.075,5.955C153.251,84.581,153.251,86.541,153.175,88.2z"}),B("path",{style:{fill:"#B12A27"},d:"M213.18,63.323V53.222h-38.37v58.195h11.383V87.823h22.992V77.646h-22.992V63.323H213.18z"})]}),B("g",{children:B("path",{style:{fill:"#B12A27"},d:"M110.132,64.379c-0.905-2.186-2.111-4.146-3.769-5.804c-1.658-1.658-3.694-3.015-6.031-3.92 c-2.412-0.98-5.126-1.432-8.141-1.432H69.651v58.195h11.383V89.481h11.157c3.015,0,5.729-0.452,8.141-1.432 c2.337-0.905,4.372-2.261,6.031-3.92c1.659-1.658,2.865-3.543,3.769-5.804c0.829-2.186,1.282-4.523,1.282-6.935 C111.413,68.902,110.961,66.565,110.132,64.379z M97.844,77.118c-1.508,1.432-3.618,2.186-6.181,2.186H81.034V63.323h10.629 c2.563,0,4.674,0.754,6.181,2.261c1.432,1.432,2.186,3.392,2.186,5.804C100.031,73.726,99.277,75.686,97.844,77.118z"})})]}),B("polygon",{style:{opacity:.08,fill:"#040000"},points:"475.435,117.825 475.435,512 47.791,512 47.791,419.581 247.705,219.667 259.54,207.832 266.098,201.273 277.029,190.343 289.995,177.377 412.491,54.881 "}),B("polygon",{style:{fill:"#771B1B"},points:"475.435,117.836 357.599,117.836 357.599,0 "}),B("g",{children:B("path",{style:{fill:"#F2F2F2"},d:"M414.376,370.658c-2.488-4.372-5.88-8.518-10.101-12.287c-3.467-3.166-7.538-6.106-12.137-8.82 c-18.544-10.93-45.003-16.207-80.961-16.207h-3.618c-1.96-1.809-3.995-3.618-6.106-5.503 c-13.644-12.287-24.499-25.63-32.942-40.48c16.584-36.561,24.499-69.126,23.519-96.867c-0.151-4.674-0.829-9.046-2.035-13.117 c-1.809-6.558-4.824-12.363-9.046-17.112c-0.075-0.075-0.075-0.075-0.151-0.151c-6.709-7.538-16.056-11.835-25.555-11.835 c-9.574,0-18.393,4.146-24.801,11.76c-6.332,7.538-9.724,17.866-9.875,30.002c-0.226,18.544,1.281,36.108,4.448,52.315 c0.301,1.282,0.528,2.563,0.829,3.844c3.166,14.7,7.84,28.645,13.87,41.611c-7.086,14.398-14.247,26.836-19.223,35.279 c-3.769,6.408-7.915,13.117-12.212,19.826c-19.373,3.468-35.807,7.689-50.129,12.966c-19.373,7.011-34.902,16.056-46.059,26.836 c-7.237,6.935-12.137,14.323-14.549,22.012c-2.563,7.915-2.412,15.83,0.452,22.916c2.638,6.558,7.387,12.061,13.72,15.83 c1.508,0.905,3.091,1.658,4.749,2.337c4.825,1.96,10.101,3.015,15.604,3.015c12.74,0,25.856-5.503,36.937-15.378 c20.655-18.469,41.988-48.169,54.577-66.94c10.327-1.583,21.559-2.94,34.224-4.297c14.926-1.508,28.118-2.412,40.104-2.865 c3.694,3.317,7.237,6.483,10.629,9.498c18.846,16.81,33.168,28.947,46.134,37.465c0,0.075,0.075,0.075,0.151,0.075 c5.126,3.392,10.026,6.181,14.926,8.443c5.503,2.563,11.081,3.92,16.81,3.92c7.237,0,14.021-2.186,19.675-6.181 c5.729-4.146,9.875-10.101,11.76-16.81C420.18,387.694,418.899,378.724,414.376,370.658z M247.705,219.667 c-1.055-9.348-1.508-19.072-1.357-29.324c0.151-9.724,3.694-16.283,8.895-16.283c3.92,0,8.066,3.543,9.95,10.327 c0.528,2.035,0.905,4.372,0.98,7.01c0.151,3.166,0.075,6.483-0.075,9.875c-0.452,9.574-2.111,19.75-4.975,30.681 c-1.734,7.011-3.995,14.323-6.784,21.936C251.173,243.186,248.911,231.803,247.705,219.667z M121.967,418.073 c-1.282-3.166,0.151-9.272,7.991-16.81c11.986-11.458,30.756-20.504,56.914-27.364c-4.975,6.784-9.875,12.966-14.624,18.619 c-7.237,8.744-14.172,16.132-20.429,21.71c-5.352,4.824-11.232,7.84-16.81,8.594c-0.98,0.151-1.96,0.226-2.94,0.226 C127.168,423.049,123.173,421.089,121.967,418.073z M242.428,337.942l0.528-0.829l-0.829,0.151 c0.151-0.377,0.377-0.754,0.603-1.055c3.166-5.352,7.161-12.212,11.458-20.127l0.377,0.829l0.98-2.035 c3.166,4.523,6.634,8.971,10.252,13.267c1.734,2.035,3.543,3.995,5.352,5.955l-1.206,0.075l1.055,0.98 c-3.091,0.226-6.332,0.528-9.574,0.829c-2.035,0.226-4.146,0.377-6.257,0.603C250.796,337.037,246.499,337.49,242.428,337.942z M369.297,384.98c-8.971-5.729-18.996-13.795-31.359-24.575c17.564,1.809,31.359,5.654,41.159,11.383 c4.297,2.488,7.538,5.051,9.724,7.538c3.618,3.844,4.9,7.312,4.221,9.649c-0.603,2.337-3.241,3.92-6.483,3.92 c-1.885,0-3.844-0.452-5.88-1.432c-3.468-1.658-7.086-3.694-10.93-6.181C369.598,385.282,369.448,385.131,369.297,384.98z"})})]})})}import{Fragment as Re,jsx as r,jsxs as g}from"react/jsx-runtime";var Yr="/pdfjs",lo=32,uo=240,jr=8192,lt=.25,dt=8,ut=80,mo=80,Or=a=>{switch(a){case"image":return r(ie,{});case"pdf":return r(ae,{});case"text":return r(Dr,{sx:{mr:1,color:"#66BB6A"}});case"spreadsheet":return r(Xr,{sx:{mr:1,color:"#4CAF50"}});case"html":return r(no,{sx:{mr:1,color:"#E91E63"}});case"code":return r(no,{sx:{mr:1,color:"#2196F3"}});case"video":return r(zr,{sx:{mr:1,color:"#AB47BC"}});case"audio":return r(Hr,{sx:{mr:1,color:"#FF7043"}});case"office":return r(Vr,{sx:{mr:1,color:"#FFA726"}});default:return r(Ar,{sx:{mr:1,color:"#78909C"}})}},po=a=>typeof a?.rotate=="number"?a.rotate:typeof a?._pageInfo?.rotate=="number"?a._pageInfo.rotate:0,ho=({open:a,onClose:c,file:u,files:m=null,initialIndex:j=0,loadFile:U,onDownload:Q,onShare:D,pdfAssetBase:J=Yr})=>{let y=eo(),xo=Tr(),$=Cr(xo.breakpoints.down("sm")),v=oo(()=>m&&m.length>0?m:[],[m]),[ee,W]=h(0);R(()=>{a&&W(v.length>0?Math.min(Math.max(j,0),v.length-1):0)},[a,j,v]);let l=v.length>0?v[ee]??u:u,[De,ze]=h(!0),[yo,mt]=h(!1),[C,He]=h(""),[I,A]=h(1),[O,se]=h(0),[pt,he]=h(""),[M,ht]=h(""),[ft,fe]=h(""),[ce,ge]=h(14),[Ve,xe]=h(""),[Ae,gt]=h("preview"),[Xe,le]=h([]),[xt,yt]=h([]),[bo,We]=h(""),[_e,bt]=h(null),[vt,ye]=h(!1),[vo,Ye]=h(!0),[wt,be]=h(""),[E,Mt]=h(),[F,G]=h(1),[wo,je]=h(!1),[ve,Ct]=h("portrait"),[Mo,Tt]=h(0),[Oe,It]=h(0),[de,kt]=h({width:0,height:0}),Lt=x([]),Ne=x(null),K=x(null),Ue=x(null),$e=x(null),Co=w(e=>{if(Ue.current?.disconnect(),$e.current?.(),$e.current=null,K.current=e,!e){Ue.current=null;return}let t=i=>{i.touches.length>=2&&i.preventDefault()};e.addEventListener("touchmove",t,{passive:!1}),$e.current=()=>e.removeEventListener("touchmove",t);let o=new ResizeObserver(i=>{let s=i[0]?.contentRect;s&&kt({width:s.width,height:s.height})});o.observe(e),Ue.current=o;let n=e.getBoundingClientRect();kt({width:n.width,height:n.height})},[]),[we,Et]=h(!1),[Ge,To]=h({x:0,y:0}),[Ke,Io]=h({x:0,y:0}),ko=w(async(e,t)=>{let o=URL.createObjectURL(e);He(o),ht(e.type||"");let n=T(t,e.type||"");if(n==="text"||n==="code"){let s=await e.text();fe(s);return}if(n==="html"){let s=await e.text();xe(s);return}if(n!=="spreadsheet")return;let i=t.split(".").pop()?.toLowerCase()||"";if(i==="csv"){let p=(await e.text()).split(`
|
|
2
|
+
`).map(f=>f.split(",").map(H=>({value:H.trim()})));le(p);return}if(i==="xls"||i==="xlsx"){ye(!0),Ye(!0);let s=await e.arrayBuffer(),p=pe.read(s,{type:"array"});yt(p.SheetNames),bt(p);let f=p.SheetNames[0];We(f),et(p,f)}},[]),ue=x(null),qe=w(async e=>{if(e.blob)return e.blob;if(U)return await U(e);if(e.url){let t=await fetch(e.url);if(!t.ok)throw new Error("\uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");return await t.blob()}throw new Error("\uD30C\uC77C \uB370\uC774\uD130 \uC18C\uC2A4(blob/url/loadFile)\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.")},[U]);R(()=>(l&&a?Ro():(C&&URL.revokeObjectURL(C),ue.current=null,He(""),fe(""),xe(""),le([]),ge(14),A(1),se(0)),()=>{C&&URL.revokeObjectURL(C)}),[l,a]);let Lo=({numPages:e})=>{Mt(e),G(1),Ee.current=!0},Eo=e=>{let{width:t,height:o}=Fo(e);Tt(po(e)),t>0&&o>0&&It(t/o);let n=t>o?"landscape":"portrait";Ct(n)},Fo=e=>{let t=e?.width||0,o=e?.height||0,n=po(e);try{if(typeof e?.getViewport=="function"){let i=e.getViewport({scale:1,rotation:n});t=i.width,o=i.height}}catch(i){console.warn("[FileViewer] getViewport \uC2E4\uD328 - \uAE30\uBCF8 width/height\uB85C \uB300\uCCB4",i)}return{width:t,height:o}},Me=w(()=>{G(e=>Math.max(e-1,1))},[]),Ce=w(()=>{G(e=>Math.min(e+1,E||1))},[E]),Ft=oo(()=>({cMapUrl:`${J}/cmaps/`,cMapPacked:!0,standardFontDataUrl:`${J}/standard_fonts/`,wasmUrl:`${J}/wasm/`}),[J]);R(()=>{typeof window>"u"||(Wr.GlobalWorkerOptions.workerSrc=`${J}/pdf.worker.min.mjs`)},[J]),R(()=>{if(!a||v.length<=1||T(l?.name||"",M)==="pdf")return;let e=t=>{t.key==="ArrowLeft"?(t.preventDefault(),W(o=>Math.max(o-1,0))):t.key==="ArrowRight"&&(t.preventDefault(),W(o=>Math.min(o+1,v.length-1)))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a,v.length,l?.name,M]),R(()=>{if(!a||v.length<=1||T(l?.name||"",M)==="pdf"||I>1)return;let e=0,t=0,o=i=>{e=i.touches[0]?.clientX??0,t=i.touches[0]?.clientY??0},n=i=>{let s=(i.changedTouches[0]?.clientX??0)-e,p=(i.changedTouches[0]?.clientY??0)-t;Math.abs(s)<60||Math.abs(p)>Math.abs(s)||(s<0?W(f=>Math.min(f+1,v.length-1)):W(f=>Math.max(f-1,0)))};return document.addEventListener("touchstart",o,{passive:!0}),document.addEventListener("touchend",n,{passive:!0}),()=>{document.removeEventListener("touchstart",o),document.removeEventListener("touchend",n)}},[a,v.length,l?.name,M,I]),R(()=>{if(!a||T(l?.name||"",M)!=="pdf")return;let e=o=>{switch(o.key){case"ArrowLeft":case"ArrowUp":o.preventDefault(),Me();break;case"ArrowRight":case"ArrowDown":o.preventDefault(),Ce();break;case"Home":o.preventDefault(),G(1);break;case"End":o.preventDefault(),E&&G(E);break}},t=o=>{o.ctrlKey||Math.abs(o.deltaY)>50&&(o.preventDefault(),o.deltaY>0?Ce():Me())};return document.addEventListener("keydown",e),document.addEventListener("wheel",t,{passive:!1}),()=>{document.removeEventListener("keydown",e),document.removeEventListener("wheel",t)}},[a,l,M,Me,Ce,E]),R(()=>{if(!E||!a||T(l?.name||"",M)!=="pdf")return;if(F===1&&Ne.current){Ne.current.scrollTo({top:0,behavior:"smooth"});return}let e=Lt.current[F-1];e&&e.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},[a,l,M,E,F]),R(()=>{if(De){let e=window.setTimeout(()=>mt(!0),180);return()=>window.clearTimeout(e)}},[De]);let Ro=async()=>{if(l){ze(!0),he(""),ht(""),fe(""),xe(""),le([]);try{let e=await qe(l);ue.current=e,await ko(e,l.name)}catch(e){console.error("\uD30C\uC77C \uB85C\uB4DC \uC624\uB958:",e),he("\uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")}finally{ze(!1)}}},Po=async()=>{if(l)try{if(Q){await Q(l);return}let e=ue.current??await qe(l);it(e,l.name)}catch(e){console.error("\uD30C\uC77C \uB2E4\uC6B4\uB85C\uB4DC \uC624\uB958:",e)}},So=typeof navigator<"u"&&typeof navigator.share=="function"&&typeof navigator.canShare=="function",Bo=!!D||So,Do=async()=>{if(l)try{if(D){await D(l);return}let e=ue.current??await qe(l),t=e.type||(typeof l.mimeType=="string"?l.mimeType:"")||"application/octet-stream",o=new File([e],l.name,{type:t});navigator.canShare({files:[o]})?await navigator.share({files:[o],title:l.name}):console.warn("\uC774 \uAE30\uAE30\uB294 \uC774 \uD30C\uC77C \uD615\uC2DD\uC758 \uACF5\uC720\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.")}catch(e){if(e?.name==="AbortError")return;console.error("\uD30C\uC77C \uACF5\uC720 \uC624\uB958:",e)}},zo=()=>{let e=l?T(l.name,M):"";e==="text"||e==="html"||e==="code"||e==="spreadsheet"?ge(t=>Math.min(t+2,24)):A(e==="pdf"?t=>Math.min(t+.25,dt):t=>Math.min(t+.25,3))},Ho=()=>{let e=l?T(l.name,M):"";e==="text"||e==="html"||e==="code"||e==="spreadsheet"?ge(t=>Math.max(t-2,10)):A(e==="pdf"?t=>Math.max(t-.25,lt):t=>Math.max(t-.25,.25))},b=x(new Map),Vo=e=>Math.min(Math.max(e,.25),3),Ao=e=>Math.min(Math.max(e,lt),dt),Ze=x(null),Te=x(null),_=x({scale:1,tx:0,ty:0,rotation:0}),N=x(0),te=x(null),Ie=x(null),ke=w((e,t,o,n)=>{let i=Ze.current,s=Te.current;if(!i||!s)return{tx:t,ty:o};let p=s.offsetWidth,f=s.offsetHeight,H=(Math.round(n/90)%4+4)%4;if(H===1||H===3){let cr=p;p=f,f=cr}let X=p*e,Kt=f*e,qt=X>i.clientWidth?(X+i.clientWidth)/2-mo:0,Zt=Kt>i.clientHeight?(Kt+i.clientHeight)/2-mo:0;return{tx:Math.min(qt,Math.max(-qt,t)),ty:Math.min(Zt,Math.max(-Zt,o))}},[]),Rt=w((e,t)=>{let o=Ze.current,n=Te.current;if(!o||!n)return e>1;let i=(Math.round(t/90)%4+4)%4,s=i===1||i===3,p=s?n.offsetHeight:n.offsetWidth,f=s?n.offsetWidth:n.offsetHeight;return p*e>o.clientWidth+1||f*e>o.clientHeight+1},[]),q=w(e=>{let t=Te.current;if(!t)return;let{scale:o,tx:n,ty:i,rotation:s}=_.current;t.style.transition=e?"transform 0.25s ease":"none",t.style.transform=`translate(${n}px, ${i}px) scale(${o}) rotate(${s}deg)`},[]),Pt=w(()=>{let e=_.current,t=ke(e.scale,e.tx,e.ty,e.rotation);e.tx=t.tx,e.ty=t.ty,!N.current&&(N.current=requestAnimationFrame(()=>{N.current=0,q(!1)}))},[q,ke]),St=w(()=>{N.current&&(cancelAnimationFrame(N.current),N.current=0),b.current.clear(),te.current=null,Ie.current=null},[]),Xo=w(e=>{Te.current=e,e&&(_.current={scale:1,tx:0,ty:0,rotation:0},q(!1))},[q]);R(()=>{if(T(l?.name||"",M)!=="image")return;let e=_.current;e.scale=I,e.rotation=O;let t=ke(e.scale,e.tx,e.ty,e.rotation);e.tx=t.tx,e.ty=t.ty,q(!0)},[I,O,l,M,C,q,ke]),R(()=>()=>{N.current&&cancelAnimationFrame(N.current)},[]);let Wo=e=>{e.currentTarget.setPointerCapture?.(e.pointerId),b.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=[...b.current.values()],o=_.current;if(t.length===2){te.current=null;let n=e.currentTarget.getBoundingClientRect();Ie.current={startDist:Math.hypot(t[0].x-t[1].x,t[0].y-t[1].y)||1,baseScale:o.scale,baseTx:o.tx,baseTy:o.ty,startMidX:(t[0].x+t[1].x)/2,startMidY:(t[0].y+t[1].y)/2,centerX:n.left+n.width/2,centerY:n.top+n.height/2}}else t.length===1&&Rt(o.scale,o.rotation)&&(te.current={startX:e.clientX,startY:e.clientY,baseTx:o.tx,baseTy:o.ty})},_o=e=>{if(!b.current.has(e.pointerId))return;b.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=_.current,o=Ie.current,n=[...b.current.values()];if(o&&n.length>=2){let s=Math.hypot(n[0].x-n[1].x,n[0].y-n[1].y),p=(n[0].x+n[1].x)/2,f=(n[0].y+n[1].y)/2,H=Vo(o.baseScale*s/o.startDist),X=H/o.baseScale;t.scale=H,t.tx=p-o.centerX-X*(o.startMidX-o.centerX-o.baseTx),t.ty=f-o.centerY-X*(o.startMidY-o.centerY-o.baseTy),Pt();return}let i=te.current;i&&n.length===1&&(t.tx=i.baseTx+(e.clientX-i.startX),t.ty=i.baseTy+(e.clientY-i.startY),Pt())},Bt=e=>{if(!b.current.has(e.pointerId))return;b.current.delete(e.pointerId),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId);let t=_.current;if(b.current.size<2&&(Ie.current=null,Math.abs(t.scale-I)>.001&&A(t.scale)),b.current.size===0)te.current=null;else if(b.current.size===1&&Rt(t.scale,t.rotation)){let o=[...b.current.values()][0];te.current={startX:o.x,startY:o.y,baseTx:t.tx,baseTy:t.ty}}},Dt=w(async()=>{if(C)try{let t=await(await fetch(C)).blob(),o=t.type==="image/png"?t:await Jt(t);await navigator.clipboard.write([new ClipboardItem({"image/png":o})]),be("\uC774\uBBF8\uC9C0\uB97C \uD074\uB9BD\uBCF4\uB4DC\uC5D0 \uBCF5\uC0AC\uD588\uC2B5\uB2C8\uB2E4.")}catch(e){console.error("\uC774\uBBF8\uC9C0 \uBCF5\uC0AC \uC624\uB958:",e),be("\uC774\uBBF8\uC9C0\uB97C \uBCF5\uC0AC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")}},[C]);R(()=>{if(!a||T(l?.name||"",M)!=="image")return;let e=t=>{if(!(t.ctrlKey||t.metaKey)||t.key.toLowerCase()!=="c")return;let o=t.target,n=o?.tagName;n==="INPUT"||n==="TEXTAREA"||o?.isContentEditable||(t.preventDefault(),Dt())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a,l,M,Dt]);let oe=x(null),z=x(0),me=x(null),re=x(null),Z=()=>K.current?.querySelector(".react-pdf__Page")??null,Le=x(null),zt=x(null),Yo=()=>{let e=zt.current,t=Z()?.querySelector("canvas");if(!e||!t||!t.width||!t.height)return!1;let o=document.createElement("canvas");o.width=t.width,o.height=t.height;let n=o.getContext("2d");if(!n)return!1;n.drawImage(t,0,0);let i=t.getBoundingClientRect(),s=e.getBoundingClientRect();return Object.assign(o.style,{position:"absolute",left:`${i.left-s.left}px`,top:`${i.top-s.top}px`,width:`${i.width}px`,height:`${i.height}px`,pointerEvents:"none",zIndex:"1"}),e.appendChild(o),Le.current=o,!0},Ht=()=>{Le.current?.remove(),Le.current=null;let e=Z();e&&(e.style.visibility="")},jo=()=>{z.current||(z.current=requestAnimationFrame(()=>{z.current=0;let e=oe.current,t=Z();!e||!t||(t.style.transition="none",t.style.transformOrigin="top left",t.style.transform=`translate(${e.tx}px, ${e.ty}px) scale(${e.k})`,me.current={k:e.k,tx:e.tx,ty:e.ty,midX:e.lastMidX,midY:e.lastMidY})}))},Vt=()=>{z.current&&(cancelAnimationFrame(z.current),z.current=0),oe.current=null,re.current=null,me.current=null,Ht();let e=Z();e&&(e.style.transform="",e.style.willChange="auto")},At=e=>{let t=Z(),o=K.current;if(!t||!o)return;t.style.transform&&(t.style.transform="");let n=t.getBoundingClientRect(),i=o.getBoundingClientRect(),s=(e[0].x+e[1].x)/2,p=(e[0].y+e[1].y)/2;oe.current={startDist:Math.hypot(e[0].x-e[1].x,e[0].y-e[1].y)||1,rectLeft:n.left,rectTop:n.top,pageW:n.width,pageH:n.height,viewerL:i.left,viewerT:i.top,viewerR:i.right,viewerB:i.bottom,startMidX:s,startMidY:p,lastMidX:s,lastMidY:p,k:1,tx:0,ty:0},me.current={k:1,tx:0,ty:0,midX:s,midY:p},t.style.willChange="transform"},Oo=e=>{if(e.pointerType!=="touch")return;b.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=[...b.current.values()];if(t.length===2){if(re.current||Le.current)return;At(t)}},No=e=>{if(!b.current.has(e.pointerId))return;b.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=oe.current,o=[...b.current.values()];if(t&&o.length>=2){e.preventDefault();let n=Math.hypot(o[0].x-o[1].x,o[0].y-o[1].y),i=Math.min(Math.max(n/t.startDist,lt/(I||1)),dt/(I||1)),s=(o[0].x+o[1].x)/2,p=(o[0].y+o[1].y)/2,f=s-t.rectLeft-i*(t.startMidX-t.rectLeft),H=p-t.rectTop-i*(t.startMidY-t.rectTop),X=ut;f=Math.min(t.viewerR-X-t.rectLeft,Math.max(t.viewerL+X-t.rectLeft-i*t.pageW,f)),H=Math.min(t.viewerB-X-t.rectTop,Math.max(t.viewerT+X-t.rectTop-i*t.pageH,H)),t.k=i,t.tx=f,t.ty=H,t.lastMidX=s,t.lastMidY=p,jo()}},Xt=e=>{if(b.current.delete(e.pointerId),b.current.size>=2)return;let t=oe.current;if(oe.current=null,!t)return;z.current&&(cancelAnimationFrame(z.current),z.current=0);let o=me.current??{k:1,tx:0,ty:0,midX:t.startMidX,midY:t.startMidY};me.current=null;let n=Ao(I*o.k);if(Math.abs(n-I)<.001){let s=K.current;Vt(),s&&(s.scrollLeft-=o.tx,s.scrollTop-=o.ty);return}let i=K.current;if(i){let s=i.getBoundingClientRect();re.current={u:(o.midX-t.rectLeft-o.tx)/o.k,v:(o.midY-t.rectTop-o.ty)/o.k,offX:o.midX-s.left,offY:o.midY-s.top,factor:n/(I||1)}}if(Yo()){let s=Z();s&&(s.style.transform="",s.style.visibility="hidden")}A(n),Math.round(Math.min(tt*n,Ut))===ot&&requestAnimationFrame(()=>_t())},Ee=x(!0),Qe=x(null),Wt=()=>{let e=K.current;e&&(e.scrollLeft=(e.scrollWidth-e.clientWidth)/2,e.scrollTop=(e.scrollHeight-e.clientHeight)/2)},_t=()=>{let e=re.current;if(!e)return;re.current=null;let t=K.current,o=Z();if(!t||!o)return;Ht(),o.style.transform="",o.style.willChange="auto";let n=o.getBoundingClientRect(),i=t.getBoundingClientRect();t.scrollLeft+=n.left-i.left+e.u*e.factor-e.offX,t.scrollTop+=n.top-i.top+e.v*e.factor-e.offY;let s=[...b.current.values()];s.length>=2&&At(s)},Yt=()=>{let e=`${F}:${O}`;if(re.current){Qe.current=e,_t();return}(Ee.current||Qe.current!==e)&&(Ee.current=!1,Qe.current=e,Wt())};R(()=>()=>{z.current&&cancelAnimationFrame(z.current)},[]);let Uo=()=>{se(e=>e-90)},$o=()=>{se(e=>e+90)},Go=()=>{let e=T(l?.name||"",M);Vt(),e==="text"||e==="html"||e==="code"||e==="spreadsheet"?ge(14):e==="pdf"?(A(1),I===1&&O===0?Wt():Ee.current=!0):(St(),_.current={scale:1,tx:0,ty:0,rotation:0},q(!0),A(1)),se(0)},jt=(e,t)=>{Et(!0),To({x:e.clientX,y:e.clientY}),Io({x:t.scrollLeft,y:t.scrollTop}),e.preventDefault()},Ot=w((e,t)=>{if(!we)return;let o=e.clientX-Ge.x,n=e.clientY-Ge.y;t.scrollLeft=Ke.x-o,t.scrollTop=Ke.y-n,e.preventDefault()},[we,Ge,Ke]),Je=w(()=>{Et(!1),document.body.style.cursor="default"},[]);R(()=>{if(we){let e=t=>{document.querySelectorAll(".draggable-scroll").forEach(n=>{Ot(t,n)})};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",Je),document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",Je),document.body.style.userSelect="",document.body.style.webkitUserSelect=""}}},[we,Ot,Je]);let Ko=w(()=>{ze(!1),mt(!1)},[]),et=w(async(e,t)=>{ye(!0),Ye(!0);try{await new Promise(p=>setTimeout(p,500));let o=e.Sheets[t],n=pe.utils.decode_range(o["!ref"]||"A1");console.debug("Excel range:",n);let s=pe.utils.sheet_to_json(o,{header:1,range:n,defval:""}).map(p=>p.map(f=>({value:f!=null?String(f):""})));le(s),await new Promise(p=>setTimeout(p,200))}catch(o){console.error("\uC6CC\uD06C\uC2DC\uD2B8 \uB85C\uB4DC \uC624\uB958:",o)}finally{Ye(!1)}},[]),qo=w(()=>{ye(!1)},[]),Zo=w(e=>{_e&&(We(e),et(_e,e))},[_e,et]),Nt=()=>{St(),_.current={scale:1,tx:0,ty:0,rotation:0},be(""),C&&URL.revokeObjectURL(C),ue.current=null,He(""),fe(""),xe(""),le([]),yt([]),We(""),bt(null),ye(!1),A(1),se(0),he(""),Mt(void 0),G(1),Ct("portrait"),Tt(0),It(0),c()};if(!l)return null;let k=T(l.name,M),Qo=((Mo+O)%360+360)%360,Fe=O%180===0?Oe:Oe>0?1/Oe:0,Jo=Math.max(de.width-lo,uo),er=Math.max(de.height-lo,uo),tt=de.width>0&&Fe>0?Math.min(Jo,er*Fe):ve==="portrait"?600:800,tr=typeof window<"u"&&window.devicePixelRatio||1,Ut=jr/tr*(Fe>0?Math.min(1,Fe):1),ot=Math.round(Math.min(tt*I,Ut)),$t=Math.round(tt*I),or=$t>ot,rr=Math.max(16,Math.round(de.width)-ut),nr=Math.max(16,Math.round(de.height)-ut),ir=ve==="landscape"?"200px":"150px",ar=ve==="landscape"?.18:.17,Gt=()=>E?r(d,{ref:Ne,sx:{width:ir,height:"100%",backgroundColor:"grey.200",borderRight:"1px solid",borderColor:"grey.300",overflow:"auto",p:2},children:Array.from({length:E},(e,t)=>g(d,{ref:o=>{Lt.current[t]=o},children:[r(d,{sx:{mb:0,p:1,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",border:F===t+1?"2px solid":"1px solid",borderColor:F===t+1?"primary.main":"grey.400",borderRadius:1,overflow:"hidden",backgroundColor:"white","&:hover":{borderColor:"primary.main"},aspectRatio:ve==="landscape"?"4 / 3":"3 / 4"},onClick:()=>{G(t+1),y&&je(!1)},children:r(io,{file:C,options:Ft,loading:r("div",{style:{display:"none"}}),children:r(ao,{pageNumber:t+1,scale:ar,loading:r("div",{style:{display:"none"}}),renderAnnotationLayer:!1,renderTextLayer:!1})})}),r(P,{variant:"caption",sx:{display:"block",textAlign:"center",p:.5,mb:1,color:F===t+1?"primary.main":"",fontWeight:F===t+1?"bold":"normal"},children:t+1})]},t+1))}):null,sr=()=>{let e=T(l?.name||"",M);if(yo&&!(e==="spreadsheet"))return r(d,{sx:{display:"flex",height:"100%",width:"100%",alignItems:"center",justifyContent:"center"},children:r(co,{visible:De,exitDelay:100,onComplete:Ko})});if(pt)return g(d,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column",children:[r(P,{color:"error",variant:"h6",children:pt}),r(P,{color:"text.secondary",variant:"body2",sx:{mt:1},children:"\uD30C\uC77C\uC744 \uB2E4\uC6B4\uB85C\uB4DC\uD558\uC5EC \uD655\uC778\uD574\uC8FC\uC138\uC694."})]});if(!C)return null;switch(e){case"image":return r(d,{ref:Ze,"data-allow-pinch":"true",onPointerDown:Wo,onPointerMove:_o,onPointerUp:Bt,onPointerCancel:Bt,sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,overflow:"hidden",height:"100%",backgroundColor:"grey.100",p:2,touchAction:"none",overscrollBehavior:"contain",userSelect:"none","&:active":{cursor:"grabbing"}},children:r("img",{ref:Xo,src:C,alt:l.name,draggable:!1,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",display:"block",transform:"translate(0px, 0px) scale(1) rotate(0deg)",transformOrigin:"center center",pointerEvents:"none"}})});case"pdf":return g(Re,{children:[g(d,{ref:zt,sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",backgroundColor:"grey.100",position:"relative",overflow:"hidden"},children:[!y&&Gt(),r(d,{ref:Co,className:"draggable-scroll",onMouseDown:o=>{let n=o.currentTarget;jt(o,n)},"data-allow-pinch":"true",onPointerDown:Oo,onPointerMove:No,onPointerUp:Xt,onPointerCancel:Xt,sx:{flex:1,display:"flex",flexDirection:"column",overflow:"auto",height:"100%",py:y?0:2,overflowAnchor:"none",touchAction:"pan-x pan-y","& > .react-pdf__Document":{m:"auto",...y&&{px:`${rr}px`,py:`${nr}px`},...or&&{"& .react-pdf__Page__canvas":{width:`${$t}px !important`,height:"auto !important"}}}},children:r(io,{file:C,onLoadSuccess:Lo,onLoadError:o=>{console.error("PDF \uB85C\uB4DC \uC624\uB958:",o),he("PDF \uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")},loading:r("div",{style:{display:"none"}}),error:g(d,{sx:{textAlign:"center",p:4},children:[r(P,{color:"error",variant:"h6",sx:{mb:2},children:"PDF\uB97C \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."}),r(P,{color:"text.secondary",variant:"body2",children:"\uD30C\uC77C\uC744 \uB2E4\uC6B4\uB85C\uB4DC\uD558\uC5EC \uD655\uC778\uD574\uC8FC\uC138\uC694."})]}),options:Ft,children:r(ao,{pageNumber:F,width:ot,rotate:O===0?void 0:Qo,loading:r("div",{style:{display:"none"}}),renderAnnotationLayer:!1,renderTextLayer:!1,onLoadSuccess:Eo,onRenderSuccess:Yt,onRenderError:Yt})})})]}),y&&r(br,{anchor:"left",open:wo,onClose:()=>je(!1),sx:{zIndex:o=>o.zIndex.modal+2},children:Gt()})]});case"text":case"code":return r(d,{sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",flexDirection:"column"},children:ft?r(d,{sx:{flex:1,height:"100%",overflow:"hidden"},children:r(so,{height:"100%",language:nt(l.name),value:ft,theme:"vs-dark",loading:!1,options:{readOnly:!0,domReadOnly:!0,minimap:{enabled:!0},scrollBeyondLastLine:!1,automaticLayout:!0,folding:!0,foldingHighlight:!1,formatOnPaste:!0,formatOnType:!0,wordWrap:"on",lineNumbers:"on",lineNumbersMinChars:4,glyphMargin:!1,renderLineHighlight:"none",renderWhitespace:"selection",fontFamily:"'Roboto', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace",fontSize:ce,lineHeight:Math.round(ce*1.5),scrollbar:{vertical:"auto",horizontal:"auto"},lineDecorationsWidth:10},onMount:(o,n)=>{o.onDidAttemptReadOnlyEdit(()=>{});let i=o.getDomNode();if(i){let s=document.createElement("style");s.textContent=`
|
|
3
3
|
.monaco-editor .margin-view-overlays {
|
|
4
4
|
border-right: 1px solid #3c3c3c;
|
|
5
5
|
}
|
|
@@ -27,7 +27,7 @@ import{useState as h,useEffect as R,useMemo as rr,useCallback as w,useRef as x}f
|
|
|
27
27
|
.monaco-editor .overlay.cursor-layer {
|
|
28
28
|
padding-left: 15px !important;
|
|
29
29
|
}
|
|
30
|
-
`,i.appendChild(s)}}})}):
|
|
30
|
+
`,i.appendChild(s)}}})}):r(d,{sx:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:r(P,{color:"text.secondary",children:"\uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."})})});case"html":return r(d,{sx:{width:"100%",height:"calc(100vh - 60px)",overflow:"hidden",borderRadius:1},children:Ve?g(d,{sx:{width:"100%",height:"100%",display:"flex",flexDirection:"column"},children:[g(d,{sx:{display:"flex",gap:1,p:1,borderBottom:"1px solid",borderColor:"grey.300",backgroundColor:"grey.50"},children:[r(ro,{variant:Ae==="preview"?"contained":"outlined",size:"small",onClick:()=>gt("preview"),children:"\uBBF8\uB9AC\uBCF4\uAE30"}),r(ro,{variant:Ae==="source"?"contained":"outlined",size:"small",onClick:()=>gt("source"),children:"\uC18C\uC2A4\uCF54\uB4DC"})]}),Ae==="preview"?r(d,{sx:{flex:1,overflow:"auto",backgroundColor:"white",border:"1px solid",borderColor:"grey.300",fontSize:`${ce}px`,p:2},dangerouslySetInnerHTML:{__html:Ve}}):r(d,{sx:{flex:1,height:"100%",overflow:"hidden"},children:r(so,{height:"100%",language:"html",value:Ve,theme:"vs-dark",options:{readOnly:!0,domReadOnly:!0,minimap:{enabled:!0},scrollBeyondLastLine:!1,automaticLayout:!0,folding:!0,foldingHighlight:!1,wordWrap:"on",lineNumbers:"on",lineNumbersMinChars:4,glyphMargin:!1,renderLineHighlight:"none",renderWhitespace:"selection",fontFamily:"'Roboto', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace",fontSize:ce,lineHeight:Math.round(ce*1.5),scrollbar:{vertical:"auto",horizontal:"auto"},lineDecorationsWidth:10},onMount:(o,n)=>{o.onDidAttemptReadOnlyEdit(()=>{});let i=o.getDomNode();if(i){let s=document.createElement("style");s.textContent=`
|
|
31
31
|
.monaco-editor .margin-view-overlays {
|
|
32
32
|
border-right: 1px solid #3c3c3c;
|
|
33
33
|
}
|
|
@@ -55,4 +55,4 @@ import{useState as h,useEffect as R,useMemo as rr,useCallback as w,useRef as x}f
|
|
|
55
55
|
.monaco-editor .overlay.cursor-layer {
|
|
56
56
|
padding-left: 15px !important;
|
|
57
57
|
}
|
|
58
|
-
`,i.appendChild(s)}}})})]}):o(d,{sx:{backgroundColor:"white",p:2,borderRadius:1,border:"1px solid",borderColor:"grey.300",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center"},children:o(P,{color:"text.secondary",children:"HTML \uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."})})});case"video":return o(d,{className:"draggable-scroll",onMouseDown:r=>{let n=r.currentTarget;jt(r,n)},sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,overflow:"auto"},children:o("video",{src:C,controls:!0,style:{maxWidth:"100%",maxHeight:"70vh",transform:`scale(${I}) rotate(${O}deg)`,transition:"transform 0.3s ease",pointerEvents:I>1?"none":"auto"},children:"\uBE0C\uB77C\uC6B0\uC800\uAC00 \uBE44\uB514\uC624\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4."})});case"spreadsheet":return g(d,{sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[Xe.length>0||vt?g(d,{sx:{flex:1,position:"relative",overflow:"scroll",backgroundColor:"white",minHeight:"400px",minWidth:"100%","&::-webkit-scrollbar":{width:"18px",height:"18px"},"&::-webkit-scrollbar-track":{backgroundColor:"#f1f1f1",borderRadius:"10px"},"&::-webkit-scrollbar-thumb":{backgroundColor:"#888",borderRadius:"10px",border:"2px solid #f1f1f1","&:hover":{backgroundColor:"#555"}},"&::-webkit-scrollbar-corner":{backgroundColor:"#f1f1f1"}},children:[Xe.length>0&&o(d,{sx:{minWidth:"max-content",minHeight:"max-content"},children:o(_o,{data:Xe,darkMode:!1})}),vt&&o(d,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255, 255, 255, 0.8)",zIndex:1e3},children:o(cr,{visible:br,exitDelay:200,fadeoutDuration:300,onComplete:Kr})})]}):o(d,{sx:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},children:o(P,{color:"text.secondary",children:"\uC2A4\uD504\uB808\uB4DC\uC2DC\uD2B8 \uB370\uC774\uD130\uB97C \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."})}),xt.length>1&&o(d,{sx:{borderTop:1,borderColor:"divider",backgroundColor:"#e0e0e0",padding:"0 8px 8px 8px"},children:o(vo,{value:yr,onChange:(r,n)=>qr(n),variant:"scrollable",scrollButtons:"auto",sx:{minHeight:"36px","& .MuiTabs-flexContainer":{gap:"6px"},"& .MuiTabs-indicator":{display:"none"},"& .MuiTab-root":{minHeight:"32px",fontSize:"0.875rem",textTransform:"none",padding:"6px 16px",margin:"0",backgroundColor:"white",border:"1px solid #d0d0d0",borderRadius:"0 0 4px 4px",color:"#666",minWidth:"80px",transition:"all 0.2s ease","&:hover":{backgroundColor:"#f8f8f8",color:"#333"},"&.Mui-selected":{backgroundColor:"primary.main",color:"white",border:"1px solid",borderColor:"primary.dark",fontWeight:600,"&:hover":{backgroundColor:"primary.dark"}}}},children:xt.map(r=>o(wo,{label:r,value:r},r))})})]});case"audio":return g(d,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column"},children:[o(P,{variant:"h6",sx:{mb:2},children:l.name}),o("audio",{src:C,controls:!0,style:{width:"100%",maxWidth:"500px"},children:"\uBE0C\uB77C\uC6B0\uC800\uAC00 \uC624\uB514\uC624\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4."})]});default:return g(d,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column",children:[o(P,{variant:"h6",color:"text.secondary",children:"\uBBF8\uB9AC\uBCF4\uAE30\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uD30C\uC77C \uD615\uC2DD\uC785\uB2C8\uB2E4"}),o(P,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"\uD30C\uC77C\uC744 \uB2E4\uC6B4\uB85C\uB4DC\uD558\uC5EC \uD655\uC778\uD574\uC8FC\uC138\uC694."})]})}};return g(go,{open:a,onClose:Nt,maxWidth:"lg",fullScreen:!0,children:[g(xo,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"grey.800",color:"white",height:"60px",boxSizing:"border-box",userSelect:"none",px:b?1:3},onContextMenu:e=>e.preventDefault(),children:[g(d,{sx:{display:"flex",alignItems:"center",gap:$?.35:1,flexShrink:0,"& .MuiSvgIcon-root":{fontSize:b?"1.7rem":void 0}},children:[v.length>1?g(d,{sx:{display:"flex",alignItems:"center",gap:b?0:.5},children:[o(S,{title:"\uC774\uC804 \uD30C\uC77C",children:o("span",{style:{display:"inline-flex"},children:o(L,{onClick:()=>W(e=>Math.max(e-1,0)),disabled:ee<=0,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"}},children:o(st,{})})})}),g(P,{variant:"body2",sx:{color:"grey.300",minWidth:40,textAlign:"center",userSelect:"none"},children:[ee+1," / ",v.length]}),o(S,{title:"\uB2E4\uC74C \uD30C\uC77C",children:o("span",{style:{display:"inline-flex"},children:o(L,{onClick:()=>W(e=>Math.min(e+1,v.length-1)),disabled:ee>=v.length-1,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"}},children:o(ct,{})})})})]}):null,b&&k==="pdf"&&E?o(S,{title:"\uD398\uC774\uC9C0 \uBAA9\uB85D",children:o(L,{onClick:()=>je(e=>!e),size:"medium",sx:{color:"grey.300","&:hover":{color:"white"}},children:o(ko,{})})}):null,k==="pdf"&&E?g(d,{sx:{display:"flex",alignItems:"center",gap:b?0:.5},children:[o(S,{title:"\uC774\uC804 \uD398\uC774\uC9C0",children:o("span",{style:{display:"inline-flex"},children:o(L,{onClick:Me,disabled:F<=1,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"},transition:"all 0.2s ease-in-out"},children:o(st,{})})})}),o(P,{variant:"body2",sx:{minWidth:b?"auto":"80px",textAlign:"center",color:"white",px:b?.5:1,fontSize:b?"1.05rem":void 0,fontWeight:b?600:void 0,whiteSpace:"nowrap"},children:$?F:`${F} / ${E}`}),o(S,{title:"\uB2E4\uC74C \uD398\uC774\uC9C0",children:o("span",{style:{display:"inline-flex"},children:o(L,{onClick:Ce,disabled:F>=E,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"},transition:"all 0.2s ease-in-out"},children:o(ct,{})})})})]}):null]}),o(d,{sx:{display:"flex",alignItems:"center",flexGrow:1,mr:$?0:2,overflow:"hidden"},children:!$&&g(d,{sx:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:1.5,fontSize:"1rem"},children:[Oo(k),l.name]})}),g(d,{className:"toolbar",sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:$?1.25:1,"& .MuiSvgIcon-root":{fontSize:$?"1.45rem":b?"1.7rem":void 0},"& .MuiIconButton-root":$?{p:.75}:{}},children:[(k==="image"||k==="pdf"||k==="text"||k==="html"||k==="code"||k==="spreadsheet")&&g(Re,{children:[!(b&&(k==="image"||k==="pdf"))&&g(Re,{children:[o(S,{title:"\uD655\uB300",children:o(L,{onClick:Br,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:o(Fo,{})})}),o(S,{title:"\uCD95\uC18C",children:o(L,{onClick:zr,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:o(Ro,{})})})]}),(!b||k==="image"||k==="pdf")&&o(S,{title:"\uD654\uBA74\uC5D0 \uB9DE\uCD94\uAE30",children:o(L,{onClick:$r,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:o(Do,{})})}),(k==="image"||k==="pdf")&&g(Re,{children:[o(S,{title:"\uC67C\uCABD\uC73C\uB85C \uD68C\uC804",children:o(L,{onClick:Nr,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:o(Po,{})})}),o(S,{title:"\uC624\uB978\uCABD\uC73C\uB85C \uD68C\uC804",children:o(L,{onClick:Ur,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:o(So,{})})})]})]}),o(S,{title:"\uB2E4\uC6B4\uB85C\uB4DC",children:o(L,{onClick:Rr,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:o(Eo,{})})}),Sr&&o(S,{title:"\uACF5\uC720",children:o(L,{onClick:()=>void Dr(),size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:o(Lo,{})})}),o(S,{title:"\uB2EB\uAE30",children:o(L,{onClick:Nt,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:o(Io,{})})})]})]}),!b&&v.length>1&&ee>0?o(L,{"aria-label":"\uC774\uC804 \uD30C\uC77C",onClick:()=>W(e=>Math.max(e-1,0)),sx:{position:"fixed",left:12,top:"50%",transform:"translateY(-50%)",zIndex:10,color:"white",backgroundColor:"rgba(0, 0, 0, 0.35)","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.55)"},width:44,height:44},children:o(st,{sx:{fontSize:30}})}):null,!b&&v.length>1&&ee<v.length-1?o(L,{"aria-label":"\uB2E4\uC74C \uD30C\uC77C",onClick:()=>W(e=>Math.min(e+1,v.length-1)),sx:{position:"fixed",right:12,top:"50%",transform:"translateY(-50%)",zIndex:10,color:"white",backgroundColor:"rgba(0, 0, 0, 0.35)","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.55)"},width:44,height:44},children:o(ct,{sx:{fontSize:30}})}):null,o(yo,{sx:{p:"0 !important",overflow:"hidden",userSelect:"none"},onContextMenu:e=>e.preventDefault(),children:ao()}),o(Mo,{open:!!wt,autoHideDuration:2e3,onClose:()=>be(""),anchorOrigin:{vertical:"bottom",horizontal:"center"},message:wt,sx:{"& .MuiSnackbarContent-message":{fontSize:"0.95rem"}}})]})},No=pr;import{jsx as hr}from"react/jsx-runtime";function Pe(a){return hr("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 550.801 550.801",width:a.width||"22px",fill:a.fill||"#E91E63",...a,children:hr("path",{d:"M488.426,197.019H475.2v-63.816c0-0.401-0.063-0.799-0.116-1.205c-0.021-2.534-0.827-5.023-2.562-6.992L366.325,3.691 c-0.032-0.031-0.063-0.042-0.085-0.073c-0.633-0.707-1.371-1.298-2.151-1.804c-0.231-0.158-0.464-0.287-0.706-0.422 c-0.676-0.366-1.393-0.675-2.131-0.896c-0.2-0.053-0.38-0.135-0.58-0.19C359.87,0.119,359.037,0,358.193,0H97.2 c-11.918,0-21.6,9.693-21.6,21.601v175.413H62.377c-17.049,0-30.873,13.818-30.873,30.87v160.542 c0,17.044,13.824,30.876,30.873,30.876h13.224V529.2c0,11.907,9.682,21.601,21.6,21.601h356.4c11.907,0,21.6-9.693,21.6-21.601 V419.302h13.226c17.044,0,30.871-13.827,30.871-30.87V227.89C519.297,210.838,505.47,197.019,488.426,197.019z M97.2,21.605 h250.193v110.51c0,5.967,4.841,10.8,10.8,10.8h95.407v54.108H97.2V21.605z M406.467,363.983h-26.104l-1.751-46.464 c-0.527-14.598-1.055-32.236-1.055-49.895h-0.517c-3.691,15.485-8.596,32.782-13.163,47.015l-14.354,47.366h-20.851l-12.625-47.002 c-3.85-14.228-7.889-31.524-10.694-47.374h-0.348c-0.707,16.397-1.234,35.129-2.1,50.253l-2.114,46.111h-24.711l7.535-121.395 h35.575l11.569,40.521c3.691,14.048,7.362,29.183,9.999,43.416h0.521c3.344-14.054,7.356-30.074,11.222-43.585l12.614-40.353 h34.879L406.467,363.983z M174.438,265.642v-23.058h90.77v23.058h-32.239v98.342h-26.821v-98.342H174.438z M89.403,313.195v50.788 H62.604V242.584h26.799v46.654h43.999v-46.654h26.645v121.399h-26.645v-50.794H89.403V313.195z M453.601,523.353H97.2V419.302 h356.4V523.353z M500.787,363.983h-73.786V242.584h26.811v98.339h46.976V363.983z"})})}import{jsx as Y,jsxs as Uo}from"react/jsx-runtime";function Se(a){return Uo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 550.801 550.801",width:a.width||"22px",fill:a.fill||"#B45309",...a,children:[Y("path",{d:"M475.095,131.992c-0.032-2.526-0.833-5.021-2.568-6.993L366.324,3.694c-0.021-0.034-0.053-0.045-0.084-0.076 c-0.633-0.707-1.36-1.29-2.141-1.804c-0.232-0.15-0.465-0.285-0.707-0.422c-0.686-0.366-1.393-0.67-2.131-0.892 c-0.2-0.058-0.379-0.14-0.58-0.192C359.87,0.114,359.047,0,358.203,0H97.2C85.292,0,75.6,9.693,75.6,21.601v507.6 c0,11.913,9.692,21.601,21.6,21.601H453.6c11.918,0,21.601-9.688,21.601-21.601V133.202 C475.2,132.796,475.137,132.398,475.095,131.992z M243.599,523.494H141.75v-15.936l62.398-89.797v-0.785h-56.565v-24.484h95.051 v17.106l-61.038,88.636v0.771h62.002V523.494z M292.021,523.494h-29.744V392.492h29.744V523.494z M399.705,463.44 c-10.104,9.524-25.069,13.796-42.566,13.796c-3.893,0-7.383-0.19-10.104-0.58v46.849h-29.352V394.242 c9.134-1.561,21.958-2.721,40.036-2.721c18.277,0,31.292,3.491,40.046,10.494c8.354,6.607,13.996,17.486,13.996,30.322 C411.761,445.163,407.479,456.053,399.705,463.44z M97.2,366.752V21.601h129.167v-3.396h32.756v3.396h88.28v110.515 c0,5.961,4.831,10.8,10.8,10.8H453.6l0.011,223.836H97.2z"}),Y("path",{d:"M359.279,413.87c-6.033,0-10.114,0.586-12.245,1.171v38.676c2.521,0.585,5.632,0.785,9.914,0.785 c15.736,0,25.46-7.979,25.46-21.378C382.408,421.063,374.045,413.87,359.279,413.87z"}),Y("rect",{x:"259.124",y:"39.918",width:"32.756",height:"13.516"}),Y("rect",{x:"226.368",y:"21.601",width:"32.756",height:"10.125"}),Y("rect",{x:"226.368",y:"60.146",width:"32.756",height:"13.516"}),Y("rect",{x:"259.124",y:"82.274",width:"32.756",height:"13.518"}),Y("rect",{x:"259.124",y:"124.983",width:"32.756",height:"13.516"}),Y("rect",{x:"226.368",y:"103.275",width:"32.756",height:"13.516"}),Y("path",{d:"M259.124,149.537c-23.193,0-34.225,18.792-34.225,41.99l-7.765,70.348c0,23.198,18.792,42.003,41.984,42.003 c23.19,0,41.974-18.805,41.974-42.003l-7.741-70.348C293.361,168.334,282.318,149.537,259.124,149.537z M273.04,285.431h-27.799 v-58.728h27.799V285.431z"})]})}import $o from"@mui/icons-material/TextSnippet";import Go from"@mui/icons-material/VideoFile";import Ko from"@mui/icons-material/AudioFile";import qo from"@mui/icons-material/Description";import Zo from"@mui/icons-material/InsertDriveFile";import Qo from"@mui/icons-material/Code";import Jo from"@mui/icons-material/TableView";import{jsx as V}from"react/jsx-runtime";function De(a,c=22){let u=`${c}px`,m={fontSize:c};switch(a){case"image":return V(ie,{width:u,height:u});case"pdf":return V(ae,{width:u,height:u});case"html":return V(Pe,{width:u,height:u});case"archive":return V(Se,{width:u,height:u});case"text":return V($o,{sx:{...m,color:"#66BB6A"}});case"spreadsheet":return V(Jo,{sx:{...m,color:"#4CAF50"}});case"code":return V(Qo,{sx:{...m,color:"#2196F3"}});case"video":return V(Go,{sx:{...m,color:"#AB47BC"}});case"audio":return V(Ko,{sx:{...m,color:"#FF7043"}});case"office":return V(qo,{sx:{...m,color:"#FFA726"}});default:return V(Zo,{sx:{...m,color:"#78909C"}})}}var en=new Set(["zip","rar","7z","gz","tgz","tar","bz2","xz","alz","egg"]);function fr({fileName:a,mime:c,size:u=22}){let m=a.includes(".")?a.slice(a.lastIndexOf(".")+1).toLowerCase():"";return en.has(m)?De("archive",u):De(T(a,c??""),u)}export{fr as FileTypeIcon,pr as FileViewer,No as FileViewerDefault,Pe as HtmlIcon,ie as ImageIcon,ae as PdfIcon,Se as ZipIcon,mo as ensureFileExtension,nt as getEditorLanguage,ot as getFileType,Qt as getFileTypeFromMime,De as getFileTypeIcon,lo as isFileViewerPreviewable,T as resolveFileType,it as saveBlobAsFile};
|
|
58
|
+
`,i.appendChild(s)}}})})]}):r(d,{sx:{backgroundColor:"white",p:2,borderRadius:1,border:"1px solid",borderColor:"grey.300",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center"},children:r(P,{color:"text.secondary",children:"HTML \uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."})})});case"video":return r(d,{className:"draggable-scroll",onMouseDown:o=>{let n=o.currentTarget;jt(o,n)},sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,overflow:"auto"},children:r("video",{src:C,controls:!0,style:{maxWidth:"100%",maxHeight:"70vh",transform:`scale(${I}) rotate(${O}deg)`,transition:"transform 0.3s ease",pointerEvents:I>1?"none":"auto"},children:"\uBE0C\uB77C\uC6B0\uC800\uAC00 \uBE44\uB514\uC624\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4."})});case"spreadsheet":return g(d,{sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[Xe.length>0||vt?g(d,{sx:{flex:1,position:"relative",overflow:"scroll",backgroundColor:"white",minHeight:"400px",minWidth:"100%","&::-webkit-scrollbar":{width:"18px",height:"18px"},"&::-webkit-scrollbar-track":{backgroundColor:"#f1f1f1",borderRadius:"10px"},"&::-webkit-scrollbar-thumb":{backgroundColor:"#888",borderRadius:"10px",border:"2px solid #f1f1f1","&:hover":{backgroundColor:"#555"}},"&::-webkit-scrollbar-corner":{backgroundColor:"#f1f1f1"}},children:[Xe.length>0&&r(d,{sx:{minWidth:"max-content",minHeight:"max-content"},children:r(_r,{data:Xe,darkMode:!1})}),vt&&r(d,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255, 255, 255, 0.8)",zIndex:1e3},children:r(co,{visible:vo,exitDelay:200,fadeoutDuration:300,onComplete:qo})})]}):r(d,{sx:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},children:r(P,{color:"text.secondary",children:"\uC2A4\uD504\uB808\uB4DC\uC2DC\uD2B8 \uB370\uC774\uD130\uB97C \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."})}),xt.length>1&&r(d,{sx:{borderTop:1,borderColor:"divider",backgroundColor:"#e0e0e0",padding:"0 8px 8px 8px"},children:r(vr,{value:bo,onChange:(o,n)=>Zo(n),variant:"scrollable",scrollButtons:"auto",sx:{minHeight:"36px","& .MuiTabs-flexContainer":{gap:"6px"},"& .MuiTabs-indicator":{display:"none"},"& .MuiTab-root":{minHeight:"32px",fontSize:"0.875rem",textTransform:"none",padding:"6px 16px",margin:"0",backgroundColor:"white",border:"1px solid #d0d0d0",borderRadius:"0 0 4px 4px",color:"#666",minWidth:"80px",transition:"all 0.2s ease","&:hover":{backgroundColor:"#f8f8f8",color:"#333"},"&.Mui-selected":{backgroundColor:"primary.main",color:"white",border:"1px solid",borderColor:"primary.dark",fontWeight:600,"&:hover":{backgroundColor:"primary.dark"}}}},children:xt.map(o=>r(wr,{label:o,value:o},o))})})]});case"audio":return g(d,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column"},children:[r(P,{variant:"h6",sx:{mb:2},children:l.name}),r("audio",{src:C,controls:!0,style:{width:"100%",maxWidth:"500px"},children:"\uBE0C\uB77C\uC6B0\uC800\uAC00 \uC624\uB514\uC624\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4."})]});default:return g(d,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column",children:[r(P,{variant:"h6",color:"text.secondary",children:"\uBBF8\uB9AC\uBCF4\uAE30\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uD30C\uC77C \uD615\uC2DD\uC785\uB2C8\uB2E4"}),r(P,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"\uD30C\uC77C\uC744 \uB2E4\uC6B4\uB85C\uB4DC\uD558\uC5EC \uD655\uC778\uD574\uC8FC\uC138\uC694."})]})}};return g(gr,{open:a,onClose:Nt,maxWidth:"lg",fullScreen:!0,children:[g(xr,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"grey.800",color:"white",height:"60px",boxSizing:"border-box",userSelect:"none",pl:y?1:3,pr:y?2:3},onContextMenu:e=>e.preventDefault(),children:[g(d,{sx:{display:"flex",alignItems:"center",gap:$?.35:1,flexShrink:0,"& .MuiSvgIcon-root":{fontSize:y?"1.7rem":void 0}},children:[v.length>1?g(d,{sx:{display:"flex",alignItems:"center",gap:y?0:.5},children:[r(S,{title:"\uC774\uC804 \uD30C\uC77C",children:r("span",{style:{display:"inline-flex"},children:r(L,{onClick:()=>W(e=>Math.max(e-1,0)),disabled:ee<=0,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"}},children:r(st,{})})})}),g(P,{variant:"body2",sx:{color:"grey.300",minWidth:40,textAlign:"center",userSelect:"none"},children:[ee+1," / ",v.length]}),r(S,{title:"\uB2E4\uC74C \uD30C\uC77C",children:r("span",{style:{display:"inline-flex"},children:r(L,{onClick:()=>W(e=>Math.min(e+1,v.length-1)),disabled:ee>=v.length-1,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"}},children:r(ct,{})})})})]}):null,y&&k==="pdf"&&E?r(S,{title:"\uD398\uC774\uC9C0 \uBAA9\uB85D",children:r(L,{onClick:()=>je(e=>!e),size:"medium",sx:{color:"grey.300","&:hover":{color:"white"}},children:r(kr,{})})}):null,k==="pdf"&&E?g(d,{sx:{display:"flex",alignItems:"center",gap:y?0:.5},children:[r(S,{title:"\uC774\uC804 \uD398\uC774\uC9C0",children:r("span",{style:{display:"inline-flex"},children:r(L,{onClick:Me,disabled:F<=1,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"},transition:"all 0.2s ease-in-out"},children:r(st,{})})})}),r(P,{variant:"body2",sx:{minWidth:y?"auto":"80px",textAlign:"center",color:"white",px:y?.5:1,fontSize:y?"1.05rem":void 0,fontWeight:y?600:void 0,whiteSpace:"nowrap"},children:$?F:`${F} / ${E}`}),r(S,{title:"\uB2E4\uC74C \uD398\uC774\uC9C0",children:r("span",{style:{display:"inline-flex"},children:r(L,{onClick:Ce,disabled:F>=E,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"},transition:"all 0.2s ease-in-out"},children:r(ct,{})})})})]}):null]}),r(d,{sx:{display:"flex",alignItems:"center",flexGrow:1,mr:$?0:2,overflow:"hidden"},children:!$&&g(d,{sx:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:1.5,fontSize:"1rem"},children:[Or(k),l.name]})}),g(d,{className:"toolbar",sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:$?1.25:1,"& .MuiSvgIcon-root":{fontSize:$?"1.45rem":y?"1.7rem":void 0},"& .MuiIconButton-root":$?{p:.75}:{},"@media (hover: none)":{"& .MuiIconButton-root:hover, & .MuiIconButton-root.Mui-focusVisible":{backgroundColor:"transparent",transform:"none"}}},children:[(k==="image"||k==="pdf"||k==="text"||k==="html"||k==="code"||k==="spreadsheet")&&g(Re,{children:[!(y&&(k==="image"||k==="pdf"))&&g(Re,{children:[r(S,{title:"\uD655\uB300",children:r(L,{onClick:zo,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:r(Fr,{})})}),r(S,{title:"\uCD95\uC18C",children:r(L,{onClick:Ho,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:r(Rr,{})})})]}),(!y||k==="image"||k==="pdf")&&r(S,{title:"\uD654\uBA74\uC5D0 \uB9DE\uCD94\uAE30",children:r(L,{onClick:Go,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:r(Br,{})})}),(k==="image"||k==="pdf")&&g(Re,{children:[r(S,{title:"\uC67C\uCABD\uC73C\uB85C \uD68C\uC804",children:r(L,{onClick:Uo,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:r(Pr,{})})}),r(S,{title:"\uC624\uB978\uCABD\uC73C\uB85C \uD68C\uC804",children:r(L,{onClick:$o,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:r(Sr,{})})})]})]}),r(S,{title:"\uB2E4\uC6B4\uB85C\uB4DC",children:r(L,{onClick:Po,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:r(Er,{})})}),Bo&&r(S,{title:"\uACF5\uC720",children:r(L,{onClick:()=>void Do(),size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:r(Lr,{})})}),r(S,{title:"\uB2EB\uAE30",children:r(L,{onClick:Nt,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:r(Ir,{})})})]})]}),!y&&v.length>1&&ee>0?r(L,{"aria-label":"\uC774\uC804 \uD30C\uC77C",onClick:()=>W(e=>Math.max(e-1,0)),sx:{position:"fixed",left:12,top:"50%",transform:"translateY(-50%)",zIndex:10,color:"white",backgroundColor:"rgba(0, 0, 0, 0.35)","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.55)"},width:44,height:44},children:r(st,{sx:{fontSize:30}})}):null,!y&&v.length>1&&ee<v.length-1?r(L,{"aria-label":"\uB2E4\uC74C \uD30C\uC77C",onClick:()=>W(e=>Math.min(e+1,v.length-1)),sx:{position:"fixed",right:12,top:"50%",transform:"translateY(-50%)",zIndex:10,color:"white",backgroundColor:"rgba(0, 0, 0, 0.35)","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.55)"},width:44,height:44},children:r(ct,{sx:{fontSize:30}})}):null,r(yr,{sx:{p:"0 !important",overflow:"hidden",userSelect:"none"},onContextMenu:e=>e.preventDefault(),children:sr()}),r(Mr,{open:!!wt,autoHideDuration:2e3,onClose:()=>be(""),anchorOrigin:{vertical:"bottom",horizontal:"center"},message:wt,sx:{"& .MuiSnackbarContent-message":{fontSize:"0.95rem"}}})]})},Nr=ho;import{jsx as fo}from"react/jsx-runtime";function Pe(a){return fo("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 550.801 550.801",width:a.width||"22px",fill:a.fill||"#E91E63",...a,children:fo("path",{d:"M488.426,197.019H475.2v-63.816c0-0.401-0.063-0.799-0.116-1.205c-0.021-2.534-0.827-5.023-2.562-6.992L366.325,3.691 c-0.032-0.031-0.063-0.042-0.085-0.073c-0.633-0.707-1.371-1.298-2.151-1.804c-0.231-0.158-0.464-0.287-0.706-0.422 c-0.676-0.366-1.393-0.675-2.131-0.896c-0.2-0.053-0.38-0.135-0.58-0.19C359.87,0.119,359.037,0,358.193,0H97.2 c-11.918,0-21.6,9.693-21.6,21.601v175.413H62.377c-17.049,0-30.873,13.818-30.873,30.87v160.542 c0,17.044,13.824,30.876,30.873,30.876h13.224V529.2c0,11.907,9.682,21.601,21.6,21.601h356.4c11.907,0,21.6-9.693,21.6-21.601 V419.302h13.226c17.044,0,30.871-13.827,30.871-30.87V227.89C519.297,210.838,505.47,197.019,488.426,197.019z M97.2,21.605 h250.193v110.51c0,5.967,4.841,10.8,10.8,10.8h95.407v54.108H97.2V21.605z M406.467,363.983h-26.104l-1.751-46.464 c-0.527-14.598-1.055-32.236-1.055-49.895h-0.517c-3.691,15.485-8.596,32.782-13.163,47.015l-14.354,47.366h-20.851l-12.625-47.002 c-3.85-14.228-7.889-31.524-10.694-47.374h-0.348c-0.707,16.397-1.234,35.129-2.1,50.253l-2.114,46.111h-24.711l7.535-121.395 h35.575l11.569,40.521c3.691,14.048,7.362,29.183,9.999,43.416h0.521c3.344-14.054,7.356-30.074,11.222-43.585l12.614-40.353 h34.879L406.467,363.983z M174.438,265.642v-23.058h90.77v23.058h-32.239v98.342h-26.821v-98.342H174.438z M89.403,313.195v50.788 H62.604V242.584h26.799v46.654h43.999v-46.654h26.645v121.399h-26.645v-50.794H89.403V313.195z M453.601,523.353H97.2V419.302 h356.4V523.353z M500.787,363.983h-73.786V242.584h26.811v98.339h46.976V363.983z"})})}import{jsx as Y,jsxs as Ur}from"react/jsx-runtime";function Se(a){return Ur("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 550.801 550.801",width:a.width||"22px",fill:a.fill||"#B45309",...a,children:[Y("path",{d:"M475.095,131.992c-0.032-2.526-0.833-5.021-2.568-6.993L366.324,3.694c-0.021-0.034-0.053-0.045-0.084-0.076 c-0.633-0.707-1.36-1.29-2.141-1.804c-0.232-0.15-0.465-0.285-0.707-0.422c-0.686-0.366-1.393-0.67-2.131-0.892 c-0.2-0.058-0.379-0.14-0.58-0.192C359.87,0.114,359.047,0,358.203,0H97.2C85.292,0,75.6,9.693,75.6,21.601v507.6 c0,11.913,9.692,21.601,21.6,21.601H453.6c11.918,0,21.601-9.688,21.601-21.601V133.202 C475.2,132.796,475.137,132.398,475.095,131.992z M243.599,523.494H141.75v-15.936l62.398-89.797v-0.785h-56.565v-24.484h95.051 v17.106l-61.038,88.636v0.771h62.002V523.494z M292.021,523.494h-29.744V392.492h29.744V523.494z M399.705,463.44 c-10.104,9.524-25.069,13.796-42.566,13.796c-3.893,0-7.383-0.19-10.104-0.58v46.849h-29.352V394.242 c9.134-1.561,21.958-2.721,40.036-2.721c18.277,0,31.292,3.491,40.046,10.494c8.354,6.607,13.996,17.486,13.996,30.322 C411.761,445.163,407.479,456.053,399.705,463.44z M97.2,366.752V21.601h129.167v-3.396h32.756v3.396h88.28v110.515 c0,5.961,4.831,10.8,10.8,10.8H453.6l0.011,223.836H97.2z"}),Y("path",{d:"M359.279,413.87c-6.033,0-10.114,0.586-12.245,1.171v38.676c2.521,0.585,5.632,0.785,9.914,0.785 c15.736,0,25.46-7.979,25.46-21.378C382.408,421.063,374.045,413.87,359.279,413.87z"}),Y("rect",{x:"259.124",y:"39.918",width:"32.756",height:"13.516"}),Y("rect",{x:"226.368",y:"21.601",width:"32.756",height:"10.125"}),Y("rect",{x:"226.368",y:"60.146",width:"32.756",height:"13.516"}),Y("rect",{x:"259.124",y:"82.274",width:"32.756",height:"13.518"}),Y("rect",{x:"259.124",y:"124.983",width:"32.756",height:"13.516"}),Y("rect",{x:"226.368",y:"103.275",width:"32.756",height:"13.516"}),Y("path",{d:"M259.124,149.537c-23.193,0-34.225,18.792-34.225,41.99l-7.765,70.348c0,23.198,18.792,42.003,41.984,42.003 c23.19,0,41.974-18.805,41.974-42.003l-7.741-70.348C293.361,168.334,282.318,149.537,259.124,149.537z M273.04,285.431h-27.799 v-58.728h27.799V285.431z"})]})}import $r from"@mui/icons-material/TextSnippet";import Gr from"@mui/icons-material/VideoFile";import Kr from"@mui/icons-material/AudioFile";import qr from"@mui/icons-material/Description";import Zr from"@mui/icons-material/InsertDriveFile";import Qr from"@mui/icons-material/Code";import Jr from"@mui/icons-material/TableView";import{jsx as V}from"react/jsx-runtime";function Be(a,c=22){let u=`${c}px`,m={fontSize:c};switch(a){case"image":return V(ie,{width:u,height:u});case"pdf":return V(ae,{width:u,height:u});case"html":return V(Pe,{width:u,height:u});case"archive":return V(Se,{width:u,height:u});case"text":return V($r,{sx:{...m,color:"#66BB6A"}});case"spreadsheet":return V(Jr,{sx:{...m,color:"#4CAF50"}});case"code":return V(Qr,{sx:{...m,color:"#2196F3"}});case"video":return V(Gr,{sx:{...m,color:"#AB47BC"}});case"audio":return V(Kr,{sx:{...m,color:"#FF7043"}});case"office":return V(qr,{sx:{...m,color:"#FFA726"}});default:return V(Zr,{sx:{...m,color:"#78909C"}})}}var en=new Set(["zip","rar","7z","gz","tgz","tar","bz2","xz","alz","egg"]);function go({fileName:a,mime:c,size:u=22}){let m=a.includes(".")?a.slice(a.lastIndexOf(".")+1).toLowerCase():"";return en.has(m)?Be("archive",u):Be(T(a,c??""),u)}export{go as FileTypeIcon,ho as FileViewer,Nr as FileViewerDefault,Pe as HtmlIcon,ie as ImageIcon,ae as PdfIcon,Se as ZipIcon,mr as ensureFileExtension,nt as getEditorLanguage,rt as getFileType,Qt as getFileTypeFromMime,Be as getFileTypeIcon,dr as isFileViewerPreviewable,T as resolveFileType,it as saveBlobAsFile};
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var ko=Object.create;var Ee=Object.defineProperty;var Lo=Object.getOwnPropertyDescriptor;var Eo=Object.getOwnPropertyNames;var Fo=Object.getPrototypeOf,Ro=Object.prototype.hasOwnProperty;var Po=(a,d)=>{for(var u in d)Ee(a,u,{get:d[u],enumerable:!0})},er=(a,d,u,p)=>{if(d&&typeof d=="object"||typeof d=="function")for(let k of Eo(d))!Ro.call(a,k)&&k!==u&&Ee(a,k,{get:()=>d[k],enumerable:!(p=Lo(d,k))||p.enumerable});return a};var f=(a,d,u)=>(u=a!=null?ko(Fo(a)):{},er(d||!a||!a.__esModule?Ee(u,"default",{value:a,enumerable:!0}):u,a)),So=a=>er(Ee({},"__esModule",{value:!0}),a);var Wo={};Po(Wo,{FileTypeIcon:()=>pt,FileViewer:()=>ut,FileViewerDefault:()=>Ir,HtmlIcon:()=>le,ImageIcon:()=>G,PdfIcon:()=>K,ZipIcon:()=>de,ensureFileExtension:()=>rr,getEditorLanguage:()=>Re,getFileType:()=>Fe,getFileTypeFromMime:()=>nt,getFileTypeIcon:()=>ue,isFileViewerPreviewable:()=>tr,resolveFileType:()=>w,saveBlobAsFile:()=>Pe});module.exports=So(Wo);var i=require("react"),n=require("@mui/material"),lr=f(require("@mui/icons-material/Close"),1),dr=f(require("@mui/icons-material/Menu"),1),ur=f(require("@mui/icons-material/Share"),1),mr=f(require("@mui/icons-material/Download"),1),pr=f(require("@mui/icons-material/Add"),1),hr=f(require("@mui/icons-material/Remove"),1),fr=f(require("@mui/icons-material/RotateLeft"),1),gr=f(require("@mui/icons-material/RotateRight"),1),xr=f(require("@mui/icons-material/FitScreen"),1),De=f(require("@mui/icons-material/KeyboardArrowLeft"),1),Be=f(require("@mui/icons-material/KeyboardArrowRight"),1),yr=f(require("@mui/icons-material/TextSnippet"),1),br=f(require("@mui/icons-material/VideoFile"),1),vr=f(require("@mui/icons-material/AudioFile"),1),wr=f(require("@mui/icons-material/Description"),1),Mr=f(require("@mui/icons-material/InsertDriveFile"),1),ct=f(require("@mui/icons-material/Code"),1),Cr=f(require("@mui/icons-material/TableView"),1),_=require("react-pdf"),lt=f(require("@monaco-editor/react"),1),Tr=f(require("react-spreadsheet"),1),ce=f(require("xlsx"),1),dt=require("@ehfuse/mui-fadeout-loading-progress");var Fe=a=>{let d=a.split(".").pop()?.toLowerCase()||"";return["jpg","jpeg","png","gif","bmp","webp","svg"].includes(d)?"image":d==="pdf"?"pdf":["txt","json","xml","log","md","markdown"].includes(d)?"text":["csv","xls","xlsx"].includes(d)?"spreadsheet":["html","htm"].includes(d)?"html":["js","jsx","ts","tsx","css","scss","sass","less","php","py","java","c","cpp","h","hpp","cs","go","rs","rb","swift","kt","scala","sql","sh","bash","bat","ps1","yml","yaml","toml","ini","conf"].includes(d)?"code":["mp4","avi","mov","wmv","flv","webm"].includes(d)?"video":["mp3","wav","ogg","m4a","aac"].includes(d)?"audio":["doc","docx","ppt","pptx","hwp","hwpx"].includes(d)?"office":"unsupported"},nt=a=>{let d=(a||"").toLowerCase().split(";")[0].trim();return d?d.startsWith("image/")?"image":d==="application/pdf"?"pdf":d.startsWith("video/")?"video":d.startsWith("audio/")?"audio":d==="text/html"?"html":d==="text/csv"||d==="application/vnd.ms-excel"||d==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"?"spreadsheet":d.startsWith("text/")||d==="application/json"||d==="application/xml"?"text":"unsupported":"unsupported"},w=(a,d)=>{let u=Fe(a);return u!=="unsupported"?u:nt(d)},Do=new Set(["image","pdf","text","code","html","spreadsheet","video","audio"]),tr=a=>Do.has(Fe(a)),Bo={"image/jpeg":"jpg","image/png":"png","image/gif":"gif","image/webp":"webp","image/bmp":"bmp","image/svg+xml":"svg","application/pdf":"pdf","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/vnd.ms-excel":"xls","text/csv":"csv","text/plain":"txt","application/json":"json","text/xml":"xml","application/xml":"xml","text/html":"html","video/mp4":"mp4","video/webm":"webm","audio/mpeg":"mp3","audio/wav":"wav"},rr=(a,d)=>{let u=(a??"").trim()||"\uCCA8\uBD80\uD30C\uC77C";if(/\.[a-z0-9]+$/i.test(u))return u;let p=(d??"").trim().toLowerCase().split(";")[0],k=Bo[p]??"";return k?`${u}.${k}`:u},Re=a=>{let d=a.split(".").pop()?.toLowerCase()||"";return{js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",html:"html",htm:"html",css:"css",scss:"scss",sass:"scss",less:"less",json:"json",xml:"xml",php:"php",py:"python",java:"java",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",go:"go",rs:"rust",rb:"ruby",swift:"swift",kt:"kotlin",scala:"scala",sql:"sql",sh:"shell",bash:"shell",bat:"bat",ps1:"powershell",yml:"yaml",yaml:"yaml",toml:"toml",ini:"ini",conf:"ini",md:"markdown",markdown:"markdown",txt:"plaintext",log:"plaintext",csv:"plaintext"}[d]||"plaintext"};var zo=a=>(a||"").replace(/[\\/:*?"<>|\r\n]/g,"_").trim()||"download",Pe=(a,d)=>{let u=URL.createObjectURL(a),p=document.createElement("a");p.href=u,p.download=zo(d),p.rel="noopener",document.body.appendChild(p),p.click(),p.remove(),window.setTimeout(()=>URL.revokeObjectURL(u),6e4)};var or=async a=>{let d=URL.createObjectURL(a);try{let u=await new Promise((Y,q)=>{let P=new Image;P.onload=()=>Y(P),P.onerror=()=>q(new Error("\uC774\uBBF8\uC9C0\uB97C \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")),P.src=d}),p=document.createElement("canvas");p.width=u.naturalWidth||u.width||1024,p.height=u.naturalHeight||u.height||1024;let k=p.getContext("2d");if(!k)throw new Error("\uCE94\uBC84\uC2A4\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");return k.drawImage(u,0,0,p.width,p.height),await new Promise((Y,q)=>{p.toBlob(P=>P?Y(P):q(new Error("PNG \uBCC0\uD658 \uC2E4\uD328")),"image/png")})}finally{URL.revokeObjectURL(d)}};var Se=require("@mui/material");function nr(){let a=(0,Se.useTheme)();return!(0,Se.useMediaQuery)(a.breakpoints.up("lg"))}var H=require("react/jsx-runtime");function G(a){return(0,H.jsxs)("svg",{id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 501.551 501.551",xmlSpace:"preserve",width:a.width||"22px",...a,children:[(0,H.jsx)("path",{style:{fill:"#F2F2F2"},d:"M480.653,0H20.898C9.404,0,0,9.404,0,20.898v459.755c0,11.494,9.404,20.898,20.898,20.898h459.755 c11.494,0,20.898-9.404,20.898-20.898V20.898C501.551,9.404,492.147,0,480.653,0z"}),(0,H.jsx)("rect",{x:36.571,y:36.571,style:{fill:"#84DBFF"},width:428.408,height:345.861}),(0,H.jsx)("path",{style:{fill:"#334A5E"},d:"M261.224,382.433H36.571v-87.771c17.763-5.224,37.616-7.314,57.469-7.314 c25.078,0,50.155,4.18,71.053,12.539c6.269,2.09,11.494,4.18,16.718,7.314C218.384,323.918,246.596,350.041,261.224,382.433z"}),(0,H.jsx)("path",{style:{fill:"#40596B"},d:"M464.98,271.673v110.759H127.478c9.404-29.257,29.257-55.38,55.38-76.278 c42.841-34.482,103.445-55.38,172.408-55.38C393.927,250.776,432.588,258.09,464.98,271.673z"}),(0,H.jsxs)("g",{children:[(0,H.jsx)("circle",{style:{fill:"#FFFFFF"},cx:122.253,cy:122.253,r:42.841}),(0,H.jsx)("path",{style:{fill:"#FFFFFF"},d:"M433.633,101.355c1.045-3.135,1.045-6.269,1.045-9.404c0-16.718-13.584-31.347-31.347-31.347 c-11.494,0-21.943,6.269-27.167,15.673c-3.135-2.09-7.314-2.09-11.494-2.09c-14.629,0-26.122,10.449-28.212,24.033 c-8.359,2.09-14.629,9.404-14.629,17.763c0,10.449,8.359,18.808,18.808,18.808h82.547c10.449,0,18.808-8.359,18.808-18.808 C441.992,109.714,438.857,104.49,433.633,101.355z"})]})]})}var M=require("react/jsx-runtime");function K(a){return(0,M.jsx)("svg",{id:"_x35_",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512",xmlSpace:"preserve",width:a.width||"28px",...a,children:(0,M.jsxs)("g",{children:[(0,M.jsx)("polygon",{style:{fill:"#B12A27"},points:"475.435,117.825 475.435,512 47.791,512 47.791,0.002 357.613,0.002 412.491,54.881 "}),(0,M.jsx)("rect",{x:36.565,y:34.295,style:{fill:"#F2F2F2"},width:205.097,height:91.768}),(0,M.jsxs)("g",{children:[(0,M.jsxs)("g",{children:[(0,M.jsx)("path",{style:{fill:"#B12A27"},d:"M110.132,64.379c-0.905-2.186-2.111-4.146-3.769-5.804c-1.658-1.658-3.694-3.015-6.031-3.92 c-2.412-0.98-5.126-1.432-8.141-1.432H69.651v58.195h11.383V89.481h11.157c3.015,0,5.729-0.452,8.141-1.432 c2.337-0.905,4.372-2.261,6.031-3.92c1.659-1.658,2.865-3.543,3.769-5.804c0.829-2.186,1.282-4.523,1.282-6.935 C111.413,68.902,110.961,66.565,110.132,64.379z M97.844,77.118c-1.508,1.432-3.618,2.186-6.181,2.186H81.034V63.323h10.629 c2.563,0,4.674,0.754,6.181,2.261c1.432,1.432,2.186,3.392,2.186,5.804C100.031,73.726,99.277,75.686,97.844,77.118z"}),(0,M.jsx)("path",{style:{fill:"#B12A27"},d:"M164.558,75.761c-0.075-2.035-0.151-3.844-0.377-5.503c-0.226-1.659-0.603-3.166-1.131-4.598 c-0.528-1.357-1.206-2.714-2.111-3.92c-2.035-2.94-4.523-5.126-7.312-6.483c-2.865-1.357-6.257-2.035-10.252-2.035h-20.956 v58.195h20.956c3.995,0,7.387-0.678,10.252-2.035c2.789-1.357,5.277-3.543,7.312-6.483c0.905-1.206,1.583-2.563,2.111-3.92 c0.528-1.432,0.905-2.94,1.131-4.598c0.226-1.658,0.301-3.468,0.377-5.503c0.075-1.96,0.075-4.146,0.075-6.558 C164.633,79.908,164.633,77.721,164.558,75.761z M153.175,88.2c0,1.734-0.151,3.091-0.302,4.297 c-0.151,1.131-0.377,2.186-0.678,2.94c-0.301,0.829-0.754,1.583-1.281,2.261c-1.885,2.412-4.749,3.543-8.518,3.543h-8.669V63.323 h8.669c3.769,0,6.634,1.206,8.518,3.618c0.528,0.678,0.98,1.357,1.281,2.186s0.528,1.809,0.678,3.015 c0.151,1.131,0.302,2.563,0.302,4.221c0.075,1.659,0.075,3.694,0.075,5.955C153.251,84.581,153.251,86.541,153.175,88.2z"}),(0,M.jsx)("path",{style:{fill:"#B12A27"},d:"M213.18,63.323V53.222h-38.37v58.195h11.383V87.823h22.992V77.646h-22.992V63.323H213.18z"})]}),(0,M.jsx)("g",{children:(0,M.jsx)("path",{style:{fill:"#B12A27"},d:"M110.132,64.379c-0.905-2.186-2.111-4.146-3.769-5.804c-1.658-1.658-3.694-3.015-6.031-3.92 c-2.412-0.98-5.126-1.432-8.141-1.432H69.651v58.195h11.383V89.481h11.157c3.015,0,5.729-0.452,8.141-1.432 c2.337-0.905,4.372-2.261,6.031-3.92c1.659-1.658,2.865-3.543,3.769-5.804c0.829-2.186,1.282-4.523,1.282-6.935 C111.413,68.902,110.961,66.565,110.132,64.379z M97.844,77.118c-1.508,1.432-3.618,2.186-6.181,2.186H81.034V63.323h10.629 c2.563,0,4.674,0.754,6.181,2.261c1.432,1.432,2.186,3.392,2.186,5.804C100.031,73.726,99.277,75.686,97.844,77.118z"})})]}),(0,M.jsx)("polygon",{style:{opacity:.08,fill:"#040000"},points:"475.435,117.825 475.435,512 47.791,512 47.791,419.581 247.705,219.667 259.54,207.832 266.098,201.273 277.029,190.343 289.995,177.377 412.491,54.881 "}),(0,M.jsx)("polygon",{style:{fill:"#771B1B"},points:"475.435,117.836 357.599,117.836 357.599,0 "}),(0,M.jsx)("g",{children:(0,M.jsx)("path",{style:{fill:"#F2F2F2"},d:"M414.376,370.658c-2.488-4.372-5.88-8.518-10.101-12.287c-3.467-3.166-7.538-6.106-12.137-8.82 c-18.544-10.93-45.003-16.207-80.961-16.207h-3.618c-1.96-1.809-3.995-3.618-6.106-5.503 c-13.644-12.287-24.499-25.63-32.942-40.48c16.584-36.561,24.499-69.126,23.519-96.867c-0.151-4.674-0.829-9.046-2.035-13.117 c-1.809-6.558-4.824-12.363-9.046-17.112c-0.075-0.075-0.075-0.075-0.151-0.151c-6.709-7.538-16.056-11.835-25.555-11.835 c-9.574,0-18.393,4.146-24.801,11.76c-6.332,7.538-9.724,17.866-9.875,30.002c-0.226,18.544,1.281,36.108,4.448,52.315 c0.301,1.282,0.528,2.563,0.829,3.844c3.166,14.7,7.84,28.645,13.87,41.611c-7.086,14.398-14.247,26.836-19.223,35.279 c-3.769,6.408-7.915,13.117-12.212,19.826c-19.373,3.468-35.807,7.689-50.129,12.966c-19.373,7.011-34.902,16.056-46.059,26.836 c-7.237,6.935-12.137,14.323-14.549,22.012c-2.563,7.915-2.412,15.83,0.452,22.916c2.638,6.558,7.387,12.061,13.72,15.83 c1.508,0.905,3.091,1.658,4.749,2.337c4.825,1.96,10.101,3.015,15.604,3.015c12.74,0,25.856-5.503,36.937-15.378 c20.655-18.469,41.988-48.169,54.577-66.94c10.327-1.583,21.559-2.94,34.224-4.297c14.926-1.508,28.118-2.412,40.104-2.865 c3.694,3.317,7.237,6.483,10.629,9.498c18.846,16.81,33.168,28.947,46.134,37.465c0,0.075,0.075,0.075,0.151,0.075 c5.126,3.392,10.026,6.181,14.926,8.443c5.503,2.563,11.081,3.92,16.81,3.92c7.237,0,14.021-2.186,19.675-6.181 c5.729-4.146,9.875-10.101,11.76-16.81C420.18,387.694,418.899,378.724,414.376,370.658z M247.705,219.667 c-1.055-9.348-1.508-19.072-1.357-29.324c0.151-9.724,3.694-16.283,8.895-16.283c3.92,0,8.066,3.543,9.95,10.327 c0.528,2.035,0.905,4.372,0.98,7.01c0.151,3.166,0.075,6.483-0.075,9.875c-0.452,9.574-2.111,19.75-4.975,30.681 c-1.734,7.011-3.995,14.323-6.784,21.936C251.173,243.186,248.911,231.803,247.705,219.667z M121.967,418.073 c-1.282-3.166,0.151-9.272,7.991-16.81c11.986-11.458,30.756-20.504,56.914-27.364c-4.975,6.784-9.875,12.966-14.624,18.619 c-7.237,8.744-14.172,16.132-20.429,21.71c-5.352,4.824-11.232,7.84-16.81,8.594c-0.98,0.151-1.96,0.226-2.94,0.226 C127.168,423.049,123.173,421.089,121.967,418.073z M242.428,337.942l0.528-0.829l-0.829,0.151 c0.151-0.377,0.377-0.754,0.603-1.055c3.166-5.352,7.161-12.212,11.458-20.127l0.377,0.829l0.98-2.035 c3.166,4.523,6.634,8.971,10.252,13.267c1.734,2.035,3.543,3.995,5.352,5.955l-1.206,0.075l1.055,0.98 c-3.091,0.226-6.332,0.528-9.574,0.829c-2.035,0.226-4.146,0.377-6.257,0.603C250.796,337.037,246.499,337.49,242.428,337.942z M369.297,384.98c-8.971-5.729-18.996-13.795-31.359-24.575c17.564,1.809,31.359,5.654,41.159,11.383 c4.297,2.488,7.538,5.051,9.724,7.538c3.618,3.844,4.9,7.312,4.221,9.649c-0.603,2.337-3.241,3.92-6.483,3.92 c-1.885,0-3.844-0.452-5.88-1.432c-3.468-1.658-7.086-3.694-10.93-6.181C369.598,385.282,369.448,385.131,369.297,384.98z"})})]})})}var r=require("react/jsx-runtime");var Ho="/pdfjs",ir=32,ar=240,Vo=8192,it=.25,at=8,st=80,sr=80,Ao=a=>{switch(a){case"image":return(0,r.jsx)(G,{});case"pdf":return(0,r.jsx)(K,{});case"text":return(0,r.jsx)(yr.default,{sx:{mr:1,color:"#66BB6A"}});case"spreadsheet":return(0,r.jsx)(Cr.default,{sx:{mr:1,color:"#4CAF50"}});case"html":return(0,r.jsx)(ct.default,{sx:{mr:1,color:"#E91E63"}});case"code":return(0,r.jsx)(ct.default,{sx:{mr:1,color:"#2196F3"}});case"video":return(0,r.jsx)(br.default,{sx:{mr:1,color:"#AB47BC"}});case"audio":return(0,r.jsx)(vr.default,{sx:{mr:1,color:"#FF7043"}});case"office":return(0,r.jsx)(wr.default,{sx:{mr:1,color:"#FFA726"}});default:return(0,r.jsx)(Mr.default,{sx:{mr:1,color:"#78909C"}})}},cr=a=>typeof a?.rotate=="number"?a.rotate:typeof a?._pageInfo?.rotate=="number"?a._pageInfo.rotate:0,ut=({open:a,onClose:d,file:u,files:p=null,initialIndex:k=0,loadFile:Y,onDownload:q,onShare:P,pdfAssetBase:Z=Ho})=>{let y=nr(),Dr=(0,n.useTheme)(),j=(0,n.useMediaQuery)(Dr.breakpoints.down("sm")),b=(0,i.useMemo)(()=>p&&p.length>0?p:[],[p]),[Q,V]=(0,i.useState)(0);(0,i.useEffect)(()=>{a&&V(b.length>0?Math.min(Math.max(k,0),b.length-1):0)},[a,k,b]);let m=b.length>0?b[Q]??u:u,[ze,He]=(0,i.useState)(!0),[Br,ht]=(0,i.useState)(!1),[C,Ve]=(0,i.useState)(""),[T,B]=(0,i.useState)(1),[X,re]=(0,i.useState)(0),[ft,me]=(0,i.useState)(""),[v,gt]=(0,i.useState)(""),[xt,pe]=(0,i.useState)(""),[oe,he]=(0,i.useState)(14),[Ae,fe]=(0,i.useState)(""),[Xe,yt]=(0,i.useState)("preview"),[We,ne]=(0,i.useState)([]),[bt,vt]=(0,i.useState)([]),[zr,_e]=(0,i.useState)(""),[Ye,wt]=(0,i.useState)(null),[Mt,ge]=(0,i.useState)(!1),[Hr,je]=(0,i.useState)(!0),[Ct,xe]=(0,i.useState)(""),[L,Tt]=(0,i.useState)(),[E,O]=(0,i.useState)(1),[Vr,Oe]=(0,i.useState)(!1),[ye,It]=(0,i.useState)("portrait"),[Ar,kt]=(0,i.useState)(0),[Ne,Lt]=(0,i.useState)(0),[ie,Et]=(0,i.useState)({width:0,height:0}),Ft=(0,i.useRef)([]),Ue=(0,i.useRef)(null),N=(0,i.useRef)(null),$e=(0,i.useRef)(null),Ge=(0,i.useRef)(null),Xr=(0,i.useCallback)(e=>{if($e.current?.disconnect(),Ge.current?.(),Ge.current=null,N.current=e,!e){$e.current=null;return}let t=c=>{c.touches.length>=2&&c.preventDefault()};e.addEventListener("touchmove",t,{passive:!1}),Ge.current=()=>e.removeEventListener("touchmove",t);let o=new ResizeObserver(c=>{let l=c[0]?.contentRect;l&&Et({width:l.width,height:l.height})});o.observe(e),$e.current=o;let s=e.getBoundingClientRect();Et({width:s.width,height:s.height})},[]),[be,Rt]=(0,i.useState)(!1),[Ke,Wr]=(0,i.useState)({x:0,y:0}),[qe,_r]=(0,i.useState)({x:0,y:0}),Yr=(0,i.useCallback)(async(e,t)=>{let o=URL.createObjectURL(e);Ve(o),gt(e.type||"");let s=w(t,e.type||"");if(s==="text"||s==="code"){let l=await e.text();pe(l);return}if(s==="html"){let l=await e.text();fe(l);return}if(s!=="spreadsheet")return;let c=t.split(".").pop()?.toLowerCase()||"";if(c==="csv"){let h=(await e.text()).split(`
|
|
2
|
-
`).map(g=>g.split(",").map(D=>({value:D.trim()})));ne(h);return}if(c==="xls"||c==="xlsx"){ge(!0),je(!0);let l=await e.arrayBuffer(),h=ce.read(l,{type:"array"});vt(h.SheetNames),wt(h);let g=h.SheetNames[0];_e(g),tt(h,g)}},[]),ae=(0,i.useRef)(null),Ze=(0,i.useCallback)(async e=>{if(e.blob)return e.blob;if(Y)return await Y(e);if(e.url){let t=await fetch(e.url);if(!t.ok)throw new Error("\uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");return await t.blob()}throw new Error("\uD30C\uC77C \uB370\uC774\uD130 \uC18C\uC2A4(blob/url/loadFile)\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.")},[Y]);(0,i.useEffect)(()=>(m&&a?Ur():(C&&URL.revokeObjectURL(C),ae.current=null,Ve(""),pe(""),fe(""),ne([]),he(14),B(1),re(0)),()=>{C&&URL.revokeObjectURL(C)}),[m,a]);let jr=({numPages:e})=>{Tt(e),O(1),ke.current=!0},Or=e=>{let{width:t,height:o}=Nr(e);kt(cr(e)),t>0&&o>0&&Lt(t/o);let s=t>o?"landscape":"portrait";It(s)},Nr=e=>{let t=e?.width||0,o=e?.height||0,s=cr(e);try{if(typeof e?.getViewport=="function"){let c=e.getViewport({scale:1,rotation:s});t=c.width,o=c.height}}catch(c){console.warn("[FileViewer] getViewport \uC2E4\uD328 - \uAE30\uBCF8 width/height\uB85C \uB300\uCCB4",c)}return{width:t,height:o}},ve=(0,i.useCallback)(()=>{O(e=>Math.max(e-1,1))},[]),we=(0,i.useCallback)(()=>{O(e=>Math.min(e+1,L||1))},[L]),Pt=(0,i.useMemo)(()=>({cMapUrl:`${Z}/cmaps/`,cMapPacked:!0,standardFontDataUrl:`${Z}/standard_fonts/`,wasmUrl:`${Z}/wasm/`}),[Z]);(0,i.useEffect)(()=>{typeof window>"u"||(_.pdfjs.GlobalWorkerOptions.workerSrc=`${Z}/pdf.worker.min.mjs`)},[Z]),(0,i.useEffect)(()=>{if(!a||b.length<=1||w(m?.name||"",v)==="pdf")return;let e=t=>{t.key==="ArrowLeft"?(t.preventDefault(),V(o=>Math.max(o-1,0))):t.key==="ArrowRight"&&(t.preventDefault(),V(o=>Math.min(o+1,b.length-1)))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a,b.length,m?.name,v]),(0,i.useEffect)(()=>{if(!a||b.length<=1||w(m?.name||"",v)==="pdf"||T>1)return;let e=0,t=0,o=c=>{e=c.touches[0]?.clientX??0,t=c.touches[0]?.clientY??0},s=c=>{let l=(c.changedTouches[0]?.clientX??0)-e,h=(c.changedTouches[0]?.clientY??0)-t;Math.abs(l)<60||Math.abs(h)>Math.abs(l)||(l<0?V(g=>Math.min(g+1,b.length-1)):V(g=>Math.max(g-1,0)))};return document.addEventListener("touchstart",o,{passive:!0}),document.addEventListener("touchend",s,{passive:!0}),()=>{document.removeEventListener("touchstart",o),document.removeEventListener("touchend",s)}},[a,b.length,m?.name,v,T]),(0,i.useEffect)(()=>{if(!a||w(m?.name||"",v)!=="pdf")return;let e=o=>{switch(o.key){case"ArrowLeft":case"ArrowUp":o.preventDefault(),ve();break;case"ArrowRight":case"ArrowDown":o.preventDefault(),we();break;case"Home":o.preventDefault(),O(1);break;case"End":o.preventDefault(),L&&O(L);break}},t=o=>{o.ctrlKey||Math.abs(o.deltaY)>50&&(o.preventDefault(),o.deltaY>0?we():ve())};return document.addEventListener("keydown",e),document.addEventListener("wheel",t,{passive:!1}),()=>{document.removeEventListener("keydown",e),document.removeEventListener("wheel",t)}},[a,m,v,ve,we,L]),(0,i.useEffect)(()=>{if(!L||!a||w(m?.name||"",v)!=="pdf")return;if(E===1&&Ue.current){Ue.current.scrollTo({top:0,behavior:"smooth"});return}let e=Ft.current[E-1];e&&e.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},[a,m,v,L,E]),(0,i.useEffect)(()=>{if(ze){let e=window.setTimeout(()=>ht(!0),180);return()=>window.clearTimeout(e)}},[ze]);let Ur=async()=>{if(m){He(!0),me(""),gt(""),pe(""),fe(""),ne([]);try{let e=await Ze(m);ae.current=e,await Yr(e,m.name)}catch(e){console.error("\uD30C\uC77C \uB85C\uB4DC \uC624\uB958:",e),me("\uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")}finally{He(!1)}}},$r=async()=>{if(m)try{if(q){await q(m);return}let e=ae.current??await Ze(m);Pe(e,m.name)}catch(e){console.error("\uD30C\uC77C \uB2E4\uC6B4\uB85C\uB4DC \uC624\uB958:",e)}},Gr=typeof navigator<"u"&&typeof navigator.share=="function"&&typeof navigator.canShare=="function",Kr=!!P||Gr,qr=async()=>{if(m)try{if(P){await P(m);return}let e=ae.current??await Ze(m),t=e.type||(typeof m.mimeType=="string"?m.mimeType:"")||"application/octet-stream",o=new File([e],m.name,{type:t});navigator.canShare({files:[o]})?await navigator.share({files:[o],title:m.name}):console.warn("\uC774 \uAE30\uAE30\uB294 \uC774 \uD30C\uC77C \uD615\uC2DD\uC758 \uACF5\uC720\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.")}catch(e){if(e?.name==="AbortError")return;console.error("\uD30C\uC77C \uACF5\uC720 \uC624\uB958:",e)}},Zr=()=>{let e=m?w(m.name,v):"";e==="text"||e==="html"||e==="code"||e==="spreadsheet"?he(t=>Math.min(t+2,24)):B(e==="pdf"?t=>Math.min(t+.25,at):t=>Math.min(t+.25,3))},Qr=()=>{let e=m?w(m.name,v):"";e==="text"||e==="html"||e==="code"||e==="spreadsheet"?he(t=>Math.max(t-2,10)):B(e==="pdf"?t=>Math.max(t-.25,it):t=>Math.max(t-.25,.25))},x=(0,i.useRef)(new Map),Jr=e=>Math.min(Math.max(e,.25),3),eo=e=>Math.min(Math.max(e,it),at),Qe=(0,i.useRef)(null),Me=(0,i.useRef)(null),A=(0,i.useRef)({scale:1,tx:0,ty:0,rotation:0}),W=(0,i.useRef)(0),J=(0,i.useRef)(null),Ce=(0,i.useRef)(null),Te=(0,i.useCallback)((e,t,o,s)=>{let c=Qe.current,l=Me.current;if(!c||!l)return{tx:t,ty:o};let h=l.offsetWidth,g=l.offsetHeight,D=(Math.round(s/90)%4+4)%4;if(D===1||D===3){let Io=h;h=g,g=Io}let z=h*e,Zt=g*e,Qt=z>c.clientWidth?(z+c.clientWidth)/2-sr:0,Jt=Zt>c.clientHeight?(Zt+c.clientHeight)/2-sr:0;return{tx:Math.min(Qt,Math.max(-Qt,t)),ty:Math.min(Jt,Math.max(-Jt,o))}},[]),St=(0,i.useCallback)((e,t)=>{let o=Qe.current,s=Me.current;if(!o||!s)return e>1;let c=(Math.round(t/90)%4+4)%4,l=c===1||c===3,h=l?s.offsetHeight:s.offsetWidth,g=l?s.offsetWidth:s.offsetHeight;return h*e>o.clientWidth+1||g*e>o.clientHeight+1},[]),U=(0,i.useCallback)(e=>{let t=Me.current;if(!t)return;let{scale:o,tx:s,ty:c,rotation:l}=A.current;t.style.transition=e?"transform 0.25s ease":"none",t.style.transform=`translate(${s}px, ${c}px) scale(${o}) rotate(${l}deg)`},[]),Dt=(0,i.useCallback)(()=>{let e=A.current,t=Te(e.scale,e.tx,e.ty,e.rotation);e.tx=t.tx,e.ty=t.ty,!W.current&&(W.current=requestAnimationFrame(()=>{W.current=0,U(!1)}))},[U,Te]),Bt=(0,i.useCallback)(()=>{W.current&&(cancelAnimationFrame(W.current),W.current=0),x.current.clear(),J.current=null,Ce.current=null},[]),to=(0,i.useCallback)(e=>{Me.current=e,e&&(A.current={scale:1,tx:0,ty:0,rotation:0},U(!1))},[U]);(0,i.useEffect)(()=>{if(w(m?.name||"",v)!=="image")return;let e=A.current;e.scale=T,e.rotation=X;let t=Te(e.scale,e.tx,e.ty,e.rotation);e.tx=t.tx,e.ty=t.ty,U(!0)},[T,X,m,v,C,U,Te]),(0,i.useEffect)(()=>()=>{W.current&&cancelAnimationFrame(W.current)},[]);let ro=e=>{e.currentTarget.setPointerCapture?.(e.pointerId),x.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=[...x.current.values()],o=A.current;if(t.length===2){J.current=null;let s=e.currentTarget.getBoundingClientRect();Ce.current={startDist:Math.hypot(t[0].x-t[1].x,t[0].y-t[1].y)||1,baseScale:o.scale,baseTx:o.tx,baseTy:o.ty,startMidX:(t[0].x+t[1].x)/2,startMidY:(t[0].y+t[1].y)/2,centerX:s.left+s.width/2,centerY:s.top+s.height/2}}else t.length===1&&St(o.scale,o.rotation)&&(J.current={startX:e.clientX,startY:e.clientY,baseTx:o.tx,baseTy:o.ty})},oo=e=>{if(!x.current.has(e.pointerId))return;x.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=A.current,o=Ce.current,s=[...x.current.values()];if(o&&s.length>=2){let l=Math.hypot(s[0].x-s[1].x,s[0].y-s[1].y),h=(s[0].x+s[1].x)/2,g=(s[0].y+s[1].y)/2,D=Jr(o.baseScale*l/o.startDist),z=D/o.baseScale;t.scale=D,t.tx=h-o.centerX-z*(o.startMidX-o.centerX-o.baseTx),t.ty=g-o.centerY-z*(o.startMidY-o.centerY-o.baseTy),Dt();return}let c=J.current;c&&s.length===1&&(t.tx=c.baseTx+(e.clientX-c.startX),t.ty=c.baseTy+(e.clientY-c.startY),Dt())},zt=e=>{if(!x.current.has(e.pointerId))return;x.current.delete(e.pointerId),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId);let t=A.current;if(x.current.size<2&&(Ce.current=null,Math.abs(t.scale-T)>.001&&B(t.scale)),x.current.size===0)J.current=null;else if(x.current.size===1&&St(t.scale,t.rotation)){let o=[...x.current.values()][0];J.current={startX:o.x,startY:o.y,baseTx:t.tx,baseTy:t.ty}}},Ht=(0,i.useCallback)(async()=>{if(C)try{let t=await(await fetch(C)).blob(),o=t.type==="image/png"?t:await or(t);await navigator.clipboard.write([new ClipboardItem({"image/png":o})]),xe("\uC774\uBBF8\uC9C0\uB97C \uD074\uB9BD\uBCF4\uB4DC\uC5D0 \uBCF5\uC0AC\uD588\uC2B5\uB2C8\uB2E4.")}catch(e){console.error("\uC774\uBBF8\uC9C0 \uBCF5\uC0AC \uC624\uB958:",e),xe("\uC774\uBBF8\uC9C0\uB97C \uBCF5\uC0AC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")}},[C]);(0,i.useEffect)(()=>{if(!a||w(m?.name||"",v)!=="image")return;let e=t=>{if(!(t.ctrlKey||t.metaKey)||t.key.toLowerCase()!=="c")return;let o=t.target,s=o?.tagName;s==="INPUT"||s==="TEXTAREA"||o?.isContentEditable||(t.preventDefault(),Ht())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a,m,v,Ht]);let ee=(0,i.useRef)(null),S=(0,i.useRef)(0),se=(0,i.useRef)(null),te=(0,i.useRef)(null),$=()=>N.current?.querySelector(".react-pdf__Page")??null,Ie=(0,i.useRef)(null),Vt=(0,i.useRef)(null),no=()=>{let e=Vt.current,t=$()?.querySelector("canvas");if(!e||!t||!t.width||!t.height)return!1;let o=document.createElement("canvas");o.width=t.width,o.height=t.height;let s=o.getContext("2d");if(!s)return!1;s.drawImage(t,0,0);let c=t.getBoundingClientRect(),l=e.getBoundingClientRect();return Object.assign(o.style,{position:"absolute",left:`${c.left-l.left}px`,top:`${c.top-l.top}px`,width:`${c.width}px`,height:`${c.height}px`,pointerEvents:"none",zIndex:"1"}),e.appendChild(o),Ie.current=o,!0},At=()=>{Ie.current?.remove(),Ie.current=null;let e=$();e&&(e.style.visibility="")},io=()=>{S.current||(S.current=requestAnimationFrame(()=>{S.current=0;let e=ee.current,t=$();!e||!t||(t.style.transition="none",t.style.transformOrigin="top left",t.style.transform=`translate(${e.tx}px, ${e.ty}px) scale(${e.k})`,se.current={k:e.k,tx:e.tx,ty:e.ty,midX:e.lastMidX,midY:e.lastMidY})}))},Xt=()=>{S.current&&(cancelAnimationFrame(S.current),S.current=0),ee.current=null,te.current=null,se.current=null,At();let e=$();e&&(e.style.transform="",e.style.willChange="auto")},Wt=e=>{let t=$(),o=N.current;if(!t||!o)return;t.style.transform&&(t.style.transform="");let s=t.getBoundingClientRect(),c=o.getBoundingClientRect(),l=(e[0].x+e[1].x)/2,h=(e[0].y+e[1].y)/2;ee.current={startDist:Math.hypot(e[0].x-e[1].x,e[0].y-e[1].y)||1,rectLeft:s.left,rectTop:s.top,pageW:s.width,pageH:s.height,viewerL:c.left,viewerT:c.top,viewerR:c.right,viewerB:c.bottom,startMidX:l,startMidY:h,lastMidX:l,lastMidY:h,k:1,tx:0,ty:0},se.current={k:1,tx:0,ty:0,midX:l,midY:h},t.style.willChange="transform"},ao=e=>{if(e.pointerType!=="touch")return;x.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=[...x.current.values()];if(t.length===2){if(te.current||Ie.current)return;Wt(t)}},so=e=>{if(!x.current.has(e.pointerId))return;x.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=ee.current,o=[...x.current.values()];if(t&&o.length>=2){e.preventDefault();let s=Math.hypot(o[0].x-o[1].x,o[0].y-o[1].y),c=Math.min(Math.max(s/t.startDist,it/(T||1)),at/(T||1)),l=(o[0].x+o[1].x)/2,h=(o[0].y+o[1].y)/2,g=l-t.rectLeft-c*(t.startMidX-t.rectLeft),D=h-t.rectTop-c*(t.startMidY-t.rectTop),z=st;g=Math.min(t.viewerR-z-t.rectLeft,Math.max(t.viewerL+z-t.rectLeft-c*t.pageW,g)),D=Math.min(t.viewerB-z-t.rectTop,Math.max(t.viewerT+z-t.rectTop-c*t.pageH,D)),t.k=c,t.tx=g,t.ty=D,t.lastMidX=l,t.lastMidY=h,io()}},_t=e=>{if(x.current.delete(e.pointerId),x.current.size>=2)return;let t=ee.current;if(ee.current=null,!t)return;S.current&&(cancelAnimationFrame(S.current),S.current=0);let o=se.current??{k:1,tx:0,ty:0,midX:t.startMidX,midY:t.startMidY};se.current=null;let s=eo(T*o.k);if(Math.abs(s-T)<.001){let l=N.current;Xt(),l&&(l.scrollLeft-=o.tx,l.scrollTop-=o.ty);return}let c=N.current;if(c){let l=c.getBoundingClientRect();te.current={u:(o.midX-t.rectLeft-o.tx)/o.k,v:(o.midY-t.rectTop-o.ty)/o.k,offX:o.midX-l.left,offY:o.midY-l.top,factor:s/(T||1)}}if(no()){let l=$();l&&(l.style.transform="",l.style.visibility="hidden")}B(s),Math.round(Math.min(rt*s,Gt))===ot&&requestAnimationFrame(()=>jt())},ke=(0,i.useRef)(!0),Je=(0,i.useRef)(null),Yt=()=>{let e=N.current;e&&(e.scrollLeft=(e.scrollWidth-e.clientWidth)/2,e.scrollTop=(e.scrollHeight-e.clientHeight)/2)},jt=()=>{let e=te.current;if(!e)return;te.current=null;let t=N.current,o=$();if(!t||!o)return;At(),o.style.transform="",o.style.willChange="auto";let s=o.getBoundingClientRect(),c=t.getBoundingClientRect();t.scrollLeft+=s.left-c.left+e.u*e.factor-e.offX,t.scrollTop+=s.top-c.top+e.v*e.factor-e.offY;let l=[...x.current.values()];l.length>=2&&Wt(l)},Ot=()=>{let e=`${E}:${X}`;if(te.current){Je.current=e,jt();return}(ke.current||Je.current!==e)&&(ke.current=!1,Je.current=e,Yt())};(0,i.useEffect)(()=>()=>{S.current&&cancelAnimationFrame(S.current)},[]);let co=()=>{re(e=>e-90)},lo=()=>{re(e=>e+90)},uo=()=>{let e=w(m?.name||"",v);Xt(),e==="text"||e==="html"||e==="code"||e==="spreadsheet"?he(14):e==="pdf"?(B(1),T===1&&X===0?Yt():ke.current=!0):(Bt(),A.current={scale:1,tx:0,ty:0,rotation:0},U(!0),B(1)),re(0)},Nt=(e,t)=>{Rt(!0),Wr({x:e.clientX,y:e.clientY}),_r({x:t.scrollLeft,y:t.scrollTop}),e.preventDefault()},Ut=(0,i.useCallback)((e,t)=>{if(!be)return;let o=e.clientX-Ke.x,s=e.clientY-Ke.y;t.scrollLeft=qe.x-o,t.scrollTop=qe.y-s,e.preventDefault()},[be,Ke,qe]),et=(0,i.useCallback)(()=>{Rt(!1),document.body.style.cursor="default"},[]);(0,i.useEffect)(()=>{if(be){let e=t=>{document.querySelectorAll(".draggable-scroll").forEach(s=>{Ut(t,s)})};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",et),document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",et),document.body.style.userSelect="",document.body.style.webkitUserSelect=""}}},[be,Ut,et]);let mo=(0,i.useCallback)(()=>{He(!1),ht(!1)},[]),tt=(0,i.useCallback)(async(e,t)=>{ge(!0),je(!0);try{await new Promise(h=>setTimeout(h,500));let o=e.Sheets[t],s=ce.utils.decode_range(o["!ref"]||"A1");console.debug("Excel range:",s);let l=ce.utils.sheet_to_json(o,{header:1,range:s,defval:""}).map(h=>h.map(g=>({value:g!=null?String(g):""})));ne(l),await new Promise(h=>setTimeout(h,200))}catch(o){console.error("\uC6CC\uD06C\uC2DC\uD2B8 \uB85C\uB4DC \uC624\uB958:",o)}finally{je(!1)}},[]),po=(0,i.useCallback)(()=>{ge(!1)},[]),ho=(0,i.useCallback)(e=>{Ye&&(_e(e),tt(Ye,e))},[Ye,tt]),$t=()=>{Bt(),A.current={scale:1,tx:0,ty:0,rotation:0},xe(""),C&&URL.revokeObjectURL(C),ae.current=null,Ve(""),pe(""),fe(""),ne([]),vt([]),_e(""),wt(null),ge(!1),B(1),re(0),me(""),Tt(void 0),O(1),It("portrait"),kt(0),Lt(0),d()};if(!m)return null;let I=w(m.name,v),fo=((Ar+X)%360+360)%360,Le=X%180===0?Ne:Ne>0?1/Ne:0,go=Math.max(ie.width-ir,ar),xo=Math.max(ie.height-ir,ar),rt=ie.width>0&&Le>0?Math.min(go,xo*Le):ye==="portrait"?600:800,yo=typeof window<"u"&&window.devicePixelRatio||1,Gt=Vo/yo*(Le>0?Math.min(1,Le):1),ot=Math.round(Math.min(rt*T,Gt)),Kt=Math.round(rt*T),bo=Kt>ot,vo=Math.max(16,Math.round(ie.width)-st),wo=Math.max(16,Math.round(ie.height)-st),Mo=ye==="landscape"?"200px":"150px",Co=ye==="landscape"?.18:.17,qt=()=>L?(0,r.jsx)(n.Box,{ref:Ue,sx:{width:Mo,height:"100%",backgroundColor:"grey.200",borderRight:"1px solid",borderColor:"grey.300",overflow:"auto",p:2},children:Array.from({length:L},(e,t)=>(0,r.jsxs)(n.Box,{ref:o=>{Ft.current[t]=o},children:[(0,r.jsx)(n.Box,{sx:{mb:0,p:1,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",border:E===t+1?"2px solid":"1px solid",borderColor:E===t+1?"primary.main":"grey.400",borderRadius:1,overflow:"hidden",backgroundColor:"white","&:hover":{borderColor:"primary.main"},aspectRatio:ye==="landscape"?"4 / 3":"3 / 4"},onClick:()=>{O(t+1),y&&Oe(!1)},children:(0,r.jsx)(_.Document,{file:C,options:Pt,loading:(0,r.jsx)("div",{style:{display:"none"}}),children:(0,r.jsx)(_.Page,{pageNumber:t+1,scale:Co,loading:(0,r.jsx)("div",{style:{display:"none"}}),renderAnnotationLayer:!1,renderTextLayer:!1})})}),(0,r.jsx)(n.Typography,{variant:"caption",sx:{display:"block",textAlign:"center",p:.5,mb:1,color:E===t+1?"primary.main":"",fontWeight:E===t+1?"bold":"normal"},children:t+1})]},t+1))}):null,To=()=>{let e=w(m?.name||"",v);if(Br&&!(e==="spreadsheet"))return(0,r.jsx)(n.Box,{sx:{display:"flex",height:"100%",width:"100%",alignItems:"center",justifyContent:"center"},children:(0,r.jsx)(dt.LoadingProgress,{visible:ze,exitDelay:100,onComplete:mo})});if(ft)return(0,r.jsxs)(n.Box,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column",children:[(0,r.jsx)(n.Typography,{color:"error",variant:"h6",children:ft}),(0,r.jsx)(n.Typography,{color:"text.secondary",variant:"body2",sx:{mt:1},children:"\uD30C\uC77C\uC744 \uB2E4\uC6B4\uB85C\uB4DC\uD558\uC5EC \uD655\uC778\uD574\uC8FC\uC138\uC694."})]});if(!C)return null;switch(e){case"image":return(0,r.jsx)(n.Box,{ref:Qe,"data-allow-pinch":"true",onPointerDown:ro,onPointerMove:oo,onPointerUp:zt,onPointerCancel:zt,sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,overflow:"hidden",height:"100%",backgroundColor:"grey.100",p:2,touchAction:"none",overscrollBehavior:"contain",userSelect:"none","&:active":{cursor:"grabbing"}},children:(0,r.jsx)("img",{ref:to,src:C,alt:m.name,draggable:!1,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",display:"block",transform:"translate(0px, 0px) scale(1) rotate(0deg)",transformOrigin:"center center",pointerEvents:"none"}})});case"pdf":return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.Box,{ref:Vt,sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",backgroundColor:"grey.100",position:"relative",overflow:"hidden"},children:[!y&&qt(),(0,r.jsx)(n.Box,{ref:Xr,className:"draggable-scroll",onMouseDown:o=>{let s=o.currentTarget;Nt(o,s)},"data-allow-pinch":"true",onPointerDown:ao,onPointerMove:so,onPointerUp:_t,onPointerCancel:_t,sx:{flex:1,display:"flex",flexDirection:"column",overflow:"auto",height:"100%",py:y?0:2,overflowAnchor:"none",touchAction:"pan-x pan-y","& > .react-pdf__Document":{m:"auto",...y&&{px:`${vo}px`,py:`${wo}px`},...bo&&{"& .react-pdf__Page__canvas":{width:`${Kt}px !important`,height:"auto !important"}}}},children:(0,r.jsx)(_.Document,{file:C,onLoadSuccess:jr,onLoadError:o=>{console.error("PDF \uB85C\uB4DC \uC624\uB958:",o),me("PDF \uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")},loading:(0,r.jsx)("div",{style:{display:"none"}}),error:(0,r.jsxs)(n.Box,{sx:{textAlign:"center",p:4},children:[(0,r.jsx)(n.Typography,{color:"error",variant:"h6",sx:{mb:2},children:"PDF\uB97C \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."}),(0,r.jsx)(n.Typography,{color:"text.secondary",variant:"body2",children:"\uD30C\uC77C\uC744 \uB2E4\uC6B4\uB85C\uB4DC\uD558\uC5EC \uD655\uC778\uD574\uC8FC\uC138\uC694."})]}),options:Pt,children:(0,r.jsx)(_.Page,{pageNumber:E,width:ot,rotate:X===0?void 0:fo,loading:(0,r.jsx)("div",{style:{display:"none"}}),renderAnnotationLayer:!1,renderTextLayer:!1,onLoadSuccess:Or,onRenderSuccess:Ot,onRenderError:Ot})})})]}),y&&(0,r.jsx)(n.Drawer,{anchor:"left",open:Vr,onClose:()=>Oe(!1),sx:{zIndex:o=>o.zIndex.modal+2},children:qt()})]});case"text":case"code":return(0,r.jsx)(n.Box,{sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",flexDirection:"column"},children:xt?(0,r.jsx)(n.Box,{sx:{flex:1,height:"100%",overflow:"hidden"},children:(0,r.jsx)(lt.default,{height:"100%",language:Re(m.name),value:xt,theme:"vs-dark",loading:!1,options:{readOnly:!0,domReadOnly:!0,minimap:{enabled:!0},scrollBeyondLastLine:!1,automaticLayout:!0,folding:!0,foldingHighlight:!1,formatOnPaste:!0,formatOnType:!0,wordWrap:"on",lineNumbers:"on",lineNumbersMinChars:4,glyphMargin:!1,renderLineHighlight:"none",renderWhitespace:"selection",fontFamily:"'Roboto', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace",fontSize:oe,lineHeight:Math.round(oe*1.5),scrollbar:{vertical:"auto",horizontal:"auto"},lineDecorationsWidth:10},onMount:(o,s)=>{o.onDidAttemptReadOnlyEdit(()=>{});let c=o.getDomNode();if(c){let l=document.createElement("style");l.textContent=`
|
|
1
|
+
"use strict";var kr=Object.create;var Ee=Object.defineProperty;var Lr=Object.getOwnPropertyDescriptor;var Er=Object.getOwnPropertyNames;var Fr=Object.getPrototypeOf,Rr=Object.prototype.hasOwnProperty;var Pr=(a,d)=>{for(var u in d)Ee(a,u,{get:d[u],enumerable:!0})},eo=(a,d,u,p)=>{if(d&&typeof d=="object"||typeof d=="function")for(let k of Er(d))!Rr.call(a,k)&&k!==u&&Ee(a,k,{get:()=>d[k],enumerable:!(p=Lr(d,k))||p.enumerable});return a};var f=(a,d,u)=>(u=a!=null?kr(Fr(a)):{},eo(d||!a||!a.__esModule?Ee(u,"default",{value:a,enumerable:!0}):u,a)),Sr=a=>eo(Ee({},"__esModule",{value:!0}),a);var Wr={};Pr(Wr,{FileTypeIcon:()=>pt,FileViewer:()=>ut,FileViewerDefault:()=>ko,HtmlIcon:()=>le,ImageIcon:()=>G,PdfIcon:()=>K,ZipIcon:()=>de,ensureFileExtension:()=>oo,getEditorLanguage:()=>Re,getFileType:()=>Fe,getFileTypeFromMime:()=>nt,getFileTypeIcon:()=>ue,isFileViewerPreviewable:()=>to,resolveFileType:()=>w,saveBlobAsFile:()=>Pe});module.exports=Sr(Wr);var i=require("react"),n=require("@mui/material"),lo=f(require("@mui/icons-material/Close"),1),uo=f(require("@mui/icons-material/Menu"),1),mo=f(require("@mui/icons-material/Share"),1),po=f(require("@mui/icons-material/Download"),1),ho=f(require("@mui/icons-material/Add"),1),fo=f(require("@mui/icons-material/Remove"),1),go=f(require("@mui/icons-material/RotateLeft"),1),xo=f(require("@mui/icons-material/RotateRight"),1),yo=f(require("@mui/icons-material/FitScreen"),1),Be=f(require("@mui/icons-material/KeyboardArrowLeft"),1),De=f(require("@mui/icons-material/KeyboardArrowRight"),1),bo=f(require("@mui/icons-material/TextSnippet"),1),vo=f(require("@mui/icons-material/VideoFile"),1),wo=f(require("@mui/icons-material/AudioFile"),1),Mo=f(require("@mui/icons-material/Description"),1),Co=f(require("@mui/icons-material/InsertDriveFile"),1),ct=f(require("@mui/icons-material/Code"),1),To=f(require("@mui/icons-material/TableView"),1),_=require("react-pdf"),lt=f(require("@monaco-editor/react"),1),Io=f(require("react-spreadsheet"),1),ce=f(require("xlsx"),1),dt=require("@ehfuse/mui-fadeout-loading-progress");var Fe=a=>{let d=a.split(".").pop()?.toLowerCase()||"";return["jpg","jpeg","png","gif","bmp","webp","svg"].includes(d)?"image":d==="pdf"?"pdf":["txt","json","xml","log","md","markdown"].includes(d)?"text":["csv","xls","xlsx"].includes(d)?"spreadsheet":["html","htm"].includes(d)?"html":["js","jsx","ts","tsx","css","scss","sass","less","php","py","java","c","cpp","h","hpp","cs","go","rs","rb","swift","kt","scala","sql","sh","bash","bat","ps1","yml","yaml","toml","ini","conf"].includes(d)?"code":["mp4","avi","mov","wmv","flv","webm"].includes(d)?"video":["mp3","wav","ogg","m4a","aac"].includes(d)?"audio":["doc","docx","ppt","pptx","hwp","hwpx"].includes(d)?"office":"unsupported"},nt=a=>{let d=(a||"").toLowerCase().split(";")[0].trim();return d?d.startsWith("image/")?"image":d==="application/pdf"?"pdf":d.startsWith("video/")?"video":d.startsWith("audio/")?"audio":d==="text/html"?"html":d==="text/csv"||d==="application/vnd.ms-excel"||d==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"?"spreadsheet":d.startsWith("text/")||d==="application/json"||d==="application/xml"?"text":"unsupported":"unsupported"},w=(a,d)=>{let u=Fe(a);return u!=="unsupported"?u:nt(d)},Br=new Set(["image","pdf","text","code","html","spreadsheet","video","audio"]),to=a=>Br.has(Fe(a)),Dr={"image/jpeg":"jpg","image/png":"png","image/gif":"gif","image/webp":"webp","image/bmp":"bmp","image/svg+xml":"svg","application/pdf":"pdf","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/vnd.ms-excel":"xls","text/csv":"csv","text/plain":"txt","application/json":"json","text/xml":"xml","application/xml":"xml","text/html":"html","video/mp4":"mp4","video/webm":"webm","audio/mpeg":"mp3","audio/wav":"wav"},oo=(a,d)=>{let u=(a??"").trim()||"\uCCA8\uBD80\uD30C\uC77C";if(/\.[a-z0-9]+$/i.test(u))return u;let p=(d??"").trim().toLowerCase().split(";")[0],k=Dr[p]??"";return k?`${u}.${k}`:u},Re=a=>{let d=a.split(".").pop()?.toLowerCase()||"";return{js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",html:"html",htm:"html",css:"css",scss:"scss",sass:"scss",less:"less",json:"json",xml:"xml",php:"php",py:"python",java:"java",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",go:"go",rs:"rust",rb:"ruby",swift:"swift",kt:"kotlin",scala:"scala",sql:"sql",sh:"shell",bash:"shell",bat:"bat",ps1:"powershell",yml:"yaml",yaml:"yaml",toml:"toml",ini:"ini",conf:"ini",md:"markdown",markdown:"markdown",txt:"plaintext",log:"plaintext",csv:"plaintext"}[d]||"plaintext"};var zr=a=>(a||"").replace(/[\\/:*?"<>|\r\n]/g,"_").trim()||"download",Pe=(a,d)=>{let u=URL.createObjectURL(a),p=document.createElement("a");p.href=u,p.download=zr(d),p.rel="noopener",document.body.appendChild(p),p.click(),p.remove(),window.setTimeout(()=>URL.revokeObjectURL(u),6e4)};var ro=async a=>{let d=URL.createObjectURL(a);try{let u=await new Promise((Y,q)=>{let P=new Image;P.onload=()=>Y(P),P.onerror=()=>q(new Error("\uC774\uBBF8\uC9C0\uB97C \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")),P.src=d}),p=document.createElement("canvas");p.width=u.naturalWidth||u.width||1024,p.height=u.naturalHeight||u.height||1024;let k=p.getContext("2d");if(!k)throw new Error("\uCE94\uBC84\uC2A4\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");return k.drawImage(u,0,0,p.width,p.height),await new Promise((Y,q)=>{p.toBlob(P=>P?Y(P):q(new Error("PNG \uBCC0\uD658 \uC2E4\uD328")),"image/png")})}finally{URL.revokeObjectURL(d)}};var Se=require("@mui/material");function no(){let a=(0,Se.useTheme)();return!(0,Se.useMediaQuery)(a.breakpoints.up("lg"))}var H=require("react/jsx-runtime");function G(a){return(0,H.jsxs)("svg",{id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 501.551 501.551",xmlSpace:"preserve",width:a.width||"22px",...a,children:[(0,H.jsx)("path",{style:{fill:"#F2F2F2"},d:"M480.653,0H20.898C9.404,0,0,9.404,0,20.898v459.755c0,11.494,9.404,20.898,20.898,20.898h459.755 c11.494,0,20.898-9.404,20.898-20.898V20.898C501.551,9.404,492.147,0,480.653,0z"}),(0,H.jsx)("rect",{x:36.571,y:36.571,style:{fill:"#84DBFF"},width:428.408,height:345.861}),(0,H.jsx)("path",{style:{fill:"#334A5E"},d:"M261.224,382.433H36.571v-87.771c17.763-5.224,37.616-7.314,57.469-7.314 c25.078,0,50.155,4.18,71.053,12.539c6.269,2.09,11.494,4.18,16.718,7.314C218.384,323.918,246.596,350.041,261.224,382.433z"}),(0,H.jsx)("path",{style:{fill:"#40596B"},d:"M464.98,271.673v110.759H127.478c9.404-29.257,29.257-55.38,55.38-76.278 c42.841-34.482,103.445-55.38,172.408-55.38C393.927,250.776,432.588,258.09,464.98,271.673z"}),(0,H.jsxs)("g",{children:[(0,H.jsx)("circle",{style:{fill:"#FFFFFF"},cx:122.253,cy:122.253,r:42.841}),(0,H.jsx)("path",{style:{fill:"#FFFFFF"},d:"M433.633,101.355c1.045-3.135,1.045-6.269,1.045-9.404c0-16.718-13.584-31.347-31.347-31.347 c-11.494,0-21.943,6.269-27.167,15.673c-3.135-2.09-7.314-2.09-11.494-2.09c-14.629,0-26.122,10.449-28.212,24.033 c-8.359,2.09-14.629,9.404-14.629,17.763c0,10.449,8.359,18.808,18.808,18.808h82.547c10.449,0,18.808-8.359,18.808-18.808 C441.992,109.714,438.857,104.49,433.633,101.355z"})]})]})}var M=require("react/jsx-runtime");function K(a){return(0,M.jsx)("svg",{id:"_x35_",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512",xmlSpace:"preserve",width:a.width||"28px",...a,children:(0,M.jsxs)("g",{children:[(0,M.jsx)("polygon",{style:{fill:"#B12A27"},points:"475.435,117.825 475.435,512 47.791,512 47.791,0.002 357.613,0.002 412.491,54.881 "}),(0,M.jsx)("rect",{x:36.565,y:34.295,style:{fill:"#F2F2F2"},width:205.097,height:91.768}),(0,M.jsxs)("g",{children:[(0,M.jsxs)("g",{children:[(0,M.jsx)("path",{style:{fill:"#B12A27"},d:"M110.132,64.379c-0.905-2.186-2.111-4.146-3.769-5.804c-1.658-1.658-3.694-3.015-6.031-3.92 c-2.412-0.98-5.126-1.432-8.141-1.432H69.651v58.195h11.383V89.481h11.157c3.015,0,5.729-0.452,8.141-1.432 c2.337-0.905,4.372-2.261,6.031-3.92c1.659-1.658,2.865-3.543,3.769-5.804c0.829-2.186,1.282-4.523,1.282-6.935 C111.413,68.902,110.961,66.565,110.132,64.379z M97.844,77.118c-1.508,1.432-3.618,2.186-6.181,2.186H81.034V63.323h10.629 c2.563,0,4.674,0.754,6.181,2.261c1.432,1.432,2.186,3.392,2.186,5.804C100.031,73.726,99.277,75.686,97.844,77.118z"}),(0,M.jsx)("path",{style:{fill:"#B12A27"},d:"M164.558,75.761c-0.075-2.035-0.151-3.844-0.377-5.503c-0.226-1.659-0.603-3.166-1.131-4.598 c-0.528-1.357-1.206-2.714-2.111-3.92c-2.035-2.94-4.523-5.126-7.312-6.483c-2.865-1.357-6.257-2.035-10.252-2.035h-20.956 v58.195h20.956c3.995,0,7.387-0.678,10.252-2.035c2.789-1.357,5.277-3.543,7.312-6.483c0.905-1.206,1.583-2.563,2.111-3.92 c0.528-1.432,0.905-2.94,1.131-4.598c0.226-1.658,0.301-3.468,0.377-5.503c0.075-1.96,0.075-4.146,0.075-6.558 C164.633,79.908,164.633,77.721,164.558,75.761z M153.175,88.2c0,1.734-0.151,3.091-0.302,4.297 c-0.151,1.131-0.377,2.186-0.678,2.94c-0.301,0.829-0.754,1.583-1.281,2.261c-1.885,2.412-4.749,3.543-8.518,3.543h-8.669V63.323 h8.669c3.769,0,6.634,1.206,8.518,3.618c0.528,0.678,0.98,1.357,1.281,2.186s0.528,1.809,0.678,3.015 c0.151,1.131,0.302,2.563,0.302,4.221c0.075,1.659,0.075,3.694,0.075,5.955C153.251,84.581,153.251,86.541,153.175,88.2z"}),(0,M.jsx)("path",{style:{fill:"#B12A27"},d:"M213.18,63.323V53.222h-38.37v58.195h11.383V87.823h22.992V77.646h-22.992V63.323H213.18z"})]}),(0,M.jsx)("g",{children:(0,M.jsx)("path",{style:{fill:"#B12A27"},d:"M110.132,64.379c-0.905-2.186-2.111-4.146-3.769-5.804c-1.658-1.658-3.694-3.015-6.031-3.92 c-2.412-0.98-5.126-1.432-8.141-1.432H69.651v58.195h11.383V89.481h11.157c3.015,0,5.729-0.452,8.141-1.432 c2.337-0.905,4.372-2.261,6.031-3.92c1.659-1.658,2.865-3.543,3.769-5.804c0.829-2.186,1.282-4.523,1.282-6.935 C111.413,68.902,110.961,66.565,110.132,64.379z M97.844,77.118c-1.508,1.432-3.618,2.186-6.181,2.186H81.034V63.323h10.629 c2.563,0,4.674,0.754,6.181,2.261c1.432,1.432,2.186,3.392,2.186,5.804C100.031,73.726,99.277,75.686,97.844,77.118z"})})]}),(0,M.jsx)("polygon",{style:{opacity:.08,fill:"#040000"},points:"475.435,117.825 475.435,512 47.791,512 47.791,419.581 247.705,219.667 259.54,207.832 266.098,201.273 277.029,190.343 289.995,177.377 412.491,54.881 "}),(0,M.jsx)("polygon",{style:{fill:"#771B1B"},points:"475.435,117.836 357.599,117.836 357.599,0 "}),(0,M.jsx)("g",{children:(0,M.jsx)("path",{style:{fill:"#F2F2F2"},d:"M414.376,370.658c-2.488-4.372-5.88-8.518-10.101-12.287c-3.467-3.166-7.538-6.106-12.137-8.82 c-18.544-10.93-45.003-16.207-80.961-16.207h-3.618c-1.96-1.809-3.995-3.618-6.106-5.503 c-13.644-12.287-24.499-25.63-32.942-40.48c16.584-36.561,24.499-69.126,23.519-96.867c-0.151-4.674-0.829-9.046-2.035-13.117 c-1.809-6.558-4.824-12.363-9.046-17.112c-0.075-0.075-0.075-0.075-0.151-0.151c-6.709-7.538-16.056-11.835-25.555-11.835 c-9.574,0-18.393,4.146-24.801,11.76c-6.332,7.538-9.724,17.866-9.875,30.002c-0.226,18.544,1.281,36.108,4.448,52.315 c0.301,1.282,0.528,2.563,0.829,3.844c3.166,14.7,7.84,28.645,13.87,41.611c-7.086,14.398-14.247,26.836-19.223,35.279 c-3.769,6.408-7.915,13.117-12.212,19.826c-19.373,3.468-35.807,7.689-50.129,12.966c-19.373,7.011-34.902,16.056-46.059,26.836 c-7.237,6.935-12.137,14.323-14.549,22.012c-2.563,7.915-2.412,15.83,0.452,22.916c2.638,6.558,7.387,12.061,13.72,15.83 c1.508,0.905,3.091,1.658,4.749,2.337c4.825,1.96,10.101,3.015,15.604,3.015c12.74,0,25.856-5.503,36.937-15.378 c20.655-18.469,41.988-48.169,54.577-66.94c10.327-1.583,21.559-2.94,34.224-4.297c14.926-1.508,28.118-2.412,40.104-2.865 c3.694,3.317,7.237,6.483,10.629,9.498c18.846,16.81,33.168,28.947,46.134,37.465c0,0.075,0.075,0.075,0.151,0.075 c5.126,3.392,10.026,6.181,14.926,8.443c5.503,2.563,11.081,3.92,16.81,3.92c7.237,0,14.021-2.186,19.675-6.181 c5.729-4.146,9.875-10.101,11.76-16.81C420.18,387.694,418.899,378.724,414.376,370.658z M247.705,219.667 c-1.055-9.348-1.508-19.072-1.357-29.324c0.151-9.724,3.694-16.283,8.895-16.283c3.92,0,8.066,3.543,9.95,10.327 c0.528,2.035,0.905,4.372,0.98,7.01c0.151,3.166,0.075,6.483-0.075,9.875c-0.452,9.574-2.111,19.75-4.975,30.681 c-1.734,7.011-3.995,14.323-6.784,21.936C251.173,243.186,248.911,231.803,247.705,219.667z M121.967,418.073 c-1.282-3.166,0.151-9.272,7.991-16.81c11.986-11.458,30.756-20.504,56.914-27.364c-4.975,6.784-9.875,12.966-14.624,18.619 c-7.237,8.744-14.172,16.132-20.429,21.71c-5.352,4.824-11.232,7.84-16.81,8.594c-0.98,0.151-1.96,0.226-2.94,0.226 C127.168,423.049,123.173,421.089,121.967,418.073z M242.428,337.942l0.528-0.829l-0.829,0.151 c0.151-0.377,0.377-0.754,0.603-1.055c3.166-5.352,7.161-12.212,11.458-20.127l0.377,0.829l0.98-2.035 c3.166,4.523,6.634,8.971,10.252,13.267c1.734,2.035,3.543,3.995,5.352,5.955l-1.206,0.075l1.055,0.98 c-3.091,0.226-6.332,0.528-9.574,0.829c-2.035,0.226-4.146,0.377-6.257,0.603C250.796,337.037,246.499,337.49,242.428,337.942z M369.297,384.98c-8.971-5.729-18.996-13.795-31.359-24.575c17.564,1.809,31.359,5.654,41.159,11.383 c4.297,2.488,7.538,5.051,9.724,7.538c3.618,3.844,4.9,7.312,4.221,9.649c-0.603,2.337-3.241,3.92-6.483,3.92 c-1.885,0-3.844-0.452-5.88-1.432c-3.468-1.658-7.086-3.694-10.93-6.181C369.598,385.282,369.448,385.131,369.297,384.98z"})})]})})}var o=require("react/jsx-runtime");var Hr="/pdfjs",io=32,ao=240,Vr=8192,it=.25,at=8,st=80,so=80,Ar=a=>{switch(a){case"image":return(0,o.jsx)(G,{});case"pdf":return(0,o.jsx)(K,{});case"text":return(0,o.jsx)(bo.default,{sx:{mr:1,color:"#66BB6A"}});case"spreadsheet":return(0,o.jsx)(To.default,{sx:{mr:1,color:"#4CAF50"}});case"html":return(0,o.jsx)(ct.default,{sx:{mr:1,color:"#E91E63"}});case"code":return(0,o.jsx)(ct.default,{sx:{mr:1,color:"#2196F3"}});case"video":return(0,o.jsx)(vo.default,{sx:{mr:1,color:"#AB47BC"}});case"audio":return(0,o.jsx)(wo.default,{sx:{mr:1,color:"#FF7043"}});case"office":return(0,o.jsx)(Mo.default,{sx:{mr:1,color:"#FFA726"}});default:return(0,o.jsx)(Co.default,{sx:{mr:1,color:"#78909C"}})}},co=a=>typeof a?.rotate=="number"?a.rotate:typeof a?._pageInfo?.rotate=="number"?a._pageInfo.rotate:0,ut=({open:a,onClose:d,file:u,files:p=null,initialIndex:k=0,loadFile:Y,onDownload:q,onShare:P,pdfAssetBase:Z=Hr})=>{let x=no(),Do=(0,n.useTheme)(),j=(0,n.useMediaQuery)(Do.breakpoints.down("sm")),b=(0,i.useMemo)(()=>p&&p.length>0?p:[],[p]),[Q,V]=(0,i.useState)(0);(0,i.useEffect)(()=>{a&&V(b.length>0?Math.min(Math.max(k,0),b.length-1):0)},[a,k,b]);let m=b.length>0?b[Q]??u:u,[ze,He]=(0,i.useState)(!0),[zo,ht]=(0,i.useState)(!1),[C,Ve]=(0,i.useState)(""),[T,D]=(0,i.useState)(1),[X,oe]=(0,i.useState)(0),[ft,me]=(0,i.useState)(""),[v,gt]=(0,i.useState)(""),[xt,pe]=(0,i.useState)(""),[re,he]=(0,i.useState)(14),[Ae,fe]=(0,i.useState)(""),[Xe,yt]=(0,i.useState)("preview"),[We,ne]=(0,i.useState)([]),[bt,vt]=(0,i.useState)([]),[Ho,_e]=(0,i.useState)(""),[Ye,wt]=(0,i.useState)(null),[Mt,ge]=(0,i.useState)(!1),[Vo,je]=(0,i.useState)(!0),[Ct,xe]=(0,i.useState)(""),[L,Tt]=(0,i.useState)(),[E,O]=(0,i.useState)(1),[Ao,Oe]=(0,i.useState)(!1),[ye,It]=(0,i.useState)("portrait"),[Xo,kt]=(0,i.useState)(0),[Ne,Lt]=(0,i.useState)(0),[ie,Et]=(0,i.useState)({width:0,height:0}),Ft=(0,i.useRef)([]),Ue=(0,i.useRef)(null),N=(0,i.useRef)(null),$e=(0,i.useRef)(null),Ge=(0,i.useRef)(null),Wo=(0,i.useCallback)(e=>{if($e.current?.disconnect(),Ge.current?.(),Ge.current=null,N.current=e,!e){$e.current=null;return}let t=c=>{c.touches.length>=2&&c.preventDefault()};e.addEventListener("touchmove",t,{passive:!1}),Ge.current=()=>e.removeEventListener("touchmove",t);let r=new ResizeObserver(c=>{let l=c[0]?.contentRect;l&&Et({width:l.width,height:l.height})});r.observe(e),$e.current=r;let s=e.getBoundingClientRect();Et({width:s.width,height:s.height})},[]),[be,Rt]=(0,i.useState)(!1),[Ke,_o]=(0,i.useState)({x:0,y:0}),[qe,Yo]=(0,i.useState)({x:0,y:0}),jo=(0,i.useCallback)(async(e,t)=>{let r=URL.createObjectURL(e);Ve(r),gt(e.type||"");let s=w(t,e.type||"");if(s==="text"||s==="code"){let l=await e.text();pe(l);return}if(s==="html"){let l=await e.text();fe(l);return}if(s!=="spreadsheet")return;let c=t.split(".").pop()?.toLowerCase()||"";if(c==="csv"){let h=(await e.text()).split(`
|
|
2
|
+
`).map(g=>g.split(",").map(B=>({value:B.trim()})));ne(h);return}if(c==="xls"||c==="xlsx"){ge(!0),je(!0);let l=await e.arrayBuffer(),h=ce.read(l,{type:"array"});vt(h.SheetNames),wt(h);let g=h.SheetNames[0];_e(g),tt(h,g)}},[]),ae=(0,i.useRef)(null),Ze=(0,i.useCallback)(async e=>{if(e.blob)return e.blob;if(Y)return await Y(e);if(e.url){let t=await fetch(e.url);if(!t.ok)throw new Error("\uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");return await t.blob()}throw new Error("\uD30C\uC77C \uB370\uC774\uD130 \uC18C\uC2A4(blob/url/loadFile)\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.")},[Y]);(0,i.useEffect)(()=>(m&&a?$o():(C&&URL.revokeObjectURL(C),ae.current=null,Ve(""),pe(""),fe(""),ne([]),he(14),D(1),oe(0)),()=>{C&&URL.revokeObjectURL(C)}),[m,a]);let Oo=({numPages:e})=>{Tt(e),O(1),ke.current=!0},No=e=>{let{width:t,height:r}=Uo(e);kt(co(e)),t>0&&r>0&&Lt(t/r);let s=t>r?"landscape":"portrait";It(s)},Uo=e=>{let t=e?.width||0,r=e?.height||0,s=co(e);try{if(typeof e?.getViewport=="function"){let c=e.getViewport({scale:1,rotation:s});t=c.width,r=c.height}}catch(c){console.warn("[FileViewer] getViewport \uC2E4\uD328 - \uAE30\uBCF8 width/height\uB85C \uB300\uCCB4",c)}return{width:t,height:r}},ve=(0,i.useCallback)(()=>{O(e=>Math.max(e-1,1))},[]),we=(0,i.useCallback)(()=>{O(e=>Math.min(e+1,L||1))},[L]),Pt=(0,i.useMemo)(()=>({cMapUrl:`${Z}/cmaps/`,cMapPacked:!0,standardFontDataUrl:`${Z}/standard_fonts/`,wasmUrl:`${Z}/wasm/`}),[Z]);(0,i.useEffect)(()=>{typeof window>"u"||(_.pdfjs.GlobalWorkerOptions.workerSrc=`${Z}/pdf.worker.min.mjs`)},[Z]),(0,i.useEffect)(()=>{if(!a||b.length<=1||w(m?.name||"",v)==="pdf")return;let e=t=>{t.key==="ArrowLeft"?(t.preventDefault(),V(r=>Math.max(r-1,0))):t.key==="ArrowRight"&&(t.preventDefault(),V(r=>Math.min(r+1,b.length-1)))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a,b.length,m?.name,v]),(0,i.useEffect)(()=>{if(!a||b.length<=1||w(m?.name||"",v)==="pdf"||T>1)return;let e=0,t=0,r=c=>{e=c.touches[0]?.clientX??0,t=c.touches[0]?.clientY??0},s=c=>{let l=(c.changedTouches[0]?.clientX??0)-e,h=(c.changedTouches[0]?.clientY??0)-t;Math.abs(l)<60||Math.abs(h)>Math.abs(l)||(l<0?V(g=>Math.min(g+1,b.length-1)):V(g=>Math.max(g-1,0)))};return document.addEventListener("touchstart",r,{passive:!0}),document.addEventListener("touchend",s,{passive:!0}),()=>{document.removeEventListener("touchstart",r),document.removeEventListener("touchend",s)}},[a,b.length,m?.name,v,T]),(0,i.useEffect)(()=>{if(!a||w(m?.name||"",v)!=="pdf")return;let e=r=>{switch(r.key){case"ArrowLeft":case"ArrowUp":r.preventDefault(),ve();break;case"ArrowRight":case"ArrowDown":r.preventDefault(),we();break;case"Home":r.preventDefault(),O(1);break;case"End":r.preventDefault(),L&&O(L);break}},t=r=>{r.ctrlKey||Math.abs(r.deltaY)>50&&(r.preventDefault(),r.deltaY>0?we():ve())};return document.addEventListener("keydown",e),document.addEventListener("wheel",t,{passive:!1}),()=>{document.removeEventListener("keydown",e),document.removeEventListener("wheel",t)}},[a,m,v,ve,we,L]),(0,i.useEffect)(()=>{if(!L||!a||w(m?.name||"",v)!=="pdf")return;if(E===1&&Ue.current){Ue.current.scrollTo({top:0,behavior:"smooth"});return}let e=Ft.current[E-1];e&&e.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},[a,m,v,L,E]),(0,i.useEffect)(()=>{if(ze){let e=window.setTimeout(()=>ht(!0),180);return()=>window.clearTimeout(e)}},[ze]);let $o=async()=>{if(m){He(!0),me(""),gt(""),pe(""),fe(""),ne([]);try{let e=await Ze(m);ae.current=e,await jo(e,m.name)}catch(e){console.error("\uD30C\uC77C \uB85C\uB4DC \uC624\uB958:",e),me("\uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")}finally{He(!1)}}},Go=async()=>{if(m)try{if(q){await q(m);return}let e=ae.current??await Ze(m);Pe(e,m.name)}catch(e){console.error("\uD30C\uC77C \uB2E4\uC6B4\uB85C\uB4DC \uC624\uB958:",e)}},Ko=typeof navigator<"u"&&typeof navigator.share=="function"&&typeof navigator.canShare=="function",qo=!!P||Ko,Zo=async()=>{if(m)try{if(P){await P(m);return}let e=ae.current??await Ze(m),t=e.type||(typeof m.mimeType=="string"?m.mimeType:"")||"application/octet-stream",r=new File([e],m.name,{type:t});navigator.canShare({files:[r]})?await navigator.share({files:[r],title:m.name}):console.warn("\uC774 \uAE30\uAE30\uB294 \uC774 \uD30C\uC77C \uD615\uC2DD\uC758 \uACF5\uC720\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.")}catch(e){if(e?.name==="AbortError")return;console.error("\uD30C\uC77C \uACF5\uC720 \uC624\uB958:",e)}},Qo=()=>{let e=m?w(m.name,v):"";e==="text"||e==="html"||e==="code"||e==="spreadsheet"?he(t=>Math.min(t+2,24)):D(e==="pdf"?t=>Math.min(t+.25,at):t=>Math.min(t+.25,3))},Jo=()=>{let e=m?w(m.name,v):"";e==="text"||e==="html"||e==="code"||e==="spreadsheet"?he(t=>Math.max(t-2,10)):D(e==="pdf"?t=>Math.max(t-.25,it):t=>Math.max(t-.25,.25))},y=(0,i.useRef)(new Map),er=e=>Math.min(Math.max(e,.25),3),tr=e=>Math.min(Math.max(e,it),at),Qe=(0,i.useRef)(null),Me=(0,i.useRef)(null),A=(0,i.useRef)({scale:1,tx:0,ty:0,rotation:0}),W=(0,i.useRef)(0),J=(0,i.useRef)(null),Ce=(0,i.useRef)(null),Te=(0,i.useCallback)((e,t,r,s)=>{let c=Qe.current,l=Me.current;if(!c||!l)return{tx:t,ty:r};let h=l.offsetWidth,g=l.offsetHeight,B=(Math.round(s/90)%4+4)%4;if(B===1||B===3){let Ir=h;h=g,g=Ir}let z=h*e,Zt=g*e,Qt=z>c.clientWidth?(z+c.clientWidth)/2-so:0,Jt=Zt>c.clientHeight?(Zt+c.clientHeight)/2-so:0;return{tx:Math.min(Qt,Math.max(-Qt,t)),ty:Math.min(Jt,Math.max(-Jt,r))}},[]),St=(0,i.useCallback)((e,t)=>{let r=Qe.current,s=Me.current;if(!r||!s)return e>1;let c=(Math.round(t/90)%4+4)%4,l=c===1||c===3,h=l?s.offsetHeight:s.offsetWidth,g=l?s.offsetWidth:s.offsetHeight;return h*e>r.clientWidth+1||g*e>r.clientHeight+1},[]),U=(0,i.useCallback)(e=>{let t=Me.current;if(!t)return;let{scale:r,tx:s,ty:c,rotation:l}=A.current;t.style.transition=e?"transform 0.25s ease":"none",t.style.transform=`translate(${s}px, ${c}px) scale(${r}) rotate(${l}deg)`},[]),Bt=(0,i.useCallback)(()=>{let e=A.current,t=Te(e.scale,e.tx,e.ty,e.rotation);e.tx=t.tx,e.ty=t.ty,!W.current&&(W.current=requestAnimationFrame(()=>{W.current=0,U(!1)}))},[U,Te]),Dt=(0,i.useCallback)(()=>{W.current&&(cancelAnimationFrame(W.current),W.current=0),y.current.clear(),J.current=null,Ce.current=null},[]),or=(0,i.useCallback)(e=>{Me.current=e,e&&(A.current={scale:1,tx:0,ty:0,rotation:0},U(!1))},[U]);(0,i.useEffect)(()=>{if(w(m?.name||"",v)!=="image")return;let e=A.current;e.scale=T,e.rotation=X;let t=Te(e.scale,e.tx,e.ty,e.rotation);e.tx=t.tx,e.ty=t.ty,U(!0)},[T,X,m,v,C,U,Te]),(0,i.useEffect)(()=>()=>{W.current&&cancelAnimationFrame(W.current)},[]);let rr=e=>{e.currentTarget.setPointerCapture?.(e.pointerId),y.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=[...y.current.values()],r=A.current;if(t.length===2){J.current=null;let s=e.currentTarget.getBoundingClientRect();Ce.current={startDist:Math.hypot(t[0].x-t[1].x,t[0].y-t[1].y)||1,baseScale:r.scale,baseTx:r.tx,baseTy:r.ty,startMidX:(t[0].x+t[1].x)/2,startMidY:(t[0].y+t[1].y)/2,centerX:s.left+s.width/2,centerY:s.top+s.height/2}}else t.length===1&&St(r.scale,r.rotation)&&(J.current={startX:e.clientX,startY:e.clientY,baseTx:r.tx,baseTy:r.ty})},nr=e=>{if(!y.current.has(e.pointerId))return;y.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=A.current,r=Ce.current,s=[...y.current.values()];if(r&&s.length>=2){let l=Math.hypot(s[0].x-s[1].x,s[0].y-s[1].y),h=(s[0].x+s[1].x)/2,g=(s[0].y+s[1].y)/2,B=er(r.baseScale*l/r.startDist),z=B/r.baseScale;t.scale=B,t.tx=h-r.centerX-z*(r.startMidX-r.centerX-r.baseTx),t.ty=g-r.centerY-z*(r.startMidY-r.centerY-r.baseTy),Bt();return}let c=J.current;c&&s.length===1&&(t.tx=c.baseTx+(e.clientX-c.startX),t.ty=c.baseTy+(e.clientY-c.startY),Bt())},zt=e=>{if(!y.current.has(e.pointerId))return;y.current.delete(e.pointerId),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId);let t=A.current;if(y.current.size<2&&(Ce.current=null,Math.abs(t.scale-T)>.001&&D(t.scale)),y.current.size===0)J.current=null;else if(y.current.size===1&&St(t.scale,t.rotation)){let r=[...y.current.values()][0];J.current={startX:r.x,startY:r.y,baseTx:t.tx,baseTy:t.ty}}},Ht=(0,i.useCallback)(async()=>{if(C)try{let t=await(await fetch(C)).blob(),r=t.type==="image/png"?t:await ro(t);await navigator.clipboard.write([new ClipboardItem({"image/png":r})]),xe("\uC774\uBBF8\uC9C0\uB97C \uD074\uB9BD\uBCF4\uB4DC\uC5D0 \uBCF5\uC0AC\uD588\uC2B5\uB2C8\uB2E4.")}catch(e){console.error("\uC774\uBBF8\uC9C0 \uBCF5\uC0AC \uC624\uB958:",e),xe("\uC774\uBBF8\uC9C0\uB97C \uBCF5\uC0AC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")}},[C]);(0,i.useEffect)(()=>{if(!a||w(m?.name||"",v)!=="image")return;let e=t=>{if(!(t.ctrlKey||t.metaKey)||t.key.toLowerCase()!=="c")return;let r=t.target,s=r?.tagName;s==="INPUT"||s==="TEXTAREA"||r?.isContentEditable||(t.preventDefault(),Ht())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a,m,v,Ht]);let ee=(0,i.useRef)(null),S=(0,i.useRef)(0),se=(0,i.useRef)(null),te=(0,i.useRef)(null),$=()=>N.current?.querySelector(".react-pdf__Page")??null,Ie=(0,i.useRef)(null),Vt=(0,i.useRef)(null),ir=()=>{let e=Vt.current,t=$()?.querySelector("canvas");if(!e||!t||!t.width||!t.height)return!1;let r=document.createElement("canvas");r.width=t.width,r.height=t.height;let s=r.getContext("2d");if(!s)return!1;s.drawImage(t,0,0);let c=t.getBoundingClientRect(),l=e.getBoundingClientRect();return Object.assign(r.style,{position:"absolute",left:`${c.left-l.left}px`,top:`${c.top-l.top}px`,width:`${c.width}px`,height:`${c.height}px`,pointerEvents:"none",zIndex:"1"}),e.appendChild(r),Ie.current=r,!0},At=()=>{Ie.current?.remove(),Ie.current=null;let e=$();e&&(e.style.visibility="")},ar=()=>{S.current||(S.current=requestAnimationFrame(()=>{S.current=0;let e=ee.current,t=$();!e||!t||(t.style.transition="none",t.style.transformOrigin="top left",t.style.transform=`translate(${e.tx}px, ${e.ty}px) scale(${e.k})`,se.current={k:e.k,tx:e.tx,ty:e.ty,midX:e.lastMidX,midY:e.lastMidY})}))},Xt=()=>{S.current&&(cancelAnimationFrame(S.current),S.current=0),ee.current=null,te.current=null,se.current=null,At();let e=$();e&&(e.style.transform="",e.style.willChange="auto")},Wt=e=>{let t=$(),r=N.current;if(!t||!r)return;t.style.transform&&(t.style.transform="");let s=t.getBoundingClientRect(),c=r.getBoundingClientRect(),l=(e[0].x+e[1].x)/2,h=(e[0].y+e[1].y)/2;ee.current={startDist:Math.hypot(e[0].x-e[1].x,e[0].y-e[1].y)||1,rectLeft:s.left,rectTop:s.top,pageW:s.width,pageH:s.height,viewerL:c.left,viewerT:c.top,viewerR:c.right,viewerB:c.bottom,startMidX:l,startMidY:h,lastMidX:l,lastMidY:h,k:1,tx:0,ty:0},se.current={k:1,tx:0,ty:0,midX:l,midY:h},t.style.willChange="transform"},sr=e=>{if(e.pointerType!=="touch")return;y.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=[...y.current.values()];if(t.length===2){if(te.current||Ie.current)return;Wt(t)}},cr=e=>{if(!y.current.has(e.pointerId))return;y.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=ee.current,r=[...y.current.values()];if(t&&r.length>=2){e.preventDefault();let s=Math.hypot(r[0].x-r[1].x,r[0].y-r[1].y),c=Math.min(Math.max(s/t.startDist,it/(T||1)),at/(T||1)),l=(r[0].x+r[1].x)/2,h=(r[0].y+r[1].y)/2,g=l-t.rectLeft-c*(t.startMidX-t.rectLeft),B=h-t.rectTop-c*(t.startMidY-t.rectTop),z=st;g=Math.min(t.viewerR-z-t.rectLeft,Math.max(t.viewerL+z-t.rectLeft-c*t.pageW,g)),B=Math.min(t.viewerB-z-t.rectTop,Math.max(t.viewerT+z-t.rectTop-c*t.pageH,B)),t.k=c,t.tx=g,t.ty=B,t.lastMidX=l,t.lastMidY=h,ar()}},_t=e=>{if(y.current.delete(e.pointerId),y.current.size>=2)return;let t=ee.current;if(ee.current=null,!t)return;S.current&&(cancelAnimationFrame(S.current),S.current=0);let r=se.current??{k:1,tx:0,ty:0,midX:t.startMidX,midY:t.startMidY};se.current=null;let s=tr(T*r.k);if(Math.abs(s-T)<.001){let l=N.current;Xt(),l&&(l.scrollLeft-=r.tx,l.scrollTop-=r.ty);return}let c=N.current;if(c){let l=c.getBoundingClientRect();te.current={u:(r.midX-t.rectLeft-r.tx)/r.k,v:(r.midY-t.rectTop-r.ty)/r.k,offX:r.midX-l.left,offY:r.midY-l.top,factor:s/(T||1)}}if(ir()){let l=$();l&&(l.style.transform="",l.style.visibility="hidden")}D(s),Math.round(Math.min(ot*s,Gt))===rt&&requestAnimationFrame(()=>jt())},ke=(0,i.useRef)(!0),Je=(0,i.useRef)(null),Yt=()=>{let e=N.current;e&&(e.scrollLeft=(e.scrollWidth-e.clientWidth)/2,e.scrollTop=(e.scrollHeight-e.clientHeight)/2)},jt=()=>{let e=te.current;if(!e)return;te.current=null;let t=N.current,r=$();if(!t||!r)return;At(),r.style.transform="",r.style.willChange="auto";let s=r.getBoundingClientRect(),c=t.getBoundingClientRect();t.scrollLeft+=s.left-c.left+e.u*e.factor-e.offX,t.scrollTop+=s.top-c.top+e.v*e.factor-e.offY;let l=[...y.current.values()];l.length>=2&&Wt(l)},Ot=()=>{let e=`${E}:${X}`;if(te.current){Je.current=e,jt();return}(ke.current||Je.current!==e)&&(ke.current=!1,Je.current=e,Yt())};(0,i.useEffect)(()=>()=>{S.current&&cancelAnimationFrame(S.current)},[]);let lr=()=>{oe(e=>e-90)},dr=()=>{oe(e=>e+90)},ur=()=>{let e=w(m?.name||"",v);Xt(),e==="text"||e==="html"||e==="code"||e==="spreadsheet"?he(14):e==="pdf"?(D(1),T===1&&X===0?Yt():ke.current=!0):(Dt(),A.current={scale:1,tx:0,ty:0,rotation:0},U(!0),D(1)),oe(0)},Nt=(e,t)=>{Rt(!0),_o({x:e.clientX,y:e.clientY}),Yo({x:t.scrollLeft,y:t.scrollTop}),e.preventDefault()},Ut=(0,i.useCallback)((e,t)=>{if(!be)return;let r=e.clientX-Ke.x,s=e.clientY-Ke.y;t.scrollLeft=qe.x-r,t.scrollTop=qe.y-s,e.preventDefault()},[be,Ke,qe]),et=(0,i.useCallback)(()=>{Rt(!1),document.body.style.cursor="default"},[]);(0,i.useEffect)(()=>{if(be){let e=t=>{document.querySelectorAll(".draggable-scroll").forEach(s=>{Ut(t,s)})};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",et),document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",et),document.body.style.userSelect="",document.body.style.webkitUserSelect=""}}},[be,Ut,et]);let mr=(0,i.useCallback)(()=>{He(!1),ht(!1)},[]),tt=(0,i.useCallback)(async(e,t)=>{ge(!0),je(!0);try{await new Promise(h=>setTimeout(h,500));let r=e.Sheets[t],s=ce.utils.decode_range(r["!ref"]||"A1");console.debug("Excel range:",s);let l=ce.utils.sheet_to_json(r,{header:1,range:s,defval:""}).map(h=>h.map(g=>({value:g!=null?String(g):""})));ne(l),await new Promise(h=>setTimeout(h,200))}catch(r){console.error("\uC6CC\uD06C\uC2DC\uD2B8 \uB85C\uB4DC \uC624\uB958:",r)}finally{je(!1)}},[]),pr=(0,i.useCallback)(()=>{ge(!1)},[]),hr=(0,i.useCallback)(e=>{Ye&&(_e(e),tt(Ye,e))},[Ye,tt]),$t=()=>{Dt(),A.current={scale:1,tx:0,ty:0,rotation:0},xe(""),C&&URL.revokeObjectURL(C),ae.current=null,Ve(""),pe(""),fe(""),ne([]),vt([]),_e(""),wt(null),ge(!1),D(1),oe(0),me(""),Tt(void 0),O(1),It("portrait"),kt(0),Lt(0),d()};if(!m)return null;let I=w(m.name,v),fr=((Xo+X)%360+360)%360,Le=X%180===0?Ne:Ne>0?1/Ne:0,gr=Math.max(ie.width-io,ao),xr=Math.max(ie.height-io,ao),ot=ie.width>0&&Le>0?Math.min(gr,xr*Le):ye==="portrait"?600:800,yr=typeof window<"u"&&window.devicePixelRatio||1,Gt=Vr/yr*(Le>0?Math.min(1,Le):1),rt=Math.round(Math.min(ot*T,Gt)),Kt=Math.round(ot*T),br=Kt>rt,vr=Math.max(16,Math.round(ie.width)-st),wr=Math.max(16,Math.round(ie.height)-st),Mr=ye==="landscape"?"200px":"150px",Cr=ye==="landscape"?.18:.17,qt=()=>L?(0,o.jsx)(n.Box,{ref:Ue,sx:{width:Mr,height:"100%",backgroundColor:"grey.200",borderRight:"1px solid",borderColor:"grey.300",overflow:"auto",p:2},children:Array.from({length:L},(e,t)=>(0,o.jsxs)(n.Box,{ref:r=>{Ft.current[t]=r},children:[(0,o.jsx)(n.Box,{sx:{mb:0,p:1,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",border:E===t+1?"2px solid":"1px solid",borderColor:E===t+1?"primary.main":"grey.400",borderRadius:1,overflow:"hidden",backgroundColor:"white","&:hover":{borderColor:"primary.main"},aspectRatio:ye==="landscape"?"4 / 3":"3 / 4"},onClick:()=>{O(t+1),x&&Oe(!1)},children:(0,o.jsx)(_.Document,{file:C,options:Pt,loading:(0,o.jsx)("div",{style:{display:"none"}}),children:(0,o.jsx)(_.Page,{pageNumber:t+1,scale:Cr,loading:(0,o.jsx)("div",{style:{display:"none"}}),renderAnnotationLayer:!1,renderTextLayer:!1})})}),(0,o.jsx)(n.Typography,{variant:"caption",sx:{display:"block",textAlign:"center",p:.5,mb:1,color:E===t+1?"primary.main":"",fontWeight:E===t+1?"bold":"normal"},children:t+1})]},t+1))}):null,Tr=()=>{let e=w(m?.name||"",v);if(zo&&!(e==="spreadsheet"))return(0,o.jsx)(n.Box,{sx:{display:"flex",height:"100%",width:"100%",alignItems:"center",justifyContent:"center"},children:(0,o.jsx)(dt.LoadingProgress,{visible:ze,exitDelay:100,onComplete:mr})});if(ft)return(0,o.jsxs)(n.Box,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column",children:[(0,o.jsx)(n.Typography,{color:"error",variant:"h6",children:ft}),(0,o.jsx)(n.Typography,{color:"text.secondary",variant:"body2",sx:{mt:1},children:"\uD30C\uC77C\uC744 \uB2E4\uC6B4\uB85C\uB4DC\uD558\uC5EC \uD655\uC778\uD574\uC8FC\uC138\uC694."})]});if(!C)return null;switch(e){case"image":return(0,o.jsx)(n.Box,{ref:Qe,"data-allow-pinch":"true",onPointerDown:rr,onPointerMove:nr,onPointerUp:zt,onPointerCancel:zt,sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,overflow:"hidden",height:"100%",backgroundColor:"grey.100",p:2,touchAction:"none",overscrollBehavior:"contain",userSelect:"none","&:active":{cursor:"grabbing"}},children:(0,o.jsx)("img",{ref:or,src:C,alt:m.name,draggable:!1,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",display:"block",transform:"translate(0px, 0px) scale(1) rotate(0deg)",transformOrigin:"center center",pointerEvents:"none"}})});case"pdf":return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(n.Box,{ref:Vt,sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",backgroundColor:"grey.100",position:"relative",overflow:"hidden"},children:[!x&&qt(),(0,o.jsx)(n.Box,{ref:Wo,className:"draggable-scroll",onMouseDown:r=>{let s=r.currentTarget;Nt(r,s)},"data-allow-pinch":"true",onPointerDown:sr,onPointerMove:cr,onPointerUp:_t,onPointerCancel:_t,sx:{flex:1,display:"flex",flexDirection:"column",overflow:"auto",height:"100%",py:x?0:2,overflowAnchor:"none",touchAction:"pan-x pan-y","& > .react-pdf__Document":{m:"auto",...x&&{px:`${vr}px`,py:`${wr}px`},...br&&{"& .react-pdf__Page__canvas":{width:`${Kt}px !important`,height:"auto !important"}}}},children:(0,o.jsx)(_.Document,{file:C,onLoadSuccess:Oo,onLoadError:r=>{console.error("PDF \uB85C\uB4DC \uC624\uB958:",r),me("PDF \uD30C\uC77C\uC744 \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.")},loading:(0,o.jsx)("div",{style:{display:"none"}}),error:(0,o.jsxs)(n.Box,{sx:{textAlign:"center",p:4},children:[(0,o.jsx)(n.Typography,{color:"error",variant:"h6",sx:{mb:2},children:"PDF\uB97C \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."}),(0,o.jsx)(n.Typography,{color:"text.secondary",variant:"body2",children:"\uD30C\uC77C\uC744 \uB2E4\uC6B4\uB85C\uB4DC\uD558\uC5EC \uD655\uC778\uD574\uC8FC\uC138\uC694."})]}),options:Pt,children:(0,o.jsx)(_.Page,{pageNumber:E,width:rt,rotate:X===0?void 0:fr,loading:(0,o.jsx)("div",{style:{display:"none"}}),renderAnnotationLayer:!1,renderTextLayer:!1,onLoadSuccess:No,onRenderSuccess:Ot,onRenderError:Ot})})})]}),x&&(0,o.jsx)(n.Drawer,{anchor:"left",open:Ao,onClose:()=>Oe(!1),sx:{zIndex:r=>r.zIndex.modal+2},children:qt()})]});case"text":case"code":return(0,o.jsx)(n.Box,{sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",flexDirection:"column"},children:xt?(0,o.jsx)(n.Box,{sx:{flex:1,height:"100%",overflow:"hidden"},children:(0,o.jsx)(lt.default,{height:"100%",language:Re(m.name),value:xt,theme:"vs-dark",loading:!1,options:{readOnly:!0,domReadOnly:!0,minimap:{enabled:!0},scrollBeyondLastLine:!1,automaticLayout:!0,folding:!0,foldingHighlight:!1,formatOnPaste:!0,formatOnType:!0,wordWrap:"on",lineNumbers:"on",lineNumbersMinChars:4,glyphMargin:!1,renderLineHighlight:"none",renderWhitespace:"selection",fontFamily:"'Roboto', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace",fontSize:re,lineHeight:Math.round(re*1.5),scrollbar:{vertical:"auto",horizontal:"auto"},lineDecorationsWidth:10},onMount:(r,s)=>{r.onDidAttemptReadOnlyEdit(()=>{});let c=r.getDomNode();if(c){let l=document.createElement("style");l.textContent=`
|
|
3
3
|
.monaco-editor .margin-view-overlays {
|
|
4
4
|
border-right: 1px solid #3c3c3c;
|
|
5
5
|
}
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
.monaco-editor .overlay.cursor-layer {
|
|
28
28
|
padding-left: 15px !important;
|
|
29
29
|
}
|
|
30
|
-
`,c.appendChild(l)}}})}):(0,
|
|
30
|
+
`,c.appendChild(l)}}})}):(0,o.jsx)(n.Box,{sx:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,o.jsx)(n.Typography,{color:"text.secondary",children:"\uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."})})});case"html":return(0,o.jsx)(n.Box,{sx:{width:"100%",height:"calc(100vh - 60px)",overflow:"hidden",borderRadius:1},children:Ae?(0,o.jsxs)(n.Box,{sx:{width:"100%",height:"100%",display:"flex",flexDirection:"column"},children:[(0,o.jsxs)(n.Box,{sx:{display:"flex",gap:1,p:1,borderBottom:"1px solid",borderColor:"grey.300",backgroundColor:"grey.50"},children:[(0,o.jsx)(n.Button,{variant:Xe==="preview"?"contained":"outlined",size:"small",onClick:()=>yt("preview"),children:"\uBBF8\uB9AC\uBCF4\uAE30"}),(0,o.jsx)(n.Button,{variant:Xe==="source"?"contained":"outlined",size:"small",onClick:()=>yt("source"),children:"\uC18C\uC2A4\uCF54\uB4DC"})]}),Xe==="preview"?(0,o.jsx)(n.Box,{sx:{flex:1,overflow:"auto",backgroundColor:"white",border:"1px solid",borderColor:"grey.300",fontSize:`${re}px`,p:2},dangerouslySetInnerHTML:{__html:Ae}}):(0,o.jsx)(n.Box,{sx:{flex:1,height:"100%",overflow:"hidden"},children:(0,o.jsx)(lt.default,{height:"100%",language:"html",value:Ae,theme:"vs-dark",options:{readOnly:!0,domReadOnly:!0,minimap:{enabled:!0},scrollBeyondLastLine:!1,automaticLayout:!0,folding:!0,foldingHighlight:!1,wordWrap:"on",lineNumbers:"on",lineNumbersMinChars:4,glyphMargin:!1,renderLineHighlight:"none",renderWhitespace:"selection",fontFamily:"'Roboto', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace",fontSize:re,lineHeight:Math.round(re*1.5),scrollbar:{vertical:"auto",horizontal:"auto"},lineDecorationsWidth:10},onMount:(r,s)=>{r.onDidAttemptReadOnlyEdit(()=>{});let c=r.getDomNode();if(c){let l=document.createElement("style");l.textContent=`
|
|
31
31
|
.monaco-editor .margin-view-overlays {
|
|
32
32
|
border-right: 1px solid #3c3c3c;
|
|
33
33
|
}
|
|
@@ -55,4 +55,4 @@
|
|
|
55
55
|
.monaco-editor .overlay.cursor-layer {
|
|
56
56
|
padding-left: 15px !important;
|
|
57
57
|
}
|
|
58
|
-
`,c.appendChild(l)}}})})]}):(0,r.jsx)(n.Box,{sx:{backgroundColor:"white",p:2,borderRadius:1,border:"1px solid",borderColor:"grey.300",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,r.jsx)(n.Typography,{color:"text.secondary",children:"HTML \uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."})})});case"video":return(0,r.jsx)(n.Box,{className:"draggable-scroll",onMouseDown:o=>{let s=o.currentTarget;Nt(o,s)},sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,overflow:"auto"},children:(0,r.jsx)("video",{src:C,controls:!0,style:{maxWidth:"100%",maxHeight:"70vh",transform:`scale(${T}) rotate(${X}deg)`,transition:"transform 0.3s ease",pointerEvents:T>1?"none":"auto"},children:"\uBE0C\uB77C\uC6B0\uC800\uAC00 \uBE44\uB514\uC624\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4."})});case"spreadsheet":return(0,r.jsxs)(n.Box,{sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[We.length>0||Mt?(0,r.jsxs)(n.Box,{sx:{flex:1,position:"relative",overflow:"scroll",backgroundColor:"white",minHeight:"400px",minWidth:"100%","&::-webkit-scrollbar":{width:"18px",height:"18px"},"&::-webkit-scrollbar-track":{backgroundColor:"#f1f1f1",borderRadius:"10px"},"&::-webkit-scrollbar-thumb":{backgroundColor:"#888",borderRadius:"10px",border:"2px solid #f1f1f1","&:hover":{backgroundColor:"#555"}},"&::-webkit-scrollbar-corner":{backgroundColor:"#f1f1f1"}},children:[We.length>0&&(0,r.jsx)(n.Box,{sx:{minWidth:"max-content",minHeight:"max-content"},children:(0,r.jsx)(Tr.default,{data:We,darkMode:!1})}),Mt&&(0,r.jsx)(n.Box,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255, 255, 255, 0.8)",zIndex:1e3},children:(0,r.jsx)(dt.LoadingProgress,{visible:Hr,exitDelay:200,fadeoutDuration:300,onComplete:po})})]}):(0,r.jsx)(n.Box,{sx:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},children:(0,r.jsx)(n.Typography,{color:"text.secondary",children:"\uC2A4\uD504\uB808\uB4DC\uC2DC\uD2B8 \uB370\uC774\uD130\uB97C \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."})}),bt.length>1&&(0,r.jsx)(n.Box,{sx:{borderTop:1,borderColor:"divider",backgroundColor:"#e0e0e0",padding:"0 8px 8px 8px"},children:(0,r.jsx)(n.Tabs,{value:zr,onChange:(o,s)=>ho(s),variant:"scrollable",scrollButtons:"auto",sx:{minHeight:"36px","& .MuiTabs-flexContainer":{gap:"6px"},"& .MuiTabs-indicator":{display:"none"},"& .MuiTab-root":{minHeight:"32px",fontSize:"0.875rem",textTransform:"none",padding:"6px 16px",margin:"0",backgroundColor:"white",border:"1px solid #d0d0d0",borderRadius:"0 0 4px 4px",color:"#666",minWidth:"80px",transition:"all 0.2s ease","&:hover":{backgroundColor:"#f8f8f8",color:"#333"},"&.Mui-selected":{backgroundColor:"primary.main",color:"white",border:"1px solid",borderColor:"primary.dark",fontWeight:600,"&:hover":{backgroundColor:"primary.dark"}}}},children:bt.map(o=>(0,r.jsx)(n.Tab,{label:o,value:o},o))})})]});case"audio":return(0,r.jsxs)(n.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column"},children:[(0,r.jsx)(n.Typography,{variant:"h6",sx:{mb:2},children:m.name}),(0,r.jsx)("audio",{src:C,controls:!0,style:{width:"100%",maxWidth:"500px"},children:"\uBE0C\uB77C\uC6B0\uC800\uAC00 \uC624\uB514\uC624\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4."})]});default:return(0,r.jsxs)(n.Box,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column",children:[(0,r.jsx)(n.Typography,{variant:"h6",color:"text.secondary",children:"\uBBF8\uB9AC\uBCF4\uAE30\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uD30C\uC77C \uD615\uC2DD\uC785\uB2C8\uB2E4"}),(0,r.jsx)(n.Typography,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"\uD30C\uC77C\uC744 \uB2E4\uC6B4\uB85C\uB4DC\uD558\uC5EC \uD655\uC778\uD574\uC8FC\uC138\uC694."})]})}};return(0,r.jsxs)(n.Dialog,{open:a,onClose:$t,maxWidth:"lg",fullScreen:!0,children:[(0,r.jsxs)(n.DialogTitle,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"grey.800",color:"white",height:"60px",boxSizing:"border-box",userSelect:"none",px:y?1:3},onContextMenu:e=>e.preventDefault(),children:[(0,r.jsxs)(n.Box,{sx:{display:"flex",alignItems:"center",gap:j?.35:1,flexShrink:0,"& .MuiSvgIcon-root":{fontSize:y?"1.7rem":void 0}},children:[b.length>1?(0,r.jsxs)(n.Box,{sx:{display:"flex",alignItems:"center",gap:y?0:.5},children:[(0,r.jsx)(n.Tooltip,{title:"\uC774\uC804 \uD30C\uC77C",children:(0,r.jsx)("span",{style:{display:"inline-flex"},children:(0,r.jsx)(n.IconButton,{onClick:()=>V(e=>Math.max(e-1,0)),disabled:Q<=0,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"}},children:(0,r.jsx)(De.default,{})})})}),(0,r.jsxs)(n.Typography,{variant:"body2",sx:{color:"grey.300",minWidth:40,textAlign:"center",userSelect:"none"},children:[Q+1," / ",b.length]}),(0,r.jsx)(n.Tooltip,{title:"\uB2E4\uC74C \uD30C\uC77C",children:(0,r.jsx)("span",{style:{display:"inline-flex"},children:(0,r.jsx)(n.IconButton,{onClick:()=>V(e=>Math.min(e+1,b.length-1)),disabled:Q>=b.length-1,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"}},children:(0,r.jsx)(Be.default,{})})})})]}):null,y&&I==="pdf"&&L?(0,r.jsx)(n.Tooltip,{title:"\uD398\uC774\uC9C0 \uBAA9\uB85D",children:(0,r.jsx)(n.IconButton,{onClick:()=>Oe(e=>!e),size:"medium",sx:{color:"grey.300","&:hover":{color:"white"}},children:(0,r.jsx)(dr.default,{})})}):null,I==="pdf"&&L?(0,r.jsxs)(n.Box,{sx:{display:"flex",alignItems:"center",gap:y?0:.5},children:[(0,r.jsx)(n.Tooltip,{title:"\uC774\uC804 \uD398\uC774\uC9C0",children:(0,r.jsx)("span",{style:{display:"inline-flex"},children:(0,r.jsx)(n.IconButton,{onClick:ve,disabled:E<=1,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"},transition:"all 0.2s ease-in-out"},children:(0,r.jsx)(De.default,{})})})}),(0,r.jsx)(n.Typography,{variant:"body2",sx:{minWidth:y?"auto":"80px",textAlign:"center",color:"white",px:y?.5:1,fontSize:y?"1.05rem":void 0,fontWeight:y?600:void 0,whiteSpace:"nowrap"},children:j?E:`${E} / ${L}`}),(0,r.jsx)(n.Tooltip,{title:"\uB2E4\uC74C \uD398\uC774\uC9C0",children:(0,r.jsx)("span",{style:{display:"inline-flex"},children:(0,r.jsx)(n.IconButton,{onClick:we,disabled:E>=L,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"},transition:"all 0.2s ease-in-out"},children:(0,r.jsx)(Be.default,{})})})})]}):null]}),(0,r.jsx)(n.Box,{sx:{display:"flex",alignItems:"center",flexGrow:1,mr:j?0:2,overflow:"hidden"},children:!j&&(0,r.jsxs)(n.Box,{sx:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:1.5,fontSize:"1rem"},children:[Ao(I),m.name]})}),(0,r.jsxs)(n.Box,{className:"toolbar",sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:j?1.25:1,"& .MuiSvgIcon-root":{fontSize:j?"1.45rem":y?"1.7rem":void 0},"& .MuiIconButton-root":j?{p:.75}:{}},children:[(I==="image"||I==="pdf"||I==="text"||I==="html"||I==="code"||I==="spreadsheet")&&(0,r.jsxs)(r.Fragment,{children:[!(y&&(I==="image"||I==="pdf"))&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.Tooltip,{title:"\uD655\uB300",children:(0,r.jsx)(n.IconButton,{onClick:Zr,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,r.jsx)(pr.default,{})})}),(0,r.jsx)(n.Tooltip,{title:"\uCD95\uC18C",children:(0,r.jsx)(n.IconButton,{onClick:Qr,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,r.jsx)(hr.default,{})})})]}),(!y||I==="image"||I==="pdf")&&(0,r.jsx)(n.Tooltip,{title:"\uD654\uBA74\uC5D0 \uB9DE\uCD94\uAE30",children:(0,r.jsx)(n.IconButton,{onClick:uo,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,r.jsx)(xr.default,{})})}),(I==="image"||I==="pdf")&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.Tooltip,{title:"\uC67C\uCABD\uC73C\uB85C \uD68C\uC804",children:(0,r.jsx)(n.IconButton,{onClick:co,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,r.jsx)(fr.default,{})})}),(0,r.jsx)(n.Tooltip,{title:"\uC624\uB978\uCABD\uC73C\uB85C \uD68C\uC804",children:(0,r.jsx)(n.IconButton,{onClick:lo,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,r.jsx)(gr.default,{})})})]})]}),(0,r.jsx)(n.Tooltip,{title:"\uB2E4\uC6B4\uB85C\uB4DC",children:(0,r.jsx)(n.IconButton,{onClick:$r,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,r.jsx)(mr.default,{})})}),Kr&&(0,r.jsx)(n.Tooltip,{title:"\uACF5\uC720",children:(0,r.jsx)(n.IconButton,{onClick:()=>void qr(),size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,r.jsx)(ur.default,{})})}),(0,r.jsx)(n.Tooltip,{title:"\uB2EB\uAE30",children:(0,r.jsx)(n.IconButton,{onClick:$t,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,r.jsx)(lr.default,{})})})]})]}),!y&&b.length>1&&Q>0?(0,r.jsx)(n.IconButton,{"aria-label":"\uC774\uC804 \uD30C\uC77C",onClick:()=>V(e=>Math.max(e-1,0)),sx:{position:"fixed",left:12,top:"50%",transform:"translateY(-50%)",zIndex:10,color:"white",backgroundColor:"rgba(0, 0, 0, 0.35)","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.55)"},width:44,height:44},children:(0,r.jsx)(De.default,{sx:{fontSize:30}})}):null,!y&&b.length>1&&Q<b.length-1?(0,r.jsx)(n.IconButton,{"aria-label":"\uB2E4\uC74C \uD30C\uC77C",onClick:()=>V(e=>Math.min(e+1,b.length-1)),sx:{position:"fixed",right:12,top:"50%",transform:"translateY(-50%)",zIndex:10,color:"white",backgroundColor:"rgba(0, 0, 0, 0.35)","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.55)"},width:44,height:44},children:(0,r.jsx)(Be.default,{sx:{fontSize:30}})}):null,(0,r.jsx)(n.DialogContent,{sx:{p:"0 !important",overflow:"hidden",userSelect:"none"},onContextMenu:e=>e.preventDefault(),children:To()}),(0,r.jsx)(n.Snackbar,{open:!!Ct,autoHideDuration:2e3,onClose:()=>xe(""),anchorOrigin:{vertical:"bottom",horizontal:"center"},message:Ct,sx:{"& .MuiSnackbarContent-message":{fontSize:"0.95rem"}}})]})},Ir=ut;var mt=require("react/jsx-runtime");function le(a){return(0,mt.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 550.801 550.801",width:a.width||"22px",fill:a.fill||"#E91E63",...a,children:(0,mt.jsx)("path",{d:"M488.426,197.019H475.2v-63.816c0-0.401-0.063-0.799-0.116-1.205c-0.021-2.534-0.827-5.023-2.562-6.992L366.325,3.691 c-0.032-0.031-0.063-0.042-0.085-0.073c-0.633-0.707-1.371-1.298-2.151-1.804c-0.231-0.158-0.464-0.287-0.706-0.422 c-0.676-0.366-1.393-0.675-2.131-0.896c-0.2-0.053-0.38-0.135-0.58-0.19C359.87,0.119,359.037,0,358.193,0H97.2 c-11.918,0-21.6,9.693-21.6,21.601v175.413H62.377c-17.049,0-30.873,13.818-30.873,30.87v160.542 c0,17.044,13.824,30.876,30.873,30.876h13.224V529.2c0,11.907,9.682,21.601,21.6,21.601h356.4c11.907,0,21.6-9.693,21.6-21.601 V419.302h13.226c17.044,0,30.871-13.827,30.871-30.87V227.89C519.297,210.838,505.47,197.019,488.426,197.019z M97.2,21.605 h250.193v110.51c0,5.967,4.841,10.8,10.8,10.8h95.407v54.108H97.2V21.605z M406.467,363.983h-26.104l-1.751-46.464 c-0.527-14.598-1.055-32.236-1.055-49.895h-0.517c-3.691,15.485-8.596,32.782-13.163,47.015l-14.354,47.366h-20.851l-12.625-47.002 c-3.85-14.228-7.889-31.524-10.694-47.374h-0.348c-0.707,16.397-1.234,35.129-2.1,50.253l-2.114,46.111h-24.711l7.535-121.395 h35.575l11.569,40.521c3.691,14.048,7.362,29.183,9.999,43.416h0.521c3.344-14.054,7.356-30.074,11.222-43.585l12.614-40.353 h34.879L406.467,363.983z M174.438,265.642v-23.058h90.77v23.058h-32.239v98.342h-26.821v-98.342H174.438z M89.403,313.195v50.788 H62.604V242.584h26.799v46.654h43.999v-46.654h26.645v121.399h-26.645v-50.794H89.403V313.195z M453.601,523.353H97.2V419.302 h356.4V523.353z M500.787,363.983h-73.786V242.584h26.811v98.339h46.976V363.983z"})})}var F=require("react/jsx-runtime");function de(a){return(0,F.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 550.801 550.801",width:a.width||"22px",fill:a.fill||"#B45309",...a,children:[(0,F.jsx)("path",{d:"M475.095,131.992c-0.032-2.526-0.833-5.021-2.568-6.993L366.324,3.694c-0.021-0.034-0.053-0.045-0.084-0.076 c-0.633-0.707-1.36-1.29-2.141-1.804c-0.232-0.15-0.465-0.285-0.707-0.422c-0.686-0.366-1.393-0.67-2.131-0.892 c-0.2-0.058-0.379-0.14-0.58-0.192C359.87,0.114,359.047,0,358.203,0H97.2C85.292,0,75.6,9.693,75.6,21.601v507.6 c0,11.913,9.692,21.601,21.6,21.601H453.6c11.918,0,21.601-9.688,21.601-21.601V133.202 C475.2,132.796,475.137,132.398,475.095,131.992z M243.599,523.494H141.75v-15.936l62.398-89.797v-0.785h-56.565v-24.484h95.051 v17.106l-61.038,88.636v0.771h62.002V523.494z M292.021,523.494h-29.744V392.492h29.744V523.494z M399.705,463.44 c-10.104,9.524-25.069,13.796-42.566,13.796c-3.893,0-7.383-0.19-10.104-0.58v46.849h-29.352V394.242 c9.134-1.561,21.958-2.721,40.036-2.721c18.277,0,31.292,3.491,40.046,10.494c8.354,6.607,13.996,17.486,13.996,30.322 C411.761,445.163,407.479,456.053,399.705,463.44z M97.2,366.752V21.601h129.167v-3.396h32.756v3.396h88.28v110.515 c0,5.961,4.831,10.8,10.8,10.8H453.6l0.011,223.836H97.2z"}),(0,F.jsx)("path",{d:"M359.279,413.87c-6.033,0-10.114,0.586-12.245,1.171v38.676c2.521,0.585,5.632,0.785,9.914,0.785 c15.736,0,25.46-7.979,25.46-21.378C382.408,421.063,374.045,413.87,359.279,413.87z"}),(0,F.jsx)("rect",{x:"259.124",y:"39.918",width:"32.756",height:"13.516"}),(0,F.jsx)("rect",{x:"226.368",y:"21.601",width:"32.756",height:"10.125"}),(0,F.jsx)("rect",{x:"226.368",y:"60.146",width:"32.756",height:"13.516"}),(0,F.jsx)("rect",{x:"259.124",y:"82.274",width:"32.756",height:"13.518"}),(0,F.jsx)("rect",{x:"259.124",y:"124.983",width:"32.756",height:"13.516"}),(0,F.jsx)("rect",{x:"226.368",y:"103.275",width:"32.756",height:"13.516"}),(0,F.jsx)("path",{d:"M259.124,149.537c-23.193,0-34.225,18.792-34.225,41.99l-7.765,70.348c0,23.198,18.792,42.003,41.984,42.003 c23.19,0,41.974-18.805,41.974-42.003l-7.741-70.348C293.361,168.334,282.318,149.537,259.124,149.537z M273.04,285.431h-27.799 v-58.728h27.799V285.431z"})]})}var kr=f(require("@mui/icons-material/TextSnippet"),1),Lr=f(require("@mui/icons-material/VideoFile"),1),Er=f(require("@mui/icons-material/AudioFile"),1),Fr=f(require("@mui/icons-material/Description"),1),Rr=f(require("@mui/icons-material/InsertDriveFile"),1),Pr=f(require("@mui/icons-material/Code"),1),Sr=f(require("@mui/icons-material/TableView"),1);var R=require("react/jsx-runtime");function ue(a,d=22){let u=`${d}px`,p={fontSize:d};switch(a){case"image":return(0,R.jsx)(G,{width:u,height:u});case"pdf":return(0,R.jsx)(K,{width:u,height:u});case"html":return(0,R.jsx)(le,{width:u,height:u});case"archive":return(0,R.jsx)(de,{width:u,height:u});case"text":return(0,R.jsx)(kr.default,{sx:{...p,color:"#66BB6A"}});case"spreadsheet":return(0,R.jsx)(Sr.default,{sx:{...p,color:"#4CAF50"}});case"code":return(0,R.jsx)(Pr.default,{sx:{...p,color:"#2196F3"}});case"video":return(0,R.jsx)(Lr.default,{sx:{...p,color:"#AB47BC"}});case"audio":return(0,R.jsx)(Er.default,{sx:{...p,color:"#FF7043"}});case"office":return(0,R.jsx)(Fr.default,{sx:{...p,color:"#FFA726"}});default:return(0,R.jsx)(Rr.default,{sx:{...p,color:"#78909C"}})}}var Xo=new Set(["zip","rar","7z","gz","tgz","tar","bz2","xz","alz","egg"]);function pt({fileName:a,mime:d,size:u=22}){let p=a.includes(".")?a.slice(a.lastIndexOf(".")+1).toLowerCase():"";return Xo.has(p)?ue("archive",u):ue(w(a,d??""),u)}
|
|
58
|
+
`,c.appendChild(l)}}})})]}):(0,o.jsx)(n.Box,{sx:{backgroundColor:"white",p:2,borderRadius:1,border:"1px solid",borderColor:"grey.300",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,o.jsx)(n.Typography,{color:"text.secondary",children:"HTML \uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."})})});case"video":return(0,o.jsx)(n.Box,{className:"draggable-scroll",onMouseDown:r=>{let s=r.currentTarget;Nt(r,s)},sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,overflow:"auto"},children:(0,o.jsx)("video",{src:C,controls:!0,style:{maxWidth:"100%",maxHeight:"70vh",transform:`scale(${T}) rotate(${X}deg)`,transition:"transform 0.3s ease",pointerEvents:T>1?"none":"auto"},children:"\uBE0C\uB77C\uC6B0\uC800\uAC00 \uBE44\uB514\uC624\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4."})});case"spreadsheet":return(0,o.jsxs)(n.Box,{sx:{width:"100%",height:"calc(100vh - 60px)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[We.length>0||Mt?(0,o.jsxs)(n.Box,{sx:{flex:1,position:"relative",overflow:"scroll",backgroundColor:"white",minHeight:"400px",minWidth:"100%","&::-webkit-scrollbar":{width:"18px",height:"18px"},"&::-webkit-scrollbar-track":{backgroundColor:"#f1f1f1",borderRadius:"10px"},"&::-webkit-scrollbar-thumb":{backgroundColor:"#888",borderRadius:"10px",border:"2px solid #f1f1f1","&:hover":{backgroundColor:"#555"}},"&::-webkit-scrollbar-corner":{backgroundColor:"#f1f1f1"}},children:[We.length>0&&(0,o.jsx)(n.Box,{sx:{minWidth:"max-content",minHeight:"max-content"},children:(0,o.jsx)(Io.default,{data:We,darkMode:!1})}),Mt&&(0,o.jsx)(n.Box,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255, 255, 255, 0.8)",zIndex:1e3},children:(0,o.jsx)(dt.LoadingProgress,{visible:Vo,exitDelay:200,fadeoutDuration:300,onComplete:pr})})]}):(0,o.jsx)(n.Box,{sx:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},children:(0,o.jsx)(n.Typography,{color:"text.secondary",children:"\uC2A4\uD504\uB808\uB4DC\uC2DC\uD2B8 \uB370\uC774\uD130\uB97C \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."})}),bt.length>1&&(0,o.jsx)(n.Box,{sx:{borderTop:1,borderColor:"divider",backgroundColor:"#e0e0e0",padding:"0 8px 8px 8px"},children:(0,o.jsx)(n.Tabs,{value:Ho,onChange:(r,s)=>hr(s),variant:"scrollable",scrollButtons:"auto",sx:{minHeight:"36px","& .MuiTabs-flexContainer":{gap:"6px"},"& .MuiTabs-indicator":{display:"none"},"& .MuiTab-root":{minHeight:"32px",fontSize:"0.875rem",textTransform:"none",padding:"6px 16px",margin:"0",backgroundColor:"white",border:"1px solid #d0d0d0",borderRadius:"0 0 4px 4px",color:"#666",minWidth:"80px",transition:"all 0.2s ease","&:hover":{backgroundColor:"#f8f8f8",color:"#333"},"&.Mui-selected":{backgroundColor:"primary.main",color:"white",border:"1px solid",borderColor:"primary.dark",fontWeight:600,"&:hover":{backgroundColor:"primary.dark"}}}},children:bt.map(r=>(0,o.jsx)(n.Tab,{label:r,value:r},r))})})]});case"audio":return(0,o.jsxs)(n.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column"},children:[(0,o.jsx)(n.Typography,{variant:"h6",sx:{mb:2},children:m.name}),(0,o.jsx)("audio",{src:C,controls:!0,style:{width:"100%",maxWidth:"500px"},children:"\uBE0C\uB77C\uC6B0\uC800\uAC00 \uC624\uB514\uC624\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4."})]});default:return(0,o.jsxs)(n.Box,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400,flexDirection:"column",children:[(0,o.jsx)(n.Typography,{variant:"h6",color:"text.secondary",children:"\uBBF8\uB9AC\uBCF4\uAE30\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uD30C\uC77C \uD615\uC2DD\uC785\uB2C8\uB2E4"}),(0,o.jsx)(n.Typography,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"\uD30C\uC77C\uC744 \uB2E4\uC6B4\uB85C\uB4DC\uD558\uC5EC \uD655\uC778\uD574\uC8FC\uC138\uC694."})]})}};return(0,o.jsxs)(n.Dialog,{open:a,onClose:$t,maxWidth:"lg",fullScreen:!0,children:[(0,o.jsxs)(n.DialogTitle,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"grey.800",color:"white",height:"60px",boxSizing:"border-box",userSelect:"none",pl:x?1:3,pr:x?2:3},onContextMenu:e=>e.preventDefault(),children:[(0,o.jsxs)(n.Box,{sx:{display:"flex",alignItems:"center",gap:j?.35:1,flexShrink:0,"& .MuiSvgIcon-root":{fontSize:x?"1.7rem":void 0}},children:[b.length>1?(0,o.jsxs)(n.Box,{sx:{display:"flex",alignItems:"center",gap:x?0:.5},children:[(0,o.jsx)(n.Tooltip,{title:"\uC774\uC804 \uD30C\uC77C",children:(0,o.jsx)("span",{style:{display:"inline-flex"},children:(0,o.jsx)(n.IconButton,{onClick:()=>V(e=>Math.max(e-1,0)),disabled:Q<=0,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"}},children:(0,o.jsx)(Be.default,{})})})}),(0,o.jsxs)(n.Typography,{variant:"body2",sx:{color:"grey.300",minWidth:40,textAlign:"center",userSelect:"none"},children:[Q+1," / ",b.length]}),(0,o.jsx)(n.Tooltip,{title:"\uB2E4\uC74C \uD30C\uC77C",children:(0,o.jsx)("span",{style:{display:"inline-flex"},children:(0,o.jsx)(n.IconButton,{onClick:()=>V(e=>Math.min(e+1,b.length-1)),disabled:Q>=b.length-1,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"}},children:(0,o.jsx)(De.default,{})})})})]}):null,x&&I==="pdf"&&L?(0,o.jsx)(n.Tooltip,{title:"\uD398\uC774\uC9C0 \uBAA9\uB85D",children:(0,o.jsx)(n.IconButton,{onClick:()=>Oe(e=>!e),size:"medium",sx:{color:"grey.300","&:hover":{color:"white"}},children:(0,o.jsx)(uo.default,{})})}):null,I==="pdf"&&L?(0,o.jsxs)(n.Box,{sx:{display:"flex",alignItems:"center",gap:x?0:.5},children:[(0,o.jsx)(n.Tooltip,{title:"\uC774\uC804 \uD398\uC774\uC9C0",children:(0,o.jsx)("span",{style:{display:"inline-flex"},children:(0,o.jsx)(n.IconButton,{onClick:ve,disabled:E<=1,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"},transition:"all 0.2s ease-in-out"},children:(0,o.jsx)(Be.default,{})})})}),(0,o.jsx)(n.Typography,{variant:"body2",sx:{minWidth:x?"auto":"80px",textAlign:"center",color:"white",px:x?.5:1,fontSize:x?"1.05rem":void 0,fontWeight:x?600:void 0,whiteSpace:"nowrap"},children:j?E:`${E} / ${L}`}),(0,o.jsx)(n.Tooltip,{title:"\uB2E4\uC74C \uD398\uC774\uC9C0",children:(0,o.jsx)("span",{style:{display:"inline-flex"},children:(0,o.jsx)(n.IconButton,{onClick:we,disabled:E>=L,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},"&.Mui-disabled":{color:"rgba(255, 255, 255, 0.3)"},transition:"all 0.2s ease-in-out"},children:(0,o.jsx)(De.default,{})})})})]}):null]}),(0,o.jsx)(n.Box,{sx:{display:"flex",alignItems:"center",flexGrow:1,mr:j?0:2,overflow:"hidden"},children:!j&&(0,o.jsxs)(n.Box,{sx:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:1.5,fontSize:"1rem"},children:[Ar(I),m.name]})}),(0,o.jsxs)(n.Box,{className:"toolbar",sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:j?1.25:1,"& .MuiSvgIcon-root":{fontSize:j?"1.45rem":x?"1.7rem":void 0},"& .MuiIconButton-root":j?{p:.75}:{},"@media (hover: none)":{"& .MuiIconButton-root:hover, & .MuiIconButton-root.Mui-focusVisible":{backgroundColor:"transparent",transform:"none"}}},children:[(I==="image"||I==="pdf"||I==="text"||I==="html"||I==="code"||I==="spreadsheet")&&(0,o.jsxs)(o.Fragment,{children:[!(x&&(I==="image"||I==="pdf"))&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.Tooltip,{title:"\uD655\uB300",children:(0,o.jsx)(n.IconButton,{onClick:Qo,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,o.jsx)(ho.default,{})})}),(0,o.jsx)(n.Tooltip,{title:"\uCD95\uC18C",children:(0,o.jsx)(n.IconButton,{onClick:Jo,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,o.jsx)(fo.default,{})})})]}),(!x||I==="image"||I==="pdf")&&(0,o.jsx)(n.Tooltip,{title:"\uD654\uBA74\uC5D0 \uB9DE\uCD94\uAE30",children:(0,o.jsx)(n.IconButton,{onClick:ur,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,o.jsx)(yo.default,{})})}),(I==="image"||I==="pdf")&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.Tooltip,{title:"\uC67C\uCABD\uC73C\uB85C \uD68C\uC804",children:(0,o.jsx)(n.IconButton,{onClick:lr,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,o.jsx)(go.default,{})})}),(0,o.jsx)(n.Tooltip,{title:"\uC624\uB978\uCABD\uC73C\uB85C \uD68C\uC804",children:(0,o.jsx)(n.IconButton,{onClick:dr,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,o.jsx)(xo.default,{})})})]})]}),(0,o.jsx)(n.Tooltip,{title:"\uB2E4\uC6B4\uB85C\uB4DC",children:(0,o.jsx)(n.IconButton,{onClick:Go,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,o.jsx)(po.default,{})})}),qo&&(0,o.jsx)(n.Tooltip,{title:"\uACF5\uC720",children:(0,o.jsx)(n.IconButton,{onClick:()=>void Zo(),size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,o.jsx)(mo.default,{})})}),(0,o.jsx)(n.Tooltip,{title:"\uB2EB\uAE30",children:(0,o.jsx)(n.IconButton,{onClick:$t,size:"medium",sx:{color:"grey.300","&:hover":{color:"white",backgroundColor:"rgba(255, 255, 255, 0.08)",transform:"scale(1.1)"},transition:"all 0.2s ease-in-out"},children:(0,o.jsx)(lo.default,{})})})]})]}),!x&&b.length>1&&Q>0?(0,o.jsx)(n.IconButton,{"aria-label":"\uC774\uC804 \uD30C\uC77C",onClick:()=>V(e=>Math.max(e-1,0)),sx:{position:"fixed",left:12,top:"50%",transform:"translateY(-50%)",zIndex:10,color:"white",backgroundColor:"rgba(0, 0, 0, 0.35)","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.55)"},width:44,height:44},children:(0,o.jsx)(Be.default,{sx:{fontSize:30}})}):null,!x&&b.length>1&&Q<b.length-1?(0,o.jsx)(n.IconButton,{"aria-label":"\uB2E4\uC74C \uD30C\uC77C",onClick:()=>V(e=>Math.min(e+1,b.length-1)),sx:{position:"fixed",right:12,top:"50%",transform:"translateY(-50%)",zIndex:10,color:"white",backgroundColor:"rgba(0, 0, 0, 0.35)","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.55)"},width:44,height:44},children:(0,o.jsx)(De.default,{sx:{fontSize:30}})}):null,(0,o.jsx)(n.DialogContent,{sx:{p:"0 !important",overflow:"hidden",userSelect:"none"},onContextMenu:e=>e.preventDefault(),children:Tr()}),(0,o.jsx)(n.Snackbar,{open:!!Ct,autoHideDuration:2e3,onClose:()=>xe(""),anchorOrigin:{vertical:"bottom",horizontal:"center"},message:Ct,sx:{"& .MuiSnackbarContent-message":{fontSize:"0.95rem"}}})]})},ko=ut;var mt=require("react/jsx-runtime");function le(a){return(0,mt.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 550.801 550.801",width:a.width||"22px",fill:a.fill||"#E91E63",...a,children:(0,mt.jsx)("path",{d:"M488.426,197.019H475.2v-63.816c0-0.401-0.063-0.799-0.116-1.205c-0.021-2.534-0.827-5.023-2.562-6.992L366.325,3.691 c-0.032-0.031-0.063-0.042-0.085-0.073c-0.633-0.707-1.371-1.298-2.151-1.804c-0.231-0.158-0.464-0.287-0.706-0.422 c-0.676-0.366-1.393-0.675-2.131-0.896c-0.2-0.053-0.38-0.135-0.58-0.19C359.87,0.119,359.037,0,358.193,0H97.2 c-11.918,0-21.6,9.693-21.6,21.601v175.413H62.377c-17.049,0-30.873,13.818-30.873,30.87v160.542 c0,17.044,13.824,30.876,30.873,30.876h13.224V529.2c0,11.907,9.682,21.601,21.6,21.601h356.4c11.907,0,21.6-9.693,21.6-21.601 V419.302h13.226c17.044,0,30.871-13.827,30.871-30.87V227.89C519.297,210.838,505.47,197.019,488.426,197.019z M97.2,21.605 h250.193v110.51c0,5.967,4.841,10.8,10.8,10.8h95.407v54.108H97.2V21.605z M406.467,363.983h-26.104l-1.751-46.464 c-0.527-14.598-1.055-32.236-1.055-49.895h-0.517c-3.691,15.485-8.596,32.782-13.163,47.015l-14.354,47.366h-20.851l-12.625-47.002 c-3.85-14.228-7.889-31.524-10.694-47.374h-0.348c-0.707,16.397-1.234,35.129-2.1,50.253l-2.114,46.111h-24.711l7.535-121.395 h35.575l11.569,40.521c3.691,14.048,7.362,29.183,9.999,43.416h0.521c3.344-14.054,7.356-30.074,11.222-43.585l12.614-40.353 h34.879L406.467,363.983z M174.438,265.642v-23.058h90.77v23.058h-32.239v98.342h-26.821v-98.342H174.438z M89.403,313.195v50.788 H62.604V242.584h26.799v46.654h43.999v-46.654h26.645v121.399h-26.645v-50.794H89.403V313.195z M453.601,523.353H97.2V419.302 h356.4V523.353z M500.787,363.983h-73.786V242.584h26.811v98.339h46.976V363.983z"})})}var F=require("react/jsx-runtime");function de(a){return(0,F.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 550.801 550.801",width:a.width||"22px",fill:a.fill||"#B45309",...a,children:[(0,F.jsx)("path",{d:"M475.095,131.992c-0.032-2.526-0.833-5.021-2.568-6.993L366.324,3.694c-0.021-0.034-0.053-0.045-0.084-0.076 c-0.633-0.707-1.36-1.29-2.141-1.804c-0.232-0.15-0.465-0.285-0.707-0.422c-0.686-0.366-1.393-0.67-2.131-0.892 c-0.2-0.058-0.379-0.14-0.58-0.192C359.87,0.114,359.047,0,358.203,0H97.2C85.292,0,75.6,9.693,75.6,21.601v507.6 c0,11.913,9.692,21.601,21.6,21.601H453.6c11.918,0,21.601-9.688,21.601-21.601V133.202 C475.2,132.796,475.137,132.398,475.095,131.992z M243.599,523.494H141.75v-15.936l62.398-89.797v-0.785h-56.565v-24.484h95.051 v17.106l-61.038,88.636v0.771h62.002V523.494z M292.021,523.494h-29.744V392.492h29.744V523.494z M399.705,463.44 c-10.104,9.524-25.069,13.796-42.566,13.796c-3.893,0-7.383-0.19-10.104-0.58v46.849h-29.352V394.242 c9.134-1.561,21.958-2.721,40.036-2.721c18.277,0,31.292,3.491,40.046,10.494c8.354,6.607,13.996,17.486,13.996,30.322 C411.761,445.163,407.479,456.053,399.705,463.44z M97.2,366.752V21.601h129.167v-3.396h32.756v3.396h88.28v110.515 c0,5.961,4.831,10.8,10.8,10.8H453.6l0.011,223.836H97.2z"}),(0,F.jsx)("path",{d:"M359.279,413.87c-6.033,0-10.114,0.586-12.245,1.171v38.676c2.521,0.585,5.632,0.785,9.914,0.785 c15.736,0,25.46-7.979,25.46-21.378C382.408,421.063,374.045,413.87,359.279,413.87z"}),(0,F.jsx)("rect",{x:"259.124",y:"39.918",width:"32.756",height:"13.516"}),(0,F.jsx)("rect",{x:"226.368",y:"21.601",width:"32.756",height:"10.125"}),(0,F.jsx)("rect",{x:"226.368",y:"60.146",width:"32.756",height:"13.516"}),(0,F.jsx)("rect",{x:"259.124",y:"82.274",width:"32.756",height:"13.518"}),(0,F.jsx)("rect",{x:"259.124",y:"124.983",width:"32.756",height:"13.516"}),(0,F.jsx)("rect",{x:"226.368",y:"103.275",width:"32.756",height:"13.516"}),(0,F.jsx)("path",{d:"M259.124,149.537c-23.193,0-34.225,18.792-34.225,41.99l-7.765,70.348c0,23.198,18.792,42.003,41.984,42.003 c23.19,0,41.974-18.805,41.974-42.003l-7.741-70.348C293.361,168.334,282.318,149.537,259.124,149.537z M273.04,285.431h-27.799 v-58.728h27.799V285.431z"})]})}var Lo=f(require("@mui/icons-material/TextSnippet"),1),Eo=f(require("@mui/icons-material/VideoFile"),1),Fo=f(require("@mui/icons-material/AudioFile"),1),Ro=f(require("@mui/icons-material/Description"),1),Po=f(require("@mui/icons-material/InsertDriveFile"),1),So=f(require("@mui/icons-material/Code"),1),Bo=f(require("@mui/icons-material/TableView"),1);var R=require("react/jsx-runtime");function ue(a,d=22){let u=`${d}px`,p={fontSize:d};switch(a){case"image":return(0,R.jsx)(G,{width:u,height:u});case"pdf":return(0,R.jsx)(K,{width:u,height:u});case"html":return(0,R.jsx)(le,{width:u,height:u});case"archive":return(0,R.jsx)(de,{width:u,height:u});case"text":return(0,R.jsx)(Lo.default,{sx:{...p,color:"#66BB6A"}});case"spreadsheet":return(0,R.jsx)(Bo.default,{sx:{...p,color:"#4CAF50"}});case"code":return(0,R.jsx)(So.default,{sx:{...p,color:"#2196F3"}});case"video":return(0,R.jsx)(Eo.default,{sx:{...p,color:"#AB47BC"}});case"audio":return(0,R.jsx)(Fo.default,{sx:{...p,color:"#FF7043"}});case"office":return(0,R.jsx)(Ro.default,{sx:{...p,color:"#FFA726"}});default:return(0,R.jsx)(Po.default,{sx:{...p,color:"#78909C"}})}}var Xr=new Set(["zip","rar","7z","gz","tgz","tar","bz2","xz","alz","egg"]);function pt({fileName:a,mime:d,size:u=22}){let p=a.includes(".")?a.slice(a.lastIndexOf(".")+1).toLowerCase():"";return Xr.has(p)?ue("archive",u):ue(w(a,d??""),u)}
|