"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[33266,4977,214],{78075:function(e,n,t){t.d(n,{Z:function(){return j}});var r=t(26801),s=t.n(r),o=t(10574),c=t.n(o),a=t(39343),i=t.n(a),l=t(11006),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),h=t(98915),v=t(55989),x=t(6848),m=t(85578),g=t(86018),w=t(57732),y=t(67871),A=t(37712),j=function(e){var n,t,r,o,a,l,j,b=e.editOffice,_=void 0===b?"view":b,C=e.data,k=(e.theme,e.type),E=e.filename,Z=e.monacoEditor,N=e.className,R=e.style,P=e.close,I=e.onClose,S=e.hasMask,B=e.disabledDownload,D=e.onImgDimensions,z=e.showNodata,Y=(0,d.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),H=u()(Y,2),O=(H[0],H[1],(0,d.useState)("")),L=u()(O,2),M=(L[0],L[1]),T=(0,d.useState)(),V=u()(T,2),U=V[0],F=V[1],K="build"===window.ENV?"/react/build":"",q=location.host.startsWith("localhost")?y.Z.PROXY_SERVER:y.Z.API_SERVER;console.log("disabledDownload---",B);var G=(0,d.useRef)();null!==(n=C)&&void 0!==n&&n.startsWith("/api")&&"txt"!==k&&(C=y.Z.API_SERVER+C),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"===k&&J()}),[k,C]);var J=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:",C),n=C,C.startsWith("http")||(n=location.origin+n),t=new URL(n).pathname.split("/").pop(),e.next=6,(0,g.gJ)({attachment_id:t});case 6:r=e.sent,F(r);case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),W=function(){C.startsWith("http")||C.startsWith("blob:")?Q():(0,m.Sv)(E||"educoder",C,E)},Q=function(){(0,m.Nd)(E||"educoder",decodeURIComponent(C))};return console.log(C,"data"),(0,A.jsxs)("div",{style:s()({},R||{}),className:"".concat(S&&p.bgBlack," ").concat(k?p.wrp:"hide"),children:[P&&(0,A.jsxs)("div",{className:p.close,ref:G,children:[!!D&&(0,A.jsx)(x.Z,{title:"点击对图片进行批注",getPopupContainer:function(){return G.current},children:(0,A.jsx)("span",{onClick:function(){I(),D()},children:(0,A.jsx)("i",{className:"icon-yulanpizhu"})})}),!B&&(0,A.jsx)(x.Z,{title:"点击下载此文件",getPopupContainer:function(){return G.current},children:(0,A.jsx)("span",{onClick:Q,children:(0,A.jsx)("i",{className:"icon-quxiaozhiding"})})}),(0,A.jsx)(x.Z,{title:"关闭",getPopupContainer:function(){return G.current},children:(0,A.jsx)("span",{className:"",onClick:I,children:(0,A.jsx)("i",{className:"icon-guanbi1"})})})]}),(0,A.jsx)("div",{className:"".concat(p[N]," ").concat(N," ").concat(p.monaco," ").concat("txt"===k?"show":"hide"),children:"txt"===k&&(0,A.jsx)(v.ZP,s()({},Z))}),"audio"===k&&(0,A.jsx)("audio",{src:(null===(t=C)||void 0===t?void 0:t.indexOf("http"))>-1||null!==(r=C)&&void 0!==r&&r.startsWith("/api")?C:"data:image/png;base64,".concat(C),autoPlay:!0}),"video"===k&&(0,A.jsx)(A.Fragment,{children:(null===(o=C)||void 0===o?void 0:o.indexOf("http"))>-1||null!==(a=C)&&void 0!==a&&a.startsWith("/api")?(0,A.jsx)("video",{controls:!0,src:"".concat(C),autoPlay:!0}):(0,A.jsx)("video",{controls:!0,src:"data:video/mp4;base64,".concat(C),autoPlay:!0})}),"office"===k&&U&&(0,A.jsx)("iframe",{src:"".concat(K,"/office.html?key=").concat(U.key,"&url=").concat(q+U.url,"&callbackUrl=").concat(q+U.callbackUrl,"&fileType=").concat(U.fileType,"&title=").concat(U.title,"&model=").concat(_,"&officeServer=").concat(y.Z.ONLYOFFICE,"&disabledDownload=").concat(!!B)}),"html"===k&&(0,A.jsx)("iframe",{src:C+"&disposition=inline"}),"pdf"===k&&(0,A.jsx)("iframe",{src:"".concat(K,"/js/pdfview/index.html?url=").concat(C,"&disabledDownload=").concat(!!B)}),"image"===k&&(0,A.jsx)("img",{src:(null===(l=C)||void 0===l?void 0:l.indexOf("http"))>-1||null!==(j=C)&&void 0!==j&&j.startsWith("/api")?C:"data:image/png;base64,".concat(C)}),("other"===k||"download"===k)&&(0,A.jsx)(A.Fragment,{children:z?(0,A.jsx)(w.Z,{customText:"当前文件不支持预览,可点击下载查看",ButtonTwo:(0,A.jsx)(f.ZP,{icon:(0,A.jsx)("i",{className:"iconfont icon-xiazai4 font14"}),type:"primary",size:"middle",onClick:W,children:"下载"})}):(0,A.jsxs)(f.ZP,{type:"primary",size:"middle",onClick:W,children:[(0,A.jsx)(h.Z,{}),"点击下载"]})})]})}},80416:function(e,n,t){t.d(n,{Z:function(){return V}});var r=t(26801),s=t.n(r),o=t(93923),c=t.n(o),a=t(98190),i=t.n(a),l=t(11006),u=t.n(l),d=t(59301),p=(t(31020),t(32834)),f=t.n(p),h=t(11690);var v=[],x=["