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.
373 lines
1.1 MiB
373 lines
1.1 MiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[175,3,5,7,8,17,20],{"+NIl":function(Fe,Ce,j){(function(J){J(j("VrN/"))})(function(J){"use strict";J.defineMode("stex",function(K,R){"use strict";function H(T,p){T.cmdState.push(p)}function N(T){return T.cmdState.length>0?T.cmdState[T.cmdState.length-1]:null}function x(T){var p=T.cmdState.pop();p&&p.closeBracket()}function U(T){for(var p=T.cmdState,m=p.length-1;m>=0;m--){var i=p[m];if(i.name=="DEFAULT")continue;return i}return{styleIdentifier:function(){return null}}}function I(T,p,m){return function(){this.name=T,this.bracketNo=0,this.style=p,this.styles=m,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var E={};E.importmodule=I("importmodule","tag",["string","builtin"]),E.documentclass=I("documentclass","tag",["","atom"]),E.usepackage=I("usepackage","tag",["atom"]),E.begin=I("begin","tag",["atom"]),E.end=I("end","tag",["atom"]),E.label=I("label","tag",["atom"]),E.ref=I("ref","tag",["atom"]),E.eqref=I("eqref","tag",["atom"]),E.cite=I("cite","tag",["atom"]),E.bibitem=I("bibitem","tag",["atom"]),E.Bibitem=I("Bibitem","tag",["atom"]),E.RBibitem=I("RBibitem","tag",["atom"]),E.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function L(T,p){T.f=p}function f(T,p){var m;if(T.match(/^\\[a-zA-Z@]+/)){var i=T.current().slice(1);return m=E.hasOwnProperty(i)?E[i]:E.DEFAULT,m=new m,H(p,m),L(p,P),m.style}if(T.match(/^\\[$&%#{}_]/))return"tag";if(T.match(/^\\[,;!\/\\]/))return"tag";if(T.match("\\["))return L(p,function(u,c){return S(u,c,"\\]")}),"keyword";if(T.match("\\("))return L(p,function(u,c){return S(u,c,"\\)")}),"keyword";if(T.match("$$"))return L(p,function(u,c){return S(u,c,"$$")}),"keyword";if(T.match("$"))return L(p,function(u,c){return S(u,c,"$")}),"keyword";var a=T.next();if(a=="%")return T.skipToEnd(),"comment";if(a=="}"||a=="]"){if(m=N(p),m)m.closeBracket(a),L(p,P);else return"error";return"bracket"}else return a=="{"||a=="["?(m=E.DEFAULT,m=new m,H(p,m),"bracket"):/\d/.test(a)?(T.eatWhile(/[\w.%]/),"atom"):(T.eatWhile(/[\w\-_]/),m=U(p),m.name=="begin"&&(m.argument=T.current()),m.styleIdentifier())}function S(T,p,m){if(T.eatSpace())return null;if(m&&T.match(m))return L(p,f),"keyword";if(T.match(/^\\[a-zA-Z@]+/))return"tag";if(T.match(/^[a-zA-Z]+/))return"variable-2";if(T.match(/^\\[$&%#{}_]/))return"tag";if(T.match(/^\\[,;!\/]/))return"tag";if(T.match(/^[\^_&]/))return"tag";if(T.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(T.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var i=T.next();return i=="{"||i=="}"||i=="["||i=="]"||i=="("||i==")"?"bracket":i=="%"?(T.skipToEnd(),"comment"):"error"}function P(T,p){var m=T.peek(),i;return m=="{"||m=="["?(i=N(p),i.openBracket(m),T.eat(m),L(p,f),"bracket"):/[ \t\r]/.test(m)?(T.eat(m),null):(L(p,f),x(p),f(T,p))}return{startState:function(){var T=R.inMathMode?function(p,m){return S(p,m)}:f;return{cmdState:[],f:T}},copyState:function(T){return{cmdState:T.cmdState.slice(),f:T.f}},token:function(T,p){return p.f(T,p)},blankLine:function(T){T.f=f,T.cmdState.length=0},lineComment:"%"}}),J.defineMIME("text/x-stex","stex"),J.defineMIME("text/x-latex","stex")})},"+k/U":function(Fe,Ce,j){Fe.exports={pagination:"pagination___2XcQw",info:"info___12Y4R"}},"07cG":function(Fe,Ce,j){Fe.exports={ldsRing:"ldsRing___2F8W7",idsRingWrapper:"idsRingWrapper___fC2cF",ldsring:"ldsring___3A88y"}},"19Vz":function(Fe,Ce,j){(function(J){J(j("VrN/"))})(function(J){J.defineOption("placeholder","",function(I,E,L){var f=L&&L!=J.Init;if(E&&!f)I.on("blur",N),I.on("change",x),I.on("swapDoc",x),J.on(I.getInputField(),"compositionupdate",I.state.placeholderCompose=function(){H(I)}),x(I);else if(!E&&f){I.off("blur",N),I.off("change",x),I.off("swapDoc",x),J.off(I.getInputField(),"compositionupdate",I.state.placeholderCompose),K(I);var S=I.getWrapperElement();S.className=S.className.replace(" CodeMirror-empty","")}E&&!I.hasFocus()&&N(I)});function K(I){I.state.placeholder&&(I.state.placeholder.parentNode.removeChild(I.state.placeholder),I.state.placeholder=null)}function R(I){K(I);var E=I.state.placeholder=document.createElement("pre");E.style.cssText="height: 0; overflow: visible",E.style.direction=I.getOption("direction"),E.className="CodeMirror-placeholder CodeMirror-line-like";var L=I.getOption("placeholder");typeof L=="string"&&(L=document.createTextNode(L)),E.appendChild(L),I.display.lineSpace.insertBefore(E,I.display.lineSpace.firstChild)}function H(I){setTimeout(function(){var E=!1,L=I.getInputField();L.nodeName=="TEXTAREA"?E=!L.value:I.lineCount()==1&&(E=!/[^\u200b]/.test(L.querySelector(".CodeMirror-line").textContent)),E?R(I):K(I)},20)}function N(I){U(I)&&R(I)}function x(I){var E=I.getWrapperElement(),L=U(I);E.className=E.className.replace(" CodeMirror-empty","")+(L?" CodeMirror-empty":""),L?R(I):K(I)}function U(I){return I.lineCount()===1&&I.getLine(0)===""}})},"1eCo":function(Fe,Ce,j){(function(J){J(j("VrN/"))})(function(J){"use strict";var K={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},R={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};J.defineMode("xml",function(H,N){var x=H.indentUnit,U={},I=N.htmlMode?K:R;for(var E in I)U[E]=I[E];for(var E in N)U[E]=N[E];var L,f;function S(s,w){function C(B){return w.tokenize=B,B(s,w)}var v=s.next();if(v=="<")return s.eat("!")?s.eat("[")?s.match("CDATA[")?C(p("atom","]]>")):null:s.match("--")?C(p("comment","-->")):s.match("DOCTYPE",!0,!0)?(s.eatWhile(/[\w\._\-]/),C(m(1))):null:s.eat("?")?(s.eatWhile(/[\w\._\-]/),w.tokenize=p("meta","?>"),"meta"):(L=s.eat("/")?"closeTag":"openTag",w.tokenize=P,"tag bracket");if(v=="&"){var M;return s.eat("#")?s.eat("x")?M=s.eatWhile(/[a-fA-F\d]/)&&s.eat(";"):M=s.eatWhile(/[\d]/)&&s.eat(";"):M=s.eatWhile(/[\w\.\-:]/)&&s.eat(";"),M?"atom":"error"}else return s.eatWhile(/[^&<]/),null}S.isInText=!0;function P(s,w){var C=s.next();if(C==">"||C=="/"&&s.eat(">"))return w.tokenize=S,L=C==">"?"endTag":"selfcloseTag","tag bracket";if(C=="=")return L="equals",null;if(C=="<"){w.tokenize=S,w.state=c,w.tagName=w.tagStart=null;var v=w.tokenize(s,w);return v?v+" tag error":"tag error"}else return/[\'\"]/.test(C)?(w.tokenize=T(C),w.stringStartCol=s.column(),w.tokenize(s,w)):(s.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function T(s){var w=function(C,v){for(;!C.eol();)if(C.next()==s){v.tokenize=P;break}return"string"};return w.isInAttribute=!0,w}function p(s,w){return function(C,v){for(;!C.eol();){if(C.match(w)){v.tokenize=S;break}C.next()}return s}}function m(s){return function(w,C){for(var v;(v=w.next())!=null;){if(v=="<")return C.tokenize=m(s+1),C.tokenize(w,C);if(v==">")if(s==1){C.tokenize=S;break}else return C.tokenize=m(s-1),C.tokenize(w,C)}return"meta"}}function i(s,w,C){this.prev=s.context,this.tagName=w,this.indent=s.indented,this.startOfLine=C,(U.doNotIndent.hasOwnProperty(w)||s.context&&s.context.noIndent)&&(this.noIndent=!0)}function a(s){s.context&&(s.context=s.context.prev)}function u(s,w){for(var C;;){if(!s.context)return;if(C=s.context.tagName,!U.contextGrabbers.hasOwnProperty(C)||!U.contextGrabbers[C].hasOwnProperty(w))return;a(s)}}function c(s,w,C){return s=="openTag"?(C.tagStart=w.column(),O):s=="closeTag"?b:c}function O(s,w,C){return s=="word"?(C.tagName=w.current(),f="tag",_):U.allowMissingTagName&&s=="endTag"?(f="tag bracket",_(s,w,C)):(f="error",O)}function b(s,w,C){if(s=="word"){var v=w.current();return C.context&&C.context.tagName!=v&&U.implicitlyClosed.hasOwnProperty(C.context.tagName)&&a(C),C.context&&C.context.tagName==v||U.matchClosing===!1?(f="tag",y):(f="tag error",D)}else return U.allowMissingTagName&&s=="endTag"?(f="tag bracket",y(s,w,C)):(f="error",D)}function y(s,w,C){return s!="endTag"?(f="error",y):(a(C),c)}function D(s,w,C){return f="error",y(s,w,C)}function _(s,w,C){if(s=="word")return f="attribute",h;if(s=="endTag"||s=="selfcloseTag"){var v=C.tagName,M=C.tagStart;return C.tagName=C.tagStart=null,s=="selfcloseTag"||U.autoSelfClosers.hasOwnProperty(v)?u(C,v):(u(C,v),C.context=new i(C,v,M==C.indented)),c}return f="error",_}function h(s,w,C){return s=="equals"?d:(U.allowMissing||(f="error"),_(s,w,C))}function d(s,w,C){return s=="string"?o:s=="word"&&U.allowUnquoted?(f="string",_):(f="error",_(s,w,C))}function o(s,w,C){return s=="string"?o:_(s,w,C)}return{startState:function(s){var w={tokenize:S,state:c,indented:s||0,tagName:null,tagStart:null,context:null};return s!=null&&(w.baseIndent=s),w},token:function(s,w){if(!w.tagName&&s.sol()&&(w.indented=s.indentation()),s.eatSpace())return null;L=null;var C=w.tokenize(s,w);return(C||L)&&C!="comment"&&(f=null,w.state=w.state(L||C,s,w),f&&(C=f=="error"?C+" error":f)),C},indent:function(s,w,C){var v=s.context;if(s.tokenize.isInAttribute)return s.tagStart==s.indented?s.stringStartCol+1:s.indented+x;if(v&&v.noIndent)return J.Pass;if(s.tokenize!=P&&s.tokenize!=S)return C?C.match(/^(\s*)/)[0].length:0;if(s.tagName)return U.multilineTagIndentPastTag!==!1?s.tagStart+s.tagName.length+2:s.tagStart+x*(U.multilineTagIndentFactor||1);if(U.alignCDATA&&/<!\[CDATA\[/.test(w))return 0;var M=w&&/^<(\/)?([\w_:\.-]*)/.exec(w);if(M&&M[1])for(;v;)if(v.tagName==M[2]){v=v.prev;break}else if(U.implicitlyClosed.hasOwnProperty(v.tagName))v=v.prev;else break;else if(M)for(;v;){var B=U.contextGrabbers[v.tagName];if(B&&B.hasOwnProperty(M[2]))v=v.prev;else break}for(;v&&v.prev&&!v.startOfLine;)v=v.prev;return v?v.indent+x:s.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:U.htmlMode?"html":"xml",helperType:U.htmlMode?"html":"xml",skipAttribute:function(s){s.state==d&&(s.state=_)},xmlCurrentTag:function(s){return s.tagName?{name:s.tagName,close:s.type=="closeTag"}:null},xmlCurrentContext:function(s){for(var w=[],C=s.context;C;C=C.prev)C.tagName&&w.push(C.tagName);return w.reverse()}}}),J.defineMIME("text/xml","xml"),J.defineMIME("application/xml","xml"),J.mimeModes.hasOwnProperty("text/html")||J.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"1j5w":function(Fe,Ce,j){"use strict";j.d(Ce,"d",function(){return Rt}),j.d(Ce,"b",function(){return we}),j.d(Ce,"c",function(){return Je}),j.d(Ce,"a",function(){return It});var J=j("VTBJ"),K=j("1OyB"),R=j("vuIU"),H=j("JX7q"),N=j("Ji7U"),x=j("LK+K"),U=j("q1tI"),I=j("I8Z2"),E=j("BGR+"),L=j("wx14"),f=j("rePB"),S=j("4IlW"),P=j("2GS6"),T=j("Gytx"),p=j.n(T),m=j("TSYQ"),i=j.n(m),a=j("U8pU"),u=j("ODXe"),c=/iPhone/i,O=/iPod/i,b=/iPad/i,y=/\bAndroid(?:.+)Mobile\b/i,D=/Android/i,_=/\bAndroid(?:.+)SD4930UR\b/i,h=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,d=/Windows Phone/i,o=/\bWindows(?:.+)ARM\b/i,s=/BlackBerry/i,w=/BB10/i,C=/Opera Mini/i,v=/\b(CriOS|Chrome)(?:.+)Mobile/i,M=/Mobile(?:.+)Firefox\b/i;function B(it,Be){return it.test(Be)}function F(it){var Be=it||(typeof navigator!="undefined"?navigator.userAgent:""),Ue=Be.split("[FBAN");if(typeof Ue[1]!="undefined"){var Re=Ue,se=Object(u.a)(Re,1);Be=se[0]}if(Ue=Be.split("Twitter"),typeof Ue[1]!="undefined"){var pe=Ue,je=Object(u.a)(pe,1);Be=je[0]}var Ie={apple:{phone:B(c,Be)&&!B(d,Be),ipod:B(O,Be),tablet:!B(c,Be)&&B(b,Be)&&!B(d,Be),device:(B(c,Be)||B(O,Be)||B(b,Be))&&!B(d,Be)},amazon:{phone:B(_,Be),tablet:!B(_,Be)&&B(h,Be),device:B(_,Be)||B(h,Be)},android:{phone:!B(d,Be)&&B(_,Be)||!B(d,Be)&&B(y,Be),tablet:!B(d,Be)&&!B(_,Be)&&!B(y,Be)&&(B(h,Be)||B(D,Be)),device:!B(d,Be)&&(B(_,Be)||B(h,Be)||B(y,Be)||B(D,Be))||B(/\bokhttp\b/i,Be)},windows:{phone:B(d,Be),tablet:B(o,Be),device:B(d,Be)||B(o,Be)},other:{blackberry:B(s,Be),blackberry10:B(w,Be),opera:B(C,Be),firefox:B(M,Be),chrome:B(v,Be),device:B(s,Be)||B(w,Be)||B(C,Be)||B(M,Be)||B(v,Be)},any:null,phone:null,tablet:null};return Ie.any=Ie.apple.device||Ie.android.device||Ie.windows.device||Ie.other.device,Ie.phone=Ie.apple.phone||Ie.android.phone||Ie.windows.phone,Ie.tablet=Ie.apple.tablet||Ie.android.tablet||Ie.windows.tablet,Ie}var Q=Object(J.a)(Object(J.a)({},F()),{},{isMobile:F}),G=Q;function W(){}function $(it,Be,Ue){var Re=Be||"";return it.key||"".concat(Re,"item_").concat(Ue)}function re(it){return"".concat(it,"-menu-")}function ae(it,Be){var Ue=-1;U.Children.forEach(it,function(Re){Ue+=1,Re&&Re.type&&Re.type.isMenuItemGroup?U.Children.forEach(Re.props.children,function(se){Ue+=1,Be(se,Ue)}):Be(Re,Ue)})}function he(it,Be,Ue){if(!it||Ue.find)return;U.Children.forEach(it,function(Re){if(Re){var se=Re.type;if(!se||!(se.isSubMenu||se.isMenuItem||se.isMenuItemGroup))return;Be.indexOf(Re.key)!==-1?Ue.find=!0:Re.props.children&&he(Re.props.children,Be,Ue)}})}var Te=["defaultSelectedKeys","selectedKeys","defaultOpenKeys","openKeys","mode","getPopupContainer","onSelect","onDeselect","onDestroy","openTransitionName","openAnimation","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","triggerSubMenuAction","level","selectable","multiple","onOpenChange","visible","focusable","defaultActiveFirst","prefixCls","inlineIndent","parentMenu","title","rootPrefixCls","eventKey","active","onItemHover","onTitleMouseEnter","onTitleMouseLeave","onTitleClick","popupAlign","popupOffset","isOpen","renderMenuItem","manualRef","subMenuKey","disabled","index","isSelected","store","activeKey","builtinPlacements","overflowedIndicator","motion","attribute","value","popupClassName","inlineCollapsed","menu","theme","itemIcon","expandIcon"],ye=function(Be){var Ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Re=Be&&typeof Be.getBoundingClientRect=="function"&&Be.getBoundingClientRect().width;if(Re){if(Ue){var se=getComputedStyle(Be),pe=se.marginLeft,je=se.marginRight;Re+=+pe.replace("px","")+ +je.replace("px","")}Re=+Re.toFixed(6)}return Re||0},Ee=function(Be,Ue,Re){Be&&Object(a.a)(Be.style)==="object"&&(Be.style[Ue]=Re)},Oe=function(){return G.any},_e=j("KQm4"),fe=j("Ff2n"),le=j("i8i4"),Me=j("bdgK"),ot=j("uciX"),ut=j("8XRh"),rt={adjustX:1,adjustY:1},tt={topLeft:{points:["bl","tl"],overflow:rt,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:rt,offset:[0,7]},leftTop:{points:["tr","tl"],overflow:rt,offset:[-4,0]},rightTop:{points:["tl","tr"],overflow:rt,offset:[4,0]}},ze={topLeft:{points:["bl","tl"],overflow:rt,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:rt,offset:[0,7]},rightTop:{points:["tr","tl"],overflow:rt,offset:[-4,0]},leftTop:{points:["tl","tr"],overflow:rt,offset:[4,0]}},$e=tt,ct=0,vt={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"},at=function(Be,Ue,Re){var se=re(Ue),pe=Be.getState();Be.setState({defaultActiveFirst:Object(J.a)(Object(J.a)({},pe.defaultActiveFirst),{},Object(f.a)({},se,Re))})},et=function(it){Object(N.a)(Ue,it);var Be=Object(x.a)(Ue);function Ue(Re){var se;Object(K.a)(this,Ue),se=Be.call(this,Re),se.onDestroy=function(Ae){se.props.onDestroy(Ae)},se.onKeyDown=function(Ae){var qe=Ae.keyCode,pt=se.menuInstance,mt=se.props,Lt=mt.isOpen,mn=mt.store;if(qe===S.a.ENTER)return se.onTitleClick(Ae),at(mn,se.props.eventKey,!0),!0;if(qe===S.a.RIGHT)return Lt?pt.onKeyDown(Ae):(se.triggerOpenChange(!0),at(mn,se.props.eventKey,!0)),!0;if(qe===S.a.LEFT){var hn;if(Lt)hn=pt.onKeyDown(Ae);else return;return hn||(se.triggerOpenChange(!1),hn=!0),hn}return Lt&&(qe===S.a.UP||qe===S.a.DOWN)?pt.onKeyDown(Ae):void 0},se.onOpenChange=function(Ae){se.props.onOpenChange(Ae)},se.onPopupVisibleChange=function(Ae){se.triggerOpenChange(Ae,Ae?"mouseenter":"mouseleave")},se.onMouseEnter=function(Ae){var qe=se.props,pt=qe.eventKey,mt=qe.onMouseEnter,Lt=qe.store;at(Lt,se.props.eventKey,!1),mt({key:pt,domEvent:Ae})},se.onMouseLeave=function(Ae){var qe=se.props,pt=qe.parentMenu,mt=qe.eventKey,Lt=qe.onMouseLeave;pt.subMenuInstance=Object(H.a)(se),Lt({key:mt,domEvent:Ae})},se.onTitleMouseEnter=function(Ae){var qe=se.props,pt=qe.eventKey,mt=qe.onItemHover,Lt=qe.onTitleMouseEnter;mt({key:pt,hover:!0}),Lt({key:pt,domEvent:Ae})},se.onTitleMouseLeave=function(Ae){var qe=se.props,pt=qe.parentMenu,mt=qe.eventKey,Lt=qe.onItemHover,mn=qe.onTitleMouseLeave;pt.subMenuInstance=Object(H.a)(se),Lt({key:mt,hover:!1}),mn({key:mt,domEvent:Ae})},se.onTitleClick=function(Ae){var qe=Object(H.a)(se),pt=qe.props;if(pt.onTitleClick({key:pt.eventKey,domEvent:Ae}),pt.triggerSubMenuAction==="hover")return;se.triggerOpenChange(!pt.isOpen,"click"),at(pt.store,se.props.eventKey,!1)},se.onSubMenuClick=function(Ae){typeof se.props.onClick=="function"&&se.props.onClick(se.addKeyPath(Ae))},se.onSelect=function(Ae){se.props.onSelect(Ae)},se.onDeselect=function(Ae){se.props.onDeselect(Ae)},se.getPrefixCls=function(){return"".concat(se.props.rootPrefixCls,"-submenu")},se.getActiveClassName=function(){return"".concat(se.getPrefixCls(),"-active")},se.getDisabledClassName=function(){return"".concat(se.getPrefixCls(),"-disabled")},se.getSelectedClassName=function(){return"".concat(se.getPrefixCls(),"-selected")},se.getOpenClassName=function(){return"".concat(se.props.rootPrefixCls,"-submenu-open")},se.saveMenuInstance=function(Ae){se.menuInstance=Ae},se.addKeyPath=function(Ae){return Object(J.a)(Object(J.a)({},Ae),{},{keyPath:(Ae.keyPath||[]).concat(se.props.eventKey)})},se.triggerOpenChange=function(Ae,qe){var pt=se.props.eventKey,mt=function(){se.onOpenChange({key:pt,item:Object(H.a)(se),trigger:qe,open:Ae})};qe==="mouseenter"?se.mouseenterTimeout=setTimeout(function(){mt()},0):mt()},se.isChildrenSelected=function(){var Ae={find:!1};return he(se.props.children,se.props.selectedKeys,Ae),Ae.find},se.isOpen=function(){return se.props.openKeys.indexOf(se.props.eventKey)!==-1},se.adjustWidth=function(){if(!se.subMenuTitle||!se.menuInstance)return;var Ae=le.findDOMNode(se.menuInstance);if(Ae.offsetWidth>=se.subMenuTitle.offsetWidth)return;Ae.style.minWidth="".concat(se.subMenuTitle.offsetWidth,"px")},se.saveSubMenuTitle=function(Ae){se.subMenuTitle=Ae},se.getBaseProps=function(){var Ae=Object(H.a)(se),qe=Ae.props;return{mode:qe.mode==="horizontal"?"vertical":qe.mode,visible:se.props.isOpen,level:qe.level+1,inlineIndent:qe.inlineIndent,focusable:!1,onClick:se.onSubMenuClick,onSelect:se.onSelect,onDeselect:se.onDeselect,onDestroy:se.onDestroy,selectedKeys:qe.selectedKeys,eventKey:"".concat(qe.eventKey,"-menu-"),openKeys:qe.openKeys,motion:qe.motion,onOpenChange:se.onOpenChange,subMenuOpenDelay:qe.subMenuOpenDelay,parentMenu:Object(H.a)(se),subMenuCloseDelay:qe.subMenuCloseDelay,forceSubMenuRender:qe.forceSubMenuRender,triggerSubMenuAction:qe.triggerSubMenuAction,builtinPlacements:qe.builtinPlacements,defaultActiveFirst:qe.store.getState().defaultActiveFirst[re(qe.eventKey)],multiple:qe.multiple,prefixCls:qe.rootPrefixCls,id:se.internalMenuId,manualRef:se.saveMenuInstance,itemIcon:qe.itemIcon,expandIcon:qe.expandIcon,direction:qe.direction}},se.getMotion=function(Ae,qe){var pt=Object(H.a)(se),mt=pt.haveRendered,Lt=se.props,mn=Lt.motion,hn=Lt.rootPrefixCls,en=Object(J.a)(Object(J.a)({},mn),{},{leavedClassName:"".concat(hn,"-hidden"),removeOnLeave:!1,motionAppear:mt||!qe||Ae!=="inline"});return en};var pe=Re.store,je=Re.eventKey,Ie=pe.getState(),lt=Ie.defaultActiveFirst;se.isRootMenu=!1;var st=!1;return lt&&(st=lt[je]),at(pe,je,st),se}return Object(R.a)(Ue,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var se=this,pe=this.props,je=pe.mode,Ie=pe.parentMenu,lt=pe.manualRef;if(lt&<(this),je!=="horizontal"||!Ie.isRootMenu||!this.props.isOpen)return;this.minWidthTimeout=setTimeout(function(){return se.adjustWidth()},0)}},{key:"componentWillUnmount",value:function(){var se=this.props,pe=se.onDestroy,je=se.eventKey;pe&&pe(je),this.minWidthTimeout&&clearTimeout(this.minWidthTimeout),this.mouseenterTimeout&&clearTimeout(this.mouseenterTimeout)}},{key:"renderChildren",value:function(se){var pe=this,je=this.getBaseProps(),Ie=this.getMotion(je.mode,je.visible);if(this.haveRendered=!0,this.haveOpened=this.haveOpened||je.visible||je.forceSubMenuRender,!this.haveOpened)return U.createElement("div",null);var lt=je.direction;return U.createElement(ut.default,Object.assign({visible:je.visible},Ie),function(st){var Ae=st.className,qe=st.style,pt=i()("".concat(je.prefixCls,"-sub"),Ae,Object(f.a)({},"".concat(je.prefixCls,"-rtl"),lt==="rtl"));return U.createElement(ge,Object.assign({},je,{id:pe.internalMenuId,className:pt,style:qe}),se)})}},{key:"render",value:function(){var se,pe=Object(J.a)({},this.props),je=pe.isOpen,Ie=this.getPrefixCls(),lt=pe.mode==="inline",st=i()(Ie,"".concat(Ie,"-").concat(pe.mode),(se={},Object(f.a)(se,pe.className,!!pe.className),Object(f.a)(se,this.getOpenClassName(),je),Object(f.a)(se,this.getActiveClassName(),pe.active||je&&!lt),Object(f.a)(se,this.getDisabledClassName(),pe.disabled),Object(f.a)(se,this.getSelectedClassName(),this.isChildrenSelected()),se));this.internalMenuId||(pe.eventKey?this.internalMenuId="".concat(pe.eventKey,"$Menu"):(ct+=1,this.internalMenuId="$__$".concat(ct,"$Menu")));var Ae={},qe={},pt={};pe.disabled||(Ae={onMouseLeave:this.onMouseLeave,onMouseEnter:this.onMouseEnter},qe={onClick:this.onTitleClick},pt={onMouseEnter:this.onTitleMouseEnter,onMouseLeave:this.onTitleMouseLeave});var mt={},Lt=pe.direction;lt&&(Lt==="rtl"?mt.paddingRight=pe.inlineIndent*pe.level:mt.paddingLeft=pe.inlineIndent*pe.level);var mn={};this.props.isOpen&&(mn={"aria-owns":this.internalMenuId});var hn=null;pe.mode!=="horizontal"&&(hn=this.props.expandIcon,typeof this.props.expandIcon=="function"&&(hn=U.createElement(this.props.expandIcon,Object(J.a)({},this.props))));var en=U.createElement("div",Object.assign({ref:this.saveSubMenuTitle,style:mt,className:"".concat(Ie,"-title"),role:"button"},pt,qe,{"aria-expanded":je},mn,{"aria-haspopup":"true",title:typeof pe.title=="string"?pe.title:void 0}),pe.title,hn||U.createElement("i",{className:"".concat(Ie,"-arrow")})),Dt=this.renderChildren(pe.children),xn=pe.parentMenu.isRootMenu?pe.parentMenu.props.getPopupContainer:function(Gt){return Gt.parentNode},He=vt[pe.mode],ht=pe.popupOffset?{offset:pe.popupOffset}:{},St=pe.mode==="inline"?"":pe.popupClassName;St+=Lt==="rtl"?" ".concat(Ie,"-rtl"):"";var Xt=pe.disabled,an=pe.triggerSubMenuAction,un=pe.subMenuOpenDelay,Ye=pe.forceSubMenuRender,ft=pe.subMenuCloseDelay,kt=pe.builtinPlacements;Te.forEach(function(Gt){return delete pe[Gt]}),delete pe.onClick;var vn=Lt==="rtl"?Object.assign({},ze,kt):Object.assign({},tt,kt);return delete pe.direction,U.createElement("li",Object.assign({},pe,Ae,{className:st,role:"menuitem"}),lt&&en,lt&&Dt,!lt&&U.createElement(ot.a,{prefixCls:Ie,popupClassName:i()("".concat(Ie,"-popup"),St),getPopupContainer:xn,builtinPlacements:vn,popupPlacement:He,popupVisible:je,popupAlign:ht,popup:Dt,action:Xt?[]:[an],mouseEnterDelay:un,mouseLeaveDelay:ft,onPopupVisibleChange:this.onPopupVisibleChange,forceRender:Ye},en))}}]),Ue}(U.Component);et.defaultProps={onMouseEnter:W,onMouseLeave:W,onTitleMouseEnter:W,onTitleMouseLeave:W,onTitleClick:W,manualRef:W,mode:"vertical",title:""};var nt=Object(I.b)(function(it,Be){var Ue=it.openKeys,Re=it.activeKey,se=it.selectedKeys,pe=Be.eventKey,je=Be.subMenuKey;return{isOpen:Ue.indexOf(pe)>-1,active:Re[je]===pe,selectedKeys:se}})(et);nt.isSubMenu=!0;var Rt=nt,Ct="menuitem-overflowed",xt=.5,yt=function(it){Object(N.a)(Ue,it);var Be=Object(x.a)(Ue);function Ue(){var Re;return Object(K.a)(this,Ue),Re=Be.apply(this,arguments),Re.resizeObserver=null,Re.mutationObserver=null,Re.originalTotalWidth=0,Re.overflowedItems=[],Re.menuItemSizes=[],Re.cancelFrameId=null,Re.state={lastVisibleIndex:void 0},Re.getMenuItemNodes=function(){var se=Re.props.prefixCls,pe=le.findDOMNode(Object(H.a)(Re));return pe?[].slice.call(pe.children).filter(function(je){return je.className.split(" ").indexOf("".concat(se,"-overflowed-submenu"))<0}):[]},Re.getOverflowedSubMenuItem=function(se,pe,je){var Ie=Re.props,lt=Ie.overflowedIndicator,st=Ie.level,Ae=Ie.mode,qe=Ie.prefixCls,pt=Ie.theme;if(st!==1||Ae!=="horizontal")return null;var mt=Re.props.children[0],Lt=mt.props,mn=Lt.children,hn=Lt.title,en=Lt.style,Dt=Object(fe.a)(Lt,["children","title","style"]),xn=Object(J.a)({},en),He="".concat(se,"-overflowed-indicator"),ht="".concat(se,"-overflowed-indicator");pe.length===0&&je!==!0?xn=Object(J.a)(Object(J.a)({},xn),{},{display:"none"}):je&&(xn=Object(J.a)(Object(J.a)({},xn),{},{visibility:"hidden",position:"absolute"}),He="".concat(He,"-placeholder"),ht="".concat(ht,"-placeholder"));var St=pt?"".concat(qe,"-").concat(pt):"",Xt={};return Te.forEach(function(an){Dt[an]!==void 0&&(Xt[an]=Dt[an])}),U.createElement(Rt,Object.assign({title:lt,className:"".concat(qe,"-overflowed-submenu"),popupClassName:St},Xt,{key:He,eventKey:ht,disabled:!1,style:xn}),pe)},Re.setChildrenWidthAndResize=function(){if(Re.props.mode!=="horizontal")return;var se=le.findDOMNode(Object(H.a)(Re));if(!se)return;var pe=se.children;if(!pe||pe.length===0)return;var je=se.children[pe.length-1];Ee(je,"display","inline-block");var Ie=Re.getMenuItemNodes(),lt=Ie.filter(function(st){return st.className.split(" ").indexOf(Ct)>=0});lt.forEach(function(st){Ee(st,"display","inline-block")}),Re.menuItemSizes=Ie.map(function(st){return ye(st,!0)}),lt.forEach(function(st){Ee(st,"display","none")}),Re.overflowedIndicatorWidth=ye(se.children[se.children.length-1],!0),Re.originalTotalWidth=Re.menuItemSizes.reduce(function(st,Ae){return st+Ae},0),Re.handleResize(),Ee(je,"display","none")},Re.handleResize=function(){if(Re.props.mode!=="horizontal")return;var se=le.findDOMNode(Object(H.a)(Re));if(!se)return;var pe=ye(se);Re.overflowedItems=[];var je=0,Ie;Re.originalTotalWidth>pe+xt&&(Ie=-1,Re.menuItemSizes.forEach(function(lt){je+=lt,je+Re.overflowedIndicatorWidth<=pe&&(Ie+=1)})),Re.setState({lastVisibleIndex:Ie})},Re}return Object(R.a)(Ue,[{key:"componentDidMount",value:function(){var se=this;if(this.setChildrenWidthAndResize(),this.props.level===1&&this.props.mode==="horizontal"){var pe=le.findDOMNode(this);if(!pe)return;this.resizeObserver=new Me.default(function(je){je.forEach(function(){var Ie=se.cancelFrameId;cancelAnimationFrame(Ie),se.cancelFrameId=requestAnimationFrame(se.setChildrenWidthAndResize)})}),[].slice.call(pe.children).concat(pe).forEach(function(je){se.resizeObserver.observe(je)}),typeof MutationObserver!="undefined"&&(this.mutationObserver=new MutationObserver(function(){se.resizeObserver.disconnect(),[].slice.call(pe.children).concat(pe).forEach(function(je){se.resizeObserver.observe(je)}),se.setChildrenWidthAndResize()}),this.mutationObserver.observe(pe,{attributes:!1,childList:!0,subTree:!1}))}}},{key:"componentWillUnmount",value:function(){this.resizeObserver&&this.resizeObserver.disconnect(),this.mutationObserver&&this.mutationObserver.disconnect(),cancelAnimationFrame(this.cancelFrameId)}},{key:"renderChildren",value:function(se){var pe=this,je=this.state.lastVisibleIndex;return(se||[]).reduce(function(Ie,lt,st){var Ae=lt;if(pe.props.mode==="horizontal"){var qe=pe.getOverflowedSubMenuItem(lt.props.eventKey,[]);je!==void 0&&pe.props.className.indexOf("".concat(pe.props.prefixCls,"-root"))!==-1&&(st>je&&(Ae=U.cloneElement(lt,{style:{display:"none"},eventKey:"".concat(lt.props.eventKey,"-hidden"),className:"".concat(Ct)})),st===je+1&&(pe.overflowedItems=se.slice(je+1).map(function(mt){return U.cloneElement(mt,{key:mt.props.eventKey,mode:"vertical-left"})}),qe=pe.getOverflowedSubMenuItem(lt.props.eventKey,pe.overflowedItems)));var pt=[].concat(Object(_e.a)(Ie),[qe,Ae]);return st===se.length-1&&pt.push(pe.getOverflowedSubMenuItem(lt.props.eventKey,[],!0)),pt}return[].concat(Object(_e.a)(Ie),[Ae])},[])}},{key:"render",value:function(){var se=this.props,pe=se.visible,je=se.prefixCls,Ie=se.overflowedIndicator,lt=se.mode,st=se.level,Ae=se.tag,qe=se.children,pt=se.theme,mt=Object(fe.a)(se,["visible","prefixCls","overflowedIndicator","mode","level","tag","children","theme"]),Lt=Ae;return U.createElement(Lt,Object.assign({},mt),this.renderChildren(qe))}}]),Ue}(U.Component);yt.defaultProps={tag:"div",className:""};var wt=yt;function Et(it){return it.length?it.every(function(Be){return!!Be.props.disabled}):!0}function Se(it,Be,Ue){var Re=it.getState();it.setState({activeKey:Object(J.a)(Object(J.a)({},Re.activeKey),{},Object(f.a)({},Be,Ue))})}function xe(it){return it.eventKey||"0-menu-"}function Ke(it,Be){var Ue=Be,Re=it.children,se=it.eventKey;if(Ue){var pe;if(ae(Re,function(je,Ie){je&&je.props&&!je.props.disabled&&Ue===$(je,se,Ie)&&(pe=!0)}),pe)return Ue}return Ue=null,it.defaultActiveFirst&&ae(Re,function(je,Ie){!Ue&&je&&!je.props.disabled&&(Ue=$(je,se,Ie))}),Ue}function Ve(it){if(it){var Be=this.instanceArray.indexOf(it);Be!==-1?this.instanceArray[Be]=it:this.instanceArray.push(it)}}var De=function(it){Object(N.a)(Ue,it);var Be=Object(x.a)(Ue);function Ue(Re){var se;return Object(K.a)(this,Ue),se=Be.call(this,Re),se.onKeyDown=function(pe,je){var Ie=pe.keyCode,lt;if(se.getFlatInstanceArray().forEach(function(Ae){Ae&&Ae.props.active&&Ae.onKeyDown&&(lt=Ae.onKeyDown(pe))}),lt)return 1;var st=null;return(Ie===S.a.UP||Ie===S.a.DOWN)&&(st=se.step(Ie===S.a.UP?-1:1)),st?(pe.preventDefault(),Se(se.props.store,xe(se.props),st.props.eventKey),typeof je=="function"&&je(st),1):void 0},se.onItemHover=function(pe){var je=pe.key,Ie=pe.hover;Se(se.props.store,xe(se.props),Ie?je:null)},se.onDeselect=function(pe){se.props.onDeselect(pe)},se.onSelect=function(pe){se.props.onSelect(pe)},se.onClick=function(pe){se.props.onClick(pe)},se.onOpenChange=function(pe){se.props.onOpenChange(pe)},se.onDestroy=function(pe){se.props.onDestroy(pe)},se.getFlatInstanceArray=function(){return se.instanceArray},se.step=function(pe){var je=se.getFlatInstanceArray(),Ie=se.props.store.getState().activeKey[xe(se.props)],lt=je.length;if(!lt)return null;pe<0&&(je=je.concat().reverse());var st=-1;if(je.every(function(mt,Lt){return mt&&mt.props.eventKey===Ie?(st=Lt,!1):!0}),!se.props.defaultActiveFirst&&st!==-1&&Et(je.slice(st,lt-1)))return;var Ae=(st+1)%lt,qe=Ae;do{var pt=je[qe];if(!pt||pt.props.disabled)qe=(qe+1)%lt;else return pt}while(qe!==Ae);return null},se.renderCommonMenuItem=function(pe,je,Ie){var lt=se.props.store.getState(),st=Object(H.a)(se),Ae=st.props,qe=$(pe,Ae.eventKey,je),pt=pe.props;if(!pt||typeof pe.type=="string")return pe;var mt=qe===lt.activeKey,Lt=Object(J.a)(Object(J.a)({mode:pt.mode||Ae.mode,level:Ae.level,inlineIndent:Ae.inlineIndent,renderMenuItem:se.renderMenuItem,rootPrefixCls:Ae.prefixCls,index:je,parentMenu:Ae.parentMenu,manualRef:pt.disabled?void 0:Object(P.a)(pe.ref,Ve.bind(Object(H.a)(se))),eventKey:qe,active:!pt.disabled&&mt,multiple:Ae.multiple,onClick:function(hn){(pt.onClick||W)(hn),se.onClick(hn)},onItemHover:se.onItemHover,motion:Ae.motion,subMenuOpenDelay:Ae.subMenuOpenDelay,subMenuCloseDelay:Ae.subMenuCloseDelay,forceSubMenuRender:Ae.forceSubMenuRender,onOpenChange:se.onOpenChange,onDeselect:se.onDeselect,onSelect:se.onSelect,builtinPlacements:Ae.builtinPlacements,itemIcon:pt.itemIcon||se.props.itemIcon,expandIcon:pt.expandIcon||se.props.expandIcon},Ie),{},{direction:Ae.direction});return(Ae.mode==="inline"||Oe())&&(Lt.triggerSubMenuAction="click"),U.cloneElement(pe,Lt)},se.renderMenuItem=function(pe,je,Ie){if(!pe)return null;var lt=se.props.store.getState(),st={openKeys:lt.openKeys,selectedKeys:lt.selectedKeys,triggerSubMenuAction:se.props.triggerSubMenuAction,subMenuKey:Ie};return se.renderCommonMenuItem(pe,je,st)},Re.store.setState({activeKey:Object(J.a)(Object(J.a)({},Re.store.getState().activeKey),{},Object(f.a)({},Re.eventKey,Ke(Re,Re.activeKey)))}),se.instanceArray=[],se}return Object(R.a)(Ue,[{key:"componentDidMount",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"shouldComponentUpdate",value:function(se){return this.props.visible||se.visible||this.props.className!==se.className||!p()(this.props.style,se.style)}},{key:"componentDidUpdate",value:function(se){var pe=this.props,je="activeKey"in pe?pe.activeKey:pe.store.getState().activeKey[xe(pe)],Ie=Ke(pe,je);if(Ie!==je)Se(pe.store,xe(pe),Ie);else if("activeKey"in se){var lt=Ke(se,se.activeKey);Ie!==lt&&Se(pe.store,xe(pe),Ie)}}},{key:"render",value:function(){var se=this,pe=Object(L.a)({},this.props);this.instanceArray=[];var je=i()(pe.prefixCls,pe.className,"".concat(pe.prefixCls,"-").concat(pe.mode)),Ie={className:je,role:pe.role||"menu"};pe.id&&(Ie.id=pe.id),pe.focusable&&(Ie.tabIndex=0,Ie.onKeyDown=this.onKeyDown);var lt=pe.prefixCls,st=pe.eventKey,Ae=pe.visible,qe=pe.level,pt=pe.mode,mt=pe.overflowedIndicator,Lt=pe.theme;return Te.forEach(function(mn){return delete pe[mn]}),delete pe.onClick,U.createElement(wt,Object.assign({},pe,{prefixCls:lt,mode:pt,tag:"ul",level:qe,theme:Lt,visible:Ae,overflowedIndicator:mt},Ie),U.Children.map(pe.children,function(mn,hn){return se.renderMenuItem(mn,hn,st||"0-menu-")}))}}]),Ue}(U.Component);De.defaultProps={prefixCls:"rc-menu",className:"",mode:"vertical",level:1,inlineIndent:24,visible:!0,focusable:!0,style:{},manualRef:W};var We=Object(I.b)()(De),ge=We,de=j("Kwbf");function ce(it,Be,Ue){var Re=it.prefixCls,se=it.motion,pe=it.defaultMotions,je=pe===void 0?{}:pe,Ie=it.openAnimation,lt=it.openTransitionName,st=Be.switchingModeFromInline;if(se)return se;if(Object(a.a)(Ie)==="object"&&Ie)Object(de.a)(!1,"Object type of `openAnimation` is removed. Please use `motion` instead.");else if(typeof Ie=="string")return{motionName:"".concat(Re,"-open-").concat(Ie)};if(lt)return{motionName:lt};var Ae=je[Ue];return Ae||(st?null:je.other)}var ne=function(it){Object(N.a)(Ue,it);var Be=Object(x.a)(Ue);function Ue(Re){var se;Object(K.a)(this,Ue),se=Be.call(this,Re),se.inlineOpenKeys=[],se.onSelect=function(Ie){var lt=Object(H.a)(se),st=lt.props;if(st.selectable){var Ae=se.store.getState(),qe=Ae.selectedKeys,pt=Ie.key;st.multiple?qe=qe.concat([pt]):qe=[pt],"selectedKeys"in st||se.store.setState({selectedKeys:qe}),st.onSelect(Object(J.a)(Object(J.a)({},Ie),{},{selectedKeys:qe}))}},se.onClick=function(Ie){var lt=se.getRealMenuMode(),st=Object(H.a)(se),Ae=st.store,qe=st.props.onOpenChange;lt!=="inline"&&!("openKeys"in se.props)&&(Ae.setState({openKeys:[]}),qe([])),se.props.onClick(Ie)},se.onKeyDown=function(Ie,lt){se.innerMenu.getWrappedInstance().onKeyDown(Ie,lt)},se.onOpenChange=function(Ie){var lt=Object(H.a)(se),st=lt.props,Ae=se.store.getState().openKeys.concat(),qe=!1,pt=function(Lt){var mn=!1;if(Lt.open)mn=Ae.indexOf(Lt.key)===-1,mn&&Ae.push(Lt.key);else{var hn=Ae.indexOf(Lt.key);mn=hn!==-1,mn&&Ae.splice(hn,1)}qe=qe||mn};Array.isArray(Ie)?Ie.forEach(pt):pt(Ie),qe&&("openKeys"in se.props||se.store.setState({openKeys:Ae}),st.onOpenChange(Ae))},se.onDeselect=function(Ie){var lt=Object(H.a)(se),st=lt.props;if(st.selectable){var Ae=se.store.getState().selectedKeys.concat(),qe=Ie.key,pt=Ae.indexOf(qe);pt!==-1&&Ae.splice(pt,1),"selectedKeys"in st||se.store.setState({selectedKeys:Ae}),st.onDeselect(Object(J.a)(Object(J.a)({},Ie),{},{selectedKeys:Ae}))}},se.onMouseEnter=function(Ie){se.restoreModeVerticalFromInline();var lt=se.props.onMouseEnter;lt&<(Ie)},se.onTransitionEnd=function(Ie){var lt=Ie.propertyName==="width"&&Ie.target===Ie.currentTarget,st=Ie.target.className,Ae=Object.prototype.toString.call(st)==="[object SVGAnimatedString]"?st.animVal:st,qe=Ie.propertyName==="font-size"&&Ae.indexOf("anticon")>=0;(lt||qe)&&se.restoreModeVerticalFromInline()},se.setInnerMenu=function(Ie){se.innerMenu=Ie},se.isRootMenu=!0;var pe=Re.defaultSelectedKeys,je=Re.defaultOpenKeys;return"selectedKeys"in Re&&(pe=Re.selectedKeys||[]),"openKeys"in Re&&(je=Re.openKeys||[]),se.store=Object(I.c)({selectedKeys:pe,openKeys:je,activeKey:{"0-menu-":Ke(Re,Re.activeKey)}}),se.state={switchingModeFromInline:!1},se}return Object(R.a)(Ue,[{key:"componentDidMount",value:function(){this.updateMiniStore(),this.updateMenuDisplay()}},{key:"componentDidUpdate",value:function(se){this.updateOpentKeysWhenSwitchMode(se),this.updateMiniStore();var pe=this.props,je=pe.siderCollapsed,Ie=pe.inlineCollapsed,lt=pe.onOpenChange;(!se.inlineCollapsed&&Ie||!se.siderCollapsed&&je)&<([]),this.updateMenuDisplay()}},{key:"updateOpentKeysWhenSwitchMode",value:function(se){var pe=this.props,je=this.store,Ie=this.inlineOpenKeys,lt=je.getState(),st={};se.mode==="inline"&&pe.mode!=="inline"&&this.setState({switchingModeFromInline:!0}),"openKeys"in pe||((pe.inlineCollapsed&&!se.inlineCollapsed||pe.siderCollapsed&&!se.siderCollapsed)&&(this.setState({switchingModeFromInline:!0}),this.inlineOpenKeys=lt.openKeys.concat(),st.openKeys=[]),(!pe.inlineCollapsed&&se.inlineCollapsed||!pe.siderCollapsed&&se.siderCollapsed)&&(st.openKeys=Ie,this.inlineOpenKeys=[])),Object.keys(st).length&&je.setState(st)}},{key:"updateMenuDisplay",value:function(){var se=this.props.collapsedWidth,pe=this.store,je=this.prevOpenKeys,Ie=this.getInlineCollapsed()&&(se===0||se==="0"||se==="0px");Ie?(this.prevOpenKeys=pe.getState().openKeys.concat(),this.store.setState({openKeys:[]})):je&&(this.store.setState({openKeys:je}),this.prevOpenKeys=null)}},{key:"getRealMenuMode",value:function(){var se=this.props.mode,pe=this.state.switchingModeFromInline,je=this.getInlineCollapsed();return pe&&je?"inline":je?"vertical":se}},{key:"getInlineCollapsed",value:function(){var se=this.props,pe=se.inlineCollapsed,je=se.siderCollapsed;return je!==void 0?je:pe}},{key:"restoreModeVerticalFromInline",value:function(){var se=this.state.switchingModeFromInline;se&&this.setState({switchingModeFromInline:!1})}},{key:"updateMiniStore",value:function(){"selectedKeys"in this.props&&this.store.setState({selectedKeys:this.props.selectedKeys||[]}),"openKeys"in this.props&&this.store.setState({openKeys:this.props.openKeys||[]})}},{key:"render",value:function(){var se=Object(J.a)({},Object(E.default)(this.props,["collapsedWidth","siderCollapsed","defaultMotions"])),pe=this.getRealMenuMode();return se.className+=" ".concat(se.prefixCls,"-root"),se.direction==="rtl"&&(se.className+=" ".concat(se.prefixCls,"-rtl")),se=Object(J.a)(Object(J.a)({},se),{},{mode:pe,onClick:this.onClick,onOpenChange:this.onOpenChange,onDeselect:this.onDeselect,onSelect:this.onSelect,onMouseEnter:this.onMouseEnter,onTransitionEnd:this.onTransitionEnd,parentMenu:this,motion:ce(this.props,this.state,pe)}),delete se.openAnimation,delete se.openTransitionName,U.createElement(I.a,{store:this.store},U.createElement(ge,Object.assign({},se,{ref:this.setInnerMenu}),this.props.children))}}]),Ue}(U.Component);ne.defaultProps={selectable:!0,onClick:W,onSelect:W,onOpenChange:W,onDeselect:W,defaultSelectedKeys:[],defaultOpenKeys:[],subMenuOpenDelay:.1,subMenuCloseDelay:.1,triggerSubMenuAction:"hover",prefixCls:"rc-menu",className:"",mode:"vertical",style:{},builtinPlacements:{},overflowedIndicator:U.createElement("span",null,"\xB7\xB7\xB7")};var ie=ne,oe=function(it){Object(N.a)(Ue,it);var Be=Object(x.a)(Ue);function Ue(){var Re;return Object(K.a)(this,Ue),Re=Be.apply(this,arguments),Re.onKeyDown=function(se){var pe=se.keyCode;return pe===S.a.ENTER?(Re.onClick(se),!0):void 0},Re.onMouseLeave=function(se){var pe=Re.props,je=pe.eventKey,Ie=pe.onItemHover,lt=pe.onMouseLeave;Ie({key:je,hover:!1}),lt({key:je,domEvent:se})},Re.onMouseEnter=function(se){var pe=Re.props,je=pe.eventKey,Ie=pe.onItemHover,lt=pe.onMouseEnter;Ie({key:je,hover:!0}),lt({key:je,domEvent:se})},Re.onClick=function(se){var pe=Re.props,je=pe.eventKey,Ie=pe.multiple,lt=pe.onClick,st=pe.onSelect,Ae=pe.onDeselect,qe=pe.isSelected,pt={key:je,keyPath:[je],item:Object(H.a)(Re),domEvent:se};lt(pt),Ie?qe?Ae(pt):st(pt):qe||st(pt)},Re.saveNode=function(se){Re.node=se},Re}return Object(R.a)(Ue,[{key:"componentDidMount",value:function(){this.callRef()}},{key:"componentDidUpdate",value:function(){this.callRef()}},{key:"componentWillUnmount",value:function(){var se=this.props;se.onDestroy&&se.onDestroy(se.eventKey)}},{key:"getPrefixCls",value:function(){return"".concat(this.props.rootPrefixCls,"-item")}},{key:"getActiveClassName",value:function(){return"".concat(this.getPrefixCls(),"-active")}},{key:"getSelectedClassName",value:function(){return"".concat(this.getPrefixCls(),"-selected")}},{key:"getDisabledClassName",value:function(){return"".concat(this.getPrefixCls(),"-disabled")}},{key:"callRef",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"render",value:function(){var se,pe=Object(J.a)({},this.props),je=i()(this.getPrefixCls(),pe.className,(se={},Object(f.a)(se,this.getActiveClassName(),!pe.disabled&&pe.active),Object(f.a)(se,this.getSelectedClassName(),pe.isSelected),Object(f.a)(se,this.getDisabledClassName(),pe.disabled),se)),Ie=Object(J.a)(Object(J.a)({},pe.attribute),{},{title:typeof pe.title=="string"?pe.title:void 0,className:je,role:pe.role||"menuitem","aria-disabled":pe.disabled});pe.role==="option"?Ie=Object(J.a)(Object(J.a)({},Ie),{},{role:"option","aria-selected":pe.isSelected}):(pe.role===null||pe.role==="none")&&(Ie.role="none");var lt={onClick:pe.disabled?null:this.onClick,onMouseLeave:pe.disabled?null:this.onMouseLeave,onMouseEnter:pe.disabled?null:this.onMouseEnter},st=Object(J.a)({},pe.style);pe.mode==="inline"&&(pe.direction==="rtl"?st.paddingRight=pe.inlineIndent*pe.level:st.paddingLeft=pe.inlineIndent*pe.level),Te.forEach(function(qe){return delete pe[qe]}),delete pe.direction;var Ae=this.props.itemIcon;return typeof this.props.itemIcon=="function"&&(Ae=U.createElement(this.props.itemIcon,this.props)),U.createElement("li",Object.assign({},Object(E.default)(pe,["onClick","onMouseEnter","onMouseLeave","onSelect"]),Ie,lt,{style:st,ref:this.saveNode}),pe.children,Ae)}}]),Ue}(U.Component);oe.isMenuItem=!0,oe.defaultProps={onSelect:W,onMouseEnter:W,onMouseLeave:W,manualRef:W};var ue=Object(I.b)(function(it,Be){var Ue=it.activeKey,Re=it.selectedKeys,se=Be.eventKey,pe=Be.subMenuKey;return{active:Ue[pe]===se,isSelected:Re.indexOf(se)!==-1}})(oe),we=ue,ke=function(it){Object(N.a)(Ue,it);var Be=Object(x.a)(Ue);function Ue(){var Re;return Object(K.a)(this,Ue),Re=Be.apply(this,arguments),Re.renderInnerMenuItem=function(se){var pe=Re.props,je=pe.renderMenuItem,Ie=pe.index;return je(se,Ie,Re.props.subMenuKey)},Re}return Object(R.a)(Ue,[{key:"render",value:function(){var se=Object(L.a)({},this.props),pe=se.className,je=pe===void 0?"":pe,Ie=se.rootPrefixCls,lt="".concat(Ie,"-item-group-title"),st="".concat(Ie,"-item-group-list"),Ae=se.title,qe=se.children;return Te.forEach(function(pt){return delete se[pt]}),delete se.onClick,delete se.direction,U.createElement("li",Object.assign({},se,{className:"".concat(je," ").concat(Ie,"-item-group")}),U.createElement("div",{className:lt,title:typeof Ae=="string"?Ae:void 0},Ae),U.createElement("ul",{className:st},U.Children.map(qe,this.renderInnerMenuItem)))}}]),Ue}(U.Component);ke.isMenuItemGroup=!0,ke.defaultProps={disabled:!0};var Je=ke,bt=function(Be){var Ue=Be.className,Re=Be.rootPrefixCls,se=Be.style;return U.createElement("li",{className:"".concat(Ue," ").concat(Re,"-item-divider"),style:se})};bt.defaultProps={disabled:!0,className:"",style:{}};var It=bt,Ge=Ce.e=ie},"55Ip":function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return u}),j.d(Ce,"b",function(){return _});var J=j("Ty5D"),K=j("dI71"),R=j("q1tI"),H=j.n(R),N=j("YS25"),x=j("17x9"),U=j.n(x),I=j("wx14"),E=j("zLVn"),L=j("9R94"),f=function(d){Object(K.a)(o,d);function o(){for(var w,C=arguments.length,v=new Array(C),M=0;M<C;M++)v[M]=arguments[M];return w=d.call.apply(d,[this].concat(v))||this,w.history=Object(N.a)(w.props),w}var s=o.prototype;return s.render=function(){return H.a.createElement(J.c,{history:this.history,children:this.props.children})},o}(H.a.Component),S=function(d){Object(K.a)(o,d);function o(){for(var w,C=arguments.length,v=new Array(C),M=0;M<C;M++)v[M]=arguments[M];return w=d.call.apply(d,[this].concat(v))||this,w.history=Object(N.b)(w.props),w}var s=o.prototype;return s.render=function(){return H.a.createElement(J.c,{history:this.history,children:this.props.children})},o}(H.a.Component),P=function(o,s){return typeof o=="function"?o(s):o},T=function(o,s){return typeof o=="string"?Object(N.c)(o,null,null,s):o},p=function(o){return o},m=H.a.forwardRef;typeof m=="undefined"&&(m=p);function i(d){return!!(d.metaKey||d.altKey||d.ctrlKey||d.shiftKey)}var a=m(function(d,o){var s=d.innerRef,w=d.navigate,C=d.onClick,v=Object(E.a)(d,["innerRef","navigate","onClick"]),M=v.target,B=Object(I.a)({},v,{onClick:function(Q){try{C&&C(Q)}catch(G){throw Q.preventDefault(),G}!Q.defaultPrevented&&Q.button===0&&(!M||M==="_self")&&!i(Q)&&(Q.preventDefault(),w())}});return p!==m?B.ref=o||s:B.ref=s,H.a.createElement("a",B)}),u=m(function(d,o){var s=d.component,w=s===void 0?a:s,C=d.replace,v=d.to,M=d.innerRef,B=Object(E.a)(d,["component","replace","to","innerRef"]);return H.a.createElement(J.e.Consumer,null,function(F){F||Object(L.a)(!1);var Q=F.history,G=T(P(v,F.location),F.location),W=G?Q.createHref(G):"",$=Object(I.a)({},B,{href:W,navigate:function(){var ae=P(v,F.location),he=C?Q.replace:Q.push;he(ae)}});return p!==m?$.ref=o||M:$.innerRef=M,H.a.createElement(w,$)})});if(!1)var c,O;var b=function(o){return o},y=H.a.forwardRef;typeof y=="undefined"&&(y=b);function D(){for(var d=arguments.length,o=new Array(d),s=0;s<d;s++)o[s]=arguments[s];return o.filter(function(w){return w}).join(" ")}var _=y(function(d,o){var s=d["aria-current"],w=s===void 0?"page":s,C=d.activeClassName,v=C===void 0?"active":C,M=d.activeStyle,B=d.className,F=d.exact,Q=d.isActive,G=d.location,W=d.sensitive,$=d.strict,re=d.style,ae=d.to,he=d.innerRef,Te=Object(E.a)(d,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return H.a.createElement(J.e.Consumer,null,function(ye){ye||Object(L.a)(!1);var Ee=G||ye.location,Oe=T(P(ae,Ee),Ee),_e=Oe.pathname,fe=_e&&_e.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),le=fe?Object(J.f)(Ee.pathname,{path:fe,exact:F,sensitive:W,strict:$}):null,Me=!!(Q?Q(le,Ee):le),ot=Me?D(B,v):B,ut=Me?Object(I.a)({},re,{},M):re,rt=Object(I.a)({"aria-current":Me&&w||null,className:ot,style:ut,to:Oe},Te);return b!==y?rt.ref=o||he:rt.innerRef=he,H.a.createElement(u,rt)})});if(!1)var h},"5nXd":function(Fe,Ce,j){var J=j("MFOe"),K=J.slice,R=J.pluck,H=J.each,N=J.bind,x=J.create,U=J.isList,I=J.isFunction,E=J.isObject;Fe.exports={createStore:S};var L={version:"2.0.12",enabled:!1,get:function(P,T){var p=this.storage.read(this._namespacePrefix+P);return this._deserialize(p,T)},set:function(P,T){return T===void 0?this.remove(P):(this.storage.write(this._namespacePrefix+P,this._serialize(T)),T)},remove:function(P){this.storage.remove(this._namespacePrefix+P)},each:function(P){var T=this;this.storage.each(function(p,m){P.call(T,T._deserialize(p),(m||"").replace(T._namespaceRegexp,""))})},clearAll:function(){this.storage.clearAll()},hasNamespace:function(P){return this._namespacePrefix=="__storejs_"+P+"_"},createStore:function(){return S.apply(this,arguments)},addPlugin:function(P){this._addPlugin(P)},namespace:function(P){return S(this.storage,this.plugins,P)}};function f(){var P=typeof console=="undefined"?null:console;if(!P)return;var T=P.warn?P.warn:P.log;T.apply(P,arguments)}function S(P,T,p){p||(p=""),P&&!U(P)&&(P=[P]),T&&!U(T)&&(T=[T]);var m=p?"__storejs_"+p+"_":"",i=p?new RegExp("^"+m):null,a=/^[a-zA-Z0-9_\-]*$/;if(!a.test(p))throw new Error("store.js namespaces can only have alphanumerics + underscores and dashes");var u={_namespacePrefix:m,_namespaceRegexp:i,_testStorage:function(O){try{var b="__storejs__test__";O.write(b,b);var y=O.read(b)===b;return O.remove(b),y}catch(D){return!1}},_assignPluginFnProp:function(O,b){var y=this[b];this[b]=function(){var _=K(arguments,0),h=this;function d(){return y?(H(arguments,function(s,w){_[w]=s}),y.apply(h,_)):void 0}var o=[d].concat(_);return O.apply(h,o)}},_serialize:function(O){return JSON.stringify(O)},_deserialize:function(O,b){if(!O)return b;var y="";try{y=JSON.parse(O)}catch(D){y=O}return y!==void 0?y:b},_addStorage:function(O){if(this.enabled)return;this._testStorage(O)&&(this.storage=O,this.enabled=!0)},_addPlugin:function(O){var b=this;if(U(O)){H(O,function(_){b._addPlugin(_)});return}var y=R(this.plugins,function(_){return O===_});if(y)return;if(this.plugins.push(O),!I(O))throw new Error("Plugins must be function values that return objects");var D=O.call(this);if(!E(D))throw new Error("Plugins must return an object of function properties");H(D,function(_,h){if(!I(_))throw new Error("Bad plugin property: "+h+" from plugin "+O.name+". Plugins should only return functions.");b._assignPluginFnProp(_,h)})},addStorage:function(O){f("store.addStorage(storage) is deprecated. Use createStore([storages])"),this._addStorage(O)}},c=x(u,L,{plugins:[]});return c.raw={},H(c,function(O,b){I(O)&&(c.raw[b]=N(c,O))}),H(P,function(O){c._addStorage(O)}),H(T,function(O){c._addPlugin(O)}),c}},"6+eU":function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return y});var J=j("wx14"),K=j("rePB"),R=j("VTBJ"),H=j("1OyB"),N=j("vuIU"),x=j("Ji7U"),U=j("LK+K"),I=j("q1tI"),E=j.n(I),L=j("TSYQ"),f=j.n(L),S=function(_){var h,d="".concat(_.rootPrefixCls,"-item"),o=f()(d,"".concat(d,"-").concat(_.page),(h={},Object(K.a)(h,"".concat(d,"-active"),_.active),Object(K.a)(h,_.className,!!_.className),Object(K.a)(h,"".concat(d,"-disabled"),!_.page),h)),s=function(){_.onClick(_.page)},w=function(v){_.onKeyPress(v,_.onClick,_.page)};return E.a.createElement("li",{title:_.showTitle?_.page:null,className:o,onClick:s,onKeyPress:w,tabIndex:"0"},_.itemRender(_.page,"page",E.a.createElement("a",{rel:"nofollow"},_.page)))},P=S,T={ZERO:48,NINE:57,NUMPAD_ZERO:96,NUMPAD_NINE:105,BACKSPACE:8,DELETE:46,ENTER:13,ARROW_UP:38,ARROW_DOWN:40},p=function(D){Object(x.a)(h,D);var _=Object(U.a)(h);function h(){var d;Object(H.a)(this,h);for(var o=arguments.length,s=new Array(o),w=0;w<o;w++)s[w]=arguments[w];return d=_.call.apply(_,[this].concat(s)),d.state={goInputText:""},d.buildOptionText=function(C){return"".concat(C," ").concat(d.props.locale.items_per_page)},d.changeSize=function(C){d.props.changeSize(Number(C))},d.handleChange=function(C){d.setState({goInputText:C.target.value})},d.handleBlur=function(C){var v=d.props,M=v.goButton,B=v.quickGo,F=v.rootPrefixCls,Q=d.state.goInputText;if(M||Q==="")return;if(C.relatedTarget&&(C.relatedTarget.className.indexOf("".concat(F,"-prev"))>=0||C.relatedTarget.className.indexOf("".concat(F,"-next"))>=0))return;d.setState({goInputText:""}),B(d.getValidValue())},d.go=function(C){var v=d.state.goInputText;if(v==="")return;(C.keyCode===T.ENTER||C.type==="click")&&(d.setState({goInputText:""}),d.props.quickGo(d.getValidValue()))},d}return Object(N.a)(h,[{key:"getValidValue",value:function(){var o=this.state,s=o.goInputText,w=o.current;return!s||isNaN(s)?w:Number(s)}},{key:"getPageSizeOptions",value:function(){var o=this.props,s=o.pageSize,w=o.pageSizeOptions;return w.some(function(C){return C.toString()===s.toString()})?w:w.concat([s.toString()]).sort(function(C,v){var M=isNaN(Number(C))?0:Number(C),B=isNaN(Number(v))?0:Number(v);return M-B})}},{key:"render",value:function(){var o=this,s=this.props,w=s.pageSize,C=s.locale,v=s.rootPrefixCls,M=s.changeSize,B=s.quickGo,F=s.goButton,Q=s.selectComponentClass,G=s.buildOptionText,W=s.selectPrefixCls,$=s.disabled,re=this.state.goInputText,ae="".concat(v,"-options"),he=Q,Te=null,ye=null,Ee=null;if(!M&&!B)return null;var Oe=this.getPageSizeOptions();if(M&&he){var _e=Oe.map(function(fe,le){return E.a.createElement(he.Option,{key:le,value:fe.toString()},(G||o.buildOptionText)(fe))});Te=E.a.createElement(he,{disabled:$,prefixCls:W,showSearch:!1,className:"".concat(ae,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(w||Oe[0]).toString(),onChange:this.changeSize,getPopupContainer:function(le){return le.parentNode}},_e)}return B&&(F&&(Ee=typeof F=="boolean"?E.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:$,className:"".concat(ae,"-quick-jumper-button")},C.jump_to_confirm):E.a.createElement("span",{onClick:this.go,onKeyUp:this.go},F)),ye=E.a.createElement("div",{className:"".concat(ae,"-quick-jumper")},C.jump_to,E.a.createElement("input",{disabled:$,type:"text",value:re,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),C.page,Ee)),E.a.createElement("li",{className:"".concat(ae)},Te,ye)}}]),h}(E.a.Component);p.defaultProps={pageSizeOptions:["10","20","50","100"]};var m=p,i=j("N2Kk");function a(){}function u(D){return typeof D=="number"&&isFinite(D)&&Math.floor(D)===D}function c(D,_,h){return h}function O(D,_,h){var d=typeof D=="undefined"?_.pageSize:D;return Math.floor((h.total-1)/d)+1}var b=function(D){Object(x.a)(h,D);var _=Object(U.a)(h);function h(d){var o;Object(H.a)(this,h),o=_.call(this,d),o.getJumpPrevPage=function(){return Math.max(1,o.state.current-(o.props.showLessItems?3:5))},o.getJumpNextPage=function(){return Math.min(O(void 0,o.state,o.props),o.state.current+(o.props.showLessItems?3:5))},o.getItemIcon=function(M,B){var F=o.props.prefixCls,Q=M||E.a.createElement("button",{type:"button","aria-label":B,className:"".concat(F,"-item-link")});return typeof M=="function"&&(Q=E.a.createElement(M,Object(R.a)({},o.props))),Q},o.savePaginationNode=function(M){o.paginationNode=M},o.isValid=function(M){return u(M)&&M!==o.state.current},o.shouldDisplayQuickJumper=function(){var M=o.props,B=M.showQuickJumper,F=M.pageSize,Q=M.total;return Q<=F?!1:B},o.handleKeyDown=function(M){(M.keyCode===T.ARROW_UP||M.keyCode===T.ARROW_DOWN)&&M.preventDefault()},o.handleKeyUp=function(M){var B=o.getValidValue(M),F=o.state.currentInputValue;B!==F&&o.setState({currentInputValue:B}),M.keyCode===T.ENTER?o.handleChange(B):M.keyCode===T.ARROW_UP?o.handleChange(B-1):M.keyCode===T.ARROW_DOWN&&o.handleChange(B+1)},o.changePageSize=function(M){var B=o.state.current,F=O(M,o.state,o.props);B=B>F?F:B,F===0&&(B=o.state.current),typeof M=="number"&&("pageSize"in o.props||o.setState({pageSize:M}),"current"in o.props||o.setState({current:B,currentInputValue:B})),o.props.onShowSizeChange(B,M),"onChange"in o.props&&o.props.onChange&&o.props.onChange(B,M)},o.handleChange=function(M){var B=o.props.disabled,F=M;if(o.isValid(F)&&!B){var Q=O(void 0,o.state,o.props);F>Q?F=Q:F<1&&(F=1),"current"in o.props||o.setState({current:F,currentInputValue:F});var G=o.state.pageSize;return o.props.onChange(F,G),F}return o.state.current},o.prev=function(){o.hasPrev()&&o.handleChange(o.state.current-1)},o.next=function(){o.hasNext()&&o.handleChange(o.state.current+1)},o.jumpPrev=function(){o.handleChange(o.getJumpPrevPage())},o.jumpNext=function(){o.handleChange(o.getJumpNextPage())},o.hasPrev=function(){return o.state.current>1},o.hasNext=function(){return o.state.current<O(void 0,o.state,o.props)},o.runIfEnter=function(M,B){if(M.key==="Enter"||M.charCode===13){for(var F=arguments.length,Q=new Array(F>2?F-2:0),G=2;G<F;G++)Q[G-2]=arguments[G];B.apply(void 0,Q)}},o.runIfEnterPrev=function(M){o.runIfEnter(M,o.prev)},o.runIfEnterNext=function(M){o.runIfEnter(M,o.next)},o.runIfEnterJumpPrev=function(M){o.runIfEnter(M,o.jumpPrev)},o.runIfEnterJumpNext=function(M){o.runIfEnter(M,o.jumpNext)},o.handleGoTO=function(M){(M.keyCode===T.ENTER||M.type==="click")&&o.handleChange(o.state.currentInputValue)};var s=d.onChange!==a,w="current"in d;w&&!s&&console.warn("Warning: You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component.");var C=d.defaultCurrent;"current"in d&&(C=d.current);var v=d.defaultPageSize;return"pageSize"in d&&(v=d.pageSize),C=Math.min(C,O(v,void 0,d)),o.state={current:C,currentInputValue:C,pageSize:v},o}return Object(N.a)(h,[{key:"componentDidUpdate",value:function(o,s){var w=this.props.prefixCls;if(s.current!==this.state.current&&this.paginationNode){var C=this.paginationNode.querySelector(".".concat(w,"-item-").concat(s.current));C&&document.activeElement===C&&C.blur()}}},{key:"getValidValue",value:function(o){var s=o.target.value,w=O(void 0,this.state,this.props),C=this.state.currentInputValue,v;return s===""?v=s:isNaN(Number(s))?v=C:s>=w?v=w:v=Number(s),v}},{key:"getShowSizeChanger",value:function(){var o=this.props,s=o.showSizeChanger,w=o.total,C=o.totalBoundaryShowSizeChanger;return typeof s!="undefined"?s:w>C}},{key:"renderPrev",value:function(o){var s=this.props,w=s.prevIcon,C=s.itemRender,v=C(o,"prev",this.getItemIcon(w,"prev page")),M=!this.hasPrev();return Object(I.isValidElement)(v)?Object(I.cloneElement)(v,{disabled:M}):v}},{key:"renderNext",value:function(o){var s=this.props,w=s.nextIcon,C=s.itemRender,v=C(o,"next",this.getItemIcon(w,"next page")),M=!this.hasNext();return Object(I.isValidElement)(v)?Object(I.cloneElement)(v,{disabled:M}):v}},{key:"render",value:function(){var o=this,s=this.props,w=s.prefixCls,C=s.className,v=s.style,M=s.disabled,B=s.hideOnSinglePage,F=s.total,Q=s.locale,G=s.showQuickJumper,W=s.showLessItems,$=s.showTitle,re=s.showTotal,ae=s.simple,he=s.itemRender,Te=s.showPrevNextJumpers,ye=s.jumpPrevIcon,Ee=s.jumpNextIcon,Oe=s.selectComponentClass,_e=s.selectPrefixCls,fe=s.pageSizeOptions,le=this.state,Me=le.current,ot=le.pageSize,ut=le.currentInputValue;if(B===!0&&F<=ot)return null;var rt=O(void 0,this.state,this.props),tt=[],ze=null,$e=null,ct=null,vt=null,at=null,et=G&&G.goButton,nt=W?1:2,Rt=Me-1>0?Me-1:0,Ct=Me+1<rt?Me+1:rt,xt=Object.keys(this.props).reduce(function(ne,ie){return(ie.substr(0,5)==="data-"||ie.substr(0,5)==="aria-"||ie==="role")&&(ne[ie]=o.props[ie]),ne},{});if(ae)return et&&(typeof et=="boolean"?at=E.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},Q.jump_to_confirm):at=E.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},et),at=E.a.createElement("li",{title:$?"".concat(Q.jump_to).concat(Me,"/").concat(rt):null,className:"".concat(w,"-simple-pager")},at)),E.a.createElement("ul",Object(J.a)({className:f()(w,"".concat(w,"-simple"),Object(K.a)({},"".concat(w,"-disabled"),M),C),style:v,ref:this.savePaginationNode},xt),E.a.createElement("li",{title:$?Q.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:f()("".concat(w,"-prev"),Object(K.a)({},"".concat(w,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(Rt)),E.a.createElement("li",{title:$?"".concat(Me,"/").concat(rt):null,className:"".concat(w,"-simple-pager")},E.a.createElement("input",{type:"text",value:ut,disabled:M,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),E.a.createElement("span",{className:"".concat(w,"-slash")},"/"),rt),E.a.createElement("li",{title:$?Q.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:f()("".concat(w,"-next"),Object(K.a)({},"".concat(w,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(Ct)),at);if(rt<=3+nt*2){var yt={locale:Q,rootPrefixCls:w,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:$,itemRender:he};rt||tt.push(E.a.createElement(P,Object(J.a)({},yt,{key:"noPager",page:rt,className:"".concat(w,"-disabled")})));for(var wt=1;wt<=rt;wt+=1){var Et=Me===wt;tt.push(E.a.createElement(P,Object(J.a)({},yt,{key:wt,page:wt,active:Et})))}}else{var Se=W?Q.prev_3:Q.prev_5,xe=W?Q.next_3:Q.next_5;Te&&(ze=E.a.createElement("li",{title:$?Se:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:f()("".concat(w,"-jump-prev"),Object(K.a)({},"".concat(w,"-jump-prev-custom-icon"),!!ye))},he(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(ye,"prev page"))),$e=E.a.createElement("li",{title:$?xe:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:f()("".concat(w,"-jump-next"),Object(K.a)({},"".concat(w,"-jump-next-custom-icon"),!!Ee))},he(this.getJumpNextPage(),"jump-next",this.getItemIcon(Ee,"next page")))),vt=E.a.createElement(P,{locale:Q,last:!0,rootPrefixCls:w,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:rt,page:rt,active:!1,showTitle:$,itemRender:he}),ct=E.a.createElement(P,{locale:Q,rootPrefixCls:w,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:$,itemRender:he});var Ke=Math.max(1,Me-nt),Ve=Math.min(Me+nt,rt);Me-1<=nt&&(Ve=1+nt*2),rt-Me<=nt&&(Ke=rt-nt*2);for(var De=Ke;De<=Ve;De+=1){var We=Me===De;tt.push(E.a.createElement(P,{locale:Q,rootPrefixCls:w,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:De,page:De,active:We,showTitle:$,itemRender:he}))}Me-1>=nt*2&&Me!==1+2&&(tt[0]=Object(I.cloneElement)(tt[0],{className:"".concat(w,"-item-after-jump-prev")}),tt.unshift(ze)),rt-Me>=nt*2&&Me!==rt-2&&(tt[tt.length-1]=Object(I.cloneElement)(tt[tt.length-1],{className:"".concat(w,"-item-before-jump-next")}),tt.push($e)),Ke!==1&&tt.unshift(ct),Ve!==rt&&tt.push(vt)}var ge=null;re&&(ge=E.a.createElement("li",{className:"".concat(w,"-total-text")},re(F,[F===0?0:(Me-1)*ot+1,Me*ot>F?F:Me*ot])));var de=!this.hasPrev()||!rt,ce=!this.hasNext()||!rt;return E.a.createElement("ul",Object(J.a)({className:f()(w,C,Object(K.a)({},"".concat(w,"-disabled"),M)),style:v,unselectable:"unselectable",ref:this.savePaginationNode},xt),ge,E.a.createElement("li",{title:$?Q.prev_page:null,onClick:this.prev,tabIndex:de?null:0,onKeyPress:this.runIfEnterPrev,className:f()("".concat(w,"-prev"),Object(K.a)({},"".concat(w,"-disabled"),de)),"aria-disabled":de},this.renderPrev(Rt)),tt,E.a.createElement("li",{title:$?Q.next_page:null,onClick:this.next,tabIndex:ce?null:0,onKeyPress:this.runIfEnterNext,className:f()("".concat(w,"-next"),Object(K.a)({},"".concat(w,"-disabled"),ce)),"aria-disabled":ce},this.renderNext(Ct)),E.a.createElement(m,{disabled:M,locale:Q,rootPrefixCls:w,selectComponentClass:Oe,selectPrefixCls:_e,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:Me,pageSize:ot,pageSizeOptions:fe,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:et}))}}],[{key:"getDerivedStateFromProps",value:function(o,s){var w={};if("current"in o&&(w.current=o.current,o.current!==s.current&&(w.currentInputValue=w.current)),"pageSize"in o&&o.pageSize!==s.pageSize){var C=s.current,v=O(o.pageSize,s,o);C=C>v?v:C,"current"in o||(w.current=C,w.currentInputValue=C),w.pageSize=o.pageSize}return w}}]),h}(E.a.Component);b.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:a,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:a,locale:i.a,style:{},itemRender:c,totalBoundaryShowSizeChanger:50};var y=b},"6RRn":function(Fe,Ce,j){"use strict";var J=j("wCXF"),K=j("n6Qo");j.d(Ce,"b",function(){return K.a});var R=j("IBYe"),H=j("6eGT"),N=j("hW8S");j.d(Ce,"a",function(){return N.a}),Ce.c=J.b},"6eGT":function(Fe,Ce,j){"use strict";function J(K){return null}Ce.a=J},"7Cbv":function(Fe,Ce,j){"use strict";var J=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),K=new Uint8Array(16);function R(){if(!J)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return J(K)}var H=/^(?:[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 N(P){return typeof P=="string"&&H.test(P)}for(var x=N,U=[],I=0;I<256;++I)U.push((I+256).toString(16).substr(1));function E(P){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,p=(U[P[T+0]]+U[P[T+1]]+U[P[T+2]]+U[P[T+3]]+"-"+U[P[T+4]]+U[P[T+5]]+"-"+U[P[T+6]]+U[P[T+7]]+"-"+U[P[T+8]]+U[P[T+9]]+"-"+U[P[T+10]]+U[P[T+11]]+U[P[T+12]]+U[P[T+13]]+U[P[T+14]]+U[P[T+15]]).toLowerCase();if(!x(p))throw TypeError("Stringified UUID is invalid");return p}var L=E;function f(P,T,p){P=P||{};var m=P.random||(P.rng||R)();if(m[6]=m[6]&15|64,m[8]=m[8]&63|128,T){p=p||0;for(var i=0;i<16;++i)T[p+i]=m[i];return T}return L(m)}var S=Ce.a=f},"7ahc":function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return O});var J=j("k1fw"),K=j("0Owb"),R=j("+L6B"),H=j("2/Rp"),N=j("y8nQ"),x=j("Vl3Y"),U=j("tJVT"),I=j("OaEy"),E=j("2fM7"),L=j("q1tI"),f=j.n(L),S=j("VrN/"),P=j.n(S),T=j("p77/"),p=j.n(T),m=j("c5Ni"),i=j.n(m),a=E.a.Option,u={labelCol:{span:4},wrapperCol:{span:20}},c={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"]};Ce.b=function(b){var y=b.callback,D=b.onCancel,_=Object(L.useState)("python"),h=Object(U.a)(_,2),d=h[0],o=h[1];function s(C){o(c[C][1])}function w(C){y(C)}return f.a.createElement(x.a,Object(K.a)({},u,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:w}),f.a.createElement(x.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},f.a.createElement(E.a,{onChange:s},Object.keys(c).map(function(C){return f.a.createElement(a,{key:C,value:C},c[C][0])}))),f.a.createElement(x.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},f.a.createElement(O,{mode:d})),f.a.createElement("div",{className:"flex-container flex-end"},f.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),f.a.createElement(H.a,{type:"ghost",onClick:D},"\u53D6\u6D88")))};function O(b){var y=b.value,D=b.onChange,_=b.mode,h=b.options,d=h===void 0?{}:h,o=Object(L.useRef)(),s=Object(L.useState)(),w=Object(U.a)(s,2),C=w[0],v=w[1];return Object(L.useEffect)(function(){if(C){function M(B){var F=B.getValue();D&&D(F)}return C.on("change",M),function(){C.off("change",M)}}},[C,D]),Object(L.useEffect)(function(){C&&C.setOption("mode",_)},[C,_]),Object(L.useEffect)(function(){C&&((y!==C.getValue()||y==="")&&setTimeout(function(){C.setValue(y||" ")},300))},[C,y]),Object(L.useEffect)(function(){if(o.current&&!C){var M=P.a.fromTextArea(o.current,Object(J.a)({mode:_,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},d));v(M)}},[o.current,C]),f.a.createElement("div",{className:"my-codemirror-container"},f.a.createElement("textarea",{ref:o}))}},"7ixt":function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return R});var J={adjustX:1,adjustY:1},K=[0,0],R={left:{points:["cr","cl"],overflow:J,offset:[-4,0],targetOffset:K},right:{points:["cl","cr"],overflow:J,offset:[4,0],targetOffset:K},top:{points:["bc","tc"],overflow:J,offset:[0,-4],targetOffset:K},bottom:{points:["tc","bc"],overflow:J,offset:[0,4],targetOffset:K},topLeft:{points:["bl","tl"],overflow:J,offset:[0,-4],targetOffset:K},leftTop:{points:["tr","tl"],overflow:J,offset:[-4,0],targetOffset:K},topRight:{points:["br","tr"],overflow:J,offset:[0,-4],targetOffset:K},rightTop:{points:["tl","tr"],overflow:J,offset:[4,0],targetOffset:K},bottomRight:{points:["tr","br"],overflow:J,offset:[0,4],targetOffset:K},rightBottom:{points:["bl","br"],overflow:J,offset:[4,0],targetOffset:K},bottomLeft:{points:["tl","bl"],overflow:J,offset:[0,4],targetOffset:K},leftBottom:{points:["br","bl"],overflow:J,offset:[-4,0],targetOffset:K}},H=R},"815F":function(Fe,Ce,j){"use strict";j.d(Ce,"e",function(){return U}),j.d(Ce,"c",function(){return E}),j.d(Ce,"d",function(){return L}),j.d(Ce,"a",function(){return S}),j.d(Ce,"f",function(){return P}),j.d(Ce,"b",function(){return T});var J=j("KQm4"),K=j("VTBJ"),R=j("Ff2n"),H=j("Zm9Q"),N=j("Kwbf"),x=j("OZM5");function U(p,m){return p!=null?p:m}function I(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],m=new Map;function i(a){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(a||[]).forEach(function(c){var O=c.key,b=c.children;Object(N.a)(O!=null,"Tree node must have a certain key: [".concat(u).concat(O,"]"));var y=String(O);Object(N.a)(!m.has(y)||O===null||O===void 0,"Same 'key' exist in the Tree: ".concat(y)),m.set(y,!0),i(b,"".concat(u).concat(y," > "))})}i(p)}function E(p){function m(i){var a=Object(H.a)(i);return a.map(function(u){if(!Object(x.i)(u))return Object(N.a)(!u,"Tree/TreeNode can only accept TreeNode as children."),null;var c=u.key,O=u.props,b=O.children,y=Object(R.a)(O,["children"]),D=Object(K.a)({key:c},y),_=m(b);return _.length&&(D.children=_),D}).filter(function(u){return u})}return m(p)}function L(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=new Set(m===!0?[]:m),a=[];function u(c){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return c.map(function(b,y){var D=Object(x.h)(O?O.pos:"0",y),_=U(b.key,D),h=Object(K.a)(Object(K.a)({},b),{},{parent:O,pos:D,children:null,data:b,isStart:[].concat(Object(J.a)(O?O.isStart:[]),[y===0]),isEnd:[].concat(Object(J.a)(O?O.isEnd:[]),[y===c.length-1])});return a.push(h),m===!0||i.has(_)?h.children=u(b.children||[],h):h.children=[],h})}return u(p),a}function f(p,m,i){var a;i?typeof i=="string"?a=function(O){return O[i]}:typeof i=="function"&&(a=function(O){return i(O)}):a=function(O,b){return U(O.key,b)};function u(c,O,b){var y=c?c.children:p,D=c?Object(x.h)(b.pos,O):"0";if(c){var _=a(c,D),h={node:c,index:O,pos:D,key:_,parentPos:b.node?b.pos:null,level:b.level+1};m(h)}y&&y.forEach(function(d,o){u(d,o,{node:c,pos:D,level:b?b.level+1:-1})})}u(null)}function S(p){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=m.initWrapper,a=m.processEntity,u=m.onProcessFinished,c=arguments.length>2?arguments[2]:void 0,O={},b={},y={posEntities:O,keyEntities:b};return i&&(y=i(y)||y),f(p,function(D){var _=D.node,h=D.index,d=D.pos,o=D.key,s=D.parentPos,w=D.level,C={node:_,index:h,key:o,pos:d,level:w},v=U(o,d);O[d]=C,b[v]=C,C.parent=O[s],C.parent&&(C.parent.children=C.parent.children||[],C.parent.children.push(C)),a&&a(C,y)},c),u&&u(y),y}function P(p,m){var i=m.expandedKeys,a=m.selectedKeys,u=m.loadedKeys,c=m.loadingKeys,O=m.checkedKeys,b=m.halfCheckedKeys,y=m.dragOverNodeKey,D=m.dropPosition,_=m.keyEntities,h=_[p],d={eventKey:p,expanded:i.indexOf(p)!==-1,selected:a.indexOf(p)!==-1,loaded:u.indexOf(p)!==-1,loading:c.indexOf(p)!==-1,checked:O.indexOf(p)!==-1,halfChecked:b.indexOf(p)!==-1,pos:String(h?h.pos:""),dragOver:y===p&&D===0,dragOverGapTop:y===p&&D===-1,dragOverGapBottom:y===p&&D===1};return d}function T(p){var m=p.data,i=p.expanded,a=p.selected,u=p.checked,c=p.loaded,O=p.loading,b=p.halfChecked,y=p.dragOver,D=p.dragOverGapTop,_=p.dragOverGapBottom,h=p.pos,d=p.active,o=Object(K.a)(Object(K.a)({},m),{},{expanded:i,selected:a,checked:u,loaded:c,loading:O,halfChecked:b,dragOver:y,dragOverGapTop:D,dragOverGapBottom:_,pos:h,active:d});return"props"in o||Object.defineProperty(o,"props",{get:function(){return Object(N.a)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),p}}),o}},"8EBN":function(Fe,Ce,j){(function(J){J(j("VrN/"))})(function(J){"use strict";J.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 K=0;K<J.modeInfo.length;K++){var R=J.modeInfo[K];R.mimes&&(R.mime=R.mimes[0])}J.findModeByMIME=function(H){H=H.toLowerCase();for(var N=0;N<J.modeInfo.length;N++){var x=J.modeInfo[N];if(x.mime==H)return x;if(x.mimes){for(var U=0;U<x.mimes.length;U++)if(x.mimes[U]==H)return x}}if(/\+xml$/.test(H))return J.findModeByMIME("application/xml");if(/\+json$/.test(H))return J.findModeByMIME("application/json")},J.findModeByExtension=function(H){H=H.toLowerCase();for(var N=0;N<J.modeInfo.length;N++){var x=J.modeInfo[N];if(x.ext){for(var U=0;U<x.ext.length;U++)if(x.ext[U]==H)return x}}},J.findModeByFileName=function(H){for(var N=0;N<J.modeInfo.length;N++){var x=J.modeInfo[N];if(x.file&&x.file.test(H))return x}var U=H.lastIndexOf("."),I=U>-1&&H.substring(U+1,H.length);if(I)return J.findModeByExtension(I)},J.findModeByName=function(H){H=H.toLowerCase();for(var N=0;N<J.modeInfo.length;N++){var x=J.modeInfo[N];if(x.name.toLowerCase()==H)return x;if(x.alias){for(var U=0;U<x.alias.length;U++)if(x.alias[U].toLowerCase()==H)return x}}}})},"8hTe":function(Fe,Ce,j){Fe.exports={button:"button___1wy9m"}},"9Bee":function(Fe,Ce,j){"use strict";var J=j("DYRE"),K=j("zeV3"),R=j("+L6B"),H=j("2/Rp"),N=j("k1fw"),x=j("9og8"),U=j("tJVT"),I=j("WmNS"),E=j.n(I),L=j("q1tI"),f=j.n(L),S=j("vg9a"),P=j("DlQD"),T=j.n(P),p=j("rUJ1");function m(z,g){var A=z.match(/^(\s+)(?:```)/);if(A===null)return g;var V=A[1];return g.split(`
|
|
`).map(function(ee){var X=ee.match(/^\s+/);if(X===null)return ee;var ve=Object(U.a)(X,1),Xe=ve[0];return Xe.length>=V.length?ee.slice(V.length):ee}).join(`
|
|
`)}var i=[],a=["<ul>"],u=new T.a.Renderer,c=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function O(){i.length=0,a=["<ul>"]}var b={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function y(z,g,A,V){if(g>=z.length||z[g].level<=A)return g;var ee=z[g];V.push("<li><a href='#"+ee.anchor+"'>"+ee.text+"</a>"),g++;var X=[];return g=y(z,g,ee.level,X),X.length>0&&(V.push("<ul>"),X.forEach(function(ve){V.push(ve)}),V.push("</ul>")),V.push("</li>"),g=y(z,g,A,V),g}function D(){return y(i,0,0,a),a.push("</ul>"),a.join("")}var _={heading:function(g){var A=c.exec(g);if(A)return{type:"heading",raw:A[0],depth:A[1].length,text:A[2]}},fences:function(g){var A=this.rules.block.fences.exec(g);if(A){var V=A[0],ee=m(V,A[3]||""),X=A[2]?A[2].trim():A[2];if(["latex","katex","math"].indexOf(X)>=0){var ve=o(),Xe=ee;ee=ve,s[ve]={type:"block",expression:Xe}}return{type:"code",raw:V,lang:X,text:ee}}}},h=/(?:\${2})([^\n`]+?)(?:\${2})/gi,d=0,o=function(){return"__special_katext_id_".concat(d++,"__")},s={};function w(){return s}function C(){d=0,s={}}function v(z){return z=z.replace(h,function(g,A){var V=o();return s[V]={type:"inline",expression:A},V}),z}var M=u.listitem;u.listitem=function(z){return M(v(z))};var B=u.paragraph;u.paragraph=function(z){return B(v(z))};var F=u.tablecell;u.tablecell=function(z,g){return F(v(z),g)},u.code=function(z,g,A){var V=(g||"").match(/\S*/)[0];return V?["latex","katex","math"].indexOf(V)>=0?"<p class='editormd-tex'>".concat(z,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(g,'">').concat(A?z:Object(p.escape)(z,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(A?z:Object(p.escape)(z,!0))+"</code></pre>"},u.heading=function(z,g,A){var V=this.options.headerPrefix+A.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return i.push({anchor:V,level:g,text:z}),"<h"+g+' id="'+V+'">'+z+"</h"+g+">"},T.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),T.a.use({tokenizer:_,renderer:u});var Q=T.a,G=j("SJMd"),W=j("ulZh"),$=j.n(W),re=j("m3rI"),ae=j("Oy/b"),he=j("p5ED"),Te=j("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 ye=function(z,g){return(ye=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,V){A.__proto__=V}||function(A,V){for(var ee in V)Object.prototype.hasOwnProperty.call(V,ee)&&(A[ee]=V[ee])})(z,g)};function Ee(z,g){function A(){this.constructor=z}ye(z,g),z.prototype=g===null?Object.create(g):(A.prototype=g.prototype,new A)}function Oe(z,g,A,V){return new(A||(A=Promise))(function(ee,X){function ve(At){try{Le(V.next(At))}catch(Qe){X(Qe)}}function Xe(At){try{Le(V.throw(At))}catch(Qe){X(Qe)}}function Le(At){var Qe;At.done?ee(At.value):(Qe=At.value,Qe instanceof A?Qe:new A(function(Bt){Bt(Qe)})).then(ve,Xe)}Le((V=V.apply(z,g||[])).next())})}function _e(z,g){var A,V,ee,X,ve={label:0,sent:function(){if(1&ee[0])throw ee[1];return ee[1]},trys:[],ops:[]};return X={next:Xe(0),throw:Xe(1),return:Xe(2)},typeof Symbol=="function"&&(X[Symbol.iterator]=function(){return this}),X;function Xe(Le){return function(At){return function(Qe){if(A)throw new TypeError("Generator is already executing.");for(;ve;)try{if(A=1,V&&(ee=2&Qe[0]?V.return:Qe[0]?V.throw||((ee=V.return)&&ee.call(V),0):V.next)&&!(ee=ee.call(V,Qe[1])).done)return ee;switch(V=0,ee&&(Qe=[2&Qe[0],ee.value]),Qe[0]){case 0:case 1:ee=Qe;break;case 4:return ve.label++,{value:Qe[1],done:!1};case 5:ve.label++,V=Qe[1],Qe=[0];continue;case 7:Qe=ve.ops.pop(),ve.trys.pop();continue;default:if(!(ee=ve.trys,(ee=ee.length>0&&ee[ee.length-1])||Qe[0]!==6&&Qe[0]!==2)){ve=0;continue}if(Qe[0]===3&&(!ee||Qe[1]>ee[0]&&Qe[1]<ee[3])){ve.label=Qe[1];break}if(Qe[0]===6&&ve.label<ee[1]){ve.label=ee[1],ee=Qe;break}if(ee&&ve.label<ee[2]){ve.label=ee[2],ve.ops.push(Qe);break}ee[2]&&ve.ops.pop(),ve.trys.pop();continue}Qe=g.call(z,ve)}catch(Bt){Qe=[6,Bt],V=0}finally{A=ee=0}if(5&Qe[0])throw Qe[1];return{value:Qe[0]?Qe[1]:void 0,done:!0}}([Le,At])}}}function fe(){for(var z=0,g=0,A=arguments.length;g<A;g++)z+=arguments[g].length;var V=Array(z),ee=0;for(g=0;g<A;g++)for(var X=arguments[g],ve=0,Xe=X.length;ve<Xe;ve++,ee++)V[ee]=X[ve];return V}var le=function(){function z(){}return z.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},z.setAttributes=function(g,A){for(var V=0,ee=A;V<ee.length;V++){var X=ee[V],ve=X[0],Xe=X[1];g.setAttribute(ve,Xe)}},z.createRect=function(g,A,V){var ee=document.createElementNS("http://www.w3.org/2000/svg","rect");return ee.setAttribute("width",g.toString()),ee.setAttribute("height",A.toString()),V&&z.setAttributes(ee,V),ee},z.createLine=function(g,A,V,ee,X){var ve=document.createElementNS("http://www.w3.org/2000/svg","line");return ve.setAttribute("x1",g.toString()),ve.setAttribute("y1",A.toString()),ve.setAttribute("x2",V.toString()),ve.setAttribute("y2",ee.toString()),X&&z.setAttributes(ve,X),ve},z.createPolygon=function(g,A){var V=document.createElementNS("http://www.w3.org/2000/svg","polygon");return V.setAttribute("points",g),A&&z.setAttributes(V,A),V},z.createCircle=function(g,A){var V=document.createElementNS("http://www.w3.org/2000/svg","circle");return V.setAttribute("cx",(g/2).toString()),V.setAttribute("cy",(g/2).toString()),V.setAttribute("r",g.toString()),A&&z.setAttributes(V,A),V},z.createEllipse=function(g,A,V){var ee=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return ee.setAttribute("cx",(g/2).toString()),ee.setAttribute("cy",(A/2).toString()),ee.setAttribute("rx",(g/2).toString()),ee.setAttribute("ry",(A/2).toString()),V&&z.setAttributes(ee,V),ee},z.createGroup=function(g){var A=document.createElementNS("http://www.w3.org/2000/svg","g");return g&&z.setAttributes(A,g),A},z.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},z.createMarker=function(g,A,V,ee,X,ve,Xe){var Le=document.createElementNS("http://www.w3.org/2000/svg","marker");return z.setAttributes(Le,[["id",g],["orient",A],["markerWidth",V.toString()],["markerHeight",ee.toString()],["refX",X.toString()],["refY",ve.toString()]]),Le.appendChild(Xe),Le},z.createText=function(g){var A=document.createElementNS("http://www.w3.org/2000/svg","text");return A.setAttribute("x","0"),A.setAttribute("y","0"),g&&z.setAttributes(A,g),A},z.createTSpan=function(g,A){var V=document.createElementNS("http://www.w3.org/2000/svg","tspan");return V.textContent=g,A&&z.setAttributes(V,A),V},z.createImage=function(g){var A=document.createElementNS("http://www.w3.org/2000/svg","image");return g&&z.setAttributes(A,g),A},z.createPoint=function(g,A){var V=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return V.x=g,V.y=A,V},z.createPath=function(g,A){var V=document.createElementNS("http://www.w3.org/2000/svg","path");return V.setAttribute("d",g),A&&z.setAttributes(V,A),V},z}(),Me=function(){function z(){}return z.addKey=function(g){z.key=g},Object.defineProperty(z,"isLicensed",{get:function(){return!!z.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(z.key)},enumerable:!1,configurable:!0}),z}(),ot=function(){function z(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return z.prototype.rasterize=function(g,A,V){var ee=this;return new Promise(function(X){var ve=V!==void 0?V:document.createElement("canvas");g===null&&(ee.markersOnly=!0,ee.naturalSize=!1);var Xe=document.createElementNS("http://www.w3.org/2000/svg","svg");Xe.setAttribute("xmlns","http://www.w3.org/2000/svg"),Xe.setAttribute("width",A.width.baseVal.valueAsString),Xe.setAttribute("height",A.height.baseVal.valueAsString),Xe.setAttribute("viewBox","0 0 "+A.viewBox.baseVal.width.toString()+" "+A.viewBox.baseVal.height.toString()),Xe.innerHTML=A.innerHTML,ee.naturalSize===!0?(Xe.width.baseVal.value=g.naturalWidth,Xe.height.baseVal.value=g.naturalHeight):ee.width!==void 0&&ee.height!==void 0&&(Xe.width.baseVal.value=ee.width,Xe.height.baseVal.value=ee.height),ve.width=Xe.width.baseVal.value,ve.height=Xe.height.baseVal.value;var Le=Xe.outerHTML,At=ve.getContext("2d");ee.markersOnly!==!0&&At.drawImage(g,0,0,ve.width,ve.height);var Qe=window.URL,Bt=new Image(ve.width,ve.height);Bt.setAttribute("crossOrigin","anonymous");var Ft=new Blob([Le],{type:"image/svg+xml"}),tn=Qe.createObjectURL(Ft);Bt.onload=function(){At.drawImage(Bt,0,0),Qe.revokeObjectURL(tn);var zn=ve.toDataURL(ee.imageType,ee.imageQuality);X(zn)},Bt.src=tn})},z}(),ut=function(){},rt=function(){function z(g){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+g+"_"}return Object.defineProperty(z.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(z.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(z.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),z.prototype.addClass=function(g){return this.styleSheet===void 0&&this.addStyleSheet(),g.name=""+this.classNamePrefix+g.localName,this.classes.push(g),this.styleSheet.sheet.insertRule("."+g.name+" {"+g.style+"}",this.styleSheet.sheet.cssRules.length),g},z.prototype.addRule=function(g){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(g),this.styleSheet.sheet.insertRule(g.selector+" {"+g.style+"}",this.styleSheet.sheet.cssRules.length)},z.prototype.addStyleSheet=function(){var g;this.styleSheet=document.createElement("style"),((g=this.styleSheetRoot)!==null&&g!==void 0?g:document.head).appendChild(this.styleSheet),this.addRule(new tt("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new tt("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new tt("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new ze("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new ze("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},z.prototype.removeStyleSheet=function(){var g;this.styleSheet&&(((g=this.styleSheetRoot)!==null&&g!==void 0?g:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},z}(),tt=function(z,g){this.selector=z,this.style=g},ze=function(z,g){this.localName=z,this.style=g},$e=function(){function z(g,A,V,ee,X){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=g,this.displayMode=A,this.markerItems=V,this.uiStyleSettings=ee,this.styles=X,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return z.prototype.show=function(g){var A=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=g,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var V=document.createElement("div");V.className=this.toolbarBlockStyleClass.name,V.style.whiteSpace="nowrap",this.uiContainer.appendChild(V),this.addActionButton(V,'<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(V,'<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(V,'<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(V,'<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(V,'<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(V,'<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(V,'<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(V,'<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(X){var ve=document.createElement("div");ve.className=""+A.toolbarButtonStyleClass.name,ve.setAttribute("data-type-name",X.typeName),ve.innerHTML=X.icon,ve.addEventListener("click",function(){A.markerToolbarButtonClicked(ve,X)}),A.buttons.push(ve),A.markerButtons.push(ve)}),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 ee=document.createElement("div");ee.className=this.toolbarBlockStyleClass.name,ee.style.whiteSpace="nowrap",ee.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(ee),this.addActionButton(ee,'<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(ee,'<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()},z.prototype.addButtonClickListener=function(g){this.buttonClickListeners.push(g)},z.prototype.removeButtonClickListener=function(g){this.buttonClickListeners.indexOf(g)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(g),1)},z.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},z.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var g=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var A=0;A<this.markerButtons.length;A++)A<g||A===g&&this.markerButtons.length-1===g?this.markerButtonBlock.appendChild(this.markerButtons[A]):(A===g&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[A]))}},z.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")},z.prototype.resetButtonStyles=function(){var g=this;this.buttons.forEach(function(A){A.className=A.className.replace(g.uiStyleSettings.toolbarButtonStyleColorsClassName?g.uiStyleSettings.toolbarButtonStyleColorsClassName:g.toolbarButtonStyleColorsClass.name,"").trim(),A.className=A.className.replace(g.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?g.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:g.toolbarActiveButtonStyleColorsClass.name,"").trim(),A.className+=" "+(g.uiStyleSettings.toolbarButtonStyleColorsClassName?g.uiStyleSettings.toolbarButtonStyleColorsClassName:g.toolbarButtonStyleColorsClass.name)})},z.prototype.addActionButton=function(g,A,V){var ee=this,X=document.createElement("div");switch(X.className=""+this.toolbarButtonStyleClass.name,X.innerHTML=A,X.setAttribute("data-action",V),X.addEventListener("click",function(){ee.actionToolbarButtonClicked(X,V)}),V){case"select":X.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":X.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":X.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":X.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":X.style.fill=this.uiStyleSettings.closeButtonColor}g.appendChild(X),this.buttons.push(X)},z.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new ze("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 ze("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new ze("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new ze("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 ze("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var g=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new ze("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*g)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*g)+`px;
|
|
padding: `+g+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new ze("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new ze("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new tt("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new tt("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},z.prototype.markerToolbarButtonClicked=function(g,A){this.setActiveButton(g),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(V){return V("marker",A)}),this.markerButtonOverflowBlock.style.display="none"},z.prototype.actionToolbarButtonClicked=function(g,A){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(V){return V("action",A)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},z.prototype.setActiveButton=function(g){this.resetButtonStyles(),g.className=g.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),g.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},z.prototype.setActiveMarkerButton=function(g){var A=this.markerButtons.find(function(V){return V.getAttribute("data-type-name")===g});A&&this.setActiveButton(A)},z.prototype.setCurrentMarker=function(g){var A=this;this.currentMarker=g,this.buttons.filter(function(V){return/delete|notes/.test(V.getAttribute("data-action"))}).forEach(function(V){A.currentMarker===void 0?(V.style.fillOpacity="0.4",V.style.pointerEvents="none"):(V.style.fillOpacity="1",V.style.pointerEvents="all")})},z}(),ct=function(){function z(g,A,V,ee){this.panels=[],this.panelButtons=[],this.markerjsContainer=g,this.displayMode=A,this.uiStyleSettings=V,this.styles=ee,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return z.prototype.addStyles=function(){var g;this.toolboxStyleClass=this.styles.addClass(new ze("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 ze("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var A=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new ze("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new ze("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new ze("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 ze("toolbox-panel-row_colors",`
|
|
background-color: `+((g=this.uiStyleSettings.toolboxBackgroundColor)!==null&&g!==void 0?g:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new ze("toolbox_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*A)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*A)+`px;
|
|
padding: `+A+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new ze("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new ze("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new tt("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new tt("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},z.prototype.show=function(g){var A;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=g,this.uiContainer.className=this.toolboxStyleClass.name+" "+((A=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&A!==void 0?A:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},z.prototype.setPanelButtons=function(g){var A,V,ee=this;this.panels=g,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((A=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&A!==void 0?A:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((V=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&V!==void 0?V:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(X){var ve;X.uiStyleSettings=ee.uiStyleSettings;var Xe=document.createElement("div");Xe.className=ee.toolboxButtonStyleClass.name+" "+((ve=ee.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ve!==void 0?ve:ee.toolboxButtonStyleColorsClass.name),Xe.innerHTML=X.icon,Xe.title=X.title,Xe.addEventListener("click",function(){ee.panelButtonClick(X)}),ee.panelButtons.push(Xe),ee.buttonRow.appendChild(Xe)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},z.prototype.panelButtonClick=function(g){var A=this,V=-1;if(g!==this.activePanel){V=this.panels.indexOf(g),this.panelRow.innerHTML="";var ee=g.getUi();ee.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(ee),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=g}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){A.displayMode==="inline"?A.panelRow.style.display="none":A.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(X,ve){var Xe,Le;X.className=A.toolboxButtonStyleClass.name+" "+(ve===V?""+((Xe=A.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Xe!==void 0?Xe:A.toolboxActiveButtonStyleColorsClass.name):""+((Le=A.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Le!==void 0?Le:A.toolboxButtonStyleColorsClass.name))})},z}(),vt=function(z,g){this.title=z,this.icon=g},at=function(z){function g(A,V,ee,X){var ve=z.call(this,A,X||'<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 ve.colors=[],ve.addTransparent=!1,ve.colorBoxes=[],ve.colors=V,ve.currentColor=ee,ve.setCurrentColor=ve.setCurrentColor.bind(ve),ve.getColorBox=ve.getColorBox.bind(ve),ve}return Ee(g,z),g.prototype.getUi=function(){var A=this,V=document.createElement("div");return V.style.overflow="hidden",V.style.whiteSpace="nowrap",this.colors.forEach(function(ee){var X=A.getColorBox(ee);V.appendChild(X),A.colorBoxes.push(X)}),V},g.prototype.getColorBox=function(A){var V=this,ee=this.uiStyleSettings.toolbarHeight/4,X=this.uiStyleSettings.toolbarHeight-ee,ve=document.createElement("div");ve.style.display="inline-block",ve.style.boxSizing="content-box",ve.style.width=X-2+"px",ve.style.height=X-2+"px",ve.style.padding="1px",ve.style.marginRight="2px",ve.style.marginBottom="2px",ve.style.borderWidth="2px",ve.style.borderStyle="solid",ve.style.borderRadius=(X+2)/2+"px",ve.style.borderColor=A===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ve.addEventListener("click",function(){V.setCurrentColor(A,ve)});var Xe=document.createElement("div");return Xe.style.display="inline-block",Xe.style.width=X-2+"px",Xe.style.height=X-2+"px",Xe.style.backgroundColor=A,Xe.style.borderRadius=X/2+"px",A==="transparent"&&(Xe.style.fill=this.uiStyleSettings.toolboxAccentColor,Xe.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>`),ve.appendChild(Xe),ve},g.prototype.setCurrentColor=function(A,V){var ee=this;this.currentColor=A,this.colorBoxes.forEach(function(X){X.style.borderColor=X===V?ee.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(A)},g}(vt),et=function(){function z(g,A,V){this._state="new",this._isSelected=!1,this._container=g,this._overlayContainer=A,this.globalSettings=V,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(z.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),z.prototype.ownsTarget=function(g){return!1},Object.defineProperty(z.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),z.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},z.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},z.prototype.pointerDown=function(g,A){},z.prototype.dblClick=function(g,A){},z.prototype.manipulate=function(g){},z.prototype.pointerUp=function(g){this.stateChanged()},z.prototype.dispose=function(){},z.prototype.addMarkerVisualToContainer=function(g){this.container.childNodes.length>0?this.container.insertBefore(g,this.container.childNodes[0]):this.container.appendChild(g)},z.prototype.getState=function(){return{typeName:z.typeName,state:this.state,notes:this.notes}},z.prototype.restoreState=function(g){this._state=g.state,this.notes=g.notes},z.prototype.scale=function(g,A){},z.prototype.colorChanged=function(g){this.onColorChanged&&this.onColorChanged(g),this.stateChanged()},z.prototype.fillColorChanged=function(g){this.onFillColorChanged&&this.onFillColorChanged(g),this.stateChanged()},z.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var g=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),g.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(g)&&this.onStateChanged(this)}},z.typeName="MarkerBase",z}(),nt=function(){function z(){this.findGripByVisual=this.findGripByVisual.bind(this)}return z.prototype.findGripByVisual=function(g){return this.topLeft.ownsTarget(g)?this.topLeft:this.topCenter.ownsTarget(g)?this.topCenter:this.topRight.ownsTarget(g)?this.topRight:this.centerLeft.ownsTarget(g)?this.centerLeft:this.centerRight.ownsTarget(g)?this.centerRight:this.bottomLeft.ownsTarget(g)?this.bottomLeft:this.bottomCenter.ownsTarget(g)?this.bottomCenter:this.bottomRight.ownsTarget(g)?this.bottomRight:void 0},z}(),Rt=function(){function z(){this.GRIP_SIZE=10,this.visual=le.createGroup(),this.visual.appendChild(le.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(le.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return z.prototype.ownsTarget=function(g){return g===this.visual||g===this.visual.childNodes[0]||g===this.visual.childNodes[1]},z}(),Ct=function(){function z(){}return z.toITransformMatrix=function(g){return{a:g.a,b:g.b,c:g.c,d:g.d,e:g.e,f:g.f}},z.toSVGMatrix=function(g,A){return g.a=A.a,g.b=A.b,g.c=A.c,g.d=A.d,g.e=A.e,g.f=A.f,g},z}(),xt=function(z){function g(A,V,ee){var X=z.call(this,A,V,ee)||this;return X.left=0,X.top=0,X.width=0,X.height=0,X.defaultSize={x:50,y:20},X.offsetX=0,X.offsetY=0,X.rotationAngle=0,X.CB_DISTANCE=10,X._suppressMarkerCreateEvent=!1,X.container.transform.baseVal.appendItem(le.createTransform()),X.setupControlBox(),X}return Ee(g,z),Object.defineProperty(g.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"visual",{get:function(){return this._visual},set:function(A){this._visual=A;var V=le.createTransform();this._visual.transform.baseVal.appendItem(V)},enumerable:!1,configurable:!0}),g.prototype.ownsTarget=function(A){return!!z.prototype.ownsTarget.call(this,A)||!!(this.controlGrips.findGripByVisual(A)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(A))},g.prototype.pointerDown=function(A,V){z.prototype.pointerDown.call(this,A,V),this.state==="new"&&(this.left=A.x,this.top=A.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var ee=this.unrotatePoint(A);if(this.manipulationStartX=ee.x,this.manipulationStartY=ee.y,this.offsetX=ee.x-this.left,this.offsetY=ee.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(V),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(V)){this.activeGrip=this.rotatorGrip;var X=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=X.x-this.width/2,this.top=X.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ve=this.container.transform.baseVal.getItem(0);ve.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ve,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},g.prototype.pointerUp=function(A){var V=this.state;z.prototype.pointerUp.call(this,A),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(A),this._state="select",V==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},g.prototype.moveVisual=function(A){this.visual.style.transform="translate("+A.x+"px, "+A.y+"px)"},g.prototype.manipulate=function(A){var V=this.unrotatePoint(A);this.state==="creating"?this.resize(A):this.state==="move"?(this.left=this.manipulationStartLeft+(V.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(V.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(V):this.state==="rotate"&&this.rotate(A)},g.prototype.resize=function(A){var V=this.manipulationStartLeft,ee=this.manipulationStartWidth,X=this.manipulationStartTop,ve=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:V=this.manipulationStartLeft+A.x-this.manipulationStartX,ee=this.manipulationStartWidth+this.manipulationStartLeft-V;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:ee=this.manipulationStartWidth+A.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:X=this.manipulationStartTop+A.y-this.manipulationStartY,ve=this.manipulationStartHeight+this.manipulationStartTop-X;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ve=this.manipulationStartHeight+A.y-this.manipulationStartY}ee>=0?(this.left=V,this.width=ee):(this.left=V+ee,this.width=-ee),ve>=0?(this.top=X,this.height=ve):(this.top=X+ve,this.height=-ve),this.setSize()},g.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},g.prototype.rotate=function(A){if(Math.abs(A.x-this.centerX)>.1){var V=Math.sign(A.x-this.centerX);this.rotationAngle=180*Math.atan((A.y-this.centerY)/(A.x-this.centerX))/Math.PI+90*V,this.applyRotation()}},g.prototype.applyRotation=function(){var A=this.container.transform.baseVal.getItem(0);A.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(A,0)},g.prototype.rotatePoint=function(A){if(this.rotationAngle===0)return A;var V=this.container.getCTM(),ee=le.createPoint(A.x,A.y);return{x:(ee=ee.matrixTransform(V)).x,y:ee.y}},g.prototype.unrotatePoint=function(A){if(this.rotationAngle===0)return A;var V=this.container.getCTM();V=V.inverse();var ee=le.createPoint(A.x,A.y);return{x:(ee=ee.matrixTransform(V)).x,y:ee.y}},g.prototype.select=function(){z.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},g.prototype.deselect=function(){z.prototype.deselect.call(this),this.controlBox.style.display="none"},g.prototype.setupControlBox=function(){this.controlBox=le.createGroup();var A=le.createTransform();A.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(A),this.container.appendChild(this.controlBox),this.controlRect=le.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=le.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 nt,this.addControlGrips(),this.controlBox.style.display="none"},g.prototype.adjustControlBox=function(){var A=this.controlBox.transform.baseVal.getItem(0);A.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(A,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()},g.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()},g.prototype.createGrip=function(){var A=new Rt;return A.visual.transform.baseVal.appendItem(le.createTransform()),this.controlBox.appendChild(A.visual),A},g.prototype.positionGrips=function(){var A=this.controlGrips.topLeft.GRIP_SIZE,V=-A/2,ee=V,X=(this.width+this.CB_DISTANCE)/2-A/2,ve=(this.height+this.CB_DISTANCE)/2-A/2,Xe=this.height+this.CB_DISTANCE-A/2,Le=this.width+this.CB_DISTANCE-A/2;this.positionGrip(this.controlGrips.topLeft.visual,V,ee),this.positionGrip(this.controlGrips.topCenter.visual,X,ee),this.positionGrip(this.controlGrips.topRight.visual,Le,ee),this.positionGrip(this.controlGrips.centerLeft.visual,V,ve),this.positionGrip(this.controlGrips.centerRight.visual,Le,ve),this.positionGrip(this.controlGrips.bottomLeft.visual,V,Xe),this.positionGrip(this.controlGrips.bottomCenter.visual,X,Xe),this.positionGrip(this.controlGrips.bottomRight.visual,Le,Xe),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,X,ee-3*this.CB_DISTANCE)},g.prototype.positionGrip=function(A,V,ee){var X=A.transform.baseVal.getItem(0);X.setTranslate(V,ee),A.transform.baseVal.replaceItem(X,0)},g.prototype.hideControlBox=function(){this.controlBox.style.display="none"},g.prototype.showControlBox=function(){this.controlBox.style.display=""},g.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:Ct.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:Ct.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},z.prototype.getState.call(this))},g.prototype.restoreState=function(A){z.prototype.restoreState.call(this,A);var V=A;this.left=V.left,this.top=V.top,this.width=V.width,this.height=V.height,this.rotationAngle=V.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(Ct.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,V.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(Ct.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,V.containerTransformMatrix))},g.prototype.scale=function(A,V){z.prototype.scale.call(this,A,V);var ee=this.rotatePoint({x:this.left,y:this.top}),X=this.unrotatePoint({x:ee.x*A,y:ee.y*V});this.left=X.x,this.top=X.y,this.width=this.width*A,this.height=this.height*V,this.adjustControlBox()},g}(et),yt=function(z){function g(A,V,ee){var X=z.call(this,A,V,ee)||this;return X.fillColor="transparent",X.strokeColor="transparent",X.strokeWidth=0,X.strokeDasharray="",X.opacity=1,X.setStrokeColor=X.setStrokeColor.bind(X),X.setFillColor=X.setFillColor.bind(X),X.setStrokeWidth=X.setStrokeWidth.bind(X),X.setStrokeDasharray=X.setStrokeDasharray.bind(X),X.createVisual=X.createVisual.bind(X),X}return Ee(g,z),g.prototype.ownsTarget=function(A){return!(!z.prototype.ownsTarget.call(this,A)&&A!==this.visual)},g.prototype.createVisual=function(){this.visual=le.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)},g.prototype.pointerDown=function(A,V){z.prototype.pointerDown.call(this,A,V),this.state==="new"&&(this.createVisual(),this.moveVisual(A),this._state="creating")},g.prototype.manipulate=function(A){z.prototype.manipulate.call(this,A)},g.prototype.resize=function(A){z.prototype.resize.call(this,A),this.setSize()},g.prototype.setSize=function(){z.prototype.setSize.call(this),le.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},g.prototype.pointerUp=function(A){z.prototype.pointerUp.call(this,A),this.setSize()},g.prototype.setStrokeColor=function(A){this.strokeColor=A,this.visual&&le.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(A),this.stateChanged()},g.prototype.setFillColor=function(A){this.fillColor=A,this.visual&&le.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},g.prototype.setStrokeWidth=function(A){this.strokeWidth=A,this.visual&&le.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},g.prototype.setStrokeDasharray=function(A){this.strokeDasharray=A,this.visual&&le.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},g.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},z.prototype.getState.call(this))},g.prototype.restoreState=function(A){var V=A;this.fillColor=V.fillColor,this.strokeColor=V.strokeColor,this.strokeWidth=V.strokeWidth,this.strokeDasharray=V.strokeDasharray,this.opacity=V.opacity,this.createVisual(),z.prototype.restoreState.call(this,A),this.setSize()},g.prototype.scale=function(A,V){z.prototype.scale.call(this,A,V),this.setSize()},g.title="Rectangle marker",g}(xt),wt=function(z){function g(A,V,ee,X){var ve=z.call(this,A,X||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return ve.widths=[],ve.widthBoxes=[],ve.widths=V,ve.currentWidth=ee,ve.setCurrentWidth=ve.setCurrentWidth.bind(ve),ve}return Ee(g,z),g.prototype.getUi=function(){var A=this,V=document.createElement("div");return V.style.display="flex",V.style.overflow="hidden",V.style.flexGrow="2",this.widths.forEach(function(ee){var X=document.createElement("div");X.style.display="flex",X.style.flexGrow="2",X.style.alignItems="center",X.style.justifyContent="space-between",X.style.padding="5px",X.style.borderWidth="2px",X.style.borderStyle="solid",X.style.borderColor=ee===A.currentWidth?A.uiStyleSettings.toolboxAccentColor:"transparent",X.addEventListener("click",function(){A.setCurrentWidth(ee,X)}),V.appendChild(X);var ve=document.createElement("div");ve.innerText=ee.toString(),ve.style.marginRight="5px",X.appendChild(ve);var Xe=document.createElement("div");Xe.style.minHeight="20px",Xe.style.flexGrow="2",Xe.style.display="flex",Xe.style.alignItems="center";var Le=document.createElement("hr");Le.style.minWidth="20px",Le.style.border="0px",Le.style.borderTop=ee+"px solid "+A.uiStyleSettings.toolboxColor,Le.style.flexGrow="2",Xe.appendChild(Le),X.appendChild(Xe),A.widthBoxes.push(X)}),V},g.prototype.setCurrentWidth=function(A,V){var ee=this;this.currentWidth=A,this.widthBoxes.forEach(function(X){X.style.borderColor=X===V?ee.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},g}(vt),Et=function(z){function g(A,V,ee,X){var ve=z.call(this,A,X||'<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 ve.styles=[],ve.styleBoxes=[],ve.styles=V,ve.currentStyle=ee,ve.setCurrentStyle=ve.setCurrentStyle.bind(ve),ve}return Ee(g,z),g.prototype.getUi=function(){var A=this,V=document.createElement("div");return V.style.display="flex",V.style.overflow="hidden",V.style.flexGrow="2",this.styles.forEach(function(ee){var X=document.createElement("div");X.style.display="flex",X.style.alignItems="center",X.style.justifyContent="space-between",X.style.padding="5px",X.style.borderWidth="2px",X.style.borderStyle="solid",X.style.overflow="hidden",X.style.maxWidth=100/A.styles.length-5+"%",X.style.borderColor=ee===A.currentStyle?A.uiStyleSettings.toolboxAccentColor:"transparent",X.addEventListener("click",function(){A.setCurrentStyle(ee,X)}),V.appendChild(X);var ve=document.createElement("div");ve.style.minHeight="20px",ve.style.flexGrow="2",ve.style.overflow="hidden";var Xe=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+A.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(ee!==""?'stroke-dasharray="'+ee+'"':"")+` />
|
|
</svg>`;ve.innerHTML=Xe,X.appendChild(ve),A.styleBoxes.push(X)}),V},g.prototype.setCurrentStyle=function(A,V){var ee=this;this.currentStyle=A,this.styleBoxes.forEach(function(X){X.style.borderColor=X===V?ee.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},g}(vt),Se=function(z){function g(A,V,ee){var X=z.call(this,A,V,ee)||this;return X.strokeColor=ee.defaultColor,X.strokeWidth=ee.defaultStrokeWidth,X.strokeDasharray=ee.defaultStrokeDasharray,X.strokePanel=new at("Line color",ee.defaultColorSet,ee.defaultColor),X.strokePanel.onColorChanged=X.setStrokeColor,X.strokeWidthPanel=new wt("Line width",ee.defaultStrokeWidths,ee.defaultStrokeWidth),X.strokeWidthPanel.onWidthChanged=X.setStrokeWidth,X.strokeStylePanel=new Et("Line style",ee.defaultStrokeDasharrays,ee.defaultStrokeDasharray),X.strokeStylePanel.onStyleChanged=X.setStrokeDasharray,X}return Ee(g,z),Object.defineProperty(g.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),g.prototype.getState=function(){var A=z.prototype.getState.call(this);return A.typeName=g.typeName,A},g.typeName="FrameMarker",g.title="Frame marker",g.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',g}(yt),xe=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},Ke=function(z){function g(A,V,ee){var X=z.call(this,A,V,ee)||this;return X.x1=0,X.y1=0,X.x2=0,X.y2=0,X.defaultLength=50,X.manipulationStartX=0,X.manipulationStartY=0,X.manipulationStartX1=0,X.manipulationStartY1=0,X.manipulationStartX2=0,X.manipulationStartY2=0,X.setupControlBox(),X}return Ee(g,z),g.prototype.ownsTarget=function(A){return!!z.prototype.ownsTarget.call(this,A)||!(!this.grip1.ownsTarget(A)&&!this.grip2.ownsTarget(A))},g.prototype.pointerDown=function(A,V){z.prototype.pointerDown.call(this,A,V),this.manipulationStartX=A.x,this.manipulationStartY=A.y,this.state==="new"&&(this.x1=A.x,this.y1=A.y,this.x2=A.x,this.y2=A.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(V)?this.activeGrip=this.grip1:this.grip2.ownsTarget(V)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},g.prototype.pointerUp=function(A){var V=this.state;z.prototype.pointerUp.call(this,A),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(A),this._state="select",V==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},g.prototype.adjustVisual=function(){},g.prototype.manipulate=function(A){this.state==="creating"?this.resize(A):this.state==="move"?(this.x1=this.manipulationStartX1+A.x-this.manipulationStartX,this.y1=this.manipulationStartY1+A.y-this.manipulationStartY,this.x2=this.manipulationStartX2+A.x-this.manipulationStartX,this.y2=this.manipulationStartY2+A.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(A)},g.prototype.resize=function(A){switch(this.activeGrip){case this.grip1:this.x1=A.x,this.y1=A.y;break;case this.grip2:case void 0:this.x2=A.x,this.y2=A.y}this.adjustVisual(),this.adjustControlBox()},g.prototype.select=function(){z.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},g.prototype.deselect=function(){z.prototype.deselect.call(this),this.controlBox.style.display="none"},g.prototype.setupControlBox=function(){this.controlBox=le.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},g.prototype.adjustControlBox=function(){this.positionGrips()},g.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},g.prototype.createGrip=function(){var A=new Rt;return A.visual.transform.baseVal.appendItem(le.createTransform()),this.controlBox.appendChild(A.visual),A},g.prototype.positionGrips=function(){var A=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-A/2,this.y1-A/2),this.positionGrip(this.grip2.visual,this.x2-A/2,this.y2-A/2)},g.prototype.positionGrip=function(A,V,ee){var X=A.transform.baseVal.getItem(0);X.setTranslate(V,ee),A.transform.baseVal.replaceItem(X,0)},g.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},z.prototype.getState.call(this))},g.prototype.restoreState=function(A){z.prototype.restoreState.call(this,A);var V=A;this.x1=V.x1,this.y1=V.y1,this.x2=V.x2,this.y2=V.y2},g.prototype.scale=function(A,V){z.prototype.scale.call(this,A,V),this.x1=this.x1*A,this.y1=this.y1*V,this.x2=this.x2*A,this.y2=this.y2*V,this.adjustVisual(),this.adjustControlBox()},g}(et),Ve=function(z){function g(A,V,ee){var X=z.call(this,A,V,ee)||this;return X.strokeColor="transparent",X.strokeWidth=0,X.strokeDasharray="",X.setStrokeColor=X.setStrokeColor.bind(X),X.setStrokeWidth=X.setStrokeWidth.bind(X),X.setStrokeDasharray=X.setStrokeDasharray.bind(X),X.strokeColor=ee.defaultColor,X.strokeWidth=ee.defaultStrokeWidth,X.strokeDasharray=ee.defaultStrokeDasharray,X.strokePanel=new at("Line color",ee.defaultColorSet,ee.defaultColor),X.strokePanel.onColorChanged=X.setStrokeColor,X.strokeWidthPanel=new wt("Line width",ee.defaultStrokeWidths,ee.defaultStrokeWidth),X.strokeWidthPanel.onWidthChanged=X.setStrokeWidth,X.strokeStylePanel=new Et("Line style",ee.defaultStrokeDasharrays,ee.defaultStrokeDasharray),X.strokeStylePanel.onStyleChanged=X.setStrokeDasharray,X}return Ee(g,z),g.prototype.ownsTarget=function(A){return!(!z.prototype.ownsTarget.call(this,A)&&A!==this.visual&&A!==this.selectorLine&&A!==this.visibleLine)},g.prototype.createVisual=function(){this.visual=le.createGroup(),this.selectorLine=le.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=le.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)},g.prototype.pointerDown=function(A,V){z.prototype.pointerDown.call(this,A,V),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},g.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()),le.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),le.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),le.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},g.prototype.setStrokeColor=function(A){this.strokeColor=A,this.adjustVisual(),this.colorChanged(A)},g.prototype.setStrokeWidth=function(A){this.strokeWidth=A,this.adjustVisual()},g.prototype.setStrokeDasharray=function(A){this.strokeDasharray=A,this.adjustVisual(),this.stateChanged()},Object.defineProperty(g.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),g.prototype.getState=function(){var A=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},z.prototype.getState.call(this));return A.typeName=g.typeName,A},g.prototype.restoreState=function(A){z.prototype.restoreState.call(this,A);var V=A;this.strokeColor=V.strokeColor,this.strokeWidth=V.strokeWidth,this.strokeDasharray=V.strokeDasharray,this.createVisual(),this.adjustVisual()},g.typeName="LineMarker",g.title="Line marker",g.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',g}(Ke),De=function(z){function g(A,V,ee,X){var ve=z.call(this,A,X||'<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 ve.fonts=[],ve.fontBoxes=[],ve.fonts=V,ve.currentFont=ee,ve.setCurrentFont=ve.setCurrentFont.bind(ve),ve}return Ee(g,z),g.prototype.getUi=function(){var A=this,V=document.createElement("div");return V.style.overflow="hidden",V.style.flexGrow="2",this.fonts.forEach(function(ee){var X=document.createElement("div");X.style.display="inline-block",X.style.alignItems="center",X.style.justifyContent="space-between",X.style.padding="5px",X.style.borderWidth="2px",X.style.borderStyle="solid",X.style.overflow="hidden",X.style.maxWidth=100/A.fonts.length-5+"%",X.style.borderColor=ee===A.currentFont?A.uiStyleSettings.toolboxAccentColor:"transparent",X.addEventListener("click",function(){A.setCurrentFont(ee,X)}),V.appendChild(X);var ve=document.createElement("div");ve.style.display="flex",ve.style.minHeight="20px",ve.style.flexGrow="2",ve.style.fontFamily=ee,ve.style.overflow="hidden";var Xe=document.createElement("div");Xe.style.whiteSpace="nowrap",Xe.style.overflow="hidden",Xe.style.textOverflow="ellipsis",Xe.innerHTML="The quick brown fox jumps over the lazy dog",ve.appendChild(Xe),X.appendChild(ve),A.fontBoxes.push(X)}),V},g.prototype.setCurrentFont=function(A,V){var ee=this;this.currentFont=A,this.fontBoxes.forEach(function(X){X.style.borderColor=X===V?ee.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},g}(vt),We=function(z){function g(A,V,ee){var X=z.call(this,A,V,ee)||this;return X.color="transparent",X.padding=5,X.DEFAULT_TEXT="your text here",X.text=X.DEFAULT_TEXT,X.isMoved=!1,X.color=ee.defaultColor,X.fontFamily=ee.defaultFontFamily,X.defaultSize={x:100,y:30},X.setColor=X.setColor.bind(X),X.setFont=X.setFont.bind(X),X.renderText=X.renderText.bind(X),X.sizeText=X.sizeText.bind(X),X.textEditDivClicked=X.textEditDivClicked.bind(X),X.showTextEditor=X.showTextEditor.bind(X),X.setSize=X.setSize.bind(X),X.positionTextEditor=X.positionTextEditor.bind(X),X.colorPanel=new at("Color",ee.defaultColorSet,ee.defaultColor),X.colorPanel.onColorChanged=X.setColor,X.fontFamilyPanel=new De("Font",ee.defaultFontFamilies,ee.defaultFontFamily),X.fontFamilyPanel.onFontChanged=X.setFont,X}return Ee(g,z),g.prototype.ownsTarget=function(A){if(z.prototype.ownsTarget.call(this,A)||A===this.visual||A===this.textElement||A===this.bgRectangle)return!0;var V=!1;return this.textElement.childNodes.forEach(function(ee){ee===A&&(V=!0)}),V},g.prototype.createVisual=function(){this.visual=le.createGroup(),this.bgRectangle=le.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=le.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(le.createTransform()),this.textElement.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},g.prototype.pointerDown=function(A,V){z.prototype.pointerDown.call(this,A,V),this.isMoved=!1,this.pointerDownPoint=A,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(A),this._state="creating")},g.prototype.renderText=function(){var A=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(V){A.textElement.appendChild(le.createTSpan(V.trim()===""?" ":V.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},g.prototype.getTextScale=function(){var A=this.textElement.getBBox(),V=1;if(A.width>0&&A.height>0){var ee=(1*this.width-this.width*this.padding*2/100)/A.width,X=(1*this.height-this.height*this.padding*2/100)/A.height;V=Math.min(ee,X)}return V},g.prototype.getTextPosition=function(A){var V=this.textElement.getBBox(),ee=0,X=0;return V.width>0&&V.height>0&&(ee=(this.width-V.width*A)/2,X=this.height/2-V.height*A/2),{x:ee,y:X}},g.prototype.sizeText=function(){var A=this.textElement.getBBox(),V=this.getTextScale(),ee=this.getTextPosition(V);ee.y-=A.y*V,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+ee.x+"px, "+ee.y+"px) scale("+V+", "+V+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(ee.x,ee.y),this.textElement.transform.baseVal.getItem(1).setScale(V,V))},g.prototype.manipulate=function(A){z.prototype.manipulate.call(this,A),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(A.x-this.pointerDownPoint.x)>5||Math.abs(A.y-this.pointerDownPoint.y)>5)},g.prototype.resize=function(A){z.prototype.resize.call(this,A),this.isMoved=!0,this.setSize(),this.sizeText()},g.prototype.setSize=function(){z.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(le.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),le.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},g.prototype.pointerUp=function(A){var V=this.state;V==="creating"&&(this._suppressMarkerCreateEvent=!0),z.prototype.pointerUp.call(this,A),this.setSize(),(V==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},g.prototype.showTextEditor=function(){var A=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(V){V.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var V=Number.parseFloat(A.textEditor.style.fontSize);A.textEditor.clientWidth>=Number.parseInt(A.textEditor.style.maxWidth)&&V>.9;)V-=.1,A.textEditor.style.fontSize=Math.max(V,.9)+"em"}),this.textEditor.addEventListener("keyup",function(V){V.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(V){if(V.clipboardData){var ee=V.clipboardData.getData("text"),X=window.getSelection();if(!X.rangeCount)return!1;X.deleteFromDocument(),X.getRangeAt(0).insertNode(document.createTextNode(ee)),V.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){A.textEditDivClicked(A.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},g.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var A=this.getTextScale(),V=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),ee=this.textElement.getBBox(),X={x:ee.width*A,y:ee.height*A};V.x-=X.x/2,V.y-=X.y/2,this.textEditor.style.top=V.y+"px",this.textEditor.style.left=V.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-V.x+"px",this.textEditor.style.fontSize=Math.max(16*A,12)+"px",this.textElement.style.display="none"}},g.prototype.textEditDivClicked=function(A){this.text=A.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},g.prototype.select=function(){z.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},g.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),z.prototype.deselect.call(this)},g.prototype.dblClick=function(A,V){z.prototype.dblClick.call(this,A,V),this.showTextEditor()},g.prototype.setColor=function(A){this.textElement&&le.setAttributes(this.textElement,[["fill",A]]),this.color=A,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(A)},g.prototype.setFont=function(A){this.textElement&&le.setAttributes(this.textElement,[["font-family",A]]),this.fontFamily=A,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},g.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},g.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(g.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),g.prototype.getState=function(){var A=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},z.prototype.getState.call(this));return A.typeName=g.typeName,A},g.prototype.restoreState=function(A){var V=A;this.color=V.color,this.fontFamily=V.fontFamily,this.padding=V.padding,this.text=V.text,this.createVisual(),z.prototype.restoreState.call(this,A),this.setSize()},g.prototype.scale=function(A,V){z.prototype.scale.call(this,A,V),this.setSize(),this.sizeText(),this.positionTextEditor()},g.typeName="TextMarker",g.title="Text marker",g.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>',g}(xt),ge=function(z){function g(A,V,ee){var X=z.call(this,A,V,ee)||this;return X.color="transparent",X.lineWidth=3,X.drawing=!1,X.pixelRatio=1,X.color=ee.defaultColor,X.lineWidth=ee.defaultStrokeWidth,X.pixelRatio=ee.freehandPixelRatio,X.setColor=X.setColor.bind(X),X.addCanvas=X.addCanvas.bind(X),X.finishCreation=X.finishCreation.bind(X),X.setLineWidth=X.setLineWidth.bind(X),X.colorPanel=new at("Color",ee.defaultColorSet,ee.defaultColor),X.colorPanel.onColorChanged=X.setColor,X.lineWidthPanel=new wt("Line width",ee.defaultStrokeWidths,ee.defaultStrokeWidth),X.lineWidthPanel.onWidthChanged=X.setLineWidth,X}return Ee(g,z),g.prototype.ownsTarget=function(A){return!(!z.prototype.ownsTarget.call(this,A)&&A!==this.visual&&A!==this.drawingImage)},g.prototype.createVisual=function(){this.visual=le.createGroup(),this.drawingImage=le.createImage(),this.visual.appendChild(this.drawingImage);var A=le.createTransform();this.visual.transform.baseVal.appendItem(A),this.addMarkerVisualToContainer(this.visual)},g.prototype.pointerDown=function(A,V){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(A.x,A.y),this.drawing=!0):z.prototype.pointerDown.call(this,A,V)},g.prototype.manipulate=function(A){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(A.x,A.y),this.canvasContext.stroke()):z.prototype.manipulate.call(this,A)},g.prototype.resize=function(A){z.prototype.resize.call(this,A),le.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),le.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},g.prototype.pointerUp=function(A){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):z.prototype.pointerUp.call(this,A)},g.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)},g.prototype.select=function(){this.state==="creating"&&this.finishCreation(),z.prototype.select.call(this)},g.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),z.prototype.deselect.call(this)},g.prototype.finishCreation=function(){for(var A=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),V=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],ee=V[0],X=V[1],ve=V[2],Xe=V[3],Le=!1,At=0;At<this.canvasElement.height;At++)for(var Qe=0;Qe<this.canvasElement.width;Qe++)A.data[At*this.canvasElement.width*4+4*Qe+3]>0&&(Le=!0,At<X&&(X=At),Qe<ee&&(ee=Qe),At>Xe&&(Xe=At),Qe>ve&&(ve=Qe));if(Le){this.left=ee/this.pixelRatio,this.top=X/this.pixelRatio,this.width=(ve-ee)/this.pixelRatio,this.height=(Xe-X)/this.pixelRatio;var Bt=document.createElement("canvas");Bt.width=ve-ee,Bt.height=Xe-X,Bt.getContext("2d").putImageData(this.canvasContext.getImageData(ee,X,ve-ee,Xe-X),0,0),this.drawingImgUrl=Bt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},g.prototype.setDrawingImage=function(){le.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),le.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},g.prototype.setColor=function(A){this.color=A,this.colorChanged(A)},g.prototype.setLineWidth=function(A){this.lineWidth=A},Object.defineProperty(g.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),g.prototype.getState=function(){var A=Object.assign({drawingImgUrl:this.drawingImgUrl},z.prototype.getState.call(this));return A.typeName=g.typeName,A},g.prototype.restoreState=function(A){this.createVisual(),z.prototype.restoreState.call(this,A),this.drawingImgUrl=A.drawingImgUrl,this.setDrawingImage()},g.prototype.scale=function(A,V){z.prototype.scale.call(this,A,V),this.setDrawingImage()},g.typeName="FreehandMarker",g.title="Freehand marker",g.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>',g}(xt),de=function(z){function g(A,V,ee){var X=z.call(this,A,ee||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return X.typeBoxes=[],X.currentType=V,X.setCurrentType=X.setCurrentType.bind(X),X}return Ee(g,z),g.prototype.getUi=function(){var A=this,V=document.createElement("div");V.style.display="flex",V.style.overflow="hidden",V.style.flexGrow="2";for(var ee=function(Xe){var Le="both";switch(Xe){case 0:Le="both";break;case 1:Le="start";break;case 2:Le="end";break;case 3:Le="none"}var At=document.createElement("div");if(At.style.display="flex",At.style.flexGrow="2",At.style.alignItems="center",At.style.justifyContent="space-between",At.style.padding="5px",At.style.borderWidth="2px",At.style.borderStyle="solid",At.style.borderColor=Le===X.currentType?X.uiStyleSettings.toolboxAccentColor:"transparent",At.addEventListener("click",function(){A.setCurrentType(Le,At)}),V.appendChild(At),Le==="both"||Le==="start"){var Qe=document.createElement("div");Qe.style.display="flex",Qe.style.alignItems="center",Qe.style.minHeight="20px",Qe.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="`+(X.uiStyleSettings!==void 0?X.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Qe.style.marginLeft="5px",At.appendChild(Qe)}var Bt=document.createElement("div");Bt.style.display="flex",Bt.style.alignItems="center",Bt.style.minHeight="20px",Bt.style.flexGrow="2";var Ft=document.createElement("hr");if(Ft.style.minWidth="20px",Ft.style.border="0px",Ft.style.borderTop="3px solid "+(X.uiStyleSettings!==void 0?X.uiStyleSettings.toolboxColor:"#eeeeee"),Ft.style.flexGrow="2",Bt.appendChild(Ft),At.appendChild(Bt),Le==="both"||Le==="end"){var tn=document.createElement("div");tn.style.display="flex",tn.style.alignItems="center",tn.style.minHeight="20px",tn.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="`+(X.uiStyleSettings!==void 0?X.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,tn.style.marginRight="5px",At.appendChild(tn)}X.typeBoxes.push(At)},X=this,ve=0;ve<4;ve++)ee(ve);return V},g.prototype.setCurrentType=function(A,V){var ee=this;this.currentType=A,this.typeBoxes.forEach(function(X){X.style.borderColor=X===V?ee.uiStyleSettings!==void 0?ee.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},g}(vt),ce=function(z){function g(A,V,ee){var X=z.call(this,A,V,ee)||this;return X.arrowType="end",X.arrowBaseHeight=10,X.arrowBaseWidth=10,X.getArrowPoints=X.getArrowPoints.bind(X),X.setArrowType=X.setArrowType.bind(X),X.arrowTypePanel=new de("Arrow type","end"),X.arrowTypePanel.onArrowTypeChanged=X.setArrowType,X}return Ee(g,z),g.prototype.ownsTarget=function(A){return!(!z.prototype.ownsTarget.call(this,A)&&A!==this.arrow1&&A!==this.arrow2)},g.prototype.getArrowPoints=function(A,V){var ee=this.arrowBaseWidth+2*this.strokeWidth,X=this.arrowBaseHeight+2*this.strokeWidth;return A-ee/2+","+(V+X/2)+" "+A+","+(V-X/2)+" "+(A+ee/2)+","+(V+X/2)},g.prototype.createTips=function(){this.arrow1=le.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=le.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.arrow2)},g.prototype.pointerDown=function(A,V){z.prototype.pointerDown.call(this,A,V),this.state==="creating"&&this.createTips()},g.prototype.adjustVisual=function(){if(z.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",le.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),le.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var A=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),V=this.arrow1.transform.baseVal.getItem(0);V.setRotate(A,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(V,0);var ee=this.arrow2.transform.baseVal.getItem(0);ee.setRotate(A+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(ee,0)}},g.prototype.setArrowType=function(A){this.arrowType=A,this.adjustVisual(),this.stateChanged()},Object.defineProperty(g.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),g.prototype.getState=function(){var A=Object.assign({arrowType:this.arrowType},z.prototype.getState.call(this));return A.typeName=g.typeName,A},g.prototype.restoreState=function(A){z.prototype.restoreState.call(this,A);var V=A;this.arrowType=V.arrowType,this.createTips(),this.adjustVisual()},g.typeName="ArrowMarker",g.title="Arrow marker",g.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',g}(Ve),ne=function(z){function g(A,V,ee){var X=z.call(this,A,V,ee)||this;return X.fillColor=ee.defaultFillColor,X.strokeWidth=0,X.fillPanel=new at("Color",ee.defaultColorSet,ee.defaultFillColor),X.fillPanel.onColorChanged=X.setFillColor,X}return Ee(g,z),Object.defineProperty(g.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),g.prototype.getState=function(){var A=z.prototype.getState.call(this);return A.typeName=g.typeName,A},g.typeName="CoverMarker",g.title="Cover marker",g.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',g}(yt),ie=function(z){function g(A,V,ee,X){var ve=z.call(this,A,X||'<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 ve.opacities=[],ve.opacityBoxes=[],ve.opacities=V,ve.currentOpacity=ee,ve.setCurrentOpacity=ve.setCurrentOpacity.bind(ve),ve}return Ee(g,z),g.prototype.getUi=function(){var A=this,V=document.createElement("div");return V.style.display="flex",V.style.overflow="hidden",V.style.flexGrow="2",V.style.justifyContent="space-between",this.opacities.forEach(function(ee){var X=document.createElement("div");X.style.display="flex",X.style.alignItems="center",X.style.justifyContent="center",X.style.padding="5px",X.style.borderWidth="2px",X.style.borderStyle="solid",X.style.borderColor=ee===A.currentOpacity?A.uiStyleSettings.toolboxAccentColor:"transparent",X.addEventListener("click",function(){A.setCurrentOpacity(ee,X)}),V.appendChild(X);var ve=document.createElement("div");ve.innerText=100*ee+"%",X.appendChild(ve),A.opacityBoxes.push(X)}),V},g.prototype.setCurrentOpacity=function(A,V){var ee=this;this.currentOpacity=A,this.opacityBoxes.forEach(function(X){X.style.borderColor=X===V?ee.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},g}(vt),oe=function(z){function g(A,V,ee){var X=z.call(this,A,V,ee)||this;return X.setOpacity=X.setOpacity.bind(X),X.fillColor=ee.defaultHighlightColor,X.strokeWidth=0,X.opacity=ee.defaultHighlightOpacity,X.fillPanel=new at("Color",ee.defaultColorSet,X.fillColor),X.fillPanel.onColorChanged=X.setFillColor,X.opacityPanel=new ie("Opacity",ee.defaultOpacitySteps,X.opacity),X.opacityPanel.onOpacityChanged=X.setOpacity,X}return Ee(g,z),g.prototype.setOpacity=function(A){this.opacity=A,this.visual&&le.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(g.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),g.prototype.getState=function(){var A=z.prototype.getState.call(this);return A.typeName=g.typeName,A},g.typeName="HighlightMarker",g.title="Highlight marker",g.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>',g}(ne),ue='<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>',we=function(z){function g(A,V,ee){var X=z.call(this,A,V,ee)||this;return X.bgColor="transparent",X.tipPosition={x:0,y:0},X.tipBase1Position={x:0,y:0},X.tipBase2Position={x:0,y:0},X.tipMoving=!1,X.color=ee.defaultStrokeColor,X.bgColor=ee.defaultFillColor,X.fontFamily=ee.defaultFontFamily,X.defaultSize={x:100,y:30},X.setBgColor=X.setBgColor.bind(X),X.getTipPoints=X.getTipPoints.bind(X),X.positionTip=X.positionTip.bind(X),X.setTipPoints=X.setTipPoints.bind(X),X.colorPanel=new at("Text color",ee.defaultColorSet,X.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>'),X.colorPanel.onColorChanged=X.setColor,X.bgColorPanel=new at("Fill color",ee.defaultColorSet,X.bgColor,ue),X.bgColorPanel.onColorChanged=X.setBgColor,X.fontFamilyPanel=new De("Font",ee.defaultFontFamilies,ee.defaultFontFamily),X.fontFamilyPanel.onFontChanged=X.setFont,X.tipGrip=new Rt,X.tipGrip.visual.transform.baseVal.appendItem(le.createTransform()),X.controlBox.appendChild(X.tipGrip.visual),X}return Ee(g,z),g.prototype.ownsTarget=function(A){return z.prototype.ownsTarget.call(this,A)||this.tipGrip.ownsTarget(A)||this.tip===A},g.prototype.createTip=function(){le.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=le.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},g.prototype.pointerDown=function(A,V){this.state==="new"&&z.prototype.pointerDown.call(this,A,V),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(V)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):z.prototype.pointerDown.call(this,A,V)},g.prototype.pointerUp=function(A){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,z.prototype.pointerUp.call(this,A);else{var V=this.state==="creating";z.prototype.pointerUp.call(this,A),this.setTipPoints(V),this.positionTip()}},g.prototype.manipulate=function(A){if(this.tipMoving){var V=this.unrotatePoint(A);this.tipPosition={x:V.x-this.manipulationStartLeft,y:V.y-this.manipulationStartTop},this.positionTip()}else z.prototype.manipulate.call(this,A)},g.prototype.setBgColor=function(A){this.bgRectangle&&this.tip&&(le.setAttributes(this.bgRectangle,[["fill",A]]),le.setAttributes(this.tip,[["fill",A]])),this.bgColor=A,this.fillColorChanged(A)},g.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},g.prototype.setTipPoints=function(A){A===void 0&&(A=!1);var V=Math.min(this.height/2,15),ee=this.height/5;A&&(this.tipPosition={x:V+ee/2,y:this.height+20});var X=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?X<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(ee=this.width/5,V=Math.min(this.width/2,15),this.tipBase1Position={x:V,y:0},this.tipBase2Position={x:V+ee,y:0}):(this.tipBase1Position={x:0,y:V},this.tipBase2Position={x:0,y:V+ee}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?X<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(ee=this.width/5,V=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-V-ee,y:0},this.tipBase2Position={x:this.width-V,y:0}):(this.tipBase1Position={x:this.width,y:V},this.tipBase2Position={x:this.width,y:V+ee}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?X<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(ee=this.width/5,V=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-V-ee,y:this.height},this.tipBase2Position={x:this.width-V,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-V-ee},this.tipBase2Position={x:this.width,y:this.height-V}):X<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(ee=this.width/5,V=Math.min(this.width/2,15),this.tipBase1Position={x:V,y:this.height},this.tipBase2Position={x:V+ee,y:this.height}):(this.tipBase1Position={x:0,y:this.height-V},this.tipBase2Position={x:0,y:this.height-V-ee})},g.prototype.resize=function(A){z.prototype.resize.call(this,A),this.positionTip()},g.prototype.positionTip=function(){le.setAttributes(this.tip,[["points",this.getTipPoints()]]);var A=this.tipGrip.visual.transform.baseVal.getItem(0);A.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(A,0)},Object.defineProperty(g.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),g.prototype.select=function(){this.positionTip(),z.prototype.select.call(this)},g.prototype.getState=function(){var A=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},z.prototype.getState.call(this));return A.typeName=g.typeName,A},g.prototype.restoreState=function(A){var V=A;this.bgColor=V.bgColor,this.tipPosition=V.tipPosition,z.prototype.restoreState.call(this,A),this.createTip(),this.setTipPoints()},g.prototype.scale=function(A,V){z.prototype.scale.call(this,A,V),this.tipPosition={x:this.tipPosition.x*A,y:this.tipPosition.y*V},this.positionTip()},g.typeName="CalloutMarker",g.title="Callout marker",g.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>',g}(We),ke=function(z){function g(A,V,ee){var X=z.call(this,A,V,ee)||this;return X.fillColor="transparent",X.strokeColor="transparent",X.strokeWidth=0,X.strokeDasharray="",X.opacity=1,X.strokeColor=ee.defaultColor,X.strokeWidth=ee.defaultStrokeWidth,X.strokeDasharray=ee.defaultStrokeDasharray,X.fillColor=ee.defaultFillColor,X.setStrokeColor=X.setStrokeColor.bind(X),X.setFillColor=X.setFillColor.bind(X),X.setStrokeWidth=X.setStrokeWidth.bind(X),X.setStrokeDasharray=X.setStrokeDasharray.bind(X),X.setOpacity=X.setOpacity.bind(X),X.createVisual=X.createVisual.bind(X),X.strokePanel=new at("Line color",fe(ee.defaultColorSet,["transparent"]),ee.defaultColor),X.strokePanel.onColorChanged=X.setStrokeColor,X.fillPanel=new at("Fill color",fe(ee.defaultColorSet,["transparent"]),X.fillColor,ue),X.fillPanel.onColorChanged=X.setFillColor,X.strokeWidthPanel=new wt("Line width",ee.defaultStrokeWidths,ee.defaultStrokeWidth),X.strokeWidthPanel.onWidthChanged=X.setStrokeWidth,X.strokeStylePanel=new Et("Line style",ee.defaultStrokeDasharrays,ee.defaultStrokeDasharray),X.strokeStylePanel.onStyleChanged=X.setStrokeDasharray,X.opacityPanel=new ie("Opacity",ee.defaultOpacitySteps,X.opacity),X.opacityPanel.onOpacityChanged=X.setOpacity,X}return Ee(g,z),g.prototype.ownsTarget=function(A){return!(!z.prototype.ownsTarget.call(this,A)&&A!==this.visual)},g.prototype.createVisual=function(){this.visual=le.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)},g.prototype.pointerDown=function(A,V){z.prototype.pointerDown.call(this,A,V),this.state==="new"&&(this.createVisual(),this.moveVisual(A),this._state="creating")},g.prototype.manipulate=function(A){z.prototype.manipulate.call(this,A)},g.prototype.resize=function(A){z.prototype.resize.call(this,A),this.setSize()},g.prototype.setSize=function(){z.prototype.setSize.call(this),le.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},g.prototype.pointerUp=function(A){z.prototype.pointerUp.call(this,A),this.setSize()},g.prototype.setStrokeColor=function(A){this.strokeColor=A,this.visual&&le.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(A),this.stateChanged()},g.prototype.setFillColor=function(A){this.fillColor=A,this.visual&&le.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(A),this.stateChanged()},g.prototype.setStrokeWidth=function(A){this.strokeWidth=A,this.visual&&le.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},g.prototype.setStrokeDasharray=function(A){this.strokeDasharray=A,this.visual&&le.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},g.prototype.setOpacity=function(A){this.opacity=A,this.visual&&le.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(g.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),g.prototype.getState=function(){var A=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},z.prototype.getState.call(this));return A.typeName=g.typeName,A},g.prototype.restoreState=function(A){var V=A;this.fillColor=V.fillColor,this.strokeColor=V.strokeColor,this.strokeWidth=V.strokeWidth,this.strokeDasharray=V.strokeDasharray,this.opacity=V.opacity,this.createVisual(),z.prototype.restoreState.call(this,A),this.setSize()},g.prototype.scale=function(A,V){z.prototype.scale.call(this,A,V),this.setSize()},g.typeName="EllipseMarker",g.title="Ellipse marker",g.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>',g}(xt),Je=function(z){function g(A,V,ee){return z.call(this,A,V,ee)||this}return Ee(g,z),Object.defineProperty(g.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),g.prototype.ownsTarget=function(A){return!(!z.prototype.ownsTarget.call(this,A)&&A!==this.tip1&&A!==this.tip2)},g.prototype.createTips=function(){this.tip1=le.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(le.createTransform()),this.visual.appendChild(this.tip1),this.tip2=le.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(le.createTransform()),this.visual.appendChild(this.tip2)},g.prototype.pointerDown=function(A,V){z.prototype.pointerDown.call(this,A,V),this.state==="creating"&&this.createTips()},g.prototype.adjustVisual=function(){if(z.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(le.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()]]),le.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 A=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),V=this.tip1.transform.baseVal.getItem(0);V.setRotate(A,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(V,0);var ee=this.tip2.transform.baseVal.getItem(0);ee.setRotate(A+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(ee,0)}},Object.defineProperty(g.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),g.prototype.getState=function(){var A=z.prototype.getState.call(this);return A.typeName=g.typeName,A},g.prototype.restoreState=function(A){z.prototype.restoreState.call(this,A),this.createTips(),this.adjustVisual()},g.typeName="MeasurementMarker",g.title="Measurement marker",g.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>',g}(Ve),bt=function(z){function g(A,V,ee){var X=z.call(this,A,V,ee)||this;return X.strokePanel.colors=ee.defaultColorSet,X.fillColor="transparent",X}return Ee(g,z),Object.defineProperty(g.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),g.prototype.getState=function(){var A=z.prototype.getState.call(this);return A.typeName=g.typeName,A},g.typeName="EllipseFrameMarker",g.title="Ellipse frame marker",g.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>',g}(ke),It=function(){function z(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(z.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),z.prototype.addUndoStep=function(g){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(g)||(this.undoStack.push(g),JSON.stringify(this.lastRedoStep)!==JSON.stringify(g)&&this.redoStack.splice(0,this.redoStack.length))},z.prototype.replaceLastUndoStep=function(g){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=g)},z.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},z.prototype.undo=function(){if(this.undoStack.length>1){var g=this.undoStack.pop();return g!==void 0&&this.redoStack.push(g),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},z.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},z}(),Ge=function(z){function g(A,V,ee){var X=z.call(this,A,V,ee)||this;return X.strokeColor="transparent",X.strokeWidth=0,X.strokeDasharray="",X.curveX=0,X.curveY=0,X.manipulationStartCurveX=0,X.manipulationStartCurveY=0,X.setStrokeColor=X.setStrokeColor.bind(X),X.setStrokeWidth=X.setStrokeWidth.bind(X),X.setStrokeDasharray=X.setStrokeDasharray.bind(X),X.positionGrips=X.positionGrips.bind(X),X.addControlGrips=X.addControlGrips.bind(X),X.adjustVisual=X.adjustVisual.bind(X),X.setupControlBox=X.setupControlBox.bind(X),X.resize=X.resize.bind(X),X.strokeColor=ee.defaultColor,X.strokeWidth=ee.defaultStrokeWidth,X.strokeDasharray=ee.defaultStrokeDasharray,X.strokePanel=new at("Line color",ee.defaultColorSet,ee.defaultColor),X.strokePanel.onColorChanged=X.setStrokeColor,X.strokeWidthPanel=new wt("Line width",ee.defaultStrokeWidths,ee.defaultStrokeWidth),X.strokeWidthPanel.onWidthChanged=X.setStrokeWidth,X.strokeStylePanel=new Et("Line style",ee.defaultStrokeDasharrays,ee.defaultStrokeDasharray),X.strokeStylePanel.onStyleChanged=X.setStrokeDasharray,X}return Ee(g,z),g.prototype.ownsTarget=function(A){return!(!z.prototype.ownsTarget.call(this,A)&&A!==this.visual&&A!==this.selectorCurve&&A!==this.visibleCurve&&!this.curveGrip.ownsTarget(A))},g.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},g.prototype.createVisual=function(){this.visual=le.createGroup(),this.selectorCurve=le.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=le.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)},g.prototype.pointerDown=function(A,V){z.prototype.pointerDown.call(this,A,V),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=A.x,this.curveY=A.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(V)&&(this.activeGrip=this.curveGrip,this._state="resize")},g.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),le.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),le.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),le.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},g.prototype.setupControlBox=function(){z.prototype.setupControlBox.call(this),this.curveControlLine1=le.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=le.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)},g.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,z.prototype.addControlGrips.call(this)},g.prototype.positionGrips=function(){z.prototype.positionGrips.call(this);var A=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-A/2,this.curveY-A/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()))},g.prototype.manipulate=function(A){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+A.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+A.y-this.manipulationStartY),z.prototype.manipulate.call(this,A)},g.prototype.resize=function(A){this.activeGrip===this.curveGrip&&(this.curveX=A.x,this.curveY=A.y),z.prototype.resize.call(this,A),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},g.prototype.setStrokeColor=function(A){this.strokeColor=A,this.adjustVisual(),this.colorChanged(A)},g.prototype.setStrokeWidth=function(A){this.strokeWidth=A,this.adjustVisual()},g.prototype.setStrokeDasharray=function(A){this.strokeDasharray=A,this.adjustVisual()},g.prototype.scale=function(A,V){this.curveX=this.curveX*A,this.curveY=this.curveY*V,z.prototype.scale.call(this,A,V)},Object.defineProperty(g.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),g.prototype.getState=function(){var A=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},z.prototype.getState.call(this));return A.typeName=g.typeName,A},g.prototype.restoreState=function(A){z.prototype.restoreState.call(this,A);var V=A;this.strokeColor=V.strokeColor,this.strokeWidth=V.strokeWidth,this.strokeDasharray=V.strokeDasharray,this.curveX=V.curveX,this.curveY=V.curveY,this.createVisual(),this.adjustVisual()},g.typeName="CurveMarker",g.title="Curve marker",g.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>',g}(Ke),it=function(){function z(g,A){A===void 0&&(A=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=g,this.cancelable=A}return Object.defineProperty(z.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),z.prototype.preventDefault=function(){this._defaultPrevented=!0},z}(),Be=function(z){function g(A,V,ee){var X=z.call(this,A,!1)||this;return X.dataUrl=V,X.state=ee,X}return Ee(g,z),g}(it),Ue=function(z){function g(A,V,ee){ee===void 0&&(ee=!1);var X=z.call(this,A,ee)||this;return X.marker=V,X}return Ee(g,z),g}(it),Re=function(){function z(){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 z.prototype.addEventListener=function(g,A){this[g].push(A)},z.prototype.removeEventListener=function(g,A){var V=this[g].indexOf(A);V>-1&&this[g].splice(V,1)},z}(),se=function(){function z(g){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new xe,this._isOpen=!1,this.undoRedoManager=new It,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 Re,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=z.instanceCounter++,this.styles=new rt(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=g,this.targetRoot=document.body,this.width=g.clientWidth,this.height=g.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(z.prototype,"ALL_MARKER_TYPES",{get:function(){return[Se,ge,ce,We,bt,ke,oe,we,Je,ne,Ve,Ge]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[Se,ge,ce,We,ke,oe,we]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"BASIC_MARKER_TYPES",{get:function(){return[Se,ge,ce,We,oe]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(g){var A=this;this._availableMarkerTypes.splice(0),g.forEach(function(V){if(typeof V=="string"){var ee=A.ALL_MARKER_TYPES.find(function(X){return X.typeName===V});ee!==void 0&&A._availableMarkerTypes.push(ee)}else A._availableMarkerTypes.push(V)})},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(g){this._zoomLevel=g,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(z.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),z.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),Me.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},z.prototype.show=function(){var g=this;this.styles.styleSheetRoot===void 0&&ut.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=ut.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(A){return A(new it(g))})},z.prototype.render=function(){return Oe(this,void 0,void 0,function(){var g;return _e(this,function(A){switch(A.label){case 0:return this.setCurrentMarker(),(g=new ot).naturalSize=this.renderAtNaturalSize,g.imageType=this.renderImageType,g.imageQuality=this.renderImageQuality,g.markersOnly=this.renderMarkersOnly,g.width=this.renderWidth,g.height=this.renderHeight,[4,g.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return A.sent(),[4,g.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,A.sent()]}})})},z.prototype.close=function(g){var A=this;if(g===void 0&&(g=!1),this.isOpen){var V=!1;g||this.eventListeners.beforeclose.forEach(function(ee){var X=new it(A,!0);ee(X),X.defaultPrevented&&(V=!0)}),V||(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(ee){return ee(new it(A))}),this.detachEvents(),this._isOpen=!1)}},z.prototype.addMarkersToToolbar=function(){for(var g,A=[],V=0;V<arguments.length;V++)A[V]=arguments[V];(g=this._availableMarkerTypes).push.apply(g,A)},z.prototype.addRenderEventListener=function(g){this.addEventListener("render",function(A){g(A.dataUrl,A.state)})},z.prototype.removeRenderEventListener=function(g){},z.prototype.addCloseEventListener=function(g){this.addEventListener("close",function(){g()})},z.prototype.removeCloseEventListener=function(g){},z.prototype.setupResizeObserver=function(){var g=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){g.resize(g.target.clientWidth,g.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return g.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},z.prototype.onPopupTargetResize=function(){var g=1*this.target.clientWidth/this.target.clientHeight,A=this.editorCanvas.clientWidth/g>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*g:this.editorCanvas.clientWidth,V=A<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/g;this.resize(A,V)},z.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},z.prototype.resize=function(g,A){this._isResizing=!0;var V=g/this.imageWidth,ee=A/this.imageHeight;this.imageWidth=Math.round(g),this.imageHeight=Math.round(A),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(V,ee),this._isResizing=!1},z.prototype.scaleMarkers=function(g,A){var V,ee=this;this._currentMarker&&this._currentMarker instanceof We?this._currentMarker.scale(g,A):(V=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(X){X!==ee._currentMarker&&X.scale(g,A)}),V!==void 0&&this.setCurrentMarker(V)},z.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"},z.prototype.setTopLeft=function(){var g=this.editingTarget.getBoundingClientRect(),A=this.editorCanvas.getBoundingClientRect();this.left=g.left-A.left,this.top=g.top-A.top},z.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)},z.prototype.addDefs=function(){for(var g,A=[],V=0;V<arguments.length;V++)A[V]=arguments[V];this.defs=le.createDefs(),this.addDefsToImage(),(g=this.defs).append.apply(g,A)},z.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},z.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)},z.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},z.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},z.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)},z.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},z.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)},z.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 g=document.createElement("a");g.href="https://markerjs.com/",g.target="_blank",g.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>',g.title="Powered by marker.js",g.style.display="grid",g.style.alignItems="center",g.style.justifyItems="center",g.style.padding="3px",g.style.width="20px",g.style.height="20px",this.logoUI.appendChild(g),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},z.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")},z.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"},z.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},z.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 g=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=g+"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 $e(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 ct(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},z.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},z.prototype.removeMarker=function(g){this.markerImage.removeChild(g.container),this.markers.indexOf(g)>-1&&this.markers.splice(this.markers.indexOf(g),1),g.dispose()},z.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())},z.prototype.toolbarButtonClicked=function(g,A){if(g==="marker"&&A!==void 0)this.createNewMarker(A);else if(g==="action")switch(A){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()}},z.prototype.deleteSelectedMarker=function(){var g=this;if(this._currentMarker!==void 0){var A=!1;if(this.eventListeners.markerbeforedelete.forEach(function(ee){var X=new Ue(g,g._currentMarker,!0);ee(X),X.defaultPrevented&&(A=!0)}),!A){var V=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(ee){return ee(new Ue(g,V))})}}},z.prototype.clear=function(){var g=this,A=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ve){var Xe=new Ue(g,void 0,!0);ve(Xe),Xe.defaultPrevented&&(A=!0)}),!A)){this.setCurrentMarker();for(var V=function(ve){var Xe=ee.markers[ve];ee.setCurrentMarker(ee.markers[ve]),ee._currentMarker.dispose(),ee.markerImage.removeChild(ee._currentMarker.container),ee.markers.splice(ee.markers.indexOf(ee._currentMarker),1),ee.eventListeners.markerdelete.forEach(function(Le){return Le(new Ue(g,Xe))})},ee=this,X=this.markers.length-1;X>=0;X--)V(X);this.addUndoStep()}},Object.defineProperty(z.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),z.prototype.showNotesEditor=function(){var g;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=(g=this._currentMarker.notes)!==null&&g!==void 0?g:"",this.overlayContainer.appendChild(this.notesArea))},z.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)},z.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},z.prototype.addUndoStep=function(){var g=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var A=this.getState(),V=this.undoRedoManager.getLastUndoStep();if(!V||V.width===A.width&&V.height===A.height){var ee=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(A),ee<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(X){return X(new it(g))})}else this.undoRedoManager.replaceLastUndoStep(A),this.eventListeners.statechange.forEach(function(X){return X(new it(g))})}},z.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},z.prototype.undoStep=function(){var g=this,A=this.undoRedoManager.undo();A!==void 0&&(this.restoreState(A),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(V){return V(new it(g))}))},z.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},z.prototype.redoStep=function(){var g=this,A=this.undoRedoManager.redo();A!==void 0&&(this.restoreState(A),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(V){return V(new it(g))}))},z.prototype.stepZoom=function(){var g=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=g<this.zoomSteps.length-1?this.zoomSteps[g+1]:this.zoomSteps[0]},z.prototype.panTo=function(g){this.contentDiv.scrollBy({left:this.prevPanPoint.x-g.x,top:this.prevPanPoint.y-g.y}),this.prevPanPoint=g},z.prototype.startRenderAndClose=function(){return Oe(this,void 0,void 0,function(){var g,A,V=this;return _e(this,function(ee){switch(ee.label){case 0:return[4,this.render()];case 1:return g=ee.sent(),A=this.getState(),this.eventListeners.render.forEach(function(X){return X(new Be(V,g,A))}),this.close(!0),[2]}})})},z.prototype.getState=function(g){g===!0&&this.setCurrentMarker();var A={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(V){return A.markers.push(V.getState())}),A},z.prototype.restoreState=function(g){var A=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);g.markers.forEach(function(V){var ee=A._availableMarkerTypes.find(function(ve){return ve.typeName===V.typeName});if(ee!==void 0){var X=A.addNewMarker(ee);X.restoreState(V),A.markers.push(X)}}),g.width&&g.height&&(g.width!==this.imageWidth||g.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/g.width,this.imageHeight/g.height),this.eventListeners.restorestate.forEach(function(V){return V(new it(A))})},z.prototype.addNewMarker=function(g){var A=le.createGroup();return this.markerImage.appendChild(A),new g(A,this.overlayContainer,this.settings)},z.prototype.createNewMarker=function(g){var A,V=this;(A=typeof g=="string"?this._availableMarkerTypes.find(function(ee){return ee.typeName===g}):g)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(A),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(A.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(ee){return ee(new Ue(V,V._currentMarker))}))},z.prototype.markerCreated=function(g){var A=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(g),this.setCurrentMarker(g),g instanceof ge&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(ge):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(V){return V(new Ue(A,A._currentMarker))})},z.prototype.colorChanged=function(g){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=g,this.settings.defaultStrokeColor=g)},z.prototype.fillColorChanged=function(g){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=g)},z.prototype.markerStateChanged=function(g){var A=this;this.eventListeners.markerchange.forEach(function(V){return V(new Ue(A,g))})},z.prototype.setCurrentMarker=function(g){var A=this;this._currentMarker!==g&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(V){return V(new Ue(A,A._currentMarker))})),this._currentMarker=g,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(V){return V(new Ue(A,A._currentMarker))}))},z.prototype.onPointerDown=function(g){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||g.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var A=this.markers.find(function(V){return V.ownsTarget(g.target)});A!==void 0?(this.setCurrentMarker(A),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(g.clientX,g.clientY),g.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:g.clientX,y:g.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(g.clientX,g.clientY))},z.prototype.onDblClick=function(g){if(this._isFocused||this.focus(),this.mode==="select"){var A=this.markers.find(function(V){return V.ownsTarget(g.target)});A!==void 0&&A!==this._currentMarker&&this.setCurrentMarker(A),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(g.clientX,g.clientY),g.target):this.setCurrentMarker()}},z.prototype.onPointerMove=function(g){this.touchPoints!==1&&g.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||g.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(g.clientX,g.clientY)):this.zoomLevel>1&&this.panTo({x:g.clientX,y:g.clientY}))},z.prototype.onPointerUp=function(g){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(g.clientX,g.clientY)),this.isDragging=!1,this.addUndoStep()},z.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},z.prototype.onKeyUp=function(g){this._currentMarker===void 0||this.notesArea!==void 0||g.key!=="Delete"&&g.key!=="Backspace"||this.deleteSelectedMarker()},z.prototype.clientToLocalCoordinates=function(g,A){var V=this.markerImage.getBoundingClientRect();return{x:(g-V.left)/this.zoomLevel,y:(A-V.top)/this.zoomLevel}},z.prototype.onWindowResize=function(){this.positionUI()},z.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var g=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=g+"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()},z.prototype.addLicenseKey=function(g){Me.addKey(g)},z.prototype.addEventListener=function(g,A){this.eventListeners.addEventListener(g,A)},z.prototype.removeEventListener=function(g,A){this.eventListeners.removeEventListener(g,A)},z.prototype.renderState=function(g){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(g),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(z.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),z.prototype.focus=function(){var g=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(A){return A(new it(g))}))},z.prototype.blur=function(){var g=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(A){return A(new it(g))}))},z.instanceCounter=0,z}();/* **********************************
|
|
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 pe=function(z,g){return(pe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,V){A.__proto__=V}||function(A,V){for(var ee in V)Object.prototype.hasOwnProperty.call(V,ee)&&(A[ee]=V[ee])})(z,g)};function je(z,g){if(typeof g!="function"&&g!==null)throw new TypeError("Class extends value "+String(g)+" is not a constructor or null");function A(){this.constructor=z}pe(z,g),z.prototype=g===null?Object.create(g):(A.prototype=g.prototype,new A)}function Ie(z,g,A,V){return new(A||(A=Promise))(function(ee,X){function ve(At){try{Le(V.next(At))}catch(Qe){X(Qe)}}function Xe(At){try{Le(V.throw(At))}catch(Qe){X(Qe)}}function Le(At){var Qe;At.done?ee(At.value):(Qe=At.value,Qe instanceof A?Qe:new A(function(Bt){Bt(Qe)})).then(ve,Xe)}Le((V=V.apply(z,g||[])).next())})}function lt(z,g){var A,V,ee,X,ve={label:0,sent:function(){if(1&ee[0])throw ee[1];return ee[1]},trys:[],ops:[]};return X={next:Xe(0),throw:Xe(1),return:Xe(2)},typeof Symbol=="function"&&(X[Symbol.iterator]=function(){return this}),X;function Xe(Le){return function(At){return function(Qe){if(A)throw new TypeError("Generator is already executing.");for(;ve;)try{if(A=1,V&&(ee=2&Qe[0]?V.return:Qe[0]?V.throw||((ee=V.return)&&ee.call(V),0):V.next)&&!(ee=ee.call(V,Qe[1])).done)return ee;switch(V=0,ee&&(Qe=[2&Qe[0],ee.value]),Qe[0]){case 0:case 1:ee=Qe;break;case 4:return ve.label++,{value:Qe[1],done:!1};case 5:ve.label++,V=Qe[1],Qe=[0];continue;case 7:Qe=ve.ops.pop(),ve.trys.pop();continue;default:if(!(ee=ve.trys,(ee=ee.length>0&&ee[ee.length-1])||Qe[0]!==6&&Qe[0]!==2)){ve=0;continue}if(Qe[0]===3&&(!ee||Qe[1]>ee[0]&&Qe[1]<ee[3])){ve.label=Qe[1];break}if(Qe[0]===6&&ve.label<ee[1]){ve.label=ee[1],ee=Qe;break}if(ee&&ve.label<ee[2]){ve.label=ee[2],ve.ops.push(Qe);break}ee[2]&&ve.ops.pop(),ve.trys.pop();continue}Qe=g.call(z,ve)}catch(Bt){Qe=[6,Bt],V=0}finally{A=ee=0}if(5&Qe[0])throw Qe[1];return{value:Qe[0]?Qe[1]:void 0,done:!0}}([Le,At])}}}var st=function(){function z(){}return z.addKey=function(g){z.key=g},Object.defineProperty(z,"isLicensed",{get:function(){return!!z.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(z.key)},enumerable:!1,configurable:!0}),z}(),Ae=function(){function z(){}return z.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},z.setAttributes=function(g,A){for(var V=0,ee=A;V<ee.length;V++){var X=ee[V],ve=X[0],Xe=X[1];g.setAttribute(ve,Xe)}},z.createRect=function(g,A,V){var ee=document.createElementNS("http://www.w3.org/2000/svg","rect");return ee.setAttribute("width",g.toString()),ee.setAttribute("height",A.toString()),V&&z.setAttributes(ee,V),ee},z.createLine=function(g,A,V,ee,X){var ve=document.createElementNS("http://www.w3.org/2000/svg","line");return ve.setAttribute("x1",g.toString()),ve.setAttribute("y1",A.toString()),ve.setAttribute("x2",V.toString()),ve.setAttribute("y2",ee.toString()),X&&z.setAttributes(ve,X),ve},z.createPolygon=function(g,A){var V=document.createElementNS("http://www.w3.org/2000/svg","polygon");return V.setAttribute("points",g),A&&z.setAttributes(V,A),V},z.createCircle=function(g,A){var V=document.createElementNS("http://www.w3.org/2000/svg","circle");return V.setAttribute("cx",(g/2).toString()),V.setAttribute("cy",(g/2).toString()),V.setAttribute("r",g.toString()),A&&z.setAttributes(V,A),V},z.createEllipse=function(g,A,V){var ee=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return ee.setAttribute("cx",(g/2).toString()),ee.setAttribute("cy",(A/2).toString()),ee.setAttribute("rx",(g/2).toString()),ee.setAttribute("ry",(A/2).toString()),V&&z.setAttributes(ee,V),ee},z.createGroup=function(g){var A=document.createElementNS("http://www.w3.org/2000/svg","g");return g&&z.setAttributes(A,g),A},z.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},z.createMarker=function(g,A,V,ee,X,ve,Xe){var Le=document.createElementNS("http://www.w3.org/2000/svg","marker");return z.setAttributes(Le,[["id",g],["orient",A],["markerWidth",V.toString()],["markerHeight",ee.toString()],["refX",X.toString()],["refY",ve.toString()]]),Le.appendChild(Xe),Le},z.createText=function(g){var A=document.createElementNS("http://www.w3.org/2000/svg","text");return A.setAttribute("x","0"),A.setAttribute("y","0"),g&&z.setAttributes(A,g),A},z.createTSpan=function(g,A){var V=document.createElementNS("http://www.w3.org/2000/svg","tspan");return V.textContent=g,A&&z.setAttributes(V,A),V},z.createImage=function(g){var A=document.createElementNS("http://www.w3.org/2000/svg","image");return g&&z.setAttributes(A,g),A},z.createPoint=function(g,A){var V=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return V.x=g,V.y=A,V},z.createPath=function(g,A){var V=document.createElementNS("http://www.w3.org/2000/svg","path");return V.setAttribute("d",g),A&&z.setAttributes(V,A),V},z.createElement=function(g,A){var V=document.createElementNS("http://www.w3.org/2000/svg",g);return A&&z.setAttributes(V,A),V},z.getHollowRectanglePath=function(g,A,V,ee,X,ve,Xe,Le){return"M"+g+","+A+"V"+(A+ee)+"H"+(g+V)+"V"+A+"H"+X+"V"+ve+"H"+(X+Xe)+"V"+(ve+Le)+"H"+X+"V"+A+"Z"},z}(),qe=function(){function z(g){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+g+"_"}return Object.defineProperty(z.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(z.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(z.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),z.prototype.addClass=function(g){return this.styleSheet===void 0&&this.addStyleSheet(),g.name=""+this.classNamePrefix+g.localName,this.classes.push(g),this.styleSheet.sheet.insertRule("."+g.name+" {"+g.style+"}",this.styleSheet.sheet.cssRules.length),g},z.prototype.addRule=function(g){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(g),this.styleSheet.sheet.insertRule(g.selector+" {"+g.style+"}",this.styleSheet.sheet.cssRules.length)},z.prototype.addStyleSheet=function(){var g;this.styleSheet=document.createElement("style"),((g=this.styleSheetRoot)!==null&&g!==void 0?g:document.head).appendChild(this.styleSheet),this.addRule(new pt("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new pt("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new pt("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new mt("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new mt("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},z.prototype.removeStyleSheet=function(){var g;this.styleSheet&&(((g=this.styleSheetRoot)!==null&&g!==void 0?g:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},z}(),pt=function(z,g){this.selector=z,this.style=g},mt=function(z,g){this.localName=z,this.style=g},Lt=function(){function z(){this.blocks=[],this.display=""}return z.prototype.addButtonBlock=function(g){g.className=this.blockClassName,g.buttonClassName=this.buttonClassName,g.buttonColorsClassName=this.buttonColorsClassName,g.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(g)},z.prototype.addElementBlock=function(g){g.className===void 0&&(g.className=this.blockClassName),this.blocks.push(g)},z.prototype.getUI=function(){var g=document.createElement("div");return g.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,g.style.display=this.display,this.blocks.forEach(function(A){return g.appendChild(A.getUI())}),g},z}(),mn=function(){function z(){}return z.prototype.getUI=function(){var g=document.createElement("div");if(g.className=this.className,this.minWidth!==void 0&&(g.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":g.style.justifyContent="flex-start";break;case"center":g.style.justifyContent="center";break;case"end":g.style.justifyContent="flex-end"}return g.style.whiteSpace="nowrap",g},z}(),hn=function(z){function g(){var A=z!==null&&z.apply(this,arguments)||this;return A.buttons=[],A}return je(g,z),g.prototype.addButton=function(A){A.className=this.buttonClassName,A.colorsClassName=this.buttonColorsClassName,A.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(A)},g.prototype.getUI=function(){var A=z.prototype.getUI.call(this);return this.buttons.forEach(function(V){return A.appendChild(V.getUI())}),A},g}(mn),en=function(){function z(g,A){this._isActive=!1,this._isHidden=!1,this._icon=g,this.title=A,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(z.prototype,"icon",{get:function(){return this._icon},set:function(g){this._icon=g,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isActive",{get:function(){return this._isActive},set:function(g){this._isActive=g,this.adjustClassName()},enumerable:!1,configurable:!0}),z.prototype.getUI=function(){var g=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 g.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},z.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,"")))},z.prototype.hide=function(){this._isHidden=!0},z}(),Dt=function(z){function g(){var A=z!==null&&z.apply(this,arguments)||this;return A.elements=[],A}return je(g,z),g.prototype.addElement=function(A){this.elements.push(A)},g.prototype.getUI=function(){var A=z.prototype.getUI.call(this);return this.elements.forEach(function(V){return A.appendChild(V)}),A},g}(mn),xn=function(){function z(g,A){this.horizontal=g,this.vertical=A}return Object.defineProperty(z.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),z.prototype.getVerticalLength=function(g){return g/this.ratio},z.prototype.getHorizontalLength=function(g){return g*this.ratio},z}(),He=function(){function z(){}return z.getIcon=function(g,A){if(g>0&&A>0){var V=new xn(g,A),ee=V.ratio>=1?20:V.getHorizontalLength(20),X=V.ratio<1?20:V.getVerticalLength(20),ve=document.createElementNS("http://www.w3.org/2000/svg","svg");ve.setAttribute("xmlns","http://www.w3.org/2000/svg"),ve.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ve);var Xe=Ae.createDefs();ve.appendChild(Xe);var Le=Ae.createElement("clipPath",[["id","text-bg-clip"]]);Xe.appendChild(Le);var At=Ae.createPath(Ae.getHollowRectanglePath((24-ee)/2,(24-X)/2,ee,X,(24-ee)/2+2,(24-X)/2+2,ee-4,X-4));ve.appendChild(At);var Qe=Ae.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Qe.appendChild(Ae.createTSpan(g+":"+A)),ve.appendChild(Qe);var Bt=Qe.getBBox();Ae.setAttributes(Qe,[["x",((24-Bt.width)/2).toString()],["y",((24-Bt.height)/2-Bt.y).toString()]]);var Ft=Ae.createPath(Ae.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Bt.width))/2,(24-Math.ceil(Bt.height))/2,Math.ceil(Bt.width),Math.ceil(Bt.height)));return Le.appendChild(Ft),Ae.setAttributes(At,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ve),ve.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>'},z}(),ht=function(z){function g(A,V,ee){var X=z.call(this,A,V)||this;return X.isDropdownOpen=!1,X.onClick=X.dropdownButtonClicked,X.dropdownButtons=ee,X}return je(g,z),g.prototype.setupDropdown=function(){var A=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(V){V.className=A.className,V.colorsClassName=A.colorsClassName,A.dropdownBlock.appendChild(V.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},g.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},g.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},g.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},g.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},g.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},g}(en),St=function(){function z(g,A){this.GRIP_SIZE=10,this.color=g,this.fillColor=A,this.visual=Ae.createGroup(),this.visual.appendChild(Ae.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Ae.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return z.prototype.ownsTarget=function(g){return g===this.visual||g===this.visual.childNodes[0]||g===this.visual.childNodes[1]},z.prototype.setCenter=function(g,A){this.visual.childNodes.forEach(function(V){return Ae.setAttributes(V,[["cx",g.toString()],["cy",A.toString()]])})},z}(),Xt=function(){function z(g,A,V,ee){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=g,this.canvasHeight=A,this.margin=V,this.container=ee,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(z.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(g){this._aspectRatio=g,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(g){this._isGridVisible=g,this.gridContainer&&Ae.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(g){this._zoomFactor=g,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),z.prototype.open=function(){var g=this;this.cropShadeElement=Ae.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=Ae.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var A=0;A<this.numberOfGridLines;A++)this.horizontalGridLines.push(Ae.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(Ae.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(V){return g.gridContainer.appendChild(V)}),this.verticalGridLines.forEach(function(V){return g.gridContainer.appendChild(V)}),this.cropRectElement=Ae.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new St(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new St(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new St(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new St(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},z.prototype.setCropRectangle=function(g){this.cropRect=g;var A=Object.assign({},this.cropRect);this.zoomFactor!==1&&(A.width=this.cropRect.width*this.zoomFactor,A.height=this.cropRect.height*this.zoomFactor,A.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-A.width/2,A.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-A.height/2),Ae.setAttributes(this.cropRectElement,[["x",A.x.toString()],["y",A.y.toString()],["width",A.width.toString()],["height",A.height.toString()]]);var V=A.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(X,ve){var Xe=A.y+V*(ve+1);Ae.setAttributes(X,[["x1",""+A.x],["y1",""+Xe],["x2",""+(A.x+A.width)],["y2",""+Xe]])});var ee=A.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(X,ve){var Xe=A.x+ee*(ve+1);Ae.setAttributes(X,[["x1",""+Xe],["y1",""+A.y],["x2",""+Xe],["y2",""+(A.y+A.height)]])}),Ae.setAttributes(this.cropShadeElement,[["d",Ae.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,A.x,A.y,A.width,A.height)]]),this.topLeftGrip.setCenter(A.x,A.y),this.topRightGrip.setCenter(A.x+A.width,A.y),this.bottomLeftGrip.setCenter(A.x,A.y+A.height),this.bottomRightGrip.setCenter(A.x+A.width,A.y+A.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},z.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)},z.prototype.clientToLocalCoordinates=function(g,A){var V=this.container.getBoundingClientRect();return{x:g-V.left+this.margin,y:A-V.top+this.margin}},z.prototype.onPointerDown=function(g){this.container.setPointerCapture(g.pointerId),this.previousPoint=this.clientToLocalCoordinates(g.clientX,g.clientY),this.cropRectElement===g.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(g.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(g.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(g.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(g.target)&&(this.activeGrip=this.bottomRightGrip)},z.prototype.onPointerMove=function(g){if(this.isMoving)this.move(this.clientToLocalCoordinates(g.clientX,g.clientY));else if(this.activeGrip){var A=this.clientToLocalCoordinates(g.clientX,g.clientY);this.resize(A)}g.preventDefault()},z.prototype.onPointerUp=function(g){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(g.pointerId)},z.prototype.move=function(g){var A=g.x-this.previousPoint.x,V=g.y-this.previousPoint.y;this.zoomFactor!==1&&(A=-A/this.zoomFactor,V=-V/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+A),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+V),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=g},z.prototype.resize=function(g){var A=Object.assign({},this.cropRect),V=g.x-this.previousPoint.x,ee=g.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:A.x+V<this.margin&&(V=this.margin-A.x),A.x+=V,A.width=this.cropRect.x+this.cropRect.width-A.x;break;case this.bottomRightGrip:case this.topRightGrip:A.width+V>this.canvasWidth*this.zoomFactor&&(V=this.canvasWidth*this.zoomFactor-A.width),A.width+=V}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(A.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(V),A.height=this.aspectRatio.getVerticalLength(A.width)):(A.y+=ee,A.height=this.cropRect.y+this.cropRect.height-A.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?A.height=this.aspectRatio.getVerticalLength(A.width):A.height+=ee}A.width<10&&(A.x=this.cropRect.x,A.width=10),A.height<10&&(A.y=this.cropRect.y,A.height=10),this.previousPoint=g,A.x>=this.margin&&A.y>=this.margin&&A.x-this.margin+A.width<=this.canvasWidth&&A.y-this.margin+A.height<=this.canvasHeight&&(this.cropRect=A,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},z.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var g=this.cropRect.x+this.cropRect.width/2,A=this.cropRect.y+this.cropRect.height/2,V=this.aspectRatio.getHorizontalLength(this.cropRect.height),ee=this.aspectRatio.getVerticalLength(this.cropRect.width);V/this.canvasWidth<ee/this.canvasHeight?this.cropRect.width=V:this.cropRect.height=ee,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=g-this.cropRect.width/2,this.cropRect.y=A-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)}},z.prototype.getRescaledRect=function(g,A,V,ee,X,ve){var Xe=V/g,Le=ee/A;return{x:(X.x-ve)*Xe+ve,y:(X.y-ve)*Le+ve,width:X.width*Xe,height:X.height*Le}},z.prototype.scaleCanvas=function(g,A){var V=this.getRescaledRect(this.canvasWidth,this.canvasHeight,g,A,this.cropRect,this.margin);this.canvasWidth=g,this.canvasHeight=A,this.onCropChange&&this.onCropChange(V),this.setCropRectangle(V)},z}(),an=function(){function z(g){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=g,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(z.prototype,"angle",{get:function(){return this._angle},set:function(g){this._angle=g,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),z.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},z.prototype.onPointerDown=function(g){this.controlContainer.setPointerCapture(g.pointerId),this.isDragging=!0,this.previousPoint={x:g.clientX,y:g.clientY}},z.prototype.onPointerMove=function(g){this.isDragging&&(this.onAngleChange&&this.onAngleChange((g.clientX-this.previousPoint.x)/5),this.previousPoint.x=g.clientX)},z.prototype.onPointerUp=function(g){this.isDragging&&this.onAngleChange&&this.onAngleChange((g.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(g.pointerId)},z.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var g=this.angleLabelText.getBBox();Ae.setAttributes(this.angleLabelElement,[["x",((this.width-g.width)/2).toString()],["y",(this.height/2).toString()]])}},z.prototype.positionScaleShape=function(){if(this.scaleShape){var g=this.scaleShape.transform.baseVal.getItem(0);g.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(g,0)}},z.prototype.getVisual=function(){var g=document.createElementNS("http://www.w3.org/2000/svg","svg");g.setAttribute("xmlns","http://www.w3.org/2000/svg"),g.setAttribute("width",this.width+"px"),g.setAttribute("height",this.height+"px"),g.setAttribute("viewBox","0 0 "+this.width+" "+this.height),g.style.flexShrink="0",document.body.appendChild(g);for(var A="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,V=1;V<=this.width/5+10;V++){var ee=V%5==0?this.height/3:this.height/6;A+="h4v"+-ee+"h1v"+ee}A+="v1H0Z",this.scaleShape=Ae.createPath(A);var X=Ae.createTransform();this.scaleShape.transform.baseVal.appendItem(X),g.appendChild(this.scaleShape),this.angleLabelElement=Ae.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=Ae.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ve=Ae.createTSpan("");return ve.innerHTML="°",this.angleLabelElement.appendChild(ve),g.appendChild(this.angleLabelElement),document.body.removeChild(g),g},z}(),un=function(){function z(){this.naturalSize=!1,this.imageType="image/png"}return z.prototype.rasterize=function(g,A,V,ee,X,ve,Xe){var Le=this;return new Promise(function(At){var Qe=document.createElement("canvas");Qe.width=g.width.baseVal.value-2*ee,Qe.height=g.height.baseVal.value-2*ee;var Bt=1,Ft=1;Le.naturalSize===!0?(Bt=A.naturalWidth/(g.width.baseVal.value-2*ee)/ve,Ft=A.naturalHeight/(g.height.baseVal.value-2*ee)/Xe,Qe.width=A.naturalWidth/ve,Qe.height=A.naturalHeight/Xe):Le.width!==void 0&&Le.height!==void 0&&(Bt=Le.width/V.width,Ft=Le.height/V.height,Qe.width*=Bt,Qe.height*=Ft);var tn=Qe.getContext("2d");tn.translate(Qe.width/2,Qe.height/2),tn.rotate(X*Math.PI/180),tn.scale(ve,Xe),tn.translate(-Qe.width/2,-Qe.height/2),tn.drawImage(A,0,0,Qe.width,Qe.height);var zn=document.createElement("canvas");zn.width=V.width*Bt,zn.height=V.height*Ft,zn.getContext("2d").putImageData(tn.getImageData((V.x-ee)*Bt,(V.y-ee)*Ft,V.width*Bt,V.height*Ft),0,0),At(zn.toDataURL(Le.imageType,Le.imageQuality))})},z}(),Ye=function(){function z(g){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=z.instanceCounter++,this.styles=new qe(this.instanceNo),this.target=g,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(z.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(g){this._zoomToCropEnabled=g,g?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(g){this._isGridVisible=g,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"gridLines",{get:function(){return this._gridLines},set:function(g){this._gridLines=g,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(g){this._rotationAngle=g,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"aspectRatio",{get:function(){var g;return(g=this._aspectRatio)!==null&&g!==void 0?g:this.aspectRatios[0]},set:function(g){this._aspectRatio=g},enumerable:!1,configurable:!0}),z.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},z.prototype.show=function(){this.showUI(),this.open()},z.prototype.close=function(g){g===void 0&&(g=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),g||this.closeEventListeners.forEach(function(A){return A()}),this._isOpen=!1)},z.prototype.addRenderEventListener=function(g){this.renderEventListeners.push(g)},z.prototype.removeRenderEventListener=function(g){this.renderEventListeners.indexOf(g)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(g),1)},z.prototype.addCloseEventListener=function(g){this.closeEventListeners.push(g)},z.prototype.removeCloseEventListener=function(g){this.closeEventListeners.indexOf(g)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(g),1)},z.prototype.setupResizeObserver=function(){var g=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){g.resize(g.target.clientWidth,g.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))},z.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var g=1*this.target.clientWidth/this.target.clientHeight,A=this.contentDiv.clientWidth/g>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*g:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,V=A+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/g;this.resize(A,V)}},z.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},z.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",Ae.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},z.prototype.resize=function(g,A){this.imageWidth=Math.round(g),this.imageHeight=Math.round(A),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()},z.prototype.setEditingTarget=function(){var g=document.createElement("canvas");g.width=this.target.naturalWidth,g.height=this.target.naturalHeight,g.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var A=g.toDataURL();Ae.setAttributes(this.editingTarget,[["href",A]]),this.setEditingTargetSize()},z.prototype.setTopLeft=function(){var g=this.target.getBoundingClientRect(),A=this.editorCanvas.getBoundingClientRect();this.left=g.left-A.left-this.CANVAS_MARGIN,this.top=g.top-A.top-this.CANVAS_MARGIN},z.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=Ae.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=Ae.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=Ae.createGroup(),this.editingTargetRotationScaleContainer=Ae.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var g=Ae.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(g);var A=Ae.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(A),this.editingTargetContainer=Ae.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)},z.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},z.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=Ae.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Xt(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()},z.prototype.zoomToCrop=function(){if(this.cropRect){var g=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,A=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=g+"px "+A+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-g+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-A+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},z.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)},z.prototype.cropRectChanged=function(g){this.cropRect=g,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},z.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},z.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"},z.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},z.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 g=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,A=this.target.offsetTop>g+this.CANVAS_MARGIN?this.target.offsetTop-(g+this.CANVAS_MARGIN):0;this.coverDiv.style.top=A+"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},z.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},z.prototype.addTopToolbar=function(){var g=this;this.topToolbar=new Lt,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 A=new hn;A.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(A);var V=[];this.aspectRatios.forEach(function(Ft){var tn=new en(He.getIcon(Ft.horizontal,Ft.vertical),Ft.horizontal===0&&Ft.vertical===0?"FREE":Ft.horizontal+":"+Ft.vertical);tn.onClick=function(){return g.ratioButtonClicked(Ft)},V.push(tn)}),this.aspectRatioButton=new ht(He.getIcon(0,0),"Aspect ratio",V),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,A.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var ee=new en('<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");ee.isActive=this.isGridVisible,ee.onClick=function(){g.isGridVisible=!g.isGridVisible,ee.isActive=g.isGridVisible},A.addButton(ee);var X=new en('<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(X.isActive=this.zoomToCropEnabled,X.onClick=function(){g.zoomToCropEnabled=!g.zoomToCropEnabled,X.isActive=g.zoomToCropEnabled},A.addButton(X),!st.isLicensed){var ve=new Dt;this.topToolbar.addElementBlock(ve);var Xe=document.createElement("div");Xe.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var Le=document.createElement("a");Le.style.color="currentColor",Le.href="https://markerjs.com/products/cropro",Le.target="_blank",Le.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>',Xe.appendChild(Le),ve.addElement(Xe)}var At=new hn;At.minWidth=3*this.toolbarHeight+"px",At.contentAlign="end",this.topToolbar.addButtonBlock(At);var Qe=new en('<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");Qe.onClick=this.startRenderAndClose,At.addButton(Qe),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Qe.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Bt=new en('<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");Bt.onClick=this.close,At.addButton(Bt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Bt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},z.prototype.addBottomToolbar=function(){var g=this;this.bottomToolbar=new Lt,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 A=new hn;A.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(A);var V=new en('<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");V.onClick=this.rotateLeftButtonClicked,A.addButton(V);var ee=new en('<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");ee.onClick=this.rotateRightButtonClicked,A.addButton(ee);var X=new Dt;X.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(X),this.straightener=new an("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(At){g.rotateBy(At),g.straightener.angle=g.rotationAngle},X.addElement(this.straightener.getUI());var ve=new hn;ve.minWidth=2*this.toolbarHeight+"px",ve.contentAlign="end",this.bottomToolbar.addButtonBlock(ve);var Xe=new en('<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");Xe.onClick=this.flipHorizontallyButtonClicked,ve.addButton(Xe);var Le=new en('<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");Le.onClick=this.flipVerticallyButtonClicked,ve.addButton(Le)},z.prototype.ratioButtonClicked=function(g){this.aspectRatio=g,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},z.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=He.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},z.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new xn(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},z.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},z.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},z.prototype.restoreState=function(g){if(g){var A=this.cropLayer.getRescaledRect(g.width,g.height,this.imageWidth,this.imageHeight,g.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(A),this.cropRectChanged(A),this.flippedHorizontally=g.flippedHorizontally,this.flippedVertically=g.flippedVertically,this.applyFlip(),this.rotationAngle=g.rotationAngle,this.applyRotation()}},z.prototype.clientToLocalCoordinates=function(g,A){var V=this.cropImage.getBoundingClientRect();return{x:g-V.left,y:A-V.top}},z.prototype.onWindowResize=function(){this.positionUI()},z.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var g=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=g+"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()},z.prototype.rotateLeftButtonClicked=function(){var g=this.rotationAngle-90;this.rotationAngle%90!=0&&(g+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(g)},z.prototype.rotateRightButtonClicked=function(){var g=this.rotationAngle+90;this.rotationAngle%90!=0&&(g-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(g)},z.prototype.rotateTo=function(g){g=(g=g>180?g-360:g)<=-180?g+360:g,this.rotationAngle=g,this.applyRotation()},z.prototype.rotateBy=function(g){this.rotateTo((this.rotationAngle+g)%360)},z.prototype.applyRotation=function(){var g=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var A=this.editingTargetRotationContainer.transform.baseVal.getItem(0);A.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(A,0);var V=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/V.width,this.imageHeight/V.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=g},z.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},z.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},z.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},z.prototype.startRenderAndClose=function(){return Ie(this,void 0,void 0,function(){var g,A;return lt(this,function(V){switch(V.label){case 0:return[4,this.render()];case 1:return g=V.sent(),A=this.getState(),this.renderEventListeners.forEach(function(ee){return ee(g,A)}),this.close(!0),[2]}})})},z.prototype.render=function(){return Ie(this,void 0,void 0,function(){var g;return lt(this,function(A){switch(A.label){case 0:return(g=new un).naturalSize=this.renderAtNaturalSize,g.imageType=this.renderImageType,g.imageQuality=this.renderImageQuality,g.width=this.renderWidth,g.height=this.renderHeight,this.unzoomFromCrop(),Ae.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,g.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 A.sent(),[4,g.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,A.sent()]}})})},z.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new mt("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 mt("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new mt("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var g=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new mt("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*g)+`px;
|
|
height: `+(this.toolbarHeight-2*g)+`px;
|
|
padding: `+g+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new mt("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new mt("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new pt("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new pt("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new mt("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 mt("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new mt("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 mt("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*g)+`px;
|
|
padding: `+g+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new mt("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},z.instanceCounter=0,z}(),ft=j("8hTe"),kt=j.n(ft),vn=/<pre[^>]*>/g;function Gt(z){var g=document.createElement("div");return g.innerHTML=z,g.childNodes.length===0?"":g.childNodes[0].nodeValue}var Zt=Ce.a=function(z){var g=z.value,A=g===void 0?"":g,V=z.edit,ee=V===void 0?!1:V,X=z.className,ve=z.showTextOnly,Xe=z.showLines,Le=z.replaces,At=z.zoomImg,Qe=z.hasMask,Bt=z.style,Ft=Bt===void 0?{}:Bt,tn=z.stylesPrev,zn=tn===void 0?{}:tn,Wn=String(A),$t=Object(L.useRef)(),yn=Object(L.useRef)(),Mn=Object(L.useState)(""),bn=Object(U.a)(Mn,2),fn=bn[0],Sn=bn[1],Tn=Object(L.useState)("office"),Hn=Object(U.a)(Tn,2),Gn=Hn[0],er=Hn[1],Dn=function(){var nn=new Ye(yn.current);nn.displayMode="popup",nn.addRenderEventListener(function(){var Pn=Object(x.a)(E.a.mark(function dn(kn){var gn;return E.a.wrap(function(Un){for(;;)switch(Un.prev=Un.next){case 0:return $t.current.style.display="none",Un.next=3,Object(Te.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:kn}});case 3:gn=Un.sent,gn!=null&&gn.id&&Le(yn.current.getAttribute("src").replace(re.a.API_SERVER,""),"/api/attachments/".concat(gn==null?void 0:gn.id,"?type=").concat(gn.content_type));case 5:case"end":return Un.stop()}},dn)}));return function(dn){return Pn.apply(this,arguments)}}()),nn.show()},Or=function(){var nn=new se(yn.current);nn.settings.displayMode="popup",nn.addEventListener("render",function(){var Pn=Object(x.a)(E.a.mark(function dn(kn){var gn;return E.a.wrap(function(Un){for(;;)switch(Un.prev=Un.next){case 0:if($t.current.style.display="none",!yn.current){Un.next=6;break}return Un.next=4,Object(Te.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:kn.dataUrl}});case 4:gn=Un.sent,gn!=null&&gn.id&&Le(yn.current.getAttribute("src").replace(re.a.API_SERVER,""),"/api/attachments/".concat(gn==null?void 0:gn.id,"?type=").concat(gn.content_type));case 6:case"end":return Un.stop()}},dn)}));return function(dn){return Pn.apply(this,arguments)}}()),nn.show(),window.markerArea=nn},on=Object(L.useMemo)(function(){try{var pn=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,nn=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Pn=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Wn=Wn.replace(pn,"("+re.a.API_SERVER+"/api/attachments/").replace(nn,'"'+re.a.API_SERVER+"/api/attachments/").replace(Pn,'"'+re.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,`
|
|
`),Wn=Wn.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
|
|
`)}catch(Er){}var dn=Q(Wn),kn=w();if(Wn.match(/\[TOC\]/)&&(dn=dn.replace("<p>[TOC]</p>",D()),O()),dn=dn.replace(/(__special_katext_id_\d+__)/g,function(Er,Un){var Bn=kn[Un],tr=Bn.type,cr=Bn.expression;return Object(ae.renderToString)(Gt(cr)||"",{displayMode:tr==="block",throwOnError:!1,output:"html"})}),dn=dn.replace(/▁/g,"\u2581\u2581\u2581"),C(),ve){var gn=document.createElement("div");return gn.innerHTML=dn,gn.innerText}return setTimeout(function(){return yr()},500),dn},[Wn]),Yn=Object(L.useRef)();b.WebkitLineClamp=Xe,Xe&&(Ft=Object(N.a)(Object(N.a)({},Ft),b));function Ar(pn){var nn=pn.target;if(nn.tagName.toUpperCase()==="IMG"){if(At){var Pn=nn.getAttribute("src");Sn(Pn),er("image")}}else if(nn.tagName.toUpperCase()==="A"){var dn=nn.getAttribute("href");if(dn.indexOf("office")>-1)pn.preventDefault(),Sn(dn),er("office");else if(dn.indexOf("application/pdf")>-1)pn.preventDefault(),Sn(dn),er("pdf");else if(dn.indexOf("type=text")>-1)pn.preventDefault(),Sn(dn),er("html");else if(dn.startsWith("#")){pn.preventDefault();var kn=document.getElementById(dn.replace("#",""));kn&&kn.scrollIntoView(!0)}}}var yr=function(){var nn,Pn=(nn=Yn.current)===null||nn===void 0?void 0:nn.querySelectorAll("video");Pn==null||Pn.forEach(function(dn){if(dn.oncontextmenu=function(){return!1},dn.src.indexOf(".m3u8")>-1&&!dn.canPlayType("application/vnd.apple.mpegurl")){if($.a.isSupported()){var kn=new $.a;kn.loadSource(dn.src),kn.attachMedia(dn)}}})};Object(L.useEffect)(function(){if(Yn.current&&on&&(on.match(vn)&&window.PR.prettyPrint()),Yn.current)return Yn.current.addEventListener("click",Ar),function(){Yn.current.removeEventListener("click",Ar),C(),O()}},[on,Yn.current,Ar]);var br=function(nn){if(!ee)return;nn.target.nodeName==="IMG"?($t.current.style.display="flex",$t.current.style.width=nn.target.clientWidth+"px",$t.current.style.height=nn.target.clientHeight+"px",$t.current.style.top=nn.target.offsetTop+"px",$t.current.style.left=nn.target.offsetLeft+"px",yn.current.src=nn.target.getAttribute("src")):$t.current.style.display="none"};return f.a.createElement("div",{style:{position:"relative"}},f.a.createElement("div",{ref:Yn,style:Object(N.a)({},Ft),className:"".concat(X||""," markdown-body ").concat(kt.a.mdBody),onMouseOver:br,dangerouslySetInnerHTML:{__html:on}}),f.a.createElement("div",{ref:$t,className:kt.a.button},f.a.createElement(K.a,null,f.a.createElement(H.a,{onClick:function(){return Dn()}},"\u88C1\u526A"),f.a.createElement(H.a,{onClick:function(){return Or()}},"\u7F16\u8F91"))),f.a.createElement("img",{ref:yn,src:"https://ali-cdn.educoder.net/images/avatars/PortalImage/170?t=1659681136",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),f.a.createElement(he.a,{close:!0,data:fn,hasMask:Qe,type:fn!=null&&fn.length?Gn:"",style:Object(N.a)({},zn),onClose:function(){return Sn("")}}))}},"9VGf":function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return R});var J=j("q1tI"),K=j.n(J);function R(H,N){var x=Object(J.useRef)();Object(J.useEffect)(function(){x.current=H}),Object(J.useEffect)(function(){function U(){x.current()}if(N!==null){var I=setInterval(U,N);return function(){return clearInterval(I)}}},[N])}},AMnG:function(Fe,Ce,j){"use strict";var J=j("miYZ"),K=j("tsqr"),R=j("tJVT"),H=j("q1tI"),N=j.n(H),x=j("nWbc"),U=j.n(x),I=j("Ot1p");Ce.a=function(E){var L=E.id,f=E.activeDiscussIndex,S=E.onReplyDiscuss,P=Object(H.useState)(""),T=Object(R.a)(P,2),p=T[0],m=T[1];function i(u){m(u)}function a(){if(!p){K.b.info("\u56DE\u590D\u5185\u5BB9\u4E0D\u80FD\u4E3A\u7A7A!");return}S(L,p),m("")}return N.a.createElement("div",{key:L,className:"discuss-item-editor",style:{display:f===L?"block":"none",width:"100%"}},N.a.createElement(I.a,{miniToolbar:!0,startInit:f===L,defaultValue:p,id:L,noStorage:!0,watch:!1,height:155,placeholder:"\u6211\u8981\u56DE\u590D",showResizeBar:!0,onChange:i}),N.a.createElement("a",{onClick:a,className:"btn-send"},"\u53D1\u9001"))}},BU3w:function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return x});var J=j("MNnm"),K="rc-util-key";function R(U){if(U.attachTo)return U.attachTo;var I=document.querySelector("head");return I||document.body}function H(U){var I,E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(J.a)())return null;var L=document.createElement("style");if((I=E.csp)===null||I===void 0?void 0:I.nonce){var f;L.nonce=(f=E.csp)===null||f===void 0?void 0:f.nonce}L.innerHTML=U;var S=R(E),P=S.firstChild;return E.prepend&&S.prepend?S.prepend(L):E.prepend&&P?S.insertBefore(L,P):S.appendChild(L),L}var N=new Map;function x(U,I){var E=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},L=R(E);if(!N.has(L)){var f=H("",E),S=f.parentNode;N.set(L,S),S.removeChild(f)}var P=Array.from(N.get(L).children).find(function(a){return a.tagName==="STYLE"&&a[K]===I});if(P){var T,p;if(((T=E.csp)===null||T===void 0?void 0:T.nonce)&&P.nonce!==((p=E.csp)===null||p===void 0?void 0:p.nonce)){var m;P.nonce=(m=E.csp)===null||m===void 0?void 0:m.nonce}return P.innerHTML!==U&&(P.innerHTML=U),P}var i=H(U,E);return i[K]=I,i}},Bd2K:function(Fe,Ce,j){(function(J){J(j("VrN/"),j("osHv"))})(function(J){J.defineOption("autoCloseTags",!1,function(E,L,f){if(f!=J.Init&&f&&E.removeKeyMap("autoCloseTags"),!L)return;var S={name:"autoCloseTags"};(typeof L!="object"||L.whenClosing!==!1)&&(S["'/'"]=function(P){return x(P)}),(typeof L!="object"||L.whenOpening!==!1)&&(S["'>'"]=function(P){return H(P)}),E.addKeyMap(S)});var K=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],R=["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 H(E){if(E.getOption("disableInput"))return J.Pass;for(var L=E.listSelections(),f=[],S=E.getOption("autoCloseTags"),P=0;P<L.length;P++){if(!L[P].empty())return J.Pass;var T=L[P].head,p=E.getTokenAt(T),m=J.innerMode(E.getMode(),p.state),i=m.state,a=m.mode.xmlCurrentTag&&m.mode.xmlCurrentTag(i),u=a&&a.name;if(!u)return J.Pass;var c=m.mode.configuration=="html",O=typeof S=="object"&&S.dontCloseTags||c&&K,b=typeof S=="object"&&S.indentTags||c&&R;p.end>T.ch&&(u=u.slice(0,u.length-p.end+T.ch));var y=u.toLowerCase();if(!u||p.type=="string"&&(p.end!=T.ch||!/[\"\']/.test(p.string.charAt(p.string.length-1))||p.string.length==1)||p.type=="tag"&&a.close||p.string.indexOf("/")==T.ch-p.start-1||O&&U(O,y)>-1||I(E,m.mode.xmlCurrentContext&&m.mode.xmlCurrentContext(i)||[],u,T,!0))return J.Pass;var D=typeof S=="object"&&S.emptyTags;if(D&&U(D,u)>-1){f[P]={text:"/>",newPos:J.Pos(T.line,T.ch+2)};continue}var _=b&&U(b,y)>-1;f[P]={indent:_,text:">"+(_?`
|
|
|
|
`:"")+"</"+u+">",newPos:_?J.Pos(T.line+1,0):J.Pos(T.line,T.ch+1)}}for(var h=typeof S=="object"&&S.dontIndentOnAutoClose,P=L.length-1;P>=0;P--){var d=f[P];E.replaceRange(d.text,L[P].head,L[P].anchor,"+insert");var o=E.listSelections().slice(0);o[P]={head:d.newPos,anchor:d.newPos},E.setSelections(o),!h&&d.indent&&(E.indentLine(d.newPos.line,null,!0),E.indentLine(d.newPos.line+1,null,!0))}}function N(E,L){for(var f=E.listSelections(),S=[],P=L?"/":"</",T=E.getOption("autoCloseTags"),p=typeof T=="object"&&T.dontIndentOnSlash,m=0;m<f.length;m++){if(!f[m].empty())return J.Pass;var i=f[m].head,a=E.getTokenAt(i),u=J.innerMode(E.getMode(),a.state),c=u.state;if(L&&(a.type=="string"||a.string.charAt(0)!="<"||a.start!=i.ch-1))return J.Pass;var O,b=u.mode.name!="xml"&&E.getMode().name=="htmlmixed";if(b&&u.mode.name=="javascript")O=P+"script";else if(b&&u.mode.name=="css")O=P+"style";else{var y=u.mode.xmlCurrentContext&&u.mode.xmlCurrentContext(c);if(!y||y.length&&I(E,y,y[y.length-1],i))return J.Pass;O=P+y[y.length-1]}E.getLine(i.line).charAt(a.end)!=">"&&(O+=">"),S[m]=O}if(E.replaceSelections(S),f=E.listSelections(),!p)for(var m=0;m<f.length;m++)(m==f.length-1||f[m].head.line<f[m+1].head.line)&&E.indentLine(f[m].head.line)}function x(E){return E.getOption("disableInput")?J.Pass:N(E,!0)}J.commands.closeTag=function(E){return N(E)};function U(E,L){if(E.indexOf)return E.indexOf(L);for(var f=0,S=E.length;f<S;++f)if(E[f]==L)return f;return-1}function I(E,L,f,S,P){if(!J.scanForClosingTag)return!1;var T=Math.min(E.lastLine()+1,S.line+500),p=J.scanForClosingTag(E,S,null,T);if(!p||p.tag!=f)return!1;for(var m=P?1:0,i=L.length-1;i>=0&&L[i]==f;i--)++m;S=p.to;for(var i=1;i<m;i++){var a=J.scanForClosingTag(E,S,null,T);if(!a||a.tag!=f)return!1;S=a.to}return!0}})},BdwD:function(Fe,Ce,j){"use strict";var J=j("+L6B"),K=j("2/Rp"),R=j("0Owb"),H=j("k1fw"),N=j("q1tI"),x=j.n(N),U=j("FOrL"),I=j.n(U),E=function(f){var S=f.buttonProps,P=S===void 0?{}:S,T=f.styles,p=T===void 0?{}:T,m=f.customText,i=f.ButtonText,a=f.ButtonClick,u=f.Buttonclass,c=f.ButtonTwo;return x.a.createElement("section",{className:"tc animated fadeIn",style:Object(H.a)(Object(H.a)({},{color:"#999",margin:"200px auto"}),p)},x.a.createElement("img",{src:I.a}),x.a.createElement("p",{className:"mt20 font14"},m||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),i&&x.a.createElement(K.a,Object(R.a)({className:u,onClick:a},P),i),c&&c)};Ce.a=E},BjJ7:function(Fe,Ce,j){"use strict";j.d(Ce,"d",function(){return K}),j.d(Ce,"c",function(){return R}),j.d(Ce,"e",function(){return H}),j.d(Ce,"b",function(){return N}),j.d(Ce,"a",function(){return U});var J=j("m3rI");function K(I){var E=!0;if(I.length>0){for(var L=0;L<I.length;L++)if(I[L].compile_success==0||!I[L].compile_success){E=!1;break}}else E=!1;return E}function R(I){for(var E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",L=[],f=0;f<I.length;f++){var S=I[f],P=E?"".concat(E,"/").concat(S.name):"".concat(S.name);L.push({title:S.name,isLeaf:!(S.type==="tree"),key:P})}return L}function H(I,E,L){for(var f=0;f<I.length;f++){var S=I[f];if(S.key===E){S.children=L;break}S.children&&H(S.children,E,L)}return I}function N(I,E,L){var f;return function(){var S=this,P=arguments,T=function(){f=null,L||I.apply(S,P)},p=L&&!f;clearTimeout(f),f=setTimeout(T,E),p&&I.apply(S,P)}}var x=!0,U=J.a.API_SERVER},"C+DQ":function(Fe,Ce,j){},CrYA:function(Fe,Ce,j){var J=j("MFOe"),K=J.Global;Fe.exports={name:"sessionStorage",read:H,write:N,each:x,remove:U,clearAll:I};function R(){return K.sessionStorage}function H(E){return R().getItem(E)}function N(E,L){return R().setItem(E,L)}function x(E){for(var L=R().length-1;L>=0;L--){var f=R().key(L);E(H(f),f)}}function U(E){return R().removeItem(E)}function I(){return R().clear()}},D1Df:function(Fe,Ce,j){"use strict";function J(v){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?J=function(B){return typeof B}:J=function(B){return B&&typeof Symbol=="function"&&B.constructor===Symbol&&B!==Symbol.prototype?"symbol":typeof B},J(v)}function K(){return K=Object.assign||function(v){for(var M=1;M<arguments.length;M++){var B=arguments[M];for(var F in B)Object.prototype.hasOwnProperty.call(B,F)&&(v[F]=B[F])}return v},K.apply(this,arguments)}function R(v,M){var B=Object.keys(v);if(Object.getOwnPropertySymbols){var F=Object.getOwnPropertySymbols(v);M&&(F=F.filter(function(Q){return Object.getOwnPropertyDescriptor(v,Q).enumerable})),B.push.apply(B,F)}return B}function H(v){for(var M=1;M<arguments.length;M++){var B=arguments[M]!=null?arguments[M]:{};M%2?R(B,!0).forEach(function(F){p(v,F,B[F])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(B)):R(B).forEach(function(F){Object.defineProperty(v,F,Object.getOwnPropertyDescriptor(B,F))})}return v}function N(v,M){if(v==null)return{};var B=x(v,M),F,Q;if(Object.getOwnPropertySymbols){var G=Object.getOwnPropertySymbols(v);for(Q=0;Q<G.length;Q++){if(F=G[Q],M.indexOf(F)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(v,F))continue;B[F]=v[F]}}return B}function x(v,M){if(v==null)return{};var B={},F=Object.keys(v),Q,G;for(G=0;G<F.length;G++){if(Q=F[G],M.indexOf(Q)>=0)continue;B[Q]=v[Q]}return B}function U(v,M){if(!(v instanceof M))throw new TypeError("Cannot call a class as a function")}function I(v,M){for(var B=0;B<M.length;B++){var F=M[B];F.enumerable=F.enumerable||!1,F.configurable=!0,"value"in F&&(F.writable=!0),Object.defineProperty(v,F.key,F)}}function E(v,M,B){return M&&I(v.prototype,M),B&&I(v,B),v}function L(v,M){return M&&(J(M)==="object"||typeof M=="function")?M:S(v)}function f(v){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(B){return B.__proto__||Object.getPrototypeOf(B)},f(v)}function S(v){if(v===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v}function P(v,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function");v.prototype=Object.create(M&&M.prototype,{constructor:{value:v,writable:!0,configurable:!0}}),M&&T(v,M)}function T(v,M){return T=Object.setPrototypeOf||function(F,Q){return F.__proto__=Q,F},T(v,M)}function p(v,M,B){return M in v?Object.defineProperty(v,M,{value:B,enumerable:!0,configurable:!0,writable:!0}):v[M]=B,v}var m=j("q1tI"),i=j("17x9"),a=j("H38U"),u=j("aRTE");function c(v){for(var M="",B=0;B<v.length;B++){var F=v.charCodeAt(B);F<128?M+=String.fromCharCode(F):F<2048?(M+=String.fromCharCode(192|F>>6),M+=String.fromCharCode(128|F&63)):F<55296||F>=57344?(M+=String.fromCharCode(224|F>>12),M+=String.fromCharCode(128|F>>6&63),M+=String.fromCharCode(128|F&63)):(B++,F=65536+((F&1023)<<10|v.charCodeAt(B)&1023),M+=String.fromCharCode(240|F>>18),M+=String.fromCharCode(128|F>>12&63),M+=String.fromCharCode(128|F>>6&63),M+=String.fromCharCode(128|F&63))}return M}var O={size:128,level:"L",bgColor:"#FFFFFF",fgColor:"#000000",includeMargin:!1},b={},y=4,D=.1;function _(v){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,B=[];return v.forEach(function(F,Q){var G=null;F.forEach(function(W,$){if(!W&&G!==null){B.push("M".concat(G+M," ").concat(Q+M,"h").concat($-G,"v1H").concat(G+M,"z")),G=null;return}if($===F.length-1){if(!W)return;G===null?B.push("M".concat($+M,",").concat(Q+M," h1v1H").concat($+M,"z")):B.push("M".concat(G+M,",").concat(Q+M," h").concat($+1-G,"v1H").concat(G+M,"z"));return}W&&G===null&&(G=$)})}),B.join("")}function h(v,M){return v.slice().map(function(B,F){return F<M.y||F>=M.y+M.h?B:B.map(function(Q,G){return G<M.x||G>=M.x+M.w?Q:!1})})}function d(v,M){var B=v.imageSettings,F=v.size,Q=v.includeMargin;if(B==null)return null;var G=Q?y:0,W=M.length+G*2,$=Math.floor(F*D),re=W/F,ae=(B.width||$)*re,he=(B.height||$)*re,Te=B.x==null?M.length/2-ae/2:B.x*re,ye=B.y==null?M.length/2-he/2:B.y*re,Ee=null;if(B.excavate){var Oe=Math.floor(Te),_e=Math.floor(ye),fe=Math.ceil(ae+Te-Oe),le=Math.ceil(he+ye-_e);Ee={x:Oe,y:_e,w:fe,h:le}}return{x:Te,y:ye,h:he,w:ae,excavation:Ee}}var o=function(){try{new Path2D().addPath(new Path2D)}catch(v){return!1}return!0}(),s=function(v){P(M,v);function M(){var B,F;U(this,M);for(var Q=arguments.length,G=new Array(Q),W=0;W<Q;W++)G[W]=arguments[W];return F=L(this,(B=f(M)).call.apply(B,[this].concat(G))),p(S(F),"_canvas",void 0),p(S(F),"_image",void 0),p(S(F),"state",{imgLoaded:!1}),p(S(F),"handleImageLoad",function(){F.setState({imgLoaded:!0})}),F}return E(M,[{key:"componentDidMount",value:function(){this.update()}},{key:"componentDidUpdate",value:function(){this.update()}},{key:"update",value:function(){var F=this.props,Q=F.value,G=F.size,W=F.level,$=F.bgColor,re=F.fgColor,ae=F.includeMargin,he=F.imageSettings,Te=new a(-1,u[W]);if(Te.addData(c(Q)),Te.make(),this._canvas!=null){var ye=this._canvas,Ee=ye.getContext("2d");if(!Ee)return;var Oe=Te.modules;if(Oe===null)return;var _e=ae?y:0,fe=Oe.length+_e*2,le=d(this.props,Oe);he!=null&&le!=null&&(le.excavation!=null&&(Oe=h(Oe,le.excavation)));var Me=window.devicePixelRatio||1;ye.height=ye.width=G*Me;var ot=G/fe*Me;Ee.scale(ot,ot),Ee.fillStyle=$,Ee.fillRect(0,0,fe,fe),Ee.fillStyle=re,o?Ee.fill(new Path2D(_(Oe,_e))):Oe.forEach(function(ut,rt){ut.forEach(function(tt,ze){tt&&Ee.fillRect(ze+_e,rt+_e,1,1)})}),this.state.imgLoaded&&this._image&&le!=null&&Ee.drawImage(this._image,le.x+_e,le.y+_e,le.w,le.h)}}},{key:"render",value:function(){var F=this,Q=this.props,G=Q.value,W=Q.size,$=Q.level,re=Q.bgColor,ae=Q.fgColor,he=Q.style,Te=Q.includeMargin,ye=Q.imageSettings,Ee=N(Q,["value","size","level","bgColor","fgColor","style","includeMargin","imageSettings"]),Oe=H({height:W,width:W},he),_e=null,fe=ye&&ye.src;return ye!=null&&fe!=null&&(_e=m.createElement("img",{src:fe,style:{display:"none"},onLoad:this.handleImageLoad,ref:function(Me){return F._image=Me}})),m.createElement(m.Fragment,null,m.createElement("canvas",K({style:Oe,height:W,width:W,ref:function(Me){return F._canvas=Me}},Ee)),_e)}}]),M}(m.PureComponent);p(s,"defaultProps",O);var w=function(v){P(M,v);function M(){return U(this,M),L(this,f(M).apply(this,arguments))}return E(M,[{key:"render",value:function(){var F=this.props,Q=F.value,G=F.size,W=F.level,$=F.bgColor,re=F.fgColor,ae=F.includeMargin,he=F.imageSettings,Te=N(F,["value","size","level","bgColor","fgColor","includeMargin","imageSettings"]),ye=new a(-1,u[W]);ye.addData(c(Q)),ye.make();var Ee=ye.modules;if(Ee===null)return null;var Oe=ae?y:0,_e=Ee.length+Oe*2,fe=d(this.props,Ee),le=null;he!=null&&fe!=null&&(fe.excavation!=null&&(Ee=h(Ee,fe.excavation)),le=m.createElement("image",{xlinkHref:he.src,height:fe.h,width:fe.w,x:fe.x+Oe,y:fe.y+Oe,preserveAspectRatio:"none"}));var Me=_(Ee,Oe);return m.createElement("svg",K({shapeRendering:"crispEdges",height:G,width:G,viewBox:"0 0 ".concat(_e," ").concat(_e)},Te),m.createElement("path",{fill:$,d:"M0,0 h".concat(_e,"v").concat(_e,"H0z")}),m.createElement("path",{fill:re,d:Me}),le)}}]),M}(m.PureComponent);p(w,"defaultProps",O);var C=function(M){var B=M.renderAs,F=N(M,["renderAs"]),Q=B==="svg"?w:s;return m.createElement(Q,F)};C.defaultProps=H({renderAs:"canvas"},O),Fe.exports=C},DlQD:function(Fe,Ce,j){(function(J,K){Fe.exports=K()})(this,function(){"use strict";function J(ge,de){for(var ce=0;ce<de.length;ce++){var ne=de[ce];ne.enumerable=ne.enumerable||!1,ne.configurable=!0,"value"in ne&&(ne.writable=!0),Object.defineProperty(ge,ne.key,ne)}}function K(ge,de,ce){return de&&J(ge.prototype,de),ce&&J(ge,ce),ge}function R(ge,de){if(!ge)return;if(typeof ge=="string")return H(ge,de);var ce=Object.prototype.toString.call(ge).slice(8,-1);if(ce==="Object"&&ge.constructor&&(ce=ge.constructor.name),ce==="Map"||ce==="Set")return Array.from(ge);if(ce==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ce))return H(ge,de)}function H(ge,de){(de==null||de>ge.length)&&(de=ge.length);for(var ce=0,ne=new Array(de);ce<de;ce++)ne[ce]=ge[ce];return ne}function N(ge,de){var ce;if(typeof Symbol=="undefined"||ge[Symbol.iterator]==null){if(Array.isArray(ge)||(ce=R(ge))||de&&ge&&typeof ge.length=="number"){ce&&(ge=ce);var ne=0;return function(){return ne>=ge.length?{done:!0}:{done:!1,value:ge[ne++]}}}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 ce=ge[Symbol.iterator](),ce.next.bind(ce)}function x(ge,de){return de={exports:{}},ge(de,de.exports),de.exports}var U=x(function(ge){function de(){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 ce(ne){ge.exports.defaults=ne}ge.exports={defaults:de(),getDefaults:de,changeDefaults:ce}}),I=U.defaults,E=U.getDefaults,L=U.changeDefaults,f=/[&<>"']/,S=/[&<>"']/g,P=/[<>"']|&(?!#?\w+;)/,T=/[<>"']|&(?!#?\w+;)/g,p={"&":"&","<":"<",">":">",'"':""","'":"'"},m=function(de){return p[de]};function i(ge,de){if(de){if(f.test(ge))return ge.replace(S,m)}else if(P.test(ge))return ge.replace(T,m);return ge}var a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function u(ge){return ge.replace(a,function(de,ce){return ce=ce.toLowerCase(),ce==="colon"?":":ce.charAt(0)==="#"?ce.charAt(1)==="x"?String.fromCharCode(parseInt(ce.substring(2),16)):String.fromCharCode(+ce.substring(1)):""})}var c=/(^|[^\[])\^/g;function O(ge,de){ge=ge.source||ge,de=de||"";var ce={replace:function(ie,oe){return oe=oe.source||oe,oe=oe.replace(c,"$1"),ge=ge.replace(ie,oe),ce},getRegex:function(){return new RegExp(ge,de)}};return ce}var b=/[^\w:]/g,y=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function D(ge,de,ce){if(ge){var ne;try{ne=decodeURIComponent(u(ce)).replace(b,"").toLowerCase()}catch(ie){return null}if(ne.indexOf("javascript:")===0||ne.indexOf("vbscript:")===0||ne.indexOf("data:")===0)return null}de&&!y.test(ce)&&(ce=s(de,ce));try{ce=encodeURI(ce).replace(/%25/g,"%")}catch(ie){return null}return ce}var _={},h=/^[^:]+:\/*[^/]*$/,d=/^([^:]+:)[\s\S]*$/,o=/^([^:]+:\/*[^/]*)[\s\S]*$/;function s(ge,de){_[" "+ge]||(h.test(ge)?_[" "+ge]=ge+"/":_[" "+ge]=M(ge,"/",!0)),ge=_[" "+ge];var ce=ge.indexOf(":")===-1;return de.substring(0,2)==="//"?ce?de:ge.replace(d,"$1")+de:de.charAt(0)==="/"?ce?de:ge.replace(o,"$1")+de:ge+de}var w={exec:function(){}};function C(ge){for(var de=1,ce,ne;de<arguments.length;de++){ce=arguments[de];for(ne in ce)Object.prototype.hasOwnProperty.call(ce,ne)&&(ge[ne]=ce[ne])}return ge}function v(ge,de){var ce=ge.replace(/\|/g,function(oe,ue,we){for(var ke=!1,Je=ue;--Je>=0&&we[Je]==="\\";)ke=!ke;return ke?"|":" |"}),ne=ce.split(/ \|/),ie=0;if(ne.length>de)ne.splice(de);else for(;ne.length<de;)ne.push("");for(;ie<ne.length;ie++)ne[ie]=ne[ie].trim().replace(/\\\|/g,"|");return ne}function M(ge,de,ce){var ne=ge.length;if(ne===0)return"";for(var ie=0;ie<ne;){var oe=ge.charAt(ne-ie-1);if(oe===de&&!ce)ie++;else if(oe!==de&&ce)ie++;else break}return ge.substr(0,ne-ie)}function B(ge,de){if(ge.indexOf(de[1])===-1)return-1;for(var ce=ge.length,ne=0,ie=0;ie<ce;ie++)if(ge[ie]==="\\")ie++;else if(ge[ie]===de[0])ne++;else if(ge[ie]===de[1]&&(ne--,ne<0))return ie;return-1}function F(ge){ge&&ge.sanitize&&!ge.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 Q={escape:i,unescape:u,edit:O,cleanUrl:D,resolveUrl:s,noopTest:w,merge:C,splitCells:v,rtrim:M,findClosingBracket:B,checkSanitizeDeprecation:F},G=U.defaults,W=Q.rtrim,$=Q.splitCells,re=Q.escape,ae=Q.findClosingBracket;function he(ge,de,ce){var ne=de.href,ie=de.title?re(de.title):null,oe=ge[1].replace(/\\([\[\]])/g,"$1");return ge[0].charAt(0)!=="!"?{type:"link",raw:ce,href:ne,title:ie,text:oe}:{type:"image",raw:ce,href:ne,title:ie,text:re(oe)}}function Te(ge,de){var ce=ge.match(/^(\s+)(?:```)/);if(ce===null)return de;var ne=ce[1];return de.split(`
|
|
`).map(function(ie){var oe=ie.match(/^\s+/);if(oe===null)return ie;var ue=oe[0];return ue.length>=ne.length?ie.slice(ne.length):ie}).join(`
|
|
`)}var ye=function(){function ge(ce){this.options=ce||G}var de=ge.prototype;return de.space=function(ne){var ie=this.rules.block.newline.exec(ne);if(ie)return ie[0].length>1?{type:"space",raw:ie[0]}:{raw:`
|
|
`}},de.code=function(ne,ie){var oe=this.rules.block.code.exec(ne);if(oe){var ue=ie[ie.length-1];if(ue&&ue.type==="paragraph")return{raw:oe[0],text:oe[0].trimRight()};var we=oe[0].replace(/^ {4}/gm,"");return{type:"code",raw:oe[0],codeBlockStyle:"indented",text:this.options.pedantic?we:W(we,`
|
|
`)}}},de.fences=function(ne){var ie=this.rules.block.fences.exec(ne);if(ie){var oe=ie[0],ue=Te(oe,ie[3]||"");return{type:"code",raw:oe,lang:ie[2]?ie[2].trim():ie[2],text:ue}}},de.heading=function(ne){var ie=this.rules.block.heading.exec(ne);if(ie)return{type:"heading",raw:ie[0],depth:ie[1].length,text:ie[2]}},de.nptable=function(ne){var ie=this.rules.block.nptable.exec(ne);if(ie){var oe={type:"table",header:$(ie[1].replace(/^ *| *\| *$/g,"")),align:ie[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ie[3]?ie[3].replace(/\n$/,"").split(`
|
|
`):[],raw:ie[0]};if(oe.header.length===oe.align.length){var ue=oe.align.length,we;for(we=0;we<ue;we++)/^ *-+: *$/.test(oe.align[we])?oe.align[we]="right":/^ *:-+: *$/.test(oe.align[we])?oe.align[we]="center":/^ *:-+ *$/.test(oe.align[we])?oe.align[we]="left":oe.align[we]=null;for(ue=oe.cells.length,we=0;we<ue;we++)oe.cells[we]=$(oe.cells[we],oe.header.length);return oe}}},de.hr=function(ne){var ie=this.rules.block.hr.exec(ne);if(ie)return{type:"hr",raw:ie[0]}},de.blockquote=function(ne){var ie=this.rules.block.blockquote.exec(ne);if(ie){var oe=ie[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ie[0],text:oe}}},de.list=function(ne){var ie=this.rules.block.list.exec(ne);if(ie){for(var oe=ie[0],ue=ie[2],we=ue.length>1,ke=ue[ue.length-1]===")",Je={type:"list",raw:oe,ordered:we,start:we?+ue.slice(0,-1):"",loose:!1,items:[]},bt=ie[0].match(this.rules.block.item),It=!1,Ge,it,Be,Ue,Re,se,pe,je=bt.length,Ie=0;Ie<je;Ie++)Ge=bt[Ie],oe=Ge,it=Ge.length,Ge=Ge.replace(/^ *([*+-]|\d+[.)]) */,""),~Ge.indexOf(`
|
|
`)&&(it-=Ge.length,Ge=this.options.pedantic?Ge.replace(/^ {1,4}/gm,""):Ge.replace(new RegExp("^ {1,"+it+"}","gm"),"")),Ie!==je-1&&(Be=this.rules.block.bullet.exec(bt[Ie+1])[0],(we?Be.length===1||!ke&&Be[Be.length-1]===")":Be.length>1||this.options.smartLists&&Be!==ue)&&(Ue=bt.slice(Ie+1).join(`
|
|
`),Je.raw=Je.raw.substring(0,Je.raw.length-Ue.length),Ie=je-1)),Re=It||/\n\n(?!\s*$)/.test(Ge),Ie!==je-1&&(It=Ge.charAt(Ge.length-1)===`
|
|
`,Re||(Re=It)),Re&&(Je.loose=!0),se=/^\[[ xX]\] /.test(Ge),pe=void 0,se&&(pe=Ge[1]!==" ",Ge=Ge.replace(/^\[[ xX]\] +/,"")),Je.items.push({type:"list_item",raw:oe,task:se,checked:pe,loose:Re,text:Ge});return Je}},de.html=function(ne){var ie=this.rules.block.html.exec(ne);if(ie)return{type:this.options.sanitize?"paragraph":"html",raw:ie[0],pre:!this.options.sanitizer&&(ie[1]==="pre"||ie[1]==="script"||ie[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ie[0]):re(ie[0]):ie[0]}},de.def=function(ne){var ie=this.rules.block.def.exec(ne);if(ie){ie[3]&&(ie[3]=ie[3].substring(1,ie[3].length-1));var oe=ie[1].toLowerCase().replace(/\s+/g," ");return{tag:oe,raw:ie[0],href:ie[2],title:ie[3]}}},de.table=function(ne){var ie=this.rules.block.table.exec(ne);if(ie){var oe={type:"table",header:$(ie[1].replace(/^ *| *\| *$/g,"")),align:ie[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ie[3]?ie[3].replace(/\n$/,"").split(`
|
|
`):[]};if(oe.header.length===oe.align.length){oe.raw=ie[0];var ue=oe.align.length,we;for(we=0;we<ue;we++)/^ *-+: *$/.test(oe.align[we])?oe.align[we]="right":/^ *:-+: *$/.test(oe.align[we])?oe.align[we]="center":/^ *:-+ *$/.test(oe.align[we])?oe.align[we]="left":oe.align[we]=null;for(ue=oe.cells.length,we=0;we<ue;we++)oe.cells[we]=$(oe.cells[we].replace(/^ *\| *| *\| *$/g,""),oe.header.length);return oe}}},de.lheading=function(ne){var ie=this.rules.block.lheading.exec(ne);if(ie)return{type:"heading",raw:ie[0],depth:ie[2].charAt(0)==="="?1:2,text:ie[1]}},de.paragraph=function(ne){var ie=this.rules.block.paragraph.exec(ne);if(ie)return{type:"paragraph",raw:ie[0],text:ie[1].charAt(ie[1].length-1)===`
|
|
`?ie[1].slice(0,-1):ie[1]}},de.text=function(ne,ie){var oe=this.rules.block.text.exec(ne);if(oe){var ue=ie[ie.length-1];return ue&&ue.type==="text"?{raw:oe[0],text:oe[0]}:{type:"text",raw:oe[0],text:oe[0]}}},de.escape=function(ne){var ie=this.rules.inline.escape.exec(ne);if(ie)return{type:"escape",raw:ie[0],text:re(ie[1])}},de.tag=function(ne,ie,oe){var ue=this.rules.inline.tag.exec(ne);if(ue)return!ie&&/^<a /i.test(ue[0])?ie=!0:ie&&/^<\/a>/i.test(ue[0])&&(ie=!1),!oe&&/^<(pre|code|kbd|script)(\s|>)/i.test(ue[0])?oe=!0:oe&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ue[0])&&(oe=!1),{type:this.options.sanitize?"text":"html",raw:ue[0],inLink:ie,inRawBlock:oe,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ue[0]):re(ue[0]):ue[0]}},de.link=function(ne){var ie=this.rules.inline.link.exec(ne);if(ie){var oe=ae(ie[2],"()");if(oe>-1){var ue=ie[0].indexOf("!")===0?5:4,we=ue+ie[1].length+oe;ie[2]=ie[2].substring(0,oe),ie[0]=ie[0].substring(0,we).trim(),ie[3]=""}var ke=ie[2],Je="";if(this.options.pedantic){var bt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(ke);bt?(ke=bt[1],Je=bt[3]):Je=""}else Je=ie[3]?ie[3].slice(1,-1):"";ke=ke.trim().replace(/^<([\s\S]*)>$/,"$1");var It=he(ie,{href:ke&&ke.replace(this.rules.inline._escapes,"$1"),title:Je&&Je.replace(this.rules.inline._escapes,"$1")},ie[0]);return It}},de.reflink=function(ne,ie){var oe;if((oe=this.rules.inline.reflink.exec(ne))||(oe=this.rules.inline.nolink.exec(ne))){var ue=(oe[2]||oe[1]).replace(/\s+/g," ");if(ue=ie[ue.toLowerCase()],!ue||!ue.href){var we=oe[0].charAt(0);return{type:"text",raw:we,text:we}}var ke=he(oe,ue,oe[0]);return ke}},de.strong=function(ne,ie,oe){oe===void 0&&(oe="");var ue=this.rules.inline.strong.start.exec(ne);if(ue&&(!ue[1]||ue[1]&&(oe===""||this.rules.inline.punctuation.exec(oe)))){ie=ie.slice(-1*ne.length);var we=ue[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;we.lastIndex=0;for(var ke;(ue=we.exec(ie))!=null;)if(ke=this.rules.inline.strong.middle.exec(ie.slice(0,ue.index+3)),ke)return{type:"strong",raw:ne.slice(0,ke[0].length),text:ne.slice(2,ke[0].length-2)}}},de.em=function(ne,ie,oe){oe===void 0&&(oe="");var ue=this.rules.inline.em.start.exec(ne);if(ue&&(!ue[1]||ue[1]&&(oe===""||this.rules.inline.punctuation.exec(oe)))){ie=ie.slice(-1*ne.length);var we=ue[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;we.lastIndex=0;for(var ke;(ue=we.exec(ie))!=null;)if(ke=this.rules.inline.em.middle.exec(ie.slice(0,ue.index+2)),ke)return{type:"em",raw:ne.slice(0,ke[0].length),text:ne.slice(1,ke[0].length-1)}}},de.codespan=function(ne){var ie=this.rules.inline.code.exec(ne);if(ie){var oe=ie[2].replace(/\n/g," "),ue=/[^ ]/.test(oe),we=oe.startsWith(" ")&&oe.endsWith(" ");return ue&&we&&(oe=oe.substring(1,oe.length-1)),oe=re(oe,!0),{type:"codespan",raw:ie[0],text:oe}}},de.br=function(ne){var ie=this.rules.inline.br.exec(ne);if(ie)return{type:"br",raw:ie[0]}},de.del=function(ne){var ie=this.rules.inline.del.exec(ne);if(ie)return{type:"del",raw:ie[0],text:ie[1]}},de.autolink=function(ne,ie){var oe=this.rules.inline.autolink.exec(ne);if(oe){var ue,we;return oe[2]==="@"?(ue=re(this.options.mangle?ie(oe[1]):oe[1]),we="mailto:"+ue):(ue=re(oe[1]),we=ue),{type:"link",raw:oe[0],text:ue,href:we,tokens:[{type:"text",raw:ue,text:ue}]}}},de.url=function(ne,ie){var oe;if(oe=this.rules.inline.url.exec(ne)){var ue,we;if(oe[2]==="@")ue=re(this.options.mangle?ie(oe[0]):oe[0]),we="mailto:"+ue;else{var ke;do ke=oe[0],oe[0]=this.rules.inline._backpedal.exec(oe[0])[0];while(ke!==oe[0]);ue=re(oe[0]),oe[1]==="www."?we="http://"+ue:we=ue}return{type:"link",raw:oe[0],text:ue,href:we,tokens:[{type:"text",raw:ue,text:ue}]}}},de.inlineText=function(ne,ie,oe){var ue=this.rules.inline.text.exec(ne);if(ue){var we;return ie?we=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ue[0]):re(ue[0]):ue[0]:we=re(this.options.smartypants?oe(ue[0]):ue[0]),{type:"text",raw:ue[0],text:we}}},ge}(),Ee=Q.noopTest,Oe=Q.edit,_e=Q.merge,fe={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:Ee,table:Ee,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};fe._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,fe._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,fe.def=Oe(fe.def).replace("label",fe._label).replace("title",fe._title).getRegex(),fe.bullet=/(?:[*+-]|\d{1,9}[.)])/,fe.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,fe.item=Oe(fe.item,"gm").replace(/bull/g,fe.bullet).getRegex(),fe.list=Oe(fe.list).replace(/bull/g,fe.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+fe.def.source+")").getRegex(),fe._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",fe._comment=/<!--(?!-?>)[\s\S]*?-->/,fe.html=Oe(fe.html,"i").replace("comment",fe._comment).replace("tag",fe._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),fe.paragraph=Oe(fe._paragraph).replace("hr",fe.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",fe._tag).getRegex(),fe.blockquote=Oe(fe.blockquote).replace("paragraph",fe.paragraph).getRegex(),fe.normal=_e({},fe),fe.gfm=_e({},fe.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*|$)"}),fe.gfm.nptable=Oe(fe.gfm.nptable).replace("hr",fe.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",fe._tag).getRegex(),fe.gfm.table=Oe(fe.gfm.table).replace("hr",fe.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",fe._tag).getRegex(),fe.pedantic=_e({},fe.normal,{html:Oe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",fe._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:Ee,paragraph:Oe(fe.normal._paragraph).replace("hr",fe.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",fe.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var le={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Ee,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:Ee,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};le._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",le.punctuation=Oe(le.punctuation).replace(/punctuation/g,le._punctuation).getRegex(),le._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",le._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",le.em.start=Oe(le.em.start).replace(/punctuation/g,le._punctuation).getRegex(),le.em.middle=Oe(le.em.middle).replace(/punctuation/g,le._punctuation).replace(/overlapSkip/g,le._overlapSkip).getRegex(),le.em.endAst=Oe(le.em.endAst,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.em.endUnd=Oe(le.em.endUnd,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.strong.start=Oe(le.strong.start).replace(/punctuation/g,le._punctuation).getRegex(),le.strong.middle=Oe(le.strong.middle).replace(/punctuation/g,le._punctuation).replace(/blockSkip/g,le._blockSkip).getRegex(),le.strong.endAst=Oe(le.strong.endAst,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.strong.endUnd=Oe(le.strong.endUnd,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.blockSkip=Oe(le._blockSkip,"g").getRegex(),le.overlapSkip=Oe(le._overlapSkip,"g").getRegex(),le._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,le._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,le._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])?)+(?![-_])/,le.autolink=Oe(le.autolink).replace("scheme",le._scheme).replace("email",le._email).getRegex(),le._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,le.tag=Oe(le.tag).replace("comment",fe._comment).replace("attribute",le._attribute).getRegex(),le._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,le._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,le._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,le.link=Oe(le.link).replace("label",le._label).replace("href",le._href).replace("title",le._title).getRegex(),le.reflink=Oe(le.reflink).replace("label",le._label).getRegex(),le.reflinkSearch=Oe(le.reflinkSearch,"g").replace("reflink",le.reflink).replace("nolink",le.nolink).getRegex(),le.normal=_e({},le),le.pedantic=_e({},le.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:Oe(/^!?\[(label)\]\((.*?)\)/).replace("label",le._label).getRegex(),reflink:Oe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",le._label).getRegex()}),le.gfm=_e({},le.normal,{escape:Oe(le.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),le.gfm.url=Oe(le.gfm.url,"i").replace("email",le.gfm._extended_email).getRegex(),le.breaks=_e({},le.gfm,{br:Oe(le.br).replace("{2,}","*").getRegex(),text:Oe(le.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Me={block:fe,inline:le},ot=U.defaults,ut=Me.block,rt=Me.inline;function tt(ge){return ge.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 ze(ge){var de="",ce,ne,ie=ge.length;for(ce=0;ce<ie;ce++)ne=ge.charCodeAt(ce),Math.random()>.5&&(ne="x"+ne.toString(16)),de+="&#"+ne+";";return de}var $e=function(){function ge(ce){this.tokens=[],this.tokens.links=Object.create(null),this.options=ce||ot,this.options.tokenizer=this.options.tokenizer||new ye,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var ne={block:ut.normal,inline:rt.normal};this.options.pedantic?(ne.block=ut.pedantic,ne.inline=rt.pedantic):this.options.gfm&&(ne.block=ut.gfm,this.options.breaks?ne.inline=rt.breaks:ne.inline=rt.gfm),this.tokenizer.rules=ne}ge.lex=function(ne,ie){var oe=new ge(ie);return oe.lex(ne)};var de=ge.prototype;return de.lex=function(ne){return ne=ne.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(ne,this.tokens,!0),this.inline(this.tokens),this.tokens},de.blockTokens=function(ne,ie,oe){ie===void 0&&(ie=[]),oe===void 0&&(oe=!0),ne=ne.replace(/^ +$/gm,"");for(var ue,we,ke,Je;ne;){if(ue=this.tokenizer.space(ne)){ne=ne.substring(ue.raw.length),ue.type&&ie.push(ue);continue}if(ue=this.tokenizer.code(ne,ie)){ne=ne.substring(ue.raw.length),ue.type?ie.push(ue):(Je=ie[ie.length-1],Je.raw+=`
|
|
`+ue.raw,Je.text+=`
|
|
`+ue.text);continue}if(ue=this.tokenizer.fences(ne)){ne=ne.substring(ue.raw.length),ie.push(ue);continue}if(ue=this.tokenizer.heading(ne)){ne=ne.substring(ue.raw.length),ie.push(ue);continue}if(ue=this.tokenizer.nptable(ne)){ne=ne.substring(ue.raw.length),ie.push(ue);continue}if(ue=this.tokenizer.hr(ne)){ne=ne.substring(ue.raw.length),ie.push(ue);continue}if(ue=this.tokenizer.blockquote(ne)){ne=ne.substring(ue.raw.length),ue.tokens=this.blockTokens(ue.text,[],oe),ie.push(ue);continue}if(ue=this.tokenizer.list(ne)){for(ne=ne.substring(ue.raw.length),ke=ue.items.length,we=0;we<ke;we++)ue.items[we].tokens=this.blockTokens(ue.items[we].text,[],!1);ie.push(ue);continue}if(ue=this.tokenizer.html(ne)){ne=ne.substring(ue.raw.length),ie.push(ue);continue}if(oe&&(ue=this.tokenizer.def(ne))){ne=ne.substring(ue.raw.length),this.tokens.links[ue.tag]||(this.tokens.links[ue.tag]={href:ue.href,title:ue.title});continue}if(ue=this.tokenizer.table(ne)){ne=ne.substring(ue.raw.length),ie.push(ue);continue}if(ue=this.tokenizer.lheading(ne)){ne=ne.substring(ue.raw.length),ie.push(ue);continue}if(oe&&(ue=this.tokenizer.paragraph(ne))){ne=ne.substring(ue.raw.length),ie.push(ue);continue}if(ue=this.tokenizer.text(ne,ie)){ne=ne.substring(ue.raw.length),ue.type?ie.push(ue):(Je=ie[ie.length-1],Je.raw+=`
|
|
`+ue.raw,Je.text+=`
|
|
`+ue.text);continue}if(ne){var bt="Infinite loop on byte: "+ne.charCodeAt(0);if(this.options.silent){console.error(bt);break}else throw new Error(bt)}}return ie},de.inline=function(ne){var ie,oe,ue,we,ke,Je,bt=ne.length;for(ie=0;ie<bt;ie++){Je=ne[ie];switch(Je.type){case"paragraph":case"text":case"heading":{Je.tokens=[],this.inlineTokens(Je.text,Je.tokens);break}case"table":{for(Je.tokens={header:[],cells:[]},we=Je.header.length,oe=0;oe<we;oe++)Je.tokens.header[oe]=[],this.inlineTokens(Je.header[oe],Je.tokens.header[oe]);for(we=Je.cells.length,oe=0;oe<we;oe++)for(ke=Je.cells[oe],Je.tokens.cells[oe]=[],ue=0;ue<ke.length;ue++)Je.tokens.cells[oe][ue]=[],this.inlineTokens(ke[ue],Je.tokens.cells[oe][ue]);break}case"blockquote":{this.inline(Je.tokens);break}case"list":{for(we=Je.items.length,oe=0;oe<we;oe++)this.inline(Je.items[oe].tokens);break}}}return ne},de.inlineTokens=function(ne,ie,oe,ue,we){ie===void 0&&(ie=[]),oe===void 0&&(oe=!1),ue===void 0&&(ue=!1),we===void 0&&(we="");var ke,Je=ne,bt;if(this.tokens.links){var It=Object.keys(this.tokens.links);if(It.length>0)for(;(bt=this.tokenizer.rules.inline.reflinkSearch.exec(Je))!=null;)It.includes(bt[0].slice(bt[0].lastIndexOf("[")+1,-1))&&(Je=Je.slice(0,bt.index)+"["+"a".repeat(bt[0].length-2)+"]"+Je.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(bt=this.tokenizer.rules.inline.blockSkip.exec(Je))!=null;)Je=Je.slice(0,bt.index)+"["+"a".repeat(bt[0].length-2)+"]"+Je.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;ne;){if(ke=this.tokenizer.escape(ne)){ne=ne.substring(ke.raw.length),ie.push(ke);continue}if(ke=this.tokenizer.tag(ne,oe,ue)){ne=ne.substring(ke.raw.length),oe=ke.inLink,ue=ke.inRawBlock,ie.push(ke);continue}if(ke=this.tokenizer.link(ne)){ne=ne.substring(ke.raw.length),ke.type==="link"&&(ke.tokens=this.inlineTokens(ke.text,[],!0,ue)),ie.push(ke);continue}if(ke=this.tokenizer.reflink(ne,this.tokens.links)){ne=ne.substring(ke.raw.length),ke.type==="link"&&(ke.tokens=this.inlineTokens(ke.text,[],!0,ue)),ie.push(ke);continue}if(ke=this.tokenizer.strong(ne,Je,we)){ne=ne.substring(ke.raw.length),ke.tokens=this.inlineTokens(ke.text,[],oe,ue),ie.push(ke);continue}if(ke=this.tokenizer.em(ne,Je,we)){ne=ne.substring(ke.raw.length),ke.tokens=this.inlineTokens(ke.text,[],oe,ue),ie.push(ke);continue}if(ke=this.tokenizer.codespan(ne)){ne=ne.substring(ke.raw.length),ie.push(ke);continue}if(ke=this.tokenizer.br(ne)){ne=ne.substring(ke.raw.length),ie.push(ke);continue}if(ke=this.tokenizer.del(ne)){ne=ne.substring(ke.raw.length),ke.tokens=this.inlineTokens(ke.text,[],oe,ue),ie.push(ke);continue}if(ke=this.tokenizer.autolink(ne,ze)){ne=ne.substring(ke.raw.length),ie.push(ke);continue}if(!oe&&(ke=this.tokenizer.url(ne,ze))){ne=ne.substring(ke.raw.length),ie.push(ke);continue}if(ke=this.tokenizer.inlineText(ne,ue,tt)){ne=ne.substring(ke.raw.length),we=ke.raw.slice(-1),ie.push(ke);continue}if(ne){var Ge="Infinite loop on byte: "+ne.charCodeAt(0);if(this.options.silent){console.error(Ge);break}else throw new Error(Ge)}}return ie},K(ge,null,[{key:"rules",get:function(){return{block:ut,inline:rt}}}]),ge}(),ct=U.defaults,vt=Q.cleanUrl,at=Q.escape,et=function(){function ge(ce){this.options=ce||ct}var de=ge.prototype;return de.code=function(ne,ie,oe){var ue=(ie||"").match(/\S*/)[0];if(this.options.highlight){var we=this.options.highlight(ne,ue);we!=null&&we!==ne&&(oe=!0,ne=we)}return ue?'<pre><code class="'+this.options.langPrefix+at(ue,!0)+'">'+(oe?ne:at(ne,!0))+`</code></pre>
|
|
`:"<pre><code>"+(oe?ne:at(ne,!0))+`</code></pre>
|
|
`},de.blockquote=function(ne){return`<blockquote>
|
|
`+ne+`</blockquote>
|
|
`},de.html=function(ne){return ne},de.heading=function(ne,ie,oe,ue){return this.options.headerIds?"<h"+ie+' id="'+this.options.headerPrefix+ue.slug(oe)+'">'+ne+"</h"+ie+`>
|
|
`:"<h"+ie+">"+ne+"</h"+ie+`>
|
|
`},de.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},de.list=function(ne,ie,oe){var ue=ie?"ol":"ul",we=ie&&oe!==1?' start="'+oe+'"':"";return"<"+ue+we+`>
|
|
`+ne+"</"+ue+`>
|
|
`},de.listitem=function(ne){return"<li>"+ne+`</li>
|
|
`},de.checkbox=function(ne){return"<input "+(ne?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},de.paragraph=function(ne){return"<p>"+ne+`</p>
|
|
`},de.table=function(ne,ie){return ie&&(ie="<tbody>"+ie+"</tbody>"),`<table>
|
|
<thead>
|
|
`+ne+`</thead>
|
|
`+ie+`</table>
|
|
`},de.tablerow=function(ne){return`<tr>
|
|
`+ne+`</tr>
|
|
`},de.tablecell=function(ne,ie){var oe=ie.header?"th":"td",ue=ie.align?"<"+oe+' align="'+ie.align+'">':"<"+oe+">";return ue+ne+"</"+oe+`>
|
|
`},de.strong=function(ne){return"<strong>"+ne+"</strong>"},de.em=function(ne){return"<em>"+ne+"</em>"},de.codespan=function(ne){return"<code>"+ne+"</code>"},de.br=function(){return this.options.xhtml?"<br/>":"<br>"},de.del=function(ne){return"<del>"+ne+"</del>"},de.link=function(ne,ie,oe){if(ne=vt(this.options.sanitize,this.options.baseUrl,ne),ne===null)return oe;var ue='<a href="'+at(ne)+'"';return ie&&(ue+=' title="'+ie+'"'),ue+=">"+oe+"</a>",ue},de.image=function(ne,ie,oe){if(ne=vt(this.options.sanitize,this.options.baseUrl,ne),ne===null)return oe;var ue='<img src="'+ne+'" alt="'+oe+'"';return ie&&(ue+=' title="'+ie+'"'),ue+=this.options.xhtml?"/>":">",ue},de.text=function(ne){return ne},ge}(),nt=function(){function ge(){}var de=ge.prototype;return de.strong=function(ne){return ne},de.em=function(ne){return ne},de.codespan=function(ne){return ne},de.del=function(ne){return ne},de.html=function(ne){return ne},de.text=function(ne){return ne},de.link=function(ne,ie,oe){return""+oe},de.image=function(ne,ie,oe){return""+oe},de.br=function(){return""},ge}(),Rt=function(){function ge(){this.seen={}}var de=ge.prototype;return de.slug=function(ne){var ie=ne.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ie)){var oe=ie;do this.seen[oe]++,ie=oe+"-"+this.seen[oe];while(this.seen.hasOwnProperty(ie))}return this.seen[ie]=0,ie},ge}(),Ct=U.defaults,xt=Q.unescape,yt=function(){function ge(ce){this.options=ce||Ct,this.options.renderer=this.options.renderer||new et,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new nt,this.slugger=new Rt}ge.parse=function(ne,ie){var oe=new ge(ie);return oe.parse(ne)};var de=ge.prototype;return de.parse=function(ne,ie){ie===void 0&&(ie=!0);var oe="",ue,we,ke,Je,bt,It,Ge,it,Be,Ue,Re,se,pe,je,Ie,lt,st,Ae,qe=ne.length;for(ue=0;ue<qe;ue++){Ue=ne[ue];switch(Ue.type){case"space":continue;case"hr":{oe+=this.renderer.hr();continue}case"heading":{oe+=this.renderer.heading(this.parseInline(Ue.tokens),Ue.depth,xt(this.parseInline(Ue.tokens,this.textRenderer)),this.slugger);continue}case"code":{oe+=this.renderer.code(Ue.text,Ue.lang,Ue.escaped);continue}case"table":{for(it="",Ge="",Je=Ue.header.length,we=0;we<Je;we++)Ge+=this.renderer.tablecell(this.parseInline(Ue.tokens.header[we]),{header:!0,align:Ue.align[we]});for(it+=this.renderer.tablerow(Ge),Be="",Je=Ue.cells.length,we=0;we<Je;we++){for(It=Ue.tokens.cells[we],Ge="",bt=It.length,ke=0;ke<bt;ke++)Ge+=this.renderer.tablecell(this.parseInline(It[ke]),{header:!1,align:Ue.align[ke]});Be+=this.renderer.tablerow(Ge)}oe+=this.renderer.table(it,Be);continue}case"blockquote":{Be=this.parse(Ue.tokens),oe+=this.renderer.blockquote(Be);continue}case"list":{for(Re=Ue.ordered,se=Ue.start,pe=Ue.loose,Je=Ue.items.length,Be="",we=0;we<Je;we++)Ie=Ue.items[we],lt=Ie.checked,st=Ie.task,je="",Ie.task&&(Ae=this.renderer.checkbox(lt),pe?Ie.tokens.length>0&&Ie.tokens[0].type==="text"?(Ie.tokens[0].text=Ae+" "+Ie.tokens[0].text,Ie.tokens[0].tokens&&Ie.tokens[0].tokens.length>0&&Ie.tokens[0].tokens[0].type==="text"&&(Ie.tokens[0].tokens[0].text=Ae+" "+Ie.tokens[0].tokens[0].text)):Ie.tokens.unshift({type:"text",text:Ae}):je+=Ae),je+=this.parse(Ie.tokens,pe),Be+=this.renderer.listitem(je,st,lt);oe+=this.renderer.list(Be,Re,se);continue}case"html":{oe+=this.renderer.html(Ue.text);continue}case"paragraph":{oe+=this.renderer.paragraph(this.parseInline(Ue.tokens));continue}case"text":{for(Be=Ue.tokens?this.parseInline(Ue.tokens):Ue.text;ue+1<qe&&ne[ue+1].type==="text";)Ue=ne[++ue],Be+=`
|
|
`+(Ue.tokens?this.parseInline(Ue.tokens):Ue.text);oe+=ie?this.renderer.paragraph(Be):Be;continue}default:{var pt='Token with "'+Ue.type+'" type was not found.';if(this.options.silent){console.error(pt);return}else throw new Error(pt)}}}return oe},de.parseInline=function(ne,ie){ie=ie||this.renderer;var oe="",ue,we,ke=ne.length;for(ue=0;ue<ke;ue++){we=ne[ue];switch(we.type){case"escape":{oe+=ie.text(we.text);break}case"html":{oe+=ie.html(we.text);break}case"link":{oe+=ie.link(we.href,we.title,this.parseInline(we.tokens,ie));break}case"image":{oe+=ie.image(we.href,we.title,we.text);break}case"strong":{oe+=ie.strong(this.parseInline(we.tokens,ie));break}case"em":{oe+=ie.em(this.parseInline(we.tokens,ie));break}case"codespan":{oe+=ie.codespan(we.text);break}case"br":{oe+=ie.br();break}case"del":{oe+=ie.del(this.parseInline(we.tokens,ie));break}case"text":{oe+=ie.text(we.text);break}default:{var Je='Token with "'+we.type+'" type was not found.';if(this.options.silent){console.error(Je);return}else throw new Error(Je)}}}return oe},ge}(),wt=Q.merge,Et=Q.checkSanitizeDeprecation,Se=Q.escape,xe=U.getDefaults,Ke=U.changeDefaults,Ve=U.defaults;function De(ge,de,ce){if(typeof ge=="undefined"||ge===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ge!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ge)+", string expected");if(typeof de=="function"&&(ce=de,de=null),de=wt({},De.defaults,de||{}),Et(de),ce){var ne=de.highlight,ie;try{ie=$e.lex(ge,de)}catch(ke){return ce(ke)}var oe=function(Je){var bt;if(!Je)try{bt=yt.parse(ie,de)}catch(It){Je=It}return de.highlight=ne,Je?ce(Je):ce(null,bt)};if(!ne||ne.length<3)return oe();if(delete de.highlight,!ie.length)return oe();var ue=0;De.walkTokens(ie,function(ke){ke.type==="code"&&(ue++,setTimeout(function(){ne(ke.text,ke.lang,function(Je,bt){if(Je)return oe(Je);bt!=null&&bt!==ke.text&&(ke.text=bt,ke.escaped=!0),ue--,ue===0&&oe()})},0))}),ue===0&&oe();return}try{var we=$e.lex(ge,de);return de.walkTokens&&De.walkTokens(we,de.walkTokens),yt.parse(we,de)}catch(ke){if(ke.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,de.silent)return"<p>An error occurred:</p><pre>"+Se(ke.message+"",!0)+"</pre>";throw ke}}De.options=De.setOptions=function(ge){return wt(De.defaults,ge),Ke(De.defaults),De},De.getDefaults=xe,De.defaults=Ve,De.use=function(ge){var de=wt({},ge);if(ge.renderer&&function(){var ne=De.defaults.renderer||new et,ie=function(we){var ke=ne[we];ne[we]=function(){for(var Je=arguments.length,bt=new Array(Je),It=0;It<Je;It++)bt[It]=arguments[It];var Ge=ge.renderer[we].apply(ne,bt);return Ge===!1&&(Ge=ke.apply(ne,bt)),Ge}};for(var oe in ge.renderer)ie(oe);de.renderer=ne}(),ge.tokenizer&&function(){var ne=De.defaults.tokenizer||new ye,ie=function(we){var ke=ne[we];ne[we]=function(){for(var Je=arguments.length,bt=new Array(Je),It=0;It<Je;It++)bt[It]=arguments[It];var Ge=ge.tokenizer[we].apply(ne,bt);return Ge===!1&&(Ge=ke.apply(ne,bt)),Ge}};for(var oe in ge.tokenizer)ie(oe);de.tokenizer=ne}(),ge.walkTokens){var ce=De.defaults.walkTokens;de.walkTokens=function(ne){ge.walkTokens(ne),ce&&ce(ne)}}De.setOptions(de)},De.walkTokens=function(ge,de){for(var ce=N(ge),ne;!(ne=ce()).done;){var ie=ne.value;de(ie);switch(ie.type){case"table":{for(var oe=N(ie.tokens.header),ue;!(ue=oe()).done;){var we=ue.value;De.walkTokens(we,de)}for(var ke=N(ie.tokens.cells),Je;!(Je=ke()).done;)for(var bt=Je.value,It=N(bt),Ge;!(Ge=It()).done;){var it=Ge.value;De.walkTokens(it,de)}break}case"list":{De.walkTokens(ie.items,de);break}default:ie.tokens&&De.walkTokens(ie.tokens,de)}}},De.Parser=yt,De.parser=yt.parse,De.Renderer=et,De.TextRenderer=nt,De.Lexer=$e,De.lexer=$e.lex,De.Tokenizer=ye,De.Slugger=Rt,De.parse=De;var We=De;return We})},"DlR+":function(Fe,Ce,j){var J=j("MFOe"),K=J.Global,R=J.trim;Fe.exports={name:"cookieStorage",read:N,write:U,each:x,remove:I,clearAll:E};var H=K.document;function N(f){if(!f||!L(f))return null;var S="(?:^|.*;\\s*)"+escape(f).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(H.cookie.replace(new RegExp(S),"$1"))}function x(f){for(var S=H.cookie.split(/; ?/g),P=S.length-1;P>=0;P--){if(!R(S[P]))continue;var T=S[P].split("="),p=unescape(T[0]),m=unescape(T[1]);f(m,p)}}function U(f,S){if(!f)return;H.cookie=escape(f)+"="+escape(S)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/"}function I(f){if(!f||!L(f))return;H.cookie=escape(f)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/"}function E(){x(function(f,S){I(S)})}function L(f){return new RegExp("(?:^|;\\s*)"+escape(f).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(H.cookie)}},EHPI:function(Fe,Ce,j){"use strict";var J=j("bbsP"),K=j("/wGt"),R=j("tJVT"),H=j("k1fw"),N=j("q1tI"),x=j.n(N),U=j("ZW9T"),I=j("ZD9Y"),E=j("M8RZ"),L=j("bCnd"),f=j("fcyK"),S=j.n(f),P={theme:Object(L.a)("cmCodeMode","vs-dark"),fontSize:Object(L.a)("cmFontSize",14),showEditorSetting:!1,tabToSpace:Object(L.a)("cmTabToSpace",!0)},T;(function(i){i[i.set_font_size=0]="set_font_size",i[i.set_theme=1]="set_theme",i[i.on_tab_to_space=2]="on_tab_to_space",i[i.set_show_editor_setting=3]="set_show_editor_setting"})(T||(T={}));function p(i,a){switch(a.type){case T.set_show_editor_setting:return Object(H.a)(Object(H.a)({},i),{},{showEditorSetting:a.payload});case T.set_theme:return Object(H.a)(Object(H.a)({},i),{},{theme:a.payload});case T.set_font_size:return Object(H.a)(Object(H.a)({},i),{},{fontSize:a.payload});case T.on_tab_to_space:return Object(H.a)(Object(H.a)({},i),{},{tabToSpace:a.payload});default:throw new Error}}Ce.a=function(i){var a=i.value,u=i.onChange,c=i.language,O=i.ActionBarRender,b=O===void 0?function(F){return x.a.createElement(m,{onShowCodeSetting:F})}:O,y=Object(N.useReducer)(p,P),D=Object(R.a)(y,2),_=D[0],h=D[1],d=_.theme,o=_.fontSize,s=_.showEditorSetting,w=_.tabToSpace,C={onFontSizeChange:function(Q){h({type:T.set_font_size,payload:Q}),Object(L.b)("cmFontSize",Q)},tabToSpace:w,cmFontSize:o,className:"oj",cmCodeMode:d,onTabToSpace:function(Q){h({type:T.on_tab_to_space,payload:Q}),Object(L.b)("cmTabToSpace",Q)},onCodeModeChange:function(Q){h({type:T.set_theme,payload:Q}),Object(L.b)("cmCodeMode",Q)}};function v(){h({type:T.set_show_editor_setting,payload:!1})}function M(){h({type:T.set_show_editor_setting,payload:!0})}var B={value:a,language:c,onChange:u,theme:d,height:"calc(100% - 56px)",options:{fontSize:o,insertSpaces:w}};return x.a.createElement(N.Fragment,null,x.a.createElement("div",{className:"code-panel-container"},b(M),x.a.createElement(U.b,B)),x.a.createElement(E.a,null,x.a.createElement(K.a,{className:"oj",title:null,placement:"right",closable:!1,visible:s,onClose:v},x.a.createElement(I.a,C))))};function m(i){var a=i.onShowCodeSetting;return x.a.createElement("div",{className:"action-bar"},x.a.createElement("span",null,"\u5B66\u5458\u521D\u59CB\u4EE3\u7801\u6587\u4EF6"),x.a.createElement("a",{onClick:a},x.a.createElement("i",{className:"iconfont icon-shezhi"})))}},ELLl:function(Fe,Ce,j){(function(J){J(j("VrN/"))})(function(J){var K={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},R=J.Pos;J.defineOption("autoCloseBrackets",!1,function(p,m,i){i&&i!=J.Init&&(p.removeKeyMap(N),p.state.closeBrackets=null),m&&(x(H(m,"pairs")),p.state.closeBrackets=m,p.addKeyMap(N))});function H(p,m){return m=="pairs"&&typeof p=="string"?p:typeof p=="object"&&p[m]!=null?p[m]:K[m]}var N={Backspace:E,Enter:L};function x(p){for(var m=0;m<p.length;m++){var i=p.charAt(m),a="'"+i+"'";N[a]||(N[a]=U(i))}}x(K.pairs+"`");function U(p){return function(m){return S(m,p)}}function I(p){var m=p.state.closeBrackets;if(!m||m.override)return m;var i=p.getModeAt(p.getCursor());return i.closeBrackets||m}function E(p){var m=I(p);if(!m||p.getOption("disableInput"))return J.Pass;for(var i=H(m,"pairs"),a=p.listSelections(),u=0;u<a.length;u++){if(!a[u].empty())return J.Pass;var c=P(p,a[u].head);if(!c||i.indexOf(c)%2!=0)return J.Pass}for(var u=a.length-1;u>=0;u--){var O=a[u].head;p.replaceRange("",R(O.line,O.ch-1),R(O.line,O.ch+1),"+delete")}}function L(p){var m=I(p),i=m&&H(m,"explode");if(!i||p.getOption("disableInput"))return J.Pass;for(var a=p.listSelections(),u=0;u<a.length;u++){if(!a[u].empty())return J.Pass;var c=P(p,a[u].head);if(!c||i.indexOf(c)%2!=0)return J.Pass}p.operation(function(){var O=p.lineSeparator()||`
|
|
`;p.replaceSelection(O+O,null),p.execCommand("goCharLeft"),a=p.listSelections();for(var b=0;b<a.length;b++){var y=a[b].head.line;p.indentLine(y,null,!0),p.indentLine(y+1,null,!0)}})}function f(p){var m=J.cmpPos(p.anchor,p.head)>0;return{anchor:new R(p.anchor.line,p.anchor.ch+(m?-1:1)),head:new R(p.head.line,p.head.ch+(m?1:-1))}}function S(p,m){var i=I(p);if(!i||p.getOption("disableInput"))return J.Pass;var a=H(i,"pairs"),u=a.indexOf(m);if(u==-1)return J.Pass;for(var c=H(i,"closeBefore"),O=H(i,"triples"),b=a.charAt(u+1)==m,y=p.listSelections(),D=u%2==0,_,h=0;h<y.length;h++){var d=y[h],o=d.head,s,w=p.getRange(o,R(o.line,o.ch+1));if(D&&!d.empty())s="surround";else if((b||!D)&&w==m)b&&T(p,o)?s="both":O.indexOf(m)>=0&&p.getRange(o,R(o.line,o.ch+3))==m+m+m?s="skipThree":s="skip";else if(b&&o.ch>1&&O.indexOf(m)>=0&&p.getRange(R(o.line,o.ch-2),o)==m+m){if(o.ch>2&&/\bstring/.test(p.getTokenTypeAt(R(o.line,o.ch-2))))return J.Pass;s="addFour"}else if(b){var C=o.ch==0?" ":p.getRange(R(o.line,o.ch-1),o);if(!J.isWordChar(w)&&C!=m&&!J.isWordChar(C))s="both";else return J.Pass}else if(D&&(w.length===0||/\s/.test(w)||c.indexOf(w)>-1))s="both";else return J.Pass;if(!_)_=s;else if(_!=s)return J.Pass}var v=u%2?a.charAt(u-1):m,M=u%2?m:a.charAt(u+1);p.operation(function(){if(_=="skip")p.execCommand("goCharRight");else if(_=="skipThree")for(var B=0;B<3;B++)p.execCommand("goCharRight");else if(_=="surround"){for(var F=p.getSelections(),B=0;B<F.length;B++)F[B]=v+F[B]+M;p.replaceSelections(F,"around"),F=p.listSelections().slice();for(var B=0;B<F.length;B++)F[B]=f(F[B]);p.setSelections(F)}else _=="both"?(p.replaceSelection(v+M,null),p.triggerElectric(v+M),p.execCommand("goCharLeft")):_=="addFour"&&(p.replaceSelection(v+v+v+v,"before"),p.execCommand("goCharRight"))})}function P(p,m){var i=p.getRange(R(m.line,m.ch-1),R(m.line,m.ch+1));return i.length==2?i:null}function T(p,m){var i=p.getTokenAt(R(m.line,m.ch+1));return/\bstring/.test(i.type)&&i.start==m.ch&&(m.ch==0||!/\bstring/.test(p.getTokenTypeAt(m)))}})},FOrL:function(Fe,Ce,j){Fe.exports=j.p+"static/nodata.a6b3f948.png"},Gytx:function(Fe,Ce){Fe.exports=function(J,K,R,H){var N=R?R.call(H,J,K):void 0;if(N!==void 0)return!!N;if(J===K)return!0;if(typeof J!="object"||!J||typeof K!="object"||!K)return!1;var x=Object.keys(J),U=Object.keys(K);if(x.length!==U.length)return!1;for(var I=Object.prototype.hasOwnProperty.bind(K),E=0;E<x.length;E++){var L=x[E];if(!I(L))return!1;var f=J[L],S=K[L];if(N=R?R.call(H,f,S,L):void 0,N===!1||N===void 0&&f!==S)return!1}return!0}},H2Ag:function(Fe,Ce,j){Fe.exports={"left-panel":"left-panel___19pOi","tab-panel-body":"tab-panel-body___1Wa4B","s-navs":"s-navs___Rtxdn","bg-white":"bg-white___3Or1a",active:"active___x-fRG"}},H38U:function(Fe,Ce,j){var J=j("f4xo"),K=j("rcnY"),R=j("wU8J"),H=j("Iq15"),N=j("dWSS");function x(I,E){this.typeNumber=I,this.errorCorrectLevel=E,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var U=x.prototype;U.addData=function(I){var E=new J(I);this.dataList.push(E),this.dataCache=null},U.isDark=function(I,E){if(I<0||this.moduleCount<=I||E<0||this.moduleCount<=E)throw new Error(I+","+E);return this.modules[I][E]},U.getModuleCount=function(){return this.moduleCount},U.make=function(){if(this.typeNumber<1){var I=1;for(I=1;I<40;I++){for(var E=K.getRSBlocks(I,this.errorCorrectLevel),L=new R,f=0,S=0;S<E.length;S++)f+=E[S].dataCount;for(var S=0;S<this.dataList.length;S++){var P=this.dataList[S];L.put(P.mode,4),L.put(P.getLength(),H.getLengthInBits(P.mode,I)),P.write(L)}if(L.getLengthInBits()<=f*8)break}this.typeNumber=I}this.makeImpl(!1,this.getBestMaskPattern())},U.makeImpl=function(I,E){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var L=0;L<this.moduleCount;L++){this.modules[L]=new Array(this.moduleCount);for(var f=0;f<this.moduleCount;f++)this.modules[L][f]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(I,E),this.typeNumber>=7&&this.setupTypeNumber(I),this.dataCache==null&&(this.dataCache=x.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,E)},U.setupPositionProbePattern=function(I,E){for(var L=-1;L<=7;L++){if(I+L<=-1||this.moduleCount<=I+L)continue;for(var f=-1;f<=7;f++){if(E+f<=-1||this.moduleCount<=E+f)continue;0<=L&&L<=6&&(f==0||f==6)||0<=f&&f<=6&&(L==0||L==6)||2<=L&&L<=4&&2<=f&&f<=4?this.modules[I+L][E+f]=!0:this.modules[I+L][E+f]=!1}}},U.getBestMaskPattern=function(){for(var I=0,E=0,L=0;L<8;L++){this.makeImpl(!0,L);var f=H.getLostPoint(this);(L==0||I>f)&&(I=f,E=L)}return E},U.createMovieClip=function(I,E,L){var f=I.createEmptyMovieClip(E,L),S=1;this.make();for(var P=0;P<this.modules.length;P++)for(var T=P*S,p=0;p<this.modules[P].length;p++){var m=p*S,i=this.modules[P][p];i&&(f.beginFill(0,100),f.moveTo(m,T),f.lineTo(m+S,T),f.lineTo(m+S,T+S),f.lineTo(m,T+S),f.endFill())}return f},U.setupTimingPattern=function(){for(var I=8;I<this.moduleCount-8;I++){if(this.modules[I][6]!=null)continue;this.modules[I][6]=I%2==0}for(var E=8;E<this.moduleCount-8;E++){if(this.modules[6][E]!=null)continue;this.modules[6][E]=E%2==0}},U.setupPositionAdjustPattern=function(){for(var I=H.getPatternPosition(this.typeNumber),E=0;E<I.length;E++)for(var L=0;L<I.length;L++){var f=I[E],S=I[L];if(this.modules[f][S]!=null)continue;for(var P=-2;P<=2;P++)for(var T=-2;T<=2;T++)P==-2||P==2||T==-2||T==2||P==0&&T==0?this.modules[f+P][S+T]=!0:this.modules[f+P][S+T]=!1}},U.setupTypeNumber=function(I){for(var E=H.getBCHTypeNumber(this.typeNumber),L=0;L<18;L++){var f=!I&&(E>>L&1)==1;this.modules[Math.floor(L/3)][L%3+this.moduleCount-8-3]=f}for(var L=0;L<18;L++){var f=!I&&(E>>L&1)==1;this.modules[L%3+this.moduleCount-8-3][Math.floor(L/3)]=f}},U.setupTypeInfo=function(I,E){for(var L=this.errorCorrectLevel<<3|E,f=H.getBCHTypeInfo(L),S=0;S<15;S++){var P=!I&&(f>>S&1)==1;S<6?this.modules[S][8]=P:S<8?this.modules[S+1][8]=P:this.modules[this.moduleCount-15+S][8]=P}for(var S=0;S<15;S++){var P=!I&&(f>>S&1)==1;S<8?this.modules[8][this.moduleCount-S-1]=P:S<9?this.modules[8][15-S-1+1]=P:this.modules[8][15-S-1]=P}this.modules[this.moduleCount-8][8]=!I},U.mapData=function(I,E){for(var L=-1,f=this.moduleCount-1,S=7,P=0,T=this.moduleCount-1;T>0;T-=2)for(T==6&&T--;;){for(var p=0;p<2;p++)if(this.modules[f][T-p]==null){var m=!1;P<I.length&&(m=(I[P]>>>S&1)==1);var i=H.getMask(E,f,T-p);i&&(m=!m),this.modules[f][T-p]=m,S--,S==-1&&(P++,S=7)}if(f+=L,f<0||this.moduleCount<=f){f-=L,L=-L;break}}},x.PAD0=236,x.PAD1=17,x.createData=function(I,E,L){for(var f=K.getRSBlocks(I,E),S=new R,P=0;P<L.length;P++){var T=L[P];S.put(T.mode,4),S.put(T.getLength(),H.getLengthInBits(T.mode,I)),T.write(S)}for(var p=0,P=0;P<f.length;P++)p+=f[P].dataCount;if(S.getLengthInBits()>p*8)throw new Error("code length overflow. ("+S.getLengthInBits()+">"+p*8+")");for(S.getLengthInBits()+4<=p*8&&S.put(0,4);S.getLengthInBits()%8!=0;)S.putBit(!1);for(;!(S.getLengthInBits()>=p*8);){if(S.put(x.PAD0,8),S.getLengthInBits()>=p*8)break;S.put(x.PAD1,8)}return x.createBytes(S,f)},x.createBytes=function(I,E){for(var L=0,f=0,S=0,P=new Array(E.length),T=new Array(E.length),p=0;p<E.length;p++){var m=E[p].dataCount,i=E[p].totalCount-m;f=Math.max(f,m),S=Math.max(S,i),P[p]=new Array(m);for(var a=0;a<P[p].length;a++)P[p][a]=255&I.buffer[a+L];L+=m;var u=H.getErrorCorrectPolynomial(i),c=new N(P[p],u.getLength()-1),O=c.mod(u);T[p]=new Array(u.getLength()-1);for(var a=0;a<T[p].length;a++){var b=a+O.getLength()-T[p].length;T[p][a]=b>=0?O.get(b):0}}for(var y=0,a=0;a<E.length;a++)y+=E[a].totalCount;for(var D=new Array(y),_=0,a=0;a<f;a++)for(var p=0;p<E.length;p++)a<P[p].length&&(D[_++]=P[p][a]);for(var a=0;a<S;a++)for(var p=0;p<E.length;p++)a<T[p].length&&(D[_++]=T[p][a]);return D},Fe.exports=x},HmJG:function(Fe,Ce,j){},I8Z2:function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return H}),j.d(Ce,"b",function(){return P}),j.d(Ce,"c",function(){return p});var J=j("q1tI"),K=function(){var m=function(i,a){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,c){u.__proto__=c}||function(u,c){for(var O in c)c.hasOwnProperty(O)&&(u[O]=c[O])},m(i,a)};return function(i,a){m(i,a);function u(){this.constructor=i}i.prototype=a===null?Object.create(a):(u.prototype=a.prototype,new u)}}(),R=J.createContext(null),H=function(m){K(i,m);function i(){return m!==null&&m.apply(this,arguments)||this}return i.prototype.render=function(){return J.createElement(R.Provider,{value:this.props.store},this.props.children)},i}(J.Component),N=j("Gytx"),x=j.n(N),U=j("2mql"),I=j.n(U),E=function(){var m=function(i,a){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,c){u.__proto__=c}||function(u,c){for(var O in c)c.hasOwnProperty(O)&&(u[O]=c[O])},m(i,a)};return function(i,a){m(i,a);function u(){this.constructor=i}i.prototype=a===null?Object.create(a):(u.prototype=a.prototype,new u)}}(),L=function(){return L=Object.assign||function(m){for(var i,a=1,u=arguments.length;a<u;a++){i=arguments[a];for(var c in i)Object.prototype.hasOwnProperty.call(i,c)&&(m[c]=i[c])}return m},L.apply(this,arguments)};function f(m){return m.displayName||m.name||"Component"}var S=function(){return{}};function P(m,i){i===void 0&&(i={});var a=!!m,u=m||S;return function(O){var b=function(D){E(_,D);function _(h,d){var o=D.call(this,h,d)||this;return o.unsubscribe=null,o.handleChange=function(){if(!o.unsubscribe)return;var s=u(o.store.getState(),o.props);o.setState({subscribed:s})},o.store=o.context,o.state={subscribed:u(o.store.getState(),h),store:o.store,props:h},o}return _.getDerivedStateFromProps=function(h,d){return m&&m.length===2&&h!==d.props?{subscribed:u(d.store.getState(),h),props:h}:{props:h}},_.prototype.componentDidMount=function(){this.trySubscribe()},_.prototype.componentWillUnmount=function(){this.tryUnsubscribe()},_.prototype.shouldComponentUpdate=function(h,d){return!x()(this.props,h)||!x()(this.state.subscribed,d.subscribed)},_.prototype.trySubscribe=function(){a&&(this.unsubscribe=this.store.subscribe(this.handleChange),this.handleChange())},_.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null)},_.prototype.render=function(){var h=L(L(L({},this.props),this.state.subscribed),{store:this.store});return J.createElement(O,L({},h,{ref:this.props.miniStoreForwardedRef}))},_.displayName="Connect("+f(O)+")",_.contextType=R,_}(J.Component);if(i.forwardRef){var y=J.forwardRef(function(D,_){return J.createElement(b,L({},D,{miniStoreForwardedRef:_}))});return I()(y,O)}return I()(b,O)}}var T=function(){return T=Object.assign||function(m){for(var i,a=1,u=arguments.length;a<u;a++){i=arguments[a];for(var c in i)Object.prototype.hasOwnProperty.call(i,c)&&(m[c]=i[c])}return m},T.apply(this,arguments)};function p(m){var i=m,a=[];function u(b){i=T(T({},i),b);for(var y=0;y<a.length;y++)a[y]()}function c(){return i}function O(b){return a.push(b),function(){var D=a.indexOf(b);a.splice(D,1)}}return{setState:u,getState:c,subscribe:O}}},IBYe:function(Fe,Ce,j){"use strict";function J(K){return null}Ce.a=J},Iq15:function(Fe,Ce,j){var J=j("nVVt"),K=j("dWSS"),R=j("dQei"),H={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},N={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,G18:1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,G15_MASK:1<<14|1<<12|1<<10|1<<4|1<<1,getBCHTypeInfo:function(x){for(var U=x<<10;N.getBCHDigit(U)-N.getBCHDigit(N.G15)>=0;)U^=N.G15<<N.getBCHDigit(U)-N.getBCHDigit(N.G15);return(x<<10|U)^N.G15_MASK},getBCHTypeNumber:function(x){for(var U=x<<12;N.getBCHDigit(U)-N.getBCHDigit(N.G18)>=0;)U^=N.G18<<N.getBCHDigit(U)-N.getBCHDigit(N.G18);return x<<12|U},getBCHDigit:function(x){for(var U=0;x!=0;)U++,x>>>=1;return U},getPatternPosition:function(x){return N.PATTERN_POSITION_TABLE[x-1]},getMask:function(x,U,I){switch(x){case H.PATTERN000:return(U+I)%2==0;case H.PATTERN001:return U%2==0;case H.PATTERN010:return I%3==0;case H.PATTERN011:return(U+I)%3==0;case H.PATTERN100:return(Math.floor(U/2)+Math.floor(I/3))%2==0;case H.PATTERN101:return U*I%2+U*I%3==0;case H.PATTERN110:return(U*I%2+U*I%3)%2==0;case H.PATTERN111:return(U*I%3+(U+I)%2)%2==0;default:throw new Error("bad maskPattern:"+x)}},getErrorCorrectPolynomial:function(x){for(var U=new K([1],0),I=0;I<x;I++)U=U.multiply(new K([1,R.gexp(I)],0));return U},getLengthInBits:function(x,U){if(1<=U&&U<10)switch(x){case J.MODE_NUMBER:return 10;case J.MODE_ALPHA_NUM:return 9;case J.MODE_8BIT_BYTE:return 8;case J.MODE_KANJI:return 8;default:throw new Error("mode:"+x)}else if(U<27)switch(x){case J.MODE_NUMBER:return 12;case J.MODE_ALPHA_NUM:return 11;case J.MODE_8BIT_BYTE:return 16;case J.MODE_KANJI:return 10;default:throw new Error("mode:"+x)}else if(U<41)switch(x){case J.MODE_NUMBER:return 14;case J.MODE_ALPHA_NUM:return 13;case J.MODE_8BIT_BYTE:return 16;case J.MODE_KANJI:return 12;default:throw new Error("mode:"+x)}else throw new Error("type:"+U)},getLostPoint:function(x){for(var U=x.getModuleCount(),I=0,E=0;E<U;E++)for(var L=0;L<U;L++){for(var f=0,S=x.isDark(E,L),P=-1;P<=1;P++){if(E+P<0||U<=E+P)continue;for(var T=-1;T<=1;T++){if(L+T<0||U<=L+T)continue;if(P==0&&T==0)continue;S==x.isDark(E+P,L+T)&&f++}}f>5&&(I+=3+f-5)}for(var E=0;E<U-1;E++)for(var L=0;L<U-1;L++){var p=0;x.isDark(E,L)&&p++,x.isDark(E+1,L)&&p++,x.isDark(E,L+1)&&p++,x.isDark(E+1,L+1)&&p++,(p==0||p==4)&&(I+=3)}for(var E=0;E<U;E++)for(var L=0;L<U-6;L++)x.isDark(E,L)&&!x.isDark(E,L+1)&&x.isDark(E,L+2)&&x.isDark(E,L+3)&&x.isDark(E,L+4)&&!x.isDark(E,L+5)&&x.isDark(E,L+6)&&(I+=40);for(var L=0;L<U;L++)for(var E=0;E<U-6;E++)x.isDark(E,L)&&!x.isDark(E+1,L)&&x.isDark(E+2,L)&&x.isDark(E+3,L)&&x.isDark(E+4,L)&&!x.isDark(E+5,L)&&x.isDark(E+6,L)&&(I+=40);for(var m=0,L=0;L<U;L++)for(var E=0;E<U;E++)x.isDark(E,L)&&m++;var i=Math.abs(100*m/U/U-50)/5;return I+=i*10,I}};Fe.exports=N},IxHN:function(Fe,Ce,j){"use strict";var J=j("q1tI"),K=j.n(J),R=j("07cG"),H=j.n(R);Ce.a=function(N){var x=N.message,U=N.className,I=N.children,E=N.style,L=E===void 0?{}:E;return K.a.createElement("div",{className:"".concat(H.a.idsRingWrapper," ").concat(U)},K.a.createElement("div",{className:H.a.ldsRing},K.a.createElement("div",null),K.a.createElement("div",null),K.a.createElement("div",null),K.a.createElement("div",null)),x?K.a.createElement("p",{style:L},x):null,I)}},J66h:function(Fe,Ce,j){(function(J){var K,R;(function(H,N){Fe.exports=N(H)})(typeof self!="undefined"?self:typeof window!="undefined"?window:typeof J!="undefined"?J:this,function(H){"use strict";H=H||{};var N=H.Base64,x="2.6.4",U="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",I=function(v){for(var M={},B=0,F=v.length;B<F;B++)M[v.charAt(B)]=B;return M}(U),E=String.fromCharCode,L=function(v){if(v.length<2){var M=v.charCodeAt(0);return M<128?v:M<2048?E(192|M>>>6)+E(128|M&63):E(224|M>>>12&15)+E(128|M>>>6&63)+E(128|M&63)}else{var M=65536+(v.charCodeAt(0)-55296)*1024+(v.charCodeAt(1)-56320);return E(240|M>>>18&7)+E(128|M>>>12&63)+E(128|M>>>6&63)+E(128|M&63)}},f=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,S=function(v){return v.replace(f,L)},P=function(v){var M=[0,2,1][v.length%3],B=v.charCodeAt(0)<<16|(v.length>1?v.charCodeAt(1):0)<<8|(v.length>2?v.charCodeAt(2):0),F=[U.charAt(B>>>18),U.charAt(B>>>12&63),M>=2?"=":U.charAt(B>>>6&63),M>=1?"=":U.charAt(B&63)];return F.join("")},T=H.btoa&&typeof H.btoa=="function"?function(v){return H.btoa(v)}:function(v){if(v.match(/[^\x00-\xFF]/))throw new RangeError("The string contains invalid characters.");return v.replace(/[\s\S]{1,3}/g,P)},p=function(v){return T(S(String(v)))},m=function(v){return v.replace(/[+\/]/g,function(M){return M=="+"?"-":"_"}).replace(/=/g,"")},i=function(v,M){return M?m(p(v)):p(v)},a=function(v){return i(v,!0)},u;H.Uint8Array&&(u=function(v,M){for(var B="",F=0,Q=v.length;F<Q;F+=3){var G=v[F],W=v[F+1],$=v[F+2],re=G<<16|W<<8|$;B+=U.charAt(re>>>18)+U.charAt(re>>>12&63)+(typeof W!="undefined"?U.charAt(re>>>6&63):"=")+(typeof $!="undefined"?U.charAt(re&63):"=")}return M?m(B):B});var c=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,O=function(v){switch(v.length){case 4:var M=(7&v.charCodeAt(0))<<18|(63&v.charCodeAt(1))<<12|(63&v.charCodeAt(2))<<6|63&v.charCodeAt(3),B=M-65536;return E((B>>>10)+55296)+E((B&1023)+56320);case 3:return E((15&v.charCodeAt(0))<<12|(63&v.charCodeAt(1))<<6|63&v.charCodeAt(2));default:return E((31&v.charCodeAt(0))<<6|63&v.charCodeAt(1))}},b=function(v){return v.replace(c,O)},y=function(v){var M=v.length,B=M%4,F=(M>0?I[v.charAt(0)]<<18:0)|(M>1?I[v.charAt(1)]<<12:0)|(M>2?I[v.charAt(2)]<<6:0)|(M>3?I[v.charAt(3)]:0),Q=[E(F>>>16),E(F>>>8&255),E(F&255)];return Q.length-=[0,0,2,1][B],Q.join("")},D=H.atob&&typeof H.atob=="function"?function(v){return H.atob(v)}:function(v){return v.replace(/\S{1,4}/g,y)},_=function(v){return D(String(v).replace(/[^A-Za-z0-9\+\/]/g,""))},h=function(v){return b(D(v))},d=function(v){return String(v).replace(/[-_]/g,function(M){return M=="-"?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,"")},o=function(v){return h(d(v))},s;H.Uint8Array&&(s=function(v){return Uint8Array.from(_(d(v)),function(M){return M.charCodeAt(0)})});var w=function(){var v=H.Base64;return H.Base64=N,v};if(H.Base64={VERSION:x,atob:_,btoa:T,fromBase64:o,toBase64:i,utob:S,encode:i,encodeURI:a,btou:b,decode:o,noConflict:w,fromUint8Array:u,toUint8Array:s},typeof Object.defineProperty=="function"){var C=function(v){return{value:v,enumerable:!1,writable:!0,configurable:!0}};H.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",C(function(){return o(this)})),Object.defineProperty(String.prototype,"toBase64",C(function(v){return i(this,v)})),Object.defineProperty(String.prototype,"toBase64URI",C(function(){return i(this,!0)}))}}return H.Meteor&&(Base64=H.Base64),Fe.exports?Fe.exports.Base64=H.Base64:!(K=[],R=function(){return H.Base64}.apply(Ce,K),R!==void 0&&(Fe.exports=R)),{Base64:H.Base64}})}).call(this,j("IyRk"))},JB8y:function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return J});var J;(function(K){K[K.NOMATCH=-1]="NOMATCH",K[K.OK=0]="OK",K[K.TIMEOUT=2]="TIMEOUT",K[K.PODFAILURE=3]="PODFAILURE",K[K.COMPILEFAILURE=4]="COMPILEFAILURE",K[K.EXECUTEFAILURE=5]="EXECUTEFAILURE"})(J||(J={}))},JPnl:function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return y}),j.d(Ce,"c",function(){return h});var J=j("+L6B"),K=j("2/Rp"),R=j("tJVT"),H=j("k1fw"),N=j("jrin"),x=j("5NDa"),U=j("5rEg"),I=j("q1tI"),E=j.n(I),L=j("8Skl"),f=j("y3Kf"),S=j("JB8y"),P=j("J66h"),T=j.n(P),p=j("a4uL"),m=j.n(p),i=j("IxHN"),a=j("9Bee"),u=j("1vsH"),c,O=U.a.TextArea,b={visible:!1,tabIndex:"0"},y=(c={},Object(N.a)(c,S.a.NOMATCH,"\u6D4B\u8BD5\u7528\u4F8B\u7ED3\u679C\u4E0D\u5339\u914D"),Object(N.a)(c,S.a.OK,"\u8C03\u8BD5\u901A\u8FC7"),Object(N.a)(c,2,"\u8C03\u8BD5\u8D85\u65F6"),Object(N.a)(c,3,"\u8C03\u8BD5pod\u5931\u8D25"),Object(N.a)(c,4,"\u7F16\u8BD1\u5931\u8D25"),Object(N.a)(c,5,"\u6267\u884C\u5931\u8D25"),c),D;(function(o){o[o.SET_VISIBLE=0]="SET_VISIBLE",o[o.SET_TABINDEX=1]="SET_TABINDEX"})(D||(D={}));function _(o,s){switch(s.type){case D.SET_VISIBLE:return Object(H.a)(Object(H.a)({},o),{},{visible:s.payload});case D.SET_TABINDEX:return Object(H.a)(Object(H.a)({},o),{},{tabIndex:s.payload});default:throw new Error}}function h(o){var s=o.status,w=o.error_msg,C=o.output,v=o.input,M=o.expected_output,B=o.is_file,F=o.input_file_url,Q=o.output_file_url,G=o.expected_output_file_url,W=null,$={minHeight:150,marginBottom:10,paddingLeft:24,background:"#070f19",color:"#fff"};switch(s){case S.a.NOMATCH:W=E.a.createElement(E.a.Fragment,null,E.a.createElement("p",{className:"c-red"},"\u5B9E\u9645\u8F93\u5165\uFF1A"),!B&&E.a.createElement(a.a,{value:v,style:$}),B&&E.a.createElement("div",{style:$},E.a.createElement("a",{onClick:function(){return Object(u.w)(F,v)}},v)),E.a.createElement("p",{className:"c-red"},"\u5B9E\u9645\u8F93\u51FA\uFF1A"),!B&&E.a.createElement(a.a,{value:C&&P.Base64.decode(C)||"",style:$}),B&&E.a.createElement("div",{style:$},E.a.createElement("a",{onClick:function(){return Object(u.w)(Q,C)}},C)),E.a.createElement("p",{className:"c-red"},"\u9884\u671F\u8F93\u51FA\uFF1A"),!B&&E.a.createElement(a.a,{value:M&&P.Base64.decode(M)||"",style:$}),B&&E.a.createElement("div",{style:$},E.a.createElement("a",{onClick:function(){return Object(u.w)(G,M)}},M)));break;case S.a.EXECUTEFAILURE:W=E.a.createElement(E.a.Fragment,null,E.a.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A"),!B&&E.a.createElement(a.a,{value:v,style:$}),B&&E.a.createElement("div",{style:$},E.a.createElement("a",{onClick:function(){return Object(u.w)(F,v)}},v)),E.a.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),E.a.createElement("pre",{className:"error"},P.Base64.decode(w)));break;case S.a.COMPILEFAILURE:W=E.a.createElement(E.a.Fragment,null,E.a.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A"),!B&&E.a.createElement(a.a,{value:v,style:$}),B&&E.a.createElement("div",{style:$},E.a.createElement("a",{onClick:function(){return Object(u.w)(F,v)}},v)),E.a.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),E.a.createElement("pre",{className:"error"},P.Base64.decode(w)));break;case S.a.PODFAILURE:W=E.a.createElement("p",null,"\u521B\u5EFApod\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break;case S.a.TIMEOUT:W=E.a.createElement("p",null,"\u8BC4\u6D4B\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break}return E.a.createElement(E.a.Fragment,null," ",W," ")}function d(o){var s=o.status,w=o.error_msg,C=o.execute_time,v=o.output,M=o.input,B=o.expected_output,F=o.is_file,Q=o.input_file_url,G=o.output_file_url,W=o.expected_output_file_url,$=null;switch(s){case S.a.OK:$=E.a.createElement(E.a.Fragment,null,E.a.createElement("p",null,"\u6267\u884C\u7528\u65F6\uFF1A",C),E.a.createElement("p",null,"\u6267\u884C\u7ED3\u679C\uFF1A"),E.a.createElement("pre",null,P.Base64.decode(v)));break;case S.a.NOMATCH:$=E.a.createElement(E.a.Fragment,null,E.a.createElement("p",null,"\u8F93\u5165\uFF1A",E.a.createElement("pre",null,M)),E.a.createElement("p",null,"\u8F93\u51FA\uFF1A",v&&P.Base64.decode(v)),E.a.createElement("p",null,"\u9884\u671F\u8F93\u51FA\uFF1A",B&&P.Base64.decode(B)));break;case S.a.EXECUTEFAILURE:$=E.a.createElement(E.a.Fragment,null,E.a.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A",E.a.createElement("pre",null,M)),E.a.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),E.a.createElement("pre",{className:"error"},P.Base64.decode(w)));break;case S.a.COMPILEFAILURE:$=E.a.createElement(E.a.Fragment,null,E.a.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A",E.a.createElement("pre",null,M)),E.a.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),E.a.createElement("pre",{className:"error"},P.Base64.decode(w)));break;case S.a.PODFAILURE:$=E.a.createElement("p",null,"\u521B\u5EFApod\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break;case S.a.TIMEOUT:$=E.a.createElement("p",null,"\u8BC4\u6D4B\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break}return E.a.createElement(E.a.Fragment,null," ",$," ")}Ce.b=function(o){var s=o.input,w=o.debuging,C=o.submitting,v=o.executingMessage,M=o.debugResult,B=o.onChangeInput,F=o.onDebugCode,Q=o.onSubmitCode,G=Object(I.useReducer)(_,b),W=Object(R.a)(G,2),$=W[0],re=W[1],ae=$.visible,he=$.tabIndex;function Te(_e){var fe=_e.target.id;re({type:D.SET_TABINDEX,payload:fe})}function ye(){re({type:D.SET_VISIBLE,payload:!ae})}var Ee=Object(I.useMemo)(function(){if(M){var _e=M.status;return E.a.createElement(E.a.Fragment,null,d(M))}return null},[M]);function Oe(){re({type:D.SET_VISIBLE,payload:!0}),re({type:D.SET_TABINDEX,payload:"1"}),F()}return E.a.createElement("div",{className:"test-case-panel"},E.a.createElement("div",{className:"test-case-panel-body ".concat(ae?"active":"")},E.a.createElement("ul",{className:"s-navs"},E.a.createElement("li",null,E.a.createElement("a",{className:he==="0"?"active":"",id:"0",onClick:Te},"\u81EA\u5B9A\u4E49\u6D4B\u8BD5\u7528\u4F8B")),E.a.createElement("li",null,E.a.createElement("a",{className:he==="1"?"active":"",id:"1",onClick:Te},"\u4EE3\u7801\u6267\u884C\u7ED3\u679C"))),E.a.createElement("div",{className:"tab-panel-body ".concat(he==="0"?"":"hide")},E.a.createElement(O,{placeholder:"\u8BF7\u586B\u5199\u6D4B\u8BD5\u7528\u4F8B\u7684\u8F93\u5165\u503C\uFF0C\u70B9\u51FB\u201C\u8C03\u8BD5\u4EE3\u7801\u201D",value:s,onChange:B})),E.a.createElement("div",{className:"tab-panel-body ".concat(he==="1"?"":"hide")},w?E.a.createElement(i.a,{message:v}):M?E.a.createElement("section",{style:{height:200}}," ",Ee," "):E.a.createElement("p",{className:"tip"},"\u8BF7\u586B\u5199\u6D4B\u8BD5\u7528\u4F8B\u7684\u8F93\u5165\u503C\uFF0C\u70B9\u51FB\u201C\u8C03\u8BD5\u4EE3\u7801\u201D"))),E.a.createElement("a",{className:"btn-collapse ".concat(ae?"up":""),onClick:ye},ae?E.a.createElement(L.a,null):E.a.createElement(f.a,null)),E.a.createElement("footer",{className:"footer"},E.a.createElement("span",null,"\u63A7\u5236\u53F0"),E.a.createElement("div",{className:"flex-container"},E.a.createElement(K.a,{className:"btn-green",type:"ghost",loading:w,onClick:Oe},"\u8C03\u8BD5\u4EE3\u7801"),E.a.createElement(K.a,{type:"primary",loading:C,disabled:C,onClick:function(){re({type:D.SET_VISIBLE,payload:!1}),Q()}},"\u8BC4\u6D4B\u5E76\u63D0\u4EA4"))))}},LdHM:function(Fe,Ce,j){"use strict";j.d(Ce,"b",function(){return c}),j.d(Ce,"a",function(){return b});var J=j("1OyB"),K=j("vuIU"),R=j("Ji7U"),H=j("LK+K"),N=j("q1tI"),x=j("rePB"),U=j("Ff2n"),I=j("ODXe"),E=j("4IlW"),L=j("bX4T"),f=j("YrtM"),S=j("TSYQ"),P=j.n(S),T=j("+nKL"),p=j("8OUc"),m=function($,re){var ae=$.prefixCls,he=$.id,Te=$.flattenOptions,ye=$.childrenAsData,Ee=$.values,Oe=$.searchValue,_e=$.multiple,fe=$.defaultActiveFirstOption,le=$.height,Me=$.itemHeight,ot=$.notFoundContent,ut=$.open,rt=$.menuItemSelectedIcon,tt=$.virtual,ze=$.onSelect,$e=$.onToggleOpen,ct=$.onActiveValue,vt=$.onScroll,at=$.onMouseEnter,et="".concat(ae,"-item"),nt=Object(f.a)(function(){return Te},[ut,Te],function(We,ge){return ge[0]&&We[1]!==ge[1]}),Rt=N.useRef(null),Ct=function(ge){ge.preventDefault()},xt=function(ge){Rt.current&&Rt.current.scrollTo({index:ge})},yt=function(ge){for(var de=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ce=nt.length,ne=0;ne<ce;ne+=1){var ie=(ge+ne*de+ce)%ce,oe=nt[ie],ue=oe.group,we=oe.data;if(!ue&&!we.disabled)return ie}return-1},wt=N.useState(function(){return yt(0)}),Et=Object(I.a)(wt,2),Se=Et[0],xe=Et[1],Ke=function(ge){xe(ge);var de=nt[ge];if(!de){ct(null,-1);return}ct(de.data.value,ge)};N.useEffect(function(){Ke(fe!==!1?yt(0):-1)},[nt.length,Oe]),N.useEffect(function(){var We=setTimeout(function(){if(!_e&&ut&&Ee.size===1){var ge=Array.from(Ee)[0],de=nt.findIndex(function(ce){var ne=ce.data;return ne.value===ge});Ke(de),xt(de)}});return function(){return clearTimeout(We)}},[ut]);var Ve=function(ge){ge!==void 0&&ze(ge,{selected:!Ee.has(ge)}),_e||$e(!1)};if(N.useImperativeHandle(re,function(){return{onKeyDown:function(ge){var de=ge.which;switch(de){case E.a.UP:case E.a.DOWN:{var ce=0;if(de===E.a.UP?ce=-1:de===E.a.DOWN&&(ce=1),ce!==0){var ne=yt(Se+ce,ce);xt(ne),Ke(ne)}break}case E.a.ENTER:{var ie=nt[Se];ie&&!ie.data.disabled?Ve(ie.data.value):Ve(void 0),ut&&ge.preventDefault();break}case E.a.ESC:$e(!1)}},onKeyUp:function(){},scrollTo:function(ge){xt(ge)}}}),nt.length===0)return N.createElement("div",{role:"listbox",id:"".concat(he,"_list"),className:"".concat(et,"-empty"),onMouseDown:Ct},ot);function De(We){var ge=nt[We];if(!ge)return null;var de=ge.data||{},ce=de.value,ne=de.label,ie=de.children,oe=Object(L.a)(de,!0),ue=ye?ie:ne;return ge?N.createElement("div",Object.assign({"aria-label":typeof ue=="string"?ue:null},oe,{key:We,role:"option",id:"".concat(he,"_list_").concat(We),"aria-selected":Ee.has(ce)}),ce):null}return N.createElement(N.Fragment,null,N.createElement("div",{role:"listbox",id:"".concat(he,"_list"),style:{height:0,width:0,overflow:"hidden"}},De(Se-1),De(Se),De(Se+1)),N.createElement(T.a,{itemKey:"key",ref:Rt,data:nt,height:le,itemHeight:Me,fullHeight:!1,onMouseDown:Ct,onScroll:vt,virtual:tt,onMouseEnter:at},function(We,ge){var de,ce=We.group,ne=We.groupOption,ie=We.data,oe=ie.label,ue=ie.key;if(ce)return N.createElement("div",{className:P()(et,"".concat(et,"-group"))},oe!==void 0?oe:ue);var we=ie.disabled,ke=ie.value,Je=ie.title,bt=ie.children,It=ie.style,Ge=ie.className,it=Object(U.a)(ie,["disabled","value","title","children","style","className"]),Be=Ee.has(ke),Ue="".concat(et,"-option"),Re=P()(et,Ue,Ge,(de={},Object(x.a)(de,"".concat(Ue,"-grouped"),ne),Object(x.a)(de,"".concat(Ue,"-active"),Se===ge&&!we),Object(x.a)(de,"".concat(Ue,"-disabled"),we),Object(x.a)(de,"".concat(Ue,"-selected"),Be),de)),se=ye?bt:oe,pe=!rt||typeof rt=="function"||Be;return N.createElement("div",Object.assign({},it,{"aria-selected":Be,className:Re,title:Je,onMouseMove:function(){if(Se===ge||we)return;Ke(ge)},onClick:function(){we||Ve(ke)},style:It}),N.createElement("div",{className:"".concat(Ue,"-content")},se||ke),N.isValidElement(rt)||Be,pe&&N.createElement(p.a,{className:"".concat(et,"-option-state"),customizeIcon:rt,customizeIconProps:{isSelected:Be}},Be?"\u2713":null))}))},i=N.forwardRef(m);i.displayName="OptionList";var a=i,u=function(){return null};u.isSelectOption=!0;var c=u,O=function(){return null};O.isSelectOptGroup=!0;var b=O,y=j("VTBJ"),D=j("Zm9Q");function _(W){var $=W.key,re=W.props,ae=re.children,he=re.value,Te=Object(U.a)(re,["children","value"]);return Object(y.a)({key:$,value:he!==void 0?he:$,children:ae},Te)}function h(W){var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(D.a)(W).map(function(re,ae){if(!N.isValidElement(re)||!re.type)return null;var he=re.type.isSelectOptGroup,Te=re.key,ye=re.props,Ee=ye.children,Oe=Object(U.a)(ye,["children"]);return $||!he?_(re):Object(y.a)(Object(y.a)({key:"__RC_SELECT_GRP__".concat(Te===null?ae:Te,"__"),label:Te},Oe),{},{options:h(Ee)})}).filter(function(re){return re})}var d=j("2Qr1"),o=j("qNPg"),s=j("U8pU"),w=j("Kwbf"),C=j("WKfj");function v(W){var $=W.mode,re=W.options,ae=W.children,he=W.backfill,Te=W.allowClear,ye=W.placeholder,Ee=W.getInputElement,Oe=W.showSearch,_e=W.onSearch,fe=W.defaultOpen,le=W.autoFocus,Me=W.labelInValue,ot=W.value,ut=W.inputValue,rt=W.optionLabelProp,tt=$==="multiple"||$==="tags",ze=Oe!==void 0?Oe:tt||$==="combobox",$e=re||h(ae);if(Object(w.a)($!=="tags"||$e.every(function(et){return!et.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),$==="tags"||$==="combobox"){var ct=$e.some(function(et){return et.options?et.options.some(function(nt){return typeof("value"in nt?nt.value:nt.key)=="number"}):typeof("value"in et?et.value:et.key)=="number"});Object(w.a)(!ct,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(w.a)($!=="combobox"||!rt,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(w.a)($==="combobox"||!he,"`backfill` only works with `combobox` mode."),Object(w.a)($==="combobox"||!Ee,"`getInputElement` only work with `combobox` mode."),Object(w.b)($!=="combobox"||!Ee||!Te||!ye,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),_e&&!ze&&$!=="combobox"&&$!=="tags"&&Object(w.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(w.b)(!fe||le,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ot!=null){var vt=Object(C.d)(ot);Object(w.a)(!Me||vt.every(function(et){return Object(s.a)(et)==="object"&&("key"in et||"value"in et)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(w.a)(!tt||Array.isArray(ot),"`value` should be array when `mode` is `multiple` or `tags`")}if(ae){var at=null;Object(D.a)(ae).some(function(et){if(!N.isValidElement(et)||!et.type)return!1;var nt=et.type;if(nt.isSelectOption)return!1;if(nt.isSelectOptGroup){var Rt=Object(D.a)(et.props.children).every(function(Ct){return!N.isValidElement(Ct)||!et.type||Ct.type.isSelectOption?!0:(at=Ct.type,!1)});return!Rt}return at=nt,!0}),at&&Object(w.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(at.displayName||at.name||at,"`.")),Object(w.a)(ut===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var M=v,B=Object(o.a)({prefixCls:"rc-select",components:{optionList:a},convertChildrenToData:h,flattenOptions:d.d,getLabeledValue:d.e,filterOptions:d.b,isValueDisabled:d.g,findValueOption:d.c,warningProps:M,fillOptionsWithMissingValue:d.a}),F=function(W){Object(R.a)(re,W);var $=Object(H.a)(re);function re(){var ae;return Object(J.a)(this,re),ae=$.apply(this,arguments),ae.selectRef=N.createRef(),ae.focus=function(){ae.selectRef.current.focus()},ae.blur=function(){ae.selectRef.current.blur()},ae}return Object(K.a)(re,[{key:"render",value:function(){return N.createElement(B,Object.assign({ref:this.selectRef},this.props))}}]),re}(N.Component);F.Option=c,F.OptGroup=b;var Q=F,G=Ce.c=Q},M8RZ:function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return E});var J=j("fWQN"),K=j("mtLc"),R=j("yKVA"),H=j("879j"),N=j("q1tI"),x=j.n(N),U=j("i8i4"),I=j.n(U),E=function(L){Object(R.a)(S,L);var f=Object(H.a)(S);function S(P){var T;Object(J.a)(this,S),T=f.call(this,P);var p=window.document;return T.node=p.createElement("div"),p.body.appendChild(T.node),T}return Object(K.a)(S,[{key:"render",value:function(){var T=this.props.children;return Object(U.createPortal)(T,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),S}(x.a.Component)},MFOe:function(Fe,Ce,j){(function(J){var K=x(),R=U(),H=I(),N=typeof window!="undefined"?window:J;Fe.exports={assign:K,create:R,trim:H,bind:E,slice:L,each:f,map:S,pluck:P,isList:T,isFunction:p,isObject:m,Global:N};function x(){return Object.assign?Object.assign:function(a,u,c,O){for(var b=1;b<arguments.length;b++)f(Object(arguments[b]),function(y,D){a[D]=y});return a}}function U(){if(Object.create)return function(u,c,O,b){var y=L(arguments,1);return K.apply(this,[Object.create(u)].concat(y))};{function i(){}return function(u,c,O,b){var y=L(arguments,1);return i.prototype=u,K.apply(this,[new i].concat(y))}}}function I(){return String.prototype.trim?function(a){return String.prototype.trim.call(a)}:function(a){return a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}}function E(i,a){return function(){return a.apply(i,Array.prototype.slice.call(arguments,0))}}function L(i,a){return Array.prototype.slice.call(i,a||0)}function f(i,a){P(i,function(u,c){return a(u,c),!1})}function S(i,a){var u=T(i)?[]:{};return P(i,function(c,O){return u[O]=a(c,O),!1}),u}function P(i,a){if(T(i)){for(var u=0;u<i.length;u++)if(a(i[u],u))return i[u]}else for(var c in i)if(i.hasOwnProperty(c)&&a(i[c],c))return i[c]}function T(i){return i!=null&&typeof i!="function"&&typeof i.length=="number"}function p(i){return i&&{}.toString.call(i)==="[object Function]"}function m(i){return i&&{}.toString.call(i)==="[object Object]"}}).call(this,j("IyRk"))},NvD2:function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return x});var J=j("Kwbf");function K(U,I){var E=new Set;return U.forEach(function(L){I.has(L)||E.add(L)}),E}function R(U){var I=U||{},E=I.disabled,L=I.disableCheckbox,f=I.checkable;return!!(E||L)||f===!1}function H(U,I,E,L){for(var f=new Set(U),S=new Set,P=0;P<=E;P+=1){var T=I.get(P)||new Set;T.forEach(function(a){var u=a.key,c=a.node,O=a.children,b=O===void 0?[]:O;f.has(u)&&!L(c)&&b.filter(function(y){return!L(y.node)}).forEach(function(y){f.add(y.key)})})}for(var p=new Set,m=E;m>=0;m-=1){var i=I.get(m)||new Set;i.forEach(function(a){var u=a.parent,c=a.node;if(L(c)||!a.parent||p.has(a.parent.key))return;if(L(a.parent.node)){p.add(u.key);return}var O=!0,b=!1;(u.children||[]).filter(function(y){return!L(y.node)}).forEach(function(y){var D=y.key,_=f.has(D);O&&!_&&(O=!1),!b&&(_||S.has(D))&&(b=!0)}),O&&f.add(u.key),b&&S.add(u.key),p.add(u.key)})}return{checkedKeys:Array.from(f),halfCheckedKeys:Array.from(K(S,f))}}function N(U,I,E,L,f){for(var S=new Set(U),P=new Set(I),T=0;T<=L;T+=1){var p=E.get(T)||new Set;p.forEach(function(u){var c=u.key,O=u.node,b=u.children,y=b===void 0?[]:b;!S.has(c)&&!P.has(c)&&!f(O)&&y.filter(function(D){return!f(D.node)}).forEach(function(D){S.delete(D.key)})})}P=new Set;for(var m=new Set,i=L;i>=0;i-=1){var a=E.get(i)||new Set;a.forEach(function(u){var c=u.parent,O=u.node;if(f(O)||!u.parent||m.has(u.parent.key))return;if(f(u.parent.node)){m.add(c.key);return}var b=!0,y=!1;(c.children||[]).filter(function(D){return!f(D.node)}).forEach(function(D){var _=D.key,h=S.has(_);b&&!h&&(b=!1),!y&&(h||P.has(_))&&(y=!0)}),b||S.delete(c.key),y&&P.add(c.key),m.add(c.key)})}return{checkedKeys:Array.from(S),halfCheckedKeys:Array.from(K(P,S))}}function x(U,I,E,L){var f=[],S;L?S=L:S=R;var P=new Set(U.filter(function(i){var a=!!E[i];return a||f.push(i),a})),T=new Map,p=0;Object.keys(E).forEach(function(i){var a=E[i],u=a.level,c=T.get(u);c||(c=new Set,T.set(u,c)),c.add(a),p=Math.max(p,u)}),Object(J.a)(!f.length,"Tree missing follow keys: ".concat(f.slice(0,100).map(function(i){return"'".concat(i,"'")}).join(", ")));var m;return I===!0?m=H(P,T,p,S):m=N(P,I.halfCheckedKeys,T,p,S),m}},OJz4:function(Fe,Ce,j){"use strict";j.d(Ce,"d",function(){return K}),j.d(Ce,"h",function(){return R}),j.d(Ce,"b",function(){return H}),j.d(Ce,"f",function(){return N}),j.d(Ce,"e",function(){return x}),j.d(Ce,"c",function(){return U}),j.d(Ce,"a",function(){return I}),j.d(Ce,"g",function(){return E}),j.d(Ce,"i",function(){return L}),j.d(Ce,"k",function(){return f}),j.d(Ce,"l",function(){return S}),j.d(Ce,"j",function(){return P});var J=j("ErOA");function K(T){return Object(J.c)("myproblems/".concat(T,".json"),{hidePopLogin:!0})}function R(T,p){return Object(J.f)("myproblems/".concat(T,"/code_submit.json"),p)}function H(T,p){return Object(J.c)("myproblems/".concat(T,"/code_debug.json"),p)}function N(T,p){return Object(J.c)("myproblems/".concat(T,"/submit_records.json"),p)}function x(T){return Object(J.c)("myproblems/record_detail.json",{id:T})}function U(T,p){return Object(J.c)("myproblems/".concat(T,"/result.json"),{mode:p})}function I(T,p){return Object(J.f)("myproblems/".concat(T,"/add_notes.json"),p)}function E(T){return Object(J.f)("myproblems/".concat(T,"/restore_initial_code.json"))}function L(T){return Object(J.f)("myproblems/".concat(T,"/sync_code.json"))}function f(T,p){return Object(J.f)("myproblems/".concat(T,"/update_code.json"),p)}function S(T){return Object(J.f)("myproblems/".concat(T,"/cost_time.json"))}function P(T,p){return Object(J.f)("discusses/".concat(T,"/plus.json"),p)}},OLES:function(Fe,Ce,j){"use strict";var J=j("U8pU"),K=j("VTBJ"),R=j("Ff2n"),H=j("q1tI"),N=j("uciX"),x=j("7ixt"),U=function(P){var T=P.overlay,p=P.prefixCls,m=P.id,i=P.overlayInnerStyle;return H.createElement("div",{className:"".concat(p,"-inner"),id:m,role:"tooltip",style:i},typeof T=="function"?T():T)},I=U,E=function(P,T){var p=P.overlayClassName,m=P.trigger,i=m===void 0?["hover"]:m,a=P.mouseEnterDelay,u=a===void 0?0:a,c=P.mouseLeaveDelay,O=c===void 0?.1:c,b=P.overlayStyle,y=P.prefixCls,D=y===void 0?"rc-tooltip":y,_=P.children,h=P.onVisibleChange,d=P.afterVisibleChange,o=P.transitionName,s=P.animation,w=P.placement,C=w===void 0?"right":w,v=P.align,M=v===void 0?{}:v,B=P.destroyTooltipOnHide,F=B===void 0?!1:B,Q=P.defaultVisible,G=P.getTooltipContainer,W=P.overlayInnerStyle,$=Object(R.a)(P,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),re=Object(H.useRef)(null);Object(H.useImperativeHandle)(T,function(){return re.current});var ae=Object(K.a)({},$);"visible"in P&&(ae.popupVisible=P.visible);var he=function(){var _e=P.arrowContent,fe=_e===void 0?null:_e,le=P.overlay,Me=P.id;return[H.createElement("div",{className:"".concat(D,"-arrow"),key:"arrow"},fe),H.createElement(I,{key:"content",prefixCls:D,id:Me,overlay:le,overlayInnerStyle:W})]},Te=!1,ye=!1;if(typeof F=="boolean")Te=F;else if(F&&Object(J.a)(F)==="object"){var Ee=F.keepParent;Te=Ee===!0,ye=Ee===!1}return H.createElement(N.a,Object.assign({popupClassName:p,prefixCls:D,popup:he,action:i,builtinPlacements:x.a,popupPlacement:C,ref:re,popupAlign:M,getPopupContainer:G,onPopupVisibleChange:h,afterPopupVisibleChange:d,popupTransitionName:o,popupAnimation:s,defaultPopupVisible:Q,destroyPopupOnHide:Te,autoDestroy:ye,mouseLeaveDelay:O,popupStyle:b,mouseEnterDelay:u},ae),_)},L=Object(H.forwardRef)(E),f=Ce.a=L},OZM5:function(Fe,Ce,j){"use strict";j.d(Ce,"b",function(){return L}),j.d(Ce,"a",function(){return f}),j.d(Ce,"k",function(){return S}),j.d(Ce,"h",function(){return P}),j.d(Ce,"i",function(){return T}),j.d(Ce,"g",function(){return p}),j.d(Ce,"c",function(){return m}),j.d(Ce,"d",function(){return i}),j.d(Ce,"j",function(){return c}),j.d(Ce,"e",function(){return O}),j.d(Ce,"f",function(){return b});var J=j("KQm4"),K=j("U8pU"),R=j("Ff2n"),H=j("q1tI"),N=j.n(H),x=j("Kwbf"),U=j("WaYH"),I=.25,E=2;function L(y,D){var _=y.slice(),h=_.indexOf(D);return h>=0&&_.splice(h,1),_}function f(y,D){var _=y.slice();return _.indexOf(D)===-1&&_.push(D),_}function S(y){return y.split("-")}function P(y,D){return"".concat(y,"-").concat(D)}function T(y){return y&&y.type&&y.type.isTreeNode}function p(y,D){var _=[y],h=D[y];function d(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];o.forEach(function(s){var w=s.key,C=s.children;_.push(w),d(C)})}return d(h.children),_}function m(y,D){var _=y.clientY,h=D.selectHandle.getBoundingClientRect(),d=h.top,o=h.bottom,s=h.height,w=Math.max(s*I,E);return _<=d+w?-1:_>=o-w?1:0}function i(y,D){if(!y)return;var _=D.multiple;return _?y.slice():y.length?[y[0]]:y}var a=function(D){return D};function u(y,D){if(!y)return[];var _=D||{},h=_.processProps,d=h===void 0?a:h,o=Array.isArray(y)?y:[y];return o.map(function(s){var w=s.children,C=Object(R.a)(s,["children"]),v=u(w,D);return N.a.createElement(U.a,Object.assign({},d(C)),v)})}function c(y){if(!y)return null;var D;if(Array.isArray(y))D={checkedKeys:y,halfCheckedKeys:void 0};else if(Object(K.a)(y)==="object")D={checkedKeys:y.checked||void 0,halfCheckedKeys:y.halfChecked||void 0};else return Object(x.a)(!1,"`checkedKeys` is not an array or an object"),null;return D}function O(y,D){var _=new Set;function h(d){if(_.has(d))return;var o=D[d];if(!o)return;_.add(d);var s=o.parent,w=o.node;if(w.disabled)return;s&&h(s.key)}return(y||[]).forEach(function(d){h(d)}),Object(J.a)(_)}function b(y){var D={};return Object.keys(y).forEach(function(_){(_.startsWith("data-")||_.startsWith("aria-"))&&(D[_]=y[_])}),D}},Ot1p:function(Fe,Ce,j){"use strict";var J=j("2qtc"),K=j("kLXV"),R=j("rAM+"),H=j("miYZ"),N=j("tsqr"),x=j("9og8"),U=j("tJVT"),I=j("jrin"),E=j("WmNS"),L=j.n(E),f=j("q1tI"),S=j.n(f),P=j("VrN/"),T=j.n(P),p=j("bdgK"),m=j("p77/"),i=j("Bd2K"),a=j("ELLl"),u=j("19Vz"),c=j("lZu9"),O=j("+NIl"),b=j("kSUc"),y=j("9Bee"),D=function(Ge){var it=Ge.value,Be=it===void 0?"":it,Ue=Ge.className,Re=Ge.showTextOnly,se=Ge.showLines,pe=Ge.style,je=pe===void 0?{}:pe,Ie=Object(f.useMemo)(function(){return""},[Be]);return S.a.createElement(S.a.Fragment,null,S.a.createElement("div",{dangerouslySetInnerHTML:{__html:Ie}}))},_=j("Q9mQ"),h=j("diRs"),d=j("0Owb"),o=j("dejd"),s=j("C+DQ"),w=j("D1Df"),C=j.n(w),v=j("1vsH"),M=j("m3rI"),B=[{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 F(Ge){var it=Ge.onActionCallback,Be=Ge.title,Ue=Ge.icon,Re=Ge.actionName,se=Ge.className,pe=se===void 0?"":se,je=Ge.children;function Ie(){it(Re)}return S.a.createElement("a",{title:Be,className:pe,onClick:Ie},S.a.createElement("i",{className:"md-iconfont ".concat(Ue)}),je)}var Q=function(Ge){var it=Ge.watch,Be=Ge.showNullButton,Ue=Ge.onActionCallback,Re=Ge.fullScreen,se=Ge.insertTemp,pe=Ge.hidetoolBar,je=Ge.uuid,Ie=Ge.setOpenPhones,lt=Object(v.E)("_educoder_session_login"),st=Object(v.E)("_educoder_session"),Ae=[].concat(B,[{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 S.a.createElement("ul",{className:"markdown-toolbar-container"},!pe&&Ae.map(function(qe,pt){return S.a.createElement("li",{key:pt},qe.actionName?S.a.createElement(F,Object(d.a)({},qe,{onActionCallback:Ue})):S.a.createElement("span",{className:"v-line"}))}),Be?S.a.createElement("li",null,S.a.createElement(F,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Ue},S.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,se&&S.a.createElement("li",null,S.a.createElement(F,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(se),onActionCallback:Ue},S.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),S.a.createElement("li",null,S.a.createElement(h.a,{title:"\u6253\u5F00\u624B\u673A\u626B\u4E00\u626B",content:S.a.createElement("div",null,S.a.createElement("span",{style:{display:"none"}},"test----",location.origin+"/upload.html?_educoder_session_login="+lt+"&_educoder_session="+st+"&key="+je+"&api="+encodeURIComponent(M.a.API_SERVER)),S.a.createElement(C.a,{size:150,fgColor:"#000",value:location.origin+"/upload.html?_educoder_session_login="+lt+"&_educoder_session="+st+"&key="+je+"&api="+encodeURIComponent(M.a.API_SERVER)}))},S.a.createElement("span",{className:"fill-tip",onMouseOver:function(){return Ie(!0)}},"\u624B\u673A\u4E0A\u4F20\u6587\u4EF6"))),S.a.createElement("li",{className:"btn-full-screen"},S.a.createElement(F,{icon:"".concat(Re?"icon-shrink":"icon-enlarge"),title:Re?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Ue})))},G=j("M8RZ"),W=j("+L6B"),$=j("2/Rp"),re=j("y8nQ"),ae=j("Vl3Y"),he=j("5NDa"),Te=j("5rEg"),ye={labelCol:{span:4},wrapperCol:{span:20}},Ee=function(Ge){var it=Ge.callback,Be=Ge.onCancel;function Ue(Re){it(Re)}return S.a.createElement(ae.a,Object(d.a)({},ye,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Ue}),S.a.createElement(ae.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},S.a.createElement(Te.a,null)),S.a.createElement(ae.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},S.a.createElement(Te.a,null)),S.a.createElement("div",{className:"flex-container flex-end"},S.a.createElement($.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),S.a.createElement($.a,{type:"ghost",onClick:Be},"\u53D6\u6D88")))},Oe=j("7ahc"),_e=j("k1fw"),fe=j("HmJG"),le=j("BjJ7"),Me=ae.a.useForm,ot={width:280,marginRight:10},ut={labelCol:{span:5},wrapperCol:{span:19}},rt=function(Ge){var it=Ge.callback,Be=Ge.onCancel,Ue=Me(),Re=Object(U.a)(Ue,1),se=Re[0],pe=Object(f.useRef)();function je(st){it(Object(_e.a)(Object(_e.a)({},st),{},{name:pe.current}))}function Ie(st,Ae){se.setFieldsValue({src:"/api/attachments/".concat(st.id,"?type=").concat(st.content_type),type:Ae.type})}function lt(st){var Ae=st.target.files[0];pe.current=Ae.name,ze(Ae,Ie)}return S.a.createElement(ae.a,Object(d.a)({form:se},ut,{className:"upload-image-panel",onFinish:je}),S.a.createElement(ae.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},S.a.createElement("div",{className:"flex-container"},S.a.createElement(ae.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},S.a.createElement(Te.a,{style:ot})),S.a.createElement(tt,{onFileChange:lt}))),S.a.createElement(ae.a.Item,{label:"\u6587\u4EF6\u63CF\u8FF0",name:"alt"},S.a.createElement(Te.a,{style:{width:264}})),S.a.createElement(ae.a.Item,{style:{textAlign:"right"}},S.a.createElement($.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),S.a.createElement($.a,{type:"ghost",onClick:Be},"\u53D6\u6D88")))};function tt(Ge){var it=Ge.onFileChange;return S.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",S.a.createElement("input",{type:"file",onChange:it}))}function ze(Ge,it){if(!Ge)throw new String("\u6CA1\u6709\u6587\u4EF6");var Be=new FormData;Be.append("editormd-image-file",Ge),Be.append("file_param_name","editormd-image-file"),Be.append("byxhr","true");var Ue=new window.XMLHttpRequest;Ue.withCredentials=!0,Ue.addEventListener("load",function(Re){it(JSON.parse(Re.target.responseText),Ge)},!1),Ue.addEventListener("error",function(Re){console.error(Re)},!1),Ue.open("POST","".concat(le.a,"/api/attachments.json")),Ue.send(Be)}var $e=j("giR+"),ct=j("fyUT"),vt=j("7Kak"),at=j("9yH6"),et=at.a.Group,nt={margin:"0 8px"},Rt=function(Ge){var it=Ge.callback,Be=Ge.onCancel;function Ue(Re){it(Re)}return S.a.createElement(ae.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Ue},S.a.createElement("div",{className:"flex-container"},S.a.createElement("span",{style:nt},"\u5355\u5143\u683C\u6570\uFF1A"),S.a.createElement("span",{style:nt},"\u884C\u6570"),S.a.createElement(ae.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},S.a.createElement(ct.a,null)),S.a.createElement("span",{style:nt},"\u5217\u6570"),S.a.createElement(ae.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},S.a.createElement(ct.a,null))),S.a.createElement("div",{className:"flex-container",style:{marginTop:12}},S.a.createElement("span",{style:nt},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),S.a.createElement(ae.a.Item,{name:"align"},S.a.createElement(et,null,S.a.createElement(at.a,{value:"default"},S.a.createElement("i",{className:"fa fa-align-justify"})),S.a.createElement(at.a,{value:"left"},S.a.createElement("i",{className:"fa fa-align-left"})),S.a.createElement(at.a,{value:"center"},S.a.createElement("i",{className:"fa fa-align-center"})),S.a.createElement(at.a,{value:"right"},S.a.createElement("i",{className:"fa fa-align-right"}))))),S.a.createElement("div",{className:"flex-container flex-end"},S.a.createElement($.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),S.a.createElement($.a,{type:"ghost",onClick:Be},"\u53D6\u6D88")))},Ct=j("ErOA"),xt=j("7Cbv"),yt="link",wt="upload-image",Et="code-block",Se="add-table",xe="------------",Ke={default:xe,left:":".concat(xe),center:":".concat(xe,":"),right:"".concat(xe,":")},Ve=j("9VGf"),De,We;function ge(){}var de=0,ce=1e4,ne="\u2581",ie=`
|
|
**\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 oe(Ge){return/^\d+$/.test(Ge)?"".concat(Ge,"px"):Ge}var ue=navigator.platform.toUpperCase().indexOf("MAC")>=0,we=ue?"Cmd":"Ctrl",ke=["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"],Je=(De={},Object(I.a)(De,we+"-B","bold"),Object(I.a)(De,we+"-I","italic"),De),bt=(We={},Object(I.a)(We,yt,"\u6DFB\u52A0\u94FE\u63A5"),Object(I.a)(We,Et,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(I.a)(We,wt,"\u6DFB\u52A0\u6587\u4EF6"),Object(I.a)(We,Se,"\u6DFB\u52A0\u8868\u683C"),We),It=Ce.a=function(Ge){var it=Ge.defaultValue,Be=it===void 0?"":it,Ue=Ge.onChange,Re=Ge.width,se=Re===void 0?"100%":Re,pe=Ge.height,je=pe===void 0?400:pe,Ie=Ge.miniToolbar,lt=Ie===void 0?!1:Ie,st=Ge.isFocus,Ae=st===void 0?!1:st,qe=Ge.watch,pt=Ge.insertTemp,mt=Ge.mode,Lt=mt===void 0?"markdown":mt,mn=Ge.id,hn=mn===void 0?"markdown-editor-id":mn,en=Ge.showResizeBar,Dt=en===void 0?!1:en,xn=Ge.noStorage,He=xn===void 0?!1:xn,ht=Ge.showNullButton,St=ht===void 0?!1:ht,Xt=Ge.hidetoolBar,an=Xt===void 0?!1:Xt,un=Ge.fullScreen,Ye=un===void 0?!1:un,ft=Ge.onBlur,kt=Ge.onCMBeforeChange,vn=Ge.onFullScreen,Gt=Ge.className,Zt=Gt===void 0?"":Gt,z=Ge.disablePaste,g=z===void 0?!1:z,A=Ge.placeholder,V=A===void 0?"":A,ee=Ge.values,X=ee===void 0?"":ee,ve=Object(f.useState)(null),Xe=Object(U.a)(ve,2),Le=Xe[0],At=Xe[1],Qe=Object(f.useState)(Be),Bt=Object(U.a)(Qe,2),Ft=Bt[0],tn=Bt[1],zn=Object(f.useState)(qe),Wn=Object(U.a)(zn,2),$t=Wn[0],yn=Wn[1],Mn=Object(f.useState)(Ye),bn=Object(U.a)(Mn,2),fn=bn[0],Sn=bn[1],Tn=Object(f.useState)(""),Hn=Object(U.a)(Tn,2),Gn=Hn[0],er=Hn[1],Dn=Object(f.useState)(0),Or=Object(U.a)(Dn,2),on=Or[0],Yn=Or[1],Ar=Object(f.useState)(je),yr=Object(U.a)(Ar,2),br=yr[0],pn=yr[1],nn=Object(f.useState)(!1),Pn=Object(U.a)(nn,2),dn=Pn[0],kn=Pn[1],gn=Object(f.useRef)(Object(xt.a)()),Er=Object(f.useRef)(!1),Un=Object(f.useRef)(),Bn=Object(f.useRef)(),tr=Object(f.useRef)(),cr=Object(f.useRef)(),xr=Object(f.useRef)(),Ur=function(){var Mt=Object(x.a)(L.a.mark(function Nt(){var Wt,Tt;return L.a.wrap(function(sn){for(;;)switch(sn.prev=sn.next){case 0:return sn.next=2,Object(Ct.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:gn.current}});case 2:Tt=sn.sent,Tt!=null&&(Wt=Tt.attachments)!==null&&Wt!==void 0&&Wt.length&&(console.log("cm:",Le,Bn),Tt.attachments.map(function(Jt){Jt.content_type.indexOf("image")>-1?Le.replaceSelection(".concat(Jt.content_type,")")):Jt.content_type.indexOf("video")>-1?Le.replaceSelection('<video width="100%" controls src="'.concat(M.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Jt.content_type.indexOf("pdf")>-1?Le.replaceSelection('<a href="'.concat(M.a.API_SERVER,"/api/attachments/").concat(Jt.id,"?type=").concat(Jt.content_type,'&disposition=inline" target="_blank">').concat(Jt.name,"</a>")):Le.replaceSelection("[".concat(Jt.name,"](").concat(M.a.API_SERVER,"/api/attachments/").concat(Jt.id,"?type=").concat(Jt.content_type,")"))}));case 4:case"end":return sn.stop()}},Nt)}));return function(){return Mt.apply(this,arguments)}}();Object(f.useEffect)(function(){tn(X),Le==null||Le.setValue(X)},[X]),Object(f.useEffect)(function(){vn==null||vn(fn)},[fn]),Object(f.useEffect)(function(){if(Bn.current){var Mt=T.a.fromTextArea(Bn.current,{mode:Lt,lineNumbers:!lt,lineWrapping:!0,value:Be,autoCloseTags:!0,autoCloseBrackets:!0});Ae&&Mt.focus();function Nt(Wt,Tt){if(g){Tt.preventDefault();return}var rn=Tt.clipboardData;if(rn){var sn=rn.types.toString(),Jt=rn.items;if(sn==="Files"||rn.types.indexOf("Files")>-1){if(Tt.preventDefault(),Lt=="stex")return;try{var cn,Rn=Jt[1];((cn=Jt[0])===null||cn===void 0?void 0:cn.kind)==="file"&&(Rn=Jt[0]);var zt=Rn.getAsFile(),lr=zt.name.split(".").pop();ze(zt,function(jt){if(jt.id){var Qt,Ht,In;(zt==null||((Qt=zt.type)===null||Qt===void 0)?void 0:Qt.indexOf("image"))>-1?Mt.replaceSelection(".concat(jt.content_type,")")):(zt==null||((Ht=zt.type)===null||Ht===void 0)?void 0:Ht.indexOf("video"))>-1?Mt.replaceSelection('<video width="100%" controls src="'.concat(M.a.API_SERVER,"/api/attachments/").concat(jt.id,'"></video>')):(zt==null||((In=zt.type)===null||In===void 0)?void 0:In.indexOf("pdf"))>-1?Mt.replaceSelection('<a href="'.concat(M.a.API_SERVER,"/api/attachments/").concat(jt.id,"?type=").concat(zt.type,'&disposition=inline" target="_blank">').concat(zt.name,"</a>")):ke.includes(lr)?Mt.replaceSelection('<a href="'.concat(M.a.API_SERVER,"/api/attachments/").concat(jt.id,'?type=office&disposition=inline" target="_blank">').concat(zt.name,"</a>")):Mt.replaceSelection("[".concat(zt.name,"](").concat(M.a.API_SERVER,"/api/attachments/").concat(jt.id,"?type=").concat(jt.content_type,")"))}else(jt==null?void 0:jt.status)===401&&(document.location.href="/user/login")})}catch(jt){N.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return Mt.on("paste",Nt),Mt.on("dragleave",function(Wt,Tt){tr.current.classList.remove("mouse-hover-md")}),Mt.on("dragover",function(Wt,Tt){tr.current.classList.add("mouse-hover-md")}),Mt.on("drop",function(Wt,Tt){tr.current.classList.add("mouse-hover-md");var rn;if(rn=Tt.dataTransfer.files,rn.length>0){Tt.preventDefault(),Tt.stopPropagation();for(var sn=function(Rn){var zt=rn[Rn],lr=zt.name.split(".").pop();ze(zt,function(jt){if(jt.id){var Qt,Ht,In;(zt==null||((Qt=zt.type)===null||Qt===void 0)?void 0:Qt.indexOf("image"))>-1?Mt.replaceSelection(".concat(jt.content_type,")")):(zt==null||((Ht=zt.type)===null||Ht===void 0)?void 0:Ht.indexOf("video"))>-1?Mt.replaceSelection('<video width="100%" controls src="'.concat(M.a.API_SERVER,"/api/attachments/").concat(jt.id,'"></video>')):(zt==null||((In=zt.type)===null||In===void 0)?void 0:In.indexOf("pdf"))>-1?Mt.replaceSelection('<a href="'.concat(M.a.API_SERVER,"/api/attachments/").concat(jt.id,"?type=").concat(zt.type,'&disposition=inline" target="_blank">').concat(zt.name,"</a>")):ke.includes(lr)?Mt.replaceSelection('<a href="'.concat(M.a.API_SERVER,"/api/attachments/").concat(jt.id,'?type=office&disposition=inline" target="_blank">').concat(zt.name,"</a>")):Mt.replaceSelection("[".concat(zt.name,"](").concat(M.a.API_SERVER,"/api/attachments/").concat(jt.id,"?type=").concat(jt.content_type,")"))}else(jt==null?void 0:jt.status)===401&&(document.location.href="/user/login")})},Jt=0;Jt<rn.length;Jt++)sn(Jt)}}),At(Mt),function(){Mt.off("paste",Nt)}}},[]);var hr=Object(f.useCallback)(function(){if(tr.current)try{}catch(Mt){console.log(Mt,"---- to set md editor body height")}},[br,tr,fn]);Object(f.useEffect)(function(){function Mt(){var Wt=new p.default(function(Tt){var rn=Object(R.a)(Tt),sn;try{for(rn.s();!(sn=rn.n()).done;){var Jt=sn.value;(Jt.target.offsetHeight>0||Jt.target.offsetWidth>0)&&(hr(),Le.setSize("100%","100%"),Le.refresh())}}catch(cn){rn.e(cn)}finally{rn.f()}});return Wt.observe(Bn.current.parentElement),Wt}if(Le){var Nt=Mt();return function(){Nt.unobserve(Bn.current.parentElement)}}},[Le,hr]),Object(f.useEffect)(function(){if(Le){for(var Mt=[],Nt=function(){var Jt=Tt[Wt];rn=Object(U.a)(Jt,2);var cn=rn[0],Rn=rn[1],zt=Object(I.a)({},cn,function(){Tr(Rn)});Mt.push(zt),Le.addKeyMap(zt)},Wt=0,Tt=Object.entries(Je);Wt<Tt.length;Wt++){var rn;Nt()}return Un.current=setInterval(function(){Er.current&&Ur()},4e3),function(){clearInterval(Un.current);var sn=Object(R.a)(Mt),Jt;try{for(sn.s();!(Jt=sn.n()).done;){var cn=Jt.value;Le.removeKeyMap(cn)}}catch(Rn){sn.e(Rn)}finally{sn.f()}}}},[Le]),Object(f.useEffect)(function(){Ye!==fn&&Sn(Ye)},[Ye]),Object(Ve.a)(function(){if(!He&&on>0){var Mt=new Date().getTime(),Nt=window.sessionStorage.getItem(hn);Mt>=on+ce&&(!Nt||Nt!==Ft)&&(window.sessionStorage.setItem(hn,Ft),kn(!0))}},ce),Object(f.useEffect)(function(){yn(qe)},[Le,qe]),Object(f.useEffect)(function(){Le&&(Ae&&Le.focus())},[Le,Ae]),Object(f.useEffect)(function(){if($t&&Le){var Mt=Le.getScrollerElement();function Nt(Wt){var Tt=Wt.target;if(xr.current){var rn=Tt.scrollTop/Tt.scrollHeight;xr.current.scrollTop=xr.current.scrollHeight*rn}}return Mt.addEventListener("scroll",Nt),function(){Mt.removeEventListener("scroll",Nt)}}},[Le,$t]),Object(f.useEffect)(function(){if(Le&&kt){function Mt(Nt,Wt){kt(Nt,Wt)}return Le.on("beforeChange",Mt),function(){Le.off("beforeChange",Mt)}}},[Le,kt]),Object(f.useEffect)(function(){if(Le&&ft){function Mt(){ft(Le.getValue())}return Le.on("blur",Mt),function(){Le.off("blur",Mt)}}},[Le,ft]),Object(f.useEffect)(function(){if(Le){function Mt(Nt){var Wt=Nt.getValue();tn(Wt),Yn(new Date().getTime()),Nt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Ue&&Ue(Wt)}return Le.on("change",Mt),function(){Le.off("change",Mt)}}},[Le,Ue]),Object(f.useEffect)(function(){Le&&(Be==null?(Le.setValue(""),tn("")):Be!==Le.getValue()&&(Le.setValue(Be),tn(Be),Le.setCursor(Le.lineCount(),0)))},[Le,Be]);var Tr=Object(f.useCallback)(function(Mt){var Nt=Le.getCursor(),Wt=Le.getSelection(),Tt=Wt.split(`
|
|
`);switch(Mt){case"bold":return Le.replaceSelection("**"+Wt+"**"),Wt===""&&Le.setCursor(Nt.line,Nt.ch+2),Le.focus();case"italic":return Le.replaceSelection("*"+Wt+"*"),Wt===""&&Le.setCursor(Nt.line,Nt.ch+1),Le.focus();case"code":return Le.replaceSelection("`"+Wt+"`"),Wt===""&&Le.setCursor(Nt.line,Nt.ch+1),Le.focus();case"inline-latex":return Le.replaceSelection("`$$"+Wt+"$$`"),Wt===""&&Le.setCursor(Nt.line,Nt.ch+3),Le.focus();case"latex":return Le.replaceSelection("```latex\n"+Wt+"\n```"),Le.setCursor(Nt.line+1,Wt.length+1),Le.focus();case"line-break":return Le.replaceSelection(`<br/>
|
|
`),Le.focus();case"list-ul":return Wt===""?Le.replaceSelection("- "+Wt):Le.replaceSelection(Tt.map(function(rn){return rn===""?"":"- ".concat(rn)}).join(`
|
|
`)),Le.focus();case"list-ol":return Wt===""?Le.replaceSelection("1. "+Wt):Le.replaceSelection(Tt.map(function(rn,sn){return rn===""?"":"".concat(sn+1,". ").concat(rn)}).join(`
|
|
`)),Le.focus();case"add-null-ch":return Wt===""&&Le.setCursor(Nt.line,Nt.ch+1),Le.replaceSelection(ne),Le.focus();case"inster-template-1":return Wt===""&&Le.setCursor(Nt.line,Nt.ch),Le.replaceSelection(ie),Le.focus();case"eraser":return Le.setValue(""),Le.focus();case"trigger-watch":return yn(!$t),Le.focus();case"trigger-full-screen":return Sn(!fn),Le.focus();case yt:er(yt);return;case Et:er(Et);return;case wt:er(wt);return;case Se:er(Se);return;default:throw new Error}},[Le,$t,fn]),nr=Object(f.useCallback)(function(Mt){er("");switch(Gn){case yt:var Nt=Mt.title,Wt=Mt.link;return Le.replaceSelection("[".concat(Nt,"](").concat(Wt,")")),Le.focus();case Et:var Tt=Mt.language,rn=Mt.content;return Le.replaceSelection(["```"+Tt,rn,"```"].join(`
|
|
`)),Le.focus();case wt:var sn=Mt.src,Jt=Mt.alt,cn=Mt.name;return sn.indexOf("type=image")>-1?Le.replaceSelection(".concat(sn,' "').concat(Jt||"",'" )')):sn.indexOf("type=application/pdf")>-1?Le.replaceSelection('<a href="'.concat(sn,'&disposition=inline" target="_blank">').concat(cn,"</a>")):Le.replaceSelection('<a href="'.concat(sn,'" target="_blank">').concat(cn,"</a>")),Le.focus();case Se:for(var Rn=Mt.row,zt=Mt.col,lr=Mt.align,jt=`
|
|
`,Qt=0;Qt<Rn;Qt++){for(var Ht=[],In=[],Rr=0;Rr<zt;Rr++)Qt===1&&In.push(Ke[lr]),Ht.push(" ");Qt===1&&(jt+="| ".concat(In.join(" | "),` |
|
|
`)),jt+="| ".concat(Ht.join(zt===1?"":" | "),` |
|
|
`)}return Le.replaceSelection(jt+`
|
|
`),Le.focus();default:throw new Error}},[Le,Gn]),Dr=Object(f.useMemo)(function(){switch(Gn){case yt:return S.a.createElement(Ee,{callback:nr,onCancel:ir});case Et:return S.a.createElement(Oe.b,{callback:nr,onCancel:ir});case wt:return S.a.createElement(rt,{callback:nr,onCancel:ir});case Se:return S.a.createElement(Rt,{callback:nr,onCancel:ir});default:return null}},[Gn]);function ir(){er("")}Object(f.useEffect)(function(){if(cr.current){var Mt=cr.current,Nt=!1,Wt=0;function Tt(Jt){Nt=!0,Wt=Jt.pageY}function rn(){Nt=!1}function sn(Jt){if(Nt){var cn=Jt.pageY-Wt;cn<0&&(cn=0),cn>300&&(cn=300);var Rn=je+cn+"px";pn(Rn)}}return Mt.addEventListener("mousedown",Tt),document.addEventListener("mousemove",sn),document.addEventListener("mouseup",rn),function(){Mt.removeEventListener("mousedown",Tt),document.removeEventListener("mousemove",sn),document.removeEventListener("mouseup",rn)}}},[Le,cr]),Object(f.useEffect)(function(){pn(je)},[je]);var ar=oe(se),En=oe(br),qt={width:ar,height:En},On=Object(f.useMemo)(function(){if(on){var Mt=new Date(on),Nt=Mt.getHours(),Wt=Mt.getMinutes(),Tt=Mt.getSeconds();return Nt=Nt<10?"0"+Nt:Nt,Wt=Wt<10?"0"+Wt:Wt,Tt=Tt<10?"0"+Tt:Tt,"".concat(Nt,":").concat(Wt,":").concat(Tt)}return 0},[on]);function Kt(){window.sessionStorage.removeItem(hn),kn(!1),Yn(0)}function wn(){kn(!1),Yn(0),Le.setValue(window.sessionStorage.getItem(hn))}function _n(Mt,Nt){var Wt=Le.getValue();Wt=Wt.replace(Mt,Nt),tn(Wt),Le==null||Le.setValue(Wt)}return S.a.createElement(f.Fragment,null,S.a.createElement("div",{className:"markdown-editor-wrapper",ref:tr},S.a.createElement("div",{className:"markdown-editor-container ".concat(Zt," ").concat($t?"on-preview":""," ").concat(lt?"mini":""," ").concat(fn?"full-screen":""),style:qt},S.a.createElement(Q,{insertTemp:pt,watch:$t,fullScreen:fn,showNullButton:St,onActionCallback:Tr,hidetoolBar:an,uuid:gn.current,setOpenPhones:function(){Er.current=!0}}),S.a.createElement("div",{className:"markdown-editor-body"},S.a.createElement("div",{className:"codemirror-container"},S.a.createElement("textarea",{ref:Bn,placeholder:V})),$t?S.a.createElement("div",{ref:xr,className:"preview-container"},Lt==="stex"&&S.a.createElement(D,{value:Ft}),Lt!=="stex"&&S.a.createElement(y.a,{edit:!0,value:Ft,replaces:_n})):null))),Dt?S.a.createElement("a",{ref:cr,className:"editor-resize"}):null,S.a.createElement(G.a,null,bt[Gn]?S.a.createElement(K.a,{centered:!0,title:bt[Gn],visible:!0,onCancel:ir,footer:null},Dr):null))}},PD8m:function(Fe,Ce){Fe.exports={name:"memoryStorage",read:J,write:K,each:R,remove:H,clearAll:N};var j={};function J(x){return j[x]}function K(x,U){j[x]=U}function R(x){for(var U in j)j.hasOwnProperty(U)&&x(j[U],U)}function H(x){delete j[x]}function N(x){j={}}},QUZ3:function(Fe,Ce,j){"use strict";j.r(Ce);var J=j("0Owb"),K=j("PpiC"),R=j("T2oS"),H=j("W9HT"),N=j("+L6B"),x=j("2/Rp"),U=j("2qtc"),I=j("kLXV"),E=j("9og8"),L=j("tJVT"),f=j("k1fw"),S=j("aHsQ"),P=j("sGsY"),T=j("WmNS"),p=j.n(T),m=j("q1tI"),i=j.n(m),a=j("Fvcw"),u=j("GIiI"),c=j("Ty5D"),O=j("55Ip"),b=j("OJz4"),y=j("V0Rq"),D=j("bntm"),_=j("cDPC"),h=j("m3rI"),d=j("RCxd"),o=j("EHPI"),s=j("S+dL"),w=j.n(s),C=j("J66h"),v=j("uMZB"),M=j.n(v),B=j("p/48"),F=j("JPnl"),Q=j("y8nQ"),G=j("Vl3Y"),W=j("5NDa"),$=j("5rEg"),re=$.a.TextArea,ae=5e3,he=function(He){var ht=He.callback,St=He.onCancel,Xt=He.notes;function an(un){ht(un)}return i.a.createElement(G.a,{className:"note-form-panel",onFinish:an,initialValues:{notes:Xt}},i.a.createElement(G.a.Item,{name:"notes",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u7B14\u8BB0\u5185\u5BB9"},{max:ae,message:"\u7B14\u8BB0\u6700\u5927\u5B57\u6570\u4E3A".concat(ae)}]},i.a.createElement(re,{placeholder:"\u8BF7\u8F93\u5165\u7B14\u8BB0\u5185\u5BB9",rows:5})),i.a.createElement(G.a.Item,{style:{textAlign:"right"}},i.a.createElement(x.a,{type:"ghost",onClick:St,style:{marginRight:10}}," \u53D6\u6D88 "),i.a.createElement(x.a,{type:"primary",htmlType:"submit"}," \u63D0\u4EA4 ")))},Te=j("H2Ag"),ye=j.n(Te),Ee=j("DjyN"),Oe=j("NUBc"),_e=j("miYZ"),fe=j("tsqr"),le=j("g9YV"),Me=j("wCAj"),ot=j("+k/U"),ut=j.n(ot),rt=j("ye1Q"),tt=j("lfch"),ze=j("JB8y"),$e=j("1vsH"),ct=j("wd/R"),vt=j.n(ct),at=Me.a.Column,et=function(He){var ht=He.submitResult,St=He.submitting,Xt=He.submitRecords,an=He.page,un=He.onPageChange,Ye=He.topicId,ft=ht||{},kt=ft.status,vn=ft.id,Gt=ft.input,Zt=ft.output,z=ft.expected_output,g=ft.is_file,A=ft.input_file_url,V=ft.output_file_url,ee=ft.expected_output_file_url,X=ft.error_msg,ve=Xt||{},Xe=ve.records,Le=ve.records_count;function At(){g?navigator.clipboard.writeText(C.Base64.decode(X)).then(function(){fe.b.success("\u590D\u5236\u9519\u8BEF\u4FE1\u606F\u6210\u529F")}):navigator.clipboard.writeText(C.Base64.decode(Zt)).then(function(){fe.b.success("\u590D\u5236\u9519\u8BEF\u4FE1\u606F\u6210\u529F")})}return i.a.createElement(H.a,{spinning:St,tip:"\u8BC4\u6D4B\u4E2D...",indicator:i.a.createElement(rt.a,{style:{fontSize:24},spin:!0})},vn?i.a.createElement(i.a.Fragment,null,i.a.createElement("ul",{className:ut.a.info},i.a.createElement("li",null,"\u6267\u884C\u7ED3\u679C\uFF1A",i.a.createElement("span",{className:kt===ze.a.OK?"c-green":"c-red"},F.a[kt])),i.a.createElement("li",{className:ut.a.error},i.a.createElement("a",{onClick:At},"\u590D\u5236\u9519\u8BEF\u4FE1\u606F ",i.a.createElement(tt.a,null)," ")),i.a.createElement("li",null,i.a.createElement(O.a,{to:"/myproblems/".concat(Ye,"/record-detail/").concat(vn)},"\u663E\u793A\u8BE6\u60C5 >"," "))),kt!==ze.a.OK?i.a.createElement(i.a.Fragment,null,i.a.createElement("p",{className:"c-red"},"\u5B9E\u9645\u8F93\u5165\uFF1A"),i.a.createElement("pre",null,!g&&Gt,g&&i.a.createElement("a",{style:{fontSize:"16px"},onClick:function(){return Object($e.w)(A,Gt)}},Gt)),i.a.createElement("p",{className:"c-red"},"\u5B9E\u9645\u8F93\u51FA\uFF1A"),i.a.createElement("pre",null,(kt===4||kt===5)&&C.Base64.decode(X),kt!=4&&kt!=5&&(g?i.a.createElement("a",{style:{fontSize:"16px"},onClick:function(){return Object($e.w)(V,Zt)}},Zt):C.Base64.decode(Zt))),i.a.createElement("p",{className:"c-red"},"\u9884\u671F\u8F93\u51FA\uFF1A"),i.a.createElement("pre",null,!g&&C.Base64.decode(z),g&&i.a.createElement("a",{style:{fontSize:"16px"},onClick:function(){return Object($e.w)(ee,z)}},z))):null):null,(Xe==null?void 0:Xe.length)>0?i.a.createElement(Me.a,{dataSource:Xe,rowKey:"id",pagination:!1},i.a.createElement(at,{title:"\u63D0\u4EA4\u65F6\u95F4",dataIndex:"created_at",key:"created_at",render:function(Bt,Ft){return i.a.createElement("span",null," ",vt()(Bt).format("YYYY-MM-DD HH:mm:ss"))}}),i.a.createElement(at,{title:"\u63D0\u4EA4\u7ED3\u679C",dataIndex:"status",key:"status",render:function(Bt,Ft){var tn;return i.a.createElement(O.a,{className:Bt===0?"c-green":"c-red",to:"/myproblems/".concat(Ye,"/record-detail/").concat(Ft.id)},(tn=F.a[Bt])===null||tn===void 0?void 0:tn.replace("\u8C03\u8BD5","\u8BC4\u6D4B"))}}),i.a.createElement(at,{title:"\u6267\u884C\u7528\u65F6 (S)",dataIndex:"execute_time",key:"execute_time"}),i.a.createElement(at,{title:"\u5185\u5B58\u6D88\u8017\uFF08MB\uFF09",dataIndex:"execute_memory",key:"execute_memory"}),i.a.createElement(at,{title:"\u8BED\u8A00",dataIndex:"language",key:"language"}),i.a.createElement(at,{title:"\u64CD\u4F5C",dataIndex:"status",key:"status",render:function(Bt,Ft){return i.a.createElement(O.a,{className:"c-light-primary",to:"/myproblems/".concat(Ye,"/record-detail/").concat(Ft.id)},"\u67E5\u770B")}})):i.a.createElement("div",{style:{height:300,width:"100%"}}),Le>15?i.a.createElement(Oe.a,{className:ut.a.pagination,current:an,pageSize:15,total:Le,onChange:un}):null)},nt=j("BdwD"),Rt=j("DYRE"),Ct=j("zeV3"),xt=j("+BJd"),yt=j("mr32"),wt=j("pPuO"),Et=j.n(wt),Se=j("9Bee"),xe={1:{name:"\u7B80\u5355",color:"#52c41a"},2:{name:"\u4E2D\u7B49",color:"#faad14"},3:{name:"\u56F0\u96BE",color:"#f5222d"}},Ke=function(He){var ht=He.hack,St=He.onTriggerPraise,Xt=He.toDiscuss,an=ht.language,un=ht.difficult,Ye=ht.time_limit,ft=ht.username,kt=ht.user_path,vn=ht.user_praise,Gt=ht.comments_count,Zt=ht.praises_count,z=ht.description,g=ht.pass_count,A=ht.submit_count,V=Object(c.h)(),ee=xe[un];return i.a.createElement(i.a.Fragment,null,i.a.createElement("ul",{className:Et.a.info},i.a.createElement("li",null,"\u7F16\u7A0B\u8BED\uFF1A",i.a.createElement("b",null,an)),i.a.createElement("li",null,"\u96BE\u5EA6\uFF1A",i.a.createElement(yt.a,{color:ee.color},ee.name)),i.a.createElement("li",null,"\u8BC4\u6D4B\u65F6\u957F\u9650\u5236\uFF1A",i.a.createElement("b",null,Ye,"\u79D2"))),i.a.createElement(Se.a,{value:z,className:Et.a.desc}),i.a.createElement("ul",{className:Et.a["commit-info"]},i.a.createElement("li",null,i.a.createElement(Ct.a,{size:4},i.a.createElement("span",null,"\u901A\u8FC7\u6B21\u6570")," ",i.a.createElement("b",null,g))),i.a.createElement("li",null,i.a.createElement(Ct.a,{size:4},i.a.createElement("span",null,"\u63D0\u4EA4\u6B21\u6570")," ",i.a.createElement("b",null,A))," "),i.a.createElement("li",{style:{flex:"1 0 0"}}),V.query.type!=="exercises"&&i.a.createElement("li",null,i.a.createElement(Ct.a,{size:4},i.a.createElement("i",{className:"iconfont icon-huifu1",onClick:Xt})," ",i.a.createElement("b",null,Gt))," ")))},Ve=j("dhSg"),De=j("oBTY"),We=j("M8RZ"),ge=j("qJ4+"),de=j("ErOA");function ce(He,ht){return Object(de.c)("/problems/".concat(He,"/comments.json?page=").concat(ht,"&limit=10"))}function ne(He){return Object(de.f)("/discusses/".concat(He,"/plus.json"),{container_type:"Discuss",type:1})}function ie(He,ht,St){return Object(de.f)("/problems/".concat(He,"/comments/reply.json"),{comments:{content:St,parent_id:ht}})}function oe(He,ht){return Object(de.f)("/problems/".concat(He,"/comments.json"),{comments:{content:ht}})}function ue(He,ht,St){return Object(de.f)("/problems/".concat(He,"/comments/").concat(ht,"/hidden.json"),St)}function we(He,ht){return Object(de.b)("/problems/".concat(He,"/comments/").concat(ht))}var ke=j("U7T7"),Je=j("AMnG");function bt(He){var ht=He.author;return i.a.createElement("a",{href:"/users/".concat(ht.login),target:"_blank"},i.a.createElement("img",{alt:"\u7528\u6237\u5934\u50CF",height:"50",style:{borderRadius:"50%"},src:"".concat(h.a.IMG_SERVER,"/images/").concat(ht.image_url),width:"50"}))}function It(He){var ht=He.data,St=He.index,Xt=He.parentDiscussIndex,an=He.user,un=He.onSetActionType,Ye=ht.author,ft=ht.can_delete,kt=ht.content,vn=ht.id,Gt=ht.time;function Zt(){un({id:vn,index:St,type:"delete-discuss",parentDiscussIndex:Xt,message:"\u786E\u5B9A\u8981\u5220\u9664\u8BE5\u6761\u56DE\u590D\u5417"})}var z=an.admin||ft||Ye.user_id===an.user_id;return i.a.createElement("div",{className:"discuss-item-container second-discuss "},i.a.createElement(bt,{author:Ye}),i.a.createElement("section",null,i.a.createElement("div",{className:"discuss-info"},i.a.createElement("a",{href:"/users/".concat(Ye.login),target:"_blank"},Ye.name),i.a.createElement("span",{className:"grey"},Gt),i.a.createElement("div",{className:"btn-group",style:{marginBottom:0}},z?i.a.createElement("a",{onClick:Zt,title:"\u5220\u9664"},i.a.createElement("i",{className:"iconfont icon-shanchu"})):null)),i.a.createElement(Se.a,{className:"discuss-content",value:kt})))}var Ge=function(He){var ht=He.user,St=He.data,Xt=He.index,an=He.onPlusDiscuss,un=He.onSetActionType,Ye=He.activeDiscussIndex,ft=He.onReplyDiscuss,kt=He.onSetActiveDiscussIndex,vn=St.content,Gt=St.children,Zt=St.hidden,z=St.id,g=St.praise_count,A=St.time,V=St.user_praise,ee=St.can_delete,X=St.author;function ve(){kt(z)}function Xe(){an(z,!V,Xt)}function Le(){un({id:z,index:Xt,type:"delete-discuss",message:"\u786E\u5B9A\u8981\u5220\u9664\u8BE5\u6761\u56DE\u590D\u5417"})}function At(){un({id:z,index:Xt,params:{hidden:Zt?"0":"1"},type:"hidden-discuss",message:Zt?"\u786E\u5B9A\u8981\u53D6\u6D88\u9690\u85CF\u8BE5\u6761\u56DE\u590D\u5417":"\u786E\u5B9A\u8981\u9690\u85CF\u8BE5\u6761\u56DE\u590D\u5417"})}var Qe=ht.admin||ht.user_id===X.user_id;return i.a.createElement("div",{className:"discuss-item-container",key:z},i.a.createElement(bt,{author:X}),i.a.createElement("section",null,i.a.createElement("div",{className:"discuss-info"},i.a.createElement("a",{href:"/users/".concat(X.login),target:"_blank"}," ",X.name," "),i.a.createElement("span",{className:"grey"},A)),i.a.createElement(Se.a,{className:"discuss-content",value:vn}),Gt&&Gt.length>0?i.a.createElement("div",{className:"reply-discuss-container"},Gt.map(function(Bt,Ft){return i.a.createElement(It,{key:Bt.id,data:Bt,index:Ft,user:ht,onSetActionType:un,parentDiscussIndex:Xt})})):null,i.a.createElement("div",{className:"btn-group"},Qe?i.a.createElement("a",{onClick:At,title:Zt?"\u53D6\u6D88\u9690\u85CF":"\u9690\u85CF\u8BC4\u8BBA"},i.a.createElement("i",{className:Zt?"iconfont icon-yincangbiyan":"fa fa-eye"})):null,ee&&(!Gt||Gt.length==0)?i.a.createElement("a",{onClick:Le,title:"\u5220\u9664"},i.a.createElement("i",{className:"iconfont icon-shanchu"})):null,i.a.createElement("a",{onClick:ve,title:"\u56DE\u590D"}," ",i.a.createElement("i",{className:"iconfont icon-huifu1"})," "),i.a.createElement("a",{onClick:Xe,className:V?"c-orange":""},i.a.createElement("i",{className:V?"iconfont icon-dianzan mr3":"iconfont icon-dianzan-xian mr3 "}),i.a.createElement("span",null,g||""))),i.a.createElement(Je.a,{id:z,activeDiscussIndex:Ye,onReplyDiscuss:ft})))},it=j("kaH+"),Be=j("uD2n"),Ue=j.n(Be),Re=j("Ot1p"),se=function(He){var ht=He.user_praise,St=He.praise_count,Xt=He.praisePlus,an=He.onCreateDiscuss,un=He.discuss_count,Ye=Object(m.useState)(!1),ft=Object(L.a)(Ye,2),kt=ft[0],vn=ft[1],Gt=Object(m.useState)(""),Zt=Object(L.a)(Gt,2),z=Zt[0],g=Zt[1];function A(Xe){g(Xe)}function V(){vn(!0)}function ee(){vn(!1)}function X(){return ve.apply(this,arguments)}function ve(){return ve=Object(E.a)(p.a.mark(function Xe(){return p.a.wrap(function(At){for(;;)switch(At.prev=At.next){case 0:an(z),g(""),vn(!1);case 3:case"end":return At.stop()}},Xe)})),ve.apply(this,arguments)}return i.a.createElement("div",{className:"".concat(Ue.a["dis-input-editor-container"]," ").concat(kt?Ue.a.active:""," ")},i.a.createElement("div",{className:kt?"hide ".concat(Ue.a["text-area"]):Ue.a["text-area"]},i.a.createElement("input",{placeholder:"\u8BF4\u70B9\u4EC0\u4E48",onClick:V}),i.a.createElement("a",null," ",i.a.createElement("i",{className:"iconfont icon-huifu1"})," \xA0 \xA0",un," "),i.a.createElement("a",{className:"c-light-black",onClick:Xt,title:ht?"\u53D6\u6D88\u70B9\u8D5E":"\u70B9\u8D5E"},i.a.createElement("i",{className:"mr3 ".concat(ht?"iconfont icon-dianzan c-orange":"iconfont icon-dianzan-xian"," ")}),St?i.a.createElement("span",null,St):"")),kt?i.a.createElement("div",{className:Ue.a["input-mask"],onClick:ee}):null,i.a.createElement("div",{className:kt?Ue.a["md-container"]:"".concat(Ue.a["md-container"]," hide")},i.a.createElement(Re.a,{id:"discuss-input-editor",miniToolbar:!0,watch:!1,noStorage:!0,defaultValue:z,height:240,onChange:A}),i.a.createElement("div",{className:Ue.a["tip-container"],onClick:ee},i.a.createElement("a",{className:Ue.a["btn-send"],onClick:X}," \u53D1\u9001 "))))},pe={loading:!1,page:1,data:[],count:0,actionType:null,activeDiscussIndex:null},je;(function(He){He[He.GET_DISCUSSES=0]="GET_DISCUSSES",He[He.TOP_OR_DOWN_DISCUSS=1]="TOP_OR_DOWN_DISCUSS",He[He.ACTIVE_DISCUSS_INDEX=2]="ACTIVE_DISCUSS_INDEX",He[He.PLUS_DISCUSS=3]="PLUS_DISCUSS",He[He.SET_ACTION_TYPE=4]="SET_ACTION_TYPE",He[He.SET_PAGE=5]="SET_PAGE",He[He.SHOW_DISCUSSES_LOADING=6]="SHOW_DISCUSSES_LOADING"})(je||(je={}));function Ie(He,ht){switch(ht.type){case je.SHOW_DISCUSSES_LOADING:return Object(f.a)(Object(f.a)({},He),{},{loading:!0});case je.GET_DISCUSSES:return Object(f.a)(Object(f.a)({},He),ht.payload);case je.TOP_OR_DOWN_DISCUSS:return Object(f.a)(Object(f.a)({},He),ht.payload);case je.SET_ACTION_TYPE:return Object(f.a)(Object(f.a)({},He),ht.payload);case je.PLUS_DISCUSS:return Object(f.a)(Object(f.a)({},He),ht.payload);case je.SET_PAGE:return Object(f.a)(Object(f.a)({},He),{},{page:ht.payload});case je.ACTIVE_DISCUSS_INDEX:return Object(f.a)(Object(f.a)({},He),ht.payload);default:throw new Error}}var lt=function(He){var ht=He.user,St=He.identifier,Xt=He.hack,an=He.onTriggerPraise,un=Object(m.useReducer)(Ie,pe),Ye=Object(L.a)(un,2),ft=Ye[0],kt=Ye[1],vn=ft.loading,Gt=ft.page,Zt=ft.data,z=ft.count,g=ft.actionType,A=ft.activeDiscussIndex,V=Object(m.useCallback)(Object(E.a)(p.a.mark(function $t(){var yn,Mn,bn;return p.a.wrap(function(Sn){for(;;)switch(Sn.prev=Sn.next){case 0:return kt({type:je.SHOW_DISCUSSES_LOADING}),Sn.next=3,ce(St,Gt);case 3:yn=Sn.sent,Mn=yn.comments,bn=yn.disscuss_count,kt({type:je.GET_DISCUSSES,payload:{data:Mn,count:bn,loading:!1}});case 6:case"end":return Sn.stop()}},$t)})),[Gt,St]);Object(m.useEffect)(function(){V()},[St,Gt]);function ee($t){kt({type:je.SET_PAGE,page:$t})}function X($t){kt({type:je.SET_ACTION_TYPE,payload:{actionType:$t}})}function ve($t){A===$t?kt({type:je.ACTIVE_DISCUSS_INDEX,payload:{activeDiscussIndex:null}}):kt({type:je.ACTIVE_DISCUSS_INDEX,payload:{activeDiscussIndex:$t}})}function Xe($t,yn,Mn){return Le.apply(this,arguments)}function Le(){return Le=Object(E.a)(p.a.mark(function $t(yn,Mn,bn){var fn;return p.a.wrap(function(Tn){for(;;)switch(Tn.prev=Tn.next){case 0:return Tn.prev=0,Tn.next=3,ne(yn);case 3:fn=Tn.sent,Zt[bn].user_praise=Mn,Zt[bn].praise_count=fn.praise_count,kt({type:je.PLUS_DISCUSS,payload:{data:Object(De.a)(Zt)}}),Tn.next=12;break;case 9:Tn.prev=9,Tn.t0=Tn.catch(0),console.log(Tn.t0);case 12:case"end":return Tn.stop()}},$t,null,[[0,9]])})),Le.apply(this,arguments)}function At(){return Qe.apply(this,arguments)}function Qe(){return Qe=Object(E.a)(p.a.mark(function $t(){var yn,Mn,bn,fn,Sn,Tn,Hn,Gn;return p.a.wrap(function(Dn){for(;;)switch(Dn.prev=Dn.next){case 0:if(yn=g.id,Mn=g.params,bn=g.type,fn=g.index,Sn=g.parentDiscussIndex,!(bn==="hidden-discuss")){Dn.next=6;break}return Dn.next=4,ue(St,yn,Mn);case 4:Sn?Zt[Sn].children[fn].hidden=Mn.hidden==1:Zt[fn].hidden=Mn.hidden==1,kt({type:je.SET_ACTION_TYPE,payload:{actionType:null,data:Object(De.a)(Zt)}});case 6:if(!(bn==="delete-discuss")){Dn.next=31;break}return Dn.next=9,we(St,yn);case 9:if(!(Sn||Sn===0)){Dn.next=22;break}Tn=Zt[Sn].children,Hn=Tn.length-1;case 12:if(!(Hn>=0)){Dn.next=19;break}if(!(Tn[Hn].id===yn)){Dn.next=16;break}return Tn.splice(Hn,1),Dn.abrupt("break",19);case 16:Hn--,Dn.next=12;break;case 19:Zt[Sn].children=Tn,Dn.next=30;break;case 22:Gn=Zt.length-1;case 23:if(!(Gn>=0)){Dn.next=30;break}if(!(Zt[Gn].id===yn)){Dn.next=27;break}return Zt.splice(Gn,1),Dn.abrupt("break",30);case 27:Gn--,Dn.next=23;break;case 30:kt({type:je.SET_ACTION_TYPE,payload:{actionType:null,data:Object(De.a)(Zt)}});case 31:case"end":return Dn.stop()}},$t)})),Qe.apply(this,arguments)}function Bt(){kt({type:je.SET_ACTION_TYPE,payload:{actionType:null}})}function Ft($t,yn){return tn.apply(this,arguments)}function tn(){return tn=Object(E.a)(p.a.mark(function $t(yn,Mn){return p.a.wrap(function(fn){for(;;)switch(fn.prev=fn.next){case 0:return fn.prev=0,fn.next=3,ie(St,yn,Mn);case 3:V(),fn.next=9;break;case 6:fn.prev=6,fn.t0=fn.catch(0),console.log(fn.t0);case 9:case"end":return fn.stop()}},$t,null,[[0,6]])})),tn.apply(this,arguments)}function zn($t){return Wn.apply(this,arguments)}function Wn(){return Wn=Object(E.a)(p.a.mark(function $t(yn){return p.a.wrap(function(bn){for(;;)switch(bn.prev=bn.next){case 0:return kt({type:je.SHOW_DISCUSSES_LOADING}),bn.next=3,oe(St,yn);case 3:V();case 4:case"end":return bn.stop()}},$t)})),Wn.apply(this,arguments)}return i.a.createElement(i.a.Fragment,null,i.a.createElement("div",{className:"discuss-panel"},Zt.length===0?i.a.createElement(nt.a,null):Zt.map(function($t,yn){return i.a.createElement(Ge,{onReplyDiscuss:Ft,onPlusDiscuss:Xe,onSetActiveDiscussIndex:ve,onSetActionType:X,data:$t,index:yn,user:ht,activeDiscussIndex:A})}),z>10?i.a.createElement("div",{className:"pagination-container"},i.a.createElement(Oe.a,{showQuickJumper:!0,onChange:ee,current:Gt,total:z})):null),i.a.createElement(se,{user_praise:Xt.user_praise,praise_count:Xt.praises_count,praisePlus:an,discuss_count:Xt.comments_count,onCreateDiscuss:zn}),i.a.createElement(We.a,null,i.a.createElement(I.a,{centered:!0,title:"\u63D0\u793A",visible:!!g,onOk:At,onCancel:Bt},i.a.createElement("p",null,g?g.message:"")),i.a.createElement(it.a,null)))},st=function(He){var ht=He.hack;return i.a.createElement("div",{style:{padding:20}},i.a.createElement("div",{className:"font16 c-grey-333"},"\u6837\u4F8B\u4EE3\u7801\uFF1A"),i.a.createElement(Se.a,{hasMask:!0,value:ht==null?void 0:ht.standard_answer,zoomImg:!0}))},Ae=function(He){var ht=He.hack,St=He.onTriggerPraise,Xt=He.topicId,an=He.page,un=He.onPageChange,Ye=He.user,ft=He.submitRecords,kt=He.submitting,vn=He.submitResult,Gt=Object(m.useState)("0"),Zt=Object(L.a)(Gt,2),z=Zt[0],g=Zt[1],A=Object(c.h)();function V(X){var ve=X.target.id;g(ve)}Object(m.useEffect)(function(){var X=Ve.a.subscribe("to-commit-info",function(){g("1")});return X},[]);function ee(){g("2")}return console.log(ft,"submitRecords"),i.a.createElement("div",{className:ye.a["left-panel"]},i.a.createElement("ul",{className:"".concat(ye.a["s-navs"],' "bg-white"')},i.a.createElement("li",null,i.a.createElement("a",{className:z==="0"?ye.a.active:"",id:"0",onClick:V},"\u4EFB\u52A1\u63CF\u8FF0")),i.a.createElement("li",null,i.a.createElement("a",{className:z==="1"?ye.a.active:"",id:"1",onClick:V},"\u63D0\u4EA4\u8BB0\u5F55")),A.query.type!=="exercises"&&i.a.createElement("li",null,i.a.createElement("a",{className:z==="2"?ye.a.active:"",id:"2",onClick:V},"\u8BC4\u8BBA")),i.a.createElement("li",null,i.a.createElement("a",{className:z==="3"?ye.a.active:"",id:"3",onClick:V},"\u6837\u4F8B\u4EE3\u7801"))),i.a.createElement("div",{className:"".concat(ye.a["tab-panel-body"]," ").concat(z==="0"?"":"hide")},i.a.createElement(Ke,{hack:ht,onTriggerPraise:St,toDiscuss:ee})),i.a.createElement("div",{className:"".concat(ye.a["tab-panel-body"]," ").concat(z==="1"?"":"hide")},!!(ft!=null&&ft.records_count)||kt?i.a.createElement(et,{page:an,onPageChange:un,topicId:Xt,submitting:kt,submitRecords:ft,submitResult:vn}):i.a.createElement(nt.a,null)),i.a.createElement("div",{className:"".concat(ye.a["tab-panel-body"]," ").concat(z==="2"?"":"hide"),style:{padding:0}},i.a.createElement(lt,{user:Ye,identifier:ht.identifier,hack:ht,onTriggerPraise:St})),i.a.createElement("div",{className:"".concat(ye.a["tab-panel-body"]," ").concat(z==="3"?"":"hide"),style:{padding:0}},i.a.createElement(st,{hack:ht})))},qe=P.a.Countdown,pt={Java:"java",C:"c",Python:"py","C++":"c"},mt;(function(He){He[He.SET_LOADING=0]="SET_LOADING",He[He.GET_DATA=1]="GET_DATA",He[He.GET_SUBMIT_RECORDS=2]="GET_SUBMIT_RECORDS",He[He.SET_DATA=3]="SET_DATA",He[He.SET_DEBUGING=4]="SET_DEBUGING",He[He.SET_SUBMITING=5]="SET_SUBMITING",He[He.SET_EXECUTE_MESSAGE=6]="SET_EXECUTE_MESSAGE",He[He.SET_EXECUTE_RESULT=7]="SET_EXECUTE_RESULT",He[He.SET_SUBMIT_RESULT=8]="SET_SUBMIT_RESULT",He[He.SET_SHOW_NOTE=9]="SET_SHOW_NOTE",He[He.SET_PAGE=10]="SET_PAGE"})(mt||(mt={}));function Lt(){return new Date().getTime()}var mn={loading:!0,data:void 0,showNote:!1,debugResult:void 0,submitResult:void 0,debuging:!1,submitting:!1,submitRecords:void 0,submitRecordPage:1,executingMessage:""};function hn(He,ht){switch(ht.type){case mt.GET_DATA:return Object(f.a)(Object(f.a)({},He),ht.payload);case mt.SET_DATA:return Object(f.a)(Object(f.a)({},He),{},{data:ht.payload});case mt.SET_LOADING:return Object(f.a)(Object(f.a)({},He),{},{loading:ht.payload});case mt.SET_SHOW_NOTE:return Object(f.a)(Object(f.a)({},He),{},{showNote:ht.payload});case mt.SET_DEBUGING:return Object(f.a)(Object(f.a)({},He),{},{debuging:ht.payload});case mt.SET_SUBMITING:return Object(f.a)(Object(f.a)({},He),{},{submitting:ht.payload});case mt.GET_SUBMIT_RECORDS:return Object(f.a)(Object(f.a)({},He),{},{submitRecords:ht.payload});case mt.SET_PAGE:return Object(f.a)(Object(f.a)({},He),{},{submitRecordPage:ht.payload});case mt.SET_EXECUTE_MESSAGE:return Object(f.a)(Object(f.a)({},He),{},{executingMessage:ht.payload});case mt.SET_EXECUTE_RESULT:return Object(f.a)(Object(f.a)({},He),ht.payload);case mt.SET_SUBMIT_RESULT:return Object(f.a)(Object(f.a)({},He),ht.payload);default:throw new Error}}var en=Ce.default=function(He){var ht,St,Xt,an=He.children,un=Object(m.useReducer)(hn,mn),Ye=Object(L.a)(un,2),ft=Ye[0],kt=Ye[1],vn=Object(c.i)(),Gt=vn.id,Zt=Object(c.g)(),z=Object(c.h)(),g=ft.loading,A=ft.data,V=ft.debugResult,ee=ft.submitResult,X=ft.submitRecords,ve=ft.submitRecordPage,Xe=ft.showNote,Le=ft.debuging,At=ft.submitting,Qe=ft.executingMessage,Bt=Object(m.useState)("#FFF"),Ft=Object(L.a)(Bt,2),tn=Ft[0],zn=Ft[1],Wn=Object(m.useState)(null),$t=Object(L.a)(Wn,2),yn=$t[0],Mn=$t[1],bn=Object(m.useState)({}),fn=Object(L.a)(bn,2),Sn=fn[0],Tn=fn[1],Hn=Object(m.useState)(!0),Gn=Object(L.a)(Hn,2),er=Gn[0],Dn=Gn[1],Or=A==null?void 0:A.user,on=A==null?void 0:A.hack;Object(m.useEffect)(function(){function En(){return qt.apply(this,arguments)}function qt(){return qt=Object(E.a)(p.a.mark(function On(){var Kt,wn,_n,Mt,Nt,Wt,Tt,rn,sn,Jt,cn;return p.a.wrap(function(zt){for(;;)switch(zt.prev=zt.next){case 0:return Dn(!0),zt.next=3,Object(b.d)(Gt);case 3:if(Kt=zt.sent,setTimeout(function(){Dn(!1)},800),Kt.status===401?document.location.href="/user/login":(Kt.hack.code=C.Base64.decode(Kt.hack.code),kt({type:mt.GET_DATA,payload:{loading:!1,data:Kt}})),!(z.query.type==="exercises")){zt.next=18;break}if(!(z.query.coursesId=="coursesId")){zt.next=13;break}return zt.next=10,Object(y.X)({categoryId:z.query.exercisesId,login:z.query.login});case 10:Nt=zt.sent,zt.next=16;break;case 13:return zt.next=15,Object(y.y)({categoryId:z.query.exercisesId,login:z.query.login});case 15:Nt=zt.sent;case 16:Tn(Object(f.a)({},Nt)),(wn=Nt)!==null&&wn!==void 0&&wn.left_banner_id&&(_n=Nt)!==null&&_n!==void 0&&(Mt=_n.exercise)!==null&&Mt!==void 0&&Mt.left_time&&(Mn(Date.now()+((Wt=Nt)===null||Wt===void 0||((Tt=Wt.exercise)===null||Tt===void 0)?void 0:Tt.left_time)*1e3),setTimeout(function(){zn("red")},(((rn=Nt)===null||rn===void 0||((sn=rn.exercise)===null||sn===void 0)?void 0:sn.left_time)-300>0?((Jt=Nt)===null||Jt===void 0||((cn=Jt.exercise)===null||cn===void 0)?void 0:cn.left_time)-300:0)*1e3));case 18:case"end":return zt.stop()}},On)})),qt.apply(this,arguments)}Gt&&En()},[Gt]),Object(m.useEffect)(function(){return Ar(),z.query.type==="exercises"&&(document.addEventListener(Object(D.c)(),Yn),window.focus(),window.onblur=function(){Object(D.a)()&&Object(D.b)()}),function(){document.removeEventListener(Object(D.c)(),Yn)}},[Gt,ve]);var Yn=function(){window.parent.postMessage("backExercise","*")};function Ar(){return yr.apply(this,arguments)}function yr(){return yr=Object(E.a)(p.a.mark(function En(){var qt;return p.a.wrap(function(Kt){for(;;)switch(Kt.prev=Kt.next){case 0:return Kt.prev=0,Kt.next=3,Object(b.f)(Gt,{limit:15,page:ve});case 3:qt=Kt.sent,kt({type:mt.GET_SUBMIT_RECORDS,payload:qt}),Kt.next=10;break;case 7:Kt.prev=7,Kt.t0=Kt.catch(0),console.log(Kt.t0);case 10:case"end":return Kt.stop()}},En,null,[[0,7]])})),yr.apply(this,arguments)}function br(En){kt({type:mt.SET_PAGE,payload:En})}function pn(){return nn.apply(this,arguments)}function nn(){return nn=Object(E.a)(p.a.mark(function En(){var qt;return p.a.wrap(function(Kt){for(;;)switch(Kt.prev=Kt.next){case 0:return Kt.next=2,Object(b.k)(Gt,{code:C.Base64.encode(on.code)});case 2:return qt=Kt.sent,Kt.abrupt("return",qt);case 4:case"end":return Kt.stop()}},En)})),nn.apply(this,arguments)}function Pn(){return dn.apply(this,arguments)}function dn(){return dn=Object(E.a)(p.a.mark(function En(){var qt,On,Kt,wn,_n,Mt,Nt;return p.a.wrap(function(Tt){for(;;)switch(Tt.prev=Tt.next){case 0:if(!At){Tt.next=2;break}return Tt.abrupt("return");case 2:return kt({type:mt.SET_SUBMITING,payload:!0}),Tt.prev=3,Tt.next=6,Object(b.l)(Gt);case 6:return Ve.a.publish("to-commit-info"),Tt.next=9,pn();case 9:if(qt=Tt.sent,console.log(qt,1),!(qt.status===0)){Tt.next=25;break}return Nt=function(){return Nt=Object(E.a)(p.a.mark(function sn(){var Jt,cn,Rn,zt,lr,jt;return p.a.wrap(function(Ht){for(;;)switch(Ht.prev=Ht.next){case 0:return Ht.next=2,Object(b.c)(Gt,"submit");case 2:if(Jt=Ht.sent,cn=Jt.status,Rn=Jt.data,zt=Lt(),lr=zt-_n>(wn+3)*1e3,cn!==0&&!lr&&setTimeout(Mt,1e3),!lr){Ht.next=12;break}return I.a.error({centered:!0,okText:"\u77E5\u9053\u5566",content:"\u8BC4\u6D4B\u4EE3\u7801\u8D85\u65F6"}),kt({type:mt.SET_SUBMITING,payload:!1}),Ht.abrupt("return");case 12:if(!(cn===0)){Ht.next=18;break}return Rn.status===2&&I.a.error({centered:!0,okText:"\u77E5\u9053\u5566",content:"\u8BC4\u6D4B\u4EE3\u7801\u8D85\u65F6"}),Ht.next=16,Object(b.f)(Gt,{limit:15,page:ve});case 16:jt=Ht.sent,kt({type:mt.SET_SUBMIT_RESULT,payload:Object(f.a)(Object(f.a)({},ft),{},{submitResult:Rn,submitting:!1,submitRecords:jt})});case 18:case"end":return Ht.stop()}},sn)})),Nt.apply(this,arguments)},Mt=function(){return Nt.apply(this,arguments)},On={},z.query.type==="exercises"&&(On.extras={exercise_id:z.query.exercisesId,question_id:z.query.questionId}),Tt.next=18,Object(b.h)(Gt,On);case 18:if(Kt=Tt.sent,!(Kt.status===-1)){Tt.next=22;break}return window.parent.location.href="/classrooms/".concat(z.query.coursesId,"/exercise/").concat(z.query.exercisesId,"/detail"),Tt.abrupt("return");case 22:wn=on.time_limit,_n=Lt(),Mt();case 25:Tt.next=31;break;case 27:Tt.prev=27,Tt.t0=Tt.catch(3),console.log(Tt.t0),kt({type:mt.SET_SUBMITING,payload:!1});case 31:case"end":return Tt.stop()}},En,null,[[3,27]])})),dn.apply(this,arguments)}function kn(){return gn.apply(this,arguments)}function gn(){return gn=Object(E.a)(p.a.mark(function En(){var qt,On,Kt,wn,_n,Mt,Nt;return p.a.wrap(function(Tt){for(;;)switch(Tt.prev=Tt.next){case 0:return ft.debuging=!0,kt({type:mt.SET_DEBUGING,payload:!0}),Tt.prev=2,Tt.next=5,pn();case 5:if(qt=Tt.sent,!(qt.status===0)){Tt.next=22;break}return Nt=function(){return Nt=Object(E.a)(p.a.mark(function sn(){var Jt,cn,Rn,zt,lr,jt;return p.a.wrap(function(Ht){for(;;)switch(Ht.prev=Ht.next){case 0:return Ht.next=2,Object(b.c)(Gt,"debug");case 2:if(Jt=Ht.sent,cn=Jt.status,Rn=Jt.message,zt=Jt.data,lr=Lt(),jt=lr-_n>(On+3)*1e3,cn!==0&&!jt&&(kt({type:mt.SET_EXECUTE_MESSAGE,payload:Rn}),setTimeout(Mt,1e3)),!jt){Ht.next=13;break}return I.a.error({centered:!0,okText:"\u77E5\u9053\u5566",content:"\u8C03\u8BD5\u4EE3\u7801\u8D85\u65F6"}),kt({type:mt.SET_DEBUGING,payload:!1}),Ht.abrupt("return");case 13:cn===0&&(kt({type:mt.SET_DEBUGING,payload:!1}),zt.status===2&&I.a.error({centered:!0,okText:"\u77E5\u9053\u5566",content:"\u8C03\u8BD5\u4EE3\u7801\u8D85\u65F6"}),zt.status===2&&I.a.error({centered:!0,okText:"\u77E5\u9053\u5566",content:"\u8C03\u8BD5\u4EE3\u7801\u8D85\u65F6"}),kt({type:mt.SET_EXECUTE_RESULT,payload:Object(f.a)(Object(f.a)({},ft),{},{debugResult:zt,debuging:!1})}));case 14:case"end":return Ht.stop()}},sn)})),Nt.apply(this,arguments)},Mt=function(){return Nt.apply(this,arguments)},On=on.time_limit,Kt={input:encodeURIComponent(A.test_case.input)},z.query.type==="exercises"&&(Kt.exercise_id=z.query.exercisesId),Tt.next=14,Object(b.b)(Gt,Kt);case 14:if(wn=Tt.sent,!(wn.status===-1)){Tt.next=18;break}return window.parent.location.href="/classrooms/".concat(z.query.coursesId,"/exercise/").concat(z.query.exercisesId,"/detail"),Tt.abrupt("return");case 18:_n=Lt(),Mt(),Tt.next=23;break;case 22:kt({type:mt.SET_DEBUGING,payload:!1});case 23:Tt.next=28;break;case 25:Tt.prev=25,Tt.t0=Tt.catch(2),console.log(Tt.t0);case 28:return Tt.prev=28,Tt.finish(28);case 30:case"end":return Tt.stop()}},En,null,[[2,25,28,30]])})),gn.apply(this,arguments)}function Er(En){kt({type:mt.SET_DATA,payload:Object(f.a)(Object(f.a)({},A),{},{hack:Object(f.a)(Object(f.a)({},on),{},{code:En})})})}function Un(En){var qt=En.target.value;kt({type:mt.SET_DATA,payload:Object(f.a)(Object(f.a)({},A),{},{test_case:{input:qt}})})}function Bn(){return tr.apply(this,arguments)}function tr(){return tr=Object(E.a)(p.a.mark(function En(){var qt;return p.a.wrap(function(Kt){for(;;)switch(Kt.prev=Kt.next){case 0:return Kt.prev=0,Kt.next=3,Object(b.g)(Gt);case 3:qt=Kt.sent,qt.status===401?Zt.replace("/login",{from:z.pathname}):Er(C.Base64.decode(qt.code)),Kt.next=10;break;case 7:Kt.prev=7,Kt.t0=Kt.catch(0),console.log(Kt.t0);case 10:case"end":return Kt.stop()}},En,null,[[0,7]])})),tr.apply(this,arguments)}function cr(){I.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:i.a.createElement("p",null,"\u521D\u59CB\u4EE3\u7801\u6709\u4FEE\u6539\uFF0C\u66F4\u65B0\u540E\u5C06\u8986\u76D6\u73B0\u6709\u4EE3\u7801\u54E6~ ",i.a.createElement("br",null),"\u8BF7\u5C06\u60A8\u7F16\u8F91\u7684\u4EE3\u7801\u4FDD\u5B58\u81F3\u672C\u5730\uFF0C\u4EE5\u9632\u4E22\u5931"),onOk:function(){return Object(E.a)(p.a.mark(function qt(){var On;return p.a.wrap(function(wn){for(;;)switch(wn.prev=wn.next){case 0:return wn.next=2,Object(b.i)(Gt);case 2:On=wn.sent,On.status===401?Zt.replace("/login",{from:z.pathname}):Er(C.Base64.decode(On.code));case 4:case"end":return wn.stop()}},qt)}))()}})}function xr(){kt({type:mt.SET_SHOW_NOTE,payload:!0})}function Ur(){kt({type:mt.SET_SHOW_NOTE,payload:!1})}function hr(En){return Tr.apply(this,arguments)}function Tr(){return Tr=Object(E.a)(p.a.mark(function En(qt){return p.a.wrap(function(Kt){for(;;)switch(Kt.prev=Kt.next){case 0:return Kt.next=2,Object(b.a)(Gt,qt);case 2:kt({type:mt.GET_DATA,payload:{showNote:!1,data:Object(f.a)(Object(f.a)({},A),{},{hack:Object(f.a)(Object(f.a)({},on),{},{notes:qt.notes})})}});case 3:case"end":return Kt.stop()}},En)})),Tr.apply(this,arguments)}var nr={input:A==null||((ht=A.test_case)===null||ht===void 0)?void 0:ht.input,language:on==null?void 0:on.language,code:on==null?void 0:on.code,title:"main."+pt[on==null?void 0:on.language],modify_code:on==null?void 0:on.modify_code,notes:on==null?void 0:on.notes,debugResult:V,debuging:Le,submitting:At,executingMessage:Qe,onCancelNote:Ur,onAddNote:hr,showNote:Xe,onShowNote:xr,onSubmitCode:Pn,onChangeCode:Er,onChangeInput:Un,onDebugCode:kn,onResetCode:Bn,onSyncCode:cr,onUpdateCode:pn};function Dr(){return ir.apply(this,arguments)}function ir(){return ir=Object(E.a)(p.a.mark(function En(){var qt,On,Kt;return p.a.wrap(function(_n){for(;;)switch(_n.prev=_n.next){case 0:return _n.next=2,Object(b.j)(on.id,{container_type:"Hack",type:1});case 2:qt=_n.sent,On=qt.praise_count,Kt=Object(f.a)(Object(f.a)({},A),{},{hack:Object(f.a)(Object(f.a)({},on),{},{praises_count:On,user_praise:!on.user_praise})}),kt({type:mt.SET_DATA,payload:Kt});case 6:case"end":return _n.stop()}},En)})),ir.apply(this,arguments)}var ar={topicId:Gt,submitResult:ee,submitRecords:X,submitting:At,page:ve,onPageChange:br,hack:on,user:A==null?void 0:A.user,onTriggerPraise:Dr};return i.a.createElement(i.a.Fragment,null,i.a.createElement(H.a,{spinning:g,delay:500},A?i.a.createElement(i.a.Fragment,null,i.a.createElement("header",{className:M.a.header},z.query.type!=="exercises"&&i.a.createElement("div",null,i.a.createElement("img",{src:"".concat(h.a.IMG_SERVER,"/images/").concat(Or.image_url),alt:"user",width:30}),i.a.createElement("span",null,Or.name)),i.a.createElement("h2",null," ",on.name," "),Or.hack_manager?i.a.createElement(O.a,{className:M.a.btn_back,to:"/problems/".concat(on.identifier,"/edit"),style:{marginRight:10}}," ",i.a.createElement(a.a,null)," \u7F16\u8F91"):null,(Sn==null||((St=Sn.exercise)===null||St===void 0)?void 0:St.left_time)&&i.a.createElement(i.a.Fragment,null,i.a.createElement("span",{style:{color:tn},className:"iconfont icon-kaoshishichang mr5"}),i.a.createElement("span",{className:"c-white mr20"},i.a.createElement(qe,{valueStyle:{color:tn,fontSize:16,fontWeight:"normal"},title:i.a.createElement("span",{style:{color:tn,fontSize:16}},"\u5269\u4F59\u65F6\u95F4\uFF1A"),value:yn,onFinish:Object(E.a)(p.a.mark(function En(){var qt,On;return p.a.wrap(function(wn){for(;;)switch(wn.prev=wn.next){case 0:return wn.next=2,Object(y.Y)({categoryId:z.query.exercisesId,commit_method:2});case 2:qt=wn.sent,(qt==null?void 0:qt.status)===0&&(pn(),I.a.info({width:530,title:"\u63D0\u793A",centered:!0,okText:"\u786E\u5B9A",content:i.a.createElement("div",{className:"tc font16"},"\u7B54\u9898\u7ED3\u675F\u4E86\uFF0C\u7CFB\u7EDF\u5DF2\u81EA\u52A8\u63D0\u4EA4\u8BD5\u5377",i.a.createElement("br",null),"\u4E0D\u80FD\u518D\u4FEE\u6539\u7B54\u9898"),onOk:function(){var _n=Object(E.a)(p.a.mark(function Nt(){return p.a.wrap(function(Tt){for(;;)switch(Tt.prev=Tt.next){case 0:window.parent.location.href="/classrooms/".concat(z.query.coursesId,"/exercise/").concat(z.query.exercisesId,"/detail");case 1:case"end":return Tt.stop()}},Nt)}));function Mt(){return _n.apply(this,arguments)}return Mt}()})),(qt==null?void 0:qt.status)===-3&&(On=parseInt(qt==null?void 0:qt.message),Mn(Date.now()+On*1e3));case 5:case"end":return wn.stop()}},En)}))}))),(z==null||((Xt=z.query)===null||Xt===void 0)?void 0:Xt.type)==="exercises"?i.a.createElement(x.a,{type:"primary",onClick:function(){pn(),I.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:i.a.createElement("div",{className:"tc"},"\u8BF7\u786E\u8BA4\u4F60\u7684\u7B54\u9898\u5185\u5BB9\u5DF2\u7ECF\u63D0\u4EA4\uFF1F"),onOk:function(){var qt=Object(E.a)(p.a.mark(function Kt(){return p.a.wrap(function(_n){for(;;)switch(_n.prev=_n.next){case 0:return _n.next=2,Object(b.l)(Gt);case 2:Yn();case 3:case"end":return _n.stop()}},Kt)}));function On(){return qt.apply(this,arguments)}return On}()})}},i.a.createElement("span",{className:"iconfont icon-yiguanbi mr5 font14"})," \u8FD4\u56DE\u8BD5\u5377"):i.a.createElement(O.a,{className:M.a.btn_back,to:"/problemset"}," ",i.a.createElement(u.a,null),"\u9000\u51FA")),i.a.createElement(H.a,{size:"large",spinning:er},i.a.createElement(_.a,{className:"my-problems",leftChild:i.a.createElement(Ae,ar),rightChild:i.a.createElement(xn,nr)}))):null))};function Dt(He){var ht=He.title,St=He.modify_code,Xt=He.onSyncCode,an=He.onShowCodeSetting,un=He.onResetCode,Ye=function(){I.a.confirm({title:"\u6062\u590D\u521D\u59CB\u4EE3\u7801",icon:i.a.createElement(d.a,null),content:"\u4F60\u5728\u672C\u6587\u4EF6\u4E2D\u4FEE\u6539\u7684\u5185\u5BB9\u5C06\u4E22\u5931\uFF0C\u662F\u5426\u786E\u5B9A\u91CD\u65B0\u52A0\u8F7D\u521D\u59CB\u4EE3\u7801\uFF1F",centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",onOk:un})};return i.a.createElement("div",{className:"action-bar"},i.a.createElement("span",null),St?i.a.createElement("a",{title:"\u66F4\u65B0\u901A\u77E5",onClick:Xt},i.a.createElement("img",{src:w.a,alt:"notice"})):null,i.a.createElement("a",{title:"\u6062\u590D\u521D\u59CB\u4EE3\u7801",onClick:Ye},i.a.createElement("i",{className:"iconfont icon-zhongzhi font-20 "})),i.a.createElement("a",{onClick:an},i.a.createElement("i",{className:"iconfont icon-shezhi"})))}function xn(He){var ht=He.input,St=He.showNote,Xt=He.onShowNote,an=He.notes,un=He.onCancelNote,Ye=He.onAddNote,ft=He.debugResult,kt=He.language,vn=He.debuging,Gt=He.submitting,Zt=He.executingMessage,z=He.code,g=He.onSubmitCode,A=He.onDebugCode,V=He.onChangeCode,ee=He.onChangeInput,X=He.onUpdateCode,ve=Object(K.a)(He,["input","showNote","onShowNote","notes","onCancelNote","onAddNote","debugResult","language","debuging","submitting","executingMessage","code","onSubmitCode","onDebugCode","onChangeCode","onChangeInput","onUpdateCode"]);function Xe(At){return i.a.createElement(Dt,Object(J.a)({},ve,{onShowCodeSetting:At}))}var Le={input:ht,debugResult:ft,debuging:vn,submitting:Gt,executingMessage:Zt,onDebugCode:A,onChangeCode:V,onSubmitCode:g,onChangeInput:ee};return i.a.createElement("div",{className:"right-panel"},i.a.createElement(o.a,{language:kt,value:z,onChange:V,ActionBarRender:Xe}),i.a.createElement("div",{className:"note-form-area ".concat(St?"active":"")},i.a.createElement(he,{onCancel:un,notes:an,callback:Ye})),i.a.createElement(F.b,Le))}},RELg:function(Fe,Ce,j){var J=j("MFOe"),K=J.Global;Fe.exports={name:"oldIE-userDataStorage",write:U,read:I,each:E,remove:L,clearAll:f};var R="storejs",H=K.document,N=T(),x=(K.navigator?K.navigator.userAgent:"").match(/ (MSIE 8|MSIE 9|MSIE 10)\./);function U(p,m){if(x)return;var i=P(p);N(function(a){a.setAttribute(i,m),a.save(R)})}function I(p){if(x)return;var m=P(p),i=null;return N(function(a){i=a.getAttribute(m)}),i}function E(p){N(function(m){for(var i=m.XMLDocument.documentElement.attributes,a=i.length-1;a>=0;a--){var u=i[a];p(m.getAttribute(u.name),u.name)}})}function L(p){var m=P(p);N(function(i){i.removeAttribute(m),i.save(R)})}function f(){N(function(p){var m=p.XMLDocument.documentElement.attributes;p.load(R);for(var i=m.length-1;i>=0;i--)p.removeAttribute(m[i].name);p.save(R)})}var S=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g");function P(p){return p.replace(/^\d/,"___$&").replace(S,"___")}function T(){if(!H||!H.documentElement||!H.documentElement.addBehavior)return null;var p="script",m,i,a;try{i=new ActiveXObject("htmlfile"),i.open(),i.write("<"+p+">document.w=window</"+p+'><iframe src="/favicon.ico"></iframe>'),i.close(),m=i.w.frames[0].document,a=m.createElement("div")}catch(u){a=H.createElement("div"),m=H.body}return function(u){var c=[].slice.call(arguments,0);c.unshift(a),m.appendChild(a),a.addBehavior("#default#userData"),a.load(R),u.apply(this,c),m.removeChild(a);return}}},"S+dL":function(Fe,Ce){Fe.exports="data:image/gif;base64,R0lGODlhFAAQAOZVAD6Q33p6ezZto2VnaW5vcDuCxiYvNysvM1tdXzNij5eXlyg0QTA0OExOUWZnaS8zN19hYzFYf0Oi/Sg1QoeHh2JjZWZoaTdzrTRmljl5tzFZgDBWez6P3Tl4tjl8uzdxqWBiYys/VCUqL39/gHV2dy4yNScyPDJeiEpNTzk8P0CX6jc7PiYuNWlqaywwNDZtojAzNytDWScrLitAVUGb8Xl6eoWFhTp+wDNgjWRmZ4+QkFdZWzo9QIODgyo/Uzh3syg0QCczPmprbTRllW9wcSotMVJUVjZupDuEylBSVUGb8kxPUZGRkTd0rUGc82JkZUKe9j2M1zg7P4iIiEOj/yUpLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/wtYTVAgRGF0YVhNUDw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6N0U3Nzk1NkY5QkRGMTFFQUIzQzFDQjY5MEVFODZDMDciIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6N0U3Nzk1NzA5QkRGMTFFQUIzQzFDQjY5MEVFODZDMDciPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo3RTc3OTU2RDlCREYxMUVBQjNDMUNCNjkwRUU4NkMwNyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo3RTc3OTU2RTlCREYxMUVBQjNDMUNCNjkwRUU4NkMwNyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PgH//v38+/r5+Pf29fTz8vHw7+7t7Ovq6ejn5uXk4+Lh4N/e3dzb2tnY19bV1NPS0dDPzs3My8rJyMfGxcTDwsHAv769vLu6ubi3trW0s7KxsK+urayrqqmop6alpKOioaCfnp2cm5qZmJeWlZSTkpGQj46NjIuKiYiHhoWEg4KBgH9+fXx7enl4d3Z1dHNycXBvbm1sa2ppaGdmZWRjYmFgX15dXFtaWVhXVlVUU1JRUE9OTUxLSklIR0ZFRENCQUA/Pj08Ozo5ODc2NTQzMjEwLy4tLCsqKSgnJiUkIyIhIB8eHRwbGhkYFxYVFBMSERAPDg0MCwoJCAcGBQQDAgEAACH5BAUyAFUALAAAAAAUABAAAAd5gFWCg4RSLoSIiVUPFlNEhAwDCIoyST1TUwGCBwM6AweJPCSYmJpVCAMMgykgFRUtFKSlilVCsreZtAS4sqaJu7yzisDBvhAKyBDEvL6Iy7jNhA7BwoklKA0NRiO30bRFOzakpqiqtItPsTWbA0wWoOcrOUuEMA6TgQAh+QQFMgBVACwAAAAAFAAQAAAHeIBVgoOEISaEiIlVExlUSIQLAgmKIidOVFQAggYCNAIGiTFRmJiaVQkCC4MzHxcXHhKkpYpVN7K3mbQFuLKmibu8s4rAwb4YpBjEvL6IyrjMhB3BwolBGxEROCq30LQsQ1CkpqiqtItNsRybAkpHoOY+PxqEQC+TgQA7"},"SA+Z":function(Fe,Ce,j){var J=j("wTVA"),K=j("EbDI"),R=j("ZhPi"),H=j("wkBT");function N(x){return J(x)||K(x)||R(x)||H()}Fe.exports=N,Fe.exports.__esModule=!0,Fe.exports.default=Fe.exports},SJMd:function(Fe,Ce){/**
|
|
* @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 j,J,K,R=!1,H,N;window.PR_SHOULD_USE_CONTINUATION=!0;var x,U;(function(){var I=window,E=["break,continue,do,else,for,if,return,while"],L=[E,"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"],f=[L,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],S=[f,"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=[f,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],T=[f,"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"],p="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",m=[f,"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",a=[E,"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"],u=[E,"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"],c=[E,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],O=[S,T,P,m,i,a,u,c],b=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,y="str",D="kwd",_="com",h="typ",d="lit",o="pun",s="pln",w="tag",C="dec",v="src",M="atn",B="atv",F="nocode",Q="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function G(ze){for(var $e=0,ct=!1,vt=!1,at=0,et=ze.length;at<et;++at){var nt=ze[at];if(nt.ignoreCase)vt=!0;else if(/[a-z]/i.test(nt.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){ct=!0,vt=!1;break}}var Rt={b:8,t:9,n:10,v:11,f:12,r:13};function Ct(Se){var xe=Se.charCodeAt(0);if(xe!==92)return xe;var Ke=Se.charAt(1);return xe=Rt[Ke],xe||("0"<=Ke&&Ke<="7"?parseInt(Se.substring(1),8):Ke==="u"||Ke==="x"?parseInt(Se.substring(2),16):Se.charCodeAt(1))}function xt(Se){if(Se<32)return(Se<16?"\\x0":"\\x")+Se.toString(16);var xe=String.fromCharCode(Se);return xe==="\\"||xe==="-"||xe==="]"||xe==="^"?"\\"+xe:xe}function yt(Se){var xe=Se.substring(1,Se.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")),Ke=[],Ve=xe[0]==="^",De=["["];Ve&&De.push("^");for(var We=Ve?1:0,ge=xe.length;We<ge;++We){var de=xe[We];if(/\\[bdsw]/i.test(de))De.push(de);else{var ce=Ct(de),ne;We+2<ge&&xe[We+1]==="-"?(ne=Ct(xe[We+2]),We+=2):ne=ce,Ke.push([ce,ne]),ne<65||ce>122||(ne<65||ce>90||Ke.push([Math.max(65,ce)|32,Math.min(ne,90)|32]),ne<97||ce>122||Ke.push([Math.max(97,ce)&~32,Math.min(ne,122)&~32]))}}Ke.sort(function(we,ke){return we[0]-ke[0]||ke[1]-we[1]});for(var ie=[],oe=[],We=0;We<Ke.length;++We){var ue=Ke[We];ue[0]<=oe[1]+1?oe[1]=Math.max(oe[1],ue[1]):ie.push(oe=ue)}for(var We=0;We<ie.length;++We){var ue=ie[We];De.push(xt(ue[0])),ue[1]>ue[0]&&(ue[1]+1>ue[0]&&De.push("-"),De.push(xt(ue[1])))}return De.push("]"),De.join("")}function wt(Se){for(var xe=Se.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")),Ke=xe.length,Ve=[],De=0,We=0;De<Ke;++De){var ge=xe[De];if(ge==="(")++We;else if(ge.charAt(0)==="\\"){var de=+ge.substring(1);de&&(de<=We?Ve[de]=-1:xe[De]=xt(de))}}for(var De=1;De<Ve.length;++De)Ve[De]===-1&&(Ve[De]=++$e);for(var De=0,We=0;De<Ke;++De){var ge=xe[De];if(ge==="(")++We,Ve[We]||(xe[De]="(?:");else if(ge.charAt(0)==="\\"){var de=+ge.substring(1);de&&de<=We&&(xe[De]="\\"+Ve[de])}}for(var De=0;De<Ke;++De)xe[De]==="^"&&xe[De+1]!=="^"&&(xe[De]="");if(Se.ignoreCase&&ct)for(var De=0;De<Ke;++De){var ge=xe[De],ce=ge.charAt(0);ge.length>=2&&ce==="["?xe[De]=yt(ge):ce!=="\\"&&(xe[De]=ge.replace(/[a-zA-Z]/g,function(oe){var ue=oe.charCodeAt(0);return"["+String.fromCharCode(ue&~32,ue|32)+"]"}))}return xe.join("")}for(var Et=[],at=0,et=ze.length;at<et;++at){var nt=ze[at];if(nt.global||nt.multiline)throw new Error(""+nt);Et.push("(?:"+wt(nt)+")")}return new RegExp(Et.join("|"),vt?"gi":"g")}function W(ze,$e){var ct=/(?:^|\s)nocode(?:\s|$)/,vt=[],at=0,et=[],nt=0;function Rt(Ct){var xt=Ct.nodeType;if(xt==1){if(ct.test(Ct.className))return;for(var yt=Ct.firstChild;yt;yt=yt.nextSibling)Rt(yt);var wt=Ct.nodeName.toLowerCase();(wt==="br"||wt==="li")&&(vt[nt]=`
|
|
`,et[nt<<1]=at++,et[nt++<<1|1]=Ct)}else if(xt==3||xt==4){var Et=Ct.nodeValue;Et.length&&($e?Et=Et.replace(/\r\n?/g,`
|
|
`):Et=Et.replace(/[ \t\r\n]+/g," "),vt[nt]=Et,et[nt<<1]=at,at+=Et.length,et[nt++<<1|1]=Ct)}}return Rt(ze),{sourceCode:vt.join("").replace(/\n$/,""),spans:et}}function $(ze,$e,ct,vt,at){if(!ct)return;var et={sourceNode:ze,pre:1,langExtension:null,numberLines:null,sourceCode:ct,spans:null,basePos:$e,decorations:null};vt(et),at.push.apply(at,et.decorations)}var re=/\S/;function ae(ze){for(var $e=void 0,ct=ze.firstChild;ct;ct=ct.nextSibling){var vt=ct.nodeType;$e=vt===1?$e?ze:ct:vt===3&&re.test(ct.nodeValue)?ze:$e}return $e===ze?void 0:$e}function he(ze,$e){var ct={},vt;(function(){for(var nt=ze.concat($e),Rt=[],Ct={},xt=0,yt=nt.length;xt<yt;++xt){var wt=nt[xt],Et=wt[3];if(Et)for(var Se=Et.length;--Se>=0;)ct[Et.charAt(Se)]=wt;var xe=wt[1],Ke=""+xe;Ct.hasOwnProperty(Ke)||(Rt.push(xe),Ct[Ke]=null)}Rt.push(/[\0-\uffff]/),vt=G(Rt)})();var at=$e.length,et=function(nt){for(var Rt=nt.sourceCode,Ct=nt.basePos,xt=nt.sourceNode,yt=[Ct,s],wt=0,Et=Rt.match(vt)||[],Se={},xe=0,Ke=Et.length;xe<Ke;++xe){var Ve=Et[xe],De=Se[Ve],We=void 0,ge;if(typeof De=="string")ge=!1;else{var de=ct[Ve.charAt(0)];if(de)We=Ve.match(de[1]),De=de[0];else{for(var ce=0;ce<at;++ce)if(de=$e[ce],We=Ve.match(de[1]),We){De=de[0];break}We||(De=s)}ge=De.length>=5&&De.substring(0,5)==="lang-",ge&&!(We&&typeof We[1]=="string")&&(ge=!1,De=v),ge||(Se[Ve]=De)}var ne=wt;if(wt+=Ve.length,!ge)yt.push(Ct+ne,De);else{var ie=We[1],oe=Ve.indexOf(ie),ue=oe+ie.length;We[2]&&(ue=Ve.length-We[2].length,oe=ue-ie.length);var we=De.substring(5);$(xt,Ct+ne,Ve.substring(0,oe),et,yt),$(xt,Ct+ne+oe,ie,le(we,ie),yt),$(xt,Ct+ne+ue,Ve.substring(ue),et,yt)}}nt.decorations=yt};return et}function Te(ze){var $e=[],ct=[];ze.tripleQuotedStrings?$e.push([y,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ze.multiLineStrings?$e.push([y,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):$e.push([y,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ze.verbatimStrings&&ct.push([y,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var vt=ze.hashComments;vt&&(ze.cStyleComments?(vt>1?$e.push([_,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):$e.push([_,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),ct.push([y,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):$e.push([_,/^#[^\r\n]*/,null,"#"])),ze.cStyleComments&&(ct.push([_,/^\/\/[^\r\n]*/,null]),ct.push([_,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var at=ze.regexLiterals;if(at){var et=at>1?"":`
|
|
\r`,nt=et?".":"[\\S\\s]",Rt="/(?=[^/*"+et+"])(?:[^/\\x5B\\x5C"+et+"]|\\x5C"+nt+"|\\x5B(?:[^\\x5C\\x5D"+et+"]|\\x5C"+nt+")*(?:\\x5D|$))+/";ct.push(["lang-regex",RegExp("^"+Q+"("+Rt+")")])}var Ct=ze.types;Ct&&ct.push([h,Ct]);var xt=(""+ze.keywords).replace(/^ | $/g,"");xt.length&&ct.push([D,new RegExp("^(?:"+xt.replace(/[\s,]+/g,"|")+")\\b"),null]),$e.push([s,/^\s+/,null,` \r
|
|
\xA0`]);var yt="^.[^\\s\\w.$@'\"`/\\\\]*";return ze.regexLiterals&&(yt+="(?!s*/)"),ct.push([d,/^@[a-z_$][a-z_$@0-9]*/i,null],[h,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[s,/^[a-z_$][a-z_$@0-9]*/i,null],[d,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[s,/^\\[\s\S]?/,null],[o,new RegExp(yt),null]),he($e,ct)}var ye=Te({keywords:O,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Ee(ze,$e,ct){for(var vt=/(?:^|\s)nocode(?:\s|$)/,at=/\r\n?|\n/,et=ze.ownerDocument,nt=et.createElement("li");ze.firstChild;)nt.appendChild(ze.firstChild);var Rt=[nt];function Ct(xe){var Ke=xe.nodeType;if(Ke==1&&!vt.test(xe.className))if(xe.nodeName==="br")xt(xe),xe.parentNode&&xe.parentNode.removeChild(xe);else for(var Ve=xe.firstChild;Ve;Ve=Ve.nextSibling)Ct(Ve);else if((Ke==3||Ke==4)&&ct){var De=xe.nodeValue,We=De.match(at);if(We){var ge=De.substring(0,We.index);xe.nodeValue=ge;var de=De.substring(We.index+We[0].length);if(de){var ce=xe.parentNode;ce.insertBefore(et.createTextNode(de),xe.nextSibling)}xt(xe),ge||xe.parentNode.removeChild(xe)}}}function xt(xe){for(;!xe.nextSibling;)if(xe=xe.parentNode,!xe)return;function Ke(We,ge){var de=ge?We.cloneNode(!1):We,ce=We.parentNode;if(ce){var ne=Ke(ce,1),ie=We.nextSibling;ne.appendChild(de);for(var oe=ie;oe;oe=ie)ie=oe.nextSibling,ne.appendChild(oe)}return de}for(var Ve=Ke(xe.nextSibling,0),De;(De=Ve.parentNode)&&De.nodeType===1;)Ve=De;Rt.push(Ve)}for(var yt=0;yt<Rt.length;++yt)Ct(Rt[yt]);$e===($e|0)&&Rt[0].setAttribute("value",$e);var wt=et.createElement("ol");wt.className="linenums";for(var Et=Math.max(0,$e-1|0)||0,yt=0,Se=Rt.length;yt<Se;++yt)nt=Rt[yt],nt.className="L"+(yt+Et)%10,nt.firstChild||nt.appendChild(et.createTextNode("\xA0")),wt.appendChild(nt);ze.appendChild(wt)}function Oe(ze){var $e=/\bMSIE\s(\d+)/.exec(navigator.userAgent);$e=$e&&+$e[1]<=8;var ct=/\n/g,vt=ze.sourceCode,at=vt.length,et=0,nt=ze.spans,Rt=nt.length,Ct=0,xt=ze.decorations,yt=xt.length,wt=0;xt[yt]=at;var Et,Se;for(Se=Et=0;Se<yt;)xt[Se]!==xt[Se+2]?(xt[Et++]=xt[Se++],xt[Et++]=xt[Se++]):Se+=2;for(yt=Et,Se=Et=0;Se<yt;){for(var xe=xt[Se],Ke=xt[Se+1],Ve=Se+2;Ve+2<=yt&&xt[Ve+1]===Ke;)Ve+=2;xt[Et++]=xe,xt[Et++]=Ke,Se=Ve}yt=xt.length=Et;var De=ze.sourceNode,We="";De&&(We=De.style.display,De.style.display="none");try{for(var ge=null;Ct<Rt;){var de=nt[Ct],ce=nt[Ct+2]||at,ne=xt[wt+2]||at,Ve=Math.min(ce,ne),ie=nt[Ct+1],oe;if(ie.nodeType!==1&&(oe=vt.substring(et,Ve))){$e&&(oe=oe.replace(ct,"\r")),ie.nodeValue=oe;var ue=ie.ownerDocument,we=ue.createElement("span");we.className=xt[wt+1];var ke=ie.parentNode;ke.replaceChild(we,ie),we.appendChild(ie),et<ce&&(nt[Ct+1]=ie=ue.createTextNode(vt.substring(Ve,ce)),ke.insertBefore(ie,we.nextSibling))}et=Ve,et>=ce&&(Ct+=2),et>=ne&&(wt+=2)}}finally{De&&(De.style.display=We)}}var _e={};function fe(ze,$e){for(var ct=$e.length;--ct>=0;){var vt=$e[ct];_e.hasOwnProperty(vt)?I.console&&console.warn("cannot override language handler %s",vt):_e[vt]=ze}}function le(ze,$e){return ze&&_e.hasOwnProperty(ze)||(ze=/^\s*</.test($e)?"default-markup":"default-code"),_e[ze]}fe(ye,["default-code"]),fe(he([],[[s,/^[^<?]+/],[C,/^<!\w[^>]*(?:>|$)/],[_,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[o,/^(?:<[%?]|[%?]>)/],["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"]),fe(he([[s,/^[\s]+/,null,` \r
|
|
`],[B,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[w,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[M,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[o,/^[=<>\/]+/],["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"]),fe(he([],[[B,/^[\s\S]+/]]),["uq.val"]),fe(Te({keywords:S,hashComments:!0,cStyleComments:!0,types:b}),["c","cc","cpp","cxx","cyc","m"]),fe(Te({keywords:"null,true,false"}),["json"]),fe(Te({keywords:T,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:b}),["cs"]),fe(Te({keywords:P,cStyleComments:!0}),["java"]),fe(Te({keywords:c,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),fe(Te({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),fe(Te({keywords:i,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),fe(Te({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),fe(Te({keywords:m,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),fe(Te({keywords:p,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),fe(he([],[[y,/^[\s\S]+/]]),["regex"]);function Me(ze){var $e=ze.langExtension;try{var ct=W(ze.sourceNode,ze.pre),vt=ct.sourceCode;ze.sourceCode=vt,ze.spans=ct.spans,ze.basePos=0,le($e,vt)(ze),Oe(ze)}catch(at){I.console&&console.log(at&&at.stack||at)}}function ot(ze,$e,ct){var vt=ct||!1,at=$e||null,et=document.createElement("div");et.innerHTML="<pre>"+ze+"</pre>",et=et.firstChild,vt&&Ee(et,vt,!0);var nt={langExtension:at,numberLines:vt,sourceNode:et,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Me(nt),et.innerHTML}function ut(ze,$e){var ct=$e||document.body,vt=ct.ownerDocument||document;function at(de){return ct.getElementsByTagName(de)}for(var et=[at("pre"),at("code"),at("xmp")],nt=[],Rt=0;Rt<et.length;++Rt)for(var Ct=0,xt=et[Rt].length;Ct<xt;++Ct)nt.push(et[Rt][Ct]);et=null;var yt=Date;yt.now||(yt={now:function(){return+new Date}});var wt=0,Et=/\blang(?:uage)?-([\w.]+)(?!\S)/,Se=/\bprettyprint\b/,xe=/\bprettyprinted\b/,Ke=/pre|xmp/i,Ve=/^code$/i,De=/^(?:pre|code|xmp)$/i,We={};function ge(){for(var de=I.PR_SHOULD_USE_CONTINUATION?yt.now()+250:Infinity;wt<nt.length&&yt.now()<de;wt++){for(var ce=nt[wt],ne=We,ie=ce;ie=ie.previousSibling;){var oe=ie.nodeType,ue=(oe===7||oe===8)&&ie.nodeValue;if(ue?!/^\??prettify\b/.test(ue):oe!==3||/\S/.test(ie.nodeValue))break;if(ue){ne={},ue.replace(/\b(\w+)=([\w:.%+-]+)/g,function(je,Ie,lt){ne[Ie]=lt});break}}var we=ce.className;if((ne!==We||Se.test(we))&&!xe.test(we)){for(var ke=!1,Je=ce.parentNode;Je;Je=Je.parentNode){var bt=Je.tagName;if(De.test(bt)&&Je.className&&Se.test(Je.className)){ke=!0;break}}if(!ke){ce.className+=" prettyprinted";var It=ne.lang;if(!It){It=we.match(Et);var Ge;!It&&(Ge=ae(ce))&&Ve.test(Ge.tagName)&&(It=Ge.className.match(Et)),It&&(It=It[1])}var it;if(Ke.test(ce.tagName))it=1;else{var Be=ce.currentStyle,Ue=vt.defaultView,Re=Be?Be.whiteSpace:Ue&&Ue.getComputedStyle?Ue.getComputedStyle(ce,null).getPropertyValue("white-space"):0;it=Re&&Re.substring(0,3)==="pre"}var se=ne.linenums;(se=se==="true"||+se)||(se=we.match(/\blinenums\b(?::(\d+))?/),se=se?se[1]&&se[1].length?+se[1]:!0:!1),se&&Ee(ce,se,it);var pe={langExtension:It,sourceNode:ce,numberLines:se,pre:it,sourceCode:null,basePos:null,spans:null,decorations:null};Me(pe)}}}wt<nt.length?I.setTimeout(ge,250):typeof ze=="function"&&ze()}ge()}var rt=I.PR={createSimpleLexer:he,registerLangHandler:fe,sourceDecorator:Te,PR_ATTRIB_NAME:M,PR_ATTRIB_VALUE:B,PR_COMMENT:_,PR_DECLARATION:C,PR_KEYWORD:D,PR_LITERAL:d,PR_NOCODE:F,PR_PLAIN:s,PR_PUNCTUATION:o,PR_SOURCE:v,PR_STRING:y,PR_TAG:w,PR_TYPE:h,prettyPrintOne:R?I.prettyPrintOne=ot:x=ot,prettyPrint:U=R?I.prettyPrint=ut:U=ut},tt=I.define;typeof tt=="function"&&tt.amd&&tt("google-code-prettify",[],function(){return rt})})()},U7T7:function(Fe,Ce,j){},UZu5:function(Fe,Ce,j){},"VrN/":function(Fe,Ce,j){(function(J,K){Fe.exports=K()})(this,function(){"use strict";var J=navigator.userAgent,K=navigator.platform,R=/gecko\/\d/i.test(J),H=/MSIE \d/.test(J),N=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(J),x=/Edge\/(\d+)/.exec(J),U=H||N||x,I=U&&(H?document.documentMode||6:+(x||N)[1]),E=!x&&/WebKit\//.test(J),L=E&&/Qt\/\d+\.\d+/.test(J),f=!x&&/Chrome\//.test(J),S=/Opera\//.test(J),P=/Apple Computer/.test(navigator.vendor),T=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(J),p=/PhantomJS/.test(J),m=!x&&/AppleWebKit/.test(J)&&/Mobile\/\w+/.test(J),i=/Android/.test(J),a=m||i||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(J),u=m||/Mac/.test(K),c=/\bCrOS\b/.test(J),O=/win/i.test(K),b=S&&J.match(/Version\/(\d*\.\d*)/);b&&(b=Number(b[1])),b&&b>=15&&(S=!1,E=!0);var y=u&&(L||S&&(b==null||b<12.11)),D=R||U&&I>=9;function _(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var h=function(e,t){var r=e.className,n=_(t).exec(r);if(n){var l=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(l?n[1]+l:"")}};function d(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function o(e,t){return d(e).appendChild(t)}function s(e,t,r,n){var l=document.createElement(e);if(r&&(l.className=r),n&&(l.style.cssText=n),typeof t=="string")l.appendChild(document.createTextNode(t));else if(t)for(var k=0;k<t.length;++k)l.appendChild(t[k]);return l}function w(e,t,r,n){var l=s(e,t,r,n);return l.setAttribute("role","presentation"),l}var C;document.createRange?C=function(e,t,r,n){var l=document.createRange();return l.setEnd(n||e,r),l.setStart(e,t),l}:C=function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(l){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};function v(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function M(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function B(e,t){var r=e.className;_(t).test(r)||(e.className+=(r?" ":"")+t)}function F(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!_(r[n]).test(t)&&(t+=" "+r[n]);return t}var Q=function(e){e.select()};m?Q=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:U&&(Q=function(e){try{e.select()}catch(t){}});function G(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function W(e,t,r){t||(t={});for(var n in e)e.hasOwnProperty(n)&&(r!==!1||!t.hasOwnProperty(n))&&(t[n]=e[n]);return t}function $(e,t,r,n,l){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var k=n||0,Y=l||0;;){var Z=e.indexOf(" ",k);if(Z<0||Z>=t)return Y+(t-k);Y+=Z-k,Y+=r-Y%r,k=Z+1}}var re=function(){this.id=null,this.f=null,this.time=0,this.handler=G(this.onTimeout,this)};re.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},re.prototype.set=function(e,t){this.f=t;var r=+new Date+e;(!this.id||r<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=r)};function ae(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}var he=50,Te={toString:function(){return"CodeMirror.Pass"}},ye={scroll:!1},Ee={origin:"*mouse"},Oe={origin:"+move"};function _e(e,t,r){for(var n=0,l=0;;){var k=e.indexOf(" ",n);k==-1&&(k=e.length);var Y=k-n;if(k==e.length||l+Y>=t)return n+Math.min(Y,t-l);if(l+=k-n,l+=r-l%r,n=k+1,l>=t)return n}}var fe=[""];function le(e){for(;fe.length<=e;)fe.push(Me(fe)+" ");return fe[e]}function Me(e){return e[e.length-1]}function ot(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function ut(e,t,r){for(var n=0,l=r(t);n<e.length&&r(e[n])<=l;)n++;e.splice(n,0,t)}function rt(){}function tt(e,t){var r;return Object.create?r=Object.create(e):(rt.prototype=e,r=new rt),t&&W(t,r),r}var ze=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function $e(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||ze.test(e))}function ct(e,t){return t?t.source.indexOf("\\w")>-1&&$e(e)?!0:t.test(e):$e(e)}function vt(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var at=/[\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 et(e){return e.charCodeAt(0)>=768&&at.test(e)}function nt(e,t,r){for(;(r<0?t>0:t<e.length)&&et(e.charAt(t));)t+=r;return t}function Rt(e,t,r){for(var n=t>r?-1:1;;){if(t==r)return t;var l=(t+r)/2,k=n<0?Math.ceil(l):Math.floor(l);if(k==t)return e(k)?t:r;e(k)?r=k:t=k+n}}function Ct(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var l=!1,k=0;k<e.length;++k){var Y=e[k];(Y.from<r&&Y.to>t||t==r&&Y.to==t)&&(n(Math.max(Y.from,t),Math.min(Y.to,r),Y.level==1?"rtl":"ltr",k),l=!0)}l||n(t,r,"ltr")}var xt=null;function yt(e,t,r){var n;xt=null;for(var l=0;l<e.length;++l){var k=e[l];if(k.from<t&&k.to>t)return l;k.to==t&&(k.from!=k.to&&r=="before"?n=l:xt=l),k.from==t&&(k.from!=k.to&&r!="before"?n=l:xt=l)}return n!=null?n:xt}var wt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function r(te){return te<=247?e.charAt(te):1424<=te&&te<=1524?"R":1536<=te&&te<=1785?t.charAt(te-1536):1774<=te&&te<=2220?"r":8192<=te&&te<=8203?"w":te==8204?"b":"L"}var n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,l=/[stwN]/,k=/[LRr]/,Y=/[Lb1n]/,Z=/[1n]/;function q(te,me,be){this.level=te,this.from=me,this.to=be}return function(te,me){var be=me=="ltr"?"L":"R";if(te.length==0||me=="ltr"&&!n.test(te))return!1;for(var Ne=te.length,Pe=[],Ze=0;Ze<Ne;++Ze)Pe.push(r(te.charCodeAt(Ze)));for(var dt=0,gt=be;dt<Ne;++dt){var _t=Pe[dt];_t=="m"?Pe[dt]=gt:gt=_t}for(var Pt=0,Ot=be;Pt<Ne;++Pt){var Ut=Pe[Pt];Ut=="1"&&Ot=="r"?Pe[Pt]="n":k.test(Ut)&&(Ot=Ut,Ut=="r"&&(Pe[Pt]="R"))}for(var Yt=1,Vt=Pe[0];Yt<Ne-1;++Yt){var ln=Pe[Yt];ln=="+"&&Vt=="1"&&Pe[Yt+1]=="1"?Pe[Yt]="1":ln==","&&Vt==Pe[Yt+1]&&(Vt=="1"||Vt=="n")&&(Pe[Yt]=Vt),Vt=ln}for(var Ln=0;Ln<Ne;++Ln){var Zn=Pe[Ln];if(Zn==",")Pe[Ln]="N";else if(Zn=="%"){var jn=void 0;for(jn=Ln+1;jn<Ne&&Pe[jn]=="%";++jn);for(var Sr=Ln&&Pe[Ln-1]=="!"||jn<Ne&&Pe[jn]=="1"?"1":"N",mr=Ln;mr<jn;++mr)Pe[mr]=Sr;Ln=jn-1}}for(var Vn=0,gr=be;Vn<Ne;++Vn){var rr=Pe[Vn];gr=="L"&&rr=="1"?Pe[Vn]="L":k.test(rr)&&(gr=rr)}for(var $n=0;$n<Ne;++$n)if(l.test(Pe[$n])){var Xn=void 0;for(Xn=$n+1;Xn<Ne&&l.test(Pe[Xn]);++Xn);for(var Fn=($n?Pe[$n-1]:be)=="L",vr=(Xn<Ne?Pe[Xn]:be)=="L",xi=Fn==vr?Fn?"L":"R":be,$r=$n;$r<Xn;++$r)Pe[$r]=xi;$n=Xn-1}for(var sr=[],Nr,qn=0;qn<Ne;)if(Y.test(Pe[qn])){var qa=qn;for(++qn;qn<Ne&&Y.test(Pe[qn]);++qn);sr.push(new q(0,qa,qn))}else{var Fr=qn,ii=sr.length,ai=me=="rtl"?1:0;for(++qn;qn<Ne&&Pe[qn]!="L";++qn);for(var dr=Fr;dr<qn;)if(Z.test(Pe[dr])){Fr<dr&&(sr.splice(ii,0,new q(1,Fr,dr)),ii+=ai);var Ci=dr;for(++dr;dr<qn&&Z.test(Pe[dr]);++dr);sr.splice(ii,0,new q(2,Ci,dr)),ii+=ai,Fr=dr}else++dr;Fr<qn&&sr.splice(ii,0,new q(1,Fr,qn))}return me=="ltr"&&(sr[0].level==1&&(Nr=te.match(/^\s+/))&&(sr[0].from=Nr[0].length,sr.unshift(new q(0,0,Nr[0].length))),Me(sr).level==1&&(Nr=te.match(/\s+$/))&&(Me(sr).to-=Nr[0].length,sr.push(new q(0,Ne-Nr[0].length,Ne)))),me=="rtl"?sr.reverse():sr}}();function Et(e,t){var r=e.order;return r==null&&(r=e.order=wt(e.text,t)),r}var Se=[],xe=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={});n[t]=(n[t]||Se).concat(r)}};function Ke(e,t){return e._handlers&&e._handlers[t]||Se}function Ve(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers,l=n&&n[t];if(l){var k=ae(l,r);k>-1&&(n[t]=l.slice(0,k).concat(l.slice(k+1)))}}}function De(e,t){var r=Ke(e,t);if(!r.length)return;for(var n=Array.prototype.slice.call(arguments,2),l=0;l<r.length;++l)r[l].apply(null,n)}function We(e,t,r){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),De(e,r||t.type,e,t),oe(t)||t.codemirrorIgnore}function ge(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)ae(r,t[n])==-1&&r.push(t[n])}function de(e,t){return Ke(e,t).length>0}function ce(e){e.prototype.on=function(t,r){xe(this,t,r)},e.prototype.off=function(t,r){Ve(this,t,r)}}function ne(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ie(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function oe(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ue(e){ne(e),ie(e)}function we(e){return e.target||e.srcElement}function ke(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),u&&e.ctrlKey&&t==1&&(t=3),t}var Je=function(){if(U&&I<9)return!1;var e=s("div");return"draggable"in e||"dragDrop"in e}(),bt;function It(e){if(bt==null){var t=s("span","\u200B");o(e,s("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(bt=t.offsetWidth<=1&&t.offsetHeight>2&&!(U&&I<8))}var r=bt?s("span","\u200B"):s("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}var Ge;function it(e){if(Ge!=null)return Ge;var t=o(e,document.createTextNode("A\u062EA")),r=C(t,0,1).getBoundingClientRect(),n=C(t,1,2).getBoundingClientRect();return d(e),!r||r.left==r.right?!1:Ge=n.right-r.right<3}var Be=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,r=[],n=e.length;t<=n;){var l=e.indexOf(`
|
|
`,t);l==-1&&(l=e.length);var k=e.slice(t,e.charAt(l-1)=="\r"?l-1:l),Y=k.indexOf("\r");Y!=-1?(r.push(k.slice(0,Y)),t+=Y+1):(r.push(k),t=l+1)}return r}:function(e){return e.split(/\r\n?|\n/)},Ue=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(r){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Re=function(){var e=s("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),se=null;function pe(e){if(se!=null)return se;var t=o(e,s("span","x")),r=t.getBoundingClientRect(),n=C(t,0,1).getBoundingClientRect();return se=Math.abs(r.left-n.left)>1}var je={},Ie={};function lt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),je[e]=t}function st(e,t){Ie[e]=t}function Ae(e){if(typeof e=="string"&&Ie.hasOwnProperty(e))e=Ie[e];else if(e&&typeof e.name=="string"&&Ie.hasOwnProperty(e.name)){var t=Ie[e.name];typeof t=="string"&&(t={name:t}),e=tt(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ae("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ae("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function qe(e,t){t=Ae(t);var r=je[t.name];if(!r)return qe(e,"text/plain");var n=r(e,t);if(pt.hasOwnProperty(t.name)){var l=pt[t.name];for(var k in l){if(!l.hasOwnProperty(k))continue;n.hasOwnProperty(k)&&(n["_"+k]=n[k]),n[k]=l[k]}}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var Y in t.modeProps)n[Y]=t.modeProps[Y];return n}var pt={};function mt(e,t){var r=pt.hasOwnProperty(e)?pt[e]:pt[e]={};W(t,r)}function Lt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var l=t[n];l instanceof Array&&(l=l.concat([])),r[n]=l}return r}function mn(e,t){for(var r;e.innerMode&&!(r=e.innerMode(t),!r||r.mode==e);)t=r.state,e=r.mode;return r||{mode:e,state:t}}function hn(e,t,r){return e.startState?e.startState(t,r):!0}var en=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};en.prototype.eol=function(){return this.pos>=this.string.length},en.prototype.sol=function(){return this.pos==this.lineStart},en.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},en.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},en.prototype.eat=function(e){var t=this.string.charAt(this.pos),r;if(typeof e=="string"?r=t==e:r=t&&(e.test?e.test(t):e(t)),r)return++this.pos,t},en.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},en.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},en.prototype.skipToEnd=function(){this.pos=this.string.length},en.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},en.prototype.backUp=function(e){this.pos-=e},en.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=$(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?$(this.string,this.lineStart,this.tabSize):0)},en.prototype.indentation=function(){return $(this.string,null,this.tabSize)-(this.lineStart?$(this.string,this.lineStart,this.tabSize):0)},en.prototype.match=function(e,t,r){if(typeof e=="string"){var n=function(Y){return r?Y.toLowerCase():Y},l=this.string.substr(this.pos,e.length);if(n(l)==n(e))return t!==!1&&(this.pos+=e.length),!0}else{var k=this.string.slice(this.pos).match(e);return k&&k.index>0?null:(k&&t!==!1&&(this.pos+=k[0].length),k)}},en.prototype.current=function(){return this.string.slice(this.start,this.pos)},en.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},en.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},en.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function Dt(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var l=r.children[n],k=l.chunkSize();if(t<k){r=l;break}t-=k}return r.lines[t]}function xn(e,t,r){var n=[],l=t.line;return e.iter(t.line,r.line+1,function(k){var Y=k.text;l==r.line&&(Y=Y.slice(0,r.ch)),l==t.line&&(Y=Y.slice(t.ch)),n.push(Y),++l}),n}function He(e,t,r){var n=[];return e.iter(t,r,function(l){n.push(l.text)}),n}function ht(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function St(e){if(e.parent==null)return null;for(var t=e.parent,r=ae(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var l=0;!(n.children[l]==t);++l)r+=n.children[l].chunkSize();return r+t.first}function Xt(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var l=e.children[n],k=l.height;if(t<k){e=l;continue e}t-=k,r+=l.chunkSize()}return r}while(!e.lines);for(var Y=0;Y<e.lines.length;++Y){var Z=e.lines[Y],q=Z.height;if(t<q)break;t-=q}return r+Y}function an(e,t){return t>=e.first&&t<e.first+e.size}function un(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ye(e,t,r){if(r===void 0&&(r=null),!(this instanceof Ye))return new Ye(e,t,r);this.line=e,this.ch=t,this.sticky=r}function ft(e,t){return e.line-t.line||e.ch-t.ch}function kt(e,t){return e.sticky==t.sticky&&ft(e,t)==0}function vn(e){return Ye(e.line,e.ch)}function Gt(e,t){return ft(e,t)<0?t:e}function Zt(e,t){return ft(e,t)<0?e:t}function z(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function g(e,t){if(t.line<e.first)return Ye(e.first,0);var r=e.first+e.size-1;return t.line>r?Ye(r,Dt(e,r).text.length):A(t,Dt(e,t.line).text.length)}function A(e,t){var r=e.ch;return r==null||r>t?Ye(e.line,t):r<0?Ye(e.line,0):e}function V(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=g(e,t[n]);return r}var ee=function(e,t){this.state=e,this.lookAhead=t},X=function(e,t,r,n){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};X.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},X.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},X.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},X.fromSaved=function(e,t,r){return t instanceof ee?new X(e,Lt(e.mode,t.state),r,t.lookAhead):new X(e,Lt(e.mode,t),r)},X.prototype.save=function(e){var t=e!==!1?Lt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ee(t,this.maxLookAhead):t};function ve(e,t,r,n){var l=[e.state.modeGen],k={};Wn(e,t.text,e.doc.mode,r,function(te,me){return l.push(te,me)},k,n);for(var Y=r.state,Z=function(te){r.baseTokens=l;var me=e.state.overlays[te],be=1,Ne=0;r.state=!0,Wn(e,t.text,me.mode,r,function(Pe,Ze){for(var dt=be;Ne<Pe;){var gt=l[be];gt>Pe&&l.splice(be,1,Pe,l[be+1],gt),be+=2,Ne=Math.min(Pe,gt)}if(!Ze)return;if(me.opaque)l.splice(dt,be-dt,Pe,"overlay "+Ze),be=dt+2;else for(;dt<be;dt+=2){var _t=l[dt+1];l[dt+1]=(_t?_t+" ":"")+"overlay "+Ze}},k),r.state=Y,r.baseTokens=null,r.baseTokenPos=1},q=0;q<e.state.overlays.length;++q)Z(q);return{styles:l,classes:k.bgClass||k.textClass?k:null}}function Xe(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=Le(e,St(t)),l=t.text.length>e.options.maxHighlightLength&&Lt(e.doc.mode,n.state),k=ve(e,t,n);l&&(n.state=l),t.stateAfter=n.save(!l),t.styles=k.styles,k.classes?t.styleClasses=k.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Le(e,t,r){var n=e.doc,l=e.display;if(!n.mode.startState)return new X(n,!0,t);var k=$t(e,t,r),Y=k>n.first&&Dt(n,k-1).stateAfter,Z=Y?X.fromSaved(n,Y,k):new X(n,hn(n.mode),k);return n.iter(k,t,function(q){At(e,q.text,Z);var te=Z.line;q.stateAfter=te==t-1||te%5==0||te>=l.viewFrom&&te<l.viewTo?Z.save():null,Z.nextLine()}),r&&(n.modeFrontier=Z.line),Z}function At(e,t,r,n){var l=e.doc.mode,k=new en(t,e.options.tabSize,r);for(k.start=k.pos=n||0,t==""&&Qe(l,r.state);!k.eol();)Bt(l,k,r.state),k.start=k.pos}function Qe(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var r=mn(e,t);if(r.mode.blankLine)return r.mode.blankLine(r.state)}function Bt(e,t,r,n){for(var l=0;l<10;l++){n&&(n[0]=mn(e,r).mode);var k=e.token(t,r);if(t.pos>t.start)return k}throw new Error("Mode "+e.name+" failed to advance stream.")}var Ft=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function tn(e,t,r,n){var l=e.doc,k=l.mode,Y;t=g(l,t);var Z=Dt(l,t.line),q=Le(e,t.line,r),te=new en(Z.text,e.options.tabSize,q),me;for(n&&(me=[]);(n||te.pos<t.ch)&&!te.eol();)te.start=te.pos,Y=Bt(k,te,q.state),n&&me.push(new Ft(te,Y,Lt(l.mode,q.state)));return n?me:new Ft(te,Y,q.state)}function zn(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";t[n]==null?t[n]=r[2]:new RegExp("(?:^|\\s)"+r[2]+"(?:$|\\s)").test(t[n])||(t[n]+=" "+r[2])}return e}function Wn(e,t,r,n,l,k,Y){var Z=r.flattenSpans;Z==null&&(Z=e.options.flattenSpans);var q=0,te=null,me=new en(t,e.options.tabSize,n),be,Ne=e.options.addModeClass&&[null];for(t==""&&zn(Qe(r,n.state),k);!me.eol();){if(me.pos>e.options.maxHighlightLength?(Z=!1,Y&&At(e,t,n,me.pos),me.pos=t.length,be=null):be=zn(Bt(r,me,n.state,Ne),k),Ne){var Pe=Ne[0].name;Pe&&(be="m-"+(be?Pe+" "+be:Pe))}if(!Z||te!=be){for(;q<me.start;)q=Math.min(me.start,q+5e3),l(q,te);te=be}me.start=me.pos}for(;q<me.pos;){var Ze=Math.min(me.pos,q+5e3);l(Ze,te),q=Ze}}function $t(e,t,r){for(var n,l,k=e.doc,Y=r?-1:t-(e.doc.mode.innerMode?1e3:100),Z=t;Z>Y;--Z){if(Z<=k.first)return k.first;var q=Dt(k,Z-1),te=q.stateAfter;if(te&&(!r||Z+(te instanceof ee?te.lookAhead:0)<=k.modeFrontier))return Z;var me=$(q.text,null,e.options.tabSize);(l==null||n>me)&&(l=Z-1,n=me)}return l}function yn(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var r=e.first,n=t-1;n>r;n--){var l=Dt(e,n).stateAfter;if(l&&(!(l instanceof ee)||n+l.lookAhead<t)){r=n+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}var Mn=!1,bn=!1;function fn(){Mn=!0}function Sn(){bn=!0}function Tn(e,t,r){this.marker=e,this.from=t,this.to=r}function Hn(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function Gn(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function er(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Dn(e,t,r){var n;if(e)for(var l=0;l<e.length;++l){var k=e[l],Y=k.marker,Z=k.from==null||(Y.inclusiveLeft?k.from<=t:k.from<t);if(Z||k.from==t&&Y.type=="bookmark"&&(!r||!k.marker.insertLeft)){var q=k.to==null||(Y.inclusiveRight?k.to>=t:k.to>t);(n||(n=[])).push(new Tn(Y,k.from,q?null:k.to))}}return n}function Or(e,t,r){var n;if(e)for(var l=0;l<e.length;++l){var k=e[l],Y=k.marker,Z=k.to==null||(Y.inclusiveRight?k.to>=t:k.to>t);if(Z||k.from==t&&Y.type=="bookmark"&&(!r||k.marker.insertLeft)){var q=k.from==null||(Y.inclusiveLeft?k.from<=t:k.from<t);(n||(n=[])).push(new Tn(Y,q?null:k.from-t,k.to==null?null:k.to-t))}}return n}function on(e,t){if(t.full)return null;var r=an(e,t.from.line)&&Dt(e,t.from.line).markedSpans,n=an(e,t.to.line)&&Dt(e,t.to.line).markedSpans;if(!r&&!n)return null;var l=t.from.ch,k=t.to.ch,Y=ft(t.from,t.to)==0,Z=Dn(r,l,Y),q=Or(n,k,Y),te=t.text.length==1,me=Me(t.text).length+(te?l:0);if(Z)for(var be=0;be<Z.length;++be){var Ne=Z[be];if(Ne.to==null){var Pe=Hn(q,Ne.marker);Pe?te&&(Ne.to=Pe.to==null?null:Pe.to+me):Ne.to=l}}if(q)for(var Ze=0;Ze<q.length;++Ze){var dt=q[Ze];if(dt.to!=null&&(dt.to+=me),dt.from==null){var gt=Hn(Z,dt.marker);gt||(dt.from=me,te&&(Z||(Z=[])).push(dt))}else dt.from+=me,te&&(Z||(Z=[])).push(dt)}Z&&(Z=Yn(Z)),q&&q!=Z&&(q=Yn(q));var _t=[Z];if(!te){var Pt=t.text.length-2,Ot;if(Pt>0&&Z)for(var Ut=0;Ut<Z.length;++Ut)Z[Ut].to==null&&(Ot||(Ot=[])).push(new Tn(Z[Ut].marker,null,null));for(var Yt=0;Yt<Pt;++Yt)_t.push(Ot);_t.push(q)}return _t}function Yn(e){for(var t=0;t<e.length;++t){var r=e[t];r.from!=null&&r.from==r.to&&r.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Ar(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(Pe){if(Pe.markedSpans)for(var Ze=0;Ze<Pe.markedSpans.length;++Ze){var dt=Pe.markedSpans[Ze].marker;dt.readOnly&&(!n||ae(n,dt)==-1)&&(n||(n=[])).push(dt)}}),!n)return null;for(var l=[{from:t,to:r}],k=0;k<n.length;++k)for(var Y=n[k],Z=Y.find(0),q=0;q<l.length;++q){var te=l[q];if(ft(te.to,Z.from)<0||ft(te.from,Z.to)>0)continue;var me=[q,1],be=ft(te.from,Z.from),Ne=ft(te.to,Z.to);(be<0||!Y.inclusiveLeft&&!be)&&me.push({from:te.from,to:Z.from}),(Ne>0||!Y.inclusiveRight&&!Ne)&&me.push({from:Z.to,to:te.to}),l.splice.apply(l,me),q+=me.length-3}return l}function yr(e){var t=e.markedSpans;if(!t)return;for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}function br(e,t){if(!t)return;for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}function pn(e){return e.inclusiveLeft?-1:0}function nn(e){return e.inclusiveRight?1:0}function Pn(e,t){var r=e.lines.length-t.lines.length;if(r!=0)return r;var n=e.find(),l=t.find(),k=ft(n.from,l.from)||pn(e)-pn(t);if(k)return-k;var Y=ft(n.to,l.to)||nn(e)-nn(t);return Y||t.id-e.id}function dn(e,t){var r=bn&&e.markedSpans,n;if(r)for(var l=void 0,k=0;k<r.length;++k)l=r[k],l.marker.collapsed&&(t?l.from:l.to)==null&&(!n||Pn(n,l.marker)<0)&&(n=l.marker);return n}function kn(e){return dn(e,!0)}function gn(e){return dn(e,!1)}function Er(e,t){var r=bn&&e.markedSpans,n;if(r)for(var l=0;l<r.length;++l){var k=r[l];k.marker.collapsed&&(k.from==null||k.from<t)&&(k.to==null||k.to>t)&&(!n||Pn(n,k.marker)<0)&&(n=k.marker)}return n}function Un(e,t,r,n,l){var k=Dt(e,t),Y=bn&&k.markedSpans;if(Y)for(var Z=0;Z<Y.length;++Z){var q=Y[Z];if(!q.marker.collapsed)continue;var te=q.marker.find(0),me=ft(te.from,r)||pn(q.marker)-pn(l),be=ft(te.to,n)||nn(q.marker)-nn(l);if(me>=0&&be<=0||me<=0&&be>=0)continue;if(me<=0&&(q.marker.inclusiveRight&&l.inclusiveLeft?ft(te.to,r)>=0:ft(te.to,r)>0)||me>=0&&(q.marker.inclusiveRight&&l.inclusiveLeft?ft(te.from,n)<=0:ft(te.from,n)<0))return!0}}function Bn(e){for(var t;t=kn(e);)e=t.find(-1,!0).line;return e}function tr(e){for(var t;t=gn(e);)e=t.find(1,!0).line;return e}function cr(e){for(var t,r;t=gn(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function xr(e,t){var r=Dt(e,t),n=Bn(r);return r==n?t:St(n)}function Ur(e,t){if(t>e.lastLine())return t;var r=Dt(e,t),n;if(!hr(e,r))return t;for(;n=gn(r);)r=n.find(1,!0).line;return St(r)+1}function hr(e,t){var r=bn&&t.markedSpans;if(r)for(var n=void 0,l=0;l<r.length;++l){if(n=r[l],!n.marker.collapsed)continue;if(n.from==null)return!0;if(n.marker.widgetNode)continue;if(n.from==0&&n.marker.inclusiveLeft&&Tr(e,t,n))return!0}}function Tr(e,t,r){if(r.to==null){var n=r.marker.find(1,!0);return Tr(e,n.line,Hn(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var l=void 0,k=0;k<t.markedSpans.length;++k)if(l=t.markedSpans[k],l.marker.collapsed&&!l.marker.widgetNode&&l.from==r.to&&(l.to==null||l.to!=r.from)&&(l.marker.inclusiveLeft||r.marker.inclusiveRight)&&Tr(e,t,l))return!0}function nr(e){e=Bn(e);for(var t=0,r=e.parent,n=0;n<r.lines.length;++n){var l=r.lines[n];if(l==e)break;t+=l.height}for(var k=r.parent;k;r=k,k=r.parent)for(var Y=0;Y<k.children.length;++Y){var Z=k.children[Y];if(Z==r)break;t+=Z.height}return t}function Dr(e){if(e.height==0)return 0;for(var t=e.text.length,r,n=e;r=kn(n);){var l=r.find(0,!0);n=l.from.line,t+=l.from.ch-l.to.ch}for(n=e;r=gn(n);){var k=r.find(0,!0);t-=n.text.length-k.from.ch,n=k.to.line,t+=n.text.length-k.to.ch}return t}function ir(e){var t=e.display,r=e.doc;t.maxLine=Dt(r,r.first),t.maxLineLength=Dr(t.maxLine),t.maxLineChanged=!0,r.iter(function(n){var l=Dr(n);l>t.maxLineLength&&(t.maxLineLength=l,t.maxLine=n)})}var ar=function(e,t,r){this.text=e,br(this,t),this.height=r?r(this):1};ar.prototype.lineNo=function(){return St(this)},ce(ar);function En(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),yr(e),br(e,r);var l=n?n(e):1;l!=e.height&&ht(e,l)}function qt(e){e.parent=null,yr(e)}var On={},Kt={};function wn(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?Kt:On;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function _n(e,t){var r=w("span",null,null,E?"padding-right: .1px":null),n={pre:w("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var l=0;l<=(t.rest?t.rest.length:0);l++){var k=l?t.rest[l-1]:t.line,Y=void 0;n.pos=0,n.addToken=Nt,it(e.display.measure)&&(Y=Et(k,e.doc.direction))&&(n.addToken=Tt(n.addToken,Y)),n.map=[];var Z=t!=e.display.externalMeasured&&St(k);sn(k,n,Xe(e,k,Z)),k.styleClasses&&(k.styleClasses.bgClass&&(n.bgClass=F(k.styleClasses.bgClass,n.bgClass||"")),k.styleClasses.textClass&&(n.textClass=F(k.styleClasses.textClass,n.textClass||""))),n.map.length==0&&n.map.push(0,0,n.content.appendChild(It(e.display.measure))),l==0?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(E){var q=n.content.lastChild;(/\bcm-tab\b/.test(q.className)||q.querySelector&&q.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return De(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=F(n.pre.className,n.textClass||"")),n}function Mt(e){var t=s("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Nt(e,t,r,n,l,k,Y){if(!t)return;var Z=e.splitSpaces?Wt(t,e.trailingSpace):t,q=e.cm.state.specialChars,te=!1,me;if(!q.test(t))e.col+=t.length,me=document.createTextNode(Z),e.map.push(e.pos,e.pos+t.length,me),U&&I<9&&(te=!0),e.pos+=t.length;else{me=document.createDocumentFragment();for(var be=0;;){q.lastIndex=be;var Ne=q.exec(t),Pe=Ne?Ne.index-be:t.length-be;if(Pe){var Ze=document.createTextNode(Z.slice(be,be+Pe));U&&I<9?me.appendChild(s("span",[Ze])):me.appendChild(Ze),e.map.push(e.pos,e.pos+Pe,Ze),e.col+=Pe,e.pos+=Pe}if(!Ne)break;be+=Pe+1;var dt=void 0;if(Ne[0]==" "){var gt=e.cm.options.tabSize,_t=gt-e.col%gt;dt=me.appendChild(s("span",le(_t),"cm-tab")),dt.setAttribute("role","presentation"),dt.setAttribute("cm-text"," "),e.col+=_t}else Ne[0]=="\r"||Ne[0]==`
|
|
`?(dt=me.appendChild(s("span",Ne[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),dt.setAttribute("cm-text",Ne[0]),e.col+=1):(dt=e.cm.options.specialCharPlaceholder(Ne[0]),dt.setAttribute("cm-text",Ne[0]),U&&I<9?me.appendChild(s("span",[dt])):me.appendChild(dt),e.col+=1);e.map.push(e.pos,e.pos+1,dt),e.pos++}}if(e.trailingSpace=Z.charCodeAt(t.length-1)==32,r||n||l||te||k||Y){var Pt=r||"";n&&(Pt+=n),l&&(Pt+=l);var Ot=s("span",[me],Pt,k);if(Y)for(var Ut in Y)Y.hasOwnProperty(Ut)&&Ut!="style"&&Ut!="class"&&Ot.setAttribute(Ut,Y[Ut]);return e.content.appendChild(Ot)}e.content.appendChild(me)}function Wt(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,n="",l=0;l<e.length;l++){var k=e.charAt(l);k==" "&&r&&(l==e.length-1||e.charCodeAt(l+1)==32)&&(k="\xA0"),n+=k,r=k==" "}return n}function Tt(e,t){return function(r,n,l,k,Y,Z,q){l=l?l+" cm-force-border":"cm-force-border";for(var te=r.pos,me=te+n.length;;){for(var be=void 0,Ne=0;Ne<t.length&&!(be=t[Ne],be.to>te&&be.from<=te);Ne++);if(be.to>=me)return e(r,n,l,k,Y,Z,q);e(r,n.slice(0,be.to-te),l,k,null,Z,q),k=null,n=n.slice(be.to-te),te=be.to}}}function rn(e,t,r,n){var l=!n&&r.widgetNode;l&&e.map.push(e.pos,e.pos+t,l),!n&&e.cm.display.input.needsContentAttribute&&(l||(l=e.content.appendChild(document.createElement("span"))),l.setAttribute("cm-marker",r.id)),l&&(e.cm.display.input.setUneditable(l),e.content.appendChild(l)),e.pos+=t,e.trailingSpace=!1}function sn(e,t,r){var n=e.markedSpans,l=e.text,k=0;if(!n){for(var Y=1;Y<r.length;Y+=2)t.addToken(t,l.slice(k,k=r[Y]),wn(r[Y+1],t.cm.options));return}for(var Z=l.length,q=0,te=1,me="",be,Ne,Pe=0,Ze,dt,gt,_t,Pt;;){if(Pe==q){Ze=dt=gt=Ne="",Pt=null,_t=null,Pe=Infinity;for(var Ot=[],Ut=void 0,Yt=0;Yt<n.length;++Yt){var Vt=n[Yt],ln=Vt.marker;if(ln.type=="bookmark"&&Vt.from==q&&ln.widgetNode)Ot.push(ln);else if(Vt.from<=q&&(Vt.to==null||Vt.to>q||ln.collapsed&&Vt.to==q&&Vt.from==q)){if(Vt.to!=null&&Vt.to!=q&&Pe>Vt.to&&(Pe=Vt.to,dt=""),ln.className&&(Ze+=" "+ln.className),ln.css&&(Ne=(Ne?Ne+";":"")+ln.css),ln.startStyle&&Vt.from==q&&(gt+=" "+ln.startStyle),ln.endStyle&&Vt.to==Pe&&(Ut||(Ut=[])).push(ln.endStyle,Vt.to),ln.title&&((Pt||(Pt={})).title=ln.title),ln.attributes)for(var Ln in ln.attributes)(Pt||(Pt={}))[Ln]=ln.attributes[Ln];ln.collapsed&&(!_t||Pn(_t.marker,ln)<0)&&(_t=Vt)}else Vt.from>q&&Pe>Vt.from&&(Pe=Vt.from)}if(Ut)for(var Zn=0;Zn<Ut.length;Zn+=2)Ut[Zn+1]==Pe&&(dt+=" "+Ut[Zn]);if(!_t||_t.from==q)for(var jn=0;jn<Ot.length;++jn)rn(t,0,Ot[jn]);if(_t&&(_t.from||0)==q){if(rn(t,(_t.to==null?Z+1:_t.to)-q,_t.marker,_t.from==null),_t.to==null)return;_t.to==q&&(_t=!1)}}if(q>=Z)break;for(var Sr=Math.min(Z,Pe);;){if(me){var mr=q+me.length;if(!_t){var Vn=mr>Sr?me.slice(0,Sr-q):me;t.addToken(t,Vn,be?be+Ze:Ze,gt,q+Vn.length==Pe?dt:"",Ne,Pt)}if(mr>=Sr){me=me.slice(Sr-q),q=Sr;break}q=mr,gt=""}me=l.slice(k,k=r[te++]),be=wn(r[te++],t.cm.options)}}}function Jt(e,t,r){this.line=t,this.rest=cr(t),this.size=this.rest?St(Me(this.rest))-r+1:1,this.node=this.text=null,this.hidden=hr(e,t)}function cn(e,t,r){for(var n=[],l,k=t;k<r;k=l){var Y=new Jt(e.doc,Dt(e.doc,k),k);l=k+Y.size,n.push(Y)}return n}var Rn=null;function zt(e){Rn?Rn.ops.push(e):e.ownsGroup=Rn={ops:[e],delayedCallbacks:[]}}function lr(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var n=0;n<e.ops.length;n++){var l=e.ops[n];if(l.cursorActivityHandlers)for(;l.cursorActivityCalled<l.cursorActivityHandlers.length;)l.cursorActivityHandlers[l.cursorActivityCalled++].call(null,l.cm)}}while(r<t.length)}function jt(e,t){var r=e.ownsGroup;if(!r)return;try{lr(r)}finally{Rn=null,t(r)}}var Qt=null;function Ht(e,t){var r=Ke(e,t);if(!r.length)return;var n=Array.prototype.slice.call(arguments,2),l;Rn?l=Rn.delayedCallbacks:Qt?l=Qt:(l=Qt=[],setTimeout(In,0));for(var k=function(Z){l.push(function(){return r[Z].apply(null,n)})},Y=0;Y<r.length;++Y)k(Y)}function In(){var e=Qt;Qt=null;for(var t=0;t<e.length;++t)e[t]()}function Rr(e,t,r,n){for(var l=0;l<t.changes.length;l++){var k=t.changes[l];k=="text"?ga(e,t):k=="gutter"?to(e,t,r,n):k=="class"?va(e,t):k=="widget"&&Is(e,t,n)}t.changes=null}function Wr(e){return e.node==e.text&&(e.node=s("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),U&&I<8&&(e.node.style.zIndex=2)),e.node}function Si(e,t){var r=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(r&&(r+=" CodeMirror-linebackground"),t.background)r?t.background.className=r:(t.background.parentNode.removeChild(t.background),t.background=null);else if(r){var n=Wr(t);t.background=n.insertBefore(s("div",null,r),n.firstChild),e.display.input.setUneditable(t.background)}}function Xi(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):_n(e,t)}function ga(e,t){var r=t.text.className,n=Xi(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,va(e,t)):r&&(t.text.className=r)}function va(e,t){Si(e,t),t.line.wrapClass?Wr(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var r=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=r||""}function to(e,t,r,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var l=Wr(t);t.gutterBackground=s("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),l.insertBefore(t.gutterBackground,t.text)}var k=t.line.gutterMarkers;if(e.options.lineNumbers||k){var Y=Wr(t),Z=t.gutter=s("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(Z),Y.insertBefore(Z,t.text),t.line.gutterClass&&(Z.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!k||!k["CodeMirror-linenumbers"])&&(t.lineNumber=Z.appendChild(s("div",un(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),k)for(var q=0;q<e.display.gutterSpecs.length;++q){var te=e.display.gutterSpecs[q].className,me=k.hasOwnProperty(te)&&k[te];me&&Z.appendChild(s("div",[me],"CodeMirror-gutter-elt","left: "+n.gutterLeft[te]+"px; width: "+n.gutterWidth[te]+"px"))}}}function Is(e,t,r){t.alignable&&(t.alignable=null);for(var n=_("CodeMirror-linewidget"),l=t.node.firstChild,k=void 0;l;l=k)k=l.nextSibling,n.test(l.className)&&t.node.removeChild(l);no(e,t,r)}function Ns(e,t,r,n){var l=Xi(e,t);return t.text=t.node=l.pre,l.bgClass&&(t.bgClass=l.bgClass),l.textClass&&(t.textClass=l.textClass),va(e,t),to(e,t,r,n),no(e,t,n),t.node}function no(e,t,r){if(ro(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)ro(e,t.rest[n],t,r,!1)}function ro(e,t,r,n,l){if(!t.widgets)return;for(var k=Wr(r),Y=0,Z=t.widgets;Y<Z.length;++Y){var q=Z[Y],te=s("div",[q.node],"CodeMirror-linewidget"+(q.className?" "+q.className:""));q.handleMouseEvents||te.setAttribute("cm-ignore-events","true"),Us(q,te,r,n),e.display.input.setUneditable(te),l&&q.above?k.insertBefore(te,r.gutter||r.text):k.appendChild(te),Ht(q,"redraw")}}function Us(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var l=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(l-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=l+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function Ti(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!v(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),o(t.display.measure,s("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function Br(e,t){for(var r=we(t);r!=e.wrapper;r=r.parentNode)if(!r||r.nodeType==1&&r.getAttribute("cm-ignore-events")=="true"||r.parentNode==e.sizer&&r!=e.mover)return!0}function Yi(e){return e.lineSpace.offsetTop}function ya(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function io(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=o(e.measure,s("pre","x","CodeMirror-line-like")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return!isNaN(n.left)&&!isNaN(n.right)&&(e.cachedPaddingH=n),n}function kr(e){return he-e.display.nativeBarWidth}function Jr(e){return e.display.scroller.clientWidth-kr(e)-e.display.barWidth}function ba(e){return e.display.scroller.clientHeight-kr(e)-e.display.barHeight}function Bs(e,t,r){var n=e.options.lineWrapping,l=n&&Jr(e);if(!t.measure.heights||n&&t.measure.width!=l){var k=t.measure.heights=[];if(n){t.measure.width=l;for(var Y=t.text.firstChild.getClientRects(),Z=0;Z<Y.length-1;Z++){var q=Y[Z],te=Y[Z+1];Math.abs(q.bottom-te.bottom)>2&&k.push((q.bottom+te.top)/2-r.top)}}k.push(r.bottom-r.top)}}function ao(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var l=0;l<e.rest.length;l++)if(St(e.rest[l])>r)return{map:e.measure.maps[l],cache:e.measure.caches[l],before:!0}}function js(e,t){t=Bn(t);var r=St(t),n=e.display.externalMeasured=new Jt(e.doc,t,r);n.lineN=r;var l=n.built=_n(e,n);return n.text=l.pre,o(e.display.lineMeasure,l.pre),n}function oo(e,t,r,n){return Ir(e,oi(e,t),r,n)}function Ea(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[qr(e,t)];var r=e.display.externalMeasured;if(r&&t>=r.lineN&&t<r.lineN+r.size)return r}function oi(e,t){var r=St(t),n=Ea(e,r);n&&!n.text?n=null:n&&n.changes&&(Rr(e,n,r,_a(e)),e.curOp.forceUpdate=!0),n||(n=js(e,t));var l=ao(n,t,r);return{line:t,view:n,rect:null,map:l.map,cache:l.cache,before:l.before,hasHeights:!1}}function Ir(e,t,r,n,l){t.before&&(r=-1);var k=r+(n||""),Y;return t.cache.hasOwnProperty(k)?Y=t.cache[k]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Bs(e,t.view,t.rect),t.hasHeights=!0),Y=Ws(e,t,r,n),Y.bogus||(t.cache[k]=Y)),{left:Y.left,right:Y.right,top:l?Y.rtop:Y.top,bottom:l?Y.rbottom:Y.bottom}}var so={left:0,right:0,top:0,bottom:0};function lo(e,t,r){for(var n,l,k,Y,Z,q,te=0;te<e.length;te+=3)if(Z=e[te],q=e[te+1],t<Z?(l=0,k=1,Y="left"):t<q?(l=t-Z,k=l+1):(te==e.length-3||t==q&&e[te+3]>t)&&(k=q-Z,l=k-1,t>=q&&(Y="right")),l!=null){if(n=e[te+2],Z==q&&r==(n.insertLeft?"left":"right")&&(Y=r),r=="left"&&l==0)for(;te&&e[te-2]==e[te-3]&&e[te-1].insertLeft;)n=e[(te-=3)+2],Y="left";if(r=="right"&&l==q-Z)for(;te<e.length-3&&e[te+3]==e[te+4]&&!e[te+5].insertLeft;)n=e[(te+=3)+2],Y="right";break}return{node:n,start:l,end:k,collapse:Y,coverStart:Z,coverEnd:q}}function Fs(e,t){var r=so;if(t=="left")for(var n=0;n<e.length&&!((r=e[n]).left!=r.right);n++);else for(var l=e.length-1;l>=0&&!((r=e[l]).left!=r.right);l--);return r}function Ws(e,t,r,n){var l=lo(t.map,r,n),k=l.node,Y=l.start,Z=l.end,q=l.collapse,te;if(k.nodeType==3){for(var me=0;me<4;me++){for(;Y&&et(t.line.text.charAt(l.coverStart+Y));)--Y;for(;l.coverStart+Z<l.coverEnd&&et(t.line.text.charAt(l.coverStart+Z));)++Z;if(U&&I<9&&Y==0&&Z==l.coverEnd-l.coverStart?te=k.parentNode.getBoundingClientRect():te=Fs(C(k,Y,Z).getClientRects(),n),te.left||te.right||Y==0)break;Z=Y,Y=Y-1,q="right"}U&&I<11&&(te=Hs(e.display.measure,te))}else{Y>0&&(q=n="right");var be;e.options.lineWrapping&&(be=k.getClientRects()).length>1?te=be[n=="right"?be.length-1:0]:te=k.getBoundingClientRect()}if(U&&I<9&&!Y&&(!te||!te.left&&!te.right)){var Ne=k.parentNode.getClientRects()[0];Ne?te={left:Ne.left,right:Ne.left+li(e.display),top:Ne.top,bottom:Ne.bottom}:te=so}for(var Pe=te.top-t.rect.top,Ze=te.bottom-t.rect.top,dt=(Pe+Ze)/2,gt=t.view.measure.heights,_t=0;_t<gt.length-1&&!(dt<gt[_t]);_t++);var Pt=_t?gt[_t-1]:0,Ot=gt[_t],Ut={left:(q=="right"?te.right:te.left)-t.rect.left,right:(q=="left"?te.left:te.right)-t.rect.left,top:Pt,bottom:Ot};return!te.left&&!te.right&&(Ut.bogus=!0),e.options.singleCursorHeightPerLine||(Ut.rtop=Pe,Ut.rbottom=Ze),Ut}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!pe(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}function uo(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function co(e){e.display.externalMeasure=null,d(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)uo(e.display.view[t])}function wi(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 ho(){return f&&i?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function fo(){return f&&i?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function xa(e){var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=Ti(e.widgets[r]));return t}function $i(e,t,r,n,l){if(!l){var k=xa(t);r.top+=k,r.bottom+=k}if(n=="line")return r;n||(n="local");var Y=nr(t);if(n=="local"?Y+=Yi(e.display):Y-=e.display.viewOffset,n=="page"||n=="window"){var Z=e.display.lineSpace.getBoundingClientRect();Y+=Z.top+(n=="window"?0:fo());var q=Z.left+(n=="window"?0:ho());r.left+=q,r.right+=q}return r.top+=Y,r.bottom+=Y,r}function po(e,t,r){if(r=="div")return t;var n=t.left,l=t.top;if(r=="page")n-=ho(),l-=fo();else if(r=="local"||!r){var k=e.display.sizer.getBoundingClientRect();n+=k.left,l+=k.top}var Y=e.display.lineSpace.getBoundingClientRect();return{left:n-Y.left,top:l-Y.top}}function Ca(e,t,r,n,l){return n||(n=Dt(e.doc,t.line)),$i(e,n,oo(e,n,t.ch,l),r)}function Lr(e,t,r,n,l,k){n=n||Dt(e.doc,t.line),l||(l=oi(e,n));function Y(Ze,dt){var gt=Ir(e,l,Ze,dt?"right":"left",k);return dt?gt.left=gt.right:gt.right=gt.left,$i(e,n,gt,r)}var Z=Et(n,e.doc.direction),q=t.ch,te=t.sticky;if(q>=n.text.length?(q=n.text.length,te="before"):q<=0&&(q=0,te="after"),!Z)return Y(te=="before"?q-1:q,te=="before");function me(Ze,dt,gt){var _t=Z[dt],Pt=_t.level==1;return Y(gt?Ze-1:Ze,Pt!=gt)}var be=yt(Z,q,te),Ne=xt,Pe=me(q,be,te=="before");return Ne!=null&&(Pe.other=me(q,Ne,te!="before")),Pe}function mo(e,t){var r=0;t=g(e.doc,t),e.options.lineWrapping||(r=li(e.display)*t.ch);var n=Dt(e.doc,t.line),l=nr(n)+Yi(e.display);return{left:r,right:r,top:l,bottom:l+n.height}}function Sa(e,t,r,n,l){var k=Ye(e,t,r);return k.xRel=l,n&&(k.outside=n),k}function Ta(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,r<0)return Sa(n.first,0,null,-1,-1);var l=Xt(n,r),k=n.first+n.size-1;if(l>k)return Sa(n.first+n.size-1,Dt(n,k).text.length,null,1,1);t<0&&(t=0);for(var Y=Dt(n,l);;){var Z=Ks(e,Y,l,t,r),q=Er(Y,Z.ch+(Z.xRel>0||Z.outside>0?1:0));if(!q)return Z;var te=q.find(1);if(te.line==l)return te;Y=Dt(n,l=te.line)}}function go(e,t,r,n){n-=xa(t);var l=t.text.length,k=Rt(function(Y){return Ir(e,r,Y-1).bottom<=n},l,0);return l=Rt(function(Y){return Ir(e,r,Y).top>n},k,l),{begin:k,end:l}}function vo(e,t,r,n){r||(r=oi(e,t));var l=$i(e,t,Ir(e,r,n),"line").top;return go(e,t,r,l)}function wa(e,t,r,n){return e.bottom<=r?!1:e.top>r?!0:(n?e.left:e.right)>t}function Ks(e,t,r,n,l){l-=nr(t);var k=oi(e,t),Y=xa(t),Z=0,q=t.text.length,te=!0,me=Et(t,e.doc.direction);if(me){var be=(e.options.lineWrapping?Gs:zs)(e,t,r,k,me,n,l);te=be.level!=1,Z=te?be.from:be.to-1,q=te?be.to:be.from-1}var Ne=null,Pe=null,Ze=Rt(function(Yt){var Vt=Ir(e,k,Yt);return Vt.top+=Y,Vt.bottom+=Y,wa(Vt,n,l,!1)?(Vt.top<=l&&Vt.left<=n&&(Ne=Yt,Pe=Vt),!0):!1},Z,q),dt,gt,_t=!1;if(Pe){var Pt=n-Pe.left<Pe.right-n,Ot=Pt==te;Ze=Ne+(Ot?0:1),gt=Ot?"after":"before",dt=Pt?Pe.left:Pe.right}else{!te&&(Ze==q||Ze==Z)&&Ze++,gt=Ze==0?"after":Ze==t.text.length?"before":Ir(e,k,Ze-(te?1:0)).bottom+Y<=l==te?"after":"before";var Ut=Lr(e,Ye(r,Ze,gt),"line",t,k);dt=Ut.left,_t=l<Ut.top?-1:l>=Ut.bottom?1:0}return Ze=nt(t.text,Ze,1),Sa(r,Ze,gt,_t,n-dt)}function zs(e,t,r,n,l,k,Y){var Z=Rt(function(be){var Ne=l[be],Pe=Ne.level!=1;return wa(Lr(e,Ye(r,Pe?Ne.to:Ne.from,Pe?"before":"after"),"line",t,n),k,Y,!0)},0,l.length-1),q=l[Z];if(Z>0){var te=q.level!=1,me=Lr(e,Ye(r,te?q.from:q.to,te?"after":"before"),"line",t,n);wa(me,k,Y,!0)&&me.top>Y&&(q=l[Z-1])}return q}function Gs(e,t,r,n,l,k,Y){var Z=go(e,t,n,Y),q=Z.begin,te=Z.end;/\s/.test(t.text.charAt(te-1))&&te--;for(var me=null,be=null,Ne=0;Ne<l.length;Ne++){var Pe=l[Ne];if(Pe.from>=te||Pe.to<=q)continue;var Ze=Pe.level!=1,dt=Ir(e,n,Ze?Math.min(te,Pe.to)-1:Math.max(q,Pe.from)).right,gt=dt<k?k-dt+1e9:dt-k;(!me||be>gt)&&(me=Pe,be=gt)}return me||(me=l[l.length-1]),me.from<q&&(me={from:q,to:me.to,level:me.level}),me.to>te&&(me={from:me.from,to:te,level:me.level}),me}var Qr;function si(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Qr==null){Qr=s("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Qr.appendChild(document.createTextNode("x")),Qr.appendChild(s("br"));Qr.appendChild(document.createTextNode("x"))}o(e.measure,Qr);var r=Qr.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),d(e.measure),r||1}function li(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=s("span","xxxxxxxxxx"),r=s("pre",[t],"CodeMirror-line-like");o(e.measure,r);var n=t.getBoundingClientRect(),l=(n.right-n.left)/10;return l>2&&(e.cachedCharWidth=l),l||10}function _a(e){for(var t=e.display,r={},n={},l=t.gutters.clientLeft,k=t.gutters.firstChild,Y=0;k;k=k.nextSibling,++Y){var Z=e.display.gutterSpecs[Y].className;r[Z]=k.offsetLeft+k.clientLeft+l,n[Z]=k.clientWidth}return{fixedPos:Oa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function Oa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function yo(e){var t=si(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/li(e.display)-3);return function(l){if(hr(e.doc,l))return 0;var k=0;if(l.widgets)for(var Y=0;Y<l.widgets.length;Y++)l.widgets[Y].height&&(k+=l.widgets[Y].height);return r?k+(Math.ceil(l.text.length/n)||1)*t:k+t}}function Aa(e){var t=e.doc,r=yo(e);t.iter(function(n){var l=r(n);l!=n.height&&ht(n,l)})}function Zr(e,t,r,n){var l=e.display;if(!r&&we(t).getAttribute("cm-not-content")=="true")return null;var k,Y,Z=l.lineSpace.getBoundingClientRect();try{k=t.clientX-Z.left,Y=t.clientY-Z.top}catch(be){return null}var q=Ta(e,k,Y),te;if(n&&q.xRel>0&&(te=Dt(e.doc,q.line).text).length==q.ch){var me=$(te,te.length,e.options.tabSize)-te.length;q=Ye(q.line,Math.max(0,Math.round((k-io(e.display).left)/li(e.display))-me))}return q}function qr(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var r=e.display.view,n=0;n<r.length;n++)if(t-=r[n].size,t<0)return n}function fr(e,t,r,n){t==null&&(t=e.doc.first),r==null&&(r=e.doc.first+e.doc.size),n||(n=0);var l=e.display;if(n&&r<l.viewTo&&(l.updateLineNumbers==null||l.updateLineNumbers>t)&&(l.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=l.viewTo)bn&&xr(e.doc,t)<l.viewTo&&Kr(e);else if(r<=l.viewFrom)bn&&Ur(e.doc,r+n)>l.viewFrom?Kr(e):(l.viewFrom+=n,l.viewTo+=n);else if(t<=l.viewFrom&&r>=l.viewTo)Kr(e);else if(t<=l.viewFrom){var k=Ji(e,r,r+n,1);k?(l.view=l.view.slice(k.index),l.viewFrom=k.lineN,l.viewTo+=n):Kr(e)}else if(r>=l.viewTo){var Y=Ji(e,t,t,-1);Y?(l.view=l.view.slice(0,Y.index),l.viewTo=Y.lineN):Kr(e)}else{var Z=Ji(e,t,t,-1),q=Ji(e,r,r+n,1);Z&&q?(l.view=l.view.slice(0,Z.index).concat(cn(e,Z.lineN,q.lineN)).concat(l.view.slice(q.index)),l.viewTo+=n):Kr(e)}var te=l.externalMeasured;te&&(r<te.lineN?te.lineN+=n:t<te.lineN+te.size&&(l.externalMeasured=null))}function Hr(e,t,r){e.curOp.viewChanged=!0;var n=e.display,l=e.display.externalMeasured;if(l&&t>=l.lineN&&t<l.lineN+l.size&&(n.externalMeasured=null),t<n.viewFrom||t>=n.viewTo)return;var k=n.view[qr(e,t)];if(k.node==null)return;var Y=k.changes||(k.changes=[]);ae(Y,r)==-1&&Y.push(r)}function Kr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ji(e,t,r,n){var l=qr(e,t),k,Y=e.display.view;if(!bn||r==e.doc.first+e.doc.size)return{index:l,lineN:r};for(var Z=e.display.viewFrom,q=0;q<l;q++)Z+=Y[q].size;if(Z!=t){if(n>0){if(l==Y.length-1)return null;k=Z+Y[l].size-t,l++}else k=Z-t;t+=k,r+=k}for(;xr(e.doc,r)!=r;){if(l==(n<0?0:Y.length-1))return null;r+=n*Y[l-(n<0?1:0)].size,l+=n}return{index:l,lineN:r}}function Vs(e,t,r){var n=e.display,l=n.view;l.length==0||t>=n.viewTo||r<=n.viewFrom?(n.view=cn(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=cn(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(qr(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(cn(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,qr(e,r)))),n.viewTo=r}function bo(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var l=t[n];!l.hidden&&(!l.node||l.changes)&&++r}return r}function _i(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Eo(e,t){t===void 0&&(t=!0);for(var r=e.doc,n={},l=n.cursors=document.createDocumentFragment(),k=n.selection=document.createDocumentFragment(),Y=0;Y<r.sel.ranges.length;Y++){if(!t&&Y==r.sel.primIndex)continue;var Z=r.sel.ranges[Y];if(Z.from().line>=e.display.viewTo||Z.to().line<e.display.viewFrom)continue;var q=Z.empty();(q||e.options.showCursorWhenSelecting)&&xo(e,Z.head,l),q||Xs(e,Z,k)}return n}function xo(e,t,r){var n=Lr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),l=r.appendChild(s("div","\xA0","CodeMirror-cursor"));if(l.style.left=n.left+"px",l.style.top=n.top+"px",l.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var k=r.appendChild(s("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));k.style.display="",k.style.left=n.other.left+"px",k.style.top=n.other.top+"px",k.style.height=(n.other.bottom-n.other.top)*.85+"px"}}function Qi(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,r){var n=e.display,l=e.doc,k=document.createDocumentFragment(),Y=io(e.display),Z=Y.left,q=Math.max(n.sizerWidth,Jr(e)-n.sizer.offsetLeft)-Y.right,te=l.direction=="ltr";function me(Ot,Ut,Yt,Vt){Ut<0&&(Ut=0),Ut=Math.round(Ut),Vt=Math.round(Vt),k.appendChild(s("div",null,"CodeMirror-selected","position: absolute; left: "+Ot+`px;
|
|
top: `+Ut+"px; width: "+(Yt==null?q-Ot:Yt)+`px;
|
|
height: `+(Vt-Ut)+"px"))}function be(Ot,Ut,Yt){var Vt=Dt(l,Ot),ln=Vt.text.length,Ln,Zn;function jn(Vn,gr){return Ca(e,Ye(Ot,Vn),"div",Vt,gr)}function Sr(Vn,gr,rr){var $n=vo(e,Vt,null,Vn),Xn=gr=="ltr"==(rr=="after")?"left":"right",Fn=rr=="after"?$n.begin:$n.end-(/\s/.test(Vt.text.charAt($n.end-1))?2:1);return jn(Fn,Xn)[Xn]}var mr=Et(Vt,l.direction);return Ct(mr,Ut||0,Yt==null?ln:Yt,function(Vn,gr,rr,$n){var Xn=rr=="ltr",Fn=jn(Vn,Xn?"left":"right"),vr=jn(gr-1,Xn?"right":"left"),xi=Ut==null&&Vn==0,$r=Yt==null&&gr==ln,sr=$n==0,Nr=!mr||$n==mr.length-1;if(vr.top-Fn.top<=3){var qn=(te?xi:$r)&&sr,qa=(te?$r:xi)&&Nr,Fr=qn?Z:(Xn?Fn:vr).left,ii=qa?q:(Xn?vr:Fn).right;me(Fr,Fn.top,ii-Fr,Fn.bottom)}else{var ai,dr,Ci,eo;Xn?(ai=te&&xi&&sr?Z:Fn.left,dr=te?q:Sr(Vn,rr,"before"),Ci=te?Z:Sr(gr,rr,"after"),eo=te&&$r&&Nr?q:vr.right):(ai=te?Sr(Vn,rr,"before"):Z,dr=!te&&xi&&sr?q:Fn.right,Ci=!te&&$r&&Nr?Z:vr.left,eo=te?Sr(gr,rr,"after"):q),me(ai,Fn.top,dr-ai,Fn.bottom),Fn.bottom<vr.top&&me(Z,Fn.bottom,null,vr.top),me(Ci,vr.top,eo-Ci,vr.bottom)}(!Ln||Qi(Fn,Ln)<0)&&(Ln=Fn),Qi(vr,Ln)<0&&(Ln=vr),(!Zn||Qi(Fn,Zn)<0)&&(Zn=Fn),Qi(vr,Zn)<0&&(Zn=vr)}),{start:Ln,end:Zn}}var Ne=t.from(),Pe=t.to();if(Ne.line==Pe.line)be(Ne.line,Ne.ch,Pe.ch);else{var Ze=Dt(l,Ne.line),dt=Dt(l,Pe.line),gt=Bn(Ze)==Bn(dt),_t=be(Ne.line,Ne.ch,gt?Ze.text.length+1:null).end,Pt=be(Pe.line,gt?0:null,Pe.ch).start;gt&&(_t.top<Pt.top-2?(me(_t.right,_t.top,null,_t.bottom),me(Z,Pt.top,Pt.left,Pt.bottom)):me(_t.right,_t.top,Pt.left-_t.right,_t.bottom)),_t.bottom<Pt.top&&me(Z,_t.bottom,null,Pt.top)}r.appendChild(k)}function Da(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||ui(e),t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function Co(e){e.state.focused||(e.display.input.focus(),Ra(e))}function So(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,ui(e))},100)}function Ra(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(De(e,"focus",e,t),e.state.focused=!0,B(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),E&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Da(e)}function ui(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(De(e,"blur",e,t),e.state.focused=!1,h(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Zi(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var l=t.view[n],k=e.options.lineWrapping,Y=void 0,Z=0;if(l.hidden)continue;if(U&&I<8){var q=l.node.offsetTop+l.node.offsetHeight;Y=q-r,r=q}else{var te=l.node.getBoundingClientRect();Y=te.bottom-te.top,!k&&l.text.firstChild&&(Z=l.text.firstChild.getBoundingClientRect().right-te.left-1)}var me=l.line.height-Y;if((me>.005||me<-.005)&&(ht(l.line,Y),To(l.line),l.rest))for(var be=0;be<l.rest.length;be++)To(l.rest[be]);if(Z>e.display.sizerWidth){var Ne=Math.ceil(Z/li(e.display));Ne>e.display.maxLineLength&&(e.display.maxLineLength=Ne,e.display.maxLine=l.line,e.display.maxLineChanged=!0)}}}function To(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var r=e.widgets[t],n=r.node.parentNode;n&&(r.height=n.offsetHeight)}}function qi(e,t,r){var n=r&&r.top!=null?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-Yi(e));var l=r&&r.bottom!=null?r.bottom:n+e.wrapper.clientHeight,k=Xt(t,n),Y=Xt(t,l);if(r&&r.ensure){var Z=r.ensure.from.line,q=r.ensure.to.line;Z<k?(k=Z,Y=Xt(t,nr(Dt(t,Z))+e.wrapper.clientHeight)):Math.min(q,t.lastLine())>=Y&&(k=Xt(t,nr(Dt(t,q))-e.wrapper.clientHeight),Y=q)}return{from:k,to:Math.max(Y,k+1)}}function Ys(e,t){if(We(e,"scrollCursorIntoView"))return;var r=e.display,n=r.sizer.getBoundingClientRect(),l=null;if(t.top+n.top<0?l=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(l=!1),l!=null&&!p){var k=s("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-r.viewOffset-Yi(e.display))+`px;
|
|
height: `+(t.bottom-t.top+kr(e)+r.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(k),k.scrollIntoView(l),e.display.lineSpace.removeChild(k)}}function $s(e,t,r,n){n==null&&(n=0);var l;!e.options.lineWrapping&&t==r&&(t=t.ch?Ye(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,r=t.sticky=="before"?Ye(t.line,t.ch+1,"before"):t);for(var k=0;k<5;k++){var Y=!1,Z=Lr(e,t),q=!r||r==t?Z:Lr(e,r);l={left:Math.min(Z.left,q.left),top:Math.min(Z.top,q.top)-n,right:Math.max(Z.left,q.left),bottom:Math.max(Z.bottom,q.bottom)+n};var te=La(e,l),me=e.doc.scrollTop,be=e.doc.scrollLeft;if(te.scrollTop!=null&&(Ai(e,te.scrollTop),Math.abs(e.doc.scrollTop-me)>1&&(Y=!0)),te.scrollLeft!=null&&(ei(e,te.scrollLeft),Math.abs(e.doc.scrollLeft-be)>1&&(Y=!0)),!Y)break}return l}function Js(e,t){var r=La(e,t);r.scrollTop!=null&&Ai(e,r.scrollTop),r.scrollLeft!=null&&ei(e,r.scrollLeft)}function La(e,t){var r=e.display,n=si(e.display);t.top<0&&(t.top=0);var l=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:r.scroller.scrollTop,k=ba(e),Y={};t.bottom-t.top>k&&(t.bottom=t.top+k);var Z=e.doc.height+ya(r),q=t.top<n,te=t.bottom>Z-n;if(t.top<l)Y.scrollTop=q?0:t.top;else if(t.bottom>l+k){var me=Math.min(t.top,(te?Z:t.bottom)-k);me!=l&&(Y.scrollTop=me)}var be=e.options.fixedGutter?0:r.gutters.offsetWidth,Ne=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:r.scroller.scrollLeft-be,Pe=Jr(e)-r.gutters.offsetWidth,Ze=t.right-t.left>Pe;return Ze&&(t.right=t.left+Pe),t.left<10?Y.scrollLeft=0:t.left<Ne?Y.scrollLeft=Math.max(0,t.left+be-(Ze?0:10)):t.right>Pe+Ne-3&&(Y.scrollLeft=t.right+(Ze?0:10)-Pe),Y}function Ma(e,t){if(t==null)return;ea(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function di(e){ea(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Oi(e,t,r){(t!=null||r!=null)&&ea(e),t!=null&&(e.curOp.scrollLeft=t),r!=null&&(e.curOp.scrollTop=r)}function Qs(e,t){ea(e),e.curOp.scrollToPos=t}function ea(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=mo(e,t.from),n=mo(e,t.to);wo(e,r,n,t.margin)}}function wo(e,t,r,n){var l=La(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});Oi(e,l.scrollLeft,l.scrollTop)}function Ai(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;R||ka(e,{top:t}),_o(e,t,!0),R&&ka(e),Li(e,100)}function _o(e,t,r){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!r)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function ei(e,t,r,n){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n)return;e.doc.scrollLeft=t,Lo(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function Di(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+ya(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+kr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var ti=function(e,t,r){this.cm=r;var n=this.vert=s("div",[s("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),l=this.horiz=s("div",[s("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=l.tabIndex=-1,e(n),e(l),xe(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),xe(l,"scroll",function(){l.clientWidth&&t(l.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,U&&I<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};ti.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var l=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+l)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var k=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+k)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(n==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},ti.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},ti.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},ti.prototype.zeroWidthHack=function(){var e=u&&!T?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new re,this.disableVert=new re},ti.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto";function n(){var l=e.getBoundingClientRect(),k=r=="vert"?document.elementFromPoint(l.right-1,(l.top+l.bottom)/2):document.elementFromPoint((l.right+l.left)/2,l.bottom-1);k!=e?e.style.pointerEvents="none":t.set(1e3,n)}t.set(1e3,n)},ti.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Ri=function(){};Ri.prototype.update=function(){return{bottom:0,right:0}},Ri.prototype.setScrollLeft=function(){},Ri.prototype.setScrollTop=function(){},Ri.prototype.clear=function(){};function ci(e,t){t||(t=Di(e));var r=e.display.barWidth,n=e.display.barHeight;Oo(e,t);for(var l=0;l<4&&r!=e.display.barWidth||n!=e.display.barHeight;l++)r!=e.display.barWidth&&e.options.lineWrapping&&Zi(e),Oo(e,Di(e)),r=e.display.barWidth,n=e.display.barHeight}function Oo(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}var Ao={native:ti,null:Ri};function Do(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&h(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Ao[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),xe(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,r){r=="horizontal"?ei(e,t):Ai(e,t)},e),e.display.scrollbars.addClass&&B(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function ni(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:++Zs},zt(e.curOp)}function ri(e){var t=e.curOp;t&&jt(t,function(r){for(var n=0;n<r.ops.length;n++)r.ops[n].cm.curOp=null;qs(r)})}function qs(e){for(var t=e.ops,r=0;r<t.length;r++)el(t[r]);for(var n=0;n<t.length;n++)tl(t[n]);for(var l=0;l<t.length;l++)nl(t[l]);for(var k=0;k<t.length;k++)rl(t[k]);for(var Y=0;Y<t.length;Y++)il(t[Y])}function el(e){var t=e.cm,r=t.display;ol(t),e.updateMaxLine&&ir(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<r.viewFrom||e.scrollToPos.to.line>=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new ta(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Pa(e.cm,e.update)}function nl(e){var t=e.cm,r=t.display;e.updatedDisplay&&Zi(t),e.barMeasure=Di(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=oo(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+kr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Jr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function rl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&ei(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==M();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&ci(t,e.barMeasure),e.updatedDisplay&&Na(t,e.barMeasure),e.selectionChanged&&Da(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&Co(e.cm)}function il(e){var t=e.cm,r=t.display,n=t.doc;if(e.updatedDisplay&&Ro(t,e.update),r.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(r.wheelStartX=r.wheelStartY=null),e.scrollTop!=null&&_o(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&ei(t,e.scrollLeft,!0,!0),e.scrollToPos){var l=$s(t,g(n,e.scrollToPos.from),g(n,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,l)}var k=e.maybeHiddenMarkers,Y=e.maybeUnhiddenMarkers;if(k)for(var Z=0;Z<k.length;++Z)k[Z].lines.length||De(k[Z],"hide");if(Y)for(var q=0;q<Y.length;++q)Y[q].lines.length&&De(Y[q],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&De(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Cr(e,t){if(e.curOp)return t();ni(e);try{return t()}finally{ri(e)}}function Jn(e,t){return function(){if(e.curOp)return t.apply(e,arguments);ni(e);try{return t.apply(e,arguments)}finally{ri(e)}}}function ur(e){return function(){if(this.curOp)return e.apply(this,arguments);ni(this);try{return e.apply(this,arguments)}finally{ri(this)}}}function Qn(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);ni(t);try{return e.apply(this,arguments)}finally{ri(t)}}}function Li(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,G(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var r=+new Date+e.options.workTime,n=Le(e,t.highlightFrontier),l=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),function(k){if(n.line>=e.display.viewFrom){var Y=k.styles,Z=k.text.length>e.options.maxHighlightLength?Lt(t.mode,n.state):null,q=ve(e,k,n,!0);Z&&(n.state=Z),k.styles=q.styles;var te=k.styleClasses,me=q.classes;me?k.styleClasses=me:te&&(k.styleClasses=null);for(var be=!Y||Y.length!=k.styles.length||te!=me&&(!te||!me||te.bgClass!=me.bgClass||te.textClass!=me.textClass),Ne=0;!be&&Ne<Y.length;++Ne)be=Y[Ne]!=k.styles[Ne];be&&l.push(n.line),k.stateAfter=n.save(),n.nextLine()}else k.text.length<=e.options.maxHighlightLength&&At(e,k.text,n),k.stateAfter=n.line%5==0?n.save():null,n.nextLine();if(+new Date>r)return Li(e,e.options.workDelay),!0}),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),l.length&&Cr(e,function(){for(var k=0;k<l.length;k++)Hr(e,l[k],"text")})}var ta=function(e,t,r){var n=e.display;this.viewport=t,this.visible=qi(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=Jr(e),this.force=r,this.dims=_a(e),this.events=[]};ta.prototype.signal=function(e,t){de(e,t)&&this.events.push(arguments)},ta.prototype.finish=function(){for(var e=0;e<this.events.length;e++)De.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=kr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=kr(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=M();if(!t||!v(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&v(e.display.lineDiv,n.anchorNode)&&(r.anchorNode=n.anchorNode,r.anchorOffset=n.anchorOffset,r.focusNode=n.focusNode,r.focusOffset=n.focusOffset)}return r}function ll(e){if(!e||!e.activeElt||e.activeElt==M())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&v(document.body,e.anchorNode)&&v(document.body,e.focusNode)){var t=window.getSelection(),r=document.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),t.removeAllRanges(),t.addRange(r),t.extend(e.focusNode,e.focusOffset)}}function Pa(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return Kr(e),!1;if(!t.force&&t.visible.from>=r.viewFrom&&t.visible.to<=r.viewTo&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&bo(e)==0)return!1;Mo(e)&&(Kr(e),t.dims=_a(e));var l=n.first+n.size,k=Math.max(t.visible.from-e.options.viewportMargin,n.first),Y=Math.min(l,t.visible.to+e.options.viewportMargin);r.viewFrom<k&&k-r.viewFrom<20&&(k=Math.max(n.first,r.viewFrom)),r.viewTo>Y&&r.viewTo-Y<20&&(Y=Math.min(l,r.viewTo)),bn&&(k=xr(e.doc,k),Y=Ur(e.doc,Y));var Z=k!=r.viewFrom||Y!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Vs(e,k,Y),r.viewOffset=nr(Dt(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var q=bo(e);if(!Z&&q==0&&!t.force&&r.renderedView==r.view&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo))return!1;var te=sl(e);return q>4&&(r.lineDiv.style.display="none"),ul(e,r.updateLineNumbers,t.dims),q>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,ll(te),d(r.cursorDiv),d(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,Z&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,Li(e,400)),r.updateLineNumbers=null,!0}function Ro(e,t){for(var r=t.viewport,n=!0;;n=!1){if(!n||!e.options.lineWrapping||t.oldDisplayWidth==Jr(e)){if(r&&r.top!=null&&(r={top:Math.min(e.doc.height+ya(e.display)-ba(e),r.top)}),t.visible=qi(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else n&&(t.visible=qi(e.display,e.doc,r));if(!Pa(e,t))break;Zi(e);var l=Di(e);_i(e),ci(e,l),Na(e,l),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function ka(e,t){var r=new ta(e,t);if(Pa(e,r)){Zi(e),Ro(e,r);var n=Di(e);_i(e),ci(e,n),Na(e,n),r.finish()}}function ul(e,t,r){var n=e.display,l=e.options.lineNumbers,k=n.lineDiv,Y=k.firstChild;function Z(Ze){var dt=Ze.nextSibling;return E&&u&&e.display.currentWheelTarget==Ze?Ze.style.display="none":Ze.parentNode.removeChild(Ze),dt}for(var q=n.view,te=n.viewFrom,me=0;me<q.length;me++){var be=q[me];if(!be.hidden)if(!be.node||be.node.parentNode!=k){var Ne=Ns(e,be,te,r);k.insertBefore(Ne,Y)}else{for(;Y!=be.node;)Y=Z(Y);var Pe=l&&t!=null&&t<=te&&be.lineNumber;be.changes&&(ae(be.changes,"gutter")>-1&&(Pe=!1),Rr(e,be,te,r)),Pe&&(d(be.lineNumber),be.lineNumber.appendChild(document.createTextNode(un(e.options,te)))),Y=be.node.nextSibling}te+=be.size}for(;Y;)Y=Z(Y)}function Ia(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Na(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+kr(e)+"px"}function Lo(e){var t=e.display,r=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var n=Oa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,l=t.gutters.offsetWidth,k=n+"px",Y=0;Y<r.length;Y++)if(!r[Y].hidden){e.options.fixedGutter&&(r[Y].gutter&&(r[Y].gutter.style.left=k),r[Y].gutterBackground&&(r[Y].gutterBackground.style.left=k));var Z=r[Y].alignable;if(Z)for(var q=0;q<Z.length;q++)Z[q].style.left=k}e.options.fixedGutter&&(t.gutters.style.left=n+l+"px")}function Mo(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=un(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var l=n.measure.appendChild(s("div",[s("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),k=l.firstChild.offsetWidth,Y=l.offsetWidth-k;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(k,n.lineGutter.offsetWidth-Y)+1,n.lineNumWidth=n.lineNumInnerWidth+Y,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",Ia(e.display),!0}return!1}function Ua(e,t){for(var r=[],n=!1,l=0;l<e.length;l++){var k=e[l],Y=null;if(typeof k!="string"&&(Y=k.style,k=k.className),k=="CodeMirror-linenumbers")if(t)n=!0;else continue;r.push({className:k,style:Y})}return t&&!n&&r.push({className:"CodeMirror-linenumbers",style:null}),r}function Po(e){var t=e.gutters,r=e.gutterSpecs;d(t),e.lineGutter=null;for(var n=0;n<r.length;++n){var l=r[n],k=l.className,Y=l.style,Z=t.appendChild(s("div",null,"CodeMirror-gutter "+k));Y&&(Z.style.cssText=Y),k=="CodeMirror-linenumbers"&&(e.lineGutter=Z,Z.style.width=(e.lineNumWidth||1)+"px")}t.style.display=r.length?"":"none",Ia(e)}function Mi(e){Po(e.display),fr(e),Lo(e)}function dl(e,t,r,n){var l=this;this.input=r,l.scrollbarFiller=s("div",null,"CodeMirror-scrollbar-filler"),l.scrollbarFiller.setAttribute("cm-not-content","true"),l.gutterFiller=s("div",null,"CodeMirror-gutter-filler"),l.gutterFiller.setAttribute("cm-not-content","true"),l.lineDiv=w("div",null,"CodeMirror-code"),l.selectionDiv=s("div",null,null,"position: relative; z-index: 1"),l.cursorDiv=s("div",null,"CodeMirror-cursors"),l.measure=s("div",null,"CodeMirror-measure"),l.lineMeasure=s("div",null,"CodeMirror-measure"),l.lineSpace=w("div",[l.measure,l.lineMeasure,l.selectionDiv,l.cursorDiv,l.lineDiv],null,"position: relative; outline: none");var k=w("div",[l.lineSpace],"CodeMirror-lines");l.mover=s("div",[k],null,"position: relative"),l.sizer=s("div",[l.mover],"CodeMirror-sizer"),l.sizerWidth=null,l.heightForcer=s("div",null,null,"position: absolute; height: "+he+"px; width: 1px;"),l.gutters=s("div",null,"CodeMirror-gutters"),l.lineGutter=null,l.scroller=s("div",[l.sizer,l.heightForcer,l.gutters],"CodeMirror-scroll"),l.scroller.setAttribute("tabIndex","-1"),l.wrapper=s("div",[l.scrollbarFiller,l.gutterFiller,l.scroller],"CodeMirror"),U&&I<8&&(l.gutters.style.zIndex=-1,l.scroller.style.paddingRight=0),!E&&!(R&&a)&&(l.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(l.wrapper):e(l.wrapper)),l.viewFrom=l.viewTo=t.first,l.reportedViewFrom=l.reportedViewTo=t.first,l.view=[],l.renderedView=null,l.externalMeasured=null,l.viewOffset=0,l.lastWrapHeight=l.lastWrapWidth=0,l.updateLineNumbers=null,l.nativeBarWidth=l.barHeight=l.barWidth=0,l.scrollbarsClipped=!1,l.lineNumWidth=l.lineNumInnerWidth=l.lineNumChars=null,l.alignWidgets=!1,l.cachedCharWidth=l.cachedTextHeight=l.cachedPaddingH=null,l.maxLine=null,l.maxLineLength=0,l.maxLineChanged=!1,l.wheelDX=l.wheelDY=l.wheelStartX=l.wheelStartY=null,l.shift=!1,l.selForContextMenu=null,l.activeTouch=null,l.gutterSpecs=Ua(n.gutters,n.lineNumbers),Po(l),r.init(l)}var na=0,wr=null;U?wr=-.53:R?wr=15:f?wr=-.7:P&&(wr=-1/3);function ko(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),r==null&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:r==null&&(r=e.wheelDelta),{x:t,y:r}}function cl(e){var t=ko(e);return t.x*=wr,t.y*=wr,t}function Io(e,t){var r=ko(t),n=r.x,l=r.y,k=e.display,Y=k.scroller,Z=Y.scrollWidth>Y.clientWidth,q=Y.scrollHeight>Y.clientHeight;if(!(n&&Z||l&&q))return;if(l&&u&&E){e:for(var te=t.target,me=k.view;te!=Y;te=te.parentNode)for(var be=0;be<me.length;be++)if(me[be].node==te){e.display.currentWheelTarget=te;break e}}if(n&&!R&&!S&&wr!=null){l&&q&&Ai(e,Math.max(0,Y.scrollTop+l*wr)),ei(e,Math.max(0,Y.scrollLeft+n*wr)),(!l||l&&q)&&ne(t),k.wheelStartX=null;return}if(l&&wr!=null){var Ne=l*wr,Pe=e.doc.scrollTop,Ze=Pe+k.wrapper.clientHeight;Ne<0?Pe=Math.max(0,Pe+Ne-50):Ze=Math.min(e.doc.height,Ze+Ne+50),ka(e,{top:Pe,bottom:Ze})}na<20&&(k.wheelStartX==null?(k.wheelStartX=Y.scrollLeft,k.wheelStartY=Y.scrollTop,k.wheelDX=n,k.wheelDY=l,setTimeout(function(){if(k.wheelStartX==null)return;var dt=Y.scrollLeft-k.wheelStartX,gt=Y.scrollTop-k.wheelStartY,_t=gt&&k.wheelDY&>/k.wheelDY||dt&&k.wheelDX&&dt/k.wheelDX;if(k.wheelStartX=k.wheelStartY=null,!_t)return;wr=(wr*na+_t)/(na+1),++na},200)):(k.wheelDX+=n,k.wheelDY+=l))}var _r=function(e,t){this.ranges=e,this.primIndex=t};_r.prototype.primary=function(){return this.ranges[this.primIndex]},_r.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var r=this.ranges[t],n=e.ranges[t];if(!kt(r.anchor,n.anchor)||!kt(r.head,n.head))return!1}return!0},_r.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Cn(vn(this.ranges[t].anchor),vn(this.ranges[t].head));return new _r(e,this.primIndex)},_r.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},_r.prototype.contains=function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(ft(t,n.from())>=0&&ft(e,n.to())<=0)return r}return-1};var Cn=function(e,t){this.anchor=e,this.head=t};Cn.prototype.from=function(){return Zt(this.anchor,this.head)},Cn.prototype.to=function(){return Gt(this.anchor,this.head)},Cn.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Mr(e,t,r){var n=e&&e.options.selectionsMayTouch,l=t[r];t.sort(function(Ne,Pe){return ft(Ne.from(),Pe.from())}),r=ae(t,l);for(var k=1;k<t.length;k++){var Y=t[k],Z=t[k-1],q=ft(Z.to(),Y.from());if(n&&!Y.empty()?q>0:q>=0){var te=Zt(Z.from(),Y.from()),me=Gt(Z.to(),Y.to()),be=Z.empty()?Y.from()==Y.head:Z.from()==Z.head;k<=r&&--r,t.splice(--k,2,new Cn(be?me:te,be?te:me))}}return new _r(t,r)}function zr(e,t){return new _r([new Cn(e,t||e)],0)}function Gr(e){return e.text?Ye(e.from.line+e.text.length-1,Me(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function No(e,t){if(ft(e,t.from)<0)return e;if(ft(e,t.to)<=0)return Gr(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=Gr(t).ch-t.to.ch),Ye(r,n)}function Ba(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var l=e.sel.ranges[n];r.push(new Cn(No(l.anchor,t),No(l.head,t)))}return Mr(e.cm,r,e.sel.primIndex)}function Uo(e,t,r){return e.line==t.line?Ye(r.line,e.ch-t.ch+r.ch):Ye(r.line+(e.line-t.line),e.ch)}function hl(e,t,r){for(var n=[],l=Ye(e.first,0),k=l,Y=0;Y<t.length;Y++){var Z=t[Y],q=Uo(Z.from,l,k),te=Uo(Gr(Z),l,k);if(l=Z.to,k=te,r=="around"){var me=e.sel.ranges[Y],be=ft(me.head,me.anchor)<0;n[Y]=new Cn(be?te:q,be?q:te)}else n[Y]=new Cn(q,q)}return new _r(n,e.sel.primIndex)}function ja(e){e.doc.mode=qe(e.options,e.doc.modeOption),Pi(e)}function Pi(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,Li(e,100),e.state.modeGen++,e.curOp&&fr(e)}function Bo(e,t){return t.from.ch==0&&t.to.ch==0&&Me(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Fa(e,t,r,n){function l(Pt){return r?r[Pt]:null}function k(Pt,Ot,Ut){En(Pt,Ot,Ut,n),Ht(Pt,"change",Pt,t)}function Y(Pt,Ot){for(var Ut=[],Yt=Pt;Yt<Ot;++Yt)Ut.push(new ar(te[Yt],l(Yt),n));return Ut}var Z=t.from,q=t.to,te=t.text,me=Dt(e,Z.line),be=Dt(e,q.line),Ne=Me(te),Pe=l(te.length-1),Ze=q.line-Z.line;if(t.full)e.insert(0,Y(0,te.length)),e.remove(te.length,e.size-te.length);else if(Bo(e,t)){var dt=Y(0,te.length-1);k(be,be.text,Pe),Ze&&e.remove(Z.line,Ze),dt.length&&e.insert(Z.line,dt)}else if(me==be)if(te.length==1)k(me,me.text.slice(0,Z.ch)+Ne+me.text.slice(q.ch),Pe);else{var gt=Y(1,te.length-1);gt.push(new ar(Ne+me.text.slice(q.ch),Pe,n)),k(me,me.text.slice(0,Z.ch)+te[0],l(0)),e.insert(Z.line+1,gt)}else if(te.length==1)k(me,me.text.slice(0,Z.ch)+te[0]+be.text.slice(q.ch),l(0)),e.remove(Z.line+1,Ze);else{k(me,me.text.slice(0,Z.ch)+te[0],l(0)),k(be,Ne+be.text.slice(q.ch),Pe);var _t=Y(1,te.length-1);Ze>1&&e.remove(Z.line+1,Ze-1),e.insert(Z.line+1,_t)}Ht(e,"change",e,t)}function Vr(e,t,r){function n(l,k,Y){if(l.linked)for(var Z=0;Z<l.linked.length;++Z){var q=l.linked[Z];if(q.doc==k)continue;var te=Y&&q.sharedHist;if(r&&!te)continue;t(q.doc,te),n(q.doc,l,te)}}n(e,null,!0)}function jo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Aa(e),ja(e),Fo(e),e.options.lineWrapping||ir(e),e.options.mode=t.modeOption,fr(e)}function Fo(e){(e.doc.direction=="rtl"?B:h)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Cr(e,function(){Fo(e),fr(e)})}function ra(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 Wa(e,t){var r={from:vn(t.from),to:Gr(t),text:xn(e,t.from,t.to)};return Ko(e,r,t.from.line,t.to.line+1),Vr(e,function(n){return Ko(n,r,t.from.line,t.to.line+1)},!0),r}function Wo(e){for(;e.length;){var t=Me(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Wo(e.done),Me(e.done);if(e.done.length&&!Me(e.done).ranges)return Me(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Me(e.done)}function Ho(e,t,r,n){var l=e.history;l.undone.length=0;var k=+new Date,Y,Z;if((l.lastOp==n||l.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&l.lastModTime>k-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(Y=pl(l,l.lastOp==n)))Z=Me(Y.changes),ft(t.from,t.to)==0&&ft(t.from,Z.to)==0?Z.to=Gr(t):Y.changes.push(Wa(e,t));else{var q=Me(l.done);for((!q||!q.ranges)&&ia(e.sel,l.done),Y={changes:[Wa(e,t)],generation:l.generation},l.done.push(Y);l.done.length>l.undoDepth;)l.done.shift(),l.done[0].ranges||l.done.shift()}l.done.push(r),l.generation=++l.maxGeneration,l.lastModTime=l.lastSelTime=k,l.lastOp=l.lastSelOp=n,l.lastOrigin=l.lastSelOrigin=t.origin,Z||De(e,"historyAdded")}function ml(e,t,r,n){var l=t.charAt(0);return l=="*"||l=="+"&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,r,n){var l=e.history,k=n&&n.origin;r==l.lastSelOp||k&&l.lastSelOrigin==k&&(l.lastModTime==l.lastSelTime&&l.lastOrigin==k||ml(e,k,Me(l.done),t))?l.done[l.done.length-1]=t:ia(t,l.done),l.lastSelTime=+new Date,l.lastSelOrigin=k,l.lastSelOp=r,n&&n.clearRedo!==!1&&Wo(l.undone)}function ia(e,t){var r=Me(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Ko(e,t,r,n){var l=t["spans_"+e.id],k=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(Y){Y.markedSpans&&((l||(l=t["spans_"+e.id]={}))[k]=Y.markedSpans),++k})}function vl(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function yl(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=[],l=0;l<t.text.length;++l)n.push(vl(r[l]));return n}function zo(e,t){var r=yl(e,t),n=on(e,t);if(!r)return n;if(!n)return r;for(var l=0;l<r.length;++l){var k=r[l],Y=n[l];if(k&&Y){e:for(var Z=0;Z<Y.length;++Z){for(var q=Y[Z],te=0;te<k.length;++te)if(k[te].marker==q.marker)continue e;k.push(q)}}else Y&&(r[l]=Y)}return r}function hi(e,t,r){for(var n=[],l=0;l<e.length;++l){var k=e[l];if(k.ranges){n.push(r?_r.prototype.deepCopy.call(k):k);continue}var Y=k.changes,Z=[];n.push({changes:Z});for(var q=0;q<Y.length;++q){var te=Y[q],me=void 0;if(Z.push({from:te.from,to:te.to,text:te.text}),t)for(var be in te)(me=be.match(/^spans_(\d+)$/))&&(ae(t,Number(me[1]))>-1&&(Me(Z)[be]=te[be],delete te[be]))}}return n}function Ha(e,t,r,n){if(n){var l=e.anchor;if(r){var k=ft(t,l)<0;k!=ft(r,l)<0?(l=t,t=r):k!=ft(t,r)<0&&(t=r)}return new Cn(l,t)}else return new Cn(r||t,t)}function aa(e,t,r,n,l){l==null&&(l=e.cm&&(e.cm.display.shift||e.extend)),or(e,new _r([Ha(e.sel.primary(),t,r,l)],0),n)}function Go(e,t,r){for(var n=[],l=e.cm&&(e.cm.display.shift||e.extend),k=0;k<e.sel.ranges.length;k++)n[k]=Ha(e.sel.ranges[k],t[k],null,l);var Y=Mr(e.cm,n,e.sel.primIndex);or(e,Y,r)}function Ka(e,t,r,n){var l=e.sel.ranges.slice(0);l[t]=r,or(e,Mr(e.cm,l,e.sel.primIndex),n)}function Vo(e,t,r,n){or(e,zr(t,r),n)}function bl(e,t,r){var n={ranges:t.ranges,update:function(l){this.ranges=[];for(var k=0;k<l.length;k++)this.ranges[k]=new Cn(g(e,l[k].anchor),g(e,l[k].head))},origin:r&&r.origin};return De(e,"beforeSelectionChange",e,n),e.cm&&De(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?Mr(e.cm,n.ranges,n.ranges.length-1):t}function Xo(e,t,r){var n=e.history.done,l=Me(n);l&&l.ranges?(n[n.length-1]=t,oa(e,t,r)):or(e,t,r)}function or(e,t,r){oa(e,t,r),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function oa(e,t,r){(de(e,"beforeSelectionChange")||e.cm&&de(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,r));var n=r&&r.bias||(ft(t.primary().head,e.sel.primary().head)<0?-1:1);Yo(e,Jo(e,t,n,!0)),!(r&&r.scroll===!1)&&e.cm&&di(e.cm)}function Yo(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ge(e.cm)),Ht(e,"cursorActivity",e)}function $o(e){Yo(e,Jo(e,e.sel,null,!1))}function Jo(e,t,r,n){for(var l,k=0;k<t.ranges.length;k++){var Y=t.ranges[k],Z=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[k],q=sa(e,Y.anchor,Z&&Z.anchor,r,n),te=sa(e,Y.head,Z&&Z.head,r,n);(l||q!=Y.anchor||te!=Y.head)&&(l||(l=t.ranges.slice(0,k)),l[k]=new Cn(q,te))}return l?Mr(e.cm,l,t.primIndex):t}function fi(e,t,r,n,l){var k=Dt(e,t.line);if(k.markedSpans)for(var Y=0;Y<k.markedSpans.length;++Y){var Z=k.markedSpans[Y],q=Z.marker,te="selectLeft"in q?!q.selectLeft:q.inclusiveLeft,me="selectRight"in q?!q.selectRight:q.inclusiveRight;if((Z.from==null||(te?Z.from<=t.ch:Z.from<t.ch))&&(Z.to==null||(me?Z.to>=t.ch:Z.to>t.ch))){if(l&&(De(q,"beforeCursorEnter"),q.explicitlyCleared))if(k.markedSpans){--Y;continue}else break;if(!q.atomic)continue;if(r){var be=q.find(n<0?1:-1),Ne=void 0;if((n<0?me:te)&&(be=Qo(e,be,-n,be&&be.line==t.line?k:null)),be&&be.line==t.line&&(Ne=ft(be,r))&&(n<0?Ne<0:Ne>0))return fi(e,be,t,n,l)}var Pe=q.find(n<0?-1:1);return(n<0?te:me)&&(Pe=Qo(e,Pe,n,Pe.line==t.line?k:null)),Pe?fi(e,Pe,t,n,l):null}}return t}function sa(e,t,r,n,l){var k=n||1,Y=fi(e,t,r,k,l)||!l&&fi(e,t,r,k,!0)||fi(e,t,r,-k,l)||!l&&fi(e,t,r,-k,!0);return Y||(e.cantEdit=!0,Ye(e.first,0))}function Qo(e,t,r,n){return r<0&&t.ch==0?t.line>e.first?g(e,Ye(t.line-1)):null:r>0&&t.ch==(n||Dt(e,t.line)).text.length?t.line<e.first+e.size-1?Ye(t.line+1,0):null:new Ye(t.line,t.ch+r)}function Zo(e){e.setSelection(Ye(e.firstLine(),0),Ye(e.lastLine()),ye)}function qo(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return n.canceled=!0}};return r&&(n.update=function(l,k,Y,Z){l&&(n.from=g(e,l)),k&&(n.to=g(e,k)),Y&&(n.text=Y),Z!==void 0&&(n.origin=Z)}),De(e,"beforeChange",e,n),e.cm&&De(e.cm,"beforeChange",e.cm,n),n.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:n.from,to:n.to,text:n.text,origin:n.origin}}function pi(e,t,r){if(e.cm){if(!e.cm.curOp)return Jn(e.cm,pi)(e,t,r);if(e.cm.state.suppressEdits)return}if((de(e,"beforeChange")||e.cm&&de(e.cm,"beforeChange"))&&(t=qo(e,t,!0),!t))return;var n=Mn&&!r&&Ar(e,t.from,t.to);if(n)for(var l=n.length-1;l>=0;--l)es(e,{from:n[l].from,to:n[l].to,text:l?[""]:t.text,origin:t.origin});else es(e,t)}function es(e,t){if(t.text.length==1&&t.text[0]==""&&ft(t.from,t.to)==0)return;var r=Ba(e,t);Ho(e,t,r,e.cm?e.cm.curOp.id:NaN),ki(e,t,r,on(e,t));var n=[];Vr(e,function(l,k){!k&&ae(n,l.history)==-1&&(is(l.history,t),n.push(l.history)),ki(l,t,null,on(l,t))})}function la(e,t,r){var n=e.cm&&e.cm.state.suppressEdits;if(n&&!r)return;for(var l=e.history,k,Y=e.sel,Z=t=="undo"?l.done:l.undone,q=t=="undo"?l.undone:l.done,te=0;te<Z.length&&!(k=Z[te],r?k.ranges&&!k.equals(e.sel):!k.ranges);te++);if(te==Z.length)return;for(l.lastOrigin=l.lastSelOrigin=null;;)if(k=Z.pop(),k.ranges){if(ia(k,q),r&&!k.equals(e.sel)){or(e,k,{clearRedo:!1});return}Y=k}else if(n){Z.push(k);return}else break;var me=[];ia(Y,q),q.push({changes:me,generation:l.generation}),l.generation=k.generation||++l.maxGeneration;for(var be=de(e,"beforeChange")||e.cm&&de(e.cm,"beforeChange"),Ne=function(dt){var gt=k.changes[dt];if(gt.origin=t,be&&!qo(e,gt,!1))return Z.length=0,{};me.push(Wa(e,gt));var _t=dt?Ba(e,gt):Me(Z);ki(e,gt,_t,zo(e,gt)),!dt&&e.cm&&e.cm.scrollIntoView({from:gt.from,to:Gr(gt)});var Pt=[];Vr(e,function(Ot,Ut){!Ut&&ae(Pt,Ot.history)==-1&&(is(Ot.history,gt),Pt.push(Ot.history)),ki(Ot,gt,null,zo(Ot,gt))})},Pe=k.changes.length-1;Pe>=0;--Pe){var Ze=Ne(Pe);if(Ze)return Ze.v}}function ts(e,t){if(t==0)return;if(e.first+=t,e.sel=new _r(ot(e.sel.ranges,function(l){return new Cn(Ye(l.anchor.line+t,l.anchor.ch),Ye(l.head.line+t,l.head.ch))}),e.sel.primIndex),e.cm){fr(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)Hr(e.cm,n,"gutter")}}function ki(e,t,r,n){if(e.cm&&!e.cm.curOp)return Jn(e.cm,ki)(e,t,r,n);if(t.to.line<e.first){ts(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var l=t.text.length-1-(e.first-t.from.line);ts(e,l),t={from:Ye(e.first,0),to:Ye(t.to.line+l,t.to.ch),text:[Me(t.text)],origin:t.origin}}var k=e.lastLine();t.to.line>k&&(t={from:t.from,to:Ye(k,Dt(e,k).text.length),text:[t.text[0]],origin:t.origin}),t.removed=xn(e,t.from,t.to),r||(r=Ba(e,t)),e.cm?El(e.cm,t,n):Fa(e,t,n),oa(e,r,ye),e.cantEdit&&sa(e,Ye(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,r){var n=e.doc,l=e.display,k=t.from,Y=t.to,Z=!1,q=k.line;e.options.lineWrapping||(q=St(Bn(Dt(n,k.line))),n.iter(q,Y.line+1,function(Pe){if(Pe==l.maxLine)return Z=!0,!0})),n.sel.contains(t.from,t.to)>-1&&ge(e),Fa(n,t,r,yo(e)),e.options.lineWrapping||(n.iter(q,k.line+t.text.length,function(Pe){var Ze=Dr(Pe);Ze>l.maxLineLength&&(l.maxLine=Pe,l.maxLineLength=Ze,l.maxLineChanged=!0,Z=!1)}),Z&&(e.curOp.updateMaxLine=!0)),yn(n,k.line),Li(e,400);var te=t.text.length-(Y.line-k.line)-1;t.full?fr(e):k.line==Y.line&&t.text.length==1&&!Bo(e.doc,t)?Hr(e,k.line,"text"):fr(e,k.line,Y.line+1,te);var me=de(e,"changes"),be=de(e,"change");if(be||me){var Ne={from:k,to:Y,text:t.text,removed:t.removed,origin:t.origin};be&&Ht(e,"change",e,Ne),me&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Ne)}e.display.selForContextMenu=null}function mi(e,t,r,n,l){var k;n||(n=r),ft(n,r)<0&&(k=[n,r],r=k[0],n=k[1]),typeof t=="string"&&(t=e.splitLines(t)),pi(e,{from:r,to:n,text:t,origin:l})}function ns(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function rs(e,t,r,n){for(var l=0;l<e.length;++l){var k=e[l],Y=!0;if(k.ranges){k.copied||(k=e[l]=k.deepCopy(),k.copied=!0);for(var Z=0;Z<k.ranges.length;Z++)ns(k.ranges[Z].anchor,t,r,n),ns(k.ranges[Z].head,t,r,n);continue}for(var q=0;q<k.changes.length;++q){var te=k.changes[q];if(r<te.from.line)te.from=Ye(te.from.line+n,te.from.ch),te.to=Ye(te.to.line+n,te.to.ch);else if(t<=te.to.line){Y=!1;break}}Y||(e.splice(0,l+1),l=0)}}function is(e,t){var r=t.from.line,n=t.to.line,l=t.text.length-(n-r)-1;rs(e.done,r,n,l),rs(e.undone,r,n,l)}function Ii(e,t,r,n){var l=t,k=t;return typeof t=="number"?k=Dt(e,z(e,t)):l=St(t),l==null?null:(n(k,l)&&e.cm&&Hr(e.cm,l,r),k)}function Ni(e){this.lines=e,this.parent=null;for(var t=0,r=0;r<e.length;++r)e[r].parent=this,t+=e[r].height;this.height=t}Ni.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,n=e+t;r<n;++r){var l=this.lines[r];this.height-=l.height,qt(l),Ht(l,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;e<n;++e)if(r(this.lines[e]))return!0}};function Ui(e){this.children=e;for(var t=0,r=0,n=0;n<e.length;++n){var l=e[n];t+=l.chunkSize(),r+=l.height,l.parent=this}this.size=t,this.height=r,this.parent=null}Ui.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var n=this.children[r],l=n.chunkSize();if(e<l){var k=Math.min(t,l-e),Y=n.height;if(n.removeInner(e,k),this.height-=Y-n.height,l==k&&(this.children.splice(r--,1),n.parent=null),(t-=k)==0)break;e=0}else e-=l}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Ni))){var Z=[];this.collapse(Z),this.children=[new Ni(Z)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var n=0;n<this.children.length;++n){var l=this.children[n],k=l.chunkSize();if(e<=k){if(l.insertInner(e,t,r),l.lines&&l.lines.length>50){for(var Y=l.lines.length%25+25,Z=Y;Z<l.lines.length;){var q=new Ni(l.lines.slice(Z,Z+=25));l.height-=q.height,this.children.splice(++n,0,q),q.parent=this}l.lines=l.lines.slice(0,Y),this.maybeSpill()}break}e-=k}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new Ui(t);if(e.parent){e.size-=r.size,e.height-=r.height;var l=ae(e.parent.children,e);e.parent.children.splice(l+1,0,r)}else{var n=new Ui(e.children);n.parent=e,e.children=[n,r],e=n}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,r){for(var n=0;n<this.children.length;++n){var l=this.children[n],k=l.chunkSize();if(e<k){var Y=Math.min(t,k-e);if(l.iterN(e,Y,r))return!0;if((t-=Y)==0)break;e=0}else e-=k}}};var Bi=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.doc=e,this.node=t};Bi.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=St(r);if(n==null||!t)return;for(var l=0;l<t.length;++l)t[l]==this&&t.splice(l--,1);t.length||(r.widgets=null);var k=Ti(this);ht(r,Math.max(0,r.height-k)),e&&(Cr(e,function(){as(e,r,-k),Hr(e,n,"widget")}),Ht(e,"lineWidgetCleared",e,this,n))},Bi.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,n=this.line;this.height=null;var l=Ti(this)-t;if(!l)return;hr(this.doc,n)||ht(n,n.height+l),r&&Cr(r,function(){r.curOp.forceUpdate=!0,as(r,n,l),Ht(r,"lineWidgetChanged",r,e,St(n))})},ce(Bi);function as(e,t,r){nr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Ma(e,r)}function xl(e,t,r,n){var l=new Bi(e,r,n),k=e.cm;return k&&l.noHScroll&&(k.display.alignWidgets=!0),Ii(e,t,"widget",function(Y){var Z=Y.widgets||(Y.widgets=[]);if(l.insertAt==null?Z.push(l):Z.splice(Math.min(Z.length-1,Math.max(0,l.insertAt)),0,l),l.line=Y,k&&!hr(e,Y)){var q=nr(Y)<e.scrollTop;ht(Y,Y.height+Ti(l)),q&&Ma(k,l.height),k.curOp.forceUpdate=!0}return!0}),k&&Ht(k,"lineWidgetAdded",k,l,typeof t=="number"?t:St(t)),l}var os=0,Xr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++os};Xr.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&ni(e),de(this,"clear")){var r=this.find();r&&Ht(this,"clear",r.from,r.to)}for(var n=null,l=null,k=0;k<this.lines.length;++k){var Y=this.lines[k],Z=Hn(Y.markedSpans,this);e&&!this.collapsed?Hr(e,St(Y),"text"):e&&(Z.to!=null&&(l=St(Y)),Z.from!=null&&(n=St(Y))),Y.markedSpans=Gn(Y.markedSpans,Z),Z.from==null&&this.collapsed&&!hr(this.doc,Y)&&e&&ht(Y,si(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var q=0;q<this.lines.length;++q){var te=Bn(this.lines[q]),me=Dr(te);me>e.display.maxLineLength&&(e.display.maxLine=te,e.display.maxLineLength=me,e.display.maxLineChanged=!0)}n!=null&&e&&this.collapsed&&fr(e,n,l+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&$o(e.doc)),e&&Ht(e,"markerCleared",e,this,n,l),t&&ri(e),this.parent&&this.parent.clear()},Xr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var r,n,l=0;l<this.lines.length;++l){var k=this.lines[l],Y=Hn(k.markedSpans,this);if(Y.from!=null&&(r=Ye(t?k:St(k),Y.from),e==-1))return r;if(Y.to!=null&&(n=Ye(t?k:St(k),Y.to),e==1))return n}return r&&{from:r,to:n}},Xr.prototype.changed=function(){var e=this,t=this.find(-1,!0),r=this,n=this.doc.cm;if(!t||!n)return;Cr(n,function(){var l=t.line,k=St(t.line),Y=Ea(n,k);if(Y&&(uo(Y),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!hr(r.doc,l)&&r.height!=null){var Z=r.height;r.height=null;var q=Ti(r)-Z;q&&ht(l,l.height+q)}Ht(n,"markerChanged",n,e)})},Xr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ae(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Xr.prototype.detachLine=function(e){if(this.lines.splice(ae(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ce(Xr);function gi(e,t,r,n,l){if(n&&n.shared)return Cl(e,t,r,n,l);if(e.cm&&!e.cm.curOp)return Jn(e.cm,gi)(e,t,r,n,l);var k=new Xr(e,l),Y=ft(t,r);if(n&&W(n,k,!1),Y>0||Y==0&&k.clearWhenEmpty!==!1)return k;if(k.replacedWith&&(k.collapsed=!0,k.widgetNode=w("span",[k.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||k.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(k.widgetNode.insertLeft=!0)),k.collapsed){if(Un(e,t.line,t,r,k)||t.line!=r.line&&Un(e,r.line,t,r,k))throw new Error("Inserting collapsed marker partially overlapping an existing one");Sn()}k.addToHistory&&Ho(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var Z=t.line,q=e.cm,te;if(e.iter(Z,r.line+1,function(be){q&&k.collapsed&&!q.options.lineWrapping&&Bn(be)==q.display.maxLine&&(te=!0),k.collapsed&&Z!=t.line&&ht(be,0),er(be,new Tn(k,Z==t.line?t.ch:null,Z==r.line?r.ch:null)),++Z}),k.collapsed&&e.iter(t.line,r.line+1,function(be){hr(e,be)&&ht(be,0)}),k.clearOnEnter&&xe(k,"beforeCursorEnter",function(){return k.clear()}),k.readOnly&&(fn(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),k.collapsed&&(k.id=++os,k.atomic=!0),q){if(te&&(q.curOp.updateMaxLine=!0),k.collapsed)fr(q,t.line,r.line+1);else if(k.className||k.startStyle||k.endStyle||k.css||k.attributes||k.title)for(var me=t.line;me<=r.line;me++)Hr(q,me,"text");k.atomic&&$o(q.doc),Ht(q,"markerAdded",q,k)}return k}var ji=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};ji.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Ht(this,"clear")},ji.prototype.find=function(e,t){return this.primary.find(e,t)},ce(ji);function Cl(e,t,r,n,l){n=W(n),n.shared=!1;var k=[gi(e,t,r,n,l)],Y=k[0],Z=n.widgetNode;return Vr(e,function(q){Z&&(n.widgetNode=Z.cloneNode(!0)),k.push(gi(q,g(q,t),g(q,r),n,l));for(var te=0;te<q.linked.length;++te)if(q.linked[te].isParent)return;Y=Me(k)}),new ji(k,Y)}function ss(e){return e.findMarks(Ye(e.first,0),e.clipPos(Ye(e.lastLine())),function(t){return t.parent})}function Sl(e,t){for(var r=0;r<t.length;r++){var n=t[r],l=n.find(),k=e.clipPos(l.from),Y=e.clipPos(l.to);if(ft(k,Y)){var Z=gi(e,k,Y,n.primary,n.primary.type);n.markers.push(Z),Z.parent=n}}}function Tl(e){for(var t=function(n){var l=e[n],k=[l.primary.doc];Vr(l.primary.doc,function(q){return k.push(q)});for(var Y=0;Y<l.markers.length;Y++){var Z=l.markers[Y];ae(k,Z.doc)==-1&&(Z.parent=null,l.markers.splice(Y--,1))}},r=0;r<e.length;r++)t(r)}var wl=0,pr=function(e,t,r,n,l){if(!(this instanceof pr))return new pr(e,t,r,n,l);r==null&&(r=0),Ui.call(this,[new Ni([new ar("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var k=Ye(r,0);this.sel=zr(k),this.history=new ra(null),this.id=++wl,this.modeOption=t,this.lineSep=n,this.direction=l=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Fa(this,{from:k,to:k,text:e}),or(this,zr(k),ye)};pr.prototype=tt(Ui.prototype,{constructor:pr,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n<t.length;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=He(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Qn(function(e){var t=Ye(this.first,0),r=this.first+this.size-1;pi(this,{from:t,to:Ye(r,Dt(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Oi(this.cm,0,0),or(this,zr(t),ye)}),replaceRange:function(e,t,r,n){t=g(this,t),r=r?g(this,r):t,mi(this,e,t,r,n)},getRange:function(e,t,r){var n=xn(this,g(this,e),g(this,t));return r===!1?n:n.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(an(this,e))return Dt(this,e)},getLineNumber:function(e){return St(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=Dt(this,e)),Bn(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return g(this,e)},getCursor:function(e){var t=this.sel.primary(),r;return e==null||e=="head"?r=t.head:e=="anchor"?r=t.anchor:e=="end"||e=="to"||e===!1?r=t.to():r=t.from(),r},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Qn(function(e,t,r){Vo(this,g(this,typeof e=="number"?Ye(e,t||0):e),null,r)}),setSelection:Qn(function(e,t,r){Vo(this,g(this,e),g(this,t||e),r)}),extendSelection:Qn(function(e,t,r){aa(this,g(this,e),t&&g(this,t),r)}),extendSelections:Qn(function(e,t){Go(this,V(this,e),t)}),extendSelectionsBy:Qn(function(e,t){var r=ot(this.sel.ranges,e);Go(this,V(this,r),t)}),setSelections:Qn(function(e,t,r){if(!e.length)return;for(var n=[],l=0;l<e.length;l++)n[l]=new Cn(g(this,e[l].anchor),g(this,e[l].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),or(this,Mr(this.cm,n,t),r)}),addSelection:Qn(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new Cn(g(this,e),g(this,t||e))),or(this,Mr(this.cm,n,n.length-1),r)}),getSelection:function(e){for(var t=this.sel.ranges,r,n=0;n<t.length;n++){var l=xn(this,t[n].from(),t[n].to());r=r?r.concat(l):l}return e===!1?r:r.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var l=xn(this,r[n].from(),r[n].to());e!==!1&&(l=l.join(e||this.lineSeparator())),t[n]=l}return t},replaceSelection:function(e,t,r){for(var n=[],l=0;l<this.sel.ranges.length;l++)n[l]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:Qn(function(e,t,r){for(var n=[],l=this.sel,k=0;k<l.ranges.length;k++){var Y=l.ranges[k];n[k]={from:Y.from(),to:Y.to(),text:this.splitLines(e[k]),origin:r}}for(var Z=t&&t!="end"&&hl(this,n,t),q=n.length-1;q>=0;q--)pi(this,n[q]);Z?Xo(this,Z):this.cm&&di(this.cm)}),undo:Qn(function(){la(this,"undo")}),redo:Qn(function(){la(this,"redo")}),undoSelection:Qn(function(){la(this,"undo",!0)}),redoSelection:Qn(function(){la(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var l=0;l<e.undone.length;l++)e.undone[l].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){var e=this;this.history=new ra(this.history.maxGeneration),Vr(this,function(t){return t.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:hi(this.history.done),undone:hi(this.history.undone)}},setHistory:function(e){var t=this.history=new ra(this.history.maxGeneration);t.done=hi(e.done.slice(0),null,!0),t.undone=hi(e.undone.slice(0),null,!0)},setGutterMarker:Qn(function(e,t,r){return Ii(this,e,"gutter",function(n){var l=n.gutterMarkers||(n.gutterMarkers={});return l[t]=r,!r&&vt(l)&&(n.gutterMarkers=null),!0})}),clearGutter:Qn(function(e){var t=this;this.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&Ii(t,r,"gutter",function(){return r.gutterMarkers[e]=null,vt(r.gutterMarkers)&&(r.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!an(this,e))return null;if(t=e,e=Dt(this,e),!e)return null}else if(t=St(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:Qn(function(e,t,r){return Ii(this,e,t=="gutter"?"gutter":"class",function(n){var l=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!n[l])n[l]=r;else{if(_(r).test(n[l]))return!1;n[l]+=" "+r}return!0})}),removeLineClass:Qn(function(e,t,r){return Ii(this,e,t=="gutter"?"gutter":"class",function(n){var l=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",k=n[l];if(k)if(r==null)n[l]=null;else{var Y=k.match(_(r));if(!Y)return!1;var Z=Y.index+Y[0].length;n[l]=k.slice(0,Y.index)+(!Y.index||Z==k.length?"":" ")+k.slice(Z)||null}else return!1;return!0})}),addLineWidget:Qn(function(e,t,r){return xl(this,e,t,r)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return gi(this,g(this,e),g(this,t),r,r&&r.type||"range")},setBookmark:function(e,t){var r={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=g(this,e),gi(this,e,e,r,"bookmark")},findMarksAt:function(e){e=g(this,e);var t=[],r=Dt(this,e.line).markedSpans;if(r)for(var n=0;n<r.length;++n){var l=r[n];(l.from==null||l.from<=e.ch)&&(l.to==null||l.to>=e.ch)&&t.push(l.marker.parent||l.marker)}return t},findMarks:function(e,t,r){e=g(this,e),t=g(this,t);var n=[],l=e.line;return this.iter(e.line,t.line+1,function(k){var Y=k.markedSpans;if(Y)for(var Z=0;Z<Y.length;Z++){var q=Y[Z];!(q.to!=null&&l==e.line&&e.ch>=q.to||q.from==null&&l!=e.line||q.from!=null&&l==t.line&&q.from>=t.ch)&&(!r||r(q.marker))&&n.push(q.marker.parent||q.marker)}++l}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)r[n].from!=null&&e.push(r[n].marker)}),e},posFromIndex:function(e){var t,r=this.first,n=this.lineSeparator().length;return this.iter(function(l){var k=l.text.length+n;if(k>e)return t=e,!0;e-=k,++r}),g(this,Ye(r,t))},indexFromPos:function(e){e=g(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var r=this.lineSeparator().length;return this.iter(this.first,e.line,function(n){t+=n.text.length+r}),t},copy:function(e){var t=new pr(He(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<r&&(r=e.to);var n=new pr(He(this,t,r),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Sl(n,ss(this)),n},unlinkDoc:function(e){if(e instanceof Nn&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var r=this.linked[t];if(r.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),Tl(ss(this));break}if(e.history==this.history){var n=[e.id];Vr(e,function(l){return n.push(l.id)},!0),e.history=new ra(null),e.history.done=hi(this.history.done,n),e.history.undone=hi(this.history.undone,n)}},iterLinkedDocs:function(e){Vr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Be(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Qn(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&fl(this.cm)})}),pr.prototype.eachLine=pr.prototype.iter;var ls=0;function _l(e){var t=this;if(us(t),We(t,e)||Br(t.display,e))return;ne(e),U&&(ls=+new Date);var r=Zr(t,e,!0),n=e.dataTransfer.files;if(!r||t.isReadOnly())return;if(n&&n.length&&window.FileReader&&window.File)for(var l=n.length,k=Array(l),Y=0,Z=function(){++Y==l&&Jn(t,function(){r=g(t.doc,r);var Pe={from:r,to:r,text:t.doc.splitLines(k.filter(function(Ze){return Ze!=null}).join(t.doc.lineSeparator())),origin:"paste"};pi(t.doc,Pe),Xo(t.doc,zr(g(t.doc,r),g(t.doc,Gr(Pe))))})()},q=function(Pe,Ze){if(t.options.allowDropFileTypes&&ae(t.options.allowDropFileTypes,Pe.type)==-1){Z();return}var dt=new FileReader;dt.onerror=function(){return Z()},dt.onload=function(){var gt=dt.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(gt)){Z();return}k[Ze]=gt,Z()},dt.readAsText(Pe)},te=0;te<n.length;te++)q(n[te],te);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var me=e.dataTransfer.getData("Text");if(me){var be;if(t.state.draggingText&&!t.state.draggingText.copy&&(be=t.listSelections()),oa(t.doc,zr(r,r)),be)for(var Ne=0;Ne<be.length;++Ne)mi(t.doc,"",be[Ne].anchor,be[Ne].head,"drag");t.replaceSelection(me,"around","paste"),t.display.input.focus()}}catch(Pe){}}}function Ol(e,t){if(U&&(!e.state.draggingText||+new Date-ls<100)){ue(t);return}if(We(e,t)||Br(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!P){var r=s("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",S&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),S&&r.parentNode.removeChild(r)}}function Al(e,t){var r=Zr(e,t);if(!r)return;var n=document.createDocumentFragment();xo(e,r,n),e.display.dragCursor||(e.display.dragCursor=s("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),o(e.display.dragCursor,n)}function us(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ds(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),r=[],n=0;n<t.length;n++){var l=t[n].CodeMirror;l&&r.push(l)}r.length&&r[0].operation(function(){for(var k=0;k<r.length;k++)e(r[k])})}var cs=!1;function Dl(){if(cs)return;Rl(),cs=!0}function Rl(){var e;xe(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ds(Ll)},100))}),xe(window,"blur",function(){return ds(ui)})}function Ll(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Yr={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"},Fi=0;Fi<10;Fi++)Yr[Fi+48]=Yr[Fi+96]=String(Fi);for(var ua=65;ua<=90;ua++)Yr[ua]=String.fromCharCode(ua);for(var Wi=1;Wi<=12;Wi++)Yr[Wi+111]=Yr[Wi+63235]="F"+Wi;var jr={};jr.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"},jr.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"},jr.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"},jr.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"]},jr.default=u?jr.macDefault:jr.pcDefault;function Ml(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var r,n,l,k,Y=0;Y<t.length-1;Y++){var Z=t[Y];if(/^(cmd|meta|m)$/i.test(Z))k=!0;else if(/^a(lt)?$/i.test(Z))r=!0;else if(/^(c|ctrl|control)$/i.test(Z))n=!0;else if(/^s(hift)?$/i.test(Z))l=!0;else throw new Error("Unrecognized modifier name: "+Z)}return r&&(e="Alt-"+e),n&&(e="Ctrl-"+e),k&&(e="Cmd-"+e),l&&(e="Shift-"+e),e}function Pl(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if(n=="..."){delete e[r];continue}for(var l=ot(r.split(" "),Ml),k=0;k<l.length;k++){var Y=void 0,Z=void 0;k==l.length-1?(Z=l.join(" "),Y=n):(Z=l.slice(0,k+1).join(" "),Y="...");var q=t[Z];if(!q)t[Z]=Y;else if(q!=Y)throw new Error("Inconsistent bindings for "+Z)}delete e[r]}for(var te in t)e[te]=t[te];return e}function vi(e,t,r,n){t=da(t);var l=t.call?t.call(e,n):t[e];if(l===!1)return"nothing";if(l==="...")return"multi";if(l!=null&&r(l))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return vi(e,t.fallthrough,r,n);for(var k=0;k<t.fallthrough.length;k++){var Y=vi(e,t.fallthrough[k],r,n);if(Y)return Y}}}function hs(e){var t=typeof e=="string"?e:Yr[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function fs(e,t,r){var n=e;return t.altKey&&n!="Alt"&&(e="Alt-"+e),(y?t.metaKey:t.ctrlKey)&&n!="Ctrl"&&(e="Ctrl-"+e),(y?t.ctrlKey:t.metaKey)&&n!="Mod"&&(e="Cmd-"+e),!r&&t.shiftKey&&n!="Shift"&&(e="Shift-"+e),e}function ps(e,t){if(S&&e.keyCode==34&&e.char)return!1;var r=Yr[e.keyCode];return r==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(r=e.code),fs(r,e,t))}function da(e){return typeof e=="string"?jr[e]:e}function yi(e,t){for(var r=e.doc.sel.ranges,n=[],l=0;l<r.length;l++){for(var k=t(r[l]);n.length&&ft(k.from,Me(n).to)<=0;){var Y=n.pop();if(ft(Y.from,k.from)<0){k.from=Y.from;break}}n.push(k)}Cr(e,function(){for(var Z=n.length-1;Z>=0;Z--)mi(e.doc,"",n[Z].from,n[Z].to,"+delete");di(e)})}function za(e,t,r){var n=nt(e.text,t+r,r);return n<0||n>e.text.length?null:n}function Ga(e,t,r){var n=za(e,t.ch,r);return n==null?null:new Ye(t.line,n,r<0?"after":"before")}function Va(e,t,r,n,l){if(e){t.doc.direction=="rtl"&&(l=-l);var k=Et(r,t.doc.direction);if(k){var Y=l<0?Me(k):k[0],Z=l<0==(Y.level==1),q=Z?"after":"before",te;if(Y.level>0||t.doc.direction=="rtl"){var me=oi(t,r);te=l<0?r.text.length-1:0;var be=Ir(t,me,te).top;te=Rt(function(Ne){return Ir(t,me,Ne).top==be},l<0==(Y.level==1)?Y.from:Y.to-1,te),q=="before"&&(te=za(r,te,1))}else te=l<0?Y.to:Y.from;return new Ye(n,te,q)}}return new Ye(n,l<0?r.text.length:0,l<0?"before":"after")}function kl(e,t,r,n){var l=Et(t,e.doc.direction);if(!l)return Ga(t,r,n);r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var k=yt(l,r.ch,r.sticky),Y=l[k];if(e.doc.direction=="ltr"&&Y.level%2==0&&(n>0?Y.to>r.ch:Y.from<r.ch))return Ga(t,r,n);var Z=function(_t,Pt){return za(t,_t instanceof Ye?_t.ch:_t,Pt)},q,te=function(_t){return e.options.lineWrapping?(q=q||oi(e,t),vo(e,t,q,_t)):{begin:0,end:t.text.length}},me=te(r.sticky=="before"?Z(r,-1):r.ch);if(e.doc.direction=="rtl"||Y.level==1){var be=Y.level==1==n<0,Ne=Z(r,be?1:-1);if(Ne!=null&&(be?Ne<=Y.to&&Ne<=me.end:Ne>=Y.from&&Ne>=me.begin)){var Pe=be?"before":"after";return new Ye(r.line,Ne,Pe)}}var Ze=function(_t,Pt,Ot){for(var Ut=function(Ln,Zn){return Zn?new Ye(r.line,Z(Ln,1),"before"):new Ye(r.line,Ln,"after")};_t>=0&&_t<l.length;_t+=Pt){var Yt=l[_t],Vt=Pt>0==(Yt.level!=1),ln=Vt?Ot.begin:Z(Ot.end,-1);if(Yt.from<=ln&&ln<Yt.to)return Ut(ln,Vt);if(ln=Vt?Yt.from:Z(Yt.to,-1),Ot.begin<=ln&&ln<Ot.end)return Ut(ln,Vt)}},dt=Ze(k+n,n,me);if(dt)return dt;var gt=n>0?me.end:Z(me.begin,-1);return gt!=null&&!(n>0&>==t.text.length)&&(dt=Ze(n>0?0:l.length-1,n,te(gt)),dt)?dt:null}var Hi={selectAll:Zo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ye)},killLine:function(e){return yi(e,function(t){if(t.empty()){var r=Dt(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:Ye(t.head.line+1,0)}:{from:t.head,to:Ye(t.head.line,r)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return yi(e,function(t){return{from:Ye(t.from().line,0),to:g(e.doc,Ye(t.to().line+1,0))}})},delLineLeft:function(e){return yi(e,function(t){return{from:Ye(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return yi(e,function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return{from:n,to:t.from()}})},delWrappedLineRight:function(e){return yi(e,function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div");return{from:t.from(),to:n}})},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(Ye(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ye(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return ms(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return gs(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")},Oe)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")},Oe)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return n.ch<e.getLine(n.line).search(/\S/)?gs(e,t.head):n},Oe)},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 t=[],r=e.listSelections(),n=e.options.tabSize,l=0;l<r.length;l++){var k=r[l].from(),Y=$(e.getLine(k.line),k.ch,n);t.push(le(n-Y%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Cr(e,function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++){if(!t[n].empty())continue;var l=t[n].head,k=Dt(e.doc,l.line).text;if(k){if(l.ch==k.length&&(l=new Ye(l.line,l.ch-1)),l.ch>0)l=new Ye(l.line,l.ch+1),e.replaceRange(k.charAt(l.ch-1)+k.charAt(l.ch-2),Ye(l.line,l.ch-2),l,"+transpose");else if(l.line>e.doc.first){var Y=Dt(e.doc,l.line-1).text;Y&&(l=new Ye(l.line,1),e.replaceRange(k.charAt(0)+e.doc.lineSeparator()+Y.charAt(Y.length-1),Ye(l.line-1,Y.length-1),l,"+transpose"))}}r.push(new Cn(l,l))}e.setSelections(r)})},newlineAndIndent:function(e){return Cr(e,function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var n=0;n<t.length;n++)e.indentLine(t[n].from().line,null,!0);di(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function ms(e,t){var r=Dt(e.doc,t),n=Bn(r);return n!=r&&(t=St(n)),Va(!0,e,n,t,1)}function Il(e,t){var r=Dt(e.doc,t),n=tr(r);return n!=r&&(t=St(n)),Va(!0,e,r,t,-1)}function gs(e,t){var r=ms(e,t.line),n=Dt(e.doc,r.line),l=Et(n,e.doc.direction);if(!l||l[0].level==0){var k=Math.max(r.ch,n.text.search(/\S/)),Y=t.line==r.line&&t.ch<=k&&t.ch;return Ye(r.line,Y?0:k,r.sticky)}return r}function ca(e,t,r){if(typeof t=="string"&&(t=Hi[t],!t))return!1;e.display.input.ensurePolled();var n=e.display.shift,l=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),l=t(e)!=Te}finally{e.display.shift=n,e.state.suppressEdits=!1}return l}function Nl(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var l=vi(t,e.state.keyMaps[n],r,e);if(l)return l}return e.options.extraKeys&&vi(t,e.options.extraKeys,r,e)||vi(t,e.options.keyMap,r,e)}var Ul=new re;function Ki(e,t,r,n){var l=e.state.keySeq;if(l){if(hs(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Ul.set(50,function(){e.state.keySeq==l&&(e.state.keySeq=null,e.display.input.reset())}),vs(e,l+" "+t,r,n))return!0}return vs(e,t,r,n)}function vs(e,t,r,n){var l=Nl(e,t,n);return l=="multi"&&(e.state.keySeq=t),l=="handled"&&Ht(e,"keyHandled",e,t,r),(l=="handled"||l=="multi")&&(ne(r),Da(e)),!!l}function ys(e,t){var r=ps(t,!0);return r?t.shiftKey&&!e.state.keySeq?Ki(e,"Shift-"+r,t,function(n){return ca(e,n,!0)})||Ki(e,r,t,function(n){if(typeof n=="string"?/^go[A-Z]/.test(n):n.motion)return ca(e,n)}):Ki(e,r,t,function(n){return ca(e,n)}):!1}function Bl(e,t,r){return Ki(e,"'"+r+"'",t,function(n){return ca(e,n,!0)})}var Xa=null;function bs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=M(),We(t,e))return;U&&I<11&&e.keyCode==27&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=r==16||e.shiftKey;var n=ys(t,e);S&&(Xa=n?r:null,!n&&r==88&&!Re&&(u?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),R&&!u&&!n&&r==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),r==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&jl(t)}function jl(e){var t=e.display.lineDiv;B(t,"CodeMirror-crosshair");function r(n){(n.keyCode==18||!n.altKey)&&(h(t,"CodeMirror-crosshair"),Ve(document,"keyup",r),Ve(document,"mouseover",r))}xe(document,"keyup",r),xe(document,"mouseover",r)}function Es(e){e.keyCode==16&&(this.doc.sel.shift=!1),We(this,e)}function xs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Br(t.display,e)||We(t,e)||e.ctrlKey&&!e.altKey||u&&e.metaKey)return;var r=e.keyCode,n=e.charCode;if(S&&r==Xa){Xa=null,ne(e);return}if(S&&(!e.which||e.which<10)&&ys(t,e))return;var l=String.fromCharCode(n==null?r:n);if(l=="\b")return;if(Bl(t,e,l))return;t.display.input.onKeyPress(e)}var Fl=400,Ya=function(e,t,r){this.time=e,this.pos=t,this.button=r};Ya.prototype.compare=function(e,t,r){return this.time+Fl>e&&ft(t,this.pos)==0&&r==this.button};var zi,Gi;function Wl(e,t){var r=+new Date;return Gi&&Gi.compare(r,e,t)?(zi=Gi=null,"triple"):zi&&zi.compare(r,e,t)?(Gi=new Ya(r,e,t),zi=null,"double"):(zi=new Ya(r,e,t),Gi=null,"single")}function Cs(e){var t=this,r=t.display;if(We(t,e)||r.activeTouch&&r.input.supportsTouch())return;if(r.input.ensurePolled(),r.shift=e.shiftKey,Br(r,e)){E||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100));return}if($a(t,e))return;var n=Zr(t,e),l=ke(e),k=n?Wl(n,l):"single";if(window.focus(),l==1&&t.state.selectingText&&t.state.selectingText(e),n&&Hl(t,l,n,k,e))return;l==1?n?zl(t,n,k,e):we(e)==r.scroller&&ne(e):l==2?(n&&aa(t.doc,n),setTimeout(function(){return r.input.focus()},20)):l==3&&(D?t.display.input.onContextMenu(e):So(t))}function Hl(e,t,r,n,l){var k="Click";return n=="double"?k="Double"+k:n=="triple"&&(k="Triple"+k),k=(t==1?"Left":t==2?"Middle":"Right")+k,Ki(e,fs(k,l),l,function(Y){if(typeof Y=="string"&&(Y=Hi[Y]),!Y)return!1;var Z=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Z=Y(e,r)!=Te}finally{e.state.suppressEdits=!1}return Z})}function Kl(e,t,r){var n=e.getOption("configureMouse"),l=n?n(e,t,r):{};if(l.unit==null){var k=c?r.shiftKey&&r.metaKey:r.altKey;l.unit=k?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(l.extend==null||e.doc.extend)&&(l.extend=e.doc.extend||r.shiftKey),l.addNew==null&&(l.addNew=u?r.metaKey:r.ctrlKey),l.moveOnDrag==null&&(l.moveOnDrag=!(u?r.altKey:r.ctrlKey)),l}function zl(e,t,r,n){U?setTimeout(G(Co,e),0):e.curOp.focus=M();var l=Kl(e,r,n),k=e.doc.sel,Y;e.options.dragDrop&&Je&&!e.isReadOnly()&&r=="single"&&(Y=k.contains(t))>-1&&(ft((Y=k.ranges[Y]).from(),t)<0||t.xRel>0)&&(ft(Y.to(),t)>0||t.xRel<0)?Gl(e,n,t,l):Vl(e,n,t,l)}function Gl(e,t,r,n){var l=e.display,k=!1,Y=Jn(e,function(te){E&&(l.scroller.draggable=!1),e.state.draggingText=!1,Ve(l.wrapper.ownerDocument,"mouseup",Y),Ve(l.wrapper.ownerDocument,"mousemove",Z),Ve(l.scroller,"dragstart",q),Ve(l.scroller,"drop",Y),k||(ne(te),n.addNew||aa(e.doc,r,null,null,n.extend),E&&!P||U&&I==9?setTimeout(function(){l.wrapper.ownerDocument.body.focus({preventScroll:!0}),l.input.focus()},20):l.input.focus())}),Z=function(te){k=k||Math.abs(t.clientX-te.clientX)+Math.abs(t.clientY-te.clientY)>=10},q=function(){return k=!0};E&&(l.scroller.draggable=!0),e.state.draggingText=Y,Y.copy=!n.moveOnDrag,l.scroller.dragDrop&&l.scroller.dragDrop(),xe(l.wrapper.ownerDocument,"mouseup",Y),xe(l.wrapper.ownerDocument,"mousemove",Z),xe(l.scroller,"dragstart",q),xe(l.scroller,"drop",Y),So(e),setTimeout(function(){return l.input.focus()},20)}function Ss(e,t,r){if(r=="char")return new Cn(t,t);if(r=="word")return e.findWordAt(t);if(r=="line")return new Cn(Ye(t.line,0),g(e.doc,Ye(t.line+1,0)));var n=r(e,t);return new Cn(n.from,n.to)}function Vl(e,t,r,n){var l=e.display,k=e.doc;ne(t);var Y,Z,q=k.sel,te=q.ranges;if(n.addNew&&!n.extend?(Z=k.sel.contains(r),Z>-1?Y=te[Z]:Y=new Cn(r,r)):(Y=k.sel.primary(),Z=k.sel.primIndex),n.unit=="rectangle")n.addNew||(Y=new Cn(r,r)),r=Zr(e,t,!0,!0),Z=-1;else{var me=Ss(e,r,n.unit);n.extend?Y=Ha(Y,me.anchor,me.head,n.extend):Y=me}n.addNew?Z==-1?(Z=te.length,or(k,Mr(e,te.concat([Y]),Z),{scroll:!1,origin:"*mouse"})):te.length>1&&te[Z].empty()&&n.unit=="char"&&!n.extend?(or(k,Mr(e,te.slice(0,Z).concat(te.slice(Z+1)),0),{scroll:!1,origin:"*mouse"}),q=k.sel):Ka(k,Z,Y,Ee):(Z=0,or(k,new _r([Y],0),Ee),q=k.sel);var be=r;function Ne(Ot){if(ft(be,Ot)==0)return;if(be=Ot,n.unit=="rectangle"){for(var Ut=[],Yt=e.options.tabSize,Vt=$(Dt(k,r.line).text,r.ch,Yt),ln=$(Dt(k,Ot.line).text,Ot.ch,Yt),Ln=Math.min(Vt,ln),Zn=Math.max(Vt,ln),jn=Math.min(r.line,Ot.line),Sr=Math.min(e.lastLine(),Math.max(r.line,Ot.line));jn<=Sr;jn++){var mr=Dt(k,jn).text,Vn=_e(mr,Ln,Yt);Ln==Zn?Ut.push(new Cn(Ye(jn,Vn),Ye(jn,Vn))):mr.length>Vn&&Ut.push(new Cn(Ye(jn,Vn),Ye(jn,_e(mr,Zn,Yt))))}Ut.length||Ut.push(new Cn(r,r)),or(k,Mr(e,q.ranges.slice(0,Z).concat(Ut),Z),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Ot)}else{var gr=Y,rr=Ss(e,Ot,n.unit),$n=gr.anchor,Xn;ft(rr.anchor,$n)>0?(Xn=rr.head,$n=Zt(gr.from(),rr.anchor)):(Xn=rr.anchor,$n=Gt(gr.to(),rr.head));var Fn=q.ranges.slice(0);Fn[Z]=Xl(e,new Cn(g(k,$n),Xn)),or(k,Mr(e,Fn,Z),Ee)}}var Pe=l.wrapper.getBoundingClientRect(),Ze=0;function dt(Ot){var Ut=++Ze,Yt=Zr(e,Ot,!0,n.unit=="rectangle");if(!Yt)return;if(ft(Yt,be)!=0){e.curOp.focus=M(),Ne(Yt);var Vt=qi(l,k);(Yt.line>=Vt.to||Yt.line<Vt.from)&&setTimeout(Jn(e,function(){Ze==Ut&&dt(Ot)}),150)}else{var ln=Ot.clientY<Pe.top?-20:Ot.clientY>Pe.bottom?20:0;ln&&setTimeout(Jn(e,function(){if(Ze!=Ut)return;l.scroller.scrollTop+=ln,dt(Ot)}),50)}}function gt(Ot){e.state.selectingText=!1,Ze=Infinity,Ot&&(ne(Ot),l.input.focus()),Ve(l.wrapper.ownerDocument,"mousemove",_t),Ve(l.wrapper.ownerDocument,"mouseup",Pt),k.history.lastSelOrigin=null}var _t=Jn(e,function(Ot){Ot.buttons===0||!ke(Ot)?gt(Ot):dt(Ot)}),Pt=Jn(e,gt);e.state.selectingText=Pt,xe(l.wrapper.ownerDocument,"mousemove",_t),xe(l.wrapper.ownerDocument,"mouseup",Pt)}function Xl(e,t){var r=t.anchor,n=t.head,l=Dt(e.doc,r.line);if(ft(r,n)==0&&r.sticky==n.sticky)return t;var k=Et(l);if(!k)return t;var Y=yt(k,r.ch,r.sticky),Z=k[Y];if(Z.from!=r.ch&&Z.to!=r.ch)return t;var q=Y+(Z.from==r.ch==(Z.level!=1)?0:1);if(q==0||q==k.length)return t;var te;if(n.line!=r.line)te=(n.line-r.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var me=yt(k,n.ch,n.sticky),be=me-Y||(n.ch-r.ch)*(Z.level==1?-1:1);me==q-1||me==q?te=be<0:te=be>0}var Ne=k[q+(te?-1:0)],Pe=te==(Ne.level==1),Ze=Pe?Ne.from:Ne.to,dt=Pe?"after":"before";return r.ch==Ze&&r.sticky==dt?t:new Cn(new Ye(r.line,Ze,dt),n)}function Ts(e,t,r,n){var l,k;if(t.touches)l=t.touches[0].clientX,k=t.touches[0].clientY;else try{l=t.clientX,k=t.clientY}catch(Ne){return!1}if(l>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&ne(t);var Y=e.display,Z=Y.lineDiv.getBoundingClientRect();if(k>Z.bottom||!de(e,r))return oe(t);k-=Z.top-Y.viewOffset;for(var q=0;q<e.display.gutterSpecs.length;++q){var te=Y.gutters.childNodes[q];if(te&&te.getBoundingClientRect().right>=l){var me=Xt(e.doc,k),be=e.display.gutterSpecs[q];return De(e,r,e,me,be.className,t),oe(t)}}}function $a(e,t){return Ts(e,t,"gutterClick",!0)}function ws(e,t){if(Br(e.display,t)||Yl(e,t))return;if(We(e,t,"contextmenu"))return;D||e.display.input.onContextMenu(t)}function Yl(e,t){return de(e,"gutterContextMenu")?Ts(e,t,"gutterContextMenu",!1):!1}function _s(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),wi(e)}var bi={toString:function(){return"CodeMirror.Init"}},Os={},ha={};function $l(e){var t=e.optionHandlers;function r(n,l,k,Y){e.defaults[n]=l,k&&(t[n]=Y?function(Z,q,te){te!=bi&&k(Z,q,te)}:k)}e.defineOption=r,e.Init=bi,r("value","",function(n,l){return n.setValue(l)},!0),r("mode",null,function(n,l){n.doc.modeOption=l,ja(n)},!0),r("indentUnit",2,ja,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,function(n){Pi(n),wi(n),fr(n)},!0),r("lineSeparator",null,function(n,l){if(n.doc.lineSep=l,!l)return;var k=[],Y=n.doc.first;n.doc.iter(function(q){for(var te=0;;){var me=q.text.indexOf(l,te);if(me==-1)break;te=me+l.length,k.push(Ye(Y,me))}Y++});for(var Z=k.length-1;Z>=0;Z--)mi(n.doc,l,k[Z],Ye(k[Z].line,k[Z].ch+l.length))}),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(n,l,k){n.state.specialChars=new RegExp(l.source+(l.test(" ")?"":"| "),"g"),k!=bi&&n.refresh()}),r("specialCharPlaceholder",Mt,function(n){return n.refresh()},!0),r("electricChars",!0),r("inputStyle",a?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),r("spellcheck",!1,function(n,l){return n.getInputField().spellcheck=l},!0),r("autocorrect",!1,function(n,l){return n.getInputField().autocorrect=l},!0),r("autocapitalize",!1,function(n,l){return n.getInputField().autocapitalize=l},!0),r("rtlMoveVisually",!O),r("wholeLineUpdateBefore",!0),r("theme","default",function(n){_s(n),Mi(n)},!0),r("keyMap","default",function(n,l,k){var Y=da(l),Z=k!=bi&&da(k);Z&&Z.detach&&Z.detach(n,Y),Y.attach&&Y.attach(n,Z||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,Ql,!0),r("gutters",[],function(n,l){n.display.gutterSpecs=Ua(l,n.options.lineNumbers),Mi(n)},!0),r("fixedGutter",!0,function(n,l){n.display.gutters.style.left=l?Oa(n.display)+"px":"0",n.refresh()},!0),r("coverGutterNextToScrollbar",!1,function(n){return ci(n)},!0),r("scrollbarStyle","native",function(n){Do(n),ci(n),n.display.scrollbars.setScrollTop(n.doc.scrollTop),n.display.scrollbars.setScrollLeft(n.doc.scrollLeft)},!0),r("lineNumbers",!1,function(n,l){n.display.gutterSpecs=Ua(n.options.gutters,l),Mi(n)},!0),r("firstLineNumber",1,Mi,!0),r("lineNumberFormatter",function(n){return n},Mi,!0),r("showCursorWhenSelecting",!1,_i,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,function(n,l){l=="nocursor"&&(ui(n),n.display.input.blur()),n.display.input.readOnlyChanged(l)}),r("screenReaderLabel",null,function(n,l){l=l===""?null:l,n.display.input.screenReaderLabelChanged(l)}),r("disableInput",!1,function(n,l){l||n.display.input.reset()},!0),r("dragDrop",!0,Jl),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,_i,!0),r("singleCursorHeightPerLine",!0,_i,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,Pi,!0),r("addModeClass",!1,Pi,!0),r("pollInterval",100),r("undoDepth",200,function(n,l){return n.doc.history.undoDepth=l}),r("historyEventDelay",1250),r("viewportMargin",10,function(n){return n.refresh()},!0),r("maxHighlightLength",1e4,Pi,!0),r("moveInputWithCursor",!0,function(n,l){l||n.display.input.resetPosition()}),r("tabindex",null,function(n,l){return n.display.input.getField().tabIndex=l||""}),r("autofocus",null),r("direction","ltr",function(n,l){return n.doc.setDirection(l)},!0),r("phrases",null)}function Jl(e,t,r){var n=r&&r!=bi;if(!t!=!n){var l=e.display.dragFunctions,k=t?xe:Ve;k(e.display.scroller,"dragstart",l.start),k(e.display.scroller,"dragenter",l.enter),k(e.display.scroller,"dragover",l.over),k(e.display.scroller,"dragleave",l.leave),k(e.display.scroller,"drop",l.drop)}}function Ql(e){e.options.lineWrapping?(B(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(h(e.display.wrapper,"CodeMirror-wrap"),ir(e)),Aa(e),fr(e),wi(e),setTimeout(function(){return ci(e)},100)}function Nn(e,t){var r=this;if(!(this instanceof Nn))return new Nn(e,t);this.options=t=t?W(t):{},W(Os,t,!1);var n=t.value;typeof n=="string"?n=new pr(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var l=new Nn.inputStyles[t.inputStyle](this),k=this.display=new dl(e,n,l,t);k.wrapper.CodeMirror=this,_s(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Do(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 re,keySeq:null,specialChars:null},t.autofocus&&!a&&k.input.focus(),U&&I<11&&setTimeout(function(){return r.display.input.reset(!0)},20),Zl(this),Dl(),ni(this),this.curOp.forceUpdate=!0,jo(this,n),t.autofocus&&!a||this.hasFocus()?setTimeout(function(){r.hasFocus()&&!r.state.focused&&Ra(r)},20):ui(this);for(var Y in ha)ha.hasOwnProperty(Y)&&ha[Y](this,t[Y],bi);Mo(this),t.finishInit&&t.finishInit(this);for(var Z=0;Z<Ja.length;++Z)Ja[Z](this);ri(this),E&&t.lineWrapping&&getComputedStyle(k.lineDiv).textRendering=="optimizelegibility"&&(k.lineDiv.style.textRendering="auto")}Nn.defaults=Os,Nn.optionHandlers=ha;function Zl(e){var t=e.display;xe(t.scroller,"mousedown",Jn(e,Cs)),U&&I<11?xe(t.scroller,"dblclick",Jn(e,function(q){if(We(e,q))return;var te=Zr(e,q);if(!te||$a(e,q)||Br(e.display,q))return;ne(q);var me=e.findWordAt(te);aa(e.doc,me.anchor,me.head)})):xe(t.scroller,"dblclick",function(q){return We(e,q)||ne(q)}),xe(t.scroller,"contextmenu",function(q){return ws(e,q)}),xe(t.input.getField(),"contextmenu",function(q){t.scroller.contains(q.target)||ws(e,q)});var r,n={end:0};function l(){t.activeTouch&&(r=setTimeout(function(){return t.activeTouch=null},1e3),n=t.activeTouch,n.end=+new Date)}function k(q){if(q.touches.length!=1)return!1;var te=q.touches[0];return te.radiusX<=1&&te.radiusY<=1}function Y(q,te){if(te.left==null)return!0;var me=te.left-q.left,be=te.top-q.top;return me*me+be*be>20*20}xe(t.scroller,"touchstart",function(q){if(!We(e,q)&&!k(q)&&!$a(e,q)){t.input.ensurePolled(),clearTimeout(r);var te=+new Date;t.activeTouch={start:te,moved:!1,prev:te-n.end<=300?n:null},q.touches.length==1&&(t.activeTouch.left=q.touches[0].pageX,t.activeTouch.top=q.touches[0].pageY)}}),xe(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),xe(t.scroller,"touchend",function(q){var te=t.activeTouch;if(te&&!Br(t,q)&&te.left!=null&&!te.moved&&new Date-te.start<300){var me=e.coordsChar(t.activeTouch,"page"),be;!te.prev||Y(te,te.prev)?be=new Cn(me,me):!te.prev.prev||Y(te,te.prev.prev)?be=e.findWordAt(me):be=new Cn(Ye(me.line,0),g(e.doc,Ye(me.line+1,0))),e.setSelection(be.anchor,be.head),e.focus(),ne(q)}l()}),xe(t.scroller,"touchcancel",l),xe(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Ai(e,t.scroller.scrollTop),ei(e,t.scroller.scrollLeft,!0),De(e,"scroll",e))}),xe(t.scroller,"mousewheel",function(q){return Io(e,q)}),xe(t.scroller,"DOMMouseScroll",function(q){return Io(e,q)}),xe(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(q){We(e,q)||ue(q)},over:function(q){We(e,q)||(Al(e,q),ue(q))},start:function(q){return Ol(e,q)},drop:Jn(e,_l),leave:function(q){We(e,q)||us(e)}};var Z=t.input.getField();xe(Z,"keyup",function(q){return Es.call(e,q)}),xe(Z,"keydown",Jn(e,bs)),xe(Z,"keypress",Jn(e,xs)),xe(Z,"focus",function(q){return Ra(e,q)}),xe(Z,"blur",function(q){return ui(e,q)})}var Ja=[];Nn.defineInitHook=function(e){return Ja.push(e)};function Vi(e,t,r,n){var l=e.doc,k;r==null&&(r="add"),r=="smart"&&(l.mode.indent?k=Le(e,t).state:r="prev");var Y=e.options.tabSize,Z=Dt(l,t),q=$(Z.text,null,Y);Z.stateAfter&&(Z.stateAfter=null);var te=Z.text.match(/^\s*/)[0],me;if(!n&&!/\S/.test(Z.text))me=0,r="not";else if(r=="smart"&&(me=l.mode.indent(k,Z.text.slice(te.length),Z.text),me==Te||me>150)){if(!n)return;r="prev"}r=="prev"?t>l.first?me=$(Dt(l,t-1).text,null,Y):me=0:r=="add"?me=q+e.options.indentUnit:r=="subtract"?me=q-e.options.indentUnit:typeof r=="number"&&(me=q+r),me=Math.max(0,me);var be="",Ne=0;if(e.options.indentWithTabs)for(var Pe=Math.floor(me/Y);Pe;--Pe)Ne+=Y,be+=" ";if(Ne<me&&(be+=le(me-Ne)),be!=te)return mi(l,be,Ye(t,0),Ye(t,te.length),"+input"),Z.stateAfter=null,!0;for(var Ze=0;Ze<l.sel.ranges.length;Ze++){var dt=l.sel.ranges[Ze];if(dt.head.line==t&&dt.head.ch<te.length){var gt=Ye(t,te.length);Ka(l,Ze,new Cn(gt,gt));break}}}var Pr=null;function fa(e){Pr=e}function Qa(e,t,r,n,l){var k=e.doc;e.display.shift=!1,n||(n=k.sel);var Y=+new Date-200,Z=l=="paste"||e.state.pasteIncoming>Y,q=Be(t),te=null;if(Z&&n.ranges.length>1)if(Pr&&Pr.text.join(`
|
|
`)==t){if(n.ranges.length%Pr.text.length==0){te=[];for(var me=0;me<Pr.text.length;me++)te.push(k.splitLines(Pr.text[me]))}}else q.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(te=ot(q,function(_t){return[_t]}));for(var be=e.curOp.updateInput,Ne=n.ranges.length-1;Ne>=0;Ne--){var Pe=n.ranges[Ne],Ze=Pe.from(),dt=Pe.to();Pe.empty()&&(r&&r>0?Ze=Ye(Ze.line,Ze.ch-r):e.state.overwrite&&!Z?dt=Ye(dt.line,Math.min(Dt(k,dt.line).text.length,dt.ch+Me(q).length)):Z&&Pr&&Pr.lineWise&&Pr.text.join(`
|
|
`)==q.join(`
|
|
`)&&(Ze=dt=Ye(Ze.line,0)));var gt={from:Ze,to:dt,text:te?te[Ne%te.length]:q,origin:l||(Z?"paste":e.state.cutIncoming>Y?"cut":"+input")};pi(e.doc,gt),Ht(e,"inputRead",e,gt)}t&&!Z&&Ds(e,t),di(e),e.curOp.updateInput<2&&(e.curOp.updateInput=be),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function As(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Cr(t,function(){return Qa(t,r,0,null,"paste")}),!0}function Ds(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var l=r.ranges[n];if(l.head.ch>100||n&&r.ranges[n-1].head.line==l.head.line)continue;var k=e.getModeAt(l.head),Y=!1;if(k.electricChars){for(var Z=0;Z<k.electricChars.length;Z++)if(t.indexOf(k.electricChars.charAt(Z))>-1){Y=Vi(e,l.head.line,"smart");break}}else k.electricInput&&(k.electricInput.test(Dt(e.doc,l.head.line).text.slice(0,l.head.ch))&&(Y=Vi(e,l.head.line,"smart")));Y&&Ht(e,"electricInput",e,l.head.line)}}function Rs(e){for(var t=[],r=[],n=0;n<e.doc.sel.ranges.length;n++){var l=e.doc.sel.ranges[n].head.line,k={anchor:Ye(l,0),head:Ye(l+1,0)};r.push(k),t.push(e.getRange(k.anchor,k.head))}return{text:t,ranges:r}}function Ls(e,t,r,n){e.setAttribute("autocorrect",r?"":"off"),e.setAttribute("autocapitalize",n?"":"off"),e.setAttribute("spellcheck",!!t)}function Ms(){var e=s("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=s("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return E?e.style.width="1000px":e.setAttribute("wrap","off"),m&&(e.style.border="1px solid black"),Ls(e),t}function ql(e){var t=e.optionHandlers,r=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(n,l){var k=this.options,Y=k[n];if(k[n]==l&&n!="mode")return;k[n]=l,t.hasOwnProperty(n)&&Jn(this,t[n])(this,l,Y),De(this,"optionChange",this,n)},getOption:function(n){return this.options[n]},getDoc:function(){return this.doc},addKeyMap:function(n,l){this.state.keyMaps[l?"push":"unshift"](da(n))},removeKeyMap:function(n){for(var l=this.state.keyMaps,k=0;k<l.length;++k)if(l[k]==n||l[k].name==n)return l.splice(k,1),!0},addOverlay:ur(function(n,l){var k=n.token?n:e.getMode(this.options,n);if(k.startState)throw new Error("Overlays may not be stateful.");ut(this.state.overlays,{mode:k,modeSpec:n,opaque:l&&l.opaque,priority:l&&l.priority||0},function(Y){return Y.priority}),this.state.modeGen++,fr(this)}),removeOverlay:ur(function(n){for(var l=this.state.overlays,k=0;k<l.length;++k){var Y=l[k].modeSpec;if(Y==n||typeof n=="string"&&Y.name==n){l.splice(k,1),this.state.modeGen++,fr(this);return}}}),indentLine:ur(function(n,l,k){typeof l!="string"&&typeof l!="number"&&(l==null?l=this.options.smartIndent?"smart":"prev":l=l?"add":"subtract"),an(this.doc,n)&&Vi(this,n,l,k)}),indentSelection:ur(function(n){for(var l=this.doc.sel.ranges,k=-1,Y=0;Y<l.length;Y++){var Z=l[Y];if(Z.empty())Z.head.line>k&&(Vi(this,Z.head.line,n,!0),k=Z.head.line,Y==this.doc.sel.primIndex&&di(this));else{var q=Z.from(),te=Z.to(),me=Math.max(k,q.line);k=Math.min(this.lastLine(),te.line-(te.ch?0:1))+1;for(var be=me;be<k;++be)Vi(this,be,n);var Ne=this.doc.sel.ranges;q.ch==0&&l.length==Ne.length&&Ne[Y].from().ch>0&&Ka(this.doc,Y,new Cn(q,Ne[Y].to()),ye)}}}),getTokenAt:function(n,l){return tn(this,n,l)},getLineTokens:function(n,l){return tn(this,Ye(n),l,!0)},getTokenTypeAt:function(n){n=g(this.doc,n);var l=Xe(this,Dt(this.doc,n.line)),k=0,Y=(l.length-1)/2,Z=n.ch,q;if(Z==0)q=l[2];else for(;;){var te=k+Y>>1;if((te?l[te*2-1]:0)>=Z)Y=te;else if(l[te*2+1]<Z)k=te+1;else{q=l[te*2+2];break}}var me=q?q.indexOf("overlay "):-1;return me<0?q:me==0?null:q.slice(0,me-1)},getModeAt:function(n){var l=this.doc.mode;return l.innerMode?e.innerMode(l,this.getTokenAt(n).state).mode:l},getHelper:function(n,l){return this.getHelpers(n,l)[0]},getHelpers:function(n,l){var k=[];if(!r.hasOwnProperty(l))return k;var Y=r[l],Z=this.getModeAt(n);if(typeof Z[l]=="string")Y[Z[l]]&&k.push(Y[Z[l]]);else if(Z[l])for(var q=0;q<Z[l].length;q++){var te=Y[Z[l][q]];te&&k.push(te)}else Z.helperType&&Y[Z.helperType]?k.push(Y[Z.helperType]):Y[Z.name]&&k.push(Y[Z.name]);for(var me=0;me<Y._global.length;me++){var be=Y._global[me];be.pred(Z,this)&&ae(k,be.val)==-1&&k.push(be.val)}return k},getStateAfter:function(n,l){var k=this.doc;return n=z(k,n==null?k.first+k.size-1:n),Le(this,n+1,l).state},cursorCoords:function(n,l){var k,Y=this.doc.sel.primary();return n==null?k=Y.head:typeof n=="object"?k=g(this.doc,n):k=n?Y.from():Y.to(),Lr(this,k,l||"page")},charCoords:function(n,l){return Ca(this,g(this.doc,n),l||"page")},coordsChar:function(n,l){return n=po(this,n,l||"page"),Ta(this,n.left,n.top)},lineAtHeight:function(n,l){return n=po(this,{top:n,left:0},l||"page").top,Xt(this.doc,n+this.display.viewOffset)},heightAtLine:function(n,l,k){var Y=!1,Z;if(typeof n=="number"){var q=this.doc.first+this.doc.size-1;n<this.doc.first?n=this.doc.first:n>q&&(n=q,Y=!0),Z=Dt(this.doc,n)}else Z=n;return $i(this,Z,{top:0,left:0},l||"page",k||Y).top+(Y?this.doc.height-nr(Z):0)},defaultTextHeight:function(){return si(this.display)},defaultCharWidth:function(){return li(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(n,l,k,Y,Z){var q=this.display;n=Lr(this,g(this.doc,n));var te=n.bottom,me=n.left;if(l.style.position="absolute",l.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(l),q.sizer.appendChild(l),Y=="over")te=n.top;else if(Y=="above"||Y=="near"){var be=Math.max(q.wrapper.clientHeight,this.doc.height),Ne=Math.max(q.sizer.clientWidth,q.lineSpace.clientWidth);(Y=="above"||n.bottom+l.offsetHeight>be)&&n.top>l.offsetHeight?te=n.top-l.offsetHeight:n.bottom+l.offsetHeight<=be&&(te=n.bottom),me+l.offsetWidth>Ne&&(me=Ne-l.offsetWidth)}l.style.top=te+"px",l.style.left=l.style.right="",Z=="right"?(me=q.sizer.clientWidth-l.offsetWidth,l.style.right="0px"):(Z=="left"?me=0:Z=="middle"&&(me=(q.sizer.clientWidth-l.offsetWidth)/2),l.style.left=me+"px"),k&&Js(this,{left:me,top:te,right:me+l.offsetWidth,bottom:te+l.offsetHeight})},triggerOnKeyDown:ur(bs),triggerOnKeyPress:ur(xs),triggerOnKeyUp:Es,triggerOnMouseDown:ur(Cs),execCommand:function(n){if(Hi.hasOwnProperty(n))return Hi[n].call(null,this)},triggerElectric:ur(function(n){Ds(this,n)}),findPosH:function(n,l,k,Y){var Z=1;l<0&&(Z=-1,l=-l);for(var q=g(this.doc,n),te=0;te<l&&!(q=Za(this.doc,q,Z,k,Y),q.hitSide);++te);return q},moveH:ur(function(n,l){var k=this;this.extendSelectionsBy(function(Y){return k.display.shift||k.doc.extend||Y.empty()?Za(k.doc,Y.head,n,l,k.options.rtlMoveVisually):n<0?Y.from():Y.to()},Oe)}),deleteH:ur(function(n,l){var k=this.doc.sel,Y=this.doc;k.somethingSelected()?Y.replaceSelection("",null,"+delete"):yi(this,function(Z){var q=Za(Y,Z.head,n,l,!1);return n<0?{from:q,to:Z.head}:{from:Z.head,to:q}})}),findPosV:function(n,l,k,Y){var Z=1,q=Y;l<0&&(Z=-1,l=-l);for(var te=g(this.doc,n),me=0;me<l;++me){var be=Lr(this,te,"div");if(q==null?q=be.left:be.left=q,te=Ps(this,be,Z,k),te.hitSide)break}return te},moveV:ur(function(n,l){var k=this,Y=this.doc,Z=[],q=!this.display.shift&&!Y.extend&&Y.sel.somethingSelected();if(Y.extendSelectionsBy(function(me){if(q)return n<0?me.from():me.to();var be=Lr(k,me.head,"div");me.goalColumn!=null&&(be.left=me.goalColumn),Z.push(be.left);var Ne=Ps(k,be,n,l);return l=="page"&&me==Y.sel.primary()&&Ma(k,Ca(k,Ne,"div").top-be.top),Ne},Oe),Z.length)for(var te=0;te<Y.sel.ranges.length;te++)Y.sel.ranges[te].goalColumn=Z[te]}),findWordAt:function(n){var l=this.doc,k=Dt(l,n.line).text,Y=n.ch,Z=n.ch;if(k){var q=this.getHelper(n,"wordChars");(n.sticky=="before"||Z==k.length)&&Y?--Y:++Z;for(var te=k.charAt(Y),me=ct(te,q)?function(be){return ct(be,q)}:/\s/.test(te)?function(be){return/\s/.test(be)}:function(be){return!/\s/.test(be)&&!ct(be)};Y>0&&me(k.charAt(Y-1));)--Y;for(;Z<k.length&&me(k.charAt(Z));)++Z}return new Cn(Ye(n.line,Y),Ye(n.line,Z))},toggleOverwrite:function(n){if(n!=null&&n==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?B(this.display.cursorDiv,"CodeMirror-overwrite"):h(this.display.cursorDiv,"CodeMirror-overwrite"),De(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==M()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:ur(function(n,l){Oi(this,n,l)}),getScrollInfo:function(){var n=this.display.scroller;return{left:n.scrollLeft,top:n.scrollTop,height:n.scrollHeight-kr(this)-this.display.barHeight,width:n.scrollWidth-kr(this)-this.display.barWidth,clientHeight:ba(this),clientWidth:Jr(this)}},scrollIntoView:ur(function(n,l){n==null?(n={from:this.doc.sel.primary().head,to:null},l==null&&(l=this.options.cursorScrollMargin)):typeof n=="number"?n={from:Ye(n,0),to:null}:n.from==null&&(n={from:n,to:null}),n.to||(n.to=n.from),n.margin=l||0,n.from.line!=null?Qs(this,n):wo(this,n.from,n.to,n.margin)}),setSize:ur(function(n,l){var k=this,Y=function(q){return typeof q=="number"||/^\d+$/.test(String(q))?q+"px":q};n!=null&&(this.display.wrapper.style.width=Y(n)),l!=null&&(this.display.wrapper.style.height=Y(l)),this.options.lineWrapping&&co(this);var Z=this.display.viewFrom;this.doc.iter(Z,this.display.viewTo,function(q){if(q.widgets){for(var te=0;te<q.widgets.length;te++)if(q.widgets[te].noHScroll){Hr(k,Z,"widget");break}}++Z}),this.curOp.forceUpdate=!0,De(this,"refresh",this)}),operation:function(n){return Cr(this,n)},startOperation:function(){return ni(this)},endOperation:function(){return ri(this)},refresh:ur(function(){var n=this.display.cachedTextHeight;fr(this),this.curOp.forceUpdate=!0,wi(this),Oi(this,this.doc.scrollLeft,this.doc.scrollTop),Ia(this.display),(n==null||Math.abs(n-si(this.display))>.5||this.options.lineWrapping)&&Aa(this),De(this,"refresh",this)}),swapDoc:ur(function(n){var l=this.doc;return l.cm=null,this.state.selectingText&&this.state.selectingText(),jo(this,n),wi(this),this.display.input.reset(),Oi(this,n.scrollLeft,n.scrollTop),this.curOp.forceScroll=!0,Ht(this,"swapDoc",this,l),l}),phrase:function(n){var l=this.options.phrases;return l&&Object.prototype.hasOwnProperty.call(l,n)?l[n]:n},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}},ce(e),e.registerHelper=function(n,l,k){r.hasOwnProperty(n)||(r[n]=e[n]={_global:[]}),r[n][l]=k},e.registerGlobalHelper=function(n,l,k,Y){e.registerHelper(n,l,Y),r[n]._global.push({pred:k,val:Y})}}function Za(e,t,r,n,l){var k=t,Y=r,Z=Dt(e,t.line),q=l&&e.direction=="rtl"?-r:r;function te(){var Pt=t.line+q;return Pt<e.first||Pt>=e.first+e.size?!1:(t=new Ye(Pt,t.ch,t.sticky),Z=Dt(e,Pt))}function me(Pt){var Ot;if(n=="codepoint"){var Ut=Z.text.charCodeAt(t.ch+(n>0?0:-1));isNaN(Ut)?Ot=null:Ot=new Ye(t.line,Math.max(0,Math.min(Z.text.length,t.ch+r*(Ut>=55296&&Ut<56320?2:1))),-r)}else l?Ot=kl(e.cm,Z,t,r):Ot=Ga(Z,t,r);if(Ot==null)if(!Pt&&te())t=Va(l,e.cm,Z,t.line,q);else return!1;else t=Ot;return!0}if(n=="char"||n=="codepoint")me();else if(n=="column")me(!0);else if(n=="word"||n=="group")for(var be=null,Ne=n=="group",Pe=e.cm&&e.cm.getHelper(t,"wordChars"),Ze=!0;!(r<0&&!me(!Ze));Ze=!1){var dt=Z.text.charAt(t.ch)||`
|
|
`,gt=ct(dt,Pe)?"w":Ne&&dt==`
|
|
`?"n":!Ne||/\s/.test(dt)?null:"p";if(Ne&&!Ze&&!gt&&(gt="s"),be&&be!=gt){r<0&&(r=1,me(),t.sticky="after");break}if(gt&&(be=gt),r>0&&!me(!Ze))break}var _t=sa(e,t,k,Y,!0);return kt(k,_t)&&(_t.hitSide=!0),_t}function Ps(e,t,r,n){var l=e.doc,k=t.left,Y;if(n=="page"){var Z=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),q=Math.max(Z-.5*si(e.display),3);Y=(r>0?t.bottom:t.top)+r*q}else n=="line"&&(Y=r>0?t.bottom+3:t.top-3);for(var te;!(te=Ta(e,k,Y),!te.outside);){if(r<0?Y<=0:Y>=l.height){te.hitSide=!0;break}Y+=r*5}return te}var An=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new re,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};An.prototype.init=function(e){var t=this,r=this,n=r.cm,l=r.div=e.lineDiv;Ls(l,n.options.spellcheck,n.options.autocorrect,n.options.autocapitalize);function k(Z){for(var q=Z.target;q;q=q.parentNode){if(q==l)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(q.className))break}return!1}xe(l,"paste",function(Z){if(!k(Z)||We(n,Z)||As(Z,n))return;I<=11&&setTimeout(Jn(n,function(){return t.updateFromDOM()}),20)}),xe(l,"compositionstart",function(Z){t.composing={data:Z.data,done:!1}}),xe(l,"compositionupdate",function(Z){t.composing||(t.composing={data:Z.data,done:!1})}),xe(l,"compositionend",function(Z){t.composing&&(Z.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),xe(l,"touchstart",function(){return r.forceCompositionEnd()}),xe(l,"input",function(){t.composing||t.readFromDOMSoon()});function Y(Z){if(!k(Z)||We(n,Z))return;if(n.somethingSelected())fa({lineWise:!1,text:n.getSelections()}),Z.type=="cut"&&n.replaceSelection("",null,"cut");else if(n.options.lineWiseCopyCut){var q=Rs(n);fa({lineWise:!0,text:q.text}),Z.type=="cut"&&n.operation(function(){n.setSelections(q.ranges,0,ye),n.replaceSelection("",null,"cut")})}else return;if(Z.clipboardData){Z.clipboardData.clearData();var te=Pr.text.join(`
|
|
`);if(Z.clipboardData.setData("Text",te),Z.clipboardData.getData("Text")==te){Z.preventDefault();return}}var me=Ms(),be=me.firstChild;n.display.lineSpace.insertBefore(me,n.display.lineSpace.firstChild),be.value=Pr.text.join(`
|
|
`);var Ne=document.activeElement;Q(be),setTimeout(function(){n.display.lineSpace.removeChild(me),Ne.focus(),Ne==l&&r.showPrimarySelection()},50)}xe(l,"copy",Y),xe(l,"cut",Y)},An.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},An.prototype.prepareSelection=function(){var e=Eo(this.cm,!1);return e.focus=document.activeElement==this.div,e},An.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},An.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},An.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),n=r.from(),l=r.to();if(t.display.viewTo==t.display.viewFrom||n.line>=t.display.viewTo||l.line<t.display.viewFrom){e.removeAllRanges();return}var k=pa(t,e.anchorNode,e.anchorOffset),Y=pa(t,e.focusNode,e.focusOffset);if(k&&!k.bad&&Y&&!Y.bad&&ft(Zt(k,Y),n)==0&&ft(Gt(k,Y),l)==0)return;var Z=t.display.view,q=n.line>=t.display.viewFrom&&ks(t,n)||{node:Z[0].measure.map[2],offset:0},te=l.line<t.display.viewTo&&ks(t,l);if(!te){var me=Z[Z.length-1].measure,be=me.maps?me.maps[me.maps.length-1]:me.map;te={node:be[be.length-1],offset:be[be.length-2]-be[be.length-3]}}if(!q||!te){e.removeAllRanges();return}var Ne=e.rangeCount&&e.getRangeAt(0),Pe;try{Pe=C(q.node,q.offset,te.offset,te.node)}catch(Ze){}Pe&&(!R&&t.state.focused?(e.collapse(q.node,q.offset),Pe.collapsed||(e.removeAllRanges(),e.addRange(Pe))):(e.removeAllRanges(),e.addRange(Pe)),Ne&&e.anchorNode==null?e.addRange(Ne):R&&this.startGracePeriod()),this.rememberSelection()},An.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)},An.prototype.showMultipleSelections=function(e){o(this.cm.display.cursorDiv,e.cursors),o(this.cm.display.selectionDiv,e.selection)},An.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},An.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return v(this.div,t)},An.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},An.prototype.blur=function(){this.div.blur()},An.prototype.getField=function(){return this.div},An.prototype.supportsTouch=function(){return!0},An.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Cr(this.cm,function(){return e.cm.curOp.selectionChanged=!0});function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}this.polling.set(this.cm.options.pollInterval,t)},An.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},An.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(i&&f&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var r=pa(t,e.anchorNode,e.anchorOffset),n=pa(t,e.focusNode,e.focusOffset);r&&n&&Cr(t,function(){or(t.doc,zr(r,n),ye),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})},An.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,r=e.doc.sel.primary(),n=r.from(),l=r.to();if(n.ch==0&&n.line>e.firstLine()&&(n=Ye(n.line-1,Dt(e.doc,n.line-1).length)),l.ch==Dt(e.doc,l.line).text.length&&l.line<e.lastLine()&&(l=Ye(l.line+1,0)),n.line<t.viewFrom||l.line>t.viewTo-1)return!1;var k,Y,Z;n.line==t.viewFrom||(k=qr(e,n.line))==0?(Y=St(t.view[0].line),Z=t.view[0].node):(Y=St(t.view[k].line),Z=t.view[k-1].node.nextSibling);var q=qr(e,l.line),te,me;if(q==t.view.length-1?(te=t.viewTo-1,me=t.lineDiv.lastChild):(te=St(t.view[q+1].line)-1,me=t.view[q+1].node.previousSibling),!Z)return!1;for(var be=e.doc.splitLines(tu(e,Z,me,Y,te)),Ne=xn(e.doc,Ye(Y,0),Ye(te,Dt(e.doc,te).text.length));be.length>1&&Ne.length>1;)if(Me(be)==Me(Ne))be.pop(),Ne.pop(),te--;else if(be[0]==Ne[0])be.shift(),Ne.shift(),Y++;else break;for(var Pe=0,Ze=0,dt=be[0],gt=Ne[0],_t=Math.min(dt.length,gt.length);Pe<_t&&dt.charCodeAt(Pe)==gt.charCodeAt(Pe);)++Pe;for(var Pt=Me(be),Ot=Me(Ne),Ut=Math.min(Pt.length-(be.length==1?Pe:0),Ot.length-(Ne.length==1?Pe:0));Ze<Ut&&Pt.charCodeAt(Pt.length-Ze-1)==Ot.charCodeAt(Ot.length-Ze-1);)++Ze;if(be.length==1&&Ne.length==1&&Y==n.line)for(;Pe&&Pe>n.ch&&Pt.charCodeAt(Pt.length-Ze-1)==Ot.charCodeAt(Ot.length-Ze-1);)Pe--,Ze++;be[be.length-1]=Pt.slice(0,Pt.length-Ze).replace(/^\u200b+/,""),be[0]=be[0].slice(Pe).replace(/\u200b+$/,"");var Yt=Ye(Y,Pe),Vt=Ye(te,Ne.length?Me(Ne).length-Ze:0);if(be.length>1||be[0]||ft(Yt,Vt))return mi(e.doc,be,Yt,Vt,"+input"),!0},An.prototype.ensurePolled=function(){this.forceCompositionEnd()},An.prototype.reset=function(){this.forceCompositionEnd()},An.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},An.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)},An.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Cr(this.cm,function(){return fr(e.cm)})},An.prototype.setUneditable=function(e){e.contentEditable="false"},An.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Jn(this.cm,Qa)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},An.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},An.prototype.onContextMenu=function(){},An.prototype.resetPosition=function(){},An.prototype.needsContentAttribute=!0;function ks(e,t){var r=Ea(e,t.line);if(!r||r.hidden)return null;var n=Dt(e.doc,t.line),l=ao(r,n,t.line),k=Et(n,e.doc.direction),Y="left";if(k){var Z=yt(k,t.ch);Y=Z%2?"right":"left"}var q=lo(l.map,t.ch,Y);return q.offset=q.collapse=="right"?q.end:q.start,q}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Ei(e,t){return t&&(e.bad=!0),e}function tu(e,t,r,n,l){var k="",Y=!1,Z=e.doc.lineSeparator(),q=!1;function te(Pe){return function(Ze){return Ze.id==Pe}}function me(){Y&&(k+=Z,q&&(k+=Z),Y=q=!1)}function be(Pe){Pe&&(me(),k+=Pe)}function Ne(Pe){if(Pe.nodeType==1){var Ze=Pe.getAttribute("cm-text");if(Ze){be(Ze);return}var dt=Pe.getAttribute("cm-marker"),gt;if(dt){var _t=e.findMarks(Ye(n,0),Ye(l+1,0),te(+dt));_t.length&&(gt=_t[0].find(0))&&be(xn(e.doc,gt.from,gt.to).join(Z));return}if(Pe.getAttribute("contenteditable")=="false")return;var Pt=/^(pre|div|p|li|table|br)$/i.test(Pe.nodeName);if(!/^br$/i.test(Pe.nodeName)&&Pe.textContent.length==0)return;Pt&&me();for(var Ot=0;Ot<Pe.childNodes.length;Ot++)Ne(Pe.childNodes[Ot]);/^(pre|p)$/i.test(Pe.nodeName)&&(q=!0),Pt&&(Y=!0)}else Pe.nodeType==3&&be(Pe.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Ne(t),t==r);)t=t.nextSibling,q=!1;return k}function pa(e,t,r){var n;if(t==e.display.lineDiv){if(n=e.display.lineDiv.childNodes[r],!n)return Ei(e.clipPos(Ye(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var l=0;l<e.display.view.length;l++){var k=e.display.view[l];if(k.node==n)return nu(k,t,r)}}function nu(e,t,r){var n=e.text.firstChild,l=!1;if(!t||!v(n,t))return Ei(Ye(St(e.line),0),!0);if(t==n&&(l=!0,t=n.childNodes[r],r=0,!t)){var k=e.rest?Me(e.rest):e.line;return Ei(Ye(St(k),k.text.length),l)}var Y=t.nodeType==3?t:null,Z=t;for(!Y&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(Y=t.firstChild,r&&(r=Y.nodeValue.length));Z.parentNode!=n;)Z=Z.parentNode;var q=e.measure,te=q.maps;function me(gt,_t,Pt){for(var Ot=-1;Ot<(te?te.length:0);Ot++)for(var Ut=Ot<0?q.map:te[Ot],Yt=0;Yt<Ut.length;Yt+=3){var Vt=Ut[Yt+2];if(Vt==gt||Vt==_t){var ln=St(Ot<0?e.line:e.rest[Ot]),Ln=Ut[Yt]+Pt;return(Pt<0||Vt!=gt)&&(Ln=Ut[Yt+(Pt?1:0)]),Ye(ln,Ln)}}}var be=me(Y,Z,r);if(be)return Ei(be,l);for(var Ne=Z.nextSibling,Pe=Y?Y.nodeValue.length-r:0;Ne;Ne=Ne.nextSibling){if(be=me(Ne,Ne.firstChild,0),be)return Ei(Ye(be.line,be.ch-Pe),l);Pe+=Ne.textContent.length}for(var Ze=Z.previousSibling,dt=r;Ze;Ze=Ze.previousSibling){if(be=me(Ze,Ze.firstChild,-1),be)return Ei(Ye(be.line,be.ch+dt),l);dt+=Ze.textContent.length}}var Kn=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new re,this.hasSelection=!1,this.composing=null};Kn.prototype.init=function(e){var t=this,r=this,n=this.cm;this.createField(e);var l=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),m&&(l.style.width="0px"),xe(l,"input",function(){U&&I>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),xe(l,"paste",function(Y){if(We(n,Y)||As(Y,n))return;n.state.pasteIncoming=+new Date,r.fastPoll()});function k(Y){if(We(n,Y))return;if(n.somethingSelected())fa({lineWise:!1,text:n.getSelections()});else if(n.options.lineWiseCopyCut){var Z=Rs(n);fa({lineWise:!0,text:Z.text}),Y.type=="cut"?n.setSelections(Z.ranges,null,ye):(r.prevInput="",l.value=Z.text.join(`
|
|
`),Q(l))}else return;Y.type=="cut"&&(n.state.cutIncoming=+new Date)}xe(l,"cut",k),xe(l,"copy",k),xe(e.scroller,"paste",function(Y){if(Br(e,Y)||We(n,Y))return;if(!l.dispatchEvent){n.state.pasteIncoming=+new Date,r.focus();return}var Z=new Event("paste");Z.clipboardData=Y.clipboardData,l.dispatchEvent(Z)}),xe(e.lineSpace,"selectstart",function(Y){Br(e,Y)||ne(Y)}),xe(l,"compositionstart",function(){var Y=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:Y,range:n.markText(Y,n.getCursor("to"),{className:"CodeMirror-composing"})}}),xe(l,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},Kn.prototype.createField=function(e){this.wrapper=Ms(),this.textarea=this.wrapper.firstChild},Kn.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Kn.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=Eo(e);if(e.options.moveInputWithCursor){var l=Lr(e,r.sel.primary().head,"div"),k=t.wrapper.getBoundingClientRect(),Y=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,l.top+Y.top-k.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,l.left+Y.left-k.left))}return n},Kn.prototype.showSelection=function(e){var t=this.cm,r=t.display;o(r.cursorDiv,e.cursors),o(r.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Kn.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&Q(this.textarea),U&&I>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",U&&I>=9&&(this.hasSelection=null))},Kn.prototype.getField=function(){return this.textarea},Kn.prototype.supportsTouch=function(){return!1},Kn.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!a||M()!=this.textarea))try{this.textarea.focus()}catch(e){}},Kn.prototype.blur=function(){this.textarea.blur()},Kn.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Kn.prototype.receivedFocus=function(){this.slowPoll()},Kn.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()})},Kn.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function r(){var n=t.poll();!n&&!e?(e=!0,t.polling.set(60,r)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,r)},Kn.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||Ue(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var l=r.value;if(l==n&&!t.somethingSelected())return!1;if(U&&I>=9&&this.hasSelection===l||u&&/[\uf700-\uf7ff]/.test(l))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var k=l.charCodeAt(0);if(k==8203&&!n&&(n="\u200B"),k==8666)return this.reset(),this.cm.execCommand("undo")}for(var Y=0,Z=Math.min(n.length,l.length);Y<Z&&n.charCodeAt(Y)==l.charCodeAt(Y);)++Y;return Cr(t,function(){Qa(t,l.slice(Y),n.length-Y,null,e.composing?"*compose":null),l.length>1e3||l.indexOf(`
|
|
`)>-1?r.value=e.prevInput="":e.prevInput=l,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Kn.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Kn.prototype.onKeyPress=function(){U&&I>=9&&(this.hasSelection=null),this.fastPoll()},Kn.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,l=t.textarea;t.contextMenuPending&&t.contextMenuPending();var k=Zr(r,e),Y=n.scroller.scrollTop;if(!k||S)return;var Z=r.options.resetSelectionOnContextMenu;Z&&r.doc.sel.contains(k)==-1&&Jn(r,or)(r.doc,zr(k),ye);var q=l.style.cssText,te=t.wrapper.style.cssText,me=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",l.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-me.top-5)+"px; left: "+(e.clientX-me.left-5)+`px;
|
|
z-index: 1000; background: `+(U?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var be;E&&(be=window.scrollY),n.input.focus(),E&&window.scrollTo(null,be),n.input.reset(),r.somethingSelected()||(l.value=t.prevInput=" "),t.contextMenuPending=Pe,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll);function Ne(){if(l.selectionStart!=null){var dt=r.somethingSelected(),gt="\u200B"+(dt?l.value:"");l.value="\u21DA",l.value=gt,t.prevInput=dt?"":"\u200B",l.selectionStart=1,l.selectionEnd=gt.length,n.selForContextMenu=r.doc.sel}}function Pe(){if(t.contextMenuPending!=Pe)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=te,l.style.cssText=q,U&&I<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=Y),l.selectionStart!=null){(!U||U&&I<9)&&Ne();var dt=0,gt=function(){n.selForContextMenu==r.doc.sel&&l.selectionStart==0&&l.selectionEnd>0&&t.prevInput=="\u200B"?Jn(r,Zo)(r):dt++<10?n.detectingSelectAll=setTimeout(gt,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(gt,200)}}if(U&&I>=9&&Ne(),D){ue(e);var Ze=function(){Ve(window,"mouseup",Ze),setTimeout(Pe,20)};xe(window,"mouseup",Ze)}else setTimeout(Pe,50)},Kn.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Kn.prototype.setUneditable=function(){},Kn.prototype.needsContentAttribute=!1;function ru(e,t){if(t=t?W(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var r=M();t.autofocus=r==e||e.getAttribute("autofocus")!=null&&r==document.body}function n(){e.value=Z.getValue()}var l;if(e.form&&(xe(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var k=e.form;l=k.submit;try{var Y=k.submit=function(){n(),k.submit=l,k.submit(),k.submit=Y}}catch(q){}}t.finishInit=function(q){q.save=n,q.getTextArea=function(){return e},q.toTextArea=function(){q.toTextArea=isNaN,n(),e.parentNode.removeChild(q.getWrapperElement()),e.style.display="",e.form&&(Ve(e.form,"submit",n),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=l))}},e.style.display="none";var Z=Nn(function(q){return e.parentNode.insertBefore(q,e.nextSibling)},t);return Z}function iu(e){e.off=Ve,e.on=xe,e.wheelEventPixels=cl,e.Doc=pr,e.splitLines=Be,e.countColumn=$,e.findColumn=_e,e.isWordChar=$e,e.Pass=Te,e.signal=De,e.Line=ar,e.changeEnd=Gr,e.scrollbarModel=Ao,e.Pos=Ye,e.cmpPos=ft,e.modes=je,e.mimeModes=Ie,e.resolveMode=Ae,e.getMode=qe,e.modeExtensions=pt,e.extendMode=mt,e.copyState=Lt,e.startState=hn,e.innerMode=mn,e.commands=Hi,e.keyMap=jr,e.keyName=ps,e.isModifierKey=hs,e.lookupKey=vi,e.normalizeKeyMap=Pl,e.StringStream=en,e.SharedTextMarker=ji,e.TextMarker=Xr,e.LineWidget=Bi,e.e_preventDefault=ne,e.e_stopPropagation=ie,e.e_stop=ue,e.addClass=B,e.contains=v,e.rmClass=h,e.keyNames=Yr}$l(Nn),ql(Nn);var au="iter insert remove copy getEditor constructor".split(" ");for(var ma in pr.prototype)pr.prototype.hasOwnProperty(ma)&&ae(au,ma)<0&&(Nn.prototype[ma]=function(e){return function(){return e.apply(this.doc,arguments)}}(pr.prototype[ma]));return ce(pr),Nn.inputStyles={textarea:Kn,contenteditable:An},Nn.defineMode=function(e){!Nn.defaults.mode&&e!="null"&&(Nn.defaults.mode=e),lt.apply(this,arguments)},Nn.defineMIME=st,Nn.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Nn.defineMIME("text/plain","null"),Nn.defineExtension=function(e,t){Nn.prototype[e]=t},Nn.defineDocExtension=function(e,t){pr.prototype[e]=t},Nn.fromTextArea=ru,iu(Nn),Nn.version="5.58.2",Nn})},WaYH:function(Fe,Ce,j){"use strict";var J=j("rePB"),K=j("Ff2n"),R=j("VTBJ"),H=j("1OyB"),N=j("vuIU"),x=j("JX7q"),U=j("Ji7U"),I=j("LK+K"),E=j("q1tI"),L=j("TSYQ"),f=j.n(L),S=j("sboe"),P=j("OZM5"),T=function(D){var _=D.prefixCls,h=D.level,d=D.isStart,o=D.isEnd;if(!h)return null;for(var s="".concat(_,"-indent-unit"),w=[],C=0;C<h;C+=1){var v;w.push(E.createElement("span",{key:C,className:f()(s,(v={},Object(J.a)(v,"".concat(s,"-start"),d[C+1]),Object(J.a)(v,"".concat(s,"-end"),o[C+1]),Object(J.a)(v,"".concat(s,"-end-first-level"),!C&&o[0]),v))}))}return E.createElement("span",{"aria-hidden":"true",className:"".concat(_,"-indent")},w)},p=T,m=j("815F"),i="open",a="close",u="---",c=function(y){Object(U.a)(_,y);var D=Object(I.a)(_);function _(){var h;return Object(H.a)(this,_),h=D.apply(this,arguments),h.state={dragNodeHighlight:!1},h.onSelectorClick=function(d){var o=h.props.context.onNodeClick;o(d,Object(m.b)(h.props)),h.isSelectable()?h.onSelect(d):h.onCheck(d)},h.onSelectorDoubleClick=function(d){var o=h.props.context.onNodeDoubleClick;o(d,Object(m.b)(h.props))},h.onSelect=function(d){if(h.isDisabled())return;var o=h.props.context.onNodeSelect;d.preventDefault(),o(d,Object(m.b)(h.props))},h.onCheck=function(d){if(h.isDisabled())return;var o=h.props,s=o.disableCheckbox,w=o.checked,C=h.props.context.onNodeCheck;if(!h.isCheckable()||s)return;d.preventDefault();var v=!w;C(d,Object(m.b)(h.props),v)},h.onMouseEnter=function(d){var o=h.props.context.onNodeMouseEnter;o(d,Object(m.b)(h.props))},h.onMouseLeave=function(d){var o=h.props.context.onNodeMouseLeave;o(d,Object(m.b)(h.props))},h.onContextMenu=function(d){var o=h.props.context.onNodeContextMenu;o(d,Object(m.b)(h.props))},h.onDragStart=function(d){var o=h.props.context.onNodeDragStart;d.stopPropagation(),h.setState({dragNodeHighlight:!0}),o(d,Object(x.a)(h));try{d.dataTransfer.setData("text/plain","")}catch(s){}},h.onDragEnter=function(d){var o=h.props.context.onNodeDragEnter;d.preventDefault(),d.stopPropagation(),o(d,Object(x.a)(h))},h.onDragOver=function(d){var o=h.props.context.onNodeDragOver;d.preventDefault(),d.stopPropagation(),o(d,Object(x.a)(h))},h.onDragLeave=function(d){var o=h.props.context.onNodeDragLeave;d.stopPropagation(),o(d,Object(x.a)(h))},h.onDragEnd=function(d){var o=h.props.context.onNodeDragEnd;d.stopPropagation(),h.setState({dragNodeHighlight:!1}),o(d,Object(x.a)(h))},h.onDrop=function(d){var o=h.props.context.onNodeDrop;d.preventDefault(),d.stopPropagation(),h.setState({dragNodeHighlight:!1}),o(d,Object(x.a)(h))},h.onExpand=function(d){var o=h.props.context.onNodeExpand;o(d,Object(m.b)(h.props))},h.setSelectHandle=function(d){h.selectHandle=d},h.getNodeState=function(){var d=h.props.expanded;return h.isLeaf()?null:d?i:a},h.hasChildren=function(){var d=h.props.eventKey,o=h.props.context.keyEntities,s=o[d]||{},w=s.children;return!!(w||[]).length},h.isLeaf=function(){var d=h.props,o=d.isLeaf,s=d.loaded,w=h.props.context.loadData,C=h.hasChildren();return o===!1?!1:o||!w&&!C||w&&s&&!C},h.isDisabled=function(){var d=h.props.disabled,o=h.props.context.disabled;return!!(o||d)},h.isCheckable=function(){var d=h.props.checkable,o=h.props.context.checkable;return!o||d===!1?!1:o},h.syncLoadData=function(d){var o=d.expanded,s=d.loading,w=d.loaded,C=h.props.context,v=C.loadData,M=C.onNodeLoad;if(s)return;v&&o&&!h.isLeaf()&&(!h.hasChildren()&&!w&&M(Object(m.b)(h.props)))},h.renderSwitcher=function(){var d=h.props,o=d.expanded,s=d.switcherIcon,w=h.props.context,C=w.prefixCls,v=w.switcherIcon,M=s||v;if(h.isLeaf())return E.createElement("span",{className:f()("".concat(C,"-switcher"),"".concat(C,"-switcher-noop"))},typeof M=="function"?M(Object(R.a)(Object(R.a)({},h.props),{},{isLeaf:!0})):M);var B=f()("".concat(C,"-switcher"),"".concat(C,"-switcher_").concat(o?i:a));return E.createElement("span",{onClick:h.onExpand,className:B},typeof M=="function"?M(Object(R.a)(Object(R.a)({},h.props),{},{isLeaf:!1})):M)},h.renderCheckbox=function(){var d=h.props,o=d.checked,s=d.halfChecked,w=d.disableCheckbox,C=h.props.context.prefixCls,v=h.isDisabled(),M=h.isCheckable();if(!M)return null;var B=typeof M!="boolean"?M:null;return E.createElement("span",{className:f()("".concat(C,"-checkbox"),o&&"".concat(C,"-checkbox-checked"),!o&&s&&"".concat(C,"-checkbox-indeterminate"),(v||w)&&"".concat(C,"-checkbox-disabled")),onClick:h.onCheck},B)},h.renderIcon=function(){var d=h.props.loading,o=h.props.context.prefixCls;return E.createElement("span",{className:f()("".concat(o,"-iconEle"),"".concat(o,"-icon__").concat(h.getNodeState()||"docu"),d&&"".concat(o,"-icon_loading"))})},h.renderSelector=function(){var d=h.state.dragNodeHighlight,o=h.props,s=o.title,w=o.selected,C=o.icon,v=o.loading,M=o.data,B=h.props.context,F=B.prefixCls,Q=B.showIcon,G=B.icon,W=B.draggable,$=B.loadData,re=B.titleRender,ae=h.isDisabled(),he="".concat(F,"-node-content-wrapper"),Te;if(Q){var ye=C||G;Te=ye?E.createElement("span",{className:f()("".concat(F,"-iconEle"),"".concat(F,"-icon__customize"))},typeof ye=="function"?ye(h.props):ye):h.renderIcon()}else $&&v&&(Te=h.renderIcon());var Ee;typeof s=="function"?Ee=s(M):re?Ee=re(M):Ee=s;var Oe=E.createElement("span",{className:"".concat(F,"-title")},Ee);return E.createElement("span",{ref:h.setSelectHandle,title:typeof s=="string"?s:"",className:f()("".concat(he),"".concat(he,"-").concat(h.getNodeState()||"normal"),!ae&&(w||d)&&"".concat(F,"-node-selected"),!ae&&W&&"draggable"),draggable:!ae&&W||void 0,"aria-grabbed":!ae&&W||void 0,onMouseEnter:h.onMouseEnter,onMouseLeave:h.onMouseLeave,onContextMenu:h.onContextMenu,onClick:h.onSelectorClick,onDoubleClick:h.onSelectorDoubleClick,onDragStart:W?h.onDragStart:void 0},Te,Oe)},h}return Object(N.a)(_,[{key:"componentDidMount",value:function(){this.syncLoadData(this.props)}},{key:"componentDidUpdate",value:function(){this.syncLoadData(this.props)}},{key:"isSelectable",value:function(){var d=this.props.selectable,o=this.props.context.selectable;return typeof d=="boolean"?d:o}},{key:"render",value:function(){var d,o=this.props,s=o.eventKey,w=o.className,C=o.style,v=o.dragOver,M=o.dragOverGapTop,B=o.dragOverGapBottom,F=o.isLeaf,Q=o.isStart,G=o.isEnd,W=o.expanded,$=o.selected,re=o.checked,ae=o.halfChecked,he=o.loading,Te=o.domRef,ye=o.active,Ee=o.onMouseMove,Oe=Object(K.a)(o,["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","onMouseMove"]),_e=this.props.context,fe=_e.prefixCls,le=_e.filterTreeNode,Me=_e.draggable,ot=_e.keyEntities,ut=this.isDisabled(),rt=Object(P.f)(Oe),tt=ot[s]||{},ze=tt.level,$e=G[G.length-1];return E.createElement("div",Object.assign({ref:Te,className:f()(w,"".concat(fe,"-treenode"),(d={},Object(J.a)(d,"".concat(fe,"-treenode-disabled"),ut),Object(J.a)(d,"".concat(fe,"-treenode-switcher-").concat(W?"open":"close"),!F),Object(J.a)(d,"".concat(fe,"-treenode-checkbox-checked"),re),Object(J.a)(d,"".concat(fe,"-treenode-checkbox-indeterminate"),ae),Object(J.a)(d,"".concat(fe,"-treenode-selected"),$),Object(J.a)(d,"".concat(fe,"-treenode-loading"),he),Object(J.a)(d,"".concat(fe,"-treenode-active"),ye),Object(J.a)(d,"".concat(fe,"-treenode-leaf-last"),$e),Object(J.a)(d,"drag-over",!ut&&v),Object(J.a)(d,"drag-over-gap-top",!ut&&M),Object(J.a)(d,"drag-over-gap-bottom",!ut&&B),Object(J.a)(d,"filter-node",le&&le(Object(m.b)(this.props))),d)),style:C,onDragEnter:Me?this.onDragEnter:void 0,onDragOver:Me?this.onDragOver:void 0,onDragLeave:Me?this.onDragLeave:void 0,onDrop:Me?this.onDrop:void 0,onDragEnd:Me?this.onDragEnd:void 0,onMouseMove:Ee},rt),E.createElement(p,{prefixCls:fe,level:ze,isStart:Q,isEnd:G}),this.renderSwitcher(),this.renderCheckbox(),this.renderSelector())}}]),_}(E.Component),O=function(D){return E.createElement(S.a.Consumer,null,function(_){return E.createElement(c,Object.assign({},D,{context:_}))})};O.displayName="TreeNode",O.defaultProps={title:u},O.isTreeNode=1;var b=Ce.a=O},XIdC:function(Fe,Ce,j){"use strict";var J=j("rePB"),K=j("ODXe"),R=j("Ff2n"),H=j("q1tI"),N=j.n(H),x=j("TSYQ"),U=j.n(x),I=j("6cGi"),E=j("4IlW"),L=H.forwardRef(function(f,S){var P,T=f.prefixCls,p=T===void 0?"rc-switch":T,m=f.className,i=f.checked,a=f.defaultChecked,u=f.disabled,c=f.loadingIcon,O=f.checkedChildren,b=f.unCheckedChildren,y=f.onClick,D=f.onChange,_=f.onKeyDown,h=Object(R.a)(f,["prefixCls","className","checked","defaultChecked","disabled","loadingIcon","checkedChildren","unCheckedChildren","onClick","onChange","onKeyDown"]),d=Object(I.a)(!1,{value:i,defaultValue:a}),o=Object(K.a)(d,2),s=o[0],w=o[1];function C(F,Q){var G=s;return u||(G=F,w(G),D==null||D(G,Q)),G}function v(F){F.which===E.a.LEFT?C(!1,F):F.which===E.a.RIGHT&&C(!0,F),_==null||_(F)}function M(F){var Q=C(!s,F);y==null||y(Q,F)}var B=U()(p,m,(P={},Object(J.a)(P,"".concat(p,"-checked"),s),Object(J.a)(P,"".concat(p,"-disabled"),u),P));return H.createElement("button",Object.assign({},h,{type:"button",role:"switch","aria-checked":s,disabled:u,className:B,ref:S,onKeyDown:v,onClick:M}),c,H.createElement("span",{className:"".concat(p,"-inner")},s?O:b))});L.displayName="Switch",Ce.a=L},Y1PL:function(Fe,Ce,j){"use strict";j.r(Ce),j.d(Ce,"ResizableTextArea",function(){return ae});var J=j("wx14"),K=j("1OyB"),R=j("vuIU"),H=j("Ji7U"),N=j("LK+K"),x=j("q1tI"),U=j("VTBJ"),I=j("rePB"),E=j("Zm9Q"),L=j("Kwbf"),f=j("c+Xe"),S=j("m+aA"),P=j("bdgK"),T=new Map;function p(ye){ye.forEach(function(Ee){var Oe,_e=Ee.target;(Oe=T.get(_e))===null||Oe===void 0||Oe.forEach(function(fe){return fe(_e)})})}var m=new P.default(p),i=null,a=null;function u(ye,Ee){T.has(ye)||(T.set(ye,new Set),m.observe(ye)),T.get(ye).add(Ee)}function c(ye,Ee){T.has(ye)&&(T.get(ye).delete(Ee),T.get(ye).size||(m.unobserve(ye),T.delete(ye)))}var O=function(ye){Object(H.a)(Oe,ye);var Ee=Object(N.a)(Oe);function Oe(){return Object(K.a)(this,Oe),Ee.apply(this,arguments)}return Object(R.a)(Oe,[{key:"render",value:function(){return this.props.children}}]),Oe}(x.Component),b=x.createContext(null);function y(ye){var Ee=ye.children,Oe=ye.onBatchResize,_e=x.useRef(0),fe=x.useRef([]),le=x.useContext(b),Me=x.useCallback(function(ot,ut,rt){_e.current+=1;var tt=_e.current;fe.current.push({size:ot,element:ut,data:rt}),Promise.resolve().then(function(){tt===_e.current&&(Oe==null||Oe(fe.current),fe.current=[])}),le==null||le(ot,ut,rt)},[Oe,le]);return x.createElement(b.Provider,{value:Me},Ee)}function D(ye){var Ee=ye.children,Oe=ye.disabled,_e=x.useRef(null),fe=x.useRef(null),le=x.useContext(b),Me=x.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ot=x.isValidElement(Ee)&&Object(f.c)(Ee),ut=ot?Ee.ref:null,rt=x.useMemo(function(){return Object(f.a)(ut,_e)},[ut,_e]),tt=x.useRef(ye);tt.current=ye;var ze=x.useCallback(function($e){var ct=tt.current,vt=ct.onResize,at=ct.data,et=$e.getBoundingClientRect(),nt=et.width,Rt=et.height,Ct=$e.offsetWidth,xt=$e.offsetHeight,yt=Math.floor(nt),wt=Math.floor(Rt);if(Me.current.width!==yt||Me.current.height!==wt||Me.current.offsetWidth!==Ct||Me.current.offsetHeight!==xt){var Et={width:yt,height:wt,offsetWidth:Ct,offsetHeight:xt};Me.current=Et;var Se=Ct===Math.round(nt)?nt:Ct,xe=xt===Math.round(Rt)?Rt:xt,Ke=Object(U.a)(Object(U.a)({},Et),{},{offsetWidth:Se,offsetHeight:xe});le==null||le(Ke,$e,at),vt&&Promise.resolve().then(function(){vt(Ke,$e)})}},[]);return x.useEffect(function(){var $e=Object(S.a)(_e.current)||Object(S.a)(fe.current);return $e&&!Oe&&u($e,ze),function(){return c($e,ze)}},[_e.current,Oe]),x.createElement(O,{ref:fe},ot?x.cloneElement(Ee,{ref:rt}):Ee)}var _="rc-observer-key";function h(ye){var Ee=ye.children,Oe=Object(E.a)(Ee);return Oe.map(function(_e,fe){var le=(_e==null?void 0:_e.key)||"".concat(_,"-").concat(fe);return x.createElement(D,Object(J.a)({},ye,{key:le}),_e)})}h.Collection=y;var d=h,o=j("bT9E"),s=j("TSYQ"),w=j.n(s),C=`
|
|
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
|
|
`,v=["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"],M={},B;function F(ye){var Ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Oe=ye.getAttribute("id")||ye.getAttribute("data-reactid")||ye.getAttribute("name");if(Ee&&M[Oe])return M[Oe];var _e=window.getComputedStyle(ye),fe=_e.getPropertyValue("box-sizing")||_e.getPropertyValue("-moz-box-sizing")||_e.getPropertyValue("-webkit-box-sizing"),le=parseFloat(_e.getPropertyValue("padding-bottom"))+parseFloat(_e.getPropertyValue("padding-top")),Me=parseFloat(_e.getPropertyValue("border-bottom-width"))+parseFloat(_e.getPropertyValue("border-top-width")),ot=v.map(function(rt){return"".concat(rt,":").concat(_e.getPropertyValue(rt))}).join(";"),ut={sizingStyle:ot,paddingSize:le,borderSize:Me,boxSizing:fe};return Ee&&Oe&&(M[Oe]=ut),ut}function Q(ye){var Ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Oe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,_e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;B||(B=document.createElement("textarea"),B.setAttribute("tab-index","-1"),B.setAttribute("aria-hidden","true"),document.body.appendChild(B)),ye.getAttribute("wrap")?B.setAttribute("wrap",ye.getAttribute("wrap")):B.removeAttribute("wrap");var fe=F(ye,Ee),le=fe.paddingSize,Me=fe.borderSize,ot=fe.boxSizing,ut=fe.sizingStyle;B.setAttribute("style","".concat(ut,";").concat(C)),B.value=ye.value||ye.placeholder||"";var rt=Number.MIN_SAFE_INTEGER,tt=Number.MAX_SAFE_INTEGER,ze=B.scrollHeight,$e;if(ot==="border-box"?ze+=Me:ot==="content-box"&&(ze-=le),Oe!==null||_e!==null){B.value=" ";var ct=B.scrollHeight-le;Oe!==null&&(rt=ct*Oe,ot==="border-box"&&(rt=rt+le+Me),ze=Math.max(rt,ze)),_e!==null&&(tt=ct*_e,ot==="border-box"&&(tt=tt+le+Me),$e=ze>tt?"":"hidden",ze=Math.min(tt,ze))}return{height:ze,minHeight:rt,maxHeight:tt,overflowY:$e,resize:"none"}}var G=j("Gytx"),W=j.n(G),$;(function(ye){ye[ye.NONE=0]="NONE",ye[ye.RESIZING=1]="RESIZING",ye[ye.RESIZED=2]="RESIZED"})($||($={}));var re=function(ye){Object(H.a)(Oe,ye);var Ee=Object(N.a)(Oe);function Oe(_e){var fe;return Object(K.a)(this,Oe),fe=Ee.call(this,_e),fe.nextFrameActionId=void 0,fe.resizeFrameId=void 0,fe.textArea=void 0,fe.saveTextArea=function(le){fe.textArea=le},fe.handleResize=function(le){var Me=fe.state.resizeStatus,ot=fe.props,ut=ot.autoSize,rt=ot.onResize;if(Me!==$.NONE)return;typeof rt=="function"&&rt(le),ut&&fe.resizeOnNextFrame()},fe.resizeOnNextFrame=function(){cancelAnimationFrame(fe.nextFrameActionId),fe.nextFrameActionId=requestAnimationFrame(fe.resizeTextarea)},fe.resizeTextarea=function(){var le=fe.props.autoSize;if(!le||!fe.textArea)return;var Me=le.minRows,ot=le.maxRows,ut=Q(fe.textArea,!1,Me,ot);fe.setState({textareaStyles:ut,resizeStatus:$.RESIZING},function(){cancelAnimationFrame(fe.resizeFrameId),fe.resizeFrameId=requestAnimationFrame(function(){fe.setState({resizeStatus:$.RESIZED},function(){fe.resizeFrameId=requestAnimationFrame(function(){fe.setState({resizeStatus:$.NONE}),fe.fixFirefoxAutoScroll()})})})})},fe.renderTextArea=function(){var le=fe.props,Me=le.prefixCls,ot=Me===void 0?"rc-textarea":Me,ut=le.autoSize,rt=le.onResize,tt=le.className,ze=le.disabled,$e=fe.state,ct=$e.textareaStyles,vt=$e.resizeStatus,at=Object(o.a)(fe.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),et=w()(ot,tt,Object(I.a)({},"".concat(ot,"-disabled"),ze));"value"in at&&(at.value=at.value||"");var nt=Object(U.a)(Object(U.a)(Object(U.a)({},fe.props.style),ct),vt===$.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return x.createElement(d,{onResize:fe.handleResize,disabled:!(ut||rt)},x.createElement("textarea",Object(J.a)({},at,{className:et,style:nt,ref:fe.saveTextArea})))},fe.state={textareaStyles:{},resizeStatus:$.NONE},fe}return Object(R.a)(Oe,[{key:"componentDidUpdate",value:function(fe){(fe.value!==this.props.value||!W()(fe.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 fe=this.textArea.selectionStart,le=this.textArea.selectionEnd;this.textArea.setSelectionRange(fe,le)}}catch(Me){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Oe}(x.Component),ae=re,he=function(ye){Object(H.a)(Oe,ye);var Ee=Object(N.a)(Oe);function Oe(_e){var fe;Object(K.a)(this,Oe),fe=Ee.call(this,_e),fe.resizableTextArea=void 0,fe.focus=function(){fe.resizableTextArea.textArea.focus()},fe.saveTextArea=function(Me){fe.resizableTextArea=Me},fe.handleChange=function(Me){var ot=fe.props.onChange;fe.setValue(Me.target.value,function(){fe.resizableTextArea.resizeTextarea()}),ot&&ot(Me)},fe.handleKeyDown=function(Me){var ot=fe.props,ut=ot.onPressEnter,rt=ot.onKeyDown;Me.keyCode===13&&ut&&ut(Me),rt&&rt(Me)};var le=typeof _e.value=="undefined"||_e.value===null?_e.defaultValue:_e.value;return fe.state={value:le},fe}return Object(R.a)(Oe,[{key:"setValue",value:function(fe,le){"value"in this.props||this.setState({value:fe},le)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return x.createElement(ae,Object(J.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(fe){return"value"in fe?{value:fe.value}:null}}]),Oe}(x.Component),Te=Ce.default=he},ZD9Y:function(Fe,Ce,j){"use strict";var J=j("BoS7"),K=j("Sdc0"),R=j("OaEy"),H=j("2fM7"),N=j("q1tI"),x=j.n(N),U=j("lOMy"),I=j.n(U),E=H.a.Option;Ce.a=function(L){var f=L.onFontSizeChange,S=L.cmFontSize,P=L.cmCodeMode,T=L.onCodeModeChange,p=L.onTabToSpace,m=L.className,i=m===void 0?"":m,a=L.tabToSpace,u=L.children;return x.a.createElement("div",{className:"tpi-code-setting ".concat(i)},x.a.createElement("h3",null,"\u4EE3\u7801\u7F16\u8F91\u5668"),x.a.createElement("section",null,x.a.createElement("div",{className:"file-item"},x.a.createElement("b",null,"\u98CE\u683C\u5207\u6362"),x.a.createElement(H.a,{bordered:!1,size:"small",value:P,onChange:T},x.a.createElement(E,{value:"vs"},"\u6D45\u8272\u98CE\u683C"),x.a.createElement(E,{value:"vs-dark"},"\u6DF1\u8272\u98CE\u683C"))),x.a.createElement("div",{className:"file-item"},x.a.createElement("b",null,"\u5B57\u4F53\u5927\u5C0F"),x.a.createElement(H.a,{bordered:!1,size:"small",value:S,onChange:f},x.a.createElement(E,{value:12},"12px"),x.a.createElement(E,{value:14},"14px"),x.a.createElement(E,{value:16},"16px"),x.a.createElement(E,{value:18},"18px"),x.a.createElement(E,{value:20},"20px"),x.a.createElement(E,{value:22},"22px"))),x.a.createElement("div",{className:"file-item"},x.a.createElement("b",null,"Tab\u8F6C\u6362"),x.a.createElement(K.a,{checked:a,onChange:p}))),x.a.createElement("h3",null,"\u5FEB\u6377\u952E"),x.a.createElement("section",null,x.a.createElement("div",{className:"file-item"},x.a.createElement("b",null,"\u4FDD\u5B58\u4EE3\u7801"),x.a.createElement("span",null,"Ctrl + S")),x.a.createElement("div",{className:"file-item"},x.a.createElement("b",null,"\u5524\u51FA\u5FEB\u6377\u952E\u5217\u8868"),x.a.createElement("span",null,"F1 / Alt + F1")),x.a.createElement("div",{className:"file-item"},x.a.createElement("b",null,"\u5DE6\u53F3\u7F29\u8FDB"),x.a.createElement("span",null,"Ctrl + ]/[")),x.a.createElement("div",{className:"file-item"},x.a.createElement("b",null,"\u8DF3\u5230\u5339\u914D\u7684\u62EC\u53F7"),x.a.createElement("span",null,"Ctrl + Shift + \\")),x.a.createElement("div",{className:"file-item"},x.a.createElement("b",null,"\u8F6C\u5230\u884C\u9996"),x.a.createElement("span",null,"Home")),x.a.createElement("div",{className:"file-item"},x.a.createElement("b",null,"\u8F6C\u5230\u884C\u5C3E"),x.a.createElement("span",null,"End"))),u)}},ZW9T:function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return O});var J=j("k1fw"),K=j("miYZ"),R=j("tsqr"),H=j("rAM+"),N=j("tJVT"),x=j("PpiC"),U=j("q1tI"),I=j.n(U),E=j("bdgK");function L(b,y,D,_,h){var d=y.getWordUntilPosition(D),o={startLineNumber:D.lineNumber,endLineNumber:D.lineNumber,startColumn:d.startColumn,endColumn:d.endColumn},s=_.map(function(w){return{label:w,kind:b.languages.CompletionItemKind.Keyword,insertText:w,insertTextRules:b.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:o}});return h.map(function(w){s.push(Object(J.a)(Object(J.a)({},w),{},{range:o}))}),s}var f=function(b){var y={label:"ifelse",kind:b.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`),insertTextRules:b.languages.CompletionItemInsertTextRule.InsertAsSnippet},D=["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","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];b.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(o,s){var w=L(b,o,s,D,[y]);return{suggestions:w}}});var _=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];b.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(o,s){var w=[{label:"print",kind:b.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:b.languages.CompletionItemInsertTextRule.InsertAsSnippet}],C=L(b,o,s,_,w);return{suggestions:C}}});var h=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];b.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(o,s){var w=[y,{label:"main",kind:b.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`),insertTextRules:b.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:b.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
|
|
`),insertTextRules:b.languages.CompletionItemInsertTextRule.InsertAsSnippet}],C=L(b,o,s,h,w);return{suggestions:C}}})},S="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",P=j("LvDl");function T(b){return/^\d+$/.test(b)?"".concat(b,"px"):b}function p(){}var m=!1,i={"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 a(){var b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],y=b;if(Array.isArray(b)){for(var D=0;D<b.length;D++){var _=i[b[D]];if(_)return _}return y[0]}return i[y]||y}var u=null,c=Ce.b=function(b){var y=b.width,D=y===void 0?"100%":y,_=b.height,h=_===void 0?"100%":_,d=b.value,o=b.language,s=o===void 0?"javascript":o,w=b.style,C=w===void 0?{}:w,v=b.options,M=v===void 0?{}:v,B=b.overrideServices,F=B===void 0?{}:B,Q=b.theme,G=Q===void 0?"vs-dark":Q,W=b.onEditBlur,$=b.onSave,re=b.autoHeight,ae=re===void 0?!1:re,he=b.forbidCopy,Te=he===void 0?!1:he,ye=b.onChange,Ee=ye===void 0?p:ye,Oe=b.editorDidMount,_e=Oe===void 0?p:Oe,fe=b.onFocus,le=fe===void 0?p:fe,Me=b.filename,ot=Me===void 0?"educoder.txt":Me,ut=Object(x.a)(b,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),rt=Object(U.useRef)(),tt=Object(U.useRef)({}),ze=Object(U.useRef)(),$e=Object(U.useRef)(!1),ct=Object(U.useRef)(),vt=Object(U.useState)(!1),at=Object(N.a)(vt,2),et=at[0],nt=at[1];function Rt(){var oe;return rt.current&&(oe=new E.default(function(ue){var we=Object(H.a)(ue),ke;try{for(we.s();!(ke=we.n()).done;){var Je=ke.value;(Je.target.offsetHeight>0||Je.target.offsetWidth>0)&&tt.current.instance.layout()}}catch(bt){we.e(bt)}finally{we.f()}}),oe.observe(rt.current)),oe}function Ct(){R.b.warn(decodeURIComponent(S))}var xt=function(){var ue=tt.current.instance;if(d!=null&&ue&&et){var we=ue.getModel();we&&d!==we.getValue()&&(m=!0,we.setValue(d),ue.layout(),m=!1)}};Object(U.useEffect)(function(){ze.current&&clearTimeout(ze.current),ze.current=setTimeout(function(){xt()},500)},[d,et,tt.current]);function yt(){var oe=tt.current.instance;if(oe){var ue=oe.getSelection(),we=tt.current.pastePos||{},ke=new u.Range(we.startLineNumber||ue.endLineNumber,we.startColumn||ue.endColumn,we.endLineNumber||ue.endLineNumber,we.endColumn||ue.endColumn);setTimeout(function(){oe.executeEdits("",[{range:ke,text:""}])},300)}}function wt(oe){(window.navigator.platform.match("Mac")?oe.metaKey:oe.ctrlKey)&&oe.keyCode==83&&(oe.preventDefault(),$())}var Et=function(){if(ae&&tt.current.instance){var ue=tt.current.instance.getContentHeight();ne(ue<h?h:ue)}else ne(h)};function Se(oe){var ue=document.createEvent("MouseEvents");ue.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),oe.dispatchEvent(ue)}function xe(oe,ue){var we=window.URL||window.webkitURL||window,ke=new Blob([ue]),Je=document.createElementNS("http://www.w3.org/1999/xhtml","a");Je.href=we.createObjectURL(ke),Je.download=oe,Se(Je)}Object(U.useEffect)(function(){Et()},[Et]),Object(U.useEffect)(function(){rt.current&&!et&&j.e(27).then(j.t.bind(null,"M/lh",7)).then(function(oe){try{u=oe,tt.current.instance=u.editor.create(rt.current,{value:d,language:a(s),theme:G,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},F);var ue=tt.current.instance;if(_e(ue,u),setTimeout(function(){Et(),tt.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){xe(ot||"educoder.txt",ue.getValue())}})},500),tt.current.subscription=ue.onDidChangeModelContent(function(ke){$e.current?clearTimeout(ct.current):(Et(),Ee(ue.getValue(),ke)),ct.current=setTimeout(function(){$e.current=!1},500)}),window.Monaco||f(u),Te&&(ue.addCommand(u.KeyMod.CtrlCmd|u.KeyMod.Shift|u.KeyCode.KEY_V,function(){return Ct(),null}),ue.addCommand(u.KeyMod.CtrlCmd|u.KeyCode.KEY_C,function(){return Ct(),null})),window.Monaco=u,W&&ue.onDidBlurEditorWidget(function(){W(ue.getValue())}),le&&ue.onDidFocusEditorText(function(){le(ue.getValue())}),Te){ue.addCommand(u.KeyMod.CtrlCmd|u.KeyCode.KEY_V,function(){return Ct(),null}),ue.onDidPaste(function(ke){tt.current.pastePos=ke});try{window.addEventListener("paste",yt)}catch(ke){}}var we=Rt();return nt(!0),function(){var ke=tt.current.instance;ke.dispose();var Je=ke.getModel();Je&&Je.dispose(),tt.current.subscription&&tt.current.subscription.dispose(),Te&&window.removeEventListener("paste",yt),we.unobserve(rt.current)}}catch(ke){}})},[]),Object(U.useEffect)(function(){var oe=tt.current.instance;if(oe&&et)return document.addEventListener("keydown",wt,!1),function(){document.removeEventListener("keydown",wt)}},[$,et]),Object(U.useEffect)(function(){var oe=tt.current.instance;if(oe&&et){var ue=a(s);u.editor.setModelLanguage(oe.getModel(),ue),console.log("language:",s,oe.getModel(),ue)}},[s,et]),Object(U.useEffect)(function(){var oe=tt.current.instance;oe&&et&&u.editor.setTheme(G)},[G,et]),Object(U.useEffect)(function(){var oe=tt.current.instance;oe&&et&&(oe.updateOptions(Object(J.a)({},M)),setTimeout(function(){oe.getModel().updateOptions(Object(J.a)({},M))},200))},[JSON.stringify(M),et]),Object(U.useEffect)(function(){var oe=tt.current.instance;oe&&et&&oe.layout()},[D,h,et]);var Ke=Object(U.useState)(T(D)),Ve=Object(N.a)(Ke,2),De=Ve[0],We=Ve[1],ge=Object(U.useState)(T(h)),de=Object(N.a)(ge,2),ce=de[0],ne=de[1],ie=Object(J.a)(Object(J.a)({},C),{},{width:De,height:ce});return I.a.createElement("div",{className:"my-monaco-editor",ref:rt,style:ie})};function O(b){var y=b.width,D=y===void 0?"100%":y,_=b.height,h=_===void 0?"100%":_,d=b.original,o=b.modified,s=b.language,w=b.options,C=w===void 0?{}:w,v=Object(U.useRef)(),M=Object(U.useState)(null),B=Object(N.a)(M,2),F=B[0],Q=B[1];function G(ae){var he;return v.current&&(he=new E.default(function(Te){var ye=Object(H.a)(Te),Ee;try{for(ye.s();!(Ee=ye.n()).done;){var Oe=Ee.value;(Oe.target.offsetHeight>0||Oe.target.offsetWidth>0)&&ae.layout()}}catch(_e){ye.e(_e)}finally{ye.f()}}),he.observe(v.current)),he}Object(U.useEffect)(function(){v.current&&j.e(27).then(j.t.bind(null,"M/lh",7)).then(function(ae){u=ae;var he=u.editor.createDiffEditor(v.current,Object(J.a)(Object(J.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},C),{},{wordWrap:!0}));Q(he);var Te=G(he);return function(){he.dispose();var ye=he.getModel();ye&&ye.dispose(),Te.unobserve(v.current)}})},[]),Object(U.useEffect)(function(){F&&F.setModel({original:u.editor.createModel(d,s),modified:u.editor.createModel(o,s)})},[d,o,s,F]);var W=T(D),$=T(h),re={width:W,height:$};return I.a.createElement("div",{className:"my-diff-editor",ref:v,style:re})}},ZpRC:function(Fe,Ce,j){"use strict";function J(f){return typeof f=="object"&&f!=null&&f.nodeType===1}function K(f,S){return(!S||f!=="hidden")&&f!=="visible"&&f!=="clip"}function R(f,S){if(f.clientHeight<f.scrollHeight||f.clientWidth<f.scrollWidth){var P=getComputedStyle(f,null);return K(P.overflowY,S)||K(P.overflowX,S)||function(T){var p=function(m){if(!m.ownerDocument||!m.ownerDocument.defaultView)return null;try{return m.ownerDocument.defaultView.frameElement}catch(i){return null}}(T);return!!p&&(p.clientHeight<T.scrollHeight||p.clientWidth<T.scrollWidth)}(f)}return!1}function H(f,S,P,T,p,m,i,a){return m<f&&i>S||m>f&&i<S?0:m<=f&&a<=P||i>=S&&a>=P?m-f-T:i>S&&a<P||m<f&&a>P?i-S+p:0}var N=function(f,S){var P=window,T=S.scrollMode,p=S.block,m=S.inline,i=S.boundary,a=S.skipOverflowHiddenElements,u=typeof i=="function"?i:function(ct){return ct!==i};if(!J(f))throw new TypeError("Invalid target");for(var c=document.scrollingElement||document.documentElement,O=[],b=f;J(b)&&u(b);){if((b=b.parentElement)===c){O.push(b);break}b!=null&&b===document.body&&R(b)&&!R(document.documentElement)||b!=null&&R(b,a)&&O.push(b)}for(var y=P.visualViewport?P.visualViewport.width:innerWidth,D=P.visualViewport?P.visualViewport.height:innerHeight,_=window.scrollX||pageXOffset,h=window.scrollY||pageYOffset,d=f.getBoundingClientRect(),o=d.height,s=d.width,w=d.top,C=d.right,v=d.bottom,M=d.left,B=p==="start"||p==="nearest"?w:p==="end"?v:w+o/2,F=m==="center"?M+s/2:m==="end"?C:M,Q=[],G=0;G<O.length;G++){var W=O[G],$=W.getBoundingClientRect(),re=$.height,ae=$.width,he=$.top,Te=$.right,ye=$.bottom,Ee=$.left;if(T==="if-needed"&&w>=0&&M>=0&&v<=D&&C<=y&&w>=he&&v<=ye&&M>=Ee&&C<=Te)return Q;var Oe=getComputedStyle(W),_e=parseInt(Oe.borderLeftWidth,10),fe=parseInt(Oe.borderTopWidth,10),le=parseInt(Oe.borderRightWidth,10),Me=parseInt(Oe.borderBottomWidth,10),ot=0,ut=0,rt="offsetWidth"in W?W.offsetWidth-W.clientWidth-_e-le:0,tt="offsetHeight"in W?W.offsetHeight-W.clientHeight-fe-Me:0;if(c===W)ot=p==="start"?B:p==="end"?B-D:p==="nearest"?H(h,h+D,D,fe,Me,h+B,h+B+o,o):B-D/2,ut=m==="start"?F:m==="center"?F-y/2:m==="end"?F-y:H(_,_+y,y,_e,le,_+F,_+F+s,s),ot=Math.max(0,ot+h),ut=Math.max(0,ut+_);else{ot=p==="start"?B-he-fe:p==="end"?B-ye+Me+tt:p==="nearest"?H(he,ye,re,fe,Me+tt,B,B+o,o):B-(he+re/2)+tt/2,ut=m==="start"?F-Ee-_e:m==="center"?F-(Ee+ae/2)+rt/2:m==="end"?F-Te+le+rt:H(Ee,Te,ae,_e,le+rt,F,F+s,s);var ze=W.scrollLeft,$e=W.scrollTop;B+=$e-(ot=Math.max(0,Math.min($e+ot,W.scrollHeight-re+tt))),F+=ze-(ut=Math.max(0,Math.min(ze+ut,W.scrollWidth-ae+rt)))}Q.push({el:W,top:ot,left:ut})}return Q};function x(f){return f===Object(f)&&Object.keys(f).length!==0}function U(f,S){S===void 0&&(S="auto");var P="scrollBehavior"in document.body.style;f.forEach(function(T){var p=T.el,m=T.top,i=T.left;p.scroll&&P?p.scroll({top:m,left:i,behavior:S}):(p.scrollTop=m,p.scrollLeft=i)})}function I(f){return f===!1?{block:"end",inline:"nearest"}:x(f)?f:{block:"start",inline:"nearest"}}function E(f,S){var P=!f.ownerDocument.documentElement.contains(f);if(x(S)&&typeof S.behavior=="function")return S.behavior(P?[]:N(f,S));if(P)return;var T=I(S);return U(N(f,T),T.behavior)}var L=Ce.a=E},a4uL:function(Fe,Ce,j){},aRTE:function(Fe,Ce){Fe.exports={L:1,M:0,Q:3,H:2}},bCnd:function(Fe,Ce,j){"use strict";j.d(Ce,"b",function(){return H}),j.d(Ce,"a",function(){return N});var J=j("je13"),K=j.n(J),R=!1;function H(x,U){var I=K.a.get("__ec");I||(I={}),I[x]=U,K.a.set("__ec",I)}function N(x,U){var I=K.a.get("__ec");return I?I[x]===void 0?U:I[x]:U}},bT9E:function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return K});var J=j("VTBJ");function K(R,H){var N=Object(J.a)({},R);return Array.isArray(H)&&H.forEach(function(x){delete N[x]}),N}},biw7:function(Fe,Ce,j){"use strict";var J=j("q1tI"),K=j.n(J),R=J.createContext(null);Ce.a=R},c5Ni:function(Fe,Ce,j){},cDPC:function(Fe,Ce,j){"use strict";var J=j("tJVT"),K=j("q1tI"),R=j.n(K),H=j("i3hx"),N=j.n(H);Ce.a=function(x){var U=x.defaultX,I=U===void 0?"40%":U,E=x.leftChild,L=x.rightChild,f=x.className,S=x.hideResize,P=S===void 0?!1:S,T=Object(K.useState)(I),p=Object(J.a)(T,2),m=p[0],i=p[1],a=Object(K.useRef)();function u(){a.current=!0}Object(K.useEffect)(function(){function b(D){a.current&&i(D.pageX)}function y(){a.current=!1}return window.addEventListener("mousemove",b),window.addEventListener("mouseup",y),function(){window.removeEventListener("mousemove",b),window.removeEventListener("mouseup",y)}},[]);var c=typeof m=="number"&&m!==.01?"".concat(m,"px"):I,O="calc(100% - ".concat(P?"0px":"4px"," - ").concat(c,")");return R.a.createElement("div",{className:"split-panel-container ".concat(f)},R.a.createElement("section",{style:{width:c,display:m===.01?"none":""}},E),R.a.createElement("section",{className:"resize-x-bar",onMouseDown:u},R.a.createElement("a",{className:"btn-resize"},R.a.createElement("svg",{width:"16",height:"13",viewBox:"0 0 16 13"},R.a.createElement("path",{d:"M12.245 7.53H5.647v1.882h6.598v2.823L16 8.471l-3.755-3.765V7.53zM10.353 4.706H3.755v2.823L0 3.765 3.755 0v2.824h6.598v1.882z"})))),R.a.createElement("section",{style:{width:O}},L))}},dQei:function(Fe,Ce){for(var j={glog:function(K){if(K<1)throw new Error("glog("+K+")");return j.LOG_TABLE[K]},gexp:function(K){for(;K<0;)K+=255;for(;K>=256;)K-=255;return j.EXP_TABLE[K]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},J=0;J<8;J++)j.EXP_TABLE[J]=1<<J;for(var J=8;J<256;J++)j.EXP_TABLE[J]=j.EXP_TABLE[J-4]^j.EXP_TABLE[J-5]^j.EXP_TABLE[J-6]^j.EXP_TABLE[J-8];for(var J=0;J<255;J++)j.LOG_TABLE[j.EXP_TABLE[J]]=J;Fe.exports=j},dWSS:function(Fe,Ce,j){var J=j("dQei");function K(R,H){if(R.length==null)throw new Error(R.length+"/"+H);for(var N=0;N<R.length&&R[N]==0;)N++;this.num=new Array(R.length-N+H);for(var x=0;x<R.length-N;x++)this.num[x]=R[x+N]}K.prototype={get:function(R){return this.num[R]},getLength:function(){return this.num.length},multiply:function(R){for(var H=new Array(this.getLength()+R.getLength()-1),N=0;N<this.getLength();N++)for(var x=0;x<R.getLength();x++)H[N+x]^=J.gexp(J.glog(this.get(N))+J.glog(R.get(x)));return new K(H,0)},mod:function(R){if(this.getLength()-R.getLength()<0)return this;for(var H=J.glog(this.get(0))-J.glog(R.get(0)),N=new Array(this.getLength()),x=0;x<this.getLength();x++)N[x]=this.get(x);for(var x=0;x<R.getLength();x++)N[x]^=J.gexp(J.glog(R.get(x))+H);return new K(N,0).mod(R)}},Fe.exports=K},dejd:function(Fe,Ce,j){},dmUQ:function(Fe,Ce,j){"use strict";var J=j("Ff2n"),K=j("rePB"),R=j("1OyB"),H=j("vuIU"),N=j("Ji7U"),x=j("md7G"),U=j("foSv"),I=j("q1tI"),E=j.n(I),L=j("TSYQ"),f=j.n(L),S=j("4IlW");function P(o,s){var w=Object.keys(o);if(Object.getOwnPropertySymbols){var C=Object.getOwnPropertySymbols(o);s&&(C=C.filter(function(v){return Object.getOwnPropertyDescriptor(o,v).enumerable})),w.push.apply(w,C)}return w}function T(o){for(var s=1;s<arguments.length;s++){var w=arguments[s]!=null?arguments[s]:{};s%2?P(Object(w),!0).forEach(function(C){Object(K.a)(o,C,w[C])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(w)):P(Object(w)).forEach(function(C){Object.defineProperty(o,C,Object.getOwnPropertyDescriptor(w,C))})}return o}function p(o){var s=m();return function(){var C=Object(U.a)(o),v;if(s){var M=Object(U.a)(this).constructor;v=Reflect.construct(C,arguments,M)}else v=C.apply(this,arguments);return Object(x.a)(this,v)}}function m(){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(o){return!1}}function i(){}function a(o){o.preventDefault()}var u=function(s){return s.replace(/[^\w.-]+/g,"")},c=200,O=600,b=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,y=function(s){return s!=null},D=function(s,w){return w===s||typeof w=="number"&&typeof s=="number"&&isNaN(w)&&isNaN(s)},_=function(o){Object(N.a)(w,o);var s=p(w);function w(C){var v;Object(R.a)(this,w),v=s.call(this,C),v.onKeyDown=function(F){var Q=v.props,G=Q.onKeyDown,W=Q.onPressEnter;if(F.keyCode===S.a.UP){var $=v.getRatio(F);v.up(F,$,null),v.stop()}else if(F.keyCode===S.a.DOWN){var re=v.getRatio(F);v.down(F,re,null),v.stop()}else F.keyCode===S.a.ENTER&&W&&W(F);if(v.recordCursorPosition(),v.lastKeyCode=F.keyCode,G){for(var ae=arguments.length,he=new Array(ae>1?ae-1:0),Te=1;Te<ae;Te++)he[Te-1]=arguments[Te];G.apply(void 0,[F].concat(he))}},v.onKeyUp=function(F){var Q=v.props.onKeyUp;if(v.stop(),v.recordCursorPosition(),Q){for(var G=arguments.length,W=new Array(G>1?G-1:0),$=1;$<G;$++)W[$-1]=arguments[$];Q.apply(void 0,[F].concat(W))}},v.onChange=function(F){var Q=v.props.onChange;v.state.focused&&(v.inputting=!0),v.rawInput=v.props.parser(v.getValueFromEvent(F)),v.setState({inputValue:v.rawInput}),Q(v.toNumber(v.rawInput))},v.onMouseUp=function(){var F=v.props.onMouseUp;v.recordCursorPosition(),F&&F.apply(void 0,arguments)},v.onFocus=function(){var F;v.setState({focused:!0}),(F=v.props).onFocus.apply(F,arguments)},v.onBlur=function(){var F=v.props.onBlur;v.inputting=!1,v.setState({focused:!1});var Q=v.getCurrentValidValue(v.state.inputValue),G=v.setValue(Q,i);if(F){var W=v.input.value,$=v.getInputDisplayValue({focus:!1,value:G});v.input.value=$&&Number($),F.apply(void 0,arguments),v.input.value=W}},v.getRatio=function(F){var Q=1;return F.metaKey||F.ctrlKey?Q=.1:F.shiftKey&&(Q=10),Q},v.getFullNum=function(F){return isNaN(F)?F:/e/i.test(String(F))?Number(F).toFixed(18).replace(/\.?0+$/,""):F},v.getPrecision=function(F){if(y(v.props.precision))return v.props.precision;var Q=String(F);if(Q.indexOf("e-")>=0)return parseInt(Q.slice(Q.indexOf("e-")+2),10);var G=0;return Q.indexOf(".")>=0&&(G=Q.length-Q.indexOf(".")-1),G},v.getInputDisplayValue=function(F){var Q=F||v.state,G=Q.focused,W=Q.inputValue,$=Q.value,re;G?re=W:re=v.toPrecisionAsStep($),re==null&&(re="");var ae=v.formatWrapper(re);return y(v.props.decimalSeparator)&&(ae=ae.toString().replace(".",v.props.decimalSeparator)),ae},v.recordCursorPosition=function(){try{v.cursorStart=v.input.selectionStart,v.cursorEnd=v.input.selectionEnd,v.currentValue=v.input.value,v.cursorBefore=v.input.value.substring(0,v.cursorStart),v.cursorAfter=v.input.value.substring(v.cursorEnd)}catch(F){}},v.restoreByAfter=function(F){if(F===void 0)return!1;var Q=v.input.value,G=Q.lastIndexOf(F);if(G===-1)return!1;var W=v.cursorBefore.length;return v.lastKeyCode===S.a.DELETE&&v.cursorBefore.charAt(W-1)===F[0]?(v.fixCaret(W,W),!0):G+F.length===Q.length?(v.fixCaret(G,G),!0):!1},v.partRestoreByAfter=function(F){return F===void 0?!1:Array.prototype.some.call(F,function(Q,G){var W=F.substring(G);return v.restoreByAfter(W)})},v.isNotCompleteNumber=function(F){return isNaN(F)||F===""||F===null||F&&F.toString().indexOf(".")===F.toString().length-1},v.stop=function(){v.autoStepTimer&&clearTimeout(v.autoStepTimer)},v.down=function(F,Q,G){v.pressingUpOrDown=!0,v.step("down",F,Q,G)},v.up=function(F,Q,G){v.pressingUpOrDown=!0,v.step("up",F,Q,G)},v.saveInput=function(F){v.input=F};var M=C.value;M===void 0&&(M=C.defaultValue),v.state={focused:C.autoFocus};var B=v.getValidValue(v.toNumber(M));return v.state=T(T({},v.state),{},{inputValue:v.toPrecisionAsStep(B),value:B}),v}return Object(H.a)(w,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(v){var M=this.props,B=M.value,F=M.onChange,Q=M.max,G=M.min,W=this.state.focused;if(v){if(!D(v.value,B)||!D(v.max,Q)||!D(v.min,G)){var $=W?B:this.getValidValue(B),re;this.pressingUpOrDown?re=$:this.inputting?re=this.rawInput:re=this.toPrecisionAsStep($),this.setState({value:$,inputValue:re})}var ae="value"in this.props?B:this.state.value;"max"in this.props&&v.max!==Q&&typeof ae=="number"&&ae>Q&&F&&F(Q),"min"in this.props&&v.min!==G&&typeof ae=="number"&&ae<G&&F&&F(G)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var he=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===S.a.BACKSPACE?he=this.cursorStart-1:this.lastKeyCode===S.a.DELETE&&(he=this.cursorStart):he=this.input.value.length,this.fixCaret(he,he)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case S.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case S.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Te){}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(v){var M=v;return M===""?M="":this.isNotCompleteNumber(parseFloat(M))?M=this.state.value:M=this.getValidValue(M),this.toNumber(M)}},{key:"getValueFromEvent",value:function(v){var M=v.target.value.trim().replace(/。/g,".");return y(this.props.decimalSeparator)&&(M=M.replace(this.props.decimalSeparator,".")),M}},{key:"getValidValue",value:function(v){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,F=parseFloat(v);return isNaN(F)?v:(F<M&&(F=M),F>B&&(F=B),F)}},{key:"setValue",value:function(v,M){var B=this.props.precision,F=this.isNotCompleteNumber(parseFloat(v))?null:parseFloat(v),Q=this.state.value,G=Q===void 0?null:Q,W=this.state.inputValue,$=W===void 0?null:W,re=typeof F=="number"?F.toFixed(B):"".concat(F),ae=F!==G||re!=="".concat($);return"value"in this.props?($=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:$},M)):this.setState({value:F,inputValue:this.toPrecisionAsStep(v)},M),ae&&this.props.onChange(F),F}},{key:"getMaxPrecision",value:function(v){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,B=this.props,F=B.precision,Q=B.step;if(y(F))return F;var G=this.getPrecision(M),W=this.getPrecision(Q),$=this.getPrecision(v);return v?Math.max($,G+W):G+W}},{key:"getPrecisionFactor",value:function(v){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,B=this.getMaxPrecision(v,M);return Math.pow(10,B)}},{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(v){return this.props.formatter?this.props.formatter(v):v}},{key:"toPrecisionAsStep",value:function(v){if(this.isNotCompleteNumber(v)||v==="")return v;var M=Math.abs(this.getMaxPrecision(v));return isNaN(M)?v.toString():Number(v).toFixed(M)}},{key:"toNumber",value:function(v){var M=this.props.precision,B=this.state.focused,F=v&&v.length>16&&B;return this.isNotCompleteNumber(v)||F?v:y(M)?Math.round(v*Math.pow(10,M))/Math.pow(10,M):Number(v)}},{key:"upStep",value:function(v,M){var B=this.props.step,F=this.getPrecisionFactor(v,M),Q=Math.abs(this.getMaxPrecision(v,M)),G=((F*v+F*B*M)/F).toFixed(Q);return this.toNumber(G)}},{key:"downStep",value:function(v,M){var B=this.props.step,F=this.getPrecisionFactor(v,M),Q=Math.abs(this.getMaxPrecision(v,M)),G=((F*v-F*B*M)/F).toFixed(Q);return this.toNumber(G)}},{key:"step",value:function(v,M){var B=this,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,Q=arguments.length>3?arguments[3]:void 0;this.stop(),M&&(M.persist(),M.preventDefault());var G=this.props;if(G.disabled)return;var W=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(W))return;var $=this["".concat(v,"Step")](W,F),re=$>G.max||$<G.min;if($>G.max?$=G.max:$<G.min&&($=G.min),this.setValue($,null),this.setState({focused:!0},function(){B.pressingUpOrDown=!1}),re)return;this.autoStepTimer=setTimeout(function(){B[v](M,F,!0)},Q?c:O)}},{key:"fixCaret",value:function(v,M){if(v===void 0||M===void 0||!this.input||!this.input.value)return;try{var B=this.input.selectionStart,F=this.input.selectionEnd;(v!==B||M!==F)&&this.input.setSelectionRange(v,M)}catch(Q){}}},{key:"render",value:function(){var v,M=this.props,B=M.prefixCls,F=M.disabled,Q=M.readOnly,G=M.useTouch,W=M.autoComplete,$=M.upHandler,re=M.downHandler,ae=M.className,he=M.max,Te=M.min,ye=M.style,Ee=M.title,Oe=M.onMouseEnter,_e=M.onMouseLeave,fe=M.onMouseOver,le=M.onMouseOut,Me=M.required,ot=M.onClick,ut=M.tabIndex,rt=M.type,tt=M.placeholder,ze=M.id,$e=M.inputMode,ct=M.pattern,vt=M.step,at=M.maxLength,et=M.autoFocus,nt=M.name,Rt=M.onPaste,Ct=M.onInput,xt=Object(J.a)(M,["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"]),yt=this.state,wt=yt.value,Et=yt.focused,Se=f()(B,(v={},Object(K.a)(v,ae,!!ae),Object(K.a)(v,"".concat(B,"-disabled"),F),Object(K.a)(v,"".concat(B,"-focused"),Et),v)),xe={};Object.keys(xt).forEach(function(ue){(ue.substr(0,5)==="data-"||ue.substr(0,5)==="aria-"||ue==="role")&&(xe[ue]=xt[ue])});var Ke=!Q&&!F,Ve=this.getInputDisplayValue(null),De=(wt||wt===0)&&(isNaN(wt)||Number(wt)>=he),We=(wt||wt===0)&&(isNaN(wt)||Number(wt)<=Te),ge=De||F||Q,de=We||F||Q,ce=f()("".concat(B,"-handler"),"".concat(B,"-handler-up"),Object(K.a)({},"".concat(B,"-handler-up-disabled"),ge)),ne=f()("".concat(B,"-handler"),"".concat(B,"-handler-down"),Object(K.a)({},"".concat(B,"-handler-down-disabled"),de)),ie=G?{onTouchStart:ge?i:this.up,onTouchEnd:this.stop}:{onMouseDown:ge?i:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},oe=G?{onTouchStart:de?i:this.down,onTouchEnd:this.stop}:{onMouseDown:de?i:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return E.a.createElement("div",{className:Se,style:ye,title:Ee,onMouseEnter:Oe,onMouseLeave:_e,onMouseOver:fe,onMouseOut:le,onFocus:function(){return null},onBlur:function(){return null}},E.a.createElement("div",{className:"".concat(B,"-handler-wrap")},E.a.createElement("span",Object.assign({unselectable:"on"},ie,{role:"button","aria-label":"Increase Value","aria-disabled":ge,className:ce}),$||E.a.createElement("span",{unselectable:"on",className:"".concat(B,"-handler-up-inner"),onClick:a})),E.a.createElement("span",Object.assign({unselectable:"on"},oe,{role:"button","aria-label":"Decrease Value","aria-disabled":de,className:ne}),re||E.a.createElement("span",{unselectable:"on",className:"".concat(B,"-handler-down-inner"),onClick:a}))),E.a.createElement("div",{className:"".concat(B,"-input-wrap")},E.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Te,"aria-valuemax":he,"aria-valuenow":wt,required:Me,type:rt,placeholder:tt,onPaste:Rt,onClick:ot,onMouseUp:this.onMouseUp,className:"".concat(B,"-input"),tabIndex:ut,autoComplete:W,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Ke?this.onKeyDown:i,onKeyUp:Ke?this.onKeyUp:i,autoFocus:et,maxLength:at,readOnly:Q,disabled:F,max:he,min:Te,step:vt,name:nt,title:Ee,id:ze,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Ve),pattern:ct,inputMode:$e,onInput:Ct},xe))))}}]),w}(E.a.Component);_.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:b,min:-b,step:1,style:{},onChange:i,onKeyDown:i,onPressEnter:i,onFocus:i,onBlur:i,parser:u,required:!1,autoComplete:"off"};var h=_,d=Ce.a=h},f4xo:function(Fe,Ce,j){var J=j("nVVt");function K(R){this.mode=J.MODE_8BIT_BYTE,this.data=R}K.prototype={getLength:function(R){return this.data.length},write:function(R){for(var H=0;H<this.data.length;H++)R.put(this.data.charCodeAt(H),8)}},Fe.exports=K},fcSX:function(Fe,Ce,j){"use strict";var J=j("Ff2n"),K=j("1OyB"),R=j("vuIU"),H=j("Ji7U"),N=j("md7G"),x=j("foSv"),U=j("1W/9"),I=j("q1tI"),E=j("rePB"),L=j("JX7q"),f=j("TSYQ"),S=j.n(f),P=j("qx4F"),T=j("4IlW");function p(F){return Array.isArray(F)?F:[F]}var m={transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend"},i=Object.keys(m).filter(function(F){if(typeof document=="undefined")return!1;var Q=document.getElementsByTagName("html")[0];return F in(Q?Q.style:{})})[0],a=m[i];function u(F,Q,G,W){F.addEventListener?F.addEventListener(Q,G,W):F.attachEvent&&F.attachEvent("on".concat(Q),G)}function c(F,Q,G,W){F.removeEventListener?F.removeEventListener(Q,G,W):F.attachEvent&&F.detachEvent("on".concat(Q),G)}function O(F,Q){var G=typeof F=="function"?F(Q):F;return Array.isArray(G)?G.length===2?G:[G[0],G[1]]:[G]}var b=function(Q){return!isNaN(parseFloat(Q))&&isFinite(Q)},y=!(typeof window!="undefined"&&window.document&&window.document.createElement),D=function F(Q,G,W,$){if(!G||G===document||G instanceof Document)return!1;if(G===Q.parentNode)return!0;var re=Math.max(Math.abs(W),Math.abs($))===Math.abs($),ae=Math.max(Math.abs(W),Math.abs($))===Math.abs(W),he=G.scrollHeight-G.clientHeight,Te=G.scrollWidth-G.clientWidth,ye=document.defaultView.getComputedStyle(G),Ee=ye.overflowY==="auto"||ye.overflowY==="scroll",Oe=ye.overflowX==="auto"||ye.overflowX==="scroll",_e=he&&Ee,fe=Te&&Oe;return re&&(!_e||_e&&(G.scrollTop>=he&&$<0||G.scrollTop<=0&&$>0))||ae&&(!fe||fe&&(G.scrollLeft>=Te&&W<0||G.scrollLeft<=0&&W>0))?F(Q,G.parentNode,W,$):!1};function _(F){var Q=h();return function(){var W=Object(x.a)(F),$;if(Q){var re=Object(x.a)(this).constructor;$=Reflect.construct(W,arguments,re)}else $=W.apply(this,arguments);return Object(N.a)(this,$)}}function h(){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(F){return!1}}var d={},o=function(F){Object(H.a)(G,F);var Q=_(G);function G(W){var $;return Object(K.a)(this,G),$=Q.call(this,W),$.domFocus=function(){$.dom&&$.dom.focus()},$.removeStartHandler=function(re){if(re.touches.length>1)return;$.startPos={x:re.touches[0].clientX,y:re.touches[0].clientY}},$.removeMoveHandler=function(re){if(re.changedTouches.length>1)return;var ae=re.currentTarget,he=re.changedTouches[0].clientX-$.startPos.x,Te=re.changedTouches[0].clientY-$.startPos.y;(ae===$.maskDom||ae===$.handlerDom||ae===$.contentDom&&D(ae,re.target,he,Te))&&re.cancelable&&re.preventDefault()},$.transitionEnd=function(re){var ae=re.target;c(ae,a,$.transitionEnd),ae.style.transition=""},$.onKeyDown=function(re){if(re.keyCode===T.a.ESC){var ae=$.props.onClose;re.stopPropagation(),ae&&ae(re)}},$.onWrapperTransitionEnd=function(re){var ae=$.props,he=ae.open,Te=ae.afterVisibleChange;re.target===$.contentWrapper&&re.propertyName.match(/transform$/)&&($.dom.style.transition="",!he&&$.getCurrentDrawerSome()&&(document.body.style.overflowX="",$.maskDom&&($.maskDom.style.left="",$.maskDom.style.width="")),Te&&Te(!!he))},$.openLevelTransition=function(){var re=$.props,ae=re.open,he=re.width,Te=re.height,ye=$.getHorizontalBoolAndPlacementName(),Ee=ye.isHorizontal,Oe=ye.placementName,_e=$.contentDom?$.contentDom.getBoundingClientRect()[Ee?"width":"height"]:0,fe=(Ee?he:Te)||_e;$.setLevelAndScrolling(ae,Oe,fe)},$.setLevelTransform=function(re,ae,he,Te){var ye=$.props,Ee=ye.placement,Oe=ye.levelMove,_e=ye.duration,fe=ye.ease,le=ye.showMask;$.levelDom.forEach(function(Me){Me.style.transition="transform ".concat(_e," ").concat(fe),u(Me,a,$.transitionEnd);var ot=re?he:0;if(Oe){var ut=O(Oe,{target:Me,open:re});ot=re?ut[0]:ut[1]||0}var rt=typeof ot=="number"?"".concat(ot,"px"):ot,tt=Ee==="left"||Ee==="top"?rt:"-".concat(rt);tt=le&&Ee==="right"&&Te?"calc(".concat(tt," + ").concat(Te,"px)"):tt,Me.style.transform=ot?"".concat(ae,"(").concat(tt,")"):""})},$.setLevelAndScrolling=function(re,ae,he){var Te=$.props.onChange;if(!y){var ye=document.body.scrollHeight>(window.innerHeight||document.documentElement.clientHeight)&&window.innerWidth>document.body.offsetWidth?Object(P.a)(!0):0;$.setLevelTransform(re,ae,he,ye),$.toggleScrollingToDrawerAndBody(ye)}Te&&Te(re)},$.toggleScrollingToDrawerAndBody=function(re){var ae=$.props,he=ae.getOpenCount,Te=ae.getContainer,ye=ae.showMask,Ee=ae.open,Oe=Te&&Te(),_e=he&&he();if(Oe&&Oe.parentNode===document.body&&ye){var fe=["touchstart"],le=[document.body,$.maskDom,$.handlerDom,$.contentDom];Ee&&document.body.style.overflow!=="hidden"?(re&&$.addScrollingEffect(re),_e===1&&(document.body.style.overflow="hidden"),document.body.style.touchAction="none",le.forEach(function(Me,ot){if(!Me)return;u(Me,fe[ot]||"touchmove",ot?$.removeMoveHandler:$.removeStartHandler,$.passive)})):$.getCurrentDrawerSome()&&(_e||(document.body.style.overflow=""),document.body.style.touchAction="",re&&$.remScrollingEffect(re),le.forEach(function(Me,ot){if(!Me)return;c(Me,fe[ot]||"touchmove",ot?$.removeMoveHandler:$.removeStartHandler,$.passive)}))}},$.addScrollingEffect=function(re){var ae=$.props,he=ae.placement,Te=ae.duration,ye=ae.ease,Ee=ae.getOpenCount,Oe=ae.switchScrollingEffect,_e=Ee&&Ee();_e===1&&Oe();var fe="width ".concat(Te," ").concat(ye),le="transform ".concat(Te," ").concat(ye);$.dom.style.transition="none";switch(he){case"right":$.dom.style.transform="translateX(-".concat(re,"px)");break;case"top":case"bottom":$.dom.style.width="calc(100% - ".concat(re,"px)"),$.dom.style.transform="translateZ(0)";break;default:break}clearTimeout($.timeout),$.timeout=setTimeout(function(){$.dom&&($.dom.style.transition="".concat(le,",").concat(fe),$.dom.style.width="",$.dom.style.transform="")})},$.remScrollingEffect=function(re){var ae=$.props,he=ae.placement,Te=ae.duration,ye=ae.ease,Ee=ae.getOpenCount,Oe=ae.switchScrollingEffect,_e=Ee&&Ee();_e||Oe(!0),i&&(document.body.style.overflowX="hidden"),$.dom.style.transition="none";var fe,le="width ".concat(Te," ").concat(ye),Me="transform ".concat(Te," ").concat(ye);switch(he){case"left":{$.dom.style.width="100%",le="width 0s ".concat(ye," ").concat(Te);break}case"right":{$.dom.style.transform="translateX(".concat(re,"px)"),$.dom.style.width="100%",le="width 0s ".concat(ye," ").concat(Te),$.maskDom&&($.maskDom.style.left="-".concat(re,"px"),$.maskDom.style.width="calc(100% + ".concat(re,"px)"));break}case"top":case"bottom":{$.dom.style.width="calc(100% + ".concat(re,"px)"),$.dom.style.height="100%",$.dom.style.transform="translateZ(0)",fe="height 0s ".concat(ye," ").concat(Te);break}default:break}clearTimeout($.timeout),$.timeout=setTimeout(function(){$.dom&&($.dom.style.transition="".concat(Me,",").concat(fe?"".concat(fe,","):"").concat(le),$.dom.style.transform="",$.dom.style.width="",$.dom.style.height="")})},$.getCurrentDrawerSome=function(){return!Object.keys(d).some(function(re){return d[re]})},$.getLevelDom=function(re){var ae=re.level,he=re.getContainer;if(y)return;var Te=he&&he(),ye=Te?Te.parentNode:null;if($.levelDom=[],ae==="all"){var Ee=ye?Array.prototype.slice.call(ye.children):[];Ee.forEach(function(Oe){Oe.nodeName!=="SCRIPT"&&Oe.nodeName!=="STYLE"&&Oe.nodeName!=="LINK"&&Oe!==Te&&$.levelDom.push(Oe)})}else ae&&p(ae).forEach(function(Oe){document.querySelectorAll(Oe).forEach(function(_e){$.levelDom.push(_e)})})},$.getHorizontalBoolAndPlacementName=function(){var re=$.props.placement,ae=re==="left"||re==="right",he="translate".concat(ae?"X":"Y");return{isHorizontal:ae,placementName:he}},$.state={_self:Object(L.a)($)},$}return Object(R.a)(G,[{key:"componentDidMount",value:function(){var $=this;if(!y){var re=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){return re=!0,null}}))}catch(Ee){}this.passive=re?{passive:!1}:!1}var ae=this.props,he=ae.open,Te=ae.getContainer,ye=Te&&Te();this.drawerId="drawer_id_".concat(Number((Date.now()+Math.random()).toString().replace(".",Math.round(Math.random()*9).toString())).toString(16)),this.getLevelDom(this.props),he&&(ye&&ye.parentNode===document.body&&(d[this.drawerId]=he),this.openLevelTransition(),this.forceUpdate(function(){$.domFocus()}))}},{key:"componentDidUpdate",value:function($){var re=this.props,ae=re.open,he=re.getContainer,Te=he&&he();ae!==$.open&&(ae&&this.domFocus(),Te&&Te.parentNode===document.body&&(d[this.drawerId]=!!ae),this.openLevelTransition())}},{key:"componentWillUnmount",value:function(){var $=this.props,re=$.getOpenCount,ae=$.open,he=$.switchScrollingEffect,Te=typeof re=="function"&&re();delete d[this.drawerId],ae&&(this.setLevelTransform(!1),document.body.style.touchAction=""),Te||(document.body.style.overflow="",he(!0))}},{key:"render",value:function(){var $,re=this,ae=this.props,he=ae.className,Te=ae.children,ye=ae.style,Ee=ae.width,Oe=ae.height,_e=ae.defaultOpen,fe=ae.open,le=ae.prefixCls,Me=ae.placement,ot=ae.level,ut=ae.levelMove,rt=ae.ease,tt=ae.duration,ze=ae.getContainer,$e=ae.handler,ct=ae.onChange,vt=ae.afterVisibleChange,at=ae.showMask,et=ae.maskClosable,nt=ae.maskStyle,Rt=ae.onClose,Ct=ae.onHandleClick,xt=ae.keyboard,yt=ae.getOpenCount,wt=ae.switchScrollingEffect,Et=Object(J.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"]),Se=this.dom?fe:!1,xe=S()(le,($={},Object(E.a)($,"".concat(le,"-").concat(Me),!0),Object(E.a)($,"".concat(le,"-open"),Se),Object(E.a)($,he||"",!!he),Object(E.a)($,"no-mask",!at),$)),Ke=this.getHorizontalBoolAndPlacementName(),Ve=Ke.placementName,De=Me==="left"||Me==="top"?"-100%":"100%",We=Se?"":"".concat(Ve,"(").concat(De,")"),ge=$e&&I.cloneElement($e,{onClick:function(ce){$e.props.onClick&&$e.props.onClick(),Ct&&Ct(ce)},ref:function(ce){re.handlerDom=ce}});return I.createElement("div",Object.assign({},Et,{tabIndex:-1,className:xe,style:ye,ref:function(ce){re.dom=ce},onKeyDown:Se&&xt?this.onKeyDown:void 0,onTransitionEnd:this.onWrapperTransitionEnd}),at&&I.createElement("div",{className:"".concat(le,"-mask"),onClick:et?Rt:void 0,style:nt,ref:function(ce){re.maskDom=ce}}),I.createElement("div",{className:"".concat(le,"-content-wrapper"),style:{transform:We,msTransform:We,width:b(Ee)?"".concat(Ee,"px"):Ee,height:b(Oe)?"".concat(Oe,"px"):Oe},ref:function(ce){re.contentWrapper=ce}},I.createElement("div",{className:"".concat(le,"-content"),ref:function(ce){re.contentDom=ce},onTouchStart:Se&&at?this.removeStartHandler:void 0,onTouchMove:Se&&at?this.removeMoveHandler:void 0},Te),ge))}}],[{key:"getDerivedStateFromProps",value:function($,re){var ae=re.prevProps,he=re._self,Te={prevProps:$};if(ae!==void 0){var ye=$.placement,Ee=$.level;ye!==ae.placement&&(he.contentDom=null),Ee!==ae.level&&he.getLevelDom($)}return Te}}]),G}(I.Component);o.defaultProps={switchScrollingEffect:function(){}};var s=o;function w(F){var Q=C();return function(){var W=Object(x.a)(F),$;if(Q){var re=Object(x.a)(this).constructor;$=Reflect.construct(W,arguments,re)}else $=W.apply(this,arguments);return Object(N.a)(this,$)}}function C(){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(F){return!1}}var v=function(F){Object(H.a)(G,F);var Q=w(G);function G(W){var $;Object(K.a)(this,G),$=Q.call(this,W),$.onHandleClick=function(ae){var he=$.props,Te=he.onHandleClick,ye=he.open;if(Te&&Te(ae),typeof ye=="undefined"){var Ee=$.state.open;$.setState({open:!Ee})}},$.onClose=function(ae){var he=$.props,Te=he.onClose,ye=he.open;Te&&Te(ae),typeof ye=="undefined"&&$.setState({open:!1})};var re=typeof W.open!="undefined"?W.open:!!W.defaultOpen;return $.state={open:re},"onMaskClick"in W&&console.warn("`onMaskClick` are removed, please use `onClose` instead."),$}return Object(R.a)(G,[{key:"render",value:function(){var $=this,re=this.props,ae=re.defaultOpen,he=re.getContainer,Te=re.wrapperClassName,ye=re.forceRender,Ee=re.handler,Oe=Object(J.a)(re,["defaultOpen","getContainer","wrapperClassName","forceRender","handler"]),_e=this.state.open;if(!he)return I.createElement("div",{className:Te,ref:function(Me){$.dom=Me}},I.createElement(s,Object.assign({},Oe,{open:_e,handler:Ee,getContainer:function(){return $.dom},onClose:this.onClose,onHandleClick:this.onHandleClick})));var fe=!!Ee||ye;return I.createElement(U.a,{visible:_e,forceRender:fe,getContainer:he,wrapperClassName:Te},function(le){var Me=le.visible,ot=le.afterClose,ut=Object(J.a)(le,["visible","afterClose"]);return I.createElement(s,Object.assign({},Oe,ut,{open:Me!==void 0?Me:_e,afterVisibleChange:ot!==void 0?ot:Oe.afterVisibleChange,handler:Ee,onClose:$.onClose,onHandleClick:$.onHandleClick}))})}}],[{key:"getDerivedStateFromProps",value:function($,re){var ae=re.prevProps,he={prevProps:$};return typeof ae!="undefined"&&$.open!==ae.open&&(he.open=$.open),he}}]),G}(I.Component);v.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:I.createElement("div",{className:"drawer-handle"},I.createElement("i",{className:"drawer-handle-icon"})),showMask:!0,maskClosable:!0,maskStyle:{},wrapperClassName:"",className:"",keyboard:!0,forceRender:!1};var M=v,B=Ce.a=M},fcyK:function(Fe,Ce,j){},fyJ8:function(Fe,Ce,j){"use strict";var J=j("rePB"),K=j("VTBJ"),R=j("Ff2n"),H=j("U8pU"),N=j("q1tI"),x=j.n(N),U=j("TSYQ"),I=j.n(U),E=j("c+Xe"),L=j("sR1s");function f(m){return m&&Object(H.a)(m)==="object"&&!Array.isArray(m)&&!N.isValidElement(m)}function S(m){return typeof m=="string"?!0:Object(E.c)(m)}function P(m,i){var a,u=m.prefixCls,c=m.className,O=m.record,b=m.index,y=m.dataIndex,D=m.render,_=m.children,h=m.component,d=h===void 0?"td":h,o=m.colSpan,s=m.rowSpan,w=m.fixLeft,C=m.fixRight,v=m.firstFixLeft,M=m.lastFixLeft,B=m.firstFixRight,F=m.lastFixRight,Q=m.appendNode,G=m.additionalProps,W=G===void 0?{}:G,$=m.ellipsis,re=m.align,ae=m.rowType,he=m.isSticky,Te="".concat(u,"-cell"),ye,Ee;if(_)Ee=_;else{var Oe=Object(L.b)(O,y);if(Ee=Oe,D){var _e=D(Oe,O,b);f(_e)?(Ee=_e.children,ye=_e.props):Ee=_e}}Object(H.a)(Ee)==="object"&&!Array.isArray(Ee)&&!N.isValidElement(Ee)&&(Ee=null),$&&(M||B)&&(Ee=N.createElement("span",{className:"".concat(Te,"-content")},Ee));var fe=ye||{},le=fe.colSpan,Me=fe.rowSpan,ot=fe.style,ut=fe.className,rt=Object(R.a)(fe,["colSpan","rowSpan","style","className"]),tt=le!==void 0?le:o,ze=Me!==void 0?Me:s;if(tt===0||ze===0)return null;var $e={},ct=typeof w=="number",vt=typeof C=="number";ct&&($e.position="sticky",$e.left=w),vt&&($e.position="sticky",$e.right=C);var at={};re&&(at.textAlign=re);var et,nt=$===!0?{showTitle:!0}:$;nt&&(nt.showTitle||ae==="header")&&(typeof Ee=="string"||typeof Ee=="number"?et=Ee.toString():N.isValidElement(Ee)&&typeof Ee.props.children=="string"&&(et=Ee.props.children));var Rt=Object(K.a)(Object(K.a)(Object(K.a)({title:et},rt),W),{},{colSpan:tt&&tt!==1?tt:null,rowSpan:ze&&ze!==1?ze:null,className:I()(Te,c,(a={},Object(J.a)(a,"".concat(Te,"-fix-left"),ct),Object(J.a)(a,"".concat(Te,"-fix-left-first"),v),Object(J.a)(a,"".concat(Te,"-fix-left-last"),M),Object(J.a)(a,"".concat(Te,"-fix-right"),vt),Object(J.a)(a,"".concat(Te,"-fix-right-first"),B),Object(J.a)(a,"".concat(Te,"-fix-right-last"),F),Object(J.a)(a,"".concat(Te,"-ellipsis"),$),Object(J.a)(a,"".concat(Te,"-with-append"),Q),Object(J.a)(a,"".concat(Te,"-fix-sticky"),(ct||vt)&&he),a),W.className,ut),style:Object(K.a)(Object(K.a)(Object(K.a)(Object(K.a)({},W.style),at),$e),ot),ref:S(d)?i:null});return N.createElement(d,Object.assign({},Rt),Q,Ee)}var T=N.forwardRef(P);T.displayName="Cell";var p=N.memo(T,function(m,i){return i.shouldCellUpdate?!i.shouldCellUpdate(i.record,m.record):!1});Ce.a=p},gRFJ:function(Fe,Ce,j){Fe.exports=[j("rdUC"),j("ynwM"),j("RELg"),j("DlR+"),j("CrYA"),j("PD8m")]},gaXo:function(module,exports){typeof JSON!="object"&&(JSON={}),function(){"use strict";var rx_one=/^[\],:{}\s]*$/,rx_two=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rx_three=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rx_four=/(?:^|:|,)(?:\s*\[)+/g,rx_escapable=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,rx_dangerous=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;function f(Fe){return Fe<10?"0"+Fe:Fe}function this_value(){return this.valueOf()}typeof Date.prototype.toJSON!="function"&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},Boolean.prototype.toJSON=this_value,Number.prototype.toJSON=this_value,String.prototype.toJSON=this_value);var gap,indent,meta,rep;function quote(Fe){return rx_escapable.lastIndex=0,rx_escapable.test(Fe)?'"'+Fe.replace(rx_escapable,function(Ce){var j=meta[Ce];return typeof j=="string"?j:"\\u"+("0000"+Ce.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+Fe+'"'}function str(Fe,Ce){var j,J,K,R,H=gap,N,x=Ce[Fe];x&&typeof x=="object"&&typeof x.toJSON=="function"&&(x=x.toJSON(Fe)),typeof rep=="function"&&(x=rep.call(Ce,Fe,x));switch(typeof x){case"string":return quote(x);case"number":return isFinite(x)?String(x):"null";case"boolean":case"null":return String(x);case"object":if(!x)return"null";if(gap+=indent,N=[],Object.prototype.toString.apply(x)==="[object Array]"){for(R=x.length,j=0;j<R;j+=1)N[j]=str(j,x)||"null";return K=N.length===0?"[]":gap?`[
|
|
`+gap+N.join(`,
|
|
`+gap)+`
|
|
`+H+"]":"["+N.join(",")+"]",gap=H,K}if(rep&&typeof rep=="object")for(R=rep.length,j=0;j<R;j+=1)typeof rep[j]=="string"&&(J=rep[j],K=str(J,x),K&&N.push(quote(J)+(gap?": ":":")+K));else for(J in x)Object.prototype.hasOwnProperty.call(x,J)&&(K=str(J,x),K&&N.push(quote(J)+(gap?": ":":")+K));return K=N.length===0?"{}":gap?`{
|
|
`+gap+N.join(`,
|
|
`+gap)+`
|
|
`+H+"}":"{"+N.join(",")+"}",gap=H,K}}typeof JSON.stringify!="function"&&(meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},JSON.stringify=function(Fe,Ce,j){var J;if(gap="",indent="",typeof j=="number")for(J=0;J<j;J+=1)indent+=" ";else typeof j=="string"&&(indent=j);if(rep=Ce,Ce&&typeof Ce!="function"&&(typeof Ce!="object"||typeof Ce.length!="number"))throw new Error("JSON.stringify");return str("",{"":Fe})}),typeof JSON.parse!="function"&&(JSON.parse=function(text,reviver){var j;function walk(Fe,Ce){var j,J,K=Fe[Ce];if(K&&typeof K=="object")for(j in K)Object.prototype.hasOwnProperty.call(K,j)&&(J=walk(K,j),J!==void 0?K[j]=J:delete K[j]);return reviver.call(Fe,Ce,K)}if(text=String(text),rx_dangerous.lastIndex=0,rx_dangerous.test(text)&&(text=text.replace(rx_dangerous,function(Fe){return"\\u"+("0000"+Fe.charCodeAt(0).toString(16)).slice(-4)})),rx_one.test(text.replace(rx_two,"@").replace(rx_three,"]").replace(rx_four,"")))return j=eval("("+text+")"),typeof reviver=="function"?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}()},hW8S:function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return H}),j.d(Ce,"c",function(){return N}),j.d(Ce,"b",function(){return x});var J=j("VTBJ"),K=j("Ff2n"),R=j("Kwbf"),H="RC_TABLE_INTERNAL_COL_DEFINE";function N(U){var I=U.expandable,E=Object(K.a)(U,["expandable"]);return"expandable"in U?Object(J.a)(Object(J.a)({},E),I):E}function x(U){return Object.keys(U).reduce(function(I,E){return(E.substr(0,5)==="data-"||E.substr(0,5)==="aria-")&&(I[E]=U[E]),I},{})}},i3hx:function(Fe,Ce,j){},je13:function(Fe,Ce,j){var J=j("5nXd"),K=j("gRFJ"),R=[j("uQRt")];Fe.exports=J.createStore(K,R)},kSUc:function(Fe,Ce,j){},"kaH+":function(Fe,Ce,j){"use strict";var J=j("+L6B"),K=j("2/Rp"),R=j("tJVT"),H=j("q1tI"),N=j.n(H),x=j("UZu5"),U=j.n(x),I=j("dhSg"),E=j("rLCj"),L=j("dF/Y"),f=j("4i/N");Ce.a=function(){var S=Object(H.useState)(""),P=Object(R.a)(S,2),T=P[0],p=P[1],m=Object(H.useState)(0),i=Object(R.a)(m,2),a=i[0],u=i[1],c=Object(H.useRef)("");Object(H.useEffect)(function(){var D=I.a.subscribe("preview-image",function(_){p(_),document.body.style.overflow="hidden"});return D},[]),Object(H.useEffect)(function(){return document.addEventListener("keydown",O),function(){document.removeEventListener("keydown",O)}},[]),Object(H.useEffect)(function(){c.current=T},[T]);function O(D){D.keyCode==27&&c.current&&b()}function b(){document.body.style.overflow="auto",p("")}function y(){u(a+90)}return N.a.createElement(H.Fragment,null,T?N.a.createElement("div",{className:"image-preview-container"},N.a.createElement("div",{className:"button-group"},N.a.createElement(K.a,{onClick:y},"\u65CB\u8F6C",N.a.createElement(E.a,null)),N.a.createElement(K.a,{href:T},"\u4E0B\u8F7D",N.a.createElement(L.a,null)),N.a.createElement(K.a,{onClick:b},"\u5173\u95ED",N.a.createElement(f.a,null))),N.a.createElement("div",{className:"preview-wrp-group"},N.a.createElement("img",{className:"image-preview",src:T,alt:"\u9884\u89C8\u5927\u56FE",style:{transform:"rotate(".concat(a,"deg)")}}))):null)}},lOMy:function(Fe,Ce,j){},lZu9:function(Fe,Ce,j){(function(J){J(j("VrN/"),j("1eCo"),j("8EBN"))})(function(J){"use strict";J.defineMode("markdown",function(K,R){var H=J.getMode(K,"text/html"),N=H.name=="null";function x(G){if(J.findModeByName){var W=J.findModeByName(G);W&&(G=W.mime||W.mimes[0])}var $=J.getMode(K,G);return $.name=="null"?null:$}R.highlightFormatting===void 0&&(R.highlightFormatting=!1),R.maxBlockquoteDepth===void 0&&(R.maxBlockquoteDepth=0),R.taskLists===void 0&&(R.taskLists=!1),R.strikethrough===void 0&&(R.strikethrough=!1),R.emoji===void 0&&(R.emoji=!1),R.fencedCodeBlockHighlighting===void 0&&(R.fencedCodeBlockHighlighting=!0),R.fencedCodeBlockDefaultMode===void 0&&(R.fencedCodeBlockDefaultMode="text/plain"),R.xml===void 0&&(R.xml=!0),R.tokenTypeOverrides===void 0&&(R.tokenTypeOverrides={});var U={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 I in U)U.hasOwnProperty(I)&&R.tokenTypeOverrides[I]&&(U[I]=R.tokenTypeOverrides[I]);var E=/^([*\-_])(?:\s*\1){2,}\s*$/,L=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,f=/^\[(x| )\](?=\s)/i,S=R.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,P=/^ {0,3}(?:\={1,}|-{2,})\s*$/,T=/^[^#!\[\]*_\\<>` "'(~:]+/,p=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,m=/^\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]/,a=" ";function u(G,W,$){return W.f=W.inline=$,$(G,W)}function c(G,W,$){return W.f=W.block=$,$(G,W)}function O(G){return!G||!/\S/.test(G.string)}function b(G){if(G.linkTitle=!1,G.linkHref=!1,G.linkText=!1,G.em=!1,G.strong=!1,G.strikethrough=!1,G.quote=0,G.indentedCode=!1,G.f==D){var W=N;if(!W){var $=J.innerMode(H,G.htmlState);W=$.mode.name=="xml"&&$.state.tagStart===null&&!$.state.context&&$.state.tokenize.isInText}W&&(G.f=o,G.block=y,G.htmlState=null)}return G.trailingSpace=0,G.trailingSpaceNewLine=!1,G.prevLine=G.thisLine,G.thisLine={stream:null},null}function y(G,W){var $=G.column()===W.indentation,re=O(W.prevLine.stream),ae=W.indentedCode,he=W.prevLine.hr,Te=W.list!==!1,ye=(W.listStack[W.listStack.length-1]||0)+3;W.indentedCode=!1;var Ee=W.indentation;if(W.indentationDiff===null&&(W.indentationDiff=W.indentation,Te)){for(W.list=null;Ee<W.listStack[W.listStack.length-1];)W.listStack.pop(),W.listStack.length?W.indentation=W.listStack[W.listStack.length-1]:W.list=!1;W.list!==!1&&(W.indentationDiff=Ee-W.listStack[W.listStack.length-1])}var Oe=!re&&!he&&!W.prevLine.header&&(!Te||!ae)&&!W.prevLine.fencedCodeEnd,_e=(W.list===!1||he||re)&&W.indentation<=ye&&G.match(E),fe=null;if(W.indentationDiff>=4&&(ae||W.prevLine.fencedCodeEnd||W.prevLine.header||re))return G.skipToEnd(),W.indentedCode=!0,U.code;if(G.eatSpace())return null;if($&&W.indentation<=ye&&(fe=G.match(S))&&fe[1].length<=6)return W.quote=0,W.header=fe[1].length,W.thisLine.header=!0,R.highlightFormatting&&(W.formatting="header"),W.f=W.inline,h(W);if(W.indentation<=ye&&G.eat(">"))return W.quote=$?1:W.quote+1,R.highlightFormatting&&(W.formatting="quote"),G.eatSpace(),h(W);if(!_e&&!W.setext&&$&&W.indentation<=ye&&(fe=G.match(L))){var le=fe[1]?"ol":"ul";return W.indentation=Ee+G.current().length,W.list=!0,W.quote=0,W.listStack.push(W.indentation),W.em=!1,W.strong=!1,W.code=!1,W.strikethrough=!1,R.taskLists&&G.match(f,!1)&&(W.taskList=!0),W.f=W.inline,R.highlightFormatting&&(W.formatting=["list","list-"+le]),h(W)}else{if($&&W.indentation<=ye&&(fe=G.match(p,!0)))return W.quote=0,W.fencedEndRE=new RegExp(fe[1]+"+ *$"),W.localMode=R.fencedCodeBlockHighlighting&&x(fe[2]||R.fencedCodeBlockDefaultMode),W.localMode&&(W.localState=J.startState(W.localMode)),W.f=W.block=_,R.highlightFormatting&&(W.formatting="code-block"),W.code=-1,h(W);if(W.setext||(!Oe||!Te)&&!W.quote&&W.list===!1&&!W.code&&!_e&&!m.test(G.string)&&(fe=G.lookAhead(1))&&(fe=fe.match(P)))return W.setext?(W.header=W.setext,W.setext=0,G.skipToEnd(),R.highlightFormatting&&(W.formatting="header")):(W.header=fe[0].charAt(0)=="="?1:2,W.setext=W.header),W.thisLine.header=!0,W.f=W.inline,h(W);if(_e)return G.skipToEnd(),W.hr=!0,W.thisLine.hr=!0,U.hr;if(G.peek()==="[")return u(G,W,M)}return u(G,W,W.inline)}function D(G,W){var $=H.token(G,W.htmlState);if(!N){var re=J.innerMode(H,W.htmlState);(re.mode.name=="xml"&&re.state.tagStart===null&&!re.state.context&&re.state.tokenize.isInText||W.md_inside&&G.current().indexOf(">")>-1)&&(W.f=o,W.block=y,W.htmlState=null)}return $}function _(G,W){var $=W.listStack[W.listStack.length-1]||0,re=W.indentation<$,ae=$+3;if(W.fencedEndRE&&W.indentation<=ae&&(re||G.match(W.fencedEndRE))){R.highlightFormatting&&(W.formatting="code-block");var he;return re||(he=h(W)),W.localMode=W.localState=null,W.block=y,W.f=o,W.fencedEndRE=null,W.code=0,W.thisLine.fencedCodeEnd=!0,re?c(G,W,W.block):he}else return W.localMode?W.localMode.token(G,W.localState):(G.skipToEnd(),U.code)}function h(G){var W=[];if(G.formatting){W.push(U.formatting),typeof G.formatting=="string"&&(G.formatting=[G.formatting]);for(var $=0;$<G.formatting.length;$++)W.push(U.formatting+"-"+G.formatting[$]),G.formatting[$]==="header"&&W.push(U.formatting+"-"+G.formatting[$]+"-"+G.header),G.formatting[$]==="quote"&&(!R.maxBlockquoteDepth||R.maxBlockquoteDepth>=G.quote?W.push(U.formatting+"-"+G.formatting[$]+"-"+G.quote):W.push("error"))}if(G.taskOpen)return W.push("meta"),W.length?W.join(" "):null;if(G.taskClosed)return W.push("property"),W.length?W.join(" "):null;if(G.linkHref?W.push(U.linkHref,"url"):(G.strong&&W.push(U.strong),G.em&&W.push(U.em),G.strikethrough&&W.push(U.strikethrough),G.emoji&&W.push(U.emoji),G.linkText&&W.push(U.linkText),G.code&&W.push(U.code),G.image&&W.push(U.image),G.imageAltText&&W.push(U.imageAltText,"link"),G.imageMarker&&W.push(U.imageMarker)),G.header&&W.push(U.header,U.header+"-"+G.header),G.quote&&(W.push(U.quote),!R.maxBlockquoteDepth||R.maxBlockquoteDepth>=G.quote?W.push(U.quote+"-"+G.quote):W.push(U.quote+"-"+R.maxBlockquoteDepth)),G.list!==!1){var re=(G.listStack.length-1)%3;re?re===1?W.push(U.list2):W.push(U.list3):W.push(U.list1)}return G.trailingSpaceNewLine?W.push("trailing-space-new-line"):G.trailingSpace&&W.push("trailing-space-"+(G.trailingSpace%2?"a":"b")),W.length?W.join(" "):null}function d(G,W){return G.match(T,!0)?h(W):void 0}function o(G,W){var $=W.text(G,W);if(typeof $!="undefined")return $;if(W.list)return W.list=null,h(W);if(W.taskList){var re=G.match(f,!0)[1]===" ";return re?W.taskOpen=!0:W.taskClosed=!0,R.highlightFormatting&&(W.formatting="task"),W.taskList=!1,h(W)}if(W.taskOpen=!1,W.taskClosed=!1,W.header&&G.match(/^#+$/,!0))return R.highlightFormatting&&(W.formatting="header"),h(W);var ae=G.next();if(W.linkTitle){W.linkTitle=!1;var he=ae;ae==="("&&(he=")"),he=(he+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Te="^\\s*(?:[^"+he+"\\\\]+|\\\\\\\\|\\\\.)"+he;if(G.match(new RegExp(Te),!0))return U.linkHref}if(ae==="`"){var ye=W.formatting;R.highlightFormatting&&(W.formatting="code"),G.eatWhile("`");var Ee=G.current().length;if(W.code==0&&(!W.quote||Ee==1))return W.code=Ee,h(W);if(Ee==W.code){var Oe=h(W);return W.code=0,Oe}else return W.formatting=ye,h(W)}else if(W.code)return h(W);if(ae==="\\"&&(G.next(),R.highlightFormatting)){var _e=h(W),fe=U.formatting+"-escape";return _e?_e+" "+fe:fe}if(ae==="!"&&G.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return W.imageMarker=!0,W.image=!0,R.highlightFormatting&&(W.formatting="image"),h(W);if(ae==="["&&W.imageMarker&&G.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return W.imageMarker=!1,W.imageAltText=!0,R.highlightFormatting&&(W.formatting="image"),h(W);if(ae==="]"&&W.imageAltText){R.highlightFormatting&&(W.formatting="image");var _e=h(W);return W.imageAltText=!1,W.image=!1,W.inline=W.f=w,_e}if(ae==="["&&!W.image)return W.linkText&&G.match(/^.*?\]/)||(W.linkText=!0,R.highlightFormatting&&(W.formatting="link")),h(W);if(ae==="]"&&W.linkText){R.highlightFormatting&&(W.formatting="link");var _e=h(W);return W.linkText=!1,W.inline=W.f=G.match(/\(.*?\)| ?\[.*?\]/,!1)?w:o,_e}if(ae==="<"&&G.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){W.f=W.inline=s,R.highlightFormatting&&(W.formatting="link");var _e=h(W);return _e?_e+=" ":_e="",_e+U.linkInline}if(ae==="<"&&G.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){W.f=W.inline=s,R.highlightFormatting&&(W.formatting="link");var _e=h(W);return _e?_e+=" ":_e="",_e+U.linkEmail}if(R.xml&&ae==="<"&&G.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var le=G.string.indexOf(">",G.pos);if(le!=-1){var Me=G.string.substring(G.start,le);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Me)&&(W.md_inside=!0)}return G.backUp(1),W.htmlState=J.startState(H),c(G,W,D)}if(R.xml&&ae==="<"&&G.match(/^\/\w*?>/))return W.md_inside=!1,"tag";if(ae==="*"||ae==="_"){for(var ot=1,ut=G.pos==1?" ":G.string.charAt(G.pos-2);ot<3&&G.eat(ae);)ot++;var rt=G.peek()||" ",tt=!/\s/.test(rt)&&(!i.test(rt)||/\s/.test(ut)||i.test(ut)),ze=!/\s/.test(ut)&&(!i.test(ut)||/\s/.test(rt)||i.test(rt)),$e=null,ct=null;if(ot%2&&(!W.em&&tt&&(ae==="*"||!ze||i.test(ut))?$e=!0:W.em==ae&&ze&&(ae==="*"||!tt||i.test(rt))&&($e=!1)),ot>1&&(!W.strong&&tt&&(ae==="*"||!ze||i.test(ut))?ct=!0:W.strong==ae&&ze&&(ae==="*"||!tt||i.test(rt))&&(ct=!1)),ct!=null||$e!=null){R.highlightFormatting&&(W.formatting=$e==null?"strong":ct==null?"em":"strong em"),$e===!0&&(W.em=ae),ct===!0&&(W.strong=ae);var Oe=h(W);return $e===!1&&(W.em=!1),ct===!1&&(W.strong=!1),Oe}}else if(ae===" "&&(G.eat("*")||G.eat("_"))){if(G.peek()===" ")return h(W);G.backUp(1)}if(R.strikethrough){if(ae==="~"&&G.eatWhile(ae)){if(W.strikethrough){R.highlightFormatting&&(W.formatting="strikethrough");var Oe=h(W);return W.strikethrough=!1,Oe}else if(G.match(/^[^\s]/,!1))return W.strikethrough=!0,R.highlightFormatting&&(W.formatting="strikethrough"),h(W)}else if(ae===" "&&G.match(/^~~/,!0)){if(G.peek()===" ")return h(W);G.backUp(2)}}if(R.emoji&&ae===":"&&G.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){W.emoji=!0,R.highlightFormatting&&(W.formatting="emoji");var vt=h(W);return W.emoji=!1,vt}return ae===" "&&(G.match(/^ +$/,!1)?W.trailingSpace++:W.trailingSpace&&(W.trailingSpaceNewLine=!0)),h(W)}function s(G,W){var $=G.next();if($===">"){W.f=W.inline=o,R.highlightFormatting&&(W.formatting="link");var re=h(W);return re?re+=" ":re="",re+U.linkInline}return G.match(/^[^>]+/,!0),U.linkInline}function w(G,W){if(G.eatSpace())return null;var $=G.next();return $==="("||$==="["?(W.f=W.inline=v($==="("?")":"]"),R.highlightFormatting&&(W.formatting="link-string"),W.linkHref=!0,h(W)):"error"}var C={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function v(G){return function(W,$){var re=W.next();if(re===G){$.f=$.inline=o,R.highlightFormatting&&($.formatting="link-string");var ae=h($);return $.linkHref=!1,ae}return W.match(C[G]),$.linkHref=!0,h($)}}function M(G,W){return G.match(/^([^\]\\]|\\.)*\]:/,!1)?(W.f=B,G.next(),R.highlightFormatting&&(W.formatting="link"),W.linkText=!0,h(W)):u(G,W,o)}function B(G,W){if(G.match(/^\]:/,!0)){W.f=W.inline=F,R.highlightFormatting&&(W.formatting="link");var $=h(W);return W.linkText=!1,$}return G.match(/^([^\]\\]|\\.)+/,!0),U.linkText}function F(G,W){return G.eatSpace()?null:(G.match(/^[^\s]+/,!0),G.peek()===void 0?W.linkTitle=!0:G.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),W.f=W.inline=o,U.linkHref+" url")}var Q={startState:function(){return{f:y,prevLine:{stream:null},thisLine:{stream:null},block:y,htmlState:null,indentation:0,inline:o,text:d,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(G){return{f:G.f,prevLine:G.prevLine,thisLine:G.thisLine,block:G.block,htmlState:G.htmlState&&J.copyState(H,G.htmlState),indentation:G.indentation,localMode:G.localMode,localState:G.localMode?J.copyState(G.localMode,G.localState):null,inline:G.inline,text:G.text,formatting:!1,linkText:G.linkText,linkTitle:G.linkTitle,linkHref:G.linkHref,code:G.code,em:G.em,strong:G.strong,strikethrough:G.strikethrough,emoji:G.emoji,header:G.header,setext:G.setext,hr:G.hr,taskList:G.taskList,list:G.list,listStack:G.listStack.slice(0),quote:G.quote,indentedCode:G.indentedCode,trailingSpace:G.trailingSpace,trailingSpaceNewLine:G.trailingSpaceNewLine,md_inside:G.md_inside,fencedEndRE:G.fencedEndRE}},token:function(G,W){if(W.formatting=!1,G!=W.thisLine.stream){if(W.header=0,W.hr=!1,G.match(/^\s*$/,!0))return b(W),null;if(W.prevLine=W.thisLine,W.thisLine={stream:G},W.taskList=!1,W.trailingSpace=0,W.trailingSpaceNewLine=!1,!W.localState&&(W.f=W.block,W.f!=D)){var $=G.match(/^\s*/,!0)[0].replace(/\t/g,a).length;if(W.indentation=$,W.indentationDiff=null,$>0)return null}}return W.f(G,W)},innerMode:function(G){return G.block==D?{state:G.htmlState,mode:H}:G.localState?{state:G.localState,mode:G.localMode}:{state:G,mode:Q}},indent:function(G,W,$){return G.block==D&&H.indent?H.indent(G.htmlState,W,$):G.localState&&G.localMode.indent?G.localMode.indent(G.localState,W,$):J.Pass},blankLine:b,getType:h,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return Q},"xml"),J.defineMIME("text/markdown","markdown"),J.defineMIME("text/x-markdown","markdown")})},n6Qo:function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return I});var J=j("q1tI"),K=j("biw7"),R=j("fyJ8");function H(E){var L=E.className,f=E.index,S=E.children,P=E.colSpan,T=E.rowSpan,p=J.useContext(K.a),m=p.prefixCls,i=p.fixedInfoList,a=i[f];return J.createElement(R.a,Object.assign({className:L,index:f,component:"td",prefixCls:m,record:null,dataIndex:null,render:function(){return{children:S,props:{colSpan:P,rowSpan:T}}}},a))}function N(E){return J.createElement("tr",Object.assign({},E))}function x(E){var L=E.children,f=J.useContext(K.a),S=f.prefixCls;return J.createElement("tfoot",{className:"".concat(S,"-summary")},L)}var U=Ce.b=x,I={Cell:H,Row:N}},nVVt:function(Fe,Ce){Fe.exports={MODE_NUMBER:1<<0,MODE_ALPHA_NUM:1<<1,MODE_8BIT_BYTE:1<<2,MODE_KANJI:1<<3}},nWbc:function(Fe,Ce,j){},osHv:function(Fe,Ce,j){(function(J){J(j("VrN/"))})(function(J){"use strict";var K=J.Pos;function R(i,a){return i.line-a.line||i.ch-a.ch}var H="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",N=H+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",x=new RegExp("<(/?)(["+H+"]["+N+"]*)","g");function U(i,a,u,c){this.line=a,this.ch=u,this.cm=i,this.text=i.getLine(a),this.min=c?Math.max(c.from,i.firstLine()):i.firstLine(),this.max=c?Math.min(c.to-1,i.lastLine()):i.lastLine()}function I(i,a){var u=i.cm.getTokenTypeAt(K(i.line,a));return u&&/\btag\b/.test(u)}function E(i){return i.line>=i.max?void 0:(i.ch=0,i.text=i.cm.getLine(++i.line),!0)}function L(i){return i.line<=i.min?void 0:(i.text=i.cm.getLine(--i.line),i.ch=i.text.length,!0)}function f(i){for(;;){var a=i.text.indexOf(">",i.ch);if(a==-1){if(E(i))continue;return}if(!I(i,a+1)){i.ch=a+1;continue}var u=i.text.lastIndexOf("/",a),c=u>-1&&!/\S/.test(i.text.slice(u+1,a));return i.ch=a+1,c?"selfClose":"regular"}}function S(i){for(;;){var a=i.ch?i.text.lastIndexOf("<",i.ch-1):-1;if(a==-1){if(L(i))continue;return}if(!I(i,a+1)){i.ch=a;continue}x.lastIndex=a,i.ch=a;var u=x.exec(i.text);if(u&&u.index==a)return u}}function P(i){for(;;){x.lastIndex=i.ch;var a=x.exec(i.text);if(!a){if(E(i))continue;return}if(!I(i,a.index+1)){i.ch=a.index+1;continue}return i.ch=a.index+a[0].length,a}}function T(i){for(;;){var a=i.ch?i.text.lastIndexOf(">",i.ch-1):-1;if(a==-1){if(L(i))continue;return}if(!I(i,a+1)){i.ch=a;continue}var u=i.text.lastIndexOf("/",a),c=u>-1&&!/\S/.test(i.text.slice(u+1,a));return i.ch=a+1,c?"selfClose":"regular"}}function p(i,a){for(var u=[];;){var c=P(i),O,b=i.line,y=i.ch-(c?c[0].length:0);if(!c||!(O=f(i)))return;if(O=="selfClose")continue;if(c[1]){for(var D=u.length-1;D>=0;--D)if(u[D]==c[2]){u.length=D;break}if(D<0&&(!a||a==c[2]))return{tag:c[2],from:K(b,y),to:K(i.line,i.ch)}}else u.push(c[2])}}function m(i,a){for(var u=[];;){var c=T(i);if(!c)return;if(c=="selfClose"){S(i);continue}var O=i.line,b=i.ch,y=S(i);if(!y)return;if(y[1])u.push(y[2]);else{for(var D=u.length-1;D>=0;--D)if(u[D]==y[2]){u.length=D;break}if(D<0&&(!a||a==y[2]))return{tag:y[2],from:K(i.line,i.ch),to:K(O,b)}}}}J.registerHelper("fold","xml",function(i,a){for(var u=new U(i,a.line,0);;){var c=P(u);if(!c||u.line!=a.line)return;var O=f(u);if(!O)return;if(!c[1]&&O!="selfClose"){var b=K(u.line,u.ch),y=p(u,c[2]);return y&&R(y.from,b)>0?{from:b,to:y.from}:null}}}),J.findMatchingTag=function(i,a,u){var c=new U(i,a.line,a.ch,u);if(c.text.indexOf(">")==-1&&c.text.indexOf("<")==-1)return;var O=f(c),b=O&&K(c.line,c.ch),y=O&&S(c);if(!O||!y||R(c,a)>0)return;var D={from:K(c.line,c.ch),to:b,tag:y[2]};return O=="selfClose"?{open:D,close:null,at:"open"}:y[1]?{open:m(c,y[2]),close:D,at:"close"}:(c=new U(i,b.line,b.ch,u),{open:D,close:p(c,y[2]),at:"open"})},J.findEnclosingTag=function(i,a,u,c){for(var O=new U(i,a.line,a.ch,u);;){var b=m(O,c);if(!b)break;var y=new U(i,a.line,a.ch,u),D=p(y,b.tag);if(D)return{open:b,close:D}}},J.scanForClosingTag=function(i,a,u,c){var O=new U(i,a.line,a.ch,c?{from:0,to:c}:null);return p(O,u)}})},"p/48":function(Fe,Ce,j){},p5ED:function(Fe,Ce,j){"use strict";var J=j("+L6B"),K=j("2/Rp"),R=j("5Dmo"),H=j("3S7+"),N=j("k1fw"),x=j("tJVT"),U=j("q1tI"),I=j.n(U),E=j("vHTk"),L=j.n(E),f=j("yEEn"),S=j("ZW9T"),P=j("1vsH");Ce.a=function(T){var p=T.name,m=T.data,i=T.theme,a=T.type,u=T.filename,c=T.monacoEditor,O=T.className,b=T.style,y=T.close,D=T.onClose,_=T.hasMask,h=Object(U.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),d=Object(x.a)(h,2),o=d[0],s=d[1],w=Object(U.useState)(""),C=Object(x.a)(w,2),v=C[0],M=C[1],B=Object(U.useRef)();u&&(c.filename=u),Object(U.useEffect)(function(){var G,W,$=(G=document.cookie)===null||G===void 0||((W=G.replace(/\s/g,""))===null||W===void 0)?void 0:W.split(";");$==null||$.map(function(re){var ae=re.split("=");ae[0]==="_educoder_session"&&M(ae[1])})},[]);var F=function(){if(m.startsWith("http")||m.startsWith("/")){Q();return}Object(P.x)(u||"educoder",m,u)},Q=function(){Object(P.v)(u||p,m)};return console.log("data:",m,"fileanme:",u," name:",p),I.a.createElement("div",{style:Object(N.a)({},b||{}),className:"".concat(_&&L.a.bgBlack," ").concat(a?L.a.wrp:"hide")},y&&I.a.createElement("div",{className:L.a.close,ref:B},I.a.createElement(H.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return B.current}},I.a.createElement("span",{onClick:Q},I.a.createElement("i",{className:"icon-quxiaozhiding"}))),I.a.createElement(H.a,{title:"\u5173\u95ED",getPopupContainer:function(){return B.current}},I.a.createElement("span",{className:"",onClick:D},I.a.createElement("i",{className:"icon-guanbi1"})))),I.a.createElement("div",{className:"".concat(L.a[O]," ").concat(O," ").concat(L.a.monaco," ").concat(a==="txt"?"show":"hide")},a==="txt"&&I.a.createElement(S.b,c)),a==="audio"&&I.a.createElement("audio",{src:"".concat(m!=null&&m.startsWith("/")||(m==null?void 0:m.indexOf("https://"))>-1?m:"data:audio/mp3;base64,").concat(m),autoPlay:!0}),a==="video"&&I.a.createElement(I.a.Fragment,null,m!=null&&m.startsWith("/")?I.a.createElement("video",{controls:!0,src:"".concat(m),autoPlay:!0}):I.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(m),autoPlay:!0})),a==="html"&&I.a.createElement("iframe",{src:m+"&disposition=inline"}),a==="pdf"&&I.a.createElement("embed",{className:L.a.embed,src:m}),a==="pdfeditor"&&I.a.createElement("div",null,I.a.createElement("iframe",{src:"https://a1office.co/solutions/editor/pdf-editor/\u67E5\u91CD\u6587\u68631-8839d79b81e8bda0d298ca058913ab88.pdf"}),I.a.createElement("div",{style:{position:"absolute",left:"1px",top:"1px",width:180,height:60,background:"#f9f9f9"}})),a==="image"&&I.a.createElement(I.a.Fragment,null,I.a.createElement("img",{src:"".concat(m!=null&&m.startsWith("/")||(m==null?void 0:m.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(m)})),a==="other"&&I.a.createElement("div",null,I.a.createElement(K.a,{type:"primary",size:"large",onClick:F},I.a.createElement(f.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(a==="download"||a==="office")&&I.a.createElement(K.a,{type:"primary",size:"large",onClick:F},I.a.createElement(f.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(Fe,Ce,j){},pPuO:function(Fe,Ce,j){Fe.exports={desc:"desc___2o_2w",info:"info___Uro3x","commit-info":"commit-info___o2-Ex"}},"qJ4+":function(Fe,Ce,j){},"rAM+":function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return K});var J=j("Qw5x");function K(R,H){var N;if(typeof Symbol=="undefined"||R[Symbol.iterator]==null){if(Array.isArray(R)||(N=Object(J.a)(R))||H&&R&&typeof R.length=="number"){N&&(R=N);var x=0,U=function(){};return{s:U,n:function(){return x>=R.length?{done:!0}:{done:!1,value:R[x++]}},e:function(S){throw S},f:U}}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 I=!0,E=!1,L;return{s:function(){N=R[Symbol.iterator]()},n:function(){var S=N.next();return I=S.done,S},e:function(S){E=!0,L=S},f:function(){try{!I&&N.return!=null&&N.return()}finally{if(E)throw L}}}}},rUJ1:function(Fe,Ce){const j=/[&<>"']/,J=/[&<>"']/g,K=/[<>"']|&(?!#?\w+;)/,R=/[<>"']|&(?!#?\w+;)/g,H={"&":"&","<":"<",">":">",'"':""","'":"'"},N=_=>H[_];function x(_,h){if(h){if(j.test(_))return _.replace(J,N)}else if(K.test(_))return _.replace(R,N);return _}const U=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function I(_){return _.replace(U,(h,d)=>(d=d.toLowerCase(),d==="colon"?":":d.charAt(0)==="#"?d.charAt(1)==="x"?String.fromCharCode(parseInt(d.substring(2),16)):String.fromCharCode(+d.substring(1)):""))}const E=/(^|[^\[])\^/g;function L(_,h){_=_.source||_,h=h||"";const d={replace:(o,s)=>(s=s.source||s,s=s.replace(E,"$1"),_=_.replace(o,s),d),getRegex:()=>new RegExp(_,h)};return d}const f=/[^\w:]/g,S=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function P(_,h,d){if(_){let o;try{o=decodeURIComponent(I(d)).replace(f,"").toLowerCase()}catch(s){return null}if(o.indexOf("javascript:")===0||o.indexOf("vbscript:")===0||o.indexOf("data:")===0)return null}h&&!S.test(d)&&(d=a(h,d));try{d=encodeURI(d).replace(/%25/g,"%")}catch(o){return null}return d}const T={},p=/^[^:]+:\/*[^/]*$/,m=/^([^:]+:)[\s\S]*$/,i=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(_,h){T[" "+_]||(p.test(_)?T[" "+_]=_+"/":T[" "+_]=b(_,"/",!0)),_=T[" "+_];const d=_.indexOf(":")===-1;return h.substring(0,2)==="//"?d?h:_.replace(m,"$1")+h:h.charAt(0)==="/"?d?h:_.replace(i,"$1")+h:_+h}const u={exec:function(){}};function c(_){let h=1,d,o;for(;h<arguments.length;h++){d=arguments[h];for(o in d)Object.prototype.hasOwnProperty.call(d,o)&&(_[o]=d[o])}return _}function O(_,h){const d=_.replace(/\|/g,(w,C,v)=>{let M=!1,B=C;for(;--B>=0&&v[B]==="\\";)M=!M;return M?"|":" |"}),o=d.split(/ \|/);let s=0;if(o.length>h)o.splice(h);else for(;o.length<h;)o.push("");for(;s<o.length;s++)o[s]=o[s].trim().replace(/\\\|/g,"|");return o}function b(_,h,d){const o=_.length;if(o===0)return"";let s=0;for(;s<o;){const w=_.charAt(o-s-1);if(w===h&&!d)s++;else if(w!==h&&d)s++;else break}return _.substr(0,o-s)}function y(_,h){if(_.indexOf(h[1])===-1)return-1;const d=_.length;let o=0,s=0;for(;s<d;s++)if(_[s]==="\\")s++;else if(_[s]===h[0])o++;else if(_[s]===h[1]&&(o--,o<0))return s;return-1}function D(_){_&&_.sanitize&&!_.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")}Fe.exports={escape:x,unescape:I,edit:L,cleanUrl:P,resolveUrl:a,noopTest:u,merge:c,splitCells:O,rtrim:b,findClosingBracket:y,checkSanitizeDeprecation:D}},rcnY:function(Fe,Ce,j){var J=j("aRTE");function K(R,H){this.totalCount=R,this.dataCount=H}K.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],K.getRSBlocks=function(R,H){var N=K.getRsBlockTable(R,H);if(N==null)throw new Error("bad rs block @ typeNumber:"+R+"/errorCorrectLevel:"+H);for(var x=N.length/3,U=new Array,I=0;I<x;I++)for(var E=N[I*3+0],L=N[I*3+1],f=N[I*3+2],S=0;S<E;S++)U.push(new K(L,f));return U},K.getRsBlockTable=function(R,H){switch(H){case J.L:return K.RS_BLOCK_TABLE[(R-1)*4+0];case J.M:return K.RS_BLOCK_TABLE[(R-1)*4+1];case J.Q:return K.RS_BLOCK_TABLE[(R-1)*4+2];case J.H:return K.RS_BLOCK_TABLE[(R-1)*4+3];default:return}},Fe.exports=K},rdUC:function(Fe,Ce,j){var J=j("MFOe"),K=J.Global;Fe.exports={name:"localStorage",read:H,write:N,each:x,remove:U,clearAll:I};function R(){return K.localStorage}function H(E){return R().getItem(E)}function N(E,L){return R().setItem(E,L)}function x(E){for(var L=R().length-1;L>=0;L--){var f=R().key(L);E(H(f),f)}}function U(E){return R().removeItem(E)}function I(){return R().clear()}},sR1s:function(Fe,Ce,j){"use strict";j.d(Ce,"b",function(){return H}),j.d(Ce,"a",function(){return N}),j.d(Ce,"c",function(){return x}),j.d(Ce,"d",function(){return U});var J=j("U8pU"),K="RC_TABLE_KEY";function R(I){return I==null?[]:Array.isArray(I)?I:[I]}function H(I,E){if(!E&&typeof E!="number")return I;for(var L=R(E),f=I,S=0;S<L.length;S+=1){if(!f)return null;var P=L[S];f=f[P]}return f}function N(I){var E=[],L={};return I.forEach(function(f){for(var S=f||{},P=S.key,T=S.dataIndex,p=P||R(T).join("-")||K;L[p];)p="".concat(p,"_next");L[p]=!0,E.push(p)}),E}function x(){var I={};function E(P,T){T&&Object.keys(T).forEach(function(p){var m=T[p];m&&Object(J.a)(m)==="object"?(P[p]=P[p]||{},E(P[p],m)):P[p]=m})}for(var L=arguments.length,f=new Array(L),S=0;S<L;S++)f[S]=arguments[S];return f.forEach(function(P){E(I,P)}),I}function U(I){return I!=null}},sboe:function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return R});var J=j("q1tI"),K=j.n(J),R=J.createContext(null)},t23M:function(Fe,Ce,j){"use strict";var J=j("VTBJ"),K=j("1OyB"),R=j("vuIU"),H=j("Ji7U"),N=j("LK+K"),x=j("q1tI"),U=j.n(x),I=j("m+aA"),E=j("Zm9Q"),L=j("Kwbf"),f=j("c+Xe"),S=j("bdgK"),P="rc-observer-key",T=function(p){Object(H.a)(i,p);var m=Object(N.a)(i);function i(){var a;return Object(K.a)(this,i),a=m.apply(this,arguments),a.resizeObserver=null,a.childNode=null,a.currentElement=null,a.state={width:0,height:0,offsetHeight:0,offsetWidth:0},a.onResize=function(u){var c=a.props.onResize,O=u[0].target,b=O.getBoundingClientRect(),y=b.width,D=b.height,_=O.offsetWidth,h=O.offsetHeight,d=Math.floor(y),o=Math.floor(D);if(a.state.width!==d||a.state.height!==o||a.state.offsetWidth!==_||a.state.offsetHeight!==h){var s={width:d,height:o,offsetWidth:_,offsetHeight:h};a.setState(s),c&&Promise.resolve().then(function(){c(Object(J.a)(Object(J.a)({},s),{},{offsetWidth:_,offsetHeight:h}))})}},a.setChildNode=function(u){a.childNode=u},a}return Object(R.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 u=this.props.disabled;if(u){this.destroyObserver();return}var c=Object(I.a)(this.childNode||this),O=c!==this.currentElement;O&&(this.destroyObserver(),this.currentElement=c),!this.resizeObserver&&c&&(this.resizeObserver=new S.default(this.onResize),this.resizeObserver.observe(c))}},{key:"destroyObserver",value:function(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}},{key:"render",value:function(){var u=this.props.children,c=Object(E.a)(u);if(c.length>1)Object(L.a)(!1,"Find more than one child node with `children` in ResizeObserver. Will only observe first one.");else if(c.length===0)return Object(L.a)(!1,"`children` of ResizeObserver is empty. Nothing is in observe."),null;var O=c[0];if(x.isValidElement(O)&&Object(f.c)(O)){var b=O.ref;c[0]=x.cloneElement(O,{ref:Object(f.a)(b,this.setChildNode)})}return c.length===1?c[0]:c.map(function(y,D){return!x.isValidElement(y)||"key"in y&&y.key!==null?y:x.cloneElement(y,{key:"".concat(P,"-").concat(D)})})}}]),i}(x.Component);T.displayName="ResizeObserver",Ce.a=T},uD2n:function(Fe,Ce,j){Fe.exports={"dis-input-editor-container":"dis-input-editor-container___3uf7A",active:"active___20tmT","input-mask":"input-mask___1kijM","text-area":"text-area___2gTEA","tip-container":"tip-container___2tKkE",hide:"hide___3jIwM","md-container":"md-container___14zRI","btn-send":"btn-send___3TabT"}},uMZB:function(Fe,Ce,j){Fe.exports={header:"header___3a50V",checkboxs:"checkboxs___3TnBC",field:"field___SHW6f","oj-form-container":"oj-form-container___36KBv","oj-left-panel":"oj-left-panel___3Fdj5","oj-form-info":"oj-form-info___dilPb",footer:"footer___1Ie9U","test-case-name":"test-case-name___356US","btn-remove-case":"btn-remove-case___1Z5cd","icon-tag":"icon-tag___3zUaP",btn_back:"btn_back___2UBbR",testJi:"testJi___1dyLk",upBtn:"upBtn___1I0SJ"}},uQRt:function(Fe,Ce,j){Fe.exports=J;function J(){return j("gaXo"),{}}},ulZh:function(Fe,Ce,j){typeof window!="undefined"&&function(K,R){Fe.exports=R()}(this,function(){return function(J){var K={};function R(H){if(K[H])return K[H].exports;var N=K[H]={i:H,l:!1,exports:{}};return J[H].call(N.exports,N,N.exports,R),N.l=!0,N.exports}return R.m=J,R.c=K,R.d=function(H,N,x){R.o(H,N)||Object.defineProperty(H,N,{enumerable:!0,get:x})},R.r=function(H){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(H,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(H,"__esModule",{value:!0})},R.t=function(H,N){if(N&1&&(H=R(H)),N&8)return H;if(N&4&&typeof H=="object"&&H&&H.__esModule)return H;var x=Object.create(null);if(R.r(x),Object.defineProperty(x,"default",{enumerable:!0,value:H}),N&2&&typeof H!="string")for(var U in H)R.d(x,U,function(I){return H[I]}.bind(null,U));return x},R.n=function(H){var N=H&&H.__esModule?function(){return H.default}:function(){return H};return R.d(N,"a",N),N},R.o=function(H,N){return Object.prototype.hasOwnProperty.call(H,N)},R.p="/dist/",R(R.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(J,K,R){"use strict";var H=Object.prototype.hasOwnProperty,N="~";function x(){}Object.create&&(x.prototype=Object.create(null),new x().__proto__||(N=!1));function U(f,S,P){this.fn=f,this.context=S,this.once=P||!1}function I(f,S,P,T,p){if(typeof P!="function")throw new TypeError("The listener must be a function");var m=new U(P,T||f,p),i=N?N+S:S;return f._events[i]?f._events[i].fn?f._events[i]=[f._events[i],m]:f._events[i].push(m):(f._events[i]=m,f._eventsCount++),f}function E(f,S){--f._eventsCount===0?f._events=new x:delete f._events[S]}function L(){this._events=new x,this._eventsCount=0}L.prototype.eventNames=function(){var S=[],P,T;if(this._eventsCount===0)return S;for(T in P=this._events)H.call(P,T)&&S.push(N?T.slice(1):T);return Object.getOwnPropertySymbols?S.concat(Object.getOwnPropertySymbols(P)):S},L.prototype.listeners=function(S){var P=N?N+S:S,T=this._events[P];if(!T)return[];if(T.fn)return[T.fn];for(var p=0,m=T.length,i=new Array(m);p<m;p++)i[p]=T[p].fn;return i},L.prototype.listenerCount=function(S){var P=N?N+S:S,T=this._events[P];return T?T.fn?1:T.length:0},L.prototype.emit=function(S,P,T,p,m,i){var a=N?N+S:S;if(!this._events[a])return!1;var u=this._events[a],c=arguments.length,O,b;if(u.fn){u.once&&this.removeListener(S,u.fn,void 0,!0);switch(c){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,P),!0;case 3:return u.fn.call(u.context,P,T),!0;case 4:return u.fn.call(u.context,P,T,p),!0;case 5:return u.fn.call(u.context,P,T,p,m),!0;case 6:return u.fn.call(u.context,P,T,p,m,i),!0}for(b=1,O=new Array(c-1);b<c;b++)O[b-1]=arguments[b];u.fn.apply(u.context,O)}else{var y=u.length,D;for(b=0;b<y;b++){u[b].once&&this.removeListener(S,u[b].fn,void 0,!0);switch(c){case 1:u[b].fn.call(u[b].context);break;case 2:u[b].fn.call(u[b].context,P);break;case 3:u[b].fn.call(u[b].context,P,T);break;case 4:u[b].fn.call(u[b].context,P,T,p);break;default:if(!O)for(D=1,O=new Array(c-1);D<c;D++)O[D-1]=arguments[D];u[b].fn.apply(u[b].context,O)}}}return!0},L.prototype.on=function(S,P,T){return I(this,S,P,T,!1)},L.prototype.once=function(S,P,T){return I(this,S,P,T,!0)},L.prototype.removeListener=function(S,P,T,p){var m=N?N+S:S;if(!this._events[m])return this;if(!P)return E(this,m),this;var i=this._events[m];if(i.fn)i.fn===P&&(!p||i.once)&&(!T||i.context===T)&&E(this,m);else{for(var a=0,u=[],c=i.length;a<c;a++)(i[a].fn!==P||p&&!i[a].once||T&&i[a].context!==T)&&u.push(i[a]);u.length?this._events[m]=u.length===1?u[0]:u:E(this,m)}return this},L.prototype.removeAllListeners=function(S){var P;return S?(P=N?N+S:S,this._events[P]&&E(this,P)):(this._events=new x,this._eventsCount=0),this},L.prototype.off=L.prototype.removeListener,L.prototype.addListener=L.prototype.on,L.prefixed=N,L.EventEmitter=L,J.exports=L},"./node_modules/url-toolkit/src/url-toolkit.js":function(J,K,R){(function(H){var N=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,x=/^([^\/?#]*)([^]*)$/,U=/(?:\/|^)\.(?=\/)/g,I=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,E={buildAbsoluteURL:function(L,f,S){if(S=S||{},L=L.trim(),f=f.trim(),!f){if(!S.alwaysNormalize)return L;var P=E.parseURL(L);if(!P)throw new Error("Error trying to parse base URL.");return P.path=E.normalizePath(P.path),E.buildURLFromParts(P)}var T=E.parseURL(f);if(!T)throw new Error("Error trying to parse relative URL.");if(T.scheme)return S.alwaysNormalize?(T.path=E.normalizePath(T.path),E.buildURLFromParts(T)):f;var p=E.parseURL(L);if(!p)throw new Error("Error trying to parse base URL.");if(!p.netLoc&&p.path&&p.path[0]!=="/"){var m=x.exec(p.path);p.netLoc=m[1],p.path=m[2]}p.netLoc&&!p.path&&(p.path="/");var i={scheme:p.scheme,netLoc:T.netLoc,path:null,params:T.params,query:T.query,fragment:T.fragment};if(!T.netLoc&&(i.netLoc=p.netLoc,T.path[0]!=="/"))if(!T.path)i.path=p.path,T.params||(i.params=p.params,T.query||(i.query=p.query));else{var a=p.path,u=a.substring(0,a.lastIndexOf("/")+1)+T.path;i.path=E.normalizePath(u)}return i.path===null&&(i.path=S.alwaysNormalize?E.normalizePath(T.path):T.path),E.buildURLFromParts(i)},parseURL:function(L){var f=N.exec(L);return f?{scheme:f[1]||"",netLoc:f[2]||"",path:f[3]||"",params:f[4]||"",query:f[5]||"",fragment:f[6]||""}:null},normalizePath:function(L){for(L=L.split("").reverse().join("").replace(U,"");L.length!==(L=L.replace(I,"")).length;);return L.split("").reverse().join("")},buildURLFromParts:function(L){return L.scheme+L.netLoc+L.path+L.params+L.query+L.fragment}};J.exports=E})(this)},"./node_modules/webworkify-webpack/index.js":function(J,K,R){function H(S){var P={};function T(m){if(P[m])return P[m].exports;var i=P[m]={i:m,l:!1,exports:{}};return S[m].call(i.exports,i,i.exports,T),i.l=!0,i.exports}T.m=S,T.c=P,T.i=function(m){return m},T.d=function(m,i,a){T.o(m,i)||Object.defineProperty(m,i,{configurable:!1,enumerable:!0,get:a})},T.r=function(m){Object.defineProperty(m,"__esModule",{value:!0})},T.n=function(m){var i=m&&m.__esModule?function(){return m.default}:function(){return m};return T.d(i,"a",i),i},T.o=function(m,i){return Object.prototype.hasOwnProperty.call(m,i)},T.p="/",T.oe=function(m){throw console.error(m),m};var p=T(T.s=ENTRY_MODULE);return p.default||p}var N="[\\.|\\-|\\+|\\w|/|@]+",x="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+N+").*?\\)";function U(S){return(S+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function I(S){return!isNaN(1*S)}function E(S,P,T){var p={};p[T]=[];var m=P.toString(),i=m.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!i)return p;for(var a=i[1],u=new RegExp("(\\\\n|\\W)"+U(a)+x,"g"),c;c=u.exec(m);){if(c[3]==="dll-reference")continue;p[T].push(c[3])}for(u=new RegExp("\\("+U(a)+'\\("(dll-reference\\s('+N+'))"\\)\\)'+x,"g");c=u.exec(m);)S[c[2]]||(p[T].push(c[1]),S[c[2]]=R(c[1]).m),p[c[2]]=p[c[2]]||[],p[c[2]].push(c[4]);for(var O=Object.keys(p),b=0;b<O.length;b++)for(var y=0;y<p[O[b]].length;y++)I(p[O[b]][y])&&(p[O[b]][y]=1*p[O[b]][y]);return p}function L(S){var P=Object.keys(S);return P.reduce(function(T,p){return T||S[p].length>0},!1)}function f(S,P){for(var T={main:[P]},p={main:[]},m={main:{}};L(T);)for(var i=Object.keys(T),a=0;a<i.length;a++){var u=i[a],c=T[u],O=c.pop();if(m[u]=m[u]||{},m[u][O]||!S[u][O])continue;m[u][O]=!0,p[u]=p[u]||[],p[u].push(O);for(var b=E(S,S[u][O],u),y=Object.keys(b),D=0;D<y.length;D++)T[y[D]]=T[y[D]]||[],T[y[D]]=T[y[D]].concat(b[y[D]])}return p}J.exports=function(S,P){P=P||{};var T={main:R.m},p=P.all?{main:Object.keys(T.main)}:f(T,S),m="";Object.keys(p).filter(function(O){return O!=="main"}).forEach(function(O){for(var b=0;p[O][b];)b++;p[O].push(b),T[O][b]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",m=m+"var "+O+" = ("+H.toString().replace("ENTRY_MODULE",JSON.stringify(b))+")({"+p[O].map(function(y){return""+JSON.stringify(y)+": "+T[O][y].toString()}).join(",")+`});
|
|
`}),m=m+"new (("+H.toString().replace("ENTRY_MODULE",JSON.stringify(S))+")({"+p.main.map(function(O){return""+JSON.stringify(O)+": "+T.main[O].toString()}).join(",")+"}))(self);";var i=new window.Blob([m],{type:"text/javascript"});if(P.bare)return i;var a=window.URL||window.webkitURL||window.mozURL||window.msURL,u=a.createObjectURL(i),c=new window.Worker(u);return c.objectURL=u,c}},"./src/config.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"hlsDefaultConfig",function(){return D}),R.d(K,"mergeConfig",function(){return h}),R.d(K,"enableStreamingMode",function(){return d});var H=R("./src/controller/abr-controller.ts"),N=R("./src/controller/audio-stream-controller.ts"),x=R("./src/controller/audio-track-controller.ts"),U=R("./src/controller/subtitle-stream-controller.ts"),I=R("./src/controller/subtitle-track-controller.ts"),E=R("./src/controller/buffer-controller.ts"),L=R("./src/controller/timeline-controller.ts"),f=R("./src/controller/cap-level-controller.ts"),S=R("./src/controller/fps-controller.ts"),P=R("./src/controller/eme-controller.ts"),T=R("./src/controller/cmcd-controller.ts"),p=R("./src/utils/xhr-loader.ts"),m=R("./src/utils/fetch-loader.ts"),i=R("./src/utils/cues.ts"),a=R("./src/utils/mediakeys-helper.ts"),u=R("./src/utils/logger.ts");function c(){return c=Object.assign||function(o){for(var s=1;s<arguments.length;s++){var w=arguments[s];for(var C in w)Object.prototype.hasOwnProperty.call(w,C)&&(o[C]=w[C])}return o},c.apply(this,arguments)}function O(o,s){var w=Object.keys(o);if(Object.getOwnPropertySymbols){var C=Object.getOwnPropertySymbols(o);s&&(C=C.filter(function(v){return Object.getOwnPropertyDescriptor(o,v).enumerable})),w.push.apply(w,C)}return w}function b(o){for(var s=1;s<arguments.length;s++){var w=arguments[s]!=null?arguments[s]:{};s%2?O(Object(w),!0).forEach(function(C){y(o,C,w[C])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(w)):O(Object(w)).forEach(function(C){Object.defineProperty(o,C,Object.getOwnPropertyDescriptor(w,C))})}return o}function y(o,s,w){return s in o?Object.defineProperty(o,s,{value:w,enumerable:!0,configurable:!0,writable:!0}):o[s]=w,o}var D=b(b({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:p.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:H.default,bufferController:E.default,capLevelController:f.default,fpsController:S.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:a.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},_()),{},{subtitleStreamController:U.SubtitleStreamController,subtitleTrackController:I.default,timelineController:L.TimelineController,audioStreamController:N.default,audioTrackController:x.default,emeController:P.default,cmcdController:T.default});function _(){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 h(o,s){if((s.liveSyncDurationCount||s.liveMaxLatencyDurationCount)&&(s.liveSyncDuration||s.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(s.liveMaxLatencyDurationCount!==void 0&&(s.liveSyncDurationCount===void 0||s.liveMaxLatencyDurationCount<=s.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(s.liveMaxLatencyDuration!==void 0&&(s.liveSyncDuration===void 0||s.liveMaxLatencyDuration<=s.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return c({},o,s)}function d(o){var s=o.loader;if(s!==m.default&&s!==p.default)u.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),o.progressive=!1;else{var w=Object(m.fetchSupported)();w&&(o.loader=m.default,o.progressive=!0,o.enableSoftwareAES=!0,u.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(J,K,R){"use strict";R.r(K);var H=R("./src/polyfills/number.ts"),N=R("./src/utils/ewma-bandwidth-estimator.ts"),x=R("./src/events.ts"),U=R("./src/utils/buffer-helper.ts"),I=R("./src/errors.ts"),E=R("./src/types/loader.ts"),L=R("./src/utils/logger.ts");function f(T,p){for(var m=0;m<p.length;m++){var i=p[m];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(T,i.key,i)}}function S(T,p,m){return p&&f(T.prototype,p),m&&f(T,m),T}var P=function(){function T(m){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=m;var i=m.config;this.bwEstimator=new N.default(i.abrEwmaSlowVoD,i.abrEwmaFastVoD,i.abrEwmaDefaultEstimate),this.registerListeners()}var p=T.prototype;return p.registerListeners=function(){var i=this.hls;i.on(x.Events.FRAG_LOADING,this.onFragLoading,this),i.on(x.Events.FRAG_LOADED,this.onFragLoaded,this),i.on(x.Events.FRAG_BUFFERED,this.onFragBuffered,this),i.on(x.Events.LEVEL_LOADED,this.onLevelLoaded,this),i.on(x.Events.ERROR,this.onError,this)},p.unregisterListeners=function(){var i=this.hls;i.off(x.Events.FRAG_LOADING,this.onFragLoading,this),i.off(x.Events.FRAG_LOADED,this.onFragLoaded,this),i.off(x.Events.FRAG_BUFFERED,this.onFragBuffered,this),i.off(x.Events.LEVEL_LOADED,this.onLevelLoaded,this),i.off(x.Events.ERROR,this.onError,this)},p.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},p.onFragLoading=function(i,a){var u=a.frag;if(u.type===E.PlaylistLevelType.MAIN&&!this.timer){var c;this.fragCurrent=u,this.partCurrent=(c=a.part)!=null?c:null,this.timer=self.setInterval(this.onCheck,100)}},p.onLevelLoaded=function(i,a){var u=this.hls.config;a.details.live?this.bwEstimator.update(u.abrEwmaSlowLive,u.abrEwmaFastLive):this.bwEstimator.update(u.abrEwmaSlowVoD,u.abrEwmaFastVoD)},p._abandonRulesCheck=function(){var i=this.fragCurrent,a=this.partCurrent,u=this.hls,c=u.autoLevelEnabled,O=u.config,b=u.media;if(!i||!b)return;var y=a?a.stats:i.stats,D=a?a.duration:i.duration;if(y.aborted){L.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!c||b.paused||!b.playbackRate||!b.readyState)return;var _=performance.now()-y.loading.start,h=Math.abs(b.playbackRate);if(_<=500*D/h)return;var d=u.levels,o=u.minAutoLevel,s=d[i.level],w=y.total||Math.max(y.loaded,Math.round(D*s.maxBitrate/8)),C=Math.max(1,y.bwEstimate?y.bwEstimate/8:y.loaded*1e3/_),v=(w-y.loaded)/C,M=b.currentTime,B=(U.BufferHelper.bufferInfo(b,M,O.maxBufferHole).end-M)/h;if(B>=2*D/h||v<=B)return;var F=Number.POSITIVE_INFINITY,Q;for(Q=i.level-1;Q>o;Q--){var G=d[Q].maxBitrate;if(F=D*G/(8*.8*C),F<B)break}if(F>=v)return;var W=this.bwEstimator.getEstimate();L.logger.warn("Fragment "+i.sn+(a?" part "+a.index:"")+" of level "+i.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+Q+`
|
|
Current BW estimate: `+(Object(H.isFiniteNumber)(W)?(W/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+v.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+F.toFixed(3)+` s
|
|
Time to underbuffer: `+B.toFixed(3)+" s"),u.nextLoadLevel=Q,this.bwEstimator.sample(_,y.loaded),this.clearTimer(),i.loader&&(this.fragCurrent=this.partCurrent=null,i.loader.abort()),u.trigger(x.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:i,part:a,stats:y})},p.onFragLoaded=function(i,a){var u=a.frag,c=a.part;if(u.type===E.PlaylistLevelType.MAIN&&Object(H.isFiniteNumber)(u.sn)){var O=c?c.stats:u.stats,b=c?c.duration:u.duration;if(this.clearTimer(),this.lastLoadedFragLevel=u.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var y=this.hls.levels[u.level],D=(y.loaded?y.loaded.bytes:0)+O.loaded,_=(y.loaded?y.loaded.duration:0)+b;y.loaded={bytes:D,duration:_},y.realBitrate=Math.round(8*D/_)}if(u.bitrateTest){var h={stats:O,frag:u,part:c,id:u.type};this.onFragBuffered(x.Events.FRAG_BUFFERED,h),u.bitrateTest=!1}}},p.onFragBuffered=function(i,a){var u=a.frag,c=a.part,O=c?c.stats:u.stats;if(O.aborted)return;if(u.type!==E.PlaylistLevelType.MAIN||u.sn==="initSegment")return;var b=O.parsing.end-O.loading.start;this.bwEstimator.sample(b,O.loaded),O.bwEstimate=this.bwEstimator.getEstimate(),u.bitrateTest?this.bitrateTestDelay=b/1e3:this.bitrateTestDelay=0},p.onError=function(i,a){switch(a.details){case I.ErrorDetails.FRAG_LOAD_ERROR:case I.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},p.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},p.getNextABRAutoLevel=function(){var i=this.fragCurrent,a=this.partCurrent,u=this.hls,c=u.maxAutoLevel,O=u.config,b=u.minAutoLevel,y=u.media,D=a?a.duration:i?i.duration:0,_=y?y.currentTime:0,h=y&&y.playbackRate!==0?Math.abs(y.playbackRate):1,d=this.bwEstimator?this.bwEstimator.getEstimate():O.abrEwmaDefaultEstimate,o=(U.BufferHelper.bufferInfo(y,_,O.maxBufferHole).end-_)/h,s=this.findBestLevel(d,b,c,o,O.abrBandWidthFactor,O.abrBandWidthUpFactor);if(s>=0)return s;L.logger.trace((o?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var w=D?Math.min(D,O.maxStarvationDelay):O.maxStarvationDelay,C=O.abrBandWidthFactor,v=O.abrBandWidthUpFactor;if(!o){var M=this.bitrateTestDelay;if(M){var B=D?Math.min(D,O.maxLoadingDelay):O.maxLoadingDelay;w=B-M,L.logger.trace("bitrate test took "+Math.round(1e3*M)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*w)+" ms"),C=v=1}}return s=this.findBestLevel(d,b,c,o+w,C,v),Math.max(s,0)},p.findBestLevel=function(i,a,u,c,O,b){for(var y,D=this.fragCurrent,_=this.partCurrent,h=this.lastLoadedFragLevel,d=this.hls.levels,o=d[h],s=!!(o!=null&&(y=o.details)!==null&&y!==void 0&&y.live),w=o==null?void 0:o.codecSet,C=_?_.duration:D?D.duration:0,v=u;v>=a;v--){var M=d[v];if(!M||w&&M.codecSet!==w)continue;var B=M.details,F=(_?B==null?void 0:B.partTarget:B==null?void 0:B.averagetargetduration)||C,Q=void 0;v<=h?Q=O*i:Q=b*i;var G=d[v].maxBitrate,W=G*F/Q;if(L.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+v+"/"+Math.round(Q)+"/"+G+"/"+F+"/"+c+"/"+W),Q>G&&(!W||s&&!this.bitrateTestDelay||W<c))return v}return-1},S(T,[{key:"nextAutoLevel",get:function(){var i=this._nextAutoLevel,a=this.bwEstimator;if(i!==-1&&(!a||!a.canEstimate()))return i;var u=this.getNextABRAutoLevel();return i!==-1&&(u=Math.min(i,u)),u},set:function(i){this._nextAutoLevel=i}}]),T}();K.default=P},"./src/controller/audio-stream-controller.ts":function(J,K,R){"use strict";R.r(K);var H=R("./src/polyfills/number.ts"),N=R("./src/controller/base-stream-controller.ts"),x=R("./src/events.ts"),U=R("./src/utils/buffer-helper.ts"),I=R("./src/controller/fragment-tracker.ts"),E=R("./src/types/level.ts"),L=R("./src/types/loader.ts"),f=R("./src/loader/fragment.ts"),S=R("./src/demux/chunk-cache.ts"),P=R("./src/demux/transmuxer-interface.ts"),T=R("./src/types/transmuxer.ts"),p=R("./src/controller/fragment-finders.ts"),m=R("./src/utils/discontinuities.ts"),i=R("./src/errors.ts"),a=R("./src/utils/logger.ts");function u(){return u=Object.assign||function(D){for(var _=1;_<arguments.length;_++){var h=arguments[_];for(var d in h)Object.prototype.hasOwnProperty.call(h,d)&&(D[d]=h[d])}return D},u.apply(this,arguments)}function c(D,_){D.prototype=Object.create(_.prototype),D.prototype.constructor=D,O(D,_)}function O(D,_){return O=Object.setPrototypeOf||function(d,o){return d.__proto__=o,d},O(D,_)}var b=100,y=function(D){c(_,D);function _(d,o){var s;return s=D.call(this,d,o,"[audio-stream-controller]")||this,s.videoBuffer=null,s.videoTrackCC=-1,s.waitingVideoCC=-1,s.audioSwitch=!1,s.trackId=-1,s.waitingData=null,s.mainDetails=null,s.bufferFlushed=!1,s._registerListeners(),s}var h=_.prototype;return h.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},h._registerListeners=function(){var o=this.hls;o.on(x.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(x.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(x.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(x.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.on(x.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),o.on(x.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),o.on(x.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),o.on(x.Events.ERROR,this.onError,this),o.on(x.Events.BUFFER_RESET,this.onBufferReset,this),o.on(x.Events.BUFFER_CREATED,this.onBufferCreated,this),o.on(x.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),o.on(x.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),o.on(x.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h._unregisterListeners=function(){var o=this.hls;o.off(x.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(x.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(x.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(x.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.off(x.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),o.off(x.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),o.off(x.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),o.off(x.Events.ERROR,this.onError,this),o.off(x.Events.BUFFER_RESET,this.onBufferReset,this),o.off(x.Events.BUFFER_CREATED,this.onBufferCreated,this),o.off(x.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),o.off(x.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),o.off(x.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h.onInitPtsFound=function(o,s){var w=s.frag,C=s.id,v=s.initPTS;if(C==="main"){var M=w.cc;this.initPTS[w.cc]=v,this.log("InitPTS for cc: "+M+" found from main: "+v),this.videoTrackCC=M,this.state===N.State.WAITING_INIT_PTS&&this.tick()}},h.startLoad=function(o){if(!this.levels){this.startPosition=o,this.state=N.State.STOPPED;return}var s=this.lastCurrentTime;this.stopLoad(),this.setInterval(b),this.fragLoadError=0,s>0&&o===-1?(this.log("Override startPosition with lastCurrentTime @"+s.toFixed(3)),this.state=N.State.IDLE):(this.loadedmetadata=!1,this.state=N.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=o,this.tick()},h.doTick=function(){switch(this.state){case N.State.IDLE:this.doTickIdle();break;case N.State.WAITING_TRACK:{var o,s=this.levels,w=this.trackId,C=s==null||((o=s[w])===null||o===void 0)?void 0:o.details;if(C){if(this.waitForCdnTuneIn(C))break;this.state=N.State.WAITING_INIT_PTS}break}case N.State.FRAG_LOADING_WAITING_RETRY:{var v,M=performance.now(),B=this.retryDate;(!B||M>=B||(v=this.media)!==null&&v!==void 0&&v.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=N.State.IDLE);break}case N.State.WAITING_INIT_PTS:{var F=this.waitingData;if(F){var Q=F.frag,G=F.part,W=F.cache,$=F.complete;if(this.initPTS[Q.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=N.State.FRAG_LOADING;var re=W.flush(),ae={frag:Q,part:G,payload:re,networkDetails:null};this._handleFragmentLoadProgress(ae),$&&D.prototype._handleFragmentLoadComplete.call(this,ae)}else if(this.videoTrackCC!==this.waitingVideoCC)a.logger.log("Waiting fragment cc ("+Q.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var he=this.getLoadPosition(),Te=U.BufferHelper.bufferInfo(this.mediaBuffer,he,this.config.maxBufferHole),ye=Object(p.fragmentWithinToleranceTest)(Te.end,this.config.maxFragLookUpTolerance,Q);ye<0&&(a.logger.log("Waiting fragment cc ("+Q.cc+") @ "+Q.start+" cancelled because another fragment at "+Te.end+" is needed"),this.clearWaitingFragment())}}else this.state=N.State.IDLE}}this.onTickEnd()},h.clearWaitingFragment=function(){var o=this.waitingData;o&&(this.fragmentTracker.removeFragment(o.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=N.State.IDLE)},h.onTickEnd=function(){var o=this.media;if(!o||!o.readyState)return;var s=this.mediaBuffer?this.mediaBuffer:o,w=s.buffered;!this.loadedmetadata&&w.length&&(this.loadedmetadata=!0),this.lastCurrentTime=o.currentTime},h.doTickIdle=function(){var o,s,w=this.hls,C=this.levels,v=this.media,M=this.trackId,B=w.config;if(!C||!C[M])return;if(!v&&(this.startFragRequested||!B.startFragPrefetch))return;var F=C[M],Q=F.details;if(!Q||Q.live&&this.levelLastLoaded!==M||this.waitForCdnTuneIn(Q)){this.state=N.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,f.ElementaryStreamTypes.AUDIO,L.PlaylistLevelType.AUDIO));var G=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,L.PlaylistLevelType.AUDIO);if(G===null)return;var W=G.len,$=this.getMaxBufferLength(),re=this.audioSwitch;if(W>=$&&!re)return;if(!re&&this._streamEnded(G,Q)){w.trigger(x.Events.BUFFER_EOS,{type:"audio"}),this.state=N.State.ENDED;return}var ae=Q.fragments,he=ae[0].start,Te=G.end;if(re){var ye=this.getLoadPosition();Te=ye,Q.PTSKnown&&ye<he&&((G.end>he||G.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),v.currentTime=he+.05))}var Ee=this.getNextFragment(Te,Q);if(!Ee){this.bufferFlushed=!0;return}((o=Ee.decryptdata)===null||o===void 0?void 0:o.keyFormat)==="identity"&&!((s=Ee.decryptdata)!==null&&s!==void 0&&s.key)?this.loadKey(Ee,Q):this.loadFragment(Ee,Q,Te)},h.getMaxBufferLength=function(){var o=D.prototype.getMaxBufferLength.call(this),s=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,L.PlaylistLevelType.MAIN);return s===null?o:Math.max(o,s.len)},h.onMediaDetaching=function(){this.videoBuffer=null,D.prototype.onMediaDetaching.call(this)},h.onAudioTracksUpdated=function(o,s){var w=s.audioTracks;this.resetTransmuxer(),this.levels=w.map(function(C){return new E.Level(C)})},h.onAudioTrackSwitching=function(o,s){var w=!!s.url;this.trackId=s.id;var C=this.fragCurrent;C!=null&&C.loader&&C.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),w?this.setInterval(b):this.resetTransmuxer(),w?(this.audioSwitch=!0,this.state=N.State.IDLE):this.state=N.State.STOPPED,this.tick()},h.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},h.onLevelLoaded=function(o,s){this.mainDetails=s.details},h.onAudioTrackLoaded=function(o,s){var w,C=this.levels,v=s.details,M=s.id;if(!C){this.warn("Audio tracks were reset while loading level "+M);return}this.log("Track "+M+" loaded ["+v.startSN+","+v.endSN+"],duration:"+v.totalduration);var B=C[M],F=0;if(v.live||(w=B.details)!==null&&w!==void 0&&w.live){var Q=this.mainDetails;if(v.fragments[0]||(v.deltaUpdateFailed=!0),v.deltaUpdateFailed||!Q)return;!B.details&&v.hasProgramDateTime&&Q.hasProgramDateTime?(Object(m.alignMediaPlaylistByPDT)(v,Q),F=v.fragments[0].start):F=this.alignPlaylists(v,B.details)}B.details=v,this.levelLastLoaded=M,!this.startFragRequested&&(this.mainDetails||!v.live)&&this.setStartPosition(B.details,F),this.state===N.State.WAITING_TRACK&&!this.waitForCdnTuneIn(v)&&(this.state=N.State.IDLE),this.tick()},h._handleFragmentLoadProgress=function(o){var s,w=o.frag,C=o.part,v=o.payload,M=this.config,B=this.trackId,F=this.levels;if(!F){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+w.sn+" of level "+w.level+" will not be buffered");return}var Q=F[B];console.assert(Q,"Audio track is defined on fragment load progress");var G=Q.details;console.assert(G,"Audio track details are defined on fragment load progress");var W=M.defaultAudioCodec||Q.audioCodec||"mp4a.40.2",$=this.transmuxer;$||($=this.transmuxer=new P.default(this.hls,L.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var re=this.initPTS[w.cc],ae=(s=w.initSegment)===null||s===void 0?void 0:s.data;if(re!==void 0){var he=!1,Te=C?C.index:-1,ye=Te!==-1,Ee=new T.ChunkMetadata(w.level,w.sn,w.stats.chunkCount,v.byteLength,Te,ye);$.push(v,ae,W,"",w,C,G.totalduration,he,Ee,re)}else{a.logger.log("Unknown video PTS for cc "+w.cc+", waiting for video PTS before demuxing audio frag "+w.sn+" of ["+G.startSN+" ,"+G.endSN+"],track "+B);var Oe=this.waitingData=this.waitingData||{frag:w,part:C,cache:new S.default,complete:!1},_e=Oe.cache;_e.push(new Uint8Array(v)),this.waitingVideoCC=this.videoTrackCC,this.state=N.State.WAITING_INIT_PTS}},h._handleFragmentLoadComplete=function(o){if(this.waitingData){this.waitingData.complete=!0;return}D.prototype._handleFragmentLoadComplete.call(this,o)},h.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},h.onBufferCreated=function(o,s){var w=s.tracks.audio;w&&(this.mediaBuffer=w.buffer),s.tracks.video&&(this.videoBuffer=s.tracks.video.buffer)},h.onFragBuffered=function(o,s){var w=s.frag,C=s.part;if(w.type!==L.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(w)){this.warn("Fragment "+w.sn+(C?" p: "+C.index:"")+" of level "+w.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}w.sn!=="initSegment"&&(this.fragPrevious=w,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(x.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(w,C)},h.onError=function(o,s){switch(s.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(L.PlaylistLevelType.AUDIO,s);break;case i.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case i.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==N.State.ERROR&&this.state!==N.State.STOPPED&&(this.state=s.fatal?N.State.ERROR:N.State.IDLE,this.warn(s.details+" while loading frag, switching to "+this.state+" state"));break;case i.ErrorDetails.BUFFER_FULL_ERROR:if(s.parent==="audio"&&(this.state===N.State.PARSING||this.state===N.State.PARSED)){var w=!0,C=this.getFwdBufferInfo(this.mediaBuffer,L.PlaylistLevelType.AUDIO);C&&C.len>.5&&(w=!this.reduceMaxBufferLength(C.len)),w&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,D.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},h.onBufferFlushed=function(o,s){var w=s.type;w===f.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},h._handleTransmuxComplete=function(o){var s,w="audio",C=this.hls,v=o.remuxResult,M=o.chunkMeta,B=this.getCurrentContext(M);if(!B){this.warn("The loading context changed while buffering fragment "+M.sn+" of level "+M.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(M.level);return}var F=B.frag,Q=B.part,G=v.audio,W=v.text,$=v.id3,re=v.initSegment;if(this.fragContextChanged(F))return;if(this.state=N.State.PARSING,this.audioSwitch&&G&&this.completeAudioSwitch(),re!=null&&re.tracks&&(this._bufferInitSegment(re.tracks,F,M),C.trigger(x.Events.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:w,tracks:re.tracks})),G){var ae=G.startPTS,he=G.endPTS,Te=G.startDTS,ye=G.endDTS;Q&&(Q.elementaryStreams[f.ElementaryStreamTypes.AUDIO]={startPTS:ae,endPTS:he,startDTS:Te,endDTS:ye}),F.setElementaryStreamInfo(f.ElementaryStreamTypes.AUDIO,ae,he,Te,ye),this.bufferFragmentData(G,F,Q,M)}if($!=null&&(s=$.samples)!==null&&s!==void 0&&s.length){var Ee=u({frag:F,id:w},$);C.trigger(x.Events.FRAG_PARSING_METADATA,Ee)}if(W){var Oe=u({frag:F,id:w},W);C.trigger(x.Events.FRAG_PARSING_USERDATA,Oe)}},h._bufferInitSegment=function(o,s,w){if(this.state!==N.State.PARSING)return;o.video&&delete o.video;var C=o.audio;if(!C)return;C.levelCodec=C.codec,C.id="audio",this.log("Init audio buffer, container:"+C.container+", codecs[parsed]=["+C.codec+"]"),this.hls.trigger(x.Events.BUFFER_CODECS,o);var v=C.initSegment;if(v!=null&&v.byteLength){var M={type:"audio",frag:s,part:null,chunkMeta:w,parent:s.type,data:v};this.hls.trigger(x.Events.BUFFER_APPENDING,M)}this.tick()},h.loadFragment=function(o,s,w){var C=this.fragmentTracker.getState(o);this.fragCurrent=o,(this.audioSwitch||C===I.FragmentState.NOT_LOADED||C===I.FragmentState.PARTIAL)&&(o.sn==="initSegment"?this._loadInitSegment(o):s.live&&!Object(H.isFiniteNumber)(this.initPTS[o.cc])?(this.log("Waiting for video PTS in continuity counter "+o.cc+" of live stream before loading audio fragment "+o.sn+" of level "+this.trackId),this.state=N.State.WAITING_INIT_PTS):(this.startFragRequested=!0,D.prototype.loadFragment.call(this,o,s,w)))},h.completeAudioSwitch=function(){var o=this.hls,s=this.media,w=this.trackId;s&&(this.log("Switching audio track : flushing all audio"),D.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,o.trigger(x.Events.AUDIO_TRACK_SWITCHED,{id:w})},_}(N.default);K.default=y},"./src/controller/audio-track-controller.ts":function(J,K,R){"use strict";R.r(K);var H=R("./src/events.ts"),N=R("./src/errors.ts"),x=R("./src/controller/base-playlist-controller.ts"),U=R("./src/types/loader.ts");function I(P,T){for(var p=0;p<T.length;p++){var m=T[p];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(P,m.key,m)}}function E(P,T,p){return T&&I(P.prototype,T),p&&I(P,p),P}function L(P,T){P.prototype=Object.create(T.prototype),P.prototype.constructor=P,f(P,T)}function f(P,T){return f=Object.setPrototypeOf||function(m,i){return m.__proto__=i,m},f(P,T)}var S=function(P){L(T,P);function T(m){var i;return i=P.call(this,m,"[audio-track-controller]")||this,i.tracks=[],i.groupId=null,i.tracksInGroup=[],i.trackId=-1,i.trackName="",i.selectDefaultTrack=!0,i.registerListeners(),i}var p=T.prototype;return p.registerListeners=function(){var i=this.hls;i.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),i.on(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),i.on(H.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),i.on(H.Events.ERROR,this.onError,this)},p.unregisterListeners=function(){var i=this.hls;i.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.off(H.Events.LEVEL_LOADING,this.onLevelLoading,this),i.off(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),i.off(H.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),i.off(H.Events.ERROR,this.onError,this)},p.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,P.prototype.destroy.call(this)},p.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},p.onManifestParsed=function(i,a){this.tracks=a.audioTracks||[]},p.onAudioTrackLoaded=function(i,a){var u=a.id,c=a.details,O=this.tracksInGroup[u];if(!O){this.warn("Invalid audio track id "+u);return}var b=O.details;O.details=a.details,this.log("audioTrack "+u+" loaded ["+c.startSN+"-"+c.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,a,b))},p.onLevelLoading=function(i,a){this.switchLevel(a.level)},p.onLevelSwitching=function(i,a){this.switchLevel(a.level)},p.switchLevel=function(i){var a=this.hls.levels[i];if(!(a!=null&&a.audioGroupIds))return;var u=a.audioGroupIds[a.urlId];if(this.groupId!==u){this.groupId=u;var c=this.tracks.filter(function(b){return!u||b.groupId===u});this.selectDefaultTrack&&!c.some(function(b){return b.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=c;var O={audioTracks:c};this.log("Updating audio tracks, "+c.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(H.Events.AUDIO_TRACKS_UPDATED,O),this.selectInitialTrack()}},p.onError=function(i,a){if(P.prototype.onError.call(this,i,a),a.fatal||!a.context)return;a.context.type===U.PlaylistContextType.AUDIO_TRACK&&a.context.id===this.trackId&&a.context.groupId===this.groupId&&this.retryLoadingOrFail(a)},p.setAudioTrack=function(i){var a=this.tracksInGroup;if(i<0||i>=a.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var u=a[this.trackId];this.log("Now switching to audio-track index "+i);var c=a[i],O=c.id,b=c.groupId,y=b===void 0?"":b,D=c.name,_=c.type,h=c.url;if(this.trackId=i,this.trackName=D,this.selectDefaultTrack=!1,this.hls.trigger(H.Events.AUDIO_TRACK_SWITCHING,{id:O,groupId:y,name:D,type:_,url:h}),c.details&&!c.details.live)return;var d=this.switchParams(c.url,u==null?void 0:u.details);this.loadPlaylist(d)},p.selectInitialTrack=function(){var i=this.tracksInGroup;console.assert(i.length,"Initial audio track should be selected when tracks are known");var a=this.trackName,u=this.findTrackId(a)||this.findTrackId();u!==-1?this.setAudioTrack(u):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(H.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},p.findTrackId=function(i){for(var a=this.tracksInGroup,u=0;u<a.length;u++){var c=a[u];if((!this.selectDefaultTrack||c.default)&&(!i||i===c.name))return c.id}return-1},p.loadPlaylist=function(i){var a=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(a)){var u=a.id,c=a.groupId,O=a.url;if(i)try{O=i.addDirectives(O)}catch(b){this.warn("Could not construct new URL with HLS Delivery Directives: "+b)}this.log("loading audio-track playlist for id: "+u),this.clearTimer(),this.hls.trigger(H.Events.AUDIO_TRACK_LOADING,{url:O,id:u,groupId:c,deliveryDirectives:i||null})}},E(T,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(i){this.selectDefaultTrack=!1,this.setAudioTrack(i)}}]),T}(x.default);K.default=S},"./src/controller/base-playlist-controller.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return E});var H=R("./src/polyfills/number.ts"),N=R("./src/types/level.ts"),x=R("./src/controller/level-helper.ts"),U=R("./src/utils/logger.ts"),I=R("./src/errors.ts"),E=function(){function L(S,P){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=U.logger.log.bind(U.logger,P+":"),this.warn=U.logger.warn.bind(U.logger,P+":"),this.hls=S}var f=L.prototype;return f.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},f.onError=function(P,T){T.fatal&&T.type===I.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},f.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},f.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},f.stopLoad=function(){this.canLoad=!1,this.clearTimer()},f.switchParams=function(P,T){var p=T==null?void 0:T.renditionReports;if(p)for(var m=0;m<p.length;m++){var i=p[m],a=""+i.URI;if(a===P.substr(-a.length)){var u=parseInt(i["LAST-MSN"]),c=parseInt(i["LAST-PART"]);if(T&&this.hls.config.lowLatencyMode){var O=Math.min(T.age-T.partTarget,T.targetduration);c!==void 0&&O>T.partTarget&&(c+=1)}if(Object(H.isFiniteNumber)(u))return new N.HlsUrlParameters(u,Object(H.isFiniteNumber)(c)?c:void 0,N.HlsSkip.No)}}},f.loadPlaylist=function(P){},f.shouldLoadTrack=function(P){return this.canLoad&&P&&!!P.url&&(!P.details||P.details.live)},f.playlistLoaded=function(P,T,p){var m=this,i=T.details,a=T.stats,u=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(i.advancedDateTime=Date.now()-u,i.live||p!=null&&p.live){if(i.reloaded(p),p&&this.log("live playlist "+P+" "+(i.advanced?"REFRESHED "+i.lastPartSn+"-"+i.lastPartIndex:"MISSED")),p&&i.fragments.length>0&&Object(x.mergeDetails)(p,i),!this.canLoad||!i.live)return;var c,O=void 0,b=void 0;if(i.canBlockReload&&i.endSN&&i.advanced){var y=this.hls.config.lowLatencyMode,D=i.lastPartSn,_=i.endSN,h=i.lastPartIndex,d=h!==-1,o=D===_,s=y?0:h;d?(O=o?_+1:D,b=o?s:h+1):O=_+1;var w=i.age,C=w+i.ageHeader,v=Math.min(C-i.partTarget,i.targetduration*1.5);if(v>0){if(p&&v>p.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+p.tuneInGoal+" to: "+v+" with playlist age: "+i.age),v=0;else{var M=Math.floor(v/i.targetduration);if(O+=M,b!==void 0){var B=Math.round(v%i.targetduration/i.partTarget);b+=B}this.log("CDN Tune-in age: "+i.ageHeader+"s last advanced "+w.toFixed(2)+"s goal: "+v+" skip sn "+M+" to part "+b)}i.tuneInGoal=v}if(c=this.getDeliveryDirectives(i,T.deliveryDirectives,O,b),y||!o){this.loadPlaylist(c);return}}else c=this.getDeliveryDirectives(i,T.deliveryDirectives,O,b);var F=Object(x.computeReloadInterval)(i,a);O!==void 0&&i.canBlockReload&&(F-=i.partTarget||1),this.log("reload live playlist "+P+" in "+Math.round(F)+" ms"),this.timer=self.setTimeout(function(){return m.loadPlaylist(c)},F)}else this.clearTimer()},f.getDeliveryDirectives=function(P,T,p,m){var i=Object(N.getSkipValue)(P,p);return T!=null&&T.skip&&P.deltaUpdateFailed&&(p=T.msn,m=T.part,i=N.HlsSkip.No),new N.HlsUrlParameters(p,m,i)},f.retryLoadingOrFail=function(P){var T=this,p=this.hls.config,m=this.retryCount<p.levelLoadingMaxRetry;if(m){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 a=Math.min(Math.pow(2,this.retryCount)*p.levelLoadingRetryDelay,p.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return T.loadPlaylist()},a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+P.details+'"')}}else this.warn('cannot recover from error "'+P.details+'"'),this.clearTimer(),P.fatal=!0;return m},L}()},"./src/controller/base-stream-controller.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"State",function(){return _}),R.d(K,"default",function(){return h});var H=R("./src/polyfills/number.ts"),N=R("./src/task-loop.ts"),x=R("./src/controller/fragment-tracker.ts"),U=R("./src/utils/buffer-helper.ts"),I=R("./src/utils/logger.ts"),E=R("./src/events.ts"),L=R("./src/errors.ts"),f=R("./src/types/transmuxer.ts"),S=R("./src/utils/mp4-tools.ts"),P=R("./src/utils/discontinuities.ts"),T=R("./src/controller/fragment-finders.ts"),p=R("./src/controller/level-helper.ts"),m=R("./src/loader/fragment-loader.ts"),i=R("./src/crypt/decrypter.ts"),a=R("./src/utils/time-ranges.ts"),u=R("./src/types/loader.ts");function c(d,o){for(var s=0;s<o.length;s++){var w=o[s];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(d,w.key,w)}}function O(d,o,s){return o&&c(d.prototype,o),s&&c(d,s),d}function b(d){if(d===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d}function y(d,o){d.prototype=Object.create(o.prototype),d.prototype.constructor=d,D(d,o)}function D(d,o){return D=Object.setPrototypeOf||function(w,C){return w.__proto__=C,w},D(d,o)}var _={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"},h=function(d){y(o,d);function o(w,C,v){var M;return M=d.call(this)||this,M.hls=void 0,M.fragPrevious=null,M.fragCurrent=null,M.fragmentTracker=void 0,M.transmuxer=null,M._state=_.STOPPED,M.media=void 0,M.mediaBuffer=void 0,M.config=void 0,M.bitrateTest=!1,M.lastCurrentTime=0,M.nextLoadPosition=0,M.startPosition=0,M.loadedmetadata=!1,M.fragLoadError=0,M.retryDate=0,M.levels=null,M.fragmentLoader=void 0,M.levelLastLoaded=null,M.startFragRequested=!1,M.decrypter=void 0,M.initPTS=[],M.onvseeking=null,M.onvended=null,M.logPrefix="",M.log=void 0,M.warn=void 0,M.logPrefix=v,M.log=I.logger.log.bind(I.logger,v+":"),M.warn=I.logger.warn.bind(I.logger,v+":"),M.hls=w,M.fragmentLoader=new m.default(w.config),M.fragmentTracker=C,M.config=w.config,M.decrypter=new i.default(w,w.config),w.on(E.Events.KEY_LOADED,M.onKeyLoaded,b(M)),M}var s=o.prototype;return s.doTick=function(){this.onTickEnd()},s.onTickEnd=function(){},s.startLoad=function(C){},s.stopLoad=function(){this.fragmentLoader.abort();var C=this.fragCurrent;C&&this.fragmentTracker.removeFragment(C),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=_.STOPPED},s._streamEnded=function(C,v){var M=this.fragCurrent,B=this.fragmentTracker;if(!v.live&&M&&M.sn===v.endSN&&!C.nextStart){var F=B.getState(M);return F===x.FragmentState.PARTIAL||F===x.FragmentState.OK}return!1},s.onMediaAttached=function(C,v){var M=this.media=this.mediaBuffer=v.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),M.addEventListener("seeking",this.onvseeking),M.addEventListener("ended",this.onvended);var B=this.config;this.levels&&B.autoStartLoad&&this.state===_.STOPPED&&this.startLoad(B.startPosition)},s.onMediaDetaching=function(){var C=this.media;C!=null&&C.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),C&&(C.removeEventListener("seeking",this.onvseeking),C.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},s.onMediaSeeking=function(){var C=this.config,v=this.fragCurrent,M=this.media,B=this.mediaBuffer,F=this.state,Q=M?M.currentTime:0,G=U.BufferHelper.bufferInfo(B||M,Q,C.maxBufferHole);if(this.log("media seeking to "+(Object(H.isFiniteNumber)(Q)?Q.toFixed(3):Q)+", state: "+F),F===_.ENDED)this.resetLoadingState();else if(v&&!G.len){var W=C.maxFragLookUpTolerance,$=v.start-W,re=v.start+v.duration+W,ae=Q>re;(Q<$||ae)&&(ae&&v.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),v.loader.abort()),this.resetLoadingState())}M&&(this.lastCurrentTime=Q),!this.loadedmetadata&&!G.len&&(this.nextLoadPosition=this.startPosition=Q),this.tickImmediate()},s.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},s.onKeyLoaded=function(C,v){if(this.state!==_.KEY_LOADING||v.frag!==this.fragCurrent||!this.levels)return;this.state=_.IDLE;var M=this.levels[v.frag.level].details;M&&this.loadFragment(v.frag,M,v.frag.start)},s.onHandlerDestroying=function(){this.stopLoad(),d.prototype.onHandlerDestroying.call(this)},s.onHandlerDestroyed=function(){this.state=_.STOPPED,this.hls.off(E.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,d.prototype.onHandlerDestroyed.call(this)},s.loadKey=function(C,v){this.log("Loading key for "+C.sn+" of ["+v.startSN+"-"+v.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+C.level),this.state=_.KEY_LOADING,this.fragCurrent=C,this.hls.trigger(E.Events.KEY_LOADING,{frag:C})},s.loadFragment=function(C,v,M){this._loadFragForPlayback(C,v,M)},s._loadFragForPlayback=function(C,v,M){var B=this,F=function(G){if(B.fragContextChanged(C)){B.warn("Fragment "+C.sn+(G.part?" p: "+G.part.index:"")+" of level "+C.level+" was dropped during download."),B.fragmentTracker.removeFragment(C);return}C.stats.chunkCount++,B._handleFragmentLoadProgress(G)};this._doFragLoad(C,v,M,F).then(function(Q){if(!Q)return;B.fragLoadError=0;var G=B.state;if(B.fragContextChanged(C)){(G===_.FRAG_LOADING||G===_.BACKTRACKING||!B.fragCurrent&&G===_.PARSING)&&(B.fragmentTracker.removeFragment(C),B.state=_.IDLE);return}if("payload"in Q&&(B.log("Loaded fragment "+C.sn+" of level "+C.level),B.hls.trigger(E.Events.FRAG_LOADED,Q),B.state===_.BACKTRACKING)){B.fragmentTracker.backtrack(C,Q),B.resetFragmentLoading(C);return}B._handleFragmentLoadComplete(Q)}).catch(function(Q){B.warn(Q),B.resetFragmentLoading(C)})},s.flushMainBuffer=function(C,v,M){if(M===void 0&&(M=null),!(C-v))return;var B={startOffset:C,endOffset:v,type:M};this.fragLoadError=0,this.hls.trigger(E.Events.BUFFER_FLUSHING,B)},s._loadInitSegment=function(C){var v=this;this._doFragLoad(C).then(function(M){if(!M||v.fragContextChanged(C)||!v.levels)throw new Error("init load aborted");return M}).then(function(M){var B=v.hls,F=M.payload,Q=C.decryptdata;if(F&&F.byteLength>0&&Q&&Q.key&&Q.iv&&Q.method==="AES-128"){var G=self.performance.now();return v.decrypter.webCryptoDecrypt(new Uint8Array(F),Q.key.buffer,Q.iv.buffer).then(function(W){var $=self.performance.now();return B.trigger(E.Events.FRAG_DECRYPTED,{frag:C,payload:W,stats:{tstart:G,tdecrypt:$}}),M.payload=W,M})}return M}).then(function(M){var B=v.fragCurrent,F=v.hls,Q=v.levels;if(!Q)throw new Error("init load aborted, missing levels");var G=Q[C.level].details;console.assert(G,"Level details are defined when init segment is loaded");var W=C.stats;v.state=_.IDLE,v.fragLoadError=0,C.data=new Uint8Array(M.payload),W.parsing.start=W.buffering.start=self.performance.now(),W.parsing.end=W.buffering.end=self.performance.now(),M.frag===B&&F.trigger(E.Events.FRAG_BUFFERED,{stats:W,frag:B,part:null,id:C.type}),v.tick()}).catch(function(M){v.warn(M),v.resetFragmentLoading(C)})},s.fragContextChanged=function(C){var v=this.fragCurrent;return!C||!v||C.level!==v.level||C.sn!==v.sn||C.urlId!==v.urlId},s.fragBufferedComplete=function(C,v){var M=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+C.type+" sn: "+C.sn+(v?" part: "+v.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+C.level+" "+a.default.toString(U.BufferHelper.getBuffered(M))),this.state=_.IDLE,this.tick()},s._handleFragmentLoadComplete=function(C){var v=this.transmuxer;if(!v)return;var M=C.frag,B=C.part,F=C.partsLoaded,Q=!F||F.length===0||F.some(function(W){return!W}),G=new f.ChunkMetadata(M.level,M.sn,M.stats.chunkCount+1,0,B?B.index:-1,!Q);v.flush(G)},s._handleFragmentLoadProgress=function(C){},s._doFragLoad=function(C,v,M,B){var F=this;if(M===void 0&&(M=null),!this.levels)throw new Error("frag load aborted, missing levels");if(M=Math.max(C.start,M||0),this.config.lowLatencyMode&&v){var Q=v.partList;if(Q&&B){M>C.end&&v.fragmentHint&&(C=v.fragmentHint);var G=this.getNextPart(Q,C,M);if(G>-1){var W=Q[G];return this.log("Loading part sn: "+C.sn+" p: "+W.index+" cc: "+C.cc+" of playlist ["+v.startSN+"-"+v.endSN+"] parts [0-"+G+"-"+(Q.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+C.level+", target: "+parseFloat(M.toFixed(3))),this.nextLoadPosition=W.start+W.duration,this.state=_.FRAG_LOADING,this.hls.trigger(E.Events.FRAG_LOADING,{frag:C,part:Q[G],targetBufferTime:M}),this.doFragPartsLoad(C,Q,G,B).catch(function($){return F.handleFragLoadError($)})}else if(!C.url||this.loadedEndOfParts(Q,M))return Promise.resolve(null)}}return this.log("Loading fragment "+C.sn+" cc: "+C.cc+" "+(v?"of ["+v.startSN+"-"+v.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+C.level+", target: "+parseFloat(M.toFixed(3))),Object(H.isFiniteNumber)(C.sn)&&!this.bitrateTest&&(this.nextLoadPosition=C.start+C.duration),this.state=_.FRAG_LOADING,this.hls.trigger(E.Events.FRAG_LOADING,{frag:C,targetBufferTime:M}),this.fragmentLoader.load(C,B).catch(function($){return F.handleFragLoadError($)})},s.doFragPartsLoad=function(C,v,M,B){var F=this;return new Promise(function(Q,G){var W=[],$=function re(ae){var he=v[ae];F.fragmentLoader.loadPart(C,he,B).then(function(Te){W[he.index]=Te;var ye=Te.part;F.hls.trigger(E.Events.FRAG_LOADED,Te);var Ee=v[ae+1];if(Ee&&Ee.fragment===C)re(ae+1);else return Q({frag:C,part:ye,partsLoaded:W})}).catch(G)};$(M)})},s.handleFragLoadError=function(C){var v=C.data;return v&&v.details===L.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(v.frag,v.part):this.hls.trigger(E.Events.ERROR,v),null},s._handleTransmuxerFlush=function(C){var v=this.getCurrentContext(C);if(!v||this.state!==_.PARSING){this.fragCurrent||(this.state=_.IDLE);return}var M=v.frag,B=v.part,F=v.level,Q=self.performance.now();M.stats.parsing.end=Q,B&&(B.stats.parsing.end=Q),this.updateLevelTiming(M,B,F,C.partial)},s.getCurrentContext=function(C){var v=this.levels,M=C.level,B=C.sn,F=C.part;if(!v||!v[M])return this.warn("Levels object was unset while buffering fragment "+B+" of level "+M+". The current chunk will not be buffered."),null;var Q=v[M],G=F>-1?Object(p.getPartWith)(Q,B,F):null,W=G?G.fragment:Object(p.getFragmentWithSN)(Q,B,this.fragCurrent);return W?{frag:W,part:G,level:Q}:null},s.bufferFragmentData=function(C,v,M,B){if(!C||this.state!==_.PARSING)return;var F=C.data1,Q=C.data2,G=F;if(F&&Q&&(G=Object(S.appendUint8Array)(F,Q)),!G||!G.length)return;var W={type:C.type,frag:v,part:M,chunkMeta:B,parent:v.type,data:G};this.hls.trigger(E.Events.BUFFER_APPENDING,W),C.dropped&&C.independent&&!M&&this.flushBufferGap(v)},s.flushBufferGap=function(C){var v=this.media;if(!v)return;if(!U.BufferHelper.isBuffered(v,v.currentTime)){this.flushMainBuffer(0,C.start);return}var M=v.currentTime,B=U.BufferHelper.bufferInfo(v,M,0),F=C.duration,Q=Math.min(this.config.maxFragLookUpTolerance*2,F*.25),G=Math.max(Math.min(C.start-Q,B.end-Q),M+Q);C.start-G>Q&&this.flushMainBuffer(G,C.start)},s.getFwdBufferInfo=function(C,v){var M=this.config,B=this.getLoadPosition();if(!Object(H.isFiniteNumber)(B))return null;var F=U.BufferHelper.bufferInfo(C,B,M.maxBufferHole);if(F.len===0&&F.nextStart!==void 0){var Q=this.fragmentTracker.getBufferedFrag(B,v);if(Q&&F.nextStart<Q.end)return U.BufferHelper.bufferInfo(C,B,Math.max(F.nextStart,M.maxBufferHole))}return F},s.getMaxBufferLength=function(C){var v=this.config,M;return C?M=Math.max(8*v.maxBufferSize/C,v.maxBufferLength):M=v.maxBufferLength,Math.min(M,v.maxMaxBufferLength)},s.reduceMaxBufferLength=function(C){var v=this.config,M=C||v.maxBufferLength;return v.maxMaxBufferLength>=M?(v.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+v.maxMaxBufferLength+"s"),!0):!1},s.getNextFragment=function(C,v){var M,B,F=v.fragments,Q=F.length;if(!Q)return null;var G=this.config,W=F[0].start,$;if(v.live){var re=G.initialLiveManifestSize;if(Q<re)return this.warn("Not enough fragments to start playback (have: "+Q+", need: "+re+")"),null;!v.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&($=this.getInitialLiveFragment(v,F),this.startPosition=$?this.hls.liveSyncPosition||$.start:C)}else C<=W&&($=F[0]);if(!$){var ae=G.lowLatencyMode?v.partEnd:v.fragmentEnd;$=this.getFragmentAtPosition(C,ae,v)}return(M=$)!==null&&M!==void 0&&M.initSegment&&!((B=$)!==null&&B!==void 0&&B.initSegment.data)&&!this.bitrateTest&&($=$.initSegment),$},s.getNextPart=function(C,v,M){for(var B=-1,F=!1,Q=!0,G=0,W=C.length;G<W;G++){var $=C[G];if(Q=Q&&!$.independent,B>-1&&M<$.start)break;var re=$.loaded;!re&&(F||$.independent||Q)&&$.fragment===v&&(B=G),F=re}return B},s.loadedEndOfParts=function(C,v){var M=C[C.length-1];return M&&v>M.start&&M.loaded},s.getInitialLiveFragment=function(C,v){var M=this.fragPrevious,B=null;if(M){if(C.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+M.programDateTime),B=Object(T.findFragmentByPDT)(v,M.endProgramDateTime,this.config.maxFragLookUpTolerance)),!B){var F=M.sn+1;if(F>=C.startSN&&F<=C.endSN){var Q=v[F-C.startSN];M.cc===Q.cc&&(B=Q,this.log("Live playlist, switching playlist, load frag with next SN: "+B.sn))}B||(B=Object(T.findFragWithCC)(v,M.cc),B&&this.log("Live playlist, switching playlist, load frag with same CC: "+B.sn))}}else{var G=this.hls.liveSyncPosition;G!==null&&(B=this.getFragmentAtPosition(G,this.bitrateTest?C.fragmentEnd:C.edge,C))}return B},s.getFragmentAtPosition=function(C,v,M){var B=this.config,F=this.fragPrevious,Q=M.fragments,G=M.endSN,W=M.fragmentHint,$=B.maxFragLookUpTolerance,re=!!(B.lowLatencyMode&&M.partList&&W);re&&W&&!this.bitrateTest&&(Q=Q.concat(W),G=W.sn);var ae;if(C<v){var he=C>v-$?0:$;ae=Object(T.findFragmentByPTS)(F,Q,C,he)}else ae=Q[Q.length-1];if(ae){var Te=ae.sn-M.startSN,ye=F&&ae.level===F.level,Ee=Q[Te+1],Oe=this.fragmentTracker.getState(ae);if(Oe===x.FragmentState.BACKTRACKED){ae=null;for(var _e=Te;Q[_e]&&this.fragmentTracker.getState(Q[_e])===x.FragmentState.BACKTRACKED;)F?ae=Q[_e--]:ae=Q[--_e];ae||(ae=Ee)}else F&&ae.sn===F.sn&&!re&&(ye&&(ae.sn<G&&this.fragmentTracker.getState(Ee)!==x.FragmentState.OK?(this.log("SN "+ae.sn+" just loaded, load next one: "+Ee.sn),ae=Ee):ae=null))}return ae},s.synchronizeToLiveEdge=function(C){var v=this.config,M=this.media;if(!M)return;var B=this.hls.liveSyncPosition,F=M.currentTime,Q=C.fragments[0].start,G=C.edge,W=F>=Q-v.maxFragLookUpTolerance&&F<=G;if(B!==null&&M.duration>B&&(F<B||!W)){var $=v.liveMaxLatencyDuration!==void 0?v.liveMaxLatencyDuration:v.liveMaxLatencyDurationCount*C.targetduration;(!W&&M.readyState<4||F<G-$)&&(this.loadedmetadata||(this.nextLoadPosition=B),M.readyState&&(this.warn("Playback: "+F.toFixed(3)+" is located too far from the end of live sliding playlist: "+G+", reset currentTime to : "+B.toFixed(3)),M.currentTime=B))}},s.alignPlaylists=function(C,v){var M=this.levels,B=this.levelLastLoaded,F=this.fragPrevious,Q=B!==null?M[B]:null,G=C.fragments.length;if(!G)return this.warn("No fragments in live playlist"),0;var W=C.fragments[0].start,$=!v,re=C.alignedSliding&&Object(H.isFiniteNumber)(W);if($||!re&&!W){Object(P.alignStream)(F,Q,C);var ae=C.fragments[0].start;return this.log("Live playlist sliding: "+ae.toFixed(2)+" start-sn: "+(v?v.startSN:"na")+"->"+C.startSN+" prev-sn: "+(F?F.sn:"na")+" fragments: "+G),ae}return W},s.waitForCdnTuneIn=function(C){var v=3;return C.live&&C.canBlockReload&&C.tuneInGoal>Math.max(C.partHoldBack,C.partTarget*v)},s.setStartPosition=function(C,v){var M=this.startPosition;if(M<v&&(M=-1),M===-1||this.lastCurrentTime===-1){var B=C.startTimeOffset;Object(H.isFiniteNumber)(B)?(M=v+B,B<0&&(M+=C.totalduration),M=Math.min(Math.max(v,M),v+C.totalduration),this.log("Start time offset "+B+" found in playlist, adjust startPosition to "+M),this.startPosition=M):C.live?M=this.hls.liveSyncPosition||v:this.startPosition=M=0,this.lastCurrentTime=M}this.nextLoadPosition=M},s.getLoadPosition=function(){var C=this.media,v=0;return this.loadedmetadata&&C?v=C.currentTime:this.nextLoadPosition&&(v=this.nextLoadPosition),v},s.handleFragLoadAborted=function(C,v){this.transmuxer&&C.sn!=="initSegment"&&C.stats.aborted&&(this.warn("Fragment "+C.sn+(v?" part"+v.index:"")+" of level "+C.level+" was aborted"),this.resetFragmentLoading(C))},s.resetFragmentLoading=function(C){(!this.fragCurrent||!this.fragContextChanged(C))&&(this.state=_.IDLE)},s.onFragmentOrKeyLoadError=function(C,v){if(v.fatal)return;var M=v.frag;if(!M||M.type!==C)return;var B=this.fragCurrent;console.assert(B&&M.sn===B.sn&&M.level===B.level&&M.urlId===B.urlId,"Frag load error must match current frag to retry");var F=this.config;if(this.fragLoadError+1<=F.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(M.level))return;var Q=Math.min(Math.pow(2,this.fragLoadError)*F.fragLoadingRetryDelay,F.fragLoadingMaxRetryTimeout);this.warn("Fragment "+M.sn+" of "+C+" "+M.level+" failed to load, retrying in "+Q+"ms"),this.retryDate=self.performance.now()+Q,this.fragLoadError++,this.state=_.FRAG_LOADING_WAITING_RETRY}else v.levelRetry?(C===u.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=_.IDLE):(I.logger.error(v.details+" reaches max retry, redispatch as fatal ..."),v.fatal=!0,this.hls.stopLoad(),this.state=_.ERROR)},s.afterBufferFlushed=function(C,v,M){if(!C)return;var B=U.BufferHelper.getBuffered(C);this.fragmentTracker.detectEvictedFragments(v,B,M),this.state===_.ENDED&&this.resetLoadingState()},s.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=_.IDLE},s.resetLiveStartWhenNotLoaded=function(C){if(!this.loadedmetadata){this.startFragRequested=!1;var v=this.levels?this.levels[C].details:null;if(v!=null&&v.live)return this.startPosition=-1,this.setStartPosition(v,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},s.updateLevelTiming=function(C,v,M,B){var F=this,Q=M.details;console.assert(!!Q,"level.details must be defined");var G=Object.keys(C.elementaryStreams).reduce(function(W,$){var re=C.elementaryStreams[$];if(re){var ae=re.endPTS-re.startPTS;if(ae<=0)return F.warn("Could not parse fragment "+C.sn+" "+$+" duration reliably ("+ae+") resetting transmuxer to fallback to playlist timing"),F.resetTransmuxer(),W||!1;var he=B?0:Object(p.updateFragPTSDTS)(Q,C,re.startPTS,re.endPTS,re.startDTS,re.endDTS);return F.hls.trigger(E.Events.LEVEL_PTS_UPDATED,{details:Q,level:M,drift:he,type:$,frag:C,start:re.startPTS,end:re.endPTS}),!0}return W},!1);G?(this.state=_.PARSED,this.hls.trigger(E.Events.FRAG_PARSED,{frag:C,part:v})):this.resetLoadingState()},s.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},O(o,[{key:"state",get:function(){return this._state},set:function(C){var v=this._state;v!==C&&(this._state=C,this.log(v+"->"+C))}}]),o}(N.default)},"./src/controller/buffer-controller.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return T});var H=R("./src/polyfills/number.ts"),N=R("./src/events.ts"),x=R("./src/utils/logger.ts"),U=R("./src/errors.ts"),I=R("./src/utils/buffer-helper.ts"),E=R("./src/utils/mediasource-helper.ts"),L=R("./src/loader/fragment.ts"),f=R("./src/controller/buffer-operation-queue.ts"),S=Object(E.getMediaSource)(),P=/([ha]vc.)(?:\.[^.,]+)+/,T=function(){function p(i){var a=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 u=a.hls,c=a.media,O=a.mediaSource;x.logger.log("[buffer-controller]: Media source opened"),c&&(a.updateMediaElementDuration(),u.trigger(N.Events.MEDIA_ATTACHED,{media:c})),O&&O.removeEventListener("sourceopen",a._onMediaSourceOpen),a.checkPendingTracks()},this._onMediaSourceClose=function(){x.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){x.logger.log("[buffer-controller]: Media source ended")},this.hls=i,this._initSourceBuffer(),this.registerListeners()}var m=p.prototype;return m.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},m.destroy=function(){this.unregisterListeners(),this.details=null},m.registerListeners=function(){var a=this.hls;a.on(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(N.Events.BUFFER_RESET,this.onBufferReset,this),a.on(N.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.on(N.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.on(N.Events.BUFFER_EOS,this.onBufferEos,this),a.on(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(N.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(N.Events.FRAG_PARSED,this.onFragParsed,this),a.on(N.Events.FRAG_CHANGED,this.onFragChanged,this)},m.unregisterListeners=function(){var a=this.hls;a.off(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(N.Events.BUFFER_RESET,this.onBufferReset,this),a.off(N.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.off(N.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.off(N.Events.BUFFER_EOS,this.onBufferEos,this),a.off(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(N.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(N.Events.FRAG_PARSED,this.onFragParsed,this),a.off(N.Events.FRAG_CHANGED,this.onFragChanged,this)},m._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new f.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},m.onManifestParsed=function(a,u){var c=2;(u.audio&&!u.video||!u.altAudio)&&(c=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=c,this.details=null,x.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},m.onMediaAttaching=function(a,u){var c=this.media=u.media;if(c&&S){var O=this.mediaSource=new S;O.addEventListener("sourceopen",this._onMediaSourceOpen),O.addEventListener("sourceended",this._onMediaSourceEnded),O.addEventListener("sourceclose",this._onMediaSourceClose),c.src=self.URL.createObjectURL(O),this._objectUrl=c.src}},m.onMediaDetaching=function(){var a=this.media,u=this.mediaSource,c=this._objectUrl;if(u){if(x.logger.log("[buffer-controller]: media source detaching"),u.readyState==="open")try{u.endOfStream()}catch(O){x.logger.warn("[buffer-controller]: onMediaDetaching: "+O.message+" while calling endOfStream")}this.onBufferReset(),u.removeEventListener("sourceopen",this._onMediaSourceOpen),u.removeEventListener("sourceended",this._onMediaSourceEnded),u.removeEventListener("sourceclose",this._onMediaSourceClose),a&&(c&&self.URL.revokeObjectURL(c),a.src===c?(a.removeAttribute("src"),a.load()):x.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(N.Events.MEDIA_DETACHED,void 0)},m.onBufferReset=function(){var a=this;this.getSourceBufferTypes().forEach(function(u){var c=a.sourceBuffer[u];try{c&&(a.removeBufferListeners(u),a.mediaSource&&a.mediaSource.removeSourceBuffer(c),a.sourceBuffer[u]=void 0)}catch(O){x.logger.warn("[buffer-controller]: Failed to reset the "+u+" buffer",O)}}),this._initSourceBuffer()},m.onBufferCodecs=function(a,u){var c=this,O=this.getSourceBufferTypes().length;if(Object.keys(u).forEach(function(b){if(O){var y=c.tracks[b];if(y&&typeof y.buffer.changeType=="function"){var D=u[b],_=D.codec,h=D.levelCodec,d=D.container,o=(y.levelCodec||y.codec).replace(P,"$1"),s=(h||_).replace(P,"$1");if(o!==s){var w=d+";codecs="+(h||_);c.appendChangeType(b,w)}}}else c.pendingTracks[b]=u[b]}),O)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},m.appendChangeType=function(a,u){var c=this,O=this.operationQueue,b={execute:function(){var D=c.sourceBuffer[a];D&&(x.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+u),D.changeType(u)),O.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(D){x.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",D)}};O.append(b,a)},m.onBufferAppending=function(a,u){var c=this,O=this.hls,b=this.operationQueue,y=this.tracks,D=u.data,_=u.type,h=u.frag,d=u.part,o=u.chunkMeta,s=o.buffering[_],w=self.performance.now();s.start=w;var C=h.stats.buffering,v=d?d.stats.buffering:null;C.start===0&&(C.start=w),v&&v.start===0&&(v.start=w);var M=y.audio,B=_==="audio"&&o.id===1&&(M==null?void 0:M.container)==="audio/mpeg",F={execute:function(){if(s.executeStart=self.performance.now(),B){var G=c.sourceBuffer[_];if(G){var W=h.start-G.timestampOffset;Math.abs(W)>=.1&&(x.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+h.start+" (delta: "+W+") sn: "+h.sn+")"),G.timestampOffset=h.start)}}c.appendExecutor(D,_)},onStart:function(){},onComplete:function(){var G=self.performance.now();s.executeEnd=s.end=G,C.first===0&&(C.first=G),v&&v.first===0&&(v.first=G);var W=c.sourceBuffer,$={};for(var re in W)$[re]=I.BufferHelper.getBuffered(W[re]);c.appendError=0,c.hls.trigger(N.Events.BUFFER_APPENDED,{type:_,frag:h,part:d,chunkMeta:o,parent:h.type,timeRanges:$})},onError:function(G){x.logger.error("[buffer-controller]: Error encountered while trying to append to the "+_+" SourceBuffer",G);var W={type:U.ErrorTypes.MEDIA_ERROR,parent:h.type,details:U.ErrorDetails.BUFFER_APPEND_ERROR,err:G,fatal:!1};G.code===DOMException.QUOTA_EXCEEDED_ERR?W.details=U.ErrorDetails.BUFFER_FULL_ERROR:(c.appendError++,W.details=U.ErrorDetails.BUFFER_APPEND_ERROR,c.appendError>O.config.appendErrorMaxRetry&&(x.logger.error("[buffer-controller]: Failed "+O.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),W.fatal=!0)),O.trigger(N.Events.ERROR,W)}};b.append(F,_)},m.onBufferFlushing=function(a,u){var c=this,O=this.operationQueue,b=function(D){return{execute:c.removeExecutor.bind(c,D,u.startOffset,u.endOffset),onStart:function(){},onComplete:function(){c.hls.trigger(N.Events.BUFFER_FLUSHED,{type:D})},onError:function(h){x.logger.warn("[buffer-controller]: Failed to remove from "+D+" SourceBuffer",h)}}};u.type?O.append(b(u.type),u.type):this.getSourceBufferTypes().forEach(function(y){O.append(b(y),y)})},m.onFragParsed=function(a,u){var c=this,O=u.frag,b=u.part,y=[],D=b?b.elementaryStreams:O.elementaryStreams;D[L.ElementaryStreamTypes.AUDIOVIDEO]?y.push("audiovideo"):(D[L.ElementaryStreamTypes.AUDIO]&&y.push("audio"),D[L.ElementaryStreamTypes.VIDEO]&&y.push("video"));var _=function(){var d=self.performance.now();O.stats.buffering.end=d,b&&(b.stats.buffering.end=d);var o=b?b.stats:O.stats;c.hls.trigger(N.Events.FRAG_BUFFERED,{frag:O,part:b,stats:o,id:O.type})};y.length===0&&x.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+O.type+" level: "+O.level+" sn: "+O.sn),this.blockBuffers(_,y)},m.onFragChanged=function(a,u){this.flushBackBuffer()},m.onBufferEos=function(a,u){var c=this,O=this.getSourceBufferTypes().reduce(function(b,y){var D=c.sourceBuffer[y];return(!u.type||u.type===y)&&(D&&!D.ended&&(D.ended=!0,x.logger.log("[buffer-controller]: "+y+" sourceBuffer now EOS"))),b&&!!(!D||D.ended)},!0);O&&this.blockBuffers(function(){var b=c.mediaSource;if(!b||b.readyState!=="open")return;b.endOfStream()})},m.onLevelUpdated=function(a,u){var c=u.details;if(!c.fragments.length)return;this.details=c,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},m.flushBackBuffer=function(){var a=this.hls,u=this.details,c=this.media,O=this.sourceBuffer;if(!c||u===null)return;var b=this.getSourceBufferTypes();if(!b.length)return;var y=u.live&&a.config.liveBackBufferLength!==null?a.config.liveBackBufferLength:a.config.backBufferLength;if(!Object(H.isFiniteNumber)(y)||y<0)return;var D=c.currentTime,_=u.levelTargetDuration,h=Math.max(y,_),d=Math.floor(D/_)*_-h;b.forEach(function(o){var s=O[o];if(s){var w=I.BufferHelper.getBuffered(s);w.length>0&&d>w.start(0)&&(a.trigger(N.Events.BACK_BUFFER_REACHED,{bufferEnd:d}),u.live&&a.trigger(N.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:d}),a.trigger(N.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:d,type:o}))}})},m.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var a=this.details,u=this.hls,c=this.media,O=this.mediaSource,b=a.fragments[0].start+a.totalduration,y=c.duration,D=Object(H.isFiniteNumber)(O.duration)?O.duration:0;a.live&&u.config.liveDurationInfinity?(x.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),O.duration=Infinity,this.updateSeekableRange(a)):(b>D&&b>y||!Object(H.isFiniteNumber)(y))&&(x.logger.log("[buffer-controller]: Updating Media Source duration to "+b.toFixed(3)),O.duration=b)},m.updateSeekableRange=function(a){var u=this.mediaSource,c=a.fragments,O=c.length;if(O&&a.live&&u!==null&&u!==void 0&&u.setLiveSeekableRange){var b=Math.max(0,c[0].start),y=Math.max(b,b+a.totalduration);u.setLiveSeekableRange(b,y)}},m.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,u=this.operationQueue,c=this.pendingTracks,O=Object.keys(c).length;if(O&&!a||O===2){this.createSourceBuffers(c),this.pendingTracks={};var b=this.getSourceBufferTypes();if(b.length===0){this.hls.trigger(N.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}b.forEach(function(y){u.executeNext(y)})}},m.createSourceBuffers=function(a){var u=this.sourceBuffer,c=this.mediaSource;if(!c)throw Error("createSourceBuffers called when mediaSource was null");var O=0;for(var b in a)if(!u[b]){var y=a[b];if(!y)throw Error("source buffer exists for track "+b+", however track does not");var D=y.levelCodec||y.codec,_=y.container+";codecs="+D;x.logger.log("[buffer-controller]: creating sourceBuffer("+_+")");try{var h=u[b]=c.addSourceBuffer(_),d=b;this.addBufferListener(d,"updatestart",this._onSBUpdateStart),this.addBufferListener(d,"updateend",this._onSBUpdateEnd),this.addBufferListener(d,"error",this._onSBUpdateError),this.tracks[b]={buffer:h,codec:D,container:y.container,levelCodec:y.levelCodec,id:y.id},O++}catch(o){x.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+o.message),this.hls.trigger(N.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:o,mimeType:_})}}O&&this.hls.trigger(N.Events.BUFFER_CREATED,{tracks:this.tracks})},m._onSBUpdateStart=function(a){var u=this.operationQueue,c=u.current(a);c.onStart()},m._onSBUpdateEnd=function(a){var u=this.operationQueue,c=u.current(a);c.onComplete(),u.shiftAndExecuteNext(a)},m._onSBUpdateError=function(a,u){x.logger.error("[buffer-controller]: "+a+" SourceBuffer error",u),this.hls.trigger(N.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var c=this.operationQueue.current(a);c&&c.onError(u)},m.removeExecutor=function(a,u,c){var O=this.media,b=this.mediaSource,y=this.operationQueue,D=this.sourceBuffer,_=D[a];if(!O||!b||!_){x.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),y.shiftAndExecuteNext(a);return}var h=Object(H.isFiniteNumber)(O.duration)?O.duration:Infinity,d=Object(H.isFiniteNumber)(b.duration)?b.duration:Infinity,o=Math.max(0,u),s=Math.min(c,h,d);s>o?(x.logger.log("[buffer-controller]: Removing ["+o+","+s+"] from the "+a+" SourceBuffer"),console.assert(!_.updating,a+" sourceBuffer must not be updating"),_.remove(o,s)):y.shiftAndExecuteNext(a)},m.appendExecutor=function(a,u){var c=this.operationQueue,O=this.sourceBuffer,b=O[u];if(!b){x.logger.warn("[buffer-controller]: Attempting to append to the "+u+" SourceBuffer, but it does not exist"),c.shiftAndExecuteNext(u);return}b.ended=!1,console.assert(!b.updating,u+" sourceBuffer must not be updating"),b.appendBuffer(a)},m.blockBuffers=function(a,u){var c=this;if(u===void 0&&(u=this.getSourceBufferTypes()),!u.length){x.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(a);return}var O=this.operationQueue,b=u.map(function(y){return O.appendBlocker(y)});Promise.all(b).then(function(){a(),u.forEach(function(y){var D=c.sourceBuffer[y];(!D||!D.updating)&&O.shiftAndExecuteNext(y)})})},m.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},m.addBufferListener=function(a,u,c){var O=this.sourceBuffer[a];if(!O)return;var b=c.bind(this,a);this.listeners[a].push({event:u,listener:b}),O.addEventListener(u,b)},m.removeBufferListeners=function(a){var u=this.sourceBuffer[a];if(!u)return;this.listeners[a].forEach(function(c){u.removeEventListener(c.event,c.listener)})},p}()},"./src/controller/buffer-operation-queue.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return N});var H=R("./src/utils/logger.ts"),N=function(){function x(I){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=I}var U=x.prototype;return U.append=function(E,L){var f=this.queues[L];f.push(E),f.length===1&&this.buffers[L]&&this.executeNext(L)},U.insertAbort=function(E,L){var f=this.queues[L];f.unshift(E),this.executeNext(L)},U.appendBlocker=function(E){var L,f=new Promise(function(P){L=P}),S={execute:L,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(S,E),f},U.executeNext=function(E){var L=this.buffers,f=this.queues,S=L[E],P=f[E];if(P.length){var T=P[0];try{T.execute()}catch(p){H.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),T.onError(p),(!S||!S.updating)&&(P.shift(),this.executeNext(E))}}},U.shiftAndExecuteNext=function(E){this.queues[E].shift(),this.executeNext(E)},U.current=function(E){return this.queues[E][0]},x}()},"./src/controller/cap-level-controller.ts":function(J,K,R){"use strict";R.r(K);var H=R("./src/events.ts");function N(I,E){for(var L=0;L<E.length;L++){var f=E[L];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(I,f.key,f)}}function x(I,E,L){return E&&N(I.prototype,E),L&&N(I,L),I}var U=function(){function I(L){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=L,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var E=I.prototype;return E.setStreamController=function(f){this.streamController=f},E.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},E.registerListeners=function(){var f=this.hls;f.on(H.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),f.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),f.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.on(H.Events.BUFFER_CODECS,this.onBufferCodecs,this),f.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},E.unregisterListener=function(){var f=this.hls;f.off(H.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),f.off(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),f.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.off(H.Events.BUFFER_CODECS,this.onBufferCodecs,this),f.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},E.onFpsDropLevelCapping=function(f,S){I.isLevelAllowed(S.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(S.droppedLevel)},E.onMediaAttaching=function(f,S){this.media=S.media instanceof HTMLVideoElement?S.media:null},E.onManifestParsed=function(f,S){var P=this.hls;this.restrictedLevels=[],this.firstLevel=S.firstLevel,P.config.capLevelToPlayerSize&&S.video&&this.startCapping()},E.onBufferCodecs=function(f,S){var P=this.hls;P.config.capLevelToPlayerSize&&S.video&&this.startCapping()},E.onMediaDetaching=function(){this.stopCapping()},E.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var f=this.hls.levels;if(f.length){var S=this.hls;S.autoLevelCapping=this.getMaxLevel(f.length-1),S.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=S.autoLevelCapping}}},E.getMaxLevel=function(f){var S=this,P=this.hls.levels;if(!P.length)return-1;var T=P.filter(function(p,m){return I.isLevelAllowed(m,S.restrictedLevels)&&m<=f});return this.clientRect=null,I.getMaxLevelByMediaSize(T,this.mediaWidth,this.mediaHeight)},E.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()},E.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},E.getDimensions=function(){if(this.clientRect)return this.clientRect;var f=this.media,S={width:0,height:0};if(f){var P=f.getBoundingClientRect();S.width=P.width,S.height=P.height,!S.width&&!S.height&&(S.width=P.right-P.left||f.width||0,S.height=P.bottom-P.top||f.height||0)}return this.clientRect=S,S},I.isLevelAllowed=function(f,S){return S===void 0&&(S=[]),S.indexOf(f)===-1},I.getMaxLevelByMediaSize=function(f,S,P){if(!f||!f.length)return-1;for(var T=function(u,c){return c?u.width!==c.width||u.height!==c.height:!0},p=f.length-1,m=0;m<f.length;m+=1){var i=f[m];if((i.width>=S||i.height>=P)&&T(i,f[m+1])){p=m;break}}return p},x(I,[{key:"mediaWidth",get:function(){return this.getDimensions().width*I.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*I.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var f=1;try{f=self.devicePixelRatio}catch(S){}return f}}]),I}();K.default=U},"./src/controller/cmcd-controller.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return T});var H=R("./src/events.ts"),N=R("./src/types/cmcd.ts"),x=R("./src/utils/buffer-helper.ts"),U=R("./src/utils/logger.ts");function I(p,m){for(var i=0;i<m.length;i++){var a=m[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(p,a.key,a)}}function E(p,m,i){return m&&I(p.prototype,m),i&&I(p,i),p}function L(p,m){var i=typeof Symbol!="undefined"&&p[Symbol.iterator]||p["@@iterator"];if(i)return(i=i.call(p)).next.bind(i);if(Array.isArray(p)||(i=f(p))||m&&p&&typeof p.length=="number"){i&&(p=i);var a=0;return function(){return a>=p.length?{done:!0}:{done:!1,value:p[a++]}}}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 f(p,m){if(!p)return;if(typeof p=="string")return S(p,m);var i=Object.prototype.toString.call(p).slice(8,-1);if(i==="Object"&&p.constructor&&(i=p.constructor.name),i==="Map"||i==="Set")return Array.from(p);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return S(p,m)}function S(p,m){(m==null||m>p.length)&&(m=p.length);for(var i=0,a=new Array(m);i<m;i++)a[i]=p[i];return a}function P(){return P=Object.assign||function(p){for(var m=1;m<arguments.length;m++){var i=arguments[m];for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(p[a]=i[a])}return p},P.apply(this,arguments)}var T=function(){function p(i){var a=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(){a.initialized&&(a.starved=!0),a.buffering=!0},this.onPlaying=function(){a.initialized||(a.initialized=!0),a.buffering=!1},this.applyPlaylistData=function(O){try{a.apply(O,{ot:N.CMCDObjectType.MANIFEST,su:!a.initialized})}catch(b){U.logger.warn("Could not generate manifest CMCD data.",b)}},this.applyFragmentData=function(O){try{var b=O.frag,y=a.hls.levels[b.level],D=a.getObjectType(b),_={d:b.duration*1e3,ot:D};(D===N.CMCDObjectType.VIDEO||D===N.CMCDObjectType.AUDIO||D==N.CMCDObjectType.MUXED)&&(_.br=y.bitrate/1e3,_.tb=a.getTopBandwidth(D),_.bl=a.getBufferLength(D)),a.apply(O,_)}catch(h){U.logger.warn("Could not generate segment CMCD data.",h)}},this.hls=i;var u=this.config=i.config,c=u.cmcd;c!=null&&(u.pLoader=this.createPlaylistLoader(),u.fLoader=this.createFragmentLoader(),this.sid=c.sessionId||p.uuid(),this.cid=c.contentId,this.useHeaders=c.useHeaders===!0,this.registerListeners())}var m=p.prototype;return m.registerListeners=function(){var a=this.hls;a.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.on(H.Events.BUFFER_CREATED,this.onBufferCreated,this)},m.unregisterListeners=function(){var a=this.hls;a.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.off(H.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},m.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},m.onMediaAttached=function(a,u){this.media=u.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},m.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},m.onBufferCreated=function(a,u){var c,O;this.audioBuffer=(c=u.tracks.audio)===null||c===void 0?void 0:c.buffer,this.videoBuffer=(O=u.tracks.video)===null||O===void 0?void 0:O.buffer},m.createData=function(){var a;return{v:N.CMCDVersion,sf:N.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(a=this.media)===null||a===void 0?void 0:a.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},m.apply=function(a,u){u===void 0&&(u={}),P(u,this.createData());var c=u.ot===N.CMCDObjectType.INIT||u.ot===N.CMCDObjectType.VIDEO||u.ot===N.CMCDObjectType.MUXED;if(this.starved&&c&&(u.bs=!0,u.su=!0,this.starved=!1),u.su==null&&(u.su=this.buffering),this.useHeaders){var O=p.toHeaders(u);if(!Object.keys(O).length)return;a.headers||(a.headers={}),P(a.headers,O)}else{var b=p.toQuery(u);if(!b)return;a.url=p.appendQueryToUri(a.url,b)}},m.getObjectType=function(a){var u=a.type;return u==="subtitle"?N.CMCDObjectType.TIMED_TEXT:a.sn==="initSegment"?N.CMCDObjectType.INIT:u==="audio"?N.CMCDObjectType.AUDIO:u==="main"?this.hls.audioTracks.length?N.CMCDObjectType.VIDEO:N.CMCDObjectType.MUXED:void 0},m.getTopBandwidth=function(a){for(var u=0,c=a===N.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,O=L(c),b;!(b=O()).done;){var y=b.value;y.bitrate>u&&(u=y.bitrate)}return u>0?u:NaN},m.getBufferLength=function(a){var u=this.hls.media,c=a===N.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!c||!u)return NaN;var O=x.BufferHelper.bufferInfo(c,u.currentTime,this.config.maxBufferHole);return O.len*1e3},m.createPlaylistLoader=function(){var a=this.config.pLoader,u=this.applyPlaylistData,c=a||this.config.loader;return function(){function O(y){this.loader=void 0,this.loader=new c(y)}var b=O.prototype;return b.destroy=function(){this.loader.destroy()},b.abort=function(){this.loader.abort()},b.load=function(D,_,h){u(D),this.loader.load(D,_,h)},E(O,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),O}()},m.createFragmentLoader=function(){var a=this.config.fLoader,u=this.applyFragmentData,c=a||this.config.loader;return function(){function O(y){this.loader=void 0,this.loader=new c(y)}var b=O.prototype;return b.destroy=function(){this.loader.destroy()},b.abort=function(){this.loader.abort()},b.load=function(D,_,h){u(D),this.loader.load(D,_,h)},E(O,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),O}()},p.uuid=function(){var a=URL.createObjectURL(new Blob),u=a.toString();return URL.revokeObjectURL(a),u.substr(u.lastIndexOf("/")+1)},p.serialize=function(a){for(var u=[],c=function(B){return!Number.isNaN(B)&&B!=null&&B!==""&&B!==!1},O=function(B){return Math.round(B)},b=function(B){return O(B/100)*100},y=function(B){return encodeURIComponent(B)},D={br:O,d:O,bl:b,dl:b,mtp:b,nor:y,rtp:b,tb:O},_=Object.keys(a||{}).sort(),h=L(_),d;!(d=h()).done;){var o=d.value,s=a[o];if(!c(s))continue;if(o==="v"&&s===1)continue;if(o=="pr"&&s===1)continue;var w=D[o];w&&(s=w(s));var C=typeof s,v=void 0;o==="ot"||o==="sf"||o==="st"?v=o+"="+s:C==="boolean"?v=o:C==="number"?v=o+"="+s:v=o+"="+JSON.stringify(s),u.push(v)}return u.join(",")},p.toHeaders=function(a){for(var u=Object.keys(a),c={},O=["Object","Request","Session","Status"],b=[{},{},{},{}],y={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},D=0,_=u;D<_.length;D++){var h=_[D],d=y[h]!=null?y[h]:1;b[d][h]=a[h]}for(var o=0;o<b.length;o++){var s=p.serialize(b[o]);s&&(c["CMCD-"+O[o]]=s)}return c},p.toQuery=function(a){return"CMCD="+encodeURIComponent(p.serialize(a))},p.appendQueryToUri=function(a,u){if(!u)return a;var c=a.includes("?")?"&":"?";return""+a+c+u},p}()},"./src/controller/eme-controller.ts":function(J,K,R){"use strict";R.r(K);var H=R("./src/events.ts"),N=R("./src/errors.ts"),x=R("./src/utils/logger.ts"),U=R("./src/utils/mediakeys-helper.ts");function I(T,p){for(var m=0;m<p.length;m++){var i=p[m];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(T,i.key,i)}}function E(T,p,m){return p&&I(T.prototype,p),m&&I(T,m),T}var L=3,f=function(p,m,i){var a={audioCapabilities:[],videoCapabilities:[]};return p.forEach(function(u){a.audioCapabilities.push({contentType:'audio/mp4; codecs="'+u+'"',robustness:i.audioRobustness||""})}),m.forEach(function(u){a.videoCapabilities.push({contentType:'video/mp4; codecs="'+u+'"',robustness:i.videoRobustness||""})}),[a]},S=function(p,m,i,a){switch(p){case U.KeySystems.WIDEVINE:return f(m,i,a);default:throw new Error("Unknown key-system: "+p)}},P=function(){function T(m){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=m,this._config=m.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 p=T.prototype;return p.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},p._registerListeners=function(){this.hls.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this)},p._unregisterListeners=function(){this.hls.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this)},p.getLicenseServerUrl=function(i){switch(i){case U.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+i+'"')},p._attemptKeySystemAccess=function(i,a,u){var c=this,O=S(i,a,u,this._drmSystemOptions);x.logger.log("Requesting encrypted media key-system access");var b=this.requestMediaKeySystemAccess(i,O);this.mediaKeysPromise=b.then(function(y){return c._onMediaKeySystemAccessObtained(i,y)}),b.catch(function(y){x.logger.error('Failed to obtain key-system "'+i+'" access:',y)})},p._onMediaKeySystemAccessObtained=function(i,a){var u=this;x.logger.log('Access for key-system "'+i+'" obtained');var c={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:a,mediaKeySystemDomain:i};this._mediaKeysList.push(c);var O=Promise.resolve().then(function(){return a.createMediaKeys()}).then(function(b){return c.mediaKeys=b,x.logger.log('Media-keys created for key-system "'+i+'"'),u._onMediaKeysCreated(),b});return O.catch(function(b){x.logger.error("Failed to create media-keys:",b)}),O},p._onMediaKeysCreated=function(){var i=this;this._mediaKeysList.forEach(function(a){a.mediaKeysSession||(a.mediaKeysSession=a.mediaKeys.createSession(),i._onNewMediaKeySession(a.mediaKeysSession))})},p._onNewMediaKeySession=function(i){var a=this;x.logger.log("New key-system session "+i.sessionId),i.addEventListener("message",function(u){a._onKeySessionMessage(i,u.message)},!1)},p._onKeySessionMessage=function(i,a){x.logger.log("Got EME message event, creating license request"),this._requestLicense(a,function(u){x.logger.log("Received license data (length: "+(u&&u.byteLength)+"), updating key-session"),i.update(u)})},p.onMediaEncrypted=function(i){var a=this;if(x.logger.log('Media is encrypted using "'+i.initDataType+'" init data type'),!this.mediaKeysPromise){x.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(H.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var u=function(O){if(!a._media)return;a._attemptSetMediaKeys(O),a._generateRequestWithPreferredKeySession(i.initDataType,i.initData)};this.mediaKeysPromise.then(u).catch(u)},p._attemptSetMediaKeys=function(i){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var a=this._mediaKeysList[0];if(!a||!a.mediaKeys){x.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}x.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(a.mediaKeys),this._hasSetMediaKeys=!0}},p._generateRequestWithPreferredKeySession=function(i,a){var u=this,c=this._mediaKeysList[0];if(!c){x.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(c.mediaKeysSessionInitialized){x.logger.warn("Key-Session already initialized but requested again");return}var O=c.mediaKeysSession;if(!O){x.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(H.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!a){x.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(H.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}x.logger.log('Generating key-session request for "'+i+'" init data type'),c.mediaKeysSessionInitialized=!0,O.generateRequest(i,a).then(function(){x.logger.debug("Key-session generation succeeded")}).catch(function(b){x.logger.error("Error generating key-session request:",b),u.hls.trigger(H.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},p._createLicenseXhr=function(i,a,u){var c=new XMLHttpRequest;c.responseType="arraybuffer",c.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,c,i,a,u);var O=this._licenseXhrSetup;if(O)try{O.call(this.hls,c,i),O=void 0}catch(b){x.logger.error(b)}try{c.readyState||c.open("POST",i,!0),O&&O.call(this.hls,c,i)}catch(b){throw new Error("issue setting up KeySystem license XHR "+b)}return c},p._onLicenseRequestReadyStageChange=function(i,a,u,c){switch(i.readyState){case 4:if(i.status===200){this._requestLicenseFailureCount=0,x.logger.log("License request succeeded");var O=i.response,b=this._licenseResponseCallback;if(b)try{O=b.call(this.hls,i,a)}catch(D){x.logger.error(D)}c(O)}else{if(x.logger.error("License Request XHR failed ("+a+"). Status: "+i.status+" ("+i.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>L){this.hls.trigger(H.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var y=L-this._requestLicenseFailureCount+1;x.logger.warn("Retrying license request, "+y+" attempts left"),this._requestLicense(u,c)}break}},p._generateLicenseRequestChallenge=function(i,a){switch(i.mediaKeySystemDomain){case U.KeySystems.WIDEVINE:return a}throw new Error("unsupported key-system: "+i.mediaKeySystemDomain)},p._requestLicense=function(i,a){x.logger.log("Requesting content license for key-system");var u=this._mediaKeysList[0];if(!u){x.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var c=this.getLicenseServerUrl(u.mediaKeySystemDomain),O=this._createLicenseXhr(c,i,a);x.logger.log("Sending license request to URL: "+c);var b=this._generateLicenseRequestChallenge(u,i);O.send(b)}catch(y){x.logger.error("Failure requesting DRM license: "+y),this.hls.trigger(H.Events.ERROR,{type:N.ErrorTypes.KEY_SYSTEM_ERROR,details:N.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},p.onMediaAttached=function(i,a){if(!this._emeEnabled)return;var u=a.media;this._media=u,u.addEventListener("encrypted",this._onMediaEncrypted)},p.onMediaDetached=function(){var i=this._media,a=this._mediaKeysList;if(!i)return;i.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(a.map(function(u){if(u.mediaKeysSession)return u.mediaKeysSession.close().catch(function(){})})).then(function(){return i.setMediaKeys(null)}).catch(function(){})},p.onManifestParsed=function(i,a){if(!this._emeEnabled)return;var u=a.levels.map(function(O){return O.audioCodec}).filter(function(O){return!!O}),c=a.levels.map(function(O){return O.videoCodec}).filter(function(O){return!!O});this._attemptKeySystemAccess(U.KeySystems.WIDEVINE,u,c)},E(T,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),T}();K.default=P},"./src/controller/fps-controller.ts":function(J,K,R){"use strict";R.r(K);var H=R("./src/events.ts"),N=R("./src/utils/logger.ts"),x=function(){function U(E){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=E,this.registerListeners()}var I=U.prototype;return I.setStreamController=function(L){this.streamController=L},I.registerListeners=function(){this.hls.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},I.unregisterListeners=function(){this.hls.off(H.Events.MEDIA_ATTACHING,this.onMediaAttaching)},I.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},I.onMediaAttaching=function(L,f){var S=this.hls.config;if(S.capLevelOnFPSDrop){var P=f.media instanceof self.HTMLVideoElement?f.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),S.fpsDroppedMonitoringPeriod)}},I.checkFPS=function(L,f,S){var P=performance.now();if(f){if(this.lastTime){var T=P-this.lastTime,p=S-this.lastDroppedFrames,m=f-this.lastDecodedFrames,i=1e3*p/T,a=this.hls;if(a.trigger(H.Events.FPS_DROP,{currentDropped:p,currentDecoded:m,totalDroppedFrames:S}),i>0&&p>a.config.fpsDroppedMonitoringThreshold*m){var u=a.currentLevel;N.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(a.autoLevelCapping===-1||a.autoLevelCapping>=u)&&(u=u-1,a.trigger(H.Events.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:a.currentLevel}),a.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=P,this.lastDroppedFrames=S,this.lastDecodedFrames=f}},I.checkFPSInterval=function(){var L=this.media;if(L)if(this.isVideoPlaybackQualityAvailable){var f=L.getVideoPlaybackQuality();this.checkFPS(L,f.totalVideoFrames,f.droppedVideoFrames)}else this.checkFPS(L,L.webkitDecodedFrameCount,L.webkitDroppedFrameCount)},U}();K.default=x},"./src/controller/fragment-finders.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"findFragmentByPDT",function(){return x}),R.d(K,"findFragmentByPTS",function(){return U}),R.d(K,"fragmentWithinToleranceTest",function(){return I}),R.d(K,"pdtWithinToleranceTest",function(){return E}),R.d(K,"findFragWithCC",function(){return L});var H=R("./src/polyfills/number.ts"),N=R("./src/utils/binary-search.ts");function x(f,S,P){if(S===null||!Array.isArray(f)||!f.length||!Object(H.isFiniteNumber)(S))return null;var T=f[0].programDateTime;if(S<(T||0))return null;var p=f[f.length-1].endProgramDateTime;if(S>=(p||0))return null;P=P||0;for(var m=0;m<f.length;++m){var i=f[m];if(E(S,P,i))return i}return null}function U(f,S,P,T){P===void 0&&(P=0),T===void 0&&(T=0);var p=null;if(f?p=S[f.sn-S[0].sn+1]||null:P===0&&S[0].start===0&&(p=S[0]),p&&I(P,T,p)===0)return p;var m=N.default.search(S,I.bind(null,P,T));return m||p}function I(f,S,P){f===void 0&&(f=0),S===void 0&&(S=0);var T=Math.min(S,P.duration+(P.deltaPTS?P.deltaPTS:0));return P.start+P.duration-T<=f?1:P.start-T>f&&P.start?-1:0}function E(f,S,P){var T=Math.min(S,P.duration+(P.deltaPTS?P.deltaPTS:0))*1e3,p=P.endProgramDateTime||0;return p-T>f}function L(f,S){return N.default.search(f,function(P){return P.cc<S?1:P.cc>S?-1:0})}},"./src/controller/fragment-tracker.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"FragmentState",function(){return x}),R.d(K,"FragmentTracker",function(){return U});var H=R("./src/events.ts"),N=R("./src/types/loader.ts"),x;(function(L){L.NOT_LOADED="NOT_LOADED",L.BACKTRACKED="BACKTRACKED",L.APPENDING="APPENDING",L.PARTIAL="PARTIAL",L.OK="OK"})(x||(x={}));var U=function(){function L(S){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=S,this._registerListeners()}var f=L.prototype;return f._registerListeners=function(){var P=this.hls;P.on(H.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.on(H.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.on(H.Events.FRAG_LOADED,this.onFragLoaded,this)},f._unregisterListeners=function(){var P=this.hls;P.off(H.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.off(H.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.off(H.Events.FRAG_LOADED,this.onFragLoaded,this)},f.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},f.getAppendedFrag=function(P,T){if(T===N.PlaylistLevelType.MAIN){var p=this.activeFragment,m=this.activeParts;if(!p)return null;if(m)for(var i=m.length;i--;){var a=m[i],u=a?a.end:p.appendedPTS;if(a.start<=P&&u!==void 0&&P<=u)return i>9&&(this.activeParts=m.slice(i-9)),a}else if(p.start<=P&&p.appendedPTS!==void 0&&P<=p.appendedPTS)return p}return this.getBufferedFrag(P,T)},f.getBufferedFrag=function(P,T){for(var p=this.fragments,m=Object.keys(p),i=m.length;i--;){var a=p[m[i]];if((a==null?void 0:a.body.type)===T&&a.buffered){var u=a.body;if(u.start<=P&&P<=u.end)return u}}return null},f.detectEvictedFragments=function(P,T,p){var m=this;Object.keys(this.fragments).forEach(function(i){var a=m.fragments[i];if(!a)return;if(!a.buffered){a.body.type===p&&m.removeFragment(a.body);return}var u=a.range[P];if(!u)return;u.time.some(function(c){var O=!m.isTimeBuffered(c.startPTS,c.endPTS,T);return O&&m.removeFragment(a.body),O})})},f.detectPartialFragments=function(P){var T=this,p=this.timeRanges,m=P.frag,i=P.part;if(!p||m.sn==="initSegment")return;var a=E(m),u=this.fragments[a];if(!u)return;Object.keys(p).forEach(function(c){var O=m.elementaryStreams[c];if(!O)return;var b=p[c],y=i!==null||O.partial===!0;u.range[c]=T.getBufferedTimes(m,i,y,b)}),u.backtrack=u.loaded=null,Object.keys(u.range).length?u.buffered=!0:this.removeFragment(u.body)},f.fragBuffered=function(P){var T=E(P),p=this.fragments[T];p&&(p.backtrack=p.loaded=null,p.buffered=!0)},f.getBufferedTimes=function(P,T,p,m){for(var i={time:[],partial:p},a=T?T.start:P.start,u=T?T.end:P.end,c=P.minEndPTS||u,O=P.maxStartPTS||a,b=0;b<m.length;b++){var y=m.start(b)-this.bufferPadding,D=m.end(b)+this.bufferPadding;if(O>=y&&c<=D){i.time.push({startPTS:Math.max(a,m.start(b)),endPTS:Math.min(u,m.end(b))});break}else if(a<D&&u>y)i.partial=!0,i.time.push({startPTS:Math.max(a,m.start(b)),endPTS:Math.min(u,m.end(b))});else if(u<=y)break}return i},f.getPartialFragment=function(P){var T=null,p,m,i,a=0,u=this.bufferPadding,c=this.fragments;return Object.keys(c).forEach(function(O){var b=c[O];if(!b)return;I(b)&&(m=b.body.start-u,i=b.body.end+u,P>=m&&P<=i&&(p=Math.min(P-m,i-P),a<=p&&(T=b.body,a=p)))}),T},f.getState=function(P){var T=E(P),p=this.fragments[T];return p?p.buffered?I(p)?x.PARTIAL:x.OK:p.backtrack?x.BACKTRACKED:x.APPENDING:x.NOT_LOADED},f.backtrack=function(P,T){var p=E(P),m=this.fragments[p];if(!m||m.backtrack)return null;var i=m.backtrack=T||m.loaded;return m.loaded=null,i},f.getBacktrackData=function(P){var T=E(P),p=this.fragments[T];if(p){var m,i=p.backtrack;if(i!=null&&(m=i.payload)!==null&&m!==void 0&&m.byteLength)return i;this.removeFragment(P)}return null},f.isTimeBuffered=function(P,T,p){for(var m,i,a=0;a<p.length;a++){if(m=p.start(a)-this.bufferPadding,i=p.end(a)+this.bufferPadding,P>=m&&T<=i)return!0;if(T<=m)return!1}return!1},f.onFragLoaded=function(P,T){var p=T.frag,m=T.part;if(p.sn==="initSegment"||p.bitrateTest||m)return;var i=E(p);this.fragments[i]={body:p,loaded:T,backtrack:null,buffered:!1,range:Object.create(null)}},f.onBufferAppended=function(P,T){var p=this,m=T.frag,i=T.part,a=T.timeRanges;if(m.type===N.PlaylistLevelType.MAIN)if(this.activeFragment=m,i){var u=this.activeParts;u||(this.activeParts=u=[]),u.push(i)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach(function(c){var O=a[c];if(p.detectEvictedFragments(c,O),!i)for(var b=0;b<O.length;b++)m.appendedPTS=Math.max(O.end(b),m.appendedPTS||0)})},f.onFragBuffered=function(P,T){this.detectPartialFragments(T)},f.hasFragment=function(P){var T=E(P);return!!this.fragments[T]},f.removeFragmentsInRange=function(P,T,p){var m=this;Object.keys(this.fragments).forEach(function(i){var a=m.fragments[i];if(!a)return;if(a.buffered){var u=a.body;u.type===p&&u.start<T&&u.end>P&&m.removeFragment(u)}})},f.removeFragment=function(P){var T=E(P);P.stats.loaded=0,P.clearElementaryStreamInfo(),delete this.fragments[T]},f.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},L}();function I(L){var f,S;return L.buffered&&(((f=L.range.video)===null||f===void 0?void 0:f.partial)||((S=L.range.audio)===null||S===void 0?void 0:S.partial))}function E(L){return L.type+"_"+L.level+"_"+L.urlId+"_"+L.sn}},"./src/controller/gap-controller.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"STALL_MINIMUM_DURATION_MS",function(){return I}),R.d(K,"MAX_START_GAP_JUMP",function(){return E}),R.d(K,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return L}),R.d(K,"SKIP_BUFFER_RANGE_START",function(){return f}),R.d(K,"default",function(){return S});var H=R("./src/utils/buffer-helper.ts"),N=R("./src/errors.ts"),x=R("./src/events.ts"),U=R("./src/utils/logger.ts"),I=250,E=2,L=.1,f=.05,S=function(){function P(p,m,i,a){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=p,this.media=m,this.fragmentTracker=i,this.hls=a}var T=P.prototype;return T.destroy=function(){this.hls=this.fragmentTracker=this.media=null},T.poll=function(m){var i=this.config,a=this.media,u=this.stalled,c=a.currentTime,O=a.seeking,b=this.seeking&&!O,y=!this.seeking&&O;if(this.seeking=O,c!==m){if(this.moved=!0,u!==null){if(this.stallReported){var D=self.performance.now()-u;U.logger.warn("playback not stuck anymore @"+c+", after "+Math.round(D)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((y||b)&&(this.stalled=null),a.paused||a.ended||a.playbackRate===0||!H.BufferHelper.getBuffered(a).length)return;var _=H.BufferHelper.bufferInfo(a,c,0),h=_.len>0,d=_.nextStart||0;if(!h&&!d)return;if(O){var o=_.len>E,s=!d||d-c>E&&!this.fragmentTracker.getPartialFragment(c);if(o||s)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var w,C=Math.max(d,_.start||0)-c,v=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,M=v==null||((w=v.details)===null||w===void 0)?void 0:w.live,B=M?v.details.targetduration*2:E;if(C>0&&C<=B){this._trySkipBufferHole(null);return}}var F=self.performance.now();if(u===null){this.stalled=F;return}var Q=F-u;!O&&Q>=I&&this._reportStall(_.len);var G=H.BufferHelper.bufferInfo(a,c,i.maxBufferHole);this._tryFixBufferStall(G,Q)},T._tryFixBufferStall=function(m,i){var a=this.config,u=this.fragmentTracker,c=this.media,O=c.currentTime,b=u.getPartialFragment(O);if(b){var y=this._trySkipBufferHole(b);if(y)return}m.len>a.maxBufferHole&&i>a.highBufferWatchdogPeriod*1e3&&(U.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},T._reportStall=function(m){var i=this.hls,a=this.media,u=this.stallReported;u||(this.stallReported=!0,U.logger.warn("Playback stalling at @"+a.currentTime+" due to low buffer (buffer="+m+")"),i.trigger(x.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:m}))},T._trySkipBufferHole=function(m){for(var i=this.config,a=this.hls,u=this.media,c=u.currentTime,O=0,b=H.BufferHelper.getBuffered(u),y=0;y<b.length;y++){var D=b.start(y);if(c+i.maxBufferHole>=O&&c<D){var _=Math.max(D+f,u.currentTime+L);return U.logger.warn("skipping hole, adjusting currentTime from "+c+" to "+_),this.moved=!0,this.stalled=null,u.currentTime=_,m&&a.trigger(x.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+c+" to "+_,frag:m}),_}O=b.end(y)}return 0},T._tryNudgeBuffer=function(){var m=this.config,i=this.hls,a=this.media,u=a.currentTime,c=(this.nudgeRetry||0)+1;if(this.nudgeRetry=c,c<m.nudgeMaxRetry){var O=u+c*m.nudgeOffset;U.logger.warn("Nudging 'currentTime' from "+u+" to "+O),a.currentTime=O,i.trigger(x.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else U.logger.error("Playhead still not moving while enough data buffered @"+u+" after "+m.nudgeMaxRetry+" nudges"),i.trigger(x.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},P}()},"./src/controller/id3-track-controller.ts":function(J,K,R){"use strict";R.r(K);var H=R("./src/events.ts"),N=R("./src/utils/texttrack-utils.ts"),x=R("./src/demux/id3.ts"),U=.25,I=function(){function E(f){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=f,this._registerListeners()}var L=E.prototype;return L.destroy=function(){this._unregisterListeners()},L._registerListeners=function(){var S=this.hls;S.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),S.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),S.on(H.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),S.on(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L._unregisterListeners=function(){var S=this.hls;S.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),S.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),S.off(H.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),S.off(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L.onMediaAttached=function(S,P){this.media=P.media},L.onMediaDetaching=function(){if(!this.id3Track)return;Object(N.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},L.getID3Track=function(S){if(!this.media)return;for(var P=0;P<S.length;P++){var T=S[P];if(T.kind==="metadata"&&T.label==="id3")return Object(N.sendAddTrackEvent)(T,this.media),T}return this.media.addTextTrack("metadata","id3")},L.onFragParsingMetadata=function(S,P){if(!this.media)return;var T=P.frag,p=P.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var m=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,i=0;i<p.length;i++){var a=x.getID3Frames(p[i].data);if(a){var u=p[i].pts,c=i<p.length-1?p[i+1].pts:T.end,O=c-u;O<=0&&(c=u+U);for(var b=0;b<a.length;b++){var y=a[b];if(!x.isTimeStampFrame(y)){var D=new m(u,c,"");D.value=y,this.id3Track.addCue(D)}}}}},L.onBufferFlushing=function(S,P){var T=P.startOffset,p=P.endOffset,m=P.type;if(!m||m==="audio"){var i=this.id3Track;i&&Object(N.removeCuesInRange)(i,T,p)}},E}();K.default=I},"./src/controller/latency-controller.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return E});var H=R("./src/errors.ts"),N=R("./src/events.ts"),x=R("./src/utils/logger.ts");function U(L,f){for(var S=0;S<f.length;S++){var P=f[S];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(L,P.key,P)}}function I(L,f,S){return f&&U(L.prototype,f),S&&U(L,S),L}var E=function(){function L(S){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=S,this.config=S.config,this.registerListeners()}var f=L.prototype;return f.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},f.registerListeners=function(){this.hls.on(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(N.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(N.Events.ERROR,this.onError,this)},f.unregisterListeners=function(){this.hls.off(N.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(N.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(N.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(N.Events.ERROR,this.onError)},f.onMediaAttached=function(P,T){this.media=T.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},f.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},f.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},f.onLevelUpdated=function(P,T){var p=T.details;this.levelDetails=p,p.advanced&&this.timeupdate(),!p.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},f.onError=function(P,T){if(T.details!==H.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,x.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},f.timeupdate=function(){var P=this.media,T=this.levelDetails;if(!P||!T)return;this.currentTime=P.currentTime;var p=this.computeLatency();if(p===null)return;this._latency=p;var m=this.config,i=m.lowLatencyMode,a=m.maxLiveSyncPlaybackRate;if(!i||a===1)return;var u=this.targetLatency;if(u===null)return;var c=p-u,O=Math.min(this.maxLatency,u+T.targetduration),b=c<O;if(T.live&&b&&c>.05&&this.forwardBufferLength>1){var y=Math.min(2,Math.max(1,a)),D=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20;P.playbackRate=Math.min(y,Math.max(1,D))}else P.playbackRate!==1&&P.playbackRate!==0&&(P.playbackRate=1)},f.estimateLiveEdge=function(){var P=this.levelDetails;return P===null?null:P.edge+P.age},f.computeLatency=function(){var P=this.estimateLiveEdge();return P===null?null:P-this.currentTime},I(L,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var P=this.config,T=this.levelDetails;return P.liveMaxLatencyDuration!==void 0?P.liveMaxLatencyDuration:T?P.liveMaxLatencyDurationCount*T.targetduration:0}},{key:"targetLatency",get:function(){var P=this.levelDetails;if(P===null)return null;var T=P.holdBack,p=P.partHoldBack,m=P.targetduration,i=this.config,a=i.liveSyncDuration,u=i.liveSyncDurationCount,c=i.lowLatencyMode,O=this.hls.userConfig,b=c&&p||T;(O.liveSyncDuration||O.liveSyncDurationCount||b===0)&&(b=a!==void 0?a:u*m);var y=m,D=1;return b+Math.min(this.stallCount*D,y)}},{key:"liveSyncPosition",get:function(){var P=this.estimateLiveEdge(),T=this.targetLatency,p=this.levelDetails;if(P===null||T===null||p===null)return null;var m=p.edge,i=P-T-this.edgeStalled,a=m-p.totalduration,u=m-(this.config.lowLatencyMode&&p.partTarget||p.targetduration);return Math.min(Math.max(a,i),u)}},{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 T=(this.config.lowLatencyMode&&P.partTarget||P.targetduration)*3;return Math.max(P.age-T,0)}},{key:"forwardBufferLength",get:function(){var P=this.media,T=this.levelDetails;if(!P||!T)return 0;var p=P.buffered.length;return p?P.buffered.end(p-1):T.edge-this.currentTime}}]),L}()},"./src/controller/level-controller.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return i});var H=R("./src/types/level.ts"),N=R("./src/events.ts"),x=R("./src/errors.ts"),U=R("./src/utils/codecs.ts"),I=R("./src/controller/level-helper.ts"),E=R("./src/controller/base-playlist-controller.ts"),L=R("./src/types/loader.ts");function f(){return f=Object.assign||function(a){for(var u=1;u<arguments.length;u++){var c=arguments[u];for(var O in c)Object.prototype.hasOwnProperty.call(c,O)&&(a[O]=c[O])}return a},f.apply(this,arguments)}function S(a,u){for(var c=0;c<u.length;c++){var O=u[c];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(a,O.key,O)}}function P(a,u,c){return u&&S(a.prototype,u),c&&S(a,c),a}function T(a,u){a.prototype=Object.create(u.prototype),a.prototype.constructor=a,p(a,u)}function p(a,u){return p=Object.setPrototypeOf||function(O,b){return O.__proto__=b,O},p(a,u)}var m=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),i=function(a){T(u,a);function u(O){var b;return b=a.call(this,O,"[level-controller]")||this,b._levels=[],b._firstLevel=-1,b._startLevel=void 0,b.currentLevelIndex=-1,b.manualLevelIndex=-1,b.onParsedComplete=void 0,b._registerListeners(),b}var c=u.prototype;return c._registerListeners=function(){var b=this.hls;b.on(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),b.on(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),b.on(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),b.on(N.Events.FRAG_LOADED,this.onFragLoaded,this),b.on(N.Events.ERROR,this.onError,this)},c._unregisterListeners=function(){var b=this.hls;b.off(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),b.off(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),b.off(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),b.off(N.Events.FRAG_LOADED,this.onFragLoaded,this),b.off(N.Events.ERROR,this.onError,this)},c.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,a.prototype.destroy.call(this)},c.startLoad=function(){var b=this._levels;b.forEach(function(y){y.loadError=0}),a.prototype.startLoad.call(this)},c.onManifestLoaded=function(b,y){var D=[],_=[],h=[],d,o={},s,w=!1,C=!1,v=!1;if(y.levels.forEach(function(Q){var G=Q.attrs;w=w||!!(Q.width&&Q.height),C=C||!!Q.videoCodec,v=v||!!Q.audioCodec,m&&Q.audioCodec&&Q.audioCodec.indexOf("mp4a.40.34")!==-1&&(Q.audioCodec=void 0);var W=Q.bitrate+"-"+Q.attrs.RESOLUTION+"-"+Q.attrs.CODECS;s=o[W],s?s.url.push(Q.url):(s=new H.Level(Q),o[W]=s,D.push(s)),G&&(G.AUDIO&&Object(I.addGroupId)(s,"audio",G.AUDIO),G.SUBTITLES&&Object(I.addGroupId)(s,"text",G.SUBTITLES))}),(w||C)&&v&&(D=D.filter(function(Q){var G=Q.videoCodec,W=Q.width,$=Q.height;return!!G||!!(W&&$)})),D=D.filter(function(Q){var G=Q.audioCodec,W=Q.videoCodec;return(!G||Object(U.isCodecSupportedInMp4)(G,"audio"))&&(!W||Object(U.isCodecSupportedInMp4)(W,"video"))}),y.audioTracks&&(_=y.audioTracks.filter(function(Q){return!Q.audioCodec||Object(U.isCodecSupportedInMp4)(Q.audioCodec,"audio")}),Object(I.assignTrackIdsByGroup)(_)),y.subtitles&&(h=y.subtitles,Object(I.assignTrackIdsByGroup)(h)),D.length>0){d=D[0].bitrate,D.sort(function(Q,G){return Q.bitrate-G.bitrate}),this._levels=D;for(var M=0;M<D.length;M++)if(D[M].bitrate===d){this._firstLevel=M,this.log("manifest loaded, "+D.length+" level(s) found, first bitrate: "+d);break}var B=v&&!C,F={levels:D,audioTracks:_,subtitleTracks:h,firstLevel:this._firstLevel,stats:y.stats,audio:v,video:C,altAudio:!B&&_.some(function(Q){return!!Q.url})};this.hls.trigger(N.Events.MANIFEST_PARSED,F),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(N.Events.ERROR,{type:x.ErrorTypes.MEDIA_ERROR,details:x.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:y.url,reason:"no level with compatible codecs found in manifest"})},c.onError=function(b,y){if(a.prototype.onError.call(this,b,y),y.fatal)return;var D=y.context,_=this._levels[this.currentLevelIndex];if(D&&(D.type===L.PlaylistContextType.AUDIO_TRACK&&_.audioGroupIds&&D.groupId===_.audioGroupIds[_.urlId]||D.type===L.PlaylistContextType.SUBTITLE_TRACK&&_.textGroupIds&&D.groupId===_.textGroupIds[_.urlId])){this.redundantFailover(this.currentLevelIndex);return}var h=!1,d=!0,o;switch(y.details){case x.ErrorDetails.FRAG_LOAD_ERROR:case x.ErrorDetails.FRAG_LOAD_TIMEOUT:case x.ErrorDetails.KEY_LOAD_ERROR:case x.ErrorDetails.KEY_LOAD_TIMEOUT:if(y.frag){var s=this._levels[y.frag.level];s?(s.fragmentError++,s.fragmentError>this.hls.config.fragLoadingMaxRetry&&(o=y.frag.level)):o=y.frag.level}break;case x.ErrorDetails.LEVEL_LOAD_ERROR:case x.ErrorDetails.LEVEL_LOAD_TIMEOUT:D&&(D.deliveryDirectives&&(d=!1),o=D.level),h=!0;break;case x.ErrorDetails.REMUX_ALLOC_ERROR:o=y.level,h=!0;break}o!==void 0&&this.recoverLevel(y,o,h,d)},c.recoverLevel=function(b,y,D,_){var h=b.details,d=this._levels[y];if(d.loadError++,D){var o=this.retryLoadingOrFail(b);if(o)b.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(_){var s=d.url.length;if(s>1&&d.loadError<s)b.levelRetry=!0,this.redundantFailover(y);else if(this.manualLevelIndex===-1){var w=y===0?this._levels.length-1:y-1;this.currentLevelIndex!==w&&this._levels[w].loadError===0&&(this.warn(h+": switch to "+w),b.levelRetry=!0,this.hls.nextAutoLevel=w)}}},c.redundantFailover=function(b){var y=this._levels[b],D=y.url.length;if(D>1){var _=(y.urlId+1)%D;this.warn("Switching to redundant URL-id "+_),this._levels.forEach(function(h){h.urlId=_}),this.level=b}},c.onFragLoaded=function(b,y){var D=y.frag;if(D!==void 0&&D.type===L.PlaylistLevelType.MAIN){var _=this._levels[D.level];_!==void 0&&(_.fragmentError=0,_.loadError=0)}},c.onLevelLoaded=function(b,y){var D,_=y.level,h=y.details,d=this._levels[_];if(!d){var o;this.warn("Invalid level index "+_),(o=y.deliveryDirectives)!==null&&o!==void 0&&o.skip&&(h.deltaUpdateFailed=!0);return}_===this.currentLevelIndex?(d.fragmentError===0&&(d.loadError=0,this.retryCount=0),this.playlistLoaded(_,y,d.details)):(D=y.deliveryDirectives)!==null&&D!==void 0&&D.skip&&(h.deltaUpdateFailed=!0)},c.onAudioTrackSwitched=function(b,y){var D=this.hls.levels[this.currentLevelIndex];if(!D)return;if(D.audioGroupIds){for(var _=-1,h=this.hls.audioTracks[y.id].groupId,d=0;d<D.audioGroupIds.length;d++)if(D.audioGroupIds[d]===h){_=d;break}_!==D.urlId&&(D.urlId=_,this.startLoad())}},c.loadPlaylist=function(b){var y=this.currentLevelIndex,D=this._levels[y];if(this.canLoad&&D&&D.url.length>0){var _=D.urlId,h=D.url[_];if(b)try{h=b.addDirectives(h)}catch(d){this.warn("Could not construct new URL with HLS Delivery Directives: "+d)}this.log("Attempt loading level index "+y+(b?" at sn "+b.msn+" part "+b.part:"")+" with URL-id "+_+" "+h),this.clearTimer(),this.hls.trigger(N.Events.LEVEL_LOADING,{url:h,level:y,id:_,deliveryDirectives:b||null})}},c.removeLevel=function(b,y){var D=function(d,o){return o!==y},_=this._levels.filter(function(h,d){return d!==b?!0:h.url.length>1&&y!==void 0?(h.url=h.url.filter(D),h.audioGroupIds&&(h.audioGroupIds=h.audioGroupIds.filter(D)),h.textGroupIds&&(h.textGroupIds=h.textGroupIds.filter(D)),h.urlId=0,!0):!1}).map(function(h,d){var o=h.details;return o!=null&&o.fragments&&o.fragments.forEach(function(s){s.level=d}),h});this._levels=_,this.hls.trigger(N.Events.LEVELS_UPDATED,{levels:_})},P(u,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(b){var y,D=this._levels;if(D.length===0)return;if(this.currentLevelIndex===b&&(y=D[b])!==null&&y!==void 0&&y.details)return;if(b<0||b>=D.length){var _=b<0;if(this.hls.trigger(N.Events.ERROR,{type:x.ErrorTypes.OTHER_ERROR,details:x.ErrorDetails.LEVEL_SWITCH_ERROR,level:b,fatal:_,reason:"invalid level idx"}),_)return;b=Math.min(b,D.length-1)}this.clearTimer();var h=this.currentLevelIndex,d=D[h],o=D[b];this.log("switching to level "+b+" from "+h),this.currentLevelIndex=b;var s=f({},o,{level:b,maxBitrate:o.maxBitrate,uri:o.uri,urlId:o.urlId});delete s._urlId,this.hls.trigger(N.Events.LEVEL_SWITCHING,s);var w=o.details;if(!w||w.live){var C=this.switchParams(o.uri,d==null?void 0:d.details);this.loadPlaylist(C)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(b){this.manualLevelIndex=b,this._startLevel===void 0&&(this._startLevel=b),b!==-1&&(this.level=b)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(b){this._firstLevel=b}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var b=this.hls.config.startLevel;return b!==void 0?b:this._firstLevel}else return this._startLevel},set:function(b){this._startLevel=b}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(b){this.level=b,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=b)}}]),u}(E.default)},"./src/controller/level-helper.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"addGroupId",function(){return x}),R.d(K,"assignTrackIdsByGroup",function(){return U}),R.d(K,"updatePTS",function(){return I}),R.d(K,"updateFragPTSDTS",function(){return L}),R.d(K,"mergeDetails",function(){return f}),R.d(K,"mapPartIntersection",function(){return S}),R.d(K,"mapFragmentIntersection",function(){return P}),R.d(K,"adjustSliding",function(){return T}),R.d(K,"addSliding",function(){return p}),R.d(K,"computeReloadInterval",function(){return m}),R.d(K,"getFragmentWithSN",function(){return i}),R.d(K,"getPartWith",function(){return a});var H=R("./src/polyfills/number.ts"),N=R("./src/utils/logger.ts");function x(u,c,O){switch(c){case"audio":u.audioGroupIds||(u.audioGroupIds=[]),u.audioGroupIds.push(O);break;case"text":u.textGroupIds||(u.textGroupIds=[]),u.textGroupIds.push(O);break}}function U(u){var c={};u.forEach(function(O){var b=O.groupId||"";O.id=c[b]=c[b]||0,c[b]++})}function I(u,c,O){var b=u[c],y=u[O];E(b,y)}function E(u,c){var O=c.startPTS;if(Object(H.isFiniteNumber)(O)){var b=0,y;c.sn>u.sn?(b=O-u.start,y=u):(b=u.start-O,y=c),y.duration!==b&&(y.duration=b)}else if(c.sn>u.sn){var D=u.cc===c.cc;D&&u.minEndPTS?c.start=u.start+(u.minEndPTS-u.start):c.start=u.start+u.duration}else c.start=Math.max(u.start-c.duration,0)}function L(u,c,O,b,y,D){var _=b-O;_<=0&&(N.logger.warn("Fragment should have a positive duration",c),b=O+c.duration,D=y+c.duration);var h=O,d=b,o=c.startPTS,s=c.endPTS;if(Object(H.isFiniteNumber)(o)){var w=Math.abs(o-O);Object(H.isFiniteNumber)(c.deltaPTS)?c.deltaPTS=Math.max(w,c.deltaPTS):c.deltaPTS=w,h=Math.max(O,o),O=Math.min(O,o),y=Math.min(y,c.startDTS),d=Math.min(b,s),b=Math.max(b,s),D=Math.max(D,c.endDTS)}c.duration=b-O;var C=O-c.start;c.appendedPTS=b,c.start=c.startPTS=O,c.maxStartPTS=h,c.startDTS=y,c.endPTS=b,c.minEndPTS=d,c.endDTS=D;var v=c.sn;if(!u||v<u.startSN||v>u.endSN)return 0;var M,B=v-u.startSN,F=u.fragments;for(F[B]=c,M=B;M>0;M--)E(F[M],F[M-1]);for(M=B;M<F.length-1;M++)E(F[M],F[M+1]);return u.fragmentHint&&E(F[F.length-1],u.fragmentHint),u.PTSKnown=u.alignedSliding=!0,C}function f(u,c){for(var O=null,b=u.fragments,y=b.length-1;y>=0;y--){var D=b[y].initSegment;if(D){O=D;break}}u.fragmentHint&&delete u.fragmentHint.endPTS;var _=0,h;if(P(u,c,function(M,B){M.relurl&&(_=M.cc-B.cc),Object(H.isFiniteNumber)(M.startPTS)&&Object(H.isFiniteNumber)(M.endPTS)&&(B.start=B.startPTS=M.startPTS,B.startDTS=M.startDTS,B.appendedPTS=M.appendedPTS,B.maxStartPTS=M.maxStartPTS,B.endPTS=M.endPTS,B.endDTS=M.endDTS,B.minEndPTS=M.minEndPTS,B.duration=M.endPTS-M.startPTS,B.duration&&(h=B),c.PTSKnown=c.alignedSliding=!0),B.elementaryStreams=M.elementaryStreams,B.loader=M.loader,B.stats=M.stats,B.urlId=M.urlId,M.initSegment&&(B.initSegment=M.initSegment,O=M.initSegment)}),O){var d=c.fragmentHint?c.fragments.concat(c.fragmentHint):c.fragments;d.forEach(function(M){var B;(!M.initSegment||M.initSegment.relurl===((B=O)===null||B===void 0?void 0:B.relurl))&&(M.initSegment=O)})}if(c.skippedSegments&&(c.deltaUpdateFailed=c.fragments.some(function(M){return!M}),c.deltaUpdateFailed)){N.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var o=c.skippedSegments;o--;)c.fragments.shift();c.startSN=c.fragments[0].sn,c.startCC=c.fragments[0].cc}var s=c.fragments;if(_){N.logger.warn("discontinuity sliding from playlist, take drift into account");for(var w=0;w<s.length;w++)s[w].cc+=_}c.skippedSegments&&(c.startCC=c.fragments[0].cc),S(u.partList,c.partList,function(M,B){B.elementaryStreams=M.elementaryStreams,B.stats=M.stats}),h?L(c,h,h.startPTS,h.endPTS,h.startDTS,h.endDTS):T(u,c),s.length&&(c.totalduration=c.edge-s[0].start),c.driftStartTime=u.driftStartTime,c.driftStart=u.driftStart;var C=c.advancedDateTime;if(c.advanced&&C){var v=c.edge;c.driftStart||(c.driftStartTime=C,c.driftStart=v),c.driftEndTime=C,c.driftEnd=v}else c.driftEndTime=u.driftEndTime,c.driftEnd=u.driftEnd,c.advancedDateTime=u.advancedDateTime}function S(u,c,O){if(u&&c)for(var b=0,y=0,D=u.length;y<=D;y++){var _=u[y],h=c[y+b];_&&h&&_.index===h.index&&_.fragment.sn===h.fragment.sn?O(_,h):b--}}function P(u,c,O){for(var b=c.skippedSegments,y=Math.max(u.startSN,c.startSN)-c.startSN,D=(u.fragmentHint?1:0)+(b?c.endSN:Math.min(u.endSN,c.endSN))-c.startSN,_=c.startSN-u.startSN,h=c.fragmentHint?c.fragments.concat(c.fragmentHint):c.fragments,d=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,o=y;o<=D;o++){var s=d[_+o],w=h[o];b&&!w&&o<b&&(w=c.fragments[o]=s),s&&w&&O(s,w)}}function T(u,c){var O=c.startSN+c.skippedSegments-u.startSN,b=u.fragments;if(O<0||O>=b.length)return;p(c,b[O].start)}function p(u,c){if(c){for(var O=u.fragments,b=u.skippedSegments;b<O.length;b++)O[b].start+=c;u.fragmentHint&&(u.fragmentHint.start+=c)}}function m(u,c){var O=1e3*u.levelTargetDuration,b=O/2,y=u.age,D=y>0&&y<O*3,_=c.loading.end-c.loading.start,h,d=u.availabilityDelay;if(u.updated===!1)if(D){var o=333*u.misses;h=Math.max(Math.min(b,_*2),o),u.availabilityDelay=(u.availabilityDelay||0)+h}else h=b;else D?(d=Math.min(d||O/2,y),u.availabilityDelay=d,h=d+O-y):h=O-_;return Math.round(h)}function i(u,c,O){if(!u||!u.details)return null;var b=u.details,y=b.fragments[c-b.startSN];return y||(y=b.fragmentHint,y&&y.sn===c?y:c<b.startSN&&O&&O.sn===c?O:null)}function a(u,c,O){if(!u||!u.details)return null;var b=u.details.partList;if(b)for(var y=b.length;y--;){var D=b[y];if(D.index===O&&D.fragment.sn===c)return D}return null}},"./src/controller/stream-controller.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return b});var H=R("./src/polyfills/number.ts"),N=R("./src/controller/base-stream-controller.ts"),x=R("./src/is-supported.ts"),U=R("./src/events.ts"),I=R("./src/utils/buffer-helper.ts"),E=R("./src/controller/fragment-tracker.ts"),L=R("./src/types/loader.ts"),f=R("./src/loader/fragment.ts"),S=R("./src/demux/transmuxer-interface.ts"),P=R("./src/types/transmuxer.ts"),T=R("./src/controller/gap-controller.ts"),p=R("./src/errors.ts"),m=R("./src/utils/logger.ts");function i(y,D){for(var _=0;_<D.length;_++){var h=D[_];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(y,h.key,h)}}function a(y,D,_){return D&&i(y.prototype,D),_&&i(y,_),y}function u(y,D){y.prototype=Object.create(D.prototype),y.prototype.constructor=y,c(y,D)}function c(y,D){return c=Object.setPrototypeOf||function(h,d){return h.__proto__=d,h},c(y,D)}var O=100,b=function(y){u(D,y);function D(h,d){var o;return o=y.call(this,h,d,"[stream-controller]")||this,o.audioCodecSwap=!1,o.gapController=null,o.level=-1,o._forceStartLoad=!1,o.altAudio=!1,o.audioOnly=!1,o.fragPlaying=null,o.onvplaying=null,o.onvseeked=null,o.fragLastKbps=0,o.stalled=!1,o.couldBacktrack=!1,o.audioCodecSwitch=!1,o.videoBuffer=null,o._registerListeners(),o}var _=D.prototype;return _._registerListeners=function(){var d=this.hls;d.on(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(U.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(U.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),d.on(U.Events.ERROR,this.onError,this),d.on(U.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.on(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),d.on(U.Events.BUFFER_CREATED,this.onBufferCreated,this),d.on(U.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.on(U.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),d.on(U.Events.FRAG_BUFFERED,this.onFragBuffered,this)},_._unregisterListeners=function(){var d=this.hls;d.off(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(U.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),d.off(U.Events.ERROR,this.onError,this),d.off(U.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.off(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),d.off(U.Events.BUFFER_CREATED,this.onBufferCreated,this),d.off(U.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.off(U.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),d.off(U.Events.FRAG_BUFFERED,this.onFragBuffered,this)},_.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},_.startLoad=function(d){if(this.levels){var o=this.lastCurrentTime,s=this.hls;if(this.stopLoad(),this.setInterval(O),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var w=s.startLevel;w===-1&&(s.config.testBandwidth?(w=0,this.bitrateTest=!0):w=s.nextAutoLevel),this.level=s.nextLoadLevel=w,this.loadedmetadata=!1}o>0&&d===-1&&(this.log("Override startPosition with lastCurrentTime @"+o.toFixed(3)),d=o),this.state=N.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=d,this.tick()}else this._forceStartLoad=!0,this.state=N.State.STOPPED},_.stopLoad=function(){this._forceStartLoad=!1,y.prototype.stopLoad.call(this)},_.doTick=function(){switch(this.state){case N.State.IDLE:this.doTickIdle();break;case N.State.WAITING_LEVEL:{var d,o=this.levels,s=this.level,w=o==null||((d=o[s])===null||d===void 0)?void 0:d.details;if(w&&(!w.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(w))break;this.state=N.State.IDLE;break}break}case N.State.FRAG_LOADING_WAITING_RETRY:{var C,v=self.performance.now(),M=this.retryDate;(!M||v>=M||(C=this.media)!==null&&C!==void 0&&C.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=N.State.IDLE)}break;default:break}this.onTickEnd()},_.onTickEnd=function(){y.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},_.doTickIdle=function(){var d,o,s=this.hls,w=this.levelLastLoaded,C=this.levels,v=this.media,M=s.config,B=s.nextLoadLevel;if(w===null||!v&&(this.startFragRequested||!M.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!C||!C[B])return;var F=C[B];this.level=s.nextLoadLevel=B;var Q=F.details;if(!Q||this.state===N.State.WAITING_LEVEL||Q.live&&this.levelLastLoaded!==B){this.state=N.State.WAITING_LEVEL;return}var G=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:v,L.PlaylistLevelType.MAIN);if(G===null)return;var W=G.len,$=this.getMaxBufferLength(F.maxBitrate);if(W>=$)return;if(this._streamEnded(G,Q)){var re={};this.altAudio&&(re.type="video"),this.hls.trigger(U.Events.BUFFER_EOS,re),this.state=N.State.ENDED;return}var ae=G.end,he=this.getNextFragment(ae,Q);if(this.couldBacktrack&&!this.fragPrevious&&he&&he.sn!=="initSegment"){var Te=he.sn-Q.startSN;Te>1&&(he=Q.fragments[Te-1],this.fragmentTracker.removeFragment(he))}if(he&&this.fragmentTracker.getState(he)===E.FragmentState.OK&&this.nextLoadPosition>ae){var ye=this.audioOnly&&!this.altAudio?f.ElementaryStreamTypes.AUDIO:f.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(v,ye,L.PlaylistLevelType.MAIN),he=this.getNextFragment(this.nextLoadPosition,Q)}if(!he)return;he.initSegment&&!he.initSegment.data&&!this.bitrateTest&&(he=he.initSegment),((d=he.decryptdata)===null||d===void 0?void 0:d.keyFormat)==="identity"&&!((o=he.decryptdata)!==null&&o!==void 0&&o.key)?this.loadKey(he,Q):this.loadFragment(he,Q,ae)},_.loadFragment=function(d,o,s){var w,C=this.fragmentTracker.getState(d);if(this.fragCurrent=d,C===E.FragmentState.BACKTRACKED){var v=this.fragmentTracker.getBacktrackData(d);if(v){this._handleFragmentLoadProgress(v),this._handleFragmentLoadComplete(v);return}else C=E.FragmentState.NOT_LOADED}C===E.FragmentState.NOT_LOADED||C===E.FragmentState.PARTIAL?d.sn==="initSegment"?this._loadInitSegment(d):this.bitrateTest?(d.bitrateTest=!0,this.log("Fragment "+d.sn+" of level "+d.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(d)):(this.startFragRequested=!0,y.prototype.loadFragment.call(this,d,o,s)):C===E.FragmentState.APPENDING?this.reduceMaxBufferLength(d.duration)&&this.fragmentTracker.removeFragment(d):((w=this.media)===null||w===void 0?void 0:w.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},_.getAppendedFrag=function(d){var o=this.fragmentTracker.getAppendedFrag(d,L.PlaylistLevelType.MAIN);return o&&"fragment"in o?o.fragment:o},_.getBufferedFrag=function(d){return this.fragmentTracker.getBufferedFrag(d,L.PlaylistLevelType.MAIN)},_.followingBufferedFrag=function(d){return d?this.getBufferedFrag(d.end+.5):null},_.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},_.nextLevelSwitch=function(){var d=this.levels,o=this.media;if(o!=null&&o.readyState){var s,w=this.getAppendedFrag(o.currentTime);if(w&&w.start>1&&this.flushMainBuffer(0,w.start-1),!o.paused&&d){var C=this.hls.nextLoadLevel,v=d[C],M=this.fragLastKbps;M&&this.fragCurrent?s=this.fragCurrent.duration*v.maxBitrate/(1e3*M)+1:s=0}else s=0;var B=this.getBufferedFrag(o.currentTime+s);if(B){var F=this.followingBufferedFrag(B);if(F){this.abortCurrentFrag();var Q=F.maxStartPTS?F.maxStartPTS:F.start,G=F.duration,W=Math.max(B.end,Q+Math.min(Math.max(G-this.config.maxFragLookUpTolerance,G*.5),G*.75));this.flushMainBuffer(W,Number.POSITIVE_INFINITY)}}}},_.abortCurrentFrag=function(){var d=this.fragCurrent;this.fragCurrent=null,d!=null&&d.loader&&d.loader.abort(),this.state===N.State.KEY_LOADING&&(this.state=N.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},_.flushMainBuffer=function(d,o){y.prototype.flushMainBuffer.call(this,d,o,this.altAudio?"video":null)},_.onMediaAttached=function(d,o){y.prototype.onMediaAttached.call(this,d,o);var s=o.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),s.addEventListener("playing",this.onvplaying),s.addEventListener("seeked",this.onvseeked),this.gapController=new T.default(this.config,s,this.fragmentTracker,this.hls)},_.onMediaDetaching=function(){var d=this.media;d&&(d.removeEventListener("playing",this.onvplaying),d.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),y.prototype.onMediaDetaching.call(this)},_.onMediaPlaying=function(){this.tick()},_.onMediaSeeked=function(){var d=this.media,o=d?d.currentTime:null;Object(H.isFiniteNumber)(o)&&this.log("Media seeked to "+o.toFixed(3)),this.tick()},_.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(U.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},_.onManifestParsed=function(d,o){var s=!1,w=!1,C;o.levels.forEach(function(v){C=v.audioCodec,C&&(C.indexOf("mp4a.40.2")!==-1&&(s=!0),C.indexOf("mp4a.40.5")!==-1&&(w=!0))}),this.audioCodecSwitch=s&&w&&!Object(x.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=o.levels,this.startFragRequested=!1},_.onLevelLoading=function(d,o){var s=this.levels;if(!s||this.state!==N.State.IDLE)return;var w=s[o.level];(!w.details||w.details.live&&this.levelLastLoaded!==o.level||this.waitForCdnTuneIn(w.details))&&(this.state=N.State.WAITING_LEVEL)},_.onLevelLoaded=function(d,o){var s,w=this.levels,C=o.level,v=o.details,M=v.totalduration;if(!w){this.warn("Levels were reset while loading level "+C);return}this.log("Level "+C+" loaded ["+v.startSN+","+v.endSN+"], cc ["+v.startCC+", "+v.endCC+"] duration:"+M);var B=this.fragCurrent;B&&(this.state===N.State.FRAG_LOADING||this.state===N.State.FRAG_LOADING_WAITING_RETRY)&&(B.level!==o.level&&B.loader&&(this.state=N.State.IDLE,B.loader.abort()));var F=w[C],Q=0;if(v.live||(s=F.details)!==null&&s!==void 0&&s.live){if(v.fragments[0]||(v.deltaUpdateFailed=!0),v.deltaUpdateFailed)return;Q=this.alignPlaylists(v,F.details)}if(F.details=v,this.levelLastLoaded=C,this.hls.trigger(U.Events.LEVEL_UPDATED,{details:v,level:C}),this.state===N.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(v))return;this.state=N.State.IDLE}this.startFragRequested?v.live&&this.synchronizeToLiveEdge(v):this.setStartPosition(v,Q),this.tick()},_._handleFragmentLoadProgress=function(d){var o,s=d.frag,w=d.part,C=d.payload,v=this.levels;if(!v){this.warn("Levels were reset while fragment load was in progress. Fragment "+s.sn+" of level "+s.level+" will not be buffered");return}var M=v[s.level],B=M.details;if(!B){this.warn("Dropping fragment "+s.sn+" of level "+s.level+" after level details were reset");return}var F=M.videoCodec,Q=B.PTSKnown||!B.live,G=(o=s.initSegment)===null||o===void 0?void 0:o.data,W=this._getAudioCodec(M),$=this.transmuxer=this.transmuxer||new S.default(this.hls,L.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),re=w?w.index:-1,ae=re!==-1,he=new P.ChunkMetadata(s.level,s.sn,s.stats.chunkCount,C.byteLength,re,ae),Te=this.initPTS[s.cc];$.push(C,G,W,F,s,w,B.totalduration,Q,he,Te)},_.onAudioTrackSwitching=function(d,o){var s=this.altAudio,w=!!o.url,C=o.id;if(!w){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var v=this.fragCurrent;v!=null&&v.loader&&(this.log("Switching to main audio track, cancel main fragment load"),v.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var M=this.hls;s&&M.trigger(U.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),M.trigger(U.Events.AUDIO_TRACK_SWITCHED,{id:C})}},_.onAudioTrackSwitched=function(d,o){var s=o.id,w=!!this.hls.audioTracks[s].url;if(w){var C=this.videoBuffer;C&&this.mediaBuffer!==C&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=C)}this.altAudio=w,this.tick()},_.onBufferCreated=function(d,o){var s=o.tracks,w,C,v=!1;for(var M in s){var B=s[M];if(B.id==="main"){if(C=M,w=B,M==="video"){var F=s[M];F&&(this.videoBuffer=F.buffer)}}else v=!0}v&&w?(this.log("Alternate track found, use "+C+".buffered to schedule main fragment loading"),this.mediaBuffer=w.buffer):this.mediaBuffer=this.media},_.onFragBuffered=function(d,o){var s=o.frag,w=o.part;if(s&&s.type!==L.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(s)){this.warn("Fragment "+s.sn+(w?" p: "+w.index:"")+" of level "+s.level+" finished buffering, but was aborted. state: "+this.state),this.state===N.State.PARSED&&(this.state=N.State.IDLE);return}var C=w?w.stats:s.stats;this.fragLastKbps=Math.round(8*C.total/(C.buffering.end-C.loading.first)),s.sn!=="initSegment"&&(this.fragPrevious=s),this.fragBufferedComplete(s,w)},_.onError=function(d,o){switch(o.details){case p.ErrorDetails.FRAG_LOAD_ERROR:case p.ErrorDetails.FRAG_LOAD_TIMEOUT:case p.ErrorDetails.KEY_LOAD_ERROR:case p.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.MAIN,o);break;case p.ErrorDetails.LEVEL_LOAD_ERROR:case p.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==N.State.ERROR&&(o.fatal?(this.warn(""+o.details),this.state=N.State.ERROR):!o.levelRetry&&this.state===N.State.WAITING_LEVEL&&(this.state=N.State.IDLE));break;case p.ErrorDetails.BUFFER_FULL_ERROR:if(o.parent==="main"&&(this.state===N.State.PARSING||this.state===N.State.PARSED)){var s=!0,w=this.getFwdBufferInfo(this.media,L.PlaylistLevelType.MAIN);w&&w.len>.5&&(s=!this.reduceMaxBufferLength(w.len)),s&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},_.checkBuffer=function(){var d=this.media,o=this.gapController;if(!d||!o||!d.readyState)return;var s=I.BufferHelper.getBuffered(d);!this.loadedmetadata&&s.length?(this.loadedmetadata=!0,this.seekToStartPos()):o.poll(this.lastCurrentTime),this.lastCurrentTime=d.currentTime},_.onFragLoadEmergencyAborted=function(){this.state=N.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},_.onBufferFlushed=function(d,o){var s=o.type;if(s!==f.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var w=(s===f.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(w,s,L.PlaylistLevelType.MAIN)}},_.onLevelsUpdated=function(d,o){this.levels=o.levels},_.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},_.seekToStartPos=function(){var d=this.media,o=d.currentTime,s=this.startPosition;if(s>=0&&o<s){if(d.seeking){m.logger.log("could not seek to "+s+", already seeking at "+o);return}var w=I.BufferHelper.getBuffered(d),C=w.length?w.start(0):0,v=C-s;v>0&&(v<this.config.maxBufferHole||v<this.config.maxFragLookUpTolerance)&&(m.logger.log("adjusting start position by "+v+" to match buffer start"),s+=v,this.startPosition=s),this.log("seek to target start position "+s+" from current time "+o),d.currentTime=s}},_._getAudioCodec=function(d){var o=this.config.defaultAudioCodec||d.audioCodec;return this.audioCodecSwap&&o&&(this.log("Swapping audio codec"),o.indexOf("mp4a.40.5")!==-1?o="mp4a.40.2":o="mp4a.40.5"),o},_._loadBitrateTestFrag=function(d){var o=this;this._doFragLoad(d).then(function(s){var w=o.hls;if(!s||w.nextLoadLevel||o.fragContextChanged(d))return;o.fragLoadError=0,o.state=N.State.IDLE,o.startFragRequested=!1,o.bitrateTest=!1;var C=d.stats;C.parsing.start=C.parsing.end=C.buffering.start=C.buffering.end=self.performance.now(),w.trigger(U.Events.FRAG_LOADED,s)})},_._handleTransmuxComplete=function(d){var o,s="main",w=this.hls,C=d.remuxResult,v=d.chunkMeta,M=this.getCurrentContext(v);if(!M){this.warn("The loading context changed while buffering fragment "+v.sn+" of level "+v.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(v.level);return}var B=M.frag,F=M.part,Q=M.level,G=C.video,W=C.text,$=C.id3,re=C.initSegment,ae=this.altAudio?void 0:C.audio;if(this.fragContextChanged(B))return;if(this.state=N.State.PARSING,re){re.tracks&&(this._bufferInitSegment(Q,re.tracks,B,v),w.trigger(U.Events.FRAG_PARSING_INIT_SEGMENT,{frag:B,id:s,tracks:re.tracks}));var he=re.initPTS,Te=re.timescale;Object(H.isFiniteNumber)(he)&&(this.initPTS[B.cc]=he,w.trigger(U.Events.INIT_PTS_FOUND,{frag:B,id:s,initPTS:he,timescale:Te}))}if(G&&C.independent!==!1){if(Q.details){var ye=G.startPTS,Ee=G.endPTS,Oe=G.startDTS,_e=G.endDTS;if(F)F.elementaryStreams[G.type]={startPTS:ye,endPTS:Ee,startDTS:Oe,endDTS:_e};else if(G.firstKeyFrame&&G.independent&&(this.couldBacktrack=!0),G.dropped&&G.independent){var fe=this.getLoadPosition()+this.config.maxBufferHole;if(fe<ye){this.backtrack(B);return}B.setElementaryStreamInfo(G.type,B.start,Ee,B.start,_e,!0)}B.setElementaryStreamInfo(G.type,ye,Ee,Oe,_e),this.bufferFragmentData(G,B,F,v)}}else if(C.independent===!1){this.backtrack(B);return}if(ae){var le=ae.startPTS,Me=ae.endPTS,ot=ae.startDTS,ut=ae.endDTS;F&&(F.elementaryStreams[f.ElementaryStreamTypes.AUDIO]={startPTS:le,endPTS:Me,startDTS:ot,endDTS:ut}),B.setElementaryStreamInfo(f.ElementaryStreamTypes.AUDIO,le,Me,ot,ut),this.bufferFragmentData(ae,B,F,v)}if($!=null&&(o=$.samples)!==null&&o!==void 0&&o.length){var rt={frag:B,id:s,samples:$.samples};w.trigger(U.Events.FRAG_PARSING_METADATA,rt)}if(W){var tt={frag:B,id:s,samples:W.samples};w.trigger(U.Events.FRAG_PARSING_USERDATA,tt)}},_._bufferInitSegment=function(d,o,s,w){var C=this;if(this.state!==N.State.PARSING)return;this.audioOnly=!!o.audio&&!o.video,this.altAudio&&!this.audioOnly&&delete o.audio;var v=o.audio,M=o.video,B=o.audiovideo;if(v){var F=d.audioCodec,Q=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(F&&(F.indexOf("mp4a.40.5")!==-1?F="mp4a.40.2":F="mp4a.40.5"),v.metadata.channelCount!==1&&Q.indexOf("firefox")===-1&&(F="mp4a.40.5")),Q.indexOf("android")!==-1&&v.container!=="audio/mpeg"&&(F="mp4a.40.2",this.log("Android: force audio codec to "+F)),d.audioCodec&&d.audioCodec!==F&&this.log('Swapping manifest audio codec "'+d.audioCodec+'" for "'+F+'"'),v.levelCodec=F,v.id="main",this.log("Init audio buffer, container:"+v.container+", codecs[selected/level/parsed]=["+(F||"")+"/"+(d.audioCodec||"")+"/"+v.codec+"]")}M&&(M.levelCodec=d.videoCodec,M.id="main",this.log("Init video buffer, container:"+M.container+", codecs[level/parsed]=["+(d.videoCodec||"")+"/"+M.codec+"]")),B&&this.log("Init audiovideo buffer, container:"+B.container+", codecs[level/parsed]=["+(d.attrs.CODECS||"")+"/"+B.codec+"]"),this.hls.trigger(U.Events.BUFFER_CODECS,o),Object.keys(o).forEach(function(G){var W=o[G],$=W.initSegment;$!=null&&$.byteLength&&C.hls.trigger(U.Events.BUFFER_APPENDING,{type:G,data:$,frag:s,part:null,chunkMeta:w,parent:s.type})}),this.tick()},_.backtrack=function(d){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(d);var o=this.fragmentTracker.backtrack(d);this.fragPrevious=null,this.nextLoadPosition=d.start,o?this.resetFragmentLoading(d):this.state=N.State.BACKTRACKING},_.checkFragmentChanged=function(){var d=this.media,o=null;if(d&&d.readyState>1&&d.seeking===!1){var s=d.currentTime;if(I.BufferHelper.isBuffered(d,s)?o=this.getAppendedFrag(s):I.BufferHelper.isBuffered(d,s+.1)&&(o=this.getAppendedFrag(s+.1)),o){var w=this.fragPlaying,C=o.level;(!w||o.sn!==w.sn||w.level!==C||o.urlId!==w.urlId)&&(this.hls.trigger(U.Events.FRAG_CHANGED,{frag:o}),(!w||w.level!==C)&&this.hls.trigger(U.Events.LEVEL_SWITCHED,{level:C}),this.fragPlaying=o)}}},a(D,[{key:"nextLevel",get:function(){var d=this.nextBufferedFrag;return d?d.level:-1}},{key:"currentLevel",get:function(){var d=this.media;if(d){var o=this.getAppendedFrag(d.currentTime);if(o)return o.level}return-1}},{key:"nextBufferedFrag",get:function(){var d=this.media;if(d){var o=this.getAppendedFrag(d.currentTime);return this.followingBufferedFrag(o)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),D}(N.default)},"./src/controller/subtitle-stream-controller.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"SubtitleStreamController",function(){return u});var H=R("./src/events.ts"),N=R("./src/utils/logger.ts"),x=R("./src/utils/buffer-helper.ts"),U=R("./src/controller/fragment-finders.ts"),I=R("./src/utils/discontinuities.ts"),E=R("./src/controller/level-helper.ts"),L=R("./src/controller/fragment-tracker.ts"),f=R("./src/controller/base-stream-controller.ts"),S=R("./src/types/loader.ts"),P=R("./src/types/level.ts");function T(c,O){for(var b=0;b<O.length;b++){var y=O[b];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(c,y.key,y)}}function p(c,O,b){return O&&T(c.prototype,O),b&&T(c,b),c}function m(c,O){c.prototype=Object.create(O.prototype),c.prototype.constructor=c,i(c,O)}function i(c,O){return i=Object.setPrototypeOf||function(y,D){return y.__proto__=D,y},i(c,O)}var a=500,u=function(c){m(O,c);function O(y,D){var _;return _=c.call(this,y,D,"[subtitle-stream-controller]")||this,_.levels=[],_.currentTrackId=-1,_.tracksBuffered=[],_.mainDetails=null,_._registerListeners(),_}var b=O.prototype;return b.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},b._registerListeners=function(){var D=this.hls;D.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),D.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),D.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),D.on(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),D.on(H.Events.ERROR,this.onError,this),D.on(H.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),D.on(H.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),D.on(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),D.on(H.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),D.on(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},b._unregisterListeners=function(){var D=this.hls;D.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),D.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),D.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),D.off(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),D.off(H.Events.ERROR,this.onError,this),D.off(H.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),D.off(H.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),D.off(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),D.off(H.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),D.off(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},b.startLoad=function(){this.stopLoad(),this.state=f.State.IDLE,this.setInterval(a),this.tick()},b.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},b.onLevelLoaded=function(D,_){this.mainDetails=_.details},b.onSubtitleFragProcessed=function(D,_){var h=_.frag,d=_.success;if(this.fragPrevious=h,this.state=f.State.IDLE,!d)return;var o=this.tracksBuffered[this.currentTrackId];if(!o)return;for(var s,w=h.start,C=0;C<o.length;C++)if(w>=o[C].start&&w<=o[C].end){s=o[C];break}var v=h.start+h.duration;s?s.end=v:(s={start:w,end:v},o.push(s)),this.fragmentTracker.fragBuffered(h)},b.onBufferFlushing=function(D,_){var h=_.startOffset,d=_.endOffset;if(h===0&&d!==Number.POSITIVE_INFINITY){var o=this.currentTrackId,s=this.levels;if(!s.length||!s[o]||!s[o].details)return;var w=s[o].details,C=w.targetduration,v=d-C;if(v<=0)return;_.endOffsetSubtitles=Math.max(0,v),this.tracksBuffered.forEach(function(M){for(var B=0;B<M.length;){if(M[B].end<=v){M.shift();continue}else if(M[B].start<v)M[B].start=v;else break;B++}}),this.fragmentTracker.removeFragmentsInRange(h,v,S.PlaylistLevelType.SUBTITLE)}},b.onError=function(D,_){var h,d=_.frag;if(!d||d.type!==S.PlaylistLevelType.SUBTITLE)return;(h=this.fragCurrent)!==null&&h!==void 0&&h.loader&&this.fragCurrent.loader.abort(),this.state=f.State.IDLE},b.onSubtitleTracksUpdated=function(D,_){var h=this,d=_.subtitleTracks;this.tracksBuffered=[],this.levels=d.map(function(o){return new P.Level(o)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(o){h.tracksBuffered[o.id]=[]}),this.mediaBuffer=null},b.onSubtitleTrackSwitch=function(D,_){if(this.currentTrackId=_.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var h=this.levels[this.currentTrackId];h!=null&&h.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,h&&this.setInterval(a)},b.onSubtitleTrackLoaded=function(D,_){var h,d=_.details,o=_.id,s=this.currentTrackId,w=this.levels;if(!w.length)return;var C=w[s];if(o>=w.length||o!==s||!C)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,d.live||(h=C.details)!==null&&h!==void 0&&h.live){var v=this.mainDetails;if(d.deltaUpdateFailed||!v)return;var M=v.fragments[0];if(!C.details)d.hasProgramDateTime&&v.hasProgramDateTime?Object(I.alignMediaPlaylistByPDT)(d,v):M&&Object(E.addSliding)(d,M.start);else{var B=this.alignPlaylists(d,C.details);B===0&&M&&Object(E.addSliding)(d,M.start)}}if(C.details=d,this.levelLastLoaded=o,this.tick(),d.live&&!this.fragCurrent&&this.media&&this.state===f.State.IDLE){var F=Object(U.findFragmentByPTS)(null,d.fragments,this.media.currentTime,0);F||(this.warn("Subtitle playlist not aligned with playback"),C.details=void 0)}},b._handleFragmentLoadComplete=function(D){var _=D.frag,h=D.payload,d=_.decryptdata,o=this.hls;if(this.fragContextChanged(_))return;if(h&&h.byteLength>0&&d&&d.key&&d.iv&&d.method==="AES-128"){var s=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(h),d.key.buffer,d.iv.buffer).then(function(w){var C=performance.now();o.trigger(H.Events.FRAG_DECRYPTED,{frag:_,payload:w,stats:{tstart:s,tdecrypt:C}})})}},b.doTick=function(){if(!this.media){this.state=f.State.IDLE;return}if(this.state===f.State.IDLE){var D,_=this.currentTrackId,h=this.levels;if(!h.length||!h[_]||!h[_].details)return;var d=h[_].details,o=d.targetduration,s=this.config,w=this.media,C=x.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,w.currentTime-o,s.maxBufferHole),v=C.end,M=C.len,B=this.getMaxBufferLength()+o;if(M>B)return;console.assert(d,"Subtitle track details are defined on idle subtitle stream controller tick");var F=d.fragments,Q=F.length,G=d.edge,W,$=this.fragPrevious;if(v<G){var re=s.maxFragLookUpTolerance;$&&d.hasProgramDateTime&&(W=Object(U.findFragmentByPDT)(F,$.endProgramDateTime,re)),W||(W=Object(U.findFragmentByPTS)($,F,v,re),!W&&$&&$.start<F[0].start&&(W=F[0]))}else W=F[Q-1];(D=W)!==null&&D!==void 0&&D.encrypted?(N.logger.log("Loading key for "+W.sn),this.state=f.State.KEY_LOADING,this.hls.trigger(H.Events.KEY_LOADING,{frag:W})):W&&this.fragmentTracker.getState(W)===L.FragmentState.NOT_LOADED&&this.loadFragment(W,d,v)}},b.loadFragment=function(D,_,h){this.fragCurrent=D,c.prototype.loadFragment.call(this,D,_,h)},p(O,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),O}(f.default)},"./src/controller/subtitle-track-controller.ts":function(J,K,R){"use strict";R.r(K);var H=R("./src/events.ts"),N=R("./src/utils/texttrack-utils.ts"),x=R("./src/controller/base-playlist-controller.ts"),U=R("./src/types/loader.ts");function I(T,p){for(var m=0;m<p.length;m++){var i=p[m];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(T,i.key,i)}}function E(T,p,m){return p&&I(T.prototype,p),m&&I(T,m),T}function L(T,p){T.prototype=Object.create(p.prototype),T.prototype.constructor=T,f(T,p)}function f(T,p){return f=Object.setPrototypeOf||function(i,a){return i.__proto__=a,i},f(T,p)}var S=function(T){L(p,T);function p(i){var a;return a=T.call(this,i,"[subtitle-track-controller]")||this,a.media=null,a.tracks=[],a.groupId=null,a.tracksInGroup=[],a.trackId=-1,a.selectDefaultTrack=!0,a.queuedDefaultTrack=-1,a.trackChangeListener=function(){return a.onTextTracksChanged()},a.asyncPollTrackChange=function(){return a.pollTrackChange(0)},a.useTextTrackPolling=!1,a.subtitlePollingInterval=-1,a.subtitleDisplay=!0,a.registerListeners(),a}var m=p.prototype;return m.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,T.prototype.destroy.call(this)},m.registerListeners=function(){var a=this.hls;a.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.on(H.Events.ERROR,this.onError,this)},m.unregisterListeners=function(){var a=this.hls;a.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(H.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.off(H.Events.ERROR,this.onError,this)},m.onMediaAttached=function(a,u){if(this.media=u.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)},m.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},m.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 a=P(this.media.textTracks);a.forEach(function(u){Object(N.clearCurrentCues)(u)}),this.subtitleTrack=-1,this.media=null},m.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},m.onManifestParsed=function(a,u){this.tracks=u.subtitleTracks},m.onSubtitleTrackLoaded=function(a,u){var c=u.id,O=u.details,b=this.trackId,y=this.tracksInGroup[b];if(!y){this.warn("Invalid subtitle track id "+c);return}var D=y.details;y.details=u.details,this.log("subtitle track "+c+" loaded ["+O.startSN+"-"+O.endSN+"]"),c===this.trackId&&(this.retryCount=0,this.playlistLoaded(c,u,D))},m.onLevelLoading=function(a,u){this.switchLevel(u.level)},m.onLevelSwitching=function(a,u){this.switchLevel(u.level)},m.switchLevel=function(a){var u=this.hls.levels[a];if(!(u!=null&&u.textGroupIds))return;var c=u.textGroupIds[u.urlId];if(this.groupId!==c){var O=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,b=this.tracks.filter(function(_){return!c||_.groupId===c});this.tracksInGroup=b;var y=this.findTrackId(O==null?void 0:O.name)||this.findTrackId();this.groupId=c;var D={subtitleTracks:b};this.log("Updating subtitle tracks, "+b.length+' track(s) found in "'+c+'" group-id'),this.hls.trigger(H.Events.SUBTITLE_TRACKS_UPDATED,D),y!==-1&&this.setSubtitleTrack(y,O)}},m.findTrackId=function(a){for(var u=this.tracksInGroup,c=0;c<u.length;c++){var O=u[c];if((!this.selectDefaultTrack||O.default)&&(!a||a===O.name))return O.id}return-1},m.onError=function(a,u){if(T.prototype.onError.call(this,a,u),u.fatal||!u.context)return;u.context.type===U.PlaylistContextType.SUBTITLE_TRACK&&u.context.id===this.trackId&&u.context.groupId===this.groupId&&this.retryLoadingOrFail(u)},m.loadPlaylist=function(a){var u=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(u)){var c=u.id,O=u.groupId,b=u.url;if(a)try{b=a.addDirectives(b)}catch(y){this.warn("Could not construct new URL with HLS Delivery Directives: "+y)}this.log("Loading subtitle playlist for id "+c),this.hls.trigger(H.Events.SUBTITLE_TRACK_LOADING,{url:b,id:c,groupId:O,deliveryDirectives:a||null})}},m.toggleTrackModes=function(a){var u=this,c=this.media,O=this.subtitleDisplay,b=this.trackId;if(!c)return;var y=P(c.textTracks),D=y.filter(function(d){return d.groupId===u.groupId});if(a===-1)[].slice.call(y).forEach(function(d){d.mode="disabled"});else{var _=D[b];_&&(_.mode="disabled")}var h=D[a];h&&(h.mode=O?"showing":"hidden")},m.setSubtitleTrack=function(a,u){var c,O=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=a;return}if(this.trackId!==a&&this.toggleTrackModes(a),this.trackId===a&&(a===-1||(c=O[a])!==null&&c!==void 0&&c.details)||a<-1||a>=O.length)return;this.clearTimer();var b=O[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,b){var y=b.id,D=b.groupId,_=D===void 0?"":D,h=b.name,d=b.type,o=b.url;this.hls.trigger(H.Events.SUBTITLE_TRACK_SWITCH,{id:y,groupId:_,name:h,type:d,url:o});var s=this.switchParams(b.url,u==null?void 0:u.details);this.loadPlaylist(s)}else this.hls.trigger(H.Events.SUBTITLE_TRACK_SWITCH,{id:a})},m.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var a=-1,u=P(this.media.textTracks),c=0;c<u.length;c++)if(u[c].mode==="hidden")a=c;else if(u[c].mode==="showing"){a=c;break}this.subtitleTrack!==a&&(this.subtitleTrack=a)},E(p,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1;var u=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(a,u)}}]),p}(x.default);function P(T){for(var p=[],m=0;m<T.length;m++){var i=T[m];i.kind==="subtitles"&&i.label&&p.push(T[m])}return p}K.default=S},"./src/controller/timeline-controller.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"TimelineController",function(){return P});var H=R("./src/polyfills/number.ts"),N=R("./src/events.ts"),x=R("./src/utils/cea-608-parser.ts"),U=R("./src/utils/output-filter.ts"),I=R("./src/utils/webvtt-parser.ts"),E=R("./src/utils/texttrack-utils.ts"),L=R("./src/utils/imsc1-ttml-parser.ts"),f=R("./src/types/loader.ts"),S=R("./src/utils/logger.ts"),P=function(){function i(u){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=m(),this.captionsProperties=void 0,this.hls=u,this.config=u.config,this.Cues=u.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 c=new U.default(this,"textTrack1"),O=new U.default(this,"textTrack2"),b=new U.default(this,"textTrack3"),y=new U.default(this,"textTrack4");this.cea608Parser1=new x.default(1,c,O),this.cea608Parser2=new x.default(3,b,y)}u.on(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.on(N.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.on(N.Events.FRAG_LOADING,this.onFragLoading,this),u.on(N.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(N.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.on(N.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.on(N.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(N.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.on(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var a=i.prototype;return a.destroy=function(){var c=this.hls;c.off(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),c.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(N.Events.MANIFEST_LOADED,this.onManifestLoaded,this),c.off(N.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),c.off(N.Events.FRAG_LOADING,this.onFragLoading,this),c.off(N.Events.FRAG_LOADED,this.onFragLoaded,this),c.off(N.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),c.off(N.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),c.off(N.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),c.off(N.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),c.off(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},a.addCues=function(c,O,b,y,D){for(var _=!1,h=D.length;h--;){var d=D[h],o=p(d[0],d[1],O,b);if(o>=0&&(d[0]=Math.min(d[0],O),d[1]=Math.max(d[1],b),_=!0,o/(b-O)>.5))return}if(_||D.push([O,b]),this.config.renderTextTracksNatively){var s=this.captionsTracks[c];this.Cues.newCue(s,O,b,y)}else{var w=this.Cues.newCue(null,O,b,y);this.hls.trigger(N.Events.CUES_PARSED,{type:"captions",cues:w,track:c})}},a.onInitPtsFound=function(c,O){var b=this,y=O.frag,D=O.id,_=O.initPTS,h=O.timescale,d=this.unparsedVttFrags;D==="main"&&(this.initPTS[y.cc]=_,this.timescale[y.cc]=h),d.length&&(this.unparsedVttFrags=[],d.forEach(function(o){b.onFragLoaded(N.Events.FRAG_LOADED,o)}))},a.getExistingTrack=function(c){var O=this.media;if(O)for(var b=0;b<O.textTracks.length;b++){var y=O.textTracks[b];if(y[c])return y}return null},a.createCaptionsTrack=function(c){this.config.renderTextTracksNatively?this.createNativeTrack(c):this.createNonNativeTrack(c)},a.createNativeTrack=function(c){if(this.captionsTracks[c])return;var O=this.captionsProperties,b=this.captionsTracks,y=this.media,D=O[c],_=D.label,h=D.languageCode,d=this.getExistingTrack(c);if(d)b[c]=d,Object(E.clearCurrentCues)(b[c]),Object(E.sendAddTrackEvent)(b[c],y);else{var o=this.createTextTrack("captions",_,h);o&&(o[c]=!0,b[c]=o)}},a.createNonNativeTrack=function(c){if(this.nonNativeCaptionsTracks[c])return;var O=this.captionsProperties[c];if(!O)return;var b=O.label,y={_id:c,label:b,kind:"captions",default:O.media?!!O.media.default:!1,closedCaptions:O.media};this.nonNativeCaptionsTracks[c]=y,this.hls.trigger(N.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[y]})},a.createTextTrack=function(c,O,b){var y=this.media;return y?y.addTextTrack(c,O,b):void 0},a.onMediaAttaching=function(c,O){this.media=O.media,this._cleanTracks()},a.onMediaDetaching=function(){var c=this.captionsTracks;Object.keys(c).forEach(function(O){Object(E.clearCurrentCues)(c[O]),delete c[O]}),this.nonNativeCaptionsTracks={}},a.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=m(),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())},a._cleanTracks=function(){var c=this.media;if(!c)return;var O=c.textTracks;if(O)for(var b=0;b<O.length;b++)Object(E.clearCurrentCues)(O[b])},a.onSubtitleTracksUpdated=function(c,O){var b=this;this.textTracks=[];var y=O.subtitleTracks||[],D=y.some(function(o){return o.textCodec===L.IMSC1_CODEC});if(this.config.enableWebVTT||D&&this.config.enableIMSC1){var _=this.tracks&&y&&this.tracks.length===y.length;if(this.tracks=y||[],this.config.renderTextTracksNatively){var h=this.media?this.media.textTracks:[];this.tracks.forEach(function(o,s){var w;if(s<h.length){for(var C=null,v=0;v<h.length;v++)if(T(h[v],o)){C=h[v];break}C&&(w=C)}w?Object(E.clearCurrentCues)(w):(w=b.createTextTrack("subtitles",o.name,o.lang),w&&(w.mode="disabled")),w&&(w.groupId=o.groupId,b.textTracks.push(w))})}else if(!_&&this.tracks&&this.tracks.length){var d=this.tracks.map(function(o){return{label:o.name,kind:o.type.toLowerCase(),default:o.default,subtitleTrack:o}});this.hls.trigger(N.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:d})}}},a.onManifestLoaded=function(c,O){var b=this;this.config.enableCEA708Captions&&O.captions&&O.captions.forEach(function(y){var D=/(?:CC|SERVICE)([1-4])/.exec(y.instreamId);if(!D)return;var _="textTrack"+D[1],h=b.captionsProperties[_];if(!h)return;h.label=y.name,y.lang&&(h.languageCode=y.lang),h.media=y})},a.onFragLoading=function(c,O){var b=this.cea608Parser1,y=this.cea608Parser2,D=this.lastSn,_=this.lastPartIndex;if(!this.enabled||!(b&&y))return;if(O.frag.type===f.PlaylistLevelType.MAIN){var h,d,o=O.frag.sn,s=(h=O==null||((d=O.part)===null||d===void 0)?void 0:d.index)!=null?h:-1;o===D+1||o===D&&s===_+1||(b.reset(),y.reset()),this.lastSn=o,this.lastPartIndex=s}},a.onFragLoaded=function(c,O){var b=O.frag,y=O.payload,D=this.initPTS,_=this.unparsedVttFrags;if(b.type===f.PlaylistLevelType.SUBTITLE)if(y.byteLength){if(!Object(H.isFiniteNumber)(D[b.cc])){_.push(O),D.length&&this.hls.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:b,error:new Error("Missing initial subtitle PTS")});return}var h=b.decryptdata;if(h==null||h.key==null||h.method!=="AES-128"){var d=this.tracks[b.level],o=this.vttCCs;o[b.cc]||(o[b.cc]={start:b.start,prevCC:this.prevCC,new:!0},this.prevCC=b.cc),d&&d.textCodec===L.IMSC1_CODEC?this._parseIMSC1(b,y):this._parseVTTs(b,y,o)}}else this.hls.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:b,error:new Error("Empty subtitle payload")})},a._parseIMSC1=function(c,O){var b=this,y=this.hls;Object(L.parseIMSC1)(O,this.initPTS[c.cc],this.timescale[c.cc],function(D){b._appendCues(D,c.level),y.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:c})},function(D){S.logger.log("Failed to parse IMSC1: "+D),y.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c,error:D})})},a._parseVTTs=function(c,O,b){var y=this,D=this.hls;Object(I.parseWebVTT)(O,this.initPTS[c.cc],this.timescale[c.cc],b,c.cc,c.start,function(_){y._appendCues(_,c.level),D.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:c})},function(_){y._fallbackToIMSC1(c,O),S.logger.log("Failed to parse VTT cue: "+_),D.trigger(N.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c,error:_})})},a._fallbackToIMSC1=function(c,O){var b=this,y=this.tracks[c.level];y.textCodec||Object(L.parseIMSC1)(O,this.initPTS[c.cc],this.timescale[c.cc],function(){y.textCodec=L.IMSC1_CODEC,b._parseIMSC1(c,O)},function(){y.textCodec="wvtt"})},a._appendCues=function(c,O){var b=this.hls;if(this.config.renderTextTracksNatively){var y=this.textTracks[O];if(y.mode==="disabled")return;c.forEach(function(h){return Object(E.addCueToTrack)(y,h)})}else{var D=this.tracks[O],_=D.default?"default":"subtitles"+O;b.trigger(N.Events.CUES_PARSED,{type:"subtitles",cues:c,track:_})}},a.onFragDecrypted=function(c,O){var b=O.frag;if(b.type===f.PlaylistLevelType.SUBTITLE){if(!Object(H.isFiniteNumber)(this.initPTS[b.cc])){this.unparsedVttFrags.push(O);return}this.onFragLoaded(N.Events.FRAG_LOADED,O)}},a.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},a.onFragParsingUserdata=function(c,O){var b=this.cea608Parser1,y=this.cea608Parser2;if(!this.enabled||!(b&&y))return;for(var D=0;D<O.samples.length;D++){var _=O.samples[D].bytes;if(_){var h=this.extractCea608Data(_);b.addData(O.samples[D].pts,h[0]),y.addData(O.samples[D].pts,h[1])}}},a.onBufferFlushing=function(c,O){var b=O.startOffset,y=O.endOffset,D=O.endOffsetSubtitles,_=O.type,h=this.media;if(!h||h.currentTime<y)return;if(!_||_==="video"){var d=this.captionsTracks;Object.keys(d).forEach(function(s){return Object(E.removeCuesInRange)(d[s],b,y)})}if(this.config.renderTextTracksNatively&&(b===0&&D!==void 0)){var o=this.textTracks;Object.keys(o).forEach(function(s){return Object(E.removeCuesInRange)(o[s],b,D)})}},a.extractCea608Data=function(c){for(var O=c[0]&31,b=2,y=[[],[]],D=0;D<O;D++){var _=c[b++],h=127&c[b++],d=127&c[b++],o=(4&_)!==0,s=3&_;if(h===0&&d===0)continue;o&&((s===0||s===1)&&(y[s].push(h),y[s].push(d)))}return y},i}();function T(i,a){return i&&i.label===a.name&&!(i.textTrack1||i.textTrack2)}function p(i,a,u,c){return Math.min(a,c)-Math.max(i,u)}function m(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return H});var H=function(){function N(U,I){this.subtle=void 0,this.aesIV=void 0,this.subtle=U,this.aesIV=I}var x=N.prototype;return x.decrypt=function(I,E){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},E,I)},N}()},"./src/crypt/aes-decryptor.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"removePadding",function(){return N}),R.d(K,"default",function(){return x});var H=R("./src/utils/typed-array.ts");function N(U){var I=U.byteLength,E=I&&new DataView(U.buffer).getUint8(I-1);return E?Object(H.sliceUint8)(U,0,I-E):U}var x=function(){function U(){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 I=U.prototype;return I.uint8ArrayToUint32Array_=function(L){for(var f=new DataView(L),S=new Uint32Array(4),P=0;P<4;P++)S[P]=f.getUint32(P*4);return S},I.initTable=function(){var L=this.sBox,f=this.invSBox,S=this.subMix,P=S[0],T=S[1],p=S[2],m=S[3],i=this.invSubMix,a=i[0],u=i[1],c=i[2],O=i[3],b=new Uint32Array(256),y=0,D=0,_=0;for(_=0;_<256;_++)_<128?b[_]=_<<1:b[_]=_<<1^283;for(_=0;_<256;_++){var h=D^D<<1^D<<2^D<<3^D<<4;h=h>>>8^h&255^99,L[y]=h,f[h]=y;var d=b[y],o=b[d],s=b[o],w=b[h]*257^h*16843008;P[y]=w<<24|w>>>8,T[y]=w<<16|w>>>16,p[y]=w<<8|w>>>24,m[y]=w,w=s*16843009^o*65537^d*257^y*16843008,a[h]=w<<24|w>>>8,u[h]=w<<16|w>>>16,c[h]=w<<8|w>>>24,O[h]=w,y?(y=d^b[b[b[s^d]]],D^=b[b[D]]):y=D=1}},I.expandKey=function(L){for(var f=this.uint8ArrayToUint32Array_(L),S=!0,P=0;P<f.length&&S;)S=f[P]===this.key[P],P++;if(S)return;this.key=f;var T=this.keySize=f.length;if(T!==4&&T!==6&&T!==8)throw new Error("Invalid aes key size="+T);var p=this.ksRows=(T+6+1)*4,m,i,a=this.keySchedule=new Uint32Array(p),u=this.invKeySchedule=new Uint32Array(p),c=this.sBox,O=this.rcon,b=this.invSubMix,y=b[0],D=b[1],_=b[2],h=b[3],d,o;for(m=0;m<p;m++){if(m<T){d=a[m]=f[m];continue}o=d,m%T===0?(o=o<<8|o>>>24,o=c[o>>>24]<<24|c[o>>>16&255]<<16|c[o>>>8&255]<<8|c[o&255],o^=O[m/T|0]<<24):T>6&&m%T===4&&(o=c[o>>>24]<<24|c[o>>>16&255]<<16|c[o>>>8&255]<<8|c[o&255]),a[m]=d=(a[m-T]^o)>>>0}for(i=0;i<p;i++)m=p-i,i&3?o=a[m]:o=a[m-4],i<4||m<=4?u[i]=o:u[i]=y[c[o>>>24]]^D[c[o>>>16&255]]^_[c[o>>>8&255]]^h[c[o&255]],u[i]=u[i]>>>0},I.networkToHostOrderSwap=function(L){return L<<24|(L&65280)<<8|(L&16711680)>>8|L>>>24},I.decrypt=function(L,f,S){for(var P=this.keySize+6,T=this.invKeySchedule,p=this.invSBox,m=this.invSubMix,i=m[0],a=m[1],u=m[2],c=m[3],O=this.uint8ArrayToUint32Array_(S),b=O[0],y=O[1],D=O[2],_=O[3],h=new Int32Array(L),d=new Int32Array(h.length),o,s,w,C,v,M,B,F,Q,G,W,$,re,ae,he=this.networkToHostOrderSwap;f<h.length;){for(Q=he(h[f]),G=he(h[f+1]),W=he(h[f+2]),$=he(h[f+3]),v=Q^T[0],M=$^T[1],B=W^T[2],F=G^T[3],re=4,ae=1;ae<P;ae++)o=i[v>>>24]^a[M>>16&255]^u[B>>8&255]^c[F&255]^T[re],s=i[M>>>24]^a[B>>16&255]^u[F>>8&255]^c[v&255]^T[re+1],w=i[B>>>24]^a[F>>16&255]^u[v>>8&255]^c[M&255]^T[re+2],C=i[F>>>24]^a[v>>16&255]^u[M>>8&255]^c[B&255]^T[re+3],v=o,M=s,B=w,F=C,re=re+4;o=p[v>>>24]<<24^p[M>>16&255]<<16^p[B>>8&255]<<8^p[F&255]^T[re],s=p[M>>>24]<<24^p[B>>16&255]<<16^p[F>>8&255]<<8^p[v&255]^T[re+1],w=p[B>>>24]<<24^p[F>>16&255]<<16^p[v>>8&255]<<8^p[M&255]^T[re+2],C=p[F>>>24]<<24^p[v>>16&255]<<16^p[M>>8&255]<<8^p[B&255]^T[re+3],d[f]=he(o^b),d[f+1]=he(C^y),d[f+2]=he(w^D),d[f+3]=he(s^_),b=Q,y=G,D=W,_=$,f=f+4}return d.buffer},U}()},"./src/crypt/decrypter.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return f});var H=R("./src/crypt/aes-crypto.ts"),N=R("./src/crypt/fast-aes-key.ts"),x=R("./src/crypt/aes-decryptor.ts"),U=R("./src/utils/logger.ts"),I=R("./src/utils/mp4-tools.ts"),E=R("./src/utils/typed-array.ts"),L=16,f=function(){function S(T,p,m){var i=m===void 0?{}:m,a=i.removePKCS7Padding,u=a===void 0?!0:a;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=T,this.config=p,this.removePKCS7Padding=u,u)try{var c=self.crypto;c&&(this.subtle=c.subtle||c.webkitSubtle)}catch(O){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var P=S.prototype;return P.destroy=function(){this.observer=null},P.isSync=function(){return this.config.enableSoftwareAES},P.flush=function(){var p=this.currentResult;if(!p){this.reset();return}var m=new Uint8Array(p);return this.reset(),this.removePKCS7Padding?Object(x.removePadding)(m):m},P.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},P.decrypt=function(p,m,i,a){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(p),m,i);var u=this.flush();u&&a(u.buffer)}else this.webCryptoDecrypt(new Uint8Array(p),m,i).then(a)},P.softwareDecrypt=function(p,m,i){var a=this.currentIV,u=this.currentResult,c=this.remainderData;this.logOnce("JS AES decrypt"),c&&(p=Object(I.appendUint8Array)(c,p),this.remainderData=null);var O=this.getValidChunk(p);if(!O.length)return null;a&&(i=a);var b=this.softwareDecrypter;b||(b=this.softwareDecrypter=new x.default),b.expandKey(m);var y=u;return this.currentResult=b.decrypt(O.buffer,0,i),this.currentIV=Object(E.sliceUint8)(O,-16).buffer,y||null},P.webCryptoDecrypt=function(p,m,i){var a=this,u=this.subtle;return(this.key!==m||!this.fastAesKey)&&(this.key=m,this.fastAesKey=new N.default(u,m)),this.fastAesKey.expandKey().then(function(c){if(!u)return Promise.reject(new Error("web crypto not initialized"));var O=new H.default(u,i);return O.decrypt(p.buffer,c)}).catch(function(c){return a.onWebCryptoError(c,p,m,i)})},P.onWebCryptoError=function(p,m,i,a){return U.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",p),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(m,i,a)},P.getValidChunk=function(p){var m=p,i=p.length-p.length%L;return i!==p.length&&(m=Object(E.sliceUint8)(p,0,i),this.remainderData=Object(E.sliceUint8)(p,i)),m},P.logOnce=function(p){if(!this.logEnabled)return;U.logger.log("[decrypter.ts]: "+p),this.logEnabled=!1},S}()},"./src/crypt/fast-aes-key.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return H});var H=function(){function N(U,I){this.subtle=void 0,this.key=void 0,this.subtle=U,this.key=I}var x=N.prototype;return x.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},N}()},"./src/demux/aacdemuxer.ts":function(J,K,R){"use strict";R.r(K);var H=R("./src/demux/base-audio-demuxer.ts"),N=R("./src/demux/adts.ts"),x=R("./src/utils/logger.ts"),U=R("./src/demux/id3.ts");function I(f,S){f.prototype=Object.create(S.prototype),f.prototype.constructor=f,E(f,S)}function E(f,S){return E=Object.setPrototypeOf||function(T,p){return T.__proto__=p,T},E(f,S)}var L=function(f){I(S,f);function S(T,p){var m;return m=f.call(this)||this,m.observer=void 0,m.config=void 0,m.observer=T,m.config=p,m}var P=S.prototype;return P.resetInitSegment=function(p,m,i){f.prototype.resetInitSegment.call(this,p,m,i),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:p,duration:i,inputTimeScale:9e4,dropped:0}},S.probe=function(p){if(!p)return!1;for(var m=U.getID3Data(p,0)||[],i=m.length,a=p.length;i<a;i++)if(N.probe(p,i))return x.logger.log("ADTS sync word found !"),!0;return!1},P.canParse=function(p,m){return N.canParse(p,m)},P.appendFrame=function(p,m,i){N.initTrackConfig(p,this.observer,m,i,p.manifestCodec);var a=N.appendFrame(p,m,i,this.initPTS,this.frameIndex);if(a&&a.missing===0)return a},S}(H.default);L.minProbeByteLength=9,K.default=L},"./src/demux/adts.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"getAudioConfig",function(){return U}),R.d(K,"isHeaderPattern",function(){return I}),R.d(K,"getHeaderLength",function(){return E}),R.d(K,"getFullFrameLength",function(){return L}),R.d(K,"canGetFrameLength",function(){return f}),R.d(K,"isHeader",function(){return S}),R.d(K,"canParse",function(){return P}),R.d(K,"probe",function(){return T}),R.d(K,"initTrackConfig",function(){return p}),R.d(K,"getFrameDuration",function(){return m}),R.d(K,"parseFrameHeader",function(){return i}),R.d(K,"appendFrame",function(){return a});var H=R("./src/utils/logger.ts"),N=R("./src/errors.ts"),x=R("./src/events.ts");function U(u,c,O,b){var y,D,_,h,d=navigator.userAgent.toLowerCase(),o=b,s=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];y=((c[O+2]&192)>>>6)+1;var w=(c[O+2]&60)>>>2;if(w>s.length-1){u.trigger(x.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+w});return}return _=(c[O+2]&1)<<2,_|=(c[O+3]&192)>>>6,H.logger.log("manifest codec:"+b+", ADTS type:"+y+", samplingIndex:"+w),/firefox/i.test(d)?w>=6?(y=5,h=new Array(4),D=w-3):(y=2,h=new Array(2),D=w):d.indexOf("android")!==-1?(y=2,h=new Array(2),D=w):(y=5,h=new Array(4),b&&(b.indexOf("mp4a.40.29")!==-1||b.indexOf("mp4a.40.5")!==-1)||!b&&w>=6?D=w-3:((b&&b.indexOf("mp4a.40.2")!==-1&&(w>=6&&_===1||/vivaldi/i.test(d))||!b&&_===1)&&(y=2,h=new Array(2)),D=w)),h[0]=y<<3,h[0]|=(w&14)>>1,h[1]|=(w&1)<<7,h[1]|=_<<3,y===5&&(h[1]|=(D&14)>>1,h[2]=(D&1)<<7,h[2]|=2<<2,h[3]=0),{config:h,samplerate:s[w],channelCount:_,codec:"mp4a.40."+y,manifestCodec:o}}function I(u,c){return u[c]===255&&(u[c+1]&246)===240}function E(u,c){return u[c+1]&1?7:9}function L(u,c){return(u[c+3]&3)<<11|u[c+4]<<3|(u[c+5]&224)>>>5}function f(u,c){return c+5<u.length}function S(u,c){return c+1<u.length&&I(u,c)}function P(u,c){return f(u,c)&&I(u,c)&&L(u,c)<=u.length-c}function T(u,c){if(S(u,c)){var O=E(u,c);if(c+O>=u.length)return!1;var b=L(u,c);if(b<=O)return!1;var y=c+b;return y===u.length||S(u,y)}return!1}function p(u,c,O,b,y){if(!u.samplerate){var D=U(c,O,b,y);if(!D)return;u.config=D.config,u.samplerate=D.samplerate,u.channelCount=D.channelCount,u.codec=D.codec,u.manifestCodec=D.manifestCodec,H.logger.log("parsed codec:"+u.codec+", rate:"+D.samplerate+", channels:"+D.channelCount)}}function m(u){return 1024*9e4/u}function i(u,c,O,b,y){var D=E(u,c),_=L(u,c);if(_-=D,_>0){var h=O+b*y;return{headerLength:D,frameLength:_,stamp:h}}}function a(u,c,O,b,y){var D=m(u.samplerate),_=i(c,O,b,y,D);if(_){var h=_.frameLength,d=_.headerLength,o=_.stamp,s=d+h,w=Math.max(0,O+s-c.length),C;w?(C=new Uint8Array(s-d),C.set(c.subarray(O+d,c.length),0)):C=c.subarray(O+d,O+s);var v={unit:C,pts:o};return w||u.samples.push(v),{sample:v,length:s,missing:w}}}},"./src/demux/base-audio-demuxer.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"initPTSFn",function(){return L});var H=R("./src/polyfills/number.ts"),N=R("./src/demux/id3.ts"),x=R("./src/demux/dummy-demuxed-track.ts"),U=R("./src/utils/mp4-tools.ts"),I=R("./src/utils/typed-array.ts"),E=function(){function f(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var S=f.prototype;return S.resetInitSegment=function(T,p,m){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},S.resetTimeStamp=function(){},S.resetContiguity=function(){},S.canParse=function(T,p){return!1},S.appendFrame=function(T,p,m){},S.demux=function(T,p){this.cachedData&&(T=Object(U.appendUint8Array)(this.cachedData,T),this.cachedData=null);var m=N.getID3Data(T,0),i=m?m.length:0,a,u,c=this._audioTrack,O=this._id3Track,b=m?N.getTimeStamp(m):void 0,y=T.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=L(b,p)),m&&m.length>0&&O.samples.push({pts:this.initPTS,dts:this.initPTS,data:m}),u=this.initPTS;i<y;){if(this.canParse(T,i)){var D=this.appendFrame(c,T,i);D?(this.frameIndex++,u=D.sample.pts,i+=D.length,a=i):i=y}else N.canParse(T,i)?(m=N.getID3Data(T,i),O.samples.push({pts:u,dts:u,data:m}),i+=m.length,a=i):i++;if(i===y&&a!==y){var _=Object(I.sliceUint8)(T,a);this.cachedData?this.cachedData=Object(U.appendUint8Array)(this.cachedData,_):this.cachedData=_}}return{audioTrack:c,avcTrack:Object(x.dummyTrack)(),id3Track:O,textTrack:Object(x.dummyTrack)()}},S.demuxSampleAes=function(T,p,m){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},S.flush=function(T){var p=this.cachedData;return p&&(this.cachedData=null,this.demux(p,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(x.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(x.dummyTrack)()}},S.destroy=function(){},f}(),L=function(S,P){return Object(H.isFiniteNumber)(S)?S*90:P*9e4};K.default=E},"./src/demux/chunk-cache.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return H});var H=function(){function x(){this.chunks=[],this.dataLength=0}var U=x.prototype;return U.push=function(E){this.chunks.push(E),this.dataLength+=E.length},U.flush=function(){var E=this.chunks,L=this.dataLength,f;if(E.length)E.length===1?f=E[0]:f=N(E,L);else return new Uint8Array(0);return this.reset(),f},U.reset=function(){this.chunks.length=0,this.dataLength=0},x}();function N(x,U){for(var I=new Uint8Array(U),E=0,L=0;L<x.length;L++){var f=x[L];I.set(f,E),E+=f.length}return I}},"./src/demux/dummy-demuxed-track.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"dummyTrack",function(){return H});function H(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(J,K,R){"use strict";R.r(K);var H=R("./src/utils/logger.ts"),N=function(){function x(I){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=I,this.bytesAvailable=I.byteLength,this.word=0,this.bitsAvailable=0}var U=x.prototype;return U.loadWord=function(){var E=this.data,L=this.bytesAvailable,f=E.byteLength-L,S=new Uint8Array(4),P=Math.min(4,L);if(P===0)throw new Error("no bytes available");S.set(E.subarray(f,f+P)),this.word=new DataView(S.buffer).getUint32(0),this.bitsAvailable=P*8,this.bytesAvailable-=P},U.skipBits=function(E){var L;this.bitsAvailable>E?(this.word<<=E,this.bitsAvailable-=E):(E-=this.bitsAvailable,L=E>>3,E-=L>>3,this.bytesAvailable-=L,this.loadWord(),this.word<<=E,this.bitsAvailable-=E)},U.readBits=function(E){var L=Math.min(this.bitsAvailable,E),f=this.word>>>32-L;return E>32&&H.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=L,this.bitsAvailable>0?this.word<<=L:this.bytesAvailable>0&&this.loadWord(),L=E-L,L>0&&this.bitsAvailable?f<<L|this.readBits(L):f},U.skipLZ=function(){var E;for(E=0;E<this.bitsAvailable;++E)if((this.word&2147483648>>>E)!==0)return this.word<<=E,this.bitsAvailable-=E,E;return this.loadWord(),E+this.skipLZ()},U.skipUEG=function(){this.skipBits(1+this.skipLZ())},U.skipEG=function(){this.skipBits(1+this.skipLZ())},U.readUEG=function(){var E=this.skipLZ();return this.readBits(E+1)-1},U.readEG=function(){var E=this.readUEG();return 1&E?1+E>>>1:-1*(E>>>1)},U.readBoolean=function(){return this.readBits(1)===1},U.readUByte=function(){return this.readBits(8)},U.readUShort=function(){return this.readBits(16)},U.readUInt=function(){return this.readBits(32)},U.skipScalingList=function(E){for(var L=8,f=8,S,P=0;P<E;P++)f!==0&&(S=this.readEG(),f=(L+S+256)%256),L=f===0?L:f},U.readSPS=function(){var E=0,L=0,f=0,S=0,P,T,p,m=this.readUByte.bind(this),i=this.readBits.bind(this),a=this.readUEG.bind(this),u=this.readBoolean.bind(this),c=this.skipBits.bind(this),O=this.skipEG.bind(this),b=this.skipUEG.bind(this),y=this.skipScalingList.bind(this);m();var D=m();if(i(5),c(3),m(),b(),D===100||D===110||D===122||D===244||D===44||D===83||D===86||D===118||D===128){var _=a();if(_===3&&c(1),b(),b(),c(1),u())for(T=_!==3?8:12,p=0;p<T;p++)u()&&(p<6?y(16):y(64))}b();var h=a();if(h===0)a();else if(h===1)for(c(1),O(),O(),P=a(),p=0;p<P;p++)O();b(),c(1);var d=a(),o=a(),s=i(1);s===0&&c(1),c(1),u()&&(E=a(),L=a(),f=a(),S=a());var w=[1,1];if(u()&&u()){var C=m();switch(C){case 1:w=[1,1];break;case 2:w=[12,11];break;case 3:w=[10,11];break;case 4:w=[16,11];break;case 5:w=[40,33];break;case 6:w=[24,11];break;case 7:w=[20,11];break;case 8:w=[32,11];break;case 9:w=[80,33];break;case 10:w=[18,11];break;case 11:w=[15,11];break;case 12:w=[64,33];break;case 13:w=[160,99];break;case 14:w=[4,3];break;case 15:w=[3,2];break;case 16:w=[2,1];break;case 255:{w=[m()<<8|m(),m()<<8|m()];break}}}return{width:Math.ceil((d+1)*16-E*2-L*2),height:(2-s)*(o+1)*16-(s?2:4)*(f+S),pixelRatio:w}},U.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},x}();K.default=N},"./src/demux/id3.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"isHeader",function(){return H}),R.d(K,"isFooter",function(){return N}),R.d(K,"getID3Data",function(){return x}),R.d(K,"canParse",function(){return I}),R.d(K,"getTimeStamp",function(){return E}),R.d(K,"isTimeStampFrame",function(){return L}),R.d(K,"getID3Frames",function(){return S}),R.d(K,"decodeFrame",function(){return P}),R.d(K,"utf8ArrayToStr",function(){return a}),R.d(K,"testables",function(){return u});var H=function(y,D){return D+10<=y.length&&(y[D]===73&&y[D+1]===68&&y[D+2]===51&&(y[D+3]<255&&y[D+4]<255&&(y[D+6]<128&&y[D+7]<128&&y[D+8]<128&&y[D+9]<128)))},N=function(y,D){return D+10<=y.length&&(y[D]===51&&y[D+1]===68&&y[D+2]===73&&(y[D+3]<255&&y[D+4]<255&&(y[D+6]<128&&y[D+7]<128&&y[D+8]<128&&y[D+9]<128)))},x=function(y,D){for(var _=D,h=0;H(y,D);){h+=10;var d=U(y,D+6);h+=d,N(y,D+10)&&(h+=10),D+=h}return h>0?y.subarray(_,_+h):void 0},U=function(y,D){var _=0;return _=(y[D]&127)<<21,_|=(y[D+1]&127)<<14,_|=(y[D+2]&127)<<7,_|=y[D+3]&127,_},I=function(y,D){return H(y,D)&&U(y,D+6)+10<=y.length-D},E=function(y){for(var D=S(y),_=0;_<D.length;_++){var h=D[_];if(L(h))return i(h)}return},L=function(y){return y&&y.key==="PRIV"&&y.info==="com.apple.streaming.transportStreamTimestamp"},f=function(y){var D=String.fromCharCode(y[0],y[1],y[2],y[3]),_=U(y,4),h=10;return{type:D,size:_,data:y.subarray(h,h+_)}},S=function(y){for(var D=0,_=[];H(y,D);){var h=U(y,D+6);D+=10;for(var d=D+h;D+8<d;){var o=f(y.subarray(D)),s=P(o);s&&_.push(s),D+=o.size+10}N(y,D)&&(D+=10)}return _},P=function(y){return y.type==="PRIV"?T(y):y.type[0]==="W"?m(y):p(y)},T=function(y){if(y.size<2)return;var D=a(y.data,!0),_=new Uint8Array(y.data.subarray(D.length+1));return{key:y.type,info:D,data:_.buffer}},p=function(y){if(y.size<2)return;if(y.type==="TXXX"){var D=1,_=a(y.data.subarray(D),!0);D+=_.length+1;var h=a(y.data.subarray(D));return{key:y.type,info:_,data:h}}var d=a(y.data.subarray(1));return{key:y.type,data:d}},m=function(y){if(y.type==="WXXX"){if(y.size<2)return;var D=1,_=a(y.data.subarray(D),!0);D+=_.length+1;var h=a(y.data.subarray(D));return{key:y.type,info:_,data:h}}var d=a(y.data);return{key:y.type,data:d}},i=function(y){if(y.data.byteLength===8){var D=new Uint8Array(y.data),_=D[3]&1,h=(D[4]<<23)+(D[5]<<15)+(D[6]<<7)+D[7];return h/=45,_&&(h+=4772185884e-2),Math.round(h)}return},a=function(y,D){D===void 0&&(D=!1);var _=O();if(_){var h=_.decode(y);if(D){var d=h.indexOf("\0");return d!==-1?h.substring(0,d):h}return h.replace(/\0/g,"")}for(var o=y.length,s,w,C,v="",M=0;M<o;){if(s=y[M++],s===0&&D)return v;if(s===0||s===3)continue;switch(s>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:v+=String.fromCharCode(s);break;case 12:case 13:w=y[M++],v+=String.fromCharCode((s&31)<<6|w&63);break;case 14:w=y[M++],C=y[M++],v+=String.fromCharCode((s&15)<<12|(w&63)<<6|(C&63)<<0);break;default:}}return v},u={decodeTextFrame:p},c;function O(){return!c&&typeof self.TextDecoder!="undefined"&&(c=new self.TextDecoder("utf-8")),c}},"./src/demux/mp3demuxer.ts":function(J,K,R){"use strict";R.r(K);var H=R("./src/demux/base-audio-demuxer.ts"),N=R("./src/demux/id3.ts"),x=R("./src/utils/logger.ts"),U=R("./src/demux/mpegaudio.ts");function I(f,S){f.prototype=Object.create(S.prototype),f.prototype.constructor=f,E(f,S)}function E(f,S){return E=Object.setPrototypeOf||function(T,p){return T.__proto__=p,T},E(f,S)}var L=function(f){I(S,f);function S(){return f.apply(this,arguments)||this}var P=S.prototype;return P.resetInitSegment=function(p,m,i){f.prototype.resetInitSegment.call(this,p,m,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:p,duration:i,inputTimeScale:9e4,dropped:0}},S.probe=function(p){if(!p)return!1;for(var m=N.getID3Data(p,0)||[],i=m.length,a=p.length;i<a;i++)if(U.probe(p,i))return x.logger.log("MPEG Audio sync word found !"),!0;return!1},P.canParse=function(p,m){return U.canParse(p,m)},P.appendFrame=function(p,m,i){return this.initPTS===null?void 0:U.appendFrame(p,m,i,this.initPTS,this.frameIndex)},S}(H.default);L.minProbeByteLength=4,K.default=L},"./src/demux/mp4demuxer.ts":function(J,K,R){"use strict";R.r(K);var H=R("./src/utils/mp4-tools.ts"),N=R("./src/demux/dummy-demuxed-track.ts"),x=function(){function U(E,L){this.remainderData=null,this.config=void 0,this.config=L}var I=U.prototype;return I.resetTimeStamp=function(){},I.resetInitSegment=function(){},I.resetContiguity=function(){},U.probe=function(L){return Object(H.findBox)({data:L,start:0,end:Math.min(L.length,16384)},["moof"]).length>0},I.demux=function(L){var f=L,S=Object(N.dummyTrack)();if(this.config.progressive){this.remainderData&&(f=Object(H.appendUint8Array)(this.remainderData,L));var P=Object(H.segmentValidRange)(f);this.remainderData=P.remainder,S.samples=P.valid||new Uint8Array}else S.samples=f;return{audioTrack:Object(N.dummyTrack)(),avcTrack:S,id3Track:Object(N.dummyTrack)(),textTrack:Object(N.dummyTrack)()}},I.flush=function(){var L=Object(N.dummyTrack)();return L.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(N.dummyTrack)(),avcTrack:L,id3Track:Object(N.dummyTrack)(),textTrack:Object(N.dummyTrack)()}},I.demuxSampleAes=function(L,f,S){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},I.destroy=function(){},U}();x.minProbeByteLength=1024,K.default=x},"./src/demux/mpegaudio.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"appendFrame",function(){return E}),R.d(K,"parseHeader",function(){return L}),R.d(K,"isHeaderPattern",function(){return f}),R.d(K,"isHeader",function(){return S}),R.d(K,"canParse",function(){return P}),R.d(K,"probe",function(){return T});var H=null,N=[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],x=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],U=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],I=[0,1,1,4];function E(p,m,i,a,u){if(i+24>m.length)return;var c=L(m,i);if(c&&i+c.frameLength<=m.length){var O=c.samplesPerFrame*9e4/c.sampleRate,b=a+u*O,y={unit:m.subarray(i,i+c.frameLength),pts:b,dts:b};return p.config=[],p.channelCount=c.channelCount,p.samplerate=c.sampleRate,p.samples.push(y),{sample:y,length:c.frameLength,missing:0}}}function L(p,m){var i=p[m+1]>>3&3,a=p[m+1]>>1&3,u=p[m+2]>>4&15,c=p[m+2]>>2&3;if(i!==1&&u!==0&&u!==15&&c!==3){var O=p[m+2]>>1&1,b=p[m+3]>>6,y=i===3?3-a:a===3?3:4,D=N[y*14+u-1]*1e3,_=i===3?0:i===2?1:2,h=x[_*3+c],d=b===3?1:2,o=U[i][a],s=I[a],w=o*8*s,C=Math.floor(o*D/h+O)*s;if(H===null){var v=navigator.userAgent||"",M=v.match(/Chrome\/(\d+)/i);H=M?parseInt(M[1]):0}var B=!!H&&H<=87;return B&&a===2&&D>=224e3&&b===0&&(p[m+3]=p[m+3]|128),{sampleRate:h,channelCount:d,frameLength:C,samplesPerFrame:w}}}function f(p,m){return p[m]===255&&(p[m+1]&224)===224&&(p[m+1]&6)!==0}function S(p,m){return m+1<p.length&&f(p,m)}function P(p,m){var i=4;return f(p,m)&&i<=p.length-m}function T(p,m){if(m+1<p.length&&f(p,m)){var i=4,a=L(p,m),u=i;a!=null&&a.frameLength&&(u=a.frameLength);var c=m+u;return c===p.length||S(p,c)}return!1}},"./src/demux/sample-aes.ts":function(J,K,R){"use strict";R.r(K);var H=R("./src/crypt/decrypter.ts"),N=R("./src/demux/tsdemuxer.ts"),x=function(){function U(E,L,f){this.keyData=void 0,this.decrypter=void 0,this.keyData=f,this.decrypter=new H.default(E,L,{removePKCS7Padding:!1})}var I=U.prototype;return I.decryptBuffer=function(L,f){this.decrypter.decrypt(L,this.keyData.key.buffer,this.keyData.iv.buffer,f)},I.decryptAacSample=function(L,f,S,P){var T=L[f].unit,p=T.subarray(16,T.length-T.length%16),m=p.buffer.slice(p.byteOffset,p.byteOffset+p.length),i=this;this.decryptBuffer(m,function(a){var u=new Uint8Array(a);T.set(u,16),P||i.decryptAacSamples(L,f+1,S)})},I.decryptAacSamples=function(L,f,S){for(;;f++){if(f>=L.length){S();return}if(L[f].unit.length<32)continue;var P=this.decrypter.isSync();if(this.decryptAacSample(L,f,S,P),!P)return}},I.getAvcEncryptedData=function(L){for(var f=Math.floor((L.length-48)/160)*16+16,S=new Int8Array(f),P=0,T=32;T<=L.length-16;T+=160,P+=16)S.set(L.subarray(T,T+16),P);return S},I.getAvcDecryptedUnit=function(L,f){for(var S=new Uint8Array(f),P=0,T=32;T<=L.length-16;T+=160,P+=16)L.set(S.subarray(P,P+16),T);return L},I.decryptAvcSample=function(L,f,S,P,T,p){var m=Object(N.discardEPB)(T.data),i=this.getAvcEncryptedData(m),a=this;this.decryptBuffer(i.buffer,function(u){T.data=a.getAvcDecryptedUnit(m,u),p||a.decryptAvcSamples(L,f,S+1,P)})},I.decryptAvcSamples=function(L,f,S,P){if(L instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;f++,S=0){if(f>=L.length){P();return}for(var T=L[f].units;!(S>=T.length);S++){var p=T[S];if(p.data.length<=48||p.type!==1&&p.type!==5)continue;var m=this.decrypter.isSync();if(this.decryptAvcSample(L,f,S,P,p,m),!m)return}}},U}();K.default=x},"./src/demux/transmuxer-interface.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return T});var H=R("./node_modules/webworkify-webpack/index.js"),N=R.n(H),x=R("./src/events.ts"),U=R("./src/demux/transmuxer.ts"),I=R("./src/utils/logger.ts"),E=R("./src/errors.ts"),L=R("./src/utils/mediasource-helper.ts"),f=R("./node_modules/eventemitter3/index.js"),S=R.n(f),P=Object(L.getMediaSource)()||{isTypeSupported:function(){return!1}},T=function(){function p(i,a,u,c){var O=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=a,this.onTransmuxComplete=u,this.onFlush=c;var b=i.config,y=function(o,s){s=s||{},s.frag=O.frag,s.id=O.id,i.trigger(o,s)};this.observer=new f.EventEmitter,this.observer.on(x.Events.FRAG_DECRYPTED,y),this.observer.on(x.Events.ERROR,y);var D={mp4:P.isTypeSupported("video/mp4"),mpeg:P.isTypeSupported("audio/mpeg"),mp3:P.isTypeSupported('audio/mp4; codecs="mp3"')},_=navigator.vendor;if(b.enableWorker&&typeof Worker!="undefined"){I.logger.log("demuxing in webworker");var h;try{h=this.worker=H("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),h.addEventListener("message",this.onwmsg),h.onerror=function(d){i.trigger(x.Events.ERROR,{type:E.ErrorTypes.OTHER_ERROR,details:E.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(d.message+" ("+d.filename+":"+d.lineno+")")})},h.postMessage({cmd:"init",typeSupported:D,vendor:_,id:a,config:JSON.stringify(b)})}catch(d){I.logger.warn("Error in worker:",d),I.logger.error("Error while initializing DemuxerWorker, fallback to inline"),h&&self.URL.revokeObjectURL(h.objectURL),this.transmuxer=new U.default(this.observer,D,b,_,a),this.worker=null}}else this.transmuxer=new U.default(this.observer,D,b,_,a)}var m=p.prototype;return m.destroy=function(){var a=this.worker;if(a)a.removeEventListener("message",this.onwmsg),a.terminate(),this.worker=null;else{var u=this.transmuxer;u&&(u.destroy(),this.transmuxer=null)}var c=this.observer;c&&c.removeAllListeners(),this.observer=null},m.push=function(a,u,c,O,b,y,D,_,h,d){var o=this;h.transmuxing.start=self.performance.now();var s=this.transmuxer,w=this.worker,C=y?y.start:b.start,v=b.decryptdata,M=this.frag,B=!(M&&b.cc===M.cc),F=!(M&&h.level===M.level),Q=M?h.sn-M.sn:-1,G=this.part?h.part-this.part.index:1,W=!F&&(Q===1||Q===0&&G===1),$=self.performance.now();(F||Q||b.stats.parsing.start===0)&&(b.stats.parsing.start=$),y&&(G||!W)&&(y.stats.parsing.start=$);var re=new U.TransmuxState(B,W,_,F,C);if(!W||B){I.logger.log("[transmuxer-interface, "+b.type+"]: Starting new transmux session for sn: "+h.sn+" p: "+h.part+" level: "+h.level+" id: "+h.id+`
|
|
discontinuity: `+B+`
|
|
trackSwitch: `+F+`
|
|
contiguous: `+W+`
|
|
accurateTimeOffset: `+_+`
|
|
timeOffset: `+C);var ae=new U.TransmuxConfig(c,O,u,D,d);this.configureTransmuxer(ae)}if(this.frag=b,this.part=y,w)w.postMessage({cmd:"demux",data:a,decryptdata:v,chunkMeta:h,state:re},a instanceof ArrayBuffer?[a]:[]);else if(s){var he=s.push(a,v,h,re);Object(U.isPromise)(he)?he.then(function(Te){o.handleTransmuxComplete(Te)}):this.handleTransmuxComplete(he)}},m.flush=function(a){var u=this;a.transmuxing.start=self.performance.now();var c=this.transmuxer,O=this.worker;if(O)O.postMessage({cmd:"flush",chunkMeta:a});else if(c){var b=c.flush(a);Object(U.isPromise)(b)?b.then(function(y){u.handleFlushResult(y,a)}):this.handleFlushResult(b,a)}},m.handleFlushResult=function(a,u){var c=this;a.forEach(function(O){c.handleTransmuxComplete(O)}),this.onFlush(u)},m.onWorkerMessage=function(a){var u=a.data,c=this.hls;switch(u.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(u.data);break}case"flush":{this.onFlush(u.data);break}default:{u.data=u.data||{},u.data.frag=this.frag,u.data.id=this.id,c.trigger(u.event,u.data);break}}},m.configureTransmuxer=function(a){var u=this.worker,c=this.transmuxer;u?u.postMessage({cmd:"configure",config:a}):c&&c.configure(a)},m.handleTransmuxComplete=function(a){a.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(a)},p}()},"./src/demux/transmuxer-worker.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return E});var H=R("./src/demux/transmuxer.ts"),N=R("./src/events.ts"),x=R("./src/utils/logger.ts"),U=R("./node_modules/eventemitter3/index.js"),I=R.n(U);function E(T){var p=new U.EventEmitter,m=function(a,u){T.postMessage({event:a,data:u})};p.on(N.Events.FRAG_DECRYPTED,m),p.on(N.Events.ERROR,m),T.addEventListener("message",function(i){var a=i.data;switch(a.cmd){case"init":{var u=JSON.parse(a.config);T.transmuxer=new H.default(p,a.typeSupported,u,a.vendor,a.id),Object(x.enableLogs)(u.debug),m("init",null);break}case"configure":{T.transmuxer.configure(a.config);break}case"demux":{var c=T.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(H.isPromise)(c)?c.then(function(y){L(T,y)}):L(T,c);break}case"flush":{var O=a.chunkMeta,b=T.transmuxer.flush(O);Object(H.isPromise)(b)?b.then(function(y){S(T,y,O)}):S(T,b,O);break}default:break}})}function L(T,p){if(P(p.remuxResult))return;var m=[],i=p.remuxResult,a=i.audio,u=i.video;a&&f(m,a),u&&f(m,u),T.postMessage({event:"transmuxComplete",data:p},m)}function f(T,p){p.data1&&T.push(p.data1.buffer),p.data2&&T.push(p.data2.buffer)}function S(T,p,m){p.forEach(function(i){L(T,i)}),T.postMessage({event:"flush",data:m})}function P(T){return!T.audio&&!T.video&&!T.text&&!T.id3&&!T.initSegment}},"./src/demux/transmuxer.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return u}),R.d(K,"isPromise",function(){return b}),R.d(K,"TransmuxConfig",function(){return y}),R.d(K,"TransmuxState",function(){return D});var H=R("./src/events.ts"),N=R("./src/errors.ts"),x=R("./src/crypt/decrypter.ts"),U=R("./src/demux/aacdemuxer.ts"),I=R("./src/demux/mp4demuxer.ts"),E=R("./src/demux/tsdemuxer.ts"),L=R("./src/demux/mp3demuxer.ts"),f=R("./src/remux/mp4-remuxer.ts"),S=R("./src/remux/passthrough-remuxer.ts"),P=R("./src/demux/chunk-cache.ts"),T=R("./src/utils/mp4-tools.ts"),p=R("./src/utils/logger.ts"),m;try{m=self.performance.now.bind(self.performance)}catch(_){p.logger.debug("Unable to use Performance API on this environment"),m=self.Date.now}var i=[{demux:E.default,remux:f.default},{demux:I.default,remux:S.default},{demux:U.default,remux:f.default},{demux:L.default,remux:f.default}],a=1024;i.forEach(function(_){var h=_.demux;a=Math.max(a,h.minProbeByteLength)});var u=function(){function _(d,o,s,w,C){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=d,this.typeSupported=o,this.config=s,this.vendor=w,this.id=C}var h=_.prototype;return h.configure=function(o){this.transmuxConfig=o,this.decrypter&&this.decrypter.reset()},h.push=function(o,s,w,C){var v=this,M=w.transmuxing;M.executeStart=m();var B=new Uint8Array(o),F=this.cache,Q=this.config,G=this.currentTransmuxState,W=this.transmuxConfig;C&&(this.currentTransmuxState=C);var $=c(B,s);if($&&$.method==="AES-128"){var re=this.getDecrypter();if(Q.enableSoftwareAES){var ae=re.softwareDecrypt(B,$.key.buffer,$.iv.buffer);if(!ae)return M.executeEnd=m(),O(w);B=new Uint8Array(ae)}else return this.decryptionPromise=re.webCryptoDecrypt(B,$.key.buffer,$.iv.buffer).then(function($e){var ct=v.push($e,null,w);return v.decryptionPromise=null,ct}),this.decryptionPromise}var he=C||G,Te=he.contiguous,ye=he.discontinuity,Ee=he.trackSwitch,Oe=he.accurateTimeOffset,_e=he.timeOffset,fe=W.audioCodec,le=W.videoCodec,Me=W.defaultInitPts,ot=W.duration,ut=W.initSegmentData;if((ye||Ee)&&this.resetInitSegment(ut,fe,le,ot),ye&&this.resetInitialTimestamp(Me),Te||this.resetContiguity(),this.needsProbing(B,ye,Ee)){if(F.dataLength){var rt=F.flush();B=Object(T.appendUint8Array)(rt,B)}this.configureTransmuxer(B,W)}var tt=this.transmux(B,$,_e,Oe,w),ze=this.currentTransmuxState;return ze.contiguous=!0,ze.discontinuity=!1,ze.trackSwitch=!1,M.executeEnd=m(),tt},h.flush=function(o){var s=this,w=o.transmuxing;w.executeStart=m();var C=this.decrypter,v=this.cache,M=this.currentTransmuxState,B=this.decryptionPromise;if(B)return B.then(function(){return s.flush(o)});var F=[],Q=M.timeOffset;if(C){var G=C.flush();G&&F.push(this.push(G,null,o))}var W=v.dataLength;v.reset();var $=this.demuxer,re=this.remuxer;if(!$||!re)return W>=a&&this.observer.emit(H.Events.ERROR,H.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),w.executeEnd=m(),[O(o)];var ae=$.flush(Q);return b(ae)?ae.then(function(he){return s.flushRemux(F,he,o),F}):(this.flushRemux(F,ae,o),F)},h.flushRemux=function(o,s,w){var C=s.audioTrack,v=s.avcTrack,M=s.id3Track,B=s.textTrack,F=this.currentTransmuxState,Q=F.accurateTimeOffset,G=F.timeOffset;p.logger.log("[transmuxer.ts]: Flushed fragment "+w.sn+(w.part>-1?" p: "+w.part:"")+" of level "+w.level);var W=this.remuxer.remux(C,v,M,B,G,Q,!0,this.id);o.push({remuxResult:W,chunkMeta:w}),w.transmuxing.executeEnd=m()},h.resetInitialTimestamp=function(o){var s=this.demuxer,w=this.remuxer;if(!s||!w)return;s.resetTimeStamp(o),w.resetTimeStamp(o)},h.resetContiguity=function(){var o=this.demuxer,s=this.remuxer;if(!o||!s)return;o.resetContiguity(),s.resetNextTimestamp()},h.resetInitSegment=function(o,s,w,C){var v=this.demuxer,M=this.remuxer;if(!v||!M)return;v.resetInitSegment(s,w,C),M.resetInitSegment(o,s,w)},h.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},h.transmux=function(o,s,w,C,v){var M;return s&&s.method==="SAMPLE-AES"?M=this.transmuxSampleAes(o,s,w,C,v):M=this.transmuxUnencrypted(o,w,C,v),M},h.transmuxUnencrypted=function(o,s,w,C){var v=this.demuxer.demux(o,s,!1,!this.config.progressive),M=v.audioTrack,B=v.avcTrack,F=v.id3Track,Q=v.textTrack,G=this.remuxer.remux(M,B,F,Q,s,w,!1,this.id);return{remuxResult:G,chunkMeta:C}},h.transmuxSampleAes=function(o,s,w,C,v){var M=this;return this.demuxer.demuxSampleAes(o,s,w).then(function(B){var F=M.remuxer.remux(B.audioTrack,B.avcTrack,B.id3Track,B.textTrack,w,C,!1,M.id);return{remuxResult:F,chunkMeta:v}})},h.configureTransmuxer=function(o,s){for(var w=this.config,C=this.observer,v=this.typeSupported,M=this.vendor,B=s.audioCodec,F=s.defaultInitPts,Q=s.duration,G=s.initSegmentData,W=s.videoCodec,$,re=0,ae=i.length;re<ae;re++)if(i[re].demux.probe(o)){$=i[re];break}$||(p.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),$={demux:I.default,remux:S.default});var he=this.demuxer,Te=this.remuxer,ye=$.remux,Ee=$.demux;(!Te||!(Te instanceof ye))&&(this.remuxer=new ye(C,w,v,M)),(!he||!(he instanceof Ee))&&(this.demuxer=new Ee(C,w,v),this.probe=Ee.probe),this.resetInitSegment(G,B,W,Q),this.resetInitialTimestamp(F)},h.needsProbing=function(o,s,w){return!this.demuxer||!this.remuxer||s||w},h.getDecrypter=function(){var o=this.decrypter;return o||(o=this.decrypter=new x.default(this.observer,this.config)),o},_}();function c(_,h){var d=null;return _.byteLength>0&&h!=null&&h.key!=null&&h.iv!==null&&h.method!=null&&(d=h),d}var O=function(h){return{remuxResult:{},chunkMeta:h}};function b(_){return"then"in _&&_.then instanceof Function}var y=function(h,d,o,s,w){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=h,this.videoCodec=d,this.initSegmentData=o,this.duration=s,this.defaultInitPts=w},D=function(h,d,o,s,w){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=h,this.contiguous=d,this.accurateTimeOffset=o,this.trackSwitch=s,this.timeOffset=w}},"./src/demux/tsdemuxer.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"discardEPB",function(){return O});var H=R("./src/demux/adts.ts"),N=R("./src/demux/mpegaudio.ts"),x=R("./src/demux/exp-golomb.ts"),U=R("./src/demux/id3.ts"),I=R("./src/demux/sample-aes.ts"),E=R("./src/events.ts"),L=R("./src/utils/mp4-tools.ts"),f=R("./src/utils/logger.ts"),S=R("./src/errors.ts"),P={video:1,audio:2,id3:3,text:4},T=function(){function b(D,_,h){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=D,this.config=_,this.typeSupported=h}b.probe=function(_){var h=b.syncOffset(_);return h<0?!1:(h&&f.logger.warn("MPEG2-TS detected but first sync word found @ offset "+h+", junk ahead ?"),!0)},b.syncOffset=function(_){for(var h=Math.min(1e3,_.length-3*188),d=0;d<h;){if(_[d]===71&&_[d+188]===71&&_[d+2*188]===71)return d;d++}return-1},b.createTrack=function(_,h){return{container:_==="video"||_==="audio"?"video/mp2t":void 0,type:_,id:P[_],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:_==="audio"?h:void 0}};var y=b.prototype;return y.resetInitSegment=function(_,h,d){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=b.createTrack("video",d),this._audioTrack=b.createTrack("audio",d),this._id3Track=b.createTrack("id3",d),this._txtTrack=b.createTrack("text",d),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=_,this.videoCodec=h,this._duration=d},y.resetTimeStamp=function(){},y.resetContiguity=function(){var _=this._audioTrack,h=this._avcTrack,d=this._id3Track;_&&(_.pesData=null),h&&(h.pesData=null),d&&(d.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},y.demux=function(_,h,d,o){d===void 0&&(d=!1),o===void 0&&(o=!1),d||(this.sampleAes=null);var s,w=this._avcTrack,C=this._audioTrack,v=this._id3Track,M=w.pid,B=w.pesData,F=C.pid,Q=v.pid,G=C.pesData,W=v.pesData,$=!1,re=this.pmtParsed,ae=this._pmtId,he=_.length;if(this.remainderData&&(_=Object(L.appendUint8Array)(this.remainderData,_),he=_.length,this.remainderData=null),he<188&&!o)return this.remainderData=_,{audioTrack:C,avcTrack:w,id3Track:v,textTrack:this._txtTrack};var Te=Math.max(0,b.syncOffset(_));he-=(he+Te)%188,he<_.byteLength&&!o&&(this.remainderData=new Uint8Array(_.buffer,he,_.buffer.byteLength-he));for(var ye=Te;ye<he;ye+=188)if(_[ye]===71){var Ee=!!(_[ye+1]&64),Oe=((_[ye+1]&31)<<8)+_[ye+2],_e=(_[ye+3]&48)>>4,fe=void 0;if(_e>1){if(fe=ye+5+_[ye+4],fe===ye+188)continue}else fe=ye+4;switch(Oe){case M:Ee&&(B&&(s=a(B))&&this.parseAVCPES(s,!1),B={data:[],size:0}),B&&(B.data.push(_.subarray(fe,ye+188)),B.size+=ye+188-fe);break;case F:Ee&&(G&&(s=a(G))&&(C.isAAC?this.parseAACPES(s):this.parseMPEGPES(s)),G={data:[],size:0}),G&&(G.data.push(_.subarray(fe,ye+188)),G.size+=ye+188-fe);break;case Q:Ee&&(W&&(s=a(W))&&this.parseID3PES(s),W={data:[],size:0}),W&&(W.data.push(_.subarray(fe,ye+188)),W.size+=ye+188-fe);break;case 0:Ee&&(fe+=_[fe]+1),ae=this._pmtId=m(_,fe);break;case ae:{Ee&&(fe+=_[fe]+1);var le=i(_,fe,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,d);M=le.avc,M>0&&(w.pid=M),F=le.audio,F>0&&(C.pid=F,C.isAAC=le.isAAC),Q=le.id3,Q>0&&(v.pid=Q),$&&!re&&(f.logger.log("reparse from beginning"),$=!1,ye=Te-188),re=this.pmtParsed=!0;break}case 17:case 8191:break;default:$=!0;break}}else this.observer.emit(E.Events.ERROR,E.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});w.pesData=B,C.pesData=G,v.pesData=W;var Me={audioTrack:C,avcTrack:w,id3Track:v,textTrack:this._txtTrack};return o&&this.extractRemainingSamples(Me),Me},y.flush=function(){var _=this.remainderData;this.remainderData=null;var h;return _?h=this.demux(_,-1,!1,!0):h={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(h),this.sampleAes?this.decrypt(h,this.sampleAes):h},y.extractRemainingSamples=function(_){var h=_.audioTrack,d=_.avcTrack,o=_.id3Track,s=d.pesData,w=h.pesData,C=o.pesData,v;s&&(v=a(s))?(this.parseAVCPES(v,!0),d.pesData=null):d.pesData=s,w&&(v=a(w))?(h.isAAC?this.parseAACPES(v):this.parseMPEGPES(v),h.pesData=null):(w!=null&&w.size&&f.logger.log("last AAC PES packet truncated,might overlap between fragments"),h.pesData=w),C&&(v=a(C))?(this.parseID3PES(v),o.pesData=null):o.pesData=C},y.demuxSampleAes=function(_,h,d){var o=this.demux(_,d,!0,!this.config.progressive),s=this.sampleAes=new I.default(this.observer,this.config,h);return this.decrypt(o,s)},y.decrypt=function(_,h){return new Promise(function(d){var o=_.audioTrack,s=_.avcTrack;o.samples&&o.isAAC?h.decryptAacSamples(o.samples,0,function(){s.samples?h.decryptAvcSamples(s.samples,0,0,function(){d(_)}):d(_)}):s.samples&&h.decryptAvcSamples(s.samples,0,0,function(){d(_)})})},y.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},y.parseAVCPES=function(_,h){var d=this,o=this._avcTrack,s=this.parseAVCNALu(_.data),w=!1,C=this.avcSample,v,M=!1;_.data=null,C&&s.length&&!o.audFound&&(u(C,o),C=this.avcSample=p(!1,_.pts,_.dts,"")),s.forEach(function(B){switch(B.type){case 1:{v=!0,C||(C=d.avcSample=p(!0,_.pts,_.dts,"")),w&&(C.debug+="NDR "),C.frame=!0;var F=B.data;if(M&&F.length>4){var Q=new x.default(F).readSliceType();(Q===2||Q===4||Q===7||Q===9)&&(C.key=!0)}break}case 5:v=!0,C||(C=d.avcSample=p(!0,_.pts,_.dts,"")),w&&(C.debug+="IDR "),C.key=!0,C.frame=!0;break;case 6:{v=!0,w&&C&&(C.debug+="SEI ");var G=new x.default(O(B.data));G.readUByte();for(var W=0,$=0,re=!1,ae=0;!re&&G.bytesAvailable>1;){W=0;do ae=G.readUByte(),W+=ae;while(ae===255);$=0;do ae=G.readUByte(),$+=ae;while(ae===255);if(W===4&&G.bytesAvailable!==0){re=!0;var he=G.readUByte();if(he===181){var Te=G.readUShort();if(Te===49){var ye=G.readUInt();if(ye===1195456820){var Ee=G.readUByte();if(Ee===3){for(var Oe=G.readUByte(),_e=G.readUByte(),fe=31&Oe,le=[Oe,_e],Me=0;Me<fe;Me++)le.push(G.readUByte()),le.push(G.readUByte()),le.push(G.readUByte());c(d._txtTrack.samples,{type:3,pts:_.pts,bytes:le})}}}}}else if(W===5&&G.bytesAvailable!==0){if(re=!0,$>16){for(var ot=[],ut=0;ut<16;ut++)ot.push(G.readUByte().toString(16)),(ut===3||ut===5||ut===7||ut===9)&&ot.push("-");for(var rt=$-16,tt=new Uint8Array(rt),ze=0;ze<rt;ze++)tt[ze]=G.readUByte();c(d._txtTrack.samples,{pts:_.pts,payloadType:W,uuid:ot.join(""),userData:Object(U.utf8ArrayToStr)(tt),userDataBytes:tt})}}else if($<G.bytesAvailable)for(var $e=0;$e<$;$e++)G.readUByte()}break}case 7:if(v=!0,M=!0,w&&C&&(C.debug+="SPS "),!o.sps){var ct=new x.default(B.data),vt=ct.readSPS();o.width=vt.width,o.height=vt.height,o.pixelRatio=vt.pixelRatio,o.sps=[B.data],o.duration=d._duration;for(var at=B.data.subarray(1,4),et="avc1.",nt=0;nt<3;nt++){var Rt=at[nt].toString(16);Rt.length<2&&(Rt="0"+Rt),et+=Rt}o.codec=et}break;case 8:v=!0,w&&C&&(C.debug+="PPS "),o.pps||(o.pps=[B.data]);break;case 9:v=!1,o.audFound=!0,C&&u(C,o),C=d.avcSample=p(!1,_.pts,_.dts,w?"AUD ":"");break;case 12:v=!1;break;default:v=!1,C&&(C.debug+="unknown NAL "+B.type+" ");break}if(C&&v){var Ct=C.units;Ct.push(B)}}),h&&C&&(u(C,o),this.avcSample=null)},y.getLastNalUnit=function(){var _,h=this.avcSample,d;if(!h||h.units.length===0){var o=this._avcTrack.samples;h=o[o.length-1]}if((_=h)!==null&&_!==void 0&&_.units){var s=h.units;d=s[s.length-1]}return d},y.parseAVCNALu=function(_){var h=_.byteLength,d=this._avcTrack,o=d.naluState||0,s=o,w=[],C=0,v,M,B,F=-1,Q=0;for(o===-1&&(F=0,Q=_[0]&31,o=0,C=1);C<h;){if(v=_[C++],!o){o=v?0:1;continue}if(o===1){o=v?0:2;continue}if(!v)o=3;else if(v===1){if(F>=0){var G={data:_.subarray(F,C-o-1),type:Q};w.push(G)}else{var W=this.getLastNalUnit();if(W&&(s&&C<=4-s&&(W.state&&(W.data=W.data.subarray(0,W.data.byteLength-s))),M=C-o-1,M>0)){var $=new Uint8Array(W.data.byteLength+M);$.set(W.data,0),$.set(_.subarray(0,M),W.data.byteLength),W.data=$,W.state=0}}C<h?(B=_[C]&31,F=C,Q=B,o=0):o=-1}else o=0}if(F>=0&&o>=0){var re={data:_.subarray(F,h),type:Q,state:o};w.push(re)}if(w.length===0){var ae=this.getLastNalUnit();if(ae){var he=new Uint8Array(ae.data.byteLength+_.byteLength);he.set(ae.data,0),he.set(_,ae.data.byteLength),ae.data=he}}return d.naluState=o,w},y.parseAACPES=function(_){var h=0,d=this._audioTrack,o=this.aacOverFlow,s=_.data;if(o){this.aacOverFlow=null;var w=o.sample.unit.byteLength,C=Math.min(o.missing,w),v=w-C;o.sample.unit.set(s.subarray(0,C),v),d.samples.push(o.sample),h=o.missing}var M,B;for(M=h,B=s.length;M<B-1&&!H.isHeader(s,M);M++);if(M!==h){var F,Q;if(M<B-1?(F="AAC PES did not start with ADTS header,offset:"+M,Q=!1):(F="no ADTS header found in AAC PES",Q=!0),f.logger.warn("parsing error:"+F),this.observer.emit(E.Events.ERROR,E.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.FRAG_PARSING_ERROR,fatal:Q,reason:F}),Q)return}H.initTrackConfig(d,this.observer,s,M,this.audioCodec);var G;if(_.pts!==void 0)G=_.pts;else if(o){var W=H.getFrameDuration(d.samplerate);G=o.sample.pts+W}else{f.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var $=0;M<B;)if(H.isHeader(s,M)){if(M+5<B){var re=H.appendFrame(d,s,M,G,$);if(re)if(re.missing)this.aacOverFlow=re;else{M+=re.length,$++;continue}}break}else M++},y.parseMPEGPES=function(_){var h=_.data,d=h.length,o=0,s=0,w=_.pts;if(w===void 0){f.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;s<d;)if(N.isHeader(h,s)){var C=N.appendFrame(this._audioTrack,h,s,w,o);if(C)s+=C.length,o++;else break}else s++},y.parseID3PES=function(_){if(_.pts===void 0){f.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(_)},b}();T.minProbeByteLength=188;function p(b,y,D,_){return{key:b,frame:!1,pts:y,dts:D,units:[],debug:_,length:0}}function m(b,y){return(b[y+10]&31)<<8|b[y+11]}function i(b,y,D,_){var h={audio:-1,avc:-1,id3:-1,isAAC:!0},d=(b[y+1]&15)<<8|b[y+2],o=y+3+d-4,s=(b[y+10]&15)<<8|b[y+11];for(y+=12+s;y<o;){var w=(b[y+1]&31)<<8|b[y+2];switch(b[y]){case 207:if(!_){f.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:h.audio===-1&&(h.audio=w);break;case 21:h.id3===-1&&(h.id3=w);break;case 219:if(!_){f.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:h.avc===-1&&(h.avc=w);break;case 3:case 4:D?h.audio===-1&&(h.audio=w,h.isAAC=!1):f.logger.log("MPEG audio found, not supported in this browser");break;case 36:f.logger.warn("Unsupported HEVC stream type found");break;default:break}y+=((b[y+3]&15)<<8|b[y+4])+5}return h}function a(b){var y=0,D,_,h,d,o,s=b.data;if(!b||b.size===0)return null;for(;s[0].length<19&&s.length>1;){var w=new Uint8Array(s[0].length+s[1].length);w.set(s[0]),w.set(s[1],s[0].length),s[0]=w,s.splice(1,1)}D=s[0];var C=(D[0]<<16)+(D[1]<<8)+D[2];if(C===1){if(_=(D[4]<<8)+D[5],_&&_>b.size-6)return null;var v=D[7];v&192&&(d=(D[9]&14)*536870912+(D[10]&255)*4194304+(D[11]&254)*16384+(D[12]&255)*128+(D[13]&254)/2,v&64?(o=(D[14]&14)*536870912+(D[15]&255)*4194304+(D[16]&254)*16384+(D[17]&255)*128+(D[18]&254)/2,d-o>60*9e4&&(f.logger.warn(Math.round((d-o)/9e4)+"s delta between PTS and DTS, align them"),d=o)):o=d),h=D[8];var M=h+9;if(b.size<=M)return null;b.size-=M;for(var B=new Uint8Array(b.size),F=0,Q=s.length;F<Q;F++){D=s[F];var G=D.byteLength;if(M)if(M>G){M-=G;continue}else D=D.subarray(M),G-=M,M=0;B.set(D,y),y+=G}return _&&(_-=h+3),{data:B,pts:d,dts:o,len:_}}return null}function u(b,y){if(b.units.length&&b.frame){if(b.pts===void 0){var D=y.samples,_=D.length;if(_){var h=D[_-1];b.pts=h.pts,b.dts=h.dts}else{y.dropped++;return}}y.samples.push(b)}b.debug.length&&f.logger.log(b.pts+"/"+b.dts+":"+b.debug)}function c(b,y){var D=b.length;if(D>0){if(y.pts>=b[D-1].pts)b.push(y);else for(var _=D-1;_>=0;_--)if(y.pts<b[_].pts){b.splice(_,0,y);break}}else b.push(y)}function O(b){for(var y=b.byteLength,D=[],_=1;_<y-2;)b[_]===0&&b[_+1]===0&&b[_+2]===3?(D.push(_+2),_+=2):_++;if(D.length===0)return b;var h=y-D.length,d=new Uint8Array(h),o=0;for(_=0;_<h;o++,_++)o===D[0]&&(o++,D.shift()),d[_]=b[o];return d}K.default=T},"./src/errors.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"ErrorTypes",function(){return H}),R.d(K,"ErrorDetails",function(){return N});var H;(function(x){x.NETWORK_ERROR="networkError",x.MEDIA_ERROR="mediaError",x.KEY_SYSTEM_ERROR="keySystemError",x.MUX_ERROR="muxError",x.OTHER_ERROR="otherError"})(H||(H={}));var N;(function(x){x.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",x.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",x.KEY_SYSTEM_NO_SESSION="keySystemNoSession",x.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",x.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",x.MANIFEST_LOAD_ERROR="manifestLoadError",x.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",x.MANIFEST_PARSING_ERROR="manifestParsingError",x.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",x.LEVEL_EMPTY_ERROR="levelEmptyError",x.LEVEL_LOAD_ERROR="levelLoadError",x.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",x.LEVEL_SWITCH_ERROR="levelSwitchError",x.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",x.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",x.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",x.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",x.FRAG_LOAD_ERROR="fragLoadError",x.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",x.FRAG_DECRYPT_ERROR="fragDecryptError",x.FRAG_PARSING_ERROR="fragParsingError",x.REMUX_ALLOC_ERROR="remuxAllocError",x.KEY_LOAD_ERROR="keyLoadError",x.KEY_LOAD_TIMEOUT="keyLoadTimeOut",x.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",x.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",x.BUFFER_APPEND_ERROR="bufferAppendError",x.BUFFER_APPENDING_ERROR="bufferAppendingError",x.BUFFER_STALLED_ERROR="bufferStalledError",x.BUFFER_FULL_ERROR="bufferFullError",x.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",x.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",x.INTERNAL_EXCEPTION="internalException",x.INTERNAL_ABORTED="aborted",x.UNKNOWN="unknown"})(N||(N={}))},"./src/events.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"Events",function(){return H});var H;(function(N){N.MEDIA_ATTACHING="hlsMediaAttaching",N.MEDIA_ATTACHED="hlsMediaAttached",N.MEDIA_DETACHING="hlsMediaDetaching",N.MEDIA_DETACHED="hlsMediaDetached",N.BUFFER_RESET="hlsBufferReset",N.BUFFER_CODECS="hlsBufferCodecs",N.BUFFER_CREATED="hlsBufferCreated",N.BUFFER_APPENDING="hlsBufferAppending",N.BUFFER_APPENDED="hlsBufferAppended",N.BUFFER_EOS="hlsBufferEos",N.BUFFER_FLUSHING="hlsBufferFlushing",N.BUFFER_FLUSHED="hlsBufferFlushed",N.MANIFEST_LOADING="hlsManifestLoading",N.MANIFEST_LOADED="hlsManifestLoaded",N.MANIFEST_PARSED="hlsManifestParsed",N.LEVEL_SWITCHING="hlsLevelSwitching",N.LEVEL_SWITCHED="hlsLevelSwitched",N.LEVEL_LOADING="hlsLevelLoading",N.LEVEL_LOADED="hlsLevelLoaded",N.LEVEL_UPDATED="hlsLevelUpdated",N.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",N.LEVELS_UPDATED="hlsLevelsUpdated",N.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",N.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",N.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",N.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",N.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",N.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",N.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",N.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",N.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",N.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",N.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",N.CUES_PARSED="hlsCuesParsed",N.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",N.INIT_PTS_FOUND="hlsInitPtsFound",N.FRAG_LOADING="hlsFragLoading",N.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",N.FRAG_LOADED="hlsFragLoaded",N.FRAG_DECRYPTED="hlsFragDecrypted",N.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",N.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",N.FRAG_PARSING_METADATA="hlsFragParsingMetadata",N.FRAG_PARSED="hlsFragParsed",N.FRAG_BUFFERED="hlsFragBuffered",N.FRAG_CHANGED="hlsFragChanged",N.FPS_DROP="hlsFpsDrop",N.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",N.ERROR="hlsError",N.DESTROYING="hlsDestroying",N.KEY_LOADING="hlsKeyLoading",N.KEY_LOADED="hlsKeyLoaded",N.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",N.BACK_BUFFER_REACHED="hlsBackBufferReached"})(H||(H={}))},"./src/hls.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return b});var H=R("./node_modules/url-toolkit/src/url-toolkit.js"),N=R.n(H),x=R("./src/loader/playlist-loader.ts"),U=R("./src/loader/key-loader.ts"),I=R("./src/controller/id3-track-controller.ts"),E=R("./src/controller/latency-controller.ts"),L=R("./src/controller/level-controller.ts"),f=R("./src/controller/fragment-tracker.ts"),S=R("./src/controller/stream-controller.ts"),P=R("./src/is-supported.ts"),T=R("./src/utils/logger.ts"),p=R("./src/config.ts"),m=R("./node_modules/eventemitter3/index.js"),i=R.n(m),a=R("./src/events.ts"),u=R("./src/errors.ts");function c(y,D){for(var _=0;_<D.length;_++){var h=D[_];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(y,h.key,h)}}function O(y,D,_){return D&&c(y.prototype,D),_&&c(y,_),y}var b=function(){y.isSupported=function(){return Object(P.isSupported)()};function y(_){_===void 0&&(_={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new m.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 h=this.config=Object(p.mergeConfig)(y.DefaultConfig,_);this.userConfig=_,Object(T.enableLogs)(h.debug),this._autoLevelCapping=-1,h.progressive&&Object(p.enableStreamingMode)(h);var d=h.abrController,o=h.bufferController,s=h.capLevelController,w=h.fpsController,C=this.abrController=new d(this),v=this.bufferController=new o(this),M=this.capLevelController=new s(this),B=new w(this),F=new x.default(this),Q=new U.default(this),G=new I.default(this),W=this.levelController=new L.default(this),$=new f.FragmentTracker(this),re=this.streamController=new S.default(this,$);M.setStreamController(re),B.setStreamController(re);var ae=[W,re];this.networkControllers=ae;var he=[F,Q,C,v,M,B,G,$];this.audioTrackController=this.createController(h.audioTrackController,null,ae),this.createController(h.audioStreamController,$,ae),this.subtitleTrackController=this.createController(h.subtitleTrackController,null,ae),this.createController(h.subtitleStreamController,$,ae),this.createController(h.timelineController,null,he),this.emeController=this.createController(h.emeController,null,he),this.cmcdController=this.createController(h.cmcdController,null,he),this.latencyController=this.createController(E.default,null,he),this.coreComponents=he}var D=y.prototype;return D.createController=function(h,d,o){if(h){var s=d?new h(this,d):new h(this);return o&&o.push(s),s}return null},D.on=function(h,d,o){o===void 0&&(o=this),this._emitter.on(h,d,o)},D.once=function(h,d,o){o===void 0&&(o=this),this._emitter.once(h,d,o)},D.removeAllListeners=function(h){this._emitter.removeAllListeners(h)},D.off=function(h,d,o,s){o===void 0&&(o=this),this._emitter.off(h,d,o,s)},D.listeners=function(h){return this._emitter.listeners(h)},D.emit=function(h,d,o){return this._emitter.emit(h,d,o)},D.trigger=function(h,d){if(this.config.debug)return this.emit(h,h,d);try{return this.emit(h,h,d)}catch(o){T.logger.error("An internal error happened while handling event "+h+'. Error message: "'+o.message+'". Here is a stacktrace:',o),this.trigger(a.Events.ERROR,{type:u.ErrorTypes.OTHER_ERROR,details:u.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:h,error:o})}return!1},D.listenerCount=function(h){return this._emitter.listenerCount(h)},D.destroy=function(){T.logger.log("destroy"),this.trigger(a.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(h){return h.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(h){return h.destroy()}),this.coreComponents.length=0},D.attachMedia=function(h){T.logger.log("attachMedia"),this._media=h,this.trigger(a.Events.MEDIA_ATTACHING,{media:h})},D.detachMedia=function(){T.logger.log("detachMedia"),this.trigger(a.Events.MEDIA_DETACHING,void 0),this._media=null},D.loadSource=function(h){this.stopLoad();var d=this.media,o=this.url,s=this.url=H.buildAbsoluteURL(self.location.href,h,{alwaysNormalize:!0});T.logger.log("loadSource:"+s),d&&o&&o!==s&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(d)),this.trigger(a.Events.MANIFEST_LOADING,{url:h})},D.startLoad=function(h){h===void 0&&(h=-1),T.logger.log("startLoad("+h+")"),this.networkControllers.forEach(function(d){d.startLoad(h)})},D.stopLoad=function(){T.logger.log("stopLoad"),this.networkControllers.forEach(function(h){h.stopLoad()})},D.swapAudioCodec=function(){T.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},D.recoverMediaError=function(){T.logger.log("recoverMediaError");var h=this._media;this.detachMedia(),h&&this.attachMedia(h)},D.removeLevel=function(h,d){d===void 0&&(d=0),this.levelController.removeLevel(h,d)},O(y,[{key:"levels",get:function(){var h=this.levelController.levels;return h||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(h){T.logger.log("set currentLevel:"+h),this.loadLevel=h,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(h){T.logger.log("set nextLevel:"+h),this.levelController.manualLevel=h,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(h){T.logger.log("set loadLevel:"+h),this.levelController.manualLevel=h}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(h){this.levelController.nextLoadLevel=h}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(h){T.logger.log("set firstLevel:"+h),this.levelController.firstLevel=h}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(h){T.logger.log("set startLevel:"+h),h!==-1&&(h=Math.max(h,this.minAutoLevel)),this.levelController.startLevel=h}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(h){var d=!!h;d!==this.config.capLevelToPlayerSize&&(d?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=d)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(h){this._autoLevelCapping!==h&&(T.logger.log("set autoLevelCapping:"+h),this._autoLevelCapping=h)}},{key:"bandwidthEstimate",get:function(){var h=this.abrController.bwEstimator;return h?h.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var h=this.levels,d=this.config.minAutoBitrate;if(!h)return 0;for(var o=h.length,s=0;s<o;s++)if(h[s].maxBitrate>d)return s;return 0}},{key:"maxAutoLevel",get:function(){var h=this.levels,d=this.autoLevelCapping,o;return d===-1&&h&&h.length?o=h.length-1:o=d,o}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(h){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,h)}},{key:"audioTracks",get:function(){var h=this.audioTrackController;return h?h.audioTracks:[]}},{key:"audioTrack",get:function(){var h=this.audioTrackController;return h?h.audioTrack:-1},set:function(h){var d=this.audioTrackController;d&&(d.audioTrack=h)}},{key:"subtitleTracks",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTrack:-1},set:function(h){var d=this.subtitleTrackController;d&&(d.subtitleTrack=h)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var h=this.subtitleTrackController;return h?h.subtitleDisplay:!1},set:function(h){var d=this.subtitleTrackController;d&&(d.subtitleDisplay=h)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(h){this.config.lowLatencyMode=h}},{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 a.Events}},{key:"ErrorTypes",get:function(){return u.ErrorTypes}},{key:"ErrorDetails",get:function(){return u.ErrorDetails}},{key:"DefaultConfig",get:function(){return y.defaultConfig?y.defaultConfig:p.hlsDefaultConfig},set:function(h){y.defaultConfig=h}}]),y}();b.defaultConfig=void 0},"./src/is-supported.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"isSupported",function(){return x}),R.d(K,"changeTypeSupported",function(){return U});var H=R("./src/utils/mediasource-helper.ts");function N(){return self.SourceBuffer||self.WebKitSourceBuffer}function x(){var I=Object(H.getMediaSource)();if(!I)return!1;var E=N(),L=I&&typeof I.isTypeSupported=="function"&&I.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),f=!E||E.prototype&&typeof E.prototype.appendBuffer=="function"&&typeof E.prototype.remove=="function";return!!L&&!!f}function U(){var I,E=N();return typeof(E==null||((I=E.prototype)===null||I===void 0)?void 0:I.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return T}),R.d(K,"LoadError",function(){return m});var H=R("./src/polyfills/number.ts"),N=R("./src/errors.ts");function x(i,a){i.prototype=Object.create(a.prototype),i.prototype.constructor=i,f(i,a)}function U(i){var a=typeof Map=="function"?new Map:void 0;return U=function(c){if(c===null||!L(c))return c;if(typeof c!="function")throw new TypeError("Super expression must either be null or a function");if(typeof a!="undefined"){if(a.has(c))return a.get(c);a.set(c,O)}function O(){return I(c,arguments,S(this).constructor)}return O.prototype=Object.create(c.prototype,{constructor:{value:O,enumerable:!1,writable:!0,configurable:!0}}),f(O,c)},U(i)}function I(i,a,u){return E()?I=Reflect.construct:I=function(O,b,y){var D=[null];D.push.apply(D,b);var _=Function.bind.apply(O,D),h=new _;return y&&f(h,y.prototype),h},I.apply(null,arguments)}function E(){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 L(i){return Function.toString.call(i).indexOf("[native code]")!==-1}function f(i,a){return f=Object.setPrototypeOf||function(c,O){return c.__proto__=O,c},f(i,a)}function S(i){return S=Object.setPrototypeOf?Object.getPrototypeOf:function(u){return u.__proto__||Object.getPrototypeOf(u)},S(i)}var P=Math.pow(2,17),T=function(){function i(u){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=u}var a=i.prototype;return a.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},a.abort=function(){this.loader&&this.loader.abort()},a.load=function(c,O){var b=this,y=c.url;if(!y)return Promise.reject(new m({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,networkDetails:null},"Fragment does not have a "+(y?"part list":"url")));this.abort();var D=this.config,_=D.fLoader,h=D.loader;return new Promise(function(d,o){b.loader&&b.loader.destroy();var s=b.loader=c.loader=_?new _(D):new h(D),w=p(c),C={timeout:D.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:D.fragLoadingMaxRetryTimeout,highWaterMark:P};c.stats=s.stats,s.load(w,C,{onSuccess:function(M,B,F,Q){b.resetLoader(c,s),d({frag:c,part:null,payload:M.data,networkDetails:Q})},onError:function(M,B,F){b.resetLoader(c,s),o(new m({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,response:M,networkDetails:F}))},onAbort:function(M,B,F){b.resetLoader(c,s),o(new m({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:c,networkDetails:F}))},onTimeout:function(M,B,F){b.resetLoader(c,s),o(new m({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:c,networkDetails:F}))},onProgress:function(M,B,F,Q){O&&O({frag:c,part:null,payload:F,networkDetails:Q})}})})},a.loadPart=function(c,O,b){var y=this;this.abort();var D=this.config,_=D.fLoader,h=D.loader;return new Promise(function(d,o){y.loader&&y.loader.destroy();var s=y.loader=c.loader=_?new _(D):new h(D),w=p(c,O),C={timeout:D.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:D.fragLoadingMaxRetryTimeout,highWaterMark:P};O.stats=s.stats,s.load(w,C,{onSuccess:function(M,B,F,Q){y.resetLoader(c,s),y.updateStatsFromPart(c,O);var G={frag:c,part:O,payload:M.data,networkDetails:Q};b(G),d(G)},onError:function(M,B,F){y.resetLoader(c,s),o(new m({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,part:O,response:M,networkDetails:F}))},onAbort:function(M,B,F){c.stats.aborted=O.stats.aborted,y.resetLoader(c,s),o(new m({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:c,part:O,networkDetails:F}))},onTimeout:function(M,B,F){y.resetLoader(c,s),o(new m({type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:c,part:O,networkDetails:F}))}})})},a.updateStatsFromPart=function(c,O){var b=c.stats,y=O.stats,D=y.total;if(b.loaded+=y.loaded,D){var _=Math.round(c.duration/O.duration),h=Math.min(Math.round(b.loaded/D),_),d=_-h,o=d*Math.round(b.loaded/h);b.total=b.loaded+o}else b.total=Math.max(b.loaded,b.total);var s=b.loading,w=y.loading;s.start?s.first+=w.first-w.start:(s.start=w.start,s.first=w.first),s.end=w.end},a.resetLoader=function(c,O){c.loader=null,this.loader===O&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),O.destroy()},i}();function p(i,a){a===void 0&&(a=null);var u=a||i,c={frag:i,part:a,responseType:"arraybuffer",url:u.url,headers:{},rangeStart:0,rangeEnd:0},O=u.byteRangeStartOffset,b=u.byteRangeEndOffset;return Object(H.isFiniteNumber)(O)&&Object(H.isFiniteNumber)(b)&&(c.rangeStart=O,c.rangeEnd=b),c}var m=function(i){x(a,i);function a(u){for(var c,O=arguments.length,b=new Array(O>1?O-1:0),y=1;y<O;y++)b[y-1]=arguments[y];return c=i.call.apply(i,[this].concat(b))||this,c.data=void 0,c.data=u,c}return a}(U(Error))},"./src/loader/fragment.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"ElementaryStreamTypes",function(){return T}),R.d(K,"BaseSegment",function(){return p}),R.d(K,"Fragment",function(){return m}),R.d(K,"Part",function(){return i});var H=R("./src/polyfills/number.ts"),N=R("./node_modules/url-toolkit/src/url-toolkit.js"),x=R.n(N),U=R("./src/utils/logger.ts"),I=R("./src/loader/level-key.ts"),E=R("./src/loader/load-stats.ts");function L(a,u){a.prototype=Object.create(u.prototype),a.prototype.constructor=a,f(a,u)}function f(a,u){return f=Object.setPrototypeOf||function(O,b){return O.__proto__=b,O},f(a,u)}function S(a,u){for(var c=0;c<u.length;c++){var O=u[c];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(a,O.key,O)}}function P(a,u,c){return u&&S(a.prototype,u),c&&S(a,c),a}var T;(function(a){a.AUDIO="audio",a.VIDEO="video",a.AUDIOVIDEO="audiovideo"})(T||(T={}));var p=function(){function a(c){var O;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(O={},O[T.AUDIO]=null,O[T.VIDEO]=null,O[T.AUDIOVIDEO]=null,O),this.baseurl=c}var u=a.prototype;return u.setByteRange=function(O,b){var y=O.split("@",2),D=[];y.length===1?D[0]=b?b.byteRangeEndOffset:0:D[0]=parseInt(y[1]),D[1]=parseInt(y[0])+D[0],this._byteRange=D},P(a,[{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(N.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(O){this._url=O}}]),a}(),m=function(a){L(u,a);function u(O,b){var y;return y=a.call(this,b)||this,y._decryptdata=null,y.rawProgramDateTime=null,y.programDateTime=null,y.tagList=[],y.duration=0,y.sn=0,y.levelkey=void 0,y.type=void 0,y.loader=null,y.level=-1,y.cc=0,y.startPTS=void 0,y.endPTS=void 0,y.appendedPTS=void 0,y.startDTS=void 0,y.endDTS=void 0,y.start=0,y.deltaPTS=void 0,y.maxStartPTS=void 0,y.minEndPTS=void 0,y.stats=new E.LoadStats,y.urlId=0,y.data=void 0,y.bitrateTest=!1,y.title=null,y.initSegment=null,y.type=O,y}var c=u.prototype;return c.createInitializationVector=function(b){for(var y=new Uint8Array(16),D=12;D<16;D++)y[D]=b>>8*(15-D)&255;return y},c.setDecryptDataFromLevelKey=function(b,y){var D=b;return(b==null?void 0:b.method)==="AES-128"&&b.uri&&!b.iv&&(D=I.LevelKey.fromURI(b.uri),D.method=b.method,D.iv=this.createInitializationVector(y),D.keyFormat="identity"),D},c.setElementaryStreamInfo=function(b,y,D,_,h,d){d===void 0&&(d=!1);var o=this.elementaryStreams,s=o[b];if(!s){o[b]={startPTS:y,endPTS:D,startDTS:_,endDTS:h,partial:d};return}s.startPTS=Math.min(s.startPTS,y),s.endPTS=Math.max(s.endPTS,D),s.startDTS=Math.min(s.startDTS,_),s.endDTS=Math.max(s.endDTS,h)},c.clearElementaryStreamInfo=function(){var b=this.elementaryStreams;b[T.AUDIO]=null,b[T.VIDEO]=null,b[T.AUDIOVIDEO]=null},P(u,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var b=this.sn;typeof b!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&U.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),b=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,b)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(H.isFiniteNumber)(this.programDateTime))return null;var b=Object(H.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+b*1e3}},{key:"encrypted",get:function(){var b;return!!((b=this.decryptdata)!==null&&b!==void 0&&b.keyFormat&&this.decryptdata.uri)}}]),u}(p),i=function(a){L(u,a);function u(c,O,b,y,D){var _;_=a.call(this,b)||this,_.fragOffset=0,_.duration=0,_.gap=!1,_.independent=!1,_.relurl=void 0,_.fragment=void 0,_.index=void 0,_.stats=new E.LoadStats,_.duration=c.decimalFloatingPoint("DURATION"),_.gap=c.bool("GAP"),_.independent=c.bool("INDEPENDENT"),_.relurl=c.enumeratedString("URI"),_.fragment=O,_.index=y;var h=c.enumeratedString("BYTERANGE");return h&&_.setByteRange(h,D),D&&(_.fragOffset=D.fragOffset+D.duration),_}return P(u,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var O=this.elementaryStreams;return!!(O.audio||O.video||O.audiovideo)}}]),u}(p)},"./src/loader/key-loader.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return U});var H=R("./src/events.ts"),N=R("./src/errors.ts"),x=R("./src/utils/logger.ts"),U=function(){function I(L){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=L,this._registerListeners()}var E=I.prototype;return E._registerListeners=function(){this.hls.on(H.Events.KEY_LOADING,this.onKeyLoading,this)},E._unregisterListeners=function(){this.hls.off(H.Events.KEY_LOADING,this.onKeyLoading)},E.destroy=function(){this._unregisterListeners();for(var f in this.loaders){var S=this.loaders[f];S&&S.destroy()}this.loaders={}},E.onKeyLoading=function(f,S){var P=S.frag,T=P.type,p=this.loaders[T];if(!P.decryptdata){x.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var m=P.decryptdata.uri;if(m!==this.decrypturl||this.decryptkey===null){var i=this.hls.config;if(p&&(x.logger.warn("abort previous key loader for type:"+T),p.abort()),!m){x.logger.warn("key uri is falsy");return}var a=i.loader,u=P.loader=this.loaders[T]=new a(i);this.decrypturl=m,this.decryptkey=null;var c={url:m,frag:P,responseType:"arraybuffer"},O={timeout:i.fragLoadingTimeOut,maxRetry:0,retryDelay:i.fragLoadingRetryDelay,maxRetryDelay:i.fragLoadingMaxRetryTimeout,highWaterMark:0},b={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(c,O,b)}else this.decryptkey&&(P.decryptdata.key=this.decryptkey,this.hls.trigger(H.Events.KEY_LOADED,{frag:P}))},E.loadsuccess=function(f,S,P){var T=P.frag;if(!T.decryptdata){x.logger.error("after key load, decryptdata unset");return}this.decryptkey=T.decryptdata.key=new Uint8Array(f.data),T.loader=null,delete this.loaders[T.type],this.hls.trigger(H.Events.KEY_LOADED,{frag:T})},E.loaderror=function(f,S){var P=S.frag,T=P.loader;T&&T.abort(),delete this.loaders[P.type],this.hls.trigger(H.Events.ERROR,{type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:P,response:f})},E.loadtimeout=function(f,S){var P=S.frag,T=P.loader;T&&T.abort(),delete this.loaders[P.type],this.hls.trigger(H.Events.ERROR,{type:N.ErrorTypes.NETWORK_ERROR,details:N.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:P})},I}()},"./src/loader/level-details.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"LevelDetails",function(){return I});var H=R("./src/polyfills/number.ts");function N(E,L){for(var f=0;f<L.length;f++){var S=L[f];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(E,S.key,S)}}function x(E,L,f){return L&&N(E.prototype,L),f&&N(E,f),E}var U=10,I=function(){function E(f){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=f}var L=E.prototype;return L.reloaded=function(S){if(!S){this.advanced=!0,this.updated=!0;return}var P=this.lastPartSn-S.lastPartSn,T=this.lastPartIndex-S.lastPartIndex;this.updated=this.endSN!==S.endSN||!!T||!!P,this.advanced=this.endSN>S.endSN||P>0||P===0&&T>0,this.updated||this.advanced?this.misses=Math.floor(S.misses*.6):this.misses=S.misses+1,this.availabilityDelay=S.availabilityDelay},x(E,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(H.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||U}},{key:"drift",get:function(){var S=this.driftEndTime-this.driftStartTime;if(S>0){var P=this.driftEnd-this.driftStart;return P*1e3/S}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var S;return(S=this.partList)!==null&&S!==void 0&&S.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var S;return(S=this.fragments)!==null&&S!==void 0&&S.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 S;return(S=this.partList)!==null&&S!==void 0&&S.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var S;return(S=this.partList)!==null&&S!==void 0&&S.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),E}()},"./src/loader/level-key.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"LevelKey",function(){return I});var H=R("./node_modules/url-toolkit/src/url-toolkit.js"),N=R.n(H);function x(E,L){for(var f=0;f<L.length;f++){var S=L[f];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(E,S.key,S)}}function U(E,L,f){return L&&x(E.prototype,L),f&&x(E,f),E}var I=function(){E.fromURL=function(f,S){return new E(f,S)},E.fromURI=function(f){return new E(f)};function E(L,f){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,f?this._uri=Object(H.buildAbsoluteURL)(L,f,{alwaysNormalize:!0}):this._uri=L}return U(E,[{key:"uri",get:function(){return this._uri}}]),E}()},"./src/loader/load-stats.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"LoadStats",function(){return H});var H=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(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return u});var H=R("./src/polyfills/number.ts"),N=R("./node_modules/url-toolkit/src/url-toolkit.js"),x=R.n(N),U=R("./src/loader/fragment.ts"),I=R("./src/loader/level-details.ts"),E=R("./src/loader/level-key.ts"),L=R("./src/utils/attr-list.ts"),f=R("./src/utils/logger.ts"),S=R("./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,T=/#EXT-X-MEDIA:(.*)/g,p=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),m=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 a(D){var _,h;return i.test((_=(h=N.parseURL(D))===null||h===void 0?void 0:h.path)!=null?_:"")}var u=function(){function D(){}return D.findGroup=function(h,d){for(var o=0;o<h.length;o++){var s=h[o];if(s.id===d)return s}},D.convertAVC1ToAVCOTI=function(h){var d=h.split(".");if(d.length>2){var o=d.shift()+".";return o+=parseInt(d.shift()).toString(16),o+=("000"+parseInt(d.shift()).toString(16)).substr(-4),o}return h},D.resolve=function(h,d){return N.buildAbsoluteURL(d,h,{alwaysNormalize:!0})},D.parseMasterPlaylist=function(h,d){var o=[],s={},w=!1;P.lastIndex=0;for(var C;(C=P.exec(h))!=null;)if(C[1]){var v=new L.AttrList(C[1]),M={attrs:v,bitrate:v.decimalInteger("AVERAGE-BANDWIDTH")||v.decimalInteger("BANDWIDTH"),name:v.NAME,url:D.resolve(C[2],d)},B=v.decimalResolution("RESOLUTION");B&&(M.width=B.width,M.height=B.height),c((v.CODECS||"").split(/[ ,]+/).filter(function(Q){return Q}),M),M.videoCodec&&M.videoCodec.indexOf("avc1")!==-1&&(M.videoCodec=D.convertAVC1ToAVCOTI(M.videoCodec)),o.push(M)}else if(C[3]){var F=new L.AttrList(C[3]);F["DATA-ID"]&&(w=!0,s[F["DATA-ID"]]=F)}return{levels:o,sessionData:w?s:null}},D.parseMasterPlaylistMedia=function(h,d,o,s){s===void 0&&(s=[]);var w,C=[],v=0;for(T.lastIndex=0;(w=T.exec(h))!==null;){var M=new L.AttrList(w[1]);if(M.TYPE===o){var B={attrs:M,bitrate:0,id:v++,groupId:M["GROUP-ID"],instreamId:M["INSTREAM-ID"],name:M.NAME||M.LANGUAGE||"",type:o,default:M.bool("DEFAULT"),autoselect:M.bool("AUTOSELECT"),forced:M.bool("FORCED"),lang:M.LANGUAGE,url:M.URI?D.resolve(M.URI,d):""};if(s.length){var F=D.findGroup(s,B.groupId)||s[0];O(B,F,"audioCodec"),O(B,F,"textCodec")}C.push(B)}}return C},D.parseLevelPlaylist=function(h,d,o,s,w){var C=new I.LevelDetails(d),v=C.fragments,M=null,B=0,F=0,Q=0,G=0,W=null,$=new U.Fragment(s,d),re,ae,he,Te=-1,ye=!1;for(p.lastIndex=0,C.m3u8=h;(re=p.exec(h))!==null;){ye&&(ye=!1,$=new U.Fragment(s,d),$.start=Q,$.sn=B,$.cc=G,$.level=o,M&&($.initSegment=M,$.rawProgramDateTime=M.rawProgramDateTime));var Ee=re[1];if(Ee){$.duration=parseFloat(Ee);var Oe=(" "+re[2]).slice(1);$.title=Oe||null,$.tagList.push(Oe?["INF",Ee,Oe]:["INF",Ee])}else if(re[3])Object(H.isFiniteNumber)($.duration)&&($.start=Q,he&&($.levelkey=he),$.sn=B,$.level=o,$.cc=G,$.urlId=w,v.push($),$.relurl=(" "+re[3]).slice(1),y($,W),W=$,Q+=$.duration,B++,F=0,ye=!0);else if(re[4]){var _e=(" "+re[4]).slice(1);W?$.setByteRange(_e,W):$.setByteRange(_e)}else if(re[5])$.rawProgramDateTime=(" "+re[5]).slice(1),$.tagList.push(["PROGRAM-DATE-TIME",$.rawProgramDateTime]),Te===-1&&(Te=v.length);else{if(re=re[0].match(m),!re){f.logger.warn("No matches on slow regex match for level playlist!");continue}for(ae=1;ae<re.length&&!(typeof re[ae]!="undefined");ae++);var fe=(" "+re[ae]).slice(1),le=(" "+re[ae+1]).slice(1),Me=re[ae+2]?(" "+re[ae+2]).slice(1):"";switch(fe){case"PLAYLIST-TYPE":C.type=le.toUpperCase();break;case"MEDIA-SEQUENCE":B=C.startSN=parseInt(le);break;case"SKIP":{var ot=new L.AttrList(le),ut=ot.decimalInteger("SKIPPED-SEGMENTS");if(Object(H.isFiniteNumber)(ut)){C.skippedSegments=ut;for(var rt=ut;rt--;)v.unshift(null);B+=ut}var tt=ot.enumeratedString("RECENTLY-REMOVED-DATERANGES");tt&&(C.recentlyRemovedDateranges=tt.split(" "));break}case"TARGETDURATION":C.targetduration=parseFloat(le);break;case"VERSION":C.version=parseInt(le);break;case"EXTM3U":break;case"ENDLIST":C.live=!1;break;case"#":(le||Me)&&$.tagList.push(Me?[le,Me]:[le]);break;case"DIS":G++;case"GAP":$.tagList.push([fe]);break;case"BITRATE":$.tagList.push([fe,le]);break;case"DISCONTINUITY-SEQ":G=parseInt(le);break;case"KEY":{var ze,$e=new L.AttrList(le),ct=$e.enumeratedString("METHOD"),vt=$e.URI,at=$e.hexadecimalInteger("IV"),et=$e.enumeratedString("KEYFORMATVERSIONS"),nt=$e.enumeratedString("KEYID"),Rt=(ze=$e.enumeratedString("KEYFORMAT"))!=null?ze:"identity",Ct=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ct.indexOf(Rt)>-1){f.logger.warn("Keyformat "+Rt+" is not supported from the manifest");continue}else if(Rt!=="identity")continue;ct&&(he=E.LevelKey.fromURL(d,vt),vt&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(ct)>=0&&(he.method=ct,he.keyFormat=Rt,nt&&(he.keyID=nt),et&&(he.keyFormatVersions=et),he.iv=at));break}case"START":{var xt=new L.AttrList(le),yt=xt.decimalFloatingPoint("TIME-OFFSET");Object(H.isFiniteNumber)(yt)&&(C.startTimeOffset=yt);break}case"MAP":{var wt=new L.AttrList(le);$.relurl=wt.URI,wt.BYTERANGE&&$.setByteRange(wt.BYTERANGE),$.level=o,$.sn="initSegment",he&&($.levelkey=he),$.initSegment=null,M=$,ye=!0;break}case"SERVER-CONTROL":{var Et=new L.AttrList(le);C.canBlockReload=Et.bool("CAN-BLOCK-RELOAD"),C.canSkipUntil=Et.optionalFloat("CAN-SKIP-UNTIL",0),C.canSkipDateRanges=C.canSkipUntil>0&&Et.bool("CAN-SKIP-DATERANGES"),C.partHoldBack=Et.optionalFloat("PART-HOLD-BACK",0),C.holdBack=Et.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Se=new L.AttrList(le);C.partTarget=Se.decimalFloatingPoint("PART-TARGET");break}case"PART":{var xe=C.partList;xe||(xe=C.partList=[]);var Ke=F>0?xe[xe.length-1]:void 0,Ve=F++,De=new U.Part(new L.AttrList(le),$,d,Ve,Ke);xe.push(De),$.duration+=De.duration;break}case"PRELOAD-HINT":{var We=new L.AttrList(le);C.preloadHint=We;break}case"RENDITION-REPORT":{var ge=new L.AttrList(le);C.renditionReports=C.renditionReports||[],C.renditionReports.push(ge);break}default:f.logger.warn("line parsed but not handled: "+re);break}}}W&&!W.relurl?(v.pop(),Q-=W.duration,C.partList&&(C.fragmentHint=W)):C.partList&&(y($,W),$.cc=G,C.fragmentHint=$);var de=v.length,ce=v[0],ne=v[de-1];if(Q+=C.skippedSegments*C.targetduration,Q>0&&de&&ne){C.averagetargetduration=Q/de;var ie=ne.sn;C.endSN=ie!=="initSegment"?ie:0,ce&&(C.startCC=ce.cc,ce.initSegment||C.fragments.every(function(oe){return oe.relurl&&a(oe.relurl)})&&(f.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),$=new U.Fragment(s,d),$.relurl=ne.relurl,$.level=o,$.sn="initSegment",ce.initSegment=$,C.needSidxRanges=!0))}else C.endSN=0,C.startCC=0;return C.fragmentHint&&(Q+=C.fragmentHint.duration),C.totalduration=Q,C.endCC=G,Te>0&&b(v,Te),C},D}();function c(D,_){["video","audio","text"].forEach(function(h){var d=D.filter(function(s){return Object(S.isCodecType)(s,h)});if(d.length){var o=d.filter(function(s){return s.lastIndexOf("avc1",0)===0||s.lastIndexOf("mp4a",0)===0});_[h+"Codec"]=o.length>0?o[0]:d[0],D=D.filter(function(s){return d.indexOf(s)===-1})}}),_.unknownCodecs=D}function O(D,_,h){var d=_[h];d&&(D[h]=d)}function b(D,_){for(var h=D[_],d=_;d--;){var o=D[d];if(!o)return;o.programDateTime=h.programDateTime-o.duration*1e3,h=o}}function y(D,_){D.rawProgramDateTime?D.programDateTime=Date.parse(D.rawProgramDateTime):_!=null&&_.programDateTime&&(D.programDateTime=_.endProgramDateTime),Object(H.isFiniteNumber)(D.programDateTime)||(D.programDateTime=null,D.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(J,K,R){"use strict";R.r(K);var H=R("./src/polyfills/number.ts"),N=R("./src/events.ts"),x=R("./src/errors.ts"),U=R("./src/utils/logger.ts"),I=R("./src/utils/mp4-tools.ts"),E=R("./src/loader/m3u8-parser.ts"),L=R("./src/types/loader.ts"),f=R("./src/utils/attr-list.ts");function S(p){var m=p.type;switch(m){case L.PlaylistContextType.AUDIO_TRACK:return L.PlaylistLevelType.AUDIO;case L.PlaylistContextType.SUBTITLE_TRACK:return L.PlaylistLevelType.SUBTITLE;default:return L.PlaylistLevelType.MAIN}}function P(p,m){var i=p.url;return(i===void 0||i.indexOf("data:")===0)&&(i=m.url),i}var T=function(){function p(i){this.hls=void 0,this.loaders=Object.create(null),this.hls=i,this.registerListeners()}var m=p.prototype;return m.registerListeners=function(){var a=this.hls;a.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(N.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(N.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.on(N.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},m.unregisterListeners=function(){var a=this.hls;a.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(N.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(N.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.off(N.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},m.createInternalLoader=function(a){var u=this.hls.config,c=u.pLoader,O=u.loader,b=c||O,y=new b(u);return a.loader=y,this.loaders[a.type]=y,y},m.getInternalLoader=function(a){return this.loaders[a.type]},m.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},m.destroyInternalLoaders=function(){for(var a in this.loaders){var u=this.loaders[a];u&&u.destroy(),this.resetInternalLoader(a)}},m.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},m.onManifestLoading=function(a,u){var c=u.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:L.PlaylistContextType.MANIFEST,url:c,deliveryDirectives:null})},m.onLevelLoading=function(a,u){var c=u.id,O=u.level,b=u.url,y=u.deliveryDirectives;this.load({id:c,groupId:null,level:O,responseType:"text",type:L.PlaylistContextType.LEVEL,url:b,deliveryDirectives:y})},m.onAudioTrackLoading=function(a,u){var c=u.id,O=u.groupId,b=u.url,y=u.deliveryDirectives;this.load({id:c,groupId:O,level:null,responseType:"text",type:L.PlaylistContextType.AUDIO_TRACK,url:b,deliveryDirectives:y})},m.onSubtitleTrackLoading=function(a,u){var c=u.id,O=u.groupId,b=u.url,y=u.deliveryDirectives;this.load({id:c,groupId:O,level:null,responseType:"text",type:L.PlaylistContextType.SUBTITLE_TRACK,url:b,deliveryDirectives:y})},m.load=function(a){var u,c=this.hls.config,O=this.getInternalLoader(a);if(O){var b=O.context;if(b&&b.url===a.url){U.logger.trace("[playlist-loader]: playlist request ongoing");return}U.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),O.abort()}var y,D,_,h;switch(a.type){case L.PlaylistContextType.MANIFEST:y=c.manifestLoadingMaxRetry,D=c.manifestLoadingTimeOut,_=c.manifestLoadingRetryDelay,h=c.manifestLoadingMaxRetryTimeout;break;case L.PlaylistContextType.LEVEL:case L.PlaylistContextType.AUDIO_TRACK:case L.PlaylistContextType.SUBTITLE_TRACK:y=0,D=c.levelLoadingTimeOut;break;default:y=c.levelLoadingMaxRetry,D=c.levelLoadingTimeOut,_=c.levelLoadingRetryDelay,h=c.levelLoadingMaxRetryTimeout;break}if(O=this.createInternalLoader(a),(u=a.deliveryDirectives)!==null&&u!==void 0&&u.part){var d;if(a.type===L.PlaylistContextType.LEVEL&&a.level!==null?d=this.hls.levels[a.level].details:a.type===L.PlaylistContextType.AUDIO_TRACK&&a.id!==null?d=this.hls.audioTracks[a.id].details:a.type===L.PlaylistContextType.SUBTITLE_TRACK&&a.id!==null&&(d=this.hls.subtitleTracks[a.id].details),d){var o=d.partTarget,s=d.targetduration;o&&s&&(D=Math.min(Math.max(o*3,s*.8)*1e3,D))}}var w={timeout:D,maxRetry:y,retryDelay:_,maxRetryDelay:h,highWaterMark:0},C={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};O.load(a,w,C)},m.loadsuccess=function(a,u,c,O){if(O===void 0&&(O=null),c.isSidxRequest){this.handleSidxRequest(a,c),this.handlePlaylistLoaded(a,u,c,O);return}this.resetInternalLoader(c.type);var b=a.data;if(b.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,c,"no EXTM3U delimiter",O);return}u.parsing.start=performance.now(),b.indexOf("#EXTINF:")>0||b.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,u,c,O):this.handleMasterPlaylist(a,u,c,O)},m.loaderror=function(a,u,c){c===void 0&&(c=null),this.handleNetworkError(u,c,!1,a)},m.loadtimeout=function(a,u,c){c===void 0&&(c=null),this.handleNetworkError(u,c,!0)},m.handleMasterPlaylist=function(a,u,c,O){var b=this.hls,y=a.data,D=P(a,c),_=E.default.parseMasterPlaylist(y,D),h=_.levels,d=_.sessionData;if(!h.length){this.handleManifestParsingError(a,c,"no level found in manifest",O);return}var o=h.map(function(B){return{id:B.attrs.AUDIO,audioCodec:B.audioCodec}}),s=h.map(function(B){return{id:B.attrs.SUBTITLES,textCodec:B.textCodec}}),w=E.default.parseMasterPlaylistMedia(y,D,"AUDIO",o),C=E.default.parseMasterPlaylistMedia(y,D,"SUBTITLES",s),v=E.default.parseMasterPlaylistMedia(y,D,"CLOSED-CAPTIONS");if(w.length){var M=w.some(function(B){return!B.url});!M&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(U.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),w.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new f.AttrList({}),bitrate:0,url:""}))}b.trigger(N.Events.MANIFEST_LOADED,{levels:h,audioTracks:w,subtitles:C,captions:v,url:D,stats:u,networkDetails:O,sessionData:d})},m.handleTrackOrLevelPlaylist=function(a,u,c,O){var b=this.hls,y=c.id,D=c.level,_=c.type,h=P(a,c),d=Object(H.isFiniteNumber)(y)?y:0,o=Object(H.isFiniteNumber)(D)?D:d,s=S(c),w=E.default.parseLevelPlaylist(a.data,h,o,s,d);if(!w.fragments.length){b.trigger(N.Events.ERROR,{type:x.ErrorTypes.NETWORK_ERROR,details:x.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:h,reason:"no fragments found in level",level:typeof c.level=="number"?c.level:void 0});return}if(_===L.PlaylistContextType.MANIFEST){var C={attrs:new f.AttrList({}),bitrate:0,details:w,name:"",url:h};b.trigger(N.Events.MANIFEST_LOADED,{levels:[C],audioTracks:[],url:h,stats:u,networkDetails:O,sessionData:null})}if(u.parsing.end=performance.now(),w.needSidxRanges){var v,M=(v=w.fragments[0].initSegment)===null||v===void 0?void 0:v.url;this.load({url:M,isSidxRequest:!0,type:_,level:D,levelDetails:w,id:y,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}c.levelDetails=w,this.handlePlaylistLoaded(a,u,c,O)},m.handleSidxRequest=function(a,u){var c=Object(I.parseSegmentIndex)(new Uint8Array(a.data));if(!c)return;var O=c.references,b=u.levelDetails;O.forEach(function(y,D){var _=y.info,h=b.fragments[D];h.byteRange.length===0&&h.setByteRange(String(1+_.end-_.start)+"@"+String(_.start)),h.initSegment&&h.initSegment.setByteRange(String(c.moovEndOffset)+"@0")})},m.handleManifestParsingError=function(a,u,c,O){this.hls.trigger(N.Events.ERROR,{type:x.ErrorTypes.NETWORK_ERROR,details:x.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:u.type===L.PlaylistContextType.MANIFEST,url:a.url,reason:c,response:a,context:u,networkDetails:O})},m.handleNetworkError=function(a,u,c,O){c===void 0&&(c=!1),U.logger.warn("[playlist-loader]: A network "+(c?"timeout":"error")+" occurred while loading "+a.type+" level: "+a.level+" id: "+a.id+' group-id: "'+a.groupId+'"');var b=x.ErrorDetails.UNKNOWN,y=!1,D=this.getInternalLoader(a);switch(a.type){case L.PlaylistContextType.MANIFEST:b=c?x.ErrorDetails.MANIFEST_LOAD_TIMEOUT:x.ErrorDetails.MANIFEST_LOAD_ERROR,y=!0;break;case L.PlaylistContextType.LEVEL:b=c?x.ErrorDetails.LEVEL_LOAD_TIMEOUT:x.ErrorDetails.LEVEL_LOAD_ERROR,y=!1;break;case L.PlaylistContextType.AUDIO_TRACK:b=c?x.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:x.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,y=!1;break;case L.PlaylistContextType.SUBTITLE_TRACK:b=c?x.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:x.ErrorDetails.SUBTITLE_LOAD_ERROR,y=!1;break}D&&this.resetInternalLoader(a.type);var _={type:x.ErrorTypes.NETWORK_ERROR,details:b,fatal:y,url:a.url,loader:D,context:a,networkDetails:u};O&&(_.response=O),this.hls.trigger(N.Events.ERROR,_)},m.handlePlaylistLoaded=function(a,u,c,O){var b=c.type,y=c.level,D=c.id,_=c.groupId,h=c.loader,d=c.levelDetails,o=c.deliveryDirectives;if(!(d!=null&&d.targetduration)){this.handleManifestParsingError(a,c,"invalid target duration",O);return}if(!h)return;d.live&&(h.getCacheAge&&(d.ageHeader=h.getCacheAge()||0),(!h.getCacheAge||isNaN(d.ageHeader))&&(d.ageHeader=0));switch(b){case L.PlaylistContextType.MANIFEST:case L.PlaylistContextType.LEVEL:this.hls.trigger(N.Events.LEVEL_LOADED,{details:d,level:y||0,id:D||0,stats:u,networkDetails:O,deliveryDirectives:o});break;case L.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(N.Events.AUDIO_TRACK_LOADED,{details:d,id:D||0,groupId:_||"",stats:u,networkDetails:O,deliveryDirectives:o});break;case L.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(N.Events.SUBTITLE_TRACK_LOADED,{details:d,id:D||0,groupId:_||"",stats:u,networkDetails:O,deliveryDirectives:o});break}},p}();K.default=T},"./src/polyfills/number.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"isFiniteNumber",function(){return H}),R.d(K,"MAX_SAFE_INTEGER",function(){return N});var H=Number.isFinite||function(x){return typeof x=="number"&&isFinite(x)},N=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(J,K,R){"use strict";R.r(K);var H=function(){function N(){}return N.getSilentFrame=function(U,I){switch(U){case"mp4a.40.2":if(I===1)return new Uint8Array([0,200,0,128,35,128]);if(I===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(I===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(I===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(I===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(I===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(I===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(I===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(I===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},N}();K.default=H},"./src/remux/mp4-generator.ts":function(J,K,R){"use strict";R.r(K);var H=Math.pow(2,32)-1,N=function(){function x(){}return x.init=function(){x.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 I;for(I in x.types)x.types.hasOwnProperty(I)&&(x.types[I]=[I.charCodeAt(0),I.charCodeAt(1),I.charCodeAt(2),I.charCodeAt(3)]);var E=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]),L=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]);x.HDLR_TYPES={video:E,audio:L};var f=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),S=new Uint8Array([0,0,0,0,0,0,0,0]);x.STTS=x.STSC=x.STCO=S,x.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),x.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),x.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),x.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var P=new Uint8Array([105,115,111,109]),T=new Uint8Array([97,118,99,49]),p=new Uint8Array([0,0,0,1]);x.FTYP=x.box(x.types.ftyp,P,p,P,T),x.DINF=x.box(x.types.dinf,x.box(x.types.dref,f))},x.box=function(I){for(var E=8,L=arguments.length,f=new Array(L>1?L-1:0),S=1;S<L;S++)f[S-1]=arguments[S];for(var P=f.length,T=P;P--;)E+=f[P].byteLength;var p=new Uint8Array(E);for(p[0]=E>>24&255,p[1]=E>>16&255,p[2]=E>>8&255,p[3]=E&255,p.set(I,4),P=0,E=8;P<T;P++)p.set(f[P],E),E+=f[P].byteLength;return p},x.hdlr=function(I){return x.box(x.types.hdlr,x.HDLR_TYPES[I])},x.mdat=function(I){return x.box(x.types.mdat,I)},x.mdhd=function(I,E){E*=I;var L=Math.floor(E/(H+1)),f=Math.floor(E%(H+1));return x.box(x.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,I>>24&255,I>>16&255,I>>8&255,I&255,L>>24,L>>16&255,L>>8&255,L&255,f>>24,f>>16&255,f>>8&255,f&255,85,196,0,0]))},x.mdia=function(I){return x.box(x.types.mdia,x.mdhd(I.timescale,I.duration),x.hdlr(I.type),x.minf(I))},x.mfhd=function(I){return x.box(x.types.mfhd,new Uint8Array([0,0,0,0,I>>24,I>>16&255,I>>8&255,I&255]))},x.minf=function(I){return I.type==="audio"?x.box(x.types.minf,x.box(x.types.smhd,x.SMHD),x.DINF,x.stbl(I)):x.box(x.types.minf,x.box(x.types.vmhd,x.VMHD),x.DINF,x.stbl(I))},x.moof=function(I,E,L){return x.box(x.types.moof,x.mfhd(I),x.traf(L,E))},x.moov=function(I){for(var E=I.length,L=[];E--;)L[E]=x.trak(I[E]);return x.box.apply(null,[x.types.moov,x.mvhd(I[0].timescale,I[0].duration)].concat(L).concat(x.mvex(I)))},x.mvex=function(I){for(var E=I.length,L=[];E--;)L[E]=x.trex(I[E]);return x.box.apply(null,[x.types.mvex].concat(L))},x.mvhd=function(I,E){E*=I;var L=Math.floor(E/(H+1)),f=Math.floor(E%(H+1)),S=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,I>>24&255,I>>16&255,I>>8&255,I&255,L>>24,L>>16&255,L>>8&255,L&255,f>>24,f>>16&255,f>>8&255,f&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 x.box(x.types.mvhd,S)},x.sdtp=function(I){var E=I.samples||[],L=new Uint8Array(4+E.length),f,S;for(f=0;f<E.length;f++)S=E[f].flags,L[f+4]=S.dependsOn<<4|S.isDependedOn<<2|S.hasRedundancy;return x.box(x.types.sdtp,L)},x.stbl=function(I){return x.box(x.types.stbl,x.stsd(I),x.box(x.types.stts,x.STTS),x.box(x.types.stsc,x.STSC),x.box(x.types.stsz,x.STSZ),x.box(x.types.stco,x.STCO))},x.avc1=function(I){var E=[],L=[],f,S,P;for(f=0;f<I.sps.length;f++)S=I.sps[f],P=S.byteLength,E.push(P>>>8&255),E.push(P&255),E=E.concat(Array.prototype.slice.call(S));for(f=0;f<I.pps.length;f++)S=I.pps[f],P=S.byteLength,L.push(P>>>8&255),L.push(P&255),L=L.concat(Array.prototype.slice.call(S));var T=x.box(x.types.avcC,new Uint8Array([1,E[3],E[4],E[5],252|3,224|I.sps.length].concat(E).concat([I.pps.length]).concat(L))),p=I.width,m=I.height,i=I.pixelRatio[0],a=I.pixelRatio[1];return x.box(x.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,p>>8&255,p&255,m>>8&255,m&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]),T,x.box(x.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),x.box(x.types.pasp,new Uint8Array([i>>24,i>>16&255,i>>8&255,i&255,a>>24,a>>16&255,a>>8&255,a&255])))},x.esds=function(I){var E=I.config.length;return new Uint8Array([0,0,0,0,3,23+E,0,1,0,4,15+E,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([E]).concat(I.config).concat([6,1,2]))},x.mp4a=function(I){var E=I.samplerate;return x.box(x.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,I.channelCount,0,16,0,0,0,0,E>>8&255,E&255,0,0]),x.box(x.types.esds,x.esds(I)))},x.mp3=function(I){var E=I.samplerate;return x.box(x.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,I.channelCount,0,16,0,0,0,0,E>>8&255,E&255,0,0]))},x.stsd=function(I){return I.type==="audio"?!I.isAAC&&I.codec==="mp3"?x.box(x.types.stsd,x.STSD,x.mp3(I)):x.box(x.types.stsd,x.STSD,x.mp4a(I)):x.box(x.types.stsd,x.STSD,x.avc1(I))},x.tkhd=function(I){var E=I.id,L=I.duration*I.timescale,f=I.width,S=I.height,P=Math.floor(L/(H+1)),T=Math.floor(L%(H+1));return x.box(x.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,E>>24&255,E>>16&255,E>>8&255,E&255,0,0,0,0,P>>24,P>>16&255,P>>8&255,P&255,T>>24,T>>16&255,T>>8&255,T&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,f>>8&255,f&255,0,0,S>>8&255,S&255,0,0]))},x.traf=function(I,E){var L=x.sdtp(I),f=I.id,S=Math.floor(E/(H+1)),P=Math.floor(E%(H+1));return x.box(x.types.traf,x.box(x.types.tfhd,new Uint8Array([0,0,0,0,f>>24,f>>16&255,f>>8&255,f&255])),x.box(x.types.tfdt,new Uint8Array([1,0,0,0,S>>24,S>>16&255,S>>8&255,S&255,P>>24,P>>16&255,P>>8&255,P&255])),x.trun(I,L.length+16+20+8+16+8+8),L)},x.trak=function(I){return I.duration=I.duration||4294967295,x.box(x.types.trak,x.tkhd(I),x.mdia(I))},x.trex=function(I){var E=I.id;return x.box(x.types.trex,new Uint8Array([0,0,0,0,E>>24,E>>16&255,E>>8&255,E&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},x.trun=function(I,E){var L=I.samples||[],f=L.length,S=12+16*f,P=new Uint8Array(S),T,p,m,i,a,u;for(E+=8+S,P.set([0,0,15,1,f>>>24&255,f>>>16&255,f>>>8&255,f&255,E>>>24&255,E>>>16&255,E>>>8&255,E&255],0),T=0;T<f;T++)p=L[T],m=p.duration,i=p.size,a=p.flags,u=p.cts,P.set([m>>>24&255,m>>>16&255,m>>>8&255,m&255,i>>>24&255,i>>>16&255,i>>>8&255,i&255,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,a.degradPrio&240<<8,a.degradPrio&15,u>>>24&255,u>>>16&255,u>>>8&255,u&255],12+16*T);return x.box(x.types.trun,P)},x.initSegment=function(I){x.types||x.init();var E=x.moov(I),L=new Uint8Array(x.FTYP.byteLength+E.byteLength);return L.set(x.FTYP),L.set(E,x.FTYP.byteLength),L},x}();N.types=void 0,N.HDLR_TYPES=void 0,N.STTS=void 0,N.STSC=void 0,N.STCO=void 0,N.STSZ=void 0,N.VMHD=void 0,N.SMHD=void 0,N.STSD=void 0,N.FTYP=void 0,N.DINF=void 0,K.default=N},"./src/remux/mp4-remuxer.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return u}),R.d(K,"normalizePts",function(){return c});var H=R("./src/polyfills/number.ts"),N=R("./src/remux/aac-helper.ts"),x=R("./src/remux/mp4-generator.ts"),U=R("./src/events.ts"),I=R("./src/errors.ts"),E=R("./src/utils/logger.ts"),L=R("./src/types/loader.ts"),f=R("./src/utils/timescale-conversion.ts");function S(){return S=Object.assign||function(D){for(var _=1;_<arguments.length;_++){var h=arguments[_];for(var d in h)Object.prototype.hasOwnProperty.call(h,d)&&(D[d]=h[d])}return D},S.apply(this,arguments)}var P=10*1e3,T=1024,p=1152,m=null,i=null,a=!1,u=function(){function D(h,d,o,s){if(s===void 0&&(s=""),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=h,this.config=d,this.typeSupported=o,this.ISGenerated=!1,m===null){var w=navigator.userAgent||"",C=w.match(/Chrome\/(\d+)/i);m=C?parseInt(C[1]):0}if(i===null){var v=navigator.userAgent.match(/Safari\/(\d+)/i);i=v?parseInt(v[1]):0}a=!!m&&m<75||!!i&&i<600}var _=D.prototype;return _.destroy=function(){},_.resetTimeStamp=function(d){E.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=d},_.resetNextTimestamp=function(){E.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},_.resetInitSegment=function(){E.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},_.getVideoStartPts=function(d){var o=!1,s=d.reduce(function(w,C){var v=C.pts-w;return v<-4294967296?(o=!0,c(w,C.pts)):v>0?w:C.pts},d[0].pts);return o&&E.logger.debug("PTS rollover detected"),s},_.remux=function(d,o,s,w,C,v,M,B){var F,Q,G,W,$,re,ae=C,he=C,Te=d.pid>-1,ye=o.pid>-1,Ee=o.samples.length,Oe=d.samples.length>0,_e=Ee>1,fe=(!Te||Oe)&&(!ye||_e)||this.ISGenerated||M;if(fe){this.ISGenerated||(G=this.generateIS(d,o,C));var le=this.isVideoContiguous,Me=-1;if(_e&&(Me=O(o.samples),!le&&this.config.forceKeyFrameOnDiscontinuity))if(re=!0,Me>0){E.logger.warn("[mp4-remuxer]: Dropped "+Me+" out of "+Ee+" video samples due to a missing keyframe");var ot=this.getVideoStartPts(o.samples);o.samples=o.samples.slice(Me),o.dropped+=Me,he+=(o.samples[0].pts-ot)/(o.timescale||9e4)}else Me===-1&&(E.logger.warn("[mp4-remuxer]: No keyframe found out of "+Ee+" video samples"),re=!1);if(this.ISGenerated){if(Oe&&_e){var ut=this.getVideoStartPts(o.samples),rt=c(d.samples[0].pts,ut)-ut,tt=rt/o.inputTimeScale;ae+=Math.max(0,tt),he+=Math.max(0,-tt)}if(Oe){if(d.samplerate||(E.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),G=this.generateIS(d,o,C)),Q=this.remuxAudio(d,ae,this.isAudioContiguous,v,ye||_e||B===L.PlaylistLevelType.AUDIO?he:void 0),_e){var ze=Q?Q.endPTS-Q.startPTS:0;o.inputTimeScale||(E.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),G=this.generateIS(d,o,C)),F=this.remuxVideo(o,he,le,ze)}}else _e&&(F=this.remuxVideo(o,he,le,0));F&&(F.firstKeyFrame=Me,F.independent=Me!==-1)}}return this.ISGenerated&&(s.samples.length&&($=this.remuxID3(s,C)),w.samples.length&&(W=this.remuxText(w,C))),{audio:Q,video:F,initSegment:G,independent:re,text:W,id3:$}},_.generateIS=function(d,o,s){var w=d.samples,C=o.samples,v=this.typeSupported,M={},B=!Object(H.isFiniteNumber)(this._initPTS),F="audio/mp4",Q,G,W;if(B&&(Q=G=Infinity),d.config&&w.length&&(d.timescale=d.samplerate,d.isAAC||(v.mpeg?(F="audio/mpeg",d.codec=""):v.mp3&&(d.codec="mp3")),M.audio={id:"audio",container:F,codec:d.codec,initSegment:!d.isAAC&&v.mpeg?new Uint8Array(0):x.default.initSegment([d]),metadata:{channelCount:d.channelCount}},B&&(W=d.inputTimeScale,Q=G=w[0].pts-Math.round(W*s))),o.sps&&o.pps&&C.length&&(o.timescale=o.inputTimeScale,M.video={id:"main",container:"video/mp4",codec:o.codec,initSegment:x.default.initSegment([o]),metadata:{width:o.width,height:o.height}},B)){W=o.inputTimeScale;var $=this.getVideoStartPts(C),re=Math.round(W*s);G=Math.min(G,c(C[0].dts,$)-re),Q=Math.min(Q,$-re)}if(Object.keys(M).length)return this.ISGenerated=!0,B&&(this._initPTS=Q,this._initDTS=G),{tracks:M,initPTS:Q,timescale:W}},_.remuxVideo=function(d,o,s,w){var C=d.inputTimeScale,v=d.samples,M=[],B=v.length,F=this._initPTS,Q=this.nextAvcDts,G=8,W,$,re,ae=Number.POSITIVE_INFINITY,he=Number.NEGATIVE_INFINITY,Te=0,ye=!1;if(!s||Q===null){var Ee=o*C,Oe=v[0].pts-c(v[0].dts,v[0].pts);Q=Ee-Oe}for(var _e=0;_e<B;_e++){var fe=v[_e];if(fe.pts=c(fe.pts-F,Q),fe.dts=c(fe.dts-F,Q),fe.dts>fe.pts){var le=9e4*.2;Te=Math.max(Math.min(Te,fe.pts-fe.dts),-1*le)}fe.dts<v[_e>0?_e-1:_e].dts&&(ye=!0)}ye&&v.sort(function(it,Be){var Ue=it.dts-Be.dts,Re=it.pts-Be.pts;return Ue||Re}),$=v[0].dts,re=v[v.length-1].dts;var Me=Math.round((re-$)/(B-1));if(Te<0){if(Te<Me*-2){E.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(f.toMsFromMpegTsClock)(-Me,!0)+" ms");for(var ot=Te,ut=0;ut<B;ut++)v[ut].dts=ot=Math.max(ot,v[ut].pts-Me),v[ut].pts=Math.max(ot,v[ut].pts)}else{E.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(f.toMsFromMpegTsClock)(Te,!0)+" ms to overcome this issue");for(var rt=0;rt<B;rt++)v[rt].dts=v[rt].dts+Te}$=v[0].dts}if(s){var tt=$-Q,ze=tt>Me,$e=tt<-1;if(ze||$e){ze?E.logger.warn("AVC: "+Object(f.toMsFromMpegTsClock)(tt,!0)+" ms ("+tt+"dts) hole between fragments detected, filling it"):E.logger.warn("AVC: "+Object(f.toMsFromMpegTsClock)(-tt,!0)+" ms ("+tt+"dts) overlapping between fragments detected"),$=Q;var ct=v[0].pts-tt;v[0].dts=$,v[0].pts=ct,E.logger.log("Video: First PTS/DTS adjusted: "+Object(f.toMsFromMpegTsClock)(ct,!0)+"/"+Object(f.toMsFromMpegTsClock)($,!0)+", delta: "+Object(f.toMsFromMpegTsClock)(tt,!0)+" ms")}}a&&($=Math.max(0,$));for(var vt=0,at=0,et=0;et<B;et++){for(var nt=v[et],Rt=nt.units,Ct=Rt.length,xt=0,yt=0;yt<Ct;yt++)xt+=Rt[yt].data.length;at+=xt,vt+=Ct,nt.length=xt,nt.dts=Math.max(nt.dts,$),nt.pts=Math.max(nt.pts,nt.dts,0),ae=Math.min(nt.pts,ae),he=Math.max(nt.pts,he)}re=v[B-1].dts;var wt=at+4*vt+8,Et;try{Et=new Uint8Array(wt)}catch(it){this.observer.emit(U.Events.ERROR,U.Events.ERROR,{type:I.ErrorTypes.MUX_ERROR,details:I.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:wt,reason:"fail allocating video mdat "+wt});return}var Se=new DataView(Et.buffer);Se.setUint32(0,wt),Et.set(x.default.types.mdat,4);for(var xe=0;xe<B;xe++){for(var Ke=v[xe],Ve=Ke.units,De=0,We=0,ge=Ve.length;We<ge;We++){var de=Ve[We],ce=de.data,ne=de.data.byteLength;Se.setUint32(G,ne),G+=4,Et.set(ce,G),G+=ne,De+=4+ne}if(xe<B-1)W=v[xe+1].dts-Ke.dts;else{var ie=this.config,oe=Ke.dts-v[xe>0?xe-1:xe].dts;if(ie.stretchShortVideoTrack&&this.nextAudioPts!==null){var ue=Math.floor(ie.maxBufferHole*C),we=(w?ae+w*C:this.nextAudioPts)-Ke.pts;we>ue?(W=we-oe,W<0&&(W=oe),E.logger.log("[mp4-remuxer]: It is approximately "+we/90+" ms to the next segment; using duration "+W/90+" ms for the last video frame.")):W=oe}else W=oe}var ke=Math.round(Ke.pts-Ke.dts);M.push(new b(Ke.key,W,De,ke))}if(M.length&&m&&m<70){var Je=M[0].flags;Je.dependsOn=2,Je.isNonSync=0}console.assert(W!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=Q=re+W,this.isVideoContiguous=!0;var bt=x.default.moof(d.sequenceNumber++,$,S({},d,{samples:M})),It="video",Ge={data1:bt,data2:Et,startPTS:ae/C,endPTS:(he+W)/C,startDTS:$/C,endDTS:Q/C,type:It,hasAudio:!1,hasVideo:!0,nb:M.length,dropped:d.dropped};return d.samples=[],d.dropped=0,console.assert(Et.length,"MDAT length must not be zero"),Ge},_.remuxAudio=function(d,o,s,w,C){var v=d.inputTimeScale,M=d.samplerate?d.samplerate:v,B=v/M,F=d.isAAC?T:p,Q=F*B,G=this._initPTS,W=!d.isAAC&&this.typeSupported.mpeg,$=[],re=d.samples,ae=W?0:8,he=this.nextAudioPts||-1,Te=o*v;if(this.isAudioContiguous=s=s||re.length&&he>0&&(w&&Math.abs(Te-he)<9e3||Math.abs(c(re[0].pts-G,Te)-he)<20*Q),re.forEach(function(ce){ce.pts=c(ce.pts-G,Te)}),!s||he<0){if(re=re.filter(function(ce){return ce.pts>=0}),!re.length)return;C===0?he=0:w?he=Math.max(0,Te):he=re[0].pts}if(d.isAAC)for(var ye=C!==void 0,Ee=this.config.maxAudioFramesDrift,Oe=0,_e=he;Oe<re.length;Oe++){var fe=re[Oe],le=fe.pts,Me=le-_e,ot=Math.abs(1e3*Me/v);if(Me<=-Ee*Q&&ye)Oe===0&&(E.logger.warn("Audio frame @ "+(le/v).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Me/v)+" ms."),this.nextAudioPts=he=_e=le);else if(Me>=Ee*Q&&ot<P&&ye){var ut=Math.round(Me/Q);_e=le-ut*Q,_e<0&&(ut--,_e+=Q),Oe===0&&(this.nextAudioPts=he=_e),E.logger.warn("[mp4-remuxer]: Injecting "+ut+" audio frame @ "+(_e/v).toFixed(3)+"s due to "+Math.round(1e3*Me/v)+" ms gap.");for(var rt=0;rt<ut;rt++){var tt=Math.max(_e,0),ze=N.default.getSilentFrame(d.manifestCodec||d.codec,d.channelCount);ze||(E.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ze=fe.unit.subarray()),re.splice(Oe,0,{unit:ze,pts:tt}),_e+=Q,Oe++}}fe.pts=_e,_e+=Q}for(var $e=null,ct=null,vt,at=0,et=re.length;et--;)at+=re[et].unit.byteLength;for(var nt=0,Rt=re.length;nt<Rt;nt++){var Ct=re[nt],xt=Ct.unit,yt=Ct.pts;if(ct!==null){var wt=$[nt-1];wt.duration=Math.round((yt-ct)/B)}else if(s&&d.isAAC&&(yt=he),$e=yt,at>0){at+=ae;try{vt=new Uint8Array(at)}catch(ce){this.observer.emit(U.Events.ERROR,U.Events.ERROR,{type:I.ErrorTypes.MUX_ERROR,details:I.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:at,reason:"fail allocating audio mdat "+at});return}if(!W){var Et=new DataView(vt.buffer);Et.setUint32(0,at),vt.set(x.default.types.mdat,4)}}else return;vt.set(xt,ae);var Se=xt.byteLength;ae+=Se,$.push(new b(!0,F,Se,0)),ct=yt}var xe=$.length;if(!xe)return;var Ke=$[$.length-1];this.nextAudioPts=he=ct+B*Ke.duration;var Ve=W?new Uint8Array(0):x.default.moof(d.sequenceNumber++,$e/B,S({},d,{samples:$}));d.samples=[];var De=$e/v,We=he/v,ge="audio",de={data1:Ve,data2:vt,startPTS:De,endPTS:We,startDTS:De,endDTS:We,type:ge,hasAudio:!0,hasVideo:!1,nb:xe};return this.isAudioContiguous=!0,console.assert(vt.length,"MDAT length must not be zero"),de},_.remuxEmptyAudio=function(d,o,s,w){var C=d.inputTimeScale,v=d.samplerate?d.samplerate:C,M=C/v,B=this.nextAudioPts,F=(B!==null?B:w.startDTS*C)+this._initDTS,Q=w.endDTS*C+this._initDTS,G=M*T,W=Math.ceil((Q-F)/G),$=N.default.getSilentFrame(d.manifestCodec||d.codec,d.channelCount);if(E.logger.warn("[mp4-remuxer]: remux empty Audio"),!$){E.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var re=[],ae=0;ae<W;ae++){var he=F+ae*G;re.push({unit:$,pts:he,dts:he})}return d.samples=re,this.remuxAudio(d,o,s,!1)},_.remuxID3=function(d,o){var s=d.samples.length;if(!s)return;for(var w=d.inputTimeScale,C=this._initPTS,v=this._initDTS,M=0;M<s;M++){var B=d.samples[M];B.pts=c(B.pts-C,o*w)/w,B.dts=c(B.dts-v,o*w)/w}var F=d.samples;return d.samples=[],{samples:F}},_.remuxText=function(d,o){var s=d.samples.length;if(!s)return;for(var w=d.inputTimeScale,C=this._initPTS,v=0;v<s;v++){var M=d.samples[v];M.pts=c(M.pts-C,o*w)/w}d.samples.sort(function(F,Q){return F.pts-Q.pts});var B=d.samples;return d.samples=[],{samples:B}},D}();function c(D,_){var h;if(_===null)return D;for(_<D?h=-8589934592:h=8589934592;Math.abs(D-_)>4294967296;)D+=h;return D}function O(D){for(var _=0;_<D.length;_++)if(D[_].key)return _;return-1}var b=function(_,h,d,o){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=h,this.size=d,this.cts=o,this.flags=new y(_)},y=function(_){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=_?2:1,this.isNonSync=_?0:1}},"./src/remux/passthrough-remuxer.ts":function(J,K,R){"use strict";R.r(K);var H=R("./src/polyfills/number.ts"),N=R("./src/utils/mp4-tools.ts"),x=R("./src/loader/fragment.ts"),U=R("./src/utils/logger.ts"),I=function(){function f(){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 S=f.prototype;return S.destroy=function(){},S.resetTimeStamp=function(T){this.initPTS=T,this.lastEndDTS=null},S.resetNextTimestamp=function(){this.lastEndDTS=null},S.resetInitSegment=function(T,p,m){this.audioCodec=p,this.videoCodec=m,this.generateInitSegment(T),this.emitInitSegment=!0},S.generateInitSegment=function(T){var p=this.audioCodec,m=this.videoCodec;if(!T||!T.byteLength){this.initTracks=void 0,this.initData=void 0;return}var i=this.initData=Object(N.parseInitSegment)(T);p||(p=L(i.audio,x.ElementaryStreamTypes.AUDIO)),m||(m=L(i.video,x.ElementaryStreamTypes.VIDEO));var a={};i.audio&&i.video?a.audiovideo={container:"video/mp4",codec:p+","+m,initSegment:T,id:"main"}:i.audio?a.audio={container:"audio/mp4",codec:p,initSegment:T,id:"audio"}:i.video?a.video={container:"video/mp4",codec:m,initSegment:T,id:"main"}:U.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a},S.remux=function(T,p,m,i,a){var u=this.initPTS,c=this.lastEndDTS,O={audio:void 0,video:void 0,text:i,id3:m,initSegment:void 0};Object(H.isFiniteNumber)(c)||(c=this.lastEndDTS=a||0);var b=p.samples;if(!b||!b.length)return O;var y={initPTS:void 0,timescale:1},D=this.initData;if((!D||!D.length)&&(this.generateInitSegment(b),D=this.initData),!D||!D.length)return U.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),O;this.emitInitSegment&&(y.tracks=this.initTracks,this.emitInitSegment=!1),Object(H.isFiniteNumber)(u)||(this.initPTS=y.initPTS=u=E(D,b,c));var _=Object(N.getDuration)(b,D),h=c,d=_+h;Object(N.offsetStartDTS)(D,b,u),_>0?this.lastEndDTS=d:(U.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var o=!!D.audio,s=!!D.video,w="";o&&(w+="audio"),s&&(w+="video");var C={data1:b,startPTS:h,startDTS:h,endPTS:d,endDTS:d,type:w,hasAudio:o,hasVideo:s,nb:1,dropped:0};return O.audio=C.type==="audio"?C:void 0,O.video=C.type!=="audio"?C:void 0,O.text=i,O.id3=m,O.initSegment=y,O},f}(),E=function(S,P,T){return Object(N.getStartDTS)(S,P)-T};function L(f,S){var P=f==null?void 0:f.codec;return P&&P.length>4?P:P==="hvc1"?"hvc1.1.c.L120.90":P==="av01"?"av01.0.04M.08":P==="avc1"||S===x.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}K.default=I},"./src/task-loop.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return H});var H=function(){function N(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var x=N.prototype;return x.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},x.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},x.onHandlerDestroyed=function(){},x.hasInterval=function(){return!!this._tickInterval},x.hasNextTick=function(){return!!this._tickTimer},x.setInterval=function(I){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,I),!0)},x.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},x.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},x.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},x.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},x.doTick=function(){},N}()},"./src/types/cmcd.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"CMCDVersion",function(){return H}),R.d(K,"CMCDObjectType",function(){return N}),R.d(K,"CMCDStreamingFormat",function(){return x}),R.d(K,"CMCDStreamType",function(){return U});var H=1,N;(function(I){I.MANIFEST="m",I.AUDIO="a",I.VIDEO="v",I.MUXED="av",I.INIT="i",I.CAPTION="c",I.TIMED_TEXT="tt",I.KEY="k",I.OTHER="o"})(N||(N={}));var x;(function(I){I.DASH="d",I.HLS="h",I.SMOOTH="s",I.OTHER="o"})(x||(x={}));var U;(function(I){I.VOD="v",I.LIVE="l"})(U||(U={}))},"./src/types/level.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"HlsSkip",function(){return x}),R.d(K,"getSkipValue",function(){return U}),R.d(K,"HlsUrlParameters",function(){return I}),R.d(K,"Level",function(){return E});function H(L,f){for(var S=0;S<f.length;S++){var P=f[S];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(L,P.key,P)}}function N(L,f,S){return f&&H(L.prototype,f),S&&H(L,S),L}var x;(function(L){L.No="",L.Yes="YES",L.v2="v2"})(x||(x={}));function U(L,f){var S=L.canSkipUntil,P=L.canSkipDateRanges,T=L.endSN,p=f!==void 0?f-T:0;return S&&p<S?P?x.v2:x.Yes:x.No}var I=function(){function L(S,P,T){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=S,this.part=P,this.skip=T}var f=L.prototype;return f.addDirectives=function(P){var T=new self.URL(P);return this.msn!==void 0&&T.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&T.searchParams.set("_HLS_part",this.part.toString()),this.skip&&T.searchParams.set("_HLS_skip",this.skip),T.toString()},L}(),E=function(){function L(f){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=[f.url],this.attrs=f.attrs,this.bitrate=f.bitrate,f.details&&(this.details=f.details),this.id=f.id||0,this.name=f.name,this.width=f.width||0,this.height=f.height||0,this.audioCodec=f.audioCodec,this.videoCodec=f.videoCodec,this.unknownCodecs=f.unknownCodecs,this.codecSet=[f.videoCodec,f.audioCodec].filter(function(S){return S}).join(",").replace(/\.[^.,]+/g,"")}return N(L,[{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(S){var P=S%this.url.length;this._urlId!==P&&(this.details=void 0,this._urlId=P)}}]),L}()},"./src/types/loader.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"PlaylistContextType",function(){return H}),R.d(K,"PlaylistLevelType",function(){return N});var H;(function(x){x.MANIFEST="manifest",x.LEVEL="level",x.AUDIO_TRACK="audioTrack",x.SUBTITLE_TRACK="subtitleTrack"})(H||(H={}));var N;(function(x){x.MAIN="main",x.AUDIO="audio",x.SUBTITLE="subtitle"})(N||(N={}))},"./src/types/transmuxer.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"ChunkMetadata",function(){return H});var H=function(U,I,E,L,f,S){L===void 0&&(L=0),f===void 0&&(f=-1),S===void 0&&(S=!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=N(),this.buffering={audio:N(),video:N(),audiovideo:N()},this.level=U,this.sn=I,this.id=E,this.size=L,this.part=f,this.partial=S};function N(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"AttrList",function(){return x});var H=/^(\d+)x(\d+)$/,N=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,x=function(){function U(E){typeof E=="string"&&(E=U.parseAttrList(E));for(var L in E)E.hasOwnProperty(L)&&(this[L]=E[L])}var I=U.prototype;return I.decimalInteger=function(L){var f=parseInt(this[L],10);return f>Number.MAX_SAFE_INTEGER?Infinity:f},I.hexadecimalInteger=function(L){if(this[L]){var f=(this[L]||"0x").slice(2);f=(f.length&1?"0":"")+f;for(var S=new Uint8Array(f.length/2),P=0;P<f.length/2;P++)S[P]=parseInt(f.slice(P*2,P*2+2),16);return S}else return null},I.hexadecimalIntegerAsNumber=function(L){var f=parseInt(this[L],16);return f>Number.MAX_SAFE_INTEGER?Infinity:f},I.decimalFloatingPoint=function(L){return parseFloat(this[L])},I.optionalFloat=function(L,f){var S=this[L];return S?parseFloat(S):f},I.enumeratedString=function(L){return this[L]},I.bool=function(L){return this[L]==="YES"},I.decimalResolution=function(L){var f=H.exec(this[L]);return f===null?void 0:{width:parseInt(f[1],10),height:parseInt(f[2],10)}},U.parseAttrList=function(L){var f,S={},P='"';for(N.lastIndex=0;(f=N.exec(L))!==null;){var T=f[2];T.indexOf(P)===0&&T.lastIndexOf(P)===T.length-1&&(T=T.slice(1,-1)),S[f[1]]=T}return S},U}()},"./src/utils/binary-search.ts":function(J,K,R){"use strict";R.r(K);var H={search:function(x,U){for(var I=0,E=x.length-1,L=null,f=null;I<=E;){L=(I+E)/2|0,f=x[L];var S=U(f);if(S>0)I=L+1;else if(S<0)E=L-1;else return f}return null}};K.default=H},"./src/utils/buffer-helper.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"BufferHelper",function(){return x});var H=R("./src/utils/logger.ts"),N={length:0,start:function(){return 0},end:function(){return 0}},x=function(){function U(){}return U.isBuffered=function(E,L){try{if(E){for(var f=U.getBuffered(E),S=0;S<f.length;S++)if(L>=f.start(S)&&L<=f.end(S))return!0}}catch(P){}return!1},U.bufferInfo=function(E,L,f){try{if(E){var S=U.getBuffered(E),P=[],T;for(T=0;T<S.length;T++)P.push({start:S.start(T),end:S.end(T)});return this.bufferedInfo(P,L,f)}}catch(p){}return{len:0,start:L,end:L,nextStart:void 0}},U.bufferedInfo=function(E,L,f){L=Math.max(0,L),E.sort(function(y,D){var _=y.start-D.start;return _||D.end-y.end});var S=[];if(f)for(var P=0;P<E.length;P++){var T=S.length;if(T){var p=S[T-1].end;E[P].start-p<f?E[P].end>p&&(S[T-1].end=E[P].end):S.push(E[P])}else S.push(E[P])}else S=E;for(var m=0,i,a=L,u=L,c=0;c<S.length;c++){var O=S[c].start,b=S[c].end;if(L+f>=O&&L<b)a=O,u=b,m=u-L;else if(L+f<O){i=O;break}}return{len:m,start:a||0,end:u||0,nextStart:i}},U.getBuffered=function(E){try{return E.buffered}catch(L){return H.logger.log("failed to get media.buffered",L),N}},U}()},"./src/utils/cea-608-parser.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"Row",function(){return u}),R.d(K,"CaptionScreen",function(){return c});var H=R("./src/utils/logger.ts"),N={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},x=function(d){var o=d;return N.hasOwnProperty(d)&&(o=N[d]),String.fromCharCode(o)},U=15,I=100,E={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},L={17:2,18:4,21:6,22:8,23:10,19:13,20:15},f={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},S={25:2,26:4,29:6,30:8,31:10,27:13,28:15},P=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],T;(function(h){h[h.ERROR=0]="ERROR",h[h.TEXT=1]="TEXT",h[h.WARNING=2]="WARNING",h[h.INFO=2]="INFO",h[h.DEBUG=3]="DEBUG",h[h.DATA=3]="DATA"})(T||(T={}));var p=function(){function h(){this.time=null,this.verboseLevel=T.ERROR}var d=h.prototype;return d.log=function(s,w){this.verboseLevel>=s&&H.logger.log(this.time+" ["+s+"] "+w)},h}(),m=function(d){for(var o=[],s=0;s<d.length;s++)o.push(d[s].toString(16));return o},i=function(){function h(o,s,w,C,v){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=o||"white",this.underline=s||!1,this.italics=w||!1,this.background=C||"black",this.flash=v||!1}var d=h.prototype;return d.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},d.setStyles=function(s){for(var w=["foreground","underline","italics","background","flash"],C=0;C<w.length;C++){var v=w[C];s.hasOwnProperty(v)&&(this[v]=s[v])}},d.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},d.equals=function(s){return this.foreground===s.foreground&&this.underline===s.underline&&this.italics===s.italics&&this.background===s.background&&this.flash===s.flash},d.copy=function(s){this.foreground=s.foreground,this.underline=s.underline,this.italics=s.italics,this.background=s.background,this.flash=s.flash},d.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},h}(),a=function(){function h(o,s,w,C,v,M){this.uchar=void 0,this.penState=void 0,this.uchar=o||" ",this.penState=new i(s,w,C,v,M)}var d=h.prototype;return d.reset=function(){this.uchar=" ",this.penState.reset()},d.setChar=function(s,w){this.uchar=s,this.penState.copy(w)},d.setPenState=function(s){this.penState.copy(s)},d.equals=function(s){return this.uchar===s.uchar&&this.penState.equals(s.penState)},d.copy=function(s){this.uchar=s.uchar,this.penState.copy(s.penState)},d.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},h}(),u=function(){function h(o){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var s=0;s<I;s++)this.chars.push(new a);this.logger=o,this.pos=0,this.currPenState=new i}var d=h.prototype;return d.equals=function(s){for(var w=!0,C=0;C<I;C++)if(!this.chars[C].equals(s.chars[C])){w=!1;break}return w},d.copy=function(s){for(var w=0;w<I;w++)this.chars[w].copy(s.chars[w])},d.isEmpty=function(){for(var s=!0,w=0;w<I;w++)if(!this.chars[w].isEmpty()){s=!1;break}return s},d.setCursor=function(s){this.pos!==s&&(this.pos=s),this.pos<0?(this.logger.log(T.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>I&&(this.logger.log(T.DEBUG,"Too large cursor position "+this.pos),this.pos=I)},d.moveCursor=function(s){var w=this.pos+s;if(s>1)for(var C=this.pos+1;C<w+1;C++)this.chars[C].setPenState(this.currPenState);this.setCursor(w)},d.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},d.insertChar=function(s){s>=144&&this.backSpace();var w=x(s);if(this.pos>=I){this.logger.log(T.ERROR,"Cannot insert "+s.toString(16)+" ("+w+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(w,this.currPenState),this.moveCursor(1)},d.clearFromPos=function(s){var w;for(w=s;w<I;w++)this.chars[w].reset()},d.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},d.clearToEndOfRow=function(){this.clearFromPos(this.pos)},d.getTextString=function(){for(var s=[],w=!0,C=0;C<I;C++){var v=this.chars[C].uchar;v!==" "&&(w=!1),s.push(v)}return w?"":s.join("")},d.setPenStyles=function(s){this.currPenState.setStyles(s);var w=this.chars[this.pos];w.setPenState(this.currPenState)},h}(),c=function(){function h(o){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var s=0;s<U;s++)this.rows.push(new u(o));this.logger=o,this.currRow=U-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var d=h.prototype;return d.reset=function(){for(var s=0;s<U;s++)this.rows[s].clear();this.currRow=U-1},d.equals=function(s){for(var w=!0,C=0;C<U;C++)if(!this.rows[C].equals(s.rows[C])){w=!1;break}return w},d.copy=function(s){for(var w=0;w<U;w++)this.rows[w].copy(s.rows[w])},d.isEmpty=function(){for(var s=!0,w=0;w<U;w++)if(!this.rows[w].isEmpty()){s=!1;break}return s},d.backSpace=function(){var s=this.rows[this.currRow];s.backSpace()},d.clearToEndOfRow=function(){var s=this.rows[this.currRow];s.clearToEndOfRow()},d.insertChar=function(s){var w=this.rows[this.currRow];w.insertChar(s)},d.setPen=function(s){var w=this.rows[this.currRow];w.setPenStyles(s)},d.moveCursor=function(s){var w=this.rows[this.currRow];w.moveCursor(s)},d.setCursor=function(s){this.logger.log(T.INFO,"setCursor: "+s);var w=this.rows[this.currRow];w.setCursor(s)},d.setPAC=function(s){this.logger.log(T.INFO,"pacData = "+JSON.stringify(s));var w=s.row-1;if(this.nrRollUpRows&&w<this.nrRollUpRows-1&&(w=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==w){for(var C=0;C<U;C++)this.rows[C].clear();var v=this.currRow+1-this.nrRollUpRows,M=this.lastOutputScreen;if(M){var B=M.rows[v].cueStartTime,F=this.logger.time;if(B&&F!==null&&B<F)for(var Q=0;Q<this.nrRollUpRows;Q++)this.rows[w-this.nrRollUpRows+Q+1].copy(M.rows[v+Q])}}this.currRow=w;var G=this.rows[this.currRow];if(s.indent!==null){var W=s.indent,$=Math.max(W-1,0);G.setCursor(s.indent),s.color=G.chars[$].penState.foreground}var re={foreground:s.color,underline:s.underline,italics:s.italics,background:"black",flash:!1};this.setPen(re)},d.setBkgData=function(s){this.logger.log(T.INFO,"bkgData = "+JSON.stringify(s)),this.backSpace(),this.setPen(s),this.insertChar(32)},d.setRollUpRows=function(s){this.nrRollUpRows=s},d.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(T.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(T.TEXT,this.getDisplayText());var s=this.currRow+1-this.nrRollUpRows,w=this.rows.splice(s,1)[0];w.clear(),this.rows.splice(this.currRow,0,w),this.logger.log(T.INFO,"Rolling up")},d.getDisplayText=function(s){s=s||!1;for(var w=[],C="",v=-1,M=0;M<U;M++){var B=this.rows[M].getTextString();B&&(v=M+1,s?w.push("Row "+v+": '"+B+"'"):w.push(B.trim()))}return w.length>0&&(s?C="["+w.join(" | ")+"]":C=w.join(`
|
|
`)),C},d.getTextAndFormat=function(){return this.rows},h}(),O=function(){function h(o,s,w){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=o,this.outputFilter=s,this.mode=null,this.verbose=0,this.displayedMemory=new c(w),this.nonDisplayedMemory=new c(w),this.lastOutputScreen=new c(w),this.currRollUpRow=this.displayedMemory.rows[U-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=w}var d=h.prototype;return d.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[U-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},d.getHandler=function(){return this.outputFilter},d.setHandler=function(s){this.outputFilter=s},d.setPAC=function(s){this.writeScreen.setPAC(s)},d.setBkgData=function(s){this.writeScreen.setBkgData(s)},d.setMode=function(s){if(s===this.mode)return;this.mode=s,this.logger.log(T.INFO,"MODE="+s),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=s},d.insertChars=function(s){for(var w=0;w<s.length;w++)this.writeScreen.insertChar(s[w]);var C=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(T.INFO,C+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(T.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},d.ccRCL=function(){this.logger.log(T.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},d.ccBS=function(){if(this.logger.log(T.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},d.ccAOF=function(){},d.ccAON=function(){},d.ccDER=function(){this.logger.log(T.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},d.ccRU=function(s){this.logger.log(T.INFO,"RU("+s+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(s)},d.ccFON=function(){this.logger.log(T.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},d.ccRDC=function(){this.logger.log(T.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},d.ccTR=function(){this.logger.log(T.INFO,"TR"),this.setMode("MODE_TEXT")},d.ccRTD=function(){this.logger.log(T.INFO,"RTD"),this.setMode("MODE_TEXT")},d.ccEDM=function(){this.logger.log(T.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},d.ccCR=function(){this.logger.log(T.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},d.ccENM=function(){this.logger.log(T.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},d.ccEOC=function(){if(this.logger.log(T.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var s=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=s,this.writeScreen=this.nonDisplayedMemory,this.logger.log(T.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},d.ccTO=function(s){this.logger.log(T.INFO,"TO("+s+") - Tab Offset"),this.writeScreen.moveCursor(s)},d.ccMIDROW=function(s){var w={flash:!1};if(w.underline=s%2===1,w.italics=s>=46,w.italics)w.foreground="white";else{var C=Math.floor(s/2)-16,v=["white","green","blue","cyan","red","yellow","magenta"];w.foreground=v[C]}this.logger.log(T.INFO,"MIDROW: "+JSON.stringify(w)),this.writeScreen.setPen(w)},d.outputDataUpdate=function(s){s===void 0&&(s=!1);var w=this.logger.time;if(w===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=w:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,w,this.lastOutputScreen),s&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:w),this.lastOutputScreen.copy(this.displayedMemory))},d.cueSplitAtTime=function(s){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,s,this.displayedMemory),this.cueStartTime=s))},h}(),b=function(){function h(o,s,w){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var C=new p;this.channels=[null,new O(o,s,C),new O(o+1,w,C)],this.cmdHistory=_(),this.logger=C}var d=h.prototype;return d.getHandler=function(s){return this.channels[s].getHandler()},d.setHandler=function(s,w){this.channels[s].setHandler(w)},d.addData=function(s,w){var C,v,M,B=!1;this.logger.time=s;for(var F=0;F<w.length;F+=2){if(v=w[F]&127,M=w[F+1]&127,v===0&&M===0)continue;if(this.logger.log(T.DATA,"["+m([w[F],w[F+1]])+"] -> ("+m([v,M])+")"),C=this.parseCmd(v,M),C||(C=this.parseMidrow(v,M)),C||(C=this.parsePAC(v,M)),C||(C=this.parseBackgroundAttributes(v,M)),!C&&(B=this.parseChars(v,M),B)){var Q=this.currentChannel;if(Q&&Q>0){var G=this.channels[Q];G.insertChars(B)}else this.logger.log(T.WARNING,"No channel found yet. TEXT-MODE?")}!C&&!B&&this.logger.log(T.WARNING,"Couldn't parse cleaned data "+m([v,M])+" orig: "+m([w[F],w[F+1]]))}},d.parseCmd=function(s,w){var C=this.cmdHistory,v=(s===20||s===28||s===21||s===29)&&w>=32&&w<=47,M=(s===23||s===31)&&w>=33&&w<=35;if(!(v||M))return!1;if(D(s,w,C))return y(null,null,C),this.logger.log(T.DEBUG,"Repeated command ("+m([s,w])+") is dropped"),!0;var B=s===20||s===21||s===23?1:2,F=this.channels[B];return s===20||s===21||s===28||s===29?w===32?F.ccRCL():w===33?F.ccBS():w===34?F.ccAOF():w===35?F.ccAON():w===36?F.ccDER():w===37?F.ccRU(2):w===38?F.ccRU(3):w===39?F.ccRU(4):w===40?F.ccFON():w===41?F.ccRDC():w===42?F.ccTR():w===43?F.ccRTD():w===44?F.ccEDM():w===45?F.ccCR():w===46?F.ccENM():w===47&&F.ccEOC():F.ccTO(w-32),y(s,w,C),this.currentChannel=B,!0},d.parseMidrow=function(s,w){var C=0;if((s===17||s===25)&&w>=32&&w<=47){if(s===17?C=1:C=2,C!==this.currentChannel)return this.logger.log(T.ERROR,"Mismatch channel in midrow parsing"),!1;var v=this.channels[C];return v?(v.ccMIDROW(w),this.logger.log(T.DEBUG,"MIDROW ("+m([s,w])+")"),!0):!1}return!1},d.parsePAC=function(s,w){var C,v=this.cmdHistory,M=(s>=17&&s<=23||s>=25&&s<=31)&&w>=64&&w<=127,B=(s===16||s===24)&&w>=64&&w<=95;if(!(M||B))return!1;if(D(s,w,v))return y(null,null,v),!0;var F=s<=23?1:2;w>=64&&w<=95?C=F===1?E[s]:f[s]:C=F===1?L[s]:S[s];var Q=this.channels[F];return Q?(Q.setPAC(this.interpretPAC(C,w)),y(s,w,v),this.currentChannel=F,!0):!1},d.interpretPAC=function(s,w){var C,v={color:null,italics:!1,indent:null,underline:!1,row:s};return w>95?C=w-96:C=w-64,v.underline=(C&1)===1,C<=13?v.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(C/2)]:C<=15?(v.italics=!0,v.color="white"):v.indent=Math.floor((C-16)/2)*4,v},d.parseChars=function(s,w){var C,v=null,M=null;if(s>=25?(C=2,M=s-8):(C=1,M=s),M>=17&&M<=19){var B;M===17?B=w+80:M===18?B=w+112:B=w+144,this.logger.log(T.INFO,"Special char '"+x(B)+"' in channel "+C),v=[B]}else s>=32&&s<=127&&(v=w===0?[s]:[s,w]);if(v){var F=m(v);this.logger.log(T.DEBUG,"Char codes = "+F.join(",")),y(s,w,this.cmdHistory)}return v},d.parseBackgroundAttributes=function(s,w){var C=(s===16||s===24)&&w>=32&&w<=47,v=(s===23||s===31)&&w>=45&&w<=47;if(!(C||v))return!1;var M,B={};s===16||s===24?(M=Math.floor((w-32)/2),B.background=P[M],w%2===1&&(B.background=B.background+"_semi")):w===45?B.background="transparent":(B.foreground="black",w===47&&(B.underline=!0));var F=s<=23?1:2,Q=this.channels[F];return Q.setBkgData(B),y(s,w,this.cmdHistory),!0},d.reset=function(){for(var s=0;s<Object.keys(this.channels).length;s++){var w=this.channels[s];w&&w.reset()}this.cmdHistory=_()},d.cueSplitAtTime=function(s){for(var w=0;w<this.channels.length;w++){var C=this.channels[w];C&&C.cueSplitAtTime(s)}},h}();function y(h,d,o){o.a=h,o.b=d}function D(h,d,o){return o.a===h&&o.b===d}function _(){return{a:null,b:null}}K.default=b},"./src/utils/codecs.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"isCodecType",function(){return N}),R.d(K,"isCodecSupportedInMp4",function(){return x});var H={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 N(U,I){var E=H[I];return!!E&&E[U.slice(0,4)]===!0}function x(U,I){return MediaSource.isTypeSupported((I||"video")+'/mp4;codecs="'+U+'"')}},"./src/utils/cues.ts":function(J,K,R){"use strict";R.r(K);var H=R("./src/utils/vttparser.ts"),N=R("./src/utils/webvtt-parser.ts"),x=R("./src/utils/texttrack-utils.ts"),U=/\s/,I={newCue:function(L,f,S,P){for(var T=[],p,m,i,a,u,c=self.VTTCue||self.TextTrackCue,O=0;O<P.rows.length;O++)if(p=P.rows[O],i=!0,a=0,u="",!p.isEmpty()){for(var b=0;b<p.chars.length;b++)U.test(p.chars[b].uchar)&&i?a++:(u+=p.chars[b].uchar,i=!1);p.cueStartTime=f,f===S&&(S+=1e-4),a>=16?a--:a++;var y=Object(H.fixLineBreaks)(u.trim()),D=Object(N.generateCueId)(f,S,y);(!L||!L.cues||!L.cues.getCueById(D))&&(m=new c(f,S,y),m.id=D,m.line=O+1,m.align="left",m.position=10+Math.min(80,Math.floor(a*8/32)*10),T.push(m))}return L&&T.length&&(T.sort(function(_,h){return _.line==="auto"||h.line==="auto"?0:_.line>8&&h.line>8?h.line-_.line:_.line-h.line}),T.forEach(function(_){return Object(x.addCueToTrack)(L,_)})),T}};K.default=I},"./src/utils/discontinuities.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"findFirstFragWithCC",function(){return U}),R.d(K,"shouldAlignOnDiscontinuities",function(){return I}),R.d(K,"findDiscontinuousReferenceFrag",function(){return E}),R.d(K,"adjustSlidingStart",function(){return f}),R.d(K,"alignStream",function(){return S}),R.d(K,"alignPDT",function(){return T}),R.d(K,"alignFragmentByPDTDelta",function(){return p}),R.d(K,"alignMediaPlaylistByPDT",function(){return m});var H=R("./src/polyfills/number.ts"),N=R("./src/utils/logger.ts"),x=R("./src/controller/level-helper.ts");function U(i,a){for(var u=null,c=0,O=i.length;c<O;c++){var b=i[c];if(b&&b.cc===a){u=b;break}}return u}function I(i,a,u){return!!(a.details&&(u.endCC>u.startCC||i&&i.cc<u.startCC))}function E(i,a){var u=i.fragments,c=a.fragments;if(!c.length||!u.length){N.logger.log("No fragments to align");return}var O=U(u,c[0].cc);if(!O||O&&!O.startPTS){N.logger.log("No frag in previous level to align on");return}return O}function L(i,a){if(i){var u=i.start+a;i.start=i.startPTS=u,i.endPTS=u+i.duration}}function f(i,a){for(var u=a.fragments,c=0,O=u.length;c<O;c++)L(u[c],i);a.fragmentHint&&L(a.fragmentHint,i),a.alignedSliding=!0}function S(i,a,u){if(!a)return;P(i,u,a),!u.alignedSliding&&a.details&&T(u,a.details),!u.alignedSliding&&a.details&&!u.skippedSegments&&Object(x.adjustSliding)(a.details,u)}function P(i,a,u){if(I(i,u,a)){var c=E(u.details,a);c&&Object(H.isFiniteNumber)(c.start)&&(N.logger.log("Adjusting PTS using last level due to CC increase within current level "+a.url),f(c.start,a))}}function T(i,a){if(!a.fragments.length||!i.hasProgramDateTime||!a.hasProgramDateTime)return;var u=a.fragments[0].programDateTime,c=i.fragments[0].programDateTime,O=(c-u)/1e3+a.fragments[0].start;O&&Object(H.isFiniteNumber)(O)&&(N.logger.log("Adjusting PTS using programDateTime delta "+(c-u)+"ms, sliding:"+O.toFixed(3)+" "+i.url+" "),f(O,i))}function p(i,a){var u=i.programDateTime;if(!u)return;var c=(u-a)/1e3;i.start=i.startPTS=c,i.endPTS=c+i.duration}function m(i,a){if(!a.fragments.length||!i.hasProgramDateTime||!a.hasProgramDateTime)return;var u=a.fragments[0].programDateTime,c=a.fragments[0].start,O=u-c*1e3;i.fragments.forEach(function(b){p(b,O)}),i.fragmentHint&&p(i.fragmentHint,O),i.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(J,K,R){"use strict";R.r(K);var H=R("./src/utils/ewma.ts"),N=function(){function x(I,E,L){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=L,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new H.default(I),this.fast_=new H.default(E)}var U=x.prototype;return U.update=function(E,L){var f=this.slow_,S=this.fast_;this.slow_.halfLife!==E&&(this.slow_=new H.default(E,f.getEstimate(),f.getTotalWeight())),this.fast_.halfLife!==L&&(this.fast_=new H.default(L,S.getEstimate(),S.getTotalWeight()))},U.sample=function(E,L){E=Math.max(E,this.minDelayMs_);var f=8*L,S=E/1e3,P=f/S;this.fast_.sample(S,P),this.slow_.sample(S,P)},U.canEstimate=function(){var E=this.fast_;return E&&E.getTotalWeight()>=this.minWeight_},U.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},U.destroy=function(){},x}();K.default=N},"./src/utils/ewma.ts":function(J,K,R){"use strict";R.r(K);var H=function(){function N(U,I,E){I===void 0&&(I=0),E===void 0&&(E=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=U,this.alpha_=U?Math.exp(Math.log(.5)/U):0,this.estimate_=I,this.totalWeight_=E}var x=N.prototype;return x.sample=function(I,E){var L=Math.pow(this.alpha_,I);this.estimate_=E*(1-L)+L*this.estimate_,this.totalWeight_+=I},x.getTotalWeight=function(){return this.totalWeight_},x.getEstimate=function(){if(this.alpha_){var I=1-Math.pow(this.alpha_,this.totalWeight_);if(I)return this.estimate_/I}return this.estimate_},N}();K.default=H},"./src/utils/fetch-loader.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"fetchSupported",function(){return p});var H=R("./src/polyfills/number.ts"),N=R("./src/loader/load-stats.ts"),x=R("./src/demux/chunk-cache.ts");function U(c,O){c.prototype=Object.create(O.prototype),c.prototype.constructor=c,S(c,O)}function I(c){var O=typeof Map=="function"?new Map:void 0;return I=function(y){if(y===null||!f(y))return y;if(typeof y!="function")throw new TypeError("Super expression must either be null or a function");if(typeof O!="undefined"){if(O.has(y))return O.get(y);O.set(y,D)}function D(){return E(y,arguments,P(this).constructor)}return D.prototype=Object.create(y.prototype,{constructor:{value:D,enumerable:!1,writable:!0,configurable:!0}}),S(D,y)},I(c)}function E(c,O,b){return L()?E=Reflect.construct:E=function(D,_,h){var d=[null];d.push.apply(d,_);var o=Function.bind.apply(D,d),s=new o;return h&&S(s,h.prototype),s},E.apply(null,arguments)}function L(){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(c){return!1}}function f(c){return Function.toString.call(c).indexOf("[native code]")!==-1}function S(c,O){return S=Object.setPrototypeOf||function(y,D){return y.__proto__=D,y},S(c,O)}function P(c){return P=Object.setPrototypeOf?Object.getPrototypeOf:function(b){return b.__proto__||Object.getPrototypeOf(b)},P(c)}function T(){return T=Object.assign||function(c){for(var O=1;O<arguments.length;O++){var b=arguments[O];for(var y in b)Object.prototype.hasOwnProperty.call(b,y)&&(c[y]=b[y])}return c},T.apply(this,arguments)}function p(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(c){}return!1}var m=function(){function c(b){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=b.fetchSetup||a,this.controller=new self.AbortController,this.stats=new N.LoadStats}var O=c.prototype;return O.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},O.abortInternal=function(){var y=this.response;(!y||!y.ok)&&(this.stats.aborted=!0,this.controller.abort())},O.abort=function(){var y;this.abortInternal(),(y=this.callbacks)!==null&&y!==void 0&&y.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},O.load=function(y,D,_){var h=this,d=this.stats;if(d.loading.start)throw new Error("Loader can only be used once.");d.loading.start=self.performance.now();var o=i(y,this.controller.signal),s=_.onProgress,w=y.responseType==="arraybuffer",C=w?"byteLength":"length";this.context=y,this.config=D,this.callbacks=_,this.request=this.fetchSetup(y,o),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){h.abortInternal(),_.onTimeout(d,y,h.response)},D.timeout),self.fetch(this.request).then(function(v){if(h.response=h.loader=v,!v.ok){var M=v.status,B=v.statusText;throw new u(B||"fetch, bad network response",M,v)}return d.loading.first=Math.max(self.performance.now(),d.loading.start),d.total=parseInt(v.headers.get("Content-Length")||"0"),s&&Object(H.isFiniteNumber)(D.highWaterMark)?h.loadProgressively(v,d,y,D.highWaterMark,s):w?v.arrayBuffer():v.text()}).then(function(v){var M=h.response;self.clearTimeout(h.requestTimeout),d.loading.end=Math.max(self.performance.now(),d.loading.first),d.loaded=d.total=v[C];var B={url:M.url,data:v};s&&!Object(H.isFiniteNumber)(D.highWaterMark)&&s(d,y,v,M),_.onSuccess(B,d,y,M)}).catch(function(v){if(self.clearTimeout(h.requestTimeout),d.aborted)return;var M=v.code||0;_.onError({code:M,text:v.message},y,v.details)})},O.getCacheAge=function(){var y=null;if(this.response){var D=this.response.headers.get("age");y=D?parseFloat(D):null}return y},O.loadProgressively=function(y,D,_,h,d){h===void 0&&(h=0);var o=new x.default,s=y.body.getReader(),w=function C(){return s.read().then(function(v){if(v.done)return o.dataLength&&d(D,_,o.flush(),y),Promise.resolve(new ArrayBuffer(0));var M=v.value,B=M.length;return D.loaded+=B,B<h||o.dataLength?(o.push(M),o.dataLength>=h&&d(D,_,o.flush(),y)):d(D,_,M,y),C()}).catch(function(){return Promise.reject()})};return w()},c}();function i(c,O){var b={method:"GET",mode:"cors",credentials:"same-origin",signal:O,headers:new self.Headers(T({},c.headers))};return c.rangeEnd&&b.headers.set("Range","bytes="+c.rangeStart+"-"+String(c.rangeEnd-1)),b}function a(c,O){return new self.Request(c.url,O)}var u=function(c){U(O,c);function O(b,y,D){var _;return _=c.call(this,b)||this,_.code=void 0,_.details=void 0,_.code=y,_.details=D,_}return O}(I(Error));K.default=m},"./src/utils/imsc1-ttml-parser.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"IMSC1_CODEC",function(){return f}),R.d(K,"parseIMSC1",function(){return p});var H=R("./src/utils/mp4-tools.ts"),N=R("./src/utils/vttparser.ts"),x=R("./src/utils/vttcue.ts"),U=R("./src/demux/id3.ts"),I=R("./src/utils/timescale-conversion.ts"),E=R("./src/utils/webvtt-parser.ts");function L(){return L=Object.assign||function(h){for(var d=1;d<arguments.length;d++){var o=arguments[d];for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(h[s]=o[s])}return h},L.apply(this,arguments)}var f="stpp.ttml.im1t",S=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,P=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,T={left:"start",center:"center",right:"end",start:"start",end:"end"};function p(h,d,o,s,w){var C=Object(H.findBox)(new Uint8Array(h),["mdat"]);if(C.length===0){w(new Error("Could not parse IMSC1 mdat"));return}var v=C[0],M=Object(U.utf8ArrayToStr)(new Uint8Array(h,v.start,v.end-v.start)),B=Object(I.toTimescaleFromScale)(d,1,o);try{s(m(M,B))}catch(F){w(F)}}function m(h,d){var o=new DOMParser,s=o.parseFromString(h,"text/xml"),w=s.getElementsByTagName("tt")[0];if(!w)throw new Error("Invalid ttml");var C={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},v=Object.keys(C).reduce(function(G,W){return G[W]=w.getAttribute("ttp:"+W)||C[W],G},{}),M=w.getAttribute("xml:space")!=="preserve",B=a(i(w,"styling","style")),F=a(i(w,"layout","region")),Q=i(w,"body","[begin]");return[].map.call(Q,function(G){var W=u(G,M);if(!W||!G.hasAttribute("begin"))return null;var $=y(G.getAttribute("begin"),v),re=y(G.getAttribute("dur"),v),ae=y(G.getAttribute("end"),v);if($===null)throw b(G);if(ae===null){if(re===null)throw b(G);ae=$+re}var he=new x.default($-d,ae-d,W);he.id=Object(E.generateCueId)(he.startTime,he.endTime,he.text);var Te=F[G.getAttribute("region")],ye=B[G.getAttribute("style")];he.position=10,he.size=80;var Ee=c(Te,ye),Oe=Ee.textAlign;if(Oe){var _e=T[Oe];_e&&(he.lineAlign=_e),he.align=Oe}return L(he,Ee),he}).filter(function(G){return G!==null})}function i(h,d,o){var s=h.getElementsByTagName(d)[0];return s?[].slice.call(s.querySelectorAll(o)):[]}function a(h){return h.reduce(function(d,o){var s=o.getAttribute("xml:id");return s&&(d[s]=o),d},{})}function u(h,d){return[].slice.call(h.childNodes).reduce(function(o,s,w){var C;return s.nodeName==="br"&&w?o+`
|
|
`:(C=s.childNodes)!==null&&C!==void 0&&C.length?u(s,d):d?o+s.textContent.trim().replace(/\s+/g," "):o+s.textContent},"")}function c(h,d){var o="http://www.w3.org/ns/ttml#styling",s=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return s.reduce(function(w,C){var v=O(d,o,C)||O(h,o,C);return v&&(w[C]=v),w},{})}function O(h,d,o){return h.hasAttributeNS(d,o)?h.getAttributeNS(d,o):null}function b(h){return new Error("Could not parse ttml timestamp "+h)}function y(h,d){if(!h)return null;var o=Object(N.parseTimeStamp)(h);return o===null&&(S.test(h)?o=D(h,d):P.test(h)&&(o=_(h,d))),o}function D(h,d){var o=S.exec(h),s=(o[4]|0)+(o[5]|0)/d.subFrameRate;return(o[1]|0)*3600+(o[2]|0)*60+(o[3]|0)+s/d.frameRate}function _(h,d){var o=P.exec(h),s=Number(o[1]),w=o[2];switch(w){case"h":return s*3600;case"m":return s*60;case"ms":return s*1e3;case"f":return s/d.frameRate;case"t":return s/d.tickRate}return s}},"./src/utils/logger.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"enableLogs",function(){return E}),R.d(K,"logger",function(){return L});var H=function(){},N={trace:H,debug:H,log:H,warn:H,info:H,error:H},x=N;function U(f){var S=self.console[f];return S?S.bind(self.console,"["+f+"] >"):H}function I(f){for(var S=arguments.length,P=new Array(S>1?S-1:0),T=1;T<S;T++)P[T-1]=arguments[T];P.forEach(function(p){x[p]=f[p]?f[p].bind(f):U(p)})}function E(f){if(self.console&&f===!0||typeof f=="object"){I(f,"debug","log","info","warn","error");try{x.log()}catch(S){x=N}}else x=N}var L=x},"./src/utils/mediakeys-helper.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"KeySystems",function(){return H}),R.d(K,"requestMediaKeySystemAccess",function(){return N});var H;(function(x){x.WIDEVINE="com.widevine.alpha",x.PLAYREADY="com.microsoft.playready"})(H||(H={}));var N=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"getMediaSource",function(){return H});function H(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"bin2str",function(){return I}),R.d(K,"readUint16",function(){return E}),R.d(K,"readUint32",function(){return L}),R.d(K,"writeUint32",function(){return f}),R.d(K,"findBox",function(){return S}),R.d(K,"parseSegmentIndex",function(){return P}),R.d(K,"parseInitSegment",function(){return T}),R.d(K,"getStartDTS",function(){return p}),R.d(K,"getDuration",function(){return m}),R.d(K,"computeRawDurationFromSamples",function(){return i}),R.d(K,"offsetStartDTS",function(){return a}),R.d(K,"segmentValidRange",function(){return u}),R.d(K,"appendUint8Array",function(){return c});var H=R("./src/utils/typed-array.ts"),N=R("./src/loader/fragment.ts"),x=Math.pow(2,32)-1,U=[].push;function I(O){return String.fromCharCode.apply(null,O)}function E(O,b){"data"in O&&(b+=O.start,O=O.data);var y=O[b]<<8|O[b+1];return y<0?65536+y:y}function L(O,b){"data"in O&&(b+=O.start,O=O.data);var y=O[b]<<24|O[b+1]<<16|O[b+2]<<8|O[b+3];return y<0?4294967296+y:y}function f(O,b,y){"data"in O&&(b+=O.start,O=O.data),O[b]=y>>24,O[b+1]=y>>16&255,O[b+2]=y>>8&255,O[b+3]=y&255}function S(O,b){var y=[];if(!b.length)return y;var D,_,h;"data"in O?(D=O.data,_=O.start,h=O.end):(D=O,_=0,h=D.byteLength);for(var d=_;d<h;){var o=L(D,d),s=I(D.subarray(d+4,d+8)),w=o>1?d+o:h;if(s===b[0])if(b.length===1)y.push({data:D,start:d+8,end:w});else{var C=S({data:D,start:d+8,end:w},b.slice(1));C.length&&U.apply(y,C)}d=w}return y}function P(O){var b=S(O,["moov"]),y=b[0],D=y?y.end:null,_=S(O,["sidx"]);if(!_||!_[0])return null;var h=[],d=_[0],o=d.data[0],s=o===0?8:16,w=L(d,s);s+=4;var C=0,v=0;o===0?s+=8:s+=16,s+=2;var M=d.end+v,B=E(d,s);s+=2;for(var F=0;F<B;F++){var Q=s,G=L(d,Q);Q+=4;var W=G&2147483647,$=(G&2147483648)>>>31;if($===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var re=L(d,Q);Q+=4,h.push({referenceSize:W,subsegmentDuration:re,info:{duration:re/w,start:M,end:M+W-1}}),M+=W,Q+=4,s=Q}return{earliestPresentationTime:C,timescale:w,version:o,referencesCount:B,references:h,moovEndOffset:D}}function T(O){for(var b=[],y=S(O,["moov","trak"]),D=0;D<y.length;D++){var _=y[D],h=S(_,["tkhd"])[0];if(h){var d=h.data[h.start],o=d===0?12:20,s=L(h,o),w=S(_,["mdia","mdhd"])[0];if(w){d=w.data[w.start],o=d===0?12:20;var C=L(w,o),v=S(_,["mdia","hdlr"])[0];if(v){var M=I(v.data.subarray(v.start+8,v.start+12)),B={soun:N.ElementaryStreamTypes.AUDIO,vide:N.ElementaryStreamTypes.VIDEO}[M];if(B){var F=S(_,["mdia","minf","stbl","stsd"])[0],Q=void 0;F&&(Q=I(F.data.subarray(F.start+12,F.start+16))),b[s]={timescale:C,type:B},b[B]={timescale:C,id:s,codec:Q}}}}}}var G=S(O,["moov","mvex","trex"]);return G.forEach(function(W){var $=L(W,4),re=b[$];re&&(re.default={duration:L(W,12),flags:L(W,20)})}),b}function p(O,b){return S(b,["moof","traf"]).reduce(function(y,D){var _=S(D,["tfdt"])[0],h=_.data[_.start],d=S(D,["tfhd"]).reduce(function(o,s){var w=L(s,4),C=O[w];if(C){var v=L(_,4);h===1&&(v*=Math.pow(2,32),v+=L(_,8));var M=C.timescale||9e4,B=v/M;if(isFinite(B)&&(o===null||B<o))return B}return o},null);return d!==null&&isFinite(d)&&(y===null||d<y)?d:y},null)||0}function m(O,b){for(var y=0,D=0,_=0,h=S(O,["moof","traf"]),d=0;d<h.length;d++){var o=h[d],s=S(o,["tfhd"])[0],w=L(s,4),C=b[w];if(!C)continue;var v=C.default,M=L(s,0)|(v==null?void 0:v.flags),B=v==null?void 0:v.duration;M&8&&(M&2?B=L(s,12):B=L(s,8));for(var F=C.timescale||9e4,Q=S(o,["trun"]),G=0;G<Q.length;G++){if(B){var W=L(Q[G],4);y=B*W}else y=i(Q[G]);C.type===N.ElementaryStreamTypes.VIDEO?D+=y/F:C.type===N.ElementaryStreamTypes.AUDIO&&(_+=y/F)}}if(D===0&&_===0){var $=P(O);if($!=null&&$.references)return $.references.reduce(function(re,ae){return re+ae.info.duration||0},0)}return D||_}function i(O){var b=L(O,0),y=8;b&1&&(y+=4),b&4&&(y+=4);for(var D=0,_=L(O,4),h=0;h<_;h++){if(b&256){var d=L(O,y);D+=d,y+=4}b&512&&(y+=4),b&1024&&(y+=4),b&2048&&(y+=4)}return D}function a(O,b,y){S(b,["moof","traf"]).forEach(function(D){S(D,["tfhd"]).forEach(function(_){var h=L(_,4),d=O[h];if(!d)return;var o=d.timescale||9e4;S(D,["tfdt"]).forEach(function(s){var w=s.data[s.start],C=L(s,4);if(w===0)f(s,4,C-y*o);else{C*=Math.pow(2,32),C+=L(s,8),C-=y*o,C=Math.max(C,0);var v=Math.floor(C/(x+1)),M=Math.floor(C%(x+1));f(s,4,v),f(s,8,M)}})})})}function u(O){var b={valid:null,remainder:null},y=S(O,["moof"]);if(y){if(y.length<2)return b.remainder=O,b}else return b;var D=y[y.length-1];return b.valid=Object(H.sliceUint8)(O,0,D.start-8),b.remainder=Object(H.sliceUint8)(O,D.start-8),b}function c(O,b){var y=new Uint8Array(O.length+b.length);return y.set(O),y.set(b,O.length),y}},"./src/utils/output-filter.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return H});var H=function(){function N(U,I){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=U,this.trackName=I}var x=N.prototype;return x.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},x.newCue=function(I,E,L){(this.startTime===null||this.startTime>I)&&(this.startTime=I),this.endTime=E,this.screen=L,this.timelineController.createCaptionsTrack(this.trackName)},x.reset=function(){this.cueRanges=[]},N}()},"./src/utils/texttrack-utils.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"sendAddTrackEvent",function(){return N}),R.d(K,"addCueToTrack",function(){return x}),R.d(K,"clearCurrentCues",function(){return U}),R.d(K,"removeCuesInRange",function(){return I}),R.d(K,"getCuesInRange",function(){return L});var H=R("./src/utils/logger.ts");function N(f,S){var P;try{P=new Event("addtrack")}catch(T){P=document.createEvent("Event"),P.initEvent("addtrack",!1,!1)}P.track=f,S.dispatchEvent(P)}function x(f,S){var P=f.mode;if(P==="disabled"&&(f.mode="hidden"),f.cues&&!f.cues.getCueById(S.id))try{if(f.addCue(S),!f.cues.getCueById(S.id))throw new Error("addCue is failed for: "+S)}catch(p){H.logger.debug("[texttrack-utils]: "+p);var T=new self.TextTrackCue(S.startTime,S.endTime,S.text);T.id=S.id,f.addCue(T)}P==="disabled"&&(f.mode=P)}function U(f){var S=f.mode;if(S==="disabled"&&(f.mode="hidden"),f.cues)for(var P=f.cues.length;P--;)f.removeCue(f.cues[P]);S==="disabled"&&(f.mode=S)}function I(f,S,P){var T=f.mode;if(T==="disabled"&&(f.mode="hidden"),f.cues&&f.cues.length>0)for(var p=L(f.cues,S,P),m=0;m<p.length;m++)f.removeCue(p[m]);T==="disabled"&&(f.mode=T)}function E(f,S){if(S<f[0].startTime)return 0;var P=f.length-1;if(S>f[P].endTime)return-1;for(var T=0,p=P;T<=p;){var m=Math.floor((p+T)/2);if(S<f[m].startTime)p=m-1;else if(S>f[m].startTime&&T<P)T=m+1;else return m}return f[T].startTime-S<S-f[p].startTime?T:p}function L(f,S,P){var T=[],p=E(f,S);if(p>-1)for(var m=p,i=f.length;m<i;m++){var a=f[m];if(a.startTime>=S&&a.endTime<=P)T.push(a);else if(a.startTime>P)return T}return T}},"./src/utils/time-ranges.ts":function(J,K,R){"use strict";R.r(K);var H={toString:function(x){for(var U="",I=x.length,E=0;E<I;E++)U+="["+x.start(E).toFixed(3)+","+x.end(E).toFixed(3)+"]";return U}};K.default=H},"./src/utils/timescale-conversion.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"toTimescaleFromBase",function(){return N}),R.d(K,"toTimescaleFromScale",function(){return x}),R.d(K,"toMsFromMpegTsClock",function(){return U}),R.d(K,"toMpegTsClockFromTimescale",function(){return I});var H=9e4;function N(E,L,f,S){f===void 0&&(f=1),S===void 0&&(S=!1);var P=E*L*f;return S?Math.round(P):P}function x(E,L,f,S){return f===void 0&&(f=1),S===void 0&&(S=!1),N(E,L,1/f,S)}function U(E,L){return L===void 0&&(L=!1),N(E,1e3,1/H,L)}function I(E,L){return L===void 0&&(L=1),N(E,H,1/L)}},"./src/utils/typed-array.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"sliceUint8",function(){return H});function H(N,x,U){return Uint8Array.prototype.slice?N.slice(x,U):new Uint8Array(Array.prototype.slice.call(N,x,U))}},"./src/utils/vttcue.ts":function(J,K,R){"use strict";R.r(K),K.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var H=["","lr","rl"],N=["start","middle","end","left","right"];function x(f,S){if(typeof S!="string")return!1;if(!Array.isArray(f))return!1;var P=S.toLowerCase();return~f.indexOf(P)?P:!1}function U(f){return x(H,f)}function I(f){return x(N,f)}function E(f){for(var S=arguments.length,P=new Array(S>1?S-1:0),T=1;T<S;T++)P[T-1]=arguments[T];for(var p=1;p<arguments.length;p++){var m=arguments[p];for(var i in m)f[i]=m[i]}return f}function L(f,S,P){var T=this,p={enumerable:!0};T.hasBeenReset=!1;var m="",i=!1,a=f,u=S,c=P,O=null,b="",y=!0,D="auto",_="start",h=50,d="middle",o=50,s="middle";Object.defineProperty(T,"id",E({},p,{get:function(){return m},set:function(C){m=""+C}})),Object.defineProperty(T,"pauseOnExit",E({},p,{get:function(){return i},set:function(C){i=!!C}})),Object.defineProperty(T,"startTime",E({},p,{get:function(){return a},set:function(C){if(typeof C!="number")throw new TypeError("Start time must be set to a number.");a=C,this.hasBeenReset=!0}})),Object.defineProperty(T,"endTime",E({},p,{get:function(){return u},set:function(C){if(typeof C!="number")throw new TypeError("End time must be set to a number.");u=C,this.hasBeenReset=!0}})),Object.defineProperty(T,"text",E({},p,{get:function(){return c},set:function(C){c=""+C,this.hasBeenReset=!0}})),Object.defineProperty(T,"region",E({},p,{get:function(){return O},set:function(C){O=C,this.hasBeenReset=!0}})),Object.defineProperty(T,"vertical",E({},p,{get:function(){return b},set:function(C){var v=U(C);if(v===!1)throw new SyntaxError("An invalid or illegal string was specified.");b=v,this.hasBeenReset=!0}})),Object.defineProperty(T,"snapToLines",E({},p,{get:function(){return y},set:function(C){y=!!C,this.hasBeenReset=!0}})),Object.defineProperty(T,"line",E({},p,{get:function(){return D},set:function(C){if(typeof C!="number"&&C!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");D=C,this.hasBeenReset=!0}})),Object.defineProperty(T,"lineAlign",E({},p,{get:function(){return _},set:function(C){var v=I(C);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");_=v,this.hasBeenReset=!0}})),Object.defineProperty(T,"position",E({},p,{get:function(){return h},set:function(C){if(C<0||C>100)throw new Error("Position must be between 0 and 100.");h=C,this.hasBeenReset=!0}})),Object.defineProperty(T,"positionAlign",E({},p,{get:function(){return d},set:function(C){var v=I(C);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");d=v,this.hasBeenReset=!0}})),Object.defineProperty(T,"size",E({},p,{get:function(){return o},set:function(C){if(C<0||C>100)throw new Error("Size must be between 0 and 100.");o=C,this.hasBeenReset=!0}})),Object.defineProperty(T,"align",E({},p,{get:function(){return s},set:function(C){var v=I(C);if(!v)throw new SyntaxError("An invalid or illegal string was specified.");s=v,this.hasBeenReset=!0}})),T.displayState=void 0}return L.prototype.getCueAsHTML=function(){var f=self.WebVTT;return f.convertCueToDOMTree(self,this.text)},L}()},"./src/utils/vttparser.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"parseTimeStamp",function(){return x}),R.d(K,"fixLineBreaks",function(){return S}),R.d(K,"VTTParser",function(){return P});var H=R("./src/utils/vttcue.ts"),N=function(){function T(){}var p=T.prototype;return p.decode=function(i,a){if(!i)return"";if(typeof i!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(i))},T}();function x(T){function p(i,a,u,c){return(i|0)*3600+(a|0)*60+(u|0)+parseFloat(c||0)}var m=T.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return m?parseFloat(m[2])>59?p(m[2],m[3],0,m[4]):p(m[1],m[2],m[3],m[4]):null}var U=function(){function T(){this.values=Object.create(null)}var p=T.prototype;return p.set=function(i,a){!this.get(i)&&a!==""&&(this.values[i]=a)},p.get=function(i,a,u){return u?this.has(i)?this.values[i]:a[u]:this.has(i)?this.values[i]:a},p.has=function(i){return i in this.values},p.alt=function(i,a,u){for(var c=0;c<u.length;++c)if(a===u[c]){this.set(i,a);break}},p.integer=function(i,a){/^-?\d+$/.test(a)&&this.set(i,parseInt(a,10))},p.percent=function(i,a){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(a)){var u=parseFloat(a);if(u>=0&&u<=100)return this.set(i,u),!0}return!1},T}();function I(T,p,m,i){var a=i?T.split(i):[T];for(var u in a){if(typeof a[u]!="string")continue;var c=a[u].split(m);if(c.length!==2)continue;var O=c[0],b=c[1];p(O,b)}}var E=new H.default(0,0,""),L=E.align==="middle"?"middle":"center";function f(T,p,m){var i=T;function a(){var O=x(T);if(O===null)throw new Error("Malformed timestamp: "+i);return T=T.replace(/^[^\sa-zA-Z-]+/,""),O}function u(O,b){var y=new U;I(O,function(h,d){var o;switch(h){case"region":for(var s=m.length-1;s>=0;s--)if(m[s].id===d){y.set(h,m[s].region);break}break;case"vertical":y.alt(h,d,["rl","lr"]);break;case"line":o=d.split(","),y.integer(h,o[0]),y.percent(h,o[0])&&y.set("snapToLines",!1),y.alt(h,o[0],["auto"]),o.length===2&&y.alt("lineAlign",o[1],["start",L,"end"]);break;case"position":o=d.split(","),y.percent(h,o[0]),o.length===2&&y.alt("positionAlign",o[1],["start",L,"end","line-left","line-right","auto"]);break;case"size":y.percent(h,d);break;case"align":y.alt(h,d,["start",L,"end","left","right"]);break}},/:/,/\s/),b.region=y.get("region",null),b.vertical=y.get("vertical","");var D=y.get("line","auto");D==="auto"&&E.line===-1&&(D=-1),b.line=D,b.lineAlign=y.get("lineAlign","start"),b.snapToLines=y.get("snapToLines",!0),b.size=y.get("size",100),b.align=y.get("align",L);var _=y.get("position","auto");_==="auto"&&E.position===50&&(_=b.align==="start"||b.align==="left"?0:b.align==="end"||b.align==="right"?100:50),b.position=_}function c(){T=T.replace(/^\s+/,"")}if(c(),p.startTime=a(),c(),T.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+i);T=T.substr(3),c(),p.endTime=a(),c(),u(T,p)}function S(T){return T.replace(/<br(?: \/)?>/gi,`
|
|
`)}var P=function(){function T(){this.state="INITIAL",this.buffer="",this.decoder=new N,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var p=T.prototype;return p.parse=function(i){var a=this;i&&(a.buffer+=a.decoder.decode(i,{stream:!0}));function u(){var _=a.buffer,h=0;for(_=S(_);h<_.length&&_[h]!=="\r"&&_[h]!==`
|
|
`;)++h;var d=_.substr(0,h);return _[h]==="\r"&&++h,_[h]===`
|
|
`&&++h,a.buffer=_.substr(h),d}function c(_){I(_,function(h,d){},/:/)}try{var O="";if(a.state==="INITIAL"){if(!/\r\n|\n/.test(a.buffer))return this;O=u();var b=O.match(/^()?WEBVTT([ \t].*)?$/);if(!b||!b[0])throw new Error("Malformed WebVTT signature.");a.state="HEADER"}for(var y=!1;a.buffer;){if(!/\r\n|\n/.test(a.buffer))return this;y?y=!1:O=u();switch(a.state){case"HEADER":/:/.test(O)?c(O):O||(a.state="ID");continue;case"NOTE":O||(a.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(O)){a.state="NOTE";break}if(!O)continue;if(a.cue=new H.default(0,0,""),a.state="CUE",O.indexOf("-->")===-1){a.cue.id=O;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{f(O,a.cue,a.regionList)}catch(_){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var D=O.indexOf("-->")!==-1;if(!O||D&&(y=!0)){a.oncue&&a.cue&&a.oncue(a.cue),a.cue=null,a.state="ID";continue}if(a.cue===null)continue;a.cue.text&&(a.cue.text+=`
|
|
`),a.cue.text+=O}continue;case"BADCUE":O||(a.state="ID")}}}catch(_){a.state==="CUETEXT"&&a.cue&&a.oncue&&a.oncue(a.cue),a.cue=null,a.state=a.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},p.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(a){i.onparsingerror&&i.onparsingerror(a)}return i.onflush&&i.onflush(),this},T}()},"./src/utils/webvtt-parser.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"generateCueId",function(){return P}),R.d(K,"parseWebVTT",function(){return p});var H=R("./src/polyfills/number.ts"),N=R("./src/utils/vttparser.ts"),x=R("./src/demux/id3.ts"),U=R("./src/utils/timescale-conversion.ts"),I=R("./src/remux/mp4-remuxer.ts"),E=/\r\n|\n\r|\n|\r/g,L=function(i,a,u){return u===void 0&&(u=0),i.substr(u,a.length)===a},f=function(i){var a=parseInt(i.substr(-3)),u=parseInt(i.substr(-6,2)),c=parseInt(i.substr(-9,2)),O=i.length>9?parseInt(i.substr(0,i.indexOf(":"))):0;if(!Object(H.isFiniteNumber)(a)||!Object(H.isFiniteNumber)(u)||!Object(H.isFiniteNumber)(c)||!Object(H.isFiniteNumber)(O))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+i);return a+=1e3*u,a+=60*1e3*c,a+=60*60*1e3*O,a},S=function(i){for(var a=5381,u=i.length;u;)a=a*33^i.charCodeAt(--u);return(a>>>0).toString()};function P(m,i,a){return S(m.toString())+S(i.toString())+S(a)}var T=function(i,a,u){var c=i[a],O=i[c.prevCC];if(!O||!O.new&&c.new){i.ccOffset=i.presentationOffset=c.start,c.new=!1;return}for(;(b=O)!==null&&b!==void 0&&b.new;){var b;i.ccOffset+=c.start-O.start,c.new=!1,c=O,O=i[c.prevCC]}i.presentationOffset=u};function p(m,i,a,u,c,O,b,y){var D=new N.VTTParser,_=Object(x.utf8ArrayToStr)(new Uint8Array(m)).trim().replace(E,`
|
|
`).split(`
|
|
`),h=[],d=Object(U.toMpegTsClockFromTimescale)(i,a),o="00:00.000",s=0,w=0,C,v=!0,M=!1;D.oncue=function(B){var F=u[c],Q=u.ccOffset,G=(s-d)/9e4;if(F!=null&&F.new&&(w!==void 0?Q=u.ccOffset=F.start:T(u,c,G)),G&&(Q=G-u.presentationOffset),M){var W=B.endTime-B.startTime,$=Object(I.normalizePts)((B.startTime+Q-w)*9e4,O*9e4)/9e4;B.startTime=$,B.endTime=$+W}var re=B.text.trim();B.text=decodeURIComponent(encodeURIComponent(re)),B.id||(B.id=P(B.startTime,B.endTime,re)),B.endTime>0&&h.push(B)},D.onparsingerror=function(B){C=B},D.onflush=function(){if(C){y(C);return}b(h)},_.forEach(function(B){if(v)if(L(B,"X-TIMESTAMP-MAP=")){v=!1,M=!0,B.substr(16).split(",").forEach(function(F){L(F,"LOCAL:")?o=F.substr(6):L(F,"MPEGTS:")&&(s=parseInt(F.substr(7)))});try{w=f(o)/1e3}catch(F){M=!1,C=F}return}else B===""&&(v=!1);D.parse(B+`
|
|
`)}),D.flush()}},"./src/utils/xhr-loader.ts":function(J,K,R){"use strict";R.r(K);var H=R("./src/utils/logger.ts"),N=R("./src/loader/load-stats.ts"),x=/^age:\s*[\d.]+\s*$/m,U=function(){function I(L){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=L?L.xhrSetup:null,this.stats=new N.LoadStats,this.retryDelay=0}var E=I.prototype;return E.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},E.abortInternal=function(){var f=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),f&&(f.onreadystatechange=null,f.onprogress=null,f.readyState!==4&&(this.stats.aborted=!0,f.abort()))},E.abort=function(){var f;this.abortInternal(),(f=this.callbacks)!==null&&f!==void 0&&f.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},E.load=function(f,S,P){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=f,this.config=S,this.callbacks=P,this.retryDelay=S.retryDelay,this.loadInternal()},E.loadInternal=function(){var f=this.config,S=this.context;if(!f)return;var P=this.loader=new self.XMLHttpRequest,T=this.stats;T.loading.first=0,T.loaded=0;var p=this.xhrSetup;try{if(p)try{p(P,S.url)}catch(a){P.open("GET",S.url,!0),p(P,S.url)}P.readyState||P.open("GET",S.url,!0);var m=this.context.headers;if(m)for(var i in m)P.setRequestHeader(i,m[i])}catch(a){this.callbacks.onError({code:P.status,text:a.message},S,P);return}S.rangeEnd&&P.setRequestHeader("Range","bytes="+S.rangeStart+"-"+(S.rangeEnd-1)),P.onreadystatechange=this.readystatechange.bind(this),P.onprogress=this.loadprogress.bind(this),P.responseType=S.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),f.timeout),P.send()},E.readystatechange=function(){var f=this.context,S=this.loader,P=this.stats;if(!f||!S)return;var T=S.readyState,p=this.config;if(P.aborted)return;if(T>=2)if(self.clearTimeout(this.requestTimeout),P.loading.first===0&&(P.loading.first=Math.max(self.performance.now(),P.loading.start)),T===4){S.onreadystatechange=null,S.onprogress=null;var m=S.status;if(m>=200&&m<300){P.loading.end=Math.max(self.performance.now(),P.loading.first);var i,a;if(f.responseType==="arraybuffer"?(i=S.response,a=i.byteLength):(i=S.responseText,a=i.length),P.loaded=P.total=a,!this.callbacks)return;var u=this.callbacks.onProgress;if(u&&u(P,f,i,S),!this.callbacks)return;var c={url:S.responseURL,data:i};this.callbacks.onSuccess(c,P,f,S)}else P.retry>=p.maxRetry||m>=400&&m<499?(H.logger.error(m+" while loading "+f.url),this.callbacks.onError({code:m,text:S.statusText},f,S)):(H.logger.warn(m+" while loading "+f.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,p.maxRetryDelay),P.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),p.timeout)},E.loadtimeout=function(){H.logger.warn("timeout while loading "+this.context.url);var f=this.callbacks;f&&(this.abortInternal(),f.onTimeout(this.stats,this.context,this.loader))},E.loadprogress=function(f){var S=this.stats;S.loaded=f.loaded,f.lengthComputable&&(S.total=f.total)},E.getCacheAge=function(){var f=null;if(this.loader&&x.test(this.loader.getAllResponseHeaders())){var S=this.loader.getResponseHeader("age");f=S?parseFloat(S):null}return f},I}();K.default=U}}).default})},vHTk:function(Fe,Ce,j){Fe.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wCXF:function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return xt});var J=j("rePB"),K=j("VTBJ"),R=j("KQm4"),H=j("U8pU"),N=j("ODXe"),x=j("q1tI"),U=j("TSYQ"),I=j.n(U),E=j("Gytx"),L=j.n(E),f=j("Kwbf"),S=j("t23M"),P=j("qx4F"),T=j("6eGT"),p=j("IBYe"),m=j("Ff2n"),i=j("c+Xe"),a=j("fyJ8"),u=j("biw7");function c(Se,xe,Ke,Ve,De){var We=Ke[Se]||{},ge=Ke[xe]||{},de,ce;We.fixed==="left"?de=Ve.left[Se]:ge.fixed==="right"&&(ce=Ve.right[xe]);var ne=!1,ie=!1,oe=!1,ue=!1,we=Ke[xe+1],ke=Ke[Se-1];if(De==="rtl"){if(de!==void 0){var Je=ke&&ke.fixed==="left";ue=!Je}else if(ce!==void 0){var bt=we&&we.fixed==="right";oe=!bt}}else if(de!==void 0){var It=we&&we.fixed==="left";ne=!It}else if(ce!==void 0){var Ge=ke&&ke.fixed==="right";ie=!Ge}return{fixLeft:de,fixRight:ce,lastFixLeft:ne,firstFixRight:ie,lastFixRight:oe,firstFixLeft:ue,isSticky:Ve.isSticky}}var O=j("sR1s");function b(Se){var xe=Se.cells,Ke=Se.stickyOffsets,Ve=Se.flattenColumns,De=Se.rowComponent,We=Se.cellComponent,ge=Se.onHeaderRow,de=Se.index,ce=x.useContext(u.a),ne=ce.prefixCls,ie=ce.direction,oe;ge&&(oe=ge(xe.map(function(we){return we.column}),de));var ue=Object(O.a)(xe.map(function(we){return we.column}));return x.createElement(De,Object.assign({},oe),xe.map(function(we,ke){var Je=we.column,bt=c(we.colStart,we.colEnd,Ve,Ke,ie),It;return Je&&Je.onHeaderCell&&(It=we.column.onHeaderCell(Je)),x.createElement(a.a,Object.assign({},we,{ellipsis:Je.ellipsis,align:Je.align,component:We,prefixCls:ne,key:ue[ke]},bt,{additionalProps:It,rowType:"header"}))}))}b.displayName="HeaderRow";var y=b;function D(Se){var xe=[];function Ke(ge,de){var ce=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;xe[ce]=xe[ce]||[];var ne=de,ie=ge.filter(Boolean).map(function(oe){var ue={key:oe.key,className:oe.className||"",children:oe.title,column:oe,colStart:ne},we=1,ke=oe.children;return ke&&ke.length>0&&(we=Ke(ke,ne,ce+1).reduce(function(Je,bt){return Je+bt},0),ue.hasSubColumns=!0),"colSpan"in oe&&(we=oe.colSpan),"rowSpan"in oe&&(ue.rowSpan=oe.rowSpan),ue.colSpan=we,ue.colEnd=ue.colStart+we-1,xe[ce].push(ue),ne+=we,we});return ie}Ke(Se,0);for(var Ve=xe.length,De=function(de){xe[de].forEach(function(ce){!("rowSpan"in ce)&&!ce.hasSubColumns&&(ce.rowSpan=Ve-de)})},We=0;We<Ve;We+=1)De(We);return xe}function _(Se){var xe=Se.stickyOffsets,Ke=Se.columns,Ve=Se.flattenColumns,De=Se.onHeaderRow,We=x.useContext(u.a),ge=We.prefixCls,de=We.getComponent,ce=x.useMemo(function(){return D(Ke)},[Ke]),ne=de(["header","wrapper"],"thead"),ie=de(["header","row"],"tr"),oe=de(["header","cell"],"th");return x.createElement(ne,{className:"".concat(ge,"-thead")},ce.map(function(ue,we){var ke=x.createElement(y,{key:we,flattenColumns:Ve,cells:ue,stickyOffsets:xe,rowComponent:ie,cellComponent:oe,onHeaderRow:De,index:we});return ke}))}var h=_,d=j("hW8S");function o(Se){for(var xe=Se.colWidths,Ke=Se.columns,Ve=Se.columCount,De=[],We=Ve||Ke.length,ge=!1,de=We-1;de>=0;de-=1){var ce=xe[de],ne=Ke&&Ke[de],ie=ne&&ne[d.a];(ce||ie||ge)&&(De.unshift(x.createElement("col",Object.assign({key:de,style:{width:ce,minWidth:ce}},ie))),ge=!0)}return x.createElement("colgroup",null,De)}var s=o;function w(Se,xe){return Object(x.useMemo)(function(){for(var Ke=[],Ve=0;Ve<xe;Ve+=1){var De=Se[Ve];if(De!==void 0)Ke[Ve]=De;else return null}return Ke},[Se.join("_"),xe])}var C=x.forwardRef(function(Se,xe){var Ke=Se.noData,Ve=Se.columns,De=Se.flattenColumns,We=Se.colWidths,ge=Se.columCount,de=Se.stickyOffsets,ce=Se.direction,ne=Se.fixHeader,ie=Se.offsetHeader,oe=Se.stickyClassName,ue=Se.onScroll,we=Object(m.a)(Se,["noData","columns","flattenColumns","colWidths","columCount","stickyOffsets","direction","fixHeader","offsetHeader","stickyClassName","onScroll"]),ke=x.useContext(u.a),Je=ke.prefixCls,bt=ke.scrollbarSize,It=ke.isSticky,Ge=It&&!ne?0:bt,it=x.useRef(null),Be=x.useCallback(function(lt){Object(i.b)(xe,lt),Object(i.b)(it,lt)},[]);x.useEffect(function(){var lt;function st(Ae){var qe=Ae.currentTarget,pt=Ae.deltaX;pt&&(ue({currentTarget:qe,scrollLeft:qe.scrollLeft+pt}),Ae.preventDefault())}return(lt=it.current)===null||lt===void 0||lt.addEventListener("wheel",st),function(){var Ae;(Ae=it.current)===null||Ae===void 0||Ae.removeEventListener("wheel",st)}},[]);var Ue=De[De.length-1],Re={fixed:Ue?Ue.fixed:null,onHeaderCell:function(){return{className:"".concat(Je,"-cell-scrollbar")}}},se=Object(x.useMemo)(function(){return Ge?[].concat(Object(R.a)(Ve),[Re]):Ve},[Ge,Ve]),pe=Object(x.useMemo)(function(){return Ge?[].concat(Object(R.a)(De),[Re]):De},[Ge,De]),je=Object(x.useMemo)(function(){var lt=de.right,st=de.left;return Object(K.a)(Object(K.a)({},de),{},{left:ce==="rtl"?[].concat(Object(R.a)(st.map(function(Ae){return Ae+Ge})),[0]):st,right:ce==="rtl"?lt:[].concat(Object(R.a)(lt.map(function(Ae){return Ae+Ge})),[0]),isSticky:It})},[Ge,de,It]),Ie=w(We,ge);return x.createElement("div",{style:Object(K.a)({overflow:"hidden"},It?{top:ie}:{}),ref:Be,className:I()("".concat(Je,"-header"),Object(J.a)({},oe,!!oe))},x.createElement("table",{style:{tableLayout:"fixed",visibility:Ke||Ie?null:"hidden"}},x.createElement(s,{colWidths:Ie?[].concat(Object(R.a)(Ie),[Ge]):[],columCount:ge+1,columns:pe}),x.createElement(h,Object.assign({},we,{stickyOffsets:je,columns:se,flattenColumns:pe}))))});C.displayName="FixedHeader";var v=C,M=x.createContext(null),B=M;function F(Se){var xe=Se.prefixCls,Ke=Se.children,Ve=Se.component,De=Se.cellComponent,We=Se.fixHeader,ge=Se.fixColumn,de=Se.horizonScroll,ce=Se.className,ne=Se.expanded,ie=Se.componentWidth,oe=Se.colSpan,ue=x.useContext(u.a),we=ue.scrollbarSize;return x.useMemo(function(){var ke=Ke;return ge&&(ke=x.createElement("div",{style:{width:ie-(We?we:0),position:"sticky",left:0,overflow:"hidden"},className:"".concat(xe,"-expanded-row-fixed")},ke)),x.createElement(Ve,{className:ce,style:{display:ne?null:"none"}},x.createElement(a.a,{component:De,prefixCls:xe,colSpan:oe},ke))},[Ke,Ve,We,de,ce,ne,ie,oe,we])}var Q=F;function G(Se){var xe=Se.className,Ke=Se.style,Ve=Se.record,De=Se.index,We=Se.rowKey,ge=Se.getRowKey,de=Se.rowExpandable,ce=Se.expandedKeys,ne=Se.onRow,ie=Se.indent,oe=ie===void 0?0:ie,ue=Se.rowComponent,we=Se.cellComponent,ke=Se.childrenColumnName,Je=x.useContext(u.a),bt=Je.prefixCls,It=Je.fixedInfoList,Ge=x.useContext(B),it=Ge.fixHeader,Be=Ge.fixColumn,Ue=Ge.horizonScroll,Re=Ge.componentWidth,se=Ge.flattenColumns,pe=Ge.expandableType,je=Ge.expandRowByClick,Ie=Ge.onTriggerExpand,lt=Ge.rowClassName,st=Ge.expandedRowClassName,Ae=Ge.indentSize,qe=Ge.expandIcon,pt=Ge.expandedRowRender,mt=Ge.expandIconColumnIndex,Lt=x.useState(!1),mn=Object(N.a)(Lt,2),hn=mn[0],en=mn[1],Dt=ce&&ce.has(Se.recordKey);x.useEffect(function(){Dt&&en(!0)},[Dt]);var xn=pe==="row"&&(!de||de(Ve)),He=pe==="nest",ht=ke&&Ve&&Ve[ke],St=xn||He,Xt;ne&&(Xt=ne(Ve,De));var an=function(g){if(je&&St&&Ie(Ve,g),Xt&&Xt.onClick){for(var A,V=arguments.length,ee=new Array(V>1?V-1:0),X=1;X<V;X++)ee[X-1]=arguments[X];(A=Xt).onClick.apply(A,[g].concat(ee))}},un;typeof lt=="string"?un=lt:typeof lt=="function"&&(un=lt(Ve,De,oe));var Ye=Object(O.a)(se),ft=x.createElement(ue,Object.assign({},Xt,{"data-row-key":We,className:I()(xe,"".concat(bt,"-row"),"".concat(bt,"-row-level-").concat(oe),un,Xt&&Xt.className),style:Object(K.a)(Object(K.a)({},Ke),Xt?Xt.style:null),onClick:an}),se.map(function(z,g){var A=z.render,V=z.dataIndex,ee=z.className,X=Ye[g],ve=It[g],Xe;g===(mt||0)&&He&&(Xe=x.createElement(x.Fragment,null,x.createElement("span",{style:{paddingLeft:"".concat(Ae*oe,"px")},className:"".concat(bt,"-row-indent indent-level-").concat(oe)}),qe({prefixCls:bt,expanded:Dt,expandable:ht,record:Ve,onExpand:Ie})));var Le;return z.onCell&&(Le=z.onCell(Ve,De)),x.createElement(a.a,Object.assign({className:ee,ellipsis:z.ellipsis,align:z.align,component:we,prefixCls:bt,key:X,record:Ve,index:De,dataIndex:V,render:A,shouldCellUpdate:z.shouldCellUpdate},ve,{appendNode:Xe,additionalProps:Le}))})),kt;if(xn&&(hn||Dt)){var vn=pt(Ve,De,oe+1,Dt),Gt=st&&st(Ve,De,oe);kt=x.createElement(Q,{expanded:Dt,className:I()("".concat(bt,"-expanded-row"),"".concat(bt,"-expanded-row-level-").concat(oe+1),Gt),prefixCls:bt,fixHeader:it,fixColumn:Be,horizonScroll:Ue,component:ue,componentWidth:Re,cellComponent:we,colSpan:se.length},vn)}var Zt;return ht&&Dt&&(Zt=(Ve[ke]||[]).map(function(z,g){var A=ge(z,g);return x.createElement(G,Object.assign({},Se,{key:A,rowKey:A,record:z,recordKey:A,index:g,indent:oe+1}))})),x.createElement(x.Fragment,null,ft,kt,Zt)}G.displayName="BodyRow";var W=G,$=x.createContext(null),re=$;function ae(Se){var xe=Se.columnKey,Ke=Se.onColumnResize,Ve=x.useRef();return x.useEffect(function(){Ve.current&&Ke(xe,Ve.current.offsetWidth)},[]),x.createElement(S.a,{onResize:function(We){var ge=We.offsetWidth;Ke(xe,ge)}},x.createElement("td",{ref:Ve,style:{padding:0,border:0,height:0}},x.createElement("div",{style:{height:0,overflow:"hidden"}},"\xA0")))}function he(Se){var xe=Se.data,Ke=Se.getRowKey,Ve=Se.measureColumnWidth,De=Se.expandedKeys,We=Se.onRow,ge=Se.rowExpandable,de=Se.emptyNode,ce=Se.childrenColumnName,ne=x.useContext(re),ie=ne.onColumnResize,oe=x.useContext(u.a),ue=oe.prefixCls,we=oe.getComponent,ke=x.useContext(B),Je=ke.fixHeader,bt=ke.horizonScroll,It=ke.flattenColumns,Ge=ke.componentWidth;return x.useMemo(function(){var it=we(["body","wrapper"],"tbody"),Be=we(["body","row"],"tr"),Ue=we(["body","cell"],"td"),Re;xe.length?Re=xe.map(function(pe,je){var Ie=Ke(pe,je);return x.createElement(W,{key:Ie,rowKey:Ie,record:pe,recordKey:Ie,index:je,rowComponent:Be,cellComponent:Ue,expandedKeys:De,onRow:We,getRowKey:Ke,rowExpandable:ge,childrenColumnName:ce})}):Re=x.createElement(Q,{expanded:!0,className:"".concat(ue,"-placeholder"),prefixCls:ue,fixHeader:Je,fixColumn:bt,horizonScroll:bt,component:Be,componentWidth:Ge,cellComponent:Ue,colSpan:It.length},de);var se=Object(O.a)(It);return x.createElement(it,{className:"".concat(ue,"-tbody")},Ve&&x.createElement("tr",{"aria-hidden":"true",className:"".concat(ue,"-measure-row"),style:{height:0}},se.map(function(pe){return x.createElement(ae,{key:pe,columnKey:pe,onColumnResize:ie})})),Re)},[xe,ue,We,Ve,De,Ke,we,Ge,de,It])}var Te=x.memo(he);Te.displayName="Body";var ye=Te,Ee=j("wRmb"),Oe=j("xEkU"),_e=j.n(Oe);function fe(Se){var xe=Object(x.useRef)(Se),Ke=Object(x.useState)({}),Ve=Object(N.a)(Ke,2),De=Ve[1],We=Object(x.useRef)(null),ge=Object(x.useRef)([]);function de(ce){We.current===null&&(ge.current=[],We.current=_e()(function(){ge.current.forEach(function(ne){xe.current=ne(xe.current)}),We.current=null,De({})})),ge.current.push(ce)}return Object(x.useEffect)(function(){return function(){_e.a.cancel(We.current)}},[]),[xe.current,de]}function le(Se){var xe=Object(x.useRef)(Se),Ke=Object(x.useRef)(null);function Ve(){window.clearTimeout(Ke.current)}function De(ge){xe.current=ge,Ve(),Ke.current=window.setTimeout(function(){xe.current=null,Ke.current=null},100)}function We(){return xe.current}return Object(x.useEffect)(function(){return Ve},[]),[De,We]}function Me(Se,xe,Ke){var Ve=Object(x.useMemo)(function(){for(var De=[],We=[],ge=0,de=0,ce=0;ce<xe;ce+=1)if(Ke==="rtl"){We[ce]=de,de+=Se[ce]||0;var ne=xe-ce-1;De[ne]=ge,ge+=Se[ne]||0}else{De[ce]=ge,ge+=Se[ce]||0;var ie=xe-ce-1;We[ie]=de,de+=Se[ie]||0}return{left:De,right:We}},[Se,xe,Ke]);return Ve}var ot=Me;function ut(Se){var xe=Se.className,Ke=Se.children;return x.createElement("div",{className:xe},Ke)}var rt=ut,tt=j("n6Qo");function ze(Se){var xe,Ke=Se.prefixCls,Ve=Se.record,De=Se.onExpand,We=Se.expanded,ge=Se.expandable,de="".concat(Ke,"-row-expand-icon");if(!ge)return x.createElement("span",{className:I()(de,"".concat(Ke,"-row-spaced"))});var ce=function(ie){De(Ve,ie),ie.stopPropagation()};return x.createElement("span",{className:I()(de,(xe={},Object(J.a)(xe,"".concat(Ke,"-row-expanded"),We),Object(J.a)(xe,"".concat(Ke,"-row-collapsed"),!We),xe)),onClick:ce})}function $e(Se,xe,Ke){var Ve=[];function De(We){(We||[]).forEach(function(ge,de){Ve.push(xe(ge,de)),De(ge[Ke])})}return De(Se),Ve}var ct=j("zT1h"),vt=j("y0+3"),at=function(xe,Ke){var Ve,De,We=xe.scrollBodyRef,ge=xe.onScroll,de=xe.offsetScroll,ce=x.useContext(u.a),ne=ce.prefixCls,ie=((Ve=We.current)===null||Ve===void 0?void 0:Ve.scrollWidth)||0,oe=((De=We.current)===null||De===void 0?void 0:De.clientWidth)||0,ue=ie&&oe*(oe/ie),we=x.useRef(),ke=fe({scrollLeft:0,isHiddenScrollBar:!1}),Je=Object(N.a)(ke,2),bt=Je[0],It=Je[1],Ge=x.useRef({delta:0,x:0}),it=x.useState(!1),Be=Object(N.a)(it,2),Ue=Be[0],Re=Be[1],se=function(){Re(!1)},pe=function(Ae){Ae.persist(),Ge.current.delta=Ae.pageX-bt.scrollLeft,Ge.current.x=0,Re(!0),Ae.preventDefault()},je=function(Ae){var qe,pt=Ae||((qe=window)===null||qe===void 0?void 0:qe.event),mt=pt.buttons;if(!Ue||mt===0){Ue&&Re(!1);return}var Lt=Ge.current.x+Ae.pageX-Ge.current.x-Ge.current.delta;Lt<=0&&(Lt=0),Lt+ue>=oe&&(Lt=oe-ue),ge({scrollLeft:Lt/oe*(ie+2)}),Ge.current.x=Ae.pageX},Ie=function(){var Ae=Object(vt.b)(We.current).top,qe=Ae+We.current.offsetHeight,pt=document.documentElement.scrollTop+window.innerHeight;qe-Object(P.a)()<=pt||Ae>=pt-de?It(function(mt){return Object(K.a)(Object(K.a)({},mt),{},{isHiddenScrollBar:!0})}):It(function(mt){return Object(K.a)(Object(K.a)({},mt),{},{isHiddenScrollBar:!1})})},lt=function(Ae){It(function(qe){return Object(K.a)(Object(K.a)({},qe),{},{scrollLeft:Ae/ie*oe||0})})};return x.useImperativeHandle(Ke,function(){return{setScrollLeft:lt}}),x.useEffect(function(){var st=Object(ct.a)(document.body,"mouseup",se,!1),Ae=Object(ct.a)(document.body,"mousemove",je,!1);return Ie(),function(){st.remove(),Ae.remove()}},[ue,Ue]),x.useEffect(function(){var st=Object(ct.a)(window,"scroll",Ie,!1),Ae=Object(ct.a)(window,"resize",Ie,!1);return function(){st.remove(),Ae.remove()}},[]),x.useEffect(function(){bt.isHiddenScrollBar||It(function(st){var Ae,qe;return Object(K.a)(Object(K.a)({},st),{},{scrollLeft:We.current.scrollLeft/((Ae=We.current)===null||Ae===void 0?void 0:Ae.scrollWidth)*((qe=We.current)===null||qe===void 0?void 0:qe.clientWidth)})})},[bt.isHiddenScrollBar]),ie<=oe||!ue||bt.isHiddenScrollBar?null:x.createElement("div",{style:{height:Object(P.a)(),width:oe,bottom:de},className:"".concat(ne,"-sticky-scroll")},x.createElement("div",{onMouseDown:pe,ref:we,className:I()("".concat(ne,"-sticky-scroll-bar"),Object(J.a)({},"".concat(ne,"-sticky-scroll-bar-active"),Ue)),style:{width:"".concat(ue,"px"),transform:"translate3d(".concat(bt.scrollLeft,"px, 0, 0)")}}))},et=x.forwardRef(at);function nt(Se,xe){return x.useMemo(function(){var Ke=!!Se;return{isSticky:Ke,stickyClassName:Ke?"".concat(xe,"-sticky-header"):"",offsetHeader:Object(H.a)(Se)==="object"&&Se.offsetHeader||0,offsetScroll:Object(H.a)(Se)==="object"&&Se.offsetScroll||0}},[Se,xe])}var Rt=[],Ct={},xt="rc-table-internal-hook",yt=x.memo(function(Se){var xe=Se.children;return xe},function(Se,xe){return L()(Se.props,xe.props)?Se.pingLeft!==xe.pingLeft||Se.pingRight!==xe.pingRight:!1});function wt(Se){var xe,Ke=Se.prefixCls,Ve=Se.className,De=Se.rowClassName,We=Se.style,ge=Se.data,de=Se.rowKey,ce=Se.scroll,ne=Se.tableLayout,ie=Se.direction,oe=Se.title,ue=Se.footer,we=Se.summary,ke=Se.id,Je=Se.showHeader,bt=Se.components,It=Se.emptyText,Ge=Se.onRow,it=Se.onHeaderRow,Be=Se.internalHooks,Ue=Se.transformColumns,Re=Se.internalRefs,se=Se.sticky,pe=ge||Rt,je=!!pe.length,Ie=x.useState(0),lt=Object(N.a)(Ie,2),st=lt[0],Ae=lt[1];x.useEffect(function(){Ae(Object(P.a)())});var qe=x.useMemo(function(){return Object(O.c)(bt,{})},[bt]),pt=x.useCallback(function(jt,Qt){return Object(O.b)(qe,jt)||Qt},[qe]),mt=x.useMemo(function(){return typeof de=="function"?de:function(jt){var Qt=jt&&jt[de];return Qt}},[de]),Lt=Object(d.c)(Se),mn=Lt.expandIcon,hn=Lt.expandedRowKeys,en=Lt.defaultExpandedRowKeys,Dt=Lt.defaultExpandAllRows,xn=Lt.expandedRowRender,He=Lt.onExpand,ht=Lt.onExpandedRowsChange,St=Lt.expandRowByClick,Xt=Lt.rowExpandable,an=Lt.expandIconColumnIndex,un=Lt.expandedRowClassName,Ye=Lt.childrenColumnName,ft=Lt.indentSize,kt=mn||ze,vn=Ye||"children",Gt=x.useMemo(function(){return xn?"row":Se.expandable&&Be===xt&&Se.expandable.__PARENT_RENDER_ICON__||pe.some(function(jt){return jt&&Object(H.a)(jt)==="object"&&jt[vn]})?"nest":!1},[!!xn,pe]),Zt=x.useState(function(){return en||(Dt?$e(pe,mt,vn):[])}),z=Object(N.a)(Zt,2),g=z[0],A=z[1],V=x.useMemo(function(){return new Set(hn||g||[])},[hn,g]),ee=x.useCallback(function(jt){var Qt=mt(jt,pe.indexOf(jt)),Ht,In=V.has(Qt);In?(V.delete(Qt),Ht=Object(R.a)(V)):Ht=[].concat(Object(R.a)(V),[Qt]),A(Ht),He&&He(!In,jt),ht&&ht(Ht)},[mt,V,pe,He,ht]),X=x.useState(0),ve=Object(N.a)(X,2),Xe=ve[0],Le=ve[1],At=Object(Ee.b)(Object(K.a)(Object(K.a)(Object(K.a)({},Se),Lt),{},{expandable:!!xn,expandedKeys:V,getRowKey:mt,onTriggerExpand:ee,expandIcon:kt,expandIconColumnIndex:an,direction:ie}),Be===xt?Ue:null),Qe=Object(N.a)(At,2),Bt=Qe[0],Ft=Qe[1],tn=x.useMemo(function(){return{columns:Bt,flattenColumns:Ft}},[Bt,Ft]),zn=x.useRef(),Wn=x.useRef(),$t=x.useRef(),yn=x.useState(!1),Mn=Object(N.a)(yn,2),bn=Mn[0],fn=Mn[1],Sn=x.useState(!1),Tn=Object(N.a)(Sn,2),Hn=Tn[0],Gn=Tn[1],er=fe(new Map),Dn=Object(N.a)(er,2),Or=Dn[0],on=Dn[1],Yn=Object(O.a)(Ft),Ar=Yn.map(function(jt){return Or.get(jt)}),yr=x.useMemo(function(){return Ar},[Ar.join("_")]),br=ot(yr,Ft.length,ie),pn=ce&&Object(O.d)(ce.y),nn=ce&&Object(O.d)(ce.x),Pn=nn&&Ft.some(function(jt){var Qt=jt.fixed;return Qt}),dn=x.useRef(),kn=nt(se,Ke),gn=kn.isSticky,Er=kn.offsetHeader,Un=kn.offsetScroll,Bn=kn.stickyClassName,tr,cr,xr;pn&&(cr={overflowY:"scroll",maxHeight:ce.y}),nn&&(tr={overflowX:"auto"},pn||(cr={overflowY:"hidden"}),xr={width:ce.x===!0?"auto":ce.x,minWidth:"100%"});var Ur=x.useCallback(function(jt,Qt){on(function(Ht){var In=new Map(Ht);return In.set(jt,Qt),In})},[]),hr=le(null),Tr=Object(N.a)(hr,2),nr=Tr[0],Dr=Tr[1];function ir(jt,Qt){if(!Qt)return;typeof Qt=="function"?Qt(jt):Qt.scrollLeft!==jt&&(Qt.scrollLeft=jt)}var ar=function(Qt){var Ht=Qt.currentTarget,In=Qt.scrollLeft,Rr=typeof In=="number"?In:Ht.scrollLeft,Wr=Ht||Ct;if(!Dr()||Dr()===Wr){var Si;nr(Wr),ir(Rr,Wn.current),ir(Rr,$t.current),ir(Rr,(Si=dn.current)===null||Si===void 0?void 0:Si.setScrollLeft)}if(Ht){var Xi=Ht.scrollWidth,ga=Ht.clientWidth;fn(Rr>0),Gn(Rr<Xi-ga)}},En=function(){$t.current&&ar({currentTarget:$t.current})},qt=function(Qt){var Ht=Qt.width;En(),Le(zn.current?zn.current.offsetWidth:Ht)};x.useEffect(function(){return En},[]),x.useEffect(function(){nn&&En()},[nn]),x.useEffect(function(){Be===xt&&Re&&(Re.body.current=$t.current)});var On=pt(["table"],"table"),Kt=x.useMemo(function(){return ne||(Pn?ce.x==="max-content"?"auto":"fixed":pn||Ft.some(function(jt){var Qt=jt.ellipsis;return Qt})?"fixed":"auto")},[pn,Pn,Ft,ne]),wn,_n={colWidths:yr,columCount:Ft.length,stickyOffsets:br,onHeaderRow:it,fixHeader:pn},Mt=x.useMemo(function(){return je?null:typeof It=="function"?It():It},[je,It]),Nt=x.createElement(ye,{data:pe,measureColumnWidth:pn||nn||gn,expandedKeys:V,rowExpandable:Xt,getRowKey:mt,onRow:Ge,emptyNode:Mt,childrenColumnName:vn}),Wt=x.createElement(s,{colWidths:Ft.map(function(jt){var Qt=jt.width;return Qt}),columns:Ft}),Tt=we&&x.createElement(tt.b,null,we(pe)),rn=pt(["body"]);if(pn||gn){var sn;typeof rn=="function"?(sn=rn(pe,{scrollbarSize:st,ref:$t,onScroll:ar}),_n.colWidths=Ft.map(function(jt,Qt){var Ht=jt.width,In=Qt===Bt.length-1?Ht-st:Ht;return typeof In=="number"&&!Number.isNaN(In)?In:(Object(f.a)(!1,"When use `components.body` with render props. Each column should have a fixed value."),0)})):sn=x.createElement("div",{style:Object(K.a)(Object(K.a)({},tr),cr),onScroll:ar,ref:$t,className:I()("".concat(Ke,"-body"))},x.createElement(On,{style:Object(K.a)(Object(K.a)({},xr),{},{tableLayout:Kt})},Wt,Nt,Tt),gn&&x.createElement(et,{ref:dn,offsetScroll:Un,scrollBodyRef:$t,onScroll:ar})),wn=x.createElement(x.Fragment,null,Je!==!1&&x.createElement(v,Object.assign({noData:!pe.length},_n,tn,{direction:ie,offsetHeader:Er,stickyClassName:Bn,ref:Wn,onScroll:ar})),sn)}else wn=x.createElement("div",{style:Object(K.a)(Object(K.a)({},tr),cr),className:I()("".concat(Ke,"-content")),onScroll:ar,ref:$t},x.createElement(On,{style:Object(K.a)(Object(K.a)({},xr),{},{tableLayout:Kt})},Wt,Je!==!1&&x.createElement(h,Object.assign({},_n,tn)),Nt,Tt));var Jt=Object(d.b)(Se),cn=x.createElement("div",Object.assign({className:I()(Ke,Ve,(xe={},Object(J.a)(xe,"".concat(Ke,"-rtl"),ie==="rtl"),Object(J.a)(xe,"".concat(Ke,"-ping-left"),bn),Object(J.a)(xe,"".concat(Ke,"-ping-right"),Hn),Object(J.a)(xe,"".concat(Ke,"-layout-fixed"),ne==="fixed"),Object(J.a)(xe,"".concat(Ke,"-fixed-header"),pn),Object(J.a)(xe,"".concat(Ke,"-fixed-column"),Pn),Object(J.a)(xe,"".concat(Ke,"-scroll-horizontal"),nn),Object(J.a)(xe,"".concat(Ke,"-has-fix-left"),Ft[0]&&Ft[0].fixed),Object(J.a)(xe,"".concat(Ke,"-has-fix-right"),Ft[Ft.length-1]&&Ft[Ft.length-1].fixed==="right"),xe)),style:We,id:ke,ref:zn},Jt),x.createElement(yt,{pingLeft:bn,pingRight:Hn,props:Object(K.a)(Object(K.a)({},Se),{},{stickyOffsets:br,mergedExpandedKeys:V})},oe&&x.createElement(rt,{className:"".concat(Ke,"-title")},oe(pe)),x.createElement("div",{className:"".concat(Ke,"-container")},wn),ue&&x.createElement(rt,{className:"".concat(Ke,"-footer")},ue(pe))));nn&&(cn=x.createElement(S.a,{onResize:qt},cn));var Rn=x.useMemo(function(){return{prefixCls:Ke,getComponent:pt,scrollbarSize:st,direction:ie,fixedInfoList:Ft.map(function(jt,Qt){return c(Qt,Qt,Ft,br,ie)}),isSticky:gn}},[Ke,pt,st,ie,Ft,br,ie,gn]),zt=x.useMemo(function(){return Object(K.a)(Object(K.a)({},tn),{},{tableLayout:Kt,rowClassName:De,expandedRowClassName:un,componentWidth:Xe,fixHeader:pn,fixColumn:Pn,horizonScroll:nn,expandIcon:kt,expandableType:Gt,expandRowByClick:St,expandedRowRender:xn,onTriggerExpand:ee,expandIconColumnIndex:an,indentSize:ft})},[tn,Kt,De,un,Xe,pn,Pn,nn,kt,Gt,St,xn,ee,an,ft]),lr=x.useMemo(function(){return{onColumnResize:Ur}},[Ur]);return x.createElement(u.a.Provider,{value:Rn},x.createElement(B.Provider,{value:zt},x.createElement(re.Provider,{value:lr},cn)))}wt.Column=p.a,wt.ColumnGroup=T.a,wt.Summary=tt.a,wt.defaultProps={rowKey:"key",prefixCls:"rc-table",emptyText:function(){return"No Data"}};var Et=Ce.b=wt},wRmb:function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return L});var J=j("rePB"),K=j("KQm4"),R=j("VTBJ"),H=j("Ff2n"),N=j("q1tI"),x=j.n(N),U=j("Kwbf"),I=j("Zm9Q"),E=j("hW8S");function L(p){return Object(I.a)(p).filter(function(m){return N.isValidElement(m)}).map(function(m){var i=m.key,a=m.props,u=a.children,c=Object(H.a)(a,["children"]),O=Object(R.a)({key:i},c);return u&&(O.children=L(u)),O})}function f(p){return p.reduce(function(m,i){var a=i.fixed,u=a===!0?"left":a,c=i.children;return c&&c.length>0?[].concat(Object(K.a)(m),Object(K.a)(f(c).map(function(O){return Object(R.a)({fixed:u},O)}))):[].concat(Object(K.a)(m),[Object(R.a)(Object(R.a)({},i),{},{fixed:u})])},[])}function S(p){for(var m=!0,i=0;i<p.length;i+=1){var a=p[i];if(m&&a.fixed!=="left")m=!1;else if(!m&&a.fixed==="left"){Object(U.a)(!1,"Index ".concat(i-1," of `columns` missing `fixed='left'` prop."));break}}for(var u=!0,c=p.length-1;c>=0;c-=1){var O=p[c];if(u&&O.fixed!=="right")u=!1;else if(!u&&O.fixed==="right"){Object(U.a)(!1,"Index ".concat(c+1," of `columns` missing `fixed='right'` prop."));break}}}function P(p){return p.map(function(m){var i=m.fixed,a=Object(H.a)(m,["fixed"]),u=i;return i==="left"?u="right":i==="right"&&(u="left"),Object(R.a)({fixed:u},a)})}function T(p,m){var i=p.prefixCls,a=p.columns,u=p.children,c=p.expandable,O=p.expandedKeys,b=p.getRowKey,y=p.onTriggerExpand,D=p.expandIcon,_=p.rowExpandable,h=p.expandIconColumnIndex,d=p.direction,o=p.expandRowByClick,s=N.useMemo(function(){return a||L(u)},[a,u]),w=N.useMemo(function(){if(c){var M,B=h||0,F=s[B],Q=(M={},Object(J.a)(M,E.a,{className:"".concat(i,"-expand-icon-col")}),Object(J.a)(M,"title",""),Object(J.a)(M,"fixed",F?F.fixed:null),Object(J.a)(M,"className","".concat(i,"-row-expand-icon-cell")),Object(J.a)(M,"render",function($,re,ae){var he=b(re,ae),Te=O.has(he),ye=_?_(re):!0,Ee=D({prefixCls:i,expanded:Te,expandable:ye,record:re,onExpand:y});return o?N.createElement("span",{onClick:function(_e){return _e.stopPropagation()}},Ee):Ee}),M),G=s.slice();return B>=0&&G.splice(B,0,Q),G}return s},[c,s,b,O,D,d]),C=N.useMemo(function(){var M=w;return m&&(M=m(M)),M.length||(M=[{render:function(){return null}}]),M},[m,w,d]),v=N.useMemo(function(){return d==="rtl"?P(f(C)):f(C)},[C,d]);return[C,v]}Ce.b=T},wU8J:function(Fe,Ce){function j(){this.buffer=new Array,this.length=0}j.prototype={get:function(J){var K=Math.floor(J/8);return(this.buffer[K]>>>7-J%8&1)==1},put:function(J,K){for(var R=0;R<K;R++)this.putBit((J>>>K-R-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(J){var K=Math.floor(this.length/8);this.buffer.length<=K&&this.buffer.push(0),J&&(this.buffer[K]|=128>>>this.length%8),this.length++}},Fe.exports=j},"y0+3":function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return f}),j.d(Ce,"b",function(){return P});var J=/margin|padding|width|height|max|min|offset/,K={left:!0,top:!0},R={cssFloat:1,styleFloat:1,float:1};function H(T){return T.nodeType===1?T.ownerDocument.defaultView.getComputedStyle(T,null):{}}function N(T,p,m){if(p=p.toLowerCase(),m==="auto"){if(p==="height")return T.offsetHeight;if(p==="width")return T.offsetWidth}return p in K||(K[p]=J.test(p)),K[p]?parseFloat(m)||0:m}function x(T,p){var m=arguments.length,i=H(T);return p=R[p]?"cssFloat"in T.style?"cssFloat":"styleFloat":p,m===1?i:N(T,p,i[p]||T.style[p])}function U(T,p,m){var i=arguments.length;if(p=R[p]?"cssFloat"in T.style?"cssFloat":"styleFloat":p,i===3)return typeof m=="number"&&J.test(p)&&(m="".concat(m,"px")),T.style[p]=m,m;for(var a in p)p.hasOwnProperty(a)&&U(T,a,p[a]);return H(T)}function I(T){return T===document.body?document.documentElement.clientWidth:T.offsetWidth}function E(T){return T===document.body?window.innerHeight||document.documentElement.clientHeight:T.offsetHeight}function L(){var T=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),p=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);return{width:T,height:p}}function f(){var T=document.documentElement.clientWidth,p=window.innerHeight||document.documentElement.clientHeight;return{width:T,height:p}}function S(){return{scrollLeft:Math.max(document.documentElement.scrollLeft,document.body.scrollLeft),scrollTop:Math.max(document.documentElement.scrollTop,document.body.scrollTop)}}function P(T){var p=T.getBoundingClientRect(),m=document.documentElement;return{left:p.left+(window.pageXOffset||m.scrollLeft)-(m.clientLeft||document.body.clientLeft||0),top:p.top+(window.pageYOffset||m.scrollTop)-(m.clientTop||document.body.clientTop||0)}}},ynwM:function(Fe,Ce,j){var J=j("MFOe"),K=J.Global;Fe.exports={name:"oldFF-globalStorage",read:H,write:N,each:x,remove:U,clearAll:I};var R=K.globalStorage;function H(E){return R[E]}function N(E,L){R[E]=L}function x(E){for(var L=R.length-1;L>=0;L--){var f=R.key(L);E(R[f],f)}}function U(E){return R.removeItem(E)}function I(){x(function(E,L){delete R[E]})}}}]);
|