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/p__HttpStatus__hpcCourse.ca...

2 lines
27 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[134],{"9ivq":function(Et,ft,I){},axZZ:function(Et,ft,I){"use strict";I.r(ft);var Ft=I("DZo9"),bt=I("8z0m"),Gt=I("+L6B"),at=I("2/Rp"),Xt=I("miYZ"),Q=I("tsqr"),it=I("9og8"),z=I("tJVT"),M=I("q1tI"),E=I.n(M),$t=I("5NDa"),wt=I("5rEg"),_t=I("Ot1p"),ut=I("ErOA");function nt(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */nt=function(){return f};var s,f={},w=Object.prototype,v=w.hasOwnProperty,_=Object.defineProperty||function(r,t,e){r[t]=e.value},y=typeof Symbol=="function"?Symbol:{},j=y.iterator||"@@iterator",U=y.asyncIterator||"@@asyncIterator",L=y.toStringTag||"@@toStringTag";function h(r,t,e){return Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}),r[t]}try{h({},"")}catch(r){h=function(e,n,a){return e[n]=a}}function N(r,t,e,n){var a=t&&t.prototype instanceof x?t:x,o=Object.create(a.prototype),i=new D(n||[]);return _(o,"_invoke",{value:q(r,e,i)}),o}function c(r,t,e){try{return{type:"normal",arg:r.call(t,e)}}catch(n){return{type:"throw",arg:n}}}f.wrap=N;var C="suspendedStart",P="suspendedYield",G="executing",S="completed",p={};function x(){}function k(){}function d(){}var H={};h(H,j,function(){return this});var X=Object.getPrototypeOf,T=X&&X(X(Y([])));T&&T!==w&&v.call(T,j)&&(H=T);var O=d.prototype=x.prototype=Object.create(H);function V(r){["next","throw","return"].forEach(function(t){h(r,t,function(e){return this._invoke(t,e)})})}function A(r,t){function e(a,o,i,u){var l=c(r[a],r,o);if(l.type!=="throw"){var b=l.arg,m=b.value;return m&&typeof m=="object"&&v.call(m,"__await")?t.resolve(m.__await).then(function(g){e("next",g,i,u)},function(g){e("throw",g,i,u)}):t.resolve(m).then(function(g){b.value=g,i(b)},function(g){return e("throw",g,i,u)})}u(l.arg)}var n;_(this,"_invoke",{value:function(o,i){function u(){return new t(function(l,b){e(o,i,l,b)})}return n=n?n.then(u,u):u()}})}function q(r,t,e){var n=C;return function(a,o){if(n===G)throw new Error("Generator is already running");if(n===S){if(a==="throw")throw o;return{value:s,done:!0}}for(e.method=a,e.arg=o;;){var i=e.delegate;if(i){var u=Z(i,e);if(u){if(u===p)continue;return u}}if(e.method==="next")e.sent=e._sent=e.arg;else if(e.method==="throw"){if(n===C)throw n=S,e.arg;e.dispatchException(e.arg)}else e.method==="return"&&e.abrupt("return",e.arg);n=G;var l=c(r,t,e);if(l.type==="normal"){if(n=e.done?S:P,l.arg===p)continue;return{value:l.arg,done:e.done}}l.type==="throw"&&(n=S,e.method="throw",e.arg=l.arg)}}}function Z(r,t){var e=t.method,n=r.iterator[e];if(n===s)return t.delegate=null,e==="throw"&&r.iterator.return&&(t.method="return",t.arg=s,Z(r,t),t.method==="throw")||e!=="return"&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+e+"' method")),p;var a=c(n,r.iterator,t.arg);if(a.type==="throw")return t.method="throw",t.arg=a.arg,t.delegate=null,p;var o=a.arg;return o?o.done?(t[r.resultName]=o.value,t.next=r.nextLoc,t.method!=="return"&&(t.method="next",t.arg=s),t.delegate=null,p):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function J(r){var t={tryLoc:r[0]};1 in r&&(t.catchLoc=r[1]),2 in r&&(t.finallyLoc=r[2],t.afterLoc=r[3]),this.tryEntries.push(t)}function $(r){var t=r.completion||{};t.type="normal",delete t.arg,r.completion=t}function D(r){this.tryEntries=[{tryLoc:"root"}],r.forEach(J,this),this.reset(!0)}function Y(r){if(r||r===""){var t=r[j];if(t)return t.call(r);if(typeof r.next=="function")return r;if(!isNaN(r.length)){var e=-1,n=function a(){for(;++e<r.length;)if(v.call(r,e))return a.value=r[e],a.done=!1,a;return a.value=s,a.done=!0,a};return n.next=n}}throw new TypeError(typeof r+" is not iterable")}return k.prototype=d,_(O,"constructor",{value:d,configurable:!0}),_(d,"constructor",{value:k,configurable:!0}),k.displayName=h(d,L,"GeneratorFunction"),f.isGeneratorFunction=function(r){var t=typeof r=="function"&&r.constructor;return!!t&&(t===k||(t.displayName||t.name)==="GeneratorFunction")},f.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,d):(r.__proto__=d,h(r,L,"GeneratorFunction")),r.prototype=Object.create(O),r},f.awrap=function(r){return{__await:r}},V(A.prototype),h(A.prototype,U,function(){return this}),f.AsyncIterator=A,f.async=function(r,t,e,n,a){a===void 0&&(a=Promise);var o=new A(N(r,t,e,n),a);return f.isGeneratorFunction(t)?o:o.next().then(function(i){return i.done?i.value:o.next()})},V(O),h(O,L,"Generator"),h(O,j,function(){return this}),h(O,"toString",function(){return"[object Generator]"}),f.keys=function(r){var t=Object(r),e=[];for(var n in t)e.push(n);return e.reverse(),function a(){for(;e.length;){var o=e.pop();if(o in t)return a.value=o,a.done=!1,a}return a.done=!0,a}},f.values=Y,D.prototype={constructor:D,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=s,this.done=!1,this.delegate=null,this.method="next",this.arg=s,this.tryEntries.forEach($),!t)for(var e in this)e.charAt(0)==="t"&&v.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=s)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if(t.type==="throw")throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(b,m){return i.type="throw",i.arg=t,e.next=b,m&&(e.method="next",e.arg=s),!!m}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if(o.tryLoc==="root")return n("end");if(o.tryLoc<=this.prev){var u=v.call(o,"catchLoc"),l=v.call(o,"finallyLoc");if(u&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&v.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&(t==="break"||t==="continue")&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,p):this.complete(i)},complete:function(t,e){if(t.type==="throw")throw t.arg;return t.type==="break"||t.type==="continue"?this.next=t.arg:t.type==="return"?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):t.type==="normal"&&e&&(this.next=e),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),$(n),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var a=n.completion;if(a.type==="throw"){var o=a.arg;$(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:Y(t),resultName:e,nextLoc:n},this.method==="next"&&(this.arg=s),p}},f}function Lt(s){var f,w,v=s.setIscreate,_=s.init,y=s.UpdateItem,j=Object(M.useState)(""),U=Object(z.a)(j,2),L=U[0],h=U[1],N=Object(M.useState)(""),c=Object(z.a)(N,2),C=c[0],P=c[1];Object(M.useEffect)(function(){if(!y)return;h(y&&y.name),P(y&&y.description)},[y]);function G(){return(f=f||Object(it.a)(nt().mark(function p(){var x;return nt().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if(L){d.next=3;break}return Q.b.info("\u6807\u9898\u4E0D\u80FD\u4E3A\u7A7A"),d.abrupt("return");case 3:if(C){d.next=6;break}return Q.b.info("\u5185\u5BB9\u4E0D\u80FD\u4E3A\u7A7A"),d.abrupt("return");case 6:if(!y){d.next=9;break}return S(),d.abrupt("return");case 9:return d.next=11,Object(ut.a)("/api/hpc_courses.json",{method:"post",body:{name:L,description:C,container_type:window.location.pathname.split("/")[1]}});case 11:x=d.sent,x&&(Q.b.info("\u521B\u5EFA\u6210\u529F"),v(!1),_("add"));case 13:case"end":return d.stop()}},p)}))).apply(this,arguments)}function S(){return(w=w||Object(it.a)(nt().mark(function p(){var x;return nt().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return d.next=2,Object(ut.a)("/api/hpc_courses/".concat(y.id,".json"),{method:"put",body:{name:L,description:C,container_type:window.location.pathname.split("/")[1]}});case 2:x=d.sent,x&&(Q.b.info("\u7F16\u8F91\u6210\u529F"),v(!1),_(""));case 4:case"end":return d.stop()}},p)}))).apply(this,arguments)}return E.a.createElement("div",null,E.a.createElement(wt.a,{style:{marginBottom:"20px"},placeholder:"\u8BF7\u8F93\u5165\u6807\u9898",value:L,maxLength:60,addonAfter:String(L.length)+"/60",onChange:function(x){return h(x.target.value)}}),E.a.createElement(_t.a,{id:"courseContentMD",defaultValue:C,onChange:function(x){return P(x)}}),E.a.createElement("div",{className:"clearfix mt30 mb30"},E.a.createElement(at.a,{type:"primary",onClick:function(){return G()},className:"defalutSubmitbtn fl mr20"},"\u63D0\u4EA4"),E.a.createElement("a",{className:"defalutCancelbtn fl",onClick:function(){return v(!1)}},"\u53D6\u6D88")))}var xt=Lt,Ot=I("9Bee");function dt(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */dt=function(){return f};var s,f={},w=Object.prototype,v=w.hasOwnProperty,_=Object.defineProperty||function(r,t,e){r[t]=e.value},y=typeof Symbol=="function"?Symbol:{},j=y.iterator||"@@iterator",U=y.asyncIterator||"@@asyncIterator",L=y.toStringTag||"@@toStringTag";function h(r,t,e){return Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}),r[t]}try{h({},"")}catch(r){h=function(e,n,a){return e[n]=a}}function N(r,t,e,n){var a=t&&t.prototype instanceof x?t:x,o=Object.create(a.prototype),i=new D(n||[]);return _(o,"_invoke",{value:q(r,e,i)}),o}function c(r,t,e){try{return{type:"normal",arg:r.call(t,e)}}catch(n){return{type:"throw",arg:n}}}f.wrap=N;var C="suspendedStart",P="suspendedYield",G="executing",S="completed",p={};function x(){}function k(){}function d(){}var H={};h(H,j,function(){return this});var X=Object.getPrototypeOf,T=X&&X(X(Y([])));T&&T!==w&&v.call(T,j)&&(H=T);var O=d.prototype=x.prototype=Object.create(H);function V(r){["next","throw","return"].forEach(function(t){h(r,t,function(e){return this._invoke(t,e)})})}function A(r,t){function e(a,o,i,u){var l=c(r[a],r,o);if(l.type!=="throw"){var b=l.arg,m=b.value;return m&&typeof m=="object"&&v.call(m,"__await")?t.resolve(m.__await).then(function(g){e("next",g,i,u)},function(g){e("throw",g,i,u)}):t.resolve(m).then(function(g){b.value=g,i(b)},function(g){return e("throw",g,i,u)})}u(l.arg)}var n;_(this,"_invoke",{value:function(o,i){function u(){return new t(function(l,b){e(o,i,l,b)})}return n=n?n.then(u,u):u()}})}function q(r,t,e){var n=C;return function(a,o){if(n===G)throw new Error("Generator is already running");if(n===S){if(a==="throw")throw o;return{value:s,done:!0}}for(e.method=a,e.arg=o;;){var i=e.delegate;if(i){var u=Z(i,e);if(u){if(u===p)continue;return u}}if(e.method==="next")e.sent=e._sent=e.arg;else if(e.method==="throw"){if(n===C)throw n=S,e.arg;e.dispatchException(e.arg)}else e.method==="return"&&e.abrupt("return",e.arg);n=G;var l=c(r,t,e);if(l.type==="normal"){if(n=e.done?S:P,l.arg===p)continue;return{value:l.arg,done:e.done}}l.type==="throw"&&(n=S,e.method="throw",e.arg=l.arg)}}}function Z(r,t){var e=t.method,n=r.iterator[e];if(n===s)return t.delegate=null,e==="throw"&&r.iterator.return&&(t.method="return",t.arg=s,Z(r,t),t.method==="throw")||e!=="return"&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+e+"' method")),p;var a=c(n,r.iterator,t.arg);if(a.type==="throw")return t.method="throw",t.arg=a.arg,t.delegate=null,p;var o=a.arg;return o?o.done?(t[r.resultName]=o.value,t.next=r.nextLoc,t.method!=="return"&&(t.method="next",t.arg=s),t.delegate=null,p):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function J(r){var t={tryLoc:r[0]};1 in r&&(t.catchLoc=r[1]),2 in r&&(t.finallyLoc=r[2],t.afterLoc=r[3]),this.tryEntries.push(t)}function $(r){var t=r.completion||{};t.type="normal",delete t.arg,r.completion=t}function D(r){this.tryEntries=[{tryLoc:"root"}],r.forEach(J,this),this.reset(!0)}function Y(r){if(r||r===""){var t=r[j];if(t)return t.call(r);if(typeof r.next=="function")return r;if(!isNaN(r.length)){var e=-1,n=function a(){for(;++e<r.length;)if(v.call(r,e))return a.value=r[e],a.done=!1,a;return a.value=s,a.done=!0,a};return n.next=n}}throw new TypeError(typeof r+" is not iterable")}return k.prototype=d,_(O,"constructor",{value:d,configurable:!0}),_(d,"constructor",{value:k,configurable:!0}),k.displayName=h(d,L,"GeneratorFunction"),f.isGeneratorFunction=function(r){var t=typeof r=="function"&&r.constructor;return!!t&&(t===k||(t.displayName||t.name)==="GeneratorFunction")},f.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,d):(r.__proto__=d,h(r,L,"GeneratorFunction")),r.prototype=Object.create(O),r},f.awrap=function(r){return{__await:r}},V(A.prototype),h(A.prototype,U,function(){return this}),f.AsyncIterator=A,f.async=function(r,t,e,n,a){a===void 0&&(a=Promise);var o=new A(N(r,t,e,n),a);return f.isGeneratorFunction(t)?o:o.next().then(function(i){return i.done?i.value:o.next()})},V(O),h(O,L,"Generator"),h(O,j,function(){return this}),h(O,"toString",function(){return"[object Generator]"}),f.keys=function(r){var t=Object(r),e=[];for(var n in t)e.push(n);return e.reverse(),function a(){for(;e.length;){var o=e.pop();if(o in t)return a.value=o,a.done=!1,a}return a.done=!0,a}},f.values=Y,D.prototype={constructor:D,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=s,this.done=!1,this.delegate=null,this.method="next",this.arg=s,this.tryEntries.forEach($),!t)for(var e in this)e.charAt(0)==="t"&&v.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=s)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if(t.type==="throw")throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(b,m){return i.type="throw",i.arg=t,e.next=b,m&&(e.method="next",e.arg=s),!!m}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if(o.tryLoc==="root")return n("end");if(o.tryLoc<=this.prev){var u=v.call(o,"catchLoc"),l=v.call(o,"finallyLoc");if(u&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&v.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&(t==="break"||t==="continue")&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,p):this.complete(i)},complete:function(t,e){if(t.type==="throw")throw t.arg;return t.type==="break"||t.type==="continue"?this.next=t.arg:t.type==="return"?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):t.type==="normal"&&e&&(this.next=e),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),$(n),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var a=n.completion;if(a.type==="throw"){var o=a.arg;$(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:Y(t),resultName:e,nextLoc:n},this.method==="next"&&(this.arg=s),p}},f}function jt(s){var f,w=s.CourseItem,v=s.userId,_=s.init,y=s.ItemUpdate,j=s.setSee,U=s.UserInfo;function L(){return(f=f||Object(it.a)(dt().mark(function N(){var c;return dt().wrap(function(P){for(;;)switch(P.prev=P.next){case 0:return P.next=2,Object(ut.a)("/api/hpc_courses/".concat(w.id,".json"),{method:"delete"});case 2:c=P.sent,c&&(Q.b.info("\u5220\u9664\u6210\u529F"),_("delete"),j(!1));case 4:case"end":return P.stop()}},N)}))).apply(this,arguments)}function h(){y(w)}return E.a.createElement("div",null,v===299635||v===301458||(U==null?void 0:U.admin)||(U==null?void 0:U.business)?E.a.createElement("div",{style:{textAlign:"right"}},E.a.createElement(at.a,{onClick:function(){return h()}},"\u7F16\u8F91"),E.a.createElement(at.a,{onClick:function(){return L()},style:{marginLeft:"30px"}},"\u5220\u9664")):null,E.a.createElement("h1",null,w==null?void 0:w.name),E.a.createElement(Ot.a,{value:w==null?void 0:w.description}))}var It=jt,Yt=I("9ivq"),yt=I("m3rI"),St=I("Ty5D"),Ut=I("9kvl");function ht(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ht=function(){return f};var s,f={},w=Object.prototype,v=w.hasOwnProperty,_=Object.defineProperty||function(r,t,e){r[t]=e.value},y=typeof Symbol=="function"?Symbol:{},j=y.iterator||"@@iterator",U=y.asyncIterator||"@@asyncIterator",L=y.toStringTag||"@@toStringTag";function h(r,t,e){return Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}),r[t]}try{h({},"")}catch(r){h=function(e,n,a){return e[n]=a}}function N(r,t,e,n){var a=t&&t.prototype instanceof x?t:x,o=Object.create(a.prototype),i=new D(n||[]);return _(o,"_invoke",{value:q(r,e,i)}),o}function c(r,t,e){try{return{type:"normal",arg:r.call(t,e)}}catch(n){return{type:"throw",arg:n}}}f.wrap=N;var C="suspendedStart",P="suspendedYield",G="executing",S="completed",p={};function x(){}function k(){}function d(){}var H={};h(H,j,function(){return this});var X=Object.getPrototypeOf,T=X&&X(X(Y([])));T&&T!==w&&v.call(T,j)&&(H=T);var O=d.prototype=x.prototype=Object.create(H);function V(r){["next","throw","return"].forEach(function(t){h(r,t,function(e){return this._invoke(t,e)})})}function A(r,t){function e(a,o,i,u){var l=c(r[a],r,o);if(l.type!=="throw"){var b=l.arg,m=b.value;return m&&typeof m=="object"&&v.call(m,"__await")?t.resolve(m.__await).then(function(g){e("next",g,i,u)},function(g){e("throw",g,i,u)}):t.resolve(m).then(function(g){b.value=g,i(b)},function(g){return e("throw",g,i,u)})}u(l.arg)}var n;_(this,"_invoke",{value:function(o,i){function u(){return new t(function(l,b){e(o,i,l,b)})}return n=n?n.then(u,u):u()}})}function q(r,t,e){var n=C;return function(a,o){if(n===G)throw new Error("Generator is already running");if(n===S){if(a==="throw")throw o;return{value:s,done:!0}}for(e.method=a,e.arg=o;;){var i=e.delegate;if(i){var u=Z(i,e);if(u){if(u===p)continue;return u}}if(e.method==="next")e.sent=e._sent=e.arg;else if(e.method==="throw"){if(n===C)throw n=S,e.arg;e.dispatchException(e.arg)}else e.method==="return"&&e.abrupt("return",e.arg);n=G;var l=c(r,t,e);if(l.type==="normal"){if(n=e.done?S:P,l.arg===p)continue;return{value:l.arg,done:e.done}}l.type==="throw"&&(n=S,e.method="throw",e.arg=l.arg)}}}function Z(r,t){var e=t.method,n=r.iterator[e];if(n===s)return t.delegate=null,e==="throw"&&r.iterator.return&&(t.method="return",t.arg=s,Z(r,t),t.method==="throw")||e!=="return"&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+e+"' method")),p;var a=c(n,r.iterator,t.arg);if(a.type==="throw")return t.method="throw",t.arg=a.arg,t.delegate=null,p;var o=a.arg;return o?o.done?(t[r.resultName]=o.value,t.next=r.nextLoc,t.method!=="return"&&(t.method="next",t.arg=s),t.delegate=null,p):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function J(r){var t={tryLoc:r[0]};1 in r&&(t.catchLoc=r[1]),2 in r&&(t.finallyLoc=r[2],t.afterLoc=r[3]),this.tryEntries.push(t)}function $(r){var t=r.completion||{};t.type="normal",delete t.arg,r.completion=t}function D(r){this.tryEntries=[{tryLoc:"root"}],r.forEach(J,this),this.reset(!0)}function Y(r){if(r||r===""){var t=r[j];if(t)return t.call(r);if(typeof r.next=="function")return r;if(!isNaN(r.length)){var e=-1,n=function a(){for(;++e<r.length;)if(v.call(r,e))return a.value=r[e],a.done=!1,a;return a.value=s,a.done=!0,a};return n.next=n}}throw new TypeError(typeof r+" is not iterable")}return k.prototype=d,_(O,"constructor",{value:d,configurable:!0}),_(d,"constructor",{value:k,configurable:!0}),k.displayName=h(d,L,"GeneratorFunction"),f.isGeneratorFunction=function(r){var t=typeof r=="function"&&r.constructor;return!!t&&(t===k||(t.displayName||t.name)==="GeneratorFunction")},f.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,d):(r.__proto__=d,h(r,L,"GeneratorFunction")),r.prototype=Object.create(O),r},f.awrap=function(r){return{__await:r}},V(A.prototype),h(A.prototype,U,function(){return this}),f.AsyncIterator=A,f.async=function(r,t,e,n,a){a===void 0&&(a=Promise);var o=new A(N(r,t,e,n),a);return f.isGeneratorFunction(t)?o:o.next().then(function(i){return i.done?i.value:o.next()})},V(O),h(O,L,"Generator"),h(O,j,function(){return this}),h(O,"toString",function(){return"[object Generator]"}),f.keys=function(r){var t=Object(r),e=[];for(var n in t)e.push(n);return e.reverse(),function a(){for(;e.length;){var o=e.pop();if(o in t)return a.value=o,a.done=!1,a}return a.done=!0,a}},f.values=Y,D.prototype={constructor:D,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=s,this.done=!1,this.delegate=null,this.method="next",this.arg=s,this.tryEntries.forEach($),!t)for(var e in this)e.charAt(0)==="t"&&v.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=s)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if(t.type==="throw")throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(b,m){return i.type="throw",i.arg=t,e.next=b,m&&(e.method="next",e.arg=s),!!m}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if(o.tryLoc==="root")return n("end");if(o.tryLoc<=this.prev){var u=v.call(o,"catchLoc"),l=v.call(o,"finallyLoc");if(u&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&v.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&(t==="break"||t==="continue")&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,p):this.complete(i)},complete:function(t,e){if(t.type==="throw")throw t.arg;return t.type==="break"||t.type==="continue"?this.next=t.arg:t.type==="return"?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):t.type==="normal"&&e&&(this.next=e),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),$(n),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var a=n.completion;if(a.type==="throw"){var o=a.arg;$(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:Y(t),resultName:e,nextLoc:n},this.method==="next"&&(this.arg=s),p}},f}function kt(s){var f,w,v,_,y,j,U,L,h,N,c=s.user,C=s.dispatch,P=Object(M.useState)(1),G=Object(z.a)(P,2),S=G[0],p=G[1],x=Object(M.useState)(100),k=Object(z.a)(x,2),d=k[0],H=k[1],X=Object(M.useState)([]),T=Object(z.a)(X,2),O=T[0],V=T[1],A=Object(M.useState)(!1),q=Object(z.a)(A,2),Z=q[0],J=q[1],$=Object(M.useState)(!1),D=Object(z.a)($,2),Y=D[0],r=D[1],t=Object(M.useState)(""),e=Object(z.a)(t,2),n=e[0],a=e[1],o=Object(M.useState)(""),i=Object(z.a)(o,2),u=i[0],l=i[1],b=Object(M.useState)(""),m=Object(z.a)(b,2),g=m[0],Nt=m[1],Rt=Object(St.m)(),tt=Rt.itemname,Tt=Object(M.useState)(""),gt=Object(z.a)(Tt,2),st=gt[0],et=gt[1];Object(M.useEffect)(function(){C({type:"globalSetting/headerToggle",payload:!1}),S&&ct("")},[S]);function ct(B){return(f=f||Object(it.a)(ht().mark(function K(W){var R,ot,pt,vt,lt;return ht().wrap(function(F){for(;;)switch(F.prev=F.next){case 0:return F.next=2,Object(ut.a)("/api/hpc_courses.json",{method:"get",params:{page:S,per_page:d,container_type:window.location.pathname.split("/")[1]}});case 2:if(R=F.sent,!R){F.next=24;break}if(ot=R.data.hpc_courses.length,V(R.data.hpc_courses),Nt(R.data.file_url),l(""),ot){F.next=10;break}return F.abrupt("return");case 10:if(st){F.next=14;break}tt?(lt=0,R==null||((pt=R.data)===null||pt===void 0||((vt=pt.hpc_courses)===null||vt===void 0))||vt.map(function(rt,Dt){var mt;(tt==null?void 0:tt.toLocaleLowerCase())===(rt==null||((mt=rt.name)===null||mt===void 0)?void 0:mt.toLocaleLowerCase())&&(lt=Dt)}),a(R.data.hpc_courses[lt]),r(!0),et(R.data.hpc_courses[lt].id),(tt==null?void 0:tt.toLocaleLowerCase())==="resources"&&(a(R.data.hpc_courses.filter(function(rt){return rt.id===15})[0]),r(!0),et(15))):(a(R.data.hpc_courses[0]),r(!0),et(R.data.hpc_courses[0].id)),F.next=24;break;case 14:if(!(W==="delete")){F.next=23;break}if(!(ot===0)){F.next=18;break}return r(!1),F.abrupt("return");case 18:a(R.data.hpc_courses[0]),r(!0),et(R.data.hpc_courses[0].id),F.next=24;break;case 23:W==="add"?(a(R.data.hpc_courses[ot-1]),r(!0),et(R.data.hpc_courses[ot-1].id)):(a(R.data.hpc_courses.filter(function(rt){return rt.id===st})[0]),r(!0),et(st));case 24:case"end":return F.stop()}},K)}))).apply(this,arguments)}function Ct(B){J(!1),r(!0),a(B),et(B.id)}function Pt(B){l(B),J(!0),r(!1)}function At(){l(""),J(!0),r(!1)}var Mt={name:"file",multiple:!0,action:"https://www.educoder.net/api/hpc_courses/upload_file.json",data:{container_type:window.location.pathname.split("/")[1]},onChange:function(K){var W=K.file.status;W!=="uploading",W==="done"?(Q.b.success("".concat(K.file.name," \u6587\u4EF6\u4E0A\u4F20\u6210\u529F")),ct("")):W==="error"&&Q.b.error("".concat(K.file.name," \u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"))},beforeUpload:function(K){var W=K.size/1024/1024<150;return W||Q.b.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E150MB"),W}};return E.a.createElement("div",{style:{marginBottom:"40px"}},E.a.createElement("div",{className:"bannterdiv",style:{background:"url(".concat(yt.a.IMG_SERVER+"/".concat(g),")")}}),E.a.createElement("img",{style:{width:"100%"},src:yt.a.IMG_SERVER+"/".concat(g)}),E.a.createElement("div",{className:"edu-container minH500",style:{display:"flex",width:"1200px"}},E.a.createElement("div",{style:{flex:"1",marginTop:"17px"}},O&&O.map(function(B,K){return E.a.createElement("p",{key:K,onClick:function(){return Ct(B)},className:st===B.id?"menuitemselect":"menuitem task-hide"},B.name)}),(c==null||((w=c.userInfo)===null||w===void 0)?void 0:w.user_id)===299635||(c==null||((v=c.userInfo)===null||v===void 0)?void 0:v.user_id)===301458||(c==null||((_=c.userInfo)===null||_===void 0)?void 0:_.admin)||(c==null||((y=c.userInfo)===null||y===void 0)?void 0:y.business)?E.a.createElement("p",{onClick:function(){return At()},className:"menuadd",style:{fontSize:"24px",paddingLeft:"10px"}},E.a.createElement("span",{style:{fontSize:"16px",marginLeft:"5px"}},"Last updated")):null),E.a.createElement("div",{className:"rightcount",style:{flex:"6",background:"#ffffff",padding:"20px",marginLeft:"30px",marginTop:"24px"}},Z?E.a.createElement(xt,{UpdateItem:u,setIscreate:J,init:ct}):null,Y?E.a.createElement(It,{UserInfo:c==null?void 0:c.userInfo,setSee:r,userId:c==null||((j=c.userInfo)===null||j===void 0)?void 0:j.user_id,ItemUpdate:Pt,CourseItem:n,init:ct}):null)),(c==null||((U=c.userInfo)===null||U===void 0)?void 0:U.user_id)===299635||(c==null||((L=c.userInfo)===null||L===void 0)?void 0:L.user_id)===301458||(c==null||((h=c.userInfo)===null||h===void 0)?void 0:h.admin)||(c==null||((N=c.userInfo)===null||N===void 0)?void 0:N.business)?E.a.createElement(bt.a,Mt,E.a.createElement(at.a,{className:"menuadd",style:{paddingLeft:"10px",marginLeft:"20px"}},"\u4E0A\u4F20\u9996\u9875\u56FE\u7247")):null)}var Ht=ft.default=Object(Ut.a)(function(s){var f=s.user;return{user:f}})(kt)}}]);