You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/7530.b547ebdd.async.js

7 lines
17 KiB

"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[7530],{69713:function(ie,k,o){var p=o(59301),S=o(93314),D=o(3113),ee=Object.defineProperty,G=Object.defineProperties,N=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,$=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable,j=(y,g,w)=>g in y?ee(y,g,{enumerable:!0,configurable:!0,writable:!0,value:w}):y[g]=w,K=(y,g)=>{for(var w in g||(g={}))$.call(g,w)&&j(y,w,g[w]);if(O)for(var w of O(g))M.call(g,w)&&j(y,w,g[w]);return y},l=(y,g)=>G(y,N(g));const H=({img:y,buttonProps:g={},styles:w={},customText:z,ButtonText:T,ButtonClick:J,Buttonclass:F,ButtonTwo:R,imgStyles:t,loading:h=!1})=>p.createElement("section",{className:"tc animated fadeIn",style:K(K({},{color:"#999",margin:"100px auto",visibility:h?"hidden":"visible"}),w)},p.createElement("img",{src:y||S,style:l(K({},t),{pointerEvents:"none",userSelect:"none"})}),p.createElement("p",{className:"mt20 font14"},z||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),T&&p.createElement(D.ZP,K({className:F,onClick:J},g),T),R&&R);k.Z=H},99366:function(ie,k,o){o.d(k,{Z:function(){return F}});var p=o(59301),S={wrp:"wrp___dq7YK",bgBlack:"bgBlack___ARIUV",monaco:"monaco___VnZC3",darkBlue:"darkBlue___UprA9",close:"close___LKoWu",embed:"embed___hvpEJ"},D=o(3113),ee=o(24758),G=o(81459),N=o(95435),O=o(93520),$=o(76697),M=o(69713),j=o(40607),K=o(40258),l=o(59301),H=Object.defineProperty,y=Object.getOwnPropertySymbols,g=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable,z=(R,t,h)=>t in R?H(R,t,{enumerable:!0,configurable:!0,writable:!0,value:h}):R[t]=h,T=(R,t)=>{for(var h in t||(t={}))g.call(t,h)&&z(R,h,t[h]);if(y)for(var h of y(t))w.call(t,h)&&z(R,h,t[h]);return R},J=(R,t,h)=>new Promise((s,u)=>{var n=c=>{try{m(h.next(c))}catch(d){u(d)}},r=c=>{try{m(h.throw(c))}catch(d){u(d)}},m=c=>c.done?s(c.value):Promise.resolve(c.value).then(n,r);m((h=h.apply(R,t)).next())}),F=({editOffice:R="view",data:t,theme:h,type:s,filename:u,monacoEditor:n,className:r,style:m,close:c,onClose:d,hasMask:E,disabledDownload:_,onImgDimensions:L,showNodata:f,recordInfo:P})=>{const[B,Z]=(0,p.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),[C,ae]=(0,p.useState)(""),[b,oe]=(0,p.useState)(),te=window.ENV==="build"?"/react/build":"",A=location.host.startsWith("localhost")?j.Z.PROXY_SERVER:j.Z.API_SERVER,ue=10*(1024*1024),Q=(0,p.useRef)();t!=null&&t.startsWith("/api")&&s!=="txt"&&(t=j.Z.API_SERVER+t);const de=W=>W.substring(W.lastIndexOf("/")+1).split(".").pop();u&&n&&(n.filename=u),(0,p.useEffect)(()=>{var W,q;const V=(q=(W=document.cookie)==null?void 0:W.replace(/\s/g,""))==null?void 0:q.split(";");V==null||V.map(ce=>{let I=ce.split("=");I[0]==="_educoder_session"&&ae(I[1])})},[]),(0,p.useEffect)(()=>{s==="office"&&(t.indexOf("bigfilescdn.")>-1||t.indexOf("bigfiles1")>-1?oe({url:t,fileType:de(t),model:t.indexOf("model=edit")?"edit":"view"}):fe())},[s,t]);const fe=()=>J(void 0,null,function*(){console.log("data:",t);let W=t;t.startsWith("http")||(W=location.origin+W);let q=new URL(W).pathname.split("/").pop();const V=yield(0,$.gJ)({attachment_id:q});V.url=A+V.url,oe(V)}),se=()=>{if(t.startsWith("http")||t.startsWith("blob:")){Y();return}(0,O.Sv)(u||"educoder",t,u)},Y=()=>{P&&(0,K.fc)({id:P==null?void 0:P.id,watch_type:1,course_id:P==null?void 0:P.course_id}),(0,O.Nd)(u||"educoder",decodeURIComponent(t))};return l.createElement("div",{style:T({},m||{}),className:`${E&&S.bgBlack} ${s?S.wrp:"hide"}`},c&&l.createElement("div",{className:S.close,ref:Q},!!L&&l.createElement(N.Z,{title:"\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",getPopupContainer:()=>Q.current},l.createElement("span",{onClick:()=>{d(),L()}},l.createElement("i",{className:"icon-yulanpizhu"}))),!_&&l.createElement(N.Z,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:()=>Q.current},l.createElement("span",{onClick:Y},l.createElement("i",{className:"icon-quxiaozhiding"}))),l.createElement(N.Z,{title:"\u5173\u95ED",getPopupContainer:()=>Q.current},l.createElement("span",{className:"",onClick:d},l.createElement("i",{className:"icon-guanbi1"})))),l.createElement("div",{className:`${S[r]} ${r} ${S.monaco} ${s==="txt"?"show":"hide"}`},s==="txt"&&l.createElement(l.Fragment,null,l.createElement(G.ZP,T({},n)))),s==="audio"&&l.createElement("audio",{src:`${(t==null?void 0:t.indexOf("http://"))>-1||(t==null?void 0:t.indexOf("https://"))>-1?"":"data:audio/mp3;base64,"}${t}`,autoPlay:!0}),s==="video"&&l.createElement(l.Fragment,null,(t==null?void 0:t.indexOf("http"))>-1?l.createElement("video",{controls:!0,src:`${t}`,autoPlay:!0}):l.createElement("video",{controls:!0,src:`data:video/mp4;base64,${t}`,autoPlay:!0})),s==="office"&&b&&l.createElement("iframe",{src:`${te}/office.html?key=${b.key}&url=${btoa(b.url)}&callbackUrl=${A+b.callbackUrl}&fileType=${b.fileType}&title=${b.title}&model=${R}&officeServer=${j.Z.ONLYOFFICE}&disabledDownload=${!!_}`}),s==="html"&&l.createElement("iframe",{src:t+"&disposition=inline"}),s==="pdf"&&l.createElement("iframe",{src:`${te}/js/pdfview/index.html?filename=${u||"educoder.pdf"}&url=${encodeURIComponent(t)}&disabledDownload=${!!_}`}),s==="image"&&l.createElement("img",{src:`${(t==null?void 0:t.indexOf("http://"))>-1||(t==null?void 0:t.indexOf("https://"))>-1?"":"data:image/png;base64,"}${t}`}),(s==="other"||s==="download")&&l.createElement(l.Fragment,null,f?l.createElement(M.Z,{customText:"\u5F53\u524D\u6587\u4EF6\u4E0D\u652F\u6301\u9884\u89C8\uFF0C\u53EF\u70B9\u51FB\u4E0B\u8F7D\u67E5\u770B",ButtonTwo:l.createElement(D.ZP,{icon:l.createElement("i",{className:"iconfont icon-xiazai4 font14"}),type:"primary",size:"middle",onClick:se,disabled:_},"\u4E0B\u8F7D")}):l.createElement(D.ZP,{type:"primary",size:"middle",onClick:se,disabled:_},l.createElement(ee.Z,null),"\u70B9\u51FB\u4E0B\u8F7D")))}},47530:function(ie,k,o){o.d(k,{z:function(){return h}});var p=o(59301),S=o(82069),D=o(58323),ee=o(64018),G=o.n(ee),N=o(55511),O=o(40607),$=o(93520),M=o(15342),j=o.n(M),K=o(48655),l=o(99366),H=Object.defineProperty,y=Object.getOwnPropertySymbols,g=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable,z=(s,u,n)=>u in s?H(s,u,{enumerable:!0,configurable:!0,writable:!0,value:n}):s[u]=n,T=(s,u)=>{for(var n in u||(u={}))g.call(u,n)&&z(s,n,u[n]);if(y)for(var n of y(u))w.call(u,n)&&z(s,n,u[n]);return s};const J="@\u2581\u2581@",F="@\u2581@",R=/<pre[^>]*>/g;function t(s){let u=document.createElement("div");return u.innerHTML=s,u.childNodes.length===0?"":u.childNodes[0].nodeValue}const h=(s,u)=>{s=s||"";const n=/(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?\)|(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?|(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,r=/\"(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?|\"(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,m=/\(\s+(?:https?:\/\/[^\/]+)?\/files\/uploads\/([A-Za-z0-9+/=]+)(\?.*?)?|\"(?:https?:\/\/[^\/]+)?\/files\/uploads\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,c=/(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g;return u?s.replaceAll("https://www.educoder.net","").replaceAll("https://www-cdn.educoder.net","").replaceAll("//api/attachments","/api/attachments").replace(n,(d,E,_,L,f,P,B)=>{const Z=E||L||P,C=_||f||B||"?";return O.Z.API_SERVER+"/api/attachments/"+Z+C+"&t="+(0,$.Jn)(Z,Date.now())+(d.indexOf(")")>-1?")":"&")}).replaceAll('src="(','src="').replaceAll("src='(",'src="'):(s=s.replace(c,(d,E,_,L,f,P,B)=>{const Z=E||L||P,C=_||f||B||"?";return O.Z.API_SERVER+"/attachments/download/"+Z+C+"&t="+(0,$.Jn)(Z,Date.now())+(d.indexOf(")")>-1?")":"&")}).replace(n,(d,E,_,L,f,P,B)=>{const Z=E||L||P,C=_||f||B||"?";return O.Z.API_SERVER+"/api/attachments/"+Z+C+"&t="+(0,$.Jn)(Z,Date.now())+(d.indexOf(")")>-1?")":"&")}).replace(r,(d,E,_,L,f)=>{const P=E||L,B=_||f||"";return'"'+O.Z.API_SERVER+"/api/attachments/"+P+B+P+B+"&t="+(0,$.Jn)(P,Date.now())}).replace(m,(d,E,_,L,f)=>{const P=E||L,B=_||f||"";return"("+O.Z.API_SERVER+"/files/uploads/"+P+B+P+B+"&t="+(0,$.Jn)(P,Date.now())}).replaceAll('src="(','src="').replaceAll("src='(",'src="').replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
`),s)};k.Z=({value:s="",className:u,showTextOnly:n,showLines:r,style:m={},stylesPrev:c={},highlightKeywords:d,showProgramFill:E,isProgramFill:_,disabledFill:L=!1,programFillValue:f,onFillChange:P=C=>{},onFillBlur:B=()=>{},onFillFocus:Z=()=>{}})=>{let C=String(s);const[ae,b]=(0,p.useState)(""),[oe,te]=(0,p.useState)("office"),[A,le]=(0,p.useState)([]),ue=(0,p.useRef)("a"+(0,K.Z)()),Q={},de=(e,v,a)=>{const i=document.createElement(e===F?"input":"textarea");i.style.width="100%",i.style.height=e===F?"40px":"151px",i.rows=5,i.spellcheck=!1,i.name="edu-program-fill",i.placeholder="\u8BF7\u8F93\u5165",i.dataset.id=v;const x=Object.keys(Q).length;return Q[x]=i,`<span class="edu-program-fill-wrap ${e===F?"":"show"}" style="width:${e===F?"400px":"100%"}" title=${a||""}><span>${i.outerHTML}<span class="edu-program-fill-score" style="margin:0 6px"></span></span></span>`};function fe(e){return e=e.replace(/!\[.*?\]\(.*?\)/g,""),e=e.replace(/\[.*?\]\(.*?\)/g,""),e=e.replace(new RegExp("<iframe.*?<\\/iframe>","gs"),""),e=e.replace(/<embed.*?>/g,""),e=e.replace(/<img.*?>/g,""),e=e.replace(new RegExp("<video.*?>.*?<\\/video>","gs"),""),e=e.replace(new RegExp("<audio.*?>.*?<\\/audio>","gs"),""),e=e.replace(new RegExp("<style.*?>.*?<\\/style>","gs"),""),e=e.replace(new RegExp("<script.*?>.*?<\\/script>","gs"),""),e}const se=e=>e.replace(/<style.*?>([\s\S]+?)<\/style>/gim,function(v,a){let i=a.replace(/(\n|\r)/g,"").split("}"),x=[];return i.map(U=>{U!=""&&x.push(`.${ue.current} ${U}`)}),`<style>${x.join("}")}</style>`}),Y=(0,p.useMemo)(()=>{try{const i=/\(\s+\/api\/attachments\/|\(\/api\/attachments\//g,x=/\"\/api\/attachments\/|\"\/attachments\/download\//g,U=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g,ne=/\(\/attachments\/download\//g;C=C.replace(ne,"("+O.Z.API_SERVER+"/attachments/download/").replace(i,"("+O.Z.API_SERVER+"/api/attachments/").replace(x,'"'+O.Z.API_SERVER+"/api/attachments/").replace(U,'"'+O.Z.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
`)}catch(i){}if(E){let i=-1;return C=C.replaceAll("<","&lt;").replaceAll(">","&gt;").replace(/(@▁▁@|@▁@)/g,function(x,U,ne){var X;return++i,de(x,i,(X=f==null?void 0:f[i])==null?void 0:X.value.replaceAll("<","&lt;").replaceAll(">","&gt;"))}),`<pre style="background:#fff;padding:4px">${se(C||"")}</pre>`}let e=se(C);e=(0,D.ZP)(e);const v=(0,D.ez)();C.match(/\[TOC\]/)&&(e=e.replace("<p>[TOC]</p>",(0,D.Qv)()),(0,D.Iy)()),e=e.replace(/(__special_katext_id_\d+__)/g,(i,x)=>{const{type:U,expression:ne}=v[x];return(0,M.renderToString)(t(ne)||"",{displayMode:U==="block",throwOnError:!1,output:"html"})}),e=e.replace(/▁/g,"\u2581\u2581\u2581\u2581\u2581"),(0,D.AL)();const a=document.createElement("div");if(a.innerHTML=e,n)return a.innerText;if(d){const i=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return ce(a,i),a.innerHTML}return setTimeout(()=>me(),500),a.innerHTML},[C,d]);(0,p.useEffect)(()=>{I.current&&I.current.querySelectorAll(["input","textarea"]).forEach(v=>{v.oninput=W,v.onblur=q,v.onfocus=V})},[A]),(0,p.useEffect)(()=>{var e,v,a,i,x;if(f!=null&&f.length)try{const U=I.current.querySelectorAll(".edu-program-fill-score"),ne=I.current.querySelectorAll('[name="edu-program-fill"]');for(const[X,re]of ne.entries())re.value=((e=f==null?void 0:f[X])==null?void 0:e.value)||"",((v=f==null?void 0:f[X])==null?void 0:v.type)==="warning"?re.className="program-fill-warning":((a=f==null?void 0:f[X])==null?void 0:a.type)==="success"?re.className="program-fill-success":re.className="";for(const[X,re]of U.entries())re.innerHTML=(i=f==null?void 0:f[X])!=null&&i.score?`${(x=f==null?void 0:f[X])==null?void 0:x.score}\u5206`:"";le(f)}catch(U){console.log(U,"error")}},[f]);const W=e=>{A[e.target.dataset.id]=A[e.target.dataset.id]||{},A[e.target.dataset.id].value=e.target.value,le([...A]),P(A,e.target.dataset.id)},q=e=>{A[e.target.dataset.id]=A[e.target.dataset.id]||{},A[e.target.dataset.id].value=e.target.value,le([...A]),B(A,e.target.dataset.id)},V=e=>{A[e.target.dataset.id]=A[e.target.dataset.id]||{},A[e.target.dataset.id].value=e.target.value,le([...A]),Z(A,e.target.dataset.id)};function ce(e,v){return e.childNodes.forEach(a=>{var i;if(a.childNodes.length>0)ce(a,v);else if(a.nodeName!=="IMG")if(a.innerHTML)a.innerHTML=(i=a.innerHTML)==null?void 0:i.replace(new RegExp(v,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>');else{const x=document.createElement("span");x.innerHTML=a.textContent.replace(new RegExp(v,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>'),a.replaceWith(x)}})}const I=(0,p.useRef)();D.jb.WebkitLineClamp=r,r&&(m=T(T({},m),D.jb));function pe(e){let v=e.target;if(v.tagName.toUpperCase()==="A"){let a=v.getAttribute("href");if(a.indexOf("office")>-1)e.preventDefault(),b(a),te("office");else if(a.indexOf("application/pdf")>-1)e.preventDefault(),b(a),te("pdf");else if(a.indexOf("text/html")>-1)e.preventDefault(),b(a),te("html");else if(a.startsWith("#")){e.preventDefault();let i=document.getElementById(a.replace("#",""));i&&i.scrollIntoView(!0)}}}const me=()=>{var e;const v=(e=I.current)==null?void 0:e.querySelectorAll("video");v==null||v.forEach(a=>{if(a.oncontextmenu=()=>!1,a.src.indexOf(".m3u8")>-1&&!a.canPlayType("application/vnd.apple.mpegurl")){if(N.ZP.isSupported()){var i=new N.ZP;i.loadSource(a.src),i.attachMedia(a)}}})};return(0,p.useEffect)(()=>{if(I.current&&Y&&Y.match(R)&&window.PR.prettyPrint(),I.current)return I.current.addEventListener("click",pe),()=>{var e;(e=I.current)==null||e.removeEventListener("click",pe),(0,D.AL)(),(0,D.Iy)()}},[Y,I.current,pe]),(0,p.useEffect)(()=>{var e;const v=a=>{a.preventDefault(),a.clipboardData.setData("text",window.getSelection().toString())};return(e=I.current)==null||e.addEventListener("copy",v),()=>{var a;(a=I.current)==null||a.removeEventListener("copy",v)}},[I.current]),p.createElement(p.Fragment,null,n&&p.createElement("div",{ref:I},Y),!n&&p.createElement("div",{ref:I,style:T({},m),className:`${u||""} ${L?"disabled-fill":""} markdown-body ${ue.current}`,dangerouslySetInnerHTML:{__html:Y}}),p.createElement(l.Z,{close:!0,data:ae,type:ae!=null&&ae.length?oe:"",style:T({},c),onClose:()=>b("")}))}},58323:function(ie,k,o){o.d(k,{AL:function(){return R},Iy:function(){return K},Qv:function(){return y},ez:function(){return F},jb:function(){return l}});var p=o(32834),S=o.n(p),D=o(11690),ee=o.n(D);let G=1;function N(n,r){const m=n.match(/^(\s+)(?:```)/);if(m===null)return r;const c=m[1];return r.split(`
`).map(d=>{const E=d.match(/^\s+/);if(E===null)return d;const[_]=E;return _.length>=c.length?d.slice(c.length):d}).join(`
`)}let O=[],$=["<ul>"];const M=new(S()).Renderer,j=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function K(){O.length=0,$=["<ul>"]}const l={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function H(n,r,m,c){if(r>=n.length||n[r].level<=m)return r;var d=n[r];c.push("<li><a href='#"+G+d.anchor+"'>"+d.text+"</a>"),r++;var E=[];return r=H(n,r,d.level,E),E.length>0&&(c.push("<ul>"),E.forEach(function(_){c.push(_)}),c.push("</ul>")),c.push("</li>"),r=H(n,r,m,c),r}function y(){return H(O,0,0,$),$.push("</ul>"),$.join("")}const g={heading(n){const r=j.exec(n);if(G+=1,r)return{type:"heading",raw:r[0],depth:r[1].length,text:r[2]}},fences(n){const r=this.rules.block.fences.exec(n);if(r){const m=r[0];let c=N(m,r[3]||"");const d=r[2]?r[2].trim():r[2];if(["latex","katex","math"].indexOf(d)>=0){const E=T(),_=c;c=E,J[E]={type:"block",expression:_}}return{type:"code",raw:m,lang:d,text:c}}}},w=/(?:\${2})([^\n`]+?)(?:\${2})/gi;let z=0;const T=()=>`__special_katext_id_${z++}__`;let J={};function F(){return J}function R(){z=0,J={}}function t(n){return n=n.replace(w,(r,m)=>{const c=T();return J[c]={type:"inline",expression:m},c}),n}const h=M.listitem;M.listitem=function(n){return h(t(n))};const s=M.paragraph;M.paragraph=function(n){return s(t(n))};const u=M.tablecell;M.tablecell=function(n,r){return u(t(n),r)},M.code=function(n,r,m){const c=(r||"").match(/\S*/)[0];return c?["latex","katex","math"].indexOf(c)>=0?`<p class='editormd-tex'>${n}</p>`:`<pre class="prettyprint linenums"><code class="language-${r}">${m?n:(0,D.escape)(n,!0)}</code></pre>
`:'<pre class="prettyprint linenums"><code>'+(m?n:(0,D.escape)(n,!0))+"</code></pre>"},M.heading=function(n,r,m){let c=this.options.headerPrefix+m.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return O.push({anchor:c,level:r,text:n}),"<h"+r+' id="'+G+c+'">'+n+"</h"+r+">"},S().setOptions({silent:!0,gfm:!0,pedantic:!1}),S().use({tokenizer:g,renderer:M}),k.ZP=S()}}]);