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.
505 lines
1.5 MiB
505 lines
1.5 MiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[67,5,6,7,8,20],{"+GcH":function(zt,st,V){zt.exports={flex_box_center:"flex_box_center___3xHRf",flex_space_between:"flex_space_between___2VApQ",flex_box_vertical_center:"flex_box_vertical_center___M5QUt",flex_box_center_end:"flex_box_center_end___1Cj96",flex_box_column:"flex_box_column___zvXki",wrp:"wrp___1KYEa",drawer:"drawer___1uIdA",menu:"menu___MH6Nk",actived:"actived___1WaNz",actived2:"actived2___1cfLJ",listItem:"listItem___2VoBg",info:"info___1HHqK",title:"title___1LV27",titleLeft:"titleLeft___3qiqk",titleRight:"titleRight___32hrQ",search:"search___37guu",description:"description___1ap9H",menuCourse:"menuCourse___1Y9Xo",menut:"menut___jgaMW",actived3:"actived3___3x0bQ",actived4:"actived4___3niHk",subTag:"subTag___1cnUa"}},"+NIl":function(zt,st,V){(function(ie){ie(V("VrN/"))})(function(ie){"use strict";ie.defineMode("stex",function(Z,U){"use strict";function ee(o,u){o.cmdState.push(u)}function H(o){return o.cmdState.length>0?o.cmdState[o.cmdState.length-1]:null}function M(o){var u=o.cmdState.pop();u&&u.closeBracket()}function Y(o){for(var u=o.cmdState,r=u.length-1;r>=0;r--){var i=u[r];if(i.name=="DEFAULT")continue;return i}return{styleIdentifier:function(){return null}}}function X(o,u,r){return function(){this.name=o,this.bracketNo=0,this.style=u,this.styles=r,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var k={};k.importmodule=X("importmodule","tag",["string","builtin"]),k.documentclass=X("documentclass","tag",["","atom"]),k.usepackage=X("usepackage","tag",["atom"]),k.begin=X("begin","tag",["atom"]),k.end=X("end","tag",["atom"]),k.label=X("label","tag",["atom"]),k.ref=X("ref","tag",["atom"]),k.eqref=X("eqref","tag",["atom"]),k.cite=X("cite","tag",["atom"]),k.bibitem=X("bibitem","tag",["atom"]),k.Bibitem=X("Bibitem","tag",["atom"]),k.RBibitem=X("RBibitem","tag",["atom"]),k.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function D(o,u){o.f=u}function v(o,u){var r;if(o.match(/^\\[a-zA-Z@]+/)){var i=o.current().slice(1);return r=k.hasOwnProperty(i)?k[i]:k.DEFAULT,r=new r,ee(u,r),D(u,p),r.style}if(o.match(/^\\[$&%#{}_]/))return"tag";if(o.match(/^\\[,;!\/\\]/))return"tag";if(o.match("\\["))return D(u,function(c,f){return _(c,f,"\\]")}),"keyword";if(o.match("\\("))return D(u,function(c,f){return _(c,f,"\\)")}),"keyword";if(o.match("$$"))return D(u,function(c,f){return _(c,f,"$$")}),"keyword";if(o.match("$"))return D(u,function(c,f){return _(c,f,"$")}),"keyword";var t=o.next();if(t=="%")return o.skipToEnd(),"comment";if(t=="}"||t=="]"){if(r=H(u),r)r.closeBracket(t),D(u,p);else return"error";return"bracket"}else return t=="{"||t=="["?(r=k.DEFAULT,r=new r,ee(u,r),"bracket"):/\d/.test(t)?(o.eatWhile(/[\w.%]/),"atom"):(o.eatWhile(/[\w\-_]/),r=Y(u),r.name=="begin"&&(r.argument=o.current()),r.styleIdentifier())}function _(o,u,r){if(o.eatSpace())return null;if(r&&o.match(r))return D(u,v),"keyword";if(o.match(/^\\[a-zA-Z@]+/))return"tag";if(o.match(/^[a-zA-Z]+/))return"variable-2";if(o.match(/^\\[$&%#{}_]/))return"tag";if(o.match(/^\\[,;!\/]/))return"tag";if(o.match(/^[\^_&]/))return"tag";if(o.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(o.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var i=o.next();return i=="{"||i=="}"||i=="["||i=="]"||i=="("||i==")"?"bracket":i=="%"?(o.skipToEnd(),"comment"):"error"}function p(o,u){var r=o.peek(),i;return r=="{"||r=="["?(i=H(u),i.openBracket(r),o.eat(r),D(u,v),"bracket"):/[ \t\r]/.test(r)?(o.eat(r),null):(D(u,v),M(u),v(o,u))}return{startState:function(){var o=U.inMathMode?function(u,r){return _(u,r)}:v;return{cmdState:[],f:o}},copyState:function(o){return{cmdState:o.cmdState.slice(),f:o.f}},token:function(o,u){return u.f(o,u)},blankLine:function(o){o.f=v,o.cmdState.length=0},lineComment:"%"}}),ie.defineMIME("text/x-stex","stex"),ie.defineMIME("text/x-latex","stex")})},"+ua5":function(zt,st,V){},"19Vz":function(zt,st,V){(function(ie){ie(V("VrN/"))})(function(ie){ie.defineOption("placeholder","",function(X,k,D){var v=D&&D!=ie.Init;if(k&&!v)X.on("blur",H),X.on("change",M),X.on("swapDoc",M),ie.on(X.getInputField(),"compositionupdate",X.state.placeholderCompose=function(){ee(X)}),M(X);else if(!k&&v){X.off("blur",H),X.off("change",M),X.off("swapDoc",M),ie.off(X.getInputField(),"compositionupdate",X.state.placeholderCompose),Z(X);var _=X.getWrapperElement();_.className=_.className.replace(" CodeMirror-empty","")}k&&!X.hasFocus()&&H(X)});function Z(X){X.state.placeholder&&(X.state.placeholder.parentNode.removeChild(X.state.placeholder),X.state.placeholder=null)}function U(X){Z(X);var k=X.state.placeholder=document.createElement("pre");k.style.cssText="height: 0; overflow: visible",k.style.direction=X.getOption("direction"),k.className="CodeMirror-placeholder CodeMirror-line-like";var D=X.getOption("placeholder");typeof D=="string"&&(D=document.createTextNode(D)),k.appendChild(D),X.display.lineSpace.insertBefore(k,X.display.lineSpace.firstChild)}function ee(X){setTimeout(function(){var k=!1,D=X.getInputField();D.nodeName=="TEXTAREA"?k=!D.value:X.lineCount()==1&&(k=!/[^\u200b]/.test(D.querySelector(".CodeMirror-line").textContent)),k?U(X):Z(X)},20)}function H(X){Y(X)&&U(X)}function M(X){var k=X.getWrapperElement(),D=Y(X);k.className=k.className.replace(" CodeMirror-empty","")+(D?" CodeMirror-empty":""),D?U(X):Z(X)}function Y(X){return X.lineCount()===1&&X.getLine(0)===""}})},"1ZF9":function(zt,st,V){zt.exports=V.p+"static/Authorize.cc9c212f.png"},"1eCo":function(zt,st,V){(function(ie){ie(V("VrN/"))})(function(ie){"use strict";var Z={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},U={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ie.defineMode("xml",function(ee,H){var M=ee.indentUnit,Y={},X=H.htmlMode?Z:U;for(var k in X)Y[k]=X[k];for(var k in H)Y[k]=H[k];var D,v;function _(l,h){function g(N){return h.tokenize=N,N(l,h)}var b=l.next();if(b=="<")return l.eat("!")?l.eat("[")?l.match("CDATA[")?g(u("atom","]]>")):null:l.match("--")?g(u("comment","-->")):l.match("DOCTYPE",!0,!0)?(l.eatWhile(/[\w\._\-]/),g(r(1))):null:l.eat("?")?(l.eatWhile(/[\w\._\-]/),h.tokenize=u("meta","?>"),"meta"):(D=l.eat("/")?"closeTag":"openTag",h.tokenize=p,"tag bracket");if(b=="&"){var F;return l.eat("#")?l.eat("x")?F=l.eatWhile(/[a-fA-F\d]/)&&l.eat(";"):F=l.eatWhile(/[\d]/)&&l.eat(";"):F=l.eatWhile(/[\w\.\-:]/)&&l.eat(";"),F?"atom":"error"}else return l.eatWhile(/[^&<]/),null}_.isInText=!0;function p(l,h){var g=l.next();if(g==">"||g=="/"&&l.eat(">"))return h.tokenize=_,D=g==">"?"endTag":"selfcloseTag","tag bracket";if(g=="=")return D="equals",null;if(g=="<"){h.tokenize=_,h.state=f,h.tagName=h.tagStart=null;var b=h.tokenize(l,h);return b?b+" tag error":"tag error"}else return/[\'\"]/.test(g)?(h.tokenize=o(g),h.stringStartCol=l.column(),h.tokenize(l,h)):(l.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function o(l){var h=function(g,b){for(;!g.eol();)if(g.next()==l){b.tokenize=p;break}return"string"};return h.isInAttribute=!0,h}function u(l,h){return function(g,b){for(;!g.eol();){if(g.match(h)){b.tokenize=_;break}g.next()}return l}}function r(l){return function(h,g){for(var b;(b=h.next())!=null;){if(b=="<")return g.tokenize=r(l+1),g.tokenize(h,g);if(b==">")if(l==1){g.tokenize=_;break}else return g.tokenize=r(l-1),g.tokenize(h,g)}return"meta"}}function i(l,h,g){this.prev=l.context,this.tagName=h,this.indent=l.indented,this.startOfLine=g,(Y.doNotIndent.hasOwnProperty(h)||l.context&&l.context.noIndent)&&(this.noIndent=!0)}function t(l){l.context&&(l.context=l.context.prev)}function c(l,h){for(var g;;){if(!l.context)return;if(g=l.context.tagName,!Y.contextGrabbers.hasOwnProperty(g)||!Y.contextGrabbers[g].hasOwnProperty(h))return;t(l)}}function f(l,h,g){return l=="openTag"?(g.tagStart=h.column(),A):l=="closeTag"?S:f}function A(l,h,g){return l=="word"?(g.tagName=h.current(),v="tag",O):Y.allowMissingTagName&&l=="endTag"?(v="tag bracket",O(l,h,g)):(v="error",A)}function S(l,h,g){if(l=="word"){var b=h.current();return g.context&&g.context.tagName!=b&&Y.implicitlyClosed.hasOwnProperty(g.context.tagName)&&t(g),g.context&&g.context.tagName==b||Y.matchClosing===!1?(v="tag",w):(v="tag error",R)}else return Y.allowMissingTagName&&l=="endTag"?(v="tag bracket",w(l,h,g)):(v="error",R)}function w(l,h,g){return l!="endTag"?(v="error",w):(t(g),f)}function R(l,h,g){return v="error",w(l,h,g)}function O(l,h,g){if(l=="word")return v="attribute",E;if(l=="endTag"||l=="selfcloseTag"){var b=g.tagName,F=g.tagStart;return g.tagName=g.tagStart=null,l=="selfcloseTag"||Y.autoSelfClosers.hasOwnProperty(b)?c(g,b):(c(g,b),g.context=new i(g,b,F==g.indented)),f}return v="error",O}function E(l,h,g){return l=="equals"?y:(Y.allowMissing||(v="error"),O(l,h,g))}function y(l,h,g){return l=="string"?d:l=="word"&&Y.allowUnquoted?(v="string",O):(v="error",O(l,h,g))}function d(l,h,g){return l=="string"?d:O(l,h,g)}return{startState:function(l){var h={tokenize:_,state:f,indented:l||0,tagName:null,tagStart:null,context:null};return l!=null&&(h.baseIndent=l),h},token:function(l,h){if(!h.tagName&&l.sol()&&(h.indented=l.indentation()),l.eatSpace())return null;D=null;var g=h.tokenize(l,h);return(g||D)&&g!="comment"&&(v=null,h.state=h.state(D||g,l,h),v&&(g=v=="error"?g+" error":v)),g},indent:function(l,h,g){var b=l.context;if(l.tokenize.isInAttribute)return l.tagStart==l.indented?l.stringStartCol+1:l.indented+M;if(b&&b.noIndent)return ie.Pass;if(l.tokenize!=p&&l.tokenize!=_)return g?g.match(/^(\s*)/)[0].length:0;if(l.tagName)return Y.multilineTagIndentPastTag!==!1?l.tagStart+l.tagName.length+2:l.tagStart+M*(Y.multilineTagIndentFactor||1);if(Y.alignCDATA&&/<!\[CDATA\[/.test(h))return 0;var F=h&&/^<(\/)?([\w_:\.-]*)/.exec(h);if(F&&F[1])for(;b;)if(b.tagName==F[2]){b=b.prev;break}else if(Y.implicitlyClosed.hasOwnProperty(b.tagName))b=b.prev;else break;else if(F)for(;b;){var N=Y.contextGrabbers[b.tagName];if(N&&N.hasOwnProperty(F[2]))b=b.prev;else break}for(;b&&b.prev&&!b.startOfLine;)b=b.prev;return b?b.indent+M:l.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:Y.htmlMode?"html":"xml",helperType:Y.htmlMode?"html":"xml",skipAttribute:function(l){l.state==y&&(l.state=O)},xmlCurrentTag:function(l){return l.tagName?{name:l.tagName,close:l.type=="closeTag"}:null},xmlCurrentContext:function(l){for(var h=[],g=l.context;g;g=g.prev)g.tagName&&h.push(g.tagName);return h.reverse()}}}),ie.defineMIME("text/xml","xml"),ie.defineMIME("application/xml","xml"),ie.mimeModes.hasOwnProperty("text/html")||ie.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"2aBv":function(zt,st,V){"use strict";var ie=V("2qtc"),Z=V("kLXV"),U=V("0Owb"),ee=V("14J3"),H=V("BMrR"),M=V("jCWc"),Y=V("kPKH"),X=V("+L6B"),k=V("2/Rp"),D=V("oBTY"),v=V("tJVT"),_=V("q1tI"),p=V.n(_),o=V("ngQI"),u=V("Ty5D"),r=V("YIbm"),i=V.n(r),t=function(f){var A=f.visible,S=f.onOk,w=f.onCancel,R=f.data,O=Object(_.useState)([]),E=Object(v.a)(O,2),y=E[0],d=E[1],l=Object(_.useState)(!1),h=Object(v.a)(l,2),g=h[0],b=h[1],F=Object(u.i)();Object(_.useEffect)(function(){if(!A){d([]),b(!1);return}d(Object(D.a)(R)||[])},[A]);var N=function(){b(!0),S(y,function(){b(!1)})},W=function(){w()},K=function(j,$,ae){var fe=Array.from(j),pe=fe.splice($,1),Ce=Object(v.a)(pe,1),De=Ce[0];return fe.splice(ae,0,De),fe},I=function(j,$){if(!j.destination)return;var ae=K($,j.source.index,j.destination.index);d(ae)};return p.a.createElement(Z.a,{title:"\u9898\u578B\u6392\u5E8F",visible:A,centered:!0,onCancel:W,footer:p.a.createElement("div",null,p.a.createElement("span",{style:{float:"left",color:"#999",paddingTop:5}},"\u63D0\u793A:\u53EF\u5BF9\u9898\u578B\u8FDB\u884C\u4E0A\u4E0B\u62D6\u52A8\u6392\u5E8F"),p.a.createElement(k.a,{onClick:W},"\u53D6\u6D88"),p.a.createElement(k.a,{type:"primary",loading:g,onClick:N},"\u786E\u8BA4")),width:"680px"},p.a.createElement("div",{className:i.a.content},p.a.createElement(H.a,null,p.a.createElement(Y.a,{span:12},"\u5E8F\u53F7"),p.a.createElement(Y.a,{span:12},"\u9898\u578B\u540D\u79F0")),p.a.createElement(o.a,{onDragEnd:function(j){return I(j,y)}},p.a.createElement(o.c,{droppableId:"droppable"},function(x,j){return p.a.createElement("div",Object(U.a)({ref:x.innerRef},x.droppableProps,{style:{width:"100%"}}),y.map(function($,ae){return p.a.createElement(o.b,{key:ae,draggableId:ae.toString(),index:ae},function(fe,pe){return p.a.createElement("aside",Object(U.a)({ref:fe.innerRef},fe.draggableProps,fe.dragHandleProps),p.a.createElement("div",null,p.a.createElement(H.a,{style:{backgroundColor:ae%2===0?"#f5f5f5":"#fff"}},p.a.createElement(Y.a,{span:12},ae+1),p.a.createElement(Y.a,{span:12},$))))})}))}))))};st.a=t},"55Ip":function(zt,st,V){"use strict";V.d(st,"a",function(){return c});var ie=V("Ty5D"),Z=V("dI71"),U=V("q1tI"),ee=V.n(U),H=V("YS25"),M=V("17x9"),Y=V.n(M),X=V("wx14"),k=V("zLVn"),D=V("9R94"),v=function(y){Object(Z.a)(d,y);function d(){for(var h,g=arguments.length,b=new Array(g),F=0;F<g;F++)b[F]=arguments[F];return h=y.call.apply(y,[this].concat(b))||this,h.history=Object(H.a)(h.props),h}var l=d.prototype;return l.render=function(){return ee.a.createElement(ie.c,{history:this.history,children:this.props.children})},d}(ee.a.Component),_=function(y){Object(Z.a)(d,y);function d(){for(var h,g=arguments.length,b=new Array(g),F=0;F<g;F++)b[F]=arguments[F];return h=y.call.apply(y,[this].concat(b))||this,h.history=Object(H.b)(h.props),h}var l=d.prototype;return l.render=function(){return ee.a.createElement(ie.c,{history:this.history,children:this.props.children})},d}(ee.a.Component),p=function(d,l){return typeof d=="function"?d(l):d},o=function(d,l){return typeof d=="string"?Object(H.c)(d,null,null,l):d},u=function(d){return d},r=ee.a.forwardRef;typeof r=="undefined"&&(r=u);function i(y){return!!(y.metaKey||y.altKey||y.ctrlKey||y.shiftKey)}var t=r(function(y,d){var l=y.innerRef,h=y.navigate,g=y.onClick,b=Object(k.a)(y,["innerRef","navigate","onClick"]),F=b.target,N=Object(X.a)({},b,{onClick:function(K){try{g&&g(K)}catch(I){throw K.preventDefault(),I}!K.defaultPrevented&&K.button===0&&(!F||F==="_self")&&!i(K)&&(K.preventDefault(),h())}});return u!==r?N.ref=d||l:N.ref=l,ee.a.createElement("a",N)}),c=r(function(y,d){var l=y.component,h=l===void 0?t:l,g=y.replace,b=y.to,F=y.innerRef,N=Object(k.a)(y,["component","replace","to","innerRef"]);return ee.a.createElement(ie.e.Consumer,null,function(W){W||Object(D.a)(!1);var K=W.history,I=o(p(b,W.location),W.location),x=I?K.createHref(I):"",j=Object(X.a)({},N,{href:x,navigate:function(){var ae=p(b,W.location),fe=g?K.replace:K.push;fe(ae)}});return u!==r?j.ref=d||F:j.innerRef=F,ee.a.createElement(h,j)})});if(!1)var f,A;var S=function(d){return d},w=ee.a.forwardRef;typeof w=="undefined"&&(w=S);function R(){for(var y=arguments.length,d=new Array(y),l=0;l<y;l++)d[l]=arguments[l];return d.filter(function(h){return h}).join(" ")}var O=w(function(y,d){var l=y["aria-current"],h=l===void 0?"page":l,g=y.activeClassName,b=g===void 0?"active":g,F=y.activeStyle,N=y.className,W=y.exact,K=y.isActive,I=y.location,x=y.sensitive,j=y.strict,$=y.style,ae=y.to,fe=y.innerRef,pe=Object(k.a)(y,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return ee.a.createElement(ie.e.Consumer,null,function(Ce){Ce||Object(D.a)(!1);var De=I||Ce.location,xe=o(p(ae,De),De),Oe=xe.pathname,Ee=Oe&&Oe.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),be=Ee?Object(ie.f)(De.pathname,{path:Ee,exact:W,sensitive:x,strict:j}):null,te=!!(K?K(be,De):be),me=te?R(N,b):N,ye=te?Object(X.a)({},$,{},F):$,Le=Object(X.a)({"aria-current":te&&h||null,className:me,style:ye,to:xe},pe);return S!==w?Le.ref=d||fe:Le.innerRef=fe,ee.a.createElement(c,Le)})});if(!1)var E},"5VLF":function(zt,st,V){"use strict";var ie,Z;function U(ee,H,M){var Y=function(X,k){return ee.js_beautify(X,k)};return Y.js=ee.js_beautify,Y.css=H.css_beautify,Y.html=M.html_beautify,Y.js_beautify=ee.js_beautify,Y.css_beautify=H.css_beautify,Y.html_beautify=M.html_beautify,Y}!(ie=[V("6UM0"),V("TXwP"),V("psGv")],Z=function(ee,H,M){return U(ee,H,M)}.apply(st,ie),Z!==void 0&&(zt.exports=Z))},"6+eU":function(zt,st,V){"use strict";V.d(st,"a",function(){return w});var ie=V("wx14"),Z=V("rePB"),U=V("VTBJ"),ee=V("1OyB"),H=V("vuIU"),M=V("Ji7U"),Y=V("LK+K"),X=V("q1tI"),k=V.n(X),D=V("TSYQ"),v=V.n(D),_=function(O){var E,y="".concat(O.rootPrefixCls,"-item"),d=v()(y,"".concat(y,"-").concat(O.page),(E={},Object(Z.a)(E,"".concat(y,"-active"),O.active),Object(Z.a)(E,O.className,!!O.className),Object(Z.a)(E,"".concat(y,"-disabled"),!O.page),E)),l=function(){O.onClick(O.page)},h=function(b){O.onKeyPress(b,O.onClick,O.page)};return k.a.createElement("li",{title:O.showTitle?O.page:null,className:d,onClick:l,onKeyPress:h,tabIndex:"0"},O.itemRender(O.page,"page",k.a.createElement("a",{rel:"nofollow"},O.page)))},p=_,o={ZERO:48,NINE:57,NUMPAD_ZERO:96,NUMPAD_NINE:105,BACKSPACE:8,DELETE:46,ENTER:13,ARROW_UP:38,ARROW_DOWN:40},u=function(R){Object(M.a)(E,R);var O=Object(Y.a)(E);function E(){var y;Object(ee.a)(this,E);for(var d=arguments.length,l=new Array(d),h=0;h<d;h++)l[h]=arguments[h];return y=O.call.apply(O,[this].concat(l)),y.state={goInputText:""},y.buildOptionText=function(g){return"".concat(g," ").concat(y.props.locale.items_per_page)},y.changeSize=function(g){y.props.changeSize(Number(g))},y.handleChange=function(g){y.setState({goInputText:g.target.value})},y.handleBlur=function(g){var b=y.props,F=b.goButton,N=b.quickGo,W=b.rootPrefixCls,K=y.state.goInputText;if(F||K==="")return;if(g.relatedTarget&&(g.relatedTarget.className.indexOf("".concat(W,"-prev"))>=0||g.relatedTarget.className.indexOf("".concat(W,"-next"))>=0))return;y.setState({goInputText:""}),N(y.getValidValue())},y.go=function(g){var b=y.state.goInputText;if(b==="")return;(g.keyCode===o.ENTER||g.type==="click")&&(y.setState({goInputText:""}),y.props.quickGo(y.getValidValue()))},y}return Object(H.a)(E,[{key:"getValidValue",value:function(){var d=this.state,l=d.goInputText,h=d.current;return!l||isNaN(l)?h:Number(l)}},{key:"getPageSizeOptions",value:function(){var d=this.props,l=d.pageSize,h=d.pageSizeOptions;return h.some(function(g){return g.toString()===l.toString()})?h:h.concat([l.toString()]).sort(function(g,b){var F=isNaN(Number(g))?0:Number(g),N=isNaN(Number(b))?0:Number(b);return F-N})}},{key:"render",value:function(){var d=this,l=this.props,h=l.pageSize,g=l.locale,b=l.rootPrefixCls,F=l.changeSize,N=l.quickGo,W=l.goButton,K=l.selectComponentClass,I=l.buildOptionText,x=l.selectPrefixCls,j=l.disabled,$=this.state.goInputText,ae="".concat(b,"-options"),fe=K,pe=null,Ce=null,De=null;if(!F&&!N)return null;var xe=this.getPageSizeOptions();if(F&&fe){var Oe=xe.map(function(Ee,be){return k.a.createElement(fe.Option,{key:be,value:Ee.toString()},(I||d.buildOptionText)(Ee))});pe=k.a.createElement(fe,{disabled:j,prefixCls:x,showSearch:!1,className:"".concat(ae,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(h||xe[0]).toString(),onChange:this.changeSize,getPopupContainer:function(be){return be.parentNode}},Oe)}return N&&(W&&(De=typeof W=="boolean"?k.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:j,className:"".concat(ae,"-quick-jumper-button")},g.jump_to_confirm):k.a.createElement("span",{onClick:this.go,onKeyUp:this.go},W)),Ce=k.a.createElement("div",{className:"".concat(ae,"-quick-jumper")},g.jump_to,k.a.createElement("input",{disabled:j,type:"text",value:$,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),g.page,De)),k.a.createElement("li",{className:"".concat(ae)},pe,Ce)}}]),E}(k.a.Component);u.defaultProps={pageSizeOptions:["10","20","50","100"]};var r=u,i=V("N2Kk");function t(){}function c(R){return typeof R=="number"&&isFinite(R)&&Math.floor(R)===R}function f(R,O,E){return E}function A(R,O,E){var y=typeof R=="undefined"?O.pageSize:R;return Math.floor((E.total-1)/y)+1}var S=function(R){Object(M.a)(E,R);var O=Object(Y.a)(E);function E(y){var d;Object(ee.a)(this,E),d=O.call(this,y),d.getJumpPrevPage=function(){return Math.max(1,d.state.current-(d.props.showLessItems?3:5))},d.getJumpNextPage=function(){return Math.min(A(void 0,d.state,d.props),d.state.current+(d.props.showLessItems?3:5))},d.getItemIcon=function(F,N){var W=d.props.prefixCls,K=F||k.a.createElement("button",{type:"button","aria-label":N,className:"".concat(W,"-item-link")});return typeof F=="function"&&(K=k.a.createElement(F,Object(U.a)({},d.props))),K},d.savePaginationNode=function(F){d.paginationNode=F},d.isValid=function(F){return c(F)&&F!==d.state.current},d.shouldDisplayQuickJumper=function(){var F=d.props,N=F.showQuickJumper,W=F.pageSize,K=F.total;return K<=W?!1:N},d.handleKeyDown=function(F){(F.keyCode===o.ARROW_UP||F.keyCode===o.ARROW_DOWN)&&F.preventDefault()},d.handleKeyUp=function(F){var N=d.getValidValue(F),W=d.state.currentInputValue;N!==W&&d.setState({currentInputValue:N}),F.keyCode===o.ENTER?d.handleChange(N):F.keyCode===o.ARROW_UP?d.handleChange(N-1):F.keyCode===o.ARROW_DOWN&&d.handleChange(N+1)},d.changePageSize=function(F){var N=d.state.current,W=A(F,d.state,d.props);N=N>W?W:N,W===0&&(N=d.state.current),typeof F=="number"&&("pageSize"in d.props||d.setState({pageSize:F}),"current"in d.props||d.setState({current:N,currentInputValue:N})),d.props.onShowSizeChange(N,F),"onChange"in d.props&&d.props.onChange&&d.props.onChange(N,F)},d.handleChange=function(F){var N=d.props.disabled,W=F;if(d.isValid(W)&&!N){var K=A(void 0,d.state,d.props);W>K?W=K:W<1&&(W=1),"current"in d.props||d.setState({current:W,currentInputValue:W});var I=d.state.pageSize;return d.props.onChange(W,I),W}return d.state.current},d.prev=function(){d.hasPrev()&&d.handleChange(d.state.current-1)},d.next=function(){d.hasNext()&&d.handleChange(d.state.current+1)},d.jumpPrev=function(){d.handleChange(d.getJumpPrevPage())},d.jumpNext=function(){d.handleChange(d.getJumpNextPage())},d.hasPrev=function(){return d.state.current>1},d.hasNext=function(){return d.state.current<A(void 0,d.state,d.props)},d.runIfEnter=function(F,N){if(F.key==="Enter"||F.charCode===13){for(var W=arguments.length,K=new Array(W>2?W-2:0),I=2;I<W;I++)K[I-2]=arguments[I];N.apply(void 0,K)}},d.runIfEnterPrev=function(F){d.runIfEnter(F,d.prev)},d.runIfEnterNext=function(F){d.runIfEnter(F,d.next)},d.runIfEnterJumpPrev=function(F){d.runIfEnter(F,d.jumpPrev)},d.runIfEnterJumpNext=function(F){d.runIfEnter(F,d.jumpNext)},d.handleGoTO=function(F){(F.keyCode===o.ENTER||F.type==="click")&&d.handleChange(d.state.currentInputValue)};var l=y.onChange!==t,h="current"in y;h&&!l&&console.warn("Warning: You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component.");var g=y.defaultCurrent;"current"in y&&(g=y.current);var b=y.defaultPageSize;return"pageSize"in y&&(b=y.pageSize),g=Math.min(g,A(b,void 0,y)),d.state={current:g,currentInputValue:g,pageSize:b},d}return Object(H.a)(E,[{key:"componentDidUpdate",value:function(d,l){var h=this.props.prefixCls;if(l.current!==this.state.current&&this.paginationNode){var g=this.paginationNode.querySelector(".".concat(h,"-item-").concat(l.current));g&&document.activeElement===g&&g.blur()}}},{key:"getValidValue",value:function(d){var l=d.target.value,h=A(void 0,this.state,this.props),g=this.state.currentInputValue,b;return l===""?b=l:isNaN(Number(l))?b=g:l>=h?b=h:b=Number(l),b}},{key:"getShowSizeChanger",value:function(){var d=this.props,l=d.showSizeChanger,h=d.total,g=d.totalBoundaryShowSizeChanger;return typeof l!="undefined"?l:h>g}},{key:"renderPrev",value:function(d){var l=this.props,h=l.prevIcon,g=l.itemRender,b=g(d,"prev",this.getItemIcon(h,"prev page")),F=!this.hasPrev();return Object(X.isValidElement)(b)?Object(X.cloneElement)(b,{disabled:F}):b}},{key:"renderNext",value:function(d){var l=this.props,h=l.nextIcon,g=l.itemRender,b=g(d,"next",this.getItemIcon(h,"next page")),F=!this.hasNext();return Object(X.isValidElement)(b)?Object(X.cloneElement)(b,{disabled:F}):b}},{key:"render",value:function(){var d=this,l=this.props,h=l.prefixCls,g=l.className,b=l.style,F=l.disabled,N=l.hideOnSinglePage,W=l.total,K=l.locale,I=l.showQuickJumper,x=l.showLessItems,j=l.showTitle,$=l.showTotal,ae=l.simple,fe=l.itemRender,pe=l.showPrevNextJumpers,Ce=l.jumpPrevIcon,De=l.jumpNextIcon,xe=l.selectComponentClass,Oe=l.selectPrefixCls,Ee=l.pageSizeOptions,be=this.state,te=be.current,me=be.pageSize,ye=be.currentInputValue;if(N===!0&&W<=me)return null;var Le=A(void 0,this.state,this.props),$e=[],Me=null,ze=null,ot=null,Et=null,_t=null,mt=I&&I.goButton,ut=x?1:2,Xt=te-1>0?te-1:0,en=te+1<Le?te+1:Le,sn=Object.keys(this.props).reduce(function(le,he){return(he.substr(0,5)==="data-"||he.substr(0,5)==="aria-"||he==="role")&&(le[he]=d.props[he]),le},{});if(ae)return mt&&(typeof mt=="boolean"?_t=k.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},K.jump_to_confirm):_t=k.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},mt),_t=k.a.createElement("li",{title:j?"".concat(K.jump_to).concat(te,"/").concat(Le):null,className:"".concat(h,"-simple-pager")},_t)),k.a.createElement("ul",Object(ie.a)({className:v()(h,"".concat(h,"-simple"),Object(Z.a)({},"".concat(h,"-disabled"),F),g),style:b,ref:this.savePaginationNode},sn),k.a.createElement("li",{title:j?K.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:v()("".concat(h,"-prev"),Object(Z.a)({},"".concat(h,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(Xt)),k.a.createElement("li",{title:j?"".concat(te,"/").concat(Le):null,className:"".concat(h,"-simple-pager")},k.a.createElement("input",{type:"text",value:ye,disabled:F,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),k.a.createElement("span",{className:"".concat(h,"-slash")},"/"),Le),k.a.createElement("li",{title:j?K.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:v()("".concat(h,"-next"),Object(Z.a)({},"".concat(h,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(en)),_t);if(Le<=3+ut*2){var pn={locale:K,rootPrefixCls:h,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:j,itemRender:fe};Le||$e.push(k.a.createElement(p,Object(ie.a)({},pn,{key:"noPager",page:Le,className:"".concat(h,"-disabled")})));for(var Un=1;Un<=Le;Un+=1){var Cn=te===Un;$e.push(k.a.createElement(p,Object(ie.a)({},pn,{key:Un,page:Un,active:Cn})))}}else{var Qe=x?K.prev_3:K.prev_5,Ye=x?K.next_3:K.next_5;pe&&(Me=k.a.createElement("li",{title:j?Qe:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:v()("".concat(h,"-jump-prev"),Object(Z.a)({},"".concat(h,"-jump-prev-custom-icon"),!!Ce))},fe(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(Ce,"prev page"))),ze=k.a.createElement("li",{title:j?Ye:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:v()("".concat(h,"-jump-next"),Object(Z.a)({},"".concat(h,"-jump-next-custom-icon"),!!De))},fe(this.getJumpNextPage(),"jump-next",this.getItemIcon(De,"next page")))),Et=k.a.createElement(p,{locale:K,last:!0,rootPrefixCls:h,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:Le,page:Le,active:!1,showTitle:j,itemRender:fe}),ot=k.a.createElement(p,{locale:K,rootPrefixCls:h,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:j,itemRender:fe});var St=Math.max(1,te-ut),bt=Math.min(te+ut,Le);te-1<=ut&&(bt=1+ut*2),Le-te<=ut&&(St=Le-ut*2);for(var nt=St;nt<=bt;nt+=1){var vt=te===nt;$e.push(k.a.createElement(p,{locale:K,rootPrefixCls:h,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:nt,page:nt,active:vt,showTitle:j,itemRender:fe}))}te-1>=ut*2&&te!==1+2&&($e[0]=Object(X.cloneElement)($e[0],{className:"".concat(h,"-item-after-jump-prev")}),$e.unshift(Me)),Le-te>=ut*2&&te!==Le-2&&($e[$e.length-1]=Object(X.cloneElement)($e[$e.length-1],{className:"".concat(h,"-item-before-jump-next")}),$e.push(ze)),St!==1&&$e.unshift(ot),bt!==Le&&$e.push(Et)}var Ue=null;$&&(Ue=k.a.createElement("li",{className:"".concat(h,"-total-text")},$(W,[W===0?0:(te-1)*me+1,te*me>W?W:te*me])));var Ae=!this.hasPrev()||!Le,Re=!this.hasNext()||!Le;return k.a.createElement("ul",Object(ie.a)({className:v()(h,g,Object(Z.a)({},"".concat(h,"-disabled"),F)),style:b,unselectable:"unselectable",ref:this.savePaginationNode},sn),Ue,k.a.createElement("li",{title:j?K.prev_page:null,onClick:this.prev,tabIndex:Ae?null:0,onKeyPress:this.runIfEnterPrev,className:v()("".concat(h,"-prev"),Object(Z.a)({},"".concat(h,"-disabled"),Ae)),"aria-disabled":Ae},this.renderPrev(Xt)),$e,k.a.createElement("li",{title:j?K.next_page:null,onClick:this.next,tabIndex:Re?null:0,onKeyPress:this.runIfEnterNext,className:v()("".concat(h,"-next"),Object(Z.a)({},"".concat(h,"-disabled"),Re)),"aria-disabled":Re},this.renderNext(en)),k.a.createElement(r,{disabled:F,locale:K,rootPrefixCls:h,selectComponentClass:xe,selectPrefixCls:Oe,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:te,pageSize:me,pageSizeOptions:Ee,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:mt}))}}],[{key:"getDerivedStateFromProps",value:function(d,l){var h={};if("current"in d&&(h.current=d.current,d.current!==l.current&&(h.currentInputValue=h.current)),"pageSize"in d&&d.pageSize!==l.pageSize){var g=l.current,b=A(d.pageSize,l,d);g=g>b?b:g,"current"in d||(h.current=g,h.currentInputValue=g),h.pageSize=d.pageSize}return h}}]),E}(k.a.Component);S.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:t,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:t,locale:i.a,style:{},itemRender:f,totalBoundaryShowSizeChanger:50};var w=S},"69hG":function(zt,st,V){zt.exports={customModal:"customModal___1AnAw",content:"content___1zYYV",upload:"upload___1W2G-"}},"6RRn":function(zt,st,V){"use strict";var ie=V("wCXF"),Z=V("n6Qo");V.d(st,"b",function(){return Z.a});var U=V("IBYe"),ee=V("6eGT"),H=V("hW8S");V.d(st,"a",function(){return H.a}),st.c=ie.b},"6UM0":function(zt,st,V){var ie,Z;(function(){var U;(function(){"use strict";var H=[function(k,D,v){var _=v(1).Beautifier,p=v(5).Options;function o(u,r){var i=new _(u,r);return i.beautify()}k.exports=o,k.exports.defaultOptions=function(){return new p}},function(k,D,v){var _=v(2).Output,p=v(3).Token,o=v(4),u=v(5).Options,r=v(7).Tokenizer,i=v(7).line_starters,t=v(7).positionable_operators,c=v(7).TOKEN;function f(x,j){return j.indexOf(x)!==-1}function A(x){return x.replace(/^\s+/g,"")}function S(x){for(var j={},$=0;$<x.length;$++)j[x[$].replace(/-/g,"_")]=x[$];return j}function w(x,j){return x&&x.type===c.RESERVED&&x.text===j}function R(x,j){return x&&x.type===c.RESERVED&&f(x.text,j)}var O=["case","return","do","if","throw","else","await","break","continue","async"],E=["before-newline","after-newline","preserve-newline"],y=S(E),d=[y.before_newline,y.preserve_newline],l={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function h(x,j){if(j.multiline_frame||j.mode===l.ForInitializer||j.mode===l.Conditional)return;x.remove_indent(j.start_line_index)}function g(x){x=x.replace(o.allLineBreaks,`
|
|
`);for(var j=[],$=x.indexOf(`
|
|
`);$!==-1;)j.push(x.substring(0,$)),x=x.substring($+1),$=x.indexOf(`
|
|
`);return x.length&&j.push(x),j}function b(x){return x===l.ArrayLiteral}function F(x){return f(x,[l.Expression,l.ForInitializer,l.Conditional])}function N(x,j){for(var $=0;$<x.length;$++){var ae=x[$].trim();if(ae.charAt(0)!==j)return!1}return!0}function W(x,j){for(var $=0,ae=x.length,fe;$<ae;$++)if(fe=x[$],fe&&fe.indexOf(j)!==0)return!1;return!0}function K(x,j){j=j||{},this._source_text=x||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new u(j)}K.prototype.create_flags=function(x,j){var $=0;x&&($=x.indentation_level,!this._output.just_added_newline()&&x.line_indent_level>$&&($=x.line_indent_level));var ae={mode:j,parent:x,last_token:x?x.last_token:new p(c.START_BLOCK,""),last_word:x?x.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,inline_frame:!1,if_block:!1,else_block:!1,class_start_block:!1,do_block:!1,do_while:!1,import_block:!1,in_case_statement:!1,in_case:!1,case_body:!1,case_block:!1,indentation_level:$,alignment:0,line_indent_level:x?x.line_indent_level:$,start_line_index:this._output.get_line_number(),ternary_depth:0};return ae},K.prototype._reset=function(x){var j=x.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new _(this._options,j),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(l.BlockStatement);var $=new r(x,this._options);return this._tokens=$.tokenize(),x},K.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var x,j=this._reset(this._source_text),$=this._options.eol;this._options.eol==="auto"&&($=`
|
|
`,j&&o.lineBreak.test(j||"")&&($=j.match(o.lineBreak)[0]));for(var ae=this._tokens.next();ae;)this.handle_token(ae),this._last_last_text=this._flags.last_token.text,this._flags.last_token=ae,ae=this._tokens.next();return x=this._output.get_code($),x},K.prototype.handle_token=function(x,j){x.type===c.START_EXPR?this.handle_start_expr(x):x.type===c.END_EXPR?this.handle_end_expr(x):x.type===c.START_BLOCK?this.handle_start_block(x):x.type===c.END_BLOCK?this.handle_end_block(x):x.type===c.WORD?this.handle_word(x):x.type===c.RESERVED?this.handle_word(x):x.type===c.SEMICOLON?this.handle_semicolon(x):x.type===c.STRING?this.handle_string(x):x.type===c.EQUALS?this.handle_equals(x):x.type===c.OPERATOR?this.handle_operator(x):x.type===c.COMMA?this.handle_comma(x):x.type===c.BLOCK_COMMENT?this.handle_block_comment(x,j):x.type===c.COMMENT?this.handle_comment(x,j):x.type===c.DOT?this.handle_dot(x):x.type===c.EOF?this.handle_eof(x):x.type===c.UNKNOWN?this.handle_unknown(x,j):this.handle_unknown(x,j)},K.prototype.handle_whitespace_and_comments=function(x,j){var $=x.newlines,ae=this._options.keep_array_indentation&&b(this._flags.mode);if(x.comments_before)for(var fe=x.comments_before.next();fe;)this.handle_whitespace_and_comments(fe,j),this.handle_token(fe,j),fe=x.comments_before.next();if(ae)for(var pe=0;pe<$;pe+=1)this.print_newline(pe>0,j);else if(this._options.max_preserve_newlines&&$>this._options.max_preserve_newlines&&($=this._options.max_preserve_newlines),this._options.preserve_newlines&&$>1){this.print_newline(!1,j);for(var Ce=1;Ce<$;Ce+=1)this.print_newline(!0,j)}};var I=["async","break","continue","return","throw","yield"];K.prototype.allow_wrap_or_preserved_newline=function(x,j){if(j=j===void 0?!1:j,this._output.just_added_newline())return;var $=this._options.preserve_newlines&&x.newlines||j,ae=f(this._flags.last_token.text,t)||f(x.text,t);if(ae){var fe=f(this._flags.last_token.text,t)&&f(this._options.operator_position,d)||f(x.text,t);$=$&&fe}if($)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(R(this._flags.last_token,I))return;this._output.set_wrap_point()}},K.prototype.print_newline=function(x,j){if(!j&&(this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==c.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")))for(var $=this._tokens.peek();this._flags.mode===l.Statement&&!(this._flags.if_block&&w($,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(x)&&(this._flags.multiline_frame=!0)},K.prototype.print_token_line_indentation=function(x){this._output.just_added_newline()&&(this._options.keep_array_indentation&&x.newlines&&(x.text==="["||b(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(x.whitespace_before),this._output.space_before_token=!1):this._output.set_indent(this._flags.indentation_level,this._flags.alignment)&&(this._flags.line_indent_level=this._flags.indentation_level))},K.prototype.print_token=function(x){if(this._output.raw){this._output.add_raw_token(x);return}if(this._options.comma_first&&x.previous&&x.previous.type===c.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var j=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(j),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(x),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(x),this._output.non_breaking_space=!0,this._output.add_token(x.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},K.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},K.prototype.deindent=function(){this._flags.indentation_level>0&&(!this._flags.parent||this._flags.indentation_level>this._flags.parent.indentation_level)&&(this._flags.indentation_level-=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},K.prototype.set_mode=function(x){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,x),this._flags=this.create_flags(this._previous_flags,x),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},K.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===l.Statement&&h(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},K.prototype.start_of_object_property=function(){return this._flags.parent.mode===l.ObjectLiteral&&this._flags.mode===l.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||R(this._flags.last_token,["get","set"]))},K.prototype.start_of_statement=function(x){var j=!1;return j=j||R(this._flags.last_token,["var","let","const"])&&x.type===c.WORD,j=j||w(this._flags.last_token,"do"),j=j||!(this._flags.parent.mode===l.ObjectLiteral&&this._flags.mode===l.Statement)&&R(this._flags.last_token,I)&&!x.newlines,j=j||w(this._flags.last_token,"else")&&!(w(x,"if")&&!x.comments_before),j=j||this._flags.last_token.type===c.END_EXPR&&(this._previous_flags.mode===l.ForInitializer||this._previous_flags.mode===l.Conditional),j=j||this._flags.last_token.type===c.WORD&&this._flags.mode===l.BlockStatement&&!this._flags.in_case&&!(x.text==="--"||x.text==="++")&&this._last_last_text!=="function"&&x.type!==c.WORD&&x.type!==c.RESERVED,j=j||this._flags.mode===l.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||R(this._flags.last_token,["get","set"])),j?(this.set_mode(l.Statement),this.indent(),this.handle_whitespace_and_comments(x,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(x,R(x,["do","for","if","while"])),!0):!1},K.prototype.handle_start_expr=function(x){this.start_of_statement(x)||this.handle_whitespace_and_comments(x);var j=l.Expression;if(x.text==="["){if(this._flags.last_token.type===c.WORD||this._flags.last_token.text===")"){R(this._flags.last_token,i)&&(this._output.space_before_token=!0),this.print_token(x),this.set_mode(j),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}j=l.ArrayLiteral,b(this._flags.mode)&&((this._flags.last_token.text==="["||this._flags.last_token.text===","&&(this._last_last_text==="]"||this._last_last_text==="}"))&&(this._options.keep_array_indentation||this.print_newline())),f(this._flags.last_token.type,[c.START_EXPR,c.END_EXPR,c.WORD,c.OPERATOR,c.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===c.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,j=l.ForInitializer):f(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,j=l.Conditional):f(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&x.whitespace_before===""?this._output.space_before_token=!1:(f(this._flags.last_token.text,i)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===c.EQUALS||this._flags.last_token.type===c.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(x);else if(this._flags.last_token.type===c.WORD){this._output.space_before_token=!1;var $=this._tokens.peek(-3);if(this._options.space_after_named_function&&$){var ae=this._tokens.peek(-4);R($,["async","function"])||$.text==="*"&&R(ae,["async","function"])?this._output.space_before_token=!0:this._flags.mode===l.ObjectLiteral?($.text==="{"||$.text===","||$.text==="*"&&(ae.text==="{"||ae.text===","))&&(this._output.space_before_token=!0):this._flags.parent&&this._flags.parent.class_start_block&&(this._output.space_before_token=!0)}}else this.allow_wrap_or_preserved_newline(x);(this._flags.last_token.type===c.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(f(this._last_last_text,["function","yield"])||this._flags.mode===l.ObjectLiteral&&f(this._last_last_text,["{",","])))&&(this._output.space_before_token=this._options.space_after_anon_function)}this._flags.last_token.text===";"||this._flags.last_token.type===c.START_BLOCK?this.print_newline():(this._flags.last_token.type===c.END_EXPR||this._flags.last_token.type===c.START_EXPR||this._flags.last_token.type===c.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===c.COMMA)&&this.allow_wrap_or_preserved_newline(x,x.newlines),this.print_token(x),this.set_mode(j),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},K.prototype.handle_end_expr=function(x){for(;this._flags.mode===l.Statement;)this.restore_mode();this.handle_whitespace_and_comments(x),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(x,x.text==="]"&&b(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===c.START_EXPR&&!this._options.space_in_empty_paren?(this._output.trim(),this._output.space_before_token=!1):this._output.space_before_token=!0),this.deindent(),this.print_token(x),this.restore_mode(),h(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===l.Conditional&&(this._previous_flags.mode=l.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},K.prototype.handle_start_block=function(x){this.handle_whitespace_and_comments(x);var j=this._tokens.peek(),$=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===c.END_EXPR?(this.set_mode(l.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(l.BlockStatement):$&&(f($.text,[":",","])&&f(j.type,[c.STRING,c.WORD,c.RESERVED])||f(j.text,["get","set","..."])&&f($.type,[c.WORD,c.RESERVED]))?f(this._last_last_text,["class","interface"])&&!f($.text,[":",","])?this.set_mode(l.BlockStatement):this.set_mode(l.ObjectLiteral):this._flags.last_token.type===c.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(l.BlockStatement):f(this._flags.last_token.type,[c.EQUALS,c.START_EXPR,c.COMMA,c.OPERATOR])||R(this._flags.last_token,["return","throw","import","default"])?this.set_mode(l.ObjectLiteral):this.set_mode(l.BlockStatement),this._flags.last_token&&(R(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0));var ae=!j.comments_before&&j.text==="}",fe=ae&&this._flags.last_word==="function"&&this._flags.last_token.type===c.END_EXPR;if(this._options.brace_preserve_inline){var pe=0,Ce=null;this._flags.inline_frame=!0;do if(pe+=1,Ce=this._tokens.peek(pe-1),Ce.newlines){this._flags.inline_frame=!1;break}while(Ce.type!==c.EOF&&!(Ce.type===c.END_BLOCK&&Ce.opened===x))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&x.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==c.OPERATOR&&(fe||this._flags.last_token.type===c.EQUALS||R(this._flags.last_token,O)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(b(this._previous_flags.mode)&&(this._flags.last_token.type===c.START_EXPR||this._flags.last_token.type===c.COMMA)&&((this._flags.last_token.type===c.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===c.COMMA||this._flags.last_token.type===c.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(x),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==c.OPERATOR&&this._flags.last_token.type!==c.START_EXPR&&(this._flags.last_token.type===c.START_BLOCK&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(x),this.indent(),!ae&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},K.prototype.handle_end_block=function(x){for(this.handle_whitespace_and_comments(x);this._flags.mode===l.Statement;)this.restore_mode();var j=this._flags.last_token.type===c.START_BLOCK;this._flags.inline_frame&&!j?this._output.space_before_token=!0:this._options.brace_style==="expand"?j||this.print_newline():j||(b(this._flags.mode)&&this._options.keep_array_indentation?(this._options.keep_array_indentation=!1,this.print_newline(),this._options.keep_array_indentation=!0):this.print_newline()),this.restore_mode(),this.print_token(x)},K.prototype.handle_word=function(x){if(x.type===c.RESERVED){if(f(x.text,["set","get"])&&this._flags.mode!==l.ObjectLiteral)x.type=c.WORD;else if(x.text==="import"&&f(this._tokens.peek().text,["(","."]))x.type=c.WORD;else if(f(x.text,["as","from"])&&!this._flags.import_block)x.type=c.WORD;else if(this._flags.mode===l.ObjectLiteral){var j=this._tokens.peek();j.text===":"&&(x.type=c.WORD)}}if(this.start_of_statement(x)?R(this._flags.last_token,["var","let","const"])&&x.type===c.WORD&&(this._flags.declaration_statement=!0):x.newlines&&!F(this._flags.mode)&&(this._flags.last_token.type!==c.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==c.EQUALS&&(this._options.preserve_newlines||!R(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(x),this.print_newline()):this.handle_whitespace_and_comments(x),this._flags.do_block&&!this._flags.do_while)if(w(x,"while")){this._output.space_before_token=!0,this.print_token(x),this._output.space_before_token=!0,this._flags.do_while=!0;return}else this.print_newline(),this._flags.do_block=!1;if(this._flags.if_block)if(!this._flags.else_block&&w(x,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===l.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&R(x,["case","default"])){this.print_newline(),!this._flags.case_block&&(this._flags.case_body||this._options.jslint_happy)&&this.deindent(),this._flags.case_body=!1,this.print_token(x),this._flags.in_case=!0;return}if((this._flags.last_token.type===c.COMMA||this._flags.last_token.type===c.START_EXPR||this._flags.last_token.type===c.EQUALS||this._flags.last_token.type===c.OPERATOR)&&(this.start_of_object_property()||this.allow_wrap_or_preserved_newline(x)),w(x,"function")){(f(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(f(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===c.OPERATOR))&&(!this._output.just_added_blankline()&&!x.comments_before&&(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===c.RESERVED||this._flags.last_token.type===c.WORD?R(this._flags.last_token,["get","set","new","export"])||R(this._flags.last_token,I)?this._output.space_before_token=!0:w(this._flags.last_token,"default")&&this._last_last_text==="export"?this._output.space_before_token=!0:this._flags.last_token.text==="declare"?this._output.space_before_token=!0:this.print_newline():this._flags.last_token.type===c.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(F(this._flags.mode)||b(this._flags.mode))||this.print_newline(),this.print_token(x),this._flags.last_word=x.text;return}var $="NONE";if(this._flags.last_token.type===c.END_BLOCK?this._previous_flags.inline_frame?$="SPACE":R(x,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&x.newlines?$="NEWLINE":($="SPACE",this._output.space_before_token=!0):$="NEWLINE":this._flags.last_token.type===c.SEMICOLON&&this._flags.mode===l.BlockStatement?$="NEWLINE":this._flags.last_token.type===c.SEMICOLON&&F(this._flags.mode)?$="SPACE":this._flags.last_token.type===c.STRING?$="NEWLINE":this._flags.last_token.type===c.RESERVED||this._flags.last_token.type===c.WORD||this._flags.last_token.text==="*"&&(f(this._last_last_text,["function","yield"])||this._flags.mode===l.ObjectLiteral&&f(this._last_last_text,["{",","]))?$="SPACE":this._flags.last_token.type===c.START_BLOCK?this._flags.inline_frame?$="SPACE":$="NEWLINE":this._flags.last_token.type===c.END_EXPR&&(this._output.space_before_token=!0,$="NEWLINE"),R(x,i)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?$="SPACE":$="NEWLINE"),R(x,["else","catch","finally"]))if((!(this._flags.last_token.type===c.END_BLOCK&&this._previous_flags.mode===l.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&x.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var ae=this._output.current_line;ae.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else $==="NEWLINE"?R(this._flags.last_token,O)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&R(x,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==c.END_EXPR?(this._flags.last_token.type!==c.START_EXPR||!R(x,["var","let","const"]))&&this._flags.last_token.text!==":"&&(w(x,"if")&&w(x.previous,"else")?this._output.space_before_token=!0:this.print_newline()):R(x,i)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&b(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():$==="SPACE"&&(this._output.space_before_token=!0);x.previous&&(x.previous.type===c.WORD||x.previous.type===c.RESERVED)&&(this._output.space_before_token=!0),this.print_token(x),this._flags.last_word=x.text,x.type===c.RESERVED&&(x.text==="do"?this._flags.do_block=!0:x.text==="if"?this._flags.if_block=!0:x.text==="import"?this._flags.import_block=!0:this._flags.import_block&&w(x,"from")&&(this._flags.import_block=!1))},K.prototype.handle_semicolon=function(x){this.start_of_statement(x)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(x);for(var j=this._tokens.peek();this._flags.mode===l.Statement&&!(this._flags.if_block&&w(j,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(x)},K.prototype.handle_string=function(x){x.text.startsWith("`")&&x.newlines===0&&x.whitespace_before===""&&(x.previous.text===")"||this._flags.last_token.type===c.WORD)||(this.start_of_statement(x)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(x),this._flags.last_token.type===c.RESERVED||this._flags.last_token.type===c.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===c.COMMA||this._flags.last_token.type===c.START_EXPR||this._flags.last_token.type===c.EQUALS||this._flags.last_token.type===c.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(x):x.text.startsWith("`")&&this._flags.last_token.type===c.END_EXPR&&(x.previous.text==="]"||x.previous.text===")")&&x.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(x)},K.prototype.handle_equals=function(x){this.start_of_statement(x)||this.handle_whitespace_and_comments(x),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(x),this._output.space_before_token=!0},K.prototype.handle_comma=function(x){this.handle_whitespace_and_comments(x,!0),this.print_token(x),this._output.space_before_token=!0,this._flags.declaration_statement?(F(this._flags.parent.mode)&&(this._flags.declaration_assignment=!1),this._flags.declaration_assignment?(this._flags.declaration_assignment=!1,this.print_newline(!1,!0)):this._options.comma_first&&this.allow_wrap_or_preserved_newline(x)):this._flags.mode===l.ObjectLiteral||this._flags.mode===l.Statement&&this._flags.parent.mode===l.ObjectLiteral?(this._flags.mode===l.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(x)},K.prototype.handle_operator=function(x){var j=x.text==="*"&&(R(this._flags.last_token,["function","yield"])||f(this._flags.last_token.type,[c.START_BLOCK,c.COMMA,c.END_BLOCK,c.SEMICOLON])),$=f(x.text,["-","+"])&&(f(this._flags.last_token.type,[c.START_BLOCK,c.START_EXPR,c.EQUALS,c.OPERATOR])||f(this._flags.last_token.text,i)||this._flags.last_token.text===",");if(!this.start_of_statement(x)){var ae=!j;this.handle_whitespace_and_comments(x,ae)}if(x.text==="*"&&this._flags.last_token.type===c.DOT){this.print_token(x);return}if(x.text==="::"){this.print_token(x);return}if(this._flags.last_token.type===c.OPERATOR&&f(this._options.operator_position,d)&&this.allow_wrap_or_preserved_newline(x),x.text===":"&&this._flags.in_case){this.print_token(x),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==c.START_BLOCK?(this.indent(),this.print_newline(),this._flags.case_block=!1):(this._flags.case_block=!0,this._output.space_before_token=!0);return}var fe=!0,pe=!0,Ce=!1;if(x.text===":"?this._flags.ternary_depth===0?fe=!1:(this._flags.ternary_depth-=1,Ce=!0):x.text==="?"&&(this._flags.ternary_depth+=1),!$&&!j&&this._options.preserve_newlines&&f(x.text,t)){var De=x.text===":",xe=De&&Ce,Oe=De&&!Ce;switch(this._options.operator_position){case y.before_newline:this._output.space_before_token=!Oe,this.print_token(x),(!De||xe)&&this.allow_wrap_or_preserved_newline(x),this._output.space_before_token=!0;return;case y.after_newline:this._output.space_before_token=!0,!De||xe?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(x):this._output.space_before_token=!1,this.print_token(x),this._output.space_before_token=!0;return;case y.preserve_newline:Oe||this.allow_wrap_or_preserved_newline(x),fe=!(this._output.just_added_newline()||Oe),this._output.space_before_token=fe,this.print_token(x),this._output.space_before_token=!0;return}}if(j){this.allow_wrap_or_preserved_newline(x),fe=!1;var Ee=this._tokens.peek();pe=Ee&&f(Ee.type,[c.WORD,c.RESERVED])}else if(x.text==="...")this.allow_wrap_or_preserved_newline(x),fe=this._flags.last_token.type===c.START_BLOCK,pe=!1;else if(f(x.text,["--","++","!","~"])||$){if((this._flags.last_token.type===c.COMMA||this._flags.last_token.type===c.START_EXPR)&&this.allow_wrap_or_preserved_newline(x),fe=!1,pe=!1,x.newlines&&(x.text==="--"||x.text==="++"||x.text==="~")){var be=R(this._flags.last_token,O)&&x.newlines;be&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(be,!0)}this._flags.last_token.text===";"&&F(this._flags.mode)&&(fe=!0),this._flags.last_token.type===c.RESERVED?fe=!0:this._flags.last_token.type===c.END_EXPR?fe=!(this._flags.last_token.text==="]"&&(x.text==="--"||x.text==="++")):this._flags.last_token.type===c.OPERATOR&&(fe=f(x.text,["--","-","++","+"])&&f(this._flags.last_token.text,["--","-","++","+"]),f(x.text,["+","-"])&&f(this._flags.last_token.text,["--","++"])&&(pe=!0)),(this._flags.mode===l.BlockStatement&&!this._flags.inline_frame||this._flags.mode===l.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||fe,this.print_token(x),this._output.space_before_token=pe},K.prototype.handle_block_comment=function(x,j){if(this._output.raw){this._output.add_raw_token(x),x.directives&&x.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(x.directives){this.print_newline(!1,j),this.print_token(x),x.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!o.newline.test(x.text)&&!x.newlines){this._output.space_before_token=!0,this.print_token(x),this._output.space_before_token=!0;return}else this.print_block_commment(x,j)},K.prototype.print_block_commment=function(x,j){var $=g(x.text),ae,fe=!1,pe=!1,Ce=x.whitespace_before,De=Ce.length;if(this.print_newline(!1,j),this.print_token_line_indentation(x),this._output.add_token($[0]),this.print_newline(!1,j),$.length>1){for($=$.slice(1),fe=N($,"*"),pe=W($,Ce),fe&&(this._flags.alignment=1),ae=0;ae<$.length;ae++)fe?(this.print_token_line_indentation(x),this._output.add_token(A($[ae]))):pe&&$[ae]?(this.print_token_line_indentation(x),this._output.add_token($[ae].substring(De))):(this._output.current_line.set_indent(-1),this._output.add_token($[ae])),this.print_newline(!1,j);this._flags.alignment=0}},K.prototype.handle_comment=function(x,j){x.newlines?this.print_newline(!1,j):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(x),this.print_newline(!1,j)},K.prototype.handle_dot=function(x){this.start_of_statement(x)||this.handle_whitespace_and_comments(x,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),R(this._flags.last_token,O)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(x,this._flags.last_token.text===")"&&this._options.break_chained_methods),this._options.unindent_chained_methods&&this._output.just_added_newline()&&this.deindent(),this.print_token(x)},K.prototype.handle_unknown=function(x,j){this.print_token(x),x.text[x.text.length-1]===`
|
|
`&&this.print_newline(!1,j)},K.prototype.handle_eof=function(x){for(;this._flags.mode===l.Statement;)this.restore_mode();this.handle_whitespace_and_comments(x)},k.exports.Beautifier=K},function(k){function D(p){this.__parent=p,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}D.prototype.clone_empty=function(){var p=new D(this.__parent);return p.set_indent(this.__indent_count,this.__alignment_count),p},D.prototype.item=function(p){return p<0?this.__items[this.__items.length+p]:this.__items[p]},D.prototype.has_match=function(p){for(var o=this.__items.length-1;o>=0;o--)if(this.__items[o].match(p))return!0;return!1},D.prototype.set_indent=function(p,o){this.is_empty()&&(this.__indent_count=p||0,this.__alignment_count=o||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},D.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},D.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},D.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var p=this.__parent.current_line;return p.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),p.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),p.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,p.__items[0]===" "&&(p.__items.splice(0,1),p.__character_count-=1),!0}return!1},D.prototype.is_empty=function(){return this.__items.length===0},D.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},D.prototype.push=function(p){this.__items.push(p);var o=p.lastIndexOf(`
|
|
`);o!==-1?this.__character_count=p.length-o:this.__character_count+=p.length},D.prototype.pop=function(){var p=null;return this.is_empty()||(p=this.__items.pop(),this.__character_count-=p.length),p},D.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},D.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},D.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},D.prototype.toString=function(){var p="";return this.is_empty()?this.__parent.indent_empty_lines&&(p=this.__parent.get_indent_string(this.__indent_count)):(p=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),p+=this.__items.join("")),p};function v(p,o){this.__cache=[""],this.__indent_size=p.indent_size,this.__indent_string=p.indent_char,p.indent_with_tabs||(this.__indent_string=new Array(p.indent_size+1).join(p.indent_char)),o=o||"",p.indent_level>0&&(o=new Array(p.indent_level+1).join(this.__indent_string)),this.__base_string=o,this.__base_string_length=o.length}v.prototype.get_indent_size=function(p,o){var u=this.__base_string_length;return o=o||0,p<0&&(u=0),u+=p*this.__indent_size,u+=o,u},v.prototype.get_indent_string=function(p,o){var u=this.__base_string;return o=o||0,p<0&&(p=0,u=""),o+=p*this.__indent_size,this.__ensure_cache(o),u+=this.__cache[o],u},v.prototype.__ensure_cache=function(p){for(;p>=this.__cache.length;)this.__add_column()},v.prototype.__add_column=function(){var p=this.__cache.length,o=0,u="";this.__indent_size&&p>=this.__indent_size&&(o=Math.floor(p/this.__indent_size),p-=o*this.__indent_size,u=new Array(o+1).join(this.__indent_string)),p&&(u+=new Array(p+1).join(" ")),this.__cache.push(u)};function _(p,o){this.__indent_cache=new v(p,o),this.raw=!1,this._end_with_newline=p.end_with_newline,this.indent_size=p.indent_size,this.wrap_line_length=p.wrap_line_length,this.indent_empty_lines=p.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new D(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}_.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},_.prototype.get_line_number=function(){return this.__lines.length},_.prototype.get_indent_string=function(p,o){return this.__indent_cache.get_indent_string(p,o)},_.prototype.get_indent_size=function(p,o){return this.__indent_cache.get_indent_size(p,o)},_.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},_.prototype.add_new_line=function(p){return this.is_empty()||!p&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},_.prototype.get_code=function(p){this.trim(!0);var o=this.current_line.pop();o&&(o[o.length-1]===`
|
|
`&&(o=o.replace(/\n+$/g,"")),this.current_line.push(o)),this._end_with_newline&&this.__add_outputline();var u=this.__lines.join(`
|
|
`);return p!==`
|
|
`&&(u=u.replace(/[\n]/g,p)),u},_.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},_.prototype.set_indent=function(p,o){return p=p||0,o=o||0,this.next_line.set_indent(p,o),this.__lines.length>1?(this.current_line.set_indent(p,o),!0):(this.current_line.set_indent(),!1)},_.prototype.add_raw_token=function(p){for(var o=0;o<p.newlines;o++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(p.whitespace_before),this.current_line.push(p.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},_.prototype.add_token=function(p){this.__add_space_before_token(),this.current_line.push(p),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},_.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},_.prototype.remove_indent=function(p){for(var o=this.__lines.length;p<o;)this.__lines[p]._remove_indent(),p++;this.current_line._remove_wrap_indent()},_.prototype.trim=function(p){for(p=p===void 0?!1:p,this.current_line.trim();p&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},_.prototype.just_added_newline=function(){return this.current_line.is_empty()},_.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},_.prototype.ensure_empty_line_above=function(p,o){for(var u=this.__lines.length-2;u>=0;){var r=this.__lines[u];if(r.is_empty())break;if(r.item(0).indexOf(p)!==0&&r.item(-1)!==o){this.__lines.splice(u+1,0,new D(this)),this.previous_line=this.__lines[this.__lines.length-2];break}u--}},k.exports.Output=_},function(k){function D(v,_,p,o){this.type=v,this.text=_,this.comments_before=null,this.newlines=p||0,this.whitespace_before=o||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}k.exports.Token=D},function(k,D){var v="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",_="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",p="\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d\\u0c58\\u0c59\\u0c60\\u0c61\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d60\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19c1-\\u19c7\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2e2f\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc",o="\\u0300-\\u036f\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u0620-\\u0649\\u0672-\\u06d3\\u06e7-\\u06e8\\u06fb-\\u06fc\\u0730-\\u074a\\u0800-\\u0814\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0840-\\u0857\\u08e4-\\u08fe\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09d7\\u09df-\\u09e0\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5f-\\u0b60\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2-\\u0ce3\\u0ce6-\\u0cef\\u0d02\\u0d03\\u0d46-\\u0d48\\u0d57\\u0d62-\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e34-\\u0e3a\\u0e40-\\u0e45\\u0e50-\\u0e59\\u0eb4-\\u0eb9\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f41-\\u0f47\\u0f71-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1029\\u1040-\\u1049\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u170e-\\u1710\\u1720-\\u1730\\u1740-\\u1750\\u1772\\u1773\\u1780-\\u17b2\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1920-\\u192b\\u1930-\\u193b\\u1951-\\u196d\\u19b0-\\u19c0\\u19c8-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a15\\u1a20-\\u1a53\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1b46-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c00-\\u1c22\\u1c40-\\u1c49\\u1c5b-\\u1c7d\\u1cd0-\\u1cd2\\u1d00-\\u1dbe\\u1e01-\\u1f15\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2d81-\\u2d96\\u2de0-\\u2dff\\u3021-\\u3028\\u3099\\u309a\\ua640-\\ua66d\\ua674-\\ua67d\\ua69f\\ua6f0-\\ua6f1\\ua7f8-\\ua800\\ua806\\ua80b\\ua823-\\ua827\\ua880-\\ua881\\ua8b4-\\ua8c4\\ua8d0-\\ua8d9\\ua8f3-\\ua8f7\\ua900-\\ua909\\ua926-\\ua92d\\ua930-\\ua945\\ua980-\\ua983\\ua9b3-\\ua9c0\\uaa00-\\uaa27\\uaa40-\\uaa41\\uaa4c-\\uaa4d\\uaa50-\\uaa59\\uaa7b\\uaae0-\\uaae9\\uaaf2-\\uaaf3\\uabc0-\\uabe1\\uabec\\uabed\\uabf0-\\uabf9\\ufb20-\\ufb28\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f",u="(?:\\\\u[0-9a-fA-F]{4}|["+v+p+"])",r="(?:\\\\u[0-9a-fA-F]{4}|["+_+p+o+"])*";D.identifier=new RegExp(u+r,"g"),D.identifierStart=new RegExp(u),D.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+_+p+o+"])+");var i=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;D.newline=/[\n\r\u2028\u2029]/,D.lineBreak=new RegExp(`\r
|
|
|`+D.newline.source),D.allLineBreaks=new RegExp(D.lineBreak.source,"g")},function(k,D,v){var _=v(6).Options,p=["before-newline","after-newline","preserve-newline"];function o(u){_.call(this,u,"js");var r=this.raw_options.brace_style||null;r==="expand-strict"?this.raw_options.brace_style="expand":r==="collapse-preserve-inline"?this.raw_options.brace_style="collapse,preserve-inline":this.raw_options.braces_on_own_line!==void 0&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var i=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var t=0;t<i.length;t++)i[t]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=i[t];this.unindent_chained_methods=this._get_boolean("unindent_chained_methods"),this.break_chained_methods=this._get_boolean("break_chained_methods"),this.space_in_paren=this._get_boolean("space_in_paren"),this.space_in_empty_paren=this._get_boolean("space_in_empty_paren"),this.jslint_happy=this._get_boolean("jslint_happy"),this.space_after_anon_function=this._get_boolean("space_after_anon_function"),this.space_after_named_function=this._get_boolean("space_after_named_function"),this.keep_array_indentation=this._get_boolean("keep_array_indentation"),this.space_before_conditional=this._get_boolean("space_before_conditional",!0),this.unescape_strings=this._get_boolean("unescape_strings"),this.e4x=this._get_boolean("e4x"),this.comma_first=this._get_boolean("comma_first"),this.operator_position=this._get_selection("operator_position",p),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}o.prototype=new _,k.exports.Options=o},function(k){function D(p,o){this.raw_options=v(p,o),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}D.prototype._get_array=function(p,o){var u=this.raw_options[p],r=o||[];return typeof u=="object"?u!==null&&typeof u.concat=="function"&&(r=u.concat()):typeof u=="string"&&(r=u.split(/[^a-zA-Z0-9_\/\-]+/)),r},D.prototype._get_boolean=function(p,o){var u=this.raw_options[p],r=u===void 0?!!o:!!u;return r},D.prototype._get_characters=function(p,o){var u=this.raw_options[p],r=o||"";return typeof u=="string"&&(r=u.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),r},D.prototype._get_number=function(p,o){var u=this.raw_options[p];o=parseInt(o,10),isNaN(o)&&(o=0);var r=parseInt(u,10);return isNaN(r)&&(r=o),r},D.prototype._get_selection=function(p,o,u){var r=this._get_selection_list(p,o,u);if(r.length!==1)throw new Error("Invalid Option Value: The option '"+p+`' can only be one of the following values:
|
|
`+o+`
|
|
You passed in: '`+this.raw_options[p]+"'");return r[0]},D.prototype._get_selection_list=function(p,o,u){if(!o||o.length===0)throw new Error("Selection list cannot be empty.");if(u=u||[o[0]],!this._is_valid_selection(u,o))throw new Error("Invalid Default Value!");var r=this._get_array(p,u);if(!this._is_valid_selection(r,o))throw new Error("Invalid Option Value: The option '"+p+`' can contain only the following values:
|
|
`+o+`
|
|
You passed in: '`+this.raw_options[p]+"'");return r},D.prototype._is_valid_selection=function(p,o){return p.length&&o.length&&!p.some(function(u){return o.indexOf(u)===-1})};function v(p,o){var u={};p=_(p);var r;for(r in p)r!==o&&(u[r]=p[r]);if(o&&p[o])for(r in p[o])u[r]=p[o][r];return u}function _(p){var o={},u;for(u in p){var r=u.replace(/-/g,"_");o[r]=p[u]}return o}k.exports.Options=D,k.exports.normalizeOpts=_,k.exports.mergeOpts=v},function(k,D,v){var _=v(8).InputScanner,p=v(9).Tokenizer,o=v(9).TOKEN,u=v(13).Directives,r=v(4),i=v(12).Pattern,t=v(14).TemplatablePattern;function c(N,W){return W.indexOf(N)!==-1}var f={START_EXPR:"TK_START_EXPR",END_EXPR:"TK_END_EXPR",START_BLOCK:"TK_START_BLOCK",END_BLOCK:"TK_END_BLOCK",WORD:"TK_WORD",RESERVED:"TK_RESERVED",SEMICOLON:"TK_SEMICOLON",STRING:"TK_STRING",EQUALS:"TK_EQUALS",OPERATOR:"TK_OPERATOR",COMMA:"TK_COMMA",BLOCK_COMMENT:"TK_BLOCK_COMMENT",COMMENT:"TK_COMMENT",DOT:"TK_DOT",UNKNOWN:"TK_UNKNOWN",START:o.START,RAW:o.RAW,EOF:o.EOF},A=new u(/\/\*/,/\*\//),S=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,w=/[0-9]/,R=/[^\d\.]/,O=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),E=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";E=E.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),E="\\?\\.(?!\\d) "+E,E=E.replace(/ /g,"|");var y=new RegExp(E),d="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),l=d.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),h=new RegExp("^(?:"+l.join("|")+")$"),g,b=function(N,W){p.call(this,N,W),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var K=new i(this._input),I=new t(this._input).read_options(this._options);this.__patterns={template:I,identifier:I.starting_with(r.identifier).matching(r.identifierMatch),number:K.matching(S),punct:K.matching(y),comment:K.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:K.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:K.matching(/<!--/),html_comment_end:K.matching(/-->/),include:K.starting_with(/#include/).until_after(r.lineBreak),shebang:K.starting_with(/#!/).until_after(r.lineBreak),xml:K.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[^}]+?}|!\[CDATA\[[^\]]*?\]\]|)(\s*{[^}]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{([^{}]|{[^}]+?})+?}))*\s*(\/?)\s*>/),single_quote:I.until(/['\\\n\r\u2028\u2029]/),double_quote:I.until(/["\\\n\r\u2028\u2029]/),template_text:I.until(/[`\\$]/),template_expression:I.until(/[`}\\]/)}};b.prototype=new p,b.prototype._is_comment=function(N){return N.type===f.COMMENT||N.type===f.BLOCK_COMMENT||N.type===f.UNKNOWN},b.prototype._is_opening=function(N){return N.type===f.START_BLOCK||N.type===f.START_EXPR},b.prototype._is_closing=function(N,W){return(N.type===f.END_BLOCK||N.type===f.END_EXPR)&&W&&(N.text==="]"&&W.text==="["||N.text===")"&&W.text==="("||N.text==="}"&&W.text==="{")},b.prototype._reset=function(){g=!1},b.prototype._get_next_token=function(N,W){var K=null;this._readWhitespace();var I=this._input.peek();return I===null?this._create_token(f.EOF,""):(K=K||this._read_non_javascript(I),K=K||this._read_string(I),K=K||this._read_word(N),K=K||this._read_singles(I),K=K||this._read_comment(I),K=K||this._read_regexp(I,N),K=K||this._read_xml(I,N),K=K||this._read_punctuation(),K=K||this._create_token(f.UNKNOWN,this._input.next()),K)},b.prototype._read_word=function(N){var W;if(W=this.__patterns.identifier.read(),W!=="")return W=W.replace(r.allLineBreaks,`
|
|
`),!(N.type===f.DOT||N.type===f.RESERVED&&(N.text==="set"||N.text==="get"))&&h.test(W)?(W==="in"||W==="of")&&(N.type===f.WORD||N.type===f.STRING)?this._create_token(f.OPERATOR,W):this._create_token(f.RESERVED,W):this._create_token(f.WORD,W);if(W=this.__patterns.number.read(),W!=="")return this._create_token(f.WORD,W)},b.prototype._read_singles=function(N){var W=null;return N==="("||N==="["?W=this._create_token(f.START_EXPR,N):N===")"||N==="]"?W=this._create_token(f.END_EXPR,N):N==="{"?W=this._create_token(f.START_BLOCK,N):N==="}"?W=this._create_token(f.END_BLOCK,N):N===";"?W=this._create_token(f.SEMICOLON,N):N==="."&&R.test(this._input.peek(1))?W=this._create_token(f.DOT,N):N===","&&(W=this._create_token(f.COMMA,N)),W&&this._input.next(),W},b.prototype._read_punctuation=function(){var N=this.__patterns.punct.read();if(N!=="")return N==="="?this._create_token(f.EQUALS,N):N==="?."?this._create_token(f.DOT,N):this._create_token(f.OPERATOR,N)},b.prototype._read_non_javascript=function(N){var W="";if(N==="#"){if(this._is_first_token()&&(W=this.__patterns.shebang.read(),W))return this._create_token(f.UNKNOWN,W.trim()+`
|
|
`);if(W=this.__patterns.include.read(),W)return this._create_token(f.UNKNOWN,W.trim()+`
|
|
`);N=this._input.next();var K="#";if(this._input.hasNext()&&this._input.testChar(w)){do N=this._input.next(),K+=N;while(this._input.hasNext()&&N!=="#"&&N!=="=");return N==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(K+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(K+="{}",this._input.next(),this._input.next())),this._create_token(f.WORD,K)}this._input.back()}else if(N==="<"&&this._is_first_token()){if(W=this.__patterns.html_comment_start.read(),W){for(;this._input.hasNext()&&!this._input.testChar(r.newline);)W+=this._input.next();return g=!0,this._create_token(f.COMMENT,W)}}else if(g&&N==="-"&&(W=this.__patterns.html_comment_end.read(),W))return g=!1,this._create_token(f.COMMENT,W);return null},b.prototype._read_comment=function(N){var W=null;if(N==="/"){var K="";if(this._input.peek(1)==="*"){K=this.__patterns.block_comment.read();var I=A.get_directives(K);I&&I.ignore==="start"&&(K+=A.readIgnored(this._input)),K=K.replace(r.allLineBreaks,`
|
|
`),W=this._create_token(f.BLOCK_COMMENT,K),W.directives=I}else this._input.peek(1)==="/"&&(K=this.__patterns.comment.read(),W=this._create_token(f.COMMENT,K))}return W},b.prototype._read_string=function(N){if(N==="`"||N==="'"||N==='"'){var W=this._input.next();return this.has_char_escapes=!1,N==="`"?W+=this._read_string_recursive("`",!0,"${"):W+=this._read_string_recursive(N),this.has_char_escapes&&this._options.unescape_strings&&(W=F(W)),this._input.peek()===N&&(W+=this._input.next()),W=W.replace(r.allLineBreaks,`
|
|
`),this._create_token(f.STRING,W)}return null},b.prototype._allow_regexp_or_xml=function(N){return N.type===f.RESERVED&&c(N.text,["return","case","throw","else","do","typeof","yield"])||N.type===f.END_EXPR&&N.text===")"&&N.opened.previous.type===f.RESERVED&&c(N.opened.previous.text,["if","while","for"])||c(N.type,[f.COMMENT,f.START_EXPR,f.START_BLOCK,f.START,f.END_BLOCK,f.OPERATOR,f.EQUALS,f.EOF,f.SEMICOLON,f.COMMA])},b.prototype._read_regexp=function(N,W){if(N==="/"&&this._allow_regexp_or_xml(W)){for(var K=this._input.next(),I=!1,x=!1;this._input.hasNext()&&(I||x||this._input.peek()!==N)&&!this._input.testChar(r.newline);)K+=this._input.peek(),I?I=!1:(I=this._input.peek()==="\\",this._input.peek()==="["?x=!0:this._input.peek()==="]"&&(x=!1)),this._input.next();return this._input.peek()===N&&(K+=this._input.next(),K+=this._input.read(r.identifier)),this._create_token(f.STRING,K)}return null},b.prototype._read_xml=function(N,W){if(this._options.e4x&&N==="<"&&this._allow_regexp_or_xml(W)){var K="",I=this.__patterns.xml.read_match();if(I){for(var x=I[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),j=x.indexOf("{")===0,$=0;I;){var ae=!!I[1],fe=I[2],pe=!!I[I.length-1]||fe.slice(0,8)==="![CDATA[";if(!pe&&(fe===x||j&&fe.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(ae?--$:++$),K+=I[0],$<=0)break;I=this.__patterns.xml.read_match()}return I||(K+=this._input.match(/[\s\S]*/g)[0]),K=K.replace(r.allLineBreaks,`
|
|
`),this._create_token(f.STRING,K)}}return null};function F(N){for(var W="",K=0,I=new _(N),x=null;I.hasNext();)if(x=I.match(/([\s]|[^\\]|\\\\)+/g),x&&(W+=x[0]),I.peek()==="\\"){if(I.next(),I.peek()==="x")x=I.match(/x([0-9A-Fa-f]{2})/g);else if(I.peek()==="u")x=I.match(/u([0-9A-Fa-f]{4})/g);else{W+="\\",I.hasNext()&&(W+=I.next());continue}if(!x)return N;if(K=parseInt(x[1],16),K>126&&K<=255&&x[0].indexOf("x")===0)return N;if(K>=0&&K<32){W+="\\"+x[0];continue}else K===34||K===39||K===92?W+="\\"+String.fromCharCode(K):W+=String.fromCharCode(K)}return W}b.prototype._read_string_recursive=function(N,W,K){var I,x;N==="'"?x=this.__patterns.single_quote:N==='"'?x=this.__patterns.double_quote:N==="`"?x=this.__patterns.template_text:N==="}"&&(x=this.__patterns.template_expression);for(var j=x.read(),$="";this._input.hasNext();){if($=this._input.next(),$===N||!W&&r.newline.test($)){this._input.back();break}else $==="\\"&&this._input.hasNext()?(I=this._input.peek(),I==="x"||I==="u"?this.has_char_escapes=!0:I==="\r"&&this._input.peek(1)===`
|
|
`&&this._input.next(),$+=this._input.next()):K&&(K==="${"&&$==="$"&&this._input.peek()==="{"&&($+=this._input.next()),K===$&&(N==="`"?$+=this._read_string_recursive("}",W,"`"):$+=this._read_string_recursive("`",W,"${"),this._input.hasNext()&&($+=this._input.next())));$+=x.read(),j+=$}return j},k.exports.Tokenizer=b,k.exports.TOKEN=f,k.exports.positionable_operators=O.slice(),k.exports.line_starters=d.slice()},function(k){var D=RegExp.prototype.hasOwnProperty("sticky");function v(_){this.__input=_||"",this.__input_length=this.__input.length,this.__position=0}v.prototype.restart=function(){this.__position=0},v.prototype.back=function(){this.__position>0&&(this.__position-=1)},v.prototype.hasNext=function(){return this.__position<this.__input_length},v.prototype.next=function(){var _=null;return this.hasNext()&&(_=this.__input.charAt(this.__position),this.__position+=1),_},v.prototype.peek=function(_){var p=null;return _=_||0,_+=this.__position,_>=0&&_<this.__input_length&&(p=this.__input.charAt(_)),p},v.prototype.__match=function(_,p){_.lastIndex=p;var o=_.exec(this.__input);return o&&!(D&&_.sticky)&&(o.index!==p&&(o=null)),o},v.prototype.test=function(_,p){return p=p||0,p+=this.__position,p>=0&&p<this.__input_length?!!this.__match(_,p):!1},v.prototype.testChar=function(_,p){var o=this.peek(p);return _.lastIndex=0,o!==null&&_.test(o)},v.prototype.match=function(_){var p=this.__match(_,this.__position);return p?this.__position+=p[0].length:p=null,p},v.prototype.read=function(_,p,o){var u="",r;return _&&(r=this.match(_),r&&(u+=r[0])),p&&(r||!_)&&(u+=this.readUntil(p,o)),u},v.prototype.readUntil=function(_,p){var o="",u=this.__position;_.lastIndex=this.__position;var r=_.exec(this.__input);return r?(u=r.index,p&&(u+=r[0].length)):u=this.__input_length,o=this.__input.substring(this.__position,u),this.__position=u,o},v.prototype.readUntilAfter=function(_){return this.readUntil(_,!0)},v.prototype.get_regexp=function(_,p){var o=null,u="g";return p&&D&&(u="y"),typeof _=="string"&&_!==""?o=new RegExp(_,u):_&&(o=new RegExp(_.source,u)),o},v.prototype.get_literal_regexp=function(_){return RegExp(_.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},v.prototype.peekUntilAfter=function(_){var p=this.__position,o=this.readUntilAfter(_);return this.__position=p,o},v.prototype.lookBack=function(_){var p=this.__position-1;return p>=_.length&&this.__input.substring(p-_.length,p).toLowerCase()===_},k.exports.InputScanner=v},function(k,D,v){var _=v(8).InputScanner,p=v(3).Token,o=v(10).TokenStream,u=v(11).WhitespacePattern,r={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},i=function(t,c){this._input=new _(t),this._options=c||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new u(this._input)};i.prototype.tokenize=function(){this._input.restart(),this.__tokens=new o,this._reset();for(var t,c=new p(r.START,""),f=null,A=[],S=new o;c.type!==r.EOF;){for(t=this._get_next_token(c,f);this._is_comment(t);)S.add(t),t=this._get_next_token(c,f);S.isEmpty()||(t.comments_before=S,S=new o),t.parent=f,this._is_opening(t)?(A.push(f),f=t):f&&this._is_closing(t,f)&&(t.opened=f,f.closed=t,f=A.pop(),t.parent=f),t.previous=c,c.next=t,this.__tokens.add(t),c=t}return this.__tokens},i.prototype._is_first_token=function(){return this.__tokens.isEmpty()},i.prototype._reset=function(){},i.prototype._get_next_token=function(t,c){this._readWhitespace();var f=this._input.read(/.+/g);return f?this._create_token(r.RAW,f):this._create_token(r.EOF,"")},i.prototype._is_comment=function(t){return!1},i.prototype._is_opening=function(t){return!1},i.prototype._is_closing=function(t,c){return!1},i.prototype._create_token=function(t,c){var f=new p(t,c,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return f},i.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},k.exports.Tokenizer=i,k.exports.TOKEN=r},function(k){function D(v){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=v}D.prototype.restart=function(){this.__position=0},D.prototype.isEmpty=function(){return this.__tokens_length===0},D.prototype.hasNext=function(){return this.__position<this.__tokens_length},D.prototype.next=function(){var v=null;return this.hasNext()&&(v=this.__tokens[this.__position],this.__position+=1),v},D.prototype.peek=function(v){var _=null;return v=v||0,v+=this.__position,v>=0&&v<this.__tokens_length&&(_=this.__tokens[v]),_},D.prototype.add=function(v){this.__parent_token&&(v.parent=this.__parent_token),this.__tokens.push(v),this.__tokens_length+=1},k.exports.TokenStream=D},function(k,D,v){var _=v(12).Pattern;function p(o,u){_.call(this,o,u),u?this._line_regexp=this._input.get_regexp(u._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}p.prototype=new _,p.prototype.__set_whitespace_patterns=function(o,u){o+="\\t ",u+="\\n\\r",this._match_pattern=this._input.get_regexp("["+o+u+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+u+"]")},p.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var o=this._input.read(this._match_pattern);if(o===" ")this.whitespace_before_token=" ";else if(o){var u=this.__split(this._newline_regexp,o);this.newline_count=u.length-1,this.whitespace_before_token=u[this.newline_count]}return o},p.prototype.matching=function(o,u){var r=this._create();return r.__set_whitespace_patterns(o,u),r._update(),r},p.prototype._create=function(){return new p(this._input,this)},p.prototype.__split=function(o,u){o.lastIndex=0;for(var r=0,i=[],t=o.exec(u);t;)i.push(u.substring(r,t.index)),r=t.index+t[0].length,t=o.exec(u);return r<u.length?i.push(u.substring(r,u.length)):i.push(""),i},k.exports.WhitespacePattern=p},function(k){function D(v,_){this._input=v,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,_&&(this._starting_pattern=this._input.get_regexp(_._starting_pattern,!0),this._match_pattern=this._input.get_regexp(_._match_pattern,!0),this._until_pattern=this._input.get_regexp(_._until_pattern),this._until_after=_._until_after)}D.prototype.read=function(){var v=this._input.read(this._starting_pattern);return(!this._starting_pattern||v)&&(v+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),v},D.prototype.read_match=function(){return this._input.match(this._match_pattern)},D.prototype.until_after=function(v){var _=this._create();return _._until_after=!0,_._until_pattern=this._input.get_regexp(v),_._update(),_},D.prototype.until=function(v){var _=this._create();return _._until_after=!1,_._until_pattern=this._input.get_regexp(v),_._update(),_},D.prototype.starting_with=function(v){var _=this._create();return _._starting_pattern=this._input.get_regexp(v,!0),_._update(),_},D.prototype.matching=function(v){var _=this._create();return _._match_pattern=this._input.get_regexp(v,!0),_._update(),_},D.prototype._create=function(){return new D(this._input,this)},D.prototype._update=function(){},k.exports.Pattern=D},function(k){function D(v,_){v=typeof v=="string"?v:v.source,_=typeof _=="string"?_:_.source,this.__directives_block_pattern=new RegExp(v+/ beautify( \w+[:]\w+)+ /.source+_,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(v+/\sbeautify\signore:end\s/.source+_,"g")}D.prototype.get_directives=function(v){if(!v.match(this.__directives_block_pattern))return null;var _={};this.__directive_pattern.lastIndex=0;for(var p=this.__directive_pattern.exec(v);p;)_[p[1]]=p[2],p=this.__directive_pattern.exec(v);return _},D.prototype.readIgnored=function(v){return v.readUntilAfter(this.__directives_end_ignore_pattern)},k.exports.Directives=D},function(k,D,v){var _=v(12).Pattern,p={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function o(u,r){_.call(this,u,r),this.__template_pattern=null,this._disabled=Object.assign({},p),this._excluded=Object.assign({},p),r&&(this.__template_pattern=this._input.get_regexp(r.__template_pattern),this._excluded=Object.assign(this._excluded,r._excluded),this._disabled=Object.assign(this._disabled,r._disabled));var i=new _(u);this.__patterns={handlebars_comment:i.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:i.starting_with(/{{{/).until_after(/}}}/),handlebars:i.starting_with(/{{/).until_after(/}}/),php:i.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:i.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:i.starting_with(/{%/).until_after(/%}/),django_value:i.starting_with(/{{/).until_after(/}}/),django_comment:i.starting_with(/{#/).until_after(/#}/),smarty:i.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:i.starting_with(/{\*/).until_after(/\*}/),smarty_literal:i.starting_with(/{literal}/).until_after(/{\/literal}/)}}o.prototype=new _,o.prototype._create=function(){return new o(this._input,this)},o.prototype._update=function(){this.__set_templated_pattern()},o.prototype.disable=function(u){var r=this._create();return r._disabled[u]=!0,r._update(),r},o.prototype.read_options=function(u){var r=this._create();for(var i in p)r._disabled[i]=u.templating.indexOf(i)===-1;return r._update(),r},o.prototype.exclude=function(u){var r=this._create();return r._excluded[u]=!0,r._update(),r},o.prototype.read=function(){var u="";this._match_pattern?u=this._input.read(this._starting_pattern):u=this._input.read(this._starting_pattern,this.__template_pattern);for(var r=this._read_template();r;)this._match_pattern?r+=this._input.read(this._match_pattern):r+=this._input.readUntil(this.__template_pattern),u+=r,r=this._read_template();return this._until_after&&(u+=this._input.readUntilAfter(this._until_pattern)),u},o.prototype.__set_templated_pattern=function(){var u=[];this._disabled.php||u.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||u.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||u.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(u.push(this.__patterns.django._starting_pattern.source),u.push(this.__patterns.django_value._starting_pattern.source),u.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||u.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&u.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+u.join("|")+")")},o.prototype._read_template=function(){var u="",r=this._input.peek();if(r==="<"){var i=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&i==="?"&&(u=u||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&i==="%"&&(u=u||this.__patterns.erb.read())}else r==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(u=u||this.__patterns.handlebars_comment.read(),u=u||this.__patterns.handlebars_unescaped.read(),u=u||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(u=u||this.__patterns.django_value.read()),this._excluded.django||(u=u||this.__patterns.django_comment.read(),u=u||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(u=u||this.__patterns.smarty_comment.read(),u=u||this.__patterns.smarty_literal.read(),u=u||this.__patterns.smarty.read()));return u},k.exports.TemplatablePattern=o}],M={};function Y(k){var D=M[k];if(D!==void 0)return D.exports;var v=M[k]={exports:{}};return H[k](v,v.exports,Y),v.exports}var X=Y(0);U=X})();var ee=U;!(ie=[],Z=function(){return{js_beautify:ee}}.apply(st,ie),Z!==void 0&&(zt.exports=Z))})()},"6eGT":function(zt,st,V){"use strict";function ie(Z){return null}st.a=ie},"7Cbv":function(zt,st,V){"use strict";var ie=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),Z=new Uint8Array(16);function U(){if(!ie)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ie(Z)}var ee=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function H(p){return typeof p=="string"&&ee.test(p)}for(var M=H,Y=[],X=0;X<256;++X)Y.push((X+256).toString(16).substr(1));function k(p){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,u=(Y[p[o+0]]+Y[p[o+1]]+Y[p[o+2]]+Y[p[o+3]]+"-"+Y[p[o+4]]+Y[p[o+5]]+"-"+Y[p[o+6]]+Y[p[o+7]]+"-"+Y[p[o+8]]+Y[p[o+9]]+"-"+Y[p[o+10]]+Y[p[o+11]]+Y[p[o+12]]+Y[p[o+13]]+Y[p[o+14]]+Y[p[o+15]]).toLowerCase();if(!M(u))throw TypeError("Stringified UUID is invalid");return u}var D=k;function v(p,o,u){p=p||{};var r=p.random||(p.rng||U)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,o){u=u||0;for(var i=0;i<16;++i)o[u+i]=r[i];return o}return D(r)}var _=st.a=v},"7ahc":function(zt,st,V){"use strict";V.d(st,"a",function(){return A});var ie=V("k1fw"),Z=V("0Owb"),U=V("+L6B"),ee=V("2/Rp"),H=V("y8nQ"),M=V("Vl3Y"),Y=V("tJVT"),X=V("OaEy"),k=V("2fM7"),D=V("q1tI"),v=V.n(D),_=V("VrN/"),p=V.n(_),o=V("p77/"),u=V.n(o),r=V("c5Ni"),i=V.n(r),t=k.a.Option,c={labelCol:{span:4},wrapperCol:{span:20}},f={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};st.b=function(S){var w=S.callback,R=S.onCancel,O=Object(D.useState)("python"),E=Object(Y.a)(O,2),y=E[0],d=E[1];function l(g){d(f[g][1])}function h(g){w(g)}return v.a.createElement(M.a,Object(Z.a)({},c,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:h}),v.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},v.a.createElement(k.a,{onChange:l},Object.keys(f).map(function(g){return v.a.createElement(t,{key:g,value:g},f[g][0])}))),v.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},v.a.createElement(A,{mode:y})),v.a.createElement("div",{className:"flex-container flex-end"},v.a.createElement(ee.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),v.a.createElement(ee.a,{type:"ghost",onClick:R},"\u53D6\u6D88")))};function A(S){var w=S.value,R=S.onChange,O=S.mode,E=S.options,y=E===void 0?{}:E,d=Object(D.useRef)(),l=Object(D.useState)(),h=Object(Y.a)(l,2),g=h[0],b=h[1];return Object(D.useEffect)(function(){if(g){function F(N){var W=N.getValue();R&&R(W)}return g.on("change",F),function(){g.off("change",F)}}},[g,R]),Object(D.useEffect)(function(){g&&g.setOption("mode",O)},[g,O]),Object(D.useEffect)(function(){g&&((w!==g.getValue()||w==="")&&setTimeout(function(){g.setValue(w||" ")},300))},[g,w]),Object(D.useEffect)(function(){if(d.current&&!g){var F=p.a.fromTextArea(d.current,Object(ie.a)({mode:O,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},y));b(F)}},[d.current,g]),v.a.createElement("div",{className:"my-codemirror-container"},v.a.createElement("textarea",{ref:d}))}},"7qnI":function(zt,st,V){"use strict";var ie=V("5Dmo"),Z=V("3S7+"),U=V("fWQN"),ee=V("mtLc"),H=V("yKVA"),M=V("879j"),Y=V("5NDa"),X=V("5rEg"),k=V("q1tI"),D=V.n(k),v=V("O2Wb"),_=V.n(v),p=X.a.TextArea,o=function(u){Object(H.a)(i,u);var r=Object(M.a)(i);function i(){return Object(U.a)(this,i),r.apply(this,arguments)}return Object(ee.a)(i,[{key:"render",value:function(){var c=this,f=this.props,A=f.index,S=f.onAnswerChange,w=f.addChildAnswer,R=f.exerciseIsPublish,O=f.answers,E=f.activeOptionErrorIndex,y=f.flex,d=y===void 0?"0 0 1000px":y;return D.a.createElement("div",{className:_.a.flex},D.a.createElement("div",{className:"".concat(_.a.color666," mb5 mt6"),style:{flex:"0 0 90px"}},"\u7B54\u6848(\u586B\u7A7A",A+1,"):"),D.a.createElement("div",{className:"".concat(_.a.flex," ").concat(_.a.flex1),style:{flexDirection:"column"}},O.map(function(l,h){var g="".concat(A,"-").concat(h);return D.a.createElement("div",{className:"".concat(_.a.flex," ").concat(_.a.flex1),key:h},D.a.createElement("div",{className:_.a.flex1,style:{flex:d}},D.a.createElement("div",null,D.a.createElement(p,{className:g===E?_.a.error:"",spellCheck:!1,rows:4,value:l||"",defaultValue:"\u8BF7\u8F93\u5165\u53C2\u8003\u7B54\u6848".concat(h==0?"":"(\u53EF\u9009)"),onChange:function(F){return S(A,h,F.target.value)},style:{minHeight:95}}))),!R&&D.a.createElement(D.a.Fragment,null,h!=0&&D.a.createElement(Z.a,{title:"\u5220\u9664"},D.a.createElement("i",{className:"".concat(_.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return c.props.deleteChildAnswer(A,h)},style:{float:"right"}})),h===0&&D.a.createElement(Z.a,{title:"\u5220\u9664"},D.a.createElement("i",{className:"".concat(_.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return c.props.deleteChildAnswermain(A,h)},style:{float:"right"}})),D.a.createElement(Z.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},D.a.createElement("i",{className:"".concat(_.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return w(A)},style:{float:"right",visibility:h==O.length-1?"":"hidden"}}))))})))}}]),i}(k.Component);st.a=o},"815F":function(zt,st,V){"use strict";V.d(st,"e",function(){return Y}),V.d(st,"c",function(){return k}),V.d(st,"d",function(){return D}),V.d(st,"a",function(){return _}),V.d(st,"f",function(){return p}),V.d(st,"b",function(){return o});var ie=V("KQm4"),Z=V("VTBJ"),U=V("Ff2n"),ee=V("Zm9Q"),H=V("Kwbf"),M=V("OZM5");function Y(u,r){return u!=null?u:r}function X(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=new Map;function i(t){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(t||[]).forEach(function(f){var A=f.key,S=f.children;Object(H.a)(A!=null,"Tree node must have a certain key: [".concat(c).concat(A,"]"));var w=String(A);Object(H.a)(!r.has(w)||A===null||A===void 0,"Same 'key' exist in the Tree: ".concat(w)),r.set(w,!0),i(S,"".concat(c).concat(w," > "))})}i(u)}function k(u){function r(i){var t=Object(ee.a)(i);return t.map(function(c){if(!Object(M.i)(c))return Object(H.a)(!c,"Tree/TreeNode can only accept TreeNode as children."),null;var f=c.key,A=c.props,S=A.children,w=Object(U.a)(A,["children"]),R=Object(Z.a)({key:f},w),O=r(S);return O.length&&(R.children=O),R}).filter(function(c){return c})}return r(u)}function D(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=new Set(r===!0?[]:r),t=[];function c(f){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return f.map(function(S,w){var R=Object(M.h)(A?A.pos:"0",w),O=Y(S.key,R),E=Object(Z.a)(Object(Z.a)({},S),{},{parent:A,pos:R,children:null,data:S,isStart:[].concat(Object(ie.a)(A?A.isStart:[]),[w===0]),isEnd:[].concat(Object(ie.a)(A?A.isEnd:[]),[w===f.length-1])});return t.push(E),r===!0||i.has(O)?E.children=c(S.children||[],E):E.children=[],E})}return c(u),t}function v(u,r,i){var t;i?typeof i=="string"?t=function(A){return A[i]}:typeof i=="function"&&(t=function(A){return i(A)}):t=function(A,S){return Y(A.key,S)};function c(f,A,S){var w=f?f.children:u,R=f?Object(M.h)(S.pos,A):"0";if(f){var O=t(f,R),E={node:f,index:A,pos:R,key:O,parentPos:S.node?S.pos:null,level:S.level+1};r(E)}w&&w.forEach(function(y,d){c(y,d,{node:f,pos:R,level:S?S.level+1:-1})})}c(null)}function _(u){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=r.initWrapper,t=r.processEntity,c=r.onProcessFinished,f=arguments.length>2?arguments[2]:void 0,A={},S={},w={posEntities:A,keyEntities:S};return i&&(w=i(w)||w),v(u,function(R){var O=R.node,E=R.index,y=R.pos,d=R.key,l=R.parentPos,h=R.level,g={node:O,index:E,key:d,pos:y,level:h},b=Y(d,y);A[y]=g,S[b]=g,g.parent=A[l],g.parent&&(g.parent.children=g.parent.children||[],g.parent.children.push(g)),t&&t(g,w)},f),c&&c(w),w}function p(u,r){var i=r.expandedKeys,t=r.selectedKeys,c=r.loadedKeys,f=r.loadingKeys,A=r.checkedKeys,S=r.halfCheckedKeys,w=r.dragOverNodeKey,R=r.dropPosition,O=r.keyEntities,E=O[u],y={eventKey:u,expanded:i.indexOf(u)!==-1,selected:t.indexOf(u)!==-1,loaded:c.indexOf(u)!==-1,loading:f.indexOf(u)!==-1,checked:A.indexOf(u)!==-1,halfChecked:S.indexOf(u)!==-1,pos:String(E?E.pos:""),dragOver:w===u&&R===0,dragOverGapTop:w===u&&R===-1,dragOverGapBottom:w===u&&R===1};return y}function o(u){var r=u.data,i=u.expanded,t=u.selected,c=u.checked,f=u.loaded,A=u.loading,S=u.halfChecked,w=u.dragOver,R=u.dragOverGapTop,O=u.dragOverGapBottom,E=u.pos,y=u.active,d=Object(Z.a)(Object(Z.a)({},r),{},{expanded:i,selected:t,checked:c,loaded:f,loading:A,halfChecked:S,dragOver:w,dragOverGapTop:R,dragOverGapBottom:O,pos:E,active:y});return"props"in d||Object.defineProperty(d,"props",{get:function(){return Object(H.a)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),u}}),d}},"8EBN":function(zt,st,V){(function(ie){ie(V("VrN/"))})(function(ie){"use strict";ie.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var Z=0;Z<ie.modeInfo.length;Z++){var U=ie.modeInfo[Z];U.mimes&&(U.mime=U.mimes[0])}ie.findModeByMIME=function(ee){ee=ee.toLowerCase();for(var H=0;H<ie.modeInfo.length;H++){var M=ie.modeInfo[H];if(M.mime==ee)return M;if(M.mimes){for(var Y=0;Y<M.mimes.length;Y++)if(M.mimes[Y]==ee)return M}}if(/\+xml$/.test(ee))return ie.findModeByMIME("application/xml");if(/\+json$/.test(ee))return ie.findModeByMIME("application/json")},ie.findModeByExtension=function(ee){ee=ee.toLowerCase();for(var H=0;H<ie.modeInfo.length;H++){var M=ie.modeInfo[H];if(M.ext){for(var Y=0;Y<M.ext.length;Y++)if(M.ext[Y]==ee)return M}}},ie.findModeByFileName=function(ee){for(var H=0;H<ie.modeInfo.length;H++){var M=ie.modeInfo[H];if(M.file&&M.file.test(ee))return M}var Y=ee.lastIndexOf("."),X=Y>-1&&ee.substring(Y+1,ee.length);if(X)return ie.findModeByExtension(X)},ie.findModeByName=function(ee){ee=ee.toLowerCase();for(var H=0;H<ie.modeInfo.length;H++){var M=ie.modeInfo[H];if(M.name.toLowerCase()==ee)return M;if(M.alias){for(var Y=0;Y<M.alias.length;Y++)if(M.alias[Y].toLowerCase()==ee)return M}}}})},"8hTe":function(zt,st,V){zt.exports={button:"button___1wy9m"}},"9Bee":function(zt,st,V){"use strict";var ie=V("DYRE"),Z=V("zeV3"),U=V("+L6B"),ee=V("2/Rp"),H=V("k1fw"),M=V("9og8"),Y=V("tJVT"),X=V("WmNS"),k=V.n(X),D=V("q1tI"),v=V.n(D),_=V("vg9a"),p=V("DlQD"),o=V.n(p),u=V("rUJ1");function r(Q,C){var L=Q.match(/^(\s+)(?:```)/);if(L===null)return C;var z=L[1];return C.split(`
|
|
`).map(function(oe){var q=oe.match(/^\s+/);if(q===null)return oe;var ke=Object(Y.a)(q,1),ft=ke[0];return ft.length>=z.length?oe.slice(z.length):oe}).join(`
|
|
`)}var i=[],t=["<ul>"],c=new o.a.Renderer,f=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function A(){i.length=0,t=["<ul>"]}var S={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function w(Q,C,L,z){if(C>=Q.length||Q[C].level<=L)return C;var oe=Q[C];z.push("<li><a href='#"+oe.anchor+"'>"+oe.text+"</a>"),C++;var q=[];return C=w(Q,C,oe.level,q),q.length>0&&(z.push("<ul>"),q.forEach(function(ke){z.push(ke)}),z.push("</ul>")),z.push("</li>"),C=w(Q,C,L,z),C}function R(){return w(i,0,0,t),t.push("</ul>"),t.join("")}var O={heading:function(C){var L=f.exec(C);if(L)return{type:"heading",raw:L[0],depth:L[1].length,text:L[2]}},fences:function(C){var L=this.rules.block.fences.exec(C);if(L){var z=L[0],oe=r(z,L[3]||""),q=L[2]?L[2].trim():L[2];if(["latex","katex","math"].indexOf(q)>=0){var ke=d(),ft=oe;oe=ke,l[ke]={type:"block",expression:ft}}return{type:"code",raw:z,lang:q,text:oe}}}},E=/(?:\${2})([^\n`]+?)(?:\${2})/gi,y=0,d=function(){return"__special_katext_id_".concat(y++,"__")},l={};function h(){return l}function g(){y=0,l={}}function b(Q){return Q=Q.replace(E,function(C,L){var z=d();return l[z]={type:"inline",expression:L},z}),Q}var F=c.listitem;c.listitem=function(Q){return F(b(Q))};var N=c.paragraph;c.paragraph=function(Q){return N(b(Q))};var W=c.tablecell;c.tablecell=function(Q,C){return W(b(Q),C)},c.code=function(Q,C,L){var z=(C||"").match(/\S*/)[0];return z?["latex","katex","math"].indexOf(z)>=0?"<p class='editormd-tex'>".concat(Q,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(C,'">').concat(L?Q:Object(u.escape)(Q,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(L?Q:Object(u.escape)(Q,!0))+"</code></pre>"},c.heading=function(Q,C,L){var z=this.options.headerPrefix+L.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return i.push({anchor:z,level:C,text:Q}),"<h"+C+' id="'+z+'">'+Q+"</h"+C+">"},o.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),o.a.use({tokenizer:O,renderer:c});var K=o.a,I=V("SJMd"),x=V("ulZh"),j=V.n(x),$=V("m3rI"),ae=V("Oy/b"),fe=V("p5ED"),pe=V("ErOA");/*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var Ce=function(Q,C){return(Ce=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(L,z){L.__proto__=z}||function(L,z){for(var oe in z)Object.prototype.hasOwnProperty.call(z,oe)&&(L[oe]=z[oe])})(Q,C)};function De(Q,C){function L(){this.constructor=Q}Ce(Q,C),Q.prototype=C===null?Object.create(C):(L.prototype=C.prototype,new L)}function xe(Q,C,L,z){return new(L||(L=Promise))(function(oe,q){function ke(an){try{kt(z.next(an))}catch(dt){q(dt)}}function ft(an){try{kt(z.throw(an))}catch(dt){q(dt)}}function kt(an){var dt;an.done?oe(an.value):(dt=an.value,dt instanceof L?dt:new L(function(Pt){Pt(dt)})).then(ke,ft)}kt((z=z.apply(Q,C||[])).next())})}function Oe(Q,C){var L,z,oe,q,ke={label:0,sent:function(){if(1&oe[0])throw oe[1];return oe[1]},trys:[],ops:[]};return q={next:ft(0),throw:ft(1),return:ft(2)},typeof Symbol=="function"&&(q[Symbol.iterator]=function(){return this}),q;function ft(kt){return function(an){return function(dt){if(L)throw new TypeError("Generator is already executing.");for(;ke;)try{if(L=1,z&&(oe=2&dt[0]?z.return:dt[0]?z.throw||((oe=z.return)&&oe.call(z),0):z.next)&&!(oe=oe.call(z,dt[1])).done)return oe;switch(z=0,oe&&(dt=[2&dt[0],oe.value]),dt[0]){case 0:case 1:oe=dt;break;case 4:return ke.label++,{value:dt[1],done:!1};case 5:ke.label++,z=dt[1],dt=[0];continue;case 7:dt=ke.ops.pop(),ke.trys.pop();continue;default:if(!(oe=ke.trys,(oe=oe.length>0&&oe[oe.length-1])||dt[0]!==6&&dt[0]!==2)){ke=0;continue}if(dt[0]===3&&(!oe||dt[1]>oe[0]&&dt[1]<oe[3])){ke.label=dt[1];break}if(dt[0]===6&&ke.label<oe[1]){ke.label=oe[1],oe=dt;break}if(oe&&ke.label<oe[2]){ke.label=oe[2],ke.ops.push(dt);break}oe[2]&&ke.ops.pop(),ke.trys.pop();continue}dt=C.call(Q,ke)}catch(Pt){dt=[6,Pt],z=0}finally{L=oe=0}if(5&dt[0])throw dt[1];return{value:dt[0]?dt[1]:void 0,done:!0}}([kt,an])}}}function Ee(){for(var Q=0,C=0,L=arguments.length;C<L;C++)Q+=arguments[C].length;var z=Array(Q),oe=0;for(C=0;C<L;C++)for(var q=arguments[C],ke=0,ft=q.length;ke<ft;ke++,oe++)z[oe]=q[ke];return z}var be=function(){function Q(){}return Q.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},Q.setAttributes=function(C,L){for(var z=0,oe=L;z<oe.length;z++){var q=oe[z],ke=q[0],ft=q[1];C.setAttribute(ke,ft)}},Q.createRect=function(C,L,z){var oe=document.createElementNS("http://www.w3.org/2000/svg","rect");return oe.setAttribute("width",C.toString()),oe.setAttribute("height",L.toString()),z&&Q.setAttributes(oe,z),oe},Q.createLine=function(C,L,z,oe,q){var ke=document.createElementNS("http://www.w3.org/2000/svg","line");return ke.setAttribute("x1",C.toString()),ke.setAttribute("y1",L.toString()),ke.setAttribute("x2",z.toString()),ke.setAttribute("y2",oe.toString()),q&&Q.setAttributes(ke,q),ke},Q.createPolygon=function(C,L){var z=document.createElementNS("http://www.w3.org/2000/svg","polygon");return z.setAttribute("points",C),L&&Q.setAttributes(z,L),z},Q.createCircle=function(C,L){var z=document.createElementNS("http://www.w3.org/2000/svg","circle");return z.setAttribute("cx",(C/2).toString()),z.setAttribute("cy",(C/2).toString()),z.setAttribute("r",C.toString()),L&&Q.setAttributes(z,L),z},Q.createEllipse=function(C,L,z){var oe=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return oe.setAttribute("cx",(C/2).toString()),oe.setAttribute("cy",(L/2).toString()),oe.setAttribute("rx",(C/2).toString()),oe.setAttribute("ry",(L/2).toString()),z&&Q.setAttributes(oe,z),oe},Q.createGroup=function(C){var L=document.createElementNS("http://www.w3.org/2000/svg","g");return C&&Q.setAttributes(L,C),L},Q.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},Q.createMarker=function(C,L,z,oe,q,ke,ft){var kt=document.createElementNS("http://www.w3.org/2000/svg","marker");return Q.setAttributes(kt,[["id",C],["orient",L],["markerWidth",z.toString()],["markerHeight",oe.toString()],["refX",q.toString()],["refY",ke.toString()]]),kt.appendChild(ft),kt},Q.createText=function(C){var L=document.createElementNS("http://www.w3.org/2000/svg","text");return L.setAttribute("x","0"),L.setAttribute("y","0"),C&&Q.setAttributes(L,C),L},Q.createTSpan=function(C,L){var z=document.createElementNS("http://www.w3.org/2000/svg","tspan");return z.textContent=C,L&&Q.setAttributes(z,L),z},Q.createImage=function(C){var L=document.createElementNS("http://www.w3.org/2000/svg","image");return C&&Q.setAttributes(L,C),L},Q.createPoint=function(C,L){var z=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return z.x=C,z.y=L,z},Q.createPath=function(C,L){var z=document.createElementNS("http://www.w3.org/2000/svg","path");return z.setAttribute("d",C),L&&Q.setAttributes(z,L),z},Q}(),te=function(){function Q(){}return Q.addKey=function(C){Q.key=C},Object.defineProperty(Q,"isLicensed",{get:function(){return!!Q.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(Q.key)},enumerable:!1,configurable:!0}),Q}(),me=function(){function Q(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return Q.prototype.rasterize=function(C,L,z){var oe=this;return new Promise(function(q){var ke=z!==void 0?z:document.createElement("canvas");C===null&&(oe.markersOnly=!0,oe.naturalSize=!1);var ft=document.createElementNS("http://www.w3.org/2000/svg","svg");ft.setAttribute("xmlns","http://www.w3.org/2000/svg"),ft.setAttribute("width",L.width.baseVal.valueAsString),ft.setAttribute("height",L.height.baseVal.valueAsString),ft.setAttribute("viewBox","0 0 "+L.viewBox.baseVal.width.toString()+" "+L.viewBox.baseVal.height.toString()),ft.innerHTML=L.innerHTML,oe.naturalSize===!0?(ft.width.baseVal.value=C.naturalWidth,ft.height.baseVal.value=C.naturalHeight):oe.width!==void 0&&oe.height!==void 0&&(ft.width.baseVal.value=oe.width,ft.height.baseVal.value=oe.height),ke.width=ft.width.baseVal.value,ke.height=ft.height.baseVal.value;var kt=ft.outerHTML,an=ke.getContext("2d");oe.markersOnly!==!0&&an.drawImage(C,0,0,ke.width,ke.height);var dt=window.URL,Pt=new Image(ke.width,ke.height);Pt.setAttribute("crossOrigin","anonymous");var tn=new Blob([kt],{type:"image/svg+xml"}),Vn=dt.createObjectURL(tn);Pt.onload=function(){an.drawImage(Pt,0,0),dt.revokeObjectURL(Vn);var fi=ke.toDataURL(oe.imageType,oe.imageQuality);q(fi)},Pt.src=Vn})},Q}(),ye=function(){},Le=function(){function Q(C){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+C+"_"}return Object.defineProperty(Q.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#ffffff",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarColor:"#eeeeee",toolbarHeight:40,toolboxColor:"#eeeeee",toolboxAccentColor:"#3080c3",undoButtonVisible:!0,redoButtonVisible:!1,zoomButtonVisible:!1,zoomOutButtonVisible:!1,clearButtonVisible:!1,resultButtonBlockVisible:!0,logoPosition:"left"}},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),Q.prototype.addClass=function(C){return this.styleSheet===void 0&&this.addStyleSheet(),C.name=""+this.classNamePrefix+C.localName,this.classes.push(C),this.styleSheet.sheet.insertRule("."+C.name+" {"+C.style+"}",this.styleSheet.sheet.cssRules.length),C},Q.prototype.addRule=function(C){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(C),this.styleSheet.sheet.insertRule(C.selector+" {"+C.style+"}",this.styleSheet.sheet.cssRules.length)},Q.prototype.addStyleSheet=function(){var C;this.styleSheet=document.createElement("style"),((C=this.styleSheetRoot)!==null&&C!==void 0?C:document.head).appendChild(this.styleSheet),this.addRule(new $e("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new $e("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new $e("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new Me("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new Me("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},Q.prototype.removeStyleSheet=function(){var C;this.styleSheet&&(((C=this.styleSheetRoot)!==null&&C!==void 0?C:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},Q}(),$e=function(Q,C){this.selector=Q,this.style=C},Me=function(Q,C){this.localName=Q,this.style=C},ze=function(){function Q(C,L,z,oe,q){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=C,this.displayMode=L,this.markerItems=z,this.uiStyleSettings=oe,this.styles=q,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return Q.prototype.show=function(C){var L=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=C,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var z=document.createElement("div");z.className=this.toolbarBlockStyleClass.name,z.style.whiteSpace="nowrap",this.uiContainer.appendChild(z),this.addActionButton(z,'<svg viewBox="0 0 24 24"><path d="M10.07 14.27a.997.997 0 011.33.48l2.3 4.99 1.8-.85-2.31-4.98c-.24-.5-.02-1.1.48-1.33l.28-.08 2.3-.45L8 5.12V15.9l1.82-1.47.25-.16m3.57 7.7a.99.99 0 01-1.33-.47l-2.18-4.74-2.51 2.02c-.17.14-.38.22-.62.22a1 1 0 01-1-1V3a1 1 0 011-1c.24 0 .47.09.64.23l.01-.01 11.49 9.64a1.001 1.001 0 01-.44 1.75l-3.16.62 2.2 4.73c.26.5.02 1.09-.48 1.32l-3.62 1.69z"/></svg>',"select"),this.addActionButton(z,'<svg viewBox="0 0 24 24"><path d="M9 3v1H4v2h1v13a2 2 0 002 2h10a2 2 0 002-2V6h1V4h-5V3H9M7 6h10v13H7V6m2 2v9h2V8H9m4 0v9h2V8h-2z"/></svg>',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(z,'<svg viewBox="0 0 24 24"><path d="M19.36 2.72l1.42 1.42-5.72 5.71c1.07 1.54 1.22 3.39.32 4.59L9.06 8.12c1.2-.9 3.05-.75 4.59.32l5.71-5.72M5.93 17.57c-2.01-2.01-3.24-4.41-3.58-6.65l4.88-2.09 7.44 7.44-2.09 4.88c-2.24-.34-4.64-1.57-6.65-3.58z"/></svg>',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(z,'<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(z,'<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 017.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(z,'<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(z,'<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 009.5 3 6.5 6.5 0 003 9.5 6.5 6.5 0 009.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5 1.5-1.5-5-5m-6 0C7 14 5 12 5 9.5S7 5 9.5 5 14 7 14 9.5 12 14 9.5 14M7 9h5v1H7V9z"/></svg>',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(z,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(q){var ke=document.createElement("div");ke.className=""+L.toolbarButtonStyleClass.name,ke.setAttribute("data-type-name",q.typeName),ke.innerHTML=q.icon,ke.addEventListener("click",function(){L.markerToolbarButtonClicked(ke,q)}),L.buttons.push(ke),L.markerButtons.push(ke)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var oe=document.createElement("div");oe.className=this.toolbarBlockStyleClass.name,oe.style.whiteSpace="nowrap",oe.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(oe),this.addActionButton(oe,'<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"render"),this.addActionButton(oe,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},Q.prototype.addButtonClickListener=function(C){this.buttonClickListeners.push(C)},Q.prototype.removeButtonClickListener=function(C){this.buttonClickListeners.indexOf(C)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(C),1)},Q.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},Q.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var C=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var L=0;L<this.markerButtons.length;L++)L<C||L===C&&this.markerButtons.length-1===C?this.markerButtonBlock.appendChild(this.markerButtons[L]):(L===C&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[L]))}},Q.prototype.overflowButtonClicked=function(){this.markerButtonOverflowBlock.style.display!=="none"?(this.markerButtonOverflowBlock.className=this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName,""),this.markerButtonOverflowBlock.style.display="none"):(this.markerButtonOverflowBlock.className+=" "+this.styles.fadeInAnimationClassName,this.markerButtonOverflowBlock.style.top=this.uiContainer.offsetTop+this.overflowButton.offsetHeight+"px",this.markerButtonOverflowBlock.style.right=this.uiContainer.offsetWidth-this.overflowButton.offsetLeft-this.overflowButton.offsetWidth+2*this.uiContainer.offsetLeft+"px",this.markerButtonOverflowBlock.style.display="inline-block")},Q.prototype.resetButtonStyles=function(){var C=this;this.buttons.forEach(function(L){L.className=L.className.replace(C.uiStyleSettings.toolbarButtonStyleColorsClassName?C.uiStyleSettings.toolbarButtonStyleColorsClassName:C.toolbarButtonStyleColorsClass.name,"").trim(),L.className=L.className.replace(C.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?C.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:C.toolbarActiveButtonStyleColorsClass.name,"").trim(),L.className+=" "+(C.uiStyleSettings.toolbarButtonStyleColorsClassName?C.uiStyleSettings.toolbarButtonStyleColorsClassName:C.toolbarButtonStyleColorsClass.name)})},Q.prototype.addActionButton=function(C,L,z){var oe=this,q=document.createElement("div");switch(q.className=""+this.toolbarButtonStyleClass.name,q.innerHTML=L,q.setAttribute("data-action",z),q.addEventListener("click",function(){oe.actionToolbarButtonClicked(q,z)}),z){case"select":q.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":q.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":q.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":q.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":q.style.fill=this.uiStyleSettings.closeButtonColor}C.appendChild(q),this.buttons.push(q)},Q.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Me("toolbar",`
|
|
width: 100%;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
height: `+this.uiStyleSettings.toolbarHeight+`px;
|
|
box-sizing: content-box;
|
|
`+(this.displayMode==="inline"?"border-top-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
`+(this.displayMode==="inline"?"border-top-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
overflow: hidden;
|
|
`)),this.toolbarStyleColorsClass=this.styles.addClass(new Me("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Me("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new Me("toolbar-overflow-block",`
|
|
position: absolute;
|
|
top: `+this.uiStyleSettings.toolbarHeight+`px;
|
|
max-width: `+2*this.uiStyleSettings.toolbarHeight+`px;
|
|
z-index: 10;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleColorsClass=this.styles.addClass(new Me("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var C=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Me("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*C)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*C)+`px;
|
|
padding: `+C+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Me("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Me("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new $e("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new $e("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},Q.prototype.markerToolbarButtonClicked=function(C,L){this.setActiveButton(C),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(z){return z("marker",L)}),this.markerButtonOverflowBlock.style.display="none"},Q.prototype.actionToolbarButtonClicked=function(C,L){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(z){return z("action",L)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},Q.prototype.setActiveButton=function(C){this.resetButtonStyles(),C.className=C.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),C.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},Q.prototype.setActiveMarkerButton=function(C){var L=this.markerButtons.find(function(z){return z.getAttribute("data-type-name")===C});L&&this.setActiveButton(L)},Q.prototype.setCurrentMarker=function(C){var L=this;this.currentMarker=C,this.buttons.filter(function(z){return/delete|notes/.test(z.getAttribute("data-action"))}).forEach(function(z){L.currentMarker===void 0?(z.style.fillOpacity="0.4",z.style.pointerEvents="none"):(z.style.fillOpacity="1",z.style.pointerEvents="all")})},Q}(),ot=function(){function Q(C,L,z,oe){this.panels=[],this.panelButtons=[],this.markerjsContainer=C,this.displayMode=L,this.uiStyleSettings=z,this.styles=oe,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return Q.prototype.addStyles=function(){var C;this.toolboxStyleClass=this.styles.addClass(new Me("toolbox",`
|
|
width: 100%;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
font-family: sans-serif;
|
|
`+(this.displayMode==="popup"?"height:"+2.5*this.uiStyleSettings.toolbarHeight+"px;":"")+`
|
|
box-sizing: content-box;
|
|
`+(this.displayMode==="popup"?"background-color: "+this.uiStyleSettings.canvasBackgroundColor+";":"")+`
|
|
`+(this.displayMode==="inline"?"border-bottom-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
`+(this.displayMode==="inline"?"border-bottom-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
overflow: hidden;
|
|
`)),this.toolboxStyleColorsClass=this.styles.addClass(new Me("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var L=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new Me("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new Me("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new Me("toolbox-panel-row",`
|
|
display: flex;
|
|
`+(this.displayMode==="inline"?"position: absolute;":"")+`
|
|
`+(this.displayMode==="inline"?"bottom: "+this.uiStyleSettings.toolbarHeight+"px;":"")+`
|
|
cursor: default;
|
|
height: `+1.5*this.uiStyleSettings.toolbarHeight+`px;
|
|
`+(this.displayMode==="inline"?"width: 100%;":"")+`
|
|
box-sizing: content-box;
|
|
`)),this.toolboxPanelRowStyleColorsClass=this.styles.addClass(new Me("toolbox-panel-row_colors",`
|
|
background-color: `+((C=this.uiStyleSettings.toolboxBackgroundColor)!==null&&C!==void 0?C:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new Me("toolbox_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*L)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*L)+`px;
|
|
padding: `+L+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new Me("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new Me("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new $e("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new $e("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},Q.prototype.show=function(C){var L;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=C,this.uiContainer.className=this.toolboxStyleClass.name+" "+((L=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&L!==void 0?L:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},Q.prototype.setPanelButtons=function(C){var L,z,oe=this;this.panels=C,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((L=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&L!==void 0?L:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((z=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&z!==void 0?z:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(q){var ke;q.uiStyleSettings=oe.uiStyleSettings;var ft=document.createElement("div");ft.className=oe.toolboxButtonStyleClass.name+" "+((ke=oe.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ke!==void 0?ke:oe.toolboxButtonStyleColorsClass.name),ft.innerHTML=q.icon,ft.title=q.title,ft.addEventListener("click",function(){oe.panelButtonClick(q)}),oe.panelButtons.push(ft),oe.buttonRow.appendChild(ft)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},Q.prototype.panelButtonClick=function(C){var L=this,z=-1;if(C!==this.activePanel){z=this.panels.indexOf(C),this.panelRow.innerHTML="";var oe=C.getUi();oe.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(oe),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=C}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){L.displayMode==="inline"?L.panelRow.style.display="none":L.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(q,ke){var ft,kt;q.className=L.toolboxButtonStyleClass.name+" "+(ke===z?""+((ft=L.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&ft!==void 0?ft:L.toolboxActiveButtonStyleColorsClass.name):""+((kt=L.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&kt!==void 0?kt:L.toolboxButtonStyleColorsClass.name))})},Q}(),Et=function(Q,C){this.title=Q,this.icon=C},_t=function(Q){function C(L,z,oe,q){var ke=Q.call(this,L,q||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return ke.colors=[],ke.addTransparent=!1,ke.colorBoxes=[],ke.colors=z,ke.currentColor=oe,ke.setCurrentColor=ke.setCurrentColor.bind(ke),ke.getColorBox=ke.getColorBox.bind(ke),ke}return De(C,Q),C.prototype.getUi=function(){var L=this,z=document.createElement("div");return z.style.overflow="hidden",z.style.whiteSpace="nowrap",this.colors.forEach(function(oe){var q=L.getColorBox(oe);z.appendChild(q),L.colorBoxes.push(q)}),z},C.prototype.getColorBox=function(L){var z=this,oe=this.uiStyleSettings.toolbarHeight/4,q=this.uiStyleSettings.toolbarHeight-oe,ke=document.createElement("div");ke.style.display="inline-block",ke.style.boxSizing="content-box",ke.style.width=q-2+"px",ke.style.height=q-2+"px",ke.style.padding="1px",ke.style.marginRight="2px",ke.style.marginBottom="2px",ke.style.borderWidth="2px",ke.style.borderStyle="solid",ke.style.borderRadius=(q+2)/2+"px",ke.style.borderColor=L===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ke.addEventListener("click",function(){z.setCurrentColor(L,ke)});var ft=document.createElement("div");return ft.style.display="inline-block",ft.style.width=q-2+"px",ft.style.height=q-2+"px",ft.style.backgroundColor=L,ft.style.borderRadius=q/2+"px",L==="transparent"&&(ft.style.fill=this.uiStyleSettings.toolboxAccentColor,ft.innerHTML=`<svg viewBox="0 0 24 24">
|
|
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
|
|
</svg>`),ke.appendChild(ft),ke},C.prototype.setCurrentColor=function(L,z){var oe=this;this.currentColor=L,this.colorBoxes.forEach(function(q){q.style.borderColor=q===z?oe.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(L)},C}(Et),mt=function(){function Q(C,L,z){this._state="new",this._isSelected=!1,this._container=C,this._overlayContainer=L,this.globalSettings=z,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(Q.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),Q.prototype.ownsTarget=function(C){return!1},Object.defineProperty(Q.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),Q.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},Q.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},Q.prototype.pointerDown=function(C,L){},Q.prototype.dblClick=function(C,L){},Q.prototype.manipulate=function(C){},Q.prototype.pointerUp=function(C){this.stateChanged()},Q.prototype.dispose=function(){},Q.prototype.addMarkerVisualToContainer=function(C){this.container.childNodes.length>0?this.container.insertBefore(C,this.container.childNodes[0]):this.container.appendChild(C)},Q.prototype.getState=function(){return{typeName:Q.typeName,state:this.state,notes:this.notes}},Q.prototype.restoreState=function(C){this._state=C.state,this.notes=C.notes},Q.prototype.scale=function(C,L){},Q.prototype.colorChanged=function(C){this.onColorChanged&&this.onColorChanged(C),this.stateChanged()},Q.prototype.fillColorChanged=function(C){this.onFillColorChanged&&this.onFillColorChanged(C),this.stateChanged()},Q.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var C=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),C.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(C)&&this.onStateChanged(this)}},Q.typeName="MarkerBase",Q}(),ut=function(){function Q(){this.findGripByVisual=this.findGripByVisual.bind(this)}return Q.prototype.findGripByVisual=function(C){return this.topLeft.ownsTarget(C)?this.topLeft:this.topCenter.ownsTarget(C)?this.topCenter:this.topRight.ownsTarget(C)?this.topRight:this.centerLeft.ownsTarget(C)?this.centerLeft:this.centerRight.ownsTarget(C)?this.centerRight:this.bottomLeft.ownsTarget(C)?this.bottomLeft:this.bottomCenter.ownsTarget(C)?this.bottomCenter:this.bottomRight.ownsTarget(C)?this.bottomRight:void 0},Q}(),Xt=function(){function Q(){this.GRIP_SIZE=10,this.visual=be.createGroup(),this.visual.appendChild(be.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(be.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return Q.prototype.ownsTarget=function(C){return C===this.visual||C===this.visual.childNodes[0]||C===this.visual.childNodes[1]},Q}(),en=function(){function Q(){}return Q.toITransformMatrix=function(C){return{a:C.a,b:C.b,c:C.c,d:C.d,e:C.e,f:C.f}},Q.toSVGMatrix=function(C,L){return C.a=L.a,C.b=L.b,C.c=L.c,C.d=L.d,C.e=L.e,C.f=L.f,C},Q}(),sn=function(Q){function C(L,z,oe){var q=Q.call(this,L,z,oe)||this;return q.left=0,q.top=0,q.width=0,q.height=0,q.defaultSize={x:50,y:20},q.offsetX=0,q.offsetY=0,q.rotationAngle=0,q.CB_DISTANCE=10,q._suppressMarkerCreateEvent=!1,q.container.transform.baseVal.appendItem(be.createTransform()),q.setupControlBox(),q}return De(C,Q),Object.defineProperty(C.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(C.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(C.prototype,"visual",{get:function(){return this._visual},set:function(L){this._visual=L;var z=be.createTransform();this._visual.transform.baseVal.appendItem(z)},enumerable:!1,configurable:!0}),C.prototype.ownsTarget=function(L){return!!Q.prototype.ownsTarget.call(this,L)||!!(this.controlGrips.findGripByVisual(L)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(L))},C.prototype.pointerDown=function(L,z){Q.prototype.pointerDown.call(this,L,z),this.state==="new"&&(this.left=L.x,this.top=L.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var oe=this.unrotatePoint(L);if(this.manipulationStartX=oe.x,this.manipulationStartY=oe.y,this.offsetX=oe.x-this.left,this.offsetY=oe.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(z),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(z)){this.activeGrip=this.rotatorGrip;var q=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=q.x-this.width/2,this.top=q.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ke=this.container.transform.baseVal.getItem(0);ke.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ke,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},C.prototype.pointerUp=function(L){var z=this.state;Q.prototype.pointerUp.call(this,L),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(L),this._state="select",z==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},C.prototype.moveVisual=function(L){this.visual.style.transform="translate("+L.x+"px, "+L.y+"px)"},C.prototype.manipulate=function(L){var z=this.unrotatePoint(L);this.state==="creating"?this.resize(L):this.state==="move"?(this.left=this.manipulationStartLeft+(z.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(z.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(z):this.state==="rotate"&&this.rotate(L)},C.prototype.resize=function(L){var z=this.manipulationStartLeft,oe=this.manipulationStartWidth,q=this.manipulationStartTop,ke=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:z=this.manipulationStartLeft+L.x-this.manipulationStartX,oe=this.manipulationStartWidth+this.manipulationStartLeft-z;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:oe=this.manipulationStartWidth+L.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:q=this.manipulationStartTop+L.y-this.manipulationStartY,ke=this.manipulationStartHeight+this.manipulationStartTop-q;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ke=this.manipulationStartHeight+L.y-this.manipulationStartY}oe>=0?(this.left=z,this.width=oe):(this.left=z+oe,this.width=-oe),ke>=0?(this.top=q,this.height=ke):(this.top=q+ke,this.height=-ke),this.setSize()},C.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},C.prototype.rotate=function(L){if(Math.abs(L.x-this.centerX)>.1){var z=Math.sign(L.x-this.centerX);this.rotationAngle=180*Math.atan((L.y-this.centerY)/(L.x-this.centerX))/Math.PI+90*z,this.applyRotation()}},C.prototype.applyRotation=function(){var L=this.container.transform.baseVal.getItem(0);L.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(L,0)},C.prototype.rotatePoint=function(L){if(this.rotationAngle===0)return L;var z=this.container.getCTM(),oe=be.createPoint(L.x,L.y);return{x:(oe=oe.matrixTransform(z)).x,y:oe.y}},C.prototype.unrotatePoint=function(L){if(this.rotationAngle===0)return L;var z=this.container.getCTM();z=z.inverse();var oe=be.createPoint(L.x,L.y);return{x:(oe=oe.matrixTransform(z)).x,y:oe.y}},C.prototype.select=function(){Q.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},C.prototype.deselect=function(){Q.prototype.deselect.call(this),this.controlBox.style.display="none"},C.prototype.setupControlBox=function(){this.controlBox=be.createGroup();var L=be.createTransform();L.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(L),this.container.appendChild(this.controlBox),this.controlRect=be.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),this.globalSettings.disableRotation!==!0&&(this.rotatorGripLine=be.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new ut,this.addControlGrips(),this.controlBox.style.display="none"},C.prototype.adjustControlBox=function(){var L=this.controlBox.transform.baseVal.getItem(0);L.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(L,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},C.prototype.addControlGrips=function(){this.controlGrips.topLeft=this.createGrip(),this.controlGrips.topCenter=this.createGrip(),this.controlGrips.topRight=this.createGrip(),this.controlGrips.centerLeft=this.createGrip(),this.controlGrips.centerRight=this.createGrip(),this.controlGrips.bottomLeft=this.createGrip(),this.controlGrips.bottomCenter=this.createGrip(),this.controlGrips.bottomRight=this.createGrip(),this.globalSettings.disableRotation!==!0&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},C.prototype.createGrip=function(){var L=new Xt;return L.visual.transform.baseVal.appendItem(be.createTransform()),this.controlBox.appendChild(L.visual),L},C.prototype.positionGrips=function(){var L=this.controlGrips.topLeft.GRIP_SIZE,z=-L/2,oe=z,q=(this.width+this.CB_DISTANCE)/2-L/2,ke=(this.height+this.CB_DISTANCE)/2-L/2,ft=this.height+this.CB_DISTANCE-L/2,kt=this.width+this.CB_DISTANCE-L/2;this.positionGrip(this.controlGrips.topLeft.visual,z,oe),this.positionGrip(this.controlGrips.topCenter.visual,q,oe),this.positionGrip(this.controlGrips.topRight.visual,kt,oe),this.positionGrip(this.controlGrips.centerLeft.visual,z,ke),this.positionGrip(this.controlGrips.centerRight.visual,kt,ke),this.positionGrip(this.controlGrips.bottomLeft.visual,z,ft),this.positionGrip(this.controlGrips.bottomCenter.visual,q,ft),this.positionGrip(this.controlGrips.bottomRight.visual,kt,ft),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,q,oe-3*this.CB_DISTANCE)},C.prototype.positionGrip=function(L,z,oe){var q=L.transform.baseVal.getItem(0);q.setTranslate(z,oe),L.transform.baseVal.replaceItem(q,0)},C.prototype.hideControlBox=function(){this.controlBox.style.display="none"},C.prototype.showControlBox=function(){this.controlBox.style.display=""},C.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:en.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:en.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},Q.prototype.getState.call(this))},C.prototype.restoreState=function(L){Q.prototype.restoreState.call(this,L);var z=L;this.left=z.left,this.top=z.top,this.width=z.width,this.height=z.height,this.rotationAngle=z.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(en.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,z.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(en.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,z.containerTransformMatrix))},C.prototype.scale=function(L,z){Q.prototype.scale.call(this,L,z);var oe=this.rotatePoint({x:this.left,y:this.top}),q=this.unrotatePoint({x:oe.x*L,y:oe.y*z});this.left=q.x,this.top=q.y,this.width=this.width*L,this.height=this.height*z,this.adjustControlBox()},C}(mt),pn=function(Q){function C(L,z,oe){var q=Q.call(this,L,z,oe)||this;return q.fillColor="transparent",q.strokeColor="transparent",q.strokeWidth=0,q.strokeDasharray="",q.opacity=1,q.setStrokeColor=q.setStrokeColor.bind(q),q.setFillColor=q.setFillColor.bind(q),q.setStrokeWidth=q.setStrokeWidth.bind(q),q.setStrokeDasharray=q.setStrokeDasharray.bind(q),q.createVisual=q.createVisual.bind(q),q}return De(C,Q),C.prototype.ownsTarget=function(L){return!(!Q.prototype.ownsTarget.call(this,L)&&L!==this.visual)},C.prototype.createVisual=function(){this.visual=be.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},C.prototype.pointerDown=function(L,z){Q.prototype.pointerDown.call(this,L,z),this.state==="new"&&(this.createVisual(),this.moveVisual(L),this._state="creating")},C.prototype.manipulate=function(L){Q.prototype.manipulate.call(this,L)},C.prototype.resize=function(L){Q.prototype.resize.call(this,L),this.setSize()},C.prototype.setSize=function(){Q.prototype.setSize.call(this),be.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},C.prototype.pointerUp=function(L){Q.prototype.pointerUp.call(this,L),this.setSize()},C.prototype.setStrokeColor=function(L){this.strokeColor=L,this.visual&&be.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(L),this.stateChanged()},C.prototype.setFillColor=function(L){this.fillColor=L,this.visual&&be.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},C.prototype.setStrokeWidth=function(L){this.strokeWidth=L,this.visual&&be.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},C.prototype.setStrokeDasharray=function(L){this.strokeDasharray=L,this.visual&&be.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},C.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},Q.prototype.getState.call(this))},C.prototype.restoreState=function(L){var z=L;this.fillColor=z.fillColor,this.strokeColor=z.strokeColor,this.strokeWidth=z.strokeWidth,this.strokeDasharray=z.strokeDasharray,this.opacity=z.opacity,this.createVisual(),Q.prototype.restoreState.call(this,L),this.setSize()},C.prototype.scale=function(L,z){Q.prototype.scale.call(this,L,z),this.setSize()},C.title="Rectangle marker",C}(sn),Un=function(Q){function C(L,z,oe,q){var ke=Q.call(this,L,q||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return ke.widths=[],ke.widthBoxes=[],ke.widths=z,ke.currentWidth=oe,ke.setCurrentWidth=ke.setCurrentWidth.bind(ke),ke}return De(C,Q),C.prototype.getUi=function(){var L=this,z=document.createElement("div");return z.style.display="flex",z.style.overflow="hidden",z.style.flexGrow="2",this.widths.forEach(function(oe){var q=document.createElement("div");q.style.display="flex",q.style.flexGrow="2",q.style.alignItems="center",q.style.justifyContent="space-between",q.style.padding="5px",q.style.borderWidth="2px",q.style.borderStyle="solid",q.style.borderColor=oe===L.currentWidth?L.uiStyleSettings.toolboxAccentColor:"transparent",q.addEventListener("click",function(){L.setCurrentWidth(oe,q)}),z.appendChild(q);var ke=document.createElement("div");ke.innerText=oe.toString(),ke.style.marginRight="5px",q.appendChild(ke);var ft=document.createElement("div");ft.style.minHeight="20px",ft.style.flexGrow="2",ft.style.display="flex",ft.style.alignItems="center";var kt=document.createElement("hr");kt.style.minWidth="20px",kt.style.border="0px",kt.style.borderTop=oe+"px solid "+L.uiStyleSettings.toolboxColor,kt.style.flexGrow="2",ft.appendChild(kt),q.appendChild(ft),L.widthBoxes.push(q)}),z},C.prototype.setCurrentWidth=function(L,z){var oe=this;this.currentWidth=L,this.widthBoxes.forEach(function(q){q.style.borderColor=q===z?oe.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},C}(Et),Cn=function(Q){function C(L,z,oe,q){var ke=Q.call(this,L,q||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return ke.styles=[],ke.styleBoxes=[],ke.styles=z,ke.currentStyle=oe,ke.setCurrentStyle=ke.setCurrentStyle.bind(ke),ke}return De(C,Q),C.prototype.getUi=function(){var L=this,z=document.createElement("div");return z.style.display="flex",z.style.overflow="hidden",z.style.flexGrow="2",this.styles.forEach(function(oe){var q=document.createElement("div");q.style.display="flex",q.style.alignItems="center",q.style.justifyContent="space-between",q.style.padding="5px",q.style.borderWidth="2px",q.style.borderStyle="solid",q.style.overflow="hidden",q.style.maxWidth=100/L.styles.length-5+"%",q.style.borderColor=oe===L.currentStyle?L.uiStyleSettings.toolboxAccentColor:"transparent",q.addEventListener("click",function(){L.setCurrentStyle(oe,q)}),z.appendChild(q);var ke=document.createElement("div");ke.style.minHeight="20px",ke.style.flexGrow="2",ke.style.overflow="hidden";var ft=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+L.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(oe!==""?'stroke-dasharray="'+oe+'"':"")+` />
|
|
</svg>`;ke.innerHTML=ft,q.appendChild(ke),L.styleBoxes.push(q)}),z},C.prototype.setCurrentStyle=function(L,z){var oe=this;this.currentStyle=L,this.styleBoxes.forEach(function(q){q.style.borderColor=q===z?oe.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},C}(Et),Qe=function(Q){function C(L,z,oe){var q=Q.call(this,L,z,oe)||this;return q.strokeColor=oe.defaultColor,q.strokeWidth=oe.defaultStrokeWidth,q.strokeDasharray=oe.defaultStrokeDasharray,q.strokePanel=new _t("Line color",oe.defaultColorSet,oe.defaultColor),q.strokePanel.onColorChanged=q.setStrokeColor,q.strokeWidthPanel=new Un("Line width",oe.defaultStrokeWidths,oe.defaultStrokeWidth),q.strokeWidthPanel.onWidthChanged=q.setStrokeWidth,q.strokeStylePanel=new Cn("Line style",oe.defaultStrokeDasharrays,oe.defaultStrokeDasharray),q.strokeStylePanel.onStyleChanged=q.setStrokeDasharray,q}return De(C,Q),Object.defineProperty(C.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),C.prototype.getState=function(){var L=Q.prototype.getState.call(this);return L.typeName=C.typeName,L},C.typeName="FrameMarker",C.title="Frame marker",C.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',C}(pn),Ye=function(){this.defaultColorSet=["#EF4444","#10B981","#2563EB","#FFFF00","#7C3AED","#F472B6","#000000","#FFFFFF"],this.defaultColor=this.defaultColorSet[0],this.defaultFillColor=this.defaultColorSet[0],this.defaultStrokeColor=this.defaultColorSet[7],this.defaultHighlightColor=this.defaultColorSet[3],this.defaultStrokeWidth=3,this.defaultStrokeDasharray="",this.defaultHighlightOpacity=.5,this.defaultFontFamily="Helvetica, Arial, sans-serif",this.defaultStrokeWidths=[1,2,3,5,10],this.defaultStrokeDasharrays=["","3","12 3","9 6 3 6"],this.defaultOpacitySteps=[.1,.25,.5,.75,1],this.displayMode="inline",this.defaultFontFamilies=['Times, "Times New Roman", serif',"Helvetica, Arial, sans-serif",'Courier, "Courier New", monospace',"cursive","fantasy"],this.popupMargin=30,this.newFreehandMarkerOnPointerUp=!1,this.defaultColorsFollowCurrentColors=!1,this.freehandPixelRatio=1,this.disableRotation=!1},St=function(Q){function C(L,z,oe){var q=Q.call(this,L,z,oe)||this;return q.x1=0,q.y1=0,q.x2=0,q.y2=0,q.defaultLength=50,q.manipulationStartX=0,q.manipulationStartY=0,q.manipulationStartX1=0,q.manipulationStartY1=0,q.manipulationStartX2=0,q.manipulationStartY2=0,q.setupControlBox(),q}return De(C,Q),C.prototype.ownsTarget=function(L){return!!Q.prototype.ownsTarget.call(this,L)||!(!this.grip1.ownsTarget(L)&&!this.grip2.ownsTarget(L))},C.prototype.pointerDown=function(L,z){Q.prototype.pointerDown.call(this,L,z),this.manipulationStartX=L.x,this.manipulationStartY=L.y,this.state==="new"&&(this.x1=L.x,this.y1=L.y,this.x2=L.x,this.y2=L.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget(z)?this.activeGrip=this.grip1:this.grip2.ownsTarget(z)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},C.prototype.pointerUp=function(L){var z=this.state;Q.prototype.pointerUp.call(this,L),this.state==="creating"&&Math.abs(this.x1-this.x2)<10&&Math.abs(this.y1-this.y2)<10?(this.x2=this.x1+this.defaultLength,this.adjustVisual(),this.adjustControlBox()):this.manipulate(L),this._state="select",z==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},C.prototype.adjustVisual=function(){},C.prototype.manipulate=function(L){this.state==="creating"?this.resize(L):this.state==="move"?(this.x1=this.manipulationStartX1+L.x-this.manipulationStartX,this.y1=this.manipulationStartY1+L.y-this.manipulationStartY,this.x2=this.manipulationStartX2+L.x-this.manipulationStartX,this.y2=this.manipulationStartY2+L.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(L)},C.prototype.resize=function(L){switch(this.activeGrip){case this.grip1:this.x1=L.x,this.y1=L.y;break;case this.grip2:case void 0:this.x2=L.x,this.y2=L.y}this.adjustVisual(),this.adjustControlBox()},C.prototype.select=function(){Q.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},C.prototype.deselect=function(){Q.prototype.deselect.call(this),this.controlBox.style.display="none"},C.prototype.setupControlBox=function(){this.controlBox=be.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},C.prototype.adjustControlBox=function(){this.positionGrips()},C.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},C.prototype.createGrip=function(){var L=new Xt;return L.visual.transform.baseVal.appendItem(be.createTransform()),this.controlBox.appendChild(L.visual),L},C.prototype.positionGrips=function(){var L=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-L/2,this.y1-L/2),this.positionGrip(this.grip2.visual,this.x2-L/2,this.y2-L/2)},C.prototype.positionGrip=function(L,z,oe){var q=L.transform.baseVal.getItem(0);q.setTranslate(z,oe),L.transform.baseVal.replaceItem(q,0)},C.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},Q.prototype.getState.call(this))},C.prototype.restoreState=function(L){Q.prototype.restoreState.call(this,L);var z=L;this.x1=z.x1,this.y1=z.y1,this.x2=z.x2,this.y2=z.y2},C.prototype.scale=function(L,z){Q.prototype.scale.call(this,L,z),this.x1=this.x1*L,this.y1=this.y1*z,this.x2=this.x2*L,this.y2=this.y2*z,this.adjustVisual(),this.adjustControlBox()},C}(mt),bt=function(Q){function C(L,z,oe){var q=Q.call(this,L,z,oe)||this;return q.strokeColor="transparent",q.strokeWidth=0,q.strokeDasharray="",q.setStrokeColor=q.setStrokeColor.bind(q),q.setStrokeWidth=q.setStrokeWidth.bind(q),q.setStrokeDasharray=q.setStrokeDasharray.bind(q),q.strokeColor=oe.defaultColor,q.strokeWidth=oe.defaultStrokeWidth,q.strokeDasharray=oe.defaultStrokeDasharray,q.strokePanel=new _t("Line color",oe.defaultColorSet,oe.defaultColor),q.strokePanel.onColorChanged=q.setStrokeColor,q.strokeWidthPanel=new Un("Line width",oe.defaultStrokeWidths,oe.defaultStrokeWidth),q.strokeWidthPanel.onWidthChanged=q.setStrokeWidth,q.strokeStylePanel=new Cn("Line style",oe.defaultStrokeDasharrays,oe.defaultStrokeDasharray),q.strokeStylePanel.onStyleChanged=q.setStrokeDasharray,q}return De(C,Q),C.prototype.ownsTarget=function(L){return!(!Q.prototype.ownsTarget.call(this,L)&&L!==this.visual&&L!==this.selectorLine&&L!==this.visibleLine)},C.prototype.createVisual=function(){this.visual=be.createGroup(),this.selectorLine=be.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=be.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},C.prototype.pointerDown=function(L,z){Q.prototype.pointerDown.call(this,L,z),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},C.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),be.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),be.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),be.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},C.prototype.setStrokeColor=function(L){this.strokeColor=L,this.adjustVisual(),this.colorChanged(L)},C.prototype.setStrokeWidth=function(L){this.strokeWidth=L,this.adjustVisual()},C.prototype.setStrokeDasharray=function(L){this.strokeDasharray=L,this.adjustVisual(),this.stateChanged()},Object.defineProperty(C.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),C.prototype.getState=function(){var L=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},Q.prototype.getState.call(this));return L.typeName=C.typeName,L},C.prototype.restoreState=function(L){Q.prototype.restoreState.call(this,L);var z=L;this.strokeColor=z.strokeColor,this.strokeWidth=z.strokeWidth,this.strokeDasharray=z.strokeDasharray,this.createVisual(),this.adjustVisual()},C.typeName="LineMarker",C.title="Line marker",C.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',C}(St),nt=function(Q){function C(L,z,oe,q){var ke=Q.call(this,L,q||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return ke.fonts=[],ke.fontBoxes=[],ke.fonts=z,ke.currentFont=oe,ke.setCurrentFont=ke.setCurrentFont.bind(ke),ke}return De(C,Q),C.prototype.getUi=function(){var L=this,z=document.createElement("div");return z.style.overflow="hidden",z.style.flexGrow="2",this.fonts.forEach(function(oe){var q=document.createElement("div");q.style.display="inline-block",q.style.alignItems="center",q.style.justifyContent="space-between",q.style.padding="5px",q.style.borderWidth="2px",q.style.borderStyle="solid",q.style.overflow="hidden",q.style.maxWidth=100/L.fonts.length-5+"%",q.style.borderColor=oe===L.currentFont?L.uiStyleSettings.toolboxAccentColor:"transparent",q.addEventListener("click",function(){L.setCurrentFont(oe,q)}),z.appendChild(q);var ke=document.createElement("div");ke.style.display="flex",ke.style.minHeight="20px",ke.style.flexGrow="2",ke.style.fontFamily=oe,ke.style.overflow="hidden";var ft=document.createElement("div");ft.style.whiteSpace="nowrap",ft.style.overflow="hidden",ft.style.textOverflow="ellipsis",ft.innerHTML="The quick brown fox jumps over the lazy dog",ke.appendChild(ft),q.appendChild(ke),L.fontBoxes.push(q)}),z},C.prototype.setCurrentFont=function(L,z){var oe=this;this.currentFont=L,this.fontBoxes.forEach(function(q){q.style.borderColor=q===z?oe.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},C}(Et),vt=function(Q){function C(L,z,oe){var q=Q.call(this,L,z,oe)||this;return q.color="transparent",q.padding=5,q.DEFAULT_TEXT="your text here",q.text=q.DEFAULT_TEXT,q.isMoved=!1,q.color=oe.defaultColor,q.fontFamily=oe.defaultFontFamily,q.defaultSize={x:100,y:30},q.setColor=q.setColor.bind(q),q.setFont=q.setFont.bind(q),q.renderText=q.renderText.bind(q),q.sizeText=q.sizeText.bind(q),q.textEditDivClicked=q.textEditDivClicked.bind(q),q.showTextEditor=q.showTextEditor.bind(q),q.setSize=q.setSize.bind(q),q.positionTextEditor=q.positionTextEditor.bind(q),q.colorPanel=new _t("Color",oe.defaultColorSet,oe.defaultColor),q.colorPanel.onColorChanged=q.setColor,q.fontFamilyPanel=new nt("Font",oe.defaultFontFamilies,oe.defaultFontFamily),q.fontFamilyPanel.onFontChanged=q.setFont,q}return De(C,Q),C.prototype.ownsTarget=function(L){if(Q.prototype.ownsTarget.call(this,L)||L===this.visual||L===this.textElement||L===this.bgRectangle)return!0;var z=!1;return this.textElement.childNodes.forEach(function(oe){oe===L&&(z=!0)}),z},C.prototype.createVisual=function(){this.visual=be.createGroup(),this.bgRectangle=be.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=be.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(be.createTransform()),this.textElement.transform.baseVal.appendItem(be.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},C.prototype.pointerDown=function(L,z){Q.prototype.pointerDown.call(this,L,z),this.isMoved=!1,this.pointerDownPoint=L,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(L),this._state="creating")},C.prototype.renderText=function(){var L=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(z){L.textElement.appendChild(be.createTSpan(z.trim()===""?" ":z.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},C.prototype.getTextScale=function(){var L=this.textElement.getBBox(),z=1;if(L.width>0&&L.height>0){var oe=(1*this.width-this.width*this.padding*2/100)/L.width,q=(1*this.height-this.height*this.padding*2/100)/L.height;z=Math.min(oe,q)}return z},C.prototype.getTextPosition=function(L){var z=this.textElement.getBBox(),oe=0,q=0;return z.width>0&&z.height>0&&(oe=(this.width-z.width*L)/2,q=this.height/2-z.height*L/2),{x:oe,y:q}},C.prototype.sizeText=function(){var L=this.textElement.getBBox(),z=this.getTextScale(),oe=this.getTextPosition(z);oe.y-=L.y*z,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+oe.x+"px, "+oe.y+"px) scale("+z+", "+z+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(oe.x,oe.y),this.textElement.transform.baseVal.getItem(1).setScale(z,z))},C.prototype.manipulate=function(L){Q.prototype.manipulate.call(this,L),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(L.x-this.pointerDownPoint.x)>5||Math.abs(L.y-this.pointerDownPoint.y)>5)},C.prototype.resize=function(L){Q.prototype.resize.call(this,L),this.isMoved=!0,this.setSize(),this.sizeText()},C.prototype.setSize=function(){Q.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(be.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),be.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},C.prototype.pointerUp=function(L){var z=this.state;z==="creating"&&(this._suppressMarkerCreateEvent=!0),Q.prototype.pointerUp.call(this,L),this.setSize(),(z==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},C.prototype.showTextEditor=function(){var L=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",function(z){z.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var z=Number.parseFloat(L.textEditor.style.fontSize);L.textEditor.clientWidth>=Number.parseInt(L.textEditor.style.maxWidth)&&z>.9;)z-=.1,L.textEditor.style.fontSize=Math.max(z,.9)+"em"}),this.textEditor.addEventListener("keyup",function(z){z.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(z){if(z.clipboardData){var oe=z.clipboardData.getData("text"),q=window.getSelection();if(!q.rangeCount)return!1;q.deleteFromDocument(),q.getRangeAt(0).insertNode(document.createTextNode(oe)),z.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){L.textEditDivClicked(L.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},C.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var L=this.getTextScale(),z=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),oe=this.textElement.getBBox(),q={x:oe.width*L,y:oe.height*L};z.x-=q.x/2,z.y-=q.y/2,this.textEditor.style.top=z.y+"px",this.textEditor.style.left=z.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-z.x+"px",this.textEditor.style.fontSize=Math.max(16*L,12)+"px",this.textElement.style.display="none"}},C.prototype.textEditDivClicked=function(L){this.text=L.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},C.prototype.select=function(){Q.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},C.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),Q.prototype.deselect.call(this)},C.prototype.dblClick=function(L,z){Q.prototype.dblClick.call(this,L,z),this.showTextEditor()},C.prototype.setColor=function(L){this.textElement&&be.setAttributes(this.textElement,[["fill",L]]),this.color=L,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(L)},C.prototype.setFont=function(L){this.textElement&&be.setAttributes(this.textElement,[["font-family",L]]),this.fontFamily=L,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},C.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},C.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(C.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),C.prototype.getState=function(){var L=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},Q.prototype.getState.call(this));return L.typeName=C.typeName,L},C.prototype.restoreState=function(L){var z=L;this.color=z.color,this.fontFamily=z.fontFamily,this.padding=z.padding,this.text=z.text,this.createVisual(),Q.prototype.restoreState.call(this,L),this.setSize()},C.prototype.scale=function(L,z){Q.prototype.scale.call(this,L,z),this.setSize(),this.sizeText(),this.positionTextEditor()},C.typeName="TextMarker",C.title="Text marker",C.icon='<svg viewBox="0 0 24 24"><path d="M9.6 14L12 7.7l2.4 6.3M11 5L5.5 19h2.2l1.1-3H15l1.1 3h2.2L13 5h-2z"/></svg>',C}(sn),Ue=function(Q){function C(L,z,oe){var q=Q.call(this,L,z,oe)||this;return q.color="transparent",q.lineWidth=3,q.drawing=!1,q.pixelRatio=1,q.color=oe.defaultColor,q.lineWidth=oe.defaultStrokeWidth,q.pixelRatio=oe.freehandPixelRatio,q.setColor=q.setColor.bind(q),q.addCanvas=q.addCanvas.bind(q),q.finishCreation=q.finishCreation.bind(q),q.setLineWidth=q.setLineWidth.bind(q),q.colorPanel=new _t("Color",oe.defaultColorSet,oe.defaultColor),q.colorPanel.onColorChanged=q.setColor,q.lineWidthPanel=new Un("Line width",oe.defaultStrokeWidths,oe.defaultStrokeWidth),q.lineWidthPanel.onWidthChanged=q.setLineWidth,q}return De(C,Q),C.prototype.ownsTarget=function(L){return!(!Q.prototype.ownsTarget.call(this,L)&&L!==this.visual&&L!==this.drawingImage)},C.prototype.createVisual=function(){this.visual=be.createGroup(),this.drawingImage=be.createImage(),this.visual.appendChild(this.drawingImage);var L=be.createTransform();this.visual.transform.baseVal.appendItem(L),this.addMarkerVisualToContainer(this.visual)},C.prototype.pointerDown=function(L,z){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(L.x,L.y),this.drawing=!0):Q.prototype.pointerDown.call(this,L,z)},C.prototype.manipulate=function(L){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(L.x,L.y),this.canvasContext.stroke()):Q.prototype.manipulate.call(this,L)},C.prototype.resize=function(L){Q.prototype.resize.call(this,L),be.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),be.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},C.prototype.pointerUp=function(L){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):Q.prototype.pointerUp.call(this,L)},C.prototype.addCanvas=function(){this.overlayContainer.innerHTML="",this.canvasElement=document.createElement("canvas"),this.canvasElement.width=this.overlayContainer.clientWidth*this.pixelRatio,this.canvasElement.height=this.overlayContainer.clientHeight*this.pixelRatio,this.canvasContext=this.canvasElement.getContext("2d"),this.canvasContext.scale(this.pixelRatio,this.pixelRatio),this.overlayContainer.appendChild(this.canvasElement)},C.prototype.select=function(){this.state==="creating"&&this.finishCreation(),Q.prototype.select.call(this)},C.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),Q.prototype.deselect.call(this)},C.prototype.finishCreation=function(){for(var L=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),z=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],oe=z[0],q=z[1],ke=z[2],ft=z[3],kt=!1,an=0;an<this.canvasElement.height;an++)for(var dt=0;dt<this.canvasElement.width;dt++)L.data[an*this.canvasElement.width*4+4*dt+3]>0&&(kt=!0,an<q&&(q=an),dt<oe&&(oe=dt),an>ft&&(ft=an),dt>ke&&(ke=dt));if(kt){this.left=oe/this.pixelRatio,this.top=q/this.pixelRatio,this.width=(ke-oe)/this.pixelRatio,this.height=(ft-q)/this.pixelRatio;var Pt=document.createElement("canvas");Pt.width=ke-oe,Pt.height=ft-q,Pt.getContext("2d").putImageData(this.canvasContext.getImageData(oe,q,ke-oe,ft-q),0,0),this.drawingImgUrl=Pt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},C.prototype.setDrawingImage=function(){be.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),be.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},C.prototype.setColor=function(L){this.color=L,this.colorChanged(L)},C.prototype.setLineWidth=function(L){this.lineWidth=L},Object.defineProperty(C.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),C.prototype.getState=function(){var L=Object.assign({drawingImgUrl:this.drawingImgUrl},Q.prototype.getState.call(this));return L.typeName=C.typeName,L},C.prototype.restoreState=function(L){this.createVisual(),Q.prototype.restoreState.call(this,L),this.drawingImgUrl=L.drawingImgUrl,this.setDrawingImage()},C.prototype.scale=function(L,z){Q.prototype.scale.call(this,L,z),this.setDrawingImage()},C.typeName="FreehandMarker",C.title="Freehand marker",C.icon='<svg viewBox="0 0 24 24"><path d="M9.75 20.85c1.78-.7 1.39-2.63.49-3.85-.89-1.25-2.12-2.11-3.36-2.94A9.817 9.817 0 014.54 12c-.28-.33-.85-.94-.27-1.06.59-.12 1.61.46 2.13.68.91.38 1.81.82 2.65 1.34l1.01-1.7C8.5 10.23 6.5 9.32 4.64 9.05c-1.06-.16-2.18.06-2.54 1.21-.32.99.19 1.99.77 2.77 1.37 1.83 3.5 2.71 5.09 4.29.34.33.75.72.95 1.18.21.44.16.47-.31.47-1.24 0-2.79-.97-3.8-1.61l-1.01 1.7c1.53.94 4.09 2.41 5.96 1.79m11.09-15.6c.22-.22.22-.58 0-.79l-1.3-1.3a.562.562 0 00-.78 0l-1.02 1.02 2.08 2.08M11 10.92V13h2.08l6.15-6.15-2.08-2.08L11 10.92z"/></svg>',C}(sn),Ae=function(Q){function C(L,z,oe){var q=Q.call(this,L,oe||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return q.typeBoxes=[],q.currentType=z,q.setCurrentType=q.setCurrentType.bind(q),q}return De(C,Q),C.prototype.getUi=function(){var L=this,z=document.createElement("div");z.style.display="flex",z.style.overflow="hidden",z.style.flexGrow="2";for(var oe=function(ft){var kt="both";switch(ft){case 0:kt="both";break;case 1:kt="start";break;case 2:kt="end";break;case 3:kt="none"}var an=document.createElement("div");if(an.style.display="flex",an.style.flexGrow="2",an.style.alignItems="center",an.style.justifyContent="space-between",an.style.padding="5px",an.style.borderWidth="2px",an.style.borderStyle="solid",an.style.borderColor=kt===q.currentType?q.uiStyleSettings.toolboxAccentColor:"transparent",an.addEventListener("click",function(){L.setCurrentType(kt,an)}),z.appendChild(an),kt==="both"||kt==="start"){var dt=document.createElement("div");dt.style.display="flex",dt.style.alignItems="center",dt.style.minHeight="20px",dt.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
<polygon points="0,5 10,0 10,10" fill="`+(q.uiStyleSettings!==void 0?q.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,dt.style.marginLeft="5px",an.appendChild(dt)}var Pt=document.createElement("div");Pt.style.display="flex",Pt.style.alignItems="center",Pt.style.minHeight="20px",Pt.style.flexGrow="2";var tn=document.createElement("hr");if(tn.style.minWidth="20px",tn.style.border="0px",tn.style.borderTop="3px solid "+(q.uiStyleSettings!==void 0?q.uiStyleSettings.toolboxColor:"#eeeeee"),tn.style.flexGrow="2",Pt.appendChild(tn),an.appendChild(Pt),kt==="both"||kt==="end"){var Vn=document.createElement("div");Vn.style.display="flex",Vn.style.alignItems="center",Vn.style.minHeight="20px",Vn.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
<polygon points="0,0 10,5 0,10" fill="`+(q.uiStyleSettings!==void 0?q.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Vn.style.marginRight="5px",an.appendChild(Vn)}q.typeBoxes.push(an)},q=this,ke=0;ke<4;ke++)oe(ke);return z},C.prototype.setCurrentType=function(L,z){var oe=this;this.currentType=L,this.typeBoxes.forEach(function(q){q.style.borderColor=q===z?oe.uiStyleSettings!==void 0?oe.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},C}(Et),Re=function(Q){function C(L,z,oe){var q=Q.call(this,L,z,oe)||this;return q.arrowType="end",q.arrowBaseHeight=10,q.arrowBaseWidth=10,q.getArrowPoints=q.getArrowPoints.bind(q),q.setArrowType=q.setArrowType.bind(q),q.arrowTypePanel=new Ae("Arrow type","end"),q.arrowTypePanel.onArrowTypeChanged=q.setArrowType,q}return De(C,Q),C.prototype.ownsTarget=function(L){return!(!Q.prototype.ownsTarget.call(this,L)&&L!==this.arrow1&&L!==this.arrow2)},C.prototype.getArrowPoints=function(L,z){var oe=this.arrowBaseWidth+2*this.strokeWidth,q=this.arrowBaseHeight+2*this.strokeWidth;return L-oe/2+","+(z+q/2)+" "+L+","+(z-q/2)+" "+(L+oe/2)+","+(z+q/2)},C.prototype.createTips=function(){this.arrow1=be.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(be.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=be.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(be.createTransform()),this.visual.appendChild(this.arrow2)},C.prototype.pointerDown=function(L,z){Q.prototype.pointerDown.call(this,L,z),this.state==="creating"&&this.createTips()},C.prototype.adjustVisual=function(){if(Q.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",be.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),be.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var L=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),z=this.arrow1.transform.baseVal.getItem(0);z.setRotate(L,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(z,0);var oe=this.arrow2.transform.baseVal.getItem(0);oe.setRotate(L+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(oe,0)}},C.prototype.setArrowType=function(L){this.arrowType=L,this.adjustVisual(),this.stateChanged()},Object.defineProperty(C.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),C.prototype.getState=function(){var L=Object.assign({arrowType:this.arrowType},Q.prototype.getState.call(this));return L.typeName=C.typeName,L},C.prototype.restoreState=function(L){Q.prototype.restoreState.call(this,L);var z=L;this.arrowType=z.arrowType,this.createTips(),this.adjustVisual()},C.typeName="ArrowMarker",C.title="Arrow marker",C.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',C}(bt),le=function(Q){function C(L,z,oe){var q=Q.call(this,L,z,oe)||this;return q.fillColor=oe.defaultFillColor,q.strokeWidth=0,q.fillPanel=new _t("Color",oe.defaultColorSet,oe.defaultFillColor),q.fillPanel.onColorChanged=q.setFillColor,q}return De(C,Q),Object.defineProperty(C.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),C.prototype.getState=function(){var L=Q.prototype.getState.call(this);return L.typeName=C.typeName,L},C.typeName="CoverMarker",C.title="Cover marker",C.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',C}(pn),he=function(Q){function C(L,z,oe,q){var ke=Q.call(this,L,q||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return ke.opacities=[],ke.opacityBoxes=[],ke.opacities=z,ke.currentOpacity=oe,ke.setCurrentOpacity=ke.setCurrentOpacity.bind(ke),ke}return De(C,Q),C.prototype.getUi=function(){var L=this,z=document.createElement("div");return z.style.display="flex",z.style.overflow="hidden",z.style.flexGrow="2",z.style.justifyContent="space-between",this.opacities.forEach(function(oe){var q=document.createElement("div");q.style.display="flex",q.style.alignItems="center",q.style.justifyContent="center",q.style.padding="5px",q.style.borderWidth="2px",q.style.borderStyle="solid",q.style.borderColor=oe===L.currentOpacity?L.uiStyleSettings.toolboxAccentColor:"transparent",q.addEventListener("click",function(){L.setCurrentOpacity(oe,q)}),z.appendChild(q);var ke=document.createElement("div");ke.innerText=100*oe+"%",q.appendChild(ke),L.opacityBoxes.push(q)}),z},C.prototype.setCurrentOpacity=function(L,z){var oe=this;this.currentOpacity=L,this.opacityBoxes.forEach(function(q){q.style.borderColor=q===z?oe.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},C}(Et),Se=function(Q){function C(L,z,oe){var q=Q.call(this,L,z,oe)||this;return q.setOpacity=q.setOpacity.bind(q),q.fillColor=oe.defaultHighlightColor,q.strokeWidth=0,q.opacity=oe.defaultHighlightOpacity,q.fillPanel=new _t("Color",oe.defaultColorSet,q.fillColor),q.fillPanel.onColorChanged=q.setFillColor,q.opacityPanel=new he("Opacity",oe.defaultOpacitySteps,q.opacity),q.opacityPanel.onOpacityChanged=q.setOpacity,q}return De(C,Q),C.prototype.setOpacity=function(L){this.opacity=L,this.visual&&be.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(C.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),C.prototype.getState=function(){var L=Q.prototype.getState.call(this);return L.typeName=C.typeName,L},C.typeName="HighlightMarker",C.title="Highlight marker",C.icon='<svg viewBox="0 0 24 24"><path d="M18.5 1.15c-.53 0-1.04.19-1.43.58l-5.81 5.82 5.65 5.65 5.82-5.81c.77-.78.77-2.04 0-2.83l-2.84-2.83c-.39-.39-.89-.58-1.39-.58M10.3 8.5l-5.96 5.96c-.78.78-.78 2.04.02 2.85C3.14 18.54 1.9 19.77.67 21h5.66l.86-.86c.78.76 2.03.75 2.81-.02l5.95-5.96"/></svg>',C}(le),ve='<svg viewBox="0 0 24 24"><path d="M19 11.5s-2 2.17-2 3.5a2 2 0 002 2 2 2 0 002-2c0-1.33-2-3.5-2-3.5M5.21 10L10 5.21 14.79 10m1.77-1.06L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.56-.59 1.53 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.59.59-1.56 0-2.12z"/></svg>',Pe=function(Q){function C(L,z,oe){var q=Q.call(this,L,z,oe)||this;return q.bgColor="transparent",q.tipPosition={x:0,y:0},q.tipBase1Position={x:0,y:0},q.tipBase2Position={x:0,y:0},q.tipMoving=!1,q.color=oe.defaultStrokeColor,q.bgColor=oe.defaultFillColor,q.fontFamily=oe.defaultFontFamily,q.defaultSize={x:100,y:30},q.setBgColor=q.setBgColor.bind(q),q.getTipPoints=q.getTipPoints.bind(q),q.positionTip=q.positionTip.bind(q),q.setTipPoints=q.setTipPoints.bind(q),q.colorPanel=new _t("Text color",oe.defaultColorSet,q.color,'<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>'),q.colorPanel.onColorChanged=q.setColor,q.bgColorPanel=new _t("Fill color",oe.defaultColorSet,q.bgColor,ve),q.bgColorPanel.onColorChanged=q.setBgColor,q.fontFamilyPanel=new nt("Font",oe.defaultFontFamilies,oe.defaultFontFamily),q.fontFamilyPanel.onFontChanged=q.setFont,q.tipGrip=new Xt,q.tipGrip.visual.transform.baseVal.appendItem(be.createTransform()),q.controlBox.appendChild(q.tipGrip.visual),q}return De(C,Q),C.prototype.ownsTarget=function(L){return Q.prototype.ownsTarget.call(this,L)||this.tipGrip.ownsTarget(L)||this.tip===L},C.prototype.createTip=function(){be.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=be.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},C.prototype.pointerDown=function(L,z){this.state==="new"&&Q.prototype.pointerDown.call(this,L,z),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(z)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):Q.prototype.pointerDown.call(this,L,z)},C.prototype.pointerUp=function(L){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,Q.prototype.pointerUp.call(this,L);else{var z=this.state==="creating";Q.prototype.pointerUp.call(this,L),this.setTipPoints(z),this.positionTip()}},C.prototype.manipulate=function(L){if(this.tipMoving){var z=this.unrotatePoint(L);this.tipPosition={x:z.x-this.manipulationStartLeft,y:z.y-this.manipulationStartTop},this.positionTip()}else Q.prototype.manipulate.call(this,L)},C.prototype.setBgColor=function(L){this.bgRectangle&&this.tip&&(be.setAttributes(this.bgRectangle,[["fill",L]]),be.setAttributes(this.tip,[["fill",L]])),this.bgColor=L,this.fillColorChanged(L)},C.prototype.getTipPoints=function(){return this.setTipPoints(this.state==="creating"),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},C.prototype.setTipPoints=function(L){L===void 0&&(L=!1);var z=Math.min(this.height/2,15),oe=this.height/5;L&&(this.tipPosition={x:z+oe/2,y:this.height+20});var q=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?q<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(oe=this.width/5,z=Math.min(this.width/2,15),this.tipBase1Position={x:z,y:0},this.tipBase2Position={x:z+oe,y:0}):(this.tipBase1Position={x:0,y:z},this.tipBase2Position={x:0,y:z+oe}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?q<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(oe=this.width/5,z=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-z-oe,y:0},this.tipBase2Position={x:this.width-z,y:0}):(this.tipBase1Position={x:this.width,y:z},this.tipBase2Position={x:this.width,y:z+oe}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?q<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(oe=this.width/5,z=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-z-oe,y:this.height},this.tipBase2Position={x:this.width-z,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-z-oe},this.tipBase2Position={x:this.width,y:this.height-z}):q<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(oe=this.width/5,z=Math.min(this.width/2,15),this.tipBase1Position={x:z,y:this.height},this.tipBase2Position={x:z+oe,y:this.height}):(this.tipBase1Position={x:0,y:this.height-z},this.tipBase2Position={x:0,y:this.height-z-oe})},C.prototype.resize=function(L){Q.prototype.resize.call(this,L),this.positionTip()},C.prototype.positionTip=function(){be.setAttributes(this.tip,[["points",this.getTipPoints()]]);var L=this.tipGrip.visual.transform.baseVal.getItem(0);L.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(L,0)},Object.defineProperty(C.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),C.prototype.select=function(){this.positionTip(),Q.prototype.select.call(this)},C.prototype.getState=function(){var L=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},Q.prototype.getState.call(this));return L.typeName=C.typeName,L},C.prototype.restoreState=function(L){var z=L;this.bgColor=z.bgColor,this.tipPosition=z.tipPosition,Q.prototype.restoreState.call(this,L),this.createTip(),this.setTipPoints()},C.prototype.scale=function(L,z){Q.prototype.scale.call(this,L,z),this.tipPosition={x:this.tipPosition.x*L,y:this.tipPosition.y*z},this.positionTip()},C.typeName="CalloutMarker",C.title="Callout marker",C.icon='<svg viewBox="0 0 24 24"><path d="M4 2h16a2 2 0 012 2v12a2 2 0 01-2 2h-4l-4 4-4-4H4a2 2 0 01-2-2V4a2 2 0 012-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4m2 3h12v2H6V7m0 4h10v2H6v-2z"/></svg>',C}(vt),it=function(Q){function C(L,z,oe){var q=Q.call(this,L,z,oe)||this;return q.fillColor="transparent",q.strokeColor="transparent",q.strokeWidth=0,q.strokeDasharray="",q.opacity=1,q.strokeColor=oe.defaultColor,q.strokeWidth=oe.defaultStrokeWidth,q.strokeDasharray=oe.defaultStrokeDasharray,q.fillColor=oe.defaultFillColor,q.setStrokeColor=q.setStrokeColor.bind(q),q.setFillColor=q.setFillColor.bind(q),q.setStrokeWidth=q.setStrokeWidth.bind(q),q.setStrokeDasharray=q.setStrokeDasharray.bind(q),q.setOpacity=q.setOpacity.bind(q),q.createVisual=q.createVisual.bind(q),q.strokePanel=new _t("Line color",Ee(oe.defaultColorSet,["transparent"]),oe.defaultColor),q.strokePanel.onColorChanged=q.setStrokeColor,q.fillPanel=new _t("Fill color",Ee(oe.defaultColorSet,["transparent"]),q.fillColor,ve),q.fillPanel.onColorChanged=q.setFillColor,q.strokeWidthPanel=new Un("Line width",oe.defaultStrokeWidths,oe.defaultStrokeWidth),q.strokeWidthPanel.onWidthChanged=q.setStrokeWidth,q.strokeStylePanel=new Cn("Line style",oe.defaultStrokeDasharrays,oe.defaultStrokeDasharray),q.strokeStylePanel.onStyleChanged=q.setStrokeDasharray,q.opacityPanel=new he("Opacity",oe.defaultOpacitySteps,q.opacity),q.opacityPanel.onOpacityChanged=q.setOpacity,q}return De(C,Q),C.prototype.ownsTarget=function(L){return!(!Q.prototype.ownsTarget.call(this,L)&&L!==this.visual)},C.prototype.createVisual=function(){this.visual=be.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},C.prototype.pointerDown=function(L,z){Q.prototype.pointerDown.call(this,L,z),this.state==="new"&&(this.createVisual(),this.moveVisual(L),this._state="creating")},C.prototype.manipulate=function(L){Q.prototype.manipulate.call(this,L)},C.prototype.resize=function(L){Q.prototype.resize.call(this,L),this.setSize()},C.prototype.setSize=function(){Q.prototype.setSize.call(this),be.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},C.prototype.pointerUp=function(L){Q.prototype.pointerUp.call(this,L),this.setSize()},C.prototype.setStrokeColor=function(L){this.strokeColor=L,this.visual&&be.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(L),this.stateChanged()},C.prototype.setFillColor=function(L){this.fillColor=L,this.visual&&be.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(L),this.stateChanged()},C.prototype.setStrokeWidth=function(L){this.strokeWidth=L,this.visual&&be.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},C.prototype.setStrokeDasharray=function(L){this.strokeDasharray=L,this.visual&&be.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},C.prototype.setOpacity=function(L){this.opacity=L,this.visual&&be.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(C.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),C.prototype.getState=function(){var L=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},Q.prototype.getState.call(this));return L.typeName=C.typeName,L},C.prototype.restoreState=function(L){var z=L;this.fillColor=z.fillColor,this.strokeColor=z.strokeColor,this.strokeWidth=z.strokeWidth,this.strokeDasharray=z.strokeDasharray,this.opacity=z.opacity,this.createVisual(),Q.prototype.restoreState.call(this,L),this.setSize()},C.prototype.scale=function(L,z){Q.prototype.scale.call(this,L,z),this.setSize()},C.typeName="EllipseMarker",C.title="Ellipse marker",C.icon='<svg viewBox="0 0 24 24"><path d="M12 4C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',C}(sn),xt=function(Q){function C(L,z,oe){return Q.call(this,L,z,oe)||this}return De(C,Q),Object.defineProperty(C.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),C.prototype.ownsTarget=function(L){return!(!Q.prototype.ownsTarget.call(this,L)&&L!==this.tip1&&L!==this.tip2)},C.prototype.createTips=function(){this.tip1=be.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(be.createTransform()),this.visual.appendChild(this.tip1),this.tip2=be.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(be.createTransform()),this.visual.appendChild(this.tip2)},C.prototype.pointerDown=function(L,z){Q.prototype.pointerDown.call(this,L,z),this.state==="creating"&&this.createTips()},C.prototype.adjustVisual=function(){if(Q.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(be.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),be.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var L=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),z=this.tip1.transform.baseVal.getItem(0);z.setRotate(L,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(z,0);var oe=this.tip2.transform.baseVal.getItem(0);oe.setRotate(L+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(oe,0)}},Object.defineProperty(C.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),C.prototype.getState=function(){var L=Q.prototype.getState.call(this);return L.typeName=C.typeName,L},C.prototype.restoreState=function(L){Q.prototype.restoreState.call(this,L),this.createTips(),this.adjustVisual()},C.typeName="MeasurementMarker",C.title="Measurement marker",C.icon='<svg viewBox="0 0 24 24"><path d="M1.39 18.36l1.77-1.76L4.58 18l1.06-1.05-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.42 1.41L10.59 12l-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.41 1.41 1.07-1.06-1.42-1.41 1.42-1.42L18 6.7l1.07-1.06-2.47-2.48 1.76-1.77 4.25 4.25L5.64 22.61l-4.25-4.25z"/></svg>',C}(bt),$t=function(Q){function C(L,z,oe){var q=Q.call(this,L,z,oe)||this;return q.strokePanel.colors=oe.defaultColorSet,q.fillColor="transparent",q}return De(C,Q),Object.defineProperty(C.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),C.prototype.getState=function(){var L=Q.prototype.getState.call(this);return L.typeName=C.typeName,L},C.typeName="EllipseFrameMarker",C.title="Ellipse frame marker",C.icon='<svg viewBox="0 0 24 24"><path d="M12 6c4.41 0 8 2.69 8 6s-3.59 6-8 6-8-2.69-8-6 3.59-6 8-6m0-2C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',C}(it),mn=function(){function Q(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(Q.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),Q.prototype.addUndoStep=function(C){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(C)||(this.undoStack.push(C),JSON.stringify(this.lastRedoStep)!==JSON.stringify(C)&&this.redoStack.splice(0,this.redoStack.length))},Q.prototype.replaceLastUndoStep=function(C){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=C)},Q.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},Q.prototype.undo=function(){if(this.undoStack.length>1){var C=this.undoStack.pop();return C!==void 0&&this.redoStack.push(C),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},Q.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},Q}(),rn=function(Q){function C(L,z,oe){var q=Q.call(this,L,z,oe)||this;return q.strokeColor="transparent",q.strokeWidth=0,q.strokeDasharray="",q.curveX=0,q.curveY=0,q.manipulationStartCurveX=0,q.manipulationStartCurveY=0,q.setStrokeColor=q.setStrokeColor.bind(q),q.setStrokeWidth=q.setStrokeWidth.bind(q),q.setStrokeDasharray=q.setStrokeDasharray.bind(q),q.positionGrips=q.positionGrips.bind(q),q.addControlGrips=q.addControlGrips.bind(q),q.adjustVisual=q.adjustVisual.bind(q),q.setupControlBox=q.setupControlBox.bind(q),q.resize=q.resize.bind(q),q.strokeColor=oe.defaultColor,q.strokeWidth=oe.defaultStrokeWidth,q.strokeDasharray=oe.defaultStrokeDasharray,q.strokePanel=new _t("Line color",oe.defaultColorSet,oe.defaultColor),q.strokePanel.onColorChanged=q.setStrokeColor,q.strokeWidthPanel=new Un("Line width",oe.defaultStrokeWidths,oe.defaultStrokeWidth),q.strokeWidthPanel.onWidthChanged=q.setStrokeWidth,q.strokeStylePanel=new Cn("Line style",oe.defaultStrokeDasharrays,oe.defaultStrokeDasharray),q.strokeStylePanel.onStyleChanged=q.setStrokeDasharray,q}return De(C,Q),C.prototype.ownsTarget=function(L){return!(!Q.prototype.ownsTarget.call(this,L)&&L!==this.visual&&L!==this.selectorCurve&&L!==this.visibleCurve&&!this.curveGrip.ownsTarget(L))},C.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},C.prototype.createVisual=function(){this.visual=be.createGroup(),this.selectorCurve=be.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=be.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},C.prototype.pointerDown=function(L,z){Q.prototype.pointerDown.call(this,L,z),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=L.x,this.curveY=L.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(z)&&(this.activeGrip=this.curveGrip,this._state="resize")},C.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),be.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),be.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),be.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},C.prototype.setupControlBox=function(){Q.prototype.setupControlBox.call(this),this.curveControlLine1=be.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=be.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},C.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,Q.prototype.addControlGrips.call(this)},C.prototype.positionGrips=function(){Q.prototype.positionGrips.call(this);var L=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-L/2,this.curveY-L/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},C.prototype.manipulate=function(L){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+L.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+L.y-this.manipulationStartY),Q.prototype.manipulate.call(this,L)},C.prototype.resize=function(L){this.activeGrip===this.curveGrip&&(this.curveX=L.x,this.curveY=L.y),Q.prototype.resize.call(this,L),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},C.prototype.setStrokeColor=function(L){this.strokeColor=L,this.adjustVisual(),this.colorChanged(L)},C.prototype.setStrokeWidth=function(L){this.strokeWidth=L,this.adjustVisual()},C.prototype.setStrokeDasharray=function(L){this.strokeDasharray=L,this.adjustVisual()},C.prototype.scale=function(L,z){this.curveX=this.curveX*L,this.curveY=this.curveY*z,Q.prototype.scale.call(this,L,z)},Object.defineProperty(C.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),C.prototype.getState=function(){var L=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},Q.prototype.getState.call(this));return L.typeName=C.typeName,L},C.prototype.restoreState=function(L){Q.prototype.restoreState.call(this,L);var z=L;this.strokeColor=z.strokeColor,this.strokeWidth=z.strokeWidth,this.strokeDasharray=z.strokeDasharray,this.curveX=z.curveX,this.curveY=z.curveY,this.createVisual(),this.adjustVisual()},C.typeName="CurveMarker",C.title="Curve marker",C.icon='<svg viewBox="0 0 24 24"><path d="M18.5 2A1.5 1.5 0 0120 3.5 1.5 1.5 0 0118.5 5c-.23 0-.45-.05-.65-.15l-3.69 3.7.34.45c2.19-1.26 4.76-2 7.5-2l1 .03v2.01L22 9c-2.58 0-5 .75-7 2.04A3.96 3.96 0 0111.04 15C9.75 17 9 19.42 9 22l.04 1H7.03L7 22c0-2.74.74-5.31 2-7.5l-.45-.34-3.7 3.69c.1.2.15.42.15.65A1.5 1.5 0 013.5 20 1.5 1.5 0 012 18.5 1.5 1.5 0 013.5 17c.23 0 .45.05.65.15l3.69-3.7C7.31 12.78 7 11.92 7 11a4 4 0 014-4c.92 0 1.78.31 2.45.84l3.7-3.69c-.1-.2-.15-.42-.15-.65A1.5 1.5 0 0118.5 2M11 9a2 2 0 00-2 2 2 2 0 002 2 2 2 0 002-2 2 2 0 00-2-2z"/></svg>',C}(St),ci=function(){function Q(C,L){L===void 0&&(L=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=C,this.cancelable=L}return Object.defineProperty(Q.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),Q.prototype.preventDefault=function(){this._defaultPrevented=!0},Q}(),Jn=function(Q){function C(L,z,oe){var q=Q.call(this,L,!1)||this;return q.dataUrl=z,q.state=oe,q}return De(C,Q),C}(ci),Sn=function(Q){function C(L,z,oe){oe===void 0&&(oe=!1);var q=Q.call(this,L,oe)||this;return q.marker=z,q}return De(C,Q),C}(ci),pi=function(){function Q(){this.render=[],this.beforeclose=[],this.close=[],this.show=[],this.restorestate=[],this.statechange=[],this.markerselect=[],this.markerdeselect=[],this.markercreating=[],this.markercreate=[],this.markerbeforedelete=[],this.markerdelete=[],this.markerchange=[],this.focus=[],this.blur=[]}return Q.prototype.addEventListener=function(C,L){this[C].push(L)},Q.prototype.removeEventListener=function(C,L){var z=this[C].indexOf(L);z>-1&&this[C].splice(z,1)},Q}(),gi=function(){function Q(C){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Ye,this._isOpen=!1,this.undoRedoManager=new mn,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.renderMarkersOnly=!1,this.zoomSteps=[1,1.5,2,4],this._zoomLevel=1,this._isResizing=!1,this.prevPanPoint={x:0,y:0},this.eventListeners=new pi,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=Q.instanceCounter++,this.styles=new Le(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=C,this.targetRoot=document.body,this.width=C.clientWidth,this.height=C.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(Q.prototype,"ALL_MARKER_TYPES",{get:function(){return[Qe,Ue,Re,vt,$t,it,Se,Pe,xt,le,bt,rn]},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[Qe,Ue,Re,vt,it,Se,Pe]},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"BASIC_MARKER_TYPES",{get:function(){return[Qe,Ue,Re,vt,Se]},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(C){var L=this;this._availableMarkerTypes.splice(0),C.forEach(function(z){if(typeof z=="string"){var oe=L.ALL_MARKER_TYPES.find(function(q){return q.typeName===z});oe!==void 0&&L._availableMarkerTypes.push(oe)}else L._availableMarkerTypes.push(z)})},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(C){this._zoomLevel=C,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Q.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),te.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},Q.prototype.show=function(){var C=this;this.styles.styleSheetRoot===void 0&&ye.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=ye.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(L){return L(new ci(C))})},Q.prototype.render=function(){return xe(this,void 0,void 0,function(){var C;return Oe(this,function(L){switch(L.label){case 0:return this.setCurrentMarker(),(C=new me).naturalSize=this.renderAtNaturalSize,C.imageType=this.renderImageType,C.imageQuality=this.renderImageQuality,C.markersOnly=this.renderMarkersOnly,C.width=this.renderWidth,C.height=this.renderHeight,[4,C.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return L.sent(),[4,C.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,L.sent()]}})})},Q.prototype.close=function(C){var L=this;if(C===void 0&&(C=!1),this.isOpen){var z=!1;C||this.eventListeners.beforeclose.forEach(function(oe){var q=new ci(L,!0);oe(q),q.defaultPrevented&&(z=!0)}),z||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(oe){return oe(new ci(L))}),this.detachEvents(),this._isOpen=!1)}},Q.prototype.addMarkersToToolbar=function(){for(var C,L=[],z=0;z<arguments.length;z++)L[z]=arguments[z];(C=this._availableMarkerTypes).push.apply(C,L)},Q.prototype.addRenderEventListener=function(C){this.addEventListener("render",function(L){C(L.dataUrl,L.state)})},Q.prototype.removeRenderEventListener=function(C){},Q.prototype.addCloseEventListener=function(C){this.addEventListener("close",function(){C()})},Q.prototype.removeCloseEventListener=function(C){},Q.prototype.setupResizeObserver=function(){var C=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){C.resize(C.target.clientWidth,C.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return C.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},Q.prototype.onPopupTargetResize=function(){var C=1*this.target.clientWidth/this.target.clientHeight,L=this.editorCanvas.clientWidth/C>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*C:this.editorCanvas.clientWidth,z=L<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/C;this.resize(L,z)},Q.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},Q.prototype.resize=function(C,L){this._isResizing=!0;var z=C/this.imageWidth,oe=L/this.imageHeight;this.imageWidth=Math.round(C),this.imageHeight=Math.round(L),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(z,oe),this._isResizing=!1},Q.prototype.scaleMarkers=function(C,L){var z,oe=this;this._currentMarker&&this._currentMarker instanceof vt?this._currentMarker.scale(C,L):(z=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(q){q!==oe._currentMarker&&q.scale(C,L)}),z!==void 0&&this.setCurrentMarker(z)},Q.prototype.setEditingTarget=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px"},Q.prototype.setTopLeft=function(){var C=this.editingTarget.getBoundingClientRect(),L=this.editorCanvas.getBoundingClientRect();this.left=C.left-L.left,this.top=C.top-L.top},Q.prototype.initMarkerCanvas=function(){this.markerImageHolder=document.createElement("div"),this.markerImageHolder.style.setProperty("touch-action","pinch-zoom"),this.markerImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.markerImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImage.style.pointerEvents="auto",this.markerImageHolder.style.position="absolute",this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.markerImageHolder.style.transformOrigin="top left",this.positionMarkerImage(),this.markerImageHolder.appendChild(this.markerImage),this.editorCanvas.appendChild(this.markerImageHolder)},Q.prototype.addDefs=function(){for(var C,L=[],z=0;z<arguments.length;z++)L[z]=arguments[z];this.defs=be.createDefs(),this.addDefsToImage(),(C=this.defs).append.apply(C,L)},Q.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},Q.prototype.initOverlay=function(){this.overlayContainer=document.createElement("div"),this.overlayContainer.style.position="absolute",this.overlayContainer.style.left="0px",this.overlayContainer.style.top="0px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.overlayContainer.style.display="flex",this.markerImageHolder.appendChild(this.overlayContainer)},Q.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},Q.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},Q.prototype.attachWindowEvents=function(){window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("pointerout",this.onPointerOut),window.addEventListener("pointerleave",this.onPointerUp),window.addEventListener("resize",this.onWindowResize),window.addEventListener("keyup",this.onKeyUp)},Q.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},Q.prototype.detachWindowEvents=function(){window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("pointerout",this.onPointerOut),window.removeEventListener("pointerleave",this.onPointerUp),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keyup",this.onKeyUp)},Q.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var C=document.createElement("a");C.href="https://markerjs.com/",C.target="_blank",C.innerHTML='<svg viewBox="0 0 112 96" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path fill="#e5f20d" fill-opacity=".647" d="M0 40.386h111.96V95.62H0z"/><path d="M93.61 61.452c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.591 1.048-1.481 0-2.222-.74-2.222-2.22 0-16.617-.533-29.347-1.604-38.192-1.068-8.842-2.92-13.265-5.552-13.265-4.443 0-10.94 15.509-19.497 46.52v.124c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.592 1.048-1.48 0-2.22-.74-2.22-2.22 0-3.29.165-8.392.493-15.302.33-7.732.494-13.82.494-18.262 0-6.17-.186-10.55-.556-13.142-.37-2.591-1.172-3.887-2.406-3.887-2.796 0-6.333 5.12-10.612 15.363C38.494 34.367 34.01 46.44 29.32 60.34l-1.11 3.209a5.714 5.714 0 01-1.42 2.097c-.617.578-1.295.864-2.036.864-.987 0-1.644-.081-1.974-.247-.328-.162-.533-.656-.617-1.48-.41-4.03-.74-9.418-.987-16.165-.163-1.728-.329-4.566-.494-8.515-.822-13.901-1.562-23.3-2.221-28.196-.657-4.893-.987-7.628-.987-8.205 0-.657.33-1.44.987-2.345.659-.903 1.276-1.357 1.85-1.357 1.319 0 2.387.947 3.21 2.838.411.906.863 4.526 1.357 10.859.493 6.335.905 14.19 1.233 23.568l.617 18.88c4.527-13.983 9.216-26.673 14.068-38.068C45.65 6.686 50.093.988 54.123.988c2.715 0 4.566 1.974 5.553 5.923.987 3.949 1.481 9.667 1.481 17.152 0 3.949-.081 9.625-.247 17.029l-.123 5.676c3.373-11.762 6.725-21.634 10.057-29.615 3.331-7.979 6.685-11.97 10.056-11.97 8.475 0 12.71 18.757 12.71 56.269z" fill-rule="nonzero"/></svg>',C.title="Powered by marker.js",C.style.display="grid",C.style.alignItems="center",C.style.justifyItems="center",C.style.padding="3px",C.style.width="20px",C.style.height="20px",this.logoUI.appendChild(C),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},Q.prototype.positionLogo=function(){this.logoUI&&(this.uiStyleSettings.logoPosition!=="right"?this.logoUI.style.left=this.markerImageHolder.offsetLeft+10+"px":this.logoUI.style.left=this.markerImageHolder.offsetLeft+this.markerImageHolder.offsetWidth-this.logoUI.clientWidth-10+"px",this.logoUI.style.top=this.markerImageHolder.offsetTop+this.markerImageHolder.offsetHeight-this.logoUI.clientHeight-10+"px")},Q.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},Q.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},Q.prototype.showUI=function(){switch(this.settings.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var C=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=C+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.settings.displayMode==="popup"?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new ze(this.uiDiv,this.settings.displayMode,this._availableMarkerTypes,this.uiStyleSettings,this.styles),this.toolbar.addButtonClickListener(this.toolbarButtonClicked),this.toolbar.show(this._silentRenderMode||this.uiStyleSettings.hideToolbar?"hidden":"visible"),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.settings.displayMode==="popup"&&(this.contentDiv.style.backgroundColor=this.uiStyleSettings.canvasBackgroundColor,this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.uiStyleSettings.toolbarHeight+"px",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.settings.popupMargin+"px)"),this.contentDiv.style.overflow="auto",this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.settings.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.editorCanvas.style.transformOrigin="left top",this.editorCanvas.style.transform="scale("+this.zoomLevel+")",this.contentDiv.appendChild(this.editorCanvas),this.editingTarget=this.target instanceof HTMLImageElement?document.createElement("img"):document.createElement("canvas"),this.target.getClientRects().item(0).y<this.styles.settings.toolbarHeight&&(this.editingTarget.style.marginTop=this.target.offsetTop-this.styles.settings.toolbarHeight+"px"),this.editorCanvas.appendChild(this.editingTarget),this.toolbox=new ot(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},Q.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},Q.prototype.removeMarker=function(C){this.markerImage.removeChild(C.container),this.markers.indexOf(C)>-1&&this.markers.splice(this.markers.indexOf(C),1),C.dispose()},Q.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),this._currentMarker!==void 0&&(this._currentMarker.state!=="new"?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},Q.prototype.toolbarButtonClicked=function(C,L){if(C==="marker"&&L!==void 0)this.createNewMarker(L);else if(C==="action")switch(L){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},Q.prototype.deleteSelectedMarker=function(){var C=this;if(this._currentMarker!==void 0){var L=!1;if(this.eventListeners.markerbeforedelete.forEach(function(oe){var q=new Sn(C,C._currentMarker,!0);oe(q),q.defaultPrevented&&(L=!0)}),!L){var z=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(oe){return oe(new Sn(C,z))})}}},Q.prototype.clear=function(){var C=this,L=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ke){var ft=new Sn(C,void 0,!0);ke(ft),ft.defaultPrevented&&(L=!0)}),!L)){this.setCurrentMarker();for(var z=function(ke){var ft=oe.markers[ke];oe.setCurrentMarker(oe.markers[ke]),oe._currentMarker.dispose(),oe.markerImage.removeChild(oe._currentMarker.container),oe.markers.splice(oe.markers.indexOf(oe._currentMarker),1),oe.eventListeners.markerdelete.forEach(function(kt){return kt(new Sn(C,ft))})},oe=this,q=this.markers.length-1;q>=0;q--)z(q);this.addUndoStep()}},Object.defineProperty(Q.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),Q.prototype.showNotesEditor=function(){var C;this._currentMarker!==void 0&&(this.overlayContainer.innerHTML="",this.notesArea=document.createElement("textarea"),this.notesArea.className=this.uiStyleSettings.notesAreaStyleClassName,this.notesArea.style.pointerEvents="auto",this.notesArea.style.alignSelf="stretch",this.notesArea.style.width="100%",this.notesArea.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.notesArea.value=(C=this._currentMarker.notes)!==null&&C!==void 0?C:"",this.overlayContainer.appendChild(this.notesArea))},Q.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(this._currentMarker!==void 0&&(this._currentMarker.notes=this.notesArea.value.trim()!==""?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},Q.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},Q.prototype.addUndoStep=function(){var C=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var L=this.getState(),z=this.undoRedoManager.getLastUndoStep();if(!z||z.width===L.width&&z.height===L.height){var oe=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(L),oe<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(q){return q(new ci(C))})}else this.undoRedoManager.replaceLastUndoStep(L),this.eventListeners.statechange.forEach(function(q){return q(new ci(C))})}},Q.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},Q.prototype.undoStep=function(){var C=this,L=this.undoRedoManager.undo();L!==void 0&&(this.restoreState(L),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(z){return z(new ci(C))}))},Q.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},Q.prototype.redoStep=function(){var C=this,L=this.undoRedoManager.redo();L!==void 0&&(this.restoreState(L),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(z){return z(new ci(C))}))},Q.prototype.stepZoom=function(){var C=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=C<this.zoomSteps.length-1?this.zoomSteps[C+1]:this.zoomSteps[0]},Q.prototype.panTo=function(C){this.contentDiv.scrollBy({left:this.prevPanPoint.x-C.x,top:this.prevPanPoint.y-C.y}),this.prevPanPoint=C},Q.prototype.startRenderAndClose=function(){return xe(this,void 0,void 0,function(){var C,L,z=this;return Oe(this,function(oe){switch(oe.label){case 0:return[4,this.render()];case 1:return C=oe.sent(),L=this.getState(),this.eventListeners.render.forEach(function(q){return q(new Jn(z,C,L))}),this.close(!0),[2]}})})},Q.prototype.getState=function(C){C===!0&&this.setCurrentMarker();var L={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(z){return L.markers.push(z.getState())}),L},Q.prototype.restoreState=function(C){var L=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);C.markers.forEach(function(z){var oe=L._availableMarkerTypes.find(function(ke){return ke.typeName===z.typeName});if(oe!==void 0){var q=L.addNewMarker(oe);q.restoreState(z),L.markers.push(q)}}),C.width&&C.height&&(C.width!==this.imageWidth||C.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/C.width,this.imageHeight/C.height),this.eventListeners.restorestate.forEach(function(z){return z(new ci(L))})},Q.prototype.addNewMarker=function(C){var L=be.createGroup();return this.markerImage.appendChild(L),new C(L,this.overlayContainer,this.settings)},Q.prototype.createNewMarker=function(C){var L,z=this;(L=typeof C=="string"?this._availableMarkerTypes.find(function(oe){return oe.typeName===C}):C)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(L),this._currentMarker.onMarkerCreated=this.markerCreated,this._currentMarker.onColorChanged=this.colorChanged,this._currentMarker.onFillColorChanged=this.fillColorChanged,this._currentMarker.onStateChanged=this.markerStateChanged,this.markerImage.style.cursor="crosshair",this.toolbar.setActiveMarkerButton(L.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(oe){return oe(new Sn(z,z._currentMarker))}))},Q.prototype.markerCreated=function(C){var L=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(C),this.setCurrentMarker(C),C instanceof Ue&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(Ue):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(z){return z(new Sn(L,L._currentMarker))})},Q.prototype.colorChanged=function(C){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=C,this.settings.defaultStrokeColor=C)},Q.prototype.fillColorChanged=function(C){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=C)},Q.prototype.markerStateChanged=function(C){var L=this;this.eventListeners.markerchange.forEach(function(z){return z(new Sn(L,C))})},Q.prototype.setCurrentMarker=function(C){var L=this;this._currentMarker!==C&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(z){return z(new Sn(L,L._currentMarker))})),this._currentMarker=C,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(z){return z(new Sn(L,L._currentMarker))}))},Q.prototype.onPointerDown=function(C){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||C.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var L=this.markers.find(function(z){return z.ownsTarget(C.target)});L!==void 0?(this.setCurrentMarker(L),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(C.clientX,C.clientY),C.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:C.clientX,y:C.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(C.clientX,C.clientY))},Q.prototype.onDblClick=function(C){if(this._isFocused||this.focus(),this.mode==="select"){var L=this.markers.find(function(z){return z.ownsTarget(C.target)});L!==void 0&&L!==this._currentMarker&&this.setCurrentMarker(L),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(C.clientX,C.clientY),C.target):this.setCurrentMarker()}},Q.prototype.onPointerMove=function(C){this.touchPoints!==1&&C.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||C.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(C.clientX,C.clientY)):this.zoomLevel>1&&this.panTo({x:C.clientX,y:C.clientY}))},Q.prototype.onPointerUp=function(C){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(C.clientX,C.clientY)),this.isDragging=!1,this.addUndoStep()},Q.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},Q.prototype.onKeyUp=function(C){this._currentMarker===void 0||this.notesArea!==void 0||C.key!=="Delete"&&C.key!=="Backspace"||this.deleteSelectedMarker()},Q.prototype.clientToLocalCoordinates=function(C,L){var z=this.markerImage.getBoundingClientRect();return{x:(C-z.left)/this.zoomLevel,y:(L-z.top)/this.zoomLevel}},Q.prototype.onWindowResize=function(){this.positionUI()},Q.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var C=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=C+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},Q.prototype.addLicenseKey=function(C){te.addKey(C)},Q.prototype.addEventListener=function(C,L){this.eventListeners.addEventListener(C,L)},Q.prototype.removeEventListener=function(C,L){this.eventListeners.removeEventListener(C,L)},Q.prototype.renderState=function(C){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(C),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(Q.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),Q.prototype.focus=function(){var C=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(L){return L(new ci(C))}))},Q.prototype.blur=function(){var C=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(L){return L(new ci(C))}))},Q.instanceCounter=0,Q}();/* **********************************
|
|
cropro version 1.2.0
|
|
@license SEE LICENSE IN LICENSE
|
|
|
|
copyright Alan Mendelevich
|
|
see README and LICENSE for details
|
|
********************************** *//*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var xi=function(Q,C){return(xi=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(L,z){L.__proto__=z}||function(L,z){for(var oe in z)Object.prototype.hasOwnProperty.call(z,oe)&&(L[oe]=z[oe])})(Q,C)};function _i(Q,C){if(typeof C!="function"&&C!==null)throw new TypeError("Class extends value "+String(C)+" is not a constructor or null");function L(){this.constructor=Q}xi(Q,C),Q.prototype=C===null?Object.create(C):(L.prototype=C.prototype,new L)}function Dn(Q,C,L,z){return new(L||(L=Promise))(function(oe,q){function ke(an){try{kt(z.next(an))}catch(dt){q(dt)}}function ft(an){try{kt(z.throw(an))}catch(dt){q(dt)}}function kt(an){var dt;an.done?oe(an.value):(dt=an.value,dt instanceof L?dt:new L(function(Pt){Pt(dt)})).then(ke,ft)}kt((z=z.apply(Q,C||[])).next())})}function Ai(Q,C){var L,z,oe,q,ke={label:0,sent:function(){if(1&oe[0])throw oe[1];return oe[1]},trys:[],ops:[]};return q={next:ft(0),throw:ft(1),return:ft(2)},typeof Symbol=="function"&&(q[Symbol.iterator]=function(){return this}),q;function ft(kt){return function(an){return function(dt){if(L)throw new TypeError("Generator is already executing.");for(;ke;)try{if(L=1,z&&(oe=2&dt[0]?z.return:dt[0]?z.throw||((oe=z.return)&&oe.call(z),0):z.next)&&!(oe=oe.call(z,dt[1])).done)return oe;switch(z=0,oe&&(dt=[2&dt[0],oe.value]),dt[0]){case 0:case 1:oe=dt;break;case 4:return ke.label++,{value:dt[1],done:!1};case 5:ke.label++,z=dt[1],dt=[0];continue;case 7:dt=ke.ops.pop(),ke.trys.pop();continue;default:if(!(oe=ke.trys,(oe=oe.length>0&&oe[oe.length-1])||dt[0]!==6&&dt[0]!==2)){ke=0;continue}if(dt[0]===3&&(!oe||dt[1]>oe[0]&&dt[1]<oe[3])){ke.label=dt[1];break}if(dt[0]===6&&ke.label<oe[1]){ke.label=oe[1],oe=dt;break}if(oe&&ke.label<oe[2]){ke.label=oe[2],ke.ops.push(dt);break}oe[2]&&ke.ops.pop(),ke.trys.pop();continue}dt=C.call(Q,ke)}catch(Pt){dt=[6,Pt],z=0}finally{L=oe=0}if(5&dt[0])throw dt[1];return{value:dt[0]?dt[1]:void 0,done:!0}}([kt,an])}}}var Ln=function(){function Q(){}return Q.addKey=function(C){Q.key=C},Object.defineProperty(Q,"isLicensed",{get:function(){return!!Q.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(Q.key)},enumerable:!1,configurable:!0}),Q}(),Dt=function(){function Q(){}return Q.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},Q.setAttributes=function(C,L){for(var z=0,oe=L;z<oe.length;z++){var q=oe[z],ke=q[0],ft=q[1];C.setAttribute(ke,ft)}},Q.createRect=function(C,L,z){var oe=document.createElementNS("http://www.w3.org/2000/svg","rect");return oe.setAttribute("width",C.toString()),oe.setAttribute("height",L.toString()),z&&Q.setAttributes(oe,z),oe},Q.createLine=function(C,L,z,oe,q){var ke=document.createElementNS("http://www.w3.org/2000/svg","line");return ke.setAttribute("x1",C.toString()),ke.setAttribute("y1",L.toString()),ke.setAttribute("x2",z.toString()),ke.setAttribute("y2",oe.toString()),q&&Q.setAttributes(ke,q),ke},Q.createPolygon=function(C,L){var z=document.createElementNS("http://www.w3.org/2000/svg","polygon");return z.setAttribute("points",C),L&&Q.setAttributes(z,L),z},Q.createCircle=function(C,L){var z=document.createElementNS("http://www.w3.org/2000/svg","circle");return z.setAttribute("cx",(C/2).toString()),z.setAttribute("cy",(C/2).toString()),z.setAttribute("r",C.toString()),L&&Q.setAttributes(z,L),z},Q.createEllipse=function(C,L,z){var oe=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return oe.setAttribute("cx",(C/2).toString()),oe.setAttribute("cy",(L/2).toString()),oe.setAttribute("rx",(C/2).toString()),oe.setAttribute("ry",(L/2).toString()),z&&Q.setAttributes(oe,z),oe},Q.createGroup=function(C){var L=document.createElementNS("http://www.w3.org/2000/svg","g");return C&&Q.setAttributes(L,C),L},Q.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},Q.createMarker=function(C,L,z,oe,q,ke,ft){var kt=document.createElementNS("http://www.w3.org/2000/svg","marker");return Q.setAttributes(kt,[["id",C],["orient",L],["markerWidth",z.toString()],["markerHeight",oe.toString()],["refX",q.toString()],["refY",ke.toString()]]),kt.appendChild(ft),kt},Q.createText=function(C){var L=document.createElementNS("http://www.w3.org/2000/svg","text");return L.setAttribute("x","0"),L.setAttribute("y","0"),C&&Q.setAttributes(L,C),L},Q.createTSpan=function(C,L){var z=document.createElementNS("http://www.w3.org/2000/svg","tspan");return z.textContent=C,L&&Q.setAttributes(z,L),z},Q.createImage=function(C){var L=document.createElementNS("http://www.w3.org/2000/svg","image");return C&&Q.setAttributes(L,C),L},Q.createPoint=function(C,L){var z=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return z.x=C,z.y=L,z},Q.createPath=function(C,L){var z=document.createElementNS("http://www.w3.org/2000/svg","path");return z.setAttribute("d",C),L&&Q.setAttributes(z,L),z},Q.createElement=function(C,L){var z=document.createElementNS("http://www.w3.org/2000/svg",C);return L&&Q.setAttributes(z,L),z},Q.getHollowRectanglePath=function(C,L,z,oe,q,ke,ft,kt){return"M"+C+","+L+"V"+(L+oe)+"H"+(C+z)+"V"+L+"H"+q+"V"+ke+"H"+(q+ft)+"V"+(ke+kt)+"H"+q+"V"+L+"Z"},Q}(),Qn=function(){function Q(C){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+C+"_"}return Object.defineProperty(Q.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#333333",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarBackgroundActiveColor:"#282828",toolbarColor:"#eeeeee",cropShadeColor:"#ffffff",cropFrameColor:"#ffffff",gripColor:"#333333",gripFillColor:"#cccccc",toolbarHeight:40}},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),Q.prototype.addClass=function(C){return this.styleSheet===void 0&&this.addStyleSheet(),C.name=""+this.classNamePrefix+C.localName,this.classes.push(C),this.styleSheet.sheet.insertRule("."+C.name+" {"+C.style+"}",this.styleSheet.sheet.cssRules.length),C},Q.prototype.addRule=function(C){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(C),this.styleSheet.sheet.insertRule(C.selector+" {"+C.style+"}",this.styleSheet.sheet.cssRules.length)},Q.prototype.addStyleSheet=function(){var C;this.styleSheet=document.createElement("style"),((C=this.styleSheetRoot)!==null&&C!==void 0?C:document.head).appendChild(this.styleSheet),this.addRule(new vi("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new vi("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new vi("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new hi("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new hi("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},Q.prototype.removeStyleSheet=function(){var C;this.styleSheet&&(((C=this.styleSheetRoot)!==null&&C!==void 0?C:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},Q}(),vi=function(Q,C){this.selector=Q,this.style=C},hi=function(Q,C){this.localName=Q,this.style=C},bi=function(){function Q(){this.blocks=[],this.display=""}return Q.prototype.addButtonBlock=function(C){C.className=this.blockClassName,C.buttonClassName=this.buttonClassName,C.buttonColorsClassName=this.buttonColorsClassName,C.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(C)},Q.prototype.addElementBlock=function(C){C.className===void 0&&(C.className=this.blockClassName),this.blocks.push(C)},Q.prototype.getUI=function(){var C=document.createElement("div");return C.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,C.style.display=this.display,this.blocks.forEach(function(L){return C.appendChild(L.getUI())}),C},Q}(),yi=function(){function Q(){}return Q.prototype.getUI=function(){var C=document.createElement("div");if(C.className=this.className,this.minWidth!==void 0&&(C.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":C.style.justifyContent="flex-start";break;case"center":C.style.justifyContent="center";break;case"end":C.style.justifyContent="flex-end"}return C.style.whiteSpace="nowrap",C},Q}(),Fi=function(Q){function C(){var L=Q!==null&&Q.apply(this,arguments)||this;return L.buttons=[],L}return _i(C,Q),C.prototype.addButton=function(L){L.className=this.buttonClassName,L.colorsClassName=this.buttonColorsClassName,L.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(L)},C.prototype.getUI=function(){var L=Q.prototype.getUI.call(this);return this.buttons.forEach(function(z){return L.appendChild(z.getUI())}),L},C}(yi),ai=function(){function Q(C,L){this._isActive=!1,this._isHidden=!1,this._icon=C,this.title=L,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(Q.prototype,"icon",{get:function(){return this._icon},set:function(C){this._icon=C,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isActive",{get:function(){return this._isActive},set:function(C){this._isActive=C,this.adjustClassName()},enumerable:!1,configurable:!0}),Q.prototype.getUI=function(){var C=this;return this.buttonContainer=document.createElement("div"),this.buttonContainer.title=this.title,this.buttonContainer.className=this.className+" "+this.colorsClassName,this.adjustClassName(),this.buttonContainer.innerHTML=this._icon,this.onClick&&this.buttonContainer.addEventListener("click",function(){return C.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},Q.prototype.adjustClassName=function(){this.activeColorsClassName&&(this._isActive&&this.buttonContainer.className.indexOf(this.activeColorsClassName)<0?this.buttonContainer.className+=" "+this.activeColorsClassName:this._isActive||(this.buttonContainer.className=this.buttonContainer.className.replace(this.activeColorsClassName,"")))},Q.prototype.hide=function(){this._isHidden=!0},Q}(),pt=function(Q){function C(){var L=Q!==null&&Q.apply(this,arguments)||this;return L.elements=[],L}return _i(C,Q),C.prototype.addElement=function(L){this.elements.push(L)},C.prototype.getUI=function(){var L=Q.prototype.getUI.call(this);return this.elements.forEach(function(z){return L.appendChild(z)}),L},C}(yi),Je=function(){function Q(C,L){this.horizontal=C,this.vertical=L}return Object.defineProperty(Q.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),Q.prototype.getVerticalLength=function(C){return C/this.ratio},Q.prototype.getHorizontalLength=function(C){return C*this.ratio},Q}(),Ft=function(){function Q(){}return Q.getIcon=function(C,L){if(C>0&&L>0){var z=new Je(C,L),oe=z.ratio>=1?20:z.getHorizontalLength(20),q=z.ratio<1?20:z.getVerticalLength(20),ke=document.createElementNS("http://www.w3.org/2000/svg","svg");ke.setAttribute("xmlns","http://www.w3.org/2000/svg"),ke.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ke);var ft=Dt.createDefs();ke.appendChild(ft);var kt=Dt.createElement("clipPath",[["id","text-bg-clip"]]);ft.appendChild(kt);var an=Dt.createPath(Dt.getHollowRectanglePath((24-oe)/2,(24-q)/2,oe,q,(24-oe)/2+2,(24-q)/2+2,oe-4,q-4));ke.appendChild(an);var dt=Dt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);dt.appendChild(Dt.createTSpan(C+":"+L)),ke.appendChild(dt);var Pt=dt.getBBox();Dt.setAttributes(dt,[["x",((24-Pt.width)/2).toString()],["y",((24-Pt.height)/2-Pt.y).toString()]]);var tn=Dt.createPath(Dt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Pt.width))/2,(24-Math.ceil(Pt.height))/2,Math.ceil(Pt.width),Math.ceil(Pt.height)));return kt.appendChild(tn),Dt.setAttributes(an,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ke),ke.outerHTML}return'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},Q}(),Bt=function(Q){function C(L,z,oe){var q=Q.call(this,L,z)||this;return q.isDropdownOpen=!1,q.onClick=q.dropdownButtonClicked,q.dropdownButtons=oe,q}return _i(C,Q),C.prototype.setupDropdown=function(){var L=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(z){z.className=L.className,z.colorsClassName=L.colorsClassName,L.dropdownBlock.appendChild(z.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},C.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},C.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},C.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},C.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},C.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},C}(ai),Fe=function(){function Q(C,L){this.GRIP_SIZE=10,this.color=C,this.fillColor=L,this.visual=Dt.createGroup(),this.visual.appendChild(Dt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Dt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return Q.prototype.ownsTarget=function(C){return C===this.visual||C===this.visual.childNodes[0]||C===this.visual.childNodes[1]},Q.prototype.setCenter=function(C,L){this.visual.childNodes.forEach(function(z){return Dt.setAttributes(z,[["cx",C.toString()],["cy",L.toString()]])})},Q}(),ue=function(){function Q(C,L,z,oe){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=C,this.canvasHeight=L,this.margin=z,this.container=oe,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(Q.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(C){this._aspectRatio=C,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(C){this._isGridVisible=C,this.gridContainer&&Dt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(C){this._zoomFactor=C,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Q.prototype.open=function(){var C=this;this.cropShadeElement=Dt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=Dt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var L=0;L<this.numberOfGridLines;L++)this.horizontalGridLines.push(Dt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(Dt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(z){return C.gridContainer.appendChild(z)}),this.verticalGridLines.forEach(function(z){return C.gridContainer.appendChild(z)}),this.cropRectElement=Dt.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Fe(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Fe(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Fe(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Fe(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},Q.prototype.setCropRectangle=function(C){this.cropRect=C;var L=Object.assign({},this.cropRect);this.zoomFactor!==1&&(L.width=this.cropRect.width*this.zoomFactor,L.height=this.cropRect.height*this.zoomFactor,L.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-L.width/2,L.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-L.height/2),Dt.setAttributes(this.cropRectElement,[["x",L.x.toString()],["y",L.y.toString()],["width",L.width.toString()],["height",L.height.toString()]]);var z=L.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(q,ke){var ft=L.y+z*(ke+1);Dt.setAttributes(q,[["x1",""+L.x],["y1",""+ft],["x2",""+(L.x+L.width)],["y2",""+ft]])});var oe=L.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(q,ke){var ft=L.x+oe*(ke+1);Dt.setAttributes(q,[["x1",""+ft],["y1",""+L.y],["x2",""+ft],["y2",""+(L.y+L.height)]])}),Dt.setAttributes(this.cropShadeElement,[["d",Dt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,L.x,L.y,L.width,L.height)]]),this.topLeftGrip.setCenter(L.x,L.y),this.topRightGrip.setCenter(L.x+L.width,L.y),this.bottomLeftGrip.setCenter(L.x,L.y+L.height),this.bottomRightGrip.setCenter(L.x+L.width,L.y+L.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},Q.prototype.attachEvents=function(){this.container.style.touchAction="none",this.container.addEventListener("pointerdown",this.onPointerDown),this.container.addEventListener("pointermove",this.onPointerMove),this.container.addEventListener("pointerup",this.onPointerUp)},Q.prototype.clientToLocalCoordinates=function(C,L){var z=this.container.getBoundingClientRect();return{x:C-z.left+this.margin,y:L-z.top+this.margin}},Q.prototype.onPointerDown=function(C){this.container.setPointerCapture(C.pointerId),this.previousPoint=this.clientToLocalCoordinates(C.clientX,C.clientY),this.cropRectElement===C.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(C.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(C.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(C.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(C.target)&&(this.activeGrip=this.bottomRightGrip)},Q.prototype.onPointerMove=function(C){if(this.isMoving)this.move(this.clientToLocalCoordinates(C.clientX,C.clientY));else if(this.activeGrip){var L=this.clientToLocalCoordinates(C.clientX,C.clientY);this.resize(L)}C.preventDefault()},Q.prototype.onPointerUp=function(C){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(C.pointerId)},Q.prototype.move=function(C){var L=C.x-this.previousPoint.x,z=C.y-this.previousPoint.y;this.zoomFactor!==1&&(L=-L/this.zoomFactor,z=-z/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+L),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+z),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=C},Q.prototype.resize=function(C){var L=Object.assign({},this.cropRect),z=C.x-this.previousPoint.x,oe=C.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:L.x+z<this.margin&&(z=this.margin-L.x),L.x+=z,L.width=this.cropRect.x+this.cropRect.width-L.x;break;case this.bottomRightGrip:case this.topRightGrip:L.width+z>this.canvasWidth*this.zoomFactor&&(z=this.canvasWidth*this.zoomFactor-L.width),L.width+=z}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(L.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(z),L.height=this.aspectRatio.getVerticalLength(L.width)):(L.y+=oe,L.height=this.cropRect.y+this.cropRect.height-L.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?L.height=this.aspectRatio.getVerticalLength(L.width):L.height+=oe}L.width<10&&(L.x=this.cropRect.x,L.width=10),L.height<10&&(L.y=this.cropRect.y,L.height=10),this.previousPoint=C,L.x>=this.margin&&L.y>=this.margin&&L.x-this.margin+L.width<=this.canvasWidth&&L.y-this.margin+L.height<=this.canvasHeight&&(this.cropRect=L,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},Q.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var C=this.cropRect.x+this.cropRect.width/2,L=this.cropRect.y+this.cropRect.height/2,z=this.aspectRatio.getHorizontalLength(this.cropRect.height),oe=this.aspectRatio.getVerticalLength(this.cropRect.width);z/this.canvasWidth<oe/this.canvasHeight?this.cropRect.width=z:this.cropRect.height=oe,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=C-this.cropRect.width/2,this.cropRect.y=L-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},Q.prototype.getRescaledRect=function(C,L,z,oe,q,ke){var ft=z/C,kt=oe/L;return{x:(q.x-ke)*ft+ke,y:(q.y-ke)*kt+ke,width:q.width*ft,height:q.height*kt}},Q.prototype.scaleCanvas=function(C,L){var z=this.getRescaledRect(this.canvasWidth,this.canvasHeight,C,L,this.cropRect,this.margin);this.canvasWidth=C,this.canvasHeight=L,this.onCropChange&&this.onCropChange(z),this.setCropRectangle(z)},Q}(),si=function(){function Q(C){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=C,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(Q.prototype,"angle",{get:function(){return this._angle},set:function(C){this._angle=C,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),Q.prototype.getUI=function(){return this.controlContainer=document.createElement("div"),this.controlContainer.title=this.title,this.controlContainer.className=this.className+" "+this.colorsClassName,this.controlContainer.appendChild(this.getVisual()),this.controlContainer.addEventListener("pointerdown",this.onPointerDown),this.controlContainer.addEventListener("pointermove",this.onPointerMove),this.controlContainer.addEventListener("pointerup",this.onPointerUp),this.uiContainer.appendChild(this.controlContainer),this.uiContainer.style.display="inline-block",this.uiContainer.style.touchAction="none",this.setAngleLabel(),this.positionScaleShape(),this.uiContainer},Q.prototype.onPointerDown=function(C){this.controlContainer.setPointerCapture(C.pointerId),this.isDragging=!0,this.previousPoint={x:C.clientX,y:C.clientY}},Q.prototype.onPointerMove=function(C){this.isDragging&&(this.onAngleChange&&this.onAngleChange((C.clientX-this.previousPoint.x)/5),this.previousPoint.x=C.clientX)},Q.prototype.onPointerUp=function(C){this.isDragging&&this.onAngleChange&&this.onAngleChange((C.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(C.pointerId)},Q.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var C=this.angleLabelText.getBBox();Dt.setAttributes(this.angleLabelElement,[["x",((this.width-C.width)/2).toString()],["y",(this.height/2).toString()]])}},Q.prototype.positionScaleShape=function(){if(this.scaleShape){var C=this.scaleShape.transform.baseVal.getItem(0);C.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(C,0)}},Q.prototype.getVisual=function(){var C=document.createElementNS("http://www.w3.org/2000/svg","svg");C.setAttribute("xmlns","http://www.w3.org/2000/svg"),C.setAttribute("width",this.width+"px"),C.setAttribute("height",this.height+"px"),C.setAttribute("viewBox","0 0 "+this.width+" "+this.height),C.style.flexShrink="0",document.body.appendChild(C);for(var L="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,z=1;z<=this.width/5+10;z++){var oe=z%5==0?this.height/3:this.height/6;L+="h4v"+-oe+"h1v"+oe}L+="v1H0Z",this.scaleShape=Dt.createPath(L);var q=Dt.createTransform();this.scaleShape.transform.baseVal.appendItem(q),C.appendChild(this.scaleShape),this.angleLabelElement=Dt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=Dt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ke=Dt.createTSpan("");return ke.innerHTML="°",this.angleLabelElement.appendChild(ke),C.appendChild(this.angleLabelElement),document.body.removeChild(C),C},Q}(),je=function(){function Q(){this.naturalSize=!1,this.imageType="image/png"}return Q.prototype.rasterize=function(C,L,z,oe,q,ke,ft){var kt=this;return new Promise(function(an){var dt=document.createElement("canvas");dt.width=C.width.baseVal.value-2*oe,dt.height=C.height.baseVal.value-2*oe;var Pt=1,tn=1;kt.naturalSize===!0?(Pt=L.naturalWidth/(C.width.baseVal.value-2*oe)/ke,tn=L.naturalHeight/(C.height.baseVal.value-2*oe)/ft,dt.width=L.naturalWidth/ke,dt.height=L.naturalHeight/ft):kt.width!==void 0&&kt.height!==void 0&&(Pt=kt.width/z.width,tn=kt.height/z.height,dt.width*=Pt,dt.height*=tn);var Vn=dt.getContext("2d");Vn.translate(dt.width/2,dt.height/2),Vn.rotate(q*Math.PI/180),Vn.scale(ke,ft),Vn.translate(-dt.width/2,-dt.height/2),Vn.drawImage(L,0,0,dt.width,dt.height);var fi=document.createElement("canvas");fi.width=z.width*Pt,fi.height=z.height*tn,fi.getContext("2d").putImageData(Vn.getImageData((z.x-oe)*Pt,(z.y-oe)*tn,z.width*Pt,z.height*tn),0,0),an(fi.toDataURL(kt.imageType,kt.imageQuality))})},Q}(),Be=function(){function Q(C){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=Q.instanceCounter++,this.styles=new Qn(this.instanceNo),this.target=C,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(Q.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(C){this._zoomToCropEnabled=C,C?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(C){this._isGridVisible=C,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"gridLines",{get:function(){return this._gridLines},set:function(C){this._gridLines=C,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(C){this._rotationAngle=C,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"aspectRatio",{get:function(){var C;return(C=this._aspectRatio)!==null&&C!==void 0?C:this.aspectRatios[0]},set:function(C){this._aspectRatio=C},enumerable:!1,configurable:!0}),Q.prototype.open=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.setupResizeObserver(),this.initCropCanvas(),this.setEditingTarget(),this.setTopLeft(),this.initCropLayer(),this.attachEvents(),this.applyAspectRatio(),this.displayMode==="popup"&&this.onPopupResize(),this._isOpen=!0},Q.prototype.show=function(){this.showUI(),this.open()},Q.prototype.close=function(C){C===void 0&&(C=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),C||this.closeEventListeners.forEach(function(L){return L()}),this._isOpen=!1)},Q.prototype.addRenderEventListener=function(C){this.renderEventListeners.push(C)},Q.prototype.removeRenderEventListener=function(C){this.renderEventListeners.indexOf(C)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(C),1)},Q.prototype.addCloseEventListener=function(C){this.closeEventListeners.push(C)},Q.prototype.removeCloseEventListener=function(C){this.closeEventListeners.indexOf(C)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(C),1)},Q.prototype.setupResizeObserver=function(){var C=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){C.resize(C.target.clientWidth,C.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},Q.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var C=1*this.target.clientWidth/this.target.clientHeight,L=this.contentDiv.clientWidth/C>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*C:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,z=L+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/C;this.resize(L,z)}},Q.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},Q.prototype.setEditingTargetSize=function(){this.editorCanvas.style.width=this.imageWidth+2*this.CANVAS_MARGIN+"px",this.editorCanvas.style.height=this.imageHeight+2*this.CANVAS_MARGIN+"px",Dt.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},Q.prototype.resize=function(C,L){this.imageWidth=Math.round(C),this.imageHeight=Math.round(L),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},Q.prototype.setEditingTarget=function(){var C=document.createElement("canvas");C.width=this.target.naturalWidth,C.height=this.target.naturalHeight,C.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var L=C.toDataURL();Dt.setAttributes(this.editingTarget,[["href",L]]),this.setEditingTargetSize()},Q.prototype.setTopLeft=function(){var C=this.target.getBoundingClientRect(),L=this.editorCanvas.getBoundingClientRect();this.left=C.left-L.left-this.CANVAS_MARGIN,this.top=C.top-L.top-this.CANVAS_MARGIN},Q.prototype.initCropCanvas=function(){this.cropImageHolder=document.createElement("div"),this.cropImageHolder.style.setProperty("touch-action","none"),this.cropImageHolder.style.setProperty("-ms-touch-action","none"),this.cropImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.cropImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImage.style.pointerEvents="auto",this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.cropImageHolder.style.transformOrigin="top left",this.positionCropImage(),this.defs=Dt.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=Dt.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=Dt.createGroup(),this.editingTargetRotationScaleContainer=Dt.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var C=Dt.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(C);var L=Dt.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(L),this.editingTargetContainer=Dt.createGroup(),this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px)",this.editingTargetContainer.appendChild(this.editingTargetRotationContainer),this.cropImage.appendChild(this.editingTargetContainer),this.cropImageHolder.appendChild(this.cropImage),this.editorCanvas.appendChild(this.cropImageHolder)},Q.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},Q.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=Dt.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new ue(this.imageWidth,this.imageHeight,this.CANVAS_MARGIN,this.cropLayerContainer),this.cropLayer.onCropChange=this.cropRectChanged,this.cropLayer.numberOfGridLines=this.gridLines,this.cropLayer.isGridVisible=this.isGridVisible,this.cropLayer.cropShadeColor=this.styles.settings.cropShadeColor,this.cropLayer.cropFrameColor=this.styles.settings.cropFrameColor,this.cropLayer.gripColor=this.styles.settings.gripColor,this.cropLayer.gripFillColor=this.styles.settings.gripFillColor,this.cropLayer.open(),this.cropLayer.setCropRectangle(this.cropRect),this.zoomToCropEnabled&&this.zoomToCrop()},Q.prototype.zoomToCrop=function(){if(this.cropRect){var C=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,L=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=C+"px "+L+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-C+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-L+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},Q.prototype.unzoomFromCrop=function(){this.zoomFactor=1,this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin="center",this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px) scale(1)",this.cropLayer.zoomFactor=this.zoomFactor)},Q.prototype.cropRectChanged=function(C){this.cropRect=C,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},Q.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},Q.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},Q.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},Q.prototype.showUI=function(){switch(this.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var C=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,L=this.target.offsetTop>C+this.CANVAS_MARGIN?this.target.offsetTop-(C+this.CANVAS_MARGIN):0;this.coverDiv.style.top=L+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},Q.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},Q.prototype.addTopToolbar=function(){var C=this;this.topToolbar=new bi,this.topToolbar.display=this.styles.settings.hideTopToolbar?"none":"",this.topToolbar.className=this.toolbarStyleClass.name,this.topToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.topToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.topToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.topToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.topToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.topToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var L=new Fi;L.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(L);var z=[];this.aspectRatios.forEach(function(tn){var Vn=new ai(Ft.getIcon(tn.horizontal,tn.vertical),tn.horizontal===0&&tn.vertical===0?"FREE":tn.horizontal+":"+tn.vertical);Vn.onClick=function(){return C.ratioButtonClicked(tn)},z.push(Vn)}),this.aspectRatioButton=new Bt(Ft.getIcon(0,0),"Aspect ratio",z),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,L.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var oe=new ai('<svg viewBox="0 0 24 24"><path d="M10 4v4h4V4h-4m6 0v4h4V4h-4m0 6v4h4v-4h-4m0 6v4h4v-4h-4m-2 4v-4h-4v4h4m-6 0v-4H4v4h4m0-6v-4H4v4h4m0-6V4H4v4h4m2 6h4v-4h-4v4M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4c-1.08 0-2-.9-2-2V4a2 2 0 012-2z"/></svg>',"Toggle grid");oe.isActive=this.isGridVisible,oe.onClick=function(){C.isGridVisible=!C.isGridVisible,oe.isActive=C.isGridVisible},L.addButton(oe);var q=new ai('<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"Zoom to selection");if(q.isActive=this.zoomToCropEnabled,q.onClick=function(){C.zoomToCropEnabled=!C.zoomToCropEnabled,q.isActive=C.zoomToCropEnabled},L.addButton(q),!Ln.isLicensed){var ke=new pt;this.topToolbar.addElementBlock(ke);var ft=document.createElement("div");ft.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var kt=document.createElement("a");kt.style.color="currentColor",kt.href="https://markerjs.com/products/cropro",kt.target="_blank",kt.innerHTML='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M16.326 14.895c0 1.126-.558 1.688-1.673 1.688H9.931c-1.116 0-1.674-.562-1.674-1.688V3.733c0-1.126.558-1.688 1.674-1.688h4.722c1.115 0 1.673.562 1.673 1.688v2.899h-1.957V3.793h-4.124v11.042h4.124v-3.242h1.957v3.302z" fill="currentColor"/><path d="M15.94 7.364a.783.783 0 00-1.065-.304l-11.01 6.126a.783.783 0 00-.303 1.065l4.498 8.085a.783.783 0 001.065.304l11.01-6.126a.783.783 0 00.303-1.065L15.94 7.364zM5.311 14.173l3.737 6.718 9.641-5.364-3.737-6.718-9.641 5.364z" fill="#eef762"/></svg>',ft.appendChild(kt),ke.addElement(ft)}var an=new Fi;an.minWidth=3*this.toolbarHeight+"px",an.contentAlign="end",this.topToolbar.addButtonBlock(an);var dt=new ai('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");dt.onClick=this.startRenderAndClose,an.addButton(dt),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(dt.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Pt=new ai('<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"Close");Pt.onClick=this.close,an.addButton(Pt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Pt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},Q.prototype.addBottomToolbar=function(){var C=this;this.bottomToolbar=new bi,this.bottomToolbar.display=this.styles.settings.hideBottomToolbar?"none":"",this.bottomToolbar.className=this.toolbarStyleClass.name,this.bottomToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.bottomToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.bottomToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.bottomToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.bottomToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.bottomToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var L=new Fi;L.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(L);var z=new ai('<svg viewBox="0 0 24 24"><path d="M13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93M7.1 18.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.02-4.47L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47z"/></svg>',"Rotate left");z.onClick=this.rotateLeftButtonClicked,L.addButton(z);var oe=new ai('<svg viewBox="0 0 24 24"><path d="M16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.906 7.906 0 00-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45z"/></svg>',"Rotate right");oe.onClick=this.rotateRightButtonClicked,L.addButton(oe);var q=new pt;q.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(q),this.straightener=new si("Straighten"),this.straightener.className=this.toolbarStraightenerStyleClass.name,this.straightener.colorsClassName=this.styles.settings.toolbarStraightenerColorsClassName?this.styles.settings.toolbarStraightenerColorsClassName:this.toolbarStraightenerStyleColorsClass.name,this.straightener.onAngleChange=function(an){C.rotateBy(an),C.straightener.angle=C.rotationAngle},q.addElement(this.straightener.getUI());var ke=new Fi;ke.minWidth=2*this.toolbarHeight+"px",ke.contentAlign="end",this.bottomToolbar.addButtonBlock(ke);var ft=new ai('<svg viewBox="0 0 24 24"><path d="M15 21h2v-2h-2m4-10h2V7h-2M3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2m16-2v2h2c0-1.1-.9-2-2-2m-8 20h2V1h-2m8 16h2v-2h-2M15 5h2V3h-2m4 10h2v-2h-2m0 10c1.1 0 2-.9 2-2h-2z"/></svg>',"Flip horizontal");ft.onClick=this.flipHorizontallyButtonClicked,ke.addButton(ft);var kt=new ai('<svg viewBox="0 0 24 24"><path d="M3 15v2h2v-2m10 4v2h2v-2m2-16H5c-1.1 0-2 .9-2 2v4h2V5h14v4h2V5c0-1.1-.9-2-2-2m2 16h-2v2c1.1 0 2-.9 2-2M1 11v2h22v-2M7 19v2h2v-2m10-4v2h2v-2m-10 4v2h2v-2M3 19c0 1.1.9 2 2 2v-2z"/></svg>',"Flip vertical");kt.onClick=this.flipVerticallyButtonClicked,ke.addButton(kt)},Q.prototype.ratioButtonClicked=function(C){this.aspectRatio=C,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},Q.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Ft.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},Q.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Je(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},Q.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},Q.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},Q.prototype.restoreState=function(C){if(C){var L=this.cropLayer.getRescaledRect(C.width,C.height,this.imageWidth,this.imageHeight,C.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(L),this.cropRectChanged(L),this.flippedHorizontally=C.flippedHorizontally,this.flippedVertically=C.flippedVertically,this.applyFlip(),this.rotationAngle=C.rotationAngle,this.applyRotation()}},Q.prototype.clientToLocalCoordinates=function(C,L){var z=this.cropImage.getBoundingClientRect();return{x:C-z.left,y:L-z.top}},Q.prototype.onWindowResize=function(){this.positionUI()},Q.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var C=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=C+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},Q.prototype.rotateLeftButtonClicked=function(){var C=this.rotationAngle-90;this.rotationAngle%90!=0&&(C+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(C)},Q.prototype.rotateRightButtonClicked=function(){var C=this.rotationAngle+90;this.rotationAngle%90!=0&&(C-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(C)},Q.prototype.rotateTo=function(C){C=(C=C>180?C-360:C)<=-180?C+360:C,this.rotationAngle=C,this.applyRotation()},Q.prototype.rotateBy=function(C){this.rotateTo((this.rotationAngle+C)%360)},Q.prototype.applyRotation=function(){var C=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var L=this.editingTargetRotationContainer.transform.baseVal.getItem(0);L.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(L,0);var z=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/z.width,this.imageHeight/z.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=C},Q.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},Q.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},Q.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},Q.prototype.startRenderAndClose=function(){return Dn(this,void 0,void 0,function(){var C,L;return Ai(this,function(z){switch(z.label){case 0:return[4,this.render()];case 1:return C=z.sent(),L=this.getState(),this.renderEventListeners.forEach(function(oe){return oe(C,L)}),this.close(!0),[2]}})})},Q.prototype.render=function(){return Dn(this,void 0,void 0,function(){var C;return Ai(this,function(L){switch(L.label){case 0:return(C=new je).naturalSize=this.renderAtNaturalSize,C.imageType=this.renderImageType,C.imageQuality=this.renderImageQuality,C.width=this.renderWidth,C.height=this.renderHeight,this.unzoomFromCrop(),Dt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,C.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return L.sent(),[4,C.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,L.sent()]}})})},Q.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new hi("toolbar",`
|
|
width: `+(this.displayMode==="inline"?"100%":"calc(100vw - "+2*this.popupMargin+"px)")+`;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
height: `+this.toolbarHeight+`px;
|
|
box-sizing: content-box;
|
|
overflow: hidden;
|
|
line-height: 0px;
|
|
`)),this.toolbarStyleColorsClass=this.styles.addClass(new hi("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new hi("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var C=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new hi("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*C)+`px;
|
|
height: `+(this.toolbarHeight-2*C)+`px;
|
|
padding: `+C+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new hi("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new hi("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new vi("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new vi("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new hi("toolbar_dropdown",`
|
|
position: absolute;
|
|
max-width: `+4*this.toolbarHeight+`px;
|
|
z-index: 20;
|
|
white-space: normal;
|
|
box-sizing: content-box;
|
|
box-shadow: 3px 3px rgba(33, 33, 33, 0.1);
|
|
margin: `+(this.displayMode==="inline"?"0":this.popupMargin)+`px;
|
|
line-height: 0px;
|
|
`)),this.toolbarDropdownStyleColorsClass=this.styles.addClass(new hi("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new hi("toolbar_straightener_block",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
-webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 30%, rgba(0,0,0,1) 70%, rgba(0,0,0,0) 100%);
|
|
`)),this.toolbarStraightenerStyleClass=this.styles.addClass(new hi("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*C)+`px;
|
|
padding: `+C+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new hi("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},Q.instanceCounter=0,Q}(),Ie=V("8hTe"),_e=V.n(Ie),An=/<pre[^>]*>/g;function zn(Q){var C=document.createElement("div");return C.innerHTML=Q,C.childNodes.length===0?"":C.childNodes[0].nodeValue}var Pn=st.a=function(Q){var C=Q.value,L=C===void 0?"":C,z=Q.edit,oe=z===void 0?!1:z,q=Q.className,ke=Q.showTextOnly,ft=Q.showLines,kt=Q.replaces,an=Q.zoomImg,dt=Q.hasMask,Pt=Q.style,tn=Pt===void 0?{}:Pt,Vn=Q.stylesPrev,fi=Vn===void 0?{}:Vn,Hn=String(L),Fn=Object(D.useRef)(),Qt=Object(D.useRef)(),hn=Object(D.useState)(""),on=Object(Y.a)(hn,2),Nt=on[0],$n=on[1],jn=Object(D.useState)("office"),Tn=Object(Y.a)(jn,2),qn=Tn[0],En=Tn[1],In=function(){var It=new Be(Qt.current);It.displayMode="popup",It.addRenderEventListener(function(){var Ot=Object(M.a)(k.a.mark(function Vt(Zt){var Gt;return k.a.wrap(function(vn){for(;;)switch(vn.prev=vn.next){case 0:return Fn.current.style.display="none",vn.next=3,Object(pe.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Zt}});case 3:Gt=vn.sent,Gt!=null&&Gt.id&&kt(Qt.current.getAttribute("src").replace($.a.API_SERVER,""),"/api/attachments/".concat(Gt==null?void 0:Gt.id,"?type=").concat(Gt.content_type));case 5:case"end":return vn.stop()}},Vt)}));return function(Vt){return Ot.apply(this,arguments)}}()),It.show()},gn=function(){var It=new gi(Qt.current);It.settings.displayMode="popup",It.addEventListener("render",function(){var Ot=Object(M.a)(k.a.mark(function Vt(Zt){var Gt;return k.a.wrap(function(vn){for(;;)switch(vn.prev=vn.next){case 0:if(Fn.current.style.display="none",!Qt.current){vn.next=6;break}return vn.next=4,Object(pe.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Zt.dataUrl}});case 4:Gt=vn.sent,Gt!=null&&Gt.id&&kt(Qt.current.getAttribute("src").replace($.a.API_SERVER,""),"/api/attachments/".concat(Gt==null?void 0:Gt.id,"?type=").concat(Gt.content_type));case 6:case"end":return vn.stop()}},Vt)}));return function(Vt){return Ot.apply(this,arguments)}}()),It.show(),window.markerArea=It},Bn=Object(D.useMemo)(function(){Fn.current&&(Fn.current.style.zIndex=-1);try{var yt=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,It=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Ot=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Hn=Hn.replace(yt,"("+$.a.API_SERVER+"/api/attachments/").replace(It,'"'+$.a.API_SERVER+"/api/attachments/").replace(Ot,'"'+$.a.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(Ut){}var Vt=K(Hn),Zt=h();if(Hn.match(/\[TOC\]/)&&(Vt=Vt.replace("<p>[TOC]</p>",R()),A()),Vt=Vt.replace(/(__special_katext_id_\d+__)/g,function(Ut,vn){var _n=Zt[vn],un=_n.type,cn=_n.expression;return Object(ae.renderToString)(zn(cn)||"",{displayMode:un==="block",throwOnError:!1,output:"html"})}),Vt=Vt.replace(/▁/g,"\u2581\u2581\u2581"),g(),ke){var Gt=document.createElement("div");return Gt.innerHTML=Vt,Gt.innerText}return setTimeout(function(){return Kt()},500),Vt},[Hn]),Xn=Object(D.useRef)();S.WebkitLineClamp=ft,ft&&(tn=Object(H.a)(Object(H.a)({},tn),S));function Zn(yt){var It=yt.target;if(It.tagName.toUpperCase()==="IMG"){if(an){var Ot=It.getAttribute("src");$n(Ot),En("image")}}else if(It.tagName.toUpperCase()==="A"){var Vt=It.getAttribute("href");if(Vt.indexOf("office")>-1)yt.preventDefault(),$n(Vt),En("office");else if(Vt.indexOf("application/pdf")>-1)yt.preventDefault(),$n(Vt),En("pdf");else if(Vt.indexOf("text/html")>-1)yt.preventDefault(),$n(Vt),En("html");else if(Vt.startsWith("#")){yt.preventDefault();var Zt=document.getElementById(Vt.replace("#",""));Zt&&Zt.scrollIntoView(!0)}}}var Kt=function(){var It,Ot=(It=Xn.current)===null||It===void 0?void 0:It.querySelectorAll("video");Ot==null||Ot.forEach(function(Vt){if(Vt.oncontextmenu=function(){return!1},Vt.src.indexOf(".m3u8")>-1&&!Vt.canPlayType("application/vnd.apple.mpegurl")){if(j.a.isSupported()){var Zt=new j.a;Zt.loadSource(Vt.src),Zt.attachMedia(Vt)}}})};Object(D.useEffect)(function(){if(Xn.current&&Bn&&(Bn.match(An)&&window.PR.prettyPrint()),Xn.current)return Xn.current.addEventListener("click",Zn),function(){Xn.current.removeEventListener("click",Zn),g(),A()}},[Bn,Xn.current,Zn]);var Lt=function(It){if(!oe)return;It.target.nodeName==="IMG"?(Fn.current.style.zIndex=1,Fn.current.style.display="flex",Fn.current.style.width=It.target.clientWidth+"px",Fn.current.style.height=It.target.clientHeight+"px",Fn.current.style.top=It.target.offsetTop+"px",Fn.current.style.left=It.target.offsetLeft+"px",Qt.current.src=It.target.getAttribute("src")):Fn.current.style.display="none"};return v.a.createElement("div",{style:{position:"relative"}},v.a.createElement("div",{ref:Xn,style:Object(H.a)({},tn),className:"".concat(q||""," markdown-body ").concat(_e.a.mdBody),onMouseOver:Lt,dangerouslySetInnerHTML:{__html:Bn}}),v.a.createElement("div",{ref:Fn,className:_e.a.button},v.a.createElement(Z.a,null,v.a.createElement(ee.a,{onClick:function(){return In()}},"\u88C1\u526A"),v.a.createElement(ee.a,{onClick:function(){return gn()}},"\u7F16\u8F91"))),v.a.createElement("img",{ref:Qt,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),v.a.createElement(fe.a,{close:!0,data:Nt,type:Nt!=null&&Nt.length?qn:"",style:Object(H.a)({},fi),onClose:function(){return $n("")}}))}},"9VGf":function(zt,st,V){"use strict";V.d(st,"a",function(){return U});var ie=V("q1tI"),Z=V.n(ie);function U(ee,H){var M=Object(ie.useRef)();Object(ie.useEffect)(function(){M.current=ee}),Object(ie.useEffect)(function(){function Y(){M.current()}if(H!==null){var X=setInterval(Y,H);return function(){return clearInterval(X)}}},[H])}},"9z17":function(zt,st,V){"use strict";V.d(st,"b",function(){return w});var ie=V("g9YV"),Z=V("wCAj"),U=V("5NDa"),ee=V("5rEg"),H=V("y8nQ"),M=V("Vl3Y"),Y=V("2qtc"),X=V("kLXV"),k=V("7Kak"),D=V("9yH6"),v=V("9og8"),_=V("tJVT"),p=V("WmNS"),o=V.n(p),u=V("q1tI"),r=V.n(u),i=V("ie49"),t=V.n(i),c=V("HBuW"),f=function(y){var d=y.total,l=y.used,h=y.copy,g=y.canNotCopy,b=y.inPaper,F="";return h>0&&g>0?F="\u5176\u4E2D\u6709".concat(h,"\u4E2A\u5B9E\u8BAD\u53EF\u4EE5\u590D\u5236\uFF0C\u6709").concat(g,"\u4E2A\u5B9E\u8BAD\u672A\u5F00\u653E\u590D\u5236"):h>0&&g===0?F="\u5176\u4E2D\u6709".concat(h,"\u4E2A\u5B9E\u8BAD\u53EF\u4EE5\u590D\u5236"):h===0&&g>0&&(F="\u5176\u4E2D\u6709".concat(g,"\u4E2A\u5B9E\u8BAD\u672A\u5F00\u653E\u590D\u5236")),"\u5F53\u524D\u9009\u4E2D".concat(d,"\u4E2A\u5B9E\u8BAD\u4E2D\uFF0C\u6709").concat(l,"\u4E2A\u5B9E\u8BAD\u5DF2\u5728\u8BFE\u5802\u4E2D\u4F7F\u7528\uFF0C").concat(F).concat(b?"\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u4F7F\u7528\u8BD5\u5377\uFF1F":"")},A=function(y){return y?{reproducible:"\u8BD5\u5377\u4E2D\u4E0B\u5217\u5B9E\u8BAD\u5DF2\u5728\u6559\u5B66\u8BFE\u5802\u4E2D\u4F7F\u7528\uFF0C\u8BF7\u9009\u62E9\u662F\u5426\u590D\u5236\u4E3A\u65B0\u7684\u5B9E\u8BAD\u53D1\u9001\u5230\u8BFE\u5802\uFF1F",irreproducible:"\u8BD5\u5377\u4E2D\u4E0B\u5217\u91CD\u590D\u4F7F\u7528\u7684\u5B9E\u8BAD\u672A\u5F00\u542F\u590D\u5236\u6743\u9650\uFF0C\u82E5\u7EE7\u7EED\u4F7F\u7528\u4F1A\u5BFC\u81F4\u6210\u7EE9\u76F8\u4E92\u5F71\u54CD"}:{reproducible:"\u5F53\u524D\u5B9E\u8BAD\u5DF2\u5728\u6559\u5B66\u8BFE\u5802\u4E2D\u4F7F\u7528\uFF0C\u8BF7\u9009\u62E9\u662F\u5426\u7EE7\u7EED\u4F7F\u7528\u548C\u662F\u5426\u590D\u5236\u4E3A\u65B0\u7684\u5B9E\u8BAD\u53D1\u9001\u5230\u8BFE\u5802\uFF1F",irreproducible:"\u540C\u4E00\u5B9E\u8BAD\u5728\u4E00\u4E2A\u8BFE\u5802\u4E2D\u91CD\u590D\u4F7F\u7528\u65F6\uFF0C\u4F1A\u5BFC\u81F4\u6210\u7EE9\u76F8\u4E92\u5F71\u54CD\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u7EE7\u7EED\u4F7F\u7528\uFF1F"}},S=function(y){var d=y.onCancel,l=y.onOk,h=y.visible,g=y.inPaper,b=y.renderData,F=y.type,N=Object(u.useState)(1),W=Object(_.a)(N,2),K=W[0],I=W[1],x=Object(u.useState)(!1),j=Object(_.a)(x,2),$=j[0],ae=j[1],fe=Object(u.useMemo)(function(){return(b==null?void 0:b.total_num)===1&&(b==null?void 0:b.can_copy_num)===1},[b]);return r.a.createElement(r.a.Fragment,null,fe?r.a.createElement(X.a,{centered:!0,closable:!0,visible:h,title:"\u63D0\u793A",width:600,confirmLoading:$,onCancel:d,onOk:Object(v.a)(o.a.mark(function pe(){return o.a.wrap(function(De){for(;;)switch(De.prev=De.next){case 0:return ae(!0),De.next=3,l(K);case 3:ae(!1);case 4:case"end":return De.stop()}},pe)}))},r.a.createElement("div",{className:t.a.content,style:{marginBottom:20}},"\u5F53\u524D\u5B9E\u8BAD\u5DF2\u5728\u6559\u5B66\u8BFE\u5802\u4E2D\u4F7F\u7528\uFF0C\u8BF7\u95EE\u662F\u5426\u590D\u5236\u6210\u65B0\u5B9E\u8BAD\u53D1\u9001\u81F3\u6559\u5B66\u8BFE\u5802\u4E2D\uFF1F"),r.a.createElement(D.a.Group,{value:K,onChange:function(Ce){return I(Ce.target.value)},className:t.a.content,style:{marginBottom:30}},r.a.createElement(D.a,{value:1,style:{color:"#464f66"}},"\u590D\u5236\u5B9E\u8BAD"),r.a.createElement(D.a,{value:0,style:{color:"#464f66"}},"\u4E0D\u590D\u5236\u5B9E\u8BAD")),r.a.createElement("div",{className:t.a.content,style:{marginBottom:10}},"\u8BF4\u660E\uFF1A"),r.a.createElement("div",{className:t.a.content},"\u590D\u5236\u5B9E\u8BAD\uFF1A\u590D\u5236\u4E00\u4EFD\u65B0\u7684\u5B9E\u8BAD\u8FDB\u5165\u8BFE\u5802\uFF0C\u539F\u5B9E\u8BAD\u7684\u8C03\u6574\u4E0D\u4F1A\u5F71\u54CD\u5230\u590D\u5236\u7684\u5B9E\u8BAD\u4E2D\u3002"),r.a.createElement("div",{className:t.a.content},"\u4E0D\u590D\u5236\u5B9E\u8BAD\uFF1A\u540C\u4E00\u5B9E\u8BAD\u5728\u4E00\u4E2A\u8BFE\u5802\u4E2D\u91CD\u590D\u4F7F\u7528\u65F6\uFF0C\u4F1A\u5BFC\u81F4\u6210\u7EE9\u76F8\u4E92\u5F71\u54CD\u3002")):r.a.createElement(X.a,{centered:!0,closable:!0,visible:h,title:"\u63D0\u793A",width:600,onCancel:d,onOk:Object(v.a)(o.a.mark(function pe(){return o.a.wrap(function(De){for(;;)switch(De.prev=De.next){case 0:return ae(!0),De.next=3,l(0);case 3:ae(!1);case 4:case"end":return De.stop()}},pe)}))},r.a.createElement("div",{className:t.a.content},"\u5F53\u524D\u5B9E\u8BAD\u5DF2\u5728\u6559\u5B66\u8BFE\u5802\u4E2D\u4F7F\u7528\uFF0C\u540C\u4E00\u5B9E\u8BAD\u5728\u4E00\u4E2A\u8BFE\u5802\u4E2D\u91CD\u590D\u4F7F\u7528\u65F6\uFF0C\u4F1A\u5BFC\u81F4\u6210\u7EE9\u76F8\u4E92\u5F71\u54CD\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u7EE7\u7EED\u4F7F\u7528\uFF1F")))},w=function(){var y=Object(u.useState)(!1),d=Object(_.a)(y,2),l=d[0],h=d[1],g=Object(u.useState)(),b=Object(_.a)(g,2),F=b[0],N=b[1],W=function(){return h(!1)},K=function(){var I=Object(v.a)(o.a.mark(function x(j){var $;return o.a.wrap(function(fe){for(;;)switch(fe.prev=fe.next){case 0:return fe.next=2,Object(c.p)(j);case 2:if($=fe.sent,!("status"in $)){fe.next=5;break}return fe.abrupt("return",!1);case 5:if(!($.repeat_shixun_num===0)){fe.next=7;break}return fe.abrupt("return",!1);case 7:return N($),h(!0),fe.abrupt("return",!0);case 10:case"end":return fe.stop()}},x)}));return function(j){return I.apply(this,arguments)}}();return[l,W,F,K]},R=function(y){var d=M.a.useForm(),l=Object(_.a)(d,1),h=l[0],g=Object(u.useState)(!1),b=Object(_.a)(g,2),F=b[0],N=b[1],W=y.onCancel,K=y.onOk,I=y.visible,x=y.inPaper,j=x===void 0?!1:x,$=y.renderData,ae=y.type,fe=Object(u.useMemo)(function(){return j?[{title:"\u5B9E\u8BAD\u540D\u79F0",dataIndex:"name",width:424,align:"center",className:t.a.tableCell},{title:"\u662F\u5426\u590D\u5236",dataIndex:"is_copy",align:"center",render:function(Oe,Ee){return r.a.createElement(r.a.Fragment,null,r.a.createElement(M.a.Item,{name:["".concat(ae==="subject"?Ee.stage_shixun_id:Ee.id),"is_copy"],initialValue:1},r.a.createElement(D.a.Group,null,r.a.createElement(D.a,{value:1},"\u662F"),r.a.createElement(D.a,{value:0},"\u5426"))),r.a.createElement(M.a.Item,{name:["".concat(ae==="subject"?Ee==null?void 0:Ee.stage_shixun_id:Ee.id),"is_use"],hidden:!0,initialValue:1},r.a.createElement(ee.a,{type:"hidden"})))}}]:[{title:"\u5B9E\u8BAD\u540D\u79F0",dataIndex:"name",width:424,align:"center",className:t.a.tableCell},{title:"\u662F\u5426\u4F7F\u7528",dataIndex:"is_use",align:"center",render:function(Oe,Ee){return r.a.createElement(M.a.Item,{name:["".concat(ae==="subject"?Ee.stage_shixun_id:Ee.id),"is_use"],initialValue:1},r.a.createElement(D.a.Group,null,r.a.createElement(D.a,{value:1},"\u662F"),r.a.createElement(D.a,{value:0},"\u5426")))}},{title:"\u662F\u5426\u590D\u5236",dataIndex:"is_copy",align:"center",render:function(Oe,Ee){return r.a.createElement(M.a.Item,{name:["".concat(ae==="subject"?Ee.stage_shixun_id:Ee.id),"is_copy"],initialValue:1},r.a.createElement(D.a.Group,null,r.a.createElement(D.a,{value:1},"\u662F"),r.a.createElement(D.a,{value:0},"\u5426")))}}]},[j]),pe=Object(u.useMemo)(function(){return j?[{title:"\u5B9E\u8BAD\u540D\u79F0",dataIndex:"name",width:424,className:t.a.tableCell,align:"center",render:function(Oe,Ee){return r.a.createElement(r.a.Fragment,null,r.a.createElement("span",null,Oe),r.a.createElement(M.a.Item,{name:["".concat(ae==="subject"?Ee==null?void 0:Ee.stage_shixun_id:Ee.id),"is_copy"],hidden:!0,initialValue:0},r.a.createElement(ee.a,{type:"hidden"})),r.a.createElement(M.a.Item,{name:["".concat(ae==="subject"?Ee==null?void 0:Ee.stage_shixun_id:Ee.id),"is_use"],hidden:!0,initialValue:1},r.a.createElement(ee.a,{type:"hidden"})))}}]:[{title:"\u5B9E\u8BAD\u540D\u79F0",dataIndex:"name",width:424,className:t.a.tableCell,align:"center"},{title:"\u662F\u5426\u4F7F\u7528",dataIndex:"is_use",align:"center",render:function(Oe,Ee){return r.a.createElement(r.a.Fragment,null,r.a.createElement(M.a.Item,{name:["".concat(ae==="subject"?Ee==null?void 0:Ee.stage_shixun_id:Ee.id),"is_use"],initialValue:0},r.a.createElement(D.a.Group,null,r.a.createElement(D.a,{value:1},"\u662F"),r.a.createElement(D.a,{value:0},"\u5426"))),r.a.createElement(M.a.Item,{name:["".concat(ae==="subject"?Ee==null?void 0:Ee.stage_shixun_id:Ee.id),"is_copy"],hidden:!0,initialValue:0},r.a.createElement(ee.a,{type:"hidden"})))}}]},[j]),Ce=Object(u.useMemo)(function(){return f({total:$==null?void 0:$.total_num,used:$==null?void 0:$.repeat_shixun_num,copy:$==null?void 0:$.can_copy_num,canNotCopy:$==null?void 0:$.no_copy_num,inPaper:j})},[$,j]),De=Object(u.useMemo)(function(){return A(j)},[j]);return r.a.createElement(X.a,{title:"\u5B9E\u8BAD\u91CD\u590D\u4F7F\u7528\u63D0\u793A",centered:!0,visible:I,confirmLoading:F,onOk:Object(v.a)(o.a.mark(function xe(){var Oe,Ee;return o.a.wrap(function(te){for(;;)switch(te.prev=te.next){case 0:return N(!0),Oe=h.getFieldsValue(),Ee=Object.keys(Oe).map(function(me){return{id:parseInt(me),is_use:Oe[me].is_use,is_copy:Oe[me].is_copy}}),te.next=5,K(Ee);case 5:N(!1);case 6:case"end":return te.stop()}},xe)})),onCancel:W,width:800,okText:"\u786E\u8BA4",className:t.a.antdModal,destroyOnClose:!0},r.a.createElement(M.a,{form:h,preserve:!1},r.a.createElement("div",{className:t.a.brief},Ce),($==null?void 0:$.can_copy_num)>0&&r.a.createElement("div",null,r.a.createElement("div",{className:t.a.contentTitle},"\u53EF\u590D\u5236\u5B9E\u8BAD"),r.a.createElement("div",{className:t.a.content},De.reproducible),r.a.createElement("div",{className:t.a.tips},r.a.createElement("div",null,"\u590D\u5236\u5B9E\u8BAD\uFF1A\u590D\u5236\u4E00\u4EFD\u65B0\u7684\u5B9E\u8BAD\u8FDB\u5165\u8BFE\u5802\uFF0C\u539F\u5B9E\u8BAD\u7684\u8C03\u6574\u4E0D\u4F1A\u5F71\u54CD\u5230\u590D\u5236\u7684\u5B9E\u8BAD\u4E2D\u3002"),r.a.createElement("div",null,"\u4E0D\u590D\u5236\u5B9E\u8BAD\uFF1A\u540C\u4E00\u5B9E\u8BAD\u5728\u4E00\u4E2A\u8BFE\u5802\u4E2D\u91CD\u590D\u4F7F\u7528\u65F6\uFF0C\u4F1A\u5BFC\u81F4\u6210\u7EE9\u76F8\u4E92\u5F71\u54CD\u3002")),r.a.createElement(Z.a,{columns:fe,className:t.a.antdTable,dataSource:$==null?void 0:$.can_copy_list,rowKey:ae==="subject"?"stage_shixun_id":"id",pagination:!1,scroll:{y:240},bordered:!0})),($==null?void 0:$.no_copy_num)>0&&r.a.createElement("div",null,r.a.createElement("div",{className:t.a.contentTitle},"\u4E0D\u53EF\u590D\u5236\u5B9E\u8BAD"),r.a.createElement("div",{className:t.a.content},De.irreproducible),r.a.createElement(Z.a,{columns:pe,className:t.a.antdTable,dataSource:$==null?void 0:$.no_copy_list,rowKey:ae==="subject"?"stage_shixun_id":"id",pagination:!1,scroll:{y:200},bordered:!0})),($==null?void 0:$.no_use_list.length)>0&&($==null?void 0:$.no_use_list.map(function(xe){return r.a.createElement("div",{key:ae==="subject"?xe.stage_shixun_id:xe.id},r.a.createElement(M.a.Item,{name:["".concat(ae==="subject"?xe==null?void 0:xe.stage_shixun_id:xe.id),"is_copy"],hidden:!0,initialValue:0},r.a.createElement(ee.a,{type:"hidden"})),r.a.createElement(M.a.Item,{name:["".concat(ae==="subject"?xe==null?void 0:xe.stage_shixun_id:xe.id),"is_use"],hidden:!0,initialValue:1},r.a.createElement(ee.a,{type:"hidden"})))}))))},O=function(y){var d=y.modalType;return d==="multiple"?r.a.createElement(R,y):r.a.createElement(S,y)};st.a=O},BU3w:function(zt,st,V){"use strict";V.d(st,"a",function(){return M});var ie=V("MNnm"),Z="rc-util-key";function U(Y){if(Y.attachTo)return Y.attachTo;var X=document.querySelector("head");return X||document.body}function ee(Y){var X,k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ie.a)())return null;var D=document.createElement("style");if((X=k.csp)===null||X===void 0?void 0:X.nonce){var v;D.nonce=(v=k.csp)===null||v===void 0?void 0:v.nonce}D.innerHTML=Y;var _=U(k),p=_.firstChild;return k.prepend&&_.prepend?_.prepend(D):k.prepend&&p?_.insertBefore(D,p):_.appendChild(D),D}var H=new Map;function M(Y,X){var k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},D=U(k);if(!H.has(D)){var v=ee("",k),_=v.parentNode;H.set(D,_),_.removeChild(v)}var p=Array.from(H.get(D).children).find(function(t){return t.tagName==="STYLE"&&t[Z]===X});if(p){var o,u;if(((o=k.csp)===null||o===void 0?void 0:o.nonce)&&p.nonce!==((u=k.csp)===null||u===void 0?void 0:u.nonce)){var r;p.nonce=(r=k.csp)===null||r===void 0?void 0:r.nonce}return p.innerHTML!==Y&&(p.innerHTML=Y),p}var i=ee(Y,k);return i[Z]=X,i}},Bd2K:function(zt,st,V){(function(ie){ie(V("VrN/"),V("osHv"))})(function(ie){ie.defineOption("autoCloseTags",!1,function(k,D,v){if(v!=ie.Init&&v&&k.removeKeyMap("autoCloseTags"),!D)return;var _={name:"autoCloseTags"};(typeof D!="object"||D.whenClosing!==!1)&&(_["'/'"]=function(p){return M(p)}),(typeof D!="object"||D.whenOpening!==!1)&&(_["'>'"]=function(p){return ee(p)}),k.addKeyMap(_)});var Z=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],U=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function ee(k){if(k.getOption("disableInput"))return ie.Pass;for(var D=k.listSelections(),v=[],_=k.getOption("autoCloseTags"),p=0;p<D.length;p++){if(!D[p].empty())return ie.Pass;var o=D[p].head,u=k.getTokenAt(o),r=ie.innerMode(k.getMode(),u.state),i=r.state,t=r.mode.xmlCurrentTag&&r.mode.xmlCurrentTag(i),c=t&&t.name;if(!c)return ie.Pass;var f=r.mode.configuration=="html",A=typeof _=="object"&&_.dontCloseTags||f&&Z,S=typeof _=="object"&&_.indentTags||f&&U;u.end>o.ch&&(c=c.slice(0,c.length-u.end+o.ch));var w=c.toLowerCase();if(!c||u.type=="string"&&(u.end!=o.ch||!/[\"\']/.test(u.string.charAt(u.string.length-1))||u.string.length==1)||u.type=="tag"&&t.close||u.string.indexOf("/")==o.ch-u.start-1||A&&Y(A,w)>-1||X(k,r.mode.xmlCurrentContext&&r.mode.xmlCurrentContext(i)||[],c,o,!0))return ie.Pass;var R=typeof _=="object"&&_.emptyTags;if(R&&Y(R,c)>-1){v[p]={text:"/>",newPos:ie.Pos(o.line,o.ch+2)};continue}var O=S&&Y(S,w)>-1;v[p]={indent:O,text:">"+(O?`
|
|
|
|
`:"")+"</"+c+">",newPos:O?ie.Pos(o.line+1,0):ie.Pos(o.line,o.ch+1)}}for(var E=typeof _=="object"&&_.dontIndentOnAutoClose,p=D.length-1;p>=0;p--){var y=v[p];k.replaceRange(y.text,D[p].head,D[p].anchor,"+insert");var d=k.listSelections().slice(0);d[p]={head:y.newPos,anchor:y.newPos},k.setSelections(d),!E&&y.indent&&(k.indentLine(y.newPos.line,null,!0),k.indentLine(y.newPos.line+1,null,!0))}}function H(k,D){for(var v=k.listSelections(),_=[],p=D?"/":"</",o=k.getOption("autoCloseTags"),u=typeof o=="object"&&o.dontIndentOnSlash,r=0;r<v.length;r++){if(!v[r].empty())return ie.Pass;var i=v[r].head,t=k.getTokenAt(i),c=ie.innerMode(k.getMode(),t.state),f=c.state;if(D&&(t.type=="string"||t.string.charAt(0)!="<"||t.start!=i.ch-1))return ie.Pass;var A,S=c.mode.name!="xml"&&k.getMode().name=="htmlmixed";if(S&&c.mode.name=="javascript")A=p+"script";else if(S&&c.mode.name=="css")A=p+"style";else{var w=c.mode.xmlCurrentContext&&c.mode.xmlCurrentContext(f);if(!w||w.length&&X(k,w,w[w.length-1],i))return ie.Pass;A=p+w[w.length-1]}k.getLine(i.line).charAt(t.end)!=">"&&(A+=">"),_[r]=A}if(k.replaceSelections(_),v=k.listSelections(),!u)for(var r=0;r<v.length;r++)(r==v.length-1||v[r].head.line<v[r+1].head.line)&&k.indentLine(v[r].head.line)}function M(k){return k.getOption("disableInput")?ie.Pass:H(k,!0)}ie.commands.closeTag=function(k){return H(k)};function Y(k,D){if(k.indexOf)return k.indexOf(D);for(var v=0,_=k.length;v<_;++v)if(k[v]==D)return v;return-1}function X(k,D,v,_,p){if(!ie.scanForClosingTag)return!1;var o=Math.min(k.lastLine()+1,_.line+500),u=ie.scanForClosingTag(k,_,null,o);if(!u||u.tag!=v)return!1;for(var r=p?1:0,i=D.length-1;i>=0&&D[i]==v;i--)++r;_=u.to;for(var i=1;i<r;i++){var t=ie.scanForClosingTag(k,_,null,o);if(!t||t.tag!=v)return!1;_=t.to}return!0}})},BjJ7:function(zt,st,V){"use strict";V.d(st,"d",function(){return Z}),V.d(st,"c",function(){return U}),V.d(st,"e",function(){return ee}),V.d(st,"b",function(){return H}),V.d(st,"a",function(){return Y});var ie=V("m3rI");function Z(X){var k=!0;if(X.length>0){for(var D=0;D<X.length;D++)if(X[D].compile_success==0||!X[D].compile_success){k=!1;break}}else k=!1;return k}function U(X){for(var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",D=[],v=0;v<X.length;v++){var _=X[v],p=k?"".concat(k,"/").concat(_.name):"".concat(_.name);D.push({title:_.name,isLeaf:!(_.type==="tree"),key:p})}return D}function ee(X,k,D){for(var v=0;v<X.length;v++){var _=X[v];if(_.key===k){_.children=D;break}_.children&&ee(_.children,k,D)}return X}function H(X,k,D){var v;return function(){var _=this,p=arguments,o=function(){v=null,D||X.apply(_,p)},u=D&&!v;clearTimeout(v),v=setTimeout(o,k),u&&X.apply(_,p)}}var M=!0,Y=ie.a.API_SERVER},"C+DQ":function(zt,st,V){},DlQD:function(zt,st,V){(function(ie,Z){zt.exports=Z()})(this,function(){"use strict";function ie(Ue,Ae){for(var Re=0;Re<Ae.length;Re++){var le=Ae[Re];le.enumerable=le.enumerable||!1,le.configurable=!0,"value"in le&&(le.writable=!0),Object.defineProperty(Ue,le.key,le)}}function Z(Ue,Ae,Re){return Ae&&ie(Ue.prototype,Ae),Re&&ie(Ue,Re),Ue}function U(Ue,Ae){if(!Ue)return;if(typeof Ue=="string")return ee(Ue,Ae);var Re=Object.prototype.toString.call(Ue).slice(8,-1);if(Re==="Object"&&Ue.constructor&&(Re=Ue.constructor.name),Re==="Map"||Re==="Set")return Array.from(Ue);if(Re==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Re))return ee(Ue,Ae)}function ee(Ue,Ae){(Ae==null||Ae>Ue.length)&&(Ae=Ue.length);for(var Re=0,le=new Array(Ae);Re<Ae;Re++)le[Re]=Ue[Re];return le}function H(Ue,Ae){var Re;if(typeof Symbol=="undefined"||Ue[Symbol.iterator]==null){if(Array.isArray(Ue)||(Re=U(Ue))||Ae&&Ue&&typeof Ue.length=="number"){Re&&(Ue=Re);var le=0;return function(){return le>=Ue.length?{done:!0}:{done:!1,value:Ue[le++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return Re=Ue[Symbol.iterator](),Re.next.bind(Re)}function M(Ue,Ae){return Ae={exports:{}},Ue(Ae,Ae.exports),Ae.exports}var Y=M(function(Ue){function Ae(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function Re(le){Ue.exports.defaults=le}Ue.exports={defaults:Ae(),getDefaults:Ae,changeDefaults:Re}}),X=Y.defaults,k=Y.getDefaults,D=Y.changeDefaults,v=/[&<>"']/,_=/[&<>"']/g,p=/[<>"']|&(?!#?\w+;)/,o=/[<>"']|&(?!#?\w+;)/g,u={"&":"&","<":"<",">":">",'"':""","'":"'"},r=function(Ae){return u[Ae]};function i(Ue,Ae){if(Ae){if(v.test(Ue))return Ue.replace(_,r)}else if(p.test(Ue))return Ue.replace(o,r);return Ue}var t=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function c(Ue){return Ue.replace(t,function(Ae,Re){return Re=Re.toLowerCase(),Re==="colon"?":":Re.charAt(0)==="#"?Re.charAt(1)==="x"?String.fromCharCode(parseInt(Re.substring(2),16)):String.fromCharCode(+Re.substring(1)):""})}var f=/(^|[^\[])\^/g;function A(Ue,Ae){Ue=Ue.source||Ue,Ae=Ae||"";var Re={replace:function(he,Se){return Se=Se.source||Se,Se=Se.replace(f,"$1"),Ue=Ue.replace(he,Se),Re},getRegex:function(){return new RegExp(Ue,Ae)}};return Re}var S=/[^\w:]/g,w=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function R(Ue,Ae,Re){if(Ue){var le;try{le=decodeURIComponent(c(Re)).replace(S,"").toLowerCase()}catch(he){return null}if(le.indexOf("javascript:")===0||le.indexOf("vbscript:")===0||le.indexOf("data:")===0)return null}Ae&&!w.test(Re)&&(Re=l(Ae,Re));try{Re=encodeURI(Re).replace(/%25/g,"%")}catch(he){return null}return Re}var O={},E=/^[^:]+:\/*[^/]*$/,y=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function l(Ue,Ae){O[" "+Ue]||(E.test(Ue)?O[" "+Ue]=Ue+"/":O[" "+Ue]=F(Ue,"/",!0)),Ue=O[" "+Ue];var Re=Ue.indexOf(":")===-1;return Ae.substring(0,2)==="//"?Re?Ae:Ue.replace(y,"$1")+Ae:Ae.charAt(0)==="/"?Re?Ae:Ue.replace(d,"$1")+Ae:Ue+Ae}var h={exec:function(){}};function g(Ue){for(var Ae=1,Re,le;Ae<arguments.length;Ae++){Re=arguments[Ae];for(le in Re)Object.prototype.hasOwnProperty.call(Re,le)&&(Ue[le]=Re[le])}return Ue}function b(Ue,Ae){var Re=Ue.replace(/\|/g,function(Se,ve,Pe){for(var it=!1,xt=ve;--xt>=0&&Pe[xt]==="\\";)it=!it;return it?"|":" |"}),le=Re.split(/ \|/),he=0;if(le.length>Ae)le.splice(Ae);else for(;le.length<Ae;)le.push("");for(;he<le.length;he++)le[he]=le[he].trim().replace(/\\\|/g,"|");return le}function F(Ue,Ae,Re){var le=Ue.length;if(le===0)return"";for(var he=0;he<le;){var Se=Ue.charAt(le-he-1);if(Se===Ae&&!Re)he++;else if(Se!==Ae&&Re)he++;else break}return Ue.substr(0,le-he)}function N(Ue,Ae){if(Ue.indexOf(Ae[1])===-1)return-1;for(var Re=Ue.length,le=0,he=0;he<Re;he++)if(Ue[he]==="\\")he++;else if(Ue[he]===Ae[0])le++;else if(Ue[he]===Ae[1]&&(le--,le<0))return he;return-1}function W(Ue){Ue&&Ue.sanitize&&!Ue.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var K={escape:i,unescape:c,edit:A,cleanUrl:R,resolveUrl:l,noopTest:h,merge:g,splitCells:b,rtrim:F,findClosingBracket:N,checkSanitizeDeprecation:W},I=Y.defaults,x=K.rtrim,j=K.splitCells,$=K.escape,ae=K.findClosingBracket;function fe(Ue,Ae,Re){var le=Ae.href,he=Ae.title?$(Ae.title):null,Se=Ue[1].replace(/\\([\[\]])/g,"$1");return Ue[0].charAt(0)!=="!"?{type:"link",raw:Re,href:le,title:he,text:Se}:{type:"image",raw:Re,href:le,title:he,text:$(Se)}}function pe(Ue,Ae){var Re=Ue.match(/^(\s+)(?:```)/);if(Re===null)return Ae;var le=Re[1];return Ae.split(`
|
|
`).map(function(he){var Se=he.match(/^\s+/);if(Se===null)return he;var ve=Se[0];return ve.length>=le.length?he.slice(le.length):he}).join(`
|
|
`)}var Ce=function(){function Ue(Re){this.options=Re||I}var Ae=Ue.prototype;return Ae.space=function(le){var he=this.rules.block.newline.exec(le);if(he)return he[0].length>1?{type:"space",raw:he[0]}:{raw:`
|
|
`}},Ae.code=function(le,he){var Se=this.rules.block.code.exec(le);if(Se){var ve=he[he.length-1];if(ve&&ve.type==="paragraph")return{raw:Se[0],text:Se[0].trimRight()};var Pe=Se[0].replace(/^ {4}/gm,"");return{type:"code",raw:Se[0],codeBlockStyle:"indented",text:this.options.pedantic?Pe:x(Pe,`
|
|
`)}}},Ae.fences=function(le){var he=this.rules.block.fences.exec(le);if(he){var Se=he[0],ve=pe(Se,he[3]||"");return{type:"code",raw:Se,lang:he[2]?he[2].trim():he[2],text:ve}}},Ae.heading=function(le){var he=this.rules.block.heading.exec(le);if(he)return{type:"heading",raw:he[0],depth:he[1].length,text:he[2]}},Ae.nptable=function(le){var he=this.rules.block.nptable.exec(le);if(he){var Se={type:"table",header:j(he[1].replace(/^ *| *\| *$/g,"")),align:he[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:he[3]?he[3].replace(/\n$/,"").split(`
|
|
`):[],raw:he[0]};if(Se.header.length===Se.align.length){var ve=Se.align.length,Pe;for(Pe=0;Pe<ve;Pe++)/^ *-+: *$/.test(Se.align[Pe])?Se.align[Pe]="right":/^ *:-+: *$/.test(Se.align[Pe])?Se.align[Pe]="center":/^ *:-+ *$/.test(Se.align[Pe])?Se.align[Pe]="left":Se.align[Pe]=null;for(ve=Se.cells.length,Pe=0;Pe<ve;Pe++)Se.cells[Pe]=j(Se.cells[Pe],Se.header.length);return Se}}},Ae.hr=function(le){var he=this.rules.block.hr.exec(le);if(he)return{type:"hr",raw:he[0]}},Ae.blockquote=function(le){var he=this.rules.block.blockquote.exec(le);if(he){var Se=he[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:he[0],text:Se}}},Ae.list=function(le){var he=this.rules.block.list.exec(le);if(he){for(var Se=he[0],ve=he[2],Pe=ve.length>1,it=ve[ve.length-1]===")",xt={type:"list",raw:Se,ordered:Pe,start:Pe?+ve.slice(0,-1):"",loose:!1,items:[]},$t=he[0].match(this.rules.block.item),mn=!1,rn,ci,Jn,Sn,pi,gi,xi,_i=$t.length,Dn=0;Dn<_i;Dn++)rn=$t[Dn],Se=rn,ci=rn.length,rn=rn.replace(/^ *([*+-]|\d+[.)]) */,""),~rn.indexOf(`
|
|
`)&&(ci-=rn.length,rn=this.options.pedantic?rn.replace(/^ {1,4}/gm,""):rn.replace(new RegExp("^ {1,"+ci+"}","gm"),"")),Dn!==_i-1&&(Jn=this.rules.block.bullet.exec($t[Dn+1])[0],(Pe?Jn.length===1||!it&&Jn[Jn.length-1]===")":Jn.length>1||this.options.smartLists&&Jn!==ve)&&(Sn=$t.slice(Dn+1).join(`
|
|
`),xt.raw=xt.raw.substring(0,xt.raw.length-Sn.length),Dn=_i-1)),pi=mn||/\n\n(?!\s*$)/.test(rn),Dn!==_i-1&&(mn=rn.charAt(rn.length-1)===`
|
|
`,pi||(pi=mn)),pi&&(xt.loose=!0),gi=/^\[[ xX]\] /.test(rn),xi=void 0,gi&&(xi=rn[1]!==" ",rn=rn.replace(/^\[[ xX]\] +/,"")),xt.items.push({type:"list_item",raw:Se,task:gi,checked:xi,loose:pi,text:rn});return xt}},Ae.html=function(le){var he=this.rules.block.html.exec(le);if(he)return{type:this.options.sanitize?"paragraph":"html",raw:he[0],pre:!this.options.sanitizer&&(he[1]==="pre"||he[1]==="script"||he[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(he[0]):$(he[0]):he[0]}},Ae.def=function(le){var he=this.rules.block.def.exec(le);if(he){he[3]&&(he[3]=he[3].substring(1,he[3].length-1));var Se=he[1].toLowerCase().replace(/\s+/g," ");return{tag:Se,raw:he[0],href:he[2],title:he[3]}}},Ae.table=function(le){var he=this.rules.block.table.exec(le);if(he){var Se={type:"table",header:j(he[1].replace(/^ *| *\| *$/g,"")),align:he[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:he[3]?he[3].replace(/\n$/,"").split(`
|
|
`):[]};if(Se.header.length===Se.align.length){Se.raw=he[0];var ve=Se.align.length,Pe;for(Pe=0;Pe<ve;Pe++)/^ *-+: *$/.test(Se.align[Pe])?Se.align[Pe]="right":/^ *:-+: *$/.test(Se.align[Pe])?Se.align[Pe]="center":/^ *:-+ *$/.test(Se.align[Pe])?Se.align[Pe]="left":Se.align[Pe]=null;for(ve=Se.cells.length,Pe=0;Pe<ve;Pe++)Se.cells[Pe]=j(Se.cells[Pe].replace(/^ *\| *| *\| *$/g,""),Se.header.length);return Se}}},Ae.lheading=function(le){var he=this.rules.block.lheading.exec(le);if(he)return{type:"heading",raw:he[0],depth:he[2].charAt(0)==="="?1:2,text:he[1]}},Ae.paragraph=function(le){var he=this.rules.block.paragraph.exec(le);if(he)return{type:"paragraph",raw:he[0],text:he[1].charAt(he[1].length-1)===`
|
|
`?he[1].slice(0,-1):he[1]}},Ae.text=function(le,he){var Se=this.rules.block.text.exec(le);if(Se){var ve=he[he.length-1];return ve&&ve.type==="text"?{raw:Se[0],text:Se[0]}:{type:"text",raw:Se[0],text:Se[0]}}},Ae.escape=function(le){var he=this.rules.inline.escape.exec(le);if(he)return{type:"escape",raw:he[0],text:$(he[1])}},Ae.tag=function(le,he,Se){var ve=this.rules.inline.tag.exec(le);if(ve)return!he&&/^<a /i.test(ve[0])?he=!0:he&&/^<\/a>/i.test(ve[0])&&(he=!1),!Se&&/^<(pre|code|kbd|script)(\s|>)/i.test(ve[0])?Se=!0:Se&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ve[0])&&(Se=!1),{type:this.options.sanitize?"text":"html",raw:ve[0],inLink:he,inRawBlock:Se,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ve[0]):$(ve[0]):ve[0]}},Ae.link=function(le){var he=this.rules.inline.link.exec(le);if(he){var Se=ae(he[2],"()");if(Se>-1){var ve=he[0].indexOf("!")===0?5:4,Pe=ve+he[1].length+Se;he[2]=he[2].substring(0,Se),he[0]=he[0].substring(0,Pe).trim(),he[3]=""}var it=he[2],xt="";if(this.options.pedantic){var $t=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(it);$t?(it=$t[1],xt=$t[3]):xt=""}else xt=he[3]?he[3].slice(1,-1):"";it=it.trim().replace(/^<([\s\S]*)>$/,"$1");var mn=fe(he,{href:it&&it.replace(this.rules.inline._escapes,"$1"),title:xt&&xt.replace(this.rules.inline._escapes,"$1")},he[0]);return mn}},Ae.reflink=function(le,he){var Se;if((Se=this.rules.inline.reflink.exec(le))||(Se=this.rules.inline.nolink.exec(le))){var ve=(Se[2]||Se[1]).replace(/\s+/g," ");if(ve=he[ve.toLowerCase()],!ve||!ve.href){var Pe=Se[0].charAt(0);return{type:"text",raw:Pe,text:Pe}}var it=fe(Se,ve,Se[0]);return it}},Ae.strong=function(le,he,Se){Se===void 0&&(Se="");var ve=this.rules.inline.strong.start.exec(le);if(ve&&(!ve[1]||ve[1]&&(Se===""||this.rules.inline.punctuation.exec(Se)))){he=he.slice(-1*le.length);var Pe=ve[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Pe.lastIndex=0;for(var it;(ve=Pe.exec(he))!=null;)if(it=this.rules.inline.strong.middle.exec(he.slice(0,ve.index+3)),it)return{type:"strong",raw:le.slice(0,it[0].length),text:le.slice(2,it[0].length-2)}}},Ae.em=function(le,he,Se){Se===void 0&&(Se="");var ve=this.rules.inline.em.start.exec(le);if(ve&&(!ve[1]||ve[1]&&(Se===""||this.rules.inline.punctuation.exec(Se)))){he=he.slice(-1*le.length);var Pe=ve[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Pe.lastIndex=0;for(var it;(ve=Pe.exec(he))!=null;)if(it=this.rules.inline.em.middle.exec(he.slice(0,ve.index+2)),it)return{type:"em",raw:le.slice(0,it[0].length),text:le.slice(1,it[0].length-1)}}},Ae.codespan=function(le){var he=this.rules.inline.code.exec(le);if(he){var Se=he[2].replace(/\n/g," "),ve=/[^ ]/.test(Se),Pe=Se.startsWith(" ")&&Se.endsWith(" ");return ve&&Pe&&(Se=Se.substring(1,Se.length-1)),Se=$(Se,!0),{type:"codespan",raw:he[0],text:Se}}},Ae.br=function(le){var he=this.rules.inline.br.exec(le);if(he)return{type:"br",raw:he[0]}},Ae.del=function(le){var he=this.rules.inline.del.exec(le);if(he)return{type:"del",raw:he[0],text:he[1]}},Ae.autolink=function(le,he){var Se=this.rules.inline.autolink.exec(le);if(Se){var ve,Pe;return Se[2]==="@"?(ve=$(this.options.mangle?he(Se[1]):Se[1]),Pe="mailto:"+ve):(ve=$(Se[1]),Pe=ve),{type:"link",raw:Se[0],text:ve,href:Pe,tokens:[{type:"text",raw:ve,text:ve}]}}},Ae.url=function(le,he){var Se;if(Se=this.rules.inline.url.exec(le)){var ve,Pe;if(Se[2]==="@")ve=$(this.options.mangle?he(Se[0]):Se[0]),Pe="mailto:"+ve;else{var it;do it=Se[0],Se[0]=this.rules.inline._backpedal.exec(Se[0])[0];while(it!==Se[0]);ve=$(Se[0]),Se[1]==="www."?Pe="http://"+ve:Pe=ve}return{type:"link",raw:Se[0],text:ve,href:Pe,tokens:[{type:"text",raw:ve,text:ve}]}}},Ae.inlineText=function(le,he,Se){var ve=this.rules.inline.text.exec(le);if(ve){var Pe;return he?Pe=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ve[0]):$(ve[0]):ve[0]:Pe=$(this.options.smartypants?Se(ve[0]):ve[0]),{type:"text",raw:ve[0],text:Pe}}},Ue}(),De=K.noopTest,xe=K.edit,Oe=K.merge,Ee={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:De,table:De,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};Ee._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,Ee._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,Ee.def=xe(Ee.def).replace("label",Ee._label).replace("title",Ee._title).getRegex(),Ee.bullet=/(?:[*+-]|\d{1,9}[.)])/,Ee.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,Ee.item=xe(Ee.item,"gm").replace(/bull/g,Ee.bullet).getRegex(),Ee.list=xe(Ee.list).replace(/bull/g,Ee.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Ee.def.source+")").getRegex(),Ee._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ee._comment=/<!--(?!-?>)[\s\S]*?-->/,Ee.html=xe(Ee.html,"i").replace("comment",Ee._comment).replace("tag",Ee._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ee.paragraph=xe(Ee._paragraph).replace("hr",Ee.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",Ee._tag).getRegex(),Ee.blockquote=xe(Ee.blockquote).replace("paragraph",Ee.paragraph).getRegex(),Ee.normal=Oe({},Ee),Ee.gfm=Oe({},Ee.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),Ee.gfm.nptable=xe(Ee.gfm.nptable).replace("hr",Ee.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",Ee._tag).getRegex(),Ee.gfm.table=xe(Ee.gfm.table).replace("hr",Ee.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",Ee._tag).getRegex(),Ee.pedantic=Oe({},Ee.normal,{html:xe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ee._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:De,paragraph:xe(Ee.normal._paragraph).replace("hr",Ee.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",Ee.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var be={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:De,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:De,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};be._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",be.punctuation=xe(be.punctuation).replace(/punctuation/g,be._punctuation).getRegex(),be._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",be._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",be.em.start=xe(be.em.start).replace(/punctuation/g,be._punctuation).getRegex(),be.em.middle=xe(be.em.middle).replace(/punctuation/g,be._punctuation).replace(/overlapSkip/g,be._overlapSkip).getRegex(),be.em.endAst=xe(be.em.endAst,"g").replace(/punctuation/g,be._punctuation).getRegex(),be.em.endUnd=xe(be.em.endUnd,"g").replace(/punctuation/g,be._punctuation).getRegex(),be.strong.start=xe(be.strong.start).replace(/punctuation/g,be._punctuation).getRegex(),be.strong.middle=xe(be.strong.middle).replace(/punctuation/g,be._punctuation).replace(/blockSkip/g,be._blockSkip).getRegex(),be.strong.endAst=xe(be.strong.endAst,"g").replace(/punctuation/g,be._punctuation).getRegex(),be.strong.endUnd=xe(be.strong.endUnd,"g").replace(/punctuation/g,be._punctuation).getRegex(),be.blockSkip=xe(be._blockSkip,"g").getRegex(),be.overlapSkip=xe(be._overlapSkip,"g").getRegex(),be._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,be._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,be._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,be.autolink=xe(be.autolink).replace("scheme",be._scheme).replace("email",be._email).getRegex(),be._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,be.tag=xe(be.tag).replace("comment",Ee._comment).replace("attribute",be._attribute).getRegex(),be._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,be._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,be._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,be.link=xe(be.link).replace("label",be._label).replace("href",be._href).replace("title",be._title).getRegex(),be.reflink=xe(be.reflink).replace("label",be._label).getRegex(),be.reflinkSearch=xe(be.reflinkSearch,"g").replace("reflink",be.reflink).replace("nolink",be.nolink).getRegex(),be.normal=Oe({},be),be.pedantic=Oe({},be.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:xe(/^!?\[(label)\]\((.*?)\)/).replace("label",be._label).getRegex(),reflink:xe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",be._label).getRegex()}),be.gfm=Oe({},be.normal,{escape:xe(be.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),be.gfm.url=xe(be.gfm.url,"i").replace("email",be.gfm._extended_email).getRegex(),be.breaks=Oe({},be.gfm,{br:xe(be.br).replace("{2,}","*").getRegex(),text:xe(be.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var te={block:Ee,inline:be},me=Y.defaults,ye=te.block,Le=te.inline;function $e(Ue){return Ue.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function Me(Ue){var Ae="",Re,le,he=Ue.length;for(Re=0;Re<he;Re++)le=Ue.charCodeAt(Re),Math.random()>.5&&(le="x"+le.toString(16)),Ae+="&#"+le+";";return Ae}var ze=function(){function Ue(Re){this.tokens=[],this.tokens.links=Object.create(null),this.options=Re||me,this.options.tokenizer=this.options.tokenizer||new Ce,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var le={block:ye.normal,inline:Le.normal};this.options.pedantic?(le.block=ye.pedantic,le.inline=Le.pedantic):this.options.gfm&&(le.block=ye.gfm,this.options.breaks?le.inline=Le.breaks:le.inline=Le.gfm),this.tokenizer.rules=le}Ue.lex=function(le,he){var Se=new Ue(he);return Se.lex(le)};var Ae=Ue.prototype;return Ae.lex=function(le){return le=le.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(le,this.tokens,!0),this.inline(this.tokens),this.tokens},Ae.blockTokens=function(le,he,Se){he===void 0&&(he=[]),Se===void 0&&(Se=!0),le=le.replace(/^ +$/gm,"");for(var ve,Pe,it,xt;le;){if(ve=this.tokenizer.space(le)){le=le.substring(ve.raw.length),ve.type&&he.push(ve);continue}if(ve=this.tokenizer.code(le,he)){le=le.substring(ve.raw.length),ve.type?he.push(ve):(xt=he[he.length-1],xt.raw+=`
|
|
`+ve.raw,xt.text+=`
|
|
`+ve.text);continue}if(ve=this.tokenizer.fences(le)){le=le.substring(ve.raw.length),he.push(ve);continue}if(ve=this.tokenizer.heading(le)){le=le.substring(ve.raw.length),he.push(ve);continue}if(ve=this.tokenizer.nptable(le)){le=le.substring(ve.raw.length),he.push(ve);continue}if(ve=this.tokenizer.hr(le)){le=le.substring(ve.raw.length),he.push(ve);continue}if(ve=this.tokenizer.blockquote(le)){le=le.substring(ve.raw.length),ve.tokens=this.blockTokens(ve.text,[],Se),he.push(ve);continue}if(ve=this.tokenizer.list(le)){for(le=le.substring(ve.raw.length),it=ve.items.length,Pe=0;Pe<it;Pe++)ve.items[Pe].tokens=this.blockTokens(ve.items[Pe].text,[],!1);he.push(ve);continue}if(ve=this.tokenizer.html(le)){le=le.substring(ve.raw.length),he.push(ve);continue}if(Se&&(ve=this.tokenizer.def(le))){le=le.substring(ve.raw.length),this.tokens.links[ve.tag]||(this.tokens.links[ve.tag]={href:ve.href,title:ve.title});continue}if(ve=this.tokenizer.table(le)){le=le.substring(ve.raw.length),he.push(ve);continue}if(ve=this.tokenizer.lheading(le)){le=le.substring(ve.raw.length),he.push(ve);continue}if(Se&&(ve=this.tokenizer.paragraph(le))){le=le.substring(ve.raw.length),he.push(ve);continue}if(ve=this.tokenizer.text(le,he)){le=le.substring(ve.raw.length),ve.type?he.push(ve):(xt=he[he.length-1],xt.raw+=`
|
|
`+ve.raw,xt.text+=`
|
|
`+ve.text);continue}if(le){var $t="Infinite loop on byte: "+le.charCodeAt(0);if(this.options.silent){console.error($t);break}else throw new Error($t)}}return he},Ae.inline=function(le){var he,Se,ve,Pe,it,xt,$t=le.length;for(he=0;he<$t;he++){xt=le[he];switch(xt.type){case"paragraph":case"text":case"heading":{xt.tokens=[],this.inlineTokens(xt.text,xt.tokens);break}case"table":{for(xt.tokens={header:[],cells:[]},Pe=xt.header.length,Se=0;Se<Pe;Se++)xt.tokens.header[Se]=[],this.inlineTokens(xt.header[Se],xt.tokens.header[Se]);for(Pe=xt.cells.length,Se=0;Se<Pe;Se++)for(it=xt.cells[Se],xt.tokens.cells[Se]=[],ve=0;ve<it.length;ve++)xt.tokens.cells[Se][ve]=[],this.inlineTokens(it[ve],xt.tokens.cells[Se][ve]);break}case"blockquote":{this.inline(xt.tokens);break}case"list":{for(Pe=xt.items.length,Se=0;Se<Pe;Se++)this.inline(xt.items[Se].tokens);break}}}return le},Ae.inlineTokens=function(le,he,Se,ve,Pe){he===void 0&&(he=[]),Se===void 0&&(Se=!1),ve===void 0&&(ve=!1),Pe===void 0&&(Pe="");var it,xt=le,$t;if(this.tokens.links){var mn=Object.keys(this.tokens.links);if(mn.length>0)for(;($t=this.tokenizer.rules.inline.reflinkSearch.exec(xt))!=null;)mn.includes($t[0].slice($t[0].lastIndexOf("[")+1,-1))&&(xt=xt.slice(0,$t.index)+"["+"a".repeat($t[0].length-2)+"]"+xt.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;($t=this.tokenizer.rules.inline.blockSkip.exec(xt))!=null;)xt=xt.slice(0,$t.index)+"["+"a".repeat($t[0].length-2)+"]"+xt.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;le;){if(it=this.tokenizer.escape(le)){le=le.substring(it.raw.length),he.push(it);continue}if(it=this.tokenizer.tag(le,Se,ve)){le=le.substring(it.raw.length),Se=it.inLink,ve=it.inRawBlock,he.push(it);continue}if(it=this.tokenizer.link(le)){le=le.substring(it.raw.length),it.type==="link"&&(it.tokens=this.inlineTokens(it.text,[],!0,ve)),he.push(it);continue}if(it=this.tokenizer.reflink(le,this.tokens.links)){le=le.substring(it.raw.length),it.type==="link"&&(it.tokens=this.inlineTokens(it.text,[],!0,ve)),he.push(it);continue}if(it=this.tokenizer.strong(le,xt,Pe)){le=le.substring(it.raw.length),it.tokens=this.inlineTokens(it.text,[],Se,ve),he.push(it);continue}if(it=this.tokenizer.em(le,xt,Pe)){le=le.substring(it.raw.length),it.tokens=this.inlineTokens(it.text,[],Se,ve),he.push(it);continue}if(it=this.tokenizer.codespan(le)){le=le.substring(it.raw.length),he.push(it);continue}if(it=this.tokenizer.br(le)){le=le.substring(it.raw.length),he.push(it);continue}if(it=this.tokenizer.del(le)){le=le.substring(it.raw.length),it.tokens=this.inlineTokens(it.text,[],Se,ve),he.push(it);continue}if(it=this.tokenizer.autolink(le,Me)){le=le.substring(it.raw.length),he.push(it);continue}if(!Se&&(it=this.tokenizer.url(le,Me))){le=le.substring(it.raw.length),he.push(it);continue}if(it=this.tokenizer.inlineText(le,ve,$e)){le=le.substring(it.raw.length),Pe=it.raw.slice(-1),he.push(it);continue}if(le){var rn="Infinite loop on byte: "+le.charCodeAt(0);if(this.options.silent){console.error(rn);break}else throw new Error(rn)}}return he},Z(Ue,null,[{key:"rules",get:function(){return{block:ye,inline:Le}}}]),Ue}(),ot=Y.defaults,Et=K.cleanUrl,_t=K.escape,mt=function(){function Ue(Re){this.options=Re||ot}var Ae=Ue.prototype;return Ae.code=function(le,he,Se){var ve=(he||"").match(/\S*/)[0];if(this.options.highlight){var Pe=this.options.highlight(le,ve);Pe!=null&&Pe!==le&&(Se=!0,le=Pe)}return ve?'<pre><code class="'+this.options.langPrefix+_t(ve,!0)+'">'+(Se?le:_t(le,!0))+`</code></pre>
|
|
`:"<pre><code>"+(Se?le:_t(le,!0))+`</code></pre>
|
|
`},Ae.blockquote=function(le){return`<blockquote>
|
|
`+le+`</blockquote>
|
|
`},Ae.html=function(le){return le},Ae.heading=function(le,he,Se,ve){return this.options.headerIds?"<h"+he+' id="'+this.options.headerPrefix+ve.slug(Se)+'">'+le+"</h"+he+`>
|
|
`:"<h"+he+">"+le+"</h"+he+`>
|
|
`},Ae.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},Ae.list=function(le,he,Se){var ve=he?"ol":"ul",Pe=he&&Se!==1?' start="'+Se+'"':"";return"<"+ve+Pe+`>
|
|
`+le+"</"+ve+`>
|
|
`},Ae.listitem=function(le){return"<li>"+le+`</li>
|
|
`},Ae.checkbox=function(le){return"<input "+(le?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},Ae.paragraph=function(le){return"<p>"+le+`</p>
|
|
`},Ae.table=function(le,he){return he&&(he="<tbody>"+he+"</tbody>"),`<table>
|
|
<thead>
|
|
`+le+`</thead>
|
|
`+he+`</table>
|
|
`},Ae.tablerow=function(le){return`<tr>
|
|
`+le+`</tr>
|
|
`},Ae.tablecell=function(le,he){var Se=he.header?"th":"td",ve=he.align?"<"+Se+' align="'+he.align+'">':"<"+Se+">";return ve+le+"</"+Se+`>
|
|
`},Ae.strong=function(le){return"<strong>"+le+"</strong>"},Ae.em=function(le){return"<em>"+le+"</em>"},Ae.codespan=function(le){return"<code>"+le+"</code>"},Ae.br=function(){return this.options.xhtml?"<br/>":"<br>"},Ae.del=function(le){return"<del>"+le+"</del>"},Ae.link=function(le,he,Se){if(le=Et(this.options.sanitize,this.options.baseUrl,le),le===null)return Se;var ve='<a href="'+_t(le)+'"';return he&&(ve+=' title="'+he+'"'),ve+=">"+Se+"</a>",ve},Ae.image=function(le,he,Se){if(le=Et(this.options.sanitize,this.options.baseUrl,le),le===null)return Se;var ve='<img src="'+le+'" alt="'+Se+'"';return he&&(ve+=' title="'+he+'"'),ve+=this.options.xhtml?"/>":">",ve},Ae.text=function(le){return le},Ue}(),ut=function(){function Ue(){}var Ae=Ue.prototype;return Ae.strong=function(le){return le},Ae.em=function(le){return le},Ae.codespan=function(le){return le},Ae.del=function(le){return le},Ae.html=function(le){return le},Ae.text=function(le){return le},Ae.link=function(le,he,Se){return""+Se},Ae.image=function(le,he,Se){return""+Se},Ae.br=function(){return""},Ue}(),Xt=function(){function Ue(){this.seen={}}var Ae=Ue.prototype;return Ae.slug=function(le){var he=le.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(he)){var Se=he;do this.seen[Se]++,he=Se+"-"+this.seen[Se];while(this.seen.hasOwnProperty(he))}return this.seen[he]=0,he},Ue}(),en=Y.defaults,sn=K.unescape,pn=function(){function Ue(Re){this.options=Re||en,this.options.renderer=this.options.renderer||new mt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new ut,this.slugger=new Xt}Ue.parse=function(le,he){var Se=new Ue(he);return Se.parse(le)};var Ae=Ue.prototype;return Ae.parse=function(le,he){he===void 0&&(he=!0);var Se="",ve,Pe,it,xt,$t,mn,rn,ci,Jn,Sn,pi,gi,xi,_i,Dn,Ai,Ln,Dt,Qn=le.length;for(ve=0;ve<Qn;ve++){Sn=le[ve];switch(Sn.type){case"space":continue;case"hr":{Se+=this.renderer.hr();continue}case"heading":{Se+=this.renderer.heading(this.parseInline(Sn.tokens),Sn.depth,sn(this.parseInline(Sn.tokens,this.textRenderer)),this.slugger);continue}case"code":{Se+=this.renderer.code(Sn.text,Sn.lang,Sn.escaped);continue}case"table":{for(ci="",rn="",xt=Sn.header.length,Pe=0;Pe<xt;Pe++)rn+=this.renderer.tablecell(this.parseInline(Sn.tokens.header[Pe]),{header:!0,align:Sn.align[Pe]});for(ci+=this.renderer.tablerow(rn),Jn="",xt=Sn.cells.length,Pe=0;Pe<xt;Pe++){for(mn=Sn.tokens.cells[Pe],rn="",$t=mn.length,it=0;it<$t;it++)rn+=this.renderer.tablecell(this.parseInline(mn[it]),{header:!1,align:Sn.align[it]});Jn+=this.renderer.tablerow(rn)}Se+=this.renderer.table(ci,Jn);continue}case"blockquote":{Jn=this.parse(Sn.tokens),Se+=this.renderer.blockquote(Jn);continue}case"list":{for(pi=Sn.ordered,gi=Sn.start,xi=Sn.loose,xt=Sn.items.length,Jn="",Pe=0;Pe<xt;Pe++)Dn=Sn.items[Pe],Ai=Dn.checked,Ln=Dn.task,_i="",Dn.task&&(Dt=this.renderer.checkbox(Ai),xi?Dn.tokens.length>0&&Dn.tokens[0].type==="text"?(Dn.tokens[0].text=Dt+" "+Dn.tokens[0].text,Dn.tokens[0].tokens&&Dn.tokens[0].tokens.length>0&&Dn.tokens[0].tokens[0].type==="text"&&(Dn.tokens[0].tokens[0].text=Dt+" "+Dn.tokens[0].tokens[0].text)):Dn.tokens.unshift({type:"text",text:Dt}):_i+=Dt),_i+=this.parse(Dn.tokens,xi),Jn+=this.renderer.listitem(_i,Ln,Ai);Se+=this.renderer.list(Jn,pi,gi);continue}case"html":{Se+=this.renderer.html(Sn.text);continue}case"paragraph":{Se+=this.renderer.paragraph(this.parseInline(Sn.tokens));continue}case"text":{for(Jn=Sn.tokens?this.parseInline(Sn.tokens):Sn.text;ve+1<Qn&&le[ve+1].type==="text";)Sn=le[++ve],Jn+=`
|
|
`+(Sn.tokens?this.parseInline(Sn.tokens):Sn.text);Se+=he?this.renderer.paragraph(Jn):Jn;continue}default:{var vi='Token with "'+Sn.type+'" type was not found.';if(this.options.silent){console.error(vi);return}else throw new Error(vi)}}}return Se},Ae.parseInline=function(le,he){he=he||this.renderer;var Se="",ve,Pe,it=le.length;for(ve=0;ve<it;ve++){Pe=le[ve];switch(Pe.type){case"escape":{Se+=he.text(Pe.text);break}case"html":{Se+=he.html(Pe.text);break}case"link":{Se+=he.link(Pe.href,Pe.title,this.parseInline(Pe.tokens,he));break}case"image":{Se+=he.image(Pe.href,Pe.title,Pe.text);break}case"strong":{Se+=he.strong(this.parseInline(Pe.tokens,he));break}case"em":{Se+=he.em(this.parseInline(Pe.tokens,he));break}case"codespan":{Se+=he.codespan(Pe.text);break}case"br":{Se+=he.br();break}case"del":{Se+=he.del(this.parseInline(Pe.tokens,he));break}case"text":{Se+=he.text(Pe.text);break}default:{var xt='Token with "'+Pe.type+'" type was not found.';if(this.options.silent){console.error(xt);return}else throw new Error(xt)}}}return Se},Ue}(),Un=K.merge,Cn=K.checkSanitizeDeprecation,Qe=K.escape,Ye=Y.getDefaults,St=Y.changeDefaults,bt=Y.defaults;function nt(Ue,Ae,Re){if(typeof Ue=="undefined"||Ue===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Ue!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Ue)+", string expected");if(typeof Ae=="function"&&(Re=Ae,Ae=null),Ae=Un({},nt.defaults,Ae||{}),Cn(Ae),Re){var le=Ae.highlight,he;try{he=ze.lex(Ue,Ae)}catch(it){return Re(it)}var Se=function(xt){var $t;if(!xt)try{$t=pn.parse(he,Ae)}catch(mn){xt=mn}return Ae.highlight=le,xt?Re(xt):Re(null,$t)};if(!le||le.length<3)return Se();if(delete Ae.highlight,!he.length)return Se();var ve=0;nt.walkTokens(he,function(it){it.type==="code"&&(ve++,setTimeout(function(){le(it.text,it.lang,function(xt,$t){if(xt)return Se(xt);$t!=null&&$t!==it.text&&(it.text=$t,it.escaped=!0),ve--,ve===0&&Se()})},0))}),ve===0&&Se();return}try{var Pe=ze.lex(Ue,Ae);return Ae.walkTokens&&nt.walkTokens(Pe,Ae.walkTokens),pn.parse(Pe,Ae)}catch(it){if(it.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,Ae.silent)return"<p>An error occurred:</p><pre>"+Qe(it.message+"",!0)+"</pre>";throw it}}nt.options=nt.setOptions=function(Ue){return Un(nt.defaults,Ue),St(nt.defaults),nt},nt.getDefaults=Ye,nt.defaults=bt,nt.use=function(Ue){var Ae=Un({},Ue);if(Ue.renderer&&function(){var le=nt.defaults.renderer||new mt,he=function(Pe){var it=le[Pe];le[Pe]=function(){for(var xt=arguments.length,$t=new Array(xt),mn=0;mn<xt;mn++)$t[mn]=arguments[mn];var rn=Ue.renderer[Pe].apply(le,$t);return rn===!1&&(rn=it.apply(le,$t)),rn}};for(var Se in Ue.renderer)he(Se);Ae.renderer=le}(),Ue.tokenizer&&function(){var le=nt.defaults.tokenizer||new Ce,he=function(Pe){var it=le[Pe];le[Pe]=function(){for(var xt=arguments.length,$t=new Array(xt),mn=0;mn<xt;mn++)$t[mn]=arguments[mn];var rn=Ue.tokenizer[Pe].apply(le,$t);return rn===!1&&(rn=it.apply(le,$t)),rn}};for(var Se in Ue.tokenizer)he(Se);Ae.tokenizer=le}(),Ue.walkTokens){var Re=nt.defaults.walkTokens;Ae.walkTokens=function(le){Ue.walkTokens(le),Re&&Re(le)}}nt.setOptions(Ae)},nt.walkTokens=function(Ue,Ae){for(var Re=H(Ue),le;!(le=Re()).done;){var he=le.value;Ae(he);switch(he.type){case"table":{for(var Se=H(he.tokens.header),ve;!(ve=Se()).done;){var Pe=ve.value;nt.walkTokens(Pe,Ae)}for(var it=H(he.tokens.cells),xt;!(xt=it()).done;)for(var $t=xt.value,mn=H($t),rn;!(rn=mn()).done;){var ci=rn.value;nt.walkTokens(ci,Ae)}break}case"list":{nt.walkTokens(he.items,Ae);break}default:he.tokens&&nt.walkTokens(he.tokens,Ae)}}},nt.Parser=pn,nt.parser=pn.parse,nt.Renderer=mt,nt.TextRenderer=ut,nt.Lexer=ze,nt.lexer=ze.lex,nt.Tokenizer=Ce,nt.Slugger=Xt,nt.parse=nt;var vt=nt;return vt})},E7pt:function(zt,st,V){"use strict";V.r(st);var ie=V("T2oS"),Z=V("W9HT"),U=V("+L6B"),ee=V("2/Rp"),H=V("7Kak"),M=V("9yH6"),Y=V("giR+"),X=V("fyUT"),k=V("5NDa"),D=V("5rEg"),v=V("6UJt"),_=V("DFOY"),p=V("14J3"),o=V("BMrR"),u=V("jCWc"),r=V("kPKH"),i=V("sPJy"),t=V("bE4q"),c=V("miYZ"),f=V("tsqr"),A=V("k1fw"),S=V("9og8"),w=V("oBTY"),R=V("y8nQ"),O=V("Vl3Y"),E=V("tJVT"),y=V("WmNS"),d=V.n(y),l=V("q1tI"),h=V.n(l),g=V("Ty5D"),b=V("55Ip"),F=V("9kvl"),N=V("ErOA"),W=V("LvDl"),K=V("V0Rq"),I=V("bbsP"),x=V("/wGt"),j=V("DjyN"),$=V("NUBc"),ae=V("/zsF"),fe=V("PArb"),pe=V("5Dmo"),Ce=V("3S7+"),De=V("sRBo"),xe=V("kaz8"),Oe=V("xKgJ"),Ee=V("vkP9"),be=V("+GcH"),te=V.n(be),me=V("NLgs"),ye=V("9z17"),Le=D.a.Search,$e=[{id:"type",name:"\u6765\u6E90",children:[{name:"\u5168\u90E8",id:"all",type:"type"},{name:"\u6211\u7684",id:"mine",type:"type"}]}],Me=[{id:"diff",name:"\u96BE\u5EA6",children:[{name:"\u5168\u90E8",id:"",type:"diff"},{name:"\u521D\u7EA7",id:1,type:"diff"},{name:"\u4E2D\u7EA7",id:2,type:"diff"},{name:"\u4E2D\u9AD8\u7EA7",id:3,type:"diff"},{name:"\u9AD8\u7EA7",id:4,type:"diff"}]}],ze=function(Re){var le,he=Re.classroomList,Se=Re.shixunsList,ve=Re.pathsList,Pe=Re.loading,it=Re.dispatch,xt=Re.callback,$t=Object(l.useState)(Object(A.a)({},Object(g.i)())),mn=Object(E.a)($t,2),rn=mn[0],ci=mn[1],Jn=Object(g.h)(),Sn=he.actionTabs,pi=O.a.useForm(),gi=Object(E.a)(pi,1),xi=gi[0],_i=he.shixunLists,Dn=Object(l.useState)([]),Ai=Object(E.a)(Dn,2),Ln=Ai[0],Dt=Ai[1],Qn=Object(l.useState)(""),vi=Object(E.a)(Qn,2),hi=vi[0],bi=vi[1],yi=Object(l.useState)({page:1,type:"all",diff:"",status:"published",order:"desc",limit:20,sort:"publish_time",no_jupyter:1,keyword:""}),Fi=Object(E.a)(yi,2),ai=Fi[0],pt=Fi[1];Object(l.useEffect)(function(){return he.actionTabs.key==="\u9009\u7528\u5B9E\u8DF5\u9879\u76EE"?document.body.setAttribute("data-custom","height"):document.body.removeAttribute("data-custom"),function(){document.body.removeAttribute("data-custom")}},[he.actionTabs.key]);var Je=he.actionTabs.key==="\u9009\u7528\u5B9E\u8DF5\u9879\u76EE";Object(l.useEffect)(function(){Je&&it({type:"classroomList/getShixunLists",payload:Object(A.a)({},ai)})},[rn.categoryId,Je,ai]),Object(l.useEffect)(function(){it({type:"shixunsList/getMenus",payload:{}})},[]),Object(l.useEffect)(function(){Dt([])},[he.actionTabs.key]);var Ft=Object(ye.b)(),Bt=Object(E.a)(Ft,4),Fe=Bt[0],ue=Bt[1],si=Bt[2],je=Bt[3],Be=function(An,zn,Pn){ai.tag_level=An,ai.sub_discipline_id=zn,ai.discipline_id=Pn,pt(Object(A.a)({},ai))},Ie=function(){var _e=Object(S.a)(d.a.mark(function An(zn){var Pn,Q;return d.a.wrap(function(L){for(;;)switch(L.prev=L.next){case 0:xt&&xt(_i==null||((Pn=_i.shixun_list)===null||Pn===void 0)?void 0:Pn.filter(function(z){return z.identifier===Ln[0]})[0],(Q=he.actionTabs)===null||Q===void 0?void 0:Q.editData,zn),it({type:"classroomList/setActionTabs",payload:{}}),ue();case 3:case"end":return L.stop()}},An)}));return function(zn){return _e.apply(this,arguments)}}();return he.actionTabs.key!=="\u9009\u7528\u5B9E\u8DF5\u9879\u76EE"?null:h.a.createElement(x.a,{title:"\u9009\u7528\u5B9E\u8DF5\u9879\u76EE",placement:"bottom",height:"100%",closable:!0,onClose:function(){it({type:"classroomList/setActionTabs",payload:{key:""}})},visible:!!Je,key:"bottom",className:te.a.drawer,footer:h.a.createElement("div",{className:"tc"},h.a.createElement(ee.a,{size:"large",onClick:function(){it({type:"classroomList/setActionTabs",payload:{key:""}})},style:{marginRight:8}},"\u53D6\u6D88"),h.a.createElement(ee.a,{size:"large",onClick:Object(S.a)(d.a.mark(function _e(){var An;return d.a.wrap(function(Pn){for(;;)switch(Pn.prev=Pn.next){case 0:if(!(Ln.length>1)){Pn.next=4;break}f.b.error("\u53EA\u80FD\u9009\u62E9\u4E00\u4E2A\u5B9E\u8DF5\u9879\u76EE"),Pn.next=12;break;case 4:if(!(Ln.length===0)){Pn.next=8;break}f.b.error("\u8BF7\u9009\u62E9\u5B9E\u8DF5\u9879\u76EE"),Pn.next=12;break;case 8:return Pn.next=10,je({id:Ln[0],course_id:rn.coursesId,type:"shixun"});case 10:An=Pn.sent,An||Ie(0);case 12:case"end":return Pn.stop()}},_e)})),type:"primary"},"\u786E\u5B9A"))},h.a.createElement("section",{className:"tc"},h.a.createElement(Ee.a,{onChange:function(An){pt(Object(A.a)(Object(A.a)(Object(A.a)({},ai),An),{},{page:1}))}})),h.a.createElement("section",{className:"edu-container"},$e.map(function(_e,An){var zn;return h.a.createElement("ul",{className:te.a.menu,key:An},h.a.createElement("li",null,_e.name),_e==null||((zn=_e.children)===null||zn===void 0)?void 0:zn.map(function(Pn,Q){return h.a.createElement("li",{key:Q,className:ai[_e.id]==Pn.id?te.a.actived:"",onClick:function(){ai[_e.id]=Pn.id,pt(Object(A.a)({},ai)),it({type:"classroomList/getShixunLists",payload:Object(A.a)({},ai)})}},h.a.createElement("strong",null,Pn.name))}))}),h.a.createElement("ul",{className:te.a.menut},h.a.createElement("span",{style:{padding:"18px",fontWeight:"600"}},"\u65B9\u5411\uFF1A"),h.a.createElement("li",{className:ai.discipline_id?"":te.a.actived3,onClick:function(){Be(null,null,null)}},h.a.createElement("strong",null,"\u5168\u90E8")),Se.menus&&Se.menus.map(function(_e,An){return h.a.createElement("li",{key:An,className:ai.discipline_id==_e.id?te.a.actived3:""},h.a.createElement("strong",{onClick:function(){Be(1,null,_e.id)}},_e.name),h.a.createElement("div",null,_e.sub_repertoires.map(function(zn,Pn){return h.a.createElement("div",{key:Pn,className:"mt5"},h.a.createElement("div",{className:ai.sub_discipline_id==zn.id?"".concat(te.a.actived4," ").concat(te.a.subTag):te.a.subTag,onClick:function(){Be(2,zn.id,_e.id)}},zn.name),h.a.createElement("ul",{className:"mt5"},zn.tags&&zn.tags.map(function(Q,C){return h.a.createElement("li",{key:C,className:ai.sub_discipline_id==Q.id?te.a.actived4:"",onClick:function(){Be(3,Q.id,_e.id)}},Q.name)})))})))})),Me.map(function(_e,An){var zn;return h.a.createElement("ul",{className:te.a.menu,key:An},h.a.createElement("li",null,_e.name),_e==null||((zn=_e.children)===null||zn===void 0)?void 0:zn.map(function(Pn,Q){return h.a.createElement("li",{key:Q,className:ai[_e.id]==Pn.id?te.a.actived:"",onClick:function(){ai[_e.id]=Pn.id,pt(Object(A.a)({},ai)),it({type:"classroomList/getShixunLists",payload:Object(A.a)({},ai)})}},h.a.createElement("strong",null,Pn.name))}))}),h.a.createElement("div",{className:te.a.menuCourse,style:{margin:"0px 15px"}},h.a.createElement("ul",null,h.a.createElement("li",null,"\u5DF2\u9009",h.a.createElement("span",{className:"c-blue"},Ln.length),"\u4E2A\u5B9E\u8BAD"),h.a.createElement("li",null,"\u5171",h.a.createElement("span",{className:"c-blue"},_i.shixuns_count),"\u4E2A\u8BFE\u7A0B"),h.a.createElement("li",{className:"current",onClick:function(){ai.order=ai.order==="asc"?"desc":"asc",pt(Object(A.a)({},ai))}},"\u5B66\u4E60\u4EBA\u6570",h.a.createElement("p",{className:"edu-sorter current ".concat(ai.order)},ai.order==="asc"?h.a.createElement("span",{className:"iconfont icon-sanjiaoxing-up"}):h.a.createElement("span",{className:"iconfont icon-sanjiaoxing-down"}))))),h.a.createElement(xe.a.Group,{style:{display:"block"},value:Ln,onChange:function(An){Dt(An)}},_i==null||((le=_i.shixun_list)===null||le===void 0)?void 0:le.map(function(_e,An){return h.a.createElement("div",{className:te.a.listItem,key:_e.identifier},h.a.createElement(xe.a,{value:_e.identifier,disabled:_e==null?void 0:_e.need_authorize}),h.a.createElement("div",{className:te.a.info},h.a.createElement("div",{className:te.a.title},h.a.createElement("div",{className:te.a.titleLeft},h.a.createElement(b.a,{to:"/shixuns/".concat(_e.identifier,"/challenges"),target:"_blank"},h.a.createElement("strong",{className:"font16",dangerouslySetInnerHTML:{__html:_e.title}})),(_e==null?void 0:_e.need_authorize)&&h.a.createElement("span",{onClick:function(){Object(me.a)(!1)},style:{marginRight:"auto"},className:"tag-style bg-pink current ml10"},"\u9700\u6388\u6743"),Object(Oe.v)()&&(_e==null?void 0:_e.mark_status)===1&&h.a.createElement(Ce.a,{title:_e==null?void 0:_e.mark_content},h.a.createElement("span",{style:{marginRight:"auto",background:"#2FA34F"},className:"tag-style current ml10"},"\u6B63\u5E38")),Object(Oe.v)()&&(_e==null?void 0:_e.mark_status)===2&&h.a.createElement(Ce.a,{title:_e==null?void 0:_e.mark_content},h.a.createElement("span",{style:{marginRight:"auto",background:"#FF8C29"},className:"tag-style current ml10"},"\u9700\u5B8C\u5584")),Object(Oe.v)()&&(_e==null?void 0:_e.mark_status)===3&&h.a.createElement(Ce.a,{title:_e==null?void 0:_e.mark_content},h.a.createElement("span",{style:{marginRight:"auto",background:"#E53333"},className:"tag-style current ml10"},"\u65E0\u6CD5\u4F7F\u7528")))),h.a.createElement("div",{className:"flex-wrp mt10 font14 c-light-black"},h.a.createElement("span",{className:te.a.description,dangerouslySetInnerHTML:{__html:_e.description}})),h.a.createElement("div",{className:"flex-wrp mt15"},_e.challenge_names.map(function(zn,Pn){return h.a.createElement("span",{key:Pn,className:"mr30"},"\u7B2C",Pn+1,"\u5173 ",zn," ")})),h.a.createElement(fe.a,{dashed:!0}),h.a.createElement("div",{className:"c-light-black mt20"},h.a.createElement("span",null,_e.author_name),h.a.createElement("span",{className:"ml15 mr15"},"|"),h.a.createElement("span",null,_e.author_school_name),h.a.createElement("span",{className:"ml15 mr15"},"|"),h.a.createElement("span",null,"\u96BE\u5EA6\u7CFB\u6570 ",_e.level),h.a.createElement("span",{className:"ml15 mr15"},"|"),h.a.createElement("span",null,"\u5B66\u4E60\u4EBA\u6570 "),h.a.createElement("span",null,_e.study_count))))})),h.a.createElement("p",null)),h.a.createElement("div",{className:"tc"},h.a.createElement($.a,{defaultCurrent:1,current:ai.page||1,hideOnSinglePage:!0,defaultPageSize:20,showQuickJumper:!0,showSizeChanger:!1,total:_i==null?void 0:_i.shixuns_count,onChange:function(An){ai.page=An,pt(Object(A.a)({},ai)),Dt([])}})),h.a.createElement(ye.a,{visible:Fe,onCancel:ue,onOk:Ie,renderData:si,inPaper:!0,modalType:"single",type:"shixun"}))},ot=Object(F.a)(function(Ae){var Re=Ae.classroomList,le=Ae.loading,he=Ae.shixunsList,Se=Ae.pathsList;return{classroomList:Re,pathsList:Se,loading:le,shixunsList:he}})(ze),Et=V("sZF6"),_t=V("2aBv"),mt=V("zQJ6"),ut=V.n(mt),Xt=V("m3rI"),en=V("LYsE"),sn=V("g9YV"),pn=V("wCAj"),Un=V("GdJJ"),Cn=V.n(Un),Qe=V("9Bee"),Ye=V("1vsH"),St=function(Re){var le,he,Se=Re.isPreview,ve=Se===void 0?!1:Se,Pe=Re.isExportBlank,it=Pe===void 0?!1:Pe,xt=Re.activeTabs,$t=Re.exercise,mn=Re.globalSetting,rn=Re.loading,ci=Re.user,Jn=Re.dispatch,Sn=Re.setIsEdit,pi=Object(g.i)(),gi=ci.userInfo,xi=Object(l.useState)(),_i=Object(E.a)(xi,2),Dn=_i[0],Ai=_i[1],Ln=Object(l.useState)(),Dt=Object(E.a)(Ln,2),Qn=Dt[0],vi=Dt[1],hi=Object(l.useRef)(null),bi=Object(l.useState)(21),yi=Object(E.a)(bi,2),Fi=yi[0],ai=yi[1];Object(l.useEffect)(function(){Object(Ye.P)(xt)||xt==="2"&&pt()},[pi.userId,pi.coursesId,pi.exerciseId,pi.categoryId,xt]),Object(l.useEffect)(function(){hi.current&&ai(hi.current.clientHeight)},[hi.current]),Object(l.useEffect)(function(){var Fe;if((Fe=$t.exerciseExportHeadData)!==null&&Fe!==void 0&&Fe.title){var ue=$t.exerciseExportHeadData;Ai(Object(A.a)({},ue||{}));var si=ue||{},je=si.table,Be,Ie;(je!=null&&je.total_singles_scores||je!=null&&je.total_doubles_scores||je!=null&&je.total_nulls_scores||je!=null&&je.total_judges_scores||je!=null&&je.total_pros_scores||je!=null&&je.total_shixuns_scores||je!=null&&je.total_mains_scores||je!=null&&je.total_combination_scores)&&(Be=Number(je==null?void 0:je.total_singles_scores)+Number(je==null?void 0:je.total_doubles_scores)+Number(je==null?void 0:je.total_nulls_scores)+Number(je==null?void 0:je.total_judges_scores)+Number(je==null?void 0:je.total_pros_scores)+Number(je==null?void 0:je.total_shixuns_scores)+Number(je==null?void 0:je.total_mains_scores)+Number(je==null?void 0:je.total_combination_scores)),(je!=null&&je.singles_scores||je!=null&&je.doubles_scores||je!=null&&je.nulls_scores||je!=null&&je.judges_scores||je!=null&&je.pros_scores||je!=null&&je.shixuns_scores||je!=null&&je.mains_scores||je!=null&&je.combination_scores)&&(Ie=Number(je==null?void 0:je.singles_scores)+Number(je==null?void 0:je.doubles_scores)+Number(je==null?void 0:je.nulls_scores)+Number(je==null?void 0:je.judges_scores)+Number(je==null?void 0:je.pros_scores)+Number(je==null?void 0:je.shixuns_scores)+Number(je==null?void 0:je.mains_scores)+Number(je==null?void 0:je.combination_scores));var _e=[{key:"1",name:"\u5E94\u5F97\u5206",singles_score:je==null?void 0:je.total_singles_scores,doubles_score:je==null?void 0:je.total_doubles_scores,nulls_score:je==null?void 0:je.total_nulls_scores,judges_score:je==null?void 0:je.total_judges_scores,pros_score:je==null?void 0:je.total_pros_scores,shixuns_score:je==null?void 0:je.total_shixuns_scores,mains_score:je==null?void 0:je.total_mains_scores,combinations_score:je==null?void 0:je.total_combination_scores,total_score:Be},{key:"2",name:"\u5B9E\u5F97\u5206",singles_score:je==null?void 0:je.singles_scores,doubles_score:je==null?void 0:je.doubles_scores,nulls_score:je==null?void 0:je.nulls_scores,judges_score:je==null?void 0:je.judges_scores,pros_score:je==null?void 0:je.pros_scores,shixuns_score:je==null?void 0:je.shixuns_scores,mains_score:je==null?void 0:je.mains_scores,combinations_score:je==null?void 0:je.combination_scores,total_score:Ie},{key:"3",name:"\u8BC4\u5377\u4EBA"}],An=[{key:"1",name:"\u5E94\u5F97\u5206",singles_score:je==null?void 0:je.total_singles_scores,doubles_score:je==null?void 0:je.total_doubles_scores,nulls_score:je==null?void 0:je.total_nulls_scores,judges_score:je==null?void 0:je.total_judges_scores,pros_score:je==null?void 0:je.total_pros_scores,shixuns_score:je==null?void 0:je.total_shixuns_scores,mains_score:je==null?void 0:je.total_mains_scores,combinations_score:je==null?void 0:je.combination_scores,total_score:Be},{key:"2",name:"\u5B9E\u5F97\u5206"},{key:"3",name:"\u8BC4\u5377\u4EBA"}];vi(Object(w.a)(it?An:_e))}},[$t.exerciseExportHeadData]);var pt=function(){var Fe=Object(S.a)(d.a.mark(function ue(){var si,je,Be,Ie,_e,An,zn,Pn;return d.a.wrap(function(C){for(;;)switch(C.prev=C.next){case 0:return si={id:pi.exerciseId||pi.categoryId,identify:(gi==null?void 0:gi.login)||null},C.next=3,Object(K.v)(si);case 3:je=C.sent,Ai(je||{}),Be=je||{},Ie=Be.table,(Ie!=null&&Ie.total_singles_scores||Ie!=null&&Ie.total_doubles_scores||Ie!=null&&Ie.total_nulls_scores||Ie!=null&&Ie.total_judges_scores||Ie!=null&&Ie.total_pros_scores||Ie!=null&&Ie.total_shixuns_scores||Ie!=null&&Ie.total_mains_scores||Ie!=null&&Ie.total_combination_scores)&&(_e=Number(Ie==null?void 0:Ie.total_singles_scores)+Number(Ie==null?void 0:Ie.total_doubles_scores)+Number(Ie==null?void 0:Ie.total_nulls_scores)+Number(Ie==null?void 0:Ie.total_judges_scores)+Number(Ie==null?void 0:Ie.total_pros_scores)+Number(Ie==null?void 0:Ie.total_shixuns_scores)+Number(Ie==null?void 0:Ie.total_mains_scores)+Number(Ie==null?void 0:Ie.total_combination_scores)),(Ie!=null&&Ie.singles_scores||Ie!=null&&Ie.doubles_scores||Ie!=null&&Ie.nulls_scores||Ie!=null&&Ie.judges_scores||Ie!=null&&Ie.pros_scores||Ie!=null&&Ie.shixuns_scores||Ie!=null&&Ie.mains_scores||Ie!=null&&Ie.combinations_score)&&(An=Number(Ie==null?void 0:Ie.singles_scores)+Number(Ie==null?void 0:Ie.doubles_scores)+Number(Ie==null?void 0:Ie.nulls_scores)+Number(Ie==null?void 0:Ie.judges_scores)+Number(Ie==null?void 0:Ie.pros_scores)+Number(Ie==null?void 0:Ie.shixuns_scores)+Number(Ie==null?void 0:Ie.mains_scores)+Number(Ie==null?void 0:Ie.combinations_score)),zn=[{key:"1",name:"\u5E94\u5F97\u5206",singles_score:Ie==null?void 0:Ie.total_singles_scores,doubles_score:Ie==null?void 0:Ie.total_doubles_scores,nulls_score:Ie==null?void 0:Ie.total_nulls_scores,judges_score:Ie==null?void 0:Ie.total_judges_scores,pros_score:Ie==null?void 0:Ie.total_pros_scores,shixuns_score:Ie==null?void 0:Ie.total_shixuns_scores,combinations_score:Ie==null?void 0:Ie.total_combination_scores,mains_score:Ie==null?void 0:Ie.total_mains_scores,total_score:_e},{key:"2",name:"\u5B9E\u5F97\u5206",singles_score:Ie==null?void 0:Ie.singles_scores,doubles_score:Ie==null?void 0:Ie.doubles_scores,nulls_score:Ie==null?void 0:Ie.nulls_scores,judges_score:Ie==null?void 0:Ie.judges_scores,pros_score:Ie==null?void 0:Ie.pros_scores,shixuns_score:Ie==null?void 0:Ie.shixuns_scores,mains_score:Ie==null?void 0:Ie.mains_scores,combinations_score:Ie==null?void 0:Ie.combination_scores,total_score:An},{key:"3",name:"\u8BC4\u5377\u4EBA"}],Pn=[{key:"1",name:"\u5E94\u5F97\u5206"},{key:"2",name:"\u5B9E\u5F97\u5206"},{key:"3",name:"\u8BC4\u5377\u4EBA"}],vi(it?Pn:zn);case 11:case"end":return C.stop()}},ue)}));return function(){return Fe.apply(this,arguments)}}(),Je=[{width:"10%",title:"\u9898\u578B",align:"center",dataIndex:"name",render:function(ue){return h.a.createElement("a",null,ue)}},{width:"10%",title:"\u5355\u9009\u9898",align:"center",dataIndex:"singles_score",render:function(ue){return h.a.createElement("a",null,ue==="0.0"?0:ue)}},{width:"10%",title:"\u591A\u9009\u9898",align:"center",dataIndex:"doubles_score",render:function(ue){return h.a.createElement("a",null,ue==="0.0"?0:ue)}},{width:"10%",title:"\u586B\u7A7A\u9898",align:"center",dataIndex:"nulls_score",render:function(ue){return h.a.createElement("a",null,ue==="0.0"?0:ue)}},{width:"10%",title:"\u5224\u65AD\u9898",align:"center",dataIndex:"judges_score",render:function(ue){return h.a.createElement("a",null,ue==="0.0"?0:ue)}},{width:"10%",title:"\u7F16\u7A0B\u9898",align:"center",dataIndex:"pros_score",render:function(ue){return h.a.createElement("a",null,ue==="0.0"?0:ue)}},{width:"10%",title:"\u5B9E\u8BAD\u9898",align:"center",dataIndex:"shixuns_score",render:function(ue){return h.a.createElement("a",null,ue==="0.0"?0:ue)}},{width:"10%",title:"\u7B80\u7B54\u9898",align:"center",dataIndex:"mains_score",render:function(ue){return h.a.createElement("a",null,ue==="0.0"?0:ue)}},{width:"10%",title:"\u7EC4\u5408\u9898",align:"center",dataIndex:"combinations_score",render:function(ue){return h.a.createElement("a",null,ue==="0.0"?0:ue)}},{width:"10%",title:"\u603B\u5206",align:"center",dataIndex:"total_score",render:function(ue){return h.a.createElement("a",null,ue==="0.0"?0:ue)}}],Ft=Dn||{},Bt=Ft.exercise_header;return console.log("-----",$t),h.a.createElement(h.a.Fragment,null,h.a.createElement("section",{className:"".concat(Cn.a.wrap," ").concat(ve?"pl20":""," ")},(Dn==null?void 0:Dn.photo_url)&&h.a.createElement("img",{className:Cn.a.img,src:Dn==null?void 0:Dn.photo_url}),h.a.createElement("div",{style:{width:"100%",textAlign:"end"}},h.a.createElement(ee.a,{onClick:function(){return Sn(!0)}},"\u7F16\u8F91\u8BD5\u5377")),(Bt==null?void 0:Bt.show_title)&&h.a.createElement("p",{className:"font16 tc c-grey-333"},h.a.createElement("strong",null,Dn==null?void 0:Dn.title)),($t==null||((le=$t.exerciseExportHeadData)===null||le===void 0)?void 0:le.exercise_description)&&h.a.createElement("span",{ref:hi,style:{justifyContent:Fi===21?"center":"left",wordBreak:"break-all",display:"flex",textAlign:"left"},className:"tc c-grey-333"},"\u8BD5\u5377\u987B\u77E5\uFF1A".concat($t==null||((he=$t.exerciseExportHeadData)===null||he===void 0)?void 0:he.exercise_description)),(Bt==null?void 0:Bt.show_info)&&h.a.createElement("p",{className:"tc c-grey-666"},"\u5171:\u3010",Dn==null?void 0:Dn.large_counts,"\u5927\u9898\u3011\u3010",Dn==null?void 0:Dn.total_count,"\u5C0F\u9898\u3011\u3010 \u6EE1\u5206",Dn==null?void 0:Dn.score,"\u5206\u3011 \u8003\u8BD5\u65F6\u95F4\uFF1A\u3010",(Dn==null?void 0:Dn.time)>-1?"".concat(Dn==null?void 0:Dn.time,"\u5206\u949F"):"\u4E0D\u9650","\u3011"),(Bt==null?void 0:Bt.show_desc)&&h.a.createElement("div",{className:"mt10"},h.a.createElement("p",{className:"font16"},"\u8003\u8BD5\u8BF4\u660E\uFF1A"),h.a.createElement(Qe.a,{value:Dn==null?void 0:Dn.description})),(Bt==null?void 0:Bt.show_table)&&h.a.createElement("div",{className:"mt10"},h.a.createElement(pn.a,{className:Cn.a.table,columns:Je,dataSource:Object(w.a)(Qn||[]),bordered:!0,pagination:!1}))))},bt=Object(F.a)(function(Ae){var Re=Ae.exercise,le=Ae.loading,he=Ae.user,Se=Ae.globalSetting;return{exercise:Re,globalSetting:Se,user:he,loading:le.effects}})(St),nt=V("gMzb"),vt=function(Re){var le,he,Se,ve,Pe,it,xt,$t,mn,rn,ci,Jn,Sn,pi,gi,xi,_i,Dn,Ai,Ln=Re.exercise,Dt=Re.globalSetting,Qn=Re.loading,vi=Re.user,hi=Re.problemset,bi=Re.dispatch,yi=Object(g.i)(),Fi=Object(g.g)(),ai=vi.userInfo,pt=O.a.useForm(),Je=Object(E.a)(pt,1),Ft=Je[0],Bt=Object(l.useState)([]),Fe=Object(E.a)(Bt,2),ue=Fe[0],si=Fe[1],je=Object(l.useState)(!1),Be=Object(E.a)(je,2),Ie=Be[0],_e=Be[1],An=Object(l.useState)(!1),zn=Object(E.a)(An,2),Pn=zn[0],Q=zn[1],C=Object(l.useState)(!1),L=Object(E.a)(C,2),z=L[0],oe=L[1],q=Object(l.useState)(-1),ke=Object(E.a)(q,2),ft=ke[0],kt=ke[1],an=Object(l.useRef)(),dt=Object(l.useRef)(ue),Pt=Object(l.useState)({}),tn=Object(E.a)(Pt,2),Vn=tn[0],fi=tn[1],Hn=[{name:"\u5355\u9009\u9898",id:0,count:"q_singles",score:"q_singles_scores"},{name:"\u591A\u9009\u9898",id:1,count:"q_doubles",score:"q_doubles_scores"},{name:"\u5224\u65AD\u9898",id:2,count:"q_judges",score:"q_judges_scores"},{name:"\u586B\u7A7A\u9898",id:3,count:"q_nulls",score:"q_nulls_scores"},{name:"\u7B80\u7B54\u9898",id:4,count:"q_mains",score:"q_mains_scores"},{name:"\u5B9E\u8BAD\u9898",id:5,count:"q_shixuns",score:"q_shixuns_scores"},{name:"\u7F16\u7A0B\u9898",id:6,count:"q_pros",score:"q_pros_scores"},{name:"\u7EC4\u5408\u9898",id:7,count:"q_combinations",score:"q_combinations_scores"}];Object(l.useEffect)(function(){return bi({type:"globalSetting/footerToggle",payload:!1}),function(){bi({type:"globalSetting/footerToggle",payload:!0})}},[]),Object(l.useEffect)(function(){var Kt,Lt,yt;if(Ln!=null&&(Kt=Ln.editData)!==null&&Kt!==void 0&&Kt.exercise_question_types){var It,Ot,Vt,Zt,Gt,Ut,vn,_n,un,cn,bn,dn,Mt,Yt;si(Object(W.cloneDeep)(Ln==null||((It=Ln.editData)===null||It===void 0)?void 0:It.exercise_question_types)),dt.current=Object(W.cloneDeep)(Ln==null||((Ot=Ln.editData)===null||Ot===void 0)?void 0:Ot.exercise_question_types);var qt={exercise_name:(Vt=Ln.editData)===null||Vt===void 0||((Zt=Vt.exercise)===null||Zt===void 0)?void 0:Zt.exercise_name,time:(Gt=Ln.editData)===null||Gt===void 0||((Ut=Gt.exercise)===null||Ut===void 0)?void 0:Ut.time,difficulty:(vn=Ln.editData)===null||vn===void 0||((_n=vn.exercise)===null||_n===void 0)?void 0:_n.difficulty,exercise_description:(un=Ln.editData)===null||un===void 0||((cn=un.exercise)===null||cn===void 0)?void 0:cn.exercise_description};(!((bn=Ln.editData)!==null&&bn!==void 0&&(dn=bn.exercise)!==null&&dn!==void 0&&dn.time)||((Mt=Ln.editData)===null||Mt===void 0||((Yt=Mt.exercise)===null||Yt===void 0)?void 0:Yt.time)===-1)&&delete qt.time,Ft.setFieldsValue(qt)}var Wt=(Lt=Ln.editData)===null||Lt===void 0||((yt=Lt.exercise)===null||yt===void 0)?void 0:yt.sub_discipline_id;Wt&&Fn(Wt)},[Ln.editData]),Object(l.useEffect)(function(){var Kt,Lt,yt=[],It=(Kt=Ln.editData)===null||Kt===void 0||((Lt=Kt.exercise)===null||Lt===void 0)?void 0:Lt.sub_discipline_id;hi.courseOptions.map(function(Ot){var Vt;Ot.value===It&&yt.push(It),Ot==null||((Vt=Ot.children)===null||Vt===void 0)||Vt.map(function(Zt){Zt.value===It&&(yt=[Ot.value,Zt.value])})}),Ft.setFieldsValue({courseid:Object(w.a)(yt)})},[hi.courseOptions]);var Fn=function(){var Kt=Object(S.a)(d.a.mark(function Lt(yt){return d.a.wrap(function(Ot){for(;;)switch(Ot.prev=Ot.next){case 0:return Ot.next=2,bi({type:"exercise/getTagDiscipline",payload:{sub_discipline_id:yt}});case 2:case"end":return Ot.stop()}},Lt)}));return function(yt){return Kt.apply(this,arguments)}}();Object(l.useEffect)(function(){Qt()},[yi.categoryId]);var Qt=function(){var Kt=Object(S.a)(d.a.mark(function Lt(){return d.a.wrap(function(It){for(;;)switch(It.prev=It.next){case 0:return It.next=2,bi({type:"exercise/getExerciseExportHeadData",payload:{id:yi.exerciseId||yi.categoryId,identify:yi.userId||null}});case 2:return It.next=4,bi({type:"exercise/editExercise",payload:Object(A.a)({},yi)});case 4:return It.next=6,bi({type:"problemset/getEditDisciplines",payload:{source:"new_question"}});case 6:case"end":return It.stop()}},Lt)}));return function(){return Kt.apply(this,arguments)}}(),hn=function(){var Kt=Object(S.a)(d.a.mark(function Lt(){var yt,It,Ot;return d.a.wrap(function(Zt){for(;;)switch(Zt.prev=Zt.next){case 0:return Zt.next=2,Ft.validateFields();case 2:return Ot=Ft.getFieldValue(),Ot.is_md=!0,Ot.exerciseId=(yt=Ln.editData)===null||yt===void 0||((It=yt.exercise)===null||It===void 0)?void 0:It.id,Ot.sub_discipline_id=Ot.courseid[Ot.courseid.length-1],_e(!1),Zt.next=9,Object(K.O)(Object(A.a)({},Ot));case 9:kt(-1),bi({type:"exercise/editExercise",payload:Object(A.a)({},yi)}),on(yi.categoryId),Qt();case 13:case"end":return Zt.stop()}},Lt)}));return function(){return Kt.apply(this,arguments)}}();function on(Kt){return Nt.apply(this,arguments)}function Nt(){return Nt=Object(S.a)(d.a.mark(function Kt(Lt){var yt;return d.a.wrap(function(Ot){for(;;)switch(Ot.prev=Ot.next){case 0:if(Vn!=null&&Vn.ec_point_ids){Ot.next=2;break}return Ot.abrupt("return");case 2:return Ot.next=4,Object(N.a)("/api/ec_courses/".concat(Vn==null?void 0:Vn.ec_course_id,"/ec_points/set_work_points.json"),{method:"post",body:Object(A.a)({exercise_id:Lt},Vn)});case 4:yt=Ot.sent;case 5:case"end":return Ot.stop()}},Kt)})),Nt.apply(this,arguments)}var $n=function(){var Kt=Object(S.a)(d.a.mark(function Lt(yt){var It,Ot,Vt,Zt,Gt,Ut,vn;return d.a.wrap(function(un){for(;;)switch(un.prev=un.next){case 0:if(!(ft!==-1)){un.next=3;break}return f.b.error("\u4E0D\u80FD\u540C\u65F6\u7F16\u8F91\u4E24\u9898"),un.abrupt("return");case 3:if(!(yt===5)){un.next=7;break}bi({type:"classroomList/setActionTabs",payload:{key:"\u9009\u7528\u5B9E\u8DF5\u9879\u76EE"}}),un.next=21;break;case 7:if(!(yt===6)){un.next=11;break}Fi.push("/problems/new?difficult=".concat((It=Ln.editData)===null||It===void 0||((Ot=It.exercise)===null||Ot===void 0)?void 0:Ot.difficulty,"&sub_discipline_id=").concat((Vt=Ln.editData)===null||Vt===void 0||((Zt=Vt.exercise)===null||Zt===void 0)?void 0:Zt.sub_discipline_id,"&express_id=").concat(yi.categoryId,"&callback_url=").concat(location.pathname)),un.next=21;break;case 11:if(Ut=ue.find(function(cn){return cn.question_type===yt}),Ut){un.next=18;break}return dt.current=Object(W.cloneDeep)(ue),ue.push({name:Hn.find(function(cn){return cn.id===yt}).name,question_type:yt,count:0,score:0,items:[{key:1,insert_id:1,question_type:yt}]}),si(Object(w.a)(ue)),kt("".concat(yt,"-",1)),un.abrupt("return");case 18:setTimeout(function(){var cn;(cn=document.getElementById("".concat(yt,"-").concat(Ut.count-1)))===null||cn===void 0||cn.scrollIntoView()},400),vn={key:Ut.count,insert_id:(Gt=Ut.items[Ut.count])===null||Gt===void 0?void 0:Gt.question_id,question_type:yt},Tn(vn);case 21:case"end":return un.stop()}},Lt)}));return function(yt){return Kt.apply(this,arguments)}}(),jn=function(){kt(-1),si(dt.current)},Tn=function(){var Lt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(dt.current=Object(W.cloneDeep)(ue),Lt.question_type===6){var yt,It,Ot,Vt;return Fi.push("/problems/new?difficult=".concat((yt=Ln.editData)===null||yt===void 0||((It=yt.exercise)===null||It===void 0)?void 0:It.difficulty,"&sub_discipline_id=").concat((Ot=Ln.editData)===null||Ot===void 0||((Vt=Ot.exercise)===null||Vt===void 0)?void 0:Vt.sub_discipline_id,"&express_id=").concat(yi.categoryId,"&callback_url=").concat(location.pathname)),!1}ue.map(function(Zt){if(Zt.question_type===Lt.question_type){var Gt=Object(W.cloneDeep)(Zt.items);Gt.splice(Lt==null?void 0:Lt.key,0,Object(A.a)({insert_id:Lt==null?void 0:Lt.insert_id},Lt)),Zt.items=Gt}return Zt}),si(Object(w.a)(ue)),kt("".concat(Lt.question_type,"-").concat(Lt.key+1))},qn={ref:an,editKey:ft,hideAction:!1,cancelAdd:function(){return jn()},setEditKey:function(Lt){return kt(Lt)},addCallback:function(Lt){return Tn(Lt)}},En=function(Lt,yt,It,Ot,Vt){var Zt=new FormData;Object.keys(Lt).forEach(function(Ut){Zt.append(Ut,Lt[Ut])});var Gt=new window.XMLHttpRequest;return Gt.withCredentials=!0,Gt.addEventListener("load",function(Ut){var vn;It(JSON.parse(Ut==null||((vn=Ut.target)===null||vn===void 0)?void 0:vn.response))},!1),Gt.addEventListener("error",function(Ut){Vt&&Vt(Ut)},!1),Gt.upload.onprogress=function(Ut){Ot&&Ot(Ut)},Gt.open("POST",yt),Gt.send(Zt),Gt},In=function(){var Kt=Object(S.a)(d.a.mark(function Lt(yt,It){var Ot,Vt;return d.a.wrap(function(Gt){for(;;)switch(Gt.prev=Gt.next){case 0:if(!(yt.length===0)){Gt.next=4;break}return f.b.warn("\u8BF7\u4E0A\u4F20\u6587\u4EF6"),It(),Gt.abrupt("return");case 4:Vt={id:yi==null?void 0:yi.categoryId,file:(Ot=yt[0])===null||Ot===void 0?void 0:Ot.file},En(Vt,"".concat(Xt.a.API_SERVER,"/api/courses/").concat(yi==null?void 0:yi.coursesId,"/exercises/import_exercise.json"),function(Ut){if((Ut==null?void 0:Ut.status)===0){var vn,_n={};Ut==null||((vn=Ut.fail)===null||vn===void 0)||vn.forEach(function(cn){var bn,dn=(bn=Object.keys(_n))===null||bn===void 0?void 0:bn.includes(cn.message);dn?_n[cn.message]=_n[cn.message]+1:_n[cn.message]=1});var un="\u6210\u529F\u5BFC\u5165".concat(Ut==null?void 0:Ut.success,"\u6761");Object.keys(_n).forEach(function(cn){un=un+",".concat(cn).concat(_n[cn],"\u6761")}),f.b.success(un),Q(!1),Qt()}(Ut==null?void 0:Ut.status)===-1&&(f.b.error(Ut==null?void 0:Ut.message),It())});case 6:case"end":return Gt.stop()}},Lt)}));return function(yt,It){return Kt.apply(this,arguments)}}(),gn=function(){var Kt=Object(S.a)(d.a.mark(function Lt(yt,It){var Ot;return d.a.wrap(function(Zt){for(;;)switch(Zt.prev=Zt.next){case 0:return Zt.next=2,Object(N.a)("/api/exercises/".concat(yi==null?void 0:yi.categoryId,"/sort_question_type.json"),{method:"post",body:{question_type:yt}});case 2:Ot=Zt.sent,(Ot==null?void 0:Ot.status)===0&&(f.b.success(Ot==null?void 0:Ot.message),oe(!1),Qt()),It();case 5:case"end":return Zt.stop()}},Lt)}));return function(yt,It){return Kt.apply(this,arguments)}}(),Bn=function(){if(ft!==-1){f.b.error("\u8BF7\u5148\u4FDD\u5B58\u6216\u53D6\u6D88\u5F53\u524D\u6B63\u5728\u7F16\u8F91\u7684\u95EE\u9898\u3002");return}Q(!0)},Xn=function(){var Kt=Object(S.a)(d.a.mark(function Lt(yt,It){var Ot,Vt,Zt;return d.a.wrap(function(Ut){for(;;)switch(Ut.prev=Ut.next){case 0:return dt.current=Object(W.cloneDeep)(ue),Ot=ue.findIndex(function(vn){return vn.question_type===It}),Vt=ue,Vt[Ot].items=yt,si(Object(w.a)(Vt)),Ut.next=7,Object(N.a)("/api/exercises/".concat(yi==null?void 0:yi.categoryId,"/adjust_position.json"),{method:"post",body:{question_ids:yt.map(function(vn){return vn==null?void 0:vn.question_id})}});case 7:Zt=Ut.sent,(Zt==null?void 0:Zt.status)!==0&&si(dt.current);case 9:case"end":return Ut.stop()}},Lt)}));return function(yt,It){return Kt.apply(this,arguments)}}(),Zn=function(){var Kt=Object(S.a)(d.a.mark(function Lt(){var yt,It,Ot;return d.a.wrap(function(Zt){for(;;)switch(Zt.prev=Zt.next){case 0:return Zt.next=2,Object(K.Y)(Object(A.a)(Object(A.a)({},yi),{},{is_reset:1}));case 2:It=Zt.sent,It!=null&&(yt=It.exercise)!==null&&yt!==void 0&&yt.id&&Fi.push("/classrooms/".concat(yi.coursesId,"/exercise/").concat(yi.categoryId,"/").concat((Ot=vi.userInfo)===null||Ot===void 0?void 0:Ot.login,"/initate_answer"));case 4:case"end":return Zt.stop()}},Lt)}));return function(){return Kt.apply(this,arguments)}}();return h.a.createElement("div",null,h.a.createElement("section",{className:"edu-container minH500"},h.a.createElement(Z.a,{spinning:Qn["exercise/editExercise"]||Qn["exercise/getExerciseExportHeadData"],size:"large",style:{position:"fixed",maxHeight:"100vh"},className:"mt30"},h.a.createElement("section",{className:"animated fadeIn"},h.a.createElement("aside",{className:"mt10"},ai&&h.a.createElement(t.a,{separator:">"},h.a.createElement(t.a.Item,null,h.a.createElement(b.a,{to:"/classrooms/".concat(yi.coursesId,"/exercise")},ai==null||((le=ai.course)===null||le===void 0)?void 0:le.course_name)),h.a.createElement(t.a.Item,null,h.a.createElement(b.a,{to:"/classrooms/".concat(yi.coursesId,"/exercise")},"\u8BD5\u5377\u5217\u8868")),h.a.createElement(t.a.Item,null,"\u7F16\u8F91\u8BD5\u5377"))),h.a.createElement("aside",{className:[ut.a.title,"mt20"].join(" ")},h.a.createElement(o.a,{style:{width:"100%"}},h.a.createElement(r.a,{flex:"1"},h.a.createElement("strong",{className:"font20 ml5"},"\u7F16\u8F91\u8BD5\u5377")),h.a.createElement(r.a,null,h.a.createElement(b.a,{className:"font16 c-light-black",to:"/classrooms/".concat(yi.coursesId,"/exercise")},"\u8FD4\u56DE"))))),h.a.createElement("section",{className:[ut.a.bg,"pt30","pl30","pr30","pb60","mt20"].join(" ")},!Ie&&h.a.createElement(bt,{setIsEdit:_e,isExportBlank:!1}),Ie&&h.a.createElement(O.a,{layout:"vertical",form:Ft,className:ut.a.formWrap},h.a.createElement(O.a.Item,{label:"\u65B9\u5411&\u8BFE\u7A0B\uFF1A",name:"courseid",labelCol:{span:5},wrapperCol:{span:5},rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u8BFE\u7A0B"}]},h.a.createElement(_.a,{disabled:((he=Ln.editData)===null||he===void 0||((Se=he.exercise)===null||Se===void 0)?void 0:Se.exercise_status)!==1,placeholder:"\u8BF7\u9009\u62E9...",options:hi.courseOptions})),h.a.createElement(O.a.Item,{name:"exercise_name",label:"\u8BD5\u5377\u540D\u79F0\uFF1A",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u8BD5\u5377\u540D\u79F0"}]},h.a.createElement(D.a,{maxLength:60,placeholder:"\u8BD5\u5377\u6807\u9898\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26"})),h.a.createElement("div",{style:{display:"flex"}},h.a.createElement(O.a.Item,{name:"time",label:"\u7B54\u9898\u65F6\u957F"},h.a.createElement(X.a,{min:1,max:9999,disabled:((ve=Ln.editData)===null||ve===void 0||((Pe=ve.exercise)===null||Pe===void 0)?void 0:Pe.exercise_status)!==1,style:{width:110},maxLength:60,placeholder:"\u8BF7\u586B\u5199\u7B54\u9898\u65F6\u957F"})),h.a.createElement("span",{style:{marginLeft:"10px",width:"40px",lineHeight:"32px",marginTop:23}},"\u5206\u949F")),h.a.createElement(O.a.Item,{label:"\u96BE\u5EA6\uFF1A",name:"difficulty",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u96BE\u5EA6"}]},h.a.createElement(M.a.Group,{disabled:((it=Ln.editData)===null||it===void 0||((xt=it.exercise)===null||xt===void 0)?void 0:xt.exercise_status)!==1},h.a.createElement(M.a.Button,{value:1},"\u7B80\u5355"),h.a.createElement(M.a.Button,{value:2},"\u9002\u4E2D"),h.a.createElement(M.a.Button,{value:3},"\u56F0\u96BE"))),h.a.createElement(O.a.Item,{label:"\u8BD5\u5377\u987B\u77E5\uFF1A",name:"exercise_description"},h.a.createElement(D.a.TextArea,{disabled:(($t=Ln.editData)===null||$t===void 0||((mn=$t.exercise)===null||mn===void 0)?void 0:mn.exercise_status)!==1,maxLength:65535,rows:6,placeholder:"\u8BF7\u5728\u6B64\u8F93\u5165\u672C\u6B21\u8BD5\u5377\u7B54\u9898\u7684\u76F8\u5173\u8BF4\u660E\uFF0C\u6700\u5927\u9650\u523665535\u4E2A\u5B57\u7B26"})),h.a.createElement(nt.a,{setitem:function(Lt){return fi(Object(A.a)({},Lt))},exercise_id:yi.categoryId}),h.a.createElement(O.a.Item,{className:"tr"},h.a.createElement(ee.a,{type:"primary",onClick:function(){hn()}},"\u4FDD\u5B58"),h.a.createElement(ee.a,{style:{marginLeft:10},onClick:function(){var Lt;if(_e(!1),Ln!=null&&(Lt=Ln.editData)!==null&&Lt!==void 0&&Lt.exercise_question_types){var yt,It,Ot,Vt,Zt,Gt,Ut,vn,_n,un,cn,bn,dn;si(Object(w.a)(Ln==null||((yt=Ln.editData)===null||yt===void 0)?void 0:yt.exercise_question_types));var Mt={exercise_name:(It=Ln.editData)===null||It===void 0||((Ot=It.exercise)===null||Ot===void 0)?void 0:Ot.exercise_name,time:(Vt=Ln.editData)===null||Vt===void 0||((Zt=Vt.exercise)===null||Zt===void 0)?void 0:Zt.time,difficulty:(Gt=Ln.editData)===null||Gt===void 0||((Ut=Gt.exercise)===null||Ut===void 0)?void 0:Ut.difficulty,exercise_description:(vn=Ln.editData)===null||vn===void 0||((_n=vn.exercise)===null||_n===void 0)?void 0:_n.exercise_description};(!((un=Ln.editData)!==null&&un!==void 0&&(cn=un.exercise)!==null&&cn!==void 0&&cn.time)||((bn=Ln.editData)===null||bn===void 0||((dn=bn.exercise)===null||dn===void 0)?void 0:dn.time)===-1)&&delete Mt.time,Ft.setFieldsValue(Mt)}}},"\u53D6\u6D88")))),ue!=""&&h.a.createElement("section",{className:[ut.a.bg,"pt30","pl20","pr20","pb20","mt20"].join(" ")},h.a.createElement(en.a,{data:ue,editorProps:qn,isDragDisabled:ft!==-1,onDragEnd:Xn,batchScore:["\u5355\u9009\u9898","\u591A\u9009\u9898","\u5224\u65AD\u9898","\u586B\u7A7A\u9898","\u7B80\u7B54\u9898","\u7F16\u7A0B\u9898"],reload:Qt})),h.a.createElement(ot,{callback:function(Lt,yt,It){var Ot;dt.current=Object(W.cloneDeep)(ue);var Vt={shixun:Lt.challenge_names.map(function(Ut){return{challenge_name:Ut,challenge_score:5}}),shixun_name:Lt==null||((Ot=Lt.title)===null||Ot===void 0)?void 0:Ot.replace(/<.*?>/ig,""),shixun_id:Lt.id,question_type:5,edit:!0,is_copy:It};if(yt&&(ue.map(function(Ut){if(Ut.question_type===5){var vn=Object(W.cloneDeep)(Ut.items);vn.splice(yt==null?void 0:yt.key,0,Vt),Ut.items=vn}return Ut}),kt("5-".concat(ue.key+1)),si(Object(w.a)(ue))),!yt){var Zt,Gt=ue.find(function(Ut){return Ut.question_type===5});if(!Gt){ue.push({name:Hn.find(function(Ut){return Ut.id===5}).name,question_type:5,count:0,score:0,items:[Vt]}),si(Object(w.a)(ue)),kt("".concat(5,"-",1));return}(Zt=document.getElementById("".concat(5,"-",Gt.count-1)))===null||Zt===void 0||Zt.scrollIntoView({block:"center",inline:"nearest"}),Gt.items.push(Vt),si(Object(w.a)(ue)),kt("".concat(5,"-",Gt.count))}}})),h.a.createElement(Et.a,{visible:Pn,onCancel:function(){return Q(!1)},onOk:In}),h.a.createElement(_t.a,{visible:z,onCancel:function(){return oe(!1)},onOk:gn,data:(rn=Ln.editData)===null||rn===void 0||((ci=rn.exercise)===null||ci===void 0)?void 0:ci.sort_by_qustion_type})),h.a.createElement("section",{style:{display:"flex",width:"100%",position:"fixed",bottom:0,height:70,boxShadow:"rgb(0 0 0 / 5%) 0px -4px 4px 0px",zIndex:666},className:[ut.a.bg,"pt30","pl30","pr30","pb30","mt20"].join(" ")},h.a.createElement("div",{style:{width:"1200px",margin:"0px auto",display:"flex",alignItems:"center"}},((Jn=Ln.editData)===null||Jn===void 0||((Sn=Jn.exercise)===null||Sn===void 0)?void 0:Sn.exercise_status)==1&&h.a.createElement(ee.a,{style:{height:30,marginRight:10,width:104},type:"primary",onClick:function(){Fi.push("/classrooms/".concat(yi==null?void 0:yi.coursesId,"/exercise/").concat(yi==null?void 0:yi.categoryId,"/preview_select"))}},"\u4ECE\u9898\u5E93\u4E2D\u9009\u62E9"),((pi=Ln.editData)===null||pi===void 0||((gi=pi.exercise)===null||gi===void 0)?void 0:gi.exercise_status)==1&&h.a.createElement(ee.a,{style:{height:30,marginRight:27,width:104},type:"primary",onClick:Bn},"\u6279\u91CF\u5BFC\u5165\u8BD5\u9898"),h.a.createElement("div",{style:{marginRight:"27px",height:"30px",width:1,background:"#F5F5F5"}}),h.a.createElement("div",{style:{display:"flex",marginRight:27}},((xi=Ln.editData)===null||xi===void 0||((_i=xi.exercise)===null||_i===void 0)?void 0:_i.exercise_status)===1&&Hn.map(function(Kt){return h.a.createElement("span",{style:{visibility:Kt.id===7?"hidden":"visible"},key:Kt.id,className:ut.a.button,onClick:function(){return $n(Kt.id)}},h.a.createElement("i",{className:"iconfont icon-tianjiashitixiaojiahao mr5",style:{fontSize:"10px",color:"#B1BACD"}}),Kt.name)})),h.a.createElement("div",{style:{marginRight:"25px",height:"30px",width:1,background:"#F5F5F5"}}),((Dn=Ln.editData)===null||Dn===void 0||((Ai=Dn.exercise)===null||Ai===void 0)?void 0:Ai.exercise_status)===1&&h.a.createElement(h.a.Fragment,null,h.a.createElement(ee.a,{style:{width:96,height:30,border:"1px solid #98BDF7",color:"#145DFF"},className:"mr8",onClick:function(){return oe(!0)}},h.a.createElement("i",{className:"iconfont icon-tixingpaixu mr8",style:{fontSize:"14px",color:"#98BDF7"}}),"\u9898\u578B\u6392\u5E8F")),h.a.createElement(ee.a,{style:{width:96,height:30,border:"1px solid #98BDF7",color:"#145DFF"},className:"mr8"},h.a.createElement(b.a,{to:"/classrooms/".concat(yi==null?void 0:yi.coursesId,"/exercise/").concat(yi==null?void 0:yi.categoryId,"/detail?random=false&tabs=2")},h.a.createElement("i",{className:"iconfont icon-yulan mr8",style:{fontSize:"14px",color:"#98BDF7"}}),"\u9884\u89C8")),Object(Oe.c)()&&h.a.createElement(ee.a,{style:{width:96,height:30,border:"1px solid #98BDF7",color:"#145DFF"},onClick:Object(W.throttle)(Zn,3500)},h.a.createElement("i",{className:"iconfont icon-monikaoshi1 mr8",style:{fontSize:"14px",color:"#98BDF7"}}),"\u6A21\u62DF\u8003\u8BD5"))))},Ue=st.default=Object(F.a)(function(Ae){var Re=Ae.exercise,le=Ae.loading,he=Ae.user,Se=Ae.problemset,ve=Ae.globalSetting;return{exercise:Re,globalSetting:ve,user:he,problemset:Se,loading:le.effects}})(vt)},ELLl:function(zt,st,V){(function(ie){ie(V("VrN/"))})(function(ie){var Z={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},U=ie.Pos;ie.defineOption("autoCloseBrackets",!1,function(u,r,i){i&&i!=ie.Init&&(u.removeKeyMap(H),u.state.closeBrackets=null),r&&(M(ee(r,"pairs")),u.state.closeBrackets=r,u.addKeyMap(H))});function ee(u,r){return r=="pairs"&&typeof u=="string"?u:typeof u=="object"&&u[r]!=null?u[r]:Z[r]}var H={Backspace:k,Enter:D};function M(u){for(var r=0;r<u.length;r++){var i=u.charAt(r),t="'"+i+"'";H[t]||(H[t]=Y(i))}}M(Z.pairs+"`");function Y(u){return function(r){return _(r,u)}}function X(u){var r=u.state.closeBrackets;if(!r||r.override)return r;var i=u.getModeAt(u.getCursor());return i.closeBrackets||r}function k(u){var r=X(u);if(!r||u.getOption("disableInput"))return ie.Pass;for(var i=ee(r,"pairs"),t=u.listSelections(),c=0;c<t.length;c++){if(!t[c].empty())return ie.Pass;var f=p(u,t[c].head);if(!f||i.indexOf(f)%2!=0)return ie.Pass}for(var c=t.length-1;c>=0;c--){var A=t[c].head;u.replaceRange("",U(A.line,A.ch-1),U(A.line,A.ch+1),"+delete")}}function D(u){var r=X(u),i=r&&ee(r,"explode");if(!i||u.getOption("disableInput"))return ie.Pass;for(var t=u.listSelections(),c=0;c<t.length;c++){if(!t[c].empty())return ie.Pass;var f=p(u,t[c].head);if(!f||i.indexOf(f)%2!=0)return ie.Pass}u.operation(function(){var A=u.lineSeparator()||`
|
|
`;u.replaceSelection(A+A,null),u.execCommand("goCharLeft"),t=u.listSelections();for(var S=0;S<t.length;S++){var w=t[S].head.line;u.indentLine(w,null,!0),u.indentLine(w+1,null,!0)}})}function v(u){var r=ie.cmpPos(u.anchor,u.head)>0;return{anchor:new U(u.anchor.line,u.anchor.ch+(r?-1:1)),head:new U(u.head.line,u.head.ch+(r?1:-1))}}function _(u,r){var i=X(u);if(!i||u.getOption("disableInput"))return ie.Pass;var t=ee(i,"pairs"),c=t.indexOf(r);if(c==-1)return ie.Pass;for(var f=ee(i,"closeBefore"),A=ee(i,"triples"),S=t.charAt(c+1)==r,w=u.listSelections(),R=c%2==0,O,E=0;E<w.length;E++){var y=w[E],d=y.head,l,h=u.getRange(d,U(d.line,d.ch+1));if(R&&!y.empty())l="surround";else if((S||!R)&&h==r)S&&o(u,d)?l="both":A.indexOf(r)>=0&&u.getRange(d,U(d.line,d.ch+3))==r+r+r?l="skipThree":l="skip";else if(S&&d.ch>1&&A.indexOf(r)>=0&&u.getRange(U(d.line,d.ch-2),d)==r+r){if(d.ch>2&&/\bstring/.test(u.getTokenTypeAt(U(d.line,d.ch-2))))return ie.Pass;l="addFour"}else if(S){var g=d.ch==0?" ":u.getRange(U(d.line,d.ch-1),d);if(!ie.isWordChar(h)&&g!=r&&!ie.isWordChar(g))l="both";else return ie.Pass}else if(R&&(h.length===0||/\s/.test(h)||f.indexOf(h)>-1))l="both";else return ie.Pass;if(!O)O=l;else if(O!=l)return ie.Pass}var b=c%2?t.charAt(c-1):r,F=c%2?r:t.charAt(c+1);u.operation(function(){if(O=="skip")u.execCommand("goCharRight");else if(O=="skipThree")for(var N=0;N<3;N++)u.execCommand("goCharRight");else if(O=="surround"){for(var W=u.getSelections(),N=0;N<W.length;N++)W[N]=b+W[N]+F;u.replaceSelections(W,"around"),W=u.listSelections().slice();for(var N=0;N<W.length;N++)W[N]=v(W[N]);u.setSelections(W)}else O=="both"?(u.replaceSelection(b+F,null),u.triggerElectric(b+F),u.execCommand("goCharLeft")):O=="addFour"&&(u.replaceSelection(b+b+b+b,"before"),u.execCommand("goCharRight"))})}function p(u,r){var i=u.getRange(U(r.line,r.ch-1),U(r.line,r.ch+1));return i.length==2?i:null}function o(u,r){var i=u.getTokenAt(U(r.line,r.ch+1));return/\bstring/.test(i.type)&&i.start==r.ch&&(r.ch==0||!/\bstring/.test(u.getTokenTypeAt(r)))}})},GdJJ:function(zt,st,V){zt.exports={wrap:"wrap___vnH5d",img:"img___2gMpD",table:"table___x8lNx",totalScore:"totalScore___2bdv8",people:"people___r7_jV",glassSeal:"glassSeal___3lvC-"}},GfqC:function(zt,st,V){"use strict";var ie=V("q1tI"),Z=V.n(ie),U=V("TSYQ"),ee=V.n(U);function H(K,I){var x="cannot "+K.method+" "+K.action+" "+I.status+"'",j=new Error(x);return j.status=I.status,j.method=K.method,j.url=K.action,j}function M(K){var I=K.responseText||K.response;if(!I)return I;try{return JSON.parse(I)}catch(x){return I}}function Y(K){var I=new XMLHttpRequest;K.onProgress&&I.upload&&(I.upload.onprogress=function(ae){ae.total>0&&(ae.percent=ae.loaded/ae.total*100),K.onProgress(ae)});var x=new FormData;K.data&&Object.keys(K.data).forEach(function($){var ae=K.data[$];if(Array.isArray(ae)){ae.forEach(function(fe){x.append($+"[]",fe)});return}x.append($,K.data[$])}),K.file instanceof Blob?x.append(K.filename,K.file,K.file.name):x.append(K.filename,K.file),I.onerror=function(ae){K.onError(ae)},I.onload=function(){return I.status<200||I.status>=300?K.onError(H(K,I),M(I)):K.onSuccess(M(I),I)},I.open(K.method,K.action,!0),K.withCredentials&&"withCredentials"in I&&(I.withCredentials=!0);var j=K.headers||{};return j["X-Requested-With"]!==null&&I.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(j).forEach(function($){j[$]!==null&&I.setRequestHeader($,j[$])}),I.send(x),{abort:function(){I.abort()}}}var X=+new Date,k=0;function D(){return"rc-upload-"+X+"-"+ ++k}function v(K,I){return K.indexOf(I,K.length-I.length)!==-1}var _=function(K,I){if(K&&I){var x=Array.isArray(I)?I:I.split(","),j=K.name||"",$=K.type||"",ae=$.replace(/\/.*$/,"");return x.some(function(fe){var pe=fe.trim();return pe.charAt(0)==="."?v(j.toLowerCase(),pe.toLowerCase()):/\/\*$/.test(pe)?ae===pe.replace(/\/.*$/,""):$===pe})}return!0};function p(K,I){var x=K.createReader(),j=[];function $(){x.readEntries(function(ae){var fe=Array.prototype.slice.apply(ae);j=j.concat(fe);var pe=!fe.length;pe?I(j):$()})}$()}var o=function(I,x,j){var $=function ae(fe,pe){pe=pe||"",fe.isFile?fe.file(function(Ce){j(Ce)&&(fe.fullPath&&!Ce.webkitRelativePath&&(Object.defineProperties(Ce,{webkitRelativePath:{writable:!0}}),Ce.webkitRelativePath=fe.fullPath.replace(/^\//,""),Object.defineProperties(Ce,{webkitRelativePath:{writable:!1}})),x([Ce]))}):fe.isDirectory&&p(fe,function(Ce){Ce.forEach(function(De){ae(De,""+pe+fe.name+"/")})})};I.forEach(function(ae){$(ae.webkitGetAsEntry())})},u=o,r=Object.assign||function(K){for(var I=1;I<arguments.length;I++){var x=arguments[I];for(var j in x)Object.prototype.hasOwnProperty.call(x,j)&&(K[j]=x[j])}return K},i=function(){function K(I,x){var j=[],$=!0,ae=!1,fe=void 0;try{for(var pe=I[Symbol.iterator](),Ce;!($=(Ce=pe.next()).done)&&!(j.push(Ce.value),x&&j.length===x);$=!0);}catch(De){ae=!0,fe=De}finally{try{!$&&pe.return&&pe.return()}finally{if(ae)throw fe}}return j}return function(I,x){if(Array.isArray(I))return I;if(Symbol.iterator in Object(I))return K(I,x);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),t=function(){function K(I,x){for(var j=0;j<x.length;j++){var $=x[j];$.enumerable=$.enumerable||!1,$.configurable=!0,"value"in $&&($.writable=!0),Object.defineProperty(I,$.key,$)}}return function(I,x,j){return x&&K(I.prototype,x),j&&K(I,j),I}}();function c(K,I,x){return I in K?Object.defineProperty(K,I,{value:x,enumerable:!0,configurable:!0,writable:!0}):K[I]=x,K}function f(K,I){var x={};for(var j in K){if(I.indexOf(j)>=0)continue;if(!Object.prototype.hasOwnProperty.call(K,j))continue;x[j]=K[j]}return x}function A(K,I){if(!(K instanceof I))throw new TypeError("Cannot call a class as a function")}function S(K,I){if(!K)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:K}function w(K,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);K.prototype=Object.create(I&&I.prototype,{constructor:{value:K,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(K,I):K.__proto__=I)}var R=function(I){return Object.keys(I).reduce(function(x,j){return(j.substr(0,5)==="data-"||j.substr(0,5)==="aria-"||j==="role")&&(x[j]=I[j]),x},{})},O=function(K){w(I,K);function I(){var x,j,$,ae;A(this,I);for(var fe=arguments.length,pe=Array(fe),Ce=0;Ce<fe;Ce++)pe[Ce]=arguments[Ce];return ae=(j=($=S(this,(x=I.__proto__||Object.getPrototypeOf(I)).call.apply(x,[this].concat(pe))),$),$.state={uid:D()},$.reqs={},$.onChange=function(De){var xe=De.target.files;$.uploadFiles(xe),$.reset()},$.onClick=function(De){var xe=$.fileInput;if(!xe)return;var Oe=$.props,Ee=Oe.children,be=Oe.onClick;Ee&&Ee.type==="button"&&(xe.parentNode.focus(),xe.parentNode.querySelector("button").blur()),xe.click(),be&&be(De)},$.onKeyDown=function(De){De.key==="Enter"&&$.onClick()},$.onFileDrop=function(De){var xe=$.props.multiple;if(De.preventDefault(),De.type==="dragover")return;if($.props.directory)u(Array.prototype.slice.call(De.dataTransfer.items),$.uploadFiles,function(Ee){return _(Ee,$.props.accept)});else{var Oe=Array.prototype.slice.call(De.dataTransfer.files).filter(function(Ee){return _(Ee,$.props.accept)});xe===!1&&(Oe=Oe.slice(0,1)),$.uploadFiles(Oe)}},$.uploadFiles=function(De){var xe=Array.prototype.slice.call(De);xe.map(function(Oe){return Oe.uid=D(),Oe}).forEach(function(Oe){$.upload(Oe,xe)})},$.saveFileInput=function(De){$.fileInput=De},j),S($,ae)}return t(I,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(j,$){var ae=this,fe=this.props;if(!fe.beforeUpload)return setTimeout(function(){return ae.post(j)},0);var pe=fe.beforeUpload(j,$);pe&&pe.then?pe.then(function(Ce){var De=Object.prototype.toString.call(Ce);return De==="[object File]"||De==="[object Blob]"?ae.post(Ce):ae.post(j)}).catch(function(Ce){console.log(Ce)}):pe!==!1&&setTimeout(function(){return ae.post(j)},0);return}},{key:"post",value:function(j){var $=this;if(!this._isMounted)return;var ae=this.props,fe=ae.onStart,pe=ae.onProgress,Ce=ae.transformFile,De=Ce===void 0?function(xe){return xe}:Ce;new Promise(function(xe){var Oe=ae.action;return typeof Oe=="function"&&(Oe=Oe(j)),xe(Oe)}).then(function(xe){var Oe=j.uid,Ee=ae.customRequest||Y,be=Promise.resolve(De(j)).then(function(te){var me=ae.data;return typeof me=="function"&&(me=me(te)),Promise.all([te,me])}).catch(function(te){console.error(te)});be.then(function(te){var me=i(te,2),ye=me[0],Le=me[1],$e={action:xe,filename:ae.name,data:Le,file:ye,headers:ae.headers,withCredentials:ae.withCredentials,method:ae.method||"post",onProgress:pe?function(Me){pe(Me,j)}:null,onSuccess:function(ze,ot){delete $.reqs[Oe],ae.onSuccess(ze,j,ot)},onError:function(ze,ot){delete $.reqs[Oe],ae.onError(ze,ot,j)}};fe(j),$.reqs[Oe]=Ee($e)})})}},{key:"reset",value:function(){this.setState({uid:D()})}},{key:"abort",value:function(j){var $=this.reqs;if(j){var ae=j;j&&j.uid&&(ae=j.uid),$[ae]&&$[ae].abort&&$[ae].abort(),delete $[ae]}else Object.keys($).forEach(function(fe){$[fe]&&$[fe].abort&&$[fe].abort(),delete $[fe]})}},{key:"render",value:function(){var j,$=this.props,ae=$.component,fe=$.prefixCls,pe=$.className,Ce=$.disabled,De=$.id,xe=$.style,Oe=$.multiple,Ee=$.accept,be=$.children,te=$.directory,me=$.openFileDialogOnClick,ye=$.onMouseEnter,Le=$.onMouseLeave,$e=f($,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),Me=ee()((j={},c(j,fe,!0),c(j,fe+"-disabled",Ce),c(j,pe,pe),j)),ze=Ce?{}:{onClick:me?this.onClick:function(){},onKeyDown:me?this.onKeyDown:function(){},onMouseEnter:ye,onMouseLeave:Le,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return Z.a.createElement(ae,r({},ze,{className:Me,role:"button",style:xe}),Z.a.createElement("input",r({},R($e),{id:De,type:"file",ref:this.saveFileInput,onClick:function(Et){return Et.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:Ee,directory:te?"directory":null,webkitdirectory:te?"webkitdirectory":null,multiple:Oe,onChange:this.onChange})),be)}}]),I}(ie.Component),E=O,y=Object.assign||function(K){for(var I=1;I<arguments.length;I++){var x=arguments[I];for(var j in x)Object.prototype.hasOwnProperty.call(x,j)&&(K[j]=x[j])}return K},d=function(){function K(I,x){for(var j=0;j<x.length;j++){var $=x[j];$.enumerable=$.enumerable||!1,$.configurable=!0,"value"in $&&($.writable=!0),Object.defineProperty(I,$.key,$)}}return function(I,x,j){return x&&K(I.prototype,x),j&&K(I,j),I}}();function l(K,I){if(!(K instanceof I))throw new TypeError("Cannot call a class as a function")}function h(K,I){if(!K)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:K}function g(K,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);K.prototype=Object.create(I&&I.prototype,{constructor:{value:K,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(K,I):K.__proto__=I)}function b(){}var F=function(K){g(I,K);function I(){var x,j,$,ae;l(this,I);for(var fe=arguments.length,pe=Array(fe),Ce=0;Ce<fe;Ce++)pe[Ce]=arguments[Ce];return ae=(j=($=h(this,(x=I.__proto__||Object.getPrototypeOf(I)).call.apply(x,[this].concat(pe))),$),$.saveUploader=function(De){$.uploader=De},j),h($,ae)}return d(I,[{key:"abort",value:function(j){this.uploader.abort(j)}},{key:"render",value:function(){return Z.a.createElement(E,y({},this.props,{ref:this.saveUploader}))}}]),I}(ie.Component);F.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:b,onError:b,onSuccess:b,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var N=F,W=st.a=N},HmJG:function(zt,st,V){},IBYe:function(zt,st,V){"use strict";function ie(Z){return null}st.a=ie},LYsE:function(zt,st,V){"use strict";var ie=V("9og8"),Z=V("giR+"),U=V("fyUT"),ee=V("2qtc"),H=V("kLXV"),M=V("/zsF"),Y=V("PArb"),X=V("14J3"),k=V("BMrR"),D=V("+L6B"),v=V("2/Rp"),_=V("k1fw"),p=V("0Owb"),o=V("tJVT"),u=V("WmNS"),r=V.n(u),i=V("q1tI"),t=V.n(i),c=V("5Dmo"),f=V("3S7+"),A=V("5NDa"),S=V("5rEg"),w=V("jCWc"),R=V("kPKH"),O=V("BoS7"),E=V("Sdc0"),y=V("7Kak"),d=V("9yH6"),l=V("sRBo"),h=V("kaz8"),g=V("miYZ"),b=V("tsqr"),F=V("oBTY"),N=V("PpiC"),W=V("Ty5D"),K=V("9kvl"),I=V("V0Rq"),x=V("Ot1p"),j=V("kqOp"),$=V("7qnI"),ae=V("1vsH"),fe=V("YJx+"),pe=V.n(fe),Ce=V("9Bee"),De=V("u2Z1"),xe=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Oe="\u2581",Ee=function(Je,Ft){var Bt=Je.problemset,Fe=Je.globalSetting,ue=Je.exercise,si=Je.loading,je=Je.dispatch,Be=Je.editData,Ie=Je.editKey,_e=Je.setEditKey,An=_e===void 0?function(){}:_e,zn=Je.cancelAdd,Pn=zn===void 0?function(){}:zn,Q=Je.addCallback,C=Q===void 0?function(){}:Q,L=Je.reload,z=L===void 0?function(){}:L,oe=Je.setIsClaer,q=oe===void 0?function(){}:oe,ke=Object(N.a)(Je,["problemset","globalSetting","exercise","loading","dispatch","editData","editKey","setEditKey","cancelAdd","addCallback","reload","setIsClaer"]),ft=Object(i.useState)(""),kt=Object(o.a)(ft,2),an=kt[0],dt=kt[1],Pt=Object(i.useState)(""),tn=Object(o.a)(Pt,2),Vn=tn[0],fi=tn[1],Hn=Object(i.useState)([]),Fn=Object(o.a)(Hn,2),Qt=Fn[0],hn=Fn[1],on=Object(i.useState)(""),Nt=Object(o.a)(on,2),$n=Nt[0],jn=Nt[1],Tn=Object(i.useState)(),qn=Object(o.a)(Tn,2),En=qn[0],In=qn[1],gn=Object(i.useState)(!1),Bn=Object(o.a)(gn,2),Xn=Bn[0],Zn=Bn[1],Kt=Object(i.useState)(),Lt=Object(o.a)(Kt,2),yt=Lt[0],It=Lt[1],Ot=Object(i.useState)(0),Vt=Object(o.a)(Ot,2),Zt=Vt[0],Gt=Vt[1],Ut=Object(i.useState)(!1),vn=Object(o.a)(Ut,2),_n=vn[0],un=vn[1],cn=Object(i.useState)(!1),bn=Object(o.a)(cn,2),dn=bn[0],Mt=bn[1],Yt=Object(i.useState)([]),qt=Object(o.a)(Yt,2),Wt=qt[0],fn=qt[1],On=Object(i.useState)(1),wn=Object(o.a)(On,2),gt=wn[0],rt=wn[1],Xe=Object(i.useState)(!1),Ze=Object(o.a)(Xe,2),We=Ze[0],ct=Ze[1],et=Object(i.useRef)(!1),Ct=Object(W.i)(),jt=Object(i.useState)([]),wt=Object(o.a)(jt,2),Jt=wt[0],Tt=wt[1],At=function(oi){Tt([].concat(Object(F.a)(Jt),[Object(_.a)({},oi)]))};Object(i.useEffect)(function(){if(et.current)return;if(!(Be!=null&&Be.question_title)){un(!0),dt(""),In(!1),It(2),hn([]),jn(""),Zn(!1);return}dt(Be==null?void 0:Be.question_title),In(Be==null?void 0:Be.is_ordered),rt(Be==null?void 0:Be.difficulty),ct(!(Be!=null&&Be.repeat_answer)),It(Be==null?void 0:Be.question_score);var Ci=Be==null?void 0:Be.standard_answer.map(function(oi){return oi.answer_text});hn(Object(F.a)(Ci)),fn(Be.tag_discipline_ids),fi(Be==null?void 0:Be.analysis)},[Be,_n]),Object(i.useEffect)(function(){Zn(!1),_n&&Ci();function Ci(){return oi.apply(this,arguments)}function oi(){return oi=Object(ie.a)(r.a.mark(function wi(){var Ei,Ti,Ni;return r.a.wrap(function(Ui){for(;;)switch(Ui.prev=Ui.next){case 0:return Ui.next=2,Object(I.I)({sub_discipline_id:(Ei=ue.editData)===null||Ei===void 0||((Ti=Ei.exercise)===null||Ti===void 0)?void 0:Ti.sub_discipline_id});case 2:Ni=Ui.sent,Tt(Ni.tag_disciplines);case 4:case"end":return Ui.stop()}},wi)})),oi.apply(this,arguments)}},[_n]),Object(i.useImperativeHandle)(Ft,function(){return{onSave:yn,isEdit:_n}}),Object(i.useEffect)(function(){var Ci,oi=ue!=null&&(Ci=ue.tagDisciplineData)!==null&&Ci!==void 0&&Ci.tag_disciplines&&Array.isArray(ue.tagDisciplineData.tag_disciplines)?ue.tagDisciplineData.tag_disciplines:[];Tt(oi)},[ue.tagDisciplineData]);var Rn=function(oi){(oi==null?void 0:oi.status)===0&&(b.b.success("\u4FDD\u5B58\u6210\u529F"),un(!1),An(-1),et.current=!1,z())},yn=function(){var Ci=Object(ie.a)(r.a.mark(function oi(){var wi,Ei,Ti,Ni,Vi,Ui,Ii;return r.a.wrap(function(Ki){for(;;)switch(Ki.prev=Ki.next){case 0:if(wi=[],Ei=!1,Mt(!0),Qt.forEach(function(Sr,Ji){wi.push({choice_id:Ji+1,answer_text:[]}),Sr.forEach(function(er,yr){wi[Ji].answer_text.push(er),(!er||!Object(ae.db)(er,1e4))&&(jn("".concat(Ji,"-").concat(yr)),b.b.info(er?"\u7B54\u6848\u4E0D\u80FD\u8D85\u8FC710000\u5B57\u7B26":"\u7B54\u6848\uFF1A\u4E0D\u80FD\u4E3A\u7A7A"),Ei=!0)})}),!Ei){Ki.next=7;break}return Mt(!1),Ki.abrupt("return",!1);case 7:if(et.current=!0,!Be.question_id){Ki.next=19;break}if(!((Be==null?void 0:Be.is_my)===1)){Ki.next=13;break}H.a.confirm({title:"\u63D0\u793A",content:"\u6B64\u9898\u76EE\u5DF2\u5B58\u5728\u4E8E\u8BD5\u9898\u5E93\uFF0C\u662F\u5426\u5C06\u4FEE\u6539\u540E\u7684\u9898\u76EE\u8986\u76D6\u8BD5\u9898\u5E93\u7684\u539F\u9898\uFF1F",okText:"\u8986\u76D6\u539F\u9898",cancelText:"\u4E0D\u8986\u76D6",keyboard:!1,onOk:function(){var Sr=Object(ie.a)(r.a.mark(function er(){var yr,Or;return r.a.wrap(function(fr){for(;;)switch(fr.prev=fr.next){case 0:return fr.next=2,je({type:"exercise/editExerciseQuestion",payload:{id:Be.question_id,question_title:an,question_type:3,question_score:yt,is_ordered:En,standard_answers:wi,tag_discipline_ids:Wt,sub_discipline_id:(yr=ue.editData)===null||yr===void 0||((Or=yr.exercise)===null||Or===void 0)?void 0:Or.sub_discipline_id,difficulty:gt,is_cover:1,repeat_answer:!We,analysis:Vn}});case 2:Ti=fr.sent,Rn(Ti);case 4:case"end":return fr.stop()}},er)}));function Ji(){return Sr.apply(this,arguments)}return Ji}(),onCancel:function(){var Sr=Object(ie.a)(r.a.mark(function er(){var yr,Or;return r.a.wrap(function(fr){for(;;)switch(fr.prev=fr.next){case 0:return fr.next=2,je({type:"exercise/editExerciseQuestion",payload:{id:Be.question_id,question_title:an,question_type:3,question_score:yt,is_ordered:En,standard_answers:wi,tag_discipline_ids:Wt,sub_discipline_id:(yr=ue.editData)===null||yr===void 0||((Or=yr.exercise)===null||Or===void 0)?void 0:Or.sub_discipline_id,difficulty:gt,repeat_answer:!We,analysis:Vn}});case 2:Ti=fr.sent,Rn(Ti);case 4:case"end":return fr.stop()}},er)}));function Ji(){return Sr.apply(this,arguments)}return Ji}()}),Ki.next=17;break;case 13:return Ki.next=15,je({type:"exercise/editExerciseQuestion",payload:{id:Be.question_id,question_title:an,question_type:3,question_score:yt,is_ordered:En,standard_answers:wi,tag_discipline_ids:Wt,sub_discipline_id:(Ni=ue.editData)===null||Ni===void 0||((Vi=Ni.exercise)===null||Vi===void 0)?void 0:Vi.sub_discipline_id,difficulty:gt,repeat_answer:!We,analysis:Vn}});case 15:Ti=Ki.sent,Rn(Ti);case 17:Ki.next=23;break;case 19:return Ki.next=21,je({type:"exercise/addExerciseQuestion",payload:{insert_id:Be==null?void 0:Be.insert_id,categoryId:Ct.categoryId,question_title:an,question_type:3,question_score:yt,is_ordered:En,standard_answers:wi,tag_discipline_ids:Wt,sub_discipline_id:(Ui=ue.editData)===null||Ui===void 0||((Ii=Ui.exercise)===null||Ii===void 0)?void 0:Ii.sub_discipline_id,difficulty:gt,repeat_answer:!We,analysis:Vn}});case 21:Ti=Ki.sent,Rn(Ti);case 23:return Mt(!1),Ki.abrupt("return",{name:an,analysis:Vn,standard_answers:wi,is_ordered:En});case 25:case"end":return Ki.stop()}},oi)}));return function(){return Ci.apply(this,arguments)}}(),mi=function(oi,wi,Ei){var Ti=Qt.slice();if(wi&&Ti.splice(oi,wi),Ei&&Xn||!Be.question_id)for(var Ni=0;Ni<Ei;Ni++)Ti.splice(oi+Ni,0,[""]);Gt(Ti==null?void 0:Ti.length),Zn(!0),console.log(Ti,"newStandardAnswers"),hn(Ti)},ei=function(oi,wi,Ei){jn("");var Ti=Qt.slice();Ti[oi][wi]=Ei,hn(Ti)},ti=function(oi){var wi=Qt.slice();wi[oi]=[].concat(Object(F.a)(wi[oi]),[""]),hn(wi)},nn=function(oi,wi){var Ei=Qt.slice();if(!Ei[oi][wi]){Ei[oi]=Ei[oi].filter(function(Ti,Ni){return Ni!==wi}),hn(Ei);return}H.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u53C2\u8003\u7B54\u6848\u5417\uFF1F",className:pe.a.modal,onOk:function(){Ei[oi]=Ei[oi].filter(function(Ni,Vi){return Vi!==wi}),hn(Ei)}})},kn=function(oi){H.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u53C2\u8003\u7B54\u6848\u5417\uFF1F",className:pe.a.modal,onOk:function(){var Ei=0;dt(an.replace(/\▁/g,function(Ti){return Ei++,Ei-1===oi?"":Ti})),setTimeout(function(){var Ti=Qt.slice();Ti=Qt.filter(function(Ni,Vi){return oi!==Vi}),hn(Ti)},500)}})},Yn=function(){},ni=function(){var oi,wi,Ei,Ti,Ni,Vi;return console.log(Qt,"answers"),t.a.createElement("aside",null,t.a.createElement("div",{className:pe.a.questionType},t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},"\u586B\u7A7A\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u5141\u8BB8\u624B\u52A8\u8C03\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848 \uFF1B\u652F\u6301\u6700\u591A5\u4E2A\u7A7A\uFF0C\u6BCF\u7A7A\u5F97\u5206\u6309\u7167\u672C\u9898\u7684\u603B\u5206\u5E73\u5747\u8BA1\u7B97\uFF09")),t.a.createElement("div",null,t.a.createElement(j.a,{id:"completion-question-tittle",placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE",height:155,defaultValue:an,onChange:function(Ii){return dt(Ii)},showNullButton:((oi=ue.editData)===null||oi===void 0||((wi=oi.exercise)===null||wi===void 0)?void 0:wi.exercise_status)===1,deleteEmptyDisabled:!(((Ei=ue.editData)===null||Ei===void 0||((Ti=Ei.exercise)===null||Ti===void 0)?void 0:Ti.exercise_status)===1)||dn,onPlaceholderChange:mi})),t.a.createElement("div",{className:"mt20"},Qt.map(function(Ui,Ii){var Tr,Ki;return t.a.createElement($.a,{key:Ii,answers:Ui,index:Ii,is_md:!0,exerciseIsPublish:((Tr=ue.editData)===null||Tr===void 0||((Ki=Tr.exercise)===null||Ki===void 0)?void 0:Ki.exercise_status)!==1,activeOptionErrorIndex:$n,onAnswerChange:ei,addChildAnswer:ti,deleteChildAnswer:nn,deleteChildAnswermain:kn})})),t.a.createElement("div",{className:"mt20"},Qt.length>1&&t.a.createElement("span",null,t.a.createElement(h.a,{checked:En,onChange:function(Ii){return In(Ii.target.checked)},className:"".concat(pe.a.color333," font14")},"\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"),t.a.createElement("span",{className:"".concat(pe.a.color999," font12")},"\uFF08\u9009\u4E2D\uFF0C\u6BCF\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u987A\u5E8F\u5FC5\u987B\u4E0E\u53C2\u8003\u7B54\u6848\u4E00\u81F4\uFF09"))),t.a.createElement("p",{className:pe.a.titleWrap},t.a.createElement("span",{className:pe.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),t.a.createElement(x.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Vn,onChange:function(Ii){return fi(Ii)}}),t.a.createElement("p",{className:""},t.a.createElement("span",{style:{color:"red"}},"*"),"\u5206\u503C\uFF1A",t.a.createElement(U.a,{value:yt,max:1e4,min:0,onChange:function(Ii){It(Ii)}})," \u5206 \xA0 ",!!yt&&!!Zt&&t.a.createElement("span",{style:{color:"red"}},"(\u6839\u636E\u5747\u5206\u89C4\u5219\uFF0C\u672C\u9898\u6BCF\u7A7A",(yt/Zt).toFixed(1),"\u5206)"),t.a.createElement("span",{style:{marginLeft:"30px"},className:pe.a.difficult},t.a.createElement("label",{style:{color:"red"}},"*")," \u96BE\u5EA6\uFF1A",t.a.createElement(d.a.Group,{value:gt,onChange:function(Ii){rt(Ii.target.value)}},t.a.createElement(d.a.Button,{value:1},"\u7B80\u5355"),t.a.createElement(d.a.Button,{value:2},"\u9002\u4E2D"),t.a.createElement(d.a.Button,{value:3},"\u56F0\u96BE")))),t.a.createElement("p",{className:pe.a.titleWrap},t.a.createElement("span",{className:"".concat(pe.a.title)},"\u77E5\u8BC6\u70B9\uFF1A",t.a.createElement("span",{className:pe.a.colorGray},"\uFF08\u6240\u6709\u81EA\u5EFA\u77E5\u8BC6\u70B9\u4EC5\u672C\u4EBA\u53EF\u89C1\uFF0C\u88ABEduCoder\u5E73\u53F0\u5BA1\u6838\u901A\u8FC7\u4E3A\u5B98\u65B9\u77E5\u8BC6\u70B9\u540E\u6240\u6709\u7528\u6237\u53EF\u89C1\uFF09")),t.a.createElement("div",{className:"mt5"},t.a.createElement(De.a,{value:Wt,selectvalues:Be==null?void 0:Be.tag_discipline_ids,onChange:fn,subId:(Ni=ue.editData)===null||Ni===void 0||((Vi=Ni.exercise)===null||Vi===void 0)?void 0:Vi.sub_discipline_id,knowledgeOptions:Jt,onAddKnowledgeFinish:At})),t.a.createElement("div",{style:{marginTop:10}},t.a.createElement("span",{style:{marginRight:10}},"\u4E0D\u5141\u8BB8\u5B66\u751F\u91CD\u590D\u7B54\u9898"),t.a.createElement(E.a,{checked:We,onChange:function(Ii){ct(Ii)}}))),t.a.createElement("aside",{className:"tr"},(Ie!==-1||Be.question_id)&&t.a.createElement(v.a,{type:"default",onClick:function(){Pn(),un(!1)}},"\u53D6\u6D88"),t.a.createElement(v.a,{className:"ml20",type:"primary",onClick:function(){yn()}},"\u4FDD\u5B58")))},Mn=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu current",id:"del"},{name:"(\u5411\u4E0B\u63D2\u5165\u5355\u9009\u9898)",icon:"iconfont c-light-primary ml30 icon-tianjia current",id:"add"},{name:"\u7F16\u8F91",icon:"iconfont c-light-primary ml30 icon-bianjishijuan3x current",id:"edit"}].filter(function(Ci){var oi,wi;return(ue==null||((oi=ue.editData)===null||oi===void 0||((wi=oi.exercise)===null||wi===void 0))?void 0:wi.exercise_status)===1?Ci:Ci.id!=="del"&&Ci.id!=="add"}),Li=function(){var Ci=Object(ie.a)(r.a.mark(function oi(wi){return r.a.wrap(function(Ti){for(;;)switch(Ti.prev=Ti.next){case 0:if(!(Ie!==-1)){Ti.next=3;break}return b.b.error("\u8BF7\u5148\u4FDD\u5B58\u6216\u53D6\u6D88\u5F53\u524D\u6B63\u5728\u7F16\u8F91\u7684\u95EE\u9898\u3002"),Ti.abrupt("return");case 3:Ti.t0=wi.id,Ti.next=Ti.t0==="del"?6:Ti.t0==="up"||Ti.t0==="down"?8:Ti.t0==="edit"?12:Ti.t0==="add"?15:17;break;case 6:return H.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u8BD5\u9898\u5417\uFF1F",onOk:function(){return Object(ie.a)(r.a.mark(function Vi(){return r.a.wrap(function(Ii){for(;;)switch(Ii.prev=Ii.next){case 0:return Ii.next=2,Object(I.n)({id:Be.question_id});case 2:je({type:"exercise/editExercise",payload:Object(_.a)({},Ct)});case 3:case"end":return Ii.stop()}},Vi)}))()}}),Ti.abrupt("break",17);case 8:return Ti.next=10,je({type:"exercise/exeriseMoveUpDown",payload:{id:Be.question_id,opr:wi.id}});case 10:return je({type:"exercise/editExercise",payload:Object(_.a)({},Ct)}),Ti.abrupt("break",17);case 12:return An(Be.dragKey),un(!0),Ti.abrupt("break",17);case 15:return C({key:Be.key,insert_id:Be==null?void 0:Be.question_id,question_type:3}),Ti.abrupt("break",17);case 17:case"end":return Ti.stop()}},oi)}));return function(wi){return Ci.apply(this,arguments)}}(),ji=function(){var oi;return t.a.createElement("aside",null,t.a.createElement("div",{className:pe.a.questionType},!(Be!=null&&Be.isPreview)&&t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},Be.key,"\u3001\u586B\u7A7A\u9898"),"\uFF08",Be.question_score,"\u5206\uFF09")),Be!=null&&Be.isPreview?t.a.createElement("div",{style:{display:"flex"}},t.a.createElement("span",{style:{flexShrink:0},className:"font18"},Be.key,"."),t.a.createElement(Ce.a,{value:Be.question_title}),t.a.createElement("span",{style:{flexShrink:0},className:"font16"},"\uFF08",Be.question_score,"\u5206\uFF09")):t.a.createElement("div",{className:"mt5"},t.a.createElement(Ce.a,{value:Be.question_title})),t.a.createElement("div",{className:pe.a.questionChoices},Be==null||((oi=Be.standard_answer)===null||oi===void 0)?void 0:oi.map(function(wi,Ei){return t.a.createElement(k.a,{key:Ei,align:"middle"},t.a.createElement(R.a,null,"\u7B54\u6848\uFF08\u586B\u7A7A",wi.choice_id,"\uFF09\uFF1A"),t.a.createElement(R.a,{flex:"1"},t.a.createElement(k.a,{align:"middle",gutter:[1,1]},wi.answer_text.map(function(Ti,Ni){return t.a.createElement(R.a,{span:24,key:Ni},t.a.createElement(S.a,{key:Ei,checked:Be.standard_answer.includes(Ei),disabled:!0,value:Ti}))}))))})),t.a.createElement("div",{className:pe.a.action},!Be.hideAction&&Mn.map(function(wi,Ei){return wi.id==="up"&&Be.key===1||wi.id==="down"&&Be.key===Be.len?null:t.a.createElement(f.a,{key:Ei,placement:"bottom",title:wi.name},t.a.createElement("span",{onClick:function(){return Li(wi)},className:wi.icon}))})))};return t.a.createElement("section",{className:pe.a.wrap},!_n&&ji(),_n&&ni())},be=Object(K.a)(function(pt){var Je=pt.problemset,Ft=pt.loading,Bt=pt.exercise,Fe=pt.globalSetting;return{problemset:Je,globalSetting:Fe,exercise:Bt,loading:Ft.effects}},null,null,{forwardRef:!0})(Object(i.forwardRef)(Ee)),te=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],me=function(Je,Ft){var Bt=Je.problemset,Fe=Je.globalSetting,ue=Je.exercise,si=Je.loading,je=Je.dispatch,Be=Je.onRef,Ie=Be===void 0?function(){}:Be,_e=Je.editData,An=Je.editKey,zn=Je.setEditKey,Pn=zn===void 0?function(){}:zn,Q=Je.cancelAdd,C=Q===void 0?function(){}:Q,L=Je.reload,z=L===void 0?function(){}:L,oe=Je.addCallback,q=oe===void 0?function(){}:oe,ke=Je.setIsClaer,ft=ke===void 0?function(){}:ke,kt=Object(N.a)(Je,["problemset","globalSetting","exercise","loading","dispatch","onRef","editData","editKey","setEditKey","cancelAdd","reload","addCallback","setIsClaer"]),an=Object(i.useState)(),dt=Object(o.a)(an,2),Pt=dt[0],tn=dt[1],Vn=Object(i.useState)(""),fi=Object(o.a)(Vn,2),Hn=fi[0],Fn=fi[1],Qt=Object(i.useState)(!1),hn=Object(o.a)(Qt,2),on=hn[0],Nt=hn[1],$n=Object(i.useState)(),jn=Object(o.a)($n,2),Tn=jn[0],qn=jn[1],En=Object(i.useState)([]),In=Object(o.a)(En,2),gn=In[0],Bn=In[1],Xn=Object(i.useState)([]),Zn=Object(o.a)(Xn,2),Kt=Zn[0],Lt=Zn[1],yt=Object(i.useState)(1),It=Object(o.a)(yt,2),Ot=It[0],Vt=It[1],Zt=Object(i.useState)(!1),Gt=Object(o.a)(Zt,2),Ut=Gt[0],vn=Gt[1],_n=Object(i.useState)(""),un=Object(o.a)(_n,2),cn=un[0],bn=un[1],dn=Object(i.useRef)(!1),Mt=function(Xe){Lt([].concat(Object(F.a)(Kt),[Object(_.a)({},Xe)]))},Yt=Object(W.i)();Object(i.useEffect)(function(){if(dn.current)return;if(!(_e!=null&&_e.question_choices)){Nt(!0),Fn(""),qn(2),tn("");return}vn(!(_e!=null&&_e.repeat_answer)),Fn(_e==null?void 0:_e.question_title),qn(_e==null?void 0:_e.question_score),Vt(_e==null?void 0:_e.difficulty),tn(_e.standard_answer[0]+""),Bn(_e.tag_discipline_ids),bn(_e==null?void 0:_e.analysis)},[_e,on]),Object(i.useEffect)(function(){on&&rt();function rt(){return Xe.apply(this,arguments)}function Xe(){return Xe=Object(ie.a)(r.a.mark(function Ze(){var We,ct,et;return r.a.wrap(function(jt){for(;;)switch(jt.prev=jt.next){case 0:return jt.next=2,Object(I.I)({sub_discipline_id:(We=ue.editData)===null||We===void 0||((ct=We.exercise)===null||ct===void 0)?void 0:ct.sub_discipline_id});case 2:et=jt.sent,Lt(et.tag_disciplines);case 4:case"end":return jt.stop()}},Ze)})),Xe.apply(this,arguments)}},[on]),Object(i.useImperativeHandle)(Ft,function(){return{onSave:Wt,isEdit:on}}),Object(i.useEffect)(function(){var rt,Xe=ue!=null&&(rt=ue.tagDisciplineData)!==null&&rt!==void 0&&rt.tag_disciplines&&Array.isArray(ue.tagDisciplineData.tag_disciplines)?ue.tagDisciplineData.tag_disciplines:[];Lt(Xe)},[ue.tagDisciplineData]);var qt=function(Xe){(Xe==null?void 0:Xe.status)===0&&(b.b.success("\u4FDD\u5B58\u6210\u529F"),Nt(!1),Pn(-1),dn.current=!1,z())},Wt=function(){var rt=Object(ie.a)(r.a.mark(function Xe(){var Ze,We,ct,et,Ct,jt;return r.a.wrap(function(Jt){for(;;)switch(Jt.prev=Jt.next){case 0:if(Hn){Jt.next=3;break}return b.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),Jt.abrupt("return",!1);case 3:if(Pt){Jt.next=6;break}return b.b.info("\u8BF7\u5148\u70B9\u51FB\u9009\u62E9\u672C\u9009\u62E9\u9898\u7684\u6B63\u786E\u9009\u9879"),Jt.abrupt("return",!1);case 6:if(Ze=[{choice_text:"\u6B63\u786E",is_answer:Pt==="1"?1:0},{choice_text:"\u9519\u8BEF",is_answer:Pt==="2"?2:0}],dn.current=!0,!_e.question_id){Jt.next=19;break}if(!((_e==null?void 0:_e.is_my)===1)){Jt.next=13;break}H.a.confirm({title:"\u63D0\u793A",content:"\u6B64\u9898\u76EE\u5DF2\u5B58\u5728\u4E8E\u8BD5\u9898\u5E93\uFF0C\u662F\u5426\u5C06\u4FEE\u6539\u540E\u7684\u9898\u76EE\u8986\u76D6\u8BD5\u9898\u5E93\u7684\u539F\u9898\uFF1F",okText:"\u8986\u76D6\u539F\u9898",cancelText:"\u4E0D\u8986\u76D6",keyboard:!1,onOk:function(){var Tt=Object(ie.a)(r.a.mark(function Rn(){var yn,mi;return r.a.wrap(function(ti){for(;;)switch(ti.prev=ti.next){case 0:return ti.next=2,je({type:"exercise/editExerciseQuestion",payload:{id:_e.question_id,question_title:Hn,question_type:2,question_score:Tn,question_choices:Ze.map(function(nn){return nn.choice_text}),standard_answers:Ze.filter(function(nn){return nn.is_answer}).map(function(nn){return nn.is_answer}),tag_discipline_ids:gn,sub_discipline_id:(yn=ue.editData)===null||yn===void 0||((mi=yn.exercise)===null||mi===void 0)?void 0:mi.sub_discipline_id,difficulty:Ot,is_cover:1,repeat_answer:!Ut,analysis:cn}});case 2:We=ti.sent,qt(We);case 4:case"end":return ti.stop()}},Rn)}));function At(){return Tt.apply(this,arguments)}return At}(),onCancel:function(){var Tt=Object(ie.a)(r.a.mark(function Rn(){var yn,mi;return r.a.wrap(function(ti){for(;;)switch(ti.prev=ti.next){case 0:return ti.next=2,je({type:"exercise/editExerciseQuestion",payload:{id:_e.question_id,question_title:Hn,question_type:2,question_score:Tn,question_choices:Ze.map(function(nn){return nn.choice_text}),standard_answers:Ze.filter(function(nn){return nn.is_answer}).map(function(nn){return nn.is_answer}),tag_discipline_ids:gn,sub_discipline_id:(yn=ue.editData)===null||yn===void 0||((mi=yn.exercise)===null||mi===void 0)?void 0:mi.sub_discipline_id,difficulty:Ot,repeat_answer:!Ut,analysis:cn}});case 2:We=ti.sent,qt(We);case 4:case"end":return ti.stop()}},Rn)}));function At(){return Tt.apply(this,arguments)}return At}()}),Jt.next=17;break;case 13:return Jt.next=15,je({type:"exercise/editExerciseQuestion",payload:{id:_e.question_id,question_title:Hn,question_type:2,question_score:Tn,question_choices:Ze.map(function(Tt){return Tt.choice_text}),standard_answers:Ze.filter(function(Tt){return Tt.is_answer}).map(function(Tt){return Tt.is_answer}),tag_discipline_ids:gn,sub_discipline_id:(ct=ue.editData)===null||ct===void 0||((et=ct.exercise)===null||et===void 0)?void 0:et.sub_discipline_id,difficulty:Ot,repeat_answer:!Ut,analysis:cn}});case 15:We=Jt.sent,qt(We);case 17:Jt.next=23;break;case 19:return Jt.next=21,je({type:"exercise/addExerciseQuestion",payload:{insert_id:_e==null?void 0:_e.insert_id,categoryId:Yt.categoryId,question_title:Hn,question_type:2,question_score:Tn,question_choices:Ze.map(function(Tt){return Tt.choice_text}),standard_answers:Ze.filter(function(Tt){return Tt.is_answer}).map(function(Tt){return Tt.is_answer}),tag_discipline_ids:gn,sub_discipline_id:(Ct=ue.editData)===null||Ct===void 0||((jt=Ct.exercise)===null||jt===void 0)?void 0:jt.sub_discipline_id,difficulty:Ot,repeat_answer:!Ut,analysis:cn}});case 21:We=Jt.sent,qt(We);case 23:return Jt.abrupt("return",{name:Hn,choices:Ze});case 24:case"end":return Jt.stop()}},Xe)}));return function(){return rt.apply(this,arguments)}}(),fn=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu current",id:"del"},{name:"(\u5411\u4E0B\u63D2\u5165\u5355\u9009\u9898)",icon:"iconfont c-light-primary ml30 icon-tianjia current",id:"add"},{name:"\u7F16\u8F91",icon:"iconfont c-light-primary ml30 icon-bianjishijuan3x current",id:"edit"}].filter(function(rt){var Xe,Ze;return(ue==null||((Xe=ue.editData)===null||Xe===void 0||((Ze=Xe.exercise)===null||Ze===void 0))?void 0:Ze.exercise_status)===1?rt:rt.id!=="del"&&rt.id!=="add"}),On=function(){var rt=Object(ie.a)(r.a.mark(function Xe(Ze){return r.a.wrap(function(ct){for(;;)switch(ct.prev=ct.next){case 0:if(!(An!==-1)){ct.next=3;break}return b.b.error("\u8BF7\u5148\u4FDD\u5B58\u6216\u53D6\u6D88\u5F53\u524D\u6B63\u5728\u7F16\u8F91\u7684\u95EE\u9898\u3002"),ct.abrupt("return");case 3:ct.t0=Ze.id,ct.next=ct.t0==="del"?6:ct.t0==="up"||ct.t0==="down"?8:ct.t0==="edit"?12:ct.t0==="add"?15:17;break;case 6:return H.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u8BD5\u9898\u5417\uFF1F",onOk:function(){return Object(ie.a)(r.a.mark(function Ct(){return r.a.wrap(function(wt){for(;;)switch(wt.prev=wt.next){case 0:return wt.next=2,Object(I.n)({id:_e.question_id});case 2:je({type:"exercise/editExercise",payload:Object(_.a)({},Yt)});case 3:case"end":return wt.stop()}},Ct)}))()}}),ct.abrupt("break",17);case 8:return ct.next=10,je({type:"exercise/exeriseMoveUpDown",payload:{id:_e.question_id,opr:Ze.id}});case 10:return je({type:"exercise/editExercise",payload:Object(_.a)({},Yt)}),ct.abrupt("break",17);case 12:return Pn(_e.dragKey),Nt(!0),ct.abrupt("break",17);case 15:return q({key:_e.key,insert_id:_e==null?void 0:_e.question_id,question_type:2}),ct.abrupt("break",17);case 17:case"end":return ct.stop()}},Xe)}));return function(Ze){return rt.apply(this,arguments)}}(),wn=function(){var Xe;return t.a.createElement("aside",null,t.a.createElement("div",{className:pe.a.questionType},!(_e!=null&&_e.isPreview)&&t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},_e.key,"\u3001\u5224\u65AD\u9898"),"\uFF08",_e.question_score,"\u5206\uFF09")),_e!=null&&_e.isPreview?t.a.createElement("div",{style:{display:"flex"}},t.a.createElement("span",{style:{flexShrink:0},className:"font18"},_e.key,"."),t.a.createElement(Ce.a,{value:_e.question_title}),t.a.createElement("span",{style:{flexShrink:0},className:"font16"},"\uFF08",_e.question_score,"\u5206\uFF09")):t.a.createElement("div",{className:"mt5"},t.a.createElement(Ce.a,{value:_e.question_title})),t.a.createElement("div",{className:pe.a.questionChoices},_e==null||((Xe=_e.question_choices)===null||Xe===void 0)?void 0:Xe.map(function(Ze,We){return t.a.createElement(d.a,{key:We,checked:_e.standard_answer.includes(We+1),disabled:!0},te[We],". ",t.a.createElement("span",{className:"c-black font14"},Ze.choice_text))})),t.a.createElement("div",{className:pe.a.action},!_e.hideAction&&fn.map(function(Ze,We){return Ze.id==="up"&&_e.key===1||Ze.id==="down"&&_e.key===_e.len?null:t.a.createElement(f.a,{key:We,placement:"bottom",title:Ze.name},t.a.createElement("span",{onClick:function(){return On(Ze)},className:Ze.icon}))})))},gt=function(){var Xe,Ze;return t.a.createElement("aside",null,t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},"\u5224\u65AD\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848\uFF09"),t.a.createElement("p",{className:pe.a.titleWrap},t.a.createElement("span",{className:pe.a.required},"*"),t.a.createElement("span",{className:pe.a.title},"\u9898\u5E72\uFF1A")),t.a.createElement(x.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Hn,onChange:function(ct){return Fn(ct)}}),t.a.createElement("p",{className:pe.a.titleWrap},t.a.createElement("span",{className:pe.a.required},"*"),t.a.createElement("span",{className:pe.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",t.a.createElement("span",{className:pe.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),t.a.createElement(d.a.Group,{buttonStyle:"solid",value:Pt,onChange:function(ct){return tn(ct.target.value)}},t.a.createElement(d.a.Button,{value:"1",className:"".concat(pe.a.radio," mr40")},"\u6B63\u786E"),t.a.createElement(d.a.Button,{value:"2",className:pe.a.radio},"\u9519\u8BEF")),t.a.createElement("p",{className:"c-orange"},"\u6E29\u99A8\u63D0\u793A\uFF1A\u70B9\u51FB\u9009\u9879\uFF0C\u53EF\u4EE5\u76F4\u63A5\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848"),t.a.createElement("p",{className:pe.a.titleWrap},t.a.createElement("span",{className:pe.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),t.a.createElement(x.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:cn,onChange:function(ct){return bn(ct)}}),t.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",t.a.createElement(U.a,{value:Tn,max:1e4,min:0,onChange:function(ct){qn(ct)}})," \u5206",t.a.createElement("span",{style:{marginLeft:"30px"},className:pe.a.difficult},t.a.createElement("label",{style:{color:"red"}},"*")," \u96BE\u5EA6\uFF1A",t.a.createElement(d.a.Group,{value:Ot,onChange:function(ct){Vt(ct.target.value)}},t.a.createElement(d.a.Button,{value:1},"\u7B80\u5355"),t.a.createElement(d.a.Button,{value:2},"\u9002\u4E2D"),t.a.createElement(d.a.Button,{value:3},"\u56F0\u96BE")))),t.a.createElement("p",{className:pe.a.titleWrap},t.a.createElement("span",{className:"".concat(pe.a.title)},"\u77E5\u8BC6\u70B9\uFF1A",t.a.createElement("span",{className:pe.a.colorGray},"\uFF08\u6240\u6709\u81EA\u5EFA\u77E5\u8BC6\u70B9\u4EC5\u672C\u4EBA\u53EF\u89C1\uFF0C\u88ABEduCoder\u5E73\u53F0\u5BA1\u6838\u901A\u8FC7\u4E3A\u5B98\u65B9\u77E5\u8BC6\u70B9\u540E\u6240\u6709\u7528\u6237\u53EF\u89C1\uFF09")),t.a.createElement("div",{className:"mt5"},t.a.createElement(De.a,{value:gn,selectvalues:_e==null?void 0:_e.tag_discipline_ids,onChange:Bn,subId:(Xe=ue.editData)===null||Xe===void 0||((Ze=Xe.exercise)===null||Ze===void 0)?void 0:Ze.sub_discipline_id,knowledgeOptions:Kt,onAddKnowledgeFinish:Mt})),t.a.createElement("div",{style:{marginTop:10}},t.a.createElement("span",{style:{marginRight:10}},"\u4E0D\u5141\u8BB8\u5B66\u751F\u91CD\u590D\u7B54\u9898"),t.a.createElement(E.a,{checked:Ut,onChange:function(ct){vn(ct)}}))),t.a.createElement("aside",{className:"tr"},(An!==-1||_e.question_id)&&t.a.createElement(v.a,{type:"default",onClick:function(){C(),Nt(!1)}},"\u53D6\u6D88"),t.a.createElement(v.a,{className:"ml20",type:"primary",onClick:function(){Wt()}},"\u4FDD\u5B58")))};return t.a.createElement("section",{className:pe.a.wrap},!on&&wn(),on&>())},ye=Object(K.a)(function(pt){var Je=pt.problemset,Ft=pt.loading,Bt=pt.exercise,Fe=pt.globalSetting;return{problemset:Je,globalSetting:Fe,exercise:Bt,loading:Ft.effects}},null,null,{forwardRef:!0})(Object(i.forwardRef)(me)),Le=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],$e=Object(i.forwardRef)(function(pt,Je){var Ft=pt.problemset,Bt=pt.globalSetting,Fe=pt.exercise,ue=pt.loading,si=pt.dispatch,je=pt.onRef,Be=je===void 0?function(){}:je,Ie=pt.editData,_e=pt.cancelAdd,An=_e===void 0?function(){}:_e,zn=pt.editKey,Pn=pt.setEditKey,Q=Pn===void 0?function(){}:Pn,C=pt.setIsClaer,L=C===void 0?function(){}:C,z=pt.addCallback,oe=z===void 0?function(jt){}:z,q=pt.reload,ke=q===void 0?function(){}:q,ft=Object(N.a)(pt,["problemset","globalSetting","exercise","loading","dispatch","onRef","editData","cancelAdd","editKey","setEditKey","setIsClaer","addCallback","reload"]),kt=Object(i.useState)([]),an=Object(o.a)(kt,2),dt=an[0],Pt=an[1],tn=Object(i.useState)(),Vn=Object(o.a)(tn,2),fi=Vn[0],Hn=Vn[1],Fn=Object(i.useState)([]),Qt=Object(o.a)(Fn,2),hn=Qt[0],on=Qt[1],Nt=Object(i.useState)(""),$n=Object(o.a)(Nt,2),jn=$n[0],Tn=$n[1],qn=Object(i.useState)(),En=Object(o.a)(qn,2),In=En[0],gn=En[1],Bn=Object(i.useState)(!1),Xn=Object(o.a)(Bn,2),Zn=Xn[0],Kt=Xn[1],Lt=Object(i.useState)([]),yt=Object(o.a)(Lt,2),It=yt[0],Ot=yt[1],Vt=Object(i.useState)(1),Zt=Object(o.a)(Vt,2),Gt=Zt[0],Ut=Zt[1],vn=Object(i.useState)(!1),_n=Object(o.a)(vn,2),un=_n[0],cn=_n[1],bn=Object(i.useState)(""),dn=Object(o.a)(bn,2),Mt=dn[0],Yt=dn[1],qt=Object(i.useState)([]),Wt=Object(o.a)(qt,2),fn=Wt[0],On=Wt[1],wn=Object(i.useRef)(!1),gt=function(wt){On([].concat(Object(F.a)(fn),[Object(_.a)({},wt)]))},rt=Object(W.i)();Object(i.useEffect)(function(){Pt(["","","",""])},[]),Object(i.useEffect)(function(){if(wn.current)return;if(!(Ie!=null&&Ie.question_choices)){Kt(!0),Tn(""),gn(5),Pt(["","","",""]),on([]);return}Tn(Ie==null?void 0:Ie.question_title),gn(Ie==null?void 0:Ie.question_score),cn(!(Ie!=null&&Ie.repeat_answer)),Ut(Ie==null?void 0:Ie.difficulty),Pt(Ie==null?void 0:Ie.question_choices.map(function(wt){return wt.choice_text}));var jt=[];Ie==null||Ie.standard_answer.map(function(wt,Jt){jt.push(wt-1)}),on(jt),Ot(Ie.tag_discipline_ids),Yt(Ie==null?void 0:Ie.analysis)},[Ie,Zn]),Object(i.useEffect)(function(){Zn&&jt();function jt(){return wt.apply(this,arguments)}function wt(){return wt=Object(ie.a)(r.a.mark(function Jt(){var Tt,At,Rn;return r.a.wrap(function(mi){for(;;)switch(mi.prev=mi.next){case 0:return mi.next=2,Object(I.I)({sub_discipline_id:(Tt=Fe.editData)===null||Tt===void 0||((At=Tt.exercise)===null||At===void 0)?void 0:At.sub_discipline_id});case 2:Rn=mi.sent,On(Rn.tag_disciplines);case 4:case"end":return mi.stop()}},Jt)})),wt.apply(this,arguments)}},[Zn]),Object(i.useImperativeHandle)(Je,function(){return{onSave:Ze,isEdit:Zn}}),Object(i.useEffect)(function(){var jt,wt=Fe!=null&&(jt=Fe.tagDisciplineData)!==null&&jt!==void 0&&jt.tag_disciplines&&Array.isArray(Fe.tagDisciplineData.tag_disciplines)?Fe.tagDisciplineData.tag_disciplines:[];On(wt)},[Fe.tagDisciplineData]);var Xe=function(wt){(wt==null?void 0:wt.status)===0&&(b.b.success("\u4FDD\u5B58\u6210\u529F"),Kt(!1),Q(-1),wn.current=!1,ke())},Ze=function(){var jt=Object(ie.a)(r.a.mark(function wt(){var Jt,Tt,At,Rn,yn,mi,ei;return r.a.wrap(function(nn){for(;;)switch(nn.prev=nn.next){case 0:if(jn){nn.next=3;break}return b.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u76EE"),nn.abrupt("return",!1);case 3:if(Jt=dt.findIndex(function(kn){return!kn}),!(Jt>-1)){nn.next=7;break}return b.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(Le[Jt]," \u9009\u9879\u7684\u5185\u5BB9")),nn.abrupt("return",!1);case 7:if(hn.length){nn.next=10;break}return b.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),nn.abrupt("return",!1);case 10:if(!(hn.length<1)){nn.next=13;break}return b.b.info("\u8BF7\u9009\u62E9\u7B54\u6848"),nn.abrupt("return",!1);case 13:if(Tt=dt.map(function(kn,Yn){return{choice_text:kn,is_answer:hn.includes(Yn)?Yn+1:0}}),wn.current=!0,!Ie.question_id){nn.next=26;break}if(!((Ie==null?void 0:Ie.is_my)===1)){nn.next=20;break}H.a.confirm({title:"\u63D0\u793A",content:"\u6B64\u9898\u76EE\u5DF2\u5B58\u5728\u4E8E\u8BD5\u9898\u5E93\uFF0C\u662F\u5426\u5C06\u4FEE\u6539\u540E\u7684\u9898\u76EE\u8986\u76D6\u8BD5\u9898\u5E93\u7684\u539F\u9898\uFF1F",okText:"\u8986\u76D6\u539F\u9898",cancelText:"\u4E0D\u8986\u76D6",keyboard:!1,onOk:function(){var kn=Object(ie.a)(r.a.mark(function ni(){var Mn,Li;return r.a.wrap(function(Ci){for(;;)switch(Ci.prev=Ci.next){case 0:return Ci.next=2,si({type:"exercise/editExerciseQuestion",payload:{id:Ie.question_id,question_title:jn,question_type:1,question_score:In,question_choices:Tt.map(function(oi){return oi.choice_text}),standard_answers:Tt.filter(function(oi){return oi.is_answer}).map(function(oi){return oi.is_answer}),tag_discipline_ids:It,sub_discipline_id:(Mn=Fe.editData)===null||Mn===void 0||((Li=Mn.exercise)===null||Li===void 0)?void 0:Li.sub_discipline_id,difficulty:Gt,is_cover:1,repeat_answer:!un,analysis:Mt}});case 2:At=Ci.sent,Xe(At);case 4:case"end":return Ci.stop()}},ni)}));function Yn(){return kn.apply(this,arguments)}return Yn}(),onCancel:function(){var kn=Object(ie.a)(r.a.mark(function ni(){var Mn,Li;return r.a.wrap(function(Ci){for(;;)switch(Ci.prev=Ci.next){case 0:return Ci.next=2,si({type:"exercise/editExerciseQuestion",payload:{id:Ie.question_id,question_title:jn,question_type:1,question_score:In,question_choices:Tt.map(function(oi){return oi.choice_text}),standard_answers:Tt.filter(function(oi){return oi.is_answer}).map(function(oi){return oi.is_answer}),tag_discipline_ids:It,sub_discipline_id:(Mn=Fe.editData)===null||Mn===void 0||((Li=Mn.exercise)===null||Li===void 0)?void 0:Li.sub_discipline_id,difficulty:Gt,repeat_answer:!un,analysis:Mt}});case 2:At=Ci.sent,Xe(At);case 4:case"end":return Ci.stop()}},ni)}));function Yn(){return kn.apply(this,arguments)}return Yn}()}),nn.next=24;break;case 20:return nn.next=22,si({type:"exercise/editExerciseQuestion",payload:{id:Ie.question_id,question_title:jn,question_type:1,question_score:In,question_choices:Tt.map(function(kn){return kn.choice_text}),standard_answers:Tt.filter(function(kn){return kn.is_answer}).map(function(kn){return kn.is_answer}),tag_discipline_ids:It,sub_discipline_id:(Rn=Fe.editData)===null||Rn===void 0||((yn=Rn.exercise)===null||yn===void 0)?void 0:yn.sub_discipline_id,difficulty:Gt,repeat_answer:!un,analysis:Mt}});case 22:At=nn.sent,Xe(At);case 24:nn.next=30;break;case 26:return nn.next=28,si({type:"exercise/addExerciseQuestion",payload:{insert_id:Ie==null?void 0:Ie.insert_id,categoryId:rt.categoryId,question_title:jn,question_type:1,question_score:In,question_choices:Tt.map(function(kn){return kn.choice_text}),standard_answers:Tt.filter(function(kn){return kn.is_answer}).map(function(kn){return kn.is_answer}),tag_discipline_ids:It,sub_discipline_id:(mi=Fe.editData)===null||mi===void 0||((ei=mi.exercise)===null||ei===void 0)?void 0:ei.sub_discipline_id,difficulty:Gt,repeat_answer:!un,analysis:Mt}});case 28:At=nn.sent,Xe(At);case 30:case"end":return nn.stop()}},wt)}));return function(){return jt.apply(this,arguments)}}(),We=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu current",id:"del"},{name:"(\u5411\u4E0B\u63D2\u5165\u5355\u9009\u9898)",icon:"iconfont c-light-primary ml30 icon-tianjia current",id:"add"},{name:"\u7F16\u8F91",icon:"iconfont c-light-primary ml30 icon-bianjishijuan3x current",id:"edit"}].filter(function(jt){var wt,Jt;return(Fe==null||((wt=Fe.editData)===null||wt===void 0||((Jt=wt.exercise)===null||Jt===void 0))?void 0:Jt.exercise_status)===1?jt:jt.id!=="del"&&jt.id!=="add"}),ct=function(){var jt=Object(ie.a)(r.a.mark(function wt(Jt){return r.a.wrap(function(At){for(;;)switch(At.prev=At.next){case 0:if(!(zn!==-1)){At.next=3;break}return b.b.error("\u8BF7\u5148\u4FDD\u5B58\u6216\u53D6\u6D88\u5F53\u524D\u6B63\u5728\u7F16\u8F91\u7684\u95EE\u9898\u3002"),At.abrupt("return");case 3:At.t0=Jt.id,At.next=At.t0==="del"?6:At.t0==="up"||At.t0==="down"?8:At.t0==="edit"?12:At.t0==="add"?15:17;break;case 6:return H.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u8BD5\u9898\u5417\uFF1F",onOk:function(){return Object(ie.a)(r.a.mark(function yn(){return r.a.wrap(function(ei){for(;;)switch(ei.prev=ei.next){case 0:return ei.next=2,Object(I.n)({id:Ie.question_id});case 2:si({type:"exercise/editExercise",payload:Object(_.a)({},rt)});case 3:case"end":return ei.stop()}},yn)}))()}}),At.abrupt("break",17);case 8:return At.next=10,si({type:"exercise/exeriseMoveUpDown",payload:{id:Ie.question_id,opr:Jt.id}});case 10:return si({type:"exercise/editExercise",payload:Object(_.a)({},rt)}),At.abrupt("break",17);case 12:return Q(Ie.dragKey),Kt(!0),At.abrupt("break",17);case 15:return oe({key:Ie.key,insert_id:Ie==null?void 0:Ie.question_id,question_type:1}),At.abrupt("break",17);case 17:case"end":return At.stop()}},wt)}));return function(Jt){return jt.apply(this,arguments)}}(),et=function(){var wt;return t.a.createElement("aside",null,t.a.createElement("div",{className:pe.a.questionType},!(Ie!=null&&Ie.isPreview)&&t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},Ie.key,"\u3001\u591A\u9009\u9898"),"\uFF08",Ie.question_score,"\u5206\uFF09")),Ie!=null&&Ie.isPreview?t.a.createElement("div",{style:{display:"flex"}},t.a.createElement("span",{style:{flexShrink:0},className:"font18"},Ie.key,"."),t.a.createElement(Ce.a,{value:Ie.question_title}),t.a.createElement("span",{style:{flexShrink:0},className:"font16"},"\uFF08",Ie.question_score,"\u5206\uFF09")):t.a.createElement("div",{className:"mt5"},t.a.createElement(Ce.a,{value:Ie.question_title})),t.a.createElement("div",{className:pe.a.questionChoices},Ie==null||((wt=Ie.question_choices)===null||wt===void 0)?void 0:wt.map(function(Jt,Tt){return t.a.createElement(k.a,{key:Tt},t.a.createElement(R.a,null,t.a.createElement(h.a,{key:Tt,checked:Ie.standard_answer.includes(Tt+1),disabled:!0},Le[Tt],".")),t.a.createElement(R.a,{flex:"1"},t.a.createElement("span",{className:"c-black font14"},t.a.createElement(Ce.a,{value:Jt.choice_text}))))})),t.a.createElement("div",{className:pe.a.action},!Ie.hideAction&&We.map(function(Jt,Tt){return Jt.id==="up"&&Ie.key===1||Jt.id==="down"&&Ie.key===Ie.len?null:t.a.createElement(f.a,{key:Tt,placement:"bottom",title:Jt.name},t.a.createElement("span",{onClick:function(){return ct(Jt)},className:Jt.icon}))})))},Ct=function(){var wt,Jt;return t.a.createElement("aside",null,t.a.createElement("div",{className:pe.a.questionType},t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},"\u9009\u62E9\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848\uFF09")),t.a.createElement("p",{className:pe.a.titleWrap},t.a.createElement("span",{className:pe.a.required},"*"),t.a.createElement("span",{className:pe.a.title},"\u9898\u5E72\uFF1A")),t.a.createElement(x.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:jn,onChange:function(At){return Tn(At)}}),t.a.createElement("p",{className:pe.a.titleWrap},t.a.createElement("span",{className:pe.a.required},"*"),t.a.createElement("span",{className:pe.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",t.a.createElement("span",{className:pe.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),dt.map(function(Tt,At){var Rn,yn;return t.a.createElement("div",{className:pe.a.choiceWrap,key:At},t.a.createElement(f.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},t.a.createElement("div",{className:"".concat(pe.a.answer," ").concat(hn.includes(At)?pe.a.activeAnswer:""),onClick:function(){hn.includes(At)?on(hn.filter(function(ei){return ei!==At})):on([].concat(Object(F.a)(hn),[At]))}},Le[At])),t.a.createElement("div",{className:pe.a.editorWrap},fi===At?t.a.createElement(x.a,{id:"single-question-option-".concat(At),watch:!0,isFocus:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:Tt,onChange:function(ei){dt[At]=ei,Pt(dt)}}):t.a.createElement("div",{className:pe.a.htmlWrap,onClick:function(){return Hn(At)}},t.a.createElement(Ce.a,{value:Tt}))),((Rn=Fe.editData)===null||Rn===void 0||((yn=Rn.exercise)===null||yn===void 0)?void 0:yn.exercise_status)===1&&t.a.createElement(t.a.Fragment,null,At>1&&t.a.createElement(f.a,{title:"\u5220\u9664"},t.a.createElement("i",{className:"".concat(pe.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return Pt(dt.filter(function(ei,ti){return ti!==At}))}})),At<7&&At===dt.length-1&&t.a.createElement(f.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},t.a.createElement("i",{className:"".concat(pe.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return Pt([].concat(Object(F.a)(dt),[""]))}}))))}),t.a.createElement("p",{className:"c-orange"},"\u6E29\u99A8\u63D0\u793A\uFF1A\u70B9\u51FB\u9009\u9879\u8F93\u5165\u6846\u53EF\u8BBE\u7F6E\u7B54\u6848\uFF1B\u9009\u4E2D\u7684\u9009\u9879\u5373\u4E3A\u6B63\u786E\u7B54\u6848\uFF0C\u9009\u62E9\u591A\u4E2A\u7B54\u6848\u5373\u4E3A\u591A\u9009\u9898"),t.a.createElement("p",{className:pe.a.titleWrap},t.a.createElement("span",{className:pe.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),t.a.createElement(x.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Mt,onChange:function(At){return Yt(At)}}),t.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",t.a.createElement(U.a,{value:In,max:1e4,min:0,onChange:function(At){gn(At)}})," ","\u5206",t.a.createElement("span",{style:{marginLeft:"30px"},className:pe.a.difficult},t.a.createElement("label",{style:{color:"red"}},"*")," \u96BE\u5EA6\uFF1A",t.a.createElement(d.a.Group,{value:Gt,onChange:function(At){Ut(At.target.value)}},t.a.createElement(d.a.Button,{value:1},"\u7B80\u5355"),t.a.createElement(d.a.Button,{value:2},"\u9002\u4E2D"),t.a.createElement(d.a.Button,{value:3},"\u56F0\u96BE")))),t.a.createElement("p",{className:pe.a.titleWrap},t.a.createElement("span",{className:"".concat(pe.a.title)},"\u77E5\u8BC6\u70B9\uFF1A",t.a.createElement("span",{className:pe.a.colorGray},"\uFF08\u6240\u6709\u81EA\u5EFA\u77E5\u8BC6\u70B9\u4EC5\u672C\u4EBA\u53EF\u89C1\uFF0C\u88ABEduCoder\u5E73\u53F0\u5BA1\u6838\u901A\u8FC7\u4E3A\u5B98\u65B9\u77E5\u8BC6\u70B9\u540E\u6240\u6709\u7528\u6237\u53EF\u89C1\uFF09")),t.a.createElement("div",{className:"mt5"},t.a.createElement(De.a,{value:It,selectvalues:Ie==null?void 0:Ie.tag_discipline_ids,onChange:Ot,subId:(wt=Fe.editData)===null||wt===void 0||((Jt=wt.exercise)===null||Jt===void 0)?void 0:Jt.sub_discipline_id,knowledgeOptions:fn,onAddKnowledgeFinish:gt})),t.a.createElement("div",{style:{marginTop:10}},t.a.createElement("span",{style:{marginRight:10}},"\u4E0D\u5141\u8BB8\u5B66\u751F\u91CD\u590D\u7B54\u9898"),t.a.createElement(E.a,{checked:un,onChange:function(At){cn(At)}}))),t.a.createElement("aside",{className:"tr"},(zn!==-1||Ie.question_id)&&t.a.createElement(v.a,{type:"default",onClick:function(){An(),Kt(!1)}},"\u53D6\u6D88"),t.a.createElement(v.a,{className:"ml20",type:"primary",onClick:function(){Ze()}},"\u4FDD\u5B58")))};return t.a.createElement("section",{className:pe.a.wrap},!Zn&&et(),Zn&&Ct())}),Me=Object(K.a)(function(pt){var Je=pt.problemset,Ft=pt.loading,Bt=pt.exercise,Fe=pt.globalSetting;return{problemset:Je,globalSetting:Fe,exercise:Bt,loading:Ft.effects}},null,null,{forwardRef:!0})($e),ze=V("55Ip"),ot=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Et=function(Je,Ft){var Bt=Je.problemset,Fe=Je.globalSetting,ue=Je.exercise,si=Je.loading,je=Je.dispatch,Be=Je.editData,Ie=Je.cancelAdd,_e=Ie===void 0?function(){}:Ie,An=Je.editKey,zn=Je.setEditKey,Pn=zn===void 0?function(){}:zn,Q=Je.addCallback,C=Q===void 0?function(){}:Q,L=Je.reload,z=L===void 0?function(){}:L,oe=Je.setIsClaer,q=oe===void 0?function(){}:oe,ke=Object(N.a)(Je,["problemset","globalSetting","exercise","loading","dispatch","editData","cancelAdd","editKey","setEditKey","addCallback","reload","setIsClaer"]),ft=Object(i.useState)(""),kt=Object(o.a)(ft,2),an=kt[0],dt=kt[1],Pt=Object(i.useState)(""),tn=Object(o.a)(Pt,2),Vn=tn[0],fi=tn[1],Hn=Object(i.useState)(""),Fn=Object(o.a)(Hn,2),Qt=Fn[0],hn=Fn[1],on=Object(i.useState)([]),Nt=Object(o.a)(on,2),$n=Nt[0],jn=Nt[1],Tn=Object(i.useState)(""),qn=Object(o.a)(Tn,2),En=qn[0],In=qn[1],gn=Object(i.useState)(),Bn=Object(o.a)(gn,2),Xn=Bn[0],Zn=Bn[1],Kt=Object(i.useState)(!1),Lt=Object(o.a)(Kt,2),yt=Lt[0],It=Lt[1],Ot=Object(i.useState)([]),Vt=Object(o.a)(Ot,2),Zt=Vt[0],Gt=Vt[1],Ut=Object(i.useState)(!1),vn=Object(o.a)(Ut,2),_n=vn[0],un=vn[1],cn=Object(i.useState)(!1),bn=Object(o.a)(cn,2),dn=bn[0],Mt=bn[1],Yt=Object(W.i)(),qt=Object(i.useRef)(!1);Object(i.useEffect)(function(){var Xe;if(qt.current)return;Be.edit&&(un(!0),fi(""),dt(""),Gt([])),dt(Be.shixun_name),fi(Be.question_title);var Ze=[];(Xe=Be.shixun)===null||Xe===void 0||Xe.map(function(We){Ze.push(We.challenge_score)}),Gt(Ze)},[Be]),Object(i.useEffect)(function(){It(!1)},[_n]),Object(i.useImperativeHandle)(Ft,function(){return{onSave:fn,isEdit:_n}});var Wt=function(Ze){(Ze==null?void 0:Ze.status)===0&&(b.b.success("\u4FDD\u5B58\u6210\u529F"),un(!1),Pn(-1),qt.current=!1,z())},fn=function(){var Xe=Object(ie.a)(r.a.mark(function Ze(){var We,ct,et;return r.a.wrap(function(jt){for(;;)switch(jt.prev=jt.next){case 0:if(We=[],ct=!1,!ct){jt.next=4;break}return jt.abrupt("return",!1);case 4:if(qt.current=!0,Mt(!0),!Be.question_id){jt.next=12;break}return jt.next=9,je({type:"exercise/editExerciseQuestion",payload:{id:Be.question_id,question_title:Vn,shixun_name:an,shixun_id:Be.shixun_id,question_type:5,question_scores:Zt}});case 9:et=jt.sent,jt.next=15;break;case 12:return jt.next=14,je({type:"exercise/addExerciseQuestion",payload:{insert_id:Be==null?void 0:Be.insert_id,categoryId:Yt.categoryId,question_title:Vn,shixun_name:an,shixun_id:Be.shixun_id,question_type:5,question_scores:Zt,is_copy:Be.is_copy}});case 14:et=jt.sent;case 15:return Wt(et),Mt(!1),jt.abrupt("return",{name:Vn,analysis:Qt,standard_answers:We,is_ordered:Xn});case 18:case"end":return jt.stop()}},Ze)}));return function(){return Xe.apply(this,arguments)}}(),On=function(){var Ze;return t.a.createElement("aside",null,t.a.createElement("div",{className:pe.a.questionType},t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},"\u5B9E\u8BAD\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u5141\u8BB8\u624B\u52A8\u8C03\u5206\uFF09")),t.a.createElement("div",{className:"mt10"},t.a.createElement(S.a,{defaultValue:an,onChange:function(ct){dt(ct.target.value)}})),t.a.createElement("div",{className:"mt10"},t.a.createElement(x.a,{id:"single-question-option-0",height:155,placeholder:"\u8BF7\u8F93\u5165\u5B9E\u8BAD\u9898\u5B8C\u6210\u8981\u6C42",defaultValue:Vn,onChange:function(ct){fi(ct)}})),t.a.createElement("div",{className:"mt20"},(Ze=Be.shixun)===null||Ze===void 0?void 0:Ze.map(function(We,ct){return t.a.createElement(k.a,{gutter:[20,20]},t.a.createElement(R.a,{flex:"1"},ct+1,".",We.challenge_name),t.a.createElement(R.a,null,t.a.createElement(U.a,{defaultValue:Zt[ct],onChange:function(Ct){Zt[ct]=Ct,Gt(Zt),console.log("srore:L",Zt[ct])}})," \u5206"))})),t.a.createElement("div",{className:"mt20"},$n.length>1&&t.a.createElement("span",null,t.a.createElement(h.a,{checked:Xn,onChange:function(ct){return Zn(ct.target.checked)},className:"".concat(pe.a.color333," font14")},"\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"),t.a.createElement("span",{className:"".concat(pe.a.color999," font12")},"\uFF08\u9009\u4E2D\uFF0C\u6BCF\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u987A\u5E8F\u5FC5\u987B\u4E0E\u53C2\u8003\u7B54\u6848\u4E00\u81F4\uFF09"))),t.a.createElement("aside",{className:"tr"},(An!==-1||!(Be!=null&&Be.edit))&&t.a.createElement(v.a,{type:"default",onClick:function(){_e(),un(!1)}},"\u53D6\u6D88"),t.a.createElement(v.a,{loading:dn,className:"ml20",type:"primary",onClick:function(){fn()}},"\u4FDD\u5B58")))},wn=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu current",id:"del"},{name:"(\u5411\u4E0B\u63D2\u5165\u5B9E\u8BAD\u9898)",icon:"iconfont c-light-primary ml30 icon-tianjia current",id:"add"},{name:"\u7F16\u8F91",icon:"iconfont c-light-primary ml30 icon-bianjishijuan3x current",id:"edit"}].filter(function(Xe){var Ze,We;return(ue==null||((Ze=ue.editData)===null||Ze===void 0||((We=Ze.exercise)===null||We===void 0))?void 0:We.exercise_status)===1?Xe:Xe.id!=="del"&&Xe.id!=="add"}),gt=function(){var Xe=Object(ie.a)(r.a.mark(function Ze(We){return r.a.wrap(function(et){for(;;)switch(et.prev=et.next){case 0:if(!(An!==-1)){et.next=3;break}return b.b.error("\u8BF7\u5148\u4FDD\u5B58\u6216\u53D6\u6D88\u5F53\u524D\u6B63\u5728\u7F16\u8F91\u7684\u95EE\u9898\u3002"),et.abrupt("return");case 3:et.t0=We.id,et.next=et.t0==="del"?6:et.t0==="up"||et.t0==="down"?8:et.t0==="edit"?12:et.t0==="add"?15:17;break;case 6:return H.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u8BD5\u9898\u5417\uFF1F",onOk:function(){return Object(ie.a)(r.a.mark(function jt(){return r.a.wrap(function(Jt){for(;;)switch(Jt.prev=Jt.next){case 0:return Jt.next=2,Object(I.n)({id:Be.question_id});case 2:je({type:"exercise/editExercise",payload:Object(_.a)({},Yt)});case 3:case"end":return Jt.stop()}},jt)}))()}}),et.abrupt("break",17);case 8:return et.next=10,je({type:"exercise/exeriseMoveUpDown",payload:{id:Be.question_id,opr:We.id}});case 10:return je({type:"exercise/editExercise",payload:Object(_.a)({},Yt)}),et.abrupt("break",17);case 12:return Pn(Be.dragKey),un(!0),et.abrupt("break",17);case 15:return je({type:"classroomList/setActionTabs",payload:{key:"\u9009\u7528\u5B9E\u8DF5\u9879\u76EE",editData:{key:Be.key,insert_id:Be==null?void 0:Be.question_id,question_type:5}}}),et.abrupt("break",17);case 17:case"end":return et.stop()}},Ze)}));return function(We){return Xe.apply(this,arguments)}}(),rt=function(){var Ze,We;return t.a.createElement("aside",null,t.a.createElement("div",{className:pe.a.questionType},!(Be!=null&&Be.isPreview)&&t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},Be.key,"\u3001\u5B9E\u8BAD\u9898"),"\uFF08",Be.question_score,"\u5206\uFF09")),Be!=null&&Be.isPreview?t.a.createElement("div",{style:{display:"flex"}},t.a.createElement("span",{style:{flexShrink:0},className:"font18"},Be.key,"."),t.a.createElement(Ce.a,{value:Be.shixun_name}),t.a.createElement("span",{style:{flexShrink:0},className:"font16"},"\uFF08",Be.question_score,"\u5206\uFF09"),!!((Ze=Be.schools)!==null&&Ze!==void 0&&Ze.length)&&t.a.createElement(f.a,{title:"\u8BE5\u5B9E\u8BAD\u9898\u9762\u5411\u6307\u5B9A\u5355\u4F4D\u5F00\u653E"},t.a.createElement("i",{className:"iconfont icon-zhidinggongkai1 font18 line24 c-orange"}))):t.a.createElement("div",{className:"mt5"},t.a.createElement(Ce.a,{value:Be.shixun_name})),t.a.createElement("div",{className:"mt30"}),(We=Be.shixun)===null||We===void 0?void 0:We.map(function(ct,et){return t.a.createElement("div",{key:et},"\u7B2C",et+1,"\u5173 ",t.a.createElement("span",{className:"ml10"},ct.challenge_name)," ",t.a.createElement("span",{className:"ml10"},ct.challenge_score," \u5206"))}),t.a.createElement("div",{className:pe.a.action},t.a.createElement(ze.a,{target:"_blank",to:"/shixuns/".concat(Be.shixun_identifier,"/challenges?exercise=true")},"\u5B9E\u8BAD\u8BE6\u60C5"),!Be.hideAction&&wn.map(function(ct,et){return ct.id==="up"&&Be.key===1||ct.id==="down"&&Be.key===Be.len?null:t.a.createElement(f.a,{key:et,placement:"bottom",title:ct.name},t.a.createElement("span",{onClick:function(){return gt(ct)},className:ct.icon}))})))};return t.a.createElement("section",{className:pe.a.wrap},!_n&&rt(),_n&&On())},_t=Object(K.a)(function(pt){var Je=pt.problemset,Ft=pt.loading,Bt=pt.globalSetting,Fe=pt.exercise;return{problemset:Je,globalSetting:Bt,exercise:Fe,loading:Ft.effects}},null,null,{forwardRef:!0})(Object(i.forwardRef)(Et)),mt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],ut=function(Je,Ft){var Bt=Je.problemset,Fe=Je.exercise,ue=Je.globalSetting,si=Je.loading,je=Je.dispatch,Be=Je.onRef,Ie=Be===void 0?function(){}:Be,_e=Je.editData,An=Je.cancelAdd,zn=An===void 0?function(){}:An,Pn=Je.editKey,Q=Je.setEditKey,C=Q===void 0?function(){}:Q,L=Je.setIsClaer,z=L===void 0?function(){}:L,oe=Je.reload,q=oe===void 0?function(){}:oe,ke=Je.addCallback,ft=ke===void 0?function(Jt){}:ke,kt=Object(N.a)(Je,["problemset","exercise","globalSetting","loading","dispatch","onRef","editData","cancelAdd","editKey","setEditKey","setIsClaer","reload","addCallback"]),an=Object(i.useState)([]),dt=Object(o.a)(an,2),Pt=dt[0],tn=dt[1],Vn=Object(i.useState)(),fi=Object(o.a)(Vn,2),Hn=fi[0],Fn=fi[1],Qt=Object(i.useState)([]),hn=Object(o.a)(Qt,2),on=hn[0],Nt=hn[1],$n=Object(i.useState)(""),jn=Object(o.a)($n,2),Tn=jn[0],qn=jn[1],En=Object(i.useState)(),In=Object(o.a)(En,2),gn=In[0],Bn=In[1],Xn=Object(i.useState)([]),Zn=Object(o.a)(Xn,2),Kt=Zn[0],Lt=Zn[1],yt=Object(i.useState)(!1),It=Object(o.a)(yt,2),Ot=It[0],Vt=It[1],Zt=Object(i.useState)(1),Gt=Object(o.a)(Zt,2),Ut=Gt[0],vn=Gt[1],_n=Object(i.useState)(!1),un=Object(o.a)(_n,2),cn=un[0],bn=un[1],dn=Object(i.useState)(""),Mt=Object(o.a)(dn,2),Yt=Mt[0],qt=Mt[1],Wt=Object(W.i)(),fn=Object(i.useRef)(null),On=Object(i.useRef)(!1),wn=Object(i.useState)([]),gt=Object(o.a)(wn,2),rt=gt[0],Xe=gt[1],Ze=function(Tt){Xe([].concat(Object(F.a)(rt),[Object(_.a)({},Tt)]))};Object(i.useEffect)(function(){tn(["","","",""])},[]),Object(i.useEffect)(function(){if(On.current)return;if(!(_e!=null&&_e.question_choices)){Vt(!0),qn(""),Bn(5),tn(["","","",""]),Nt([]);return}qn(_e==null?void 0:_e.question_title),Bn(_e==null?void 0:_e.question_score),bn(!(_e!=null&&_e.repeat_answer)),qt(_e==null?void 0:_e.analysis),vn(_e==null?void 0:_e.difficulty),tn(_e==null?void 0:_e.question_choices.map(function(Tt){return Tt.choice_text}));var Jt=[];_e==null||_e.standard_answer.map(function(Tt,At){Jt.push(Tt-1)}),Lt(_e.tag_discipline_ids),Nt(Jt)},[_e,Ot]),Object(i.useEffect)(function(){Ot&&Jt();function Jt(){return Tt.apply(this,arguments)}function Tt(){return Tt=Object(ie.a)(r.a.mark(function At(){var Rn,yn,mi;return r.a.wrap(function(ti){for(;;)switch(ti.prev=ti.next){case 0:return ti.next=2,Object(I.I)({sub_discipline_id:(Rn=Fe.editData)===null||Rn===void 0||((yn=Rn.exercise)===null||yn===void 0)?void 0:yn.sub_discipline_id});case 2:mi=ti.sent,Xe(mi.tag_disciplines);case 4:case"end":return ti.stop()}},At)})),Tt.apply(this,arguments)}},[Ot]),Object(i.useEffect)(function(){var Jt,Tt=Fe!=null&&(Jt=Fe.tagDisciplineData)!==null&&Jt!==void 0&&Jt.tag_disciplines&&Array.isArray(Fe.tagDisciplineData.tag_disciplines)?Fe.tagDisciplineData.tag_disciplines:[];Xe(Tt)},[Fe.tagDisciplineData]),Object(i.useImperativeHandle)(Ft,function(){return{onSave:ct,isEdit:Ot}});var We=function(Tt){(Tt==null?void 0:Tt.status)===0&&(b.b.success("\u4FDD\u5B58\u6210\u529F"),Vt(!1),C(-1),On.current=!1,q())},ct=function(){var Jt=Object(ie.a)(r.a.mark(function Tt(){var At,Rn,yn,mi,ei,ti,nn;return r.a.wrap(function(Yn){for(;;)switch(Yn.prev=Yn.next){case 0:if(Tn){Yn.next=3;break}return b.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u76EE"),Yn.abrupt("return",!1);case 3:if(At=Pt.findIndex(function(ni){return!ni}),!(At>-1)){Yn.next=7;break}return b.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(mt[At]," \u9009\u9879\u7684\u5185\u5BB9")),Yn.abrupt("return",!1);case 7:if(on.length){Yn.next=10;break}return b.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),Yn.abrupt("return",!1);case 10:if(!(on.length<1)){Yn.next=13;break}return b.b.info("\u8BF7\u9009\u62E9\u7B54\u6848"),Yn.abrupt("return",!1);case 13:if(Rn=Pt.map(function(ni,Mn){return{choice_text:ni,is_answer:on.includes(Mn)?Mn+1:0}}),On.current=!0,!_e.question_id){Yn.next=26;break}if(!((_e==null?void 0:_e.is_my)===1)){Yn.next=20;break}H.a.confirm({title:"\u63D0\u793A",content:"\u6B64\u9898\u76EE\u5DF2\u5B58\u5728\u4E8E\u8BD5\u9898\u5E93\uFF0C\u662F\u5426\u5C06\u4FEE\u6539\u540E\u7684\u9898\u76EE\u8986\u76D6\u8BD5\u9898\u5E93\u7684\u539F\u9898\uFF1F",okText:"\u8986\u76D6\u539F\u9898",cancelText:"\u4E0D\u8986\u76D6",keyboard:!1,onOk:function(){var ni=Object(ie.a)(r.a.mark(function Li(){var ji,Ci;return r.a.wrap(function(wi){for(;;)switch(wi.prev=wi.next){case 0:return wi.next=2,je({type:"exercise/editExerciseQuestion",payload:{id:_e.question_id,question_title:Tn,question_type:1,question_score:gn,question_choices:Rn.map(function(Ei){return Ei.choice_text}),standard_answers:Rn.filter(function(Ei){return Ei.is_answer}).map(function(Ei){return Ei.is_answer}),tag_discipline_ids:Kt,sub_discipline_id:(ji=Fe.editData)===null||ji===void 0||((Ci=ji.exercise)===null||Ci===void 0)?void 0:Ci.sub_discipline_id,difficulty:Ut,is_cover:1,repeat_answer:!cn,analysis:Yt}});case 2:yn=wi.sent,We(yn);case 4:case"end":return wi.stop()}},Li)}));function Mn(){return ni.apply(this,arguments)}return Mn}(),onCancel:function(){var ni=Object(ie.a)(r.a.mark(function Li(){var ji,Ci;return r.a.wrap(function(wi){for(;;)switch(wi.prev=wi.next){case 0:return wi.next=2,je({type:"exercise/editExerciseQuestion",payload:{id:_e.question_id,question_title:Tn,question_type:1,question_score:gn,question_choices:Rn.map(function(Ei){return Ei.choice_text}),standard_answers:Rn.filter(function(Ei){return Ei.is_answer}).map(function(Ei){return Ei.is_answer}),tag_discipline_ids:Kt,sub_discipline_id:(ji=Fe.editData)===null||ji===void 0||((Ci=ji.exercise)===null||Ci===void 0)?void 0:Ci.sub_discipline_id,difficulty:Ut,repeat_answer:!cn,analysis:Yt}});case 2:yn=wi.sent,We(yn);case 4:case"end":return wi.stop()}},Li)}));function Mn(){return ni.apply(this,arguments)}return Mn}()}),Yn.next=24;break;case 20:return Yn.next=22,je({type:"exercise/editExerciseQuestion",payload:{id:_e.question_id,question_title:Tn,question_type:1,question_score:gn,question_choices:Rn.map(function(ni){return ni.choice_text}),standard_answers:Rn.filter(function(ni){return ni.is_answer}).map(function(ni){return ni.is_answer}),tag_discipline_ids:Kt,sub_discipline_id:(mi=Fe.editData)===null||mi===void 0||((ei=mi.exercise)===null||ei===void 0)?void 0:ei.sub_discipline_id,difficulty:Ut,repeat_answer:!cn,analysis:Yt}});case 22:yn=Yn.sent,We(yn);case 24:Yn.next=30;break;case 26:return Yn.next=28,je({type:"exercise/addExerciseQuestion",payload:{insert_id:_e==null?void 0:_e.insert_id,categoryId:Wt.categoryId,question_title:Tn,question_type:1,question_score:gn,question_choices:Rn.map(function(ni){return ni.choice_text}),standard_answers:Rn.filter(function(ni){return ni.is_answer}).map(function(ni){return ni.is_answer}),tag_discipline_ids:Kt,sub_discipline_id:(ti=Fe.editData)===null||ti===void 0||((nn=ti.exercise)===null||nn===void 0)?void 0:nn.sub_discipline_id,difficulty:Ut,repeat_answer:!cn,analysis:Yt}});case 28:yn=Yn.sent,We(yn);case 30:case"end":return Yn.stop()}},Tt)}));return function(){return Jt.apply(this,arguments)}}(),et=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu current",id:"del"},{name:"(\u5411\u4E0B\u63D2\u5165\u5355\u9009\u9898)",icon:"iconfont c-light-primary ml30 icon-tianjia current",id:"add"},{name:"\u7F16\u8F91",icon:"iconfont c-light-primary ml30 icon-bianjishijuan3x current",id:"edit"}].filter(function(Jt){var Tt,At;return(Fe==null||((Tt=Fe.editData)===null||Tt===void 0||((At=Tt.exercise)===null||At===void 0))?void 0:At.exercise_status)===1?Jt:Jt.id!=="del"&&Jt.id!=="add"}),Ct=function(){var Jt=Object(ie.a)(r.a.mark(function Tt(At){return r.a.wrap(function(yn){for(;;)switch(yn.prev=yn.next){case 0:if(!(Pn!==-1)){yn.next=3;break}return b.b.error("\u8BF7\u5148\u4FDD\u5B58\u6216\u53D6\u6D88\u5F53\u524D\u6B63\u5728\u7F16\u8F91\u7684\u95EE\u9898\u3002"),yn.abrupt("return");case 3:yn.t0=At.id,yn.next=yn.t0==="del"?6:yn.t0==="up"||yn.t0==="down"?8:yn.t0==="edit"?12:yn.t0==="add"?15:17;break;case 6:return H.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u8BD5\u9898\u5417\uFF1F",onOk:function(){return Object(ie.a)(r.a.mark(function ei(){return r.a.wrap(function(nn){for(;;)switch(nn.prev=nn.next){case 0:return nn.next=2,Object(I.n)({id:_e.question_id});case 2:je({type:"exercise/editExercise",payload:Object(_.a)({},Wt)});case 3:case"end":return nn.stop()}},ei)}))()}}),yn.abrupt("break",17);case 8:return yn.next=10,je({type:"exercise/exeriseMoveUpDown",payload:{id:_e.question_id,opr:At.id}});case 10:return je({type:"exercise/editExercise",payload:Object(_.a)({},Wt)}),yn.abrupt("break",17);case 12:return C(_e.dragKey),Vt(!0),yn.abrupt("break",17);case 15:return ft({key:_e.key,insert_id:_e==null?void 0:_e.question_id,question_type:0}),yn.abrupt("break",17);case 17:case"end":return yn.stop()}},Tt)}));return function(At){return Jt.apply(this,arguments)}}(),jt=function(){var Tt;return t.a.createElement("aside",{ref:fn},t.a.createElement("div",{className:pe.a.questionType},!(_e!=null&&_e.isPreview)&&t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},_e.key,"\u3001\u5355\u9009\u9898"),"\uFF08",_e.question_score,"\u5206\uFF09")),_e!=null&&_e.isPreview?t.a.createElement("div",{style:{display:"flex",alignItems:"flex-start"}},t.a.createElement("span",{style:{flexShrink:0},className:"font18"},_e.key,"."),t.a.createElement(Ce.a,{value:_e.question_title}),t.a.createElement("span",{style:{flexShrink:0},className:"font16"},"\uFF08",_e.question_score,"\u5206\uFF09")):t.a.createElement("div",{className:"mt5"},t.a.createElement(Ce.a,{value:_e.question_title})),t.a.createElement("div",{className:pe.a.questionChoices},_e==null||((Tt=_e.question_choices)===null||Tt===void 0)?void 0:Tt.map(function(At,Rn){return t.a.createElement(k.a,{key:Rn},t.a.createElement(R.a,null,t.a.createElement(d.a,{key:Rn,checked:_e.standard_answer.includes(Rn+1),disabled:!0},mt[Rn],".")),t.a.createElement(R.a,{flex:"1"},t.a.createElement("span",{className:"c-black font14"},t.a.createElement(Ce.a,{value:At.choice_text}))))})),t.a.createElement("div",{className:pe.a.action},!_e.hideAction&&et.map(function(At,Rn){return At.id==="up"&&_e.key===1||At.id==="down"&&_e.key===_e.len?null:t.a.createElement(f.a,{key:Rn,placement:"bottom",title:At.name},t.a.createElement("span",{onClick:function(){return Ct(At)},className:At.icon}))})))},wt=function(){var Tt,At;return t.a.createElement("aside",null,t.a.createElement("div",{className:pe.a.questionType},t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},"\u9009\u62E9\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848\uFF09")),t.a.createElement("p",{className:pe.a.titleWrap},t.a.createElement("span",{className:pe.a.required},"*"),t.a.createElement("span",{className:pe.a.title},"\u9898\u5E72\uFF1A")),t.a.createElement(x.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Tn,onChange:function(yn){return qn(yn)}}),t.a.createElement("p",{className:pe.a.titleWrap},t.a.createElement("span",{className:pe.a.required},"*"),t.a.createElement("span",{className:pe.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",t.a.createElement("span",{className:pe.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),Pt.map(function(Rn,yn){var mi,ei;return t.a.createElement("div",{className:pe.a.choiceWrap,key:yn},t.a.createElement(f.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},t.a.createElement("div",{className:"".concat(pe.a.answer," ").concat(on.includes(yn)?pe.a.activeAnswer:""),onClick:function(){on.includes(yn)?Nt(on.filter(function(nn){return nn!==yn})):Nt([].concat(Object(F.a)(on),[yn]))}},mt[yn])),t.a.createElement("div",{className:pe.a.editorWrap},Hn===yn?t.a.createElement(x.a,{id:"single-question-option-".concat(yn),watch:!0,isFocus:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:Rn,onChange:function(nn){Pt[yn]=nn,tn(Pt)}}):t.a.createElement("div",{className:pe.a.htmlWrap,onClick:function(){return Fn(yn)}},t.a.createElement(Ce.a,{value:Rn}))),((mi=Fe.editData)===null||mi===void 0||((ei=mi.exercise)===null||ei===void 0)?void 0:ei.exercise_status)===1&&t.a.createElement(t.a.Fragment,null,yn>1&&t.a.createElement(f.a,{title:"\u5220\u9664"},t.a.createElement("i",{className:"".concat(pe.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return tn(Pt.filter(function(nn,kn){return kn!==yn}))}})),yn<7&&yn===Pt.length-1&&t.a.createElement(f.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},t.a.createElement("i",{className:"".concat(pe.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return tn([].concat(Object(F.a)(Pt),[""]))}}))))}),t.a.createElement("p",{className:"c-orange"},"\u6E29\u99A8\u63D0\u793A\uFF1A\u70B9\u51FB\u9009\u9879\u8F93\u5165\u6846\u53EF\u8BBE\u7F6E\u7B54\u6848\uFF1B\u9009\u4E2D\u7684\u9009\u9879\u5373\u4E3A\u6B63\u786E\u7B54\u6848\uFF0C\u9009\u62E9\u591A\u4E2A\u7B54\u6848\u5373\u4E3A\u591A\u9009\u9898"),t.a.createElement("p",{className:pe.a.titleWrap},t.a.createElement("span",{className:pe.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),t.a.createElement(x.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Yt,onChange:function(yn){return qt(yn)}}),t.a.createElement("div",{style:{marginBottom:14}},"\u5206\u503C\uFF1A",t.a.createElement(U.a,{value:gn,max:1e4,min:0,onChange:function(yn){Bn(yn)}})," \u5206",t.a.createElement("span",{style:{marginLeft:"30px"},className:pe.a.difficult},t.a.createElement("label",{style:{color:"red"}},"*")," \u96BE\u5EA6\uFF1A",t.a.createElement(d.a.Group,{value:Ut,onChange:function(yn){vn(yn.target.value)}},t.a.createElement(d.a.Button,{value:1},"\u7B80\u5355"),t.a.createElement(d.a.Button,{value:2},"\u9002\u4E2D"),t.a.createElement(d.a.Button,{value:3},"\u56F0\u96BE")))),t.a.createElement("div",{className:pe.a.titleWrap},t.a.createElement("span",{className:"".concat(pe.a.title)},"\u77E5\u8BC6\u70B9\uFF1A",t.a.createElement("span",{className:pe.a.colorGray},"\uFF08\u6240\u6709\u81EA\u5EFA\u77E5\u8BC6\u70B9\u4EC5\u672C\u4EBA\u53EF\u89C1\uFF0C\u88ABEduCoder\u5E73\u53F0\u5BA1\u6838\u901A\u8FC7\u4E3A\u5B98\u65B9\u77E5\u8BC6\u70B9\u540E\u6240\u6709\u7528\u6237\u53EF\u89C1\uFF09")),t.a.createElement("div",{className:"mt5"},t.a.createElement(De.a,{selectvalues:_e==null?void 0:_e.tag_discipline_ids,value:Kt,onChange:Lt,subId:(Tt=Fe.editData)===null||Tt===void 0||((At=Tt.exercise)===null||At===void 0)?void 0:At.sub_discipline_id,knowledgeOptions:rt,onAddKnowledgeFinish:Ze})),t.a.createElement("div",{style:{marginTop:10}},t.a.createElement("span",{style:{marginRight:10}},"\u4E0D\u5141\u8BB8\u5B66\u751F\u91CD\u590D\u7B54\u9898"),t.a.createElement(E.a,{checked:cn,onChange:function(yn){bn(yn)}}))),t.a.createElement("aside",{className:"tr"},(Pn!==-1||_e.question_id)&&t.a.createElement(v.a,{type:"default",onClick:function(){zn(),Vt(!1)}},"\u53D6\u6D88"),t.a.createElement(v.a,{className:"ml20",type:"primary",onClick:function(){ct()}},"\u4FDD\u5B58")))};return t.a.createElement("section",{className:pe.a.wrap},!Ot&&jt(),Ot&&wt())},Xt=Object(K.a)(function(pt){var Je=pt.problemset,Ft=pt.loading,Bt=pt.globalSetting,Fe=pt.exercise;return{problemset:Je,globalSetting:Bt,exercise:Fe,loading:Ft.effects}},null,null,{forwardRef:!0})(Object(i.forwardRef)(ut)),en=V("Z9P2"),sn=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],pn=function(Je,Ft){var Bt=Je.problemset,Fe=Je.exercise,ue=Je.globalSetting,si=Je.loading,je=Je.dispatch,Be=Je.onRef,Ie=Be===void 0?function(){}:Be,_e=Je.editData,An=Je.cancelAdd,zn=An===void 0?function(){}:An,Pn=Je.editKey,Q=Je.setEditKey,C=Q===void 0?function(){}:Q,L=Je.reload,z=L===void 0?function(){}:L,oe=Je.addCallback,q=oe===void 0?function(){}:oe,ke=Je.setIsClaer,ft=ke===void 0?function(){}:ke,kt=Object(N.a)(Je,["problemset","exercise","globalSetting","loading","dispatch","onRef","editData","cancelAdd","editKey","setEditKey","reload","addCallback","setIsClaer"]),an=Object(i.useState)(""),dt=Object(o.a)(an,2),Pt=dt[0],tn=dt[1],Vn=Object(i.useState)(""),fi=Object(o.a)(Vn,2),Hn=fi[0],Fn=fi[1],Qt=Object(i.useState)(""),hn=Object(o.a)(Qt,2),on=hn[0],Nt=hn[1],$n=Object(i.useState)(),jn=Object(o.a)($n,2),Tn=jn[0],qn=jn[1],En=Object(i.useState)(!1),In=Object(o.a)(En,2),gn=In[0],Bn=In[1],Xn=Object(i.useState)([]),Zn=Object(o.a)(Xn,2),Kt=Zn[0],Lt=Zn[1],yt=Object(i.useState)(1),It=Object(o.a)(yt,2),Ot=It[0],Vt=It[1],Zt=Object(i.useState)(!1),Gt=Object(o.a)(Zt,2),Ut=Gt[0],vn=Gt[1],_n=Object(i.useState)([[],[]]),un=Object(o.a)(_n,2),cn=un[0],bn=un[1],dn=Object(i.useRef)(!1),Mt=Object(W.i)(),Yt=Object(i.useState)([]),qt=Object(o.a)(Yt,2),Wt=qt[0],fn=qt[1],On=function(et){fn([].concat(Object(F.a)(Wt),[Object(_.a)({},et)]))};Object(i.useEffect)(function(){var ct;if(dn.current)return;if(!(_e!=null&&_e.question_title)){Bn(!0),tn(""),Nt(""),qn(10);return}vn(!(_e!=null&&_e.repeat_answer)),tn(_e==null?void 0:_e.question_title),Nt(_e==null||((ct=_e.standard_answer)===null||ct===void 0)?void 0:ct[0]),qn(_e==null?void 0:_e.question_score),Lt(_e.tag_discipline_ids),Vt(_e==null?void 0:_e.difficulty),Fn(_e==null?void 0:_e.analysis),bn([_e==null?void 0:_e.normal_keywords,_e==null?void 0:_e.main_keywords])},[Bt.editData,gn]),Object(i.useEffect)(function(){var ct,et=Fe!=null&&(ct=Fe.tagDisciplineData)!==null&&ct!==void 0&&ct.tag_disciplines&&Array.isArray(Fe.tagDisciplineData.tag_disciplines)?Fe.tagDisciplineData.tag_disciplines:[];fn(et)},[Fe.tagDisciplineData]),Object(i.useEffect)(function(){gn&&ct();function ct(){return et.apply(this,arguments)}function et(){return et=Object(ie.a)(r.a.mark(function Ct(){var jt,wt,Jt;return r.a.wrap(function(At){for(;;)switch(At.prev=At.next){case 0:return At.next=2,Object(I.I)({sub_discipline_id:(jt=Fe.editData)===null||jt===void 0||((wt=jt.exercise)===null||wt===void 0)?void 0:wt.sub_discipline_id});case 2:Jt=At.sent,fn(Jt.tag_disciplines);case 4:case"end":return At.stop()}},Ct)})),et.apply(this,arguments)}},[gn]),Object(i.useImperativeHandle)(Ft,function(){return{onSave:gt,isEdit:gn}});var wn=function(et){(et==null?void 0:et.status)===0&&(b.b.success("\u4FDD\u5B58\u6210\u529F"),Bn(!1),C(-1),dn.current=!1,z())},gt=function(){var ct=Object(ie.a)(r.a.mark(function et(){var Ct,jt,wt,Jt,Tt,At,Rn;return r.a.wrap(function(mi){for(;;)switch(mi.prev=mi.next){case 0:if(Pt){mi.next=3;break}return b.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),mi.abrupt("return",!1);case 3:if(Ct=cn[0],jt=cn[1],dn.current=!0,!_e.question_id){mi.next=17;break}if(!((_e==null?void 0:_e.is_my)===1)){mi.next=11;break}H.a.confirm({title:"\u63D0\u793A",content:"\u6B64\u9898\u76EE\u5DF2\u5B58\u5728\u4E8E\u8BD5\u9898\u5E93\uFF0C\u662F\u5426\u5C06\u4FEE\u6539\u540E\u7684\u9898\u76EE\u8986\u76D6\u8BD5\u9898\u5E93\u7684\u539F\u9898\uFF1F",okText:"\u8986\u76D6\u539F\u9898",cancelText:"\u4E0D\u8986\u76D6",keyboard:!1,onOk:function(){var ei=Object(ie.a)(r.a.mark(function nn(){var kn,Yn;return r.a.wrap(function(Mn){for(;;)switch(Mn.prev=Mn.next){case 0:return Mn.next=2,je({type:"exercise/editExerciseQuestion",payload:{id:_e.question_id,question_title:Pt,question_type:4,question_score:Tn,standard_answers:[on],tag_discipline_ids:Kt,sub_discipline_id:(kn=Fe.editData)===null||kn===void 0||((Yn=kn.exercise)===null||Yn===void 0)?void 0:Yn.sub_discipline_id,difficulty:Ot,is_cover:1,repeat_answer:!Ut,analysis:Hn,normal_keywords:Ct,main_keywords:jt}});case 2:wt=Mn.sent,wn(wt);case 4:case"end":return Mn.stop()}},nn)}));function ti(){return ei.apply(this,arguments)}return ti}(),onCancel:function(){var ei=Object(ie.a)(r.a.mark(function nn(){var kn,Yn;return r.a.wrap(function(Mn){for(;;)switch(Mn.prev=Mn.next){case 0:return Mn.next=2,je({type:"exercise/editExerciseQuestion",payload:{id:_e.question_id,question_title:Pt,question_type:4,question_score:Tn,standard_answers:[on],tag_discipline_ids:Kt,sub_discipline_id:(kn=Fe.editData)===null||kn===void 0||((Yn=kn.exercise)===null||Yn===void 0)?void 0:Yn.sub_discipline_id,difficulty:Ot,repeat_answer:!Ut,analysis:Hn,normal_keywords:Ct,main_keywords:jt}});case 2:wt=Mn.sent,wn(wt);case 4:case"end":return Mn.stop()}},nn)}));function ti(){return ei.apply(this,arguments)}return ti}()}),mi.next=15;break;case 11:return mi.next=13,je({type:"exercise/editExerciseQuestion",payload:{id:_e.question_id,question_title:Pt,question_type:4,question_score:Tn,standard_answers:[on],tag_discipline_ids:Kt,sub_discipline_id:(Jt=Fe.editData)===null||Jt===void 0||((Tt=Jt.exercise)===null||Tt===void 0)?void 0:Tt.sub_discipline_id,difficulty:Ot,repeat_answer:!Ut,analysis:Hn,normal_keywords:Ct,main_keywords:jt}});case 13:wt=mi.sent,wn(wt);case 15:mi.next=21;break;case 17:return mi.next=19,je({type:"exercise/addExerciseQuestion",payload:{insert_id:_e==null?void 0:_e.insert_id,categoryId:Mt.categoryId,exercise_bank_id:Mt.categoryId,question_title:Pt,question_type:4,question_score:Tn,standard_answers:[on],tag_discipline_ids:Kt,sub_discipline_id:(At=Fe.editData)===null||At===void 0||((Rn=At.exercise)===null||Rn===void 0)?void 0:Rn.sub_discipline_id,difficulty:Ot,repeat_answer:!Ut,analysis:Hn,normal_keywords:Ct,main_keywords:jt}});case 19:wt=mi.sent,wn(wt);case 21:return mi.abrupt("return",{name:Pt,answer_texts:[on],analysis:Hn,normal_keywords:Ct,main_keywords:jt});case 22:case"end":return mi.stop()}},et)}));return function(){return ct.apply(this,arguments)}}(),rt=function(){var et,Ct;return t.a.createElement("aside",null,t.a.createElement("div",{className:pe.a.questionType},t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},"\u4E3B\u89C2\u9898"),"\uFF08\u4E3B\u89C2\u9898\uFF0C\u672A\u4F5C\u7B54\u7684\u60C5\u51B5\u4E0B\u81EA\u52A8\u8BC4\u4E3A\u96F6\u5206\uFF09")),t.a.createElement(x.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Pt,onChange:function(wt){return tn(wt)}}),t.a.createElement("p",{className:pe.a.titleWrap},t.a.createElement("span",{className:pe.a.title},"\u53C2\u8003\u7B54\u6848\uFF1A")),t.a.createElement(x.a,{id:"single-question-reference-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848",defaultValue:on,onChange:function(wt){return Nt(wt)}}),t.a.createElement(en.a,{value:cn,onChange:bn}),t.a.createElement("p",{className:pe.a.titleWrap},t.a.createElement("span",{className:pe.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),t.a.createElement(x.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Hn,onChange:function(wt){return Fn(wt)}}),t.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",t.a.createElement(U.a,{value:Tn,max:1e4,min:0,onChange:function(wt){qn(wt)}})," \u5206",t.a.createElement("span",{style:{marginLeft:"30px"},className:pe.a.difficult},t.a.createElement("label",{style:{color:"red"}},"*")," \u96BE\u5EA6\uFF1A",t.a.createElement(d.a.Group,{value:Ot,onChange:function(wt){Vt(wt.target.value)}},t.a.createElement(d.a.Button,{value:1},"\u7B80\u5355"),t.a.createElement(d.a.Button,{value:2},"\u9002\u4E2D"),t.a.createElement(d.a.Button,{value:3},"\u56F0\u96BE")))),t.a.createElement("p",{className:pe.a.titleWrap},t.a.createElement("span",{className:"".concat(pe.a.title)},"\u77E5\u8BC6\u70B9\uFF1A",t.a.createElement("span",{className:pe.a.colorGray},"\uFF08\u6240\u6709\u81EA\u5EFA\u77E5\u8BC6\u70B9\u4EC5\u672C\u4EBA\u53EF\u89C1\uFF0C\u88ABEduCoder\u5E73\u53F0\u5BA1\u6838\u901A\u8FC7\u4E3A\u5B98\u65B9\u77E5\u8BC6\u70B9\u540E\u6240\u6709\u7528\u6237\u53EF\u89C1\uFF09")),t.a.createElement("div",{className:"mt5"},t.a.createElement(De.a,{value:Kt,selectvalues:_e==null?void 0:_e.tag_discipline_ids,onChange:Lt,subId:(et=Fe.editData)===null||et===void 0||((Ct=et.exercise)===null||Ct===void 0)?void 0:Ct.sub_discipline_id,knowledgeOptions:Wt,onAddKnowledgeFinish:On})),t.a.createElement("div",{style:{marginTop:10}},t.a.createElement("span",{style:{marginRight:10}},"\u4E0D\u5141\u8BB8\u5B66\u751F\u91CD\u590D\u7B54\u9898"),t.a.createElement(E.a,{checked:Ut,onChange:function(wt){vn(wt)}}))),t.a.createElement("aside",{className:"tr"},(Pn!==-1||_e.question_id)&&t.a.createElement(v.a,{type:"default",onClick:function(){zn(),Bn(!1)}},"\u53D6\u6D88"),t.a.createElement(v.a,{className:"ml20",type:"primary",onClick:function(){gt()}},"\u4FDD\u5B58")))},Xe=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu current",id:"del"},{name:"(\u5411\u4E0B\u63D2\u5165\u5355\u9009\u9898)",icon:"iconfont c-light-primary ml30 icon-tianjia current",id:"add"},{name:"\u7F16\u8F91",icon:"iconfont c-light-primary ml30 icon-bianjishijuan3x current",id:"edit"}].filter(function(ct){var et,Ct;return(Fe==null||((et=Fe.editData)===null||et===void 0||((Ct=et.exercise)===null||Ct===void 0))?void 0:Ct.exercise_status)===1?ct:ct.id!=="del"&&ct.id!=="add"}),Ze=function(){var ct=Object(ie.a)(r.a.mark(function et(Ct){return r.a.wrap(function(wt){for(;;)switch(wt.prev=wt.next){case 0:if(!(Pn!==-1)){wt.next=3;break}return b.b.error("\u8BF7\u5148\u4FDD\u5B58\u6216\u53D6\u6D88\u5F53\u524D\u6B63\u5728\u7F16\u8F91\u7684\u95EE\u9898\u3002"),wt.abrupt("return");case 3:wt.t0=Ct.id,wt.next=wt.t0==="del"?6:wt.t0==="up"||wt.t0==="down"?8:wt.t0==="edit"?12:wt.t0==="add"?15:17;break;case 6:return H.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u8BD5\u9898\u5417\uFF1F",onOk:function(){return Object(ie.a)(r.a.mark(function Tt(){return r.a.wrap(function(Rn){for(;;)switch(Rn.prev=Rn.next){case 0:return Rn.next=2,Object(I.n)({id:_e.question_id});case 2:je({type:"exercise/editExercise",payload:Object(_.a)({},Mt)});case 3:case"end":return Rn.stop()}},Tt)}))()}}),wt.abrupt("break",17);case 8:return wt.next=10,je({type:"exercise/exeriseMoveUpDown",payload:{id:_e.question_id,opr:Ct.id}});case 10:return je({type:"exercise/editExercise",payload:Object(_.a)({},Mt)}),wt.abrupt("break",17);case 12:return C(_e.dragKey),Bn(!0),wt.abrupt("break",17);case 15:return q({key:_e.key,insert_id:_e==null?void 0:_e.question_id,question_type:4}),wt.abrupt("break",17);case 17:case"end":return wt.stop()}},et)}));return function(Ct){return ct.apply(this,arguments)}}(),We=function(){return t.a.createElement("aside",null,t.a.createElement("div",{className:pe.a.questionType},!(_e!=null&&_e.isPreview)&&t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},_e.key,"\u3001\u7B80\u7B54\u9898"),"\uFF08",_e.question_score,"\u5206\uFF09")),_e!=null&&_e.isPreview?t.a.createElement("div",{style:{display:"flex"}},t.a.createElement("span",{style:{flexShrink:0},className:"font18"},_e.key,"."),t.a.createElement(Ce.a,{value:_e.question_title}),t.a.createElement("span",{style:{flexShrink:0},className:"font16"},"\uFF08",_e.question_score,"\u5206\uFF09")):t.a.createElement("div",{className:"mt5"},t.a.createElement(Ce.a,{value:_e.question_title})),t.a.createElement("div",{className:pe.a.questionChoices},t.a.createElement("p",null,t.a.createElement("strong",null,"\u53C2\u8003\u7B54\u6848\uFF1A")),t.a.createElement(Ce.a,{value:on||""})),t.a.createElement("div",{className:pe.a.action},!_e.hideAction&&Xe.map(function(et,Ct){return et.id==="up"&&_e.key===1||et.id==="down"&&_e.key===_e.len?null:t.a.createElement(f.a,{key:Ct,placement:"bottom",title:et.name},t.a.createElement("span",{onClick:function(){return Ze(et)},className:et.icon}))})))};return t.a.createElement("section",{className:pe.a.wrap},!gn&&We(),gn&&rt())},Un=Object(K.a)(function(pt){var Je=pt.problemset,Ft=pt.loading,Bt=pt.exercise,Fe=pt.globalSetting;return{problemset:Je,globalSetting:Fe,exercise:Bt,loading:Ft.effects}},null,null,{forwardRef:!0})(Object(i.forwardRef)(pn)),Cn=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Qe=function(Je,Ft){var Bt=Je.problemset,Fe=Je.exercise,ue=Je.globalSetting,si=Je.loading,je=Je.dispatch,Be=Je.onRef,Ie=Be===void 0?function(){}:Be,_e=Je.editData,An=Je.cancelAdd,zn=An===void 0?function(){}:An,Pn=Je.editKey,Q=Je.setEditKey,C=Q===void 0?function(){}:Q,L=Je.addCallback,z=L===void 0?function(){}:L,oe=Je.setIsClaer,q=oe===void 0?function(){}:oe,ke=Object(N.a)(Je,["problemset","exercise","globalSetting","loading","dispatch","onRef","editData","cancelAdd","editKey","setEditKey","addCallback","setIsClaer"]),ft=Object(i.useState)([]),kt=Object(o.a)(ft,2),an=kt[0],dt=kt[1],Pt=Object(i.useState)(),tn=Object(o.a)(Pt,2),Vn=tn[0],fi=tn[1],Hn=Object(i.useState)([]),Fn=Object(o.a)(Hn,2),Qt=Fn[0],hn=Fn[1],on=Object(i.useState)(""),Nt=Object(o.a)(on,2),$n=Nt[0],jn=Nt[1],Tn=Object(i.useState)(5),qn=Object(o.a)(Tn,2),En=qn[0],In=qn[1],gn=Object(i.useState)(!1),Bn=Object(o.a)(gn,2),Xn=Bn[0],Zn=Bn[1],Kt=Object(W.g)(),Lt=Object(W.i)();Object(i.useEffect)(function(){dt(["","","",""])},[]),Object(i.useEffect)(function(){if(!(_e!=null&&_e.question_choices)){Zn(!0),jn(""),In(5),dt(["","","",""]),hn([]);return}jn(_e==null?void 0:_e.question_title),In(_e==null?void 0:_e.question_score),dt(_e==null?void 0:_e.question_choices.map(function(Ut){return Ut.choice_text}));var Gt=[];_e==null||_e.standard_answer.map(function(Ut,vn){Gt.push(Ut-1)}),hn(Gt)},[_e]),Object(i.useImperativeHandle)(Ft,function(){return{onSave:yt,isEdit:Xn}});var yt=function(){var Gt=Object(ie.a)(r.a.mark(function Ut(){var vn,_n,un;return r.a.wrap(function(bn){for(;;)switch(bn.prev=bn.next){case 0:if($n){bn.next=3;break}return b.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u76EE"),bn.abrupt("return",!1);case 3:if(vn=an.findIndex(function(dn){return!dn}),!(vn>-1)){bn.next=7;break}return b.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(Cn[vn]," \u9009\u9879\u7684\u5185\u5BB9")),bn.abrupt("return",!1);case 7:if(Qt.length){bn.next=10;break}return b.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),bn.abrupt("return",!1);case 10:if(!(Qt.length<1)){bn.next=13;break}return b.b.info("\u8BF7\u9009\u62E9\u7B54\u6848"),bn.abrupt("return",!1);case 13:if(_n=an.map(function(dn,Mt){return{choice_text:dn,is_answer:Qt.includes(Mt)?Mt+1:0}}),!_e.question_id){bn.next=20;break}return bn.next=17,je({type:"exercise/editExerciseQuestion",payload:{id:_e.question_id,question_title:$n,question_type:1,question_score:En,question_choices:_n.map(function(dn){return dn.choice_text}),standard_answers:_n.filter(function(dn){return dn.is_answer}).map(function(dn){return dn.is_answer})}});case 17:un=bn.sent,bn.next=23;break;case 20:return bn.next=22,je({type:"exercise/addExerciseQuestion",payload:{insert_id:_e==null?void 0:_e.insert_id,categoryId:Lt.categoryId,question_title:$n,question_type:1,question_score:"5.0",question_choices:_n.map(function(dn){return dn.choice_text}),standard_answers:_n.filter(function(dn){return dn.is_answer}).map(function(dn){return dn.is_answer})}});case 22:un=bn.sent;case 23:un.status===0&&(b.b.success("\u4FDD\u5B58\u6210\u529F"),Zn(!1),je({type:"exercise/editExercise",payload:Object(_.a)({},Lt)}));case 24:case"end":return bn.stop()}},Ut)}));return function(){return Gt.apply(this,arguments)}}(),It=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu current",id:"del"},{name:"(\u5411\u4E0B\u63D2\u5165\u5355\u9009\u9898)",icon:"iconfont c-light-primary ml30 icon-tianjia current",id:"add"},{name:"\u7F16\u8F91",icon:"iconfont c-light-primary ml30 icon-bianjishijuan3x current",id:"edit"}].filter(function(Gt){var Ut,vn;return(Fe==null||((Ut=Fe.editData)===null||Ut===void 0||((vn=Ut.exercise)===null||vn===void 0))?void 0:vn.exercise_status)===1?Gt:Gt.id!=="del"&&Gt.id!=="add"}),Ot=function(){var Gt=Object(ie.a)(r.a.mark(function Ut(vn){return r.a.wrap(function(un){for(;;)switch(un.prev=un.next){case 0:if(!(Pn!==-1)){un.next=3;break}return b.b.error("\u8BF7\u5148\u4FDD\u5B58\u6216\u53D6\u6D88\u5F53\u524D\u6B63\u5728\u7F16\u8F91\u7684\u95EE\u9898\u3002"),un.abrupt("return");case 3:un.t0=vn.id,un.next=un.t0==="del"?6:un.t0==="up"||un.t0==="down"?8:un.t0==="edit"?12:un.t0==="add"?14:16;break;case 6:return H.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u8BD5\u9898\u5417\uFF1F",onOk:function(){return Object(ie.a)(r.a.mark(function bn(){return r.a.wrap(function(Mt){for(;;)switch(Mt.prev=Mt.next){case 0:return Mt.next=2,Object(I.n)({id:_e.question_id});case 2:je({type:"exercise/editExercise",payload:Object(_.a)({},Lt)});case 3:case"end":return Mt.stop()}},bn)}))()}}),un.abrupt("break",16);case 8:return un.next=10,je({type:"exercise/exeriseMoveUpDown",payload:{id:_e.question_id,opr:vn.id}});case 10:return je({type:"exercise/editExercise",payload:Object(_.a)({},Lt)}),un.abrupt("break",16);case 12:return Kt.push("/problems/".concat(_e==null?void 0:_e.hack_identifier,"/edit?type=exercises&express_id=").concat(Lt.categoryId,"&question_id=").concat(_e==null?void 0:_e.question_id,"&score=").concat(_e==null?void 0:_e.question_score,"&exercise=true&callback_url=").concat(location.pathname)),un.abrupt("break",16);case 14:return z({key:_e.key,insert_id:_e==null?void 0:_e.question_id,question_type:6}),un.abrupt("break",16);case 16:case"end":return un.stop()}},Ut)}));return function(vn){return Gt.apply(this,arguments)}}(),Vt=function(){var Gt=Object(ie.a)(r.a.mark(function Ut(vn){var _n;return r.a.wrap(function(cn){for(;;)switch(cn.prev=cn.next){case 0:return vn.preventDefault(),cn.next=3,Object(I.X)({id:_e==null?void 0:_e.hack_identifier});case 3:_n=cn.sent,_n.status===0&&Object(ae.S)("/myproblems/".concat(_n==null?void 0:_n.identifier));case 5:case"end":return cn.stop()}},Ut)}));return function(vn){return Gt.apply(this,arguments)}}(),Zt=function(){return t.a.createElement("aside",null,t.a.createElement("div",{className:pe.a.questionType},!(_e!=null&&_e.isPreview)&&t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},_e.key,"\u3001\u7F16\u7A0B\u9898"),"\uFF08",_e.question_score,"\u5206\uFF09")),_e!=null&&_e.isPreview?t.a.createElement("div",{style:{display:"flex"}},t.a.createElement("span",{style:{flexShrink:0},className:"font18"},_e.key,"."),t.a.createElement(Ce.a,{value:_e.question_title}),t.a.createElement("span",{style:{flexShrink:0},className:"font16"},"\uFF08",_e.question_score,"\u5206\uFF09")):t.a.createElement("div",{className:"mt5"},t.a.createElement(Ce.a,{value:_e.question_title})),t.a.createElement("div",{className:pe.a.questionChoices},t.a.createElement(Ce.a,{value:_e.description||""})),t.a.createElement("div",{className:pe.a.action},!_e.hideAction&&It.map(function(Ut,vn){return Ut.id==="up"&&_e.key===1||Ut.id==="down"&&_e.key===_e.len?null:t.a.createElement(f.a,{key:vn,placement:"bottom",title:Ut.name},t.a.createElement("span",{onClick:function(){return Ot(Ut)},className:Ut.icon}))})))};return t.a.createElement("section",{className:pe.a.wrap},Zt())},Ye=Object(K.a)(function(pt){var Je=pt.problemset,Ft=pt.loading,Bt=pt.globalSetting,Fe=pt.exercise;return{problemset:Je,globalSetting:Bt,exercise:Fe,loading:Ft.effects}},null,null,{forwardRef:!0})(Object(i.forwardRef)(Qe)),St=V("LvDl"),bt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],nt=function(Je,Ft){var Bt=Je.problemset,Fe=Je.exercise,ue=Je.globalSetting,si=Je.loading,je=Je.dispatch,Be=Je.onRef,Ie=Be===void 0?function(){}:Be,_e=Je.editData,An=Je.cancelAdd,zn=An===void 0?function(){}:An,Pn=Je.editKey,Q=Je.setEditKey,C=Q===void 0?function(){}:Q,L=Je.setIsClaer,z=L===void 0?function(){}:L,oe=Je.addCallback,q=oe===void 0?function(gt){}:oe,ke=Je.reload,ft=ke===void 0?function(){}:ke,kt=Object(N.a)(Je,["problemset","exercise","globalSetting","loading","dispatch","onRef","editData","cancelAdd","editKey","setEditKey","setIsClaer","addCallback","reload"]),an=Object(i.useState)([]),dt=Object(o.a)(an,2),Pt=dt[0],tn=dt[1],Vn=Object(i.useState)(!1),fi=Object(o.a)(Vn,2),Hn=fi[0],Fn=fi[1],Qt=Object(i.useState)(!0),hn=Object(o.a)(Qt,2),on=hn[0],Nt=hn[1],$n=Object(i.useState)(1),jn=Object(o.a)($n,2),Tn=jn[0],qn=jn[1],En=Object(i.useState)(!1),In=Object(o.a)(En,2),gn=In[0],Bn=In[1],Xn=Object(i.useState)([]),Zn=Object(o.a)(Xn,2),Kt=Zn[0],Lt=Zn[1],yt=Object(W.i)(),It=Object(i.useRef)(null),Ot=Object(i.useState)(""),Vt=Object(o.a)(Ot,2),Zt=Vt[0],Gt=Vt[1],Ut=Object(i.useState)([]),vn=Object(o.a)(Ut,2),_n=vn[0],un=vn[1],cn=Object(i.useRef)(!1),bn=function(rt){Lt([].concat(Object(F.a)(Kt),[Object(_.a)({},rt)]))};Object(i.useEffect)(function(){var gt;if(cn.current)return;if(!(_e!=null&&_e.question_title)){Fn(!0),Gt("");return}Gt(_e==null?void 0:_e.question_title),Bn(!(_e!=null&&_e.repeat_answer)),qn(_e==null?void 0:_e.difficulty),tn(_e.tag_discipline_ids);var rt=_e==null||((gt=_e.sub_exercise_questions)===null||gt===void 0)?void 0:gt.map(function(Xe){var Ze,We,ct;return Object(_.a)(Object(_.a)({},Xe),{},{id:Xe.question_id,name:Xe.question_title,open:!1,score:Xe.question_score,qusList:Xe==null||((Ze=Xe.question_choices)===null||Ze===void 0)?void 0:Ze.map(function(et){return et.choice_text}),activeQusEditor:null,qusAnswer:(We=[Xe==null||((ct=Xe.question_choices)===null||ct===void 0)?void 0:ct.findIndex(function(et){return et.standard_boolean})])===null||We===void 0?void 0:We.filter(function(et){return et!==-1})})});un(rt)},[_e,Hn]),Object(i.useEffect)(function(){Hn&>();function gt(){return rt.apply(this,arguments)}function rt(){return rt=Object(ie.a)(r.a.mark(function Xe(){var Ze,We,ct;return r.a.wrap(function(Ct){for(;;)switch(Ct.prev=Ct.next){case 0:return Ct.next=2,Object(I.I)({sub_discipline_id:(Ze=Fe.editData)===null||Ze===void 0||((We=Ze.exercise)===null||We===void 0)?void 0:We.sub_discipline_id});case 2:ct=Ct.sent,Lt(ct.tag_disciplines);case 4:case"end":return Ct.stop()}},Xe)})),rt.apply(this,arguments)}},[Hn]),Object(i.useEffect)(function(){var gt,rt=Fe!=null&&(gt=Fe.tagDisciplineData)!==null&>!==void 0&>.tag_disciplines&&Array.isArray(Fe.tagDisciplineData.tag_disciplines)?Fe.tagDisciplineData.tag_disciplines:[];Lt(rt)},[Fe.tagDisciplineData]),Object(i.useImperativeHandle)(Ft,function(){return{onSave:Mt,isEdit:Hn}});var dn=function(rt){(rt==null?void 0:rt.status)===0&&(b.b.success("\u4FDD\u5B58\u6210\u529F"),Fn(!1),C(-1),cn.current=!1,ft())},Mt=function(){var gt=Object(ie.a)(r.a.mark(function rt(){var Xe,Ze,We,ct,et,Ct,jt,wt;return r.a.wrap(function(Tt){for(;;)switch(Tt.prev=Tt.next){case 0:if(Zt){Tt.next=3;break}return b.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),Tt.abrupt("return",!1);case 3:if(!(_n.length===0)){Tt.next=6;break}return b.b.info("\u8BF7\u60A8\u6DFB\u52A0\u5C0F\u9898"),Tt.abrupt("return",!1);case 6:Xe=0;case 7:if(!(Xe<_n.length)){Tt.next=25;break}if(We=_n[Xe],We!=null&&We.name){Tt.next=12;break}return b.b.info("\u8BF7\u60A8\u8F93\u5165\u7B2C".concat(Xe+1,"\u5C0F\u9898\u9898\u5E72")),Tt.abrupt("return",!1);case 12:if(We!=null&&We.score){Tt.next=15;break}return b.b.info("\u7B2C".concat(Xe+1,"\u5C0F\u9898\u5206\u6570\u4E0D\u80FD\u4E3A0\u6216\u7A7A")),Tt.abrupt("return",!1);case 15:if(ct=We==null||((Ze=We.qusList)===null||Ze===void 0)?void 0:Ze.findIndex(function(At){return!At}),!(ct>-1)){Tt.next=19;break}return b.b.info("\u8BF7\u5148\u8F93\u5165\u7B2C".concat(Xe+1,"\u5C0F\u9898").concat(bt[ct],"\u9009\u9879\u7684\u5185\u5BB9")),Tt.abrupt("return",!1);case 19:if(We!=null&&We.qusAnswer.length){Tt.next=22;break}return b.b.info("\u8BF7\u8BBE\u7F6E\u7B2C".concat(Xe+1,"\u5C0F\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E")),Tt.abrupt("return",!1);case 22:Xe++,Tt.next=7;break;case 25:if(et=_n.map(function(At){var Rn;return{id:At.id>1?At.id:null,question_title:At.name,question_type:1,question_choices:At.qusList,question_score:At.score,standard_answers:[((Rn=At.qusAnswer)===null||Rn===void 0?void 0:Rn[0])+1]}}),cn.current=!0,!_e.question_id){Tt.next=36;break}if(!((_e==null?void 0:_e.is_my)===1)){Tt.next=32;break}H.a.confirm({title:"\u63D0\u793A",content:"\u6B64\u9898\u76EE\u5DF2\u5B58\u5728\u4E8E\u8BD5\u9898\u5E93\uFF0C\u662F\u5426\u5C06\u4FEE\u6539\u540E\u7684\u9898\u76EE\u8986\u76D6\u8BD5\u9898\u5E93\u7684\u539F\u9898\uFF1F",okText:"\u8986\u76D6\u539F\u9898",cancelText:"\u4E0D\u8986\u76D6",keyboard:!1,onOk:function(){var At=Object(ie.a)(r.a.mark(function yn(){var mi,ei;return r.a.wrap(function(nn){for(;;)switch(nn.prev=nn.next){case 0:return nn.next=2,je({type:"exercise/editExerciseQuestion",payload:{id:_e.question_id,question_title:Zt,question_type:7,sub_questions:et,tag_discipline_ids:Pt,sub_discipline_id:(mi=Fe.editData)===null||mi===void 0||((ei=mi.exercise)===null||ei===void 0)?void 0:ei.sub_discipline_id,difficulty:Tn,is_cover:1,repeat_answer:!gn}});case 2:Ct=nn.sent,dn(Ct);case 4:case"end":return nn.stop()}},yn)}));function Rn(){return At.apply(this,arguments)}return Rn}(),onCancel:function(){var At=Object(ie.a)(r.a.mark(function yn(){var mi,ei;return r.a.wrap(function(nn){for(;;)switch(nn.prev=nn.next){case 0:return nn.next=2,je({type:"exercise/editExerciseQuestion",payload:{id:_e.question_id,question_title:Zt,question_type:7,sub_questions:et,tag_discipline_ids:Pt,sub_discipline_id:(mi=Fe.editData)===null||mi===void 0||((ei=mi.exercise)===null||ei===void 0)?void 0:ei.sub_discipline_id,difficulty:Tn,repeat_answer:!gn}});case 2:Ct=nn.sent,dn(Ct);case 4:case"end":return nn.stop()}},yn)}));function Rn(){return At.apply(this,arguments)}return Rn}()}),Tt.next=36;break;case 32:return Tt.next=34,je({type:"exercise/editExerciseQuestion",payload:{id:_e.question_id,question_title:Zt,question_type:7,sub_questions:et,tag_discipline_ids:Pt,sub_discipline_id:(jt=Fe.editData)===null||jt===void 0||((wt=jt.exercise)===null||wt===void 0)?void 0:wt.sub_discipline_id,difficulty:Tn,repeat_answer:!gn}});case 34:Ct=Tt.sent,dn(Ct);case 36:case"end":return Tt.stop()}},rt)}));return function(){return gt.apply(this,arguments)}}(),Yt=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu current",id:"del"},{name:"\u7F16\u8F91",icon:"iconfont c-light-primary ml30 icon-bianjishijuan3x current",id:"edit"}].filter(function(gt){var rt,Xe;return(Fe==null||((rt=Fe.editData)===null||rt===void 0||((Xe=rt.exercise)===null||Xe===void 0))?void 0:Xe.exercise_status)===1?gt:gt.id!=="del"&>.id!=="add"}),qt=function(){var gt=Object(ie.a)(r.a.mark(function rt(Xe){return r.a.wrap(function(We){for(;;)switch(We.prev=We.next){case 0:if(!(Pn!==-1)){We.next=3;break}return b.b.error("\u8BF7\u5148\u4FDD\u5B58\u6216\u53D6\u6D88\u5F53\u524D\u6B63\u5728\u7F16\u8F91\u7684\u95EE\u9898\u3002"),We.abrupt("return");case 3:We.t0=Xe.id,We.next=We.t0==="del"?6:We.t0==="up"||We.t0==="down"?8:We.t0==="edit"?12:We.t0==="add"?15:17;break;case 6:return H.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u8BD5\u9898\u5417\uFF1F",onOk:function(){return Object(ie.a)(r.a.mark(function et(){return r.a.wrap(function(jt){for(;;)switch(jt.prev=jt.next){case 0:return jt.next=2,Object(I.n)({id:_e.question_id});case 2:je({type:"exercise/editExercise",payload:Object(_.a)({},yt)});case 3:case"end":return jt.stop()}},et)}))()}}),We.abrupt("break",17);case 8:return We.next=10,je({type:"exercise/exeriseMoveUpDown",payload:{id:_e.question_id,opr:Xe.id}});case 10:return je({type:"exercise/editExercise",payload:Object(_.a)({},yt)}),We.abrupt("break",17);case 12:return C(_e.dragKey),Fn(!0),We.abrupt("break",17);case 15:return q({key:_e.key,insert_id:_e==null?void 0:_e.question_id,question_type:0}),We.abrupt("break",17);case 17:case"end":return We.stop()}},rt)}));return function(Xe){return gt.apply(this,arguments)}}(),Wt=function(){var rt;return t.a.createElement("aside",{ref:It},t.a.createElement("div",{className:pe.a.questionType},!(_e!=null&&_e.isPreview)&&t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},_e.key,"\u3001\u7EC4\u5408\u9898"),"\uFF08",_e.question_score,"\u5206\uFF09")),_e!=null&&_e.isPreview?t.a.createElement("div",{style:{display:"flex",alignItems:"flex-start"}},t.a.createElement("span",{style:{flexShrink:0},className:"font18"},_e.key,"."),t.a.createElement(Ce.a,{value:_e.question_title}),t.a.createElement("span",{style:{flexShrink:0},className:"font16"},"\uFF08\u5171",_e==null?void 0:_e.sub_q_count,"\u5C0F\u9898\uFF0C",_e.question_score,"\u5206\uFF09")):t.a.createElement("div",{className:"mt5"},t.a.createElement(Ce.a,{value:_e.question_title})),t.a.createElement("div",{style:{display:on?"block":"none"},className:pe.a.questionChoices},_e==null||((rt=_e.sub_exercise_questions)===null||rt===void 0)?void 0:rt.map(function(Xe,Ze){var We;return t.a.createElement("div",{key:Ze},t.a.createElement("div",{style:{display:"flex",alignItems:"flex-start"}},t.a.createElement("span",{style:{flexShrink:0},className:"font18"},_e.key,".",Ze+1,"\uFF08\u5355\u9009\u9898\uFF09"),t.a.createElement(Ce.a,{value:Xe.question_title}),t.a.createElement("span",{style:{flexShrink:0},className:"font16"},"\uFF08",Xe.question_score,"\u5206\uFF09")),Xe==null||((We=Xe.question_choices)===null||We===void 0)?void 0:We.map(function(ct,et){return t.a.createElement(k.a,{key:et},t.a.createElement(R.a,null,t.a.createElement(d.a,{key:et,checked:Xe.standard_answer.includes(et+1),disabled:!0},bt[et],".")),t.a.createElement(R.a,{flex:"1"},t.a.createElement("span",{className:"c-black font14"},t.a.createElement(Ce.a,{value:ct.choice_text}))))}))})),t.a.createElement("div",{className:pe.a.action},t.a.createElement("span",{className:"c-light-primary current",onClick:function(){return Nt(!on)},style:{}},on?"\u6536\u8D77":"\u5C55\u5F00"),!_e.hideAction&&Yt.map(function(Xe,Ze){return Xe.id==="up"&&_e.key===1||Xe.id==="down"&&_e.key===_e.len?null:t.a.createElement(f.a,{key:Ze,placement:"bottom",title:Xe.name},t.a.createElement("span",{onClick:function(){return qt(Xe)},className:Xe.icon}))})))},fn=function(){var rt,Xe;return t.a.createElement("aside",null,t.a.createElement("div",{className:pe.a.questionType},t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},"\u9009\u62E9\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848\uFF09")),t.a.createElement("section",{className:pe.a.wrap,style:{padding:0}},t.a.createElement("p",{className:pe.a.titleWrap},t.a.createElement("span",{className:pe.a.required},"*"),t.a.createElement("span",{className:pe.a.title},"\u9898\u5E72\uFF1A")),t.a.createElement(x.a,{id:"combination-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Zt,onChange:function(We){return Gt(We)}}),t.a.createElement("p",null,"\u5C0F\u9898\u6570\uFF1A",_n==null?void 0:_n.length),_n==null?void 0:_n.map(function(Ze,We){var ct;return t.a.createElement("div",{className:pe.a.fold,key:Ze.id},t.a.createElement("div",{onClick:function(){return wn("open",We)},className:pe.a.head},t.a.createElement("i",{className:"iconfont icon-sanjiaoxing",style:{transform:Ze.open?"initial":"rotate(270deg) translate(2px, 4px)"}}),t.a.createElement("span",null,"\u7B2C",We+1,"\u5C0F\u9898\uFF08\u5355\u9009\u9898\uFF09"),t.a.createElement("b",{onClick:function(Ct){Ct.stopPropagation(),wn("delete",We)},className:"iconfont icon-shanchu8"})),t.a.createElement("div",{className:"mb10",style:{display:Ze.open?"block":"none"}},t.a.createElement(x.a,{watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Ze==null?void 0:Ze.name,onChange:function(Ct){return wn("value",We,Ct)}}),t.a.createElement("p",{className:pe.a.titleWrap},t.a.createElement("span",{className:pe.a.required},"*"),t.a.createElement("span",{className:pe.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",t.a.createElement("span",{className:pe.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),Ze==null||((ct=Ze.qusList)===null||ct===void 0)?void 0:ct.map(function(et,Ct){var jt,wt;return t.a.createElement("div",{className:pe.a.choiceWrap,key:Ct},t.a.createElement(f.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},t.a.createElement("div",{className:"".concat(pe.a.answer," ").concat(Ze!=null&&(jt=Ze.qusAnswer)!==null&&jt!==void 0&&jt.includes(Ct)?pe.a.activeAnswer:""),onClick:function(){return wn("answer",We,Ct)}},bt[Ct])),t.a.createElement("div",{className:pe.a.editorWrap},(Ze==null?void 0:Ze.activeQusEditor)===Ct?t.a.createElement(x.a,{id:"single-question-option-".concat(Ct),watch:!0,height:155,isFocus:!0,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:et,onChange:function(Tt){return wn("details",We,Tt)}}):t.a.createElement("div",{className:pe.a.htmlWrap,onClick:function(){return wn("edit",We,Ct)}},t.a.createElement(Ce.a,{value:et}))),Ct>1&&t.a.createElement(f.a,{title:"\u5220\u9664"},t.a.createElement("i",{className:"".concat(pe.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return wn("deleteQus",We,Ct)}})),Ct<7&&Ct===(Ze==null||((wt=Ze.qusList)===null||wt===void 0)?void 0:wt.length)-1&&t.a.createElement(f.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},t.a.createElement("i",{className:"".concat(pe.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return wn("addQus",We)}})))}),t.a.createElement("p",{className:"mt10"},"\u5206\u503C\uFF1A",t.a.createElement(U.a,{value:Ze.score,max:1e4,min:0,onChange:function(Ct){return wn("score",We,Ct)}})," ","\u5206")))}),_n.length<20&&t.a.createElement(v.a,{type:"primary",onClick:On},t.a.createElement("i",{className:"iconfont icon-tianjiatimu mr5 font14"}),"\u6DFB\u52A0\u5C0F\u9898")),t.a.createElement("p",{className:"mt10"},t.a.createElement("span",{className:pe.a.difficult},t.a.createElement("label",{style:{color:"red"}},"*")," \u96BE\u5EA6\uFF1A",t.a.createElement(d.a.Group,{value:Tn,onChange:function(We){qn(We.target.value)}},t.a.createElement(d.a.Button,{value:1},"\u7B80\u5355"),t.a.createElement(d.a.Button,{value:2},"\u9002\u4E2D"),t.a.createElement(d.a.Button,{value:3},"\u56F0\u96BE")))),t.a.createElement("p",{className:pe.a.titleWrap},t.a.createElement("span",{className:"".concat(pe.a.title)},"\u77E5\u8BC6\u70B9\uFF1A",t.a.createElement("span",{className:pe.a.colorGray},"\uFF08\u6240\u6709\u81EA\u5EFA\u77E5\u8BC6\u70B9\u4EC5\u672C\u4EBA\u53EF\u89C1\uFF0C\u88ABEduCoder\u5E73\u53F0\u5BA1\u6838\u901A\u8FC7\u4E3A\u5B98\u65B9\u77E5\u8BC6\u70B9\u540E\u6240\u6709\u7528\u6237\u53EF\u89C1\uFF09")),t.a.createElement("div",{className:"mt5"},t.a.createElement(De.a,{selectvalues:_e==null?void 0:_e.tag_discipline_ids,value:Pt,onChange:tn,subId:(rt=Fe.editData)===null||rt===void 0||((Xe=rt.exercise)===null||Xe===void 0)?void 0:Xe.sub_discipline_id,knowledgeOptions:Kt,onAddKnowledgeFinish:bn}))),t.a.createElement("aside",{className:"tr"},(Pn!==-1||_e.question_id)&&t.a.createElement(v.a,{type:"default",onClick:function(){zn(),Fn(!1)}},"\u53D6\u6D88"),t.a.createElement(v.a,{className:"ml20",type:"primary",onClick:function(){Mt()}},"\u4FDD\u5B58")))},On=function(){var rt={id:Math.random(),item_type:"SINGLE",open:!1,name:"",qusList:["","","",""],activeQusEditor:null,qusAnswer:[],analysis:""};un(_n.concat(rt))},wn=function(rt,Xe,Ze){var We=Object(St.cloneDeep)(_n);if(rt==="open"&&(We[Xe].open=!We[Xe].open),rt==="delete"&&We.splice(Xe,1),rt==="value"&&(We[Xe].name=Ze),rt==="answer"&&(We[Xe].qusAnswer=[Ze]),rt==="edit"&&(We[Xe].activeQusEditor=Ze),rt==="details"&&(We[Xe].qusList[We[Xe].activeQusEditor]=Ze),rt==="addQus"&&(We[Xe].qusList=We[Xe].qusList.concat("")),rt==="deleteQus"){var ct;We[Xe].qusList=We[Xe].qusList.filter(function(et,Ct){return Ct!==Ze}),We[Xe].qusAnswer=(ct=We[Xe].qusAnswer)===null||ct===void 0?void 0:ct.filter(function(et){return et!==Ze})}rt==="analysis"&&(We[Xe].analysis=Ze),rt==="score"&&(We[Xe].score=Ze),un(We)};return t.a.createElement("section",{className:pe.a.wrap},!Hn&&Wt(),Hn&&fn())},vt=Object(K.a)(function(pt){var Je=pt.problemset,Ft=pt.loading,Bt=pt.globalSetting,Fe=pt.exercise;return{problemset:Je,globalSetting:Bt,exercise:Fe,loading:Ft.effects}},null,null,{forwardRef:!0})(Object(i.forwardRef)(nt)),Ue=V("ngQI"),Ae=V("loLm"),Re=V.n(Ae),le=V("ErOA"),he=V("vCeJ"),Se=V("Nog9"),ve=V.n(Se),Pe=V("hQp1"),it=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],xt=function(Je,Ft){var Bt=Je.newExercisePaper,Fe=Je.dispatch,ue=Je.editData,si=Je.cancelAdd,je=si===void 0?function(){}:si,Be=Je.editKey,Ie=Je.setEditKey,_e=Ie===void 0?function(){}:Ie,An=Je.reload,zn=An===void 0?function(){}:An,Pn=Je.addCallback,Q=Pn===void 0?function(Xe){}:Pn,C=Object(i.useState)([]),L=Object(o.a)(C,2),z=L[0],oe=L[1],q=Object(i.useState)(),ke=Object(o.a)(q,2),ft=ke[0],kt=ke[1],an=Object(i.useState)([]),dt=Object(o.a)(an,2),Pt=dt[0],tn=dt[1],Vn=Object(i.useState)(""),fi=Object(o.a)(Vn,2),Hn=fi[0],Fn=fi[1],Qt=Object(i.useState)(),hn=Object(o.a)(Qt,2),on=hn[0],Nt=hn[1],$n=Object(i.useState)([]),jn=Object(o.a)($n,2),Tn=jn[0],qn=jn[1],En=Object(i.useState)(!1),In=Object(o.a)(En,2),gn=In[0],Bn=In[1],Xn=Object(i.useState)(1),Zn=Object(o.a)(Xn,2),Kt=Zn[0],Lt=Zn[1],yt=Object(i.useState)(!1),It=Object(o.a)(yt,2),Ot=It[0],Vt=It[1],Zt=Object(i.useState)(""),Gt=Object(o.a)(Zt,2),Ut=Gt[0],vn=Gt[1],_n=Object(W.i)(),un=Object(i.useRef)(null),cn=Object(i.useRef)(!1),bn=Object(i.useState)([]),dn=Object(o.a)(bn,2),Mt=dn[0],Yt=dn[1],qt=function(Ze){Yt([].concat(Object(F.a)(Mt),[Object(_.a)({},Ze)]))};Object(i.useEffect)(function(){oe(["","","",""])},[]),Object(i.useEffect)(function(){if(cn.current)return;if(!(ue!=null&&ue.question_choices)){Bn(!0),Fn(""),Nt(5),oe(["","","",""]),tn([]);return}Fn(ue==null?void 0:ue.question_title),Nt(ue==null?void 0:ue.question_score),Vt(!(ue!=null&&ue.repeat_answer)),vn(ue==null?void 0:ue.analysis),Lt(ue==null?void 0:ue.difficulty),oe(ue==null?void 0:ue.question_choices.map(function(Ze){return Ze.choice_text}));var Xe=[];ue==null||ue.standard_answer.map(function(Ze,We){Xe.push(Ze-1)}),qn(ue.tag_discipline_ids),tn(Xe)},[ue,gn]),Object(i.useEffect)(function(){gn&&Xe();function Xe(){return Ze.apply(this,arguments)}function Ze(){return Ze=Object(ie.a)(r.a.mark(function We(){var ct,et,Ct;return r.a.wrap(function(wt){for(;;)switch(wt.prev=wt.next){case 0:return wt.next=2,Object(I.I)({sub_discipline_id:(ct=Bt.editData)===null||ct===void 0||((et=ct.exercise)===null||et===void 0)?void 0:et.sub_discipline_id});case 2:Ct=wt.sent,Yt(Ct.tag_disciplines);case 4:case"end":return wt.stop()}},We)})),Ze.apply(this,arguments)}},[gn]),Object(i.useEffect)(function(){var Xe,Ze=Bt!=null&&(Xe=Bt.tagDisciplineData)!==null&&Xe!==void 0&&Xe.tag_disciplines&&Array.isArray(Bt.tagDisciplineData.tag_disciplines)?Bt.tagDisciplineData.tag_disciplines:[];Yt(Ze)},[Bt.tagDisciplineData]),Object(i.useImperativeHandle)(Ft,function(){return{onSave:fn,isEdit:gn}});var Wt=function(Ze){(Ze==null?void 0:Ze.status)===0&&(b.b.success("\u4FDD\u5B58\u6210\u529F"),Bn(!1),_e(-1),cn.current=!1,zn())},fn=function(){var Xe=Object(ie.a)(r.a.mark(function Ze(){var We,ct,et,Ct,jt,wt,Jt;return r.a.wrap(function(At){for(;;)switch(At.prev=At.next){case 0:if(Hn){At.next=3;break}return b.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u76EE"),At.abrupt("return",!1);case 3:if(We=z.findIndex(function(Rn){return!Rn}),!(We>-1)){At.next=7;break}return b.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(it[We]," \u9009\u9879\u7684\u5185\u5BB9")),At.abrupt("return",!1);case 7:if(Pt.length){At.next=10;break}return b.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),At.abrupt("return",!1);case 10:if(!(Pt.length<1)){At.next=13;break}return b.b.info("\u8BF7\u9009\u62E9\u7B54\u6848"),At.abrupt("return",!1);case 13:if(ct=z.map(function(Rn,yn){return{choice_text:Rn,is_answer:Pt.includes(yn)?1:0}}),cn.current=!0,!ue.question_id){At.next=22;break}return At.next=18,Fe({type:"newExercisePaper/editExerciseQuestion",payload:{id:_n.id,question_id:ue.question_id,name:Hn,item_type:Pt.length>1?Pe.a.Multiple:Pe.a.Single,question_score:on,choices:ct,tag_discipline_ids:Tn,sub_discipline_id:(Ct=Bt.editData)===null||Ct===void 0||((jt=Ct.exercise)===null||jt===void 0)?void 0:jt.sub_discipline_id,difficulty:Kt,repeat_answer:!Ot,analysis:Ut}});case 18:et=At.sent,Wt(et),At.next=26;break;case 22:return At.next=24,Fe({type:"newExercisePaper/addExerciseQuestion",payload:{insert_id:ue==null?void 0:ue.insert_id,id:_n.id,name:Hn,item_type:Pt.length>1?Pe.a.Multiple:Pe.a.Single,question_score:on,choices:ct,tag_discipline_ids:Tn,sub_discipline_id:(wt=Bt.editData)===null||wt===void 0||((Jt=wt.exercise)===null||Jt===void 0)?void 0:Jt.sub_discipline_id,difficulty:Kt,repeat_answer:!Ot,analysis:Ut}});case 24:et=At.sent,Wt(et);case 26:case"end":return At.stop()}},Ze)}));return function(){return Xe.apply(this,arguments)}}(),On=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu current",id:"del"},{name:"(\u5411\u4E0B\u63D2\u5165\u5355\u9009\u9898)",icon:"iconfont c-light-primary ml30 icon-tianjia current",id:"add"},{name:"\u7F16\u8F91",icon:"iconfont c-light-primary ml30 icon-bianjishijuan3x current",id:"edit"}],wn=function(){var Xe=Object(ie.a)(r.a.mark(function Ze(We){return r.a.wrap(function(et){for(;;)switch(et.prev=et.next){case 0:if(!(Be!==-1)){et.next=3;break}return b.b.error("\u8BF7\u5148\u4FDD\u5B58\u6216\u53D6\u6D88\u5F53\u524D\u6B63\u5728\u7F16\u8F91\u7684\u95EE\u9898\u3002"),et.abrupt("return");case 3:et.t0=We.id,et.next=et.t0==="del"?6:et.t0==="edit"?8:et.t0==="add"?11:13;break;case 6:return H.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u8BD5\u9898\u5417\uFF1F",onOk:function(){return Object(ie.a)(r.a.mark(function jt(){return r.a.wrap(function(Jt){for(;;)switch(Jt.prev=Jt.next){case 0:return Jt.next=2,Object(he.g)({exam_id:_n.id,question_id:ue.question_id});case 2:Fe({type:"newExercisePaper/editExercise",payload:Object(_.a)({},_n)});case 3:case"end":return Jt.stop()}},jt)}))()}}),et.abrupt("break",13);case 8:return _e(ue.dragKey),Bn(!0),et.abrupt("break",13);case 11:return Q({key:ue.key,insert_id:ue==null?void 0:ue.question_id,question_type:0}),et.abrupt("break",13);case 13:case"end":return et.stop()}},Ze)}));return function(We){return Xe.apply(this,arguments)}}(),gt=function(){var Ze;return t.a.createElement("aside",{ref:un},t.a.createElement("div",{className:ve.a.questionType},!(ue!=null&&ue.isPreview)&&t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},ue.key,"\u3001\u5355\u9009\u9898"),"\uFF08",ue.question_score,"\u5206\uFF09")),ue!=null&&ue.isPreview?t.a.createElement("div",{style:{display:"flex",alignItems:"flex-start"}},t.a.createElement("span",{style:{flexShrink:0},className:"font18"},ue.key,"."),t.a.createElement(Ce.a,{value:ue.question_title}),t.a.createElement("span",{style:{flexShrink:0},className:"font16"},"\uFF08",ue.question_score,"\u5206\uFF09")):t.a.createElement("div",{className:"mt5"},t.a.createElement(Ce.a,{value:ue.question_title})),t.a.createElement("div",{className:ve.a.questionChoices},ue==null||((Ze=ue.question_choices)===null||Ze===void 0)?void 0:Ze.map(function(We,ct){return t.a.createElement(k.a,{key:ct},t.a.createElement(R.a,null,t.a.createElement(d.a,{key:ct,checked:ue.standard_answer.includes(ct+1),disabled:!0},it[ct],".")),t.a.createElement(R.a,{flex:"1"},t.a.createElement("span",{className:"c-black font14"},t.a.createElement(Ce.a,{value:We.choice_text}))))})),t.a.createElement("div",{className:ve.a.action},!ue.hideAction&&On.map(function(We,ct){return t.a.createElement(f.a,{key:ct,placement:"bottom",title:We.name},t.a.createElement("span",{onClick:function(){return wn(We)},className:We.icon}))})))},rt=function(){var Ze,We;return t.a.createElement("aside",null,t.a.createElement("div",{className:ve.a.questionType},t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},"\u9009\u62E9\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848\uFF09")),t.a.createElement("p",{className:ve.a.titleWrap},t.a.createElement("span",{className:ve.a.required},"*"),t.a.createElement("span",{className:ve.a.title},"\u9898\u5E72\uFF1A")),t.a.createElement(x.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Hn,onChange:function(et){return Fn(et)}}),t.a.createElement("p",{className:ve.a.titleWrap},t.a.createElement("span",{className:ve.a.required},"*"),t.a.createElement("span",{className:ve.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",t.a.createElement("span",{className:ve.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),z.map(function(ct,et){return t.a.createElement("div",{className:ve.a.choiceWrap,key:et},t.a.createElement(f.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},t.a.createElement("div",{className:"".concat(ve.a.answer," ").concat(Pt.includes(et)?ve.a.activeAnswer:""),onClick:function(){Pt.includes(et)?tn(function(jt){return jt.filter(function(wt){return wt!==et})}):tn(function(jt){return[].concat(Object(F.a)(jt),[et])})}},it[et])),t.a.createElement("div",{className:ve.a.editorWrap},ft===et?t.a.createElement(x.a,{id:"single-question-option-".concat(et),watch:!0,isFocus:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:ct,onChange:function(jt){z[et]=jt,oe(z)}}):t.a.createElement("div",{className:ve.a.htmlWrap,onClick:function(){return kt(et)}},t.a.createElement(Ce.a,{value:ct}))),t.a.createElement(t.a.Fragment,null,et>1&&t.a.createElement(f.a,{title:"\u5220\u9664"},t.a.createElement("i",{className:"".concat(ve.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return oe(z.filter(function(jt,wt){return wt!==et}))}})),et<7&&et===z.length-1&&t.a.createElement(f.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},t.a.createElement("i",{className:"".concat(ve.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return oe([].concat(Object(F.a)(z),[""]))}}))))}),t.a.createElement("p",{className:"c-orange"},"\u6E29\u99A8\u63D0\u793A\uFF1A\u70B9\u51FB\u9009\u9879\u8F93\u5165\u6846\u53EF\u8BBE\u7F6E\u7B54\u6848\uFF1B\u9009\u4E2D\u7684\u9009\u9879\u5373\u4E3A\u6B63\u786E\u7B54\u6848\uFF0C\u9009\u62E9\u591A\u4E2A\u7B54\u6848\u5373\u4E3A\u591A\u9009\u9898"),t.a.createElement("p",{className:ve.a.titleWrap},t.a.createElement("span",{className:ve.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),t.a.createElement(x.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Ut,onChange:function(et){return vn(et)}}),t.a.createElement("div",{style:{marginBottom:14}},"\u5206\u503C\uFF1A",t.a.createElement(U.a,{value:on,max:1e4,min:0,onChange:function(et){Nt(et)}})," \u5206",t.a.createElement("span",{style:{marginLeft:"30px"},className:ve.a.difficult},t.a.createElement("label",{style:{color:"red"}},"*")," \u96BE\u5EA6\uFF1A",t.a.createElement(d.a.Group,{value:Kt,onChange:function(et){Lt(et.target.value)}},t.a.createElement(d.a.Button,{value:1},"\u7B80\u5355"),t.a.createElement(d.a.Button,{value:2},"\u9002\u4E2D"),t.a.createElement(d.a.Button,{value:3},"\u56F0\u96BE")))),t.a.createElement("div",{className:ve.a.titleWrap},t.a.createElement("span",{className:"".concat(ve.a.title)},"\u77E5\u8BC6\u70B9\uFF1A",t.a.createElement("span",{className:ve.a.colorGray},"\uFF08\u6240\u6709\u81EA\u5EFA\u77E5\u8BC6\u70B9\u4EC5\u672C\u4EBA\u53EF\u89C1\uFF0C\u88ABEduCoder\u5E73\u53F0\u5BA1\u6838\u901A\u8FC7\u4E3A\u5B98\u65B9\u77E5\u8BC6\u70B9\u540E\u6240\u6709\u7528\u6237\u53EF\u89C1\uFF09")),t.a.createElement("div",{className:"mt5"},t.a.createElement(De.a,{selectvalues:ue==null?void 0:ue.tag_discipline_ids,value:Tn,onChange:qn,subId:(Ze=Bt.editData)===null||Ze===void 0||((We=Ze.exercise)===null||We===void 0)?void 0:We.sub_discipline_id,knowledgeOptions:Mt,onAddKnowledgeFinish:qt})),t.a.createElement("div",{style:{marginTop:10}},t.a.createElement("span",{style:{marginRight:10}},"\u4E0D\u5141\u8BB8\u5B66\u751F\u91CD\u590D\u7B54\u9898"),t.a.createElement(E.a,{checked:Ot,onChange:function(et){Vt(et)}}))),t.a.createElement("aside",{className:"tr"},(Be!==-1||ue.question_id)&&t.a.createElement(v.a,{type:"default",onClick:function(){je(),Bn(!1)}},"\u53D6\u6D88"),t.a.createElement(v.a,{className:"ml20",type:"primary",onClick:function(){fn()}},"\u4FDD\u5B58")))};return t.a.createElement("section",{className:ve.a.wrap},!gn&>(),gn&&rt())},$t=Object(K.a)(function(pt){var Je=pt.newExercisePaper;return{newExercisePaper:Je}},null,null,{forwardRef:!0})(Object(i.forwardRef)(xt)),mn=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],rn=Object(i.forwardRef)(function(pt,Je){var Ft=pt.newExercisePaper,Bt=pt.dispatch,Fe=pt.editData,ue=pt.cancelAdd,si=ue===void 0?function(){}:ue,je=pt.editKey,Be=pt.setEditKey,Ie=Be===void 0?function(){}:Be,_e=pt.addCallback,An=_e===void 0?function(gt){}:_e,zn=pt.reload,Pn=zn===void 0?function(){}:zn,Q=Object(i.useState)([]),C=Object(o.a)(Q,2),L=C[0],z=C[1],oe=Object(i.useState)(),q=Object(o.a)(oe,2),ke=q[0],ft=q[1],kt=Object(i.useState)([]),an=Object(o.a)(kt,2),dt=an[0],Pt=an[1],tn=Object(i.useState)(""),Vn=Object(o.a)(tn,2),fi=Vn[0],Hn=Vn[1],Fn=Object(i.useState)(),Qt=Object(o.a)(Fn,2),hn=Qt[0],on=Qt[1],Nt=Object(i.useState)(!1),$n=Object(o.a)(Nt,2),jn=$n[0],Tn=$n[1],qn=Object(i.useState)([]),En=Object(o.a)(qn,2),In=En[0],gn=En[1],Bn=Object(i.useState)(1),Xn=Object(o.a)(Bn,2),Zn=Xn[0],Kt=Xn[1],Lt=Object(i.useState)(!1),yt=Object(o.a)(Lt,2),It=yt[0],Ot=yt[1],Vt=Object(i.useState)(""),Zt=Object(o.a)(Vt,2),Gt=Zt[0],Ut=Zt[1],vn=Object(i.useState)([]),_n=Object(o.a)(vn,2),un=_n[0],cn=_n[1],bn=Object(i.useRef)(!1),dn=function(rt){cn([].concat(Object(F.a)(un),[Object(_.a)({},rt)]))},Mt=Object(W.i)();Object(i.useEffect)(function(){z(["","","",""])},[]),Object(i.useEffect)(function(){if(bn.current)return;if(!(Fe!=null&&Fe.question_choices)){Tn(!0),Hn(""),on(5),z(["","","",""]),Pt([]);return}Hn(Fe==null?void 0:Fe.question_title),on(Fe==null?void 0:Fe.question_score),Ot(!(Fe!=null&&Fe.repeat_answer)),Kt(Fe==null?void 0:Fe.difficulty),z(Fe==null?void 0:Fe.question_choices.map(function(rt){return rt.choice_text}));var gt=[];Fe==null||Fe.standard_answer.map(function(rt,Xe){gt.push(rt-1)}),Pt(gt),gn(Fe.tag_discipline_ids),Ut(Fe==null?void 0:Fe.analysis)},[Fe,jn]),Object(i.useEffect)(function(){jn&>();function gt(){return rt.apply(this,arguments)}function rt(){return rt=Object(ie.a)(r.a.mark(function Xe(){var Ze,We,ct;return r.a.wrap(function(Ct){for(;;)switch(Ct.prev=Ct.next){case 0:return Ct.next=2,Object(I.I)({sub_discipline_id:(Ze=Ft.editData)===null||Ze===void 0||((We=Ze.exercise)===null||We===void 0)?void 0:We.sub_discipline_id});case 2:ct=Ct.sent,cn(ct.tag_disciplines);case 4:case"end":return Ct.stop()}},Xe)})),rt.apply(this,arguments)}},[jn]),Object(i.useImperativeHandle)(Je,function(){return{onSave:qt,isEdit:jn}}),Object(i.useEffect)(function(){var gt,rt=Ft!=null&&(gt=Ft.tagDisciplineData)!==null&>!==void 0&>.tag_disciplines&&Array.isArray(Ft.tagDisciplineData.tag_disciplines)?Ft.tagDisciplineData.tag_disciplines:[];cn(rt)},[Ft.tagDisciplineData]);var Yt=function(rt){(rt==null?void 0:rt.status)===0&&(b.b.success("\u4FDD\u5B58\u6210\u529F"),Tn(!1),Ie(-1),bn.current=!1,Pn())},qt=function(){var gt=Object(ie.a)(r.a.mark(function rt(){var Xe,Ze,We,ct,et,Ct,jt;return r.a.wrap(function(Jt){for(;;)switch(Jt.prev=Jt.next){case 0:if(fi){Jt.next=3;break}return b.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u76EE"),Jt.abrupt("return",!1);case 3:if(Xe=L.findIndex(function(Tt){return!Tt}),!(Xe>-1)){Jt.next=7;break}return b.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(mn[Xe]," \u9009\u9879\u7684\u5185\u5BB9")),Jt.abrupt("return",!1);case 7:if(dt.length){Jt.next=10;break}return b.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),Jt.abrupt("return",!1);case 10:if(!(dt.length<1)){Jt.next=13;break}return b.b.info("\u8BF7\u9009\u62E9\u7B54\u6848"),Jt.abrupt("return",!1);case 13:if(Ze=L.map(function(Tt,At){return{choice_text:Tt,is_answer:dt.includes(At)?1:0}}),bn.current=!0,!Fe.question_id){Jt.next=22;break}return Jt.next=18,Bt({type:"newExercisePaper/editExerciseQuestion",payload:{id:Mt.id,question_id:Fe.question_id,name:fi,item_type:dt.length>1?Pe.a.Multiple:Pe.a.Single,question_score:hn,choices:Ze,tag_discipline_ids:In,sub_discipline_id:(ct=Ft.editData)===null||ct===void 0||((et=ct.exercise)===null||et===void 0)?void 0:et.sub_discipline_id,difficulty:Zn,repeat_answer:!It,analysis:Gt}});case 18:We=Jt.sent,Yt(We),Jt.next=26;break;case 22:return Jt.next=24,Bt({type:"newExercisePaper/addExerciseQuestion",payload:{insert_id:Fe==null?void 0:Fe.insert_id,id:Mt.id,name:fi,item_type:dt.length>1?Pe.a.Multiple:Pe.a.Single,question_score:hn,choices:Ze,tag_discipline_ids:In,sub_discipline_id:(Ct=Ft.editData)===null||Ct===void 0||((jt=Ct.exercise)===null||jt===void 0)?void 0:jt.sub_discipline_id,difficulty:Zn,repeat_answer:!It,analysis:Gt}});case 24:We=Jt.sent,Yt(We);case 26:case"end":return Jt.stop()}},rt)}));return function(){return gt.apply(this,arguments)}}(),Wt=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu current",id:"del"},{name:"(\u5411\u4E0B\u63D2\u5165\u591A\u9009\u9898)",icon:"iconfont c-light-primary ml30 icon-tianjia current",id:"add"},{name:"\u7F16\u8F91",icon:"iconfont c-light-primary ml30 icon-bianjishijuan3x current",id:"edit"}],fn=function(){var gt=Object(ie.a)(r.a.mark(function rt(Xe){return r.a.wrap(function(We){for(;;)switch(We.prev=We.next){case 0:if(!(je!==-1)){We.next=3;break}return b.b.error("\u8BF7\u5148\u4FDD\u5B58\u6216\u53D6\u6D88\u5F53\u524D\u6B63\u5728\u7F16\u8F91\u7684\u95EE\u9898\u3002"),We.abrupt("return");case 3:We.t0=Xe.id,We.next=We.t0==="del"?6:We.t0==="edit"?8:We.t0==="add"?11:13;break;case 6:return H.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u8BD5\u9898\u5417\uFF1F",onOk:function(){return Object(ie.a)(r.a.mark(function et(){return r.a.wrap(function(jt){for(;;)switch(jt.prev=jt.next){case 0:return jt.next=2,Object(he.g)({question_id:Fe.question_id,exam_id:Mt.id});case 2:Bt({type:"newExercisePaper/editExercise",payload:Object(_.a)({},Mt)});case 3:case"end":return jt.stop()}},et)}))()}}),We.abrupt("break",13);case 8:return Ie(Fe.dragKey),Tn(!0),We.abrupt("break",13);case 11:return An({key:Fe.key,insert_id:Fe==null?void 0:Fe.question_id,question_type:1}),We.abrupt("break",13);case 13:case"end":return We.stop()}},rt)}));return function(Xe){return gt.apply(this,arguments)}}(),On=function(){var rt;return t.a.createElement("aside",null,t.a.createElement("div",{className:ve.a.questionType},!(Fe!=null&&Fe.isPreview)&&t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},Fe.key,"\u3001\u591A\u9009\u9898"),"\uFF08",Fe.question_score,"\u5206\uFF09")),Fe!=null&&Fe.isPreview?t.a.createElement("div",{style:{display:"flex"}},t.a.createElement("span",{style:{flexShrink:0},className:"font18"},Fe.key,"."),t.a.createElement(Ce.a,{value:Fe.question_title}),t.a.createElement("span",{style:{flexShrink:0},className:"font16"},"\uFF08",Fe.question_score,"\u5206\uFF09")):t.a.createElement("div",{className:"mt5"},t.a.createElement(Ce.a,{value:Fe.question_title})),t.a.createElement("div",{className:ve.a.questionChoices},Fe==null||((rt=Fe.question_choices)===null||rt===void 0)?void 0:rt.map(function(Xe,Ze){return t.a.createElement(k.a,{key:Ze},t.a.createElement(R.a,null,t.a.createElement(h.a,{key:Ze,checked:Fe.standard_answer.includes(Ze+1),disabled:!0},mn[Ze],".")),t.a.createElement(R.a,{flex:"1"},t.a.createElement("span",{className:"c-black font14"},t.a.createElement(Ce.a,{value:Xe.choice_text}))))})),t.a.createElement("div",{className:ve.a.action},!Fe.hideAction&&Wt.map(function(Xe,Ze){return t.a.createElement(f.a,{key:Ze,placement:"bottom",title:Xe.name},t.a.createElement("span",{onClick:function(){return fn(Xe)},className:Xe.icon}))})))},wn=function(){var rt,Xe;return t.a.createElement("aside",null,t.a.createElement("div",{className:ve.a.questionType},t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},"\u9009\u62E9\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848\uFF09")),t.a.createElement("p",{className:ve.a.titleWrap},t.a.createElement("span",{className:ve.a.required},"*"),t.a.createElement("span",{className:ve.a.title},"\u9898\u5E72\uFF1A")),t.a.createElement(x.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:fi,onChange:function(We){return Hn(We)}}),t.a.createElement("p",{className:ve.a.titleWrap},t.a.createElement("span",{className:ve.a.required},"*"),t.a.createElement("span",{className:ve.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",t.a.createElement("span",{className:ve.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),L.map(function(Ze,We){var ct,et;return t.a.createElement("div",{className:ve.a.choiceWrap,key:We},t.a.createElement(f.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},t.a.createElement("div",{className:"".concat(ve.a.answer," ").concat(dt.includes(We)?ve.a.activeAnswer:""),onClick:function(){dt.includes(We)?Pt(dt.filter(function(jt){return jt!==We})):Pt([].concat(Object(F.a)(dt),[We]))}},mn[We])),t.a.createElement("div",{className:ve.a.editorWrap},ke===We?t.a.createElement(x.a,{id:"single-question-option-".concat(We),watch:!0,isFocus:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:Ze,onChange:function(jt){L[We]=jt,z(L)}}):t.a.createElement("div",{className:ve.a.htmlWrap,onClick:function(){return ft(We)}},t.a.createElement(Ce.a,{value:Ze}))),((ct=Ft.editData)===null||ct===void 0||((et=ct.exercise)===null||et===void 0)?void 0:et.exercise_status)===1&&t.a.createElement(t.a.Fragment,null,We>1&&t.a.createElement(f.a,{title:"\u5220\u9664"},t.a.createElement("i",{className:"".concat(ve.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return z(L.filter(function(jt,wt){return wt!==We}))}})),We<7&&We===L.length-1&&t.a.createElement(f.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},t.a.createElement("i",{className:"".concat(ve.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return z([].concat(Object(F.a)(L),[""]))}}))))}),t.a.createElement("p",{className:"c-orange"},"\u6E29\u99A8\u63D0\u793A\uFF1A\u70B9\u51FB\u9009\u9879\u8F93\u5165\u6846\u53EF\u8BBE\u7F6E\u7B54\u6848\uFF1B\u9009\u4E2D\u7684\u9009\u9879\u5373\u4E3A\u6B63\u786E\u7B54\u6848\uFF0C\u9009\u62E9\u591A\u4E2A\u7B54\u6848\u5373\u4E3A\u591A\u9009\u9898"),t.a.createElement("p",{className:ve.a.titleWrap},t.a.createElement("span",{className:ve.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),t.a.createElement(x.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Gt,onChange:function(We){return Ut(We)}}),t.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",t.a.createElement(U.a,{value:hn,max:1e4,min:0,onChange:function(We){on(We)}}),"\u5206",t.a.createElement("span",{style:{marginLeft:"30px"},className:ve.a.difficult},t.a.createElement("label",{style:{color:"red"}},"*")," \u96BE\u5EA6\uFF1A",t.a.createElement(d.a.Group,{value:Zn,onChange:function(We){Kt(We.target.value)}},t.a.createElement(d.a.Button,{value:1},"\u7B80\u5355"),t.a.createElement(d.a.Button,{value:2},"\u9002\u4E2D"),t.a.createElement(d.a.Button,{value:3},"\u56F0\u96BE")))),t.a.createElement("p",{className:ve.a.titleWrap},t.a.createElement("span",{className:"".concat(ve.a.title)},"\u77E5\u8BC6\u70B9\uFF1A",t.a.createElement("span",{className:ve.a.colorGray},"\uFF08\u6240\u6709\u81EA\u5EFA\u77E5\u8BC6\u70B9\u4EC5\u672C\u4EBA\u53EF\u89C1\uFF0C\u88ABEduCoder\u5E73\u53F0\u5BA1\u6838\u901A\u8FC7\u4E3A\u5B98\u65B9\u77E5\u8BC6\u70B9\u540E\u6240\u6709\u7528\u6237\u53EF\u89C1\uFF09")),t.a.createElement("div",{className:"mt5"},t.a.createElement(De.a,{value:In,selectvalues:Fe==null?void 0:Fe.tag_discipline_ids,onChange:gn,subId:(rt=Ft.editData)===null||rt===void 0||((Xe=rt.exercise)===null||Xe===void 0)?void 0:Xe.sub_discipline_id,knowledgeOptions:un,onAddKnowledgeFinish:dn})),t.a.createElement("div",{style:{marginTop:10}},t.a.createElement("span",{style:{marginRight:10}},"\u4E0D\u5141\u8BB8\u5B66\u751F\u91CD\u590D\u7B54\u9898"),t.a.createElement(E.a,{checked:It,onChange:function(We){Ot(We)}}))),t.a.createElement("aside",{className:"tr"},(je!==-1||Fe.question_id)&&t.a.createElement(v.a,{type:"default",onClick:function(){si(),Tn(!1)}},"\u53D6\u6D88"),t.a.createElement(v.a,{className:"ml20",type:"primary",onClick:function(){qt()}},"\u4FDD\u5B58")))};return t.a.createElement("section",{className:ve.a.wrap},!jn&&On(),jn&&wn())}),ci=Object(K.a)(function(pt){var Je=pt.newExercisePaper;return{newExercisePaper:Je}},null,null,{forwardRef:!0})(rn),Jn=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Sn=function(Je,Ft){var Bt=Je.newExercisePaper,Fe=Je.dispatch,ue=Je.editData,si=Je.editKey,je=Je.setEditKey,Be=je===void 0?function(){}:je,Ie=Je.cancelAdd,_e=Ie===void 0?function(){}:Ie,An=Je.reload,zn=An===void 0?function(){}:An,Pn=Je.addCallback,Q=Pn===void 0?function(){}:Pn,C=Object(i.useState)(),L=Object(o.a)(C,2),z=L[0],oe=L[1],q=Object(i.useState)(""),ke=Object(o.a)(q,2),ft=ke[0],kt=ke[1],an=Object(i.useState)(!1),dt=Object(o.a)(an,2),Pt=dt[0],tn=dt[1],Vn=Object(i.useState)(),fi=Object(o.a)(Vn,2),Hn=fi[0],Fn=fi[1],Qt=Object(i.useState)([]),hn=Object(o.a)(Qt,2),on=hn[0],Nt=hn[1],$n=Object(i.useState)([]),jn=Object(o.a)($n,2),Tn=jn[0],qn=jn[1],En=Object(i.useState)(1),In=Object(o.a)(En,2),gn=In[0],Bn=In[1],Xn=Object(i.useState)(!1),Zn=Object(o.a)(Xn,2),Kt=Zn[0],Lt=Zn[1],yt=Object(i.useState)(""),It=Object(o.a)(yt,2),Ot=It[0],Vt=It[1],Zt=Object(i.useRef)(!1),Gt=function(Yt){qn([].concat(Object(F.a)(Tn),[Object(_.a)({},Yt)]))},Ut=Object(W.i)();Object(i.useEffect)(function(){if(Zt.current)return;if(!(ue!=null&&ue.question_choices)){tn(!0),kt(""),Fn(2),oe("");return}Lt(!(ue!=null&&ue.repeat_answer)),kt(ue==null?void 0:ue.question_title),Fn(ue==null?void 0:ue.question_score),Bn(ue==null?void 0:ue.difficulty),oe(ue.standard_answer[0]+""),Nt(ue.tag_discipline_ids),Vt(ue==null?void 0:ue.analysis)},[ue,Pt]),Object(i.useEffect)(function(){Pt&&Mt();function Mt(){return Yt.apply(this,arguments)}function Yt(){return Yt=Object(ie.a)(r.a.mark(function qt(){var Wt,fn,On;return r.a.wrap(function(gt){for(;;)switch(gt.prev=gt.next){case 0:return gt.next=2,Object(I.I)({sub_discipline_id:(Wt=Bt.editData)===null||Wt===void 0||((fn=Wt.exercise)===null||fn===void 0)?void 0:fn.sub_discipline_id});case 2:On=gt.sent,qn(On.tag_disciplines);case 4:case"end":return gt.stop()}},qt)})),Yt.apply(this,arguments)}},[Pt]),Object(i.useImperativeHandle)(Ft,function(){return{onSave:_n,isEdit:Pt}}),Object(i.useEffect)(function(){var Mt,Yt=Bt!=null&&(Mt=Bt.tagDisciplineData)!==null&&Mt!==void 0&&Mt.tag_disciplines&&Array.isArray(Bt.tagDisciplineData.tag_disciplines)?Bt.tagDisciplineData.tag_disciplines:[];qn(Yt)},[Bt.tagDisciplineData]);var vn=function(Yt){(Yt==null?void 0:Yt.status)===0&&(b.b.success("\u4FDD\u5B58\u6210\u529F"),tn(!1),Be(-1),Zt.current=!1,zn())},_n=function(){var Mt=Object(ie.a)(r.a.mark(function Yt(){var qt,Wt,fn,On,wn,gt;return r.a.wrap(function(Xe){for(;;)switch(Xe.prev=Xe.next){case 0:if(ft){Xe.next=3;break}return b.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),Xe.abrupt("return",!1);case 3:if(z){Xe.next=6;break}return b.b.info("\u8BF7\u5148\u70B9\u51FB\u9009\u62E9\u672C\u9009\u62E9\u9898\u7684\u6B63\u786E\u9009\u9879"),Xe.abrupt("return",!1);case 6:if(qt=[{choice_text:"\u6B63\u786E",is_answer:z==="1"?1:0},{choice_text:"\u9519\u8BEF",is_answer:z==="2"?1:0}],Zt.current=!0,!ue.question_id){Xe.next=15;break}return Xe.next=11,Fe({type:"newExercisePaper/editExerciseQuestion",payload:{id:Ut.id,question_id:ue.question_id,name:ft,item_type:Pe.a.Judge,question_score:Hn,choices:qt,tag_discipline_ids:on,sub_discipline_id:(fn=Bt.editData)===null||fn===void 0||((On=fn.exercise)===null||On===void 0)?void 0:On.sub_discipline_id,difficulty:gn,repeat_answer:!Kt,analysis:Ot}});case 11:Wt=Xe.sent,vn(Wt),Xe.next=19;break;case 15:return Xe.next=17,Fe({type:"newExercisePaper/addExerciseQuestion",payload:{id:Ut.id,insert_id:ue==null?void 0:ue.insert_id,name:ft,item_type:Pe.a.Judge,question_score:Hn,choices:qt,tag_discipline_ids:on,sub_discipline_id:(wn=Bt.editData)===null||wn===void 0||((gt=wn.exercise)===null||gt===void 0)?void 0:gt.sub_discipline_id,difficulty:gn,repeat_answer:!Kt,analysis:Ot}});case 17:Wt=Xe.sent,vn(Wt);case 19:return Xe.abrupt("return",{name:ft,choices:qt});case 20:case"end":return Xe.stop()}},Yt)}));return function(){return Mt.apply(this,arguments)}}(),un=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu current",id:"del"},{name:"(\u5411\u4E0B\u63D2\u5165\u5224\u65AD\u9898)",icon:"iconfont c-light-primary ml30 icon-tianjia current",id:"add"},{name:"\u7F16\u8F91",icon:"iconfont c-light-primary ml30 icon-bianjishijuan3x current",id:"edit"}],cn=function(){var Mt=Object(ie.a)(r.a.mark(function Yt(qt){return r.a.wrap(function(fn){for(;;)switch(fn.prev=fn.next){case 0:if(!(si!==-1)){fn.next=3;break}return b.b.error("\u8BF7\u5148\u4FDD\u5B58\u6216\u53D6\u6D88\u5F53\u524D\u6B63\u5728\u7F16\u8F91\u7684\u95EE\u9898\u3002"),fn.abrupt("return");case 3:fn.t0=qt.id,fn.next=fn.t0==="del"?6:fn.t0==="edit"?8:fn.t0==="add"?11:13;break;case 6:return H.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u8BD5\u9898\u5417\uFF1F",onOk:function(){return Object(ie.a)(r.a.mark(function wn(){return r.a.wrap(function(rt){for(;;)switch(rt.prev=rt.next){case 0:return rt.next=2,Object(he.g)({question_id:ue.question_id,exam_id:Ut.id});case 2:Fe({type:"newExercisePaper/editExercise",payload:Object(_.a)({},Ut)});case 3:case"end":return rt.stop()}},wn)}))()}}),fn.abrupt("break",13);case 8:return Be(ue.dragKey),tn(!0),fn.abrupt("break",13);case 11:return Q({key:ue.key,insert_id:ue==null?void 0:ue.question_id,question_type:2}),fn.abrupt("break",13);case 13:case"end":return fn.stop()}},Yt)}));return function(qt){return Mt.apply(this,arguments)}}(),bn=function(){var Yt;return t.a.createElement("aside",null,t.a.createElement("div",{className:ve.a.questionType},!(ue!=null&&ue.isPreview)&&t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},ue.key,"\u3001\u5224\u65AD\u9898"),"\uFF08",ue.question_score,"\u5206\uFF09")),ue!=null&&ue.isPreview?t.a.createElement("div",{style:{display:"flex"}},t.a.createElement("span",{style:{flexShrink:0},className:"font18"},ue.key,"."),t.a.createElement(Ce.a,{value:ue.question_title}),t.a.createElement("span",{style:{flexShrink:0},className:"font16"},"\uFF08",ue.question_score,"\u5206\uFF09")):t.a.createElement("div",{className:"mt5"},t.a.createElement(Ce.a,{value:ue.question_title})),t.a.createElement("div",{className:ve.a.questionChoices},ue==null||((Yt=ue.question_choices)===null||Yt===void 0)?void 0:Yt.map(function(qt,Wt){return t.a.createElement(d.a,{key:Wt,checked:ue.standard_answer.includes(Wt+1),disabled:!0},Jn[Wt],". ",t.a.createElement("span",{className:"c-black font14"},qt.choice_text))})),t.a.createElement("div",{className:ve.a.action},!ue.hideAction&&un.map(function(qt,Wt){return t.a.createElement(f.a,{key:Wt,placement:"bottom",title:qt.name},t.a.createElement("span",{onClick:function(){return cn(qt)},className:qt.icon}))})))},dn=function(){var Yt,qt;return t.a.createElement("aside",null,t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},"\u5224\u65AD\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848\uFF09"),t.a.createElement("p",{className:ve.a.titleWrap},t.a.createElement("span",{className:ve.a.required},"*"),t.a.createElement("span",{className:ve.a.title},"\u9898\u5E72\uFF1A")),t.a.createElement(x.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:ft,onChange:function(fn){return kt(fn)}}),t.a.createElement("p",{className:ve.a.titleWrap},t.a.createElement("span",{className:ve.a.required},"*"),t.a.createElement("span",{className:ve.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",t.a.createElement("span",{className:ve.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),t.a.createElement(d.a.Group,{buttonStyle:"solid",value:z,onChange:function(fn){return oe(fn.target.value)}},t.a.createElement(d.a.Button,{value:"1",className:"".concat(ve.a.radio," mr40")},"\u6B63\u786E"),t.a.createElement(d.a.Button,{value:"2",className:ve.a.radio},"\u9519\u8BEF")),t.a.createElement("p",{className:"c-orange"},"\u6E29\u99A8\u63D0\u793A\uFF1A\u70B9\u51FB\u9009\u9879\uFF0C\u53EF\u4EE5\u76F4\u63A5\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848"),t.a.createElement("p",{className:ve.a.titleWrap},t.a.createElement("span",{className:ve.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),t.a.createElement(x.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Ot,onChange:function(fn){return Vt(fn)}}),t.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",t.a.createElement(U.a,{value:Hn,max:1e4,min:0,onChange:function(fn){Fn(fn)}})," \u5206",t.a.createElement("span",{style:{marginLeft:"30px"},className:ve.a.difficult},t.a.createElement("label",{style:{color:"red"}},"*")," \u96BE\u5EA6\uFF1A",t.a.createElement(d.a.Group,{value:gn,onChange:function(fn){Bn(fn.target.value)}},t.a.createElement(d.a.Button,{value:1},"\u7B80\u5355"),t.a.createElement(d.a.Button,{value:2},"\u9002\u4E2D"),t.a.createElement(d.a.Button,{value:3},"\u56F0\u96BE")))),t.a.createElement("p",{className:ve.a.titleWrap},t.a.createElement("span",{className:"".concat(ve.a.title)},"\u77E5\u8BC6\u70B9\uFF1A",t.a.createElement("span",{className:ve.a.colorGray},"\uFF08\u6240\u6709\u81EA\u5EFA\u77E5\u8BC6\u70B9\u4EC5\u672C\u4EBA\u53EF\u89C1\uFF0C\u88ABEduCoder\u5E73\u53F0\u5BA1\u6838\u901A\u8FC7\u4E3A\u5B98\u65B9\u77E5\u8BC6\u70B9\u540E\u6240\u6709\u7528\u6237\u53EF\u89C1\uFF09")),t.a.createElement("div",{className:"mt5"},t.a.createElement(De.a,{value:on,selectvalues:ue==null?void 0:ue.tag_discipline_ids,onChange:Nt,subId:(Yt=Bt.editData)===null||Yt===void 0||((qt=Yt.exercise)===null||qt===void 0)?void 0:qt.sub_discipline_id,knowledgeOptions:Tn,onAddKnowledgeFinish:Gt})),t.a.createElement("div",{style:{marginTop:10}},t.a.createElement("span",{style:{marginRight:10}},"\u4E0D\u5141\u8BB8\u5B66\u751F\u91CD\u590D\u7B54\u9898"),t.a.createElement(E.a,{checked:Kt,onChange:function(fn){Lt(fn)}}))),t.a.createElement("aside",{className:"tr"},(si!==-1||ue.question_id)&&t.a.createElement(v.a,{type:"default",onClick:function(){_e(),tn(!1)}},"\u53D6\u6D88"),t.a.createElement(v.a,{className:"ml20",type:"primary",onClick:function(){_n()}},"\u4FDD\u5B58")))};return t.a.createElement("section",{className:ve.a.wrap},!Pt&&bn(),Pt&&dn())},pi=Object(K.a)(function(pt){var Je=pt.newExercisePaper;return{newExercisePaper:Je}},null,null,{forwardRef:!0})(Object(i.forwardRef)(Sn)),gi=function(Je,Ft){var Bt=Je.newExercisePaper,Fe=Je.dispatch,ue=Je.editData,si=Je.editKey,je=Je.setEditKey,Be=je===void 0?function(){}:je,Ie=Je.cancelAdd,_e=Ie===void 0?function(){}:Ie,An=Je.addCallback,zn=An===void 0?function(){}:An,Pn=Je.reload,Q=Pn===void 0?function(){}:Pn,C=Object(i.useState)(""),L=Object(o.a)(C,2),z=L[0],oe=L[1],q=Object(i.useState)(""),ke=Object(o.a)(q,2),ft=ke[0],kt=ke[1],an=Object(i.useState)([]),dt=Object(o.a)(an,2),Pt=dt[0],tn=dt[1],Vn=Object(i.useState)(""),fi=Object(o.a)(Vn,2),Hn=fi[0],Fn=fi[1],Qt=Object(i.useState)(),hn=Object(o.a)(Qt,2),on=hn[0],Nt=hn[1],$n=Object(i.useState)(!1),jn=Object(o.a)($n,2),Tn=jn[0],qn=jn[1],En=Object(i.useState)(),In=Object(o.a)(En,2),gn=In[0],Bn=In[1],Xn=Object(i.useState)(0),Zn=Object(o.a)(Xn,2),Kt=Zn[0],Lt=Zn[1],yt=Object(i.useState)(!1),It=Object(o.a)(yt,2),Ot=It[0],Vt=It[1],Zt=Object(i.useState)(!1),Gt=Object(o.a)(Zt,2),Ut=Gt[0],vn=Gt[1],_n=Object(i.useState)([]),un=Object(o.a)(_n,2),cn=un[0],bn=un[1],dn=Object(i.useState)(1),Mt=Object(o.a)(dn,2),Yt=Mt[0],qt=Mt[1],Wt=Object(i.useState)(!1),fn=Object(o.a)(Wt,2),On=fn[0],wn=fn[1],gt=Object(i.useRef)(!1),rt=Object(W.i)(),Xe=Object(i.useState)([]),Ze=Object(o.a)(Xe,2),We=Ze[0],ct=Ze[1],et=function(kn){ct([].concat(Object(F.a)(We),[Object(_.a)({},kn)]))};Object(i.useEffect)(function(){if(gt.current)return;if(!(ue!=null&&ue.question_title)){Vt(!0),oe(""),Nt(!1),Bn(2),tn([]),Fn(""),qn(!1);return}oe(ue==null?void 0:ue.question_title),Nt(ue==null?void 0:ue.is_ordered),qt(ue==null?void 0:ue.difficulty),wn(!(ue!=null&&ue.repeat_answer)),Bn(ue==null?void 0:ue.question_score);var nn=ue==null?void 0:ue.standard_answer.map(function(kn){return kn.answer_text});tn(Object(F.a)(nn)),bn(ue.tag_discipline_ids),kt(ue==null?void 0:ue.analysis)},[ue,Ot]),Object(i.useEffect)(function(){qn(!1),Ot&&nn();function nn(){return kn.apply(this,arguments)}function kn(){return kn=Object(ie.a)(r.a.mark(function Yn(){var ni,Mn,Li;return r.a.wrap(function(Ci){for(;;)switch(Ci.prev=Ci.next){case 0:return Ci.next=2,Object(I.I)({sub_discipline_id:(ni=Bt.editData)===null||ni===void 0||((Mn=ni.exercise)===null||Mn===void 0)?void 0:Mn.sub_discipline_id});case 2:Li=Ci.sent,ct(Li.tag_disciplines);case 4:case"end":return Ci.stop()}},Yn)})),kn.apply(this,arguments)}},[Ot]),Object(i.useImperativeHandle)(Ft,function(){return{onSave:jt,isEdit:Ot}}),Object(i.useEffect)(function(){var nn,kn=Bt!=null&&(nn=Bt.tagDisciplineData)!==null&&nn!==void 0&&nn.tag_disciplines&&Array.isArray(Bt.tagDisciplineData.tag_disciplines)?Bt.tagDisciplineData.tag_disciplines:[];ct(kn)},[Bt.tagDisciplineData]);var Ct=function(kn){(kn==null?void 0:kn.status)===0&&(b.b.success("\u4FDD\u5B58\u6210\u529F"),Vt(!1),Be(-1),gt.current=!1,Q())},jt=function(){var nn=Object(ie.a)(r.a.mark(function kn(){var Yn,ni,Mn,Li,ji,Ci,oi;return r.a.wrap(function(Ei){for(;;)switch(Ei.prev=Ei.next){case 0:if(Yn=[],ni=!1,vn(!0),Pt.forEach(function(Ti,Ni){Yn.push({position:Ni+1,answer_text:[]}),Ti.forEach(function(Vi,Ui){Yn[Ni].answer_text.push(Vi),(!Vi||!Object(ae.db)(Vi,1e4))&&(Fn("".concat(Ni,"-").concat(Ui)),b.b.info(Vi?"\u7B54\u6848\u4E0D\u80FD\u8D85\u8FC710000\u5B57\u7B26":"\u7B54\u6848\uFF1A\u4E0D\u80FD\u4E3A\u7A7A"),ni=!0)})}),!ni){Ei.next=7;break}return vn(!1),Ei.abrupt("return",!1);case 7:if(gt.current=!0,!ue.question_id){Ei.next=15;break}return Ei.next=11,Fe({type:"newExercisePaper/editExerciseQuestion",payload:{id:rt.id,question_id:ue.question_id,name:z,item_type:3,question_score:gn,is_ordered:on,standard_answers:Yn,tag_discipline_ids:cn,sub_discipline_id:(Li=Bt.editData)===null||Li===void 0||((ji=Li.exercise)===null||ji===void 0)?void 0:ji.sub_discipline_id,difficulty:Yt,repeat_answer:!On,analysis:ft}});case 11:Mn=Ei.sent,Ct(Mn),Ei.next=19;break;case 15:return Ei.next=17,Fe({type:"newExercisePaper/addExerciseQuestion",payload:{insert_id:ue==null?void 0:ue.insert_id,id:rt.id,name:z,item_type:3,question_score:gn,is_ordered:on,standard_answers:Yn,tag_discipline_ids:cn,sub_discipline_id:(Ci=Bt.editData)===null||Ci===void 0||((oi=Ci.exercise)===null||oi===void 0)?void 0:oi.sub_discipline_id,difficulty:Yt,repeat_answer:!On,analysis:ft}});case 17:Mn=Ei.sent,Ct(Mn);case 19:return vn(!1),Ei.abrupt("return",{name:z,analysis:ft,standard_answers:Yn,is_ordered:on});case 21:case"end":return Ei.stop()}},kn)}));return function(){return nn.apply(this,arguments)}}(),wt=function(kn,Yn,ni){var Mn=Pt.slice();if(Yn&&Mn.splice(kn,Yn),ni&&Tn||!ue.question_id)for(var Li=0;Li<ni;Li++)Mn.splice(kn+Li,0,[""]);Lt(Mn==null?void 0:Mn.length),qn(!0),tn(Mn)},Jt=function(kn,Yn,ni){Fn("");var Mn=Pt.slice();Mn[kn][Yn]=ni,tn(Mn)},Tt=function(kn){var Yn=Pt.slice();Yn[kn]=[].concat(Object(F.a)(Yn[kn]),[""]),tn(Yn)},At=function(kn,Yn){var ni=Pt.slice();if(!ni[kn][Yn]){ni[kn]=ni[kn].filter(function(Mn,Li){return Li!==Yn}),tn(ni);return}H.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u53C2\u8003\u7B54\u6848\u5417\uFF1F",className:ve.a.modal,onOk:function(){ni[kn]=ni[kn].filter(function(Li,ji){return ji!==Yn}),tn(ni)}})},Rn=function(kn){H.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u53C2\u8003\u7B54\u6848\u5417\uFF1F",className:ve.a.modal,onOk:function(){var ni=0;oe(z.replace(/\▁/g,function(Mn){return ni++,ni-1===kn?"":Mn})),setTimeout(function(){var Mn=Pt.slice();Mn=Pt.filter(function(Li,ji){return kn!==ji}),tn(Mn)},500)}})},yn=function(){var kn,Yn;return t.a.createElement("aside",null,t.a.createElement("div",{className:ve.a.questionType},t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},"\u586B\u7A7A\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u5141\u8BB8\u624B\u52A8\u8C03\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848 \uFF1B\u652F\u6301\u6700\u591A5\u4E2A\u7A7A\uFF0C\u6BCF\u7A7A\u5F97\u5206\u6309\u7167\u672C\u9898\u7684\u603B\u5206\u5E73\u5747\u8BA1\u7B97\uFF09")),t.a.createElement("div",null,t.a.createElement(j.a,{id:"completion-question-tittle",placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE",height:155,defaultValue:z,onChange:function(Mn){return oe(Mn)},showNullButton:!0,deleteEmptyDisabled:Ut,onPlaceholderChange:wt})),t.a.createElement("div",{className:"mt20"},Pt.map(function(ni,Mn){return t.a.createElement($.a,{key:Mn,answers:ni,index:Mn,is_md:!0,exerciseIsPublish:!1,activeOptionErrorIndex:Hn,onAnswerChange:Jt,addChildAnswer:Tt,deleteChildAnswer:At,deleteChildAnswermain:Rn})})),t.a.createElement("div",{className:"mt20"},Pt.length>1&&t.a.createElement("span",null,t.a.createElement(h.a,{checked:on,onChange:function(Mn){return Nt(Mn.target.checked)},className:"".concat(ve.a.color333," font14")},"\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"),t.a.createElement("span",{className:"".concat(ve.a.color999," font12")},"\uFF08\u9009\u4E2D\uFF0C\u6BCF\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u987A\u5E8F\u5FC5\u987B\u4E0E\u53C2\u8003\u7B54\u6848\u4E00\u81F4\uFF09"))),t.a.createElement("p",{className:ve.a.titleWrap},t.a.createElement("span",{className:ve.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),t.a.createElement(x.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:ft,onChange:function(Mn){return kt(Mn)}}),t.a.createElement("p",{className:""},t.a.createElement("span",{style:{color:"red"}},"*"),"\u5206\u503C\uFF1A",t.a.createElement(U.a,{value:gn,max:1e4,min:0,onChange:function(Mn){Bn(Mn)}})," \u5206 \xA0 ",!!gn&&!!Kt&&t.a.createElement("span",{style:{color:"red"}},"(\u6839\u636E\u5747\u5206\u89C4\u5219\uFF0C\u672C\u9898\u6BCF\u7A7A",(gn/Kt).toFixed(1),"\u5206)"),t.a.createElement("span",{style:{marginLeft:"30px"},className:ve.a.difficult},t.a.createElement("label",{style:{color:"red"}},"*")," \u96BE\u5EA6\uFF1A",t.a.createElement(d.a.Group,{value:Yt,onChange:function(Mn){qt(Mn.target.value)}},t.a.createElement(d.a.Button,{value:1},"\u7B80\u5355"),t.a.createElement(d.a.Button,{value:2},"\u9002\u4E2D"),t.a.createElement(d.a.Button,{value:3},"\u56F0\u96BE")))),t.a.createElement("p",{className:ve.a.titleWrap},t.a.createElement("span",{className:"".concat(ve.a.title)},"\u77E5\u8BC6\u70B9\uFF1A",t.a.createElement("span",{className:ve.a.colorGray},"\uFF08\u6240\u6709\u81EA\u5EFA\u77E5\u8BC6\u70B9\u4EC5\u672C\u4EBA\u53EF\u89C1\uFF0C\u88ABEduCoder\u5E73\u53F0\u5BA1\u6838\u901A\u8FC7\u4E3A\u5B98\u65B9\u77E5\u8BC6\u70B9\u540E\u6240\u6709\u7528\u6237\u53EF\u89C1\uFF09")),t.a.createElement("div",{className:"mt5"},t.a.createElement(De.a,{value:cn,selectvalues:ue==null?void 0:ue.tag_discipline_ids,onChange:bn,subId:(kn=Bt.editData)===null||kn===void 0||((Yn=kn.exercise)===null||Yn===void 0)?void 0:Yn.sub_discipline_id,knowledgeOptions:We,onAddKnowledgeFinish:et})),t.a.createElement("div",{style:{marginTop:10}},t.a.createElement("span",{style:{marginRight:10}},"\u4E0D\u5141\u8BB8\u5B66\u751F\u91CD\u590D\u7B54\u9898"),t.a.createElement(E.a,{checked:On,onChange:function(Mn){wn(Mn)}}))),t.a.createElement("aside",{className:"tr"},(si!==-1||ue.question_id)&&t.a.createElement(v.a,{type:"default",onClick:function(){_e(),Vt(!1)}},"\u53D6\u6D88"),t.a.createElement(v.a,{className:"ml20",type:"primary",onClick:function(){jt()}},"\u4FDD\u5B58")))},mi=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu current",id:"del"},{name:"(\u5411\u4E0B\u63D2\u5165\u586B\u7A7A\u9898)",icon:"iconfont c-light-primary ml30 icon-tianjia current",id:"add"},{name:"\u7F16\u8F91",icon:"iconfont c-light-primary ml30 icon-bianjishijuan3x current",id:"edit"}],ei=function(){var nn=Object(ie.a)(r.a.mark(function kn(Yn){return r.a.wrap(function(Mn){for(;;)switch(Mn.prev=Mn.next){case 0:if(!(si!==-1)){Mn.next=3;break}return b.b.error("\u8BF7\u5148\u4FDD\u5B58\u6216\u53D6\u6D88\u5F53\u524D\u6B63\u5728\u7F16\u8F91\u7684\u95EE\u9898\u3002"),Mn.abrupt("return");case 3:Mn.t0=Yn.id,Mn.next=Mn.t0==="del"?6:Mn.t0==="edit"?8:Mn.t0==="add"?11:13;break;case 6:return H.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u8BD5\u9898\u5417\uFF1F",onOk:function(){return Object(ie.a)(r.a.mark(function ji(){return r.a.wrap(function(oi){for(;;)switch(oi.prev=oi.next){case 0:return oi.next=2,Object(he.g)({question_id:ue.question_id,exam_id:rt.id});case 2:Fe({type:"newExercisePaper/editExercise",payload:Object(_.a)({},rt)});case 3:case"end":return oi.stop()}},ji)}))()}}),Mn.abrupt("break",13);case 8:return Be(ue.dragKey),Vt(!0),Mn.abrupt("break",13);case 11:return zn({key:ue.key,insert_id:ue==null?void 0:ue.question_id,question_type:3}),Mn.abrupt("break",13);case 13:case"end":return Mn.stop()}},kn)}));return function(Yn){return nn.apply(this,arguments)}}(),ti=function(){var kn;return t.a.createElement("aside",null,t.a.createElement("div",{className:ve.a.questionType},!(ue!=null&&ue.isPreview)&&t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},ue.key,"\u3001\u586B\u7A7A\u9898"),"\uFF08",ue.question_score,"\u5206\uFF09")),ue!=null&&ue.isPreview?t.a.createElement("div",{style:{display:"flex"}},t.a.createElement("span",{style:{flexShrink:0},className:"font18"},ue.key,"."),t.a.createElement(Ce.a,{value:ue.question_title}),t.a.createElement("span",{style:{flexShrink:0},className:"font16"},"\uFF08",ue.question_score,"\u5206\uFF09")):t.a.createElement("div",{className:"mt5"},t.a.createElement(Ce.a,{value:ue.question_title})),t.a.createElement("div",{className:ve.a.questionChoices},ue==null||((kn=ue.standard_answer)===null||kn===void 0)?void 0:kn.map(function(Yn,ni){return t.a.createElement(k.a,{key:ni,align:"middle"},t.a.createElement(R.a,null,"\u7B54\u6848\uFF08\u586B\u7A7A",Yn.choice_id,"\uFF09\uFF1A"),t.a.createElement(R.a,{flex:"1"},t.a.createElement(k.a,{align:"middle",gutter:[1,1]},Yn.answer_text.map(function(Mn,Li){return t.a.createElement(R.a,{span:24,key:Li},t.a.createElement(S.a,{key:ni,checked:ue.standard_answer.includes(ni),disabled:!0,value:Mn}))}))))})),t.a.createElement("div",{className:ve.a.action},!ue.hideAction&&mi.map(function(Yn,ni){return Yn.id==="up"&&ue.key===1||Yn.id==="down"&&ue.key===ue.len?null:t.a.createElement(f.a,{key:ni,placement:"bottom",title:Yn.name},t.a.createElement("span",{onClick:function(){return ei(Yn)},className:Yn.icon}))})))};return t.a.createElement("section",{className:ve.a.wrap},!Ot&&ti(),Ot&&yn())},xi=Object(K.a)(function(pt){var Je=pt.newExercisePaper;return{newExercisePaper:Je}},null,null,{forwardRef:!0})(Object(i.forwardRef)(gi)),_i=function(Je,Ft){var Bt=Je.newExercisePaper,Fe=Je.dispatch,ue=Je.editData,si=Je.cancelAdd,je=si===void 0?function(){}:si,Be=Je.editKey,Ie=Je.setEditKey,_e=Ie===void 0?function(){}:Ie,An=Je.reload,zn=An===void 0?function(){}:An,Pn=Je.addCallback,Q=Pn===void 0?function(){}:Pn,C=Object(i.useState)(""),L=Object(o.a)(C,2),z=L[0],oe=L[1],q=Object(i.useState)(""),ke=Object(o.a)(q,2),ft=ke[0],kt=ke[1],an=Object(i.useState)(""),dt=Object(o.a)(an,2),Pt=dt[0],tn=dt[1],Vn=Object(i.useState)(),fi=Object(o.a)(Vn,2),Hn=fi[0],Fn=fi[1],Qt=Object(i.useState)(!1),hn=Object(o.a)(Qt,2),on=hn[0],Nt=hn[1],$n=Object(i.useState)([]),jn=Object(o.a)($n,2),Tn=jn[0],qn=jn[1],En=Object(i.useState)(1),In=Object(o.a)(En,2),gn=In[0],Bn=In[1],Xn=Object(i.useState)(!1),Zn=Object(o.a)(Xn,2),Kt=Zn[0],Lt=Zn[1],yt=Object(i.useState)([[],[]]),It=Object(o.a)(yt,2),Ot=It[0],Vt=It[1],Zt=Object(i.useRef)(!1),Gt=Object(W.i)(),Ut=Object(i.useState)([]),vn=Object(o.a)(Ut,2),_n=vn[0],un=vn[1],cn=function(On){un([].concat(Object(F.a)(_n),[Object(_.a)({},On)]))};Object(i.useEffect)(function(){var fn;if(Zt.current)return;if(!(ue!=null&&ue.question_title)){Nt(!0),oe(""),tn(""),Fn(10);return}Lt(!(ue!=null&&ue.repeat_answer)),oe(ue==null?void 0:ue.question_title),tn(ue==null||((fn=ue.standard_answer)===null||fn===void 0)?void 0:fn[0]),Fn(ue==null?void 0:ue.question_score),qn(ue.tag_discipline_ids),Bn(ue==null?void 0:ue.difficulty),kt(ue==null?void 0:ue.analysis),Vt([ue==null?void 0:ue.normal_keywords,ue==null?void 0:ue.main_keywords])},[Bt.editData,on]),Object(i.useEffect)(function(){var fn,On=Bt!=null&&(fn=Bt.tagDisciplineData)!==null&&fn!==void 0&&fn.tag_disciplines&&Array.isArray(Bt.tagDisciplineData.tag_disciplines)?Bt.tagDisciplineData.tag_disciplines:[];un(On)},[Bt.tagDisciplineData]),Object(i.useEffect)(function(){on&&fn();function fn(){return On.apply(this,arguments)}function On(){return On=Object(ie.a)(r.a.mark(function wn(){var gt,rt,Xe;return r.a.wrap(function(We){for(;;)switch(We.prev=We.next){case 0:return We.next=2,Object(I.I)({sub_discipline_id:(gt=Bt.editData)===null||gt===void 0||((rt=gt.exercise)===null||rt===void 0)?void 0:rt.sub_discipline_id});case 2:Xe=We.sent,un(Xe.tag_disciplines);case 4:case"end":return We.stop()}},wn)})),On.apply(this,arguments)}},[on]),Object(i.useImperativeHandle)(Ft,function(){return{onSave:dn,isEdit:on}});var bn=function(On){(On==null?void 0:On.status)===0&&(b.b.success("\u4FDD\u5B58\u6210\u529F"),Nt(!1),_e(-1),Zt.current=!1,zn())},dn=function(){var fn=Object(ie.a)(r.a.mark(function On(){var wn,gt,rt,Xe,Ze,We,ct;return r.a.wrap(function(Ct){for(;;)switch(Ct.prev=Ct.next){case 0:if(z){Ct.next=3;break}return b.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),Ct.abrupt("return",!1);case 3:if(wn=Ot[0],gt=Ot[1],Zt.current=!0,!ue.question_id){Ct.next=13;break}return Ct.next=9,Fe({type:"newExercisePaper/editExerciseQuestion",payload:{id:Gt.id,question_id:ue.question_id,name:z,item_type:4,question_score:Hn,answer_texts:[Pt],tag_discipline_ids:Tn,sub_discipline_id:(Xe=Bt.editData)===null||Xe===void 0||((Ze=Xe.exercise)===null||Ze===void 0)?void 0:Ze.sub_discipline_id,difficulty:gn,repeat_answer:!Kt,analysis:ft,normal_keywords:wn,main_keywords:gt}});case 9:rt=Ct.sent,bn(rt),Ct.next=17;break;case 13:return Ct.next=15,Fe({type:"newExercisePaper/addExerciseQuestion",payload:{insert_id:ue==null?void 0:ue.insert_id,id:Gt.id,name:z,item_type:4,question_score:Hn,answer_texts:[Pt],tag_discipline_ids:Tn,sub_discipline_id:(We=Bt.editData)===null||We===void 0||((ct=We.exercise)===null||ct===void 0)?void 0:ct.sub_discipline_id,difficulty:gn,repeat_answer:!Kt,analysis:ft,normal_keywords:wn,main_keywords:gt}});case 15:rt=Ct.sent,bn(rt);case 17:return Ct.abrupt("return",{name:z,answer_texts:[Pt],analysis:ft,normal_keywords:wn,main_keywords:gt});case 18:case"end":return Ct.stop()}},On)}));return function(){return fn.apply(this,arguments)}}(),Mt=function(){var On,wn;return t.a.createElement("aside",null,t.a.createElement("div",{className:ve.a.questionType},t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},"\u4E3B\u89C2\u9898"),"\uFF08\u4E3B\u89C2\u9898\uFF0C\u672A\u4F5C\u7B54\u7684\u60C5\u51B5\u4E0B\u81EA\u52A8\u8BC4\u4E3A\u96F6\u5206\uFF09")),t.a.createElement(x.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:z,onChange:function(rt){return oe(rt)}}),t.a.createElement("p",{className:ve.a.titleWrap},t.a.createElement("span",{className:ve.a.title},"\u53C2\u8003\u7B54\u6848\uFF1A")),t.a.createElement(x.a,{id:"single-question-reference-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848",defaultValue:Pt,onChange:function(rt){return tn(rt)}}),t.a.createElement(en.a,{value:Ot,onChange:Vt}),t.a.createElement("p",{className:ve.a.titleWrap},t.a.createElement("span",{className:ve.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),t.a.createElement(x.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:ft,onChange:function(rt){return kt(rt)}}),t.a.createElement("p",{className:""},"\u5206\u503C\uFF1A",t.a.createElement(U.a,{value:Hn,max:1e4,min:0,onChange:function(rt){Fn(rt)}})," \u5206",t.a.createElement("span",{style:{marginLeft:"30px"},className:ve.a.difficult},t.a.createElement("label",{style:{color:"red"}},"*")," \u96BE\u5EA6\uFF1A",t.a.createElement(d.a.Group,{value:gn,onChange:function(rt){Bn(rt.target.value)}},t.a.createElement(d.a.Button,{value:1},"\u7B80\u5355"),t.a.createElement(d.a.Button,{value:2},"\u9002\u4E2D"),t.a.createElement(d.a.Button,{value:3},"\u56F0\u96BE")))),t.a.createElement("p",{className:ve.a.titleWrap},t.a.createElement("span",{className:"".concat(ve.a.title)},"\u77E5\u8BC6\u70B9\uFF1A",t.a.createElement("span",{className:ve.a.colorGray},"\uFF08\u6240\u6709\u81EA\u5EFA\u77E5\u8BC6\u70B9\u4EC5\u672C\u4EBA\u53EF\u89C1\uFF0C\u88ABEduCoder\u5E73\u53F0\u5BA1\u6838\u901A\u8FC7\u4E3A\u5B98\u65B9\u77E5\u8BC6\u70B9\u540E\u6240\u6709\u7528\u6237\u53EF\u89C1\uFF09")),t.a.createElement("div",{className:"mt5"},t.a.createElement(De.a,{value:Tn,selectvalues:ue==null?void 0:ue.tag_discipline_ids,onChange:qn,subId:(On=Bt.editData)===null||On===void 0||((wn=On.exercise)===null||wn===void 0)?void 0:wn.sub_discipline_id,knowledgeOptions:_n,onAddKnowledgeFinish:cn})),t.a.createElement("div",{style:{marginTop:10}},t.a.createElement("span",{style:{marginRight:10}},"\u4E0D\u5141\u8BB8\u5B66\u751F\u91CD\u590D\u7B54\u9898"),t.a.createElement(E.a,{checked:Kt,onChange:function(rt){Lt(rt)}}))),t.a.createElement("aside",{className:"tr"},(Be!==-1||ue.question_id)&&t.a.createElement(v.a,{type:"default",onClick:function(){je(),Nt(!1)}},"\u53D6\u6D88"),t.a.createElement(v.a,{className:"ml20",type:"primary",onClick:function(){dn()}},"\u4FDD\u5B58")))},Yt=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu current",id:"del"},{name:"(\u5411\u4E0B\u63D2\u5165\u7B80\u7B54\u9898)",icon:"iconfont c-light-primary ml30 icon-tianjia current",id:"add"},{name:"\u7F16\u8F91",icon:"iconfont c-light-primary ml30 icon-bianjishijuan3x current",id:"edit"}],qt=function(){var fn=Object(ie.a)(r.a.mark(function On(wn){return r.a.wrap(function(rt){for(;;)switch(rt.prev=rt.next){case 0:if(!(Be!==-1)){rt.next=3;break}return b.b.error("\u8BF7\u5148\u4FDD\u5B58\u6216\u53D6\u6D88\u5F53\u524D\u6B63\u5728\u7F16\u8F91\u7684\u95EE\u9898\u3002"),rt.abrupt("return");case 3:rt.t0=wn.id,rt.next=rt.t0==="del"?6:rt.t0==="up"||rt.t0==="down"?8:rt.t0==="edit"?12:rt.t0==="add"?15:17;break;case 6:return H.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u8BD5\u9898\u5417\uFF1F",onOk:function(){return Object(ie.a)(r.a.mark(function Ze(){return r.a.wrap(function(ct){for(;;)switch(ct.prev=ct.next){case 0:return ct.next=2,Object(he.g)({question_id:ue.question_id,exam_id:Gt.id});case 2:Fe({type:"newExercisePaper/editExercise",payload:Object(_.a)({},Gt)});case 3:case"end":return ct.stop()}},Ze)}))()}}),rt.abrupt("break",17);case 8:return rt.next=10,Fe({type:"newExercisePaper/exeriseMoveUpDown",payload:{id:ue.question_id,opr:wn.id}});case 10:return Fe({type:"newExercisePaper/editExercise",payload:Object(_.a)({},Gt)}),rt.abrupt("break",17);case 12:return _e(ue.dragKey),Nt(!0),rt.abrupt("break",17);case 15:return Q({key:ue.key,insert_id:ue==null?void 0:ue.question_id,question_type:4}),rt.abrupt("break",17);case 17:case"end":return rt.stop()}},On)}));return function(wn){return fn.apply(this,arguments)}}(),Wt=function(){return t.a.createElement("aside",null,t.a.createElement("div",{className:ve.a.questionType},!(ue!=null&&ue.isPreview)&&t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},ue.key,"\u3001\u7B80\u7B54\u9898"),"\uFF08",ue.question_score,"\u5206\uFF09")),ue!=null&&ue.isPreview?t.a.createElement("div",{style:{display:"flex"}},t.a.createElement("span",{style:{flexShrink:0},className:"font18"},ue.key,"."),t.a.createElement(Ce.a,{value:ue.question_title}),t.a.createElement("span",{style:{flexShrink:0},className:"font16"},"\uFF08",ue.question_score,"\u5206\uFF09")):t.a.createElement("div",{className:"mt5"},t.a.createElement(Ce.a,{value:ue.question_title})),t.a.createElement("div",{className:ve.a.questionChoices},t.a.createElement("p",null,t.a.createElement("strong",null,"\u53C2\u8003\u7B54\u6848\uFF1A")),t.a.createElement(Ce.a,{value:Pt||""})),t.a.createElement("div",{className:ve.a.action},!ue.hideAction&&Yt.map(function(On,wn){return t.a.createElement(f.a,{key:wn,placement:"bottom",title:On.name},t.a.createElement("span",{onClick:function(){return qt(On)},className:On.icon}))})))};return t.a.createElement("section",{className:ve.a.wrap},!on&&Wt(),on&&Mt())},Dn=Object(K.a)(function(pt){var Je=pt.newExercisePaper;return{newExercisePaper:Je}},null,null,{forwardRef:!0})(Object(i.forwardRef)(_i)),Ai=function(Je,Ft){var Bt=Je.dispatch,Fe=Je.editData,ue=Je.cancelAdd,si=ue===void 0?function(){}:ue,je=Je.editKey,Be=Je.setEditKey,Ie=Be===void 0?function(){}:Be,_e=Je.reload,An=_e===void 0?function(){}:_e,zn=Object(i.useState)(""),Pn=Object(o.a)(zn,2),Q=Pn[0],C=Pn[1],L=Object(i.useState)(""),z=Object(o.a)(L,2),oe=z[0],q=z[1],ke=Object(i.useState)(""),ft=Object(o.a)(ke,2),kt=ft[0],an=ft[1],dt=Object(i.useState)([]),Pt=Object(o.a)(dt,2),tn=Pt[0],Vn=Pt[1],fi=Object(i.useState)(),Hn=Object(o.a)(fi,2),Fn=Hn[0],Qt=Hn[1],hn=Object(i.useState)(!1),on=Object(o.a)(hn,2),Nt=on[0],$n=on[1],jn=Object(i.useState)([]),Tn=Object(o.a)(jn,2),qn=Tn[0],En=Tn[1],In=Object(i.useState)(!1),gn=Object(o.a)(In,2),Bn=gn[0],Xn=gn[1],Zn=Object(i.useState)(!1),Kt=Object(o.a)(Zn,2),Lt=Kt[0],yt=Kt[1],It=Object(W.i)(),Ot=Object(i.useRef)(!1);Object(i.useEffect)(function(){var un;if(Ot.current)return;Fe.edit&&(Xn(!0),q(""),C(""),En([])),C(Fe.shixun_name),q(Fe.question_title);var cn=[];(un=Fe.shixun)===null||un===void 0||un.map(function(bn){cn.push(bn.challenge_score)}),En(cn)},[Fe]),Object(i.useEffect)(function(){$n(!1)},[Bn]),Object(i.useImperativeHandle)(Ft,function(){return{onSave:Zt,isEdit:Bn}});var Vt=function(cn){(cn==null?void 0:cn.status)===0&&(b.b.success("\u4FDD\u5B58\u6210\u529F"),Xn(!1),Ie(-1),Ot.current=!1,An())},Zt=function(){var un=Object(ie.a)(r.a.mark(function cn(){var bn,dn,Mt;return r.a.wrap(function(qt){for(;;)switch(qt.prev=qt.next){case 0:if(bn=[],dn=!1,!dn){qt.next=4;break}return qt.abrupt("return",!1);case 4:if(Ot.current=!0,yt(!0),!Fe.question_id){qt.next=12;break}return qt.next=9,Bt({type:"newExercisePaper/editExerciseQuestion",payload:{id:It.id,question_id:Fe.question_id,name:oe,shixun_name:Q,shixun_id:Fe.shixun_id,item_type:5,question_scores:qn}});case 9:Mt=qt.sent,qt.next=15;break;case 12:return qt.next=14,Bt({type:"newExercisePaper/addExerciseQuestion",payload:{id:It.id,insert_id:Fe==null?void 0:Fe.insert_id,name:oe,shixun_name:Q,shixun_id:Fe.shixun_id,item_type:5,question_scores:qn,is_copy:Fe.is_copy}});case 14:Mt=qt.sent;case 15:return Vt(Mt),yt(!1),qt.abrupt("return",{name:oe,analysis:kt,standard_answers:bn,is_ordered:Fn});case 18:case"end":return qt.stop()}},cn)}));return function(){return un.apply(this,arguments)}}(),Gt=function(){var cn;return t.a.createElement("aside",null,t.a.createElement("div",{className:ve.a.questionType},t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},"\u5B9E\u8BAD\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u5141\u8BB8\u624B\u52A8\u8C03\u5206\uFF09")),t.a.createElement("div",{className:"mt10"},t.a.createElement(S.a,{defaultValue:Q,onChange:function(dn){C(dn.target.value)}})),t.a.createElement("div",{className:"mt10"},t.a.createElement(x.a,{id:"single-question-option-0",height:155,placeholder:"\u8BF7\u8F93\u5165\u5B9E\u8BAD\u9898\u5B8C\u6210\u8981\u6C42",defaultValue:oe,onChange:function(dn){q(dn)}})),t.a.createElement("div",{className:"mt20"},(cn=Fe.shixun)===null||cn===void 0?void 0:cn.map(function(bn,dn){return t.a.createElement(k.a,{gutter:[20,20]},t.a.createElement(R.a,{flex:"1"},dn+1,".",bn.challenge_name),t.a.createElement(R.a,null,t.a.createElement(U.a,{defaultValue:qn[dn],onChange:function(Yt){qn[dn]=Yt,En(qn)}})," ","\u5206"))})),t.a.createElement("div",{className:"mt20"},tn.length>1&&t.a.createElement("span",null,t.a.createElement(h.a,{checked:Fn,onChange:function(dn){return Qt(dn.target.checked)},className:"".concat(ve.a.color333," font14")},"\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"),t.a.createElement("span",{className:"".concat(ve.a.color999," font12")},"\uFF08\u9009\u4E2D\uFF0C\u6BCF\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u987A\u5E8F\u5FC5\u987B\u4E0E\u53C2\u8003\u7B54\u6848\u4E00\u81F4\uFF09"))),t.a.createElement("aside",{className:"tr"},(je!==-1||!(Fe!=null&&Fe.edit))&&t.a.createElement(v.a,{type:"default",onClick:function(){si(),Xn(!1)}},"\u53D6\u6D88"),t.a.createElement(v.a,{loading:Lt,className:"ml20",type:"primary",onClick:function(){Zt()}},"\u4FDD\u5B58")))},Ut=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu current",id:"del"},{name:"(\u5411\u4E0B\u63D2\u5165\u5B9E\u8BAD\u9898)",icon:"iconfont c-light-primary ml30 icon-tianjia current",id:"add"},{name:"\u7F16\u8F91",icon:"iconfont c-light-primary ml30 icon-bianjishijuan3x current",id:"edit"}],vn=function(){var un=Object(ie.a)(r.a.mark(function cn(bn){return r.a.wrap(function(Mt){for(;;)switch(Mt.prev=Mt.next){case 0:if(!(je!==-1)){Mt.next=3;break}return b.b.error("\u8BF7\u5148\u4FDD\u5B58\u6216\u53D6\u6D88\u5F53\u524D\u6B63\u5728\u7F16\u8F91\u7684\u95EE\u9898\u3002"),Mt.abrupt("return");case 3:Mt.t0=bn.id,Mt.next=Mt.t0==="del"?6:Mt.t0==="edit"?8:Mt.t0==="add"?11:13;break;case 6:return H.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u8BD5\u9898\u5417\uFF1F",onOk:function(){return Object(ie.a)(r.a.mark(function qt(){return r.a.wrap(function(fn){for(;;)switch(fn.prev=fn.next){case 0:return fn.next=2,Object(he.g)({question_id:Fe.question_id,exam_id:It.id});case 2:Bt({type:"newExercisePaper/editExercise",payload:Object(_.a)({},It)});case 3:case"end":return fn.stop()}},qt)}))()}}),Mt.abrupt("break",13);case 8:return Ie(Fe.dragKey),Xn(!0),Mt.abrupt("break",13);case 11:return Bt({type:"classroomList/setActionTabs",payload:{key:"\u9009\u7528\u5B9E\u8DF5\u9879\u76EE",editData:{key:Fe.key,insert_id:Fe==null?void 0:Fe.question_id,question_type:5}}}),Mt.abrupt("break",13);case 13:case"end":return Mt.stop()}},cn)}));return function(bn){return un.apply(this,arguments)}}(),_n=function(){var cn,bn;return t.a.createElement("aside",null,t.a.createElement("div",{className:ve.a.questionType},!(Fe!=null&&Fe.isPreview)&&t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},Fe.key,"\u3001\u5B9E\u8BAD\u9898"),"\uFF08",Fe.question_score,"\u5206\uFF09")),Fe!=null&&Fe.isPreview?t.a.createElement("div",{style:{display:"flex"}},t.a.createElement("span",{style:{flexShrink:0},className:"font18"},Fe.key,"."),t.a.createElement(Ce.a,{value:Fe.shixun_name}),t.a.createElement("span",{style:{flexShrink:0},className:"font16"},"\uFF08",Fe.question_score,"\u5206\uFF09"),!!((cn=Fe.schools)!==null&&cn!==void 0&&cn.length)&&t.a.createElement(f.a,{title:"\u8BE5\u5B9E\u8BAD\u9898\u9762\u5411\u6307\u5B9A\u5355\u4F4D\u5F00\u653E"},t.a.createElement("i",{className:"iconfont icon-zhidinggongkai1 font18 line24 c-orange"}))):t.a.createElement("div",{className:"mt5"},t.a.createElement(Ce.a,{value:Fe.shixun_name})),t.a.createElement("div",{className:"mt30"}),(bn=Fe.shixun)===null||bn===void 0?void 0:bn.map(function(dn,Mt){return t.a.createElement("div",{key:Mt},"\u7B2C",Mt+1,"\u5173"," ",t.a.createElement("span",{className:"ml10"},dn.challenge_name)," ",t.a.createElement("span",{className:"ml10"},dn.challenge_score," \u5206"))}),t.a.createElement("div",{className:ve.a.action},t.a.createElement(ze.a,{target:"_blank",to:"/shixuns/".concat(Fe.shixun_identifier,"/challenges?exercise=true")},"\u5B9E\u8BAD\u8BE6\u60C5"),!Fe.hideAction&&Ut.map(function(dn,Mt){return t.a.createElement(f.a,{key:Mt,placement:"bottom",title:dn.name},t.a.createElement("span",{onClick:function(){return vn(dn)},className:dn.icon}))})))};return t.a.createElement("section",{className:ve.a.wrap},!Bn&&_n(),Bn&&Gt())},Ln=Object(K.a)(function(pt){var Je=pt.newExercisePaper;return{newExercisePaper:Je}},null,null,{forwardRef:!0})(Object(i.forwardRef)(Ai)),Dt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Qn=function(Je,Ft){var Bt=Je.newExercisePaper,Fe=Je.dispatch,ue=Je.editData,si=Je.editKey,je=Je.addCallback,Be=je===void 0?function(){}:je,Ie=Object(i.useState)([]),_e=Object(o.a)(Ie,2),An=_e[0],zn=_e[1],Pn=Object(i.useState)(),Q=Object(o.a)(Pn,2),C=Q[0],L=Q[1],z=Object(i.useState)([]),oe=Object(o.a)(z,2),q=oe[0],ke=oe[1],ft=Object(i.useState)(""),kt=Object(o.a)(ft,2),an=kt[0],dt=kt[1],Pt=Object(i.useState)(5),tn=Object(o.a)(Pt,2),Vn=tn[0],fi=tn[1],Hn=Object(i.useState)(!1),Fn=Object(o.a)(Hn,2),Qt=Fn[0],hn=Fn[1],on=Object(W.i)();Object(i.useEffect)(function(){zn(["","","",""])},[]),Object(i.useEffect)(function(){if(!(ue!=null&&ue.question_choices)){hn(!0),dt(""),fi(5),zn(["","","",""]),ke([]);return}dt(ue==null?void 0:ue.question_title),fi(ue==null?void 0:ue.question_score),zn(ue==null?void 0:ue.question_choices.map(function(In){return In.choice_text}));var En=[];ue==null||ue.standard_answer.map(function(In,gn){En.push(In-1)}),ke(En)},[ue]),Object(i.useImperativeHandle)(Ft,function(){return{onSave:Nt,isEdit:Qt}});var Nt=function(){var En=Object(ie.a)(r.a.mark(function In(){var gn,Bn,Xn;return r.a.wrap(function(Kt){for(;;)switch(Kt.prev=Kt.next){case 0:if(an){Kt.next=3;break}return b.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u76EE"),Kt.abrupt("return",!1);case 3:if(gn=An.findIndex(function(Lt){return!Lt}),!(gn>-1)){Kt.next=7;break}return b.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(Dt[gn]," \u9009\u9879\u7684\u5185\u5BB9")),Kt.abrupt("return",!1);case 7:if(q.length){Kt.next=10;break}return b.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),Kt.abrupt("return",!1);case 10:if(!(q.length<1)){Kt.next=13;break}return b.b.info("\u8BF7\u9009\u62E9\u7B54\u6848"),Kt.abrupt("return",!1);case 13:if(Bn=An.map(function(Lt,yt){return{choice_text:Lt,is_answer:q.includes(yt)?yt+1:0}}),!ue.question_id){Kt.next=20;break}return Kt.next=17,Fe({type:"newExercisePaper/editExerciseQuestion",payload:{id:ue.question_id,question_title:an,question_type:1,question_score:Vn,question_choices:Bn.map(function(Lt){return Lt.choice_text}),standard_answers:Bn.filter(function(Lt){return Lt.is_answer}).map(function(Lt){return Lt.is_answer})}});case 17:Xn=Kt.sent,Kt.next=23;break;case 20:return Kt.next=22,Fe({type:"newExercisePaper/addExerciseQuestion",payload:{insert_id:ue==null?void 0:ue.insert_id,categoryId:on.categoryId,question_title:an,question_type:1,question_score:"5.0",question_choices:Bn.map(function(Lt){return Lt.choice_text}),standard_answers:Bn.filter(function(Lt){return Lt.is_answer}).map(function(Lt){return Lt.is_answer})}});case 22:Xn=Kt.sent;case 23:Xn.status===0&&(b.b.success("\u4FDD\u5B58\u6210\u529F"),hn(!1),Fe({type:"newExercisePaper/editExercise",payload:Object(_.a)({},on)}));case 24:case"end":return Kt.stop()}},In)}));return function(){return En.apply(this,arguments)}}(),$n=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu current",id:"del"},{name:"(\u5411\u4E0B\u63D2\u5165\u7F16\u7A0B\u9898)",icon:"iconfont c-light-primary ml30 icon-tianjia current",id:"add"},{name:"\u7F16\u8F91",icon:"iconfont c-light-primary ml30 icon-bianjishijuan3x current",id:"edit"}],jn=function(){var En=Object(ie.a)(r.a.mark(function In(gn){return r.a.wrap(function(Xn){for(;;)switch(Xn.prev=Xn.next){case 0:if(!(si!==-1)){Xn.next=3;break}return b.b.error("\u8BF7\u5148\u4FDD\u5B58\u6216\u53D6\u6D88\u5F53\u524D\u6B63\u5728\u7F16\u8F91\u7684\u95EE\u9898\u3002"),Xn.abrupt("return");case 3:Xn.t0=gn.id,Xn.next=Xn.t0==="del"?6:Xn.t0==="edit"?8:Xn.t0==="add"?10:12;break;case 6:return H.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u8BD5\u9898\u5417\uFF1F",onOk:function(){return Object(ie.a)(r.a.mark(function Kt(){return r.a.wrap(function(yt){for(;;)switch(yt.prev=yt.next){case 0:return yt.next=2,Object(he.g)({exam_id:on.id,question_id:ue.question_id});case 2:Fe({type:"newExercisePaper/editExercise",payload:Object(_.a)({},on)});case 3:case"end":return yt.stop()}},Kt)}))()}}),Xn.abrupt("break",12);case 8:return K.d.push("/problems/".concat(ue==null?void 0:ue.hack_identifier,"/edit?type=exercises&express_id=").concat(on.id,"&question_id=").concat(ue==null?void 0:ue.question_id,"&score=").concat(ue==null?void 0:ue.question_score,"&exercise=true&callback_url=").concat(location.pathname)),Xn.abrupt("break",12);case 10:return Be({key:ue.key,insert_id:ue==null?void 0:ue.question_id,question_type:6}),Xn.abrupt("break",12);case 12:case"end":return Xn.stop()}},In)}));return function(gn){return En.apply(this,arguments)}}(),Tn=function(){var En=Object(ie.a)(r.a.mark(function In(gn){var Bn;return r.a.wrap(function(Zn){for(;;)switch(Zn.prev=Zn.next){case 0:return gn.preventDefault(),Zn.next=3,Object(I.X)({id:ue==null?void 0:ue.hack_identifier});case 3:Bn=Zn.sent,Bn.status===0&&Object(ae.S)("/myproblems/".concat(Bn==null?void 0:Bn.identifier));case 5:case"end":return Zn.stop()}},In)}));return function(gn){return En.apply(this,arguments)}}(),qn=function(){return t.a.createElement("aside",null,t.a.createElement("div",{className:ve.a.questionType},!(ue!=null&&ue.isPreview)&&t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},ue.key,"\u3001\u7F16\u7A0B\u9898"),"\uFF08",ue.question_score,"\u5206\uFF09")),ue!=null&&ue.isPreview?t.a.createElement("div",{style:{display:"flex"}},t.a.createElement("span",{style:{flexShrink:0},className:"font18"},ue.key,"."),t.a.createElement(Ce.a,{value:ue.question_title}),t.a.createElement("span",{style:{flexShrink:0},className:"font16"},"\uFF08",ue.question_score,"\u5206\uFF09")):t.a.createElement("div",{className:"mt5"},t.a.createElement(Ce.a,{value:ue.question_title})),t.a.createElement("div",{className:ve.a.questionChoices},t.a.createElement(Ce.a,{value:ue.description||""})),t.a.createElement("div",{className:ve.a.action},!ue.hideAction&&$n.map(function(In,gn){return t.a.createElement(f.a,{key:gn,placement:"bottom",title:In.name},t.a.createElement("span",{onClick:function(){return jn(In)},className:In.icon}))})))};return t.a.createElement("section",{className:ve.a.wrap},qn())},vi=Object(K.a)(function(pt){var Je=pt.newExercisePaper;return{newExercisePaper:Je}},null,null,{forwardRef:!0})(Object(i.forwardRef)(Qn)),hi=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],bi=function(Je,Ft){var Bt=Je.newExercisePaper,Fe=Je.dispatch,ue=Je.editData,si=Je.cancelAdd,je=si===void 0?function(){}:si,Be=Je.editKey,Ie=Je.setEditKey,_e=Ie===void 0?function(){}:Ie,An=Je.addCallback,zn=An===void 0?function(dn){}:An,Pn=Je.reload,Q=Pn===void 0?function(){}:Pn,C=Object(i.useState)([]),L=Object(o.a)(C,2),z=L[0],oe=L[1],q=Object(i.useState)(!1),ke=Object(o.a)(q,2),ft=ke[0],kt=ke[1],an=Object(i.useState)(!0),dt=Object(o.a)(an,2),Pt=dt[0],tn=dt[1],Vn=Object(i.useState)(1),fi=Object(o.a)(Vn,2),Hn=fi[0],Fn=fi[1],Qt=Object(i.useState)(!1),hn=Object(o.a)(Qt,2),on=hn[0],Nt=hn[1],$n=Object(i.useState)([]),jn=Object(o.a)($n,2),Tn=jn[0],qn=jn[1],En=Object(W.i)(),In=Object(i.useRef)(null),gn=Object(i.useState)(""),Bn=Object(o.a)(gn,2),Xn=Bn[0],Zn=Bn[1],Kt=Object(i.useState)([]),Lt=Object(o.a)(Kt,2),yt=Lt[0],It=Lt[1],Ot=Object(i.useRef)(!1),Vt=function(Mt){qn([].concat(Object(F.a)(Tn),[Object(_.a)({},Mt)]))};Object(i.useEffect)(function(){var dn;if(Ot.current)return;if(!(ue!=null&&ue.question_title)){kt(!0),Zn("");return}Zn(ue==null?void 0:ue.question_title),Nt(!(ue!=null&&ue.repeat_answer)),Fn(ue==null?void 0:ue.difficulty),oe(ue.tag_discipline_ids);var Mt=ue==null||((dn=ue.sub_exercise_questions)===null||dn===void 0)?void 0:dn.map(function(Yt){return Object(_.a)(Object(_.a)({},Yt),{},{id:Yt.question_id,name:Yt.question_title,open:!1,question_score:Yt.question_score,choices:Yt==null?void 0:Yt.question_choices.map(function(qt){return{choice_text:qt.choice_text,is_answer:qt.standard_boolean?1:0}}),activeQusEditor:null})});It(Mt)},[ue,ft]),Object(i.useEffect)(function(){ft&&dn();function dn(){return Mt.apply(this,arguments)}function Mt(){return Mt=Object(ie.a)(r.a.mark(function Yt(){var qt,Wt,fn;return r.a.wrap(function(wn){for(;;)switch(wn.prev=wn.next){case 0:return wn.next=2,Object(I.I)({sub_discipline_id:(qt=Bt.editData)===null||qt===void 0||((Wt=qt.exercise)===null||Wt===void 0)?void 0:Wt.sub_discipline_id});case 2:fn=wn.sent,qn(fn.tag_disciplines);case 4:case"end":return wn.stop()}},Yt)})),Mt.apply(this,arguments)}},[ft]),Object(i.useEffect)(function(){var dn,Mt=Bt!=null&&(dn=Bt.tagDisciplineData)!==null&&dn!==void 0&&dn.tag_disciplines&&Array.isArray(Bt.tagDisciplineData.tag_disciplines)?Bt.tagDisciplineData.tag_disciplines:[];qn(Mt)},[Bt.tagDisciplineData]),Object(i.useImperativeHandle)(Ft,function(){return{onSave:Gt,isEdit:ft}});var Zt=function(Mt){(Mt==null?void 0:Mt.status)===0&&(b.b.success("\u4FDD\u5B58\u6210\u529F"),kt(!1),_e(-1),Ot.current=!1,Q())},Gt=function(){var dn=Object(ie.a)(r.a.mark(function Mt(){var Yt,qt,Wt,fn,On,wn,gt,rt,Xe,Ze,We;return r.a.wrap(function(et){for(;;)switch(et.prev=et.next){case 0:if(Xn){et.next=3;break}return b.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),et.abrupt("return",!1);case 3:if(!(yt.length===0)){et.next=6;break}return b.b.info("\u8BF7\u60A8\u6DFB\u52A0\u5C0F\u9898"),et.abrupt("return",!1);case 6:Yt=0;case 7:if(!(Yt<yt.length)){et.next=25;break}if(Wt=yt[Yt],Wt!=null&&Wt.name){et.next=12;break}return b.b.info("\u8BF7\u60A8\u8F93\u5165\u7B2C".concat(Yt+1,"\u5C0F\u9898\u9898\u5E72")),et.abrupt("return",!1);case 12:if(Wt!=null&&Wt.question_score){et.next=15;break}return b.b.info("\u7B2C".concat(Yt+1,"\u5C0F\u9898\u5206\u6570\u4E0D\u80FD\u4E3A0\u6216\u7A7A")),et.abrupt("return",!1);case 15:if(fn=Wt==null||((qt=Wt.choices)===null||qt===void 0)?void 0:qt.findIndex(function(Ct){return!Ct}),!(fn>-1)){et.next=19;break}return b.b.info("\u8BF7\u5148\u8F93\u5165\u7B2C".concat(Yt+1,"\u5C0F\u9898").concat(hi[fn],"\u9009\u9879\u7684\u5185\u5BB9")),et.abrupt("return",!1);case 19:if(!(Wt.choices.findIndex(function(Ct){return Ct.is_answer===1})===-1)){et.next=22;break}return b.b.info("\u8BF7\u8BBE\u7F6E\u7B2C".concat(Yt+1,"\u5C0F\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E")),et.abrupt("return",!1);case 22:Yt++,et.next=7;break;case 25:if(On=yt.map(function(Ct){return{id:Ct.id>1?Ct.id:null,name:Ct.name,item_type:Pe.a.Single,choices:Ct.choices,question_score:Ct.question_score}}),Ot.current=!0,!ue.question_id){et.next=34;break}return et.next=30,Fe({type:"newExercisePaper/editExerciseQuestion",payload:{id:En.id,question_id:ue.question_id,name:Xn,item_type:Pe.a.Combine,sub_item_banks:On,tag_discipline_ids:z,sub_discipline_id:(gt=Bt.editData)===null||gt===void 0||((rt=gt.exercise)===null||rt===void 0)?void 0:rt.sub_discipline_id,difficulty:Hn,repeat_answer:!on}});case 30:wn=et.sent,Zt(wn),et.next=38;break;case 34:return et.next=36,Fe({type:"newExercisePaper/addExerciseQuestion",payload:{id:En.id,insert_id:ue==null?void 0:ue.insert_id,name:Xn,item_type:Pe.a.Combine,tag_discipline_ids:z,sub_discipline_id:(Xe=Bt.editData)===null||Xe===void 0||((Ze=Xe.exercise)===null||Ze===void 0)?void 0:Ze.sub_discipline_id,difficulty:Hn,repeat_answer:!on,sub_item_banks:On}});case 36:wn=et.sent,((We=wn)===null||We===void 0?void 0:We.status)===0&&(_e(-1),b.b.success("\u4FDD\u5B58\u6210\u529F"),kt(!1),Fe({type:"newExercisePaper/editExercise",payload:Object(_.a)({},En)}));case 38:case"end":return et.stop()}},Mt)}));return function(){return dn.apply(this,arguments)}}(),Ut=[{name:"\u5220\u9664",icon:"iconfont c-light-black ml30 icon-shanchu current",id:"del"},{name:"\u7F16\u8F91",icon:"iconfont c-light-primary ml30 icon-bianjishijuan3x current",id:"edit"}],vn=function(){var dn=Object(ie.a)(r.a.mark(function Mt(Yt){return r.a.wrap(function(Wt){for(;;)switch(Wt.prev=Wt.next){case 0:if(!(Be!==-1)){Wt.next=3;break}return b.b.error("\u8BF7\u5148\u4FDD\u5B58\u6216\u53D6\u6D88\u5F53\u524D\u6B63\u5728\u7F16\u8F91\u7684\u95EE\u9898\u3002"),Wt.abrupt("return");case 3:Wt.t0=Yt.id,Wt.next=Wt.t0==="del"?6:Wt.t0==="edit"?8:Wt.t0==="add"?11:13;break;case 6:return H.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u8BD5\u9898\u5417\uFF1F",onOk:function(){return Object(ie.a)(r.a.mark(function On(){return r.a.wrap(function(gt){for(;;)switch(gt.prev=gt.next){case 0:return gt.next=2,Object(he.g)({question_id:ue.question_id,exam_id:En.id});case 2:Fe({type:"newExercisePaper/editExercise",payload:Object(_.a)({},En)});case 3:case"end":return gt.stop()}},On)}))()}}),Wt.abrupt("break",13);case 8:return _e(ue.dragKey),kt(!0),Wt.abrupt("break",13);case 11:return zn({key:ue.key,insert_id:ue==null?void 0:ue.question_id,item_type:Pe.a.Single}),Wt.abrupt("break",13);case 13:case"end":return Wt.stop()}},Mt)}));return function(Yt){return dn.apply(this,arguments)}}(),_n=function(){var Mt;return t.a.createElement("aside",{ref:In},t.a.createElement("div",{className:ve.a.questionType},!(ue!=null&&ue.isPreview)&&t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},ue.key,"\u3001\u7EC4\u5408\u9898"),"\uFF08",ue.question_score,"\u5206\uFF09")),ue!=null&&ue.isPreview?t.a.createElement("div",{style:{display:"flex",alignItems:"flex-start"}},t.a.createElement("span",{style:{flexShrink:0},className:"font18"},ue.key,"."),t.a.createElement(Ce.a,{value:ue.question_title}),t.a.createElement("span",{style:{flexShrink:0},className:"font16"},"\uFF08\u5171",ue==null?void 0:ue.sub_q_count,"\u5C0F\u9898\uFF0C",ue.question_score,"\u5206\uFF09")):t.a.createElement("div",{className:"mt5"},t.a.createElement(Ce.a,{value:ue.question_title})),t.a.createElement("div",{style:{display:Pt?"block":"none"},className:ve.a.questionChoices},ue==null||((Mt=ue.sub_exercise_questions)===null||Mt===void 0)?void 0:Mt.map(function(Yt,qt){var Wt;return t.a.createElement("div",{key:qt},t.a.createElement("div",{style:{display:"flex",alignItems:"flex-start"}},t.a.createElement("span",{style:{flexShrink:0},className:"font18"},ue.key,".",qt+1,"\uFF08\u5355\u9009\u9898\uFF09"),t.a.createElement(Ce.a,{value:Yt.question_title}),t.a.createElement("span",{style:{flexShrink:0},className:"font16"},"\uFF08",Yt.question_score,"\u5206\uFF09")),Yt==null||((Wt=Yt.question_choices)===null||Wt===void 0)?void 0:Wt.map(function(fn,On){return t.a.createElement(k.a,{key:On},t.a.createElement(R.a,null,t.a.createElement(d.a,{key:On,checked:fn.standard_boolean,disabled:!0},hi[On],".")),t.a.createElement(R.a,{flex:"1"},t.a.createElement("span",{className:"c-black font14"},t.a.createElement(Ce.a,{value:fn.choice_text}))))}))})),t.a.createElement("div",{className:ve.a.action},t.a.createElement("span",{className:"c-light-primary current",onClick:function(){return tn(!Pt)},style:{}},Pt?"\u6536\u8D77":"\u5C55\u5F00"),!ue.hideAction&&Ut.map(function(Yt,qt){return t.a.createElement(f.a,{key:qt,placement:"bottom",title:Yt.name},t.a.createElement("span",{onClick:function(){return vn(Yt)},className:Yt.icon}))})))},un=function(){var Mt,Yt;return t.a.createElement("aside",null,t.a.createElement("div",{className:ve.a.questionType},t.a.createElement("div",null,t.a.createElement("span",{className:"font16 c-blue"},"\u9009\u62E9\u9898"),"\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848\uFF09")),t.a.createElement("section",{className:ve.a.wrap,style:{padding:0}},t.a.createElement("p",{className:ve.a.titleWrap},t.a.createElement("span",{className:ve.a.required},"*"),t.a.createElement("span",{className:ve.a.title},"\u9898\u5E72\uFF1A")),t.a.createElement(x.a,{id:"combination-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Xn,onChange:function(Wt){return Zn(Wt)}}),t.a.createElement("p",null,"\u5C0F\u9898\u6570\uFF1A",yt==null?void 0:yt.length),yt==null?void 0:yt.map(function(qt,Wt){var fn;return t.a.createElement("div",{className:ve.a.fold,key:qt.id},t.a.createElement("div",{onClick:function(){return bn("open",Wt)},className:ve.a.head},t.a.createElement("i",{className:"iconfont icon-sanjiaoxing",style:{transform:qt.open?"initial":"rotate(270deg) translate(2px, 4px)"}}),t.a.createElement("span",null,"\u7B2C",Wt+1,"\u5C0F\u9898\uFF08\u5355\u9009\u9898\uFF09"),t.a.createElement("b",{onClick:function(wn){wn.stopPropagation(),bn("delete",Wt)},className:"iconfont icon-shanchu8"})),t.a.createElement("div",{className:"mb10",style:{display:qt.open?"block":"none"}},t.a.createElement(x.a,{watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:qt==null?void 0:qt.name,onChange:function(wn){return bn("value",Wt,wn)}}),t.a.createElement("p",{className:ve.a.titleWrap},t.a.createElement("span",{className:ve.a.required},"*"),t.a.createElement("span",{className:ve.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",t.a.createElement("span",{className:ve.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),qt==null||((fn=qt.choices)===null||fn===void 0)?void 0:fn.map(function(On,wn){var gt;return t.a.createElement("div",{className:ve.a.choiceWrap,key:wn},t.a.createElement(f.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},t.a.createElement("div",{className:"".concat(ve.a.answer," ").concat(On.is_answer===1?ve.a.activeAnswer:""),onClick:function(){return bn("answer",Wt,wn)}},hi[wn])),t.a.createElement("div",{className:ve.a.editorWrap},(qt==null?void 0:qt.activeQusEditor)===wn?t.a.createElement(x.a,{id:"single-question-option-".concat(wn),watch:!0,height:155,isFocus:!0,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:On.choice_text,onChange:function(Xe){return bn("details",Wt,Xe)}}):t.a.createElement("div",{className:ve.a.htmlWrap,onClick:function(){return bn("edit",Wt,wn)}},t.a.createElement(Ce.a,{value:On.choice_text}))),wn>1&&t.a.createElement(f.a,{title:"\u5220\u9664"},t.a.createElement("i",{className:"".concat(ve.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return bn("deleteQus",Wt,wn)}})),wn<7&&wn===(qt==null||((gt=qt.choices)===null||gt===void 0)?void 0:gt.length)-1&&t.a.createElement(f.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},t.a.createElement("i",{className:"".concat(ve.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return bn("addQus",Wt)}})))}),t.a.createElement("p",{className:"mt10"},"\u5206\u503C\uFF1A",t.a.createElement(U.a,{value:qt.question_score,max:1e4,min:0,onChange:function(wn){return bn("score",Wt,wn)}}),"\u5206")))}),yt.length<20&&t.a.createElement(v.a,{type:"primary",onClick:cn},t.a.createElement("i",{className:"iconfont icon-tianjiatimu mr5 font14"}),"\u6DFB\u52A0\u5C0F\u9898")),t.a.createElement("p",{className:"mt10"},t.a.createElement("span",{className:ve.a.difficult},t.a.createElement("label",{style:{color:"red"}},"*")," \u96BE\u5EA6\uFF1A",t.a.createElement(d.a.Group,{value:Hn,onChange:function(Wt){Fn(Wt.target.value)}},t.a.createElement(d.a.Button,{value:1},"\u7B80\u5355"),t.a.createElement(d.a.Button,{value:2},"\u9002\u4E2D"),t.a.createElement(d.a.Button,{value:3},"\u56F0\u96BE")))),t.a.createElement("p",{className:ve.a.titleWrap},t.a.createElement("span",{className:"".concat(ve.a.title)},"\u77E5\u8BC6\u70B9\uFF1A",t.a.createElement("span",{className:ve.a.colorGray},"\uFF08\u6240\u6709\u81EA\u5EFA\u77E5\u8BC6\u70B9\u4EC5\u672C\u4EBA\u53EF\u89C1\uFF0C\u88ABEduCoder\u5E73\u53F0\u5BA1\u6838\u901A\u8FC7\u4E3A\u5B98\u65B9\u77E5\u8BC6\u70B9\u540E\u6240\u6709\u7528\u6237\u53EF\u89C1\uFF09")),t.a.createElement("div",{className:"mt5"},t.a.createElement(De.a,{selectvalues:ue==null?void 0:ue.tag_discipline_ids,value:z,onChange:oe,subId:(Mt=Bt.editData)===null||Mt===void 0||((Yt=Mt.exercise)===null||Yt===void 0)?void 0:Yt.sub_discipline_id,knowledgeOptions:Tn,onAddKnowledgeFinish:Vt}))),t.a.createElement("aside",{className:"tr"},(Be!==-1||ue.question_id)&&t.a.createElement(v.a,{type:"default",onClick:function(){je(),kt(!1)}},"\u53D6\u6D88"),t.a.createElement(v.a,{className:"ml20",type:"primary",onClick:function(){Gt()}},"\u4FDD\u5B58")))},cn=function(){var Mt={id:Math.random(),item_type:"SINGLE",open:!1,name:"",choices:Array.from({length:4},function(){return{choice_text:"",is_answer:0}}),activeQusEditor:null,analysis:""};It(yt.concat(Mt))},bn=function(Mt,Yt,qt){var Wt=Object(St.cloneDeep)(yt);Mt==="open"&&(Wt[Yt].open=!Wt[Yt].open),Mt==="delete"&&Wt.splice(Yt,1),Mt==="value"&&(Wt[Yt].name=qt),Mt==="answer"&&Wt[Yt].choices.forEach(function(fn,On){fn.is_answer=qt===On?1:0}),Mt==="edit"&&(Wt[Yt].activeQusEditor=qt),Mt==="details"&&(Wt[Yt].choices[Wt[Yt].activeQusEditor].choice_text=qt),Mt==="addQus"&&(Wt[Yt].choices=Wt[Yt].choices.concat({choice_text:"",is_answer:0})),Mt==="deleteQus"&&(Wt[Yt].choices=Wt[Yt].choices.filter(function(fn,On){return On!==qt})),Mt==="analysis"&&(Wt[Yt].analysis=qt),Mt==="score"&&(Wt[Yt].question_score=qt),It(Wt)};return t.a.createElement("section",{className:ve.a.wrap},!ft&&_n(),ft&&un())},yi=Object(K.a)(function(pt){var Je=pt.newExercisePaper;return{newExercisePaper:Je}},null,null,{forwardRef:!0})(Object(i.forwardRef)(bi)),Fi=function(Je){var Ft=Je.data,Bt=Je.isDragDisabled,Fe=Bt===void 0?!1:Bt,ue=Je.editorProps,si=ue===void 0?{}:ue,je=Je.onDragEnd,Be=je===void 0?function(){}:je,Ie=Je.dispatch,_e=Je.markBtnVisible,An=_e===void 0?!1:_e,zn=Je.batchScore,Pn=zn===void 0?[]:zn,Q=Je.reload,C=Q===void 0?function(){}:Q,L=Je.inNewPaperLibrary,z=L===void 0?!1:L,oe=Object(i.useRef)(),q=Object(W.i)(),ke=function(){var Qt,hn,on,Nt,$n,jn,Tn,qn,En,In,gn,Bn,Xn,Zn,Kt,Lt,yt=[{name:"\u5355\u9009\u9898",type:0,count:Ft==null||((Qt=Ft.exercise_types)===null||Qt===void 0)?void 0:Qt.q_singles,score:Ft==null||((hn=Ft.exercise_types)===null||hn===void 0)?void 0:hn.q_singles_scores,items:[]},{name:"\u591A\u9009\u9898",type:1,count:Ft==null||((on=Ft.exercise_types)===null||on===void 0)?void 0:on.q_doubles,score:Ft==null||((Nt=Ft.exercise_types)===null||Nt===void 0)?void 0:Nt.q_doubles_scores,items:[]},{name:"\u5224\u65AD\u9898",type:2,count:Ft==null||(($n=Ft.exercise_types)===null||$n===void 0)?void 0:$n.q_judges,score:Ft==null||((jn=Ft.exercise_types)===null||jn===void 0)?void 0:jn.q_judges_scores,items:[]},{name:"\u586B\u7A7A\u9898",type:3,count:Ft==null||((Tn=Ft.exercise_types)===null||Tn===void 0)?void 0:Tn.q_nulls,score:Ft==null||((qn=Ft.exercise_types)===null||qn===void 0)?void 0:qn.q_nulls_scores,items:[]},{name:"\u7B80\u7B54\u9898",type:4,count:Ft==null||((En=Ft.exercise_types)===null||En===void 0)?void 0:En.q_mains,score:Ft==null||((In=Ft.exercise_types)===null||In===void 0)?void 0:In.q_mains_scores,items:[]},{name:"\u5B9E\u8BAD\u9898",type:5,count:Ft==null||((gn=Ft.exercise_types)===null||gn===void 0)?void 0:gn.q_shixuns,score:Ft==null||((Bn=Ft.exercise_types)===null||Bn===void 0)?void 0:Bn.q_shixuns_scores,items:[]},{name:"\u7F16\u7A0B\u9898",type:6,count:Ft==null||((Xn=Ft.exercise_types)===null||Xn===void 0)?void 0:Xn.q_pros,score:Ft==null||((Zn=Ft.exercise_types)===null||Zn===void 0)?void 0:Zn.q_pros_scores,items:[]},{name:"\u7EC4\u5408\u9898",type:7,count:Ft==null||((Kt=Ft.exercise_types)===null||Kt===void 0)?void 0:Kt.q_combinations,score:Ft==null||((Lt=Ft.exercise_types)===null||Lt===void 0)?void 0:Lt.q_combination_scores,items:[]}];return yt},ft=function(Qt,hn,on){var Nt=Array.from(Qt),$n=Nt.splice(hn,1),jn=Object(o.a)($n,1),Tn=jn[0];return Nt.splice(on,0,Tn),Nt},kt=function(Qt,hn,on){if(!Qt.destination)return;var Nt=ft(hn,Qt.source.index,Qt.destination.index);z?Be(Qt,Nt,on):Be(Nt,on)},an=function(Qt){Ie({type:"exercise/setActionTabs",payload:{key:"\u6807\u8BB0\u9519\u9898",params:Qt}})},dt=function(Qt,hn){if(hn===0)return z?t.a.createElement($t,Object(p.a)({reload:C,editData:Qt},Qt)):t.a.createElement(Xt,Object(p.a)({reload:C,editData:Qt},Qt));if(hn===1)return z?t.a.createElement(ci,Object(p.a)({reload:C,editData:Qt},Qt)):t.a.createElement(Me,Object(p.a)({reload:C,editData:Qt},Qt));if(hn===2)return z?t.a.createElement(pi,Object(p.a)({reload:C,editData:Qt},Qt)):t.a.createElement(ye,Object(p.a)({reload:C,editData:Qt},Qt));if(hn===3)return z?t.a.createElement(xi,Object(p.a)({reload:C,editData:Qt},Qt)):t.a.createElement(be,Object(p.a)({reload:C,editData:Qt},Qt));if(hn===4)return z?t.a.createElement(Dn,Object(p.a)({reload:C,editData:Qt},Qt)):t.a.createElement(Un,Object(p.a)({reload:C,editData:Qt},Qt));if(hn===5)return z?t.a.createElement(Ln,Object(p.a)({reload:C,editData:Qt},Qt)):t.a.createElement(_t,Object(p.a)({reload:C,editData:Qt},Qt));if(hn===6)return z?t.a.createElement(vi,Object(p.a)({reload:C,editData:Qt},Qt)):t.a.createElement(Ye,Object(p.a)({editData:Qt},Qt));if(hn===7)return z?t.a.createElement(yi,Object(p.a)({reload:C,editData:Qt},Qt)):t.a.createElement(vt,Object(p.a)({reload:C,editData:Qt},Qt))},Pt=function(Qt,hn,on){return t.a.createElement(Ue.a,{onDragEnd:function($n){return kt($n,Qt,hn)}},t.a.createElement(Ue.c,{droppableId:"droppable"},function(Nt,$n){return t.a.createElement("div",Object(p.a)({ref:Nt.innerRef},Nt.droppableProps,{style:{width:"100%"}}),Qt==null?void 0:Qt.map(function(jn,Tn){var qn,En=Object(_.a)(Object(_.a)({},jn),{},{key:Tn+1,hideAction:!0,isPreview:!0,dragKey:hn+"-"+Tn},si);return t.a.createElement(Ue.b,{key:En==null?void 0:En.question_id,draggableId:En==null||((qn=En.question_id)===null||qn===void 0)?void 0:qn.toString(),index:Tn,isDragDisabled:Fe},function(In,gn){return t.a.createElement("aside",Object(p.a)({ref:In.innerRef},In.draggableProps,In.dragHandleProps),t.a.createElement("div",{className:Re.a.posWarp,id:En.dragKey},dt(En,hn),An&&t.a.createElement(k.a,{className:Re.a.markWrongBtnWrapper},t.a.createElement(v.a,{onClick:function(){return an({value:En,type:hn})}},En!=null&&En.is_wrong?"\u53D6\u6D88\u6807\u8BB0\u9519\u9898":"\u6807\u8BB0\u9519\u9898")),t.a.createElement(Y.a,null),!Fe&&t.a.createElement("div",{className:Re.a.pos},t.a.createElement("div",{className:Re.a.tips},"\u62D6\u52A8\u53EF\u4EE5\u6539\u53D8\u8BD5\u9898\u663E\u793A\u987A\u5E8F"))))})}))}))},tn=function(Qt){var hn=["\u96F6","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D","\u4E03","\u516B","\u4E5D"],on=["","\u5341","\u767E","\u5343","\u4E07"];Qt=parseInt(Qt);var Nt=function(qn){for(var En=qn.toString().split("").reverse(),In="",gn=0;gn<En.length;gn++)In=(gn==0&&En[gn]==0||gn>0&&En[gn]==0&&En[gn-1]==0?"":hn[En[gn]]+(En[gn]==0?on[0]:on[gn]))+In;return In},$n=Math.floor(Qt/1e4),jn=Qt%1e4;return jn.toString().length<4&&(jn="0"+jn),$n?Nt($n)+"\u4E07"+Nt(jn):Nt(Qt)},Vn=function(Qt){var hn={\u5355\u9009\u9898:2,\u591A\u9009\u9898:5,\u586B\u7A7A\u9898:2,\u5224\u65AD\u9898:2,\u7B80\u7B54\u9898:10,\u7F16\u7A0B\u9898:10,\u5B9E\u8BAD\u9898:5,\u7EC4\u5408\u9898:10};return hn[Qt]||0},fi=function(Qt,hn){oe.current=Vn(hn),H.a.confirm({centered:!0,title:"\u6279\u91CF\u8BBE\u7F6E\u5206\u6570",content:t.a.createElement("div",{className:""},t.a.createElement("span",null,hn==="\u7EC4\u5408\u9898"?"\u7EC4\u5408\u9898\u4E2D\u7684\u6BCF\u5C0F\u9898":hn,"\uFF1A"),t.a.createElement(U.a,{min:1,defaultValue:oe.current,onChange:function(Nt){oe.current=Nt}}),t.a.createElement("span",{className:"ml5"},"\u5206/\u9898"),t.a.createElement("br",null),hn==="\u586B\u7A7A\u9898"&&t.a.createElement("div",{style:{color:"rgb(255, 0, 0)"}},"\u6BCF\u7A7A\u5206\u503C\u6309\u6BCF\u9898\u5206\u503C\u53D6\u5E73\u5747\u5206\u8BA1\u7B97")),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var on=Object(ie.a)(r.a.mark(function $n(){var jn,Tn;return r.a.wrap(function(En){for(;;)switch(En.prev=En.next){case 0:if(!z){En.next=6;break}return En.next=3,Object(he.t)(q.id,{question_type:Qt,score:oe.current});case 3:return jn=En.sent,jn.status===0&&C(),En.abrupt("return");case 6:return En.next=8,Object(le.a)("/api/exercises/".concat(q.categoryId,"/batch_set_score.json"),{method:"post",body:{question_type:Qt,score:oe.current}});case 8:Tn=En.sent,Tn.status!==-1&&C();case 10:case"end":return En.stop()}},$n)}));function Nt(){return on.apply(this,arguments)}return Nt}()})},Hn=function(){var Qt,hn=ke();Ft==null||((Qt=Ft.exercise_questions)===null||Qt===void 0)||Qt.forEach(function(Nt,$n){if(Nt.question_type===0){var jn,Tn;(jn=hn[Nt.question_type])===null||jn===void 0||((Tn=jn.items)===null||Tn===void 0)||Tn.push(Nt)}if(Nt.question_type===1){var qn,En;(qn=hn[Nt.question_type])===null||qn===void 0||((En=qn.items)===null||En===void 0)||En.push(Nt)}if(Nt.question_type===2){var In,gn;(In=hn[Nt.question_type])===null||In===void 0||((gn=In.items)===null||gn===void 0)||gn.push(Nt)}if(Nt.question_type===3){var Bn,Xn;(Bn=hn[Nt.question_type])===null||Bn===void 0||((Xn=Bn.items)===null||Xn===void 0)||Xn.push(Nt)}if(Nt.question_type===4){var Zn,Kt;(Zn=hn[Nt.question_type])===null||Zn===void 0||((Kt=Zn.items)===null||Kt===void 0)||Kt.push(Nt)}if(Nt.question_type===5){var Lt,yt;(Lt=hn[Nt.question_type])===null||Lt===void 0||((yt=Lt.items)===null||yt===void 0)||yt.push(Nt)}if(Nt.question_type===6){var It,Ot;(It=hn[Nt.question_type])===null||It===void 0||((Ot=It.items)===null||Ot===void 0)||Ot.push(Nt)}if(Nt.question_type===7){var Vt,Zt;(Vt=hn[Nt.question_type])===null||Vt===void 0||((Zt=Vt.items)===null||Zt===void 0)||Zt.push(Nt)}});var on=Ft==null?void 0:Ft.map(function(Nt,$n){return t.a.createElement(t.a.Fragment,{key:$n},t.a.createElement("div",{className:"pl20"},t.a.createElement("span",{className:"font16 c-light-primary"},tn($n+1),"\u3001",Nt.name),t.a.createElement("span",{className:"c-grey-999"},"\uFF08\u5171",Nt.count,"\u9898",(Nt==null?void 0:Nt.question_type)===7?"\uFF0C\u5305\u542B".concat(Nt.sub_count,"\u5C0F\u9898"):"","\uFF1B\u5171",Nt.score,"\u5206\uFF09"),(Pn==null?void 0:Pn.includes(Nt==null?void 0:Nt.name))&&t.a.createElement(v.a,{onClick:function(){return fi(Nt==null?void 0:Nt.question_type,Nt==null?void 0:Nt.name)},style:{float:"right"},type:"primary",ghost:!0},"\u6279\u91CF\u8BBE\u7F6E\u5F97\u5206")),Pt(Nt.items,Nt==null?void 0:Nt.question_type,Nt==null?void 0:Nt.name))});return on};return t.a.createElement("div",null," ",Hn()," ")},ai=st.a=Object(K.a)()(Fi)},LdHM:function(zt,st,V){"use strict";V.d(st,"b",function(){return f}),V.d(st,"a",function(){return S});var ie=V("1OyB"),Z=V("vuIU"),U=V("Ji7U"),ee=V("LK+K"),H=V("q1tI"),M=V("rePB"),Y=V("Ff2n"),X=V("ODXe"),k=V("4IlW"),D=V("bX4T"),v=V("YrtM"),_=V("TSYQ"),p=V.n(_),o=V("+nKL"),u=V("8OUc"),r=function(j,$){var ae=j.prefixCls,fe=j.id,pe=j.flattenOptions,Ce=j.childrenAsData,De=j.values,xe=j.searchValue,Oe=j.multiple,Ee=j.defaultActiveFirstOption,be=j.height,te=j.itemHeight,me=j.notFoundContent,ye=j.open,Le=j.menuItemSelectedIcon,$e=j.virtual,Me=j.onSelect,ze=j.onToggleOpen,ot=j.onActiveValue,Et=j.onScroll,_t=j.onMouseEnter,mt="".concat(ae,"-item"),ut=Object(v.a)(function(){return pe},[ye,pe],function(vt,Ue){return Ue[0]&&vt[1]!==Ue[1]}),Xt=H.useRef(null),en=function(Ue){Ue.preventDefault()},sn=function(Ue){Xt.current&&Xt.current.scrollTo({index:Ue})},pn=function(Ue){for(var Ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,Re=ut.length,le=0;le<Re;le+=1){var he=(Ue+le*Ae+Re)%Re,Se=ut[he],ve=Se.group,Pe=Se.data;if(!ve&&!Pe.disabled)return he}return-1},Un=H.useState(function(){return pn(0)}),Cn=Object(X.a)(Un,2),Qe=Cn[0],Ye=Cn[1],St=function(Ue){Ye(Ue);var Ae=ut[Ue];if(!Ae){ot(null,-1);return}ot(Ae.data.value,Ue)};H.useEffect(function(){St(Ee!==!1?pn(0):-1)},[ut.length,xe]),H.useEffect(function(){var vt=setTimeout(function(){if(!Oe&&ye&&De.size===1){var Ue=Array.from(De)[0],Ae=ut.findIndex(function(Re){var le=Re.data;return le.value===Ue});St(Ae),sn(Ae)}});return function(){return clearTimeout(vt)}},[ye]);var bt=function(Ue){Ue!==void 0&&Me(Ue,{selected:!De.has(Ue)}),Oe||ze(!1)};if(H.useImperativeHandle($,function(){return{onKeyDown:function(Ue){var Ae=Ue.which;switch(Ae){case k.a.UP:case k.a.DOWN:{var Re=0;if(Ae===k.a.UP?Re=-1:Ae===k.a.DOWN&&(Re=1),Re!==0){var le=pn(Qe+Re,Re);sn(le),St(le)}break}case k.a.ENTER:{var he=ut[Qe];he&&!he.data.disabled?bt(he.data.value):bt(void 0),ye&&Ue.preventDefault();break}case k.a.ESC:ze(!1)}},onKeyUp:function(){},scrollTo:function(Ue){sn(Ue)}}}),ut.length===0)return H.createElement("div",{role:"listbox",id:"".concat(fe,"_list"),className:"".concat(mt,"-empty"),onMouseDown:en},me);function nt(vt){var Ue=ut[vt];if(!Ue)return null;var Ae=Ue.data||{},Re=Ae.value,le=Ae.label,he=Ae.children,Se=Object(D.a)(Ae,!0),ve=Ce?he:le;return Ue?H.createElement("div",Object.assign({"aria-label":typeof ve=="string"?ve:null},Se,{key:vt,role:"option",id:"".concat(fe,"_list_").concat(vt),"aria-selected":De.has(Re)}),Re):null}return H.createElement(H.Fragment,null,H.createElement("div",{role:"listbox",id:"".concat(fe,"_list"),style:{height:0,width:0,overflow:"hidden"}},nt(Qe-1),nt(Qe),nt(Qe+1)),H.createElement(o.a,{itemKey:"key",ref:Xt,data:ut,height:be,itemHeight:te,fullHeight:!1,onMouseDown:en,onScroll:Et,virtual:$e,onMouseEnter:_t},function(vt,Ue){var Ae,Re=vt.group,le=vt.groupOption,he=vt.data,Se=he.label,ve=he.key;if(Re)return H.createElement("div",{className:p()(mt,"".concat(mt,"-group"))},Se!==void 0?Se:ve);var Pe=he.disabled,it=he.value,xt=he.title,$t=he.children,mn=he.style,rn=he.className,ci=Object(Y.a)(he,["disabled","value","title","children","style","className"]),Jn=De.has(it),Sn="".concat(mt,"-option"),pi=p()(mt,Sn,rn,(Ae={},Object(M.a)(Ae,"".concat(Sn,"-grouped"),le),Object(M.a)(Ae,"".concat(Sn,"-active"),Qe===Ue&&!Pe),Object(M.a)(Ae,"".concat(Sn,"-disabled"),Pe),Object(M.a)(Ae,"".concat(Sn,"-selected"),Jn),Ae)),gi=Ce?$t:Se,xi=!Le||typeof Le=="function"||Jn;return H.createElement("div",Object.assign({},ci,{"aria-selected":Jn,className:pi,title:xt,onMouseMove:function(){if(Qe===Ue||Pe)return;St(Ue)},onClick:function(){Pe||bt(it)},style:mn}),H.createElement("div",{className:"".concat(Sn,"-content")},gi||it),H.isValidElement(Le)||Jn,xi&&H.createElement(u.a,{className:"".concat(mt,"-option-state"),customizeIcon:Le,customizeIconProps:{isSelected:Jn}},Jn?"\u2713":null))}))},i=H.forwardRef(r);i.displayName="OptionList";var t=i,c=function(){return null};c.isSelectOption=!0;var f=c,A=function(){return null};A.isSelectOptGroup=!0;var S=A,w=V("VTBJ"),R=V("Zm9Q");function O(x){var j=x.key,$=x.props,ae=$.children,fe=$.value,pe=Object(Y.a)($,["children","value"]);return Object(w.a)({key:j,value:fe!==void 0?fe:j,children:ae},pe)}function E(x){var j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(R.a)(x).map(function($,ae){if(!H.isValidElement($)||!$.type)return null;var fe=$.type.isSelectOptGroup,pe=$.key,Ce=$.props,De=Ce.children,xe=Object(Y.a)(Ce,["children"]);return j||!fe?O($):Object(w.a)(Object(w.a)({key:"__RC_SELECT_GRP__".concat(pe===null?ae:pe,"__"),label:pe},xe),{},{options:E(De)})}).filter(function($){return $})}var y=V("2Qr1"),d=V("qNPg"),l=V("U8pU"),h=V("Kwbf"),g=V("WKfj");function b(x){var j=x.mode,$=x.options,ae=x.children,fe=x.backfill,pe=x.allowClear,Ce=x.placeholder,De=x.getInputElement,xe=x.showSearch,Oe=x.onSearch,Ee=x.defaultOpen,be=x.autoFocus,te=x.labelInValue,me=x.value,ye=x.inputValue,Le=x.optionLabelProp,$e=j==="multiple"||j==="tags",Me=xe!==void 0?xe:$e||j==="combobox",ze=$||E(ae);if(Object(h.a)(j!=="tags"||ze.every(function(mt){return!mt.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),j==="tags"||j==="combobox"){var ot=ze.some(function(mt){return mt.options?mt.options.some(function(ut){return typeof("value"in ut?ut.value:ut.key)=="number"}):typeof("value"in mt?mt.value:mt.key)=="number"});Object(h.a)(!ot,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(h.a)(j!=="combobox"||!Le,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(h.a)(j==="combobox"||!fe,"`backfill` only works with `combobox` mode."),Object(h.a)(j==="combobox"||!De,"`getInputElement` only work with `combobox` mode."),Object(h.b)(j!=="combobox"||!De||!pe||!Ce,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Oe&&!Me&&j!=="combobox"&&j!=="tags"&&Object(h.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(h.b)(!Ee||be,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),me!=null){var Et=Object(g.d)(me);Object(h.a)(!te||Et.every(function(mt){return Object(l.a)(mt)==="object"&&("key"in mt||"value"in mt)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(h.a)(!$e||Array.isArray(me),"`value` should be array when `mode` is `multiple` or `tags`")}if(ae){var _t=null;Object(R.a)(ae).some(function(mt){if(!H.isValidElement(mt)||!mt.type)return!1;var ut=mt.type;if(ut.isSelectOption)return!1;if(ut.isSelectOptGroup){var Xt=Object(R.a)(mt.props.children).every(function(en){return!H.isValidElement(en)||!mt.type||en.type.isSelectOption?!0:(_t=en.type,!1)});return!Xt}return _t=ut,!0}),_t&&Object(h.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(_t.displayName||_t.name||_t,"`.")),Object(h.a)(ye===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var F=b,N=Object(d.a)({prefixCls:"rc-select",components:{optionList:t},convertChildrenToData:E,flattenOptions:y.d,getLabeledValue:y.e,filterOptions:y.b,isValueDisabled:y.g,findValueOption:y.c,warningProps:F,fillOptionsWithMissingValue:y.a}),W=function(x){Object(U.a)($,x);var j=Object(ee.a)($);function $(){var ae;return Object(ie.a)(this,$),ae=j.apply(this,arguments),ae.selectRef=H.createRef(),ae.focus=function(){ae.selectRef.current.focus()},ae.blur=function(){ae.selectRef.current.blur()},ae}return Object(Z.a)($,[{key:"render",value:function(){return H.createElement(N,Object.assign({ref:this.selectRef},this.props))}}]),$}(H.Component);W.Option=f,W.OptGroup=S;var K=W,I=st.c=K},M8RZ:function(zt,st,V){"use strict";V.d(st,"a",function(){return k});var ie=V("fWQN"),Z=V("mtLc"),U=V("yKVA"),ee=V("879j"),H=V("q1tI"),M=V.n(H),Y=V("i8i4"),X=V.n(Y),k=function(D){Object(U.a)(_,D);var v=Object(ee.a)(_);function _(p){var o;Object(ie.a)(this,_),o=v.call(this,p);var u=window.document;return o.node=u.createElement("div"),u.body.appendChild(o.node),o}return Object(Z.a)(_,[{key:"render",value:function(){var o=this.props.children;return Object(Y.createPortal)(o,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),_}(M.a.Component)},NLgs:function(zt,st,V){"use strict";V.d(st,"e",function(){return f}),V.d(st,"f",function(){return A}),V.d(st,"d",function(){return w}),V.d(st,"c",function(){return R}),V.d(st,"a",function(){return O}),V.d(st,"b",function(){return E});var ie=V("miYZ"),Z=V("tsqr"),U=V("9og8"),ee=V("2qtc"),H=V("kLXV"),M=V("WmNS"),Y=V.n(M),X=V("q1tI"),k=V.n(X),D=V("9kvl"),v=V("xKgJ"),_=V("1vsH"),p=V("RCxd"),o=V("yTi+"),u=V.n(o),r=V("1ZF9"),i=V.n(r),t=V("NoGO"),c=V.n(t),f=function(d){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!!(A(d)&&S(l))},A=function(d){return Object(v.p)()?!0:(d({type:"user/showPopLogin",payload:{showPopLogin:!0,showClosable:!0}}),!1)},S=function(){var d,l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,h=Object(D.c)()._store.getState(),g=h.user;return(d=g.userInfo)!==null&&d!==void 0&&d.profile_completed?!0:(H.a.confirm({title:"\u63D0\u793A",width:530,centered:!0,content:l?"\u6309\u7167\u6709\u5173\u653F\u7B56\u89C4\u5B9A\uFF0C\u7279\u6B8A\u5B9E\u9A8C\u9700\u8981\u5148\u7ED1\u5B9A\u624B\u673A\u53F7\u624D\u80FD\u4F7F\u7528\uFF0C\u8BF7\u5148\u7ED1\u5B9A\u624B\u673A\u53F7\u7801":"\u60A8\u9700\u8981\u53BB\u5B8C\u5584\u60A8\u7684\u4E2A\u4EBA\u8D44\u6599\uFF0C\u624D\u80FD\u4F7F\u7528\u6B64\u529F\u80FD",okText:"\u7ACB\u5373\u5B8C\u5584",cancelText:"\u7A0D\u540E\u5B8C\u5584",onOk:function(){D.d.push("/account/profile/edit")}}),!1)},w=function(){var d,l=Object(D.c)()._store.getState(),h=l.user;return(d=h.userInfo)!==null&&d!==void 0&&d.professional_certification?!0:(H.a.confirm({title:"\u63D0\u793A",centered:!0,content:k.a.createElement("div",{className:"tc"},"\u60A8\u9700\u8981\u53BB\u5B8C\u6210\u60A8\u7684\u804C\u4E1A\u8BA4\u8BC1\uFF0C\u624D\u80FD\u4F7F\u7528\u6B64\u529F\u80FD"),okText:"\u7ACB\u5373\u5B8C\u5584",cancelText:"\u7A0D\u540E\u5B8C\u5584",onOk:function(){Object(_.S)("/account/certification")}}),!1)},R=function(){return Object(v.a)()?!0:(H.a.warning({centered:!0,width:530,title:"\u63D0\u793A",content:k.a.createElement("div",{className:"tc",style:{marginLeft:-38}},k.a.createElement("p",null,"\u626B\u7801\u52A0\u5934\u6B4C\u52A9\u6559\uFF0C\u7533\u8BF7\u64CD\u4F5C\u6743\u9650"),k.a.createElement("img",{src:c.a,width:200})),okText:"\u6211\u77E5\u9053\u4E86",maskClosable:!0}),!1)},O=function(d,l){return d?!0:(H.a.confirm({centered:!0,zIndex:1e4,width:530,title:"\u63D0\u793A",content:k.a.createElement("div",null,k.a.createElement("p",null,l||"\u8BE5\u5B9E\u8DF5\u8D44\u6E90\u9700\u6388\u6743\u540E\u624D\u53EF\u4F7F\u7528\u3002 \u60A8\u53EF\u4EE5\u5728QQ\u670D\u52A1\u7FA4\u5411\u7BA1\u7406\u5458\u7533\u8BF7\uFF0C\u83B7\u5F97\u7EE7\u7EED\u64CD\u4F5C\u7684\u6743\u9650\u3002"),k.a.createElement("div",{style:{marginLeft:"110px"}},k.a.createElement("img",{src:i.a,width:200}),k.a.createElement("div",{style:{marginLeft:"35px"}},"\u7FA4\u53F7\uFF1A","714336072"))),okText:"\u7ACB\u5373\u8054\u7CFB",cancelText:"\u53D6\u6D88",onOk:function(){Object(_.S)("https://qm.qq.com/cgi-bin/qm/qr?k=tIyDPXUtE0yEk-MOJxhH55lTUJS-nYAM&jump_from=webapi")}}),!1)},E=function(d){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",h=Object(D.c)()._store.getState(),g=h.shixunsDetail.detail;return(g==null?void 0:g.public)===2||(g==null?void 0:g.public)===1||(g==null?void 0:g.shixun_status)===3?(H.a.info({centered:!0,icon:k.a.createElement(p.a,{style:{color:"#faad14"}}),width:460,title:"\u63D0\u793A",content:k.a.createElement("div",{className:"tc",style:{marginLeft:-38}},k.a.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",paddingLeft:38,margin:"12px 0"}},k.a.createElement("span",null,"\u8BE5\u5B9E\u8DF5\u9879\u76EE\u7684\u72B6\u6001\u4E3A",(g==null?void 0:g.public)===2?"\u5DF2\u516C\u5F00":(g==null?void 0:g.public)===1?"\u5F85\u5BA1\u6838":"\u5DF2\u5173\u95ED","\uFF0C",l,"\u3002"),k.a.createElement("p",null,"\u5982\u6709\u9700\u8981\uFF0C\u8BF7\u8054\u7CFB\u5E73\u53F0\u7BA1\u7406\u5458\u8FDB\u884C\u6280\u672F\u652F\u6301\u3002")),k.a.createElement("img",{style:{border:"4px solid #0152d9",borderRadius:"4px"},src:u.a,alt:"\u4E8C\u7EF4\u7801",width:160})),okText:"\u6211\u77E5\u9053\u4E86"}),!0):(g==null?void 0:g.shixun_status)===2?(H.a.confirm({centered:!0,icon:k.a.createElement(p.a,null),title:"\u63D0\u793A",content:k.a.createElement("div",null,k.a.createElement("span",null,"\u8BE5\u5B9E\u8DF5\u9879\u76EE\u5DF2\u53D1\u5E03\uFF0C",l,"\u3002"),k.a.createElement("br",null),k.a.createElement("span",null,"\u5982\u6709\u9700\u8981\uFF0C\u60A8\u53EF\u4EE5\u64A4\u9500\u53D1\u5E03\u540E\uFF0C\u518D\u8FDB\u884C\u64CD\u4F5C\u3002")),okText:"\u64A4\u9500\u53D1\u5E03",cancelText:"\u53D6\u6D88",onOk:function(){H.a.confirm({width:440,centered:!0,icon:k.a.createElement(p.a,{style:{color:"#faad14"}}),title:"\u63D0\u793A",content:"\u64A4\u9500\u53D1\u5E03\u540E\uFF0C\u5B66\u5458\u5C06\u65E0\u6CD5\u8FDB\u884C\u7EC3\u4E60\u3002\u662F\u5426\u786E\u8BA4\u64A4\u9500\u53D1\u5E03\uFF1F",okText:"\u786E\u5B9A\u64A4\u9500\u53D1\u5E03",cancelText:"\u53D6\u6D88",onOk:function(){var F=Object(U.a)(Y.a.mark(function W(){var K;return Y.a.wrap(function(x){for(;;)switch(x.prev=x.next){case 0:return x.next=2,d({type:"shixunsDetail/cancelRelease",payload:{id:g==null?void 0:g.identifier}});case 2:K=x.sent,K.status!==401&&(Z.b.success("\u64A4\u9500\u53D1\u5E03\u6210\u529F\u3002\u5B9E\u8BAD\u56DE\u5230\u672A\u53D1\u5E03\u7684\u72B6\u6001\u3002"),d({type:"shixunsDetail/getShixunsDetail",payload:{id:g==null?void 0:g.identifier}}),d({type:"practiceSetting/getCommonData",payload:{id:g==null?void 0:g.identifier}}));case 4:case"end":return x.stop()}},W)}));function N(){return F.apply(this,arguments)}return N}()})}}),!0):!1}},NoGO:function(zt,st,V){zt.exports=V.p+"static/newqrcode.d852fdfc.png"},Nog9:function(zt,st,V){zt.exports={flex_box_center:"flex_box_center___FKAcC",flex_space_between:"flex_space_between___1W0sn",flex_box_vertical_center:"flex_box_vertical_center___1ZtTo",flex_box_center_end:"flex_box_center_end___3Rjsx",flex_box_column:"flex_box_column___3qWVQ",wrap:"wrap___K2ugW",modal:"modal___3Jrop",titleWrap:"titleWrap___2PdmB",required:"required___XbmpK",title:"title___1w-JF",colorGray:"colorGray___2hKRg",choiceWrap:"choiceWrap___3oJpR",answer:"answer___1Kugg",activeAnswer:"activeAnswer___3MPrD",deleteIcon:"deleteIcon___2j8_2",addIcon:"addIcon___2lm8T",editorWrap:"editorWrap___1f48O",htmlWrap:"htmlWrap___2gSXb",radio:"radio___1S16G",color333:"color333___3rZXR",color999:"color999___2xzRf",questionType:"questionType___2l_WF",questionChoices:"questionChoices___hYMa9",action:"action___1DPov",difficult:"difficult___1CZwg",fold:"fold___2FQQU",head:"head___2Es3Y"}},NvD2:function(zt,st,V){"use strict";V.d(st,"a",function(){return M});var ie=V("Kwbf");function Z(Y,X){var k=new Set;return Y.forEach(function(D){X.has(D)||k.add(D)}),k}function U(Y){var X=Y||{},k=X.disabled,D=X.disableCheckbox,v=X.checkable;return!!(k||D)||v===!1}function ee(Y,X,k,D){for(var v=new Set(Y),_=new Set,p=0;p<=k;p+=1){var o=X.get(p)||new Set;o.forEach(function(t){var c=t.key,f=t.node,A=t.children,S=A===void 0?[]:A;v.has(c)&&!D(f)&&S.filter(function(w){return!D(w.node)}).forEach(function(w){v.add(w.key)})})}for(var u=new Set,r=k;r>=0;r-=1){var i=X.get(r)||new Set;i.forEach(function(t){var c=t.parent,f=t.node;if(D(f)||!t.parent||u.has(t.parent.key))return;if(D(t.parent.node)){u.add(c.key);return}var A=!0,S=!1;(c.children||[]).filter(function(w){return!D(w.node)}).forEach(function(w){var R=w.key,O=v.has(R);A&&!O&&(A=!1),!S&&(O||_.has(R))&&(S=!0)}),A&&v.add(c.key),S&&_.add(c.key),u.add(c.key)})}return{checkedKeys:Array.from(v),halfCheckedKeys:Array.from(Z(_,v))}}function H(Y,X,k,D,v){for(var _=new Set(Y),p=new Set(X),o=0;o<=D;o+=1){var u=k.get(o)||new Set;u.forEach(function(c){var f=c.key,A=c.node,S=c.children,w=S===void 0?[]:S;!_.has(f)&&!p.has(f)&&!v(A)&&w.filter(function(R){return!v(R.node)}).forEach(function(R){_.delete(R.key)})})}p=new Set;for(var r=new Set,i=D;i>=0;i-=1){var t=k.get(i)||new Set;t.forEach(function(c){var f=c.parent,A=c.node;if(v(A)||!c.parent||r.has(c.parent.key))return;if(v(c.parent.node)){r.add(f.key);return}var S=!0,w=!1;(f.children||[]).filter(function(R){return!v(R.node)}).forEach(function(R){var O=R.key,E=_.has(O);S&&!E&&(S=!1),!w&&(E||p.has(O))&&(w=!0)}),S||_.delete(f.key),w&&p.add(f.key),r.add(f.key)})}return{checkedKeys:Array.from(_),halfCheckedKeys:Array.from(Z(p,_))}}function M(Y,X,k,D){var v=[],_;D?_=D:_=U;var p=new Set(Y.filter(function(i){var t=!!k[i];return t||v.push(i),t})),o=new Map,u=0;Object.keys(k).forEach(function(i){var t=k[i],c=t.level,f=o.get(c);f||(f=new Set,o.set(c,f)),f.add(t),u=Math.max(u,c)}),Object(ie.a)(!v.length,"Tree missing follow keys: ".concat(v.slice(0,100).map(function(i){return"'".concat(i,"'")}).join(", ")));var r;return X===!0?r=ee(p,o,u,_):r=H(p,X.halfCheckedKeys,o,u,_),r}},O2Wb:function(zt,st,V){zt.exports={flex:"flex___2gmSR",flex1:"flex1___3Tu1g",color666:"color666___2uyGL",error:"error___yJ86W",deleteIcon:"deleteIcon___1D2tg",addIcon:"addIcon___2VIYB"}},OZM5:function(zt,st,V){"use strict";V.d(st,"b",function(){return D}),V.d(st,"a",function(){return v}),V.d(st,"k",function(){return _}),V.d(st,"h",function(){return p}),V.d(st,"i",function(){return o}),V.d(st,"g",function(){return u}),V.d(st,"c",function(){return r}),V.d(st,"d",function(){return i}),V.d(st,"j",function(){return f}),V.d(st,"e",function(){return A}),V.d(st,"f",function(){return S});var ie=V("KQm4"),Z=V("U8pU"),U=V("Ff2n"),ee=V("q1tI"),H=V.n(ee),M=V("Kwbf"),Y=V("WaYH"),X=.25,k=2;function D(w,R){var O=w.slice(),E=O.indexOf(R);return E>=0&&O.splice(E,1),O}function v(w,R){var O=w.slice();return O.indexOf(R)===-1&&O.push(R),O}function _(w){return w.split("-")}function p(w,R){return"".concat(w,"-").concat(R)}function o(w){return w&&w.type&&w.type.isTreeNode}function u(w,R){var O=[w],E=R[w];function y(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];d.forEach(function(l){var h=l.key,g=l.children;O.push(h),y(g)})}return y(E.children),O}function r(w,R){var O=w.clientY,E=R.selectHandle.getBoundingClientRect(),y=E.top,d=E.bottom,l=E.height,h=Math.max(l*X,k);return O<=y+h?-1:O>=d-h?1:0}function i(w,R){if(!w)return;var O=R.multiple;return O?w.slice():w.length?[w[0]]:w}var t=function(R){return R};function c(w,R){if(!w)return[];var O=R||{},E=O.processProps,y=E===void 0?t:E,d=Array.isArray(w)?w:[w];return d.map(function(l){var h=l.children,g=Object(U.a)(l,["children"]),b=c(h,R);return H.a.createElement(Y.a,Object.assign({},y(g)),b)})}function f(w){if(!w)return null;var R;if(Array.isArray(w))R={checkedKeys:w,halfCheckedKeys:void 0};else if(Object(Z.a)(w)==="object")R={checkedKeys:w.checked||void 0,halfCheckedKeys:w.halfChecked||void 0};else return Object(M.a)(!1,"`checkedKeys` is not an array or an object"),null;return R}function A(w,R){var O=new Set;function E(y){if(O.has(y))return;var d=R[y];if(!d)return;O.add(y);var l=d.parent,h=d.node;if(h.disabled)return;l&&E(l.key)}return(w||[]).forEach(function(y){E(y)}),Object(ie.a)(O)}function S(w){var R={};return Object.keys(w).forEach(function(O){(O.startsWith("data-")||O.startsWith("aria-"))&&(R[O]=w[O])}),R}},Ot1p:function(zt,st,V){"use strict";var ie=V("2qtc"),Z=V("kLXV"),U=V("rAM+"),ee=V("miYZ"),H=V("tsqr"),M=V("9og8"),Y=V("tJVT"),X=V("jrin"),k=V("WmNS"),D=V.n(k),v=V("q1tI"),_=V.n(v),p=V("VrN/"),o=V.n(p),u=V("bdgK"),r=V("p77/"),i=V("Bd2K"),t=V("ELLl"),c=V("19Vz"),f=V("lZu9"),A=V("+NIl"),S=V("kSUc"),w=V("9Bee"),R=function(Pe){var it=Pe.value,xt=it===void 0?"":it,$t=Pe.className,mn=Pe.showTextOnly,rn=Pe.showLines,ci=Pe.style,Jn=ci===void 0?{}:ci,Sn=Object(v.useMemo)(function(){return""},[xt]);return _.a.createElement(_.a.Fragment,null,_.a.createElement("div",{dangerouslySetInnerHTML:{__html:Sn}}))},O=V("0Owb"),E=V("dejd"),y=V("C+DQ"),d=V("1vsH"),l=V("m3rI"),h=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function g(Pe){var it=Pe.onActionCallback,xt=Pe.title,$t=Pe.icon,mn=Pe.actionName,rn=Pe.className,ci=rn===void 0?"":rn,Jn=Pe.children;function Sn(){it(mn)}return _.a.createElement("a",{title:xt,className:ci,onClick:Sn},_.a.createElement("i",{className:"md-iconfont ".concat($t)}),Jn)}var b=function(Pe){var it=Pe.watch,xt=Pe.showNullButton,$t=Pe.onActionCallback,mn=Pe.fullScreen,rn=Pe.insertTemp,ci=Pe.hidetoolBar,Jn=Pe.uuid,Sn=Pe.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(d.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(d.F)("_educoder_session"),"&key=").concat(Jn,"&api=").concat(encodeURIComponent(l.a.PROXY_SERVER)));var pi=[].concat(h,[{title:"".concat(it?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(it?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return _.a.createElement("ul",{className:"markdown-toolbar-container"},!ci&&pi.map(function(gi,xi){return _.a.createElement("li",{key:xi},gi.actionName?_.a.createElement(g,Object(O.a)({},gi,{onActionCallback:$t})):_.a.createElement("span",{className:"v-line"}))}),xt?_.a.createElement("li",null,_.a.createElement(g,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:$t},_.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,rn&&_.a.createElement("li",null,_.a.createElement(g,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(rn),onActionCallback:$t},_.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),_.a.createElement("li",{className:"btn-full-screen"},_.a.createElement(g,{icon:"".concat(mn?"icon-shrink":"icon-enlarge"),title:mn?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:$t})))},F=V("M8RZ"),N=V("+L6B"),W=V("2/Rp"),K=V("y8nQ"),I=V("Vl3Y"),x=V("5NDa"),j=V("5rEg"),$={labelCol:{span:4},wrapperCol:{span:20}},ae=function(Pe){var it=Pe.callback,xt=Pe.onCancel;function $t(mn){it(mn)}return _.a.createElement(I.a,Object(O.a)({},$,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:$t}),_.a.createElement(I.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},_.a.createElement(j.a,null)),_.a.createElement(I.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},_.a.createElement(j.a,null)),_.a.createElement("div",{className:"flex-container flex-end"},_.a.createElement(W.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),_.a.createElement(W.a,{type:"ghost",onClick:xt},"\u53D6\u6D88")))},fe=V("7ahc"),pe=V("HmJG"),Ce=V("BjJ7"),De=I.a.useForm,xe={width:280,marginRight:10},Oe={labelCol:{span:5},wrapperCol:{span:19}},Ee=function(Pe){var it=Pe.callback,xt=Pe.onCancel,$t=De(),mn=Object(Y.a)($t,1),rn=mn[0];function ci(pi){it(pi)}function Jn(pi,gi){if(pi.status===-1){H.b.error(pi.message);return}rn.setFieldsValue({src:"/api/attachments/".concat(pi.id),type:gi.type})}function Sn(pi){var gi=pi.target.files[0];te(gi,Jn)}return _.a.createElement(I.a,Object(O.a)({form:rn},Oe,{className:"upload-image-panel",onFinish:ci}),_.a.createElement(I.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},_.a.createElement("div",{className:"flex-container"},_.a.createElement(I.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},_.a.createElement(j.a,{style:xe})),_.a.createElement(be,{onFileChange:Sn}))),_.a.createElement(I.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},_.a.createElement(j.a,{style:{width:264}})),_.a.createElement(I.a.Item,{style:{textAlign:"right"}},_.a.createElement(W.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),_.a.createElement(W.a,{type:"ghost",onClick:xt},"\u53D6\u6D88")))};function be(Pe){var it=Pe.onFileChange;return _.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",_.a.createElement("input",{type:"file",onChange:it}))}function te(Pe,it){if(!Pe)throw new String("\u6CA1\u6709\u6587\u4EF6");var xt=new FormData;xt.append("editormd-image-file",Pe),xt.append("file_param_name","editormd-image-file"),xt.append("byxhr","true");var $t=new window.XMLHttpRequest;$t.withCredentials=!0,$t.addEventListener("load",function(mn){it(JSON.parse(mn.target.responseText),Pe)},!1),$t.addEventListener("error",function(mn){console.error(mn)},!1),$t.open("POST","".concat(Ce.a,"/api/attachments.json")),$t.send(xt)}var me=V("giR+"),ye=V("fyUT"),Le=V("7Kak"),$e=V("9yH6"),Me=$e.a.Group,ze={margin:"0 8px"},ot=function(Pe){var it=Pe.callback,xt=Pe.onCancel;function $t(mn){it(mn)}return _.a.createElement(I.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:$t},_.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},_.a.createElement("span",{style:ze},"\u5355\u5143\u683C\u6570\uFF1A"),_.a.createElement("span",{style:ze},"\u884C\u6570"),_.a.createElement(I.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},_.a.createElement(ye.a,null)),_.a.createElement("span",{style:ze},"\u5217\u6570"),_.a.createElement(I.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},_.a.createElement(ye.a,null))),_.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},_.a.createElement("span",{style:ze},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),_.a.createElement(I.a.Item,{name:"align"},_.a.createElement(Me,null,_.a.createElement($e.a,{value:"default"},_.a.createElement("i",{className:"fa fa-align-justify"})),_.a.createElement($e.a,{value:"left"},_.a.createElement("i",{className:"fa fa-align-left"})),_.a.createElement($e.a,{value:"center"},_.a.createElement("i",{className:"fa fa-align-center"})),_.a.createElement($e.a,{value:"right"},_.a.createElement("i",{className:"fa fa-align-right"}))))),_.a.createElement("div",{className:"flex-container flex-end"},_.a.createElement(W.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),_.a.createElement(W.a,{type:"ghost",onClick:xt},"\u53D6\u6D88")))},Et=V("ErOA"),_t=V("7Cbv"),mt="link",ut="upload-image",Xt="code-block",en="add-table",sn="------------",pn={default:sn,left:":".concat(sn),center:":".concat(sn,":"),right:"".concat(sn,":")},Un=V("9VGf"),Cn,Qe;function Ye(){}var St=0,bt=1e4,nt="\u2581",vt=`
|
|
**\u6A21\u677F\u6807\u9898**
|
|
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function Ue(Pe){return/^\d+$/.test(Pe)?"".concat(Pe,"px"):Pe}var Ae=navigator.platform.toUpperCase().indexOf("MAC")>=0,Re=Ae?"Cmd":"Ctrl",le=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"],he=(Cn={},Object(X.a)(Cn,Re+"-B","bold"),Object(X.a)(Cn,Re+"-I","italic"),Cn),Se=(Qe={},Object(X.a)(Qe,mt,"\u6DFB\u52A0\u94FE\u63A5"),Object(X.a)(Qe,Xt,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(X.a)(Qe,ut,"\u6DFB\u52A0\u6587\u4EF6"),Object(X.a)(Qe,en,"\u6DFB\u52A0\u8868\u683C"),Qe),ve=st.a=function(Pe){var it=Pe.defaultValue,xt=it===void 0?"":it,$t=Pe.onChange,mn=Pe.width,rn=mn===void 0?"100%":mn,ci=Pe.height,Jn=ci===void 0?400:ci,Sn=Pe.miniToolbar,pi=Sn===void 0?!1:Sn,gi=Pe.isFocus,xi=gi===void 0?!1:gi,_i=Pe.watch,Dn=Pe.insertTemp,Ai=Pe.mode,Ln=Ai===void 0?"markdown":Ai,Dt=Pe.id,Qn=Dt===void 0?"markdown-editor-id":Dt,vi=Pe.showResizeBar,hi=vi===void 0?!1:vi,bi=Pe.noStorage,yi=bi===void 0?!1:bi,Fi=Pe.showNullButton,ai=Fi===void 0?!1:Fi,pt=Pe.hidetoolBar,Je=pt===void 0?!1:pt,Ft=Pe.fullScreen,Bt=Ft===void 0?!1:Ft,Fe=Pe.onBlur,ue=Pe.onCMBeforeChange,si=Pe.onFullScreen,je=Pe.className,Be=je===void 0?"":je,Ie=Pe.disablePaste,_e=Ie===void 0?!1:Ie,An=Pe.placeholder,zn=An===void 0?"":An,Pn=Pe.values,Q=Pn===void 0?"":Pn,C=Object(v.useState)(null),L=Object(Y.a)(C,2),z=L[0],oe=L[1],q=Object(v.useState)(xt),ke=Object(Y.a)(q,2),ft=ke[0],kt=ke[1],an=Object(v.useState)(_i),dt=Object(Y.a)(an,2),Pt=dt[0],tn=dt[1],Vn=Object(v.useState)(Bt),fi=Object(Y.a)(Vn,2),Hn=fi[0],Fn=fi[1],Qt=Object(v.useState)(""),hn=Object(Y.a)(Qt,2),on=hn[0],Nt=hn[1],$n=Object(v.useState)(0),jn=Object(Y.a)($n,2),Tn=jn[0],qn=jn[1],En=Object(v.useState)(Jn),In=Object(Y.a)(En,2),gn=In[0],Bn=In[1],Xn=Object(v.useState)(!1),Zn=Object(Y.a)(Xn,2),Kt=Zn[0],Lt=Zn[1],yt=Object(v.useRef)(Object(_t.a)()),It=Object(v.useRef)(!1),Ot=Object(v.useRef)(),Vt=Object(v.useRef)(),Zt=Object(v.useRef)(),Gt=Object(v.useRef)(),Ut=Object(v.useRef)(),vn=function(){var gt=Object(M.a)(D.a.mark(function rt(){var Xe,Ze;return D.a.wrap(function(ct){for(;;)switch(ct.prev=ct.next){case 0:return ct.next=2,Object(Et.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:yt.current}});case 2:Ze=ct.sent,Ze!=null&&(Xe=Ze.attachments)!==null&&Xe!==void 0&&Xe.length&&(console.log("cm:",z,Vt),Ze.attachments.map(function(et){et.content_type.indexOf("image")>-1?z.replaceSelection(".concat(et.content_type,")")):et.content_type.indexOf("video")>-1?z.replaceSelection('<video width="100%" controls src="'.concat(l.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):et.content_type.indexOf("pdf")>-1?z.replaceSelection('<a href="'.concat(l.a.API_SERVER,"/api/attachments/").concat(et.id,"?type=").concat(et.content_type,'&disposition=inline" target="_blank">').concat(et.name,"</a>")):z.replaceSelection("[".concat(et.name,"](").concat(l.a.API_SERVER,"/api/attachments/").concat(et.id,"?type=").concat(et.content_type,")"))}));case 4:case"end":return ct.stop()}},rt)}));return function(){return gt.apply(this,arguments)}}();Object(v.useEffect)(function(){kt(Q),z==null||z.setValue(Q)},[Q]),Object(v.useEffect)(function(){si==null||si(Hn)},[Hn]),Object(v.useEffect)(function(){if(Vt.current){var gt=o.a.fromTextArea(Vt.current,{mode:Ln,lineNumbers:!pi,lineWrapping:!0,value:xt,autoCloseTags:!0,autoCloseBrackets:!0});xi&>.focus();function rt(Xe,Ze){if(_e){Ze.preventDefault();return}var We=Ze.clipboardData;if(We){var ct=We.types.toString(),et=We.items;if(ct==="Files"||We.types.indexOf("Files")>-1){if(Ze.preventDefault(),Ln=="stex")return;try{var Ct,jt=et[1];((Ct=et[0])===null||Ct===void 0?void 0:Ct.kind)==="file"&&(jt=et[0]);var wt=jt.getAsFile(),Jt=wt.name.split(".").pop();te(wt,function(Tt){if(Tt.id){var At,Rn,yn;(wt==null||((At=wt.type)===null||At===void 0)?void 0:At.indexOf("image"))>-1?gt.replaceSelection(".concat(Tt.content_type,")")):(wt==null||((Rn=wt.type)===null||Rn===void 0)?void 0:Rn.indexOf("video"))>-1?gt.replaceSelection('<video width="100%" controls src="'.concat(l.a.API_SERVER,"/api/attachments/").concat(Tt.id,'"></video>')):(wt==null||((yn=wt.type)===null||yn===void 0)?void 0:yn.indexOf("pdf"))>-1?gt.replaceSelection('<a href="'.concat(l.a.API_SERVER,"/api/attachments/").concat(Tt.id,"?type=").concat(wt.type,'&disposition=inline" target="_blank">').concat(wt.name,"</a>")):le.includes(Jt)?gt.replaceSelection('<a href="'.concat(l.a.API_SERVER,"/api/attachments/").concat(Tt.id,'?type=office&disposition=inline" target="_blank">').concat(wt.name,"</a>")):gt.replaceSelection("[".concat(wt.name,"](").concat(l.a.API_SERVER,"/api/attachments/").concat(Tt.id,"?type=").concat(Tt.content_type,")"))}else(Tt==null?void 0:Tt.status)===401&&(document.location.href="/user/login")})}catch(Tt){H.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return gt.on("paste",rt),gt.on("dragleave",function(Xe,Ze){Zt.current.classList.remove("mouse-hover-md")}),gt.on("dragover",function(Xe,Ze){Zt.current.classList.add("mouse-hover-md")}),gt.on("drop",function(Xe,Ze){Zt.current.classList.add("mouse-hover-md");var We;if(We=Ze.dataTransfer.files,We.length>0){Ze.preventDefault(),Ze.stopPropagation();for(var ct=function(jt){var wt=We[jt],Jt=wt.name.split(".").pop();te(wt,function(Tt){if(Tt.id){var At,Rn,yn;(wt==null||((At=wt.type)===null||At===void 0)?void 0:At.indexOf("image"))>-1?gt.replaceSelection(".concat(Tt.content_type,")")):(wt==null||((Rn=wt.type)===null||Rn===void 0)?void 0:Rn.indexOf("video"))>-1?gt.replaceSelection('<video width="100%" controls src="'.concat(l.a.API_SERVER,"/api/attachments/").concat(Tt.id,'"></video>')):(wt==null||((yn=wt.type)===null||yn===void 0)?void 0:yn.indexOf("pdf"))>-1?gt.replaceSelection('<a href="'.concat(l.a.API_SERVER,"/api/attachments/").concat(Tt.id,"?type=").concat(wt.type,'&disposition=inline" target="_blank">').concat(wt.name,"</a>")):le.includes(Jt)?gt.replaceSelection('<a href="'.concat(l.a.API_SERVER,"/api/attachments/").concat(Tt.id,'?type=office&disposition=inline" target="_blank">').concat(wt.name,"</a>")):gt.replaceSelection("[".concat(wt.name,"](").concat(l.a.API_SERVER,"/api/attachments/").concat(Tt.id,"?type=").concat(Tt.content_type,")"))}else(Tt==null?void 0:Tt.status)===401&&(document.location.href="/user/login")})},et=0;et<We.length;et++)ct(et)}}),oe(gt),function(){gt.off("paste",rt)}}},[]);var _n=Object(v.useCallback)(function(){if(Zt.current)try{}catch(gt){console.log(gt,"---- to set md editor body height")}},[gn,Zt,Hn]);Object(v.useEffect)(function(){function gt(){var Xe=new u.default(function(Ze){var We=Object(U.a)(Ze),ct;try{for(We.s();!(ct=We.n()).done;){var et=ct.value;(et.target.offsetHeight>0||et.target.offsetWidth>0)&&(_n(),z.setSize("100%","100%"),z.refresh())}}catch(Ct){We.e(Ct)}finally{We.f()}});return Xe.observe(Vt.current.parentElement),Xe}if(z){var rt=gt();return function(){rt.unobserve(Vt.current.parentElement)}}},[z,_n]),Object(v.useEffect)(function(){if(z){for(var gt=[],rt=function(){var et=Ze[Xe];We=Object(Y.a)(et,2);var Ct=We[0],jt=We[1],wt=Object(X.a)({},Ct,function(){un(jt)});gt.push(wt),z.addKeyMap(wt)},Xe=0,Ze=Object.entries(he);Xe<Ze.length;Xe++){var We;rt()}return Ot.current=setInterval(function(){It.current&&vn()},4e3),function(){clearInterval(Ot.current);var ct=Object(U.a)(gt),et;try{for(ct.s();!(et=ct.n()).done;){var Ct=et.value;z.removeKeyMap(Ct)}}catch(jt){ct.e(jt)}finally{ct.f()}}}},[z]),Object(v.useEffect)(function(){Bt!==Hn&&Fn(Bt)},[Bt]),Object(Un.a)(function(){if(!yi&&Tn>0){var gt=new Date().getTime(),rt=window.sessionStorage.getItem(Qn);gt>=Tn+bt&&(!rt||rt!==ft)&&(window.sessionStorage.setItem(Qn,ft),Lt(!0))}},bt),Object(v.useEffect)(function(){tn(_i)},[z,_i]),Object(v.useEffect)(function(){z&&(xi&&z.focus())},[z,xi]),Object(v.useEffect)(function(){if(Pt&&z){var gt=z.getScrollerElement();function rt(Xe){var Ze=Xe.target;if(Ut.current){var We=Ze.scrollTop/Ze.scrollHeight;Ut.current.scrollTop=Ut.current.scrollHeight*We}}return gt.addEventListener("scroll",rt),function(){gt.removeEventListener("scroll",rt)}}},[z,Pt]),Object(v.useEffect)(function(){if(z&&ue){function gt(rt,Xe){ue(rt,Xe)}return z.on("beforeChange",gt),function(){z.off("beforeChange",gt)}}},[z,ue]),Object(v.useEffect)(function(){if(z&&Fe){function gt(){Fe(z.getValue())}return z.on("blur",gt),function(){z.off("blur",gt)}}},[z,Fe]),Object(v.useEffect)(function(){if(z){function gt(rt){var Xe=rt.getValue();kt(Xe),qn(new Date().getTime()),rt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),$t&&$t(Xe)}return z.on("change",gt),function(){z.off("change",gt)}}},[z,$t]),Object(v.useEffect)(function(){z&&(xt==null?(z.setValue(""),kt("")):xt!==z.getValue()&&(z.setValue(xt),kt(xt),z.setCursor(z.lineCount(),0)))},[z,xt]);var un=Object(v.useCallback)(function(gt){var rt=z.getCursor(),Xe=z.getSelection(),Ze=Xe.split(`
|
|
`);switch(gt){case"bold":return z.replaceSelection("**"+Xe+"**"),Xe===""&&z.setCursor(rt.line,rt.ch+2),z.focus();case"italic":return z.replaceSelection("*"+Xe+"*"),Xe===""&&z.setCursor(rt.line,rt.ch+1),z.focus();case"code":return z.replaceSelection("`"+Xe+"`"),Xe===""&&z.setCursor(rt.line,rt.ch+1),z.focus();case"inline-latex":return z.replaceSelection("`$$"+Xe+"$$`"),Xe===""&&z.setCursor(rt.line,rt.ch+3),z.focus();case"latex":return z.replaceSelection("```latex\n"+Xe+"\n```"),z.setCursor(rt.line+1,Xe.length+1),z.focus();case"line-break":return z.replaceSelection(`<br/>
|
|
`),z.focus();case"list-ul":return Xe===""?z.replaceSelection("- "+Xe):z.replaceSelection(Ze.map(function(We){return We===""?"":"- ".concat(We)}).join(`
|
|
`)),z.focus();case"list-ol":return Xe===""?z.replaceSelection("1. "+Xe):z.replaceSelection(Ze.map(function(We,ct){return We===""?"":"".concat(ct+1,". ").concat(We)}).join(`
|
|
`)),z.focus();case"add-null-ch":return Xe===""&&z.setCursor(rt.line,rt.ch+1),z.replaceSelection(nt),z.focus();case"inster-template-1":return Xe===""&&z.setCursor(rt.line,rt.ch),z.replaceSelection(vt),z.focus();case"eraser":return z.setValue(""),z.focus();case"trigger-watch":return tn(!Pt),z.focus();case"trigger-full-screen":return Fn(!Hn),z.focus();case mt:Nt(mt);return;case Xt:Nt(Xt);return;case ut:Nt(ut);return;case en:Nt(en);return;default:throw new Error}},[z,Pt,Hn]),cn=Object(v.useCallback)(function(gt){Nt("");switch(on){case mt:var rt=gt.title,Xe=gt.link;return z.replaceSelection("[".concat(rt,"](").concat(Xe,")")),z.focus();case Xt:var Ze=gt.language,We=gt.content;return z.replaceSelection(["```"+Ze,We,"```"].join(`
|
|
`)),z.focus();case ut:var ct=gt.src,et=gt.alt;return et?z.replaceSelection(".concat(ct,' "').concat(et,'" )')):z.replaceSelection("")),z.focus();case en:for(var Ct=gt.row,jt=gt.col,wt=gt.align,Jt=`
|
|
`,Tt=0;Tt<Ct;Tt++){for(var At=[],Rn=[],yn=0;yn<jt;yn++)Tt===1&&Rn.push(pn[wt]),At.push(" ");Tt===1&&(Jt+="| ".concat(Rn.join(" | "),` |
|
|
`)),Jt+="| ".concat(At.join(jt===1?"":" | "),` |
|
|
`)}return z.replaceSelection(Jt+`
|
|
`),z.focus();default:throw new Error}},[z,on]),bn=Object(v.useMemo)(function(){switch(on){case mt:return _.a.createElement(ae,{callback:cn,onCancel:dn});case Xt:return _.a.createElement(fe.b,{callback:cn,onCancel:dn});case ut:return _.a.createElement(Ee,{callback:cn,onCancel:dn});case en:return _.a.createElement(ot,{callback:cn,onCancel:dn});default:return null}},[on]);function dn(){Nt("")}Object(v.useEffect)(function(){if(Gt.current){var gt=Gt.current,rt=!1,Xe=0;function Ze(et){rt=!0,Xe=et.pageY}function We(){rt=!1}function ct(et){if(rt){var Ct=et.pageY-Xe;Ct<0&&(Ct=0),Ct>300&&(Ct=300);var jt=Jn+Ct+"px";Bn(jt)}}return gt.addEventListener("mousedown",Ze),document.addEventListener("mousemove",ct),document.addEventListener("mouseup",We),function(){gt.removeEventListener("mousedown",Ze),document.removeEventListener("mousemove",ct),document.removeEventListener("mouseup",We)}}},[z,Gt]),Object(v.useEffect)(function(){Bn(Jn)},[Jn]);var Mt=Ue(rn),Yt=Ue(gn),qt={width:Mt,height:Yt},Wt=Object(v.useMemo)(function(){if(Tn){var gt=new Date(Tn),rt=gt.getHours(),Xe=gt.getMinutes(),Ze=gt.getSeconds();return rt=rt<10?"0"+rt:rt,Xe=Xe<10?"0"+Xe:Xe,Ze=Ze<10?"0"+Ze:Ze,"".concat(rt,":").concat(Xe,":").concat(Ze)}return 0},[Tn]);function fn(){window.sessionStorage.removeItem(Qn),Lt(!1),qn(0)}function On(){Lt(!1),qn(0),z.setValue(window.sessionStorage.getItem(Qn))}function wn(gt,rt){var Xe=z.getValue();Xe=Xe.replace(gt,rt),kt(Xe),z==null||z.setValue(Xe)}return _.a.createElement(v.Fragment,null,_.a.createElement("div",{className:"markdown-editor-wrapper",ref:Zt},_.a.createElement("div",{className:"markdown-editor-container ".concat(Be," ").concat(Pt?"on-preview":""," ").concat(pi?"mini":""," ").concat(Hn?"full-screen":""),style:qt},_.a.createElement(b,{insertTemp:Dn,watch:Pt,fullScreen:Hn,showNullButton:ai,onActionCallback:un,hidetoolBar:Je,uuid:yt.current,setOpenPhones:function(){It.current=!0}}),_.a.createElement("div",{className:"markdown-editor-body"},_.a.createElement("div",{className:"codemirror-container"},_.a.createElement("textarea",{ref:Vt,placeholder:zn})),Pt?_.a.createElement("div",{ref:Ut,className:"preview-container"},Ln==="stex"&&_.a.createElement(R,{value:ft}),Ln!=="stex"&&_.a.createElement(w.a,{edit:!0,value:ft,replaces:wn})):null))),hi?_.a.createElement("a",{ref:Gt,className:"editor-resize"}):null,_.a.createElement(F.a,null,Se[on]?_.a.createElement(Z.a,{centered:!0,title:Se[on],visible:!0,onCancel:dn,footer:null,className:"markdown-popup-form"},bn):null))}},RxwV:function(zt,st,V){"use strict";var ie=V("q1tI"),Z=V("uciX"),U=V("2W6z"),ee=V.n(U),H=V("4IlW"),M=V("uK0f"),Y=V.n(M);function X(xe,Oe){if(xe===Oe)return!0;if(!xe||!Oe)return!1;var Ee=xe.length;if(Oe.length!==Ee)return!1;for(var be=0;be<Ee;be++)if(xe[be]!==Oe[be])return!1;return!0}function k(xe){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?k=function(Ee){return typeof Ee}:k=function(Ee){return Ee&&typeof Symbol=="function"&&Ee.constructor===Symbol&&Ee!==Symbol.prototype?"symbol":typeof Ee},k(xe)}function D(xe,Oe){if(!(xe instanceof Oe))throw new TypeError("Cannot call a class as a function")}function v(xe,Oe){for(var Ee=0;Ee<Oe.length;Ee++){var be=Oe[Ee];be.enumerable=be.enumerable||!1,be.configurable=!0,"value"in be&&(be.writable=!0),Object.defineProperty(xe,be.key,be)}}function _(xe,Oe,Ee){return Oe&&v(xe.prototype,Oe),Ee&&v(xe,Ee),xe}function p(xe,Oe){if(typeof Oe!="function"&&Oe!==null)throw new TypeError("Super expression must either be null or a function");xe.prototype=Object.create(Oe&&Oe.prototype,{constructor:{value:xe,writable:!0,configurable:!0}}),Oe&&o(xe,Oe)}function o(xe,Oe){return o=Object.setPrototypeOf||function(be,te){return be.__proto__=te,be},o(xe,Oe)}function u(xe){var Oe=t();return function(){var Ee=c(xe),be;if(Oe){var te=c(this).constructor;be=Reflect.construct(Ee,arguments,te)}else be=Ee.apply(this,arguments);return r(this,be)}}function r(xe,Oe){return Oe&&(k(Oe)==="object"||typeof Oe=="function")?Oe:i(xe)}function i(xe){if(xe===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return xe}function t(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(xe){return!1}}function c(xe){return c=Object.setPrototypeOf?Object.getPrototypeOf:function(Ee){return Ee.__proto__||Object.getPrototypeOf(Ee)},c(xe)}var f=function(){var xe=function(Oe){p(be,Oe);var Ee=u(be);function be(){var te;return D(this,be),te=Ee.apply(this,arguments),te.menuItems={},te.saveMenuItem=function(me){return function(ye){te.menuItems[me]=ye}},te}return _(be,[{key:"componentDidMount",value:function(){this.scrollActiveItemToView()}},{key:"componentDidUpdate",value:function(me){!me.visible&&this.props.visible&&this.scrollActiveItemToView()}},{key:"getFieldName",value:function(me){var ye=this.props,Le=ye.fieldNames,$e=ye.defaultFieldNames;return Le[me]||$e[me]}},{key:"getOption",value:function(me,ye){var Le=this.props,$e=Le.prefixCls,Me=Le.expandTrigger,ze=Le.expandIcon,ot=Le.loadingIcon,Et=this.props.onSelect.bind(this,me,ye),_t=this.props.onItemDoubleClick.bind(this,me,ye),mt={onClick:Et,onDoubleClick:_t},ut="".concat($e,"-menu-item"),Xt=null,en=me[this.getFieldName("children")]&&me[this.getFieldName("children")].length>0;(en||me.isLeaf===!1)&&(ut+=" ".concat($e,"-menu-item-expand"),me.loading||(Xt=ie.createElement("span",{className:"".concat($e,"-menu-item-expand-icon")},ze))),Me==="hover"&&(en||me.isLeaf===!1)&&(mt={onMouseEnter:this.delayOnSelect.bind(this,Et),onMouseLeave:this.delayOnSelect.bind(this),onClick:Et}),this.isActiveOption(me,ye)&&(ut+=" ".concat($e,"-menu-item-active"),mt.ref=this.saveMenuItem(ye)),me.disabled&&(ut+=" ".concat($e,"-menu-item-disabled"));var sn=null;me.loading&&(ut+=" ".concat($e,"-menu-item-loading"),sn=ot||null);var pn="";return"title"in me?pn=me.title:typeof me[this.getFieldName("label")]=="string"&&(pn=me[this.getFieldName("label")]),ie.createElement("li",Object.assign({key:me[this.getFieldName("value")],className:ut,title:pn},mt,{role:"menuitem",onMouseDown:function(Cn){return Cn.preventDefault()}}),me[this.getFieldName("label")],Xt,sn)}},{key:"getActiveOptions",value:function(me){var ye=this,Le=this.props.options,$e=me||this.props.activeValue;return Y()(Le,function(Me,ze){return Me[ye.getFieldName("value")]===$e[ze]},{childrenKeyName:this.getFieldName("children")})}},{key:"getShowOptions",value:function(){var me=this,ye=this.props.options,Le=this.getActiveOptions().map(function($e){return $e[me.getFieldName("children")]}).filter(function($e){return!!$e});return Le.unshift(ye),Le}},{key:"delayOnSelect",value:function(me){for(var ye=this,Le=arguments.length,$e=new Array(Le>1?Le-1:0),Me=1;Me<Le;Me++)$e[Me-1]=arguments[Me];this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null),typeof me=="function"&&(this.delayTimer=window.setTimeout(function(){me($e),ye.delayTimer=null},150))}},{key:"scrollActiveItemToView",value:function(){for(var me=this.getShowOptions().length,ye=0;ye<me;ye++){var Le=this.menuItems[ye];Le&&Le.parentElement&&(Le.parentElement.scrollTop=Le.offsetTop)}}},{key:"isActiveOption",value:function(me,ye){var Le=this.props.activeValue,$e=Le===void 0?[]:Le;return $e[ye]===me[this.getFieldName("value")]}},{key:"render",value:function(){var me=this,ye=this.props,Le=ye.prefixCls,$e=ye.dropdownMenuColumnStyle;return ie.createElement("div",null,this.getShowOptions().map(function(Me,ze){return ie.createElement("ul",{className:"".concat(Le,"-menu"),key:ze,style:$e},Me.map(function(ot){return me.getOption(ot,ze)}))}))}}]),be}(ie.Component);return xe.defaultProps={options:[],value:[],activeValue:[],onSelect:function(){},prefixCls:"rc-cascader-menus",visible:!1,expandTrigger:"click"},xe}(),A=f,S={bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},topLeft:{points:["bl","tl"],offset:[0,-4],overflow:{adjustX:1,adjustY:1}},bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},topRight:{points:["br","tr"],offset:[0,-4],overflow:{adjustX:1,adjustY:1}}},w=S;function R(xe){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?R=function(Ee){return typeof Ee}:R=function(Ee){return Ee&&typeof Symbol=="function"&&Ee.constructor===Symbol&&Ee!==Symbol.prototype?"symbol":typeof Ee},R(xe)}function O(xe,Oe){if(xe==null)return{};var Ee=E(xe,Oe),be,te;if(Object.getOwnPropertySymbols){var me=Object.getOwnPropertySymbols(xe);for(te=0;te<me.length;te++){if(be=me[te],Oe.indexOf(be)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(xe,be))continue;Ee[be]=xe[be]}}return Ee}function E(xe,Oe){if(xe==null)return{};var Ee={},be=Object.keys(xe),te,me;for(me=0;me<be.length;me++){if(te=be[me],Oe.indexOf(te)>=0)continue;Ee[te]=xe[te]}return Ee}function y(xe){return g(xe)||h(xe)||l(xe)||d()}function d(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function l(xe,Oe){if(!xe)return;if(typeof xe=="string")return b(xe,Oe);var Ee=Object.prototype.toString.call(xe).slice(8,-1);if(Ee==="Object"&&xe.constructor&&(Ee=xe.constructor.name),Ee==="Map"||Ee==="Set")return Array.from(xe);if(Ee==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Ee))return b(xe,Oe)}function h(xe){if(typeof Symbol!="undefined"&&Symbol.iterator in Object(xe))return Array.from(xe)}function g(xe){if(Array.isArray(xe))return b(xe)}function b(xe,Oe){(Oe==null||Oe>xe.length)&&(Oe=xe.length);for(var Ee=0,be=new Array(Oe);Ee<Oe;Ee++)be[Ee]=xe[Ee];return be}function F(xe,Oe){if(!(xe instanceof Oe))throw new TypeError("Cannot call a class as a function")}function N(xe,Oe){for(var Ee=0;Ee<Oe.length;Ee++){var be=Oe[Ee];be.enumerable=be.enumerable||!1,be.configurable=!0,"value"in be&&(be.writable=!0),Object.defineProperty(xe,be.key,be)}}function W(xe,Oe,Ee){return Oe&&N(xe.prototype,Oe),Ee&&N(xe,Ee),xe}function K(xe,Oe){if(typeof Oe!="function"&&Oe!==null)throw new TypeError("Super expression must either be null or a function");xe.prototype=Object.create(Oe&&Oe.prototype,{constructor:{value:xe,writable:!0,configurable:!0}}),Oe&&I(xe,Oe)}function I(xe,Oe){return I=Object.setPrototypeOf||function(be,te){return be.__proto__=te,be},I(xe,Oe)}function x(xe){var Oe=ae();return function(){var Ee=fe(xe),be;if(Oe){var te=fe(this).constructor;be=Reflect.construct(Ee,arguments,te)}else be=Ee.apply(this,arguments);return j(this,be)}}function j(xe,Oe){return Oe&&(R(Oe)==="object"||typeof Oe=="function")?Oe:$(xe)}function $(xe){if(xe===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return xe}function ae(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(xe){return!1}}function fe(xe){return fe=Object.setPrototypeOf?Object.getPrototypeOf:function(Ee){return Ee.__proto__||Object.getPrototypeOf(Ee)},fe(xe)}var pe=function(){var xe=function(Oe){K(be,Oe);var Ee=x(be);function be(te){var me;F(this,be),me=Ee.call(this,te),me.setPopupVisible=function(Le){var $e=me.state.value;"popupVisible"in me.props||me.setState({popupVisible:Le}),Le&&!me.state.popupVisible&&me.setState({activeValue:$e}),me.props.onPopupVisibleChange(Le)},me.handleChange=function(Le,$e,Me){var ze=$e.visible;(Me.type!=="keydown"||Me.keyCode===H.a.ENTER)&&(me.props.onChange(Le.map(function(ot){return ot[me.getFieldName("value")]}),Le),me.setPopupVisible(ze))},me.handlePopupVisibleChange=function(Le){me.setPopupVisible(Le)},me.handleMenuSelect=function(Le,$e,Me){var ze=me.trigger.getRootDomNode();ze&&ze.focus&&ze.focus();var ot=me.props,Et=ot.changeOnSelect,_t=ot.loadData,mt=ot.expandTrigger;if(!Le||Le.disabled)return;var ut=me.state.activeValue;ut=ut.slice(0,$e+1),ut[$e]=Le[me.getFieldName("value")];var Xt=me.getActiveOptions(ut);if(Le.isLeaf===!1&&!Le[me.getFieldName("children")]&&_t){Et&&me.handleChange(Xt,{visible:!0},Me),me.setState({activeValue:ut}),_t(Xt);return}var en={};!Le[me.getFieldName("children")]||!Le[me.getFieldName("children")].length?(me.handleChange(Xt,{visible:!1},Me),en.value=ut):Et&&(Me.type==="click"||Me.type==="keydown")&&(mt==="hover"?me.handleChange(Xt,{visible:!1},Me):me.handleChange(Xt,{visible:!0},Me),en.value=ut),en.activeValue=ut,("value"in me.props||Me.type==="keydown"&&Me.keyCode!==H.a.ENTER)&&delete en.value,me.setState(en)},me.handleItemDoubleClick=function(){var Le=me.props.changeOnSelect;Le&&me.setPopupVisible(!1)},me.handleKeyDown=function(Le){var $e=me.props.children;if($e&&$e.props.onKeyDown){$e.props.onKeyDown(Le);return}var Me=y(me.state.activeValue),ze=Me.length-1<0?0:Me.length-1,ot=me.getCurrentLevelOptions(),Et=ot.map(function(Xt){return Xt[me.getFieldName("value")]}).indexOf(Me[ze]);if(Le.keyCode!==H.a.DOWN&&Le.keyCode!==H.a.UP&&Le.keyCode!==H.a.LEFT&&Le.keyCode!==H.a.RIGHT&&Le.keyCode!==H.a.ENTER&&Le.keyCode!==H.a.SPACE&&Le.keyCode!==H.a.BACKSPACE&&Le.keyCode!==H.a.ESC&&Le.keyCode!==H.a.TAB)return;if(!me.state.popupVisible&&Le.keyCode!==H.a.BACKSPACE&&Le.keyCode!==H.a.LEFT&&Le.keyCode!==H.a.RIGHT&&Le.keyCode!==H.a.ESC&&Le.keyCode!==H.a.TAB){me.setPopupVisible(!0);return}if(Le.keyCode===H.a.DOWN||Le.keyCode===H.a.UP){Le.preventDefault();var _t=Et;_t!==-1?Le.keyCode===H.a.DOWN?(_t+=1,_t=_t>=ot.length?0:_t):(_t-=1,_t=_t<0?ot.length-1:_t):_t=0,Me[ze]=ot[_t][me.getFieldName("value")]}else if(Le.keyCode===H.a.LEFT||Le.keyCode===H.a.BACKSPACE)Le.preventDefault(),Me.splice(Me.length-1,1);else if(Le.keyCode===H.a.RIGHT)Le.preventDefault(),ot[Et]&&ot[Et][me.getFieldName("children")]&&Me.push(ot[Et][me.getFieldName("children")][0][me.getFieldName("value")]);else if(Le.keyCode===H.a.ESC||Le.keyCode===H.a.TAB){me.setPopupVisible(!1);return}(!Me||Me.length===0)&&me.setPopupVisible(!1);var mt=me.getActiveOptions(Me),ut=mt[mt.length-1];me.handleMenuSelect(ut,mt.length-1,Le),me.props.onKeyDown&&me.props.onKeyDown(Le)},me.saveTrigger=function(Le){me.trigger=Le};var ye=[];return"value"in te?ye=te.value||[]:"defaultValue"in te&&(ye=te.defaultValue||[]),ee()(!("filedNames"in te),"`filedNames` of Cascader is a typo usage and deprecated, please use `fieldNames` instead."),me.state={popupVisible:te.popupVisible,activeValue:ye,value:ye,prevProps:te},me.defaultFieldNames={label:"label",value:"value",children:"children"},me}return W(be,[{key:"getPopupDOMNode",value:function(){return this.trigger.getPopupDomNode()}},{key:"getFieldName",value:function(me){var ye=this.defaultFieldNames,Le=this.props,$e=Le.fieldNames,Me=Le.filedNames;return"filedNames"in this.props?Me[me]||ye[me]:$e[me]||ye[me]}},{key:"getFieldNames",value:function(){var me=this.props,ye=me.fieldNames,Le=me.filedNames;return"filedNames"in this.props?Le:ye}},{key:"getCurrentLevelOptions",value:function(){var me=this,ye=this.props.options,Le=ye===void 0?[]:ye,$e=this.state.activeValue,Me=$e===void 0?[]:$e,ze=Y()(Le,function(ot,Et){return ot[me.getFieldName("value")]===Me[Et]},{childrenKeyName:this.getFieldName("children")});return ze[ze.length-2]?ze[ze.length-2][this.getFieldName("children")]:y(Le).filter(function(ot){return!ot.disabled})}},{key:"getActiveOptions",value:function(me){var ye=this;return Y()(this.props.options||[],function(Le,$e){return Le[ye.getFieldName("value")]===me[$e]},{childrenKeyName:this.getFieldName("children")})}},{key:"render",value:function(){var me=this.props,ye=me.prefixCls,Le=me.transitionName,$e=me.popupClassName,Me=me.options,ze=Me===void 0?[]:Me,ot=me.disabled,Et=me.builtinPlacements,_t=me.popupPlacement,mt=me.children,ut=me.dropdownRender,Xt=O(me,["prefixCls","transitionName","popupClassName","options","disabled","builtinPlacements","popupPlacement","children","dropdownRender"]),en=ie.createElement("div",null),sn="";ze&&ze.length>0?en=ie.createElement(A,Object.assign({},this.props,{fieldNames:this.getFieldNames(),defaultFieldNames:this.defaultFieldNames,activeValue:this.state.activeValue,onSelect:this.handleMenuSelect,onItemDoubleClick:this.handleItemDoubleClick,visible:this.state.popupVisible})):sn=" ".concat(ye,"-menus-empty");var pn=en;return ut&&(pn=ut(en)),ie.createElement(Z.a,Object.assign({ref:this.saveTrigger},Xt,{popupPlacement:_t,builtinPlacements:Et,popupTransitionName:Le,action:ot?[]:["click"],popupVisible:ot?!1:this.state.popupVisible,onPopupVisibleChange:this.handlePopupVisibleChange,prefixCls:"".concat(ye,"-menus"),popupClassName:$e+sn,popup:pn}),ie.cloneElement(mt,{onKeyDown:this.handleKeyDown,tabIndex:ot?void 0:0}))}}],[{key:"getDerivedStateFromProps",value:function(me,ye){var Le=ye.prevProps,$e=Le===void 0?{}:Le,Me={prevProps:me};return"value"in me&&!X($e.value,me.value)&&(Me.value=me.value||[],"loadData"in me||(Me.activeValue=me.value||[])),"popupVisible"in me&&(Me.popupVisible=me.popupVisible),Me}}]),be}(ie.Component);return xe.defaultProps={onChange:function(){},onPopupVisibleChange:function(){},disabled:!1,transitionName:"",prefixCls:"rc-cascader",popupClassName:"",popupPlacement:"bottomLeft",builtinPlacements:w,expandTrigger:"click",fieldNames:{label:"label",value:"value",children:"children"},expandIcon:">"},xe}(),Ce=pe,De=st.a=Ce},"SA+Z":function(zt,st,V){var ie=V("wTVA"),Z=V("EbDI"),U=V("ZhPi"),ee=V("wkBT");function H(M){return ie(M)||Z(M)||U(M)||ee()}zt.exports=H,zt.exports.__esModule=!0,zt.exports.default=zt.exports},SJMd:function(zt,st){/**
|
|
* @license
|
|
* Copyright (C) 2006 Google Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var V,ie,Z,U=!1,ee,H;window.PR_SHOULD_USE_CONTINUATION=!0;var M,Y;(function(){var X=window,k=["break,continue,do,else,for,if,return,while"],D=[k,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],v=[D,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],_=[v,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],p=[v,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],o=[v,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],u="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",r=[v,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],i="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",t=[k,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],c=[k,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],f=[k,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],A=[_,o,p,r,i,t,c,f],S=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,w="str",R="kwd",O="com",E="typ",y="lit",d="pun",l="pln",h="tag",g="dec",b="src",F="atn",N="atv",W="nocode",K="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function I(Me){for(var ze=0,ot=!1,Et=!1,_t=0,mt=Me.length;_t<mt;++_t){var ut=Me[_t];if(ut.ignoreCase)Et=!0;else if(/[a-z]/i.test(ut.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){ot=!0,Et=!1;break}}var Xt={b:8,t:9,n:10,v:11,f:12,r:13};function en(Qe){var Ye=Qe.charCodeAt(0);if(Ye!==92)return Ye;var St=Qe.charAt(1);return Ye=Xt[St],Ye||("0"<=St&&St<="7"?parseInt(Qe.substring(1),8):St==="u"||St==="x"?parseInt(Qe.substring(2),16):Qe.charCodeAt(1))}function sn(Qe){if(Qe<32)return(Qe<16?"\\x0":"\\x")+Qe.toString(16);var Ye=String.fromCharCode(Qe);return Ye==="\\"||Ye==="-"||Ye==="]"||Ye==="^"?"\\"+Ye:Ye}function pn(Qe){var Ye=Qe.substring(1,Qe.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),St=[],bt=Ye[0]==="^",nt=["["];bt&&nt.push("^");for(var vt=bt?1:0,Ue=Ye.length;vt<Ue;++vt){var Ae=Ye[vt];if(/\\[bdsw]/i.test(Ae))nt.push(Ae);else{var Re=en(Ae),le;vt+2<Ue&&Ye[vt+1]==="-"?(le=en(Ye[vt+2]),vt+=2):le=Re,St.push([Re,le]),le<65||Re>122||(le<65||Re>90||St.push([Math.max(65,Re)|32,Math.min(le,90)|32]),le<97||Re>122||St.push([Math.max(97,Re)&~32,Math.min(le,122)&~32]))}}St.sort(function(Pe,it){return Pe[0]-it[0]||it[1]-Pe[1]});for(var he=[],Se=[],vt=0;vt<St.length;++vt){var ve=St[vt];ve[0]<=Se[1]+1?Se[1]=Math.max(Se[1],ve[1]):he.push(Se=ve)}for(var vt=0;vt<he.length;++vt){var ve=he[vt];nt.push(sn(ve[0])),ve[1]>ve[0]&&(ve[1]+1>ve[0]&&nt.push("-"),nt.push(sn(ve[1])))}return nt.push("]"),nt.join("")}function Un(Qe){for(var Ye=Qe.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),St=Ye.length,bt=[],nt=0,vt=0;nt<St;++nt){var Ue=Ye[nt];if(Ue==="(")++vt;else if(Ue.charAt(0)==="\\"){var Ae=+Ue.substring(1);Ae&&(Ae<=vt?bt[Ae]=-1:Ye[nt]=sn(Ae))}}for(var nt=1;nt<bt.length;++nt)bt[nt]===-1&&(bt[nt]=++ze);for(var nt=0,vt=0;nt<St;++nt){var Ue=Ye[nt];if(Ue==="(")++vt,bt[vt]||(Ye[nt]="(?:");else if(Ue.charAt(0)==="\\"){var Ae=+Ue.substring(1);Ae&&Ae<=vt&&(Ye[nt]="\\"+bt[Ae])}}for(var nt=0;nt<St;++nt)Ye[nt]==="^"&&Ye[nt+1]!=="^"&&(Ye[nt]="");if(Qe.ignoreCase&&ot)for(var nt=0;nt<St;++nt){var Ue=Ye[nt],Re=Ue.charAt(0);Ue.length>=2&&Re==="["?Ye[nt]=pn(Ue):Re!=="\\"&&(Ye[nt]=Ue.replace(/[a-zA-Z]/g,function(Se){var ve=Se.charCodeAt(0);return"["+String.fromCharCode(ve&~32,ve|32)+"]"}))}return Ye.join("")}for(var Cn=[],_t=0,mt=Me.length;_t<mt;++_t){var ut=Me[_t];if(ut.global||ut.multiline)throw new Error(""+ut);Cn.push("(?:"+Un(ut)+")")}return new RegExp(Cn.join("|"),Et?"gi":"g")}function x(Me,ze){var ot=/(?:^|\s)nocode(?:\s|$)/,Et=[],_t=0,mt=[],ut=0;function Xt(en){var sn=en.nodeType;if(sn==1){if(ot.test(en.className))return;for(var pn=en.firstChild;pn;pn=pn.nextSibling)Xt(pn);var Un=en.nodeName.toLowerCase();(Un==="br"||Un==="li")&&(Et[ut]=`
|
|
`,mt[ut<<1]=_t++,mt[ut++<<1|1]=en)}else if(sn==3||sn==4){var Cn=en.nodeValue;Cn.length&&(ze?Cn=Cn.replace(/\r\n?/g,`
|
|
`):Cn=Cn.replace(/[ \t\r\n]+/g," "),Et[ut]=Cn,mt[ut<<1]=_t,_t+=Cn.length,mt[ut++<<1|1]=en)}}return Xt(Me),{sourceCode:Et.join("").replace(/\n$/,""),spans:mt}}function j(Me,ze,ot,Et,_t){if(!ot)return;var mt={sourceNode:Me,pre:1,langExtension:null,numberLines:null,sourceCode:ot,spans:null,basePos:ze,decorations:null};Et(mt),_t.push.apply(_t,mt.decorations)}var $=/\S/;function ae(Me){for(var ze=void 0,ot=Me.firstChild;ot;ot=ot.nextSibling){var Et=ot.nodeType;ze=Et===1?ze?Me:ot:Et===3&&$.test(ot.nodeValue)?Me:ze}return ze===Me?void 0:ze}function fe(Me,ze){var ot={},Et;(function(){for(var ut=Me.concat(ze),Xt=[],en={},sn=0,pn=ut.length;sn<pn;++sn){var Un=ut[sn],Cn=Un[3];if(Cn)for(var Qe=Cn.length;--Qe>=0;)ot[Cn.charAt(Qe)]=Un;var Ye=Un[1],St=""+Ye;en.hasOwnProperty(St)||(Xt.push(Ye),en[St]=null)}Xt.push(/[\0-\uffff]/),Et=I(Xt)})();var _t=ze.length,mt=function(ut){for(var Xt=ut.sourceCode,en=ut.basePos,sn=ut.sourceNode,pn=[en,l],Un=0,Cn=Xt.match(Et)||[],Qe={},Ye=0,St=Cn.length;Ye<St;++Ye){var bt=Cn[Ye],nt=Qe[bt],vt=void 0,Ue;if(typeof nt=="string")Ue=!1;else{var Ae=ot[bt.charAt(0)];if(Ae)vt=bt.match(Ae[1]),nt=Ae[0];else{for(var Re=0;Re<_t;++Re)if(Ae=ze[Re],vt=bt.match(Ae[1]),vt){nt=Ae[0];break}vt||(nt=l)}Ue=nt.length>=5&&nt.substring(0,5)==="lang-",Ue&&!(vt&&typeof vt[1]=="string")&&(Ue=!1,nt=b),Ue||(Qe[bt]=nt)}var le=Un;if(Un+=bt.length,!Ue)pn.push(en+le,nt);else{var he=vt[1],Se=bt.indexOf(he),ve=Se+he.length;vt[2]&&(ve=bt.length-vt[2].length,Se=ve-he.length);var Pe=nt.substring(5);j(sn,en+le,bt.substring(0,Se),mt,pn),j(sn,en+le+Se,he,be(Pe,he),pn),j(sn,en+le+ve,bt.substring(ve),mt,pn)}}ut.decorations=pn};return mt}function pe(Me){var ze=[],ot=[];Me.tripleQuotedStrings?ze.push([w,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Me.multiLineStrings?ze.push([w,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):ze.push([w,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Me.verbatimStrings&&ot.push([w,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Et=Me.hashComments;Et&&(Me.cStyleComments?(Et>1?ze.push([O,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):ze.push([O,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),ot.push([w,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):ze.push([O,/^#[^\r\n]*/,null,"#"])),Me.cStyleComments&&(ot.push([O,/^\/\/[^\r\n]*/,null]),ot.push([O,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var _t=Me.regexLiterals;if(_t){var mt=_t>1?"":`
|
|
\r`,ut=mt?".":"[\\S\\s]",Xt="/(?=[^/*"+mt+"])(?:[^/\\x5B\\x5C"+mt+"]|\\x5C"+ut+"|\\x5B(?:[^\\x5C\\x5D"+mt+"]|\\x5C"+ut+")*(?:\\x5D|$))+/";ot.push(["lang-regex",RegExp("^"+K+"("+Xt+")")])}var en=Me.types;en&&ot.push([E,en]);var sn=(""+Me.keywords).replace(/^ | $/g,"");sn.length&&ot.push([R,new RegExp("^(?:"+sn.replace(/[\s,]+/g,"|")+")\\b"),null]),ze.push([l,/^\s+/,null,` \r
|
|
\xA0`]);var pn="^.[^\\s\\w.$@'\"`/\\\\]*";return Me.regexLiterals&&(pn+="(?!s*/)"),ot.push([y,/^@[a-z_$][a-z_$@0-9]*/i,null],[E,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[l,/^[a-z_$][a-z_$@0-9]*/i,null],[y,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[l,/^\\[\s\S]?/,null],[d,new RegExp(pn),null]),fe(ze,ot)}var Ce=pe({keywords:A,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function De(Me,ze,ot){for(var Et=/(?:^|\s)nocode(?:\s|$)/,_t=/\r\n?|\n/,mt=Me.ownerDocument,ut=mt.createElement("li");Me.firstChild;)ut.appendChild(Me.firstChild);var Xt=[ut];function en(Ye){var St=Ye.nodeType;if(St==1&&!Et.test(Ye.className))if(Ye.nodeName==="br")sn(Ye),Ye.parentNode&&Ye.parentNode.removeChild(Ye);else for(var bt=Ye.firstChild;bt;bt=bt.nextSibling)en(bt);else if((St==3||St==4)&&ot){var nt=Ye.nodeValue,vt=nt.match(_t);if(vt){var Ue=nt.substring(0,vt.index);Ye.nodeValue=Ue;var Ae=nt.substring(vt.index+vt[0].length);if(Ae){var Re=Ye.parentNode;Re.insertBefore(mt.createTextNode(Ae),Ye.nextSibling)}sn(Ye),Ue||Ye.parentNode.removeChild(Ye)}}}function sn(Ye){for(;!Ye.nextSibling;)if(Ye=Ye.parentNode,!Ye)return;function St(vt,Ue){var Ae=Ue?vt.cloneNode(!1):vt,Re=vt.parentNode;if(Re){var le=St(Re,1),he=vt.nextSibling;le.appendChild(Ae);for(var Se=he;Se;Se=he)he=Se.nextSibling,le.appendChild(Se)}return Ae}for(var bt=St(Ye.nextSibling,0),nt;(nt=bt.parentNode)&&nt.nodeType===1;)bt=nt;Xt.push(bt)}for(var pn=0;pn<Xt.length;++pn)en(Xt[pn]);ze===(ze|0)&&Xt[0].setAttribute("value",ze);var Un=mt.createElement("ol");Un.className="linenums";for(var Cn=Math.max(0,ze-1|0)||0,pn=0,Qe=Xt.length;pn<Qe;++pn)ut=Xt[pn],ut.className="L"+(pn+Cn)%10,ut.firstChild||ut.appendChild(mt.createTextNode("\xA0")),Un.appendChild(ut);Me.appendChild(Un)}function xe(Me){var ze=/\bMSIE\s(\d+)/.exec(navigator.userAgent);ze=ze&&+ze[1]<=8;var ot=/\n/g,Et=Me.sourceCode,_t=Et.length,mt=0,ut=Me.spans,Xt=ut.length,en=0,sn=Me.decorations,pn=sn.length,Un=0;sn[pn]=_t;var Cn,Qe;for(Qe=Cn=0;Qe<pn;)sn[Qe]!==sn[Qe+2]?(sn[Cn++]=sn[Qe++],sn[Cn++]=sn[Qe++]):Qe+=2;for(pn=Cn,Qe=Cn=0;Qe<pn;){for(var Ye=sn[Qe],St=sn[Qe+1],bt=Qe+2;bt+2<=pn&&sn[bt+1]===St;)bt+=2;sn[Cn++]=Ye,sn[Cn++]=St,Qe=bt}pn=sn.length=Cn;var nt=Me.sourceNode,vt="";nt&&(vt=nt.style.display,nt.style.display="none");try{for(var Ue=null;en<Xt;){var Ae=ut[en],Re=ut[en+2]||_t,le=sn[Un+2]||_t,bt=Math.min(Re,le),he=ut[en+1],Se;if(he.nodeType!==1&&(Se=Et.substring(mt,bt))){ze&&(Se=Se.replace(ot,"\r")),he.nodeValue=Se;var ve=he.ownerDocument,Pe=ve.createElement("span");Pe.className=sn[Un+1];var it=he.parentNode;it.replaceChild(Pe,he),Pe.appendChild(he),mt<Re&&(ut[en+1]=he=ve.createTextNode(Et.substring(bt,Re)),it.insertBefore(he,Pe.nextSibling))}mt=bt,mt>=Re&&(en+=2),mt>=le&&(Un+=2)}}finally{nt&&(nt.style.display=vt)}}var Oe={};function Ee(Me,ze){for(var ot=ze.length;--ot>=0;){var Et=ze[ot];Oe.hasOwnProperty(Et)?X.console&&console.warn("cannot override language handler %s",Et):Oe[Et]=Me}}function be(Me,ze){return Me&&Oe.hasOwnProperty(Me)||(Me=/^\s*</.test(ze)?"default-markup":"default-code"),Oe[Me]}Ee(Ce,["default-code"]),Ee(fe([],[[l,/^[^<?]+/],[g,/^<!\w[^>]*(?:>|$)/],[O,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[d,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),Ee(fe([[l,/^[\s]+/,null,` \r
|
|
`],[N,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[h,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[F,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[d,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),Ee(fe([],[[N,/^[\s\S]+/]]),["uq.val"]),Ee(pe({keywords:_,hashComments:!0,cStyleComments:!0,types:S}),["c","cc","cpp","cxx","cyc","m"]),Ee(pe({keywords:"null,true,false"}),["json"]),Ee(pe({keywords:o,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:S}),["cs"]),Ee(pe({keywords:p,cStyleComments:!0}),["java"]),Ee(pe({keywords:f,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),Ee(pe({keywords:t,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),Ee(pe({keywords:i,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),Ee(pe({keywords:c,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),Ee(pe({keywords:r,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),Ee(pe({keywords:u,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),Ee(fe([],[[w,/^[\s\S]+/]]),["regex"]);function te(Me){var ze=Me.langExtension;try{var ot=x(Me.sourceNode,Me.pre),Et=ot.sourceCode;Me.sourceCode=Et,Me.spans=ot.spans,Me.basePos=0,be(ze,Et)(Me),xe(Me)}catch(_t){X.console&&console.log(_t&&_t.stack||_t)}}function me(Me,ze,ot){var Et=ot||!1,_t=ze||null,mt=document.createElement("div");mt.innerHTML="<pre>"+Me+"</pre>",mt=mt.firstChild,Et&&De(mt,Et,!0);var ut={langExtension:_t,numberLines:Et,sourceNode:mt,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return te(ut),mt.innerHTML}function ye(Me,ze){var ot=ze||document.body,Et=ot.ownerDocument||document;function _t(Ae){return ot.getElementsByTagName(Ae)}for(var mt=[_t("pre"),_t("code"),_t("xmp")],ut=[],Xt=0;Xt<mt.length;++Xt)for(var en=0,sn=mt[Xt].length;en<sn;++en)ut.push(mt[Xt][en]);mt=null;var pn=Date;pn.now||(pn={now:function(){return+new Date}});var Un=0,Cn=/\blang(?:uage)?-([\w.]+)(?!\S)/,Qe=/\bprettyprint\b/,Ye=/\bprettyprinted\b/,St=/pre|xmp/i,bt=/^code$/i,nt=/^(?:pre|code|xmp)$/i,vt={};function Ue(){for(var Ae=X.PR_SHOULD_USE_CONTINUATION?pn.now()+250:Infinity;Un<ut.length&&pn.now()<Ae;Un++){for(var Re=ut[Un],le=vt,he=Re;he=he.previousSibling;){var Se=he.nodeType,ve=(Se===7||Se===8)&&he.nodeValue;if(ve?!/^\??prettify\b/.test(ve):Se!==3||/\S/.test(he.nodeValue))break;if(ve){le={},ve.replace(/\b(\w+)=([\w:.%+-]+)/g,function(_i,Dn,Ai){le[Dn]=Ai});break}}var Pe=Re.className;if((le!==vt||Qe.test(Pe))&&!Ye.test(Pe)){for(var it=!1,xt=Re.parentNode;xt;xt=xt.parentNode){var $t=xt.tagName;if(nt.test($t)&&xt.className&&Qe.test(xt.className)){it=!0;break}}if(!it){Re.className+=" prettyprinted";var mn=le.lang;if(!mn){mn=Pe.match(Cn);var rn;!mn&&(rn=ae(Re))&&bt.test(rn.tagName)&&(mn=rn.className.match(Cn)),mn&&(mn=mn[1])}var ci;if(St.test(Re.tagName))ci=1;else{var Jn=Re.currentStyle,Sn=Et.defaultView,pi=Jn?Jn.whiteSpace:Sn&&Sn.getComputedStyle?Sn.getComputedStyle(Re,null).getPropertyValue("white-space"):0;ci=pi&&pi.substring(0,3)==="pre"}var gi=le.linenums;(gi=gi==="true"||+gi)||(gi=Pe.match(/\blinenums\b(?::(\d+))?/),gi=gi?gi[1]&&gi[1].length?+gi[1]:!0:!1),gi&&De(Re,gi,ci);var xi={langExtension:mn,sourceNode:Re,numberLines:gi,pre:ci,sourceCode:null,basePos:null,spans:null,decorations:null};te(xi)}}}Un<ut.length?X.setTimeout(Ue,250):typeof Me=="function"&&Me()}Ue()}var Le=X.PR={createSimpleLexer:fe,registerLangHandler:Ee,sourceDecorator:pe,PR_ATTRIB_NAME:F,PR_ATTRIB_VALUE:N,PR_COMMENT:O,PR_DECLARATION:g,PR_KEYWORD:R,PR_LITERAL:y,PR_NOCODE:W,PR_PLAIN:l,PR_PUNCTUATION:d,PR_SOURCE:b,PR_STRING:w,PR_TAG:h,PR_TYPE:E,prettyPrintOne:U?X.prettyPrintOne=me:M=me,prettyPrint:Y=U?X.prettyPrint=ye:Y=ye},$e=X.define;typeof $e=="function"&&$e.amd&&$e("google-code-prettify",[],function(){return Le})})()},T1X5:function(zt,st){zt.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGwAAABsCAYAAACPZlfNAAALdklEQVR4Xu2dC2wc1RVAzx1nDXFiO4SEhqxtxS0JHzX94TS0FEKLALX8WkKbqrRVKQrh15Zfq0IqIaSGSOXb8ktANFJbKqUFWigEAUohfFRQDC1KxS8UR/7wDbZ3TRxix3urN951No7Xnt15M7Mbz0hRImXevffds/PmzXv33StU0KWqTlcfh6mwkCHmq8M8B5oUZosyS6EeOCD7x/Rsl/kjkFJhu8AHGWiXDNuoYqsoW5K1vCkimUpxg5SzoW+r1gylOUGErygci9IC1Fi2uR+hVeA5VZ6tquOpuSL9lnVYE1d2wNo+0jnVylLNcKYKx6EcaK23XgQJH4vyjDg8OCDc3zxd3vXSLKx7ygJYW5seOGUmZ6GcJ8IShaqwHDCeHoEhVTYh3LO7mweam+XjqO2KFNjWPp09VblUlQuAmVE7YwL93SKs2SncMr9WPojK1kiAdWzXpCa40oHlCtOi6nwpegV2ZOBuGeSGxlnSVYoMP21CBfZmnx5SneFagXPzZnJ+7I+y7S6FdQMO1xxWK++HZUgowNzpeIoVKqwCDgqrcyHp6RFlZbKetWF8HgQOrD2liwTuAHdKvj9frVVTuHDuNGkNspOBAWtt1cShC1ilcLlqecz6gnSkkS3CkMBN77zBypYWGQxCXyDAuvq1KTPIeuCYIIyuAJnPOwmWJWuk3bat1oF1pfWMjLKuAqbptn05Wl63I5ybrJOHbCqyCqw9ratEucqMDjaNrGBZqsLqpjpZaasPVhyrqlVdKe5Wcafr8TXKA6KsS9azXESG/DrHN7CODp0qdaxXON2vMftze4F/aJpljY2y008/fQFr69EZCYeH3ZX0+JrQA2ZHYDDDac0HSe+ENxe4oWRg2SfriRhWca53t3HSnFTqk1YSMPedleZv8TBYHKzc3WZ4TNbxrVLeaSUB6+zV38cTjNJgjUBT1jXMkB8XK6VoYNmp+9XFKorv39cDKlxX7JS/KGDZj+K/x99Z1n5+6gjfLObj2jOw7HLTv+MVDGuwcoK6nQSf97qM5QmYWcj9xHyensRrg9YpjRL4/HtbOd7LgrEnYF1p/U1G+XnQVk9m+Y5wfbJOfjGRDyYEZvazHOFfk2WLZCKHBfX/Zmsmo3ypqV42j6djXGBmp7gzzQuTYPMxKA7Fym1tqGPxeDvX4wLr7NULVdzd4vgKyQOiXNQwQ+4spK4gMBMwc0CG1/bDGIyQXF+ymp5dDkcUCuwpCKwzpXcqbrxgfIXsAYU1TfVy4VhqxwRm4gZJ8L/9IBQtZFdbU7eLQT41VtzjmMDaU3qzwKXW1MeCivaAwi1N9XLZ6Ib7AHPDpzO0hRmR+/L78Ict8J93IT1QdN+sN6irhs/NgR8uhM8eYl28J4EmwninQ/PosPB9gHWmdZUqoS3u/uUVuPEFKMcDWg5wxWL4zlGefGz9JhGuaxgVD7IXsOwpEhMvHsrBBPNknf9IecLKed9Au+vUyJ607t3dJPNPzewFrCOl3wPutf5TKSDwio3wdF7k3imfhMNnugGZkV2q8Ho3PPbWHhOOb4IbT4zMpHMa6+XPOe17A+vVjQhfC8u0E+/d884ysH69JCzNE+v51aY90Mw7beM5E7cJ5A7ln40zZOTnMgLMnHxMDNEZ5mG6RSbcNHv9tAV+sDCQLpck9I9b4Hd5UfKbIwrgM4cKB6toyJ0EHQHWkdJLgFtL6l2JjfKB/WwRfP/TJQoKoNmf/gu/zVuGjQqY6ZrjcEmyVm43/x4B1pnSxxVOCqDvBUXGwLx5W+CJhno5eQSYe1q/jw/DPgAeA/MGDOHjqloONtkN3CesI6XfAB7x2NzabV6B3fca3LoZ+ndbU+0KmpaAn7TA0iP2lVtOQ2LWulMb62WDC6wzrdfp8CGGUC+vwL56L3wU0ArI9Gp4cowZYLkBE2F1Q51cPfyEpXUTyvGh0gK8ArvgUXgxoGwZX5gDa79eAU+Y8HRjnSyR7K5yXwAZZibk7xXYjkHY2Abmb5uXGRJPnAfTqisAGPQ31FErnWldoMrrNh3hVZZXYF7l2byv3IZEd4YoHC4dfbqUDPfZ7KxXWTEwr57K3udwtnT06i8RVhfZ1MrtMbAi3ahcJe1pXSPKiiKbWrk9BlacG1VYa95hG1QZY55UnLBS7vYK7JXtwxuc/ZYnHTWJ4U3Ko2ZVxKTDvMMelY60bs7mISzF577aeAV25l/h7Y98qSrYeO50ePDblQHMzevYmVITDjAvGHeMLzUGVpzXBbZJR0p7gBnFNbVzt1dgr+aGRMtLUzVThofEI8cYEh9/C1ZuGu7n7BrYsMxOn31K6TXAdkTx0WwM9wrMZydLaj6UgTtegje64UefgaPnlCTGdqN+A8z8biPJAFrOwGx72pK8oRiYJU+GJMYFFg+JIXnbghp3SOyO6sCD1yFxxwBs3BbA4m91dvE3YcGV4YjoqYhp/YpH4aWAtlfMZGJNJMsGxRMentZXwIdzFBuYxbszhBbuh3MFLE25IQKtwSxNmRCBs8cIEQjB/UWrcJem4sXfvf32Qhdc8jjcdjIsThbt00AbuIu/8fZK5QDDbK/EG5gVBMxsYMYhApUDzA0RqIQgnEBfDKOEl/E7bDgIx9hb7mFuMTA3qH44zM04o9wDSWNgbsRUXiBpmYdq2wZmhr1C16sfwu0vwsVHw5EHF74vgin/nlDtcjgMEeb5sPw1zFJ/DKEePxp9GMIdFiM4bhTVCUyvT9gR4zxhx4T4Ub3PcSMDrKtPL85kuK3UX1wp7fyccTaHGE5uBhP5ZPMqx1nimAf6ojgy+/J7cP6G0rMILJ4Lt51iExeUG7CCR2bd6X3Ih9KNTj95OmZOhce+u38Do9ChdBdYyGkfcq4uJRPO9ARc9kU4Y8F+DgwKp30IO7GKXVfbkVZmQ+L4iVWyH9Ghpi6y42Z7UsoJ2ISpi0y3o0gOZs/d/iWVCzDPycFMl+P0e/7B+5XgOf2eO/mIE1z69bff9sUluMw+ZXdKnELWr+NLal90ClmjJU7SXJKvbTQqLUmzO2OM06DbAFCUjJLToBstcaGBonxt42Z/hQay77K4lIcNFBPIsFLKI6cjLpYTBjGub7RRLMeYGpejChyY3XJUxty44Ftg0OwXfMsbGs/IKHFJRXvsgiupmLMxLlpqkVbQRUtzpsZlgf1Dk7DKAme/z+LC2z6YhV54210g7tCpUkdc2r5IcJGUts/Z2NajMxIODyscW6Tdk/J2A2sww2nNB0lvqQ7wXTQj+6StVzi9VCMmQzszDGqaZY2NstNPf30DM8qfVJ0yP8VdKkRUP8GPC4JvayYYyXqWi8iQX21WgI2a8pvs3Fbl+u1khO1VhdVNo0pK+bHHumO70mo+rk1VlVBKWvnpfMBtux3h3GSdPGRTj3VgectY64FjbBpbQbKedxIsS9ZIXrEtO9YHAsyYZhaMD13AKoXLJ0uVdbNFInDTO2+wsqVFLOdPHQYeGLCR91pKFwlu8e4WO7+xspXSqnDRRKXp/VofODBjoNm57kqxQoVVUeW18uuocdr3iLIyWc/a8UrS29IfCrCcsSawpzrDtYI7/T/AVicikrNLYd2AwzWFqpoHYVeowHIdMHGPmuBKB5aHWX7YhgNNRG4G7pZBbhirMLYNHePJiARYziA3LFy5VJULKuAzoFuENTuFW0bXVg4aUr78SIHlDMmemjkL5TwRloRZh3OCX/OQKpsQ7tndzQP55XnDhFR2wPINMidBq5WlmuFMFY4Lu2qgqYYnyjPi8OCAcH+uWGhUgEbrLYsnrJAz3OwGaU5AOQ6HL2cLItRYdl6/m8AfnlPl2ao6njKlCy3rsCaurIGN7qX7edDHYSosZIj56jDPgSaF2aLM0uH8+6YaWG4GugsYEOhVYbvABxlolwzbqGKrKFuStbwZxnTcFrH/A8wNv8JI/KKJAAAAAElFTkSuQmCC"},TXwP:function(zt,st,V){var ie,Z;(function(){var U;(function(){"use strict";var H=[,,function(k){function D(p){this.__parent=p,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}D.prototype.clone_empty=function(){var p=new D(this.__parent);return p.set_indent(this.__indent_count,this.__alignment_count),p},D.prototype.item=function(p){return p<0?this.__items[this.__items.length+p]:this.__items[p]},D.prototype.has_match=function(p){for(var o=this.__items.length-1;o>=0;o--)if(this.__items[o].match(p))return!0;return!1},D.prototype.set_indent=function(p,o){this.is_empty()&&(this.__indent_count=p||0,this.__alignment_count=o||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},D.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},D.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},D.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var p=this.__parent.current_line;return p.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),p.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),p.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,p.__items[0]===" "&&(p.__items.splice(0,1),p.__character_count-=1),!0}return!1},D.prototype.is_empty=function(){return this.__items.length===0},D.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},D.prototype.push=function(p){this.__items.push(p);var o=p.lastIndexOf(`
|
|
`);o!==-1?this.__character_count=p.length-o:this.__character_count+=p.length},D.prototype.pop=function(){var p=null;return this.is_empty()||(p=this.__items.pop(),this.__character_count-=p.length),p},D.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},D.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},D.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},D.prototype.toString=function(){var p="";return this.is_empty()?this.__parent.indent_empty_lines&&(p=this.__parent.get_indent_string(this.__indent_count)):(p=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),p+=this.__items.join("")),p};function v(p,o){this.__cache=[""],this.__indent_size=p.indent_size,this.__indent_string=p.indent_char,p.indent_with_tabs||(this.__indent_string=new Array(p.indent_size+1).join(p.indent_char)),o=o||"",p.indent_level>0&&(o=new Array(p.indent_level+1).join(this.__indent_string)),this.__base_string=o,this.__base_string_length=o.length}v.prototype.get_indent_size=function(p,o){var u=this.__base_string_length;return o=o||0,p<0&&(u=0),u+=p*this.__indent_size,u+=o,u},v.prototype.get_indent_string=function(p,o){var u=this.__base_string;return o=o||0,p<0&&(p=0,u=""),o+=p*this.__indent_size,this.__ensure_cache(o),u+=this.__cache[o],u},v.prototype.__ensure_cache=function(p){for(;p>=this.__cache.length;)this.__add_column()},v.prototype.__add_column=function(){var p=this.__cache.length,o=0,u="";this.__indent_size&&p>=this.__indent_size&&(o=Math.floor(p/this.__indent_size),p-=o*this.__indent_size,u=new Array(o+1).join(this.__indent_string)),p&&(u+=new Array(p+1).join(" ")),this.__cache.push(u)};function _(p,o){this.__indent_cache=new v(p,o),this.raw=!1,this._end_with_newline=p.end_with_newline,this.indent_size=p.indent_size,this.wrap_line_length=p.wrap_line_length,this.indent_empty_lines=p.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new D(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}_.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},_.prototype.get_line_number=function(){return this.__lines.length},_.prototype.get_indent_string=function(p,o){return this.__indent_cache.get_indent_string(p,o)},_.prototype.get_indent_size=function(p,o){return this.__indent_cache.get_indent_size(p,o)},_.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},_.prototype.add_new_line=function(p){return this.is_empty()||!p&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},_.prototype.get_code=function(p){this.trim(!0);var o=this.current_line.pop();o&&(o[o.length-1]===`
|
|
`&&(o=o.replace(/\n+$/g,"")),this.current_line.push(o)),this._end_with_newline&&this.__add_outputline();var u=this.__lines.join(`
|
|
`);return p!==`
|
|
`&&(u=u.replace(/[\n]/g,p)),u},_.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},_.prototype.set_indent=function(p,o){return p=p||0,o=o||0,this.next_line.set_indent(p,o),this.__lines.length>1?(this.current_line.set_indent(p,o),!0):(this.current_line.set_indent(),!1)},_.prototype.add_raw_token=function(p){for(var o=0;o<p.newlines;o++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(p.whitespace_before),this.current_line.push(p.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},_.prototype.add_token=function(p){this.__add_space_before_token(),this.current_line.push(p),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},_.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},_.prototype.remove_indent=function(p){for(var o=this.__lines.length;p<o;)this.__lines[p]._remove_indent(),p++;this.current_line._remove_wrap_indent()},_.prototype.trim=function(p){for(p=p===void 0?!1:p,this.current_line.trim();p&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},_.prototype.just_added_newline=function(){return this.current_line.is_empty()},_.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},_.prototype.ensure_empty_line_above=function(p,o){for(var u=this.__lines.length-2;u>=0;){var r=this.__lines[u];if(r.is_empty())break;if(r.item(0).indexOf(p)!==0&&r.item(-1)!==o){this.__lines.splice(u+1,0,new D(this)),this.previous_line=this.__lines[this.__lines.length-2];break}u--}},k.exports.Output=_},,,,function(k){function D(p,o){this.raw_options=v(p,o),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}D.prototype._get_array=function(p,o){var u=this.raw_options[p],r=o||[];return typeof u=="object"?u!==null&&typeof u.concat=="function"&&(r=u.concat()):typeof u=="string"&&(r=u.split(/[^a-zA-Z0-9_\/\-]+/)),r},D.prototype._get_boolean=function(p,o){var u=this.raw_options[p],r=u===void 0?!!o:!!u;return r},D.prototype._get_characters=function(p,o){var u=this.raw_options[p],r=o||"";return typeof u=="string"&&(r=u.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),r},D.prototype._get_number=function(p,o){var u=this.raw_options[p];o=parseInt(o,10),isNaN(o)&&(o=0);var r=parseInt(u,10);return isNaN(r)&&(r=o),r},D.prototype._get_selection=function(p,o,u){var r=this._get_selection_list(p,o,u);if(r.length!==1)throw new Error("Invalid Option Value: The option '"+p+`' can only be one of the following values:
|
|
`+o+`
|
|
You passed in: '`+this.raw_options[p]+"'");return r[0]},D.prototype._get_selection_list=function(p,o,u){if(!o||o.length===0)throw new Error("Selection list cannot be empty.");if(u=u||[o[0]],!this._is_valid_selection(u,o))throw new Error("Invalid Default Value!");var r=this._get_array(p,u);if(!this._is_valid_selection(r,o))throw new Error("Invalid Option Value: The option '"+p+`' can contain only the following values:
|
|
`+o+`
|
|
You passed in: '`+this.raw_options[p]+"'");return r},D.prototype._is_valid_selection=function(p,o){return p.length&&o.length&&!p.some(function(u){return o.indexOf(u)===-1})};function v(p,o){var u={};p=_(p);var r;for(r in p)r!==o&&(u[r]=p[r]);if(o&&p[o])for(r in p[o])u[r]=p[o][r];return u}function _(p){var o={},u;for(u in p){var r=u.replace(/-/g,"_");o[r]=p[u]}return o}k.exports.Options=D,k.exports.normalizeOpts=_,k.exports.mergeOpts=v},,function(k){var D=RegExp.prototype.hasOwnProperty("sticky");function v(_){this.__input=_||"",this.__input_length=this.__input.length,this.__position=0}v.prototype.restart=function(){this.__position=0},v.prototype.back=function(){this.__position>0&&(this.__position-=1)},v.prototype.hasNext=function(){return this.__position<this.__input_length},v.prototype.next=function(){var _=null;return this.hasNext()&&(_=this.__input.charAt(this.__position),this.__position+=1),_},v.prototype.peek=function(_){var p=null;return _=_||0,_+=this.__position,_>=0&&_<this.__input_length&&(p=this.__input.charAt(_)),p},v.prototype.__match=function(_,p){_.lastIndex=p;var o=_.exec(this.__input);return o&&!(D&&_.sticky)&&(o.index!==p&&(o=null)),o},v.prototype.test=function(_,p){return p=p||0,p+=this.__position,p>=0&&p<this.__input_length?!!this.__match(_,p):!1},v.prototype.testChar=function(_,p){var o=this.peek(p);return _.lastIndex=0,o!==null&&_.test(o)},v.prototype.match=function(_){var p=this.__match(_,this.__position);return p?this.__position+=p[0].length:p=null,p},v.prototype.read=function(_,p,o){var u="",r;return _&&(r=this.match(_),r&&(u+=r[0])),p&&(r||!_)&&(u+=this.readUntil(p,o)),u},v.prototype.readUntil=function(_,p){var o="",u=this.__position;_.lastIndex=this.__position;var r=_.exec(this.__input);return r?(u=r.index,p&&(u+=r[0].length)):u=this.__input_length,o=this.__input.substring(this.__position,u),this.__position=u,o},v.prototype.readUntilAfter=function(_){return this.readUntil(_,!0)},v.prototype.get_regexp=function(_,p){var o=null,u="g";return p&&D&&(u="y"),typeof _=="string"&&_!==""?o=new RegExp(_,u):_&&(o=new RegExp(_.source,u)),o},v.prototype.get_literal_regexp=function(_){return RegExp(_.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},v.prototype.peekUntilAfter=function(_){var p=this.__position,o=this.readUntilAfter(_);return this.__position=p,o},v.prototype.lookBack=function(_){var p=this.__position-1;return p>=_.length&&this.__input.substring(p-_.length,p).toLowerCase()===_},k.exports.InputScanner=v},,,,,function(k){function D(v,_){v=typeof v=="string"?v:v.source,_=typeof _=="string"?_:_.source,this.__directives_block_pattern=new RegExp(v+/ beautify( \w+[:]\w+)+ /.source+_,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(v+/\sbeautify\signore:end\s/.source+_,"g")}D.prototype.get_directives=function(v){if(!v.match(this.__directives_block_pattern))return null;var _={};this.__directive_pattern.lastIndex=0;for(var p=this.__directive_pattern.exec(v);p;)_[p[1]]=p[2],p=this.__directive_pattern.exec(v);return _},D.prototype.readIgnored=function(v){return v.readUntilAfter(this.__directives_end_ignore_pattern)},k.exports.Directives=D},,function(k,D,v){var _=v(16).Beautifier,p=v(17).Options;function o(u,r){var i=new _(u,r);return i.beautify()}k.exports=o,k.exports.defaultOptions=function(){return new p}},function(k,D,v){var _=v(17).Options,p=v(2).Output,o=v(8).InputScanner,u=v(13).Directives,r=new u(/\/\*/,/\*\//),i=/\r\n|[\r\n]/,t=/\r\n|[\r\n]/g,c=/\s/,f=/(?:\s|\n)+/g,A=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,S=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function w(R,O){this._source_text=R||"",this._options=new _(O),this._ch=null,this._input=null,this.NESTED_AT_RULE={"@page":!0,"@font-face":!0,"@keyframes":!0,"@media":!0,"@supports":!0,"@document":!0},this.CONDITIONAL_GROUP_RULE={"@media":!0,"@supports":!0,"@document":!0},this.NON_SEMICOLON_NEWLINE_PROPERTY=["grid-template-areas","grid-template"]}w.prototype.eatString=function(R){var O="";for(this._ch=this._input.next();this._ch;){if(O+=this._ch,this._ch==="\\")O+=this._input.next();else if(R.indexOf(this._ch)!==-1||this._ch===`
|
|
`)break;this._ch=this._input.next()}return O},w.prototype.eatWhitespace=function(R){for(var O=c.test(this._input.peek()),E=0;c.test(this._input.peek());)this._ch=this._input.next(),R&&this._ch===`
|
|
`&&((E===0||E<this._options.max_preserve_newlines)&&(E++,this._output.add_new_line(!0)));return O},w.prototype.foundNestedPseudoClass=function(){for(var R=0,O=1,E=this._input.peek(O);E;){if(E==="{")return!0;if(E==="(")R+=1;else if(E===")"){if(R===0)return!1;R-=1}else if(E===";"||E==="}")return!1;O++,E=this._input.peek(O)}return!1},w.prototype.print_string=function(R){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(R)},w.prototype.preserveSingleSpace=function(R){R&&(this._output.space_before_token=!0)},w.prototype.indent=function(){this._indentLevel++},w.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},w.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var R=this._source_text,O=this._options.eol;O==="auto"&&(O=`
|
|
`,R&&i.test(R||"")&&(O=R.match(i)[0])),R=R.replace(t,`
|
|
`);var E=R.match(/^[\t ]*/)[0];this._output=new p(this._options,E),this._input=new o(R),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var y=0,d=!1,l=!1,h=!1,g=!1,b=!1,F=!1,N=this._ch,W=!1,K,I,x;K=this._input.read(f),I=K!=="",x=N,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),N=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var j=this._input.read(A),$=r.get_directives(j);$&&$.ignore==="start"&&(j+=r.readIgnored(this._input)),this.print_string(j),this.eatWhitespace(!0),this._output.add_new_line()}else if(this._ch==="/"&&this._input.peek()==="/")this._output.space_before_token=!0,this._input.back(),this.print_string(this._input.read(S)),this.eatWhitespace(!0);else if(this._ch==="@"||this._ch==="$")if(this.preserveSingleSpace(I),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var ae=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);ae.match(/[ :]$/)&&(ae=this.eatString(": ").replace(/\s$/,""),this.print_string(ae),this._output.space_before_token=!0),ae=ae.replace(/\s$/,""),ae==="extend"?g=!0:ae==="import"&&(b=!0),ae in this.NESTED_AT_RULE?(this._nestedLevel+=1,ae in this.CONDITIONAL_GROUP_RULE&&(h=!0)):!d&&y===0&&ae.indexOf(":")!==-1&&(l=!0,this.indent())}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(I),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")l&&(l=!1,this.outdent()),h?(h=!1,d=this._indentLevel>=this._nestedLevel):d=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&d&&(this._output.previous_line&&this._output.previous_line.item(-1)!=="{"&&this._output.ensure_empty_line_above("/",",")),this._output.space_before_token=!0,this._options.brace_style==="expand"?(this._output.add_new_line(),this.print_string(this._ch),this.indent(),this._output.set_indent(this._indentLevel)):(x==="("?this._output.space_before_token=!1:x!==","&&this.indent(),this.print_string(this._ch)),this.eatWhitespace(!0),this._output.add_new_line();else if(this._ch==="}")this.outdent(),this._output.add_new_line(),x==="{"&&this._output.trim(!0),b=!1,g=!1,l&&(this.outdent(),l=!1),this.print_string(this._ch),d=!1,this._nestedLevel&&this._nestedLevel--,this.eatWhitespace(!0),this._output.add_new_line(),this._options.newline_between_rules&&!this._output.just_added_blankline()&&(this._input.peek()!=="}"&&this._output.add_new_line(!0)),this._input.peek()===")"&&(this._output.trim(!0),this._options.brace_style==="expand"&&this._output.add_new_line(!0));else if(this._ch===":"){for(var fe=0;fe<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;fe++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[fe])){W=!0;break}(d||h)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!g&&y===0?(this.print_string(":"),l||(l=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent())):(this._input.lookBack(" ")&&(this._output.space_before_token=!0),this._input.peek()===":"?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":"))}else if(this._ch==='"'||this._ch==="'"){var pe=x==='"'||x==="'";this.preserveSingleSpace(pe||I),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")W=!1,y===0?(l&&(this.outdent(),l=!1),g=!1,b=!1,this.print_string(this._ch),this.eatWhitespace(!0),this._input.peek()!=="/"&&this._output.add_new_line()):(this.print_string(this._ch),this.eatWhitespace(!0),this._output.space_before_token=!0);else if(this._ch==="(")if(this._input.lookBack("url"))this.print_string(this._ch),this.eatWhitespace(),y++,this.indent(),this._ch=this._input.next(),this._ch===")"||this._ch==='"'||this._ch==="'"?this._input.back():this._ch&&(this.print_string(this._ch+this.eatString(")")),y&&(y--,this.outdent()));else{var Ce=!1;this._input.lookBack("with")&&(Ce=!0),this.preserveSingleSpace(I||Ce),this.print_string(this._ch),l&&x==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),F=!0):(this.eatWhitespace(),y++,this.indent())}else if(this._ch===")")y&&(y--,this.outdent()),F&&this._input.peek()===";"&&this._options.selector_separator_newline&&(F=!1,this.outdent(),this._output.add_new_line()),this.print_string(this._ch);else if(this._ch===",")this.print_string(this._ch),this.eatWhitespace(!0),this._options.selector_separator_newline&&(!l||F)&&y===0&&!b&&!g?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!l&&y===0)this._options.space_around_combinator?(this._output.space_before_token=!0,this.print_string(this._ch),this._output.space_before_token=!0):(this.print_string(this._ch),this.eatWhitespace(),this._ch&&c.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(I),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),c.test(this._ch)&&(this._ch="");else if(this._ch==="!"&&!this._input.lookBack("\\"))this._output.space_before_token=!0,this.print_string(this._ch);else{var De=x==='"'||x==="'";this.preserveSingleSpace(De||I),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
|
|
`&&W&&this._output.add_new_line()}var xe=this._output.get_code(O);return xe},k.exports.Beautifier=w},function(k,D,v){var _=v(6).Options;function p(o){_.call(this,o,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var u=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||u;var r=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var i=0;i<r.length;i++)r[i]!=="expand"?this.brace_style="collapse":this.brace_style=r[i]}p.prototype=new _,k.exports.Options=p}],M={};function Y(k){var D=M[k];if(D!==void 0)return D.exports;var v=M[k]={exports:{}};return H[k](v,v.exports,Y),v.exports}var X=Y(15);U=X})();var ee=U;!(ie=[],Z=function(){return{css_beautify:ee}}.apply(st,ie),Z!==void 0&&(zt.exports=Z))})()},"VrN/":function(zt,st,V){(function(ie,Z){zt.exports=Z()})(this,function(){"use strict";var ie=navigator.userAgent,Z=navigator.platform,U=/gecko\/\d/i.test(ie),ee=/MSIE \d/.test(ie),H=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ie),M=/Edge\/(\d+)/.exec(ie),Y=ee||H||M,X=Y&&(ee?document.documentMode||6:+(M||H)[1]),k=!M&&/WebKit\//.test(ie),D=k&&/Qt\/\d+\.\d+/.test(ie),v=!M&&/Chrome\//.test(ie),_=/Opera\//.test(ie),p=/Apple Computer/.test(navigator.vendor),o=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ie),u=/PhantomJS/.test(ie),r=!M&&/AppleWebKit/.test(ie)&&/Mobile\/\w+/.test(ie),i=/Android/.test(ie),t=r||i||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ie),c=r||/Mac/.test(Z),f=/\bCrOS\b/.test(ie),A=/win/i.test(Z),S=_&&ie.match(/Version\/(\d*\.\d*)/);S&&(S=Number(S[1])),S&&S>=15&&(_=!1,k=!0);var w=c&&(D||_&&(S==null||S<12.11)),R=U||Y&&X>=9;function O(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var E=function(e,n){var s=e.className,a=O(n).exec(s);if(a){var m=s.slice(a.index+a[0].length);e.className=s.slice(0,a.index)+(m?a[1]+m:"")}};function y(e){for(var n=e.childNodes.length;n>0;--n)e.removeChild(e.firstChild);return e}function d(e,n){return y(e).appendChild(n)}function l(e,n,s,a){var m=document.createElement(e);if(s&&(m.className=s),a&&(m.style.cssText=a),typeof n=="string")m.appendChild(document.createTextNode(n));else if(n)for(var B=0;B<n.length;++B)m.appendChild(n[B]);return m}function h(e,n,s,a){var m=l(e,n,s,a);return m.setAttribute("role","presentation"),m}var g;document.createRange?g=function(e,n,s,a){var m=document.createRange();return m.setEnd(a||e,s),m.setStart(e,n),m}:g=function(e,n,s){var a=document.body.createTextRange();try{a.moveToElementText(e.parentNode)}catch(m){return a}return a.collapse(!0),a.moveEnd("character",s),a.moveStart("character",n),a};function b(e,n){if(n.nodeType==3&&(n=n.parentNode),e.contains)return e.contains(n);do if(n.nodeType==11&&(n=n.host),n==e)return!0;while(n=n.parentNode)}function F(){var e;try{e=document.activeElement}catch(n){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function N(e,n){var s=e.className;O(n).test(s)||(e.className+=(s?" ":"")+n)}function W(e,n){for(var s=e.split(" "),a=0;a<s.length;a++)s[a]&&!O(s[a]).test(n)&&(n+=" "+s[a]);return n}var K=function(e){e.select()};r?K=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:Y&&(K=function(e){try{e.select()}catch(n){}});function I(e){var n=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,n)}}function x(e,n,s){n||(n={});for(var a in e)e.hasOwnProperty(a)&&(s!==!1||!n.hasOwnProperty(a))&&(n[a]=e[a]);return n}function j(e,n,s,a,m){n==null&&(n=e.search(/[^\s\u00a0]/),n==-1&&(n=e.length));for(var B=a||0,J=m||0;;){var re=e.indexOf(" ",B);if(re<0||re>=n)return J+(n-B);J+=re-B,J+=s-J%s,B=re+1}}var $=function(){this.id=null,this.f=null,this.time=0,this.handler=I(this.onTimeout,this)};$.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},$.prototype.set=function(e,n){this.f=n;var s=+new Date+e;(!this.id||s<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=s)};function ae(e,n){for(var s=0;s<e.length;++s)if(e[s]==n)return s;return-1}var fe=50,pe={toString:function(){return"CodeMirror.Pass"}},Ce={scroll:!1},De={origin:"*mouse"},xe={origin:"+move"};function Oe(e,n,s){for(var a=0,m=0;;){var B=e.indexOf(" ",a);B==-1&&(B=e.length);var J=B-a;if(B==e.length||m+J>=n)return a+Math.min(J,n-m);if(m+=B-a,m+=s-m%s,a=B+1,m>=n)return a}}var Ee=[""];function be(e){for(;Ee.length<=e;)Ee.push(te(Ee)+" ");return Ee[e]}function te(e){return e[e.length-1]}function me(e,n){for(var s=[],a=0;a<e.length;a++)s[a]=n(e[a],a);return s}function ye(e,n,s){for(var a=0,m=s(n);a<e.length&&s(e[a])<=m;)a++;e.splice(a,0,n)}function Le(){}function $e(e,n){var s;return Object.create?s=Object.create(e):(Le.prototype=e,s=new Le),n&&x(n,s),s}var Me=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ze(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Me.test(e))}function ot(e,n){return n?n.source.indexOf("\\w")>-1&&ze(e)?!0:n.test(e):ze(e)}function Et(e){for(var n in e)if(e.hasOwnProperty(n)&&e[n])return!1;return!0}var _t=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function mt(e){return e.charCodeAt(0)>=768&&_t.test(e)}function ut(e,n,s){for(;(s<0?n>0:n<e.length)&&mt(e.charAt(n));)n+=s;return n}function Xt(e,n,s){for(var a=n>s?-1:1;;){if(n==s)return n;var m=(n+s)/2,B=a<0?Math.ceil(m):Math.floor(m);if(B==n)return e(B)?n:s;e(B)?s=B:n=B+a}}function en(e,n,s,a){if(!e)return a(n,s,"ltr",0);for(var m=!1,B=0;B<e.length;++B){var J=e[B];(J.from<s&&J.to>n||n==s&&J.to==n)&&(a(Math.max(J.from,n),Math.min(J.to,s),J.level==1?"rtl":"ltr",B),m=!0)}m||a(n,s,"ltr")}var sn=null;function pn(e,n,s){var a;sn=null;for(var m=0;m<e.length;++m){var B=e[m];if(B.from<n&&B.to>n)return m;B.to==n&&(B.from!=B.to&&s=="before"?a=m:sn=m),B.from==n&&(B.from!=B.to&&s!="before"?a=m:sn=m)}return a!=null?a:sn}var Un=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",n="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function s(ge){return ge<=247?e.charAt(ge):1424<=ge&&ge<=1524?"R":1536<=ge&&ge<=1785?n.charAt(ge-1536):1774<=ge&&ge<=2220?"r":8192<=ge&&ge<=8203?"w":ge==8204?"b":"L"}var a=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,m=/[stwN]/,B=/[LRr]/,J=/[Lb1n]/,re=/[1n]/;function se(ge,Ne,Ve){this.level=ge,this.from=Ne,this.to=Ve}return function(ge,Ne){var Ve=Ne=="ltr"?"L":"R";if(ge.length==0||Ne=="ltr"&&!a.test(ge))return!1;for(var ht=ge.length,lt=[],Ht=0;Ht<ht;++Ht)lt.push(s(ge.charCodeAt(Ht)));for(var ln=0,xn=Ve;ln<ht;++ln){var Kn=lt[ln];Kn=="m"?lt[ln]=xn:xn=Kn}for(var ri=0,Gn=Ve;ri<ht;++ri){var di=lt[ri];di=="1"&&Gn=="r"?lt[ri]="n":B.test(di)&&(Gn=di,di=="r"&&(lt[ri]="R"))}for(var Ri=1,Si=lt[0];Ri<ht-1;++Ri){var Di=lt[Ri];Di=="+"&&Si=="1"&<[Ri+1]=="1"?lt[Ri]="1":Di==","&&Si==lt[Ri+1]&&(Si=="1"||Si=="n")&&(lt[Ri]=Si),Si=Di}for(var Wi=0;Wi<ht;++Wi){var ir=lt[Wi];if(ir==",")lt[Wi]="N";else if(ir=="%"){var zi=void 0;for(zi=Wi+1;zi<ht&<[zi]=="%";++zi);for(var Er=Wi&<[Wi-1]=="!"||zi<ht&<[zi]=="1"?"1":"N",vr=Wi;vr<zi;++vr)lt[vr]=Er;Wi=zi-1}}for(var Qi=0,gr=Ve;Qi<ht;++Qi){var sr=lt[Qi];gr=="L"&&sr=="1"?lt[Qi]="L":B.test(sr)&&(gr=sr)}for(var Zi=0;Zi<ht;++Zi)if(m.test(lt[Zi])){var qi=void 0;for(qi=Zi+1;qi<ht&&m.test(lt[qi]);++qi);for(var Xi=(Zi?lt[Zi-1]:Ve)=="L",_r=(qi<ht?lt[qi]:Ve)=="L",_o=Xi==_r?Xi?"L":"R":Ve,Ca=Zi;Ca<qi;++Ca)lt[Ca]=_o;Zi=qi-1}for(var dr=[],Hr,rr=0;rr<ht;)if(J.test(lt[rr])){var nu=rr;for(++rr;rr<ht&&J.test(lt[rr]);++rr);dr.push(new se(0,nu,rr))}else{var Qr=rr,Ga=dr.length,za=Ne=="rtl"?1:0;for(++rr;rr<ht&<[rr]!="L";++rr);for(var hr=Qr;hr<rr;)if(re.test(lt[hr])){Qr<hr&&(dr.splice(Ga,0,new se(1,Qr,hr)),Ga+=za);var yo=hr;for(++hr;hr<rr&&re.test(lt[hr]);++hr);dr.splice(Ga,0,new se(2,yo,hr)),Ga+=za,Qr=hr}else++hr;Qr<rr&&dr.splice(Ga,0,new se(1,Qr,rr))}return Ne=="ltr"&&(dr[0].level==1&&(Hr=ge.match(/^\s+/))&&(dr[0].from=Hr[0].length,dr.unshift(new se(0,0,Hr[0].length))),te(dr).level==1&&(Hr=ge.match(/\s+$/))&&(te(dr).to-=Hr[0].length,dr.push(new se(0,ht-Hr[0].length,ht)))),Ne=="rtl"?dr.reverse():dr}}();function Cn(e,n){var s=e.order;return s==null&&(s=e.order=Un(e.text,n)),s}var Qe=[],Ye=function(e,n,s){if(e.addEventListener)e.addEventListener(n,s,!1);else if(e.attachEvent)e.attachEvent("on"+n,s);else{var a=e._handlers||(e._handlers={});a[n]=(a[n]||Qe).concat(s)}};function St(e,n){return e._handlers&&e._handlers[n]||Qe}function bt(e,n,s){if(e.removeEventListener)e.removeEventListener(n,s,!1);else if(e.detachEvent)e.detachEvent("on"+n,s);else{var a=e._handlers,m=a&&a[n];if(m){var B=ae(m,s);B>-1&&(a[n]=m.slice(0,B).concat(m.slice(B+1)))}}}function nt(e,n){var s=St(e,n);if(!s.length)return;for(var a=Array.prototype.slice.call(arguments,2),m=0;m<s.length;++m)s[m].apply(null,a)}function vt(e,n,s){return typeof n=="string"&&(n={type:n,preventDefault:function(){this.defaultPrevented=!0}}),nt(e,s||n.type,e,n),Se(n)||n.codemirrorIgnore}function Ue(e){var n=e._handlers&&e._handlers.cursorActivity;if(!n)return;for(var s=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),a=0;a<n.length;++a)ae(s,n[a])==-1&&s.push(n[a])}function Ae(e,n){return St(e,n).length>0}function Re(e){e.prototype.on=function(n,s){Ye(this,n,s)},e.prototype.off=function(n,s){bt(this,n,s)}}function le(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function he(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Se(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ve(e){le(e),he(e)}function Pe(e){return e.target||e.srcElement}function it(e){var n=e.which;return n==null&&(e.button&1?n=1:e.button&2?n=3:e.button&4&&(n=2)),c&&e.ctrlKey&&n==1&&(n=3),n}var xt=function(){if(Y&&X<9)return!1;var e=l("div");return"draggable"in e||"dragDrop"in e}(),$t;function mn(e){if($t==null){var n=l("span","\u200B");d(e,l("span",[n,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&($t=n.offsetWidth<=1&&n.offsetHeight>2&&!(Y&&X<8))}var s=$t?l("span","\u200B"):l("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return s.setAttribute("cm-text",""),s}var rn;function ci(e){if(rn!=null)return rn;var n=d(e,document.createTextNode("A\u062EA")),s=g(n,0,1).getBoundingClientRect(),a=g(n,1,2).getBoundingClientRect();return y(e),!s||s.left==s.right?!1:rn=a.right-s.right<3}var Jn=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var n=0,s=[],a=e.length;n<=a;){var m=e.indexOf(`
|
|
`,n);m==-1&&(m=e.length);var B=e.slice(n,e.charAt(m-1)=="\r"?m-1:m),J=B.indexOf("\r");J!=-1?(s.push(B.slice(0,J)),n+=J+1):(s.push(B),n=m+1)}return s}:function(e){return e.split(/\r\n?|\n/)},Sn=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(n){return!1}}:function(e){var n;try{n=e.ownerDocument.selection.createRange()}catch(s){}return!n||n.parentElement()!=e?!1:n.compareEndPoints("StartToEnd",n)!=0},pi=function(){var e=l("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),gi=null;function xi(e){if(gi!=null)return gi;var n=d(e,l("span","x")),s=n.getBoundingClientRect(),a=g(n,0,1).getBoundingClientRect();return gi=Math.abs(s.left-a.left)>1}var _i={},Dn={};function Ai(e,n){arguments.length>2&&(n.dependencies=Array.prototype.slice.call(arguments,2)),_i[e]=n}function Ln(e,n){Dn[e]=n}function Dt(e){if(typeof e=="string"&&Dn.hasOwnProperty(e))e=Dn[e];else if(e&&typeof e.name=="string"&&Dn.hasOwnProperty(e.name)){var n=Dn[e.name];typeof n=="string"&&(n={name:n}),e=$e(n,e),e.name=n.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Dt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Dt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Qn(e,n){n=Dt(n);var s=_i[n.name];if(!s)return Qn(e,"text/plain");var a=s(e,n);if(vi.hasOwnProperty(n.name)){var m=vi[n.name];for(var B in m){if(!m.hasOwnProperty(B))continue;a.hasOwnProperty(B)&&(a["_"+B]=a[B]),a[B]=m[B]}}if(a.name=n.name,n.helperType&&(a.helperType=n.helperType),n.modeProps)for(var J in n.modeProps)a[J]=n.modeProps[J];return a}var vi={};function hi(e,n){var s=vi.hasOwnProperty(e)?vi[e]:vi[e]={};x(n,s)}function bi(e,n){if(n===!0)return n;if(e.copyState)return e.copyState(n);var s={};for(var a in n){var m=n[a];m instanceof Array&&(m=m.concat([])),s[a]=m}return s}function yi(e,n){for(var s;e.innerMode&&!(s=e.innerMode(n),!s||s.mode==e);)n=s.state,e=s.mode;return s||{mode:e,state:n}}function Fi(e,n,s){return e.startState?e.startState(n,s):!0}var ai=function(e,n,s){this.pos=this.start=0,this.string=e,this.tabSize=n||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=s};ai.prototype.eol=function(){return this.pos>=this.string.length},ai.prototype.sol=function(){return this.pos==this.lineStart},ai.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},ai.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},ai.prototype.eat=function(e){var n=this.string.charAt(this.pos),s;if(typeof e=="string"?s=n==e:s=n&&(e.test?e.test(n):e(n)),s)return++this.pos,n},ai.prototype.eatWhile=function(e){for(var n=this.pos;this.eat(e););return this.pos>n},ai.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},ai.prototype.skipToEnd=function(){this.pos=this.string.length},ai.prototype.skipTo=function(e){var n=this.string.indexOf(e,this.pos);if(n>-1)return this.pos=n,!0},ai.prototype.backUp=function(e){this.pos-=e},ai.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=j(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?j(this.string,this.lineStart,this.tabSize):0)},ai.prototype.indentation=function(){return j(this.string,null,this.tabSize)-(this.lineStart?j(this.string,this.lineStart,this.tabSize):0)},ai.prototype.match=function(e,n,s){if(typeof e=="string"){var a=function(J){return s?J.toLowerCase():J},m=this.string.substr(this.pos,e.length);if(a(m)==a(e))return n!==!1&&(this.pos+=e.length),!0}else{var B=this.string.slice(this.pos).match(e);return B&&B.index>0?null:(B&&n!==!1&&(this.pos+=B[0].length),B)}},ai.prototype.current=function(){return this.string.slice(this.start,this.pos)},ai.prototype.hideFirstChars=function(e,n){this.lineStart+=e;try{return n()}finally{this.lineStart-=e}},ai.prototype.lookAhead=function(e){var n=this.lineOracle;return n&&n.lookAhead(e)},ai.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function pt(e,n){if(n-=e.first,n<0||n>=e.size)throw new Error("There is no line "+(n+e.first)+" in the document.");for(var s=e;!s.lines;)for(var a=0;;++a){var m=s.children[a],B=m.chunkSize();if(n<B){s=m;break}n-=B}return s.lines[n]}function Je(e,n,s){var a=[],m=n.line;return e.iter(n.line,s.line+1,function(B){var J=B.text;m==s.line&&(J=J.slice(0,s.ch)),m==n.line&&(J=J.slice(n.ch)),a.push(J),++m}),a}function Ft(e,n,s){var a=[];return e.iter(n,s,function(m){a.push(m.text)}),a}function Bt(e,n){var s=n-e.height;if(s)for(var a=e;a;a=a.parent)a.height+=s}function Fe(e){if(e.parent==null)return null;for(var n=e.parent,s=ae(n.lines,e),a=n.parent;a;n=a,a=a.parent)for(var m=0;!(a.children[m]==n);++m)s+=a.children[m].chunkSize();return s+n.first}function ue(e,n){var s=e.first;e:do{for(var a=0;a<e.children.length;++a){var m=e.children[a],B=m.height;if(n<B){e=m;continue e}n-=B,s+=m.chunkSize()}return s}while(!e.lines);for(var J=0;J<e.lines.length;++J){var re=e.lines[J],se=re.height;if(n<se)break;n-=se}return s+J}function si(e,n){return n>=e.first&&n<e.first+e.size}function je(e,n){return String(e.lineNumberFormatter(n+e.firstLineNumber))}function Be(e,n,s){if(s===void 0&&(s=null),!(this instanceof Be))return new Be(e,n,s);this.line=e,this.ch=n,this.sticky=s}function Ie(e,n){return e.line-n.line||e.ch-n.ch}function _e(e,n){return e.sticky==n.sticky&&Ie(e,n)==0}function An(e){return Be(e.line,e.ch)}function zn(e,n){return Ie(e,n)<0?n:e}function Pn(e,n){return Ie(e,n)<0?e:n}function Q(e,n){return Math.max(e.first,Math.min(n,e.first+e.size-1))}function C(e,n){if(n.line<e.first)return Be(e.first,0);var s=e.first+e.size-1;return n.line>s?Be(s,pt(e,s).text.length):L(n,pt(e,n.line).text.length)}function L(e,n){var s=e.ch;return s==null||s>n?Be(e.line,n):s<0?Be(e.line,0):e}function z(e,n){for(var s=[],a=0;a<n.length;a++)s[a]=C(e,n[a]);return s}var oe=function(e,n){this.state=e,this.lookAhead=n},q=function(e,n,s,a){this.state=n,this.doc=e,this.line=s,this.maxLookAhead=a||0,this.baseTokens=null,this.baseTokenPos=1};q.prototype.lookAhead=function(e){var n=this.doc.getLine(this.line+e);return n!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),n},q.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var n=this.baseTokens[this.baseTokenPos+1];return{type:n&&n.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},q.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},q.fromSaved=function(e,n,s){return n instanceof oe?new q(e,bi(e.mode,n.state),s,n.lookAhead):new q(e,bi(e.mode,n),s)},q.prototype.save=function(e){var n=e!==!1?bi(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new oe(n,this.maxLookAhead):n};function ke(e,n,s,a){var m=[e.state.modeGen],B={};Hn(e,n.text,e.doc.mode,s,function(ge,Ne){return m.push(ge,Ne)},B,a);for(var J=s.state,re=function(ge){s.baseTokens=m;var Ne=e.state.overlays[ge],Ve=1,ht=0;s.state=!0,Hn(e,n.text,Ne.mode,s,function(lt,Ht){for(var ln=Ve;ht<lt;){var xn=m[Ve];xn>lt&&m.splice(Ve,1,lt,m[Ve+1],xn),Ve+=2,ht=Math.min(lt,xn)}if(!Ht)return;if(Ne.opaque)m.splice(ln,Ve-ln,lt,"overlay "+Ht),Ve=ln+2;else for(;ln<Ve;ln+=2){var Kn=m[ln+1];m[ln+1]=(Kn?Kn+" ":"")+"overlay "+Ht}},B),s.state=J,s.baseTokens=null,s.baseTokenPos=1},se=0;se<e.state.overlays.length;++se)re(se);return{styles:m,classes:B.bgClass||B.textClass?B:null}}function ft(e,n,s){if(!n.styles||n.styles[0]!=e.state.modeGen){var a=kt(e,Fe(n)),m=n.text.length>e.options.maxHighlightLength&&bi(e.doc.mode,a.state),B=ke(e,n,a);m&&(a.state=m),n.stateAfter=a.save(!m),n.styles=B.styles,B.classes?n.styleClasses=B.classes:n.styleClasses&&(n.styleClasses=null),s===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return n.styles}function kt(e,n,s){var a=e.doc,m=e.display;if(!a.mode.startState)return new q(a,!0,n);var B=Fn(e,n,s),J=B>a.first&&pt(a,B-1).stateAfter,re=J?q.fromSaved(a,J,B):new q(a,Fi(a.mode),B);return a.iter(B,n,function(se){an(e,se.text,re);var ge=re.line;se.stateAfter=ge==n-1||ge%5==0||ge>=m.viewFrom&&ge<m.viewTo?re.save():null,re.nextLine()}),s&&(a.modeFrontier=re.line),re}function an(e,n,s,a){var m=e.doc.mode,B=new ai(n,e.options.tabSize,s);for(B.start=B.pos=a||0,n==""&&dt(m,s.state);!B.eol();)Pt(m,B,s.state),B.start=B.pos}function dt(e,n){if(e.blankLine)return e.blankLine(n);if(!e.innerMode)return;var s=yi(e,n);if(s.mode.blankLine)return s.mode.blankLine(s.state)}function Pt(e,n,s,a){for(var m=0;m<10;m++){a&&(a[0]=yi(e,s).mode);var B=e.token(n,s);if(n.pos>n.start)return B}throw new Error("Mode "+e.name+" failed to advance stream.")}var tn=function(e,n,s){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=n||null,this.state=s};function Vn(e,n,s,a){var m=e.doc,B=m.mode,J;n=C(m,n);var re=pt(m,n.line),se=kt(e,n.line,s),ge=new ai(re.text,e.options.tabSize,se),Ne;for(a&&(Ne=[]);(a||ge.pos<n.ch)&&!ge.eol();)ge.start=ge.pos,J=Pt(B,ge,se.state),a&&Ne.push(new tn(ge,J,bi(m.mode,se.state)));return a?Ne:new tn(ge,J,se.state)}function fi(e,n){if(e)for(;;){var s=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!s)break;e=e.slice(0,s.index)+e.slice(s.index+s[0].length);var a=s[1]?"bgClass":"textClass";n[a]==null?n[a]=s[2]:new RegExp("(?:^|\\s)"+s[2]+"(?:$|\\s)").test(n[a])||(n[a]+=" "+s[2])}return e}function Hn(e,n,s,a,m,B,J){var re=s.flattenSpans;re==null&&(re=e.options.flattenSpans);var se=0,ge=null,Ne=new ai(n,e.options.tabSize,a),Ve,ht=e.options.addModeClass&&[null];for(n==""&&fi(dt(s,a.state),B);!Ne.eol();){if(Ne.pos>e.options.maxHighlightLength?(re=!1,J&&an(e,n,a,Ne.pos),Ne.pos=n.length,Ve=null):Ve=fi(Pt(s,Ne,a.state,ht),B),ht){var lt=ht[0].name;lt&&(Ve="m-"+(Ve?lt+" "+Ve:lt))}if(!re||ge!=Ve){for(;se<Ne.start;)se=Math.min(Ne.start,se+5e3),m(se,ge);ge=Ve}Ne.start=Ne.pos}for(;se<Ne.pos;){var Ht=Math.min(Ne.pos,se+5e3);m(Ht,ge),se=Ht}}function Fn(e,n,s){for(var a,m,B=e.doc,J=s?-1:n-(e.doc.mode.innerMode?1e3:100),re=n;re>J;--re){if(re<=B.first)return B.first;var se=pt(B,re-1),ge=se.stateAfter;if(ge&&(!s||re+(ge instanceof oe?ge.lookAhead:0)<=B.modeFrontier))return re;var Ne=j(se.text,null,e.options.tabSize);(m==null||a>Ne)&&(m=re-1,a=Ne)}return m}function Qt(e,n){if(e.modeFrontier=Math.min(e.modeFrontier,n),e.highlightFrontier<n-10)return;for(var s=e.first,a=n-1;a>s;a--){var m=pt(e,a).stateAfter;if(m&&(!(m instanceof oe)||a+m.lookAhead<n)){s=a+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,s)}var hn=!1,on=!1;function Nt(){hn=!0}function $n(){on=!0}function jn(e,n,s){this.marker=e,this.from=n,this.to=s}function Tn(e,n){if(e)for(var s=0;s<e.length;++s){var a=e[s];if(a.marker==n)return a}}function qn(e,n){for(var s,a=0;a<e.length;++a)e[a]!=n&&(s||(s=[])).push(e[a]);return s}function En(e,n){e.markedSpans=e.markedSpans?e.markedSpans.concat([n]):[n],n.marker.attachLine(e)}function In(e,n,s){var a;if(e)for(var m=0;m<e.length;++m){var B=e[m],J=B.marker,re=B.from==null||(J.inclusiveLeft?B.from<=n:B.from<n);if(re||B.from==n&&J.type=="bookmark"&&(!s||!B.marker.insertLeft)){var se=B.to==null||(J.inclusiveRight?B.to>=n:B.to>n);(a||(a=[])).push(new jn(J,B.from,se?null:B.to))}}return a}function gn(e,n,s){var a;if(e)for(var m=0;m<e.length;++m){var B=e[m],J=B.marker,re=B.to==null||(J.inclusiveRight?B.to>=n:B.to>n);if(re||B.from==n&&J.type=="bookmark"&&(!s||B.marker.insertLeft)){var se=B.from==null||(J.inclusiveLeft?B.from<=n:B.from<n);(a||(a=[])).push(new jn(J,se?null:B.from-n,B.to==null?null:B.to-n))}}return a}function Bn(e,n){if(n.full)return null;var s=si(e,n.from.line)&&pt(e,n.from.line).markedSpans,a=si(e,n.to.line)&&pt(e,n.to.line).markedSpans;if(!s&&!a)return null;var m=n.from.ch,B=n.to.ch,J=Ie(n.from,n.to)==0,re=In(s,m,J),se=gn(a,B,J),ge=n.text.length==1,Ne=te(n.text).length+(ge?m:0);if(re)for(var Ve=0;Ve<re.length;++Ve){var ht=re[Ve];if(ht.to==null){var lt=Tn(se,ht.marker);lt?ge&&(ht.to=lt.to==null?null:lt.to+Ne):ht.to=m}}if(se)for(var Ht=0;Ht<se.length;++Ht){var ln=se[Ht];if(ln.to!=null&&(ln.to+=Ne),ln.from==null){var xn=Tn(re,ln.marker);xn||(ln.from=Ne,ge&&(re||(re=[])).push(ln))}else ln.from+=Ne,ge&&(re||(re=[])).push(ln)}re&&(re=Xn(re)),se&&se!=re&&(se=Xn(se));var Kn=[re];if(!ge){var ri=n.text.length-2,Gn;if(ri>0&&re)for(var di=0;di<re.length;++di)re[di].to==null&&(Gn||(Gn=[])).push(new jn(re[di].marker,null,null));for(var Ri=0;Ri<ri;++Ri)Kn.push(Gn);Kn.push(se)}return Kn}function Xn(e){for(var n=0;n<e.length;++n){var s=e[n];s.from!=null&&s.from==s.to&&s.marker.clearWhenEmpty!==!1&&e.splice(n--,1)}return e.length?e:null}function Zn(e,n,s){var a=null;if(e.iter(n.line,s.line+1,function(lt){if(lt.markedSpans)for(var Ht=0;Ht<lt.markedSpans.length;++Ht){var ln=lt.markedSpans[Ht].marker;ln.readOnly&&(!a||ae(a,ln)==-1)&&(a||(a=[])).push(ln)}}),!a)return null;for(var m=[{from:n,to:s}],B=0;B<a.length;++B)for(var J=a[B],re=J.find(0),se=0;se<m.length;++se){var ge=m[se];if(Ie(ge.to,re.from)<0||Ie(ge.from,re.to)>0)continue;var Ne=[se,1],Ve=Ie(ge.from,re.from),ht=Ie(ge.to,re.to);(Ve<0||!J.inclusiveLeft&&!Ve)&&Ne.push({from:ge.from,to:re.from}),(ht>0||!J.inclusiveRight&&!ht)&&Ne.push({from:re.to,to:ge.to}),m.splice.apply(m,Ne),se+=Ne.length-3}return m}function Kt(e){var n=e.markedSpans;if(!n)return;for(var s=0;s<n.length;++s)n[s].marker.detachLine(e);e.markedSpans=null}function Lt(e,n){if(!n)return;for(var s=0;s<n.length;++s)n[s].marker.attachLine(e);e.markedSpans=n}function yt(e){return e.inclusiveLeft?-1:0}function It(e){return e.inclusiveRight?1:0}function Ot(e,n){var s=e.lines.length-n.lines.length;if(s!=0)return s;var a=e.find(),m=n.find(),B=Ie(a.from,m.from)||yt(e)-yt(n);if(B)return-B;var J=Ie(a.to,m.to)||It(e)-It(n);return J||n.id-e.id}function Vt(e,n){var s=on&&e.markedSpans,a;if(s)for(var m=void 0,B=0;B<s.length;++B)m=s[B],m.marker.collapsed&&(n?m.from:m.to)==null&&(!a||Ot(a,m.marker)<0)&&(a=m.marker);return a}function Zt(e){return Vt(e,!0)}function Gt(e){return Vt(e,!1)}function Ut(e,n){var s=on&&e.markedSpans,a;if(s)for(var m=0;m<s.length;++m){var B=s[m];B.marker.collapsed&&(B.from==null||B.from<n)&&(B.to==null||B.to>n)&&(!a||Ot(a,B.marker)<0)&&(a=B.marker)}return a}function vn(e,n,s,a,m){var B=pt(e,n),J=on&&B.markedSpans;if(J)for(var re=0;re<J.length;++re){var se=J[re];if(!se.marker.collapsed)continue;var ge=se.marker.find(0),Ne=Ie(ge.from,s)||yt(se.marker)-yt(m),Ve=Ie(ge.to,a)||It(se.marker)-It(m);if(Ne>=0&&Ve<=0||Ne<=0&&Ve>=0)continue;if(Ne<=0&&(se.marker.inclusiveRight&&m.inclusiveLeft?Ie(ge.to,s)>=0:Ie(ge.to,s)>0)||Ne>=0&&(se.marker.inclusiveRight&&m.inclusiveLeft?Ie(ge.from,a)<=0:Ie(ge.from,a)<0))return!0}}function _n(e){for(var n;n=Zt(e);)e=n.find(-1,!0).line;return e}function un(e){for(var n;n=Gt(e);)e=n.find(1,!0).line;return e}function cn(e){for(var n,s;n=Gt(e);)e=n.find(1,!0).line,(s||(s=[])).push(e);return s}function bn(e,n){var s=pt(e,n),a=_n(s);return s==a?n:Fe(a)}function dn(e,n){if(n>e.lastLine())return n;var s=pt(e,n),a;if(!Mt(e,s))return n;for(;a=Gt(s);)s=a.find(1,!0).line;return Fe(s)+1}function Mt(e,n){var s=on&&n.markedSpans;if(s)for(var a=void 0,m=0;m<s.length;++m){if(a=s[m],!a.marker.collapsed)continue;if(a.from==null)return!0;if(a.marker.widgetNode)continue;if(a.from==0&&a.marker.inclusiveLeft&&Yt(e,n,a))return!0}}function Yt(e,n,s){if(s.to==null){var a=s.marker.find(1,!0);return Yt(e,a.line,Tn(a.line.markedSpans,s.marker))}if(s.marker.inclusiveRight&&s.to==n.text.length)return!0;for(var m=void 0,B=0;B<n.markedSpans.length;++B)if(m=n.markedSpans[B],m.marker.collapsed&&!m.marker.widgetNode&&m.from==s.to&&(m.to==null||m.to!=s.from)&&(m.marker.inclusiveLeft||s.marker.inclusiveRight)&&Yt(e,n,m))return!0}function qt(e){e=_n(e);for(var n=0,s=e.parent,a=0;a<s.lines.length;++a){var m=s.lines[a];if(m==e)break;n+=m.height}for(var B=s.parent;B;s=B,B=s.parent)for(var J=0;J<B.children.length;++J){var re=B.children[J];if(re==s)break;n+=re.height}return n}function Wt(e){if(e.height==0)return 0;for(var n=e.text.length,s,a=e;s=Zt(a);){var m=s.find(0,!0);a=m.from.line,n+=m.from.ch-m.to.ch}for(a=e;s=Gt(a);){var B=s.find(0,!0);n-=a.text.length-B.from.ch,a=B.to.line,n+=a.text.length-B.to.ch}return n}function fn(e){var n=e.display,s=e.doc;n.maxLine=pt(s,s.first),n.maxLineLength=Wt(n.maxLine),n.maxLineChanged=!0,s.iter(function(a){var m=Wt(a);m>n.maxLineLength&&(n.maxLineLength=m,n.maxLine=a)})}var On=function(e,n,s){this.text=e,Lt(this,n),this.height=s?s(this):1};On.prototype.lineNo=function(){return Fe(this)},Re(On);function wn(e,n,s,a){e.text=n,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Kt(e),Lt(e,s);var m=a?a(e):1;m!=e.height&&Bt(e,m)}function gt(e){e.parent=null,Kt(e)}var rt={},Xe={};function Ze(e,n){if(!e||/^\s*$/.test(e))return null;var s=n.addModeClass?Xe:rt;return s[e]||(s[e]=e.replace(/\S+/g,"cm-$&"))}function We(e,n){var s=h("span",null,null,k?"padding-right: .1px":null),a={pre:h("pre",[s],"CodeMirror-line"),content:s,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};n.measure={};for(var m=0;m<=(n.rest?n.rest.length:0);m++){var B=m?n.rest[m-1]:n.line,J=void 0;a.pos=0,a.addToken=et,ci(e.display.measure)&&(J=Cn(B,e.doc.direction))&&(a.addToken=jt(a.addToken,J)),a.map=[];var re=n!=e.display.externalMeasured&&Fe(B);Jt(B,a,ft(e,B,re)),B.styleClasses&&(B.styleClasses.bgClass&&(a.bgClass=W(B.styleClasses.bgClass,a.bgClass||"")),B.styleClasses.textClass&&(a.textClass=W(B.styleClasses.textClass,a.textClass||""))),a.map.length==0&&a.map.push(0,0,a.content.appendChild(mn(e.display.measure))),m==0?(n.measure.map=a.map,n.measure.cache={}):((n.measure.maps||(n.measure.maps=[])).push(a.map),(n.measure.caches||(n.measure.caches=[])).push({}))}if(k){var se=a.content.lastChild;(/\bcm-tab\b/.test(se.className)||se.querySelector&&se.querySelector(".cm-tab"))&&(a.content.className="cm-tab-wrap-hack")}return nt(e,"renderLine",e,n.line,a.pre),a.pre.className&&(a.textClass=W(a.pre.className,a.textClass||"")),a}function ct(e){var n=l("span","\u2022","cm-invalidchar");return n.title="\\u"+e.charCodeAt(0).toString(16),n.setAttribute("aria-label",n.title),n}function et(e,n,s,a,m,B,J){if(!n)return;var re=e.splitSpaces?Ct(n,e.trailingSpace):n,se=e.cm.state.specialChars,ge=!1,Ne;if(!se.test(n))e.col+=n.length,Ne=document.createTextNode(re),e.map.push(e.pos,e.pos+n.length,Ne),Y&&X<9&&(ge=!0),e.pos+=n.length;else{Ne=document.createDocumentFragment();for(var Ve=0;;){se.lastIndex=Ve;var ht=se.exec(n),lt=ht?ht.index-Ve:n.length-Ve;if(lt){var Ht=document.createTextNode(re.slice(Ve,Ve+lt));Y&&X<9?Ne.appendChild(l("span",[Ht])):Ne.appendChild(Ht),e.map.push(e.pos,e.pos+lt,Ht),e.col+=lt,e.pos+=lt}if(!ht)break;Ve+=lt+1;var ln=void 0;if(ht[0]==" "){var xn=e.cm.options.tabSize,Kn=xn-e.col%xn;ln=Ne.appendChild(l("span",be(Kn),"cm-tab")),ln.setAttribute("role","presentation"),ln.setAttribute("cm-text"," "),e.col+=Kn}else ht[0]=="\r"||ht[0]==`
|
|
`?(ln=Ne.appendChild(l("span",ht[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),ln.setAttribute("cm-text",ht[0]),e.col+=1):(ln=e.cm.options.specialCharPlaceholder(ht[0]),ln.setAttribute("cm-text",ht[0]),Y&&X<9?Ne.appendChild(l("span",[ln])):Ne.appendChild(ln),e.col+=1);e.map.push(e.pos,e.pos+1,ln),e.pos++}}if(e.trailingSpace=re.charCodeAt(n.length-1)==32,s||a||m||ge||B||J){var ri=s||"";a&&(ri+=a),m&&(ri+=m);var Gn=l("span",[Ne],ri,B);if(J)for(var di in J)J.hasOwnProperty(di)&&di!="style"&&di!="class"&&Gn.setAttribute(di,J[di]);return e.content.appendChild(Gn)}e.content.appendChild(Ne)}function Ct(e,n){if(e.length>1&&!/ /.test(e))return e;for(var s=n,a="",m=0;m<e.length;m++){var B=e.charAt(m);B==" "&&s&&(m==e.length-1||e.charCodeAt(m+1)==32)&&(B="\xA0"),a+=B,s=B==" "}return a}function jt(e,n){return function(s,a,m,B,J,re,se){m=m?m+" cm-force-border":"cm-force-border";for(var ge=s.pos,Ne=ge+a.length;;){for(var Ve=void 0,ht=0;ht<n.length&&!(Ve=n[ht],Ve.to>ge&&Ve.from<=ge);ht++);if(Ve.to>=Ne)return e(s,a,m,B,J,re,se);e(s,a.slice(0,Ve.to-ge),m,B,null,re,se),B=null,a=a.slice(Ve.to-ge),ge=Ve.to}}}function wt(e,n,s,a){var m=!a&&s.widgetNode;m&&e.map.push(e.pos,e.pos+n,m),!a&&e.cm.display.input.needsContentAttribute&&(m||(m=e.content.appendChild(document.createElement("span"))),m.setAttribute("cm-marker",s.id)),m&&(e.cm.display.input.setUneditable(m),e.content.appendChild(m)),e.pos+=n,e.trailingSpace=!1}function Jt(e,n,s){var a=e.markedSpans,m=e.text,B=0;if(!a){for(var J=1;J<s.length;J+=2)n.addToken(n,m.slice(B,B=s[J]),Ze(s[J+1],n.cm.options));return}for(var re=m.length,se=0,ge=1,Ne="",Ve,ht,lt=0,Ht,ln,xn,Kn,ri;;){if(lt==se){Ht=ln=xn=ht="",ri=null,Kn=null,lt=Infinity;for(var Gn=[],di=void 0,Ri=0;Ri<a.length;++Ri){var Si=a[Ri],Di=Si.marker;if(Di.type=="bookmark"&&Si.from==se&&Di.widgetNode)Gn.push(Di);else if(Si.from<=se&&(Si.to==null||Si.to>se||Di.collapsed&&Si.to==se&&Si.from==se)){if(Si.to!=null&&Si.to!=se&<>Si.to&&(lt=Si.to,ln=""),Di.className&&(Ht+=" "+Di.className),Di.css&&(ht=(ht?ht+";":"")+Di.css),Di.startStyle&&Si.from==se&&(xn+=" "+Di.startStyle),Di.endStyle&&Si.to==lt&&(di||(di=[])).push(Di.endStyle,Si.to),Di.title&&((ri||(ri={})).title=Di.title),Di.attributes)for(var Wi in Di.attributes)(ri||(ri={}))[Wi]=Di.attributes[Wi];Di.collapsed&&(!Kn||Ot(Kn.marker,Di)<0)&&(Kn=Si)}else Si.from>se&<>Si.from&&(lt=Si.from)}if(di)for(var ir=0;ir<di.length;ir+=2)di[ir+1]==lt&&(ln+=" "+di[ir]);if(!Kn||Kn.from==se)for(var zi=0;zi<Gn.length;++zi)wt(n,0,Gn[zi]);if(Kn&&(Kn.from||0)==se){if(wt(n,(Kn.to==null?re+1:Kn.to)-se,Kn.marker,Kn.from==null),Kn.to==null)return;Kn.to==se&&(Kn=!1)}}if(se>=re)break;for(var Er=Math.min(re,lt);;){if(Ne){var vr=se+Ne.length;if(!Kn){var Qi=vr>Er?Ne.slice(0,Er-se):Ne;n.addToken(n,Qi,Ve?Ve+Ht:Ht,xn,se+Qi.length==lt?ln:"",ht,ri)}if(vr>=Er){Ne=Ne.slice(Er-se),se=Er;break}se=vr,xn=""}Ne=m.slice(B,B=s[ge++]),Ve=Ze(s[ge++],n.cm.options)}}}function Tt(e,n,s){this.line=n,this.rest=cn(n),this.size=this.rest?Fe(te(this.rest))-s+1:1,this.node=this.text=null,this.hidden=Mt(e,n)}function At(e,n,s){for(var a=[],m,B=n;B<s;B=m){var J=new Tt(e.doc,pt(e.doc,B),B);m=B+J.size,a.push(J)}return a}var Rn=null;function yn(e){Rn?Rn.ops.push(e):e.ownsGroup=Rn={ops:[e],delayedCallbacks:[]}}function mi(e){var n=e.delayedCallbacks,s=0;do{for(;s<n.length;s++)n[s].call(null);for(var a=0;a<e.ops.length;a++){var m=e.ops[a];if(m.cursorActivityHandlers)for(;m.cursorActivityCalled<m.cursorActivityHandlers.length;)m.cursorActivityHandlers[m.cursorActivityCalled++].call(null,m.cm)}}while(s<n.length)}function ei(e,n){var s=e.ownsGroup;if(!s)return;try{mi(s)}finally{Rn=null,n(s)}}var ti=null;function nn(e,n){var s=St(e,n);if(!s.length)return;var a=Array.prototype.slice.call(arguments,2),m;Rn?m=Rn.delayedCallbacks:ti?m=ti:(m=ti=[],setTimeout(kn,0));for(var B=function(re){m.push(function(){return s[re].apply(null,a)})},J=0;J<s.length;++J)B(J)}function kn(){var e=ti;ti=null;for(var n=0;n<e.length;++n)e[n]()}function Yn(e,n,s,a){for(var m=0;m<n.changes.length;m++){var B=n.changes[m];B=="text"?ji(e,n):B=="gutter"?oi(e,n,s,a):B=="class"?Ci(e,n):B=="widget"&&wi(e,n,a)}n.changes=null}function ni(e){return e.node==e.text&&(e.node=l("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),Y&&X<8&&(e.node.style.zIndex=2)),e.node}function Mn(e,n){var s=n.bgClass?n.bgClass+" "+(n.line.bgClass||""):n.line.bgClass;if(s&&(s+=" CodeMirror-linebackground"),n.background)s?n.background.className=s:(n.background.parentNode.removeChild(n.background),n.background=null);else if(s){var a=ni(n);n.background=a.insertBefore(l("div",null,s),a.firstChild),e.display.input.setUneditable(n.background)}}function Li(e,n){var s=e.display.externalMeasured;return s&&s.line==n.line?(e.display.externalMeasured=null,n.measure=s.measure,s.built):We(e,n)}function ji(e,n){var s=n.text.className,a=Li(e,n);n.text==n.node&&(n.node=a.pre),n.text.parentNode.replaceChild(a.pre,n.text),n.text=a.pre,a.bgClass!=n.bgClass||a.textClass!=n.textClass?(n.bgClass=a.bgClass,n.textClass=a.textClass,Ci(e,n)):s&&(n.text.className=s)}function Ci(e,n){Mn(e,n),n.line.wrapClass?ni(n).className=n.line.wrapClass:n.node!=n.text&&(n.node.className="");var s=n.textClass?n.textClass+" "+(n.line.textClass||""):n.line.textClass;n.text.className=s||""}function oi(e,n,s,a){if(n.gutter&&(n.node.removeChild(n.gutter),n.gutter=null),n.gutterBackground&&(n.node.removeChild(n.gutterBackground),n.gutterBackground=null),n.line.gutterClass){var m=ni(n);n.gutterBackground=l("div",null,"CodeMirror-gutter-background "+n.line.gutterClass,"left: "+(e.options.fixedGutter?a.fixedPos:-a.gutterTotalWidth)+"px; width: "+a.gutterTotalWidth+"px"),e.display.input.setUneditable(n.gutterBackground),m.insertBefore(n.gutterBackground,n.text)}var B=n.line.gutterMarkers;if(e.options.lineNumbers||B){var J=ni(n),re=n.gutter=l("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?a.fixedPos:-a.gutterTotalWidth)+"px");if(e.display.input.setUneditable(re),J.insertBefore(re,n.text),n.line.gutterClass&&(re.className+=" "+n.line.gutterClass),e.options.lineNumbers&&(!B||!B["CodeMirror-linenumbers"])&&(n.lineNumber=re.appendChild(l("div",je(e.options,s),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+a.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),B)for(var se=0;se<e.display.gutterSpecs.length;++se){var ge=e.display.gutterSpecs[se].className,Ne=B.hasOwnProperty(ge)&&B[ge];Ne&&re.appendChild(l("div",[Ne],"CodeMirror-gutter-elt","left: "+a.gutterLeft[ge]+"px; width: "+a.gutterWidth[ge]+"px"))}}}function wi(e,n,s){n.alignable&&(n.alignable=null);for(var a=O("CodeMirror-linewidget"),m=n.node.firstChild,B=void 0;m;m=B)B=m.nextSibling,a.test(m.className)&&n.node.removeChild(m);Ti(e,n,s)}function Ei(e,n,s,a){var m=Li(e,n);return n.text=n.node=m.pre,m.bgClass&&(n.bgClass=m.bgClass),m.textClass&&(n.textClass=m.textClass),Ci(e,n),oi(e,n,s,a),Ti(e,n,a),n.node}function Ti(e,n,s){if(Ni(e,n.line,n,s,!0),n.rest)for(var a=0;a<n.rest.length;a++)Ni(e,n.rest[a],n,s,!1)}function Ni(e,n,s,a,m){if(!n.widgets)return;for(var B=ni(s),J=0,re=n.widgets;J<re.length;++J){var se=re[J],ge=l("div",[se.node],"CodeMirror-linewidget"+(se.className?" "+se.className:""));se.handleMouseEvents||ge.setAttribute("cm-ignore-events","true"),Vi(se,ge,s,a),e.display.input.setUneditable(ge),m&&se.above?B.insertBefore(ge,s.gutter||s.text):B.appendChild(ge),nn(se,"redraw")}}function Vi(e,n,s,a){if(e.noHScroll){(s.alignable||(s.alignable=[])).push(n);var m=a.wrapperWidth;n.style.left=a.fixedPos+"px",e.coverGutter||(m-=a.gutterTotalWidth,n.style.paddingLeft=a.gutterTotalWidth+"px"),n.style.width=m+"px"}e.coverGutter&&(n.style.zIndex=5,n.style.position="relative",e.noHScroll||(n.style.marginLeft=-a.gutterTotalWidth+"px"))}function Ui(e){if(e.height!=null)return e.height;var n=e.doc.cm;if(!n)return 0;if(!b(document.body,e.node)){var s="position: relative;";e.coverGutter&&(s+="margin-left: -"+n.display.gutters.offsetWidth+"px;"),e.noHScroll&&(s+="width: "+n.display.wrapper.clientWidth+"px;"),d(n.display.measure,l("div",[e.node],null,s))}return e.height=e.node.parentNode.offsetHeight}function Ii(e,n){for(var s=Pe(n);s!=e.wrapper;s=s.parentNode)if(!s||s.nodeType==1&&s.getAttribute("cm-ignore-events")=="true"||s.parentNode==e.sizer&&s!=e.mover)return!0}function Tr(e){return e.lineSpace.offsetTop}function Ki(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Sr(e){if(e.cachedPaddingH)return e.cachedPaddingH;var n=d(e.measure,l("pre","x","CodeMirror-line-like")),s=window.getComputedStyle?window.getComputedStyle(n):n.currentStyle,a={left:parseInt(s.paddingLeft),right:parseInt(s.paddingRight)};return!isNaN(a.left)&&!isNaN(a.right)&&(e.cachedPaddingH=a),a}function Ji(e){return fe-e.display.nativeBarWidth}function er(e){return e.display.scroller.clientWidth-Ji(e)-e.display.barWidth}function yr(e){return e.display.scroller.clientHeight-Ji(e)-e.display.barHeight}function Or(e,n,s){var a=e.options.lineWrapping,m=a&&er(e);if(!n.measure.heights||a&&n.measure.width!=m){var B=n.measure.heights=[];if(a){n.measure.width=m;for(var J=n.text.firstChild.getClientRects(),re=0;re<J.length-1;re++){var se=J[re],ge=J[re+1];Math.abs(se.bottom-ge.bottom)>2&&B.push((se.bottom+ge.top)/2-s.top)}}B.push(s.bottom-s.top)}}function Va(e,n,s){if(e.line==n)return{map:e.measure.map,cache:e.measure.cache};for(var a=0;a<e.rest.length;a++)if(e.rest[a]==n)return{map:e.measure.maps[a],cache:e.measure.caches[a]};for(var m=0;m<e.rest.length;m++)if(Fe(e.rest[m])>s)return{map:e.measure.maps[m],cache:e.measure.caches[m],before:!0}}function fr(e,n){n=_n(n);var s=Fe(n),a=e.display.externalMeasured=new Tt(e.doc,n,s);a.lineN=s;var m=a.built=We(e,a);return a.text=m.pre,d(e.display.lineMeasure,m.pre),a}function Xa(e,n,s,a){return ar(e,kr(e,n),s,a)}function Kr(e,n){if(n>=e.display.viewFrom&&n<e.display.viewTo)return e.display.view[zr(e,n)];var s=e.display.externalMeasured;if(s&&n>=s.lineN&&n<s.lineN+s.size)return s}function kr(e,n){var s=Fe(n),a=Kr(e,s);a&&!a.text?a=null:a&&a.changes&&(Yn(e,a,s,Do(e)),e.curOp.forceUpdate=!0),a||(a=fr(e,n));var m=Va(a,n,s);return{line:n,view:a,rect:null,map:m.map,cache:m.cache,before:m.before,hasHeights:!1}}function ar(e,n,s,a,m){n.before&&(s=-1);var B=s+(a||""),J;return n.cache.hasOwnProperty(B)?J=n.cache[B]:(n.rect||(n.rect=n.view.text.getBoundingClientRect()),n.hasHeights||(Or(e,n.view,n.rect),n.hasHeights=!0),J=xo(e,n,s,a),J.bogus||(n.cache[B]=J)),{left:J.left,right:J.right,top:m?J.rtop:J.top,bottom:m?J.rbottom:J.bottom}}var qr={left:0,right:0,top:0,bottom:0};function bo(e,n,s){for(var a,m,B,J,re,se,ge=0;ge<e.length;ge+=3)if(re=e[ge],se=e[ge+1],n<re?(m=0,B=1,J="left"):n<se?(m=n-re,B=m+1):(ge==e.length-3||n==se&&e[ge+3]>n)&&(B=se-re,m=B-1,n>=se&&(J="right")),m!=null){if(a=e[ge+2],re==se&&s==(a.insertLeft?"left":"right")&&(J=s),s=="left"&&m==0)for(;ge&&e[ge-2]==e[ge-3]&&e[ge-1].insertLeft;)a=e[(ge-=3)+2],J="left";if(s=="right"&&m==se-re)for(;ge<e.length-3&&e[ge+3]==e[ge+4]&&!e[ge+5].insertLeft;)a=e[(ge+=3)+2],J="right";break}return{node:a,start:m,end:B,collapse:J,coverStart:re,coverEnd:se}}function Eo(e,n){var s=qr;if(n=="left")for(var a=0;a<e.length&&!((s=e[a]).left!=s.right);a++);else for(var m=e.length-1;m>=0&&!((s=e[m]).left!=s.right);m--);return s}function xo(e,n,s,a){var m=bo(n.map,s,a),B=m.node,J=m.start,re=m.end,se=m.collapse,ge;if(B.nodeType==3){for(var Ne=0;Ne<4;Ne++){for(;J&&mt(n.line.text.charAt(m.coverStart+J));)--J;for(;m.coverStart+re<m.coverEnd&&mt(n.line.text.charAt(m.coverStart+re));)++re;if(Y&&X<9&&J==0&&re==m.coverEnd-m.coverStart?ge=B.parentNode.getBoundingClientRect():ge=Eo(g(B,J,re).getClientRects(),a),ge.left||ge.right||J==0)break;re=J,J=J-1,se="right"}Y&&X<11&&(ge=cs(e.display.measure,ge))}else{J>0&&(se=a="right");var Ve;e.options.lineWrapping&&(Ve=B.getClientRects()).length>1?ge=Ve[a=="right"?Ve.length-1:0]:ge=B.getBoundingClientRect()}if(Y&&X<9&&!J&&(!ge||!ge.left&&!ge.right)){var ht=B.parentNode.getClientRects()[0];ht?ge={left:ht.left,right:ht.left+Zr(e.display),top:ht.top,bottom:ht.bottom}:ge=qr}for(var lt=ge.top-n.rect.top,Ht=ge.bottom-n.rect.top,ln=(lt+Ht)/2,xn=n.view.measure.heights,Kn=0;Kn<xn.length-1&&!(ln<xn[Kn]);Kn++);var ri=Kn?xn[Kn-1]:0,Gn=xn[Kn],di={left:(se=="right"?ge.right:ge.left)-n.rect.left,right:(se=="left"?ge.left:ge.right)-n.rect.left,top:ri,bottom:Gn};return!ge.left&&!ge.right&&(di.bogus=!0),e.options.singleCursorHeightPerLine||(di.rtop=lt,di.rbottom=Ht),di}function cs(e,n){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!xi(e))return n;var s=screen.logicalXDPI/screen.deviceXDPI,a=screen.logicalYDPI/screen.deviceYDPI;return{left:n.left*s,right:n.right*s,top:n.top*a,bottom:n.bottom*a}}function hs(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var n=0;n<e.rest.length;n++)e.measure.caches[n]={}}function Co(e){e.display.externalMeasure=null,y(e.display.lineMeasure);for(var n=0;n<e.display.view.length;n++)hs(e.display.view[n])}function wa(e){Co(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function fs(){return v&&i?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ps(){return v&&i?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function wo(e){var n=0;if(e.widgets)for(var s=0;s<e.widgets.length;++s)e.widgets[s].above&&(n+=Ui(e.widgets[s]));return n}function Ya(e,n,s,a,m){if(!m){var B=wo(n);s.top+=B,s.bottom+=B}if(a=="line")return s;a||(a="local");var J=qt(n);if(a=="local"?J+=Tr(e.display):J-=e.display.viewOffset,a=="page"||a=="window"){var re=e.display.lineSpace.getBoundingClientRect();J+=re.top+(a=="window"?0:ps());var se=re.left+(a=="window"?0:fs());s.left+=se,s.right+=se}return s.top+=J,s.bottom+=J,s}function To(e,n,s){if(s=="div")return n;var a=n.left,m=n.top;if(s=="page")a-=fs(),m-=ps();else if(s=="local"||!s){var B=e.display.sizer.getBoundingClientRect();a+=B.left,m+=B.top}var J=e.display.lineSpace.getBoundingClientRect();return{left:a-J.left,top:m-J.top}}function So(e,n,s,a,m){return a||(a=pt(e.doc,n.line)),Ya(e,a,Xa(e,a,n.ch,m),s)}function xr(e,n,s,a,m,B){a=a||pt(e.doc,n.line),m||(m=kr(e,a));function J(Ht,ln){var xn=ar(e,m,Ht,ln?"right":"left",B);return ln?xn.left=xn.right:xn.right=xn.left,Ya(e,a,xn,s)}var re=Cn(a,e.doc.direction),se=n.ch,ge=n.sticky;if(se>=a.text.length?(se=a.text.length,ge="before"):se<=0&&(se=0,ge="after"),!re)return J(ge=="before"?se-1:se,ge=="before");function Ne(Ht,ln,xn){var Kn=re[ln],ri=Kn.level==1;return J(xn?Ht-1:Ht,ri!=xn)}var Ve=pn(re,se,ge),ht=sn,lt=Ne(se,Ve,ge=="before");return ht!=null&&(lt.other=Ne(se,ht,ge!="before")),lt}function ms(e,n){var s=0;n=C(e.doc,n),e.options.lineWrapping||(s=Zr(e.display)*n.ch);var a=pt(e.doc,n.line),m=qt(a)+Tr(e.display);return{left:s,right:s,top:m,bottom:m+a.height}}function Oo(e,n,s,a,m){var B=Be(e,n,s);return B.xRel=m,a&&(B.outside=a),B}function Ro(e,n,s){var a=e.doc;if(s+=e.display.viewOffset,s<0)return Oo(a.first,0,null,-1,-1);var m=ue(a,s),B=a.first+a.size-1;if(m>B)return Oo(a.first+a.size-1,pt(a,B).text.length,null,1,1);n<0&&(n=0);for(var J=pt(a,m);;){var re=El(e,J,m,n,s),se=Ut(J,re.ch+(re.xRel>0||re.outside>0?1:0));if(!se)return re;var ge=se.find(1);if(ge.line==m)return ge;J=pt(a,m=ge.line)}}function vs(e,n,s,a){a-=wo(n);var m=n.text.length,B=Xt(function(J){return ar(e,s,J-1).bottom<=a},m,0);return m=Xt(function(J){return ar(e,s,J).top>a},B,m),{begin:B,end:m}}function gs(e,n,s,a){s||(s=kr(e,n));var m=Ya(e,n,ar(e,s,a),"line").top;return vs(e,n,s,m)}function Ao(e,n,s,a){return e.bottom<=s?!1:e.top>s?!0:(a?e.left:e.right)>n}function El(e,n,s,a,m){m-=qt(n);var B=kr(e,n),J=wo(n),re=0,se=n.text.length,ge=!0,Ne=Cn(n,e.doc.direction);if(Ne){var Ve=(e.options.lineWrapping?$a:Ta)(e,n,s,B,Ne,a,m);ge=Ve.level!=1,re=ge?Ve.from:Ve.to-1,se=ge?Ve.to:Ve.from-1}var ht=null,lt=null,Ht=Xt(function(Ri){var Si=ar(e,B,Ri);return Si.top+=J,Si.bottom+=J,Ao(Si,a,m,!1)?(Si.top<=m&&Si.left<=a&&(ht=Ri,lt=Si),!0):!1},re,se),ln,xn,Kn=!1;if(lt){var ri=a-lt.left<lt.right-a,Gn=ri==ge;Ht=ht+(Gn?0:1),xn=Gn?"after":"before",ln=ri?lt.left:lt.right}else{!ge&&(Ht==se||Ht==re)&&Ht++,xn=Ht==0?"after":Ht==n.text.length?"before":ar(e,B,Ht-(ge?1:0)).bottom+J<=m==ge?"after":"before";var di=xr(e,Be(s,Ht,xn),"line",n,B);ln=di.left,Kn=m<di.top?-1:m>=di.bottom?1:0}return Ht=ut(n.text,Ht,1),Oo(s,Ht,xn,Kn,a-ln)}function Ta(e,n,s,a,m,B,J){var re=Xt(function(Ve){var ht=m[Ve],lt=ht.level!=1;return Ao(xr(e,Be(s,lt?ht.to:ht.from,lt?"before":"after"),"line",n,a),B,J,!0)},0,m.length-1),se=m[re];if(re>0){var ge=se.level!=1,Ne=xr(e,Be(s,ge?se.from:se.to,ge?"after":"before"),"line",n,a);Ao(Ne,B,J,!0)&&Ne.top>J&&(se=m[re-1])}return se}function $a(e,n,s,a,m,B,J){var re=vs(e,n,a,J),se=re.begin,ge=re.end;/\s/.test(n.text.charAt(ge-1))&&ge--;for(var Ne=null,Ve=null,ht=0;ht<m.length;ht++){var lt=m[ht];if(lt.from>=ge||lt.to<=se)continue;var Ht=lt.level!=1,ln=ar(e,a,Ht?Math.min(ge,lt.to)-1:Math.max(se,lt.from)).right,xn=ln<B?B-ln+1e9:ln-B;(!Ne||Ve>xn)&&(Ne=lt,Ve=xn)}return Ne||(Ne=m[m.length-1]),Ne.from<se&&(Ne={from:se,to:Ne.to,level:Ne.level}),Ne.to>ge&&(Ne={from:Ne.from,to:ge,level:Ne.level}),Ne}var Rr;function Jr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Rr==null){Rr=l("pre",null,"CodeMirror-line-like");for(var n=0;n<49;++n)Rr.appendChild(document.createTextNode("x")),Rr.appendChild(l("br"));Rr.appendChild(document.createTextNode("x"))}d(e.measure,Rr);var s=Rr.offsetHeight/50;return s>3&&(e.cachedTextHeight=s),y(e.measure),s||1}function Zr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var n=l("span","xxxxxxxxxx"),s=l("pre",[n],"CodeMirror-line-like");d(e.measure,s);var a=n.getBoundingClientRect(),m=(a.right-a.left)/10;return m>2&&(e.cachedCharWidth=m),m||10}function Do(e){for(var n=e.display,s={},a={},m=n.gutters.clientLeft,B=n.gutters.firstChild,J=0;B;B=B.nextSibling,++J){var re=e.display.gutterSpecs[J].className;s[re]=B.offsetLeft+B.clientLeft+m,a[re]=B.clientWidth}return{fixedPos:Po(n),gutterTotalWidth:n.gutters.offsetWidth,gutterLeft:s,gutterWidth:a,wrapperWidth:n.wrapper.clientWidth}}function Po(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function _s(e){var n=Jr(e.display),s=e.options.lineWrapping,a=s&&Math.max(5,e.display.scroller.clientWidth/Zr(e.display)-3);return function(m){if(Mt(e.doc,m))return 0;var B=0;if(m.widgets)for(var J=0;J<m.widgets.length;J++)m.widgets[J].height&&(B+=m.widgets[J].height);return s?B+(Math.ceil(m.text.length/a)||1)*n:B+n}}function Lo(e){var n=e.doc,s=_s(e);n.iter(function(a){var m=s(a);m!=a.height&&Bt(a,m)})}function Gr(e,n,s,a){var m=e.display;if(!s&&Pe(n).getAttribute("cm-not-content")=="true")return null;var B,J,re=m.lineSpace.getBoundingClientRect();try{B=n.clientX-re.left,J=n.clientY-re.top}catch(Ve){return null}var se=Ro(e,B,J),ge;if(a&&se.xRel>0&&(ge=pt(e.doc,se.line).text).length==se.ch){var Ne=j(ge,ge.length,e.options.tabSize)-ge.length;se=Be(se.line,Math.max(0,Math.round((B-Sr(e.display).left)/Zr(e.display))-Ne))}return se}function zr(e,n){if(n>=e.display.viewTo)return null;if(n-=e.display.viewFrom,n<0)return null;for(var s=e.display.view,a=0;a<s.length;a++)if(n-=s[a].size,n<0)return a}function lr(e,n,s,a){n==null&&(n=e.doc.first),s==null&&(s=e.doc.first+e.doc.size),a||(a=0);var m=e.display;if(a&&s<m.viewTo&&(m.updateLineNumbers==null||m.updateLineNumbers>n)&&(m.updateLineNumbers=n),e.curOp.viewChanged=!0,n>=m.viewTo)on&&bn(e.doc,n)<m.viewTo&&Nr(e);else if(s<=m.viewFrom)on&&dn(e.doc,s+a)>m.viewFrom?Nr(e):(m.viewFrom+=a,m.viewTo+=a);else if(n<=m.viewFrom&&s>=m.viewTo)Nr(e);else if(n<=m.viewFrom){var B=ea(e,s,s+a,1);B?(m.view=m.view.slice(B.index),m.viewFrom=B.lineN,m.viewTo+=a):Nr(e)}else if(s>=m.viewTo){var J=ea(e,n,n,-1);J?(m.view=m.view.slice(0,J.index),m.viewTo=J.lineN):Nr(e)}else{var re=ea(e,n,n,-1),se=ea(e,s,s+a,1);re&&se?(m.view=m.view.slice(0,re.index).concat(At(e,re.lineN,se.lineN)).concat(m.view.slice(se.index)),m.viewTo+=a):Nr(e)}var ge=m.externalMeasured;ge&&(s<ge.lineN?ge.lineN+=a:n<ge.lineN+ge.size&&(m.externalMeasured=null))}function Mr(e,n,s){e.curOp.viewChanged=!0;var a=e.display,m=e.display.externalMeasured;if(m&&n>=m.lineN&&n<m.lineN+m.size&&(a.externalMeasured=null),n<a.viewFrom||n>=a.viewTo)return;var B=a.view[zr(e,n)];if(B.node==null)return;var J=B.changes||(B.changes=[]);ae(J,s)==-1&&J.push(s)}function Nr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function ea(e,n,s,a){var m=zr(e,n),B,J=e.display.view;if(!on||s==e.doc.first+e.doc.size)return{index:m,lineN:s};for(var re=e.display.viewFrom,se=0;se<m;se++)re+=J[se].size;if(re!=n){if(a>0){if(m==J.length-1)return null;B=re+J[m].size-n,m++}else B=re-n;n+=B,s+=B}for(;bn(e.doc,s)!=s;){if(m==(a<0?0:J.length-1))return null;s+=a*J[m-(a<0?1:0)].size,m+=a}return{index:m,lineN:s}}function xl(e,n,s){var a=e.display,m=a.view;m.length==0||n>=a.viewTo||s<=a.viewFrom?(a.view=At(e,n,s),a.viewFrom=n):(a.viewFrom>n?a.view=At(e,n,a.viewFrom).concat(a.view):a.viewFrom<n&&(a.view=a.view.slice(zr(e,n))),a.viewFrom=n,a.viewTo<s?a.view=a.view.concat(At(e,a.viewTo,s)):a.viewTo>s&&(a.view=a.view.slice(0,zr(e,s)))),a.viewTo=s}function Io(e){for(var n=e.display.view,s=0,a=0;a<n.length;a++){var m=n[a];!m.hidden&&(!m.node||m.changes)&&++s}return s}function ta(e){e.display.input.showSelection(e.display.input.prepareSelection())}function ko(e,n){n===void 0&&(n=!0);for(var s=e.doc,a={},m=a.cursors=document.createDocumentFragment(),B=a.selection=document.createDocumentFragment(),J=0;J<s.sel.ranges.length;J++){if(!n&&J==s.sel.primIndex)continue;var re=s.sel.ranges[J];if(re.from().line>=e.display.viewTo||re.to().line<e.display.viewFrom)continue;var se=re.empty();(se||e.options.showCursorWhenSelecting)&&ys(e,re.head,m),se||bs(e,re,B)}return a}function ys(e,n,s){var a=xr(e,n,"div",null,null,!e.options.singleCursorHeightPerLine),m=s.appendChild(l("div","\xA0","CodeMirror-cursor"));if(m.style.left=a.left+"px",m.style.top=a.top+"px",m.style.height=Math.max(0,a.bottom-a.top)*e.options.cursorHeight+"px",a.other){var B=s.appendChild(l("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));B.style.display="",B.style.left=a.other.left+"px",B.style.top=a.other.top+"px",B.style.height=(a.other.bottom-a.other.top)*.85+"px"}}function Qa(e,n){return e.top-n.top||e.left-n.left}function bs(e,n,s){var a=e.display,m=e.doc,B=document.createDocumentFragment(),J=Sr(e.display),re=J.left,se=Math.max(a.sizerWidth,er(e)-a.sizer.offsetLeft)-J.right,ge=m.direction=="ltr";function Ne(Gn,di,Ri,Si){di<0&&(di=0),di=Math.round(di),Si=Math.round(Si),B.appendChild(l("div",null,"CodeMirror-selected","position: absolute; left: "+Gn+`px;
|
|
top: `+di+"px; width: "+(Ri==null?se-Gn:Ri)+`px;
|
|
height: `+(Si-di)+"px"))}function Ve(Gn,di,Ri){var Si=pt(m,Gn),Di=Si.text.length,Wi,ir;function zi(Qi,gr){return So(e,Be(Gn,Qi),"div",Si,gr)}function Er(Qi,gr,sr){var Zi=gs(e,Si,null,Qi),qi=gr=="ltr"==(sr=="after")?"left":"right",Xi=sr=="after"?Zi.begin:Zi.end-(/\s/.test(Si.text.charAt(Zi.end-1))?2:1);return zi(Xi,qi)[qi]}var vr=Cn(Si,m.direction);return en(vr,di||0,Ri==null?Di:Ri,function(Qi,gr,sr,Zi){var qi=sr=="ltr",Xi=zi(Qi,qi?"left":"right"),_r=zi(gr-1,qi?"right":"left"),_o=di==null&&Qi==0,Ca=Ri==null&&gr==Di,dr=Zi==0,Hr=!vr||Zi==vr.length-1;if(_r.top-Xi.top<=3){var rr=(ge?_o:Ca)&&dr,nu=(ge?Ca:_o)&&Hr,Qr=rr?re:(qi?Xi:_r).left,Ga=nu?se:(qi?_r:Xi).right;Ne(Qr,Xi.top,Ga-Qr,Xi.bottom)}else{var za,hr,yo,iu;qi?(za=ge&&_o&&dr?re:Xi.left,hr=ge?se:Er(Qi,sr,"before"),yo=ge?re:Er(gr,sr,"after"),iu=ge&&Ca&&Hr?se:_r.right):(za=ge?Er(Qi,sr,"before"):re,hr=!ge&&_o&&dr?se:Xi.right,yo=!ge&&Ca&&Hr?re:_r.left,iu=ge?Er(gr,sr,"after"):se),Ne(za,Xi.top,hr-za,Xi.bottom),Xi.bottom<_r.top&&Ne(re,Xi.bottom,null,_r.top),Ne(yo,_r.top,iu-yo,_r.bottom)}(!Wi||Qa(Xi,Wi)<0)&&(Wi=Xi),Qa(_r,Wi)<0&&(Wi=_r),(!ir||Qa(Xi,ir)<0)&&(ir=Xi),Qa(_r,ir)<0&&(ir=_r)}),{start:Wi,end:ir}}var ht=n.from(),lt=n.to();if(ht.line==lt.line)Ve(ht.line,ht.ch,lt.ch);else{var Ht=pt(m,ht.line),ln=pt(m,lt.line),xn=_n(Ht)==_n(ln),Kn=Ve(ht.line,ht.ch,xn?Ht.text.length+1:null).end,ri=Ve(lt.line,xn?0:null,lt.ch).start;xn&&(Kn.top<ri.top-2?(Ne(Kn.right,Kn.top,null,Kn.bottom),Ne(re,ri.top,ri.left,ri.bottom)):Ne(Kn.right,Kn.top,ri.left-Kn.right,Kn.bottom)),Kn.bottom<ri.top&&Ne(re,Kn.bottom,null,ri.top)}s.appendChild(B)}function Mo(e){if(!e.state.focused)return;var n=e.display;clearInterval(n.blinker);var s=!0;n.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?n.blinker=setInterval(function(){e.hasFocus()||na(e),n.cursorDiv.style.visibility=(s=!s)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(n.cursorDiv.style.visibility="hidden")}function No(e){e.state.focused||(e.display.input.focus(),Uo(e))}function Es(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,na(e))},100)}function Uo(e,n){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(nt(e,"focus",e,n),e.state.focused=!0,N(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),k&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Mo(e)}function na(e,n){if(e.state.delayingBlurEvent)return;e.state.focused&&(nt(e,"blur",e,n),e.state.focused=!1,E(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function qa(e){for(var n=e.display,s=n.lineDiv.offsetTop,a=0;a<n.view.length;a++){var m=n.view[a],B=e.options.lineWrapping,J=void 0,re=0;if(m.hidden)continue;if(Y&&X<8){var se=m.node.offsetTop+m.node.offsetHeight;J=se-s,s=se}else{var ge=m.node.getBoundingClientRect();J=ge.bottom-ge.top,!B&&m.text.firstChild&&(re=m.text.firstChild.getBoundingClientRect().right-ge.left-1)}var Ne=m.line.height-J;if((Ne>.005||Ne<-.005)&&(Bt(m.line,J),Ar(m.line),m.rest))for(var Ve=0;Ve<m.rest.length;Ve++)Ar(m.rest[Ve]);if(re>e.display.sizerWidth){var ht=Math.ceil(re/Zr(e.display));ht>e.display.maxLineLength&&(e.display.maxLineLength=ht,e.display.maxLine=m.line,e.display.maxLineChanged=!0)}}}function Ar(e){if(e.widgets)for(var n=0;n<e.widgets.length;++n){var s=e.widgets[n],a=s.node.parentNode;a&&(s.height=a.offsetHeight)}}function Ja(e,n,s){var a=s&&s.top!=null?Math.max(0,s.top):e.scroller.scrollTop;a=Math.floor(a-Tr(e));var m=s&&s.bottom!=null?s.bottom:a+e.wrapper.clientHeight,B=ue(n,a),J=ue(n,m);if(s&&s.ensure){var re=s.ensure.from.line,se=s.ensure.to.line;re<B?(B=re,J=ue(n,qt(pt(n,re))+e.wrapper.clientHeight)):Math.min(se,n.lastLine())>=J&&(B=ue(n,qt(pt(n,se))-e.wrapper.clientHeight),J=se)}return{from:B,to:Math.max(J,B+1)}}function xs(e,n){if(vt(e,"scrollCursorIntoView"))return;var s=e.display,a=s.sizer.getBoundingClientRect(),m=null;if(n.top+a.top<0?m=!0:n.bottom+a.top>(window.innerHeight||document.documentElement.clientHeight)&&(m=!1),m!=null&&!u){var B=l("div","\u200B",null,`position: absolute;
|
|
top: `+(n.top-s.viewOffset-Tr(e.display))+`px;
|
|
height: `+(n.bottom-n.top+Ji(e)+s.barHeight)+`px;
|
|
left: `+n.left+"px; width: "+Math.max(2,n.right-n.left)+"px;");e.display.lineSpace.appendChild(B),B.scrollIntoView(m),e.display.lineSpace.removeChild(B)}}function Fo(e,n,s,a){a==null&&(a=0);var m;!e.options.lineWrapping&&n==s&&(n=n.ch?Be(n.line,n.sticky=="before"?n.ch-1:n.ch,"after"):n,s=n.sticky=="before"?Be(n.line,n.ch+1,"before"):n);for(var B=0;B<5;B++){var J=!1,re=xr(e,n),se=!s||s==n?re:xr(e,s);m={left:Math.min(re.left,se.left),top:Math.min(re.top,se.top)-a,right:Math.max(re.left,se.left),bottom:Math.max(re.bottom,se.bottom)+a};var ge=Za(e,m),Ne=e.doc.scrollTop,Ve=e.doc.scrollLeft;if(ge.scrollTop!=null&&(aa(e,ge.scrollTop),Math.abs(e.doc.scrollTop-Ne)>1&&(J=!0)),ge.scrollLeft!=null&&(Dr(e,ge.scrollLeft),Math.abs(e.doc.scrollLeft-Ve)>1&&(J=!0)),!J)break}return m}function Cl(e,n){var s=Za(e,n);s.scrollTop!=null&&aa(e,s.scrollTop),s.scrollLeft!=null&&Dr(e,s.scrollLeft)}function Za(e,n){var s=e.display,a=Jr(e.display);n.top<0&&(n.top=0);var m=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:s.scroller.scrollTop,B=yr(e),J={};n.bottom-n.top>B&&(n.bottom=n.top+B);var re=e.doc.height+Ki(s),se=n.top<a,ge=n.bottom>re-a;if(n.top<m)J.scrollTop=se?0:n.top;else if(n.bottom>m+B){var Ne=Math.min(n.top,(ge?re:n.bottom)-B);Ne!=m&&(J.scrollTop=Ne)}var Ve=e.options.fixedGutter?0:s.gutters.offsetWidth,ht=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:s.scroller.scrollLeft-Ve,lt=er(e)-s.gutters.offsetWidth,Ht=n.right-n.left>lt;return Ht&&(n.right=n.left+lt),n.left<10?J.scrollLeft=0:n.left<ht?J.scrollLeft=Math.max(0,n.left+Ve-(Ht?0:10)):n.right>lt+ht-3&&(J.scrollLeft=n.right+(Ht?0:10)-lt),J}function eo(e,n){if(n==null)return;to(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+n}function ia(e){to(e);var n=e.getCursor();e.curOp.scrollToPos={from:n,to:n,margin:e.options.cursorScrollMargin}}function ra(e,n,s){(n!=null||s!=null)&&to(e),n!=null&&(e.curOp.scrollLeft=n),s!=null&&(e.curOp.scrollTop=s)}function Cs(e,n){to(e),e.curOp.scrollToPos=n}function to(e){var n=e.curOp.scrollToPos;if(n){e.curOp.scrollToPos=null;var s=ms(e,n.from),a=ms(e,n.to);ws(e,s,a,n.margin)}}function ws(e,n,s,a){var m=Za(e,{left:Math.min(n.left,s.left),top:Math.min(n.top,s.top)-a,right:Math.max(n.right,s.right),bottom:Math.max(n.bottom,s.bottom)+a});ra(e,m.scrollLeft,m.scrollTop)}function aa(e,n){if(Math.abs(e.doc.scrollTop-n)<2)return;U||Wo(e,{top:n}),Ts(e,n,!0),U&&Wo(e),tr(e,100)}function Ts(e,n,s){if(n=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,n)),e.display.scroller.scrollTop==n&&!s)return;e.doc.scrollTop=n,e.display.scrollbars.setScrollTop(n),e.display.scroller.scrollTop!=n&&(e.display.scroller.scrollTop=n)}function Dr(e,n,s,a){if(n=Math.max(0,Math.min(n,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(s?n==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-n)<2)&&!a)return;e.doc.scrollLeft=n,Is(e),e.display.scroller.scrollLeft!=n&&(e.display.scroller.scrollLeft=n),e.display.scrollbars.setScrollLeft(n)}function oa(e){var n=e.display,s=n.gutters.offsetWidth,a=Math.round(e.doc.height+Ki(e.display));return{clientHeight:n.scroller.clientHeight,viewHeight:n.wrapper.clientHeight,scrollWidth:n.scroller.scrollWidth,clientWidth:n.scroller.clientWidth,viewWidth:n.wrapper.clientWidth,barLeft:e.options.fixedGutter?s:0,docHeight:a,scrollHeight:a+Ji(e)+n.barHeight,nativeBarWidth:n.nativeBarWidth,gutterWidth:s}}var Pr=function(e,n,s){this.cm=s;var a=this.vert=l("div",[l("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),m=this.horiz=l("div",[l("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");a.tabIndex=m.tabIndex=-1,e(a),e(m),Ye(a,"scroll",function(){a.clientHeight&&n(a.scrollTop,"vertical")}),Ye(m,"scroll",function(){m.clientWidth&&n(m.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,Y&&X<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Pr.prototype.update=function(e){var n=e.scrollWidth>e.clientWidth+1,s=e.scrollHeight>e.clientHeight+1,a=e.nativeBarWidth;if(s){this.vert.style.display="block",this.vert.style.bottom=n?a+"px":"0";var m=e.viewHeight-(n?a:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+m)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(n){this.horiz.style.display="block",this.horiz.style.right=s?a+"px":"0",this.horiz.style.left=e.barLeft+"px";var B=e.viewWidth-e.barLeft-(s?a:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+B)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(a==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:s?a:0,bottom:n?a:0}},Pr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Pr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Pr.prototype.zeroWidthHack=function(){var e=c&&!o?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new $,this.disableVert=new $},Pr.prototype.enableZeroWidthBar=function(e,n,s){e.style.pointerEvents="auto";function a(){var m=e.getBoundingClientRect(),B=s=="vert"?document.elementFromPoint(m.right-1,(m.top+m.bottom)/2):document.elementFromPoint((m.right+m.left)/2,m.bottom-1);B!=e?e.style.pointerEvents="none":n.set(1e3,a)}n.set(1e3,a)},Pr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Sa=function(){};Sa.prototype.update=function(){return{bottom:0,right:0}},Sa.prototype.setScrollLeft=function(){},Sa.prototype.setScrollTop=function(){},Sa.prototype.clear=function(){};function Ur(e,n){n||(n=oa(e));var s=e.display.barWidth,a=e.display.barHeight;Ss(e,n);for(var m=0;m<4&&s!=e.display.barWidth||a!=e.display.barHeight;m++)s!=e.display.barWidth&&e.options.lineWrapping&&qa(e),Ss(e,oa(e)),s=e.display.barWidth,a=e.display.barHeight}function Ss(e,n){var s=e.display,a=s.scrollbars.update(n);s.sizer.style.paddingRight=(s.barWidth=a.right)+"px",s.sizer.style.paddingBottom=(s.barHeight=a.bottom)+"px",s.heightForcer.style.borderBottom=a.bottom+"px solid transparent",a.right&&a.bottom?(s.scrollbarFiller.style.display="block",s.scrollbarFiller.style.height=a.bottom+"px",s.scrollbarFiller.style.width=a.right+"px"):s.scrollbarFiller.style.display="",a.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(s.gutterFiller.style.display="block",s.gutterFiller.style.height=a.bottom+"px",s.gutterFiller.style.width=n.gutterWidth+"px"):s.gutterFiller.style.display=""}var Os={native:Pr,null:Sa};function Rs(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&E(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Os[e.options.scrollbarStyle](function(n){e.display.wrapper.insertBefore(n,e.display.scrollbarFiller),Ye(n,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),n.setAttribute("cm-not-content","true")},function(n,s){s=="horizontal"?Dr(e,n):aa(e,n)},e),e.display.scrollbars.addClass&&N(e.display.wrapper,e.display.scrollbars.addClass)}var As=0;function Vr(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++As},yn(e.curOp)}function Xr(e){var n=e.curOp;n&&ei(n,function(s){for(var a=0;a<s.ops.length;a++)s.ops[a].cm.curOp=null;wl(s)})}function wl(e){for(var n=e.ops,s=0;s<n.length;s++)sa(n[s]);for(var a=0;a<n.length;a++)la(n[a]);for(var m=0;m<n.length;m++)Bo(n[m]);for(var B=0;B<n.length;B++)Tl(n[B]);for(var J=0;J<n.length;J++)Ds(n[J])}function sa(e){var n=e.cm,s=n.display;Sl(n),e.updateMaxLine&&fn(n),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<s.viewFrom||e.scrollToPos.to.line>=s.viewTo)||s.maxLineChanged&&n.options.lineWrapping,e.update=e.mustUpdate&&new Oa(n,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function la(e){e.updatedDisplay=e.mustUpdate&&no(e.cm,e.update)}function Bo(e){var n=e.cm,s=n.display;e.updatedDisplay&&qa(n),e.barMeasure=oa(n),s.maxLineChanged&&!n.options.lineWrapping&&(e.adjustWidthTo=Xa(n,s.maxLine,s.maxLine.text.length).left+3,n.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(s.scroller.clientWidth,s.sizer.offsetLeft+e.adjustWidthTo+Ji(n)+n.display.barWidth),e.maxScrollLeft=Math.max(0,s.sizer.offsetLeft+e.adjustWidthTo-er(n))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=s.input.prepareSelection())}function Tl(e){var n=e.cm;e.adjustWidthTo!=null&&(n.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<n.doc.scrollLeft&&Dr(n,Math.min(n.display.scroller.scrollLeft,e.maxScrollLeft),!0),n.display.maxLineChanged=!1);var s=e.focus&&e.focus==F();e.preparedSelection&&n.display.input.showSelection(e.preparedSelection,s),(e.updatedDisplay||e.startHeight!=n.doc.height)&&Ur(n,e.barMeasure),e.updatedDisplay&&Yr(n,e.barMeasure),e.selectionChanged&&Mo(n),n.state.focused&&e.updateInput&&n.display.input.reset(e.typing),s&&No(e.cm)}function Ds(e){var n=e.cm,s=n.display,a=n.doc;if(e.updatedDisplay&&Ls(n,e.update),s.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(s.wheelStartX=s.wheelStartY=null),e.scrollTop!=null&&Ts(n,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Dr(n,e.scrollLeft,!0,!0),e.scrollToPos){var m=Fo(n,C(a,e.scrollToPos.from),C(a,e.scrollToPos.to),e.scrollToPos.margin);xs(n,m)}var B=e.maybeHiddenMarkers,J=e.maybeUnhiddenMarkers;if(B)for(var re=0;re<B.length;++re)B[re].lines.length||nt(B[re],"hide");if(J)for(var se=0;se<J.length;++se)J[se].lines.length&&nt(J[se],"unhide");s.wrapper.offsetHeight&&(a.scrollTop=n.display.scroller.scrollTop),e.changeObjs&&nt(n,"changes",n,e.changeObjs),e.update&&e.update.finish()}function cr(e,n){if(e.curOp)return n();Vr(e);try{return n()}finally{Xr(e)}}function Gi(e,n){return function(){if(e.curOp)return n.apply(e,arguments);Vr(e);try{return n.apply(e,arguments)}finally{Xr(e)}}}function or(e){return function(){if(this.curOp)return e.apply(this,arguments);Vr(this);try{return e.apply(this,arguments)}finally{Xr(this)}}}function $i(e){return function(){var n=this.cm;if(!n||n.curOp)return e.apply(this,arguments);Vr(n);try{return e.apply(this,arguments)}finally{Xr(n)}}}function tr(e,n){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(n,I(jo,e))}function jo(e){var n=e.doc;if(n.highlightFrontier>=e.display.viewTo)return;var s=+new Date+e.options.workTime,a=kt(e,n.highlightFrontier),m=[];n.iter(a.line,Math.min(n.first+n.size,e.display.viewTo+500),function(B){if(a.line>=e.display.viewFrom){var J=B.styles,re=B.text.length>e.options.maxHighlightLength?bi(n.mode,a.state):null,se=ke(e,B,a,!0);re&&(a.state=re),B.styles=se.styles;var ge=B.styleClasses,Ne=se.classes;Ne?B.styleClasses=Ne:ge&&(B.styleClasses=null);for(var Ve=!J||J.length!=B.styles.length||ge!=Ne&&(!ge||!Ne||ge.bgClass!=Ne.bgClass||ge.textClass!=Ne.textClass),ht=0;!Ve&&ht<J.length;++ht)Ve=J[ht]!=B.styles[ht];Ve&&m.push(a.line),B.stateAfter=a.save(),a.nextLine()}else B.text.length<=e.options.maxHighlightLength&&an(e,B.text,a),B.stateAfter=a.line%5==0?a.save():null,a.nextLine();if(+new Date>s)return tr(e,e.options.workDelay),!0}),n.highlightFrontier=a.line,n.modeFrontier=Math.max(n.modeFrontier,a.line),m.length&&cr(e,function(){for(var B=0;B<m.length;B++)Mr(e,m[B],"text")})}var Oa=function(e,n,s){var a=e.display;this.viewport=n,this.visible=Ja(a,e.doc,n),this.editorIsHidden=!a.wrapper.offsetWidth,this.wrapperHeight=a.wrapper.clientHeight,this.wrapperWidth=a.wrapper.clientWidth,this.oldDisplayWidth=er(e),this.force=s,this.dims=Do(e),this.events=[]};Oa.prototype.signal=function(e,n){Ae(e,n)&&this.events.push(arguments)},Oa.prototype.finish=function(){for(var e=0;e<this.events.length;e++)nt.apply(null,this.events[e])};function Sl(e){var n=e.display;!n.scrollbarsClipped&&n.scroller.offsetWidth&&(n.nativeBarWidth=n.scroller.offsetWidth-n.scroller.clientWidth,n.heightForcer.style.height=Ji(e)+"px",n.sizer.style.marginBottom=-n.nativeBarWidth+"px",n.sizer.style.borderRightWidth=Ji(e)+"px",n.scrollbarsClipped=!0)}function Ps(e){if(e.hasFocus())return null;var n=F();if(!n||!b(e.display.lineDiv,n))return null;var s={activeElt:n};if(window.getSelection){var a=window.getSelection();a.anchorNode&&a.extend&&b(e.display.lineDiv,a.anchorNode)&&(s.anchorNode=a.anchorNode,s.anchorOffset=a.anchorOffset,s.focusNode=a.focusNode,s.focusOffset=a.focusOffset)}return s}function Ra(e){if(!e||!e.activeElt||e.activeElt==F())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&b(document.body,e.anchorNode)&&b(document.body,e.focusNode)){var n=window.getSelection(),s=document.createRange();s.setEnd(e.anchorNode,e.anchorOffset),s.collapse(!1),n.removeAllRanges(),n.addRange(s),n.extend(e.focusNode,e.focusOffset)}}function no(e,n){var s=e.display,a=e.doc;if(n.editorIsHidden)return Nr(e),!1;if(!n.force&&n.visible.from>=s.viewFrom&&n.visible.to<=s.viewTo&&(s.updateLineNumbers==null||s.updateLineNumbers>=s.viewTo)&&s.renderedView==s.view&&Io(e)==0)return!1;ks(e)&&(Nr(e),n.dims=Do(e));var m=a.first+a.size,B=Math.max(n.visible.from-e.options.viewportMargin,a.first),J=Math.min(m,n.visible.to+e.options.viewportMargin);s.viewFrom<B&&B-s.viewFrom<20&&(B=Math.max(a.first,s.viewFrom)),s.viewTo>J&&s.viewTo-J<20&&(J=Math.min(m,s.viewTo)),on&&(B=bn(e.doc,B),J=dn(e.doc,J));var re=B!=s.viewFrom||J!=s.viewTo||s.lastWrapHeight!=n.wrapperHeight||s.lastWrapWidth!=n.wrapperWidth;xl(e,B,J),s.viewOffset=qt(pt(e.doc,s.viewFrom)),e.display.mover.style.top=s.viewOffset+"px";var se=Io(e);if(!re&&se==0&&!n.force&&s.renderedView==s.view&&(s.updateLineNumbers==null||s.updateLineNumbers>=s.viewTo))return!1;var ge=Ps(e);return se>4&&(s.lineDiv.style.display="none"),Ol(e,s.updateLineNumbers,n.dims),se>4&&(s.lineDiv.style.display=""),s.renderedView=s.view,Ra(ge),y(s.cursorDiv),y(s.selectionDiv),s.gutters.style.height=s.sizer.style.minHeight=0,re&&(s.lastWrapHeight=n.wrapperHeight,s.lastWrapWidth=n.wrapperWidth,tr(e,400)),s.updateLineNumbers=null,!0}function Ls(e,n){for(var s=n.viewport,a=!0;;a=!1){if(!a||!e.options.lineWrapping||n.oldDisplayWidth==er(e)){if(s&&s.top!=null&&(s={top:Math.min(e.doc.height+Ki(e.display)-yr(e),s.top)}),n.visible=Ja(e.display,e.doc,s),n.visible.from>=e.display.viewFrom&&n.visible.to<=e.display.viewTo)break}else a&&(n.visible=Ja(e.display,e.doc,s));if(!no(e,n))break;qa(e);var m=oa(e);ta(e),Ur(e,m),Yr(e,m),n.force=!1}n.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(n.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Wo(e,n){var s=new Oa(e,n);if(no(e,s)){qa(e),Ls(e,s);var a=oa(e);ta(e),Ur(e,a),Yr(e,a),s.finish()}}function Ol(e,n,s){var a=e.display,m=e.options.lineNumbers,B=a.lineDiv,J=B.firstChild;function re(Ht){var ln=Ht.nextSibling;return k&&c&&e.display.currentWheelTarget==Ht?Ht.style.display="none":Ht.parentNode.removeChild(Ht),ln}for(var se=a.view,ge=a.viewFrom,Ne=0;Ne<se.length;Ne++){var Ve=se[Ne];if(!Ve.hidden)if(!Ve.node||Ve.node.parentNode!=B){var ht=Ei(e,Ve,ge,s);B.insertBefore(ht,J)}else{for(;J!=Ve.node;)J=re(J);var lt=m&&n!=null&&n<=ge&&Ve.lineNumber;Ve.changes&&(ae(Ve.changes,"gutter")>-1&&(lt=!1),Yn(e,Ve,ge,s)),lt&&(y(Ve.lineNumber),Ve.lineNumber.appendChild(document.createTextNode(je(e.options,ge)))),J=Ve.node.nextSibling}ge+=Ve.size}for(;J;)J=re(J)}function Aa(e){var n=e.gutters.offsetWidth;e.sizer.style.marginLeft=n+"px"}function Yr(e,n){e.display.sizer.style.minHeight=n.docHeight+"px",e.display.heightForcer.style.top=n.docHeight+"px",e.display.gutters.style.height=n.docHeight+e.display.barHeight+Ji(e)+"px"}function Is(e){var n=e.display,s=n.view;if(!n.alignWidgets&&(!n.gutters.firstChild||!e.options.fixedGutter))return;for(var a=Po(n)-n.scroller.scrollLeft+e.doc.scrollLeft,m=n.gutters.offsetWidth,B=a+"px",J=0;J<s.length;J++)if(!s[J].hidden){e.options.fixedGutter&&(s[J].gutter&&(s[J].gutter.style.left=B),s[J].gutterBackground&&(s[J].gutterBackground.style.left=B));var re=s[J].alignable;if(re)for(var se=0;se<re.length;se++)re[se].style.left=B}e.options.fixedGutter&&(n.gutters.style.left=a+m+"px")}function ks(e){if(!e.options.lineNumbers)return!1;var n=e.doc,s=je(e.options,n.first+n.size-1),a=e.display;if(s.length!=a.lineNumChars){var m=a.measure.appendChild(l("div",[l("div",s)],"CodeMirror-linenumber CodeMirror-gutter-elt")),B=m.firstChild.offsetWidth,J=m.offsetWidth-B;return a.lineGutter.style.width="",a.lineNumInnerWidth=Math.max(B,a.lineGutter.offsetWidth-J)+1,a.lineNumWidth=a.lineNumInnerWidth+J,a.lineNumChars=a.lineNumInnerWidth?s.length:-1,a.lineGutter.style.width=a.lineNumWidth+"px",Aa(e.display),!0}return!1}function Ho(e,n){for(var s=[],a=!1,m=0;m<e.length;m++){var B=e[m],J=null;if(typeof B!="string"&&(J=B.style,B=B.className),B=="CodeMirror-linenumbers")if(n)a=!0;else continue;s.push({className:B,style:J})}return n&&!a&&s.push({className:"CodeMirror-linenumbers",style:null}),s}function Ko(e){var n=e.gutters,s=e.gutterSpecs;y(n),e.lineGutter=null;for(var a=0;a<s.length;++a){var m=s[a],B=m.className,J=m.style,re=n.appendChild(l("div",null,"CodeMirror-gutter "+B));J&&(re.style.cssText=J),B=="CodeMirror-linenumbers"&&(e.lineGutter=re,re.style.width=(e.lineNumWidth||1)+"px")}n.style.display=s.length?"":"none",Aa(e)}function Da(e){Ko(e.display),lr(e),Is(e)}function Rl(e,n,s,a){var m=this;this.input=s,m.scrollbarFiller=l("div",null,"CodeMirror-scrollbar-filler"),m.scrollbarFiller.setAttribute("cm-not-content","true"),m.gutterFiller=l("div",null,"CodeMirror-gutter-filler"),m.gutterFiller.setAttribute("cm-not-content","true"),m.lineDiv=h("div",null,"CodeMirror-code"),m.selectionDiv=l("div",null,null,"position: relative; z-index: 1"),m.cursorDiv=l("div",null,"CodeMirror-cursors"),m.measure=l("div",null,"CodeMirror-measure"),m.lineMeasure=l("div",null,"CodeMirror-measure"),m.lineSpace=h("div",[m.measure,m.lineMeasure,m.selectionDiv,m.cursorDiv,m.lineDiv],null,"position: relative; outline: none");var B=h("div",[m.lineSpace],"CodeMirror-lines");m.mover=l("div",[B],null,"position: relative"),m.sizer=l("div",[m.mover],"CodeMirror-sizer"),m.sizerWidth=null,m.heightForcer=l("div",null,null,"position: absolute; height: "+fe+"px; width: 1px;"),m.gutters=l("div",null,"CodeMirror-gutters"),m.lineGutter=null,m.scroller=l("div",[m.sizer,m.heightForcer,m.gutters],"CodeMirror-scroll"),m.scroller.setAttribute("tabIndex","-1"),m.wrapper=l("div",[m.scrollbarFiller,m.gutterFiller,m.scroller],"CodeMirror"),Y&&X<8&&(m.gutters.style.zIndex=-1,m.scroller.style.paddingRight=0),!k&&!(U&&t)&&(m.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(m.wrapper):e(m.wrapper)),m.viewFrom=m.viewTo=n.first,m.reportedViewFrom=m.reportedViewTo=n.first,m.view=[],m.renderedView=null,m.externalMeasured=null,m.viewOffset=0,m.lastWrapHeight=m.lastWrapWidth=0,m.updateLineNumbers=null,m.nativeBarWidth=m.barHeight=m.barWidth=0,m.scrollbarsClipped=!1,m.lineNumWidth=m.lineNumInnerWidth=m.lineNumChars=null,m.alignWidgets=!1,m.cachedCharWidth=m.cachedTextHeight=m.cachedPaddingH=null,m.maxLine=null,m.maxLineLength=0,m.maxLineChanged=!1,m.wheelDX=m.wheelDY=m.wheelStartX=m.wheelStartY=null,m.shift=!1,m.selForContextMenu=null,m.activeTouch=null,m.gutterSpecs=Ho(a.gutters,a.lineNumbers),Ko(m),s.init(m)}var ua=0,pr=null;Y?pr=-.53:U?pr=15:v?pr=-.7:p&&(pr=-1/3);function Ms(e){var n=e.wheelDeltaX,s=e.wheelDeltaY;return n==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(n=e.detail),s==null&&e.detail&&e.axis==e.VERTICAL_AXIS?s=e.detail:s==null&&(s=e.wheelDelta),{x:n,y:s}}function io(e){var n=Ms(e);return n.x*=pr,n.y*=pr,n}function Ns(e,n){var s=Ms(n),a=s.x,m=s.y,B=e.display,J=B.scroller,re=J.scrollWidth>J.clientWidth,se=J.scrollHeight>J.clientHeight;if(!(a&&re||m&&se))return;if(m&&c&&k){e:for(var ge=n.target,Ne=B.view;ge!=J;ge=ge.parentNode)for(var Ve=0;Ve<Ne.length;Ve++)if(Ne[Ve].node==ge){e.display.currentWheelTarget=ge;break e}}if(a&&!U&&!_&&pr!=null){m&&se&&aa(e,Math.max(0,J.scrollTop+m*pr)),Dr(e,Math.max(0,J.scrollLeft+a*pr)),(!m||m&&se)&&le(n),B.wheelStartX=null;return}if(m&&pr!=null){var ht=m*pr,lt=e.doc.scrollTop,Ht=lt+B.wrapper.clientHeight;ht<0?lt=Math.max(0,lt+ht-50):Ht=Math.min(e.doc.height,Ht+ht+50),Wo(e,{top:lt,bottom:Ht})}ua<20&&(B.wheelStartX==null?(B.wheelStartX=J.scrollLeft,B.wheelStartY=J.scrollTop,B.wheelDX=a,B.wheelDY=m,setTimeout(function(){if(B.wheelStartX==null)return;var ln=J.scrollLeft-B.wheelStartX,xn=J.scrollTop-B.wheelStartY,Kn=xn&&B.wheelDY&&xn/B.wheelDY||ln&&B.wheelDX&&ln/B.wheelDX;if(B.wheelStartX=B.wheelStartY=null,!Kn)return;pr=(pr*ua+Kn)/(ua+1),++ua},200)):(B.wheelDX+=a,B.wheelDY+=m))}var mr=function(e,n){this.ranges=e,this.primIndex=n};mr.prototype.primary=function(){return this.ranges[this.primIndex]},mr.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var n=0;n<this.ranges.length;n++){var s=this.ranges[n],a=e.ranges[n];if(!_e(s.anchor,a.anchor)||!_e(s.head,a.head))return!1}return!0},mr.prototype.deepCopy=function(){for(var e=[],n=0;n<this.ranges.length;n++)e[n]=new Mi(An(this.ranges[n].anchor),An(this.ranges[n].head));return new mr(e,this.primIndex)},mr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},mr.prototype.contains=function(e,n){n||(n=e);for(var s=0;s<this.ranges.length;s++){var a=this.ranges[s];if(Ie(n,a.from())>=0&&Ie(e,a.to())<=0)return s}return-1};var Mi=function(e,n){this.anchor=e,this.head=n};Mi.prototype.from=function(){return Pn(this.anchor,this.head)},Mi.prototype.to=function(){return zn(this.anchor,this.head)},Mi.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Cr(e,n,s){var a=e&&e.options.selectionsMayTouch,m=n[s];n.sort(function(ht,lt){return Ie(ht.from(),lt.from())}),s=ae(n,m);for(var B=1;B<n.length;B++){var J=n[B],re=n[B-1],se=Ie(re.to(),J.from());if(a&&!J.empty()?se>0:se>=0){var ge=Pn(re.from(),J.from()),Ne=zn(re.to(),J.to()),Ve=re.empty()?J.from()==J.head:re.from()==re.head;B<=s&&--s,n.splice(--B,2,new Mi(Ve?Ne:ge,Ve?ge:Ne))}}return new mr(n,s)}function Fr(e,n){return new mr([new Mi(e,n||e)],0)}function $r(e){return e.text?Be(e.from.line+e.text.length-1,te(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Us(e,n){if(Ie(e,n.from)<0)return e;if(Ie(e,n.to)<=0)return $r(n);var s=e.line+n.text.length-(n.to.line-n.from.line)-1,a=e.ch;return e.line==n.to.line&&(a+=$r(n).ch-n.to.ch),Be(s,a)}function Pa(e,n){for(var s=[],a=0;a<e.sel.ranges.length;a++){var m=e.sel.ranges[a];s.push(new Mi(Us(m.anchor,n),Us(m.head,n)))}return Cr(e.cm,s,e.sel.primIndex)}function da(e,n,s){return e.line==n.line?Be(s.line,e.ch-n.ch+s.ch):Be(s.line+(e.line-n.line),e.ch)}function Al(e,n,s){for(var a=[],m=Be(e.first,0),B=m,J=0;J<n.length;J++){var re=n[J],se=da(re.from,m,B),ge=da($r(re),m,B);if(m=re.to,B=ge,s=="around"){var Ne=e.sel.ranges[J],Ve=Ie(Ne.head,Ne.anchor)<0;a[J]=new Mi(Ve?ge:se,Ve?se:ge)}else a[J]=new Mi(se,se)}return new mr(a,e.sel.primIndex)}function La(e){e.doc.mode=Qn(e.options,e.doc.modeOption),Ia(e)}function Ia(e){e.doc.iter(function(n){n.stateAfter&&(n.stateAfter=null),n.styles&&(n.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,tr(e,100),e.state.modeGen++,e.curOp&&lr(e)}function Fs(e,n){return n.from.ch==0&&n.to.ch==0&&te(n.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Go(e,n,s,a){function m(ri){return s?s[ri]:null}function B(ri,Gn,di){wn(ri,Gn,di,a),nn(ri,"change",ri,n)}function J(ri,Gn){for(var di=[],Ri=ri;Ri<Gn;++Ri)di.push(new On(ge[Ri],m(Ri),a));return di}var re=n.from,se=n.to,ge=n.text,Ne=pt(e,re.line),Ve=pt(e,se.line),ht=te(ge),lt=m(ge.length-1),Ht=se.line-re.line;if(n.full)e.insert(0,J(0,ge.length)),e.remove(ge.length,e.size-ge.length);else if(Fs(e,n)){var ln=J(0,ge.length-1);B(Ve,Ve.text,lt),Ht&&e.remove(re.line,Ht),ln.length&&e.insert(re.line,ln)}else if(Ne==Ve)if(ge.length==1)B(Ne,Ne.text.slice(0,re.ch)+ht+Ne.text.slice(se.ch),lt);else{var xn=J(1,ge.length-1);xn.push(new On(ht+Ne.text.slice(se.ch),lt,a)),B(Ne,Ne.text.slice(0,re.ch)+ge[0],m(0)),e.insert(re.line+1,xn)}else if(ge.length==1)B(Ne,Ne.text.slice(0,re.ch)+ge[0]+Ve.text.slice(se.ch),m(0)),e.remove(re.line+1,Ht);else{B(Ne,Ne.text.slice(0,re.ch)+ge[0],m(0)),B(Ve,ht+Ve.text.slice(se.ch),lt);var Kn=J(1,ge.length-1);Ht>1&&e.remove(re.line+1,Ht-1),e.insert(re.line+1,Kn)}nn(e,"change",e,n)}function wr(e,n,s){function a(m,B,J){if(m.linked)for(var re=0;re<m.linked.length;++re){var se=m.linked[re];if(se.doc==B)continue;var ge=J&&se.sharedHist;if(s&&!ge)continue;n(se.doc,ge),a(se.doc,m,ge)}}a(e,null,!0)}function zo(e,n){if(n.cm)throw new Error("This document is already in use.");e.doc=n,n.cm=e,Lo(e),La(e),Bs(e),e.options.lineWrapping||fn(e),e.options.mode=n.modeOption,lr(e)}function Bs(e){(e.doc.direction=="rtl"?N:E)(e.display.lineDiv,"CodeMirror-rtl")}function Dl(e){cr(e,function(){Bs(e),lr(e)})}function ro(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Vo(e,n){var s={from:An(n.from),to:$r(n),text:Je(e,n.from,n.to)};return Xo(e,s,n.from.line,n.to.line+1),wr(e,function(a){return Xo(a,s,n.from.line,n.to.line+1)},!0),s}function js(e){for(;e.length;){var n=te(e);if(n.ranges)e.pop();else break}}function Pl(e,n){if(n)return js(e.done),te(e.done);if(e.done.length&&!te(e.done).ranges)return te(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),te(e.done)}function Ws(e,n,s,a){var m=e.history;m.undone.length=0;var B=+new Date,J,re;if((m.lastOp==a||m.lastOrigin==n.origin&&n.origin&&(n.origin.charAt(0)=="+"&&m.lastModTime>B-(e.cm?e.cm.options.historyEventDelay:500)||n.origin.charAt(0)=="*"))&&(J=Pl(m,m.lastOp==a)))re=te(J.changes),Ie(n.from,n.to)==0&&Ie(n.from,re.to)==0?re.to=$r(n):J.changes.push(Vo(e,n));else{var se=te(m.done);for((!se||!se.ranges)&&oo(e.sel,m.done),J={changes:[Vo(e,n)],generation:m.generation},m.done.push(J);m.done.length>m.undoDepth;)m.done.shift(),m.done[0].ranges||m.done.shift()}m.done.push(s),m.generation=++m.maxGeneration,m.lastModTime=m.lastSelTime=B,m.lastOp=m.lastSelOp=a,m.lastOrigin=m.lastSelOrigin=n.origin,re||nt(e,"historyAdded")}function Ll(e,n,s,a){var m=n.charAt(0);return m=="*"||m=="+"&&s.ranges.length==a.ranges.length&&s.somethingSelected()==a.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function ao(e,n,s,a){var m=e.history,B=a&&a.origin;s==m.lastSelOp||B&&m.lastSelOrigin==B&&(m.lastModTime==m.lastSelTime&&m.lastOrigin==B||Ll(e,B,te(m.done),n))?m.done[m.done.length-1]=n:oo(n,m.done),m.lastSelTime=+new Date,m.lastSelOrigin=B,m.lastSelOp=s,a&&a.clearRedo!==!1&&js(m.undone)}function oo(e,n){var s=te(n);s&&s.ranges&&s.equals(e)||n.push(e)}function Xo(e,n,s,a){var m=n["spans_"+e.id],B=0;e.iter(Math.max(e.first,s),Math.min(e.first+e.size,a),function(J){J.markedSpans&&((m||(m=n["spans_"+e.id]={}))[B]=J.markedSpans),++B})}function so(e){if(!e)return null;for(var n,s=0;s<e.length;++s)e[s].marker.explicitlyCleared?n||(n=e.slice(0,s)):n&&n.push(e[s]);return n?n.length?n:null:e}function Hs(e,n){var s=n["spans_"+e.id];if(!s)return null;for(var a=[],m=0;m<n.text.length;++m)a.push(so(s[m]));return a}function Yo(e,n){var s=Hs(e,n),a=Bn(e,n);if(!s)return a;if(!a)return s;for(var m=0;m<s.length;++m){var B=s[m],J=a[m];if(B&&J){e:for(var re=0;re<J.length;++re){for(var se=J[re],ge=0;ge<B.length;++ge)if(B[ge].marker==se.marker)continue e;B.push(se)}}else J&&(s[m]=J)}return s}function ca(e,n,s){for(var a=[],m=0;m<e.length;++m){var B=e[m];if(B.ranges){a.push(s?mr.prototype.deepCopy.call(B):B);continue}var J=B.changes,re=[];a.push({changes:re});for(var se=0;se<J.length;++se){var ge=J[se],Ne=void 0;if(re.push({from:ge.from,to:ge.to,text:ge.text}),n)for(var Ve in ge)(Ne=Ve.match(/^spans_(\d+)$/))&&(ae(n,Number(Ne[1]))>-1&&(te(re)[Ve]=ge[Ve],delete ge[Ve]))}}return a}function lo(e,n,s,a){if(a){var m=e.anchor;if(s){var B=Ie(n,m)<0;B!=Ie(s,m)<0?(m=n,n=s):B!=Ie(n,s)<0&&(n=s)}return new Mi(m,n)}else return new Mi(s||n,n)}function uo(e,n,s,a,m){m==null&&(m=e.cm&&(e.cm.display.shift||e.extend)),nr(e,new mr([lo(e.sel.primary(),n,s,m)],0),a)}function Ks(e,n,s){for(var a=[],m=e.cm&&(e.cm.display.shift||e.extend),B=0;B<e.sel.ranges.length;B++)a[B]=lo(e.sel.ranges[B],n[B],null,m);var J=Cr(e.cm,a,e.sel.primIndex);nr(e,J,s)}function Br(e,n,s,a){var m=e.sel.ranges.slice(0);m[n]=s,nr(e,Cr(e.cm,m,e.sel.primIndex),a)}function Gs(e,n,s,a){nr(e,Fr(n,s),a)}function Il(e,n,s){var a={ranges:n.ranges,update:function(m){this.ranges=[];for(var B=0;B<m.length;B++)this.ranges[B]=new Mi(C(e,m[B].anchor),C(e,m[B].head))},origin:s&&s.origin};return nt(e,"beforeSelectionChange",e,a),e.cm&&nt(e.cm,"beforeSelectionChange",e.cm,a),a.ranges!=n.ranges?Cr(e.cm,a.ranges,a.ranges.length-1):n}function zs(e,n,s){var a=e.history.done,m=te(a);m&&m.ranges?(a[a.length-1]=n,ha(e,n,s)):nr(e,n,s)}function nr(e,n,s){ha(e,n,s),ao(e,e.sel,e.cm?e.cm.curOp.id:NaN,s)}function ha(e,n,s){(Ae(e,"beforeSelectionChange")||e.cm&&Ae(e.cm,"beforeSelectionChange"))&&(n=Il(e,n,s));var a=s&&s.bias||(Ie(n.primary().head,e.sel.primary().head)<0?-1:1);Vs(e,Ys(e,n,a,!0)),!(s&&s.scroll===!1)&&e.cm&&ia(e.cm)}function Vs(e,n){if(n.equals(e.sel))return;e.sel=n,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Ue(e.cm)),nn(e,"cursorActivity",e)}function Xs(e){Vs(e,Ys(e,e.sel,null,!1))}function Ys(e,n,s,a){for(var m,B=0;B<n.ranges.length;B++){var J=n.ranges[B],re=n.ranges.length==e.sel.ranges.length&&e.sel.ranges[B],se=co(e,J.anchor,re&&re.anchor,s,a),ge=co(e,J.head,re&&re.head,s,a);(m||se!=J.anchor||ge!=J.head)&&(m||(m=n.ranges.slice(0,B)),m[B]=new Mi(se,ge))}return m?Cr(e.cm,m,n.primIndex):n}function fa(e,n,s,a,m){var B=pt(e,n.line);if(B.markedSpans)for(var J=0;J<B.markedSpans.length;++J){var re=B.markedSpans[J],se=re.marker,ge="selectLeft"in se?!se.selectLeft:se.inclusiveLeft,Ne="selectRight"in se?!se.selectRight:se.inclusiveRight;if((re.from==null||(ge?re.from<=n.ch:re.from<n.ch))&&(re.to==null||(Ne?re.to>=n.ch:re.to>n.ch))){if(m&&(nt(se,"beforeCursorEnter"),se.explicitlyCleared))if(B.markedSpans){--J;continue}else break;if(!se.atomic)continue;if(s){var Ve=se.find(a<0?1:-1),ht=void 0;if((a<0?Ne:ge)&&(Ve=$s(e,Ve,-a,Ve&&Ve.line==n.line?B:null)),Ve&&Ve.line==n.line&&(ht=Ie(Ve,s))&&(a<0?ht<0:ht>0))return fa(e,Ve,n,a,m)}var lt=se.find(a<0?-1:1);return(a<0?ge:Ne)&&(lt=$s(e,lt,a,lt.line==n.line?B:null)),lt?fa(e,lt,n,a,m):null}}return n}function co(e,n,s,a,m){var B=a||1,J=fa(e,n,s,B,m)||!m&&fa(e,n,s,B,!0)||fa(e,n,s,-B,m)||!m&&fa(e,n,s,-B,!0);return J||(e.cantEdit=!0,Be(e.first,0))}function $s(e,n,s,a){return s<0&&n.ch==0?n.line>e.first?C(e,Be(n.line-1)):null:s>0&&n.ch==(a||pt(e,n.line)).text.length?n.line<e.first+e.size-1?Be(n.line+1,0):null:new Be(n.line,n.ch+s)}function Qs(e){e.setSelection(Be(e.firstLine(),0),Be(e.lastLine()),Ce)}function $o(e,n,s){var a={canceled:!1,from:n.from,to:n.to,text:n.text,origin:n.origin,cancel:function(){return a.canceled=!0}};return s&&(a.update=function(m,B,J,re){m&&(a.from=C(e,m)),B&&(a.to=C(e,B)),J&&(a.text=J),re!==void 0&&(a.origin=re)}),nt(e,"beforeChange",e,a),e.cm&&nt(e.cm,"beforeChange",e.cm,a),a.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:a.from,to:a.to,text:a.text,origin:a.origin}}function pa(e,n,s){if(e.cm){if(!e.cm.curOp)return Gi(e.cm,pa)(e,n,s);if(e.cm.state.suppressEdits)return}if((Ae(e,"beforeChange")||e.cm&&Ae(e.cm,"beforeChange"))&&(n=$o(e,n,!0),!n))return;var a=hn&&!s&&Zn(e,n.from,n.to);if(a)for(var m=a.length-1;m>=0;--m)qs(e,{from:a[m].from,to:a[m].to,text:m?[""]:n.text,origin:n.origin});else qs(e,n)}function qs(e,n){if(n.text.length==1&&n.text[0]==""&&Ie(n.from,n.to)==0)return;var s=Pa(e,n);Ws(e,n,s,e.cm?e.cm.curOp.id:NaN),ma(e,n,s,Bn(e,n));var a=[];wr(e,function(m,B){!B&&ae(a,m.history)==-1&&(tl(m.history,n),a.push(m.history)),ma(m,n,null,Bn(m,n))})}function ho(e,n,s){var a=e.cm&&e.cm.state.suppressEdits;if(a&&!s)return;for(var m=e.history,B,J=e.sel,re=n=="undo"?m.done:m.undone,se=n=="undo"?m.undone:m.done,ge=0;ge<re.length&&!(B=re[ge],s?B.ranges&&!B.equals(e.sel):!B.ranges);ge++);if(ge==re.length)return;for(m.lastOrigin=m.lastSelOrigin=null;;)if(B=re.pop(),B.ranges){if(oo(B,se),s&&!B.equals(e.sel)){nr(e,B,{clearRedo:!1});return}J=B}else if(a){re.push(B);return}else break;var Ne=[];oo(J,se),se.push({changes:Ne,generation:m.generation}),m.generation=B.generation||++m.maxGeneration;for(var Ve=Ae(e,"beforeChange")||e.cm&&Ae(e.cm,"beforeChange"),ht=function(ln){var xn=B.changes[ln];if(xn.origin=n,Ve&&!$o(e,xn,!1))return re.length=0,{};Ne.push(Vo(e,xn));var Kn=ln?Pa(e,xn):te(re);ma(e,xn,Kn,Yo(e,xn)),!ln&&e.cm&&e.cm.scrollIntoView({from:xn.from,to:$r(xn)});var ri=[];wr(e,function(Gn,di){!di&&ae(ri,Gn.history)==-1&&(tl(Gn.history,xn),ri.push(Gn.history)),ma(Gn,xn,null,Yo(Gn,xn))})},lt=B.changes.length-1;lt>=0;--lt){var Ht=ht(lt);if(Ht)return Ht.v}}function Js(e,n){if(n==0)return;if(e.first+=n,e.sel=new mr(me(e.sel.ranges,function(m){return new Mi(Be(m.anchor.line+n,m.anchor.ch),Be(m.head.line+n,m.head.ch))}),e.sel.primIndex),e.cm){lr(e.cm,e.first,e.first-n,n);for(var s=e.cm.display,a=s.viewFrom;a<s.viewTo;a++)Mr(e.cm,a,"gutter")}}function ma(e,n,s,a){if(e.cm&&!e.cm.curOp)return Gi(e.cm,ma)(e,n,s,a);if(n.to.line<e.first){Js(e,n.text.length-1-(n.to.line-n.from.line));return}if(n.from.line>e.lastLine())return;if(n.from.line<e.first){var m=n.text.length-1-(e.first-n.from.line);Js(e,m),n={from:Be(e.first,0),to:Be(n.to.line+m,n.to.ch),text:[te(n.text)],origin:n.origin}}var B=e.lastLine();n.to.line>B&&(n={from:n.from,to:Be(B,pt(e,B).text.length),text:[n.text[0]],origin:n.origin}),n.removed=Je(e,n.from,n.to),s||(s=Pa(e,n)),e.cm?kl(e.cm,n,a):Go(e,n,a),ha(e,s,Ce),e.cantEdit&&co(e,Be(e.firstLine(),0))&&(e.cantEdit=!1)}function kl(e,n,s){var a=e.doc,m=e.display,B=n.from,J=n.to,re=!1,se=B.line;e.options.lineWrapping||(se=Fe(_n(pt(a,B.line))),a.iter(se,J.line+1,function(lt){if(lt==m.maxLine)return re=!0,!0})),a.sel.contains(n.from,n.to)>-1&&Ue(e),Go(a,n,s,_s(e)),e.options.lineWrapping||(a.iter(se,B.line+n.text.length,function(lt){var Ht=Wt(lt);Ht>m.maxLineLength&&(m.maxLine=lt,m.maxLineLength=Ht,m.maxLineChanged=!0,re=!1)}),re&&(e.curOp.updateMaxLine=!0)),Qt(a,B.line),tr(e,400);var ge=n.text.length-(J.line-B.line)-1;n.full?lr(e):B.line==J.line&&n.text.length==1&&!Fs(e.doc,n)?Mr(e,B.line,"text"):lr(e,B.line,J.line+1,ge);var Ne=Ae(e,"changes"),Ve=Ae(e,"change");if(Ve||Ne){var ht={from:B,to:J,text:n.text,removed:n.removed,origin:n.origin};Ve&&nn(e,"change",e,ht),Ne&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(ht)}e.display.selForContextMenu=null}function va(e,n,s,a,m){var B;a||(a=s),Ie(a,s)<0&&(B=[a,s],s=B[0],a=B[1]),typeof n=="string"&&(n=e.splitLines(n)),pa(e,{from:s,to:a,text:n,origin:m})}function Zs(e,n,s,a){s<e.line?e.line+=a:n<e.line&&(e.line=n,e.ch=0)}function el(e,n,s,a){for(var m=0;m<e.length;++m){var B=e[m],J=!0;if(B.ranges){B.copied||(B=e[m]=B.deepCopy(),B.copied=!0);for(var re=0;re<B.ranges.length;re++)Zs(B.ranges[re].anchor,n,s,a),Zs(B.ranges[re].head,n,s,a);continue}for(var se=0;se<B.changes.length;++se){var ge=B.changes[se];if(s<ge.from.line)ge.from=Be(ge.from.line+a,ge.from.ch),ge.to=Be(ge.to.line+a,ge.to.ch);else if(n<=ge.to.line){J=!1;break}}J||(e.splice(0,m+1),m=0)}}function tl(e,n){var s=n.from.line,a=n.to.line,m=n.text.length-(a-s)-1;el(e.done,s,a,m),el(e.undone,s,a,m)}function ka(e,n,s,a){var m=n,B=n;return typeof n=="number"?B=pt(e,Q(e,n)):m=Fe(n),m==null?null:(a(B,m)&&e.cm&&Mr(e.cm,m,s),B)}function jr(e){this.lines=e,this.parent=null;for(var n=0,s=0;s<e.length;++s)e[s].parent=this,n+=e[s].height;this.height=n}jr.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,n){for(var s=e,a=e+n;s<a;++s){var m=this.lines[s];this.height-=m.height,gt(m),nn(m,"delete")}this.lines.splice(e,n)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,n,s){this.height+=s,this.lines=this.lines.slice(0,e).concat(n).concat(this.lines.slice(e));for(var a=0;a<n.length;++a)n[a].parent=this},iterN:function(e,n,s){for(var a=e+n;e<a;++e)if(s(this.lines[e]))return!0}};function ga(e){this.children=e;for(var n=0,s=0,a=0;a<e.length;++a){var m=e[a];n+=m.chunkSize(),s+=m.height,m.parent=this}this.size=n,this.height=s,this.parent=null}ga.prototype={chunkSize:function(){return this.size},removeInner:function(e,n){this.size-=n;for(var s=0;s<this.children.length;++s){var a=this.children[s],m=a.chunkSize();if(e<m){var B=Math.min(n,m-e),J=a.height;if(a.removeInner(e,B),this.height-=J-a.height,m==B&&(this.children.splice(s--,1),a.parent=null),(n-=B)==0)break;e=0}else e-=m}if(this.size-n<25&&(this.children.length>1||!(this.children[0]instanceof jr))){var re=[];this.collapse(re),this.children=[new jr(re)],this.children[0].parent=this}},collapse:function(e){for(var n=0;n<this.children.length;++n)this.children[n].collapse(e)},insertInner:function(e,n,s){this.size+=n.length,this.height+=s;for(var a=0;a<this.children.length;++a){var m=this.children[a],B=m.chunkSize();if(e<=B){if(m.insertInner(e,n,s),m.lines&&m.lines.length>50){for(var J=m.lines.length%25+25,re=J;re<m.lines.length;){var se=new jr(m.lines.slice(re,re+=25));m.height-=se.height,this.children.splice(++a,0,se),se.parent=this}m.lines=m.lines.slice(0,J),this.maybeSpill()}break}e-=B}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var n=e.children.splice(e.children.length-5,5),s=new ga(n);if(e.parent){e.size-=s.size,e.height-=s.height;var m=ae(e.parent.children,e);e.parent.children.splice(m+1,0,s)}else{var a=new ga(e.children);a.parent=e,e.children=[a,s],e=a}s.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,n,s){for(var a=0;a<this.children.length;++a){var m=this.children[a],B=m.chunkSize();if(e<B){var J=Math.min(n,B-e);if(m.iterN(e,J,s))return!0;if((n-=J)==0)break;e=0}else e-=B}}};var Ma=function(e,n,s){if(s)for(var a in s)s.hasOwnProperty(a)&&(this[a]=s[a]);this.doc=e,this.node=n};Ma.prototype.clear=function(){var e=this.doc.cm,n=this.line.widgets,s=this.line,a=Fe(s);if(a==null||!n)return;for(var m=0;m<n.length;++m)n[m]==this&&n.splice(m--,1);n.length||(s.widgets=null);var B=Ui(this);Bt(s,Math.max(0,s.height-B)),e&&(cr(e,function(){nl(e,s,-B),Mr(e,a,"widget")}),nn(e,"lineWidgetCleared",e,this,a))},Ma.prototype.changed=function(){var e=this,n=this.height,s=this.doc.cm,a=this.line;this.height=null;var m=Ui(this)-n;if(!m)return;Mt(this.doc,a)||Bt(a,a.height+m),s&&cr(s,function(){s.curOp.forceUpdate=!0,nl(s,a,m),nn(s,"lineWidgetChanged",s,e,Fe(a))})},Re(Ma);function nl(e,n,s){qt(n)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&eo(e,s)}function Ml(e,n,s,a){var m=new Ma(e,s,a),B=e.cm;return B&&m.noHScroll&&(B.display.alignWidgets=!0),ka(e,n,"widget",function(J){var re=J.widgets||(J.widgets=[]);if(m.insertAt==null?re.push(m):re.splice(Math.min(re.length-1,Math.max(0,m.insertAt)),0,m),m.line=J,B&&!Mt(e,J)){var se=qt(J)<e.scrollTop;Bt(J,J.height+Ui(m)),se&&eo(B,m.height),B.curOp.forceUpdate=!0}return!0}),B&&nn(B,"lineWidgetAdded",B,m,typeof n=="number"?n:Fe(n)),m}var il=0,br=function(e,n){this.lines=[],this.type=n,this.doc=e,this.id=++il};br.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,n=e&&!e.curOp;if(n&&Vr(e),Ae(this,"clear")){var s=this.find();s&&nn(this,"clear",s.from,s.to)}for(var a=null,m=null,B=0;B<this.lines.length;++B){var J=this.lines[B],re=Tn(J.markedSpans,this);e&&!this.collapsed?Mr(e,Fe(J),"text"):e&&(re.to!=null&&(m=Fe(J)),re.from!=null&&(a=Fe(J))),J.markedSpans=qn(J.markedSpans,re),re.from==null&&this.collapsed&&!Mt(this.doc,J)&&e&&Bt(J,Jr(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var se=0;se<this.lines.length;++se){var ge=_n(this.lines[se]),Ne=Wt(ge);Ne>e.display.maxLineLength&&(e.display.maxLine=ge,e.display.maxLineLength=Ne,e.display.maxLineChanged=!0)}a!=null&&e&&this.collapsed&&lr(e,a,m+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Xs(e.doc)),e&&nn(e,"markerCleared",e,this,a,m),n&&Xr(e),this.parent&&this.parent.clear()},br.prototype.find=function(e,n){e==null&&this.type=="bookmark"&&(e=1);for(var s,a,m=0;m<this.lines.length;++m){var B=this.lines[m],J=Tn(B.markedSpans,this);if(J.from!=null&&(s=Be(n?B:Fe(B),J.from),e==-1))return s;if(J.to!=null&&(a=Be(n?B:Fe(B),J.to),e==1))return a}return s&&{from:s,to:a}},br.prototype.changed=function(){var e=this,n=this.find(-1,!0),s=this,a=this.doc.cm;if(!n||!a)return;cr(a,function(){var m=n.line,B=Fe(n.line),J=Kr(a,B);if(J&&(hs(J),a.curOp.selectionChanged=a.curOp.forceUpdate=!0),a.curOp.updateMaxLine=!0,!Mt(s.doc,m)&&s.height!=null){var re=s.height;s.height=null;var se=Ui(s)-re;se&&Bt(m,m.height+se)}nn(a,"markerChanged",a,e)})},br.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var n=this.doc.cm.curOp;(!n.maybeHiddenMarkers||ae(n.maybeHiddenMarkers,this)==-1)&&(n.maybeUnhiddenMarkers||(n.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},br.prototype.detachLine=function(e){if(this.lines.splice(ae(this.lines,e),1),!this.lines.length&&this.doc.cm){var n=this.doc.cm.curOp;(n.maybeHiddenMarkers||(n.maybeHiddenMarkers=[])).push(this)}},Re(br);function _a(e,n,s,a,m){if(a&&a.shared)return Nl(e,n,s,a,m);if(e.cm&&!e.cm.curOp)return Gi(e.cm,_a)(e,n,s,a,m);var B=new br(e,m),J=Ie(n,s);if(a&&x(a,B,!1),J>0||J==0&&B.clearWhenEmpty!==!1)return B;if(B.replacedWith&&(B.collapsed=!0,B.widgetNode=h("span",[B.replacedWith],"CodeMirror-widget"),a.handleMouseEvents||B.widgetNode.setAttribute("cm-ignore-events","true"),a.insertLeft&&(B.widgetNode.insertLeft=!0)),B.collapsed){if(vn(e,n.line,n,s,B)||n.line!=s.line&&vn(e,s.line,n,s,B))throw new Error("Inserting collapsed marker partially overlapping an existing one");$n()}B.addToHistory&&Ws(e,{from:n,to:s,origin:"markText"},e.sel,NaN);var re=n.line,se=e.cm,ge;if(e.iter(re,s.line+1,function(Ve){se&&B.collapsed&&!se.options.lineWrapping&&_n(Ve)==se.display.maxLine&&(ge=!0),B.collapsed&&re!=n.line&&Bt(Ve,0),En(Ve,new jn(B,re==n.line?n.ch:null,re==s.line?s.ch:null)),++re}),B.collapsed&&e.iter(n.line,s.line+1,function(Ve){Mt(e,Ve)&&Bt(Ve,0)}),B.clearOnEnter&&Ye(B,"beforeCursorEnter",function(){return B.clear()}),B.readOnly&&(Nt(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),B.collapsed&&(B.id=++il,B.atomic=!0),se){if(ge&&(se.curOp.updateMaxLine=!0),B.collapsed)lr(se,n.line,s.line+1);else if(B.className||B.startStyle||B.endStyle||B.css||B.attributes||B.title)for(var Ne=n.line;Ne<=s.line;Ne++)Mr(se,Ne,"text");B.atomic&&Xs(se.doc),nn(se,"markerAdded",se,B)}return B}var ya=function(e,n){this.markers=e,this.primary=n;for(var s=0;s<e.length;++s)e[s].parent=this};ya.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();nn(this,"clear")},ya.prototype.find=function(e,n){return this.primary.find(e,n)},Re(ya);function Nl(e,n,s,a,m){a=x(a),a.shared=!1;var B=[_a(e,n,s,a,m)],J=B[0],re=a.widgetNode;return wr(e,function(se){re&&(a.widgetNode=re.cloneNode(!0)),B.push(_a(se,C(se,n),C(se,s),a,m));for(var ge=0;ge<se.linked.length;++ge)if(se.linked[ge].isParent)return;J=te(B)}),new ya(B,J)}function rl(e){return e.findMarks(Be(e.first,0),e.clipPos(Be(e.lastLine())),function(n){return n.parent})}function ru(e,n){for(var s=0;s<n.length;s++){var a=n[s],m=a.find(),B=e.clipPos(m.from),J=e.clipPos(m.to);if(Ie(B,J)){var re=_a(e,B,J,a.primary,a.primary.type);a.markers.push(re),re.parent=a}}}function Ul(e){for(var n=function(a){var m=e[a],B=[m.primary.doc];wr(m.primary.doc,function(se){return B.push(se)});for(var J=0;J<m.markers.length;J++){var re=m.markers[J];ae(B,re.doc)==-1&&(re.parent=null,m.markers.splice(J--,1))}},s=0;s<e.length;s++)n(s)}var Qo=0,ur=function(e,n,s,a,m){if(!(this instanceof ur))return new ur(e,n,s,a,m);s==null&&(s=0),ga.call(this,[new jr([new On("",null)])]),this.first=s,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=s;var B=Be(s,0);this.sel=Fr(B),this.history=new ro(null),this.id=++Qo,this.modeOption=n,this.lineSep=a,this.direction=m=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Go(this,{from:B,to:B,text:e}),nr(this,Fr(B),Ce)};ur.prototype=$e(ga.prototype,{constructor:ur,iter:function(e,n,s){s?this.iterN(e-this.first,n-e,s):this.iterN(this.first,this.first+this.size,e)},insert:function(e,n){for(var s=0,a=0;a<n.length;++a)s+=n[a].height;this.insertInner(e-this.first,n,s)},remove:function(e,n){this.removeInner(e-this.first,n)},getValue:function(e){var n=Ft(this,this.first,this.first+this.size);return e===!1?n:n.join(e||this.lineSeparator())},setValue:$i(function(e){var n=Be(this.first,0),s=this.first+this.size-1;pa(this,{from:n,to:Be(s,pt(this,s).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&ra(this.cm,0,0),nr(this,Fr(n),Ce)}),replaceRange:function(e,n,s,a){n=C(this,n),s=s?C(this,s):n,va(this,e,n,s,a)},getRange:function(e,n,s){var a=Je(this,C(this,e),C(this,n));return s===!1?a:a.join(s||this.lineSeparator())},getLine:function(e){var n=this.getLineHandle(e);return n&&n.text},getLineHandle:function(e){if(si(this,e))return pt(this,e)},getLineNumber:function(e){return Fe(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=pt(this,e)),_n(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return C(this,e)},getCursor:function(e){var n=this.sel.primary(),s;return e==null||e=="head"?s=n.head:e=="anchor"?s=n.anchor:e=="end"||e=="to"||e===!1?s=n.to():s=n.from(),s},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:$i(function(e,n,s){Gs(this,C(this,typeof e=="number"?Be(e,n||0):e),null,s)}),setSelection:$i(function(e,n,s){Gs(this,C(this,e),C(this,n||e),s)}),extendSelection:$i(function(e,n,s){uo(this,C(this,e),n&&C(this,n),s)}),extendSelections:$i(function(e,n){Ks(this,z(this,e),n)}),extendSelectionsBy:$i(function(e,n){var s=me(this.sel.ranges,e);Ks(this,z(this,s),n)}),setSelections:$i(function(e,n,s){if(!e.length)return;for(var a=[],m=0;m<e.length;m++)a[m]=new Mi(C(this,e[m].anchor),C(this,e[m].head));n==null&&(n=Math.min(e.length-1,this.sel.primIndex)),nr(this,Cr(this.cm,a,n),s)}),addSelection:$i(function(e,n,s){var a=this.sel.ranges.slice(0);a.push(new Mi(C(this,e),C(this,n||e))),nr(this,Cr(this.cm,a,a.length-1),s)}),getSelection:function(e){for(var n=this.sel.ranges,s,a=0;a<n.length;a++){var m=Je(this,n[a].from(),n[a].to());s=s?s.concat(m):m}return e===!1?s:s.join(e||this.lineSeparator())},getSelections:function(e){for(var n=[],s=this.sel.ranges,a=0;a<s.length;a++){var m=Je(this,s[a].from(),s[a].to());e!==!1&&(m=m.join(e||this.lineSeparator())),n[a]=m}return n},replaceSelection:function(e,n,s){for(var a=[],m=0;m<this.sel.ranges.length;m++)a[m]=e;this.replaceSelections(a,n,s||"+input")},replaceSelections:$i(function(e,n,s){for(var a=[],m=this.sel,B=0;B<m.ranges.length;B++){var J=m.ranges[B];a[B]={from:J.from(),to:J.to(),text:this.splitLines(e[B]),origin:s}}for(var re=n&&n!="end"&&Al(this,a,n),se=a.length-1;se>=0;se--)pa(this,a[se]);re?zs(this,re):this.cm&&ia(this.cm)}),undo:$i(function(){ho(this,"undo")}),redo:$i(function(){ho(this,"redo")}),undoSelection:$i(function(){ho(this,"undo",!0)}),redoSelection:$i(function(){ho(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,n=0,s=0,a=0;a<e.done.length;a++)e.done[a].ranges||++n;for(var m=0;m<e.undone.length;m++)e.undone[m].ranges||++s;return{undo:n,redo:s}},clearHistory:function(){var e=this;this.history=new ro(this.history.maxGeneration),wr(this,function(n){return n.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:ca(this.history.done),undone:ca(this.history.undone)}},setHistory:function(e){var n=this.history=new ro(this.history.maxGeneration);n.done=ca(e.done.slice(0),null,!0),n.undone=ca(e.undone.slice(0),null,!0)},setGutterMarker:$i(function(e,n,s){return ka(this,e,"gutter",function(a){var m=a.gutterMarkers||(a.gutterMarkers={});return m[n]=s,!s&&Et(m)&&(a.gutterMarkers=null),!0})}),clearGutter:$i(function(e){var n=this;this.iter(function(s){s.gutterMarkers&&s.gutterMarkers[e]&&ka(n,s,"gutter",function(){return s.gutterMarkers[e]=null,Et(s.gutterMarkers)&&(s.gutterMarkers=null),!0})})}),lineInfo:function(e){var n;if(typeof e=="number"){if(!si(this,e))return null;if(n=e,e=pt(this,e),!e)return null}else if(n=Fe(e),n==null)return null;return{line:n,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:$i(function(e,n,s){return ka(this,e,n=="gutter"?"gutter":"class",function(a){var m=n=="text"?"textClass":n=="background"?"bgClass":n=="gutter"?"gutterClass":"wrapClass";if(!a[m])a[m]=s;else{if(O(s).test(a[m]))return!1;a[m]+=" "+s}return!0})}),removeLineClass:$i(function(e,n,s){return ka(this,e,n=="gutter"?"gutter":"class",function(a){var m=n=="text"?"textClass":n=="background"?"bgClass":n=="gutter"?"gutterClass":"wrapClass",B=a[m];if(B)if(s==null)a[m]=null;else{var J=B.match(O(s));if(!J)return!1;var re=J.index+J[0].length;a[m]=B.slice(0,J.index)+(!J.index||re==B.length?"":" ")+B.slice(re)||null}else return!1;return!0})}),addLineWidget:$i(function(e,n,s){return Ml(this,e,n,s)}),removeLineWidget:function(e){e.clear()},markText:function(e,n,s){return _a(this,C(this,e),C(this,n),s,s&&s.type||"range")},setBookmark:function(e,n){var s={replacedWith:n&&(n.nodeType==null?n.widget:n),insertLeft:n&&n.insertLeft,clearWhenEmpty:!1,shared:n&&n.shared,handleMouseEvents:n&&n.handleMouseEvents};return e=C(this,e),_a(this,e,e,s,"bookmark")},findMarksAt:function(e){e=C(this,e);var n=[],s=pt(this,e.line).markedSpans;if(s)for(var a=0;a<s.length;++a){var m=s[a];(m.from==null||m.from<=e.ch)&&(m.to==null||m.to>=e.ch)&&n.push(m.marker.parent||m.marker)}return n},findMarks:function(e,n,s){e=C(this,e),n=C(this,n);var a=[],m=e.line;return this.iter(e.line,n.line+1,function(B){var J=B.markedSpans;if(J)for(var re=0;re<J.length;re++){var se=J[re];!(se.to!=null&&m==e.line&&e.ch>=se.to||se.from==null&&m!=e.line||se.from!=null&&m==n.line&&se.from>=n.ch)&&(!s||s(se.marker))&&a.push(se.marker.parent||se.marker)}++m}),a},getAllMarks:function(){var e=[];return this.iter(function(n){var s=n.markedSpans;if(s)for(var a=0;a<s.length;++a)s[a].from!=null&&e.push(s[a].marker)}),e},posFromIndex:function(e){var n,s=this.first,a=this.lineSeparator().length;return this.iter(function(m){var B=m.text.length+a;if(B>e)return n=e,!0;e-=B,++s}),C(this,Be(s,n))},indexFromPos:function(e){e=C(this,e);var n=e.ch;if(e.line<this.first||e.ch<0)return 0;var s=this.lineSeparator().length;return this.iter(this.first,e.line,function(a){n+=a.text.length+s}),n},copy:function(e){var n=new ur(Ft(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return n.scrollTop=this.scrollTop,n.scrollLeft=this.scrollLeft,n.sel=this.sel,n.extend=!1,e&&(n.history.undoDepth=this.history.undoDepth,n.setHistory(this.getHistory())),n},linkedDoc:function(e){e||(e={});var n=this.first,s=this.first+this.size;e.from!=null&&e.from>n&&(n=e.from),e.to!=null&&e.to<s&&(s=e.to);var a=new ur(Ft(this,n,s),e.mode||this.modeOption,n,this.lineSep,this.direction);return e.sharedHist&&(a.history=this.history),(this.linked||(this.linked=[])).push({doc:a,sharedHist:e.sharedHist}),a.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],ru(a,rl(this)),a},unlinkDoc:function(e){if(e instanceof Hi&&(e=e.doc),this.linked)for(var n=0;n<this.linked.length;++n){var s=this.linked[n];if(s.doc!=e)continue;this.linked.splice(n,1),e.unlinkDoc(this),Ul(rl(this));break}if(e.history==this.history){var a=[e.id];wr(e,function(m){return a.push(m.id)},!0),e.history=new ro(null),e.history.done=ca(this.history.done,a),e.history.undone=ca(this.history.undone,a)}},iterLinkedDocs:function(e){wr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Jn(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:$i(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(n){return n.order=null}),this.cm&&Dl(this.cm)})}),ur.prototype.eachLine=ur.prototype.iter;var al=0;function Fl(e){var n=this;if(qo(n),vt(n,e)||Ii(n.display,e))return;le(e),Y&&(al=+new Date);var s=Gr(n,e,!0),a=e.dataTransfer.files;if(!s||n.isReadOnly())return;if(a&&a.length&&window.FileReader&&window.File)for(var m=a.length,B=Array(m),J=0,re=function(){++J==m&&Gi(n,function(){s=C(n.doc,s);var lt={from:s,to:s,text:n.doc.splitLines(B.filter(function(Ht){return Ht!=null}).join(n.doc.lineSeparator())),origin:"paste"};pa(n.doc,lt),zs(n.doc,Fr(C(n.doc,s),C(n.doc,$r(lt))))})()},se=function(lt,Ht){if(n.options.allowDropFileTypes&&ae(n.options.allowDropFileTypes,lt.type)==-1){re();return}var ln=new FileReader;ln.onerror=function(){return re()},ln.onload=function(){var xn=ln.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(xn)){re();return}B[Ht]=xn,re()},ln.readAsText(lt)},ge=0;ge<a.length;ge++)se(a[ge],ge);else{if(n.state.draggingText&&n.doc.sel.contains(s)>-1){n.state.draggingText(e),setTimeout(function(){return n.display.input.focus()},20);return}try{var Ne=e.dataTransfer.getData("Text");if(Ne){var Ve;if(n.state.draggingText&&!n.state.draggingText.copy&&(Ve=n.listSelections()),ha(n.doc,Fr(s,s)),Ve)for(var ht=0;ht<Ve.length;++ht)va(n.doc,"",Ve[ht].anchor,Ve[ht].head,"drag");n.replaceSelection(Ne,"around","paste"),n.display.input.focus()}}catch(lt){}}}function ol(e,n){if(Y&&(!e.state.draggingText||+new Date-al<100)){ve(n);return}if(vt(e,n)||Ii(e.display,n))return;if(n.dataTransfer.setData("Text",e.getSelection()),n.dataTransfer.effectAllowed="copyMove",n.dataTransfer.setDragImage&&!p){var s=l("img",null,null,"position: fixed; left: 0; top: 0;");s.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",_&&(s.width=s.height=1,e.display.wrapper.appendChild(s),s._top=s.offsetTop),n.dataTransfer.setDragImage(s,0,0),_&&s.parentNode.removeChild(s)}}function Bl(e,n){var s=Gr(e,n);if(!s)return;var a=document.createDocumentFragment();ys(e,s,a),e.display.dragCursor||(e.display.dragCursor=l("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),d(e.display.dragCursor,a)}function qo(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function sl(e){if(!document.getElementsByClassName)return;for(var n=document.getElementsByClassName("CodeMirror"),s=[],a=0;a<n.length;a++){var m=n[a].CodeMirror;m&&s.push(m)}s.length&&s[0].operation(function(){for(var B=0;B<s.length;B++)e(s[B])})}var Jo=!1;function au(){if(Jo)return;Zo(),Jo=!0}function Zo(){var e;Ye(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,sl(jl)},100))}),Ye(window,"blur",function(){return sl(na)})}function jl(e){var n=e.display;n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.scrollbarsClipped=!1,e.setSize()}for(var Wr={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Na=0;Na<10;Na++)Wr[Na+48]=Wr[Na+96]=String(Na);for(var fo=65;fo<=90;fo++)Wr[fo]=String.fromCharCode(fo);for(var Ua=1;Ua<=12;Ua++)Wr[Ua+111]=Wr[Ua+63235]="F"+Ua;var Lr={};Lr.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Lr.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Lr.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Lr.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Lr.default=c?Lr.macDefault:Lr.pcDefault;function Wl(e){var n=e.split(/-(?!$)/);e=n[n.length-1];for(var s,a,m,B,J=0;J<n.length-1;J++){var re=n[J];if(/^(cmd|meta|m)$/i.test(re))B=!0;else if(/^a(lt)?$/i.test(re))s=!0;else if(/^(c|ctrl|control)$/i.test(re))a=!0;else if(/^s(hift)?$/i.test(re))m=!0;else throw new Error("Unrecognized modifier name: "+re)}return s&&(e="Alt-"+e),a&&(e="Ctrl-"+e),B&&(e="Cmd-"+e),m&&(e="Shift-"+e),e}function ll(e){var n={};for(var s in e)if(e.hasOwnProperty(s)){var a=e[s];if(/^(name|fallthrough|(de|at)tach)$/.test(s))continue;if(a=="..."){delete e[s];continue}for(var m=me(s.split(" "),Wl),B=0;B<m.length;B++){var J=void 0,re=void 0;B==m.length-1?(re=m.join(" "),J=a):(re=m.slice(0,B+1).join(" "),J="...");var se=n[re];if(!se)n[re]=J;else if(se!=J)throw new Error("Inconsistent bindings for "+re)}delete e[s]}for(var ge in n)e[ge]=n[ge];return e}function Ir(e,n,s,a){n=Ba(n);var m=n.call?n.call(e,a):n[e];if(m===!1)return"nothing";if(m==="...")return"multi";if(m!=null&&s(m))return"handled";if(n.fallthrough){if(Object.prototype.toString.call(n.fallthrough)!="[object Array]")return Ir(e,n.fallthrough,s,a);for(var B=0;B<n.fallthrough.length;B++){var J=Ir(e,n.fallthrough[B],s,a);if(J)return J}}}function Fa(e){var n=typeof e=="string"?e:Wr[e.keyCode];return n=="Ctrl"||n=="Alt"||n=="Shift"||n=="Mod"}function ul(e,n,s){var a=e;return n.altKey&&a!="Alt"&&(e="Alt-"+e),(w?n.metaKey:n.ctrlKey)&&a!="Ctrl"&&(e="Ctrl-"+e),(w?n.ctrlKey:n.metaKey)&&a!="Mod"&&(e="Cmd-"+e),!s&&n.shiftKey&&a!="Shift"&&(e="Shift-"+e),e}function po(e,n){if(_&&e.keyCode==34&&e.char)return!1;var s=Wr[e.keyCode];return s==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(s=e.code),ul(s,e,n))}function Ba(e){return typeof e=="string"?Lr[e]:e}function ba(e,n){for(var s=e.doc.sel.ranges,a=[],m=0;m<s.length;m++){for(var B=n(s[m]);a.length&&Ie(B.from,te(a).to)<=0;){var J=a.pop();if(Ie(J.from,B.from)<0){B.from=J.from;break}}a.push(B)}cr(e,function(){for(var re=a.length-1;re>=0;re--)va(e.doc,"",a[re].from,a[re].to,"+delete");ia(e)})}function es(e,n,s){var a=ut(e.text,n+s,s);return a<0||a>e.text.length?null:a}function ts(e,n,s){var a=es(e,n.ch,s);return a==null?null:new Be(n.line,a,s<0?"after":"before")}function ns(e,n,s,a,m){if(e){n.doc.direction=="rtl"&&(m=-m);var B=Cn(s,n.doc.direction);if(B){var J=m<0?te(B):B[0],re=m<0==(J.level==1),se=re?"after":"before",ge;if(J.level>0||n.doc.direction=="rtl"){var Ne=kr(n,s);ge=m<0?s.text.length-1:0;var Ve=ar(n,Ne,ge).top;ge=Xt(function(ht){return ar(n,Ne,ht).top==Ve},m<0==(J.level==1)?J.from:J.to-1,ge),se=="before"&&(ge=es(s,ge,1))}else ge=m<0?J.to:J.from;return new Be(a,ge,se)}}return new Be(a,m<0?s.text.length:0,m<0?"before":"after")}function is(e,n,s,a){var m=Cn(n,e.doc.direction);if(!m)return ts(n,s,a);s.ch>=n.text.length?(s.ch=n.text.length,s.sticky="before"):s.ch<=0&&(s.ch=0,s.sticky="after");var B=pn(m,s.ch,s.sticky),J=m[B];if(e.doc.direction=="ltr"&&J.level%2==0&&(a>0?J.to>s.ch:J.from<s.ch))return ts(n,s,a);var re=function(Kn,ri){return es(n,Kn instanceof Be?Kn.ch:Kn,ri)},se,ge=function(Kn){return e.options.lineWrapping?(se=se||kr(e,n),gs(e,n,se,Kn)):{begin:0,end:n.text.length}},Ne=ge(s.sticky=="before"?re(s,-1):s.ch);if(e.doc.direction=="rtl"||J.level==1){var Ve=J.level==1==a<0,ht=re(s,Ve?1:-1);if(ht!=null&&(Ve?ht<=J.to&&ht<=Ne.end:ht>=J.from&&ht>=Ne.begin)){var lt=Ve?"before":"after";return new Be(s.line,ht,lt)}}var Ht=function(Kn,ri,Gn){for(var di=function(Wi,ir){return ir?new Be(s.line,re(Wi,1),"before"):new Be(s.line,Wi,"after")};Kn>=0&&Kn<m.length;Kn+=ri){var Ri=m[Kn],Si=ri>0==(Ri.level!=1),Di=Si?Gn.begin:re(Gn.end,-1);if(Ri.from<=Di&&Di<Ri.to)return di(Di,Si);if(Di=Si?Ri.from:re(Ri.to,-1),Gn.begin<=Di&&Di<Gn.end)return di(Di,Si)}},ln=Ht(B+a,a,Ne);if(ln)return ln;var xn=a>0?Ne.end:re(Ne.begin,-1);return xn!=null&&!(a>0&&xn==n.text.length)&&(ln=Ht(a>0?0:m.length-1,a,ge(xn)),ln)?ln:null}var Ea={selectAll:Qs,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Ce)},killLine:function(e){return ba(e,function(n){if(n.empty()){var s=pt(e.doc,n.head.line).text.length;return n.head.ch==s&&n.head.line<e.lastLine()?{from:n.head,to:Be(n.head.line+1,0)}:{from:n.head,to:Be(n.head.line,s)}}else return{from:n.from(),to:n.to()}})},deleteLine:function(e){return ba(e,function(n){return{from:Be(n.from().line,0),to:C(e.doc,Be(n.to().line+1,0))}})},delLineLeft:function(e){return ba(e,function(n){return{from:Be(n.from().line,0),to:n.from()}})},delWrappedLineLeft:function(e){return ba(e,function(n){var s=e.charCoords(n.head,"div").top+5,a=e.coordsChar({left:0,top:s},"div");return{from:a,to:n.from()}})},delWrappedLineRight:function(e){return ba(e,function(n){var s=e.charCoords(n.head,"div").top+5,a=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:s},"div");return{from:n.from(),to:a}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(Be(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Be(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(n){return mo(e,n.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(n){return dl(e,n.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(n){return rs(e,n.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(n){var s=e.cursorCoords(n.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:s},"div")},xe)},goLineLeft:function(e){return e.extendSelectionsBy(function(n){var s=e.cursorCoords(n.head,"div").top+5;return e.coordsChar({left:0,top:s},"div")},xe)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(n){var s=e.cursorCoords(n.head,"div").top+5,a=e.coordsChar({left:0,top:s},"div");return a.ch<e.getLine(a.line).search(/\S/)?dl(e,n.head):a},xe)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var n=[],s=e.listSelections(),a=e.options.tabSize,m=0;m<s.length;m++){var B=s[m].from(),J=j(e.getLine(B.line),B.ch,a);n.push(be(a-J%a))}e.replaceSelections(n)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return cr(e,function(){for(var n=e.listSelections(),s=[],a=0;a<n.length;a++){if(!n[a].empty())continue;var m=n[a].head,B=pt(e.doc,m.line).text;if(B){if(m.ch==B.length&&(m=new Be(m.line,m.ch-1)),m.ch>0)m=new Be(m.line,m.ch+1),e.replaceRange(B.charAt(m.ch-1)+B.charAt(m.ch-2),Be(m.line,m.ch-2),m,"+transpose");else if(m.line>e.doc.first){var J=pt(e.doc,m.line-1).text;J&&(m=new Be(m.line,1),e.replaceRange(B.charAt(0)+e.doc.lineSeparator()+J.charAt(J.length-1),Be(m.line-1,J.length-1),m,"+transpose"))}}s.push(new Mi(m,m))}e.setSelections(s)})},newlineAndIndent:function(e){return cr(e,function(){for(var n=e.listSelections(),s=n.length-1;s>=0;s--)e.replaceRange(e.doc.lineSeparator(),n[s].anchor,n[s].head,"+input");n=e.listSelections();for(var a=0;a<n.length;a++)e.indentLine(n[a].from().line,null,!0);ia(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function mo(e,n){var s=pt(e.doc,n),a=_n(s);return a!=s&&(n=Fe(a)),ns(!0,e,a,n,1)}function rs(e,n){var s=pt(e.doc,n),a=un(s);return a!=s&&(n=Fe(a)),ns(!0,e,s,n,-1)}function dl(e,n){var s=mo(e,n.line),a=pt(e.doc,s.line),m=Cn(a,e.doc.direction);if(!m||m[0].level==0){var B=Math.max(s.ch,a.text.search(/\S/)),J=n.line==s.line&&n.ch<=B&&n.ch;return Be(s.line,J?0:B,s.sticky)}return s}function vo(e,n,s){if(typeof n=="string"&&(n=Ea[n],!n))return!1;e.display.input.ensurePolled();var a=e.display.shift,m=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),s&&(e.display.shift=!1),m=n(e)!=pe}finally{e.display.shift=a,e.state.suppressEdits=!1}return m}function Hl(e,n,s){for(var a=0;a<e.state.keyMaps.length;a++){var m=Ir(n,e.state.keyMaps[a],s,e);if(m)return m}return e.options.extraKeys&&Ir(n,e.options.extraKeys,s,e)||Ir(n,e.options.keyMap,s,e)}var Kl=new $;function ja(e,n,s,a){var m=e.state.keySeq;if(m){if(Fa(n))return"handled";if(/\'$/.test(n)?e.state.keySeq=null:Kl.set(50,function(){e.state.keySeq==m&&(e.state.keySeq=null,e.display.input.reset())}),as(e,m+" "+n,s,a))return!0}return as(e,n,s,a)}function as(e,n,s,a){var m=Hl(e,n,a);return m=="multi"&&(e.state.keySeq=n),m=="handled"&&nn(e,"keyHandled",e,n,s),(m=="handled"||m=="multi")&&(le(s),Mo(e)),!!m}function cl(e,n){var s=po(n,!0);return s?n.shiftKey&&!e.state.keySeq?ja(e,"Shift-"+s,n,function(a){return vo(e,a,!0)})||ja(e,s,n,function(a){if(typeof a=="string"?/^go[A-Z]/.test(a):a.motion)return vo(e,a)}):ja(e,s,n,function(a){return vo(e,a)}):!1}function Gl(e,n,s){return ja(e,"'"+s+"'",n,function(a){return vo(e,a,!0)})}var os=null;function hl(e){var n=this;if(e.target&&e.target!=n.display.input.getField())return;if(n.curOp.focus=F(),vt(n,e))return;Y&&X<11&&e.keyCode==27&&(e.returnValue=!1);var s=e.keyCode;n.display.shift=s==16||e.shiftKey;var a=cl(n,e);_&&(os=a?s:null,!a&&s==88&&!pi&&(c?e.metaKey:e.ctrlKey)&&n.replaceSelection("",null,"cut")),U&&!c&&!a&&s==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),s==18&&!/\bCodeMirror-crosshair\b/.test(n.display.lineDiv.className)&&zl(n)}function zl(e){var n=e.display.lineDiv;N(n,"CodeMirror-crosshair");function s(a){(a.keyCode==18||!a.altKey)&&(E(n,"CodeMirror-crosshair"),bt(document,"keyup",s),bt(document,"mouseover",s))}Ye(document,"keyup",s),Ye(document,"mouseover",s)}function fl(e){e.keyCode==16&&(this.doc.sel.shift=!1),vt(this,e)}function pl(e){var n=this;if(e.target&&e.target!=n.display.input.getField())return;if(Ii(n.display,e)||vt(n,e)||e.ctrlKey&&!e.altKey||c&&e.metaKey)return;var s=e.keyCode,a=e.charCode;if(_&&s==os){os=null,le(e);return}if(_&&(!e.which||e.which<10)&&cl(n,e))return;var m=String.fromCharCode(a==null?s:a);if(m=="\b")return;if(Gl(n,e,m))return;n.display.input.onKeyPress(e)}var Vl=400,ss=function(e,n,s){this.time=e,this.pos=n,this.button=s};ss.prototype.compare=function(e,n,s){return this.time+Vl>e&&Ie(n,this.pos)==0&&s==this.button};var Wa,Ha;function Xl(e,n){var s=+new Date;return Ha&&Ha.compare(s,e,n)?(Wa=Ha=null,"triple"):Wa&&Wa.compare(s,e,n)?(Ha=new ss(s,e,n),Wa=null,"double"):(Wa=new ss(s,e,n),Ha=null,"single")}function ls(e){var n=this,s=n.display;if(vt(n,e)||s.activeTouch&&s.input.supportsTouch())return;if(s.input.ensurePolled(),s.shift=e.shiftKey,Ii(s,e)){k||(s.scroller.draggable=!1,setTimeout(function(){return s.scroller.draggable=!0},100));return}if(ds(n,e))return;var a=Gr(n,e),m=it(e),B=a?Xl(a,m):"single";if(window.focus(),m==1&&n.state.selectingText&&n.state.selectingText(e),a&&ml(n,m,a,B,e))return;m==1?a?$l(n,a,B,e):Pe(e)==s.scroller&&le(e):m==2?(a&&uo(n.doc,a),setTimeout(function(){return s.input.focus()},20)):m==3&&(R?n.display.input.onContextMenu(e):Es(n))}function ml(e,n,s,a,m){var B="Click";return a=="double"?B="Double"+B:a=="triple"&&(B="Triple"+B),B=(n==1?"Left":n==2?"Middle":"Right")+B,ja(e,ul(B,m),m,function(J){if(typeof J=="string"&&(J=Ea[J]),!J)return!1;var re=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),re=J(e,s)!=pe}finally{e.state.suppressEdits=!1}return re})}function Yl(e,n,s){var a=e.getOption("configureMouse"),m=a?a(e,n,s):{};if(m.unit==null){var B=f?s.shiftKey&&s.metaKey:s.altKey;m.unit=B?"rectangle":n=="single"?"char":n=="double"?"word":"line"}return(m.extend==null||e.doc.extend)&&(m.extend=e.doc.extend||s.shiftKey),m.addNew==null&&(m.addNew=c?s.metaKey:s.ctrlKey),m.moveOnDrag==null&&(m.moveOnDrag=!(c?s.altKey:s.ctrlKey)),m}function $l(e,n,s,a){Y?setTimeout(I(No,e),0):e.curOp.focus=F();var m=Yl(e,s,a),B=e.doc.sel,J;e.options.dragDrop&&xt&&!e.isReadOnly()&&s=="single"&&(J=B.contains(n))>-1&&(Ie((J=B.ranges[J]).from(),n)<0||n.xRel>0)&&(Ie(J.to(),n)>0||n.xRel<0)?Ql(e,a,n,m):ql(e,a,n,m)}function Ql(e,n,s,a){var m=e.display,B=!1,J=Gi(e,function(ge){k&&(m.scroller.draggable=!1),e.state.draggingText=!1,bt(m.wrapper.ownerDocument,"mouseup",J),bt(m.wrapper.ownerDocument,"mousemove",re),bt(m.scroller,"dragstart",se),bt(m.scroller,"drop",J),B||(le(ge),a.addNew||uo(e.doc,s,null,null,a.extend),k&&!p||Y&&X==9?setTimeout(function(){m.wrapper.ownerDocument.body.focus({preventScroll:!0}),m.input.focus()},20):m.input.focus())}),re=function(ge){B=B||Math.abs(n.clientX-ge.clientX)+Math.abs(n.clientY-ge.clientY)>=10},se=function(){return B=!0};k&&(m.scroller.draggable=!0),e.state.draggingText=J,J.copy=!a.moveOnDrag,m.scroller.dragDrop&&m.scroller.dragDrop(),Ye(m.wrapper.ownerDocument,"mouseup",J),Ye(m.wrapper.ownerDocument,"mousemove",re),Ye(m.scroller,"dragstart",se),Ye(m.scroller,"drop",J),Es(e),setTimeout(function(){return m.input.focus()},20)}function us(e,n,s){if(s=="char")return new Mi(n,n);if(s=="word")return e.findWordAt(n);if(s=="line")return new Mi(Be(n.line,0),C(e.doc,Be(n.line+1,0)));var a=s(e,n);return new Mi(a.from,a.to)}function ql(e,n,s,a){var m=e.display,B=e.doc;le(n);var J,re,se=B.sel,ge=se.ranges;if(a.addNew&&!a.extend?(re=B.sel.contains(s),re>-1?J=ge[re]:J=new Mi(s,s)):(J=B.sel.primary(),re=B.sel.primIndex),a.unit=="rectangle")a.addNew||(J=new Mi(s,s)),s=Gr(e,n,!0,!0),re=-1;else{var Ne=us(e,s,a.unit);a.extend?J=lo(J,Ne.anchor,Ne.head,a.extend):J=Ne}a.addNew?re==-1?(re=ge.length,nr(B,Cr(e,ge.concat([J]),re),{scroll:!1,origin:"*mouse"})):ge.length>1&&ge[re].empty()&&a.unit=="char"&&!a.extend?(nr(B,Cr(e,ge.slice(0,re).concat(ge.slice(re+1)),0),{scroll:!1,origin:"*mouse"}),se=B.sel):Br(B,re,J,De):(re=0,nr(B,new mr([J],0),De),se=B.sel);var Ve=s;function ht(Gn){if(Ie(Ve,Gn)==0)return;if(Ve=Gn,a.unit=="rectangle"){for(var di=[],Ri=e.options.tabSize,Si=j(pt(B,s.line).text,s.ch,Ri),Di=j(pt(B,Gn.line).text,Gn.ch,Ri),Wi=Math.min(Si,Di),ir=Math.max(Si,Di),zi=Math.min(s.line,Gn.line),Er=Math.min(e.lastLine(),Math.max(s.line,Gn.line));zi<=Er;zi++){var vr=pt(B,zi).text,Qi=Oe(vr,Wi,Ri);Wi==ir?di.push(new Mi(Be(zi,Qi),Be(zi,Qi))):vr.length>Qi&&di.push(new Mi(Be(zi,Qi),Be(zi,Oe(vr,ir,Ri))))}di.length||di.push(new Mi(s,s)),nr(B,Cr(e,se.ranges.slice(0,re).concat(di),re),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Gn)}else{var gr=J,sr=us(e,Gn,a.unit),Zi=gr.anchor,qi;Ie(sr.anchor,Zi)>0?(qi=sr.head,Zi=Pn(gr.from(),sr.anchor)):(qi=sr.anchor,Zi=zn(gr.to(),sr.head));var Xi=se.ranges.slice(0);Xi[re]=Jl(e,new Mi(C(B,Zi),qi)),nr(B,Cr(e,Xi,re),De)}}var lt=m.wrapper.getBoundingClientRect(),Ht=0;function ln(Gn){var di=++Ht,Ri=Gr(e,Gn,!0,a.unit=="rectangle");if(!Ri)return;if(Ie(Ri,Ve)!=0){e.curOp.focus=F(),ht(Ri);var Si=Ja(m,B);(Ri.line>=Si.to||Ri.line<Si.from)&&setTimeout(Gi(e,function(){Ht==di&&ln(Gn)}),150)}else{var Di=Gn.clientY<lt.top?-20:Gn.clientY>lt.bottom?20:0;Di&&setTimeout(Gi(e,function(){if(Ht!=di)return;m.scroller.scrollTop+=Di,ln(Gn)}),50)}}function xn(Gn){e.state.selectingText=!1,Ht=Infinity,Gn&&(le(Gn),m.input.focus()),bt(m.wrapper.ownerDocument,"mousemove",Kn),bt(m.wrapper.ownerDocument,"mouseup",ri),B.history.lastSelOrigin=null}var Kn=Gi(e,function(Gn){Gn.buttons===0||!it(Gn)?xn(Gn):ln(Gn)}),ri=Gi(e,xn);e.state.selectingText=ri,Ye(m.wrapper.ownerDocument,"mousemove",Kn),Ye(m.wrapper.ownerDocument,"mouseup",ri)}function Jl(e,n){var s=n.anchor,a=n.head,m=pt(e.doc,s.line);if(Ie(s,a)==0&&s.sticky==a.sticky)return n;var B=Cn(m);if(!B)return n;var J=pn(B,s.ch,s.sticky),re=B[J];if(re.from!=s.ch&&re.to!=s.ch)return n;var se=J+(re.from==s.ch==(re.level!=1)?0:1);if(se==0||se==B.length)return n;var ge;if(a.line!=s.line)ge=(a.line-s.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var Ne=pn(B,a.ch,a.sticky),Ve=Ne-J||(a.ch-s.ch)*(re.level==1?-1:1);Ne==se-1||Ne==se?ge=Ve<0:ge=Ve>0}var ht=B[se+(ge?-1:0)],lt=ge==(ht.level==1),Ht=lt?ht.from:ht.to,ln=lt?"after":"before";return s.ch==Ht&&s.sticky==ln?n:new Mi(new Be(s.line,Ht,ln),a)}function vl(e,n,s,a){var m,B;if(n.touches)m=n.touches[0].clientX,B=n.touches[0].clientY;else try{m=n.clientX,B=n.clientY}catch(ht){return!1}if(m>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;a&&le(n);var J=e.display,re=J.lineDiv.getBoundingClientRect();if(B>re.bottom||!Ae(e,s))return Se(n);B-=re.top-J.viewOffset;for(var se=0;se<e.display.gutterSpecs.length;++se){var ge=J.gutters.childNodes[se];if(ge&&ge.getBoundingClientRect().right>=m){var Ne=ue(e.doc,B),Ve=e.display.gutterSpecs[se];return nt(e,s,e,Ne,Ve.className,n),Se(n)}}}function ds(e,n){return vl(e,n,"gutterClick",!0)}function gl(e,n){if(Ii(e.display,n)||_l(e,n))return;if(vt(e,n,"contextmenu"))return;R||e.display.input.onContextMenu(n)}function _l(e,n){return Ae(e,"gutterContextMenu")?vl(e,n,"gutterContextMenu",!1):!1}function yl(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),wa(e)}var xa={toString:function(){return"CodeMirror.Init"}},go={},Ka={};function Zl(e){var n=e.optionHandlers;function s(a,m,B,J){e.defaults[a]=m,B&&(n[a]=J?function(re,se,ge){ge!=xa&&B(re,se,ge)}:B)}e.defineOption=s,e.Init=xa,s("value","",function(a,m){return a.setValue(m)},!0),s("mode",null,function(a,m){a.doc.modeOption=m,La(a)},!0),s("indentUnit",2,La,!0),s("indentWithTabs",!1),s("smartIndent",!0),s("tabSize",4,function(a){Ia(a),wa(a),lr(a)},!0),s("lineSeparator",null,function(a,m){if(a.doc.lineSep=m,!m)return;var B=[],J=a.doc.first;a.doc.iter(function(se){for(var ge=0;;){var Ne=se.text.indexOf(m,ge);if(Ne==-1)break;ge=Ne+m.length,B.push(Be(J,Ne))}J++});for(var re=B.length-1;re>=0;re--)va(a.doc,m,B[re],Be(B[re].line,B[re].ch+m.length))}),s("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(a,m,B){a.state.specialChars=new RegExp(m.source+(m.test(" ")?"":"| "),"g"),B!=xa&&a.refresh()}),s("specialCharPlaceholder",ct,function(a){return a.refresh()},!0),s("electricChars",!0),s("inputStyle",t?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),s("spellcheck",!1,function(a,m){return a.getInputField().spellcheck=m},!0),s("autocorrect",!1,function(a,m){return a.getInputField().autocorrect=m},!0),s("autocapitalize",!1,function(a,m){return a.getInputField().autocapitalize=m},!0),s("rtlMoveVisually",!A),s("wholeLineUpdateBefore",!0),s("theme","default",function(a){yl(a),Da(a)},!0),s("keyMap","default",function(a,m,B){var J=Ba(m),re=B!=xa&&Ba(B);re&&re.detach&&re.detach(a,J),J.attach&&J.attach(a,re||null)}),s("extraKeys",null),s("configureMouse",null),s("lineWrapping",!1,tu,!0),s("gutters",[],function(a,m){a.display.gutterSpecs=Ho(m,a.options.lineNumbers),Da(a)},!0),s("fixedGutter",!0,function(a,m){a.display.gutters.style.left=m?Po(a.display)+"px":"0",a.refresh()},!0),s("coverGutterNextToScrollbar",!1,function(a){return Ur(a)},!0),s("scrollbarStyle","native",function(a){Rs(a),Ur(a),a.display.scrollbars.setScrollTop(a.doc.scrollTop),a.display.scrollbars.setScrollLeft(a.doc.scrollLeft)},!0),s("lineNumbers",!1,function(a,m){a.display.gutterSpecs=Ho(a.options.gutters,m),Da(a)},!0),s("firstLineNumber",1,Da,!0),s("lineNumberFormatter",function(a){return a},Da,!0),s("showCursorWhenSelecting",!1,ta,!0),s("resetSelectionOnContextMenu",!0),s("lineWiseCopyCut",!0),s("pasteLinesPerSelection",!0),s("selectionsMayTouch",!1),s("readOnly",!1,function(a,m){m=="nocursor"&&(na(a),a.display.input.blur()),a.display.input.readOnlyChanged(m)}),s("screenReaderLabel",null,function(a,m){m=m===""?null:m,a.display.input.screenReaderLabelChanged(m)}),s("disableInput",!1,function(a,m){m||a.display.input.reset()},!0),s("dragDrop",!0,eu),s("allowDropFileTypes",null),s("cursorBlinkRate",530),s("cursorScrollMargin",0),s("cursorHeight",1,ta,!0),s("singleCursorHeightPerLine",!0,ta,!0),s("workTime",100),s("workDelay",100),s("flattenSpans",!0,Ia,!0),s("addModeClass",!1,Ia,!0),s("pollInterval",100),s("undoDepth",200,function(a,m){return a.doc.history.undoDepth=m}),s("historyEventDelay",1250),s("viewportMargin",10,function(a){return a.refresh()},!0),s("maxHighlightLength",1e4,Ia,!0),s("moveInputWithCursor",!0,function(a,m){m||a.display.input.resetPosition()}),s("tabindex",null,function(a,m){return a.display.input.getField().tabIndex=m||""}),s("autofocus",null),s("direction","ltr",function(a,m){return a.doc.setDirection(m)},!0),s("phrases",null)}function eu(e,n,s){var a=s&&s!=xa;if(!n!=!a){var m=e.display.dragFunctions,B=n?Ye:bt;B(e.display.scroller,"dragstart",m.start),B(e.display.scroller,"dragenter",m.enter),B(e.display.scroller,"dragover",m.over),B(e.display.scroller,"dragleave",m.leave),B(e.display.scroller,"drop",m.drop)}}function tu(e){e.options.lineWrapping?(N(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(E(e.display.wrapper,"CodeMirror-wrap"),fn(e)),Lo(e),lr(e),wa(e),setTimeout(function(){return Ur(e)},100)}function Hi(e,n){var s=this;if(!(this instanceof Hi))return new Hi(e,n);this.options=n=n?x(n):{},x(go,n,!1);var a=n.value;typeof a=="string"?a=new ur(a,n.mode,null,n.lineSeparator,n.direction):n.mode&&(a.modeOption=n.mode),this.doc=a;var m=new Hi.inputStyles[n.inputStyle](this),B=this.display=new Rl(e,a,m,n);B.wrapper.CodeMirror=this,yl(this),n.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Rs(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new $,keySeq:null,specialChars:null},n.autofocus&&!t&&B.input.focus(),Y&&X<11&&setTimeout(function(){return s.display.input.reset(!0)},20),bl(this),au(),Vr(this),this.curOp.forceUpdate=!0,zo(this,a),n.autofocus&&!t||this.hasFocus()?setTimeout(function(){s.hasFocus()&&!s.state.focused&&Uo(s)},20):na(this);for(var J in Ka)Ka.hasOwnProperty(J)&&Ka[J](this,n[J],xa);ks(this),n.finishInit&&n.finishInit(this);for(var re=0;re<T.length;++re)T[re](this);Xr(this),k&&n.lineWrapping&&getComputedStyle(B.lineDiv).textRendering=="optimizelegibility"&&(B.lineDiv.style.textRendering="auto")}Hi.defaults=go,Hi.optionHandlers=Ka;function bl(e){var n=e.display;Ye(n.scroller,"mousedown",Gi(e,ls)),Y&&X<11?Ye(n.scroller,"dblclick",Gi(e,function(se){if(vt(e,se))return;var ge=Gr(e,se);if(!ge||ds(e,se)||Ii(e.display,se))return;le(se);var Ne=e.findWordAt(ge);uo(e.doc,Ne.anchor,Ne.head)})):Ye(n.scroller,"dblclick",function(se){return vt(e,se)||le(se)}),Ye(n.scroller,"contextmenu",function(se){return gl(e,se)}),Ye(n.input.getField(),"contextmenu",function(se){n.scroller.contains(se.target)||gl(e,se)});var s,a={end:0};function m(){n.activeTouch&&(s=setTimeout(function(){return n.activeTouch=null},1e3),a=n.activeTouch,a.end=+new Date)}function B(se){if(se.touches.length!=1)return!1;var ge=se.touches[0];return ge.radiusX<=1&&ge.radiusY<=1}function J(se,ge){if(ge.left==null)return!0;var Ne=ge.left-se.left,Ve=ge.top-se.top;return Ne*Ne+Ve*Ve>20*20}Ye(n.scroller,"touchstart",function(se){if(!vt(e,se)&&!B(se)&&!ds(e,se)){n.input.ensurePolled(),clearTimeout(s);var ge=+new Date;n.activeTouch={start:ge,moved:!1,prev:ge-a.end<=300?a:null},se.touches.length==1&&(n.activeTouch.left=se.touches[0].pageX,n.activeTouch.top=se.touches[0].pageY)}}),Ye(n.scroller,"touchmove",function(){n.activeTouch&&(n.activeTouch.moved=!0)}),Ye(n.scroller,"touchend",function(se){var ge=n.activeTouch;if(ge&&!Ii(n,se)&&ge.left!=null&&!ge.moved&&new Date-ge.start<300){var Ne=e.coordsChar(n.activeTouch,"page"),Ve;!ge.prev||J(ge,ge.prev)?Ve=new Mi(Ne,Ne):!ge.prev.prev||J(ge,ge.prev.prev)?Ve=e.findWordAt(Ne):Ve=new Mi(Be(Ne.line,0),C(e.doc,Be(Ne.line+1,0))),e.setSelection(Ve.anchor,Ve.head),e.focus(),le(se)}m()}),Ye(n.scroller,"touchcancel",m),Ye(n.scroller,"scroll",function(){n.scroller.clientHeight&&(aa(e,n.scroller.scrollTop),Dr(e,n.scroller.scrollLeft,!0),nt(e,"scroll",e))}),Ye(n.scroller,"mousewheel",function(se){return Ns(e,se)}),Ye(n.scroller,"DOMMouseScroll",function(se){return Ns(e,se)}),Ye(n.wrapper,"scroll",function(){return n.wrapper.scrollTop=n.wrapper.scrollLeft=0}),n.dragFunctions={enter:function(se){vt(e,se)||ve(se)},over:function(se){vt(e,se)||(Bl(e,se),ve(se))},start:function(se){return ol(e,se)},drop:Gi(e,Fl),leave:function(se){vt(e,se)||qo(e)}};var re=n.input.getField();Ye(re,"keyup",function(se){return fl.call(e,se)}),Ye(re,"keydown",Gi(e,hl)),Ye(re,"keypress",Gi(e,pl)),Ye(re,"focus",function(se){return Uo(e,se)}),Ye(re,"blur",function(se){return na(e,se)})}var T=[];Hi.defineInitHook=function(e){return T.push(e)};function P(e,n,s,a){var m=e.doc,B;s==null&&(s="add"),s=="smart"&&(m.mode.indent?B=kt(e,n).state:s="prev");var J=e.options.tabSize,re=pt(m,n),se=j(re.text,null,J);re.stateAfter&&(re.stateAfter=null);var ge=re.text.match(/^\s*/)[0],Ne;if(!a&&!/\S/.test(re.text))Ne=0,s="not";else if(s=="smart"&&(Ne=m.mode.indent(B,re.text.slice(ge.length),re.text),Ne==pe||Ne>150)){if(!a)return;s="prev"}s=="prev"?n>m.first?Ne=j(pt(m,n-1).text,null,J):Ne=0:s=="add"?Ne=se+e.options.indentUnit:s=="subtract"?Ne=se-e.options.indentUnit:typeof s=="number"&&(Ne=se+s),Ne=Math.max(0,Ne);var Ve="",ht=0;if(e.options.indentWithTabs)for(var lt=Math.floor(Ne/J);lt;--lt)ht+=J,Ve+=" ";if(ht<Ne&&(Ve+=be(Ne-ht)),Ve!=ge)return va(m,Ve,Be(n,0),Be(n,ge.length),"+input"),re.stateAfter=null,!0;for(var Ht=0;Ht<m.sel.ranges.length;Ht++){var ln=m.sel.ranges[Ht];if(ln.head.line==n&&ln.head.ch<ge.length){var xn=Be(n,ge.length);Br(m,Ht,new Mi(xn,xn));break}}}var G=null;function ne(e){G=e}function de(e,n,s,a,m){var B=e.doc;e.display.shift=!1,a||(a=B.sel);var J=+new Date-200,re=m=="paste"||e.state.pasteIncoming>J,se=Jn(n),ge=null;if(re&&a.ranges.length>1)if(G&&G.text.join(`
|
|
`)==n){if(a.ranges.length%G.text.length==0){ge=[];for(var Ne=0;Ne<G.text.length;Ne++)ge.push(B.splitLines(G.text[Ne]))}}else se.length==a.ranges.length&&e.options.pasteLinesPerSelection&&(ge=me(se,function(Kn){return[Kn]}));for(var Ve=e.curOp.updateInput,ht=a.ranges.length-1;ht>=0;ht--){var lt=a.ranges[ht],Ht=lt.from(),ln=lt.to();lt.empty()&&(s&&s>0?Ht=Be(Ht.line,Ht.ch-s):e.state.overwrite&&!re?ln=Be(ln.line,Math.min(pt(B,ln.line).text.length,ln.ch+te(se).length)):re&&G&&G.lineWise&&G.text.join(`
|
|
`)==se.join(`
|
|
`)&&(Ht=ln=Be(Ht.line,0)));var xn={from:Ht,to:ln,text:ge?ge[ht%ge.length]:se,origin:m||(re?"paste":e.state.cutIncoming>J?"cut":"+input")};pa(e.doc,xn),nn(e,"inputRead",e,xn)}n&&!re&&we(e,n),ia(e),e.curOp.updateInput<2&&(e.curOp.updateInput=Ve),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ce(e,n){var s=e.clipboardData&&e.clipboardData.getData("Text");if(s)return e.preventDefault(),!n.isReadOnly()&&!n.options.disableInput&&cr(n,function(){return de(n,s,0,null,"paste")}),!0}function we(e,n){if(!e.options.electricChars||!e.options.smartIndent)return;for(var s=e.doc.sel,a=s.ranges.length-1;a>=0;a--){var m=s.ranges[a];if(m.head.ch>100||a&&s.ranges[a-1].head.line==m.head.line)continue;var B=e.getModeAt(m.head),J=!1;if(B.electricChars){for(var re=0;re<B.electricChars.length;re++)if(n.indexOf(B.electricChars.charAt(re))>-1){J=P(e,m.head.line,"smart");break}}else B.electricInput&&(B.electricInput.test(pt(e.doc,m.head.line).text.slice(0,m.head.ch))&&(J=P(e,m.head.line,"smart")));J&&nn(e,"electricInput",e,m.head.line)}}function Te(e){for(var n=[],s=[],a=0;a<e.doc.sel.ranges.length;a++){var m=e.doc.sel.ranges[a].head.line,B={anchor:Be(m,0),head:Be(m+1,0)};s.push(B),n.push(e.getRange(B.anchor,B.head))}return{text:n,ranges:s}}function He(e,n,s,a){e.setAttribute("autocorrect",s?"":"off"),e.setAttribute("autocapitalize",a?"":"off"),e.setAttribute("spellcheck",!!n)}function tt(){var e=l("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),n=l("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return k?e.style.width="1000px":e.setAttribute("wrap","off"),r&&(e.style.border="1px solid black"),He(e),n}function at(e){var n=e.optionHandlers,s=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(a,m){var B=this.options,J=B[a];if(B[a]==m&&a!="mode")return;B[a]=m,n.hasOwnProperty(a)&&Gi(this,n[a])(this,m,J),nt(this,"optionChange",this,a)},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,m){this.state.keyMaps[m?"push":"unshift"](Ba(a))},removeKeyMap:function(a){for(var m=this.state.keyMaps,B=0;B<m.length;++B)if(m[B]==a||m[B].name==a)return m.splice(B,1),!0},addOverlay:or(function(a,m){var B=a.token?a:e.getMode(this.options,a);if(B.startState)throw new Error("Overlays may not be stateful.");ye(this.state.overlays,{mode:B,modeSpec:a,opaque:m&&m.opaque,priority:m&&m.priority||0},function(J){return J.priority}),this.state.modeGen++,lr(this)}),removeOverlay:or(function(a){for(var m=this.state.overlays,B=0;B<m.length;++B){var J=m[B].modeSpec;if(J==a||typeof a=="string"&&J.name==a){m.splice(B,1),this.state.modeGen++,lr(this);return}}}),indentLine:or(function(a,m,B){typeof m!="string"&&typeof m!="number"&&(m==null?m=this.options.smartIndent?"smart":"prev":m=m?"add":"subtract"),si(this.doc,a)&&P(this,a,m,B)}),indentSelection:or(function(a){for(var m=this.doc.sel.ranges,B=-1,J=0;J<m.length;J++){var re=m[J];if(re.empty())re.head.line>B&&(P(this,re.head.line,a,!0),B=re.head.line,J==this.doc.sel.primIndex&&ia(this));else{var se=re.from(),ge=re.to(),Ne=Math.max(B,se.line);B=Math.min(this.lastLine(),ge.line-(ge.ch?0:1))+1;for(var Ve=Ne;Ve<B;++Ve)P(this,Ve,a);var ht=this.doc.sel.ranges;se.ch==0&&m.length==ht.length&&ht[J].from().ch>0&&Br(this.doc,J,new Mi(se,ht[J].to()),Ce)}}}),getTokenAt:function(a,m){return Vn(this,a,m)},getLineTokens:function(a,m){return Vn(this,Be(a),m,!0)},getTokenTypeAt:function(a){a=C(this.doc,a);var m=ft(this,pt(this.doc,a.line)),B=0,J=(m.length-1)/2,re=a.ch,se;if(re==0)se=m[2];else for(;;){var ge=B+J>>1;if((ge?m[ge*2-1]:0)>=re)J=ge;else if(m[ge*2+1]<re)B=ge+1;else{se=m[ge*2+2];break}}var Ne=se?se.indexOf("overlay "):-1;return Ne<0?se:Ne==0?null:se.slice(0,Ne-1)},getModeAt:function(a){var m=this.doc.mode;return m.innerMode?e.innerMode(m,this.getTokenAt(a).state).mode:m},getHelper:function(a,m){return this.getHelpers(a,m)[0]},getHelpers:function(a,m){var B=[];if(!s.hasOwnProperty(m))return B;var J=s[m],re=this.getModeAt(a);if(typeof re[m]=="string")J[re[m]]&&B.push(J[re[m]]);else if(re[m])for(var se=0;se<re[m].length;se++){var ge=J[re[m][se]];ge&&B.push(ge)}else re.helperType&&J[re.helperType]?B.push(J[re.helperType]):J[re.name]&&B.push(J[re.name]);for(var Ne=0;Ne<J._global.length;Ne++){var Ve=J._global[Ne];Ve.pred(re,this)&&ae(B,Ve.val)==-1&&B.push(Ve.val)}return B},getStateAfter:function(a,m){var B=this.doc;return a=Q(B,a==null?B.first+B.size-1:a),kt(this,a+1,m).state},cursorCoords:function(a,m){var B,J=this.doc.sel.primary();return a==null?B=J.head:typeof a=="object"?B=C(this.doc,a):B=a?J.from():J.to(),xr(this,B,m||"page")},charCoords:function(a,m){return So(this,C(this.doc,a),m||"page")},coordsChar:function(a,m){return a=To(this,a,m||"page"),Ro(this,a.left,a.top)},lineAtHeight:function(a,m){return a=To(this,{top:a,left:0},m||"page").top,ue(this.doc,a+this.display.viewOffset)},heightAtLine:function(a,m,B){var J=!1,re;if(typeof a=="number"){var se=this.doc.first+this.doc.size-1;a<this.doc.first?a=this.doc.first:a>se&&(a=se,J=!0),re=pt(this.doc,a)}else re=a;return Ya(this,re,{top:0,left:0},m||"page",B||J).top+(J?this.doc.height-qt(re):0)},defaultTextHeight:function(){return Jr(this.display)},defaultCharWidth:function(){return Zr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(a,m,B,J,re){var se=this.display;a=xr(this,C(this.doc,a));var ge=a.bottom,Ne=a.left;if(m.style.position="absolute",m.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(m),se.sizer.appendChild(m),J=="over")ge=a.top;else if(J=="above"||J=="near"){var Ve=Math.max(se.wrapper.clientHeight,this.doc.height),ht=Math.max(se.sizer.clientWidth,se.lineSpace.clientWidth);(J=="above"||a.bottom+m.offsetHeight>Ve)&&a.top>m.offsetHeight?ge=a.top-m.offsetHeight:a.bottom+m.offsetHeight<=Ve&&(ge=a.bottom),Ne+m.offsetWidth>ht&&(Ne=ht-m.offsetWidth)}m.style.top=ge+"px",m.style.left=m.style.right="",re=="right"?(Ne=se.sizer.clientWidth-m.offsetWidth,m.style.right="0px"):(re=="left"?Ne=0:re=="middle"&&(Ne=(se.sizer.clientWidth-m.offsetWidth)/2),m.style.left=Ne+"px"),B&&Cl(this,{left:Ne,top:ge,right:Ne+m.offsetWidth,bottom:ge+m.offsetHeight})},triggerOnKeyDown:or(hl),triggerOnKeyPress:or(pl),triggerOnKeyUp:fl,triggerOnMouseDown:or(ls),execCommand:function(a){if(Ea.hasOwnProperty(a))return Ea[a].call(null,this)},triggerElectric:or(function(a){we(this,a)}),findPosH:function(a,m,B,J){var re=1;m<0&&(re=-1,m=-m);for(var se=C(this.doc,a),ge=0;ge<m&&!(se=Ge(this.doc,se,re,B,J),se.hitSide);++ge);return se},moveH:or(function(a,m){var B=this;this.extendSelectionsBy(function(J){return B.display.shift||B.doc.extend||J.empty()?Ge(B.doc,J.head,a,m,B.options.rtlMoveVisually):a<0?J.from():J.to()},xe)}),deleteH:or(function(a,m){var B=this.doc.sel,J=this.doc;B.somethingSelected()?J.replaceSelection("",null,"+delete"):ba(this,function(re){var se=Ge(J,re.head,a,m,!1);return a<0?{from:se,to:re.head}:{from:re.head,to:se}})}),findPosV:function(a,m,B,J){var re=1,se=J;m<0&&(re=-1,m=-m);for(var ge=C(this.doc,a),Ne=0;Ne<m;++Ne){var Ve=xr(this,ge,"div");if(se==null?se=Ve.left:Ve.left=se,ge=Ke(this,Ve,re,B),ge.hitSide)break}return ge},moveV:or(function(a,m){var B=this,J=this.doc,re=[],se=!this.display.shift&&!J.extend&&J.sel.somethingSelected();if(J.extendSelectionsBy(function(Ne){if(se)return a<0?Ne.from():Ne.to();var Ve=xr(B,Ne.head,"div");Ne.goalColumn!=null&&(Ve.left=Ne.goalColumn),re.push(Ve.left);var ht=Ke(B,Ve,a,m);return m=="page"&&Ne==J.sel.primary()&&eo(B,So(B,ht,"div").top-Ve.top),ht},xe),re.length)for(var ge=0;ge<J.sel.ranges.length;ge++)J.sel.ranges[ge].goalColumn=re[ge]}),findWordAt:function(a){var m=this.doc,B=pt(m,a.line).text,J=a.ch,re=a.ch;if(B){var se=this.getHelper(a,"wordChars");(a.sticky=="before"||re==B.length)&&J?--J:++re;for(var ge=B.charAt(J),Ne=ot(ge,se)?function(Ve){return ot(Ve,se)}:/\s/.test(ge)?function(Ve){return/\s/.test(Ve)}:function(Ve){return!/\s/.test(Ve)&&!ot(Ve)};J>0&&Ne(B.charAt(J-1));)--J;for(;re<B.length&&Ne(B.charAt(re));)++re}return new Mi(Be(a.line,J),Be(a.line,re))},toggleOverwrite:function(a){if(a!=null&&a==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?N(this.display.cursorDiv,"CodeMirror-overwrite"):E(this.display.cursorDiv,"CodeMirror-overwrite"),nt(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==F()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:or(function(a,m){ra(this,a,m)}),getScrollInfo:function(){var a=this.display.scroller;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-Ji(this)-this.display.barHeight,width:a.scrollWidth-Ji(this)-this.display.barWidth,clientHeight:yr(this),clientWidth:er(this)}},scrollIntoView:or(function(a,m){a==null?(a={from:this.doc.sel.primary().head,to:null},m==null&&(m=this.options.cursorScrollMargin)):typeof a=="number"?a={from:Be(a,0),to:null}:a.from==null&&(a={from:a,to:null}),a.to||(a.to=a.from),a.margin=m||0,a.from.line!=null?Cs(this,a):ws(this,a.from,a.to,a.margin)}),setSize:or(function(a,m){var B=this,J=function(se){return typeof se=="number"||/^\d+$/.test(String(se))?se+"px":se};a!=null&&(this.display.wrapper.style.width=J(a)),m!=null&&(this.display.wrapper.style.height=J(m)),this.options.lineWrapping&&Co(this);var re=this.display.viewFrom;this.doc.iter(re,this.display.viewTo,function(se){if(se.widgets){for(var ge=0;ge<se.widgets.length;ge++)if(se.widgets[ge].noHScroll){Mr(B,re,"widget");break}}++re}),this.curOp.forceUpdate=!0,nt(this,"refresh",this)}),operation:function(a){return cr(this,a)},startOperation:function(){return Vr(this)},endOperation:function(){return Xr(this)},refresh:or(function(){var a=this.display.cachedTextHeight;lr(this),this.curOp.forceUpdate=!0,wa(this),ra(this,this.doc.scrollLeft,this.doc.scrollTop),Aa(this.display),(a==null||Math.abs(a-Jr(this.display))>.5||this.options.lineWrapping)&&Lo(this),nt(this,"refresh",this)}),swapDoc:or(function(a){var m=this.doc;return m.cm=null,this.state.selectingText&&this.state.selectingText(),zo(this,a),wa(this),this.display.input.reset(),ra(this,a.scrollLeft,a.scrollTop),this.curOp.forceScroll=!0,nn(this,"swapDoc",this,m),m}),phrase:function(a){var m=this.options.phrases;return m&&Object.prototype.hasOwnProperty.call(m,a)?m[a]:a},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Re(e),e.registerHelper=function(a,m,B){s.hasOwnProperty(a)||(s[a]=e[a]={_global:[]}),s[a][m]=B},e.registerGlobalHelper=function(a,m,B,J){e.registerHelper(a,m,J),s[a]._global.push({pred:B,val:J})}}function Ge(e,n,s,a,m){var B=n,J=s,re=pt(e,n.line),se=m&&e.direction=="rtl"?-s:s;function ge(){var ri=n.line+se;return ri<e.first||ri>=e.first+e.size?!1:(n=new Be(ri,n.ch,n.sticky),re=pt(e,ri))}function Ne(ri){var Gn;if(a=="codepoint"){var di=re.text.charCodeAt(n.ch+(a>0?0:-1));isNaN(di)?Gn=null:Gn=new Be(n.line,Math.max(0,Math.min(re.text.length,n.ch+s*(di>=55296&&di<56320?2:1))),-s)}else m?Gn=is(e.cm,re,n,s):Gn=ts(re,n,s);if(Gn==null)if(!ri&&ge())n=ns(m,e.cm,re,n.line,se);else return!1;else n=Gn;return!0}if(a=="char"||a=="codepoint")Ne();else if(a=="column")Ne(!0);else if(a=="word"||a=="group")for(var Ve=null,ht=a=="group",lt=e.cm&&e.cm.getHelper(n,"wordChars"),Ht=!0;!(s<0&&!Ne(!Ht));Ht=!1){var ln=re.text.charAt(n.ch)||`
|
|
`,xn=ot(ln,lt)?"w":ht&&ln==`
|
|
`?"n":!ht||/\s/.test(ln)?null:"p";if(ht&&!Ht&&!xn&&(xn="s"),Ve&&Ve!=xn){s<0&&(s=1,Ne(),n.sticky="after");break}if(xn&&(Ve=xn),s>0&&!Ne(!Ht))break}var Kn=co(e,n,B,J,!0);return _e(B,Kn)&&(Kn.hitSide=!0),Kn}function Ke(e,n,s,a){var m=e.doc,B=n.left,J;if(a=="page"){var re=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),se=Math.max(re-.5*Jr(e.display),3);J=(s>0?n.bottom:n.top)+s*se}else a=="line"&&(J=s>0?n.bottom+3:n.top-3);for(var ge;!(ge=Ro(e,B,J),!ge.outside);){if(s<0?J<=0:J>=m.height){ge.hitSide=!0;break}J+=s*5}return ge}var qe=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new $,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};qe.prototype.init=function(e){var n=this,s=this,a=s.cm,m=s.div=e.lineDiv;He(m,a.options.spellcheck,a.options.autocorrect,a.options.autocapitalize);function B(re){for(var se=re.target;se;se=se.parentNode){if(se==m)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(se.className))break}return!1}Ye(m,"paste",function(re){if(!B(re)||vt(a,re)||ce(re,a))return;X<=11&&setTimeout(Gi(a,function(){return n.updateFromDOM()}),20)}),Ye(m,"compositionstart",function(re){n.composing={data:re.data,done:!1}}),Ye(m,"compositionupdate",function(re){n.composing||(n.composing={data:re.data,done:!1})}),Ye(m,"compositionend",function(re){n.composing&&(re.data!=n.composing.data&&n.readFromDOMSoon(),n.composing.done=!0)}),Ye(m,"touchstart",function(){return s.forceCompositionEnd()}),Ye(m,"input",function(){n.composing||n.readFromDOMSoon()});function J(re){if(!B(re)||vt(a,re))return;if(a.somethingSelected())ne({lineWise:!1,text:a.getSelections()}),re.type=="cut"&&a.replaceSelection("",null,"cut");else if(a.options.lineWiseCopyCut){var se=Te(a);ne({lineWise:!0,text:se.text}),re.type=="cut"&&a.operation(function(){a.setSelections(se.ranges,0,Ce),a.replaceSelection("",null,"cut")})}else return;if(re.clipboardData){re.clipboardData.clearData();var ge=G.text.join(`
|
|
`);if(re.clipboardData.setData("Text",ge),re.clipboardData.getData("Text")==ge){re.preventDefault();return}}var Ne=tt(),Ve=Ne.firstChild;a.display.lineSpace.insertBefore(Ne,a.display.lineSpace.firstChild),Ve.value=G.text.join(`
|
|
`);var ht=document.activeElement;K(Ve),setTimeout(function(){a.display.lineSpace.removeChild(Ne),ht.focus(),ht==m&&s.showPrimarySelection()},50)}Ye(m,"copy",J),Ye(m,"cut",J)},qe.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},qe.prototype.prepareSelection=function(){var e=ko(this.cm,!1);return e.focus=document.activeElement==this.div,e},qe.prototype.showSelection=function(e,n){if(!e||!this.cm.display.view.length)return;(e.focus||n)&&this.showPrimarySelection(),this.showMultipleSelections(e)},qe.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},qe.prototype.showPrimarySelection=function(){var e=this.getSelection(),n=this.cm,s=n.doc.sel.primary(),a=s.from(),m=s.to();if(n.display.viewTo==n.display.viewFrom||a.line>=n.display.viewTo||m.line<n.display.viewFrom){e.removeAllRanges();return}var B=ui(n,e.anchorNode,e.anchorOffset),J=ui(n,e.focusNode,e.focusOffset);if(B&&!B.bad&&J&&!J.bad&&Ie(Pn(B,J),a)==0&&Ie(zn(B,J),m)==0)return;var re=n.display.view,se=a.line>=n.display.viewFrom&&Rt(n,a)||{node:re[0].measure.map[2],offset:0},ge=m.line<n.display.viewTo&&Rt(n,m);if(!ge){var Ne=re[re.length-1].measure,Ve=Ne.maps?Ne.maps[Ne.maps.length-1]:Ne.map;ge={node:Ve[Ve.length-1],offset:Ve[Ve.length-2]-Ve[Ve.length-3]}}if(!se||!ge){e.removeAllRanges();return}var ht=e.rangeCount&&e.getRangeAt(0),lt;try{lt=g(se.node,se.offset,ge.offset,ge.node)}catch(Ht){}lt&&(!U&&n.state.focused?(e.collapse(se.node,se.offset),lt.collapsed||(e.removeAllRanges(),e.addRange(lt))):(e.removeAllRanges(),e.addRange(lt)),ht&&e.anchorNode==null?e.addRange(ht):U&&this.startGracePeriod()),this.rememberSelection()},qe.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},qe.prototype.showMultipleSelections=function(e){d(this.cm.display.cursorDiv,e.cursors),d(this.cm.display.selectionDiv,e.selection)},qe.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},qe.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var n=e.getRangeAt(0).commonAncestorContainer;return b(this.div,n)},qe.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},qe.prototype.blur=function(){this.div.blur()},qe.prototype.getField=function(){return this.div},qe.prototype.supportsTouch=function(){return!0},qe.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():cr(this.cm,function(){return e.cm.curOp.selectionChanged=!0});function n(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,n))}this.polling.set(this.cm.options.pollInterval,n)},qe.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},qe.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),n=this.cm;if(i&&v&&this.cm.display.gutterSpecs.length&&Nn(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var s=ui(n,e.anchorNode,e.anchorOffset),a=ui(n,e.focusNode,e.focusOffset);s&&a&&cr(n,function(){nr(n.doc,Fr(s,a),Ce),(s.bad||a.bad)&&(n.curOp.selectionChanged=!0)})},qe.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,n=e.display,s=e.doc.sel.primary(),a=s.from(),m=s.to();if(a.ch==0&&a.line>e.firstLine()&&(a=Be(a.line-1,pt(e.doc,a.line-1).length)),m.ch==pt(e.doc,m.line).text.length&&m.line<e.lastLine()&&(m=Be(m.line+1,0)),a.line<n.viewFrom||m.line>n.viewTo-1)return!1;var B,J,re;a.line==n.viewFrom||(B=zr(e,a.line))==0?(J=Fe(n.view[0].line),re=n.view[0].node):(J=Fe(n.view[B].line),re=n.view[B-1].node.nextSibling);var se=zr(e,m.line),ge,Ne;if(se==n.view.length-1?(ge=n.viewTo-1,Ne=n.lineDiv.lastChild):(ge=Fe(n.view[se+1].line)-1,Ne=n.view[se+1].node.previousSibling),!re)return!1;for(var Ve=e.doc.splitLines(ii(e,re,Ne,J,ge)),ht=Je(e.doc,Be(J,0),Be(ge,pt(e.doc,ge).text.length));Ve.length>1&&ht.length>1;)if(te(Ve)==te(ht))Ve.pop(),ht.pop(),ge--;else if(Ve[0]==ht[0])Ve.shift(),ht.shift(),J++;else break;for(var lt=0,Ht=0,ln=Ve[0],xn=ht[0],Kn=Math.min(ln.length,xn.length);lt<Kn&&ln.charCodeAt(lt)==xn.charCodeAt(lt);)++lt;for(var ri=te(Ve),Gn=te(ht),di=Math.min(ri.length-(Ve.length==1?lt:0),Gn.length-(ht.length==1?lt:0));Ht<di&&ri.charCodeAt(ri.length-Ht-1)==Gn.charCodeAt(Gn.length-Ht-1);)++Ht;if(Ve.length==1&&ht.length==1&&J==a.line)for(;lt&<>a.ch&&ri.charCodeAt(ri.length-Ht-1)==Gn.charCodeAt(Gn.length-Ht-1);)lt--,Ht++;Ve[Ve.length-1]=ri.slice(0,ri.length-Ht).replace(/^\u200b+/,""),Ve[0]=Ve[0].slice(lt).replace(/\u200b+$/,"");var Ri=Be(J,lt),Si=Be(ge,ht.length?te(ht).length-Ht:0);if(Ve.length>1||Ve[0]||Ie(Ri,Si))return va(e.doc,Ve,Ri,Si,"+input"),!0},qe.prototype.ensurePolled=function(){this.forceCompositionEnd()},qe.prototype.reset=function(){this.forceCompositionEnd()},qe.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},qe.prototype.readFromDOMSoon=function(){var e=this;if(this.readDOMTimeout!=null)return;this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80)},qe.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&cr(this.cm,function(){return lr(e.cm)})},qe.prototype.setUneditable=function(e){e.contentEditable="false"},qe.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Gi(this.cm,de)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},qe.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},qe.prototype.onContextMenu=function(){},qe.prototype.resetPosition=function(){},qe.prototype.needsContentAttribute=!0;function Rt(e,n){var s=Kr(e,n.line);if(!s||s.hidden)return null;var a=pt(e.doc,n.line),m=Va(s,a,n.line),B=Cn(a,e.doc.direction),J="left";if(B){var re=pn(B,n.ch);J=re%2?"right":"left"}var se=bo(m.map,n.ch,J);return se.offset=se.collapse=="right"?se.end:se.start,se}function Nn(e){for(var n=e;n;n=n.parentNode)if(/CodeMirror-gutter-wrapper/.test(n.className))return!0;return!1}function Wn(e,n){return n&&(e.bad=!0),e}function ii(e,n,s,a,m){var B="",J=!1,re=e.doc.lineSeparator(),se=!1;function ge(lt){return function(Ht){return Ht.id==lt}}function Ne(){J&&(B+=re,se&&(B+=re),J=se=!1)}function Ve(lt){lt&&(Ne(),B+=lt)}function ht(lt){if(lt.nodeType==1){var Ht=lt.getAttribute("cm-text");if(Ht){Ve(Ht);return}var ln=lt.getAttribute("cm-marker"),xn;if(ln){var Kn=e.findMarks(Be(a,0),Be(m+1,0),ge(+ln));Kn.length&&(xn=Kn[0].find(0))&&Ve(Je(e.doc,xn.from,xn.to).join(re));return}if(lt.getAttribute("contenteditable")=="false")return;var ri=/^(pre|div|p|li|table|br)$/i.test(lt.nodeName);if(!/^br$/i.test(lt.nodeName)&<.textContent.length==0)return;ri&&Ne();for(var Gn=0;Gn<lt.childNodes.length;Gn++)ht(lt.childNodes[Gn]);/^(pre|p)$/i.test(lt.nodeName)&&(se=!0),ri&&(J=!0)}else lt.nodeType==3&&Ve(lt.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(ht(n),n==s);)n=n.nextSibling,se=!1;return B}function ui(e,n,s){var a;if(n==e.display.lineDiv){if(a=e.display.lineDiv.childNodes[s],!a)return Wn(e.clipPos(Be(e.display.viewTo-1)),!0);n=null,s=0}else for(a=n;;a=a.parentNode){if(!a||a==e.display.lineDiv)return null;if(a.parentNode&&a.parentNode==e.display.lineDiv)break}for(var m=0;m<e.display.view.length;m++){var B=e.display.view[m];if(B.node==a)return Oi(B,n,s)}}function Oi(e,n,s){var a=e.text.firstChild,m=!1;if(!n||!b(a,n))return Wn(Be(Fe(e.line),0),!0);if(n==a&&(m=!0,n=a.childNodes[s],s=0,!n)){var B=e.rest?te(e.rest):e.line;return Wn(Be(Fe(B),B.text.length),m)}var J=n.nodeType==3?n:null,re=n;for(!J&&n.childNodes.length==1&&n.firstChild.nodeType==3&&(J=n.firstChild,s&&(s=J.nodeValue.length));re.parentNode!=a;)re=re.parentNode;var se=e.measure,ge=se.maps;function Ne(xn,Kn,ri){for(var Gn=-1;Gn<(ge?ge.length:0);Gn++)for(var di=Gn<0?se.map:ge[Gn],Ri=0;Ri<di.length;Ri+=3){var Si=di[Ri+2];if(Si==xn||Si==Kn){var Di=Fe(Gn<0?e.line:e.rest[Gn]),Wi=di[Ri]+ri;return(ri<0||Si!=xn)&&(Wi=di[Ri+(ri?1:0)]),Be(Di,Wi)}}}var Ve=Ne(J,re,s);if(Ve)return Wn(Ve,m);for(var ht=re.nextSibling,lt=J?J.nodeValue.length-s:0;ht;ht=ht.nextSibling){if(Ve=Ne(ht,ht.firstChild,0),Ve)return Wn(Be(Ve.line,Ve.ch-lt),m);lt+=ht.textContent.length}for(var Ht=re.previousSibling,ln=s;Ht;Ht=Ht.previousSibling){if(Ve=Ne(Ht,Ht.firstChild,-1),Ve)return Wn(Be(Ve.line,Ve.ch+ln),m);ln+=Ht.textContent.length}}var li=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new $,this.hasSelection=!1,this.composing=null};li.prototype.init=function(e){var n=this,s=this,a=this.cm;this.createField(e);var m=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),r&&(m.style.width="0px"),Ye(m,"input",function(){Y&&X>=9&&n.hasSelection&&(n.hasSelection=null),s.poll()}),Ye(m,"paste",function(J){if(vt(a,J)||ce(J,a))return;a.state.pasteIncoming=+new Date,s.fastPoll()});function B(J){if(vt(a,J))return;if(a.somethingSelected())ne({lineWise:!1,text:a.getSelections()});else if(a.options.lineWiseCopyCut){var re=Te(a);ne({lineWise:!0,text:re.text}),J.type=="cut"?a.setSelections(re.ranges,null,Ce):(s.prevInput="",m.value=re.text.join(`
|
|
`),K(m))}else return;J.type=="cut"&&(a.state.cutIncoming=+new Date)}Ye(m,"cut",B),Ye(m,"copy",B),Ye(e.scroller,"paste",function(J){if(Ii(e,J)||vt(a,J))return;if(!m.dispatchEvent){a.state.pasteIncoming=+new Date,s.focus();return}var re=new Event("paste");re.clipboardData=J.clipboardData,m.dispatchEvent(re)}),Ye(e.lineSpace,"selectstart",function(J){Ii(e,J)||le(J)}),Ye(m,"compositionstart",function(){var J=a.getCursor("from");s.composing&&s.composing.range.clear(),s.composing={start:J,range:a.markText(J,a.getCursor("to"),{className:"CodeMirror-composing"})}}),Ye(m,"compositionend",function(){s.composing&&(s.poll(),s.composing.range.clear(),s.composing=null)})},li.prototype.createField=function(e){this.wrapper=tt(),this.textarea=this.wrapper.firstChild},li.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},li.prototype.prepareSelection=function(){var e=this.cm,n=e.display,s=e.doc,a=ko(e);if(e.options.moveInputWithCursor){var m=xr(e,s.sel.primary().head,"div"),B=n.wrapper.getBoundingClientRect(),J=n.lineDiv.getBoundingClientRect();a.teTop=Math.max(0,Math.min(n.wrapper.clientHeight-10,m.top+J.top-B.top)),a.teLeft=Math.max(0,Math.min(n.wrapper.clientWidth-10,m.left+J.left-B.left))}return a},li.prototype.showSelection=function(e){var n=this.cm,s=n.display;d(s.cursorDiv,e.cursors),d(s.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},li.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var n=this.cm;if(n.somethingSelected()){this.prevInput="";var s=n.getSelection();this.textarea.value=s,n.state.focused&&K(this.textarea),Y&&X>=9&&(this.hasSelection=s)}else e||(this.prevInput=this.textarea.value="",Y&&X>=9&&(this.hasSelection=null))},li.prototype.getField=function(){return this.textarea},li.prototype.supportsTouch=function(){return!1},li.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!t||F()!=this.textarea))try{this.textarea.focus()}catch(e){}},li.prototype.blur=function(){this.textarea.blur()},li.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},li.prototype.receivedFocus=function(){this.slowPoll()},li.prototype.slowPoll=function(){var e=this;if(this.pollingFast)return;this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},li.prototype.fastPoll=function(){var e=!1,n=this;n.pollingFast=!0;function s(){var a=n.poll();!a&&!e?(e=!0,n.polling.set(60,s)):(n.pollingFast=!1,n.slowPoll())}n.polling.set(20,s)},li.prototype.poll=function(){var e=this,n=this.cm,s=this.textarea,a=this.prevInput;if(this.contextMenuPending||!n.state.focused||Sn(s)&&!a&&!this.composing||n.isReadOnly()||n.options.disableInput||n.state.keySeq)return!1;var m=s.value;if(m==a&&!n.somethingSelected())return!1;if(Y&&X>=9&&this.hasSelection===m||c&&/[\uf700-\uf7ff]/.test(m))return n.display.input.reset(),!1;if(n.doc.sel==n.display.selForContextMenu){var B=m.charCodeAt(0);if(B==8203&&!a&&(a="\u200B"),B==8666)return this.reset(),this.cm.execCommand("undo")}for(var J=0,re=Math.min(a.length,m.length);J<re&&a.charCodeAt(J)==m.charCodeAt(J);)++J;return cr(n,function(){de(n,m.slice(J),a.length-J,null,e.composing?"*compose":null),m.length>1e3||m.indexOf(`
|
|
`)>-1?s.value=e.prevInput="":e.prevInput=m,e.composing&&(e.composing.range.clear(),e.composing.range=n.markText(e.composing.start,n.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},li.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},li.prototype.onKeyPress=function(){Y&&X>=9&&(this.hasSelection=null),this.fastPoll()},li.prototype.onContextMenu=function(e){var n=this,s=n.cm,a=s.display,m=n.textarea;n.contextMenuPending&&n.contextMenuPending();var B=Gr(s,e),J=a.scroller.scrollTop;if(!B||_)return;var re=s.options.resetSelectionOnContextMenu;re&&s.doc.sel.contains(B)==-1&&Gi(s,nr)(s.doc,Fr(B),Ce);var se=m.style.cssText,ge=n.wrapper.style.cssText,Ne=n.wrapper.offsetParent.getBoundingClientRect();n.wrapper.style.cssText="position: static",m.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-Ne.top-5)+"px; left: "+(e.clientX-Ne.left-5)+`px;
|
|
z-index: 1000; background: `+(Y?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var Ve;k&&(Ve=window.scrollY),a.input.focus(),k&&window.scrollTo(null,Ve),a.input.reset(),s.somethingSelected()||(m.value=n.prevInput=" "),n.contextMenuPending=lt,a.selForContextMenu=s.doc.sel,clearTimeout(a.detectingSelectAll);function ht(){if(m.selectionStart!=null){var ln=s.somethingSelected(),xn="\u200B"+(ln?m.value:"");m.value="\u21DA",m.value=xn,n.prevInput=ln?"":"\u200B",m.selectionStart=1,m.selectionEnd=xn.length,a.selForContextMenu=s.doc.sel}}function lt(){if(n.contextMenuPending!=lt)return;if(n.contextMenuPending=!1,n.wrapper.style.cssText=ge,m.style.cssText=se,Y&&X<9&&a.scrollbars.setScrollTop(a.scroller.scrollTop=J),m.selectionStart!=null){(!Y||Y&&X<9)&&ht();var ln=0,xn=function(){a.selForContextMenu==s.doc.sel&&m.selectionStart==0&&m.selectionEnd>0&&n.prevInput=="\u200B"?Gi(s,Qs)(s):ln++<10?a.detectingSelectAll=setTimeout(xn,500):(a.selForContextMenu=null,a.input.reset())};a.detectingSelectAll=setTimeout(xn,200)}}if(Y&&X>=9&&ht(),R){ve(e);var Ht=function(){bt(window,"mouseup",Ht),setTimeout(lt,20)};Ye(window,"mouseup",Ht)}else setTimeout(lt,50)},li.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},li.prototype.setUneditable=function(){},li.prototype.needsContentAttribute=!1;function ki(e,n){if(n=n?x(n):{},n.value=e.value,!n.tabindex&&e.tabIndex&&(n.tabindex=e.tabIndex),!n.placeholder&&e.placeholder&&(n.placeholder=e.placeholder),n.autofocus==null){var s=F();n.autofocus=s==e||e.getAttribute("autofocus")!=null&&s==document.body}function a(){e.value=re.getValue()}var m;if(e.form&&(Ye(e.form,"submit",a),!n.leaveSubmitMethodAlone)){var B=e.form;m=B.submit;try{var J=B.submit=function(){a(),B.submit=m,B.submit(),B.submit=J}}catch(se){}}n.finishInit=function(se){se.save=a,se.getTextArea=function(){return e},se.toTextArea=function(){se.toTextArea=isNaN,a(),e.parentNode.removeChild(se.getWrapperElement()),e.style.display="",e.form&&(bt(e.form,"submit",a),!n.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=m))}},e.style.display="none";var re=Hi(function(se){return e.parentNode.insertBefore(se,e.nextSibling)},n);return re}function Pi(e){e.off=bt,e.on=Ye,e.wheelEventPixels=io,e.Doc=ur,e.splitLines=Jn,e.countColumn=j,e.findColumn=Oe,e.isWordChar=ze,e.Pass=pe,e.signal=nt,e.Line=On,e.changeEnd=$r,e.scrollbarModel=Os,e.Pos=Be,e.cmpPos=Ie,e.modes=_i,e.mimeModes=Dn,e.resolveMode=Dt,e.getMode=Qn,e.modeExtensions=vi,e.extendMode=hi,e.copyState=bi,e.startState=Fi,e.innerMode=yi,e.commands=Ea,e.keyMap=Lr,e.keyName=po,e.isModifierKey=Fa,e.lookupKey=Ir,e.normalizeKeyMap=ll,e.StringStream=ai,e.SharedTextMarker=ya,e.TextMarker=br,e.LineWidget=Ma,e.e_preventDefault=le,e.e_stopPropagation=he,e.e_stop=ve,e.addClass=N,e.contains=b,e.rmClass=E,e.keyNames=Wr}Zl(Hi),at(Hi);var Bi="iter insert remove copy getEditor constructor".split(" ");for(var Yi in ur.prototype)ur.prototype.hasOwnProperty(Yi)&&ae(Bi,Yi)<0&&(Hi.prototype[Yi]=function(e){return function(){return e.apply(this.doc,arguments)}}(ur.prototype[Yi]));return Re(ur),Hi.inputStyles={textarea:li,contenteditable:qe},Hi.defineMode=function(e){!Hi.defaults.mode&&e!="null"&&(Hi.defaults.mode=e),Ai.apply(this,arguments)},Hi.defineMIME=Ln,Hi.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Hi.defineMIME("text/plain","null"),Hi.defineExtension=function(e,n){Hi.prototype[e]=n},Hi.defineDocExtension=function(e,n){ur.prototype[e]=n},Hi.fromTextArea=ki,Pi(Hi),Hi.version="5.58.2",Hi})},WaYH:function(zt,st,V){"use strict";var ie=V("rePB"),Z=V("Ff2n"),U=V("VTBJ"),ee=V("1OyB"),H=V("vuIU"),M=V("JX7q"),Y=V("Ji7U"),X=V("LK+K"),k=V("q1tI"),D=V("TSYQ"),v=V.n(D),_=V("sboe"),p=V("OZM5"),o=function(R){var O=R.prefixCls,E=R.level,y=R.isStart,d=R.isEnd;if(!E)return null;for(var l="".concat(O,"-indent-unit"),h=[],g=0;g<E;g+=1){var b;h.push(k.createElement("span",{key:g,className:v()(l,(b={},Object(ie.a)(b,"".concat(l,"-start"),y[g+1]),Object(ie.a)(b,"".concat(l,"-end"),d[g+1]),Object(ie.a)(b,"".concat(l,"-end-first-level"),!g&&d[0]),b))}))}return k.createElement("span",{"aria-hidden":"true",className:"".concat(O,"-indent")},h)},u=o,r=V("815F"),i="open",t="close",c="---",f=function(w){Object(Y.a)(O,w);var R=Object(X.a)(O);function O(){var E;return Object(ee.a)(this,O),E=R.apply(this,arguments),E.state={dragNodeHighlight:!1},E.onSelectorClick=function(y){var d=E.props.context.onNodeClick;d(y,Object(r.b)(E.props)),E.isSelectable()?E.onSelect(y):E.onCheck(y)},E.onSelectorDoubleClick=function(y){var d=E.props.context.onNodeDoubleClick;d(y,Object(r.b)(E.props))},E.onSelect=function(y){if(E.isDisabled())return;var d=E.props.context.onNodeSelect;y.preventDefault(),d(y,Object(r.b)(E.props))},E.onCheck=function(y){if(E.isDisabled())return;var d=E.props,l=d.disableCheckbox,h=d.checked,g=E.props.context.onNodeCheck;if(!E.isCheckable()||l)return;y.preventDefault();var b=!h;g(y,Object(r.b)(E.props),b)},E.onMouseEnter=function(y){var d=E.props.context.onNodeMouseEnter;d(y,Object(r.b)(E.props))},E.onMouseLeave=function(y){var d=E.props.context.onNodeMouseLeave;d(y,Object(r.b)(E.props))},E.onContextMenu=function(y){var d=E.props.context.onNodeContextMenu;d(y,Object(r.b)(E.props))},E.onDragStart=function(y){var d=E.props.context.onNodeDragStart;y.stopPropagation(),E.setState({dragNodeHighlight:!0}),d(y,Object(M.a)(E));try{y.dataTransfer.setData("text/plain","")}catch(l){}},E.onDragEnter=function(y){var d=E.props.context.onNodeDragEnter;y.preventDefault(),y.stopPropagation(),d(y,Object(M.a)(E))},E.onDragOver=function(y){var d=E.props.context.onNodeDragOver;y.preventDefault(),y.stopPropagation(),d(y,Object(M.a)(E))},E.onDragLeave=function(y){var d=E.props.context.onNodeDragLeave;y.stopPropagation(),d(y,Object(M.a)(E))},E.onDragEnd=function(y){var d=E.props.context.onNodeDragEnd;y.stopPropagation(),E.setState({dragNodeHighlight:!1}),d(y,Object(M.a)(E))},E.onDrop=function(y){var d=E.props.context.onNodeDrop;y.preventDefault(),y.stopPropagation(),E.setState({dragNodeHighlight:!1}),d(y,Object(M.a)(E))},E.onExpand=function(y){var d=E.props.context.onNodeExpand;d(y,Object(r.b)(E.props))},E.setSelectHandle=function(y){E.selectHandle=y},E.getNodeState=function(){var y=E.props.expanded;return E.isLeaf()?null:y?i:t},E.hasChildren=function(){var y=E.props.eventKey,d=E.props.context.keyEntities,l=d[y]||{},h=l.children;return!!(h||[]).length},E.isLeaf=function(){var y=E.props,d=y.isLeaf,l=y.loaded,h=E.props.context.loadData,g=E.hasChildren();return d===!1?!1:d||!h&&!g||h&&l&&!g},E.isDisabled=function(){var y=E.props.disabled,d=E.props.context.disabled;return!!(d||y)},E.isCheckable=function(){var y=E.props.checkable,d=E.props.context.checkable;return!d||y===!1?!1:d},E.syncLoadData=function(y){var d=y.expanded,l=y.loading,h=y.loaded,g=E.props.context,b=g.loadData,F=g.onNodeLoad;if(l)return;b&&d&&!E.isLeaf()&&(!E.hasChildren()&&!h&&F(Object(r.b)(E.props)))},E.renderSwitcher=function(){var y=E.props,d=y.expanded,l=y.switcherIcon,h=E.props.context,g=h.prefixCls,b=h.switcherIcon,F=l||b;if(E.isLeaf())return k.createElement("span",{className:v()("".concat(g,"-switcher"),"".concat(g,"-switcher-noop"))},typeof F=="function"?F(Object(U.a)(Object(U.a)({},E.props),{},{isLeaf:!0})):F);var N=v()("".concat(g,"-switcher"),"".concat(g,"-switcher_").concat(d?i:t));return k.createElement("span",{onClick:E.onExpand,className:N},typeof F=="function"?F(Object(U.a)(Object(U.a)({},E.props),{},{isLeaf:!1})):F)},E.renderCheckbox=function(){var y=E.props,d=y.checked,l=y.halfChecked,h=y.disableCheckbox,g=E.props.context.prefixCls,b=E.isDisabled(),F=E.isCheckable();if(!F)return null;var N=typeof F!="boolean"?F:null;return k.createElement("span",{className:v()("".concat(g,"-checkbox"),d&&"".concat(g,"-checkbox-checked"),!d&&l&&"".concat(g,"-checkbox-indeterminate"),(b||h)&&"".concat(g,"-checkbox-disabled")),onClick:E.onCheck},N)},E.renderIcon=function(){var y=E.props.loading,d=E.props.context.prefixCls;return k.createElement("span",{className:v()("".concat(d,"-iconEle"),"".concat(d,"-icon__").concat(E.getNodeState()||"docu"),y&&"".concat(d,"-icon_loading"))})},E.renderSelector=function(){var y=E.state.dragNodeHighlight,d=E.props,l=d.title,h=d.selected,g=d.icon,b=d.loading,F=d.data,N=E.props.context,W=N.prefixCls,K=N.showIcon,I=N.icon,x=N.draggable,j=N.loadData,$=N.titleRender,ae=E.isDisabled(),fe="".concat(W,"-node-content-wrapper"),pe;if(K){var Ce=g||I;pe=Ce?k.createElement("span",{className:v()("".concat(W,"-iconEle"),"".concat(W,"-icon__customize"))},typeof Ce=="function"?Ce(E.props):Ce):E.renderIcon()}else j&&b&&(pe=E.renderIcon());var De;typeof l=="function"?De=l(F):$?De=$(F):De=l;var xe=k.createElement("span",{className:"".concat(W,"-title")},De);return k.createElement("span",{ref:E.setSelectHandle,title:typeof l=="string"?l:"",className:v()("".concat(fe),"".concat(fe,"-").concat(E.getNodeState()||"normal"),!ae&&(h||y)&&"".concat(W,"-node-selected"),!ae&&x&&"draggable"),draggable:!ae&&x||void 0,"aria-grabbed":!ae&&x||void 0,onMouseEnter:E.onMouseEnter,onMouseLeave:E.onMouseLeave,onContextMenu:E.onContextMenu,onClick:E.onSelectorClick,onDoubleClick:E.onSelectorDoubleClick,onDragStart:x?E.onDragStart:void 0},pe,xe)},E}return Object(H.a)(O,[{key:"componentDidMount",value:function(){this.syncLoadData(this.props)}},{key:"componentDidUpdate",value:function(){this.syncLoadData(this.props)}},{key:"isSelectable",value:function(){var y=this.props.selectable,d=this.props.context.selectable;return typeof y=="boolean"?y:d}},{key:"render",value:function(){var y,d=this.props,l=d.eventKey,h=d.className,g=d.style,b=d.dragOver,F=d.dragOverGapTop,N=d.dragOverGapBottom,W=d.isLeaf,K=d.isStart,I=d.isEnd,x=d.expanded,j=d.selected,$=d.checked,ae=d.halfChecked,fe=d.loading,pe=d.domRef,Ce=d.active,De=d.onMouseMove,xe=Object(Z.a)(d,["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","onMouseMove"]),Oe=this.props.context,Ee=Oe.prefixCls,be=Oe.filterTreeNode,te=Oe.draggable,me=Oe.keyEntities,ye=this.isDisabled(),Le=Object(p.f)(xe),$e=me[l]||{},Me=$e.level,ze=I[I.length-1];return k.createElement("div",Object.assign({ref:pe,className:v()(h,"".concat(Ee,"-treenode"),(y={},Object(ie.a)(y,"".concat(Ee,"-treenode-disabled"),ye),Object(ie.a)(y,"".concat(Ee,"-treenode-switcher-").concat(x?"open":"close"),!W),Object(ie.a)(y,"".concat(Ee,"-treenode-checkbox-checked"),$),Object(ie.a)(y,"".concat(Ee,"-treenode-checkbox-indeterminate"),ae),Object(ie.a)(y,"".concat(Ee,"-treenode-selected"),j),Object(ie.a)(y,"".concat(Ee,"-treenode-loading"),fe),Object(ie.a)(y,"".concat(Ee,"-treenode-active"),Ce),Object(ie.a)(y,"".concat(Ee,"-treenode-leaf-last"),ze),Object(ie.a)(y,"drag-over",!ye&&b),Object(ie.a)(y,"drag-over-gap-top",!ye&&F),Object(ie.a)(y,"drag-over-gap-bottom",!ye&&N),Object(ie.a)(y,"filter-node",be&&be(Object(r.b)(this.props))),y)),style:g,onDragEnter:te?this.onDragEnter:void 0,onDragOver:te?this.onDragOver:void 0,onDragLeave:te?this.onDragLeave:void 0,onDrop:te?this.onDrop:void 0,onDragEnd:te?this.onDragEnd:void 0,onMouseMove:De},Le),k.createElement(u,{prefixCls:Ee,level:Me,isStart:K,isEnd:I}),this.renderSwitcher(),this.renderCheckbox(),this.renderSelector())}}]),O}(k.Component),A=function(R){return k.createElement(_.a.Consumer,null,function(O){return k.createElement(f,Object.assign({},R,{context:O}))})};A.displayName="TreeNode",A.defaultProps={title:c},A.isTreeNode=1;var S=st.a=A},XIdC:function(zt,st,V){"use strict";var ie=V("rePB"),Z=V("ODXe"),U=V("Ff2n"),ee=V("q1tI"),H=V.n(ee),M=V("TSYQ"),Y=V.n(M),X=V("6cGi"),k=V("4IlW"),D=ee.forwardRef(function(v,_){var p,o=v.prefixCls,u=o===void 0?"rc-switch":o,r=v.className,i=v.checked,t=v.defaultChecked,c=v.disabled,f=v.loadingIcon,A=v.checkedChildren,S=v.unCheckedChildren,w=v.onClick,R=v.onChange,O=v.onKeyDown,E=Object(U.a)(v,["prefixCls","className","checked","defaultChecked","disabled","loadingIcon","checkedChildren","unCheckedChildren","onClick","onChange","onKeyDown"]),y=Object(X.a)(!1,{value:i,defaultValue:t}),d=Object(Z.a)(y,2),l=d[0],h=d[1];function g(W,K){var I=l;return c||(I=W,h(I),R==null||R(I,K)),I}function b(W){W.which===k.a.LEFT?g(!1,W):W.which===k.a.RIGHT&&g(!0,W),O==null||O(W)}function F(W){var K=g(!l,W);w==null||w(K,W)}var N=Y()(u,r,(p={},Object(ie.a)(p,"".concat(u,"-checked"),l),Object(ie.a)(p,"".concat(u,"-disabled"),c),p));return ee.createElement("button",Object.assign({},E,{type:"button",role:"switch","aria-checked":l,disabled:c,className:N,ref:_,onKeyDown:b,onClick:F}),f,ee.createElement("span",{className:"".concat(u,"-inner")},l?A:S))});D.displayName="Switch",st.a=D},Y1PL:function(zt,st,V){"use strict";V.r(st),V.d(st,"ResizableTextArea",function(){return ae});var ie=V("wx14"),Z=V("1OyB"),U=V("vuIU"),ee=V("Ji7U"),H=V("LK+K"),M=V("q1tI"),Y=V("VTBJ"),X=V("rePB"),k=V("Zm9Q"),D=V("Kwbf"),v=V("c+Xe"),_=V("m+aA"),p=V("bdgK"),o=new Map;function u(Ce){Ce.forEach(function(De){var xe,Oe=De.target;(xe=o.get(Oe))===null||xe===void 0||xe.forEach(function(Ee){return Ee(Oe)})})}var r=new p.default(u),i=null,t=null;function c(Ce,De){o.has(Ce)||(o.set(Ce,new Set),r.observe(Ce)),o.get(Ce).add(De)}function f(Ce,De){o.has(Ce)&&(o.get(Ce).delete(De),o.get(Ce).size||(r.unobserve(Ce),o.delete(Ce)))}var A=function(Ce){Object(ee.a)(xe,Ce);var De=Object(H.a)(xe);function xe(){return Object(Z.a)(this,xe),De.apply(this,arguments)}return Object(U.a)(xe,[{key:"render",value:function(){return this.props.children}}]),xe}(M.Component),S=M.createContext(null);function w(Ce){var De=Ce.children,xe=Ce.onBatchResize,Oe=M.useRef(0),Ee=M.useRef([]),be=M.useContext(S),te=M.useCallback(function(me,ye,Le){Oe.current+=1;var $e=Oe.current;Ee.current.push({size:me,element:ye,data:Le}),Promise.resolve().then(function(){$e===Oe.current&&(xe==null||xe(Ee.current),Ee.current=[])}),be==null||be(me,ye,Le)},[xe,be]);return M.createElement(S.Provider,{value:te},De)}function R(Ce){var De=Ce.children,xe=Ce.disabled,Oe=M.useRef(null),Ee=M.useRef(null),be=M.useContext(S),te=M.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),me=M.isValidElement(De)&&Object(v.c)(De),ye=me?De.ref:null,Le=M.useMemo(function(){return Object(v.a)(ye,Oe)},[ye,Oe]),$e=M.useRef(Ce);$e.current=Ce;var Me=M.useCallback(function(ze){var ot=$e.current,Et=ot.onResize,_t=ot.data,mt=ze.getBoundingClientRect(),ut=mt.width,Xt=mt.height,en=ze.offsetWidth,sn=ze.offsetHeight,pn=Math.floor(ut),Un=Math.floor(Xt);if(te.current.width!==pn||te.current.height!==Un||te.current.offsetWidth!==en||te.current.offsetHeight!==sn){var Cn={width:pn,height:Un,offsetWidth:en,offsetHeight:sn};te.current=Cn;var Qe=en===Math.round(ut)?ut:en,Ye=sn===Math.round(Xt)?Xt:sn,St=Object(Y.a)(Object(Y.a)({},Cn),{},{offsetWidth:Qe,offsetHeight:Ye});be==null||be(St,ze,_t),Et&&Promise.resolve().then(function(){Et(St,ze)})}},[]);return M.useEffect(function(){var ze=Object(_.a)(Oe.current)||Object(_.a)(Ee.current);return ze&&!xe&&c(ze,Me),function(){return f(ze,Me)}},[Oe.current,xe]),M.createElement(A,{ref:Ee},me?M.cloneElement(De,{ref:Le}):De)}var O="rc-observer-key";function E(Ce){var De=Ce.children,xe=Object(k.a)(De);return xe.map(function(Oe,Ee){var be=(Oe==null?void 0:Oe.key)||"".concat(O,"-").concat(Ee);return M.createElement(R,Object(ie.a)({},Ce,{key:be}),Oe)})}E.Collection=w;var y=E,d=V("bT9E"),l=V("TSYQ"),h=V.n(l),g=`
|
|
min-height:0 !important;
|
|
max-height:none !important;
|
|
height:0 !important;
|
|
visibility:hidden !important;
|
|
overflow:hidden !important;
|
|
position:absolute !important;
|
|
z-index:-1000 !important;
|
|
top:0 !important;
|
|
right:0 !important
|
|
`,b=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],F={},N;function W(Ce){var De=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,xe=Ce.getAttribute("id")||Ce.getAttribute("data-reactid")||Ce.getAttribute("name");if(De&&F[xe])return F[xe];var Oe=window.getComputedStyle(Ce),Ee=Oe.getPropertyValue("box-sizing")||Oe.getPropertyValue("-moz-box-sizing")||Oe.getPropertyValue("-webkit-box-sizing"),be=parseFloat(Oe.getPropertyValue("padding-bottom"))+parseFloat(Oe.getPropertyValue("padding-top")),te=parseFloat(Oe.getPropertyValue("border-bottom-width"))+parseFloat(Oe.getPropertyValue("border-top-width")),me=b.map(function(Le){return"".concat(Le,":").concat(Oe.getPropertyValue(Le))}).join(";"),ye={sizingStyle:me,paddingSize:be,borderSize:te,boxSizing:Ee};return De&&xe&&(F[xe]=ye),ye}function K(Ce){var De=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,xe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Oe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;N||(N=document.createElement("textarea"),N.setAttribute("tab-index","-1"),N.setAttribute("aria-hidden","true"),document.body.appendChild(N)),Ce.getAttribute("wrap")?N.setAttribute("wrap",Ce.getAttribute("wrap")):N.removeAttribute("wrap");var Ee=W(Ce,De),be=Ee.paddingSize,te=Ee.borderSize,me=Ee.boxSizing,ye=Ee.sizingStyle;N.setAttribute("style","".concat(ye,";").concat(g)),N.value=Ce.value||Ce.placeholder||"";var Le=Number.MIN_SAFE_INTEGER,$e=Number.MAX_SAFE_INTEGER,Me=N.scrollHeight,ze;if(me==="border-box"?Me+=te:me==="content-box"&&(Me-=be),xe!==null||Oe!==null){N.value=" ";var ot=N.scrollHeight-be;xe!==null&&(Le=ot*xe,me==="border-box"&&(Le=Le+be+te),Me=Math.max(Le,Me)),Oe!==null&&($e=ot*Oe,me==="border-box"&&($e=$e+be+te),ze=Me>$e?"":"hidden",Me=Math.min($e,Me))}return{height:Me,minHeight:Le,maxHeight:$e,overflowY:ze,resize:"none"}}var I=V("Gytx"),x=V.n(I),j;(function(Ce){Ce[Ce.NONE=0]="NONE",Ce[Ce.RESIZING=1]="RESIZING",Ce[Ce.RESIZED=2]="RESIZED"})(j||(j={}));var $=function(Ce){Object(ee.a)(xe,Ce);var De=Object(H.a)(xe);function xe(Oe){var Ee;return Object(Z.a)(this,xe),Ee=De.call(this,Oe),Ee.nextFrameActionId=void 0,Ee.resizeFrameId=void 0,Ee.textArea=void 0,Ee.saveTextArea=function(be){Ee.textArea=be},Ee.handleResize=function(be){var te=Ee.state.resizeStatus,me=Ee.props,ye=me.autoSize,Le=me.onResize;if(te!==j.NONE)return;typeof Le=="function"&&Le(be),ye&&Ee.resizeOnNextFrame()},Ee.resizeOnNextFrame=function(){cancelAnimationFrame(Ee.nextFrameActionId),Ee.nextFrameActionId=requestAnimationFrame(Ee.resizeTextarea)},Ee.resizeTextarea=function(){var be=Ee.props.autoSize;if(!be||!Ee.textArea)return;var te=be.minRows,me=be.maxRows,ye=K(Ee.textArea,!1,te,me);Ee.setState({textareaStyles:ye,resizeStatus:j.RESIZING},function(){cancelAnimationFrame(Ee.resizeFrameId),Ee.resizeFrameId=requestAnimationFrame(function(){Ee.setState({resizeStatus:j.RESIZED},function(){Ee.resizeFrameId=requestAnimationFrame(function(){Ee.setState({resizeStatus:j.NONE}),Ee.fixFirefoxAutoScroll()})})})})},Ee.renderTextArea=function(){var be=Ee.props,te=be.prefixCls,me=te===void 0?"rc-textarea":te,ye=be.autoSize,Le=be.onResize,$e=be.className,Me=be.disabled,ze=Ee.state,ot=ze.textareaStyles,Et=ze.resizeStatus,_t=Object(d.a)(Ee.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),mt=h()(me,$e,Object(X.a)({},"".concat(me,"-disabled"),Me));"value"in _t&&(_t.value=_t.value||"");var ut=Object(Y.a)(Object(Y.a)(Object(Y.a)({},Ee.props.style),ot),Et===j.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return M.createElement(y,{onResize:Ee.handleResize,disabled:!(ye||Le)},M.createElement("textarea",Object(ie.a)({},_t,{className:mt,style:ut,ref:Ee.saveTextArea})))},Ee.state={textareaStyles:{},resizeStatus:j.NONE},Ee}return Object(U.a)(xe,[{key:"componentDidUpdate",value:function(Ee){(Ee.value!==this.props.value||!x()(Ee.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var Ee=this.textArea.selectionStart,be=this.textArea.selectionEnd;this.textArea.setSelectionRange(Ee,be)}}catch(te){}}},{key:"render",value:function(){return this.renderTextArea()}}]),xe}(M.Component),ae=$,fe=function(Ce){Object(ee.a)(xe,Ce);var De=Object(H.a)(xe);function xe(Oe){var Ee;Object(Z.a)(this,xe),Ee=De.call(this,Oe),Ee.resizableTextArea=void 0,Ee.focus=function(){Ee.resizableTextArea.textArea.focus()},Ee.saveTextArea=function(te){Ee.resizableTextArea=te},Ee.handleChange=function(te){var me=Ee.props.onChange;Ee.setValue(te.target.value,function(){Ee.resizableTextArea.resizeTextarea()}),me&&me(te)},Ee.handleKeyDown=function(te){var me=Ee.props,ye=me.onPressEnter,Le=me.onKeyDown;te.keyCode===13&&ye&&ye(te),Le&&Le(te)};var be=typeof Oe.value=="undefined"||Oe.value===null?Oe.defaultValue:Oe.value;return Ee.state={value:be},Ee}return Object(U.a)(xe,[{key:"setValue",value:function(Ee,be){"value"in this.props||this.setState({value:Ee},be)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return M.createElement(ae,Object(ie.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(Ee){return"value"in Ee?{value:Ee.value}:null}}]),xe}(M.Component),pe=st.default=fe},YIbm:function(zt,st,V){zt.exports={content:"content___24s9X"}},"YJx+":function(zt,st,V){zt.exports={flex_box_center:"flex_box_center___TKIS5",flex_space_between:"flex_space_between___3ITJg",flex_box_vertical_center:"flex_box_vertical_center___pGLbk",flex_box_center_end:"flex_box_center_end___3-z2A",flex_box_column:"flex_box_column___1SlIq",wrap:"wrap___2TxDh",modal:"modal___jkvmI",titleWrap:"titleWrap___386Y5",required:"required___3ddar",title:"title___2scfU",colorGray:"colorGray___10JDh",choiceWrap:"choiceWrap___3UMox",answer:"answer___1kvCr",activeAnswer:"activeAnswer___1tun2",deleteIcon:"deleteIcon___2_EJk",addIcon:"addIcon___b404_",editorWrap:"editorWrap___1qDS7",htmlWrap:"htmlWrap___2ear6",radio:"radio___3EFAB",color333:"color333___lt3ql",color999:"color999___11Mt_",questionType:"questionType___1yIj7",questionChoices:"questionChoices___1n3A7",action:"action___3PqBm",difficult:"difficult___1L4Zj",fold:"fold___3zBy6",head:"head___1dsW5"}},Z9P2:function(zt,st,V){"use strict";var ie=V("+BJd"),Z=V("mr32"),U=V("14J3"),ee=V("BMrR"),H=V("5NDa"),M=V("5rEg"),Y=V("oBTY"),X=V("5Dmo"),k=V("3S7+"),D=V("miYZ"),v=V("tsqr"),_=V("tJVT"),p=V("q1tI"),o=V.n(p),u=function(i){var t,c,f=i.value,A=f===void 0?[[],[]]:f,S=i.onChange,w=Object(p.useState)(""),R=Object(_.a)(w,2),O=R[0],E=R[1],y=Object(p.useState)(""),d=Object(_.a)(y,2),l=d[0],h=d[1],g=function(F){if(!F)return!1;var N=new RegExp("[ `~!@#$^&*()={}':;,\\[\\].<>/?~\uFF01@#\uFFE5\u2026\u2026&*\uFF08\uFF09\u2014\u3010\u3011\u2018\uFF1B\uFF1A\u201D\u201C\u3002\uFF0C\u3001\uFF1F\u300C\u300D\u300E\u300F_\\+\\-\xB7%\u300A\u300B]|[\\\\/]");return N.test(F)?(v.b.warn("\u5173\u952E\u8BCD\u4E0D\u80FD\u542B\u6709\u7279\u6B8A\u5B57\u7B26\uFF01"),!1):F==="|"?(v.b.warn("\u5173\u952E\u8BCD\u4E0D\u80FD\u53EA\u8F93\u5165\u4E00\u4E2A\u201C|\u201D\u5B57\u7B26\uFF01"),!1):!0};return o.a.createElement("div",null,o.a.createElement("p",{className:"font14"},"\u5173\u952E\u8BCD",o.a.createElement("span",{className:"c-grey-999"},"\uFF08\u5173\u952E\u8BCD\u53EF\u7528\u4E8E\u81EA\u52A8\u5224\u5206\uFF09"),o.a.createElement(k.a,{overlayStyle:{maxWidth:350},title:o.a.createElement("div",null,o.a.createElement("div",null,"\u6BCF\u4E2A\u6838\u5FC3\u5173\u952E\u8BCD\u7684\u5206\u6570\u662F\u666E\u901A\u5173\u952E\u8BCD\u5206\u6570\u7684\u4E24\u500D"),o.a.createElement("div",null,"\u4F8B\u5982\uFF1A"),o.a.createElement("div",null,"\u672C\u989810\u5206\uFF0C\u666E\u901A\u5173\u952E\u8BCD1\u4E2A\uFF0C\u6838\u5FC3\u5173\u952E\u8BCD2\u4E2A\uFF0C\u5219\u6BCF\u4E2A"),o.a.createElement("div",null,"\u666E\u901A\u5173\u952E\u8BCD2\u5206\uFF0C\u6BCF\u4E2A\u6838\u5FC3\u5173\u952E\u8BCD4\u5206"))},o.a.createElement("span",{className:"iconfont icon-a-wenhaobeifen2 font14"}))),o.a.createElement(ee.a,{align:"middle",className:"font14"},"\u666E\u901A\u5173\u952E\u8BCD\uFF1A",o.a.createElement(M.a,{value:O,onChange:function(F){E(F.target.value)},maxLength:50,allowClear:!0,onPressEnter:function(F){var N,W=(N=F.target)===null||N===void 0?void 0:N.value;if(g(W)){var K,I;(K=A[0])===null||K===void 0||K.push(W==null||((I=W.split("|"))===null||I===void 0)?void 0:I.filter(function(x){return!!x})),S(Object(Y.a)(A)),E("")}},style:{width:800},className:"ml5 mr10",placeholder:"\u652F\u6301\u4FDD\u5B58\u591A\u4E2A\u5173\u952E\u8BCD\uFF1B\u5E76\u5217\u5173\u952E\u8BCD\uFF08\u6216\u7684\u5173\u7CFB\uFF09\u7528\u201D|\u201D\u5206\u5272\u3002"}),o.a.createElement("span",{className:"c-grey-999"},"\u201C\u56DE\u8F66\u952E\u201D\u4FDD\u5B58\u5173\u952E\u8BCD")),o.a.createElement("div",{style:{paddingLeft:89},className:"mt10"},A==null||((t=A[0])===null||t===void 0)?void 0:t.map(function(b,F){return o.a.createElement(Z.a,{className:"mb10",key:F,closable:!0,onClose:function(W){var K;W.preventDefault(),A[0]=(K=A[0])===null||K===void 0?void 0:K.filter(function(I,x){return x!==F}),S(Object(Y.a)(A))}},b==null?void 0:b.join(" \u6216 "))})),o.a.createElement(ee.a,{align:"middle",className:"font14"},"\u6838\u5FC3\u5173\u952E\u8BCD\uFF1A",o.a.createElement(M.a,{value:l,onChange:function(F){h(F.target.value)},maxLength:50,allowClear:!0,onPressEnter:function(F){var N,W=(N=F.target)===null||N===void 0?void 0:N.value;if(g(W)){var K,I;(K=A[1])===null||K===void 0||K.push(W==null||((I=W.split("|"))===null||I===void 0)?void 0:I.filter(function(x){return!!x})),S(Object(Y.a)(A)),h("")}},style:{width:800},className:"ml5 mr10",placeholder:"\u652F\u6301\u4FDD\u5B58\u591A\u4E2A\u5173\u952E\u8BCD\uFF1B\u5E76\u5217\u5173\u952E\u8BCD\uFF08\u6216\u7684\u5173\u7CFB\uFF09\u7528\u201D|\u201D\u5206\u5272\u3002"}),o.a.createElement("span",{className:"c-grey-999"},"\u201C\u56DE\u8F66\u952E\u201D\u4FDD\u5B58\u5173\u952E\u8BCD")),o.a.createElement("div",{style:{paddingLeft:89},className:"mt10"},A==null||((c=A[1])===null||c===void 0)?void 0:c.map(function(b,F){return o.a.createElement(Z.a,{className:"mb10",key:F,closable:!0,onClose:function(W){var K;W.preventDefault(),A[1]=(K=A[1])===null||K===void 0?void 0:K.filter(function(I,x){return x!==F}),S(Object(Y.a)(A))}},b==null?void 0:b.join(" \u6216 "))})))};st.a=u},ZW9T:function(zt,st,V){"use strict";V.d(st,"a",function(){return K});var ie=V("k1fw"),Z=V("miYZ"),U=V("tsqr"),ee=V("rAM+"),H=V("tJVT"),M=V("PpiC"),Y=V("q1tI"),X=V.n(Y),k=V("bdgK"),D=V("oBTY"),v=V("9og8"),_=V("WmNS"),p=V.n(_),o={keywords:["print","auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while"]},u={quickKey:[{label:"main",content:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`)},{label:"System.out.println",content:["System.out.println($0)"].join(`
|
|
`)},{label:"System.out.print",content:["System.out.print($0)"].join(`
|
|
`)}],keywords:["abstract","continue","for","new","switch","assert","default","goto","package","synchronized","boolean","do","if","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","true","false"]},r={keywords:["abstract","amp","array","auto","bool","break","case","catch","char","class","const","constexpr","const_cast","continue","cpu","decltype","default","delegate","delete","do","double","dynamic_cast","each","else","enum","event","explicit","export","extern","false","final","finally","float","for","friend","gcnew","generic","goto","if","in","initonly","inline","int","interface","interior_ptr","internal","literal","long","mutable","namespace","new","noexcept","nullptr","__nullptr","operator","override","partial","pascal","pin_ptr","private","property","protected","public","ref","register","reinterpret_cast","restrict","return","safe_cast","sealed","short","signed","sizeof","static","static_assert","static_cast","struct","switch","template","this","thread_local","throw","tile_static","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","where","while","_asm","_based","_cdecl","_declspec","_fastcall","_if_exists","_if_not_exists","_inline","_multiple_inheritance","_pascal","_single_inheritance","_stdcall","_virtual_inheritance","_w64","__abstract","__alignof","__asm","__assume","__based","__box","__builtin_alignof","__cdecl","__clrcall","__declspec","__delegate","__event","__except","__fastcall","__finally","__forceinline","__gc","__hook","__identifier","__if_exists","__if_not_exists","__inline","__int128","__int16","__int32","__int64","__int8","__interface","__leave","__m128","__m128d","__m128i","__m256","__m256d","__m256i","__m64","__multiple_inheritance","__newslot","__nogc","__noop","__nounwind","__novtordisp","__pascal","__pin","__pragma","__property","__ptr32","__ptr64","__raise","__restrict","__resume","__sealed","__single_inheritance","__stdcall","__super","__thiscall","__try","__try_cast","__typeof","__unaligned","__unhook","__uuidof","__value","__virtual_inheritance","__w64","__wchar_t"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],quickKey:[{label:"ifelse",content:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`)},{label:"#include",content:'include "$0"'},{label:"printf",content:"printf($0)"},{label:"main",content:["int main () {"," $0","}"].join(`
|
|
`)},{label:"for",content:["for( ; ; ){"," $0","}"].join(`
|
|
`)},{label:"trycatch",content:["try{"," $0","}catch(ExceptionName e){","}"].join(`
|
|
`)},{label:"using namespace std;",content:["using namespace std;"].join(`
|
|
`)},{label:"#include <iostream>",content:["#include <iostream>"].join(`
|
|
`)},{label:"#include <vector>",content:["#include <vector>"].join(`
|
|
`)},{label:"#include <sstream>",content:["#include <sstream>"].join(`
|
|
`)},{label:"#include <string>",content:["#include <string>"].join(`
|
|
`)},{label:"#include <cmath>",content:["#include <cmath>"].join(`
|
|
`)}]},i={keywords:["and","as","assert","break","class","continue","def","del","elif","else","except","exec","finally","for","from","global","if","import","in","is","lambda","None","not","or","pass","raise","return","self","try","while","with","yield","int","float","long","complex","hex","abs","all","any","apply","basestring","bin","bool","buffer","bytearray","callable","chr","classmethod","cmp","coerce","compile","complex","delattr","dict","dir","divmod","enumerate","eval","execfile","file","filter","format","frozenset","getattr","globals","hasattr","hash","help","id","input","intern","isinstance","issubclass","iter","len","locals","list","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","reversed","range","raw_input","reduce","reload","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","unichr","unicode","vars","xrange","zip","True","False","__dict__","__methods__","__members__","__class__","__bases__","__name__","__mro__","__subclasses__","__init__","__import__"],quickKey:[{label:"print",content:["print($0)"].join(`
|
|
`)}]},t=V("5VLF"),c=V.n(t),f={languages:["c","abap","apex","azcli","bat","cameligo","clojure","coffee","cpp","csharp","csp","css","dockerfile","fsharp","go","graphql","handlebars","html","ini","java","javascript","json","kotlin","less","lua","markdown","mips","msdax","mysql","objective-c","pascal","pascaligo","perl","pgsql","php","postiats","powerquery","powershell","pug","python","r","razor","redis","redshift","restructuredtext","ruby","rust","sb","scheme","scss","shell","solidity","sophia","sql","st","swift","tcl","twig","vb","xml","yaml'"],tables:{users:["name","id","email","phone","password"],roles:["id","name","order","created_at","updated_at","deleted_at"]}},A=function(x,j){return j.map(function($){return{label:$,kind:x.languages.CompletionItemKind.Keyword,insertText:$}})},S=function(x){return Object.keys(f.tables).map(function(j){return{label:j,kind:x.languages.CompletionItemKind.Variable,insertText:j}})},w=function(x,j){var $=f.tables[x];return $?$.map(function(ae){return{label:ae,kind:j.languages.CompletionItemKind.Field,insertText:ae}}):[]};function R(I,x,j,$,ae){var fe=x.getWordUntilPosition(j),pe={startLineNumber:j.lineNumber,endLineNumber:j.lineNumber,startColumn:fe.startColumn,endColumn:fe.endColumn},Ce=$.map(function(De){return{label:De,kind:I.languages.CompletionItemKind.Keyword,insertText:De,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:pe}});return ae.map(function(De){Ce.push(Object(ie.a)(Object(ie.a)({},De),{},{range:pe}))}),Ce}var O=function(I){f.languages.map(function(ae){return I.languages.registerDocumentFormattingEditProvider(ae,{provideDocumentFormattingEdits:function(pe,Ce,De){return Object(v.a)(p.a.mark(function xe(){var Oe;return p.a.wrap(function(be){for(;;)switch(be.prev=be.next){case 0:return Oe=c()(pe.getValue(),{indent_size:"2",indent_char:" ",max_preserve_newlines:"2",preserve_newlines:!0,keep_array_indentation:!0,break_chained_methods:!1,indent_scripts:"normal",brace_style:"collapse",space_before_conditional:!0,unescape_strings:!1,jslint_happy:!1,end_with_newline:!0,wrap_line_length:"0",indent_inner_html:!1,comma_first:!1,e4x:!1,indent_empty_lines:!1}),be.abrupt("return",[{range:pe.getFullModelRange(),text:Oe}]);case 2:case"end":return be.stop()}},xe)}))()}}),ae});var x=r.quickKey.map(function(ae){return{label:ae.label,kind:I.languages.CompletionItemKind.Method,insertText:ae.content,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),j=i.quickKey.map(function(ae){return{label:ae.label,kind:I.languages.CompletionItemKind.Method,insertText:ae.content,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),$=u.quickKey.map(function(ae){return{label:ae.label,kind:I.languages.CompletionItemKind.Method,insertText:ae.content,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet}});I.languages.registerCompletionItemProvider("cpp",{triggerCharacters:["."," ","#"].concat(Object(D.a)(r.keywords),Object(D.a)(r.quickKey.map(function(ae){return ae.label}))),provideCompletionItems:function(fe,pe){var Ce=fe.getValueInRange({startLineNumber:pe.lineNumber,startColumn:1,endLineNumber:pe.lineNumber,endColumn:pe.column}),De=Ce.match(/cu/gim);console.log("match:",De,pe,Ce,fe);var xe=[],Oe=pe.lineNumber,Ee=pe.column,be=fe.getValueInRange({startLineNumber:Oe,startColumn:0,endLineNumber:Oe,endColumn:Ee}),te=be.trim().split(/\s+/),me=te[te.length-1];if(me.endsWith(".")){var ye=me.slice(0,me.length-1);Object.keys(f.tables).includes(ye)&&(xe=Object(D.a)(w(ye,I)))}else me==="."?xe=[]:xe=[].concat(Object(D.a)(S(I)),Object(D.a)(A(I,r.keywords)),Object(D.a)(x));return{suggestions:xe}}}),I.languages.registerCompletionItemProvider("c",{triggerCharacters:["."," ","#"].concat(Object(D.a)(o.keywords)),provideCompletionItems:function(fe,pe){var Ce=fe.getValueInRange({startLineNumber:pe.lineNumber,startColumn:1,endLineNumber:pe.lineNumber,endColumn:pe.column}),De=Ce.match(/cu/gim);console.log("match:",De,pe,Ce,fe);var xe=[],Oe=pe.lineNumber,Ee=pe.column,be=fe.getValueInRange({startLineNumber:Oe,startColumn:0,endLineNumber:Oe,endColumn:Ee}),te=be.trim().split(/\s+/),me=te[te.length-1];if(me.endsWith(".")){var ye=me.slice(0,me.length-1);Object.keys(f.tables).includes(ye)&&(xe=Object(D.a)(w(ye,I)))}else me==="."?xe=[]:xe=[].concat(Object(D.a)(S(I)),Object(D.a)(A(I,o.keywords)));return{suggestions:xe}}}),I.languages.registerCompletionItemProvider("java",{triggerCharacters:["."," "].concat(Object(D.a)(u.keywords)),provideCompletionItems:function(fe,pe){var Ce=[],De=pe.lineNumber,xe=pe.column,Oe=fe.getValueInRange({startLineNumber:De,startColumn:0,endLineNumber:De,endColumn:xe}),Ee=Oe.trim().split(/\s+/),be=Ee[Ee.length-1];if(be.endsWith(".")){var te=be.slice(0,be.length-1);Object.keys(f.tables).includes(te)&&(Ce=Object(D.a)(w(te,I)))}else be==="."?Ce=[]:Ce=[].concat(Object(D.a)(S(I)),Object(D.a)(A(I,u.keywords)),Object(D.a)($));return{suggestions:Ce}}}),I.languages.registerCompletionItemProvider("python",{triggerCharacters:["."," "].concat(Object(D.a)(i.keywords)),provideCompletionItems:function(fe,pe){var Ce=[],De=pe.lineNumber,xe=pe.column,Oe=fe.getValueInRange({startLineNumber:De,startColumn:0,endLineNumber:De,endColumn:xe}),Ee=Oe.trim().split(/\s+/),be=Ee[Ee.length-1];if(be.endsWith(".")){var te=be.slice(0,be.length-1);Object.keys(f.tables).includes(te)&&(Ce=Object(D.a)(w(te,I)))}else be==="."?Ce=[]:Ce=[].concat(Object(D.a)(S(I)),Object(D.a)(A(I,i.keywords)),Object(D.a)(j));return{suggestions:Ce}}})},E="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",y=V("LvDl"),d=V("+ua5");function l(I){return/^\d+$/.test(I)?"".concat(I,"px"):I}function h(){}var g=!1,b={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function F(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],x=I;if(Array.isArray(I)){for(var j=0;j<I.length;j++){var $=b[I[j]];if($)return $}return x[0]}return b[x]||x}var N=null,W=st.b=function(I){var x=I.width,j=x===void 0?"100%":x,$=I.height,ae=$===void 0?"100%":$,fe=I.value,pe=I.language,Ce=pe===void 0?"javascript":pe,De=I.style,xe=De===void 0?{}:De,Oe=I.options,Ee=Oe===void 0?{}:Oe,be=I.overrideServices,te=be===void 0?{}:be,me=I.theme,ye=me===void 0?"vs-dark":me,Le=I.onEditBlur,$e=I.onSave,Me=I.autoHeight,ze=Me===void 0?!1:Me,ot=I.forbidCopy,Et=ot===void 0?!1:ot,_t=I.onChange,mt=_t===void 0?h:_t,ut=I.editorDidMount,Xt=ut===void 0?h:ut,en=I.onFocus,sn=en===void 0?h:en,pn=I.filename,Un=pn===void 0?"educoder.txt":pn,Cn=I.errorLine,Qe=I.errorContent,Ye=Qe===void 0?"":Qe,St=Object(M.a)(I,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),bt=Object(Y.useRef)(),nt=Object(Y.useRef)({}),vt=Object(Y.useRef)(),Ue=Object(Y.useRef)(!1),Ae=Object(Y.useRef)(),Re=Object(Y.useState)(!1),le=Object(H.a)(Re,2),he=le[0],Se=le[1];function ve(){var Dt;return bt.current&&(Dt=new k.default(function(Qn){var vi=Object(ee.a)(Qn),hi;try{for(vi.s();!(hi=vi.n()).done;){var bi=hi.value;(bi.target.offsetHeight>0||bi.target.offsetWidth>0)&&nt.current.instance.layout()}}catch(yi){vi.e(yi)}finally{vi.f()}}),Dt.observe(bt.current)),Dt}function Pe(){U.b.warn(decodeURIComponent(E))}var it=function(){var Qn=nt.current.instance;if(fe!=null&&Qn&&he){var vi=Qn.getModel();vi&&fe!==vi.getValue()&&(g=!0,vi.setValue(fe),Qn.layout(),g=!1)}};Object(Y.useEffect)(function(){vt.current&&clearTimeout(vt.current),vt.current=setTimeout(function(){it()},500)},[fe,he,nt.current]),Object(Y.useEffect)(function(){if(Cn&&nt.current&&nt.current.instance){var Dt=nt.current.instance;Dt.changeViewZones(function(vi){var hi=document.createElement("div");hi.style.padding="10px 20px",hi.style.width="calc(100% - 20px)",hi.className="my-error-line-wrp",hi.innerHTML=Ye,vi.addZone({afterLineNumber:Cn||11,heightInLines:3,domNode:hi})});var Qn={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};Dt.addOverlayWidget(Qn),Dt.revealPositionInCenter({lineNumber:20,column:1})}},[Cn,nt.current,he]);function xt(){var Dt=nt.current.instance;if(Dt){var Qn=Dt.getSelection(),vi=nt.current.pastePos||{},hi=new N.Range(vi.startLineNumber||Qn.endLineNumber,vi.startColumn||Qn.endColumn,vi.endLineNumber||Qn.endLineNumber,vi.endColumn||Qn.endColumn);setTimeout(function(){Dt.executeEdits("",[{range:hi,text:""}])},300)}}function $t(Dt){(window.navigator.platform.match("Mac")?Dt.metaKey:Dt.ctrlKey)&&Dt.keyCode==83&&(Dt.preventDefault(),$e())}var mn=function(){if(ze&&nt.current.instance){var Qn=nt.current.instance.getContentHeight();Ai(Qn<ae?ae:Qn)}else Ai(ae)};function rn(Dt){var Qn=document.createEvent("MouseEvents");Qn.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Dt.dispatchEvent(Qn)}function ci(Dt,Qn){var vi=window.URL||window.webkitURL||window,hi=new Blob([Qn]),bi=document.createElementNS("http://www.w3.org/1999/xhtml","a");bi.href=vi.createObjectURL(hi),bi.download=Dt,rn(bi)}Object(Y.useEffect)(function(){mn()},[mn]),Object(Y.useEffect)(function(){bt.current&&!he&&V.e(27).then(V.t.bind(null,"M/lh",7)).then(function(Dt){try{N=Dt,nt.current.instance=N.editor.create(bt.current,{value:fe,language:F(Ce),theme:ye,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},te);var Qn=nt.current.instance;if(Xt(Qn,N),setTimeout(function(){mn(),nt.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){ci(Un||"educoder.txt",Qn.getValue())}})},500),nt.current.subscription=Qn.onDidChangeModelContent(function(hi){Ue.current?clearTimeout(Ae.current):(mn(),mt(Qn.getValue(),hi)),Ae.current=setTimeout(function(){Ue.current=!1},500)}),window.Monaco||O(N),Et&&(Qn.addCommand(N.KeyMod.CtrlCmd|N.KeyMod.Shift|N.KeyCode.KEY_V,function(){return Pe(),null}),Qn.addCommand(N.KeyMod.CtrlCmd|N.KeyCode.KEY_C,function(){return Pe(),null})),window.Monaco=N,Le&&Qn.onDidBlurEditorWidget(function(){Le(Qn.getValue())}),sn&&Qn.onDidFocusEditorText(function(){sn(Qn.getValue())}),Et){Qn.addCommand(N.KeyMod.CtrlCmd|N.KeyCode.KEY_V,function(){return Pe(),null}),Qn.onDidPaste(function(hi){nt.current.pastePos=hi});try{window.addEventListener("paste",xt)}catch(hi){}}var vi=ve();return Se(!0),function(){var hi=nt.current.instance;hi.dispose();var bi=hi.getModel();bi&&bi.dispose(),nt.current.subscription&&nt.current.subscription.dispose(),Et&&window.removeEventListener("paste",xt),vi.unobserve(bt.current)}}catch(hi){}})},[]),Object(Y.useEffect)(function(){var Dt=nt.current.instance;if(Dt&&he)return document.addEventListener("keydown",$t,!1),function(){document.removeEventListener("keydown",$t)}},[$e,he]),Object(Y.useEffect)(function(){var Dt=nt.current.instance;if(Dt&&he){var Qn=F(Ce);N.editor.setModelLanguage(Dt.getModel(),Qn),console.log("language:",Ce,Dt.getModel(),Qn)}},[Ce,he]),Object(Y.useEffect)(function(){var Dt=nt.current.instance;Dt&&he&&N.editor.setTheme(ye)},[ye,he]),Object(Y.useEffect)(function(){var Dt=nt.current.instance;Dt&&he&&(Dt.updateOptions(Object(ie.a)({},Ee)),setTimeout(function(){Dt.getModel().updateOptions(Object(ie.a)({},Ee))},200))},[JSON.stringify(Ee),he]),Object(Y.useEffect)(function(){var Dt=nt.current.instance;Dt&&he&&Dt.layout()},[j,ae,he]);var Jn=Object(Y.useState)(l(j)),Sn=Object(H.a)(Jn,2),pi=Sn[0],gi=Sn[1],xi=Object(Y.useState)(l(ae)),_i=Object(H.a)(xi,2),Dn=_i[0],Ai=_i[1],Ln=Object(ie.a)(Object(ie.a)({},xe),{},{width:pi,height:Dn});return X.a.createElement("div",{className:"my-monaco-editor",ref:bt,style:Ln})};function K(I){var x=I.width,j=x===void 0?"100%":x,$=I.height,ae=$===void 0?"100%":$,fe=I.original,pe=I.modified,Ce=I.language,De=I.options,xe=De===void 0?{}:De,Oe=Object(Y.useRef)(),Ee=Object(Y.useState)(null),be=Object(H.a)(Ee,2),te=be[0],me=be[1];function ye(ze){var ot;return Oe.current&&(ot=new k.default(function(Et){var _t=Object(ee.a)(Et),mt;try{for(_t.s();!(mt=_t.n()).done;){var ut=mt.value;(ut.target.offsetHeight>0||ut.target.offsetWidth>0)&&ze.layout()}}catch(Xt){_t.e(Xt)}finally{_t.f()}}),ot.observe(Oe.current)),ot}Object(Y.useEffect)(function(){Oe.current&&V.e(27).then(V.t.bind(null,"M/lh",7)).then(function(ze){N=ze;var ot=N.editor.createDiffEditor(Oe.current,Object(ie.a)(Object(ie.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},xe),{},{wordWrap:!0}));me(ot);var Et=ye(ot);return function(){ot.dispose();var _t=ot.getModel();_t&&_t.dispose(),Et.unobserve(Oe.current)}})},[]),Object(Y.useEffect)(function(){te&&te.setModel({original:N.editor.createModel(fe,Ce),modified:N.editor.createModel(pe,Ce)})},[fe,pe,Ce,te]);var Le=l(j),$e=l(ae),Me={width:Le,height:$e};return X.a.createElement("div",{className:"my-diff-editor",ref:Oe,style:Me})}},ZpRC:function(zt,st,V){"use strict";function ie(v){return typeof v=="object"&&v!=null&&v.nodeType===1}function Z(v,_){return(!_||v!=="hidden")&&v!=="visible"&&v!=="clip"}function U(v,_){if(v.clientHeight<v.scrollHeight||v.clientWidth<v.scrollWidth){var p=getComputedStyle(v,null);return Z(p.overflowY,_)||Z(p.overflowX,_)||function(o){var u=function(r){if(!r.ownerDocument||!r.ownerDocument.defaultView)return null;try{return r.ownerDocument.defaultView.frameElement}catch(i){return null}}(o);return!!u&&(u.clientHeight<o.scrollHeight||u.clientWidth<o.scrollWidth)}(v)}return!1}function ee(v,_,p,o,u,r,i,t){return r<v&&i>_||r>v&&i<_?0:r<=v&&t<=p||i>=_&&t>=p?r-v-o:i>_&&t<p||r<v&&t>p?i-_+u:0}var H=function(v,_){var p=window,o=_.scrollMode,u=_.block,r=_.inline,i=_.boundary,t=_.skipOverflowHiddenElements,c=typeof i=="function"?i:function(ot){return ot!==i};if(!ie(v))throw new TypeError("Invalid target");for(var f=document.scrollingElement||document.documentElement,A=[],S=v;ie(S)&&c(S);){if((S=S.parentElement)===f){A.push(S);break}S!=null&&S===document.body&&U(S)&&!U(document.documentElement)||S!=null&&U(S,t)&&A.push(S)}for(var w=p.visualViewport?p.visualViewport.width:innerWidth,R=p.visualViewport?p.visualViewport.height:innerHeight,O=window.scrollX||pageXOffset,E=window.scrollY||pageYOffset,y=v.getBoundingClientRect(),d=y.height,l=y.width,h=y.top,g=y.right,b=y.bottom,F=y.left,N=u==="start"||u==="nearest"?h:u==="end"?b:h+d/2,W=r==="center"?F+l/2:r==="end"?g:F,K=[],I=0;I<A.length;I++){var x=A[I],j=x.getBoundingClientRect(),$=j.height,ae=j.width,fe=j.top,pe=j.right,Ce=j.bottom,De=j.left;if(o==="if-needed"&&h>=0&&F>=0&&b<=R&&g<=w&&h>=fe&&b<=Ce&&F>=De&&g<=pe)return K;var xe=getComputedStyle(x),Oe=parseInt(xe.borderLeftWidth,10),Ee=parseInt(xe.borderTopWidth,10),be=parseInt(xe.borderRightWidth,10),te=parseInt(xe.borderBottomWidth,10),me=0,ye=0,Le="offsetWidth"in x?x.offsetWidth-x.clientWidth-Oe-be:0,$e="offsetHeight"in x?x.offsetHeight-x.clientHeight-Ee-te:0;if(f===x)me=u==="start"?N:u==="end"?N-R:u==="nearest"?ee(E,E+R,R,Ee,te,E+N,E+N+d,d):N-R/2,ye=r==="start"?W:r==="center"?W-w/2:r==="end"?W-w:ee(O,O+w,w,Oe,be,O+W,O+W+l,l),me=Math.max(0,me+E),ye=Math.max(0,ye+O);else{me=u==="start"?N-fe-Ee:u==="end"?N-Ce+te+$e:u==="nearest"?ee(fe,Ce,$,Ee,te+$e,N,N+d,d):N-(fe+$/2)+$e/2,ye=r==="start"?W-De-Oe:r==="center"?W-(De+ae/2)+Le/2:r==="end"?W-pe+be+Le:ee(De,pe,ae,Oe,be+Le,W,W+l,l);var Me=x.scrollLeft,ze=x.scrollTop;N+=ze-(me=Math.max(0,Math.min(ze+me,x.scrollHeight-$+$e))),W+=Me-(ye=Math.max(0,Math.min(Me+ye,x.scrollWidth-ae+Le)))}K.push({el:x,top:me,left:ye})}return K};function M(v){return v===Object(v)&&Object.keys(v).length!==0}function Y(v,_){_===void 0&&(_="auto");var p="scrollBehavior"in document.body.style;v.forEach(function(o){var u=o.el,r=o.top,i=o.left;u.scroll&&p?u.scroll({top:r,left:i,behavior:_}):(u.scrollTop=r,u.scrollLeft=i)})}function X(v){return v===!1?{block:"end",inline:"nearest"}:M(v)?v:{block:"start",inline:"nearest"}}function k(v,_){var p=!v.ownerDocument.documentElement.contains(v);if(M(_)&&typeof _.behavior=="function")return _.behavior(p?[]:H(v,_));if(p)return;var o=X(_);return Y(H(v,o),o.behavior)}var D=st.a=k},Zss7:function(zt,st,V){var ie;(function(Z){var U=/^\s+/,ee=/\s+$/,H=0,M=Z.round,Y=Z.min,X=Z.max,k=Z.random;function D(te,me){if(te=te||"",me=me||{},te instanceof D)return te;if(!(this instanceof D))return new D(te,me);var ye=v(te);this._originalInput=te,this._r=ye.r,this._g=ye.g,this._b=ye.b,this._a=ye.a,this._roundA=M(100*this._a)/100,this._format=me.format||ye.format,this._gradientType=me.gradientType,this._r<1&&(this._r=M(this._r)),this._g<1&&(this._g=M(this._g)),this._b<1&&(this._b=M(this._b)),this._ok=ye.ok,this._tc_id=H++}D.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var te=this.toRgb();return(te.r*299+te.g*587+te.b*114)/1e3},getLuminance:function(){var te=this.toRgb(),me,ye,Le,$e,Me,ze;return me=te.r/255,ye=te.g/255,Le=te.b/255,me<=.03928?$e=me/12.92:$e=Z.pow((me+.055)/1.055,2.4),ye<=.03928?Me=ye/12.92:Me=Z.pow((ye+.055)/1.055,2.4),Le<=.03928?ze=Le/12.92:ze=Z.pow((Le+.055)/1.055,2.4),.2126*$e+.7152*Me+.0722*ze},setAlpha:function(te){return this._a=K(te),this._roundA=M(100*this._a)/100,this},toHsv:function(){var te=u(this._r,this._g,this._b);return{h:te.h*360,s:te.s,v:te.v,a:this._a}},toHsvString:function(){var te=u(this._r,this._g,this._b),me=M(te.h*360),ye=M(te.s*100),Le=M(te.v*100);return this._a==1?"hsv("+me+", "+ye+"%, "+Le+"%)":"hsva("+me+", "+ye+"%, "+Le+"%, "+this._roundA+")"},toHsl:function(){var te=p(this._r,this._g,this._b);return{h:te.h*360,s:te.s,l:te.l,a:this._a}},toHslString:function(){var te=p(this._r,this._g,this._b),me=M(te.h*360),ye=M(te.s*100),Le=M(te.l*100);return this._a==1?"hsl("+me+", "+ye+"%, "+Le+"%)":"hsla("+me+", "+ye+"%, "+Le+"%, "+this._roundA+")"},toHex:function(te){return i(this._r,this._g,this._b,te)},toHexString:function(te){return"#"+this.toHex(te)},toHex8:function(te){return t(this._r,this._g,this._b,this._a,te)},toHex8String:function(te){return"#"+this.toHex8(te)},toRgb:function(){return{r:M(this._r),g:M(this._g),b:M(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+M(this._r)+", "+M(this._g)+", "+M(this._b)+")":"rgba("+M(this._r)+", "+M(this._g)+", "+M(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:M(I(this._r,255)*100)+"%",g:M(I(this._g,255)*100)+"%",b:M(I(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+M(I(this._r,255)*100)+"%, "+M(I(this._g,255)*100)+"%, "+M(I(this._b,255)*100)+"%)":"rgba("+M(I(this._r,255)*100)+"%, "+M(I(this._g,255)*100)+"%, "+M(I(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:N[i(this._r,this._g,this._b,!0)]||!1},toFilter:function(te){var me="#"+c(this._r,this._g,this._b,this._a),ye=me,Le=this._gradientType?"GradientType = 1, ":"";if(te){var $e=D(te);ye="#"+c($e._r,$e._g,$e._b,$e._a)}return"progid:DXImageTransform.Microsoft.gradient("+Le+"startColorstr="+me+",endColorstr="+ye+")"},toString:function(te){var me=!!te;te=te||this._format;var ye=!1,Le=this._a<1&&this._a>=0,$e=!me&&Le&&(te==="hex"||te==="hex6"||te==="hex3"||te==="hex4"||te==="hex8"||te==="name");return $e?te==="name"&&this._a===0?this.toName():this.toRgbString():(te==="rgb"&&(ye=this.toRgbString()),te==="prgb"&&(ye=this.toPercentageRgbString()),(te==="hex"||te==="hex6")&&(ye=this.toHexString()),te==="hex3"&&(ye=this.toHexString(!0)),te==="hex4"&&(ye=this.toHex8String(!0)),te==="hex8"&&(ye=this.toHex8String()),te==="name"&&(ye=this.toName()),te==="hsl"&&(ye=this.toHslString()),te==="hsv"&&(ye=this.toHsvString()),ye||this.toHexString())},clone:function(){return D(this.toString())},_applyModification:function(te,me){var ye=te.apply(null,[this].concat([].slice.call(me)));return this._r=ye._r,this._g=ye._g,this._b=ye._b,this.setAlpha(ye._a),this},lighten:function(){return this._applyModification(w,arguments)},brighten:function(){return this._applyModification(R,arguments)},darken:function(){return this._applyModification(O,arguments)},desaturate:function(){return this._applyModification(f,arguments)},saturate:function(){return this._applyModification(A,arguments)},greyscale:function(){return this._applyModification(S,arguments)},spin:function(){return this._applyModification(E,arguments)},_applyCombination:function(te,me){return te.apply(null,[this].concat([].slice.call(me)))},analogous:function(){return this._applyCombination(g,arguments)},complement:function(){return this._applyCombination(y,arguments)},monochromatic:function(){return this._applyCombination(b,arguments)},splitcomplement:function(){return this._applyCombination(h,arguments)},triad:function(){return this._applyCombination(d,arguments)},tetrad:function(){return this._applyCombination(l,arguments)}},D.fromRatio=function(te,me){if(typeof te=="object"){var ye={};for(var Le in te)te.hasOwnProperty(Le)&&(Le==="a"?ye[Le]=te[Le]:ye[Le]=pe(te[Le]));te=ye}return D(te,me)};function v(te){var me={r:0,g:0,b:0},ye=1,Le=null,$e=null,Me=null,ze=!1,ot=!1;return typeof te=="string"&&(te=Ee(te)),typeof te=="object"&&(Oe(te.r)&&Oe(te.g)&&Oe(te.b)?(me=_(te.r,te.g,te.b),ze=!0,ot=String(te.r).substr(-1)==="%"?"prgb":"rgb"):Oe(te.h)&&Oe(te.s)&&Oe(te.v)?(Le=pe(te.s),$e=pe(te.v),me=r(te.h,Le,$e),ze=!0,ot="hsv"):Oe(te.h)&&Oe(te.s)&&Oe(te.l)&&(Le=pe(te.s),Me=pe(te.l),me=o(te.h,Le,Me),ze=!0,ot="hsl"),te.hasOwnProperty("a")&&(ye=te.a)),ye=K(ye),{ok:ze,format:te.format||ot,r:Y(255,X(me.r,0)),g:Y(255,X(me.g,0)),b:Y(255,X(me.b,0)),a:ye}}function _(te,me,ye){return{r:I(te,255)*255,g:I(me,255)*255,b:I(ye,255)*255}}function p(te,me,ye){te=I(te,255),me=I(me,255),ye=I(ye,255);var Le=X(te,me,ye),$e=Y(te,me,ye),Me,ze,ot=(Le+$e)/2;if(Le==$e)Me=ze=0;else{var Et=Le-$e;ze=ot>.5?Et/(2-Le-$e):Et/(Le+$e);switch(Le){case te:Me=(me-ye)/Et+(me<ye?6:0);break;case me:Me=(ye-te)/Et+2;break;case ye:Me=(te-me)/Et+4;break}Me/=6}return{h:Me,s:ze,l:ot}}function o(te,me,ye){var Le,$e,Me;te=I(te,360),me=I(me,100),ye=I(ye,100);function ze(_t,mt,ut){return ut<0&&(ut+=1),ut>1&&(ut-=1),ut<1/6?_t+(mt-_t)*6*ut:ut<1/2?mt:ut<2/3?_t+(mt-_t)*(2/3-ut)*6:_t}if(me===0)Le=$e=Me=ye;else{var ot=ye<.5?ye*(1+me):ye+me-ye*me,Et=2*ye-ot;Le=ze(Et,ot,te+1/3),$e=ze(Et,ot,te),Me=ze(Et,ot,te-1/3)}return{r:Le*255,g:$e*255,b:Me*255}}function u(te,me,ye){te=I(te,255),me=I(me,255),ye=I(ye,255);var Le=X(te,me,ye),$e=Y(te,me,ye),Me,ze,ot=Le,Et=Le-$e;if(ze=Le===0?0:Et/Le,Le==$e)Me=0;else{switch(Le){case te:Me=(me-ye)/Et+(me<ye?6:0);break;case me:Me=(ye-te)/Et+2;break;case ye:Me=(te-me)/Et+4;break}Me/=6}return{h:Me,s:ze,v:ot}}function r(te,me,ye){te=I(te,360)*6,me=I(me,100),ye=I(ye,100);var Le=Z.floor(te),$e=te-Le,Me=ye*(1-me),ze=ye*(1-$e*me),ot=ye*(1-(1-$e)*me),Et=Le%6,_t=[ye,ze,Me,Me,ot,ye][Et],mt=[ot,ye,ye,ze,Me,Me][Et],ut=[Me,Me,ot,ye,ye,ze][Et];return{r:_t*255,g:mt*255,b:ut*255}}function i(te,me,ye,Le){var $e=[fe(M(te).toString(16)),fe(M(me).toString(16)),fe(M(ye).toString(16))];return Le&&$e[0].charAt(0)==$e[0].charAt(1)&&$e[1].charAt(0)==$e[1].charAt(1)&&$e[2].charAt(0)==$e[2].charAt(1)?$e[0].charAt(0)+$e[1].charAt(0)+$e[2].charAt(0):$e.join("")}function t(te,me,ye,Le,$e){var Me=[fe(M(te).toString(16)),fe(M(me).toString(16)),fe(M(ye).toString(16)),fe(Ce(Le))];return $e&&Me[0].charAt(0)==Me[0].charAt(1)&&Me[1].charAt(0)==Me[1].charAt(1)&&Me[2].charAt(0)==Me[2].charAt(1)&&Me[3].charAt(0)==Me[3].charAt(1)?Me[0].charAt(0)+Me[1].charAt(0)+Me[2].charAt(0)+Me[3].charAt(0):Me.join("")}function c(te,me,ye,Le){var $e=[fe(Ce(Le)),fe(M(te).toString(16)),fe(M(me).toString(16)),fe(M(ye).toString(16))];return $e.join("")}D.equals=function(te,me){return!te||!me?!1:D(te).toRgbString()==D(me).toRgbString()},D.random=function(){return D.fromRatio({r:k(),g:k(),b:k()})};function f(te,me){me=me===0?0:me||10;var ye=D(te).toHsl();return ye.s-=me/100,ye.s=x(ye.s),D(ye)}function A(te,me){me=me===0?0:me||10;var ye=D(te).toHsl();return ye.s+=me/100,ye.s=x(ye.s),D(ye)}function S(te){return D(te).desaturate(100)}function w(te,me){me=me===0?0:me||10;var ye=D(te).toHsl();return ye.l+=me/100,ye.l=x(ye.l),D(ye)}function R(te,me){me=me===0?0:me||10;var ye=D(te).toRgb();return ye.r=X(0,Y(255,ye.r-M(255*-(me/100)))),ye.g=X(0,Y(255,ye.g-M(255*-(me/100)))),ye.b=X(0,Y(255,ye.b-M(255*-(me/100)))),D(ye)}function O(te,me){me=me===0?0:me||10;var ye=D(te).toHsl();return ye.l-=me/100,ye.l=x(ye.l),D(ye)}function E(te,me){var ye=D(te).toHsl(),Le=(ye.h+me)%360;return ye.h=Le<0?360+Le:Le,D(ye)}function y(te){var me=D(te).toHsl();return me.h=(me.h+180)%360,D(me)}function d(te){var me=D(te).toHsl(),ye=me.h;return[D(te),D({h:(ye+120)%360,s:me.s,l:me.l}),D({h:(ye+240)%360,s:me.s,l:me.l})]}function l(te){var me=D(te).toHsl(),ye=me.h;return[D(te),D({h:(ye+90)%360,s:me.s,l:me.l}),D({h:(ye+180)%360,s:me.s,l:me.l}),D({h:(ye+270)%360,s:me.s,l:me.l})]}function h(te){var me=D(te).toHsl(),ye=me.h;return[D(te),D({h:(ye+72)%360,s:me.s,l:me.l}),D({h:(ye+216)%360,s:me.s,l:me.l})]}function g(te,me,ye){me=me||6,ye=ye||30;var Le=D(te).toHsl(),$e=360/ye,Me=[D(te)];for(Le.h=(Le.h-($e*me>>1)+720)%360;--me;)Le.h=(Le.h+$e)%360,Me.push(D(Le));return Me}function b(te,me){me=me||6;for(var ye=D(te).toHsv(),Le=ye.h,$e=ye.s,Me=ye.v,ze=[],ot=1/me;me--;)ze.push(D({h:Le,s:$e,v:Me})),Me=(Me+ot)%1;return ze}D.mix=function(te,me,ye){ye=ye===0?0:ye||50;var Le=D(te).toRgb(),$e=D(me).toRgb(),Me=ye/100,ze={r:($e.r-Le.r)*Me+Le.r,g:($e.g-Le.g)*Me+Le.g,b:($e.b-Le.b)*Me+Le.b,a:($e.a-Le.a)*Me+Le.a};return D(ze)},D.readability=function(te,me){var ye=D(te),Le=D(me);return(Z.max(ye.getLuminance(),Le.getLuminance())+.05)/(Z.min(ye.getLuminance(),Le.getLuminance())+.05)},D.isReadable=function(te,me,ye){var Le=D.readability(te,me),$e,Me;Me=!1,$e=be(ye);switch($e.level+$e.size){case"AAsmall":case"AAAlarge":Me=Le>=4.5;break;case"AAlarge":Me=Le>=3;break;case"AAAsmall":Me=Le>=7;break}return Me},D.mostReadable=function(te,me,ye){var Le=null,$e=0,Me,ze,ot,Et;ye=ye||{},ze=ye.includeFallbackColors,ot=ye.level,Et=ye.size;for(var _t=0;_t<me.length;_t++)Me=D.readability(te,me[_t]),Me>$e&&($e=Me,Le=D(me[_t]));return D.isReadable(te,Le,{level:ot,size:Et})||!ze?Le:(ye.includeFallbackColors=!1,D.mostReadable(te,["#fff","#000"],ye))};var F=D.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},N=D.hexNames=W(F);function W(te){var me={};for(var ye in te)te.hasOwnProperty(ye)&&(me[te[ye]]=ye);return me}function K(te){return te=parseFloat(te),(isNaN(te)||te<0||te>1)&&(te=1),te}function I(te,me){$(te)&&(te="100%");var ye=ae(te);return te=Y(me,X(0,parseFloat(te))),ye&&(te=parseInt(te*me,10)/100),Z.abs(te-me)<1e-6?1:te%me/parseFloat(me)}function x(te){return Y(1,X(0,te))}function j(te){return parseInt(te,16)}function $(te){return typeof te=="string"&&te.indexOf(".")!=-1&&parseFloat(te)===1}function ae(te){return typeof te=="string"&&te.indexOf("%")!=-1}function fe(te){return te.length==1?"0"+te:""+te}function pe(te){return te<=1&&(te=te*100+"%"),te}function Ce(te){return Z.round(parseFloat(te)*255).toString(16)}function De(te){return j(te)/255}var xe=function(){var te="[-\\+]?\\d+%?",me="[-\\+]?\\d*\\.\\d+%?",ye="(?:"+me+")|(?:"+te+")",Le="[\\s|\\(]+("+ye+")[,|\\s]+("+ye+")[,|\\s]+("+ye+")\\s*\\)?",$e="[\\s|\\(]+("+ye+")[,|\\s]+("+ye+")[,|\\s]+("+ye+")[,|\\s]+("+ye+")\\s*\\)?";return{CSS_UNIT:new RegExp(ye),rgb:new RegExp("rgb"+Le),rgba:new RegExp("rgba"+$e),hsl:new RegExp("hsl"+Le),hsla:new RegExp("hsla"+$e),hsv:new RegExp("hsv"+Le),hsva:new RegExp("hsva"+$e),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Oe(te){return!!xe.CSS_UNIT.exec(te)}function Ee(te){te=te.replace(U,"").replace(ee,"").toLowerCase();var me=!1;if(F[te])te=F[te],me=!0;else if(te=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var ye;return(ye=xe.rgb.exec(te))?{r:ye[1],g:ye[2],b:ye[3]}:(ye=xe.rgba.exec(te))?{r:ye[1],g:ye[2],b:ye[3],a:ye[4]}:(ye=xe.hsl.exec(te))?{h:ye[1],s:ye[2],l:ye[3]}:(ye=xe.hsla.exec(te))?{h:ye[1],s:ye[2],l:ye[3],a:ye[4]}:(ye=xe.hsv.exec(te))?{h:ye[1],s:ye[2],v:ye[3]}:(ye=xe.hsva.exec(te))?{h:ye[1],s:ye[2],v:ye[3],a:ye[4]}:(ye=xe.hex8.exec(te))?{r:j(ye[1]),g:j(ye[2]),b:j(ye[3]),a:De(ye[4]),format:me?"name":"hex8"}:(ye=xe.hex6.exec(te))?{r:j(ye[1]),g:j(ye[2]),b:j(ye[3]),format:me?"name":"hex"}:(ye=xe.hex4.exec(te))?{r:j(ye[1]+""+ye[1]),g:j(ye[2]+""+ye[2]),b:j(ye[3]+""+ye[3]),a:De(ye[4]+""+ye[4]),format:me?"name":"hex8"}:(ye=xe.hex3.exec(te))?{r:j(ye[1]+""+ye[1]),g:j(ye[2]+""+ye[2]),b:j(ye[3]+""+ye[3]),format:me?"name":"hex"}:!1}function be(te){var me,ye;return te=te||{level:"AA",size:"small"},me=(te.level||"AA").toUpperCase(),ye=(te.size||"small").toLowerCase(),me!=="AA"&&me!=="AAA"&&(me="AA"),ye!=="small"&&ye!=="large"&&(ye="small"),{level:me,size:ye}}zt.exports?zt.exports=D:!(ie=function(){return D}.call(st,V,st,zt),ie!==void 0&&(zt.exports=ie))})(Math)},"a+yL":function(zt,st,V){zt.exports={search:"search___t0h96",btn:"btn___t2oDx"}},bT9E:function(zt,st,V){"use strict";V.d(st,"a",function(){return Z});var ie=V("VTBJ");function Z(U,ee){var H=Object(ie.a)({},U);return Array.isArray(ee)&&ee.forEach(function(M){delete H[M]}),H}},biw7:function(zt,st,V){"use strict";var ie=V("q1tI"),Z=V.n(ie),U=ie.createContext(null);st.a=U},c5Ni:function(zt,st,V){},dejd:function(zt,st,V){},dmUQ:function(zt,st,V){"use strict";var ie=V("Ff2n"),Z=V("rePB"),U=V("1OyB"),ee=V("vuIU"),H=V("Ji7U"),M=V("md7G"),Y=V("foSv"),X=V("q1tI"),k=V.n(X),D=V("TSYQ"),v=V.n(D),_=V("4IlW");function p(d,l){var h=Object.keys(d);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(d);l&&(g=g.filter(function(b){return Object.getOwnPropertyDescriptor(d,b).enumerable})),h.push.apply(h,g)}return h}function o(d){for(var l=1;l<arguments.length;l++){var h=arguments[l]!=null?arguments[l]:{};l%2?p(Object(h),!0).forEach(function(g){Object(Z.a)(d,g,h[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(h)):p(Object(h)).forEach(function(g){Object.defineProperty(d,g,Object.getOwnPropertyDescriptor(h,g))})}return d}function u(d){var l=r();return function(){var g=Object(Y.a)(d),b;if(l){var F=Object(Y.a)(this).constructor;b=Reflect.construct(g,arguments,F)}else b=g.apply(this,arguments);return Object(M.a)(this,b)}}function r(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(d){return!1}}function i(){}function t(d){d.preventDefault()}var c=function(l){return l.replace(/[^\w.-]+/g,"")},f=200,A=600,S=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,w=function(l){return l!=null},R=function(l,h){return h===l||typeof h=="number"&&typeof l=="number"&&isNaN(h)&&isNaN(l)},O=function(d){Object(H.a)(h,d);var l=u(h);function h(g){var b;Object(U.a)(this,h),b=l.call(this,g),b.onKeyDown=function(W){var K=b.props,I=K.onKeyDown,x=K.onPressEnter;if(W.keyCode===_.a.UP){var j=b.getRatio(W);b.up(W,j,null),b.stop()}else if(W.keyCode===_.a.DOWN){var $=b.getRatio(W);b.down(W,$,null),b.stop()}else W.keyCode===_.a.ENTER&&x&&x(W);if(b.recordCursorPosition(),b.lastKeyCode=W.keyCode,I){for(var ae=arguments.length,fe=new Array(ae>1?ae-1:0),pe=1;pe<ae;pe++)fe[pe-1]=arguments[pe];I.apply(void 0,[W].concat(fe))}},b.onKeyUp=function(W){var K=b.props.onKeyUp;if(b.stop(),b.recordCursorPosition(),K){for(var I=arguments.length,x=new Array(I>1?I-1:0),j=1;j<I;j++)x[j-1]=arguments[j];K.apply(void 0,[W].concat(x))}},b.onChange=function(W){var K=b.props.onChange;b.state.focused&&(b.inputting=!0),b.rawInput=b.props.parser(b.getValueFromEvent(W)),b.setState({inputValue:b.rawInput}),K(b.toNumber(b.rawInput))},b.onMouseUp=function(){var W=b.props.onMouseUp;b.recordCursorPosition(),W&&W.apply(void 0,arguments)},b.onFocus=function(){var W;b.setState({focused:!0}),(W=b.props).onFocus.apply(W,arguments)},b.onBlur=function(){var W=b.props.onBlur;b.inputting=!1,b.setState({focused:!1});var K=b.getCurrentValidValue(b.state.inputValue),I=b.setValue(K,i);if(W){var x=b.input.value,j=b.getInputDisplayValue({focus:!1,value:I});b.input.value=j&&Number(j),W.apply(void 0,arguments),b.input.value=x}},b.getRatio=function(W){var K=1;return W.metaKey||W.ctrlKey?K=.1:W.shiftKey&&(K=10),K},b.getFullNum=function(W){return isNaN(W)?W:/e/i.test(String(W))?Number(W).toFixed(18).replace(/\.?0+$/,""):W},b.getPrecision=function(W){if(w(b.props.precision))return b.props.precision;var K=String(W);if(K.indexOf("e-")>=0)return parseInt(K.slice(K.indexOf("e-")+2),10);var I=0;return K.indexOf(".")>=0&&(I=K.length-K.indexOf(".")-1),I},b.getInputDisplayValue=function(W){var K=W||b.state,I=K.focused,x=K.inputValue,j=K.value,$;I?$=x:$=b.toPrecisionAsStep(j),$==null&&($="");var ae=b.formatWrapper($);return w(b.props.decimalSeparator)&&(ae=ae.toString().replace(".",b.props.decimalSeparator)),ae},b.recordCursorPosition=function(){try{b.cursorStart=b.input.selectionStart,b.cursorEnd=b.input.selectionEnd,b.currentValue=b.input.value,b.cursorBefore=b.input.value.substring(0,b.cursorStart),b.cursorAfter=b.input.value.substring(b.cursorEnd)}catch(W){}},b.restoreByAfter=function(W){if(W===void 0)return!1;var K=b.input.value,I=K.lastIndexOf(W);if(I===-1)return!1;var x=b.cursorBefore.length;return b.lastKeyCode===_.a.DELETE&&b.cursorBefore.charAt(x-1)===W[0]?(b.fixCaret(x,x),!0):I+W.length===K.length?(b.fixCaret(I,I),!0):!1},b.partRestoreByAfter=function(W){return W===void 0?!1:Array.prototype.some.call(W,function(K,I){var x=W.substring(I);return b.restoreByAfter(x)})},b.isNotCompleteNumber=function(W){return isNaN(W)||W===""||W===null||W&&W.toString().indexOf(".")===W.toString().length-1},b.stop=function(){b.autoStepTimer&&clearTimeout(b.autoStepTimer)},b.down=function(W,K,I){b.pressingUpOrDown=!0,b.step("down",W,K,I)},b.up=function(W,K,I){b.pressingUpOrDown=!0,b.step("up",W,K,I)},b.saveInput=function(W){b.input=W};var F=g.value;F===void 0&&(F=g.defaultValue),b.state={focused:g.autoFocus};var N=b.getValidValue(b.toNumber(F));return b.state=o(o({},b.state),{},{inputValue:b.toPrecisionAsStep(N),value:N}),b}return Object(ee.a)(h,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(b){var F=this.props,N=F.value,W=F.onChange,K=F.max,I=F.min,x=this.state.focused;if(b){if(!R(b.value,N)||!R(b.max,K)||!R(b.min,I)){var j=x?N:this.getValidValue(N),$;this.pressingUpOrDown?$=j:this.inputting?$=this.rawInput:$=this.toPrecisionAsStep(j),this.setState({value:j,inputValue:$})}var ae="value"in this.props?N:this.state.value;"max"in this.props&&b.max!==K&&typeof ae=="number"&&ae>K&&W&&W(K),"min"in this.props&&b.min!==I&&typeof ae=="number"&&ae<I&&W&&W(I)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var fe=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===_.a.BACKSPACE?fe=this.cursorStart-1:this.lastKeyCode===_.a.DELETE&&(fe=this.cursorStart):fe=this.input.value.length,this.fixCaret(fe,fe)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case _.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case _.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(pe){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(b){var F=b;return F===""?F="":this.isNotCompleteNumber(parseFloat(F))?F=this.state.value:F=this.getValidValue(F),this.toNumber(F)}},{key:"getValueFromEvent",value:function(b){var F=b.target.value.trim().replace(/。/g,".");return w(this.props.decimalSeparator)&&(F=F.replace(this.props.decimalSeparator,".")),F}},{key:"getValidValue",value:function(b){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,W=parseFloat(b);return isNaN(W)?b:(W<F&&(W=F),W>N&&(W=N),W)}},{key:"setValue",value:function(b,F){var N=this.props.precision,W=this.isNotCompleteNumber(parseFloat(b))?null:parseFloat(b),K=this.state.value,I=K===void 0?null:K,x=this.state.inputValue,j=x===void 0?null:x,$=typeof W=="number"?W.toFixed(N):"".concat(W),ae=W!==I||$!=="".concat(j);return"value"in this.props?(j=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:j},F)):this.setState({value:W,inputValue:this.toPrecisionAsStep(b)},F),ae&&this.props.onChange(W),W}},{key:"getMaxPrecision",value:function(b){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,N=this.props,W=N.precision,K=N.step;if(w(W))return W;var I=this.getPrecision(F),x=this.getPrecision(K),j=this.getPrecision(b);return b?Math.max(j,I+x):I+x}},{key:"getPrecisionFactor",value:function(b){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,N=this.getMaxPrecision(b,F);return Math.pow(10,N)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(b){return this.props.formatter?this.props.formatter(b):b}},{key:"toPrecisionAsStep",value:function(b){if(this.isNotCompleteNumber(b)||b==="")return b;var F=Math.abs(this.getMaxPrecision(b));return isNaN(F)?b.toString():Number(b).toFixed(F)}},{key:"toNumber",value:function(b){var F=this.props.precision,N=this.state.focused,W=b&&b.length>16&&N;return this.isNotCompleteNumber(b)||W?b:w(F)?Math.round(b*Math.pow(10,F))/Math.pow(10,F):Number(b)}},{key:"upStep",value:function(b,F){var N=this.props.step,W=this.getPrecisionFactor(b,F),K=Math.abs(this.getMaxPrecision(b,F)),I=((W*b+W*N*F)/W).toFixed(K);return this.toNumber(I)}},{key:"downStep",value:function(b,F){var N=this.props.step,W=this.getPrecisionFactor(b,F),K=Math.abs(this.getMaxPrecision(b,F)),I=((W*b-W*N*F)/W).toFixed(K);return this.toNumber(I)}},{key:"step",value:function(b,F){var N=this,W=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,K=arguments.length>3?arguments[3]:void 0;this.stop(),F&&(F.persist(),F.preventDefault());var I=this.props;if(I.disabled)return;var x=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(x))return;var j=this["".concat(b,"Step")](x,W),$=j>I.max||j<I.min;if(j>I.max?j=I.max:j<I.min&&(j=I.min),this.setValue(j,null),this.setState({focused:!0},function(){N.pressingUpOrDown=!1}),$)return;this.autoStepTimer=setTimeout(function(){N[b](F,W,!0)},K?f:A)}},{key:"fixCaret",value:function(b,F){if(b===void 0||F===void 0||!this.input||!this.input.value)return;try{var N=this.input.selectionStart,W=this.input.selectionEnd;(b!==N||F!==W)&&this.input.setSelectionRange(b,F)}catch(K){}}},{key:"render",value:function(){var b,F=this.props,N=F.prefixCls,W=F.disabled,K=F.readOnly,I=F.useTouch,x=F.autoComplete,j=F.upHandler,$=F.downHandler,ae=F.className,fe=F.max,pe=F.min,Ce=F.style,De=F.title,xe=F.onMouseEnter,Oe=F.onMouseLeave,Ee=F.onMouseOver,be=F.onMouseOut,te=F.required,me=F.onClick,ye=F.tabIndex,Le=F.type,$e=F.placeholder,Me=F.id,ze=F.inputMode,ot=F.pattern,Et=F.step,_t=F.maxLength,mt=F.autoFocus,ut=F.name,Xt=F.onPaste,en=F.onInput,sn=Object(ie.a)(F,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),pn=this.state,Un=pn.value,Cn=pn.focused,Qe=v()(N,(b={},Object(Z.a)(b,ae,!!ae),Object(Z.a)(b,"".concat(N,"-disabled"),W),Object(Z.a)(b,"".concat(N,"-focused"),Cn),b)),Ye={};Object.keys(sn).forEach(function(ve){(ve.substr(0,5)==="data-"||ve.substr(0,5)==="aria-"||ve==="role")&&(Ye[ve]=sn[ve])});var St=!K&&!W,bt=this.getInputDisplayValue(null),nt=(Un||Un===0)&&(isNaN(Un)||Number(Un)>=fe),vt=(Un||Un===0)&&(isNaN(Un)||Number(Un)<=pe),Ue=nt||W||K,Ae=vt||W||K,Re=v()("".concat(N,"-handler"),"".concat(N,"-handler-up"),Object(Z.a)({},"".concat(N,"-handler-up-disabled"),Ue)),le=v()("".concat(N,"-handler"),"".concat(N,"-handler-down"),Object(Z.a)({},"".concat(N,"-handler-down-disabled"),Ae)),he=I?{onTouchStart:Ue?i:this.up,onTouchEnd:this.stop}:{onMouseDown:Ue?i:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},Se=I?{onTouchStart:Ae?i:this.down,onTouchEnd:this.stop}:{onMouseDown:Ae?i:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return k.a.createElement("div",{className:Qe,style:Ce,title:De,onMouseEnter:xe,onMouseLeave:Oe,onMouseOver:Ee,onMouseOut:be,onFocus:function(){return null},onBlur:function(){return null}},k.a.createElement("div",{className:"".concat(N,"-handler-wrap")},k.a.createElement("span",Object.assign({unselectable:"on"},he,{role:"button","aria-label":"Increase Value","aria-disabled":Ue,className:Re}),j||k.a.createElement("span",{unselectable:"on",className:"".concat(N,"-handler-up-inner"),onClick:t})),k.a.createElement("span",Object.assign({unselectable:"on"},Se,{role:"button","aria-label":"Decrease Value","aria-disabled":Ae,className:le}),$||k.a.createElement("span",{unselectable:"on",className:"".concat(N,"-handler-down-inner"),onClick:t}))),k.a.createElement("div",{className:"".concat(N,"-input-wrap")},k.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":pe,"aria-valuemax":fe,"aria-valuenow":Un,required:te,type:Le,placeholder:$e,onPaste:Xt,onClick:me,onMouseUp:this.onMouseUp,className:"".concat(N,"-input"),tabIndex:ye,autoComplete:x,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:St?this.onKeyDown:i,onKeyUp:St?this.onKeyUp:i,autoFocus:mt,maxLength:_t,readOnly:K,disabled:W,max:fe,min:pe,step:Et,name:ut,title:De,id:Me,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(bt),pattern:ot,inputMode:ze,onInput:en},Ye))))}}]),h}(k.a.Component);O.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:S,min:-S,step:1,style:{},onChange:i,onKeyDown:i,onPressEnter:i,onFocus:i,onBlur:i,parser:c,required:!1,autoComplete:"off"};var E=O,y=st.a=E},fcSX:function(zt,st,V){"use strict";var ie=V("Ff2n"),Z=V("1OyB"),U=V("vuIU"),ee=V("Ji7U"),H=V("md7G"),M=V("foSv"),Y=V("1W/9"),X=V("q1tI"),k=V("rePB"),D=V("JX7q"),v=V("TSYQ"),_=V.n(v),p=V("qx4F"),o=V("4IlW");function u(W){return Array.isArray(W)?W:[W]}var r={transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend"},i=Object.keys(r).filter(function(W){if(typeof document=="undefined")return!1;var K=document.getElementsByTagName("html")[0];return W in(K?K.style:{})})[0],t=r[i];function c(W,K,I,x){W.addEventListener?W.addEventListener(K,I,x):W.attachEvent&&W.attachEvent("on".concat(K),I)}function f(W,K,I,x){W.removeEventListener?W.removeEventListener(K,I,x):W.attachEvent&&W.detachEvent("on".concat(K),I)}function A(W,K){var I=typeof W=="function"?W(K):W;return Array.isArray(I)?I.length===2?I:[I[0],I[1]]:[I]}var S=function(K){return!isNaN(parseFloat(K))&&isFinite(K)},w=!(typeof window!="undefined"&&window.document&&window.document.createElement),R=function W(K,I,x,j){if(!I||I===document||I instanceof Document)return!1;if(I===K.parentNode)return!0;var $=Math.max(Math.abs(x),Math.abs(j))===Math.abs(j),ae=Math.max(Math.abs(x),Math.abs(j))===Math.abs(x),fe=I.scrollHeight-I.clientHeight,pe=I.scrollWidth-I.clientWidth,Ce=document.defaultView.getComputedStyle(I),De=Ce.overflowY==="auto"||Ce.overflowY==="scroll",xe=Ce.overflowX==="auto"||Ce.overflowX==="scroll",Oe=fe&&De,Ee=pe&&xe;return $&&(!Oe||Oe&&(I.scrollTop>=fe&&j<0||I.scrollTop<=0&&j>0))||ae&&(!Ee||Ee&&(I.scrollLeft>=pe&&x<0||I.scrollLeft<=0&&x>0))?W(K,I.parentNode,x,j):!1};function O(W){var K=E();return function(){var x=Object(M.a)(W),j;if(K){var $=Object(M.a)(this).constructor;j=Reflect.construct(x,arguments,$)}else j=x.apply(this,arguments);return Object(H.a)(this,j)}}function E(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(W){return!1}}var y={},d=function(W){Object(ee.a)(I,W);var K=O(I);function I(x){var j;return Object(Z.a)(this,I),j=K.call(this,x),j.domFocus=function(){j.dom&&j.dom.focus()},j.removeStartHandler=function($){if($.touches.length>1)return;j.startPos={x:$.touches[0].clientX,y:$.touches[0].clientY}},j.removeMoveHandler=function($){if($.changedTouches.length>1)return;var ae=$.currentTarget,fe=$.changedTouches[0].clientX-j.startPos.x,pe=$.changedTouches[0].clientY-j.startPos.y;(ae===j.maskDom||ae===j.handlerDom||ae===j.contentDom&&R(ae,$.target,fe,pe))&&$.cancelable&&$.preventDefault()},j.transitionEnd=function($){var ae=$.target;f(ae,t,j.transitionEnd),ae.style.transition=""},j.onKeyDown=function($){if($.keyCode===o.a.ESC){var ae=j.props.onClose;$.stopPropagation(),ae&&ae($)}},j.onWrapperTransitionEnd=function($){var ae=j.props,fe=ae.open,pe=ae.afterVisibleChange;$.target===j.contentWrapper&&$.propertyName.match(/transform$/)&&(j.dom.style.transition="",!fe&&j.getCurrentDrawerSome()&&(document.body.style.overflowX="",j.maskDom&&(j.maskDom.style.left="",j.maskDom.style.width="")),pe&&pe(!!fe))},j.openLevelTransition=function(){var $=j.props,ae=$.open,fe=$.width,pe=$.height,Ce=j.getHorizontalBoolAndPlacementName(),De=Ce.isHorizontal,xe=Ce.placementName,Oe=j.contentDom?j.contentDom.getBoundingClientRect()[De?"width":"height"]:0,Ee=(De?fe:pe)||Oe;j.setLevelAndScrolling(ae,xe,Ee)},j.setLevelTransform=function($,ae,fe,pe){var Ce=j.props,De=Ce.placement,xe=Ce.levelMove,Oe=Ce.duration,Ee=Ce.ease,be=Ce.showMask;j.levelDom.forEach(function(te){te.style.transition="transform ".concat(Oe," ").concat(Ee),c(te,t,j.transitionEnd);var me=$?fe:0;if(xe){var ye=A(xe,{target:te,open:$});me=$?ye[0]:ye[1]||0}var Le=typeof me=="number"?"".concat(me,"px"):me,$e=De==="left"||De==="top"?Le:"-".concat(Le);$e=be&&De==="right"&&pe?"calc(".concat($e," + ").concat(pe,"px)"):$e,te.style.transform=me?"".concat(ae,"(").concat($e,")"):""})},j.setLevelAndScrolling=function($,ae,fe){var pe=j.props.onChange;if(!w){var Ce=document.body.scrollHeight>(window.innerHeight||document.documentElement.clientHeight)&&window.innerWidth>document.body.offsetWidth?Object(p.a)(!0):0;j.setLevelTransform($,ae,fe,Ce),j.toggleScrollingToDrawerAndBody(Ce)}pe&&pe($)},j.toggleScrollingToDrawerAndBody=function($){var ae=j.props,fe=ae.getOpenCount,pe=ae.getContainer,Ce=ae.showMask,De=ae.open,xe=pe&&pe(),Oe=fe&&fe();if(xe&&xe.parentNode===document.body&&Ce){var Ee=["touchstart"],be=[document.body,j.maskDom,j.handlerDom,j.contentDom];De&&document.body.style.overflow!=="hidden"?($&&j.addScrollingEffect($),Oe===1&&(document.body.style.overflow="hidden"),document.body.style.touchAction="none",be.forEach(function(te,me){if(!te)return;c(te,Ee[me]||"touchmove",me?j.removeMoveHandler:j.removeStartHandler,j.passive)})):j.getCurrentDrawerSome()&&(Oe||(document.body.style.overflow=""),document.body.style.touchAction="",$&&j.remScrollingEffect($),be.forEach(function(te,me){if(!te)return;f(te,Ee[me]||"touchmove",me?j.removeMoveHandler:j.removeStartHandler,j.passive)}))}},j.addScrollingEffect=function($){var ae=j.props,fe=ae.placement,pe=ae.duration,Ce=ae.ease,De=ae.getOpenCount,xe=ae.switchScrollingEffect,Oe=De&&De();Oe===1&&xe();var Ee="width ".concat(pe," ").concat(Ce),be="transform ".concat(pe," ").concat(Ce);j.dom.style.transition="none";switch(fe){case"right":j.dom.style.transform="translateX(-".concat($,"px)");break;case"top":case"bottom":j.dom.style.width="calc(100% - ".concat($,"px)"),j.dom.style.transform="translateZ(0)";break;default:break}clearTimeout(j.timeout),j.timeout=setTimeout(function(){j.dom&&(j.dom.style.transition="".concat(be,",").concat(Ee),j.dom.style.width="",j.dom.style.transform="")})},j.remScrollingEffect=function($){var ae=j.props,fe=ae.placement,pe=ae.duration,Ce=ae.ease,De=ae.getOpenCount,xe=ae.switchScrollingEffect,Oe=De&&De();Oe||xe(!0),i&&(document.body.style.overflowX="hidden"),j.dom.style.transition="none";var Ee,be="width ".concat(pe," ").concat(Ce),te="transform ".concat(pe," ").concat(Ce);switch(fe){case"left":{j.dom.style.width="100%",be="width 0s ".concat(Ce," ").concat(pe);break}case"right":{j.dom.style.transform="translateX(".concat($,"px)"),j.dom.style.width="100%",be="width 0s ".concat(Ce," ").concat(pe),j.maskDom&&(j.maskDom.style.left="-".concat($,"px"),j.maskDom.style.width="calc(100% + ".concat($,"px)"));break}case"top":case"bottom":{j.dom.style.width="calc(100% + ".concat($,"px)"),j.dom.style.height="100%",j.dom.style.transform="translateZ(0)",Ee="height 0s ".concat(Ce," ").concat(pe);break}default:break}clearTimeout(j.timeout),j.timeout=setTimeout(function(){j.dom&&(j.dom.style.transition="".concat(te,",").concat(Ee?"".concat(Ee,","):"").concat(be),j.dom.style.transform="",j.dom.style.width="",j.dom.style.height="")})},j.getCurrentDrawerSome=function(){return!Object.keys(y).some(function($){return y[$]})},j.getLevelDom=function($){var ae=$.level,fe=$.getContainer;if(w)return;var pe=fe&&fe(),Ce=pe?pe.parentNode:null;if(j.levelDom=[],ae==="all"){var De=Ce?Array.prototype.slice.call(Ce.children):[];De.forEach(function(xe){xe.nodeName!=="SCRIPT"&&xe.nodeName!=="STYLE"&&xe.nodeName!=="LINK"&&xe!==pe&&j.levelDom.push(xe)})}else ae&&u(ae).forEach(function(xe){document.querySelectorAll(xe).forEach(function(Oe){j.levelDom.push(Oe)})})},j.getHorizontalBoolAndPlacementName=function(){var $=j.props.placement,ae=$==="left"||$==="right",fe="translate".concat(ae?"X":"Y");return{isHorizontal:ae,placementName:fe}},j.state={_self:Object(D.a)(j)},j}return Object(U.a)(I,[{key:"componentDidMount",value:function(){var j=this;if(!w){var $=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){return $=!0,null}}))}catch(De){}this.passive=$?{passive:!1}:!1}var ae=this.props,fe=ae.open,pe=ae.getContainer,Ce=pe&&pe();this.drawerId="drawer_id_".concat(Number((Date.now()+Math.random()).toString().replace(".",Math.round(Math.random()*9).toString())).toString(16)),this.getLevelDom(this.props),fe&&(Ce&&Ce.parentNode===document.body&&(y[this.drawerId]=fe),this.openLevelTransition(),this.forceUpdate(function(){j.domFocus()}))}},{key:"componentDidUpdate",value:function(j){var $=this.props,ae=$.open,fe=$.getContainer,pe=fe&&fe();ae!==j.open&&(ae&&this.domFocus(),pe&&pe.parentNode===document.body&&(y[this.drawerId]=!!ae),this.openLevelTransition())}},{key:"componentWillUnmount",value:function(){var j=this.props,$=j.getOpenCount,ae=j.open,fe=j.switchScrollingEffect,pe=typeof $=="function"&&$();delete y[this.drawerId],ae&&(this.setLevelTransform(!1),document.body.style.touchAction=""),pe||(document.body.style.overflow="",fe(!0))}},{key:"render",value:function(){var j,$=this,ae=this.props,fe=ae.className,pe=ae.children,Ce=ae.style,De=ae.width,xe=ae.height,Oe=ae.defaultOpen,Ee=ae.open,be=ae.prefixCls,te=ae.placement,me=ae.level,ye=ae.levelMove,Le=ae.ease,$e=ae.duration,Me=ae.getContainer,ze=ae.handler,ot=ae.onChange,Et=ae.afterVisibleChange,_t=ae.showMask,mt=ae.maskClosable,ut=ae.maskStyle,Xt=ae.onClose,en=ae.onHandleClick,sn=ae.keyboard,pn=ae.getOpenCount,Un=ae.switchScrollingEffect,Cn=Object(ie.a)(ae,["className","children","style","width","height","defaultOpen","open","prefixCls","placement","level","levelMove","ease","duration","getContainer","handler","onChange","afterVisibleChange","showMask","maskClosable","maskStyle","onClose","onHandleClick","keyboard","getOpenCount","switchScrollingEffect"]),Qe=this.dom?Ee:!1,Ye=_()(be,(j={},Object(k.a)(j,"".concat(be,"-").concat(te),!0),Object(k.a)(j,"".concat(be,"-open"),Qe),Object(k.a)(j,fe||"",!!fe),Object(k.a)(j,"no-mask",!_t),j)),St=this.getHorizontalBoolAndPlacementName(),bt=St.placementName,nt=te==="left"||te==="top"?"-100%":"100%",vt=Qe?"":"".concat(bt,"(").concat(nt,")"),Ue=ze&&X.cloneElement(ze,{onClick:function(Re){ze.props.onClick&&ze.props.onClick(),en&&en(Re)},ref:function(Re){$.handlerDom=Re}});return X.createElement("div",Object.assign({},Cn,{tabIndex:-1,className:Ye,style:Ce,ref:function(Re){$.dom=Re},onKeyDown:Qe&&sn?this.onKeyDown:void 0,onTransitionEnd:this.onWrapperTransitionEnd}),_t&&X.createElement("div",{className:"".concat(be,"-mask"),onClick:mt?Xt:void 0,style:ut,ref:function(Re){$.maskDom=Re}}),X.createElement("div",{className:"".concat(be,"-content-wrapper"),style:{transform:vt,msTransform:vt,width:S(De)?"".concat(De,"px"):De,height:S(xe)?"".concat(xe,"px"):xe},ref:function(Re){$.contentWrapper=Re}},X.createElement("div",{className:"".concat(be,"-content"),ref:function(Re){$.contentDom=Re},onTouchStart:Qe&&_t?this.removeStartHandler:void 0,onTouchMove:Qe&&_t?this.removeMoveHandler:void 0},pe),Ue))}}],[{key:"getDerivedStateFromProps",value:function(j,$){var ae=$.prevProps,fe=$._self,pe={prevProps:j};if(ae!==void 0){var Ce=j.placement,De=j.level;Ce!==ae.placement&&(fe.contentDom=null),De!==ae.level&&fe.getLevelDom(j)}return pe}}]),I}(X.Component);d.defaultProps={switchScrollingEffect:function(){}};var l=d;function h(W){var K=g();return function(){var x=Object(M.a)(W),j;if(K){var $=Object(M.a)(this).constructor;j=Reflect.construct(x,arguments,$)}else j=x.apply(this,arguments);return Object(H.a)(this,j)}}function g(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(W){return!1}}var b=function(W){Object(ee.a)(I,W);var K=h(I);function I(x){var j;Object(Z.a)(this,I),j=K.call(this,x),j.onHandleClick=function(ae){var fe=j.props,pe=fe.onHandleClick,Ce=fe.open;if(pe&&pe(ae),typeof Ce=="undefined"){var De=j.state.open;j.setState({open:!De})}},j.onClose=function(ae){var fe=j.props,pe=fe.onClose,Ce=fe.open;pe&&pe(ae),typeof Ce=="undefined"&&j.setState({open:!1})};var $=typeof x.open!="undefined"?x.open:!!x.defaultOpen;return j.state={open:$},"onMaskClick"in x&&console.warn("`onMaskClick` are removed, please use `onClose` instead."),j}return Object(U.a)(I,[{key:"render",value:function(){var j=this,$=this.props,ae=$.defaultOpen,fe=$.getContainer,pe=$.wrapperClassName,Ce=$.forceRender,De=$.handler,xe=Object(ie.a)($,["defaultOpen","getContainer","wrapperClassName","forceRender","handler"]),Oe=this.state.open;if(!fe)return X.createElement("div",{className:pe,ref:function(te){j.dom=te}},X.createElement(l,Object.assign({},xe,{open:Oe,handler:De,getContainer:function(){return j.dom},onClose:this.onClose,onHandleClick:this.onHandleClick})));var Ee=!!De||Ce;return X.createElement(Y.a,{visible:Oe,forceRender:Ee,getContainer:fe,wrapperClassName:pe},function(be){var te=be.visible,me=be.afterClose,ye=Object(ie.a)(be,["visible","afterClose"]);return X.createElement(l,Object.assign({},xe,ye,{open:te!==void 0?te:Oe,afterVisibleChange:me!==void 0?me:xe.afterVisibleChange,handler:De,onClose:j.onClose,onHandleClick:j.onHandleClick}))})}}],[{key:"getDerivedStateFromProps",value:function(j,$){var ae=$.prevProps,fe={prevProps:j};return typeof ae!="undefined"&&j.open!==ae.open&&(fe.open=j.open),fe}}]),I}(X.Component);b.defaultProps={prefixCls:"drawer",placement:"left",getContainer:"body",defaultOpen:!1,level:"all",duration:".3s",ease:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",onChange:function(){},afterVisibleChange:function(){},handler:X.createElement("div",{className:"drawer-handle"},X.createElement("i",{className:"drawer-handle-icon"})),showMask:!0,maskClosable:!0,maskStyle:{},wrapperClassName:"",className:"",keyboard:!0,forceRender:!1};var F=b,N=st.a=F},fyJ8:function(zt,st,V){"use strict";var ie=V("rePB"),Z=V("VTBJ"),U=V("Ff2n"),ee=V("U8pU"),H=V("q1tI"),M=V.n(H),Y=V("TSYQ"),X=V.n(Y),k=V("c+Xe"),D=V("sR1s");function v(r){return r&&Object(ee.a)(r)==="object"&&!Array.isArray(r)&&!H.isValidElement(r)}function _(r){return typeof r=="string"?!0:Object(k.c)(r)}function p(r,i){var t,c=r.prefixCls,f=r.className,A=r.record,S=r.index,w=r.dataIndex,R=r.render,O=r.children,E=r.component,y=E===void 0?"td":E,d=r.colSpan,l=r.rowSpan,h=r.fixLeft,g=r.fixRight,b=r.firstFixLeft,F=r.lastFixLeft,N=r.firstFixRight,W=r.lastFixRight,K=r.appendNode,I=r.additionalProps,x=I===void 0?{}:I,j=r.ellipsis,$=r.align,ae=r.rowType,fe=r.isSticky,pe="".concat(c,"-cell"),Ce,De;if(O)De=O;else{var xe=Object(D.b)(A,w);if(De=xe,R){var Oe=R(xe,A,S);v(Oe)?(De=Oe.children,Ce=Oe.props):De=Oe}}Object(ee.a)(De)==="object"&&!Array.isArray(De)&&!H.isValidElement(De)&&(De=null),j&&(F||N)&&(De=H.createElement("span",{className:"".concat(pe,"-content")},De));var Ee=Ce||{},be=Ee.colSpan,te=Ee.rowSpan,me=Ee.style,ye=Ee.className,Le=Object(U.a)(Ee,["colSpan","rowSpan","style","className"]),$e=be!==void 0?be:d,Me=te!==void 0?te:l;if($e===0||Me===0)return null;var ze={},ot=typeof h=="number",Et=typeof g=="number";ot&&(ze.position="sticky",ze.left=h),Et&&(ze.position="sticky",ze.right=g);var _t={};$&&(_t.textAlign=$);var mt,ut=j===!0?{showTitle:!0}:j;ut&&(ut.showTitle||ae==="header")&&(typeof De=="string"||typeof De=="number"?mt=De.toString():H.isValidElement(De)&&typeof De.props.children=="string"&&(mt=De.props.children));var Xt=Object(Z.a)(Object(Z.a)(Object(Z.a)({title:mt},Le),x),{},{colSpan:$e&&$e!==1?$e:null,rowSpan:Me&&Me!==1?Me:null,className:X()(pe,f,(t={},Object(ie.a)(t,"".concat(pe,"-fix-left"),ot),Object(ie.a)(t,"".concat(pe,"-fix-left-first"),b),Object(ie.a)(t,"".concat(pe,"-fix-left-last"),F),Object(ie.a)(t,"".concat(pe,"-fix-right"),Et),Object(ie.a)(t,"".concat(pe,"-fix-right-first"),N),Object(ie.a)(t,"".concat(pe,"-fix-right-last"),W),Object(ie.a)(t,"".concat(pe,"-ellipsis"),j),Object(ie.a)(t,"".concat(pe,"-with-append"),K),Object(ie.a)(t,"".concat(pe,"-fix-sticky"),(ot||Et)&&fe),t),x.className,ye),style:Object(Z.a)(Object(Z.a)(Object(Z.a)(Object(Z.a)({},x.style),_t),ze),me),ref:_(y)?i:null});return H.createElement(y,Object.assign({},Xt),K,De)}var o=H.forwardRef(p);o.displayName="Cell";var u=H.memo(o,function(r,i){return i.shouldCellUpdate?!i.shouldCellUpdate(i.record,r.record):!1});st.a=u},gMzb:function(zt,st,V){"use strict";var ie=V("k1fw"),Z=V("oBTY"),U=V("9og8"),ee=V("tJVT"),H=V("sRBo"),M=V("kaz8"),Y=V("WmNS"),X=V.n(Y),k=V("q1tI"),D=V.n(k),v=V("9kvl"),_=V("wlus"),p=V("w5pM"),o=V("ErOA"),u=V("OaEy"),r=V("2fM7"),i=V("y8nQ"),t=V("Vl3Y"),c=V("Ty5D"),f=V("yQHh"),A=V.n(f),S=M.a.Group,w=function(l){var h,g,b,F,N,W,K,I,x=l.classroomList,j=l.loading,$=l.user,ae=l.exercise_id,fe=ae===void 0?null:ae,pe=l.homework_common_id,Ce=pe===void 0?null:pe,De=l.setitem,xe=l.item,Oe=l.type,Ee=l.rz,be=l.dispatch,te=Object(k.useState)([]),me=Object(ee.a)(te,2),ye=me[0],Le=me[1],$e=Object(k.useState)({zydatas:[],jbdatas:[],kcdatas:[],zsdatas:[],page:1,per_page:20}),Me=Object(ee.a)($e,2),ze=Me[0],ot=Me[1],Et=Object(c.i)(),_t=Object(k.useState)(!1),mt=Object(ee.a)(_t,2),ut=mt[0],Xt=mt[1],en=Object(k.useState)(!1),sn=Object(ee.a)(en,2),pn=sn[0],Un=sn[1],Cn=t.a.useForm(),Qe=Object(ee.a)(Cn,1),Ye=Qe[0];Object(k.useEffect)(function(){Ee&&(ze.zydatas=Ee,ot(Object(ie.a)({},ze)),xe!=null&&xe.ec_course_id&&St())},[xe,Ee]);function St(){return bt.apply(this,arguments)}function bt(){return bt=Object(U.a)(X.a.mark(function le(){return X.a.wrap(function(Se){for(;;)switch(Se.prev=Se.next){case 0:return console.log("----",xe),Se.next=3,nt(xe==null?void 0:xe.ec_major_school_id);case 3:return Se.next=5,Ue(xe==null?void 0:xe.ec_year_id);case 5:return Se.next=7,Re(xe==null?void 0:xe.ec_course_id);case 7:Ye.setFieldsValue({ec_course_id:xe==null?void 0:xe.ec_course_id,ec_major_school_id:xe==null?void 0:xe.ec_major_school_id,ec_point_ids:xe==null?void 0:xe.ec_point_ids,ec_year_id:xe==null?void 0:xe.ec_year_id});case 8:case"end":return Se.stop()}},le)})),bt.apply(this,arguments)}function nt(le){return vt.apply(this,arguments)}function vt(){return vt=Object(U.a)(X.a.mark(function le(he){var Se;return X.a.wrap(function(Pe){for(;;)switch(Pe.prev=Pe.next){case 0:return Pe.next=2,Object(o.a)("/api/ec_major_schools/".concat(he,"/ec_years/get_year_list.json"),{method:"get"});case 2:Se=Pe.sent,ze.jbdatas=Se==null?void 0:Se.data,ot(Object(ie.a)({},ze)),Ye.setFieldsValue({ec_year_id:"",ec_course_id:"",ec_point_ids:[]});case 6:case"end":return Pe.stop()}},le)})),vt.apply(this,arguments)}function Ue(le){return Ae.apply(this,arguments)}function Ae(){return Ae=Object(U.a)(X.a.mark(function le(he){var Se;return X.a.wrap(function(Pe){for(;;)switch(Pe.prev=Pe.next){case 0:return Pe.next=2,Object(o.a)("/api/ec_years/".concat(he,"/ec_courses/get_courses.json"),{method:"get"});case 2:Se=Pe.sent,ze.kcdatas=Se==null?void 0:Se.data,ot(Object(ie.a)({},ze)),Ye.setFieldsValue({ec_course_id:"",ec_point_ids:[]});case 6:case"end":return Pe.stop()}},le)})),Ae.apply(this,arguments)}var Re=function(){var le=Object(U.a)(X.a.mark(function he(Se){var ve;return X.a.wrap(function(it){for(;;)switch(it.prev=it.next){case 0:return it.next=2,Object(o.a)("/api/ec_courses/".concat(Se,"/ec_points.json"),{method:"get",params:{ec_course_id:Se}});case 2:ve=it.sent,ze.zsdatas=ve==null?void 0:ve.data,ot(Object(ie.a)({},ze));case 5:case"end":return it.stop()}},he)}));return function(Se){return le.apply(this,arguments)}}();return D.a.createElement("div",{className:A.a.from},D.a.createElement(t.a,{form:Ye,layout:"inline",onValuesChange:function(he){console.log("----",he),he.ec_major_school_id&&(ze.jbdatas=[],ze.kcdatas=[],ze.zsdatas=[],ot(Object(ie.a)({},ze)),nt(he.ec_major_school_id)),he.ec_year_id&&(ze.kcdatas=[],ze.zsdatas=[],ot(Object(ie.a)({},ze)),Ue(he.ec_year_id)),he.ec_course_id&&(ze.zsdatas=[],ot(Object(ie.a)({},ze)),Re(he.ec_course_id))},onFinish:function(){var le=Object(U.a)(X.a.mark(function he(Se){return X.a.wrap(function(Pe){for(;;)switch(Pe.prev=Pe.next){case 0:De(Se);case 1:case"end":return Pe.stop()}},he)}));return function(he){return le.apply(this,arguments)}}()},D.a.createElement(t.a.Item,{label:"\u8BA4\u8BC1\u4E13\u4E1A",name:"ec_major_school_id"},D.a.createElement(r.a,{style:{width:150},disabled:((h=ze.zydatas)===null||h===void 0?void 0:h.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u8BA4\u8BC1\u4E13\u4E1A"},ze==null||((g=ze.zydatas)===null||g===void 0)?void 0:g.map(function(le,he){return D.a.createElement(r.a.Option,{key:he,value:le==null?void 0:le.ec_major_school_id},le==null?void 0:le.name)}))),D.a.createElement(t.a.Item,{label:"\u8BA4\u8BC1\u5C4A\u522B",name:"ec_year_id"},D.a.createElement(r.a,{style:{width:150},disabled:((b=ze.jbdatas)===null||b===void 0?void 0:b.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u8BA4\u8BC1\u5C4A\u522B"},ze==null||((F=ze.jbdatas)===null||F===void 0)?void 0:F.map(function(le,he){return D.a.createElement(r.a.Option,{key:he,value:le==null?void 0:le.ec_year_id},le==null?void 0:le.year)}))),D.a.createElement(t.a.Item,{label:"\u8BFE\u7A0B",name:"ec_course_id"},D.a.createElement(r.a,{style:{width:150},disabled:((N=ze.kcdatas)===null||N===void 0?void 0:N.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u8BFE\u7A0B"},ze==null||((W=ze.kcdatas)===null||W===void 0)?void 0:W.map(function(le,he){return D.a.createElement(r.a.Option,{key:he,value:le==null?void 0:le.id},le==null?void 0:le.name)}))),D.a.createElement(t.a.Item,{label:"\u77E5\u8BC6\u70B9",name:"ec_point_ids"},D.a.createElement(r.a,{onChange:function(){Ye.submit()},style:{width:150},mode:"multiple",disabled:((K=ze.zsdatas)===null||K===void 0?void 0:K.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u77E5\u8BC6\u70B9"},ze==null||((I=ze.zsdatas)===null||I===void 0)?void 0:I.map(function(le,he){return D.a.createElement(r.a.Option,{key:he,value:le==null?void 0:le.id},le==null?void 0:le.name)})))))},R=Object(v.a)(function(d){var l=d.classroomList,h=d.loading,g=d.globalSetting,b=d.user;return{classroomList:l,globalSetting:g,loading:h.effects,user:b}})(w),O=M.a.Group,E=function(l){var h,g,b,F=l.classroomList,N=l.loading,W=l.user,K=l.exercise_id,I=K===void 0?null:K,x=l.homework_common_id,j=x===void 0?null:x,$=l.setitem,ae=l.type,fe=l.dispatch,pe=Object(k.useState)([{}]),Ce=Object(ee.a)(pe,2),De=Ce[0],xe=Ce[1],Oe=Object(k.useState)([]),Ee=Object(ee.a)(Oe,2),be=Ee[0],te=Ee[1];function me(){return ye.apply(this,arguments)}function ye(){return ye=Object(U.a)(X.a.mark(function Me(){var ze,ot,Et,_t,mt;return X.a.wrap(function(Xt){for(;;)switch(Xt.prev=Xt.next){case 0:return Xt.next=2,Object(o.a)("/api/ec_courses/".concat(0,"/ec_points/get_work_points.json"),{method:"get",params:{exercise_id:I,homework_common_id:j}});case 2:ot=Xt.sent,(ot==null||((ze=ot.data)===null||ze===void 0)?void 0:ze.length)>0&&(mt=[],ot==null||((Et=ot.data)===null||Et===void 0)||Et.map(function(en){var sn;en==null||((sn=en.ec_point_ids)===null||sn===void 0)||sn.map(function(pn){mt.push(pn)})}),$(Object(ie.a)(Object(ie.a)({},ot==null||((_t=ot.data)===null||_t===void 0)?void 0:_t[0]),{},{ec_point_ids:mt})),xe(ot==null?void 0:ot.data));case 4:case"end":return Xt.stop()}},Me)})),ye.apply(this,arguments)}Object(k.useEffect)(function(){var Me,ze;W!=null&&(Me=W.userInfo)!==null&&Me!==void 0&&(ze=Me.course)!==null&&ze!==void 0&&ze.course_school_id&&Le()},[W==null||((h=W.userInfo)===null||h===void 0||((g=h.course)===null||g===void 0))?void 0:g.course_school_id]);function Le(){return $e.apply(this,arguments)}function $e(){return $e=Object(U.a)(X.a.mark(function Me(){var ze,ot,Et;return X.a.wrap(function(mt){for(;;)switch(mt.prev=mt.next){case 0:return mt.next=2,Object(o.a)("/api/schools/".concat(W==null||((ze=W.userInfo)===null||ze===void 0||((ot=ze.course)===null||ot===void 0))?void 0:ot.course_school_id,"/ec_majors/get_major_list.json"),{method:"get"});case 2:Et=mt.sent,te(Et==null?void 0:Et.data),(j||I)&&me();case 5:case"end":return mt.stop()}},Me)})),$e.apply(this,arguments)}return console.log(De),D.a.createElement("div",{style:{display:(b=W.userInfo.course)!==null&&b!==void 0&&b.is_openengineering?"":"none"}},D.a.createElement("p",{style:{fontSize:"16px",fontWeight:400}},"\u5DE5\u7A0B\u8BA4\u8BC1\u8003\u6838\u77E5\u8BC6\u70B9"),De==null?void 0:De.map(function(Me,ze){return D.a.createElement("div",{style:{display:"flex",alignItems:"center",marginBottom:"10px"}},D.a.createElement(R,{rz:be,item:Me,type:ze,setitem:function(Et){De.splice(ze,1,Et),xe(Object(Z.a)(De));var _t=[];De==null||De.map(function(mt){var ut;mt==null||((ut=mt.ec_point_ids)===null||ut===void 0)||ut.map(function(Xt){_t.push(Xt)})}),$(Object(ie.a)(Object(ie.a)({},Et),{},{ec_point_ids:_t}))}}),ze!=0&&D.a.createElement(_.a,{onClick:function(){De.splice(ze,1),xe(Object(Z.a)(De))},style:{marginLeft:10,fontSize:"20px"}}),D.a.createElement(p.a,{onClick:function(){De.push({}),xe(Object(Z.a)(De))},style:{marginLeft:10,fontSize:"20px"}}))}))},y=st.a=Object(v.a)(function(d){var l=d.classroomList,h=d.loading,g=d.globalSetting,b=d.user;return{classroomList:l,globalSetting:g,loading:h.effects,user:b}})(E)},h78n:function(zt,st,V){"use strict";V.d(st,"a",function(){return b});var ie=V("q1tI"),Z=V.n(ie),U=V("TSYQ"),ee=V.n(U),H={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},M=function(W){var K=W.map(function(){return Object(ie.useRef)()}),I=Object(ie.useRef)();return Object(ie.useEffect)(function(){var x=Date.now(),j=!1;Object.keys(K).forEach(function($){var ae=K[$].current;if(!ae)return;j=!0;var fe=ae.style;fe.transitionDuration=".3s, .3s, .3s, .06s",I.current&&x-I.current<100&&(fe.transitionDuration="0s, 0s")}),j&&(I.current=Date.now())}),[K]};function Y(){return Y=Object.assign||function(N){for(var W=1;W<arguments.length;W++){var K=arguments[W];for(var I in K)Object.prototype.hasOwnProperty.call(K,I)&&(N[I]=K[I])}return N},Y.apply(this,arguments)}function X(N,W){return p(N)||_(N,W)||D(N,W)||k()}function k(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function D(N,W){if(!N)return;if(typeof N=="string")return v(N,W);var K=Object.prototype.toString.call(N).slice(8,-1);if(K==="Object"&&N.constructor&&(K=N.constructor.name),K==="Map"||K==="Set")return Array.from(N);if(K==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(K))return v(N,W)}function v(N,W){(W==null||W>N.length)&&(W=N.length);for(var K=0,I=new Array(W);K<W;K++)I[K]=N[K];return I}function _(N,W){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(N)))return;var K=[],I=!0,x=!1,j=void 0;try{for(var $=N[Symbol.iterator](),ae;!(I=(ae=$.next()).done)&&!(K.push(ae.value),W&&K.length===W);I=!0);}catch(fe){x=!0,j=fe}finally{try{!I&&$.return!=null&&$.return()}finally{if(x)throw j}}return K}function p(N){if(Array.isArray(N))return N}function o(N,W){if(N==null)return{};var K=u(N,W),I,x;if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(N);for(x=0;x<j.length;x++){if(I=j[x],W.indexOf(I)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(N,I))continue;K[I]=N[I]}}return K}function u(N,W){if(N==null)return{};var K={},I=Object.keys(N),x,j;for(j=0;j<I.length;j++){if(x=I[j],W.indexOf(x)>=0)continue;K[x]=N[x]}return K}var r=function(W){var K=W.className,I=W.percent,x=W.prefixCls,j=W.strokeColor,$=W.strokeLinecap,ae=W.strokeWidth,fe=W.style,pe=W.trailColor,Ce=W.trailWidth,De=W.transition,xe=o(W,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete xe.gapPosition;var Oe=Array.isArray(I)?I:[I],Ee=Array.isArray(j)?j:[j],be=M(Oe),te=X(be,1),me=te[0],ye=ae/2,Le=100-ae/2,$e="M ".concat($==="round"?ye:0,",").concat(ye,`
|
|
L `).concat($==="round"?Le:100,",").concat(ye),Me="0 0 100 ".concat(ae),ze=0;return Z.a.createElement("svg",Y({className:ee()("".concat(x,"-line"),K),viewBox:Me,preserveAspectRatio:"none",style:fe},xe),Z.a.createElement("path",{className:"".concat(x,"-line-trail"),d:$e,strokeLinecap:$,stroke:pe,strokeWidth:Ce||ae,fillOpacity:"0"}),Oe.map(function(ot,Et){var _t={strokeDasharray:"".concat(ot,"px, 100px"),strokeDashoffset:"-".concat(ze,"px"),transition:De||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},mt=Ee[Et]||Ee[Ee.length-1];return ze+=ot,Z.a.createElement("path",{key:Et,className:"".concat(x,"-line-path"),d:$e,strokeLinecap:$,stroke:mt,strokeWidth:ae,fillOpacity:"0",ref:me[Et],style:_t})}))};r.defaultProps=H;var i=r;function t(){return t=Object.assign||function(N){for(var W=1;W<arguments.length;W++){var K=arguments[W];for(var I in K)Object.prototype.hasOwnProperty.call(K,I)&&(N[I]=K[I])}return N},t.apply(this,arguments)}function c(N,W){return R(N)||w(N,W)||A(N,W)||f()}function f(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function A(N,W){if(!N)return;if(typeof N=="string")return S(N,W);var K=Object.prototype.toString.call(N).slice(8,-1);if(K==="Object"&&N.constructor&&(K=N.constructor.name),K==="Map"||K==="Set")return Array.from(N);if(K==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(K))return S(N,W)}function S(N,W){(W==null||W>N.length)&&(W=N.length);for(var K=0,I=new Array(W);K<W;K++)I[K]=N[K];return I}function w(N,W){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(N)))return;var K=[],I=!0,x=!1,j=void 0;try{for(var $=N[Symbol.iterator](),ae;!(I=(ae=$.next()).done)&&!(K.push(ae.value),W&&K.length===W);I=!0);}catch(fe){x=!0,j=fe}finally{try{!I&&$.return!=null&&$.return()}finally{if(x)throw j}}return K}function R(N){if(Array.isArray(N))return N}function O(N,W){if(N==null)return{};var K=E(N,W),I,x;if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(N);for(x=0;x<j.length;x++){if(I=j[x],W.indexOf(I)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(N,I))continue;K[I]=N[I]}}return K}function E(N,W){if(N==null)return{};var K={},I=Object.keys(N),x,j;for(j=0;j<I.length;j++){if(x=I[j],W.indexOf(x)>=0)continue;K[x]=N[x]}return K}var y=0;function d(N){return+N.replace("%","")}function l(N){return Array.isArray(N)?N:[N]}function h(N,W,K,I){var x=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,j=arguments.length>5?arguments[5]:void 0,$=50-I/2,ae=0,fe=-$,pe=0,Ce=-2*$;switch(j){case"left":ae=-$,fe=0,pe=2*$,Ce=0;break;case"right":ae=$,fe=0,pe=-2*$,Ce=0;break;case"bottom":fe=$,Ce=2*$;break;default:}var De="M 50,50 m ".concat(ae,",").concat(fe,`
|
|
a `).concat($,",").concat($," 0 1 1 ").concat(pe,",").concat(-Ce,`
|
|
a `).concat($,",").concat($," 0 1 1 ").concat(-pe,",").concat(Ce),xe=Math.PI*2*$,Oe={stroke:K,strokeDasharray:"".concat(W/100*(xe-x),"px ").concat(xe,"px"),strokeDashoffset:"-".concat(x/2+N/100*(xe-x),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:De,pathStyle:Oe}}var g=function(W){var K=W.prefixCls,I=W.strokeWidth,x=W.trailWidth,j=W.gapDegree,$=W.gapPosition,ae=W.trailColor,fe=W.strokeLinecap,pe=W.style,Ce=W.className,De=W.strokeColor,xe=W.percent,Oe=O(W,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),Ee=Object(ie.useMemo)(function(){return y+=1,y},[]),be=h(0,100,ae,I,j,$),te=be.pathString,me=be.pathStyle,ye=l(xe),Le=l(De),$e=Le.find(function(_t){return Object.prototype.toString.call(_t)==="[object Object]"}),Me=M(ye),ze=c(Me,1),ot=ze[0],Et=function(){var mt=0;return ye.map(function(ut,Xt){var en=Le[Xt]||Le[Le.length-1],sn=Object.prototype.toString.call(en)==="[object Object]"?"url(#".concat(K,"-gradient-").concat(Ee,")"):"",pn=h(mt,ut,en,I,j,$);return mt+=ut,Z.a.createElement("path",{key:Xt,className:"".concat(K,"-circle-path"),d:pn.pathString,stroke:sn,strokeLinecap:fe,strokeWidth:I,opacity:ut===0?0:1,fillOpacity:"0",style:pn.pathStyle,ref:ot[Xt]})})};return Z.a.createElement("svg",t({className:ee()("".concat(K,"-circle"),Ce),viewBox:"0 0 100 100",style:pe},Oe),$e&&Z.a.createElement("defs",null,Z.a.createElement("linearGradient",{id:"".concat(K,"-gradient-").concat(Ee),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys($e).sort(function(_t,mt){return d(_t)-d(mt)}).map(function(_t,mt){return Z.a.createElement("stop",{key:mt,offset:_t,stopColor:$e[_t]})}))),Z.a.createElement("path",{className:"".concat(K,"-circle-trail"),d:te,stroke:ae,strokeLinecap:fe,strokeWidth:x||I,fillOpacity:"0",style:me}),Et().reverse())};g.defaultProps=H;var b=g,F={Line:i,Circle:b}},hQp1:function(zt,st,V){"use strict";V.d(st,"a",function(){return Z});var ie;(function(U){U.FirstPage="firstPage",U.PrevPage="prevPage",U.NextPage="nextPage"})(ie||(ie={}));var Z;(function(U){U[U.Single=0]="Single",U[U.Multiple=1]="Multiple",U[U.Judge=2]="Judge",U[U.Fill=3]="Fill",U[U.Subjective=4]="Subjective",U[U.Shixun=5]="Shixun",U[U.Program=6]="Program",U[U.Combine=7]="Combine"})(Z||(Z={}))},hW8S:function(zt,st,V){"use strict";V.d(st,"a",function(){return ee}),V.d(st,"c",function(){return H}),V.d(st,"b",function(){return M});var ie=V("VTBJ"),Z=V("Ff2n"),U=V("Kwbf"),ee="RC_TABLE_INTERNAL_COL_DEFINE";function H(Y){var X=Y.expandable,k=Object(Z.a)(Y,["expandable"]);return"expandable"in Y?Object(ie.a)(Object(ie.a)({},k),X):k}function M(Y){return Object.keys(Y).reduce(function(X,k){return(k.substr(0,5)==="data-"||k.substr(0,5)==="aria-")&&(X[k]=Y[k]),X},{})}},i58Z:function(zt,st,V){zt.exports={wrap:"wrap___Yg2Z9",addKnowledge:"addKnowledge___2FlI0",disabled:"disabled___1_wxN"}},ie49:function(zt,st,V){zt.exports={brief:"brief___29L5W",contentTitle:"contentTitle___2wPLj",content:"content___2MAv3",tips:"tips___3qmPX",antdTable:"antdTable___o4ScH",tableCell:"tableCell___24I9Y",antdModal:"antdModal___1nRWw"}},kSUc:function(zt,st,V){},kqOp:function(zt,st,V){"use strict";V.d(st,"a",function(){return D});var ie=V("0Owb"),Z=V("fWQN"),U=V("mtLc"),ee=V("yKVA"),H=V("879j"),M=V("q1tI"),Y=V.n(M),X=V("Ot1p"),k="\u2581",D=function(v){Object(ee.a)(p,v);var _=Object(H.a)(p);function p(){var o;Object(Z.a)(this,p);for(var u=arguments.length,r=new Array(u),i=0;i<u;i++)r[i]=arguments[i];return o=_.call.apply(_,[this].concat(r)),o.getChCountBeforeCursor=function(t,c){for(var f=c.line,A=0,S=0;S<f;S++)A+=t.getLine(S).split(k).length-1;var w=t.getLine(f).substring(0,c.ch);return A+=w.split(k).length-1,A},o.onCMBeforeChange=function(t,c){var f=t.getRange(c.from,c.to),A=0;if(c.text.forEach(function(O){A+=O.split(k).length-1}),f&&f.indexOf(k)!=-1){var S=f.split(k).length-1,w=o.getChCountBeforeCursor(t,c.from);console.log("\u5220\u9664".concat(S,"\u4E2A\uFF0C \u4E4B\u524D\u6709").concat(w,"\u4E2A\uFF0C\u65B0\u589E").concat(A,"\u4E2A")),o.props.deleteEmptyDisabled?c.cancel():o.props.onPlaceholderChange&&o.props.onPlaceholderChange(w,S,A)}else if(A){var R=o.getChCountBeforeCursor(t,c.from);console.log("\u65B0\u589E".concat(A,"\u4E2A\uFF0C\u4E4B\u524D\u6709").concat(R,"\u4E2A")),o.props.onPlaceholderChange&&o.props.onPlaceholderChange(R,0,A)}},o}return Object(U.a)(p,[{key:"render",value:function(){return Y.a.createElement(X.a,Object(ie.a)({},this.props,{onCMBeforeChange:this.onCMBeforeChange}))}}]),p}(M.Component)},lZu9:function(zt,st,V){(function(ie){ie(V("VrN/"),V("1eCo"),V("8EBN"))})(function(ie){"use strict";ie.defineMode("markdown",function(Z,U){var ee=ie.getMode(Z,"text/html"),H=ee.name=="null";function M(I){if(ie.findModeByName){var x=ie.findModeByName(I);x&&(I=x.mime||x.mimes[0])}var j=ie.getMode(Z,I);return j.name=="null"?null:j}U.highlightFormatting===void 0&&(U.highlightFormatting=!1),U.maxBlockquoteDepth===void 0&&(U.maxBlockquoteDepth=0),U.taskLists===void 0&&(U.taskLists=!1),U.strikethrough===void 0&&(U.strikethrough=!1),U.emoji===void 0&&(U.emoji=!1),U.fencedCodeBlockHighlighting===void 0&&(U.fencedCodeBlockHighlighting=!0),U.fencedCodeBlockDefaultMode===void 0&&(U.fencedCodeBlockDefaultMode="text/plain"),U.xml===void 0&&(U.xml=!0),U.tokenTypeOverrides===void 0&&(U.tokenTypeOverrides={});var Y={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var X in Y)Y.hasOwnProperty(X)&&U.tokenTypeOverrides[X]&&(Y[X]=U.tokenTypeOverrides[X]);var k=/^([*\-_])(?:\s*\1){2,}\s*$/,D=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,v=/^\[(x| )\](?=\s)/i,_=U.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,p=/^ {0,3}(?:\={1,}|-{2,})\s*$/,o=/^[^#!\[\]*_\\<>` "'(~:]+/,u=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,r=/^\s*\[[^\]]+?\]:.*$/,i=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,t=" ";function c(I,x,j){return x.f=x.inline=j,j(I,x)}function f(I,x,j){return x.f=x.block=j,j(I,x)}function A(I){return!I||!/\S/.test(I.string)}function S(I){if(I.linkTitle=!1,I.linkHref=!1,I.linkText=!1,I.em=!1,I.strong=!1,I.strikethrough=!1,I.quote=0,I.indentedCode=!1,I.f==R){var x=H;if(!x){var j=ie.innerMode(ee,I.htmlState);x=j.mode.name=="xml"&&j.state.tagStart===null&&!j.state.context&&j.state.tokenize.isInText}x&&(I.f=d,I.block=w,I.htmlState=null)}return I.trailingSpace=0,I.trailingSpaceNewLine=!1,I.prevLine=I.thisLine,I.thisLine={stream:null},null}function w(I,x){var j=I.column()===x.indentation,$=A(x.prevLine.stream),ae=x.indentedCode,fe=x.prevLine.hr,pe=x.list!==!1,Ce=(x.listStack[x.listStack.length-1]||0)+3;x.indentedCode=!1;var De=x.indentation;if(x.indentationDiff===null&&(x.indentationDiff=x.indentation,pe)){for(x.list=null;De<x.listStack[x.listStack.length-1];)x.listStack.pop(),x.listStack.length?x.indentation=x.listStack[x.listStack.length-1]:x.list=!1;x.list!==!1&&(x.indentationDiff=De-x.listStack[x.listStack.length-1])}var xe=!$&&!fe&&!x.prevLine.header&&(!pe||!ae)&&!x.prevLine.fencedCodeEnd,Oe=(x.list===!1||fe||$)&&x.indentation<=Ce&&I.match(k),Ee=null;if(x.indentationDiff>=4&&(ae||x.prevLine.fencedCodeEnd||x.prevLine.header||$))return I.skipToEnd(),x.indentedCode=!0,Y.code;if(I.eatSpace())return null;if(j&&x.indentation<=Ce&&(Ee=I.match(_))&&Ee[1].length<=6)return x.quote=0,x.header=Ee[1].length,x.thisLine.header=!0,U.highlightFormatting&&(x.formatting="header"),x.f=x.inline,E(x);if(x.indentation<=Ce&&I.eat(">"))return x.quote=j?1:x.quote+1,U.highlightFormatting&&(x.formatting="quote"),I.eatSpace(),E(x);if(!Oe&&!x.setext&&j&&x.indentation<=Ce&&(Ee=I.match(D))){var be=Ee[1]?"ol":"ul";return x.indentation=De+I.current().length,x.list=!0,x.quote=0,x.listStack.push(x.indentation),x.em=!1,x.strong=!1,x.code=!1,x.strikethrough=!1,U.taskLists&&I.match(v,!1)&&(x.taskList=!0),x.f=x.inline,U.highlightFormatting&&(x.formatting=["list","list-"+be]),E(x)}else{if(j&&x.indentation<=Ce&&(Ee=I.match(u,!0)))return x.quote=0,x.fencedEndRE=new RegExp(Ee[1]+"+ *$"),x.localMode=U.fencedCodeBlockHighlighting&&M(Ee[2]||U.fencedCodeBlockDefaultMode),x.localMode&&(x.localState=ie.startState(x.localMode)),x.f=x.block=O,U.highlightFormatting&&(x.formatting="code-block"),x.code=-1,E(x);if(x.setext||(!xe||!pe)&&!x.quote&&x.list===!1&&!x.code&&!Oe&&!r.test(I.string)&&(Ee=I.lookAhead(1))&&(Ee=Ee.match(p)))return x.setext?(x.header=x.setext,x.setext=0,I.skipToEnd(),U.highlightFormatting&&(x.formatting="header")):(x.header=Ee[0].charAt(0)=="="?1:2,x.setext=x.header),x.thisLine.header=!0,x.f=x.inline,E(x);if(Oe)return I.skipToEnd(),x.hr=!0,x.thisLine.hr=!0,Y.hr;if(I.peek()==="[")return c(I,x,F)}return c(I,x,x.inline)}function R(I,x){var j=ee.token(I,x.htmlState);if(!H){var $=ie.innerMode(ee,x.htmlState);($.mode.name=="xml"&&$.state.tagStart===null&&!$.state.context&&$.state.tokenize.isInText||x.md_inside&&I.current().indexOf(">")>-1)&&(x.f=d,x.block=w,x.htmlState=null)}return j}function O(I,x){var j=x.listStack[x.listStack.length-1]||0,$=x.indentation<j,ae=j+3;if(x.fencedEndRE&&x.indentation<=ae&&($||I.match(x.fencedEndRE))){U.highlightFormatting&&(x.formatting="code-block");var fe;return $||(fe=E(x)),x.localMode=x.localState=null,x.block=w,x.f=d,x.fencedEndRE=null,x.code=0,x.thisLine.fencedCodeEnd=!0,$?f(I,x,x.block):fe}else return x.localMode?x.localMode.token(I,x.localState):(I.skipToEnd(),Y.code)}function E(I){var x=[];if(I.formatting){x.push(Y.formatting),typeof I.formatting=="string"&&(I.formatting=[I.formatting]);for(var j=0;j<I.formatting.length;j++)x.push(Y.formatting+"-"+I.formatting[j]),I.formatting[j]==="header"&&x.push(Y.formatting+"-"+I.formatting[j]+"-"+I.header),I.formatting[j]==="quote"&&(!U.maxBlockquoteDepth||U.maxBlockquoteDepth>=I.quote?x.push(Y.formatting+"-"+I.formatting[j]+"-"+I.quote):x.push("error"))}if(I.taskOpen)return x.push("meta"),x.length?x.join(" "):null;if(I.taskClosed)return x.push("property"),x.length?x.join(" "):null;if(I.linkHref?x.push(Y.linkHref,"url"):(I.strong&&x.push(Y.strong),I.em&&x.push(Y.em),I.strikethrough&&x.push(Y.strikethrough),I.emoji&&x.push(Y.emoji),I.linkText&&x.push(Y.linkText),I.code&&x.push(Y.code),I.image&&x.push(Y.image),I.imageAltText&&x.push(Y.imageAltText,"link"),I.imageMarker&&x.push(Y.imageMarker)),I.header&&x.push(Y.header,Y.header+"-"+I.header),I.quote&&(x.push(Y.quote),!U.maxBlockquoteDepth||U.maxBlockquoteDepth>=I.quote?x.push(Y.quote+"-"+I.quote):x.push(Y.quote+"-"+U.maxBlockquoteDepth)),I.list!==!1){var $=(I.listStack.length-1)%3;$?$===1?x.push(Y.list2):x.push(Y.list3):x.push(Y.list1)}return I.trailingSpaceNewLine?x.push("trailing-space-new-line"):I.trailingSpace&&x.push("trailing-space-"+(I.trailingSpace%2?"a":"b")),x.length?x.join(" "):null}function y(I,x){return I.match(o,!0)?E(x):void 0}function d(I,x){var j=x.text(I,x);if(typeof j!="undefined")return j;if(x.list)return x.list=null,E(x);if(x.taskList){var $=I.match(v,!0)[1]===" ";return $?x.taskOpen=!0:x.taskClosed=!0,U.highlightFormatting&&(x.formatting="task"),x.taskList=!1,E(x)}if(x.taskOpen=!1,x.taskClosed=!1,x.header&&I.match(/^#+$/,!0))return U.highlightFormatting&&(x.formatting="header"),E(x);var ae=I.next();if(x.linkTitle){x.linkTitle=!1;var fe=ae;ae==="("&&(fe=")"),fe=(fe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var pe="^\\s*(?:[^"+fe+"\\\\]+|\\\\\\\\|\\\\.)"+fe;if(I.match(new RegExp(pe),!0))return Y.linkHref}if(ae==="`"){var Ce=x.formatting;U.highlightFormatting&&(x.formatting="code"),I.eatWhile("`");var De=I.current().length;if(x.code==0&&(!x.quote||De==1))return x.code=De,E(x);if(De==x.code){var xe=E(x);return x.code=0,xe}else return x.formatting=Ce,E(x)}else if(x.code)return E(x);if(ae==="\\"&&(I.next(),U.highlightFormatting)){var Oe=E(x),Ee=Y.formatting+"-escape";return Oe?Oe+" "+Ee:Ee}if(ae==="!"&&I.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return x.imageMarker=!0,x.image=!0,U.highlightFormatting&&(x.formatting="image"),E(x);if(ae==="["&&x.imageMarker&&I.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return x.imageMarker=!1,x.imageAltText=!0,U.highlightFormatting&&(x.formatting="image"),E(x);if(ae==="]"&&x.imageAltText){U.highlightFormatting&&(x.formatting="image");var Oe=E(x);return x.imageAltText=!1,x.image=!1,x.inline=x.f=h,Oe}if(ae==="["&&!x.image)return x.linkText&&I.match(/^.*?\]/)||(x.linkText=!0,U.highlightFormatting&&(x.formatting="link")),E(x);if(ae==="]"&&x.linkText){U.highlightFormatting&&(x.formatting="link");var Oe=E(x);return x.linkText=!1,x.inline=x.f=I.match(/\(.*?\)| ?\[.*?\]/,!1)?h:d,Oe}if(ae==="<"&&I.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){x.f=x.inline=l,U.highlightFormatting&&(x.formatting="link");var Oe=E(x);return Oe?Oe+=" ":Oe="",Oe+Y.linkInline}if(ae==="<"&&I.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){x.f=x.inline=l,U.highlightFormatting&&(x.formatting="link");var Oe=E(x);return Oe?Oe+=" ":Oe="",Oe+Y.linkEmail}if(U.xml&&ae==="<"&&I.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var be=I.string.indexOf(">",I.pos);if(be!=-1){var te=I.string.substring(I.start,be);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(te)&&(x.md_inside=!0)}return I.backUp(1),x.htmlState=ie.startState(ee),f(I,x,R)}if(U.xml&&ae==="<"&&I.match(/^\/\w*?>/))return x.md_inside=!1,"tag";if(ae==="*"||ae==="_"){for(var me=1,ye=I.pos==1?" ":I.string.charAt(I.pos-2);me<3&&I.eat(ae);)me++;var Le=I.peek()||" ",$e=!/\s/.test(Le)&&(!i.test(Le)||/\s/.test(ye)||i.test(ye)),Me=!/\s/.test(ye)&&(!i.test(ye)||/\s/.test(Le)||i.test(Le)),ze=null,ot=null;if(me%2&&(!x.em&&$e&&(ae==="*"||!Me||i.test(ye))?ze=!0:x.em==ae&&Me&&(ae==="*"||!$e||i.test(Le))&&(ze=!1)),me>1&&(!x.strong&&$e&&(ae==="*"||!Me||i.test(ye))?ot=!0:x.strong==ae&&Me&&(ae==="*"||!$e||i.test(Le))&&(ot=!1)),ot!=null||ze!=null){U.highlightFormatting&&(x.formatting=ze==null?"strong":ot==null?"em":"strong em"),ze===!0&&(x.em=ae),ot===!0&&(x.strong=ae);var xe=E(x);return ze===!1&&(x.em=!1),ot===!1&&(x.strong=!1),xe}}else if(ae===" "&&(I.eat("*")||I.eat("_"))){if(I.peek()===" ")return E(x);I.backUp(1)}if(U.strikethrough){if(ae==="~"&&I.eatWhile(ae)){if(x.strikethrough){U.highlightFormatting&&(x.formatting="strikethrough");var xe=E(x);return x.strikethrough=!1,xe}else if(I.match(/^[^\s]/,!1))return x.strikethrough=!0,U.highlightFormatting&&(x.formatting="strikethrough"),E(x)}else if(ae===" "&&I.match(/^~~/,!0)){if(I.peek()===" ")return E(x);I.backUp(2)}}if(U.emoji&&ae===":"&&I.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){x.emoji=!0,U.highlightFormatting&&(x.formatting="emoji");var Et=E(x);return x.emoji=!1,Et}return ae===" "&&(I.match(/^ +$/,!1)?x.trailingSpace++:x.trailingSpace&&(x.trailingSpaceNewLine=!0)),E(x)}function l(I,x){var j=I.next();if(j===">"){x.f=x.inline=d,U.highlightFormatting&&(x.formatting="link");var $=E(x);return $?$+=" ":$="",$+Y.linkInline}return I.match(/^[^>]+/,!0),Y.linkInline}function h(I,x){if(I.eatSpace())return null;var j=I.next();return j==="("||j==="["?(x.f=x.inline=b(j==="("?")":"]"),U.highlightFormatting&&(x.formatting="link-string"),x.linkHref=!0,E(x)):"error"}var g={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function b(I){return function(x,j){var $=x.next();if($===I){j.f=j.inline=d,U.highlightFormatting&&(j.formatting="link-string");var ae=E(j);return j.linkHref=!1,ae}return x.match(g[I]),j.linkHref=!0,E(j)}}function F(I,x){return I.match(/^([^\]\\]|\\.)*\]:/,!1)?(x.f=N,I.next(),U.highlightFormatting&&(x.formatting="link"),x.linkText=!0,E(x)):c(I,x,d)}function N(I,x){if(I.match(/^\]:/,!0)){x.f=x.inline=W,U.highlightFormatting&&(x.formatting="link");var j=E(x);return x.linkText=!1,j}return I.match(/^([^\]\\]|\\.)+/,!0),Y.linkText}function W(I,x){return I.eatSpace()?null:(I.match(/^[^\s]+/,!0),I.peek()===void 0?x.linkTitle=!0:I.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),x.f=x.inline=d,Y.linkHref+" url")}var K={startState:function(){return{f:w,prevLine:{stream:null},thisLine:{stream:null},block:w,htmlState:null,indentation:0,inline:d,text:y,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(I){return{f:I.f,prevLine:I.prevLine,thisLine:I.thisLine,block:I.block,htmlState:I.htmlState&&ie.copyState(ee,I.htmlState),indentation:I.indentation,localMode:I.localMode,localState:I.localMode?ie.copyState(I.localMode,I.localState):null,inline:I.inline,text:I.text,formatting:!1,linkText:I.linkText,linkTitle:I.linkTitle,linkHref:I.linkHref,code:I.code,em:I.em,strong:I.strong,strikethrough:I.strikethrough,emoji:I.emoji,header:I.header,setext:I.setext,hr:I.hr,taskList:I.taskList,list:I.list,listStack:I.listStack.slice(0),quote:I.quote,indentedCode:I.indentedCode,trailingSpace:I.trailingSpace,trailingSpaceNewLine:I.trailingSpaceNewLine,md_inside:I.md_inside,fencedEndRE:I.fencedEndRE}},token:function(I,x){if(x.formatting=!1,I!=x.thisLine.stream){if(x.header=0,x.hr=!1,I.match(/^\s*$/,!0))return S(x),null;if(x.prevLine=x.thisLine,x.thisLine={stream:I},x.taskList=!1,x.trailingSpace=0,x.trailingSpaceNewLine=!1,!x.localState&&(x.f=x.block,x.f!=R)){var j=I.match(/^\s*/,!0)[0].replace(/\t/g,t).length;if(x.indentation=j,x.indentationDiff=null,j>0)return null}}return x.f(I,x)},innerMode:function(I){return I.block==R?{state:I.htmlState,mode:ee}:I.localState?{state:I.localState,mode:I.localMode}:{state:I,mode:K}},indent:function(I,x,j){return I.block==R&&ee.indent?ee.indent(I.htmlState,x,j):I.localState&&I.localMode.indent?I.localMode.indent(I.localState,x,j):ie.Pass},blankLine:S,getType:E,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return K},"xml"),ie.defineMIME("text/markdown","markdown"),ie.defineMIME("text/x-markdown","markdown")})},loLm:function(zt,st,V){zt.exports={flex_box_center:"flex_box_center___Ea2v9",flex_space_between:"flex_space_between___1bTGw",flex_box_vertical_center:"flex_box_vertical_center___2J4zW",flex_box_center_end:"flex_box_center_end___9_5OK",flex_box_column:"flex_box_column___2FLgO",posWarp:"posWarp___3pf1n",pos:"pos___3-NfR",tips:"tips___2-j_s",markWrongBtnWrapper:"markWrongBtnWrapper___37HXF"}},n6Qo:function(zt,st,V){"use strict";V.d(st,"a",function(){return X});var ie=V("q1tI"),Z=V("biw7"),U=V("fyJ8");function ee(k){var D=k.className,v=k.index,_=k.children,p=k.colSpan,o=k.rowSpan,u=ie.useContext(Z.a),r=u.prefixCls,i=u.fixedInfoList,t=i[v];return ie.createElement(U.a,Object.assign({className:D,index:v,component:"td",prefixCls:r,record:null,dataIndex:null,render:function(){return{children:_,props:{colSpan:p,rowSpan:o}}}},t))}function H(k){return ie.createElement("tr",Object.assign({},k))}function M(k){var D=k.children,v=ie.useContext(Z.a),_=v.prefixCls;return ie.createElement("tfoot",{className:"".concat(_,"-summary")},D)}var Y=st.b=M,X={Cell:ee,Row:H}},ngQI:function(zt,st,V){"use strict";V.d(st,"a",function(){return Ul}),V.d(st,"b",function(){return yl}),V.d(st,"c",function(){return bl});var ie=V("q1tI"),Z=V.n(ie),U=V("dI71"),ee=V("wx14"),H=V("ANjH"),M=V("/MKj");function Y(T,P){if(T.length!==P.length)return!1;for(var G=0;G<T.length;G++)if(T[G]!==P[G])return!1;return!0}function X(T,P){var G=Object(ie.useState)(function(){return{inputs:P,result:T()}})[0],ne=Object(ie.useRef)(!0),de=Object(ie.useRef)(G),ce=ne.current||Boolean(P&&de.current.inputs&&Y(P,de.current.inputs)),we=ce?de.current:{inputs:P,result:T()};return Object(ie.useEffect)(function(){ne.current=!1,de.current=we},[we]),we.result}function k(T,P){return X(function(){return T},P)}var D=X,v=k,_=V("9R94"),p=function(P){var G=P.top,ne=P.right,de=P.bottom,ce=P.left,we=ne-ce,Te=de-G,He={top:G,right:ne,bottom:de,left:ce,width:we,height:Te,x:ce,y:G,center:{x:(ne+ce)/2,y:(de+G)/2}};return He},o=function(P,G){return{top:P.top-G.top,left:P.left-G.left,bottom:P.bottom+G.bottom,right:P.right+G.right}},u=function(P,G){return{top:P.top+G.top,left:P.left+G.left,bottom:P.bottom-G.bottom,right:P.right-G.right}},r=function(P,G){return{top:P.top+G.y,left:P.left+G.x,bottom:P.bottom+G.y,right:P.right+G.x}},i={top:0,right:0,bottom:0,left:0},t=function(P){var G=P.borderBox,ne=P.margin,de=ne===void 0?i:ne,ce=P.border,we=ce===void 0?i:ce,Te=P.padding,He=Te===void 0?i:Te,tt=p(o(G,de)),at=p(u(G,we)),Ge=p(u(at,He));return{marginBox:tt,borderBox:p(G),paddingBox:at,contentBox:Ge,margin:de,border:we,padding:He}},c=function(P){var G=P.slice(0,-2),ne=P.slice(-2);if(ne!=="px")return 0;var de=Number(G);return isNaN(de)&&Object(_.a)(!1),de},f=function(){return{x:window.pageXOffset,y:window.pageYOffset}},A=function(P,G){var ne=P.borderBox,de=P.border,ce=P.margin,we=P.padding,Te=r(ne,G);return t({borderBox:Te,border:de,margin:ce,padding:we})},S=function(P,G){return G===void 0&&(G=f()),A(P,G)},w=function(P,G){var ne={top:c(G.marginTop),right:c(G.marginRight),bottom:c(G.marginBottom),left:c(G.marginLeft)},de={top:c(G.paddingTop),right:c(G.paddingRight),bottom:c(G.paddingBottom),left:c(G.paddingLeft)},ce={top:c(G.borderTopWidth),right:c(G.borderRightWidth),bottom:c(G.borderBottomWidth),left:c(G.borderLeftWidth)};return t({borderBox:P,margin:ne,padding:de,border:ce})},R=function(P){var G=P.getBoundingClientRect(),ne=window.getComputedStyle(P);return w(G,ne)},O=Number.isNaN||function(P){return typeof P=="number"&&P!==P};function E(T,P){return T===P?!0:!!(O(T)&&O(P))}function y(T,P){if(T.length!==P.length)return!1;for(var G=0;G<T.length;G++)if(!E(T[G],P[G]))return!1;return!0}function d(T,P){P===void 0&&(P=y);var G,ne=[],de,ce=!1;function we(){for(var Te=[],He=0;He<arguments.length;He++)Te[He]=arguments[He];return ce&&G===this&&P(Te,ne)||(de=T.apply(this,Te),ce=!0,G=this,ne=Te),de}return we}var l=d,h=function(P){var G=[],ne=null,de=function(){for(var we=arguments.length,Te=new Array(we),He=0;He<we;He++)Te[He]=arguments[He];if(G=Te,ne)return;ne=requestAnimationFrame(function(){ne=null,P.apply(void 0,G)})};return de.cancel=function(){if(!ne)return;cancelAnimationFrame(ne),ne=null},de},g=h,b=V("i8i4"),F=V.n(b),N=!0,W=/[ \t]{2,}/g,K=/^[ \t]*/gm,I=function(P){return P.replace(W," ").replace(K,"").trim()},x=function(P){return I(`
|
|
%creact-beautiful-dnd
|
|
|
|
%c`+I(P)+`
|
|
|
|
%c\u{1F477}\u200D This is a development only message. It will be removed in production builds.
|
|
`)},j=function(P){return[x(P),"color: #00C584; font-size: 1.2em; font-weight: bold;","line-height: 1.5","color: #723874;"]},$="__react-beautiful-dnd-disable-dev-warnings";function ae(T,P){var G;if(N)return;if(typeof window!="undefined"&&window[$])return;(G=console)[T].apply(G,j(P))}var fe=ae.bind(null,"warn"),pe=ae.bind(null,"error");function Ce(){}function De(T,P){return Object(ee.a)({},T,{},P)}function xe(T,P,G){var ne=P.map(function(de){var ce=De(G,de.options);return T.addEventListener(de.eventName,de.fn,ce),function(){T.removeEventListener(de.eventName,de.fn,ce)}});return function(){ne.forEach(function(ce){ce()})}}var Oe=!0,Ee="Invariant failed";function be(T){this.message=T}be.prototype.toString=function(){return this.message};function te(T,P){if(T)return;throw Oe?new be(Ee):new be(Ee+": "+(P||""))}var me=function(T){Object(U.a)(P,T);function P(){for(var ne,de=arguments.length,ce=new Array(de),we=0;we<de;we++)ce[we]=arguments[we];return ne=T.call.apply(T,[this].concat(ce))||this,ne.callbacks=null,ne.unbind=Ce,ne.onWindowError=function(Te){var He=ne.getCallbacks();He.isDragging()&&He.tryAbort();var tt=Te.error;tt instanceof be&&Te.preventDefault()},ne.getCallbacks=function(){if(!ne.callbacks)throw new Error("Unable to find AppCallbacks in <ErrorBoundary/>");return ne.callbacks},ne.setCallbacks=function(Te){ne.callbacks=Te},ne}var G=P.prototype;return G.componentDidMount=function(){this.unbind=xe(window,[{eventName:"error",fn:this.onWindowError}])},G.componentWillUnmount=function(){this.unbind()},G.componentDidCatch=function(de){if(de instanceof be){this.setState({});return}throw de},G.render=function(){return this.props.children(this.setCallbacks)},P}(Z.a.Component),ye=`
|
|
Press space bar to start a drag.
|
|
When dragging you can use the arrow keys to move the item around and escape to cancel.
|
|
Some screen readers may require you to be in focus mode or to use your pass through key
|
|
`,Le=function(P){return P+1},$e=function(P){return`
|
|
You have lifted an item in position `+Le(P.source.index)+`
|
|
`},Me=function(P,G){var ne=P.droppableId===G.droppableId,de=Le(P.index),ce=Le(G.index);return ne?`
|
|
You have moved the item from position `+de+`
|
|
to position `+ce+`
|
|
`:`
|
|
You have moved the item from position `+de+`
|
|
in list `+P.droppableId+`
|
|
to list `+G.droppableId+`
|
|
in position `+ce+`
|
|
`},ze=function(P,G,ne){var de=G.droppableId===ne.droppableId;return de?`
|
|
The item `+P+`
|
|
has been combined with `+ne.draggableId:`
|
|
The item `+P+`
|
|
in list `+G.droppableId+`
|
|
has been combined with `+ne.draggableId+`
|
|
in list `+ne.droppableId+`
|
|
`},ot=function(P){var G=P.destination;if(G)return Me(P.source,G);var ne=P.combine;return ne?ze(P.draggableId,P.source,ne):"You are over an area that cannot be dropped on"},Et=function(P){return`
|
|
The item has returned to its starting position
|
|
of `+Le(P.index)+`
|
|
`},_t=function(P){if(P.reason==="CANCEL")return`
|
|
Movement cancelled.
|
|
`+Et(P.source)+`
|
|
`;var G=P.destination,ne=P.combine;return G?`
|
|
You have dropped the item.
|
|
`+Me(P.source,G)+`
|
|
`:ne?`
|
|
You have dropped the item.
|
|
`+ze(P.draggableId,P.source,ne)+`
|
|
`:`
|
|
The item has been dropped while not over a drop area.
|
|
`+Et(P.source)+`
|
|
`},mt={dragHandleUsageInstructions:ye,onDragStart:$e,onDragUpdate:ot,onDragEnd:_t},ut={x:0,y:0},Xt=function(P,G){return{x:P.x+G.x,y:P.y+G.y}},en=function(P,G){return{x:P.x-G.x,y:P.y-G.y}},sn=function(P,G){return P.x===G.x&&P.y===G.y},pn=function(P){return{x:P.x!==0?-P.x:0,y:P.y!==0?-P.y:0}},Un=function(P,G,ne){var de;return ne===void 0&&(ne=0),de={},de[P]=G,de[P==="x"?"y":"x"]=ne,de},Cn=function(P,G){return Math.sqrt(Math.pow(G.x-P.x,2)+Math.pow(G.y-P.y,2))},Qe=function(P,G){return Math.min.apply(Math,G.map(function(ne){return Cn(P,ne)}))},Ye=function(P){return function(G){return{x:P(G.x),y:P(G.y)}}},St=function(T,P){var G=p({top:Math.max(P.top,T.top),right:Math.min(P.right,T.right),bottom:Math.min(P.bottom,T.bottom),left:Math.max(P.left,T.left)});return G.width<=0||G.height<=0?null:G},bt=function(P,G){return{top:P.top+G.y,left:P.left+G.x,bottom:P.bottom+G.y,right:P.right+G.x}},nt=function(P){return[{x:P.left,y:P.top},{x:P.right,y:P.top},{x:P.left,y:P.bottom},{x:P.right,y:P.bottom}]},vt={top:0,right:0,bottom:0,left:0},Ue=function(P,G){return G?bt(P,G.scroll.diff.displacement):P},Ae=function(P,G,ne){if(ne&&ne.increasedBy){var de;return Object(ee.a)({},P,(de={},de[G.end]=P[G.end]+ne.increasedBy[G.line],de))}return P},Re=function(P,G){return G&&G.shouldClipSubject?St(G.pageMarginBox,P):p(P)},le=function(T){var P=T.page,G=T.withPlaceholder,ne=T.axis,de=T.frame,ce=Ue(P.marginBox,de),we=Ae(ce,ne,G),Te=Re(we,de);return{page:P,withPlaceholder:G,active:Te}},he=function(T,P){T.frame||te(!1);var G=T.frame,ne=en(P,G.scroll.initial),de=pn(ne),ce=Object(ee.a)({},G,{scroll:{initial:G.scroll.initial,current:P,diff:{value:ne,displacement:de},max:G.scroll.max}}),we=le({page:T.subject.page,withPlaceholder:T.subject.withPlaceholder,axis:T.axis,frame:ce}),Te=Object(ee.a)({},T,{frame:ce,subject:we});return Te};function Se(T){return Number.isInteger?Number.isInteger(T):typeof T=="number"&&isFinite(T)&&Math.floor(T)===T}function ve(T){return Object.values?Object.values(T):Object.keys(T).map(function(P){return T[P]})}function Pe(T,P){if(T.findIndex)return T.findIndex(P);for(var G=0;G<T.length;G++)if(P(T[G]))return G;return-1}function it(T,P){if(T.find)return T.find(P);var G=Pe(T,P);return G!==-1?T[G]:void 0}function xt(T){return Array.prototype.slice.call(T)}var $t=l(function(T){return T.reduce(function(P,G){return P[G.descriptor.id]=G,P},{})}),mn=l(function(T){return T.reduce(function(P,G){return P[G.descriptor.id]=G,P},{})}),rn=l(function(T){return ve(T)}),ci=l(function(T){return ve(T)}),Jn=l(function(T,P){var G=ci(P).filter(function(ne){return T===ne.descriptor.droppableId}).sort(function(ne,de){return ne.descriptor.index-de.descriptor.index});return G});function Sn(T){return T.at&&T.at.type==="REORDER"?T.at.destination:null}function pi(T){return T.at&&T.at.type==="COMBINE"?T.at.combine:null}var gi=l(function(T,P){return P.filter(function(G){return G.descriptor.id!==T.descriptor.id})}),xi=function(T){var P=T.isMovingForward,G=T.draggable,ne=T.destination,de=T.insideDestination,ce=T.previousImpact;if(!ne.isCombineEnabled)return null;var we=Sn(ce);if(!we)return null;function Te(Nn){var Wn={type:"COMBINE",combine:{draggableId:Nn,droppableId:ne.descriptor.id}};return Object(ee.a)({},ce,{at:Wn})}var He=ce.displaced.all,tt=He.length?He[0]:null;if(P)return tt?Te(tt):null;var at=gi(G,de);if(!tt){if(!at.length)return null;var Ge=at[at.length-1];return Te(Ge.descriptor.id)}var Ke=Pe(at,function(Nn){return Nn.descriptor.id===tt});Ke!==-1||te(!1);var qe=Ke-1;if(qe<0)return null;var Rt=at[qe];return Te(Rt.descriptor.id)},_i=function(T,P){return T.descriptor.droppableId===P.descriptor.id},Dn={point:ut,value:0},Ai={invisible:{},visible:{},all:[]},Ln={displaced:Ai,displacedBy:Dn,at:null},Dt=function(T,P){return function(G){return T<=G&&G<=P}},Qn=function(T){var P=Dt(T.top,T.bottom),G=Dt(T.left,T.right);return function(ne){var de=P(ne.top)&&P(ne.bottom)&&G(ne.left)&&G(ne.right);if(de)return!0;var ce=P(ne.top)||P(ne.bottom),we=G(ne.left)||G(ne.right),Te=ce&&we;if(Te)return!0;var He=ne.top<T.top&&ne.bottom>T.bottom,tt=ne.left<T.left&&ne.right>T.right,at=He&&tt;if(at)return!0;var Ge=He&&we||tt&&ce;return Ge}},vi=function(T){var P=Dt(T.top,T.bottom),G=Dt(T.left,T.right);return function(ne){var de=P(ne.top)&&P(ne.bottom)&&G(ne.left)&&G(ne.right);return de}},hi={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},bi={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"},yi=function(T){return function(P){var G=Dt(P.top,P.bottom),ne=Dt(P.left,P.right);return function(de){return T===hi?G(de.top)&&G(de.bottom):ne(de.left)&&ne(de.right)}}},Fi=function(P,G){var ne=G.frame?G.frame.scroll.diff.displacement:ut;return bt(P,ne)},ai=function(P,G,ne){return G.subject.active?ne(G.subject.active)(P):!1},pt=function(P,G,ne){return ne(G)(P)},Je=function(P){var G=P.target,ne=P.destination,de=P.viewport,ce=P.withDroppableDisplacement,we=P.isVisibleThroughFrameFn,Te=ce?Fi(G,ne):G;return ai(Te,ne,we)&&pt(Te,de,we)},Ft=function(P){return Je(Object(ee.a)({},P,{isVisibleThroughFrameFn:Qn}))},Bt=function(P){return Je(Object(ee.a)({},P,{isVisibleThroughFrameFn:vi}))},Fe=function(P){return Je(Object(ee.a)({},P,{isVisibleThroughFrameFn:yi(P.destination.axis)}))},ue=function(P,G,ne){if(typeof ne=="boolean")return ne;if(!G)return!0;var de=G.invisible,ce=G.visible;if(de[P])return!1;var we=ce[P];return we?we.shouldAnimate:!0};function si(T,P){var G=T.page.marginBox,ne={top:P.point.y,right:0,bottom:0,left:P.point.x};return p(o(G,ne))}function je(T){var P=T.afterDragging,G=T.destination,ne=T.displacedBy,de=T.viewport,ce=T.forceShouldAnimate,we=T.last;return P.reduce(function(He,tt){var at=si(tt,ne),Ge=tt.descriptor.id;He.all.push(Ge);var Ke=Ft({target:at,destination:G,viewport:de,withDroppableDisplacement:!0});if(!Ke)return He.invisible[tt.descriptor.id]=!0,He;var qe=ue(Ge,we,ce),Rt={draggableId:Ge,shouldAnimate:qe};return He.visible[Ge]=Rt,He},{all:[],visible:{},invisible:{}})}function Be(T,P){if(!T.length)return 0;var G=T[T.length-1].descriptor.index;return P.inHomeList?G:G+1}function Ie(T){var P=T.insideDestination,G=T.inHomeList,ne=T.displacedBy,de=T.destination,ce=Be(P,{inHomeList:G});return{displaced:Ai,displacedBy:ne,at:{type:"REORDER",destination:{droppableId:de.descriptor.id,index:ce}}}}function _e(T){var P=T.draggable,G=T.insideDestination,ne=T.destination,de=T.viewport,ce=T.displacedBy,we=T.last,Te=T.index,He=T.forceShouldAnimate,tt=_i(P,ne);if(Te==null)return Ie({insideDestination:G,inHomeList:tt,displacedBy:ce,destination:ne});var at=it(G,function(Nn){return Nn.descriptor.index===Te});if(!at)return Ie({insideDestination:G,inHomeList:tt,displacedBy:ce,destination:ne});var Ge=gi(P,G),Ke=G.indexOf(at),qe=Ge.slice(Ke),Rt=je({afterDragging:qe,destination:ne,displacedBy:ce,last:we,viewport:de.frame,forceShouldAnimate:He});return{displaced:Rt,displacedBy:ce,at:{type:"REORDER",destination:{droppableId:ne.descriptor.id,index:Te}}}}function An(T,P){return Boolean(P.effected[T])}var zn=function(T){var P=T.isMovingForward,G=T.destination,ne=T.draggables,de=T.combine,ce=T.afterCritical;if(!G.isCombineEnabled)return null;var we=de.draggableId,Te=ne[we],He=Te.descriptor.index,tt=An(we,ce);return tt?P?He:He-1:P?He+1:He},Pn=function(T){var P=T.isMovingForward,G=T.isInHomeList,ne=T.insideDestination,de=T.location;if(!ne.length)return null;var ce=de.index,we=P?ce+1:ce-1,Te=ne[0].descriptor.index,He=ne[ne.length-1].descriptor.index,tt=G?He:He+1;return we<Te||we>tt?null:we},Q=function(T){var P=T.isMovingForward,G=T.isInHomeList,ne=T.draggable,de=T.draggables,ce=T.destination,we=T.insideDestination,Te=T.previousImpact,He=T.viewport,tt=T.afterCritical,at=Te.at;if(at||te(!1),at.type==="REORDER"){var Ge=Pn({isMovingForward:P,isInHomeList:G,location:at.destination,insideDestination:we});return Ge==null?null:_e({draggable:ne,insideDestination:we,destination:ce,viewport:He,last:Te.displaced,displacedBy:Te.displacedBy,index:Ge})}var Ke=zn({isMovingForward:P,destination:ce,displaced:Te.displaced,draggables:de,combine:at.combine,afterCritical:tt});return Ke==null?null:_e({draggable:ne,insideDestination:we,destination:ce,viewport:He,last:Te.displaced,displacedBy:Te.displacedBy,index:Ke})},C=function(T){var P=T.displaced,G=T.afterCritical,ne=T.combineWith,de=T.displacedBy,ce=Boolean(P.visible[ne]||P.invisible[ne]);return An(ne,G)?ce?ut:pn(de.point):ce?de.point:ut},L=function(T){var P=T.afterCritical,G=T.impact,ne=T.draggables,de=pi(G);de||te(!1);var ce=de.draggableId,we=ne[ce].page.borderBox.center,Te=C({displaced:G.displaced,afterCritical:P,combineWith:ce,displacedBy:G.displacedBy});return Xt(we,Te)},z=function(P,G){return G.margin[P.start]+G.borderBox[P.size]/2},oe=function(P,G){return G.margin[P.end]+G.borderBox[P.size]/2},q=function(P,G,ne){return G[P.crossAxisStart]+ne.margin[P.crossAxisStart]+ne.borderBox[P.crossAxisSize]/2},ke=function(P){var G=P.axis,ne=P.moveRelativeTo,de=P.isMoving;return Un(G.line,ne.marginBox[G.end]+z(G,de),q(G,ne.marginBox,de))},ft=function(P){var G=P.axis,ne=P.moveRelativeTo,de=P.isMoving;return Un(G.line,ne.marginBox[G.start]-oe(G,de),q(G,ne.marginBox,de))},kt=function(P){var G=P.axis,ne=P.moveInto,de=P.isMoving;return Un(G.line,ne.contentBox[G.start]+z(G,de),q(G,ne.contentBox,de))},an=function(T){var P=T.impact,G=T.draggable,ne=T.draggables,de=T.droppable,ce=T.afterCritical,we=Jn(de.descriptor.id,ne),Te=G.page,He=de.axis;if(!we.length)return kt({axis:He,moveInto:de.page,isMoving:Te});var tt=P.displaced,at=P.displacedBy,Ge=tt.all[0];if(Ge){var Ke=ne[Ge];if(An(Ge,ce))return ft({axis:He,moveRelativeTo:Ke.page,isMoving:Te});var qe=A(Ke.page,at.point);return ft({axis:He,moveRelativeTo:qe,isMoving:Te})}var Rt=we[we.length-1];if(Rt.descriptor.id===G.descriptor.id)return Te.borderBox.center;if(An(Rt.descriptor.id,ce)){var Nn=A(Rt.page,pn(ce.displacedBy.point));return ke({axis:He,moveRelativeTo:Nn,isMoving:Te})}return ke({axis:He,moveRelativeTo:Rt.page,isMoving:Te})},dt=function(T,P){var G=T.frame;return G?Xt(P,G.scroll.diff.displacement):P},Pt=function(P){var G=P.impact,ne=P.draggable,de=P.droppable,ce=P.draggables,we=P.afterCritical,Te=ne.page.borderBox.center,He=G.at;return de&&He?He.type==="REORDER"?an({impact:G,draggable:ne,draggables:ce,droppable:de,afterCritical:we}):L({impact:G,draggables:ce,afterCritical:we}):Te},tn=function(T){var P=Pt(T),G=T.droppable,ne=G?dt(G,P):P;return ne},Vn=function(T,P){var G=en(P,T.scroll.initial),ne=pn(G),de=p({top:P.y,bottom:P.y+T.frame.height,left:P.x,right:P.x+T.frame.width}),ce={frame:de,scroll:{initial:T.scroll.initial,max:T.scroll.max,current:P,diff:{value:G,displacement:ne}}};return ce};function fi(T,P){return T.map(function(G){return P[G]})}function Hn(T,P){for(var G=0;G<P.length;G++){var ne=P[G].visible[T];if(ne)return ne}return null}var Fn=function(T){var P=T.impact,G=T.viewport,ne=T.destination,de=T.draggables,ce=T.maxScrollChange,we=Vn(G,Xt(G.scroll.current,ce)),Te=ne.frame?he(ne,Xt(ne.frame.scroll.current,ce)):ne,He=P.displaced,tt=je({afterDragging:fi(He.all,de),destination:ne,displacedBy:P.displacedBy,viewport:we.frame,last:He,forceShouldAnimate:!1}),at=je({afterDragging:fi(He.all,de),destination:Te,displacedBy:P.displacedBy,viewport:G.frame,last:He,forceShouldAnimate:!1}),Ge={},Ke={},qe=[He,tt,at];He.all.forEach(function(Nn){var Wn=Hn(Nn,qe);if(Wn){Ke[Nn]=Wn;return}Ge[Nn]=!0});var Rt=Object(ee.a)({},P,{displaced:{all:He.all,invisible:Ge,visible:Ke}});return Rt},Qt=function(T,P){return Xt(T.scroll.diff.displacement,P)},hn=function(T){var P=T.pageBorderBoxCenter,G=T.draggable,ne=T.viewport,de=Qt(ne,P),ce=en(de,G.page.borderBox.center);return Xt(G.client.borderBox.center,ce)},on=function(T){var P=T.draggable,G=T.destination,ne=T.newPageBorderBoxCenter,de=T.viewport,ce=T.withDroppableDisplacement,we=T.onlyOnMainAxis,Te=we===void 0?!1:we,He=en(ne,P.page.borderBox.center),tt=bt(P.page.borderBox,He),at={target:tt,destination:G,withDroppableDisplacement:ce,viewport:de};return Te?Fe(at):Bt(at)},Nt=function(T){var P=T.isMovingForward,G=T.draggable,ne=T.destination,de=T.draggables,ce=T.previousImpact,we=T.viewport,Te=T.previousPageBorderBoxCenter,He=T.previousClientSelection,tt=T.afterCritical;if(!ne.isEnabled)return null;var at=Jn(ne.descriptor.id,de),Ge=_i(G,ne),Ke=xi({isMovingForward:P,draggable:G,destination:ne,insideDestination:at,previousImpact:ce})||Q({isMovingForward:P,isInHomeList:Ge,draggable:G,draggables:de,destination:ne,insideDestination:at,previousImpact:ce,viewport:we,afterCritical:tt});if(!Ke)return null;var qe=tn({impact:Ke,draggable:G,droppable:ne,draggables:de,afterCritical:tt}),Rt=on({draggable:G,destination:ne,newPageBorderBoxCenter:qe,viewport:we.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0});if(Rt){var Nn=hn({pageBorderBoxCenter:qe,draggable:G,viewport:we});return{clientSelection:Nn,impact:Ke,scrollJumpRequest:null}}var Wn=en(qe,Te),ii=Fn({impact:Ke,viewport:we,destination:ne,draggables:de,maxScrollChange:Wn});return{clientSelection:He,impact:ii,scrollJumpRequest:Wn}},$n=function(P){var G=P.subject.active;return G||te(!1),G},jn=function(T){var P=T.isMovingForward,G=T.pageBorderBoxCenter,ne=T.source,de=T.droppables,ce=T.viewport,we=ne.subject.active;if(!we)return null;var Te=ne.axis,He=Dt(we[Te.start],we[Te.end]),tt=rn(de).filter(function(Ge){return Ge!==ne}).filter(function(Ge){return Ge.isEnabled}).filter(function(Ge){return Boolean(Ge.subject.active)}).filter(function(Ge){return Qn(ce.frame)($n(Ge))}).filter(function(Ge){var Ke=$n(Ge);return P?we[Te.crossAxisEnd]<Ke[Te.crossAxisEnd]:Ke[Te.crossAxisStart]<we[Te.crossAxisStart]}).filter(function(Ge){var Ke=$n(Ge),qe=Dt(Ke[Te.start],Ke[Te.end]);return He(Ke[Te.start])||He(Ke[Te.end])||qe(we[Te.start])||qe(we[Te.end])}).sort(function(Ge,Ke){var qe=$n(Ge)[Te.crossAxisStart],Rt=$n(Ke)[Te.crossAxisStart];return P?qe-Rt:Rt-qe}).filter(function(Ge,Ke,qe){return $n(Ge)[Te.crossAxisStart]===$n(qe[0])[Te.crossAxisStart]});if(!tt.length)return null;if(tt.length===1)return tt[0];var at=tt.filter(function(Ge){var Ke=Dt($n(Ge)[Te.start],$n(Ge)[Te.end]);return Ke(G[Te.line])});return at.length===1?at[0]:at.length>1?at.sort(function(Ge,Ke){return $n(Ge)[Te.start]-$n(Ke)[Te.start]})[0]:tt.sort(function(Ge,Ke){var qe=Qe(G,nt($n(Ge))),Rt=Qe(G,nt($n(Ke)));return qe!==Rt?qe-Rt:$n(Ge)[Te.start]-$n(Ke)[Te.start]})[0]},Tn=function(P,G){var ne=P.page.borderBox.center;return An(P.descriptor.id,G)?en(ne,G.displacedBy.point):ne},qn=function(P,G){var ne=P.page.borderBox;return An(P.descriptor.id,G)?bt(ne,pn(G.displacedBy.point)):ne},En=function(T){var P=T.pageBorderBoxCenter,G=T.viewport,ne=T.destination,de=T.insideDestination,ce=T.afterCritical,we=de.filter(function(Te){return Bt({target:qn(Te,ce),destination:ne,viewport:G.frame,withDroppableDisplacement:!0})}).sort(function(Te,He){var tt=Cn(P,dt(ne,Tn(Te,ce))),at=Cn(P,dt(ne,Tn(He,ce)));return tt<at?-1:at<tt?1:Te.descriptor.index-He.descriptor.index});return we[0]||null},In=l(function(P,G){var ne=G[P.line];return{value:ne,point:Un(P.line,ne)}}),gn=function(P,G,ne){var de=P.axis;if(P.descriptor.mode==="virtual")return Un(de.line,G[de.line]);var ce=P.subject.page.contentBox[de.size],we=Jn(P.descriptor.id,ne),Te=we.reduce(function(at,Ge){return at+Ge.client.marginBox[de.size]},0),He=Te+G[de.line],tt=He-ce;return tt<=0?null:Un(de.line,tt)},Bn=function(P,G){return Object(ee.a)({},P,{scroll:Object(ee.a)({},P.scroll,{max:G})})},Xn=function(P,G,ne){var de=P.frame;_i(G,P)&&te(!1),P.subject.withPlaceholder&&te(!1);var ce=In(P.axis,G.displaceBy).point,we=gn(P,ce,ne),Te={placeholderSize:ce,increasedBy:we,oldFrameMaxScroll:P.frame?P.frame.scroll.max:null};if(!de){var He=le({page:P.subject.page,withPlaceholder:Te,axis:P.axis,frame:P.frame});return Object(ee.a)({},P,{subject:He})}var tt=we?Xt(de.scroll.max,we):de.scroll.max,at=Bn(de,tt),Ge=le({page:P.subject.page,withPlaceholder:Te,axis:P.axis,frame:at});return Object(ee.a)({},P,{subject:Ge,frame:at})},Zn=function(P){var G=P.subject.withPlaceholder;G||te(!1);var ne=P.frame;if(!ne){var de=le({page:P.subject.page,axis:P.axis,frame:null,withPlaceholder:null});return Object(ee.a)({},P,{subject:de})}var ce=G.oldFrameMaxScroll;ce||te(!1);var we=Bn(ne,ce),Te=le({page:P.subject.page,axis:P.axis,frame:we,withPlaceholder:null});return Object(ee.a)({},P,{subject:Te,frame:we})},Kt=function(T){var P=T.previousPageBorderBoxCenter,G=T.moveRelativeTo,ne=T.insideDestination,de=T.draggable,ce=T.draggables,we=T.destination,Te=T.viewport,He=T.afterCritical;if(!G){if(ne.length)return null;var tt={displaced:Ai,displacedBy:Dn,at:{type:"REORDER",destination:{droppableId:we.descriptor.id,index:0}}},at=tn({impact:tt,draggable:de,droppable:we,draggables:ce,afterCritical:He}),Ge=_i(de,we)?we:Xn(we,de,ce),Ke=on({draggable:de,destination:Ge,newPageBorderBoxCenter:at,viewport:Te.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0});return Ke?tt:null}var qe=Boolean(P[we.axis.line]<=G.page.borderBox.center[we.axis.line]),Rt=function(){var Wn=G.descriptor.index;return G.descriptor.id===de.descriptor.id||qe?Wn:Wn+1}(),Nn=In(we.axis,de.displaceBy);return _e({draggable:de,insideDestination:ne,destination:we,viewport:Te,displacedBy:Nn,last:Ai,index:Rt})},Lt=function(T){var P=T.isMovingForward,G=T.previousPageBorderBoxCenter,ne=T.draggable,de=T.isOver,ce=T.draggables,we=T.droppables,Te=T.viewport,He=T.afterCritical,tt=jn({isMovingForward:P,pageBorderBoxCenter:G,source:de,droppables:we,viewport:Te});if(!tt)return null;var at=Jn(tt.descriptor.id,ce),Ge=En({pageBorderBoxCenter:G,viewport:Te,destination:tt,insideDestination:at,afterCritical:He}),Ke=Kt({previousPageBorderBoxCenter:G,destination:tt,draggable:ne,draggables:ce,moveRelativeTo:Ge,insideDestination:at,viewport:Te,afterCritical:He});if(!Ke)return null;var qe=tn({impact:Ke,draggable:ne,droppable:tt,draggables:ce,afterCritical:He}),Rt=hn({pageBorderBoxCenter:qe,draggable:ne,viewport:Te});return{clientSelection:Rt,impact:Ke,scrollJumpRequest:null}},yt=function(T){var P=T.at;return P?P.type==="REORDER"?P.destination.droppableId:P.combine.droppableId:null},It=function(P,G){var ne=yt(P);return ne?G[ne]:null},Ot=function(T){var P=T.state,G=T.type,ne=It(P.impact,P.dimensions.droppables),de=Boolean(ne),ce=P.dimensions.droppables[P.critical.droppable.id],we=ne||ce,Te=we.axis.direction,He=Te==="vertical"&&(G==="MOVE_UP"||G==="MOVE_DOWN")||Te==="horizontal"&&(G==="MOVE_LEFT"||G==="MOVE_RIGHT");if(He&&!de)return null;var tt=G==="MOVE_DOWN"||G==="MOVE_RIGHT",at=P.dimensions.draggables[P.critical.draggable.id],Ge=P.current.page.borderBoxCenter,Ke=P.dimensions,qe=Ke.draggables,Rt=Ke.droppables;return He?Nt({isMovingForward:tt,previousPageBorderBoxCenter:Ge,draggable:at,destination:we,draggables:qe,viewport:P.viewport,previousClientSelection:P.current.client.selection,previousImpact:P.impact,afterCritical:P.afterCritical}):Lt({isMovingForward:tt,previousPageBorderBoxCenter:Ge,draggable:at,isOver:we,draggables:qe,droppables:Rt,viewport:P.viewport,afterCritical:P.afterCritical})};function Vt(T){return T.phase==="DRAGGING"||T.phase==="COLLECTING"}function Zt(T){var P=Dt(T.top,T.bottom),G=Dt(T.left,T.right);return function(de){return P(de.y)&&G(de.x)}}function Gt(T,P){return T.left<P.right&&T.right>P.left&&T.top<P.bottom&&T.bottom>P.top}function Ut(T){var P=T.pageBorderBox,G=T.draggable,ne=T.candidates,de=G.page.borderBox.center,ce=ne.map(function(we){var Te=we.axis,He=Un(we.axis.line,P.center[Te.line],we.page.borderBox.center[Te.crossAxisLine]);return{id:we.descriptor.id,distance:Cn(de,He)}}).sort(function(we,Te){return Te.distance-we.distance});return ce[0]?ce[0].id:null}function vn(T){var P=T.pageBorderBox,G=T.draggable,ne=T.droppables,de=rn(ne).filter(function(ce){if(!ce.isEnabled)return!1;var we=ce.subject.active;if(!we)return!1;if(!Gt(P,we))return!1;if(Zt(we)(P.center))return!0;var Te=ce.axis,He=we.center[Te.crossAxisLine],tt=P[Te.crossAxisStart],at=P[Te.crossAxisEnd],Ge=Dt(we[Te.crossAxisStart],we[Te.crossAxisEnd]),Ke=Ge(tt),qe=Ge(at);return!Ke&&!qe?!0:Ke?tt<He:at>He});return de.length?de.length===1?de[0].descriptor.id:Ut({pageBorderBox:P,draggable:G,candidates:de}):null}var _n=function(P,G){return p(bt(P,G))},un=function(T,P){var G=T.frame;return G?_n(P,G.scroll.diff.value):P};function cn(T){var P=T.displaced,G=T.id;return Boolean(P.visible[G]||P.invisible[G])}function bn(T){var P=T.draggable,G=T.closest,ne=T.inHomeList;return G?ne&&G.descriptor.index>P.descriptor.index?G.descriptor.index-1:G.descriptor.index:null}var dn=function(T){var P=T.pageBorderBoxWithDroppableScroll,G=T.draggable,ne=T.destination,de=T.insideDestination,ce=T.last,we=T.viewport,Te=T.afterCritical,He=ne.axis,tt=In(ne.axis,G.displaceBy),at=tt.value,Ge=P[He.start],Ke=P[He.end],qe=gi(G,de),Rt=it(qe,function(Wn){var ii=Wn.descriptor.id,ui=Wn.page.borderBox.center[He.line],Oi=An(ii,Te),li=cn({displaced:ce,id:ii});return Oi?li?Ke<=ui:Ge<ui-at:li?Ke<=ui+at:Ge<ui}),Nn=bn({draggable:G,closest:Rt,inHomeList:_i(G,ne)});return _e({draggable:G,insideDestination:de,destination:ne,viewport:we,last:ce,displacedBy:tt,index:Nn})},Mt=4,Yt=function(T){var P=T.draggable,G=T.pageBorderBoxWithDroppableScroll,ne=T.previousImpact,de=T.destination,ce=T.insideDestination,we=T.afterCritical;if(!de.isCombineEnabled)return null;var Te=de.axis,He=In(de.axis,P.displaceBy),tt=He.value,at=G[Te.start],Ge=G[Te.end],Ke=gi(P,ce),qe=it(Ke,function(Nn){var Wn=Nn.descriptor.id,ii=Nn.page.borderBox,ui=ii[Te.size],Oi=ui/Mt,li=An(Wn,we),ki=cn({displaced:ne.displaced,id:Wn});return li?ki?Ge>ii[Te.start]+Oi&&Ge<ii[Te.end]-Oi:at>ii[Te.start]-tt+Oi&&at<ii[Te.end]-tt-Oi:ki?Ge>ii[Te.start]+tt+Oi&&Ge<ii[Te.end]+tt-Oi:at>ii[Te.start]+Oi&&at<ii[Te.end]-Oi});if(!qe)return null;var Rt={displacedBy:He,displaced:ne.displaced,at:{type:"COMBINE",combine:{draggableId:qe.descriptor.id,droppableId:de.descriptor.id}}};return Rt},qt=function(T){var P=T.pageOffset,G=T.draggable,ne=T.draggables,de=T.droppables,ce=T.previousImpact,we=T.viewport,Te=T.afterCritical,He=_n(G.page.borderBox,P),tt=vn({pageBorderBox:He,draggable:G,droppables:de});if(!tt)return Ln;var at=de[tt],Ge=Jn(at.descriptor.id,ne),Ke=un(at,He);return Yt({pageBorderBoxWithDroppableScroll:Ke,draggable:G,previousImpact:ce,destination:at,insideDestination:Ge,afterCritical:Te})||dn({pageBorderBoxWithDroppableScroll:Ke,draggable:G,destination:at,insideDestination:Ge,last:ce.displaced,viewport:we,afterCritical:Te})},Wt=function(T,P){var G;return Object(ee.a)({},T,(G={},G[P.descriptor.id]=P,G))},fn=function(P){var G=P.previousImpact,ne=P.impact,de=P.droppables,ce=yt(G),we=yt(ne);if(!ce)return de;if(ce===we)return de;var Te=de[ce];if(!Te.subject.withPlaceholder)return de;var He=Zn(Te);return Wt(de,He)},On=function(T){var P=T.draggable,G=T.draggables,ne=T.droppables,de=T.previousImpact,ce=T.impact,we=fn({previousImpact:de,impact:ce,droppables:ne}),Te=yt(ce);if(!Te)return we;var He=ne[Te];if(_i(P,He))return we;if(He.subject.withPlaceholder)return we;var tt=Xn(He,P,G);return Wt(we,tt)},wn=function(T){var P=T.state,G=T.clientSelection,ne=T.dimensions,de=T.viewport,ce=T.impact,we=T.scrollJumpRequest,Te=de||P.viewport,He=ne||P.dimensions,tt=G||P.current.client.selection,at=en(tt,P.initial.client.selection),Ge={offset:at,selection:tt,borderBoxCenter:Xt(P.initial.client.borderBoxCenter,at)},Ke={selection:Xt(Ge.selection,Te.scroll.current),borderBoxCenter:Xt(Ge.borderBoxCenter,Te.scroll.current),offset:Xt(Ge.offset,Te.scroll.diff.value)},qe={client:Ge,page:Ke};if(P.phase==="COLLECTING")return Object(ee.a)({phase:"COLLECTING"},P,{dimensions:He,viewport:Te,current:qe});var Rt=He.draggables[P.critical.draggable.id],Nn=ce||qt({pageOffset:Ke.offset,draggable:Rt,draggables:He.draggables,droppables:He.droppables,previousImpact:P.impact,viewport:Te,afterCritical:P.afterCritical}),Wn=On({draggable:Rt,impact:Nn,previousImpact:P.impact,draggables:He.draggables,droppables:He.droppables}),ii=Object(ee.a)({},P,{current:qe,dimensions:{draggables:He.draggables,droppables:Wn},impact:Nn,viewport:Te,scrollJumpRequest:we||null,forceShouldAnimate:we?!1:null});return ii};function gt(T,P){return T.map(function(G){return P[G]})}var rt=function(T){var P=T.impact,G=T.viewport,ne=T.draggables,de=T.destination,ce=T.forceShouldAnimate,we=P.displaced,Te=gt(we.all,ne),He=je({afterDragging:Te,destination:de,displacedBy:P.displacedBy,viewport:G.frame,forceShouldAnimate:ce,last:we});return Object(ee.a)({},P,{displaced:He})},Xe=function(T){var P=T.impact,G=T.draggable,ne=T.droppable,de=T.draggables,ce=T.viewport,we=T.afterCritical,Te=tn({impact:P,draggable:G,draggables:de,droppable:ne,afterCritical:we});return hn({pageBorderBoxCenter:Te,draggable:G,viewport:ce})},Ze=function(T){var P=T.state,G=T.dimensions,ne=T.viewport;P.movementMode==="SNAP"||te(!1);var de=P.impact,ce=ne||P.viewport,we=G||P.dimensions,Te=we.draggables,He=we.droppables,tt=Te[P.critical.draggable.id],at=yt(de);at||te(!1);var Ge=He[at],Ke=rt({impact:de,viewport:ce,destination:Ge,draggables:Te}),qe=Xe({impact:Ke,draggable:tt,droppable:Ge,draggables:Te,viewport:ce,afterCritical:P.afterCritical});return wn({impact:Ke,clientSelection:qe,state:P,dimensions:we,viewport:ce})},We=function(T){return{index:T.index,droppableId:T.droppableId}},ct=function(T){var P=T.draggable,G=T.home,ne=T.draggables,de=T.viewport,ce=In(G.axis,P.displaceBy),we=Jn(G.descriptor.id,ne),Te=we.indexOf(P);Te!==-1||te(!1);var He=we.slice(Te+1),tt=He.reduce(function(qe,Rt){return qe[Rt.descriptor.id]=!0,qe},{}),at={inVirtualList:G.descriptor.mode==="virtual",displacedBy:ce,effected:tt},Ge=je({afterDragging:He,destination:G,displacedBy:ce,last:null,viewport:de.frame,forceShouldAnimate:!1}),Ke={displaced:Ge,displacedBy:ce,at:{type:"REORDER",destination:We(P.descriptor)}};return{impact:Ke,afterCritical:at}},et=function(T,P){return{draggables:T.draggables,droppables:Wt(T.droppables,P)}},Ct=function(P){},jt=function(P){},wt=function(T){var P=T.draggable,G=T.offset,ne=T.initialWindowScroll,de=A(P.client,G),ce=S(de,ne),we=Object(ee.a)({},P,{placeholder:Object(ee.a)({},P.placeholder,{client:de}),client:de,page:ce});return we},Jt=function(T){var P=T.frame;return P||te(!1),P},Tt=function(T){var P=T.additions,G=T.updatedDroppables,ne=T.viewport,de=ne.scroll.diff.value;return P.map(function(ce){var we=ce.descriptor.droppableId,Te=G[we],He=Jt(Te),tt=He.scroll.diff.value,at=Xt(de,tt),Ge=wt({draggable:ce,offset:at,initialWindowScroll:ne.scroll.initial});return Ge})},At=function(T){var P=T.state,G=T.published;Ct();var ne=G.modified.map(function(Oi){var li=P.dimensions.droppables[Oi.droppableId],ki=he(li,Oi.scroll);return ki}),de=Object(ee.a)({},P.dimensions.droppables,{},$t(ne)),ce=mn(Tt({additions:G.additions,updatedDroppables:de,viewport:P.viewport})),we=Object(ee.a)({},P.dimensions.draggables,{},ce);G.removals.forEach(function(Oi){delete we[Oi]});var Te={droppables:de,draggables:we},He=yt(P.impact),tt=He?Te.droppables[He]:null,at=Te.draggables[P.critical.draggable.id],Ge=Te.droppables[P.critical.droppable.id],Ke=ct({draggable:at,home:Ge,draggables:we,viewport:P.viewport}),qe=Ke.impact,Rt=Ke.afterCritical,Nn=tt&&tt.isCombineEnabled?P.impact:qe,Wn=qt({pageOffset:P.current.page.offset,draggable:Te.draggables[P.critical.draggable.id],draggables:Te.draggables,droppables:Te.droppables,previousImpact:Nn,viewport:P.viewport,afterCritical:Rt});jt();var ii=Object(ee.a)({phase:"DRAGGING"},P,{phase:"DRAGGING",impact:Wn,onLiftImpact:qe,dimensions:Te,afterCritical:Rt,forceShouldAnimate:!1});if(P.phase==="COLLECTING")return ii;var ui=Object(ee.a)({phase:"DROP_PENDING"},ii,{phase:"DROP_PENDING",reason:P.reason,isWaiting:!1});return ui},Rn=function(P){return P.movementMode==="SNAP"},yn=function(P,G,ne){var de=et(P.dimensions,G);return!Rn(P)||ne?wn({state:P,dimensions:de}):Ze({state:P,dimensions:de})};function mi(T){return T.isDragging&&T.movementMode==="SNAP"?Object(ee.a)({phase:"DRAGGING"},T,{scrollJumpRequest:null}):T}var ei={phase:"IDLE",completed:null,shouldFlush:!1},ti=function(T,P){if(T===void 0&&(T=ei),P.type==="FLUSH")return Object(ee.a)({},ei,{shouldFlush:!0});if(P.type==="INITIAL_PUBLISH"){T.phase==="IDLE"||te(!1);var G=P.payload,ne=G.critical,de=G.clientSelection,ce=G.viewport,we=G.dimensions,Te=G.movementMode,He=we.draggables[ne.draggable.id],tt=we.droppables[ne.droppable.id],at={selection:de,borderBoxCenter:He.client.borderBox.center,offset:ut},Ge={client:at,page:{selection:Xt(at.selection,ce.scroll.initial),borderBoxCenter:Xt(at.selection,ce.scroll.initial),offset:Xt(at.selection,ce.scroll.diff.value)}},Ke=rn(we.droppables).every(function(Si){return!Si.isFixedOnPage}),qe=ct({draggable:He,home:tt,draggables:we.draggables,viewport:ce}),Rt=qe.impact,Nn=qe.afterCritical,Wn={phase:"DRAGGING",isDragging:!0,critical:ne,movementMode:Te,dimensions:we,initial:Ge,current:Ge,isWindowScrollAllowed:Ke,impact:Rt,afterCritical:Nn,onLiftImpact:Rt,viewport:ce,scrollJumpRequest:null,forceShouldAnimate:null};return Wn}if(P.type==="COLLECTION_STARTING"){if(T.phase==="COLLECTING"||T.phase==="DROP_PENDING")return T;T.phase==="DRAGGING"||te(!1);var ii=Object(ee.a)({phase:"COLLECTING"},T,{phase:"COLLECTING"});return ii}if(P.type==="PUBLISH_WHILE_DRAGGING")return T.phase==="COLLECTING"||T.phase==="DROP_PENDING"||te(!1),At({state:T,published:P.payload});if(P.type==="MOVE"){if(T.phase==="DROP_PENDING")return T;Vt(T)||te(!1);var ui=P.payload.client;return sn(ui,T.current.client.selection)?T:wn({state:T,clientSelection:ui,impact:Rn(T)?T.impact:null})}if(P.type==="UPDATE_DROPPABLE_SCROLL"){if(T.phase==="DROP_PENDING")return mi(T);if(T.phase==="COLLECTING")return mi(T);Vt(T)||te(!1);var Oi=P.payload,li=Oi.id,ki=Oi.newScroll,Pi=T.dimensions.droppables[li];if(!Pi)return T;var Bi=he(Pi,ki);return yn(T,Bi,!1)}if(P.type==="UPDATE_DROPPABLE_IS_ENABLED"){if(T.phase==="DROP_PENDING")return T;Vt(T)||te(!1);var Yi=P.payload,e=Yi.id,n=Yi.isEnabled,s=T.dimensions.droppables[e];s||te(!1),s.isEnabled!==n||te(!1);var a=Object(ee.a)({},s,{isEnabled:n});return yn(T,a,!0)}if(P.type==="UPDATE_DROPPABLE_IS_COMBINE_ENABLED"){if(T.phase==="DROP_PENDING")return T;Vt(T)||te(!1);var m=P.payload,B=m.id,J=m.isCombineEnabled,re=T.dimensions.droppables[B];re||te(!1),re.isCombineEnabled!==J||te(!1);var se=Object(ee.a)({},re,{isCombineEnabled:J});return yn(T,se,!0)}if(P.type==="MOVE_BY_WINDOW_SCROLL"){if(T.phase==="DROP_PENDING"||T.phase==="DROP_ANIMATING")return T;Vt(T)||te(!1),T.isWindowScrollAllowed||te(!1);var ge=P.payload.newScroll;if(sn(T.viewport.scroll.current,ge))return mi(T);var Ne=Vn(T.viewport,ge);return Rn(T)?Ze({state:T,viewport:Ne}):wn({state:T,viewport:Ne})}if(P.type==="UPDATE_VIEWPORT_MAX_SCROLL"){if(!Vt(T))return T;var Ve=P.payload.maxScroll;if(sn(Ve,T.viewport.scroll.max))return T;var ht=Object(ee.a)({},T.viewport,{scroll:Object(ee.a)({},T.viewport.scroll,{max:Ve})});return Object(ee.a)({phase:"DRAGGING"},T,{viewport:ht})}if(P.type==="MOVE_UP"||P.type==="MOVE_DOWN"||P.type==="MOVE_LEFT"||P.type==="MOVE_RIGHT"){if(T.phase==="COLLECTING"||T.phase==="DROP_PENDING")return T;T.phase==="DRAGGING"||te(!1);var lt=Ot({state:T,type:P.type});return lt?wn({state:T,impact:lt.impact,clientSelection:lt.clientSelection,scrollJumpRequest:lt.scrollJumpRequest}):T}if(P.type==="DROP_PENDING"){var Ht=P.payload.reason;T.phase==="COLLECTING"||te(!1);var ln=Object(ee.a)({phase:"DROP_PENDING"},T,{phase:"DROP_PENDING",isWaiting:!0,reason:Ht});return ln}if(P.type==="DROP_ANIMATE"){var xn=P.payload,Kn=xn.completed,ri=xn.dropDuration,Gn=xn.newHomeClientOffset;T.phase==="DRAGGING"||T.phase==="DROP_PENDING"||te(!1);var di={phase:"DROP_ANIMATING",completed:Kn,dropDuration:ri,newHomeClientOffset:Gn,dimensions:T.dimensions};return di}if(P.type==="DROP_COMPLETE"){var Ri=P.payload.completed;return{phase:"IDLE",completed:Ri,shouldFlush:!1}}return T},nn=function(P){return{type:"BEFORE_INITIAL_CAPTURE",payload:P}},kn=function(P){return{type:"LIFT",payload:P}},Yn=function(P){return{type:"INITIAL_PUBLISH",payload:P}},ni=function(P){return{type:"PUBLISH_WHILE_DRAGGING",payload:P}},Mn=function(){return{type:"COLLECTION_STARTING",payload:null}},Li=function(P){return{type:"UPDATE_DROPPABLE_SCROLL",payload:P}},ji=function(P){return{type:"UPDATE_DROPPABLE_IS_ENABLED",payload:P}},Ci=function(P){return{type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:P}},oi=function(P){return{type:"MOVE",payload:P}},wi=function(P){return{type:"MOVE_BY_WINDOW_SCROLL",payload:P}},Ei=function(P){return{type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:P}},Ti=function(){return{type:"MOVE_UP",payload:null}},Ni=function(){return{type:"MOVE_DOWN",payload:null}},Vi=function(){return{type:"MOVE_RIGHT",payload:null}},Ui=function(){return{type:"MOVE_LEFT",payload:null}},Ii=function(){return{type:"FLUSH",payload:null}},Tr=function(P){return{type:"DROP_ANIMATE",payload:P}},Ki=function(P){return{type:"DROP_COMPLETE",payload:P}},Sr=function(P){return{type:"DROP",payload:P}},Ji=function(P){return{type:"DROP_PENDING",payload:P}},er=function(){return{type:"DROP_ANIMATION_FINISHED",payload:null}};function yr(T){if(T.length<=1)return;for(var P=T.map(function(Te){return Te.descriptor.index}),G={},ne=1;ne<P.length;ne++){var de=P[ne],ce=P[ne-1];de!==ce+1&&(G[de]=!0)}if(!Object.keys(G).length)return;var we=P.map(function(Te){var He=Boolean(G[Te]);return He?"[\u{1F525}"+Te+"]":""+Te}).join(", ")}function Or(T,P){if(!1)var G}var Va=function(T){return function(P){var G=P.getState,ne=P.dispatch;return function(de){return function(ce){if(ce.type!=="LIFT"){de(ce);return}var we=ce.payload,Te=we.id,He=we.clientSelection,tt=we.movementMode,at=G();at.phase==="DROP_ANIMATING"&&ne(Ki({completed:at.completed})),G().phase==="IDLE"||te(!1),ne(Ii()),ne(nn({draggableId:Te,movementMode:tt}));var Ge={shouldPublishImmediately:tt==="SNAP"},Ke={draggableId:Te,scrollOptions:Ge},qe=T.startPublishing(Ke),Rt=qe.critical,Nn=qe.dimensions,Wn=qe.viewport;Or(Rt,Nn),ne(Yn({critical:Rt,dimensions:Nn,clientSelection:He,movementMode:tt,viewport:Wn}))}}}},fr=function(T){return function(){return function(P){return function(G){G.type==="INITIAL_PUBLISH"&&T.dragging(),G.type==="DROP_ANIMATE"&&T.dropping(G.payload.completed.result.reason),(G.type==="FLUSH"||G.type==="DROP_COMPLETE")&&T.resting(),P(G)}}}},Xa={outOfTheWay:"cubic-bezier(0.2, 0, 0, 1)",drop:"cubic-bezier(.2,1,.1,1)"},Kr={opacity:{drop:0,combining:.7},scale:{drop:.75}},kr={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},ar=kr.outOfTheWay+"s "+Xa.outOfTheWay,qr={fluid:"opacity "+ar,snap:"transform "+ar+", opacity "+ar,drop:function(P){var G=P+"s "+Xa.drop;return"transform "+G+", opacity "+G},outOfTheWay:"transform "+ar,placeholder:"height "+ar+", width "+ar+", margin "+ar},bo=function(P){return sn(P,ut)?null:"translate("+P.x+"px, "+P.y+"px)"},Eo={moveTo:bo,drop:function(P,G){var ne=bo(P);return ne?G?ne+" scale("+Kr.scale.drop+")":ne:null}},xo=kr.minDropTime,cs=kr.maxDropTime,hs=cs-xo,Co=1500,wa=.6,fs=function(T){var P=T.current,G=T.destination,ne=T.reason,de=Cn(P,G);if(de<=0)return xo;if(de>=Co)return cs;var ce=de/Co,we=xo+hs*ce,Te=ne==="CANCEL"?we*wa:we;return Number(Te.toFixed(2))},ps=function(T){var P=T.impact,G=T.draggable,ne=T.dimensions,de=T.viewport,ce=T.afterCritical,we=ne.draggables,Te=ne.droppables,He=yt(P),tt=He?Te[He]:null,at=Te[G.descriptor.droppableId],Ge=Xe({impact:P,draggable:G,draggables:we,afterCritical:ce,droppable:tt||at,viewport:de}),Ke=en(Ge,G.client.borderBox.center);return Ke},wo=function(T){var P=T.draggables,G=T.reason,ne=T.lastImpact,de=T.home,ce=T.viewport,we=T.onLiftImpact;if(!ne.at||G!=="DROP"){var Te=rt({draggables:P,impact:we,destination:de,viewport:ce,forceShouldAnimate:!0});return{impact:Te,didDropInsideDroppable:!1}}if(ne.at.type==="REORDER")return{impact:ne,didDropInsideDroppable:!0};var He=Object(ee.a)({},ne,{displaced:Ai});return{impact:He,didDropInsideDroppable:!0}},Ya=function(T){var P=T.getState,G=T.dispatch;return function(ne){return function(de){if(de.type!=="DROP"){ne(de);return}var ce=P(),we=de.payload.reason;if(ce.phase==="COLLECTING"){G(Ji({reason:we}));return}if(ce.phase==="IDLE")return;var Te=ce.phase==="DROP_PENDING"&&ce.isWaiting;Te&&te(!1),ce.phase==="DRAGGING"||ce.phase==="DROP_PENDING"||te(!1);var He=ce.critical,tt=ce.dimensions,at=tt.draggables[ce.critical.draggable.id],Ge=wo({reason:we,lastImpact:ce.impact,afterCritical:ce.afterCritical,onLiftImpact:ce.onLiftImpact,home:ce.dimensions.droppables[ce.critical.droppable.id],viewport:ce.viewport,draggables:ce.dimensions.draggables}),Ke=Ge.impact,qe=Ge.didDropInsideDroppable,Rt=qe?Sn(Ke):null,Nn=qe?pi(Ke):null,Wn={index:He.draggable.index,droppableId:He.droppable.id},ii={draggableId:at.descriptor.id,type:at.descriptor.type,source:Wn,reason:we,mode:ce.movementMode,destination:Rt,combine:Nn},ui=ps({impact:Ke,draggable:at,dimensions:tt,viewport:ce.viewport,afterCritical:ce.afterCritical}),Oi={critical:ce.critical,afterCritical:ce.afterCritical,result:ii,impact:Ke},li=!sn(ce.current.client.offset,ui)||Boolean(ii.combine);if(!li){G(Ki({completed:Oi}));return}var ki=fs({current:ce.current.client.offset,destination:ui,reason:we}),Pi={newHomeClientOffset:ui,dropDuration:ki,completed:Oi};G(Tr(Pi))}}},To=function(){return{x:window.pageXOffset,y:window.pageYOffset}};function So(T){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:function(G){if(G.target!==window&&G.target!==window.document)return;T()}}}function xr(T){var P=T.onWindowScroll;function G(){P(To())}var ne=g(G),de=So(ne),ce=Ce;function we(){return ce!==Ce}function Te(){we()&&te(!1),ce=xe(window,[de])}function He(){we()||te(!1),ne.cancel(),ce(),ce=Ce}return{start:Te,stop:He,isActive:we}}var ms=function(P){return P.type==="DROP_COMPLETE"||P.type==="DROP_ANIMATE"||P.type==="FLUSH"},Oo=function(T){var P=xr({onWindowScroll:function(ne){T.dispatch(wi({newScroll:ne}))}});return function(G){return function(ne){!P.isActive()&&ne.type==="INITIAL_PUBLISH"&&P.start(),P.isActive()&&ms(ne)&&P.stop(),G(ne)}}},Ro=function(T){var P=!1,G=!1,ne=setTimeout(function(){G=!0}),de=function(we){if(P)return;if(G)return;P=!0,T(we),clearTimeout(ne)};return de.wasCalled=function(){return P},de},vs=function(){var T=[],P=function(ce){var we=Pe(T,function(tt){return tt.timerId===ce});we!==-1||te(!1);var Te=T.splice(we,1),He=Te[0];He.callback()},G=function(ce){var we=setTimeout(function(){return P(we)}),Te={timerId:we,callback:ce};T.push(Te)},ne=function(){if(!T.length)return;var ce=[].concat(T);T.length=0,ce.forEach(function(we){clearTimeout(we.timerId),we.callback()})};return{add:G,flush:ne}},gs=function(P,G){return P==null&&G==null?!0:P==null||G==null?!1:P.droppableId===G.droppableId&&P.index===G.index},Ao=function(P,G){return P==null&&G==null?!0:P==null||G==null?!1:P.draggableId===G.draggableId&&P.droppableId===G.droppableId},El=function(P,G){if(P===G)return!0;var ne=P.draggable.id===G.draggable.id&&P.draggable.droppableId===G.draggable.droppableId&&P.draggable.type===G.draggable.type&&P.draggable.index===G.draggable.index,de=P.droppable.id===G.droppable.id&&P.droppable.type===G.droppable.type;return ne&&de},Ta=function(P,G){Ct(),G(),jt()},$a=function(P,G){return{draggableId:P.draggable.id,type:P.droppable.type,source:{droppableId:P.droppable.id,index:P.draggable.index},mode:G}},Rr=function(P,G,ne,de){if(!P){ne(de(G));return}var ce=Ro(ne),we={announce:ce};P(G,we),ce.wasCalled()||ne(de(G))},Jr=function(T,P){var G=vs(),ne=null,de=function(Ke,qe){ne&&te(!1),Ta("onBeforeCapture",function(){var Rt=T().onBeforeCapture;if(Rt){var Nn={draggableId:Ke,mode:qe};Rt(Nn)}})},ce=function(Ke,qe){ne&&te(!1),Ta("onBeforeDragStart",function(){var Rt=T().onBeforeDragStart;Rt&&Rt($a(Ke,qe))})},we=function(Ke,qe){ne&&te(!1);var Rt=$a(Ke,qe);ne={mode:qe,lastCritical:Ke,lastLocation:Rt.source,lastCombine:null},G.add(function(){Ta("onDragStart",function(){return Rr(T().onDragStart,Rt,P,mt.onDragStart)})})},Te=function(Ke,qe){var Rt=Sn(qe),Nn=pi(qe);ne||te(!1);var Wn=!El(Ke,ne.lastCritical);Wn&&(ne.lastCritical=Ke);var ii=!gs(ne.lastLocation,Rt);ii&&(ne.lastLocation=Rt);var ui=!Ao(ne.lastCombine,Nn);if(ui&&(ne.lastCombine=Nn),!Wn&&!ii&&!ui)return;var Oi=Object(ee.a)({},$a(Ke,ne.mode),{combine:Nn,destination:Rt});G.add(function(){Ta("onDragUpdate",function(){return Rr(T().onDragUpdate,Oi,P,mt.onDragUpdate)})})},He=function(){ne||te(!1),G.flush()},tt=function(Ke){ne||te(!1),ne=null,Ta("onDragEnd",function(){return Rr(T().onDragEnd,Ke,P,mt.onDragEnd)})},at=function(){if(!ne)return;var Ke=Object(ee.a)({},$a(ne.lastCritical,ne.mode),{combine:null,destination:null,reason:"CANCEL"});tt(Ke)};return{beforeCapture:de,beforeStart:ce,start:we,update:Te,flush:He,drop:tt,abort:at}},Zr=function(T,P){var G=Jr(T,P);return function(ne){return function(de){return function(ce){if(ce.type==="BEFORE_INITIAL_CAPTURE"){G.beforeCapture(ce.payload.draggableId,ce.payload.movementMode);return}if(ce.type==="INITIAL_PUBLISH"){var we=ce.payload.critical;G.beforeStart(we,ce.payload.movementMode),de(ce),G.start(we,ce.payload.movementMode);return}if(ce.type==="DROP_COMPLETE"){var Te=ce.payload.completed.result;G.flush(),de(ce),G.drop(Te);return}if(de(ce),ce.type==="FLUSH"){G.abort();return}var He=ne.getState();He.phase==="DRAGGING"&&G.update(He.critical,He.impact)}}}},Do=function(T){return function(P){return function(G){if(G.type!=="DROP_ANIMATION_FINISHED"){P(G);return}var ne=T.getState();ne.phase==="DROP_ANIMATING"||te(!1),T.dispatch(Ki({completed:ne.completed}))}}},Po=function(T){var P=null,G=null;function ne(){G&&(cancelAnimationFrame(G),G=null),P&&(P(),P=null)}return function(de){return function(ce){if((ce.type==="FLUSH"||ce.type==="DROP_COMPLETE"||ce.type==="DROP_ANIMATION_FINISHED")&&ne(),de(ce),ce.type!=="DROP_ANIMATE")return;var we={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){var He=T.getState();He.phase==="DROP_ANIMATING"&&T.dispatch(er())}};G=requestAnimationFrame(function(){G=null,P=xe(window,[we])})}}},_s=function(T){return function(){return function(P){return function(G){(G.type==="DROP_COMPLETE"||G.type==="FLUSH"||G.type==="DROP_ANIMATE")&&T.stopPublishing(),P(G)}}}},Lo=function(T){var P=!1;return function(){return function(G){return function(ne){if(ne.type==="INITIAL_PUBLISH"){P=!0,T.tryRecordFocus(ne.payload.critical.draggable.id),G(ne),T.tryRestoreFocusRecorded();return}if(G(ne),!P)return;if(ne.type==="FLUSH"){P=!1,T.tryRestoreFocusRecorded();return}if(ne.type==="DROP_COMPLETE"){P=!1;var de=ne.payload.completed.result;de.combine&&T.tryShiftRecord(de.draggableId,de.combine.draggableId),T.tryRestoreFocusRecorded()}}}}},Gr=function(P){return P.type==="DROP_COMPLETE"||P.type==="DROP_ANIMATE"||P.type==="FLUSH"},zr=function(T){return function(P){return function(G){return function(ne){if(Gr(ne)){T.stop(),G(ne);return}if(ne.type==="INITIAL_PUBLISH"){G(ne);var de=P.getState();de.phase==="DRAGGING"||te(!1),T.start(de);return}G(ne),T.scroll(P.getState())}}}},lr=function(T){return function(P){return function(G){if(P(G),G.type!=="PUBLISH_WHILE_DRAGGING")return;var ne=T.getState();if(ne.phase!=="DROP_PENDING")return;if(ne.isWaiting)return;T.dispatch(Sr({reason:ne.reason}))}}},Mr=H.d,Nr=function(T){var P=T.dimensionMarshal,G=T.focusMarshal,ne=T.styleMarshal,de=T.getResponders,ce=T.announce,we=T.autoScroller;return Object(H.e)(ti,Mr(Object(H.a)(fr(ne),_s(P),Va(P),Ya,Do,Po,lr,zr(we),Oo,Lo(G),Zr(de,ce))))},ea=function(){return{additions:{},removals:{},modified:{}}};function xl(T){var P=T.registry,G=T.callbacks,ne=ea(),de=null,ce=function(){if(de)return;G.collectionStarting(),de=requestAnimationFrame(function(){de=null,Ct();var at=ne,Ge=at.additions,Ke=at.removals,qe=at.modified,Rt=Object.keys(Ge).map(function(ii){return P.draggable.getById(ii).getDimension(ut)}).sort(function(ii,ui){return ii.descriptor.index-ui.descriptor.index}),Nn=Object.keys(qe).map(function(ii){var ui=P.droppable.getById(ii),Oi=ui.callbacks.getScrollWhileDragging();return{droppableId:ii,scroll:Oi}}),Wn={additions:Rt,removals:Object.keys(Ke),modified:Nn};ne=ea(),jt(),G.publish(Wn)})},we=function(at){var Ge=at.descriptor.id;ne.additions[Ge]=at,ne.modified[at.descriptor.droppableId]=!0,ne.removals[Ge]&&delete ne.removals[Ge],ce()},Te=function(at){var Ge=at.descriptor;ne.removals[Ge.id]=!0,ne.modified[Ge.droppableId]=!0,ne.additions[Ge.id]&&delete ne.additions[Ge.id],ce()},He=function(){if(!de)return;cancelAnimationFrame(de),de=null,ne=ea()};return{add:we,remove:Te,stop:He}}var Io=function(T){var P=T.scrollHeight,G=T.scrollWidth,ne=T.height,de=T.width,ce=en({x:G,y:P},{x:de,y:ne}),we={x:Math.max(0,ce.x),y:Math.max(0,ce.y)};return we},ta=function(){var T=document.documentElement;return T||te(!1),T},ko=function(){var T=ta(),P=Io({scrollHeight:T.scrollHeight,scrollWidth:T.scrollWidth,width:T.clientWidth,height:T.clientHeight});return P},ys=function(){var T=To(),P=ko(),G=T.y,ne=T.x,de=ta(),ce=de.clientWidth,we=de.clientHeight,Te=ne+ce,He=G+we,tt=p({top:G,left:ne,right:Te,bottom:He}),at={frame:tt,scroll:{initial:T,current:T,max:P,diff:{value:ut,displacement:ut}}};return at},Qa=function(T){var P=T.critical,G=T.scrollOptions,ne=T.registry;Ct();var de=ys(),ce=de.scroll.current,we=P.droppable,Te=ne.droppable.getAllByType(we.type).map(function(Ge){return Ge.callbacks.getDimensionAndWatchScroll(ce,G)}),He=ne.draggable.getAllByType(P.draggable.type).map(function(Ge){return Ge.getDimension(ce)}),tt={draggables:mn(He),droppables:$t(Te)};jt();var at={dimensions:tt,critical:P,viewport:de};return at};function bs(T,P,G){if(G.descriptor.id===P.id)return!1;if(G.descriptor.type!==P.type)return!1;var ne=T.droppable.getById(G.descriptor.droppableId);return!(ne.descriptor.mode!=="virtual")}var Mo=function(T,P){var G=null,ne=xl({callbacks:{publish:P.publishWhileDragging,collectionStarting:P.collectionStarting},registry:T}),de=function(qe,Rt){if(T.droppable.exists(qe)||te(!1),!G)return;P.updateDroppableIsEnabled({id:qe,isEnabled:Rt})},ce=function(qe,Rt){if(!G)return;T.droppable.exists(qe)||te(!1),P.updateDroppableIsCombineEnabled({id:qe,isCombineEnabled:Rt})},we=function(qe,Rt){if(!G)return;T.droppable.exists(qe)||te(!1),P.updateDroppableScroll({id:qe,newScroll:Rt})},Te=function(qe,Rt){if(!G)return;T.droppable.getById(qe).callbacks.scroll(Rt)},He=function(){if(!G)return;ne.stop();var qe=G.critical.droppable;T.droppable.getAllByType(qe.type).forEach(function(Rt){return Rt.callbacks.dragStopped()}),G.unsubscribe(),G=null},tt=function(qe){G||te(!1);var Rt=G.critical.draggable;qe.type==="ADDITION"&&(bs(T,Rt,qe.value)&&ne.add(qe.value)),qe.type==="REMOVAL"&&(bs(T,Rt,qe.value)&&ne.remove(qe.value))},at=function(qe){G&&te(!1);var Rt=T.draggable.getById(qe.draggableId),Nn=T.droppable.getById(Rt.descriptor.droppableId),Wn={draggable:Rt.descriptor,droppable:Nn.descriptor},ii=T.subscribe(tt);return G={critical:Wn,unsubscribe:ii},Qa({critical:Wn,registry:T,scrollOptions:qe.scrollOptions})},Ge={updateDroppableIsEnabled:de,updateDroppableIsCombineEnabled:ce,scrollDroppable:Te,updateDroppableScroll:we,startPublishing:at,stopPublishing:He};return Ge},No=function(T,P){return T.phase==="IDLE"?!0:T.phase!=="DROP_ANIMATING"||T.completed.result.draggableId===P?!1:T.completed.result.reason==="DROP"},Es=function(T){window.scrollBy(T.x,T.y)},Uo=l(function(T){return rn(T).filter(function(P){return P.isEnabled?!!P.frame:!1})}),na=function(P,G){var ne=it(Uo(G),function(de){return de.frame||te(!1),Zt(de.frame.pageMarginBox)(P)});return ne},qa=function(T){var P=T.center,G=T.destination,ne=T.droppables;if(G){var de=ne[G];return de.frame?de:null}var ce=na(P,ne);return ce},Ar={startFromPercentage:.25,maxScrollAtPercentage:.05,maxPixelScroll:28,ease:function(P){return Math.pow(P,2)},durationDampening:{stopDampeningAt:1200,accelerateAt:360}},Ja=function(T,P){var G=T[P.size]*Ar.startFromPercentage,ne=T[P.size]*Ar.maxScrollAtPercentage,de={startScrollingFrom:G,maxScrollValueAt:ne};return de},xs=function(T){var P=T.startOfRange,G=T.endOfRange,ne=T.current,de=G-P;if(de===0)return 0;var ce=ne-P,we=ce/de;return we},Fo=1,Cl=function(T,P){if(T>P.startScrollingFrom)return 0;if(T<=P.maxScrollValueAt)return Ar.maxPixelScroll;if(T===P.startScrollingFrom)return Fo;var G=xs({startOfRange:P.maxScrollValueAt,endOfRange:P.startScrollingFrom,current:T}),ne=1-G,de=Ar.maxPixelScroll*Ar.ease(ne);return Math.ceil(de)},Za=Ar.durationDampening.accelerateAt,eo=Ar.durationDampening.stopDampeningAt,ia=function(T,P){var G=P,ne=eo,de=Date.now(),ce=de-G;if(ce>=eo)return T;if(ce<Za)return Fo;var we=xs({startOfRange:Za,endOfRange:ne,current:ce}),Te=T*Ar.ease(we);return Math.ceil(Te)},ra=function(T){var P=T.distanceToEdge,G=T.thresholds,ne=T.dragStartTime,de=T.shouldUseTimeDampening,ce=Cl(P,G);return ce===0?0:de?Math.max(ia(ce,ne),Fo):ce},Cs=function(T){var P=T.container,G=T.distanceToEdges,ne=T.dragStartTime,de=T.axis,ce=T.shouldUseTimeDampening,we=Ja(P,de),Te=G[de.end]<G[de.start];return Te?ra({distanceToEdge:G[de.end],thresholds:we,dragStartTime:ne,shouldUseTimeDampening:ce}):-1*ra({distanceToEdge:G[de.start],thresholds:we,dragStartTime:ne,shouldUseTimeDampening:ce})},to=function(T){var P=T.container,G=T.subject,ne=T.proposedScroll,de=G.height>P.height,ce=G.width>P.width;return!ce&&!de?ne:ce&&de?null:{x:ce?0:ne.x,y:de?0:ne.y}},ws=Ye(function(T){return T===0?0:T}),aa=function(T){var P=T.dragStartTime,G=T.container,ne=T.subject,de=T.center,ce=T.shouldUseTimeDampening,we={top:de.y-G.top,right:G.right-de.x,bottom:G.bottom-de.y,left:de.x-G.left},Te=Cs({container:G,distanceToEdges:we,dragStartTime:P,axis:hi,shouldUseTimeDampening:ce}),He=Cs({container:G,distanceToEdges:we,dragStartTime:P,axis:bi,shouldUseTimeDampening:ce}),tt=ws({x:He,y:Te});if(sn(tt,ut))return null;var at=to({container:G,subject:ne,proposedScroll:tt});return at?sn(at,ut)?null:at:null},Ts=Ye(function(T){return T===0?0:T>0?1:-1}),Dr=function(){var T=function(G,ne){return G<0?G:G>ne?G-ne:0};return function(P){var G=P.current,ne=P.max,de=P.change,ce=Xt(G,de),we={x:T(ce.x,ne.x),y:T(ce.y,ne.y)};return sn(we,ut)?null:we}}(),oa=function(P){var G=P.max,ne=P.current,de=P.change,ce={x:Math.max(ne.x,G.x),y:Math.max(ne.y,G.y)},we=Ts(de),Te=Dr({max:ce,current:ne,change:we});return Te?we.x!==0&&Te.x===0?!0:we.y!==0&&Te.y===0:!0},Pr=function(P,G){return oa({current:P.scroll.current,max:P.scroll.max,change:G})},Sa=function(P,G){if(!Pr(P,G))return null;var ne=P.scroll.max,de=P.scroll.current;return Dr({current:de,max:ne,change:G})},Ur=function(P,G){var ne=P.frame;return ne?oa({current:ne.scroll.current,max:ne.scroll.max,change:G}):!1},Ss=function(P,G){var ne=P.frame;return ne&&Ur(P,G)?Dr({current:ne.scroll.current,max:ne.scroll.max,change:G}):null},Os=function(T){var P=T.viewport,G=T.subject,ne=T.center,de=T.dragStartTime,ce=T.shouldUseTimeDampening,we=aa({dragStartTime:de,container:P.frame,subject:G,center:ne,shouldUseTimeDampening:ce});return we&&Pr(P,we)?we:null},Rs=function(T){var P=T.droppable,G=T.subject,ne=T.center,de=T.dragStartTime,ce=T.shouldUseTimeDampening,we=P.frame;if(!we)return null;var Te=aa({dragStartTime:de,container:we.pageMarginBox,subject:G,center:ne,shouldUseTimeDampening:ce});return Te&&Ur(P,Te)?Te:null},As=function(T){var P=T.state,G=T.dragStartTime,ne=T.shouldUseTimeDampening,de=T.scrollWindow,ce=T.scrollDroppable,we=P.current.page.borderBoxCenter,Te=P.dimensions.draggables[P.critical.draggable.id],He=Te.page.marginBox;if(P.isWindowScrollAllowed){var tt=P.viewport,at=Os({dragStartTime:G,viewport:tt,subject:He,center:we,shouldUseTimeDampening:ne});if(at){de(at);return}}var Ge=qa({center:we,destination:yt(P.impact),droppables:P.dimensions.droppables});if(!Ge)return;var Ke=Rs({dragStartTime:G,droppable:Ge,subject:He,center:we,shouldUseTimeDampening:ne});Ke&&ce(Ge.descriptor.id,Ke)},Vr=function(T){var P=T.scrollWindow,G=T.scrollDroppable,ne=g(P),de=g(G),ce=null,we=function(at){ce||te(!1);var Ge=ce,Ke=Ge.shouldUseTimeDampening,qe=Ge.dragStartTime;As({state:at,scrollWindow:ne,scrollDroppable:de,dragStartTime:qe,shouldUseTimeDampening:Ke})},Te=function(at){Ct(),ce&&te(!1);var Ge=Date.now(),Ke=!1,qe=function(){Ke=!0};As({state:at,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:qe,scrollDroppable:qe}),ce={dragStartTime:Ge,shouldUseTimeDampening:Ke},jt(),Ke&&we(at)},He=function(){if(!ce)return;ne.cancel(),de.cancel(),ce=null};return{start:Te,stop:He,scroll:we}},Xr=function(T){var P=T.move,G=T.scrollDroppable,ne=T.scrollWindow,de=function(tt,at){var Ge=Xt(tt.current.client.selection,at);P({client:Ge})},ce=function(tt,at){if(!Ur(tt,at))return at;var Ge=Ss(tt,at);if(!Ge)return G(tt.descriptor.id,at),null;var Ke=en(at,Ge);G(tt.descriptor.id,Ke);var qe=en(at,Ke);return qe},we=function(tt,at,Ge){if(!tt)return Ge;if(!Pr(at,Ge))return Ge;var Ke=Sa(at,Ge);if(!Ke)return ne(Ge),null;var qe=en(Ge,Ke);ne(qe);var Rt=en(Ge,qe);return Rt},Te=function(tt){var at=tt.scrollJumpRequest;if(!at)return;var Ge=yt(tt.impact);Ge||te(!1);var Ke=ce(tt.dimensions.droppables[Ge],at);if(!Ke)return;var qe=tt.viewport,Rt=we(tt.isWindowScrollAllowed,qe,Ke);if(!Rt)return;de(tt,Rt)};return Te},wl=function(T){var P=T.scrollDroppable,G=T.scrollWindow,ne=T.move,de=Vr({scrollWindow:G,scrollDroppable:P}),ce=Xr({move:ne,scrollWindow:G,scrollDroppable:P}),we=function(tt){if(tt.phase!=="DRAGGING")return;if(tt.movementMode==="FLUID"){de.scroll(tt);return}if(!tt.scrollJumpRequest)return;ce(tt)},Te={scroll:we,start:de.start,stop:de.stop};return Te},sa="data-rbd",la=function(){var T=sa+"-drag-handle";return{base:T,draggableId:T+"-draggable-id",contextId:T+"-context-id"}}(),Bo=function(){var T=sa+"-draggable";return{base:T,contextId:T+"-context-id",id:T+"-id"}}(),Tl=function(){var T=sa+"-droppable";return{base:T,contextId:T+"-context-id",id:T+"-id"}}(),Ds={contextId:sa+"-scroll-container-context-id"},cr=function(P){return function(G){return"["+G+'="'+P+'"]'}},Gi=function(P,G){return P.map(function(ne){var de=ne.styles[G];return de?ne.selector+" { "+de+" }":""}).join(" ")},or="pointer-events: none;",$i=function(T){var P=cr(T),G=function(){var Te=`
|
|
cursor: -webkit-grab;
|
|
cursor: grab;
|
|
`;return{selector:P(la.contextId),styles:{always:`
|
|
-webkit-touch-callout: none;
|
|
-webkit-tap-highlight-color: rgba(0,0,0,0);
|
|
touch-action: manipulation;
|
|
`,resting:Te,dragging:or,dropAnimating:Te}}}(),ne=function(){var Te=`
|
|
transition: `+qr.outOfTheWay+`;
|
|
`;return{selector:P(Bo.contextId),styles:{dragging:Te,dropAnimating:Te,userCancel:Te}}}(),de={selector:P(Tl.contextId),styles:{always:"overflow-anchor: none;"}},ce={selector:"body",styles:{dragging:`
|
|
cursor: grabbing;
|
|
cursor: -webkit-grabbing;
|
|
user-select: none;
|
|
-webkit-user-select: none;
|
|
-moz-user-select: none;
|
|
-ms-user-select: none;
|
|
overflow-anchor: none;
|
|
`}},we=[ne,G,de,ce];return{always:Gi(we,"always"),resting:Gi(we,"resting"),dragging:Gi(we,"dragging"),dropAnimating:Gi(we,"dropAnimating"),userCancel:Gi(we,"userCancel")}},tr=typeof window!="undefined"&&typeof window.document!="undefined"&&typeof window.document.createElement!="undefined"?ie.useLayoutEffect:ie.useEffect,jo=function(){var P=document.querySelector("head");return P||te(!1),P},Oa=function(P){var G=document.createElement("style");return P&&G.setAttribute("nonce",P),G.type="text/css",G};function Sl(T,P){var G=D(function(){return $i(T)},[T]),ne=Object(ie.useRef)(null),de=Object(ie.useRef)(null),ce=v(l(function(Ge){var Ke=de.current;Ke||te(!1),Ke.textContent=Ge}),[]),we=v(function(Ge){var Ke=ne.current;Ke||te(!1),Ke.textContent=Ge},[]);tr(function(){!ne.current&&!de.current||te(!1);var Ge=Oa(P),Ke=Oa(P);return ne.current=Ge,de.current=Ke,Ge.setAttribute(sa+"-always",T),Ke.setAttribute(sa+"-dynamic",T),jo().appendChild(Ge),jo().appendChild(Ke),we(G.always),ce(G.resting),function(){var qe=function(Nn){var Wn=Nn.current;Wn||te(!1),jo().removeChild(Wn),Nn.current=null};qe(ne),qe(de)}},[P,we,ce,G.always,G.resting,T]);var Te=v(function(){return ce(G.dragging)},[ce,G.dragging]),He=v(function(Ge){if(Ge==="DROP"){ce(G.dropAnimating);return}ce(G.userCancel)},[ce,G.dropAnimating,G.userCancel]),tt=v(function(){if(!de.current)return;ce(G.resting)},[ce,G.resting]),at=D(function(){return{dragging:Te,dropping:He,resting:tt}},[Te,He,tt]);return at}var Ps=function(T){return T&&T.ownerDocument?T.ownerDocument.defaultView:window};function Ra(T){return T instanceof Ps(T).HTMLElement}function no(T,P){var G="["+la.contextId+'="'+T+'"]',ne=xt(document.querySelectorAll(G));if(!ne.length)return null;var de=it(ne,function(ce){return ce.getAttribute(la.draggableId)===P});return de&&Ra(de)?de:null}function Ls(T){var P=Object(ie.useRef)({}),G=Object(ie.useRef)(null),ne=Object(ie.useRef)(null),de=Object(ie.useRef)(!1),ce=v(function(Ke,qe){var Rt={id:Ke,focus:qe};return P.current[Ke]=Rt,function(){var Wn=P.current,ii=Wn[Ke];ii!==Rt&&delete Wn[Ke]}},[]),we=v(function(Ke){var qe=no(T,Ke);qe&&qe!==document.activeElement&&qe.focus()},[T]),Te=v(function(Ke,qe){G.current===Ke&&(G.current=qe)},[]),He=v(function(){if(ne.current)return;if(!de.current)return;ne.current=requestAnimationFrame(function(){ne.current=null;var Ke=G.current;Ke&&we(Ke)})},[we]),tt=v(function(Ke){G.current=null;var qe=document.activeElement;if(!qe)return;if(qe.getAttribute(la.draggableId)!==Ke)return;G.current=Ke},[]);tr(function(){return de.current=!0,function(){de.current=!1;var Ke=ne.current;Ke&&cancelAnimationFrame(Ke)}},[]);var at=D(function(){return{register:ce,tryRecordFocus:tt,tryRestoreFocusRecorded:He,tryShiftRecord:Te}},[ce,tt,He,Te]);return at}function Wo(){var T={draggables:{},droppables:{}},P=[];function G(Ge){return P.push(Ge),function(){var qe=P.indexOf(Ge);if(qe===-1)return;P.splice(qe,1)}}function ne(Ge){P.length&&P.forEach(function(Ke){return Ke(Ge)})}function de(Ge){return T.draggables[Ge]||null}function ce(Ge){var Ke=de(Ge);return Ke||te(!1),Ke}var we={register:function(Ke){T.draggables[Ke.descriptor.id]=Ke,ne({type:"ADDITION",value:Ke})},update:function(Ke,qe){var Rt=T.draggables[qe.descriptor.id];if(!Rt)return;if(Rt.uniqueId!==Ke.uniqueId)return;delete T.draggables[qe.descriptor.id],T.draggables[Ke.descriptor.id]=Ke},unregister:function(Ke){var qe=Ke.descriptor.id,Rt=de(qe);if(!Rt)return;if(Ke.uniqueId!==Rt.uniqueId)return;delete T.draggables[qe],ne({type:"REMOVAL",value:Ke})},getById:ce,findById:de,exists:function(Ke){return Boolean(de(Ke))},getAllByType:function(Ke){return ve(T.draggables).filter(function(qe){return qe.descriptor.type===Ke})}};function Te(Ge){return T.droppables[Ge]||null}function He(Ge){var Ke=Te(Ge);return Ke||te(!1),Ke}var tt={register:function(Ke){T.droppables[Ke.descriptor.id]=Ke},unregister:function(Ke){var qe=Te(Ke.descriptor.id);if(!qe)return;if(Ke.uniqueId!==qe.uniqueId)return;delete T.droppables[Ke.descriptor.id]},getById:He,findById:Te,exists:function(Ke){return Boolean(Te(Ke))},getAllByType:function(Ke){return ve(T.droppables).filter(function(qe){return qe.descriptor.type===Ke})}};function at(){T.draggables={},T.droppables={},P.length=0}return{draggable:we,droppable:tt,subscribe:G,clean:at}}function Ol(){var T=D(Wo,[]);return Object(ie.useEffect)(function(){return function(){requestAnimationFrame(T.clean)}},[T]),T}var Aa=Z.a.createContext(null),Yr=function(){var T=document.body;return T||te(!1),T},Is={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},ks=function(P){return"rbd-announcement-"+P};function Ho(T){var P=D(function(){return ks(T)},[T]),G=Object(ie.useRef)(null);Object(ie.useEffect)(function(){var ce=document.createElement("div");return G.current=ce,ce.id=P,ce.setAttribute("aria-live","assertive"),ce.setAttribute("aria-atomic","true"),Object(ee.a)(ce.style,Is),Yr().appendChild(ce),function(){setTimeout(function(){var He=Yr();He.contains(ce)&&He.removeChild(ce),ce===G.current&&(G.current=null)})}},[P]);var ne=v(function(de){var ce=G.current;if(ce){ce.textContent=de;return}},[]);return ne}var Ko=0,Da={separator:"::"};function Rl(){Ko=0}function ua(T,P){return P===void 0&&(P=Da),D(function(){return""+T+P.separator+Ko++},[P.separator,T])}function pr(T){var P=T.contextId,G=T.uniqueId;return"rbd-hidden-text-"+P+"-"+G}function Ms(T){var P=T.contextId,G=T.text,ne=ua("hidden-text",{separator:"-"}),de=D(function(){return pr({contextId:P,uniqueId:ne})},[ne,P]);return Object(ie.useEffect)(function(){var we=document.createElement("div");return we.id=de,we.textContent=G,we.style.display="none",Yr().appendChild(we),function(){var He=Yr();He.contains(we)&&He.removeChild(we)}},[de,G]),de}var io=Z.a.createContext(null),Ns={react:"^16.8.5","react-dom":"^16.8.5"},mr=/(\d+)\.(\d+)\.(\d+)/,Mi=function(P){var G=mr.exec(P);G!=null||te(!1);var ne=Number(G[1]),de=Number(G[2]),ce=Number(G[3]);return{major:ne,minor:de,patch:ce,raw:P}},Cr=function(P,G){return G.major>P.major?!0:G.major<P.major?!1:G.minor>P.minor?!0:G.minor<P.minor?!1:G.patch>=P.patch},Fr=function(T,P){var G=Mi(T),ne=Mi(P);if(Cr(G,ne))return},$r=`
|
|
We expect a html5 doctype: <!doctype html>
|
|
This is to ensure consistent browser layout and measurement
|
|
|
|
More information: https://github.com/atlassian/react-beautiful-dnd/blob/master/docs/guides/doctype.md
|
|
`,Us=function(T){var P=T.doctype;if(!P)return;P.name.toLowerCase()!=="html",P.publicId!==""};function Pa(T){}function da(T,P){Pa(function(){Object(ie.useEffect)(function(){try{T()}catch(G){pe(`
|
|
A setup problem was encountered.
|
|
|
|
> `+G.message+`
|
|
`)}},P)})}function Al(){da(function(){Fr(Ns.react,Z.a.version),Us(document)},[])}function La(T){var P=Object(ie.useRef)(T);return Object(ie.useEffect)(function(){P.current=T}),P}function Ia(){var T=null;function P(){return Boolean(T)}function G(we){return we===T}function ne(we){T&&te(!1);var Te={abandon:we};return T=Te,Te}function de(){T||te(!1),T=null}function ce(){T&&(T.abandon(),de())}return{isClaimed:P,isActive:G,claim:ne,release:de,tryAbandon:ce}}var Fs=9,Go=13,wr=27,zo=32,Bs=33,Dl=34,ro=35,Vo=36,js=37,Pl=38,Ws=39,Ll=40,ao,oo=(ao={},ao[Go]=!0,ao[Fs]=!0,ao),Xo=function(T){oo[T.keyCode]&&T.preventDefault()},so=function(){var T="visibilitychange";if(typeof document=="undefined")return T;var P=[T,"ms"+T,"webkit"+T,"moz"+T,"o"+T],G=it(P,function(ne){return"on"+ne in document});return G||T}(),Hs=0,Yo=5;function ca(T,P){return Math.abs(P.x-T.x)>=Yo||Math.abs(P.y-T.y)>=Yo}var lo={type:"IDLE"};function uo(T){var P=T.cancel,G=T.completed,ne=T.getPhase,de=T.setPhase;return[{eventName:"mousemove",fn:function(we){var Te=we.button,He=we.clientX,tt=we.clientY;if(Te!==Hs)return;var at={x:He,y:tt},Ge=ne();if(Ge.type==="DRAGGING"){we.preventDefault(),Ge.actions.move(at);return}Ge.type==="PENDING"||te(!1);var Ke=Ge.point;if(!ca(Ke,at))return;we.preventDefault();var qe=Ge.actions.fluidLift(at);de({type:"DRAGGING",actions:qe})}},{eventName:"mouseup",fn:function(we){var Te=ne();if(Te.type!=="DRAGGING"){P();return}we.preventDefault(),Te.actions.drop({shouldBlockNextClick:!0}),G()}},{eventName:"mousedown",fn:function(we){ne().type==="DRAGGING"&&we.preventDefault(),P()}},{eventName:"keydown",fn:function(we){var Te=ne();if(Te.type==="PENDING"){P();return}if(we.keyCode===wr){we.preventDefault(),P();return}Xo(we)}},{eventName:"resize",fn:P},{eventName:"scroll",options:{passive:!0,capture:!1},fn:function(){ne().type==="PENDING"&&P()}},{eventName:"webkitmouseforcedown",fn:function(we){var Te=ne();if(Te.type!=="IDLE"||te(!1),Te.actions.shouldRespectForcePress()){P();return}we.preventDefault()}},{eventName:so,fn:P}]}function Ks(T){var P=Object(ie.useRef)(lo),G=Object(ie.useRef)(Ce),ne=D(function(){return{eventName:"mousedown",fn:function(Ge){if(Ge.defaultPrevented)return;if(Ge.button!==Hs)return;if(Ge.ctrlKey||Ge.metaKey||Ge.shiftKey||Ge.altKey)return;var Ke=T.findClosestDraggableId(Ge);if(!Ke)return;var qe=T.tryGetLock(Ke,we,{sourceEvent:Ge});if(!qe)return;Ge.preventDefault();var Rt={x:Ge.clientX,y:Ge.clientY};G.current(),tt(qe,Rt)}}},[T]),de=D(function(){return{eventName:"webkitmouseforcewillbegin",fn:function(Ge){if(Ge.defaultPrevented)return;var Ke=T.findClosestDraggableId(Ge);if(!Ke)return;var qe=T.findOptionsForDraggable(Ke);if(!qe)return;if(qe.shouldRespectForcePress)return;if(!T.canGetLock(Ke))return;Ge.preventDefault()}}},[T]),ce=v(function(){var Ge={passive:!1,capture:!0};G.current=xe(window,[de,ne],Ge)},[de,ne]),we=v(function(){var at=P.current;if(at.type==="IDLE")return;P.current=lo,G.current(),ce()},[ce]),Te=v(function(){var at=P.current;we(),at.type==="DRAGGING"&&at.actions.cancel({shouldBlockNextClick:!0}),at.type==="PENDING"&&at.actions.abort()},[we]),He=v(function(){var Ge={capture:!0,passive:!1},Ke=uo({cancel:Te,completed:we,getPhase:function(){return P.current},setPhase:function(Rt){P.current=Rt}});G.current=xe(window,Ke,Ge)},[Te,we]),tt=v(function(Ge,Ke){P.current.type==="IDLE"||te(!1),P.current={type:"PENDING",point:Ke,actions:Ge},He()},[He]);tr(function(){return ce(),function(){G.current()}},[ce])}var Br;function Gs(){}var Il=(Br={},Br[Dl]=!0,Br[Bs]=!0,Br[Vo]=!0,Br[ro]=!0,Br);function zs(T,P){function G(){P(),T.cancel()}function ne(){P(),T.drop()}return[{eventName:"keydown",fn:function(ce){if(ce.keyCode===wr){ce.preventDefault(),G();return}if(ce.keyCode===zo){ce.preventDefault(),ne();return}if(ce.keyCode===Ll){ce.preventDefault(),T.moveDown();return}if(ce.keyCode===Pl){ce.preventDefault(),T.moveUp();return}if(ce.keyCode===Ws){ce.preventDefault(),T.moveRight();return}if(ce.keyCode===js){ce.preventDefault(),T.moveLeft();return}if(Il[ce.keyCode]){ce.preventDefault();return}Xo(ce)}},{eventName:"mousedown",fn:G},{eventName:"mouseup",fn:G},{eventName:"click",fn:G},{eventName:"touchstart",fn:G},{eventName:"resize",fn:G},{eventName:"wheel",fn:G,options:{passive:!0}},{eventName:so,fn:G}]}function nr(T){var P=Object(ie.useRef)(Gs),G=D(function(){return{eventName:"keydown",fn:function(ce){if(ce.defaultPrevented)return;if(ce.keyCode!==zo)return;var we=T.findClosestDraggableId(ce);if(!we)return;var Te=T.tryGetLock(we,at,{sourceEvent:ce});if(!Te)return;ce.preventDefault();var He=!0,tt=Te.snapLift();P.current();function at(){He||te(!1),He=!1,P.current(),ne()}P.current=xe(window,zs(tt,at),{capture:!0,passive:!1})}}},[T]),ne=v(function(){var ce={passive:!1,capture:!0};P.current=xe(window,[G],ce)},[G]);tr(function(){return ne(),function(){P.current()}},[ne])}var ha={type:"IDLE"},Vs=120,Xs=.15;function Ys(T){var P=T.cancel,G=T.getPhase;return[{eventName:"orientationchange",fn:P},{eventName:"resize",fn:P},{eventName:"contextmenu",fn:function(de){de.preventDefault()}},{eventName:"keydown",fn:function(de){if(G().type!=="DRAGGING"){P();return}de.keyCode===wr&&de.preventDefault(),P()}},{eventName:so,fn:P}]}function fa(T){var P=T.cancel,G=T.completed,ne=T.getPhase;return[{eventName:"touchmove",options:{capture:!1},fn:function(ce){var we=ne();if(we.type!=="DRAGGING"){P();return}we.hasMoved=!0;var Te=ce.touches[0],He=Te.clientX,tt=Te.clientY,at={x:He,y:tt};ce.preventDefault(),we.actions.move(at)}},{eventName:"touchend",fn:function(ce){var we=ne();if(we.type!=="DRAGGING"){P();return}ce.preventDefault(),we.actions.drop({shouldBlockNextClick:!0}),G()}},{eventName:"touchcancel",fn:function(ce){if(ne().type!=="DRAGGING"){P();return}ce.preventDefault(),P()}},{eventName:"touchforcechange",fn:function(ce){var we=ne();we.type!=="IDLE"||te(!1);var Te=ce.touches[0];if(!Te)return;var He=Te.force>=Xs;if(!He)return;var tt=we.actions.shouldRespectForcePress();if(we.type==="PENDING"){tt&&P();return}if(tt){if(we.hasMoved){ce.preventDefault();return}P();return}ce.preventDefault()}},{eventName:so,fn:P}]}function co(T){var P=Object(ie.useRef)(ha),G=Object(ie.useRef)(Ce),ne=v(function(){return P.current},[]),de=v(function(qe){P.current=qe},[]),ce=D(function(){return{eventName:"touchstart",fn:function(qe){if(qe.defaultPrevented)return;var Rt=T.findClosestDraggableId(qe);if(!Rt)return;var Nn=T.tryGetLock(Rt,Te,{sourceEvent:qe});if(!Nn)return;var Wn=qe.touches[0],ii=Wn.clientX,ui=Wn.clientY,Oi={x:ii,y:ui};G.current(),Ge(Nn,Oi)}}},[T]),we=v(function(){var qe={capture:!0,passive:!1};G.current=xe(window,[ce],qe)},[ce]),Te=v(function(){var Ke=P.current;if(Ke.type==="IDLE")return;Ke.type==="PENDING"&&clearTimeout(Ke.longPressTimerId),de(ha),G.current(),we()},[we,de]),He=v(function(){var Ke=P.current;Te(),Ke.type==="DRAGGING"&&Ke.actions.cancel({shouldBlockNextClick:!0}),Ke.type==="PENDING"&&Ke.actions.abort()},[Te]),tt=v(function(){var qe={capture:!0,passive:!1},Rt={cancel:He,completed:Te,getPhase:ne},Nn=xe(window,fa(Rt),qe),Wn=xe(window,Ys(Rt),qe);G.current=function(){Nn(),Wn()}},[He,ne,Te]),at=v(function(){var qe=ne();qe.type==="PENDING"||te(!1);var Rt=qe.actions.fluidLift(qe.point);de({type:"DRAGGING",actions:Rt,hasMoved:!1})},[ne,de]),Ge=v(function(qe,Rt){ne().type==="IDLE"||te(!1);var Nn=setTimeout(at,Vs);de({type:"PENDING",point:Rt,actions:qe,longPressTimerId:Nn}),tt()},[tt,ne,de,at]);tr(function(){return we(),function(){G.current();var Rt=ne();Rt.type==="PENDING"&&(clearTimeout(Rt.longPressTimerId),de(ha))}},[ne,we,de]),tr(function(){var qe=xe(window,[{eventName:"touchmove",fn:function(){},options:{capture:!1,passive:!1}}]);return qe},[])}function $s(T){Pa(function(){var P=La(T);da(function(){P.current.length===T.length||te(!1)})})}var Qs={input:!0,button:!0,textarea:!0,select:!0,option:!0,optgroup:!0,video:!0,audio:!0};function $o(T,P){if(P==null)return!1;var G=Boolean(Qs[P.tagName.toLowerCase()]);if(G)return!0;var ne=P.getAttribute("contenteditable");return ne==="true"||ne===""?!0:P===T?!1:$o(T,P.parentElement)}function pa(T,P){var G=P.target;return Ra(G)?$o(T,G):!1}var qs=function(T){return p(T.getBoundingClientRect()).center};function ho(T){return T instanceof Ps(T).Element}var Js=function(){var T="matches";if(typeof document=="undefined")return T;var P=[T,"msMatchesSelector","webkitMatchesSelector"],G=it(P,function(ne){return ne in Element.prototype});return G||T}();function ma(T,P){return T==null?null:T[Js](P)?T:ma(T.parentElement,P)}function kl(T,P){return T.closest?T.closest(P):ma(T,P)}function va(T){return"["+la.contextId+'="'+T+'"]'}function Zs(T,P){var G=P.target;if(!ho(G))return null;var ne=va(T),de=kl(G,ne);return de&&Ra(de)?de:null}function el(T,P){var G=Zs(T,P);return G?G.getAttribute(la.draggableId):null}function tl(T,P){var G="["+Bo.contextId+'="'+T+'"]',ne=xt(document.querySelectorAll(G)),de=it(ne,function(ce){return ce.getAttribute(Bo.id)===P});return de&&Ra(de)?de:null}function ka(T){T.preventDefault()}function jr(T){var P=T.expected,G=T.phase,ne=T.isLockActive,de=T.shouldWarn;return ne()?!(P!==G):!1}function ga(T){var P=T.lockAPI,G=T.store,ne=T.registry,de=T.draggableId;if(P.isClaimed())return!1;var ce=ne.draggable.findById(de);return ce&&ce.options.isEnabled?!!No(G.getState(),de):!1}function Ma(T){var P=T.lockAPI,G=T.contextId,ne=T.store,de=T.registry,ce=T.draggableId,we=T.forceSensorStop,Te=T.sourceEvent,He=ga({lockAPI:P,store:ne,registry:de,draggableId:ce});if(!He)return null;var tt=de.draggable.getById(ce),at=tl(G,tt.descriptor.id);if(!at)return null;if(Te&&!tt.options.canDragInteractiveElements&&pa(at,Te))return null;var Ge=P.claim(we||Ce),Ke="PRE_DRAG";function qe(){return tt.options.shouldRespectForcePress}function Rt(){return P.isActive(Ge)}function Nn(Pi,Bi){jr({expected:Pi,phase:Ke,isLockActive:Rt,shouldWarn:!0})&&ne.dispatch(Bi())}var Wn=Nn.bind(null,"DRAGGING");function ii(Pi){function Bi(){P.release(),Ke="COMPLETED"}Ke!=="PRE_DRAG"&&(Bi(),Ke==="PRE_DRAG"||te(!1)),ne.dispatch(kn(Pi.liftActionArgs)),Ke="DRAGGING";function Yi(e,n){if(n===void 0&&(n={shouldBlockNextClick:!1}),Pi.cleanup(),n.shouldBlockNextClick){var s=xe(window,[{eventName:"click",fn:ka,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(s)}Bi(),ne.dispatch(Sr({reason:e}))}return Object(ee.a)({isActive:function(){return jr({expected:"DRAGGING",phase:Ke,isLockActive:Rt,shouldWarn:!1})},shouldRespectForcePress:qe,drop:function(n){return Yi("DROP",n)},cancel:function(n){return Yi("CANCEL",n)}},Pi.actions)}function ui(Pi){var Bi=g(function(e){Wn(function(){return oi({client:e})})}),Yi=ii({liftActionArgs:{id:ce,clientSelection:Pi,movementMode:"FLUID"},cleanup:function(){return Bi.cancel()},actions:{move:Bi}});return Object(ee.a)({},Yi,{move:Bi})}function Oi(){var Pi={moveUp:function(){return Wn(Ti)},moveRight:function(){return Wn(Vi)},moveDown:function(){return Wn(Ni)},moveLeft:function(){return Wn(Ui)}};return ii({liftActionArgs:{id:ce,clientSelection:qs(at),movementMode:"SNAP"},cleanup:Ce,actions:Pi})}function li(){var Pi=jr({expected:"PRE_DRAG",phase:Ke,isLockActive:Rt,shouldWarn:!0});Pi&&P.release()}var ki={isActive:function(){return jr({expected:"PRE_DRAG",phase:Ke,isLockActive:Rt,shouldWarn:!1})},shouldRespectForcePress:qe,fluidLift:ui,snapLift:Oi,abort:li};return ki}var nl=[Ks,nr,co];function Ml(T){var P=T.contextId,G=T.store,ne=T.registry,de=T.customSensors,ce=T.enableDefaultSensors,we=[].concat(ce?nl:[],de||[]),Te=Object(ie.useState)(function(){return Ia()})[0],He=v(function(ui,Oi){ui.isDragging&&!Oi.isDragging&&Te.tryAbandon()},[Te]);tr(function(){var ui=G.getState(),Oi=G.subscribe(function(){var li=G.getState();He(ui,li),ui=li});return Oi},[Te,G,He]),tr(function(){return Te.tryAbandon},[Te.tryAbandon]);var tt=v(function(ii){return ga({lockAPI:Te,registry:ne,store:G,draggableId:ii})},[Te,ne,G]),at=v(function(ii,ui,Oi){return Ma({lockAPI:Te,registry:ne,contextId:P,store:G,draggableId:ii,forceSensorStop:ui,sourceEvent:Oi&&Oi.sourceEvent?Oi.sourceEvent:null})},[P,Te,ne,G]),Ge=v(function(ii){return el(P,ii)},[P]),Ke=v(function(ii){var ui=ne.draggable.findById(ii);return ui?ui.options:null},[ne.draggable]),qe=v(function(){if(!Te.isClaimed())return;Te.tryAbandon(),G.getState().phase!=="IDLE"&&G.dispatch(Ii())},[Te,G]),Rt=v(Te.isClaimed,[Te]),Nn=D(function(){return{canGetLock:tt,tryGetLock:at,findClosestDraggableId:Ge,findOptionsForDraggable:Ke,tryReleaseLock:qe,isLockClaimed:Rt}},[tt,at,Ge,Ke,qe,Rt]);$s(we);for(var Wn=0;Wn<we.length;Wn++)we[Wn](Nn)}var il=function(P){return{onBeforeCapture:P.onBeforeCapture,onBeforeDragStart:P.onBeforeDragStart,onDragStart:P.onDragStart,onDragEnd:P.onDragEnd,onDragUpdate:P.onDragUpdate}};function br(T){return T.current||te(!1),T.current}function _a(T){var P=T.contextId,G=T.setCallbacks,ne=T.sensors,de=T.nonce,ce=T.dragHandleUsageInstructions,we=Object(ie.useRef)(null);Al();var Te=La(T),He=v(function(){return il(Te.current)},[Te]),tt=Ho(P),at=Ms({contextId:P,text:ce}),Ge=Sl(P,de),Ke=v(function(e){br(we).dispatch(e)},[]),qe=D(function(){return Object(H.b)({publishWhileDragging:ni,updateDroppableScroll:Li,updateDroppableIsEnabled:ji,updateDroppableIsCombineEnabled:Ci,collectionStarting:Mn},Ke)},[Ke]),Rt=Ol(),Nn=D(function(){return Mo(Rt,qe)},[Rt,qe]),Wn=D(function(){return wl(Object(ee.a)({scrollWindow:Es,scrollDroppable:Nn.scrollDroppable},Object(H.b)({move:oi},Ke)))},[Nn.scrollDroppable,Ke]),ii=Ls(P),ui=D(function(){return Nr({announce:tt,autoScroller:Wn,dimensionMarshal:Nn,focusMarshal:ii,getResponders:He,styleMarshal:Ge})},[tt,Wn,Nn,ii,He,Ge]);we.current=ui;var Oi=v(function(){var e=br(we),n=e.getState();n.phase!=="IDLE"&&e.dispatch(Ii())},[]),li=v(function(){var e=br(we).getState();return e.isDragging||e.phase==="DROP_ANIMATING"},[]),ki=D(function(){return{isDragging:li,tryAbort:Oi}},[li,Oi]);G(ki);var Pi=v(function(e){return No(br(we).getState(),e)},[]),Bi=v(function(){return Vt(br(we).getState())},[]),Yi=D(function(){return{marshal:Nn,focus:ii,contextId:P,canLift:Pi,isMovementAllowed:Bi,dragHandleUsageInstructionsId:at,registry:Rt}},[P,Nn,at,ii,Pi,Bi,Rt]);return Ml({contextId:P,store:ui,registry:Rt,customSensors:ne,enableDefaultSensors:T.enableDefaultSensors!==!1}),Object(ie.useEffect)(function(){return Oi},[Oi]),Z.a.createElement(io.Provider,{value:Yi},Z.a.createElement(M.a,{context:Aa,store:ui},T.children))}var ya=0;function Nl(){ya=0}function rl(){return D(function(){return""+ya++},[])}function ru(){Nl(),Rl()}function Ul(T){var P=rl(),G=T.dragHandleUsageInstructions||mt.dragHandleUsageInstructions;return Z.a.createElement(me,null,function(ne){return Z.a.createElement(_a,{nonce:T.nonce,contextId:P,setCallbacks:ne,dragHandleUsageInstructions:G,enableDefaultSensors:T.enableDefaultSensors,sensors:T.sensors,onBeforeCapture:T.onBeforeCapture,onBeforeDragStart:T.onBeforeDragStart,onDragStart:T.onDragStart,onDragUpdate:T.onDragUpdate,onDragEnd:T.onDragEnd},T.children)})}var Qo=function(P){return function(G){return P===G}},ur=Qo("scroll"),al=Qo("auto"),Fl=Qo("visible"),ol=function(P,G){return G(P.overflowX)||G(P.overflowY)},Bl=function(P,G){return G(P.overflowX)&&G(P.overflowY)},qo=function(P){var G=window.getComputedStyle(P),ne={overflowX:G.overflowX,overflowY:G.overflowY};return ol(ne,ur)||ol(ne,al)},sl=function(){return!1;var P,G;if(!qo(P))return!1;var ne,de;if(Bl(de,Fl))return!1},Jo=function T(P){return P==null?null:P===document.body?sl()?P:null:P===document.documentElement?null:qo(P)?P:T(P.parentElement)},au=function(T){if(!T)return;var P=Jo(T.parentElement);if(!P)return},Zo=function(T){return{x:T.scrollLeft,y:T.scrollTop}},jl=function T(P){if(!P)return!1;var G=window.getComputedStyle(P);return G.position==="fixed"?!0:T(P.parentElement)},Wr=function(T){var P=Jo(T),G=jl(T);return{closestScrollable:P,isFixedOnPage:G}},Na=function(T){var P=T.descriptor,G=T.isEnabled,ne=T.isCombineEnabled,de=T.isFixedOnPage,ce=T.direction,we=T.client,Te=T.page,He=T.closest,tt=function(){if(!He)return null;var qe=He.scrollSize,Rt=He.client,Nn=Io({scrollHeight:qe.scrollHeight,scrollWidth:qe.scrollWidth,height:Rt.paddingBox.height,width:Rt.paddingBox.width});return{pageMarginBox:He.page.marginBox,frameClient:Rt,scrollSize:qe,shouldClipSubject:He.shouldClipSubject,scroll:{initial:He.scroll,current:He.scroll,max:Nn,diff:{value:ut,displacement:ut}}}}(),at=ce==="vertical"?hi:bi,Ge=le({page:Te,withPlaceholder:null,axis:at,frame:tt}),Ke={descriptor:P,isCombineEnabled:ne,isFixedOnPage:de,axis:at,isEnabled:G,client:we,page:Te,frame:tt,subject:Ge};return Ke},fo=function(P,G){var ne=R(P);if(!G)return ne;if(P!==G)return ne;var de=ne.paddingBox.top-G.scrollTop,ce=ne.paddingBox.left-G.scrollLeft,we=de+G.scrollHeight,Te=ce+G.scrollWidth,He={top:de,right:Te,bottom:we,left:ce},tt=o(He,ne.border),at=t({borderBox:tt,margin:ne.margin,border:ne.border,padding:ne.padding});return at},Ua=function(T){var P=T.ref,G=T.descriptor,ne=T.env,de=T.windowScroll,ce=T.direction,we=T.isDropDisabled,Te=T.isCombineEnabled,He=T.shouldClipSubject,tt=ne.closestScrollable,at=fo(P,tt),Ge=S(at,de),Ke=function(){if(!tt)return null;var Rt=R(tt),Nn={scrollHeight:tt.scrollHeight,scrollWidth:tt.scrollWidth};return{client:Rt,page:S(Rt,de),scroll:Zo(tt),scrollSize:Nn,shouldClipSubject:He}}(),qe=Na({descriptor:G,isEnabled:!we,isCombineEnabled:Te,isFixedOnPage:ne.isFixedOnPage,direction:ce,client:at,page:Ge,closest:Ke});return qe},Lr={passive:!1},Wl={passive:!0},ll=function(T){return T.shouldPublishImmediately?Lr:Wl};function Ir(T){var P=Object(ie.useContext)(T);return P||te(!1),P}var Fa=function(P){return P&&P.env.closestScrollable||null};function ul(T){var P=Object(ie.useRef)(null),G=Ir(io),ne=ua("droppable"),de=G.registry,ce=G.marshal,we=La(T),Te=D(function(){return{id:T.droppableId,type:T.type,mode:T.mode}},[T.droppableId,T.mode,T.type]),He=Object(ie.useRef)(Te),tt=D(function(){return l(function(li,ki){P.current||te(!1);var Pi={x:li,y:ki};ce.updateDroppableScroll(Te.id,Pi)})},[Te.id,ce]),at=v(function(){var li=P.current;return!li||!li.env.closestScrollable?ut:Zo(li.env.closestScrollable)},[]),Ge=v(function(){var li=at();tt(li.x,li.y)},[at,tt]),Ke=D(function(){return g(Ge)},[Ge]),qe=v(function(){var li=P.current,ki=Fa(li);li&&ki||te(!1);var Pi=li.scrollOptions;if(Pi.shouldPublishImmediately){Ge();return}Ke()},[Ke,Ge]),Rt=v(function(li,ki){P.current&&te(!1);var Pi=we.current,Bi=Pi.getDroppableRef();Bi||te(!1);var Yi=Wr(Bi),e={ref:Bi,descriptor:Te,env:Yi,scrollOptions:ki};P.current=e;var n=Ua({ref:Bi,descriptor:Te,env:Yi,windowScroll:li,direction:Pi.direction,isDropDisabled:Pi.isDropDisabled,isCombineEnabled:Pi.isCombineEnabled,shouldClipSubject:!Pi.ignoreContainerClipping}),s=Yi.closestScrollable;return s&&(s.setAttribute(Ds.contextId,G.contextId),s.addEventListener("scroll",qe,ll(e.scrollOptions))),n},[G.contextId,Te,qe,we]),Nn=v(function(){var li=P.current,ki=Fa(li);return li&&ki||te(!1),Zo(ki)},[]),Wn=v(function(){var li=P.current;li||te(!1);var ki=Fa(li);if(P.current=null,!ki)return;Ke.cancel(),ki.removeAttribute(Ds.contextId),ki.removeEventListener("scroll",qe,ll(li.scrollOptions))},[qe,Ke]),ii=v(function(li){var ki=P.current;ki||te(!1);var Pi=Fa(ki);Pi||te(!1),Pi.scrollTop+=li.y,Pi.scrollLeft+=li.x},[]),ui=D(function(){return{getDimensionAndWatchScroll:Rt,getScrollWhileDragging:Nn,dragStopped:Wn,scroll:ii}},[Wn,Rt,Nn,ii]),Oi=D(function(){return{uniqueId:ne,descriptor:Te,callbacks:ui}},[ui,Te,ne]);tr(function(){return He.current=Oi.descriptor,de.droppable.register(Oi),function(){P.current&&Wn(),de.droppable.unregister(Oi)}},[ui,Te,Wn,Oi,ce,de.droppable]),tr(function(){if(!P.current)return;ce.updateDroppableIsEnabled(He.current.id,!T.isDropDisabled)},[T.isDropDisabled,ce]),tr(function(){if(!P.current)return;ce.updateDroppableIsCombineEnabled(He.current.id,T.isCombineEnabled)},[T.isCombineEnabled,ce])}function po(){}var Ba={width:0,height:0,margin:vt},ba=function(P){var G=P.isAnimatingOpenOnMount,ne=P.placeholder,de=P.animate;return G||de==="close"?Ba:{height:ne.client.borderBox.height,width:ne.client.borderBox.width,margin:ne.client.margin}},es=function(P){var G=P.isAnimatingOpenOnMount,ne=P.placeholder,de=P.animate,ce=ba({isAnimatingOpenOnMount:G,placeholder:ne,animate:de});return{display:ne.display,boxSizing:"border-box",width:ce.width,height:ce.height,marginTop:ce.margin.top,marginRight:ce.margin.right,marginBottom:ce.margin.bottom,marginLeft:ce.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:de!=="none"?qr.placeholder:null}};function ts(T){var P=Object(ie.useRef)(null),G=v(function(){if(!P.current)return;clearTimeout(P.current),P.current=null},[]),ne=T.animate,de=T.onTransitionEnd,ce=T.onClose,we=T.contextId,Te=Object(ie.useState)(T.animate==="open"),He=Te[0],tt=Te[1];Object(ie.useEffect)(function(){return He?ne!=="open"?(G(),tt(!1),po):P.current?po:(P.current=setTimeout(function(){P.current=null,tt(!1)}),G):po},[ne,He,G]);var at=v(function(Ke){if(Ke.propertyName!=="height")return;de(),ne==="close"&&ce()},[ne,ce,de]),Ge=es({isAnimatingOpenOnMount:He,animate:T.animate,placeholder:T.placeholder});return Z.a.createElement(T.placeholder.tagName,{style:Ge,"data-rbd-placeholder-context-id":we,onTransitionEnd:at,ref:T.innerRef})}var ns=Z.a.memo(ts),is=Z.a.createContext(null);function Ea(T){T&&Ra(T)||te(!1)}function mo(T){return typeof T=="boolean"}function rs(T,P){P.forEach(function(G){return G(T)})}var dl=[function(P){var G=P.props;G.droppableId||te(!1),typeof G.droppableId=="string"||te(!1)},function(P){var G=P.props;mo(G.isDropDisabled)||te(!1),mo(G.isCombineEnabled)||te(!1),mo(G.ignoreContainerClipping)||te(!1)},function(P){var G=P.getDroppableRef;Ea(G())}],vo=[function(P){var G=P.props,ne=P.getPlaceholderRef;if(!G.placeholder)return;var de=ne();if(de)return}],Hl=[function(P){var G=P.props;G.renderClone||te(!1)},function(P){var G=P.getPlaceholderRef;G()&&te(!1)}];function Kl(T){da(function(){rs(T,dl),T.props.mode==="standard"&&rs(T,vo),T.props.mode==="virtual"&&rs(T,Hl)})}var ja=function(T){Object(U.a)(P,T);function P(){for(var ne,de=arguments.length,ce=new Array(de),we=0;we<de;we++)ce[we]=arguments[we];return ne=T.call.apply(T,[this].concat(ce))||this,ne.state={isVisible:Boolean(ne.props.on),data:ne.props.on,animate:ne.props.shouldAnimate&&ne.props.on?"open":"none"},ne.onClose=function(){if(ne.state.animate!=="close")return;ne.setState({isVisible:!1})},ne}P.getDerivedStateFromProps=function(de,ce){return de.shouldAnimate?de.on?{isVisible:!0,data:de.on,animate:"open"}:ce.isVisible?{isVisible:!0,data:ce.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:Boolean(de.on),data:de.on,animate:"none"}};var G=P.prototype;return G.render=function(){if(!this.state.isVisible)return null;var de={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(de)},P}(Z.a.PureComponent),as={dragging:5e3,dropAnimating:4500},cl=function(P,G){return G?qr.drop(G.duration):P?qr.snap:qr.fluid},Gl=function(P,G){return P?G?Kr.opacity.drop:Kr.opacity.combining:null},os=function(P){return P.forceShouldAnimate!=null?P.forceShouldAnimate:P.mode==="SNAP"};function hl(T){var P=T.dimension,G=P.client,ne=T.offset,de=T.combineWith,ce=T.dropping,we=Boolean(de),Te=os(T),He=Boolean(ce),tt=He?Eo.drop(ne,we):Eo.moveTo(ne),at={position:"fixed",top:G.marginBox.top,left:G.marginBox.left,boxSizing:"border-box",width:G.borderBox.width,height:G.borderBox.height,transition:cl(Te,ce),transform:tt,opacity:Gl(we,He),zIndex:He?as.dropAnimating:as.dragging,pointerEvents:"none"};return at}function zl(T){return{transform:Eo.moveTo(T.offset),transition:T.shouldAnimateDisplacement?null:"none"}}function fl(T){return T.type==="DRAGGING"?hl(T):zl(T)}function pl(T,P,G){G===void 0&&(G=ut);var ne=window.getComputedStyle(P),de=P.getBoundingClientRect(),ce=w(de,ne),we=S(ce,G),Te={client:ce,tagName:P.tagName.toLowerCase(),display:ne.display},He={x:ce.marginBox.width,y:ce.marginBox.height},tt={descriptor:T,placeholder:Te,displaceBy:He,client:ce,page:we};return tt}function Vl(T){var P=ua("draggable"),G=T.descriptor,ne=T.registry,de=T.getDraggableRef,ce=T.canDragInteractiveElements,we=T.shouldRespectForcePress,Te=T.isEnabled,He=D(function(){return{canDragInteractiveElements:ce,shouldRespectForcePress:we,isEnabled:Te}},[ce,Te,we]),tt=v(function(qe){var Rt=de();return Rt||te(!1),pl(G,Rt,qe)},[G,de]),at=D(function(){return{uniqueId:P,descriptor:G,options:He,getDimension:tt}},[G,tt,He,P]),Ge=Object(ie.useRef)(at),Ke=Object(ie.useRef)(!0);tr(function(){return ne.draggable.register(Ge.current),function(){return ne.draggable.unregister(Ge.current)}},[ne.draggable]),tr(function(){if(Ke.current){Ke.current=!1;return}var qe=Ge.current;Ge.current=at,ne.draggable.update(at,qe)},[at,ne.draggable])}function ss(T,P,G){da(function(){function ne(ce){return"Draggable[id: "+ce+"]: "}var de=T.draggableId;if(de||te(!1),typeof de=="string"||te(!1),Se(T.index)||te(!1),T.mapped.type==="DRAGGING")return;Ea(G()),T.isEnabled&&(no(P,de)||te(!1))})}function Wa(T){Pa(function(){var P=Object(ie.useRef)(T);da(function(){T===P.current||te(!1)},[T])})}function Ha(T){T.preventDefault()}function Xl(T){var P=Object(ie.useRef)(null),G=v(function(e){P.current=e},[]),ne=v(function(){return P.current},[]),de=Ir(io),ce=de.contextId,we=de.dragHandleUsageInstructionsId,Te=de.registry,He=Ir(is),tt=He.type,at=He.droppableId,Ge=D(function(){return{id:T.draggableId,index:T.index,type:tt,droppableId:at}},[T.draggableId,T.index,tt,at]),Ke=T.children,qe=T.draggableId,Rt=T.isEnabled,Nn=T.shouldRespectForcePress,Wn=T.canDragInteractiveElements,ii=T.isClone,ui=T.mapped,Oi=T.dropAnimationFinished;if(ss(T,ce,ne),Wa(ii),!ii){var li=D(function(){return{descriptor:Ge,registry:Te,getDraggableRef:ne,canDragInteractiveElements:Wn,shouldRespectForcePress:Nn,isEnabled:Rt}},[Ge,Te,ne,Wn,Nn,Rt]);Vl(li)}var ki=D(function(){return Rt?{tabIndex:0,role:"button","aria-describedby":we,"data-rbd-drag-handle-draggable-id":qe,"data-rbd-drag-handle-context-id":ce,draggable:!1,onDragStart:Ha}:null},[ce,we,qe,Rt]),Pi=v(function(e){if(ui.type!=="DRAGGING")return;if(!ui.dropping)return;if(e.propertyName!=="transform")return;Oi()},[Oi,ui]),Bi=D(function(){var e=fl(ui),n=ui.type==="DRAGGING"&&ui.dropping?Pi:null,s={innerRef:G,draggableProps:{"data-rbd-draggable-context-id":ce,"data-rbd-draggable-id":qe,style:e,onTransitionEnd:n},dragHandleProps:ki};return s},[ce,ki,qe,ui,Pi,G]),Yi=D(function(){return{draggableId:Ge.id,type:Ge.type,source:{index:Ge.index,droppableId:Ge.droppableId}}},[Ge.droppableId,Ge.id,Ge.index,Ge.type]);return Ke(Bi,ui.snapshot,Yi)}var ls=function(T,P){return T===P},ml=function(T){var P=T.combine,G=T.destination;return G?G.droppableId:P?P.droppableId:null},Yl=function(P){return P.combine?P.combine.draggableId:null},$l=function(P){return P.at&&P.at.type==="COMBINE"?P.at.combine.draggableId:null};function Ql(){var T=l(function(de,ce){return{x:de,y:ce}}),P=l(function(de,ce,we,Te,He){return{isDragging:!0,isClone:ce,isDropAnimating:Boolean(He),dropAnimation:He,mode:de,draggingOver:we,combineWith:Te,combineTargetFor:null}}),G=l(function(de,ce,we,Te,He,tt,at){return{mapped:{type:"DRAGGING",dropping:null,draggingOver:He,combineWith:tt,mode:ce,offset:de,dimension:we,forceShouldAnimate:at,snapshot:P(ce,Te,He,tt,null)}}}),ne=function(ce,we){if(ce.isDragging){if(ce.critical.draggable.id!==we.draggableId)return null;var Te=ce.current.client.offset,He=ce.dimensions.draggables[we.draggableId],tt=yt(ce.impact),at=$l(ce.impact),Ge=ce.forceShouldAnimate;return G(T(Te.x,Te.y),ce.movementMode,He,we.isClone,tt,at,Ge)}if(ce.phase==="DROP_ANIMATING"){var Ke=ce.completed;if(Ke.result.draggableId!==we.draggableId)return null;var qe=we.isClone,Rt=ce.dimensions.draggables[we.draggableId],Nn=Ke.result,Wn=Nn.mode,ii=ml(Nn),ui=Yl(Nn),Oi=ce.dropDuration,li={duration:Oi,curve:Xa.drop,moveTo:ce.newHomeClientOffset,opacity:ui?Kr.opacity.drop:null,scale:ui?Kr.scale.drop:null};return{mapped:{type:"DRAGGING",offset:ce.newHomeClientOffset,dimension:Rt,dropping:li,draggingOver:ii,combineWith:ui,mode:Wn,forceShouldAnimate:null,snapshot:P(Wn,qe,ii,ui,li)}}}return null};return ne}function us(T){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:T,combineWith:null}}var ql={mapped:{type:"SECONDARY",offset:ut,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:us(null)}};function Jl(){var T=l(function(we,Te){return{x:we,y:Te}}),P=l(us),G=l(function(we,Te,He){return Te===void 0&&(Te=null),{mapped:{type:"SECONDARY",offset:we,combineTargetFor:Te,shouldAnimateDisplacement:He,snapshot:P(Te)}}}),ne=function(Te){return Te?G(ut,Te,!0):null},de=function(Te,He,tt,at){var Ge=tt.displaced.visible[Te],Ke=Boolean(at.inVirtualList&&at.effected[Te]),qe=pi(tt),Rt=qe&&qe.draggableId===Te?He:null;if(!Ge){if(!Ke)return ne(Rt);if(tt.displaced.invisible[Te])return null;var Nn=pn(at.displacedBy.point),Wn=T(Nn.x,Nn.y);return G(Wn,Rt,!0)}if(Ke)return ne(Rt);var ii=tt.displacedBy.point,ui=T(ii.x,ii.y);return G(ui,Rt,Ge.shouldAnimate)},ce=function(Te,He){if(Te.isDragging)return Te.critical.draggable.id===He.draggableId?null:de(He.draggableId,Te.critical.draggable.id,Te.impact,Te.afterCritical);if(Te.phase==="DROP_ANIMATING"){var tt=Te.completed;return tt.result.draggableId===He.draggableId?null:de(He.draggableId,tt.result.draggableId,tt.impact,tt.afterCritical)}return null};return ce}var vl=function(){var P=Ql(),G=Jl(),ne=function(ce,we){return P(ce,we)||G(ce,we)||ql};return ne},ds={dropAnimationFinished:er},gl=Object(M.c)(vl,ds,null,{context:Aa,pure:!0,areStatePropsEqual:ls})(Xl);function _l(T){var P=Ir(is),G=P.isUsingCloneFor;return G===T.draggableId&&!T.isClone?null:Z.a.createElement(gl,T)}function yl(T){var P=typeof T.isDragDisabled=="boolean"?!T.isDragDisabled:!0,G=Boolean(T.disableInteractiveElementBlocking),ne=Boolean(T.shouldRespectForcePress);return Z.a.createElement(_l,Object(ee.a)({},T,{isClone:!1,isEnabled:P,canDragInteractiveElements:G,shouldRespectForcePress:ne}))}function xa(T){var P=Object(ie.useContext)(io);P||te(!1);var G=P.contextId,ne=P.isMovementAllowed,de=Object(ie.useRef)(null),ce=Object(ie.useRef)(null),we=T.children,Te=T.droppableId,He=T.type,tt=T.mode,at=T.direction,Ge=T.ignoreContainerClipping,Ke=T.isDropDisabled,qe=T.isCombineEnabled,Rt=T.snapshot,Nn=T.useClone,Wn=T.updateViewportMaxScroll,ii=T.getContainerForClone,ui=v(function(){return de.current},[]),Oi=v(function(a){de.current=a},[]),li=v(function(){return ce.current},[]),ki=v(function(a){ce.current=a},[]);Kl({props:T,getDroppableRef:ui,getPlaceholderRef:li});var Pi=v(function(){ne()&&Wn({maxScroll:ko()})},[ne,Wn]);ul({droppableId:Te,type:He,mode:tt,direction:at,isDropDisabled:Ke,isCombineEnabled:qe,ignoreContainerClipping:Ge,getDroppableRef:ui});var Bi=Z.a.createElement(ja,{on:T.placeholder,shouldAnimate:T.shouldAnimatePlaceholder},function(a){var m=a.onClose,B=a.data,J=a.animate;return Z.a.createElement(ns,{placeholder:B,onClose:m,innerRef:ki,animate:J,contextId:G,onTransitionEnd:Pi})}),Yi=D(function(){return{innerRef:Oi,placeholder:Bi,droppableProps:{"data-rbd-droppable-id":Te,"data-rbd-droppable-context-id":G}}},[G,Te,Bi,Oi]),e=Nn?Nn.dragging.draggableId:null,n=D(function(){return{droppableId:Te,type:He,isUsingCloneFor:e}},[Te,e,He]);function s(){if(!Nn)return null;var a=Nn.dragging,m=Nn.render,B=Z.a.createElement(_l,{draggableId:a.draggableId,index:a.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},function(J,re){return m(J,re,a)});return F.a.createPortal(B,ii())}return Z.a.createElement(is.Provider,{value:n},we(Yi,Rt),s())}var go=function(P,G){return P===G.droppable.type},Ka=function(P,G){return G.draggables[P.draggable.id]},Zl=function(){var P={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},G=Object(ee.a)({},P,{shouldAnimatePlaceholder:!1}),ne=l(function(we){return{draggableId:we.id,type:we.type,source:{index:we.index,droppableId:we.droppableId}}}),de=l(function(we,Te,He,tt,at,Ge){var Ke=at.descriptor.id,qe=at.descriptor.droppableId===we;if(qe){var Rt=Ge?{render:Ge,dragging:ne(at.descriptor)}:null,Nn={isDraggingOver:He,draggingOverWith:He?Ke:null,draggingFromThisWith:Ke,isUsingPlaceholder:!0};return{placeholder:at.placeholder,shouldAnimatePlaceholder:!1,snapshot:Nn,useClone:Rt}}if(!Te)return G;if(!tt)return P;var Wn={isDraggingOver:He,draggingOverWith:Ke,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:at.placeholder,shouldAnimatePlaceholder:!0,snapshot:Wn,useClone:null}}),ce=function(Te,He){var tt=He.droppableId,at=He.type,Ge=!He.isDropDisabled,Ke=He.renderClone;if(Te.isDragging){var qe=Te.critical;if(!go(at,qe))return G;var Rt=Ka(qe,Te.dimensions),Nn=yt(Te.impact)===tt;return de(tt,Ge,Nn,Nn,Rt,Ke)}if(Te.phase==="DROP_ANIMATING"){var Wn=Te.completed;if(!go(at,Wn.critical))return G;var ii=Ka(Wn.critical,Te.dimensions);return de(tt,Ge,ml(Wn.result)===tt,yt(Wn.impact)===tt,ii,Ke)}if(Te.phase==="IDLE"&&Te.completed&&!Te.shouldFlush){var ui=Te.completed;if(!go(at,ui.critical))return G;var Oi=yt(ui.impact)===tt,li=Boolean(ui.impact.at&&ui.impact.at.type==="COMBINE"),ki=ui.critical.droppable.id===tt;return Oi?li?P:G:ki?P:G}return G};return ce},eu={updateViewportMaxScroll:Ei};function tu(){return document.body||te(!1),document.body}var Hi={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:tu},bl=Object(M.c)(Zl,eu,null,{context:Aa,pure:!0,areStatePropsEqual:ls})(xa);bl.defaultProps=Hi},osHv:function(zt,st,V){(function(ie){ie(V("VrN/"))})(function(ie){"use strict";var Z=ie.Pos;function U(i,t){return i.line-t.line||i.ch-t.ch}var ee="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",H=ee+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",M=new RegExp("<(/?)(["+ee+"]["+H+"]*)","g");function Y(i,t,c,f){this.line=t,this.ch=c,this.cm=i,this.text=i.getLine(t),this.min=f?Math.max(f.from,i.firstLine()):i.firstLine(),this.max=f?Math.min(f.to-1,i.lastLine()):i.lastLine()}function X(i,t){var c=i.cm.getTokenTypeAt(Z(i.line,t));return c&&/\btag\b/.test(c)}function k(i){return i.line>=i.max?void 0:(i.ch=0,i.text=i.cm.getLine(++i.line),!0)}function D(i){return i.line<=i.min?void 0:(i.text=i.cm.getLine(--i.line),i.ch=i.text.length,!0)}function v(i){for(;;){var t=i.text.indexOf(">",i.ch);if(t==-1){if(k(i))continue;return}if(!X(i,t+1)){i.ch=t+1;continue}var c=i.text.lastIndexOf("/",t),f=c>-1&&!/\S/.test(i.text.slice(c+1,t));return i.ch=t+1,f?"selfClose":"regular"}}function _(i){for(;;){var t=i.ch?i.text.lastIndexOf("<",i.ch-1):-1;if(t==-1){if(D(i))continue;return}if(!X(i,t+1)){i.ch=t;continue}M.lastIndex=t,i.ch=t;var c=M.exec(i.text);if(c&&c.index==t)return c}}function p(i){for(;;){M.lastIndex=i.ch;var t=M.exec(i.text);if(!t){if(k(i))continue;return}if(!X(i,t.index+1)){i.ch=t.index+1;continue}return i.ch=t.index+t[0].length,t}}function o(i){for(;;){var t=i.ch?i.text.lastIndexOf(">",i.ch-1):-1;if(t==-1){if(D(i))continue;return}if(!X(i,t+1)){i.ch=t;continue}var c=i.text.lastIndexOf("/",t),f=c>-1&&!/\S/.test(i.text.slice(c+1,t));return i.ch=t+1,f?"selfClose":"regular"}}function u(i,t){for(var c=[];;){var f=p(i),A,S=i.line,w=i.ch-(f?f[0].length:0);if(!f||!(A=v(i)))return;if(A=="selfClose")continue;if(f[1]){for(var R=c.length-1;R>=0;--R)if(c[R]==f[2]){c.length=R;break}if(R<0&&(!t||t==f[2]))return{tag:f[2],from:Z(S,w),to:Z(i.line,i.ch)}}else c.push(f[2])}}function r(i,t){for(var c=[];;){var f=o(i);if(!f)return;if(f=="selfClose"){_(i);continue}var A=i.line,S=i.ch,w=_(i);if(!w)return;if(w[1])c.push(w[2]);else{for(var R=c.length-1;R>=0;--R)if(c[R]==w[2]){c.length=R;break}if(R<0&&(!t||t==w[2]))return{tag:w[2],from:Z(i.line,i.ch),to:Z(A,S)}}}}ie.registerHelper("fold","xml",function(i,t){for(var c=new Y(i,t.line,0);;){var f=p(c);if(!f||c.line!=t.line)return;var A=v(c);if(!A)return;if(!f[1]&&A!="selfClose"){var S=Z(c.line,c.ch),w=u(c,f[2]);return w&&U(w.from,S)>0?{from:S,to:w.from}:null}}}),ie.findMatchingTag=function(i,t,c){var f=new Y(i,t.line,t.ch,c);if(f.text.indexOf(">")==-1&&f.text.indexOf("<")==-1)return;var A=v(f),S=A&&Z(f.line,f.ch),w=A&&_(f);if(!A||!w||U(f,t)>0)return;var R={from:Z(f.line,f.ch),to:S,tag:w[2]};return A=="selfClose"?{open:R,close:null,at:"open"}:w[1]?{open:r(f,w[2]),close:R,at:"close"}:(f=new Y(i,S.line,S.ch,c),{open:R,close:u(f,w[2]),at:"open"})},ie.findEnclosingTag=function(i,t,c,f){for(var A=new Y(i,t.line,t.ch,c);;){var S=r(A,f);if(!S)break;var w=new Y(i,t.line,t.ch,c),R=u(w,S.tag);if(R)return{open:S,close:R}}},ie.scanForClosingTag=function(i,t,c,f){var A=new Y(i,t.line,t.ch,f?{from:0,to:f}:null);return u(A,c)}})},p5ED:function(zt,st,V){"use strict";var ie=V("+L6B"),Z=V("2/Rp"),U=V("5Dmo"),ee=V("3S7+"),H=V("k1fw"),M=V("tJVT"),Y=V("q1tI"),X=V.n(Y),k=V("vHTk"),D=V.n(k),v=V("yEEn"),_=V("ZW9T"),p=V("1vsH");st.a=function(o){var u=o.name,r=o.data,i=o.theme,t=o.type,c=o.filename,f=o.monacoEditor,A=o.className,S=o.style,w=o.close,R=o.onClose,O=o.hasMask,E=Object(Y.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),y=Object(M.a)(E,2),d=y[0],l=y[1],h=Object(Y.useState)(""),g=Object(M.a)(h,2),b=g[0],F=g[1],N,W=1024*1024,K=10*W,I=Object(Y.useRef)();t==="office"&&(N=Object(p.T)(r).filesize,N>K&&(t="other")),c&&(f.filename=c),Object(Y.useEffect)(function(){var $,ae,fe=($=document.cookie)===null||$===void 0||((ae=$.replace(/\s/g,""))===null||ae===void 0)?void 0:ae.split(";");fe==null||fe.map(function(pe){var Ce=pe.split("=");Ce[0]==="_educoder_session"&&F(Ce[1])})},[]);var x=function(){if(r.startsWith("http")||r.startsWith("/")){j();return}Object(p.z)(c||"educoder",r,c)},j=function(){Object(p.x)(c||u,r)};return console.log("data:",r,"fileanme:",c," name:",u),X.a.createElement("div",{style:Object(H.a)({},S||{}),className:"".concat(O&&D.a.bgBlack," ").concat(t?D.a.wrp:"hide")},w&&X.a.createElement("div",{className:D.a.close,ref:I},X.a.createElement(ee.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return I.current}},X.a.createElement("span",{onClick:j},X.a.createElement("i",{className:"icon-quxiaozhiding"}))),X.a.createElement(ee.a,{title:"\u5173\u95ED",getPopupContainer:function(){return I.current}},X.a.createElement("span",{className:"",onClick:R},X.a.createElement("i",{className:"icon-guanbi1"})))),X.a.createElement("div",{className:"".concat(D.a[A]," ").concat(A," ").concat(D.a.monaco," ").concat(t==="txt"?"show":"hide")},t==="txt"&&X.a.createElement(_.b,f)),t==="audio"&&X.a.createElement("audio",{src:"".concat(r!=null&&r.startsWith("/")||(r==null?void 0:r.indexOf("https://"))>-1?r:"data:audio/mp3;base64,").concat(r),autoPlay:!0}),t==="video"&&X.a.createElement(X.a.Fragment,null,r!=null&&r.startsWith("/")?X.a.createElement("video",{controls:!0,src:"".concat(r),autoPlay:!0}):X.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(r),autoPlay:!0})),t==="html"&&X.a.createElement("iframe",{src:r+"&disposition=inline"}),t==="pdf"&&X.a.createElement("embed",{className:D.a.embed,src:r}),t==="image"&&X.a.createElement(X.a.Fragment,null,X.a.createElement("img",{src:"".concat(r!=null&&r.startsWith("/")||(r==null?void 0:r.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(r)})),t==="other"&&X.a.createElement("div",null,X.a.createElement(Z.a,{type:"primary",size:"large",onClick:x},X.a.createElement(v.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(t==="download"||t==="office")&&X.a.createElement(Z.a,{type:"primary",size:"large",onClick:x},X.a.createElement(v.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(zt,st,V){},psGv:function(zt,st,V){var ie,Z;(function(){var U;(function(){"use strict";var Y=[,,function(v){function _(u){this.__parent=u,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}_.prototype.clone_empty=function(){var u=new _(this.__parent);return u.set_indent(this.__indent_count,this.__alignment_count),u},_.prototype.item=function(u){return u<0?this.__items[this.__items.length+u]:this.__items[u]},_.prototype.has_match=function(u){for(var r=this.__items.length-1;r>=0;r--)if(this.__items[r].match(u))return!0;return!1},_.prototype.set_indent=function(u,r){this.is_empty()&&(this.__indent_count=u||0,this.__alignment_count=r||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},_.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},_.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},_.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var u=this.__parent.current_line;return u.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),u.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),u.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,u.__items[0]===" "&&(u.__items.splice(0,1),u.__character_count-=1),!0}return!1},_.prototype.is_empty=function(){return this.__items.length===0},_.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},_.prototype.push=function(u){this.__items.push(u);var r=u.lastIndexOf(`
|
|
`);r!==-1?this.__character_count=u.length-r:this.__character_count+=u.length},_.prototype.pop=function(){var u=null;return this.is_empty()||(u=this.__items.pop(),this.__character_count-=u.length),u},_.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},_.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},_.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},_.prototype.toString=function(){var u="";return this.is_empty()?this.__parent.indent_empty_lines&&(u=this.__parent.get_indent_string(this.__indent_count)):(u=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),u+=this.__items.join("")),u};function p(u,r){this.__cache=[""],this.__indent_size=u.indent_size,this.__indent_string=u.indent_char,u.indent_with_tabs||(this.__indent_string=new Array(u.indent_size+1).join(u.indent_char)),r=r||"",u.indent_level>0&&(r=new Array(u.indent_level+1).join(this.__indent_string)),this.__base_string=r,this.__base_string_length=r.length}p.prototype.get_indent_size=function(u,r){var i=this.__base_string_length;return r=r||0,u<0&&(i=0),i+=u*this.__indent_size,i+=r,i},p.prototype.get_indent_string=function(u,r){var i=this.__base_string;return r=r||0,u<0&&(u=0,i=""),r+=u*this.__indent_size,this.__ensure_cache(r),i+=this.__cache[r],i},p.prototype.__ensure_cache=function(u){for(;u>=this.__cache.length;)this.__add_column()},p.prototype.__add_column=function(){var u=this.__cache.length,r=0,i="";this.__indent_size&&u>=this.__indent_size&&(r=Math.floor(u/this.__indent_size),u-=r*this.__indent_size,i=new Array(r+1).join(this.__indent_string)),u&&(i+=new Array(u+1).join(" ")),this.__cache.push(i)};function o(u,r){this.__indent_cache=new p(u,r),this.raw=!1,this._end_with_newline=u.end_with_newline,this.indent_size=u.indent_size,this.wrap_line_length=u.wrap_line_length,this.indent_empty_lines=u.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new _(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}o.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},o.prototype.get_line_number=function(){return this.__lines.length},o.prototype.get_indent_string=function(u,r){return this.__indent_cache.get_indent_string(u,r)},o.prototype.get_indent_size=function(u,r){return this.__indent_cache.get_indent_size(u,r)},o.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},o.prototype.add_new_line=function(u){return this.is_empty()||!u&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},o.prototype.get_code=function(u){this.trim(!0);var r=this.current_line.pop();r&&(r[r.length-1]===`
|
|
`&&(r=r.replace(/\n+$/g,"")),this.current_line.push(r)),this._end_with_newline&&this.__add_outputline();var i=this.__lines.join(`
|
|
`);return u!==`
|
|
`&&(i=i.replace(/[\n]/g,u)),i},o.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},o.prototype.set_indent=function(u,r){return u=u||0,r=r||0,this.next_line.set_indent(u,r),this.__lines.length>1?(this.current_line.set_indent(u,r),!0):(this.current_line.set_indent(),!1)},o.prototype.add_raw_token=function(u){for(var r=0;r<u.newlines;r++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(u.whitespace_before),this.current_line.push(u.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},o.prototype.add_token=function(u){this.__add_space_before_token(),this.current_line.push(u),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},o.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},o.prototype.remove_indent=function(u){for(var r=this.__lines.length;u<r;)this.__lines[u]._remove_indent(),u++;this.current_line._remove_wrap_indent()},o.prototype.trim=function(u){for(u=u===void 0?!1:u,this.current_line.trim();u&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},o.prototype.just_added_newline=function(){return this.current_line.is_empty()},o.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},o.prototype.ensure_empty_line_above=function(u,r){for(var i=this.__lines.length-2;i>=0;){var t=this.__lines[i];if(t.is_empty())break;if(t.item(0).indexOf(u)!==0&&t.item(-1)!==r){this.__lines.splice(i+1,0,new _(this)),this.previous_line=this.__lines[this.__lines.length-2];break}i--}},v.exports.Output=o},function(v){function _(p,o,u,r){this.type=p,this.text=o,this.comments_before=null,this.newlines=u||0,this.whitespace_before=r||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}v.exports.Token=_},,,function(v){function _(u,r){this.raw_options=p(u,r),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}_.prototype._get_array=function(u,r){var i=this.raw_options[u],t=r||[];return typeof i=="object"?i!==null&&typeof i.concat=="function"&&(t=i.concat()):typeof i=="string"&&(t=i.split(/[^a-zA-Z0-9_\/\-]+/)),t},_.prototype._get_boolean=function(u,r){var i=this.raw_options[u],t=i===void 0?!!r:!!i;return t},_.prototype._get_characters=function(u,r){var i=this.raw_options[u],t=r||"";return typeof i=="string"&&(t=i.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),t},_.prototype._get_number=function(u,r){var i=this.raw_options[u];r=parseInt(r,10),isNaN(r)&&(r=0);var t=parseInt(i,10);return isNaN(t)&&(t=r),t},_.prototype._get_selection=function(u,r,i){var t=this._get_selection_list(u,r,i);if(t.length!==1)throw new Error("Invalid Option Value: The option '"+u+`' can only be one of the following values:
|
|
`+r+`
|
|
You passed in: '`+this.raw_options[u]+"'");return t[0]},_.prototype._get_selection_list=function(u,r,i){if(!r||r.length===0)throw new Error("Selection list cannot be empty.");if(i=i||[r[0]],!this._is_valid_selection(i,r))throw new Error("Invalid Default Value!");var t=this._get_array(u,i);if(!this._is_valid_selection(t,r))throw new Error("Invalid Option Value: The option '"+u+`' can contain only the following values:
|
|
`+r+`
|
|
You passed in: '`+this.raw_options[u]+"'");return t},_.prototype._is_valid_selection=function(u,r){return u.length&&r.length&&!u.some(function(i){return r.indexOf(i)===-1})};function p(u,r){var i={};u=o(u);var t;for(t in u)t!==r&&(i[t]=u[t]);if(r&&u[r])for(t in u[r])i[t]=u[r][t];return i}function o(u){var r={},i;for(i in u){var t=i.replace(/-/g,"_");r[t]=u[i]}return r}v.exports.Options=_,v.exports.normalizeOpts=o,v.exports.mergeOpts=p},,function(v){var _=RegExp.prototype.hasOwnProperty("sticky");function p(o){this.__input=o||"",this.__input_length=this.__input.length,this.__position=0}p.prototype.restart=function(){this.__position=0},p.prototype.back=function(){this.__position>0&&(this.__position-=1)},p.prototype.hasNext=function(){return this.__position<this.__input_length},p.prototype.next=function(){var o=null;return this.hasNext()&&(o=this.__input.charAt(this.__position),this.__position+=1),o},p.prototype.peek=function(o){var u=null;return o=o||0,o+=this.__position,o>=0&&o<this.__input_length&&(u=this.__input.charAt(o)),u},p.prototype.__match=function(o,u){o.lastIndex=u;var r=o.exec(this.__input);return r&&!(_&&o.sticky)&&(r.index!==u&&(r=null)),r},p.prototype.test=function(o,u){return u=u||0,u+=this.__position,u>=0&&u<this.__input_length?!!this.__match(o,u):!1},p.prototype.testChar=function(o,u){var r=this.peek(u);return o.lastIndex=0,r!==null&&o.test(r)},p.prototype.match=function(o){var u=this.__match(o,this.__position);return u?this.__position+=u[0].length:u=null,u},p.prototype.read=function(o,u,r){var i="",t;return o&&(t=this.match(o),t&&(i+=t[0])),u&&(t||!o)&&(i+=this.readUntil(u,r)),i},p.prototype.readUntil=function(o,u){var r="",i=this.__position;o.lastIndex=this.__position;var t=o.exec(this.__input);return t?(i=t.index,u&&(i+=t[0].length)):i=this.__input_length,r=this.__input.substring(this.__position,i),this.__position=i,r},p.prototype.readUntilAfter=function(o){return this.readUntil(o,!0)},p.prototype.get_regexp=function(o,u){var r=null,i="g";return u&&_&&(i="y"),typeof o=="string"&&o!==""?r=new RegExp(o,i):o&&(r=new RegExp(o.source,i)),r},p.prototype.get_literal_regexp=function(o){return RegExp(o.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},p.prototype.peekUntilAfter=function(o){var u=this.__position,r=this.readUntilAfter(o);return this.__position=u,r},p.prototype.lookBack=function(o){var u=this.__position-1;return u>=o.length&&this.__input.substring(u-o.length,u).toLowerCase()===o},v.exports.InputScanner=p},function(v,_,p){var o=p(8).InputScanner,u=p(3).Token,r=p(10).TokenStream,i=p(11).WhitespacePattern,t={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},c=function(f,A){this._input=new o(f),this._options=A||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new i(this._input)};c.prototype.tokenize=function(){this._input.restart(),this.__tokens=new r,this._reset();for(var f,A=new u(t.START,""),S=null,w=[],R=new r;A.type!==t.EOF;){for(f=this._get_next_token(A,S);this._is_comment(f);)R.add(f),f=this._get_next_token(A,S);R.isEmpty()||(f.comments_before=R,R=new r),f.parent=S,this._is_opening(f)?(w.push(S),S=f):S&&this._is_closing(f,S)&&(f.opened=S,S.closed=f,S=w.pop(),f.parent=S),f.previous=A,A.next=f,this.__tokens.add(f),A=f}return this.__tokens},c.prototype._is_first_token=function(){return this.__tokens.isEmpty()},c.prototype._reset=function(){},c.prototype._get_next_token=function(f,A){this._readWhitespace();var S=this._input.read(/.+/g);return S?this._create_token(t.RAW,S):this._create_token(t.EOF,"")},c.prototype._is_comment=function(f){return!1},c.prototype._is_opening=function(f){return!1},c.prototype._is_closing=function(f,A){return!1},c.prototype._create_token=function(f,A){var S=new u(f,A,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return S},c.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},v.exports.Tokenizer=c,v.exports.TOKEN=t},function(v){function _(p){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=p}_.prototype.restart=function(){this.__position=0},_.prototype.isEmpty=function(){return this.__tokens_length===0},_.prototype.hasNext=function(){return this.__position<this.__tokens_length},_.prototype.next=function(){var p=null;return this.hasNext()&&(p=this.__tokens[this.__position],this.__position+=1),p},_.prototype.peek=function(p){var o=null;return p=p||0,p+=this.__position,p>=0&&p<this.__tokens_length&&(o=this.__tokens[p]),o},_.prototype.add=function(p){this.__parent_token&&(p.parent=this.__parent_token),this.__tokens.push(p),this.__tokens_length+=1},v.exports.TokenStream=_},function(v,_,p){var o=p(12).Pattern;function u(r,i){o.call(this,r,i),i?this._line_regexp=this._input.get_regexp(i._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}u.prototype=new o,u.prototype.__set_whitespace_patterns=function(r,i){r+="\\t ",i+="\\n\\r",this._match_pattern=this._input.get_regexp("["+r+i+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+i+"]")},u.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var r=this._input.read(this._match_pattern);if(r===" ")this.whitespace_before_token=" ";else if(r){var i=this.__split(this._newline_regexp,r);this.newline_count=i.length-1,this.whitespace_before_token=i[this.newline_count]}return r},u.prototype.matching=function(r,i){var t=this._create();return t.__set_whitespace_patterns(r,i),t._update(),t},u.prototype._create=function(){return new u(this._input,this)},u.prototype.__split=function(r,i){r.lastIndex=0;for(var t=0,c=[],f=r.exec(i);f;)c.push(i.substring(t,f.index)),t=f.index+f[0].length,f=r.exec(i);return t<i.length?c.push(i.substring(t,i.length)):c.push(""),c},v.exports.WhitespacePattern=u},function(v){function _(p,o){this._input=p,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,o&&(this._starting_pattern=this._input.get_regexp(o._starting_pattern,!0),this._match_pattern=this._input.get_regexp(o._match_pattern,!0),this._until_pattern=this._input.get_regexp(o._until_pattern),this._until_after=o._until_after)}_.prototype.read=function(){var p=this._input.read(this._starting_pattern);return(!this._starting_pattern||p)&&(p+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),p},_.prototype.read_match=function(){return this._input.match(this._match_pattern)},_.prototype.until_after=function(p){var o=this._create();return o._until_after=!0,o._until_pattern=this._input.get_regexp(p),o._update(),o},_.prototype.until=function(p){var o=this._create();return o._until_after=!1,o._until_pattern=this._input.get_regexp(p),o._update(),o},_.prototype.starting_with=function(p){var o=this._create();return o._starting_pattern=this._input.get_regexp(p,!0),o._update(),o},_.prototype.matching=function(p){var o=this._create();return o._match_pattern=this._input.get_regexp(p,!0),o._update(),o},_.prototype._create=function(){return new _(this._input,this)},_.prototype._update=function(){},v.exports.Pattern=_},function(v){function _(p,o){p=typeof p=="string"?p:p.source,o=typeof o=="string"?o:o.source,this.__directives_block_pattern=new RegExp(p+/ beautify( \w+[:]\w+)+ /.source+o,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(p+/\sbeautify\signore:end\s/.source+o,"g")}_.prototype.get_directives=function(p){if(!p.match(this.__directives_block_pattern))return null;var o={};this.__directive_pattern.lastIndex=0;for(var u=this.__directive_pattern.exec(p);u;)o[u[1]]=u[2],u=this.__directive_pattern.exec(p);return o},_.prototype.readIgnored=function(p){return p.readUntilAfter(this.__directives_end_ignore_pattern)},v.exports.Directives=_},function(v,_,p){var o=p(12).Pattern,u={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function r(i,t){o.call(this,i,t),this.__template_pattern=null,this._disabled=Object.assign({},u),this._excluded=Object.assign({},u),t&&(this.__template_pattern=this._input.get_regexp(t.__template_pattern),this._excluded=Object.assign(this._excluded,t._excluded),this._disabled=Object.assign(this._disabled,t._disabled));var c=new o(i);this.__patterns={handlebars_comment:c.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:c.starting_with(/{{{/).until_after(/}}}/),handlebars:c.starting_with(/{{/).until_after(/}}/),php:c.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:c.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:c.starting_with(/{%/).until_after(/%}/),django_value:c.starting_with(/{{/).until_after(/}}/),django_comment:c.starting_with(/{#/).until_after(/#}/),smarty:c.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:c.starting_with(/{\*/).until_after(/\*}/),smarty_literal:c.starting_with(/{literal}/).until_after(/{\/literal}/)}}r.prototype=new o,r.prototype._create=function(){return new r(this._input,this)},r.prototype._update=function(){this.__set_templated_pattern()},r.prototype.disable=function(i){var t=this._create();return t._disabled[i]=!0,t._update(),t},r.prototype.read_options=function(i){var t=this._create();for(var c in u)t._disabled[c]=i.templating.indexOf(c)===-1;return t._update(),t},r.prototype.exclude=function(i){var t=this._create();return t._excluded[i]=!0,t._update(),t},r.prototype.read=function(){var i="";this._match_pattern?i=this._input.read(this._starting_pattern):i=this._input.read(this._starting_pattern,this.__template_pattern);for(var t=this._read_template();t;)this._match_pattern?t+=this._input.read(this._match_pattern):t+=this._input.readUntil(this.__template_pattern),i+=t,t=this._read_template();return this._until_after&&(i+=this._input.readUntilAfter(this._until_pattern)),i},r.prototype.__set_templated_pattern=function(){var i=[];this._disabled.php||i.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||i.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||i.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(i.push(this.__patterns.django._starting_pattern.source),i.push(this.__patterns.django_value._starting_pattern.source),i.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||i.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&i.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+i.join("|")+")")},r.prototype._read_template=function(){var i="",t=this._input.peek();if(t==="<"){var c=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&c==="?"&&(i=i||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&c==="%"&&(i=i||this.__patterns.erb.read())}else t==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(i=i||this.__patterns.handlebars_comment.read(),i=i||this.__patterns.handlebars_unescaped.read(),i=i||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(i=i||this.__patterns.django_value.read()),this._excluded.django||(i=i||this.__patterns.django_comment.read(),i=i||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(i=i||this.__patterns.smarty_comment.read(),i=i||this.__patterns.smarty_literal.read(),i=i||this.__patterns.smarty.read()));return i},v.exports.TemplatablePattern=r},,,,function(v,_,p){var o=p(19).Beautifier,u=p(20).Options;function r(i,t,c,f){var A=new o(i,t,c,f);return A.beautify()}v.exports=r,v.exports.defaultOptions=function(){return new u}},function(v,_,p){var o=p(20).Options,u=p(2).Output,r=p(21).Tokenizer,i=p(21).TOKEN,t=/\r\n|[\r\n]/,c=/\r\n|[\r\n]/g,f=function(h,g){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=h.max_preserve_newlines,this.preserve_newlines=h.preserve_newlines,this._output=new u(h,g)};f.prototype.current_line_has_match=function(h){return this._output.current_line.has_match(h)},f.prototype.set_space_before_token=function(h,g){this._output.space_before_token=h,this._output.non_breaking_space=g},f.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},f.prototype.add_raw_token=function(h){this._output.add_raw_token(h)},f.prototype.print_preserved_newlines=function(h){var g=0;h.type!==i.TEXT&&h.previous.type!==i.TEXT&&(g=h.newlines?1:0),this.preserve_newlines&&(g=h.newlines<this.max_preserve_newlines+1?h.newlines:this.max_preserve_newlines+1);for(var b=0;b<g;b++)this.print_newline(b>0);return g!==0},f.prototype.traverse_whitespace=function(h){return h.whitespace_before||h.newlines?(this.print_preserved_newlines(h)||(this._output.space_before_token=!0),!0):!1},f.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},f.prototype.print_newline=function(h){this._output.add_new_line(h)},f.prototype.print_token=function(h){h.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(h.text))},f.prototype.indent=function(){this.indent_level++},f.prototype.get_full_indent=function(h){return h=this.indent_level+(h||0),h<1?"":this._output.get_indent_string(h)};var A=function(h){for(var g=null,b=h.next;b.type!==i.EOF&&h.closed!==b;){if(b.type===i.ATTRIBUTE&&b.text==="type"){b.next&&b.next.type===i.EQUALS&&b.next.next&&b.next.next.type===i.VALUE&&(g=b.next.next.text);break}b=b.next}return g},S=function(h,g){var b=null,F=null;return g.closed?(h==="script"?b="text/javascript":h==="style"&&(b="text/css"),b=A(g)||b,b.search("text/css")>-1?F="css":b.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?F="javascript":b.search(/(text|application|dojo)\/(x-)?(html)/)>-1?F="html":b.search(/test\/null/)>-1&&(F="null"),F):null};function w(h,g){return g.indexOf(h)!==-1}function R(h,g,b){this.parent=h||null,this.tag=g?g.tag_name:"",this.indent_level=b||0,this.parser_token=g||null}function O(h){this._printer=h,this._current_frame=null}O.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},O.prototype.record_tag=function(h){var g=new R(this._current_frame,h,this._printer.indent_level);this._current_frame=g},O.prototype._try_pop_frame=function(h){var g=null;return h&&(g=h.parser_token,this._printer.indent_level=h.indent_level,this._current_frame=h.parent),g},O.prototype._get_frame=function(h,g){for(var b=this._current_frame;b&&!(h.indexOf(b.tag)!==-1);){if(g&&g.indexOf(b.tag)!==-1){b=null;break}b=b.parent}return b},O.prototype.try_pop=function(h,g){var b=this._get_frame([h],g);return this._try_pop_frame(b)},O.prototype.indent_to_tag=function(h){var g=this._get_frame(h);g&&(this._printer.indent_level=g.indent_level)};function E(h,g,b,F){this._source_text=h||"",g=g||{},this._js_beautify=b,this._css_beautify=F,this._tag_stack=null;var N=new o(g,"html");this._options=N,this._is_wrap_attributes_force=this._options.wrap_attributes.substr(0,"force".length)==="force",this._is_wrap_attributes_force_expand_multiline=this._options.wrap_attributes==="force-expand-multiline",this._is_wrap_attributes_force_aligned=this._options.wrap_attributes==="force-aligned",this._is_wrap_attributes_aligned_multiple=this._options.wrap_attributes==="aligned-multiple",this._is_wrap_attributes_preserve=this._options.wrap_attributes.substr(0,"preserve".length)==="preserve",this._is_wrap_attributes_preserve_aligned=this._options.wrap_attributes==="preserve-aligned"}E.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var h=this._source_text,g=this._options.eol;this._options.eol==="auto"&&(g=`
|
|
`,h&&t.test(h)&&(g=h.match(t)[0])),h=h.replace(c,`
|
|
`);var b=h.match(/^[\t ]*/)[0],F={text:"",type:""},N=new y,W=new f(this._options,b),K=new r(h,this._options).tokenize();this._tag_stack=new O(W);for(var I=null,x=K.next();x.type!==i.EOF;)x.type===i.TAG_OPEN||x.type===i.COMMENT?(I=this._handle_tag_open(W,x,N,F),N=I):x.type===i.ATTRIBUTE||x.type===i.EQUALS||x.type===i.VALUE||x.type===i.TEXT&&!N.tag_complete?I=this._handle_inside_tag(W,x,N,K):x.type===i.TAG_CLOSE?I=this._handle_tag_close(W,x,N):x.type===i.TEXT?I=this._handle_text(W,x,N):W.add_raw_token(x),F=I,x=K.next();var j=W._output.get_code(g);return j},E.prototype._handle_tag_close=function(h,g,b){var F={text:g.text,type:g.type};return h.alignment_size=0,b.tag_complete=!0,h.set_space_before_token(g.newlines||g.whitespace_before!=="",!0),b.is_unformatted?h.add_raw_token(g):(b.tag_start_char==="<"&&(h.set_space_before_token(g.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&b.has_wrapped_attrs&&h.print_newline(!1)),h.print_token(g)),b.indent_content&&!(b.is_unformatted||b.is_content_unformatted)&&(h.indent(),b.indent_content=!1),!b.is_inline_element&&!(b.is_unformatted||b.is_content_unformatted)&&h.set_wrap_point(),F},E.prototype._handle_inside_tag=function(h,g,b,F){var N=b.has_wrapped_attrs,W={text:g.text,type:g.type};if(h.set_space_before_token(g.newlines||g.whitespace_before!=="",!0),b.is_unformatted)h.add_raw_token(g);else if(b.tag_start_char==="{"&&g.type===i.TEXT)h.print_preserved_newlines(g)?(g.newlines=0,h.add_raw_token(g)):h.print_token(g);else{if(g.type===i.ATTRIBUTE?(h.set_space_before_token(!0),b.attr_count+=1):(g.type===i.EQUALS||g.type===i.VALUE&&g.previous.type===i.EQUALS)&&h.set_space_before_token(!1),g.type===i.ATTRIBUTE&&b.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(h.traverse_whitespace(g),N=N||g.newlines!==0),this._is_wrap_attributes_force)){var K=b.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&b.attr_count===1){var I=!0,x=0,j;do{if(j=F.peek(x),j.type===i.ATTRIBUTE){I=!1;break}x+=1}while(x<4&&j.type!==i.EOF&&j.type!==i.TAG_CLOSE);K=!I}K&&(h.print_newline(!1),N=!0)}h.print_token(g),N=N||h.previous_token_wrapped(),b.has_wrapped_attrs=N}return W},E.prototype._handle_text=function(h,g,b){var F={text:g.text,type:"TK_CONTENT"};return b.custom_beautifier_name?this._print_custom_beatifier_text(h,g,b):b.is_unformatted||b.is_content_unformatted?h.add_raw_token(g):(h.traverse_whitespace(g),h.print_token(g)),F},E.prototype._print_custom_beatifier_text=function(h,g,b){var F=this;if(g.text!==""){var N=g.text,W,K=1,I="",x="";b.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?W=this._js_beautify:b.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?W=this._css_beautify:b.custom_beautifier_name==="html"&&(W=function(Ce,De){var xe=new E(Ce,De,F._js_beautify,F._css_beautify);return xe.beautify()}),this._options.indent_scripts==="keep"?K=0:this._options.indent_scripts==="separate"&&(K=-h.indent_level);var j=h.get_full_indent(K);if(N=N.replace(/\n[ \t]*$/,""),b.custom_beautifier_name!=="html"&&N[0]==="<"&&N.match(/^(<!--|<!\[CDATA\[)/)){var $=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(N);if(!$){h.add_raw_token(g);return}I=j+$[1]+`
|
|
`,N=$[4],$[5]&&(x=j+$[5]),N=N.replace(/\n[ \t]*$/,""),($[2]||$[3].indexOf(`
|
|
`)!==-1)&&($=$[3].match(/[ \t]+$/),$&&(g.whitespace_before=$[0]))}if(N)if(W){var ae=function(){this.eol=`
|
|
`};ae.prototype=this._options.raw_options;var fe=new ae;N=W(j+N,fe)}else{var pe=g.whitespace_before;pe&&(N=N.replace(new RegExp(`
|
|
(`+pe+")?","g"),`
|
|
`)),N=j+N.replace(/\n/g,`
|
|
`+j)}I&&(N?N=I+N+`
|
|
`+x:N=I+x),h.print_newline(!1),N&&(g.text=N,g.whitespace_before="",g.newlines=0,h.add_raw_token(g),h.print_newline(!0))}},E.prototype._handle_tag_open=function(h,g,b,F){var N=this._get_tag_open_token(g);return(b.is_unformatted||b.is_content_unformatted)&&!b.is_empty_element&&g.type===i.TAG_OPEN&&g.text.indexOf("</")===0?(h.add_raw_token(g),N.start_tag_token=this._tag_stack.try_pop(N.tag_name)):(h.traverse_whitespace(g),this._set_tag_position(h,g,N,b,F),N.is_inline_element||h.set_wrap_point(),h.print_token(g)),(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(N.alignment_size=g.text.length+1),!N.tag_complete&&!N.is_unformatted&&(h.alignment_size=N.alignment_size),N};var y=function(h,g){if(this.parent=h||null,this.text="",this.type="TK_TAG_OPEN",this.tag_name="",this.is_inline_element=!1,this.is_unformatted=!1,this.is_content_unformatted=!1,this.is_empty_element=!1,this.is_start_tag=!1,this.is_end_tag=!1,this.indent_content=!1,this.multiline_content=!1,this.custom_beautifier_name=null,this.start_tag_token=null,this.attr_count=0,this.has_wrapped_attrs=!1,this.alignment_size=0,this.tag_complete=!1,this.tag_start_char="",this.tag_check="",!g)this.tag_complete=!0;else{var b;this.tag_start_char=g.text[0],this.text=g.text,this.tag_start_char==="<"?(b=g.text.match(/^<([^\s>]*)/),this.tag_check=b?b[1]:""):(b=g.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=b?b[1]:"",(g.text.startsWith("{{#>")||g.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&g.next!==null?this.tag_check=g.next.text.split(" ")[0]:this.tag_check=g.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),g.type===i.COMMENT&&(this.tag_complete=!0),this.is_start_tag=this.tag_check.charAt(0)!=="/",this.tag_name=this.is_start_tag?this.tag_check:this.tag_check.substr(1),this.is_end_tag=!this.is_start_tag||g.closed&&g.closed.text==="/>";var F=2;this.tag_start_char==="{"&&this.text.length>=3&&(this.text.charAt(2)==="~"&&(F=3)),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(F)))}};E.prototype._get_tag_open_token=function(h){var g=new y(this._tag_stack.get_parser_token(),h);return g.alignment_size=this._options.wrap_attributes_indent_size,g.is_end_tag=g.is_end_tag||w(g.tag_check,this._options.void_elements),g.is_empty_element=g.tag_complete||g.is_start_tag&&g.is_end_tag,g.is_unformatted=!g.tag_complete&&w(g.tag_check,this._options.unformatted),g.is_content_unformatted=!g.is_empty_element&&w(g.tag_check,this._options.content_unformatted),g.is_inline_element=w(g.tag_name,this._options.inline)||g.tag_name.includes("-")||g.tag_start_char==="{",g},E.prototype._set_tag_position=function(h,g,b,F,N){if(b.is_empty_element||(b.is_end_tag?b.start_tag_token=this._tag_stack.try_pop(b.tag_name):(this._do_optional_end_element(b)&&(b.is_inline_element||h.print_newline(!1)),this._tag_stack.record_tag(b),(b.tag_name==="script"||b.tag_name==="style")&&!(b.is_unformatted||b.is_content_unformatted)&&(b.custom_beautifier_name=S(b.tag_check,g)))),w(b.tag_check,this._options.extra_liners)&&(h.print_newline(!1),h._output.just_added_blankline()||h.print_newline(!0)),b.is_empty_element){if(b.tag_start_char==="{"&&b.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),b.indent_content=!0;var W=h.current_line_has_match(/{{#if/);W||h.print_newline(!1)}b.tag_name==="!--"&&N.type===i.TAG_CLOSE&&F.is_end_tag&&b.text.indexOf(`
|
|
`)===-1||(b.is_inline_element||b.is_unformatted||h.print_newline(!1),this._calcluate_parent_multiline(h,b))}else if(b.is_end_tag){var K=!1;K=b.start_tag_token&&b.start_tag_token.multiline_content,K=K||!b.is_inline_element&&!(F.is_inline_element||F.is_unformatted)&&!(N.type===i.TAG_CLOSE&&b.start_tag_token===F)&&N.type!=="TK_CONTENT",(b.is_content_unformatted||b.is_unformatted)&&(K=!1),K&&h.print_newline(!1)}else b.indent_content=!b.custom_beautifier_name,b.tag_start_char==="<"&&(b.tag_name==="html"?b.indent_content=this._options.indent_inner_html:b.tag_name==="head"?b.indent_content=this._options.indent_head_inner_html:b.tag_name==="body"&&(b.indent_content=this._options.indent_body_inner_html)),!(b.is_inline_element||b.is_unformatted)&&(N.type!=="TK_CONTENT"||b.is_content_unformatted)&&h.print_newline(!1),this._calcluate_parent_multiline(h,b)},E.prototype._calcluate_parent_multiline=function(h,g){g.parent&&h._output.just_added_newline()&&!((g.is_inline_element||g.is_unformatted)&&g.parent.is_inline_element)&&(g.parent.multiline_content=!0)};var d=["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","main","nav","ol","p","pre","section","table","ul"],l=["a","audio","del","ins","map","noscript","video"];E.prototype._do_optional_end_element=function(h){var g=null;if(h.is_empty_element||!h.is_start_tag||!h.parent)return;if(h.tag_name==="body")g=g||this._tag_stack.try_pop("head");else if(h.tag_name==="li")g=g||this._tag_stack.try_pop("li",["ol","ul"]);else if(h.tag_name==="dd"||h.tag_name==="dt")g=g||this._tag_stack.try_pop("dt",["dl"]),g=g||this._tag_stack.try_pop("dd",["dl"]);else if(h.parent.tag_name==="p"&&d.indexOf(h.tag_name)!==-1){var b=h.parent.parent;(!b||l.indexOf(b.tag_name)===-1)&&(g=g||this._tag_stack.try_pop("p"))}else h.tag_name==="rp"||h.tag_name==="rt"?(g=g||this._tag_stack.try_pop("rt",["ruby","rtc"]),g=g||this._tag_stack.try_pop("rp",["ruby","rtc"])):h.tag_name==="optgroup"?g=g||this._tag_stack.try_pop("optgroup",["select"]):h.tag_name==="option"?g=g||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):h.tag_name==="colgroup"?g=g||this._tag_stack.try_pop("caption",["table"]):h.tag_name==="thead"?(g=g||this._tag_stack.try_pop("caption",["table"]),g=g||this._tag_stack.try_pop("colgroup",["table"])):h.tag_name==="tbody"||h.tag_name==="tfoot"?(g=g||this._tag_stack.try_pop("caption",["table"]),g=g||this._tag_stack.try_pop("colgroup",["table"]),g=g||this._tag_stack.try_pop("thead",["table"]),g=g||this._tag_stack.try_pop("tbody",["table"])):h.tag_name==="tr"?(g=g||this._tag_stack.try_pop("caption",["table"]),g=g||this._tag_stack.try_pop("colgroup",["table"]),g=g||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(h.tag_name==="th"||h.tag_name==="td")&&(g=g||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),g=g||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return h.parent=this._tag_stack.get_parser_token(),g},v.exports.Beautifier=E},function(v,_,p){var o=p(6).Options;function u(r){o.call(this,r,"html"),this.templating.length===1&&this.templating[0]==="auto"&&(this.templating=["django","erb","handlebars","php"]),this.indent_inner_html=this._get_boolean("indent_inner_html"),this.indent_body_inner_html=this._get_boolean("indent_body_inner_html",!0),this.indent_head_inner_html=this._get_boolean("indent_head_inner_html",!0),this.indent_handlebars=this._get_boolean("indent_handlebars",!0),this.wrap_attributes=this._get_selection("wrap_attributes",["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"]),this.wrap_attributes_indent_size=this._get_number("wrap_attributes_indent_size",this.indent_size),this.extra_liners=this._get_array("extra_liners",["head","body","/html"]),this.inline=this._get_array("inline",["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","big","strike","tt"]),this.void_elements=this._get_array("void_elements",["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","basefont","isindex"]),this.unformatted=this._get_array("unformatted",[]),this.content_unformatted=this._get_array("content_unformatted",["pre","textarea"]),this.unformatted_content_delimiter=this._get_characters("unformatted_content_delimiter"),this.indent_scripts=this._get_selection("indent_scripts",["normal","keep","separate"])}u.prototype=new o,v.exports.Options=u},function(v,_,p){var o=p(9).Tokenizer,u=p(9).TOKEN,r=p(13).Directives,i=p(14).TemplatablePattern,t=p(12).Pattern,c={TAG_OPEN:"TK_TAG_OPEN",TAG_CLOSE:"TK_TAG_CLOSE",ATTRIBUTE:"TK_ATTRIBUTE",EQUALS:"TK_EQUALS",VALUE:"TK_VALUE",COMMENT:"TK_COMMENT",TEXT:"TK_TEXT",UNKNOWN:"TK_UNKNOWN",START:u.START,RAW:u.RAW,EOF:u.EOF},f=new r(/<\!--/,/-->/),A=function(S,w){o.call(this,S,w),this._current_tag_name="";var R=new i(this._input).read_options(this._options),O=new t(this._input);if(this.__patterns={word:R.until(/[\n\r\t <]/),single_quote:R.until_after(/'/),double_quote:R.until_after(/"/),attribute:R.until(/[\n\r\t =>]|\/>/),element_name:R.until(/[\n\r\t >\/]/),handlebars_comment:O.starting_with(/{{!--/).until_after(/--}}/),handlebars:O.starting_with(/{{/).until_after(/}}/),handlebars_open:O.until(/[\n\r\t }]/),handlebars_raw_close:O.until(/}}/),comment:O.starting_with(/<!--/).until_after(/-->/),cdata:O.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:O.starting_with(/<!\[/).until_after(/]>/),processing:O.starting_with(/<\?/).until_after(/\?>/)},this._options.indent_handlebars&&(this.__patterns.word=this.__patterns.word.exclude("handlebars")),this._unformatted_content_delimiter=null,this._options.unformatted_content_delimiter){var E=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=O.matching(E).until_after(E)}};A.prototype=new o,A.prototype._is_comment=function(S){return!1},A.prototype._is_opening=function(S){return S.type===c.TAG_OPEN},A.prototype._is_closing=function(S,w){return S.type===c.TAG_CLOSE&&w&&((S.text===">"||S.text==="/>")&&w.text[0]==="<"||S.text==="}}"&&w.text[0]==="{"&&w.text[1]==="{")},A.prototype._reset=function(){this._current_tag_name=""},A.prototype._get_next_token=function(S,w){var R=null;this._readWhitespace();var O=this._input.peek();return O===null?this._create_token(c.EOF,""):(R=R||this._read_open_handlebars(O,w),R=R||this._read_attribute(O,S,w),R=R||this._read_close(O,w),R=R||this._read_raw_content(O,S,w),R=R||this._read_content_word(O),R=R||this._read_comment_or_cdata(O),R=R||this._read_processing(O),R=R||this._read_open(O,w),R=R||this._create_token(c.UNKNOWN,this._input.next()),R)},A.prototype._read_comment_or_cdata=function(S){var w=null,R=null,O=null;if(S==="<"){var E=this._input.peek(1);E==="!"&&(R=this.__patterns.comment.read(),R?(O=f.get_directives(R),O&&O.ignore==="start"&&(R+=f.readIgnored(this._input))):R=this.__patterns.cdata.read()),R&&(w=this._create_token(c.COMMENT,R),w.directives=O)}return w},A.prototype._read_processing=function(S){var w=null,R=null,O=null;if(S==="<"){var E=this._input.peek(1);(E==="!"||E==="?")&&(R=this.__patterns.conditional_comment.read(),R=R||this.__patterns.processing.read()),R&&(w=this._create_token(c.COMMENT,R),w.directives=O)}return w},A.prototype._read_open=function(S,w){var R=null,O=null;return w||S==="<"&&(R=this._input.next(),this._input.peek()==="/"&&(R+=this._input.next()),R+=this.__patterns.element_name.read(),O=this._create_token(c.TAG_OPEN,R)),O},A.prototype._read_open_handlebars=function(S,w){var R=null,O=null;return w||this._options.indent_handlebars&&S==="{"&&this._input.peek(1)==="{"&&(this._input.peek(2)==="!"?(R=this.__patterns.handlebars_comment.read(),R=R||this.__patterns.handlebars.read(),O=this._create_token(c.COMMENT,R)):(R=this.__patterns.handlebars_open.read(),O=this._create_token(c.TAG_OPEN,R))),O},A.prototype._read_close=function(S,w){var R=null,O=null;return w&&(w.text[0]==="<"&&(S===">"||S==="/"&&this._input.peek(1)===">")?(R=this._input.next(),S==="/"&&(R+=this._input.next()),O=this._create_token(c.TAG_CLOSE,R)):w.text[0]==="{"&&S==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),O=this._create_token(c.TAG_CLOSE,"}}"))),O},A.prototype._read_attribute=function(S,w,R){var O=null,E="";if(R&&R.text[0]==="<")if(S==="=")O=this._create_token(c.EQUALS,this._input.next());else if(S==='"'||S==="'"){var y=this._input.next();S==='"'?y+=this.__patterns.double_quote.read():y+=this.__patterns.single_quote.read(),O=this._create_token(c.VALUE,y)}else E=this.__patterns.attribute.read(),E&&(w.type===c.EQUALS?O=this._create_token(c.VALUE,E):O=this._create_token(c.ATTRIBUTE,E));return O},A.prototype._is_content_unformatted=function(S){return this._options.void_elements.indexOf(S)===-1&&(this._options.content_unformatted.indexOf(S)!==-1||this._options.unformatted.indexOf(S)!==-1)},A.prototype._read_raw_content=function(S,w,R){var O="";if(R&&R.text[0]==="{")O=this.__patterns.handlebars_raw_close.read();else if(w.type===c.TAG_CLOSE&&w.opened.text[0]==="<"&&w.text[0]!=="/"){var E=w.opened.text.substr(1).toLowerCase();if(E==="script"||E==="style"){var y=this._read_comment_or_cdata(S);if(y)return y.type=c.TEXT,y;O=this._input.readUntil(new RegExp("</"+E+"[\\n\\r\\t ]*?>","ig"))}else this._is_content_unformatted(E)&&(O=this._input.readUntil(new RegExp("</"+E+"[\\n\\r\\t ]*?>","ig")))}return O?this._create_token(c.TEXT,O):null},A.prototype._read_content_word=function(S){var w="";if(this._options.unformatted_content_delimiter&&(S===this._options.unformatted_content_delimiter[0]&&(w=this.__patterns.unformatted_content_delimiter.read())),w||(w=this.__patterns.word.read()),w)return this._create_token(c.TEXT,w)},v.exports.Tokenizer=A,v.exports.TOKEN=c}],X={};function k(v){var _=X[v];if(_!==void 0)return _.exports;var p=X[v]={exports:{}};return Y[v](p,p.exports,k),p.exports}var D=k(18);U=D})();var ee=U;if(!0)!(ie=[V,V("6UM0"),V("TXwP")],Z=function(Y){var X=V("6UM0"),k=V("TXwP");return{html_beautify:function(D,v){return ee(D,v,X.js_beautify,k.css_beautify)}}}.apply(st,ie),Z!==void 0&&(zt.exports=Z));else var H,M})()},"rAM+":function(zt,st,V){"use strict";V.d(st,"a",function(){return Z});var ie=V("Qw5x");function Z(U,ee){var H;if(typeof Symbol=="undefined"||U[Symbol.iterator]==null){if(Array.isArray(U)||(H=Object(ie.a)(U))||ee&&U&&typeof U.length=="number"){H&&(U=H);var M=0,Y=function(){};return{s:Y,n:function(){return M>=U.length?{done:!0}:{done:!1,value:U[M++]}},e:function(_){throw _},f:Y}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var X=!0,k=!1,D;return{s:function(){H=U[Symbol.iterator]()},n:function(){var _=H.next();return X=_.done,_},e:function(_){k=!0,D=_},f:function(){try{!X&&H.return!=null&&H.return()}finally{if(k)throw D}}}}},rUJ1:function(zt,st){const V=/[&<>"']/,ie=/[&<>"']/g,Z=/[<>"']|&(?!#?\w+;)/,U=/[<>"']|&(?!#?\w+;)/g,ee={"&":"&","<":"<",">":">",'"':""","'":"'"},H=O=>ee[O];function M(O,E){if(E){if(V.test(O))return O.replace(ie,H)}else if(Z.test(O))return O.replace(U,H);return O}const Y=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function X(O){return O.replace(Y,(E,y)=>(y=y.toLowerCase(),y==="colon"?":":y.charAt(0)==="#"?y.charAt(1)==="x"?String.fromCharCode(parseInt(y.substring(2),16)):String.fromCharCode(+y.substring(1)):""))}const k=/(^|[^\[])\^/g;function D(O,E){O=O.source||O,E=E||"";const y={replace:(d,l)=>(l=l.source||l,l=l.replace(k,"$1"),O=O.replace(d,l),y),getRegex:()=>new RegExp(O,E)};return y}const v=/[^\w:]/g,_=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function p(O,E,y){if(O){let d;try{d=decodeURIComponent(X(y)).replace(v,"").toLowerCase()}catch(l){return null}if(d.indexOf("javascript:")===0||d.indexOf("vbscript:")===0||d.indexOf("data:")===0)return null}E&&!_.test(y)&&(y=t(E,y));try{y=encodeURI(y).replace(/%25/g,"%")}catch(d){return null}return y}const o={},u=/^[^:]+:\/*[^/]*$/,r=/^([^:]+:)[\s\S]*$/,i=/^([^:]+:\/*[^/]*)[\s\S]*$/;function t(O,E){o[" "+O]||(u.test(O)?o[" "+O]=O+"/":o[" "+O]=S(O,"/",!0)),O=o[" "+O];const y=O.indexOf(":")===-1;return E.substring(0,2)==="//"?y?E:O.replace(r,"$1")+E:E.charAt(0)==="/"?y?E:O.replace(i,"$1")+E:O+E}const c={exec:function(){}};function f(O){let E=1,y,d;for(;E<arguments.length;E++){y=arguments[E];for(d in y)Object.prototype.hasOwnProperty.call(y,d)&&(O[d]=y[d])}return O}function A(O,E){const y=O.replace(/\|/g,(h,g,b)=>{let F=!1,N=g;for(;--N>=0&&b[N]==="\\";)F=!F;return F?"|":" |"}),d=y.split(/ \|/);let l=0;if(d.length>E)d.splice(E);else for(;d.length<E;)d.push("");for(;l<d.length;l++)d[l]=d[l].trim().replace(/\\\|/g,"|");return d}function S(O,E,y){const d=O.length;if(d===0)return"";let l=0;for(;l<d;){const h=O.charAt(d-l-1);if(h===E&&!y)l++;else if(h!==E&&y)l++;else break}return O.substr(0,d-l)}function w(O,E){if(O.indexOf(E[1])===-1)return-1;const y=O.length;let d=0,l=0;for(;l<y;l++)if(O[l]==="\\")l++;else if(O[l]===E[0])d++;else if(O[l]===E[1]&&(d--,d<0))return l;return-1}function R(O){O&&O.sanitize&&!O.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}zt.exports={escape:M,unescape:X,edit:D,cleanUrl:p,resolveUrl:t,noopTest:c,merge:f,splitCells:A,rtrim:S,findClosingBracket:w,checkSanitizeDeprecation:R}},sR1s:function(zt,st,V){"use strict";V.d(st,"b",function(){return ee}),V.d(st,"a",function(){return H}),V.d(st,"c",function(){return M}),V.d(st,"d",function(){return Y});var ie=V("U8pU"),Z="RC_TABLE_KEY";function U(X){return X==null?[]:Array.isArray(X)?X:[X]}function ee(X,k){if(!k&&typeof k!="number")return X;for(var D=U(k),v=X,_=0;_<D.length;_+=1){if(!v)return null;var p=D[_];v=v[p]}return v}function H(X){var k=[],D={};return X.forEach(function(v){for(var _=v||{},p=_.key,o=_.dataIndex,u=p||U(o).join("-")||Z;D[u];)u="".concat(u,"_next");D[u]=!0,k.push(u)}),k}function M(){var X={};function k(p,o){o&&Object.keys(o).forEach(function(u){var r=o[u];r&&Object(ie.a)(r)==="object"?(p[u]=p[u]||{},k(p[u],r)):p[u]=r})}for(var D=arguments.length,v=new Array(D),_=0;_<D;_++)v[_]=arguments[_];return v.forEach(function(p){k(X,p)}),X}function Y(X){return X!=null}},sZF6:function(zt,st,V){"use strict";var ie=V("2qtc"),Z=V("kLXV"),U=V("DZo9"),ee=V("8z0m"),H=V("+L6B"),M=V("2/Rp"),Y=V("tJVT"),X=V("q1tI"),k=V.n(X),D=V("xvlK"),v=V("m3rI"),_=V("1vsH"),p=V("Ty5D"),o=V("69hG"),u=V.n(o),r=function(t){var c=t.visible,f=t.onOk,A=t.onCancel,S=Object(X.useState)([]),w=Object(Y.a)(S,2),R=w[0],O=w[1],E=Object(X.useState)(!1),y=Object(Y.a)(E,2),d=y[0],l=y[1],h=Object(p.i)();Object(X.useEffect)(function(){c||(O([]),l(!1))},[c]);var g=function(){l(!0),f(R,function(){l(!1)})},b=function(){A()},F=function(){console.log(h,444);var I="".concat(v.a.API_SERVER,"/api/courses/").concat(h.coursesId,"/exercises/down_template");Object(_.x)(null,I)},N=function(I){var x={name:I.name,uid:I.uid,file:I};return O([x]),!1},W=function(){O([])};return k.a.createElement(Z.a,{title:"\u6279\u91CF\u5BFC\u5165\u8BD5\u9898",visible:c,onOk:g,centered:!0,wrapClassName:u.a.customModal,onCancel:b,width:"680px",okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",confirmLoading:d},k.a.createElement("div",{className:u.a.content},k.a.createElement("aside",null,k.a.createElement("div",null,"\u6B65\u9AA41\uFF1A"),k.a.createElement("ul",null,k.a.createElement("li",null,"\u4E0B\u8F7D\xA0",k.a.createElement("span",{style:{color:"#0152d9",cursor:"pointer"},onClick:F},"\u8003\u8BD5\u8BD5\u9898\u6A21\u677F"),",\xA0\u6279\u91CF\u5BFC\u5165\u8BD5\u9898\u3002"),k.a.createElement("li",{className:"c-grey-999 mt10"},"\u6CE8\uFF1A\u76EE\u524D\u4EC5\u652F\u6301Excel\u683C\u5F0F\u6A21\u677F\uFF0C\u6BCF\u6B21\u6700\u591A\u5BFC\u5165300\u9898\u3002\u4E0D\u652F\u6301\u7F16\u7A0B\u9898\u548C\u5B9E\u8BAD\u9898\u5BFC\u5165"))),k.a.createElement("aside",{className:"mt30"},k.a.createElement("div",null,"\u6B65\u9AA42\uFF1A"),k.a.createElement("ul",{style:{flex:1}},k.a.createElement("li",null,"\u4E0A\u4F20\u586B\u5199\u597D\u7684\u8BD5\u9898\u8868"),c&&k.a.createElement(ee.a,{action:"".concat(v.a.API_SERVER,"/api/attachments.json"),beforeUpload:N,onRemove:W,withCredentials:!0,fileList:R,accept:".xls,.xlsx"},k.a.createElement(M.a,{className:u.a.upload,type:"primary",icon:k.a.createElement(D.a,null)},"\u9009\u62E9\u6587\u4EF6"))))))};st.a=r},sboe:function(zt,st,V){"use strict";V.d(st,"a",function(){return U});var ie=V("q1tI"),Z=V.n(ie),U=ie.createContext(null)},t23M:function(zt,st,V){"use strict";var ie=V("VTBJ"),Z=V("1OyB"),U=V("vuIU"),ee=V("Ji7U"),H=V("LK+K"),M=V("q1tI"),Y=V.n(M),X=V("m+aA"),k=V("Zm9Q"),D=V("Kwbf"),v=V("c+Xe"),_=V("bdgK"),p="rc-observer-key",o=function(u){Object(ee.a)(i,u);var r=Object(H.a)(i);function i(){var t;return Object(Z.a)(this,i),t=r.apply(this,arguments),t.resizeObserver=null,t.childNode=null,t.currentElement=null,t.state={width:0,height:0,offsetHeight:0,offsetWidth:0},t.onResize=function(c){var f=t.props.onResize,A=c[0].target,S=A.getBoundingClientRect(),w=S.width,R=S.height,O=A.offsetWidth,E=A.offsetHeight,y=Math.floor(w),d=Math.floor(R);if(t.state.width!==y||t.state.height!==d||t.state.offsetWidth!==O||t.state.offsetHeight!==E){var l={width:y,height:d,offsetWidth:O,offsetHeight:E};t.setState(l),f&&Promise.resolve().then(function(){f(Object(ie.a)(Object(ie.a)({},l),{},{offsetWidth:O,offsetHeight:E}))})}},t.setChildNode=function(c){t.childNode=c},t}return Object(U.a)(i,[{key:"componentDidMount",value:function(){this.onComponentUpdated()}},{key:"componentDidUpdate",value:function(){this.onComponentUpdated()}},{key:"componentWillUnmount",value:function(){this.destroyObserver()}},{key:"onComponentUpdated",value:function(){var c=this.props.disabled;if(c){this.destroyObserver();return}var f=Object(X.a)(this.childNode||this),A=f!==this.currentElement;A&&(this.destroyObserver(),this.currentElement=f),!this.resizeObserver&&f&&(this.resizeObserver=new _.default(this.onResize),this.resizeObserver.observe(f))}},{key:"destroyObserver",value:function(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}},{key:"render",value:function(){var c=this.props.children,f=Object(k.a)(c);if(f.length>1)Object(D.a)(!1,"Find more than one child node with `children` in ResizeObserver. Will only observe first one.");else if(f.length===0)return Object(D.a)(!1,"`children` of ResizeObserver is empty. Nothing is in observe."),null;var A=f[0];if(M.isValidElement(A)&&Object(v.c)(A)){var S=A.ref;f[0]=M.cloneElement(A,{ref:Object(v.a)(S,this.setChildNode)})}return f.length===1?f[0]:f.map(function(w,R){return!M.isValidElement(w)||"key"in w&&w.key!==null?w:M.cloneElement(w,{key:"".concat(p,"-").concat(R)})})}}]),i}(M.Component);o.displayName="ResizeObserver",st.a=o},u2Z1:function(zt,st,V){"use strict";V.d(st,"a",function(){return S});var ie=V("miYZ"),Z=V("tsqr"),U=V("9og8"),ee=V("5NDa"),H=V("5rEg"),M=V("2qtc"),Y=V("kLXV"),X=V("oBTY"),k=V("tJVT"),D=V("OaEy"),v=V("2fM7"),_=V("WmNS"),p=V.n(_),o=V("q1tI"),u=V.n(o),r=V("ErOA"),i=V("i58Z"),t=V.n(i),c=V("T1X5"),f=V.n(c),A=v.a.Option,S=function(R){var O=R.subId,E=R.value,y=R.selectvalues,d=R.disabled,l=R.knowledgeOptions,h=l===void 0?[]:l,g=R.onChange,b=g===void 0?function(){}:g,F=R.onAddKnowledgeFinish,N=F===void 0?function(){}:F,W=Object(o.useRef)(),K=Object(o.useState)([]),I=Object(k.a)(K,2),x=I[0],j=I[1];E=E||[];var $=function(pe,Ce){pe?(j([Ce.key]),b([Ce.key])):(j([]),b([]))};Object(o.useEffect)(function(){(y==null?void 0:y.length)>0&&(j(Object(X.a)(y)),b(Object(X.a)(y)))},[h]),Object(o.useEffect)(function(){var fe;((fe=E)===null||fe===void 0?void 0:fe.length)>0&&b(Object(X.a)(E))},[h]);var ae=function(pe){pe.preventDefault(),W.current="",Y.a.confirm({centered:!0,width:700,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",icon:null,title:"\u65B0\u5EFA\u77E5\u8BC6\u70B9",className:"custom-modal-divider",content:u.a.createElement("div",{className:"font14"},u.a.createElement("div",{style:{display:"flex",marginTop:"48px",marginBottom:"36px"}},u.a.createElement("img",{src:f.a,style:{width:"108px",height:"108px",marginRight:"29px"}}),"\u60A8\u586B\u5199\u7684\u77E5\u8BC6\u70B9\u6682\u65F6\u4EC5\u5BF9\u672C\u4EBA\u53EF\u89C1\uFF0C\u5E73\u53F0\u5BA1\u6838\u901A\u8FC7\u540E\u5C06\u5217\u5165\u516C\u5F00\u77E5\u8BC6\u70B9\uFF0C\u5BF9\u6240\u6709\u7528\u6237\u53EF\u89C1\uFF1B",u.a.createElement("br",null),"\u5E73\u53F0\u5BA1\u6838\u8FC7\u7A0B\u4E2D\u6709\u6743\u5220\u9664\u4E0D\u5408\u9002\u7684\u77E5\u8BC6\u70B9\uFF08\u5305\u62EC\u4F46\u4E0D\u9650\u4E8E\u9519\u8BEF\u3001\u975E\u6CD5\u3001\u4E0D\u96C5\u3001\u4E0D\u5339\u914D\u5F53\u524D\u8BFE\u7A0B\u7B49\u60C5\u5F62\uFF09\uFF0C\u5220\u9664\u540E\u53EF\u80FD\u5F71\u54CD\u60A8\u7684\u8BD5\u9898\u7684\u6B63\u5E38\u4F7F\u7528\u3002",u.a.createElement("br",null),"\u8BF7\u8BA4\u771F\u586B\u5199\u4E0E\u6559\u5B66\u5185\u5BB9\u76F8\u5173\u7684\u771F\u5B9E\u77E5\u8BC6\u70B9 ",u.a.createElement("br",null)),u.a.createElement(H.a,{className:"mt5",maxLength:20,style:{marginBottom:"42px"},placeholder:"\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC720\u5B57\u7684\u77E5\u8BC6\u70B9\u540D\u79F0",defaultValue:W.current,onChange:function(De){W.current=De.target.value}})),onOk:function(){return new Promise(function(){var De=Object(U.a)(p.a.mark(function xe(Oe,Ee){var be,te;return p.a.wrap(function(ye){for(;;)switch(ye.prev=ye.next){case 0:if(W.current){ye.next=3;break}return Z.b.warn("\u8BF7\u8F93\u5165\u77E5\u8BC6\u70B9\u540D\u79F0"),ye.abrupt("return",Ee());case 3:if(!(W.current.length>20)){ye.next=6;break}return Z.b.warn("\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC720\u5B57\u7684\u77E5\u8BC6\u70B9\u540D\u79F0"),ye.abrupt("return",Ee());case 6:return ye.next=8,Object(r.a)("/api/tag_disciplines.json",{method:"post",body:{name:W.current,sub_discipline_id:O}});case 8:return be=ye.sent,(be==null?void 0:be.status)===0&&(N({id:be.tag_discipline_id,name:W.current,type:"personal"}),te=[],te.push(be.tag_discipline_id),b([].concat(te)),j([be.tag_discipline_id]),b([].concat(te))),ye.abrupt("return",Oe());case 11:case"end":return ye.stop()}},xe)}));return function(xe,Oe){return De.apply(this,arguments)}}())}})};return u.a.createElement("div",{className:t.a.wrap},u.a.createElement(v.a,{disabled:!O||d,className:"mr5",style:{width:"242px"},onChange:$,showSearch:!0,allowClear:!0,value:h==null?void 0:h.filter(function(fe){return(x==null?void 0:x.includes(fe==null?void 0:fe.id))||(x==null?void 0:x.includes((fe==null?void 0:fe.id)+""))}).map(function(fe){return fe.name})},h==null?void 0:h.map(function(fe){return u.a.createElement(A,{key:fe.id,value:fe.name},u.a.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},u.a.createElement("span",{style:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}},fe.name),u.a.createElement("span",null,fe.type==="personal"?"\uFF08\u81EA\u7528\uFF09":"")))})),u.a.createElement("button",{disabled:!O,className:"".concat(t.a.addKnowledge," ").concat(O?"":t.a.disabled),onClick:ae},"\u65B0\u5EFA\u77E5\u8BC6\u70B9"))}},uK0f:function(zt,st,V){(function(ie,Z){zt.exports=Z()})(this,function(){"use strict";function ie(Z,U,ee){ee=ee||{},ee.childrenKeyName=ee.childrenKeyName||"children";var H=Z||[],M=[],Y=0;do{var X=H.filter(function(k){return U(k,Y)})[0];if(!X)break;M.push(X),H=X[ee.childrenKeyName]||[],Y+=1}while(H.length>0);return M}return ie})},ulZh:function(zt,st,V){typeof window!="undefined"&&function(Z,U){zt.exports=U()}(this,function(){return function(ie){var Z={};function U(ee){if(Z[ee])return Z[ee].exports;var H=Z[ee]={i:ee,l:!1,exports:{}};return ie[ee].call(H.exports,H,H.exports,U),H.l=!0,H.exports}return U.m=ie,U.c=Z,U.d=function(ee,H,M){U.o(ee,H)||Object.defineProperty(ee,H,{enumerable:!0,get:M})},U.r=function(ee){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(ee,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(ee,"__esModule",{value:!0})},U.t=function(ee,H){if(H&1&&(ee=U(ee)),H&8)return ee;if(H&4&&typeof ee=="object"&&ee&&ee.__esModule)return ee;var M=Object.create(null);if(U.r(M),Object.defineProperty(M,"default",{enumerable:!0,value:ee}),H&2&&typeof ee!="string")for(var Y in ee)U.d(M,Y,function(X){return ee[X]}.bind(null,Y));return M},U.n=function(ee){var H=ee&&ee.__esModule?function(){return ee.default}:function(){return ee};return U.d(H,"a",H),H},U.o=function(ee,H){return Object.prototype.hasOwnProperty.call(ee,H)},U.p="/dist/",U(U.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ie,Z,U){"use strict";var ee=Object.prototype.hasOwnProperty,H="~";function M(){}Object.create&&(M.prototype=Object.create(null),new M().__proto__||(H=!1));function Y(v,_,p){this.fn=v,this.context=_,this.once=p||!1}function X(v,_,p,o,u){if(typeof p!="function")throw new TypeError("The listener must be a function");var r=new Y(p,o||v,u),i=H?H+_:_;return v._events[i]?v._events[i].fn?v._events[i]=[v._events[i],r]:v._events[i].push(r):(v._events[i]=r,v._eventsCount++),v}function k(v,_){--v._eventsCount===0?v._events=new M:delete v._events[_]}function D(){this._events=new M,this._eventsCount=0}D.prototype.eventNames=function(){var _=[],p,o;if(this._eventsCount===0)return _;for(o in p=this._events)ee.call(p,o)&&_.push(H?o.slice(1):o);return Object.getOwnPropertySymbols?_.concat(Object.getOwnPropertySymbols(p)):_},D.prototype.listeners=function(_){var p=H?H+_:_,o=this._events[p];if(!o)return[];if(o.fn)return[o.fn];for(var u=0,r=o.length,i=new Array(r);u<r;u++)i[u]=o[u].fn;return i},D.prototype.listenerCount=function(_){var p=H?H+_:_,o=this._events[p];return o?o.fn?1:o.length:0},D.prototype.emit=function(_,p,o,u,r,i){var t=H?H+_:_;if(!this._events[t])return!1;var c=this._events[t],f=arguments.length,A,S;if(c.fn){c.once&&this.removeListener(_,c.fn,void 0,!0);switch(f){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,p),!0;case 3:return c.fn.call(c.context,p,o),!0;case 4:return c.fn.call(c.context,p,o,u),!0;case 5:return c.fn.call(c.context,p,o,u,r),!0;case 6:return c.fn.call(c.context,p,o,u,r,i),!0}for(S=1,A=new Array(f-1);S<f;S++)A[S-1]=arguments[S];c.fn.apply(c.context,A)}else{var w=c.length,R;for(S=0;S<w;S++){c[S].once&&this.removeListener(_,c[S].fn,void 0,!0);switch(f){case 1:c[S].fn.call(c[S].context);break;case 2:c[S].fn.call(c[S].context,p);break;case 3:c[S].fn.call(c[S].context,p,o);break;case 4:c[S].fn.call(c[S].context,p,o,u);break;default:if(!A)for(R=1,A=new Array(f-1);R<f;R++)A[R-1]=arguments[R];c[S].fn.apply(c[S].context,A)}}}return!0},D.prototype.on=function(_,p,o){return X(this,_,p,o,!1)},D.prototype.once=function(_,p,o){return X(this,_,p,o,!0)},D.prototype.removeListener=function(_,p,o,u){var r=H?H+_:_;if(!this._events[r])return this;if(!p)return k(this,r),this;var i=this._events[r];if(i.fn)i.fn===p&&(!u||i.once)&&(!o||i.context===o)&&k(this,r);else{for(var t=0,c=[],f=i.length;t<f;t++)(i[t].fn!==p||u&&!i[t].once||o&&i[t].context!==o)&&c.push(i[t]);c.length?this._events[r]=c.length===1?c[0]:c:k(this,r)}return this},D.prototype.removeAllListeners=function(_){var p;return _?(p=H?H+_:_,this._events[p]&&k(this,p)):(this._events=new M,this._eventsCount=0),this},D.prototype.off=D.prototype.removeListener,D.prototype.addListener=D.prototype.on,D.prefixed=H,D.EventEmitter=D,ie.exports=D},"./node_modules/url-toolkit/src/url-toolkit.js":function(ie,Z,U){(function(ee){var H=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,M=/^([^\/?#]*)([^]*)$/,Y=/(?:\/|^)\.(?=\/)/g,X=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,k={buildAbsoluteURL:function(D,v,_){if(_=_||{},D=D.trim(),v=v.trim(),!v){if(!_.alwaysNormalize)return D;var p=k.parseURL(D);if(!p)throw new Error("Error trying to parse base URL.");return p.path=k.normalizePath(p.path),k.buildURLFromParts(p)}var o=k.parseURL(v);if(!o)throw new Error("Error trying to parse relative URL.");if(o.scheme)return _.alwaysNormalize?(o.path=k.normalizePath(o.path),k.buildURLFromParts(o)):v;var u=k.parseURL(D);if(!u)throw new Error("Error trying to parse base URL.");if(!u.netLoc&&u.path&&u.path[0]!=="/"){var r=M.exec(u.path);u.netLoc=r[1],u.path=r[2]}u.netLoc&&!u.path&&(u.path="/");var i={scheme:u.scheme,netLoc:o.netLoc,path:null,params:o.params,query:o.query,fragment:o.fragment};if(!o.netLoc&&(i.netLoc=u.netLoc,o.path[0]!=="/"))if(!o.path)i.path=u.path,o.params||(i.params=u.params,o.query||(i.query=u.query));else{var t=u.path,c=t.substring(0,t.lastIndexOf("/")+1)+o.path;i.path=k.normalizePath(c)}return i.path===null&&(i.path=_.alwaysNormalize?k.normalizePath(o.path):o.path),k.buildURLFromParts(i)},parseURL:function(D){var v=H.exec(D);return v?{scheme:v[1]||"",netLoc:v[2]||"",path:v[3]||"",params:v[4]||"",query:v[5]||"",fragment:v[6]||""}:null},normalizePath:function(D){for(D=D.split("").reverse().join("").replace(Y,"");D.length!==(D=D.replace(X,"")).length;);return D.split("").reverse().join("")},buildURLFromParts:function(D){return D.scheme+D.netLoc+D.path+D.params+D.query+D.fragment}};ie.exports=k})(this)},"./node_modules/webworkify-webpack/index.js":function(ie,Z,U){function ee(_){var p={};function o(r){if(p[r])return p[r].exports;var i=p[r]={i:r,l:!1,exports:{}};return _[r].call(i.exports,i,i.exports,o),i.l=!0,i.exports}o.m=_,o.c=p,o.i=function(r){return r},o.d=function(r,i,t){o.o(r,i)||Object.defineProperty(r,i,{configurable:!1,enumerable:!0,get:t})},o.r=function(r){Object.defineProperty(r,"__esModule",{value:!0})},o.n=function(r){var i=r&&r.__esModule?function(){return r.default}:function(){return r};return o.d(i,"a",i),i},o.o=function(r,i){return Object.prototype.hasOwnProperty.call(r,i)},o.p="/",o.oe=function(r){throw console.error(r),r};var u=o(o.s=ENTRY_MODULE);return u.default||u}var H="[\\.|\\-|\\+|\\w|/|@]+",M="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+H+").*?\\)";function Y(_){return(_+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function X(_){return!isNaN(1*_)}function k(_,p,o){var u={};u[o]=[];var r=p.toString(),i=r.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!i)return u;for(var t=i[1],c=new RegExp("(\\\\n|\\W)"+Y(t)+M,"g"),f;f=c.exec(r);){if(f[3]==="dll-reference")continue;u[o].push(f[3])}for(c=new RegExp("\\("+Y(t)+'\\("(dll-reference\\s('+H+'))"\\)\\)'+M,"g");f=c.exec(r);)_[f[2]]||(u[o].push(f[1]),_[f[2]]=U(f[1]).m),u[f[2]]=u[f[2]]||[],u[f[2]].push(f[4]);for(var A=Object.keys(u),S=0;S<A.length;S++)for(var w=0;w<u[A[S]].length;w++)X(u[A[S]][w])&&(u[A[S]][w]=1*u[A[S]][w]);return u}function D(_){var p=Object.keys(_);return p.reduce(function(o,u){return o||_[u].length>0},!1)}function v(_,p){for(var o={main:[p]},u={main:[]},r={main:{}};D(o);)for(var i=Object.keys(o),t=0;t<i.length;t++){var c=i[t],f=o[c],A=f.pop();if(r[c]=r[c]||{},r[c][A]||!_[c][A])continue;r[c][A]=!0,u[c]=u[c]||[],u[c].push(A);for(var S=k(_,_[c][A],c),w=Object.keys(S),R=0;R<w.length;R++)o[w[R]]=o[w[R]]||[],o[w[R]]=o[w[R]].concat(S[w[R]])}return u}ie.exports=function(_,p){p=p||{};var o={main:U.m},u=p.all?{main:Object.keys(o.main)}:v(o,_),r="";Object.keys(u).filter(function(A){return A!=="main"}).forEach(function(A){for(var S=0;u[A][S];)S++;u[A].push(S),o[A][S]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",r=r+"var "+A+" = ("+ee.toString().replace("ENTRY_MODULE",JSON.stringify(S))+")({"+u[A].map(function(w){return""+JSON.stringify(w)+": "+o[A][w].toString()}).join(",")+`});
|
|
`}),r=r+"new (("+ee.toString().replace("ENTRY_MODULE",JSON.stringify(_))+")({"+u.main.map(function(A){return""+JSON.stringify(A)+": "+o.main[A].toString()}).join(",")+"}))(self);";var i=new window.Blob([r],{type:"text/javascript"});if(p.bare)return i;var t=window.URL||window.webkitURL||window.mozURL||window.msURL,c=t.createObjectURL(i),f=new window.Worker(c);return f.objectURL=c,f}},"./src/config.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"hlsDefaultConfig",function(){return R}),U.d(Z,"mergeConfig",function(){return E}),U.d(Z,"enableStreamingMode",function(){return y});var ee=U("./src/controller/abr-controller.ts"),H=U("./src/controller/audio-stream-controller.ts"),M=U("./src/controller/audio-track-controller.ts"),Y=U("./src/controller/subtitle-stream-controller.ts"),X=U("./src/controller/subtitle-track-controller.ts"),k=U("./src/controller/buffer-controller.ts"),D=U("./src/controller/timeline-controller.ts"),v=U("./src/controller/cap-level-controller.ts"),_=U("./src/controller/fps-controller.ts"),p=U("./src/controller/eme-controller.ts"),o=U("./src/controller/cmcd-controller.ts"),u=U("./src/utils/xhr-loader.ts"),r=U("./src/utils/fetch-loader.ts"),i=U("./src/utils/cues.ts"),t=U("./src/utils/mediakeys-helper.ts"),c=U("./src/utils/logger.ts");function f(){return f=Object.assign||function(d){for(var l=1;l<arguments.length;l++){var h=arguments[l];for(var g in h)Object.prototype.hasOwnProperty.call(h,g)&&(d[g]=h[g])}return d},f.apply(this,arguments)}function A(d,l){var h=Object.keys(d);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(d);l&&(g=g.filter(function(b){return Object.getOwnPropertyDescriptor(d,b).enumerable})),h.push.apply(h,g)}return h}function S(d){for(var l=1;l<arguments.length;l++){var h=arguments[l]!=null?arguments[l]:{};l%2?A(Object(h),!0).forEach(function(g){w(d,g,h[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(h)):A(Object(h)).forEach(function(g){Object.defineProperty(d,g,Object.getOwnPropertyDescriptor(h,g))})}return d}function w(d,l,h){return l in d?Object.defineProperty(d,l,{value:h,enumerable:!0,configurable:!0,writable:!0}):d[l]=h,d}var R=S(S({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:u.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:ee.default,bufferController:k.default,capLevelController:v.default,fpsController:_.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:t.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},O()),{},{subtitleStreamController:Y.SubtitleStreamController,subtitleTrackController:X.default,timelineController:D.TimelineController,audioStreamController:H.default,audioTrackController:M.default,emeController:p.default,cmcdController:o.default});function O(){return{cueHandler:i.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function E(d,l){if((l.liveSyncDurationCount||l.liveMaxLatencyDurationCount)&&(l.liveSyncDuration||l.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(l.liveMaxLatencyDurationCount!==void 0&&(l.liveSyncDurationCount===void 0||l.liveMaxLatencyDurationCount<=l.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(l.liveMaxLatencyDuration!==void 0&&(l.liveSyncDuration===void 0||l.liveMaxLatencyDuration<=l.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return f({},d,l)}function y(d){var l=d.loader;if(l!==r.default&&l!==u.default)c.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),d.progressive=!1;else{var h=Object(r.fetchSupported)();h&&(d.loader=r.default,d.progressive=!0,d.enableSoftwareAES=!0,c.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ie,Z,U){"use strict";U.r(Z);var ee=U("./src/polyfills/number.ts"),H=U("./src/utils/ewma-bandwidth-estimator.ts"),M=U("./src/events.ts"),Y=U("./src/utils/buffer-helper.ts"),X=U("./src/errors.ts"),k=U("./src/types/loader.ts"),D=U("./src/utils/logger.ts");function v(o,u){for(var r=0;r<u.length;r++){var i=u[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(o,i.key,i)}}function _(o,u,r){return u&&v(o.prototype,u),r&&v(o,r),o}var p=function(){function o(r){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=r;var i=r.config;this.bwEstimator=new H.default(i.abrEwmaSlowVoD,i.abrEwmaFastVoD,i.abrEwmaDefaultEstimate),this.registerListeners()}var u=o.prototype;return u.registerListeners=function(){var i=this.hls;i.on(M.Events.FRAG_LOADING,this.onFragLoading,this),i.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),i.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),i.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),i.on(M.Events.ERROR,this.onError,this)},u.unregisterListeners=function(){var i=this.hls;i.off(M.Events.FRAG_LOADING,this.onFragLoading,this),i.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),i.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),i.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),i.off(M.Events.ERROR,this.onError,this)},u.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},u.onFragLoading=function(i,t){var c=t.frag;if(c.type===k.PlaylistLevelType.MAIN&&!this.timer){var f;this.fragCurrent=c,this.partCurrent=(f=t.part)!=null?f:null,this.timer=self.setInterval(this.onCheck,100)}},u.onLevelLoaded=function(i,t){var c=this.hls.config;t.details.live?this.bwEstimator.update(c.abrEwmaSlowLive,c.abrEwmaFastLive):this.bwEstimator.update(c.abrEwmaSlowVoD,c.abrEwmaFastVoD)},u._abandonRulesCheck=function(){var i=this.fragCurrent,t=this.partCurrent,c=this.hls,f=c.autoLevelEnabled,A=c.config,S=c.media;if(!i||!S)return;var w=t?t.stats:i.stats,R=t?t.duration:i.duration;if(w.aborted){D.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!f||S.paused||!S.playbackRate||!S.readyState)return;var O=performance.now()-w.loading.start,E=Math.abs(S.playbackRate);if(O<=500*R/E)return;var y=c.levels,d=c.minAutoLevel,l=y[i.level],h=w.total||Math.max(w.loaded,Math.round(R*l.maxBitrate/8)),g=Math.max(1,w.bwEstimate?w.bwEstimate/8:w.loaded*1e3/O),b=(h-w.loaded)/g,F=S.currentTime,N=(Y.BufferHelper.bufferInfo(S,F,A.maxBufferHole).end-F)/E;if(N>=2*R/E||b<=N)return;var W=Number.POSITIVE_INFINITY,K;for(K=i.level-1;K>d;K--){var I=y[K].maxBitrate;if(W=R*I/(8*.8*g),W<N)break}if(W>=b)return;var x=this.bwEstimator.getEstimate();D.logger.warn("Fragment "+i.sn+(t?" part "+t.index:"")+" of level "+i.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+K+`
|
|
Current BW estimate: `+(Object(ee.isFiniteNumber)(x)?(x/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+b.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+W.toFixed(3)+` s
|
|
Time to underbuffer: `+N.toFixed(3)+" s"),c.nextLoadLevel=K,this.bwEstimator.sample(O,w.loaded),this.clearTimer(),i.loader&&(this.fragCurrent=this.partCurrent=null,i.loader.abort()),c.trigger(M.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:i,part:t,stats:w})},u.onFragLoaded=function(i,t){var c=t.frag,f=t.part;if(c.type===k.PlaylistLevelType.MAIN&&Object(ee.isFiniteNumber)(c.sn)){var A=f?f.stats:c.stats,S=f?f.duration:c.duration;if(this.clearTimer(),this.lastLoadedFragLevel=c.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var w=this.hls.levels[c.level],R=(w.loaded?w.loaded.bytes:0)+A.loaded,O=(w.loaded?w.loaded.duration:0)+S;w.loaded={bytes:R,duration:O},w.realBitrate=Math.round(8*R/O)}if(c.bitrateTest){var E={stats:A,frag:c,part:f,id:c.type};this.onFragBuffered(M.Events.FRAG_BUFFERED,E),c.bitrateTest=!1}}},u.onFragBuffered=function(i,t){var c=t.frag,f=t.part,A=f?f.stats:c.stats;if(A.aborted)return;if(c.type!==k.PlaylistLevelType.MAIN||c.sn==="initSegment")return;var S=A.parsing.end-A.loading.start;this.bwEstimator.sample(S,A.loaded),A.bwEstimate=this.bwEstimator.getEstimate(),c.bitrateTest?this.bitrateTestDelay=S/1e3:this.bitrateTestDelay=0},u.onError=function(i,t){switch(t.details){case X.ErrorDetails.FRAG_LOAD_ERROR:case X.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},u.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},u.getNextABRAutoLevel=function(){var i=this.fragCurrent,t=this.partCurrent,c=this.hls,f=c.maxAutoLevel,A=c.config,S=c.minAutoLevel,w=c.media,R=t?t.duration:i?i.duration:0,O=w?w.currentTime:0,E=w&&w.playbackRate!==0?Math.abs(w.playbackRate):1,y=this.bwEstimator?this.bwEstimator.getEstimate():A.abrEwmaDefaultEstimate,d=(Y.BufferHelper.bufferInfo(w,O,A.maxBufferHole).end-O)/E,l=this.findBestLevel(y,S,f,d,A.abrBandWidthFactor,A.abrBandWidthUpFactor);if(l>=0)return l;D.logger.trace((d?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var h=R?Math.min(R,A.maxStarvationDelay):A.maxStarvationDelay,g=A.abrBandWidthFactor,b=A.abrBandWidthUpFactor;if(!d){var F=this.bitrateTestDelay;if(F){var N=R?Math.min(R,A.maxLoadingDelay):A.maxLoadingDelay;h=N-F,D.logger.trace("bitrate test took "+Math.round(1e3*F)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*h)+" ms"),g=b=1}}return l=this.findBestLevel(y,S,f,d+h,g,b),Math.max(l,0)},u.findBestLevel=function(i,t,c,f,A,S){for(var w,R=this.fragCurrent,O=this.partCurrent,E=this.lastLoadedFragLevel,y=this.hls.levels,d=y[E],l=!!(d!=null&&(w=d.details)!==null&&w!==void 0&&w.live),h=d==null?void 0:d.codecSet,g=O?O.duration:R?R.duration:0,b=c;b>=t;b--){var F=y[b];if(!F||h&&F.codecSet!==h)continue;var N=F.details,W=(O?N==null?void 0:N.partTarget:N==null?void 0:N.averagetargetduration)||g,K=void 0;b<=E?K=A*i:K=S*i;var I=y[b].maxBitrate,x=I*W/K;if(D.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+b+"/"+Math.round(K)+"/"+I+"/"+W+"/"+f+"/"+x),K>I&&(!x||l&&!this.bitrateTestDelay||x<f))return b}return-1},_(o,[{key:"nextAutoLevel",get:function(){var i=this._nextAutoLevel,t=this.bwEstimator;if(i!==-1&&(!t||!t.canEstimate()))return i;var c=this.getNextABRAutoLevel();return i!==-1&&(c=Math.min(i,c)),c},set:function(i){this._nextAutoLevel=i}}]),o}();Z.default=p},"./src/controller/audio-stream-controller.ts":function(ie,Z,U){"use strict";U.r(Z);var ee=U("./src/polyfills/number.ts"),H=U("./src/controller/base-stream-controller.ts"),M=U("./src/events.ts"),Y=U("./src/utils/buffer-helper.ts"),X=U("./src/controller/fragment-tracker.ts"),k=U("./src/types/level.ts"),D=U("./src/types/loader.ts"),v=U("./src/loader/fragment.ts"),_=U("./src/demux/chunk-cache.ts"),p=U("./src/demux/transmuxer-interface.ts"),o=U("./src/types/transmuxer.ts"),u=U("./src/controller/fragment-finders.ts"),r=U("./src/utils/discontinuities.ts"),i=U("./src/errors.ts"),t=U("./src/utils/logger.ts");function c(){return c=Object.assign||function(R){for(var O=1;O<arguments.length;O++){var E=arguments[O];for(var y in E)Object.prototype.hasOwnProperty.call(E,y)&&(R[y]=E[y])}return R},c.apply(this,arguments)}function f(R,O){R.prototype=Object.create(O.prototype),R.prototype.constructor=R,A(R,O)}function A(R,O){return A=Object.setPrototypeOf||function(y,d){return y.__proto__=d,y},A(R,O)}var S=100,w=function(R){f(O,R);function O(y,d){var l;return l=R.call(this,y,d,"[audio-stream-controller]")||this,l.videoBuffer=null,l.videoTrackCC=-1,l.waitingVideoCC=-1,l.audioSwitch=!1,l.trackId=-1,l.waitingData=null,l.mainDetails=null,l.bufferFlushed=!1,l._registerListeners(),l}var E=O.prototype;return E.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},E._registerListeners=function(){var d=this.hls;d.on(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.on(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.on(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(M.Events.ERROR,this.onError,this),d.on(M.Events.BUFFER_RESET,this.onBufferReset,this),d.on(M.Events.BUFFER_CREATED,this.onBufferCreated,this),d.on(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.on(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},E._unregisterListeners=function(){var d=this.hls;d.off(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.off(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.off(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(M.Events.ERROR,this.onError,this),d.off(M.Events.BUFFER_RESET,this.onBufferReset,this),d.off(M.Events.BUFFER_CREATED,this.onBufferCreated,this),d.off(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.off(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},E.onInitPtsFound=function(d,l){var h=l.frag,g=l.id,b=l.initPTS;if(g==="main"){var F=h.cc;this.initPTS[h.cc]=b,this.log("InitPTS for cc: "+F+" found from main: "+b),this.videoTrackCC=F,this.state===H.State.WAITING_INIT_PTS&&this.tick()}},E.startLoad=function(d){if(!this.levels){this.startPosition=d,this.state=H.State.STOPPED;return}var l=this.lastCurrentTime;this.stopLoad(),this.setInterval(S),this.fragLoadError=0,l>0&&d===-1?(this.log("Override startPosition with lastCurrentTime @"+l.toFixed(3)),this.state=H.State.IDLE):(this.loadedmetadata=!1,this.state=H.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=d,this.tick()},E.doTick=function(){switch(this.state){case H.State.IDLE:this.doTickIdle();break;case H.State.WAITING_TRACK:{var d,l=this.levels,h=this.trackId,g=l==null||((d=l[h])===null||d===void 0)?void 0:d.details;if(g){if(this.waitForCdnTuneIn(g))break;this.state=H.State.WAITING_INIT_PTS}break}case H.State.FRAG_LOADING_WAITING_RETRY:{var b,F=performance.now(),N=this.retryDate;(!N||F>=N||(b=this.media)!==null&&b!==void 0&&b.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=H.State.IDLE);break}case H.State.WAITING_INIT_PTS:{var W=this.waitingData;if(W){var K=W.frag,I=W.part,x=W.cache,j=W.complete;if(this.initPTS[K.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=H.State.FRAG_LOADING;var $=x.flush(),ae={frag:K,part:I,payload:$,networkDetails:null};this._handleFragmentLoadProgress(ae),j&&R.prototype._handleFragmentLoadComplete.call(this,ae)}else if(this.videoTrackCC!==this.waitingVideoCC)t.logger.log("Waiting fragment cc ("+K.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var fe=this.getLoadPosition(),pe=Y.BufferHelper.bufferInfo(this.mediaBuffer,fe,this.config.maxBufferHole),Ce=Object(u.fragmentWithinToleranceTest)(pe.end,this.config.maxFragLookUpTolerance,K);Ce<0&&(t.logger.log("Waiting fragment cc ("+K.cc+") @ "+K.start+" cancelled because another fragment at "+pe.end+" is needed"),this.clearWaitingFragment())}}else this.state=H.State.IDLE}}this.onTickEnd()},E.clearWaitingFragment=function(){var d=this.waitingData;d&&(this.fragmentTracker.removeFragment(d.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=H.State.IDLE)},E.onTickEnd=function(){var d=this.media;if(!d||!d.readyState)return;var l=this.mediaBuffer?this.mediaBuffer:d,h=l.buffered;!this.loadedmetadata&&h.length&&(this.loadedmetadata=!0),this.lastCurrentTime=d.currentTime},E.doTickIdle=function(){var d,l,h=this.hls,g=this.levels,b=this.media,F=this.trackId,N=h.config;if(!g||!g[F])return;if(!b&&(this.startFragRequested||!N.startFragPrefetch))return;var W=g[F],K=W.details;if(!K||K.live&&this.levelLastLoaded!==F||this.waitForCdnTuneIn(K)){this.state=H.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,v.ElementaryStreamTypes.AUDIO,D.PlaylistLevelType.AUDIO));var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,D.PlaylistLevelType.AUDIO);if(I===null)return;var x=I.len,j=this.getMaxBufferLength(),$=this.audioSwitch;if(x>=j&&!$)return;if(!$&&this._streamEnded(I,K)){h.trigger(M.Events.BUFFER_EOS,{type:"audio"}),this.state=H.State.ENDED;return}var ae=K.fragments,fe=ae[0].start,pe=I.end;if($){var Ce=this.getLoadPosition();pe=Ce,K.PTSKnown&&Ce<fe&&((I.end>fe||I.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),b.currentTime=fe+.05))}var De=this.getNextFragment(pe,K);if(!De){this.bufferFlushed=!0;return}((d=De.decryptdata)===null||d===void 0?void 0:d.keyFormat)==="identity"&&!((l=De.decryptdata)!==null&&l!==void 0&&l.key)?this.loadKey(De,K):this.loadFragment(De,K,pe)},E.getMaxBufferLength=function(){var d=R.prototype.getMaxBufferLength.call(this),l=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,D.PlaylistLevelType.MAIN);return l===null?d:Math.max(d,l.len)},E.onMediaDetaching=function(){this.videoBuffer=null,R.prototype.onMediaDetaching.call(this)},E.onAudioTracksUpdated=function(d,l){var h=l.audioTracks;this.resetTransmuxer(),this.levels=h.map(function(g){return new k.Level(g)})},E.onAudioTrackSwitching=function(d,l){var h=!!l.url;this.trackId=l.id;var g=this.fragCurrent;g!=null&&g.loader&&g.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),h?this.setInterval(S):this.resetTransmuxer(),h?(this.audioSwitch=!0,this.state=H.State.IDLE):this.state=H.State.STOPPED,this.tick()},E.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},E.onLevelLoaded=function(d,l){this.mainDetails=l.details},E.onAudioTrackLoaded=function(d,l){var h,g=this.levels,b=l.details,F=l.id;if(!g){this.warn("Audio tracks were reset while loading level "+F);return}this.log("Track "+F+" loaded ["+b.startSN+","+b.endSN+"],duration:"+b.totalduration);var N=g[F],W=0;if(b.live||(h=N.details)!==null&&h!==void 0&&h.live){var K=this.mainDetails;if(b.fragments[0]||(b.deltaUpdateFailed=!0),b.deltaUpdateFailed||!K)return;!N.details&&b.hasProgramDateTime&&K.hasProgramDateTime?(Object(r.alignMediaPlaylistByPDT)(b,K),W=b.fragments[0].start):W=this.alignPlaylists(b,N.details)}N.details=b,this.levelLastLoaded=F,!this.startFragRequested&&(this.mainDetails||!b.live)&&this.setStartPosition(N.details,W),this.state===H.State.WAITING_TRACK&&!this.waitForCdnTuneIn(b)&&(this.state=H.State.IDLE),this.tick()},E._handleFragmentLoadProgress=function(d){var l,h=d.frag,g=d.part,b=d.payload,F=this.config,N=this.trackId,W=this.levels;if(!W){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+h.sn+" of level "+h.level+" will not be buffered");return}var K=W[N];console.assert(K,"Audio track is defined on fragment load progress");var I=K.details;console.assert(I,"Audio track details are defined on fragment load progress");var x=F.defaultAudioCodec||K.audioCodec||"mp4a.40.2",j=this.transmuxer;j||(j=this.transmuxer=new p.default(this.hls,D.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var $=this.initPTS[h.cc],ae=(l=h.initSegment)===null||l===void 0?void 0:l.data;if($!==void 0){var fe=!1,pe=g?g.index:-1,Ce=pe!==-1,De=new o.ChunkMetadata(h.level,h.sn,h.stats.chunkCount,b.byteLength,pe,Ce);j.push(b,ae,x,"",h,g,I.totalduration,fe,De,$)}else{t.logger.log("Unknown video PTS for cc "+h.cc+", waiting for video PTS before demuxing audio frag "+h.sn+" of ["+I.startSN+" ,"+I.endSN+"],track "+N);var xe=this.waitingData=this.waitingData||{frag:h,part:g,cache:new _.default,complete:!1},Oe=xe.cache;Oe.push(new Uint8Array(b)),this.waitingVideoCC=this.videoTrackCC,this.state=H.State.WAITING_INIT_PTS}},E._handleFragmentLoadComplete=function(d){if(this.waitingData){this.waitingData.complete=!0;return}R.prototype._handleFragmentLoadComplete.call(this,d)},E.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},E.onBufferCreated=function(d,l){var h=l.tracks.audio;h&&(this.mediaBuffer=h.buffer),l.tracks.video&&(this.videoBuffer=l.tracks.video.buffer)},E.onFragBuffered=function(d,l){var h=l.frag,g=l.part;if(h.type!==D.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(h)){this.warn("Fragment "+h.sn+(g?" p: "+g.index:"")+" of level "+h.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}h.sn!=="initSegment"&&(this.fragPrevious=h,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(M.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(h,g)},E.onError=function(d,l){switch(l.details){case i.ErrorDetails.FRAG_LOAD_ERROR:case i.ErrorDetails.FRAG_LOAD_TIMEOUT:case i.ErrorDetails.KEY_LOAD_ERROR:case i.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(D.PlaylistLevelType.AUDIO,l);break;case i.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case i.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==H.State.ERROR&&this.state!==H.State.STOPPED&&(this.state=l.fatal?H.State.ERROR:H.State.IDLE,this.warn(l.details+" while loading frag, switching to "+this.state+" state"));break;case i.ErrorDetails.BUFFER_FULL_ERROR:if(l.parent==="audio"&&(this.state===H.State.PARSING||this.state===H.State.PARSED)){var h=!0,g=this.getFwdBufferInfo(this.mediaBuffer,D.PlaylistLevelType.AUDIO);g&&g.len>.5&&(h=!this.reduceMaxBufferLength(g.len)),h&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,R.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},E.onBufferFlushed=function(d,l){var h=l.type;h===v.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},E._handleTransmuxComplete=function(d){var l,h="audio",g=this.hls,b=d.remuxResult,F=d.chunkMeta,N=this.getCurrentContext(F);if(!N){this.warn("The loading context changed while buffering fragment "+F.sn+" of level "+F.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(F.level);return}var W=N.frag,K=N.part,I=b.audio,x=b.text,j=b.id3,$=b.initSegment;if(this.fragContextChanged(W))return;if(this.state=H.State.PARSING,this.audioSwitch&&I&&this.completeAudioSwitch(),$!=null&&$.tracks&&(this._bufferInitSegment($.tracks,W,F),g.trigger(M.Events.FRAG_PARSING_INIT_SEGMENT,{frag:W,id:h,tracks:$.tracks})),I){var ae=I.startPTS,fe=I.endPTS,pe=I.startDTS,Ce=I.endDTS;K&&(K.elementaryStreams[v.ElementaryStreamTypes.AUDIO]={startPTS:ae,endPTS:fe,startDTS:pe,endDTS:Ce}),W.setElementaryStreamInfo(v.ElementaryStreamTypes.AUDIO,ae,fe,pe,Ce),this.bufferFragmentData(I,W,K,F)}if(j!=null&&(l=j.samples)!==null&&l!==void 0&&l.length){var De=c({frag:W,id:h},j);g.trigger(M.Events.FRAG_PARSING_METADATA,De)}if(x){var xe=c({frag:W,id:h},x);g.trigger(M.Events.FRAG_PARSING_USERDATA,xe)}},E._bufferInitSegment=function(d,l,h){if(this.state!==H.State.PARSING)return;d.video&&delete d.video;var g=d.audio;if(!g)return;g.levelCodec=g.codec,g.id="audio",this.log("Init audio buffer, container:"+g.container+", codecs[parsed]=["+g.codec+"]"),this.hls.trigger(M.Events.BUFFER_CODECS,d);var b=g.initSegment;if(b!=null&&b.byteLength){var F={type:"audio",frag:l,part:null,chunkMeta:h,parent:l.type,data:b};this.hls.trigger(M.Events.BUFFER_APPENDING,F)}this.tick()},E.loadFragment=function(d,l,h){var g=this.fragmentTracker.getState(d);this.fragCurrent=d,(this.audioSwitch||g===X.FragmentState.NOT_LOADED||g===X.FragmentState.PARTIAL)&&(d.sn==="initSegment"?this._loadInitSegment(d):l.live&&!Object(ee.isFiniteNumber)(this.initPTS[d.cc])?(this.log("Waiting for video PTS in continuity counter "+d.cc+" of live stream before loading audio fragment "+d.sn+" of level "+this.trackId),this.state=H.State.WAITING_INIT_PTS):(this.startFragRequested=!0,R.prototype.loadFragment.call(this,d,l,h)))},E.completeAudioSwitch=function(){var d=this.hls,l=this.media,h=this.trackId;l&&(this.log("Switching audio track : flushing all audio"),R.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,d.trigger(M.Events.AUDIO_TRACK_SWITCHED,{id:h})},O}(H.default);Z.default=w},"./src/controller/audio-track-controller.ts":function(ie,Z,U){"use strict";U.r(Z);var ee=U("./src/events.ts"),H=U("./src/errors.ts"),M=U("./src/controller/base-playlist-controller.ts"),Y=U("./src/types/loader.ts");function X(p,o){for(var u=0;u<o.length;u++){var r=o[u];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(p,r.key,r)}}function k(p,o,u){return o&&X(p.prototype,o),u&&X(p,u),p}function D(p,o){p.prototype=Object.create(o.prototype),p.prototype.constructor=p,v(p,o)}function v(p,o){return v=Object.setPrototypeOf||function(r,i){return r.__proto__=i,r},v(p,o)}var _=function(p){D(o,p);function o(r){var i;return i=p.call(this,r,"[audio-track-controller]")||this,i.tracks=[],i.groupId=null,i.tracksInGroup=[],i.trackId=-1,i.trackName="",i.selectDefaultTrack=!0,i.registerListeners(),i}var u=o.prototype;return u.registerListeners=function(){var i=this.hls;i.on(ee.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.on(ee.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.on(ee.Events.LEVEL_LOADING,this.onLevelLoading,this),i.on(ee.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),i.on(ee.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),i.on(ee.Events.ERROR,this.onError,this)},u.unregisterListeners=function(){var i=this.hls;i.off(ee.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.off(ee.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.off(ee.Events.LEVEL_LOADING,this.onLevelLoading,this),i.off(ee.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),i.off(ee.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),i.off(ee.Events.ERROR,this.onError,this)},u.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,p.prototype.destroy.call(this)},u.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},u.onManifestParsed=function(i,t){this.tracks=t.audioTracks||[]},u.onAudioTrackLoaded=function(i,t){var c=t.id,f=t.details,A=this.tracksInGroup[c];if(!A){this.warn("Invalid audio track id "+c);return}var S=A.details;A.details=t.details,this.log("audioTrack "+c+" loaded ["+f.startSN+"-"+f.endSN+"]"),c===this.trackId&&(this.retryCount=0,this.playlistLoaded(c,t,S))},u.onLevelLoading=function(i,t){this.switchLevel(t.level)},u.onLevelSwitching=function(i,t){this.switchLevel(t.level)},u.switchLevel=function(i){var t=this.hls.levels[i];if(!(t!=null&&t.audioGroupIds))return;var c=t.audioGroupIds[t.urlId];if(this.groupId!==c){this.groupId=c;var f=this.tracks.filter(function(S){return!c||S.groupId===c});this.selectDefaultTrack&&!f.some(function(S){return S.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=f;var A={audioTracks:f};this.log("Updating audio tracks, "+f.length+' track(s) found in "'+c+'" group-id'),this.hls.trigger(ee.Events.AUDIO_TRACKS_UPDATED,A),this.selectInitialTrack()}},u.onError=function(i,t){if(p.prototype.onError.call(this,i,t),t.fatal||!t.context)return;t.context.type===Y.PlaylistContextType.AUDIO_TRACK&&t.context.id===this.trackId&&t.context.groupId===this.groupId&&this.retryLoadingOrFail(t)},u.setAudioTrack=function(i){var t=this.tracksInGroup;if(i<0||i>=t.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var c=t[this.trackId];this.log("Now switching to audio-track index "+i);var f=t[i],A=f.id,S=f.groupId,w=S===void 0?"":S,R=f.name,O=f.type,E=f.url;if(this.trackId=i,this.trackName=R,this.selectDefaultTrack=!1,this.hls.trigger(ee.Events.AUDIO_TRACK_SWITCHING,{id:A,groupId:w,name:R,type:O,url:E}),f.details&&!f.details.live)return;var y=this.switchParams(f.url,c==null?void 0:c.details);this.loadPlaylist(y)},u.selectInitialTrack=function(){var i=this.tracksInGroup;console.assert(i.length,"Initial audio track should be selected when tracks are known");var t=this.trackName,c=this.findTrackId(t)||this.findTrackId();c!==-1?this.setAudioTrack(c):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(ee.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},u.findTrackId=function(i){for(var t=this.tracksInGroup,c=0;c<t.length;c++){var f=t[c];if((!this.selectDefaultTrack||f.default)&&(!i||i===f.name))return f.id}return-1},u.loadPlaylist=function(i){var t=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(t)){var c=t.id,f=t.groupId,A=t.url;if(i)try{A=i.addDirectives(A)}catch(S){this.warn("Could not construct new URL with HLS Delivery Directives: "+S)}this.log("loading audio-track playlist for id: "+c),this.clearTimer(),this.hls.trigger(ee.Events.AUDIO_TRACK_LOADING,{url:A,id:c,groupId:f,deliveryDirectives:i||null})}},k(o,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(i){this.selectDefaultTrack=!1,this.setAudioTrack(i)}}]),o}(M.default);Z.default=_},"./src/controller/base-playlist-controller.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"default",function(){return k});var ee=U("./src/polyfills/number.ts"),H=U("./src/types/level.ts"),M=U("./src/controller/level-helper.ts"),Y=U("./src/utils/logger.ts"),X=U("./src/errors.ts"),k=function(){function D(_,p){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=Y.logger.log.bind(Y.logger,p+":"),this.warn=Y.logger.warn.bind(Y.logger,p+":"),this.hls=_}var v=D.prototype;return v.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},v.onError=function(p,o){o.fatal&&o.type===X.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},v.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},v.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},v.stopLoad=function(){this.canLoad=!1,this.clearTimer()},v.switchParams=function(p,o){var u=o==null?void 0:o.renditionReports;if(u)for(var r=0;r<u.length;r++){var i=u[r],t=""+i.URI;if(t===p.substr(-t.length)){var c=parseInt(i["LAST-MSN"]),f=parseInt(i["LAST-PART"]);if(o&&this.hls.config.lowLatencyMode){var A=Math.min(o.age-o.partTarget,o.targetduration);f!==void 0&&A>o.partTarget&&(f+=1)}if(Object(ee.isFiniteNumber)(c))return new H.HlsUrlParameters(c,Object(ee.isFiniteNumber)(f)?f:void 0,H.HlsSkip.No)}}},v.loadPlaylist=function(p){},v.shouldLoadTrack=function(p){return this.canLoad&&p&&!!p.url&&(!p.details||p.details.live)},v.playlistLoaded=function(p,o,u){var r=this,i=o.details,t=o.stats,c=t.loading.end?Math.max(0,self.performance.now()-t.loading.end):0;if(i.advancedDateTime=Date.now()-c,i.live||u!=null&&u.live){if(i.reloaded(u),u&&this.log("live playlist "+p+" "+(i.advanced?"REFRESHED "+i.lastPartSn+"-"+i.lastPartIndex:"MISSED")),u&&i.fragments.length>0&&Object(M.mergeDetails)(u,i),!this.canLoad||!i.live)return;var f,A=void 0,S=void 0;if(i.canBlockReload&&i.endSN&&i.advanced){var w=this.hls.config.lowLatencyMode,R=i.lastPartSn,O=i.endSN,E=i.lastPartIndex,y=E!==-1,d=R===O,l=w?0:E;y?(A=d?O+1:R,S=d?l:E+1):A=O+1;var h=i.age,g=h+i.ageHeader,b=Math.min(g-i.partTarget,i.targetduration*1.5);if(b>0){if(u&&b>u.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+u.tuneInGoal+" to: "+b+" with playlist age: "+i.age),b=0;else{var F=Math.floor(b/i.targetduration);if(A+=F,S!==void 0){var N=Math.round(b%i.targetduration/i.partTarget);S+=N}this.log("CDN Tune-in age: "+i.ageHeader+"s last advanced "+h.toFixed(2)+"s goal: "+b+" skip sn "+F+" to part "+S)}i.tuneInGoal=b}if(f=this.getDeliveryDirectives(i,o.deliveryDirectives,A,S),w||!d){this.loadPlaylist(f);return}}else f=this.getDeliveryDirectives(i,o.deliveryDirectives,A,S);var W=Object(M.computeReloadInterval)(i,t);A!==void 0&&i.canBlockReload&&(W-=i.partTarget||1),this.log("reload live playlist "+p+" in "+Math.round(W)+" ms"),this.timer=self.setTimeout(function(){return r.loadPlaylist(f)},W)}else this.clearTimer()},v.getDeliveryDirectives=function(p,o,u,r){var i=Object(H.getSkipValue)(p,u);return o!=null&&o.skip&&p.deltaUpdateFailed&&(u=o.msn,r=o.part,i=H.HlsSkip.No),new H.HlsUrlParameters(u,r,i)},v.retryLoadingOrFail=function(p){var o=this,u=this.hls.config,r=this.retryCount<u.levelLoadingMaxRetry;if(r){var i;if(this.retryCount++,p.details.indexOf("LoadTimeOut")>-1&&(i=p.context)!==null&&i!==void 0&&i.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+p.details+'"'),this.loadPlaylist();else{var t=Math.min(Math.pow(2,this.retryCount)*u.levelLoadingRetryDelay,u.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return o.loadPlaylist()},t),this.warn("retry playlist loading #"+this.retryCount+" in "+t+' ms after "'+p.details+'"')}}else this.warn('cannot recover from error "'+p.details+'"'),this.clearTimer(),p.fatal=!0;return r},D}()},"./src/controller/base-stream-controller.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"State",function(){return O}),U.d(Z,"default",function(){return E});var ee=U("./src/polyfills/number.ts"),H=U("./src/task-loop.ts"),M=U("./src/controller/fragment-tracker.ts"),Y=U("./src/utils/buffer-helper.ts"),X=U("./src/utils/logger.ts"),k=U("./src/events.ts"),D=U("./src/errors.ts"),v=U("./src/types/transmuxer.ts"),_=U("./src/utils/mp4-tools.ts"),p=U("./src/utils/discontinuities.ts"),o=U("./src/controller/fragment-finders.ts"),u=U("./src/controller/level-helper.ts"),r=U("./src/loader/fragment-loader.ts"),i=U("./src/crypt/decrypter.ts"),t=U("./src/utils/time-ranges.ts"),c=U("./src/types/loader.ts");function f(y,d){for(var l=0;l<d.length;l++){var h=d[l];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(y,h.key,h)}}function A(y,d,l){return d&&f(y.prototype,d),l&&f(y,l),y}function S(y){if(y===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return y}function w(y,d){y.prototype=Object.create(d.prototype),y.prototype.constructor=y,R(y,d)}function R(y,d){return R=Object.setPrototypeOf||function(h,g){return h.__proto__=g,h},R(y,d)}var O={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},E=function(y){w(d,y);function d(h,g,b){var F;return F=y.call(this)||this,F.hls=void 0,F.fragPrevious=null,F.fragCurrent=null,F.fragmentTracker=void 0,F.transmuxer=null,F._state=O.STOPPED,F.media=void 0,F.mediaBuffer=void 0,F.config=void 0,F.bitrateTest=!1,F.lastCurrentTime=0,F.nextLoadPosition=0,F.startPosition=0,F.loadedmetadata=!1,F.fragLoadError=0,F.retryDate=0,F.levels=null,F.fragmentLoader=void 0,F.levelLastLoaded=null,F.startFragRequested=!1,F.decrypter=void 0,F.initPTS=[],F.onvseeking=null,F.onvended=null,F.logPrefix="",F.log=void 0,F.warn=void 0,F.logPrefix=b,F.log=X.logger.log.bind(X.logger,b+":"),F.warn=X.logger.warn.bind(X.logger,b+":"),F.hls=h,F.fragmentLoader=new r.default(h.config),F.fragmentTracker=g,F.config=h.config,F.decrypter=new i.default(h,h.config),h.on(k.Events.KEY_LOADED,F.onKeyLoaded,S(F)),F}var l=d.prototype;return l.doTick=function(){this.onTickEnd()},l.onTickEnd=function(){},l.startLoad=function(g){},l.stopLoad=function(){this.fragmentLoader.abort();var g=this.fragCurrent;g&&this.fragmentTracker.removeFragment(g),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=O.STOPPED},l._streamEnded=function(g,b){var F=this.fragCurrent,N=this.fragmentTracker;if(!b.live&&F&&F.sn===b.endSN&&!g.nextStart){var W=N.getState(F);return W===M.FragmentState.PARTIAL||W===M.FragmentState.OK}return!1},l.onMediaAttached=function(g,b){var F=this.media=this.mediaBuffer=b.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),F.addEventListener("seeking",this.onvseeking),F.addEventListener("ended",this.onvended);var N=this.config;this.levels&&N.autoStartLoad&&this.state===O.STOPPED&&this.startLoad(N.startPosition)},l.onMediaDetaching=function(){var g=this.media;g!=null&&g.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),g&&(g.removeEventListener("seeking",this.onvseeking),g.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},l.onMediaSeeking=function(){var g=this.config,b=this.fragCurrent,F=this.media,N=this.mediaBuffer,W=this.state,K=F?F.currentTime:0,I=Y.BufferHelper.bufferInfo(N||F,K,g.maxBufferHole);if(this.log("media seeking to "+(Object(ee.isFiniteNumber)(K)?K.toFixed(3):K)+", state: "+W),W===O.ENDED)this.resetLoadingState();else if(b&&!I.len){var x=g.maxFragLookUpTolerance,j=b.start-x,$=b.start+b.duration+x,ae=K>$;(K<j||ae)&&(ae&&b.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),b.loader.abort()),this.resetLoadingState())}F&&(this.lastCurrentTime=K),!this.loadedmetadata&&!I.len&&(this.nextLoadPosition=this.startPosition=K),this.tickImmediate()},l.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},l.onKeyLoaded=function(g,b){if(this.state!==O.KEY_LOADING||b.frag!==this.fragCurrent||!this.levels)return;this.state=O.IDLE;var F=this.levels[b.frag.level].details;F&&this.loadFragment(b.frag,F,b.frag.start)},l.onHandlerDestroying=function(){this.stopLoad(),y.prototype.onHandlerDestroying.call(this)},l.onHandlerDestroyed=function(){this.state=O.STOPPED,this.hls.off(k.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,y.prototype.onHandlerDestroyed.call(this)},l.loadKey=function(g,b){this.log("Loading key for "+g.sn+" of ["+b.startSN+"-"+b.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level),this.state=O.KEY_LOADING,this.fragCurrent=g,this.hls.trigger(k.Events.KEY_LOADING,{frag:g})},l.loadFragment=function(g,b,F){this._loadFragForPlayback(g,b,F)},l._loadFragForPlayback=function(g,b,F){var N=this,W=function(I){if(N.fragContextChanged(g)){N.warn("Fragment "+g.sn+(I.part?" p: "+I.part.index:"")+" of level "+g.level+" was dropped during download."),N.fragmentTracker.removeFragment(g);return}g.stats.chunkCount++,N._handleFragmentLoadProgress(I)};this._doFragLoad(g,b,F,W).then(function(K){if(!K)return;N.fragLoadError=0;var I=N.state;if(N.fragContextChanged(g)){(I===O.FRAG_LOADING||I===O.BACKTRACKING||!N.fragCurrent&&I===O.PARSING)&&(N.fragmentTracker.removeFragment(g),N.state=O.IDLE);return}if("payload"in K&&(N.log("Loaded fragment "+g.sn+" of level "+g.level),N.hls.trigger(k.Events.FRAG_LOADED,K),N.state===O.BACKTRACKING)){N.fragmentTracker.backtrack(g,K),N.resetFragmentLoading(g);return}N._handleFragmentLoadComplete(K)}).catch(function(K){N.warn(K),N.resetFragmentLoading(g)})},l.flushMainBuffer=function(g,b,F){if(F===void 0&&(F=null),!(g-b))return;var N={startOffset:g,endOffset:b,type:F};this.fragLoadError=0,this.hls.trigger(k.Events.BUFFER_FLUSHING,N)},l._loadInitSegment=function(g){var b=this;this._doFragLoad(g).then(function(F){if(!F||b.fragContextChanged(g)||!b.levels)throw new Error("init load aborted");return F}).then(function(F){var N=b.hls,W=F.payload,K=g.decryptdata;if(W&&W.byteLength>0&&K&&K.key&&K.iv&&K.method==="AES-128"){var I=self.performance.now();return b.decrypter.webCryptoDecrypt(new Uint8Array(W),K.key.buffer,K.iv.buffer).then(function(x){var j=self.performance.now();return N.trigger(k.Events.FRAG_DECRYPTED,{frag:g,payload:x,stats:{tstart:I,tdecrypt:j}}),F.payload=x,F})}return F}).then(function(F){var N=b.fragCurrent,W=b.hls,K=b.levels;if(!K)throw new Error("init load aborted, missing levels");var I=K[g.level].details;console.assert(I,"Level details are defined when init segment is loaded");var x=g.stats;b.state=O.IDLE,b.fragLoadError=0,g.data=new Uint8Array(F.payload),x.parsing.start=x.buffering.start=self.performance.now(),x.parsing.end=x.buffering.end=self.performance.now(),F.frag===N&&W.trigger(k.Events.FRAG_BUFFERED,{stats:x,frag:N,part:null,id:g.type}),b.tick()}).catch(function(F){b.warn(F),b.resetFragmentLoading(g)})},l.fragContextChanged=function(g){var b=this.fragCurrent;return!g||!b||g.level!==b.level||g.sn!==b.sn||g.urlId!==b.urlId},l.fragBufferedComplete=function(g,b){var F=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+g.type+" sn: "+g.sn+(b?" part: "+b.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level+" "+t.default.toString(Y.BufferHelper.getBuffered(F))),this.state=O.IDLE,this.tick()},l._handleFragmentLoadComplete=function(g){var b=this.transmuxer;if(!b)return;var F=g.frag,N=g.part,W=g.partsLoaded,K=!W||W.length===0||W.some(function(x){return!x}),I=new v.ChunkMetadata(F.level,F.sn,F.stats.chunkCount+1,0,N?N.index:-1,!K);b.flush(I)},l._handleFragmentLoadProgress=function(g){},l._doFragLoad=function(g,b,F,N){var W=this;if(F===void 0&&(F=null),!this.levels)throw new Error("frag load aborted, missing levels");if(F=Math.max(g.start,F||0),this.config.lowLatencyMode&&b){var K=b.partList;if(K&&N){F>g.end&&b.fragmentHint&&(g=b.fragmentHint);var I=this.getNextPart(K,g,F);if(I>-1){var x=K[I];return this.log("Loading part sn: "+g.sn+" p: "+x.index+" cc: "+g.cc+" of playlist ["+b.startSN+"-"+b.endSN+"] parts [0-"+I+"-"+(K.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(F.toFixed(3))),this.nextLoadPosition=x.start+x.duration,this.state=O.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:g,part:K[I],targetBufferTime:F}),this.doFragPartsLoad(g,K,I,N).catch(function(j){return W.handleFragLoadError(j)})}else if(!g.url||this.loadedEndOfParts(K,F))return Promise.resolve(null)}}return this.log("Loading fragment "+g.sn+" cc: "+g.cc+" "+(b?"of ["+b.startSN+"-"+b.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(F.toFixed(3))),Object(ee.isFiniteNumber)(g.sn)&&!this.bitrateTest&&(this.nextLoadPosition=g.start+g.duration),this.state=O.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:g,targetBufferTime:F}),this.fragmentLoader.load(g,N).catch(function(j){return W.handleFragLoadError(j)})},l.doFragPartsLoad=function(g,b,F,N){var W=this;return new Promise(function(K,I){var x=[],j=function $(ae){var fe=b[ae];W.fragmentLoader.loadPart(g,fe,N).then(function(pe){x[fe.index]=pe;var Ce=pe.part;W.hls.trigger(k.Events.FRAG_LOADED,pe);var De=b[ae+1];if(De&&De.fragment===g)$(ae+1);else return K({frag:g,part:Ce,partsLoaded:x})}).catch(I)};j(F)})},l.handleFragLoadError=function(g){var b=g.data;return b&&b.details===D.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(b.frag,b.part):this.hls.trigger(k.Events.ERROR,b),null},l._handleTransmuxerFlush=function(g){var b=this.getCurrentContext(g);if(!b||this.state!==O.PARSING){this.fragCurrent||(this.state=O.IDLE);return}var F=b.frag,N=b.part,W=b.level,K=self.performance.now();F.stats.parsing.end=K,N&&(N.stats.parsing.end=K),this.updateLevelTiming(F,N,W,g.partial)},l.getCurrentContext=function(g){var b=this.levels,F=g.level,N=g.sn,W=g.part;if(!b||!b[F])return this.warn("Levels object was unset while buffering fragment "+N+" of level "+F+". The current chunk will not be buffered."),null;var K=b[F],I=W>-1?Object(u.getPartWith)(K,N,W):null,x=I?I.fragment:Object(u.getFragmentWithSN)(K,N,this.fragCurrent);return x?{frag:x,part:I,level:K}:null},l.bufferFragmentData=function(g,b,F,N){if(!g||this.state!==O.PARSING)return;var W=g.data1,K=g.data2,I=W;if(W&&K&&(I=Object(_.appendUint8Array)(W,K)),!I||!I.length)return;var x={type:g.type,frag:b,part:F,chunkMeta:N,parent:b.type,data:I};this.hls.trigger(k.Events.BUFFER_APPENDING,x),g.dropped&&g.independent&&!F&&this.flushBufferGap(b)},l.flushBufferGap=function(g){var b=this.media;if(!b)return;if(!Y.BufferHelper.isBuffered(b,b.currentTime)){this.flushMainBuffer(0,g.start);return}var F=b.currentTime,N=Y.BufferHelper.bufferInfo(b,F,0),W=g.duration,K=Math.min(this.config.maxFragLookUpTolerance*2,W*.25),I=Math.max(Math.min(g.start-K,N.end-K),F+K);g.start-I>K&&this.flushMainBuffer(I,g.start)},l.getFwdBufferInfo=function(g,b){var F=this.config,N=this.getLoadPosition();if(!Object(ee.isFiniteNumber)(N))return null;var W=Y.BufferHelper.bufferInfo(g,N,F.maxBufferHole);if(W.len===0&&W.nextStart!==void 0){var K=this.fragmentTracker.getBufferedFrag(N,b);if(K&&W.nextStart<K.end)return Y.BufferHelper.bufferInfo(g,N,Math.max(W.nextStart,F.maxBufferHole))}return W},l.getMaxBufferLength=function(g){var b=this.config,F;return g?F=Math.max(8*b.maxBufferSize/g,b.maxBufferLength):F=b.maxBufferLength,Math.min(F,b.maxMaxBufferLength)},l.reduceMaxBufferLength=function(g){var b=this.config,F=g||b.maxBufferLength;return b.maxMaxBufferLength>=F?(b.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+b.maxMaxBufferLength+"s"),!0):!1},l.getNextFragment=function(g,b){var F,N,W=b.fragments,K=W.length;if(!K)return null;var I=this.config,x=W[0].start,j;if(b.live){var $=I.initialLiveManifestSize;if(K<$)return this.warn("Not enough fragments to start playback (have: "+K+", need: "+$+")"),null;!b.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(j=this.getInitialLiveFragment(b,W),this.startPosition=j?this.hls.liveSyncPosition||j.start:g)}else g<=x&&(j=W[0]);if(!j){var ae=I.lowLatencyMode?b.partEnd:b.fragmentEnd;j=this.getFragmentAtPosition(g,ae,b)}return(F=j)!==null&&F!==void 0&&F.initSegment&&!((N=j)!==null&&N!==void 0&&N.initSegment.data)&&!this.bitrateTest&&(j=j.initSegment),j},l.getNextPart=function(g,b,F){for(var N=-1,W=!1,K=!0,I=0,x=g.length;I<x;I++){var j=g[I];if(K=K&&!j.independent,N>-1&&F<j.start)break;var $=j.loaded;!$&&(W||j.independent||K)&&j.fragment===b&&(N=I),W=$}return N},l.loadedEndOfParts=function(g,b){var F=g[g.length-1];return F&&b>F.start&&F.loaded},l.getInitialLiveFragment=function(g,b){var F=this.fragPrevious,N=null;if(F){if(g.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+F.programDateTime),N=Object(o.findFragmentByPDT)(b,F.endProgramDateTime,this.config.maxFragLookUpTolerance)),!N){var W=F.sn+1;if(W>=g.startSN&&W<=g.endSN){var K=b[W-g.startSN];F.cc===K.cc&&(N=K,this.log("Live playlist, switching playlist, load frag with next SN: "+N.sn))}N||(N=Object(o.findFragWithCC)(b,F.cc),N&&this.log("Live playlist, switching playlist, load frag with same CC: "+N.sn))}}else{var I=this.hls.liveSyncPosition;I!==null&&(N=this.getFragmentAtPosition(I,this.bitrateTest?g.fragmentEnd:g.edge,g))}return N},l.getFragmentAtPosition=function(g,b,F){var N=this.config,W=this.fragPrevious,K=F.fragments,I=F.endSN,x=F.fragmentHint,j=N.maxFragLookUpTolerance,$=!!(N.lowLatencyMode&&F.partList&&x);$&&x&&!this.bitrateTest&&(K=K.concat(x),I=x.sn);var ae;if(g<b){var fe=g>b-j?0:j;ae=Object(o.findFragmentByPTS)(W,K,g,fe)}else ae=K[K.length-1];if(ae){var pe=ae.sn-F.startSN,Ce=W&&ae.level===W.level,De=K[pe+1],xe=this.fragmentTracker.getState(ae);if(xe===M.FragmentState.BACKTRACKED){ae=null;for(var Oe=pe;K[Oe]&&this.fragmentTracker.getState(K[Oe])===M.FragmentState.BACKTRACKED;)W?ae=K[Oe--]:ae=K[--Oe];ae||(ae=De)}else W&&ae.sn===W.sn&&!$&&(Ce&&(ae.sn<I&&this.fragmentTracker.getState(De)!==M.FragmentState.OK?(this.log("SN "+ae.sn+" just loaded, load next one: "+De.sn),ae=De):ae=null))}return ae},l.synchronizeToLiveEdge=function(g){var b=this.config,F=this.media;if(!F)return;var N=this.hls.liveSyncPosition,W=F.currentTime,K=g.fragments[0].start,I=g.edge,x=W>=K-b.maxFragLookUpTolerance&&W<=I;if(N!==null&&F.duration>N&&(W<N||!x)){var j=b.liveMaxLatencyDuration!==void 0?b.liveMaxLatencyDuration:b.liveMaxLatencyDurationCount*g.targetduration;(!x&&F.readyState<4||W<I-j)&&(this.loadedmetadata||(this.nextLoadPosition=N),F.readyState&&(this.warn("Playback: "+W.toFixed(3)+" is located too far from the end of live sliding playlist: "+I+", reset currentTime to : "+N.toFixed(3)),F.currentTime=N))}},l.alignPlaylists=function(g,b){var F=this.levels,N=this.levelLastLoaded,W=this.fragPrevious,K=N!==null?F[N]:null,I=g.fragments.length;if(!I)return this.warn("No fragments in live playlist"),0;var x=g.fragments[0].start,j=!b,$=g.alignedSliding&&Object(ee.isFiniteNumber)(x);if(j||!$&&!x){Object(p.alignStream)(W,K,g);var ae=g.fragments[0].start;return this.log("Live playlist sliding: "+ae.toFixed(2)+" start-sn: "+(b?b.startSN:"na")+"->"+g.startSN+" prev-sn: "+(W?W.sn:"na")+" fragments: "+I),ae}return x},l.waitForCdnTuneIn=function(g){var b=3;return g.live&&g.canBlockReload&&g.tuneInGoal>Math.max(g.partHoldBack,g.partTarget*b)},l.setStartPosition=function(g,b){var F=this.startPosition;if(F<b&&(F=-1),F===-1||this.lastCurrentTime===-1){var N=g.startTimeOffset;Object(ee.isFiniteNumber)(N)?(F=b+N,N<0&&(F+=g.totalduration),F=Math.min(Math.max(b,F),b+g.totalduration),this.log("Start time offset "+N+" found in playlist, adjust startPosition to "+F),this.startPosition=F):g.live?F=this.hls.liveSyncPosition||b:this.startPosition=F=0,this.lastCurrentTime=F}this.nextLoadPosition=F},l.getLoadPosition=function(){var g=this.media,b=0;return this.loadedmetadata&&g?b=g.currentTime:this.nextLoadPosition&&(b=this.nextLoadPosition),b},l.handleFragLoadAborted=function(g,b){this.transmuxer&&g.sn!=="initSegment"&&g.stats.aborted&&(this.warn("Fragment "+g.sn+(b?" part"+b.index:"")+" of level "+g.level+" was aborted"),this.resetFragmentLoading(g))},l.resetFragmentLoading=function(g){(!this.fragCurrent||!this.fragContextChanged(g))&&(this.state=O.IDLE)},l.onFragmentOrKeyLoadError=function(g,b){if(b.fatal)return;var F=b.frag;if(!F||F.type!==g)return;var N=this.fragCurrent;console.assert(N&&F.sn===N.sn&&F.level===N.level&&F.urlId===N.urlId,"Frag load error must match current frag to retry");var W=this.config;if(this.fragLoadError+1<=W.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(F.level))return;var K=Math.min(Math.pow(2,this.fragLoadError)*W.fragLoadingRetryDelay,W.fragLoadingMaxRetryTimeout);this.warn("Fragment "+F.sn+" of "+g+" "+F.level+" failed to load, retrying in "+K+"ms"),this.retryDate=self.performance.now()+K,this.fragLoadError++,this.state=O.FRAG_LOADING_WAITING_RETRY}else b.levelRetry?(g===c.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=O.IDLE):(X.logger.error(b.details+" reaches max retry, redispatch as fatal ..."),b.fatal=!0,this.hls.stopLoad(),this.state=O.ERROR)},l.afterBufferFlushed=function(g,b,F){if(!g)return;var N=Y.BufferHelper.getBuffered(g);this.fragmentTracker.detectEvictedFragments(b,N,F),this.state===O.ENDED&&this.resetLoadingState()},l.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=O.IDLE},l.resetLiveStartWhenNotLoaded=function(g){if(!this.loadedmetadata){this.startFragRequested=!1;var b=this.levels?this.levels[g].details:null;if(b!=null&&b.live)return this.startPosition=-1,this.setStartPosition(b,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},l.updateLevelTiming=function(g,b,F,N){var W=this,K=F.details;console.assert(!!K,"level.details must be defined");var I=Object.keys(g.elementaryStreams).reduce(function(x,j){var $=g.elementaryStreams[j];if($){var ae=$.endPTS-$.startPTS;if(ae<=0)return W.warn("Could not parse fragment "+g.sn+" "+j+" duration reliably ("+ae+") resetting transmuxer to fallback to playlist timing"),W.resetTransmuxer(),x||!1;var fe=N?0:Object(u.updateFragPTSDTS)(K,g,$.startPTS,$.endPTS,$.startDTS,$.endDTS);return W.hls.trigger(k.Events.LEVEL_PTS_UPDATED,{details:K,level:F,drift:fe,type:j,frag:g,start:$.startPTS,end:$.endPTS}),!0}return x},!1);I?(this.state=O.PARSED,this.hls.trigger(k.Events.FRAG_PARSED,{frag:g,part:b})):this.resetLoadingState()},l.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},A(d,[{key:"state",get:function(){return this._state},set:function(g){var b=this._state;b!==g&&(this._state=g,this.log(b+"->"+g))}}]),d}(H.default)},"./src/controller/buffer-controller.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"default",function(){return o});var ee=U("./src/polyfills/number.ts"),H=U("./src/events.ts"),M=U("./src/utils/logger.ts"),Y=U("./src/errors.ts"),X=U("./src/utils/buffer-helper.ts"),k=U("./src/utils/mediasource-helper.ts"),D=U("./src/loader/fragment.ts"),v=U("./src/controller/buffer-operation-queue.ts"),_=Object(k.getMediaSource)(),p=/([ha]vc.)(?:\.[^.,]+)+/,o=function(){function u(i){var t=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var c=t.hls,f=t.media,A=t.mediaSource;M.logger.log("[buffer-controller]: Media source opened"),f&&(t.updateMediaElementDuration(),c.trigger(H.Events.MEDIA_ATTACHED,{media:f})),A&&A.removeEventListener("sourceopen",t._onMediaSourceOpen),t.checkPendingTracks()},this._onMediaSourceClose=function(){M.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){M.logger.log("[buffer-controller]: Media source ended")},this.hls=i,this._initSourceBuffer(),this.registerListeners()}var r=u.prototype;return r.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},r.destroy=function(){this.unregisterListeners(),this.details=null},r.registerListeners=function(){var t=this.hls;t.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.on(H.Events.BUFFER_RESET,this.onBufferReset,this),t.on(H.Events.BUFFER_APPENDING,this.onBufferAppending,this),t.on(H.Events.BUFFER_CODECS,this.onBufferCodecs,this),t.on(H.Events.BUFFER_EOS,this.onBufferEos,this),t.on(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(H.Events.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(H.Events.FRAG_PARSED,this.onFragParsed,this),t.on(H.Events.FRAG_CHANGED,this.onFragChanged,this)},r.unregisterListeners=function(){var t=this.hls;t.off(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.off(H.Events.BUFFER_RESET,this.onBufferReset,this),t.off(H.Events.BUFFER_APPENDING,this.onBufferAppending,this),t.off(H.Events.BUFFER_CODECS,this.onBufferCodecs,this),t.off(H.Events.BUFFER_EOS,this.onBufferEos,this),t.off(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(H.Events.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(H.Events.FRAG_PARSED,this.onFragParsed,this),t.off(H.Events.FRAG_CHANGED,this.onFragChanged,this)},r._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new v.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},r.onManifestParsed=function(t,c){var f=2;(c.audio&&!c.video||!c.altAudio)&&(f=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=f,this.details=null,M.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},r.onMediaAttaching=function(t,c){var f=this.media=c.media;if(f&&_){var A=this.mediaSource=new _;A.addEventListener("sourceopen",this._onMediaSourceOpen),A.addEventListener("sourceended",this._onMediaSourceEnded),A.addEventListener("sourceclose",this._onMediaSourceClose),f.src=self.URL.createObjectURL(A),this._objectUrl=f.src}},r.onMediaDetaching=function(){var t=this.media,c=this.mediaSource,f=this._objectUrl;if(c){if(M.logger.log("[buffer-controller]: media source detaching"),c.readyState==="open")try{c.endOfStream()}catch(A){M.logger.warn("[buffer-controller]: onMediaDetaching: "+A.message+" while calling endOfStream")}this.onBufferReset(),c.removeEventListener("sourceopen",this._onMediaSourceOpen),c.removeEventListener("sourceended",this._onMediaSourceEnded),c.removeEventListener("sourceclose",this._onMediaSourceClose),t&&(f&&self.URL.revokeObjectURL(f),t.src===f?(t.removeAttribute("src"),t.load()):M.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(H.Events.MEDIA_DETACHED,void 0)},r.onBufferReset=function(){var t=this;this.getSourceBufferTypes().forEach(function(c){var f=t.sourceBuffer[c];try{f&&(t.removeBufferListeners(c),t.mediaSource&&t.mediaSource.removeSourceBuffer(f),t.sourceBuffer[c]=void 0)}catch(A){M.logger.warn("[buffer-controller]: Failed to reset the "+c+" buffer",A)}}),this._initSourceBuffer()},r.onBufferCodecs=function(t,c){var f=this,A=this.getSourceBufferTypes().length;if(Object.keys(c).forEach(function(S){if(A){var w=f.tracks[S];if(w&&typeof w.buffer.changeType=="function"){var R=c[S],O=R.codec,E=R.levelCodec,y=R.container,d=(w.levelCodec||w.codec).replace(p,"$1"),l=(E||O).replace(p,"$1");if(d!==l){var h=y+";codecs="+(E||O);f.appendChangeType(S,h)}}}else f.pendingTracks[S]=c[S]}),A)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},r.appendChangeType=function(t,c){var f=this,A=this.operationQueue,S={execute:function(){var R=f.sourceBuffer[t];R&&(M.logger.log("[buffer-controller]: changing "+t+" sourceBuffer type to "+c),R.changeType(c)),A.shiftAndExecuteNext(t)},onStart:function(){},onComplete:function(){},onError:function(R){M.logger.warn("[buffer-controller]: Failed to change "+t+" SourceBuffer type",R)}};A.append(S,t)},r.onBufferAppending=function(t,c){var f=this,A=this.hls,S=this.operationQueue,w=this.tracks,R=c.data,O=c.type,E=c.frag,y=c.part,d=c.chunkMeta,l=d.buffering[O],h=self.performance.now();l.start=h;var g=E.stats.buffering,b=y?y.stats.buffering:null;g.start===0&&(g.start=h),b&&b.start===0&&(b.start=h);var F=w.audio,N=O==="audio"&&d.id===1&&(F==null?void 0:F.container)==="audio/mpeg",W={execute:function(){if(l.executeStart=self.performance.now(),N){var I=f.sourceBuffer[O];if(I){var x=E.start-I.timestampOffset;Math.abs(x)>=.1&&(M.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+E.start+" (delta: "+x+") sn: "+E.sn+")"),I.timestampOffset=E.start)}}f.appendExecutor(R,O)},onStart:function(){},onComplete:function(){var I=self.performance.now();l.executeEnd=l.end=I,g.first===0&&(g.first=I),b&&b.first===0&&(b.first=I);var x=f.sourceBuffer,j={};for(var $ in x)j[$]=X.BufferHelper.getBuffered(x[$]);f.appendError=0,f.hls.trigger(H.Events.BUFFER_APPENDED,{type:O,frag:E,part:y,chunkMeta:d,parent:E.type,timeRanges:j})},onError:function(I){M.logger.error("[buffer-controller]: Error encountered while trying to append to the "+O+" SourceBuffer",I);var x={type:Y.ErrorTypes.MEDIA_ERROR,parent:E.type,details:Y.ErrorDetails.BUFFER_APPEND_ERROR,err:I,fatal:!1};I.code===DOMException.QUOTA_EXCEEDED_ERR?x.details=Y.ErrorDetails.BUFFER_FULL_ERROR:(f.appendError++,x.details=Y.ErrorDetails.BUFFER_APPEND_ERROR,f.appendError>A.config.appendErrorMaxRetry&&(M.logger.error("[buffer-controller]: Failed "+A.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),x.fatal=!0)),A.trigger(H.Events.ERROR,x)}};S.append(W,O)},r.onBufferFlushing=function(t,c){var f=this,A=this.operationQueue,S=function(R){return{execute:f.removeExecutor.bind(f,R,c.startOffset,c.endOffset),onStart:function(){},onComplete:function(){f.hls.trigger(H.Events.BUFFER_FLUSHED,{type:R})},onError:function(E){M.logger.warn("[buffer-controller]: Failed to remove from "+R+" SourceBuffer",E)}}};c.type?A.append(S(c.type),c.type):this.getSourceBufferTypes().forEach(function(w){A.append(S(w),w)})},r.onFragParsed=function(t,c){var f=this,A=c.frag,S=c.part,w=[],R=S?S.elementaryStreams:A.elementaryStreams;R[D.ElementaryStreamTypes.AUDIOVIDEO]?w.push("audiovideo"):(R[D.ElementaryStreamTypes.AUDIO]&&w.push("audio"),R[D.ElementaryStreamTypes.VIDEO]&&w.push("video"));var O=function(){var y=self.performance.now();A.stats.buffering.end=y,S&&(S.stats.buffering.end=y);var d=S?S.stats:A.stats;f.hls.trigger(H.Events.FRAG_BUFFERED,{frag:A,part:S,stats:d,id:A.type})};w.length===0&&M.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+A.type+" level: "+A.level+" sn: "+A.sn),this.blockBuffers(O,w)},r.onFragChanged=function(t,c){this.flushBackBuffer()},r.onBufferEos=function(t,c){var f=this,A=this.getSourceBufferTypes().reduce(function(S,w){var R=f.sourceBuffer[w];return(!c.type||c.type===w)&&(R&&!R.ended&&(R.ended=!0,M.logger.log("[buffer-controller]: "+w+" sourceBuffer now EOS"))),S&&!!(!R||R.ended)},!0);A&&this.blockBuffers(function(){var S=f.mediaSource;if(!S||S.readyState!=="open")return;S.endOfStream()})},r.onLevelUpdated=function(t,c){var f=c.details;if(!f.fragments.length)return;this.details=f,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},r.flushBackBuffer=function(){var t=this.hls,c=this.details,f=this.media,A=this.sourceBuffer;if(!f||c===null)return;var S=this.getSourceBufferTypes();if(!S.length)return;var w=c.live&&t.config.liveBackBufferLength!==null?t.config.liveBackBufferLength:t.config.backBufferLength;if(!Object(ee.isFiniteNumber)(w)||w<0)return;var R=f.currentTime,O=c.levelTargetDuration,E=Math.max(w,O),y=Math.floor(R/O)*O-E;S.forEach(function(d){var l=A[d];if(l){var h=X.BufferHelper.getBuffered(l);h.length>0&&y>h.start(0)&&(t.trigger(H.Events.BACK_BUFFER_REACHED,{bufferEnd:y}),c.live&&t.trigger(H.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:y}),t.trigger(H.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:y,type:d}))}})},r.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var t=this.details,c=this.hls,f=this.media,A=this.mediaSource,S=t.fragments[0].start+t.totalduration,w=f.duration,R=Object(ee.isFiniteNumber)(A.duration)?A.duration:0;t.live&&c.config.liveDurationInfinity?(M.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),A.duration=Infinity,this.updateSeekableRange(t)):(S>R&&S>w||!Object(ee.isFiniteNumber)(w))&&(M.logger.log("[buffer-controller]: Updating Media Source duration to "+S.toFixed(3)),A.duration=S)},r.updateSeekableRange=function(t){var c=this.mediaSource,f=t.fragments,A=f.length;if(A&&t.live&&c!==null&&c!==void 0&&c.setLiveSeekableRange){var S=Math.max(0,f[0].start),w=Math.max(S,S+t.totalduration);c.setLiveSeekableRange(S,w)}},r.checkPendingTracks=function(){var t=this.bufferCodecEventsExpected,c=this.operationQueue,f=this.pendingTracks,A=Object.keys(f).length;if(A&&!t||A===2){this.createSourceBuffers(f),this.pendingTracks={};var S=this.getSourceBufferTypes();if(S.length===0){this.hls.trigger(H.Events.ERROR,{type:Y.ErrorTypes.MEDIA_ERROR,details:Y.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}S.forEach(function(w){c.executeNext(w)})}},r.createSourceBuffers=function(t){var c=this.sourceBuffer,f=this.mediaSource;if(!f)throw Error("createSourceBuffers called when mediaSource was null");var A=0;for(var S in t)if(!c[S]){var w=t[S];if(!w)throw Error("source buffer exists for track "+S+", however track does not");var R=w.levelCodec||w.codec,O=w.container+";codecs="+R;M.logger.log("[buffer-controller]: creating sourceBuffer("+O+")");try{var E=c[S]=f.addSourceBuffer(O),y=S;this.addBufferListener(y,"updatestart",this._onSBUpdateStart),this.addBufferListener(y,"updateend",this._onSBUpdateEnd),this.addBufferListener(y,"error",this._onSBUpdateError),this.tracks[S]={buffer:E,codec:R,container:w.container,levelCodec:w.levelCodec,id:w.id},A++}catch(d){M.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+d.message),this.hls.trigger(H.Events.ERROR,{type:Y.ErrorTypes.MEDIA_ERROR,details:Y.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:d,mimeType:O})}}A&&this.hls.trigger(H.Events.BUFFER_CREATED,{tracks:this.tracks})},r._onSBUpdateStart=function(t){var c=this.operationQueue,f=c.current(t);f.onStart()},r._onSBUpdateEnd=function(t){var c=this.operationQueue,f=c.current(t);f.onComplete(),c.shiftAndExecuteNext(t)},r._onSBUpdateError=function(t,c){M.logger.error("[buffer-controller]: "+t+" SourceBuffer error",c),this.hls.trigger(H.Events.ERROR,{type:Y.ErrorTypes.MEDIA_ERROR,details:Y.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var f=this.operationQueue.current(t);f&&f.onError(c)},r.removeExecutor=function(t,c,f){var A=this.media,S=this.mediaSource,w=this.operationQueue,R=this.sourceBuffer,O=R[t];if(!A||!S||!O){M.logger.warn("[buffer-controller]: Attempting to remove from the "+t+" SourceBuffer, but it does not exist"),w.shiftAndExecuteNext(t);return}var E=Object(ee.isFiniteNumber)(A.duration)?A.duration:Infinity,y=Object(ee.isFiniteNumber)(S.duration)?S.duration:Infinity,d=Math.max(0,c),l=Math.min(f,E,y);l>d?(M.logger.log("[buffer-controller]: Removing ["+d+","+l+"] from the "+t+" SourceBuffer"),console.assert(!O.updating,t+" sourceBuffer must not be updating"),O.remove(d,l)):w.shiftAndExecuteNext(t)},r.appendExecutor=function(t,c){var f=this.operationQueue,A=this.sourceBuffer,S=A[c];if(!S){M.logger.warn("[buffer-controller]: Attempting to append to the "+c+" SourceBuffer, but it does not exist"),f.shiftAndExecuteNext(c);return}S.ended=!1,console.assert(!S.updating,c+" sourceBuffer must not be updating"),S.appendBuffer(t)},r.blockBuffers=function(t,c){var f=this;if(c===void 0&&(c=this.getSourceBufferTypes()),!c.length){M.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(t);return}var A=this.operationQueue,S=c.map(function(w){return A.appendBlocker(w)});Promise.all(S).then(function(){t(),c.forEach(function(w){var R=f.sourceBuffer[w];(!R||!R.updating)&&A.shiftAndExecuteNext(w)})})},r.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},r.addBufferListener=function(t,c,f){var A=this.sourceBuffer[t];if(!A)return;var S=f.bind(this,t);this.listeners[t].push({event:c,listener:S}),A.addEventListener(c,S)},r.removeBufferListeners=function(t){var c=this.sourceBuffer[t];if(!c)return;this.listeners[t].forEach(function(f){c.removeEventListener(f.event,f.listener)})},u}()},"./src/controller/buffer-operation-queue.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"default",function(){return H});var ee=U("./src/utils/logger.ts"),H=function(){function M(X){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=X}var Y=M.prototype;return Y.append=function(k,D){var v=this.queues[D];v.push(k),v.length===1&&this.buffers[D]&&this.executeNext(D)},Y.insertAbort=function(k,D){var v=this.queues[D];v.unshift(k),this.executeNext(D)},Y.appendBlocker=function(k){var D,v=new Promise(function(p){D=p}),_={execute:D,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(_,k),v},Y.executeNext=function(k){var D=this.buffers,v=this.queues,_=D[k],p=v[k];if(p.length){var o=p[0];try{o.execute()}catch(u){ee.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),o.onError(u),(!_||!_.updating)&&(p.shift(),this.executeNext(k))}}},Y.shiftAndExecuteNext=function(k){this.queues[k].shift(),this.executeNext(k)},Y.current=function(k){return this.queues[k][0]},M}()},"./src/controller/cap-level-controller.ts":function(ie,Z,U){"use strict";U.r(Z);var ee=U("./src/events.ts");function H(X,k){for(var D=0;D<k.length;D++){var v=k[D];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(X,v.key,v)}}function M(X,k,D){return k&&H(X.prototype,k),D&&H(X,D),X}var Y=function(){function X(D){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=D,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var k=X.prototype;return k.setStreamController=function(v){this.streamController=v},k.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},k.registerListeners=function(){var v=this.hls;v.on(ee.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),v.on(ee.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),v.on(ee.Events.MANIFEST_PARSED,this.onManifestParsed,this),v.on(ee.Events.BUFFER_CODECS,this.onBufferCodecs,this),v.on(ee.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},k.unregisterListener=function(){var v=this.hls;v.off(ee.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),v.off(ee.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),v.off(ee.Events.MANIFEST_PARSED,this.onManifestParsed,this),v.off(ee.Events.BUFFER_CODECS,this.onBufferCodecs,this),v.off(ee.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},k.onFpsDropLevelCapping=function(v,_){X.isLevelAllowed(_.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(_.droppedLevel)},k.onMediaAttaching=function(v,_){this.media=_.media instanceof HTMLVideoElement?_.media:null},k.onManifestParsed=function(v,_){var p=this.hls;this.restrictedLevels=[],this.firstLevel=_.firstLevel,p.config.capLevelToPlayerSize&&_.video&&this.startCapping()},k.onBufferCodecs=function(v,_){var p=this.hls;p.config.capLevelToPlayerSize&&_.video&&this.startCapping()},k.onMediaDetaching=function(){this.stopCapping()},k.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var v=this.hls.levels;if(v.length){var _=this.hls;_.autoLevelCapping=this.getMaxLevel(v.length-1),_.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=_.autoLevelCapping}}},k.getMaxLevel=function(v){var _=this,p=this.hls.levels;if(!p.length)return-1;var o=p.filter(function(u,r){return X.isLevelAllowed(r,_.restrictedLevels)&&r<=v});return this.clientRect=null,X.getMaxLevelByMediaSize(o,this.mediaWidth,this.mediaHeight)},k.startCapping=function(){if(this.timer)return;this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize()},k.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},k.getDimensions=function(){if(this.clientRect)return this.clientRect;var v=this.media,_={width:0,height:0};if(v){var p=v.getBoundingClientRect();_.width=p.width,_.height=p.height,!_.width&&!_.height&&(_.width=p.right-p.left||v.width||0,_.height=p.bottom-p.top||v.height||0)}return this.clientRect=_,_},X.isLevelAllowed=function(v,_){return _===void 0&&(_=[]),_.indexOf(v)===-1},X.getMaxLevelByMediaSize=function(v,_,p){if(!v||!v.length)return-1;for(var o=function(c,f){return f?c.width!==f.width||c.height!==f.height:!0},u=v.length-1,r=0;r<v.length;r+=1){var i=v[r];if((i.width>=_||i.height>=p)&&o(i,v[r+1])){u=r;break}}return u},M(X,[{key:"mediaWidth",get:function(){return this.getDimensions().width*X.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*X.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var v=1;try{v=self.devicePixelRatio}catch(_){}return v}}]),X}();Z.default=Y},"./src/controller/cmcd-controller.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"default",function(){return o});var ee=U("./src/events.ts"),H=U("./src/types/cmcd.ts"),M=U("./src/utils/buffer-helper.ts"),Y=U("./src/utils/logger.ts");function X(u,r){for(var i=0;i<r.length;i++){var t=r[i];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(u,t.key,t)}}function k(u,r,i){return r&&X(u.prototype,r),i&&X(u,i),u}function D(u,r){var i=typeof Symbol!="undefined"&&u[Symbol.iterator]||u["@@iterator"];if(i)return(i=i.call(u)).next.bind(i);if(Array.isArray(u)||(i=v(u))||r&&u&&typeof u.length=="number"){i&&(u=i);var t=0;return function(){return t>=u.length?{done:!0}:{done:!1,value:u[t++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function v(u,r){if(!u)return;if(typeof u=="string")return _(u,r);var i=Object.prototype.toString.call(u).slice(8,-1);if(i==="Object"&&u.constructor&&(i=u.constructor.name),i==="Map"||i==="Set")return Array.from(u);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return _(u,r)}function _(u,r){(r==null||r>u.length)&&(r=u.length);for(var i=0,t=new Array(r);i<r;i++)t[i]=u[i];return t}function p(){return p=Object.assign||function(u){for(var r=1;r<arguments.length;r++){var i=arguments[r];for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&(u[t]=i[t])}return u},p.apply(this,arguments)}var o=function(){function u(i){var t=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){t.initialized&&(t.starved=!0),t.buffering=!0},this.onPlaying=function(){t.initialized||(t.initialized=!0),t.buffering=!1},this.applyPlaylistData=function(A){try{t.apply(A,{ot:H.CMCDObjectType.MANIFEST,su:!t.initialized})}catch(S){Y.logger.warn("Could not generate manifest CMCD data.",S)}},this.applyFragmentData=function(A){try{var S=A.frag,w=t.hls.levels[S.level],R=t.getObjectType(S),O={d:S.duration*1e3,ot:R};(R===H.CMCDObjectType.VIDEO||R===H.CMCDObjectType.AUDIO||R==H.CMCDObjectType.MUXED)&&(O.br=w.bitrate/1e3,O.tb=t.getTopBandwidth(R),O.bl=t.getBufferLength(R)),t.apply(A,O)}catch(E){Y.logger.warn("Could not generate segment CMCD data.",E)}},this.hls=i;var c=this.config=i.config,f=c.cmcd;f!=null&&(c.pLoader=this.createPlaylistLoader(),c.fLoader=this.createFragmentLoader(),this.sid=f.sessionId||u.uuid(),this.cid=f.contentId,this.useHeaders=f.useHeaders===!0,this.registerListeners())}var r=u.prototype;return r.registerListeners=function(){var t=this.hls;t.on(ee.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(ee.Events.MEDIA_DETACHED,this.onMediaDetached,this),t.on(ee.Events.BUFFER_CREATED,this.onBufferCreated,this)},r.unregisterListeners=function(){var t=this.hls;t.off(ee.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(ee.Events.MEDIA_DETACHED,this.onMediaDetached,this),t.off(ee.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},r.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},r.onMediaAttached=function(t,c){this.media=c.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},r.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},r.onBufferCreated=function(t,c){var f,A;this.audioBuffer=(f=c.tracks.audio)===null||f===void 0?void 0:f.buffer,this.videoBuffer=(A=c.tracks.video)===null||A===void 0?void 0:A.buffer},r.createData=function(){var t;return{v:H.CMCDVersion,sf:H.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(t=this.media)===null||t===void 0?void 0:t.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},r.apply=function(t,c){c===void 0&&(c={}),p(c,this.createData());var f=c.ot===H.CMCDObjectType.INIT||c.ot===H.CMCDObjectType.VIDEO||c.ot===H.CMCDObjectType.MUXED;if(this.starved&&f&&(c.bs=!0,c.su=!0,this.starved=!1),c.su==null&&(c.su=this.buffering),this.useHeaders){var A=u.toHeaders(c);if(!Object.keys(A).length)return;t.headers||(t.headers={}),p(t.headers,A)}else{var S=u.toQuery(c);if(!S)return;t.url=u.appendQueryToUri(t.url,S)}},r.getObjectType=function(t){var c=t.type;return c==="subtitle"?H.CMCDObjectType.TIMED_TEXT:t.sn==="initSegment"?H.CMCDObjectType.INIT:c==="audio"?H.CMCDObjectType.AUDIO:c==="main"?this.hls.audioTracks.length?H.CMCDObjectType.VIDEO:H.CMCDObjectType.MUXED:void 0},r.getTopBandwidth=function(t){for(var c=0,f=t===H.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,A=D(f),S;!(S=A()).done;){var w=S.value;w.bitrate>c&&(c=w.bitrate)}return c>0?c:NaN},r.getBufferLength=function(t){var c=this.hls.media,f=t===H.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!f||!c)return NaN;var A=M.BufferHelper.bufferInfo(f,c.currentTime,this.config.maxBufferHole);return A.len*1e3},r.createPlaylistLoader=function(){var t=this.config.pLoader,c=this.applyPlaylistData,f=t||this.config.loader;return function(){function A(w){this.loader=void 0,this.loader=new f(w)}var S=A.prototype;return S.destroy=function(){this.loader.destroy()},S.abort=function(){this.loader.abort()},S.load=function(R,O,E){c(R),this.loader.load(R,O,E)},k(A,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),A}()},r.createFragmentLoader=function(){var t=this.config.fLoader,c=this.applyFragmentData,f=t||this.config.loader;return function(){function A(w){this.loader=void 0,this.loader=new f(w)}var S=A.prototype;return S.destroy=function(){this.loader.destroy()},S.abort=function(){this.loader.abort()},S.load=function(R,O,E){c(R),this.loader.load(R,O,E)},k(A,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),A}()},u.uuid=function(){var t=URL.createObjectURL(new Blob),c=t.toString();return URL.revokeObjectURL(t),c.substr(c.lastIndexOf("/")+1)},u.serialize=function(t){for(var c=[],f=function(N){return!Number.isNaN(N)&&N!=null&&N!==""&&N!==!1},A=function(N){return Math.round(N)},S=function(N){return A(N/100)*100},w=function(N){return encodeURIComponent(N)},R={br:A,d:A,bl:S,dl:S,mtp:S,nor:w,rtp:S,tb:A},O=Object.keys(t||{}).sort(),E=D(O),y;!(y=E()).done;){var d=y.value,l=t[d];if(!f(l))continue;if(d==="v"&&l===1)continue;if(d=="pr"&&l===1)continue;var h=R[d];h&&(l=h(l));var g=typeof l,b=void 0;d==="ot"||d==="sf"||d==="st"?b=d+"="+l:g==="boolean"?b=d:g==="number"?b=d+"="+l:b=d+"="+JSON.stringify(l),c.push(b)}return c.join(",")},u.toHeaders=function(t){for(var c=Object.keys(t),f={},A=["Object","Request","Session","Status"],S=[{},{},{},{}],w={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},R=0,O=c;R<O.length;R++){var E=O[R],y=w[E]!=null?w[E]:1;S[y][E]=t[E]}for(var d=0;d<S.length;d++){var l=u.serialize(S[d]);l&&(f["CMCD-"+A[d]]=l)}return f},u.toQuery=function(t){return"CMCD="+encodeURIComponent(u.serialize(t))},u.appendQueryToUri=function(t,c){if(!c)return t;var f=t.includes("?")?"&":"?";return""+t+f+c},u}()},"./src/controller/eme-controller.ts":function(ie,Z,U){"use strict";U.r(Z);var ee=U("./src/events.ts"),H=U("./src/errors.ts"),M=U("./src/utils/logger.ts"),Y=U("./src/utils/mediakeys-helper.ts");function X(o,u){for(var r=0;r<u.length;r++){var i=u[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(o,i.key,i)}}function k(o,u,r){return u&&X(o.prototype,u),r&&X(o,r),o}var D=3,v=function(u,r,i){var t={audioCapabilities:[],videoCapabilities:[]};return u.forEach(function(c){t.audioCapabilities.push({contentType:'audio/mp4; codecs="'+c+'"',robustness:i.audioRobustness||""})}),r.forEach(function(c){t.videoCapabilities.push({contentType:'video/mp4; codecs="'+c+'"',robustness:i.videoRobustness||""})}),[t]},_=function(u,r,i,t){switch(u){case Y.KeySystems.WIDEVINE:return v(r,i,t);default:throw new Error("Unknown key-system: "+u)}},p=function(){function o(r){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=r,this._config=r.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var u=o.prototype;return u.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},u._registerListeners=function(){this.hls.on(ee.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(ee.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(ee.Events.MANIFEST_PARSED,this.onManifestParsed,this)},u._unregisterListeners=function(){this.hls.off(ee.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(ee.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(ee.Events.MANIFEST_PARSED,this.onManifestParsed,this)},u.getLicenseServerUrl=function(i){switch(i){case Y.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+i+'"')},u._attemptKeySystemAccess=function(i,t,c){var f=this,A=_(i,t,c,this._drmSystemOptions);M.logger.log("Requesting encrypted media key-system access");var S=this.requestMediaKeySystemAccess(i,A);this.mediaKeysPromise=S.then(function(w){return f._onMediaKeySystemAccessObtained(i,w)}),S.catch(function(w){M.logger.error('Failed to obtain key-system "'+i+'" access:',w)})},u._onMediaKeySystemAccessObtained=function(i,t){var c=this;M.logger.log('Access for key-system "'+i+'" obtained');var f={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:t,mediaKeySystemDomain:i};this._mediaKeysList.push(f);var A=Promise.resolve().then(function(){return t.createMediaKeys()}).then(function(S){return f.mediaKeys=S,M.logger.log('Media-keys created for key-system "'+i+'"'),c._onMediaKeysCreated(),S});return A.catch(function(S){M.logger.error("Failed to create media-keys:",S)}),A},u._onMediaKeysCreated=function(){var i=this;this._mediaKeysList.forEach(function(t){t.mediaKeysSession||(t.mediaKeysSession=t.mediaKeys.createSession(),i._onNewMediaKeySession(t.mediaKeysSession))})},u._onNewMediaKeySession=function(i){var t=this;M.logger.log("New key-system session "+i.sessionId),i.addEventListener("message",function(c){t._onKeySessionMessage(i,c.message)},!1)},u._onKeySessionMessage=function(i,t){M.logger.log("Got EME message event, creating license request"),this._requestLicense(t,function(c){M.logger.log("Received license data (length: "+(c&&c.byteLength)+"), updating key-session"),i.update(c)})},u.onMediaEncrypted=function(i){var t=this;if(M.logger.log('Media is encrypted using "'+i.initDataType+'" init data type'),!this.mediaKeysPromise){M.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(ee.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var c=function(A){if(!t._media)return;t._attemptSetMediaKeys(A),t._generateRequestWithPreferredKeySession(i.initDataType,i.initData)};this.mediaKeysPromise.then(c).catch(c)},u._attemptSetMediaKeys=function(i){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var t=this._mediaKeysList[0];if(!t||!t.mediaKeys){M.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(ee.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}M.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(t.mediaKeys),this._hasSetMediaKeys=!0}},u._generateRequestWithPreferredKeySession=function(i,t){var c=this,f=this._mediaKeysList[0];if(!f){M.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(ee.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(f.mediaKeysSessionInitialized){M.logger.warn("Key-Session already initialized but requested again");return}var A=f.mediaKeysSession;if(!A){M.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(ee.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!t){M.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(ee.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}M.logger.log('Generating key-session request for "'+i+'" init data type'),f.mediaKeysSessionInitialized=!0,A.generateRequest(i,t).then(function(){M.logger.debug("Key-session generation succeeded")}).catch(function(S){M.logger.error("Error generating key-session request:",S),c.hls.trigger(ee.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},u._createLicenseXhr=function(i,t,c){var f=new XMLHttpRequest;f.responseType="arraybuffer",f.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,f,i,t,c);var A=this._licenseXhrSetup;if(A)try{A.call(this.hls,f,i),A=void 0}catch(S){M.logger.error(S)}try{f.readyState||f.open("POST",i,!0),A&&A.call(this.hls,f,i)}catch(S){throw new Error("issue setting up KeySystem license XHR "+S)}return f},u._onLicenseRequestReadyStageChange=function(i,t,c,f){switch(i.readyState){case 4:if(i.status===200){this._requestLicenseFailureCount=0,M.logger.log("License request succeeded");var A=i.response,S=this._licenseResponseCallback;if(S)try{A=S.call(this.hls,i,t)}catch(R){M.logger.error(R)}f(A)}else{if(M.logger.error("License Request XHR failed ("+t+"). Status: "+i.status+" ("+i.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>D){this.hls.trigger(ee.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var w=D-this._requestLicenseFailureCount+1;M.logger.warn("Retrying license request, "+w+" attempts left"),this._requestLicense(c,f)}break}},u._generateLicenseRequestChallenge=function(i,t){switch(i.mediaKeySystemDomain){case Y.KeySystems.WIDEVINE:return t}throw new Error("unsupported key-system: "+i.mediaKeySystemDomain)},u._requestLicense=function(i,t){M.logger.log("Requesting content license for key-system");var c=this._mediaKeysList[0];if(!c){M.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(ee.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var f=this.getLicenseServerUrl(c.mediaKeySystemDomain),A=this._createLicenseXhr(f,i,t);M.logger.log("Sending license request to URL: "+f);var S=this._generateLicenseRequestChallenge(c,i);A.send(S)}catch(w){M.logger.error("Failure requesting DRM license: "+w),this.hls.trigger(ee.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},u.onMediaAttached=function(i,t){if(!this._emeEnabled)return;var c=t.media;this._media=c,c.addEventListener("encrypted",this._onMediaEncrypted)},u.onMediaDetached=function(){var i=this._media,t=this._mediaKeysList;if(!i)return;i.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(t.map(function(c){if(c.mediaKeysSession)return c.mediaKeysSession.close().catch(function(){})})).then(function(){return i.setMediaKeys(null)}).catch(function(){})},u.onManifestParsed=function(i,t){if(!this._emeEnabled)return;var c=t.levels.map(function(A){return A.audioCodec}).filter(function(A){return!!A}),f=t.levels.map(function(A){return A.videoCodec}).filter(function(A){return!!A});this._attemptKeySystemAccess(Y.KeySystems.WIDEVINE,c,f)},k(o,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),o}();Z.default=p},"./src/controller/fps-controller.ts":function(ie,Z,U){"use strict";U.r(Z);var ee=U("./src/events.ts"),H=U("./src/utils/logger.ts"),M=function(){function Y(k){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=k,this.registerListeners()}var X=Y.prototype;return X.setStreamController=function(D){this.streamController=D},X.registerListeners=function(){this.hls.on(ee.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},X.unregisterListeners=function(){this.hls.off(ee.Events.MEDIA_ATTACHING,this.onMediaAttaching)},X.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},X.onMediaAttaching=function(D,v){var _=this.hls.config;if(_.capLevelOnFPSDrop){var p=v.media instanceof self.HTMLVideoElement?v.media:null;this.media=p,p&&typeof p.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),_.fpsDroppedMonitoringPeriod)}},X.checkFPS=function(D,v,_){var p=performance.now();if(v){if(this.lastTime){var o=p-this.lastTime,u=_-this.lastDroppedFrames,r=v-this.lastDecodedFrames,i=1e3*u/o,t=this.hls;if(t.trigger(ee.Events.FPS_DROP,{currentDropped:u,currentDecoded:r,totalDroppedFrames:_}),i>0&&u>t.config.fpsDroppedMonitoringThreshold*r){var c=t.currentLevel;H.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+c),c>0&&(t.autoLevelCapping===-1||t.autoLevelCapping>=c)&&(c=c-1,t.trigger(ee.Events.FPS_DROP_LEVEL_CAPPING,{level:c,droppedLevel:t.currentLevel}),t.autoLevelCapping=c,this.streamController.nextLevelSwitch())}}this.lastTime=p,this.lastDroppedFrames=_,this.lastDecodedFrames=v}},X.checkFPSInterval=function(){var D=this.media;if(D)if(this.isVideoPlaybackQualityAvailable){var v=D.getVideoPlaybackQuality();this.checkFPS(D,v.totalVideoFrames,v.droppedVideoFrames)}else this.checkFPS(D,D.webkitDecodedFrameCount,D.webkitDroppedFrameCount)},Y}();Z.default=M},"./src/controller/fragment-finders.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"findFragmentByPDT",function(){return M}),U.d(Z,"findFragmentByPTS",function(){return Y}),U.d(Z,"fragmentWithinToleranceTest",function(){return X}),U.d(Z,"pdtWithinToleranceTest",function(){return k}),U.d(Z,"findFragWithCC",function(){return D});var ee=U("./src/polyfills/number.ts"),H=U("./src/utils/binary-search.ts");function M(v,_,p){if(_===null||!Array.isArray(v)||!v.length||!Object(ee.isFiniteNumber)(_))return null;var o=v[0].programDateTime;if(_<(o||0))return null;var u=v[v.length-1].endProgramDateTime;if(_>=(u||0))return null;p=p||0;for(var r=0;r<v.length;++r){var i=v[r];if(k(_,p,i))return i}return null}function Y(v,_,p,o){p===void 0&&(p=0),o===void 0&&(o=0);var u=null;if(v?u=_[v.sn-_[0].sn+1]||null:p===0&&_[0].start===0&&(u=_[0]),u&&X(p,o,u)===0)return u;var r=H.default.search(_,X.bind(null,p,o));return r||u}function X(v,_,p){v===void 0&&(v=0),_===void 0&&(_=0);var o=Math.min(_,p.duration+(p.deltaPTS?p.deltaPTS:0));return p.start+p.duration-o<=v?1:p.start-o>v&&p.start?-1:0}function k(v,_,p){var o=Math.min(_,p.duration+(p.deltaPTS?p.deltaPTS:0))*1e3,u=p.endProgramDateTime||0;return u-o>v}function D(v,_){return H.default.search(v,function(p){return p.cc<_?1:p.cc>_?-1:0})}},"./src/controller/fragment-tracker.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"FragmentState",function(){return M}),U.d(Z,"FragmentTracker",function(){return Y});var ee=U("./src/events.ts"),H=U("./src/types/loader.ts"),M;(function(D){D.NOT_LOADED="NOT_LOADED",D.BACKTRACKED="BACKTRACKED",D.APPENDING="APPENDING",D.PARTIAL="PARTIAL",D.OK="OK"})(M||(M={}));var Y=function(){function D(_){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=_,this._registerListeners()}var v=D.prototype;return v._registerListeners=function(){var p=this.hls;p.on(ee.Events.BUFFER_APPENDED,this.onBufferAppended,this),p.on(ee.Events.FRAG_BUFFERED,this.onFragBuffered,this),p.on(ee.Events.FRAG_LOADED,this.onFragLoaded,this)},v._unregisterListeners=function(){var p=this.hls;p.off(ee.Events.BUFFER_APPENDED,this.onBufferAppended,this),p.off(ee.Events.FRAG_BUFFERED,this.onFragBuffered,this),p.off(ee.Events.FRAG_LOADED,this.onFragLoaded,this)},v.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},v.getAppendedFrag=function(p,o){if(o===H.PlaylistLevelType.MAIN){var u=this.activeFragment,r=this.activeParts;if(!u)return null;if(r)for(var i=r.length;i--;){var t=r[i],c=t?t.end:u.appendedPTS;if(t.start<=p&&c!==void 0&&p<=c)return i>9&&(this.activeParts=r.slice(i-9)),t}else if(u.start<=p&&u.appendedPTS!==void 0&&p<=u.appendedPTS)return u}return this.getBufferedFrag(p,o)},v.getBufferedFrag=function(p,o){for(var u=this.fragments,r=Object.keys(u),i=r.length;i--;){var t=u[r[i]];if((t==null?void 0:t.body.type)===o&&t.buffered){var c=t.body;if(c.start<=p&&p<=c.end)return c}}return null},v.detectEvictedFragments=function(p,o,u){var r=this;Object.keys(this.fragments).forEach(function(i){var t=r.fragments[i];if(!t)return;if(!t.buffered){t.body.type===u&&r.removeFragment(t.body);return}var c=t.range[p];if(!c)return;c.time.some(function(f){var A=!r.isTimeBuffered(f.startPTS,f.endPTS,o);return A&&r.removeFragment(t.body),A})})},v.detectPartialFragments=function(p){var o=this,u=this.timeRanges,r=p.frag,i=p.part;if(!u||r.sn==="initSegment")return;var t=k(r),c=this.fragments[t];if(!c)return;Object.keys(u).forEach(function(f){var A=r.elementaryStreams[f];if(!A)return;var S=u[f],w=i!==null||A.partial===!0;c.range[f]=o.getBufferedTimes(r,i,w,S)}),c.backtrack=c.loaded=null,Object.keys(c.range).length?c.buffered=!0:this.removeFragment(c.body)},v.fragBuffered=function(p){var o=k(p),u=this.fragments[o];u&&(u.backtrack=u.loaded=null,u.buffered=!0)},v.getBufferedTimes=function(p,o,u,r){for(var i={time:[],partial:u},t=o?o.start:p.start,c=o?o.end:p.end,f=p.minEndPTS||c,A=p.maxStartPTS||t,S=0;S<r.length;S++){var w=r.start(S)-this.bufferPadding,R=r.end(S)+this.bufferPadding;if(A>=w&&f<=R){i.time.push({startPTS:Math.max(t,r.start(S)),endPTS:Math.min(c,r.end(S))});break}else if(t<R&&c>w)i.partial=!0,i.time.push({startPTS:Math.max(t,r.start(S)),endPTS:Math.min(c,r.end(S))});else if(c<=w)break}return i},v.getPartialFragment=function(p){var o=null,u,r,i,t=0,c=this.bufferPadding,f=this.fragments;return Object.keys(f).forEach(function(A){var S=f[A];if(!S)return;X(S)&&(r=S.body.start-c,i=S.body.end+c,p>=r&&p<=i&&(u=Math.min(p-r,i-p),t<=u&&(o=S.body,t=u)))}),o},v.getState=function(p){var o=k(p),u=this.fragments[o];return u?u.buffered?X(u)?M.PARTIAL:M.OK:u.backtrack?M.BACKTRACKED:M.APPENDING:M.NOT_LOADED},v.backtrack=function(p,o){var u=k(p),r=this.fragments[u];if(!r||r.backtrack)return null;var i=r.backtrack=o||r.loaded;return r.loaded=null,i},v.getBacktrackData=function(p){var o=k(p),u=this.fragments[o];if(u){var r,i=u.backtrack;if(i!=null&&(r=i.payload)!==null&&r!==void 0&&r.byteLength)return i;this.removeFragment(p)}return null},v.isTimeBuffered=function(p,o,u){for(var r,i,t=0;t<u.length;t++){if(r=u.start(t)-this.bufferPadding,i=u.end(t)+this.bufferPadding,p>=r&&o<=i)return!0;if(o<=r)return!1}return!1},v.onFragLoaded=function(p,o){var u=o.frag,r=o.part;if(u.sn==="initSegment"||u.bitrateTest||r)return;var i=k(u);this.fragments[i]={body:u,loaded:o,backtrack:null,buffered:!1,range:Object.create(null)}},v.onBufferAppended=function(p,o){var u=this,r=o.frag,i=o.part,t=o.timeRanges;if(r.type===H.PlaylistLevelType.MAIN)if(this.activeFragment=r,i){var c=this.activeParts;c||(this.activeParts=c=[]),c.push(i)}else this.activeParts=null;this.timeRanges=t,Object.keys(t).forEach(function(f){var A=t[f];if(u.detectEvictedFragments(f,A),!i)for(var S=0;S<A.length;S++)r.appendedPTS=Math.max(A.end(S),r.appendedPTS||0)})},v.onFragBuffered=function(p,o){this.detectPartialFragments(o)},v.hasFragment=function(p){var o=k(p);return!!this.fragments[o]},v.removeFragmentsInRange=function(p,o,u){var r=this;Object.keys(this.fragments).forEach(function(i){var t=r.fragments[i];if(!t)return;if(t.buffered){var c=t.body;c.type===u&&c.start<o&&c.end>p&&r.removeFragment(c)}})},v.removeFragment=function(p){var o=k(p);p.stats.loaded=0,p.clearElementaryStreamInfo(),delete this.fragments[o]},v.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},D}();function X(D){var v,_;return D.buffered&&(((v=D.range.video)===null||v===void 0?void 0:v.partial)||((_=D.range.audio)===null||_===void 0?void 0:_.partial))}function k(D){return D.type+"_"+D.level+"_"+D.urlId+"_"+D.sn}},"./src/controller/gap-controller.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"STALL_MINIMUM_DURATION_MS",function(){return X}),U.d(Z,"MAX_START_GAP_JUMP",function(){return k}),U.d(Z,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return D}),U.d(Z,"SKIP_BUFFER_RANGE_START",function(){return v}),U.d(Z,"default",function(){return _});var ee=U("./src/utils/buffer-helper.ts"),H=U("./src/errors.ts"),M=U("./src/events.ts"),Y=U("./src/utils/logger.ts"),X=250,k=2,D=.1,v=.05,_=function(){function p(u,r,i,t){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=u,this.media=r,this.fragmentTracker=i,this.hls=t}var o=p.prototype;return o.destroy=function(){this.hls=this.fragmentTracker=this.media=null},o.poll=function(r){var i=this.config,t=this.media,c=this.stalled,f=t.currentTime,A=t.seeking,S=this.seeking&&!A,w=!this.seeking&&A;if(this.seeking=A,f!==r){if(this.moved=!0,c!==null){if(this.stallReported){var R=self.performance.now()-c;Y.logger.warn("playback not stuck anymore @"+f+", after "+Math.round(R)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((w||S)&&(this.stalled=null),t.paused||t.ended||t.playbackRate===0||!ee.BufferHelper.getBuffered(t).length)return;var O=ee.BufferHelper.bufferInfo(t,f,0),E=O.len>0,y=O.nextStart||0;if(!E&&!y)return;if(A){var d=O.len>k,l=!y||y-f>k&&!this.fragmentTracker.getPartialFragment(f);if(d||l)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var h,g=Math.max(y,O.start||0)-f,b=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,F=b==null||((h=b.details)===null||h===void 0)?void 0:h.live,N=F?b.details.targetduration*2:k;if(g>0&&g<=N){this._trySkipBufferHole(null);return}}var W=self.performance.now();if(c===null){this.stalled=W;return}var K=W-c;!A&&K>=X&&this._reportStall(O.len);var I=ee.BufferHelper.bufferInfo(t,f,i.maxBufferHole);this._tryFixBufferStall(I,K)},o._tryFixBufferStall=function(r,i){var t=this.config,c=this.fragmentTracker,f=this.media,A=f.currentTime,S=c.getPartialFragment(A);if(S){var w=this._trySkipBufferHole(S);if(w)return}r.len>t.maxBufferHole&&i>t.highBufferWatchdogPeriod*1e3&&(Y.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},o._reportStall=function(r){var i=this.hls,t=this.media,c=this.stallReported;c||(this.stallReported=!0,Y.logger.warn("Playback stalling at @"+t.currentTime+" due to low buffer (buffer="+r+")"),i.trigger(M.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:r}))},o._trySkipBufferHole=function(r){for(var i=this.config,t=this.hls,c=this.media,f=c.currentTime,A=0,S=ee.BufferHelper.getBuffered(c),w=0;w<S.length;w++){var R=S.start(w);if(f+i.maxBufferHole>=A&&f<R){var O=Math.max(R+v,c.currentTime+D);return Y.logger.warn("skipping hole, adjusting currentTime from "+f+" to "+O),this.moved=!0,this.stalled=null,c.currentTime=O,r&&t.trigger(M.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+f+" to "+O,frag:r}),O}A=S.end(w)}return 0},o._tryNudgeBuffer=function(){var r=this.config,i=this.hls,t=this.media,c=t.currentTime,f=(this.nudgeRetry||0)+1;if(this.nudgeRetry=f,f<r.nudgeMaxRetry){var A=c+f*r.nudgeOffset;Y.logger.warn("Nudging 'currentTime' from "+c+" to "+A),t.currentTime=A,i.trigger(M.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else Y.logger.error("Playhead still not moving while enough data buffered @"+c+" after "+r.nudgeMaxRetry+" nudges"),i.trigger(M.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},p}()},"./src/controller/id3-track-controller.ts":function(ie,Z,U){"use strict";U.r(Z);var ee=U("./src/events.ts"),H=U("./src/utils/texttrack-utils.ts"),M=U("./src/demux/id3.ts"),Y=.25,X=function(){function k(v){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=v,this._registerListeners()}var D=k.prototype;return D.destroy=function(){this._unregisterListeners()},D._registerListeners=function(){var _=this.hls;_.on(ee.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.on(ee.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.on(ee.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),_.on(ee.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D._unregisterListeners=function(){var _=this.hls;_.off(ee.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.off(ee.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.off(ee.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),_.off(ee.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D.onMediaAttached=function(_,p){this.media=p.media},D.onMediaDetaching=function(){if(!this.id3Track)return;Object(H.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},D.getID3Track=function(_){if(!this.media)return;for(var p=0;p<_.length;p++){var o=_[p];if(o.kind==="metadata"&&o.label==="id3")return Object(H.sendAddTrackEvent)(o,this.media),o}return this.media.addTextTrack("metadata","id3")},D.onFragParsingMetadata=function(_,p){if(!this.media)return;var o=p.frag,u=p.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var r=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,i=0;i<u.length;i++){var t=M.getID3Frames(u[i].data);if(t){var c=u[i].pts,f=i<u.length-1?u[i+1].pts:o.end,A=f-c;A<=0&&(f=c+Y);for(var S=0;S<t.length;S++){var w=t[S];if(!M.isTimeStampFrame(w)){var R=new r(c,f,"");R.value=w,this.id3Track.addCue(R)}}}}},D.onBufferFlushing=function(_,p){var o=p.startOffset,u=p.endOffset,r=p.type;if(!r||r==="audio"){var i=this.id3Track;i&&Object(H.removeCuesInRange)(i,o,u)}},k}();Z.default=X},"./src/controller/latency-controller.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"default",function(){return k});var ee=U("./src/errors.ts"),H=U("./src/events.ts"),M=U("./src/utils/logger.ts");function Y(D,v){for(var _=0;_<v.length;_++){var p=v[_];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(D,p.key,p)}}function X(D,v,_){return v&&Y(D.prototype,v),_&&Y(D,_),D}var k=function(){function D(_){var p=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return p.timeupdate()},this.hls=_,this.config=_.config,this.registerListeners()}var v=D.prototype;return v.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},v.registerListeners=function(){this.hls.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(H.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(H.Events.ERROR,this.onError,this)},v.unregisterListeners=function(){this.hls.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(H.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(H.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(H.Events.ERROR,this.onError)},v.onMediaAttached=function(p,o){this.media=o.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},v.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},v.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},v.onLevelUpdated=function(p,o){var u=o.details;this.levelDetails=u,u.advanced&&this.timeupdate(),!u.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},v.onError=function(p,o){if(o.details!==ee.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,M.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},v.timeupdate=function(){var p=this.media,o=this.levelDetails;if(!p||!o)return;this.currentTime=p.currentTime;var u=this.computeLatency();if(u===null)return;this._latency=u;var r=this.config,i=r.lowLatencyMode,t=r.maxLiveSyncPlaybackRate;if(!i||t===1)return;var c=this.targetLatency;if(c===null)return;var f=u-c,A=Math.min(this.maxLatency,c+o.targetduration),S=f<A;if(o.live&&S&&f>.05&&this.forwardBufferLength>1){var w=Math.min(2,Math.max(1,t)),R=Math.round(2/(1+Math.exp(-.75*f-this.edgeStalled))*20)/20;p.playbackRate=Math.min(w,Math.max(1,R))}else p.playbackRate!==1&&p.playbackRate!==0&&(p.playbackRate=1)},v.estimateLiveEdge=function(){var p=this.levelDetails;return p===null?null:p.edge+p.age},v.computeLatency=function(){var p=this.estimateLiveEdge();return p===null?null:p-this.currentTime},X(D,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var p=this.config,o=this.levelDetails;return p.liveMaxLatencyDuration!==void 0?p.liveMaxLatencyDuration:o?p.liveMaxLatencyDurationCount*o.targetduration:0}},{key:"targetLatency",get:function(){var p=this.levelDetails;if(p===null)return null;var o=p.holdBack,u=p.partHoldBack,r=p.targetduration,i=this.config,t=i.liveSyncDuration,c=i.liveSyncDurationCount,f=i.lowLatencyMode,A=this.hls.userConfig,S=f&&u||o;(A.liveSyncDuration||A.liveSyncDurationCount||S===0)&&(S=t!==void 0?t:c*r);var w=r,R=1;return S+Math.min(this.stallCount*R,w)}},{key:"liveSyncPosition",get:function(){var p=this.estimateLiveEdge(),o=this.targetLatency,u=this.levelDetails;if(p===null||o===null||u===null)return null;var r=u.edge,i=p-o-this.edgeStalled,t=r-u.totalduration,c=r-(this.config.lowLatencyMode&&u.partTarget||u.targetduration);return Math.min(Math.max(t,i),c)}},{key:"drift",get:function(){var p=this.levelDetails;return p===null?1:p.drift}},{key:"edgeStalled",get:function(){var p=this.levelDetails;if(p===null)return 0;var o=(this.config.lowLatencyMode&&p.partTarget||p.targetduration)*3;return Math.max(p.age-o,0)}},{key:"forwardBufferLength",get:function(){var p=this.media,o=this.levelDetails;if(!p||!o)return 0;var u=p.buffered.length;return u?p.buffered.end(u-1):o.edge-this.currentTime}}]),D}()},"./src/controller/level-controller.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"default",function(){return i});var ee=U("./src/types/level.ts"),H=U("./src/events.ts"),M=U("./src/errors.ts"),Y=U("./src/utils/codecs.ts"),X=U("./src/controller/level-helper.ts"),k=U("./src/controller/base-playlist-controller.ts"),D=U("./src/types/loader.ts");function v(){return v=Object.assign||function(t){for(var c=1;c<arguments.length;c++){var f=arguments[c];for(var A in f)Object.prototype.hasOwnProperty.call(f,A)&&(t[A]=f[A])}return t},v.apply(this,arguments)}function _(t,c){for(var f=0;f<c.length;f++){var A=c[f];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(t,A.key,A)}}function p(t,c,f){return c&&_(t.prototype,c),f&&_(t,f),t}function o(t,c){t.prototype=Object.create(c.prototype),t.prototype.constructor=t,u(t,c)}function u(t,c){return u=Object.setPrototypeOf||function(A,S){return A.__proto__=S,A},u(t,c)}var r=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),i=function(t){o(c,t);function c(A){var S;return S=t.call(this,A,"[level-controller]")||this,S._levels=[],S._firstLevel=-1,S._startLevel=void 0,S.currentLevelIndex=-1,S.manualLevelIndex=-1,S.onParsedComplete=void 0,S._registerListeners(),S}var f=c.prototype;return f._registerListeners=function(){var S=this.hls;S.on(H.Events.MANIFEST_LOADED,this.onManifestLoaded,this),S.on(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),S.on(H.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),S.on(H.Events.FRAG_LOADED,this.onFragLoaded,this),S.on(H.Events.ERROR,this.onError,this)},f._unregisterListeners=function(){var S=this.hls;S.off(H.Events.MANIFEST_LOADED,this.onManifestLoaded,this),S.off(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),S.off(H.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),S.off(H.Events.FRAG_LOADED,this.onFragLoaded,this),S.off(H.Events.ERROR,this.onError,this)},f.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,t.prototype.destroy.call(this)},f.startLoad=function(){var S=this._levels;S.forEach(function(w){w.loadError=0}),t.prototype.startLoad.call(this)},f.onManifestLoaded=function(S,w){var R=[],O=[],E=[],y,d={},l,h=!1,g=!1,b=!1;if(w.levels.forEach(function(K){var I=K.attrs;h=h||!!(K.width&&K.height),g=g||!!K.videoCodec,b=b||!!K.audioCodec,r&&K.audioCodec&&K.audioCodec.indexOf("mp4a.40.34")!==-1&&(K.audioCodec=void 0);var x=K.bitrate+"-"+K.attrs.RESOLUTION+"-"+K.attrs.CODECS;l=d[x],l?l.url.push(K.url):(l=new ee.Level(K),d[x]=l,R.push(l)),I&&(I.AUDIO&&Object(X.addGroupId)(l,"audio",I.AUDIO),I.SUBTITLES&&Object(X.addGroupId)(l,"text",I.SUBTITLES))}),(h||g)&&b&&(R=R.filter(function(K){var I=K.videoCodec,x=K.width,j=K.height;return!!I||!!(x&&j)})),R=R.filter(function(K){var I=K.audioCodec,x=K.videoCodec;return(!I||Object(Y.isCodecSupportedInMp4)(I,"audio"))&&(!x||Object(Y.isCodecSupportedInMp4)(x,"video"))}),w.audioTracks&&(O=w.audioTracks.filter(function(K){return!K.audioCodec||Object(Y.isCodecSupportedInMp4)(K.audioCodec,"audio")}),Object(X.assignTrackIdsByGroup)(O)),w.subtitles&&(E=w.subtitles,Object(X.assignTrackIdsByGroup)(E)),R.length>0){y=R[0].bitrate,R.sort(function(K,I){return K.bitrate-I.bitrate}),this._levels=R;for(var F=0;F<R.length;F++)if(R[F].bitrate===y){this._firstLevel=F,this.log("manifest loaded, "+R.length+" level(s) found, first bitrate: "+y);break}var N=b&&!g,W={levels:R,audioTracks:O,subtitleTracks:E,firstLevel:this._firstLevel,stats:w.stats,audio:b,video:g,altAudio:!N&&O.some(function(K){return!!K.url})};this.hls.trigger(H.Events.MANIFEST_PARSED,W),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:w.url,reason:"no level with compatible codecs found in manifest"})},f.onError=function(S,w){if(t.prototype.onError.call(this,S,w),w.fatal)return;var R=w.context,O=this._levels[this.currentLevelIndex];if(R&&(R.type===D.PlaylistContextType.AUDIO_TRACK&&O.audioGroupIds&&R.groupId===O.audioGroupIds[O.urlId]||R.type===D.PlaylistContextType.SUBTITLE_TRACK&&O.textGroupIds&&R.groupId===O.textGroupIds[O.urlId])){this.redundantFailover(this.currentLevelIndex);return}var E=!1,y=!0,d;switch(w.details){case M.ErrorDetails.FRAG_LOAD_ERROR:case M.ErrorDetails.FRAG_LOAD_TIMEOUT:case M.ErrorDetails.KEY_LOAD_ERROR:case M.ErrorDetails.KEY_LOAD_TIMEOUT:if(w.frag){var l=this._levels[w.frag.level];l?(l.fragmentError++,l.fragmentError>this.hls.config.fragLoadingMaxRetry&&(d=w.frag.level)):d=w.frag.level}break;case M.ErrorDetails.LEVEL_LOAD_ERROR:case M.ErrorDetails.LEVEL_LOAD_TIMEOUT:R&&(R.deliveryDirectives&&(y=!1),d=R.level),E=!0;break;case M.ErrorDetails.REMUX_ALLOC_ERROR:d=w.level,E=!0;break}d!==void 0&&this.recoverLevel(w,d,E,y)},f.recoverLevel=function(S,w,R,O){var E=S.details,y=this._levels[w];if(y.loadError++,R){var d=this.retryLoadingOrFail(S);if(d)S.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(O){var l=y.url.length;if(l>1&&y.loadError<l)S.levelRetry=!0,this.redundantFailover(w);else if(this.manualLevelIndex===-1){var h=w===0?this._levels.length-1:w-1;this.currentLevelIndex!==h&&this._levels[h].loadError===0&&(this.warn(E+": switch to "+h),S.levelRetry=!0,this.hls.nextAutoLevel=h)}}},f.redundantFailover=function(S){var w=this._levels[S],R=w.url.length;if(R>1){var O=(w.urlId+1)%R;this.warn("Switching to redundant URL-id "+O),this._levels.forEach(function(E){E.urlId=O}),this.level=S}},f.onFragLoaded=function(S,w){var R=w.frag;if(R!==void 0&&R.type===D.PlaylistLevelType.MAIN){var O=this._levels[R.level];O!==void 0&&(O.fragmentError=0,O.loadError=0)}},f.onLevelLoaded=function(S,w){var R,O=w.level,E=w.details,y=this._levels[O];if(!y){var d;this.warn("Invalid level index "+O),(d=w.deliveryDirectives)!==null&&d!==void 0&&d.skip&&(E.deltaUpdateFailed=!0);return}O===this.currentLevelIndex?(y.fragmentError===0&&(y.loadError=0,this.retryCount=0),this.playlistLoaded(O,w,y.details)):(R=w.deliveryDirectives)!==null&&R!==void 0&&R.skip&&(E.deltaUpdateFailed=!0)},f.onAudioTrackSwitched=function(S,w){var R=this.hls.levels[this.currentLevelIndex];if(!R)return;if(R.audioGroupIds){for(var O=-1,E=this.hls.audioTracks[w.id].groupId,y=0;y<R.audioGroupIds.length;y++)if(R.audioGroupIds[y]===E){O=y;break}O!==R.urlId&&(R.urlId=O,this.startLoad())}},f.loadPlaylist=function(S){var w=this.currentLevelIndex,R=this._levels[w];if(this.canLoad&&R&&R.url.length>0){var O=R.urlId,E=R.url[O];if(S)try{E=S.addDirectives(E)}catch(y){this.warn("Could not construct new URL with HLS Delivery Directives: "+y)}this.log("Attempt loading level index "+w+(S?" at sn "+S.msn+" part "+S.part:"")+" with URL-id "+O+" "+E),this.clearTimer(),this.hls.trigger(H.Events.LEVEL_LOADING,{url:E,level:w,id:O,deliveryDirectives:S||null})}},f.removeLevel=function(S,w){var R=function(y,d){return d!==w},O=this._levels.filter(function(E,y){return y!==S?!0:E.url.length>1&&w!==void 0?(E.url=E.url.filter(R),E.audioGroupIds&&(E.audioGroupIds=E.audioGroupIds.filter(R)),E.textGroupIds&&(E.textGroupIds=E.textGroupIds.filter(R)),E.urlId=0,!0):!1}).map(function(E,y){var d=E.details;return d!=null&&d.fragments&&d.fragments.forEach(function(l){l.level=y}),E});this._levels=O,this.hls.trigger(H.Events.LEVELS_UPDATED,{levels:O})},p(c,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(S){var w,R=this._levels;if(R.length===0)return;if(this.currentLevelIndex===S&&(w=R[S])!==null&&w!==void 0&&w.details)return;if(S<0||S>=R.length){var O=S<0;if(this.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.OTHER_ERROR,details:M.ErrorDetails.LEVEL_SWITCH_ERROR,level:S,fatal:O,reason:"invalid level idx"}),O)return;S=Math.min(S,R.length-1)}this.clearTimer();var E=this.currentLevelIndex,y=R[E],d=R[S];this.log("switching to level "+S+" from "+E),this.currentLevelIndex=S;var l=v({},d,{level:S,maxBitrate:d.maxBitrate,uri:d.uri,urlId:d.urlId});delete l._urlId,this.hls.trigger(H.Events.LEVEL_SWITCHING,l);var h=d.details;if(!h||h.live){var g=this.switchParams(d.uri,y==null?void 0:y.details);this.loadPlaylist(g)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(S){this.manualLevelIndex=S,this._startLevel===void 0&&(this._startLevel=S),S!==-1&&(this.level=S)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(S){this._firstLevel=S}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var S=this.hls.config.startLevel;return S!==void 0?S:this._firstLevel}else return this._startLevel},set:function(S){this._startLevel=S}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(S){this.level=S,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=S)}}]),c}(k.default)},"./src/controller/level-helper.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"addGroupId",function(){return M}),U.d(Z,"assignTrackIdsByGroup",function(){return Y}),U.d(Z,"updatePTS",function(){return X}),U.d(Z,"updateFragPTSDTS",function(){return D}),U.d(Z,"mergeDetails",function(){return v}),U.d(Z,"mapPartIntersection",function(){return _}),U.d(Z,"mapFragmentIntersection",function(){return p}),U.d(Z,"adjustSliding",function(){return o}),U.d(Z,"addSliding",function(){return u}),U.d(Z,"computeReloadInterval",function(){return r}),U.d(Z,"getFragmentWithSN",function(){return i}),U.d(Z,"getPartWith",function(){return t});var ee=U("./src/polyfills/number.ts"),H=U("./src/utils/logger.ts");function M(c,f,A){switch(f){case"audio":c.audioGroupIds||(c.audioGroupIds=[]),c.audioGroupIds.push(A);break;case"text":c.textGroupIds||(c.textGroupIds=[]),c.textGroupIds.push(A);break}}function Y(c){var f={};c.forEach(function(A){var S=A.groupId||"";A.id=f[S]=f[S]||0,f[S]++})}function X(c,f,A){var S=c[f],w=c[A];k(S,w)}function k(c,f){var A=f.startPTS;if(Object(ee.isFiniteNumber)(A)){var S=0,w;f.sn>c.sn?(S=A-c.start,w=c):(S=c.start-A,w=f),w.duration!==S&&(w.duration=S)}else if(f.sn>c.sn){var R=c.cc===f.cc;R&&c.minEndPTS?f.start=c.start+(c.minEndPTS-c.start):f.start=c.start+c.duration}else f.start=Math.max(c.start-f.duration,0)}function D(c,f,A,S,w,R){var O=S-A;O<=0&&(H.logger.warn("Fragment should have a positive duration",f),S=A+f.duration,R=w+f.duration);var E=A,y=S,d=f.startPTS,l=f.endPTS;if(Object(ee.isFiniteNumber)(d)){var h=Math.abs(d-A);Object(ee.isFiniteNumber)(f.deltaPTS)?f.deltaPTS=Math.max(h,f.deltaPTS):f.deltaPTS=h,E=Math.max(A,d),A=Math.min(A,d),w=Math.min(w,f.startDTS),y=Math.min(S,l),S=Math.max(S,l),R=Math.max(R,f.endDTS)}f.duration=S-A;var g=A-f.start;f.appendedPTS=S,f.start=f.startPTS=A,f.maxStartPTS=E,f.startDTS=w,f.endPTS=S,f.minEndPTS=y,f.endDTS=R;var b=f.sn;if(!c||b<c.startSN||b>c.endSN)return 0;var F,N=b-c.startSN,W=c.fragments;for(W[N]=f,F=N;F>0;F--)k(W[F],W[F-1]);for(F=N;F<W.length-1;F++)k(W[F],W[F+1]);return c.fragmentHint&&k(W[W.length-1],c.fragmentHint),c.PTSKnown=c.alignedSliding=!0,g}function v(c,f){for(var A=null,S=c.fragments,w=S.length-1;w>=0;w--){var R=S[w].initSegment;if(R){A=R;break}}c.fragmentHint&&delete c.fragmentHint.endPTS;var O=0,E;if(p(c,f,function(F,N){F.relurl&&(O=F.cc-N.cc),Object(ee.isFiniteNumber)(F.startPTS)&&Object(ee.isFiniteNumber)(F.endPTS)&&(N.start=N.startPTS=F.startPTS,N.startDTS=F.startDTS,N.appendedPTS=F.appendedPTS,N.maxStartPTS=F.maxStartPTS,N.endPTS=F.endPTS,N.endDTS=F.endDTS,N.minEndPTS=F.minEndPTS,N.duration=F.endPTS-F.startPTS,N.duration&&(E=N),f.PTSKnown=f.alignedSliding=!0),N.elementaryStreams=F.elementaryStreams,N.loader=F.loader,N.stats=F.stats,N.urlId=F.urlId,F.initSegment&&(N.initSegment=F.initSegment,A=F.initSegment)}),A){var y=f.fragmentHint?f.fragments.concat(f.fragmentHint):f.fragments;y.forEach(function(F){var N;(!F.initSegment||F.initSegment.relurl===((N=A)===null||N===void 0?void 0:N.relurl))&&(F.initSegment=A)})}if(f.skippedSegments&&(f.deltaUpdateFailed=f.fragments.some(function(F){return!F}),f.deltaUpdateFailed)){H.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var d=f.skippedSegments;d--;)f.fragments.shift();f.startSN=f.fragments[0].sn,f.startCC=f.fragments[0].cc}var l=f.fragments;if(O){H.logger.warn("discontinuity sliding from playlist, take drift into account");for(var h=0;h<l.length;h++)l[h].cc+=O}f.skippedSegments&&(f.startCC=f.fragments[0].cc),_(c.partList,f.partList,function(F,N){N.elementaryStreams=F.elementaryStreams,N.stats=F.stats}),E?D(f,E,E.startPTS,E.endPTS,E.startDTS,E.endDTS):o(c,f),l.length&&(f.totalduration=f.edge-l[0].start),f.driftStartTime=c.driftStartTime,f.driftStart=c.driftStart;var g=f.advancedDateTime;if(f.advanced&&g){var b=f.edge;f.driftStart||(f.driftStartTime=g,f.driftStart=b),f.driftEndTime=g,f.driftEnd=b}else f.driftEndTime=c.driftEndTime,f.driftEnd=c.driftEnd,f.advancedDateTime=c.advancedDateTime}function _(c,f,A){if(c&&f)for(var S=0,w=0,R=c.length;w<=R;w++){var O=c[w],E=f[w+S];O&&E&&O.index===E.index&&O.fragment.sn===E.fragment.sn?A(O,E):S--}}function p(c,f,A){for(var S=f.skippedSegments,w=Math.max(c.startSN,f.startSN)-f.startSN,R=(c.fragmentHint?1:0)+(S?f.endSN:Math.min(c.endSN,f.endSN))-f.startSN,O=f.startSN-c.startSN,E=f.fragmentHint?f.fragments.concat(f.fragmentHint):f.fragments,y=c.fragmentHint?c.fragments.concat(c.fragmentHint):c.fragments,d=w;d<=R;d++){var l=y[O+d],h=E[d];S&&!h&&d<S&&(h=f.fragments[d]=l),l&&h&&A(l,h)}}function o(c,f){var A=f.startSN+f.skippedSegments-c.startSN,S=c.fragments;if(A<0||A>=S.length)return;u(f,S[A].start)}function u(c,f){if(f){for(var A=c.fragments,S=c.skippedSegments;S<A.length;S++)A[S].start+=f;c.fragmentHint&&(c.fragmentHint.start+=f)}}function r(c,f){var A=1e3*c.levelTargetDuration,S=A/2,w=c.age,R=w>0&&w<A*3,O=f.loading.end-f.loading.start,E,y=c.availabilityDelay;if(c.updated===!1)if(R){var d=333*c.misses;E=Math.max(Math.min(S,O*2),d),c.availabilityDelay=(c.availabilityDelay||0)+E}else E=S;else R?(y=Math.min(y||A/2,w),c.availabilityDelay=y,E=y+A-w):E=A-O;return Math.round(E)}function i(c,f,A){if(!c||!c.details)return null;var S=c.details,w=S.fragments[f-S.startSN];return w||(w=S.fragmentHint,w&&w.sn===f?w:f<S.startSN&&A&&A.sn===f?A:null)}function t(c,f,A){if(!c||!c.details)return null;var S=c.details.partList;if(S)for(var w=S.length;w--;){var R=S[w];if(R.index===A&&R.fragment.sn===f)return R}return null}},"./src/controller/stream-controller.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"default",function(){return S});var ee=U("./src/polyfills/number.ts"),H=U("./src/controller/base-stream-controller.ts"),M=U("./src/is-supported.ts"),Y=U("./src/events.ts"),X=U("./src/utils/buffer-helper.ts"),k=U("./src/controller/fragment-tracker.ts"),D=U("./src/types/loader.ts"),v=U("./src/loader/fragment.ts"),_=U("./src/demux/transmuxer-interface.ts"),p=U("./src/types/transmuxer.ts"),o=U("./src/controller/gap-controller.ts"),u=U("./src/errors.ts"),r=U("./src/utils/logger.ts");function i(w,R){for(var O=0;O<R.length;O++){var E=R[O];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(w,E.key,E)}}function t(w,R,O){return R&&i(w.prototype,R),O&&i(w,O),w}function c(w,R){w.prototype=Object.create(R.prototype),w.prototype.constructor=w,f(w,R)}function f(w,R){return f=Object.setPrototypeOf||function(E,y){return E.__proto__=y,E},f(w,R)}var A=100,S=function(w){c(R,w);function R(E,y){var d;return d=w.call(this,E,y,"[stream-controller]")||this,d.audioCodecSwap=!1,d.gapController=null,d.level=-1,d._forceStartLoad=!1,d.altAudio=!1,d.audioOnly=!1,d.fragPlaying=null,d.onvplaying=null,d.onvseeked=null,d.fragLastKbps=0,d.stalled=!1,d.couldBacktrack=!1,d.audioCodecSwitch=!1,d.videoBuffer=null,d._registerListeners(),d}var O=R.prototype;return O._registerListeners=function(){var y=this.hls;y.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),y.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),y.on(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),y.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.on(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),y.on(Y.Events.LEVEL_LOADED,this.onLevelLoaded,this),y.on(Y.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),y.on(Y.Events.ERROR,this.onError,this),y.on(Y.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),y.on(Y.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),y.on(Y.Events.BUFFER_CREATED,this.onBufferCreated,this),y.on(Y.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),y.on(Y.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),y.on(Y.Events.FRAG_BUFFERED,this.onFragBuffered,this)},O._unregisterListeners=function(){var y=this.hls;y.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),y.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),y.off(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),y.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.off(Y.Events.LEVEL_LOADED,this.onLevelLoaded,this),y.off(Y.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),y.off(Y.Events.ERROR,this.onError,this),y.off(Y.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),y.off(Y.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),y.off(Y.Events.BUFFER_CREATED,this.onBufferCreated,this),y.off(Y.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),y.off(Y.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),y.off(Y.Events.FRAG_BUFFERED,this.onFragBuffered,this)},O.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},O.startLoad=function(y){if(this.levels){var d=this.lastCurrentTime,l=this.hls;if(this.stopLoad(),this.setInterval(A),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var h=l.startLevel;h===-1&&(l.config.testBandwidth?(h=0,this.bitrateTest=!0):h=l.nextAutoLevel),this.level=l.nextLoadLevel=h,this.loadedmetadata=!1}d>0&&y===-1&&(this.log("Override startPosition with lastCurrentTime @"+d.toFixed(3)),y=d),this.state=H.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=y,this.tick()}else this._forceStartLoad=!0,this.state=H.State.STOPPED},O.stopLoad=function(){this._forceStartLoad=!1,w.prototype.stopLoad.call(this)},O.doTick=function(){switch(this.state){case H.State.IDLE:this.doTickIdle();break;case H.State.WAITING_LEVEL:{var y,d=this.levels,l=this.level,h=d==null||((y=d[l])===null||y===void 0)?void 0:y.details;if(h&&(!h.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(h))break;this.state=H.State.IDLE;break}break}case H.State.FRAG_LOADING_WAITING_RETRY:{var g,b=self.performance.now(),F=this.retryDate;(!F||b>=F||(g=this.media)!==null&&g!==void 0&&g.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=H.State.IDLE)}break;default:break}this.onTickEnd()},O.onTickEnd=function(){w.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},O.doTickIdle=function(){var y,d,l=this.hls,h=this.levelLastLoaded,g=this.levels,b=this.media,F=l.config,N=l.nextLoadLevel;if(h===null||!b&&(this.startFragRequested||!F.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!g||!g[N])return;var W=g[N];this.level=l.nextLoadLevel=N;var K=W.details;if(!K||this.state===H.State.WAITING_LEVEL||K.live&&this.levelLastLoaded!==N){this.state=H.State.WAITING_LEVEL;return}var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:b,D.PlaylistLevelType.MAIN);if(I===null)return;var x=I.len,j=this.getMaxBufferLength(W.maxBitrate);if(x>=j)return;if(this._streamEnded(I,K)){var $={};this.altAudio&&($.type="video"),this.hls.trigger(Y.Events.BUFFER_EOS,$),this.state=H.State.ENDED;return}var ae=I.end,fe=this.getNextFragment(ae,K);if(this.couldBacktrack&&!this.fragPrevious&&fe&&fe.sn!=="initSegment"){var pe=fe.sn-K.startSN;pe>1&&(fe=K.fragments[pe-1],this.fragmentTracker.removeFragment(fe))}if(fe&&this.fragmentTracker.getState(fe)===k.FragmentState.OK&&this.nextLoadPosition>ae){var Ce=this.audioOnly&&!this.altAudio?v.ElementaryStreamTypes.AUDIO:v.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(b,Ce,D.PlaylistLevelType.MAIN),fe=this.getNextFragment(this.nextLoadPosition,K)}if(!fe)return;fe.initSegment&&!fe.initSegment.data&&!this.bitrateTest&&(fe=fe.initSegment),((y=fe.decryptdata)===null||y===void 0?void 0:y.keyFormat)==="identity"&&!((d=fe.decryptdata)!==null&&d!==void 0&&d.key)?this.loadKey(fe,K):this.loadFragment(fe,K,ae)},O.loadFragment=function(y,d,l){var h,g=this.fragmentTracker.getState(y);if(this.fragCurrent=y,g===k.FragmentState.BACKTRACKED){var b=this.fragmentTracker.getBacktrackData(y);if(b){this._handleFragmentLoadProgress(b),this._handleFragmentLoadComplete(b);return}else g=k.FragmentState.NOT_LOADED}g===k.FragmentState.NOT_LOADED||g===k.FragmentState.PARTIAL?y.sn==="initSegment"?this._loadInitSegment(y):this.bitrateTest?(y.bitrateTest=!0,this.log("Fragment "+y.sn+" of level "+y.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(y)):(this.startFragRequested=!0,w.prototype.loadFragment.call(this,y,d,l)):g===k.FragmentState.APPENDING?this.reduceMaxBufferLength(y.duration)&&this.fragmentTracker.removeFragment(y):((h=this.media)===null||h===void 0?void 0:h.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},O.getAppendedFrag=function(y){var d=this.fragmentTracker.getAppendedFrag(y,D.PlaylistLevelType.MAIN);return d&&"fragment"in d?d.fragment:d},O.getBufferedFrag=function(y){return this.fragmentTracker.getBufferedFrag(y,D.PlaylistLevelType.MAIN)},O.followingBufferedFrag=function(y){return y?this.getBufferedFrag(y.end+.5):null},O.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},O.nextLevelSwitch=function(){var y=this.levels,d=this.media;if(d!=null&&d.readyState){var l,h=this.getAppendedFrag(d.currentTime);if(h&&h.start>1&&this.flushMainBuffer(0,h.start-1),!d.paused&&y){var g=this.hls.nextLoadLevel,b=y[g],F=this.fragLastKbps;F&&this.fragCurrent?l=this.fragCurrent.duration*b.maxBitrate/(1e3*F)+1:l=0}else l=0;var N=this.getBufferedFrag(d.currentTime+l);if(N){var W=this.followingBufferedFrag(N);if(W){this.abortCurrentFrag();var K=W.maxStartPTS?W.maxStartPTS:W.start,I=W.duration,x=Math.max(N.end,K+Math.min(Math.max(I-this.config.maxFragLookUpTolerance,I*.5),I*.75));this.flushMainBuffer(x,Number.POSITIVE_INFINITY)}}}},O.abortCurrentFrag=function(){var y=this.fragCurrent;this.fragCurrent=null,y!=null&&y.loader&&y.loader.abort(),this.state===H.State.KEY_LOADING&&(this.state=H.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},O.flushMainBuffer=function(y,d){w.prototype.flushMainBuffer.call(this,y,d,this.altAudio?"video":null)},O.onMediaAttached=function(y,d){w.prototype.onMediaAttached.call(this,y,d);var l=d.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),l.addEventListener("playing",this.onvplaying),l.addEventListener("seeked",this.onvseeked),this.gapController=new o.default(this.config,l,this.fragmentTracker,this.hls)},O.onMediaDetaching=function(){var y=this.media;y&&(y.removeEventListener("playing",this.onvplaying),y.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),w.prototype.onMediaDetaching.call(this)},O.onMediaPlaying=function(){this.tick()},O.onMediaSeeked=function(){var y=this.media,d=y?y.currentTime:null;Object(ee.isFiniteNumber)(d)&&this.log("Media seeked to "+d.toFixed(3)),this.tick()},O.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(Y.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},O.onManifestParsed=function(y,d){var l=!1,h=!1,g;d.levels.forEach(function(b){g=b.audioCodec,g&&(g.indexOf("mp4a.40.2")!==-1&&(l=!0),g.indexOf("mp4a.40.5")!==-1&&(h=!0))}),this.audioCodecSwitch=l&&h&&!Object(M.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=d.levels,this.startFragRequested=!1},O.onLevelLoading=function(y,d){var l=this.levels;if(!l||this.state!==H.State.IDLE)return;var h=l[d.level];(!h.details||h.details.live&&this.levelLastLoaded!==d.level||this.waitForCdnTuneIn(h.details))&&(this.state=H.State.WAITING_LEVEL)},O.onLevelLoaded=function(y,d){var l,h=this.levels,g=d.level,b=d.details,F=b.totalduration;if(!h){this.warn("Levels were reset while loading level "+g);return}this.log("Level "+g+" loaded ["+b.startSN+","+b.endSN+"], cc ["+b.startCC+", "+b.endCC+"] duration:"+F);var N=this.fragCurrent;N&&(this.state===H.State.FRAG_LOADING||this.state===H.State.FRAG_LOADING_WAITING_RETRY)&&(N.level!==d.level&&N.loader&&(this.state=H.State.IDLE,N.loader.abort()));var W=h[g],K=0;if(b.live||(l=W.details)!==null&&l!==void 0&&l.live){if(b.fragments[0]||(b.deltaUpdateFailed=!0),b.deltaUpdateFailed)return;K=this.alignPlaylists(b,W.details)}if(W.details=b,this.levelLastLoaded=g,this.hls.trigger(Y.Events.LEVEL_UPDATED,{details:b,level:g}),this.state===H.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(b))return;this.state=H.State.IDLE}this.startFragRequested?b.live&&this.synchronizeToLiveEdge(b):this.setStartPosition(b,K),this.tick()},O._handleFragmentLoadProgress=function(y){var d,l=y.frag,h=y.part,g=y.payload,b=this.levels;if(!b){this.warn("Levels were reset while fragment load was in progress. Fragment "+l.sn+" of level "+l.level+" will not be buffered");return}var F=b[l.level],N=F.details;if(!N){this.warn("Dropping fragment "+l.sn+" of level "+l.level+" after level details were reset");return}var W=F.videoCodec,K=N.PTSKnown||!N.live,I=(d=l.initSegment)===null||d===void 0?void 0:d.data,x=this._getAudioCodec(F),j=this.transmuxer=this.transmuxer||new _.default(this.hls,D.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),$=h?h.index:-1,ae=$!==-1,fe=new p.ChunkMetadata(l.level,l.sn,l.stats.chunkCount,g.byteLength,$,ae),pe=this.initPTS[l.cc];j.push(g,I,x,W,l,h,N.totalduration,K,fe,pe)},O.onAudioTrackSwitching=function(y,d){var l=this.altAudio,h=!!d.url,g=d.id;if(!h){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var b=this.fragCurrent;b!=null&&b.loader&&(this.log("Switching to main audio track, cancel main fragment load"),b.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var F=this.hls;l&&F.trigger(Y.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),F.trigger(Y.Events.AUDIO_TRACK_SWITCHED,{id:g})}},O.onAudioTrackSwitched=function(y,d){var l=d.id,h=!!this.hls.audioTracks[l].url;if(h){var g=this.videoBuffer;g&&this.mediaBuffer!==g&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=g)}this.altAudio=h,this.tick()},O.onBufferCreated=function(y,d){var l=d.tracks,h,g,b=!1;for(var F in l){var N=l[F];if(N.id==="main"){if(g=F,h=N,F==="video"){var W=l[F];W&&(this.videoBuffer=W.buffer)}}else b=!0}b&&h?(this.log("Alternate track found, use "+g+".buffered to schedule main fragment loading"),this.mediaBuffer=h.buffer):this.mediaBuffer=this.media},O.onFragBuffered=function(y,d){var l=d.frag,h=d.part;if(l&&l.type!==D.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(l)){this.warn("Fragment "+l.sn+(h?" p: "+h.index:"")+" of level "+l.level+" finished buffering, but was aborted. state: "+this.state),this.state===H.State.PARSED&&(this.state=H.State.IDLE);return}var g=h?h.stats:l.stats;this.fragLastKbps=Math.round(8*g.total/(g.buffering.end-g.loading.first)),l.sn!=="initSegment"&&(this.fragPrevious=l),this.fragBufferedComplete(l,h)},O.onError=function(y,d){switch(d.details){case u.ErrorDetails.FRAG_LOAD_ERROR:case u.ErrorDetails.FRAG_LOAD_TIMEOUT:case u.ErrorDetails.KEY_LOAD_ERROR:case u.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(D.PlaylistLevelType.MAIN,d);break;case u.ErrorDetails.LEVEL_LOAD_ERROR:case u.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==H.State.ERROR&&(d.fatal?(this.warn(""+d.details),this.state=H.State.ERROR):!d.levelRetry&&this.state===H.State.WAITING_LEVEL&&(this.state=H.State.IDLE));break;case u.ErrorDetails.BUFFER_FULL_ERROR:if(d.parent==="main"&&(this.state===H.State.PARSING||this.state===H.State.PARSED)){var l=!0,h=this.getFwdBufferInfo(this.media,D.PlaylistLevelType.MAIN);h&&h.len>.5&&(l=!this.reduceMaxBufferLength(h.len)),l&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},O.checkBuffer=function(){var y=this.media,d=this.gapController;if(!y||!d||!y.readyState)return;var l=X.BufferHelper.getBuffered(y);!this.loadedmetadata&&l.length?(this.loadedmetadata=!0,this.seekToStartPos()):d.poll(this.lastCurrentTime),this.lastCurrentTime=y.currentTime},O.onFragLoadEmergencyAborted=function(){this.state=H.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},O.onBufferFlushed=function(y,d){var l=d.type;if(l!==v.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var h=(l===v.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(h,l,D.PlaylistLevelType.MAIN)}},O.onLevelsUpdated=function(y,d){this.levels=d.levels},O.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},O.seekToStartPos=function(){var y=this.media,d=y.currentTime,l=this.startPosition;if(l>=0&&d<l){if(y.seeking){r.logger.log("could not seek to "+l+", already seeking at "+d);return}var h=X.BufferHelper.getBuffered(y),g=h.length?h.start(0):0,b=g-l;b>0&&(b<this.config.maxBufferHole||b<this.config.maxFragLookUpTolerance)&&(r.logger.log("adjusting start position by "+b+" to match buffer start"),l+=b,this.startPosition=l),this.log("seek to target start position "+l+" from current time "+d),y.currentTime=l}},O._getAudioCodec=function(y){var d=this.config.defaultAudioCodec||y.audioCodec;return this.audioCodecSwap&&d&&(this.log("Swapping audio codec"),d.indexOf("mp4a.40.5")!==-1?d="mp4a.40.2":d="mp4a.40.5"),d},O._loadBitrateTestFrag=function(y){var d=this;this._doFragLoad(y).then(function(l){var h=d.hls;if(!l||h.nextLoadLevel||d.fragContextChanged(y))return;d.fragLoadError=0,d.state=H.State.IDLE,d.startFragRequested=!1,d.bitrateTest=!1;var g=y.stats;g.parsing.start=g.parsing.end=g.buffering.start=g.buffering.end=self.performance.now(),h.trigger(Y.Events.FRAG_LOADED,l)})},O._handleTransmuxComplete=function(y){var d,l="main",h=this.hls,g=y.remuxResult,b=y.chunkMeta,F=this.getCurrentContext(b);if(!F){this.warn("The loading context changed while buffering fragment "+b.sn+" of level "+b.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(b.level);return}var N=F.frag,W=F.part,K=F.level,I=g.video,x=g.text,j=g.id3,$=g.initSegment,ae=this.altAudio?void 0:g.audio;if(this.fragContextChanged(N))return;if(this.state=H.State.PARSING,$){$.tracks&&(this._bufferInitSegment(K,$.tracks,N,b),h.trigger(Y.Events.FRAG_PARSING_INIT_SEGMENT,{frag:N,id:l,tracks:$.tracks}));var fe=$.initPTS,pe=$.timescale;Object(ee.isFiniteNumber)(fe)&&(this.initPTS[N.cc]=fe,h.trigger(Y.Events.INIT_PTS_FOUND,{frag:N,id:l,initPTS:fe,timescale:pe}))}if(I&&g.independent!==!1){if(K.details){var Ce=I.startPTS,De=I.endPTS,xe=I.startDTS,Oe=I.endDTS;if(W)W.elementaryStreams[I.type]={startPTS:Ce,endPTS:De,startDTS:xe,endDTS:Oe};else if(I.firstKeyFrame&&I.independent&&(this.couldBacktrack=!0),I.dropped&&I.independent){var Ee=this.getLoadPosition()+this.config.maxBufferHole;if(Ee<Ce){this.backtrack(N);return}N.setElementaryStreamInfo(I.type,N.start,De,N.start,Oe,!0)}N.setElementaryStreamInfo(I.type,Ce,De,xe,Oe),this.bufferFragmentData(I,N,W,b)}}else if(g.independent===!1){this.backtrack(N);return}if(ae){var be=ae.startPTS,te=ae.endPTS,me=ae.startDTS,ye=ae.endDTS;W&&(W.elementaryStreams[v.ElementaryStreamTypes.AUDIO]={startPTS:be,endPTS:te,startDTS:me,endDTS:ye}),N.setElementaryStreamInfo(v.ElementaryStreamTypes.AUDIO,be,te,me,ye),this.bufferFragmentData(ae,N,W,b)}if(j!=null&&(d=j.samples)!==null&&d!==void 0&&d.length){var Le={frag:N,id:l,samples:j.samples};h.trigger(Y.Events.FRAG_PARSING_METADATA,Le)}if(x){var $e={frag:N,id:l,samples:x.samples};h.trigger(Y.Events.FRAG_PARSING_USERDATA,$e)}},O._bufferInitSegment=function(y,d,l,h){var g=this;if(this.state!==H.State.PARSING)return;this.audioOnly=!!d.audio&&!d.video,this.altAudio&&!this.audioOnly&&delete d.audio;var b=d.audio,F=d.video,N=d.audiovideo;if(b){var W=y.audioCodec,K=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(W&&(W.indexOf("mp4a.40.5")!==-1?W="mp4a.40.2":W="mp4a.40.5"),b.metadata.channelCount!==1&&K.indexOf("firefox")===-1&&(W="mp4a.40.5")),K.indexOf("android")!==-1&&b.container!=="audio/mpeg"&&(W="mp4a.40.2",this.log("Android: force audio codec to "+W)),y.audioCodec&&y.audioCodec!==W&&this.log('Swapping manifest audio codec "'+y.audioCodec+'" for "'+W+'"'),b.levelCodec=W,b.id="main",this.log("Init audio buffer, container:"+b.container+", codecs[selected/level/parsed]=["+(W||"")+"/"+(y.audioCodec||"")+"/"+b.codec+"]")}F&&(F.levelCodec=y.videoCodec,F.id="main",this.log("Init video buffer, container:"+F.container+", codecs[level/parsed]=["+(y.videoCodec||"")+"/"+F.codec+"]")),N&&this.log("Init audiovideo buffer, container:"+N.container+", codecs[level/parsed]=["+(y.attrs.CODECS||"")+"/"+N.codec+"]"),this.hls.trigger(Y.Events.BUFFER_CODECS,d),Object.keys(d).forEach(function(I){var x=d[I],j=x.initSegment;j!=null&&j.byteLength&&g.hls.trigger(Y.Events.BUFFER_APPENDING,{type:I,data:j,frag:l,part:null,chunkMeta:h,parent:l.type})}),this.tick()},O.backtrack=function(y){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(y);var d=this.fragmentTracker.backtrack(y);this.fragPrevious=null,this.nextLoadPosition=y.start,d?this.resetFragmentLoading(y):this.state=H.State.BACKTRACKING},O.checkFragmentChanged=function(){var y=this.media,d=null;if(y&&y.readyState>1&&y.seeking===!1){var l=y.currentTime;if(X.BufferHelper.isBuffered(y,l)?d=this.getAppendedFrag(l):X.BufferHelper.isBuffered(y,l+.1)&&(d=this.getAppendedFrag(l+.1)),d){var h=this.fragPlaying,g=d.level;(!h||d.sn!==h.sn||h.level!==g||d.urlId!==h.urlId)&&(this.hls.trigger(Y.Events.FRAG_CHANGED,{frag:d}),(!h||h.level!==g)&&this.hls.trigger(Y.Events.LEVEL_SWITCHED,{level:g}),this.fragPlaying=d)}}},t(R,[{key:"nextLevel",get:function(){var y=this.nextBufferedFrag;return y?y.level:-1}},{key:"currentLevel",get:function(){var y=this.media;if(y){var d=this.getAppendedFrag(y.currentTime);if(d)return d.level}return-1}},{key:"nextBufferedFrag",get:function(){var y=this.media;if(y){var d=this.getAppendedFrag(y.currentTime);return this.followingBufferedFrag(d)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),R}(H.default)},"./src/controller/subtitle-stream-controller.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"SubtitleStreamController",function(){return c});var ee=U("./src/events.ts"),H=U("./src/utils/logger.ts"),M=U("./src/utils/buffer-helper.ts"),Y=U("./src/controller/fragment-finders.ts"),X=U("./src/utils/discontinuities.ts"),k=U("./src/controller/level-helper.ts"),D=U("./src/controller/fragment-tracker.ts"),v=U("./src/controller/base-stream-controller.ts"),_=U("./src/types/loader.ts"),p=U("./src/types/level.ts");function o(f,A){for(var S=0;S<A.length;S++){var w=A[S];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(f,w.key,w)}}function u(f,A,S){return A&&o(f.prototype,A),S&&o(f,S),f}function r(f,A){f.prototype=Object.create(A.prototype),f.prototype.constructor=f,i(f,A)}function i(f,A){return i=Object.setPrototypeOf||function(w,R){return w.__proto__=R,w},i(f,A)}var t=500,c=function(f){r(A,f);function A(w,R){var O;return O=f.call(this,w,R,"[subtitle-stream-controller]")||this,O.levels=[],O.currentTrackId=-1,O.tracksBuffered=[],O.mainDetails=null,O._registerListeners(),O}var S=A.prototype;return S.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},S._registerListeners=function(){var R=this.hls;R.on(ee.Events.MEDIA_ATTACHED,this.onMediaAttached,this),R.on(ee.Events.MEDIA_DETACHING,this.onMediaDetaching,this),R.on(ee.Events.MANIFEST_LOADING,this.onManifestLoading,this),R.on(ee.Events.LEVEL_LOADED,this.onLevelLoaded,this),R.on(ee.Events.ERROR,this.onError,this),R.on(ee.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),R.on(ee.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),R.on(ee.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),R.on(ee.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),R.on(ee.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},S._unregisterListeners=function(){var R=this.hls;R.off(ee.Events.MEDIA_ATTACHED,this.onMediaAttached,this),R.off(ee.Events.MEDIA_DETACHING,this.onMediaDetaching,this),R.off(ee.Events.MANIFEST_LOADING,this.onManifestLoading,this),R.off(ee.Events.LEVEL_LOADED,this.onLevelLoaded,this),R.off(ee.Events.ERROR,this.onError,this),R.off(ee.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),R.off(ee.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),R.off(ee.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),R.off(ee.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),R.off(ee.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},S.startLoad=function(){this.stopLoad(),this.state=v.State.IDLE,this.setInterval(t),this.tick()},S.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},S.onLevelLoaded=function(R,O){this.mainDetails=O.details},S.onSubtitleFragProcessed=function(R,O){var E=O.frag,y=O.success;if(this.fragPrevious=E,this.state=v.State.IDLE,!y)return;var d=this.tracksBuffered[this.currentTrackId];if(!d)return;for(var l,h=E.start,g=0;g<d.length;g++)if(h>=d[g].start&&h<=d[g].end){l=d[g];break}var b=E.start+E.duration;l?l.end=b:(l={start:h,end:b},d.push(l)),this.fragmentTracker.fragBuffered(E)},S.onBufferFlushing=function(R,O){var E=O.startOffset,y=O.endOffset;if(E===0&&y!==Number.POSITIVE_INFINITY){var d=this.currentTrackId,l=this.levels;if(!l.length||!l[d]||!l[d].details)return;var h=l[d].details,g=h.targetduration,b=y-g;if(b<=0)return;O.endOffsetSubtitles=Math.max(0,b),this.tracksBuffered.forEach(function(F){for(var N=0;N<F.length;){if(F[N].end<=b){F.shift();continue}else if(F[N].start<b)F[N].start=b;else break;N++}}),this.fragmentTracker.removeFragmentsInRange(E,b,_.PlaylistLevelType.SUBTITLE)}},S.onError=function(R,O){var E,y=O.frag;if(!y||y.type!==_.PlaylistLevelType.SUBTITLE)return;(E=this.fragCurrent)!==null&&E!==void 0&&E.loader&&this.fragCurrent.loader.abort(),this.state=v.State.IDLE},S.onSubtitleTracksUpdated=function(R,O){var E=this,y=O.subtitleTracks;this.tracksBuffered=[],this.levels=y.map(function(d){return new p.Level(d)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(d){E.tracksBuffered[d.id]=[]}),this.mediaBuffer=null},S.onSubtitleTrackSwitch=function(R,O){if(this.currentTrackId=O.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var E=this.levels[this.currentTrackId];E!=null&&E.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,E&&this.setInterval(t)},S.onSubtitleTrackLoaded=function(R,O){var E,y=O.details,d=O.id,l=this.currentTrackId,h=this.levels;if(!h.length)return;var g=h[l];if(d>=h.length||d!==l||!g)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,y.live||(E=g.details)!==null&&E!==void 0&&E.live){var b=this.mainDetails;if(y.deltaUpdateFailed||!b)return;var F=b.fragments[0];if(!g.details)y.hasProgramDateTime&&b.hasProgramDateTime?Object(X.alignMediaPlaylistByPDT)(y,b):F&&Object(k.addSliding)(y,F.start);else{var N=this.alignPlaylists(y,g.details);N===0&&F&&Object(k.addSliding)(y,F.start)}}if(g.details=y,this.levelLastLoaded=d,this.tick(),y.live&&!this.fragCurrent&&this.media&&this.state===v.State.IDLE){var W=Object(Y.findFragmentByPTS)(null,y.fragments,this.media.currentTime,0);W||(this.warn("Subtitle playlist not aligned with playback"),g.details=void 0)}},S._handleFragmentLoadComplete=function(R){var O=R.frag,E=R.payload,y=O.decryptdata,d=this.hls;if(this.fragContextChanged(O))return;if(E&&E.byteLength>0&&y&&y.key&&y.iv&&y.method==="AES-128"){var l=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(E),y.key.buffer,y.iv.buffer).then(function(h){var g=performance.now();d.trigger(ee.Events.FRAG_DECRYPTED,{frag:O,payload:h,stats:{tstart:l,tdecrypt:g}})})}},S.doTick=function(){if(!this.media){this.state=v.State.IDLE;return}if(this.state===v.State.IDLE){var R,O=this.currentTrackId,E=this.levels;if(!E.length||!E[O]||!E[O].details)return;var y=E[O].details,d=y.targetduration,l=this.config,h=this.media,g=M.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,h.currentTime-d,l.maxBufferHole),b=g.end,F=g.len,N=this.getMaxBufferLength()+d;if(F>N)return;console.assert(y,"Subtitle track details are defined on idle subtitle stream controller tick");var W=y.fragments,K=W.length,I=y.edge,x,j=this.fragPrevious;if(b<I){var $=l.maxFragLookUpTolerance;j&&y.hasProgramDateTime&&(x=Object(Y.findFragmentByPDT)(W,j.endProgramDateTime,$)),x||(x=Object(Y.findFragmentByPTS)(j,W,b,$),!x&&j&&j.start<W[0].start&&(x=W[0]))}else x=W[K-1];(R=x)!==null&&R!==void 0&&R.encrypted?(H.logger.log("Loading key for "+x.sn),this.state=v.State.KEY_LOADING,this.hls.trigger(ee.Events.KEY_LOADING,{frag:x})):x&&this.fragmentTracker.getState(x)===D.FragmentState.NOT_LOADED&&this.loadFragment(x,y,b)}},S.loadFragment=function(R,O,E){this.fragCurrent=R,f.prototype.loadFragment.call(this,R,O,E)},u(A,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),A}(v.default)},"./src/controller/subtitle-track-controller.ts":function(ie,Z,U){"use strict";U.r(Z);var ee=U("./src/events.ts"),H=U("./src/utils/texttrack-utils.ts"),M=U("./src/controller/base-playlist-controller.ts"),Y=U("./src/types/loader.ts");function X(o,u){for(var r=0;r<u.length;r++){var i=u[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(o,i.key,i)}}function k(o,u,r){return u&&X(o.prototype,u),r&&X(o,r),o}function D(o,u){o.prototype=Object.create(u.prototype),o.prototype.constructor=o,v(o,u)}function v(o,u){return v=Object.setPrototypeOf||function(i,t){return i.__proto__=t,i},v(o,u)}var _=function(o){D(u,o);function u(i){var t;return t=o.call(this,i,"[subtitle-track-controller]")||this,t.media=null,t.tracks=[],t.groupId=null,t.tracksInGroup=[],t.trackId=-1,t.selectDefaultTrack=!0,t.queuedDefaultTrack=-1,t.trackChangeListener=function(){return t.onTextTracksChanged()},t.asyncPollTrackChange=function(){return t.pollTrackChange(0)},t.useTextTrackPolling=!1,t.subtitlePollingInterval=-1,t.subtitleDisplay=!0,t.registerListeners(),t}var r=u.prototype;return r.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,o.prototype.destroy.call(this)},r.registerListeners=function(){var t=this.hls;t.on(ee.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(ee.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(ee.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(ee.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.on(ee.Events.LEVEL_LOADING,this.onLevelLoading,this),t.on(ee.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(ee.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(ee.Events.ERROR,this.onError,this)},r.unregisterListeners=function(){var t=this.hls;t.off(ee.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(ee.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(ee.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(ee.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.off(ee.Events.LEVEL_LOADING,this.onLevelLoading,this),t.off(ee.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(ee.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(ee.Events.ERROR,this.onError,this)},r.onMediaAttached=function(t,c){if(this.media=c.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},r.pollTrackChange=function(t){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,t)},r.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var t=p(this.media.textTracks);t.forEach(function(c){Object(H.clearCurrentCues)(c)}),this.subtitleTrack=-1,this.media=null},r.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},r.onManifestParsed=function(t,c){this.tracks=c.subtitleTracks},r.onSubtitleTrackLoaded=function(t,c){var f=c.id,A=c.details,S=this.trackId,w=this.tracksInGroup[S];if(!w){this.warn("Invalid subtitle track id "+f);return}var R=w.details;w.details=c.details,this.log("subtitle track "+f+" loaded ["+A.startSN+"-"+A.endSN+"]"),f===this.trackId&&(this.retryCount=0,this.playlistLoaded(f,c,R))},r.onLevelLoading=function(t,c){this.switchLevel(c.level)},r.onLevelSwitching=function(t,c){this.switchLevel(c.level)},r.switchLevel=function(t){var c=this.hls.levels[t];if(!(c!=null&&c.textGroupIds))return;var f=c.textGroupIds[c.urlId];if(this.groupId!==f){var A=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,S=this.tracks.filter(function(O){return!f||O.groupId===f});this.tracksInGroup=S;var w=this.findTrackId(A==null?void 0:A.name)||this.findTrackId();this.groupId=f;var R={subtitleTracks:S};this.log("Updating subtitle tracks, "+S.length+' track(s) found in "'+f+'" group-id'),this.hls.trigger(ee.Events.SUBTITLE_TRACKS_UPDATED,R),w!==-1&&this.setSubtitleTrack(w,A)}},r.findTrackId=function(t){for(var c=this.tracksInGroup,f=0;f<c.length;f++){var A=c[f];if((!this.selectDefaultTrack||A.default)&&(!t||t===A.name))return A.id}return-1},r.onError=function(t,c){if(o.prototype.onError.call(this,t,c),c.fatal||!c.context)return;c.context.type===Y.PlaylistContextType.SUBTITLE_TRACK&&c.context.id===this.trackId&&c.context.groupId===this.groupId&&this.retryLoadingOrFail(c)},r.loadPlaylist=function(t){var c=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(c)){var f=c.id,A=c.groupId,S=c.url;if(t)try{S=t.addDirectives(S)}catch(w){this.warn("Could not construct new URL with HLS Delivery Directives: "+w)}this.log("Loading subtitle playlist for id "+f),this.hls.trigger(ee.Events.SUBTITLE_TRACK_LOADING,{url:S,id:f,groupId:A,deliveryDirectives:t||null})}},r.toggleTrackModes=function(t){var c=this,f=this.media,A=this.subtitleDisplay,S=this.trackId;if(!f)return;var w=p(f.textTracks),R=w.filter(function(y){return y.groupId===c.groupId});if(t===-1)[].slice.call(w).forEach(function(y){y.mode="disabled"});else{var O=R[S];O&&(O.mode="disabled")}var E=R[t];E&&(E.mode=A?"showing":"hidden")},r.setSubtitleTrack=function(t,c){var f,A=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=t;return}if(this.trackId!==t&&this.toggleTrackModes(t),this.trackId===t&&(t===-1||(f=A[t])!==null&&f!==void 0&&f.details)||t<-1||t>=A.length)return;this.clearTimer();var S=A[t];if(this.log("Switching to subtitle track "+t),this.trackId=t,S){var w=S.id,R=S.groupId,O=R===void 0?"":R,E=S.name,y=S.type,d=S.url;this.hls.trigger(ee.Events.SUBTITLE_TRACK_SWITCH,{id:w,groupId:O,name:E,type:y,url:d});var l=this.switchParams(S.url,c==null?void 0:c.details);this.loadPlaylist(l)}else this.hls.trigger(ee.Events.SUBTITLE_TRACK_SWITCH,{id:t})},r.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var t=-1,c=p(this.media.textTracks),f=0;f<c.length;f++)if(c[f].mode==="hidden")t=f;else if(c[f].mode==="showing"){t=f;break}this.subtitleTrack!==t&&(this.subtitleTrack=t)},k(u,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(t){this.selectDefaultTrack=!1;var c=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(t,c)}}]),u}(M.default);function p(o){for(var u=[],r=0;r<o.length;r++){var i=o[r];i.kind==="subtitles"&&i.label&&u.push(o[r])}return u}Z.default=_},"./src/controller/timeline-controller.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"TimelineController",function(){return p});var ee=U("./src/polyfills/number.ts"),H=U("./src/events.ts"),M=U("./src/utils/cea-608-parser.ts"),Y=U("./src/utils/output-filter.ts"),X=U("./src/utils/webvtt-parser.ts"),k=U("./src/utils/texttrack-utils.ts"),D=U("./src/utils/imsc1-ttml-parser.ts"),v=U("./src/types/loader.ts"),_=U("./src/utils/logger.ts"),p=function(){function i(c){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=r(),this.captionsProperties=void 0,this.hls=c,this.config=c.config,this.Cues=c.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var f=new Y.default(this,"textTrack1"),A=new Y.default(this,"textTrack2"),S=new Y.default(this,"textTrack3"),w=new Y.default(this,"textTrack4");this.cea608Parser1=new M.default(1,f,A),this.cea608Parser2=new M.default(3,S,w)}c.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),c.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(H.Events.MANIFEST_LOADED,this.onManifestLoaded,this),c.on(H.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),c.on(H.Events.FRAG_LOADING,this.onFragLoading,this),c.on(H.Events.FRAG_LOADED,this.onFragLoaded,this),c.on(H.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),c.on(H.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),c.on(H.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),c.on(H.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),c.on(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var t=i.prototype;return t.destroy=function(){var f=this.hls;f.off(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),f.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.off(H.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.off(H.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),f.off(H.Events.FRAG_LOADING,this.onFragLoading,this),f.off(H.Events.FRAG_LOADED,this.onFragLoaded,this),f.off(H.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),f.off(H.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),f.off(H.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),f.off(H.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),f.off(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},t.addCues=function(f,A,S,w,R){for(var O=!1,E=R.length;E--;){var y=R[E],d=u(y[0],y[1],A,S);if(d>=0&&(y[0]=Math.min(y[0],A),y[1]=Math.max(y[1],S),O=!0,d/(S-A)>.5))return}if(O||R.push([A,S]),this.config.renderTextTracksNatively){var l=this.captionsTracks[f];this.Cues.newCue(l,A,S,w)}else{var h=this.Cues.newCue(null,A,S,w);this.hls.trigger(H.Events.CUES_PARSED,{type:"captions",cues:h,track:f})}},t.onInitPtsFound=function(f,A){var S=this,w=A.frag,R=A.id,O=A.initPTS,E=A.timescale,y=this.unparsedVttFrags;R==="main"&&(this.initPTS[w.cc]=O,this.timescale[w.cc]=E),y.length&&(this.unparsedVttFrags=[],y.forEach(function(d){S.onFragLoaded(H.Events.FRAG_LOADED,d)}))},t.getExistingTrack=function(f){var A=this.media;if(A)for(var S=0;S<A.textTracks.length;S++){var w=A.textTracks[S];if(w[f])return w}return null},t.createCaptionsTrack=function(f){this.config.renderTextTracksNatively?this.createNativeTrack(f):this.createNonNativeTrack(f)},t.createNativeTrack=function(f){if(this.captionsTracks[f])return;var A=this.captionsProperties,S=this.captionsTracks,w=this.media,R=A[f],O=R.label,E=R.languageCode,y=this.getExistingTrack(f);if(y)S[f]=y,Object(k.clearCurrentCues)(S[f]),Object(k.sendAddTrackEvent)(S[f],w);else{var d=this.createTextTrack("captions",O,E);d&&(d[f]=!0,S[f]=d)}},t.createNonNativeTrack=function(f){if(this.nonNativeCaptionsTracks[f])return;var A=this.captionsProperties[f];if(!A)return;var S=A.label,w={_id:f,label:S,kind:"captions",default:A.media?!!A.media.default:!1,closedCaptions:A.media};this.nonNativeCaptionsTracks[f]=w,this.hls.trigger(H.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[w]})},t.createTextTrack=function(f,A,S){var w=this.media;return w?w.addTextTrack(f,A,S):void 0},t.onMediaAttaching=function(f,A){this.media=A.media,this._cleanTracks()},t.onMediaDetaching=function(){var f=this.captionsTracks;Object.keys(f).forEach(function(A){Object(k.clearCurrentCues)(f[A]),delete f[A]}),this.nonNativeCaptionsTracks={}},t.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=r(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},t._cleanTracks=function(){var f=this.media;if(!f)return;var A=f.textTracks;if(A)for(var S=0;S<A.length;S++)Object(k.clearCurrentCues)(A[S])},t.onSubtitleTracksUpdated=function(f,A){var S=this;this.textTracks=[];var w=A.subtitleTracks||[],R=w.some(function(d){return d.textCodec===D.IMSC1_CODEC});if(this.config.enableWebVTT||R&&this.config.enableIMSC1){var O=this.tracks&&w&&this.tracks.length===w.length;if(this.tracks=w||[],this.config.renderTextTracksNatively){var E=this.media?this.media.textTracks:[];this.tracks.forEach(function(d,l){var h;if(l<E.length){for(var g=null,b=0;b<E.length;b++)if(o(E[b],d)){g=E[b];break}g&&(h=g)}h?Object(k.clearCurrentCues)(h):(h=S.createTextTrack("subtitles",d.name,d.lang),h&&(h.mode="disabled")),h&&(h.groupId=d.groupId,S.textTracks.push(h))})}else if(!O&&this.tracks&&this.tracks.length){var y=this.tracks.map(function(d){return{label:d.name,kind:d.type.toLowerCase(),default:d.default,subtitleTrack:d}});this.hls.trigger(H.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:y})}}},t.onManifestLoaded=function(f,A){var S=this;this.config.enableCEA708Captions&&A.captions&&A.captions.forEach(function(w){var R=/(?:CC|SERVICE)([1-4])/.exec(w.instreamId);if(!R)return;var O="textTrack"+R[1],E=S.captionsProperties[O];if(!E)return;E.label=w.name,w.lang&&(E.languageCode=w.lang),E.media=w})},t.onFragLoading=function(f,A){var S=this.cea608Parser1,w=this.cea608Parser2,R=this.lastSn,O=this.lastPartIndex;if(!this.enabled||!(S&&w))return;if(A.frag.type===v.PlaylistLevelType.MAIN){var E,y,d=A.frag.sn,l=(E=A==null||((y=A.part)===null||y===void 0)?void 0:y.index)!=null?E:-1;d===R+1||d===R&&l===O+1||(S.reset(),w.reset()),this.lastSn=d,this.lastPartIndex=l}},t.onFragLoaded=function(f,A){var S=A.frag,w=A.payload,R=this.initPTS,O=this.unparsedVttFrags;if(S.type===v.PlaylistLevelType.SUBTITLE)if(w.byteLength){if(!Object(ee.isFiniteNumber)(R[S.cc])){O.push(A),R.length&&this.hls.trigger(H.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:S,error:new Error("Missing initial subtitle PTS")});return}var E=S.decryptdata;if(E==null||E.key==null||E.method!=="AES-128"){var y=this.tracks[S.level],d=this.vttCCs;d[S.cc]||(d[S.cc]={start:S.start,prevCC:this.prevCC,new:!0},this.prevCC=S.cc),y&&y.textCodec===D.IMSC1_CODEC?this._parseIMSC1(S,w):this._parseVTTs(S,w,d)}}else this.hls.trigger(H.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:S,error:new Error("Empty subtitle payload")})},t._parseIMSC1=function(f,A){var S=this,w=this.hls;Object(D.parseIMSC1)(A,this.initPTS[f.cc],this.timescale[f.cc],function(R){S._appendCues(R,f.level),w.trigger(H.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:f})},function(R){_.logger.log("Failed to parse IMSC1: "+R),w.trigger(H.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:R})})},t._parseVTTs=function(f,A,S){var w=this,R=this.hls;Object(X.parseWebVTT)(A,this.initPTS[f.cc],this.timescale[f.cc],S,f.cc,f.start,function(O){w._appendCues(O,f.level),R.trigger(H.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:f})},function(O){w._fallbackToIMSC1(f,A),_.logger.log("Failed to parse VTT cue: "+O),R.trigger(H.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:O})})},t._fallbackToIMSC1=function(f,A){var S=this,w=this.tracks[f.level];w.textCodec||Object(D.parseIMSC1)(A,this.initPTS[f.cc],this.timescale[f.cc],function(){w.textCodec=D.IMSC1_CODEC,S._parseIMSC1(f,A)},function(){w.textCodec="wvtt"})},t._appendCues=function(f,A){var S=this.hls;if(this.config.renderTextTracksNatively){var w=this.textTracks[A];if(w.mode==="disabled")return;f.forEach(function(E){return Object(k.addCueToTrack)(w,E)})}else{var R=this.tracks[A],O=R.default?"default":"subtitles"+A;S.trigger(H.Events.CUES_PARSED,{type:"subtitles",cues:f,track:O})}},t.onFragDecrypted=function(f,A){var S=A.frag;if(S.type===v.PlaylistLevelType.SUBTITLE){if(!Object(ee.isFiniteNumber)(this.initPTS[S.cc])){this.unparsedVttFrags.push(A);return}this.onFragLoaded(H.Events.FRAG_LOADED,A)}},t.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},t.onFragParsingUserdata=function(f,A){var S=this.cea608Parser1,w=this.cea608Parser2;if(!this.enabled||!(S&&w))return;for(var R=0;R<A.samples.length;R++){var O=A.samples[R].bytes;if(O){var E=this.extractCea608Data(O);S.addData(A.samples[R].pts,E[0]),w.addData(A.samples[R].pts,E[1])}}},t.onBufferFlushing=function(f,A){var S=A.startOffset,w=A.endOffset,R=A.endOffsetSubtitles,O=A.type,E=this.media;if(!E||E.currentTime<w)return;if(!O||O==="video"){var y=this.captionsTracks;Object.keys(y).forEach(function(l){return Object(k.removeCuesInRange)(y[l],S,w)})}if(this.config.renderTextTracksNatively&&(S===0&&R!==void 0)){var d=this.textTracks;Object.keys(d).forEach(function(l){return Object(k.removeCuesInRange)(d[l],S,R)})}},t.extractCea608Data=function(f){for(var A=f[0]&31,S=2,w=[[],[]],R=0;R<A;R++){var O=f[S++],E=127&f[S++],y=127&f[S++],d=(4&O)!==0,l=3&O;if(E===0&&y===0)continue;d&&((l===0||l===1)&&(w[l].push(E),w[l].push(y)))}return w},i}();function o(i,t){return i&&i.label===t.name&&!(i.textTrack1||i.textTrack2)}function u(i,t,c,f){return Math.min(t,f)-Math.max(i,c)}function r(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"default",function(){return ee});var ee=function(){function H(Y,X){this.subtle=void 0,this.aesIV=void 0,this.subtle=Y,this.aesIV=X}var M=H.prototype;return M.decrypt=function(X,k){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},k,X)},H}()},"./src/crypt/aes-decryptor.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"removePadding",function(){return H}),U.d(Z,"default",function(){return M});var ee=U("./src/utils/typed-array.ts");function H(Y){var X=Y.byteLength,k=X&&new DataView(Y.buffer).getUint8(X-1);return k?Object(ee.sliceUint8)(Y,0,X-k):Y}var M=function(){function Y(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var X=Y.prototype;return X.uint8ArrayToUint32Array_=function(D){for(var v=new DataView(D),_=new Uint32Array(4),p=0;p<4;p++)_[p]=v.getUint32(p*4);return _},X.initTable=function(){var D=this.sBox,v=this.invSBox,_=this.subMix,p=_[0],o=_[1],u=_[2],r=_[3],i=this.invSubMix,t=i[0],c=i[1],f=i[2],A=i[3],S=new Uint32Array(256),w=0,R=0,O=0;for(O=0;O<256;O++)O<128?S[O]=O<<1:S[O]=O<<1^283;for(O=0;O<256;O++){var E=R^R<<1^R<<2^R<<3^R<<4;E=E>>>8^E&255^99,D[w]=E,v[E]=w;var y=S[w],d=S[y],l=S[d],h=S[E]*257^E*16843008;p[w]=h<<24|h>>>8,o[w]=h<<16|h>>>16,u[w]=h<<8|h>>>24,r[w]=h,h=l*16843009^d*65537^y*257^w*16843008,t[E]=h<<24|h>>>8,c[E]=h<<16|h>>>16,f[E]=h<<8|h>>>24,A[E]=h,w?(w=y^S[S[S[l^y]]],R^=S[S[R]]):w=R=1}},X.expandKey=function(D){for(var v=this.uint8ArrayToUint32Array_(D),_=!0,p=0;p<v.length&&_;)_=v[p]===this.key[p],p++;if(_)return;this.key=v;var o=this.keySize=v.length;if(o!==4&&o!==6&&o!==8)throw new Error("Invalid aes key size="+o);var u=this.ksRows=(o+6+1)*4,r,i,t=this.keySchedule=new Uint32Array(u),c=this.invKeySchedule=new Uint32Array(u),f=this.sBox,A=this.rcon,S=this.invSubMix,w=S[0],R=S[1],O=S[2],E=S[3],y,d;for(r=0;r<u;r++){if(r<o){y=t[r]=v[r];continue}d=y,r%o===0?(d=d<<8|d>>>24,d=f[d>>>24]<<24|f[d>>>16&255]<<16|f[d>>>8&255]<<8|f[d&255],d^=A[r/o|0]<<24):o>6&&r%o===4&&(d=f[d>>>24]<<24|f[d>>>16&255]<<16|f[d>>>8&255]<<8|f[d&255]),t[r]=y=(t[r-o]^d)>>>0}for(i=0;i<u;i++)r=u-i,i&3?d=t[r]:d=t[r-4],i<4||r<=4?c[i]=d:c[i]=w[f[d>>>24]]^R[f[d>>>16&255]]^O[f[d>>>8&255]]^E[f[d&255]],c[i]=c[i]>>>0},X.networkToHostOrderSwap=function(D){return D<<24|(D&65280)<<8|(D&16711680)>>8|D>>>24},X.decrypt=function(D,v,_){for(var p=this.keySize+6,o=this.invKeySchedule,u=this.invSBox,r=this.invSubMix,i=r[0],t=r[1],c=r[2],f=r[3],A=this.uint8ArrayToUint32Array_(_),S=A[0],w=A[1],R=A[2],O=A[3],E=new Int32Array(D),y=new Int32Array(E.length),d,l,h,g,b,F,N,W,K,I,x,j,$,ae,fe=this.networkToHostOrderSwap;v<E.length;){for(K=fe(E[v]),I=fe(E[v+1]),x=fe(E[v+2]),j=fe(E[v+3]),b=K^o[0],F=j^o[1],N=x^o[2],W=I^o[3],$=4,ae=1;ae<p;ae++)d=i[b>>>24]^t[F>>16&255]^c[N>>8&255]^f[W&255]^o[$],l=i[F>>>24]^t[N>>16&255]^c[W>>8&255]^f[b&255]^o[$+1],h=i[N>>>24]^t[W>>16&255]^c[b>>8&255]^f[F&255]^o[$+2],g=i[W>>>24]^t[b>>16&255]^c[F>>8&255]^f[N&255]^o[$+3],b=d,F=l,N=h,W=g,$=$+4;d=u[b>>>24]<<24^u[F>>16&255]<<16^u[N>>8&255]<<8^u[W&255]^o[$],l=u[F>>>24]<<24^u[N>>16&255]<<16^u[W>>8&255]<<8^u[b&255]^o[$+1],h=u[N>>>24]<<24^u[W>>16&255]<<16^u[b>>8&255]<<8^u[F&255]^o[$+2],g=u[W>>>24]<<24^u[b>>16&255]<<16^u[F>>8&255]<<8^u[N&255]^o[$+3],y[v]=fe(d^S),y[v+1]=fe(g^w),y[v+2]=fe(h^R),y[v+3]=fe(l^O),S=K,w=I,R=x,O=j,v=v+4}return y.buffer},Y}()},"./src/crypt/decrypter.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"default",function(){return v});var ee=U("./src/crypt/aes-crypto.ts"),H=U("./src/crypt/fast-aes-key.ts"),M=U("./src/crypt/aes-decryptor.ts"),Y=U("./src/utils/logger.ts"),X=U("./src/utils/mp4-tools.ts"),k=U("./src/utils/typed-array.ts"),D=16,v=function(){function _(o,u,r){var i=r===void 0?{}:r,t=i.removePKCS7Padding,c=t===void 0?!0:t;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=o,this.config=u,this.removePKCS7Padding=c,c)try{var f=self.crypto;f&&(this.subtle=f.subtle||f.webkitSubtle)}catch(A){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var p=_.prototype;return p.destroy=function(){this.observer=null},p.isSync=function(){return this.config.enableSoftwareAES},p.flush=function(){var u=this.currentResult;if(!u){this.reset();return}var r=new Uint8Array(u);return this.reset(),this.removePKCS7Padding?Object(M.removePadding)(r):r},p.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},p.decrypt=function(u,r,i,t){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(u),r,i);var c=this.flush();c&&t(c.buffer)}else this.webCryptoDecrypt(new Uint8Array(u),r,i).then(t)},p.softwareDecrypt=function(u,r,i){var t=this.currentIV,c=this.currentResult,f=this.remainderData;this.logOnce("JS AES decrypt"),f&&(u=Object(X.appendUint8Array)(f,u),this.remainderData=null);var A=this.getValidChunk(u);if(!A.length)return null;t&&(i=t);var S=this.softwareDecrypter;S||(S=this.softwareDecrypter=new M.default),S.expandKey(r);var w=c;return this.currentResult=S.decrypt(A.buffer,0,i),this.currentIV=Object(k.sliceUint8)(A,-16).buffer,w||null},p.webCryptoDecrypt=function(u,r,i){var t=this,c=this.subtle;return(this.key!==r||!this.fastAesKey)&&(this.key=r,this.fastAesKey=new H.default(c,r)),this.fastAesKey.expandKey().then(function(f){if(!c)return Promise.reject(new Error("web crypto not initialized"));var A=new ee.default(c,i);return A.decrypt(u.buffer,f)}).catch(function(f){return t.onWebCryptoError(f,u,r,i)})},p.onWebCryptoError=function(u,r,i,t){return Y.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",u),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(r,i,t)},p.getValidChunk=function(u){var r=u,i=u.length-u.length%D;return i!==u.length&&(r=Object(k.sliceUint8)(u,0,i),this.remainderData=Object(k.sliceUint8)(u,i)),r},p.logOnce=function(u){if(!this.logEnabled)return;Y.logger.log("[decrypter.ts]: "+u),this.logEnabled=!1},_}()},"./src/crypt/fast-aes-key.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"default",function(){return ee});var ee=function(){function H(Y,X){this.subtle=void 0,this.key=void 0,this.subtle=Y,this.key=X}var M=H.prototype;return M.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},H}()},"./src/demux/aacdemuxer.ts":function(ie,Z,U){"use strict";U.r(Z);var ee=U("./src/demux/base-audio-demuxer.ts"),H=U("./src/demux/adts.ts"),M=U("./src/utils/logger.ts"),Y=U("./src/demux/id3.ts");function X(v,_){v.prototype=Object.create(_.prototype),v.prototype.constructor=v,k(v,_)}function k(v,_){return k=Object.setPrototypeOf||function(o,u){return o.__proto__=u,o},k(v,_)}var D=function(v){X(_,v);function _(o,u){var r;return r=v.call(this)||this,r.observer=void 0,r.config=void 0,r.observer=o,r.config=u,r}var p=_.prototype;return p.resetInitSegment=function(u,r,i){v.prototype.resetInitSegment.call(this,u,r,i),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:u,duration:i,inputTimeScale:9e4,dropped:0}},_.probe=function(u){if(!u)return!1;for(var r=Y.getID3Data(u,0)||[],i=r.length,t=u.length;i<t;i++)if(H.probe(u,i))return M.logger.log("ADTS sync word found !"),!0;return!1},p.canParse=function(u,r){return H.canParse(u,r)},p.appendFrame=function(u,r,i){H.initTrackConfig(u,this.observer,r,i,u.manifestCodec);var t=H.appendFrame(u,r,i,this.initPTS,this.frameIndex);if(t&&t.missing===0)return t},_}(ee.default);D.minProbeByteLength=9,Z.default=D},"./src/demux/adts.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"getAudioConfig",function(){return Y}),U.d(Z,"isHeaderPattern",function(){return X}),U.d(Z,"getHeaderLength",function(){return k}),U.d(Z,"getFullFrameLength",function(){return D}),U.d(Z,"canGetFrameLength",function(){return v}),U.d(Z,"isHeader",function(){return _}),U.d(Z,"canParse",function(){return p}),U.d(Z,"probe",function(){return o}),U.d(Z,"initTrackConfig",function(){return u}),U.d(Z,"getFrameDuration",function(){return r}),U.d(Z,"parseFrameHeader",function(){return i}),U.d(Z,"appendFrame",function(){return t});var ee=U("./src/utils/logger.ts"),H=U("./src/errors.ts"),M=U("./src/events.ts");function Y(c,f,A,S){var w,R,O,E,y=navigator.userAgent.toLowerCase(),d=S,l=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];w=((f[A+2]&192)>>>6)+1;var h=(f[A+2]&60)>>>2;if(h>l.length-1){c.trigger(M.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+h});return}return O=(f[A+2]&1)<<2,O|=(f[A+3]&192)>>>6,ee.logger.log("manifest codec:"+S+", ADTS type:"+w+", samplingIndex:"+h),/firefox/i.test(y)?h>=6?(w=5,E=new Array(4),R=h-3):(w=2,E=new Array(2),R=h):y.indexOf("android")!==-1?(w=2,E=new Array(2),R=h):(w=5,E=new Array(4),S&&(S.indexOf("mp4a.40.29")!==-1||S.indexOf("mp4a.40.5")!==-1)||!S&&h>=6?R=h-3:((S&&S.indexOf("mp4a.40.2")!==-1&&(h>=6&&O===1||/vivaldi/i.test(y))||!S&&O===1)&&(w=2,E=new Array(2)),R=h)),E[0]=w<<3,E[0]|=(h&14)>>1,E[1]|=(h&1)<<7,E[1]|=O<<3,w===5&&(E[1]|=(R&14)>>1,E[2]=(R&1)<<7,E[2]|=2<<2,E[3]=0),{config:E,samplerate:l[h],channelCount:O,codec:"mp4a.40."+w,manifestCodec:d}}function X(c,f){return c[f]===255&&(c[f+1]&246)===240}function k(c,f){return c[f+1]&1?7:9}function D(c,f){return(c[f+3]&3)<<11|c[f+4]<<3|(c[f+5]&224)>>>5}function v(c,f){return f+5<c.length}function _(c,f){return f+1<c.length&&X(c,f)}function p(c,f){return v(c,f)&&X(c,f)&&D(c,f)<=c.length-f}function o(c,f){if(_(c,f)){var A=k(c,f);if(f+A>=c.length)return!1;var S=D(c,f);if(S<=A)return!1;var w=f+S;return w===c.length||_(c,w)}return!1}function u(c,f,A,S,w){if(!c.samplerate){var R=Y(f,A,S,w);if(!R)return;c.config=R.config,c.samplerate=R.samplerate,c.channelCount=R.channelCount,c.codec=R.codec,c.manifestCodec=R.manifestCodec,ee.logger.log("parsed codec:"+c.codec+", rate:"+R.samplerate+", channels:"+R.channelCount)}}function r(c){return 1024*9e4/c}function i(c,f,A,S,w){var R=k(c,f),O=D(c,f);if(O-=R,O>0){var E=A+S*w;return{headerLength:R,frameLength:O,stamp:E}}}function t(c,f,A,S,w){var R=r(c.samplerate),O=i(f,A,S,w,R);if(O){var E=O.frameLength,y=O.headerLength,d=O.stamp,l=y+E,h=Math.max(0,A+l-f.length),g;h?(g=new Uint8Array(l-y),g.set(f.subarray(A+y,f.length),0)):g=f.subarray(A+y,A+l);var b={unit:g,pts:d};return h||c.samples.push(b),{sample:b,length:l,missing:h}}}},"./src/demux/base-audio-demuxer.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"initPTSFn",function(){return D});var ee=U("./src/polyfills/number.ts"),H=U("./src/demux/id3.ts"),M=U("./src/demux/dummy-demuxed-track.ts"),Y=U("./src/utils/mp4-tools.ts"),X=U("./src/utils/typed-array.ts"),k=function(){function v(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var _=v.prototype;return _.resetInitSegment=function(o,u,r){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},_.resetTimeStamp=function(){},_.resetContiguity=function(){},_.canParse=function(o,u){return!1},_.appendFrame=function(o,u,r){},_.demux=function(o,u){this.cachedData&&(o=Object(Y.appendUint8Array)(this.cachedData,o),this.cachedData=null);var r=H.getID3Data(o,0),i=r?r.length:0,t,c,f=this._audioTrack,A=this._id3Track,S=r?H.getTimeStamp(r):void 0,w=o.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=D(S,u)),r&&r.length>0&&A.samples.push({pts:this.initPTS,dts:this.initPTS,data:r}),c=this.initPTS;i<w;){if(this.canParse(o,i)){var R=this.appendFrame(f,o,i);R?(this.frameIndex++,c=R.sample.pts,i+=R.length,t=i):i=w}else H.canParse(o,i)?(r=H.getID3Data(o,i),A.samples.push({pts:c,dts:c,data:r}),i+=r.length,t=i):i++;if(i===w&&t!==w){var O=Object(X.sliceUint8)(o,t);this.cachedData?this.cachedData=Object(Y.appendUint8Array)(this.cachedData,O):this.cachedData=O}}return{audioTrack:f,avcTrack:Object(M.dummyTrack)(),id3Track:A,textTrack:Object(M.dummyTrack)()}},_.demuxSampleAes=function(o,u,r){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},_.flush=function(o){var u=this.cachedData;return u&&(this.cachedData=null,this.demux(u,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(M.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(M.dummyTrack)()}},_.destroy=function(){},v}(),D=function(_,p){return Object(ee.isFiniteNumber)(_)?_*90:p*9e4};Z.default=k},"./src/demux/chunk-cache.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"default",function(){return ee});var ee=function(){function M(){this.chunks=[],this.dataLength=0}var Y=M.prototype;return Y.push=function(k){this.chunks.push(k),this.dataLength+=k.length},Y.flush=function(){var k=this.chunks,D=this.dataLength,v;if(k.length)k.length===1?v=k[0]:v=H(k,D);else return new Uint8Array(0);return this.reset(),v},Y.reset=function(){this.chunks.length=0,this.dataLength=0},M}();function H(M,Y){for(var X=new Uint8Array(Y),k=0,D=0;D<M.length;D++){var v=M[D];X.set(v,k),k+=v.length}return X}},"./src/demux/dummy-demuxed-track.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"dummyTrack",function(){return ee});function ee(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ie,Z,U){"use strict";U.r(Z);var ee=U("./src/utils/logger.ts"),H=function(){function M(X){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=X,this.bytesAvailable=X.byteLength,this.word=0,this.bitsAvailable=0}var Y=M.prototype;return Y.loadWord=function(){var k=this.data,D=this.bytesAvailable,v=k.byteLength-D,_=new Uint8Array(4),p=Math.min(4,D);if(p===0)throw new Error("no bytes available");_.set(k.subarray(v,v+p)),this.word=new DataView(_.buffer).getUint32(0),this.bitsAvailable=p*8,this.bytesAvailable-=p},Y.skipBits=function(k){var D;this.bitsAvailable>k?(this.word<<=k,this.bitsAvailable-=k):(k-=this.bitsAvailable,D=k>>3,k-=D>>3,this.bytesAvailable-=D,this.loadWord(),this.word<<=k,this.bitsAvailable-=k)},Y.readBits=function(k){var D=Math.min(this.bitsAvailable,k),v=this.word>>>32-D;return k>32&&ee.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=D,this.bitsAvailable>0?this.word<<=D:this.bytesAvailable>0&&this.loadWord(),D=k-D,D>0&&this.bitsAvailable?v<<D|this.readBits(D):v},Y.skipLZ=function(){var k;for(k=0;k<this.bitsAvailable;++k)if((this.word&2147483648>>>k)!==0)return this.word<<=k,this.bitsAvailable-=k,k;return this.loadWord(),k+this.skipLZ()},Y.skipUEG=function(){this.skipBits(1+this.skipLZ())},Y.skipEG=function(){this.skipBits(1+this.skipLZ())},Y.readUEG=function(){var k=this.skipLZ();return this.readBits(k+1)-1},Y.readEG=function(){var k=this.readUEG();return 1&k?1+k>>>1:-1*(k>>>1)},Y.readBoolean=function(){return this.readBits(1)===1},Y.readUByte=function(){return this.readBits(8)},Y.readUShort=function(){return this.readBits(16)},Y.readUInt=function(){return this.readBits(32)},Y.skipScalingList=function(k){for(var D=8,v=8,_,p=0;p<k;p++)v!==0&&(_=this.readEG(),v=(D+_+256)%256),D=v===0?D:v},Y.readSPS=function(){var k=0,D=0,v=0,_=0,p,o,u,r=this.readUByte.bind(this),i=this.readBits.bind(this),t=this.readUEG.bind(this),c=this.readBoolean.bind(this),f=this.skipBits.bind(this),A=this.skipEG.bind(this),S=this.skipUEG.bind(this),w=this.skipScalingList.bind(this);r();var R=r();if(i(5),f(3),r(),S(),R===100||R===110||R===122||R===244||R===44||R===83||R===86||R===118||R===128){var O=t();if(O===3&&f(1),S(),S(),f(1),c())for(o=O!==3?8:12,u=0;u<o;u++)c()&&(u<6?w(16):w(64))}S();var E=t();if(E===0)t();else if(E===1)for(f(1),A(),A(),p=t(),u=0;u<p;u++)A();S(),f(1);var y=t(),d=t(),l=i(1);l===0&&f(1),f(1),c()&&(k=t(),D=t(),v=t(),_=t());var h=[1,1];if(c()&&c()){var g=r();switch(g){case 1:h=[1,1];break;case 2:h=[12,11];break;case 3:h=[10,11];break;case 4:h=[16,11];break;case 5:h=[40,33];break;case 6:h=[24,11];break;case 7:h=[20,11];break;case 8:h=[32,11];break;case 9:h=[80,33];break;case 10:h=[18,11];break;case 11:h=[15,11];break;case 12:h=[64,33];break;case 13:h=[160,99];break;case 14:h=[4,3];break;case 15:h=[3,2];break;case 16:h=[2,1];break;case 255:{h=[r()<<8|r(),r()<<8|r()];break}}}return{width:Math.ceil((y+1)*16-k*2-D*2),height:(2-l)*(d+1)*16-(l?2:4)*(v+_),pixelRatio:h}},Y.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},M}();Z.default=H},"./src/demux/id3.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"isHeader",function(){return ee}),U.d(Z,"isFooter",function(){return H}),U.d(Z,"getID3Data",function(){return M}),U.d(Z,"canParse",function(){return X}),U.d(Z,"getTimeStamp",function(){return k}),U.d(Z,"isTimeStampFrame",function(){return D}),U.d(Z,"getID3Frames",function(){return _}),U.d(Z,"decodeFrame",function(){return p}),U.d(Z,"utf8ArrayToStr",function(){return t}),U.d(Z,"testables",function(){return c});var ee=function(w,R){return R+10<=w.length&&(w[R]===73&&w[R+1]===68&&w[R+2]===51&&(w[R+3]<255&&w[R+4]<255&&(w[R+6]<128&&w[R+7]<128&&w[R+8]<128&&w[R+9]<128)))},H=function(w,R){return R+10<=w.length&&(w[R]===51&&w[R+1]===68&&w[R+2]===73&&(w[R+3]<255&&w[R+4]<255&&(w[R+6]<128&&w[R+7]<128&&w[R+8]<128&&w[R+9]<128)))},M=function(w,R){for(var O=R,E=0;ee(w,R);){E+=10;var y=Y(w,R+6);E+=y,H(w,R+10)&&(E+=10),R+=E}return E>0?w.subarray(O,O+E):void 0},Y=function(w,R){var O=0;return O=(w[R]&127)<<21,O|=(w[R+1]&127)<<14,O|=(w[R+2]&127)<<7,O|=w[R+3]&127,O},X=function(w,R){return ee(w,R)&&Y(w,R+6)+10<=w.length-R},k=function(w){for(var R=_(w),O=0;O<R.length;O++){var E=R[O];if(D(E))return i(E)}return},D=function(w){return w&&w.key==="PRIV"&&w.info==="com.apple.streaming.transportStreamTimestamp"},v=function(w){var R=String.fromCharCode(w[0],w[1],w[2],w[3]),O=Y(w,4),E=10;return{type:R,size:O,data:w.subarray(E,E+O)}},_=function(w){for(var R=0,O=[];ee(w,R);){var E=Y(w,R+6);R+=10;for(var y=R+E;R+8<y;){var d=v(w.subarray(R)),l=p(d);l&&O.push(l),R+=d.size+10}H(w,R)&&(R+=10)}return O},p=function(w){return w.type==="PRIV"?o(w):w.type[0]==="W"?r(w):u(w)},o=function(w){if(w.size<2)return;var R=t(w.data,!0),O=new Uint8Array(w.data.subarray(R.length+1));return{key:w.type,info:R,data:O.buffer}},u=function(w){if(w.size<2)return;if(w.type==="TXXX"){var R=1,O=t(w.data.subarray(R),!0);R+=O.length+1;var E=t(w.data.subarray(R));return{key:w.type,info:O,data:E}}var y=t(w.data.subarray(1));return{key:w.type,data:y}},r=function(w){if(w.type==="WXXX"){if(w.size<2)return;var R=1,O=t(w.data.subarray(R),!0);R+=O.length+1;var E=t(w.data.subarray(R));return{key:w.type,info:O,data:E}}var y=t(w.data);return{key:w.type,data:y}},i=function(w){if(w.data.byteLength===8){var R=new Uint8Array(w.data),O=R[3]&1,E=(R[4]<<23)+(R[5]<<15)+(R[6]<<7)+R[7];return E/=45,O&&(E+=4772185884e-2),Math.round(E)}return},t=function(w,R){R===void 0&&(R=!1);var O=A();if(O){var E=O.decode(w);if(R){var y=E.indexOf("\0");return y!==-1?E.substring(0,y):E}return E.replace(/\0/g,"")}for(var d=w.length,l,h,g,b="",F=0;F<d;){if(l=w[F++],l===0&&R)return b;if(l===0||l===3)continue;switch(l>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:b+=String.fromCharCode(l);break;case 12:case 13:h=w[F++],b+=String.fromCharCode((l&31)<<6|h&63);break;case 14:h=w[F++],g=w[F++],b+=String.fromCharCode((l&15)<<12|(h&63)<<6|(g&63)<<0);break;default:}}return b},c={decodeTextFrame:u},f;function A(){return!f&&typeof self.TextDecoder!="undefined"&&(f=new self.TextDecoder("utf-8")),f}},"./src/demux/mp3demuxer.ts":function(ie,Z,U){"use strict";U.r(Z);var ee=U("./src/demux/base-audio-demuxer.ts"),H=U("./src/demux/id3.ts"),M=U("./src/utils/logger.ts"),Y=U("./src/demux/mpegaudio.ts");function X(v,_){v.prototype=Object.create(_.prototype),v.prototype.constructor=v,k(v,_)}function k(v,_){return k=Object.setPrototypeOf||function(o,u){return o.__proto__=u,o},k(v,_)}var D=function(v){X(_,v);function _(){return v.apply(this,arguments)||this}var p=_.prototype;return p.resetInitSegment=function(u,r,i){v.prototype.resetInitSegment.call(this,u,r,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:u,duration:i,inputTimeScale:9e4,dropped:0}},_.probe=function(u){if(!u)return!1;for(var r=H.getID3Data(u,0)||[],i=r.length,t=u.length;i<t;i++)if(Y.probe(u,i))return M.logger.log("MPEG Audio sync word found !"),!0;return!1},p.canParse=function(u,r){return Y.canParse(u,r)},p.appendFrame=function(u,r,i){return this.initPTS===null?void 0:Y.appendFrame(u,r,i,this.initPTS,this.frameIndex)},_}(ee.default);D.minProbeByteLength=4,Z.default=D},"./src/demux/mp4demuxer.ts":function(ie,Z,U){"use strict";U.r(Z);var ee=U("./src/utils/mp4-tools.ts"),H=U("./src/demux/dummy-demuxed-track.ts"),M=function(){function Y(k,D){this.remainderData=null,this.config=void 0,this.config=D}var X=Y.prototype;return X.resetTimeStamp=function(){},X.resetInitSegment=function(){},X.resetContiguity=function(){},Y.probe=function(D){return Object(ee.findBox)({data:D,start:0,end:Math.min(D.length,16384)},["moof"]).length>0},X.demux=function(D){var v=D,_=Object(H.dummyTrack)();if(this.config.progressive){this.remainderData&&(v=Object(ee.appendUint8Array)(this.remainderData,D));var p=Object(ee.segmentValidRange)(v);this.remainderData=p.remainder,_.samples=p.valid||new Uint8Array}else _.samples=v;return{audioTrack:Object(H.dummyTrack)(),avcTrack:_,id3Track:Object(H.dummyTrack)(),textTrack:Object(H.dummyTrack)()}},X.flush=function(){var D=Object(H.dummyTrack)();return D.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(H.dummyTrack)(),avcTrack:D,id3Track:Object(H.dummyTrack)(),textTrack:Object(H.dummyTrack)()}},X.demuxSampleAes=function(D,v,_){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},X.destroy=function(){},Y}();M.minProbeByteLength=1024,Z.default=M},"./src/demux/mpegaudio.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"appendFrame",function(){return k}),U.d(Z,"parseHeader",function(){return D}),U.d(Z,"isHeaderPattern",function(){return v}),U.d(Z,"isHeader",function(){return _}),U.d(Z,"canParse",function(){return p}),U.d(Z,"probe",function(){return o});var ee=null,H=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],M=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Y=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],X=[0,1,1,4];function k(u,r,i,t,c){if(i+24>r.length)return;var f=D(r,i);if(f&&i+f.frameLength<=r.length){var A=f.samplesPerFrame*9e4/f.sampleRate,S=t+c*A,w={unit:r.subarray(i,i+f.frameLength),pts:S,dts:S};return u.config=[],u.channelCount=f.channelCount,u.samplerate=f.sampleRate,u.samples.push(w),{sample:w,length:f.frameLength,missing:0}}}function D(u,r){var i=u[r+1]>>3&3,t=u[r+1]>>1&3,c=u[r+2]>>4&15,f=u[r+2]>>2&3;if(i!==1&&c!==0&&c!==15&&f!==3){var A=u[r+2]>>1&1,S=u[r+3]>>6,w=i===3?3-t:t===3?3:4,R=H[w*14+c-1]*1e3,O=i===3?0:i===2?1:2,E=M[O*3+f],y=S===3?1:2,d=Y[i][t],l=X[t],h=d*8*l,g=Math.floor(d*R/E+A)*l;if(ee===null){var b=navigator.userAgent||"",F=b.match(/Chrome\/(\d+)/i);ee=F?parseInt(F[1]):0}var N=!!ee&&ee<=87;return N&&t===2&&R>=224e3&&S===0&&(u[r+3]=u[r+3]|128),{sampleRate:E,channelCount:y,frameLength:g,samplesPerFrame:h}}}function v(u,r){return u[r]===255&&(u[r+1]&224)===224&&(u[r+1]&6)!==0}function _(u,r){return r+1<u.length&&v(u,r)}function p(u,r){var i=4;return v(u,r)&&i<=u.length-r}function o(u,r){if(r+1<u.length&&v(u,r)){var i=4,t=D(u,r),c=i;t!=null&&t.frameLength&&(c=t.frameLength);var f=r+c;return f===u.length||_(u,f)}return!1}},"./src/demux/sample-aes.ts":function(ie,Z,U){"use strict";U.r(Z);var ee=U("./src/crypt/decrypter.ts"),H=U("./src/demux/tsdemuxer.ts"),M=function(){function Y(k,D,v){this.keyData=void 0,this.decrypter=void 0,this.keyData=v,this.decrypter=new ee.default(k,D,{removePKCS7Padding:!1})}var X=Y.prototype;return X.decryptBuffer=function(D,v){this.decrypter.decrypt(D,this.keyData.key.buffer,this.keyData.iv.buffer,v)},X.decryptAacSample=function(D,v,_,p){var o=D[v].unit,u=o.subarray(16,o.length-o.length%16),r=u.buffer.slice(u.byteOffset,u.byteOffset+u.length),i=this;this.decryptBuffer(r,function(t){var c=new Uint8Array(t);o.set(c,16),p||i.decryptAacSamples(D,v+1,_)})},X.decryptAacSamples=function(D,v,_){for(;;v++){if(v>=D.length){_();return}if(D[v].unit.length<32)continue;var p=this.decrypter.isSync();if(this.decryptAacSample(D,v,_,p),!p)return}},X.getAvcEncryptedData=function(D){for(var v=Math.floor((D.length-48)/160)*16+16,_=new Int8Array(v),p=0,o=32;o<=D.length-16;o+=160,p+=16)_.set(D.subarray(o,o+16),p);return _},X.getAvcDecryptedUnit=function(D,v){for(var _=new Uint8Array(v),p=0,o=32;o<=D.length-16;o+=160,p+=16)D.set(_.subarray(p,p+16),o);return D},X.decryptAvcSample=function(D,v,_,p,o,u){var r=Object(H.discardEPB)(o.data),i=this.getAvcEncryptedData(r),t=this;this.decryptBuffer(i.buffer,function(c){o.data=t.getAvcDecryptedUnit(r,c),u||t.decryptAvcSamples(D,v,_+1,p)})},X.decryptAvcSamples=function(D,v,_,p){if(D instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;v++,_=0){if(v>=D.length){p();return}for(var o=D[v].units;!(_>=o.length);_++){var u=o[_];if(u.data.length<=48||u.type!==1&&u.type!==5)continue;var r=this.decrypter.isSync();if(this.decryptAvcSample(D,v,_,p,u,r),!r)return}}},Y}();Z.default=M},"./src/demux/transmuxer-interface.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"default",function(){return o});var ee=U("./node_modules/webworkify-webpack/index.js"),H=U.n(ee),M=U("./src/events.ts"),Y=U("./src/demux/transmuxer.ts"),X=U("./src/utils/logger.ts"),k=U("./src/errors.ts"),D=U("./src/utils/mediasource-helper.ts"),v=U("./node_modules/eventemitter3/index.js"),_=U.n(v),p=Object(D.getMediaSource)()||{isTypeSupported:function(){return!1}},o=function(){function u(i,t,c,f){var A=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=i,this.id=t,this.onTransmuxComplete=c,this.onFlush=f;var S=i.config,w=function(d,l){l=l||{},l.frag=A.frag,l.id=A.id,i.trigger(d,l)};this.observer=new v.EventEmitter,this.observer.on(M.Events.FRAG_DECRYPTED,w),this.observer.on(M.Events.ERROR,w);var R={mp4:p.isTypeSupported("video/mp4"),mpeg:p.isTypeSupported("audio/mpeg"),mp3:p.isTypeSupported('audio/mp4; codecs="mp3"')},O=navigator.vendor;if(S.enableWorker&&typeof Worker!="undefined"){X.logger.log("demuxing in webworker");var E;try{E=this.worker=ee("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),E.addEventListener("message",this.onwmsg),E.onerror=function(y){i.trigger(M.Events.ERROR,{type:k.ErrorTypes.OTHER_ERROR,details:k.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(y.message+" ("+y.filename+":"+y.lineno+")")})},E.postMessage({cmd:"init",typeSupported:R,vendor:O,id:t,config:JSON.stringify(S)})}catch(y){X.logger.warn("Error in worker:",y),X.logger.error("Error while initializing DemuxerWorker, fallback to inline"),E&&self.URL.revokeObjectURL(E.objectURL),this.transmuxer=new Y.default(this.observer,R,S,O,t),this.worker=null}}else this.transmuxer=new Y.default(this.observer,R,S,O,t)}var r=u.prototype;return r.destroy=function(){var t=this.worker;if(t)t.removeEventListener("message",this.onwmsg),t.terminate(),this.worker=null;else{var c=this.transmuxer;c&&(c.destroy(),this.transmuxer=null)}var f=this.observer;f&&f.removeAllListeners(),this.observer=null},r.push=function(t,c,f,A,S,w,R,O,E,y){var d=this;E.transmuxing.start=self.performance.now();var l=this.transmuxer,h=this.worker,g=w?w.start:S.start,b=S.decryptdata,F=this.frag,N=!(F&&S.cc===F.cc),W=!(F&&E.level===F.level),K=F?E.sn-F.sn:-1,I=this.part?E.part-this.part.index:1,x=!W&&(K===1||K===0&&I===1),j=self.performance.now();(W||K||S.stats.parsing.start===0)&&(S.stats.parsing.start=j),w&&(I||!x)&&(w.stats.parsing.start=j);var $=new Y.TransmuxState(N,x,O,W,g);if(!x||N){X.logger.log("[transmuxer-interface, "+S.type+"]: Starting new transmux session for sn: "+E.sn+" p: "+E.part+" level: "+E.level+" id: "+E.id+`
|
|
discontinuity: `+N+`
|
|
trackSwitch: `+W+`
|
|
contiguous: `+x+`
|
|
accurateTimeOffset: `+O+`
|
|
timeOffset: `+g);var ae=new Y.TransmuxConfig(f,A,c,R,y);this.configureTransmuxer(ae)}if(this.frag=S,this.part=w,h)h.postMessage({cmd:"demux",data:t,decryptdata:b,chunkMeta:E,state:$},t instanceof ArrayBuffer?[t]:[]);else if(l){var fe=l.push(t,b,E,$);Object(Y.isPromise)(fe)?fe.then(function(pe){d.handleTransmuxComplete(pe)}):this.handleTransmuxComplete(fe)}},r.flush=function(t){var c=this;t.transmuxing.start=self.performance.now();var f=this.transmuxer,A=this.worker;if(A)A.postMessage({cmd:"flush",chunkMeta:t});else if(f){var S=f.flush(t);Object(Y.isPromise)(S)?S.then(function(w){c.handleFlushResult(w,t)}):this.handleFlushResult(S,t)}},r.handleFlushResult=function(t,c){var f=this;t.forEach(function(A){f.handleTransmuxComplete(A)}),this.onFlush(c)},r.onWorkerMessage=function(t){var c=t.data,f=this.hls;switch(c.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(c.data);break}case"flush":{this.onFlush(c.data);break}default:{c.data=c.data||{},c.data.frag=this.frag,c.data.id=this.id,f.trigger(c.event,c.data);break}}},r.configureTransmuxer=function(t){var c=this.worker,f=this.transmuxer;c?c.postMessage({cmd:"configure",config:t}):f&&f.configure(t)},r.handleTransmuxComplete=function(t){t.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(t)},u}()},"./src/demux/transmuxer-worker.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"default",function(){return k});var ee=U("./src/demux/transmuxer.ts"),H=U("./src/events.ts"),M=U("./src/utils/logger.ts"),Y=U("./node_modules/eventemitter3/index.js"),X=U.n(Y);function k(o){var u=new Y.EventEmitter,r=function(t,c){o.postMessage({event:t,data:c})};u.on(H.Events.FRAG_DECRYPTED,r),u.on(H.Events.ERROR,r),o.addEventListener("message",function(i){var t=i.data;switch(t.cmd){case"init":{var c=JSON.parse(t.config);o.transmuxer=new ee.default(u,t.typeSupported,c,t.vendor,t.id),Object(M.enableLogs)(c.debug),r("init",null);break}case"configure":{o.transmuxer.configure(t.config);break}case"demux":{var f=o.transmuxer.push(t.data,t.decryptdata,t.chunkMeta,t.state);Object(ee.isPromise)(f)?f.then(function(w){D(o,w)}):D(o,f);break}case"flush":{var A=t.chunkMeta,S=o.transmuxer.flush(A);Object(ee.isPromise)(S)?S.then(function(w){_(o,w,A)}):_(o,S,A);break}default:break}})}function D(o,u){if(p(u.remuxResult))return;var r=[],i=u.remuxResult,t=i.audio,c=i.video;t&&v(r,t),c&&v(r,c),o.postMessage({event:"transmuxComplete",data:u},r)}function v(o,u){u.data1&&o.push(u.data1.buffer),u.data2&&o.push(u.data2.buffer)}function _(o,u,r){u.forEach(function(i){D(o,i)}),o.postMessage({event:"flush",data:r})}function p(o){return!o.audio&&!o.video&&!o.text&&!o.id3&&!o.initSegment}},"./src/demux/transmuxer.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"default",function(){return c}),U.d(Z,"isPromise",function(){return S}),U.d(Z,"TransmuxConfig",function(){return w}),U.d(Z,"TransmuxState",function(){return R});var ee=U("./src/events.ts"),H=U("./src/errors.ts"),M=U("./src/crypt/decrypter.ts"),Y=U("./src/demux/aacdemuxer.ts"),X=U("./src/demux/mp4demuxer.ts"),k=U("./src/demux/tsdemuxer.ts"),D=U("./src/demux/mp3demuxer.ts"),v=U("./src/remux/mp4-remuxer.ts"),_=U("./src/remux/passthrough-remuxer.ts"),p=U("./src/demux/chunk-cache.ts"),o=U("./src/utils/mp4-tools.ts"),u=U("./src/utils/logger.ts"),r;try{r=self.performance.now.bind(self.performance)}catch(O){u.logger.debug("Unable to use Performance API on this environment"),r=self.Date.now}var i=[{demux:k.default,remux:v.default},{demux:X.default,remux:_.default},{demux:Y.default,remux:v.default},{demux:D.default,remux:v.default}],t=1024;i.forEach(function(O){var E=O.demux;t=Math.max(t,E.minProbeByteLength)});var c=function(){function O(y,d,l,h,g){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new p.default,this.observer=y,this.typeSupported=d,this.config=l,this.vendor=h,this.id=g}var E=O.prototype;return E.configure=function(d){this.transmuxConfig=d,this.decrypter&&this.decrypter.reset()},E.push=function(d,l,h,g){var b=this,F=h.transmuxing;F.executeStart=r();var N=new Uint8Array(d),W=this.cache,K=this.config,I=this.currentTransmuxState,x=this.transmuxConfig;g&&(this.currentTransmuxState=g);var j=f(N,l);if(j&&j.method==="AES-128"){var $=this.getDecrypter();if(K.enableSoftwareAES){var ae=$.softwareDecrypt(N,j.key.buffer,j.iv.buffer);if(!ae)return F.executeEnd=r(),A(h);N=new Uint8Array(ae)}else return this.decryptionPromise=$.webCryptoDecrypt(N,j.key.buffer,j.iv.buffer).then(function(ze){var ot=b.push(ze,null,h);return b.decryptionPromise=null,ot}),this.decryptionPromise}var fe=g||I,pe=fe.contiguous,Ce=fe.discontinuity,De=fe.trackSwitch,xe=fe.accurateTimeOffset,Oe=fe.timeOffset,Ee=x.audioCodec,be=x.videoCodec,te=x.defaultInitPts,me=x.duration,ye=x.initSegmentData;if((Ce||De)&&this.resetInitSegment(ye,Ee,be,me),Ce&&this.resetInitialTimestamp(te),pe||this.resetContiguity(),this.needsProbing(N,Ce,De)){if(W.dataLength){var Le=W.flush();N=Object(o.appendUint8Array)(Le,N)}this.configureTransmuxer(N,x)}var $e=this.transmux(N,j,Oe,xe,h),Me=this.currentTransmuxState;return Me.contiguous=!0,Me.discontinuity=!1,Me.trackSwitch=!1,F.executeEnd=r(),$e},E.flush=function(d){var l=this,h=d.transmuxing;h.executeStart=r();var g=this.decrypter,b=this.cache,F=this.currentTransmuxState,N=this.decryptionPromise;if(N)return N.then(function(){return l.flush(d)});var W=[],K=F.timeOffset;if(g){var I=g.flush();I&&W.push(this.push(I,null,d))}var x=b.dataLength;b.reset();var j=this.demuxer,$=this.remuxer;if(!j||!$)return x>=t&&this.observer.emit(ee.Events.ERROR,ee.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),h.executeEnd=r(),[A(d)];var ae=j.flush(K);return S(ae)?ae.then(function(fe){return l.flushRemux(W,fe,d),W}):(this.flushRemux(W,ae,d),W)},E.flushRemux=function(d,l,h){var g=l.audioTrack,b=l.avcTrack,F=l.id3Track,N=l.textTrack,W=this.currentTransmuxState,K=W.accurateTimeOffset,I=W.timeOffset;u.logger.log("[transmuxer.ts]: Flushed fragment "+h.sn+(h.part>-1?" p: "+h.part:"")+" of level "+h.level);var x=this.remuxer.remux(g,b,F,N,I,K,!0,this.id);d.push({remuxResult:x,chunkMeta:h}),h.transmuxing.executeEnd=r()},E.resetInitialTimestamp=function(d){var l=this.demuxer,h=this.remuxer;if(!l||!h)return;l.resetTimeStamp(d),h.resetTimeStamp(d)},E.resetContiguity=function(){var d=this.demuxer,l=this.remuxer;if(!d||!l)return;d.resetContiguity(),l.resetNextTimestamp()},E.resetInitSegment=function(d,l,h,g){var b=this.demuxer,F=this.remuxer;if(!b||!F)return;b.resetInitSegment(l,h,g),F.resetInitSegment(d,l,h)},E.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},E.transmux=function(d,l,h,g,b){var F;return l&&l.method==="SAMPLE-AES"?F=this.transmuxSampleAes(d,l,h,g,b):F=this.transmuxUnencrypted(d,h,g,b),F},E.transmuxUnencrypted=function(d,l,h,g){var b=this.demuxer.demux(d,l,!1,!this.config.progressive),F=b.audioTrack,N=b.avcTrack,W=b.id3Track,K=b.textTrack,I=this.remuxer.remux(F,N,W,K,l,h,!1,this.id);return{remuxResult:I,chunkMeta:g}},E.transmuxSampleAes=function(d,l,h,g,b){var F=this;return this.demuxer.demuxSampleAes(d,l,h).then(function(N){var W=F.remuxer.remux(N.audioTrack,N.avcTrack,N.id3Track,N.textTrack,h,g,!1,F.id);return{remuxResult:W,chunkMeta:b}})},E.configureTransmuxer=function(d,l){for(var h=this.config,g=this.observer,b=this.typeSupported,F=this.vendor,N=l.audioCodec,W=l.defaultInitPts,K=l.duration,I=l.initSegmentData,x=l.videoCodec,j,$=0,ae=i.length;$<ae;$++)if(i[$].demux.probe(d)){j=i[$];break}j||(u.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),j={demux:X.default,remux:_.default});var fe=this.demuxer,pe=this.remuxer,Ce=j.remux,De=j.demux;(!pe||!(pe instanceof Ce))&&(this.remuxer=new Ce(g,h,b,F)),(!fe||!(fe instanceof De))&&(this.demuxer=new De(g,h,b),this.probe=De.probe),this.resetInitSegment(I,N,x,K),this.resetInitialTimestamp(W)},E.needsProbing=function(d,l,h){return!this.demuxer||!this.remuxer||l||h},E.getDecrypter=function(){var d=this.decrypter;return d||(d=this.decrypter=new M.default(this.observer,this.config)),d},O}();function f(O,E){var y=null;return O.byteLength>0&&E!=null&&E.key!=null&&E.iv!==null&&E.method!=null&&(y=E),y}var A=function(E){return{remuxResult:{},chunkMeta:E}};function S(O){return"then"in O&&O.then instanceof Function}var w=function(E,y,d,l,h){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=E,this.videoCodec=y,this.initSegmentData=d,this.duration=l,this.defaultInitPts=h},R=function(E,y,d,l,h){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=E,this.contiguous=y,this.accurateTimeOffset=d,this.trackSwitch=l,this.timeOffset=h}},"./src/demux/tsdemuxer.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"discardEPB",function(){return A});var ee=U("./src/demux/adts.ts"),H=U("./src/demux/mpegaudio.ts"),M=U("./src/demux/exp-golomb.ts"),Y=U("./src/demux/id3.ts"),X=U("./src/demux/sample-aes.ts"),k=U("./src/events.ts"),D=U("./src/utils/mp4-tools.ts"),v=U("./src/utils/logger.ts"),_=U("./src/errors.ts"),p={video:1,audio:2,id3:3,text:4},o=function(){function S(R,O,E){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=R,this.config=O,this.typeSupported=E}S.probe=function(O){var E=S.syncOffset(O);return E<0?!1:(E&&v.logger.warn("MPEG2-TS detected but first sync word found @ offset "+E+", junk ahead ?"),!0)},S.syncOffset=function(O){for(var E=Math.min(1e3,O.length-3*188),y=0;y<E;){if(O[y]===71&&O[y+188]===71&&O[y+2*188]===71)return y;y++}return-1},S.createTrack=function(O,E){return{container:O==="video"||O==="audio"?"video/mp2t":void 0,type:O,id:p[O],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:O==="audio"?E:void 0}};var w=S.prototype;return w.resetInitSegment=function(O,E,y){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=S.createTrack("video",y),this._audioTrack=S.createTrack("audio",y),this._id3Track=S.createTrack("id3",y),this._txtTrack=S.createTrack("text",y),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=O,this.videoCodec=E,this._duration=y},w.resetTimeStamp=function(){},w.resetContiguity=function(){var O=this._audioTrack,E=this._avcTrack,y=this._id3Track;O&&(O.pesData=null),E&&(E.pesData=null),y&&(y.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},w.demux=function(O,E,y,d){y===void 0&&(y=!1),d===void 0&&(d=!1),y||(this.sampleAes=null);var l,h=this._avcTrack,g=this._audioTrack,b=this._id3Track,F=h.pid,N=h.pesData,W=g.pid,K=b.pid,I=g.pesData,x=b.pesData,j=!1,$=this.pmtParsed,ae=this._pmtId,fe=O.length;if(this.remainderData&&(O=Object(D.appendUint8Array)(this.remainderData,O),fe=O.length,this.remainderData=null),fe<188&&!d)return this.remainderData=O,{audioTrack:g,avcTrack:h,id3Track:b,textTrack:this._txtTrack};var pe=Math.max(0,S.syncOffset(O));fe-=(fe+pe)%188,fe<O.byteLength&&!d&&(this.remainderData=new Uint8Array(O.buffer,fe,O.buffer.byteLength-fe));for(var Ce=pe;Ce<fe;Ce+=188)if(O[Ce]===71){var De=!!(O[Ce+1]&64),xe=((O[Ce+1]&31)<<8)+O[Ce+2],Oe=(O[Ce+3]&48)>>4,Ee=void 0;if(Oe>1){if(Ee=Ce+5+O[Ce+4],Ee===Ce+188)continue}else Ee=Ce+4;switch(xe){case F:De&&(N&&(l=t(N))&&this.parseAVCPES(l,!1),N={data:[],size:0}),N&&(N.data.push(O.subarray(Ee,Ce+188)),N.size+=Ce+188-Ee);break;case W:De&&(I&&(l=t(I))&&(g.isAAC?this.parseAACPES(l):this.parseMPEGPES(l)),I={data:[],size:0}),I&&(I.data.push(O.subarray(Ee,Ce+188)),I.size+=Ce+188-Ee);break;case K:De&&(x&&(l=t(x))&&this.parseID3PES(l),x={data:[],size:0}),x&&(x.data.push(O.subarray(Ee,Ce+188)),x.size+=Ce+188-Ee);break;case 0:De&&(Ee+=O[Ee]+1),ae=this._pmtId=r(O,Ee);break;case ae:{De&&(Ee+=O[Ee]+1);var be=i(O,Ee,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,y);F=be.avc,F>0&&(h.pid=F),W=be.audio,W>0&&(g.pid=W,g.isAAC=be.isAAC),K=be.id3,K>0&&(b.pid=K),j&&!$&&(v.logger.log("reparse from beginning"),j=!1,Ce=pe-188),$=this.pmtParsed=!0;break}case 17:case 8191:break;default:j=!0;break}}else this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:_.ErrorTypes.MEDIA_ERROR,details:_.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});h.pesData=N,g.pesData=I,b.pesData=x;var te={audioTrack:g,avcTrack:h,id3Track:b,textTrack:this._txtTrack};return d&&this.extractRemainingSamples(te),te},w.flush=function(){var O=this.remainderData;this.remainderData=null;var E;return O?E=this.demux(O,-1,!1,!0):E={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(E),this.sampleAes?this.decrypt(E,this.sampleAes):E},w.extractRemainingSamples=function(O){var E=O.audioTrack,y=O.avcTrack,d=O.id3Track,l=y.pesData,h=E.pesData,g=d.pesData,b;l&&(b=t(l))?(this.parseAVCPES(b,!0),y.pesData=null):y.pesData=l,h&&(b=t(h))?(E.isAAC?this.parseAACPES(b):this.parseMPEGPES(b),E.pesData=null):(h!=null&&h.size&&v.logger.log("last AAC PES packet truncated,might overlap between fragments"),E.pesData=h),g&&(b=t(g))?(this.parseID3PES(b),d.pesData=null):d.pesData=g},w.demuxSampleAes=function(O,E,y){var d=this.demux(O,y,!0,!this.config.progressive),l=this.sampleAes=new X.default(this.observer,this.config,E);return this.decrypt(d,l)},w.decrypt=function(O,E){return new Promise(function(y){var d=O.audioTrack,l=O.avcTrack;d.samples&&d.isAAC?E.decryptAacSamples(d.samples,0,function(){l.samples?E.decryptAvcSamples(l.samples,0,0,function(){y(O)}):y(O)}):l.samples&&E.decryptAvcSamples(l.samples,0,0,function(){y(O)})})},w.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},w.parseAVCPES=function(O,E){var y=this,d=this._avcTrack,l=this.parseAVCNALu(O.data),h=!1,g=this.avcSample,b,F=!1;O.data=null,g&&l.length&&!d.audFound&&(c(g,d),g=this.avcSample=u(!1,O.pts,O.dts,"")),l.forEach(function(N){switch(N.type){case 1:{b=!0,g||(g=y.avcSample=u(!0,O.pts,O.dts,"")),h&&(g.debug+="NDR "),g.frame=!0;var W=N.data;if(F&&W.length>4){var K=new M.default(W).readSliceType();(K===2||K===4||K===7||K===9)&&(g.key=!0)}break}case 5:b=!0,g||(g=y.avcSample=u(!0,O.pts,O.dts,"")),h&&(g.debug+="IDR "),g.key=!0,g.frame=!0;break;case 6:{b=!0,h&&g&&(g.debug+="SEI ");var I=new M.default(A(N.data));I.readUByte();for(var x=0,j=0,$=!1,ae=0;!$&&I.bytesAvailable>1;){x=0;do ae=I.readUByte(),x+=ae;while(ae===255);j=0;do ae=I.readUByte(),j+=ae;while(ae===255);if(x===4&&I.bytesAvailable!==0){$=!0;var fe=I.readUByte();if(fe===181){var pe=I.readUShort();if(pe===49){var Ce=I.readUInt();if(Ce===1195456820){var De=I.readUByte();if(De===3){for(var xe=I.readUByte(),Oe=I.readUByte(),Ee=31&xe,be=[xe,Oe],te=0;te<Ee;te++)be.push(I.readUByte()),be.push(I.readUByte()),be.push(I.readUByte());f(y._txtTrack.samples,{type:3,pts:O.pts,bytes:be})}}}}}else if(x===5&&I.bytesAvailable!==0){if($=!0,j>16){for(var me=[],ye=0;ye<16;ye++)me.push(I.readUByte().toString(16)),(ye===3||ye===5||ye===7||ye===9)&&me.push("-");for(var Le=j-16,$e=new Uint8Array(Le),Me=0;Me<Le;Me++)$e[Me]=I.readUByte();f(y._txtTrack.samples,{pts:O.pts,payloadType:x,uuid:me.join(""),userData:Object(Y.utf8ArrayToStr)($e),userDataBytes:$e})}}else if(j<I.bytesAvailable)for(var ze=0;ze<j;ze++)I.readUByte()}break}case 7:if(b=!0,F=!0,h&&g&&(g.debug+="SPS "),!d.sps){var ot=new M.default(N.data),Et=ot.readSPS();d.width=Et.width,d.height=Et.height,d.pixelRatio=Et.pixelRatio,d.sps=[N.data],d.duration=y._duration;for(var _t=N.data.subarray(1,4),mt="avc1.",ut=0;ut<3;ut++){var Xt=_t[ut].toString(16);Xt.length<2&&(Xt="0"+Xt),mt+=Xt}d.codec=mt}break;case 8:b=!0,h&&g&&(g.debug+="PPS "),d.pps||(d.pps=[N.data]);break;case 9:b=!1,d.audFound=!0,g&&c(g,d),g=y.avcSample=u(!1,O.pts,O.dts,h?"AUD ":"");break;case 12:b=!1;break;default:b=!1,g&&(g.debug+="unknown NAL "+N.type+" ");break}if(g&&b){var en=g.units;en.push(N)}}),E&&g&&(c(g,d),this.avcSample=null)},w.getLastNalUnit=function(){var O,E=this.avcSample,y;if(!E||E.units.length===0){var d=this._avcTrack.samples;E=d[d.length-1]}if((O=E)!==null&&O!==void 0&&O.units){var l=E.units;y=l[l.length-1]}return y},w.parseAVCNALu=function(O){var E=O.byteLength,y=this._avcTrack,d=y.naluState||0,l=d,h=[],g=0,b,F,N,W=-1,K=0;for(d===-1&&(W=0,K=O[0]&31,d=0,g=1);g<E;){if(b=O[g++],!d){d=b?0:1;continue}if(d===1){d=b?0:2;continue}if(!b)d=3;else if(b===1){if(W>=0){var I={data:O.subarray(W,g-d-1),type:K};h.push(I)}else{var x=this.getLastNalUnit();if(x&&(l&&g<=4-l&&(x.state&&(x.data=x.data.subarray(0,x.data.byteLength-l))),F=g-d-1,F>0)){var j=new Uint8Array(x.data.byteLength+F);j.set(x.data,0),j.set(O.subarray(0,F),x.data.byteLength),x.data=j,x.state=0}}g<E?(N=O[g]&31,W=g,K=N,d=0):d=-1}else d=0}if(W>=0&&d>=0){var $={data:O.subarray(W,E),type:K,state:d};h.push($)}if(h.length===0){var ae=this.getLastNalUnit();if(ae){var fe=new Uint8Array(ae.data.byteLength+O.byteLength);fe.set(ae.data,0),fe.set(O,ae.data.byteLength),ae.data=fe}}return y.naluState=d,h},w.parseAACPES=function(O){var E=0,y=this._audioTrack,d=this.aacOverFlow,l=O.data;if(d){this.aacOverFlow=null;var h=d.sample.unit.byteLength,g=Math.min(d.missing,h),b=h-g;d.sample.unit.set(l.subarray(0,g),b),y.samples.push(d.sample),E=d.missing}var F,N;for(F=E,N=l.length;F<N-1&&!ee.isHeader(l,F);F++);if(F!==E){var W,K;if(F<N-1?(W="AAC PES did not start with ADTS header,offset:"+F,K=!1):(W="no ADTS header found in AAC PES",K=!0),v.logger.warn("parsing error:"+W),this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:_.ErrorTypes.MEDIA_ERROR,details:_.ErrorDetails.FRAG_PARSING_ERROR,fatal:K,reason:W}),K)return}ee.initTrackConfig(y,this.observer,l,F,this.audioCodec);var I;if(O.pts!==void 0)I=O.pts;else if(d){var x=ee.getFrameDuration(y.samplerate);I=d.sample.pts+x}else{v.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var j=0;F<N;)if(ee.isHeader(l,F)){if(F+5<N){var $=ee.appendFrame(y,l,F,I,j);if($)if($.missing)this.aacOverFlow=$;else{F+=$.length,j++;continue}}break}else F++},w.parseMPEGPES=function(O){var E=O.data,y=E.length,d=0,l=0,h=O.pts;if(h===void 0){v.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;l<y;)if(H.isHeader(E,l)){var g=H.appendFrame(this._audioTrack,E,l,h,d);if(g)l+=g.length,d++;else break}else l++},w.parseID3PES=function(O){if(O.pts===void 0){v.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(O)},S}();o.minProbeByteLength=188;function u(S,w,R,O){return{key:S,frame:!1,pts:w,dts:R,units:[],debug:O,length:0}}function r(S,w){return(S[w+10]&31)<<8|S[w+11]}function i(S,w,R,O){var E={audio:-1,avc:-1,id3:-1,isAAC:!0},y=(S[w+1]&15)<<8|S[w+2],d=w+3+y-4,l=(S[w+10]&15)<<8|S[w+11];for(w+=12+l;w<d;){var h=(S[w+1]&31)<<8|S[w+2];switch(S[w]){case 207:if(!O){v.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:E.audio===-1&&(E.audio=h);break;case 21:E.id3===-1&&(E.id3=h);break;case 219:if(!O){v.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:E.avc===-1&&(E.avc=h);break;case 3:case 4:R?E.audio===-1&&(E.audio=h,E.isAAC=!1):v.logger.log("MPEG audio found, not supported in this browser");break;case 36:v.logger.warn("Unsupported HEVC stream type found");break;default:break}w+=((S[w+3]&15)<<8|S[w+4])+5}return E}function t(S){var w=0,R,O,E,y,d,l=S.data;if(!S||S.size===0)return null;for(;l[0].length<19&&l.length>1;){var h=new Uint8Array(l[0].length+l[1].length);h.set(l[0]),h.set(l[1],l[0].length),l[0]=h,l.splice(1,1)}R=l[0];var g=(R[0]<<16)+(R[1]<<8)+R[2];if(g===1){if(O=(R[4]<<8)+R[5],O&&O>S.size-6)return null;var b=R[7];b&192&&(y=(R[9]&14)*536870912+(R[10]&255)*4194304+(R[11]&254)*16384+(R[12]&255)*128+(R[13]&254)/2,b&64?(d=(R[14]&14)*536870912+(R[15]&255)*4194304+(R[16]&254)*16384+(R[17]&255)*128+(R[18]&254)/2,y-d>60*9e4&&(v.logger.warn(Math.round((y-d)/9e4)+"s delta between PTS and DTS, align them"),y=d)):d=y),E=R[8];var F=E+9;if(S.size<=F)return null;S.size-=F;for(var N=new Uint8Array(S.size),W=0,K=l.length;W<K;W++){R=l[W];var I=R.byteLength;if(F)if(F>I){F-=I;continue}else R=R.subarray(F),I-=F,F=0;N.set(R,w),w+=I}return O&&(O-=E+3),{data:N,pts:y,dts:d,len:O}}return null}function c(S,w){if(S.units.length&&S.frame){if(S.pts===void 0){var R=w.samples,O=R.length;if(O){var E=R[O-1];S.pts=E.pts,S.dts=E.dts}else{w.dropped++;return}}w.samples.push(S)}S.debug.length&&v.logger.log(S.pts+"/"+S.dts+":"+S.debug)}function f(S,w){var R=S.length;if(R>0){if(w.pts>=S[R-1].pts)S.push(w);else for(var O=R-1;O>=0;O--)if(w.pts<S[O].pts){S.splice(O,0,w);break}}else S.push(w)}function A(S){for(var w=S.byteLength,R=[],O=1;O<w-2;)S[O]===0&&S[O+1]===0&&S[O+2]===3?(R.push(O+2),O+=2):O++;if(R.length===0)return S;var E=w-R.length,y=new Uint8Array(E),d=0;for(O=0;O<E;d++,O++)d===R[0]&&(d++,R.shift()),y[O]=S[d];return y}Z.default=o},"./src/errors.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"ErrorTypes",function(){return ee}),U.d(Z,"ErrorDetails",function(){return H});var ee;(function(M){M.NETWORK_ERROR="networkError",M.MEDIA_ERROR="mediaError",M.KEY_SYSTEM_ERROR="keySystemError",M.MUX_ERROR="muxError",M.OTHER_ERROR="otherError"})(ee||(ee={}));var H;(function(M){M.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",M.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",M.KEY_SYSTEM_NO_SESSION="keySystemNoSession",M.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",M.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",M.MANIFEST_LOAD_ERROR="manifestLoadError",M.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",M.MANIFEST_PARSING_ERROR="manifestParsingError",M.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",M.LEVEL_EMPTY_ERROR="levelEmptyError",M.LEVEL_LOAD_ERROR="levelLoadError",M.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",M.LEVEL_SWITCH_ERROR="levelSwitchError",M.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",M.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",M.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",M.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",M.FRAG_LOAD_ERROR="fragLoadError",M.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",M.FRAG_DECRYPT_ERROR="fragDecryptError",M.FRAG_PARSING_ERROR="fragParsingError",M.REMUX_ALLOC_ERROR="remuxAllocError",M.KEY_LOAD_ERROR="keyLoadError",M.KEY_LOAD_TIMEOUT="keyLoadTimeOut",M.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",M.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",M.BUFFER_APPEND_ERROR="bufferAppendError",M.BUFFER_APPENDING_ERROR="bufferAppendingError",M.BUFFER_STALLED_ERROR="bufferStalledError",M.BUFFER_FULL_ERROR="bufferFullError",M.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",M.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",M.INTERNAL_EXCEPTION="internalException",M.INTERNAL_ABORTED="aborted",M.UNKNOWN="unknown"})(H||(H={}))},"./src/events.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"Events",function(){return ee});var ee;(function(H){H.MEDIA_ATTACHING="hlsMediaAttaching",H.MEDIA_ATTACHED="hlsMediaAttached",H.MEDIA_DETACHING="hlsMediaDetaching",H.MEDIA_DETACHED="hlsMediaDetached",H.BUFFER_RESET="hlsBufferReset",H.BUFFER_CODECS="hlsBufferCodecs",H.BUFFER_CREATED="hlsBufferCreated",H.BUFFER_APPENDING="hlsBufferAppending",H.BUFFER_APPENDED="hlsBufferAppended",H.BUFFER_EOS="hlsBufferEos",H.BUFFER_FLUSHING="hlsBufferFlushing",H.BUFFER_FLUSHED="hlsBufferFlushed",H.MANIFEST_LOADING="hlsManifestLoading",H.MANIFEST_LOADED="hlsManifestLoaded",H.MANIFEST_PARSED="hlsManifestParsed",H.LEVEL_SWITCHING="hlsLevelSwitching",H.LEVEL_SWITCHED="hlsLevelSwitched",H.LEVEL_LOADING="hlsLevelLoading",H.LEVEL_LOADED="hlsLevelLoaded",H.LEVEL_UPDATED="hlsLevelUpdated",H.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",H.LEVELS_UPDATED="hlsLevelsUpdated",H.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",H.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",H.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",H.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",H.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",H.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",H.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",H.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",H.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",H.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",H.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",H.CUES_PARSED="hlsCuesParsed",H.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",H.INIT_PTS_FOUND="hlsInitPtsFound",H.FRAG_LOADING="hlsFragLoading",H.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",H.FRAG_LOADED="hlsFragLoaded",H.FRAG_DECRYPTED="hlsFragDecrypted",H.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",H.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",H.FRAG_PARSING_METADATA="hlsFragParsingMetadata",H.FRAG_PARSED="hlsFragParsed",H.FRAG_BUFFERED="hlsFragBuffered",H.FRAG_CHANGED="hlsFragChanged",H.FPS_DROP="hlsFpsDrop",H.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",H.ERROR="hlsError",H.DESTROYING="hlsDestroying",H.KEY_LOADING="hlsKeyLoading",H.KEY_LOADED="hlsKeyLoaded",H.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",H.BACK_BUFFER_REACHED="hlsBackBufferReached"})(ee||(ee={}))},"./src/hls.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"default",function(){return S});var ee=U("./node_modules/url-toolkit/src/url-toolkit.js"),H=U.n(ee),M=U("./src/loader/playlist-loader.ts"),Y=U("./src/loader/key-loader.ts"),X=U("./src/controller/id3-track-controller.ts"),k=U("./src/controller/latency-controller.ts"),D=U("./src/controller/level-controller.ts"),v=U("./src/controller/fragment-tracker.ts"),_=U("./src/controller/stream-controller.ts"),p=U("./src/is-supported.ts"),o=U("./src/utils/logger.ts"),u=U("./src/config.ts"),r=U("./node_modules/eventemitter3/index.js"),i=U.n(r),t=U("./src/events.ts"),c=U("./src/errors.ts");function f(w,R){for(var O=0;O<R.length;O++){var E=R[O];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(w,E.key,E)}}function A(w,R,O){return R&&f(w.prototype,R),O&&f(w,O),w}var S=function(){w.isSupported=function(){return Object(p.isSupported)()};function w(O){O===void 0&&(O={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new r.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var E=this.config=Object(u.mergeConfig)(w.DefaultConfig,O);this.userConfig=O,Object(o.enableLogs)(E.debug),this._autoLevelCapping=-1,E.progressive&&Object(u.enableStreamingMode)(E);var y=E.abrController,d=E.bufferController,l=E.capLevelController,h=E.fpsController,g=this.abrController=new y(this),b=this.bufferController=new d(this),F=this.capLevelController=new l(this),N=new h(this),W=new M.default(this),K=new Y.default(this),I=new X.default(this),x=this.levelController=new D.default(this),j=new v.FragmentTracker(this),$=this.streamController=new _.default(this,j);F.setStreamController($),N.setStreamController($);var ae=[x,$];this.networkControllers=ae;var fe=[W,K,g,b,F,N,I,j];this.audioTrackController=this.createController(E.audioTrackController,null,ae),this.createController(E.audioStreamController,j,ae),this.subtitleTrackController=this.createController(E.subtitleTrackController,null,ae),this.createController(E.subtitleStreamController,j,ae),this.createController(E.timelineController,null,fe),this.emeController=this.createController(E.emeController,null,fe),this.cmcdController=this.createController(E.cmcdController,null,fe),this.latencyController=this.createController(k.default,null,fe),this.coreComponents=fe}var R=w.prototype;return R.createController=function(E,y,d){if(E){var l=y?new E(this,y):new E(this);return d&&d.push(l),l}return null},R.on=function(E,y,d){d===void 0&&(d=this),this._emitter.on(E,y,d)},R.once=function(E,y,d){d===void 0&&(d=this),this._emitter.once(E,y,d)},R.removeAllListeners=function(E){this._emitter.removeAllListeners(E)},R.off=function(E,y,d,l){d===void 0&&(d=this),this._emitter.off(E,y,d,l)},R.listeners=function(E){return this._emitter.listeners(E)},R.emit=function(E,y,d){return this._emitter.emit(E,y,d)},R.trigger=function(E,y){if(this.config.debug)return this.emit(E,E,y);try{return this.emit(E,E,y)}catch(d){o.logger.error("An internal error happened while handling event "+E+'. Error message: "'+d.message+'". Here is a stacktrace:',d),this.trigger(t.Events.ERROR,{type:c.ErrorTypes.OTHER_ERROR,details:c.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:E,error:d})}return!1},R.listenerCount=function(E){return this._emitter.listenerCount(E)},R.destroy=function(){o.logger.log("destroy"),this.trigger(t.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(E){return E.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(E){return E.destroy()}),this.coreComponents.length=0},R.attachMedia=function(E){o.logger.log("attachMedia"),this._media=E,this.trigger(t.Events.MEDIA_ATTACHING,{media:E})},R.detachMedia=function(){o.logger.log("detachMedia"),this.trigger(t.Events.MEDIA_DETACHING,void 0),this._media=null},R.loadSource=function(E){this.stopLoad();var y=this.media,d=this.url,l=this.url=ee.buildAbsoluteURL(self.location.href,E,{alwaysNormalize:!0});o.logger.log("loadSource:"+l),y&&d&&d!==l&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(y)),this.trigger(t.Events.MANIFEST_LOADING,{url:E})},R.startLoad=function(E){E===void 0&&(E=-1),o.logger.log("startLoad("+E+")"),this.networkControllers.forEach(function(y){y.startLoad(E)})},R.stopLoad=function(){o.logger.log("stopLoad"),this.networkControllers.forEach(function(E){E.stopLoad()})},R.swapAudioCodec=function(){o.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},R.recoverMediaError=function(){o.logger.log("recoverMediaError");var E=this._media;this.detachMedia(),E&&this.attachMedia(E)},R.removeLevel=function(E,y){y===void 0&&(y=0),this.levelController.removeLevel(E,y)},A(w,[{key:"levels",get:function(){var E=this.levelController.levels;return E||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(E){o.logger.log("set currentLevel:"+E),this.loadLevel=E,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(E){o.logger.log("set nextLevel:"+E),this.levelController.manualLevel=E,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(E){o.logger.log("set loadLevel:"+E),this.levelController.manualLevel=E}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(E){this.levelController.nextLoadLevel=E}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(E){o.logger.log("set firstLevel:"+E),this.levelController.firstLevel=E}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(E){o.logger.log("set startLevel:"+E),E!==-1&&(E=Math.max(E,this.minAutoLevel)),this.levelController.startLevel=E}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(E){var y=!!E;y!==this.config.capLevelToPlayerSize&&(y?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=y)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(E){this._autoLevelCapping!==E&&(o.logger.log("set autoLevelCapping:"+E),this._autoLevelCapping=E)}},{key:"bandwidthEstimate",get:function(){var E=this.abrController.bwEstimator;return E?E.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var E=this.levels,y=this.config.minAutoBitrate;if(!E)return 0;for(var d=E.length,l=0;l<d;l++)if(E[l].maxBitrate>y)return l;return 0}},{key:"maxAutoLevel",get:function(){var E=this.levels,y=this.autoLevelCapping,d;return y===-1&&E&&E.length?d=E.length-1:d=y,d}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(E){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,E)}},{key:"audioTracks",get:function(){var E=this.audioTrackController;return E?E.audioTracks:[]}},{key:"audioTrack",get:function(){var E=this.audioTrackController;return E?E.audioTrack:-1},set:function(E){var y=this.audioTrackController;y&&(y.audioTrack=E)}},{key:"subtitleTracks",get:function(){var E=this.subtitleTrackController;return E?E.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var E=this.subtitleTrackController;return E?E.subtitleTrack:-1},set:function(E){var y=this.subtitleTrackController;y&&(y.subtitleTrack=E)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var E=this.subtitleTrackController;return E?E.subtitleDisplay:!1},set:function(E){var y=this.subtitleTrackController;y&&(y.subtitleDisplay=E)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(E){this.config.lowLatencyMode=E}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return t.Events}},{key:"ErrorTypes",get:function(){return c.ErrorTypes}},{key:"ErrorDetails",get:function(){return c.ErrorDetails}},{key:"DefaultConfig",get:function(){return w.defaultConfig?w.defaultConfig:u.hlsDefaultConfig},set:function(E){w.defaultConfig=E}}]),w}();S.defaultConfig=void 0},"./src/is-supported.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"isSupported",function(){return M}),U.d(Z,"changeTypeSupported",function(){return Y});var ee=U("./src/utils/mediasource-helper.ts");function H(){return self.SourceBuffer||self.WebKitSourceBuffer}function M(){var X=Object(ee.getMediaSource)();if(!X)return!1;var k=H(),D=X&&typeof X.isTypeSupported=="function"&&X.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),v=!k||k.prototype&&typeof k.prototype.appendBuffer=="function"&&typeof k.prototype.remove=="function";return!!D&&!!v}function Y(){var X,k=H();return typeof(k==null||((X=k.prototype)===null||X===void 0)?void 0:X.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"default",function(){return o}),U.d(Z,"LoadError",function(){return r});var ee=U("./src/polyfills/number.ts"),H=U("./src/errors.ts");function M(i,t){i.prototype=Object.create(t.prototype),i.prototype.constructor=i,v(i,t)}function Y(i){var t=typeof Map=="function"?new Map:void 0;return Y=function(f){if(f===null||!D(f))return f;if(typeof f!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t!="undefined"){if(t.has(f))return t.get(f);t.set(f,A)}function A(){return X(f,arguments,_(this).constructor)}return A.prototype=Object.create(f.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}}),v(A,f)},Y(i)}function X(i,t,c){return k()?X=Reflect.construct:X=function(A,S,w){var R=[null];R.push.apply(R,S);var O=Function.bind.apply(A,R),E=new O;return w&&v(E,w.prototype),E},X.apply(null,arguments)}function k(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(i){return!1}}function D(i){return Function.toString.call(i).indexOf("[native code]")!==-1}function v(i,t){return v=Object.setPrototypeOf||function(f,A){return f.__proto__=A,f},v(i,t)}function _(i){return _=Object.setPrototypeOf?Object.getPrototypeOf:function(c){return c.__proto__||Object.getPrototypeOf(c)},_(i)}var p=Math.pow(2,17),o=function(){function i(c){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=c}var t=i.prototype;return t.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},t.abort=function(){this.loader&&this.loader.abort()},t.load=function(f,A){var S=this,w=f.url;if(!w)return Promise.reject(new r({type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:f,networkDetails:null},"Fragment does not have a "+(w?"part list":"url")));this.abort();var R=this.config,O=R.fLoader,E=R.loader;return new Promise(function(y,d){S.loader&&S.loader.destroy();var l=S.loader=f.loader=O?new O(R):new E(R),h=u(f),g={timeout:R.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:R.fragLoadingMaxRetryTimeout,highWaterMark:p};f.stats=l.stats,l.load(h,g,{onSuccess:function(F,N,W,K){S.resetLoader(f,l),y({frag:f,part:null,payload:F.data,networkDetails:K})},onError:function(F,N,W){S.resetLoader(f,l),d(new r({type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:f,response:F,networkDetails:W}))},onAbort:function(F,N,W){S.resetLoader(f,l),d(new r({type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:f,networkDetails:W}))},onTimeout:function(F,N,W){S.resetLoader(f,l),d(new r({type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:f,networkDetails:W}))},onProgress:function(F,N,W,K){A&&A({frag:f,part:null,payload:W,networkDetails:K})}})})},t.loadPart=function(f,A,S){var w=this;this.abort();var R=this.config,O=R.fLoader,E=R.loader;return new Promise(function(y,d){w.loader&&w.loader.destroy();var l=w.loader=f.loader=O?new O(R):new E(R),h=u(f,A),g={timeout:R.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:R.fragLoadingMaxRetryTimeout,highWaterMark:p};A.stats=l.stats,l.load(h,g,{onSuccess:function(F,N,W,K){w.resetLoader(f,l),w.updateStatsFromPart(f,A);var I={frag:f,part:A,payload:F.data,networkDetails:K};S(I),y(I)},onError:function(F,N,W){w.resetLoader(f,l),d(new r({type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:f,part:A,response:F,networkDetails:W}))},onAbort:function(F,N,W){f.stats.aborted=A.stats.aborted,w.resetLoader(f,l),d(new r({type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:f,part:A,networkDetails:W}))},onTimeout:function(F,N,W){w.resetLoader(f,l),d(new r({type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:f,part:A,networkDetails:W}))}})})},t.updateStatsFromPart=function(f,A){var S=f.stats,w=A.stats,R=w.total;if(S.loaded+=w.loaded,R){var O=Math.round(f.duration/A.duration),E=Math.min(Math.round(S.loaded/R),O),y=O-E,d=y*Math.round(S.loaded/E);S.total=S.loaded+d}else S.total=Math.max(S.loaded,S.total);var l=S.loading,h=w.loading;l.start?l.first+=h.first-h.start:(l.start=h.start,l.first=h.first),l.end=h.end},t.resetLoader=function(f,A){f.loader=null,this.loader===A&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),A.destroy()},i}();function u(i,t){t===void 0&&(t=null);var c=t||i,f={frag:i,part:t,responseType:"arraybuffer",url:c.url,headers:{},rangeStart:0,rangeEnd:0},A=c.byteRangeStartOffset,S=c.byteRangeEndOffset;return Object(ee.isFiniteNumber)(A)&&Object(ee.isFiniteNumber)(S)&&(f.rangeStart=A,f.rangeEnd=S),f}var r=function(i){M(t,i);function t(c){for(var f,A=arguments.length,S=new Array(A>1?A-1:0),w=1;w<A;w++)S[w-1]=arguments[w];return f=i.call.apply(i,[this].concat(S))||this,f.data=void 0,f.data=c,f}return t}(Y(Error))},"./src/loader/fragment.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"ElementaryStreamTypes",function(){return o}),U.d(Z,"BaseSegment",function(){return u}),U.d(Z,"Fragment",function(){return r}),U.d(Z,"Part",function(){return i});var ee=U("./src/polyfills/number.ts"),H=U("./node_modules/url-toolkit/src/url-toolkit.js"),M=U.n(H),Y=U("./src/utils/logger.ts"),X=U("./src/loader/level-key.ts"),k=U("./src/loader/load-stats.ts");function D(t,c){t.prototype=Object.create(c.prototype),t.prototype.constructor=t,v(t,c)}function v(t,c){return v=Object.setPrototypeOf||function(A,S){return A.__proto__=S,A},v(t,c)}function _(t,c){for(var f=0;f<c.length;f++){var A=c[f];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(t,A.key,A)}}function p(t,c,f){return c&&_(t.prototype,c),f&&_(t,f),t}var o;(function(t){t.AUDIO="audio",t.VIDEO="video",t.AUDIOVIDEO="audiovideo"})(o||(o={}));var u=function(){function t(f){var A;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(A={},A[o.AUDIO]=null,A[o.VIDEO]=null,A[o.AUDIOVIDEO]=null,A),this.baseurl=f}var c=t.prototype;return c.setByteRange=function(A,S){var w=A.split("@",2),R=[];w.length===1?R[0]=S?S.byteRangeEndOffset:0:R[0]=parseInt(w[1]),R[1]=parseInt(w[0])+R[0],this._byteRange=R},p(t,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(H.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(A){this._url=A}}]),t}(),r=function(t){D(c,t);function c(A,S){var w;return w=t.call(this,S)||this,w._decryptdata=null,w.rawProgramDateTime=null,w.programDateTime=null,w.tagList=[],w.duration=0,w.sn=0,w.levelkey=void 0,w.type=void 0,w.loader=null,w.level=-1,w.cc=0,w.startPTS=void 0,w.endPTS=void 0,w.appendedPTS=void 0,w.startDTS=void 0,w.endDTS=void 0,w.start=0,w.deltaPTS=void 0,w.maxStartPTS=void 0,w.minEndPTS=void 0,w.stats=new k.LoadStats,w.urlId=0,w.data=void 0,w.bitrateTest=!1,w.title=null,w.initSegment=null,w.type=A,w}var f=c.prototype;return f.createInitializationVector=function(S){for(var w=new Uint8Array(16),R=12;R<16;R++)w[R]=S>>8*(15-R)&255;return w},f.setDecryptDataFromLevelKey=function(S,w){var R=S;return(S==null?void 0:S.method)==="AES-128"&&S.uri&&!S.iv&&(R=X.LevelKey.fromURI(S.uri),R.method=S.method,R.iv=this.createInitializationVector(w),R.keyFormat="identity"),R},f.setElementaryStreamInfo=function(S,w,R,O,E,y){y===void 0&&(y=!1);var d=this.elementaryStreams,l=d[S];if(!l){d[S]={startPTS:w,endPTS:R,startDTS:O,endDTS:E,partial:y};return}l.startPTS=Math.min(l.startPTS,w),l.endPTS=Math.max(l.endPTS,R),l.startDTS=Math.min(l.startDTS,O),l.endDTS=Math.max(l.endDTS,E)},f.clearElementaryStreamInfo=function(){var S=this.elementaryStreams;S[o.AUDIO]=null,S[o.VIDEO]=null,S[o.AUDIOVIDEO]=null},p(c,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var S=this.sn;typeof S!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&Y.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),S=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,S)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(ee.isFiniteNumber)(this.programDateTime))return null;var S=Object(ee.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+S*1e3}},{key:"encrypted",get:function(){var S;return!!((S=this.decryptdata)!==null&&S!==void 0&&S.keyFormat&&this.decryptdata.uri)}}]),c}(u),i=function(t){D(c,t);function c(f,A,S,w,R){var O;O=t.call(this,S)||this,O.fragOffset=0,O.duration=0,O.gap=!1,O.independent=!1,O.relurl=void 0,O.fragment=void 0,O.index=void 0,O.stats=new k.LoadStats,O.duration=f.decimalFloatingPoint("DURATION"),O.gap=f.bool("GAP"),O.independent=f.bool("INDEPENDENT"),O.relurl=f.enumeratedString("URI"),O.fragment=A,O.index=w;var E=f.enumeratedString("BYTERANGE");return E&&O.setByteRange(E,R),R&&(O.fragOffset=R.fragOffset+R.duration),O}return p(c,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var A=this.elementaryStreams;return!!(A.audio||A.video||A.audiovideo)}}]),c}(u)},"./src/loader/key-loader.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"default",function(){return Y});var ee=U("./src/events.ts"),H=U("./src/errors.ts"),M=U("./src/utils/logger.ts"),Y=function(){function X(D){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=D,this._registerListeners()}var k=X.prototype;return k._registerListeners=function(){this.hls.on(ee.Events.KEY_LOADING,this.onKeyLoading,this)},k._unregisterListeners=function(){this.hls.off(ee.Events.KEY_LOADING,this.onKeyLoading)},k.destroy=function(){this._unregisterListeners();for(var v in this.loaders){var _=this.loaders[v];_&&_.destroy()}this.loaders={}},k.onKeyLoading=function(v,_){var p=_.frag,o=p.type,u=this.loaders[o];if(!p.decryptdata){M.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var r=p.decryptdata.uri;if(r!==this.decrypturl||this.decryptkey===null){var i=this.hls.config;if(u&&(M.logger.warn("abort previous key loader for type:"+o),u.abort()),!r){M.logger.warn("key uri is falsy");return}var t=i.loader,c=p.loader=this.loaders[o]=new t(i);this.decrypturl=r,this.decryptkey=null;var f={url:r,frag:p,responseType:"arraybuffer"},A={timeout:i.fragLoadingTimeOut,maxRetry:0,retryDelay:i.fragLoadingRetryDelay,maxRetryDelay:i.fragLoadingMaxRetryTimeout,highWaterMark:0},S={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};c.load(f,A,S)}else this.decryptkey&&(p.decryptdata.key=this.decryptkey,this.hls.trigger(ee.Events.KEY_LOADED,{frag:p}))},k.loadsuccess=function(v,_,p){var o=p.frag;if(!o.decryptdata){M.logger.error("after key load, decryptdata unset");return}this.decryptkey=o.decryptdata.key=new Uint8Array(v.data),o.loader=null,delete this.loaders[o.type],this.hls.trigger(ee.Events.KEY_LOADED,{frag:o})},k.loaderror=function(v,_){var p=_.frag,o=p.loader;o&&o.abort(),delete this.loaders[p.type],this.hls.trigger(ee.Events.ERROR,{type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:p,response:v})},k.loadtimeout=function(v,_){var p=_.frag,o=p.loader;o&&o.abort(),delete this.loaders[p.type],this.hls.trigger(ee.Events.ERROR,{type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:p})},X}()},"./src/loader/level-details.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"LevelDetails",function(){return X});var ee=U("./src/polyfills/number.ts");function H(k,D){for(var v=0;v<D.length;v++){var _=D[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(k,_.key,_)}}function M(k,D,v){return D&&H(k.prototype,D),v&&H(k,v),k}var Y=10,X=function(){function k(v){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=v}var D=k.prototype;return D.reloaded=function(_){if(!_){this.advanced=!0,this.updated=!0;return}var p=this.lastPartSn-_.lastPartSn,o=this.lastPartIndex-_.lastPartIndex;this.updated=this.endSN!==_.endSN||!!o||!!p,this.advanced=this.endSN>_.endSN||p>0||p===0&&o>0,this.updated||this.advanced?this.misses=Math.floor(_.misses*.6):this.misses=_.misses+1,this.availabilityDelay=_.availabilityDelay},M(k,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(ee.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||Y}},{key:"drift",get:function(){var _=this.driftEndTime-this.driftStartTime;if(_>0){var p=this.driftEnd-this.driftStart;return p*1e3/_}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var _;return(_=this.partList)!==null&&_!==void 0&&_.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var _;return(_=this.fragments)!==null&&_!==void 0&&_.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var _;return(_=this.partList)!==null&&_!==void 0&&_.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var _;return(_=this.partList)!==null&&_!==void 0&&_.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),k}()},"./src/loader/level-key.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"LevelKey",function(){return X});var ee=U("./node_modules/url-toolkit/src/url-toolkit.js"),H=U.n(ee);function M(k,D){for(var v=0;v<D.length;v++){var _=D[v];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(k,_.key,_)}}function Y(k,D,v){return D&&M(k.prototype,D),v&&M(k,v),k}var X=function(){k.fromURL=function(v,_){return new k(v,_)},k.fromURI=function(v){return new k(v)};function k(D,v){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,v?this._uri=Object(ee.buildAbsoluteURL)(D,v,{alwaysNormalize:!0}):this._uri=D}return Y(k,[{key:"uri",get:function(){return this._uri}}]),k}()},"./src/loader/load-stats.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"LoadStats",function(){return ee});var ee=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"default",function(){return c});var ee=U("./src/polyfills/number.ts"),H=U("./node_modules/url-toolkit/src/url-toolkit.js"),M=U.n(H),Y=U("./src/loader/fragment.ts"),X=U("./src/loader/level-details.ts"),k=U("./src/loader/level-key.ts"),D=U("./src/utils/attr-list.ts"),v=U("./src/utils/logger.ts"),_=U("./src/utils/codecs.ts"),p=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,o=/#EXT-X-MEDIA:(.*)/g,u=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),r=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),i=/\.(mp4|m4s|m4v|m4a)$/i;function t(R){var O,E;return i.test((O=(E=H.parseURL(R))===null||E===void 0?void 0:E.path)!=null?O:"")}var c=function(){function R(){}return R.findGroup=function(E,y){for(var d=0;d<E.length;d++){var l=E[d];if(l.id===y)return l}},R.convertAVC1ToAVCOTI=function(E){var y=E.split(".");if(y.length>2){var d=y.shift()+".";return d+=parseInt(y.shift()).toString(16),d+=("000"+parseInt(y.shift()).toString(16)).substr(-4),d}return E},R.resolve=function(E,y){return H.buildAbsoluteURL(y,E,{alwaysNormalize:!0})},R.parseMasterPlaylist=function(E,y){var d=[],l={},h=!1;p.lastIndex=0;for(var g;(g=p.exec(E))!=null;)if(g[1]){var b=new D.AttrList(g[1]),F={attrs:b,bitrate:b.decimalInteger("AVERAGE-BANDWIDTH")||b.decimalInteger("BANDWIDTH"),name:b.NAME,url:R.resolve(g[2],y)},N=b.decimalResolution("RESOLUTION");N&&(F.width=N.width,F.height=N.height),f((b.CODECS||"").split(/[ ,]+/).filter(function(K){return K}),F),F.videoCodec&&F.videoCodec.indexOf("avc1")!==-1&&(F.videoCodec=R.convertAVC1ToAVCOTI(F.videoCodec)),d.push(F)}else if(g[3]){var W=new D.AttrList(g[3]);W["DATA-ID"]&&(h=!0,l[W["DATA-ID"]]=W)}return{levels:d,sessionData:h?l:null}},R.parseMasterPlaylistMedia=function(E,y,d,l){l===void 0&&(l=[]);var h,g=[],b=0;for(o.lastIndex=0;(h=o.exec(E))!==null;){var F=new D.AttrList(h[1]);if(F.TYPE===d){var N={attrs:F,bitrate:0,id:b++,groupId:F["GROUP-ID"],instreamId:F["INSTREAM-ID"],name:F.NAME||F.LANGUAGE||"",type:d,default:F.bool("DEFAULT"),autoselect:F.bool("AUTOSELECT"),forced:F.bool("FORCED"),lang:F.LANGUAGE,url:F.URI?R.resolve(F.URI,y):""};if(l.length){var W=R.findGroup(l,N.groupId)||l[0];A(N,W,"audioCodec"),A(N,W,"textCodec")}g.push(N)}}return g},R.parseLevelPlaylist=function(E,y,d,l,h){var g=new X.LevelDetails(y),b=g.fragments,F=null,N=0,W=0,K=0,I=0,x=null,j=new Y.Fragment(l,y),$,ae,fe,pe=-1,Ce=!1;for(u.lastIndex=0,g.m3u8=E;($=u.exec(E))!==null;){Ce&&(Ce=!1,j=new Y.Fragment(l,y),j.start=K,j.sn=N,j.cc=I,j.level=d,F&&(j.initSegment=F,j.rawProgramDateTime=F.rawProgramDateTime));var De=$[1];if(De){j.duration=parseFloat(De);var xe=(" "+$[2]).slice(1);j.title=xe||null,j.tagList.push(xe?["INF",De,xe]:["INF",De])}else if($[3])Object(ee.isFiniteNumber)(j.duration)&&(j.start=K,fe&&(j.levelkey=fe),j.sn=N,j.level=d,j.cc=I,j.urlId=h,b.push(j),j.relurl=(" "+$[3]).slice(1),w(j,x),x=j,K+=j.duration,N++,W=0,Ce=!0);else if($[4]){var Oe=(" "+$[4]).slice(1);x?j.setByteRange(Oe,x):j.setByteRange(Oe)}else if($[5])j.rawProgramDateTime=(" "+$[5]).slice(1),j.tagList.push(["PROGRAM-DATE-TIME",j.rawProgramDateTime]),pe===-1&&(pe=b.length);else{if($=$[0].match(r),!$){v.logger.warn("No matches on slow regex match for level playlist!");continue}for(ae=1;ae<$.length&&!(typeof $[ae]!="undefined");ae++);var Ee=(" "+$[ae]).slice(1),be=(" "+$[ae+1]).slice(1),te=$[ae+2]?(" "+$[ae+2]).slice(1):"";switch(Ee){case"PLAYLIST-TYPE":g.type=be.toUpperCase();break;case"MEDIA-SEQUENCE":N=g.startSN=parseInt(be);break;case"SKIP":{var me=new D.AttrList(be),ye=me.decimalInteger("SKIPPED-SEGMENTS");if(Object(ee.isFiniteNumber)(ye)){g.skippedSegments=ye;for(var Le=ye;Le--;)b.unshift(null);N+=ye}var $e=me.enumeratedString("RECENTLY-REMOVED-DATERANGES");$e&&(g.recentlyRemovedDateranges=$e.split(" "));break}case"TARGETDURATION":g.targetduration=parseFloat(be);break;case"VERSION":g.version=parseInt(be);break;case"EXTM3U":break;case"ENDLIST":g.live=!1;break;case"#":(be||te)&&j.tagList.push(te?[be,te]:[be]);break;case"DIS":I++;case"GAP":j.tagList.push([Ee]);break;case"BITRATE":j.tagList.push([Ee,be]);break;case"DISCONTINUITY-SEQ":I=parseInt(be);break;case"KEY":{var Me,ze=new D.AttrList(be),ot=ze.enumeratedString("METHOD"),Et=ze.URI,_t=ze.hexadecimalInteger("IV"),mt=ze.enumeratedString("KEYFORMATVERSIONS"),ut=ze.enumeratedString("KEYID"),Xt=(Me=ze.enumeratedString("KEYFORMAT"))!=null?Me:"identity",en=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(en.indexOf(Xt)>-1){v.logger.warn("Keyformat "+Xt+" is not supported from the manifest");continue}else if(Xt!=="identity")continue;ot&&(fe=k.LevelKey.fromURL(y,Et),Et&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(ot)>=0&&(fe.method=ot,fe.keyFormat=Xt,ut&&(fe.keyID=ut),mt&&(fe.keyFormatVersions=mt),fe.iv=_t));break}case"START":{var sn=new D.AttrList(be),pn=sn.decimalFloatingPoint("TIME-OFFSET");Object(ee.isFiniteNumber)(pn)&&(g.startTimeOffset=pn);break}case"MAP":{var Un=new D.AttrList(be);j.relurl=Un.URI,Un.BYTERANGE&&j.setByteRange(Un.BYTERANGE),j.level=d,j.sn="initSegment",fe&&(j.levelkey=fe),j.initSegment=null,F=j,Ce=!0;break}case"SERVER-CONTROL":{var Cn=new D.AttrList(be);g.canBlockReload=Cn.bool("CAN-BLOCK-RELOAD"),g.canSkipUntil=Cn.optionalFloat("CAN-SKIP-UNTIL",0),g.canSkipDateRanges=g.canSkipUntil>0&&Cn.bool("CAN-SKIP-DATERANGES"),g.partHoldBack=Cn.optionalFloat("PART-HOLD-BACK",0),g.holdBack=Cn.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Qe=new D.AttrList(be);g.partTarget=Qe.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ye=g.partList;Ye||(Ye=g.partList=[]);var St=W>0?Ye[Ye.length-1]:void 0,bt=W++,nt=new Y.Part(new D.AttrList(be),j,y,bt,St);Ye.push(nt),j.duration+=nt.duration;break}case"PRELOAD-HINT":{var vt=new D.AttrList(be);g.preloadHint=vt;break}case"RENDITION-REPORT":{var Ue=new D.AttrList(be);g.renditionReports=g.renditionReports||[],g.renditionReports.push(Ue);break}default:v.logger.warn("line parsed but not handled: "+$);break}}}x&&!x.relurl?(b.pop(),K-=x.duration,g.partList&&(g.fragmentHint=x)):g.partList&&(w(j,x),j.cc=I,g.fragmentHint=j);var Ae=b.length,Re=b[0],le=b[Ae-1];if(K+=g.skippedSegments*g.targetduration,K>0&&Ae&&le){g.averagetargetduration=K/Ae;var he=le.sn;g.endSN=he!=="initSegment"?he:0,Re&&(g.startCC=Re.cc,Re.initSegment||g.fragments.every(function(Se){return Se.relurl&&t(Se.relurl)})&&(v.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),j=new Y.Fragment(l,y),j.relurl=le.relurl,j.level=d,j.sn="initSegment",Re.initSegment=j,g.needSidxRanges=!0))}else g.endSN=0,g.startCC=0;return g.fragmentHint&&(K+=g.fragmentHint.duration),g.totalduration=K,g.endCC=I,pe>0&&S(b,pe),g},R}();function f(R,O){["video","audio","text"].forEach(function(E){var y=R.filter(function(l){return Object(_.isCodecType)(l,E)});if(y.length){var d=y.filter(function(l){return l.lastIndexOf("avc1",0)===0||l.lastIndexOf("mp4a",0)===0});O[E+"Codec"]=d.length>0?d[0]:y[0],R=R.filter(function(l){return y.indexOf(l)===-1})}}),O.unknownCodecs=R}function A(R,O,E){var y=O[E];y&&(R[E]=y)}function S(R,O){for(var E=R[O],y=O;y--;){var d=R[y];if(!d)return;d.programDateTime=E.programDateTime-d.duration*1e3,E=d}}function w(R,O){R.rawProgramDateTime?R.programDateTime=Date.parse(R.rawProgramDateTime):O!=null&&O.programDateTime&&(R.programDateTime=O.endProgramDateTime),Object(ee.isFiniteNumber)(R.programDateTime)||(R.programDateTime=null,R.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ie,Z,U){"use strict";U.r(Z);var ee=U("./src/polyfills/number.ts"),H=U("./src/events.ts"),M=U("./src/errors.ts"),Y=U("./src/utils/logger.ts"),X=U("./src/utils/mp4-tools.ts"),k=U("./src/loader/m3u8-parser.ts"),D=U("./src/types/loader.ts"),v=U("./src/utils/attr-list.ts");function _(u){var r=u.type;switch(r){case D.PlaylistContextType.AUDIO_TRACK:return D.PlaylistLevelType.AUDIO;case D.PlaylistContextType.SUBTITLE_TRACK:return D.PlaylistLevelType.SUBTITLE;default:return D.PlaylistLevelType.MAIN}}function p(u,r){var i=u.url;return(i===void 0||i.indexOf("data:")===0)&&(i=r.url),i}var o=function(){function u(i){this.hls=void 0,this.loaders=Object.create(null),this.hls=i,this.registerListeners()}var r=u.prototype;return r.registerListeners=function(){var t=this.hls;t.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),t.on(H.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.on(H.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},r.unregisterListeners=function(){var t=this.hls;t.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(H.Events.LEVEL_LOADING,this.onLevelLoading,this),t.off(H.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.off(H.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},r.createInternalLoader=function(t){var c=this.hls.config,f=c.pLoader,A=c.loader,S=f||A,w=new S(c);return t.loader=w,this.loaders[t.type]=w,w},r.getInternalLoader=function(t){return this.loaders[t.type]},r.resetInternalLoader=function(t){this.loaders[t]&&delete this.loaders[t]},r.destroyInternalLoaders=function(){for(var t in this.loaders){var c=this.loaders[t];c&&c.destroy(),this.resetInternalLoader(t)}},r.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},r.onManifestLoading=function(t,c){var f=c.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:D.PlaylistContextType.MANIFEST,url:f,deliveryDirectives:null})},r.onLevelLoading=function(t,c){var f=c.id,A=c.level,S=c.url,w=c.deliveryDirectives;this.load({id:f,groupId:null,level:A,responseType:"text",type:D.PlaylistContextType.LEVEL,url:S,deliveryDirectives:w})},r.onAudioTrackLoading=function(t,c){var f=c.id,A=c.groupId,S=c.url,w=c.deliveryDirectives;this.load({id:f,groupId:A,level:null,responseType:"text",type:D.PlaylistContextType.AUDIO_TRACK,url:S,deliveryDirectives:w})},r.onSubtitleTrackLoading=function(t,c){var f=c.id,A=c.groupId,S=c.url,w=c.deliveryDirectives;this.load({id:f,groupId:A,level:null,responseType:"text",type:D.PlaylistContextType.SUBTITLE_TRACK,url:S,deliveryDirectives:w})},r.load=function(t){var c,f=this.hls.config,A=this.getInternalLoader(t);if(A){var S=A.context;if(S&&S.url===t.url){Y.logger.trace("[playlist-loader]: playlist request ongoing");return}Y.logger.log("[playlist-loader]: aborting previous loader for type: "+t.type),A.abort()}var w,R,O,E;switch(t.type){case D.PlaylistContextType.MANIFEST:w=f.manifestLoadingMaxRetry,R=f.manifestLoadingTimeOut,O=f.manifestLoadingRetryDelay,E=f.manifestLoadingMaxRetryTimeout;break;case D.PlaylistContextType.LEVEL:case D.PlaylistContextType.AUDIO_TRACK:case D.PlaylistContextType.SUBTITLE_TRACK:w=0,R=f.levelLoadingTimeOut;break;default:w=f.levelLoadingMaxRetry,R=f.levelLoadingTimeOut,O=f.levelLoadingRetryDelay,E=f.levelLoadingMaxRetryTimeout;break}if(A=this.createInternalLoader(t),(c=t.deliveryDirectives)!==null&&c!==void 0&&c.part){var y;if(t.type===D.PlaylistContextType.LEVEL&&t.level!==null?y=this.hls.levels[t.level].details:t.type===D.PlaylistContextType.AUDIO_TRACK&&t.id!==null?y=this.hls.audioTracks[t.id].details:t.type===D.PlaylistContextType.SUBTITLE_TRACK&&t.id!==null&&(y=this.hls.subtitleTracks[t.id].details),y){var d=y.partTarget,l=y.targetduration;d&&l&&(R=Math.min(Math.max(d*3,l*.8)*1e3,R))}}var h={timeout:R,maxRetry:w,retryDelay:O,maxRetryDelay:E,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};A.load(t,h,g)},r.loadsuccess=function(t,c,f,A){if(A===void 0&&(A=null),f.isSidxRequest){this.handleSidxRequest(t,f),this.handlePlaylistLoaded(t,c,f,A);return}this.resetInternalLoader(f.type);var S=t.data;if(S.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(t,f,"no EXTM3U delimiter",A);return}c.parsing.start=performance.now(),S.indexOf("#EXTINF:")>0||S.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(t,c,f,A):this.handleMasterPlaylist(t,c,f,A)},r.loaderror=function(t,c,f){f===void 0&&(f=null),this.handleNetworkError(c,f,!1,t)},r.loadtimeout=function(t,c,f){f===void 0&&(f=null),this.handleNetworkError(c,f,!0)},r.handleMasterPlaylist=function(t,c,f,A){var S=this.hls,w=t.data,R=p(t,f),O=k.default.parseMasterPlaylist(w,R),E=O.levels,y=O.sessionData;if(!E.length){this.handleManifestParsingError(t,f,"no level found in manifest",A);return}var d=E.map(function(N){return{id:N.attrs.AUDIO,audioCodec:N.audioCodec}}),l=E.map(function(N){return{id:N.attrs.SUBTITLES,textCodec:N.textCodec}}),h=k.default.parseMasterPlaylistMedia(w,R,"AUDIO",d),g=k.default.parseMasterPlaylistMedia(w,R,"SUBTITLES",l),b=k.default.parseMasterPlaylistMedia(w,R,"CLOSED-CAPTIONS");if(h.length){var F=h.some(function(N){return!N.url});!F&&E[0].audioCodec&&!E[0].attrs.AUDIO&&(Y.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),h.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new v.AttrList({}),bitrate:0,url:""}))}S.trigger(H.Events.MANIFEST_LOADED,{levels:E,audioTracks:h,subtitles:g,captions:b,url:R,stats:c,networkDetails:A,sessionData:y})},r.handleTrackOrLevelPlaylist=function(t,c,f,A){var S=this.hls,w=f.id,R=f.level,O=f.type,E=p(t,f),y=Object(ee.isFiniteNumber)(w)?w:0,d=Object(ee.isFiniteNumber)(R)?R:y,l=_(f),h=k.default.parseLevelPlaylist(t.data,E,d,l,y);if(!h.fragments.length){S.trigger(H.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:E,reason:"no fragments found in level",level:typeof f.level=="number"?f.level:void 0});return}if(O===D.PlaylistContextType.MANIFEST){var g={attrs:new v.AttrList({}),bitrate:0,details:h,name:"",url:E};S.trigger(H.Events.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:E,stats:c,networkDetails:A,sessionData:null})}if(c.parsing.end=performance.now(),h.needSidxRanges){var b,F=(b=h.fragments[0].initSegment)===null||b===void 0?void 0:b.url;this.load({url:F,isSidxRequest:!0,type:O,level:R,levelDetails:h,id:w,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}f.levelDetails=h,this.handlePlaylistLoaded(t,c,f,A)},r.handleSidxRequest=function(t,c){var f=Object(X.parseSegmentIndex)(new Uint8Array(t.data));if(!f)return;var A=f.references,S=c.levelDetails;A.forEach(function(w,R){var O=w.info,E=S.fragments[R];E.byteRange.length===0&&E.setByteRange(String(1+O.end-O.start)+"@"+String(O.start)),E.initSegment&&E.initSegment.setByteRange(String(f.moovEndOffset)+"@0")})},r.handleManifestParsingError=function(t,c,f,A){this.hls.trigger(H.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:c.type===D.PlaylistContextType.MANIFEST,url:t.url,reason:f,response:t,context:c,networkDetails:A})},r.handleNetworkError=function(t,c,f,A){f===void 0&&(f=!1),Y.logger.warn("[playlist-loader]: A network "+(f?"timeout":"error")+" occurred while loading "+t.type+" level: "+t.level+" id: "+t.id+' group-id: "'+t.groupId+'"');var S=M.ErrorDetails.UNKNOWN,w=!1,R=this.getInternalLoader(t);switch(t.type){case D.PlaylistContextType.MANIFEST:S=f?M.ErrorDetails.MANIFEST_LOAD_TIMEOUT:M.ErrorDetails.MANIFEST_LOAD_ERROR,w=!0;break;case D.PlaylistContextType.LEVEL:S=f?M.ErrorDetails.LEVEL_LOAD_TIMEOUT:M.ErrorDetails.LEVEL_LOAD_ERROR,w=!1;break;case D.PlaylistContextType.AUDIO_TRACK:S=f?M.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:M.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,w=!1;break;case D.PlaylistContextType.SUBTITLE_TRACK:S=f?M.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:M.ErrorDetails.SUBTITLE_LOAD_ERROR,w=!1;break}R&&this.resetInternalLoader(t.type);var O={type:M.ErrorTypes.NETWORK_ERROR,details:S,fatal:w,url:t.url,loader:R,context:t,networkDetails:c};A&&(O.response=A),this.hls.trigger(H.Events.ERROR,O)},r.handlePlaylistLoaded=function(t,c,f,A){var S=f.type,w=f.level,R=f.id,O=f.groupId,E=f.loader,y=f.levelDetails,d=f.deliveryDirectives;if(!(y!=null&&y.targetduration)){this.handleManifestParsingError(t,f,"invalid target duration",A);return}if(!E)return;y.live&&(E.getCacheAge&&(y.ageHeader=E.getCacheAge()||0),(!E.getCacheAge||isNaN(y.ageHeader))&&(y.ageHeader=0));switch(S){case D.PlaylistContextType.MANIFEST:case D.PlaylistContextType.LEVEL:this.hls.trigger(H.Events.LEVEL_LOADED,{details:y,level:w||0,id:R||0,stats:c,networkDetails:A,deliveryDirectives:d});break;case D.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(H.Events.AUDIO_TRACK_LOADED,{details:y,id:R||0,groupId:O||"",stats:c,networkDetails:A,deliveryDirectives:d});break;case D.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(H.Events.SUBTITLE_TRACK_LOADED,{details:y,id:R||0,groupId:O||"",stats:c,networkDetails:A,deliveryDirectives:d});break}},u}();Z.default=o},"./src/polyfills/number.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"isFiniteNumber",function(){return ee}),U.d(Z,"MAX_SAFE_INTEGER",function(){return H});var ee=Number.isFinite||function(M){return typeof M=="number"&&isFinite(M)},H=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ie,Z,U){"use strict";U.r(Z);var ee=function(){function H(){}return H.getSilentFrame=function(Y,X){switch(Y){case"mp4a.40.2":if(X===1)return new Uint8Array([0,200,0,128,35,128]);if(X===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(X===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(X===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(X===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(X===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(X===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(X===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(X===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},H}();Z.default=ee},"./src/remux/mp4-generator.ts":function(ie,Z,U){"use strict";U.r(Z);var ee=Math.pow(2,32)-1,H=function(){function M(){}return M.init=function(){M.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var X;for(X in M.types)M.types.hasOwnProperty(X)&&(M.types[X]=[X.charCodeAt(0),X.charCodeAt(1),X.charCodeAt(2),X.charCodeAt(3)]);var k=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),D=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);M.HDLR_TYPES={video:k,audio:D};var v=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),_=new Uint8Array([0,0,0,0,0,0,0,0]);M.STTS=M.STSC=M.STCO=_,M.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),M.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),M.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),M.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var p=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),u=new Uint8Array([0,0,0,1]);M.FTYP=M.box(M.types.ftyp,p,u,p,o),M.DINF=M.box(M.types.dinf,M.box(M.types.dref,v))},M.box=function(X){for(var k=8,D=arguments.length,v=new Array(D>1?D-1:0),_=1;_<D;_++)v[_-1]=arguments[_];for(var p=v.length,o=p;p--;)k+=v[p].byteLength;var u=new Uint8Array(k);for(u[0]=k>>24&255,u[1]=k>>16&255,u[2]=k>>8&255,u[3]=k&255,u.set(X,4),p=0,k=8;p<o;p++)u.set(v[p],k),k+=v[p].byteLength;return u},M.hdlr=function(X){return M.box(M.types.hdlr,M.HDLR_TYPES[X])},M.mdat=function(X){return M.box(M.types.mdat,X)},M.mdhd=function(X,k){k*=X;var D=Math.floor(k/(ee+1)),v=Math.floor(k%(ee+1));return M.box(M.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,X>>24&255,X>>16&255,X>>8&255,X&255,D>>24,D>>16&255,D>>8&255,D&255,v>>24,v>>16&255,v>>8&255,v&255,85,196,0,0]))},M.mdia=function(X){return M.box(M.types.mdia,M.mdhd(X.timescale,X.duration),M.hdlr(X.type),M.minf(X))},M.mfhd=function(X){return M.box(M.types.mfhd,new Uint8Array([0,0,0,0,X>>24,X>>16&255,X>>8&255,X&255]))},M.minf=function(X){return X.type==="audio"?M.box(M.types.minf,M.box(M.types.smhd,M.SMHD),M.DINF,M.stbl(X)):M.box(M.types.minf,M.box(M.types.vmhd,M.VMHD),M.DINF,M.stbl(X))},M.moof=function(X,k,D){return M.box(M.types.moof,M.mfhd(X),M.traf(D,k))},M.moov=function(X){for(var k=X.length,D=[];k--;)D[k]=M.trak(X[k]);return M.box.apply(null,[M.types.moov,M.mvhd(X[0].timescale,X[0].duration)].concat(D).concat(M.mvex(X)))},M.mvex=function(X){for(var k=X.length,D=[];k--;)D[k]=M.trex(X[k]);return M.box.apply(null,[M.types.mvex].concat(D))},M.mvhd=function(X,k){k*=X;var D=Math.floor(k/(ee+1)),v=Math.floor(k%(ee+1)),_=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,X>>24&255,X>>16&255,X>>8&255,X&255,D>>24,D>>16&255,D>>8&255,D&255,v>>24,v>>16&255,v>>8&255,v&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return M.box(M.types.mvhd,_)},M.sdtp=function(X){var k=X.samples||[],D=new Uint8Array(4+k.length),v,_;for(v=0;v<k.length;v++)_=k[v].flags,D[v+4]=_.dependsOn<<4|_.isDependedOn<<2|_.hasRedundancy;return M.box(M.types.sdtp,D)},M.stbl=function(X){return M.box(M.types.stbl,M.stsd(X),M.box(M.types.stts,M.STTS),M.box(M.types.stsc,M.STSC),M.box(M.types.stsz,M.STSZ),M.box(M.types.stco,M.STCO))},M.avc1=function(X){var k=[],D=[],v,_,p;for(v=0;v<X.sps.length;v++)_=X.sps[v],p=_.byteLength,k.push(p>>>8&255),k.push(p&255),k=k.concat(Array.prototype.slice.call(_));for(v=0;v<X.pps.length;v++)_=X.pps[v],p=_.byteLength,D.push(p>>>8&255),D.push(p&255),D=D.concat(Array.prototype.slice.call(_));var o=M.box(M.types.avcC,new Uint8Array([1,k[3],k[4],k[5],252|3,224|X.sps.length].concat(k).concat([X.pps.length]).concat(D))),u=X.width,r=X.height,i=X.pixelRatio[0],t=X.pixelRatio[1];return M.box(M.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,u>>8&255,u&255,r>>8&255,r&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,M.box(M.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),M.box(M.types.pasp,new Uint8Array([i>>24,i>>16&255,i>>8&255,i&255,t>>24,t>>16&255,t>>8&255,t&255])))},M.esds=function(X){var k=X.config.length;return new Uint8Array([0,0,0,0,3,23+k,0,1,0,4,15+k,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([k]).concat(X.config).concat([6,1,2]))},M.mp4a=function(X){var k=X.samplerate;return M.box(M.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,X.channelCount,0,16,0,0,0,0,k>>8&255,k&255,0,0]),M.box(M.types.esds,M.esds(X)))},M.mp3=function(X){var k=X.samplerate;return M.box(M.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,X.channelCount,0,16,0,0,0,0,k>>8&255,k&255,0,0]))},M.stsd=function(X){return X.type==="audio"?!X.isAAC&&X.codec==="mp3"?M.box(M.types.stsd,M.STSD,M.mp3(X)):M.box(M.types.stsd,M.STSD,M.mp4a(X)):M.box(M.types.stsd,M.STSD,M.avc1(X))},M.tkhd=function(X){var k=X.id,D=X.duration*X.timescale,v=X.width,_=X.height,p=Math.floor(D/(ee+1)),o=Math.floor(D%(ee+1));return M.box(M.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,k>>24&255,k>>16&255,k>>8&255,k&255,0,0,0,0,p>>24,p>>16&255,p>>8&255,p&255,o>>24,o>>16&255,o>>8&255,o&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,v>>8&255,v&255,0,0,_>>8&255,_&255,0,0]))},M.traf=function(X,k){var D=M.sdtp(X),v=X.id,_=Math.floor(k/(ee+1)),p=Math.floor(k%(ee+1));return M.box(M.types.traf,M.box(M.types.tfhd,new Uint8Array([0,0,0,0,v>>24,v>>16&255,v>>8&255,v&255])),M.box(M.types.tfdt,new Uint8Array([1,0,0,0,_>>24,_>>16&255,_>>8&255,_&255,p>>24,p>>16&255,p>>8&255,p&255])),M.trun(X,D.length+16+20+8+16+8+8),D)},M.trak=function(X){return X.duration=X.duration||4294967295,M.box(M.types.trak,M.tkhd(X),M.mdia(X))},M.trex=function(X){var k=X.id;return M.box(M.types.trex,new Uint8Array([0,0,0,0,k>>24,k>>16&255,k>>8&255,k&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},M.trun=function(X,k){var D=X.samples||[],v=D.length,_=12+16*v,p=new Uint8Array(_),o,u,r,i,t,c;for(k+=8+_,p.set([0,0,15,1,v>>>24&255,v>>>16&255,v>>>8&255,v&255,k>>>24&255,k>>>16&255,k>>>8&255,k&255],0),o=0;o<v;o++)u=D[o],r=u.duration,i=u.size,t=u.flags,c=u.cts,p.set([r>>>24&255,r>>>16&255,r>>>8&255,r&255,i>>>24&255,i>>>16&255,i>>>8&255,i&255,t.isLeading<<2|t.dependsOn,t.isDependedOn<<6|t.hasRedundancy<<4|t.paddingValue<<1|t.isNonSync,t.degradPrio&240<<8,t.degradPrio&15,c>>>24&255,c>>>16&255,c>>>8&255,c&255],12+16*o);return M.box(M.types.trun,p)},M.initSegment=function(X){M.types||M.init();var k=M.moov(X),D=new Uint8Array(M.FTYP.byteLength+k.byteLength);return D.set(M.FTYP),D.set(k,M.FTYP.byteLength),D},M}();H.types=void 0,H.HDLR_TYPES=void 0,H.STTS=void 0,H.STSC=void 0,H.STCO=void 0,H.STSZ=void 0,H.VMHD=void 0,H.SMHD=void 0,H.STSD=void 0,H.FTYP=void 0,H.DINF=void 0,Z.default=H},"./src/remux/mp4-remuxer.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"default",function(){return c}),U.d(Z,"normalizePts",function(){return f});var ee=U("./src/polyfills/number.ts"),H=U("./src/remux/aac-helper.ts"),M=U("./src/remux/mp4-generator.ts"),Y=U("./src/events.ts"),X=U("./src/errors.ts"),k=U("./src/utils/logger.ts"),D=U("./src/types/loader.ts"),v=U("./src/utils/timescale-conversion.ts");function _(){return _=Object.assign||function(R){for(var O=1;O<arguments.length;O++){var E=arguments[O];for(var y in E)Object.prototype.hasOwnProperty.call(E,y)&&(R[y]=E[y])}return R},_.apply(this,arguments)}var p=10*1e3,o=1024,u=1152,r=null,i=null,t=!1,c=function(){function R(E,y,d,l){if(l===void 0&&(l=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=E,this.config=y,this.typeSupported=d,this.ISGenerated=!1,r===null){var h=navigator.userAgent||"",g=h.match(/Chrome\/(\d+)/i);r=g?parseInt(g[1]):0}if(i===null){var b=navigator.userAgent.match(/Safari\/(\d+)/i);i=b?parseInt(b[1]):0}t=!!r&&r<75||!!i&&i<600}var O=R.prototype;return O.destroy=function(){},O.resetTimeStamp=function(y){k.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=y},O.resetNextTimestamp=function(){k.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},O.resetInitSegment=function(){k.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},O.getVideoStartPts=function(y){var d=!1,l=y.reduce(function(h,g){var b=g.pts-h;return b<-4294967296?(d=!0,f(h,g.pts)):b>0?h:g.pts},y[0].pts);return d&&k.logger.debug("PTS rollover detected"),l},O.remux=function(y,d,l,h,g,b,F,N){var W,K,I,x,j,$,ae=g,fe=g,pe=y.pid>-1,Ce=d.pid>-1,De=d.samples.length,xe=y.samples.length>0,Oe=De>1,Ee=(!pe||xe)&&(!Ce||Oe)||this.ISGenerated||F;if(Ee){this.ISGenerated||(I=this.generateIS(y,d,g));var be=this.isVideoContiguous,te=-1;if(Oe&&(te=A(d.samples),!be&&this.config.forceKeyFrameOnDiscontinuity))if($=!0,te>0){k.logger.warn("[mp4-remuxer]: Dropped "+te+" out of "+De+" video samples due to a missing keyframe");var me=this.getVideoStartPts(d.samples);d.samples=d.samples.slice(te),d.dropped+=te,fe+=(d.samples[0].pts-me)/(d.timescale||9e4)}else te===-1&&(k.logger.warn("[mp4-remuxer]: No keyframe found out of "+De+" video samples"),$=!1);if(this.ISGenerated){if(xe&&Oe){var ye=this.getVideoStartPts(d.samples),Le=f(y.samples[0].pts,ye)-ye,$e=Le/d.inputTimeScale;ae+=Math.max(0,$e),fe+=Math.max(0,-$e)}if(xe){if(y.samplerate||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),I=this.generateIS(y,d,g)),K=this.remuxAudio(y,ae,this.isAudioContiguous,b,Ce||Oe||N===D.PlaylistLevelType.AUDIO?fe:void 0),Oe){var Me=K?K.endPTS-K.startPTS:0;d.inputTimeScale||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),I=this.generateIS(y,d,g)),W=this.remuxVideo(d,fe,be,Me)}}else Oe&&(W=this.remuxVideo(d,fe,be,0));W&&(W.firstKeyFrame=te,W.independent=te!==-1)}}return this.ISGenerated&&(l.samples.length&&(j=this.remuxID3(l,g)),h.samples.length&&(x=this.remuxText(h,g))),{audio:K,video:W,initSegment:I,independent:$,text:x,id3:j}},O.generateIS=function(y,d,l){var h=y.samples,g=d.samples,b=this.typeSupported,F={},N=!Object(ee.isFiniteNumber)(this._initPTS),W="audio/mp4",K,I,x;if(N&&(K=I=Infinity),y.config&&h.length&&(y.timescale=y.samplerate,y.isAAC||(b.mpeg?(W="audio/mpeg",y.codec=""):b.mp3&&(y.codec="mp3")),F.audio={id:"audio",container:W,codec:y.codec,initSegment:!y.isAAC&&b.mpeg?new Uint8Array(0):M.default.initSegment([y]),metadata:{channelCount:y.channelCount}},N&&(x=y.inputTimeScale,K=I=h[0].pts-Math.round(x*l))),d.sps&&d.pps&&g.length&&(d.timescale=d.inputTimeScale,F.video={id:"main",container:"video/mp4",codec:d.codec,initSegment:M.default.initSegment([d]),metadata:{width:d.width,height:d.height}},N)){x=d.inputTimeScale;var j=this.getVideoStartPts(g),$=Math.round(x*l);I=Math.min(I,f(g[0].dts,j)-$),K=Math.min(K,j-$)}if(Object.keys(F).length)return this.ISGenerated=!0,N&&(this._initPTS=K,this._initDTS=I),{tracks:F,initPTS:K,timescale:x}},O.remuxVideo=function(y,d,l,h){var g=y.inputTimeScale,b=y.samples,F=[],N=b.length,W=this._initPTS,K=this.nextAvcDts,I=8,x,j,$,ae=Number.POSITIVE_INFINITY,fe=Number.NEGATIVE_INFINITY,pe=0,Ce=!1;if(!l||K===null){var De=d*g,xe=b[0].pts-f(b[0].dts,b[0].pts);K=De-xe}for(var Oe=0;Oe<N;Oe++){var Ee=b[Oe];if(Ee.pts=f(Ee.pts-W,K),Ee.dts=f(Ee.dts-W,K),Ee.dts>Ee.pts){var be=9e4*.2;pe=Math.max(Math.min(pe,Ee.pts-Ee.dts),-1*be)}Ee.dts<b[Oe>0?Oe-1:Oe].dts&&(Ce=!0)}Ce&&b.sort(function(ci,Jn){var Sn=ci.dts-Jn.dts,pi=ci.pts-Jn.pts;return Sn||pi}),j=b[0].dts,$=b[b.length-1].dts;var te=Math.round(($-j)/(N-1));if(pe<0){if(pe<te*-2){k.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(v.toMsFromMpegTsClock)(-te,!0)+" ms");for(var me=pe,ye=0;ye<N;ye++)b[ye].dts=me=Math.max(me,b[ye].pts-te),b[ye].pts=Math.max(me,b[ye].pts)}else{k.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(v.toMsFromMpegTsClock)(pe,!0)+" ms to overcome this issue");for(var Le=0;Le<N;Le++)b[Le].dts=b[Le].dts+pe}j=b[0].dts}if(l){var $e=j-K,Me=$e>te,ze=$e<-1;if(Me||ze){Me?k.logger.warn("AVC: "+Object(v.toMsFromMpegTsClock)($e,!0)+" ms ("+$e+"dts) hole between fragments detected, filling it"):k.logger.warn("AVC: "+Object(v.toMsFromMpegTsClock)(-$e,!0)+" ms ("+$e+"dts) overlapping between fragments detected"),j=K;var ot=b[0].pts-$e;b[0].dts=j,b[0].pts=ot,k.logger.log("Video: First PTS/DTS adjusted: "+Object(v.toMsFromMpegTsClock)(ot,!0)+"/"+Object(v.toMsFromMpegTsClock)(j,!0)+", delta: "+Object(v.toMsFromMpegTsClock)($e,!0)+" ms")}}t&&(j=Math.max(0,j));for(var Et=0,_t=0,mt=0;mt<N;mt++){for(var ut=b[mt],Xt=ut.units,en=Xt.length,sn=0,pn=0;pn<en;pn++)sn+=Xt[pn].data.length;_t+=sn,Et+=en,ut.length=sn,ut.dts=Math.max(ut.dts,j),ut.pts=Math.max(ut.pts,ut.dts,0),ae=Math.min(ut.pts,ae),fe=Math.max(ut.pts,fe)}$=b[N-1].dts;var Un=_t+4*Et+8,Cn;try{Cn=new Uint8Array(Un)}catch(ci){this.observer.emit(Y.Events.ERROR,Y.Events.ERROR,{type:X.ErrorTypes.MUX_ERROR,details:X.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Un,reason:"fail allocating video mdat "+Un});return}var Qe=new DataView(Cn.buffer);Qe.setUint32(0,Un),Cn.set(M.default.types.mdat,4);for(var Ye=0;Ye<N;Ye++){for(var St=b[Ye],bt=St.units,nt=0,vt=0,Ue=bt.length;vt<Ue;vt++){var Ae=bt[vt],Re=Ae.data,le=Ae.data.byteLength;Qe.setUint32(I,le),I+=4,Cn.set(Re,I),I+=le,nt+=4+le}if(Ye<N-1)x=b[Ye+1].dts-St.dts;else{var he=this.config,Se=St.dts-b[Ye>0?Ye-1:Ye].dts;if(he.stretchShortVideoTrack&&this.nextAudioPts!==null){var ve=Math.floor(he.maxBufferHole*g),Pe=(h?ae+h*g:this.nextAudioPts)-St.pts;Pe>ve?(x=Pe-Se,x<0&&(x=Se),k.logger.log("[mp4-remuxer]: It is approximately "+Pe/90+" ms to the next segment; using duration "+x/90+" ms for the last video frame.")):x=Se}else x=Se}var it=Math.round(St.pts-St.dts);F.push(new S(St.key,x,nt,it))}if(F.length&&r&&r<70){var xt=F[0].flags;xt.dependsOn=2,xt.isNonSync=0}console.assert(x!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=K=$+x,this.isVideoContiguous=!0;var $t=M.default.moof(y.sequenceNumber++,j,_({},y,{samples:F})),mn="video",rn={data1:$t,data2:Cn,startPTS:ae/g,endPTS:(fe+x)/g,startDTS:j/g,endDTS:K/g,type:mn,hasAudio:!1,hasVideo:!0,nb:F.length,dropped:y.dropped};return y.samples=[],y.dropped=0,console.assert(Cn.length,"MDAT length must not be zero"),rn},O.remuxAudio=function(y,d,l,h,g){var b=y.inputTimeScale,F=y.samplerate?y.samplerate:b,N=b/F,W=y.isAAC?o:u,K=W*N,I=this._initPTS,x=!y.isAAC&&this.typeSupported.mpeg,j=[],$=y.samples,ae=x?0:8,fe=this.nextAudioPts||-1,pe=d*b;if(this.isAudioContiguous=l=l||$.length&&fe>0&&(h&&Math.abs(pe-fe)<9e3||Math.abs(f($[0].pts-I,pe)-fe)<20*K),$.forEach(function(Re){Re.pts=f(Re.pts-I,pe)}),!l||fe<0){if($=$.filter(function(Re){return Re.pts>=0}),!$.length)return;g===0?fe=0:h?fe=Math.max(0,pe):fe=$[0].pts}if(y.isAAC)for(var Ce=g!==void 0,De=this.config.maxAudioFramesDrift,xe=0,Oe=fe;xe<$.length;xe++){var Ee=$[xe],be=Ee.pts,te=be-Oe,me=Math.abs(1e3*te/b);if(te<=-De*K&&Ce)xe===0&&(k.logger.warn("Audio frame @ "+(be/b).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*te/b)+" ms."),this.nextAudioPts=fe=Oe=be);else if(te>=De*K&&me<p&&Ce){var ye=Math.round(te/K);Oe=be-ye*K,Oe<0&&(ye--,Oe+=K),xe===0&&(this.nextAudioPts=fe=Oe),k.logger.warn("[mp4-remuxer]: Injecting "+ye+" audio frame @ "+(Oe/b).toFixed(3)+"s due to "+Math.round(1e3*te/b)+" ms gap.");for(var Le=0;Le<ye;Le++){var $e=Math.max(Oe,0),Me=H.default.getSilentFrame(y.manifestCodec||y.codec,y.channelCount);Me||(k.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Me=Ee.unit.subarray()),$.splice(xe,0,{unit:Me,pts:$e}),Oe+=K,xe++}}Ee.pts=Oe,Oe+=K}for(var ze=null,ot=null,Et,_t=0,mt=$.length;mt--;)_t+=$[mt].unit.byteLength;for(var ut=0,Xt=$.length;ut<Xt;ut++){var en=$[ut],sn=en.unit,pn=en.pts;if(ot!==null){var Un=j[ut-1];Un.duration=Math.round((pn-ot)/N)}else if(l&&y.isAAC&&(pn=fe),ze=pn,_t>0){_t+=ae;try{Et=new Uint8Array(_t)}catch(Re){this.observer.emit(Y.Events.ERROR,Y.Events.ERROR,{type:X.ErrorTypes.MUX_ERROR,details:X.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:_t,reason:"fail allocating audio mdat "+_t});return}if(!x){var Cn=new DataView(Et.buffer);Cn.setUint32(0,_t),Et.set(M.default.types.mdat,4)}}else return;Et.set(sn,ae);var Qe=sn.byteLength;ae+=Qe,j.push(new S(!0,W,Qe,0)),ot=pn}var Ye=j.length;if(!Ye)return;var St=j[j.length-1];this.nextAudioPts=fe=ot+N*St.duration;var bt=x?new Uint8Array(0):M.default.moof(y.sequenceNumber++,ze/N,_({},y,{samples:j}));y.samples=[];var nt=ze/b,vt=fe/b,Ue="audio",Ae={data1:bt,data2:Et,startPTS:nt,endPTS:vt,startDTS:nt,endDTS:vt,type:Ue,hasAudio:!0,hasVideo:!1,nb:Ye};return this.isAudioContiguous=!0,console.assert(Et.length,"MDAT length must not be zero"),Ae},O.remuxEmptyAudio=function(y,d,l,h){var g=y.inputTimeScale,b=y.samplerate?y.samplerate:g,F=g/b,N=this.nextAudioPts,W=(N!==null?N:h.startDTS*g)+this._initDTS,K=h.endDTS*g+this._initDTS,I=F*o,x=Math.ceil((K-W)/I),j=H.default.getSilentFrame(y.manifestCodec||y.codec,y.channelCount);if(k.logger.warn("[mp4-remuxer]: remux empty Audio"),!j){k.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var $=[],ae=0;ae<x;ae++){var fe=W+ae*I;$.push({unit:j,pts:fe,dts:fe})}return y.samples=$,this.remuxAudio(y,d,l,!1)},O.remuxID3=function(y,d){var l=y.samples.length;if(!l)return;for(var h=y.inputTimeScale,g=this._initPTS,b=this._initDTS,F=0;F<l;F++){var N=y.samples[F];N.pts=f(N.pts-g,d*h)/h,N.dts=f(N.dts-b,d*h)/h}var W=y.samples;return y.samples=[],{samples:W}},O.remuxText=function(y,d){var l=y.samples.length;if(!l)return;for(var h=y.inputTimeScale,g=this._initPTS,b=0;b<l;b++){var F=y.samples[b];F.pts=f(F.pts-g,d*h)/h}y.samples.sort(function(W,K){return W.pts-K.pts});var N=y.samples;return y.samples=[],{samples:N}},R}();function f(R,O){var E;if(O===null)return R;for(O<R?E=-8589934592:E=8589934592;Math.abs(R-O)>4294967296;)R+=E;return R}function A(R){for(var O=0;O<R.length;O++)if(R[O].key)return O;return-1}var S=function(O,E,y,d){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=E,this.size=y,this.cts=d,this.flags=new w(O)},w=function(O){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=O?2:1,this.isNonSync=O?0:1}},"./src/remux/passthrough-remuxer.ts":function(ie,Z,U){"use strict";U.r(Z);var ee=U("./src/polyfills/number.ts"),H=U("./src/utils/mp4-tools.ts"),M=U("./src/loader/fragment.ts"),Y=U("./src/utils/logger.ts"),X=function(){function v(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var _=v.prototype;return _.destroy=function(){},_.resetTimeStamp=function(o){this.initPTS=o,this.lastEndDTS=null},_.resetNextTimestamp=function(){this.lastEndDTS=null},_.resetInitSegment=function(o,u,r){this.audioCodec=u,this.videoCodec=r,this.generateInitSegment(o),this.emitInitSegment=!0},_.generateInitSegment=function(o){var u=this.audioCodec,r=this.videoCodec;if(!o||!o.byteLength){this.initTracks=void 0,this.initData=void 0;return}var i=this.initData=Object(H.parseInitSegment)(o);u||(u=D(i.audio,M.ElementaryStreamTypes.AUDIO)),r||(r=D(i.video,M.ElementaryStreamTypes.VIDEO));var t={};i.audio&&i.video?t.audiovideo={container:"video/mp4",codec:u+","+r,initSegment:o,id:"main"}:i.audio?t.audio={container:"audio/mp4",codec:u,initSegment:o,id:"audio"}:i.video?t.video={container:"video/mp4",codec:r,initSegment:o,id:"main"}:Y.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=t},_.remux=function(o,u,r,i,t){var c=this.initPTS,f=this.lastEndDTS,A={audio:void 0,video:void 0,text:i,id3:r,initSegment:void 0};Object(ee.isFiniteNumber)(f)||(f=this.lastEndDTS=t||0);var S=u.samples;if(!S||!S.length)return A;var w={initPTS:void 0,timescale:1},R=this.initData;if((!R||!R.length)&&(this.generateInitSegment(S),R=this.initData),!R||!R.length)return Y.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),A;this.emitInitSegment&&(w.tracks=this.initTracks,this.emitInitSegment=!1),Object(ee.isFiniteNumber)(c)||(this.initPTS=w.initPTS=c=k(R,S,f));var O=Object(H.getDuration)(S,R),E=f,y=O+E;Object(H.offsetStartDTS)(R,S,c),O>0?this.lastEndDTS=y:(Y.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var d=!!R.audio,l=!!R.video,h="";d&&(h+="audio"),l&&(h+="video");var g={data1:S,startPTS:E,startDTS:E,endPTS:y,endDTS:y,type:h,hasAudio:d,hasVideo:l,nb:1,dropped:0};return A.audio=g.type==="audio"?g:void 0,A.video=g.type!=="audio"?g:void 0,A.text=i,A.id3=r,A.initSegment=w,A},v}(),k=function(_,p,o){return Object(H.getStartDTS)(_,p)-o};function D(v,_){var p=v==null?void 0:v.codec;return p&&p.length>4?p:p==="hvc1"?"hvc1.1.c.L120.90":p==="av01"?"av01.0.04M.08":p==="avc1"||_===M.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}Z.default=X},"./src/task-loop.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"default",function(){return ee});var ee=function(){function H(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var M=H.prototype;return M.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},M.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},M.onHandlerDestroyed=function(){},M.hasInterval=function(){return!!this._tickInterval},M.hasNextTick=function(){return!!this._tickTimer},M.setInterval=function(X){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,X),!0)},M.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},M.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},M.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},M.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},M.doTick=function(){},H}()},"./src/types/cmcd.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"CMCDVersion",function(){return ee}),U.d(Z,"CMCDObjectType",function(){return H}),U.d(Z,"CMCDStreamingFormat",function(){return M}),U.d(Z,"CMCDStreamType",function(){return Y});var ee=1,H;(function(X){X.MANIFEST="m",X.AUDIO="a",X.VIDEO="v",X.MUXED="av",X.INIT="i",X.CAPTION="c",X.TIMED_TEXT="tt",X.KEY="k",X.OTHER="o"})(H||(H={}));var M;(function(X){X.DASH="d",X.HLS="h",X.SMOOTH="s",X.OTHER="o"})(M||(M={}));var Y;(function(X){X.VOD="v",X.LIVE="l"})(Y||(Y={}))},"./src/types/level.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"HlsSkip",function(){return M}),U.d(Z,"getSkipValue",function(){return Y}),U.d(Z,"HlsUrlParameters",function(){return X}),U.d(Z,"Level",function(){return k});function ee(D,v){for(var _=0;_<v.length;_++){var p=v[_];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(D,p.key,p)}}function H(D,v,_){return v&&ee(D.prototype,v),_&&ee(D,_),D}var M;(function(D){D.No="",D.Yes="YES",D.v2="v2"})(M||(M={}));function Y(D,v){var _=D.canSkipUntil,p=D.canSkipDateRanges,o=D.endSN,u=v!==void 0?v-o:0;return _&&u<_?p?M.v2:M.Yes:M.No}var X=function(){function D(_,p,o){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=_,this.part=p,this.skip=o}var v=D.prototype;return v.addDirectives=function(p){var o=new self.URL(p);return this.msn!==void 0&&o.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&o.searchParams.set("_HLS_part",this.part.toString()),this.skip&&o.searchParams.set("_HLS_skip",this.skip),o.toString()},D}(),k=function(){function D(v){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[v.url],this.attrs=v.attrs,this.bitrate=v.bitrate,v.details&&(this.details=v.details),this.id=v.id||0,this.name=v.name,this.width=v.width||0,this.height=v.height||0,this.audioCodec=v.audioCodec,this.videoCodec=v.videoCodec,this.unknownCodecs=v.unknownCodecs,this.codecSet=[v.videoCodec,v.audioCodec].filter(function(_){return _}).join(",").replace(/\.[^.,]+/g,"")}return H(D,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(_){var p=_%this.url.length;this._urlId!==p&&(this.details=void 0,this._urlId=p)}}]),D}()},"./src/types/loader.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"PlaylistContextType",function(){return ee}),U.d(Z,"PlaylistLevelType",function(){return H});var ee;(function(M){M.MANIFEST="manifest",M.LEVEL="level",M.AUDIO_TRACK="audioTrack",M.SUBTITLE_TRACK="subtitleTrack"})(ee||(ee={}));var H;(function(M){M.MAIN="main",M.AUDIO="audio",M.SUBTITLE="subtitle"})(H||(H={}))},"./src/types/transmuxer.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"ChunkMetadata",function(){return ee});var ee=function(Y,X,k,D,v,_){D===void 0&&(D=0),v===void 0&&(v=-1),_===void 0&&(_=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=H(),this.buffering={audio:H(),video:H(),audiovideo:H()},this.level=Y,this.sn=X,this.id=k,this.size=D,this.part=v,this.partial=_};function H(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"AttrList",function(){return M});var ee=/^(\d+)x(\d+)$/,H=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,M=function(){function Y(k){typeof k=="string"&&(k=Y.parseAttrList(k));for(var D in k)k.hasOwnProperty(D)&&(this[D]=k[D])}var X=Y.prototype;return X.decimalInteger=function(D){var v=parseInt(this[D],10);return v>Number.MAX_SAFE_INTEGER?Infinity:v},X.hexadecimalInteger=function(D){if(this[D]){var v=(this[D]||"0x").slice(2);v=(v.length&1?"0":"")+v;for(var _=new Uint8Array(v.length/2),p=0;p<v.length/2;p++)_[p]=parseInt(v.slice(p*2,p*2+2),16);return _}else return null},X.hexadecimalIntegerAsNumber=function(D){var v=parseInt(this[D],16);return v>Number.MAX_SAFE_INTEGER?Infinity:v},X.decimalFloatingPoint=function(D){return parseFloat(this[D])},X.optionalFloat=function(D,v){var _=this[D];return _?parseFloat(_):v},X.enumeratedString=function(D){return this[D]},X.bool=function(D){return this[D]==="YES"},X.decimalResolution=function(D){var v=ee.exec(this[D]);return v===null?void 0:{width:parseInt(v[1],10),height:parseInt(v[2],10)}},Y.parseAttrList=function(D){var v,_={},p='"';for(H.lastIndex=0;(v=H.exec(D))!==null;){var o=v[2];o.indexOf(p)===0&&o.lastIndexOf(p)===o.length-1&&(o=o.slice(1,-1)),_[v[1]]=o}return _},Y}()},"./src/utils/binary-search.ts":function(ie,Z,U){"use strict";U.r(Z);var ee={search:function(M,Y){for(var X=0,k=M.length-1,D=null,v=null;X<=k;){D=(X+k)/2|0,v=M[D];var _=Y(v);if(_>0)X=D+1;else if(_<0)k=D-1;else return v}return null}};Z.default=ee},"./src/utils/buffer-helper.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"BufferHelper",function(){return M});var ee=U("./src/utils/logger.ts"),H={length:0,start:function(){return 0},end:function(){return 0}},M=function(){function Y(){}return Y.isBuffered=function(k,D){try{if(k){for(var v=Y.getBuffered(k),_=0;_<v.length;_++)if(D>=v.start(_)&&D<=v.end(_))return!0}}catch(p){}return!1},Y.bufferInfo=function(k,D,v){try{if(k){var _=Y.getBuffered(k),p=[],o;for(o=0;o<_.length;o++)p.push({start:_.start(o),end:_.end(o)});return this.bufferedInfo(p,D,v)}}catch(u){}return{len:0,start:D,end:D,nextStart:void 0}},Y.bufferedInfo=function(k,D,v){D=Math.max(0,D),k.sort(function(w,R){var O=w.start-R.start;return O||R.end-w.end});var _=[];if(v)for(var p=0;p<k.length;p++){var o=_.length;if(o){var u=_[o-1].end;k[p].start-u<v?k[p].end>u&&(_[o-1].end=k[p].end):_.push(k[p])}else _.push(k[p])}else _=k;for(var r=0,i,t=D,c=D,f=0;f<_.length;f++){var A=_[f].start,S=_[f].end;if(D+v>=A&&D<S)t=A,c=S,r=c-D;else if(D+v<A){i=A;break}}return{len:r,start:t||0,end:c||0,nextStart:i}},Y.getBuffered=function(k){try{return k.buffered}catch(D){return ee.logger.log("failed to get media.buffered",D),H}},Y}()},"./src/utils/cea-608-parser.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"Row",function(){return c}),U.d(Z,"CaptionScreen",function(){return f});var ee=U("./src/utils/logger.ts"),H={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},M=function(y){var d=y;return H.hasOwnProperty(y)&&(d=H[y]),String.fromCharCode(d)},Y=15,X=100,k={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},D={17:2,18:4,21:6,22:8,23:10,19:13,20:15},v={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},_={25:2,26:4,29:6,30:8,31:10,27:13,28:15},p=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],o;(function(E){E[E.ERROR=0]="ERROR",E[E.TEXT=1]="TEXT",E[E.WARNING=2]="WARNING",E[E.INFO=2]="INFO",E[E.DEBUG=3]="DEBUG",E[E.DATA=3]="DATA"})(o||(o={}));var u=function(){function E(){this.time=null,this.verboseLevel=o.ERROR}var y=E.prototype;return y.log=function(l,h){this.verboseLevel>=l&&ee.logger.log(this.time+" ["+l+"] "+h)},E}(),r=function(y){for(var d=[],l=0;l<y.length;l++)d.push(y[l].toString(16));return d},i=function(){function E(d,l,h,g,b){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=d||"white",this.underline=l||!1,this.italics=h||!1,this.background=g||"black",this.flash=b||!1}var y=E.prototype;return y.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},y.setStyles=function(l){for(var h=["foreground","underline","italics","background","flash"],g=0;g<h.length;g++){var b=h[g];l.hasOwnProperty(b)&&(this[b]=l[b])}},y.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},y.equals=function(l){return this.foreground===l.foreground&&this.underline===l.underline&&this.italics===l.italics&&this.background===l.background&&this.flash===l.flash},y.copy=function(l){this.foreground=l.foreground,this.underline=l.underline,this.italics=l.italics,this.background=l.background,this.flash=l.flash},y.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},E}(),t=function(){function E(d,l,h,g,b,F){this.uchar=void 0,this.penState=void 0,this.uchar=d||" ",this.penState=new i(l,h,g,b,F)}var y=E.prototype;return y.reset=function(){this.uchar=" ",this.penState.reset()},y.setChar=function(l,h){this.uchar=l,this.penState.copy(h)},y.setPenState=function(l){this.penState.copy(l)},y.equals=function(l){return this.uchar===l.uchar&&this.penState.equals(l.penState)},y.copy=function(l){this.uchar=l.uchar,this.penState.copy(l.penState)},y.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},E}(),c=function(){function E(d){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var l=0;l<X;l++)this.chars.push(new t);this.logger=d,this.pos=0,this.currPenState=new i}var y=E.prototype;return y.equals=function(l){for(var h=!0,g=0;g<X;g++)if(!this.chars[g].equals(l.chars[g])){h=!1;break}return h},y.copy=function(l){for(var h=0;h<X;h++)this.chars[h].copy(l.chars[h])},y.isEmpty=function(){for(var l=!0,h=0;h<X;h++)if(!this.chars[h].isEmpty()){l=!1;break}return l},y.setCursor=function(l){this.pos!==l&&(this.pos=l),this.pos<0?(this.logger.log(o.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>X&&(this.logger.log(o.DEBUG,"Too large cursor position "+this.pos),this.pos=X)},y.moveCursor=function(l){var h=this.pos+l;if(l>1)for(var g=this.pos+1;g<h+1;g++)this.chars[g].setPenState(this.currPenState);this.setCursor(h)},y.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},y.insertChar=function(l){l>=144&&this.backSpace();var h=M(l);if(this.pos>=X){this.logger.log(o.ERROR,"Cannot insert "+l.toString(16)+" ("+h+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(h,this.currPenState),this.moveCursor(1)},y.clearFromPos=function(l){var h;for(h=l;h<X;h++)this.chars[h].reset()},y.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},y.clearToEndOfRow=function(){this.clearFromPos(this.pos)},y.getTextString=function(){for(var l=[],h=!0,g=0;g<X;g++){var b=this.chars[g].uchar;b!==" "&&(h=!1),l.push(b)}return h?"":l.join("")},y.setPenStyles=function(l){this.currPenState.setStyles(l);var h=this.chars[this.pos];h.setPenState(this.currPenState)},E}(),f=function(){function E(d){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var l=0;l<Y;l++)this.rows.push(new c(d));this.logger=d,this.currRow=Y-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var y=E.prototype;return y.reset=function(){for(var l=0;l<Y;l++)this.rows[l].clear();this.currRow=Y-1},y.equals=function(l){for(var h=!0,g=0;g<Y;g++)if(!this.rows[g].equals(l.rows[g])){h=!1;break}return h},y.copy=function(l){for(var h=0;h<Y;h++)this.rows[h].copy(l.rows[h])},y.isEmpty=function(){for(var l=!0,h=0;h<Y;h++)if(!this.rows[h].isEmpty()){l=!1;break}return l},y.backSpace=function(){var l=this.rows[this.currRow];l.backSpace()},y.clearToEndOfRow=function(){var l=this.rows[this.currRow];l.clearToEndOfRow()},y.insertChar=function(l){var h=this.rows[this.currRow];h.insertChar(l)},y.setPen=function(l){var h=this.rows[this.currRow];h.setPenStyles(l)},y.moveCursor=function(l){var h=this.rows[this.currRow];h.moveCursor(l)},y.setCursor=function(l){this.logger.log(o.INFO,"setCursor: "+l);var h=this.rows[this.currRow];h.setCursor(l)},y.setPAC=function(l){this.logger.log(o.INFO,"pacData = "+JSON.stringify(l));var h=l.row-1;if(this.nrRollUpRows&&h<this.nrRollUpRows-1&&(h=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==h){for(var g=0;g<Y;g++)this.rows[g].clear();var b=this.currRow+1-this.nrRollUpRows,F=this.lastOutputScreen;if(F){var N=F.rows[b].cueStartTime,W=this.logger.time;if(N&&W!==null&&N<W)for(var K=0;K<this.nrRollUpRows;K++)this.rows[h-this.nrRollUpRows+K+1].copy(F.rows[b+K])}}this.currRow=h;var I=this.rows[this.currRow];if(l.indent!==null){var x=l.indent,j=Math.max(x-1,0);I.setCursor(l.indent),l.color=I.chars[j].penState.foreground}var $={foreground:l.color,underline:l.underline,italics:l.italics,background:"black",flash:!1};this.setPen($)},y.setBkgData=function(l){this.logger.log(o.INFO,"bkgData = "+JSON.stringify(l)),this.backSpace(),this.setPen(l),this.insertChar(32)},y.setRollUpRows=function(l){this.nrRollUpRows=l},y.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(o.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(o.TEXT,this.getDisplayText());var l=this.currRow+1-this.nrRollUpRows,h=this.rows.splice(l,1)[0];h.clear(),this.rows.splice(this.currRow,0,h),this.logger.log(o.INFO,"Rolling up")},y.getDisplayText=function(l){l=l||!1;for(var h=[],g="",b=-1,F=0;F<Y;F++){var N=this.rows[F].getTextString();N&&(b=F+1,l?h.push("Row "+b+": '"+N+"'"):h.push(N.trim()))}return h.length>0&&(l?g="["+h.join(" | ")+"]":g=h.join(`
|
|
`)),g},y.getTextAndFormat=function(){return this.rows},E}(),A=function(){function E(d,l,h){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=d,this.outputFilter=l,this.mode=null,this.verbose=0,this.displayedMemory=new f(h),this.nonDisplayedMemory=new f(h),this.lastOutputScreen=new f(h),this.currRollUpRow=this.displayedMemory.rows[Y-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=h}var y=E.prototype;return y.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[Y-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},y.getHandler=function(){return this.outputFilter},y.setHandler=function(l){this.outputFilter=l},y.setPAC=function(l){this.writeScreen.setPAC(l)},y.setBkgData=function(l){this.writeScreen.setBkgData(l)},y.setMode=function(l){if(l===this.mode)return;this.mode=l,this.logger.log(o.INFO,"MODE="+l),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=l},y.insertChars=function(l){for(var h=0;h<l.length;h++)this.writeScreen.insertChar(l[h]);var g=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(o.INFO,g+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(o.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},y.ccRCL=function(){this.logger.log(o.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},y.ccBS=function(){if(this.logger.log(o.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},y.ccAOF=function(){},y.ccAON=function(){},y.ccDER=function(){this.logger.log(o.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},y.ccRU=function(l){this.logger.log(o.INFO,"RU("+l+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(l)},y.ccFON=function(){this.logger.log(o.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},y.ccRDC=function(){this.logger.log(o.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},y.ccTR=function(){this.logger.log(o.INFO,"TR"),this.setMode("MODE_TEXT")},y.ccRTD=function(){this.logger.log(o.INFO,"RTD"),this.setMode("MODE_TEXT")},y.ccEDM=function(){this.logger.log(o.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},y.ccCR=function(){this.logger.log(o.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},y.ccENM=function(){this.logger.log(o.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},y.ccEOC=function(){if(this.logger.log(o.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var l=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=l,this.writeScreen=this.nonDisplayedMemory,this.logger.log(o.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},y.ccTO=function(l){this.logger.log(o.INFO,"TO("+l+") - Tab Offset"),this.writeScreen.moveCursor(l)},y.ccMIDROW=function(l){var h={flash:!1};if(h.underline=l%2===1,h.italics=l>=46,h.italics)h.foreground="white";else{var g=Math.floor(l/2)-16,b=["white","green","blue","cyan","red","yellow","magenta"];h.foreground=b[g]}this.logger.log(o.INFO,"MIDROW: "+JSON.stringify(h)),this.writeScreen.setPen(h)},y.outputDataUpdate=function(l){l===void 0&&(l=!1);var h=this.logger.time;if(h===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=h:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,h,this.lastOutputScreen),l&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:h),this.lastOutputScreen.copy(this.displayedMemory))},y.cueSplitAtTime=function(l){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,l,this.displayedMemory),this.cueStartTime=l))},E}(),S=function(){function E(d,l,h){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var g=new u;this.channels=[null,new A(d,l,g),new A(d+1,h,g)],this.cmdHistory=O(),this.logger=g}var y=E.prototype;return y.getHandler=function(l){return this.channels[l].getHandler()},y.setHandler=function(l,h){this.channels[l].setHandler(h)},y.addData=function(l,h){var g,b,F,N=!1;this.logger.time=l;for(var W=0;W<h.length;W+=2){if(b=h[W]&127,F=h[W+1]&127,b===0&&F===0)continue;if(this.logger.log(o.DATA,"["+r([h[W],h[W+1]])+"] -> ("+r([b,F])+")"),g=this.parseCmd(b,F),g||(g=this.parseMidrow(b,F)),g||(g=this.parsePAC(b,F)),g||(g=this.parseBackgroundAttributes(b,F)),!g&&(N=this.parseChars(b,F),N)){var K=this.currentChannel;if(K&&K>0){var I=this.channels[K];I.insertChars(N)}else this.logger.log(o.WARNING,"No channel found yet. TEXT-MODE?")}!g&&!N&&this.logger.log(o.WARNING,"Couldn't parse cleaned data "+r([b,F])+" orig: "+r([h[W],h[W+1]]))}},y.parseCmd=function(l,h){var g=this.cmdHistory,b=(l===20||l===28||l===21||l===29)&&h>=32&&h<=47,F=(l===23||l===31)&&h>=33&&h<=35;if(!(b||F))return!1;if(R(l,h,g))return w(null,null,g),this.logger.log(o.DEBUG,"Repeated command ("+r([l,h])+") is dropped"),!0;var N=l===20||l===21||l===23?1:2,W=this.channels[N];return l===20||l===21||l===28||l===29?h===32?W.ccRCL():h===33?W.ccBS():h===34?W.ccAOF():h===35?W.ccAON():h===36?W.ccDER():h===37?W.ccRU(2):h===38?W.ccRU(3):h===39?W.ccRU(4):h===40?W.ccFON():h===41?W.ccRDC():h===42?W.ccTR():h===43?W.ccRTD():h===44?W.ccEDM():h===45?W.ccCR():h===46?W.ccENM():h===47&&W.ccEOC():W.ccTO(h-32),w(l,h,g),this.currentChannel=N,!0},y.parseMidrow=function(l,h){var g=0;if((l===17||l===25)&&h>=32&&h<=47){if(l===17?g=1:g=2,g!==this.currentChannel)return this.logger.log(o.ERROR,"Mismatch channel in midrow parsing"),!1;var b=this.channels[g];return b?(b.ccMIDROW(h),this.logger.log(o.DEBUG,"MIDROW ("+r([l,h])+")"),!0):!1}return!1},y.parsePAC=function(l,h){var g,b=this.cmdHistory,F=(l>=17&&l<=23||l>=25&&l<=31)&&h>=64&&h<=127,N=(l===16||l===24)&&h>=64&&h<=95;if(!(F||N))return!1;if(R(l,h,b))return w(null,null,b),!0;var W=l<=23?1:2;h>=64&&h<=95?g=W===1?k[l]:v[l]:g=W===1?D[l]:_[l];var K=this.channels[W];return K?(K.setPAC(this.interpretPAC(g,h)),w(l,h,b),this.currentChannel=W,!0):!1},y.interpretPAC=function(l,h){var g,b={color:null,italics:!1,indent:null,underline:!1,row:l};return h>95?g=h-96:g=h-64,b.underline=(g&1)===1,g<=13?b.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(g/2)]:g<=15?(b.italics=!0,b.color="white"):b.indent=Math.floor((g-16)/2)*4,b},y.parseChars=function(l,h){var g,b=null,F=null;if(l>=25?(g=2,F=l-8):(g=1,F=l),F>=17&&F<=19){var N;F===17?N=h+80:F===18?N=h+112:N=h+144,this.logger.log(o.INFO,"Special char '"+M(N)+"' in channel "+g),b=[N]}else l>=32&&l<=127&&(b=h===0?[l]:[l,h]);if(b){var W=r(b);this.logger.log(o.DEBUG,"Char codes = "+W.join(",")),w(l,h,this.cmdHistory)}return b},y.parseBackgroundAttributes=function(l,h){var g=(l===16||l===24)&&h>=32&&h<=47,b=(l===23||l===31)&&h>=45&&h<=47;if(!(g||b))return!1;var F,N={};l===16||l===24?(F=Math.floor((h-32)/2),N.background=p[F],h%2===1&&(N.background=N.background+"_semi")):h===45?N.background="transparent":(N.foreground="black",h===47&&(N.underline=!0));var W=l<=23?1:2,K=this.channels[W];return K.setBkgData(N),w(l,h,this.cmdHistory),!0},y.reset=function(){for(var l=0;l<Object.keys(this.channels).length;l++){var h=this.channels[l];h&&h.reset()}this.cmdHistory=O()},y.cueSplitAtTime=function(l){for(var h=0;h<this.channels.length;h++){var g=this.channels[h];g&&g.cueSplitAtTime(l)}},E}();function w(E,y,d){d.a=E,d.b=y}function R(E,y,d){return d.a===E&&d.b===y}function O(){return{a:null,b:null}}Z.default=S},"./src/utils/codecs.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"isCodecType",function(){return H}),U.d(Z,"isCodecSupportedInMp4",function(){return M});var ee={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function H(Y,X){var k=ee[X];return!!k&&k[Y.slice(0,4)]===!0}function M(Y,X){return MediaSource.isTypeSupported((X||"video")+'/mp4;codecs="'+Y+'"')}},"./src/utils/cues.ts":function(ie,Z,U){"use strict";U.r(Z);var ee=U("./src/utils/vttparser.ts"),H=U("./src/utils/webvtt-parser.ts"),M=U("./src/utils/texttrack-utils.ts"),Y=/\s/,X={newCue:function(D,v,_,p){for(var o=[],u,r,i,t,c,f=self.VTTCue||self.TextTrackCue,A=0;A<p.rows.length;A++)if(u=p.rows[A],i=!0,t=0,c="",!u.isEmpty()){for(var S=0;S<u.chars.length;S++)Y.test(u.chars[S].uchar)&&i?t++:(c+=u.chars[S].uchar,i=!1);u.cueStartTime=v,v===_&&(_+=1e-4),t>=16?t--:t++;var w=Object(ee.fixLineBreaks)(c.trim()),R=Object(H.generateCueId)(v,_,w);(!D||!D.cues||!D.cues.getCueById(R))&&(r=new f(v,_,w),r.id=R,r.line=A+1,r.align="left",r.position=10+Math.min(80,Math.floor(t*8/32)*10),o.push(r))}return D&&o.length&&(o.sort(function(O,E){return O.line==="auto"||E.line==="auto"?0:O.line>8&&E.line>8?E.line-O.line:O.line-E.line}),o.forEach(function(O){return Object(M.addCueToTrack)(D,O)})),o}};Z.default=X},"./src/utils/discontinuities.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"findFirstFragWithCC",function(){return Y}),U.d(Z,"shouldAlignOnDiscontinuities",function(){return X}),U.d(Z,"findDiscontinuousReferenceFrag",function(){return k}),U.d(Z,"adjustSlidingStart",function(){return v}),U.d(Z,"alignStream",function(){return _}),U.d(Z,"alignPDT",function(){return o}),U.d(Z,"alignFragmentByPDTDelta",function(){return u}),U.d(Z,"alignMediaPlaylistByPDT",function(){return r});var ee=U("./src/polyfills/number.ts"),H=U("./src/utils/logger.ts"),M=U("./src/controller/level-helper.ts");function Y(i,t){for(var c=null,f=0,A=i.length;f<A;f++){var S=i[f];if(S&&S.cc===t){c=S;break}}return c}function X(i,t,c){return!!(t.details&&(c.endCC>c.startCC||i&&i.cc<c.startCC))}function k(i,t){var c=i.fragments,f=t.fragments;if(!f.length||!c.length){H.logger.log("No fragments to align");return}var A=Y(c,f[0].cc);if(!A||A&&!A.startPTS){H.logger.log("No frag in previous level to align on");return}return A}function D(i,t){if(i){var c=i.start+t;i.start=i.startPTS=c,i.endPTS=c+i.duration}}function v(i,t){for(var c=t.fragments,f=0,A=c.length;f<A;f++)D(c[f],i);t.fragmentHint&&D(t.fragmentHint,i),t.alignedSliding=!0}function _(i,t,c){if(!t)return;p(i,c,t),!c.alignedSliding&&t.details&&o(c,t.details),!c.alignedSliding&&t.details&&!c.skippedSegments&&Object(M.adjustSliding)(t.details,c)}function p(i,t,c){if(X(i,c,t)){var f=k(c.details,t);f&&Object(ee.isFiniteNumber)(f.start)&&(H.logger.log("Adjusting PTS using last level due to CC increase within current level "+t.url),v(f.start,t))}}function o(i,t){if(!t.fragments.length||!i.hasProgramDateTime||!t.hasProgramDateTime)return;var c=t.fragments[0].programDateTime,f=i.fragments[0].programDateTime,A=(f-c)/1e3+t.fragments[0].start;A&&Object(ee.isFiniteNumber)(A)&&(H.logger.log("Adjusting PTS using programDateTime delta "+(f-c)+"ms, sliding:"+A.toFixed(3)+" "+i.url+" "),v(A,i))}function u(i,t){var c=i.programDateTime;if(!c)return;var f=(c-t)/1e3;i.start=i.startPTS=f,i.endPTS=f+i.duration}function r(i,t){if(!t.fragments.length||!i.hasProgramDateTime||!t.hasProgramDateTime)return;var c=t.fragments[0].programDateTime,f=t.fragments[0].start,A=c-f*1e3;i.fragments.forEach(function(S){u(S,A)}),i.fragmentHint&&u(i.fragmentHint,A),i.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ie,Z,U){"use strict";U.r(Z);var ee=U("./src/utils/ewma.ts"),H=function(){function M(X,k,D){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=D,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new ee.default(X),this.fast_=new ee.default(k)}var Y=M.prototype;return Y.update=function(k,D){var v=this.slow_,_=this.fast_;this.slow_.halfLife!==k&&(this.slow_=new ee.default(k,v.getEstimate(),v.getTotalWeight())),this.fast_.halfLife!==D&&(this.fast_=new ee.default(D,_.getEstimate(),_.getTotalWeight()))},Y.sample=function(k,D){k=Math.max(k,this.minDelayMs_);var v=8*D,_=k/1e3,p=v/_;this.fast_.sample(_,p),this.slow_.sample(_,p)},Y.canEstimate=function(){var k=this.fast_;return k&&k.getTotalWeight()>=this.minWeight_},Y.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},Y.destroy=function(){},M}();Z.default=H},"./src/utils/ewma.ts":function(ie,Z,U){"use strict";U.r(Z);var ee=function(){function H(Y,X,k){X===void 0&&(X=0),k===void 0&&(k=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=Y,this.alpha_=Y?Math.exp(Math.log(.5)/Y):0,this.estimate_=X,this.totalWeight_=k}var M=H.prototype;return M.sample=function(X,k){var D=Math.pow(this.alpha_,X);this.estimate_=k*(1-D)+D*this.estimate_,this.totalWeight_+=X},M.getTotalWeight=function(){return this.totalWeight_},M.getEstimate=function(){if(this.alpha_){var X=1-Math.pow(this.alpha_,this.totalWeight_);if(X)return this.estimate_/X}return this.estimate_},H}();Z.default=ee},"./src/utils/fetch-loader.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"fetchSupported",function(){return u});var ee=U("./src/polyfills/number.ts"),H=U("./src/loader/load-stats.ts"),M=U("./src/demux/chunk-cache.ts");function Y(f,A){f.prototype=Object.create(A.prototype),f.prototype.constructor=f,_(f,A)}function X(f){var A=typeof Map=="function"?new Map:void 0;return X=function(w){if(w===null||!v(w))return w;if(typeof w!="function")throw new TypeError("Super expression must either be null or a function");if(typeof A!="undefined"){if(A.has(w))return A.get(w);A.set(w,R)}function R(){return k(w,arguments,p(this).constructor)}return R.prototype=Object.create(w.prototype,{constructor:{value:R,enumerable:!1,writable:!0,configurable:!0}}),_(R,w)},X(f)}function k(f,A,S){return D()?k=Reflect.construct:k=function(R,O,E){var y=[null];y.push.apply(y,O);var d=Function.bind.apply(R,y),l=new d;return E&&_(l,E.prototype),l},k.apply(null,arguments)}function D(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(f){return!1}}function v(f){return Function.toString.call(f).indexOf("[native code]")!==-1}function _(f,A){return _=Object.setPrototypeOf||function(w,R){return w.__proto__=R,w},_(f,A)}function p(f){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(S){return S.__proto__||Object.getPrototypeOf(S)},p(f)}function o(){return o=Object.assign||function(f){for(var A=1;A<arguments.length;A++){var S=arguments[A];for(var w in S)Object.prototype.hasOwnProperty.call(S,w)&&(f[w]=S[w])}return f},o.apply(this,arguments)}function u(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(f){}return!1}var r=function(){function f(S){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=S.fetchSetup||t,this.controller=new self.AbortController,this.stats=new H.LoadStats}var A=f.prototype;return A.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},A.abortInternal=function(){var w=this.response;(!w||!w.ok)&&(this.stats.aborted=!0,this.controller.abort())},A.abort=function(){var w;this.abortInternal(),(w=this.callbacks)!==null&&w!==void 0&&w.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},A.load=function(w,R,O){var E=this,y=this.stats;if(y.loading.start)throw new Error("Loader can only be used once.");y.loading.start=self.performance.now();var d=i(w,this.controller.signal),l=O.onProgress,h=w.responseType==="arraybuffer",g=h?"byteLength":"length";this.context=w,this.config=R,this.callbacks=O,this.request=this.fetchSetup(w,d),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){E.abortInternal(),O.onTimeout(y,w,E.response)},R.timeout),self.fetch(this.request).then(function(b){if(E.response=E.loader=b,!b.ok){var F=b.status,N=b.statusText;throw new c(N||"fetch, bad network response",F,b)}return y.loading.first=Math.max(self.performance.now(),y.loading.start),y.total=parseInt(b.headers.get("Content-Length")||"0"),l&&Object(ee.isFiniteNumber)(R.highWaterMark)?E.loadProgressively(b,y,w,R.highWaterMark,l):h?b.arrayBuffer():b.text()}).then(function(b){var F=E.response;self.clearTimeout(E.requestTimeout),y.loading.end=Math.max(self.performance.now(),y.loading.first),y.loaded=y.total=b[g];var N={url:F.url,data:b};l&&!Object(ee.isFiniteNumber)(R.highWaterMark)&&l(y,w,b,F),O.onSuccess(N,y,w,F)}).catch(function(b){if(self.clearTimeout(E.requestTimeout),y.aborted)return;var F=b.code||0;O.onError({code:F,text:b.message},w,b.details)})},A.getCacheAge=function(){var w=null;if(this.response){var R=this.response.headers.get("age");w=R?parseFloat(R):null}return w},A.loadProgressively=function(w,R,O,E,y){E===void 0&&(E=0);var d=new M.default,l=w.body.getReader(),h=function g(){return l.read().then(function(b){if(b.done)return d.dataLength&&y(R,O,d.flush(),w),Promise.resolve(new ArrayBuffer(0));var F=b.value,N=F.length;return R.loaded+=N,N<E||d.dataLength?(d.push(F),d.dataLength>=E&&y(R,O,d.flush(),w)):y(R,O,F,w),g()}).catch(function(){return Promise.reject()})};return h()},f}();function i(f,A){var S={method:"GET",mode:"cors",credentials:"same-origin",signal:A,headers:new self.Headers(o({},f.headers))};return f.rangeEnd&&S.headers.set("Range","bytes="+f.rangeStart+"-"+String(f.rangeEnd-1)),S}function t(f,A){return new self.Request(f.url,A)}var c=function(f){Y(A,f);function A(S,w,R){var O;return O=f.call(this,S)||this,O.code=void 0,O.details=void 0,O.code=w,O.details=R,O}return A}(X(Error));Z.default=r},"./src/utils/imsc1-ttml-parser.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"IMSC1_CODEC",function(){return v}),U.d(Z,"parseIMSC1",function(){return u});var ee=U("./src/utils/mp4-tools.ts"),H=U("./src/utils/vttparser.ts"),M=U("./src/utils/vttcue.ts"),Y=U("./src/demux/id3.ts"),X=U("./src/utils/timescale-conversion.ts"),k=U("./src/utils/webvtt-parser.ts");function D(){return D=Object.assign||function(E){for(var y=1;y<arguments.length;y++){var d=arguments[y];for(var l in d)Object.prototype.hasOwnProperty.call(d,l)&&(E[l]=d[l])}return E},D.apply(this,arguments)}var v="stpp.ttml.im1t",_=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,p=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,o={left:"start",center:"center",right:"end",start:"start",end:"end"};function u(E,y,d,l,h){var g=Object(ee.findBox)(new Uint8Array(E),["mdat"]);if(g.length===0){h(new Error("Could not parse IMSC1 mdat"));return}var b=g[0],F=Object(Y.utf8ArrayToStr)(new Uint8Array(E,b.start,b.end-b.start)),N=Object(X.toTimescaleFromScale)(y,1,d);try{l(r(F,N))}catch(W){h(W)}}function r(E,y){var d=new DOMParser,l=d.parseFromString(E,"text/xml"),h=l.getElementsByTagName("tt")[0];if(!h)throw new Error("Invalid ttml");var g={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},b=Object.keys(g).reduce(function(I,x){return I[x]=h.getAttribute("ttp:"+x)||g[x],I},{}),F=h.getAttribute("xml:space")!=="preserve",N=t(i(h,"styling","style")),W=t(i(h,"layout","region")),K=i(h,"body","[begin]");return[].map.call(K,function(I){var x=c(I,F);if(!x||!I.hasAttribute("begin"))return null;var j=w(I.getAttribute("begin"),b),$=w(I.getAttribute("dur"),b),ae=w(I.getAttribute("end"),b);if(j===null)throw S(I);if(ae===null){if($===null)throw S(I);ae=j+$}var fe=new M.default(j-y,ae-y,x);fe.id=Object(k.generateCueId)(fe.startTime,fe.endTime,fe.text);var pe=W[I.getAttribute("region")],Ce=N[I.getAttribute("style")];fe.position=10,fe.size=80;var De=f(pe,Ce),xe=De.textAlign;if(xe){var Oe=o[xe];Oe&&(fe.lineAlign=Oe),fe.align=xe}return D(fe,De),fe}).filter(function(I){return I!==null})}function i(E,y,d){var l=E.getElementsByTagName(y)[0];return l?[].slice.call(l.querySelectorAll(d)):[]}function t(E){return E.reduce(function(y,d){var l=d.getAttribute("xml:id");return l&&(y[l]=d),y},{})}function c(E,y){return[].slice.call(E.childNodes).reduce(function(d,l,h){var g;return l.nodeName==="br"&&h?d+`
|
|
`:(g=l.childNodes)!==null&&g!==void 0&&g.length?c(l,y):y?d+l.textContent.trim().replace(/\s+/g," "):d+l.textContent},"")}function f(E,y){var d="http://www.w3.org/ns/ttml#styling",l=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return l.reduce(function(h,g){var b=A(y,d,g)||A(E,d,g);return b&&(h[g]=b),h},{})}function A(E,y,d){return E.hasAttributeNS(y,d)?E.getAttributeNS(y,d):null}function S(E){return new Error("Could not parse ttml timestamp "+E)}function w(E,y){if(!E)return null;var d=Object(H.parseTimeStamp)(E);return d===null&&(_.test(E)?d=R(E,y):p.test(E)&&(d=O(E,y))),d}function R(E,y){var d=_.exec(E),l=(d[4]|0)+(d[5]|0)/y.subFrameRate;return(d[1]|0)*3600+(d[2]|0)*60+(d[3]|0)+l/y.frameRate}function O(E,y){var d=p.exec(E),l=Number(d[1]),h=d[2];switch(h){case"h":return l*3600;case"m":return l*60;case"ms":return l*1e3;case"f":return l/y.frameRate;case"t":return l/y.tickRate}return l}},"./src/utils/logger.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"enableLogs",function(){return k}),U.d(Z,"logger",function(){return D});var ee=function(){},H={trace:ee,debug:ee,log:ee,warn:ee,info:ee,error:ee},M=H;function Y(v){var _=self.console[v];return _?_.bind(self.console,"["+v+"] >"):ee}function X(v){for(var _=arguments.length,p=new Array(_>1?_-1:0),o=1;o<_;o++)p[o-1]=arguments[o];p.forEach(function(u){M[u]=v[u]?v[u].bind(v):Y(u)})}function k(v){if(self.console&&v===!0||typeof v=="object"){X(v,"debug","log","info","warn","error");try{M.log()}catch(_){M=H}}else M=H}var D=M},"./src/utils/mediakeys-helper.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"KeySystems",function(){return ee}),U.d(Z,"requestMediaKeySystemAccess",function(){return H});var ee;(function(M){M.WIDEVINE="com.widevine.alpha",M.PLAYREADY="com.microsoft.playready"})(ee||(ee={}));var H=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"getMediaSource",function(){return ee});function ee(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"bin2str",function(){return X}),U.d(Z,"readUint16",function(){return k}),U.d(Z,"readUint32",function(){return D}),U.d(Z,"writeUint32",function(){return v}),U.d(Z,"findBox",function(){return _}),U.d(Z,"parseSegmentIndex",function(){return p}),U.d(Z,"parseInitSegment",function(){return o}),U.d(Z,"getStartDTS",function(){return u}),U.d(Z,"getDuration",function(){return r}),U.d(Z,"computeRawDurationFromSamples",function(){return i}),U.d(Z,"offsetStartDTS",function(){return t}),U.d(Z,"segmentValidRange",function(){return c}),U.d(Z,"appendUint8Array",function(){return f});var ee=U("./src/utils/typed-array.ts"),H=U("./src/loader/fragment.ts"),M=Math.pow(2,32)-1,Y=[].push;function X(A){return String.fromCharCode.apply(null,A)}function k(A,S){"data"in A&&(S+=A.start,A=A.data);var w=A[S]<<8|A[S+1];return w<0?65536+w:w}function D(A,S){"data"in A&&(S+=A.start,A=A.data);var w=A[S]<<24|A[S+1]<<16|A[S+2]<<8|A[S+3];return w<0?4294967296+w:w}function v(A,S,w){"data"in A&&(S+=A.start,A=A.data),A[S]=w>>24,A[S+1]=w>>16&255,A[S+2]=w>>8&255,A[S+3]=w&255}function _(A,S){var w=[];if(!S.length)return w;var R,O,E;"data"in A?(R=A.data,O=A.start,E=A.end):(R=A,O=0,E=R.byteLength);for(var y=O;y<E;){var d=D(R,y),l=X(R.subarray(y+4,y+8)),h=d>1?y+d:E;if(l===S[0])if(S.length===1)w.push({data:R,start:y+8,end:h});else{var g=_({data:R,start:y+8,end:h},S.slice(1));g.length&&Y.apply(w,g)}y=h}return w}function p(A){var S=_(A,["moov"]),w=S[0],R=w?w.end:null,O=_(A,["sidx"]);if(!O||!O[0])return null;var E=[],y=O[0],d=y.data[0],l=d===0?8:16,h=D(y,l);l+=4;var g=0,b=0;d===0?l+=8:l+=16,l+=2;var F=y.end+b,N=k(y,l);l+=2;for(var W=0;W<N;W++){var K=l,I=D(y,K);K+=4;var x=I&2147483647,j=(I&2147483648)>>>31;if(j===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var $=D(y,K);K+=4,E.push({referenceSize:x,subsegmentDuration:$,info:{duration:$/h,start:F,end:F+x-1}}),F+=x,K+=4,l=K}return{earliestPresentationTime:g,timescale:h,version:d,referencesCount:N,references:E,moovEndOffset:R}}function o(A){for(var S=[],w=_(A,["moov","trak"]),R=0;R<w.length;R++){var O=w[R],E=_(O,["tkhd"])[0];if(E){var y=E.data[E.start],d=y===0?12:20,l=D(E,d),h=_(O,["mdia","mdhd"])[0];if(h){y=h.data[h.start],d=y===0?12:20;var g=D(h,d),b=_(O,["mdia","hdlr"])[0];if(b){var F=X(b.data.subarray(b.start+8,b.start+12)),N={soun:H.ElementaryStreamTypes.AUDIO,vide:H.ElementaryStreamTypes.VIDEO}[F];if(N){var W=_(O,["mdia","minf","stbl","stsd"])[0],K=void 0;W&&(K=X(W.data.subarray(W.start+12,W.start+16))),S[l]={timescale:g,type:N},S[N]={timescale:g,id:l,codec:K}}}}}}var I=_(A,["moov","mvex","trex"]);return I.forEach(function(x){var j=D(x,4),$=S[j];$&&($.default={duration:D(x,12),flags:D(x,20)})}),S}function u(A,S){return _(S,["moof","traf"]).reduce(function(w,R){var O=_(R,["tfdt"])[0],E=O.data[O.start],y=_(R,["tfhd"]).reduce(function(d,l){var h=D(l,4),g=A[h];if(g){var b=D(O,4);E===1&&(b*=Math.pow(2,32),b+=D(O,8));var F=g.timescale||9e4,N=b/F;if(isFinite(N)&&(d===null||N<d))return N}return d},null);return y!==null&&isFinite(y)&&(w===null||y<w)?y:w},null)||0}function r(A,S){for(var w=0,R=0,O=0,E=_(A,["moof","traf"]),y=0;y<E.length;y++){var d=E[y],l=_(d,["tfhd"])[0],h=D(l,4),g=S[h];if(!g)continue;var b=g.default,F=D(l,0)|(b==null?void 0:b.flags),N=b==null?void 0:b.duration;F&8&&(F&2?N=D(l,12):N=D(l,8));for(var W=g.timescale||9e4,K=_(d,["trun"]),I=0;I<K.length;I++){if(N){var x=D(K[I],4);w=N*x}else w=i(K[I]);g.type===H.ElementaryStreamTypes.VIDEO?R+=w/W:g.type===H.ElementaryStreamTypes.AUDIO&&(O+=w/W)}}if(R===0&&O===0){var j=p(A);if(j!=null&&j.references)return j.references.reduce(function($,ae){return $+ae.info.duration||0},0)}return R||O}function i(A){var S=D(A,0),w=8;S&1&&(w+=4),S&4&&(w+=4);for(var R=0,O=D(A,4),E=0;E<O;E++){if(S&256){var y=D(A,w);R+=y,w+=4}S&512&&(w+=4),S&1024&&(w+=4),S&2048&&(w+=4)}return R}function t(A,S,w){_(S,["moof","traf"]).forEach(function(R){_(R,["tfhd"]).forEach(function(O){var E=D(O,4),y=A[E];if(!y)return;var d=y.timescale||9e4;_(R,["tfdt"]).forEach(function(l){var h=l.data[l.start],g=D(l,4);if(h===0)v(l,4,g-w*d);else{g*=Math.pow(2,32),g+=D(l,8),g-=w*d,g=Math.max(g,0);var b=Math.floor(g/(M+1)),F=Math.floor(g%(M+1));v(l,4,b),v(l,8,F)}})})})}function c(A){var S={valid:null,remainder:null},w=_(A,["moof"]);if(w){if(w.length<2)return S.remainder=A,S}else return S;var R=w[w.length-1];return S.valid=Object(ee.sliceUint8)(A,0,R.start-8),S.remainder=Object(ee.sliceUint8)(A,R.start-8),S}function f(A,S){var w=new Uint8Array(A.length+S.length);return w.set(A),w.set(S,A.length),w}},"./src/utils/output-filter.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"default",function(){return ee});var ee=function(){function H(Y,X){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=Y,this.trackName=X}var M=H.prototype;return M.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},M.newCue=function(X,k,D){(this.startTime===null||this.startTime>X)&&(this.startTime=X),this.endTime=k,this.screen=D,this.timelineController.createCaptionsTrack(this.trackName)},M.reset=function(){this.cueRanges=[]},H}()},"./src/utils/texttrack-utils.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"sendAddTrackEvent",function(){return H}),U.d(Z,"addCueToTrack",function(){return M}),U.d(Z,"clearCurrentCues",function(){return Y}),U.d(Z,"removeCuesInRange",function(){return X}),U.d(Z,"getCuesInRange",function(){return D});var ee=U("./src/utils/logger.ts");function H(v,_){var p;try{p=new Event("addtrack")}catch(o){p=document.createEvent("Event"),p.initEvent("addtrack",!1,!1)}p.track=v,_.dispatchEvent(p)}function M(v,_){var p=v.mode;if(p==="disabled"&&(v.mode="hidden"),v.cues&&!v.cues.getCueById(_.id))try{if(v.addCue(_),!v.cues.getCueById(_.id))throw new Error("addCue is failed for: "+_)}catch(u){ee.logger.debug("[texttrack-utils]: "+u);var o=new self.TextTrackCue(_.startTime,_.endTime,_.text);o.id=_.id,v.addCue(o)}p==="disabled"&&(v.mode=p)}function Y(v){var _=v.mode;if(_==="disabled"&&(v.mode="hidden"),v.cues)for(var p=v.cues.length;p--;)v.removeCue(v.cues[p]);_==="disabled"&&(v.mode=_)}function X(v,_,p){var o=v.mode;if(o==="disabled"&&(v.mode="hidden"),v.cues&&v.cues.length>0)for(var u=D(v.cues,_,p),r=0;r<u.length;r++)v.removeCue(u[r]);o==="disabled"&&(v.mode=o)}function k(v,_){if(_<v[0].startTime)return 0;var p=v.length-1;if(_>v[p].endTime)return-1;for(var o=0,u=p;o<=u;){var r=Math.floor((u+o)/2);if(_<v[r].startTime)u=r-1;else if(_>v[r].startTime&&o<p)o=r+1;else return r}return v[o].startTime-_<_-v[u].startTime?o:u}function D(v,_,p){var o=[],u=k(v,_);if(u>-1)for(var r=u,i=v.length;r<i;r++){var t=v[r];if(t.startTime>=_&&t.endTime<=p)o.push(t);else if(t.startTime>p)return o}return o}},"./src/utils/time-ranges.ts":function(ie,Z,U){"use strict";U.r(Z);var ee={toString:function(M){for(var Y="",X=M.length,k=0;k<X;k++)Y+="["+M.start(k).toFixed(3)+","+M.end(k).toFixed(3)+"]";return Y}};Z.default=ee},"./src/utils/timescale-conversion.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"toTimescaleFromBase",function(){return H}),U.d(Z,"toTimescaleFromScale",function(){return M}),U.d(Z,"toMsFromMpegTsClock",function(){return Y}),U.d(Z,"toMpegTsClockFromTimescale",function(){return X});var ee=9e4;function H(k,D,v,_){v===void 0&&(v=1),_===void 0&&(_=!1);var p=k*D*v;return _?Math.round(p):p}function M(k,D,v,_){return v===void 0&&(v=1),_===void 0&&(_=!1),H(k,D,1/v,_)}function Y(k,D){return D===void 0&&(D=!1),H(k,1e3,1/ee,D)}function X(k,D){return D===void 0&&(D=1),H(k,ee,1/D)}},"./src/utils/typed-array.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"sliceUint8",function(){return ee});function ee(H,M,Y){return Uint8Array.prototype.slice?H.slice(M,Y):new Uint8Array(Array.prototype.slice.call(H,M,Y))}},"./src/utils/vttcue.ts":function(ie,Z,U){"use strict";U.r(Z),Z.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var ee=["","lr","rl"],H=["start","middle","end","left","right"];function M(v,_){if(typeof _!="string")return!1;if(!Array.isArray(v))return!1;var p=_.toLowerCase();return~v.indexOf(p)?p:!1}function Y(v){return M(ee,v)}function X(v){return M(H,v)}function k(v){for(var _=arguments.length,p=new Array(_>1?_-1:0),o=1;o<_;o++)p[o-1]=arguments[o];for(var u=1;u<arguments.length;u++){var r=arguments[u];for(var i in r)v[i]=r[i]}return v}function D(v,_,p){var o=this,u={enumerable:!0};o.hasBeenReset=!1;var r="",i=!1,t=v,c=_,f=p,A=null,S="",w=!0,R="auto",O="start",E=50,y="middle",d=50,l="middle";Object.defineProperty(o,"id",k({},u,{get:function(){return r},set:function(g){r=""+g}})),Object.defineProperty(o,"pauseOnExit",k({},u,{get:function(){return i},set:function(g){i=!!g}})),Object.defineProperty(o,"startTime",k({},u,{get:function(){return t},set:function(g){if(typeof g!="number")throw new TypeError("Start time must be set to a number.");t=g,this.hasBeenReset=!0}})),Object.defineProperty(o,"endTime",k({},u,{get:function(){return c},set:function(g){if(typeof g!="number")throw new TypeError("End time must be set to a number.");c=g,this.hasBeenReset=!0}})),Object.defineProperty(o,"text",k({},u,{get:function(){return f},set:function(g){f=""+g,this.hasBeenReset=!0}})),Object.defineProperty(o,"region",k({},u,{get:function(){return A},set:function(g){A=g,this.hasBeenReset=!0}})),Object.defineProperty(o,"vertical",k({},u,{get:function(){return S},set:function(g){var b=Y(g);if(b===!1)throw new SyntaxError("An invalid or illegal string was specified.");S=b,this.hasBeenReset=!0}})),Object.defineProperty(o,"snapToLines",k({},u,{get:function(){return w},set:function(g){w=!!g,this.hasBeenReset=!0}})),Object.defineProperty(o,"line",k({},u,{get:function(){return R},set:function(g){if(typeof g!="number"&&g!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");R=g,this.hasBeenReset=!0}})),Object.defineProperty(o,"lineAlign",k({},u,{get:function(){return O},set:function(g){var b=X(g);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");O=b,this.hasBeenReset=!0}})),Object.defineProperty(o,"position",k({},u,{get:function(){return E},set:function(g){if(g<0||g>100)throw new Error("Position must be between 0 and 100.");E=g,this.hasBeenReset=!0}})),Object.defineProperty(o,"positionAlign",k({},u,{get:function(){return y},set:function(g){var b=X(g);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");y=b,this.hasBeenReset=!0}})),Object.defineProperty(o,"size",k({},u,{get:function(){return d},set:function(g){if(g<0||g>100)throw new Error("Size must be between 0 and 100.");d=g,this.hasBeenReset=!0}})),Object.defineProperty(o,"align",k({},u,{get:function(){return l},set:function(g){var b=X(g);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");l=b,this.hasBeenReset=!0}})),o.displayState=void 0}return D.prototype.getCueAsHTML=function(){var v=self.WebVTT;return v.convertCueToDOMTree(self,this.text)},D}()},"./src/utils/vttparser.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"parseTimeStamp",function(){return M}),U.d(Z,"fixLineBreaks",function(){return _}),U.d(Z,"VTTParser",function(){return p});var ee=U("./src/utils/vttcue.ts"),H=function(){function o(){}var u=o.prototype;return u.decode=function(i,t){if(!i)return"";if(typeof i!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(i))},o}();function M(o){function u(i,t,c,f){return(i|0)*3600+(t|0)*60+(c|0)+parseFloat(f||0)}var r=o.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return r?parseFloat(r[2])>59?u(r[2],r[3],0,r[4]):u(r[1],r[2],r[3],r[4]):null}var Y=function(){function o(){this.values=Object.create(null)}var u=o.prototype;return u.set=function(i,t){!this.get(i)&&t!==""&&(this.values[i]=t)},u.get=function(i,t,c){return c?this.has(i)?this.values[i]:t[c]:this.has(i)?this.values[i]:t},u.has=function(i){return i in this.values},u.alt=function(i,t,c){for(var f=0;f<c.length;++f)if(t===c[f]){this.set(i,t);break}},u.integer=function(i,t){/^-?\d+$/.test(t)&&this.set(i,parseInt(t,10))},u.percent=function(i,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){var c=parseFloat(t);if(c>=0&&c<=100)return this.set(i,c),!0}return!1},o}();function X(o,u,r,i){var t=i?o.split(i):[o];for(var c in t){if(typeof t[c]!="string")continue;var f=t[c].split(r);if(f.length!==2)continue;var A=f[0],S=f[1];u(A,S)}}var k=new ee.default(0,0,""),D=k.align==="middle"?"middle":"center";function v(o,u,r){var i=o;function t(){var A=M(o);if(A===null)throw new Error("Malformed timestamp: "+i);return o=o.replace(/^[^\sa-zA-Z-]+/,""),A}function c(A,S){var w=new Y;X(A,function(E,y){var d;switch(E){case"region":for(var l=r.length-1;l>=0;l--)if(r[l].id===y){w.set(E,r[l].region);break}break;case"vertical":w.alt(E,y,["rl","lr"]);break;case"line":d=y.split(","),w.integer(E,d[0]),w.percent(E,d[0])&&w.set("snapToLines",!1),w.alt(E,d[0],["auto"]),d.length===2&&w.alt("lineAlign",d[1],["start",D,"end"]);break;case"position":d=y.split(","),w.percent(E,d[0]),d.length===2&&w.alt("positionAlign",d[1],["start",D,"end","line-left","line-right","auto"]);break;case"size":w.percent(E,y);break;case"align":w.alt(E,y,["start",D,"end","left","right"]);break}},/:/,/\s/),S.region=w.get("region",null),S.vertical=w.get("vertical","");var R=w.get("line","auto");R==="auto"&&k.line===-1&&(R=-1),S.line=R,S.lineAlign=w.get("lineAlign","start"),S.snapToLines=w.get("snapToLines",!0),S.size=w.get("size",100),S.align=w.get("align",D);var O=w.get("position","auto");O==="auto"&&k.position===50&&(O=S.align==="start"||S.align==="left"?0:S.align==="end"||S.align==="right"?100:50),S.position=O}function f(){o=o.replace(/^\s+/,"")}if(f(),u.startTime=t(),f(),o.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+i);o=o.substr(3),f(),u.endTime=t(),f(),c(o,u)}function _(o){return o.replace(/<br(?: \/)?>/gi,`
|
|
`)}var p=function(){function o(){this.state="INITIAL",this.buffer="",this.decoder=new H,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var u=o.prototype;return u.parse=function(i){var t=this;i&&(t.buffer+=t.decoder.decode(i,{stream:!0}));function c(){var O=t.buffer,E=0;for(O=_(O);E<O.length&&O[E]!=="\r"&&O[E]!==`
|
|
`;)++E;var y=O.substr(0,E);return O[E]==="\r"&&++E,O[E]===`
|
|
`&&++E,t.buffer=O.substr(E),y}function f(O){X(O,function(E,y){},/:/)}try{var A="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;A=c();var S=A.match(/^()?WEBVTT([ \t].*)?$/);if(!S||!S[0])throw new Error("Malformed WebVTT signature.");t.state="HEADER"}for(var w=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;w?w=!1:A=c();switch(t.state){case"HEADER":/:/.test(A)?f(A):A||(t.state="ID");continue;case"NOTE":A||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(A)){t.state="NOTE";break}if(!A)continue;if(t.cue=new ee.default(0,0,""),t.state="CUE",A.indexOf("-->")===-1){t.cue.id=A;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{v(A,t.cue,t.regionList)}catch(O){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{var R=A.indexOf("-->")!==-1;if(!A||R&&(w=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=`
|
|
`),t.cue.text+=A}continue;case"BADCUE":A||(t.state="ID")}}}catch(O){t.state==="CUETEXT"&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},u.flush=function(){var i=this;try{if((i.cue||i.state==="HEADER")&&(i.buffer+=`
|
|
|
|
`,i.parse()),i.state==="INITIAL"||i.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){i.onparsingerror&&i.onparsingerror(t)}return i.onflush&&i.onflush(),this},o}()},"./src/utils/webvtt-parser.ts":function(ie,Z,U){"use strict";U.r(Z),U.d(Z,"generateCueId",function(){return p}),U.d(Z,"parseWebVTT",function(){return u});var ee=U("./src/polyfills/number.ts"),H=U("./src/utils/vttparser.ts"),M=U("./src/demux/id3.ts"),Y=U("./src/utils/timescale-conversion.ts"),X=U("./src/remux/mp4-remuxer.ts"),k=/\r\n|\n\r|\n|\r/g,D=function(i,t,c){return c===void 0&&(c=0),i.substr(c,t.length)===t},v=function(i){var t=parseInt(i.substr(-3)),c=parseInt(i.substr(-6,2)),f=parseInt(i.substr(-9,2)),A=i.length>9?parseInt(i.substr(0,i.indexOf(":"))):0;if(!Object(ee.isFiniteNumber)(t)||!Object(ee.isFiniteNumber)(c)||!Object(ee.isFiniteNumber)(f)||!Object(ee.isFiniteNumber)(A))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+i);return t+=1e3*c,t+=60*1e3*f,t+=60*60*1e3*A,t},_=function(i){for(var t=5381,c=i.length;c;)t=t*33^i.charCodeAt(--c);return(t>>>0).toString()};function p(r,i,t){return _(r.toString())+_(i.toString())+_(t)}var o=function(i,t,c){var f=i[t],A=i[f.prevCC];if(!A||!A.new&&f.new){i.ccOffset=i.presentationOffset=f.start,f.new=!1;return}for(;(S=A)!==null&&S!==void 0&&S.new;){var S;i.ccOffset+=f.start-A.start,f.new=!1,f=A,A=i[f.prevCC]}i.presentationOffset=c};function u(r,i,t,c,f,A,S,w){var R=new H.VTTParser,O=Object(M.utf8ArrayToStr)(new Uint8Array(r)).trim().replace(k,`
|
|
`).split(`
|
|
`),E=[],y=Object(Y.toMpegTsClockFromTimescale)(i,t),d="00:00.000",l=0,h=0,g,b=!0,F=!1;R.oncue=function(N){var W=c[f],K=c.ccOffset,I=(l-y)/9e4;if(W!=null&&W.new&&(h!==void 0?K=c.ccOffset=W.start:o(c,f,I)),I&&(K=I-c.presentationOffset),F){var x=N.endTime-N.startTime,j=Object(X.normalizePts)((N.startTime+K-h)*9e4,A*9e4)/9e4;N.startTime=j,N.endTime=j+x}var $=N.text.trim();N.text=decodeURIComponent(encodeURIComponent($)),N.id||(N.id=p(N.startTime,N.endTime,$)),N.endTime>0&&E.push(N)},R.onparsingerror=function(N){g=N},R.onflush=function(){if(g){w(g);return}S(E)},O.forEach(function(N){if(b)if(D(N,"X-TIMESTAMP-MAP=")){b=!1,F=!0,N.substr(16).split(",").forEach(function(W){D(W,"LOCAL:")?d=W.substr(6):D(W,"MPEGTS:")&&(l=parseInt(W.substr(7)))});try{h=v(d)/1e3}catch(W){F=!1,g=W}return}else N===""&&(b=!1);R.parse(N+`
|
|
`)}),R.flush()}},"./src/utils/xhr-loader.ts":function(ie,Z,U){"use strict";U.r(Z);var ee=U("./src/utils/logger.ts"),H=U("./src/loader/load-stats.ts"),M=/^age:\s*[\d.]+\s*$/m,Y=function(){function X(D){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=D?D.xhrSetup:null,this.stats=new H.LoadStats,this.retryDelay=0}var k=X.prototype;return k.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},k.abortInternal=function(){var v=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),v&&(v.onreadystatechange=null,v.onprogress=null,v.readyState!==4&&(this.stats.aborted=!0,v.abort()))},k.abort=function(){var v;this.abortInternal(),(v=this.callbacks)!==null&&v!==void 0&&v.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},k.load=function(v,_,p){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=v,this.config=_,this.callbacks=p,this.retryDelay=_.retryDelay,this.loadInternal()},k.loadInternal=function(){var v=this.config,_=this.context;if(!v)return;var p=this.loader=new self.XMLHttpRequest,o=this.stats;o.loading.first=0,o.loaded=0;var u=this.xhrSetup;try{if(u)try{u(p,_.url)}catch(t){p.open("GET",_.url,!0),u(p,_.url)}p.readyState||p.open("GET",_.url,!0);var r=this.context.headers;if(r)for(var i in r)p.setRequestHeader(i,r[i])}catch(t){this.callbacks.onError({code:p.status,text:t.message},_,p);return}_.rangeEnd&&p.setRequestHeader("Range","bytes="+_.rangeStart+"-"+(_.rangeEnd-1)),p.onreadystatechange=this.readystatechange.bind(this),p.onprogress=this.loadprogress.bind(this),p.responseType=_.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),v.timeout),p.send()},k.readystatechange=function(){var v=this.context,_=this.loader,p=this.stats;if(!v||!_)return;var o=_.readyState,u=this.config;if(p.aborted)return;if(o>=2)if(self.clearTimeout(this.requestTimeout),p.loading.first===0&&(p.loading.first=Math.max(self.performance.now(),p.loading.start)),o===4){_.onreadystatechange=null,_.onprogress=null;var r=_.status;if(r>=200&&r<300){p.loading.end=Math.max(self.performance.now(),p.loading.first);var i,t;if(v.responseType==="arraybuffer"?(i=_.response,t=i.byteLength):(i=_.responseText,t=i.length),p.loaded=p.total=t,!this.callbacks)return;var c=this.callbacks.onProgress;if(c&&c(p,v,i,_),!this.callbacks)return;var f={url:_.responseURL,data:i};this.callbacks.onSuccess(f,p,v,_)}else p.retry>=u.maxRetry||r>=400&&r<499?(ee.logger.error(r+" while loading "+v.url),this.callbacks.onError({code:r,text:_.statusText},v,_)):(ee.logger.warn(r+" while loading "+v.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,u.maxRetryDelay),p.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),u.timeout)},k.loadtimeout=function(){ee.logger.warn("timeout while loading "+this.context.url);var v=this.callbacks;v&&(this.abortInternal(),v.onTimeout(this.stats,this.context,this.loader))},k.loadprogress=function(v){var _=this.stats;_.loaded=v.loaded,v.lengthComputable&&(_.total=v.total)},k.getCacheAge=function(){var v=null;if(this.loader&&M.test(this.loader.getAllResponseHeaders())){var _=this.loader.getResponseHeader("age");v=_?parseFloat(_):null}return v},X}();Z.default=Y}}).default})},vHTk:function(zt,st,V){zt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},vkP9:function(zt,st,V){"use strict";var ie=V("+L6B"),Z=V("2/Rp"),U=V("5NDa"),ee=V("5rEg"),H=V("y8nQ"),M=V("Vl3Y"),Y=V("tJVT"),X=V("q1tI"),k=V.n(X),D=V("a+yL"),v=V.n(D),_=function(o){var u=o.value,r=o.onChange,i=M.a.useForm(),t=Object(Y.a)(i,1),c=t[0];Object(X.useEffect)(function(){u&&c.setFieldsValue(u)},u);var f=function(S){r(S)};return k.a.createElement("div",{className:v.a.search},k.a.createElement(M.a,{className:v.a.formWrap,colon:!1,form:c,size:"large",layout:"inline",onFinish:f},k.a.createElement(M.a.Item,{label:"\u5B9E\u8BAD\u4FE1\u606F",name:"keyword",initialValue:""},k.a.createElement(ee.a,{style:{width:280,height:40}})),k.a.createElement(M.a.Item,{label:"\u5B66\u6821/\u5355\u4F4D",name:"schools",initialValue:"",style:{margin:"0 40px"}},k.a.createElement(ee.a,{style:{width:280,height:40}})),k.a.createElement(M.a.Item,{label:"\u521B\u5EFA\u8005",name:"creator",initialValue:""},k.a.createElement(ee.a,{style:{width:200,height:40}})),k.a.createElement(Z.a,{className:v.a.btn,type:"primary",htmlType:"submit"},"\u641C\u7D22")))};st.a=_},wCXF:function(zt,st,V){"use strict";V.d(st,"a",function(){return sn});var ie=V("rePB"),Z=V("VTBJ"),U=V("KQm4"),ee=V("U8pU"),H=V("ODXe"),M=V("q1tI"),Y=V("TSYQ"),X=V.n(Y),k=V("Gytx"),D=V.n(k),v=V("Kwbf"),_=V("t23M"),p=V("qx4F"),o=V("6eGT"),u=V("IBYe"),r=V("Ff2n"),i=V("c+Xe"),t=V("fyJ8"),c=V("biw7");function f(Qe,Ye,St,bt,nt){var vt=St[Qe]||{},Ue=St[Ye]||{},Ae,Re;vt.fixed==="left"?Ae=bt.left[Qe]:Ue.fixed==="right"&&(Re=bt.right[Ye]);var le=!1,he=!1,Se=!1,ve=!1,Pe=St[Ye+1],it=St[Qe-1];if(nt==="rtl"){if(Ae!==void 0){var xt=it&&it.fixed==="left";ve=!xt}else if(Re!==void 0){var $t=Pe&&Pe.fixed==="right";Se=!$t}}else if(Ae!==void 0){var mn=Pe&&Pe.fixed==="left";le=!mn}else if(Re!==void 0){var rn=it&&it.fixed==="right";he=!rn}return{fixLeft:Ae,fixRight:Re,lastFixLeft:le,firstFixRight:he,lastFixRight:Se,firstFixLeft:ve,isSticky:bt.isSticky}}var A=V("sR1s");function S(Qe){var Ye=Qe.cells,St=Qe.stickyOffsets,bt=Qe.flattenColumns,nt=Qe.rowComponent,vt=Qe.cellComponent,Ue=Qe.onHeaderRow,Ae=Qe.index,Re=M.useContext(c.a),le=Re.prefixCls,he=Re.direction,Se;Ue&&(Se=Ue(Ye.map(function(Pe){return Pe.column}),Ae));var ve=Object(A.a)(Ye.map(function(Pe){return Pe.column}));return M.createElement(nt,Object.assign({},Se),Ye.map(function(Pe,it){var xt=Pe.column,$t=f(Pe.colStart,Pe.colEnd,bt,St,he),mn;return xt&&xt.onHeaderCell&&(mn=Pe.column.onHeaderCell(xt)),M.createElement(t.a,Object.assign({},Pe,{ellipsis:xt.ellipsis,align:xt.align,component:vt,prefixCls:le,key:ve[it]},$t,{additionalProps:mn,rowType:"header"}))}))}S.displayName="HeaderRow";var w=S;function R(Qe){var Ye=[];function St(Ue,Ae){var Re=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;Ye[Re]=Ye[Re]||[];var le=Ae,he=Ue.filter(Boolean).map(function(Se){var ve={key:Se.key,className:Se.className||"",children:Se.title,column:Se,colStart:le},Pe=1,it=Se.children;return it&&it.length>0&&(Pe=St(it,le,Re+1).reduce(function(xt,$t){return xt+$t},0),ve.hasSubColumns=!0),"colSpan"in Se&&(Pe=Se.colSpan),"rowSpan"in Se&&(ve.rowSpan=Se.rowSpan),ve.colSpan=Pe,ve.colEnd=ve.colStart+Pe-1,Ye[Re].push(ve),le+=Pe,Pe});return he}St(Qe,0);for(var bt=Ye.length,nt=function(Ae){Ye[Ae].forEach(function(Re){!("rowSpan"in Re)&&!Re.hasSubColumns&&(Re.rowSpan=bt-Ae)})},vt=0;vt<bt;vt+=1)nt(vt);return Ye}function O(Qe){var Ye=Qe.stickyOffsets,St=Qe.columns,bt=Qe.flattenColumns,nt=Qe.onHeaderRow,vt=M.useContext(c.a),Ue=vt.prefixCls,Ae=vt.getComponent,Re=M.useMemo(function(){return R(St)},[St]),le=Ae(["header","wrapper"],"thead"),he=Ae(["header","row"],"tr"),Se=Ae(["header","cell"],"th");return M.createElement(le,{className:"".concat(Ue,"-thead")},Re.map(function(ve,Pe){var it=M.createElement(w,{key:Pe,flattenColumns:bt,cells:ve,stickyOffsets:Ye,rowComponent:he,cellComponent:Se,onHeaderRow:nt,index:Pe});return it}))}var E=O,y=V("hW8S");function d(Qe){for(var Ye=Qe.colWidths,St=Qe.columns,bt=Qe.columCount,nt=[],vt=bt||St.length,Ue=!1,Ae=vt-1;Ae>=0;Ae-=1){var Re=Ye[Ae],le=St&&St[Ae],he=le&&le[y.a];(Re||he||Ue)&&(nt.unshift(M.createElement("col",Object.assign({key:Ae,style:{width:Re,minWidth:Re}},he))),Ue=!0)}return M.createElement("colgroup",null,nt)}var l=d;function h(Qe,Ye){return Object(M.useMemo)(function(){for(var St=[],bt=0;bt<Ye;bt+=1){var nt=Qe[bt];if(nt!==void 0)St[bt]=nt;else return null}return St},[Qe.join("_"),Ye])}var g=M.forwardRef(function(Qe,Ye){var St=Qe.noData,bt=Qe.columns,nt=Qe.flattenColumns,vt=Qe.colWidths,Ue=Qe.columCount,Ae=Qe.stickyOffsets,Re=Qe.direction,le=Qe.fixHeader,he=Qe.offsetHeader,Se=Qe.stickyClassName,ve=Qe.onScroll,Pe=Object(r.a)(Qe,["noData","columns","flattenColumns","colWidths","columCount","stickyOffsets","direction","fixHeader","offsetHeader","stickyClassName","onScroll"]),it=M.useContext(c.a),xt=it.prefixCls,$t=it.scrollbarSize,mn=it.isSticky,rn=mn&&!le?0:$t,ci=M.useRef(null),Jn=M.useCallback(function(Ai){Object(i.b)(Ye,Ai),Object(i.b)(ci,Ai)},[]);M.useEffect(function(){var Ai;function Ln(Dt){var Qn=Dt.currentTarget,vi=Dt.deltaX;vi&&(ve({currentTarget:Qn,scrollLeft:Qn.scrollLeft+vi}),Dt.preventDefault())}return(Ai=ci.current)===null||Ai===void 0||Ai.addEventListener("wheel",Ln),function(){var Dt;(Dt=ci.current)===null||Dt===void 0||Dt.removeEventListener("wheel",Ln)}},[]);var Sn=nt[nt.length-1],pi={fixed:Sn?Sn.fixed:null,onHeaderCell:function(){return{className:"".concat(xt,"-cell-scrollbar")}}},gi=Object(M.useMemo)(function(){return rn?[].concat(Object(U.a)(bt),[pi]):bt},[rn,bt]),xi=Object(M.useMemo)(function(){return rn?[].concat(Object(U.a)(nt),[pi]):nt},[rn,nt]),_i=Object(M.useMemo)(function(){var Ai=Ae.right,Ln=Ae.left;return Object(Z.a)(Object(Z.a)({},Ae),{},{left:Re==="rtl"?[].concat(Object(U.a)(Ln.map(function(Dt){return Dt+rn})),[0]):Ln,right:Re==="rtl"?Ai:[].concat(Object(U.a)(Ai.map(function(Dt){return Dt+rn})),[0]),isSticky:mn})},[rn,Ae,mn]),Dn=h(vt,Ue);return M.createElement("div",{style:Object(Z.a)({overflow:"hidden"},mn?{top:he}:{}),ref:Jn,className:X()("".concat(xt,"-header"),Object(ie.a)({},Se,!!Se))},M.createElement("table",{style:{tableLayout:"fixed",visibility:St||Dn?null:"hidden"}},M.createElement(l,{colWidths:Dn?[].concat(Object(U.a)(Dn),[rn]):[],columCount:Ue+1,columns:xi}),M.createElement(E,Object.assign({},Pe,{stickyOffsets:_i,columns:gi,flattenColumns:xi}))))});g.displayName="FixedHeader";var b=g,F=M.createContext(null),N=F;function W(Qe){var Ye=Qe.prefixCls,St=Qe.children,bt=Qe.component,nt=Qe.cellComponent,vt=Qe.fixHeader,Ue=Qe.fixColumn,Ae=Qe.horizonScroll,Re=Qe.className,le=Qe.expanded,he=Qe.componentWidth,Se=Qe.colSpan,ve=M.useContext(c.a),Pe=ve.scrollbarSize;return M.useMemo(function(){var it=St;return Ue&&(it=M.createElement("div",{style:{width:he-(vt?Pe:0),position:"sticky",left:0,overflow:"hidden"},className:"".concat(Ye,"-expanded-row-fixed")},it)),M.createElement(bt,{className:Re,style:{display:le?null:"none"}},M.createElement(t.a,{component:nt,prefixCls:Ye,colSpan:Se},it))},[St,bt,vt,Ae,Re,le,he,Se,Pe])}var K=W;function I(Qe){var Ye=Qe.className,St=Qe.style,bt=Qe.record,nt=Qe.index,vt=Qe.rowKey,Ue=Qe.getRowKey,Ae=Qe.rowExpandable,Re=Qe.expandedKeys,le=Qe.onRow,he=Qe.indent,Se=he===void 0?0:he,ve=Qe.rowComponent,Pe=Qe.cellComponent,it=Qe.childrenColumnName,xt=M.useContext(c.a),$t=xt.prefixCls,mn=xt.fixedInfoList,rn=M.useContext(N),ci=rn.fixHeader,Jn=rn.fixColumn,Sn=rn.horizonScroll,pi=rn.componentWidth,gi=rn.flattenColumns,xi=rn.expandableType,_i=rn.expandRowByClick,Dn=rn.onTriggerExpand,Ai=rn.rowClassName,Ln=rn.expandedRowClassName,Dt=rn.indentSize,Qn=rn.expandIcon,vi=rn.expandedRowRender,hi=rn.expandIconColumnIndex,bi=M.useState(!1),yi=Object(H.a)(bi,2),Fi=yi[0],ai=yi[1],pt=Re&&Re.has(Qe.recordKey);M.useEffect(function(){pt&&ai(!0)},[pt]);var Je=xi==="row"&&(!Ae||Ae(bt)),Ft=xi==="nest",Bt=it&&bt&&bt[it],Fe=Je||Ft,ue;le&&(ue=le(bt,nt));var si=function(C){if(_i&&Fe&&Dn(bt,C),ue&&ue.onClick){for(var L,z=arguments.length,oe=new Array(z>1?z-1:0),q=1;q<z;q++)oe[q-1]=arguments[q];(L=ue).onClick.apply(L,[C].concat(oe))}},je;typeof Ai=="string"?je=Ai:typeof Ai=="function"&&(je=Ai(bt,nt,Se));var Be=Object(A.a)(gi),Ie=M.createElement(ve,Object.assign({},ue,{"data-row-key":vt,className:X()(Ye,"".concat($t,"-row"),"".concat($t,"-row-level-").concat(Se),je,ue&&ue.className),style:Object(Z.a)(Object(Z.a)({},St),ue?ue.style:null),onClick:si}),gi.map(function(Q,C){var L=Q.render,z=Q.dataIndex,oe=Q.className,q=Be[C],ke=mn[C],ft;C===(hi||0)&&Ft&&(ft=M.createElement(M.Fragment,null,M.createElement("span",{style:{paddingLeft:"".concat(Dt*Se,"px")},className:"".concat($t,"-row-indent indent-level-").concat(Se)}),Qn({prefixCls:$t,expanded:pt,expandable:Bt,record:bt,onExpand:Dn})));var kt;return Q.onCell&&(kt=Q.onCell(bt,nt)),M.createElement(t.a,Object.assign({className:oe,ellipsis:Q.ellipsis,align:Q.align,component:Pe,prefixCls:$t,key:q,record:bt,index:nt,dataIndex:z,render:L,shouldCellUpdate:Q.shouldCellUpdate},ke,{appendNode:ft,additionalProps:kt}))})),_e;if(Je&&(Fi||pt)){var An=vi(bt,nt,Se+1,pt),zn=Ln&&Ln(bt,nt,Se);_e=M.createElement(K,{expanded:pt,className:X()("".concat($t,"-expanded-row"),"".concat($t,"-expanded-row-level-").concat(Se+1),zn),prefixCls:$t,fixHeader:ci,fixColumn:Jn,horizonScroll:Sn,component:ve,componentWidth:pi,cellComponent:Pe,colSpan:gi.length},An)}var Pn;return Bt&&pt&&(Pn=(bt[it]||[]).map(function(Q,C){var L=Ue(Q,C);return M.createElement(I,Object.assign({},Qe,{key:L,rowKey:L,record:Q,recordKey:L,index:C,indent:Se+1}))})),M.createElement(M.Fragment,null,Ie,_e,Pn)}I.displayName="BodyRow";var x=I,j=M.createContext(null),$=j;function ae(Qe){var Ye=Qe.columnKey,St=Qe.onColumnResize,bt=M.useRef();return M.useEffect(function(){bt.current&&St(Ye,bt.current.offsetWidth)},[]),M.createElement(_.a,{onResize:function(vt){var Ue=vt.offsetWidth;St(Ye,Ue)}},M.createElement("td",{ref:bt,style:{padding:0,border:0,height:0}},M.createElement("div",{style:{height:0,overflow:"hidden"}},"\xA0")))}function fe(Qe){var Ye=Qe.data,St=Qe.getRowKey,bt=Qe.measureColumnWidth,nt=Qe.expandedKeys,vt=Qe.onRow,Ue=Qe.rowExpandable,Ae=Qe.emptyNode,Re=Qe.childrenColumnName,le=M.useContext($),he=le.onColumnResize,Se=M.useContext(c.a),ve=Se.prefixCls,Pe=Se.getComponent,it=M.useContext(N),xt=it.fixHeader,$t=it.horizonScroll,mn=it.flattenColumns,rn=it.componentWidth;return M.useMemo(function(){var ci=Pe(["body","wrapper"],"tbody"),Jn=Pe(["body","row"],"tr"),Sn=Pe(["body","cell"],"td"),pi;Ye.length?pi=Ye.map(function(xi,_i){var Dn=St(xi,_i);return M.createElement(x,{key:Dn,rowKey:Dn,record:xi,recordKey:Dn,index:_i,rowComponent:Jn,cellComponent:Sn,expandedKeys:nt,onRow:vt,getRowKey:St,rowExpandable:Ue,childrenColumnName:Re})}):pi=M.createElement(K,{expanded:!0,className:"".concat(ve,"-placeholder"),prefixCls:ve,fixHeader:xt,fixColumn:$t,horizonScroll:$t,component:Jn,componentWidth:rn,cellComponent:Sn,colSpan:mn.length},Ae);var gi=Object(A.a)(mn);return M.createElement(ci,{className:"".concat(ve,"-tbody")},bt&&M.createElement("tr",{"aria-hidden":"true",className:"".concat(ve,"-measure-row"),style:{height:0}},gi.map(function(xi){return M.createElement(ae,{key:xi,columnKey:xi,onColumnResize:he})})),pi)},[Ye,ve,vt,bt,nt,St,Pe,rn,Ae,mn])}var pe=M.memo(fe);pe.displayName="Body";var Ce=pe,De=V("wRmb"),xe=V("xEkU"),Oe=V.n(xe);function Ee(Qe){var Ye=Object(M.useRef)(Qe),St=Object(M.useState)({}),bt=Object(H.a)(St,2),nt=bt[1],vt=Object(M.useRef)(null),Ue=Object(M.useRef)([]);function Ae(Re){vt.current===null&&(Ue.current=[],vt.current=Oe()(function(){Ue.current.forEach(function(le){Ye.current=le(Ye.current)}),vt.current=null,nt({})})),Ue.current.push(Re)}return Object(M.useEffect)(function(){return function(){Oe.a.cancel(vt.current)}},[]),[Ye.current,Ae]}function be(Qe){var Ye=Object(M.useRef)(Qe),St=Object(M.useRef)(null);function bt(){window.clearTimeout(St.current)}function nt(Ue){Ye.current=Ue,bt(),St.current=window.setTimeout(function(){Ye.current=null,St.current=null},100)}function vt(){return Ye.current}return Object(M.useEffect)(function(){return bt},[]),[nt,vt]}function te(Qe,Ye,St){var bt=Object(M.useMemo)(function(){for(var nt=[],vt=[],Ue=0,Ae=0,Re=0;Re<Ye;Re+=1)if(St==="rtl"){vt[Re]=Ae,Ae+=Qe[Re]||0;var le=Ye-Re-1;nt[le]=Ue,Ue+=Qe[le]||0}else{nt[Re]=Ue,Ue+=Qe[Re]||0;var he=Ye-Re-1;vt[he]=Ae,Ae+=Qe[he]||0}return{left:nt,right:vt}},[Qe,Ye,St]);return bt}var me=te;function ye(Qe){var Ye=Qe.className,St=Qe.children;return M.createElement("div",{className:Ye},St)}var Le=ye,$e=V("n6Qo");function Me(Qe){var Ye,St=Qe.prefixCls,bt=Qe.record,nt=Qe.onExpand,vt=Qe.expanded,Ue=Qe.expandable,Ae="".concat(St,"-row-expand-icon");if(!Ue)return M.createElement("span",{className:X()(Ae,"".concat(St,"-row-spaced"))});var Re=function(he){nt(bt,he),he.stopPropagation()};return M.createElement("span",{className:X()(Ae,(Ye={},Object(ie.a)(Ye,"".concat(St,"-row-expanded"),vt),Object(ie.a)(Ye,"".concat(St,"-row-collapsed"),!vt),Ye)),onClick:Re})}function ze(Qe,Ye,St){var bt=[];function nt(vt){(vt||[]).forEach(function(Ue,Ae){bt.push(Ye(Ue,Ae)),nt(Ue[St])})}return nt(Qe),bt}var ot=V("zT1h"),Et=V("y0+3"),_t=function(Ye,St){var bt,nt,vt=Ye.scrollBodyRef,Ue=Ye.onScroll,Ae=Ye.offsetScroll,Re=M.useContext(c.a),le=Re.prefixCls,he=((bt=vt.current)===null||bt===void 0?void 0:bt.scrollWidth)||0,Se=((nt=vt.current)===null||nt===void 0?void 0:nt.clientWidth)||0,ve=he&&Se*(Se/he),Pe=M.useRef(),it=Ee({scrollLeft:0,isHiddenScrollBar:!1}),xt=Object(H.a)(it,2),$t=xt[0],mn=xt[1],rn=M.useRef({delta:0,x:0}),ci=M.useState(!1),Jn=Object(H.a)(ci,2),Sn=Jn[0],pi=Jn[1],gi=function(){pi(!1)},xi=function(Dt){Dt.persist(),rn.current.delta=Dt.pageX-$t.scrollLeft,rn.current.x=0,pi(!0),Dt.preventDefault()},_i=function(Dt){var Qn,vi=Dt||((Qn=window)===null||Qn===void 0?void 0:Qn.event),hi=vi.buttons;if(!Sn||hi===0){Sn&&pi(!1);return}var bi=rn.current.x+Dt.pageX-rn.current.x-rn.current.delta;bi<=0&&(bi=0),bi+ve>=Se&&(bi=Se-ve),Ue({scrollLeft:bi/Se*(he+2)}),rn.current.x=Dt.pageX},Dn=function(){var Dt=Object(Et.b)(vt.current).top,Qn=Dt+vt.current.offsetHeight,vi=document.documentElement.scrollTop+window.innerHeight;Qn-Object(p.a)()<=vi||Dt>=vi-Ae?mn(function(hi){return Object(Z.a)(Object(Z.a)({},hi),{},{isHiddenScrollBar:!0})}):mn(function(hi){return Object(Z.a)(Object(Z.a)({},hi),{},{isHiddenScrollBar:!1})})},Ai=function(Dt){mn(function(Qn){return Object(Z.a)(Object(Z.a)({},Qn),{},{scrollLeft:Dt/he*Se||0})})};return M.useImperativeHandle(St,function(){return{setScrollLeft:Ai}}),M.useEffect(function(){var Ln=Object(ot.a)(document.body,"mouseup",gi,!1),Dt=Object(ot.a)(document.body,"mousemove",_i,!1);return Dn(),function(){Ln.remove(),Dt.remove()}},[ve,Sn]),M.useEffect(function(){var Ln=Object(ot.a)(window,"scroll",Dn,!1),Dt=Object(ot.a)(window,"resize",Dn,!1);return function(){Ln.remove(),Dt.remove()}},[]),M.useEffect(function(){$t.isHiddenScrollBar||mn(function(Ln){var Dt,Qn;return Object(Z.a)(Object(Z.a)({},Ln),{},{scrollLeft:vt.current.scrollLeft/((Dt=vt.current)===null||Dt===void 0?void 0:Dt.scrollWidth)*((Qn=vt.current)===null||Qn===void 0?void 0:Qn.clientWidth)})})},[$t.isHiddenScrollBar]),he<=Se||!ve||$t.isHiddenScrollBar?null:M.createElement("div",{style:{height:Object(p.a)(),width:Se,bottom:Ae},className:"".concat(le,"-sticky-scroll")},M.createElement("div",{onMouseDown:xi,ref:Pe,className:X()("".concat(le,"-sticky-scroll-bar"),Object(ie.a)({},"".concat(le,"-sticky-scroll-bar-active"),Sn)),style:{width:"".concat(ve,"px"),transform:"translate3d(".concat($t.scrollLeft,"px, 0, 0)")}}))},mt=M.forwardRef(_t);function ut(Qe,Ye){return M.useMemo(function(){var St=!!Qe;return{isSticky:St,stickyClassName:St?"".concat(Ye,"-sticky-header"):"",offsetHeader:Object(ee.a)(Qe)==="object"&&Qe.offsetHeader||0,offsetScroll:Object(ee.a)(Qe)==="object"&&Qe.offsetScroll||0}},[Qe,Ye])}var Xt=[],en={},sn="rc-table-internal-hook",pn=M.memo(function(Qe){var Ye=Qe.children;return Ye},function(Qe,Ye){return D()(Qe.props,Ye.props)?Qe.pingLeft!==Ye.pingLeft||Qe.pingRight!==Ye.pingRight:!1});function Un(Qe){var Ye,St=Qe.prefixCls,bt=Qe.className,nt=Qe.rowClassName,vt=Qe.style,Ue=Qe.data,Ae=Qe.rowKey,Re=Qe.scroll,le=Qe.tableLayout,he=Qe.direction,Se=Qe.title,ve=Qe.footer,Pe=Qe.summary,it=Qe.id,xt=Qe.showHeader,$t=Qe.components,mn=Qe.emptyText,rn=Qe.onRow,ci=Qe.onHeaderRow,Jn=Qe.internalHooks,Sn=Qe.transformColumns,pi=Qe.internalRefs,gi=Qe.sticky,xi=Ue||Xt,_i=!!xi.length,Dn=M.useState(0),Ai=Object(H.a)(Dn,2),Ln=Ai[0],Dt=Ai[1];M.useEffect(function(){Dt(Object(p.a)())});var Qn=M.useMemo(function(){return Object(A.c)($t,{})},[$t]),vi=M.useCallback(function(ei,ti){return Object(A.b)(Qn,ei)||ti},[Qn]),hi=M.useMemo(function(){return typeof Ae=="function"?Ae:function(ei){var ti=ei&&ei[Ae];return ti}},[Ae]),bi=Object(y.c)(Qe),yi=bi.expandIcon,Fi=bi.expandedRowKeys,ai=bi.defaultExpandedRowKeys,pt=bi.defaultExpandAllRows,Je=bi.expandedRowRender,Ft=bi.onExpand,Bt=bi.onExpandedRowsChange,Fe=bi.expandRowByClick,ue=bi.rowExpandable,si=bi.expandIconColumnIndex,je=bi.expandedRowClassName,Be=bi.childrenColumnName,Ie=bi.indentSize,_e=yi||Me,An=Be||"children",zn=M.useMemo(function(){return Je?"row":Qe.expandable&&Jn===sn&&Qe.expandable.__PARENT_RENDER_ICON__||xi.some(function(ei){return ei&&Object(ee.a)(ei)==="object"&&ei[An]})?"nest":!1},[!!Je,xi]),Pn=M.useState(function(){return ai||(pt?ze(xi,hi,An):[])}),Q=Object(H.a)(Pn,2),C=Q[0],L=Q[1],z=M.useMemo(function(){return new Set(Fi||C||[])},[Fi,C]),oe=M.useCallback(function(ei){var ti=hi(ei,xi.indexOf(ei)),nn,kn=z.has(ti);kn?(z.delete(ti),nn=Object(U.a)(z)):nn=[].concat(Object(U.a)(z),[ti]),L(nn),Ft&&Ft(!kn,ei),Bt&&Bt(nn)},[hi,z,xi,Ft,Bt]),q=M.useState(0),ke=Object(H.a)(q,2),ft=ke[0],kt=ke[1],an=Object(De.b)(Object(Z.a)(Object(Z.a)(Object(Z.a)({},Qe),bi),{},{expandable:!!Je,expandedKeys:z,getRowKey:hi,onTriggerExpand:oe,expandIcon:_e,expandIconColumnIndex:si,direction:he}),Jn===sn?Sn:null),dt=Object(H.a)(an,2),Pt=dt[0],tn=dt[1],Vn=M.useMemo(function(){return{columns:Pt,flattenColumns:tn}},[Pt,tn]),fi=M.useRef(),Hn=M.useRef(),Fn=M.useRef(),Qt=M.useState(!1),hn=Object(H.a)(Qt,2),on=hn[0],Nt=hn[1],$n=M.useState(!1),jn=Object(H.a)($n,2),Tn=jn[0],qn=jn[1],En=Ee(new Map),In=Object(H.a)(En,2),gn=In[0],Bn=In[1],Xn=Object(A.a)(tn),Zn=Xn.map(function(ei){return gn.get(ei)}),Kt=M.useMemo(function(){return Zn},[Zn.join("_")]),Lt=me(Kt,tn.length,he),yt=Re&&Object(A.d)(Re.y),It=Re&&Object(A.d)(Re.x),Ot=It&&tn.some(function(ei){var ti=ei.fixed;return ti}),Vt=M.useRef(),Zt=ut(gi,St),Gt=Zt.isSticky,Ut=Zt.offsetHeader,vn=Zt.offsetScroll,_n=Zt.stickyClassName,un,cn,bn;yt&&(cn={overflowY:"scroll",maxHeight:Re.y}),It&&(un={overflowX:"auto"},yt||(cn={overflowY:"hidden"}),bn={width:Re.x===!0?"auto":Re.x,minWidth:"100%"});var dn=M.useCallback(function(ei,ti){Bn(function(nn){var kn=new Map(nn);return kn.set(ei,ti),kn})},[]),Mt=be(null),Yt=Object(H.a)(Mt,2),qt=Yt[0],Wt=Yt[1];function fn(ei,ti){if(!ti)return;typeof ti=="function"?ti(ei):ti.scrollLeft!==ei&&(ti.scrollLeft=ei)}var On=function(ti){var nn=ti.currentTarget,kn=ti.scrollLeft,Yn=typeof kn=="number"?kn:nn.scrollLeft,ni=nn||en;if(!Wt()||Wt()===ni){var Mn;qt(ni),fn(Yn,Hn.current),fn(Yn,Fn.current),fn(Yn,(Mn=Vt.current)===null||Mn===void 0?void 0:Mn.setScrollLeft)}if(nn){var Li=nn.scrollWidth,ji=nn.clientWidth;Nt(Yn>0),qn(Yn<Li-ji)}},wn=function(){Fn.current&&On({currentTarget:Fn.current})},gt=function(ti){var nn=ti.width;wn(),kt(fi.current?fi.current.offsetWidth:nn)};M.useEffect(function(){return wn},[]),M.useEffect(function(){It&&wn()},[It]),M.useEffect(function(){Jn===sn&&pi&&(pi.body.current=Fn.current)});var rt=vi(["table"],"table"),Xe=M.useMemo(function(){return le||(Ot?Re.x==="max-content"?"auto":"fixed":yt||tn.some(function(ei){var ti=ei.ellipsis;return ti})?"fixed":"auto")},[yt,Ot,tn,le]),Ze,We={colWidths:Kt,columCount:tn.length,stickyOffsets:Lt,onHeaderRow:ci,fixHeader:yt},ct=M.useMemo(function(){return _i?null:typeof mn=="function"?mn():mn},[_i,mn]),et=M.createElement(Ce,{data:xi,measureColumnWidth:yt||It||Gt,expandedKeys:z,rowExpandable:ue,getRowKey:hi,onRow:rn,emptyNode:ct,childrenColumnName:An}),Ct=M.createElement(l,{colWidths:tn.map(function(ei){var ti=ei.width;return ti}),columns:tn}),jt=Pe&&M.createElement($e.b,null,Pe(xi)),wt=vi(["body"]);if(yt||Gt){var Jt;typeof wt=="function"?(Jt=wt(xi,{scrollbarSize:Ln,ref:Fn,onScroll:On}),We.colWidths=tn.map(function(ei,ti){var nn=ei.width,kn=ti===Pt.length-1?nn-Ln:nn;return typeof kn=="number"&&!Number.isNaN(kn)?kn:(Object(v.a)(!1,"When use `components.body` with render props. Each column should have a fixed value."),0)})):Jt=M.createElement("div",{style:Object(Z.a)(Object(Z.a)({},un),cn),onScroll:On,ref:Fn,className:X()("".concat(St,"-body"))},M.createElement(rt,{style:Object(Z.a)(Object(Z.a)({},bn),{},{tableLayout:Xe})},Ct,et,jt),Gt&&M.createElement(mt,{ref:Vt,offsetScroll:vn,scrollBodyRef:Fn,onScroll:On})),Ze=M.createElement(M.Fragment,null,xt!==!1&&M.createElement(b,Object.assign({noData:!xi.length},We,Vn,{direction:he,offsetHeader:Ut,stickyClassName:_n,ref:Hn,onScroll:On})),Jt)}else Ze=M.createElement("div",{style:Object(Z.a)(Object(Z.a)({},un),cn),className:X()("".concat(St,"-content")),onScroll:On,ref:Fn},M.createElement(rt,{style:Object(Z.a)(Object(Z.a)({},bn),{},{tableLayout:Xe})},Ct,xt!==!1&&M.createElement(E,Object.assign({},We,Vn)),et,jt));var Tt=Object(y.b)(Qe),At=M.createElement("div",Object.assign({className:X()(St,bt,(Ye={},Object(ie.a)(Ye,"".concat(St,"-rtl"),he==="rtl"),Object(ie.a)(Ye,"".concat(St,"-ping-left"),on),Object(ie.a)(Ye,"".concat(St,"-ping-right"),Tn),Object(ie.a)(Ye,"".concat(St,"-layout-fixed"),le==="fixed"),Object(ie.a)(Ye,"".concat(St,"-fixed-header"),yt),Object(ie.a)(Ye,"".concat(St,"-fixed-column"),Ot),Object(ie.a)(Ye,"".concat(St,"-scroll-horizontal"),It),Object(ie.a)(Ye,"".concat(St,"-has-fix-left"),tn[0]&&tn[0].fixed),Object(ie.a)(Ye,"".concat(St,"-has-fix-right"),tn[tn.length-1]&&tn[tn.length-1].fixed==="right"),Ye)),style:vt,id:it,ref:fi},Tt),M.createElement(pn,{pingLeft:on,pingRight:Tn,props:Object(Z.a)(Object(Z.a)({},Qe),{},{stickyOffsets:Lt,mergedExpandedKeys:z})},Se&&M.createElement(Le,{className:"".concat(St,"-title")},Se(xi)),M.createElement("div",{className:"".concat(St,"-container")},Ze),ve&&M.createElement(Le,{className:"".concat(St,"-footer")},ve(xi))));It&&(At=M.createElement(_.a,{onResize:gt},At));var Rn=M.useMemo(function(){return{prefixCls:St,getComponent:vi,scrollbarSize:Ln,direction:he,fixedInfoList:tn.map(function(ei,ti){return f(ti,ti,tn,Lt,he)}),isSticky:Gt}},[St,vi,Ln,he,tn,Lt,he,Gt]),yn=M.useMemo(function(){return Object(Z.a)(Object(Z.a)({},Vn),{},{tableLayout:Xe,rowClassName:nt,expandedRowClassName:je,componentWidth:ft,fixHeader:yt,fixColumn:Ot,horizonScroll:It,expandIcon:_e,expandableType:zn,expandRowByClick:Fe,expandedRowRender:Je,onTriggerExpand:oe,expandIconColumnIndex:si,indentSize:Ie})},[Vn,Xe,nt,je,ft,yt,Ot,It,_e,zn,Fe,Je,oe,si,Ie]),mi=M.useMemo(function(){return{onColumnResize:dn}},[dn]);return M.createElement(c.a.Provider,{value:Rn},M.createElement(N.Provider,{value:yn},M.createElement($.Provider,{value:mi},At)))}Un.Column=u.a,Un.ColumnGroup=o.a,Un.Summary=$e.a,Un.defaultProps={rowKey:"key",prefixCls:"rc-table",emptyText:function(){return"No Data"}};var Cn=st.b=Un},wRmb:function(zt,st,V){"use strict";V.d(st,"a",function(){return D});var ie=V("rePB"),Z=V("KQm4"),U=V("VTBJ"),ee=V("Ff2n"),H=V("q1tI"),M=V.n(H),Y=V("Kwbf"),X=V("Zm9Q"),k=V("hW8S");function D(u){return Object(X.a)(u).filter(function(r){return H.isValidElement(r)}).map(function(r){var i=r.key,t=r.props,c=t.children,f=Object(ee.a)(t,["children"]),A=Object(U.a)({key:i},f);return c&&(A.children=D(c)),A})}function v(u){return u.reduce(function(r,i){var t=i.fixed,c=t===!0?"left":t,f=i.children;return f&&f.length>0?[].concat(Object(Z.a)(r),Object(Z.a)(v(f).map(function(A){return Object(U.a)({fixed:c},A)}))):[].concat(Object(Z.a)(r),[Object(U.a)(Object(U.a)({},i),{},{fixed:c})])},[])}function _(u){for(var r=!0,i=0;i<u.length;i+=1){var t=u[i];if(r&&t.fixed!=="left")r=!1;else if(!r&&t.fixed==="left"){Object(Y.a)(!1,"Index ".concat(i-1," of `columns` missing `fixed='left'` prop."));break}}for(var c=!0,f=u.length-1;f>=0;f-=1){var A=u[f];if(c&&A.fixed!=="right")c=!1;else if(!c&&A.fixed==="right"){Object(Y.a)(!1,"Index ".concat(f+1," of `columns` missing `fixed='right'` prop."));break}}}function p(u){return u.map(function(r){var i=r.fixed,t=Object(ee.a)(r,["fixed"]),c=i;return i==="left"?c="right":i==="right"&&(c="left"),Object(U.a)({fixed:c},t)})}function o(u,r){var i=u.prefixCls,t=u.columns,c=u.children,f=u.expandable,A=u.expandedKeys,S=u.getRowKey,w=u.onTriggerExpand,R=u.expandIcon,O=u.rowExpandable,E=u.expandIconColumnIndex,y=u.direction,d=u.expandRowByClick,l=H.useMemo(function(){return t||D(c)},[t,c]),h=H.useMemo(function(){if(f){var F,N=E||0,W=l[N],K=(F={},Object(ie.a)(F,k.a,{className:"".concat(i,"-expand-icon-col")}),Object(ie.a)(F,"title",""),Object(ie.a)(F,"fixed",W?W.fixed:null),Object(ie.a)(F,"className","".concat(i,"-row-expand-icon-cell")),Object(ie.a)(F,"render",function(j,$,ae){var fe=S($,ae),pe=A.has(fe),Ce=O?O($):!0,De=R({prefixCls:i,expanded:pe,expandable:Ce,record:$,onExpand:w});return d?H.createElement("span",{onClick:function(Oe){return Oe.stopPropagation()}},De):De}),F),I=l.slice();return N>=0&&I.splice(N,0,K),I}return l},[f,l,S,A,R,y]),g=H.useMemo(function(){var F=h;return r&&(F=r(F)),F.length||(F=[{render:function(){return null}}]),F},[r,h,y]),b=H.useMemo(function(){return y==="rtl"?p(v(g)):v(g)},[g,y]);return[g,b]}st.b=o},"y0+3":function(zt,st,V){"use strict";V.d(st,"a",function(){return v}),V.d(st,"b",function(){return p});var ie=/margin|padding|width|height|max|min|offset/,Z={left:!0,top:!0},U={cssFloat:1,styleFloat:1,float:1};function ee(o){return o.nodeType===1?o.ownerDocument.defaultView.getComputedStyle(o,null):{}}function H(o,u,r){if(u=u.toLowerCase(),r==="auto"){if(u==="height")return o.offsetHeight;if(u==="width")return o.offsetWidth}return u in Z||(Z[u]=ie.test(u)),Z[u]?parseFloat(r)||0:r}function M(o,u){var r=arguments.length,i=ee(o);return u=U[u]?"cssFloat"in o.style?"cssFloat":"styleFloat":u,r===1?i:H(o,u,i[u]||o.style[u])}function Y(o,u,r){var i=arguments.length;if(u=U[u]?"cssFloat"in o.style?"cssFloat":"styleFloat":u,i===3)return typeof r=="number"&&ie.test(u)&&(r="".concat(r,"px")),o.style[u]=r,r;for(var t in u)u.hasOwnProperty(t)&&Y(o,t,u[t]);return ee(o)}function X(o){return o===document.body?document.documentElement.clientWidth:o.offsetWidth}function k(o){return o===document.body?window.innerHeight||document.documentElement.clientHeight:o.offsetHeight}function D(){var o=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),u=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);return{width:o,height:u}}function v(){var o=document.documentElement.clientWidth,u=window.innerHeight||document.documentElement.clientHeight;return{width:o,height:u}}function _(){return{scrollLeft:Math.max(document.documentElement.scrollLeft,document.body.scrollLeft),scrollTop:Math.max(document.documentElement.scrollTop,document.body.scrollTop)}}function p(o){var u=o.getBoundingClientRect(),r=document.documentElement;return{left:u.left+(window.pageXOffset||r.scrollLeft)-(r.clientLeft||document.body.clientLeft||0),top:u.top+(window.pageYOffset||r.scrollTop)-(r.clientTop||document.body.clientTop||0)}}},yQHh:function(zt,st,V){},"yTi+":function(zt,st,V){zt.exports=V.p+"static/AssistantCode3.fdd8db3c.jpeg"},zQJ6:function(zt,st,V){zt.exports={flex_box_center:"flex_box_center___FrKC-",flex_space_between:"flex_space_between___3Xq0k",flex_box_vertical_center:"flex_box_vertical_center___2dDK4",flex_box_center_end:"flex_box_center_end___-_svz",flex_box_column:"flex_box_column___AMsqw",bg:"bg___Ka7gN",containerTitle:"containerTitle___UPWE-",containerDesc:"containerDesc___-C8Mv",d1:"d1___1bM93",name:"name___1Rp75",diff:"diff___24T5J",time:"time___26Wly",d2:"d2___17KZm",listItem:"listItem___3kcp7",info:"info___trdzW",title:"title___3ubEr",titleLeft:"titleLeft___3ovNY",titleRight:"titleRight___34e8-",acitons:"acitons___F8glz",formWrap:"formWrap___3Cib3",button:"button___3jAVF"}}}]);
|