"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[57655,93478],{2701:function(e,n,t){t.d(n,{Z:function(){return j}});var r=t(82242),s=t.n(r),o=t(7557),c=t.n(o),a=t(41498),i=t.n(a),l=t(79800),u=t.n(l),d=t(59301),p={wrp:"wrp___dq7YK",bgBlack:"bgBlack___ARIUV",monaco:"monaco___VnZC3",darkBlue:"darkBlue___UprA9",close:"close___LKoWu",embed:"embed___hvpEJ"},f=t(3113),_=t(74516),h=t(23239),v=t(6848),x=t(41282),m=t(66151),g=t(77984),y=t(57357),b=t(37712),j=function(e){var n,t,r,o,a,l,j,w=e.editOffice,k=void 0===w?"view":w,N=e.data,A=(e.theme,e.type),E=e.filename,Z=e.monacoEditor,I=e.className,R=e.style,S=e.close,P=e.onClose,C=e.hasMask,O=e.disabledDownload,Y=e.onImgDimensions,H=e.showNodata,F=(0,d.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),T=u()(F,2),V=(T[0],T[1],(0,d.useState)("")),L=u()(V,2),M=(L[0],L[1]),q=(0,d.useState)(),W=u()(q,2),z=W[0],D=W[1],B="build"===window.ENV?"/react/build":"",U=location.host.startsWith("localhost")?y.Z.PROXY_SERVER:y.Z.API_SERVER;console.log("disabledDownload---",O);var G=(0,d.useRef)();null!==(n=N)&&void 0!==n&&n.startsWith("/api")&&"txt"!==A&&(N=y.Z.API_SERVER+N),E&&(Z.filename=E),(0,d.useEffect)((function(){var e,n=null===(e=document.cookie)||void 0===e||null===(e=e.replace(/\s/g,""))||void 0===e?void 0:e.split(";");null==n||n.map((function(e){var n=e.split("=");"_educoder_session"===n[0]&&M(n[1])}))}),[]),(0,d.useEffect)((function(){"office"===A&&X()}),[A,N]);var X=function(){var e=i()(c()().mark((function e(){var n,t,r;return c()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("data:",N),n=N,N.startsWith("http")||(n=location.origin+n),t=new URL(n).pathname.split("/").pop(),e.next=6,(0,m.gJ)({attachment_id:t});case 6:r=e.sent,D(r);case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),J=function(){N.startsWith("http")||N.startsWith("blob:")?K():(0,x.Sv)(E||"educoder",N,E)},K=function(){(0,x.Nd)(E||"educoder",decodeURIComponent(N))};return console.log(N,"data"),(0,b.jsxs)("div",{style:s()({},R||{}),className:"".concat(C&&p.bgBlack," ").concat(A?p.wrp:"hide"),children:[S&&(0,b.jsxs)("div",{className:p.close,ref:G,children:[!!Y&&(0,b.jsx)(v.Z,{title:"点击对图片进行批注",getPopupContainer:function(){return G.current},children:(0,b.jsx)("span",{onClick:function(){P(),Y()},children:(0,b.jsx)("i",{className:"icon-yulanpizhu"})})}),!O&&(0,b.jsx)(v.Z,{title:"点击下载此文件",getPopupContainer:function(){return G.current},children:(0,b.jsx)("span",{onClick:K,children:(0,b.jsx)("i",{className:"icon-quxiaozhiding"})})}),(0,b.jsx)(v.Z,{title:"关闭",getPopupContainer:function(){return G.current},children:(0,b.jsx)("span",{className:"",onClick:P,children:(0,b.jsx)("i",{className:"icon-guanbi1"})})})]}),(0,b.jsx)("div",{className:"".concat(p[I]," ").concat(I," ").concat(p.monaco," ").concat("txt"===A?"show":"hide"),children:"txt"===A&&(0,b.jsx)(h.ZP,s()({},Z))}),"audio"===A&&(0,b.jsx)("audio",{src:(null===(t=N)||void 0===t?void 0:t.indexOf("http"))>-1||null!==(r=N)&&void 0!==r&&r.startsWith("/api")?N:"data:image/png;base64,".concat(N),autoPlay:!0}),"video"===A&&(0,b.jsx)(b.Fragment,{children:(null===(o=N)||void 0===o?void 0:o.indexOf("http"))>-1||null!==(a=N)&&void 0!==a&&a.startsWith("/api")?(0,b.jsx)("video",{controls:!0,src:"".concat(N),autoPlay:!0}):(0,b.jsx)("video",{controls:!0,src:"data:video/mp4;base64,".concat(N),autoPlay:!0})}),"office"===A&&z&&(0,b.jsx)("iframe",{src:"".concat(B,"/office.html?key=").concat(z.key,"&url=").concat(U+z.url,"&callbackUrl=").concat(U+z.callbackUrl,"&fileType=").concat(z.fileType,"&title=").concat(z.title,"&model=").concat(k,"&officeServer=").concat(y.Z.ONLYOFFICE,"&disabledDownload=").concat(!!O)}),"html"===A&&(0,b.jsx)("iframe",{src:N+"&disposition=inline"}),"pdf"===A&&(0,b.jsx)("iframe",{src:"".concat(B,"/js/pdfview/index.html?url=").concat(N,"&disabledDownload=").concat(!!O)}),"image"===A&&(0,b.jsx)("img",{src:(null===(l=N)||void 0===l?void 0:l.indexOf("http"))>-1||null!==(j=N)&&void 0!==j&&j.startsWith("/api")?N:"data:image/png;base64,".concat(N)}),("other"===A||"download"===A)&&(0,b.jsx)(b.Fragment,{children:H?(0,b.jsx)(g.Z,{customText:"当前文件不支持预览,可点击下载查看",ButtonTwo:(0,b.jsx)(f.ZP,{icon:(0,b.jsx)("i",{className:"iconfont icon-xiazai4 font14"}),type:"primary",size:"middle",onClick:J,children:"下载"})}):(0,b.jsxs)(f.ZP,{type:"primary",size:"middle",onClick:J,children:[(0,b.jsx)(_.Z,{}),"点击下载"]})})]})}},80248:function(e,n,t){t.d(n,{Z:function(){return W}});var r=t(82242),s=t.n(r),o=t(37205),c=t.n(o),a=t(91232),i=t.n(a),l=t(79800),u=t.n(l),d=t(59301),p=(t(8341),t(32834)),f=t.n(p),_=t(11690);var h=[],v=["