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