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([[173,3,5,7,8,20],{"+NIl":function(Ke,we,U){(function(q){q(U("VrN/"))})(function(q){"use strict";q.defineMode("stex",function(z,L){"use strict";function K(_,E){_.cmdState.push(E)}function I(_){return _.cmdState.length>0?_.cmdState[_.cmdState.length-1]:null}function w(_){var E=_.cmdState.pop();E&&E.closeBracket()}function B(_){for(var E=_.cmdState,g=E.length-1;g>=0;g--){var u=E[g];if(u.name=="DEFAULT")continue;return u}return{styleIdentifier:function(){return null}}}function N(_,E,g){return function(){this.name=_,this.bracketNo=0,this.style=E,this.styles=g,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var A={};A.importmodule=N("importmodule","tag",["string","builtin"]),A.documentclass=N("documentclass","tag",["","atom"]),A.usepackage=N("usepackage","tag",["atom"]),A.begin=N("begin","tag",["atom"]),A.end=N("end","tag",["atom"]),A.label=N("label","tag",["atom"]),A.ref=N("ref","tag",["atom"]),A.eqref=N("eqref","tag",["atom"]),A.cite=N("cite","tag",["atom"]),A.bibitem=N("bibitem","tag",["atom"]),A.Bibitem=N("Bibitem","tag",["atom"]),A.RBibitem=N("RBibitem","tag",["atom"]),A.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function k(_,E){_.f=E}function m(_,E){var g;if(_.match(/^\\[a-zA-Z@]+/)){var u=_.current().slice(1);return g=A.hasOwnProperty(u)?A[u]:A.DEFAULT,g=new g,K(E,g),k(E,R),g.style}if(_.match(/^\\[$&%#{}_]/))return"tag";if(_.match(/^\\[,;!\/\\]/))return"tag";if(_.match("\\["))return k(E,function(i,c){return O(i,c,"\\]")}),"keyword";if(_.match("\\("))return k(E,function(i,c){return O(i,c,"\\)")}),"keyword";if(_.match("$$"))return k(E,function(i,c){return O(i,c,"$$")}),"keyword";if(_.match("$"))return k(E,function(i,c){return O(i,c,"$")}),"keyword";var a=_.next();if(a=="%")return _.skipToEnd(),"comment";if(a=="}"||a=="]"){if(g=I(E),g)g.closeBracket(a),k(E,R);else return"error";return"bracket"}else return a=="{"||a=="["?(g=A.DEFAULT,g=new g,K(E,g),"bracket"):/\d/.test(a)?(_.eatWhile(/[\w.%]/),"atom"):(_.eatWhile(/[\w\-_]/),g=B(E),g.name=="begin"&&(g.argument=_.current()),g.styleIdentifier())}function O(_,E,g){if(_.eatSpace())return null;if(g&&_.match(g))return k(E,m),"keyword";if(_.match(/^\\[a-zA-Z@]+/))return"tag";if(_.match(/^[a-zA-Z]+/))return"variable-2";if(_.match(/^\\[$&%#{}_]/))return"tag";if(_.match(/^\\[,;!\/]/))return"tag";if(_.match(/^[\^_&]/))return"tag";if(_.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(_.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var u=_.next();return u=="{"||u=="}"||u=="["||u=="]"||u=="("||u==")"?"bracket":u=="%"?(_.skipToEnd(),"comment"):"error"}function R(_,E){var g=_.peek(),u;return g=="{"||g=="["?(u=I(E),u.openBracket(g),_.eat(g),k(E,m),"bracket"):/[ \t\r]/.test(g)?(_.eat(g),null):(k(E,m),w(E),m(_,E))}return{startState:function(){var _=L.inMathMode?function(E,g){return O(E,g)}:m;return{cmdState:[],f:_}},copyState:function(_){return{cmdState:_.cmdState.slice(),f:_.f}},token:function(_,E){return E.f(_,E)},blankLine:function(_){_.f=m,_.cmdState.length=0},lineComment:"%"}}),q.defineMIME("text/x-stex","stex"),q.defineMIME("text/x-latex","stex")})},"+k/U":function(Ke,we,U){Ke.exports={pagination:"pagination___2XcQw",info:"info___12Y4R"}},"07cG":function(Ke,we,U){Ke.exports={ldsRing:"ldsRing___2F8W7",idsRingWrapper:"idsRingWrapper___fC2cF",ldsring:"ldsring___3A88y"}},"19Vz":function(Ke,we,U){(function(q){q(U("VrN/"))})(function(q){q.defineOption("placeholder","",function(N,A,k){var m=k&&k!=q.Init;if(A&&!m)N.on("blur",I),N.on("change",w),N.on("swapDoc",w),q.on(N.getInputField(),"compositionupdate",N.state.placeholderCompose=function(){K(N)}),w(N);else if(!A&&m){N.off("blur",I),N.off("change",w),N.off("swapDoc",w),q.off(N.getInputField(),"compositionupdate",N.state.placeholderCompose),z(N);var O=N.getWrapperElement();O.className=O.className.replace(" CodeMirror-empty","")}A&&!N.hasFocus()&&I(N)});function z(N){N.state.placeholder&&(N.state.placeholder.parentNode.removeChild(N.state.placeholder),N.state.placeholder=null)}function L(N){z(N);var A=N.state.placeholder=document.createElement("pre");A.style.cssText="height: 0; overflow: visible",A.style.direction=N.getOption("direction"),A.className="CodeMirror-placeholder CodeMirror-line-like";var k=N.getOption("placeholder");typeof k=="string"&&(k=document.createTextNode(k)),A.appendChild(k),N.display.lineSpace.insertBefore(A,N.display.lineSpace.firstChild)}function K(N){setTimeout(function(){var A=!1,k=N.getInputField();k.nodeName=="TEXTAREA"?A=!k.value:N.lineCount()==1&&(A=!/[^\u200b]/.test(k.querySelector(".CodeMirror-line").textContent)),A?L(N):z(N)},20)}function I(N){B(N)&&L(N)}function w(N){var A=N.getWrapperElement(),k=B(N);A.className=A.className.replace(" CodeMirror-empty","")+(k?" CodeMirror-empty":""),k?L(N):z(N)}function B(N){return N.lineCount()===1&&N.getLine(0)===""}})},"1eCo":function(Ke,we,U){(function(q){q(U("VrN/"))})(function(q){"use strict";var z={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},L={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};q.defineMode("xml",function(K,I){var w=K.indentUnit,B={},N=I.htmlMode?z:L;for(var A in N)B[A]=N[A];for(var A in I)B[A]=I[A];var k,m;function O(s,C){function y(j){return C.tokenize=j,j(s,C)}var x=s.next();if(x=="<")return s.eat("!")?s.eat("[")?s.match("CDATA[")?y(E("atom","]]>")):null:s.match("--")?y(E("comment","-->")):s.match("DOCTYPE",!0,!0)?(s.eatWhile(/[\w\._\-]/),y(g(1))):null:s.eat("?")?(s.eatWhile(/[\w\._\-]/),C.tokenize=E("meta","?>"),"meta"):(k=s.eat("/")?"closeTag":"openTag",C.tokenize=R,"tag bracket");if(x=="&"){var P;return s.eat("#")?s.eat("x")?P=s.eatWhile(/[a-fA-F\d]/)&&s.eat(";"):P=s.eatWhile(/[\d]/)&&s.eat(";"):P=s.eatWhile(/[\w\.\-:]/)&&s.eat(";"),P?"atom":"error"}else return s.eatWhile(/[^&<]/),null}O.isInText=!0;function R(s,C){var y=s.next();if(y==">"||y=="/"&&s.eat(">"))return C.tokenize=O,k=y==">"?"endTag":"selfcloseTag","tag bracket";if(y=="=")return k="equals",null;if(y=="<"){C.tokenize=O,C.state=c,C.tagName=C.tagStart=null;var x=C.tokenize(s,C);return x?x+" tag error":"tag error"}else return/[\'\"]/.test(y)?(C.tokenize=_(y),C.stringStartCol=s.column(),C.tokenize(s,C)):(s.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function _(s){var C=function(y,x){for(;!y.eol();)if(y.next()==s){x.tokenize=R;break}return"string"};return C.isInAttribute=!0,C}function E(s,C){return function(y,x){for(;!y.eol();){if(y.match(C)){x.tokenize=O;break}y.next()}return s}}function g(s){return function(C,y){for(var x;(x=C.next())!=null;){if(x=="<")return y.tokenize=g(s+1),y.tokenize(C,y);if(x==">")if(s==1){y.tokenize=O;break}else return y.tokenize=g(s-1),y.tokenize(C,y)}return"meta"}}function u(s,C,y){this.prev=s.context,this.tagName=C,this.indent=s.indented,this.startOfLine=y,(B.doNotIndent.hasOwnProperty(C)||s.context&&s.context.noIndent)&&(this.noIndent=!0)}function a(s){s.context&&(s.context=s.context.prev)}function i(s,C){for(var y;;){if(!s.context)return;if(y=s.context.tagName,!B.contextGrabbers.hasOwnProperty(y)||!B.contextGrabbers[y].hasOwnProperty(C))return;a(s)}}function c(s,C,y){return s=="openTag"?(y.tagStart=C.column(),S):s=="closeTag"?v:c}function S(s,C,y){return s=="word"?(y.tagName=C.current(),m="tag",b):B.allowMissingTagName&&s=="endTag"?(m="tag bracket",b(s,C,y)):(m="error",S)}function v(s,C,y){if(s=="word"){var x=C.current();return y.context&&y.context.tagName!=x&&B.implicitlyClosed.hasOwnProperty(y.context.tagName)&&a(y),y.context&&y.context.tagName==x||B.matchClosing===!1?(m="tag",p):(m="tag error",D)}else return B.allowMissingTagName&&s=="endTag"?(m="tag bracket",p(s,C,y)):(m="error",D)}function p(s,C,y){return s!="endTag"?(m="error",p):(a(y),c)}function D(s,C,y){return m="error",p(s,C,y)}function b(s,C,y){if(s=="word")return m="attribute",h;if(s=="endTag"||s=="selfcloseTag"){var x=y.tagName,P=y.tagStart;return y.tagName=y.tagStart=null,s=="selfcloseTag"||B.autoSelfClosers.hasOwnProperty(x)?i(y,x):(i(y,x),y.context=new u(y,x,P==y.indented)),c}return m="error",b}function h(s,C,y){return s=="equals"?d:(B.allowMissing||(m="error"),b(s,C,y))}function d(s,C,y){return s=="string"?o:s=="word"&&B.allowUnquoted?(m="string",b):(m="error",b(s,C,y))}function o(s,C,y){return s=="string"?o:b(s,C,y)}return{startState:function(s){var C={tokenize:O,state:c,indented:s||0,tagName:null,tagStart:null,context:null};return s!=null&&(C.baseIndent=s),C},token:function(s,C){if(!C.tagName&&s.sol()&&(C.indented=s.indentation()),s.eatSpace())return null;k=null;var y=C.tokenize(s,C);return(y||k)&&y!="comment"&&(m=null,C.state=C.state(k||y,s,C),m&&(y=m=="error"?y+" error":m)),y},indent:function(s,C,y){var x=s.context;if(s.tokenize.isInAttribute)return s.tagStart==s.indented?s.stringStartCol+1:s.indented+w;if(x&&x.noIndent)return q.Pass;if(s.tokenize!=R&&s.tokenize!=O)return y?y.match(/^(\s*)/)[0].length:0;if(s.tagName)return B.multilineTagIndentPastTag!==!1?s.tagStart+s.tagName.length+2:s.tagStart+w*(B.multilineTagIndentFactor||1);if(B.alignCDATA&&/<!\[CDATA\[/.test(C))return 0;var P=C&&/^<(\/)?([\w_:\.-]*)/.exec(C);if(P&&P[1])for(;x;)if(x.tagName==P[2]){x=x.prev;break}else if(B.implicitlyClosed.hasOwnProperty(x.tagName))x=x.prev;else break;else if(P)for(;x;){var j=B.contextGrabbers[x.tagName];if(j&&j.hasOwnProperty(P[2]))x=x.prev;else break}for(;x&&x.prev&&!x.startOfLine;)x=x.prev;return x?x.indent+w:s.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:B.htmlMode?"html":"xml",helperType:B.htmlMode?"html":"xml",skipAttribute:function(s){s.state==d&&(s.state=b)},xmlCurrentTag:function(s){return s.tagName?{name:s.tagName,close:s.type=="closeTag"}:null},xmlCurrentContext:function(s){for(var C=[],y=s.context;y;y=y.prev)y.tagName&&C.push(y.tagName);return C.reverse()}}}),q.defineMIME("text/xml","xml"),q.defineMIME("application/xml","xml"),q.mimeModes.hasOwnProperty("text/html")||q.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"1j5w":function(Ke,we,U){"use strict";U.d(we,"d",function(){return Ct}),U.d(we,"b",function(){return Te}),U.d(we,"c",function(){return ze}),U.d(we,"a",function(){return yt});var q=U("VTBJ"),z=U("1OyB"),L=U("vuIU"),K=U("JX7q"),I=U("Ji7U"),w=U("LK+K"),B=U("q1tI"),N=U("I8Z2"),A=U("BGR+"),k=U("wx14"),m=U("rePB"),O=U("4IlW"),R=U("2GS6"),_=U("Gytx"),E=U.n(_),g=U("TSYQ"),u=U.n(g),a=U("U8pU"),i=U("ODXe"),c=/iPhone/i,S=/iPod/i,v=/iPad/i,p=/\bAndroid(?:.+)Mobile\b/i,D=/Android/i,b=/\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,C=/BB10/i,y=/Opera Mini/i,x=/\b(CriOS|Chrome)(?:.+)Mobile/i,P=/Mobile(?:.+)Firefox\b/i;function j(st,Be){return st.test(Be)}function Y(st){var Be=st||(typeof navigator!="undefined"?navigator.userAgent:""),Fe=Be.split("[FBAN");if(typeof Fe[1]!="undefined"){var Pe=Fe,oe=Object(i.a)(Pe,1);Be=oe[0]}if(Fe=Be.split("Twitter"),typeof Fe[1]!="undefined"){var fe=Fe,We=Object(i.a)(fe,1);Be=We[0]}var Ie={apple:{phone:j(c,Be)&&!j(d,Be),ipod:j(S,Be),tablet:!j(c,Be)&&j(v,Be)&&!j(d,Be),device:(j(c,Be)||j(S,Be)||j(v,Be))&&!j(d,Be)},amazon:{phone:j(b,Be),tablet:!j(b,Be)&&j(h,Be),device:j(b,Be)||j(h,Be)},android:{phone:!j(d,Be)&&j(b,Be)||!j(d,Be)&&j(p,Be),tablet:!j(d,Be)&&!j(b,Be)&&!j(p,Be)&&(j(h,Be)||j(D,Be)),device:!j(d,Be)&&(j(b,Be)||j(h,Be)||j(p,Be)||j(D,Be))||j(/\bokhttp\b/i,Be)},windows:{phone:j(d,Be),tablet:j(o,Be),device:j(d,Be)||j(o,Be)},other:{blackberry:j(s,Be),blackberry10:j(C,Be),opera:j(y,Be),firefox:j(P,Be),chrome:j(x,Be),device:j(s,Be)||j(C,Be)||j(y,Be)||j(P,Be)||j(x,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(q.a)(Object(q.a)({},Y()),{},{isMobile:Y}),X=Q;function F(){}function $(st,Be,Fe){var Pe=Be||"";return st.key||"".concat(Pe,"item_").concat(Fe)}function re(st){return"".concat(st,"-menu-")}function se(st,Be){var Fe=-1;B.Children.forEach(st,function(Pe){Fe+=1,Pe&&Pe.type&&Pe.type.isMenuItemGroup?B.Children.forEach(Pe.props.children,function(oe){Fe+=1,Be(oe,Fe)}):Be(Pe,Fe)})}function he(st,Be,Fe){if(!st||Fe.find)return;B.Children.forEach(st,function(Pe){if(Pe){var oe=Pe.type;if(!oe||!(oe.isSubMenu||oe.isMenuItem||oe.isMenuItemGroup))return;Be.indexOf(Pe.key)!==-1?Fe.find=!0:Pe.props.children&&he(Pe.props.children,Be,Fe)}})}var _e=["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"],xe=function(Be){var Fe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Pe=Be&&typeof Be.getBoundingClientRect=="function"&&Be.getBoundingClientRect().width;if(Pe){if(Fe){var oe=getComputedStyle(Be),fe=oe.marginLeft,We=oe.marginRight;Pe+=+fe.replace("px","")+ +We.replace("px","")}Pe=+Pe.toFixed(6)}return Pe||0},Ce=function(Be,Fe,Pe){Be&&Object(a.a)(Be.style)==="object"&&(Be.style[Fe]=Pe)},Oe=function(){return X.any},De=U("KQm4"),pe=U("Ff2n"),ue=U("i8i4"),Me=U("bdgK"),at=U("uciX"),lt=U("8XRh"),et={adjustX:1,adjustY:1},Qe={topLeft:{points:["bl","tl"],overflow:et,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:et,offset:[0,7]},leftTop:{points:["tr","tl"],overflow:et,offset:[-4,0]},rightTop:{points:["tl","tr"],overflow:et,offset:[4,0]}},je={topLeft:{points:["bl","tl"],overflow:et,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:et,offset:[0,7]},rightTop:{points:["tr","tl"],overflow:et,offset:[-4,0]},leftTop:{points:["tl","tr"],overflow:et,offset:[4,0]}},Ye=Qe,rt=0,mt={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"},ot=function(Be,Fe,Pe){var oe=re(Fe),fe=Be.getState();Be.setState({defaultActiveFirst:Object(q.a)(Object(q.a)({},fe.defaultActiveFirst),{},Object(m.a)({},oe,Pe))})},qe=function(st){Object(I.a)(Fe,st);var Be=Object(w.a)(Fe);function Fe(Pe){var oe;Object(z.a)(this,Fe),oe=Be.call(this,Pe),oe.onDestroy=function(Ae){oe.props.onDestroy(Ae)},oe.onKeyDown=function(Ae){var nt=Ae.keyCode,gt=oe.menuInstance,Bt=oe.props,pt=Bt.isOpen,sn=Bt.store;if(nt===O.a.ENTER)return oe.onTitleClick(Ae),ot(sn,oe.props.eventKey,!0),!0;if(nt===O.a.RIGHT)return pt?gt.onKeyDown(Ae):(oe.triggerOpenChange(!0),ot(sn,oe.props.eventKey,!0)),!0;if(nt===O.a.LEFT){var gn;if(pt)gn=gt.onKeyDown(Ae);else return;return gn||(oe.triggerOpenChange(!1),gn=!0),gn}return pt&&(nt===O.a.UP||nt===O.a.DOWN)?gt.onKeyDown(Ae):void 0},oe.onOpenChange=function(Ae){oe.props.onOpenChange(Ae)},oe.onPopupVisibleChange=function(Ae){oe.triggerOpenChange(Ae,Ae?"mouseenter":"mouseleave")},oe.onMouseEnter=function(Ae){var nt=oe.props,gt=nt.eventKey,Bt=nt.onMouseEnter,pt=nt.store;ot(pt,oe.props.eventKey,!1),Bt({key:gt,domEvent:Ae})},oe.onMouseLeave=function(Ae){var nt=oe.props,gt=nt.parentMenu,Bt=nt.eventKey,pt=nt.onMouseLeave;gt.subMenuInstance=Object(K.a)(oe),pt({key:Bt,domEvent:Ae})},oe.onTitleMouseEnter=function(Ae){var nt=oe.props,gt=nt.eventKey,Bt=nt.onItemHover,pt=nt.onTitleMouseEnter;Bt({key:gt,hover:!0}),pt({key:gt,domEvent:Ae})},oe.onTitleMouseLeave=function(Ae){var nt=oe.props,gt=nt.parentMenu,Bt=nt.eventKey,pt=nt.onItemHover,sn=nt.onTitleMouseLeave;gt.subMenuInstance=Object(K.a)(oe),pt({key:Bt,hover:!1}),sn({key:Bt,domEvent:Ae})},oe.onTitleClick=function(Ae){var nt=Object(K.a)(oe),gt=nt.props;if(gt.onTitleClick({key:gt.eventKey,domEvent:Ae}),gt.triggerSubMenuAction==="hover")return;oe.triggerOpenChange(!gt.isOpen,"click"),ot(gt.store,oe.props.eventKey,!1)},oe.onSubMenuClick=function(Ae){typeof oe.props.onClick=="function"&&oe.props.onClick(oe.addKeyPath(Ae))},oe.onSelect=function(Ae){oe.props.onSelect(Ae)},oe.onDeselect=function(Ae){oe.props.onDeselect(Ae)},oe.getPrefixCls=function(){return"".concat(oe.props.rootPrefixCls,"-submenu")},oe.getActiveClassName=function(){return"".concat(oe.getPrefixCls(),"-active")},oe.getDisabledClassName=function(){return"".concat(oe.getPrefixCls(),"-disabled")},oe.getSelectedClassName=function(){return"".concat(oe.getPrefixCls(),"-selected")},oe.getOpenClassName=function(){return"".concat(oe.props.rootPrefixCls,"-submenu-open")},oe.saveMenuInstance=function(Ae){oe.menuInstance=Ae},oe.addKeyPath=function(Ae){return Object(q.a)(Object(q.a)({},Ae),{},{keyPath:(Ae.keyPath||[]).concat(oe.props.eventKey)})},oe.triggerOpenChange=function(Ae,nt){var gt=oe.props.eventKey,Bt=function(){oe.onOpenChange({key:gt,item:Object(K.a)(oe),trigger:nt,open:Ae})};nt==="mouseenter"?oe.mouseenterTimeout=setTimeout(function(){Bt()},0):Bt()},oe.isChildrenSelected=function(){var Ae={find:!1};return he(oe.props.children,oe.props.selectedKeys,Ae),Ae.find},oe.isOpen=function(){return oe.props.openKeys.indexOf(oe.props.eventKey)!==-1},oe.adjustWidth=function(){if(!oe.subMenuTitle||!oe.menuInstance)return;var Ae=ue.findDOMNode(oe.menuInstance);if(Ae.offsetWidth>=oe.subMenuTitle.offsetWidth)return;Ae.style.minWidth="".concat(oe.subMenuTitle.offsetWidth,"px")},oe.saveSubMenuTitle=function(Ae){oe.subMenuTitle=Ae},oe.getBaseProps=function(){var Ae=Object(K.a)(oe),nt=Ae.props;return{mode:nt.mode==="horizontal"?"vertical":nt.mode,visible:oe.props.isOpen,level:nt.level+1,inlineIndent:nt.inlineIndent,focusable:!1,onClick:oe.onSubMenuClick,onSelect:oe.onSelect,onDeselect:oe.onDeselect,onDestroy:oe.onDestroy,selectedKeys:nt.selectedKeys,eventKey:"".concat(nt.eventKey,"-menu-"),openKeys:nt.openKeys,motion:nt.motion,onOpenChange:oe.onOpenChange,subMenuOpenDelay:nt.subMenuOpenDelay,parentMenu:Object(K.a)(oe),subMenuCloseDelay:nt.subMenuCloseDelay,forceSubMenuRender:nt.forceSubMenuRender,triggerSubMenuAction:nt.triggerSubMenuAction,builtinPlacements:nt.builtinPlacements,defaultActiveFirst:nt.store.getState().defaultActiveFirst[re(nt.eventKey)],multiple:nt.multiple,prefixCls:nt.rootPrefixCls,id:oe.internalMenuId,manualRef:oe.saveMenuInstance,itemIcon:nt.itemIcon,expandIcon:nt.expandIcon,direction:nt.direction}},oe.getMotion=function(Ae,nt){var gt=Object(K.a)(oe),Bt=gt.haveRendered,pt=oe.props,sn=pt.motion,gn=pt.rootPrefixCls,en=Object(q.a)(Object(q.a)({},sn),{},{leavedClassName:"".concat(gn,"-hidden"),removeOnLeave:!1,motionAppear:Bt||!nt||Ae!=="inline"});return en};var fe=Pe.store,We=Pe.eventKey,Ie=fe.getState(),tt=Ie.defaultActiveFirst;oe.isRootMenu=!1;var ft=!1;return tt&&(ft=tt[We]),ot(fe,We,ft),oe}return Object(L.a)(Fe,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var oe=this,fe=this.props,We=fe.mode,Ie=fe.parentMenu,tt=fe.manualRef;if(tt&&tt(this),We!=="horizontal"||!Ie.isRootMenu||!this.props.isOpen)return;this.minWidthTimeout=setTimeout(function(){return oe.adjustWidth()},0)}},{key:"componentWillUnmount",value:function(){var oe=this.props,fe=oe.onDestroy,We=oe.eventKey;fe&&fe(We),this.minWidthTimeout&&clearTimeout(this.minWidthTimeout),this.mouseenterTimeout&&clearTimeout(this.mouseenterTimeout)}},{key:"renderChildren",value:function(oe){var fe=this,We=this.getBaseProps(),Ie=this.getMotion(We.mode,We.visible);if(this.haveRendered=!0,this.haveOpened=this.haveOpened||We.visible||We.forceSubMenuRender,!this.haveOpened)return B.createElement("div",null);var tt=We.direction;return B.createElement(lt.default,Object.assign({visible:We.visible},Ie),function(ft){var Ae=ft.className,nt=ft.style,gt=u()("".concat(We.prefixCls,"-sub"),Ae,Object(m.a)({},"".concat(We.prefixCls,"-rtl"),tt==="rtl"));return B.createElement(ge,Object.assign({},We,{id:fe.internalMenuId,className:gt,style:nt}),oe)})}},{key:"render",value:function(){var oe,fe=Object(q.a)({},this.props),We=fe.isOpen,Ie=this.getPrefixCls(),tt=fe.mode==="inline",ft=u()(Ie,"".concat(Ie,"-").concat(fe.mode),(oe={},Object(m.a)(oe,fe.className,!!fe.className),Object(m.a)(oe,this.getOpenClassName(),We),Object(m.a)(oe,this.getActiveClassName(),fe.active||We&&!tt),Object(m.a)(oe,this.getDisabledClassName(),fe.disabled),Object(m.a)(oe,this.getSelectedClassName(),this.isChildrenSelected()),oe));this.internalMenuId||(fe.eventKey?this.internalMenuId="".concat(fe.eventKey,"$Menu"):(rt+=1,this.internalMenuId="$__$".concat(rt,"$Menu")));var Ae={},nt={},gt={};fe.disabled||(Ae={onMouseLeave:this.onMouseLeave,onMouseEnter:this.onMouseEnter},nt={onClick:this.onTitleClick},gt={onMouseEnter:this.onTitleMouseEnter,onMouseLeave:this.onTitleMouseLeave});var Bt={},pt=fe.direction;tt&&(pt==="rtl"?Bt.paddingRight=fe.inlineIndent*fe.level:Bt.paddingLeft=fe.inlineIndent*fe.level);var sn={};this.props.isOpen&&(sn={"aria-owns":this.internalMenuId});var gn=null;fe.mode!=="horizontal"&&(gn=this.props.expandIcon,typeof this.props.expandIcon=="function"&&(gn=B.createElement(this.props.expandIcon,Object(q.a)({},this.props))));var en=B.createElement("div",Object.assign({ref:this.saveSubMenuTitle,style:Bt,className:"".concat(Ie,"-title"),role:"button"},gt,nt,{"aria-expanded":We},sn,{"aria-haspopup":"true",title:typeof fe.title=="string"?fe.title:void 0}),fe.title,gn||B.createElement("i",{className:"".concat(Ie,"-arrow")})),Dt=this.renderChildren(fe.children),Sn=fe.parentMenu.isRootMenu?fe.parentMenu.props.getPopupContainer:function(mn){return mn.parentNode},Nn=mt[fe.mode],Ne=fe.popupOffset?{offset:fe.popupOffset}:{},it=fe.mode==="inline"?"":fe.popupClassName;it+=pt==="rtl"?" ".concat(Ie,"-rtl"):"";var Pt=fe.disabled,Qt=fe.triggerSubMenuAction,un=fe.subMenuOpenDelay,$e=fe.forceSubMenuRender,Ot=fe.subMenuCloseDelay,Ht=fe.builtinPlacements;_e.forEach(function(mn){return delete fe[mn]}),delete fe.onClick;var jt=pt==="rtl"?Object.assign({},je,Ht):Object.assign({},Qe,Ht);return delete fe.direction,B.createElement("li",Object.assign({},fe,Ae,{className:ft,role:"menuitem"}),tt&&en,tt&&Dt,!tt&&B.createElement(at.a,{prefixCls:Ie,popupClassName:u()("".concat(Ie,"-popup"),it),getPopupContainer:Sn,builtinPlacements:jt,popupPlacement:Nn,popupVisible:We,popupAlign:Ne,popup:Dt,action:Pt?[]:[Qt],mouseEnterDelay:un,mouseLeaveDelay:Ot,onPopupVisibleChange:this.onPopupVisibleChange,forceRender:$e},en))}}]),Fe}(B.Component);qe.defaultProps={onMouseEnter:F,onMouseLeave:F,onTitleMouseEnter:F,onTitleMouseLeave:F,onTitleClick:F,manualRef:F,mode:"vertical",title:""};var Xe=Object(N.b)(function(st,Be){var Fe=st.openKeys,Pe=st.activeKey,oe=st.selectedKeys,fe=Be.eventKey,We=Be.subMenuKey;return{isOpen:Fe.indexOf(fe)>-1,active:Pe[We]===fe,selectedKeys:oe}})(qe);Xe.isSubMenu=!0;var Ct=Xe,xt="menuitem-overflowed",bt=.5,Et=function(st){Object(I.a)(Fe,st);var Be=Object(w.a)(Fe);function Fe(){var Pe;return Object(z.a)(this,Fe),Pe=Be.apply(this,arguments),Pe.resizeObserver=null,Pe.mutationObserver=null,Pe.originalTotalWidth=0,Pe.overflowedItems=[],Pe.menuItemSizes=[],Pe.cancelFrameId=null,Pe.state={lastVisibleIndex:void 0},Pe.getMenuItemNodes=function(){var oe=Pe.props.prefixCls,fe=ue.findDOMNode(Object(K.a)(Pe));return fe?[].slice.call(fe.children).filter(function(We){return We.className.split(" ").indexOf("".concat(oe,"-overflowed-submenu"))<0}):[]},Pe.getOverflowedSubMenuItem=function(oe,fe,We){var Ie=Pe.props,tt=Ie.overflowedIndicator,ft=Ie.level,Ae=Ie.mode,nt=Ie.prefixCls,gt=Ie.theme;if(ft!==1||Ae!=="horizontal")return null;var Bt=Pe.props.children[0],pt=Bt.props,sn=pt.children,gn=pt.title,en=pt.style,Dt=Object(pe.a)(pt,["children","title","style"]),Sn=Object(q.a)({},en),Nn="".concat(oe,"-overflowed-indicator"),Ne="".concat(oe,"-overflowed-indicator");fe.length===0&&We!==!0?Sn=Object(q.a)(Object(q.a)({},Sn),{},{display:"none"}):We&&(Sn=Object(q.a)(Object(q.a)({},Sn),{},{visibility:"hidden",position:"absolute"}),Nn="".concat(Nn,"-placeholder"),Ne="".concat(Ne,"-placeholder"));var it=gt?"".concat(nt,"-").concat(gt):"",Pt={};return _e.forEach(function(Qt){Dt[Qt]!==void 0&&(Pt[Qt]=Dt[Qt])}),B.createElement(Ct,Object.assign({title:tt,className:"".concat(nt,"-overflowed-submenu"),popupClassName:it},Pt,{key:Nn,eventKey:Ne,disabled:!1,style:Sn}),fe)},Pe.setChildrenWidthAndResize=function(){if(Pe.props.mode!=="horizontal")return;var oe=ue.findDOMNode(Object(K.a)(Pe));if(!oe)return;var fe=oe.children;if(!fe||fe.length===0)return;var We=oe.children[fe.length-1];Ce(We,"display","inline-block");var Ie=Pe.getMenuItemNodes(),tt=Ie.filter(function(ft){return ft.className.split(" ").indexOf(xt)>=0});tt.forEach(function(ft){Ce(ft,"display","inline-block")}),Pe.menuItemSizes=Ie.map(function(ft){return xe(ft,!0)}),tt.forEach(function(ft){Ce(ft,"display","none")}),Pe.overflowedIndicatorWidth=xe(oe.children[oe.children.length-1],!0),Pe.originalTotalWidth=Pe.menuItemSizes.reduce(function(ft,Ae){return ft+Ae},0),Pe.handleResize(),Ce(We,"display","none")},Pe.handleResize=function(){if(Pe.props.mode!=="horizontal")return;var oe=ue.findDOMNode(Object(K.a)(Pe));if(!oe)return;var fe=xe(oe);Pe.overflowedItems=[];var We=0,Ie;Pe.originalTotalWidth>fe+bt&&(Ie=-1,Pe.menuItemSizes.forEach(function(tt){We+=tt,We+Pe.overflowedIndicatorWidth<=fe&&(Ie+=1)})),Pe.setState({lastVisibleIndex:Ie})},Pe}return Object(L.a)(Fe,[{key:"componentDidMount",value:function(){var oe=this;if(this.setChildrenWidthAndResize(),this.props.level===1&&this.props.mode==="horizontal"){var fe=ue.findDOMNode(this);if(!fe)return;this.resizeObserver=new Me.default(function(We){We.forEach(function(){var Ie=oe.cancelFrameId;cancelAnimationFrame(Ie),oe.cancelFrameId=requestAnimationFrame(oe.setChildrenWidthAndResize)})}),[].slice.call(fe.children).concat(fe).forEach(function(We){oe.resizeObserver.observe(We)}),typeof MutationObserver!="undefined"&&(this.mutationObserver=new MutationObserver(function(){oe.resizeObserver.disconnect(),[].slice.call(fe.children).concat(fe).forEach(function(We){oe.resizeObserver.observe(We)}),oe.setChildrenWidthAndResize()}),this.mutationObserver.observe(fe,{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(oe){var fe=this,We=this.state.lastVisibleIndex;return(oe||[]).reduce(function(Ie,tt,ft){var Ae=tt;if(fe.props.mode==="horizontal"){var nt=fe.getOverflowedSubMenuItem(tt.props.eventKey,[]);We!==void 0&&fe.props.className.indexOf("".concat(fe.props.prefixCls,"-root"))!==-1&&(ft>We&&(Ae=B.cloneElement(tt,{style:{display:"none"},eventKey:"".concat(tt.props.eventKey,"-hidden"),className:"".concat(xt)})),ft===We+1&&(fe.overflowedItems=oe.slice(We+1).map(function(Bt){return B.cloneElement(Bt,{key:Bt.props.eventKey,mode:"vertical-left"})}),nt=fe.getOverflowedSubMenuItem(tt.props.eventKey,fe.overflowedItems)));var gt=[].concat(Object(De.a)(Ie),[nt,Ae]);return ft===oe.length-1&>.push(fe.getOverflowedSubMenuItem(tt.props.eventKey,[],!0)),gt}return[].concat(Object(De.a)(Ie),[Ae])},[])}},{key:"render",value:function(){var oe=this.props,fe=oe.visible,We=oe.prefixCls,Ie=oe.overflowedIndicator,tt=oe.mode,ft=oe.level,Ae=oe.tag,nt=oe.children,gt=oe.theme,Bt=Object(pe.a)(oe,["visible","prefixCls","overflowedIndicator","mode","level","tag","children","theme"]),pt=Ae;return B.createElement(pt,Object.assign({},Bt),this.renderChildren(nt))}}]),Fe}(B.Component);Et.defaultProps={tag:"div",className:""};var At=Et;function St(st){return st.length?st.every(function(Be){return!!Be.props.disabled}):!0}function Se(st,Be,Fe){var Pe=st.getState();st.setState({activeKey:Object(q.a)(Object(q.a)({},Pe.activeKey),{},Object(m.a)({},Be,Fe))})}function Ee(st){return st.eventKey||"0-menu-"}function He(st,Be){var Fe=Be,Pe=st.children,oe=st.eventKey;if(Fe){var fe;if(se(Pe,function(We,Ie){We&&We.props&&!We.props.disabled&&Fe===$(We,oe,Ie)&&(fe=!0)}),fe)return Fe}return Fe=null,st.defaultActiveFirst&&se(Pe,function(We,Ie){!Fe&&We&&!We.props.disabled&&(Fe=$(We,oe,Ie))}),Fe}function Ge(st){if(st){var Be=this.instanceArray.indexOf(st);Be!==-1?this.instanceArray[Be]=st:this.instanceArray.push(st)}}var Re=function(st){Object(I.a)(Fe,st);var Be=Object(w.a)(Fe);function Fe(Pe){var oe;return Object(z.a)(this,Fe),oe=Be.call(this,Pe),oe.onKeyDown=function(fe,We){var Ie=fe.keyCode,tt;if(oe.getFlatInstanceArray().forEach(function(Ae){Ae&&Ae.props.active&&Ae.onKeyDown&&(tt=Ae.onKeyDown(fe))}),tt)return 1;var ft=null;return(Ie===O.a.UP||Ie===O.a.DOWN)&&(ft=oe.step(Ie===O.a.UP?-1:1)),ft?(fe.preventDefault(),Se(oe.props.store,Ee(oe.props),ft.props.eventKey),typeof We=="function"&&We(ft),1):void 0},oe.onItemHover=function(fe){var We=fe.key,Ie=fe.hover;Se(oe.props.store,Ee(oe.props),Ie?We:null)},oe.onDeselect=function(fe){oe.props.onDeselect(fe)},oe.onSelect=function(fe){oe.props.onSelect(fe)},oe.onClick=function(fe){oe.props.onClick(fe)},oe.onOpenChange=function(fe){oe.props.onOpenChange(fe)},oe.onDestroy=function(fe){oe.props.onDestroy(fe)},oe.getFlatInstanceArray=function(){return oe.instanceArray},oe.step=function(fe){var We=oe.getFlatInstanceArray(),Ie=oe.props.store.getState().activeKey[Ee(oe.props)],tt=We.length;if(!tt)return null;fe<0&&(We=We.concat().reverse());var ft=-1;if(We.every(function(Bt,pt){return Bt&&Bt.props.eventKey===Ie?(ft=pt,!1):!0}),!oe.props.defaultActiveFirst&&ft!==-1&&St(We.slice(ft,tt-1)))return;var Ae=(ft+1)%tt,nt=Ae;do{var gt=We[nt];if(!gt||gt.props.disabled)nt=(nt+1)%tt;else return gt}while(nt!==Ae);return null},oe.renderCommonMenuItem=function(fe,We,Ie){var tt=oe.props.store.getState(),ft=Object(K.a)(oe),Ae=ft.props,nt=$(fe,Ae.eventKey,We),gt=fe.props;if(!gt||typeof fe.type=="string")return fe;var Bt=nt===tt.activeKey,pt=Object(q.a)(Object(q.a)({mode:gt.mode||Ae.mode,level:Ae.level,inlineIndent:Ae.inlineIndent,renderMenuItem:oe.renderMenuItem,rootPrefixCls:Ae.prefixCls,index:We,parentMenu:Ae.parentMenu,manualRef:gt.disabled?void 0:Object(R.a)(fe.ref,Ge.bind(Object(K.a)(oe))),eventKey:nt,active:!gt.disabled&&Bt,multiple:Ae.multiple,onClick:function(gn){(gt.onClick||F)(gn),oe.onClick(gn)},onItemHover:oe.onItemHover,motion:Ae.motion,subMenuOpenDelay:Ae.subMenuOpenDelay,subMenuCloseDelay:Ae.subMenuCloseDelay,forceSubMenuRender:Ae.forceSubMenuRender,onOpenChange:oe.onOpenChange,onDeselect:oe.onDeselect,onSelect:oe.onSelect,builtinPlacements:Ae.builtinPlacements,itemIcon:gt.itemIcon||oe.props.itemIcon,expandIcon:gt.expandIcon||oe.props.expandIcon},Ie),{},{direction:Ae.direction});return(Ae.mode==="inline"||Oe())&&(pt.triggerSubMenuAction="click"),B.cloneElement(fe,pt)},oe.renderMenuItem=function(fe,We,Ie){if(!fe)return null;var tt=oe.props.store.getState(),ft={openKeys:tt.openKeys,selectedKeys:tt.selectedKeys,triggerSubMenuAction:oe.props.triggerSubMenuAction,subMenuKey:Ie};return oe.renderCommonMenuItem(fe,We,ft)},Pe.store.setState({activeKey:Object(q.a)(Object(q.a)({},Pe.store.getState().activeKey),{},Object(m.a)({},Pe.eventKey,He(Pe,Pe.activeKey)))}),oe.instanceArray=[],oe}return Object(L.a)(Fe,[{key:"componentDidMount",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"shouldComponentUpdate",value:function(oe){return this.props.visible||oe.visible||this.props.className!==oe.className||!E()(this.props.style,oe.style)}},{key:"componentDidUpdate",value:function(oe){var fe=this.props,We="activeKey"in fe?fe.activeKey:fe.store.getState().activeKey[Ee(fe)],Ie=He(fe,We);if(Ie!==We)Se(fe.store,Ee(fe),Ie);else if("activeKey"in oe){var tt=He(oe,oe.activeKey);Ie!==tt&&Se(fe.store,Ee(fe),Ie)}}},{key:"render",value:function(){var oe=this,fe=Object(k.a)({},this.props);this.instanceArray=[];var We=u()(fe.prefixCls,fe.className,"".concat(fe.prefixCls,"-").concat(fe.mode)),Ie={className:We,role:fe.role||"menu"};fe.id&&(Ie.id=fe.id),fe.focusable&&(Ie.tabIndex=0,Ie.onKeyDown=this.onKeyDown);var tt=fe.prefixCls,ft=fe.eventKey,Ae=fe.visible,nt=fe.level,gt=fe.mode,Bt=fe.overflowedIndicator,pt=fe.theme;return _e.forEach(function(sn){return delete fe[sn]}),delete fe.onClick,B.createElement(At,Object.assign({},fe,{prefixCls:tt,mode:gt,tag:"ul",level:nt,theme:pt,visible:Ae,overflowedIndicator:Bt},Ie),B.Children.map(fe.children,function(sn,gn){return oe.renderMenuItem(sn,gn,ft||"0-menu-")}))}}]),Fe}(B.Component);Re.defaultProps={prefixCls:"rc-menu",className:"",mode:"vertical",level:1,inlineIndent:24,visible:!0,focusable:!0,style:{},manualRef:F};var Ue=Object(N.b)()(Re),ge=Ue,de=U("Kwbf");function ce(st,Be,Fe){var Pe=st.prefixCls,oe=st.motion,fe=st.defaultMotions,We=fe===void 0?{}:fe,Ie=st.openAnimation,tt=st.openTransitionName,ft=Be.switchingModeFromInline;if(oe)return oe;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(Pe,"-open-").concat(Ie)};if(tt)return{motionName:tt};var Ae=We[Fe];return Ae||(ft?null:We.other)}var te=function(st){Object(I.a)(Fe,st);var Be=Object(w.a)(Fe);function Fe(Pe){var oe;Object(z.a)(this,Fe),oe=Be.call(this,Pe),oe.inlineOpenKeys=[],oe.onSelect=function(Ie){var tt=Object(K.a)(oe),ft=tt.props;if(ft.selectable){var Ae=oe.store.getState(),nt=Ae.selectedKeys,gt=Ie.key;ft.multiple?nt=nt.concat([gt]):nt=[gt],"selectedKeys"in ft||oe.store.setState({selectedKeys:nt}),ft.onSelect(Object(q.a)(Object(q.a)({},Ie),{},{selectedKeys:nt}))}},oe.onClick=function(Ie){var tt=oe.getRealMenuMode(),ft=Object(K.a)(oe),Ae=ft.store,nt=ft.props.onOpenChange;tt!=="inline"&&!("openKeys"in oe.props)&&(Ae.setState({openKeys:[]}),nt([])),oe.props.onClick(Ie)},oe.onKeyDown=function(Ie,tt){oe.innerMenu.getWrappedInstance().onKeyDown(Ie,tt)},oe.onOpenChange=function(Ie){var tt=Object(K.a)(oe),ft=tt.props,Ae=oe.store.getState().openKeys.concat(),nt=!1,gt=function(pt){var sn=!1;if(pt.open)sn=Ae.indexOf(pt.key)===-1,sn&&Ae.push(pt.key);else{var gn=Ae.indexOf(pt.key);sn=gn!==-1,sn&&Ae.splice(gn,1)}nt=nt||sn};Array.isArray(Ie)?Ie.forEach(gt):gt(Ie),nt&&("openKeys"in oe.props||oe.store.setState({openKeys:Ae}),ft.onOpenChange(Ae))},oe.onDeselect=function(Ie){var tt=Object(K.a)(oe),ft=tt.props;if(ft.selectable){var Ae=oe.store.getState().selectedKeys.concat(),nt=Ie.key,gt=Ae.indexOf(nt);gt!==-1&&Ae.splice(gt,1),"selectedKeys"in ft||oe.store.setState({selectedKeys:Ae}),ft.onDeselect(Object(q.a)(Object(q.a)({},Ie),{},{selectedKeys:Ae}))}},oe.onMouseEnter=function(Ie){oe.restoreModeVerticalFromInline();var tt=oe.props.onMouseEnter;tt&&tt(Ie)},oe.onTransitionEnd=function(Ie){var tt=Ie.propertyName==="width"&&Ie.target===Ie.currentTarget,ft=Ie.target.className,Ae=Object.prototype.toString.call(ft)==="[object SVGAnimatedString]"?ft.animVal:ft,nt=Ie.propertyName==="font-size"&&Ae.indexOf("anticon")>=0;(tt||nt)&&oe.restoreModeVerticalFromInline()},oe.setInnerMenu=function(Ie){oe.innerMenu=Ie},oe.isRootMenu=!0;var fe=Pe.defaultSelectedKeys,We=Pe.defaultOpenKeys;return"selectedKeys"in Pe&&(fe=Pe.selectedKeys||[]),"openKeys"in Pe&&(We=Pe.openKeys||[]),oe.store=Object(N.c)({selectedKeys:fe,openKeys:We,activeKey:{"0-menu-":He(Pe,Pe.activeKey)}}),oe.state={switchingModeFromInline:!1},oe}return Object(L.a)(Fe,[{key:"componentDidMount",value:function(){this.updateMiniStore(),this.updateMenuDisplay()}},{key:"componentDidUpdate",value:function(oe){this.updateOpentKeysWhenSwitchMode(oe),this.updateMiniStore();var fe=this.props,We=fe.siderCollapsed,Ie=fe.inlineCollapsed,tt=fe.onOpenChange;(!oe.inlineCollapsed&&Ie||!oe.siderCollapsed&&We)&&tt([]),this.updateMenuDisplay()}},{key:"updateOpentKeysWhenSwitchMode",value:function(oe){var fe=this.props,We=this.store,Ie=this.inlineOpenKeys,tt=We.getState(),ft={};oe.mode==="inline"&&fe.mode!=="inline"&&this.setState({switchingModeFromInline:!0}),"openKeys"in fe||((fe.inlineCollapsed&&!oe.inlineCollapsed||fe.siderCollapsed&&!oe.siderCollapsed)&&(this.setState({switchingModeFromInline:!0}),this.inlineOpenKeys=tt.openKeys.concat(),ft.openKeys=[]),(!fe.inlineCollapsed&&oe.inlineCollapsed||!fe.siderCollapsed&&oe.siderCollapsed)&&(ft.openKeys=Ie,this.inlineOpenKeys=[])),Object.keys(ft).length&&We.setState(ft)}},{key:"updateMenuDisplay",value:function(){var oe=this.props.collapsedWidth,fe=this.store,We=this.prevOpenKeys,Ie=this.getInlineCollapsed()&&(oe===0||oe==="0"||oe==="0px");Ie?(this.prevOpenKeys=fe.getState().openKeys.concat(),this.store.setState({openKeys:[]})):We&&(this.store.setState({openKeys:We}),this.prevOpenKeys=null)}},{key:"getRealMenuMode",value:function(){var oe=this.props.mode,fe=this.state.switchingModeFromInline,We=this.getInlineCollapsed();return fe&&We?"inline":We?"vertical":oe}},{key:"getInlineCollapsed",value:function(){var oe=this.props,fe=oe.inlineCollapsed,We=oe.siderCollapsed;return We!==void 0?We:fe}},{key:"restoreModeVerticalFromInline",value:function(){var oe=this.state.switchingModeFromInline;oe&&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 oe=Object(q.a)({},Object(A.default)(this.props,["collapsedWidth","siderCollapsed","defaultMotions"])),fe=this.getRealMenuMode();return oe.className+=" ".concat(oe.prefixCls,"-root"),oe.direction==="rtl"&&(oe.className+=" ".concat(oe.prefixCls,"-rtl")),oe=Object(q.a)(Object(q.a)({},oe),{},{mode:fe,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,fe)}),delete oe.openAnimation,delete oe.openTransitionName,B.createElement(N.a,{store:this.store},B.createElement(ge,Object.assign({},oe,{ref:this.setInnerMenu}),this.props.children))}}]),Fe}(B.Component);te.defaultProps={selectable:!0,onClick:F,onSelect:F,onOpenChange:F,onDeselect:F,defaultSelectedKeys:[],defaultOpenKeys:[],subMenuOpenDelay:.1,subMenuCloseDelay:.1,triggerSubMenuAction:"hover",prefixCls:"rc-menu",className:"",mode:"vertical",style:{},builtinPlacements:{},overflowedIndicator:B.createElement("span",null,"\xB7\xB7\xB7")};var ie=te,ae=function(st){Object(I.a)(Fe,st);var Be=Object(w.a)(Fe);function Fe(){var Pe;return Object(z.a)(this,Fe),Pe=Be.apply(this,arguments),Pe.onKeyDown=function(oe){var fe=oe.keyCode;return fe===O.a.ENTER?(Pe.onClick(oe),!0):void 0},Pe.onMouseLeave=function(oe){var fe=Pe.props,We=fe.eventKey,Ie=fe.onItemHover,tt=fe.onMouseLeave;Ie({key:We,hover:!1}),tt({key:We,domEvent:oe})},Pe.onMouseEnter=function(oe){var fe=Pe.props,We=fe.eventKey,Ie=fe.onItemHover,tt=fe.onMouseEnter;Ie({key:We,hover:!0}),tt({key:We,domEvent:oe})},Pe.onClick=function(oe){var fe=Pe.props,We=fe.eventKey,Ie=fe.multiple,tt=fe.onClick,ft=fe.onSelect,Ae=fe.onDeselect,nt=fe.isSelected,gt={key:We,keyPath:[We],item:Object(K.a)(Pe),domEvent:oe};tt(gt),Ie?nt?Ae(gt):ft(gt):nt||ft(gt)},Pe.saveNode=function(oe){Pe.node=oe},Pe}return Object(L.a)(Fe,[{key:"componentDidMount",value:function(){this.callRef()}},{key:"componentDidUpdate",value:function(){this.callRef()}},{key:"componentWillUnmount",value:function(){var oe=this.props;oe.onDestroy&&oe.onDestroy(oe.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 oe,fe=Object(q.a)({},this.props),We=u()(this.getPrefixCls(),fe.className,(oe={},Object(m.a)(oe,this.getActiveClassName(),!fe.disabled&&fe.active),Object(m.a)(oe,this.getSelectedClassName(),fe.isSelected),Object(m.a)(oe,this.getDisabledClassName(),fe.disabled),oe)),Ie=Object(q.a)(Object(q.a)({},fe.attribute),{},{title:typeof fe.title=="string"?fe.title:void 0,className:We,role:fe.role||"menuitem","aria-disabled":fe.disabled});fe.role==="option"?Ie=Object(q.a)(Object(q.a)({},Ie),{},{role:"option","aria-selected":fe.isSelected}):(fe.role===null||fe.role==="none")&&(Ie.role="none");var tt={onClick:fe.disabled?null:this.onClick,onMouseLeave:fe.disabled?null:this.onMouseLeave,onMouseEnter:fe.disabled?null:this.onMouseEnter},ft=Object(q.a)({},fe.style);fe.mode==="inline"&&(fe.direction==="rtl"?ft.paddingRight=fe.inlineIndent*fe.level:ft.paddingLeft=fe.inlineIndent*fe.level),_e.forEach(function(nt){return delete fe[nt]}),delete fe.direction;var Ae=this.props.itemIcon;return typeof this.props.itemIcon=="function"&&(Ae=B.createElement(this.props.itemIcon,this.props)),B.createElement("li",Object.assign({},Object(A.default)(fe,["onClick","onMouseEnter","onMouseLeave","onSelect"]),Ie,tt,{style:ft,ref:this.saveNode}),fe.children,Ae)}}]),Fe}(B.Component);ae.isMenuItem=!0,ae.defaultProps={onSelect:F,onMouseEnter:F,onMouseLeave:F,manualRef:F};var le=Object(N.b)(function(st,Be){var Fe=st.activeKey,Pe=st.selectedKeys,oe=Be.eventKey,fe=Be.subMenuKey;return{active:Fe[fe]===oe,isSelected:Pe.indexOf(oe)!==-1}})(ae),Te=le,be=function(st){Object(I.a)(Fe,st);var Be=Object(w.a)(Fe);function Fe(){var Pe;return Object(z.a)(this,Fe),Pe=Be.apply(this,arguments),Pe.renderInnerMenuItem=function(oe){var fe=Pe.props,We=fe.renderMenuItem,Ie=fe.index;return We(oe,Ie,Pe.props.subMenuKey)},Pe}return Object(L.a)(Fe,[{key:"render",value:function(){var oe=Object(k.a)({},this.props),fe=oe.className,We=fe===void 0?"":fe,Ie=oe.rootPrefixCls,tt="".concat(Ie,"-item-group-title"),ft="".concat(Ie,"-item-group-list"),Ae=oe.title,nt=oe.children;return _e.forEach(function(gt){return delete oe[gt]}),delete oe.onClick,delete oe.direction,B.createElement("li",Object.assign({},oe,{className:"".concat(We," ").concat(Ie,"-item-group")}),B.createElement("div",{className:tt,title:typeof Ae=="string"?Ae:void 0},Ae),B.createElement("ul",{className:ft},B.Children.map(nt,this.renderInnerMenuItem)))}}]),Fe}(B.Component);be.isMenuItemGroup=!0,be.defaultProps={disabled:!0};var ze=be,dt=function(Be){var Fe=Be.className,Pe=Be.rootPrefixCls,oe=Be.style;return B.createElement("li",{className:"".concat(Fe," ").concat(Pe,"-item-divider"),style:oe})};dt.defaultProps={disabled:!0,className:"",style:{}};var yt=dt,ct=we.e=ie},"55Ip":function(Ke,we,U){"use strict";U.d(we,"a",function(){return i}),U.d(we,"b",function(){return b});var q=U("Ty5D"),z=U("dI71"),L=U("q1tI"),K=U.n(L),I=U("YS25"),w=U("17x9"),B=U.n(w),N=U("wx14"),A=U("zLVn"),k=U("9R94"),m=function(d){Object(z.a)(o,d);function o(){for(var C,y=arguments.length,x=new Array(y),P=0;P<y;P++)x[P]=arguments[P];return C=d.call.apply(d,[this].concat(x))||this,C.history=Object(I.a)(C.props),C}var s=o.prototype;return s.render=function(){return K.a.createElement(q.c,{history:this.history,children:this.props.children})},o}(K.a.Component),O=function(d){Object(z.a)(o,d);function o(){for(var C,y=arguments.length,x=new Array(y),P=0;P<y;P++)x[P]=arguments[P];return C=d.call.apply(d,[this].concat(x))||this,C.history=Object(I.b)(C.props),C}var s=o.prototype;return s.render=function(){return K.a.createElement(q.c,{history:this.history,children:this.props.children})},o}(K.a.Component),R=function(o,s){return typeof o=="function"?o(s):o},_=function(o,s){return typeof o=="string"?Object(I.c)(o,null,null,s):o},E=function(o){return o},g=K.a.forwardRef;typeof g=="undefined"&&(g=E);function u(d){return!!(d.metaKey||d.altKey||d.ctrlKey||d.shiftKey)}var a=g(function(d,o){var s=d.innerRef,C=d.navigate,y=d.onClick,x=Object(A.a)(d,["innerRef","navigate","onClick"]),P=x.target,j=Object(N.a)({},x,{onClick:function(Q){try{y&&y(Q)}catch(X){throw Q.preventDefault(),X}!Q.defaultPrevented&&Q.button===0&&(!P||P==="_self")&&!u(Q)&&(Q.preventDefault(),C())}});return E!==g?j.ref=o||s:j.ref=s,K.a.createElement("a",j)}),i=g(function(d,o){var s=d.component,C=s===void 0?a:s,y=d.replace,x=d.to,P=d.innerRef,j=Object(A.a)(d,["component","replace","to","innerRef"]);return K.a.createElement(q.e.Consumer,null,function(Y){Y||Object(k.a)(!1);var Q=Y.history,X=_(R(x,Y.location),Y.location),F=X?Q.createHref(X):"",$=Object(N.a)({},j,{href:F,navigate:function(){var se=R(x,Y.location),he=y?Q.replace:Q.push;he(se)}});return E!==g?$.ref=o||P:$.innerRef=P,K.a.createElement(C,$)})});if(!1)var c,S;var v=function(o){return o},p=K.a.forwardRef;typeof p=="undefined"&&(p=v);function D(){for(var d=arguments.length,o=new Array(d),s=0;s<d;s++)o[s]=arguments[s];return o.filter(function(C){return C}).join(" ")}var b=p(function(d,o){var s=d["aria-current"],C=s===void 0?"page":s,y=d.activeClassName,x=y===void 0?"active":y,P=d.activeStyle,j=d.className,Y=d.exact,Q=d.isActive,X=d.location,F=d.sensitive,$=d.strict,re=d.style,se=d.to,he=d.innerRef,_e=Object(A.a)(d,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return K.a.createElement(q.e.Consumer,null,function(xe){xe||Object(k.a)(!1);var Ce=X||xe.location,Oe=_(R(se,Ce),Ce),De=Oe.pathname,pe=De&&De.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),ue=pe?Object(q.f)(Ce.pathname,{path:pe,exact:Y,sensitive:F,strict:$}):null,Me=!!(Q?Q(ue,Ce):ue),at=Me?D(j,x):j,lt=Me?Object(N.a)({},re,{},P):re,et=Object(N.a)({"aria-current":Me&&C||null,className:at,style:lt,to:Oe},_e);return v!==p?et.ref=o||he:et.innerRef=he,K.a.createElement(i,et)})});if(!1)var h},"5nXd":function(Ke,we,U){var q=U("MFOe"),z=q.slice,L=q.pluck,K=q.each,I=q.bind,w=q.create,B=q.isList,N=q.isFunction,A=q.isObject;Ke.exports={createStore:O};var k={version:"2.0.12",enabled:!1,get:function(R,_){var E=this.storage.read(this._namespacePrefix+R);return this._deserialize(E,_)},set:function(R,_){return _===void 0?this.remove(R):(this.storage.write(this._namespacePrefix+R,this._serialize(_)),_)},remove:function(R){this.storage.remove(this._namespacePrefix+R)},each:function(R){var _=this;this.storage.each(function(E,g){R.call(_,_._deserialize(E),(g||"").replace(_._namespaceRegexp,""))})},clearAll:function(){this.storage.clearAll()},hasNamespace:function(R){return this._namespacePrefix=="__storejs_"+R+"_"},createStore:function(){return O.apply(this,arguments)},addPlugin:function(R){this._addPlugin(R)},namespace:function(R){return O(this.storage,this.plugins,R)}};function m(){var R=typeof console=="undefined"?null:console;if(!R)return;var _=R.warn?R.warn:R.log;_.apply(R,arguments)}function O(R,_,E){E||(E=""),R&&!B(R)&&(R=[R]),_&&!B(_)&&(_=[_]);var g=E?"__storejs_"+E+"_":"",u=E?new RegExp("^"+g):null,a=/^[a-zA-Z0-9_\-]*$/;if(!a.test(E))throw new Error("store.js namespaces can only have alphanumerics + underscores and dashes");var i={_namespacePrefix:g,_namespaceRegexp:u,_testStorage:function(S){try{var v="__storejs__test__";S.write(v,v);var p=S.read(v)===v;return S.remove(v),p}catch(D){return!1}},_assignPluginFnProp:function(S,v){var p=this[v];this[v]=function(){var b=z(arguments,0),h=this;function d(){return p?(K(arguments,function(s,C){b[C]=s}),p.apply(h,b)):void 0}var o=[d].concat(b);return S.apply(h,o)}},_serialize:function(S){return JSON.stringify(S)},_deserialize:function(S,v){if(!S)return v;var p="";try{p=JSON.parse(S)}catch(D){p=S}return p!==void 0?p:v},_addStorage:function(S){if(this.enabled)return;this._testStorage(S)&&(this.storage=S,this.enabled=!0)},_addPlugin:function(S){var v=this;if(B(S)){K(S,function(b){v._addPlugin(b)});return}var p=L(this.plugins,function(b){return S===b});if(p)return;if(this.plugins.push(S),!N(S))throw new Error("Plugins must be function values that return objects");var D=S.call(this);if(!A(D))throw new Error("Plugins must return an object of function properties");K(D,function(b,h){if(!N(b))throw new Error("Bad plugin property: "+h+" from plugin "+S.name+". Plugins should only return functions.");v._assignPluginFnProp(b,h)})},addStorage:function(S){m("store.addStorage(storage) is deprecated. Use createStore([storages])"),this._addStorage(S)}},c=w(i,k,{plugins:[]});return c.raw={},K(c,function(S,v){N(S)&&(c.raw[v]=I(c,S))}),K(R,function(S){c._addStorage(S)}),K(_,function(S){c._addPlugin(S)}),c}},"6+eU":function(Ke,we,U){"use strict";U.d(we,"a",function(){return p});var q=U("wx14"),z=U("rePB"),L=U("VTBJ"),K=U("1OyB"),I=U("vuIU"),w=U("Ji7U"),B=U("LK+K"),N=U("q1tI"),A=U.n(N),k=U("TSYQ"),m=U.n(k),O=function(b){var h,d="".concat(b.rootPrefixCls,"-item"),o=m()(d,"".concat(d,"-").concat(b.page),(h={},Object(z.a)(h,"".concat(d,"-active"),b.active),Object(z.a)(h,b.className,!!b.className),Object(z.a)(h,"".concat(d,"-disabled"),!b.page),h)),s=function(){b.onClick(b.page)},C=function(x){b.onKeyPress(x,b.onClick,b.page)};return A.a.createElement("li",{title:b.showTitle?b.page:null,className:o,onClick:s,onKeyPress:C,tabIndex:"0"},b.itemRender(b.page,"page",A.a.createElement("a",{rel:"nofollow"},b.page)))},R=O,_={ZERO:48,NINE:57,NUMPAD_ZERO:96,NUMPAD_NINE:105,BACKSPACE:8,DELETE:46,ENTER:13,ARROW_UP:38,ARROW_DOWN:40},E=function(D){Object(w.a)(h,D);var b=Object(B.a)(h);function h(){var d;Object(K.a)(this,h);for(var o=arguments.length,s=new Array(o),C=0;C<o;C++)s[C]=arguments[C];return d=b.call.apply(b,[this].concat(s)),d.state={goInputText:""},d.buildOptionText=function(y){return"".concat(y," ").concat(d.props.locale.items_per_page)},d.changeSize=function(y){d.props.changeSize(Number(y))},d.handleChange=function(y){d.setState({goInputText:y.target.value})},d.handleBlur=function(y){var x=d.props,P=x.goButton,j=x.quickGo,Y=x.rootPrefixCls,Q=d.state.goInputText;if(P||Q==="")return;if(y.relatedTarget&&(y.relatedTarget.className.indexOf("".concat(Y,"-prev"))>=0||y.relatedTarget.className.indexOf("".concat(Y,"-next"))>=0))return;d.setState({goInputText:""}),j(d.getValidValue())},d.go=function(y){var x=d.state.goInputText;if(x==="")return;(y.keyCode===_.ENTER||y.type==="click")&&(d.setState({goInputText:""}),d.props.quickGo(d.getValidValue()))},d}return Object(I.a)(h,[{key:"getValidValue",value:function(){var o=this.state,s=o.goInputText,C=o.current;return!s||isNaN(s)?C:Number(s)}},{key:"getPageSizeOptions",value:function(){var o=this.props,s=o.pageSize,C=o.pageSizeOptions;return C.some(function(y){return y.toString()===s.toString()})?C:C.concat([s.toString()]).sort(function(y,x){var P=isNaN(Number(y))?0:Number(y),j=isNaN(Number(x))?0:Number(x);return P-j})}},{key:"render",value:function(){var o=this,s=this.props,C=s.pageSize,y=s.locale,x=s.rootPrefixCls,P=s.changeSize,j=s.quickGo,Y=s.goButton,Q=s.selectComponentClass,X=s.buildOptionText,F=s.selectPrefixCls,$=s.disabled,re=this.state.goInputText,se="".concat(x,"-options"),he=Q,_e=null,xe=null,Ce=null;if(!P&&!j)return null;var Oe=this.getPageSizeOptions();if(P&&he){var De=Oe.map(function(pe,ue){return A.a.createElement(he.Option,{key:ue,value:pe.toString()},(X||o.buildOptionText)(pe))});_e=A.a.createElement(he,{disabled:$,prefixCls:F,showSearch:!1,className:"".concat(se,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(C||Oe[0]).toString(),onChange:this.changeSize,getPopupContainer:function(ue){return ue.parentNode}},De)}return j&&(Y&&(Ce=typeof Y=="boolean"?A.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:$,className:"".concat(se,"-quick-jumper-button")},y.jump_to_confirm):A.a.createElement("span",{onClick:this.go,onKeyUp:this.go},Y)),xe=A.a.createElement("div",{className:"".concat(se,"-quick-jumper")},y.jump_to,A.a.createElement("input",{disabled:$,type:"text",value:re,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),y.page,Ce)),A.a.createElement("li",{className:"".concat(se)},_e,xe)}}]),h}(A.a.Component);E.defaultProps={pageSizeOptions:["10","20","50","100"]};var g=E,u=U("N2Kk");function a(){}function i(D){return typeof D=="number"&&isFinite(D)&&Math.floor(D)===D}function c(D,b,h){return h}function S(D,b,h){var d=typeof D=="undefined"?b.pageSize:D;return Math.floor((h.total-1)/d)+1}var v=function(D){Object(w.a)(h,D);var b=Object(B.a)(h);function h(d){var o;Object(K.a)(this,h),o=b.call(this,d),o.getJumpPrevPage=function(){return Math.max(1,o.state.current-(o.props.showLessItems?3:5))},o.getJumpNextPage=function(){return Math.min(S(void 0,o.state,o.props),o.state.current+(o.props.showLessItems?3:5))},o.getItemIcon=function(P,j){var Y=o.props.prefixCls,Q=P||A.a.createElement("button",{type:"button","aria-label":j,className:"".concat(Y,"-item-link")});return typeof P=="function"&&(Q=A.a.createElement(P,Object(L.a)({},o.props))),Q},o.savePaginationNode=function(P){o.paginationNode=P},o.isValid=function(P){return i(P)&&P!==o.state.current},o.shouldDisplayQuickJumper=function(){var P=o.props,j=P.showQuickJumper,Y=P.pageSize,Q=P.total;return Q<=Y?!1:j},o.handleKeyDown=function(P){(P.keyCode===_.ARROW_UP||P.keyCode===_.ARROW_DOWN)&&P.preventDefault()},o.handleKeyUp=function(P){var j=o.getValidValue(P),Y=o.state.currentInputValue;j!==Y&&o.setState({currentInputValue:j}),P.keyCode===_.ENTER?o.handleChange(j):P.keyCode===_.ARROW_UP?o.handleChange(j-1):P.keyCode===_.ARROW_DOWN&&o.handleChange(j+1)},o.changePageSize=function(P){var j=o.state.current,Y=S(P,o.state,o.props);j=j>Y?Y:j,Y===0&&(j=o.state.current),typeof P=="number"&&("pageSize"in o.props||o.setState({pageSize:P}),"current"in o.props||o.setState({current:j,currentInputValue:j})),o.props.onShowSizeChange(j,P),"onChange"in o.props&&o.props.onChange&&o.props.onChange(j,P)},o.handleChange=function(P){var j=o.props.disabled,Y=P;if(o.isValid(Y)&&!j){var Q=S(void 0,o.state,o.props);Y>Q?Y=Q:Y<1&&(Y=1),"current"in o.props||o.setState({current:Y,currentInputValue:Y});var X=o.state.pageSize;return o.props.onChange(Y,X),Y}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<S(void 0,o.state,o.props)},o.runIfEnter=function(P,j){if(P.key==="Enter"||P.charCode===13){for(var Y=arguments.length,Q=new Array(Y>2?Y-2:0),X=2;X<Y;X++)Q[X-2]=arguments[X];j.apply(void 0,Q)}},o.runIfEnterPrev=function(P){o.runIfEnter(P,o.prev)},o.runIfEnterNext=function(P){o.runIfEnter(P,o.next)},o.runIfEnterJumpPrev=function(P){o.runIfEnter(P,o.jumpPrev)},o.runIfEnterJumpNext=function(P){o.runIfEnter(P,o.jumpNext)},o.handleGoTO=function(P){(P.keyCode===_.ENTER||P.type==="click")&&o.handleChange(o.state.currentInputValue)};var s=d.onChange!==a,C="current"in d;C&&!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 y=d.defaultCurrent;"current"in d&&(y=d.current);var x=d.defaultPageSize;return"pageSize"in d&&(x=d.pageSize),y=Math.min(y,S(x,void 0,d)),o.state={current:y,currentInputValue:y,pageSize:x},o}return Object(I.a)(h,[{key:"componentDidUpdate",value:function(o,s){var C=this.props.prefixCls;if(s.current!==this.state.current&&this.paginationNode){var y=this.paginationNode.querySelector(".".concat(C,"-item-").concat(s.current));y&&document.activeElement===y&&y.blur()}}},{key:"getValidValue",value:function(o){var s=o.target.value,C=S(void 0,this.state,this.props),y=this.state.currentInputValue,x;return s===""?x=s:isNaN(Number(s))?x=y:s>=C?x=C:x=Number(s),x}},{key:"getShowSizeChanger",value:function(){var o=this.props,s=o.showSizeChanger,C=o.total,y=o.totalBoundaryShowSizeChanger;return typeof s!="undefined"?s:C>y}},{key:"renderPrev",value:function(o){var s=this.props,C=s.prevIcon,y=s.itemRender,x=y(o,"prev",this.getItemIcon(C,"prev page")),P=!this.hasPrev();return Object(N.isValidElement)(x)?Object(N.cloneElement)(x,{disabled:P}):x}},{key:"renderNext",value:function(o){var s=this.props,C=s.nextIcon,y=s.itemRender,x=y(o,"next",this.getItemIcon(C,"next page")),P=!this.hasNext();return Object(N.isValidElement)(x)?Object(N.cloneElement)(x,{disabled:P}):x}},{key:"render",value:function(){var o=this,s=this.props,C=s.prefixCls,y=s.className,x=s.style,P=s.disabled,j=s.hideOnSinglePage,Y=s.total,Q=s.locale,X=s.showQuickJumper,F=s.showLessItems,$=s.showTitle,re=s.showTotal,se=s.simple,he=s.itemRender,_e=s.showPrevNextJumpers,xe=s.jumpPrevIcon,Ce=s.jumpNextIcon,Oe=s.selectComponentClass,De=s.selectPrefixCls,pe=s.pageSizeOptions,ue=this.state,Me=ue.current,at=ue.pageSize,lt=ue.currentInputValue;if(j===!0&&Y<=at)return null;var et=S(void 0,this.state,this.props),Qe=[],je=null,Ye=null,rt=null,mt=null,ot=null,qe=X&&X.goButton,Xe=F?1:2,Ct=Me-1>0?Me-1:0,xt=Me+1<et?Me+1:et,bt=Object.keys(this.props).reduce(function(te,ie){return(ie.substr(0,5)==="data-"||ie.substr(0,5)==="aria-"||ie==="role")&&(te[ie]=o.props[ie]),te},{});if(se)return qe&&(typeof qe=="boolean"?ot=A.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},Q.jump_to_confirm):ot=A.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},qe),ot=A.a.createElement("li",{title:$?"".concat(Q.jump_to).concat(Me,"/").concat(et):null,className:"".concat(C,"-simple-pager")},ot)),A.a.createElement("ul",Object(q.a)({className:m()(C,"".concat(C,"-simple"),Object(z.a)({},"".concat(C,"-disabled"),P),y),style:x,ref:this.savePaginationNode},bt),A.a.createElement("li",{title:$?Q.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:m()("".concat(C,"-prev"),Object(z.a)({},"".concat(C,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(Ct)),A.a.createElement("li",{title:$?"".concat(Me,"/").concat(et):null,className:"".concat(C,"-simple-pager")},A.a.createElement("input",{type:"text",value:lt,disabled:P,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),A.a.createElement("span",{className:"".concat(C,"-slash")},"/"),et),A.a.createElement("li",{title:$?Q.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:m()("".concat(C,"-next"),Object(z.a)({},"".concat(C,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(xt)),ot);if(et<=3+Xe*2){var Et={locale:Q,rootPrefixCls:C,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:$,itemRender:he};et||Qe.push(A.a.createElement(R,Object(q.a)({},Et,{key:"noPager",page:et,className:"".concat(C,"-disabled")})));for(var At=1;At<=et;At+=1){var St=Me===At;Qe.push(A.a.createElement(R,Object(q.a)({},Et,{key:At,page:At,active:St})))}}else{var Se=F?Q.prev_3:Q.prev_5,Ee=F?Q.next_3:Q.next_5;_e&&(je=A.a.createElement("li",{title:$?Se:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:m()("".concat(C,"-jump-prev"),Object(z.a)({},"".concat(C,"-jump-prev-custom-icon"),!!xe))},he(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(xe,"prev page"))),Ye=A.a.createElement("li",{title:$?Ee:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:m()("".concat(C,"-jump-next"),Object(z.a)({},"".concat(C,"-jump-next-custom-icon"),!!Ce))},he(this.getJumpNextPage(),"jump-next",this.getItemIcon(Ce,"next page")))),mt=A.a.createElement(R,{locale:Q,last:!0,rootPrefixCls:C,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:et,page:et,active:!1,showTitle:$,itemRender:he}),rt=A.a.createElement(R,{locale:Q,rootPrefixCls:C,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:$,itemRender:he});var He=Math.max(1,Me-Xe),Ge=Math.min(Me+Xe,et);Me-1<=Xe&&(Ge=1+Xe*2),et-Me<=Xe&&(He=et-Xe*2);for(var Re=He;Re<=Ge;Re+=1){var Ue=Me===Re;Qe.push(A.a.createElement(R,{locale:Q,rootPrefixCls:C,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:Re,page:Re,active:Ue,showTitle:$,itemRender:he}))}Me-1>=Xe*2&&Me!==1+2&&(Qe[0]=Object(N.cloneElement)(Qe[0],{className:"".concat(C,"-item-after-jump-prev")}),Qe.unshift(je)),et-Me>=Xe*2&&Me!==et-2&&(Qe[Qe.length-1]=Object(N.cloneElement)(Qe[Qe.length-1],{className:"".concat(C,"-item-before-jump-next")}),Qe.push(Ye)),He!==1&&Qe.unshift(rt),Ge!==et&&Qe.push(mt)}var ge=null;re&&(ge=A.a.createElement("li",{className:"".concat(C,"-total-text")},re(Y,[Y===0?0:(Me-1)*at+1,Me*at>Y?Y:Me*at])));var de=!this.hasPrev()||!et,ce=!this.hasNext()||!et;return A.a.createElement("ul",Object(q.a)({className:m()(C,y,Object(z.a)({},"".concat(C,"-disabled"),P)),style:x,unselectable:"unselectable",ref:this.savePaginationNode},bt),ge,A.a.createElement("li",{title:$?Q.prev_page:null,onClick:this.prev,tabIndex:de?null:0,onKeyPress:this.runIfEnterPrev,className:m()("".concat(C,"-prev"),Object(z.a)({},"".concat(C,"-disabled"),de)),"aria-disabled":de},this.renderPrev(Ct)),Qe,A.a.createElement("li",{title:$?Q.next_page:null,onClick:this.next,tabIndex:ce?null:0,onKeyPress:this.runIfEnterNext,className:m()("".concat(C,"-next"),Object(z.a)({},"".concat(C,"-disabled"),ce)),"aria-disabled":ce},this.renderNext(xt)),A.a.createElement(g,{disabled:P,locale:Q,rootPrefixCls:C,selectComponentClass:Oe,selectPrefixCls:De,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:Me,pageSize:at,pageSizeOptions:pe,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:qe}))}}],[{key:"getDerivedStateFromProps",value:function(o,s){var C={};if("current"in o&&(C.current=o.current,o.current!==s.current&&(C.currentInputValue=C.current)),"pageSize"in o&&o.pageSize!==s.pageSize){var y=s.current,x=S(o.pageSize,s,o);y=y>x?x:y,"current"in o||(C.current=y,C.currentInputValue=y),C.pageSize=o.pageSize}return C}}]),h}(A.a.Component);v.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:u.a,style:{},itemRender:c,totalBoundaryShowSizeChanger:50};var p=v},"6RRn":function(Ke,we,U){"use strict";var q=U("wCXF"),z=U("n6Qo");U.d(we,"b",function(){return z.a});var L=U("IBYe"),K=U("6eGT"),I=U("hW8S");U.d(we,"a",function(){return I.a}),we.c=q.b},"6eGT":function(Ke,we,U){"use strict";function q(z){return null}we.a=q},"7Cbv":function(Ke,we,U){"use strict";var q=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),z=new Uint8Array(16);function L(){if(!q)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return q(z)}var K=/^(?:[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 I(R){return typeof R=="string"&&K.test(R)}for(var w=I,B=[],N=0;N<256;++N)B.push((N+256).toString(16).substr(1));function A(R){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,E=(B[R[_+0]]+B[R[_+1]]+B[R[_+2]]+B[R[_+3]]+"-"+B[R[_+4]]+B[R[_+5]]+"-"+B[R[_+6]]+B[R[_+7]]+"-"+B[R[_+8]]+B[R[_+9]]+"-"+B[R[_+10]]+B[R[_+11]]+B[R[_+12]]+B[R[_+13]]+B[R[_+14]]+B[R[_+15]]).toLowerCase();if(!w(E))throw TypeError("Stringified UUID is invalid");return E}var k=A;function m(R,_,E){R=R||{};var g=R.random||(R.rng||L)();if(g[6]=g[6]&15|64,g[8]=g[8]&63|128,_){E=E||0;for(var u=0;u<16;++u)_[E+u]=g[u];return _}return k(g)}var O=we.a=m},"7ahc":function(Ke,we,U){"use strict";U.d(we,"a",function(){return S});var q=U("k1fw"),z=U("0Owb"),L=U("+L6B"),K=U("2/Rp"),I=U("y8nQ"),w=U("Vl3Y"),B=U("tJVT"),N=U("OaEy"),A=U("2fM7"),k=U("q1tI"),m=U.n(k),O=U("VrN/"),R=U.n(O),_=U("p77/"),E=U.n(_),g=U("c5Ni"),u=U.n(g),a=A.a.Option,i={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"]};we.b=function(v){var p=v.callback,D=v.onCancel,b=Object(k.useState)("python"),h=Object(B.a)(b,2),d=h[0],o=h[1];function s(y){o(c[y][1])}function C(y){p(y)}return m.a.createElement(w.a,Object(z.a)({},i,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:C}),m.a.createElement(w.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},m.a.createElement(A.a,{onChange:s},Object.keys(c).map(function(y){return m.a.createElement(a,{key:y,value:y},c[y][0])}))),m.a.createElement(w.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},m.a.createElement(S,{mode:d})),m.a.createElement("div",{className:"flex-container flex-end"},m.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),m.a.createElement(K.a,{type:"ghost",onClick:D},"\u53D6\u6D88")))};function S(v){var p=v.value,D=v.onChange,b=v.mode,h=v.options,d=h===void 0?{}:h,o=Object(k.useRef)(),s=Object(k.useState)(),C=Object(B.a)(s,2),y=C[0],x=C[1];return Object(k.useEffect)(function(){if(y){function P(j){var Y=j.getValue();D&&D(Y)}return y.on("change",P),function(){y.off("change",P)}}},[y,D]),Object(k.useEffect)(function(){y&&y.setOption("mode",b)},[y,b]),Object(k.useEffect)(function(){y&&((p!==y.getValue()||p==="")&&setTimeout(function(){y.setValue(p||" ")},300))},[y,p]),Object(k.useEffect)(function(){if(o.current&&!y){var P=R.a.fromTextArea(o.current,Object(q.a)({mode:b,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},d));x(P)}},[o.current,y]),m.a.createElement("div",{className:"my-codemirror-container"},m.a.createElement("textarea",{ref:o}))}},"7ixt":function(Ke,we,U){"use strict";U.d(we,"a",function(){return L});var q={adjustX:1,adjustY:1},z=[0,0],L={left:{points:["cr","cl"],overflow:q,offset:[-4,0],targetOffset:z},right:{points:["cl","cr"],overflow:q,offset:[4,0],targetOffset:z},top:{points:["bc","tc"],overflow:q,offset:[0,-4],targetOffset:z},bottom:{points:["tc","bc"],overflow:q,offset:[0,4],targetOffset:z},topLeft:{points:["bl","tl"],overflow:q,offset:[0,-4],targetOffset:z},leftTop:{points:["tr","tl"],overflow:q,offset:[-4,0],targetOffset:z},topRight:{points:["br","tr"],overflow:q,offset:[0,-4],targetOffset:z},rightTop:{points:["tl","tr"],overflow:q,offset:[4,0],targetOffset:z},bottomRight:{points:["tr","br"],overflow:q,offset:[0,4],targetOffset:z},rightBottom:{points:["bl","br"],overflow:q,offset:[4,0],targetOffset:z},bottomLeft:{points:["tl","bl"],overflow:q,offset:[0,4],targetOffset:z},leftBottom:{points:["br","bl"],overflow:q,offset:[-4,0],targetOffset:z}},K=L},"815F":function(Ke,we,U){"use strict";U.d(we,"e",function(){return B}),U.d(we,"c",function(){return A}),U.d(we,"d",function(){return k}),U.d(we,"a",function(){return O}),U.d(we,"f",function(){return R}),U.d(we,"b",function(){return _});var q=U("KQm4"),z=U("VTBJ"),L=U("Ff2n"),K=U("Zm9Q"),I=U("Kwbf"),w=U("OZM5");function B(E,g){return E!=null?E:g}function N(){var E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],g=new Map;function u(a){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(a||[]).forEach(function(c){var S=c.key,v=c.children;Object(I.a)(S!=null,"Tree node must have a certain key: [".concat(i).concat(S,"]"));var p=String(S);Object(I.a)(!g.has(p)||S===null||S===void 0,"Same 'key' exist in the Tree: ".concat(p)),g.set(p,!0),u(v,"".concat(i).concat(p," > "))})}u(E)}function A(E){function g(u){var a=Object(K.a)(u);return a.map(function(i){if(!Object(w.i)(i))return Object(I.a)(!i,"Tree/TreeNode can only accept TreeNode as children."),null;var c=i.key,S=i.props,v=S.children,p=Object(L.a)(S,["children"]),D=Object(z.a)({key:c},p),b=g(v);return b.length&&(D.children=b),D}).filter(function(i){return i})}return g(E)}function k(){var E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],u=new Set(g===!0?[]:g),a=[];function i(c){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return c.map(function(v,p){var D=Object(w.h)(S?S.pos:"0",p),b=B(v.key,D),h=Object(z.a)(Object(z.a)({},v),{},{parent:S,pos:D,children:null,data:v,isStart:[].concat(Object(q.a)(S?S.isStart:[]),[p===0]),isEnd:[].concat(Object(q.a)(S?S.isEnd:[]),[p===c.length-1])});return a.push(h),g===!0||u.has(b)?h.children=i(v.children||[],h):h.children=[],h})}return i(E),a}function m(E,g,u){var a;u?typeof u=="string"?a=function(S){return S[u]}:typeof u=="function"&&(a=function(S){return u(S)}):a=function(S,v){return B(S.key,v)};function i(c,S,v){var p=c?c.children:E,D=c?Object(w.h)(v.pos,S):"0";if(c){var b=a(c,D),h={node:c,index:S,pos:D,key:b,parentPos:v.node?v.pos:null,level:v.level+1};g(h)}p&&p.forEach(function(d,o){i(d,o,{node:c,pos:D,level:v?v.level+1:-1})})}i(null)}function O(E){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},u=g.initWrapper,a=g.processEntity,i=g.onProcessFinished,c=arguments.length>2?arguments[2]:void 0,S={},v={},p={posEntities:S,keyEntities:v};return u&&(p=u(p)||p),m(E,function(D){var b=D.node,h=D.index,d=D.pos,o=D.key,s=D.parentPos,C=D.level,y={node:b,index:h,key:o,pos:d,level:C},x=B(o,d);S[d]=y,v[x]=y,y.parent=S[s],y.parent&&(y.parent.children=y.parent.children||[],y.parent.children.push(y)),a&&a(y,p)},c),i&&i(p),p}function R(E,g){var u=g.expandedKeys,a=g.selectedKeys,i=g.loadedKeys,c=g.loadingKeys,S=g.checkedKeys,v=g.halfCheckedKeys,p=g.dragOverNodeKey,D=g.dropPosition,b=g.keyEntities,h=b[E],d={eventKey:E,expanded:u.indexOf(E)!==-1,selected:a.indexOf(E)!==-1,loaded:i.indexOf(E)!==-1,loading:c.indexOf(E)!==-1,checked:S.indexOf(E)!==-1,halfChecked:v.indexOf(E)!==-1,pos:String(h?h.pos:""),dragOver:p===E&&D===0,dragOverGapTop:p===E&&D===-1,dragOverGapBottom:p===E&&D===1};return d}function _(E){var g=E.data,u=E.expanded,a=E.selected,i=E.checked,c=E.loaded,S=E.loading,v=E.halfChecked,p=E.dragOver,D=E.dragOverGapTop,b=E.dragOverGapBottom,h=E.pos,d=E.active,o=Object(z.a)(Object(z.a)({},g),{},{expanded:u,selected:a,checked:i,loaded:c,loading:S,halfChecked:v,dragOver:p,dragOverGapTop:D,dragOverGapBottom:b,pos:h,active:d});return"props"in o||Object.defineProperty(o,"props",{get:function(){return Object(I.a)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),E}}),o}},"8EBN":function(Ke,we,U){(function(q){q(U("VrN/"))})(function(q){"use strict";q.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var z=0;z<q.modeInfo.length;z++){var L=q.modeInfo[z];L.mimes&&(L.mime=L.mimes[0])}q.findModeByMIME=function(K){K=K.toLowerCase();for(var I=0;I<q.modeInfo.length;I++){var w=q.modeInfo[I];if(w.mime==K)return w;if(w.mimes){for(var B=0;B<w.mimes.length;B++)if(w.mimes[B]==K)return w}}if(/\+xml$/.test(K))return q.findModeByMIME("application/xml");if(/\+json$/.test(K))return q.findModeByMIME("application/json")},q.findModeByExtension=function(K){K=K.toLowerCase();for(var I=0;I<q.modeInfo.length;I++){var w=q.modeInfo[I];if(w.ext){for(var B=0;B<w.ext.length;B++)if(w.ext[B]==K)return w}}},q.findModeByFileName=function(K){for(var I=0;I<q.modeInfo.length;I++){var w=q.modeInfo[I];if(w.file&&w.file.test(K))return w}var B=K.lastIndexOf("."),N=B>-1&&K.substring(B+1,K.length);if(N)return q.findModeByExtension(N)},q.findModeByName=function(K){K=K.toLowerCase();for(var I=0;I<q.modeInfo.length;I++){var w=q.modeInfo[I];if(w.name.toLowerCase()==K)return w;if(w.alias){for(var B=0;B<w.alias.length;B++)if(w.alias[B].toLowerCase()==K)return w}}}})},"8hTe":function(Ke,we,U){Ke.exports={button:"button___1wy9m"}},"9Bee":function(Ke,we,U){"use strict";var q=U("DYRE"),z=U("zeV3"),L=U("+L6B"),K=U("2/Rp"),I=U("k1fw"),w=U("9og8"),B=U("tJVT"),N=U("WmNS"),A=U.n(N),k=U("q1tI"),m=U.n(k),O=U("vg9a"),R=U("DlQD"),_=U.n(R),E=U("rUJ1");function g(H,f){var T=H.match(/^(\s+)(?:```)/);if(T===null)return f;var W=T[1];return f.split(`
|
|
`).map(function(J){var G=J.match(/^\s+/);if(G===null)return J;var ve=Object(B.a)(G,1),Ve=ve[0];return Ve.length>=W.length?J.slice(W.length):J}).join(`
|
|
`)}var u=[],a=["<ul>"],i=new _.a.Renderer,c=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function S(){u.length=0,a=["<ul>"]}var v={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function p(H,f,T,W){if(f>=H.length||H[f].level<=T)return f;var J=H[f];W.push("<li><a href='#"+J.anchor+"'>"+J.text+"</a>"),f++;var G=[];return f=p(H,f,J.level,G),G.length>0&&(W.push("<ul>"),G.forEach(function(ve){W.push(ve)}),W.push("</ul>")),W.push("</li>"),f=p(H,f,T,W),f}function D(){return p(u,0,0,a),a.push("</ul>"),a.join("")}var b={heading:function(f){var T=c.exec(f);if(T)return{type:"heading",raw:T[0],depth:T[1].length,text:T[2]}},fences:function(f){var T=this.rules.block.fences.exec(f);if(T){var W=T[0],J=g(W,T[3]||""),G=T[2]?T[2].trim():T[2];if(["latex","katex","math"].indexOf(G)>=0){var ve=o(),Ve=J;J=ve,s[ve]={type:"block",expression:Ve}}return{type:"code",raw:W,lang:G,text:J}}}},h=/(?:\${2})([^\n`]+?)(?:\${2})/gi,d=0,o=function(){return"__special_katext_id_".concat(d++,"__")},s={};function C(){return s}function y(){d=0,s={}}function x(H){return H=H.replace(h,function(f,T){var W=o();return s[W]={type:"inline",expression:T},W}),H}var P=i.listitem;i.listitem=function(H){return P(x(H))};var j=i.paragraph;i.paragraph=function(H){return j(x(H))};var Y=i.tablecell;i.tablecell=function(H,f){return Y(x(H),f)},i.code=function(H,f,T){var W=(f||"").match(/\S*/)[0];return W?["latex","katex","math"].indexOf(W)>=0?"<p class='editormd-tex'>".concat(H,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(f,'">').concat(T?H:Object(E.escape)(H,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(T?H:Object(E.escape)(H,!0))+"</code></pre>"},i.heading=function(H,f,T){var W=this.options.headerPrefix+T.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return u.push({anchor:W,level:f,text:H}),"<h"+f+' id="'+W+'">'+H+"</h"+f+">"},_.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),_.a.use({tokenizer:b,renderer:i});var Q=_.a,X=U("SJMd"),F=U("ulZh"),$=U.n(F),re=U("m3rI"),se=U("Oy/b"),he=U("p5ED"),_e=U("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 xe=function(H,f){return(xe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(T,W){T.__proto__=W}||function(T,W){for(var J in W)Object.prototype.hasOwnProperty.call(W,J)&&(T[J]=W[J])})(H,f)};function Ce(H,f){function T(){this.constructor=H}xe(H,f),H.prototype=f===null?Object.create(f):(T.prototype=f.prototype,new T)}function Oe(H,f,T,W){return new(T||(T=Promise))(function(J,G){function ve(Tt){try{ht(W.next(Tt))}catch(Je){G(Je)}}function Ve(Tt){try{ht(W.throw(Tt))}catch(Je){G(Je)}}function ht(Tt){var Je;Tt.done?J(Tt.value):(Je=Tt.value,Je instanceof T?Je:new T(function(It){It(Je)})).then(ve,Ve)}ht((W=W.apply(H,f||[])).next())})}function De(H,f){var T,W,J,G,ve={label:0,sent:function(){if(1&J[0])throw J[1];return J[1]},trys:[],ops:[]};return G={next:Ve(0),throw:Ve(1),return:Ve(2)},typeof Symbol=="function"&&(G[Symbol.iterator]=function(){return this}),G;function Ve(ht){return function(Tt){return function(Je){if(T)throw new TypeError("Generator is already executing.");for(;ve;)try{if(T=1,W&&(J=2&Je[0]?W.return:Je[0]?W.throw||((J=W.return)&&J.call(W),0):W.next)&&!(J=J.call(W,Je[1])).done)return J;switch(W=0,J&&(Je=[2&Je[0],J.value]),Je[0]){case 0:case 1:J=Je;break;case 4:return ve.label++,{value:Je[1],done:!1};case 5:ve.label++,W=Je[1],Je=[0];continue;case 7:Je=ve.ops.pop(),ve.trys.pop();continue;default:if(!(J=ve.trys,(J=J.length>0&&J[J.length-1])||Je[0]!==6&&Je[0]!==2)){ve=0;continue}if(Je[0]===3&&(!J||Je[1]>J[0]&&Je[1]<J[3])){ve.label=Je[1];break}if(Je[0]===6&&ve.label<J[1]){ve.label=J[1],J=Je;break}if(J&&ve.label<J[2]){ve.label=J[2],ve.ops.push(Je);break}J[2]&&ve.ops.pop(),ve.trys.pop();continue}Je=f.call(H,ve)}catch(It){Je=[6,It],W=0}finally{T=J=0}if(5&Je[0])throw Je[1];return{value:Je[0]?Je[1]:void 0,done:!0}}([ht,Tt])}}}function pe(){for(var H=0,f=0,T=arguments.length;f<T;f++)H+=arguments[f].length;var W=Array(H),J=0;for(f=0;f<T;f++)for(var G=arguments[f],ve=0,Ve=G.length;ve<Ve;ve++,J++)W[J]=G[ve];return W}var ue=function(){function H(){}return H.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},H.setAttributes=function(f,T){for(var W=0,J=T;W<J.length;W++){var G=J[W],ve=G[0],Ve=G[1];f.setAttribute(ve,Ve)}},H.createRect=function(f,T,W){var J=document.createElementNS("http://www.w3.org/2000/svg","rect");return J.setAttribute("width",f.toString()),J.setAttribute("height",T.toString()),W&&H.setAttributes(J,W),J},H.createLine=function(f,T,W,J,G){var ve=document.createElementNS("http://www.w3.org/2000/svg","line");return ve.setAttribute("x1",f.toString()),ve.setAttribute("y1",T.toString()),ve.setAttribute("x2",W.toString()),ve.setAttribute("y2",J.toString()),G&&H.setAttributes(ve,G),ve},H.createPolygon=function(f,T){var W=document.createElementNS("http://www.w3.org/2000/svg","polygon");return W.setAttribute("points",f),T&&H.setAttributes(W,T),W},H.createCircle=function(f,T){var W=document.createElementNS("http://www.w3.org/2000/svg","circle");return W.setAttribute("cx",(f/2).toString()),W.setAttribute("cy",(f/2).toString()),W.setAttribute("r",f.toString()),T&&H.setAttributes(W,T),W},H.createEllipse=function(f,T,W){var J=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return J.setAttribute("cx",(f/2).toString()),J.setAttribute("cy",(T/2).toString()),J.setAttribute("rx",(f/2).toString()),J.setAttribute("ry",(T/2).toString()),W&&H.setAttributes(J,W),J},H.createGroup=function(f){var T=document.createElementNS("http://www.w3.org/2000/svg","g");return f&&H.setAttributes(T,f),T},H.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},H.createMarker=function(f,T,W,J,G,ve,Ve){var ht=document.createElementNS("http://www.w3.org/2000/svg","marker");return H.setAttributes(ht,[["id",f],["orient",T],["markerWidth",W.toString()],["markerHeight",J.toString()],["refX",G.toString()],["refY",ve.toString()]]),ht.appendChild(Ve),ht},H.createText=function(f){var T=document.createElementNS("http://www.w3.org/2000/svg","text");return T.setAttribute("x","0"),T.setAttribute("y","0"),f&&H.setAttributes(T,f),T},H.createTSpan=function(f,T){var W=document.createElementNS("http://www.w3.org/2000/svg","tspan");return W.textContent=f,T&&H.setAttributes(W,T),W},H.createImage=function(f){var T=document.createElementNS("http://www.w3.org/2000/svg","image");return f&&H.setAttributes(T,f),T},H.createPoint=function(f,T){var W=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return W.x=f,W.y=T,W},H.createPath=function(f,T){var W=document.createElementNS("http://www.w3.org/2000/svg","path");return W.setAttribute("d",f),T&&H.setAttributes(W,T),W},H}(),Me=function(){function H(){}return H.addKey=function(f){H.key=f},Object.defineProperty(H,"isLicensed",{get:function(){return!!H.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(H.key)},enumerable:!1,configurable:!0}),H}(),at=function(){function H(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return H.prototype.rasterize=function(f,T,W){var J=this;return new Promise(function(G){var ve=W!==void 0?W:document.createElement("canvas");f===null&&(J.markersOnly=!0,J.naturalSize=!1);var Ve=document.createElementNS("http://www.w3.org/2000/svg","svg");Ve.setAttribute("xmlns","http://www.w3.org/2000/svg"),Ve.setAttribute("width",T.width.baseVal.valueAsString),Ve.setAttribute("height",T.height.baseVal.valueAsString),Ve.setAttribute("viewBox","0 0 "+T.viewBox.baseVal.width.toString()+" "+T.viewBox.baseVal.height.toString()),Ve.innerHTML=T.innerHTML,J.naturalSize===!0?(Ve.width.baseVal.value=f.naturalWidth,Ve.height.baseVal.value=f.naturalHeight):J.width!==void 0&&J.height!==void 0&&(Ve.width.baseVal.value=J.width,Ve.height.baseVal.value=J.height),ve.width=Ve.width.baseVal.value,ve.height=Ve.height.baseVal.value;var ht=Ve.outerHTML,Tt=ve.getContext("2d");J.markersOnly!==!0&&Tt.drawImage(f,0,0,ve.width,ve.height);var Je=window.URL,It=new Image(ve.width,ve.height);It.setAttribute("crossOrigin","anonymous");var kt=new Blob([ht],{type:"image/svg+xml"}),rn=Je.createObjectURL(kt);It.onload=function(){Tt.drawImage(It,0,0),Je.revokeObjectURL(rn);var An=ve.toDataURL(J.imageType,J.imageQuality);G(An)},It.src=rn})},H}(),lt=function(){},et=function(){function H(f){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+f+"_"}return Object.defineProperty(H.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(H.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(H.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),H.prototype.addClass=function(f){return this.styleSheet===void 0&&this.addStyleSheet(),f.name=""+this.classNamePrefix+f.localName,this.classes.push(f),this.styleSheet.sheet.insertRule("."+f.name+" {"+f.style+"}",this.styleSheet.sheet.cssRules.length),f},H.prototype.addRule=function(f){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(f),this.styleSheet.sheet.insertRule(f.selector+" {"+f.style+"}",this.styleSheet.sheet.cssRules.length)},H.prototype.addStyleSheet=function(){var f;this.styleSheet=document.createElement("style"),((f=this.styleSheetRoot)!==null&&f!==void 0?f:document.head).appendChild(this.styleSheet),this.addRule(new Qe("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Qe("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new Qe("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new je("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new je("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},H.prototype.removeStyleSheet=function(){var f;this.styleSheet&&(((f=this.styleSheetRoot)!==null&&f!==void 0?f:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},H}(),Qe=function(H,f){this.selector=H,this.style=f},je=function(H,f){this.localName=H,this.style=f},Ye=function(){function H(f,T,W,J,G){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=f,this.displayMode=T,this.markerItems=W,this.uiStyleSettings=J,this.styles=G,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return H.prototype.show=function(f){var T=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=f,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var W=document.createElement("div");W.className=this.toolbarBlockStyleClass.name,W.style.whiteSpace="nowrap",this.uiContainer.appendChild(W),this.addActionButton(W,'<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(W,'<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(W,'<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(W,'<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(W,'<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(W,'<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(W,'<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(W,'<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(G){var ve=document.createElement("div");ve.className=""+T.toolbarButtonStyleClass.name,ve.setAttribute("data-type-name",G.typeName),ve.innerHTML=G.icon,ve.addEventListener("click",function(){T.markerToolbarButtonClicked(ve,G)}),T.buttons.push(ve),T.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 J=document.createElement("div");J.className=this.toolbarBlockStyleClass.name,J.style.whiteSpace="nowrap",J.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(J),this.addActionButton(J,'<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(J,'<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()},H.prototype.addButtonClickListener=function(f){this.buttonClickListeners.push(f)},H.prototype.removeButtonClickListener=function(f){this.buttonClickListeners.indexOf(f)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(f),1)},H.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},H.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var f=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var T=0;T<this.markerButtons.length;T++)T<f||T===f&&this.markerButtons.length-1===f?this.markerButtonBlock.appendChild(this.markerButtons[T]):(T===f&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[T]))}},H.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")},H.prototype.resetButtonStyles=function(){var f=this;this.buttons.forEach(function(T){T.className=T.className.replace(f.uiStyleSettings.toolbarButtonStyleColorsClassName?f.uiStyleSettings.toolbarButtonStyleColorsClassName:f.toolbarButtonStyleColorsClass.name,"").trim(),T.className=T.className.replace(f.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?f.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:f.toolbarActiveButtonStyleColorsClass.name,"").trim(),T.className+=" "+(f.uiStyleSettings.toolbarButtonStyleColorsClassName?f.uiStyleSettings.toolbarButtonStyleColorsClassName:f.toolbarButtonStyleColorsClass.name)})},H.prototype.addActionButton=function(f,T,W){var J=this,G=document.createElement("div");switch(G.className=""+this.toolbarButtonStyleClass.name,G.innerHTML=T,G.setAttribute("data-action",W),G.addEventListener("click",function(){J.actionToolbarButtonClicked(G,W)}),W){case"select":G.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":G.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":G.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":G.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":G.style.fill=this.uiStyleSettings.closeButtonColor}f.appendChild(G),this.buttons.push(G)},H.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new je("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 je("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new je("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new je("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 je("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var f=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new je("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*f)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*f)+`px;
|
|
padding: `+f+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new je("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new je("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new Qe("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new Qe("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},H.prototype.markerToolbarButtonClicked=function(f,T){this.setActiveButton(f),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(W){return W("marker",T)}),this.markerButtonOverflowBlock.style.display="none"},H.prototype.actionToolbarButtonClicked=function(f,T){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(W){return W("action",T)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},H.prototype.setActiveButton=function(f){this.resetButtonStyles(),f.className=f.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),f.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},H.prototype.setActiveMarkerButton=function(f){var T=this.markerButtons.find(function(W){return W.getAttribute("data-type-name")===f});T&&this.setActiveButton(T)},H.prototype.setCurrentMarker=function(f){var T=this;this.currentMarker=f,this.buttons.filter(function(W){return/delete|notes/.test(W.getAttribute("data-action"))}).forEach(function(W){T.currentMarker===void 0?(W.style.fillOpacity="0.4",W.style.pointerEvents="none"):(W.style.fillOpacity="1",W.style.pointerEvents="all")})},H}(),rt=function(){function H(f,T,W,J){this.panels=[],this.panelButtons=[],this.markerjsContainer=f,this.displayMode=T,this.uiStyleSettings=W,this.styles=J,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return H.prototype.addStyles=function(){var f;this.toolboxStyleClass=this.styles.addClass(new je("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 je("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var T=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new je("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new je("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new je("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 je("toolbox-panel-row_colors",`
|
|
background-color: `+((f=this.uiStyleSettings.toolboxBackgroundColor)!==null&&f!==void 0?f:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new je("toolbox_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*T)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*T)+`px;
|
|
padding: `+T+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new je("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new je("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new Qe("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new Qe("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},H.prototype.show=function(f){var T;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=f,this.uiContainer.className=this.toolboxStyleClass.name+" "+((T=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&T!==void 0?T:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},H.prototype.setPanelButtons=function(f){var T,W,J=this;this.panels=f,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((T=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&T!==void 0?T:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((W=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&W!==void 0?W:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(G){var ve;G.uiStyleSettings=J.uiStyleSettings;var Ve=document.createElement("div");Ve.className=J.toolboxButtonStyleClass.name+" "+((ve=J.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ve!==void 0?ve:J.toolboxButtonStyleColorsClass.name),Ve.innerHTML=G.icon,Ve.title=G.title,Ve.addEventListener("click",function(){J.panelButtonClick(G)}),J.panelButtons.push(Ve),J.buttonRow.appendChild(Ve)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},H.prototype.panelButtonClick=function(f){var T=this,W=-1;if(f!==this.activePanel){W=this.panels.indexOf(f),this.panelRow.innerHTML="";var J=f.getUi();J.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(J),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=f}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){T.displayMode==="inline"?T.panelRow.style.display="none":T.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(G,ve){var Ve,ht;G.className=T.toolboxButtonStyleClass.name+" "+(ve===W?""+((Ve=T.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Ve!==void 0?Ve:T.toolboxActiveButtonStyleColorsClass.name):""+((ht=T.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ht!==void 0?ht:T.toolboxButtonStyleColorsClass.name))})},H}(),mt=function(H,f){this.title=H,this.icon=f},ot=function(H){function f(T,W,J,G){var ve=H.call(this,T,G||'<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=W,ve.currentColor=J,ve.setCurrentColor=ve.setCurrentColor.bind(ve),ve.getColorBox=ve.getColorBox.bind(ve),ve}return Ce(f,H),f.prototype.getUi=function(){var T=this,W=document.createElement("div");return W.style.overflow="hidden",W.style.whiteSpace="nowrap",this.colors.forEach(function(J){var G=T.getColorBox(J);W.appendChild(G),T.colorBoxes.push(G)}),W},f.prototype.getColorBox=function(T){var W=this,J=this.uiStyleSettings.toolbarHeight/4,G=this.uiStyleSettings.toolbarHeight-J,ve=document.createElement("div");ve.style.display="inline-block",ve.style.boxSizing="content-box",ve.style.width=G-2+"px",ve.style.height=G-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=(G+2)/2+"px",ve.style.borderColor=T===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ve.addEventListener("click",function(){W.setCurrentColor(T,ve)});var Ve=document.createElement("div");return Ve.style.display="inline-block",Ve.style.width=G-2+"px",Ve.style.height=G-2+"px",Ve.style.backgroundColor=T,Ve.style.borderRadius=G/2+"px",T==="transparent"&&(Ve.style.fill=this.uiStyleSettings.toolboxAccentColor,Ve.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(Ve),ve},f.prototype.setCurrentColor=function(T,W){var J=this;this.currentColor=T,this.colorBoxes.forEach(function(G){G.style.borderColor=G===W?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(T)},f}(mt),qe=function(){function H(f,T,W){this._state="new",this._isSelected=!1,this._container=f,this._overlayContainer=T,this.globalSettings=W,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(H.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),H.prototype.ownsTarget=function(f){return!1},Object.defineProperty(H.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),H.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},H.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},H.prototype.pointerDown=function(f,T){},H.prototype.dblClick=function(f,T){},H.prototype.manipulate=function(f){},H.prototype.pointerUp=function(f){this.stateChanged()},H.prototype.dispose=function(){},H.prototype.addMarkerVisualToContainer=function(f){this.container.childNodes.length>0?this.container.insertBefore(f,this.container.childNodes[0]):this.container.appendChild(f)},H.prototype.getState=function(){return{typeName:H.typeName,state:this.state,notes:this.notes}},H.prototype.restoreState=function(f){this._state=f.state,this.notes=f.notes},H.prototype.scale=function(f,T){},H.prototype.colorChanged=function(f){this.onColorChanged&&this.onColorChanged(f),this.stateChanged()},H.prototype.fillColorChanged=function(f){this.onFillColorChanged&&this.onFillColorChanged(f),this.stateChanged()},H.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var f=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),f.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(f)&&this.onStateChanged(this)}},H.typeName="MarkerBase",H}(),Xe=function(){function H(){this.findGripByVisual=this.findGripByVisual.bind(this)}return H.prototype.findGripByVisual=function(f){return this.topLeft.ownsTarget(f)?this.topLeft:this.topCenter.ownsTarget(f)?this.topCenter:this.topRight.ownsTarget(f)?this.topRight:this.centerLeft.ownsTarget(f)?this.centerLeft:this.centerRight.ownsTarget(f)?this.centerRight:this.bottomLeft.ownsTarget(f)?this.bottomLeft:this.bottomCenter.ownsTarget(f)?this.bottomCenter:this.bottomRight.ownsTarget(f)?this.bottomRight:void 0},H}(),Ct=function(){function H(){this.GRIP_SIZE=10,this.visual=ue.createGroup(),this.visual.appendChild(ue.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(ue.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return H.prototype.ownsTarget=function(f){return f===this.visual||f===this.visual.childNodes[0]||f===this.visual.childNodes[1]},H}(),xt=function(){function H(){}return H.toITransformMatrix=function(f){return{a:f.a,b:f.b,c:f.c,d:f.d,e:f.e,f:f.f}},H.toSVGMatrix=function(f,T){return f.a=T.a,f.b=T.b,f.c=T.c,f.d=T.d,f.e=T.e,f.f=T.f,f},H}(),bt=function(H){function f(T,W,J){var G=H.call(this,T,W,J)||this;return G.left=0,G.top=0,G.width=0,G.height=0,G.defaultSize={x:50,y:20},G.offsetX=0,G.offsetY=0,G.rotationAngle=0,G.CB_DISTANCE=10,G._suppressMarkerCreateEvent=!1,G.container.transform.baseVal.appendItem(ue.createTransform()),G.setupControlBox(),G}return Ce(f,H),Object.defineProperty(f.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"visual",{get:function(){return this._visual},set:function(T){this._visual=T;var W=ue.createTransform();this._visual.transform.baseVal.appendItem(W)},enumerable:!1,configurable:!0}),f.prototype.ownsTarget=function(T){return!!H.prototype.ownsTarget.call(this,T)||!!(this.controlGrips.findGripByVisual(T)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(T))},f.prototype.pointerDown=function(T,W){H.prototype.pointerDown.call(this,T,W),this.state==="new"&&(this.left=T.x,this.top=T.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var J=this.unrotatePoint(T);if(this.manipulationStartX=J.x,this.manipulationStartY=J.y,this.offsetX=J.x-this.left,this.offsetY=J.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(W),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(W)){this.activeGrip=this.rotatorGrip;var G=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=G.x-this.width/2,this.top=G.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"},f.prototype.pointerUp=function(T){var W=this.state;H.prototype.pointerUp.call(this,T),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(T),this._state="select",W==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},f.prototype.moveVisual=function(T){this.visual.style.transform="translate("+T.x+"px, "+T.y+"px)"},f.prototype.manipulate=function(T){var W=this.unrotatePoint(T);this.state==="creating"?this.resize(T):this.state==="move"?(this.left=this.manipulationStartLeft+(W.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(W.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(W):this.state==="rotate"&&this.rotate(T)},f.prototype.resize=function(T){var W=this.manipulationStartLeft,J=this.manipulationStartWidth,G=this.manipulationStartTop,ve=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:W=this.manipulationStartLeft+T.x-this.manipulationStartX,J=this.manipulationStartWidth+this.manipulationStartLeft-W;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:J=this.manipulationStartWidth+T.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:G=this.manipulationStartTop+T.y-this.manipulationStartY,ve=this.manipulationStartHeight+this.manipulationStartTop-G;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ve=this.manipulationStartHeight+T.y-this.manipulationStartY}J>=0?(this.left=W,this.width=J):(this.left=W+J,this.width=-J),ve>=0?(this.top=G,this.height=ve):(this.top=G+ve,this.height=-ve),this.setSize()},f.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},f.prototype.rotate=function(T){if(Math.abs(T.x-this.centerX)>.1){var W=Math.sign(T.x-this.centerX);this.rotationAngle=180*Math.atan((T.y-this.centerY)/(T.x-this.centerX))/Math.PI+90*W,this.applyRotation()}},f.prototype.applyRotation=function(){var T=this.container.transform.baseVal.getItem(0);T.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(T,0)},f.prototype.rotatePoint=function(T){if(this.rotationAngle===0)return T;var W=this.container.getCTM(),J=ue.createPoint(T.x,T.y);return{x:(J=J.matrixTransform(W)).x,y:J.y}},f.prototype.unrotatePoint=function(T){if(this.rotationAngle===0)return T;var W=this.container.getCTM();W=W.inverse();var J=ue.createPoint(T.x,T.y);return{x:(J=J.matrixTransform(W)).x,y:J.y}},f.prototype.select=function(){H.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},f.prototype.deselect=function(){H.prototype.deselect.call(this),this.controlBox.style.display="none"},f.prototype.setupControlBox=function(){this.controlBox=ue.createGroup();var T=ue.createTransform();T.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(T),this.container.appendChild(this.controlBox),this.controlRect=ue.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=ue.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 Xe,this.addControlGrips(),this.controlBox.style.display="none"},f.prototype.adjustControlBox=function(){var T=this.controlBox.transform.baseVal.getItem(0);T.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(T,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()},f.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()},f.prototype.createGrip=function(){var T=new Ct;return T.visual.transform.baseVal.appendItem(ue.createTransform()),this.controlBox.appendChild(T.visual),T},f.prototype.positionGrips=function(){var T=this.controlGrips.topLeft.GRIP_SIZE,W=-T/2,J=W,G=(this.width+this.CB_DISTANCE)/2-T/2,ve=(this.height+this.CB_DISTANCE)/2-T/2,Ve=this.height+this.CB_DISTANCE-T/2,ht=this.width+this.CB_DISTANCE-T/2;this.positionGrip(this.controlGrips.topLeft.visual,W,J),this.positionGrip(this.controlGrips.topCenter.visual,G,J),this.positionGrip(this.controlGrips.topRight.visual,ht,J),this.positionGrip(this.controlGrips.centerLeft.visual,W,ve),this.positionGrip(this.controlGrips.centerRight.visual,ht,ve),this.positionGrip(this.controlGrips.bottomLeft.visual,W,Ve),this.positionGrip(this.controlGrips.bottomCenter.visual,G,Ve),this.positionGrip(this.controlGrips.bottomRight.visual,ht,Ve),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,G,J-3*this.CB_DISTANCE)},f.prototype.positionGrip=function(T,W,J){var G=T.transform.baseVal.getItem(0);G.setTranslate(W,J),T.transform.baseVal.replaceItem(G,0)},f.prototype.hideControlBox=function(){this.controlBox.style.display="none"},f.prototype.showControlBox=function(){this.controlBox.style.display=""},f.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:xt.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:xt.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},H.prototype.getState.call(this))},f.prototype.restoreState=function(T){H.prototype.restoreState.call(this,T);var W=T;this.left=W.left,this.top=W.top,this.width=W.width,this.height=W.height,this.rotationAngle=W.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(xt.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,W.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(xt.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,W.containerTransformMatrix))},f.prototype.scale=function(T,W){H.prototype.scale.call(this,T,W);var J=this.rotatePoint({x:this.left,y:this.top}),G=this.unrotatePoint({x:J.x*T,y:J.y*W});this.left=G.x,this.top=G.y,this.width=this.width*T,this.height=this.height*W,this.adjustControlBox()},f}(qe),Et=function(H){function f(T,W,J){var G=H.call(this,T,W,J)||this;return G.fillColor="transparent",G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.opacity=1,G.setStrokeColor=G.setStrokeColor.bind(G),G.setFillColor=G.setFillColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.createVisual=G.createVisual.bind(G),G}return Ce(f,H),f.prototype.ownsTarget=function(T){return!(!H.prototype.ownsTarget.call(this,T)&&T!==this.visual)},f.prototype.createVisual=function(){this.visual=ue.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)},f.prototype.pointerDown=function(T,W){H.prototype.pointerDown.call(this,T,W),this.state==="new"&&(this.createVisual(),this.moveVisual(T),this._state="creating")},f.prototype.manipulate=function(T){H.prototype.manipulate.call(this,T)},f.prototype.resize=function(T){H.prototype.resize.call(this,T),this.setSize()},f.prototype.setSize=function(){H.prototype.setSize.call(this),ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},f.prototype.pointerUp=function(T){H.prototype.pointerUp.call(this,T),this.setSize()},f.prototype.setStrokeColor=function(T){this.strokeColor=T,this.visual&&ue.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(T),this.stateChanged()},f.prototype.setFillColor=function(T){this.fillColor=T,this.visual&&ue.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},f.prototype.setStrokeWidth=function(T){this.strokeWidth=T,this.visual&&ue.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},f.prototype.setStrokeDasharray=function(T){this.strokeDasharray=T,this.visual&&ue.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},f.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},H.prototype.getState.call(this))},f.prototype.restoreState=function(T){var W=T;this.fillColor=W.fillColor,this.strokeColor=W.strokeColor,this.strokeWidth=W.strokeWidth,this.strokeDasharray=W.strokeDasharray,this.opacity=W.opacity,this.createVisual(),H.prototype.restoreState.call(this,T),this.setSize()},f.prototype.scale=function(T,W){H.prototype.scale.call(this,T,W),this.setSize()},f.title="Rectangle marker",f}(bt),At=function(H){function f(T,W,J,G){var ve=H.call(this,T,G||'<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=W,ve.currentWidth=J,ve.setCurrentWidth=ve.setCurrentWidth.bind(ve),ve}return Ce(f,H),f.prototype.getUi=function(){var T=this,W=document.createElement("div");return W.style.display="flex",W.style.overflow="hidden",W.style.flexGrow="2",this.widths.forEach(function(J){var G=document.createElement("div");G.style.display="flex",G.style.flexGrow="2",G.style.alignItems="center",G.style.justifyContent="space-between",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.borderColor=J===T.currentWidth?T.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){T.setCurrentWidth(J,G)}),W.appendChild(G);var ve=document.createElement("div");ve.innerText=J.toString(),ve.style.marginRight="5px",G.appendChild(ve);var Ve=document.createElement("div");Ve.style.minHeight="20px",Ve.style.flexGrow="2",Ve.style.display="flex",Ve.style.alignItems="center";var ht=document.createElement("hr");ht.style.minWidth="20px",ht.style.border="0px",ht.style.borderTop=J+"px solid "+T.uiStyleSettings.toolboxColor,ht.style.flexGrow="2",Ve.appendChild(ht),G.appendChild(Ve),T.widthBoxes.push(G)}),W},f.prototype.setCurrentWidth=function(T,W){var J=this;this.currentWidth=T,this.widthBoxes.forEach(function(G){G.style.borderColor=G===W?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},f}(mt),St=function(H){function f(T,W,J,G){var ve=H.call(this,T,G||'<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=W,ve.currentStyle=J,ve.setCurrentStyle=ve.setCurrentStyle.bind(ve),ve}return Ce(f,H),f.prototype.getUi=function(){var T=this,W=document.createElement("div");return W.style.display="flex",W.style.overflow="hidden",W.style.flexGrow="2",this.styles.forEach(function(J){var G=document.createElement("div");G.style.display="flex",G.style.alignItems="center",G.style.justifyContent="space-between",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.overflow="hidden",G.style.maxWidth=100/T.styles.length-5+"%",G.style.borderColor=J===T.currentStyle?T.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){T.setCurrentStyle(J,G)}),W.appendChild(G);var ve=document.createElement("div");ve.style.minHeight="20px",ve.style.flexGrow="2",ve.style.overflow="hidden";var Ve=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+T.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(J!==""?'stroke-dasharray="'+J+'"':"")+` />
|
|
</svg>`;ve.innerHTML=Ve,G.appendChild(ve),T.styleBoxes.push(G)}),W},f.prototype.setCurrentStyle=function(T,W){var J=this;this.currentStyle=T,this.styleBoxes.forEach(function(G){G.style.borderColor=G===W?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},f}(mt),Se=function(H){function f(T,W,J){var G=H.call(this,T,W,J)||this;return G.strokeColor=J.defaultColor,G.strokeWidth=J.defaultStrokeWidth,G.strokeDasharray=J.defaultStrokeDasharray,G.strokePanel=new ot("Line color",J.defaultColorSet,J.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new At("Line width",J.defaultStrokeWidths,J.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new St("Line style",J.defaultStrokeDasharrays,J.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return Ce(f,H),Object.defineProperty(f.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),f.prototype.getState=function(){var T=H.prototype.getState.call(this);return T.typeName=f.typeName,T},f.typeName="FrameMarker",f.title="Frame marker",f.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',f}(Et),Ee=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},He=function(H){function f(T,W,J){var G=H.call(this,T,W,J)||this;return G.x1=0,G.y1=0,G.x2=0,G.y2=0,G.defaultLength=50,G.manipulationStartX=0,G.manipulationStartY=0,G.manipulationStartX1=0,G.manipulationStartY1=0,G.manipulationStartX2=0,G.manipulationStartY2=0,G.setupControlBox(),G}return Ce(f,H),f.prototype.ownsTarget=function(T){return!!H.prototype.ownsTarget.call(this,T)||!(!this.grip1.ownsTarget(T)&&!this.grip2.ownsTarget(T))},f.prototype.pointerDown=function(T,W){H.prototype.pointerDown.call(this,T,W),this.manipulationStartX=T.x,this.manipulationStartY=T.y,this.state==="new"&&(this.x1=T.x,this.y1=T.y,this.x2=T.x,this.y2=T.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(W)?this.activeGrip=this.grip1:this.grip2.ownsTarget(W)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},f.prototype.pointerUp=function(T){var W=this.state;H.prototype.pointerUp.call(this,T),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(T),this._state="select",W==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},f.prototype.adjustVisual=function(){},f.prototype.manipulate=function(T){this.state==="creating"?this.resize(T):this.state==="move"?(this.x1=this.manipulationStartX1+T.x-this.manipulationStartX,this.y1=this.manipulationStartY1+T.y-this.manipulationStartY,this.x2=this.manipulationStartX2+T.x-this.manipulationStartX,this.y2=this.manipulationStartY2+T.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(T)},f.prototype.resize=function(T){switch(this.activeGrip){case this.grip1:this.x1=T.x,this.y1=T.y;break;case this.grip2:case void 0:this.x2=T.x,this.y2=T.y}this.adjustVisual(),this.adjustControlBox()},f.prototype.select=function(){H.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},f.prototype.deselect=function(){H.prototype.deselect.call(this),this.controlBox.style.display="none"},f.prototype.setupControlBox=function(){this.controlBox=ue.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},f.prototype.adjustControlBox=function(){this.positionGrips()},f.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},f.prototype.createGrip=function(){var T=new Ct;return T.visual.transform.baseVal.appendItem(ue.createTransform()),this.controlBox.appendChild(T.visual),T},f.prototype.positionGrips=function(){var T=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-T/2,this.y1-T/2),this.positionGrip(this.grip2.visual,this.x2-T/2,this.y2-T/2)},f.prototype.positionGrip=function(T,W,J){var G=T.transform.baseVal.getItem(0);G.setTranslate(W,J),T.transform.baseVal.replaceItem(G,0)},f.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},H.prototype.getState.call(this))},f.prototype.restoreState=function(T){H.prototype.restoreState.call(this,T);var W=T;this.x1=W.x1,this.y1=W.y1,this.x2=W.x2,this.y2=W.y2},f.prototype.scale=function(T,W){H.prototype.scale.call(this,T,W),this.x1=this.x1*T,this.y1=this.y1*W,this.x2=this.x2*T,this.y2=this.y2*W,this.adjustVisual(),this.adjustControlBox()},f}(qe),Ge=function(H){function f(T,W,J){var G=H.call(this,T,W,J)||this;return G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.setStrokeColor=G.setStrokeColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.strokeColor=J.defaultColor,G.strokeWidth=J.defaultStrokeWidth,G.strokeDasharray=J.defaultStrokeDasharray,G.strokePanel=new ot("Line color",J.defaultColorSet,J.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new At("Line width",J.defaultStrokeWidths,J.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new St("Line style",J.defaultStrokeDasharrays,J.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return Ce(f,H),f.prototype.ownsTarget=function(T){return!(!H.prototype.ownsTarget.call(this,T)&&T!==this.visual&&T!==this.selectorLine&&T!==this.visibleLine)},f.prototype.createVisual=function(){this.visual=ue.createGroup(),this.selectorLine=ue.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=ue.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)},f.prototype.pointerDown=function(T,W){H.prototype.pointerDown.call(this,T,W),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},f.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()),ue.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),ue.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),ue.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},f.prototype.setStrokeColor=function(T){this.strokeColor=T,this.adjustVisual(),this.colorChanged(T)},f.prototype.setStrokeWidth=function(T){this.strokeWidth=T,this.adjustVisual()},f.prototype.setStrokeDasharray=function(T){this.strokeDasharray=T,this.adjustVisual(),this.stateChanged()},Object.defineProperty(f.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),f.prototype.getState=function(){var T=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},H.prototype.getState.call(this));return T.typeName=f.typeName,T},f.prototype.restoreState=function(T){H.prototype.restoreState.call(this,T);var W=T;this.strokeColor=W.strokeColor,this.strokeWidth=W.strokeWidth,this.strokeDasharray=W.strokeDasharray,this.createVisual(),this.adjustVisual()},f.typeName="LineMarker",f.title="Line marker",f.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',f}(He),Re=function(H){function f(T,W,J,G){var ve=H.call(this,T,G||'<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=W,ve.currentFont=J,ve.setCurrentFont=ve.setCurrentFont.bind(ve),ve}return Ce(f,H),f.prototype.getUi=function(){var T=this,W=document.createElement("div");return W.style.overflow="hidden",W.style.flexGrow="2",this.fonts.forEach(function(J){var G=document.createElement("div");G.style.display="inline-block",G.style.alignItems="center",G.style.justifyContent="space-between",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.overflow="hidden",G.style.maxWidth=100/T.fonts.length-5+"%",G.style.borderColor=J===T.currentFont?T.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){T.setCurrentFont(J,G)}),W.appendChild(G);var ve=document.createElement("div");ve.style.display="flex",ve.style.minHeight="20px",ve.style.flexGrow="2",ve.style.fontFamily=J,ve.style.overflow="hidden";var Ve=document.createElement("div");Ve.style.whiteSpace="nowrap",Ve.style.overflow="hidden",Ve.style.textOverflow="ellipsis",Ve.innerHTML="The quick brown fox jumps over the lazy dog",ve.appendChild(Ve),G.appendChild(ve),T.fontBoxes.push(G)}),W},f.prototype.setCurrentFont=function(T,W){var J=this;this.currentFont=T,this.fontBoxes.forEach(function(G){G.style.borderColor=G===W?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},f}(mt),Ue=function(H){function f(T,W,J){var G=H.call(this,T,W,J)||this;return G.color="transparent",G.padding=5,G.DEFAULT_TEXT="your text here",G.text=G.DEFAULT_TEXT,G.isMoved=!1,G.color=J.defaultColor,G.fontFamily=J.defaultFontFamily,G.defaultSize={x:100,y:30},G.setColor=G.setColor.bind(G),G.setFont=G.setFont.bind(G),G.renderText=G.renderText.bind(G),G.sizeText=G.sizeText.bind(G),G.textEditDivClicked=G.textEditDivClicked.bind(G),G.showTextEditor=G.showTextEditor.bind(G),G.setSize=G.setSize.bind(G),G.positionTextEditor=G.positionTextEditor.bind(G),G.colorPanel=new ot("Color",J.defaultColorSet,J.defaultColor),G.colorPanel.onColorChanged=G.setColor,G.fontFamilyPanel=new Re("Font",J.defaultFontFamilies,J.defaultFontFamily),G.fontFamilyPanel.onFontChanged=G.setFont,G}return Ce(f,H),f.prototype.ownsTarget=function(T){if(H.prototype.ownsTarget.call(this,T)||T===this.visual||T===this.textElement||T===this.bgRectangle)return!0;var W=!1;return this.textElement.childNodes.forEach(function(J){J===T&&(W=!0)}),W},f.prototype.createVisual=function(){this.visual=ue.createGroup(),this.bgRectangle=ue.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=ue.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(ue.createTransform()),this.textElement.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},f.prototype.pointerDown=function(T,W){H.prototype.pointerDown.call(this,T,W),this.isMoved=!1,this.pointerDownPoint=T,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(T),this._state="creating")},f.prototype.renderText=function(){var T=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(W){T.textElement.appendChild(ue.createTSpan(W.trim()===""?" ":W.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},f.prototype.getTextScale=function(){var T=this.textElement.getBBox(),W=1;if(T.width>0&&T.height>0){var J=(1*this.width-this.width*this.padding*2/100)/T.width,G=(1*this.height-this.height*this.padding*2/100)/T.height;W=Math.min(J,G)}return W},f.prototype.getTextPosition=function(T){var W=this.textElement.getBBox(),J=0,G=0;return W.width>0&&W.height>0&&(J=(this.width-W.width*T)/2,G=this.height/2-W.height*T/2),{x:J,y:G}},f.prototype.sizeText=function(){var T=this.textElement.getBBox(),W=this.getTextScale(),J=this.getTextPosition(W);J.y-=T.y*W,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+J.x+"px, "+J.y+"px) scale("+W+", "+W+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(J.x,J.y),this.textElement.transform.baseVal.getItem(1).setScale(W,W))},f.prototype.manipulate=function(T){H.prototype.manipulate.call(this,T),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(T.x-this.pointerDownPoint.x)>5||Math.abs(T.y-this.pointerDownPoint.y)>5)},f.prototype.resize=function(T){H.prototype.resize.call(this,T),this.isMoved=!0,this.setSize(),this.sizeText()},f.prototype.setSize=function(){H.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ue.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},f.prototype.pointerUp=function(T){var W=this.state;W==="creating"&&(this._suppressMarkerCreateEvent=!0),H.prototype.pointerUp.call(this,T),this.setSize(),(W==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},f.prototype.showTextEditor=function(){var T=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(W){W.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var W=Number.parseFloat(T.textEditor.style.fontSize);T.textEditor.clientWidth>=Number.parseInt(T.textEditor.style.maxWidth)&&W>.9;)W-=.1,T.textEditor.style.fontSize=Math.max(W,.9)+"em"}),this.textEditor.addEventListener("keyup",function(W){W.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(W){if(W.clipboardData){var J=W.clipboardData.getData("text"),G=window.getSelection();if(!G.rangeCount)return!1;G.deleteFromDocument(),G.getRangeAt(0).insertNode(document.createTextNode(J)),W.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){T.textEditDivClicked(T.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},f.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var T=this.getTextScale(),W=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),J=this.textElement.getBBox(),G={x:J.width*T,y:J.height*T};W.x-=G.x/2,W.y-=G.y/2,this.textEditor.style.top=W.y+"px",this.textEditor.style.left=W.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-W.x+"px",this.textEditor.style.fontSize=Math.max(16*T,12)+"px",this.textElement.style.display="none"}},f.prototype.textEditDivClicked=function(T){this.text=T.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},f.prototype.select=function(){H.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},f.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),H.prototype.deselect.call(this)},f.prototype.dblClick=function(T,W){H.prototype.dblClick.call(this,T,W),this.showTextEditor()},f.prototype.setColor=function(T){this.textElement&&ue.setAttributes(this.textElement,[["fill",T]]),this.color=T,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(T)},f.prototype.setFont=function(T){this.textElement&&ue.setAttributes(this.textElement,[["font-family",T]]),this.fontFamily=T,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},f.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},f.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(f.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),f.prototype.getState=function(){var T=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},H.prototype.getState.call(this));return T.typeName=f.typeName,T},f.prototype.restoreState=function(T){var W=T;this.color=W.color,this.fontFamily=W.fontFamily,this.padding=W.padding,this.text=W.text,this.createVisual(),H.prototype.restoreState.call(this,T),this.setSize()},f.prototype.scale=function(T,W){H.prototype.scale.call(this,T,W),this.setSize(),this.sizeText(),this.positionTextEditor()},f.typeName="TextMarker",f.title="Text marker",f.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>',f}(bt),ge=function(H){function f(T,W,J){var G=H.call(this,T,W,J)||this;return G.color="transparent",G.lineWidth=3,G.drawing=!1,G.pixelRatio=1,G.color=J.defaultColor,G.lineWidth=J.defaultStrokeWidth,G.pixelRatio=J.freehandPixelRatio,G.setColor=G.setColor.bind(G),G.addCanvas=G.addCanvas.bind(G),G.finishCreation=G.finishCreation.bind(G),G.setLineWidth=G.setLineWidth.bind(G),G.colorPanel=new ot("Color",J.defaultColorSet,J.defaultColor),G.colorPanel.onColorChanged=G.setColor,G.lineWidthPanel=new At("Line width",J.defaultStrokeWidths,J.defaultStrokeWidth),G.lineWidthPanel.onWidthChanged=G.setLineWidth,G}return Ce(f,H),f.prototype.ownsTarget=function(T){return!(!H.prototype.ownsTarget.call(this,T)&&T!==this.visual&&T!==this.drawingImage)},f.prototype.createVisual=function(){this.visual=ue.createGroup(),this.drawingImage=ue.createImage(),this.visual.appendChild(this.drawingImage);var T=ue.createTransform();this.visual.transform.baseVal.appendItem(T),this.addMarkerVisualToContainer(this.visual)},f.prototype.pointerDown=function(T,W){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(T.x,T.y),this.drawing=!0):H.prototype.pointerDown.call(this,T,W)},f.prototype.manipulate=function(T){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(T.x,T.y),this.canvasContext.stroke()):H.prototype.manipulate.call(this,T)},f.prototype.resize=function(T){H.prototype.resize.call(this,T),ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ue.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},f.prototype.pointerUp=function(T){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):H.prototype.pointerUp.call(this,T)},f.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)},f.prototype.select=function(){this.state==="creating"&&this.finishCreation(),H.prototype.select.call(this)},f.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),H.prototype.deselect.call(this)},f.prototype.finishCreation=function(){for(var T=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),W=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],J=W[0],G=W[1],ve=W[2],Ve=W[3],ht=!1,Tt=0;Tt<this.canvasElement.height;Tt++)for(var Je=0;Je<this.canvasElement.width;Je++)T.data[Tt*this.canvasElement.width*4+4*Je+3]>0&&(ht=!0,Tt<G&&(G=Tt),Je<J&&(J=Je),Tt>Ve&&(Ve=Tt),Je>ve&&(ve=Je));if(ht){this.left=J/this.pixelRatio,this.top=G/this.pixelRatio,this.width=(ve-J)/this.pixelRatio,this.height=(Ve-G)/this.pixelRatio;var It=document.createElement("canvas");It.width=ve-J,It.height=Ve-G,It.getContext("2d").putImageData(this.canvasContext.getImageData(J,G,ve-J,Ve-G),0,0),this.drawingImgUrl=It.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},f.prototype.setDrawingImage=function(){ue.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),ue.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},f.prototype.setColor=function(T){this.color=T,this.colorChanged(T)},f.prototype.setLineWidth=function(T){this.lineWidth=T},Object.defineProperty(f.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),f.prototype.getState=function(){var T=Object.assign({drawingImgUrl:this.drawingImgUrl},H.prototype.getState.call(this));return T.typeName=f.typeName,T},f.prototype.restoreState=function(T){this.createVisual(),H.prototype.restoreState.call(this,T),this.drawingImgUrl=T.drawingImgUrl,this.setDrawingImage()},f.prototype.scale=function(T,W){H.prototype.scale.call(this,T,W),this.setDrawingImage()},f.typeName="FreehandMarker",f.title="Freehand marker",f.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>',f}(bt),de=function(H){function f(T,W,J){var G=H.call(this,T,J||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return G.typeBoxes=[],G.currentType=W,G.setCurrentType=G.setCurrentType.bind(G),G}return Ce(f,H),f.prototype.getUi=function(){var T=this,W=document.createElement("div");W.style.display="flex",W.style.overflow="hidden",W.style.flexGrow="2";for(var J=function(Ve){var ht="both";switch(Ve){case 0:ht="both";break;case 1:ht="start";break;case 2:ht="end";break;case 3:ht="none"}var Tt=document.createElement("div");if(Tt.style.display="flex",Tt.style.flexGrow="2",Tt.style.alignItems="center",Tt.style.justifyContent="space-between",Tt.style.padding="5px",Tt.style.borderWidth="2px",Tt.style.borderStyle="solid",Tt.style.borderColor=ht===G.currentType?G.uiStyleSettings.toolboxAccentColor:"transparent",Tt.addEventListener("click",function(){T.setCurrentType(ht,Tt)}),W.appendChild(Tt),ht==="both"||ht==="start"){var Je=document.createElement("div");Je.style.display="flex",Je.style.alignItems="center",Je.style.minHeight="20px",Je.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="`+(G.uiStyleSettings!==void 0?G.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Je.style.marginLeft="5px",Tt.appendChild(Je)}var It=document.createElement("div");It.style.display="flex",It.style.alignItems="center",It.style.minHeight="20px",It.style.flexGrow="2";var kt=document.createElement("hr");if(kt.style.minWidth="20px",kt.style.border="0px",kt.style.borderTop="3px solid "+(G.uiStyleSettings!==void 0?G.uiStyleSettings.toolboxColor:"#eeeeee"),kt.style.flexGrow="2",It.appendChild(kt),Tt.appendChild(It),ht==="both"||ht==="end"){var rn=document.createElement("div");rn.style.display="flex",rn.style.alignItems="center",rn.style.minHeight="20px",rn.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="`+(G.uiStyleSettings!==void 0?G.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,rn.style.marginRight="5px",Tt.appendChild(rn)}G.typeBoxes.push(Tt)},G=this,ve=0;ve<4;ve++)J(ve);return W},f.prototype.setCurrentType=function(T,W){var J=this;this.currentType=T,this.typeBoxes.forEach(function(G){G.style.borderColor=G===W?J.uiStyleSettings!==void 0?J.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},f}(mt),ce=function(H){function f(T,W,J){var G=H.call(this,T,W,J)||this;return G.arrowType="end",G.arrowBaseHeight=10,G.arrowBaseWidth=10,G.getArrowPoints=G.getArrowPoints.bind(G),G.setArrowType=G.setArrowType.bind(G),G.arrowTypePanel=new de("Arrow type","end"),G.arrowTypePanel.onArrowTypeChanged=G.setArrowType,G}return Ce(f,H),f.prototype.ownsTarget=function(T){return!(!H.prototype.ownsTarget.call(this,T)&&T!==this.arrow1&&T!==this.arrow2)},f.prototype.getArrowPoints=function(T,W){var J=this.arrowBaseWidth+2*this.strokeWidth,G=this.arrowBaseHeight+2*this.strokeWidth;return T-J/2+","+(W+G/2)+" "+T+","+(W-G/2)+" "+(T+J/2)+","+(W+G/2)},f.prototype.createTips=function(){this.arrow1=ue.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=ue.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.arrow2)},f.prototype.pointerDown=function(T,W){H.prototype.pointerDown.call(this,T,W),this.state==="creating"&&this.createTips()},f.prototype.adjustVisual=function(){if(H.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",ue.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),ue.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var T=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),W=this.arrow1.transform.baseVal.getItem(0);W.setRotate(T,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(W,0);var J=this.arrow2.transform.baseVal.getItem(0);J.setRotate(T+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(J,0)}},f.prototype.setArrowType=function(T){this.arrowType=T,this.adjustVisual(),this.stateChanged()},Object.defineProperty(f.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),f.prototype.getState=function(){var T=Object.assign({arrowType:this.arrowType},H.prototype.getState.call(this));return T.typeName=f.typeName,T},f.prototype.restoreState=function(T){H.prototype.restoreState.call(this,T);var W=T;this.arrowType=W.arrowType,this.createTips(),this.adjustVisual()},f.typeName="ArrowMarker",f.title="Arrow marker",f.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',f}(Ge),te=function(H){function f(T,W,J){var G=H.call(this,T,W,J)||this;return G.fillColor=J.defaultFillColor,G.strokeWidth=0,G.fillPanel=new ot("Color",J.defaultColorSet,J.defaultFillColor),G.fillPanel.onColorChanged=G.setFillColor,G}return Ce(f,H),Object.defineProperty(f.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),f.prototype.getState=function(){var T=H.prototype.getState.call(this);return T.typeName=f.typeName,T},f.typeName="CoverMarker",f.title="Cover marker",f.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',f}(Et),ie=function(H){function f(T,W,J,G){var ve=H.call(this,T,G||'<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=W,ve.currentOpacity=J,ve.setCurrentOpacity=ve.setCurrentOpacity.bind(ve),ve}return Ce(f,H),f.prototype.getUi=function(){var T=this,W=document.createElement("div");return W.style.display="flex",W.style.overflow="hidden",W.style.flexGrow="2",W.style.justifyContent="space-between",this.opacities.forEach(function(J){var G=document.createElement("div");G.style.display="flex",G.style.alignItems="center",G.style.justifyContent="center",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.borderColor=J===T.currentOpacity?T.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){T.setCurrentOpacity(J,G)}),W.appendChild(G);var ve=document.createElement("div");ve.innerText=100*J+"%",G.appendChild(ve),T.opacityBoxes.push(G)}),W},f.prototype.setCurrentOpacity=function(T,W){var J=this;this.currentOpacity=T,this.opacityBoxes.forEach(function(G){G.style.borderColor=G===W?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},f}(mt),ae=function(H){function f(T,W,J){var G=H.call(this,T,W,J)||this;return G.setOpacity=G.setOpacity.bind(G),G.fillColor=J.defaultHighlightColor,G.strokeWidth=0,G.opacity=J.defaultHighlightOpacity,G.fillPanel=new ot("Color",J.defaultColorSet,G.fillColor),G.fillPanel.onColorChanged=G.setFillColor,G.opacityPanel=new ie("Opacity",J.defaultOpacitySteps,G.opacity),G.opacityPanel.onOpacityChanged=G.setOpacity,G}return Ce(f,H),f.prototype.setOpacity=function(T){this.opacity=T,this.visual&&ue.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(f.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),f.prototype.getState=function(){var T=H.prototype.getState.call(this);return T.typeName=f.typeName,T},f.typeName="HighlightMarker",f.title="Highlight marker",f.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>',f}(te),le='<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>',Te=function(H){function f(T,W,J){var G=H.call(this,T,W,J)||this;return G.bgColor="transparent",G.tipPosition={x:0,y:0},G.tipBase1Position={x:0,y:0},G.tipBase2Position={x:0,y:0},G.tipMoving=!1,G.color=J.defaultStrokeColor,G.bgColor=J.defaultFillColor,G.fontFamily=J.defaultFontFamily,G.defaultSize={x:100,y:30},G.setBgColor=G.setBgColor.bind(G),G.getTipPoints=G.getTipPoints.bind(G),G.positionTip=G.positionTip.bind(G),G.setTipPoints=G.setTipPoints.bind(G),G.colorPanel=new ot("Text color",J.defaultColorSet,G.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>'),G.colorPanel.onColorChanged=G.setColor,G.bgColorPanel=new ot("Fill color",J.defaultColorSet,G.bgColor,le),G.bgColorPanel.onColorChanged=G.setBgColor,G.fontFamilyPanel=new Re("Font",J.defaultFontFamilies,J.defaultFontFamily),G.fontFamilyPanel.onFontChanged=G.setFont,G.tipGrip=new Ct,G.tipGrip.visual.transform.baseVal.appendItem(ue.createTransform()),G.controlBox.appendChild(G.tipGrip.visual),G}return Ce(f,H),f.prototype.ownsTarget=function(T){return H.prototype.ownsTarget.call(this,T)||this.tipGrip.ownsTarget(T)||this.tip===T},f.prototype.createTip=function(){ue.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=ue.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},f.prototype.pointerDown=function(T,W){this.state==="new"&&H.prototype.pointerDown.call(this,T,W),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(W)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):H.prototype.pointerDown.call(this,T,W)},f.prototype.pointerUp=function(T){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,H.prototype.pointerUp.call(this,T);else{var W=this.state==="creating";H.prototype.pointerUp.call(this,T),this.setTipPoints(W),this.positionTip()}},f.prototype.manipulate=function(T){if(this.tipMoving){var W=this.unrotatePoint(T);this.tipPosition={x:W.x-this.manipulationStartLeft,y:W.y-this.manipulationStartTop},this.positionTip()}else H.prototype.manipulate.call(this,T)},f.prototype.setBgColor=function(T){this.bgRectangle&&this.tip&&(ue.setAttributes(this.bgRectangle,[["fill",T]]),ue.setAttributes(this.tip,[["fill",T]])),this.bgColor=T,this.fillColorChanged(T)},f.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},f.prototype.setTipPoints=function(T){T===void 0&&(T=!1);var W=Math.min(this.height/2,15),J=this.height/5;T&&(this.tipPosition={x:W+J/2,y:this.height+20});var G=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?G<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(J=this.width/5,W=Math.min(this.width/2,15),this.tipBase1Position={x:W,y:0},this.tipBase2Position={x:W+J,y:0}):(this.tipBase1Position={x:0,y:W},this.tipBase2Position={x:0,y:W+J}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?G<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(J=this.width/5,W=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-W-J,y:0},this.tipBase2Position={x:this.width-W,y:0}):(this.tipBase1Position={x:this.width,y:W},this.tipBase2Position={x:this.width,y:W+J}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?G<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(J=this.width/5,W=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-W-J,y:this.height},this.tipBase2Position={x:this.width-W,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-W-J},this.tipBase2Position={x:this.width,y:this.height-W}):G<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(J=this.width/5,W=Math.min(this.width/2,15),this.tipBase1Position={x:W,y:this.height},this.tipBase2Position={x:W+J,y:this.height}):(this.tipBase1Position={x:0,y:this.height-W},this.tipBase2Position={x:0,y:this.height-W-J})},f.prototype.resize=function(T){H.prototype.resize.call(this,T),this.positionTip()},f.prototype.positionTip=function(){ue.setAttributes(this.tip,[["points",this.getTipPoints()]]);var T=this.tipGrip.visual.transform.baseVal.getItem(0);T.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(T,0)},Object.defineProperty(f.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),f.prototype.select=function(){this.positionTip(),H.prototype.select.call(this)},f.prototype.getState=function(){var T=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},H.prototype.getState.call(this));return T.typeName=f.typeName,T},f.prototype.restoreState=function(T){var W=T;this.bgColor=W.bgColor,this.tipPosition=W.tipPosition,H.prototype.restoreState.call(this,T),this.createTip(),this.setTipPoints()},f.prototype.scale=function(T,W){H.prototype.scale.call(this,T,W),this.tipPosition={x:this.tipPosition.x*T,y:this.tipPosition.y*W},this.positionTip()},f.typeName="CalloutMarker",f.title="Callout marker",f.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>',f}(Ue),be=function(H){function f(T,W,J){var G=H.call(this,T,W,J)||this;return G.fillColor="transparent",G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.opacity=1,G.strokeColor=J.defaultColor,G.strokeWidth=J.defaultStrokeWidth,G.strokeDasharray=J.defaultStrokeDasharray,G.fillColor=J.defaultFillColor,G.setStrokeColor=G.setStrokeColor.bind(G),G.setFillColor=G.setFillColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.setOpacity=G.setOpacity.bind(G),G.createVisual=G.createVisual.bind(G),G.strokePanel=new ot("Line color",pe(J.defaultColorSet,["transparent"]),J.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.fillPanel=new ot("Fill color",pe(J.defaultColorSet,["transparent"]),G.fillColor,le),G.fillPanel.onColorChanged=G.setFillColor,G.strokeWidthPanel=new At("Line width",J.defaultStrokeWidths,J.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new St("Line style",J.defaultStrokeDasharrays,J.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G.opacityPanel=new ie("Opacity",J.defaultOpacitySteps,G.opacity),G.opacityPanel.onOpacityChanged=G.setOpacity,G}return Ce(f,H),f.prototype.ownsTarget=function(T){return!(!H.prototype.ownsTarget.call(this,T)&&T!==this.visual)},f.prototype.createVisual=function(){this.visual=ue.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)},f.prototype.pointerDown=function(T,W){H.prototype.pointerDown.call(this,T,W),this.state==="new"&&(this.createVisual(),this.moveVisual(T),this._state="creating")},f.prototype.manipulate=function(T){H.prototype.manipulate.call(this,T)},f.prototype.resize=function(T){H.prototype.resize.call(this,T),this.setSize()},f.prototype.setSize=function(){H.prototype.setSize.call(this),ue.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},f.prototype.pointerUp=function(T){H.prototype.pointerUp.call(this,T),this.setSize()},f.prototype.setStrokeColor=function(T){this.strokeColor=T,this.visual&&ue.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(T),this.stateChanged()},f.prototype.setFillColor=function(T){this.fillColor=T,this.visual&&ue.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(T),this.stateChanged()},f.prototype.setStrokeWidth=function(T){this.strokeWidth=T,this.visual&&ue.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},f.prototype.setStrokeDasharray=function(T){this.strokeDasharray=T,this.visual&&ue.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},f.prototype.setOpacity=function(T){this.opacity=T,this.visual&&ue.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(f.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),f.prototype.getState=function(){var T=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},H.prototype.getState.call(this));return T.typeName=f.typeName,T},f.prototype.restoreState=function(T){var W=T;this.fillColor=W.fillColor,this.strokeColor=W.strokeColor,this.strokeWidth=W.strokeWidth,this.strokeDasharray=W.strokeDasharray,this.opacity=W.opacity,this.createVisual(),H.prototype.restoreState.call(this,T),this.setSize()},f.prototype.scale=function(T,W){H.prototype.scale.call(this,T,W),this.setSize()},f.typeName="EllipseMarker",f.title="Ellipse marker",f.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>',f}(bt),ze=function(H){function f(T,W,J){return H.call(this,T,W,J)||this}return Ce(f,H),Object.defineProperty(f.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),f.prototype.ownsTarget=function(T){return!(!H.prototype.ownsTarget.call(this,T)&&T!==this.tip1&&T!==this.tip2)},f.prototype.createTips=function(){this.tip1=ue.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(ue.createTransform()),this.visual.appendChild(this.tip1),this.tip2=ue.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(ue.createTransform()),this.visual.appendChild(this.tip2)},f.prototype.pointerDown=function(T,W){H.prototype.pointerDown.call(this,T,W),this.state==="creating"&&this.createTips()},f.prototype.adjustVisual=function(){if(H.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(ue.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()]]),ue.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 T=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),W=this.tip1.transform.baseVal.getItem(0);W.setRotate(T,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(W,0);var J=this.tip2.transform.baseVal.getItem(0);J.setRotate(T+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(J,0)}},Object.defineProperty(f.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),f.prototype.getState=function(){var T=H.prototype.getState.call(this);return T.typeName=f.typeName,T},f.prototype.restoreState=function(T){H.prototype.restoreState.call(this,T),this.createTips(),this.adjustVisual()},f.typeName="MeasurementMarker",f.title="Measurement marker",f.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>',f}(Ge),dt=function(H){function f(T,W,J){var G=H.call(this,T,W,J)||this;return G.strokePanel.colors=J.defaultColorSet,G.fillColor="transparent",G}return Ce(f,H),Object.defineProperty(f.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),f.prototype.getState=function(){var T=H.prototype.getState.call(this);return T.typeName=f.typeName,T},f.typeName="EllipseFrameMarker",f.title="Ellipse frame marker",f.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>',f}(be),yt=function(){function H(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(H.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),H.prototype.addUndoStep=function(f){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(f)||(this.undoStack.push(f),JSON.stringify(this.lastRedoStep)!==JSON.stringify(f)&&this.redoStack.splice(0,this.redoStack.length))},H.prototype.replaceLastUndoStep=function(f){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=f)},H.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},H.prototype.undo=function(){if(this.undoStack.length>1){var f=this.undoStack.pop();return f!==void 0&&this.redoStack.push(f),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},H.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},H}(),ct=function(H){function f(T,W,J){var G=H.call(this,T,W,J)||this;return G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.curveX=0,G.curveY=0,G.manipulationStartCurveX=0,G.manipulationStartCurveY=0,G.setStrokeColor=G.setStrokeColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.positionGrips=G.positionGrips.bind(G),G.addControlGrips=G.addControlGrips.bind(G),G.adjustVisual=G.adjustVisual.bind(G),G.setupControlBox=G.setupControlBox.bind(G),G.resize=G.resize.bind(G),G.strokeColor=J.defaultColor,G.strokeWidth=J.defaultStrokeWidth,G.strokeDasharray=J.defaultStrokeDasharray,G.strokePanel=new ot("Line color",J.defaultColorSet,J.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new At("Line width",J.defaultStrokeWidths,J.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new St("Line style",J.defaultStrokeDasharrays,J.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return Ce(f,H),f.prototype.ownsTarget=function(T){return!(!H.prototype.ownsTarget.call(this,T)&&T!==this.visual&&T!==this.selectorCurve&&T!==this.visibleCurve&&!this.curveGrip.ownsTarget(T))},f.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},f.prototype.createVisual=function(){this.visual=ue.createGroup(),this.selectorCurve=ue.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=ue.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)},f.prototype.pointerDown=function(T,W){H.prototype.pointerDown.call(this,T,W),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=T.x,this.curveY=T.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(W)&&(this.activeGrip=this.curveGrip,this._state="resize")},f.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),ue.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),ue.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),ue.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},f.prototype.setupControlBox=function(){H.prototype.setupControlBox.call(this),this.curveControlLine1=ue.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=ue.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)},f.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,H.prototype.addControlGrips.call(this)},f.prototype.positionGrips=function(){H.prototype.positionGrips.call(this);var T=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-T/2,this.curveY-T/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()))},f.prototype.manipulate=function(T){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+T.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+T.y-this.manipulationStartY),H.prototype.manipulate.call(this,T)},f.prototype.resize=function(T){this.activeGrip===this.curveGrip&&(this.curveX=T.x,this.curveY=T.y),H.prototype.resize.call(this,T),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},f.prototype.setStrokeColor=function(T){this.strokeColor=T,this.adjustVisual(),this.colorChanged(T)},f.prototype.setStrokeWidth=function(T){this.strokeWidth=T,this.adjustVisual()},f.prototype.setStrokeDasharray=function(T){this.strokeDasharray=T,this.adjustVisual()},f.prototype.scale=function(T,W){this.curveX=this.curveX*T,this.curveY=this.curveY*W,H.prototype.scale.call(this,T,W)},Object.defineProperty(f.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),f.prototype.getState=function(){var T=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},H.prototype.getState.call(this));return T.typeName=f.typeName,T},f.prototype.restoreState=function(T){H.prototype.restoreState.call(this,T);var W=T;this.strokeColor=W.strokeColor,this.strokeWidth=W.strokeWidth,this.strokeDasharray=W.strokeDasharray,this.curveX=W.curveX,this.curveY=W.curveY,this.createVisual(),this.adjustVisual()},f.typeName="CurveMarker",f.title="Curve marker",f.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>',f}(He),st=function(){function H(f,T){T===void 0&&(T=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=f,this.cancelable=T}return Object.defineProperty(H.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),H.prototype.preventDefault=function(){this._defaultPrevented=!0},H}(),Be=function(H){function f(T,W,J){var G=H.call(this,T,!1)||this;return G.dataUrl=W,G.state=J,G}return Ce(f,H),f}(st),Fe=function(H){function f(T,W,J){J===void 0&&(J=!1);var G=H.call(this,T,J)||this;return G.marker=W,G}return Ce(f,H),f}(st),Pe=function(){function H(){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 H.prototype.addEventListener=function(f,T){this[f].push(T)},H.prototype.removeEventListener=function(f,T){var W=this[f].indexOf(T);W>-1&&this[f].splice(W,1)},H}(),oe=function(){function H(f){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Ee,this._isOpen=!1,this.undoRedoManager=new yt,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 Pe,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=H.instanceCounter++,this.styles=new et(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=f,this.targetRoot=document.body,this.width=f.clientWidth,this.height=f.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(H.prototype,"ALL_MARKER_TYPES",{get:function(){return[Se,ge,ce,Ue,dt,be,ae,Te,ze,te,Ge,ct]},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[Se,ge,ce,Ue,be,ae,Te]},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"BASIC_MARKER_TYPES",{get:function(){return[Se,ge,ce,Ue,ae]},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(f){var T=this;this._availableMarkerTypes.splice(0),f.forEach(function(W){if(typeof W=="string"){var J=T.ALL_MARKER_TYPES.find(function(G){return G.typeName===W});J!==void 0&&T._availableMarkerTypes.push(J)}else T._availableMarkerTypes.push(W)})},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(f){this._zoomLevel=f,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(H.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),H.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},H.prototype.show=function(){var f=this;this.styles.styleSheetRoot===void 0&<.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=lt.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(T){return T(new st(f))})},H.prototype.render=function(){return Oe(this,void 0,void 0,function(){var f;return De(this,function(T){switch(T.label){case 0:return this.setCurrentMarker(),(f=new at).naturalSize=this.renderAtNaturalSize,f.imageType=this.renderImageType,f.imageQuality=this.renderImageQuality,f.markersOnly=this.renderMarkersOnly,f.width=this.renderWidth,f.height=this.renderHeight,[4,f.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return T.sent(),[4,f.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,T.sent()]}})})},H.prototype.close=function(f){var T=this;if(f===void 0&&(f=!1),this.isOpen){var W=!1;f||this.eventListeners.beforeclose.forEach(function(J){var G=new st(T,!0);J(G),G.defaultPrevented&&(W=!0)}),W||(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(J){return J(new st(T))}),this.detachEvents(),this._isOpen=!1)}},H.prototype.addMarkersToToolbar=function(){for(var f,T=[],W=0;W<arguments.length;W++)T[W]=arguments[W];(f=this._availableMarkerTypes).push.apply(f,T)},H.prototype.addRenderEventListener=function(f){this.addEventListener("render",function(T){f(T.dataUrl,T.state)})},H.prototype.removeRenderEventListener=function(f){},H.prototype.addCloseEventListener=function(f){this.addEventListener("close",function(){f()})},H.prototype.removeCloseEventListener=function(f){},H.prototype.setupResizeObserver=function(){var f=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){f.resize(f.target.clientWidth,f.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return f.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},H.prototype.onPopupTargetResize=function(){var f=1*this.target.clientWidth/this.target.clientHeight,T=this.editorCanvas.clientWidth/f>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*f:this.editorCanvas.clientWidth,W=T<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/f;this.resize(T,W)},H.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},H.prototype.resize=function(f,T){this._isResizing=!0;var W=f/this.imageWidth,J=T/this.imageHeight;this.imageWidth=Math.round(f),this.imageHeight=Math.round(T),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(W,J),this._isResizing=!1},H.prototype.scaleMarkers=function(f,T){var W,J=this;this._currentMarker&&this._currentMarker instanceof Ue?this._currentMarker.scale(f,T):(W=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(G){G!==J._currentMarker&&G.scale(f,T)}),W!==void 0&&this.setCurrentMarker(W)},H.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"},H.prototype.setTopLeft=function(){var f=this.editingTarget.getBoundingClientRect(),T=this.editorCanvas.getBoundingClientRect();this.left=f.left-T.left,this.top=f.top-T.top},H.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)},H.prototype.addDefs=function(){for(var f,T=[],W=0;W<arguments.length;W++)T[W]=arguments[W];this.defs=ue.createDefs(),this.addDefsToImage(),(f=this.defs).append.apply(f,T)},H.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},H.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)},H.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},H.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},H.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)},H.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},H.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)},H.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 f=document.createElement("a");f.href="https://markerjs.com/",f.target="_blank",f.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>',f.title="Powered by marker.js",f.style.display="grid",f.style.alignItems="center",f.style.justifyItems="center",f.style.padding="3px",f.style.width="20px",f.style.height="20px",this.logoUI.appendChild(f),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},H.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")},H.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"},H.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},H.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 f=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=f+"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 Ye(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 rt(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},H.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},H.prototype.removeMarker=function(f){this.markerImage.removeChild(f.container),this.markers.indexOf(f)>-1&&this.markers.splice(this.markers.indexOf(f),1),f.dispose()},H.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())},H.prototype.toolbarButtonClicked=function(f,T){if(f==="marker"&&T!==void 0)this.createNewMarker(T);else if(f==="action")switch(T){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()}},H.prototype.deleteSelectedMarker=function(){var f=this;if(this._currentMarker!==void 0){var T=!1;if(this.eventListeners.markerbeforedelete.forEach(function(J){var G=new Fe(f,f._currentMarker,!0);J(G),G.defaultPrevented&&(T=!0)}),!T){var W=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(J){return J(new Fe(f,W))})}}},H.prototype.clear=function(){var f=this,T=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ve){var Ve=new Fe(f,void 0,!0);ve(Ve),Ve.defaultPrevented&&(T=!0)}),!T)){this.setCurrentMarker();for(var W=function(ve){var Ve=J.markers[ve];J.setCurrentMarker(J.markers[ve]),J._currentMarker.dispose(),J.markerImage.removeChild(J._currentMarker.container),J.markers.splice(J.markers.indexOf(J._currentMarker),1),J.eventListeners.markerdelete.forEach(function(ht){return ht(new Fe(f,Ve))})},J=this,G=this.markers.length-1;G>=0;G--)W(G);this.addUndoStep()}},Object.defineProperty(H.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),H.prototype.showNotesEditor=function(){var f;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=(f=this._currentMarker.notes)!==null&&f!==void 0?f:"",this.overlayContainer.appendChild(this.notesArea))},H.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)},H.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},H.prototype.addUndoStep=function(){var f=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var T=this.getState(),W=this.undoRedoManager.getLastUndoStep();if(!W||W.width===T.width&&W.height===T.height){var J=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(T),J<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(G){return G(new st(f))})}else this.undoRedoManager.replaceLastUndoStep(T),this.eventListeners.statechange.forEach(function(G){return G(new st(f))})}},H.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},H.prototype.undoStep=function(){var f=this,T=this.undoRedoManager.undo();T!==void 0&&(this.restoreState(T),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(W){return W(new st(f))}))},H.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},H.prototype.redoStep=function(){var f=this,T=this.undoRedoManager.redo();T!==void 0&&(this.restoreState(T),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(W){return W(new st(f))}))},H.prototype.stepZoom=function(){var f=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=f<this.zoomSteps.length-1?this.zoomSteps[f+1]:this.zoomSteps[0]},H.prototype.panTo=function(f){this.contentDiv.scrollBy({left:this.prevPanPoint.x-f.x,top:this.prevPanPoint.y-f.y}),this.prevPanPoint=f},H.prototype.startRenderAndClose=function(){return Oe(this,void 0,void 0,function(){var f,T,W=this;return De(this,function(J){switch(J.label){case 0:return[4,this.render()];case 1:return f=J.sent(),T=this.getState(),this.eventListeners.render.forEach(function(G){return G(new Be(W,f,T))}),this.close(!0),[2]}})})},H.prototype.getState=function(f){f===!0&&this.setCurrentMarker();var T={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(W){return T.markers.push(W.getState())}),T},H.prototype.restoreState=function(f){var T=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);f.markers.forEach(function(W){var J=T._availableMarkerTypes.find(function(ve){return ve.typeName===W.typeName});if(J!==void 0){var G=T.addNewMarker(J);G.restoreState(W),T.markers.push(G)}}),f.width&&f.height&&(f.width!==this.imageWidth||f.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/f.width,this.imageHeight/f.height),this.eventListeners.restorestate.forEach(function(W){return W(new st(T))})},H.prototype.addNewMarker=function(f){var T=ue.createGroup();return this.markerImage.appendChild(T),new f(T,this.overlayContainer,this.settings)},H.prototype.createNewMarker=function(f){var T,W=this;(T=typeof f=="string"?this._availableMarkerTypes.find(function(J){return J.typeName===f}):f)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(T),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(T.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(J){return J(new Fe(W,W._currentMarker))}))},H.prototype.markerCreated=function(f){var T=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(f),this.setCurrentMarker(f),f instanceof ge&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(ge):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(W){return W(new Fe(T,T._currentMarker))})},H.prototype.colorChanged=function(f){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=f,this.settings.defaultStrokeColor=f)},H.prototype.fillColorChanged=function(f){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=f)},H.prototype.markerStateChanged=function(f){var T=this;this.eventListeners.markerchange.forEach(function(W){return W(new Fe(T,f))})},H.prototype.setCurrentMarker=function(f){var T=this;this._currentMarker!==f&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(W){return W(new Fe(T,T._currentMarker))})),this._currentMarker=f,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(W){return W(new Fe(T,T._currentMarker))}))},H.prototype.onPointerDown=function(f){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||f.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var T=this.markers.find(function(W){return W.ownsTarget(f.target)});T!==void 0?(this.setCurrentMarker(T),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(f.clientX,f.clientY),f.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:f.clientX,y:f.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(f.clientX,f.clientY))},H.prototype.onDblClick=function(f){if(this._isFocused||this.focus(),this.mode==="select"){var T=this.markers.find(function(W){return W.ownsTarget(f.target)});T!==void 0&&T!==this._currentMarker&&this.setCurrentMarker(T),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(f.clientX,f.clientY),f.target):this.setCurrentMarker()}},H.prototype.onPointerMove=function(f){this.touchPoints!==1&&f.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||f.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(f.clientX,f.clientY)):this.zoomLevel>1&&this.panTo({x:f.clientX,y:f.clientY}))},H.prototype.onPointerUp=function(f){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(f.clientX,f.clientY)),this.isDragging=!1,this.addUndoStep()},H.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},H.prototype.onKeyUp=function(f){this._currentMarker===void 0||this.notesArea!==void 0||f.key!=="Delete"&&f.key!=="Backspace"||this.deleteSelectedMarker()},H.prototype.clientToLocalCoordinates=function(f,T){var W=this.markerImage.getBoundingClientRect();return{x:(f-W.left)/this.zoomLevel,y:(T-W.top)/this.zoomLevel}},H.prototype.onWindowResize=function(){this.positionUI()},H.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var f=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=f+"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()},H.prototype.addLicenseKey=function(f){Me.addKey(f)},H.prototype.addEventListener=function(f,T){this.eventListeners.addEventListener(f,T)},H.prototype.removeEventListener=function(f,T){this.eventListeners.removeEventListener(f,T)},H.prototype.renderState=function(f){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(f),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(H.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),H.prototype.focus=function(){var f=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(T){return T(new st(f))}))},H.prototype.blur=function(){var f=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(T){return T(new st(f))}))},H.instanceCounter=0,H}();/* **********************************
|
|
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 fe=function(H,f){return(fe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(T,W){T.__proto__=W}||function(T,W){for(var J in W)Object.prototype.hasOwnProperty.call(W,J)&&(T[J]=W[J])})(H,f)};function We(H,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");function T(){this.constructor=H}fe(H,f),H.prototype=f===null?Object.create(f):(T.prototype=f.prototype,new T)}function Ie(H,f,T,W){return new(T||(T=Promise))(function(J,G){function ve(Tt){try{ht(W.next(Tt))}catch(Je){G(Je)}}function Ve(Tt){try{ht(W.throw(Tt))}catch(Je){G(Je)}}function ht(Tt){var Je;Tt.done?J(Tt.value):(Je=Tt.value,Je instanceof T?Je:new T(function(It){It(Je)})).then(ve,Ve)}ht((W=W.apply(H,f||[])).next())})}function tt(H,f){var T,W,J,G,ve={label:0,sent:function(){if(1&J[0])throw J[1];return J[1]},trys:[],ops:[]};return G={next:Ve(0),throw:Ve(1),return:Ve(2)},typeof Symbol=="function"&&(G[Symbol.iterator]=function(){return this}),G;function Ve(ht){return function(Tt){return function(Je){if(T)throw new TypeError("Generator is already executing.");for(;ve;)try{if(T=1,W&&(J=2&Je[0]?W.return:Je[0]?W.throw||((J=W.return)&&J.call(W),0):W.next)&&!(J=J.call(W,Je[1])).done)return J;switch(W=0,J&&(Je=[2&Je[0],J.value]),Je[0]){case 0:case 1:J=Je;break;case 4:return ve.label++,{value:Je[1],done:!1};case 5:ve.label++,W=Je[1],Je=[0];continue;case 7:Je=ve.ops.pop(),ve.trys.pop();continue;default:if(!(J=ve.trys,(J=J.length>0&&J[J.length-1])||Je[0]!==6&&Je[0]!==2)){ve=0;continue}if(Je[0]===3&&(!J||Je[1]>J[0]&&Je[1]<J[3])){ve.label=Je[1];break}if(Je[0]===6&&ve.label<J[1]){ve.label=J[1],J=Je;break}if(J&&ve.label<J[2]){ve.label=J[2],ve.ops.push(Je);break}J[2]&&ve.ops.pop(),ve.trys.pop();continue}Je=f.call(H,ve)}catch(It){Je=[6,It],W=0}finally{T=J=0}if(5&Je[0])throw Je[1];return{value:Je[0]?Je[1]:void 0,done:!0}}([ht,Tt])}}}var ft=function(){function H(){}return H.addKey=function(f){H.key=f},Object.defineProperty(H,"isLicensed",{get:function(){return!!H.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(H.key)},enumerable:!1,configurable:!0}),H}(),Ae=function(){function H(){}return H.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},H.setAttributes=function(f,T){for(var W=0,J=T;W<J.length;W++){var G=J[W],ve=G[0],Ve=G[1];f.setAttribute(ve,Ve)}},H.createRect=function(f,T,W){var J=document.createElementNS("http://www.w3.org/2000/svg","rect");return J.setAttribute("width",f.toString()),J.setAttribute("height",T.toString()),W&&H.setAttributes(J,W),J},H.createLine=function(f,T,W,J,G){var ve=document.createElementNS("http://www.w3.org/2000/svg","line");return ve.setAttribute("x1",f.toString()),ve.setAttribute("y1",T.toString()),ve.setAttribute("x2",W.toString()),ve.setAttribute("y2",J.toString()),G&&H.setAttributes(ve,G),ve},H.createPolygon=function(f,T){var W=document.createElementNS("http://www.w3.org/2000/svg","polygon");return W.setAttribute("points",f),T&&H.setAttributes(W,T),W},H.createCircle=function(f,T){var W=document.createElementNS("http://www.w3.org/2000/svg","circle");return W.setAttribute("cx",(f/2).toString()),W.setAttribute("cy",(f/2).toString()),W.setAttribute("r",f.toString()),T&&H.setAttributes(W,T),W},H.createEllipse=function(f,T,W){var J=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return J.setAttribute("cx",(f/2).toString()),J.setAttribute("cy",(T/2).toString()),J.setAttribute("rx",(f/2).toString()),J.setAttribute("ry",(T/2).toString()),W&&H.setAttributes(J,W),J},H.createGroup=function(f){var T=document.createElementNS("http://www.w3.org/2000/svg","g");return f&&H.setAttributes(T,f),T},H.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},H.createMarker=function(f,T,W,J,G,ve,Ve){var ht=document.createElementNS("http://www.w3.org/2000/svg","marker");return H.setAttributes(ht,[["id",f],["orient",T],["markerWidth",W.toString()],["markerHeight",J.toString()],["refX",G.toString()],["refY",ve.toString()]]),ht.appendChild(Ve),ht},H.createText=function(f){var T=document.createElementNS("http://www.w3.org/2000/svg","text");return T.setAttribute("x","0"),T.setAttribute("y","0"),f&&H.setAttributes(T,f),T},H.createTSpan=function(f,T){var W=document.createElementNS("http://www.w3.org/2000/svg","tspan");return W.textContent=f,T&&H.setAttributes(W,T),W},H.createImage=function(f){var T=document.createElementNS("http://www.w3.org/2000/svg","image");return f&&H.setAttributes(T,f),T},H.createPoint=function(f,T){var W=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return W.x=f,W.y=T,W},H.createPath=function(f,T){var W=document.createElementNS("http://www.w3.org/2000/svg","path");return W.setAttribute("d",f),T&&H.setAttributes(W,T),W},H.createElement=function(f,T){var W=document.createElementNS("http://www.w3.org/2000/svg",f);return T&&H.setAttributes(W,T),W},H.getHollowRectanglePath=function(f,T,W,J,G,ve,Ve,ht){return"M"+f+","+T+"V"+(T+J)+"H"+(f+W)+"V"+T+"H"+G+"V"+ve+"H"+(G+Ve)+"V"+(ve+ht)+"H"+G+"V"+T+"Z"},H}(),nt=function(){function H(f){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+f+"_"}return Object.defineProperty(H.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(H.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(H.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),H.prototype.addClass=function(f){return this.styleSheet===void 0&&this.addStyleSheet(),f.name=""+this.classNamePrefix+f.localName,this.classes.push(f),this.styleSheet.sheet.insertRule("."+f.name+" {"+f.style+"}",this.styleSheet.sheet.cssRules.length),f},H.prototype.addRule=function(f){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(f),this.styleSheet.sheet.insertRule(f.selector+" {"+f.style+"}",this.styleSheet.sheet.cssRules.length)},H.prototype.addStyleSheet=function(){var f;this.styleSheet=document.createElement("style"),((f=this.styleSheetRoot)!==null&&f!==void 0?f:document.head).appendChild(this.styleSheet),this.addRule(new gt("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new gt("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new gt("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new Bt("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new Bt("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},H.prototype.removeStyleSheet=function(){var f;this.styleSheet&&(((f=this.styleSheetRoot)!==null&&f!==void 0?f:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},H}(),gt=function(H,f){this.selector=H,this.style=f},Bt=function(H,f){this.localName=H,this.style=f},pt=function(){function H(){this.blocks=[],this.display=""}return H.prototype.addButtonBlock=function(f){f.className=this.blockClassName,f.buttonClassName=this.buttonClassName,f.buttonColorsClassName=this.buttonColorsClassName,f.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(f)},H.prototype.addElementBlock=function(f){f.className===void 0&&(f.className=this.blockClassName),this.blocks.push(f)},H.prototype.getUI=function(){var f=document.createElement("div");return f.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,f.style.display=this.display,this.blocks.forEach(function(T){return f.appendChild(T.getUI())}),f},H}(),sn=function(){function H(){}return H.prototype.getUI=function(){var f=document.createElement("div");if(f.className=this.className,this.minWidth!==void 0&&(f.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":f.style.justifyContent="flex-start";break;case"center":f.style.justifyContent="center";break;case"end":f.style.justifyContent="flex-end"}return f.style.whiteSpace="nowrap",f},H}(),gn=function(H){function f(){var T=H!==null&&H.apply(this,arguments)||this;return T.buttons=[],T}return We(f,H),f.prototype.addButton=function(T){T.className=this.buttonClassName,T.colorsClassName=this.buttonColorsClassName,T.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(T)},f.prototype.getUI=function(){var T=H.prototype.getUI.call(this);return this.buttons.forEach(function(W){return T.appendChild(W.getUI())}),T},f}(sn),en=function(){function H(f,T){this._isActive=!1,this._isHidden=!1,this._icon=f,this.title=T,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(H.prototype,"icon",{get:function(){return this._icon},set:function(f){this._icon=f,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isActive",{get:function(){return this._isActive},set:function(f){this._isActive=f,this.adjustClassName()},enumerable:!1,configurable:!0}),H.prototype.getUI=function(){var f=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 f.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},H.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,"")))},H.prototype.hide=function(){this._isHidden=!0},H}(),Dt=function(H){function f(){var T=H!==null&&H.apply(this,arguments)||this;return T.elements=[],T}return We(f,H),f.prototype.addElement=function(T){this.elements.push(T)},f.prototype.getUI=function(){var T=H.prototype.getUI.call(this);return this.elements.forEach(function(W){return T.appendChild(W)}),T},f}(sn),Sn=function(){function H(f,T){this.horizontal=f,this.vertical=T}return Object.defineProperty(H.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),H.prototype.getVerticalLength=function(f){return f/this.ratio},H.prototype.getHorizontalLength=function(f){return f*this.ratio},H}(),Nn=function(){function H(){}return H.getIcon=function(f,T){if(f>0&&T>0){var W=new Sn(f,T),J=W.ratio>=1?20:W.getHorizontalLength(20),G=W.ratio<1?20:W.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 Ve=Ae.createDefs();ve.appendChild(Ve);var ht=Ae.createElement("clipPath",[["id","text-bg-clip"]]);Ve.appendChild(ht);var Tt=Ae.createPath(Ae.getHollowRectanglePath((24-J)/2,(24-G)/2,J,G,(24-J)/2+2,(24-G)/2+2,J-4,G-4));ve.appendChild(Tt);var Je=Ae.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Je.appendChild(Ae.createTSpan(f+":"+T)),ve.appendChild(Je);var It=Je.getBBox();Ae.setAttributes(Je,[["x",((24-It.width)/2).toString()],["y",((24-It.height)/2-It.y).toString()]]);var kt=Ae.createPath(Ae.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(It.width))/2,(24-Math.ceil(It.height))/2,Math.ceil(It.width),Math.ceil(It.height)));return ht.appendChild(kt),Ae.setAttributes(Tt,[["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>'},H}(),Ne=function(H){function f(T,W,J){var G=H.call(this,T,W)||this;return G.isDropdownOpen=!1,G.onClick=G.dropdownButtonClicked,G.dropdownButtons=J,G}return We(f,H),f.prototype.setupDropdown=function(){var T=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(W){W.className=T.className,W.colorsClassName=T.colorsClassName,T.dropdownBlock.appendChild(W.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},f.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},f.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},f.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},f.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},f.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},f}(en),it=function(){function H(f,T){this.GRIP_SIZE=10,this.color=f,this.fillColor=T,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 H.prototype.ownsTarget=function(f){return f===this.visual||f===this.visual.childNodes[0]||f===this.visual.childNodes[1]},H.prototype.setCenter=function(f,T){this.visual.childNodes.forEach(function(W){return Ae.setAttributes(W,[["cx",f.toString()],["cy",T.toString()]])})},H}(),Pt=function(){function H(f,T,W,J){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=f,this.canvasHeight=T,this.margin=W,this.container=J,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(H.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(f){this._aspectRatio=f,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(f){this._isGridVisible=f,this.gridContainer&&Ae.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(f){this._zoomFactor=f,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),H.prototype.open=function(){var f=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 T=0;T<this.numberOfGridLines;T++)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(W){return f.gridContainer.appendChild(W)}),this.verticalGridLines.forEach(function(W){return f.gridContainer.appendChild(W)}),this.cropRectElement=Ae.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new it(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new it(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new it(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new it(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},H.prototype.setCropRectangle=function(f){this.cropRect=f;var T=Object.assign({},this.cropRect);this.zoomFactor!==1&&(T.width=this.cropRect.width*this.zoomFactor,T.height=this.cropRect.height*this.zoomFactor,T.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-T.width/2,T.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-T.height/2),Ae.setAttributes(this.cropRectElement,[["x",T.x.toString()],["y",T.y.toString()],["width",T.width.toString()],["height",T.height.toString()]]);var W=T.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(G,ve){var Ve=T.y+W*(ve+1);Ae.setAttributes(G,[["x1",""+T.x],["y1",""+Ve],["x2",""+(T.x+T.width)],["y2",""+Ve]])});var J=T.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(G,ve){var Ve=T.x+J*(ve+1);Ae.setAttributes(G,[["x1",""+Ve],["y1",""+T.y],["x2",""+Ve],["y2",""+(T.y+T.height)]])}),Ae.setAttributes(this.cropShadeElement,[["d",Ae.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,T.x,T.y,T.width,T.height)]]),this.topLeftGrip.setCenter(T.x,T.y),this.topRightGrip.setCenter(T.x+T.width,T.y),this.bottomLeftGrip.setCenter(T.x,T.y+T.height),this.bottomRightGrip.setCenter(T.x+T.width,T.y+T.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},H.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)},H.prototype.clientToLocalCoordinates=function(f,T){var W=this.container.getBoundingClientRect();return{x:f-W.left+this.margin,y:T-W.top+this.margin}},H.prototype.onPointerDown=function(f){this.container.setPointerCapture(f.pointerId),this.previousPoint=this.clientToLocalCoordinates(f.clientX,f.clientY),this.cropRectElement===f.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(f.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(f.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(f.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(f.target)&&(this.activeGrip=this.bottomRightGrip)},H.prototype.onPointerMove=function(f){if(this.isMoving)this.move(this.clientToLocalCoordinates(f.clientX,f.clientY));else if(this.activeGrip){var T=this.clientToLocalCoordinates(f.clientX,f.clientY);this.resize(T)}f.preventDefault()},H.prototype.onPointerUp=function(f){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(f.pointerId)},H.prototype.move=function(f){var T=f.x-this.previousPoint.x,W=f.y-this.previousPoint.y;this.zoomFactor!==1&&(T=-T/this.zoomFactor,W=-W/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+T),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+W),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=f},H.prototype.resize=function(f){var T=Object.assign({},this.cropRect),W=f.x-this.previousPoint.x,J=f.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:T.x+W<this.margin&&(W=this.margin-T.x),T.x+=W,T.width=this.cropRect.x+this.cropRect.width-T.x;break;case this.bottomRightGrip:case this.topRightGrip:T.width+W>this.canvasWidth*this.zoomFactor&&(W=this.canvasWidth*this.zoomFactor-T.width),T.width+=W}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(T.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(W),T.height=this.aspectRatio.getVerticalLength(T.width)):(T.y+=J,T.height=this.cropRect.y+this.cropRect.height-T.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?T.height=this.aspectRatio.getVerticalLength(T.width):T.height+=J}T.width<10&&(T.x=this.cropRect.x,T.width=10),T.height<10&&(T.y=this.cropRect.y,T.height=10),this.previousPoint=f,T.x>=this.margin&&T.y>=this.margin&&T.x-this.margin+T.width<=this.canvasWidth&&T.y-this.margin+T.height<=this.canvasHeight&&(this.cropRect=T,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},H.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var f=this.cropRect.x+this.cropRect.width/2,T=this.cropRect.y+this.cropRect.height/2,W=this.aspectRatio.getHorizontalLength(this.cropRect.height),J=this.aspectRatio.getVerticalLength(this.cropRect.width);W/this.canvasWidth<J/this.canvasHeight?this.cropRect.width=W:this.cropRect.height=J,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=f-this.cropRect.width/2,this.cropRect.y=T-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)}},H.prototype.getRescaledRect=function(f,T,W,J,G,ve){var Ve=W/f,ht=J/T;return{x:(G.x-ve)*Ve+ve,y:(G.y-ve)*ht+ve,width:G.width*Ve,height:G.height*ht}},H.prototype.scaleCanvas=function(f,T){var W=this.getRescaledRect(this.canvasWidth,this.canvasHeight,f,T,this.cropRect,this.margin);this.canvasWidth=f,this.canvasHeight=T,this.onCropChange&&this.onCropChange(W),this.setCropRectangle(W)},H}(),Qt=function(){function H(f){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=f,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(H.prototype,"angle",{get:function(){return this._angle},set:function(f){this._angle=f,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),H.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},H.prototype.onPointerDown=function(f){this.controlContainer.setPointerCapture(f.pointerId),this.isDragging=!0,this.previousPoint={x:f.clientX,y:f.clientY}},H.prototype.onPointerMove=function(f){this.isDragging&&(this.onAngleChange&&this.onAngleChange((f.clientX-this.previousPoint.x)/5),this.previousPoint.x=f.clientX)},H.prototype.onPointerUp=function(f){this.isDragging&&this.onAngleChange&&this.onAngleChange((f.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(f.pointerId)},H.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var f=this.angleLabelText.getBBox();Ae.setAttributes(this.angleLabelElement,[["x",((this.width-f.width)/2).toString()],["y",(this.height/2).toString()]])}},H.prototype.positionScaleShape=function(){if(this.scaleShape){var f=this.scaleShape.transform.baseVal.getItem(0);f.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(f,0)}},H.prototype.getVisual=function(){var f=document.createElementNS("http://www.w3.org/2000/svg","svg");f.setAttribute("xmlns","http://www.w3.org/2000/svg"),f.setAttribute("width",this.width+"px"),f.setAttribute("height",this.height+"px"),f.setAttribute("viewBox","0 0 "+this.width+" "+this.height),f.style.flexShrink="0",document.body.appendChild(f);for(var T="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,W=1;W<=this.width/5+10;W++){var J=W%5==0?this.height/3:this.height/6;T+="h4v"+-J+"h1v"+J}T+="v1H0Z",this.scaleShape=Ae.createPath(T);var G=Ae.createTransform();this.scaleShape.transform.baseVal.appendItem(G),f.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),f.appendChild(this.angleLabelElement),document.body.removeChild(f),f},H}(),un=function(){function H(){this.naturalSize=!1,this.imageType="image/png"}return H.prototype.rasterize=function(f,T,W,J,G,ve,Ve){var ht=this;return new Promise(function(Tt){var Je=document.createElement("canvas");Je.width=f.width.baseVal.value-2*J,Je.height=f.height.baseVal.value-2*J;var It=1,kt=1;ht.naturalSize===!0?(It=T.naturalWidth/(f.width.baseVal.value-2*J)/ve,kt=T.naturalHeight/(f.height.baseVal.value-2*J)/Ve,Je.width=T.naturalWidth/ve,Je.height=T.naturalHeight/Ve):ht.width!==void 0&&ht.height!==void 0&&(It=ht.width/W.width,kt=ht.height/W.height,Je.width*=It,Je.height*=kt);var rn=Je.getContext("2d");rn.translate(Je.width/2,Je.height/2),rn.rotate(G*Math.PI/180),rn.scale(ve,Ve),rn.translate(-Je.width/2,-Je.height/2),rn.drawImage(T,0,0,Je.width,Je.height);var An=document.createElement("canvas");An.width=W.width*It,An.height=W.height*kt,An.getContext("2d").putImageData(rn.getImageData((W.x-J)*It,(W.y-J)*kt,W.width*It,W.height*kt),0,0),Tt(An.toDataURL(ht.imageType,ht.imageQuality))})},H}(),$e=function(){function H(f){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=H.instanceCounter++,this.styles=new nt(this.instanceNo),this.target=f,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(H.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(f){this._zoomToCropEnabled=f,f?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(f){this._isGridVisible=f,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"gridLines",{get:function(){return this._gridLines},set:function(f){this._gridLines=f,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(f){this._rotationAngle=f,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"aspectRatio",{get:function(){var f;return(f=this._aspectRatio)!==null&&f!==void 0?f:this.aspectRatios[0]},set:function(f){this._aspectRatio=f},enumerable:!1,configurable:!0}),H.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},H.prototype.show=function(){this.showUI(),this.open()},H.prototype.close=function(f){f===void 0&&(f=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),f||this.closeEventListeners.forEach(function(T){return T()}),this._isOpen=!1)},H.prototype.addRenderEventListener=function(f){this.renderEventListeners.push(f)},H.prototype.removeRenderEventListener=function(f){this.renderEventListeners.indexOf(f)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(f),1)},H.prototype.addCloseEventListener=function(f){this.closeEventListeners.push(f)},H.prototype.removeCloseEventListener=function(f){this.closeEventListeners.indexOf(f)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(f),1)},H.prototype.setupResizeObserver=function(){var f=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){f.resize(f.target.clientWidth,f.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))},H.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var f=1*this.target.clientWidth/this.target.clientHeight,T=this.contentDiv.clientWidth/f>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*f:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,W=T+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/f;this.resize(T,W)}},H.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},H.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"},H.prototype.resize=function(f,T){this.imageWidth=Math.round(f),this.imageHeight=Math.round(T),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()},H.prototype.setEditingTarget=function(){var f=document.createElement("canvas");f.width=this.target.naturalWidth,f.height=this.target.naturalHeight,f.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var T=f.toDataURL();Ae.setAttributes(this.editingTarget,[["href",T]]),this.setEditingTargetSize()},H.prototype.setTopLeft=function(){var f=this.target.getBoundingClientRect(),T=this.editorCanvas.getBoundingClientRect();this.left=f.left-T.left-this.CANVAS_MARGIN,this.top=f.top-T.top-this.CANVAS_MARGIN},H.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 f=Ae.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(f);var T=Ae.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(T),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)},H.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},H.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 Pt(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()},H.prototype.zoomToCrop=function(){if(this.cropRect){var f=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,T=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=f+"px "+T+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-f+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-T+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},H.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)},H.prototype.cropRectChanged=function(f){this.cropRect=f,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},H.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},H.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"},H.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},H.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 f=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,T=this.target.offsetTop>f+this.CANVAS_MARGIN?this.target.offsetTop-(f+this.CANVAS_MARGIN):0;this.coverDiv.style.top=T+"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},H.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},H.prototype.addTopToolbar=function(){var f=this;this.topToolbar=new pt,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 T=new gn;T.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(T);var W=[];this.aspectRatios.forEach(function(kt){var rn=new en(Nn.getIcon(kt.horizontal,kt.vertical),kt.horizontal===0&&kt.vertical===0?"FREE":kt.horizontal+":"+kt.vertical);rn.onClick=function(){return f.ratioButtonClicked(kt)},W.push(rn)}),this.aspectRatioButton=new Ne(Nn.getIcon(0,0),"Aspect ratio",W),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,T.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var J=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");J.isActive=this.isGridVisible,J.onClick=function(){f.isGridVisible=!f.isGridVisible,J.isActive=f.isGridVisible},T.addButton(J);var G=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(G.isActive=this.zoomToCropEnabled,G.onClick=function(){f.zoomToCropEnabled=!f.zoomToCropEnabled,G.isActive=f.zoomToCropEnabled},T.addButton(G),!ft.isLicensed){var ve=new Dt;this.topToolbar.addElementBlock(ve);var Ve=document.createElement("div");Ve.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var ht=document.createElement("a");ht.style.color="currentColor",ht.href="https://markerjs.com/products/cropro",ht.target="_blank",ht.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>',Ve.appendChild(ht),ve.addElement(Ve)}var Tt=new gn;Tt.minWidth=3*this.toolbarHeight+"px",Tt.contentAlign="end",this.topToolbar.addButtonBlock(Tt);var Je=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");Je.onClick=this.startRenderAndClose,Tt.addButton(Je),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Je.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var It=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");It.onClick=this.close,Tt.addButton(It),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(It.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},H.prototype.addBottomToolbar=function(){var f=this;this.bottomToolbar=new pt,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 T=new gn;T.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(T);var W=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");W.onClick=this.rotateLeftButtonClicked,T.addButton(W);var J=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");J.onClick=this.rotateRightButtonClicked,T.addButton(J);var G=new Dt;G.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(G),this.straightener=new Qt("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(Tt){f.rotateBy(Tt),f.straightener.angle=f.rotationAngle},G.addElement(this.straightener.getUI());var ve=new gn;ve.minWidth=2*this.toolbarHeight+"px",ve.contentAlign="end",this.bottomToolbar.addButtonBlock(ve);var Ve=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");Ve.onClick=this.flipHorizontallyButtonClicked,ve.addButton(Ve);var ht=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");ht.onClick=this.flipVerticallyButtonClicked,ve.addButton(ht)},H.prototype.ratioButtonClicked=function(f){this.aspectRatio=f,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},H.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Nn.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},H.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Sn(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},H.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},H.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},H.prototype.restoreState=function(f){if(f){var T=this.cropLayer.getRescaledRect(f.width,f.height,this.imageWidth,this.imageHeight,f.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(T),this.cropRectChanged(T),this.flippedHorizontally=f.flippedHorizontally,this.flippedVertically=f.flippedVertically,this.applyFlip(),this.rotationAngle=f.rotationAngle,this.applyRotation()}},H.prototype.clientToLocalCoordinates=function(f,T){var W=this.cropImage.getBoundingClientRect();return{x:f-W.left,y:T-W.top}},H.prototype.onWindowResize=function(){this.positionUI()},H.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var f=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=f+"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()},H.prototype.rotateLeftButtonClicked=function(){var f=this.rotationAngle-90;this.rotationAngle%90!=0&&(f+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(f)},H.prototype.rotateRightButtonClicked=function(){var f=this.rotationAngle+90;this.rotationAngle%90!=0&&(f-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(f)},H.prototype.rotateTo=function(f){f=(f=f>180?f-360:f)<=-180?f+360:f,this.rotationAngle=f,this.applyRotation()},H.prototype.rotateBy=function(f){this.rotateTo((this.rotationAngle+f)%360)},H.prototype.applyRotation=function(){var f=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var T=this.editingTargetRotationContainer.transform.baseVal.getItem(0);T.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(T,0);var W=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/W.width,this.imageHeight/W.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=f},H.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},H.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},H.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},H.prototype.startRenderAndClose=function(){return Ie(this,void 0,void 0,function(){var f,T;return tt(this,function(W){switch(W.label){case 0:return[4,this.render()];case 1:return f=W.sent(),T=this.getState(),this.renderEventListeners.forEach(function(J){return J(f,T)}),this.close(!0),[2]}})})},H.prototype.render=function(){return Ie(this,void 0,void 0,function(){var f;return tt(this,function(T){switch(T.label){case 0:return(f=new un).naturalSize=this.renderAtNaturalSize,f.imageType=this.renderImageType,f.imageQuality=this.renderImageQuality,f.width=this.renderWidth,f.height=this.renderHeight,this.unzoomFromCrop(),Ae.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,f.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 T.sent(),[4,f.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,T.sent()]}})})},H.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Bt("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 Bt("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Bt("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var f=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Bt("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*f)+`px;
|
|
height: `+(this.toolbarHeight-2*f)+`px;
|
|
padding: `+f+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Bt("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Bt("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new gt("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new gt("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new Bt("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 Bt("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Bt("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 Bt("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*f)+`px;
|
|
padding: `+f+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Bt("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},H.instanceCounter=0,H}(),Ot=U("8hTe"),Ht=U.n(Ot),jt=/<pre[^>]*>/g;function mn(H){var f=document.createElement("div");return f.innerHTML=H,f.childNodes.length===0?"":f.childNodes[0].nodeValue}var Jt=we.a=function(H){var f=H.value,T=f===void 0?"":f,W=H.edit,J=W===void 0?!1:W,G=H.className,ve=H.showTextOnly,Ve=H.showLines,ht=H.replaces,Tt=H.zoomImg,Je=H.hasMask,It=H.style,kt=It===void 0?{}:It,rn=H.stylesPrev,An=rn===void 0?{}:rn,Vn=String(T),vn=Object(k.useRef)(),hn=Object(k.useRef)(),wn=Object(k.useState)(""),yn=Object(B.a)(wn,2),Cn=yn[0],fn=yn[1],bn=Object(k.useState)("office"),En=Object(B.a)(bn,2),Yn=En[0],Kn=En[1],Ar=function(){var Nt=new $e(hn.current);Nt.displayMode="popup",Nt.addRenderEventListener(function(){var Rn=Object(w.a)(A.a.mark(function dn(_n){var cn;return A.a.wrap(function(Ln){for(;;)switch(Ln.prev=Ln.next){case 0:return vn.current.style.display="none",Ln.next=3,Object(_e.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:_n}});case 3:cn=Ln.sent,cn!=null&&cn.id&&ht(hn.current.getAttribute("src").replace(re.a.API_SERVER,""),"/api/attachments/".concat(cn==null?void 0:cn.id,"?type=").concat(cn.content_type));case 5:case"end":return Ln.stop()}},dn)}));return function(dn){return Rn.apply(this,arguments)}}()),Nt.show()},Dn=function(){var Nt=new oe(hn.current);Nt.settings.displayMode="popup",Nt.addEventListener("render",function(){var Rn=Object(w.a)(A.a.mark(function dn(_n){var cn;return A.a.wrap(function(Ln){for(;;)switch(Ln.prev=Ln.next){case 0:if(vn.current.style.display="none",!hn.current){Ln.next=6;break}return Ln.next=4,Object(_e.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:_n.dataUrl}});case 4:cn=Ln.sent,cn!=null&&cn.id&&ht(hn.current.getAttribute("src").replace(re.a.API_SERVER,""),"/api/attachments/".concat(cn==null?void 0:cn.id,"?type=").concat(cn.content_type));case 6:case"end":return Ln.stop()}},dn)}));return function(dn){return Rn.apply(this,arguments)}}()),Nt.show(),window.markerArea=Nt},fr=Object(k.useMemo)(function(){try{var pn=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Nt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Rn=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Vn=Vn.replace(pn,"("+re.a.API_SERVER+"/api/attachments/").replace(Nt,'"'+re.a.API_SERVER+"/api/attachments/").replace(Rn,'"'+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,`
|
|
`),Vn=Vn.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
|
|
`)}catch(tr){}var dn=Q(Vn),_n=C();if(Vn.match(/\[TOC\]/)&&(dn=dn.replace("<p>[TOC]</p>",D()),S()),dn=dn.replace(/(__special_katext_id_\d+__)/g,function(tr,Ln){var $n=_n[Ln],Er=$n.type,Sr=$n.expression;return Object(se.renderToString)(mn(Sr)||"",{displayMode:Er==="block",throwOnError:!1,output:"html"})}),dn=dn.replace(/▁/g,"\u2581\u2581\u2581"),y(),ve){var cn=document.createElement("div");return cn.innerHTML=dn,cn.innerText}return setTimeout(function(){return _r()},500),dn},[Vn]),er=Object(k.useRef)();v.WebkitLineClamp=Ve,Ve&&(kt=Object(I.a)(Object(I.a)({},kt),v));function lr(pn){var Nt=pn.target;if(Nt.tagName.toUpperCase()==="IMG"){if(Tt){var Rn=Nt.getAttribute("src");fn(Rn),Kn("image")}}else if(Nt.tagName.toUpperCase()==="A"){var dn=Nt.getAttribute("href");if(dn.indexOf("office")>-1)pn.preventDefault(),fn(dn),Kn("office");else if(dn.indexOf("application/pdf")>-1)pn.preventDefault(),fn(dn),Kn("pdf");else if(dn.indexOf("type=text")>-1)pn.preventDefault(),fn(dn),Kn("html");else if(dn.startsWith("#")){pn.preventDefault();var _n=document.getElementById(dn.replace("#",""));_n&&_n.scrollIntoView(!0)}}}var _r=function(){var Nt,Rn=(Nt=er.current)===null||Nt===void 0?void 0:Nt.querySelectorAll("video");Rn==null||Rn.forEach(function(dn){if(dn.oncontextmenu=function(){return!1},dn.src.indexOf(".m3u8")>-1&&!dn.canPlayType("application/vnd.apple.mpegurl")){if($.a.isSupported()){var _n=new $.a;_n.loadSource(dn.src),_n.attachMedia(dn)}}})};Object(k.useEffect)(function(){if(er.current&&fr&&(fr.match(jt)&&window.PR.prettyPrint()),er.current)return er.current.addEventListener("click",lr),function(){er.current.removeEventListener("click",lr),y(),S()}},[fr,er.current,lr]);var br=function(Nt){if(!J)return;Nt.target.nodeName==="IMG"?(vn.current.style.display="flex",vn.current.style.width=Nt.target.clientWidth+"px",vn.current.style.height=Nt.target.clientHeight+"px",vn.current.style.top=Nt.target.offsetTop+"px",vn.current.style.left=Nt.target.offsetLeft+"px",hn.current.src=Nt.target.getAttribute("src")):vn.current.style.display="none"};return m.a.createElement("div",{style:{position:"relative"}},m.a.createElement("div",{ref:er,style:Object(I.a)({},kt),className:"".concat(G||""," markdown-body ").concat(Ht.a.mdBody),onMouseOver:br,dangerouslySetInnerHTML:{__html:fr}}),m.a.createElement("div",{ref:vn,className:Ht.a.button},m.a.createElement(z.a,null,m.a.createElement(K.a,{onClick:function(){return Ar()}},"\u88C1\u526A"),m.a.createElement(K.a,{onClick:function(){return Dn()}},"\u7F16\u8F91"))),m.a.createElement("img",{ref:hn,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),m.a.createElement(he.a,{close:!0,data:Cn,hasMask:Je,type:Cn!=null&&Cn.length?Yn:"",style:Object(I.a)({},An),onClose:function(){return fn("")}}))}},"9VGf":function(Ke,we,U){"use strict";U.d(we,"a",function(){return L});var q=U("q1tI"),z=U.n(q);function L(K,I){var w=Object(q.useRef)();Object(q.useEffect)(function(){w.current=K}),Object(q.useEffect)(function(){function B(){w.current()}if(I!==null){var N=setInterval(B,I);return function(){return clearInterval(N)}}},[I])}},AMnG:function(Ke,we,U){"use strict";var q=U("miYZ"),z=U("tsqr"),L=U("tJVT"),K=U("q1tI"),I=U.n(K),w=U("nWbc"),B=U.n(w),N=U("Ot1p");we.a=function(A){var k=A.id,m=A.activeDiscussIndex,O=A.onReplyDiscuss,R=Object(K.useState)(""),_=Object(L.a)(R,2),E=_[0],g=_[1];function u(i){g(i)}function a(){if(!E){z.b.info("\u56DE\u590D\u5185\u5BB9\u4E0D\u80FD\u4E3A\u7A7A!");return}O(k,E),g("")}return I.a.createElement("div",{key:k,className:"discuss-item-editor",style:{display:m===k?"block":"none",width:"100%"}},I.a.createElement(N.a,{miniToolbar:!0,startInit:m===k,defaultValue:E,id:k,noStorage:!0,watch:!1,height:155,placeholder:"\u6211\u8981\u56DE\u590D",showResizeBar:!0,onChange:u}),I.a.createElement("a",{onClick:a,className:"btn-send"},"\u53D1\u9001"))}},BU3w:function(Ke,we,U){"use strict";U.d(we,"a",function(){return w});var q=U("MNnm"),z="rc-util-key";function L(B){if(B.attachTo)return B.attachTo;var N=document.querySelector("head");return N||document.body}function K(B){var N,A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(q.a)())return null;var k=document.createElement("style");if((N=A.csp)===null||N===void 0?void 0:N.nonce){var m;k.nonce=(m=A.csp)===null||m===void 0?void 0:m.nonce}k.innerHTML=B;var O=L(A),R=O.firstChild;return A.prepend&&O.prepend?O.prepend(k):A.prepend&&R?O.insertBefore(k,R):O.appendChild(k),k}var I=new Map;function w(B,N){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},k=L(A);if(!I.has(k)){var m=K("",A),O=m.parentNode;I.set(k,O),O.removeChild(m)}var R=Array.from(I.get(k).children).find(function(a){return a.tagName==="STYLE"&&a[z]===N});if(R){var _,E;if(((_=A.csp)===null||_===void 0?void 0:_.nonce)&&R.nonce!==((E=A.csp)===null||E===void 0?void 0:E.nonce)){var g;R.nonce=(g=A.csp)===null||g===void 0?void 0:g.nonce}return R.innerHTML!==B&&(R.innerHTML=B),R}var u=K(B,A);return u[z]=N,u}},Bd2K:function(Ke,we,U){(function(q){q(U("VrN/"),U("osHv"))})(function(q){q.defineOption("autoCloseTags",!1,function(A,k,m){if(m!=q.Init&&m&&A.removeKeyMap("autoCloseTags"),!k)return;var O={name:"autoCloseTags"};(typeof k!="object"||k.whenClosing!==!1)&&(O["'/'"]=function(R){return w(R)}),(typeof k!="object"||k.whenOpening!==!1)&&(O["'>'"]=function(R){return K(R)}),A.addKeyMap(O)});var z=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],L=["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 K(A){if(A.getOption("disableInput"))return q.Pass;for(var k=A.listSelections(),m=[],O=A.getOption("autoCloseTags"),R=0;R<k.length;R++){if(!k[R].empty())return q.Pass;var _=k[R].head,E=A.getTokenAt(_),g=q.innerMode(A.getMode(),E.state),u=g.state,a=g.mode.xmlCurrentTag&&g.mode.xmlCurrentTag(u),i=a&&a.name;if(!i)return q.Pass;var c=g.mode.configuration=="html",S=typeof O=="object"&&O.dontCloseTags||c&&z,v=typeof O=="object"&&O.indentTags||c&&L;E.end>_.ch&&(i=i.slice(0,i.length-E.end+_.ch));var p=i.toLowerCase();if(!i||E.type=="string"&&(E.end!=_.ch||!/[\"\']/.test(E.string.charAt(E.string.length-1))||E.string.length==1)||E.type=="tag"&&a.close||E.string.indexOf("/")==_.ch-E.start-1||S&&B(S,p)>-1||N(A,g.mode.xmlCurrentContext&&g.mode.xmlCurrentContext(u)||[],i,_,!0))return q.Pass;var D=typeof O=="object"&&O.emptyTags;if(D&&B(D,i)>-1){m[R]={text:"/>",newPos:q.Pos(_.line,_.ch+2)};continue}var b=v&&B(v,p)>-1;m[R]={indent:b,text:">"+(b?`
|
|
|
|
`:"")+"</"+i+">",newPos:b?q.Pos(_.line+1,0):q.Pos(_.line,_.ch+1)}}for(var h=typeof O=="object"&&O.dontIndentOnAutoClose,R=k.length-1;R>=0;R--){var d=m[R];A.replaceRange(d.text,k[R].head,k[R].anchor,"+insert");var o=A.listSelections().slice(0);o[R]={head:d.newPos,anchor:d.newPos},A.setSelections(o),!h&&d.indent&&(A.indentLine(d.newPos.line,null,!0),A.indentLine(d.newPos.line+1,null,!0))}}function I(A,k){for(var m=A.listSelections(),O=[],R=k?"/":"</",_=A.getOption("autoCloseTags"),E=typeof _=="object"&&_.dontIndentOnSlash,g=0;g<m.length;g++){if(!m[g].empty())return q.Pass;var u=m[g].head,a=A.getTokenAt(u),i=q.innerMode(A.getMode(),a.state),c=i.state;if(k&&(a.type=="string"||a.string.charAt(0)!="<"||a.start!=u.ch-1))return q.Pass;var S,v=i.mode.name!="xml"&&A.getMode().name=="htmlmixed";if(v&&i.mode.name=="javascript")S=R+"script";else if(v&&i.mode.name=="css")S=R+"style";else{var p=i.mode.xmlCurrentContext&&i.mode.xmlCurrentContext(c);if(!p||p.length&&N(A,p,p[p.length-1],u))return q.Pass;S=R+p[p.length-1]}A.getLine(u.line).charAt(a.end)!=">"&&(S+=">"),O[g]=S}if(A.replaceSelections(O),m=A.listSelections(),!E)for(var g=0;g<m.length;g++)(g==m.length-1||m[g].head.line<m[g+1].head.line)&&A.indentLine(m[g].head.line)}function w(A){return A.getOption("disableInput")?q.Pass:I(A,!0)}q.commands.closeTag=function(A){return I(A)};function B(A,k){if(A.indexOf)return A.indexOf(k);for(var m=0,O=A.length;m<O;++m)if(A[m]==k)return m;return-1}function N(A,k,m,O,R){if(!q.scanForClosingTag)return!1;var _=Math.min(A.lastLine()+1,O.line+500),E=q.scanForClosingTag(A,O,null,_);if(!E||E.tag!=m)return!1;for(var g=R?1:0,u=k.length-1;u>=0&&k[u]==m;u--)++g;O=E.to;for(var u=1;u<g;u++){var a=q.scanForClosingTag(A,O,null,_);if(!a||a.tag!=m)return!1;O=a.to}return!0}})},BdwD:function(Ke,we,U){"use strict";var q=U("+L6B"),z=U("2/Rp"),L=U("0Owb"),K=U("k1fw"),I=U("q1tI"),w=U.n(I),B=U("FOrL"),N=U.n(B),A=function(m){var O=m.buttonProps,R=O===void 0?{}:O,_=m.styles,E=_===void 0?{}:_,g=m.customText,u=m.ButtonText,a=m.ButtonClick,i=m.Buttonclass,c=m.ButtonTwo;return w.a.createElement("section",{className:"tc animated fadeIn",style:Object(K.a)(Object(K.a)({},{color:"#999",margin:"200px auto"}),E)},w.a.createElement("img",{src:N.a}),w.a.createElement("p",{className:"mt20 font14"},g||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),u&&w.a.createElement(z.a,Object(L.a)({className:i,onClick:a},R),u),c&&c)};we.a=A},BjJ7:function(Ke,we,U){"use strict";U.d(we,"d",function(){return z}),U.d(we,"c",function(){return L}),U.d(we,"e",function(){return K}),U.d(we,"b",function(){return I}),U.d(we,"a",function(){return B});var q=U("m3rI");function z(N){var A=!0;if(N.length>0){for(var k=0;k<N.length;k++)if(N[k].compile_success==0||!N[k].compile_success){A=!1;break}}else A=!1;return A}function L(N){for(var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",k=[],m=0;m<N.length;m++){var O=N[m],R=A?"".concat(A,"/").concat(O.name):"".concat(O.name);k.push({title:O.name,isLeaf:!(O.type==="tree"),key:R})}return k}function K(N,A,k){for(var m=0;m<N.length;m++){var O=N[m];if(O.key===A){O.children=k;break}O.children&&K(O.children,A,k)}return N}function I(N,A,k){var m;return function(){var O=this,R=arguments,_=function(){m=null,k||N.apply(O,R)},E=k&&!m;clearTimeout(m),m=setTimeout(_,A),E&&N.apply(O,R)}}var w=!0,B=q.a.API_SERVER},"C+DQ":function(Ke,we,U){},CrYA:function(Ke,we,U){var q=U("MFOe"),z=q.Global;Ke.exports={name:"sessionStorage",read:K,write:I,each:w,remove:B,clearAll:N};function L(){return z.sessionStorage}function K(A){return L().getItem(A)}function I(A,k){return L().setItem(A,k)}function w(A){for(var k=L().length-1;k>=0;k--){var m=L().key(k);A(K(m),m)}}function B(A){return L().removeItem(A)}function N(){return L().clear()}},DlQD:function(Ke,we,U){(function(q,z){Ke.exports=z()})(this,function(){"use strict";function q(ge,de){for(var ce=0;ce<de.length;ce++){var te=de[ce];te.enumerable=te.enumerable||!1,te.configurable=!0,"value"in te&&(te.writable=!0),Object.defineProperty(ge,te.key,te)}}function z(ge,de,ce){return de&&q(ge.prototype,de),ce&&q(ge,ce),ge}function L(ge,de){if(!ge)return;if(typeof ge=="string")return K(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 K(ge,de)}function K(ge,de){(de==null||de>ge.length)&&(de=ge.length);for(var ce=0,te=new Array(de);ce<de;ce++)te[ce]=ge[ce];return te}function I(ge,de){var ce;if(typeof Symbol=="undefined"||ge[Symbol.iterator]==null){if(Array.isArray(ge)||(ce=L(ge))||de&&ge&&typeof ge.length=="number"){ce&&(ge=ce);var te=0;return function(){return te>=ge.length?{done:!0}:{done:!1,value:ge[te++]}}}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 w(ge,de){return de={exports:{}},ge(de,de.exports),de.exports}var B=w(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(te){ge.exports.defaults=te}ge.exports={defaults:de(),getDefaults:de,changeDefaults:ce}}),N=B.defaults,A=B.getDefaults,k=B.changeDefaults,m=/[&<>"']/,O=/[&<>"']/g,R=/[<>"']|&(?!#?\w+;)/,_=/[<>"']|&(?!#?\w+;)/g,E={"&":"&","<":"<",">":">",'"':""","'":"'"},g=function(de){return E[de]};function u(ge,de){if(de){if(m.test(ge))return ge.replace(O,g)}else if(R.test(ge))return ge.replace(_,g);return ge}var a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function i(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 S(ge,de){ge=ge.source||ge,de=de||"";var ce={replace:function(ie,ae){return ae=ae.source||ae,ae=ae.replace(c,"$1"),ge=ge.replace(ie,ae),ce},getRegex:function(){return new RegExp(ge,de)}};return ce}var v=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function D(ge,de,ce){if(ge){var te;try{te=decodeURIComponent(i(ce)).replace(v,"").toLowerCase()}catch(ie){return null}if(te.indexOf("javascript:")===0||te.indexOf("vbscript:")===0||te.indexOf("data:")===0)return null}de&&!p.test(ce)&&(ce=s(de,ce));try{ce=encodeURI(ce).replace(/%25/g,"%")}catch(ie){return null}return ce}var b={},h=/^[^:]+:\/*[^/]*$/,d=/^([^:]+:)[\s\S]*$/,o=/^([^:]+:\/*[^/]*)[\s\S]*$/;function s(ge,de){b[" "+ge]||(h.test(ge)?b[" "+ge]=ge+"/":b[" "+ge]=P(ge,"/",!0)),ge=b[" "+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 C={exec:function(){}};function y(ge){for(var de=1,ce,te;de<arguments.length;de++){ce=arguments[de];for(te in ce)Object.prototype.hasOwnProperty.call(ce,te)&&(ge[te]=ce[te])}return ge}function x(ge,de){var ce=ge.replace(/\|/g,function(ae,le,Te){for(var be=!1,ze=le;--ze>=0&&Te[ze]==="\\";)be=!be;return be?"|":" |"}),te=ce.split(/ \|/),ie=0;if(te.length>de)te.splice(de);else for(;te.length<de;)te.push("");for(;ie<te.length;ie++)te[ie]=te[ie].trim().replace(/\\\|/g,"|");return te}function P(ge,de,ce){var te=ge.length;if(te===0)return"";for(var ie=0;ie<te;){var ae=ge.charAt(te-ie-1);if(ae===de&&!ce)ie++;else if(ae!==de&&ce)ie++;else break}return ge.substr(0,te-ie)}function j(ge,de){if(ge.indexOf(de[1])===-1)return-1;for(var ce=ge.length,te=0,ie=0;ie<ce;ie++)if(ge[ie]==="\\")ie++;else if(ge[ie]===de[0])te++;else if(ge[ie]===de[1]&&(te--,te<0))return ie;return-1}function Y(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:u,unescape:i,edit:S,cleanUrl:D,resolveUrl:s,noopTest:C,merge:y,splitCells:x,rtrim:P,findClosingBracket:j,checkSanitizeDeprecation:Y},X=B.defaults,F=Q.rtrim,$=Q.splitCells,re=Q.escape,se=Q.findClosingBracket;function he(ge,de,ce){var te=de.href,ie=de.title?re(de.title):null,ae=ge[1].replace(/\\([\[\]])/g,"$1");return ge[0].charAt(0)!=="!"?{type:"link",raw:ce,href:te,title:ie,text:ae}:{type:"image",raw:ce,href:te,title:ie,text:re(ae)}}function _e(ge,de){var ce=ge.match(/^(\s+)(?:```)/);if(ce===null)return de;var te=ce[1];return de.split(`
|
|
`).map(function(ie){var ae=ie.match(/^\s+/);if(ae===null)return ie;var le=ae[0];return le.length>=te.length?ie.slice(te.length):ie}).join(`
|
|
`)}var xe=function(){function ge(ce){this.options=ce||X}var de=ge.prototype;return de.space=function(te){var ie=this.rules.block.newline.exec(te);if(ie)return ie[0].length>1?{type:"space",raw:ie[0]}:{raw:`
|
|
`}},de.code=function(te,ie){var ae=this.rules.block.code.exec(te);if(ae){var le=ie[ie.length-1];if(le&&le.type==="paragraph")return{raw:ae[0],text:ae[0].trimRight()};var Te=ae[0].replace(/^ {4}/gm,"");return{type:"code",raw:ae[0],codeBlockStyle:"indented",text:this.options.pedantic?Te:F(Te,`
|
|
`)}}},de.fences=function(te){var ie=this.rules.block.fences.exec(te);if(ie){var ae=ie[0],le=_e(ae,ie[3]||"");return{type:"code",raw:ae,lang:ie[2]?ie[2].trim():ie[2],text:le}}},de.heading=function(te){var ie=this.rules.block.heading.exec(te);if(ie)return{type:"heading",raw:ie[0],depth:ie[1].length,text:ie[2]}},de.nptable=function(te){var ie=this.rules.block.nptable.exec(te);if(ie){var ae={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(ae.header.length===ae.align.length){var le=ae.align.length,Te;for(Te=0;Te<le;Te++)/^ *-+: *$/.test(ae.align[Te])?ae.align[Te]="right":/^ *:-+: *$/.test(ae.align[Te])?ae.align[Te]="center":/^ *:-+ *$/.test(ae.align[Te])?ae.align[Te]="left":ae.align[Te]=null;for(le=ae.cells.length,Te=0;Te<le;Te++)ae.cells[Te]=$(ae.cells[Te],ae.header.length);return ae}}},de.hr=function(te){var ie=this.rules.block.hr.exec(te);if(ie)return{type:"hr",raw:ie[0]}},de.blockquote=function(te){var ie=this.rules.block.blockquote.exec(te);if(ie){var ae=ie[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ie[0],text:ae}}},de.list=function(te){var ie=this.rules.block.list.exec(te);if(ie){for(var ae=ie[0],le=ie[2],Te=le.length>1,be=le[le.length-1]===")",ze={type:"list",raw:ae,ordered:Te,start:Te?+le.slice(0,-1):"",loose:!1,items:[]},dt=ie[0].match(this.rules.block.item),yt=!1,ct,st,Be,Fe,Pe,oe,fe,We=dt.length,Ie=0;Ie<We;Ie++)ct=dt[Ie],ae=ct,st=ct.length,ct=ct.replace(/^ *([*+-]|\d+[.)]) */,""),~ct.indexOf(`
|
|
`)&&(st-=ct.length,ct=this.options.pedantic?ct.replace(/^ {1,4}/gm,""):ct.replace(new RegExp("^ {1,"+st+"}","gm"),"")),Ie!==We-1&&(Be=this.rules.block.bullet.exec(dt[Ie+1])[0],(Te?Be.length===1||!be&&Be[Be.length-1]===")":Be.length>1||this.options.smartLists&&Be!==le)&&(Fe=dt.slice(Ie+1).join(`
|
|
`),ze.raw=ze.raw.substring(0,ze.raw.length-Fe.length),Ie=We-1)),Pe=yt||/\n\n(?!\s*$)/.test(ct),Ie!==We-1&&(yt=ct.charAt(ct.length-1)===`
|
|
`,Pe||(Pe=yt)),Pe&&(ze.loose=!0),oe=/^\[[ xX]\] /.test(ct),fe=void 0,oe&&(fe=ct[1]!==" ",ct=ct.replace(/^\[[ xX]\] +/,"")),ze.items.push({type:"list_item",raw:ae,task:oe,checked:fe,loose:Pe,text:ct});return ze}},de.html=function(te){var ie=this.rules.block.html.exec(te);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(te){var ie=this.rules.block.def.exec(te);if(ie){ie[3]&&(ie[3]=ie[3].substring(1,ie[3].length-1));var ae=ie[1].toLowerCase().replace(/\s+/g," ");return{tag:ae,raw:ie[0],href:ie[2],title:ie[3]}}},de.table=function(te){var ie=this.rules.block.table.exec(te);if(ie){var ae={type:"table",header:$(ie[1].replace(/^ *| *\| *$/g,"")),align:ie[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ie[3]?ie[3].replace(/\n$/,"").split(`
|
|
`):[]};if(ae.header.length===ae.align.length){ae.raw=ie[0];var le=ae.align.length,Te;for(Te=0;Te<le;Te++)/^ *-+: *$/.test(ae.align[Te])?ae.align[Te]="right":/^ *:-+: *$/.test(ae.align[Te])?ae.align[Te]="center":/^ *:-+ *$/.test(ae.align[Te])?ae.align[Te]="left":ae.align[Te]=null;for(le=ae.cells.length,Te=0;Te<le;Te++)ae.cells[Te]=$(ae.cells[Te].replace(/^ *\| *| *\| *$/g,""),ae.header.length);return ae}}},de.lheading=function(te){var ie=this.rules.block.lheading.exec(te);if(ie)return{type:"heading",raw:ie[0],depth:ie[2].charAt(0)==="="?1:2,text:ie[1]}},de.paragraph=function(te){var ie=this.rules.block.paragraph.exec(te);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(te,ie){var ae=this.rules.block.text.exec(te);if(ae){var le=ie[ie.length-1];return le&&le.type==="text"?{raw:ae[0],text:ae[0]}:{type:"text",raw:ae[0],text:ae[0]}}},de.escape=function(te){var ie=this.rules.inline.escape.exec(te);if(ie)return{type:"escape",raw:ie[0],text:re(ie[1])}},de.tag=function(te,ie,ae){var le=this.rules.inline.tag.exec(te);if(le)return!ie&&/^<a /i.test(le[0])?ie=!0:ie&&/^<\/a>/i.test(le[0])&&(ie=!1),!ae&&/^<(pre|code|kbd|script)(\s|>)/i.test(le[0])?ae=!0:ae&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(le[0])&&(ae=!1),{type:this.options.sanitize?"text":"html",raw:le[0],inLink:ie,inRawBlock:ae,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(le[0]):re(le[0]):le[0]}},de.link=function(te){var ie=this.rules.inline.link.exec(te);if(ie){var ae=se(ie[2],"()");if(ae>-1){var le=ie[0].indexOf("!")===0?5:4,Te=le+ie[1].length+ae;ie[2]=ie[2].substring(0,ae),ie[0]=ie[0].substring(0,Te).trim(),ie[3]=""}var be=ie[2],ze="";if(this.options.pedantic){var dt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(be);dt?(be=dt[1],ze=dt[3]):ze=""}else ze=ie[3]?ie[3].slice(1,-1):"";be=be.trim().replace(/^<([\s\S]*)>$/,"$1");var yt=he(ie,{href:be&&be.replace(this.rules.inline._escapes,"$1"),title:ze&&ze.replace(this.rules.inline._escapes,"$1")},ie[0]);return yt}},de.reflink=function(te,ie){var ae;if((ae=this.rules.inline.reflink.exec(te))||(ae=this.rules.inline.nolink.exec(te))){var le=(ae[2]||ae[1]).replace(/\s+/g," ");if(le=ie[le.toLowerCase()],!le||!le.href){var Te=ae[0].charAt(0);return{type:"text",raw:Te,text:Te}}var be=he(ae,le,ae[0]);return be}},de.strong=function(te,ie,ae){ae===void 0&&(ae="");var le=this.rules.inline.strong.start.exec(te);if(le&&(!le[1]||le[1]&&(ae===""||this.rules.inline.punctuation.exec(ae)))){ie=ie.slice(-1*te.length);var Te=le[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Te.lastIndex=0;for(var be;(le=Te.exec(ie))!=null;)if(be=this.rules.inline.strong.middle.exec(ie.slice(0,le.index+3)),be)return{type:"strong",raw:te.slice(0,be[0].length),text:te.slice(2,be[0].length-2)}}},de.em=function(te,ie,ae){ae===void 0&&(ae="");var le=this.rules.inline.em.start.exec(te);if(le&&(!le[1]||le[1]&&(ae===""||this.rules.inline.punctuation.exec(ae)))){ie=ie.slice(-1*te.length);var Te=le[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Te.lastIndex=0;for(var be;(le=Te.exec(ie))!=null;)if(be=this.rules.inline.em.middle.exec(ie.slice(0,le.index+2)),be)return{type:"em",raw:te.slice(0,be[0].length),text:te.slice(1,be[0].length-1)}}},de.codespan=function(te){var ie=this.rules.inline.code.exec(te);if(ie){var ae=ie[2].replace(/\n/g," "),le=/[^ ]/.test(ae),Te=ae.startsWith(" ")&&ae.endsWith(" ");return le&&Te&&(ae=ae.substring(1,ae.length-1)),ae=re(ae,!0),{type:"codespan",raw:ie[0],text:ae}}},de.br=function(te){var ie=this.rules.inline.br.exec(te);if(ie)return{type:"br",raw:ie[0]}},de.del=function(te){var ie=this.rules.inline.del.exec(te);if(ie)return{type:"del",raw:ie[0],text:ie[1]}},de.autolink=function(te,ie){var ae=this.rules.inline.autolink.exec(te);if(ae){var le,Te;return ae[2]==="@"?(le=re(this.options.mangle?ie(ae[1]):ae[1]),Te="mailto:"+le):(le=re(ae[1]),Te=le),{type:"link",raw:ae[0],text:le,href:Te,tokens:[{type:"text",raw:le,text:le}]}}},de.url=function(te,ie){var ae;if(ae=this.rules.inline.url.exec(te)){var le,Te;if(ae[2]==="@")le=re(this.options.mangle?ie(ae[0]):ae[0]),Te="mailto:"+le;else{var be;do be=ae[0],ae[0]=this.rules.inline._backpedal.exec(ae[0])[0];while(be!==ae[0]);le=re(ae[0]),ae[1]==="www."?Te="http://"+le:Te=le}return{type:"link",raw:ae[0],text:le,href:Te,tokens:[{type:"text",raw:le,text:le}]}}},de.inlineText=function(te,ie,ae){var le=this.rules.inline.text.exec(te);if(le){var Te;return ie?Te=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(le[0]):re(le[0]):le[0]:Te=re(this.options.smartypants?ae(le[0]):le[0]),{type:"text",raw:le[0],text:Te}}},ge}(),Ce=Q.noopTest,Oe=Q.edit,De=Q.merge,pe={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:Ce,table:Ce,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};pe._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,pe._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,pe.def=Oe(pe.def).replace("label",pe._label).replace("title",pe._title).getRegex(),pe.bullet=/(?:[*+-]|\d{1,9}[.)])/,pe.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,pe.item=Oe(pe.item,"gm").replace(/bull/g,pe.bullet).getRegex(),pe.list=Oe(pe.list).replace(/bull/g,pe.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+pe.def.source+")").getRegex(),pe._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",pe._comment=/<!--(?!-?>)[\s\S]*?-->/,pe.html=Oe(pe.html,"i").replace("comment",pe._comment).replace("tag",pe._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),pe.paragraph=Oe(pe._paragraph).replace("hr",pe.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",pe._tag).getRegex(),pe.blockquote=Oe(pe.blockquote).replace("paragraph",pe.paragraph).getRegex(),pe.normal=De({},pe),pe.gfm=De({},pe.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*|$)"}),pe.gfm.nptable=Oe(pe.gfm.nptable).replace("hr",pe.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",pe._tag).getRegex(),pe.gfm.table=Oe(pe.gfm.table).replace("hr",pe.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",pe._tag).getRegex(),pe.pedantic=De({},pe.normal,{html:Oe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",pe._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:Ce,paragraph:Oe(pe.normal._paragraph).replace("hr",pe.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",pe.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ue={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Ce,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:Ce,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};ue._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",ue.punctuation=Oe(ue.punctuation).replace(/punctuation/g,ue._punctuation).getRegex(),ue._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",ue._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",ue.em.start=Oe(ue.em.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.middle=Oe(ue.em.middle).replace(/punctuation/g,ue._punctuation).replace(/overlapSkip/g,ue._overlapSkip).getRegex(),ue.em.endAst=Oe(ue.em.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.endUnd=Oe(ue.em.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.start=Oe(ue.strong.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.middle=Oe(ue.strong.middle).replace(/punctuation/g,ue._punctuation).replace(/blockSkip/g,ue._blockSkip).getRegex(),ue.strong.endAst=Oe(ue.strong.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.endUnd=Oe(ue.strong.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.blockSkip=Oe(ue._blockSkip,"g").getRegex(),ue.overlapSkip=Oe(ue._overlapSkip,"g").getRegex(),ue._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,ue._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,ue._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])?)+(?![-_])/,ue.autolink=Oe(ue.autolink).replace("scheme",ue._scheme).replace("email",ue._email).getRegex(),ue._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,ue.tag=Oe(ue.tag).replace("comment",pe._comment).replace("attribute",ue._attribute).getRegex(),ue._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ue._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,ue._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,ue.link=Oe(ue.link).replace("label",ue._label).replace("href",ue._href).replace("title",ue._title).getRegex(),ue.reflink=Oe(ue.reflink).replace("label",ue._label).getRegex(),ue.reflinkSearch=Oe(ue.reflinkSearch,"g").replace("reflink",ue.reflink).replace("nolink",ue.nolink).getRegex(),ue.normal=De({},ue),ue.pedantic=De({},ue.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",ue._label).getRegex(),reflink:Oe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ue._label).getRegex()}),ue.gfm=De({},ue.normal,{escape:Oe(ue.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),ue.gfm.url=Oe(ue.gfm.url,"i").replace("email",ue.gfm._extended_email).getRegex(),ue.breaks=De({},ue.gfm,{br:Oe(ue.br).replace("{2,}","*").getRegex(),text:Oe(ue.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Me={block:pe,inline:ue},at=B.defaults,lt=Me.block,et=Me.inline;function Qe(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 je(ge){var de="",ce,te,ie=ge.length;for(ce=0;ce<ie;ce++)te=ge.charCodeAt(ce),Math.random()>.5&&(te="x"+te.toString(16)),de+="&#"+te+";";return de}var Ye=function(){function ge(ce){this.tokens=[],this.tokens.links=Object.create(null),this.options=ce||at,this.options.tokenizer=this.options.tokenizer||new xe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var te={block:lt.normal,inline:et.normal};this.options.pedantic?(te.block=lt.pedantic,te.inline=et.pedantic):this.options.gfm&&(te.block=lt.gfm,this.options.breaks?te.inline=et.breaks:te.inline=et.gfm),this.tokenizer.rules=te}ge.lex=function(te,ie){var ae=new ge(ie);return ae.lex(te)};var de=ge.prototype;return de.lex=function(te){return te=te.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(te,this.tokens,!0),this.inline(this.tokens),this.tokens},de.blockTokens=function(te,ie,ae){ie===void 0&&(ie=[]),ae===void 0&&(ae=!0),te=te.replace(/^ +$/gm,"");for(var le,Te,be,ze;te;){if(le=this.tokenizer.space(te)){te=te.substring(le.raw.length),le.type&&ie.push(le);continue}if(le=this.tokenizer.code(te,ie)){te=te.substring(le.raw.length),le.type?ie.push(le):(ze=ie[ie.length-1],ze.raw+=`
|
|
`+le.raw,ze.text+=`
|
|
`+le.text);continue}if(le=this.tokenizer.fences(te)){te=te.substring(le.raw.length),ie.push(le);continue}if(le=this.tokenizer.heading(te)){te=te.substring(le.raw.length),ie.push(le);continue}if(le=this.tokenizer.nptable(te)){te=te.substring(le.raw.length),ie.push(le);continue}if(le=this.tokenizer.hr(te)){te=te.substring(le.raw.length),ie.push(le);continue}if(le=this.tokenizer.blockquote(te)){te=te.substring(le.raw.length),le.tokens=this.blockTokens(le.text,[],ae),ie.push(le);continue}if(le=this.tokenizer.list(te)){for(te=te.substring(le.raw.length),be=le.items.length,Te=0;Te<be;Te++)le.items[Te].tokens=this.blockTokens(le.items[Te].text,[],!1);ie.push(le);continue}if(le=this.tokenizer.html(te)){te=te.substring(le.raw.length),ie.push(le);continue}if(ae&&(le=this.tokenizer.def(te))){te=te.substring(le.raw.length),this.tokens.links[le.tag]||(this.tokens.links[le.tag]={href:le.href,title:le.title});continue}if(le=this.tokenizer.table(te)){te=te.substring(le.raw.length),ie.push(le);continue}if(le=this.tokenizer.lheading(te)){te=te.substring(le.raw.length),ie.push(le);continue}if(ae&&(le=this.tokenizer.paragraph(te))){te=te.substring(le.raw.length),ie.push(le);continue}if(le=this.tokenizer.text(te,ie)){te=te.substring(le.raw.length),le.type?ie.push(le):(ze=ie[ie.length-1],ze.raw+=`
|
|
`+le.raw,ze.text+=`
|
|
`+le.text);continue}if(te){var dt="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(dt);break}else throw new Error(dt)}}return ie},de.inline=function(te){var ie,ae,le,Te,be,ze,dt=te.length;for(ie=0;ie<dt;ie++){ze=te[ie];switch(ze.type){case"paragraph":case"text":case"heading":{ze.tokens=[],this.inlineTokens(ze.text,ze.tokens);break}case"table":{for(ze.tokens={header:[],cells:[]},Te=ze.header.length,ae=0;ae<Te;ae++)ze.tokens.header[ae]=[],this.inlineTokens(ze.header[ae],ze.tokens.header[ae]);for(Te=ze.cells.length,ae=0;ae<Te;ae++)for(be=ze.cells[ae],ze.tokens.cells[ae]=[],le=0;le<be.length;le++)ze.tokens.cells[ae][le]=[],this.inlineTokens(be[le],ze.tokens.cells[ae][le]);break}case"blockquote":{this.inline(ze.tokens);break}case"list":{for(Te=ze.items.length,ae=0;ae<Te;ae++)this.inline(ze.items[ae].tokens);break}}}return te},de.inlineTokens=function(te,ie,ae,le,Te){ie===void 0&&(ie=[]),ae===void 0&&(ae=!1),le===void 0&&(le=!1),Te===void 0&&(Te="");var be,ze=te,dt;if(this.tokens.links){var yt=Object.keys(this.tokens.links);if(yt.length>0)for(;(dt=this.tokenizer.rules.inline.reflinkSearch.exec(ze))!=null;)yt.includes(dt[0].slice(dt[0].lastIndexOf("[")+1,-1))&&(ze=ze.slice(0,dt.index)+"["+"a".repeat(dt[0].length-2)+"]"+ze.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(dt=this.tokenizer.rules.inline.blockSkip.exec(ze))!=null;)ze=ze.slice(0,dt.index)+"["+"a".repeat(dt[0].length-2)+"]"+ze.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;te;){if(be=this.tokenizer.escape(te)){te=te.substring(be.raw.length),ie.push(be);continue}if(be=this.tokenizer.tag(te,ae,le)){te=te.substring(be.raw.length),ae=be.inLink,le=be.inRawBlock,ie.push(be);continue}if(be=this.tokenizer.link(te)){te=te.substring(be.raw.length),be.type==="link"&&(be.tokens=this.inlineTokens(be.text,[],!0,le)),ie.push(be);continue}if(be=this.tokenizer.reflink(te,this.tokens.links)){te=te.substring(be.raw.length),be.type==="link"&&(be.tokens=this.inlineTokens(be.text,[],!0,le)),ie.push(be);continue}if(be=this.tokenizer.strong(te,ze,Te)){te=te.substring(be.raw.length),be.tokens=this.inlineTokens(be.text,[],ae,le),ie.push(be);continue}if(be=this.tokenizer.em(te,ze,Te)){te=te.substring(be.raw.length),be.tokens=this.inlineTokens(be.text,[],ae,le),ie.push(be);continue}if(be=this.tokenizer.codespan(te)){te=te.substring(be.raw.length),ie.push(be);continue}if(be=this.tokenizer.br(te)){te=te.substring(be.raw.length),ie.push(be);continue}if(be=this.tokenizer.del(te)){te=te.substring(be.raw.length),be.tokens=this.inlineTokens(be.text,[],ae,le),ie.push(be);continue}if(be=this.tokenizer.autolink(te,je)){te=te.substring(be.raw.length),ie.push(be);continue}if(!ae&&(be=this.tokenizer.url(te,je))){te=te.substring(be.raw.length),ie.push(be);continue}if(be=this.tokenizer.inlineText(te,le,Qe)){te=te.substring(be.raw.length),Te=be.raw.slice(-1),ie.push(be);continue}if(te){var ct="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(ct);break}else throw new Error(ct)}}return ie},z(ge,null,[{key:"rules",get:function(){return{block:lt,inline:et}}}]),ge}(),rt=B.defaults,mt=Q.cleanUrl,ot=Q.escape,qe=function(){function ge(ce){this.options=ce||rt}var de=ge.prototype;return de.code=function(te,ie,ae){var le=(ie||"").match(/\S*/)[0];if(this.options.highlight){var Te=this.options.highlight(te,le);Te!=null&&Te!==te&&(ae=!0,te=Te)}return le?'<pre><code class="'+this.options.langPrefix+ot(le,!0)+'">'+(ae?te:ot(te,!0))+`</code></pre>
|
|
`:"<pre><code>"+(ae?te:ot(te,!0))+`</code></pre>
|
|
`},de.blockquote=function(te){return`<blockquote>
|
|
`+te+`</blockquote>
|
|
`},de.html=function(te){return te},de.heading=function(te,ie,ae,le){return this.options.headerIds?"<h"+ie+' id="'+this.options.headerPrefix+le.slug(ae)+'">'+te+"</h"+ie+`>
|
|
`:"<h"+ie+">"+te+"</h"+ie+`>
|
|
`},de.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},de.list=function(te,ie,ae){var le=ie?"ol":"ul",Te=ie&&ae!==1?' start="'+ae+'"':"";return"<"+le+Te+`>
|
|
`+te+"</"+le+`>
|
|
`},de.listitem=function(te){return"<li>"+te+`</li>
|
|
`},de.checkbox=function(te){return"<input "+(te?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},de.paragraph=function(te){return"<p>"+te+`</p>
|
|
`},de.table=function(te,ie){return ie&&(ie="<tbody>"+ie+"</tbody>"),`<table>
|
|
<thead>
|
|
`+te+`</thead>
|
|
`+ie+`</table>
|
|
`},de.tablerow=function(te){return`<tr>
|
|
`+te+`</tr>
|
|
`},de.tablecell=function(te,ie){var ae=ie.header?"th":"td",le=ie.align?"<"+ae+' align="'+ie.align+'">':"<"+ae+">";return le+te+"</"+ae+`>
|
|
`},de.strong=function(te){return"<strong>"+te+"</strong>"},de.em=function(te){return"<em>"+te+"</em>"},de.codespan=function(te){return"<code>"+te+"</code>"},de.br=function(){return this.options.xhtml?"<br/>":"<br>"},de.del=function(te){return"<del>"+te+"</del>"},de.link=function(te,ie,ae){if(te=mt(this.options.sanitize,this.options.baseUrl,te),te===null)return ae;var le='<a href="'+ot(te)+'"';return ie&&(le+=' title="'+ie+'"'),le+=">"+ae+"</a>",le},de.image=function(te,ie,ae){if(te=mt(this.options.sanitize,this.options.baseUrl,te),te===null)return ae;var le='<img src="'+te+'" alt="'+ae+'"';return ie&&(le+=' title="'+ie+'"'),le+=this.options.xhtml?"/>":">",le},de.text=function(te){return te},ge}(),Xe=function(){function ge(){}var de=ge.prototype;return de.strong=function(te){return te},de.em=function(te){return te},de.codespan=function(te){return te},de.del=function(te){return te},de.html=function(te){return te},de.text=function(te){return te},de.link=function(te,ie,ae){return""+ae},de.image=function(te,ie,ae){return""+ae},de.br=function(){return""},ge}(),Ct=function(){function ge(){this.seen={}}var de=ge.prototype;return de.slug=function(te){var ie=te.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ie)){var ae=ie;do this.seen[ae]++,ie=ae+"-"+this.seen[ae];while(this.seen.hasOwnProperty(ie))}return this.seen[ie]=0,ie},ge}(),xt=B.defaults,bt=Q.unescape,Et=function(){function ge(ce){this.options=ce||xt,this.options.renderer=this.options.renderer||new qe,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Xe,this.slugger=new Ct}ge.parse=function(te,ie){var ae=new ge(ie);return ae.parse(te)};var de=ge.prototype;return de.parse=function(te,ie){ie===void 0&&(ie=!0);var ae="",le,Te,be,ze,dt,yt,ct,st,Be,Fe,Pe,oe,fe,We,Ie,tt,ft,Ae,nt=te.length;for(le=0;le<nt;le++){Fe=te[le];switch(Fe.type){case"space":continue;case"hr":{ae+=this.renderer.hr();continue}case"heading":{ae+=this.renderer.heading(this.parseInline(Fe.tokens),Fe.depth,bt(this.parseInline(Fe.tokens,this.textRenderer)),this.slugger);continue}case"code":{ae+=this.renderer.code(Fe.text,Fe.lang,Fe.escaped);continue}case"table":{for(st="",ct="",ze=Fe.header.length,Te=0;Te<ze;Te++)ct+=this.renderer.tablecell(this.parseInline(Fe.tokens.header[Te]),{header:!0,align:Fe.align[Te]});for(st+=this.renderer.tablerow(ct),Be="",ze=Fe.cells.length,Te=0;Te<ze;Te++){for(yt=Fe.tokens.cells[Te],ct="",dt=yt.length,be=0;be<dt;be++)ct+=this.renderer.tablecell(this.parseInline(yt[be]),{header:!1,align:Fe.align[be]});Be+=this.renderer.tablerow(ct)}ae+=this.renderer.table(st,Be);continue}case"blockquote":{Be=this.parse(Fe.tokens),ae+=this.renderer.blockquote(Be);continue}case"list":{for(Pe=Fe.ordered,oe=Fe.start,fe=Fe.loose,ze=Fe.items.length,Be="",Te=0;Te<ze;Te++)Ie=Fe.items[Te],tt=Ie.checked,ft=Ie.task,We="",Ie.task&&(Ae=this.renderer.checkbox(tt),fe?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}):We+=Ae),We+=this.parse(Ie.tokens,fe),Be+=this.renderer.listitem(We,ft,tt);ae+=this.renderer.list(Be,Pe,oe);continue}case"html":{ae+=this.renderer.html(Fe.text);continue}case"paragraph":{ae+=this.renderer.paragraph(this.parseInline(Fe.tokens));continue}case"text":{for(Be=Fe.tokens?this.parseInline(Fe.tokens):Fe.text;le+1<nt&&te[le+1].type==="text";)Fe=te[++le],Be+=`
|
|
`+(Fe.tokens?this.parseInline(Fe.tokens):Fe.text);ae+=ie?this.renderer.paragraph(Be):Be;continue}default:{var gt='Token with "'+Fe.type+'" type was not found.';if(this.options.silent){console.error(gt);return}else throw new Error(gt)}}}return ae},de.parseInline=function(te,ie){ie=ie||this.renderer;var ae="",le,Te,be=te.length;for(le=0;le<be;le++){Te=te[le];switch(Te.type){case"escape":{ae+=ie.text(Te.text);break}case"html":{ae+=ie.html(Te.text);break}case"link":{ae+=ie.link(Te.href,Te.title,this.parseInline(Te.tokens,ie));break}case"image":{ae+=ie.image(Te.href,Te.title,Te.text);break}case"strong":{ae+=ie.strong(this.parseInline(Te.tokens,ie));break}case"em":{ae+=ie.em(this.parseInline(Te.tokens,ie));break}case"codespan":{ae+=ie.codespan(Te.text);break}case"br":{ae+=ie.br();break}case"del":{ae+=ie.del(this.parseInline(Te.tokens,ie));break}case"text":{ae+=ie.text(Te.text);break}default:{var ze='Token with "'+Te.type+'" type was not found.';if(this.options.silent){console.error(ze);return}else throw new Error(ze)}}}return ae},ge}(),At=Q.merge,St=Q.checkSanitizeDeprecation,Se=Q.escape,Ee=B.getDefaults,He=B.changeDefaults,Ge=B.defaults;function Re(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=At({},Re.defaults,de||{}),St(de),ce){var te=de.highlight,ie;try{ie=Ye.lex(ge,de)}catch(be){return ce(be)}var ae=function(ze){var dt;if(!ze)try{dt=Et.parse(ie,de)}catch(yt){ze=yt}return de.highlight=te,ze?ce(ze):ce(null,dt)};if(!te||te.length<3)return ae();if(delete de.highlight,!ie.length)return ae();var le=0;Re.walkTokens(ie,function(be){be.type==="code"&&(le++,setTimeout(function(){te(be.text,be.lang,function(ze,dt){if(ze)return ae(ze);dt!=null&&dt!==be.text&&(be.text=dt,be.escaped=!0),le--,le===0&&ae()})},0))}),le===0&&ae();return}try{var Te=Ye.lex(ge,de);return de.walkTokens&&Re.walkTokens(Te,de.walkTokens),Et.parse(Te,de)}catch(be){if(be.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,de.silent)return"<p>An error occurred:</p><pre>"+Se(be.message+"",!0)+"</pre>";throw be}}Re.options=Re.setOptions=function(ge){return At(Re.defaults,ge),He(Re.defaults),Re},Re.getDefaults=Ee,Re.defaults=Ge,Re.use=function(ge){var de=At({},ge);if(ge.renderer&&function(){var te=Re.defaults.renderer||new qe,ie=function(Te){var be=te[Te];te[Te]=function(){for(var ze=arguments.length,dt=new Array(ze),yt=0;yt<ze;yt++)dt[yt]=arguments[yt];var ct=ge.renderer[Te].apply(te,dt);return ct===!1&&(ct=be.apply(te,dt)),ct}};for(var ae in ge.renderer)ie(ae);de.renderer=te}(),ge.tokenizer&&function(){var te=Re.defaults.tokenizer||new xe,ie=function(Te){var be=te[Te];te[Te]=function(){for(var ze=arguments.length,dt=new Array(ze),yt=0;yt<ze;yt++)dt[yt]=arguments[yt];var ct=ge.tokenizer[Te].apply(te,dt);return ct===!1&&(ct=be.apply(te,dt)),ct}};for(var ae in ge.tokenizer)ie(ae);de.tokenizer=te}(),ge.walkTokens){var ce=Re.defaults.walkTokens;de.walkTokens=function(te){ge.walkTokens(te),ce&&ce(te)}}Re.setOptions(de)},Re.walkTokens=function(ge,de){for(var ce=I(ge),te;!(te=ce()).done;){var ie=te.value;de(ie);switch(ie.type){case"table":{for(var ae=I(ie.tokens.header),le;!(le=ae()).done;){var Te=le.value;Re.walkTokens(Te,de)}for(var be=I(ie.tokens.cells),ze;!(ze=be()).done;)for(var dt=ze.value,yt=I(dt),ct;!(ct=yt()).done;){var st=ct.value;Re.walkTokens(st,de)}break}case"list":{Re.walkTokens(ie.items,de);break}default:ie.tokens&&Re.walkTokens(ie.tokens,de)}}},Re.Parser=Et,Re.parser=Et.parse,Re.Renderer=qe,Re.TextRenderer=Xe,Re.Lexer=Ye,Re.lexer=Ye.lex,Re.Tokenizer=xe,Re.Slugger=Ct,Re.parse=Re;var Ue=Re;return Ue})},"DlR+":function(Ke,we,U){var q=U("MFOe"),z=q.Global,L=q.trim;Ke.exports={name:"cookieStorage",read:I,write:B,each:w,remove:N,clearAll:A};var K=z.document;function I(m){if(!m||!k(m))return null;var O="(?:^|.*;\\s*)"+escape(m).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(K.cookie.replace(new RegExp(O),"$1"))}function w(m){for(var O=K.cookie.split(/; ?/g),R=O.length-1;R>=0;R--){if(!L(O[R]))continue;var _=O[R].split("="),E=unescape(_[0]),g=unescape(_[1]);m(g,E)}}function B(m,O){if(!m)return;K.cookie=escape(m)+"="+escape(O)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/"}function N(m){if(!m||!k(m))return;K.cookie=escape(m)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/"}function A(){w(function(m,O){N(O)})}function k(m){return new RegExp("(?:^|;\\s*)"+escape(m).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(K.cookie)}},EHPI:function(Ke,we,U){"use strict";var q=U("bbsP"),z=U("/wGt"),L=U("tJVT"),K=U("k1fw"),I=U("q1tI"),w=U.n(I),B=U("ZW9T"),N=U("ZD9Y"),A=U("M8RZ"),k=U("bCnd"),m=U("fcyK"),O=U.n(m),R={theme:Object(k.a)("cmCodeMode","vs-dark"),fontSize:Object(k.a)("cmFontSize",14),showEditorSetting:!1,tabToSpace:Object(k.a)("cmTabToSpace",!0)},_;(function(u){u[u.set_font_size=0]="set_font_size",u[u.set_theme=1]="set_theme",u[u.on_tab_to_space=2]="on_tab_to_space",u[u.set_show_editor_setting=3]="set_show_editor_setting"})(_||(_={}));function E(u,a){switch(a.type){case _.set_show_editor_setting:return Object(K.a)(Object(K.a)({},u),{},{showEditorSetting:a.payload});case _.set_theme:return Object(K.a)(Object(K.a)({},u),{},{theme:a.payload});case _.set_font_size:return Object(K.a)(Object(K.a)({},u),{},{fontSize:a.payload});case _.on_tab_to_space:return Object(K.a)(Object(K.a)({},u),{},{tabToSpace:a.payload});default:throw new Error}}we.a=function(u){var a=u.value,i=u.onChange,c=u.language,S=u.ActionBarRender,v=S===void 0?function(Y){return w.a.createElement(g,{onShowCodeSetting:Y})}:S,p=Object(I.useReducer)(E,R),D=Object(L.a)(p,2),b=D[0],h=D[1],d=b.theme,o=b.fontSize,s=b.showEditorSetting,C=b.tabToSpace,y={onFontSizeChange:function(Q){h({type:_.set_font_size,payload:Q}),Object(k.b)("cmFontSize",Q)},tabToSpace:C,cmFontSize:o,className:"oj",cmCodeMode:d,onTabToSpace:function(Q){h({type:_.on_tab_to_space,payload:Q}),Object(k.b)("cmTabToSpace",Q)},onCodeModeChange:function(Q){h({type:_.set_theme,payload:Q}),Object(k.b)("cmCodeMode",Q)}};function x(){h({type:_.set_show_editor_setting,payload:!1})}function P(){h({type:_.set_show_editor_setting,payload:!0})}var j={value:a,language:c,onChange:i,theme:d,height:"calc(100% - 56px)",options:{fontSize:o,insertSpaces:C}};return w.a.createElement(I.Fragment,null,w.a.createElement("div",{className:"code-panel-container"},v(P),w.a.createElement(B.b,j)),w.a.createElement(A.a,null,w.a.createElement(z.a,{className:"oj",title:null,placement:"right",closable:!1,visible:s,onClose:x},w.a.createElement(N.a,y))))};function g(u){var a=u.onShowCodeSetting;return w.a.createElement("div",{className:"action-bar"},w.a.createElement("span",null,"\u5B66\u5458\u521D\u59CB\u4EE3\u7801\u6587\u4EF6"),w.a.createElement("a",{onClick:a},w.a.createElement("i",{className:"iconfont icon-shezhi"})))}},ELLl:function(Ke,we,U){(function(q){q(U("VrN/"))})(function(q){var z={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},L=q.Pos;q.defineOption("autoCloseBrackets",!1,function(E,g,u){u&&u!=q.Init&&(E.removeKeyMap(I),E.state.closeBrackets=null),g&&(w(K(g,"pairs")),E.state.closeBrackets=g,E.addKeyMap(I))});function K(E,g){return g=="pairs"&&typeof E=="string"?E:typeof E=="object"&&E[g]!=null?E[g]:z[g]}var I={Backspace:A,Enter:k};function w(E){for(var g=0;g<E.length;g++){var u=E.charAt(g),a="'"+u+"'";I[a]||(I[a]=B(u))}}w(z.pairs+"`");function B(E){return function(g){return O(g,E)}}function N(E){var g=E.state.closeBrackets;if(!g||g.override)return g;var u=E.getModeAt(E.getCursor());return u.closeBrackets||g}function A(E){var g=N(E);if(!g||E.getOption("disableInput"))return q.Pass;for(var u=K(g,"pairs"),a=E.listSelections(),i=0;i<a.length;i++){if(!a[i].empty())return q.Pass;var c=R(E,a[i].head);if(!c||u.indexOf(c)%2!=0)return q.Pass}for(var i=a.length-1;i>=0;i--){var S=a[i].head;E.replaceRange("",L(S.line,S.ch-1),L(S.line,S.ch+1),"+delete")}}function k(E){var g=N(E),u=g&&K(g,"explode");if(!u||E.getOption("disableInput"))return q.Pass;for(var a=E.listSelections(),i=0;i<a.length;i++){if(!a[i].empty())return q.Pass;var c=R(E,a[i].head);if(!c||u.indexOf(c)%2!=0)return q.Pass}E.operation(function(){var S=E.lineSeparator()||`
|
|
`;E.replaceSelection(S+S,null),E.execCommand("goCharLeft"),a=E.listSelections();for(var v=0;v<a.length;v++){var p=a[v].head.line;E.indentLine(p,null,!0),E.indentLine(p+1,null,!0)}})}function m(E){var g=q.cmpPos(E.anchor,E.head)>0;return{anchor:new L(E.anchor.line,E.anchor.ch+(g?-1:1)),head:new L(E.head.line,E.head.ch+(g?1:-1))}}function O(E,g){var u=N(E);if(!u||E.getOption("disableInput"))return q.Pass;var a=K(u,"pairs"),i=a.indexOf(g);if(i==-1)return q.Pass;for(var c=K(u,"closeBefore"),S=K(u,"triples"),v=a.charAt(i+1)==g,p=E.listSelections(),D=i%2==0,b,h=0;h<p.length;h++){var d=p[h],o=d.head,s,C=E.getRange(o,L(o.line,o.ch+1));if(D&&!d.empty())s="surround";else if((v||!D)&&C==g)v&&_(E,o)?s="both":S.indexOf(g)>=0&&E.getRange(o,L(o.line,o.ch+3))==g+g+g?s="skipThree":s="skip";else if(v&&o.ch>1&&S.indexOf(g)>=0&&E.getRange(L(o.line,o.ch-2),o)==g+g){if(o.ch>2&&/\bstring/.test(E.getTokenTypeAt(L(o.line,o.ch-2))))return q.Pass;s="addFour"}else if(v){var y=o.ch==0?" ":E.getRange(L(o.line,o.ch-1),o);if(!q.isWordChar(C)&&y!=g&&!q.isWordChar(y))s="both";else return q.Pass}else if(D&&(C.length===0||/\s/.test(C)||c.indexOf(C)>-1))s="both";else return q.Pass;if(!b)b=s;else if(b!=s)return q.Pass}var x=i%2?a.charAt(i-1):g,P=i%2?g:a.charAt(i+1);E.operation(function(){if(b=="skip")E.execCommand("goCharRight");else if(b=="skipThree")for(var j=0;j<3;j++)E.execCommand("goCharRight");else if(b=="surround"){for(var Y=E.getSelections(),j=0;j<Y.length;j++)Y[j]=x+Y[j]+P;E.replaceSelections(Y,"around"),Y=E.listSelections().slice();for(var j=0;j<Y.length;j++)Y[j]=m(Y[j]);E.setSelections(Y)}else b=="both"?(E.replaceSelection(x+P,null),E.triggerElectric(x+P),E.execCommand("goCharLeft")):b=="addFour"&&(E.replaceSelection(x+x+x+x,"before"),E.execCommand("goCharRight"))})}function R(E,g){var u=E.getRange(L(g.line,g.ch-1),L(g.line,g.ch+1));return u.length==2?u:null}function _(E,g){var u=E.getTokenAt(L(g.line,g.ch+1));return/\bstring/.test(u.type)&&u.start==g.ch&&(g.ch==0||!/\bstring/.test(E.getTokenTypeAt(g)))}})},FOrL:function(Ke,we,U){Ke.exports=U.p+"static/nodata.a6b3f948.png"},Gytx:function(Ke,we){Ke.exports=function(q,z,L,K){var I=L?L.call(K,q,z):void 0;if(I!==void 0)return!!I;if(q===z)return!0;if(typeof q!="object"||!q||typeof z!="object"||!z)return!1;var w=Object.keys(q),B=Object.keys(z);if(w.length!==B.length)return!1;for(var N=Object.prototype.hasOwnProperty.bind(z),A=0;A<w.length;A++){var k=w[A];if(!N(k))return!1;var m=q[k],O=z[k];if(I=L?L.call(K,m,O,k):void 0,I===!1||I===void 0&&m!==O)return!1}return!0}},H2Ag:function(Ke,we,U){Ke.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"}},HmJG:function(Ke,we,U){},I8Z2:function(Ke,we,U){"use strict";U.d(we,"a",function(){return K}),U.d(we,"b",function(){return R}),U.d(we,"c",function(){return E});var q=U("q1tI"),z=function(){var g=function(u,a){return g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,c){i.__proto__=c}||function(i,c){for(var S in c)c.hasOwnProperty(S)&&(i[S]=c[S])},g(u,a)};return function(u,a){g(u,a);function i(){this.constructor=u}u.prototype=a===null?Object.create(a):(i.prototype=a.prototype,new i)}}(),L=q.createContext(null),K=function(g){z(u,g);function u(){return g!==null&&g.apply(this,arguments)||this}return u.prototype.render=function(){return q.createElement(L.Provider,{value:this.props.store},this.props.children)},u}(q.Component),I=U("Gytx"),w=U.n(I),B=U("2mql"),N=U.n(B),A=function(){var g=function(u,a){return g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,c){i.__proto__=c}||function(i,c){for(var S in c)c.hasOwnProperty(S)&&(i[S]=c[S])},g(u,a)};return function(u,a){g(u,a);function i(){this.constructor=u}u.prototype=a===null?Object.create(a):(i.prototype=a.prototype,new i)}}(),k=function(){return k=Object.assign||function(g){for(var u,a=1,i=arguments.length;a<i;a++){u=arguments[a];for(var c in u)Object.prototype.hasOwnProperty.call(u,c)&&(g[c]=u[c])}return g},k.apply(this,arguments)};function m(g){return g.displayName||g.name||"Component"}var O=function(){return{}};function R(g,u){u===void 0&&(u={});var a=!!g,i=g||O;return function(S){var v=function(D){A(b,D);function b(h,d){var o=D.call(this,h,d)||this;return o.unsubscribe=null,o.handleChange=function(){if(!o.unsubscribe)return;var s=i(o.store.getState(),o.props);o.setState({subscribed:s})},o.store=o.context,o.state={subscribed:i(o.store.getState(),h),store:o.store,props:h},o}return b.getDerivedStateFromProps=function(h,d){return g&&g.length===2&&h!==d.props?{subscribed:i(d.store.getState(),h),props:h}:{props:h}},b.prototype.componentDidMount=function(){this.trySubscribe()},b.prototype.componentWillUnmount=function(){this.tryUnsubscribe()},b.prototype.shouldComponentUpdate=function(h,d){return!w()(this.props,h)||!w()(this.state.subscribed,d.subscribed)},b.prototype.trySubscribe=function(){a&&(this.unsubscribe=this.store.subscribe(this.handleChange),this.handleChange())},b.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null)},b.prototype.render=function(){var h=k(k(k({},this.props),this.state.subscribed),{store:this.store});return q.createElement(S,k({},h,{ref:this.props.miniStoreForwardedRef}))},b.displayName="Connect("+m(S)+")",b.contextType=L,b}(q.Component);if(u.forwardRef){var p=q.forwardRef(function(D,b){return q.createElement(v,k({},D,{miniStoreForwardedRef:b}))});return N()(p,S)}return N()(v,S)}}var _=function(){return _=Object.assign||function(g){for(var u,a=1,i=arguments.length;a<i;a++){u=arguments[a];for(var c in u)Object.prototype.hasOwnProperty.call(u,c)&&(g[c]=u[c])}return g},_.apply(this,arguments)};function E(g){var u=g,a=[];function i(v){u=_(_({},u),v);for(var p=0;p<a.length;p++)a[p]()}function c(){return u}function S(v){return a.push(v),function(){var D=a.indexOf(v);a.splice(D,1)}}return{setState:i,getState:c,subscribe:S}}},IBYe:function(Ke,we,U){"use strict";function q(z){return null}we.a=q},IxHN:function(Ke,we,U){"use strict";var q=U("q1tI"),z=U.n(q),L=U("07cG"),K=U.n(L);we.a=function(I){var w=I.message,B=I.className,N=I.children,A=I.style,k=A===void 0?{}:A;return z.a.createElement("div",{className:"".concat(K.a.idsRingWrapper," ").concat(B)},z.a.createElement("div",{className:K.a.ldsRing},z.a.createElement("div",null),z.a.createElement("div",null),z.a.createElement("div",null),z.a.createElement("div",null)),w?z.a.createElement("p",{style:k},w):null,N)}},J66h:function(Ke,we,U){(function(q){var z,L;(function(K,I){Ke.exports=I(K)})(typeof self!="undefined"?self:typeof window!="undefined"?window:typeof q!="undefined"?q:this,function(K){"use strict";K=K||{};var I=K.Base64,w="2.6.4",B="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",N=function(x){for(var P={},j=0,Y=x.length;j<Y;j++)P[x.charAt(j)]=j;return P}(B),A=String.fromCharCode,k=function(x){if(x.length<2){var P=x.charCodeAt(0);return P<128?x:P<2048?A(192|P>>>6)+A(128|P&63):A(224|P>>>12&15)+A(128|P>>>6&63)+A(128|P&63)}else{var P=65536+(x.charCodeAt(0)-55296)*1024+(x.charCodeAt(1)-56320);return A(240|P>>>18&7)+A(128|P>>>12&63)+A(128|P>>>6&63)+A(128|P&63)}},m=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,O=function(x){return x.replace(m,k)},R=function(x){var P=[0,2,1][x.length%3],j=x.charCodeAt(0)<<16|(x.length>1?x.charCodeAt(1):0)<<8|(x.length>2?x.charCodeAt(2):0),Y=[B.charAt(j>>>18),B.charAt(j>>>12&63),P>=2?"=":B.charAt(j>>>6&63),P>=1?"=":B.charAt(j&63)];return Y.join("")},_=K.btoa&&typeof K.btoa=="function"?function(x){return K.btoa(x)}:function(x){if(x.match(/[^\x00-\xFF]/))throw new RangeError("The string contains invalid characters.");return x.replace(/[\s\S]{1,3}/g,R)},E=function(x){return _(O(String(x)))},g=function(x){return x.replace(/[+\/]/g,function(P){return P=="+"?"-":"_"}).replace(/=/g,"")},u=function(x,P){return P?g(E(x)):E(x)},a=function(x){return u(x,!0)},i;K.Uint8Array&&(i=function(x,P){for(var j="",Y=0,Q=x.length;Y<Q;Y+=3){var X=x[Y],F=x[Y+1],$=x[Y+2],re=X<<16|F<<8|$;j+=B.charAt(re>>>18)+B.charAt(re>>>12&63)+(typeof F!="undefined"?B.charAt(re>>>6&63):"=")+(typeof $!="undefined"?B.charAt(re&63):"=")}return P?g(j):j});var c=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,S=function(x){switch(x.length){case 4:var P=(7&x.charCodeAt(0))<<18|(63&x.charCodeAt(1))<<12|(63&x.charCodeAt(2))<<6|63&x.charCodeAt(3),j=P-65536;return A((j>>>10)+55296)+A((j&1023)+56320);case 3:return A((15&x.charCodeAt(0))<<12|(63&x.charCodeAt(1))<<6|63&x.charCodeAt(2));default:return A((31&x.charCodeAt(0))<<6|63&x.charCodeAt(1))}},v=function(x){return x.replace(c,S)},p=function(x){var P=x.length,j=P%4,Y=(P>0?N[x.charAt(0)]<<18:0)|(P>1?N[x.charAt(1)]<<12:0)|(P>2?N[x.charAt(2)]<<6:0)|(P>3?N[x.charAt(3)]:0),Q=[A(Y>>>16),A(Y>>>8&255),A(Y&255)];return Q.length-=[0,0,2,1][j],Q.join("")},D=K.atob&&typeof K.atob=="function"?function(x){return K.atob(x)}:function(x){return x.replace(/\S{1,4}/g,p)},b=function(x){return D(String(x).replace(/[^A-Za-z0-9\+\/]/g,""))},h=function(x){return v(D(x))},d=function(x){return String(x).replace(/[-_]/g,function(P){return P=="-"?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,"")},o=function(x){return h(d(x))},s;K.Uint8Array&&(s=function(x){return Uint8Array.from(b(d(x)),function(P){return P.charCodeAt(0)})});var C=function(){var x=K.Base64;return K.Base64=I,x};if(K.Base64={VERSION:w,atob:b,btoa:_,fromBase64:o,toBase64:u,utob:O,encode:u,encodeURI:a,btou:v,decode:o,noConflict:C,fromUint8Array:i,toUint8Array:s},typeof Object.defineProperty=="function"){var y=function(x){return{value:x,enumerable:!1,writable:!0,configurable:!0}};K.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",y(function(){return o(this)})),Object.defineProperty(String.prototype,"toBase64",y(function(x){return u(this,x)})),Object.defineProperty(String.prototype,"toBase64URI",y(function(){return u(this,!0)}))}}return K.Meteor&&(Base64=K.Base64),Ke.exports?Ke.exports.Base64=K.Base64:!(z=[],L=function(){return K.Base64}.apply(we,z),L!==void 0&&(Ke.exports=L)),{Base64:K.Base64}})}).call(this,U("IyRk"))},JB8y:function(Ke,we,U){"use strict";U.d(we,"a",function(){return q});var q;(function(z){z[z.NOMATCH=-1]="NOMATCH",z[z.OK=0]="OK",z[z.TIMEOUT=2]="TIMEOUT",z[z.PODFAILURE=3]="PODFAILURE",z[z.COMPILEFAILURE=4]="COMPILEFAILURE",z[z.EXECUTEFAILURE=5]="EXECUTEFAILURE"})(q||(q={}))},JPnl:function(Ke,we,U){"use strict";U.d(we,"a",function(){return p}),U.d(we,"c",function(){return h});var q=U("+L6B"),z=U("2/Rp"),L=U("tJVT"),K=U("k1fw"),I=U("jrin"),w=U("5NDa"),B=U("5rEg"),N=U("q1tI"),A=U.n(N),k=U("8Skl"),m=U("y3Kf"),O=U("JB8y"),R=U("J66h"),_=U.n(R),E=U("a4uL"),g=U.n(E),u=U("IxHN"),a=U("9Bee"),i=U("1vsH"),c,S=B.a.TextArea,v={visible:!1,tabIndex:"0"},p=(c={},Object(I.a)(c,O.a.NOMATCH,"\u6D4B\u8BD5\u7528\u4F8B\u7ED3\u679C\u4E0D\u5339\u914D"),Object(I.a)(c,O.a.OK,"\u8C03\u8BD5\u901A\u8FC7"),Object(I.a)(c,2,"\u8C03\u8BD5\u8D85\u65F6"),Object(I.a)(c,3,"\u8C03\u8BD5pod\u5931\u8D25"),Object(I.a)(c,4,"\u7F16\u8BD1\u5931\u8D25"),Object(I.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 b(o,s){switch(s.type){case D.SET_VISIBLE:return Object(K.a)(Object(K.a)({},o),{},{visible:s.payload});case D.SET_TABINDEX:return Object(K.a)(Object(K.a)({},o),{},{tabIndex:s.payload});default:throw new Error}}function h(o){var s=o.status,C=o.error_msg,y=o.output,x=o.input,P=o.expected_output,j=o.is_file,Y=o.input_file_url,Q=o.output_file_url,X=o.expected_output_file_url,F=null,$={minHeight:150,marginBottom:10,paddingLeft:24,background:"#070f19",color:"#fff"};switch(s){case O.a.NOMATCH:F=A.a.createElement(A.a.Fragment,null,A.a.createElement("p",{className:"c-red"},"\u5B9E\u9645\u8F93\u5165\uFF1A"),!j&&A.a.createElement(a.a,{value:x,style:$}),j&&A.a.createElement("div",{style:$},A.a.createElement("a",{onClick:function(){return Object(i.w)(Y,x)}},x)),A.a.createElement("p",{className:"c-red"},"\u5B9E\u9645\u8F93\u51FA\uFF1A"),!j&&A.a.createElement(a.a,{value:y&&R.Base64.decode(y)||"",style:$}),j&&A.a.createElement("div",{style:$},A.a.createElement("a",{onClick:function(){return Object(i.w)(Q,y)}},y)),A.a.createElement("p",{className:"c-red"},"\u9884\u671F\u8F93\u51FA\uFF1A"),!j&&A.a.createElement(a.a,{value:P&&R.Base64.decode(P)||"",style:$}),j&&A.a.createElement("div",{style:$},A.a.createElement("a",{onClick:function(){return Object(i.w)(X,P)}},P)));break;case O.a.EXECUTEFAILURE:F=A.a.createElement(A.a.Fragment,null,A.a.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A"),!j&&A.a.createElement(a.a,{value:x,style:$}),j&&A.a.createElement("div",{style:$},A.a.createElement("a",{onClick:function(){return Object(i.w)(Y,x)}},x)),A.a.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),A.a.createElement("pre",{className:"error"},R.Base64.decode(C)));break;case O.a.COMPILEFAILURE:F=A.a.createElement(A.a.Fragment,null,A.a.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A"),!j&&A.a.createElement(a.a,{value:x,style:$}),j&&A.a.createElement("div",{style:$},A.a.createElement("a",{onClick:function(){return Object(i.w)(Y,x)}},x)),A.a.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),A.a.createElement("pre",{className:"error"},R.Base64.decode(C)));break;case O.a.PODFAILURE:F=A.a.createElement("p",null,"\u521B\u5EFApod\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break;case O.a.TIMEOUT:F=A.a.createElement("p",null,"\u8BC4\u6D4B\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break}return A.a.createElement(A.a.Fragment,null," ",F," ")}function d(o){var s=o.status,C=o.error_msg,y=o.execute_time,x=o.output,P=o.input,j=o.expected_output,Y=o.is_file,Q=o.input_file_url,X=o.output_file_url,F=o.expected_output_file_url,$=null;switch(s){case O.a.OK:$=A.a.createElement(A.a.Fragment,null,A.a.createElement("p",null,"\u6267\u884C\u7528\u65F6\uFF1A",y),A.a.createElement("p",null,"\u6267\u884C\u7ED3\u679C\uFF1A"),A.a.createElement("pre",null,R.Base64.decode(x)));break;case O.a.NOMATCH:$=A.a.createElement(A.a.Fragment,null,A.a.createElement("p",null,"\u8F93\u5165\uFF1A",A.a.createElement("pre",null,P)),A.a.createElement("p",null,"\u8F93\u51FA\uFF1A",x&&R.Base64.decode(x)),A.a.createElement("p",null,"\u9884\u671F\u8F93\u51FA\uFF1A",j&&R.Base64.decode(j)));break;case O.a.EXECUTEFAILURE:$=A.a.createElement(A.a.Fragment,null,A.a.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A",A.a.createElement("pre",null,P)),A.a.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),A.a.createElement("pre",{className:"error"},R.Base64.decode(C)));break;case O.a.COMPILEFAILURE:$=A.a.createElement(A.a.Fragment,null,A.a.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A",A.a.createElement("pre",null,P)),A.a.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),A.a.createElement("pre",{className:"error"},R.Base64.decode(C)));break;case O.a.PODFAILURE:$=A.a.createElement("p",null,"\u521B\u5EFApod\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break;case O.a.TIMEOUT:$=A.a.createElement("p",null,"\u8BC4\u6D4B\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break}return A.a.createElement(A.a.Fragment,null," ",$," ")}we.b=function(o){var s=o.input,C=o.debuging,y=o.submitting,x=o.executingMessage,P=o.debugResult,j=o.onChangeInput,Y=o.onDebugCode,Q=o.onSubmitCode,X=Object(N.useReducer)(b,v),F=Object(L.a)(X,2),$=F[0],re=F[1],se=$.visible,he=$.tabIndex;function _e(De){var pe=De.target.id;re({type:D.SET_TABINDEX,payload:pe})}function xe(){re({type:D.SET_VISIBLE,payload:!se})}var Ce=Object(N.useMemo)(function(){if(P){var De=P.status;return A.a.createElement(A.a.Fragment,null,d(P))}return null},[P]);function Oe(){re({type:D.SET_VISIBLE,payload:!0}),re({type:D.SET_TABINDEX,payload:"1"}),Y()}return A.a.createElement("div",{className:"test-case-panel"},A.a.createElement("div",{className:"test-case-panel-body ".concat(se?"active":"")},A.a.createElement("ul",{className:"s-navs"},A.a.createElement("li",null,A.a.createElement("a",{className:he==="0"?"active":"",id:"0",onClick:_e},"\u81EA\u5B9A\u4E49\u6D4B\u8BD5\u7528\u4F8B")),A.a.createElement("li",null,A.a.createElement("a",{className:he==="1"?"active":"",id:"1",onClick:_e},"\u4EE3\u7801\u6267\u884C\u7ED3\u679C"))),A.a.createElement("div",{className:"tab-panel-body ".concat(he==="0"?"":"hide")},A.a.createElement(S,{placeholder:"\u8BF7\u586B\u5199\u6D4B\u8BD5\u7528\u4F8B\u7684\u8F93\u5165\u503C\uFF0C\u70B9\u51FB\u201C\u8C03\u8BD5\u4EE3\u7801\u201D",value:s,onChange:j})),A.a.createElement("div",{className:"tab-panel-body ".concat(he==="1"?"":"hide")},C?A.a.createElement(u.a,{message:x}):P?A.a.createElement("section",{style:{height:200}}," ",Ce," "):A.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"))),A.a.createElement("a",{className:"btn-collapse ".concat(se?"up":""),onClick:xe},se?A.a.createElement(k.a,null):A.a.createElement(m.a,null)),A.a.createElement("footer",{className:"footer"},A.a.createElement("span",null,"\u63A7\u5236\u53F0"),A.a.createElement("div",{className:"flex-container"},A.a.createElement(z.a,{className:"btn-green",type:"ghost",loading:C,onClick:Oe},"\u8C03\u8BD5\u4EE3\u7801"),A.a.createElement(z.a,{type:"primary",loading:y,disabled:y,onClick:function(){re({type:D.SET_VISIBLE,payload:!1}),Q()}},"\u8BC4\u6D4B\u5E76\u63D0\u4EA4"))))}},LdHM:function(Ke,we,U){"use strict";U.d(we,"b",function(){return c}),U.d(we,"a",function(){return v});var q=U("1OyB"),z=U("vuIU"),L=U("Ji7U"),K=U("LK+K"),I=U("q1tI"),w=U("rePB"),B=U("Ff2n"),N=U("ODXe"),A=U("4IlW"),k=U("bX4T"),m=U("YrtM"),O=U("TSYQ"),R=U.n(O),_=U("+nKL"),E=U("8OUc"),g=function($,re){var se=$.prefixCls,he=$.id,_e=$.flattenOptions,xe=$.childrenAsData,Ce=$.values,Oe=$.searchValue,De=$.multiple,pe=$.defaultActiveFirstOption,ue=$.height,Me=$.itemHeight,at=$.notFoundContent,lt=$.open,et=$.menuItemSelectedIcon,Qe=$.virtual,je=$.onSelect,Ye=$.onToggleOpen,rt=$.onActiveValue,mt=$.onScroll,ot=$.onMouseEnter,qe="".concat(se,"-item"),Xe=Object(m.a)(function(){return _e},[lt,_e],function(Ue,ge){return ge[0]&&Ue[1]!==ge[1]}),Ct=I.useRef(null),xt=function(ge){ge.preventDefault()},bt=function(ge){Ct.current&&Ct.current.scrollTo({index:ge})},Et=function(ge){for(var de=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ce=Xe.length,te=0;te<ce;te+=1){var ie=(ge+te*de+ce)%ce,ae=Xe[ie],le=ae.group,Te=ae.data;if(!le&&!Te.disabled)return ie}return-1},At=I.useState(function(){return Et(0)}),St=Object(N.a)(At,2),Se=St[0],Ee=St[1],He=function(ge){Ee(ge);var de=Xe[ge];if(!de){rt(null,-1);return}rt(de.data.value,ge)};I.useEffect(function(){He(pe!==!1?Et(0):-1)},[Xe.length,Oe]),I.useEffect(function(){var Ue=setTimeout(function(){if(!De&<&&Ce.size===1){var ge=Array.from(Ce)[0],de=Xe.findIndex(function(ce){var te=ce.data;return te.value===ge});He(de),bt(de)}});return function(){return clearTimeout(Ue)}},[lt]);var Ge=function(ge){ge!==void 0&&je(ge,{selected:!Ce.has(ge)}),De||Ye(!1)};if(I.useImperativeHandle(re,function(){return{onKeyDown:function(ge){var de=ge.which;switch(de){case A.a.UP:case A.a.DOWN:{var ce=0;if(de===A.a.UP?ce=-1:de===A.a.DOWN&&(ce=1),ce!==0){var te=Et(Se+ce,ce);bt(te),He(te)}break}case A.a.ENTER:{var ie=Xe[Se];ie&&!ie.data.disabled?Ge(ie.data.value):Ge(void 0),lt&&ge.preventDefault();break}case A.a.ESC:Ye(!1)}},onKeyUp:function(){},scrollTo:function(ge){bt(ge)}}}),Xe.length===0)return I.createElement("div",{role:"listbox",id:"".concat(he,"_list"),className:"".concat(qe,"-empty"),onMouseDown:xt},at);function Re(Ue){var ge=Xe[Ue];if(!ge)return null;var de=ge.data||{},ce=de.value,te=de.label,ie=de.children,ae=Object(k.a)(de,!0),le=xe?ie:te;return ge?I.createElement("div",Object.assign({"aria-label":typeof le=="string"?le:null},ae,{key:Ue,role:"option",id:"".concat(he,"_list_").concat(Ue),"aria-selected":Ce.has(ce)}),ce):null}return I.createElement(I.Fragment,null,I.createElement("div",{role:"listbox",id:"".concat(he,"_list"),style:{height:0,width:0,overflow:"hidden"}},Re(Se-1),Re(Se),Re(Se+1)),I.createElement(_.a,{itemKey:"key",ref:Ct,data:Xe,height:ue,itemHeight:Me,fullHeight:!1,onMouseDown:xt,onScroll:mt,virtual:Qe,onMouseEnter:ot},function(Ue,ge){var de,ce=Ue.group,te=Ue.groupOption,ie=Ue.data,ae=ie.label,le=ie.key;if(ce)return I.createElement("div",{className:R()(qe,"".concat(qe,"-group"))},ae!==void 0?ae:le);var Te=ie.disabled,be=ie.value,ze=ie.title,dt=ie.children,yt=ie.style,ct=ie.className,st=Object(B.a)(ie,["disabled","value","title","children","style","className"]),Be=Ce.has(be),Fe="".concat(qe,"-option"),Pe=R()(qe,Fe,ct,(de={},Object(w.a)(de,"".concat(Fe,"-grouped"),te),Object(w.a)(de,"".concat(Fe,"-active"),Se===ge&&!Te),Object(w.a)(de,"".concat(Fe,"-disabled"),Te),Object(w.a)(de,"".concat(Fe,"-selected"),Be),de)),oe=xe?dt:ae,fe=!et||typeof et=="function"||Be;return I.createElement("div",Object.assign({},st,{"aria-selected":Be,className:Pe,title:ze,onMouseMove:function(){if(Se===ge||Te)return;He(ge)},onClick:function(){Te||Ge(be)},style:yt}),I.createElement("div",{className:"".concat(Fe,"-content")},oe||be),I.isValidElement(et)||Be,fe&&I.createElement(E.a,{className:"".concat(qe,"-option-state"),customizeIcon:et,customizeIconProps:{isSelected:Be}},Be?"\u2713":null))}))},u=I.forwardRef(g);u.displayName="OptionList";var a=u,i=function(){return null};i.isSelectOption=!0;var c=i,S=function(){return null};S.isSelectOptGroup=!0;var v=S,p=U("VTBJ"),D=U("Zm9Q");function b(F){var $=F.key,re=F.props,se=re.children,he=re.value,_e=Object(B.a)(re,["children","value"]);return Object(p.a)({key:$,value:he!==void 0?he:$,children:se},_e)}function h(F){var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(D.a)(F).map(function(re,se){if(!I.isValidElement(re)||!re.type)return null;var he=re.type.isSelectOptGroup,_e=re.key,xe=re.props,Ce=xe.children,Oe=Object(B.a)(xe,["children"]);return $||!he?b(re):Object(p.a)(Object(p.a)({key:"__RC_SELECT_GRP__".concat(_e===null?se:_e,"__"),label:_e},Oe),{},{options:h(Ce)})}).filter(function(re){return re})}var d=U("2Qr1"),o=U("qNPg"),s=U("U8pU"),C=U("Kwbf"),y=U("WKfj");function x(F){var $=F.mode,re=F.options,se=F.children,he=F.backfill,_e=F.allowClear,xe=F.placeholder,Ce=F.getInputElement,Oe=F.showSearch,De=F.onSearch,pe=F.defaultOpen,ue=F.autoFocus,Me=F.labelInValue,at=F.value,lt=F.inputValue,et=F.optionLabelProp,Qe=$==="multiple"||$==="tags",je=Oe!==void 0?Oe:Qe||$==="combobox",Ye=re||h(se);if(Object(C.a)($!=="tags"||Ye.every(function(qe){return!qe.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),$==="tags"||$==="combobox"){var rt=Ye.some(function(qe){return qe.options?qe.options.some(function(Xe){return typeof("value"in Xe?Xe.value:Xe.key)=="number"}):typeof("value"in qe?qe.value:qe.key)=="number"});Object(C.a)(!rt,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(C.a)($!=="combobox"||!et,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(C.a)($==="combobox"||!he,"`backfill` only works with `combobox` mode."),Object(C.a)($==="combobox"||!Ce,"`getInputElement` only work with `combobox` mode."),Object(C.b)($!=="combobox"||!Ce||!_e||!xe,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),De&&!je&&$!=="combobox"&&$!=="tags"&&Object(C.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(C.b)(!pe||ue,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),at!=null){var mt=Object(y.d)(at);Object(C.a)(!Me||mt.every(function(qe){return Object(s.a)(qe)==="object"&&("key"in qe||"value"in qe)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(C.a)(!Qe||Array.isArray(at),"`value` should be array when `mode` is `multiple` or `tags`")}if(se){var ot=null;Object(D.a)(se).some(function(qe){if(!I.isValidElement(qe)||!qe.type)return!1;var Xe=qe.type;if(Xe.isSelectOption)return!1;if(Xe.isSelectOptGroup){var Ct=Object(D.a)(qe.props.children).every(function(xt){return!I.isValidElement(xt)||!qe.type||xt.type.isSelectOption?!0:(ot=xt.type,!1)});return!Ct}return ot=Xe,!0}),ot&&Object(C.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(ot.displayName||ot.name||ot,"`.")),Object(C.a)(lt===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var P=x,j=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:P,fillOptionsWithMissingValue:d.a}),Y=function(F){Object(L.a)(re,F);var $=Object(K.a)(re);function re(){var se;return Object(q.a)(this,re),se=$.apply(this,arguments),se.selectRef=I.createRef(),se.focus=function(){se.selectRef.current.focus()},se.blur=function(){se.selectRef.current.blur()},se}return Object(z.a)(re,[{key:"render",value:function(){return I.createElement(j,Object.assign({ref:this.selectRef},this.props))}}]),re}(I.Component);Y.Option=c,Y.OptGroup=v;var Q=Y,X=we.c=Q},M8RZ:function(Ke,we,U){"use strict";U.d(we,"a",function(){return A});var q=U("fWQN"),z=U("mtLc"),L=U("yKVA"),K=U("879j"),I=U("q1tI"),w=U.n(I),B=U("i8i4"),N=U.n(B),A=function(k){Object(L.a)(O,k);var m=Object(K.a)(O);function O(R){var _;Object(q.a)(this,O),_=m.call(this,R);var E=window.document;return _.node=E.createElement("div"),E.body.appendChild(_.node),_}return Object(z.a)(O,[{key:"render",value:function(){var _=this.props.children;return Object(B.createPortal)(_,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),O}(w.a.Component)},MFOe:function(Ke,we,U){(function(q){var z=w(),L=B(),K=N(),I=typeof window!="undefined"?window:q;Ke.exports={assign:z,create:L,trim:K,bind:A,slice:k,each:m,map:O,pluck:R,isList:_,isFunction:E,isObject:g,Global:I};function w(){return Object.assign?Object.assign:function(a,i,c,S){for(var v=1;v<arguments.length;v++)m(Object(arguments[v]),function(p,D){a[D]=p});return a}}function B(){if(Object.create)return function(i,c,S,v){var p=k(arguments,1);return z.apply(this,[Object.create(i)].concat(p))};{function u(){}return function(i,c,S,v){var p=k(arguments,1);return u.prototype=i,z.apply(this,[new u].concat(p))}}}function N(){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 A(u,a){return function(){return a.apply(u,Array.prototype.slice.call(arguments,0))}}function k(u,a){return Array.prototype.slice.call(u,a||0)}function m(u,a){R(u,function(i,c){return a(i,c),!1})}function O(u,a){var i=_(u)?[]:{};return R(u,function(c,S){return i[S]=a(c,S),!1}),i}function R(u,a){if(_(u)){for(var i=0;i<u.length;i++)if(a(u[i],i))return u[i]}else for(var c in u)if(u.hasOwnProperty(c)&&a(u[c],c))return u[c]}function _(u){return u!=null&&typeof u!="function"&&typeof u.length=="number"}function E(u){return u&&{}.toString.call(u)==="[object Function]"}function g(u){return u&&{}.toString.call(u)==="[object Object]"}}).call(this,U("IyRk"))},NvD2:function(Ke,we,U){"use strict";U.d(we,"a",function(){return w});var q=U("Kwbf");function z(B,N){var A=new Set;return B.forEach(function(k){N.has(k)||A.add(k)}),A}function L(B){var N=B||{},A=N.disabled,k=N.disableCheckbox,m=N.checkable;return!!(A||k)||m===!1}function K(B,N,A,k){for(var m=new Set(B),O=new Set,R=0;R<=A;R+=1){var _=N.get(R)||new Set;_.forEach(function(a){var i=a.key,c=a.node,S=a.children,v=S===void 0?[]:S;m.has(i)&&!k(c)&&v.filter(function(p){return!k(p.node)}).forEach(function(p){m.add(p.key)})})}for(var E=new Set,g=A;g>=0;g-=1){var u=N.get(g)||new Set;u.forEach(function(a){var i=a.parent,c=a.node;if(k(c)||!a.parent||E.has(a.parent.key))return;if(k(a.parent.node)){E.add(i.key);return}var S=!0,v=!1;(i.children||[]).filter(function(p){return!k(p.node)}).forEach(function(p){var D=p.key,b=m.has(D);S&&!b&&(S=!1),!v&&(b||O.has(D))&&(v=!0)}),S&&m.add(i.key),v&&O.add(i.key),E.add(i.key)})}return{checkedKeys:Array.from(m),halfCheckedKeys:Array.from(z(O,m))}}function I(B,N,A,k,m){for(var O=new Set(B),R=new Set(N),_=0;_<=k;_+=1){var E=A.get(_)||new Set;E.forEach(function(i){var c=i.key,S=i.node,v=i.children,p=v===void 0?[]:v;!O.has(c)&&!R.has(c)&&!m(S)&&p.filter(function(D){return!m(D.node)}).forEach(function(D){O.delete(D.key)})})}R=new Set;for(var g=new Set,u=k;u>=0;u-=1){var a=A.get(u)||new Set;a.forEach(function(i){var c=i.parent,S=i.node;if(m(S)||!i.parent||g.has(i.parent.key))return;if(m(i.parent.node)){g.add(c.key);return}var v=!0,p=!1;(c.children||[]).filter(function(D){return!m(D.node)}).forEach(function(D){var b=D.key,h=O.has(b);v&&!h&&(v=!1),!p&&(h||R.has(b))&&(p=!0)}),v||O.delete(c.key),p&&R.add(c.key),g.add(c.key)})}return{checkedKeys:Array.from(O),halfCheckedKeys:Array.from(z(R,O))}}function w(B,N,A,k){var m=[],O;k?O=k:O=L;var R=new Set(B.filter(function(u){var a=!!A[u];return a||m.push(u),a})),_=new Map,E=0;Object.keys(A).forEach(function(u){var a=A[u],i=a.level,c=_.get(i);c||(c=new Set,_.set(i,c)),c.add(a),E=Math.max(E,i)}),Object(q.a)(!m.length,"Tree missing follow keys: ".concat(m.slice(0,100).map(function(u){return"'".concat(u,"'")}).join(", ")));var g;return N===!0?g=K(R,_,E,O):g=I(R,N.halfCheckedKeys,_,E,O),g}},OJz4:function(Ke,we,U){"use strict";U.d(we,"d",function(){return z}),U.d(we,"h",function(){return L}),U.d(we,"b",function(){return K}),U.d(we,"f",function(){return I}),U.d(we,"e",function(){return w}),U.d(we,"c",function(){return B}),U.d(we,"a",function(){return N}),U.d(we,"g",function(){return A}),U.d(we,"i",function(){return k}),U.d(we,"k",function(){return m}),U.d(we,"j",function(){return O});var q=U("ErOA");function z(R){return Object(q.c)("myproblems/".concat(R,".json"),{hidePopLogin:!0})}function L(R,_){return Object(q.f)("myproblems/".concat(R,"/code_submit.json"),_)}function K(R,_){return Object(q.c)("myproblems/".concat(R,"/code_debug.json"),_)}function I(R,_){return Object(q.c)("myproblems/".concat(R,"/submit_records.json"),_)}function w(R){return Object(q.c)("myproblems/record_detail.json",{id:R})}function B(R,_){return Object(q.c)("myproblems/".concat(R,"/result.json"),{mode:_})}function N(R,_){return Object(q.f)("myproblems/".concat(R,"/add_notes.json"),_)}function A(R){return Object(q.f)("myproblems/".concat(R,"/restore_initial_code.json"))}function k(R){return Object(q.f)("myproblems/".concat(R,"/sync_code.json"))}function m(R,_){return Object(q.f)("myproblems/".concat(R,"/update_code.json"),_)}function O(R,_){return Object(q.f)("discusses/".concat(R,"/plus.json"),_)}},OLES:function(Ke,we,U){"use strict";var q=U("U8pU"),z=U("VTBJ"),L=U("Ff2n"),K=U("q1tI"),I=U("uciX"),w=U("7ixt"),B=function(R){var _=R.overlay,E=R.prefixCls,g=R.id,u=R.overlayInnerStyle;return K.createElement("div",{className:"".concat(E,"-inner"),id:g,role:"tooltip",style:u},typeof _=="function"?_():_)},N=B,A=function(R,_){var E=R.overlayClassName,g=R.trigger,u=g===void 0?["hover"]:g,a=R.mouseEnterDelay,i=a===void 0?0:a,c=R.mouseLeaveDelay,S=c===void 0?.1:c,v=R.overlayStyle,p=R.prefixCls,D=p===void 0?"rc-tooltip":p,b=R.children,h=R.onVisibleChange,d=R.afterVisibleChange,o=R.transitionName,s=R.animation,C=R.placement,y=C===void 0?"right":C,x=R.align,P=x===void 0?{}:x,j=R.destroyTooltipOnHide,Y=j===void 0?!1:j,Q=R.defaultVisible,X=R.getTooltipContainer,F=R.overlayInnerStyle,$=Object(L.a)(R,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),re=Object(K.useRef)(null);Object(K.useImperativeHandle)(_,function(){return re.current});var se=Object(z.a)({},$);"visible"in R&&(se.popupVisible=R.visible);var he=function(){var De=R.arrowContent,pe=De===void 0?null:De,ue=R.overlay,Me=R.id;return[K.createElement("div",{className:"".concat(D,"-arrow"),key:"arrow"},pe),K.createElement(N,{key:"content",prefixCls:D,id:Me,overlay:ue,overlayInnerStyle:F})]},_e=!1,xe=!1;if(typeof Y=="boolean")_e=Y;else if(Y&&Object(q.a)(Y)==="object"){var Ce=Y.keepParent;_e=Ce===!0,xe=Ce===!1}return K.createElement(I.a,Object.assign({popupClassName:E,prefixCls:D,popup:he,action:u,builtinPlacements:w.a,popupPlacement:y,ref:re,popupAlign:P,getPopupContainer:X,onPopupVisibleChange:h,afterPopupVisibleChange:d,popupTransitionName:o,popupAnimation:s,defaultPopupVisible:Q,destroyPopupOnHide:_e,autoDestroy:xe,mouseLeaveDelay:S,popupStyle:v,mouseEnterDelay:i},se),b)},k=Object(K.forwardRef)(A),m=we.a=k},OZM5:function(Ke,we,U){"use strict";U.d(we,"b",function(){return k}),U.d(we,"a",function(){return m}),U.d(we,"k",function(){return O}),U.d(we,"h",function(){return R}),U.d(we,"i",function(){return _}),U.d(we,"g",function(){return E}),U.d(we,"c",function(){return g}),U.d(we,"d",function(){return u}),U.d(we,"j",function(){return c}),U.d(we,"e",function(){return S}),U.d(we,"f",function(){return v});var q=U("KQm4"),z=U("U8pU"),L=U("Ff2n"),K=U("q1tI"),I=U.n(K),w=U("Kwbf"),B=U("WaYH"),N=.25,A=2;function k(p,D){var b=p.slice(),h=b.indexOf(D);return h>=0&&b.splice(h,1),b}function m(p,D){var b=p.slice();return b.indexOf(D)===-1&&b.push(D),b}function O(p){return p.split("-")}function R(p,D){return"".concat(p,"-").concat(D)}function _(p){return p&&p.type&&p.type.isTreeNode}function E(p,D){var b=[p],h=D[p];function d(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];o.forEach(function(s){var C=s.key,y=s.children;b.push(C),d(y)})}return d(h.children),b}function g(p,D){var b=p.clientY,h=D.selectHandle.getBoundingClientRect(),d=h.top,o=h.bottom,s=h.height,C=Math.max(s*N,A);return b<=d+C?-1:b>=o-C?1:0}function u(p,D){if(!p)return;var b=D.multiple;return b?p.slice():p.length?[p[0]]:p}var a=function(D){return D};function i(p,D){if(!p)return[];var b=D||{},h=b.processProps,d=h===void 0?a:h,o=Array.isArray(p)?p:[p];return o.map(function(s){var C=s.children,y=Object(L.a)(s,["children"]),x=i(C,D);return I.a.createElement(B.a,Object.assign({},d(y)),x)})}function c(p){if(!p)return null;var D;if(Array.isArray(p))D={checkedKeys:p,halfCheckedKeys:void 0};else if(Object(z.a)(p)==="object")D={checkedKeys:p.checked||void 0,halfCheckedKeys:p.halfChecked||void 0};else return Object(w.a)(!1,"`checkedKeys` is not an array or an object"),null;return D}function S(p,D){var b=new Set;function h(d){if(b.has(d))return;var o=D[d];if(!o)return;b.add(d);var s=o.parent,C=o.node;if(C.disabled)return;s&&h(s.key)}return(p||[]).forEach(function(d){h(d)}),Object(q.a)(b)}function v(p){var D={};return Object.keys(p).forEach(function(b){(b.startsWith("data-")||b.startsWith("aria-"))&&(D[b]=p[b])}),D}},Ot1p:function(Ke,we,U){"use strict";var q=U("2qtc"),z=U("kLXV"),L=U("rAM+"),K=U("miYZ"),I=U("tsqr"),w=U("9og8"),B=U("tJVT"),N=U("jrin"),A=U("WmNS"),k=U.n(A),m=U("q1tI"),O=U.n(m),R=U("VrN/"),_=U.n(R),E=U("bdgK"),g=U("p77/"),u=U("Bd2K"),a=U("ELLl"),i=U("19Vz"),c=U("lZu9"),S=U("+NIl"),v=U("kSUc"),p=U("9Bee"),D=function(be){var ze=be.value,dt=ze===void 0?"":ze,yt=be.className,ct=be.showTextOnly,st=be.showLines,Be=be.style,Fe=Be===void 0?{}:Be,Pe=Object(m.useMemo)(function(){return""},[dt]);return O.a.createElement(O.a.Fragment,null,O.a.createElement("div",{dangerouslySetInnerHTML:{__html:Pe}}))},b=U("0Owb"),h=U("dejd"),d=U("C+DQ"),o=U("1vsH"),s=U("m3rI"),C=[{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 y(be){var ze=be.onActionCallback,dt=be.title,yt=be.icon,ct=be.actionName,st=be.className,Be=st===void 0?"":st,Fe=be.children;function Pe(){ze(ct)}return O.a.createElement("a",{title:dt,className:Be,onClick:Pe},O.a.createElement("i",{className:"md-iconfont ".concat(yt)}),Fe)}var x=function(be){var ze=be.watch,dt=be.showNullButton,yt=be.onActionCallback,ct=be.fullScreen,st=be.insertTemp,Be=be.hidetoolBar,Fe=be.uuid,Pe=be.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(o.E)("_educoder_session_login"),"&_educoder_session=").concat(Object(o.E)("_educoder_session"),"&key=").concat(Fe,"&api=").concat(encodeURIComponent(s.a.PROXY_SERVER)));var oe=[].concat(C,[{title:"".concat(ze?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(ze?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return O.a.createElement("ul",{className:"markdown-toolbar-container"},!Be&&oe.map(function(fe,We){return O.a.createElement("li",{key:We},fe.actionName?O.a.createElement(y,Object(b.a)({},fe,{onActionCallback:yt})):O.a.createElement("span",{className:"v-line"}))}),dt?O.a.createElement("li",null,O.a.createElement(y,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:yt},O.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,st&&O.a.createElement("li",null,O.a.createElement(y,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(st),onActionCallback:yt},O.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),O.a.createElement("li",{className:"btn-full-screen"},O.a.createElement(y,{icon:"".concat(ct?"icon-shrink":"icon-enlarge"),title:ct?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:yt})))},P=U("M8RZ"),j=U("+L6B"),Y=U("2/Rp"),Q=U("y8nQ"),X=U("Vl3Y"),F=U("5NDa"),$=U("5rEg"),re={labelCol:{span:4},wrapperCol:{span:20}},se=function(be){var ze=be.callback,dt=be.onCancel;function yt(ct){ze(ct)}return O.a.createElement(X.a,Object(b.a)({},re,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:yt}),O.a.createElement(X.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},O.a.createElement($.a,null)),O.a.createElement(X.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},O.a.createElement($.a,null)),O.a.createElement("div",{className:"flex-container flex-end"},O.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),O.a.createElement(Y.a,{type:"ghost",onClick:dt},"\u53D6\u6D88")))},he=U("7ahc"),_e=U("k1fw"),xe=U("HmJG"),Ce=U("BjJ7"),Oe=X.a.useForm,De={width:280,marginRight:10},pe={labelCol:{span:5},wrapperCol:{span:19}},ue=function(be){var ze=be.callback,dt=be.onCancel,yt=Oe(),ct=Object(B.a)(yt,1),st=ct[0],Be=Object(m.useRef)();function Fe(fe){ze(Object(_e.a)(Object(_e.a)({},fe),{},{name:Be.current}))}function Pe(fe,We){st.setFieldsValue({src:"/api/attachments/".concat(fe.id,"?type=").concat(fe.content_type),type:We.type})}function oe(fe){var We=fe.target.files[0];Be.current=We.name,at(We,Pe)}return O.a.createElement(X.a,Object(b.a)({form:st},pe,{className:"upload-image-panel",onFinish:Fe}),O.a.createElement(X.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},O.a.createElement("div",{className:"flex-container"},O.a.createElement(X.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},O.a.createElement($.a,{style:De})),O.a.createElement(Me,{onFileChange:oe}))),O.a.createElement(X.a.Item,{label:"\u6587\u4EF6\u63CF\u8FF0",name:"alt"},O.a.createElement($.a,{style:{width:264}})),O.a.createElement(X.a.Item,{style:{textAlign:"right"}},O.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),O.a.createElement(Y.a,{type:"ghost",onClick:dt},"\u53D6\u6D88")))};function Me(be){var ze=be.onFileChange;return O.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",O.a.createElement("input",{type:"file",onChange:ze}))}function at(be,ze){if(!be)throw new String("\u6CA1\u6709\u6587\u4EF6");var dt=new FormData;dt.append("editormd-image-file",be),dt.append("file_param_name","editormd-image-file"),dt.append("byxhr","true");var yt=new window.XMLHttpRequest;yt.withCredentials=!0,yt.addEventListener("load",function(ct){ze(JSON.parse(ct.target.responseText),be)},!1),yt.addEventListener("error",function(ct){console.error(ct)},!1),yt.open("POST","".concat(Ce.a,"/api/attachments.json")),yt.send(dt)}var lt=U("giR+"),et=U("fyUT"),Qe=U("7Kak"),je=U("9yH6"),Ye=je.a.Group,rt={margin:"0 8px"},mt=function(be){var ze=be.callback,dt=be.onCancel;function yt(ct){ze(ct)}return O.a.createElement(X.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:yt},O.a.createElement("div",{className:"flex-container"},O.a.createElement("span",{style:rt},"\u5355\u5143\u683C\u6570\uFF1A"),O.a.createElement("span",{style:rt},"\u884C\u6570"),O.a.createElement(X.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},O.a.createElement(et.a,null)),O.a.createElement("span",{style:rt},"\u5217\u6570"),O.a.createElement(X.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},O.a.createElement(et.a,null))),O.a.createElement("div",{className:"flex-container",style:{marginTop:12}},O.a.createElement("span",{style:rt},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),O.a.createElement(X.a.Item,{name:"align"},O.a.createElement(Ye,null,O.a.createElement(je.a,{value:"default"},O.a.createElement("i",{className:"fa fa-align-justify"})),O.a.createElement(je.a,{value:"left"},O.a.createElement("i",{className:"fa fa-align-left"})),O.a.createElement(je.a,{value:"center"},O.a.createElement("i",{className:"fa fa-align-center"})),O.a.createElement(je.a,{value:"right"},O.a.createElement("i",{className:"fa fa-align-right"}))))),O.a.createElement("div",{className:"flex-container flex-end"},O.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),O.a.createElement(Y.a,{type:"ghost",onClick:dt},"\u53D6\u6D88")))},ot=U("ErOA"),qe=U("7Cbv"),Xe="link",Ct="upload-image",xt="code-block",bt="add-table",Et="------------",At={default:Et,left:":".concat(Et),center:":".concat(Et,":"),right:"".concat(Et,":")},St=U("9VGf"),Se,Ee;function He(){}var Ge=0,Re=1e4,Ue="\u2581",ge=`
|
|
**\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 de(be){return/^\d+$/.test(be)?"".concat(be,"px"):be}var ce=navigator.platform.toUpperCase().indexOf("MAC")>=0,te=ce?"Cmd":"Ctrl",ie=["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"],ae=(Se={},Object(N.a)(Se,te+"-B","bold"),Object(N.a)(Se,te+"-I","italic"),Se),le=(Ee={},Object(N.a)(Ee,Xe,"\u6DFB\u52A0\u94FE\u63A5"),Object(N.a)(Ee,xt,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(N.a)(Ee,Ct,"\u6DFB\u52A0\u6587\u4EF6"),Object(N.a)(Ee,bt,"\u6DFB\u52A0\u8868\u683C"),Ee),Te=we.a=function(be){var ze=be.defaultValue,dt=ze===void 0?"":ze,yt=be.onChange,ct=be.width,st=ct===void 0?"100%":ct,Be=be.height,Fe=Be===void 0?400:Be,Pe=be.miniToolbar,oe=Pe===void 0?!1:Pe,fe=be.isFocus,We=fe===void 0?!1:fe,Ie=be.watch,tt=be.insertTemp,ft=be.mode,Ae=ft===void 0?"markdown":ft,nt=be.id,gt=nt===void 0?"markdown-editor-id":nt,Bt=be.showResizeBar,pt=Bt===void 0?!1:Bt,sn=be.noStorage,gn=sn===void 0?!1:sn,en=be.showNullButton,Dt=en===void 0?!1:en,Sn=be.hidetoolBar,Nn=Sn===void 0?!1:Sn,Ne=be.fullScreen,it=Ne===void 0?!1:Ne,Pt=be.onBlur,Qt=be.onCMBeforeChange,un=be.onFullScreen,$e=be.className,Ot=$e===void 0?"":$e,Ht=be.disablePaste,jt=Ht===void 0?!1:Ht,mn=be.placeholder,Jt=mn===void 0?"":mn,H=be.values,f=H===void 0?"":H,T=Object(m.useState)(null),W=Object(B.a)(T,2),J=W[0],G=W[1],ve=Object(m.useState)(dt),Ve=Object(B.a)(ve,2),ht=Ve[0],Tt=Ve[1],Je=Object(m.useState)(Ie),It=Object(B.a)(Je,2),kt=It[0],rn=It[1],An=Object(m.useState)(it),Vn=Object(B.a)(An,2),vn=Vn[0],hn=Vn[1],wn=Object(m.useState)(""),yn=Object(B.a)(wn,2),Cn=yn[0],fn=yn[1],bn=Object(m.useState)(0),En=Object(B.a)(bn,2),Yn=En[0],Kn=En[1],Ar=Object(m.useState)(Fe),Dn=Object(B.a)(Ar,2),fr=Dn[0],er=Dn[1],lr=Object(m.useState)(!1),_r=Object(B.a)(lr,2),br=_r[0],pn=_r[1],Nt=Object(m.useRef)(Object(qe.a)()),Rn=Object(m.useRef)(!1),dn=Object(m.useRef)(),_n=Object(m.useRef)(),cn=Object(m.useRef)(),tr=Object(m.useRef)(),Ln=Object(m.useRef)(),$n=function(){var Ft=Object(w.a)(k.a.mark(function Yt(){var zt,nn;return k.a.wrap(function(Rt){for(;;)switch(Rt.prev=Rt.next){case 0:return Rt.next=2,Object(ot.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Nt.current}});case 2:nn=Rt.sent,nn!=null&&(zt=nn.attachments)!==null&&zt!==void 0&&zt.length&&(console.log("cm:",J,_n),nn.attachments.map(function(Wt){Wt.content_type.indexOf("image")>-1?J.replaceSelection(".concat(Wt.content_type,")")):Wt.content_type.indexOf("video")>-1?J.replaceSelection('<video width="100%" controls src="'.concat(s.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Wt.content_type.indexOf("pdf")>-1?J.replaceSelection('<a href="'.concat(s.a.API_SERVER,"/api/attachments/").concat(Wt.id,"?type=").concat(Wt.content_type,'&disposition=inline" target="_blank">').concat(Wt.name,"</a>")):J.replaceSelection("[".concat(Wt.name,"](").concat(s.a.API_SERVER,"/api/attachments/").concat(Wt.id,"?type=").concat(Wt.content_type,")"))}));case 4:case"end":return Rt.stop()}},Yt)}));return function(){return Ft.apply(this,arguments)}}();Object(m.useEffect)(function(){Tt(f),J==null||J.setValue(f)},[f]),Object(m.useEffect)(function(){un==null||un(vn)},[vn]),Object(m.useEffect)(function(){if(_n.current){var Ft=_.a.fromTextArea(_n.current,{mode:Ae,lineNumbers:!oe,lineWrapping:!0,value:dt,autoCloseTags:!0,autoCloseBrackets:!0});We&&Ft.focus();function Yt(zt,nn){if(jt){nn.preventDefault();return}var Kt=nn.clipboardData;if(Kt){var Rt=Kt.types.toString(),Wt=Kt.items;if(Rt==="Files"||Kt.types.indexOf("Files")>-1){if(nn.preventDefault(),Ae=="stex")return;try{var Lt,ln=Wt[1];((Lt=Wt[0])===null||Lt===void 0?void 0:Lt.kind)==="file"&&(ln=Wt[0]);var Gt=ln.getAsFile(),Un=Gt.name.split(".").pop();at(Gt,function(Zt){if(Zt.id){var xn,Vt,Fn;(Gt==null||((xn=Gt.type)===null||xn===void 0)?void 0:xn.indexOf("image"))>-1?Ft.replaceSelection(".concat(Zt.content_type,")")):(Gt==null||((Vt=Gt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?Ft.replaceSelection('<video width="100%" controls src="'.concat(s.a.API_SERVER,"/api/attachments/").concat(Zt.id,'"></video>')):(Gt==null||((Fn=Gt.type)===null||Fn===void 0)?void 0:Fn.indexOf("pdf"))>-1?Ft.replaceSelection('<a href="'.concat(s.a.API_SERVER,"/api/attachments/").concat(Zt.id,"?type=").concat(Gt.type,'&disposition=inline" target="_blank">').concat(Gt.name,"</a>")):ie.includes(Un)?Ft.replaceSelection('<a href="'.concat(s.a.API_SERVER,"/api/attachments/").concat(Zt.id,'?type=office&disposition=inline" target="_blank">').concat(Gt.name,"</a>")):Ft.replaceSelection("[".concat(Gt.name,"](").concat(s.a.API_SERVER,"/api/attachments/").concat(Zt.id,"?type=").concat(Zt.content_type,")"))}else(Zt==null?void 0:Zt.status)===401&&(document.location.href="/user/login")})}catch(Zt){I.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return Ft.on("paste",Yt),Ft.on("dragleave",function(zt,nn){cn.current.classList.remove("mouse-hover-md")}),Ft.on("dragover",function(zt,nn){cn.current.classList.add("mouse-hover-md")}),Ft.on("drop",function(zt,nn){cn.current.classList.add("mouse-hover-md");var Kt;if(Kt=nn.dataTransfer.files,Kt.length>0){nn.preventDefault(),nn.stopPropagation();for(var Rt=function(ln){var Gt=Kt[ln],Un=Gt.name.split(".").pop();at(Gt,function(Zt){if(Zt.id){var xn,Vt,Fn;(Gt==null||((xn=Gt.type)===null||xn===void 0)?void 0:xn.indexOf("image"))>-1?Ft.replaceSelection(".concat(Zt.content_type,")")):(Gt==null||((Vt=Gt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?Ft.replaceSelection('<video width="100%" controls src="'.concat(s.a.API_SERVER,"/api/attachments/").concat(Zt.id,'"></video>')):(Gt==null||((Fn=Gt.type)===null||Fn===void 0)?void 0:Fn.indexOf("pdf"))>-1?Ft.replaceSelection('<a href="'.concat(s.a.API_SERVER,"/api/attachments/").concat(Zt.id,"?type=").concat(Gt.type,'&disposition=inline" target="_blank">').concat(Gt.name,"</a>")):ie.includes(Un)?Ft.replaceSelection('<a href="'.concat(s.a.API_SERVER,"/api/attachments/").concat(Zt.id,'?type=office&disposition=inline" target="_blank">').concat(Gt.name,"</a>")):Ft.replaceSelection("[".concat(Gt.name,"](").concat(s.a.API_SERVER,"/api/attachments/").concat(Zt.id,"?type=").concat(Zt.content_type,")"))}else(Zt==null?void 0:Zt.status)===401&&(document.location.href="/user/login")})},Wt=0;Wt<Kt.length;Wt++)Rt(Wt)}}),G(Ft),function(){Ft.off("paste",Yt)}}},[]);var Er=Object(m.useCallback)(function(){if(cn.current)try{}catch(Ft){console.log(Ft,"---- to set md editor body height")}},[fr,cn,vn]);Object(m.useEffect)(function(){function Ft(){var zt=new E.default(function(nn){var Kt=Object(L.a)(nn),Rt;try{for(Kt.s();!(Rt=Kt.n()).done;){var Wt=Rt.value;(Wt.target.offsetHeight>0||Wt.target.offsetWidth>0)&&(Er(),J.setSize("100%","100%"),J.refresh())}}catch(Lt){Kt.e(Lt)}finally{Kt.f()}});return zt.observe(_n.current.parentElement),zt}if(J){var Yt=Ft();return function(){Yt.unobserve(_n.current.parentElement)}}},[J,Er]),Object(m.useEffect)(function(){if(J){for(var Ft=[],Yt=function(){var Wt=nn[zt];Kt=Object(B.a)(Wt,2);var Lt=Kt[0],ln=Kt[1],Gt=Object(N.a)({},Lt,function(){Sr(ln)});Ft.push(Gt),J.addKeyMap(Gt)},zt=0,nn=Object.entries(ae);zt<nn.length;zt++){var Kt;Yt()}return dn.current=setInterval(function(){Rn.current&&$n()},4e3),function(){clearInterval(dn.current);var Rt=Object(L.a)(Ft),Wt;try{for(Rt.s();!(Wt=Rt.n()).done;){var Lt=Wt.value;J.removeKeyMap(Lt)}}catch(ln){Rt.e(ln)}finally{Rt.f()}}}},[J]),Object(m.useEffect)(function(){it!==vn&&hn(it)},[it]),Object(St.a)(function(){if(!gn&&Yn>0){var Ft=new Date().getTime(),Yt=window.sessionStorage.getItem(gt);Ft>=Yn+Re&&(!Yt||Yt!==ht)&&(window.sessionStorage.setItem(gt,ht),pn(!0))}},Re),Object(m.useEffect)(function(){rn(Ie)},[J,Ie]),Object(m.useEffect)(function(){J&&(We&&J.focus())},[J,We]),Object(m.useEffect)(function(){if(kt&&J){var Ft=J.getScrollerElement();function Yt(zt){var nn=zt.target;if(Ln.current){var Kt=nn.scrollTop/nn.scrollHeight;Ln.current.scrollTop=Ln.current.scrollHeight*Kt}}return Ft.addEventListener("scroll",Yt),function(){Ft.removeEventListener("scroll",Yt)}}},[J,kt]),Object(m.useEffect)(function(){if(J&&Qt){function Ft(Yt,zt){Qt(Yt,zt)}return J.on("beforeChange",Ft),function(){J.off("beforeChange",Ft)}}},[J,Qt]),Object(m.useEffect)(function(){if(J&&Pt){function Ft(){Pt(J.getValue())}return J.on("blur",Ft),function(){J.off("blur",Ft)}}},[J,Pt]),Object(m.useEffect)(function(){if(J){function Ft(Yt){var zt=Yt.getValue();Tt(zt),Kn(new Date().getTime()),Yt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),yt&&yt(zt)}return J.on("change",Ft),function(){J.off("change",Ft)}}},[J,yt]),Object(m.useEffect)(function(){J&&(dt==null?(J.setValue(""),Tt("")):dt!==J.getValue()&&(J.setValue(dt),Tt(dt),J.setCursor(J.lineCount(),0)))},[J,dt]);var Sr=Object(m.useCallback)(function(Ft){var Yt=J.getCursor(),zt=J.getSelection(),nn=zt.split(`
|
|
`);switch(Ft){case"bold":return J.replaceSelection("**"+zt+"**"),zt===""&&J.setCursor(Yt.line,Yt.ch+2),J.focus();case"italic":return J.replaceSelection("*"+zt+"*"),zt===""&&J.setCursor(Yt.line,Yt.ch+1),J.focus();case"code":return J.replaceSelection("`"+zt+"`"),zt===""&&J.setCursor(Yt.line,Yt.ch+1),J.focus();case"inline-latex":return J.replaceSelection("`$$"+zt+"$$`"),zt===""&&J.setCursor(Yt.line,Yt.ch+3),J.focus();case"latex":return J.replaceSelection("```latex\n"+zt+"\n```"),J.setCursor(Yt.line+1,zt.length+1),J.focus();case"line-break":return J.replaceSelection(`<br/>
|
|
`),J.focus();case"list-ul":return zt===""?J.replaceSelection("- "+zt):J.replaceSelection(nn.map(function(Kt){return Kt===""?"":"- ".concat(Kt)}).join(`
|
|
`)),J.focus();case"list-ol":return zt===""?J.replaceSelection("1. "+zt):J.replaceSelection(nn.map(function(Kt,Rt){return Kt===""?"":"".concat(Rt+1,". ").concat(Kt)}).join(`
|
|
`)),J.focus();case"add-null-ch":return zt===""&&J.setCursor(Yt.line,Yt.ch+1),J.replaceSelection(Ue),J.focus();case"inster-template-1":return zt===""&&J.setCursor(Yt.line,Yt.ch),J.replaceSelection(ge),J.focus();case"eraser":return J.setValue(""),J.focus();case"trigger-watch":return rn(!kt),J.focus();case"trigger-full-screen":return hn(!vn),J.focus();case Xe:fn(Xe);return;case xt:fn(xt);return;case Ct:fn(Ct);return;case bt:fn(bt);return;default:throw new Error}},[J,kt,vn]),ur=Object(m.useCallback)(function(Ft){fn("");switch(Cn){case Xe:var Yt=Ft.title,zt=Ft.link;return J.replaceSelection("[".concat(Yt,"](").concat(zt,")")),J.focus();case xt:var nn=Ft.language,Kt=Ft.content;return J.replaceSelection(["```"+nn,Kt,"```"].join(`
|
|
`)),J.focus();case Ct:var Rt=Ft.src,Wt=Ft.alt,Lt=Ft.name;return Rt.indexOf("type=image")>-1?J.replaceSelection(".concat(Rt,' "').concat(Wt||"",'" )')):Rt.indexOf("type=application/pdf")>-1?J.replaceSelection('<a href="'.concat(Rt,'&disposition=inline" target="_blank">').concat(Lt,"</a>")):J.replaceSelection('<a href="'.concat(Rt,'" target="_blank">').concat(Lt,"</a>")),J.focus();case bt:for(var ln=Ft.row,Gt=Ft.col,Un=Ft.align,Zt=`
|
|
`,xn=0;xn<ln;xn++){for(var Vt=[],Fn=[],an=0;an<Gt;an++)xn===1&&Fn.push(At[Un]),Vt.push(" ");xn===1&&(Zt+="| ".concat(Fn.join(" | "),` |
|
|
`)),Zt+="| ".concat(Vt.join(Gt===1?"":" | "),` |
|
|
`)}return J.replaceSelection(Zt+`
|
|
`),J.focus();default:throw new Error}},[J,Cn]),Dr=Object(m.useMemo)(function(){switch(Cn){case Xe:return O.a.createElement(se,{callback:ur,onCancel:nr});case xt:return O.a.createElement(he.b,{callback:ur,onCancel:nr});case Ct:return O.a.createElement(ue,{callback:ur,onCancel:nr});case bt:return O.a.createElement(mt,{callback:ur,onCancel:nr});default:return null}},[Cn]);function nr(){fn("")}Object(m.useEffect)(function(){if(tr.current){var Ft=tr.current,Yt=!1,zt=0;function nn(Wt){Yt=!0,zt=Wt.pageY}function Kt(){Yt=!1}function Rt(Wt){if(Yt){var Lt=Wt.pageY-zt;Lt<0&&(Lt=0),Lt>300&&(Lt=300);var ln=Fe+Lt+"px";er(ln)}}return Ft.addEventListener("mousedown",nn),document.addEventListener("mousemove",Rt),document.addEventListener("mouseup",Kt),function(){Ft.removeEventListener("mousedown",nn),document.removeEventListener("mousemove",Rt),document.removeEventListener("mouseup",Kt)}}},[J,tr]),Object(m.useEffect)(function(){er(Fe)},[Fe]);var kr=de(st),ir=de(fr),Rr={width:kr,height:ir},Ir=Object(m.useMemo)(function(){if(Yn){var Ft=new Date(Yn),Yt=Ft.getHours(),zt=Ft.getMinutes(),nn=Ft.getSeconds();return Yt=Yt<10?"0"+Yt:Yt,zt=zt<10?"0"+zt:zt,nn=nn<10?"0"+nn:nn,"".concat(Yt,":").concat(zt,":").concat(nn)}return 0},[Yn]);function dr(){window.sessionStorage.removeItem(gt),pn(!1),Kn(0)}function Kr(){pn(!1),Kn(0),J.setValue(window.sessionStorage.getItem(gt))}function jr(Ft,Yt){var zt=J.getValue();zt=zt.replace(Ft,Yt),Tt(zt),J==null||J.setValue(zt)}return O.a.createElement(m.Fragment,null,O.a.createElement("div",{className:"markdown-editor-wrapper",ref:cn},O.a.createElement("div",{className:"markdown-editor-container ".concat(Ot," ").concat(kt?"on-preview":""," ").concat(oe?"mini":""," ").concat(vn?"full-screen":""),style:Rr},O.a.createElement(x,{insertTemp:tt,watch:kt,fullScreen:vn,showNullButton:Dt,onActionCallback:Sr,hidetoolBar:Nn,uuid:Nt.current,setOpenPhones:function(){Rn.current=!0}}),O.a.createElement("div",{className:"markdown-editor-body"},O.a.createElement("div",{className:"codemirror-container"},O.a.createElement("textarea",{ref:_n,placeholder:Jt})),kt?O.a.createElement("div",{ref:Ln,className:"preview-container"},Ae==="stex"&&O.a.createElement(D,{value:ht}),Ae!=="stex"&&O.a.createElement(p.a,{edit:!0,value:ht,replaces:jr})):null))),pt?O.a.createElement("a",{ref:tr,className:"editor-resize"}):null,O.a.createElement(P.a,null,le[Cn]?O.a.createElement(z.a,{centered:!0,title:le[Cn],visible:!0,onCancel:nr,footer:null},Dr):null))}},PD8m:function(Ke,we){Ke.exports={name:"memoryStorage",read:q,write:z,each:L,remove:K,clearAll:I};var U={};function q(w){return U[w]}function z(w,B){U[w]=B}function L(w){for(var B in U)U.hasOwnProperty(B)&&w(U[B],B)}function K(w){delete U[w]}function I(w){U={}}},QUZ3:function(Ke,we,U){"use strict";U.r(we);var q=U("0Owb"),z=U("PpiC"),L=U("T2oS"),K=U("W9HT"),I=U("+L6B"),w=U("2/Rp"),B=U("2qtc"),N=U("kLXV"),A=U("/xke"),k=U("TeRw"),m=U("9og8"),O=U("tJVT"),R=U("k1fw"),_=U("aHsQ"),E=U("sGsY"),g=U("WmNS"),u=U.n(g),a=U("q1tI"),i=U.n(a),c=U("Fvcw"),S=U("GIiI"),v=U("Ty5D"),p=U("55Ip"),D=U("OJz4"),b=U("V0Rq"),h=U("bntm"),d=U("cDPC"),o=U("m3rI"),s=U("RCxd"),C=U("EHPI"),y=U("S+dL"),x=U.n(y),P=U("J66h"),j=U("uMZB"),Y=U.n(j),Q=U("p/48"),X=U("JPnl"),F=U("y8nQ"),$=U("Vl3Y"),re=U("5NDa"),se=U("5rEg"),he=se.a.TextArea,_e=5e3,xe=function(Ne){var it=Ne.callback,Pt=Ne.onCancel,Qt=Ne.notes;function un($e){it($e)}return i.a.createElement($.a,{className:"note-form-panel",onFinish:un,initialValues:{notes:Qt}},i.a.createElement($.a.Item,{name:"notes",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u7B14\u8BB0\u5185\u5BB9"},{max:_e,message:"\u7B14\u8BB0\u6700\u5927\u5B57\u6570\u4E3A".concat(_e)}]},i.a.createElement(he,{placeholder:"\u8BF7\u8F93\u5165\u7B14\u8BB0\u5185\u5BB9",rows:5})),i.a.createElement($.a.Item,{style:{textAlign:"right"}},i.a.createElement(w.a,{type:"ghost",onClick:Pt,style:{marginRight:10}}," \u53D6\u6D88 "),i.a.createElement(w.a,{type:"primary",htmlType:"submit"}," \u63D0\u4EA4 ")))},Ce=U("H2Ag"),Oe=U.n(Ce),De=U("DjyN"),pe=U("NUBc"),ue=U("miYZ"),Me=U("tsqr"),at=U("g9YV"),lt=U("wCAj"),et=U("+k/U"),Qe=U.n(et),je=U("ye1Q"),Ye=U("lfch"),rt=U("JB8y"),mt=U("1vsH"),ot=U("wd/R"),qe=U.n(ot),Xe=lt.a.Column,Ct=function(Ne){var it=Ne.submitResult,Pt=Ne.submitting,Qt=Ne.submitRecords,un=Ne.page,$e=Ne.onPageChange,Ot=Ne.topicId,Ht=it||{},jt=Ht.status,mn=Ht.id,Jt=Ht.input,H=Ht.output,f=Ht.expected_output,T=Ht.is_file,W=Ht.input_file_url,J=Ht.output_file_url,G=Ht.expected_output_file_url,ve=Ht.error_msg,Ve=Qt||{},ht=Ve.records,Tt=Ve.records_count;function Je(){T?navigator.clipboard.writeText(P.Base64.decode(ve)).then(function(){Me.b.success("\u590D\u5236\u9519\u8BEF\u4FE1\u606F\u6210\u529F")}):navigator.clipboard.writeText(P.Base64.decode(H)).then(function(){Me.b.success("\u590D\u5236\u9519\u8BEF\u4FE1\u606F\u6210\u529F")})}return i.a.createElement(K.a,{spinning:Pt,tip:"\u8BC4\u6D4B\u4E2D...",indicator:i.a.createElement(je.a,{style:{fontSize:24},spin:!0})},mn?i.a.createElement(i.a.Fragment,null,i.a.createElement("ul",{className:Qe.a.info},i.a.createElement("li",null,"\u6267\u884C\u7ED3\u679C\uFF1A",i.a.createElement("span",{className:jt===rt.a.OK?"c-green":"c-red"},X.a[jt])),i.a.createElement("li",{className:Qe.a.error},i.a.createElement("a",{onClick:Je},"\u590D\u5236\u9519\u8BEF\u4FE1\u606F ",i.a.createElement(Ye.a,null)," ")),i.a.createElement("li",null,i.a.createElement(p.a,{to:"/myproblems/".concat(Ot,"/record-detail/").concat(mn)},"\u663E\u793A\u8BE6\u60C5 >"," "))),jt!==rt.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,!T&&Jt,T&&i.a.createElement("a",{style:{fontSize:"16px"},onClick:function(){return Object(mt.w)(W,Jt)}},Jt)),i.a.createElement("p",{className:"c-red"},"\u5B9E\u9645\u8F93\u51FA\uFF1A"),i.a.createElement("pre",null,(jt===4||jt===5)&&P.Base64.decode(ve),jt!=4&&jt!=5&&(T?i.a.createElement("a",{style:{fontSize:"16px"},onClick:function(){return Object(mt.w)(J,H)}},H):P.Base64.decode(H))),i.a.createElement("p",{className:"c-red"},"\u9884\u671F\u8F93\u51FA\uFF1A"),i.a.createElement("pre",null,!T&&P.Base64.decode(f),T&&i.a.createElement("a",{style:{fontSize:"16px"},onClick:function(){return Object(mt.w)(G,f)}},f))):null):null,(ht==null?void 0:ht.length)>0?i.a.createElement(lt.a,{dataSource:ht,rowKey:"id",pagination:!1},i.a.createElement(Xe,{title:"\u63D0\u4EA4\u65F6\u95F4",dataIndex:"created_at",key:"created_at",render:function(kt,rn){return i.a.createElement("span",null," ",qe()(kt).format("YYYY-MM-DD HH:mm:ss"))}}),i.a.createElement(Xe,{title:"\u63D0\u4EA4\u7ED3\u679C",dataIndex:"status",key:"status",render:function(kt,rn){var An;return i.a.createElement(p.a,{className:kt===0?"c-green":"c-red",to:"/myproblems/".concat(Ot,"/record-detail/").concat(rn.id)},(An=X.a[kt])===null||An===void 0?void 0:An.replace("\u8C03\u8BD5","\u8BC4\u6D4B"))}}),i.a.createElement(Xe,{title:"\u6267\u884C\u7528\u65F6 (S)",dataIndex:"execute_time",key:"execute_time"}),i.a.createElement(Xe,{title:"\u5185\u5B58\u6D88\u8017\uFF08MB\uFF09",dataIndex:"execute_memory",key:"execute_memory"}),i.a.createElement(Xe,{title:"\u8BED\u8A00",dataIndex:"language",key:"language"}),i.a.createElement(Xe,{title:"\u64CD\u4F5C",dataIndex:"status",key:"status",render:function(kt,rn){return i.a.createElement(p.a,{className:"c-light-primary",to:"/myproblems/".concat(Ot,"/record-detail/").concat(rn.id)},"\u67E5\u770B")}})):i.a.createElement("div",{style:{height:300,width:"100%"}}),Tt>15?i.a.createElement(pe.a,{className:Qe.a.pagination,current:un,pageSize:15,total:Tt,onChange:$e}):null)},xt=U("BdwD"),bt=U("DYRE"),Et=U("zeV3"),At=U("+BJd"),St=U("mr32"),Se=U("pPuO"),Ee=U.n(Se),He=U("9Bee"),Ge={1:{name:"\u7B80\u5355",color:"#52c41a"},2:{name:"\u4E2D\u7B49",color:"#faad14"},3:{name:"\u56F0\u96BE",color:"#f5222d"}},Re=function(Ne){var it=Ne.hack,Pt=Ne.onTriggerPraise,Qt=Ne.toDiscuss,un=it.language,$e=it.difficult,Ot=it.time_limit,Ht=it.username,jt=it.user_path,mn=it.user_praise,Jt=it.comments_count,H=it.praises_count,f=it.description,T=it.pass_count,W=it.submit_count,J=Object(v.h)(),G=Ge[$e];return i.a.createElement(i.a.Fragment,null,i.a.createElement("ul",{className:Ee.a.info},i.a.createElement("li",null,"\u7F16\u7A0B\u8BED\uFF1A",i.a.createElement("b",null,un)),i.a.createElement("li",null,"\u96BE\u5EA6\uFF1A",i.a.createElement(St.a,{color:G.color},G.name)),i.a.createElement("li",null,"\u8BC4\u6D4B\u65F6\u957F\u9650\u5236\uFF1A",i.a.createElement("b",null,Ot,"\u79D2"))),i.a.createElement(He.a,{value:f,className:Ee.a.desc}),i.a.createElement("ul",{className:Ee.a["commit-info"]},i.a.createElement("li",null,i.a.createElement(Et.a,{size:4},i.a.createElement("span",null,"\u901A\u8FC7\u6B21\u6570")," ",i.a.createElement("b",null,T))),i.a.createElement("li",null,i.a.createElement(Et.a,{size:4},i.a.createElement("span",null,"\u63D0\u4EA4\u6B21\u6570")," ",i.a.createElement("b",null,W))," "),i.a.createElement("li",{style:{flex:"1 0 0"}}),J.query.type!=="exercises"&&i.a.createElement("li",null,i.a.createElement(Et.a,{size:4},i.a.createElement("i",{className:"iconfont icon-huifu1",onClick:Qt})," ",i.a.createElement("b",null,Jt))," ")))},Ue=U("dhSg"),ge=U("oBTY"),de=U("M8RZ"),ce=U("qJ4+"),te=U("ErOA");function ie(Ne,it){return Object(te.c)("/problems/".concat(Ne,"/comments.json?page=").concat(it,"&limit=10"))}function ae(Ne){return Object(te.f)("/discusses/".concat(Ne,"/plus.json"),{container_type:"Discuss",type:1})}function le(Ne,it,Pt){return Object(te.f)("/problems/".concat(Ne,"/comments/reply.json"),{comments:{content:Pt,parent_id:it}})}function Te(Ne,it){return Object(te.f)("/problems/".concat(Ne,"/comments.json"),{comments:{content:it}})}function be(Ne,it,Pt){return Object(te.f)("/problems/".concat(Ne,"/comments/").concat(it,"/hidden.json"),Pt)}function ze(Ne,it){return Object(te.b)("/problems/".concat(Ne,"/comments/").concat(it))}var dt=U("U7T7"),yt=U("AMnG");function ct(Ne){var it=Ne.author;return i.a.createElement("a",{href:"/users/".concat(it.login),target:"_blank"},i.a.createElement("img",{alt:"\u7528\u6237\u5934\u50CF",height:"50",style:{borderRadius:"50%"},src:"".concat(o.a.IMG_SERVER,"/images/").concat(it.image_url),width:"50"}))}function st(Ne){var it=Ne.data,Pt=Ne.index,Qt=Ne.parentDiscussIndex,un=Ne.user,$e=Ne.onSetActionType,Ot=it.author,Ht=it.can_delete,jt=it.content,mn=it.id,Jt=it.time;function H(){$e({id:mn,index:Pt,type:"delete-discuss",parentDiscussIndex:Qt,message:"\u786E\u5B9A\u8981\u5220\u9664\u8BE5\u6761\u56DE\u590D\u5417"})}var f=un.admin||Ht||Ot.user_id===un.user_id;return i.a.createElement("div",{className:"discuss-item-container second-discuss "},i.a.createElement(ct,{author:Ot}),i.a.createElement("section",null,i.a.createElement("div",{className:"discuss-info"},i.a.createElement("a",{href:"/users/".concat(Ot.login),target:"_blank"},Ot.name),i.a.createElement("span",{className:"grey"},Jt),i.a.createElement("div",{className:"btn-group",style:{marginBottom:0}},f?i.a.createElement("a",{onClick:H,title:"\u5220\u9664"},i.a.createElement("i",{className:"iconfont icon-shanchu"})):null)),i.a.createElement(He.a,{className:"discuss-content",value:jt})))}var Be=function(Ne){var it=Ne.user,Pt=Ne.data,Qt=Ne.index,un=Ne.onPlusDiscuss,$e=Ne.onSetActionType,Ot=Ne.activeDiscussIndex,Ht=Ne.onReplyDiscuss,jt=Ne.onSetActiveDiscussIndex,mn=Pt.content,Jt=Pt.children,H=Pt.hidden,f=Pt.id,T=Pt.praise_count,W=Pt.time,J=Pt.user_praise,G=Pt.can_delete,ve=Pt.author;function Ve(){jt(f)}function ht(){un(f,!J,Qt)}function Tt(){$e({id:f,index:Qt,type:"delete-discuss",message:"\u786E\u5B9A\u8981\u5220\u9664\u8BE5\u6761\u56DE\u590D\u5417"})}function Je(){$e({id:f,index:Qt,params:{hidden:H?"0":"1"},type:"hidden-discuss",message:H?"\u786E\u5B9A\u8981\u53D6\u6D88\u9690\u85CF\u8BE5\u6761\u56DE\u590D\u5417":"\u786E\u5B9A\u8981\u9690\u85CF\u8BE5\u6761\u56DE\u590D\u5417"})}var It=it.admin||it.user_id===ve.user_id;return i.a.createElement("div",{className:"discuss-item-container",key:f},i.a.createElement(ct,{author:ve}),i.a.createElement("section",null,i.a.createElement("div",{className:"discuss-info"},i.a.createElement("a",{href:"/users/".concat(ve.login),target:"_blank"}," ",ve.name," "),i.a.createElement("span",{className:"grey"},W)),i.a.createElement(He.a,{className:"discuss-content",value:mn}),Jt&&Jt.length>0?i.a.createElement("div",{className:"reply-discuss-container"},Jt.map(function(kt,rn){return i.a.createElement(st,{key:kt.id,data:kt,index:rn,user:it,onSetActionType:$e,parentDiscussIndex:Qt})})):null,i.a.createElement("div",{className:"btn-group"},It?i.a.createElement("a",{onClick:Je,title:H?"\u53D6\u6D88\u9690\u85CF":"\u9690\u85CF\u8BC4\u8BBA"},i.a.createElement("i",{className:H?"iconfont icon-yincangbiyan":"fa fa-eye"})):null,G&&(!Jt||Jt.length==0)?i.a.createElement("a",{onClick:Tt,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:ht,className:J?"c-orange":""},i.a.createElement("i",{className:J?"iconfont icon-dianzan mr3":"iconfont icon-dianzan-xian mr3 "}),i.a.createElement("span",null,T||""))),i.a.createElement(yt.a,{id:f,activeDiscussIndex:Ot,onReplyDiscuss:Ht})))},Fe=U("kaH+"),Pe=U("uD2n"),oe=U.n(Pe),fe=U("Ot1p"),We=function(Ne){var it=Ne.user_praise,Pt=Ne.praise_count,Qt=Ne.praisePlus,un=Ne.onCreateDiscuss,$e=Ne.discuss_count,Ot=Object(a.useState)(!1),Ht=Object(O.a)(Ot,2),jt=Ht[0],mn=Ht[1],Jt=Object(a.useState)(""),H=Object(O.a)(Jt,2),f=H[0],T=H[1];function W(ht){T(ht)}function J(){mn(!0)}function G(){mn(!1)}function ve(){return Ve.apply(this,arguments)}function Ve(){return Ve=Object(m.a)(u.a.mark(function ht(){return u.a.wrap(function(Je){for(;;)switch(Je.prev=Je.next){case 0:un(f),T(""),mn(!1);case 3:case"end":return Je.stop()}},ht)})),Ve.apply(this,arguments)}return i.a.createElement("div",{className:"".concat(oe.a["dis-input-editor-container"]," ").concat(jt?oe.a.active:""," ")},i.a.createElement("div",{className:jt?"hide ".concat(oe.a["text-area"]):oe.a["text-area"]},i.a.createElement("input",{placeholder:"\u8BF4\u70B9\u4EC0\u4E48",onClick:J}),i.a.createElement("a",null," ",i.a.createElement("i",{className:"iconfont icon-huifu1"})," \xA0 \xA0",$e," "),i.a.createElement("a",{className:"c-light-black",onClick:Qt,title:it?"\u53D6\u6D88\u70B9\u8D5E":"\u70B9\u8D5E"},i.a.createElement("i",{className:"mr3 ".concat(it?"iconfont icon-dianzan c-orange":"iconfont icon-dianzan-xian"," ")}),Pt?i.a.createElement("span",null,Pt):"")),jt?i.a.createElement("div",{className:oe.a["input-mask"],onClick:G}):null,i.a.createElement("div",{className:jt?oe.a["md-container"]:"".concat(oe.a["md-container"]," hide")},i.a.createElement(fe.a,{id:"discuss-input-editor",miniToolbar:!0,watch:!1,noStorage:!0,defaultValue:f,height:240,onChange:W}),i.a.createElement("div",{className:oe.a["tip-container"],onClick:G},i.a.createElement("a",{className:oe.a["btn-send"],onClick:ve}," \u53D1\u9001 "))))},Ie={loading:!1,page:1,data:[],count:0,actionType:null,activeDiscussIndex:null},tt;(function(Ne){Ne[Ne.GET_DISCUSSES=0]="GET_DISCUSSES",Ne[Ne.TOP_OR_DOWN_DISCUSS=1]="TOP_OR_DOWN_DISCUSS",Ne[Ne.ACTIVE_DISCUSS_INDEX=2]="ACTIVE_DISCUSS_INDEX",Ne[Ne.PLUS_DISCUSS=3]="PLUS_DISCUSS",Ne[Ne.SET_ACTION_TYPE=4]="SET_ACTION_TYPE",Ne[Ne.SET_PAGE=5]="SET_PAGE",Ne[Ne.SHOW_DISCUSSES_LOADING=6]="SHOW_DISCUSSES_LOADING"})(tt||(tt={}));function ft(Ne,it){switch(it.type){case tt.SHOW_DISCUSSES_LOADING:return Object(R.a)(Object(R.a)({},Ne),{},{loading:!0});case tt.GET_DISCUSSES:return Object(R.a)(Object(R.a)({},Ne),it.payload);case tt.TOP_OR_DOWN_DISCUSS:return Object(R.a)(Object(R.a)({},Ne),it.payload);case tt.SET_ACTION_TYPE:return Object(R.a)(Object(R.a)({},Ne),it.payload);case tt.PLUS_DISCUSS:return Object(R.a)(Object(R.a)({},Ne),it.payload);case tt.SET_PAGE:return Object(R.a)(Object(R.a)({},Ne),{},{page:it.payload});case tt.ACTIVE_DISCUSS_INDEX:return Object(R.a)(Object(R.a)({},Ne),it.payload);default:throw new Error}}var Ae=function(Ne){var it=Ne.user,Pt=Ne.identifier,Qt=Ne.hack,un=Ne.onTriggerPraise,$e=Object(a.useReducer)(ft,Ie),Ot=Object(O.a)($e,2),Ht=Ot[0],jt=Ot[1],mn=Ht.loading,Jt=Ht.page,H=Ht.data,f=Ht.count,T=Ht.actionType,W=Ht.activeDiscussIndex,J=Object(a.useCallback)(Object(m.a)(u.a.mark(function hn(){var wn,yn,Cn;return u.a.wrap(function(bn){for(;;)switch(bn.prev=bn.next){case 0:return jt({type:tt.SHOW_DISCUSSES_LOADING}),bn.next=3,ie(Pt,Jt);case 3:wn=bn.sent,yn=wn.comments,Cn=wn.disscuss_count,jt({type:tt.GET_DISCUSSES,payload:{data:yn,count:Cn,loading:!1}});case 6:case"end":return bn.stop()}},hn)})),[Jt,Pt]);Object(a.useEffect)(function(){J()},[Pt,Jt]);function G(hn){jt({type:tt.SET_PAGE,page:hn})}function ve(hn){jt({type:tt.SET_ACTION_TYPE,payload:{actionType:hn}})}function Ve(hn){W===hn?jt({type:tt.ACTIVE_DISCUSS_INDEX,payload:{activeDiscussIndex:null}}):jt({type:tt.ACTIVE_DISCUSS_INDEX,payload:{activeDiscussIndex:hn}})}function ht(hn,wn,yn){return Tt.apply(this,arguments)}function Tt(){return Tt=Object(m.a)(u.a.mark(function hn(wn,yn,Cn){var fn;return u.a.wrap(function(En){for(;;)switch(En.prev=En.next){case 0:return En.prev=0,En.next=3,ae(wn);case 3:fn=En.sent,H[Cn].user_praise=yn,H[Cn].praise_count=fn.praise_count,jt({type:tt.PLUS_DISCUSS,payload:{data:Object(ge.a)(H)}}),En.next=12;break;case 9:En.prev=9,En.t0=En.catch(0),console.log(En.t0);case 12:case"end":return En.stop()}},hn,null,[[0,9]])})),Tt.apply(this,arguments)}function Je(){return It.apply(this,arguments)}function It(){return It=Object(m.a)(u.a.mark(function hn(){var wn,yn,Cn,fn,bn,En,Yn,Kn;return u.a.wrap(function(Dn){for(;;)switch(Dn.prev=Dn.next){case 0:if(wn=T.id,yn=T.params,Cn=T.type,fn=T.index,bn=T.parentDiscussIndex,!(Cn==="hidden-discuss")){Dn.next=6;break}return Dn.next=4,be(Pt,wn,yn);case 4:bn?H[bn].children[fn].hidden=yn.hidden==1:H[fn].hidden=yn.hidden==1,jt({type:tt.SET_ACTION_TYPE,payload:{actionType:null,data:Object(ge.a)(H)}});case 6:if(!(Cn==="delete-discuss")){Dn.next=31;break}return Dn.next=9,ze(Pt,wn);case 9:if(!(bn||bn===0)){Dn.next=22;break}En=H[bn].children,Yn=En.length-1;case 12:if(!(Yn>=0)){Dn.next=19;break}if(!(En[Yn].id===wn)){Dn.next=16;break}return En.splice(Yn,1),Dn.abrupt("break",19);case 16:Yn--,Dn.next=12;break;case 19:H[bn].children=En,Dn.next=30;break;case 22:Kn=H.length-1;case 23:if(!(Kn>=0)){Dn.next=30;break}if(!(H[Kn].id===wn)){Dn.next=27;break}return H.splice(Kn,1),Dn.abrupt("break",30);case 27:Kn--,Dn.next=23;break;case 30:jt({type:tt.SET_ACTION_TYPE,payload:{actionType:null,data:Object(ge.a)(H)}});case 31:case"end":return Dn.stop()}},hn)})),It.apply(this,arguments)}function kt(){jt({type:tt.SET_ACTION_TYPE,payload:{actionType:null}})}function rn(hn,wn){return An.apply(this,arguments)}function An(){return An=Object(m.a)(u.a.mark(function hn(wn,yn){return u.a.wrap(function(fn){for(;;)switch(fn.prev=fn.next){case 0:return fn.prev=0,fn.next=3,le(Pt,wn,yn);case 3:J(),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()}},hn,null,[[0,6]])})),An.apply(this,arguments)}function Vn(hn){return vn.apply(this,arguments)}function vn(){return vn=Object(m.a)(u.a.mark(function hn(wn){return u.a.wrap(function(Cn){for(;;)switch(Cn.prev=Cn.next){case 0:return jt({type:tt.SHOW_DISCUSSES_LOADING}),Cn.next=3,Te(Pt,wn);case 3:J();case 4:case"end":return Cn.stop()}},hn)})),vn.apply(this,arguments)}return i.a.createElement(i.a.Fragment,null,i.a.createElement("div",{className:"discuss-panel"},H.length===0?i.a.createElement(xt.a,null):H.map(function(hn,wn){return i.a.createElement(Be,{onReplyDiscuss:rn,onPlusDiscuss:ht,onSetActiveDiscussIndex:Ve,onSetActionType:ve,data:hn,index:wn,user:it,activeDiscussIndex:W})}),f>10?i.a.createElement("div",{className:"pagination-container"},i.a.createElement(pe.a,{showQuickJumper:!0,onChange:G,current:Jt,total:f})):null),i.a.createElement(We,{user_praise:Qt.user_praise,praise_count:Qt.praises_count,praisePlus:un,discuss_count:Qt.comments_count,onCreateDiscuss:Vn}),i.a.createElement(de.a,null,i.a.createElement(N.a,{centered:!0,title:"\u63D0\u793A",visible:!!T,onOk:Je,onCancel:kt},i.a.createElement("p",null,T?T.message:"")),i.a.createElement(Fe.a,null)))},nt=function(Ne){var it=Ne.hack,Pt=Ne.onTriggerPraise,Qt=Ne.topicId,un=Ne.page,$e=Ne.onPageChange,Ot=Ne.user,Ht=Ne.submitRecords,jt=Ne.submitting,mn=Ne.submitResult,Jt=Object(a.useState)("0"),H=Object(O.a)(Jt,2),f=H[0],T=H[1],W=Object(v.h)();function J(ve){var Ve=ve.target.id;T(Ve)}Object(a.useEffect)(function(){var ve=Ue.a.subscribe("to-commit-info",function(){T("1")});return ve},[]);function G(){T("2")}return console.log(Ht,"submitRecords"),i.a.createElement("div",{className:Oe.a["left-panel"]},i.a.createElement("ul",{className:"".concat(Oe.a["s-navs"],' "bg-white"')},i.a.createElement("li",null,i.a.createElement("a",{className:f==="0"?Oe.a.active:"",id:"0",onClick:J},"\u4EFB\u52A1\u63CF\u8FF0")),i.a.createElement("li",null,i.a.createElement("a",{className:f==="1"?Oe.a.active:"",id:"1",onClick:J},"\u63D0\u4EA4\u8BB0\u5F55")),W.query.type!=="exercises"&&i.a.createElement("li",null,i.a.createElement("a",{className:f==="2"?Oe.a.active:"",id:"2",onClick:J},"\u8BC4\u8BBA"))),i.a.createElement("div",{className:"".concat(Oe.a["tab-panel-body"]," ").concat(f==="0"?"":"hide")},i.a.createElement(Re,{hack:it,onTriggerPraise:Pt,toDiscuss:G})),i.a.createElement("div",{className:"".concat(Oe.a["tab-panel-body"]," ").concat(f==="1"?"":"hide")},!!(Ht!=null&&Ht.records_count)||jt?i.a.createElement(Ct,{page:un,onPageChange:$e,topicId:Qt,submitting:jt,submitRecords:Ht,submitResult:mn}):i.a.createElement(xt.a,null)),i.a.createElement("div",{className:"".concat(Oe.a["tab-panel-body"]," ").concat(f==="2"?"":"hide"),style:{padding:0}},i.a.createElement(Ae,{user:Ot,identifier:it.identifier,hack:it,onTriggerPraise:Pt})))},gt=E.a.Countdown,Bt={Java:"java",C:"c",Python:"py","C++":"c"},pt;(function(Ne){Ne[Ne.SET_LOADING=0]="SET_LOADING",Ne[Ne.GET_DATA=1]="GET_DATA",Ne[Ne.GET_SUBMIT_RECORDS=2]="GET_SUBMIT_RECORDS",Ne[Ne.SET_DATA=3]="SET_DATA",Ne[Ne.SET_DEBUGING=4]="SET_DEBUGING",Ne[Ne.SET_SUBMITING=5]="SET_SUBMITING",Ne[Ne.SET_EXECUTE_MESSAGE=6]="SET_EXECUTE_MESSAGE",Ne[Ne.SET_EXECUTE_RESULT=7]="SET_EXECUTE_RESULT",Ne[Ne.SET_SUBMIT_RESULT=8]="SET_SUBMIT_RESULT",Ne[Ne.SET_SHOW_NOTE=9]="SET_SHOW_NOTE",Ne[Ne.SET_PAGE=10]="SET_PAGE"})(pt||(pt={}));function sn(){return new Date().getTime()}var gn={loading:!0,data:void 0,showNote:!1,debugResult:void 0,submitResult:void 0,debuging:!1,submitting:!1,submitRecords:void 0,submitRecordPage:1,executingMessage:""};function en(Ne,it){switch(it.type){case pt.GET_DATA:return Object(R.a)(Object(R.a)({},Ne),it.payload);case pt.SET_DATA:return Object(R.a)(Object(R.a)({},Ne),{},{data:it.payload});case pt.SET_LOADING:return Object(R.a)(Object(R.a)({},Ne),{},{loading:it.payload});case pt.SET_SHOW_NOTE:return Object(R.a)(Object(R.a)({},Ne),{},{showNote:it.payload});case pt.SET_DEBUGING:return Object(R.a)(Object(R.a)({},Ne),{},{debuging:it.payload});case pt.SET_SUBMITING:return Object(R.a)(Object(R.a)({},Ne),{},{submitting:it.payload});case pt.GET_SUBMIT_RECORDS:return Object(R.a)(Object(R.a)({},Ne),{},{submitRecords:it.payload});case pt.SET_PAGE:return Object(R.a)(Object(R.a)({},Ne),{},{submitRecordPage:it.payload});case pt.SET_EXECUTE_MESSAGE:return Object(R.a)(Object(R.a)({},Ne),{},{executingMessage:it.payload});case pt.SET_EXECUTE_RESULT:return Object(R.a)(Object(R.a)({},Ne),it.payload);case pt.SET_SUBMIT_RESULT:return Object(R.a)(Object(R.a)({},Ne),it.payload);default:throw new Error}}var Dt=we.default=function(Ne){var it,Pt,Qt,un=Ne.children,$e=Object(a.useReducer)(en,gn),Ot=Object(O.a)($e,2),Ht=Ot[0],jt=Ot[1],mn=Object(v.i)(),Jt=mn.id,H=Object(v.g)(),f=Object(v.h)(),T=Ht.loading,W=Ht.data,J=Ht.debugResult,G=Ht.submitResult,ve=Ht.submitRecords,Ve=Ht.submitRecordPage,ht=Ht.showNote,Tt=Ht.debuging,Je=Ht.submitting,It=Ht.executingMessage,kt=Object(a.useState)("#FFF"),rn=Object(O.a)(kt,2),An=rn[0],Vn=rn[1],vn=Object(a.useState)(null),hn=Object(O.a)(vn,2),wn=hn[0],yn=hn[1],Cn=Object(a.useState)({}),fn=Object(O.a)(Cn,2),bn=fn[0],En=fn[1],Yn=Object(a.useState)(!0),Kn=Object(O.a)(Yn,2),Ar=Kn[0],Dn=Kn[1],fr=Object(a.useState)(null),er=Object(O.a)(fr,2),lr=er[0],_r=er[1],br=Object(a.useRef)(),pn=W==null?void 0:W.user,Nt=W==null?void 0:W.hack;Object(a.useEffect)(function(){function Kt(){return Rt.apply(this,arguments)}function Rt(){return Rt=Object(m.a)(u.a.mark(function Wt(){var Lt,ln,Gt,Un,Zt,xn,Vt,Fn,an,qt,tn,kn;return u.a.wrap(function(Mn){for(;;)switch(Mn.prev=Mn.next){case 0:return Dn(!0),Mn.next=3,Object(D.d)(Jt);case 3:if(Lt=Mn.sent,setTimeout(function(){Dn(!1)},800),Lt.status===401?document.location.href="/user/login":(Lt.hack.code=P.Base64.decode(Lt.hack.code),jt({type:pt.GET_DATA,payload:{loading:!1,data:Lt}})),!(f.query.type==="exercises")){Mn.next=19;break}if(!(f.query.coursesId=="coursesId")){Mn.next=13;break}return Mn.next=10,Object(b.Y)({categoryId:f.query.exercisesId,login:f.query.login});case 10:xn=Mn.sent,Mn.next=16;break;case 13:return Mn.next=15,Object(b.y)({categoryId:f.query.exercisesId,login:f.query.login});case 15:xn=Mn.sent;case 16:En(Object(R.a)({},xn)),_r((ln=xn.exercise)===null||ln===void 0?void 0:ln.left_time),(Gt=xn)!==null&&Gt!==void 0&&Gt.left_banner_id&&(Un=xn)!==null&&Un!==void 0&&(Zt=Un.exercise)!==null&&Zt!==void 0&&Zt.left_time&&(yn(Date.now()+((Vt=xn)===null||Vt===void 0||((Fn=Vt.exercise)===null||Fn===void 0)?void 0:Fn.left_time)*1e3),setTimeout(function(){Vn("red")},(((an=xn)===null||an===void 0||((qt=an.exercise)===null||qt===void 0)?void 0:qt.left_time)-300>0?((tn=xn)===null||tn===void 0||((kn=tn.exercise)===null||kn===void 0)?void 0:kn.left_time)-300:0)*1e3));case 19:case"end":return Mn.stop()}},Wt)})),Rt.apply(this,arguments)}Jt&&Kt()},[Jt]),Object(a.useEffect)(function(){return lr>60&&bn&&(br.current=setInterval(function(){var Kt,Rt;if(lr--,lr===60&&clearInterval(br.current),localStorage.getItem("ismain")==="2")return;bn==null||((Kt=bn.exercise)===null||Kt===void 0||((Rt=Kt.exercise_events)===null||Rt===void 0))||Rt.map(function(Wt,Lt){parseInt(Wt==null?void 0:Wt.reminder_time)*60===lr&&k.a.open({top:76,message:"\u6E29\u99A8\u63D0\u793A",description:i.a.createElement("span",null,Wt==null?void 0:Wt.reminder_content),duration:60})})},1e3)),function(){k.a.destroy(),clearInterval(br.current)}},[lr,bn]),Object(a.useEffect)(function(){return dn(),f.query.type==="exercises"&&(document.addEventListener(Object(h.c)(),Rn),window.focus(),window.onblur=function(){Object(h.a)()&&Object(h.b)()}),function(){document.removeEventListener(Object(h.c)(),Rn)}},[Jt,Ve]);var Rn=function(){window.parent.postMessage("backExercise","*")};function dn(){return _n.apply(this,arguments)}function _n(){return _n=Object(m.a)(u.a.mark(function Kt(){var Rt;return u.a.wrap(function(Lt){for(;;)switch(Lt.prev=Lt.next){case 0:return Lt.prev=0,Lt.next=3,Object(D.f)(Jt,{limit:15,page:Ve});case 3:Rt=Lt.sent,jt({type:pt.GET_SUBMIT_RECORDS,payload:Rt}),Lt.next=10;break;case 7:Lt.prev=7,Lt.t0=Lt.catch(0),console.log(Lt.t0);case 10:case"end":return Lt.stop()}},Kt,null,[[0,7]])})),_n.apply(this,arguments)}function cn(Kt){jt({type:pt.SET_PAGE,payload:Kt})}function tr(){return Ln.apply(this,arguments)}function Ln(){return Ln=Object(m.a)(u.a.mark(function Kt(){var Rt;return u.a.wrap(function(Lt){for(;;)switch(Lt.prev=Lt.next){case 0:return Lt.next=2,Object(D.k)(Jt,{code:P.Base64.encode(Nt.code)});case 2:return Rt=Lt.sent,Lt.abrupt("return",Rt);case 4:case"end":return Lt.stop()}},Kt)})),Ln.apply(this,arguments)}function $n(){return Er.apply(this,arguments)}function Er(){return Er=Object(m.a)(u.a.mark(function Kt(){var Rt,Wt,Lt,ln,Gt,Un,Zt;return u.a.wrap(function(Vt){for(;;)switch(Vt.prev=Vt.next){case 0:if(!Je){Vt.next=2;break}return Vt.abrupt("return");case 2:return jt({type:pt.SET_SUBMITING,payload:!0}),Vt.prev=3,Ue.a.publish("to-commit-info"),Vt.next=7,tr();case 7:if(Rt=Vt.sent,console.log(Rt,1),!(Rt.status===0)){Vt.next=23;break}return Zt=function(){return Zt=Object(m.a)(u.a.mark(function an(){var qt,tn,kn,ar,Mn,Or;return u.a.wrap(function(Wn){for(;;)switch(Wn.prev=Wn.next){case 0:return Wn.next=2,Object(D.c)(Jt,"submit");case 2:if(qt=Wn.sent,tn=qt.status,kn=qt.data,ar=sn(),Mn=ar-Gt>(ln+3)*1e3,tn!==0&&!Mn&&setTimeout(Un,1e3),!Mn){Wn.next=12;break}return N.a.error({centered:!0,okText:"\u77E5\u9053\u5566",content:"\u8BC4\u6D4B\u4EE3\u7801\u8D85\u65F6"}),jt({type:pt.SET_SUBMITING,payload:!1}),Wn.abrupt("return");case 12:if(!(tn===0)){Wn.next=18;break}return kn.status===2&&N.a.error({centered:!0,okText:"\u77E5\u9053\u5566",content:"\u8BC4\u6D4B\u4EE3\u7801\u8D85\u65F6"}),Wn.next=16,Object(D.f)(Jt,{limit:15,page:Ve});case 16:Or=Wn.sent,jt({type:pt.SET_SUBMIT_RESULT,payload:Object(R.a)(Object(R.a)({},Ht),{},{submitResult:kn,submitting:!1,submitRecords:Or})});case 18:case"end":return Wn.stop()}},an)})),Zt.apply(this,arguments)},Un=function(){return Zt.apply(this,arguments)},Wt={},f.query.type==="exercises"&&(Wt.extras={exercise_id:f.query.exercisesId,question_id:f.query.questionId}),Vt.next=16,Object(D.h)(Jt,Wt);case 16:if(Lt=Vt.sent,!(Lt.status===-1)){Vt.next=20;break}return window.parent.location.href="/classrooms/".concat(f.query.coursesId,"/exercise/").concat(f.query.exercisesId,"/detail"),Vt.abrupt("return");case 20:ln=Nt.time_limit,Gt=sn(),Un();case 23:Vt.next=29;break;case 25:Vt.prev=25,Vt.t0=Vt.catch(3),console.log(Vt.t0),jt({type:pt.SET_SUBMITING,payload:!1});case 29:case"end":return Vt.stop()}},Kt,null,[[3,25]])})),Er.apply(this,arguments)}function Sr(){return ur.apply(this,arguments)}function ur(){return ur=Object(m.a)(u.a.mark(function Kt(){var Rt,Wt,Lt,ln,Gt,Un,Zt;return u.a.wrap(function(Vt){for(;;)switch(Vt.prev=Vt.next){case 0:return Ht.debuging=!0,jt({type:pt.SET_DEBUGING,payload:!0}),Vt.prev=2,Vt.next=5,tr();case 5:if(Rt=Vt.sent,!(Rt.status===0)){Vt.next=22;break}return Zt=function(){return Zt=Object(m.a)(u.a.mark(function an(){var qt,tn,kn,ar,Mn,Or;return u.a.wrap(function(Wn){for(;;)switch(Wn.prev=Wn.next){case 0:return Wn.next=2,Object(D.c)(Jt,"debug");case 2:if(qt=Wn.sent,tn=qt.status,kn=qt.message,ar=qt.data,Mn=sn(),Or=Mn-Gt>(Wt+3)*1e3,tn!==0&&!Or&&(jt({type:pt.SET_EXECUTE_MESSAGE,payload:kn}),setTimeout(Un,1e3)),!Or){Wn.next=13;break}return N.a.error({centered:!0,okText:"\u77E5\u9053\u5566",content:"\u8C03\u8BD5\u4EE3\u7801\u8D85\u65F6"}),jt({type:pt.SET_DEBUGING,payload:!1}),Wn.abrupt("return");case 13:tn===0&&(jt({type:pt.SET_DEBUGING,payload:!1}),ar.status===2&&N.a.error({centered:!0,okText:"\u77E5\u9053\u5566",content:"\u8C03\u8BD5\u4EE3\u7801\u8D85\u65F6"}),ar.status===2&&N.a.error({centered:!0,okText:"\u77E5\u9053\u5566",content:"\u8C03\u8BD5\u4EE3\u7801\u8D85\u65F6"}),jt({type:pt.SET_EXECUTE_RESULT,payload:Object(R.a)(Object(R.a)({},Ht),{},{debugResult:ar,debuging:!1})}));case 14:case"end":return Wn.stop()}},an)})),Zt.apply(this,arguments)},Un=function(){return Zt.apply(this,arguments)},Wt=Nt.time_limit,Lt={input:encodeURIComponent(W.test_case.input)},f.query.type==="exercises"&&(Lt.exercise_id=f.query.exercisesId),Vt.next=14,Object(D.b)(Jt,Lt);case 14:if(ln=Vt.sent,!(ln.status===-1)){Vt.next=18;break}return window.parent.location.href="/classrooms/".concat(f.query.coursesId,"/exercise/").concat(f.query.exercisesId,"/detail"),Vt.abrupt("return");case 18:Gt=sn(),Un(),Vt.next=23;break;case 22:jt({type:pt.SET_DEBUGING,payload:!1});case 23:Vt.next=28;break;case 25:Vt.prev=25,Vt.t0=Vt.catch(2),console.log(Vt.t0);case 28:return Vt.prev=28,Vt.finish(28);case 30:case"end":return Vt.stop()}},Kt,null,[[2,25,28,30]])})),ur.apply(this,arguments)}function Dr(Kt){jt({type:pt.SET_DATA,payload:Object(R.a)(Object(R.a)({},W),{},{hack:Object(R.a)(Object(R.a)({},Nt),{},{code:Kt})})})}function nr(Kt){var Rt=Kt.target.value;jt({type:pt.SET_DATA,payload:Object(R.a)(Object(R.a)({},W),{},{test_case:{input:Rt}})})}function kr(){return ir.apply(this,arguments)}function ir(){return ir=Object(m.a)(u.a.mark(function Kt(){var Rt;return u.a.wrap(function(Lt){for(;;)switch(Lt.prev=Lt.next){case 0:return Lt.prev=0,Lt.next=3,Object(D.g)(Jt);case 3:Rt=Lt.sent,Rt.status===401?H.replace("/login",{from:f.pathname}):Dr(P.Base64.decode(Rt.code)),Lt.next=10;break;case 7:Lt.prev=7,Lt.t0=Lt.catch(0),console.log(Lt.t0);case 10:case"end":return Lt.stop()}},Kt,null,[[0,7]])})),ir.apply(this,arguments)}function Rr(){N.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(m.a)(u.a.mark(function Rt(){var Wt;return u.a.wrap(function(ln){for(;;)switch(ln.prev=ln.next){case 0:return ln.next=2,Object(D.i)(Jt);case 2:Wt=ln.sent,Wt.status===401?H.replace("/login",{from:f.pathname}):Dr(P.Base64.decode(Wt.code));case 4:case"end":return ln.stop()}},Rt)}))()}})}function Ir(){jt({type:pt.SET_SHOW_NOTE,payload:!0})}function dr(){jt({type:pt.SET_SHOW_NOTE,payload:!1})}function Kr(Kt){return jr.apply(this,arguments)}function jr(){return jr=Object(m.a)(u.a.mark(function Kt(Rt){return u.a.wrap(function(Lt){for(;;)switch(Lt.prev=Lt.next){case 0:return Lt.next=2,Object(D.a)(Jt,Rt);case 2:jt({type:pt.GET_DATA,payload:{showNote:!1,data:Object(R.a)(Object(R.a)({},W),{},{hack:Object(R.a)(Object(R.a)({},Nt),{},{notes:Rt.notes})})}});case 3:case"end":return Lt.stop()}},Kt)})),jr.apply(this,arguments)}var Ft={input:W==null||((it=W.test_case)===null||it===void 0)?void 0:it.input,language:Nt==null?void 0:Nt.language,code:Nt==null?void 0:Nt.code,title:"main."+Bt[Nt==null?void 0:Nt.language],modify_code:Nt==null?void 0:Nt.modify_code,notes:Nt==null?void 0:Nt.notes,debugResult:J,debuging:Tt,submitting:Je,executingMessage:It,onCancelNote:dr,onAddNote:Kr,showNote:ht,onShowNote:Ir,onSubmitCode:$n,onChangeCode:Dr,onChangeInput:nr,onDebugCode:Sr,onResetCode:kr,onSyncCode:Rr,onUpdateCode:tr};function Yt(){return zt.apply(this,arguments)}function zt(){return zt=Object(m.a)(u.a.mark(function Kt(){var Rt,Wt,Lt;return u.a.wrap(function(Gt){for(;;)switch(Gt.prev=Gt.next){case 0:return Gt.next=2,Object(D.j)(Nt.id,{container_type:"Hack",type:1});case 2:Rt=Gt.sent,Wt=Rt.praise_count,Lt=Object(R.a)(Object(R.a)({},W),{},{hack:Object(R.a)(Object(R.a)({},Nt),{},{praises_count:Wt,user_praise:!Nt.user_praise})}),jt({type:pt.SET_DATA,payload:Lt});case 6:case"end":return Gt.stop()}},Kt)})),zt.apply(this,arguments)}var nn={topicId:Jt,submitResult:G,submitRecords:ve,submitting:Je,page:Ve,onPageChange:cn,hack:Nt,user:W==null?void 0:W.user,onTriggerPraise:Yt};return i.a.createElement(i.a.Fragment,null,i.a.createElement(K.a,{spinning:T,delay:500},W?i.a.createElement(i.a.Fragment,null,i.a.createElement("header",{className:Y.a.header},f.query.type!=="exercises"&&i.a.createElement("div",null,i.a.createElement("img",{src:"".concat(o.a.IMG_SERVER,"/images/").concat(pn.image_url),alt:"user",width:30}),i.a.createElement("span",null,pn.name)),i.a.createElement("h2",null," ",Nt.name," "),pn.hack_manager?i.a.createElement(p.a,{className:Y.a.btn_back,to:"/problems/".concat(Nt.identifier,"/edit"),style:{marginRight:10}}," ",i.a.createElement(c.a,null)," \u7F16\u8F91"):null,(bn==null||((Pt=bn.exercise)===null||Pt===void 0)?void 0:Pt.left_time)&&i.a.createElement(i.a.Fragment,null,i.a.createElement("span",{style:{color:An},className:"iconfont icon-kaoshishichang mr5"}),i.a.createElement("span",{className:"c-white mr20"},i.a.createElement(gt,{valueStyle:{color:An,fontSize:16,fontWeight:"normal"},title:i.a.createElement("span",{style:{color:An,fontSize:16}},"\u5269\u4F59\u65F6\u95F4\uFF1A"),value:wn,onFinish:Object(m.a)(u.a.mark(function Kt(){var Rt,Wt;return u.a.wrap(function(ln){for(;;)switch(ln.prev=ln.next){case 0:return ln.next=2,Object(b.Z)({categoryId:f.query.exercisesId,commit_method:2});case 2:Rt=ln.sent,(Rt==null?void 0:Rt.status)===0&&(tr(),N.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 Gt=Object(m.a)(u.a.mark(function Zt(){return u.a.wrap(function(Vt){for(;;)switch(Vt.prev=Vt.next){case 0:window.parent.location.href="/classrooms/".concat(f.query.coursesId,"/exercise/").concat(f.query.exercisesId,"/detail");case 1:case"end":return Vt.stop()}},Zt)}));function Un(){return Gt.apply(this,arguments)}return Un}()})),(Rt==null?void 0:Rt.status)===-3&&(Wt=parseInt(Rt==null?void 0:Rt.message),yn(Date.now()+Wt*1e3));case 5:case"end":return ln.stop()}},Kt)}))}))),(f==null||((Qt=f.query)===null||Qt===void 0)?void 0:Qt.type)==="exercises"?i.a.createElement(w.a,{type:"primary",onClick:function(){tr(),N.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(){Rn(),localStorage.setItem("ismain","2")}})}},i.a.createElement("span",{className:"iconfont icon-yiguanbi mr5 font14"})," \u8FD4\u56DE\u8BD5\u5377"):i.a.createElement(p.a,{className:Y.a.btn_back,to:"/problemset"}," ",i.a.createElement(S.a,null),"\u9000\u51FA")),i.a.createElement(K.a,{size:"large",spinning:Ar},i.a.createElement(d.a,{className:"my-problems",leftChild:i.a.createElement(nt,nn),rightChild:i.a.createElement(Nn,Ft)}))):null))};function Sn(Ne){var it=Ne.title,Pt=Ne.modify_code,Qt=Ne.onSyncCode,un=Ne.onShowCodeSetting,$e=Ne.onResetCode,Ot=function(){N.a.confirm({title:"\u6062\u590D\u521D\u59CB\u4EE3\u7801",icon:i.a.createElement(s.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:$e})};return i.a.createElement("div",{className:"action-bar"},i.a.createElement("span",null),Pt?i.a.createElement("a",{title:"\u66F4\u65B0\u901A\u77E5",onClick:Qt},i.a.createElement("img",{src:x.a,alt:"notice"})):null,i.a.createElement("a",{title:"\u6062\u590D\u521D\u59CB\u4EE3\u7801",onClick:Ot},i.a.createElement("i",{className:"iconfont icon-zhongzhi font-20 "})),i.a.createElement("a",{onClick:un},i.a.createElement("i",{className:"iconfont icon-shezhi"})))}function Nn(Ne){var it=Ne.input,Pt=Ne.showNote,Qt=Ne.onShowNote,un=Ne.notes,$e=Ne.onCancelNote,Ot=Ne.onAddNote,Ht=Ne.debugResult,jt=Ne.language,mn=Ne.debuging,Jt=Ne.submitting,H=Ne.executingMessage,f=Ne.code,T=Ne.onSubmitCode,W=Ne.onDebugCode,J=Ne.onChangeCode,G=Ne.onChangeInput,ve=Ne.onUpdateCode,Ve=Object(z.a)(Ne,["input","showNote","onShowNote","notes","onCancelNote","onAddNote","debugResult","language","debuging","submitting","executingMessage","code","onSubmitCode","onDebugCode","onChangeCode","onChangeInput","onUpdateCode"]);function ht(Je){return i.a.createElement(Sn,Object(q.a)({},Ve,{onShowCodeSetting:Je}))}var Tt={input:it,debugResult:Ht,debuging:mn,submitting:Jt,executingMessage:H,onDebugCode:W,onChangeCode:J,onSubmitCode:T,onChangeInput:G};return i.a.createElement("div",{className:"right-panel"},i.a.createElement(C.a,{language:jt,value:f,onChange:J,ActionBarRender:ht}),i.a.createElement("div",{className:"note-form-area ".concat(Pt?"active":"")},i.a.createElement(xe,{onCancel:$e,notes:un,callback:Ot})),i.a.createElement(X.b,Tt))}},RELg:function(Ke,we,U){var q=U("MFOe"),z=q.Global;Ke.exports={name:"oldIE-userDataStorage",write:B,read:N,each:A,remove:k,clearAll:m};var L="storejs",K=z.document,I=_(),w=(z.navigator?z.navigator.userAgent:"").match(/ (MSIE 8|MSIE 9|MSIE 10)\./);function B(E,g){if(w)return;var u=R(E);I(function(a){a.setAttribute(u,g),a.save(L)})}function N(E){if(w)return;var g=R(E),u=null;return I(function(a){u=a.getAttribute(g)}),u}function A(E){I(function(g){for(var u=g.XMLDocument.documentElement.attributes,a=u.length-1;a>=0;a--){var i=u[a];E(g.getAttribute(i.name),i.name)}})}function k(E){var g=R(E);I(function(u){u.removeAttribute(g),u.save(L)})}function m(){I(function(E){var g=E.XMLDocument.documentElement.attributes;E.load(L);for(var u=g.length-1;u>=0;u--)E.removeAttribute(g[u].name);E.save(L)})}var O=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g");function R(E){return E.replace(/^\d/,"___$&").replace(O,"___")}function _(){if(!K||!K.documentElement||!K.documentElement.addBehavior)return null;var E="script",g,u,a;try{u=new ActiveXObject("htmlfile"),u.open(),u.write("<"+E+">document.w=window</"+E+'><iframe src="/favicon.ico"></iframe>'),u.close(),g=u.w.frames[0].document,a=g.createElement("div")}catch(i){a=K.createElement("div"),g=K.body}return function(i){var c=[].slice.call(arguments,0);c.unshift(a),g.appendChild(a),a.addBehavior("#default#userData"),a.load(L),i.apply(this,c),g.removeChild(a);return}}},"S+dL":function(Ke,we){Ke.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(Ke,we,U){var q=U("wTVA"),z=U("EbDI"),L=U("ZhPi"),K=U("wkBT");function I(w){return q(w)||z(w)||L(w)||K()}Ke.exports=I,Ke.exports.__esModule=!0,Ke.exports.default=Ke.exports},SJMd:function(Ke,we){/**
|
|
* @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 U,q,z,L=!1,K,I;window.PR_SHOULD_USE_CONTINUATION=!0;var w,B;(function(){var N=window,A=["break,continue,do,else,for,if,return,while"],k=[A,"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"],m=[k,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],O=[m,"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"],R=[m,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],_=[m,"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"],E="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",g=[m,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],u="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=[A,"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"],i=[A,"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=[A,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],S=[O,_,R,g,u,a,i,c],v=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,p="str",D="kwd",b="com",h="typ",d="lit",o="pun",s="pln",C="tag",y="dec",x="src",P="atn",j="atv",Y="nocode",Q="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function X(je){for(var Ye=0,rt=!1,mt=!1,ot=0,qe=je.length;ot<qe;++ot){var Xe=je[ot];if(Xe.ignoreCase)mt=!0;else if(/[a-z]/i.test(Xe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){rt=!0,mt=!1;break}}var Ct={b:8,t:9,n:10,v:11,f:12,r:13};function xt(Se){var Ee=Se.charCodeAt(0);if(Ee!==92)return Ee;var He=Se.charAt(1);return Ee=Ct[He],Ee||("0"<=He&&He<="7"?parseInt(Se.substring(1),8):He==="u"||He==="x"?parseInt(Se.substring(2),16):Se.charCodeAt(1))}function bt(Se){if(Se<32)return(Se<16?"\\x0":"\\x")+Se.toString(16);var Ee=String.fromCharCode(Se);return Ee==="\\"||Ee==="-"||Ee==="]"||Ee==="^"?"\\"+Ee:Ee}function Et(Se){var Ee=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")),He=[],Ge=Ee[0]==="^",Re=["["];Ge&&Re.push("^");for(var Ue=Ge?1:0,ge=Ee.length;Ue<ge;++Ue){var de=Ee[Ue];if(/\\[bdsw]/i.test(de))Re.push(de);else{var ce=xt(de),te;Ue+2<ge&&Ee[Ue+1]==="-"?(te=xt(Ee[Ue+2]),Ue+=2):te=ce,He.push([ce,te]),te<65||ce>122||(te<65||ce>90||He.push([Math.max(65,ce)|32,Math.min(te,90)|32]),te<97||ce>122||He.push([Math.max(97,ce)&~32,Math.min(te,122)&~32]))}}He.sort(function(Te,be){return Te[0]-be[0]||be[1]-Te[1]});for(var ie=[],ae=[],Ue=0;Ue<He.length;++Ue){var le=He[Ue];le[0]<=ae[1]+1?ae[1]=Math.max(ae[1],le[1]):ie.push(ae=le)}for(var Ue=0;Ue<ie.length;++Ue){var le=ie[Ue];Re.push(bt(le[0])),le[1]>le[0]&&(le[1]+1>le[0]&&Re.push("-"),Re.push(bt(le[1])))}return Re.push("]"),Re.join("")}function At(Se){for(var Ee=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")),He=Ee.length,Ge=[],Re=0,Ue=0;Re<He;++Re){var ge=Ee[Re];if(ge==="(")++Ue;else if(ge.charAt(0)==="\\"){var de=+ge.substring(1);de&&(de<=Ue?Ge[de]=-1:Ee[Re]=bt(de))}}for(var Re=1;Re<Ge.length;++Re)Ge[Re]===-1&&(Ge[Re]=++Ye);for(var Re=0,Ue=0;Re<He;++Re){var ge=Ee[Re];if(ge==="(")++Ue,Ge[Ue]||(Ee[Re]="(?:");else if(ge.charAt(0)==="\\"){var de=+ge.substring(1);de&&de<=Ue&&(Ee[Re]="\\"+Ge[de])}}for(var Re=0;Re<He;++Re)Ee[Re]==="^"&&Ee[Re+1]!=="^"&&(Ee[Re]="");if(Se.ignoreCase&&rt)for(var Re=0;Re<He;++Re){var ge=Ee[Re],ce=ge.charAt(0);ge.length>=2&&ce==="["?Ee[Re]=Et(ge):ce!=="\\"&&(Ee[Re]=ge.replace(/[a-zA-Z]/g,function(ae){var le=ae.charCodeAt(0);return"["+String.fromCharCode(le&~32,le|32)+"]"}))}return Ee.join("")}for(var St=[],ot=0,qe=je.length;ot<qe;++ot){var Xe=je[ot];if(Xe.global||Xe.multiline)throw new Error(""+Xe);St.push("(?:"+At(Xe)+")")}return new RegExp(St.join("|"),mt?"gi":"g")}function F(je,Ye){var rt=/(?:^|\s)nocode(?:\s|$)/,mt=[],ot=0,qe=[],Xe=0;function Ct(xt){var bt=xt.nodeType;if(bt==1){if(rt.test(xt.className))return;for(var Et=xt.firstChild;Et;Et=Et.nextSibling)Ct(Et);var At=xt.nodeName.toLowerCase();(At==="br"||At==="li")&&(mt[Xe]=`
|
|
`,qe[Xe<<1]=ot++,qe[Xe++<<1|1]=xt)}else if(bt==3||bt==4){var St=xt.nodeValue;St.length&&(Ye?St=St.replace(/\r\n?/g,`
|
|
`):St=St.replace(/[ \t\r\n]+/g," "),mt[Xe]=St,qe[Xe<<1]=ot,ot+=St.length,qe[Xe++<<1|1]=xt)}}return Ct(je),{sourceCode:mt.join("").replace(/\n$/,""),spans:qe}}function $(je,Ye,rt,mt,ot){if(!rt)return;var qe={sourceNode:je,pre:1,langExtension:null,numberLines:null,sourceCode:rt,spans:null,basePos:Ye,decorations:null};mt(qe),ot.push.apply(ot,qe.decorations)}var re=/\S/;function se(je){for(var Ye=void 0,rt=je.firstChild;rt;rt=rt.nextSibling){var mt=rt.nodeType;Ye=mt===1?Ye?je:rt:mt===3&&re.test(rt.nodeValue)?je:Ye}return Ye===je?void 0:Ye}function he(je,Ye){var rt={},mt;(function(){for(var Xe=je.concat(Ye),Ct=[],xt={},bt=0,Et=Xe.length;bt<Et;++bt){var At=Xe[bt],St=At[3];if(St)for(var Se=St.length;--Se>=0;)rt[St.charAt(Se)]=At;var Ee=At[1],He=""+Ee;xt.hasOwnProperty(He)||(Ct.push(Ee),xt[He]=null)}Ct.push(/[\0-\uffff]/),mt=X(Ct)})();var ot=Ye.length,qe=function(Xe){for(var Ct=Xe.sourceCode,xt=Xe.basePos,bt=Xe.sourceNode,Et=[xt,s],At=0,St=Ct.match(mt)||[],Se={},Ee=0,He=St.length;Ee<He;++Ee){var Ge=St[Ee],Re=Se[Ge],Ue=void 0,ge;if(typeof Re=="string")ge=!1;else{var de=rt[Ge.charAt(0)];if(de)Ue=Ge.match(de[1]),Re=de[0];else{for(var ce=0;ce<ot;++ce)if(de=Ye[ce],Ue=Ge.match(de[1]),Ue){Re=de[0];break}Ue||(Re=s)}ge=Re.length>=5&&Re.substring(0,5)==="lang-",ge&&!(Ue&&typeof Ue[1]=="string")&&(ge=!1,Re=x),ge||(Se[Ge]=Re)}var te=At;if(At+=Ge.length,!ge)Et.push(xt+te,Re);else{var ie=Ue[1],ae=Ge.indexOf(ie),le=ae+ie.length;Ue[2]&&(le=Ge.length-Ue[2].length,ae=le-ie.length);var Te=Re.substring(5);$(bt,xt+te,Ge.substring(0,ae),qe,Et),$(bt,xt+te+ae,ie,ue(Te,ie),Et),$(bt,xt+te+le,Ge.substring(le),qe,Et)}}Xe.decorations=Et};return qe}function _e(je){var Ye=[],rt=[];je.tripleQuotedStrings?Ye.push([p,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):je.multiLineStrings?Ye.push([p,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Ye.push([p,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),je.verbatimStrings&&rt.push([p,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var mt=je.hashComments;mt&&(je.cStyleComments?(mt>1?Ye.push([b,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Ye.push([b,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),rt.push([p,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Ye.push([b,/^#[^\r\n]*/,null,"#"])),je.cStyleComments&&(rt.push([b,/^\/\/[^\r\n]*/,null]),rt.push([b,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var ot=je.regexLiterals;if(ot){var qe=ot>1?"":`
|
|
\r`,Xe=qe?".":"[\\S\\s]",Ct="/(?=[^/*"+qe+"])(?:[^/\\x5B\\x5C"+qe+"]|\\x5C"+Xe+"|\\x5B(?:[^\\x5C\\x5D"+qe+"]|\\x5C"+Xe+")*(?:\\x5D|$))+/";rt.push(["lang-regex",RegExp("^"+Q+"("+Ct+")")])}var xt=je.types;xt&&rt.push([h,xt]);var bt=(""+je.keywords).replace(/^ | $/g,"");bt.length&&rt.push([D,new RegExp("^(?:"+bt.replace(/[\s,]+/g,"|")+")\\b"),null]),Ye.push([s,/^\s+/,null,` \r
|
|
\xA0`]);var Et="^.[^\\s\\w.$@'\"`/\\\\]*";return je.regexLiterals&&(Et+="(?!s*/)"),rt.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(Et),null]),he(Ye,rt)}var xe=_e({keywords:S,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Ce(je,Ye,rt){for(var mt=/(?:^|\s)nocode(?:\s|$)/,ot=/\r\n?|\n/,qe=je.ownerDocument,Xe=qe.createElement("li");je.firstChild;)Xe.appendChild(je.firstChild);var Ct=[Xe];function xt(Ee){var He=Ee.nodeType;if(He==1&&!mt.test(Ee.className))if(Ee.nodeName==="br")bt(Ee),Ee.parentNode&&Ee.parentNode.removeChild(Ee);else for(var Ge=Ee.firstChild;Ge;Ge=Ge.nextSibling)xt(Ge);else if((He==3||He==4)&&rt){var Re=Ee.nodeValue,Ue=Re.match(ot);if(Ue){var ge=Re.substring(0,Ue.index);Ee.nodeValue=ge;var de=Re.substring(Ue.index+Ue[0].length);if(de){var ce=Ee.parentNode;ce.insertBefore(qe.createTextNode(de),Ee.nextSibling)}bt(Ee),ge||Ee.parentNode.removeChild(Ee)}}}function bt(Ee){for(;!Ee.nextSibling;)if(Ee=Ee.parentNode,!Ee)return;function He(Ue,ge){var de=ge?Ue.cloneNode(!1):Ue,ce=Ue.parentNode;if(ce){var te=He(ce,1),ie=Ue.nextSibling;te.appendChild(de);for(var ae=ie;ae;ae=ie)ie=ae.nextSibling,te.appendChild(ae)}return de}for(var Ge=He(Ee.nextSibling,0),Re;(Re=Ge.parentNode)&&Re.nodeType===1;)Ge=Re;Ct.push(Ge)}for(var Et=0;Et<Ct.length;++Et)xt(Ct[Et]);Ye===(Ye|0)&&Ct[0].setAttribute("value",Ye);var At=qe.createElement("ol");At.className="linenums";for(var St=Math.max(0,Ye-1|0)||0,Et=0,Se=Ct.length;Et<Se;++Et)Xe=Ct[Et],Xe.className="L"+(Et+St)%10,Xe.firstChild||Xe.appendChild(qe.createTextNode("\xA0")),At.appendChild(Xe);je.appendChild(At)}function Oe(je){var Ye=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Ye=Ye&&+Ye[1]<=8;var rt=/\n/g,mt=je.sourceCode,ot=mt.length,qe=0,Xe=je.spans,Ct=Xe.length,xt=0,bt=je.decorations,Et=bt.length,At=0;bt[Et]=ot;var St,Se;for(Se=St=0;Se<Et;)bt[Se]!==bt[Se+2]?(bt[St++]=bt[Se++],bt[St++]=bt[Se++]):Se+=2;for(Et=St,Se=St=0;Se<Et;){for(var Ee=bt[Se],He=bt[Se+1],Ge=Se+2;Ge+2<=Et&&bt[Ge+1]===He;)Ge+=2;bt[St++]=Ee,bt[St++]=He,Se=Ge}Et=bt.length=St;var Re=je.sourceNode,Ue="";Re&&(Ue=Re.style.display,Re.style.display="none");try{for(var ge=null;xt<Ct;){var de=Xe[xt],ce=Xe[xt+2]||ot,te=bt[At+2]||ot,Ge=Math.min(ce,te),ie=Xe[xt+1],ae;if(ie.nodeType!==1&&(ae=mt.substring(qe,Ge))){Ye&&(ae=ae.replace(rt,"\r")),ie.nodeValue=ae;var le=ie.ownerDocument,Te=le.createElement("span");Te.className=bt[At+1];var be=ie.parentNode;be.replaceChild(Te,ie),Te.appendChild(ie),qe<ce&&(Xe[xt+1]=ie=le.createTextNode(mt.substring(Ge,ce)),be.insertBefore(ie,Te.nextSibling))}qe=Ge,qe>=ce&&(xt+=2),qe>=te&&(At+=2)}}finally{Re&&(Re.style.display=Ue)}}var De={};function pe(je,Ye){for(var rt=Ye.length;--rt>=0;){var mt=Ye[rt];De.hasOwnProperty(mt)?N.console&&console.warn("cannot override language handler %s",mt):De[mt]=je}}function ue(je,Ye){return je&&De.hasOwnProperty(je)||(je=/^\s*</.test(Ye)?"default-markup":"default-code"),De[je]}pe(xe,["default-code"]),pe(he([],[[s,/^[^<?]+/],[y,/^<!\w[^>]*(?:>|$)/],[b,/^<\!--[\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"]),pe(he([[s,/^[\s]+/,null,` \r
|
|
`],[j,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[C,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!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"]),pe(he([],[[j,/^[\s\S]+/]]),["uq.val"]),pe(_e({keywords:O,hashComments:!0,cStyleComments:!0,types:v}),["c","cc","cpp","cxx","cyc","m"]),pe(_e({keywords:"null,true,false"}),["json"]),pe(_e({keywords:_,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:v}),["cs"]),pe(_e({keywords:R,cStyleComments:!0}),["java"]),pe(_e({keywords:c,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),pe(_e({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),pe(_e({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),pe(_e({keywords:i,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),pe(_e({keywords:g,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),pe(_e({keywords:E,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),pe(he([],[[p,/^[\s\S]+/]]),["regex"]);function Me(je){var Ye=je.langExtension;try{var rt=F(je.sourceNode,je.pre),mt=rt.sourceCode;je.sourceCode=mt,je.spans=rt.spans,je.basePos=0,ue(Ye,mt)(je),Oe(je)}catch(ot){N.console&&console.log(ot&&ot.stack||ot)}}function at(je,Ye,rt){var mt=rt||!1,ot=Ye||null,qe=document.createElement("div");qe.innerHTML="<pre>"+je+"</pre>",qe=qe.firstChild,mt&&Ce(qe,mt,!0);var Xe={langExtension:ot,numberLines:mt,sourceNode:qe,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Me(Xe),qe.innerHTML}function lt(je,Ye){var rt=Ye||document.body,mt=rt.ownerDocument||document;function ot(de){return rt.getElementsByTagName(de)}for(var qe=[ot("pre"),ot("code"),ot("xmp")],Xe=[],Ct=0;Ct<qe.length;++Ct)for(var xt=0,bt=qe[Ct].length;xt<bt;++xt)Xe.push(qe[Ct][xt]);qe=null;var Et=Date;Et.now||(Et={now:function(){return+new Date}});var At=0,St=/\blang(?:uage)?-([\w.]+)(?!\S)/,Se=/\bprettyprint\b/,Ee=/\bprettyprinted\b/,He=/pre|xmp/i,Ge=/^code$/i,Re=/^(?:pre|code|xmp)$/i,Ue={};function ge(){for(var de=N.PR_SHOULD_USE_CONTINUATION?Et.now()+250:Infinity;At<Xe.length&&Et.now()<de;At++){for(var ce=Xe[At],te=Ue,ie=ce;ie=ie.previousSibling;){var ae=ie.nodeType,le=(ae===7||ae===8)&&ie.nodeValue;if(le?!/^\??prettify\b/.test(le):ae!==3||/\S/.test(ie.nodeValue))break;if(le){te={},le.replace(/\b(\w+)=([\w:.%+-]+)/g,function(We,Ie,tt){te[Ie]=tt});break}}var Te=ce.className;if((te!==Ue||Se.test(Te))&&!Ee.test(Te)){for(var be=!1,ze=ce.parentNode;ze;ze=ze.parentNode){var dt=ze.tagName;if(Re.test(dt)&&ze.className&&Se.test(ze.className)){be=!0;break}}if(!be){ce.className+=" prettyprinted";var yt=te.lang;if(!yt){yt=Te.match(St);var ct;!yt&&(ct=se(ce))&&Ge.test(ct.tagName)&&(yt=ct.className.match(St)),yt&&(yt=yt[1])}var st;if(He.test(ce.tagName))st=1;else{var Be=ce.currentStyle,Fe=mt.defaultView,Pe=Be?Be.whiteSpace:Fe&&Fe.getComputedStyle?Fe.getComputedStyle(ce,null).getPropertyValue("white-space"):0;st=Pe&&Pe.substring(0,3)==="pre"}var oe=te.linenums;(oe=oe==="true"||+oe)||(oe=Te.match(/\blinenums\b(?::(\d+))?/),oe=oe?oe[1]&&oe[1].length?+oe[1]:!0:!1),oe&&Ce(ce,oe,st);var fe={langExtension:yt,sourceNode:ce,numberLines:oe,pre:st,sourceCode:null,basePos:null,spans:null,decorations:null};Me(fe)}}}At<Xe.length?N.setTimeout(ge,250):typeof je=="function"&&je()}ge()}var et=N.PR={createSimpleLexer:he,registerLangHandler:pe,sourceDecorator:_e,PR_ATTRIB_NAME:P,PR_ATTRIB_VALUE:j,PR_COMMENT:b,PR_DECLARATION:y,PR_KEYWORD:D,PR_LITERAL:d,PR_NOCODE:Y,PR_PLAIN:s,PR_PUNCTUATION:o,PR_SOURCE:x,PR_STRING:p,PR_TAG:C,PR_TYPE:h,prettyPrintOne:L?N.prettyPrintOne=at:w=at,prettyPrint:B=L?N.prettyPrint=lt:B=lt},Qe=N.define;typeof Qe=="function"&&Qe.amd&&Qe("google-code-prettify",[],function(){return et})})()},U7T7:function(Ke,we,U){},UZu5:function(Ke,we,U){},"VrN/":function(Ke,we,U){(function(q,z){Ke.exports=z()})(this,function(){"use strict";var q=navigator.userAgent,z=navigator.platform,L=/gecko\/\d/i.test(q),K=/MSIE \d/.test(q),I=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(q),w=/Edge\/(\d+)/.exec(q),B=K||I||w,N=B&&(K?document.documentMode||6:+(w||I)[1]),A=!w&&/WebKit\//.test(q),k=A&&/Qt\/\d+\.\d+/.test(q),m=!w&&/Chrome\//.test(q),O=/Opera\//.test(q),R=/Apple Computer/.test(navigator.vendor),_=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(q),E=/PhantomJS/.test(q),g=!w&&/AppleWebKit/.test(q)&&/Mobile\/\w+/.test(q),u=/Android/.test(q),a=g||u||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(q),i=g||/Mac/.test(z),c=/\bCrOS\b/.test(q),S=/win/i.test(z),v=O&&q.match(/Version\/(\d*\.\d*)/);v&&(v=Number(v[1])),v&&v>=15&&(O=!1,A=!0);var p=i&&(k||O&&(v==null||v<12.11)),D=L||B&&N>=9;function b(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var h=function(e,t){var r=e.className,n=b(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 M=0;M<t.length;++M)l.appendChild(t[M]);return l}function C(e,t,r,n){var l=s(e,t,r,n);return l.setAttribute("role","presentation"),l}var y;document.createRange?y=function(e,t,r,n){var l=document.createRange();return l.setEnd(n||e,r),l.setStart(e,t),l}:y=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 x(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 P(){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 j(e,t){var r=e.className;b(t).test(r)||(e.className+=(r?" ":"")+t)}function Y(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!b(r[n]).test(t)&&(t+=" "+r[n]);return t}var Q=function(e){e.select()};g?Q=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:B&&(Q=function(e){try{e.select()}catch(t){}});function X(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function F(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 M=n||0,V=l||0;;){var Z=e.indexOf(" ",M);if(Z<0||Z>=t)return V+(t-M);V+=Z-M,V+=r-V%r,M=Z+1}}var re=function(){this.id=null,this.f=null,this.time=0,this.handler=X(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 se(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}var he=50,_e={toString:function(){return"CodeMirror.Pass"}},xe={scroll:!1},Ce={origin:"*mouse"},Oe={origin:"+move"};function De(e,t,r){for(var n=0,l=0;;){var M=e.indexOf(" ",n);M==-1&&(M=e.length);var V=M-n;if(M==e.length||l+V>=t)return n+Math.min(V,t-l);if(l+=M-n,l+=r-l%r,n=M+1,l>=t)return n}}var pe=[""];function ue(e){for(;pe.length<=e;)pe.push(Me(pe)+" ");return pe[e]}function Me(e){return e[e.length-1]}function at(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function lt(e,t,r){for(var n=0,l=r(t);n<e.length&&r(e[n])<=l;)n++;e.splice(n,0,t)}function et(){}function Qe(e,t){var r;return Object.create?r=Object.create(e):(et.prototype=e,r=new et),t&&F(t,r),r}var je=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Ye(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||je.test(e))}function rt(e,t){return t?t.source.indexOf("\\w")>-1&&Ye(e)?!0:t.test(e):Ye(e)}function mt(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ot=/[\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 qe(e){return e.charCodeAt(0)>=768&&ot.test(e)}function Xe(e,t,r){for(;(r<0?t>0:t<e.length)&&qe(e.charAt(t));)t+=r;return t}function Ct(e,t,r){for(var n=t>r?-1:1;;){if(t==r)return t;var l=(t+r)/2,M=n<0?Math.ceil(l):Math.floor(l);if(M==t)return e(M)?t:r;e(M)?r=M:t=M+n}}function xt(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var l=!1,M=0;M<e.length;++M){var V=e[M];(V.from<r&&V.to>t||t==r&&V.to==t)&&(n(Math.max(V.from,t),Math.min(V.to,r),V.level==1?"rtl":"ltr",M),l=!0)}l||n(t,r,"ltr")}var bt=null;function Et(e,t,r){var n;bt=null;for(var l=0;l<e.length;++l){var M=e[l];if(M.from<t&&M.to>t)return l;M.to==t&&(M.from!=M.to&&r=="before"?n=l:bt=l),M.from==t&&(M.from!=M.to&&r!="before"?n=l:bt=l)}return n!=null?n:bt}var At=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function r(ne){return ne<=247?e.charAt(ne):1424<=ne&&ne<=1524?"R":1536<=ne&&ne<=1785?t.charAt(ne-1536):1774<=ne&&ne<=2220?"r":8192<=ne&&ne<=8203?"w":ne==8204?"b":"L"}var n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,l=/[stwN]/,M=/[LRr]/,V=/[Lb1n]/,Z=/[1n]/;function ee(ne,me,ye){this.level=ne,this.from=me,this.to=ye}return function(ne,me){var ye=me=="ltr"?"L":"R";if(ne.length==0||me=="ltr"&&!n.test(ne))return!1;for(var ke=ne.length,Le=[],Ze=0;Ze<ke;++Ze)Le.push(r(ne.charCodeAt(Ze)));for(var ut=0,vt=ye;ut<ke;++ut){var wt=Le[ut];wt=="m"?Le[ut]=vt:vt=wt}for(var Mt=0,_t=ye;Mt<ke;++Mt){var Ut=Le[Mt];Ut=="1"&&_t=="r"?Le[Mt]="n":M.test(Ut)&&(_t=Ut,Ut=="r"&&(Le[Mt]="R"))}for(var $t=1,Xt=Le[0];$t<ke-1;++$t){var on=Le[$t];on=="+"&&Xt=="1"&&Le[$t+1]=="1"?Le[$t]="1":on==","&&Xt==Le[$t+1]&&(Xt=="1"||Xt=="n")&&(Le[$t]=Xt),Xt=on}for(var Pn=0;Pn<ke;++Pn){var Qn=Le[Pn];if(Qn==",")Le[Pn]="N";else if(Qn=="%"){var Bn=void 0;for(Bn=Pn+1;Bn<ke&&Le[Bn]=="%";++Bn);for(var Cr=Pn&&Le[Pn-1]=="!"||Bn<ke&&Le[Bn]=="1"?"1":"N",gr=Pn;gr<Bn;++gr)Le[gr]=Cr;Pn=Bn-1}}for(var zn=0,vr=ye;zn<ke;++zn){var rr=Le[zn];vr=="L"&&rr=="1"?Le[zn]="L":M.test(rr)&&(vr=rr)}for(var Xn=0;Xn<ke;++Xn)if(l.test(Le[Xn])){var Gn=void 0;for(Gn=Xn+1;Gn<ke&&l.test(Le[Gn]);++Gn);for(var jn=(Xn?Le[Xn-1]:ye)=="L",yr=(Gn<ke?Le[Gn]:ye)=="L",Ti=jn==yr?jn?"L":"R":ye,Zr=Xn;Zr<Gn;++Zr)Le[Zr]=Ti;Xn=Gn-1}for(var sr=[],Br,qn=0;qn<ke;)if(V.test(Le[qn])){var qa=qn;for(++qn;qn<ke&&V.test(Le[qn]);++qn);sr.push(new ee(0,qa,qn))}else{var Hr=qn,oi=sr.length,si=me=="rtl"?1:0;for(++qn;qn<ke&&Le[qn]!="L";++qn);for(var hr=Hr;hr<qn;)if(Z.test(Le[hr])){Hr<hr&&(sr.splice(oi,0,new ee(1,Hr,hr)),oi+=si);var wi=hr;for(++hr;hr<qn&&Z.test(Le[hr]);++hr);sr.splice(oi,0,new ee(2,wi,hr)),oi+=si,Hr=hr}else++hr;Hr<qn&&sr.splice(oi,0,new ee(1,Hr,qn))}return me=="ltr"&&(sr[0].level==1&&(Br=ne.match(/^\s+/))&&(sr[0].from=Br[0].length,sr.unshift(new ee(0,0,Br[0].length))),Me(sr).level==1&&(Br=ne.match(/\s+$/))&&(Me(sr).to-=Br[0].length,sr.push(new ee(0,ke-Br[0].length,ke)))),me=="rtl"?sr.reverse():sr}}();function St(e,t){var r=e.order;return r==null&&(r=e.order=At(e.text,t)),r}var Se=[],Ee=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 He(e,t){return e._handlers&&e._handlers[t]||Se}function Ge(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 M=se(l,r);M>-1&&(n[t]=l.slice(0,M).concat(l.slice(M+1)))}}}function Re(e,t){var r=He(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 Ue(e,t,r){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Re(e,r||t.type,e,t),ae(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)se(r,t[n])==-1&&r.push(t[n])}function de(e,t){return He(e,t).length>0}function ce(e){e.prototype.on=function(t,r){Ee(this,t,r)},e.prototype.off=function(t,r){Ge(this,t,r)}}function te(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ie(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ae(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function le(e){te(e),ie(e)}function Te(e){return e.target||e.srcElement}function be(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),i&&e.ctrlKey&&t==1&&(t=3),t}var ze=function(){if(B&&N<9)return!1;var e=s("div");return"draggable"in e||"dragDrop"in e}(),dt;function yt(e){if(dt==null){var t=s("span","\u200B");o(e,s("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(dt=t.offsetWidth<=1&&t.offsetHeight>2&&!(B&&N<8))}var r=dt?s("span","\u200B"):s("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}var ct;function st(e){if(ct!=null)return ct;var t=o(e,document.createTextNode("A\u062EA")),r=y(t,0,1).getBoundingClientRect(),n=y(t,1,2).getBoundingClientRect();return d(e),!r||r.left==r.right?!1:ct=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 M=e.slice(t,e.charAt(l-1)=="\r"?l-1:l),V=M.indexOf("\r");V!=-1?(r.push(M.slice(0,V)),t+=V+1):(r.push(M),t=l+1)}return r}:function(e){return e.split(/\r\n?|\n/)},Fe=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},Pe=function(){var e=s("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),oe=null;function fe(e){if(oe!=null)return oe;var t=o(e,s("span","x")),r=t.getBoundingClientRect(),n=y(t,0,1).getBoundingClientRect();return oe=Math.abs(r.left-n.left)>1}var We={},Ie={};function tt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),We[e]=t}function ft(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=Qe(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 nt(e,t){t=Ae(t);var r=We[t.name];if(!r)return nt(e,"text/plain");var n=r(e,t);if(gt.hasOwnProperty(t.name)){var l=gt[t.name];for(var M in l){if(!l.hasOwnProperty(M))continue;n.hasOwnProperty(M)&&(n["_"+M]=n[M]),n[M]=l[M]}}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var V in t.modeProps)n[V]=t.modeProps[V];return n}var gt={};function Bt(e,t){var r=gt.hasOwnProperty(e)?gt[e]:gt[e]={};F(t,r)}function pt(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 sn(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 gn(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(V){return r?V.toLowerCase():V},l=this.string.substr(this.pos,e.length);if(n(l)==n(e))return t!==!1&&(this.pos+=e.length),!0}else{var M=this.string.slice(this.pos).match(e);return M&&M.index>0?null:(M&&t!==!1&&(this.pos+=M[0].length),M)}},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],M=l.chunkSize();if(t<M){r=l;break}t-=M}return r.lines[t]}function Sn(e,t,r){var n=[],l=t.line;return e.iter(t.line,r.line+1,function(M){var V=M.text;l==r.line&&(V=V.slice(0,r.ch)),l==t.line&&(V=V.slice(t.ch)),n.push(V),++l}),n}function Nn(e,t,r){var n=[];return e.iter(t,r,function(l){n.push(l.text)}),n}function Ne(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function it(e){if(e.parent==null)return null;for(var t=e.parent,r=se(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 Pt(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var l=e.children[n],M=l.height;if(t<M){e=l;continue e}t-=M,r+=l.chunkSize()}return r}while(!e.lines);for(var V=0;V<e.lines.length;++V){var Z=e.lines[V],ee=Z.height;if(t<ee)break;t-=ee}return r+V}function Qt(e,t){return t>=e.first&&t<e.first+e.size}function un(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function $e(e,t,r){if(r===void 0&&(r=null),!(this instanceof $e))return new $e(e,t,r);this.line=e,this.ch=t,this.sticky=r}function Ot(e,t){return e.line-t.line||e.ch-t.ch}function Ht(e,t){return e.sticky==t.sticky&&Ot(e,t)==0}function jt(e){return $e(e.line,e.ch)}function mn(e,t){return Ot(e,t)<0?t:e}function Jt(e,t){return Ot(e,t)<0?e:t}function H(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function f(e,t){if(t.line<e.first)return $e(e.first,0);var r=e.first+e.size-1;return t.line>r?$e(r,Dt(e,r).text.length):T(t,Dt(e,t.line).text.length)}function T(e,t){var r=e.ch;return r==null||r>t?$e(e.line,t):r<0?$e(e.line,0):e}function W(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=f(e,t[n]);return r}var J=function(e,t){this.state=e,this.lookAhead=t},G=function(e,t,r,n){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};G.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},G.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}},G.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},G.fromSaved=function(e,t,r){return t instanceof J?new G(e,pt(e.mode,t.state),r,t.lookAhead):new G(e,pt(e.mode,t),r)},G.prototype.save=function(e){var t=e!==!1?pt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new J(t,this.maxLookAhead):t};function ve(e,t,r,n){var l=[e.state.modeGen],M={};Vn(e,t.text,e.doc.mode,r,function(ne,me){return l.push(ne,me)},M,n);for(var V=r.state,Z=function(ne){r.baseTokens=l;var me=e.state.overlays[ne],ye=1,ke=0;r.state=!0,Vn(e,t.text,me.mode,r,function(Le,Ze){for(var ut=ye;ke<Le;){var vt=l[ye];vt>Le&&l.splice(ye,1,Le,l[ye+1],vt),ye+=2,ke=Math.min(Le,vt)}if(!Ze)return;if(me.opaque)l.splice(ut,ye-ut,Le,"overlay "+Ze),ye=ut+2;else for(;ut<ye;ut+=2){var wt=l[ut+1];l[ut+1]=(wt?wt+" ":"")+"overlay "+Ze}},M),r.state=V,r.baseTokens=null,r.baseTokenPos=1},ee=0;ee<e.state.overlays.length;++ee)Z(ee);return{styles:l,classes:M.bgClass||M.textClass?M:null}}function Ve(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=ht(e,it(t)),l=t.text.length>e.options.maxHighlightLength&&pt(e.doc.mode,n.state),M=ve(e,t,n);l&&(n.state=l),t.stateAfter=n.save(!l),t.styles=M.styles,M.classes?t.styleClasses=M.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 ht(e,t,r){var n=e.doc,l=e.display;if(!n.mode.startState)return new G(n,!0,t);var M=vn(e,t,r),V=M>n.first&&Dt(n,M-1).stateAfter,Z=V?G.fromSaved(n,V,M):new G(n,gn(n.mode),M);return n.iter(M,t,function(ee){Tt(e,ee.text,Z);var ne=Z.line;ee.stateAfter=ne==t-1||ne%5==0||ne>=l.viewFrom&&ne<l.viewTo?Z.save():null,Z.nextLine()}),r&&(n.modeFrontier=Z.line),Z}function Tt(e,t,r,n){var l=e.doc.mode,M=new en(t,e.options.tabSize,r);for(M.start=M.pos=n||0,t==""&&Je(l,r.state);!M.eol();)It(l,M,r.state),M.start=M.pos}function Je(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var r=sn(e,t);if(r.mode.blankLine)return r.mode.blankLine(r.state)}function It(e,t,r,n){for(var l=0;l<10;l++){n&&(n[0]=sn(e,r).mode);var M=e.token(t,r);if(t.pos>t.start)return M}throw new Error("Mode "+e.name+" failed to advance stream.")}var kt=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function rn(e,t,r,n){var l=e.doc,M=l.mode,V;t=f(l,t);var Z=Dt(l,t.line),ee=ht(e,t.line,r),ne=new en(Z.text,e.options.tabSize,ee),me;for(n&&(me=[]);(n||ne.pos<t.ch)&&!ne.eol();)ne.start=ne.pos,V=It(M,ne,ee.state),n&&me.push(new kt(ne,V,pt(l.mode,ee.state)));return n?me:new kt(ne,V,ee.state)}function An(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 Vn(e,t,r,n,l,M,V){var Z=r.flattenSpans;Z==null&&(Z=e.options.flattenSpans);var ee=0,ne=null,me=new en(t,e.options.tabSize,n),ye,ke=e.options.addModeClass&&[null];for(t==""&&An(Je(r,n.state),M);!me.eol();){if(me.pos>e.options.maxHighlightLength?(Z=!1,V&&Tt(e,t,n,me.pos),me.pos=t.length,ye=null):ye=An(It(r,me,n.state,ke),M),ke){var Le=ke[0].name;Le&&(ye="m-"+(ye?Le+" "+ye:Le))}if(!Z||ne!=ye){for(;ee<me.start;)ee=Math.min(me.start,ee+5e3),l(ee,ne);ne=ye}me.start=me.pos}for(;ee<me.pos;){var Ze=Math.min(me.pos,ee+5e3);l(Ze,ne),ee=Ze}}function vn(e,t,r){for(var n,l,M=e.doc,V=r?-1:t-(e.doc.mode.innerMode?1e3:100),Z=t;Z>V;--Z){if(Z<=M.first)return M.first;var ee=Dt(M,Z-1),ne=ee.stateAfter;if(ne&&(!r||Z+(ne instanceof J?ne.lookAhead:0)<=M.modeFrontier))return Z;var me=$(ee.text,null,e.options.tabSize);(l==null||n>me)&&(l=Z-1,n=me)}return l}function hn(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 J)||n+l.lookAhead<t)){r=n+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}var wn=!1,yn=!1;function Cn(){wn=!0}function fn(){yn=!0}function bn(e,t,r){this.marker=e,this.from=t,this.to=r}function En(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function Yn(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function Kn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Ar(e,t,r){var n;if(e)for(var l=0;l<e.length;++l){var M=e[l],V=M.marker,Z=M.from==null||(V.inclusiveLeft?M.from<=t:M.from<t);if(Z||M.from==t&&V.type=="bookmark"&&(!r||!M.marker.insertLeft)){var ee=M.to==null||(V.inclusiveRight?M.to>=t:M.to>t);(n||(n=[])).push(new bn(V,M.from,ee?null:M.to))}}return n}function Dn(e,t,r){var n;if(e)for(var l=0;l<e.length;++l){var M=e[l],V=M.marker,Z=M.to==null||(V.inclusiveRight?M.to>=t:M.to>t);if(Z||M.from==t&&V.type=="bookmark"&&(!r||M.marker.insertLeft)){var ee=M.from==null||(V.inclusiveLeft?M.from<=t:M.from<t);(n||(n=[])).push(new bn(V,ee?null:M.from-t,M.to==null?null:M.to-t))}}return n}function fr(e,t){if(t.full)return null;var r=Qt(e,t.from.line)&&Dt(e,t.from.line).markedSpans,n=Qt(e,t.to.line)&&Dt(e,t.to.line).markedSpans;if(!r&&!n)return null;var l=t.from.ch,M=t.to.ch,V=Ot(t.from,t.to)==0,Z=Ar(r,l,V),ee=Dn(n,M,V),ne=t.text.length==1,me=Me(t.text).length+(ne?l:0);if(Z)for(var ye=0;ye<Z.length;++ye){var ke=Z[ye];if(ke.to==null){var Le=En(ee,ke.marker);Le?ne&&(ke.to=Le.to==null?null:Le.to+me):ke.to=l}}if(ee)for(var Ze=0;Ze<ee.length;++Ze){var ut=ee[Ze];if(ut.to!=null&&(ut.to+=me),ut.from==null){var vt=En(Z,ut.marker);vt||(ut.from=me,ne&&(Z||(Z=[])).push(ut))}else ut.from+=me,ne&&(Z||(Z=[])).push(ut)}Z&&(Z=er(Z)),ee&&ee!=Z&&(ee=er(ee));var wt=[Z];if(!ne){var Mt=t.text.length-2,_t;if(Mt>0&&Z)for(var Ut=0;Ut<Z.length;++Ut)Z[Ut].to==null&&(_t||(_t=[])).push(new bn(Z[Ut].marker,null,null));for(var $t=0;$t<Mt;++$t)wt.push(_t);wt.push(ee)}return wt}function er(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 lr(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(Le){if(Le.markedSpans)for(var Ze=0;Ze<Le.markedSpans.length;++Ze){var ut=Le.markedSpans[Ze].marker;ut.readOnly&&(!n||se(n,ut)==-1)&&(n||(n=[])).push(ut)}}),!n)return null;for(var l=[{from:t,to:r}],M=0;M<n.length;++M)for(var V=n[M],Z=V.find(0),ee=0;ee<l.length;++ee){var ne=l[ee];if(Ot(ne.to,Z.from)<0||Ot(ne.from,Z.to)>0)continue;var me=[ee,1],ye=Ot(ne.from,Z.from),ke=Ot(ne.to,Z.to);(ye<0||!V.inclusiveLeft&&!ye)&&me.push({from:ne.from,to:Z.from}),(ke>0||!V.inclusiveRight&&!ke)&&me.push({from:Z.to,to:ne.to}),l.splice.apply(l,me),ee+=me.length-3}return l}function _r(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 Nt(e){return e.inclusiveRight?1:0}function Rn(e,t){var r=e.lines.length-t.lines.length;if(r!=0)return r;var n=e.find(),l=t.find(),M=Ot(n.from,l.from)||pn(e)-pn(t);if(M)return-M;var V=Ot(n.to,l.to)||Nt(e)-Nt(t);return V||t.id-e.id}function dn(e,t){var r=yn&&e.markedSpans,n;if(r)for(var l=void 0,M=0;M<r.length;++M)l=r[M],l.marker.collapsed&&(t?l.from:l.to)==null&&(!n||Rn(n,l.marker)<0)&&(n=l.marker);return n}function _n(e){return dn(e,!0)}function cn(e){return dn(e,!1)}function tr(e,t){var r=yn&&e.markedSpans,n;if(r)for(var l=0;l<r.length;++l){var M=r[l];M.marker.collapsed&&(M.from==null||M.from<t)&&(M.to==null||M.to>t)&&(!n||Rn(n,M.marker)<0)&&(n=M.marker)}return n}function Ln(e,t,r,n,l){var M=Dt(e,t),V=yn&&M.markedSpans;if(V)for(var Z=0;Z<V.length;++Z){var ee=V[Z];if(!ee.marker.collapsed)continue;var ne=ee.marker.find(0),me=Ot(ne.from,r)||pn(ee.marker)-pn(l),ye=Ot(ne.to,n)||Nt(ee.marker)-Nt(l);if(me>=0&&ye<=0||me<=0&&ye>=0)continue;if(me<=0&&(ee.marker.inclusiveRight&&l.inclusiveLeft?Ot(ne.to,r)>=0:Ot(ne.to,r)>0)||me>=0&&(ee.marker.inclusiveRight&&l.inclusiveLeft?Ot(ne.from,n)<=0:Ot(ne.from,n)<0))return!0}}function $n(e){for(var t;t=_n(e);)e=t.find(-1,!0).line;return e}function Er(e){for(var t;t=cn(e);)e=t.find(1,!0).line;return e}function Sr(e){for(var t,r;t=cn(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function ur(e,t){var r=Dt(e,t),n=$n(r);return r==n?t:it(n)}function Dr(e,t){if(t>e.lastLine())return t;var r=Dt(e,t),n;if(!nr(e,r))return t;for(;n=cn(r);)r=n.find(1,!0).line;return it(r)+1}function nr(e,t){var r=yn&&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&&kr(e,t,n))return!0}}function kr(e,t,r){if(r.to==null){var n=r.marker.find(1,!0);return kr(e,n.line,En(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var l=void 0,M=0;M<t.markedSpans.length;++M)if(l=t.markedSpans[M],l.marker.collapsed&&!l.marker.widgetNode&&l.from==r.to&&(l.to==null||l.to!=r.from)&&(l.marker.inclusiveLeft||r.marker.inclusiveRight)&&kr(e,t,l))return!0}function ir(e){e=$n(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 M=r.parent;M;r=M,M=r.parent)for(var V=0;V<M.children.length;++V){var Z=M.children[V];if(Z==r)break;t+=Z.height}return t}function Rr(e){if(e.height==0)return 0;for(var t=e.text.length,r,n=e;r=_n(n);){var l=r.find(0,!0);n=l.from.line,t+=l.from.ch-l.to.ch}for(n=e;r=cn(n);){var M=r.find(0,!0);t-=n.text.length-M.from.ch,n=M.to.line,t+=n.text.length-M.to.ch}return t}function Ir(e){var t=e.display,r=e.doc;t.maxLine=Dt(r,r.first),t.maxLineLength=Rr(t.maxLine),t.maxLineChanged=!0,r.iter(function(n){var l=Rr(n);l>t.maxLineLength&&(t.maxLineLength=l,t.maxLine=n)})}var dr=function(e,t,r){this.text=e,br(this,t),this.height=r?r(this):1};dr.prototype.lineNo=function(){return it(this)},ce(dr);function Kr(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),_r(e),br(e,r);var l=n?n(e):1;l!=e.height&&Ne(e,l)}function jr(e){e.parent=null,_r(e)}var Ft={},Yt={};function zt(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?Yt:Ft;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function nn(e,t){var r=C("span",null,null,A?"padding-right: .1px":null),n={pre:C("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 M=l?t.rest[l-1]:t.line,V=void 0;n.pos=0,n.addToken=Rt,st(e.display.measure)&&(V=St(M,e.doc.direction))&&(n.addToken=Lt(n.addToken,V)),n.map=[];var Z=t!=e.display.externalMeasured&&it(M);Gt(M,n,Ve(e,M,Z)),M.styleClasses&&(M.styleClasses.bgClass&&(n.bgClass=Y(M.styleClasses.bgClass,n.bgClass||"")),M.styleClasses.textClass&&(n.textClass=Y(M.styleClasses.textClass,n.textClass||""))),n.map.length==0&&n.map.push(0,0,n.content.appendChild(yt(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(A){var ee=n.content.lastChild;(/\bcm-tab\b/.test(ee.className)||ee.querySelector&&ee.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return Re(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=Y(n.pre.className,n.textClass||"")),n}function Kt(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 Rt(e,t,r,n,l,M,V){if(!t)return;var Z=e.splitSpaces?Wt(t,e.trailingSpace):t,ee=e.cm.state.specialChars,ne=!1,me;if(!ee.test(t))e.col+=t.length,me=document.createTextNode(Z),e.map.push(e.pos,e.pos+t.length,me),B&&N<9&&(ne=!0),e.pos+=t.length;else{me=document.createDocumentFragment();for(var ye=0;;){ee.lastIndex=ye;var ke=ee.exec(t),Le=ke?ke.index-ye:t.length-ye;if(Le){var Ze=document.createTextNode(Z.slice(ye,ye+Le));B&&N<9?me.appendChild(s("span",[Ze])):me.appendChild(Ze),e.map.push(e.pos,e.pos+Le,Ze),e.col+=Le,e.pos+=Le}if(!ke)break;ye+=Le+1;var ut=void 0;if(ke[0]==" "){var vt=e.cm.options.tabSize,wt=vt-e.col%vt;ut=me.appendChild(s("span",ue(wt),"cm-tab")),ut.setAttribute("role","presentation"),ut.setAttribute("cm-text"," "),e.col+=wt}else ke[0]=="\r"||ke[0]==`
|
|
`?(ut=me.appendChild(s("span",ke[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),ut.setAttribute("cm-text",ke[0]),e.col+=1):(ut=e.cm.options.specialCharPlaceholder(ke[0]),ut.setAttribute("cm-text",ke[0]),B&&N<9?me.appendChild(s("span",[ut])):me.appendChild(ut),e.col+=1);e.map.push(e.pos,e.pos+1,ut),e.pos++}}if(e.trailingSpace=Z.charCodeAt(t.length-1)==32,r||n||l||ne||M||V){var Mt=r||"";n&&(Mt+=n),l&&(Mt+=l);var _t=s("span",[me],Mt,M);if(V)for(var Ut in V)V.hasOwnProperty(Ut)&&Ut!="style"&&Ut!="class"&&_t.setAttribute(Ut,V[Ut]);return e.content.appendChild(_t)}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 M=e.charAt(l);M==" "&&r&&(l==e.length-1||e.charCodeAt(l+1)==32)&&(M="\xA0"),n+=M,r=M==" "}return n}function Lt(e,t){return function(r,n,l,M,V,Z,ee){l=l?l+" cm-force-border":"cm-force-border";for(var ne=r.pos,me=ne+n.length;;){for(var ye=void 0,ke=0;ke<t.length&&!(ye=t[ke],ye.to>ne&&ye.from<=ne);ke++);if(ye.to>=me)return e(r,n,l,M,V,Z,ee);e(r,n.slice(0,ye.to-ne),l,M,null,Z,ee),M=null,n=n.slice(ye.to-ne),ne=ye.to}}}function ln(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 Gt(e,t,r){var n=e.markedSpans,l=e.text,M=0;if(!n){for(var V=1;V<r.length;V+=2)t.addToken(t,l.slice(M,M=r[V]),zt(r[V+1],t.cm.options));return}for(var Z=l.length,ee=0,ne=1,me="",ye,ke,Le=0,Ze,ut,vt,wt,Mt;;){if(Le==ee){Ze=ut=vt=ke="",Mt=null,wt=null,Le=Infinity;for(var _t=[],Ut=void 0,$t=0;$t<n.length;++$t){var Xt=n[$t],on=Xt.marker;if(on.type=="bookmark"&&Xt.from==ee&&on.widgetNode)_t.push(on);else if(Xt.from<=ee&&(Xt.to==null||Xt.to>ee||on.collapsed&&Xt.to==ee&&Xt.from==ee)){if(Xt.to!=null&&Xt.to!=ee&&Le>Xt.to&&(Le=Xt.to,ut=""),on.className&&(Ze+=" "+on.className),on.css&&(ke=(ke?ke+";":"")+on.css),on.startStyle&&Xt.from==ee&&(vt+=" "+on.startStyle),on.endStyle&&Xt.to==Le&&(Ut||(Ut=[])).push(on.endStyle,Xt.to),on.title&&((Mt||(Mt={})).title=on.title),on.attributes)for(var Pn in on.attributes)(Mt||(Mt={}))[Pn]=on.attributes[Pn];on.collapsed&&(!wt||Rn(wt.marker,on)<0)&&(wt=Xt)}else Xt.from>ee&&Le>Xt.from&&(Le=Xt.from)}if(Ut)for(var Qn=0;Qn<Ut.length;Qn+=2)Ut[Qn+1]==Le&&(ut+=" "+Ut[Qn]);if(!wt||wt.from==ee)for(var Bn=0;Bn<_t.length;++Bn)ln(t,0,_t[Bn]);if(wt&&(wt.from||0)==ee){if(ln(t,(wt.to==null?Z+1:wt.to)-ee,wt.marker,wt.from==null),wt.to==null)return;wt.to==ee&&(wt=!1)}}if(ee>=Z)break;for(var Cr=Math.min(Z,Le);;){if(me){var gr=ee+me.length;if(!wt){var zn=gr>Cr?me.slice(0,Cr-ee):me;t.addToken(t,zn,ye?ye+Ze:Ze,vt,ee+zn.length==Le?ut:"",ke,Mt)}if(gr>=Cr){me=me.slice(Cr-ee),ee=Cr;break}ee=gr,vt=""}me=l.slice(M,M=r[ne++]),ye=zt(r[ne++],t.cm.options)}}}function Un(e,t,r){this.line=t,this.rest=Sr(t),this.size=this.rest?it(Me(this.rest))-r+1:1,this.node=this.text=null,this.hidden=nr(e,t)}function Zt(e,t,r){for(var n=[],l,M=t;M<r;M=l){var V=new Un(e.doc,Dt(e.doc,M),M);l=M+V.size,n.push(V)}return n}var xn=null;function Vt(e){xn?xn.ops.push(e):e.ownsGroup=xn={ops:[e],delayedCallbacks:[]}}function Fn(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 an(e,t){var r=e.ownsGroup;if(!r)return;try{Fn(r)}finally{xn=null,t(r)}}var qt=null;function tn(e,t){var r=He(e,t);if(!r.length)return;var n=Array.prototype.slice.call(arguments,2),l;xn?l=xn.delayedCallbacks:qt?l=qt:(l=qt=[],setTimeout(kn,0));for(var M=function(Z){l.push(function(){return r[Z].apply(null,n)})},V=0;V<r.length;++V)M(V)}function kn(){var e=qt;qt=null;for(var t=0;t<e.length;++t)e[t]()}function ar(e,t,r,n){for(var l=0;l<t.changes.length;l++){var M=t.changes[l];M=="text"?Wn(e,t):M=="gutter"?to(e,t,r,n):M=="class"?va(e,t):M=="widget"&&Is(e,t,n)}t.changes=null}function Mn(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),B&&N<8&&(e.node.style.zIndex=2)),e.node}function Or(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=Mn(t);t.background=n.insertBefore(s("div",null,r),n.firstChild),e.display.input.setUneditable(t.background)}}function li(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):nn(e,t)}function Wn(e,t){var r=t.text.className,n=li(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){Or(e,t),t.line.wrapClass?Mn(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=Mn(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 M=t.line.gutterMarkers;if(e.options.lineNumbers||M){var V=Mn(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),V.insertBefore(Z,t.text),t.line.gutterClass&&(Z.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!M||!M["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"))),M)for(var ee=0;ee<e.display.gutterSpecs.length;++ee){var ne=e.display.gutterSpecs[ee].className,me=M.hasOwnProperty(ne)&&M[ne];me&&Z.appendChild(s("div",[me],"CodeMirror-gutter-elt","left: "+n.gutterLeft[ne]+"px; width: "+n.gutterWidth[ne]+"px"))}}}function Is(e,t,r){t.alignable&&(t.alignable=null);for(var n=b("CodeMirror-linewidget"),l=t.node.firstChild,M=void 0;l;l=M)M=l.nextSibling,n.test(l.className)&&t.node.removeChild(l);no(e,t,r)}function Ns(e,t,r,n){var l=li(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 M=Mn(r),V=0,Z=t.widgets;V<Z.length;++V){var ee=Z[V],ne=s("div",[ee.node],"CodeMirror-linewidget"+(ee.className?" "+ee.className:""));ee.handleMouseEvents||ne.setAttribute("cm-ignore-events","true"),Us(ee,ne,r,n),e.display.input.setUneditable(ne),l&&ee.above?M.insertBefore(ne,r.gutter||r.text):M.appendChild(ne),tn(ee,"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 _i(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!x(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 Fr(e,t){for(var r=Te(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 $i(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 Nr(e){return he-e.display.nativeBarWidth}function Qr(e){return e.display.scroller.clientWidth-Nr(e)-e.display.barWidth}function ba(e){return e.display.scroller.clientHeight-Nr(e)-e.display.barHeight}function Bs(e,t,r){var n=e.options.lineWrapping,l=n&&Qr(e);if(!t.measure.heights||n&&t.measure.width!=l){var M=t.measure.heights=[];if(n){t.measure.width=l;for(var V=t.text.firstChild.getClientRects(),Z=0;Z<V.length-1;Z++){var ee=V[Z],ne=V[Z+1];Math.abs(ee.bottom-ne.bottom)>2&&M.push((ee.bottom+ne.top)/2-r.top)}}M.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(it(e.rest[l])>r)return{map:e.measure.maps[l],cache:e.measure.caches[l],before:!0}}function js(e,t){t=$n(t);var r=it(t),n=e.display.externalMeasured=new Un(e.doc,t,r);n.lineN=r;var l=n.built=nn(e,n);return n.text=l.pre,o(e.display.lineMeasure,l.pre),n}function oo(e,t,r,n){return Ur(e,ui(e,t),r,n)}function Ea(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[ti(e,t)];var r=e.display.externalMeasured;if(r&&t>=r.lineN&&t<r.lineN+r.size)return r}function ui(e,t){var r=it(t),n=Ea(e,r);n&&!n.text?n=null:n&&n.changes&&(ar(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 Ur(e,t,r,n,l){t.before&&(r=-1);var M=r+(n||""),V;return t.cache.hasOwnProperty(M)?V=t.cache[M]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Bs(e,t.view,t.rect),t.hasHeights=!0),V=Ws(e,t,r,n),V.bogus||(t.cache[M]=V)),{left:V.left,right:V.right,top:l?V.rtop:V.top,bottom:l?V.rbottom:V.bottom}}var so={left:0,right:0,top:0,bottom:0};function lo(e,t,r){for(var n,l,M,V,Z,ee,ne=0;ne<e.length;ne+=3)if(Z=e[ne],ee=e[ne+1],t<Z?(l=0,M=1,V="left"):t<ee?(l=t-Z,M=l+1):(ne==e.length-3||t==ee&&e[ne+3]>t)&&(M=ee-Z,l=M-1,t>=ee&&(V="right")),l!=null){if(n=e[ne+2],Z==ee&&r==(n.insertLeft?"left":"right")&&(V=r),r=="left"&&l==0)for(;ne&&e[ne-2]==e[ne-3]&&e[ne-1].insertLeft;)n=e[(ne-=3)+2],V="left";if(r=="right"&&l==ee-Z)for(;ne<e.length-3&&e[ne+3]==e[ne+4]&&!e[ne+5].insertLeft;)n=e[(ne+=3)+2],V="right";break}return{node:n,start:l,end:M,collapse:V,coverStart:Z,coverEnd:ee}}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),M=l.node,V=l.start,Z=l.end,ee=l.collapse,ne;if(M.nodeType==3){for(var me=0;me<4;me++){for(;V&&qe(t.line.text.charAt(l.coverStart+V));)--V;for(;l.coverStart+Z<l.coverEnd&&qe(t.line.text.charAt(l.coverStart+Z));)++Z;if(B&&N<9&&V==0&&Z==l.coverEnd-l.coverStart?ne=M.parentNode.getBoundingClientRect():ne=Fs(y(M,V,Z).getClientRects(),n),ne.left||ne.right||V==0)break;Z=V,V=V-1,ee="right"}B&&N<11&&(ne=Hs(e.display.measure,ne))}else{V>0&&(ee=n="right");var ye;e.options.lineWrapping&&(ye=M.getClientRects()).length>1?ne=ye[n=="right"?ye.length-1:0]:ne=M.getBoundingClientRect()}if(B&&N<9&&!V&&(!ne||!ne.left&&!ne.right)){var ke=M.parentNode.getClientRects()[0];ke?ne={left:ke.left,right:ke.left+ci(e.display),top:ke.top,bottom:ke.bottom}:ne=so}for(var Le=ne.top-t.rect.top,Ze=ne.bottom-t.rect.top,ut=(Le+Ze)/2,vt=t.view.measure.heights,wt=0;wt<vt.length-1&&!(ut<vt[wt]);wt++);var Mt=wt?vt[wt-1]:0,_t=vt[wt],Ut={left:(ee=="right"?ne.right:ne.left)-t.rect.left,right:(ee=="left"?ne.left:ne.right)-t.rect.left,top:Mt,bottom:_t};return!ne.left&&!ne.right&&(Ut.bogus=!0),e.options.singleCursorHeightPerLine||(Ut.rtop=Le,Ut.rbottom=Ze),Ut}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!fe(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 Oi(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 m&&u?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function fo(){return m&&u?-(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+=_i(e.widgets[r]));return t}function Ji(e,t,r,n,l){if(!l){var M=xa(t);r.top+=M,r.bottom+=M}if(n=="line")return r;n||(n="local");var V=ir(t);if(n=="local"?V+=$i(e.display):V-=e.display.viewOffset,n=="page"||n=="window"){var Z=e.display.lineSpace.getBoundingClientRect();V+=Z.top+(n=="window"?0:fo());var ee=Z.left+(n=="window"?0:ho());r.left+=ee,r.right+=ee}return r.top+=V,r.bottom+=V,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 M=e.display.sizer.getBoundingClientRect();n+=M.left,l+=M.top}var V=e.display.lineSpace.getBoundingClientRect();return{left:n-V.left,top:l-V.top}}function Ca(e,t,r,n,l){return n||(n=Dt(e.doc,t.line)),Ji(e,n,oo(e,n,t.ch,l),r)}function Lr(e,t,r,n,l,M){n=n||Dt(e.doc,t.line),l||(l=ui(e,n));function V(Ze,ut){var vt=Ur(e,l,Ze,ut?"right":"left",M);return ut?vt.left=vt.right:vt.right=vt.left,Ji(e,n,vt,r)}var Z=St(n,e.doc.direction),ee=t.ch,ne=t.sticky;if(ee>=n.text.length?(ee=n.text.length,ne="before"):ee<=0&&(ee=0,ne="after"),!Z)return V(ne=="before"?ee-1:ee,ne=="before");function me(Ze,ut,vt){var wt=Z[ut],Mt=wt.level==1;return V(vt?Ze-1:Ze,Mt!=vt)}var ye=Et(Z,ee,ne),ke=bt,Le=me(ee,ye,ne=="before");return ke!=null&&(Le.other=me(ee,ke,ne!="before")),Le}function mo(e,t){var r=0;t=f(e.doc,t),e.options.lineWrapping||(r=ci(e.display)*t.ch);var n=Dt(e.doc,t.line),l=ir(n)+$i(e.display);return{left:r,right:r,top:l,bottom:l+n.height}}function Sa(e,t,r,n,l){var M=$e(e,t,r);return M.xRel=l,n&&(M.outside=n),M}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=Pt(n,r),M=n.first+n.size-1;if(l>M)return Sa(n.first+n.size-1,Dt(n,M).text.length,null,1,1);t<0&&(t=0);for(var V=Dt(n,l);;){var Z=Ks(e,V,l,t,r),ee=tr(V,Z.ch+(Z.xRel>0||Z.outside>0?1:0));if(!ee)return Z;var ne=ee.find(1);if(ne.line==l)return ne;V=Dt(n,l=ne.line)}}function go(e,t,r,n){n-=xa(t);var l=t.text.length,M=Ct(function(V){return Ur(e,r,V-1).bottom<=n},l,0);return l=Ct(function(V){return Ur(e,r,V).top>n},M,l),{begin:M,end:l}}function vo(e,t,r,n){r||(r=ui(e,t));var l=Ji(e,t,Ur(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-=ir(t);var M=ui(e,t),V=xa(t),Z=0,ee=t.text.length,ne=!0,me=St(t,e.doc.direction);if(me){var ye=(e.options.lineWrapping?Gs:zs)(e,t,r,M,me,n,l);ne=ye.level!=1,Z=ne?ye.from:ye.to-1,ee=ne?ye.to:ye.from-1}var ke=null,Le=null,Ze=Ct(function($t){var Xt=Ur(e,M,$t);return Xt.top+=V,Xt.bottom+=V,wa(Xt,n,l,!1)?(Xt.top<=l&&Xt.left<=n&&(ke=$t,Le=Xt),!0):!1},Z,ee),ut,vt,wt=!1;if(Le){var Mt=n-Le.left<Le.right-n,_t=Mt==ne;Ze=ke+(_t?0:1),vt=_t?"after":"before",ut=Mt?Le.left:Le.right}else{!ne&&(Ze==ee||Ze==Z)&&Ze++,vt=Ze==0?"after":Ze==t.text.length?"before":Ur(e,M,Ze-(ne?1:0)).bottom+V<=l==ne?"after":"before";var Ut=Lr(e,$e(r,Ze,vt),"line",t,M);ut=Ut.left,wt=l<Ut.top?-1:l>=Ut.bottom?1:0}return Ze=Xe(t.text,Ze,1),Sa(r,Ze,vt,wt,n-ut)}function zs(e,t,r,n,l,M,V){var Z=Ct(function(ye){var ke=l[ye],Le=ke.level!=1;return wa(Lr(e,$e(r,Le?ke.to:ke.from,Le?"before":"after"),"line",t,n),M,V,!0)},0,l.length-1),ee=l[Z];if(Z>0){var ne=ee.level!=1,me=Lr(e,$e(r,ne?ee.from:ee.to,ne?"after":"before"),"line",t,n);wa(me,M,V,!0)&&me.top>V&&(ee=l[Z-1])}return ee}function Gs(e,t,r,n,l,M,V){var Z=go(e,t,n,V),ee=Z.begin,ne=Z.end;/\s/.test(t.text.charAt(ne-1))&&ne--;for(var me=null,ye=null,ke=0;ke<l.length;ke++){var Le=l[ke];if(Le.from>=ne||Le.to<=ee)continue;var Ze=Le.level!=1,ut=Ur(e,n,Ze?Math.min(ne,Le.to)-1:Math.max(ee,Le.from)).right,vt=ut<M?M-ut+1e9:ut-M;(!me||ye>vt)&&(me=Le,ye=vt)}return me||(me=l[l.length-1]),me.from<ee&&(me={from:ee,to:me.to,level:me.level}),me.to>ne&&(me={from:me.from,to:ne,level:me.level}),me}var qr;function di(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 ci(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,M=t.gutters.firstChild,V=0;M;M=M.nextSibling,++V){var Z=e.display.gutterSpecs[V].className;r[Z]=M.offsetLeft+M.clientLeft+l,n[Z]=M.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=di(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/ci(e.display)-3);return function(l){if(nr(e.doc,l))return 0;var M=0;if(l.widgets)for(var V=0;V<l.widgets.length;V++)l.widgets[V].height&&(M+=l.widgets[V].height);return r?M+(Math.ceil(l.text.length/n)||1)*t:M+t}}function Aa(e){var t=e.doc,r=yo(e);t.iter(function(n){var l=r(n);l!=n.height&&Ne(n,l)})}function ei(e,t,r,n){var l=e.display;if(!r&&Te(t).getAttribute("cm-not-content")=="true")return null;var M,V,Z=l.lineSpace.getBoundingClientRect();try{M=t.clientX-Z.left,V=t.clientY-Z.top}catch(ye){return null}var ee=Ta(e,M,V),ne;if(n&&ee.xRel>0&&(ne=Dt(e.doc,ee.line).text).length==ee.ch){var me=$(ne,ne.length,e.options.tabSize)-ne.length;ee=$e(ee.line,Math.max(0,Math.round((M-io(e.display).left)/ci(e.display))-me))}return ee}function ti(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 pr(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)yn&&ur(e.doc,t)<l.viewTo&&Gr(e);else if(r<=l.viewFrom)yn&&Dr(e.doc,r+n)>l.viewFrom?Gr(e):(l.viewFrom+=n,l.viewTo+=n);else if(t<=l.viewFrom&&r>=l.viewTo)Gr(e);else if(t<=l.viewFrom){var M=Zi(e,r,r+n,1);M?(l.view=l.view.slice(M.index),l.viewFrom=M.lineN,l.viewTo+=n):Gr(e)}else if(r>=l.viewTo){var V=Zi(e,t,t,-1);V?(l.view=l.view.slice(0,V.index),l.viewTo=V.lineN):Gr(e)}else{var Z=Zi(e,t,t,-1),ee=Zi(e,r,r+n,1);Z&&ee?(l.view=l.view.slice(0,Z.index).concat(Zt(e,Z.lineN,ee.lineN)).concat(l.view.slice(ee.index)),l.viewTo+=n):Gr(e)}var ne=l.externalMeasured;ne&&(r<ne.lineN?ne.lineN+=n:t<ne.lineN+ne.size&&(l.externalMeasured=null))}function zr(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 M=n.view[ti(e,t)];if(M.node==null)return;var V=M.changes||(M.changes=[]);se(V,r)==-1&&V.push(r)}function Gr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Zi(e,t,r,n){var l=ti(e,t),M,V=e.display.view;if(!yn||r==e.doc.first+e.doc.size)return{index:l,lineN:r};for(var Z=e.display.viewFrom,ee=0;ee<l;ee++)Z+=V[ee].size;if(Z!=t){if(n>0){if(l==V.length-1)return null;M=Z+V[l].size-t,l++}else M=Z-t;t+=M,r+=M}for(;ur(e.doc,r)!=r;){if(l==(n<0?0:V.length-1))return null;r+=n*V[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=Zt(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=Zt(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(ti(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(Zt(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,ti(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 Ai(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(),M=n.selection=document.createDocumentFragment(),V=0;V<r.sel.ranges.length;V++){if(!t&&V==r.sel.primIndex)continue;var Z=r.sel.ranges[V];if(Z.from().line>=e.display.viewTo||Z.to().line<e.display.viewFrom)continue;var ee=Z.empty();(ee||e.options.showCursorWhenSelecting)&&xo(e,Z.head,l),ee||Xs(e,Z,M)}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 M=r.appendChild(s("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));M.style.display="",M.style.left=n.other.left+"px",M.style.top=n.other.top+"px",M.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,M=document.createDocumentFragment(),V=io(e.display),Z=V.left,ee=Math.max(n.sizerWidth,Qr(e)-n.sizer.offsetLeft)-V.right,ne=l.direction=="ltr";function me(_t,Ut,$t,Xt){Ut<0&&(Ut=0),Ut=Math.round(Ut),Xt=Math.round(Xt),M.appendChild(s("div",null,"CodeMirror-selected","position: absolute; left: "+_t+`px;
|
|
top: `+Ut+"px; width: "+($t==null?ee-_t:$t)+`px;
|
|
height: `+(Xt-Ut)+"px"))}function ye(_t,Ut,$t){var Xt=Dt(l,_t),on=Xt.text.length,Pn,Qn;function Bn(zn,vr){return Ca(e,$e(_t,zn),"div",Xt,vr)}function Cr(zn,vr,rr){var Xn=vo(e,Xt,null,zn),Gn=vr=="ltr"==(rr=="after")?"left":"right",jn=rr=="after"?Xn.begin:Xn.end-(/\s/.test(Xt.text.charAt(Xn.end-1))?2:1);return Bn(jn,Gn)[Gn]}var gr=St(Xt,l.direction);return xt(gr,Ut||0,$t==null?on:$t,function(zn,vr,rr,Xn){var Gn=rr=="ltr",jn=Bn(zn,Gn?"left":"right"),yr=Bn(vr-1,Gn?"right":"left"),Ti=Ut==null&&zn==0,Zr=$t==null&&vr==on,sr=Xn==0,Br=!gr||Xn==gr.length-1;if(yr.top-jn.top<=3){var qn=(ne?Ti:Zr)&&sr,qa=(ne?Zr:Ti)&&Br,Hr=qn?Z:(Gn?jn:yr).left,oi=qa?ee:(Gn?yr:jn).right;me(Hr,jn.top,oi-Hr,jn.bottom)}else{var si,hr,wi,eo;Gn?(si=ne&&Ti&&sr?Z:jn.left,hr=ne?ee:Cr(zn,rr,"before"),wi=ne?Z:Cr(vr,rr,"after"),eo=ne&&Zr&&Br?ee:yr.right):(si=ne?Cr(zn,rr,"before"):Z,hr=!ne&&Ti&&sr?ee:jn.right,wi=!ne&&Zr&&Br?Z:yr.left,eo=ne?Cr(vr,rr,"after"):ee),me(si,jn.top,hr-si,jn.bottom),jn.bottom<yr.top&&me(Z,jn.bottom,null,yr.top),me(wi,yr.top,eo-wi,yr.bottom)}(!Pn||Qi(jn,Pn)<0)&&(Pn=jn),Qi(yr,Pn)<0&&(Pn=yr),(!Qn||Qi(jn,Qn)<0)&&(Qn=jn),Qi(yr,Qn)<0&&(Qn=yr)}),{start:Pn,end:Qn}}var ke=t.from(),Le=t.to();if(ke.line==Le.line)ye(ke.line,ke.ch,Le.ch);else{var Ze=Dt(l,ke.line),ut=Dt(l,Le.line),vt=$n(Ze)==$n(ut),wt=ye(ke.line,ke.ch,vt?Ze.text.length+1:null).end,Mt=ye(Le.line,vt?0:null,Le.ch).start;vt&&(wt.top<Mt.top-2?(me(wt.right,wt.top,null,wt.bottom),me(Z,Mt.top,Mt.left,Mt.bottom)):me(wt.right,wt.top,Mt.left-wt.right,wt.bottom)),wt.bottom<Mt.top&&me(Z,wt.bottom,null,Mt.top)}r.appendChild(M)}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()||hi(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,hi(e))},100)}function Ra(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Re(e,"focus",e,t),e.state.focused=!0,j(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),A&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Da(e)}function hi(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Re(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 qi(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var l=t.view[n],M=e.options.lineWrapping,V=void 0,Z=0;if(l.hidden)continue;if(B&&N<8){var ee=l.node.offsetTop+l.node.offsetHeight;V=ee-r,r=ee}else{var ne=l.node.getBoundingClientRect();V=ne.bottom-ne.top,!M&&l.text.firstChild&&(Z=l.text.firstChild.getBoundingClientRect().right-ne.left-1)}var me=l.line.height-V;if((me>.005||me<-.005)&&(Ne(l.line,V),To(l.line),l.rest))for(var ye=0;ye<l.rest.length;ye++)To(l.rest[ye]);if(Z>e.display.sizerWidth){var ke=Math.ceil(Z/ci(e.display));ke>e.display.maxLineLength&&(e.display.maxLineLength=ke,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 ea(e,t,r){var n=r&&r.top!=null?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-$i(e));var l=r&&r.bottom!=null?r.bottom:n+e.wrapper.clientHeight,M=Pt(t,n),V=Pt(t,l);if(r&&r.ensure){var Z=r.ensure.from.line,ee=r.ensure.to.line;Z<M?(M=Z,V=Pt(t,ir(Dt(t,Z))+e.wrapper.clientHeight)):Math.min(ee,t.lastLine())>=V&&(M=Pt(t,ir(Dt(t,ee))-e.wrapper.clientHeight),V=ee)}return{from:M,to:Math.max(V,M+1)}}function Ys(e,t){if(Ue(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&&!E){var M=s("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-r.viewOffset-$i(e.display))+`px;
|
|
height: `+(t.bottom-t.top+Nr(e)+r.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(M),M.scrollIntoView(l),e.display.lineSpace.removeChild(M)}}function $s(e,t,r,n){n==null&&(n=0);var l;!e.options.lineWrapping&&t==r&&(t=t.ch?$e(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,r=t.sticky=="before"?$e(t.line,t.ch+1,"before"):t);for(var M=0;M<5;M++){var V=!1,Z=Lr(e,t),ee=!r||r==t?Z:Lr(e,r);l={left:Math.min(Z.left,ee.left),top:Math.min(Z.top,ee.top)-n,right:Math.max(Z.left,ee.left),bottom:Math.max(Z.bottom,ee.bottom)+n};var ne=La(e,l),me=e.doc.scrollTop,ye=e.doc.scrollLeft;if(ne.scrollTop!=null&&(Ri(e,ne.scrollTop),Math.abs(e.doc.scrollTop-me)>1&&(V=!0)),ne.scrollLeft!=null&&(ni(e,ne.scrollLeft),Math.abs(e.doc.scrollLeft-ye)>1&&(V=!0)),!V)break}return l}function Js(e,t){var r=La(e,t);r.scrollTop!=null&&Ri(e,r.scrollTop),r.scrollLeft!=null&&ni(e,r.scrollLeft)}function La(e,t){var r=e.display,n=di(e.display);t.top<0&&(t.top=0);var l=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:r.scroller.scrollTop,M=ba(e),V={};t.bottom-t.top>M&&(t.bottom=t.top+M);var Z=e.doc.height+ya(r),ee=t.top<n,ne=t.bottom>Z-n;if(t.top<l)V.scrollTop=ee?0:t.top;else if(t.bottom>l+M){var me=Math.min(t.top,(ne?Z:t.bottom)-M);me!=l&&(V.scrollTop=me)}var ye=e.options.fixedGutter?0:r.gutters.offsetWidth,ke=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:r.scroller.scrollLeft-ye,Le=Qr(e)-r.gutters.offsetWidth,Ze=t.right-t.left>Le;return Ze&&(t.right=t.left+Le),t.left<10?V.scrollLeft=0:t.left<ke?V.scrollLeft=Math.max(0,t.left+ye-(Ze?0:10)):t.right>Le+ke-3&&(V.scrollLeft=t.right+(Ze?0:10)-Le),V}function Ma(e,t){if(t==null)return;ta(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function fi(e){ta(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Di(e,t,r){(t!=null||r!=null)&&ta(e),t!=null&&(e.curOp.scrollLeft=t),r!=null&&(e.curOp.scrollTop=r)}function Zs(e,t){ta(e),e.curOp.scrollToPos=t}function ta(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});Di(e,l.scrollLeft,l.scrollTop)}function Ri(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;L||ka(e,{top:t}),_o(e,t,!0),L&&ka(e),Pi(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 ni(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 Li(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+Nr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var ri=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),Ee(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),Ee(l,"scroll",function(){l.clientWidth&&t(l.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,B&&N<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};ri.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 M=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+M)+"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}},ri.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},ri.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},ri.prototype.zeroWidthHack=function(){var e=i&&!_?"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},ri.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto";function n(){var l=e.getBoundingClientRect(),M=r=="vert"?document.elementFromPoint(l.right-1,(l.top+l.bottom)/2):document.elementFromPoint((l.right+l.left)/2,l.bottom-1);M!=e?e.style.pointerEvents="none":t.set(1e3,n)}t.set(1e3,n)},ri.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Mi=function(){};Mi.prototype.update=function(){return{bottom:0,right:0}},Mi.prototype.setScrollLeft=function(){},Mi.prototype.setScrollTop=function(){},Mi.prototype.clear=function(){};function pi(e,t){t||(t=Li(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&&qi(e),Oo(e,Li(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:ri,null:Mi};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),Ee(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"?ni(e,t):Ri(e,t)},e),e.display.scrollbars.addClass&&j(e.display.wrapper,e.display.scrollbars.addClass)}var Qs=0;function ii(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:++Qs},Vt(e.curOp)}function ai(e){var t=e.curOp;t&&an(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 M=0;M<t.length;M++)rl(t[M]);for(var V=0;V<t.length;V++)il(t[V])}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 na(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&&qi(t),e.barMeasure=Li(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+Nr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Qr(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&&ni(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==P();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&pi(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&&ni(t,e.scrollLeft,!0,!0),e.scrollToPos){var l=$s(t,f(n,e.scrollToPos.from),f(n,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,l)}var M=e.maybeHiddenMarkers,V=e.maybeUnhiddenMarkers;if(M)for(var Z=0;Z<M.length;++Z)M[Z].lines.length||Re(M[Z],"hide");if(V)for(var ee=0;ee<V.length;++ee)V[ee].lines.length&&Re(V[ee],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Re(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function xr(e,t){if(e.curOp)return t();ii(e);try{return t()}finally{ai(e)}}function Jn(e,t){return function(){if(e.curOp)return t.apply(e,arguments);ii(e);try{return t.apply(e,arguments)}finally{ai(e)}}}function cr(e){return function(){if(this.curOp)return e.apply(this,arguments);ii(this);try{return e.apply(this,arguments)}finally{ai(this)}}}function Zn(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);ii(t);try{return e.apply(this,arguments)}finally{ai(t)}}}function Pi(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,X(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var r=+new Date+e.options.workTime,n=ht(e,t.highlightFrontier),l=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),function(M){if(n.line>=e.display.viewFrom){var V=M.styles,Z=M.text.length>e.options.maxHighlightLength?pt(t.mode,n.state):null,ee=ve(e,M,n,!0);Z&&(n.state=Z),M.styles=ee.styles;var ne=M.styleClasses,me=ee.classes;me?M.styleClasses=me:ne&&(M.styleClasses=null);for(var ye=!V||V.length!=M.styles.length||ne!=me&&(!ne||!me||ne.bgClass!=me.bgClass||ne.textClass!=me.textClass),ke=0;!ye&&ke<V.length;++ke)ye=V[ke]!=M.styles[ke];ye&&l.push(n.line),M.stateAfter=n.save(),n.nextLine()}else M.text.length<=e.options.maxHighlightLength&&Tt(e,M.text,n),M.stateAfter=n.line%5==0?n.save():null,n.nextLine();if(+new Date>r)return Pi(e,e.options.workDelay),!0}),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),l.length&&xr(e,function(){for(var M=0;M<l.length;M++)zr(e,l[M],"text")})}var na=function(e,t,r){var n=e.display;this.viewport=t,this.visible=ea(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=Qr(e),this.force=r,this.dims=_a(e),this.events=[]};na.prototype.signal=function(e,t){de(e,t)&&this.events.push(arguments)},na.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Re.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=Nr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Nr(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=P();if(!t||!x(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&x(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==P())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&x(document.body,e.anchorNode)&&x(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 Gr(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)&&(Gr(e),t.dims=_a(e));var l=n.first+n.size,M=Math.max(t.visible.from-e.options.viewportMargin,n.first),V=Math.min(l,t.visible.to+e.options.viewportMargin);r.viewFrom<M&&M-r.viewFrom<20&&(M=Math.max(n.first,r.viewFrom)),r.viewTo>V&&r.viewTo-V<20&&(V=Math.min(l,r.viewTo)),yn&&(M=ur(e.doc,M),V=Dr(e.doc,V));var Z=M!=r.viewFrom||V!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Vs(e,M,V),r.viewOffset=ir(Dt(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var ee=bo(e);if(!Z&&ee==0&&!t.force&&r.renderedView==r.view&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo))return!1;var ne=sl(e);return ee>4&&(r.lineDiv.style.display="none"),ul(e,r.updateLineNumbers,t.dims),ee>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,ll(ne),d(r.cursorDiv),d(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,Z&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,Pi(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==Qr(e)){if(r&&r.top!=null&&(r={top:Math.min(e.doc.height+ya(e.display)-ba(e),r.top)}),t.visible=ea(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else n&&(t.visible=ea(e.display,e.doc,r));if(!Pa(e,t))break;qi(e);var l=Li(e);Ai(e),pi(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 na(e,t);if(Pa(e,r)){qi(e),Ro(e,r);var n=Li(e);Ai(e),pi(e,n),Na(e,n),r.finish()}}function ul(e,t,r){var n=e.display,l=e.options.lineNumbers,M=n.lineDiv,V=M.firstChild;function Z(Ze){var ut=Ze.nextSibling;return A&&i&&e.display.currentWheelTarget==Ze?Ze.style.display="none":Ze.parentNode.removeChild(Ze),ut}for(var ee=n.view,ne=n.viewFrom,me=0;me<ee.length;me++){var ye=ee[me];if(!ye.hidden)if(!ye.node||ye.node.parentNode!=M){var ke=Ns(e,ye,ne,r);M.insertBefore(ke,V)}else{for(;V!=ye.node;)V=Z(V);var Le=l&&t!=null&&t<=ne&&ye.lineNumber;ye.changes&&(se(ye.changes,"gutter")>-1&&(Le=!1),ar(e,ye,ne,r)),Le&&(d(ye.lineNumber),ye.lineNumber.appendChild(document.createTextNode(un(e.options,ne)))),V=ye.node.nextSibling}ne+=ye.size}for(;V;)V=Z(V)}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+Nr(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,M=n+"px",V=0;V<r.length;V++)if(!r[V].hidden){e.options.fixedGutter&&(r[V].gutter&&(r[V].gutter.style.left=M),r[V].gutterBackground&&(r[V].gutterBackground.style.left=M));var Z=r[V].alignable;if(Z)for(var ee=0;ee<Z.length;ee++)Z[ee].style.left=M}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")),M=l.firstChild.offsetWidth,V=l.offsetWidth-M;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(M,n.lineGutter.offsetWidth-V)+1,n.lineNumWidth=n.lineNumInnerWidth+V,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 M=e[l],V=null;if(typeof M!="string"&&(V=M.style,M=M.className),M=="CodeMirror-linenumbers")if(t)n=!0;else continue;r.push({className:M,style:V})}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],M=l.className,V=l.style,Z=t.appendChild(s("div",null,"CodeMirror-gutter "+M));V&&(Z.style.cssText=V),M=="CodeMirror-linenumbers"&&(e.lineGutter=Z,Z.style.width=(e.lineNumWidth||1)+"px")}t.style.display=r.length?"":"none",Ia(e)}function ki(e){Po(e.display),pr(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=C("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=C("div",[l.measure,l.lineMeasure,l.selectionDiv,l.cursorDiv,l.lineDiv],null,"position: relative; outline: none");var M=C("div",[l.lineSpace],"CodeMirror-lines");l.mover=s("div",[M],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"),B&&N<8&&(l.gutters.style.zIndex=-1,l.scroller.style.paddingRight=0),!A&&!(L&&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 ra=0,Tr=null;B?Tr=-.53:L?Tr=15:m?Tr=-.7:R&&(Tr=-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*=Tr,t.y*=Tr,t}function Io(e,t){var r=ko(t),n=r.x,l=r.y,M=e.display,V=M.scroller,Z=V.scrollWidth>V.clientWidth,ee=V.scrollHeight>V.clientHeight;if(!(n&&Z||l&&ee))return;if(l&&i&&A){e:for(var ne=t.target,me=M.view;ne!=V;ne=ne.parentNode)for(var ye=0;ye<me.length;ye++)if(me[ye].node==ne){e.display.currentWheelTarget=ne;break e}}if(n&&!L&&!O&&Tr!=null){l&&ee&&Ri(e,Math.max(0,V.scrollTop+l*Tr)),ni(e,Math.max(0,V.scrollLeft+n*Tr)),(!l||l&&ee)&&te(t),M.wheelStartX=null;return}if(l&&Tr!=null){var ke=l*Tr,Le=e.doc.scrollTop,Ze=Le+M.wrapper.clientHeight;ke<0?Le=Math.max(0,Le+ke-50):Ze=Math.min(e.doc.height,Ze+ke+50),ka(e,{top:Le,bottom:Ze})}ra<20&&(M.wheelStartX==null?(M.wheelStartX=V.scrollLeft,M.wheelStartY=V.scrollTop,M.wheelDX=n,M.wheelDY=l,setTimeout(function(){if(M.wheelStartX==null)return;var ut=V.scrollLeft-M.wheelStartX,vt=V.scrollTop-M.wheelStartY,wt=vt&&M.wheelDY&&vt/M.wheelDY||ut&&M.wheelDX&&ut/M.wheelDX;if(M.wheelStartX=M.wheelStartY=null,!wt)return;Tr=(Tr*ra+wt)/(ra+1),++ra},200)):(M.wheelDX+=n,M.wheelDY+=l))}var wr=function(e,t){this.ranges=e,this.primIndex=t};wr.prototype.primary=function(){return this.ranges[this.primIndex]},wr.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(!Ht(r.anchor,n.anchor)||!Ht(r.head,n.head))return!1}return!0},wr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Tn(jt(this.ranges[t].anchor),jt(this.ranges[t].head));return new wr(e,this.primIndex)},wr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},wr.prototype.contains=function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(Ot(t,n.from())>=0&&Ot(e,n.to())<=0)return r}return-1};var Tn=function(e,t){this.anchor=e,this.head=t};Tn.prototype.from=function(){return Jt(this.anchor,this.head)},Tn.prototype.to=function(){return mn(this.anchor,this.head)},Tn.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(ke,Le){return Ot(ke.from(),Le.from())}),r=se(t,l);for(var M=1;M<t.length;M++){var V=t[M],Z=t[M-1],ee=Ot(Z.to(),V.from());if(n&&!V.empty()?ee>0:ee>=0){var ne=Jt(Z.from(),V.from()),me=mn(Z.to(),V.to()),ye=Z.empty()?V.from()==V.head:Z.from()==Z.head;M<=r&&--r,t.splice(--M,2,new Tn(ye?me:ne,ye?ne:me))}}return new wr(t,r)}function Vr(e,t){return new wr([new Tn(e,t||e)],0)}function Xr(e){return e.text?$e(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(Ot(e,t.from)<0)return e;if(Ot(e,t.to)<=0)return Xr(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+=Xr(t).ch-t.to.ch),$e(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 Tn(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?$e(r.line,e.ch-t.ch+r.ch):$e(r.line+(e.line-t.line),e.ch)}function hl(e,t,r){for(var n=[],l=$e(e.first,0),M=l,V=0;V<t.length;V++){var Z=t[V],ee=Uo(Z.from,l,M),ne=Uo(Xr(Z),l,M);if(l=Z.to,M=ne,r=="around"){var me=e.sel.ranges[V],ye=Ot(me.head,me.anchor)<0;n[V]=new Tn(ye?ne:ee,ye?ee:ne)}else n[V]=new Tn(ee,ee)}return new wr(n,e.sel.primIndex)}function ja(e){e.doc.mode=nt(e.options,e.doc.modeOption),Ii(e)}function Ii(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,Pi(e,100),e.state.modeGen++,e.curOp&&pr(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(Mt){return r?r[Mt]:null}function M(Mt,_t,Ut){Kr(Mt,_t,Ut,n),tn(Mt,"change",Mt,t)}function V(Mt,_t){for(var Ut=[],$t=Mt;$t<_t;++$t)Ut.push(new dr(ne[$t],l($t),n));return Ut}var Z=t.from,ee=t.to,ne=t.text,me=Dt(e,Z.line),ye=Dt(e,ee.line),ke=Me(ne),Le=l(ne.length-1),Ze=ee.line-Z.line;if(t.full)e.insert(0,V(0,ne.length)),e.remove(ne.length,e.size-ne.length);else if(Bo(e,t)){var ut=V(0,ne.length-1);M(ye,ye.text,Le),Ze&&e.remove(Z.line,Ze),ut.length&&e.insert(Z.line,ut)}else if(me==ye)if(ne.length==1)M(me,me.text.slice(0,Z.ch)+ke+me.text.slice(ee.ch),Le);else{var vt=V(1,ne.length-1);vt.push(new dr(ke+me.text.slice(ee.ch),Le,n)),M(me,me.text.slice(0,Z.ch)+ne[0],l(0)),e.insert(Z.line+1,vt)}else if(ne.length==1)M(me,me.text.slice(0,Z.ch)+ne[0]+ye.text.slice(ee.ch),l(0)),e.remove(Z.line+1,Ze);else{M(me,me.text.slice(0,Z.ch)+ne[0],l(0)),M(ye,ke+ye.text.slice(ee.ch),Le);var wt=V(1,ne.length-1);Ze>1&&e.remove(Z.line+1,Ze-1),e.insert(Z.line+1,wt)}tn(e,"change",e,t)}function Yr(e,t,r){function n(l,M,V){if(l.linked)for(var Z=0;Z<l.linked.length;++Z){var ee=l.linked[Z];if(ee.doc==M)continue;var ne=V&&ee.sharedHist;if(r&&!ne)continue;t(ee.doc,ne),n(ee.doc,l,ne)}}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,pr(e)}function Fo(e){(e.doc.direction=="rtl"?j:h)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){xr(e,function(){Fo(e),pr(e)})}function ia(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:jt(t.from),to:Xr(t),text:Sn(e,t.from,t.to)};return Ko(e,r,t.from.line,t.to.line+1),Yr(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 M=+new Date,V,Z;if((l.lastOp==n||l.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&l.lastModTime>M-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(V=pl(l,l.lastOp==n)))Z=Me(V.changes),Ot(t.from,t.to)==0&&Ot(t.from,Z.to)==0?Z.to=Xr(t):V.changes.push(Wa(e,t));else{var ee=Me(l.done);for((!ee||!ee.ranges)&&aa(e.sel,l.done),V={changes:[Wa(e,t)],generation:l.generation},l.done.push(V);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=M,l.lastOp=l.lastSelOp=n,l.lastOrigin=l.lastSelOrigin=t.origin,Z||Re(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,M=n&&n.origin;r==l.lastSelOp||M&&l.lastSelOrigin==M&&(l.lastModTime==l.lastSelTime&&l.lastOrigin==M||ml(e,M,Me(l.done),t))?l.done[l.done.length-1]=t:aa(t,l.done),l.lastSelTime=+new Date,l.lastSelOrigin=M,l.lastSelOp=r,n&&n.clearRedo!==!1&&Wo(l.undone)}function aa(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],M=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(V){V.markedSpans&&((l||(l=t["spans_"+e.id]={}))[M]=V.markedSpans),++M})}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=fr(e,t);if(!r)return n;if(!n)return r;for(var l=0;l<r.length;++l){var M=r[l],V=n[l];if(M&&V){e:for(var Z=0;Z<V.length;++Z){for(var ee=V[Z],ne=0;ne<M.length;++ne)if(M[ne].marker==ee.marker)continue e;M.push(ee)}}else V&&(r[l]=V)}return r}function mi(e,t,r){for(var n=[],l=0;l<e.length;++l){var M=e[l];if(M.ranges){n.push(r?wr.prototype.deepCopy.call(M):M);continue}var V=M.changes,Z=[];n.push({changes:Z});for(var ee=0;ee<V.length;++ee){var ne=V[ee],me=void 0;if(Z.push({from:ne.from,to:ne.to,text:ne.text}),t)for(var ye in ne)(me=ye.match(/^spans_(\d+)$/))&&(se(t,Number(me[1]))>-1&&(Me(Z)[ye]=ne[ye],delete ne[ye]))}}return n}function Ha(e,t,r,n){if(n){var l=e.anchor;if(r){var M=Ot(t,l)<0;M!=Ot(r,l)<0?(l=t,t=r):M!=Ot(t,r)<0&&(t=r)}return new Tn(l,t)}else return new Tn(r||t,t)}function oa(e,t,r,n,l){l==null&&(l=e.cm&&(e.cm.display.shift||e.extend)),or(e,new wr([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),M=0;M<e.sel.ranges.length;M++)n[M]=Ha(e.sel.ranges[M],t[M],null,l);var V=Mr(e.cm,n,e.sel.primIndex);or(e,V,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,Vr(t,r),n)}function bl(e,t,r){var n={ranges:t.ranges,update:function(l){this.ranges=[];for(var M=0;M<l.length;M++)this.ranges[M]=new Tn(f(e,l[M].anchor),f(e,l[M].head))},origin:r&&r.origin};return Re(e,"beforeSelectionChange",e,n),e.cm&&Re(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,sa(e,t,r)):or(e,t,r)}function or(e,t,r){sa(e,t,r),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function sa(e,t,r){(de(e,"beforeSelectionChange")||e.cm&&de(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,r));var n=r&&r.bias||(Ot(t.primary().head,e.sel.primary().head)<0?-1:1);Yo(e,Jo(e,t,n,!0)),!(r&&r.scroll===!1)&&e.cm&&fi(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)),tn(e,"cursorActivity",e)}function $o(e){Yo(e,Jo(e,e.sel,null,!1))}function Jo(e,t,r,n){for(var l,M=0;M<t.ranges.length;M++){var V=t.ranges[M],Z=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[M],ee=la(e,V.anchor,Z&&Z.anchor,r,n),ne=la(e,V.head,Z&&Z.head,r,n);(l||ee!=V.anchor||ne!=V.head)&&(l||(l=t.ranges.slice(0,M)),l[M]=new Tn(ee,ne))}return l?Mr(e.cm,l,t.primIndex):t}function gi(e,t,r,n,l){var M=Dt(e,t.line);if(M.markedSpans)for(var V=0;V<M.markedSpans.length;++V){var Z=M.markedSpans[V],ee=Z.marker,ne="selectLeft"in ee?!ee.selectLeft:ee.inclusiveLeft,me="selectRight"in ee?!ee.selectRight:ee.inclusiveRight;if((Z.from==null||(ne?Z.from<=t.ch:Z.from<t.ch))&&(Z.to==null||(me?Z.to>=t.ch:Z.to>t.ch))){if(l&&(Re(ee,"beforeCursorEnter"),ee.explicitlyCleared))if(M.markedSpans){--V;continue}else break;if(!ee.atomic)continue;if(r){var ye=ee.find(n<0?1:-1),ke=void 0;if((n<0?me:ne)&&(ye=Zo(e,ye,-n,ye&&ye.line==t.line?M:null)),ye&&ye.line==t.line&&(ke=Ot(ye,r))&&(n<0?ke<0:ke>0))return gi(e,ye,t,n,l)}var Le=ee.find(n<0?-1:1);return(n<0?ne:me)&&(Le=Zo(e,Le,n,Le.line==t.line?M:null)),Le?gi(e,Le,t,n,l):null}}return t}function la(e,t,r,n,l){var M=n||1,V=gi(e,t,r,M,l)||!l&&gi(e,t,r,M,!0)||gi(e,t,r,-M,l)||!l&&gi(e,t,r,-M,!0);return V||(e.cantEdit=!0,$e(e.first,0))}function Zo(e,t,r,n){return r<0&&t.ch==0?t.line>e.first?f(e,$e(t.line-1)):null:r>0&&t.ch==(n||Dt(e,t.line)).text.length?t.line<e.first+e.size-1?$e(t.line+1,0):null:new $e(t.line,t.ch+r)}function Qo(e){e.setSelection($e(e.firstLine(),0),$e(e.lastLine()),xe)}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,M,V,Z){l&&(n.from=f(e,l)),M&&(n.to=f(e,M)),V&&(n.text=V),Z!==void 0&&(n.origin=Z)}),Re(e,"beforeChange",e,n),e.cm&&Re(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 vi(e,t,r){if(e.cm){if(!e.cm.curOp)return Jn(e.cm,vi)(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=wn&&!r&&lr(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]==""&&Ot(t.from,t.to)==0)return;var r=Ba(e,t);Ho(e,t,r,e.cm?e.cm.curOp.id:NaN),Ni(e,t,r,fr(e,t));var n=[];Yr(e,function(l,M){!M&&se(n,l.history)==-1&&(is(l.history,t),n.push(l.history)),Ni(l,t,null,fr(l,t))})}function ua(e,t,r){var n=e.cm&&e.cm.state.suppressEdits;if(n&&!r)return;for(var l=e.history,M,V=e.sel,Z=t=="undo"?l.done:l.undone,ee=t=="undo"?l.undone:l.done,ne=0;ne<Z.length&&!(M=Z[ne],r?M.ranges&&!M.equals(e.sel):!M.ranges);ne++);if(ne==Z.length)return;for(l.lastOrigin=l.lastSelOrigin=null;;)if(M=Z.pop(),M.ranges){if(aa(M,ee),r&&!M.equals(e.sel)){or(e,M,{clearRedo:!1});return}V=M}else if(n){Z.push(M);return}else break;var me=[];aa(V,ee),ee.push({changes:me,generation:l.generation}),l.generation=M.generation||++l.maxGeneration;for(var ye=de(e,"beforeChange")||e.cm&&de(e.cm,"beforeChange"),ke=function(ut){var vt=M.changes[ut];if(vt.origin=t,ye&&!qo(e,vt,!1))return Z.length=0,{};me.push(Wa(e,vt));var wt=ut?Ba(e,vt):Me(Z);Ni(e,vt,wt,zo(e,vt)),!ut&&e.cm&&e.cm.scrollIntoView({from:vt.from,to:Xr(vt)});var Mt=[];Yr(e,function(_t,Ut){!Ut&&se(Mt,_t.history)==-1&&(is(_t.history,vt),Mt.push(_t.history)),Ni(_t,vt,null,zo(_t,vt))})},Le=M.changes.length-1;Le>=0;--Le){var Ze=ke(Le);if(Ze)return Ze.v}}function ts(e,t){if(t==0)return;if(e.first+=t,e.sel=new wr(at(e.sel.ranges,function(l){return new Tn($e(l.anchor.line+t,l.anchor.ch),$e(l.head.line+t,l.head.ch))}),e.sel.primIndex),e.cm){pr(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)zr(e.cm,n,"gutter")}}function Ni(e,t,r,n){if(e.cm&&!e.cm.curOp)return Jn(e.cm,Ni)(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:$e(e.first,0),to:$e(t.to.line+l,t.to.ch),text:[Me(t.text)],origin:t.origin}}var M=e.lastLine();t.to.line>M&&(t={from:t.from,to:$e(M,Dt(e,M).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Sn(e,t.from,t.to),r||(r=Ba(e,t)),e.cm?El(e.cm,t,n):Fa(e,t,n),sa(e,r,xe),e.cantEdit&&la(e,$e(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,r){var n=e.doc,l=e.display,M=t.from,V=t.to,Z=!1,ee=M.line;e.options.lineWrapping||(ee=it($n(Dt(n,M.line))),n.iter(ee,V.line+1,function(Le){if(Le==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(ee,M.line+t.text.length,function(Le){var Ze=Rr(Le);Ze>l.maxLineLength&&(l.maxLine=Le,l.maxLineLength=Ze,l.maxLineChanged=!0,Z=!1)}),Z&&(e.curOp.updateMaxLine=!0)),hn(n,M.line),Pi(e,400);var ne=t.text.length-(V.line-M.line)-1;t.full?pr(e):M.line==V.line&&t.text.length==1&&!Bo(e.doc,t)?zr(e,M.line,"text"):pr(e,M.line,V.line+1,ne);var me=de(e,"changes"),ye=de(e,"change");if(ye||me){var ke={from:M,to:V,text:t.text,removed:t.removed,origin:t.origin};ye&&tn(e,"change",e,ke),me&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(ke)}e.display.selForContextMenu=null}function yi(e,t,r,n,l){var M;n||(n=r),Ot(n,r)<0&&(M=[n,r],r=M[0],n=M[1]),typeof t=="string"&&(t=e.splitLines(t)),vi(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 M=e[l],V=!0;if(M.ranges){M.copied||(M=e[l]=M.deepCopy(),M.copied=!0);for(var Z=0;Z<M.ranges.length;Z++)ns(M.ranges[Z].anchor,t,r,n),ns(M.ranges[Z].head,t,r,n);continue}for(var ee=0;ee<M.changes.length;++ee){var ne=M.changes[ee];if(r<ne.from.line)ne.from=$e(ne.from.line+n,ne.from.ch),ne.to=$e(ne.to.line+n,ne.to.ch);else if(t<=ne.to.line){V=!1;break}}V||(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 Ui(e,t,r,n){var l=t,M=t;return typeof t=="number"?M=Dt(e,H(e,t)):l=it(t),l==null?null:(n(M,l)&&e.cm&&zr(e.cm,l,r),M)}function Bi(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}Bi.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,jr(l),tn(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 ji(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}ji.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 M=Math.min(t,l-e),V=n.height;if(n.removeInner(e,M),this.height-=V-n.height,l==M&&(this.children.splice(r--,1),n.parent=null),(t-=M)==0)break;e=0}else e-=l}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Bi))){var Z=[];this.collapse(Z),this.children=[new Bi(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],M=l.chunkSize();if(e<=M){if(l.insertInner(e,t,r),l.lines&&l.lines.length>50){for(var V=l.lines.length%25+25,Z=V;Z<l.lines.length;){var ee=new Bi(l.lines.slice(Z,Z+=25));l.height-=ee.height,this.children.splice(++n,0,ee),ee.parent=this}l.lines=l.lines.slice(0,V),this.maybeSpill()}break}e-=M}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new ji(t);if(e.parent){e.size-=r.size,e.height-=r.height;var l=se(e.parent.children,e);e.parent.children.splice(l+1,0,r)}else{var n=new ji(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],M=l.chunkSize();if(e<M){var V=Math.min(t,M-e);if(l.iterN(e,V,r))return!0;if((t-=V)==0)break;e=0}else e-=M}}};var Fi=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.doc=e,this.node=t};Fi.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=it(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 M=_i(this);Ne(r,Math.max(0,r.height-M)),e&&(xr(e,function(){as(e,r,-M),zr(e,n,"widget")}),tn(e,"lineWidgetCleared",e,this,n))},Fi.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,n=this.line;this.height=null;var l=_i(this)-t;if(!l)return;nr(this.doc,n)||Ne(n,n.height+l),r&&xr(r,function(){r.curOp.forceUpdate=!0,as(r,n,l),tn(r,"lineWidgetChanged",r,e,it(n))})},ce(Fi);function as(e,t,r){ir(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Ma(e,r)}function xl(e,t,r,n){var l=new Fi(e,r,n),M=e.cm;return M&&l.noHScroll&&(M.display.alignWidgets=!0),Ui(e,t,"widget",function(V){var Z=V.widgets||(V.widgets=[]);if(l.insertAt==null?Z.push(l):Z.splice(Math.min(Z.length-1,Math.max(0,l.insertAt)),0,l),l.line=V,M&&!nr(e,V)){var ee=ir(V)<e.scrollTop;Ne(V,V.height+_i(l)),ee&&Ma(M,l.height),M.curOp.forceUpdate=!0}return!0}),M&&tn(M,"lineWidgetAdded",M,l,typeof t=="number"?t:it(t)),l}var os=0,$r=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++os};$r.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&ii(e),de(this,"clear")){var r=this.find();r&&tn(this,"clear",r.from,r.to)}for(var n=null,l=null,M=0;M<this.lines.length;++M){var V=this.lines[M],Z=En(V.markedSpans,this);e&&!this.collapsed?zr(e,it(V),"text"):e&&(Z.to!=null&&(l=it(V)),Z.from!=null&&(n=it(V))),V.markedSpans=Yn(V.markedSpans,Z),Z.from==null&&this.collapsed&&!nr(this.doc,V)&&e&&Ne(V,di(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var ee=0;ee<this.lines.length;++ee){var ne=$n(this.lines[ee]),me=Rr(ne);me>e.display.maxLineLength&&(e.display.maxLine=ne,e.display.maxLineLength=me,e.display.maxLineChanged=!0)}n!=null&&e&&this.collapsed&&pr(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&&tn(e,"markerCleared",e,this,n,l),t&&ai(e),this.parent&&this.parent.clear()},$r.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var r,n,l=0;l<this.lines.length;++l){var M=this.lines[l],V=En(M.markedSpans,this);if(V.from!=null&&(r=$e(t?M:it(M),V.from),e==-1))return r;if(V.to!=null&&(n=$e(t?M:it(M),V.to),e==1))return n}return r&&{from:r,to:n}},$r.prototype.changed=function(){var e=this,t=this.find(-1,!0),r=this,n=this.doc.cm;if(!t||!n)return;xr(n,function(){var l=t.line,M=it(t.line),V=Ea(n,M);if(V&&(uo(V),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!nr(r.doc,l)&&r.height!=null){var Z=r.height;r.height=null;var ee=_i(r)-Z;ee&&Ne(l,l.height+ee)}tn(n,"markerChanged",n,e)})},$r.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||se(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},$r.prototype.detachLine=function(e){if(this.lines.splice(se(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ce($r);function bi(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,bi)(e,t,r,n,l);var M=new $r(e,l),V=Ot(t,r);if(n&&F(n,M,!1),V>0||V==0&&M.clearWhenEmpty!==!1)return M;if(M.replacedWith&&(M.collapsed=!0,M.widgetNode=C("span",[M.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||M.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(M.widgetNode.insertLeft=!0)),M.collapsed){if(Ln(e,t.line,t,r,M)||t.line!=r.line&&Ln(e,r.line,t,r,M))throw new Error("Inserting collapsed marker partially overlapping an existing one");fn()}M.addToHistory&&Ho(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var Z=t.line,ee=e.cm,ne;if(e.iter(Z,r.line+1,function(ye){ee&&M.collapsed&&!ee.options.lineWrapping&&$n(ye)==ee.display.maxLine&&(ne=!0),M.collapsed&&Z!=t.line&&Ne(ye,0),Kn(ye,new bn(M,Z==t.line?t.ch:null,Z==r.line?r.ch:null)),++Z}),M.collapsed&&e.iter(t.line,r.line+1,function(ye){nr(e,ye)&&Ne(ye,0)}),M.clearOnEnter&&Ee(M,"beforeCursorEnter",function(){return M.clear()}),M.readOnly&&(Cn(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),M.collapsed&&(M.id=++os,M.atomic=!0),ee){if(ne&&(ee.curOp.updateMaxLine=!0),M.collapsed)pr(ee,t.line,r.line+1);else if(M.className||M.startStyle||M.endStyle||M.css||M.attributes||M.title)for(var me=t.line;me<=r.line;me++)zr(ee,me,"text");M.atomic&&$o(ee.doc),tn(ee,"markerAdded",ee,M)}return M}var Wi=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};Wi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();tn(this,"clear")},Wi.prototype.find=function(e,t){return this.primary.find(e,t)},ce(Wi);function Cl(e,t,r,n,l){n=F(n),n.shared=!1;var M=[bi(e,t,r,n,l)],V=M[0],Z=n.widgetNode;return Yr(e,function(ee){Z&&(n.widgetNode=Z.cloneNode(!0)),M.push(bi(ee,f(ee,t),f(ee,r),n,l));for(var ne=0;ne<ee.linked.length;++ne)if(ee.linked[ne].isParent)return;V=Me(M)}),new Wi(M,V)}function ss(e){return e.findMarks($e(e.first,0),e.clipPos($e(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(),M=e.clipPos(l.from),V=e.clipPos(l.to);if(Ot(M,V)){var Z=bi(e,M,V,n.primary,n.primary.type);n.markers.push(Z),Z.parent=n}}}function Tl(e){for(var t=function(n){var l=e[n],M=[l.primary.doc];Yr(l.primary.doc,function(ee){return M.push(ee)});for(var V=0;V<l.markers.length;V++){var Z=l.markers[V];se(M,Z.doc)==-1&&(Z.parent=null,l.markers.splice(V--,1))}},r=0;r<e.length;r++)t(r)}var wl=0,mr=function(e,t,r,n,l){if(!(this instanceof mr))return new mr(e,t,r,n,l);r==null&&(r=0),ji.call(this,[new Bi([new dr("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var M=$e(r,0);this.sel=Vr(M),this.history=new ia(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:M,to:M,text:e}),or(this,Vr(M),xe)};mr.prototype=Qe(ji.prototype,{constructor:mr,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=Nn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Zn(function(e){var t=$e(this.first,0),r=this.first+this.size-1;vi(this,{from:t,to:$e(r,Dt(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Di(this.cm,0,0),or(this,Vr(t),xe)}),replaceRange:function(e,t,r,n){t=f(this,t),r=r?f(this,r):t,yi(this,e,t,r,n)},getRange:function(e,t,r){var n=Sn(this,f(this,e),f(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(Qt(this,e))return Dt(this,e)},getLineNumber:function(e){return it(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=Dt(this,e)),$n(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return f(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:Zn(function(e,t,r){Vo(this,f(this,typeof e=="number"?$e(e,t||0):e),null,r)}),setSelection:Zn(function(e,t,r){Vo(this,f(this,e),f(this,t||e),r)}),extendSelection:Zn(function(e,t,r){oa(this,f(this,e),t&&f(this,t),r)}),extendSelections:Zn(function(e,t){Go(this,W(this,e),t)}),extendSelectionsBy:Zn(function(e,t){var r=at(this.sel.ranges,e);Go(this,W(this,r),t)}),setSelections:Zn(function(e,t,r){if(!e.length)return;for(var n=[],l=0;l<e.length;l++)n[l]=new Tn(f(this,e[l].anchor),f(this,e[l].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),or(this,Mr(this.cm,n,t),r)}),addSelection:Zn(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new Tn(f(this,e),f(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=Sn(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=Sn(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:Zn(function(e,t,r){for(var n=[],l=this.sel,M=0;M<l.ranges.length;M++){var V=l.ranges[M];n[M]={from:V.from(),to:V.to(),text:this.splitLines(e[M]),origin:r}}for(var Z=t&&t!="end"&&hl(this,n,t),ee=n.length-1;ee>=0;ee--)vi(this,n[ee]);Z?Xo(this,Z):this.cm&&fi(this.cm)}),undo:Zn(function(){ua(this,"undo")}),redo:Zn(function(){ua(this,"redo")}),undoSelection:Zn(function(){ua(this,"undo",!0)}),redoSelection:Zn(function(){ua(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 ia(this.history.maxGeneration),Yr(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:mi(this.history.done),undone:mi(this.history.undone)}},setHistory:function(e){var t=this.history=new ia(this.history.maxGeneration);t.done=mi(e.done.slice(0),null,!0),t.undone=mi(e.undone.slice(0),null,!0)},setGutterMarker:Zn(function(e,t,r){return Ui(this,e,"gutter",function(n){var l=n.gutterMarkers||(n.gutterMarkers={});return l[t]=r,!r&&mt(l)&&(n.gutterMarkers=null),!0})}),clearGutter:Zn(function(e){var t=this;this.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&Ui(t,r,"gutter",function(){return r.gutterMarkers[e]=null,mt(r.gutterMarkers)&&(r.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Qt(this,e))return null;if(t=e,e=Dt(this,e),!e)return null}else if(t=it(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:Zn(function(e,t,r){return Ui(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(b(r).test(n[l]))return!1;n[l]+=" "+r}return!0})}),removeLineClass:Zn(function(e,t,r){return Ui(this,e,t=="gutter"?"gutter":"class",function(n){var l=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",M=n[l];if(M)if(r==null)n[l]=null;else{var V=M.match(b(r));if(!V)return!1;var Z=V.index+V[0].length;n[l]=M.slice(0,V.index)+(!V.index||Z==M.length?"":" ")+M.slice(Z)||null}else return!1;return!0})}),addLineWidget:Zn(function(e,t,r){return xl(this,e,t,r)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return bi(this,f(this,e),f(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=f(this,e),bi(this,e,e,r,"bookmark")},findMarksAt:function(e){e=f(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=f(this,e),t=f(this,t);var n=[],l=e.line;return this.iter(e.line,t.line+1,function(M){var V=M.markedSpans;if(V)for(var Z=0;Z<V.length;Z++){var ee=V[Z];!(ee.to!=null&&l==e.line&&e.ch>=ee.to||ee.from==null&&l!=e.line||ee.from!=null&&l==t.line&&ee.from>=t.ch)&&(!r||r(ee.marker))&&n.push(ee.marker.parent||ee.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 M=l.text.length+n;if(M>e)return t=e,!0;e-=M,++r}),f(this,$e(r,t))},indexFromPos:function(e){e=f(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 mr(Nn(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 mr(Nn(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 In&&(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];Yr(e,function(l){return n.push(l.id)},!0),e.history=new ia(null),e.history.done=mi(this.history.done,n),e.history.undone=mi(this.history.undone,n)}},iterLinkedDocs:function(e){Yr(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:Zn(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)})}),mr.prototype.eachLine=mr.prototype.iter;var ls=0;function _l(e){var t=this;if(us(t),Ue(t,e)||Fr(t.display,e))return;te(e),B&&(ls=+new Date);var r=ei(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,M=Array(l),V=0,Z=function(){++V==l&&Jn(t,function(){r=f(t.doc,r);var Le={from:r,to:r,text:t.doc.splitLines(M.filter(function(Ze){return Ze!=null}).join(t.doc.lineSeparator())),origin:"paste"};vi(t.doc,Le),Xo(t.doc,Vr(f(t.doc,r),f(t.doc,Xr(Le))))})()},ee=function(Le,Ze){if(t.options.allowDropFileTypes&&se(t.options.allowDropFileTypes,Le.type)==-1){Z();return}var ut=new FileReader;ut.onerror=function(){return Z()},ut.onload=function(){var vt=ut.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(vt)){Z();return}M[Ze]=vt,Z()},ut.readAsText(Le)},ne=0;ne<n.length;ne++)ee(n[ne],ne);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 ye;if(t.state.draggingText&&!t.state.draggingText.copy&&(ye=t.listSelections()),sa(t.doc,Vr(r,r)),ye)for(var ke=0;ke<ye.length;++ke)yi(t.doc,"",ye[ke].anchor,ye[ke].head,"drag");t.replaceSelection(me,"around","paste"),t.display.input.focus()}}catch(Le){}}}function Ol(e,t){if(B&&(!e.state.draggingText||+new Date-ls<100)){le(t);return}if(Ue(e,t)||Fr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!R){var r=s("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",O&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),O&&r.parentNode.removeChild(r)}}function Al(e,t){var r=ei(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 M=0;M<r.length;M++)e(r[M])})}var cs=!1;function Dl(){if(cs)return;Rl(),cs=!0}function Rl(){var e;Ee(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ds(Ll)},100))}),Ee(window,"blur",function(){return ds(hi)})}function Ll(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Jr={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"},Hi=0;Hi<10;Hi++)Jr[Hi+48]=Jr[Hi+96]=String(Hi);for(var da=65;da<=90;da++)Jr[da]=String.fromCharCode(da);for(var Ki=1;Ki<=12;Ki++)Jr[Ki+111]=Jr[Ki+63235]="F"+Ki;var Wr={};Wr.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"},Wr.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"},Wr.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"},Wr.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"]},Wr.default=i?Wr.macDefault:Wr.pcDefault;function Ml(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var r,n,l,M,V=0;V<t.length-1;V++){var Z=t[V];if(/^(cmd|meta|m)$/i.test(Z))M=!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),M&&(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=at(r.split(" "),Ml),M=0;M<l.length;M++){var V=void 0,Z=void 0;M==l.length-1?(Z=l.join(" "),V=n):(Z=l.slice(0,M+1).join(" "),V="...");var ee=t[Z];if(!ee)t[Z]=V;else if(ee!=V)throw new Error("Inconsistent bindings for "+Z)}delete e[r]}for(var ne in t)e[ne]=t[ne];return e}function Ei(e,t,r,n){t=ca(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 Ei(e,t.fallthrough,r,n);for(var M=0;M<t.fallthrough.length;M++){var V=Ei(e,t.fallthrough[M],r,n);if(V)return V}}}function hs(e){var t=typeof e=="string"?e:Jr[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),(p?t.metaKey:t.ctrlKey)&&n!="Ctrl"&&(e="Ctrl-"+e),(p?t.ctrlKey:t.metaKey)&&n!="Mod"&&(e="Cmd-"+e),!r&&t.shiftKey&&n!="Shift"&&(e="Shift-"+e),e}function ps(e,t){if(O&&e.keyCode==34&&e.char)return!1;var r=Jr[e.keyCode];return r==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(r=e.code),fs(r,e,t))}function ca(e){return typeof e=="string"?Wr[e]:e}function xi(e,t){for(var r=e.doc.sel.ranges,n=[],l=0;l<r.length;l++){for(var M=t(r[l]);n.length&&Ot(M.from,Me(n).to)<=0;){var V=n.pop();if(Ot(V.from,M.from)<0){M.from=V.from;break}}n.push(M)}xr(e,function(){for(var Z=n.length-1;Z>=0;Z--)yi(e.doc,"",n[Z].from,n[Z].to,"+delete");fi(e)})}function za(e,t,r){var n=Xe(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 $e(t.line,n,r<0?"after":"before")}function Va(e,t,r,n,l){if(e){t.doc.direction=="rtl"&&(l=-l);var M=St(r,t.doc.direction);if(M){var V=l<0?Me(M):M[0],Z=l<0==(V.level==1),ee=Z?"after":"before",ne;if(V.level>0||t.doc.direction=="rtl"){var me=ui(t,r);ne=l<0?r.text.length-1:0;var ye=Ur(t,me,ne).top;ne=Ct(function(ke){return Ur(t,me,ke).top==ye},l<0==(V.level==1)?V.from:V.to-1,ne),ee=="before"&&(ne=za(r,ne,1))}else ne=l<0?V.to:V.from;return new $e(n,ne,ee)}}return new $e(n,l<0?r.text.length:0,l<0?"before":"after")}function kl(e,t,r,n){var l=St(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 M=Et(l,r.ch,r.sticky),V=l[M];if(e.doc.direction=="ltr"&&V.level%2==0&&(n>0?V.to>r.ch:V.from<r.ch))return Ga(t,r,n);var Z=function(wt,Mt){return za(t,wt instanceof $e?wt.ch:wt,Mt)},ee,ne=function(wt){return e.options.lineWrapping?(ee=ee||ui(e,t),vo(e,t,ee,wt)):{begin:0,end:t.text.length}},me=ne(r.sticky=="before"?Z(r,-1):r.ch);if(e.doc.direction=="rtl"||V.level==1){var ye=V.level==1==n<0,ke=Z(r,ye?1:-1);if(ke!=null&&(ye?ke<=V.to&&ke<=me.end:ke>=V.from&&ke>=me.begin)){var Le=ye?"before":"after";return new $e(r.line,ke,Le)}}var Ze=function(wt,Mt,_t){for(var Ut=function(Pn,Qn){return Qn?new $e(r.line,Z(Pn,1),"before"):new $e(r.line,Pn,"after")};wt>=0&&wt<l.length;wt+=Mt){var $t=l[wt],Xt=Mt>0==($t.level!=1),on=Xt?_t.begin:Z(_t.end,-1);if($t.from<=on&&on<$t.to)return Ut(on,Xt);if(on=Xt?$t.from:Z($t.to,-1),_t.begin<=on&&on<_t.end)return Ut(on,Xt)}},ut=Ze(M+n,n,me);if(ut)return ut;var vt=n>0?me.end:Z(me.begin,-1);return vt!=null&&!(n>0&&vt==t.text.length)&&(ut=Ze(n>0?0:l.length-1,n,ne(vt)),ut)?ut:null}var zi={selectAll:Qo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),xe)},killLine:function(e){return xi(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:$e(t.head.line+1,0)}:{from:t.head,to:$e(t.head.line,r)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return xi(e,function(t){return{from:$e(t.from().line,0),to:f(e.doc,$e(t.to().line+1,0))}})},delLineLeft:function(e){return xi(e,function(t){return{from:$e(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return xi(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 xi(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($e(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection($e(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 M=r[l].from(),V=$(e.getLine(M.line),M.ch,n);t.push(ue(n-V%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return xr(e,function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++){if(!t[n].empty())continue;var l=t[n].head,M=Dt(e.doc,l.line).text;if(M){if(l.ch==M.length&&(l=new $e(l.line,l.ch-1)),l.ch>0)l=new $e(l.line,l.ch+1),e.replaceRange(M.charAt(l.ch-1)+M.charAt(l.ch-2),$e(l.line,l.ch-2),l,"+transpose");else if(l.line>e.doc.first){var V=Dt(e.doc,l.line-1).text;V&&(l=new $e(l.line,1),e.replaceRange(M.charAt(0)+e.doc.lineSeparator()+V.charAt(V.length-1),$e(l.line-1,V.length-1),l,"+transpose"))}}r.push(new Tn(l,l))}e.setSelections(r)})},newlineAndIndent:function(e){return xr(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);fi(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=$n(r);return n!=r&&(t=it(n)),Va(!0,e,n,t,1)}function Il(e,t){var r=Dt(e.doc,t),n=Er(r);return n!=r&&(t=it(n)),Va(!0,e,r,t,-1)}function gs(e,t){var r=ms(e,t.line),n=Dt(e.doc,r.line),l=St(n,e.doc.direction);if(!l||l[0].level==0){var M=Math.max(r.ch,n.text.search(/\S/)),V=t.line==r.line&&t.ch<=M&&t.ch;return $e(r.line,V?0:M,r.sticky)}return r}function ha(e,t,r){if(typeof t=="string"&&(t=zi[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)!=_e}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=Ei(t,e.state.keyMaps[n],r,e);if(l)return l}return e.options.extraKeys&&Ei(t,e.options.extraKeys,r,e)||Ei(t,e.options.keyMap,r,e)}var Ul=new re;function Gi(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"&&tn(e,"keyHandled",e,t,r),(l=="handled"||l=="multi")&&(te(r),Da(e)),!!l}function ys(e,t){var r=ps(t,!0);return r?t.shiftKey&&!e.state.keySeq?Gi(e,"Shift-"+r,t,function(n){return ha(e,n,!0)})||Gi(e,r,t,function(n){if(typeof n=="string"?/^go[A-Z]/.test(n):n.motion)return ha(e,n)}):Gi(e,r,t,function(n){return ha(e,n)}):!1}function Bl(e,t,r){return Gi(e,"'"+r+"'",t,function(n){return ha(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=P(),Ue(t,e))return;B&&N<11&&e.keyCode==27&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=r==16||e.shiftKey;var n=ys(t,e);O&&(Xa=n?r:null,!n&&r==88&&!Pe&&(i?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),L&&!i&&!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;j(t,"CodeMirror-crosshair");function r(n){(n.keyCode==18||!n.altKey)&&(h(t,"CodeMirror-crosshair"),Ge(document,"keyup",r),Ge(document,"mouseover",r))}Ee(document,"keyup",r),Ee(document,"mouseover",r)}function Es(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ue(this,e)}function xs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Fr(t.display,e)||Ue(t,e)||e.ctrlKey&&!e.altKey||i&&e.metaKey)return;var r=e.keyCode,n=e.charCode;if(O&&r==Xa){Xa=null,te(e);return}if(O&&(!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&&Ot(t,this.pos)==0&&r==this.button};var Vi,Xi;function Wl(e,t){var r=+new Date;return Xi&&Xi.compare(r,e,t)?(Vi=Xi=null,"triple"):Vi&&Vi.compare(r,e,t)?(Xi=new Ya(r,e,t),Vi=null,"double"):(Vi=new Ya(r,e,t),Xi=null,"single")}function Cs(e){var t=this,r=t.display;if(Ue(t,e)||r.activeTouch&&r.input.supportsTouch())return;if(r.input.ensurePolled(),r.shift=e.shiftKey,Fr(r,e)){A||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100));return}if($a(t,e))return;var n=ei(t,e),l=be(e),M=n?Wl(n,l):"single";if(window.focus(),l==1&&t.state.selectingText&&t.state.selectingText(e),n&&Hl(t,l,n,M,e))return;l==1?n?zl(t,n,M,e):Te(e)==r.scroller&&te(e):l==2?(n&&oa(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 M="Click";return n=="double"?M="Double"+M:n=="triple"&&(M="Triple"+M),M=(t==1?"Left":t==2?"Middle":"Right")+M,Gi(e,fs(M,l),l,function(V){if(typeof V=="string"&&(V=zi[V]),!V)return!1;var Z=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Z=V(e,r)!=_e}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 M=c?r.shiftKey&&r.metaKey:r.altKey;l.unit=M?"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=i?r.metaKey:r.ctrlKey),l.moveOnDrag==null&&(l.moveOnDrag=!(i?r.altKey:r.ctrlKey)),l}function zl(e,t,r,n){B?setTimeout(X(Co,e),0):e.curOp.focus=P();var l=Kl(e,r,n),M=e.doc.sel,V;e.options.dragDrop&&ze&&!e.isReadOnly()&&r=="single"&&(V=M.contains(t))>-1&&(Ot((V=M.ranges[V]).from(),t)<0||t.xRel>0)&&(Ot(V.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,M=!1,V=Jn(e,function(ne){A&&(l.scroller.draggable=!1),e.state.draggingText=!1,Ge(l.wrapper.ownerDocument,"mouseup",V),Ge(l.wrapper.ownerDocument,"mousemove",Z),Ge(l.scroller,"dragstart",ee),Ge(l.scroller,"drop",V),M||(te(ne),n.addNew||oa(e.doc,r,null,null,n.extend),A&&!R||B&&N==9?setTimeout(function(){l.wrapper.ownerDocument.body.focus({preventScroll:!0}),l.input.focus()},20):l.input.focus())}),Z=function(ne){M=M||Math.abs(t.clientX-ne.clientX)+Math.abs(t.clientY-ne.clientY)>=10},ee=function(){return M=!0};A&&(l.scroller.draggable=!0),e.state.draggingText=V,V.copy=!n.moveOnDrag,l.scroller.dragDrop&&l.scroller.dragDrop(),Ee(l.wrapper.ownerDocument,"mouseup",V),Ee(l.wrapper.ownerDocument,"mousemove",Z),Ee(l.scroller,"dragstart",ee),Ee(l.scroller,"drop",V),So(e),setTimeout(function(){return l.input.focus()},20)}function Ss(e,t,r){if(r=="char")return new Tn(t,t);if(r=="word")return e.findWordAt(t);if(r=="line")return new Tn($e(t.line,0),f(e.doc,$e(t.line+1,0)));var n=r(e,t);return new Tn(n.from,n.to)}function Vl(e,t,r,n){var l=e.display,M=e.doc;te(t);var V,Z,ee=M.sel,ne=ee.ranges;if(n.addNew&&!n.extend?(Z=M.sel.contains(r),Z>-1?V=ne[Z]:V=new Tn(r,r)):(V=M.sel.primary(),Z=M.sel.primIndex),n.unit=="rectangle")n.addNew||(V=new Tn(r,r)),r=ei(e,t,!0,!0),Z=-1;else{var me=Ss(e,r,n.unit);n.extend?V=Ha(V,me.anchor,me.head,n.extend):V=me}n.addNew?Z==-1?(Z=ne.length,or(M,Mr(e,ne.concat([V]),Z),{scroll:!1,origin:"*mouse"})):ne.length>1&&ne[Z].empty()&&n.unit=="char"&&!n.extend?(or(M,Mr(e,ne.slice(0,Z).concat(ne.slice(Z+1)),0),{scroll:!1,origin:"*mouse"}),ee=M.sel):Ka(M,Z,V,Ce):(Z=0,or(M,new wr([V],0),Ce),ee=M.sel);var ye=r;function ke(_t){if(Ot(ye,_t)==0)return;if(ye=_t,n.unit=="rectangle"){for(var Ut=[],$t=e.options.tabSize,Xt=$(Dt(M,r.line).text,r.ch,$t),on=$(Dt(M,_t.line).text,_t.ch,$t),Pn=Math.min(Xt,on),Qn=Math.max(Xt,on),Bn=Math.min(r.line,_t.line),Cr=Math.min(e.lastLine(),Math.max(r.line,_t.line));Bn<=Cr;Bn++){var gr=Dt(M,Bn).text,zn=De(gr,Pn,$t);Pn==Qn?Ut.push(new Tn($e(Bn,zn),$e(Bn,zn))):gr.length>zn&&Ut.push(new Tn($e(Bn,zn),$e(Bn,De(gr,Qn,$t))))}Ut.length||Ut.push(new Tn(r,r)),or(M,Mr(e,ee.ranges.slice(0,Z).concat(Ut),Z),{origin:"*mouse",scroll:!1}),e.scrollIntoView(_t)}else{var vr=V,rr=Ss(e,_t,n.unit),Xn=vr.anchor,Gn;Ot(rr.anchor,Xn)>0?(Gn=rr.head,Xn=Jt(vr.from(),rr.anchor)):(Gn=rr.anchor,Xn=mn(vr.to(),rr.head));var jn=ee.ranges.slice(0);jn[Z]=Xl(e,new Tn(f(M,Xn),Gn)),or(M,Mr(e,jn,Z),Ce)}}var Le=l.wrapper.getBoundingClientRect(),Ze=0;function ut(_t){var Ut=++Ze,$t=ei(e,_t,!0,n.unit=="rectangle");if(!$t)return;if(Ot($t,ye)!=0){e.curOp.focus=P(),ke($t);var Xt=ea(l,M);($t.line>=Xt.to||$t.line<Xt.from)&&setTimeout(Jn(e,function(){Ze==Ut&&ut(_t)}),150)}else{var on=_t.clientY<Le.top?-20:_t.clientY>Le.bottom?20:0;on&&setTimeout(Jn(e,function(){if(Ze!=Ut)return;l.scroller.scrollTop+=on,ut(_t)}),50)}}function vt(_t){e.state.selectingText=!1,Ze=Infinity,_t&&(te(_t),l.input.focus()),Ge(l.wrapper.ownerDocument,"mousemove",wt),Ge(l.wrapper.ownerDocument,"mouseup",Mt),M.history.lastSelOrigin=null}var wt=Jn(e,function(_t){_t.buttons===0||!be(_t)?vt(_t):ut(_t)}),Mt=Jn(e,vt);e.state.selectingText=Mt,Ee(l.wrapper.ownerDocument,"mousemove",wt),Ee(l.wrapper.ownerDocument,"mouseup",Mt)}function Xl(e,t){var r=t.anchor,n=t.head,l=Dt(e.doc,r.line);if(Ot(r,n)==0&&r.sticky==n.sticky)return t;var M=St(l);if(!M)return t;var V=Et(M,r.ch,r.sticky),Z=M[V];if(Z.from!=r.ch&&Z.to!=r.ch)return t;var ee=V+(Z.from==r.ch==(Z.level!=1)?0:1);if(ee==0||ee==M.length)return t;var ne;if(n.line!=r.line)ne=(n.line-r.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var me=Et(M,n.ch,n.sticky),ye=me-V||(n.ch-r.ch)*(Z.level==1?-1:1);me==ee-1||me==ee?ne=ye<0:ne=ye>0}var ke=M[ee+(ne?-1:0)],Le=ne==(ke.level==1),Ze=Le?ke.from:ke.to,ut=Le?"after":"before";return r.ch==Ze&&r.sticky==ut?t:new Tn(new $e(r.line,Ze,ut),n)}function Ts(e,t,r,n){var l,M;if(t.touches)l=t.touches[0].clientX,M=t.touches[0].clientY;else try{l=t.clientX,M=t.clientY}catch(ke){return!1}if(l>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&te(t);var V=e.display,Z=V.lineDiv.getBoundingClientRect();if(M>Z.bottom||!de(e,r))return ae(t);M-=Z.top-V.viewOffset;for(var ee=0;ee<e.display.gutterSpecs.length;++ee){var ne=V.gutters.childNodes[ee];if(ne&&ne.getBoundingClientRect().right>=l){var me=Pt(e.doc,M),ye=e.display.gutterSpecs[ee];return Re(e,r,e,me,ye.className,t),ae(t)}}}function $a(e,t){return Ts(e,t,"gutterClick",!0)}function ws(e,t){if(Fr(e.display,t)||Yl(e,t))return;if(Ue(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-"),Oi(e)}var Ci={toString:function(){return"CodeMirror.Init"}},Os={},fa={};function $l(e){var t=e.optionHandlers;function r(n,l,M,V){e.defaults[n]=l,M&&(t[n]=V?function(Z,ee,ne){ne!=Ci&&M(Z,ee,ne)}:M)}e.defineOption=r,e.Init=Ci,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){Ii(n),Oi(n),pr(n)},!0),r("lineSeparator",null,function(n,l){if(n.doc.lineSep=l,!l)return;var M=[],V=n.doc.first;n.doc.iter(function(ee){for(var ne=0;;){var me=ee.text.indexOf(l,ne);if(me==-1)break;ne=me+l.length,M.push($e(V,me))}V++});for(var Z=M.length-1;Z>=0;Z--)yi(n.doc,l,M[Z],$e(M[Z].line,M[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,M){n.state.specialChars=new RegExp(l.source+(l.test(" ")?"":"| "),"g"),M!=Ci&&n.refresh()}),r("specialCharPlaceholder",Kt,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",!S),r("wholeLineUpdateBefore",!0),r("theme","default",function(n){_s(n),ki(n)},!0),r("keyMap","default",function(n,l,M){var V=ca(l),Z=M!=Ci&&ca(M);Z&&Z.detach&&Z.detach(n,V),V.attach&&V.attach(n,Z||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,Zl,!0),r("gutters",[],function(n,l){n.display.gutterSpecs=Ua(l,n.options.lineNumbers),ki(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 pi(n)},!0),r("scrollbarStyle","native",function(n){Do(n),pi(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),ki(n)},!0),r("firstLineNumber",1,ki,!0),r("lineNumberFormatter",function(n){return n},ki,!0),r("showCursorWhenSelecting",!1,Ai,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,function(n,l){l=="nocursor"&&(hi(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,Ai,!0),r("singleCursorHeightPerLine",!0,Ai,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,Ii,!0),r("addModeClass",!1,Ii,!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,Ii,!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!=Ci;if(!t!=!n){var l=e.display.dragFunctions,M=t?Ee:Ge;M(e.display.scroller,"dragstart",l.start),M(e.display.scroller,"dragenter",l.enter),M(e.display.scroller,"dragover",l.over),M(e.display.scroller,"dragleave",l.leave),M(e.display.scroller,"drop",l.drop)}}function Zl(e){e.options.lineWrapping?(j(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(h(e.display.wrapper,"CodeMirror-wrap"),Ir(e)),Aa(e),pr(e),Oi(e),setTimeout(function(){return pi(e)},100)}function In(e,t){var r=this;if(!(this instanceof In))return new In(e,t);this.options=t=t?F(t):{},F(Os,t,!1);var n=t.value;typeof n=="string"?n=new mr(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var l=new In.inputStyles[t.inputStyle](this),M=this.display=new dl(e,n,l,t);M.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&&M.input.focus(),B&&N<11&&setTimeout(function(){return r.display.input.reset(!0)},20),Ql(this),Dl(),ii(this),this.curOp.forceUpdate=!0,jo(this,n),t.autofocus&&!a||this.hasFocus()?setTimeout(function(){r.hasFocus()&&!r.state.focused&&Ra(r)},20):hi(this);for(var V in fa)fa.hasOwnProperty(V)&&fa[V](this,t[V],Ci);Mo(this),t.finishInit&&t.finishInit(this);for(var Z=0;Z<Ja.length;++Z)Ja[Z](this);ai(this),A&&t.lineWrapping&&getComputedStyle(M.lineDiv).textRendering=="optimizelegibility"&&(M.lineDiv.style.textRendering="auto")}In.defaults=Os,In.optionHandlers=fa;function Ql(e){var t=e.display;Ee(t.scroller,"mousedown",Jn(e,Cs)),B&&N<11?Ee(t.scroller,"dblclick",Jn(e,function(ee){if(Ue(e,ee))return;var ne=ei(e,ee);if(!ne||$a(e,ee)||Fr(e.display,ee))return;te(ee);var me=e.findWordAt(ne);oa(e.doc,me.anchor,me.head)})):Ee(t.scroller,"dblclick",function(ee){return Ue(e,ee)||te(ee)}),Ee(t.scroller,"contextmenu",function(ee){return ws(e,ee)}),Ee(t.input.getField(),"contextmenu",function(ee){t.scroller.contains(ee.target)||ws(e,ee)});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 M(ee){if(ee.touches.length!=1)return!1;var ne=ee.touches[0];return ne.radiusX<=1&&ne.radiusY<=1}function V(ee,ne){if(ne.left==null)return!0;var me=ne.left-ee.left,ye=ne.top-ee.top;return me*me+ye*ye>20*20}Ee(t.scroller,"touchstart",function(ee){if(!Ue(e,ee)&&!M(ee)&&!$a(e,ee)){t.input.ensurePolled(),clearTimeout(r);var ne=+new Date;t.activeTouch={start:ne,moved:!1,prev:ne-n.end<=300?n:null},ee.touches.length==1&&(t.activeTouch.left=ee.touches[0].pageX,t.activeTouch.top=ee.touches[0].pageY)}}),Ee(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ee(t.scroller,"touchend",function(ee){var ne=t.activeTouch;if(ne&&!Fr(t,ee)&&ne.left!=null&&!ne.moved&&new Date-ne.start<300){var me=e.coordsChar(t.activeTouch,"page"),ye;!ne.prev||V(ne,ne.prev)?ye=new Tn(me,me):!ne.prev.prev||V(ne,ne.prev.prev)?ye=e.findWordAt(me):ye=new Tn($e(me.line,0),f(e.doc,$e(me.line+1,0))),e.setSelection(ye.anchor,ye.head),e.focus(),te(ee)}l()}),Ee(t.scroller,"touchcancel",l),Ee(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Ri(e,t.scroller.scrollTop),ni(e,t.scroller.scrollLeft,!0),Re(e,"scroll",e))}),Ee(t.scroller,"mousewheel",function(ee){return Io(e,ee)}),Ee(t.scroller,"DOMMouseScroll",function(ee){return Io(e,ee)}),Ee(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(ee){Ue(e,ee)||le(ee)},over:function(ee){Ue(e,ee)||(Al(e,ee),le(ee))},start:function(ee){return Ol(e,ee)},drop:Jn(e,_l),leave:function(ee){Ue(e,ee)||us(e)}};var Z=t.input.getField();Ee(Z,"keyup",function(ee){return Es.call(e,ee)}),Ee(Z,"keydown",Jn(e,bs)),Ee(Z,"keypress",Jn(e,xs)),Ee(Z,"focus",function(ee){return Ra(e,ee)}),Ee(Z,"blur",function(ee){return hi(e,ee)})}var Ja=[];In.defineInitHook=function(e){return Ja.push(e)};function Yi(e,t,r,n){var l=e.doc,M;r==null&&(r="add"),r=="smart"&&(l.mode.indent?M=ht(e,t).state:r="prev");var V=e.options.tabSize,Z=Dt(l,t),ee=$(Z.text,null,V);Z.stateAfter&&(Z.stateAfter=null);var ne=Z.text.match(/^\s*/)[0],me;if(!n&&!/\S/.test(Z.text))me=0,r="not";else if(r=="smart"&&(me=l.mode.indent(M,Z.text.slice(ne.length),Z.text),me==_e||me>150)){if(!n)return;r="prev"}r=="prev"?t>l.first?me=$(Dt(l,t-1).text,null,V):me=0:r=="add"?me=ee+e.options.indentUnit:r=="subtract"?me=ee-e.options.indentUnit:typeof r=="number"&&(me=ee+r),me=Math.max(0,me);var ye="",ke=0;if(e.options.indentWithTabs)for(var Le=Math.floor(me/V);Le;--Le)ke+=V,ye+=" ";if(ke<me&&(ye+=ue(me-ke)),ye!=ne)return yi(l,ye,$e(t,0),$e(t,ne.length),"+input"),Z.stateAfter=null,!0;for(var Ze=0;Ze<l.sel.ranges.length;Ze++){var ut=l.sel.ranges[Ze];if(ut.head.line==t&&ut.head.ch<ne.length){var vt=$e(t,ne.length);Ka(l,Ze,new Tn(vt,vt));break}}}var Pr=null;function pa(e){Pr=e}function Za(e,t,r,n,l){var M=e.doc;e.display.shift=!1,n||(n=M.sel);var V=+new Date-200,Z=l=="paste"||e.state.pasteIncoming>V,ee=Be(t),ne=null;if(Z&&n.ranges.length>1)if(Pr&&Pr.text.join(`
|
|
`)==t){if(n.ranges.length%Pr.text.length==0){ne=[];for(var me=0;me<Pr.text.length;me++)ne.push(M.splitLines(Pr.text[me]))}}else ee.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(ne=at(ee,function(wt){return[wt]}));for(var ye=e.curOp.updateInput,ke=n.ranges.length-1;ke>=0;ke--){var Le=n.ranges[ke],Ze=Le.from(),ut=Le.to();Le.empty()&&(r&&r>0?Ze=$e(Ze.line,Ze.ch-r):e.state.overwrite&&!Z?ut=$e(ut.line,Math.min(Dt(M,ut.line).text.length,ut.ch+Me(ee).length)):Z&&Pr&&Pr.lineWise&&Pr.text.join(`
|
|
`)==ee.join(`
|
|
`)&&(Ze=ut=$e(Ze.line,0)));var vt={from:Ze,to:ut,text:ne?ne[ke%ne.length]:ee,origin:l||(Z?"paste":e.state.cutIncoming>V?"cut":"+input")};vi(e.doc,vt),tn(e,"inputRead",e,vt)}t&&!Z&&Ds(e,t),fi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ye),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&&xr(t,function(){return Za(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 M=e.getModeAt(l.head),V=!1;if(M.electricChars){for(var Z=0;Z<M.electricChars.length;Z++)if(t.indexOf(M.electricChars.charAt(Z))>-1){V=Yi(e,l.head.line,"smart");break}}else M.electricInput&&(M.electricInput.test(Dt(e.doc,l.head.line).text.slice(0,l.head.ch))&&(V=Yi(e,l.head.line,"smart")));V&&tn(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,M={anchor:$e(l,0),head:$e(l+1,0)};r.push(M),t.push(e.getRange(M.anchor,M.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 A?e.style.width="1000px":e.setAttribute("wrap","off"),g&&(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 M=this.options,V=M[n];if(M[n]==l&&n!="mode")return;M[n]=l,t.hasOwnProperty(n)&&Jn(this,t[n])(this,l,V),Re(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"](ca(n))},removeKeyMap:function(n){for(var l=this.state.keyMaps,M=0;M<l.length;++M)if(l[M]==n||l[M].name==n)return l.splice(M,1),!0},addOverlay:cr(function(n,l){var M=n.token?n:e.getMode(this.options,n);if(M.startState)throw new Error("Overlays may not be stateful.");lt(this.state.overlays,{mode:M,modeSpec:n,opaque:l&&l.opaque,priority:l&&l.priority||0},function(V){return V.priority}),this.state.modeGen++,pr(this)}),removeOverlay:cr(function(n){for(var l=this.state.overlays,M=0;M<l.length;++M){var V=l[M].modeSpec;if(V==n||typeof n=="string"&&V.name==n){l.splice(M,1),this.state.modeGen++,pr(this);return}}}),indentLine:cr(function(n,l,M){typeof l!="string"&&typeof l!="number"&&(l==null?l=this.options.smartIndent?"smart":"prev":l=l?"add":"subtract"),Qt(this.doc,n)&&Yi(this,n,l,M)}),indentSelection:cr(function(n){for(var l=this.doc.sel.ranges,M=-1,V=0;V<l.length;V++){var Z=l[V];if(Z.empty())Z.head.line>M&&(Yi(this,Z.head.line,n,!0),M=Z.head.line,V==this.doc.sel.primIndex&&fi(this));else{var ee=Z.from(),ne=Z.to(),me=Math.max(M,ee.line);M=Math.min(this.lastLine(),ne.line-(ne.ch?0:1))+1;for(var ye=me;ye<M;++ye)Yi(this,ye,n);var ke=this.doc.sel.ranges;ee.ch==0&&l.length==ke.length&&ke[V].from().ch>0&&Ka(this.doc,V,new Tn(ee,ke[V].to()),xe)}}}),getTokenAt:function(n,l){return rn(this,n,l)},getLineTokens:function(n,l){return rn(this,$e(n),l,!0)},getTokenTypeAt:function(n){n=f(this.doc,n);var l=Ve(this,Dt(this.doc,n.line)),M=0,V=(l.length-1)/2,Z=n.ch,ee;if(Z==0)ee=l[2];else for(;;){var ne=M+V>>1;if((ne?l[ne*2-1]:0)>=Z)V=ne;else if(l[ne*2+1]<Z)M=ne+1;else{ee=l[ne*2+2];break}}var me=ee?ee.indexOf("overlay "):-1;return me<0?ee:me==0?null:ee.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 M=[];if(!r.hasOwnProperty(l))return M;var V=r[l],Z=this.getModeAt(n);if(typeof Z[l]=="string")V[Z[l]]&&M.push(V[Z[l]]);else if(Z[l])for(var ee=0;ee<Z[l].length;ee++){var ne=V[Z[l][ee]];ne&&M.push(ne)}else Z.helperType&&V[Z.helperType]?M.push(V[Z.helperType]):V[Z.name]&&M.push(V[Z.name]);for(var me=0;me<V._global.length;me++){var ye=V._global[me];ye.pred(Z,this)&&se(M,ye.val)==-1&&M.push(ye.val)}return M},getStateAfter:function(n,l){var M=this.doc;return n=H(M,n==null?M.first+M.size-1:n),ht(this,n+1,l).state},cursorCoords:function(n,l){var M,V=this.doc.sel.primary();return n==null?M=V.head:typeof n=="object"?M=f(this.doc,n):M=n?V.from():V.to(),Lr(this,M,l||"page")},charCoords:function(n,l){return Ca(this,f(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,Pt(this.doc,n+this.display.viewOffset)},heightAtLine:function(n,l,M){var V=!1,Z;if(typeof n=="number"){var ee=this.doc.first+this.doc.size-1;n<this.doc.first?n=this.doc.first:n>ee&&(n=ee,V=!0),Z=Dt(this.doc,n)}else Z=n;return Ji(this,Z,{top:0,left:0},l||"page",M||V).top+(V?this.doc.height-ir(Z):0)},defaultTextHeight:function(){return di(this.display)},defaultCharWidth:function(){return ci(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(n,l,M,V,Z){var ee=this.display;n=Lr(this,f(this.doc,n));var ne=n.bottom,me=n.left;if(l.style.position="absolute",l.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(l),ee.sizer.appendChild(l),V=="over")ne=n.top;else if(V=="above"||V=="near"){var ye=Math.max(ee.wrapper.clientHeight,this.doc.height),ke=Math.max(ee.sizer.clientWidth,ee.lineSpace.clientWidth);(V=="above"||n.bottom+l.offsetHeight>ye)&&n.top>l.offsetHeight?ne=n.top-l.offsetHeight:n.bottom+l.offsetHeight<=ye&&(ne=n.bottom),me+l.offsetWidth>ke&&(me=ke-l.offsetWidth)}l.style.top=ne+"px",l.style.left=l.style.right="",Z=="right"?(me=ee.sizer.clientWidth-l.offsetWidth,l.style.right="0px"):(Z=="left"?me=0:Z=="middle"&&(me=(ee.sizer.clientWidth-l.offsetWidth)/2),l.style.left=me+"px"),M&&Js(this,{left:me,top:ne,right:me+l.offsetWidth,bottom:ne+l.offsetHeight})},triggerOnKeyDown:cr(bs),triggerOnKeyPress:cr(xs),triggerOnKeyUp:Es,triggerOnMouseDown:cr(Cs),execCommand:function(n){if(zi.hasOwnProperty(n))return zi[n].call(null,this)},triggerElectric:cr(function(n){Ds(this,n)}),findPosH:function(n,l,M,V){var Z=1;l<0&&(Z=-1,l=-l);for(var ee=f(this.doc,n),ne=0;ne<l&&!(ee=Qa(this.doc,ee,Z,M,V),ee.hitSide);++ne);return ee},moveH:cr(function(n,l){var M=this;this.extendSelectionsBy(function(V){return M.display.shift||M.doc.extend||V.empty()?Qa(M.doc,V.head,n,l,M.options.rtlMoveVisually):n<0?V.from():V.to()},Oe)}),deleteH:cr(function(n,l){var M=this.doc.sel,V=this.doc;M.somethingSelected()?V.replaceSelection("",null,"+delete"):xi(this,function(Z){var ee=Qa(V,Z.head,n,l,!1);return n<0?{from:ee,to:Z.head}:{from:Z.head,to:ee}})}),findPosV:function(n,l,M,V){var Z=1,ee=V;l<0&&(Z=-1,l=-l);for(var ne=f(this.doc,n),me=0;me<l;++me){var ye=Lr(this,ne,"div");if(ee==null?ee=ye.left:ye.left=ee,ne=Ps(this,ye,Z,M),ne.hitSide)break}return ne},moveV:cr(function(n,l){var M=this,V=this.doc,Z=[],ee=!this.display.shift&&!V.extend&&V.sel.somethingSelected();if(V.extendSelectionsBy(function(me){if(ee)return n<0?me.from():me.to();var ye=Lr(M,me.head,"div");me.goalColumn!=null&&(ye.left=me.goalColumn),Z.push(ye.left);var ke=Ps(M,ye,n,l);return l=="page"&&me==V.sel.primary()&&Ma(M,Ca(M,ke,"div").top-ye.top),ke},Oe),Z.length)for(var ne=0;ne<V.sel.ranges.length;ne++)V.sel.ranges[ne].goalColumn=Z[ne]}),findWordAt:function(n){var l=this.doc,M=Dt(l,n.line).text,V=n.ch,Z=n.ch;if(M){var ee=this.getHelper(n,"wordChars");(n.sticky=="before"||Z==M.length)&&V?--V:++Z;for(var ne=M.charAt(V),me=rt(ne,ee)?function(ye){return rt(ye,ee)}:/\s/.test(ne)?function(ye){return/\s/.test(ye)}:function(ye){return!/\s/.test(ye)&&!rt(ye)};V>0&&me(M.charAt(V-1));)--V;for(;Z<M.length&&me(M.charAt(Z));)++Z}return new Tn($e(n.line,V),$e(n.line,Z))},toggleOverwrite:function(n){if(n!=null&&n==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?j(this.display.cursorDiv,"CodeMirror-overwrite"):h(this.display.cursorDiv,"CodeMirror-overwrite"),Re(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==P()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:cr(function(n,l){Di(this,n,l)}),getScrollInfo:function(){var n=this.display.scroller;return{left:n.scrollLeft,top:n.scrollTop,height:n.scrollHeight-Nr(this)-this.display.barHeight,width:n.scrollWidth-Nr(this)-this.display.barWidth,clientHeight:ba(this),clientWidth:Qr(this)}},scrollIntoView:cr(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:$e(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?Zs(this,n):wo(this,n.from,n.to,n.margin)}),setSize:cr(function(n,l){var M=this,V=function(ee){return typeof ee=="number"||/^\d+$/.test(String(ee))?ee+"px":ee};n!=null&&(this.display.wrapper.style.width=V(n)),l!=null&&(this.display.wrapper.style.height=V(l)),this.options.lineWrapping&&co(this);var Z=this.display.viewFrom;this.doc.iter(Z,this.display.viewTo,function(ee){if(ee.widgets){for(var ne=0;ne<ee.widgets.length;ne++)if(ee.widgets[ne].noHScroll){zr(M,Z,"widget");break}}++Z}),this.curOp.forceUpdate=!0,Re(this,"refresh",this)}),operation:function(n){return xr(this,n)},startOperation:function(){return ii(this)},endOperation:function(){return ai(this)},refresh:cr(function(){var n=this.display.cachedTextHeight;pr(this),this.curOp.forceUpdate=!0,Oi(this),Di(this,this.doc.scrollLeft,this.doc.scrollTop),Ia(this.display),(n==null||Math.abs(n-di(this.display))>.5||this.options.lineWrapping)&&Aa(this),Re(this,"refresh",this)}),swapDoc:cr(function(n){var l=this.doc;return l.cm=null,this.state.selectingText&&this.state.selectingText(),jo(this,n),Oi(this),this.display.input.reset(),Di(this,n.scrollLeft,n.scrollTop),this.curOp.forceScroll=!0,tn(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,M){r.hasOwnProperty(n)||(r[n]=e[n]={_global:[]}),r[n][l]=M},e.registerGlobalHelper=function(n,l,M,V){e.registerHelper(n,l,V),r[n]._global.push({pred:M,val:V})}}function Qa(e,t,r,n,l){var M=t,V=r,Z=Dt(e,t.line),ee=l&&e.direction=="rtl"?-r:r;function ne(){var Mt=t.line+ee;return Mt<e.first||Mt>=e.first+e.size?!1:(t=new $e(Mt,t.ch,t.sticky),Z=Dt(e,Mt))}function me(Mt){var _t;if(n=="codepoint"){var Ut=Z.text.charCodeAt(t.ch+(n>0?0:-1));isNaN(Ut)?_t=null:_t=new $e(t.line,Math.max(0,Math.min(Z.text.length,t.ch+r*(Ut>=55296&&Ut<56320?2:1))),-r)}else l?_t=kl(e.cm,Z,t,r):_t=Ga(Z,t,r);if(_t==null)if(!Mt&&ne())t=Va(l,e.cm,Z,t.line,ee);else return!1;else t=_t;return!0}if(n=="char"||n=="codepoint")me();else if(n=="column")me(!0);else if(n=="word"||n=="group")for(var ye=null,ke=n=="group",Le=e.cm&&e.cm.getHelper(t,"wordChars"),Ze=!0;!(r<0&&!me(!Ze));Ze=!1){var ut=Z.text.charAt(t.ch)||`
|
|
`,vt=rt(ut,Le)?"w":ke&&ut==`
|
|
`?"n":!ke||/\s/.test(ut)?null:"p";if(ke&&!Ze&&!vt&&(vt="s"),ye&&ye!=vt){r<0&&(r=1,me(),t.sticky="after");break}if(vt&&(ye=vt),r>0&&!me(!Ze))break}var wt=la(e,t,M,V,!0);return Ht(M,wt)&&(wt.hitSide=!0),wt}function Ps(e,t,r,n){var l=e.doc,M=t.left,V;if(n=="page"){var Z=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),ee=Math.max(Z-.5*di(e.display),3);V=(r>0?t.bottom:t.top)+r*ee}else n=="line"&&(V=r>0?t.bottom+3:t.top-3);for(var ne;!(ne=Ta(e,M,V),!ne.outside);){if(r<0?V<=0:V>=l.height){ne.hitSide=!0;break}V+=r*5}return ne}var On=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};On.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 M(Z){for(var ee=Z.target;ee;ee=ee.parentNode){if(ee==l)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(ee.className))break}return!1}Ee(l,"paste",function(Z){if(!M(Z)||Ue(n,Z)||As(Z,n))return;N<=11&&setTimeout(Jn(n,function(){return t.updateFromDOM()}),20)}),Ee(l,"compositionstart",function(Z){t.composing={data:Z.data,done:!1}}),Ee(l,"compositionupdate",function(Z){t.composing||(t.composing={data:Z.data,done:!1})}),Ee(l,"compositionend",function(Z){t.composing&&(Z.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ee(l,"touchstart",function(){return r.forceCompositionEnd()}),Ee(l,"input",function(){t.composing||t.readFromDOMSoon()});function V(Z){if(!M(Z)||Ue(n,Z))return;if(n.somethingSelected())pa({lineWise:!1,text:n.getSelections()}),Z.type=="cut"&&n.replaceSelection("",null,"cut");else if(n.options.lineWiseCopyCut){var ee=Rs(n);pa({lineWise:!0,text:ee.text}),Z.type=="cut"&&n.operation(function(){n.setSelections(ee.ranges,0,xe),n.replaceSelection("",null,"cut")})}else return;if(Z.clipboardData){Z.clipboardData.clearData();var ne=Pr.text.join(`
|
|
`);if(Z.clipboardData.setData("Text",ne),Z.clipboardData.getData("Text")==ne){Z.preventDefault();return}}var me=Ms(),ye=me.firstChild;n.display.lineSpace.insertBefore(me,n.display.lineSpace.firstChild),ye.value=Pr.text.join(`
|
|
`);var ke=document.activeElement;Q(ye),setTimeout(function(){n.display.lineSpace.removeChild(me),ke.focus(),ke==l&&r.showPrimarySelection()},50)}Ee(l,"copy",V),Ee(l,"cut",V)},On.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},On.prototype.prepareSelection=function(){var e=Eo(this.cm,!1);return e.focus=document.activeElement==this.div,e},On.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},On.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},On.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 M=ma(t,e.anchorNode,e.anchorOffset),V=ma(t,e.focusNode,e.focusOffset);if(M&&!M.bad&&V&&!V.bad&&Ot(Jt(M,V),n)==0&&Ot(mn(M,V),l)==0)return;var Z=t.display.view,ee=n.line>=t.display.viewFrom&&ks(t,n)||{node:Z[0].measure.map[2],offset:0},ne=l.line<t.display.viewTo&&ks(t,l);if(!ne){var me=Z[Z.length-1].measure,ye=me.maps?me.maps[me.maps.length-1]:me.map;ne={node:ye[ye.length-1],offset:ye[ye.length-2]-ye[ye.length-3]}}if(!ee||!ne){e.removeAllRanges();return}var ke=e.rangeCount&&e.getRangeAt(0),Le;try{Le=y(ee.node,ee.offset,ne.offset,ne.node)}catch(Ze){}Le&&(!L&&t.state.focused?(e.collapse(ee.node,ee.offset),Le.collapsed||(e.removeAllRanges(),e.addRange(Le))):(e.removeAllRanges(),e.addRange(Le)),ke&&e.anchorNode==null?e.addRange(ke):L&&this.startGracePeriod()),this.rememberSelection()},On.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)},On.prototype.showMultipleSelections=function(e){o(this.cm.display.cursorDiv,e.cursors),o(this.cm.display.selectionDiv,e.selection)},On.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},On.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return x(this.div,t)},On.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},On.prototype.blur=function(){this.div.blur()},On.prototype.getField=function(){return this.div},On.prototype.supportsTouch=function(){return!0},On.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():xr(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)},On.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},On.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(u&&m&&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=ma(t,e.anchorNode,e.anchorOffset),n=ma(t,e.focusNode,e.focusOffset);r&&n&&xr(t,function(){or(t.doc,Vr(r,n),xe),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})},On.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=$e(n.line-1,Dt(e.doc,n.line-1).length)),l.ch==Dt(e.doc,l.line).text.length&&l.line<e.lastLine()&&(l=$e(l.line+1,0)),n.line<t.viewFrom||l.line>t.viewTo-1)return!1;var M,V,Z;n.line==t.viewFrom||(M=ti(e,n.line))==0?(V=it(t.view[0].line),Z=t.view[0].node):(V=it(t.view[M].line),Z=t.view[M-1].node.nextSibling);var ee=ti(e,l.line),ne,me;if(ee==t.view.length-1?(ne=t.viewTo-1,me=t.lineDiv.lastChild):(ne=it(t.view[ee+1].line)-1,me=t.view[ee+1].node.previousSibling),!Z)return!1;for(var ye=e.doc.splitLines(tu(e,Z,me,V,ne)),ke=Sn(e.doc,$e(V,0),$e(ne,Dt(e.doc,ne).text.length));ye.length>1&&ke.length>1;)if(Me(ye)==Me(ke))ye.pop(),ke.pop(),ne--;else if(ye[0]==ke[0])ye.shift(),ke.shift(),V++;else break;for(var Le=0,Ze=0,ut=ye[0],vt=ke[0],wt=Math.min(ut.length,vt.length);Le<wt&&ut.charCodeAt(Le)==vt.charCodeAt(Le);)++Le;for(var Mt=Me(ye),_t=Me(ke),Ut=Math.min(Mt.length-(ye.length==1?Le:0),_t.length-(ke.length==1?Le:0));Ze<Ut&&Mt.charCodeAt(Mt.length-Ze-1)==_t.charCodeAt(_t.length-Ze-1);)++Ze;if(ye.length==1&&ke.length==1&&V==n.line)for(;Le&&Le>n.ch&&Mt.charCodeAt(Mt.length-Ze-1)==_t.charCodeAt(_t.length-Ze-1);)Le--,Ze++;ye[ye.length-1]=Mt.slice(0,Mt.length-Ze).replace(/^\u200b+/,""),ye[0]=ye[0].slice(Le).replace(/\u200b+$/,"");var $t=$e(V,Le),Xt=$e(ne,ke.length?Me(ke).length-Ze:0);if(ye.length>1||ye[0]||Ot($t,Xt))return yi(e.doc,ye,$t,Xt,"+input"),!0},On.prototype.ensurePolled=function(){this.forceCompositionEnd()},On.prototype.reset=function(){this.forceCompositionEnd()},On.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},On.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)},On.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&xr(this.cm,function(){return pr(e.cm)})},On.prototype.setUneditable=function(e){e.contentEditable="false"},On.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Jn(this.cm,Za)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},On.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},On.prototype.onContextMenu=function(){},On.prototype.resetPosition=function(){},On.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),M=St(n,e.doc.direction),V="left";if(M){var Z=Et(M,t.ch);V=Z%2?"right":"left"}var ee=lo(l.map,t.ch,V);return ee.offset=ee.collapse=="right"?ee.end:ee.start,ee}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Si(e,t){return t&&(e.bad=!0),e}function tu(e,t,r,n,l){var M="",V=!1,Z=e.doc.lineSeparator(),ee=!1;function ne(Le){return function(Ze){return Ze.id==Le}}function me(){V&&(M+=Z,ee&&(M+=Z),V=ee=!1)}function ye(Le){Le&&(me(),M+=Le)}function ke(Le){if(Le.nodeType==1){var Ze=Le.getAttribute("cm-text");if(Ze){ye(Ze);return}var ut=Le.getAttribute("cm-marker"),vt;if(ut){var wt=e.findMarks($e(n,0),$e(l+1,0),ne(+ut));wt.length&&(vt=wt[0].find(0))&&ye(Sn(e.doc,vt.from,vt.to).join(Z));return}if(Le.getAttribute("contenteditable")=="false")return;var Mt=/^(pre|div|p|li|table|br)$/i.test(Le.nodeName);if(!/^br$/i.test(Le.nodeName)&&Le.textContent.length==0)return;Mt&&me();for(var _t=0;_t<Le.childNodes.length;_t++)ke(Le.childNodes[_t]);/^(pre|p)$/i.test(Le.nodeName)&&(ee=!0),Mt&&(V=!0)}else Le.nodeType==3&&ye(Le.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(ke(t),t==r);)t=t.nextSibling,ee=!1;return M}function ma(e,t,r){var n;if(t==e.display.lineDiv){if(n=e.display.lineDiv.childNodes[r],!n)return Si(e.clipPos($e(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 M=e.display.view[l];if(M.node==n)return nu(M,t,r)}}function nu(e,t,r){var n=e.text.firstChild,l=!1;if(!t||!x(n,t))return Si($e(it(e.line),0),!0);if(t==n&&(l=!0,t=n.childNodes[r],r=0,!t)){var M=e.rest?Me(e.rest):e.line;return Si($e(it(M),M.text.length),l)}var V=t.nodeType==3?t:null,Z=t;for(!V&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(V=t.firstChild,r&&(r=V.nodeValue.length));Z.parentNode!=n;)Z=Z.parentNode;var ee=e.measure,ne=ee.maps;function me(vt,wt,Mt){for(var _t=-1;_t<(ne?ne.length:0);_t++)for(var Ut=_t<0?ee.map:ne[_t],$t=0;$t<Ut.length;$t+=3){var Xt=Ut[$t+2];if(Xt==vt||Xt==wt){var on=it(_t<0?e.line:e.rest[_t]),Pn=Ut[$t]+Mt;return(Mt<0||Xt!=vt)&&(Pn=Ut[$t+(Mt?1:0)]),$e(on,Pn)}}}var ye=me(V,Z,r);if(ye)return Si(ye,l);for(var ke=Z.nextSibling,Le=V?V.nodeValue.length-r:0;ke;ke=ke.nextSibling){if(ye=me(ke,ke.firstChild,0),ye)return Si($e(ye.line,ye.ch-Le),l);Le+=ke.textContent.length}for(var Ze=Z.previousSibling,ut=r;Ze;Ze=Ze.previousSibling){if(ye=me(Ze,Ze.firstChild,-1),ye)return Si($e(ye.line,ye.ch+ut),l);ut+=Ze.textContent.length}}var Hn=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new re,this.hasSelection=!1,this.composing=null};Hn.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),g&&(l.style.width="0px"),Ee(l,"input",function(){B&&N>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),Ee(l,"paste",function(V){if(Ue(n,V)||As(V,n))return;n.state.pasteIncoming=+new Date,r.fastPoll()});function M(V){if(Ue(n,V))return;if(n.somethingSelected())pa({lineWise:!1,text:n.getSelections()});else if(n.options.lineWiseCopyCut){var Z=Rs(n);pa({lineWise:!0,text:Z.text}),V.type=="cut"?n.setSelections(Z.ranges,null,xe):(r.prevInput="",l.value=Z.text.join(`
|
|
`),Q(l))}else return;V.type=="cut"&&(n.state.cutIncoming=+new Date)}Ee(l,"cut",M),Ee(l,"copy",M),Ee(e.scroller,"paste",function(V){if(Fr(e,V)||Ue(n,V))return;if(!l.dispatchEvent){n.state.pasteIncoming=+new Date,r.focus();return}var Z=new Event("paste");Z.clipboardData=V.clipboardData,l.dispatchEvent(Z)}),Ee(e.lineSpace,"selectstart",function(V){Fr(e,V)||te(V)}),Ee(l,"compositionstart",function(){var V=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:V,range:n.markText(V,n.getCursor("to"),{className:"CodeMirror-composing"})}}),Ee(l,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},Hn.prototype.createField=function(e){this.wrapper=Ms(),this.textarea=this.wrapper.firstChild},Hn.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Hn.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"),M=t.wrapper.getBoundingClientRect(),V=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,l.top+V.top-M.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,l.left+V.left-M.left))}return n},Hn.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")},Hn.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),B&&N>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",B&&N>=9&&(this.hasSelection=null))},Hn.prototype.getField=function(){return this.textarea},Hn.prototype.supportsTouch=function(){return!1},Hn.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!a||P()!=this.textarea))try{this.textarea.focus()}catch(e){}},Hn.prototype.blur=function(){this.textarea.blur()},Hn.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Hn.prototype.receivedFocus=function(){this.slowPoll()},Hn.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()})},Hn.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)},Hn.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||Fe(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(B&&N>=9&&this.hasSelection===l||i&&/[\uf700-\uf7ff]/.test(l))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var M=l.charCodeAt(0);if(M==8203&&!n&&(n="\u200B"),M==8666)return this.reset(),this.cm.execCommand("undo")}for(var V=0,Z=Math.min(n.length,l.length);V<Z&&n.charCodeAt(V)==l.charCodeAt(V);)++V;return xr(t,function(){Za(t,l.slice(V),n.length-V,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},Hn.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Hn.prototype.onKeyPress=function(){B&&N>=9&&(this.hasSelection=null),this.fastPoll()},Hn.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,l=t.textarea;t.contextMenuPending&&t.contextMenuPending();var M=ei(r,e),V=n.scroller.scrollTop;if(!M||O)return;var Z=r.options.resetSelectionOnContextMenu;Z&&r.doc.sel.contains(M)==-1&&Jn(r,or)(r.doc,Vr(M),xe);var ee=l.style.cssText,ne=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: `+(B?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ye;A&&(ye=window.scrollY),n.input.focus(),A&&window.scrollTo(null,ye),n.input.reset(),r.somethingSelected()||(l.value=t.prevInput=" "),t.contextMenuPending=Le,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll);function ke(){if(l.selectionStart!=null){var ut=r.somethingSelected(),vt="\u200B"+(ut?l.value:"");l.value="\u21DA",l.value=vt,t.prevInput=ut?"":"\u200B",l.selectionStart=1,l.selectionEnd=vt.length,n.selForContextMenu=r.doc.sel}}function Le(){if(t.contextMenuPending!=Le)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=ne,l.style.cssText=ee,B&&N<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=V),l.selectionStart!=null){(!B||B&&N<9)&&ke();var ut=0,vt=function(){n.selForContextMenu==r.doc.sel&&l.selectionStart==0&&l.selectionEnd>0&&t.prevInput=="\u200B"?Jn(r,Qo)(r):ut++<10?n.detectingSelectAll=setTimeout(vt,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(vt,200)}}if(B&&N>=9&&ke(),D){le(e);var Ze=function(){Ge(window,"mouseup",Ze),setTimeout(Le,20)};Ee(window,"mouseup",Ze)}else setTimeout(Le,50)},Hn.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Hn.prototype.setUneditable=function(){},Hn.prototype.needsContentAttribute=!1;function ru(e,t){if(t=t?F(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=P();t.autofocus=r==e||e.getAttribute("autofocus")!=null&&r==document.body}function n(){e.value=Z.getValue()}var l;if(e.form&&(Ee(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var M=e.form;l=M.submit;try{var V=M.submit=function(){n(),M.submit=l,M.submit(),M.submit=V}}catch(ee){}}t.finishInit=function(ee){ee.save=n,ee.getTextArea=function(){return e},ee.toTextArea=function(){ee.toTextArea=isNaN,n(),e.parentNode.removeChild(ee.getWrapperElement()),e.style.display="",e.form&&(Ge(e.form,"submit",n),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=l))}},e.style.display="none";var Z=In(function(ee){return e.parentNode.insertBefore(ee,e.nextSibling)},t);return Z}function iu(e){e.off=Ge,e.on=Ee,e.wheelEventPixels=cl,e.Doc=mr,e.splitLines=Be,e.countColumn=$,e.findColumn=De,e.isWordChar=Ye,e.Pass=_e,e.signal=Re,e.Line=dr,e.changeEnd=Xr,e.scrollbarModel=Ao,e.Pos=$e,e.cmpPos=Ot,e.modes=We,e.mimeModes=Ie,e.resolveMode=Ae,e.getMode=nt,e.modeExtensions=gt,e.extendMode=Bt,e.copyState=pt,e.startState=gn,e.innerMode=sn,e.commands=zi,e.keyMap=Wr,e.keyName=ps,e.isModifierKey=hs,e.lookupKey=Ei,e.normalizeKeyMap=Pl,e.StringStream=en,e.SharedTextMarker=Wi,e.TextMarker=$r,e.LineWidget=Fi,e.e_preventDefault=te,e.e_stopPropagation=ie,e.e_stop=le,e.addClass=j,e.contains=x,e.rmClass=h,e.keyNames=Jr}$l(In),ql(In);var au="iter insert remove copy getEditor constructor".split(" ");for(var ga in mr.prototype)mr.prototype.hasOwnProperty(ga)&&se(au,ga)<0&&(In.prototype[ga]=function(e){return function(){return e.apply(this.doc,arguments)}}(mr.prototype[ga]));return ce(mr),In.inputStyles={textarea:Hn,contenteditable:On},In.defineMode=function(e){!In.defaults.mode&&e!="null"&&(In.defaults.mode=e),tt.apply(this,arguments)},In.defineMIME=ft,In.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),In.defineMIME("text/plain","null"),In.defineExtension=function(e,t){In.prototype[e]=t},In.defineDocExtension=function(e,t){mr.prototype[e]=t},In.fromTextArea=ru,iu(In),In.version="5.58.2",In})},WaYH:function(Ke,we,U){"use strict";var q=U("rePB"),z=U("Ff2n"),L=U("VTBJ"),K=U("1OyB"),I=U("vuIU"),w=U("JX7q"),B=U("Ji7U"),N=U("LK+K"),A=U("q1tI"),k=U("TSYQ"),m=U.n(k),O=U("sboe"),R=U("OZM5"),_=function(D){var b=D.prefixCls,h=D.level,d=D.isStart,o=D.isEnd;if(!h)return null;for(var s="".concat(b,"-indent-unit"),C=[],y=0;y<h;y+=1){var x;C.push(A.createElement("span",{key:y,className:m()(s,(x={},Object(q.a)(x,"".concat(s,"-start"),d[y+1]),Object(q.a)(x,"".concat(s,"-end"),o[y+1]),Object(q.a)(x,"".concat(s,"-end-first-level"),!y&&o[0]),x))}))}return A.createElement("span",{"aria-hidden":"true",className:"".concat(b,"-indent")},C)},E=_,g=U("815F"),u="open",a="close",i="---",c=function(p){Object(B.a)(b,p);var D=Object(N.a)(b);function b(){var h;return Object(K.a)(this,b),h=D.apply(this,arguments),h.state={dragNodeHighlight:!1},h.onSelectorClick=function(d){var o=h.props.context.onNodeClick;o(d,Object(g.b)(h.props)),h.isSelectable()?h.onSelect(d):h.onCheck(d)},h.onSelectorDoubleClick=function(d){var o=h.props.context.onNodeDoubleClick;o(d,Object(g.b)(h.props))},h.onSelect=function(d){if(h.isDisabled())return;var o=h.props.context.onNodeSelect;d.preventDefault(),o(d,Object(g.b)(h.props))},h.onCheck=function(d){if(h.isDisabled())return;var o=h.props,s=o.disableCheckbox,C=o.checked,y=h.props.context.onNodeCheck;if(!h.isCheckable()||s)return;d.preventDefault();var x=!C;y(d,Object(g.b)(h.props),x)},h.onMouseEnter=function(d){var o=h.props.context.onNodeMouseEnter;o(d,Object(g.b)(h.props))},h.onMouseLeave=function(d){var o=h.props.context.onNodeMouseLeave;o(d,Object(g.b)(h.props))},h.onContextMenu=function(d){var o=h.props.context.onNodeContextMenu;o(d,Object(g.b)(h.props))},h.onDragStart=function(d){var o=h.props.context.onNodeDragStart;d.stopPropagation(),h.setState({dragNodeHighlight:!0}),o(d,Object(w.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(w.a)(h))},h.onDragOver=function(d){var o=h.props.context.onNodeDragOver;d.preventDefault(),d.stopPropagation(),o(d,Object(w.a)(h))},h.onDragLeave=function(d){var o=h.props.context.onNodeDragLeave;d.stopPropagation(),o(d,Object(w.a)(h))},h.onDragEnd=function(d){var o=h.props.context.onNodeDragEnd;d.stopPropagation(),h.setState({dragNodeHighlight:!1}),o(d,Object(w.a)(h))},h.onDrop=function(d){var o=h.props.context.onNodeDrop;d.preventDefault(),d.stopPropagation(),h.setState({dragNodeHighlight:!1}),o(d,Object(w.a)(h))},h.onExpand=function(d){var o=h.props.context.onNodeExpand;o(d,Object(g.b)(h.props))},h.setSelectHandle=function(d){h.selectHandle=d},h.getNodeState=function(){var d=h.props.expanded;return h.isLeaf()?null:d?u:a},h.hasChildren=function(){var d=h.props.eventKey,o=h.props.context.keyEntities,s=o[d]||{},C=s.children;return!!(C||[]).length},h.isLeaf=function(){var d=h.props,o=d.isLeaf,s=d.loaded,C=h.props.context.loadData,y=h.hasChildren();return o===!1?!1:o||!C&&!y||C&&s&&!y},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,C=d.loaded,y=h.props.context,x=y.loadData,P=y.onNodeLoad;if(s)return;x&&o&&!h.isLeaf()&&(!h.hasChildren()&&!C&&P(Object(g.b)(h.props)))},h.renderSwitcher=function(){var d=h.props,o=d.expanded,s=d.switcherIcon,C=h.props.context,y=C.prefixCls,x=C.switcherIcon,P=s||x;if(h.isLeaf())return A.createElement("span",{className:m()("".concat(y,"-switcher"),"".concat(y,"-switcher-noop"))},typeof P=="function"?P(Object(L.a)(Object(L.a)({},h.props),{},{isLeaf:!0})):P);var j=m()("".concat(y,"-switcher"),"".concat(y,"-switcher_").concat(o?u:a));return A.createElement("span",{onClick:h.onExpand,className:j},typeof P=="function"?P(Object(L.a)(Object(L.a)({},h.props),{},{isLeaf:!1})):P)},h.renderCheckbox=function(){var d=h.props,o=d.checked,s=d.halfChecked,C=d.disableCheckbox,y=h.props.context.prefixCls,x=h.isDisabled(),P=h.isCheckable();if(!P)return null;var j=typeof P!="boolean"?P:null;return A.createElement("span",{className:m()("".concat(y,"-checkbox"),o&&"".concat(y,"-checkbox-checked"),!o&&s&&"".concat(y,"-checkbox-indeterminate"),(x||C)&&"".concat(y,"-checkbox-disabled")),onClick:h.onCheck},j)},h.renderIcon=function(){var d=h.props.loading,o=h.props.context.prefixCls;return A.createElement("span",{className:m()("".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,C=o.selected,y=o.icon,x=o.loading,P=o.data,j=h.props.context,Y=j.prefixCls,Q=j.showIcon,X=j.icon,F=j.draggable,$=j.loadData,re=j.titleRender,se=h.isDisabled(),he="".concat(Y,"-node-content-wrapper"),_e;if(Q){var xe=y||X;_e=xe?A.createElement("span",{className:m()("".concat(Y,"-iconEle"),"".concat(Y,"-icon__customize"))},typeof xe=="function"?xe(h.props):xe):h.renderIcon()}else $&&x&&(_e=h.renderIcon());var Ce;typeof s=="function"?Ce=s(P):re?Ce=re(P):Ce=s;var Oe=A.createElement("span",{className:"".concat(Y,"-title")},Ce);return A.createElement("span",{ref:h.setSelectHandle,title:typeof s=="string"?s:"",className:m()("".concat(he),"".concat(he,"-").concat(h.getNodeState()||"normal"),!se&&(C||d)&&"".concat(Y,"-node-selected"),!se&&F&&"draggable"),draggable:!se&&F||void 0,"aria-grabbed":!se&&F||void 0,onMouseEnter:h.onMouseEnter,onMouseLeave:h.onMouseLeave,onContextMenu:h.onContextMenu,onClick:h.onSelectorClick,onDoubleClick:h.onSelectorDoubleClick,onDragStart:F?h.onDragStart:void 0},_e,Oe)},h}return Object(I.a)(b,[{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,C=o.className,y=o.style,x=o.dragOver,P=o.dragOverGapTop,j=o.dragOverGapBottom,Y=o.isLeaf,Q=o.isStart,X=o.isEnd,F=o.expanded,$=o.selected,re=o.checked,se=o.halfChecked,he=o.loading,_e=o.domRef,xe=o.active,Ce=o.onMouseMove,Oe=Object(z.a)(o,["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","onMouseMove"]),De=this.props.context,pe=De.prefixCls,ue=De.filterTreeNode,Me=De.draggable,at=De.keyEntities,lt=this.isDisabled(),et=Object(R.f)(Oe),Qe=at[s]||{},je=Qe.level,Ye=X[X.length-1];return A.createElement("div",Object.assign({ref:_e,className:m()(C,"".concat(pe,"-treenode"),(d={},Object(q.a)(d,"".concat(pe,"-treenode-disabled"),lt),Object(q.a)(d,"".concat(pe,"-treenode-switcher-").concat(F?"open":"close"),!Y),Object(q.a)(d,"".concat(pe,"-treenode-checkbox-checked"),re),Object(q.a)(d,"".concat(pe,"-treenode-checkbox-indeterminate"),se),Object(q.a)(d,"".concat(pe,"-treenode-selected"),$),Object(q.a)(d,"".concat(pe,"-treenode-loading"),he),Object(q.a)(d,"".concat(pe,"-treenode-active"),xe),Object(q.a)(d,"".concat(pe,"-treenode-leaf-last"),Ye),Object(q.a)(d,"drag-over",!lt&&x),Object(q.a)(d,"drag-over-gap-top",!lt&&P),Object(q.a)(d,"drag-over-gap-bottom",!lt&&j),Object(q.a)(d,"filter-node",ue&&ue(Object(g.b)(this.props))),d)),style:y,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:Ce},et),A.createElement(E,{prefixCls:pe,level:je,isStart:Q,isEnd:X}),this.renderSwitcher(),this.renderCheckbox(),this.renderSelector())}}]),b}(A.Component),S=function(D){return A.createElement(O.a.Consumer,null,function(b){return A.createElement(c,Object.assign({},D,{context:b}))})};S.displayName="TreeNode",S.defaultProps={title:i},S.isTreeNode=1;var v=we.a=S},XIdC:function(Ke,we,U){"use strict";var q=U("rePB"),z=U("ODXe"),L=U("Ff2n"),K=U("q1tI"),I=U.n(K),w=U("TSYQ"),B=U.n(w),N=U("6cGi"),A=U("4IlW"),k=K.forwardRef(function(m,O){var R,_=m.prefixCls,E=_===void 0?"rc-switch":_,g=m.className,u=m.checked,a=m.defaultChecked,i=m.disabled,c=m.loadingIcon,S=m.checkedChildren,v=m.unCheckedChildren,p=m.onClick,D=m.onChange,b=m.onKeyDown,h=Object(L.a)(m,["prefixCls","className","checked","defaultChecked","disabled","loadingIcon","checkedChildren","unCheckedChildren","onClick","onChange","onKeyDown"]),d=Object(N.a)(!1,{value:u,defaultValue:a}),o=Object(z.a)(d,2),s=o[0],C=o[1];function y(Y,Q){var X=s;return i||(X=Y,C(X),D==null||D(X,Q)),X}function x(Y){Y.which===A.a.LEFT?y(!1,Y):Y.which===A.a.RIGHT&&y(!0,Y),b==null||b(Y)}function P(Y){var Q=y(!s,Y);p==null||p(Q,Y)}var j=B()(E,g,(R={},Object(q.a)(R,"".concat(E,"-checked"),s),Object(q.a)(R,"".concat(E,"-disabled"),i),R));return K.createElement("button",Object.assign({},h,{type:"button",role:"switch","aria-checked":s,disabled:i,className:j,ref:O,onKeyDown:x,onClick:P}),c,K.createElement("span",{className:"".concat(E,"-inner")},s?S:v))});k.displayName="Switch",we.a=k},Y1PL:function(Ke,we,U){"use strict";U.r(we),U.d(we,"ResizableTextArea",function(){return se});var q=U("wx14"),z=U("1OyB"),L=U("vuIU"),K=U("Ji7U"),I=U("LK+K"),w=U("q1tI"),B=U("VTBJ"),N=U("rePB"),A=U("Zm9Q"),k=U("Kwbf"),m=U("c+Xe"),O=U("m+aA"),R=U("bdgK"),_=new Map;function E(xe){xe.forEach(function(Ce){var Oe,De=Ce.target;(Oe=_.get(De))===null||Oe===void 0||Oe.forEach(function(pe){return pe(De)})})}var g=new R.default(E),u=null,a=null;function i(xe,Ce){_.has(xe)||(_.set(xe,new Set),g.observe(xe)),_.get(xe).add(Ce)}function c(xe,Ce){_.has(xe)&&(_.get(xe).delete(Ce),_.get(xe).size||(g.unobserve(xe),_.delete(xe)))}var S=function(xe){Object(K.a)(Oe,xe);var Ce=Object(I.a)(Oe);function Oe(){return Object(z.a)(this,Oe),Ce.apply(this,arguments)}return Object(L.a)(Oe,[{key:"render",value:function(){return this.props.children}}]),Oe}(w.Component),v=w.createContext(null);function p(xe){var Ce=xe.children,Oe=xe.onBatchResize,De=w.useRef(0),pe=w.useRef([]),ue=w.useContext(v),Me=w.useCallback(function(at,lt,et){De.current+=1;var Qe=De.current;pe.current.push({size:at,element:lt,data:et}),Promise.resolve().then(function(){Qe===De.current&&(Oe==null||Oe(pe.current),pe.current=[])}),ue==null||ue(at,lt,et)},[Oe,ue]);return w.createElement(v.Provider,{value:Me},Ce)}function D(xe){var Ce=xe.children,Oe=xe.disabled,De=w.useRef(null),pe=w.useRef(null),ue=w.useContext(v),Me=w.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),at=w.isValidElement(Ce)&&Object(m.c)(Ce),lt=at?Ce.ref:null,et=w.useMemo(function(){return Object(m.a)(lt,De)},[lt,De]),Qe=w.useRef(xe);Qe.current=xe;var je=w.useCallback(function(Ye){var rt=Qe.current,mt=rt.onResize,ot=rt.data,qe=Ye.getBoundingClientRect(),Xe=qe.width,Ct=qe.height,xt=Ye.offsetWidth,bt=Ye.offsetHeight,Et=Math.floor(Xe),At=Math.floor(Ct);if(Me.current.width!==Et||Me.current.height!==At||Me.current.offsetWidth!==xt||Me.current.offsetHeight!==bt){var St={width:Et,height:At,offsetWidth:xt,offsetHeight:bt};Me.current=St;var Se=xt===Math.round(Xe)?Xe:xt,Ee=bt===Math.round(Ct)?Ct:bt,He=Object(B.a)(Object(B.a)({},St),{},{offsetWidth:Se,offsetHeight:Ee});ue==null||ue(He,Ye,ot),mt&&Promise.resolve().then(function(){mt(He,Ye)})}},[]);return w.useEffect(function(){var Ye=Object(O.a)(De.current)||Object(O.a)(pe.current);return Ye&&!Oe&&i(Ye,je),function(){return c(Ye,je)}},[De.current,Oe]),w.createElement(S,{ref:pe},at?w.cloneElement(Ce,{ref:et}):Ce)}var b="rc-observer-key";function h(xe){var Ce=xe.children,Oe=Object(A.a)(Ce);return Oe.map(function(De,pe){var ue=(De==null?void 0:De.key)||"".concat(b,"-").concat(pe);return w.createElement(D,Object(q.a)({},xe,{key:ue}),De)})}h.Collection=p;var d=h,o=U("bT9E"),s=U("TSYQ"),C=U.n(s),y=`
|
|
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
|
|
`,x=["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"],P={},j;function Y(xe){var Ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Oe=xe.getAttribute("id")||xe.getAttribute("data-reactid")||xe.getAttribute("name");if(Ce&&P[Oe])return P[Oe];var De=window.getComputedStyle(xe),pe=De.getPropertyValue("box-sizing")||De.getPropertyValue("-moz-box-sizing")||De.getPropertyValue("-webkit-box-sizing"),ue=parseFloat(De.getPropertyValue("padding-bottom"))+parseFloat(De.getPropertyValue("padding-top")),Me=parseFloat(De.getPropertyValue("border-bottom-width"))+parseFloat(De.getPropertyValue("border-top-width")),at=x.map(function(et){return"".concat(et,":").concat(De.getPropertyValue(et))}).join(";"),lt={sizingStyle:at,paddingSize:ue,borderSize:Me,boxSizing:pe};return Ce&&Oe&&(P[Oe]=lt),lt}function Q(xe){var Ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Oe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,De=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;j||(j=document.createElement("textarea"),j.setAttribute("tab-index","-1"),j.setAttribute("aria-hidden","true"),document.body.appendChild(j)),xe.getAttribute("wrap")?j.setAttribute("wrap",xe.getAttribute("wrap")):j.removeAttribute("wrap");var pe=Y(xe,Ce),ue=pe.paddingSize,Me=pe.borderSize,at=pe.boxSizing,lt=pe.sizingStyle;j.setAttribute("style","".concat(lt,";").concat(y)),j.value=xe.value||xe.placeholder||"";var et=Number.MIN_SAFE_INTEGER,Qe=Number.MAX_SAFE_INTEGER,je=j.scrollHeight,Ye;if(at==="border-box"?je+=Me:at==="content-box"&&(je-=ue),Oe!==null||De!==null){j.value=" ";var rt=j.scrollHeight-ue;Oe!==null&&(et=rt*Oe,at==="border-box"&&(et=et+ue+Me),je=Math.max(et,je)),De!==null&&(Qe=rt*De,at==="border-box"&&(Qe=Qe+ue+Me),Ye=je>Qe?"":"hidden",je=Math.min(Qe,je))}return{height:je,minHeight:et,maxHeight:Qe,overflowY:Ye,resize:"none"}}var X=U("Gytx"),F=U.n(X),$;(function(xe){xe[xe.NONE=0]="NONE",xe[xe.RESIZING=1]="RESIZING",xe[xe.RESIZED=2]="RESIZED"})($||($={}));var re=function(xe){Object(K.a)(Oe,xe);var Ce=Object(I.a)(Oe);function Oe(De){var pe;return Object(z.a)(this,Oe),pe=Ce.call(this,De),pe.nextFrameActionId=void 0,pe.resizeFrameId=void 0,pe.textArea=void 0,pe.saveTextArea=function(ue){pe.textArea=ue},pe.handleResize=function(ue){var Me=pe.state.resizeStatus,at=pe.props,lt=at.autoSize,et=at.onResize;if(Me!==$.NONE)return;typeof et=="function"&&et(ue),lt&&pe.resizeOnNextFrame()},pe.resizeOnNextFrame=function(){cancelAnimationFrame(pe.nextFrameActionId),pe.nextFrameActionId=requestAnimationFrame(pe.resizeTextarea)},pe.resizeTextarea=function(){var ue=pe.props.autoSize;if(!ue||!pe.textArea)return;var Me=ue.minRows,at=ue.maxRows,lt=Q(pe.textArea,!1,Me,at);pe.setState({textareaStyles:lt,resizeStatus:$.RESIZING},function(){cancelAnimationFrame(pe.resizeFrameId),pe.resizeFrameId=requestAnimationFrame(function(){pe.setState({resizeStatus:$.RESIZED},function(){pe.resizeFrameId=requestAnimationFrame(function(){pe.setState({resizeStatus:$.NONE}),pe.fixFirefoxAutoScroll()})})})})},pe.renderTextArea=function(){var ue=pe.props,Me=ue.prefixCls,at=Me===void 0?"rc-textarea":Me,lt=ue.autoSize,et=ue.onResize,Qe=ue.className,je=ue.disabled,Ye=pe.state,rt=Ye.textareaStyles,mt=Ye.resizeStatus,ot=Object(o.a)(pe.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),qe=C()(at,Qe,Object(N.a)({},"".concat(at,"-disabled"),je));"value"in ot&&(ot.value=ot.value||"");var Xe=Object(B.a)(Object(B.a)(Object(B.a)({},pe.props.style),rt),mt===$.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return w.createElement(d,{onResize:pe.handleResize,disabled:!(lt||et)},w.createElement("textarea",Object(q.a)({},ot,{className:qe,style:Xe,ref:pe.saveTextArea})))},pe.state={textareaStyles:{},resizeStatus:$.NONE},pe}return Object(L.a)(Oe,[{key:"componentDidUpdate",value:function(pe){(pe.value!==this.props.value||!F()(pe.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 pe=this.textArea.selectionStart,ue=this.textArea.selectionEnd;this.textArea.setSelectionRange(pe,ue)}}catch(Me){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Oe}(w.Component),se=re,he=function(xe){Object(K.a)(Oe,xe);var Ce=Object(I.a)(Oe);function Oe(De){var pe;Object(z.a)(this,Oe),pe=Ce.call(this,De),pe.resizableTextArea=void 0,pe.focus=function(){pe.resizableTextArea.textArea.focus()},pe.saveTextArea=function(Me){pe.resizableTextArea=Me},pe.handleChange=function(Me){var at=pe.props.onChange;pe.setValue(Me.target.value,function(){pe.resizableTextArea.resizeTextarea()}),at&&at(Me)},pe.handleKeyDown=function(Me){var at=pe.props,lt=at.onPressEnter,et=at.onKeyDown;Me.keyCode===13&<&<(Me),et&&et(Me)};var ue=typeof De.value=="undefined"||De.value===null?De.defaultValue:De.value;return pe.state={value:ue},pe}return Object(L.a)(Oe,[{key:"setValue",value:function(pe,ue){"value"in this.props||this.setState({value:pe},ue)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return w.createElement(se,Object(q.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(pe){return"value"in pe?{value:pe.value}:null}}]),Oe}(w.Component),_e=we.default=he},ZD9Y:function(Ke,we,U){"use strict";var q=U("BoS7"),z=U("Sdc0"),L=U("OaEy"),K=U("2fM7"),I=U("q1tI"),w=U.n(I),B=U("lOMy"),N=U.n(B),A=K.a.Option;we.a=function(k){var m=k.onFontSizeChange,O=k.cmFontSize,R=k.cmCodeMode,_=k.onCodeModeChange,E=k.onTabToSpace,g=k.className,u=g===void 0?"":g,a=k.tabToSpace,i=k.children;return w.a.createElement("div",{className:"tpi-code-setting ".concat(u)},w.a.createElement("h3",null,"\u4EE3\u7801\u683C\u5F0F"),w.a.createElement("section",null,w.a.createElement("div",{className:"file-item"},w.a.createElement("b",null,"\u663E\u793A\u6A21\u5F0F"),w.a.createElement(K.a,{bordered:!1,size:"small",value:R,onChange:_},w.a.createElement(A,{value:"vs"},"\u767D\u8272\u80CC\u666F"),w.a.createElement(A,{value:"vs-dark"},"\u9ED1\u8272\u80CC\u666F"))),w.a.createElement("div",{className:"file-item"},w.a.createElement("b",null,"\u5B57\u4F53\u5927\u5C0F"),w.a.createElement(K.a,{bordered:!1,size:"small",value:O,onChange:m},w.a.createElement(A,{value:12},"12px"),w.a.createElement(A,{value:14},"14px"),w.a.createElement(A,{value:16},"16px"),w.a.createElement(A,{value:18},"18px"),w.a.createElement(A,{value:20},"20px"),w.a.createElement(A,{value:22},"22px"))),w.a.createElement("div",{className:"file-item"},w.a.createElement("b",null,"Tab\u8F6C\u6362"),w.a.createElement(z.a,{checked:a,onChange:E}))),w.a.createElement("h3",null,"\u5FEB\u6377\u952E"),w.a.createElement("section",null,w.a.createElement("div",{className:"file-item"},w.a.createElement("b",null,"\u4FDD\u5B58\u4EE3\u7801"),w.a.createElement("span",null,"Ctrl + S")),w.a.createElement("div",{className:"file-item"},w.a.createElement("b",null,"\u5524\u51FA\u5FEB\u6377\u952E\u5217\u8868"),w.a.createElement("span",null,"F1 / Alt + F1")),w.a.createElement("div",{className:"file-item"},w.a.createElement("b",null,"\u5DE6\u53F3\u7F29\u8FDB"),w.a.createElement("span",null,"Ctrl + ]/[")),w.a.createElement("div",{className:"file-item"},w.a.createElement("b",null,"\u8DF3\u5230\u5339\u914D\u7684\u62EC\u53F7"),w.a.createElement("span",null,"Ctrl + Shift + \\")),w.a.createElement("div",{className:"file-item"},w.a.createElement("b",null,"\u8F6C\u5230\u884C\u9996"),w.a.createElement("span",null,"Home")),w.a.createElement("div",{className:"file-item"},w.a.createElement("b",null,"\u8F6C\u5230\u884C\u5C3E"),w.a.createElement("span",null,"End"))),i)}},ZW9T:function(Ke,we,U){"use strict";U.d(we,"a",function(){return S});var q=U("k1fw"),z=U("miYZ"),L=U("tsqr"),K=U("rAM+"),I=U("tJVT"),w=U("PpiC"),B=U("q1tI"),N=U.n(B),A=U("bdgK");function k(v,p,D,b,h){var d=p.getWordUntilPosition(D),o={startLineNumber:D.lineNumber,endLineNumber:D.lineNumber,startColumn:d.startColumn,endColumn:d.endColumn},s=b.map(function(C){return{label:C,kind:v.languages.CompletionItemKind.Keyword,insertText:C,insertTextRules:v.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:o}});return h.map(function(C){s.push(Object(q.a)(Object(q.a)({},C),{},{range:o}))}),s}var m=function(v){var p={label:"ifelse",kind:v.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`),insertTextRules:v.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"];v.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(o,s){var C=k(v,o,s,D,[p]);return{suggestions:C}}});var b=["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"];v.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(o,s){var C=[{label:"print",kind:v.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:v.languages.CompletionItemInsertTextRule.InsertAsSnippet}],y=k(v,o,s,b,C);return{suggestions:y}}});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"];v.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(o,s){var C=[p,{label:"main",kind:v.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`),insertTextRules:v.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:v.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
|
|
`),insertTextRules:v.languages.CompletionItemInsertTextRule.InsertAsSnippet}],y=k(v,o,s,h,C);return{suggestions:y}}})},O="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",R=U("LvDl");function _(v){return/^\d+$/.test(v)?"".concat(v,"px"):v}function E(){}var g=!1,u={"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 v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],p=v;if(Array.isArray(v)){for(var D=0;D<v.length;D++){var b=u[v[D]];if(b)return b}return p[0]}return u[p]||p}var i=null,c=we.b=function(v){var p=v.width,D=p===void 0?"100%":p,b=v.height,h=b===void 0?"100%":b,d=v.value,o=v.language,s=o===void 0?"javascript":o,C=v.style,y=C===void 0?{}:C,x=v.options,P=x===void 0?{}:x,j=v.overrideServices,Y=j===void 0?{}:j,Q=v.theme,X=Q===void 0?"vs-dark":Q,F=v.onEditBlur,$=v.onSave,re=v.autoHeight,se=re===void 0?!1:re,he=v.forbidCopy,_e=he===void 0?!1:he,xe=v.onChange,Ce=xe===void 0?E:xe,Oe=v.editorDidMount,De=Oe===void 0?E:Oe,pe=v.onFocus,ue=pe===void 0?E:pe,Me=v.filename,at=Me===void 0?"educoder.txt":Me,lt=Object(w.a)(v,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),et=Object(B.useRef)(),Qe=Object(B.useRef)({}),je=Object(B.useRef)(),Ye=Object(B.useRef)(!1),rt=Object(B.useRef)(),mt=Object(B.useState)(!1),ot=Object(I.a)(mt,2),qe=ot[0],Xe=ot[1];function Ct(){var ae;return et.current&&(ae=new A.default(function(le){var Te=Object(K.a)(le),be;try{for(Te.s();!(be=Te.n()).done;){var ze=be.value;(ze.target.offsetHeight>0||ze.target.offsetWidth>0)&&Qe.current.instance.layout()}}catch(dt){Te.e(dt)}finally{Te.f()}}),ae.observe(et.current)),ae}function xt(){L.b.warn(decodeURIComponent(O))}var bt=function(){var le=Qe.current.instance;if(d!=null&&le&&qe){var Te=le.getModel();Te&&d!==Te.getValue()&&(g=!0,Te.setValue(d),le.layout(),g=!1)}};Object(B.useEffect)(function(){je.current&&clearTimeout(je.current),je.current=setTimeout(function(){bt()},500)},[d,qe,Qe.current]);function Et(){var ae=Qe.current.instance;if(ae){var le=ae.getSelection(),Te=Qe.current.pastePos||{},be=new i.Range(Te.startLineNumber||le.endLineNumber,Te.startColumn||le.endColumn,Te.endLineNumber||le.endLineNumber,Te.endColumn||le.endColumn);setTimeout(function(){ae.executeEdits("",[{range:be,text:""}])},300)}}function At(ae){(window.navigator.platform.match("Mac")?ae.metaKey:ae.ctrlKey)&&ae.keyCode==83&&(ae.preventDefault(),$())}var St=function(){if(se&&Qe.current.instance){var le=Qe.current.instance.getContentHeight();te(le<h?h:le)}else te(h)};function Se(ae){var le=document.createEvent("MouseEvents");le.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),ae.dispatchEvent(le)}function Ee(ae,le){var Te=window.URL||window.webkitURL||window,be=new Blob([le]),ze=document.createElementNS("http://www.w3.org/1999/xhtml","a");ze.href=Te.createObjectURL(be),ze.download=ae,Se(ze)}Object(B.useEffect)(function(){St()},[St]),Object(B.useEffect)(function(){et.current&&!qe&&U.e(27).then(U.t.bind(null,"M/lh",7)).then(function(ae){try{i=ae,Qe.current.instance=i.editor.create(et.current,{value:d,language:a(s),theme:X,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},Y);var le=Qe.current.instance;if(De(le,i),setTimeout(function(){St(),Qe.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Ee(at||"educoder.txt",le.getValue())}})},500),Qe.current.subscription=le.onDidChangeModelContent(function(be){Ye.current?clearTimeout(rt.current):(St(),Ce(le.getValue(),be)),rt.current=setTimeout(function(){Ye.current=!1},500)}),window.Monaco||m(i),_e&&(le.addCommand(i.KeyMod.CtrlCmd|i.KeyMod.Shift|i.KeyCode.KEY_V,function(){return xt(),null}),le.addCommand(i.KeyMod.CtrlCmd|i.KeyCode.KEY_C,function(){return xt(),null})),window.Monaco=i,F&&le.onDidBlurEditorWidget(function(){F(le.getValue())}),ue&&le.onDidFocusEditorText(function(){ue(le.getValue())}),_e){le.addCommand(i.KeyMod.CtrlCmd|i.KeyCode.KEY_V,function(){return xt(),null}),le.onDidPaste(function(be){Qe.current.pastePos=be});try{window.addEventListener("paste",Et)}catch(be){}}var Te=Ct();return Xe(!0),function(){var be=Qe.current.instance;be.dispose();var ze=be.getModel();ze&&ze.dispose(),Qe.current.subscription&&Qe.current.subscription.dispose(),_e&&window.removeEventListener("paste",Et),Te.unobserve(et.current)}}catch(be){}})},[]),Object(B.useEffect)(function(){var ae=Qe.current.instance;if(ae&&qe)return document.addEventListener("keydown",At,!1),function(){document.removeEventListener("keydown",At)}},[$,qe]),Object(B.useEffect)(function(){var ae=Qe.current.instance;if(ae&&qe){var le=a(s);i.editor.setModelLanguage(ae.getModel(),le),console.log("language:",s,ae.getModel(),le)}},[s,qe]),Object(B.useEffect)(function(){var ae=Qe.current.instance;ae&&qe&&i.editor.setTheme(X)},[X,qe]),Object(B.useEffect)(function(){var ae=Qe.current.instance;ae&&qe&&(ae.updateOptions(Object(q.a)({},P)),setTimeout(function(){ae.getModel().updateOptions(Object(q.a)({},P))},200))},[JSON.stringify(P),qe]),Object(B.useEffect)(function(){var ae=Qe.current.instance;ae&&qe&&ae.layout()},[D,h,qe]);var He=Object(B.useState)(_(D)),Ge=Object(I.a)(He,2),Re=Ge[0],Ue=Ge[1],ge=Object(B.useState)(_(h)),de=Object(I.a)(ge,2),ce=de[0],te=de[1],ie=Object(q.a)(Object(q.a)({},y),{},{width:Re,height:ce});return N.a.createElement("div",{className:"my-monaco-editor",ref:et,style:ie})};function S(v){var p=v.width,D=p===void 0?"100%":p,b=v.height,h=b===void 0?"100%":b,d=v.original,o=v.modified,s=v.language,C=v.options,y=C===void 0?{}:C,x=Object(B.useRef)(),P=Object(B.useState)(null),j=Object(I.a)(P,2),Y=j[0],Q=j[1];function X(se){var he;return x.current&&(he=new A.default(function(_e){var xe=Object(K.a)(_e),Ce;try{for(xe.s();!(Ce=xe.n()).done;){var Oe=Ce.value;(Oe.target.offsetHeight>0||Oe.target.offsetWidth>0)&&se.layout()}}catch(De){xe.e(De)}finally{xe.f()}}),he.observe(x.current)),he}Object(B.useEffect)(function(){x.current&&U.e(27).then(U.t.bind(null,"M/lh",7)).then(function(se){i=se;var he=i.editor.createDiffEditor(x.current,Object(q.a)(Object(q.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},y),{},{wordWrap:!0}));Q(he);var _e=X(he);return function(){he.dispose();var xe=he.getModel();xe&&xe.dispose(),_e.unobserve(x.current)}})},[]),Object(B.useEffect)(function(){Y&&Y.setModel({original:i.editor.createModel(d,s),modified:i.editor.createModel(o,s)})},[d,o,s,Y]);var F=_(D),$=_(h),re={width:F,height:$};return N.a.createElement("div",{className:"my-diff-editor",ref:x,style:re})}},ZpRC:function(Ke,we,U){"use strict";function q(m){return typeof m=="object"&&m!=null&&m.nodeType===1}function z(m,O){return(!O||m!=="hidden")&&m!=="visible"&&m!=="clip"}function L(m,O){if(m.clientHeight<m.scrollHeight||m.clientWidth<m.scrollWidth){var R=getComputedStyle(m,null);return z(R.overflowY,O)||z(R.overflowX,O)||function(_){var E=function(g){if(!g.ownerDocument||!g.ownerDocument.defaultView)return null;try{return g.ownerDocument.defaultView.frameElement}catch(u){return null}}(_);return!!E&&(E.clientHeight<_.scrollHeight||E.clientWidth<_.scrollWidth)}(m)}return!1}function K(m,O,R,_,E,g,u,a){return g<m&&u>O||g>m&&u<O?0:g<=m&&a<=R||u>=O&&a>=R?g-m-_:u>O&&a<R||g<m&&a>R?u-O+E:0}var I=function(m,O){var R=window,_=O.scrollMode,E=O.block,g=O.inline,u=O.boundary,a=O.skipOverflowHiddenElements,i=typeof u=="function"?u:function(rt){return rt!==u};if(!q(m))throw new TypeError("Invalid target");for(var c=document.scrollingElement||document.documentElement,S=[],v=m;q(v)&&i(v);){if((v=v.parentElement)===c){S.push(v);break}v!=null&&v===document.body&&L(v)&&!L(document.documentElement)||v!=null&&L(v,a)&&S.push(v)}for(var p=R.visualViewport?R.visualViewport.width:innerWidth,D=R.visualViewport?R.visualViewport.height:innerHeight,b=window.scrollX||pageXOffset,h=window.scrollY||pageYOffset,d=m.getBoundingClientRect(),o=d.height,s=d.width,C=d.top,y=d.right,x=d.bottom,P=d.left,j=E==="start"||E==="nearest"?C:E==="end"?x:C+o/2,Y=g==="center"?P+s/2:g==="end"?y:P,Q=[],X=0;X<S.length;X++){var F=S[X],$=F.getBoundingClientRect(),re=$.height,se=$.width,he=$.top,_e=$.right,xe=$.bottom,Ce=$.left;if(_==="if-needed"&&C>=0&&P>=0&&x<=D&&y<=p&&C>=he&&x<=xe&&P>=Ce&&y<=_e)return Q;var Oe=getComputedStyle(F),De=parseInt(Oe.borderLeftWidth,10),pe=parseInt(Oe.borderTopWidth,10),ue=parseInt(Oe.borderRightWidth,10),Me=parseInt(Oe.borderBottomWidth,10),at=0,lt=0,et="offsetWidth"in F?F.offsetWidth-F.clientWidth-De-ue:0,Qe="offsetHeight"in F?F.offsetHeight-F.clientHeight-pe-Me:0;if(c===F)at=E==="start"?j:E==="end"?j-D:E==="nearest"?K(h,h+D,D,pe,Me,h+j,h+j+o,o):j-D/2,lt=g==="start"?Y:g==="center"?Y-p/2:g==="end"?Y-p:K(b,b+p,p,De,ue,b+Y,b+Y+s,s),at=Math.max(0,at+h),lt=Math.max(0,lt+b);else{at=E==="start"?j-he-pe:E==="end"?j-xe+Me+Qe:E==="nearest"?K(he,xe,re,pe,Me+Qe,j,j+o,o):j-(he+re/2)+Qe/2,lt=g==="start"?Y-Ce-De:g==="center"?Y-(Ce+se/2)+et/2:g==="end"?Y-_e+ue+et:K(Ce,_e,se,De,ue+et,Y,Y+s,s);var je=F.scrollLeft,Ye=F.scrollTop;j+=Ye-(at=Math.max(0,Math.min(Ye+at,F.scrollHeight-re+Qe))),Y+=je-(lt=Math.max(0,Math.min(je+lt,F.scrollWidth-se+et)))}Q.push({el:F,top:at,left:lt})}return Q};function w(m){return m===Object(m)&&Object.keys(m).length!==0}function B(m,O){O===void 0&&(O="auto");var R="scrollBehavior"in document.body.style;m.forEach(function(_){var E=_.el,g=_.top,u=_.left;E.scroll&&R?E.scroll({top:g,left:u,behavior:O}):(E.scrollTop=g,E.scrollLeft=u)})}function N(m){return m===!1?{block:"end",inline:"nearest"}:w(m)?m:{block:"start",inline:"nearest"}}function A(m,O){var R=!m.ownerDocument.documentElement.contains(m);if(w(O)&&typeof O.behavior=="function")return O.behavior(R?[]:I(m,O));if(R)return;var _=N(O);return B(I(m,_),_.behavior)}var k=we.a=A},a4uL:function(Ke,we,U){},bCnd:function(Ke,we,U){"use strict";U.d(we,"b",function(){return K}),U.d(we,"a",function(){return I});var q=U("je13"),z=U.n(q),L=!1;function K(w,B){var N=z.a.get("__ec");N||(N={}),N[w]=B,z.a.set("__ec",N)}function I(w,B){var N=z.a.get("__ec");return N?N[w]===void 0?B:N[w]:B}},bT9E:function(Ke,we,U){"use strict";U.d(we,"a",function(){return z});var q=U("VTBJ");function z(L,K){var I=Object(q.a)({},L);return Array.isArray(K)&&K.forEach(function(w){delete I[w]}),I}},biw7:function(Ke,we,U){"use strict";var q=U("q1tI"),z=U.n(q),L=q.createContext(null);we.a=L},c5Ni:function(Ke,we,U){},cDPC:function(Ke,we,U){"use strict";var q=U("tJVT"),z=U("q1tI"),L=U.n(z),K=U("i3hx"),I=U.n(K);we.a=function(w){var B=w.defaultX,N=B===void 0?"40%":B,A=w.leftChild,k=w.rightChild,m=w.className,O=w.hideResize,R=O===void 0?!1:O,_=Object(z.useState)(N),E=Object(q.a)(_,2),g=E[0],u=E[1],a=Object(z.useRef)();function i(){a.current=!0}Object(z.useEffect)(function(){function v(D){a.current&&u(D.pageX)}function p(){a.current=!1}return window.addEventListener("mousemove",v),window.addEventListener("mouseup",p),function(){window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",p)}},[]);var c=typeof g=="number"&&g!==.01?"".concat(g,"px"):N,S="calc(100% - ".concat(R?"0px":"4px"," - ").concat(c,")");return L.a.createElement("div",{className:"split-panel-container ".concat(m)},L.a.createElement("section",{style:{width:c,display:g===.01?"none":""}},A),L.a.createElement("section",{className:"resize-x-bar",onMouseDown:i},L.a.createElement("a",{className:"btn-resize"},L.a.createElement("svg",{width:"16",height:"13",viewBox:"0 0 16 13"},L.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"})))),L.a.createElement("section",{style:{width:S}},k))}},dejd:function(Ke,we,U){},dmUQ:function(Ke,we,U){"use strict";var q=U("Ff2n"),z=U("rePB"),L=U("1OyB"),K=U("vuIU"),I=U("Ji7U"),w=U("md7G"),B=U("foSv"),N=U("q1tI"),A=U.n(N),k=U("TSYQ"),m=U.n(k),O=U("4IlW");function R(o,s){var C=Object.keys(o);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(o);s&&(y=y.filter(function(x){return Object.getOwnPropertyDescriptor(o,x).enumerable})),C.push.apply(C,y)}return C}function _(o){for(var s=1;s<arguments.length;s++){var C=arguments[s]!=null?arguments[s]:{};s%2?R(Object(C),!0).forEach(function(y){Object(z.a)(o,y,C[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(C)):R(Object(C)).forEach(function(y){Object.defineProperty(o,y,Object.getOwnPropertyDescriptor(C,y))})}return o}function E(o){var s=g();return function(){var y=Object(B.a)(o),x;if(s){var P=Object(B.a)(this).constructor;x=Reflect.construct(y,arguments,P)}else x=y.apply(this,arguments);return Object(w.a)(this,x)}}function g(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(o){return!1}}function u(){}function a(o){o.preventDefault()}var i=function(s){return s.replace(/[^\w.-]+/g,"")},c=200,S=600,v=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,p=function(s){return s!=null},D=function(s,C){return C===s||typeof C=="number"&&typeof s=="number"&&isNaN(C)&&isNaN(s)},b=function(o){Object(I.a)(C,o);var s=E(C);function C(y){var x;Object(L.a)(this,C),x=s.call(this,y),x.onKeyDown=function(Y){var Q=x.props,X=Q.onKeyDown,F=Q.onPressEnter;if(Y.keyCode===O.a.UP){var $=x.getRatio(Y);x.up(Y,$,null),x.stop()}else if(Y.keyCode===O.a.DOWN){var re=x.getRatio(Y);x.down(Y,re,null),x.stop()}else Y.keyCode===O.a.ENTER&&F&&F(Y);if(x.recordCursorPosition(),x.lastKeyCode=Y.keyCode,X){for(var se=arguments.length,he=new Array(se>1?se-1:0),_e=1;_e<se;_e++)he[_e-1]=arguments[_e];X.apply(void 0,[Y].concat(he))}},x.onKeyUp=function(Y){var Q=x.props.onKeyUp;if(x.stop(),x.recordCursorPosition(),Q){for(var X=arguments.length,F=new Array(X>1?X-1:0),$=1;$<X;$++)F[$-1]=arguments[$];Q.apply(void 0,[Y].concat(F))}},x.onChange=function(Y){var Q=x.props.onChange;x.state.focused&&(x.inputting=!0),x.rawInput=x.props.parser(x.getValueFromEvent(Y)),x.setState({inputValue:x.rawInput}),Q(x.toNumber(x.rawInput))},x.onMouseUp=function(){var Y=x.props.onMouseUp;x.recordCursorPosition(),Y&&Y.apply(void 0,arguments)},x.onFocus=function(){var Y;x.setState({focused:!0}),(Y=x.props).onFocus.apply(Y,arguments)},x.onBlur=function(){var Y=x.props.onBlur;x.inputting=!1,x.setState({focused:!1});var Q=x.getCurrentValidValue(x.state.inputValue),X=x.setValue(Q,u);if(Y){var F=x.input.value,$=x.getInputDisplayValue({focus:!1,value:X});x.input.value=$&&Number($),Y.apply(void 0,arguments),x.input.value=F}},x.getRatio=function(Y){var Q=1;return Y.metaKey||Y.ctrlKey?Q=.1:Y.shiftKey&&(Q=10),Q},x.getFullNum=function(Y){return isNaN(Y)?Y:/e/i.test(String(Y))?Number(Y).toFixed(18).replace(/\.?0+$/,""):Y},x.getPrecision=function(Y){if(p(x.props.precision))return x.props.precision;var Q=String(Y);if(Q.indexOf("e-")>=0)return parseInt(Q.slice(Q.indexOf("e-")+2),10);var X=0;return Q.indexOf(".")>=0&&(X=Q.length-Q.indexOf(".")-1),X},x.getInputDisplayValue=function(Y){var Q=Y||x.state,X=Q.focused,F=Q.inputValue,$=Q.value,re;X?re=F:re=x.toPrecisionAsStep($),re==null&&(re="");var se=x.formatWrapper(re);return p(x.props.decimalSeparator)&&(se=se.toString().replace(".",x.props.decimalSeparator)),se},x.recordCursorPosition=function(){try{x.cursorStart=x.input.selectionStart,x.cursorEnd=x.input.selectionEnd,x.currentValue=x.input.value,x.cursorBefore=x.input.value.substring(0,x.cursorStart),x.cursorAfter=x.input.value.substring(x.cursorEnd)}catch(Y){}},x.restoreByAfter=function(Y){if(Y===void 0)return!1;var Q=x.input.value,X=Q.lastIndexOf(Y);if(X===-1)return!1;var F=x.cursorBefore.length;return x.lastKeyCode===O.a.DELETE&&x.cursorBefore.charAt(F-1)===Y[0]?(x.fixCaret(F,F),!0):X+Y.length===Q.length?(x.fixCaret(X,X),!0):!1},x.partRestoreByAfter=function(Y){return Y===void 0?!1:Array.prototype.some.call(Y,function(Q,X){var F=Y.substring(X);return x.restoreByAfter(F)})},x.isNotCompleteNumber=function(Y){return isNaN(Y)||Y===""||Y===null||Y&&Y.toString().indexOf(".")===Y.toString().length-1},x.stop=function(){x.autoStepTimer&&clearTimeout(x.autoStepTimer)},x.down=function(Y,Q,X){x.pressingUpOrDown=!0,x.step("down",Y,Q,X)},x.up=function(Y,Q,X){x.pressingUpOrDown=!0,x.step("up",Y,Q,X)},x.saveInput=function(Y){x.input=Y};var P=y.value;P===void 0&&(P=y.defaultValue),x.state={focused:y.autoFocus};var j=x.getValidValue(x.toNumber(P));return x.state=_(_({},x.state),{},{inputValue:x.toPrecisionAsStep(j),value:j}),x}return Object(K.a)(C,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(x){var P=this.props,j=P.value,Y=P.onChange,Q=P.max,X=P.min,F=this.state.focused;if(x){if(!D(x.value,j)||!D(x.max,Q)||!D(x.min,X)){var $=F?j:this.getValidValue(j),re;this.pressingUpOrDown?re=$:this.inputting?re=this.rawInput:re=this.toPrecisionAsStep($),this.setState({value:$,inputValue:re})}var se="value"in this.props?j:this.state.value;"max"in this.props&&x.max!==Q&&typeof se=="number"&&se>Q&&Y&&Y(Q),"min"in this.props&&x.min!==X&&typeof se=="number"&&se<X&&Y&&Y(X)}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===O.a.BACKSPACE?he=this.cursorStart-1:this.lastKeyCode===O.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 O.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case O.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(_e){}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(x){var P=x;return P===""?P="":this.isNotCompleteNumber(parseFloat(P))?P=this.state.value:P=this.getValidValue(P),this.toNumber(P)}},{key:"getValueFromEvent",value:function(x){var P=x.target.value.trim().replace(/。/g,".");return p(this.props.decimalSeparator)&&(P=P.replace(this.props.decimalSeparator,".")),P}},{key:"getValidValue",value:function(x){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,Y=parseFloat(x);return isNaN(Y)?x:(Y<P&&(Y=P),Y>j&&(Y=j),Y)}},{key:"setValue",value:function(x,P){var j=this.props.precision,Y=this.isNotCompleteNumber(parseFloat(x))?null:parseFloat(x),Q=this.state.value,X=Q===void 0?null:Q,F=this.state.inputValue,$=F===void 0?null:F,re=typeof Y=="number"?Y.toFixed(j):"".concat(Y),se=Y!==X||re!=="".concat($);return"value"in this.props?($=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:$},P)):this.setState({value:Y,inputValue:this.toPrecisionAsStep(x)},P),se&&this.props.onChange(Y),Y}},{key:"getMaxPrecision",value:function(x){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,j=this.props,Y=j.precision,Q=j.step;if(p(Y))return Y;var X=this.getPrecision(P),F=this.getPrecision(Q),$=this.getPrecision(x);return x?Math.max($,X+F):X+F}},{key:"getPrecisionFactor",value:function(x){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,j=this.getMaxPrecision(x,P);return Math.pow(10,j)}},{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(x){return this.props.formatter?this.props.formatter(x):x}},{key:"toPrecisionAsStep",value:function(x){if(this.isNotCompleteNumber(x)||x==="")return x;var P=Math.abs(this.getMaxPrecision(x));return isNaN(P)?x.toString():Number(x).toFixed(P)}},{key:"toNumber",value:function(x){var P=this.props.precision,j=this.state.focused,Y=x&&x.length>16&&j;return this.isNotCompleteNumber(x)||Y?x:p(P)?Math.round(x*Math.pow(10,P))/Math.pow(10,P):Number(x)}},{key:"upStep",value:function(x,P){var j=this.props.step,Y=this.getPrecisionFactor(x,P),Q=Math.abs(this.getMaxPrecision(x,P)),X=((Y*x+Y*j*P)/Y).toFixed(Q);return this.toNumber(X)}},{key:"downStep",value:function(x,P){var j=this.props.step,Y=this.getPrecisionFactor(x,P),Q=Math.abs(this.getMaxPrecision(x,P)),X=((Y*x-Y*j*P)/Y).toFixed(Q);return this.toNumber(X)}},{key:"step",value:function(x,P){var j=this,Y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,Q=arguments.length>3?arguments[3]:void 0;this.stop(),P&&(P.persist(),P.preventDefault());var X=this.props;if(X.disabled)return;var F=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(F))return;var $=this["".concat(x,"Step")](F,Y),re=$>X.max||$<X.min;if($>X.max?$=X.max:$<X.min&&($=X.min),this.setValue($,null),this.setState({focused:!0},function(){j.pressingUpOrDown=!1}),re)return;this.autoStepTimer=setTimeout(function(){j[x](P,Y,!0)},Q?c:S)}},{key:"fixCaret",value:function(x,P){if(x===void 0||P===void 0||!this.input||!this.input.value)return;try{var j=this.input.selectionStart,Y=this.input.selectionEnd;(x!==j||P!==Y)&&this.input.setSelectionRange(x,P)}catch(Q){}}},{key:"render",value:function(){var x,P=this.props,j=P.prefixCls,Y=P.disabled,Q=P.readOnly,X=P.useTouch,F=P.autoComplete,$=P.upHandler,re=P.downHandler,se=P.className,he=P.max,_e=P.min,xe=P.style,Ce=P.title,Oe=P.onMouseEnter,De=P.onMouseLeave,pe=P.onMouseOver,ue=P.onMouseOut,Me=P.required,at=P.onClick,lt=P.tabIndex,et=P.type,Qe=P.placeholder,je=P.id,Ye=P.inputMode,rt=P.pattern,mt=P.step,ot=P.maxLength,qe=P.autoFocus,Xe=P.name,Ct=P.onPaste,xt=P.onInput,bt=Object(q.a)(P,["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"]),Et=this.state,At=Et.value,St=Et.focused,Se=m()(j,(x={},Object(z.a)(x,se,!!se),Object(z.a)(x,"".concat(j,"-disabled"),Y),Object(z.a)(x,"".concat(j,"-focused"),St),x)),Ee={};Object.keys(bt).forEach(function(le){(le.substr(0,5)==="data-"||le.substr(0,5)==="aria-"||le==="role")&&(Ee[le]=bt[le])});var He=!Q&&!Y,Ge=this.getInputDisplayValue(null),Re=(At||At===0)&&(isNaN(At)||Number(At)>=he),Ue=(At||At===0)&&(isNaN(At)||Number(At)<=_e),ge=Re||Y||Q,de=Ue||Y||Q,ce=m()("".concat(j,"-handler"),"".concat(j,"-handler-up"),Object(z.a)({},"".concat(j,"-handler-up-disabled"),ge)),te=m()("".concat(j,"-handler"),"".concat(j,"-handler-down"),Object(z.a)({},"".concat(j,"-handler-down-disabled"),de)),ie=X?{onTouchStart:ge?u:this.up,onTouchEnd:this.stop}:{onMouseDown:ge?u:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ae=X?{onTouchStart:de?u:this.down,onTouchEnd:this.stop}:{onMouseDown:de?u:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return A.a.createElement("div",{className:Se,style:xe,title:Ce,onMouseEnter:Oe,onMouseLeave:De,onMouseOver:pe,onMouseOut:ue,onFocus:function(){return null},onBlur:function(){return null}},A.a.createElement("div",{className:"".concat(j,"-handler-wrap")},A.a.createElement("span",Object.assign({unselectable:"on"},ie,{role:"button","aria-label":"Increase Value","aria-disabled":ge,className:ce}),$||A.a.createElement("span",{unselectable:"on",className:"".concat(j,"-handler-up-inner"),onClick:a})),A.a.createElement("span",Object.assign({unselectable:"on"},ae,{role:"button","aria-label":"Decrease Value","aria-disabled":de,className:te}),re||A.a.createElement("span",{unselectable:"on",className:"".concat(j,"-handler-down-inner"),onClick:a}))),A.a.createElement("div",{className:"".concat(j,"-input-wrap")},A.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":_e,"aria-valuemax":he,"aria-valuenow":At,required:Me,type:et,placeholder:Qe,onPaste:Ct,onClick:at,onMouseUp:this.onMouseUp,className:"".concat(j,"-input"),tabIndex:lt,autoComplete:F,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:He?this.onKeyDown:u,onKeyUp:He?this.onKeyUp:u,autoFocus:qe,maxLength:ot,readOnly:Q,disabled:Y,max:he,min:_e,step:mt,name:Xe,title:Ce,id:je,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Ge),pattern:rt,inputMode:Ye,onInput:xt},Ee))))}}]),C}(A.a.Component);b.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:v,min:-v,step:1,style:{},onChange:u,onKeyDown:u,onPressEnter:u,onFocus:u,onBlur:u,parser:i,required:!1,autoComplete:"off"};var h=b,d=we.a=h},fcSX:function(Ke,we,U){"use strict";var q=U("Ff2n"),z=U("1OyB"),L=U("vuIU"),K=U("Ji7U"),I=U("md7G"),w=U("foSv"),B=U("1W/9"),N=U("q1tI"),A=U("rePB"),k=U("JX7q"),m=U("TSYQ"),O=U.n(m),R=U("qx4F"),_=U("4IlW");function E(Y){return Array.isArray(Y)?Y:[Y]}var g={transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend"},u=Object.keys(g).filter(function(Y){if(typeof document=="undefined")return!1;var Q=document.getElementsByTagName("html")[0];return Y in(Q?Q.style:{})})[0],a=g[u];function i(Y,Q,X,F){Y.addEventListener?Y.addEventListener(Q,X,F):Y.attachEvent&&Y.attachEvent("on".concat(Q),X)}function c(Y,Q,X,F){Y.removeEventListener?Y.removeEventListener(Q,X,F):Y.attachEvent&&Y.detachEvent("on".concat(Q),X)}function S(Y,Q){var X=typeof Y=="function"?Y(Q):Y;return Array.isArray(X)?X.length===2?X:[X[0],X[1]]:[X]}var v=function(Q){return!isNaN(parseFloat(Q))&&isFinite(Q)},p=!(typeof window!="undefined"&&window.document&&window.document.createElement),D=function Y(Q,X,F,$){if(!X||X===document||X instanceof Document)return!1;if(X===Q.parentNode)return!0;var re=Math.max(Math.abs(F),Math.abs($))===Math.abs($),se=Math.max(Math.abs(F),Math.abs($))===Math.abs(F),he=X.scrollHeight-X.clientHeight,_e=X.scrollWidth-X.clientWidth,xe=document.defaultView.getComputedStyle(X),Ce=xe.overflowY==="auto"||xe.overflowY==="scroll",Oe=xe.overflowX==="auto"||xe.overflowX==="scroll",De=he&&Ce,pe=_e&&Oe;return re&&(!De||De&&(X.scrollTop>=he&&$<0||X.scrollTop<=0&&$>0))||se&&(!pe||pe&&(X.scrollLeft>=_e&&F<0||X.scrollLeft<=0&&F>0))?Y(Q,X.parentNode,F,$):!1};function b(Y){var Q=h();return function(){var F=Object(w.a)(Y),$;if(Q){var re=Object(w.a)(this).constructor;$=Reflect.construct(F,arguments,re)}else $=F.apply(this,arguments);return Object(I.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(Y){return!1}}var d={},o=function(Y){Object(K.a)(X,Y);var Q=b(X);function X(F){var $;return Object(z.a)(this,X),$=Q.call(this,F),$.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 se=re.currentTarget,he=re.changedTouches[0].clientX-$.startPos.x,_e=re.changedTouches[0].clientY-$.startPos.y;(se===$.maskDom||se===$.handlerDom||se===$.contentDom&&D(se,re.target,he,_e))&&re.cancelable&&re.preventDefault()},$.transitionEnd=function(re){var se=re.target;c(se,a,$.transitionEnd),se.style.transition=""},$.onKeyDown=function(re){if(re.keyCode===_.a.ESC){var se=$.props.onClose;re.stopPropagation(),se&&se(re)}},$.onWrapperTransitionEnd=function(re){var se=$.props,he=se.open,_e=se.afterVisibleChange;re.target===$.contentWrapper&&re.propertyName.match(/transform$/)&&($.dom.style.transition="",!he&&$.getCurrentDrawerSome()&&(document.body.style.overflowX="",$.maskDom&&($.maskDom.style.left="",$.maskDom.style.width="")),_e&&_e(!!he))},$.openLevelTransition=function(){var re=$.props,se=re.open,he=re.width,_e=re.height,xe=$.getHorizontalBoolAndPlacementName(),Ce=xe.isHorizontal,Oe=xe.placementName,De=$.contentDom?$.contentDom.getBoundingClientRect()[Ce?"width":"height"]:0,pe=(Ce?he:_e)||De;$.setLevelAndScrolling(se,Oe,pe)},$.setLevelTransform=function(re,se,he,_e){var xe=$.props,Ce=xe.placement,Oe=xe.levelMove,De=xe.duration,pe=xe.ease,ue=xe.showMask;$.levelDom.forEach(function(Me){Me.style.transition="transform ".concat(De," ").concat(pe),i(Me,a,$.transitionEnd);var at=re?he:0;if(Oe){var lt=S(Oe,{target:Me,open:re});at=re?lt[0]:lt[1]||0}var et=typeof at=="number"?"".concat(at,"px"):at,Qe=Ce==="left"||Ce==="top"?et:"-".concat(et);Qe=ue&&Ce==="right"&&_e?"calc(".concat(Qe," + ").concat(_e,"px)"):Qe,Me.style.transform=at?"".concat(se,"(").concat(Qe,")"):""})},$.setLevelAndScrolling=function(re,se,he){var _e=$.props.onChange;if(!p){var xe=document.body.scrollHeight>(window.innerHeight||document.documentElement.clientHeight)&&window.innerWidth>document.body.offsetWidth?Object(R.a)(!0):0;$.setLevelTransform(re,se,he,xe),$.toggleScrollingToDrawerAndBody(xe)}_e&&_e(re)},$.toggleScrollingToDrawerAndBody=function(re){var se=$.props,he=se.getOpenCount,_e=se.getContainer,xe=se.showMask,Ce=se.open,Oe=_e&&_e(),De=he&&he();if(Oe&&Oe.parentNode===document.body&&xe){var pe=["touchstart"],ue=[document.body,$.maskDom,$.handlerDom,$.contentDom];Ce&&document.body.style.overflow!=="hidden"?(re&&$.addScrollingEffect(re),De===1&&(document.body.style.overflow="hidden"),document.body.style.touchAction="none",ue.forEach(function(Me,at){if(!Me)return;i(Me,pe[at]||"touchmove",at?$.removeMoveHandler:$.removeStartHandler,$.passive)})):$.getCurrentDrawerSome()&&(De||(document.body.style.overflow=""),document.body.style.touchAction="",re&&$.remScrollingEffect(re),ue.forEach(function(Me,at){if(!Me)return;c(Me,pe[at]||"touchmove",at?$.removeMoveHandler:$.removeStartHandler,$.passive)}))}},$.addScrollingEffect=function(re){var se=$.props,he=se.placement,_e=se.duration,xe=se.ease,Ce=se.getOpenCount,Oe=se.switchScrollingEffect,De=Ce&&Ce();De===1&&Oe();var pe="width ".concat(_e," ").concat(xe),ue="transform ".concat(_e," ").concat(xe);$.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(ue,",").concat(pe),$.dom.style.width="",$.dom.style.transform="")})},$.remScrollingEffect=function(re){var se=$.props,he=se.placement,_e=se.duration,xe=se.ease,Ce=se.getOpenCount,Oe=se.switchScrollingEffect,De=Ce&&Ce();De||Oe(!0),u&&(document.body.style.overflowX="hidden"),$.dom.style.transition="none";var pe,ue="width ".concat(_e," ").concat(xe),Me="transform ".concat(_e," ").concat(xe);switch(he){case"left":{$.dom.style.width="100%",ue="width 0s ".concat(xe," ").concat(_e);break}case"right":{$.dom.style.transform="translateX(".concat(re,"px)"),$.dom.style.width="100%",ue="width 0s ".concat(xe," ").concat(_e),$.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)",pe="height 0s ".concat(xe," ").concat(_e);break}default:break}clearTimeout($.timeout),$.timeout=setTimeout(function(){$.dom&&($.dom.style.transition="".concat(Me,",").concat(pe?"".concat(pe,","):"").concat(ue),$.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 se=re.level,he=re.getContainer;if(p)return;var _e=he&&he(),xe=_e?_e.parentNode:null;if($.levelDom=[],se==="all"){var Ce=xe?Array.prototype.slice.call(xe.children):[];Ce.forEach(function(Oe){Oe.nodeName!=="SCRIPT"&&Oe.nodeName!=="STYLE"&&Oe.nodeName!=="LINK"&&Oe!==_e&&$.levelDom.push(Oe)})}else se&&E(se).forEach(function(Oe){document.querySelectorAll(Oe).forEach(function(De){$.levelDom.push(De)})})},$.getHorizontalBoolAndPlacementName=function(){var re=$.props.placement,se=re==="left"||re==="right",he="translate".concat(se?"X":"Y");return{isHorizontal:se,placementName:he}},$.state={_self:Object(k.a)($)},$}return Object(L.a)(X,[{key:"componentDidMount",value:function(){var $=this;if(!p){var re=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){return re=!0,null}}))}catch(Ce){}this.passive=re?{passive:!1}:!1}var se=this.props,he=se.open,_e=se.getContainer,xe=_e&&_e();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&&(xe&&xe.parentNode===document.body&&(d[this.drawerId]=he),this.openLevelTransition(),this.forceUpdate(function(){$.domFocus()}))}},{key:"componentDidUpdate",value:function($){var re=this.props,se=re.open,he=re.getContainer,_e=he&&he();se!==$.open&&(se&&this.domFocus(),_e&&_e.parentNode===document.body&&(d[this.drawerId]=!!se),this.openLevelTransition())}},{key:"componentWillUnmount",value:function(){var $=this.props,re=$.getOpenCount,se=$.open,he=$.switchScrollingEffect,_e=typeof re=="function"&&re();delete d[this.drawerId],se&&(this.setLevelTransform(!1),document.body.style.touchAction=""),_e||(document.body.style.overflow="",he(!0))}},{key:"render",value:function(){var $,re=this,se=this.props,he=se.className,_e=se.children,xe=se.style,Ce=se.width,Oe=se.height,De=se.defaultOpen,pe=se.open,ue=se.prefixCls,Me=se.placement,at=se.level,lt=se.levelMove,et=se.ease,Qe=se.duration,je=se.getContainer,Ye=se.handler,rt=se.onChange,mt=se.afterVisibleChange,ot=se.showMask,qe=se.maskClosable,Xe=se.maskStyle,Ct=se.onClose,xt=se.onHandleClick,bt=se.keyboard,Et=se.getOpenCount,At=se.switchScrollingEffect,St=Object(q.a)(se,["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?pe:!1,Ee=O()(ue,($={},Object(A.a)($,"".concat(ue,"-").concat(Me),!0),Object(A.a)($,"".concat(ue,"-open"),Se),Object(A.a)($,he||"",!!he),Object(A.a)($,"no-mask",!ot),$)),He=this.getHorizontalBoolAndPlacementName(),Ge=He.placementName,Re=Me==="left"||Me==="top"?"-100%":"100%",Ue=Se?"":"".concat(Ge,"(").concat(Re,")"),ge=Ye&&N.cloneElement(Ye,{onClick:function(ce){Ye.props.onClick&&Ye.props.onClick(),xt&&xt(ce)},ref:function(ce){re.handlerDom=ce}});return N.createElement("div",Object.assign({},St,{tabIndex:-1,className:Ee,style:xe,ref:function(ce){re.dom=ce},onKeyDown:Se&&bt?this.onKeyDown:void 0,onTransitionEnd:this.onWrapperTransitionEnd}),ot&&N.createElement("div",{className:"".concat(ue,"-mask"),onClick:qe?Ct:void 0,style:Xe,ref:function(ce){re.maskDom=ce}}),N.createElement("div",{className:"".concat(ue,"-content-wrapper"),style:{transform:Ue,msTransform:Ue,width:v(Ce)?"".concat(Ce,"px"):Ce,height:v(Oe)?"".concat(Oe,"px"):Oe},ref:function(ce){re.contentWrapper=ce}},N.createElement("div",{className:"".concat(ue,"-content"),ref:function(ce){re.contentDom=ce},onTouchStart:Se&&ot?this.removeStartHandler:void 0,onTouchMove:Se&&ot?this.removeMoveHandler:void 0},_e),ge))}}],[{key:"getDerivedStateFromProps",value:function($,re){var se=re.prevProps,he=re._self,_e={prevProps:$};if(se!==void 0){var xe=$.placement,Ce=$.level;xe!==se.placement&&(he.contentDom=null),Ce!==se.level&&he.getLevelDom($)}return _e}}]),X}(N.Component);o.defaultProps={switchScrollingEffect:function(){}};var s=o;function C(Y){var Q=y();return function(){var F=Object(w.a)(Y),$;if(Q){var re=Object(w.a)(this).constructor;$=Reflect.construct(F,arguments,re)}else $=F.apply(this,arguments);return Object(I.a)(this,$)}}function y(){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(Y){return!1}}var x=function(Y){Object(K.a)(X,Y);var Q=C(X);function X(F){var $;Object(z.a)(this,X),$=Q.call(this,F),$.onHandleClick=function(se){var he=$.props,_e=he.onHandleClick,xe=he.open;if(_e&&_e(se),typeof xe=="undefined"){var Ce=$.state.open;$.setState({open:!Ce})}},$.onClose=function(se){var he=$.props,_e=he.onClose,xe=he.open;_e&&_e(se),typeof xe=="undefined"&&$.setState({open:!1})};var re=typeof F.open!="undefined"?F.open:!!F.defaultOpen;return $.state={open:re},"onMaskClick"in F&&console.warn("`onMaskClick` are removed, please use `onClose` instead."),$}return Object(L.a)(X,[{key:"render",value:function(){var $=this,re=this.props,se=re.defaultOpen,he=re.getContainer,_e=re.wrapperClassName,xe=re.forceRender,Ce=re.handler,Oe=Object(q.a)(re,["defaultOpen","getContainer","wrapperClassName","forceRender","handler"]),De=this.state.open;if(!he)return N.createElement("div",{className:_e,ref:function(Me){$.dom=Me}},N.createElement(s,Object.assign({},Oe,{open:De,handler:Ce,getContainer:function(){return $.dom},onClose:this.onClose,onHandleClick:this.onHandleClick})));var pe=!!Ce||xe;return N.createElement(B.a,{visible:De,forceRender:pe,getContainer:he,wrapperClassName:_e},function(ue){var Me=ue.visible,at=ue.afterClose,lt=Object(q.a)(ue,["visible","afterClose"]);return N.createElement(s,Object.assign({},Oe,lt,{open:Me!==void 0?Me:De,afterVisibleChange:at!==void 0?at:Oe.afterVisibleChange,handler:Ce,onClose:$.onClose,onHandleClick:$.onHandleClick}))})}}],[{key:"getDerivedStateFromProps",value:function($,re){var se=re.prevProps,he={prevProps:$};return typeof se!="undefined"&&$.open!==se.open&&(he.open=$.open),he}}]),X}(N.Component);x.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:N.createElement("div",{className:"drawer-handle"},N.createElement("i",{className:"drawer-handle-icon"})),showMask:!0,maskClosable:!0,maskStyle:{},wrapperClassName:"",className:"",keyboard:!0,forceRender:!1};var P=x,j=we.a=P},fcyK:function(Ke,we,U){},fyJ8:function(Ke,we,U){"use strict";var q=U("rePB"),z=U("VTBJ"),L=U("Ff2n"),K=U("U8pU"),I=U("q1tI"),w=U.n(I),B=U("TSYQ"),N=U.n(B),A=U("c+Xe"),k=U("sR1s");function m(g){return g&&Object(K.a)(g)==="object"&&!Array.isArray(g)&&!I.isValidElement(g)}function O(g){return typeof g=="string"?!0:Object(A.c)(g)}function R(g,u){var a,i=g.prefixCls,c=g.className,S=g.record,v=g.index,p=g.dataIndex,D=g.render,b=g.children,h=g.component,d=h===void 0?"td":h,o=g.colSpan,s=g.rowSpan,C=g.fixLeft,y=g.fixRight,x=g.firstFixLeft,P=g.lastFixLeft,j=g.firstFixRight,Y=g.lastFixRight,Q=g.appendNode,X=g.additionalProps,F=X===void 0?{}:X,$=g.ellipsis,re=g.align,se=g.rowType,he=g.isSticky,_e="".concat(i,"-cell"),xe,Ce;if(b)Ce=b;else{var Oe=Object(k.b)(S,p);if(Ce=Oe,D){var De=D(Oe,S,v);m(De)?(Ce=De.children,xe=De.props):Ce=De}}Object(K.a)(Ce)==="object"&&!Array.isArray(Ce)&&!I.isValidElement(Ce)&&(Ce=null),$&&(P||j)&&(Ce=I.createElement("span",{className:"".concat(_e,"-content")},Ce));var pe=xe||{},ue=pe.colSpan,Me=pe.rowSpan,at=pe.style,lt=pe.className,et=Object(L.a)(pe,["colSpan","rowSpan","style","className"]),Qe=ue!==void 0?ue:o,je=Me!==void 0?Me:s;if(Qe===0||je===0)return null;var Ye={},rt=typeof C=="number",mt=typeof y=="number";rt&&(Ye.position="sticky",Ye.left=C),mt&&(Ye.position="sticky",Ye.right=y);var ot={};re&&(ot.textAlign=re);var qe,Xe=$===!0?{showTitle:!0}:$;Xe&&(Xe.showTitle||se==="header")&&(typeof Ce=="string"||typeof Ce=="number"?qe=Ce.toString():I.isValidElement(Ce)&&typeof Ce.props.children=="string"&&(qe=Ce.props.children));var Ct=Object(z.a)(Object(z.a)(Object(z.a)({title:qe},et),F),{},{colSpan:Qe&&Qe!==1?Qe:null,rowSpan:je&&je!==1?je:null,className:N()(_e,c,(a={},Object(q.a)(a,"".concat(_e,"-fix-left"),rt),Object(q.a)(a,"".concat(_e,"-fix-left-first"),x),Object(q.a)(a,"".concat(_e,"-fix-left-last"),P),Object(q.a)(a,"".concat(_e,"-fix-right"),mt),Object(q.a)(a,"".concat(_e,"-fix-right-first"),j),Object(q.a)(a,"".concat(_e,"-fix-right-last"),Y),Object(q.a)(a,"".concat(_e,"-ellipsis"),$),Object(q.a)(a,"".concat(_e,"-with-append"),Q),Object(q.a)(a,"".concat(_e,"-fix-sticky"),(rt||mt)&&he),a),F.className,lt),style:Object(z.a)(Object(z.a)(Object(z.a)(Object(z.a)({},F.style),ot),Ye),at),ref:O(d)?u:null});return I.createElement(d,Object.assign({},Ct),Q,Ce)}var _=I.forwardRef(R);_.displayName="Cell";var E=I.memo(_,function(g,u){return u.shouldCellUpdate?!u.shouldCellUpdate(u.record,g.record):!1});we.a=E},gRFJ:function(Ke,we,U){Ke.exports=[U("rdUC"),U("ynwM"),U("RELg"),U("DlR+"),U("CrYA"),U("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(Ke){return Ke<10?"0"+Ke:Ke}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(Ke){return rx_escapable.lastIndex=0,rx_escapable.test(Ke)?'"'+Ke.replace(rx_escapable,function(we){var U=meta[we];return typeof U=="string"?U:"\\u"+("0000"+we.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+Ke+'"'}function str(Ke,we){var U,q,z,L,K=gap,I,w=we[Ke];w&&typeof w=="object"&&typeof w.toJSON=="function"&&(w=w.toJSON(Ke)),typeof rep=="function"&&(w=rep.call(we,Ke,w));switch(typeof w){case"string":return quote(w);case"number":return isFinite(w)?String(w):"null";case"boolean":case"null":return String(w);case"object":if(!w)return"null";if(gap+=indent,I=[],Object.prototype.toString.apply(w)==="[object Array]"){for(L=w.length,U=0;U<L;U+=1)I[U]=str(U,w)||"null";return z=I.length===0?"[]":gap?`[
|
|
`+gap+I.join(`,
|
|
`+gap)+`
|
|
`+K+"]":"["+I.join(",")+"]",gap=K,z}if(rep&&typeof rep=="object")for(L=rep.length,U=0;U<L;U+=1)typeof rep[U]=="string"&&(q=rep[U],z=str(q,w),z&&I.push(quote(q)+(gap?": ":":")+z));else for(q in w)Object.prototype.hasOwnProperty.call(w,q)&&(z=str(q,w),z&&I.push(quote(q)+(gap?": ":":")+z));return z=I.length===0?"{}":gap?`{
|
|
`+gap+I.join(`,
|
|
`+gap)+`
|
|
`+K+"}":"{"+I.join(",")+"}",gap=K,z}}typeof JSON.stringify!="function"&&(meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},JSON.stringify=function(Ke,we,U){var q;if(gap="",indent="",typeof U=="number")for(q=0;q<U;q+=1)indent+=" ";else typeof U=="string"&&(indent=U);if(rep=we,we&&typeof we!="function"&&(typeof we!="object"||typeof we.length!="number"))throw new Error("JSON.stringify");return str("",{"":Ke})}),typeof JSON.parse!="function"&&(JSON.parse=function(text,reviver){var j;function walk(Ke,we){var U,q,z=Ke[we];if(z&&typeof z=="object")for(U in z)Object.prototype.hasOwnProperty.call(z,U)&&(q=walk(z,U),q!==void 0?z[U]=q:delete z[U]);return reviver.call(Ke,we,z)}if(text=String(text),rx_dangerous.lastIndex=0,rx_dangerous.test(text)&&(text=text.replace(rx_dangerous,function(Ke){return"\\u"+("0000"+Ke.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(Ke,we,U){"use strict";U.d(we,"a",function(){return K}),U.d(we,"c",function(){return I}),U.d(we,"b",function(){return w});var q=U("VTBJ"),z=U("Ff2n"),L=U("Kwbf"),K="RC_TABLE_INTERNAL_COL_DEFINE";function I(B){var N=B.expandable,A=Object(z.a)(B,["expandable"]);return"expandable"in B?Object(q.a)(Object(q.a)({},A),N):A}function w(B){return Object.keys(B).reduce(function(N,A){return(A.substr(0,5)==="data-"||A.substr(0,5)==="aria-")&&(N[A]=B[A]),N},{})}},i3hx:function(Ke,we,U){},je13:function(Ke,we,U){var q=U("5nXd"),z=U("gRFJ"),L=[U("uQRt")];Ke.exports=q.createStore(z,L)},kSUc:function(Ke,we,U){},"kaH+":function(Ke,we,U){"use strict";var q=U("+L6B"),z=U("2/Rp"),L=U("tJVT"),K=U("q1tI"),I=U.n(K),w=U("UZu5"),B=U.n(w),N=U("dhSg"),A=U("rLCj"),k=U("dF/Y"),m=U("4i/N");we.a=function(){var O=Object(K.useState)(""),R=Object(L.a)(O,2),_=R[0],E=R[1],g=Object(K.useState)(0),u=Object(L.a)(g,2),a=u[0],i=u[1],c=Object(K.useRef)("");Object(K.useEffect)(function(){var D=N.a.subscribe("preview-image",function(b){E(b),document.body.style.overflow="hidden"});return D},[]),Object(K.useEffect)(function(){return document.addEventListener("keydown",S),function(){document.removeEventListener("keydown",S)}},[]),Object(K.useEffect)(function(){c.current=_},[_]);function S(D){D.keyCode==27&&c.current&&v()}function v(){document.body.style.overflow="auto",E("")}function p(){i(a+90)}return I.a.createElement(K.Fragment,null,_?I.a.createElement("div",{className:"image-preview-container"},I.a.createElement("div",{className:"button-group"},I.a.createElement(z.a,{onClick:p},"\u65CB\u8F6C",I.a.createElement(A.a,null)),I.a.createElement(z.a,{href:_},"\u4E0B\u8F7D",I.a.createElement(k.a,null)),I.a.createElement(z.a,{onClick:v},"\u5173\u95ED",I.a.createElement(m.a,null))),I.a.createElement("div",{className:"preview-wrp-group"},I.a.createElement("img",{className:"image-preview",src:_,alt:"\u9884\u89C8\u5927\u56FE",style:{transform:"rotate(".concat(a,"deg)")}}))):null)}},lOMy:function(Ke,we,U){},lZu9:function(Ke,we,U){(function(q){q(U("VrN/"),U("1eCo"),U("8EBN"))})(function(q){"use strict";q.defineMode("markdown",function(z,L){var K=q.getMode(z,"text/html"),I=K.name=="null";function w(X){if(q.findModeByName){var F=q.findModeByName(X);F&&(X=F.mime||F.mimes[0])}var $=q.getMode(z,X);return $.name=="null"?null:$}L.highlightFormatting===void 0&&(L.highlightFormatting=!1),L.maxBlockquoteDepth===void 0&&(L.maxBlockquoteDepth=0),L.taskLists===void 0&&(L.taskLists=!1),L.strikethrough===void 0&&(L.strikethrough=!1),L.emoji===void 0&&(L.emoji=!1),L.fencedCodeBlockHighlighting===void 0&&(L.fencedCodeBlockHighlighting=!0),L.fencedCodeBlockDefaultMode===void 0&&(L.fencedCodeBlockDefaultMode="text/plain"),L.xml===void 0&&(L.xml=!0),L.tokenTypeOverrides===void 0&&(L.tokenTypeOverrides={});var B={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 N in B)B.hasOwnProperty(N)&&L.tokenTypeOverrides[N]&&(B[N]=L.tokenTypeOverrides[N]);var A=/^([*\-_])(?:\s*\1){2,}\s*$/,k=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,m=/^\[(x| )\](?=\s)/i,O=L.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,R=/^ {0,3}(?:\={1,}|-{2,})\s*$/,_=/^[^#!\[\]*_\\<>` "'(~:]+/,E=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,g=/^\s*\[[^\]]+?\]:.*$/,u=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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 i(X,F,$){return F.f=F.inline=$,$(X,F)}function c(X,F,$){return F.f=F.block=$,$(X,F)}function S(X){return!X||!/\S/.test(X.string)}function v(X){if(X.linkTitle=!1,X.linkHref=!1,X.linkText=!1,X.em=!1,X.strong=!1,X.strikethrough=!1,X.quote=0,X.indentedCode=!1,X.f==D){var F=I;if(!F){var $=q.innerMode(K,X.htmlState);F=$.mode.name=="xml"&&$.state.tagStart===null&&!$.state.context&&$.state.tokenize.isInText}F&&(X.f=o,X.block=p,X.htmlState=null)}return X.trailingSpace=0,X.trailingSpaceNewLine=!1,X.prevLine=X.thisLine,X.thisLine={stream:null},null}function p(X,F){var $=X.column()===F.indentation,re=S(F.prevLine.stream),se=F.indentedCode,he=F.prevLine.hr,_e=F.list!==!1,xe=(F.listStack[F.listStack.length-1]||0)+3;F.indentedCode=!1;var Ce=F.indentation;if(F.indentationDiff===null&&(F.indentationDiff=F.indentation,_e)){for(F.list=null;Ce<F.listStack[F.listStack.length-1];)F.listStack.pop(),F.listStack.length?F.indentation=F.listStack[F.listStack.length-1]:F.list=!1;F.list!==!1&&(F.indentationDiff=Ce-F.listStack[F.listStack.length-1])}var Oe=!re&&!he&&!F.prevLine.header&&(!_e||!se)&&!F.prevLine.fencedCodeEnd,De=(F.list===!1||he||re)&&F.indentation<=xe&&X.match(A),pe=null;if(F.indentationDiff>=4&&(se||F.prevLine.fencedCodeEnd||F.prevLine.header||re))return X.skipToEnd(),F.indentedCode=!0,B.code;if(X.eatSpace())return null;if($&&F.indentation<=xe&&(pe=X.match(O))&&pe[1].length<=6)return F.quote=0,F.header=pe[1].length,F.thisLine.header=!0,L.highlightFormatting&&(F.formatting="header"),F.f=F.inline,h(F);if(F.indentation<=xe&&X.eat(">"))return F.quote=$?1:F.quote+1,L.highlightFormatting&&(F.formatting="quote"),X.eatSpace(),h(F);if(!De&&!F.setext&&$&&F.indentation<=xe&&(pe=X.match(k))){var ue=pe[1]?"ol":"ul";return F.indentation=Ce+X.current().length,F.list=!0,F.quote=0,F.listStack.push(F.indentation),F.em=!1,F.strong=!1,F.code=!1,F.strikethrough=!1,L.taskLists&&X.match(m,!1)&&(F.taskList=!0),F.f=F.inline,L.highlightFormatting&&(F.formatting=["list","list-"+ue]),h(F)}else{if($&&F.indentation<=xe&&(pe=X.match(E,!0)))return F.quote=0,F.fencedEndRE=new RegExp(pe[1]+"+ *$"),F.localMode=L.fencedCodeBlockHighlighting&&w(pe[2]||L.fencedCodeBlockDefaultMode),F.localMode&&(F.localState=q.startState(F.localMode)),F.f=F.block=b,L.highlightFormatting&&(F.formatting="code-block"),F.code=-1,h(F);if(F.setext||(!Oe||!_e)&&!F.quote&&F.list===!1&&!F.code&&!De&&!g.test(X.string)&&(pe=X.lookAhead(1))&&(pe=pe.match(R)))return F.setext?(F.header=F.setext,F.setext=0,X.skipToEnd(),L.highlightFormatting&&(F.formatting="header")):(F.header=pe[0].charAt(0)=="="?1:2,F.setext=F.header),F.thisLine.header=!0,F.f=F.inline,h(F);if(De)return X.skipToEnd(),F.hr=!0,F.thisLine.hr=!0,B.hr;if(X.peek()==="[")return i(X,F,P)}return i(X,F,F.inline)}function D(X,F){var $=K.token(X,F.htmlState);if(!I){var re=q.innerMode(K,F.htmlState);(re.mode.name=="xml"&&re.state.tagStart===null&&!re.state.context&&re.state.tokenize.isInText||F.md_inside&&X.current().indexOf(">")>-1)&&(F.f=o,F.block=p,F.htmlState=null)}return $}function b(X,F){var $=F.listStack[F.listStack.length-1]||0,re=F.indentation<$,se=$+3;if(F.fencedEndRE&&F.indentation<=se&&(re||X.match(F.fencedEndRE))){L.highlightFormatting&&(F.formatting="code-block");var he;return re||(he=h(F)),F.localMode=F.localState=null,F.block=p,F.f=o,F.fencedEndRE=null,F.code=0,F.thisLine.fencedCodeEnd=!0,re?c(X,F,F.block):he}else return F.localMode?F.localMode.token(X,F.localState):(X.skipToEnd(),B.code)}function h(X){var F=[];if(X.formatting){F.push(B.formatting),typeof X.formatting=="string"&&(X.formatting=[X.formatting]);for(var $=0;$<X.formatting.length;$++)F.push(B.formatting+"-"+X.formatting[$]),X.formatting[$]==="header"&&F.push(B.formatting+"-"+X.formatting[$]+"-"+X.header),X.formatting[$]==="quote"&&(!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=X.quote?F.push(B.formatting+"-"+X.formatting[$]+"-"+X.quote):F.push("error"))}if(X.taskOpen)return F.push("meta"),F.length?F.join(" "):null;if(X.taskClosed)return F.push("property"),F.length?F.join(" "):null;if(X.linkHref?F.push(B.linkHref,"url"):(X.strong&&F.push(B.strong),X.em&&F.push(B.em),X.strikethrough&&F.push(B.strikethrough),X.emoji&&F.push(B.emoji),X.linkText&&F.push(B.linkText),X.code&&F.push(B.code),X.image&&F.push(B.image),X.imageAltText&&F.push(B.imageAltText,"link"),X.imageMarker&&F.push(B.imageMarker)),X.header&&F.push(B.header,B.header+"-"+X.header),X.quote&&(F.push(B.quote),!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=X.quote?F.push(B.quote+"-"+X.quote):F.push(B.quote+"-"+L.maxBlockquoteDepth)),X.list!==!1){var re=(X.listStack.length-1)%3;re?re===1?F.push(B.list2):F.push(B.list3):F.push(B.list1)}return X.trailingSpaceNewLine?F.push("trailing-space-new-line"):X.trailingSpace&&F.push("trailing-space-"+(X.trailingSpace%2?"a":"b")),F.length?F.join(" "):null}function d(X,F){return X.match(_,!0)?h(F):void 0}function o(X,F){var $=F.text(X,F);if(typeof $!="undefined")return $;if(F.list)return F.list=null,h(F);if(F.taskList){var re=X.match(m,!0)[1]===" ";return re?F.taskOpen=!0:F.taskClosed=!0,L.highlightFormatting&&(F.formatting="task"),F.taskList=!1,h(F)}if(F.taskOpen=!1,F.taskClosed=!1,F.header&&X.match(/^#+$/,!0))return L.highlightFormatting&&(F.formatting="header"),h(F);var se=X.next();if(F.linkTitle){F.linkTitle=!1;var he=se;se==="("&&(he=")"),he=(he+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var _e="^\\s*(?:[^"+he+"\\\\]+|\\\\\\\\|\\\\.)"+he;if(X.match(new RegExp(_e),!0))return B.linkHref}if(se==="`"){var xe=F.formatting;L.highlightFormatting&&(F.formatting="code"),X.eatWhile("`");var Ce=X.current().length;if(F.code==0&&(!F.quote||Ce==1))return F.code=Ce,h(F);if(Ce==F.code){var Oe=h(F);return F.code=0,Oe}else return F.formatting=xe,h(F)}else if(F.code)return h(F);if(se==="\\"&&(X.next(),L.highlightFormatting)){var De=h(F),pe=B.formatting+"-escape";return De?De+" "+pe:pe}if(se==="!"&&X.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return F.imageMarker=!0,F.image=!0,L.highlightFormatting&&(F.formatting="image"),h(F);if(se==="["&&F.imageMarker&&X.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return F.imageMarker=!1,F.imageAltText=!0,L.highlightFormatting&&(F.formatting="image"),h(F);if(se==="]"&&F.imageAltText){L.highlightFormatting&&(F.formatting="image");var De=h(F);return F.imageAltText=!1,F.image=!1,F.inline=F.f=C,De}if(se==="["&&!F.image)return F.linkText&&X.match(/^.*?\]/)||(F.linkText=!0,L.highlightFormatting&&(F.formatting="link")),h(F);if(se==="]"&&F.linkText){L.highlightFormatting&&(F.formatting="link");var De=h(F);return F.linkText=!1,F.inline=F.f=X.match(/\(.*?\)| ?\[.*?\]/,!1)?C:o,De}if(se==="<"&&X.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){F.f=F.inline=s,L.highlightFormatting&&(F.formatting="link");var De=h(F);return De?De+=" ":De="",De+B.linkInline}if(se==="<"&&X.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){F.f=F.inline=s,L.highlightFormatting&&(F.formatting="link");var De=h(F);return De?De+=" ":De="",De+B.linkEmail}if(L.xml&&se==="<"&&X.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var ue=X.string.indexOf(">",X.pos);if(ue!=-1){var Me=X.string.substring(X.start,ue);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Me)&&(F.md_inside=!0)}return X.backUp(1),F.htmlState=q.startState(K),c(X,F,D)}if(L.xml&&se==="<"&&X.match(/^\/\w*?>/))return F.md_inside=!1,"tag";if(se==="*"||se==="_"){for(var at=1,lt=X.pos==1?" ":X.string.charAt(X.pos-2);at<3&&X.eat(se);)at++;var et=X.peek()||" ",Qe=!/\s/.test(et)&&(!u.test(et)||/\s/.test(lt)||u.test(lt)),je=!/\s/.test(lt)&&(!u.test(lt)||/\s/.test(et)||u.test(et)),Ye=null,rt=null;if(at%2&&(!F.em&&Qe&&(se==="*"||!je||u.test(lt))?Ye=!0:F.em==se&&je&&(se==="*"||!Qe||u.test(et))&&(Ye=!1)),at>1&&(!F.strong&&Qe&&(se==="*"||!je||u.test(lt))?rt=!0:F.strong==se&&je&&(se==="*"||!Qe||u.test(et))&&(rt=!1)),rt!=null||Ye!=null){L.highlightFormatting&&(F.formatting=Ye==null?"strong":rt==null?"em":"strong em"),Ye===!0&&(F.em=se),rt===!0&&(F.strong=se);var Oe=h(F);return Ye===!1&&(F.em=!1),rt===!1&&(F.strong=!1),Oe}}else if(se===" "&&(X.eat("*")||X.eat("_"))){if(X.peek()===" ")return h(F);X.backUp(1)}if(L.strikethrough){if(se==="~"&&X.eatWhile(se)){if(F.strikethrough){L.highlightFormatting&&(F.formatting="strikethrough");var Oe=h(F);return F.strikethrough=!1,Oe}else if(X.match(/^[^\s]/,!1))return F.strikethrough=!0,L.highlightFormatting&&(F.formatting="strikethrough"),h(F)}else if(se===" "&&X.match(/^~~/,!0)){if(X.peek()===" ")return h(F);X.backUp(2)}}if(L.emoji&&se===":"&&X.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){F.emoji=!0,L.highlightFormatting&&(F.formatting="emoji");var mt=h(F);return F.emoji=!1,mt}return se===" "&&(X.match(/^ +$/,!1)?F.trailingSpace++:F.trailingSpace&&(F.trailingSpaceNewLine=!0)),h(F)}function s(X,F){var $=X.next();if($===">"){F.f=F.inline=o,L.highlightFormatting&&(F.formatting="link");var re=h(F);return re?re+=" ":re="",re+B.linkInline}return X.match(/^[^>]+/,!0),B.linkInline}function C(X,F){if(X.eatSpace())return null;var $=X.next();return $==="("||$==="["?(F.f=F.inline=x($==="("?")":"]"),L.highlightFormatting&&(F.formatting="link-string"),F.linkHref=!0,h(F)):"error"}var y={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function x(X){return function(F,$){var re=F.next();if(re===X){$.f=$.inline=o,L.highlightFormatting&&($.formatting="link-string");var se=h($);return $.linkHref=!1,se}return F.match(y[X]),$.linkHref=!0,h($)}}function P(X,F){return X.match(/^([^\]\\]|\\.)*\]:/,!1)?(F.f=j,X.next(),L.highlightFormatting&&(F.formatting="link"),F.linkText=!0,h(F)):i(X,F,o)}function j(X,F){if(X.match(/^\]:/,!0)){F.f=F.inline=Y,L.highlightFormatting&&(F.formatting="link");var $=h(F);return F.linkText=!1,$}return X.match(/^([^\]\\]|\\.)+/,!0),B.linkText}function Y(X,F){return X.eatSpace()?null:(X.match(/^[^\s]+/,!0),X.peek()===void 0?F.linkTitle=!0:X.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),F.f=F.inline=o,B.linkHref+" url")}var Q={startState:function(){return{f:p,prevLine:{stream:null},thisLine:{stream:null},block:p,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(X){return{f:X.f,prevLine:X.prevLine,thisLine:X.thisLine,block:X.block,htmlState:X.htmlState&&q.copyState(K,X.htmlState),indentation:X.indentation,localMode:X.localMode,localState:X.localMode?q.copyState(X.localMode,X.localState):null,inline:X.inline,text:X.text,formatting:!1,linkText:X.linkText,linkTitle:X.linkTitle,linkHref:X.linkHref,code:X.code,em:X.em,strong:X.strong,strikethrough:X.strikethrough,emoji:X.emoji,header:X.header,setext:X.setext,hr:X.hr,taskList:X.taskList,list:X.list,listStack:X.listStack.slice(0),quote:X.quote,indentedCode:X.indentedCode,trailingSpace:X.trailingSpace,trailingSpaceNewLine:X.trailingSpaceNewLine,md_inside:X.md_inside,fencedEndRE:X.fencedEndRE}},token:function(X,F){if(F.formatting=!1,X!=F.thisLine.stream){if(F.header=0,F.hr=!1,X.match(/^\s*$/,!0))return v(F),null;if(F.prevLine=F.thisLine,F.thisLine={stream:X},F.taskList=!1,F.trailingSpace=0,F.trailingSpaceNewLine=!1,!F.localState&&(F.f=F.block,F.f!=D)){var $=X.match(/^\s*/,!0)[0].replace(/\t/g,a).length;if(F.indentation=$,F.indentationDiff=null,$>0)return null}}return F.f(X,F)},innerMode:function(X){return X.block==D?{state:X.htmlState,mode:K}:X.localState?{state:X.localState,mode:X.localMode}:{state:X,mode:Q}},indent:function(X,F,$){return X.block==D&&K.indent?K.indent(X.htmlState,F,$):X.localState&&X.localMode.indent?X.localMode.indent(X.localState,F,$):q.Pass},blankLine:v,getType:h,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return Q},"xml"),q.defineMIME("text/markdown","markdown"),q.defineMIME("text/x-markdown","markdown")})},n6Qo:function(Ke,we,U){"use strict";U.d(we,"a",function(){return N});var q=U("q1tI"),z=U("biw7"),L=U("fyJ8");function K(A){var k=A.className,m=A.index,O=A.children,R=A.colSpan,_=A.rowSpan,E=q.useContext(z.a),g=E.prefixCls,u=E.fixedInfoList,a=u[m];return q.createElement(L.a,Object.assign({className:k,index:m,component:"td",prefixCls:g,record:null,dataIndex:null,render:function(){return{children:O,props:{colSpan:R,rowSpan:_}}}},a))}function I(A){return q.createElement("tr",Object.assign({},A))}function w(A){var k=A.children,m=q.useContext(z.a),O=m.prefixCls;return q.createElement("tfoot",{className:"".concat(O,"-summary")},k)}var B=we.b=w,N={Cell:K,Row:I}},nWbc:function(Ke,we,U){},osHv:function(Ke,we,U){(function(q){q(U("VrN/"))})(function(q){"use strict";var z=q.Pos;function L(u,a){return u.line-a.line||u.ch-a.ch}var K="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",I=K+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",w=new RegExp("<(/?)(["+K+"]["+I+"]*)","g");function B(u,a,i,c){this.line=a,this.ch=i,this.cm=u,this.text=u.getLine(a),this.min=c?Math.max(c.from,u.firstLine()):u.firstLine(),this.max=c?Math.min(c.to-1,u.lastLine()):u.lastLine()}function N(u,a){var i=u.cm.getTokenTypeAt(z(u.line,a));return i&&/\btag\b/.test(i)}function A(u){return u.line>=u.max?void 0:(u.ch=0,u.text=u.cm.getLine(++u.line),!0)}function k(u){return u.line<=u.min?void 0:(u.text=u.cm.getLine(--u.line),u.ch=u.text.length,!0)}function m(u){for(;;){var a=u.text.indexOf(">",u.ch);if(a==-1){if(A(u))continue;return}if(!N(u,a+1)){u.ch=a+1;continue}var i=u.text.lastIndexOf("/",a),c=i>-1&&!/\S/.test(u.text.slice(i+1,a));return u.ch=a+1,c?"selfClose":"regular"}}function O(u){for(;;){var a=u.ch?u.text.lastIndexOf("<",u.ch-1):-1;if(a==-1){if(k(u))continue;return}if(!N(u,a+1)){u.ch=a;continue}w.lastIndex=a,u.ch=a;var i=w.exec(u.text);if(i&&i.index==a)return i}}function R(u){for(;;){w.lastIndex=u.ch;var a=w.exec(u.text);if(!a){if(A(u))continue;return}if(!N(u,a.index+1)){u.ch=a.index+1;continue}return u.ch=a.index+a[0].length,a}}function _(u){for(;;){var a=u.ch?u.text.lastIndexOf(">",u.ch-1):-1;if(a==-1){if(k(u))continue;return}if(!N(u,a+1)){u.ch=a;continue}var i=u.text.lastIndexOf("/",a),c=i>-1&&!/\S/.test(u.text.slice(i+1,a));return u.ch=a+1,c?"selfClose":"regular"}}function E(u,a){for(var i=[];;){var c=R(u),S,v=u.line,p=u.ch-(c?c[0].length:0);if(!c||!(S=m(u)))return;if(S=="selfClose")continue;if(c[1]){for(var D=i.length-1;D>=0;--D)if(i[D]==c[2]){i.length=D;break}if(D<0&&(!a||a==c[2]))return{tag:c[2],from:z(v,p),to:z(u.line,u.ch)}}else i.push(c[2])}}function g(u,a){for(var i=[];;){var c=_(u);if(!c)return;if(c=="selfClose"){O(u);continue}var S=u.line,v=u.ch,p=O(u);if(!p)return;if(p[1])i.push(p[2]);else{for(var D=i.length-1;D>=0;--D)if(i[D]==p[2]){i.length=D;break}if(D<0&&(!a||a==p[2]))return{tag:p[2],from:z(u.line,u.ch),to:z(S,v)}}}}q.registerHelper("fold","xml",function(u,a){for(var i=new B(u,a.line,0);;){var c=R(i);if(!c||i.line!=a.line)return;var S=m(i);if(!S)return;if(!c[1]&&S!="selfClose"){var v=z(i.line,i.ch),p=E(i,c[2]);return p&&L(p.from,v)>0?{from:v,to:p.from}:null}}}),q.findMatchingTag=function(u,a,i){var c=new B(u,a.line,a.ch,i);if(c.text.indexOf(">")==-1&&c.text.indexOf("<")==-1)return;var S=m(c),v=S&&z(c.line,c.ch),p=S&&O(c);if(!S||!p||L(c,a)>0)return;var D={from:z(c.line,c.ch),to:v,tag:p[2]};return S=="selfClose"?{open:D,close:null,at:"open"}:p[1]?{open:g(c,p[2]),close:D,at:"close"}:(c=new B(u,v.line,v.ch,i),{open:D,close:E(c,p[2]),at:"open"})},q.findEnclosingTag=function(u,a,i,c){for(var S=new B(u,a.line,a.ch,i);;){var v=g(S,c);if(!v)break;var p=new B(u,a.line,a.ch,i),D=E(p,v.tag);if(D)return{open:v,close:D}}},q.scanForClosingTag=function(u,a,i,c){var S=new B(u,a.line,a.ch,c?{from:0,to:c}:null);return E(S,i)}})},"p/48":function(Ke,we,U){},p5ED:function(Ke,we,U){"use strict";var q=U("+L6B"),z=U("2/Rp"),L=U("5Dmo"),K=U("3S7+"),I=U("k1fw"),w=U("9og8"),B=U("tJVT"),N=U("WmNS"),A=U.n(N),k=U("q1tI"),m=U.n(k),O=U("vHTk"),R=U.n(O),_=U("yEEn"),E=U("ZW9T"),g=U("1vsH"),u=U("V0Rq"),a=U("m3rI"),i=function(S){var v=S.name,p=S.data,D=S.theme,b=S.type,h=S.filename,d=S.monacoEditor,o=S.className,s=S.style,C=S.close,y=S.onClose,x=S.hasMask,P=S.otherData,j=P===void 0?{}:P,Y=Object(k.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),Q=Object(B.a)(Y,2),X=Q[0],F=Q[1],$=Object(k.useState)(""),re=Object(B.a)($,2),se=re[0],he=re[1],_e=Object(k.useState)(),xe=Object(B.a)(_e,2),Ce=xe[0],Oe=xe[1],De=window.ENV==="build"?"/react/build/office.html":"/office.html",pe,ue=1024*1024,Me=10*ue,at=Object(k.useRef)();b==="office"&&(pe=Object(g.R)(p).filesize,pe>Me&&(b="other")),h&&(d.filename=h),Object(k.useEffect)(function(){var je,Ye,rt=(je=document.cookie)===null||je===void 0||((Ye=je.replace(/\s/g,""))===null||Ye===void 0)?void 0:Ye.split(";");rt==null||rt.map(function(mt){var ot=mt.split("=");ot[0]==="_educoder_session"&&he(ot[1])})},[]),Object(k.useEffect)(function(){b==="office"&<()},[b]);var lt=function(){var je=Object(w.a)(A.a.mark(function Ye(){var rt,mt,ot;return A.a.wrap(function(Xe){for(;;)switch(Xe.prev=Xe.next){case 0:return console.log("data:",p),rt=p,p.startsWith("http")||(rt=location.origin+rt),mt=new URL(rt).pathname.split("/").pop(),Xe.next=6,Object(u.U)({attachment_id:mt});case 6:ot=Xe.sent,Oe(ot);case 8:case"end":return Xe.stop()}},Ye)}));return function(){return je.apply(this,arguments)}}(),et=function(){if(p.startsWith("http")||p.startsWith("/api")||p.startsWith("blob:")){Qe();return}Object(g.x)(h||"educoder",p,h||"educoder")},Qe=function(){Object(g.v)(h||"educoder",decodeURIComponent(p))};return m.a.createElement("div",{style:Object(I.a)({},s||{}),className:"".concat(x&&R.a.bgBlack," ").concat(b?R.a.wrp:"hide")},C&&m.a.createElement("div",{className:R.a.close,ref:at},m.a.createElement(K.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return at.current}},m.a.createElement("span",{onClick:Qe},m.a.createElement("i",{className:"icon-quxiaozhiding"}))),m.a.createElement(K.a,{title:"\u5173\u95ED",getPopupContainer:function(){return at.current}},m.a.createElement("span",{className:"",onClick:function(){y(),Oe(null)}},m.a.createElement("i",{className:"icon-guanbi1"})))),m.a.createElement("div",{className:"".concat(R.a[o]," ").concat(o," ").concat(R.a.monaco," ").concat(b==="txt"?"show":"hide")},b==="txt"&&m.a.createElement(E.b,d)),b==="audio"&&m.a.createElement("audio",{src:"".concat((p==null?void 0:p.indexOf("http://"))>-1||(p==null?void 0:p.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(p),autoPlay:!0}),b==="video"&&m.a.createElement(m.a.Fragment,null,(p==null?void 0:p.indexOf("/api"))>-1?m.a.createElement("video",{controls:!0,src:"".concat(p),autoPlay:!0}):m.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(p),autoPlay:!0})),b==="office"&&Ce&&m.a.createElement("iframe",{src:"".concat(De,"?key=").concat(Ce.key,"&url=").concat(a.a.API_SERVER+Ce.url,"&callbackUrl=").concat(a.a.API_SERVER+Ce.callbackUrl,"&fileType=").concat(Ce.fileType,"&title=").concat(Ce.title,"&model=view")}),(b==="xlsx"||b==="doc"||b==="pptx"||b==="docx")&&m.a.createElement("iframe",{src:"".concat(De,"?key=").concat(j.key,"&url=").concat(a.a.API_SERVER+j.url,"&callbackUrl=").concat(a.a.API_SERVER+j.callbackUrl,"&fileType=").concat(j.fileType,"&title=").concat(j.title,"&model=").concat(j.model)}),b==="html"&&m.a.createElement("iframe",{src:p+"&disposition=inline"}),b==="pdf"&&m.a.createElement("embed",{className:R.a.embed,src:p,type:"application/pdf"}),b==="image"&&m.a.createElement("img",{src:"".concat((p==null?void 0:p.indexOf("http://"))>-1||(p==null?void 0:p.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(p)}),b==="other"&&m.a.createElement("div",null,m.a.createElement(z.a,{type:"primary",size:"large",onClick:et},m.a.createElement(_.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),b==="download"&&m.a.createElement(z.a,{type:"primary",size:"large",onClick:et},m.a.createElement(_.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))};we.a=i},"p77/":function(Ke,we,U){},pPuO:function(Ke,we,U){Ke.exports={desc:"desc___2o_2w",info:"info___Uro3x","commit-info":"commit-info___o2-Ex"}},"qJ4+":function(Ke,we,U){},"rAM+":function(Ke,we,U){"use strict";U.d(we,"a",function(){return z});var q=U("Qw5x");function z(L,K){var I;if(typeof Symbol=="undefined"||L[Symbol.iterator]==null){if(Array.isArray(L)||(I=Object(q.a)(L))||K&&L&&typeof L.length=="number"){I&&(L=I);var w=0,B=function(){};return{s:B,n:function(){return w>=L.length?{done:!0}:{done:!1,value:L[w++]}},e:function(O){throw O},f:B}}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 N=!0,A=!1,k;return{s:function(){I=L[Symbol.iterator]()},n:function(){var O=I.next();return N=O.done,O},e:function(O){A=!0,k=O},f:function(){try{!N&&I.return!=null&&I.return()}finally{if(A)throw k}}}}},rUJ1:function(Ke,we){const U=/[&<>"']/,q=/[&<>"']/g,z=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,K={"&":"&","<":"<",">":">",'"':""","'":"'"},I=b=>K[b];function w(b,h){if(h){if(U.test(b))return b.replace(q,I)}else if(z.test(b))return b.replace(L,I);return b}const B=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function N(b){return b.replace(B,(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 A=/(^|[^\[])\^/g;function k(b,h){b=b.source||b,h=h||"";const d={replace:(o,s)=>(s=s.source||s,s=s.replace(A,"$1"),b=b.replace(o,s),d),getRegex:()=>new RegExp(b,h)};return d}const m=/[^\w:]/g,O=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function R(b,h,d){if(b){let o;try{o=decodeURIComponent(N(d)).replace(m,"").toLowerCase()}catch(s){return null}if(o.indexOf("javascript:")===0||o.indexOf("vbscript:")===0||o.indexOf("data:")===0)return null}h&&!O.test(d)&&(d=a(h,d));try{d=encodeURI(d).replace(/%25/g,"%")}catch(o){return null}return d}const _={},E=/^[^:]+:\/*[^/]*$/,g=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(b,h){_[" "+b]||(E.test(b)?_[" "+b]=b+"/":_[" "+b]=v(b,"/",!0)),b=_[" "+b];const d=b.indexOf(":")===-1;return h.substring(0,2)==="//"?d?h:b.replace(g,"$1")+h:h.charAt(0)==="/"?d?h:b.replace(u,"$1")+h:b+h}const i={exec:function(){}};function c(b){let h=1,d,o;for(;h<arguments.length;h++){d=arguments[h];for(o in d)Object.prototype.hasOwnProperty.call(d,o)&&(b[o]=d[o])}return b}function S(b,h){const d=b.replace(/\|/g,(C,y,x)=>{let P=!1,j=y;for(;--j>=0&&x[j]==="\\";)P=!P;return P?"|":" |"}),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 v(b,h,d){const o=b.length;if(o===0)return"";let s=0;for(;s<o;){const C=b.charAt(o-s-1);if(C===h&&!d)s++;else if(C!==h&&d)s++;else break}return b.substr(0,o-s)}function p(b,h){if(b.indexOf(h[1])===-1)return-1;const d=b.length;let o=0,s=0;for(;s<d;s++)if(b[s]==="\\")s++;else if(b[s]===h[0])o++;else if(b[s]===h[1]&&(o--,o<0))return s;return-1}function D(b){b&&b.sanitize&&!b.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")}Ke.exports={escape:w,unescape:N,edit:k,cleanUrl:R,resolveUrl:a,noopTest:i,merge:c,splitCells:S,rtrim:v,findClosingBracket:p,checkSanitizeDeprecation:D}},rdUC:function(Ke,we,U){var q=U("MFOe"),z=q.Global;Ke.exports={name:"localStorage",read:K,write:I,each:w,remove:B,clearAll:N};function L(){return z.localStorage}function K(A){return L().getItem(A)}function I(A,k){return L().setItem(A,k)}function w(A){for(var k=L().length-1;k>=0;k--){var m=L().key(k);A(K(m),m)}}function B(A){return L().removeItem(A)}function N(){return L().clear()}},sR1s:function(Ke,we,U){"use strict";U.d(we,"b",function(){return K}),U.d(we,"a",function(){return I}),U.d(we,"c",function(){return w}),U.d(we,"d",function(){return B});var q=U("U8pU"),z="RC_TABLE_KEY";function L(N){return N==null?[]:Array.isArray(N)?N:[N]}function K(N,A){if(!A&&typeof A!="number")return N;for(var k=L(A),m=N,O=0;O<k.length;O+=1){if(!m)return null;var R=k[O];m=m[R]}return m}function I(N){var A=[],k={};return N.forEach(function(m){for(var O=m||{},R=O.key,_=O.dataIndex,E=R||L(_).join("-")||z;k[E];)E="".concat(E,"_next");k[E]=!0,A.push(E)}),A}function w(){var N={};function A(R,_){_&&Object.keys(_).forEach(function(E){var g=_[E];g&&Object(q.a)(g)==="object"?(R[E]=R[E]||{},A(R[E],g)):R[E]=g})}for(var k=arguments.length,m=new Array(k),O=0;O<k;O++)m[O]=arguments[O];return m.forEach(function(R){A(N,R)}),N}function B(N){return N!=null}},sboe:function(Ke,we,U){"use strict";U.d(we,"a",function(){return L});var q=U("q1tI"),z=U.n(q),L=q.createContext(null)},t23M:function(Ke,we,U){"use strict";var q=U("VTBJ"),z=U("1OyB"),L=U("vuIU"),K=U("Ji7U"),I=U("LK+K"),w=U("q1tI"),B=U.n(w),N=U("m+aA"),A=U("Zm9Q"),k=U("Kwbf"),m=U("c+Xe"),O=U("bdgK"),R="rc-observer-key",_=function(E){Object(K.a)(u,E);var g=Object(I.a)(u);function u(){var a;return Object(z.a)(this,u),a=g.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(i){var c=a.props.onResize,S=i[0].target,v=S.getBoundingClientRect(),p=v.width,D=v.height,b=S.offsetWidth,h=S.offsetHeight,d=Math.floor(p),o=Math.floor(D);if(a.state.width!==d||a.state.height!==o||a.state.offsetWidth!==b||a.state.offsetHeight!==h){var s={width:d,height:o,offsetWidth:b,offsetHeight:h};a.setState(s),c&&Promise.resolve().then(function(){c(Object(q.a)(Object(q.a)({},s),{},{offsetWidth:b,offsetHeight:h}))})}},a.setChildNode=function(i){a.childNode=i},a}return Object(L.a)(u,[{key:"componentDidMount",value:function(){this.onComponentUpdated()}},{key:"componentDidUpdate",value:function(){this.onComponentUpdated()}},{key:"componentWillUnmount",value:function(){this.destroyObserver()}},{key:"onComponentUpdated",value:function(){var i=this.props.disabled;if(i){this.destroyObserver();return}var c=Object(N.a)(this.childNode||this),S=c!==this.currentElement;S&&(this.destroyObserver(),this.currentElement=c),!this.resizeObserver&&c&&(this.resizeObserver=new O.default(this.onResize),this.resizeObserver.observe(c))}},{key:"destroyObserver",value:function(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}},{key:"render",value:function(){var i=this.props.children,c=Object(A.a)(i);if(c.length>1)Object(k.a)(!1,"Find more than one child node with `children` in ResizeObserver. Will only observe first one.");else if(c.length===0)return Object(k.a)(!1,"`children` of ResizeObserver is empty. Nothing is in observe."),null;var S=c[0];if(w.isValidElement(S)&&Object(m.c)(S)){var v=S.ref;c[0]=w.cloneElement(S,{ref:Object(m.a)(v,this.setChildNode)})}return c.length===1?c[0]:c.map(function(p,D){return!w.isValidElement(p)||"key"in p&&p.key!==null?p:w.cloneElement(p,{key:"".concat(R,"-").concat(D)})})}}]),u}(w.Component);_.displayName="ResizeObserver",we.a=_},uD2n:function(Ke,we,U){Ke.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(Ke,we,U){Ke.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(Ke,we,U){Ke.exports=q;function q(){return U("gaXo"),{}}},ulZh:function(Ke,we,U){typeof window!="undefined"&&function(z,L){Ke.exports=L()}(this,function(){return function(q){var z={};function L(K){if(z[K])return z[K].exports;var I=z[K]={i:K,l:!1,exports:{}};return q[K].call(I.exports,I,I.exports,L),I.l=!0,I.exports}return L.m=q,L.c=z,L.d=function(K,I,w){L.o(K,I)||Object.defineProperty(K,I,{enumerable:!0,get:w})},L.r=function(K){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(K,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(K,"__esModule",{value:!0})},L.t=function(K,I){if(I&1&&(K=L(K)),I&8)return K;if(I&4&&typeof K=="object"&&K&&K.__esModule)return K;var w=Object.create(null);if(L.r(w),Object.defineProperty(w,"default",{enumerable:!0,value:K}),I&2&&typeof K!="string")for(var B in K)L.d(w,B,function(N){return K[N]}.bind(null,B));return w},L.n=function(K){var I=K&&K.__esModule?function(){return K.default}:function(){return K};return L.d(I,"a",I),I},L.o=function(K,I){return Object.prototype.hasOwnProperty.call(K,I)},L.p="/dist/",L(L.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(q,z,L){"use strict";var K=Object.prototype.hasOwnProperty,I="~";function w(){}Object.create&&(w.prototype=Object.create(null),new w().__proto__||(I=!1));function B(m,O,R){this.fn=m,this.context=O,this.once=R||!1}function N(m,O,R,_,E){if(typeof R!="function")throw new TypeError("The listener must be a function");var g=new B(R,_||m,E),u=I?I+O:O;return m._events[u]?m._events[u].fn?m._events[u]=[m._events[u],g]:m._events[u].push(g):(m._events[u]=g,m._eventsCount++),m}function A(m,O){--m._eventsCount===0?m._events=new w:delete m._events[O]}function k(){this._events=new w,this._eventsCount=0}k.prototype.eventNames=function(){var O=[],R,_;if(this._eventsCount===0)return O;for(_ in R=this._events)K.call(R,_)&&O.push(I?_.slice(1):_);return Object.getOwnPropertySymbols?O.concat(Object.getOwnPropertySymbols(R)):O},k.prototype.listeners=function(O){var R=I?I+O:O,_=this._events[R];if(!_)return[];if(_.fn)return[_.fn];for(var E=0,g=_.length,u=new Array(g);E<g;E++)u[E]=_[E].fn;return u},k.prototype.listenerCount=function(O){var R=I?I+O:O,_=this._events[R];return _?_.fn?1:_.length:0},k.prototype.emit=function(O,R,_,E,g,u){var a=I?I+O:O;if(!this._events[a])return!1;var i=this._events[a],c=arguments.length,S,v;if(i.fn){i.once&&this.removeListener(O,i.fn,void 0,!0);switch(c){case 1:return i.fn.call(i.context),!0;case 2:return i.fn.call(i.context,R),!0;case 3:return i.fn.call(i.context,R,_),!0;case 4:return i.fn.call(i.context,R,_,E),!0;case 5:return i.fn.call(i.context,R,_,E,g),!0;case 6:return i.fn.call(i.context,R,_,E,g,u),!0}for(v=1,S=new Array(c-1);v<c;v++)S[v-1]=arguments[v];i.fn.apply(i.context,S)}else{var p=i.length,D;for(v=0;v<p;v++){i[v].once&&this.removeListener(O,i[v].fn,void 0,!0);switch(c){case 1:i[v].fn.call(i[v].context);break;case 2:i[v].fn.call(i[v].context,R);break;case 3:i[v].fn.call(i[v].context,R,_);break;case 4:i[v].fn.call(i[v].context,R,_,E);break;default:if(!S)for(D=1,S=new Array(c-1);D<c;D++)S[D-1]=arguments[D];i[v].fn.apply(i[v].context,S)}}}return!0},k.prototype.on=function(O,R,_){return N(this,O,R,_,!1)},k.prototype.once=function(O,R,_){return N(this,O,R,_,!0)},k.prototype.removeListener=function(O,R,_,E){var g=I?I+O:O;if(!this._events[g])return this;if(!R)return A(this,g),this;var u=this._events[g];if(u.fn)u.fn===R&&(!E||u.once)&&(!_||u.context===_)&&A(this,g);else{for(var a=0,i=[],c=u.length;a<c;a++)(u[a].fn!==R||E&&!u[a].once||_&&u[a].context!==_)&&i.push(u[a]);i.length?this._events[g]=i.length===1?i[0]:i:A(this,g)}return this},k.prototype.removeAllListeners=function(O){var R;return O?(R=I?I+O:O,this._events[R]&&A(this,R)):(this._events=new w,this._eventsCount=0),this},k.prototype.off=k.prototype.removeListener,k.prototype.addListener=k.prototype.on,k.prefixed=I,k.EventEmitter=k,q.exports=k},"./node_modules/url-toolkit/src/url-toolkit.js":function(q,z,L){(function(K){var I=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,w=/^([^\/?#]*)([^]*)$/,B=/(?:\/|^)\.(?=\/)/g,N=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,A={buildAbsoluteURL:function(k,m,O){if(O=O||{},k=k.trim(),m=m.trim(),!m){if(!O.alwaysNormalize)return k;var R=A.parseURL(k);if(!R)throw new Error("Error trying to parse base URL.");return R.path=A.normalizePath(R.path),A.buildURLFromParts(R)}var _=A.parseURL(m);if(!_)throw new Error("Error trying to parse relative URL.");if(_.scheme)return O.alwaysNormalize?(_.path=A.normalizePath(_.path),A.buildURLFromParts(_)):m;var E=A.parseURL(k);if(!E)throw new Error("Error trying to parse base URL.");if(!E.netLoc&&E.path&&E.path[0]!=="/"){var g=w.exec(E.path);E.netLoc=g[1],E.path=g[2]}E.netLoc&&!E.path&&(E.path="/");var u={scheme:E.scheme,netLoc:_.netLoc,path:null,params:_.params,query:_.query,fragment:_.fragment};if(!_.netLoc&&(u.netLoc=E.netLoc,_.path[0]!=="/"))if(!_.path)u.path=E.path,_.params||(u.params=E.params,_.query||(u.query=E.query));else{var a=E.path,i=a.substring(0,a.lastIndexOf("/")+1)+_.path;u.path=A.normalizePath(i)}return u.path===null&&(u.path=O.alwaysNormalize?A.normalizePath(_.path):_.path),A.buildURLFromParts(u)},parseURL:function(k){var m=I.exec(k);return m?{scheme:m[1]||"",netLoc:m[2]||"",path:m[3]||"",params:m[4]||"",query:m[5]||"",fragment:m[6]||""}:null},normalizePath:function(k){for(k=k.split("").reverse().join("").replace(B,"");k.length!==(k=k.replace(N,"")).length;);return k.split("").reverse().join("")},buildURLFromParts:function(k){return k.scheme+k.netLoc+k.path+k.params+k.query+k.fragment}};q.exports=A})(this)},"./node_modules/webworkify-webpack/index.js":function(q,z,L){function K(O){var R={};function _(g){if(R[g])return R[g].exports;var u=R[g]={i:g,l:!1,exports:{}};return O[g].call(u.exports,u,u.exports,_),u.l=!0,u.exports}_.m=O,_.c=R,_.i=function(g){return g},_.d=function(g,u,a){_.o(g,u)||Object.defineProperty(g,u,{configurable:!1,enumerable:!0,get:a})},_.r=function(g){Object.defineProperty(g,"__esModule",{value:!0})},_.n=function(g){var u=g&&g.__esModule?function(){return g.default}:function(){return g};return _.d(u,"a",u),u},_.o=function(g,u){return Object.prototype.hasOwnProperty.call(g,u)},_.p="/",_.oe=function(g){throw console.error(g),g};var E=_(_.s=ENTRY_MODULE);return E.default||E}var I="[\\.|\\-|\\+|\\w|/|@]+",w="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+I+").*?\\)";function B(O){return(O+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function N(O){return!isNaN(1*O)}function A(O,R,_){var E={};E[_]=[];var g=R.toString(),u=g.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!u)return E;for(var a=u[1],i=new RegExp("(\\\\n|\\W)"+B(a)+w,"g"),c;c=i.exec(g);){if(c[3]==="dll-reference")continue;E[_].push(c[3])}for(i=new RegExp("\\("+B(a)+'\\("(dll-reference\\s('+I+'))"\\)\\)'+w,"g");c=i.exec(g);)O[c[2]]||(E[_].push(c[1]),O[c[2]]=L(c[1]).m),E[c[2]]=E[c[2]]||[],E[c[2]].push(c[4]);for(var S=Object.keys(E),v=0;v<S.length;v++)for(var p=0;p<E[S[v]].length;p++)N(E[S[v]][p])&&(E[S[v]][p]=1*E[S[v]][p]);return E}function k(O){var R=Object.keys(O);return R.reduce(function(_,E){return _||O[E].length>0},!1)}function m(O,R){for(var _={main:[R]},E={main:[]},g={main:{}};k(_);)for(var u=Object.keys(_),a=0;a<u.length;a++){var i=u[a],c=_[i],S=c.pop();if(g[i]=g[i]||{},g[i][S]||!O[i][S])continue;g[i][S]=!0,E[i]=E[i]||[],E[i].push(S);for(var v=A(O,O[i][S],i),p=Object.keys(v),D=0;D<p.length;D++)_[p[D]]=_[p[D]]||[],_[p[D]]=_[p[D]].concat(v[p[D]])}return E}q.exports=function(O,R){R=R||{};var _={main:L.m},E=R.all?{main:Object.keys(_.main)}:m(_,O),g="";Object.keys(E).filter(function(S){return S!=="main"}).forEach(function(S){for(var v=0;E[S][v];)v++;E[S].push(v),_[S][v]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",g=g+"var "+S+" = ("+K.toString().replace("ENTRY_MODULE",JSON.stringify(v))+")({"+E[S].map(function(p){return""+JSON.stringify(p)+": "+_[S][p].toString()}).join(",")+`});
|
|
`}),g=g+"new (("+K.toString().replace("ENTRY_MODULE",JSON.stringify(O))+")({"+E.main.map(function(S){return""+JSON.stringify(S)+": "+_.main[S].toString()}).join(",")+"}))(self);";var u=new window.Blob([g],{type:"text/javascript"});if(R.bare)return u;var a=window.URL||window.webkitURL||window.mozURL||window.msURL,i=a.createObjectURL(u),c=new window.Worker(i);return c.objectURL=i,c}},"./src/config.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"hlsDefaultConfig",function(){return D}),L.d(z,"mergeConfig",function(){return h}),L.d(z,"enableStreamingMode",function(){return d});var K=L("./src/controller/abr-controller.ts"),I=L("./src/controller/audio-stream-controller.ts"),w=L("./src/controller/audio-track-controller.ts"),B=L("./src/controller/subtitle-stream-controller.ts"),N=L("./src/controller/subtitle-track-controller.ts"),A=L("./src/controller/buffer-controller.ts"),k=L("./src/controller/timeline-controller.ts"),m=L("./src/controller/cap-level-controller.ts"),O=L("./src/controller/fps-controller.ts"),R=L("./src/controller/eme-controller.ts"),_=L("./src/controller/cmcd-controller.ts"),E=L("./src/utils/xhr-loader.ts"),g=L("./src/utils/fetch-loader.ts"),u=L("./src/utils/cues.ts"),a=L("./src/utils/mediakeys-helper.ts"),i=L("./src/utils/logger.ts");function c(){return c=Object.assign||function(o){for(var s=1;s<arguments.length;s++){var C=arguments[s];for(var y in C)Object.prototype.hasOwnProperty.call(C,y)&&(o[y]=C[y])}return o},c.apply(this,arguments)}function S(o,s){var C=Object.keys(o);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(o);s&&(y=y.filter(function(x){return Object.getOwnPropertyDescriptor(o,x).enumerable})),C.push.apply(C,y)}return C}function v(o){for(var s=1;s<arguments.length;s++){var C=arguments[s]!=null?arguments[s]:{};s%2?S(Object(C),!0).forEach(function(y){p(o,y,C[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(C)):S(Object(C)).forEach(function(y){Object.defineProperty(o,y,Object.getOwnPropertyDescriptor(C,y))})}return o}function p(o,s,C){return s in o?Object.defineProperty(o,s,{value:C,enumerable:!0,configurable:!0,writable:!0}):o[s]=C,o}var D=v(v({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:E.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:K.default,bufferController:A.default,capLevelController:m.default,fpsController:O.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},b()),{},{subtitleStreamController:B.SubtitleStreamController,subtitleTrackController:N.default,timelineController:k.TimelineController,audioStreamController:I.default,audioTrackController:w.default,emeController:R.default,cmcdController:_.default});function b(){return{cueHandler:u.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!==g.default&&s!==E.default)i.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),o.progressive=!1;else{var C=Object(g.fetchSupported)();C&&(o.loader=g.default,o.progressive=!0,o.enableSoftwareAES=!0,i.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/polyfills/number.ts"),I=L("./src/utils/ewma-bandwidth-estimator.ts"),w=L("./src/events.ts"),B=L("./src/utils/buffer-helper.ts"),N=L("./src/errors.ts"),A=L("./src/types/loader.ts"),k=L("./src/utils/logger.ts");function m(_,E){for(var g=0;g<E.length;g++){var u=E[g];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(_,u.key,u)}}function O(_,E,g){return E&&m(_.prototype,E),g&&m(_,g),_}var R=function(){function _(g){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=g;var u=g.config;this.bwEstimator=new I.default(u.abrEwmaSlowVoD,u.abrEwmaFastVoD,u.abrEwmaDefaultEstimate),this.registerListeners()}var E=_.prototype;return E.registerListeners=function(){var u=this.hls;u.on(w.Events.FRAG_LOADING,this.onFragLoading,this),u.on(w.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(w.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.on(w.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(w.Events.ERROR,this.onError,this)},E.unregisterListeners=function(){var u=this.hls;u.off(w.Events.FRAG_LOADING,this.onFragLoading,this),u.off(w.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(w.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.off(w.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(w.Events.ERROR,this.onError,this)},E.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},E.onFragLoading=function(u,a){var i=a.frag;if(i.type===A.PlaylistLevelType.MAIN&&!this.timer){var c;this.fragCurrent=i,this.partCurrent=(c=a.part)!=null?c:null,this.timer=self.setInterval(this.onCheck,100)}},E.onLevelLoaded=function(u,a){var i=this.hls.config;a.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)},E._abandonRulesCheck=function(){var u=this.fragCurrent,a=this.partCurrent,i=this.hls,c=i.autoLevelEnabled,S=i.config,v=i.media;if(!u||!v)return;var p=a?a.stats:u.stats,D=a?a.duration:u.duration;if(p.aborted){k.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!c||v.paused||!v.playbackRate||!v.readyState)return;var b=performance.now()-p.loading.start,h=Math.abs(v.playbackRate);if(b<=500*D/h)return;var d=i.levels,o=i.minAutoLevel,s=d[u.level],C=p.total||Math.max(p.loaded,Math.round(D*s.maxBitrate/8)),y=Math.max(1,p.bwEstimate?p.bwEstimate/8:p.loaded*1e3/b),x=(C-p.loaded)/y,P=v.currentTime,j=(B.BufferHelper.bufferInfo(v,P,S.maxBufferHole).end-P)/h;if(j>=2*D/h||x<=j)return;var Y=Number.POSITIVE_INFINITY,Q;for(Q=u.level-1;Q>o;Q--){var X=d[Q].maxBitrate;if(Y=D*X/(8*.8*y),Y<j)break}if(Y>=x)return;var F=this.bwEstimator.getEstimate();k.logger.warn("Fragment "+u.sn+(a?" part "+a.index:"")+" of level "+u.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+Q+`
|
|
Current BW estimate: `+(Object(K.isFiniteNumber)(F)?(F/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+x.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+Y.toFixed(3)+` s
|
|
Time to underbuffer: `+j.toFixed(3)+" s"),i.nextLoadLevel=Q,this.bwEstimator.sample(b,p.loaded),this.clearTimer(),u.loader&&(this.fragCurrent=this.partCurrent=null,u.loader.abort()),i.trigger(w.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:u,part:a,stats:p})},E.onFragLoaded=function(u,a){var i=a.frag,c=a.part;if(i.type===A.PlaylistLevelType.MAIN&&Object(K.isFiniteNumber)(i.sn)){var S=c?c.stats:i.stats,v=c?c.duration:i.duration;if(this.clearTimer(),this.lastLoadedFragLevel=i.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var p=this.hls.levels[i.level],D=(p.loaded?p.loaded.bytes:0)+S.loaded,b=(p.loaded?p.loaded.duration:0)+v;p.loaded={bytes:D,duration:b},p.realBitrate=Math.round(8*D/b)}if(i.bitrateTest){var h={stats:S,frag:i,part:c,id:i.type};this.onFragBuffered(w.Events.FRAG_BUFFERED,h),i.bitrateTest=!1}}},E.onFragBuffered=function(u,a){var i=a.frag,c=a.part,S=c?c.stats:i.stats;if(S.aborted)return;if(i.type!==A.PlaylistLevelType.MAIN||i.sn==="initSegment")return;var v=S.parsing.end-S.loading.start;this.bwEstimator.sample(v,S.loaded),S.bwEstimate=this.bwEstimator.getEstimate(),i.bitrateTest?this.bitrateTestDelay=v/1e3:this.bitrateTestDelay=0},E.onError=function(u,a){switch(a.details){case N.ErrorDetails.FRAG_LOAD_ERROR:case N.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},E.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},E.getNextABRAutoLevel=function(){var u=this.fragCurrent,a=this.partCurrent,i=this.hls,c=i.maxAutoLevel,S=i.config,v=i.minAutoLevel,p=i.media,D=a?a.duration:u?u.duration:0,b=p?p.currentTime:0,h=p&&p.playbackRate!==0?Math.abs(p.playbackRate):1,d=this.bwEstimator?this.bwEstimator.getEstimate():S.abrEwmaDefaultEstimate,o=(B.BufferHelper.bufferInfo(p,b,S.maxBufferHole).end-b)/h,s=this.findBestLevel(d,v,c,o,S.abrBandWidthFactor,S.abrBandWidthUpFactor);if(s>=0)return s;k.logger.trace((o?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var C=D?Math.min(D,S.maxStarvationDelay):S.maxStarvationDelay,y=S.abrBandWidthFactor,x=S.abrBandWidthUpFactor;if(!o){var P=this.bitrateTestDelay;if(P){var j=D?Math.min(D,S.maxLoadingDelay):S.maxLoadingDelay;C=j-P,k.logger.trace("bitrate test took "+Math.round(1e3*P)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*C)+" ms"),y=x=1}}return s=this.findBestLevel(d,v,c,o+C,y,x),Math.max(s,0)},E.findBestLevel=function(u,a,i,c,S,v){for(var p,D=this.fragCurrent,b=this.partCurrent,h=this.lastLoadedFragLevel,d=this.hls.levels,o=d[h],s=!!(o!=null&&(p=o.details)!==null&&p!==void 0&&p.live),C=o==null?void 0:o.codecSet,y=b?b.duration:D?D.duration:0,x=i;x>=a;x--){var P=d[x];if(!P||C&&P.codecSet!==C)continue;var j=P.details,Y=(b?j==null?void 0:j.partTarget:j==null?void 0:j.averagetargetduration)||y,Q=void 0;x<=h?Q=S*u:Q=v*u;var X=d[x].maxBitrate,F=X*Y/Q;if(k.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+x+"/"+Math.round(Q)+"/"+X+"/"+Y+"/"+c+"/"+F),Q>X&&(!F||s&&!this.bitrateTestDelay||F<c))return x}return-1},O(_,[{key:"nextAutoLevel",get:function(){var u=this._nextAutoLevel,a=this.bwEstimator;if(u!==-1&&(!a||!a.canEstimate()))return u;var i=this.getNextABRAutoLevel();return u!==-1&&(i=Math.min(u,i)),i},set:function(u){this._nextAutoLevel=u}}]),_}();z.default=R},"./src/controller/audio-stream-controller.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/polyfills/number.ts"),I=L("./src/controller/base-stream-controller.ts"),w=L("./src/events.ts"),B=L("./src/utils/buffer-helper.ts"),N=L("./src/controller/fragment-tracker.ts"),A=L("./src/types/level.ts"),k=L("./src/types/loader.ts"),m=L("./src/loader/fragment.ts"),O=L("./src/demux/chunk-cache.ts"),R=L("./src/demux/transmuxer-interface.ts"),_=L("./src/types/transmuxer.ts"),E=L("./src/controller/fragment-finders.ts"),g=L("./src/utils/discontinuities.ts"),u=L("./src/errors.ts"),a=L("./src/utils/logger.ts");function i(){return i=Object.assign||function(D){for(var b=1;b<arguments.length;b++){var h=arguments[b];for(var d in h)Object.prototype.hasOwnProperty.call(h,d)&&(D[d]=h[d])}return D},i.apply(this,arguments)}function c(D,b){D.prototype=Object.create(b.prototype),D.prototype.constructor=D,S(D,b)}function S(D,b){return S=Object.setPrototypeOf||function(d,o){return d.__proto__=o,d},S(D,b)}var v=100,p=function(D){c(b,D);function b(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=b.prototype;return h.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},h._registerListeners=function(){var o=this.hls;o.on(w.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(w.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(w.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(w.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.on(w.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),o.on(w.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),o.on(w.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),o.on(w.Events.ERROR,this.onError,this),o.on(w.Events.BUFFER_RESET,this.onBufferReset,this),o.on(w.Events.BUFFER_CREATED,this.onBufferCreated,this),o.on(w.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),o.on(w.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),o.on(w.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h._unregisterListeners=function(){var o=this.hls;o.off(w.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(w.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(w.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(w.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.off(w.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),o.off(w.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),o.off(w.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),o.off(w.Events.ERROR,this.onError,this),o.off(w.Events.BUFFER_RESET,this.onBufferReset,this),o.off(w.Events.BUFFER_CREATED,this.onBufferCreated,this),o.off(w.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),o.off(w.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),o.off(w.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h.onInitPtsFound=function(o,s){var C=s.frag,y=s.id,x=s.initPTS;if(y==="main"){var P=C.cc;this.initPTS[C.cc]=x,this.log("InitPTS for cc: "+P+" found from main: "+x),this.videoTrackCC=P,this.state===I.State.WAITING_INIT_PTS&&this.tick()}},h.startLoad=function(o){if(!this.levels){this.startPosition=o,this.state=I.State.STOPPED;return}var s=this.lastCurrentTime;this.stopLoad(),this.setInterval(v),this.fragLoadError=0,s>0&&o===-1?(this.log("Override startPosition with lastCurrentTime @"+s.toFixed(3)),this.state=I.State.IDLE):(this.loadedmetadata=!1,this.state=I.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=o,this.tick()},h.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_TRACK:{var o,s=this.levels,C=this.trackId,y=s==null||((o=s[C])===null||o===void 0)?void 0:o.details;if(y){if(this.waitForCdnTuneIn(y))break;this.state=I.State.WAITING_INIT_PTS}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var x,P=performance.now(),j=this.retryDate;(!j||P>=j||(x=this.media)!==null&&x!==void 0&&x.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=I.State.IDLE);break}case I.State.WAITING_INIT_PTS:{var Y=this.waitingData;if(Y){var Q=Y.frag,X=Y.part,F=Y.cache,$=Y.complete;if(this.initPTS[Q.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.FRAG_LOADING;var re=F.flush(),se={frag:Q,part:X,payload:re,networkDetails:null};this._handleFragmentLoadProgress(se),$&&D.prototype._handleFragmentLoadComplete.call(this,se)}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(),_e=B.BufferHelper.bufferInfo(this.mediaBuffer,he,this.config.maxBufferHole),xe=Object(E.fragmentWithinToleranceTest)(_e.end,this.config.maxFragLookUpTolerance,Q);xe<0&&(a.logger.log("Waiting fragment cc ("+Q.cc+") @ "+Q.start+" cancelled because another fragment at "+_e.end+" is needed"),this.clearWaitingFragment())}}else this.state=I.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=I.State.IDLE)},h.onTickEnd=function(){var o=this.media;if(!o||!o.readyState)return;var s=this.mediaBuffer?this.mediaBuffer:o,C=s.buffered;!this.loadedmetadata&&C.length&&(this.loadedmetadata=!0),this.lastCurrentTime=o.currentTime},h.doTickIdle=function(){var o,s,C=this.hls,y=this.levels,x=this.media,P=this.trackId,j=C.config;if(!y||!y[P])return;if(!x&&(this.startFragRequested||!j.startFragPrefetch))return;var Y=y[P],Q=Y.details;if(!Q||Q.live&&this.levelLastLoaded!==P||this.waitForCdnTuneIn(Q)){this.state=I.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,m.ElementaryStreamTypes.AUDIO,k.PlaylistLevelType.AUDIO));var X=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,k.PlaylistLevelType.AUDIO);if(X===null)return;var F=X.len,$=this.getMaxBufferLength(),re=this.audioSwitch;if(F>=$&&!re)return;if(!re&&this._streamEnded(X,Q)){C.trigger(w.Events.BUFFER_EOS,{type:"audio"}),this.state=I.State.ENDED;return}var se=Q.fragments,he=se[0].start,_e=X.end;if(re){var xe=this.getLoadPosition();_e=xe,Q.PTSKnown&&xe<he&&((X.end>he||X.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),x.currentTime=he+.05))}var Ce=this.getNextFragment(_e,Q);if(!Ce){this.bufferFlushed=!0;return}((o=Ce.decryptdata)===null||o===void 0?void 0:o.keyFormat)==="identity"&&!((s=Ce.decryptdata)!==null&&s!==void 0&&s.key)?this.loadKey(Ce,Q):this.loadFragment(Ce,Q,_e)},h.getMaxBufferLength=function(){var o=D.prototype.getMaxBufferLength.call(this),s=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,k.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 C=s.audioTracks;this.resetTransmuxer(),this.levels=C.map(function(y){return new A.Level(y)})},h.onAudioTrackSwitching=function(o,s){var C=!!s.url;this.trackId=s.id;var y=this.fragCurrent;y!=null&&y.loader&&y.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),C?this.setInterval(v):this.resetTransmuxer(),C?(this.audioSwitch=!0,this.state=I.State.IDLE):this.state=I.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 C,y=this.levels,x=s.details,P=s.id;if(!y){this.warn("Audio tracks were reset while loading level "+P);return}this.log("Track "+P+" loaded ["+x.startSN+","+x.endSN+"],duration:"+x.totalduration);var j=y[P],Y=0;if(x.live||(C=j.details)!==null&&C!==void 0&&C.live){var Q=this.mainDetails;if(x.fragments[0]||(x.deltaUpdateFailed=!0),x.deltaUpdateFailed||!Q)return;!j.details&&x.hasProgramDateTime&&Q.hasProgramDateTime?(Object(g.alignMediaPlaylistByPDT)(x,Q),Y=x.fragments[0].start):Y=this.alignPlaylists(x,j.details)}j.details=x,this.levelLastLoaded=P,!this.startFragRequested&&(this.mainDetails||!x.live)&&this.setStartPosition(j.details,Y),this.state===I.State.WAITING_TRACK&&!this.waitForCdnTuneIn(x)&&(this.state=I.State.IDLE),this.tick()},h._handleFragmentLoadProgress=function(o){var s,C=o.frag,y=o.part,x=o.payload,P=this.config,j=this.trackId,Y=this.levels;if(!Y){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+C.sn+" of level "+C.level+" will not be buffered");return}var Q=Y[j];console.assert(Q,"Audio track is defined on fragment load progress");var X=Q.details;console.assert(X,"Audio track details are defined on fragment load progress");var F=P.defaultAudioCodec||Q.audioCodec||"mp4a.40.2",$=this.transmuxer;$||($=this.transmuxer=new R.default(this.hls,k.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var re=this.initPTS[C.cc],se=(s=C.initSegment)===null||s===void 0?void 0:s.data;if(re!==void 0){var he=!1,_e=y?y.index:-1,xe=_e!==-1,Ce=new _.ChunkMetadata(C.level,C.sn,C.stats.chunkCount,x.byteLength,_e,xe);$.push(x,se,F,"",C,y,X.totalduration,he,Ce,re)}else{a.logger.log("Unknown video PTS for cc "+C.cc+", waiting for video PTS before demuxing audio frag "+C.sn+" of ["+X.startSN+" ,"+X.endSN+"],track "+j);var Oe=this.waitingData=this.waitingData||{frag:C,part:y,cache:new O.default,complete:!1},De=Oe.cache;De.push(new Uint8Array(x)),this.waitingVideoCC=this.videoTrackCC,this.state=I.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 C=s.tracks.audio;C&&(this.mediaBuffer=C.buffer),s.tracks.video&&(this.videoBuffer=s.tracks.video.buffer)},h.onFragBuffered=function(o,s){var C=s.frag,y=s.part;if(C.type!==k.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(C)){this.warn("Fragment "+C.sn+(y?" p: "+y.index:"")+" of level "+C.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}C.sn!=="initSegment"&&(this.fragPrevious=C,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(w.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(C,y)},h.onError=function(o,s){switch(s.details){case u.ErrorDetails.FRAG_LOAD_ERROR:case u.ErrorDetails.FRAG_LOAD_TIMEOUT:case u.ErrorDetails.KEY_LOAD_ERROR:case u.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(k.PlaylistLevelType.AUDIO,s);break;case u.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case u.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==I.State.ERROR&&this.state!==I.State.STOPPED&&(this.state=s.fatal?I.State.ERROR:I.State.IDLE,this.warn(s.details+" while loading frag, switching to "+this.state+" state"));break;case u.ErrorDetails.BUFFER_FULL_ERROR:if(s.parent==="audio"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var C=!0,y=this.getFwdBufferInfo(this.mediaBuffer,k.PlaylistLevelType.AUDIO);y&&y.len>.5&&(C=!this.reduceMaxBufferLength(y.len)),C&&(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 C=s.type;C===m.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},h._handleTransmuxComplete=function(o){var s,C="audio",y=this.hls,x=o.remuxResult,P=o.chunkMeta,j=this.getCurrentContext(P);if(!j){this.warn("The loading context changed while buffering fragment "+P.sn+" of level "+P.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(P.level);return}var Y=j.frag,Q=j.part,X=x.audio,F=x.text,$=x.id3,re=x.initSegment;if(this.fragContextChanged(Y))return;if(this.state=I.State.PARSING,this.audioSwitch&&X&&this.completeAudioSwitch(),re!=null&&re.tracks&&(this._bufferInitSegment(re.tracks,Y,P),y.trigger(w.Events.FRAG_PARSING_INIT_SEGMENT,{frag:Y,id:C,tracks:re.tracks})),X){var se=X.startPTS,he=X.endPTS,_e=X.startDTS,xe=X.endDTS;Q&&(Q.elementaryStreams[m.ElementaryStreamTypes.AUDIO]={startPTS:se,endPTS:he,startDTS:_e,endDTS:xe}),Y.setElementaryStreamInfo(m.ElementaryStreamTypes.AUDIO,se,he,_e,xe),this.bufferFragmentData(X,Y,Q,P)}if($!=null&&(s=$.samples)!==null&&s!==void 0&&s.length){var Ce=i({frag:Y,id:C},$);y.trigger(w.Events.FRAG_PARSING_METADATA,Ce)}if(F){var Oe=i({frag:Y,id:C},F);y.trigger(w.Events.FRAG_PARSING_USERDATA,Oe)}},h._bufferInitSegment=function(o,s,C){if(this.state!==I.State.PARSING)return;o.video&&delete o.video;var y=o.audio;if(!y)return;y.levelCodec=y.codec,y.id="audio",this.log("Init audio buffer, container:"+y.container+", codecs[parsed]=["+y.codec+"]"),this.hls.trigger(w.Events.BUFFER_CODECS,o);var x=y.initSegment;if(x!=null&&x.byteLength){var P={type:"audio",frag:s,part:null,chunkMeta:C,parent:s.type,data:x};this.hls.trigger(w.Events.BUFFER_APPENDING,P)}this.tick()},h.loadFragment=function(o,s,C){var y=this.fragmentTracker.getState(o);this.fragCurrent=o,(this.audioSwitch||y===N.FragmentState.NOT_LOADED||y===N.FragmentState.PARTIAL)&&(o.sn==="initSegment"?this._loadInitSegment(o):s.live&&!Object(K.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=I.State.WAITING_INIT_PTS):(this.startFragRequested=!0,D.prototype.loadFragment.call(this,o,s,C)))},h.completeAudioSwitch=function(){var o=this.hls,s=this.media,C=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(w.Events.AUDIO_TRACK_SWITCHED,{id:C})},b}(I.default);z.default=p},"./src/controller/audio-track-controller.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/events.ts"),I=L("./src/errors.ts"),w=L("./src/controller/base-playlist-controller.ts"),B=L("./src/types/loader.ts");function N(R,_){for(var E=0;E<_.length;E++){var g=_[E];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(R,g.key,g)}}function A(R,_,E){return _&&N(R.prototype,_),E&&N(R,E),R}function k(R,_){R.prototype=Object.create(_.prototype),R.prototype.constructor=R,m(R,_)}function m(R,_){return m=Object.setPrototypeOf||function(g,u){return g.__proto__=u,g},m(R,_)}var O=function(R){k(_,R);function _(g){var u;return u=R.call(this,g,"[audio-track-controller]")||this,u.tracks=[],u.groupId=null,u.tracksInGroup=[],u.trackId=-1,u.trackName="",u.selectDefaultTrack=!0,u.registerListeners(),u}var E=_.prototype;return E.registerListeners=function(){var u=this.hls;u.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.on(K.Events.LEVEL_LOADING,this.onLevelLoading,this),u.on(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.on(K.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(K.Events.ERROR,this.onError,this)},E.unregisterListeners=function(){var u=this.hls;u.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.off(K.Events.LEVEL_LOADING,this.onLevelLoading,this),u.off(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.off(K.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(K.Events.ERROR,this.onError,this)},E.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,R.prototype.destroy.call(this)},E.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},E.onManifestParsed=function(u,a){this.tracks=a.audioTracks||[]},E.onAudioTrackLoaded=function(u,a){var i=a.id,c=a.details,S=this.tracksInGroup[i];if(!S){this.warn("Invalid audio track id "+i);return}var v=S.details;S.details=a.details,this.log("audioTrack "+i+" loaded ["+c.startSN+"-"+c.endSN+"]"),i===this.trackId&&(this.retryCount=0,this.playlistLoaded(i,a,v))},E.onLevelLoading=function(u,a){this.switchLevel(a.level)},E.onLevelSwitching=function(u,a){this.switchLevel(a.level)},E.switchLevel=function(u){var a=this.hls.levels[u];if(!(a!=null&&a.audioGroupIds))return;var i=a.audioGroupIds[a.urlId];if(this.groupId!==i){this.groupId=i;var c=this.tracks.filter(function(v){return!i||v.groupId===i});this.selectDefaultTrack&&!c.some(function(v){return v.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=c;var S={audioTracks:c};this.log("Updating audio tracks, "+c.length+' track(s) found in "'+i+'" group-id'),this.hls.trigger(K.Events.AUDIO_TRACKS_UPDATED,S),this.selectInitialTrack()}},E.onError=function(u,a){if(R.prototype.onError.call(this,u,a),a.fatal||!a.context)return;a.context.type===B.PlaylistContextType.AUDIO_TRACK&&a.context.id===this.trackId&&a.context.groupId===this.groupId&&this.retryLoadingOrFail(a)},E.setAudioTrack=function(u){var a=this.tracksInGroup;if(u<0||u>=a.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var i=a[this.trackId];this.log("Now switching to audio-track index "+u);var c=a[u],S=c.id,v=c.groupId,p=v===void 0?"":v,D=c.name,b=c.type,h=c.url;if(this.trackId=u,this.trackName=D,this.selectDefaultTrack=!1,this.hls.trigger(K.Events.AUDIO_TRACK_SWITCHING,{id:S,groupId:p,name:D,type:b,url:h}),c.details&&!c.details.live)return;var d=this.switchParams(c.url,i==null?void 0:i.details);this.loadPlaylist(d)},E.selectInitialTrack=function(){var u=this.tracksInGroup;console.assert(u.length,"Initial audio track should be selected when tracks are known");var a=this.trackName,i=this.findTrackId(a)||this.findTrackId();i!==-1?this.setAudioTrack(i):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(K.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},E.findTrackId=function(u){for(var a=this.tracksInGroup,i=0;i<a.length;i++){var c=a[i];if((!this.selectDefaultTrack||c.default)&&(!u||u===c.name))return c.id}return-1},E.loadPlaylist=function(u){var a=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(a)){var i=a.id,c=a.groupId,S=a.url;if(u)try{S=u.addDirectives(S)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("loading audio-track playlist for id: "+i),this.clearTimer(),this.hls.trigger(K.Events.AUDIO_TRACK_LOADING,{url:S,id:i,groupId:c,deliveryDirectives:u||null})}},A(_,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(u){this.selectDefaultTrack=!1,this.setAudioTrack(u)}}]),_}(w.default);z.default=O},"./src/controller/base-playlist-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return A});var K=L("./src/polyfills/number.ts"),I=L("./src/types/level.ts"),w=L("./src/controller/level-helper.ts"),B=L("./src/utils/logger.ts"),N=L("./src/errors.ts"),A=function(){function k(O,R){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=B.logger.log.bind(B.logger,R+":"),this.warn=B.logger.warn.bind(B.logger,R+":"),this.hls=O}var m=k.prototype;return m.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},m.onError=function(R,_){_.fatal&&_.type===N.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},m.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},m.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},m.stopLoad=function(){this.canLoad=!1,this.clearTimer()},m.switchParams=function(R,_){var E=_==null?void 0:_.renditionReports;if(E)for(var g=0;g<E.length;g++){var u=E[g],a=""+u.URI;if(a===R.substr(-a.length)){var i=parseInt(u["LAST-MSN"]),c=parseInt(u["LAST-PART"]);if(_&&this.hls.config.lowLatencyMode){var S=Math.min(_.age-_.partTarget,_.targetduration);c!==void 0&&S>_.partTarget&&(c+=1)}if(Object(K.isFiniteNumber)(i))return new I.HlsUrlParameters(i,Object(K.isFiniteNumber)(c)?c:void 0,I.HlsSkip.No)}}},m.loadPlaylist=function(R){},m.shouldLoadTrack=function(R){return this.canLoad&&R&&!!R.url&&(!R.details||R.details.live)},m.playlistLoaded=function(R,_,E){var g=this,u=_.details,a=_.stats,i=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(u.advancedDateTime=Date.now()-i,u.live||E!=null&&E.live){if(u.reloaded(E),E&&this.log("live playlist "+R+" "+(u.advanced?"REFRESHED "+u.lastPartSn+"-"+u.lastPartIndex:"MISSED")),E&&u.fragments.length>0&&Object(w.mergeDetails)(E,u),!this.canLoad||!u.live)return;var c,S=void 0,v=void 0;if(u.canBlockReload&&u.endSN&&u.advanced){var p=this.hls.config.lowLatencyMode,D=u.lastPartSn,b=u.endSN,h=u.lastPartIndex,d=h!==-1,o=D===b,s=p?0:h;d?(S=o?b+1:D,v=o?s:h+1):S=b+1;var C=u.age,y=C+u.ageHeader,x=Math.min(y-u.partTarget,u.targetduration*1.5);if(x>0){if(E&&x>E.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+E.tuneInGoal+" to: "+x+" with playlist age: "+u.age),x=0;else{var P=Math.floor(x/u.targetduration);if(S+=P,v!==void 0){var j=Math.round(x%u.targetduration/u.partTarget);v+=j}this.log("CDN Tune-in age: "+u.ageHeader+"s last advanced "+C.toFixed(2)+"s goal: "+x+" skip sn "+P+" to part "+v)}u.tuneInGoal=x}if(c=this.getDeliveryDirectives(u,_.deliveryDirectives,S,v),p||!o){this.loadPlaylist(c);return}}else c=this.getDeliveryDirectives(u,_.deliveryDirectives,S,v);var Y=Object(w.computeReloadInterval)(u,a);S!==void 0&&u.canBlockReload&&(Y-=u.partTarget||1),this.log("reload live playlist "+R+" in "+Math.round(Y)+" ms"),this.timer=self.setTimeout(function(){return g.loadPlaylist(c)},Y)}else this.clearTimer()},m.getDeliveryDirectives=function(R,_,E,g){var u=Object(I.getSkipValue)(R,E);return _!=null&&_.skip&&R.deltaUpdateFailed&&(E=_.msn,g=_.part,u=I.HlsSkip.No),new I.HlsUrlParameters(E,g,u)},m.retryLoadingOrFail=function(R){var _=this,E=this.hls.config,g=this.retryCount<E.levelLoadingMaxRetry;if(g){var u;if(this.retryCount++,R.details.indexOf("LoadTimeOut")>-1&&(u=R.context)!==null&&u!==void 0&&u.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+R.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*E.levelLoadingRetryDelay,E.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return _.loadPlaylist()},a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+R.details+'"')}}else this.warn('cannot recover from error "'+R.details+'"'),this.clearTimer(),R.fatal=!0;return g},k}()},"./src/controller/base-stream-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"State",function(){return b}),L.d(z,"default",function(){return h});var K=L("./src/polyfills/number.ts"),I=L("./src/task-loop.ts"),w=L("./src/controller/fragment-tracker.ts"),B=L("./src/utils/buffer-helper.ts"),N=L("./src/utils/logger.ts"),A=L("./src/events.ts"),k=L("./src/errors.ts"),m=L("./src/types/transmuxer.ts"),O=L("./src/utils/mp4-tools.ts"),R=L("./src/utils/discontinuities.ts"),_=L("./src/controller/fragment-finders.ts"),E=L("./src/controller/level-helper.ts"),g=L("./src/loader/fragment-loader.ts"),u=L("./src/crypt/decrypter.ts"),a=L("./src/utils/time-ranges.ts"),i=L("./src/types/loader.ts");function c(d,o){for(var s=0;s<o.length;s++){var C=o[s];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(d,C.key,C)}}function S(d,o,s){return o&&c(d.prototype,o),s&&c(d,s),d}function v(d){if(d===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d}function p(d,o){d.prototype=Object.create(o.prototype),d.prototype.constructor=d,D(d,o)}function D(d,o){return D=Object.setPrototypeOf||function(C,y){return C.__proto__=y,C},D(d,o)}var b={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){p(o,d);function o(C,y,x){var P;return P=d.call(this)||this,P.hls=void 0,P.fragPrevious=null,P.fragCurrent=null,P.fragmentTracker=void 0,P.transmuxer=null,P._state=b.STOPPED,P.media=void 0,P.mediaBuffer=void 0,P.config=void 0,P.bitrateTest=!1,P.lastCurrentTime=0,P.nextLoadPosition=0,P.startPosition=0,P.loadedmetadata=!1,P.fragLoadError=0,P.retryDate=0,P.levels=null,P.fragmentLoader=void 0,P.levelLastLoaded=null,P.startFragRequested=!1,P.decrypter=void 0,P.initPTS=[],P.onvseeking=null,P.onvended=null,P.logPrefix="",P.log=void 0,P.warn=void 0,P.logPrefix=x,P.log=N.logger.log.bind(N.logger,x+":"),P.warn=N.logger.warn.bind(N.logger,x+":"),P.hls=C,P.fragmentLoader=new g.default(C.config),P.fragmentTracker=y,P.config=C.config,P.decrypter=new u.default(C,C.config),C.on(A.Events.KEY_LOADED,P.onKeyLoaded,v(P)),P}var s=o.prototype;return s.doTick=function(){this.onTickEnd()},s.onTickEnd=function(){},s.startLoad=function(y){},s.stopLoad=function(){this.fragmentLoader.abort();var y=this.fragCurrent;y&&this.fragmentTracker.removeFragment(y),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=b.STOPPED},s._streamEnded=function(y,x){var P=this.fragCurrent,j=this.fragmentTracker;if(!x.live&&P&&P.sn===x.endSN&&!y.nextStart){var Y=j.getState(P);return Y===w.FragmentState.PARTIAL||Y===w.FragmentState.OK}return!1},s.onMediaAttached=function(y,x){var P=this.media=this.mediaBuffer=x.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),P.addEventListener("seeking",this.onvseeking),P.addEventListener("ended",this.onvended);var j=this.config;this.levels&&j.autoStartLoad&&this.state===b.STOPPED&&this.startLoad(j.startPosition)},s.onMediaDetaching=function(){var y=this.media;y!=null&&y.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),y&&(y.removeEventListener("seeking",this.onvseeking),y.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 y=this.config,x=this.fragCurrent,P=this.media,j=this.mediaBuffer,Y=this.state,Q=P?P.currentTime:0,X=B.BufferHelper.bufferInfo(j||P,Q,y.maxBufferHole);if(this.log("media seeking to "+(Object(K.isFiniteNumber)(Q)?Q.toFixed(3):Q)+", state: "+Y),Y===b.ENDED)this.resetLoadingState();else if(x&&!X.len){var F=y.maxFragLookUpTolerance,$=x.start-F,re=x.start+x.duration+F,se=Q>re;(Q<$||se)&&(se&&x.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),x.loader.abort()),this.resetLoadingState())}P&&(this.lastCurrentTime=Q),!this.loadedmetadata&&!X.len&&(this.nextLoadPosition=this.startPosition=Q),this.tickImmediate()},s.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},s.onKeyLoaded=function(y,x){if(this.state!==b.KEY_LOADING||x.frag!==this.fragCurrent||!this.levels)return;this.state=b.IDLE;var P=this.levels[x.frag.level].details;P&&this.loadFragment(x.frag,P,x.frag.start)},s.onHandlerDestroying=function(){this.stopLoad(),d.prototype.onHandlerDestroying.call(this)},s.onHandlerDestroyed=function(){this.state=b.STOPPED,this.hls.off(A.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(y,x){this.log("Loading key for "+y.sn+" of ["+x.startSN+"-"+x.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level),this.state=b.KEY_LOADING,this.fragCurrent=y,this.hls.trigger(A.Events.KEY_LOADING,{frag:y})},s.loadFragment=function(y,x,P){this._loadFragForPlayback(y,x,P)},s._loadFragForPlayback=function(y,x,P){var j=this,Y=function(X){if(j.fragContextChanged(y)){j.warn("Fragment "+y.sn+(X.part?" p: "+X.part.index:"")+" of level "+y.level+" was dropped during download."),j.fragmentTracker.removeFragment(y);return}y.stats.chunkCount++,j._handleFragmentLoadProgress(X)};this._doFragLoad(y,x,P,Y).then(function(Q){if(!Q)return;j.fragLoadError=0;var X=j.state;if(j.fragContextChanged(y)){(X===b.FRAG_LOADING||X===b.BACKTRACKING||!j.fragCurrent&&X===b.PARSING)&&(j.fragmentTracker.removeFragment(y),j.state=b.IDLE);return}if("payload"in Q&&(j.log("Loaded fragment "+y.sn+" of level "+y.level),j.hls.trigger(A.Events.FRAG_LOADED,Q),j.state===b.BACKTRACKING)){j.fragmentTracker.backtrack(y,Q),j.resetFragmentLoading(y);return}j._handleFragmentLoadComplete(Q)}).catch(function(Q){j.warn(Q),j.resetFragmentLoading(y)})},s.flushMainBuffer=function(y,x,P){if(P===void 0&&(P=null),!(y-x))return;var j={startOffset:y,endOffset:x,type:P};this.fragLoadError=0,this.hls.trigger(A.Events.BUFFER_FLUSHING,j)},s._loadInitSegment=function(y){var x=this;this._doFragLoad(y).then(function(P){if(!P||x.fragContextChanged(y)||!x.levels)throw new Error("init load aborted");return P}).then(function(P){var j=x.hls,Y=P.payload,Q=y.decryptdata;if(Y&&Y.byteLength>0&&Q&&Q.key&&Q.iv&&Q.method==="AES-128"){var X=self.performance.now();return x.decrypter.webCryptoDecrypt(new Uint8Array(Y),Q.key.buffer,Q.iv.buffer).then(function(F){var $=self.performance.now();return j.trigger(A.Events.FRAG_DECRYPTED,{frag:y,payload:F,stats:{tstart:X,tdecrypt:$}}),P.payload=F,P})}return P}).then(function(P){var j=x.fragCurrent,Y=x.hls,Q=x.levels;if(!Q)throw new Error("init load aborted, missing levels");var X=Q[y.level].details;console.assert(X,"Level details are defined when init segment is loaded");var F=y.stats;x.state=b.IDLE,x.fragLoadError=0,y.data=new Uint8Array(P.payload),F.parsing.start=F.buffering.start=self.performance.now(),F.parsing.end=F.buffering.end=self.performance.now(),P.frag===j&&Y.trigger(A.Events.FRAG_BUFFERED,{stats:F,frag:j,part:null,id:y.type}),x.tick()}).catch(function(P){x.warn(P),x.resetFragmentLoading(y)})},s.fragContextChanged=function(y){var x=this.fragCurrent;return!y||!x||y.level!==x.level||y.sn!==x.sn||y.urlId!==x.urlId},s.fragBufferedComplete=function(y,x){var P=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+y.type+" sn: "+y.sn+(x?" part: "+x.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level+" "+a.default.toString(B.BufferHelper.getBuffered(P))),this.state=b.IDLE,this.tick()},s._handleFragmentLoadComplete=function(y){var x=this.transmuxer;if(!x)return;var P=y.frag,j=y.part,Y=y.partsLoaded,Q=!Y||Y.length===0||Y.some(function(F){return!F}),X=new m.ChunkMetadata(P.level,P.sn,P.stats.chunkCount+1,0,j?j.index:-1,!Q);x.flush(X)},s._handleFragmentLoadProgress=function(y){},s._doFragLoad=function(y,x,P,j){var Y=this;if(P===void 0&&(P=null),!this.levels)throw new Error("frag load aborted, missing levels");if(P=Math.max(y.start,P||0),this.config.lowLatencyMode&&x){var Q=x.partList;if(Q&&j){P>y.end&&x.fragmentHint&&(y=x.fragmentHint);var X=this.getNextPart(Q,y,P);if(X>-1){var F=Q[X];return this.log("Loading part sn: "+y.sn+" p: "+F.index+" cc: "+y.cc+" of playlist ["+x.startSN+"-"+x.endSN+"] parts [0-"+X+"-"+(Q.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(P.toFixed(3))),this.nextLoadPosition=F.start+F.duration,this.state=b.FRAG_LOADING,this.hls.trigger(A.Events.FRAG_LOADING,{frag:y,part:Q[X],targetBufferTime:P}),this.doFragPartsLoad(y,Q,X,j).catch(function($){return Y.handleFragLoadError($)})}else if(!y.url||this.loadedEndOfParts(Q,P))return Promise.resolve(null)}}return this.log("Loading fragment "+y.sn+" cc: "+y.cc+" "+(x?"of ["+x.startSN+"-"+x.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(P.toFixed(3))),Object(K.isFiniteNumber)(y.sn)&&!this.bitrateTest&&(this.nextLoadPosition=y.start+y.duration),this.state=b.FRAG_LOADING,this.hls.trigger(A.Events.FRAG_LOADING,{frag:y,targetBufferTime:P}),this.fragmentLoader.load(y,j).catch(function($){return Y.handleFragLoadError($)})},s.doFragPartsLoad=function(y,x,P,j){var Y=this;return new Promise(function(Q,X){var F=[],$=function re(se){var he=x[se];Y.fragmentLoader.loadPart(y,he,j).then(function(_e){F[he.index]=_e;var xe=_e.part;Y.hls.trigger(A.Events.FRAG_LOADED,_e);var Ce=x[se+1];if(Ce&&Ce.fragment===y)re(se+1);else return Q({frag:y,part:xe,partsLoaded:F})}).catch(X)};$(P)})},s.handleFragLoadError=function(y){var x=y.data;return x&&x.details===k.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(x.frag,x.part):this.hls.trigger(A.Events.ERROR,x),null},s._handleTransmuxerFlush=function(y){var x=this.getCurrentContext(y);if(!x||this.state!==b.PARSING){this.fragCurrent||(this.state=b.IDLE);return}var P=x.frag,j=x.part,Y=x.level,Q=self.performance.now();P.stats.parsing.end=Q,j&&(j.stats.parsing.end=Q),this.updateLevelTiming(P,j,Y,y.partial)},s.getCurrentContext=function(y){var x=this.levels,P=y.level,j=y.sn,Y=y.part;if(!x||!x[P])return this.warn("Levels object was unset while buffering fragment "+j+" of level "+P+". The current chunk will not be buffered."),null;var Q=x[P],X=Y>-1?Object(E.getPartWith)(Q,j,Y):null,F=X?X.fragment:Object(E.getFragmentWithSN)(Q,j,this.fragCurrent);return F?{frag:F,part:X,level:Q}:null},s.bufferFragmentData=function(y,x,P,j){if(!y||this.state!==b.PARSING)return;var Y=y.data1,Q=y.data2,X=Y;if(Y&&Q&&(X=Object(O.appendUint8Array)(Y,Q)),!X||!X.length)return;var F={type:y.type,frag:x,part:P,chunkMeta:j,parent:x.type,data:X};this.hls.trigger(A.Events.BUFFER_APPENDING,F),y.dropped&&y.independent&&!P&&this.flushBufferGap(x)},s.flushBufferGap=function(y){var x=this.media;if(!x)return;if(!B.BufferHelper.isBuffered(x,x.currentTime)){this.flushMainBuffer(0,y.start);return}var P=x.currentTime,j=B.BufferHelper.bufferInfo(x,P,0),Y=y.duration,Q=Math.min(this.config.maxFragLookUpTolerance*2,Y*.25),X=Math.max(Math.min(y.start-Q,j.end-Q),P+Q);y.start-X>Q&&this.flushMainBuffer(X,y.start)},s.getFwdBufferInfo=function(y,x){var P=this.config,j=this.getLoadPosition();if(!Object(K.isFiniteNumber)(j))return null;var Y=B.BufferHelper.bufferInfo(y,j,P.maxBufferHole);if(Y.len===0&&Y.nextStart!==void 0){var Q=this.fragmentTracker.getBufferedFrag(j,x);if(Q&&Y.nextStart<Q.end)return B.BufferHelper.bufferInfo(y,j,Math.max(Y.nextStart,P.maxBufferHole))}return Y},s.getMaxBufferLength=function(y){var x=this.config,P;return y?P=Math.max(8*x.maxBufferSize/y,x.maxBufferLength):P=x.maxBufferLength,Math.min(P,x.maxMaxBufferLength)},s.reduceMaxBufferLength=function(y){var x=this.config,P=y||x.maxBufferLength;return x.maxMaxBufferLength>=P?(x.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+x.maxMaxBufferLength+"s"),!0):!1},s.getNextFragment=function(y,x){var P,j,Y=x.fragments,Q=Y.length;if(!Q)return null;var X=this.config,F=Y[0].start,$;if(x.live){var re=X.initialLiveManifestSize;if(Q<re)return this.warn("Not enough fragments to start playback (have: "+Q+", need: "+re+")"),null;!x.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&($=this.getInitialLiveFragment(x,Y),this.startPosition=$?this.hls.liveSyncPosition||$.start:y)}else y<=F&&($=Y[0]);if(!$){var se=X.lowLatencyMode?x.partEnd:x.fragmentEnd;$=this.getFragmentAtPosition(y,se,x)}return(P=$)!==null&&P!==void 0&&P.initSegment&&!((j=$)!==null&&j!==void 0&&j.initSegment.data)&&!this.bitrateTest&&($=$.initSegment),$},s.getNextPart=function(y,x,P){for(var j=-1,Y=!1,Q=!0,X=0,F=y.length;X<F;X++){var $=y[X];if(Q=Q&&!$.independent,j>-1&&P<$.start)break;var re=$.loaded;!re&&(Y||$.independent||Q)&&$.fragment===x&&(j=X),Y=re}return j},s.loadedEndOfParts=function(y,x){var P=y[y.length-1];return P&&x>P.start&&P.loaded},s.getInitialLiveFragment=function(y,x){var P=this.fragPrevious,j=null;if(P){if(y.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+P.programDateTime),j=Object(_.findFragmentByPDT)(x,P.endProgramDateTime,this.config.maxFragLookUpTolerance)),!j){var Y=P.sn+1;if(Y>=y.startSN&&Y<=y.endSN){var Q=x[Y-y.startSN];P.cc===Q.cc&&(j=Q,this.log("Live playlist, switching playlist, load frag with next SN: "+j.sn))}j||(j=Object(_.findFragWithCC)(x,P.cc),j&&this.log("Live playlist, switching playlist, load frag with same CC: "+j.sn))}}else{var X=this.hls.liveSyncPosition;X!==null&&(j=this.getFragmentAtPosition(X,this.bitrateTest?y.fragmentEnd:y.edge,y))}return j},s.getFragmentAtPosition=function(y,x,P){var j=this.config,Y=this.fragPrevious,Q=P.fragments,X=P.endSN,F=P.fragmentHint,$=j.maxFragLookUpTolerance,re=!!(j.lowLatencyMode&&P.partList&&F);re&&F&&!this.bitrateTest&&(Q=Q.concat(F),X=F.sn);var se;if(y<x){var he=y>x-$?0:$;se=Object(_.findFragmentByPTS)(Y,Q,y,he)}else se=Q[Q.length-1];if(se){var _e=se.sn-P.startSN,xe=Y&&se.level===Y.level,Ce=Q[_e+1],Oe=this.fragmentTracker.getState(se);if(Oe===w.FragmentState.BACKTRACKED){se=null;for(var De=_e;Q[De]&&this.fragmentTracker.getState(Q[De])===w.FragmentState.BACKTRACKED;)Y?se=Q[De--]:se=Q[--De];se||(se=Ce)}else Y&&se.sn===Y.sn&&!re&&(xe&&(se.sn<X&&this.fragmentTracker.getState(Ce)!==w.FragmentState.OK?(this.log("SN "+se.sn+" just loaded, load next one: "+Ce.sn),se=Ce):se=null))}return se},s.synchronizeToLiveEdge=function(y){var x=this.config,P=this.media;if(!P)return;var j=this.hls.liveSyncPosition,Y=P.currentTime,Q=y.fragments[0].start,X=y.edge,F=Y>=Q-x.maxFragLookUpTolerance&&Y<=X;if(j!==null&&P.duration>j&&(Y<j||!F)){var $=x.liveMaxLatencyDuration!==void 0?x.liveMaxLatencyDuration:x.liveMaxLatencyDurationCount*y.targetduration;(!F&&P.readyState<4||Y<X-$)&&(this.loadedmetadata||(this.nextLoadPosition=j),P.readyState&&(this.warn("Playback: "+Y.toFixed(3)+" is located too far from the end of live sliding playlist: "+X+", reset currentTime to : "+j.toFixed(3)),P.currentTime=j))}},s.alignPlaylists=function(y,x){var P=this.levels,j=this.levelLastLoaded,Y=this.fragPrevious,Q=j!==null?P[j]:null,X=y.fragments.length;if(!X)return this.warn("No fragments in live playlist"),0;var F=y.fragments[0].start,$=!x,re=y.alignedSliding&&Object(K.isFiniteNumber)(F);if($||!re&&!F){Object(R.alignStream)(Y,Q,y);var se=y.fragments[0].start;return this.log("Live playlist sliding: "+se.toFixed(2)+" start-sn: "+(x?x.startSN:"na")+"->"+y.startSN+" prev-sn: "+(Y?Y.sn:"na")+" fragments: "+X),se}return F},s.waitForCdnTuneIn=function(y){var x=3;return y.live&&y.canBlockReload&&y.tuneInGoal>Math.max(y.partHoldBack,y.partTarget*x)},s.setStartPosition=function(y,x){var P=this.startPosition;if(P<x&&(P=-1),P===-1||this.lastCurrentTime===-1){var j=y.startTimeOffset;Object(K.isFiniteNumber)(j)?(P=x+j,j<0&&(P+=y.totalduration),P=Math.min(Math.max(x,P),x+y.totalduration),this.log("Start time offset "+j+" found in playlist, adjust startPosition to "+P),this.startPosition=P):y.live?P=this.hls.liveSyncPosition||x:this.startPosition=P=0,this.lastCurrentTime=P}this.nextLoadPosition=P},s.getLoadPosition=function(){var y=this.media,x=0;return this.loadedmetadata&&y?x=y.currentTime:this.nextLoadPosition&&(x=this.nextLoadPosition),x},s.handleFragLoadAborted=function(y,x){this.transmuxer&&y.sn!=="initSegment"&&y.stats.aborted&&(this.warn("Fragment "+y.sn+(x?" part"+x.index:"")+" of level "+y.level+" was aborted"),this.resetFragmentLoading(y))},s.resetFragmentLoading=function(y){(!this.fragCurrent||!this.fragContextChanged(y))&&(this.state=b.IDLE)},s.onFragmentOrKeyLoadError=function(y,x){if(x.fatal)return;var P=x.frag;if(!P||P.type!==y)return;var j=this.fragCurrent;console.assert(j&&P.sn===j.sn&&P.level===j.level&&P.urlId===j.urlId,"Frag load error must match current frag to retry");var Y=this.config;if(this.fragLoadError+1<=Y.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(P.level))return;var Q=Math.min(Math.pow(2,this.fragLoadError)*Y.fragLoadingRetryDelay,Y.fragLoadingMaxRetryTimeout);this.warn("Fragment "+P.sn+" of "+y+" "+P.level+" failed to load, retrying in "+Q+"ms"),this.retryDate=self.performance.now()+Q,this.fragLoadError++,this.state=b.FRAG_LOADING_WAITING_RETRY}else x.levelRetry?(y===i.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=b.IDLE):(N.logger.error(x.details+" reaches max retry, redispatch as fatal ..."),x.fatal=!0,this.hls.stopLoad(),this.state=b.ERROR)},s.afterBufferFlushed=function(y,x,P){if(!y)return;var j=B.BufferHelper.getBuffered(y);this.fragmentTracker.detectEvictedFragments(x,j,P),this.state===b.ENDED&&this.resetLoadingState()},s.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=b.IDLE},s.resetLiveStartWhenNotLoaded=function(y){if(!this.loadedmetadata){this.startFragRequested=!1;var x=this.levels?this.levels[y].details:null;if(x!=null&&x.live)return this.startPosition=-1,this.setStartPosition(x,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},s.updateLevelTiming=function(y,x,P,j){var Y=this,Q=P.details;console.assert(!!Q,"level.details must be defined");var X=Object.keys(y.elementaryStreams).reduce(function(F,$){var re=y.elementaryStreams[$];if(re){var se=re.endPTS-re.startPTS;if(se<=0)return Y.warn("Could not parse fragment "+y.sn+" "+$+" duration reliably ("+se+") resetting transmuxer to fallback to playlist timing"),Y.resetTransmuxer(),F||!1;var he=j?0:Object(E.updateFragPTSDTS)(Q,y,re.startPTS,re.endPTS,re.startDTS,re.endDTS);return Y.hls.trigger(A.Events.LEVEL_PTS_UPDATED,{details:Q,level:P,drift:he,type:$,frag:y,start:re.startPTS,end:re.endPTS}),!0}return F},!1);X?(this.state=b.PARSED,this.hls.trigger(A.Events.FRAG_PARSED,{frag:y,part:x})):this.resetLoadingState()},s.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},S(o,[{key:"state",get:function(){return this._state},set:function(y){var x=this._state;x!==y&&(this._state=y,this.log(x+"->"+y))}}]),o}(I.default)},"./src/controller/buffer-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return _});var K=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),w=L("./src/utils/logger.ts"),B=L("./src/errors.ts"),N=L("./src/utils/buffer-helper.ts"),A=L("./src/utils/mediasource-helper.ts"),k=L("./src/loader/fragment.ts"),m=L("./src/controller/buffer-operation-queue.ts"),O=Object(A.getMediaSource)(),R=/([ha]vc.)(?:\.[^.,]+)+/,_=function(){function E(u){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 i=a.hls,c=a.media,S=a.mediaSource;w.logger.log("[buffer-controller]: Media source opened"),c&&(a.updateMediaElementDuration(),i.trigger(I.Events.MEDIA_ATTACHED,{media:c})),S&&S.removeEventListener("sourceopen",a._onMediaSourceOpen),a.checkPendingTracks()},this._onMediaSourceClose=function(){w.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){w.logger.log("[buffer-controller]: Media source ended")},this.hls=u,this._initSourceBuffer(),this.registerListeners()}var g=E.prototype;return g.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},g.destroy=function(){this.unregisterListeners(),this.details=null},g.registerListeners=function(){var a=this.hls;a.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(I.Events.BUFFER_RESET,this.onBufferReset,this),a.on(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.on(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.on(I.Events.BUFFER_EOS,this.onBufferEos,this),a.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(I.Events.FRAG_PARSED,this.onFragParsed,this),a.on(I.Events.FRAG_CHANGED,this.onFragChanged,this)},g.unregisterListeners=function(){var a=this.hls;a.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(I.Events.BUFFER_RESET,this.onBufferReset,this),a.off(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.off(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.off(I.Events.BUFFER_EOS,this.onBufferEos,this),a.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(I.Events.FRAG_PARSED,this.onFragParsed,this),a.off(I.Events.FRAG_CHANGED,this.onFragChanged,this)},g._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new m.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},g.onManifestParsed=function(a,i){var c=2;(i.audio&&!i.video||!i.altAudio)&&(c=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=c,this.details=null,w.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},g.onMediaAttaching=function(a,i){var c=this.media=i.media;if(c&&O){var S=this.mediaSource=new O;S.addEventListener("sourceopen",this._onMediaSourceOpen),S.addEventListener("sourceended",this._onMediaSourceEnded),S.addEventListener("sourceclose",this._onMediaSourceClose),c.src=self.URL.createObjectURL(S),this._objectUrl=c.src}},g.onMediaDetaching=function(){var a=this.media,i=this.mediaSource,c=this._objectUrl;if(i){if(w.logger.log("[buffer-controller]: media source detaching"),i.readyState==="open")try{i.endOfStream()}catch(S){w.logger.warn("[buffer-controller]: onMediaDetaching: "+S.message+" while calling endOfStream")}this.onBufferReset(),i.removeEventListener("sourceopen",this._onMediaSourceOpen),i.removeEventListener("sourceended",this._onMediaSourceEnded),i.removeEventListener("sourceclose",this._onMediaSourceClose),a&&(c&&self.URL.revokeObjectURL(c),a.src===c?(a.removeAttribute("src"),a.load()):w.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(I.Events.MEDIA_DETACHED,void 0)},g.onBufferReset=function(){var a=this;this.getSourceBufferTypes().forEach(function(i){var c=a.sourceBuffer[i];try{c&&(a.removeBufferListeners(i),a.mediaSource&&a.mediaSource.removeSourceBuffer(c),a.sourceBuffer[i]=void 0)}catch(S){w.logger.warn("[buffer-controller]: Failed to reset the "+i+" buffer",S)}}),this._initSourceBuffer()},g.onBufferCodecs=function(a,i){var c=this,S=this.getSourceBufferTypes().length;if(Object.keys(i).forEach(function(v){if(S){var p=c.tracks[v];if(p&&typeof p.buffer.changeType=="function"){var D=i[v],b=D.codec,h=D.levelCodec,d=D.container,o=(p.levelCodec||p.codec).replace(R,"$1"),s=(h||b).replace(R,"$1");if(o!==s){var C=d+";codecs="+(h||b);c.appendChangeType(v,C)}}}else c.pendingTracks[v]=i[v]}),S)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},g.appendChangeType=function(a,i){var c=this,S=this.operationQueue,v={execute:function(){var D=c.sourceBuffer[a];D&&(w.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+i),D.changeType(i)),S.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(D){w.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",D)}};S.append(v,a)},g.onBufferAppending=function(a,i){var c=this,S=this.hls,v=this.operationQueue,p=this.tracks,D=i.data,b=i.type,h=i.frag,d=i.part,o=i.chunkMeta,s=o.buffering[b],C=self.performance.now();s.start=C;var y=h.stats.buffering,x=d?d.stats.buffering:null;y.start===0&&(y.start=C),x&&x.start===0&&(x.start=C);var P=p.audio,j=b==="audio"&&o.id===1&&(P==null?void 0:P.container)==="audio/mpeg",Y={execute:function(){if(s.executeStart=self.performance.now(),j){var X=c.sourceBuffer[b];if(X){var F=h.start-X.timestampOffset;Math.abs(F)>=.1&&(w.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+h.start+" (delta: "+F+") sn: "+h.sn+")"),X.timestampOffset=h.start)}}c.appendExecutor(D,b)},onStart:function(){},onComplete:function(){var X=self.performance.now();s.executeEnd=s.end=X,y.first===0&&(y.first=X),x&&x.first===0&&(x.first=X);var F=c.sourceBuffer,$={};for(var re in F)$[re]=N.BufferHelper.getBuffered(F[re]);c.appendError=0,c.hls.trigger(I.Events.BUFFER_APPENDED,{type:b,frag:h,part:d,chunkMeta:o,parent:h.type,timeRanges:$})},onError:function(X){w.logger.error("[buffer-controller]: Error encountered while trying to append to the "+b+" SourceBuffer",X);var F={type:B.ErrorTypes.MEDIA_ERROR,parent:h.type,details:B.ErrorDetails.BUFFER_APPEND_ERROR,err:X,fatal:!1};X.code===DOMException.QUOTA_EXCEEDED_ERR?F.details=B.ErrorDetails.BUFFER_FULL_ERROR:(c.appendError++,F.details=B.ErrorDetails.BUFFER_APPEND_ERROR,c.appendError>S.config.appendErrorMaxRetry&&(w.logger.error("[buffer-controller]: Failed "+S.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),F.fatal=!0)),S.trigger(I.Events.ERROR,F)}};v.append(Y,b)},g.onBufferFlushing=function(a,i){var c=this,S=this.operationQueue,v=function(D){return{execute:c.removeExecutor.bind(c,D,i.startOffset,i.endOffset),onStart:function(){},onComplete:function(){c.hls.trigger(I.Events.BUFFER_FLUSHED,{type:D})},onError:function(h){w.logger.warn("[buffer-controller]: Failed to remove from "+D+" SourceBuffer",h)}}};i.type?S.append(v(i.type),i.type):this.getSourceBufferTypes().forEach(function(p){S.append(v(p),p)})},g.onFragParsed=function(a,i){var c=this,S=i.frag,v=i.part,p=[],D=v?v.elementaryStreams:S.elementaryStreams;D[k.ElementaryStreamTypes.AUDIOVIDEO]?p.push("audiovideo"):(D[k.ElementaryStreamTypes.AUDIO]&&p.push("audio"),D[k.ElementaryStreamTypes.VIDEO]&&p.push("video"));var b=function(){var d=self.performance.now();S.stats.buffering.end=d,v&&(v.stats.buffering.end=d);var o=v?v.stats:S.stats;c.hls.trigger(I.Events.FRAG_BUFFERED,{frag:S,part:v,stats:o,id:S.type})};p.length===0&&w.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+S.type+" level: "+S.level+" sn: "+S.sn),this.blockBuffers(b,p)},g.onFragChanged=function(a,i){this.flushBackBuffer()},g.onBufferEos=function(a,i){var c=this,S=this.getSourceBufferTypes().reduce(function(v,p){var D=c.sourceBuffer[p];return(!i.type||i.type===p)&&(D&&!D.ended&&(D.ended=!0,w.logger.log("[buffer-controller]: "+p+" sourceBuffer now EOS"))),v&&!!(!D||D.ended)},!0);S&&this.blockBuffers(function(){var v=c.mediaSource;if(!v||v.readyState!=="open")return;v.endOfStream()})},g.onLevelUpdated=function(a,i){var c=i.details;if(!c.fragments.length)return;this.details=c,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},g.flushBackBuffer=function(){var a=this.hls,i=this.details,c=this.media,S=this.sourceBuffer;if(!c||i===null)return;var v=this.getSourceBufferTypes();if(!v.length)return;var p=i.live&&a.config.liveBackBufferLength!==null?a.config.liveBackBufferLength:a.config.backBufferLength;if(!Object(K.isFiniteNumber)(p)||p<0)return;var D=c.currentTime,b=i.levelTargetDuration,h=Math.max(p,b),d=Math.floor(D/b)*b-h;v.forEach(function(o){var s=S[o];if(s){var C=N.BufferHelper.getBuffered(s);C.length>0&&d>C.start(0)&&(a.trigger(I.Events.BACK_BUFFER_REACHED,{bufferEnd:d}),i.live&&a.trigger(I.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:d}),a.trigger(I.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:d,type:o}))}})},g.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var a=this.details,i=this.hls,c=this.media,S=this.mediaSource,v=a.fragments[0].start+a.totalduration,p=c.duration,D=Object(K.isFiniteNumber)(S.duration)?S.duration:0;a.live&&i.config.liveDurationInfinity?(w.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),S.duration=Infinity,this.updateSeekableRange(a)):(v>D&&v>p||!Object(K.isFiniteNumber)(p))&&(w.logger.log("[buffer-controller]: Updating Media Source duration to "+v.toFixed(3)),S.duration=v)},g.updateSeekableRange=function(a){var i=this.mediaSource,c=a.fragments,S=c.length;if(S&&a.live&&i!==null&&i!==void 0&&i.setLiveSeekableRange){var v=Math.max(0,c[0].start),p=Math.max(v,v+a.totalduration);i.setLiveSeekableRange(v,p)}},g.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,i=this.operationQueue,c=this.pendingTracks,S=Object.keys(c).length;if(S&&!a||S===2){this.createSourceBuffers(c),this.pendingTracks={};var v=this.getSourceBufferTypes();if(v.length===0){this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}v.forEach(function(p){i.executeNext(p)})}},g.createSourceBuffers=function(a){var i=this.sourceBuffer,c=this.mediaSource;if(!c)throw Error("createSourceBuffers called when mediaSource was null");var S=0;for(var v in a)if(!i[v]){var p=a[v];if(!p)throw Error("source buffer exists for track "+v+", however track does not");var D=p.levelCodec||p.codec,b=p.container+";codecs="+D;w.logger.log("[buffer-controller]: creating sourceBuffer("+b+")");try{var h=i[v]=c.addSourceBuffer(b),d=v;this.addBufferListener(d,"updatestart",this._onSBUpdateStart),this.addBufferListener(d,"updateend",this._onSBUpdateEnd),this.addBufferListener(d,"error",this._onSBUpdateError),this.tracks[v]={buffer:h,codec:D,container:p.container,levelCodec:p.levelCodec,id:p.id},S++}catch(o){w.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+o.message),this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:o,mimeType:b})}}S&&this.hls.trigger(I.Events.BUFFER_CREATED,{tracks:this.tracks})},g._onSBUpdateStart=function(a){var i=this.operationQueue,c=i.current(a);c.onStart()},g._onSBUpdateEnd=function(a){var i=this.operationQueue,c=i.current(a);c.onComplete(),i.shiftAndExecuteNext(a)},g._onSBUpdateError=function(a,i){w.logger.error("[buffer-controller]: "+a+" SourceBuffer error",i),this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var c=this.operationQueue.current(a);c&&c.onError(i)},g.removeExecutor=function(a,i,c){var S=this.media,v=this.mediaSource,p=this.operationQueue,D=this.sourceBuffer,b=D[a];if(!S||!v||!b){w.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),p.shiftAndExecuteNext(a);return}var h=Object(K.isFiniteNumber)(S.duration)?S.duration:Infinity,d=Object(K.isFiniteNumber)(v.duration)?v.duration:Infinity,o=Math.max(0,i),s=Math.min(c,h,d);s>o?(w.logger.log("[buffer-controller]: Removing ["+o+","+s+"] from the "+a+" SourceBuffer"),console.assert(!b.updating,a+" sourceBuffer must not be updating"),b.remove(o,s)):p.shiftAndExecuteNext(a)},g.appendExecutor=function(a,i){var c=this.operationQueue,S=this.sourceBuffer,v=S[i];if(!v){w.logger.warn("[buffer-controller]: Attempting to append to the "+i+" SourceBuffer, but it does not exist"),c.shiftAndExecuteNext(i);return}v.ended=!1,console.assert(!v.updating,i+" sourceBuffer must not be updating"),v.appendBuffer(a)},g.blockBuffers=function(a,i){var c=this;if(i===void 0&&(i=this.getSourceBufferTypes()),!i.length){w.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(a);return}var S=this.operationQueue,v=i.map(function(p){return S.appendBlocker(p)});Promise.all(v).then(function(){a(),i.forEach(function(p){var D=c.sourceBuffer[p];(!D||!D.updating)&&S.shiftAndExecuteNext(p)})})},g.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},g.addBufferListener=function(a,i,c){var S=this.sourceBuffer[a];if(!S)return;var v=c.bind(this,a);this.listeners[a].push({event:i,listener:v}),S.addEventListener(i,v)},g.removeBufferListeners=function(a){var i=this.sourceBuffer[a];if(!i)return;this.listeners[a].forEach(function(c){i.removeEventListener(c.event,c.listener)})},E}()},"./src/controller/buffer-operation-queue.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return I});var K=L("./src/utils/logger.ts"),I=function(){function w(N){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=N}var B=w.prototype;return B.append=function(A,k){var m=this.queues[k];m.push(A),m.length===1&&this.buffers[k]&&this.executeNext(k)},B.insertAbort=function(A,k){var m=this.queues[k];m.unshift(A),this.executeNext(k)},B.appendBlocker=function(A){var k,m=new Promise(function(R){k=R}),O={execute:k,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(O,A),m},B.executeNext=function(A){var k=this.buffers,m=this.queues,O=k[A],R=m[A];if(R.length){var _=R[0];try{_.execute()}catch(E){K.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),_.onError(E),(!O||!O.updating)&&(R.shift(),this.executeNext(A))}}},B.shiftAndExecuteNext=function(A){this.queues[A].shift(),this.executeNext(A)},B.current=function(A){return this.queues[A][0]},w}()},"./src/controller/cap-level-controller.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/events.ts");function I(N,A){for(var k=0;k<A.length;k++){var m=A[k];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(N,m.key,m)}}function w(N,A,k){return A&&I(N.prototype,A),k&&I(N,k),N}var B=function(){function N(k){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=k,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var A=N.prototype;return A.setStreamController=function(m){this.streamController=m},A.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},A.registerListeners=function(){var m=this.hls;m.on(K.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),m.on(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),m.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),m.on(K.Events.BUFFER_CODECS,this.onBufferCodecs,this),m.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},A.unregisterListener=function(){var m=this.hls;m.off(K.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),m.off(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),m.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),m.off(K.Events.BUFFER_CODECS,this.onBufferCodecs,this),m.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},A.onFpsDropLevelCapping=function(m,O){N.isLevelAllowed(O.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(O.droppedLevel)},A.onMediaAttaching=function(m,O){this.media=O.media instanceof HTMLVideoElement?O.media:null},A.onManifestParsed=function(m,O){var R=this.hls;this.restrictedLevels=[],this.firstLevel=O.firstLevel,R.config.capLevelToPlayerSize&&O.video&&this.startCapping()},A.onBufferCodecs=function(m,O){var R=this.hls;R.config.capLevelToPlayerSize&&O.video&&this.startCapping()},A.onMediaDetaching=function(){this.stopCapping()},A.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var m=this.hls.levels;if(m.length){var O=this.hls;O.autoLevelCapping=this.getMaxLevel(m.length-1),O.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=O.autoLevelCapping}}},A.getMaxLevel=function(m){var O=this,R=this.hls.levels;if(!R.length)return-1;var _=R.filter(function(E,g){return N.isLevelAllowed(g,O.restrictedLevels)&&g<=m});return this.clientRect=null,N.getMaxLevelByMediaSize(_,this.mediaWidth,this.mediaHeight)},A.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()},A.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},A.getDimensions=function(){if(this.clientRect)return this.clientRect;var m=this.media,O={width:0,height:0};if(m){var R=m.getBoundingClientRect();O.width=R.width,O.height=R.height,!O.width&&!O.height&&(O.width=R.right-R.left||m.width||0,O.height=R.bottom-R.top||m.height||0)}return this.clientRect=O,O},N.isLevelAllowed=function(m,O){return O===void 0&&(O=[]),O.indexOf(m)===-1},N.getMaxLevelByMediaSize=function(m,O,R){if(!m||!m.length)return-1;for(var _=function(i,c){return c?i.width!==c.width||i.height!==c.height:!0},E=m.length-1,g=0;g<m.length;g+=1){var u=m[g];if((u.width>=O||u.height>=R)&&_(u,m[g+1])){E=g;break}}return E},w(N,[{key:"mediaWidth",get:function(){return this.getDimensions().width*N.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*N.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var m=1;try{m=self.devicePixelRatio}catch(O){}return m}}]),N}();z.default=B},"./src/controller/cmcd-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return _});var K=L("./src/events.ts"),I=L("./src/types/cmcd.ts"),w=L("./src/utils/buffer-helper.ts"),B=L("./src/utils/logger.ts");function N(E,g){for(var u=0;u<g.length;u++){var a=g[u];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(E,a.key,a)}}function A(E,g,u){return g&&N(E.prototype,g),u&&N(E,u),E}function k(E,g){var u=typeof Symbol!="undefined"&&E[Symbol.iterator]||E["@@iterator"];if(u)return(u=u.call(E)).next.bind(u);if(Array.isArray(E)||(u=m(E))||g&&E&&typeof E.length=="number"){u&&(E=u);var a=0;return function(){return a>=E.length?{done:!0}:{done:!1,value:E[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 m(E,g){if(!E)return;if(typeof E=="string")return O(E,g);var u=Object.prototype.toString.call(E).slice(8,-1);if(u==="Object"&&E.constructor&&(u=E.constructor.name),u==="Map"||u==="Set")return Array.from(E);if(u==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u))return O(E,g)}function O(E,g){(g==null||g>E.length)&&(g=E.length);for(var u=0,a=new Array(g);u<g;u++)a[u]=E[u];return a}function R(){return R=Object.assign||function(E){for(var g=1;g<arguments.length;g++){var u=arguments[g];for(var a in u)Object.prototype.hasOwnProperty.call(u,a)&&(E[a]=u[a])}return E},R.apply(this,arguments)}var _=function(){function E(u){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(S){try{a.apply(S,{ot:I.CMCDObjectType.MANIFEST,su:!a.initialized})}catch(v){B.logger.warn("Could not generate manifest CMCD data.",v)}},this.applyFragmentData=function(S){try{var v=S.frag,p=a.hls.levels[v.level],D=a.getObjectType(v),b={d:v.duration*1e3,ot:D};(D===I.CMCDObjectType.VIDEO||D===I.CMCDObjectType.AUDIO||D==I.CMCDObjectType.MUXED)&&(b.br=p.bitrate/1e3,b.tb=a.getTopBandwidth(D),b.bl=a.getBufferLength(D)),a.apply(S,b)}catch(h){B.logger.warn("Could not generate segment CMCD data.",h)}},this.hls=u;var i=this.config=u.config,c=i.cmcd;c!=null&&(i.pLoader=this.createPlaylistLoader(),i.fLoader=this.createFragmentLoader(),this.sid=c.sessionId||E.uuid(),this.cid=c.contentId,this.useHeaders=c.useHeaders===!0,this.registerListeners())}var g=E.prototype;return g.registerListeners=function(){var a=this.hls;a.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.on(K.Events.BUFFER_CREATED,this.onBufferCreated,this)},g.unregisterListeners=function(){var a=this.hls;a.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.off(K.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},g.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},g.onMediaAttached=function(a,i){this.media=i.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},g.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},g.onBufferCreated=function(a,i){var c,S;this.audioBuffer=(c=i.tracks.audio)===null||c===void 0?void 0:c.buffer,this.videoBuffer=(S=i.tracks.video)===null||S===void 0?void 0:S.buffer},g.createData=function(){var a;return{v:I.CMCDVersion,sf:I.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}},g.apply=function(a,i){i===void 0&&(i={}),R(i,this.createData());var c=i.ot===I.CMCDObjectType.INIT||i.ot===I.CMCDObjectType.VIDEO||i.ot===I.CMCDObjectType.MUXED;if(this.starved&&c&&(i.bs=!0,i.su=!0,this.starved=!1),i.su==null&&(i.su=this.buffering),this.useHeaders){var S=E.toHeaders(i);if(!Object.keys(S).length)return;a.headers||(a.headers={}),R(a.headers,S)}else{var v=E.toQuery(i);if(!v)return;a.url=E.appendQueryToUri(a.url,v)}},g.getObjectType=function(a){var i=a.type;return i==="subtitle"?I.CMCDObjectType.TIMED_TEXT:a.sn==="initSegment"?I.CMCDObjectType.INIT:i==="audio"?I.CMCDObjectType.AUDIO:i==="main"?this.hls.audioTracks.length?I.CMCDObjectType.VIDEO:I.CMCDObjectType.MUXED:void 0},g.getTopBandwidth=function(a){for(var i=0,c=a===I.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,S=k(c),v;!(v=S()).done;){var p=v.value;p.bitrate>i&&(i=p.bitrate)}return i>0?i:NaN},g.getBufferLength=function(a){var i=this.hls.media,c=a===I.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!c||!i)return NaN;var S=w.BufferHelper.bufferInfo(c,i.currentTime,this.config.maxBufferHole);return S.len*1e3},g.createPlaylistLoader=function(){var a=this.config.pLoader,i=this.applyPlaylistData,c=a||this.config.loader;return function(){function S(p){this.loader=void 0,this.loader=new c(p)}var v=S.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(D,b,h){i(D),this.loader.load(D,b,h)},A(S,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),S}()},g.createFragmentLoader=function(){var a=this.config.fLoader,i=this.applyFragmentData,c=a||this.config.loader;return function(){function S(p){this.loader=void 0,this.loader=new c(p)}var v=S.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(D,b,h){i(D),this.loader.load(D,b,h)},A(S,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),S}()},E.uuid=function(){var a=URL.createObjectURL(new Blob),i=a.toString();return URL.revokeObjectURL(a),i.substr(i.lastIndexOf("/")+1)},E.serialize=function(a){for(var i=[],c=function(j){return!Number.isNaN(j)&&j!=null&&j!==""&&j!==!1},S=function(j){return Math.round(j)},v=function(j){return S(j/100)*100},p=function(j){return encodeURIComponent(j)},D={br:S,d:S,bl:v,dl:v,mtp:v,nor:p,rtp:v,tb:S},b=Object.keys(a||{}).sort(),h=k(b),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 C=D[o];C&&(s=C(s));var y=typeof s,x=void 0;o==="ot"||o==="sf"||o==="st"?x=o+"="+s:y==="boolean"?x=o:y==="number"?x=o+"="+s:x=o+"="+JSON.stringify(s),i.push(x)}return i.join(",")},E.toHeaders=function(a){for(var i=Object.keys(a),c={},S=["Object","Request","Session","Status"],v=[{},{},{},{}],p={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,b=i;D<b.length;D++){var h=b[D],d=p[h]!=null?p[h]:1;v[d][h]=a[h]}for(var o=0;o<v.length;o++){var s=E.serialize(v[o]);s&&(c["CMCD-"+S[o]]=s)}return c},E.toQuery=function(a){return"CMCD="+encodeURIComponent(E.serialize(a))},E.appendQueryToUri=function(a,i){if(!i)return a;var c=a.includes("?")?"&":"?";return""+a+c+i},E}()},"./src/controller/eme-controller.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/events.ts"),I=L("./src/errors.ts"),w=L("./src/utils/logger.ts"),B=L("./src/utils/mediakeys-helper.ts");function N(_,E){for(var g=0;g<E.length;g++){var u=E[g];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(_,u.key,u)}}function A(_,E,g){return E&&N(_.prototype,E),g&&N(_,g),_}var k=3,m=function(E,g,u){var a={audioCapabilities:[],videoCapabilities:[]};return E.forEach(function(i){a.audioCapabilities.push({contentType:'audio/mp4; codecs="'+i+'"',robustness:u.audioRobustness||""})}),g.forEach(function(i){a.videoCapabilities.push({contentType:'video/mp4; codecs="'+i+'"',robustness:u.videoRobustness||""})}),[a]},O=function(E,g,u,a){switch(E){case B.KeySystems.WIDEVINE:return m(g,u,a);default:throw new Error("Unknown key-system: "+E)}},R=function(){function _(g){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=g,this._config=g.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 E=_.prototype;return E.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},E._registerListeners=function(){this.hls.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this)},E._unregisterListeners=function(){this.hls.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this)},E.getLicenseServerUrl=function(u){switch(u){case B.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+u+'"')},E._attemptKeySystemAccess=function(u,a,i){var c=this,S=O(u,a,i,this._drmSystemOptions);w.logger.log("Requesting encrypted media key-system access");var v=this.requestMediaKeySystemAccess(u,S);this.mediaKeysPromise=v.then(function(p){return c._onMediaKeySystemAccessObtained(u,p)}),v.catch(function(p){w.logger.error('Failed to obtain key-system "'+u+'" access:',p)})},E._onMediaKeySystemAccessObtained=function(u,a){var i=this;w.logger.log('Access for key-system "'+u+'" obtained');var c={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:a,mediaKeySystemDomain:u};this._mediaKeysList.push(c);var S=Promise.resolve().then(function(){return a.createMediaKeys()}).then(function(v){return c.mediaKeys=v,w.logger.log('Media-keys created for key-system "'+u+'"'),i._onMediaKeysCreated(),v});return S.catch(function(v){w.logger.error("Failed to create media-keys:",v)}),S},E._onMediaKeysCreated=function(){var u=this;this._mediaKeysList.forEach(function(a){a.mediaKeysSession||(a.mediaKeysSession=a.mediaKeys.createSession(),u._onNewMediaKeySession(a.mediaKeysSession))})},E._onNewMediaKeySession=function(u){var a=this;w.logger.log("New key-system session "+u.sessionId),u.addEventListener("message",function(i){a._onKeySessionMessage(u,i.message)},!1)},E._onKeySessionMessage=function(u,a){w.logger.log("Got EME message event, creating license request"),this._requestLicense(a,function(i){w.logger.log("Received license data (length: "+(i&&i.byteLength)+"), updating key-session"),u.update(i)})},E.onMediaEncrypted=function(u){var a=this;if(w.logger.log('Media is encrypted using "'+u.initDataType+'" init data type'),!this.mediaKeysPromise){w.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(K.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var i=function(S){if(!a._media)return;a._attemptSetMediaKeys(S),a._generateRequestWithPreferredKeySession(u.initDataType,u.initData)};this.mediaKeysPromise.then(i).catch(i)},E._attemptSetMediaKeys=function(u){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){w.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}w.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(a.mediaKeys),this._hasSetMediaKeys=!0}},E._generateRequestWithPreferredKeySession=function(u,a){var i=this,c=this._mediaKeysList[0];if(!c){w.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(c.mediaKeysSessionInitialized){w.logger.warn("Key-Session already initialized but requested again");return}var S=c.mediaKeysSession;if(!S){w.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(K.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!a){w.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(K.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}w.logger.log('Generating key-session request for "'+u+'" init data type'),c.mediaKeysSessionInitialized=!0,S.generateRequest(u,a).then(function(){w.logger.debug("Key-session generation succeeded")}).catch(function(v){w.logger.error("Error generating key-session request:",v),i.hls.trigger(K.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},E._createLicenseXhr=function(u,a,i){var c=new XMLHttpRequest;c.responseType="arraybuffer",c.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,c,u,a,i);var S=this._licenseXhrSetup;if(S)try{S.call(this.hls,c,u),S=void 0}catch(v){w.logger.error(v)}try{c.readyState||c.open("POST",u,!0),S&&S.call(this.hls,c,u)}catch(v){throw new Error("issue setting up KeySystem license XHR "+v)}return c},E._onLicenseRequestReadyStageChange=function(u,a,i,c){switch(u.readyState){case 4:if(u.status===200){this._requestLicenseFailureCount=0,w.logger.log("License request succeeded");var S=u.response,v=this._licenseResponseCallback;if(v)try{S=v.call(this.hls,u,a)}catch(D){w.logger.error(D)}c(S)}else{if(w.logger.error("License Request XHR failed ("+a+"). Status: "+u.status+" ("+u.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>k){this.hls.trigger(K.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var p=k-this._requestLicenseFailureCount+1;w.logger.warn("Retrying license request, "+p+" attempts left"),this._requestLicense(i,c)}break}},E._generateLicenseRequestChallenge=function(u,a){switch(u.mediaKeySystemDomain){case B.KeySystems.WIDEVINE:return a}throw new Error("unsupported key-system: "+u.mediaKeySystemDomain)},E._requestLicense=function(u,a){w.logger.log("Requesting content license for key-system");var i=this._mediaKeysList[0];if(!i){w.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var c=this.getLicenseServerUrl(i.mediaKeySystemDomain),S=this._createLicenseXhr(c,u,a);w.logger.log("Sending license request to URL: "+c);var v=this._generateLicenseRequestChallenge(i,u);S.send(v)}catch(p){w.logger.error("Failure requesting DRM license: "+p),this.hls.trigger(K.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},E.onMediaAttached=function(u,a){if(!this._emeEnabled)return;var i=a.media;this._media=i,i.addEventListener("encrypted",this._onMediaEncrypted)},E.onMediaDetached=function(){var u=this._media,a=this._mediaKeysList;if(!u)return;u.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(a.map(function(i){if(i.mediaKeysSession)return i.mediaKeysSession.close().catch(function(){})})).then(function(){return u.setMediaKeys(null)}).catch(function(){})},E.onManifestParsed=function(u,a){if(!this._emeEnabled)return;var i=a.levels.map(function(S){return S.audioCodec}).filter(function(S){return!!S}),c=a.levels.map(function(S){return S.videoCodec}).filter(function(S){return!!S});this._attemptKeySystemAccess(B.KeySystems.WIDEVINE,i,c)},A(_,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),_}();z.default=R},"./src/controller/fps-controller.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/events.ts"),I=L("./src/utils/logger.ts"),w=function(){function B(A){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=A,this.registerListeners()}var N=B.prototype;return N.setStreamController=function(k){this.streamController=k},N.registerListeners=function(){this.hls.on(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},N.unregisterListeners=function(){this.hls.off(K.Events.MEDIA_ATTACHING,this.onMediaAttaching)},N.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},N.onMediaAttaching=function(k,m){var O=this.hls.config;if(O.capLevelOnFPSDrop){var R=m.media instanceof self.HTMLVideoElement?m.media:null;this.media=R,R&&typeof R.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),O.fpsDroppedMonitoringPeriod)}},N.checkFPS=function(k,m,O){var R=performance.now();if(m){if(this.lastTime){var _=R-this.lastTime,E=O-this.lastDroppedFrames,g=m-this.lastDecodedFrames,u=1e3*E/_,a=this.hls;if(a.trigger(K.Events.FPS_DROP,{currentDropped:E,currentDecoded:g,totalDroppedFrames:O}),u>0&&E>a.config.fpsDroppedMonitoringThreshold*g){var i=a.currentLevel;I.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+i),i>0&&(a.autoLevelCapping===-1||a.autoLevelCapping>=i)&&(i=i-1,a.trigger(K.Events.FPS_DROP_LEVEL_CAPPING,{level:i,droppedLevel:a.currentLevel}),a.autoLevelCapping=i,this.streamController.nextLevelSwitch())}}this.lastTime=R,this.lastDroppedFrames=O,this.lastDecodedFrames=m}},N.checkFPSInterval=function(){var k=this.media;if(k)if(this.isVideoPlaybackQualityAvailable){var m=k.getVideoPlaybackQuality();this.checkFPS(k,m.totalVideoFrames,m.droppedVideoFrames)}else this.checkFPS(k,k.webkitDecodedFrameCount,k.webkitDroppedFrameCount)},B}();z.default=w},"./src/controller/fragment-finders.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"findFragmentByPDT",function(){return w}),L.d(z,"findFragmentByPTS",function(){return B}),L.d(z,"fragmentWithinToleranceTest",function(){return N}),L.d(z,"pdtWithinToleranceTest",function(){return A}),L.d(z,"findFragWithCC",function(){return k});var K=L("./src/polyfills/number.ts"),I=L("./src/utils/binary-search.ts");function w(m,O,R){if(O===null||!Array.isArray(m)||!m.length||!Object(K.isFiniteNumber)(O))return null;var _=m[0].programDateTime;if(O<(_||0))return null;var E=m[m.length-1].endProgramDateTime;if(O>=(E||0))return null;R=R||0;for(var g=0;g<m.length;++g){var u=m[g];if(A(O,R,u))return u}return null}function B(m,O,R,_){R===void 0&&(R=0),_===void 0&&(_=0);var E=null;if(m?E=O[m.sn-O[0].sn+1]||null:R===0&&O[0].start===0&&(E=O[0]),E&&N(R,_,E)===0)return E;var g=I.default.search(O,N.bind(null,R,_));return g||E}function N(m,O,R){m===void 0&&(m=0),O===void 0&&(O=0);var _=Math.min(O,R.duration+(R.deltaPTS?R.deltaPTS:0));return R.start+R.duration-_<=m?1:R.start-_>m&&R.start?-1:0}function A(m,O,R){var _=Math.min(O,R.duration+(R.deltaPTS?R.deltaPTS:0))*1e3,E=R.endProgramDateTime||0;return E-_>m}function k(m,O){return I.default.search(m,function(R){return R.cc<O?1:R.cc>O?-1:0})}},"./src/controller/fragment-tracker.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"FragmentState",function(){return w}),L.d(z,"FragmentTracker",function(){return B});var K=L("./src/events.ts"),I=L("./src/types/loader.ts"),w;(function(k){k.NOT_LOADED="NOT_LOADED",k.BACKTRACKED="BACKTRACKED",k.APPENDING="APPENDING",k.PARTIAL="PARTIAL",k.OK="OK"})(w||(w={}));var B=function(){function k(O){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=O,this._registerListeners()}var m=k.prototype;return m._registerListeners=function(){var R=this.hls;R.on(K.Events.BUFFER_APPENDED,this.onBufferAppended,this),R.on(K.Events.FRAG_BUFFERED,this.onFragBuffered,this),R.on(K.Events.FRAG_LOADED,this.onFragLoaded,this)},m._unregisterListeners=function(){var R=this.hls;R.off(K.Events.BUFFER_APPENDED,this.onBufferAppended,this),R.off(K.Events.FRAG_BUFFERED,this.onFragBuffered,this),R.off(K.Events.FRAG_LOADED,this.onFragLoaded,this)},m.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},m.getAppendedFrag=function(R,_){if(_===I.PlaylistLevelType.MAIN){var E=this.activeFragment,g=this.activeParts;if(!E)return null;if(g)for(var u=g.length;u--;){var a=g[u],i=a?a.end:E.appendedPTS;if(a.start<=R&&i!==void 0&&R<=i)return u>9&&(this.activeParts=g.slice(u-9)),a}else if(E.start<=R&&E.appendedPTS!==void 0&&R<=E.appendedPTS)return E}return this.getBufferedFrag(R,_)},m.getBufferedFrag=function(R,_){for(var E=this.fragments,g=Object.keys(E),u=g.length;u--;){var a=E[g[u]];if((a==null?void 0:a.body.type)===_&&a.buffered){var i=a.body;if(i.start<=R&&R<=i.end)return i}}return null},m.detectEvictedFragments=function(R,_,E){var g=this;Object.keys(this.fragments).forEach(function(u){var a=g.fragments[u];if(!a)return;if(!a.buffered){a.body.type===E&&g.removeFragment(a.body);return}var i=a.range[R];if(!i)return;i.time.some(function(c){var S=!g.isTimeBuffered(c.startPTS,c.endPTS,_);return S&&g.removeFragment(a.body),S})})},m.detectPartialFragments=function(R){var _=this,E=this.timeRanges,g=R.frag,u=R.part;if(!E||g.sn==="initSegment")return;var a=A(g),i=this.fragments[a];if(!i)return;Object.keys(E).forEach(function(c){var S=g.elementaryStreams[c];if(!S)return;var v=E[c],p=u!==null||S.partial===!0;i.range[c]=_.getBufferedTimes(g,u,p,v)}),i.backtrack=i.loaded=null,Object.keys(i.range).length?i.buffered=!0:this.removeFragment(i.body)},m.fragBuffered=function(R){var _=A(R),E=this.fragments[_];E&&(E.backtrack=E.loaded=null,E.buffered=!0)},m.getBufferedTimes=function(R,_,E,g){for(var u={time:[],partial:E},a=_?_.start:R.start,i=_?_.end:R.end,c=R.minEndPTS||i,S=R.maxStartPTS||a,v=0;v<g.length;v++){var p=g.start(v)-this.bufferPadding,D=g.end(v)+this.bufferPadding;if(S>=p&&c<=D){u.time.push({startPTS:Math.max(a,g.start(v)),endPTS:Math.min(i,g.end(v))});break}else if(a<D&&i>p)u.partial=!0,u.time.push({startPTS:Math.max(a,g.start(v)),endPTS:Math.min(i,g.end(v))});else if(i<=p)break}return u},m.getPartialFragment=function(R){var _=null,E,g,u,a=0,i=this.bufferPadding,c=this.fragments;return Object.keys(c).forEach(function(S){var v=c[S];if(!v)return;N(v)&&(g=v.body.start-i,u=v.body.end+i,R>=g&&R<=u&&(E=Math.min(R-g,u-R),a<=E&&(_=v.body,a=E)))}),_},m.getState=function(R){var _=A(R),E=this.fragments[_];return E?E.buffered?N(E)?w.PARTIAL:w.OK:E.backtrack?w.BACKTRACKED:w.APPENDING:w.NOT_LOADED},m.backtrack=function(R,_){var E=A(R),g=this.fragments[E];if(!g||g.backtrack)return null;var u=g.backtrack=_||g.loaded;return g.loaded=null,u},m.getBacktrackData=function(R){var _=A(R),E=this.fragments[_];if(E){var g,u=E.backtrack;if(u!=null&&(g=u.payload)!==null&&g!==void 0&&g.byteLength)return u;this.removeFragment(R)}return null},m.isTimeBuffered=function(R,_,E){for(var g,u,a=0;a<E.length;a++){if(g=E.start(a)-this.bufferPadding,u=E.end(a)+this.bufferPadding,R>=g&&_<=u)return!0;if(_<=g)return!1}return!1},m.onFragLoaded=function(R,_){var E=_.frag,g=_.part;if(E.sn==="initSegment"||E.bitrateTest||g)return;var u=A(E);this.fragments[u]={body:E,loaded:_,backtrack:null,buffered:!1,range:Object.create(null)}},m.onBufferAppended=function(R,_){var E=this,g=_.frag,u=_.part,a=_.timeRanges;if(g.type===I.PlaylistLevelType.MAIN)if(this.activeFragment=g,u){var i=this.activeParts;i||(this.activeParts=i=[]),i.push(u)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach(function(c){var S=a[c];if(E.detectEvictedFragments(c,S),!u)for(var v=0;v<S.length;v++)g.appendedPTS=Math.max(S.end(v),g.appendedPTS||0)})},m.onFragBuffered=function(R,_){this.detectPartialFragments(_)},m.hasFragment=function(R){var _=A(R);return!!this.fragments[_]},m.removeFragmentsInRange=function(R,_,E){var g=this;Object.keys(this.fragments).forEach(function(u){var a=g.fragments[u];if(!a)return;if(a.buffered){var i=a.body;i.type===E&&i.start<_&&i.end>R&&g.removeFragment(i)}})},m.removeFragment=function(R){var _=A(R);R.stats.loaded=0,R.clearElementaryStreamInfo(),delete this.fragments[_]},m.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},k}();function N(k){var m,O;return k.buffered&&(((m=k.range.video)===null||m===void 0?void 0:m.partial)||((O=k.range.audio)===null||O===void 0?void 0:O.partial))}function A(k){return k.type+"_"+k.level+"_"+k.urlId+"_"+k.sn}},"./src/controller/gap-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"STALL_MINIMUM_DURATION_MS",function(){return N}),L.d(z,"MAX_START_GAP_JUMP",function(){return A}),L.d(z,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return k}),L.d(z,"SKIP_BUFFER_RANGE_START",function(){return m}),L.d(z,"default",function(){return O});var K=L("./src/utils/buffer-helper.ts"),I=L("./src/errors.ts"),w=L("./src/events.ts"),B=L("./src/utils/logger.ts"),N=250,A=2,k=.1,m=.05,O=function(){function R(E,g,u,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=E,this.media=g,this.fragmentTracker=u,this.hls=a}var _=R.prototype;return _.destroy=function(){this.hls=this.fragmentTracker=this.media=null},_.poll=function(g){var u=this.config,a=this.media,i=this.stalled,c=a.currentTime,S=a.seeking,v=this.seeking&&!S,p=!this.seeking&&S;if(this.seeking=S,c!==g){if(this.moved=!0,i!==null){if(this.stallReported){var D=self.performance.now()-i;B.logger.warn("playback not stuck anymore @"+c+", after "+Math.round(D)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((p||v)&&(this.stalled=null),a.paused||a.ended||a.playbackRate===0||!K.BufferHelper.getBuffered(a).length)return;var b=K.BufferHelper.bufferInfo(a,c,0),h=b.len>0,d=b.nextStart||0;if(!h&&!d)return;if(S){var o=b.len>A,s=!d||d-c>A&&!this.fragmentTracker.getPartialFragment(c);if(o||s)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var C,y=Math.max(d,b.start||0)-c,x=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,P=x==null||((C=x.details)===null||C===void 0)?void 0:C.live,j=P?x.details.targetduration*2:A;if(y>0&&y<=j){this._trySkipBufferHole(null);return}}var Y=self.performance.now();if(i===null){this.stalled=Y;return}var Q=Y-i;!S&&Q>=N&&this._reportStall(b.len);var X=K.BufferHelper.bufferInfo(a,c,u.maxBufferHole);this._tryFixBufferStall(X,Q)},_._tryFixBufferStall=function(g,u){var a=this.config,i=this.fragmentTracker,c=this.media,S=c.currentTime,v=i.getPartialFragment(S);if(v){var p=this._trySkipBufferHole(v);if(p)return}g.len>a.maxBufferHole&&u>a.highBufferWatchdogPeriod*1e3&&(B.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},_._reportStall=function(g){var u=this.hls,a=this.media,i=this.stallReported;i||(this.stallReported=!0,B.logger.warn("Playback stalling at @"+a.currentTime+" due to low buffer (buffer="+g+")"),u.trigger(w.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:g}))},_._trySkipBufferHole=function(g){for(var u=this.config,a=this.hls,i=this.media,c=i.currentTime,S=0,v=K.BufferHelper.getBuffered(i),p=0;p<v.length;p++){var D=v.start(p);if(c+u.maxBufferHole>=S&&c<D){var b=Math.max(D+m,i.currentTime+k);return B.logger.warn("skipping hole, adjusting currentTime from "+c+" to "+b),this.moved=!0,this.stalled=null,i.currentTime=b,g&&a.trigger(w.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+c+" to "+b,frag:g}),b}S=v.end(p)}return 0},_._tryNudgeBuffer=function(){var g=this.config,u=this.hls,a=this.media,i=a.currentTime,c=(this.nudgeRetry||0)+1;if(this.nudgeRetry=c,c<g.nudgeMaxRetry){var S=i+c*g.nudgeOffset;B.logger.warn("Nudging 'currentTime' from "+i+" to "+S),a.currentTime=S,u.trigger(w.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else B.logger.error("Playhead still not moving while enough data buffered @"+i+" after "+g.nudgeMaxRetry+" nudges"),u.trigger(w.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},R}()},"./src/controller/id3-track-controller.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/events.ts"),I=L("./src/utils/texttrack-utils.ts"),w=L("./src/demux/id3.ts"),B=.25,N=function(){function A(m){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=m,this._registerListeners()}var k=A.prototype;return k.destroy=function(){this._unregisterListeners()},k._registerListeners=function(){var O=this.hls;O.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),O.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),O.on(K.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),O.on(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},k._unregisterListeners=function(){var O=this.hls;O.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),O.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),O.off(K.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),O.off(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},k.onMediaAttached=function(O,R){this.media=R.media},k.onMediaDetaching=function(){if(!this.id3Track)return;Object(I.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},k.getID3Track=function(O){if(!this.media)return;for(var R=0;R<O.length;R++){var _=O[R];if(_.kind==="metadata"&&_.label==="id3")return Object(I.sendAddTrackEvent)(_,this.media),_}return this.media.addTextTrack("metadata","id3")},k.onFragParsingMetadata=function(O,R){if(!this.media)return;var _=R.frag,E=R.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var g=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,u=0;u<E.length;u++){var a=w.getID3Frames(E[u].data);if(a){var i=E[u].pts,c=u<E.length-1?E[u+1].pts:_.end,S=c-i;S<=0&&(c=i+B);for(var v=0;v<a.length;v++){var p=a[v];if(!w.isTimeStampFrame(p)){var D=new g(i,c,"");D.value=p,this.id3Track.addCue(D)}}}}},k.onBufferFlushing=function(O,R){var _=R.startOffset,E=R.endOffset,g=R.type;if(!g||g==="audio"){var u=this.id3Track;u&&Object(I.removeCuesInRange)(u,_,E)}},A}();z.default=N},"./src/controller/latency-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return A});var K=L("./src/errors.ts"),I=L("./src/events.ts"),w=L("./src/utils/logger.ts");function B(k,m){for(var O=0;O<m.length;O++){var R=m[O];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(k,R.key,R)}}function N(k,m,O){return m&&B(k.prototype,m),O&&B(k,O),k}var A=function(){function k(O){var R=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 R.timeupdate()},this.hls=O,this.config=O.config,this.registerListeners()}var m=k.prototype;return m.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},m.registerListeners=function(){this.hls.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(I.Events.ERROR,this.onError,this)},m.unregisterListeners=function(){this.hls.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(I.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(I.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(I.Events.ERROR,this.onError)},m.onMediaAttached=function(R,_){this.media=_.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},m.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},m.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},m.onLevelUpdated=function(R,_){var E=_.details;this.levelDetails=E,E.advanced&&this.timeupdate(),!E.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},m.onError=function(R,_){if(_.details!==K.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,w.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},m.timeupdate=function(){var R=this.media,_=this.levelDetails;if(!R||!_)return;this.currentTime=R.currentTime;var E=this.computeLatency();if(E===null)return;this._latency=E;var g=this.config,u=g.lowLatencyMode,a=g.maxLiveSyncPlaybackRate;if(!u||a===1)return;var i=this.targetLatency;if(i===null)return;var c=E-i,S=Math.min(this.maxLatency,i+_.targetduration),v=c<S;if(_.live&&v&&c>.05&&this.forwardBufferLength>1){var p=Math.min(2,Math.max(1,a)),D=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20;R.playbackRate=Math.min(p,Math.max(1,D))}else R.playbackRate!==1&&R.playbackRate!==0&&(R.playbackRate=1)},m.estimateLiveEdge=function(){var R=this.levelDetails;return R===null?null:R.edge+R.age},m.computeLatency=function(){var R=this.estimateLiveEdge();return R===null?null:R-this.currentTime},N(k,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var R=this.config,_=this.levelDetails;return R.liveMaxLatencyDuration!==void 0?R.liveMaxLatencyDuration:_?R.liveMaxLatencyDurationCount*_.targetduration:0}},{key:"targetLatency",get:function(){var R=this.levelDetails;if(R===null)return null;var _=R.holdBack,E=R.partHoldBack,g=R.targetduration,u=this.config,a=u.liveSyncDuration,i=u.liveSyncDurationCount,c=u.lowLatencyMode,S=this.hls.userConfig,v=c&&E||_;(S.liveSyncDuration||S.liveSyncDurationCount||v===0)&&(v=a!==void 0?a:i*g);var p=g,D=1;return v+Math.min(this.stallCount*D,p)}},{key:"liveSyncPosition",get:function(){var R=this.estimateLiveEdge(),_=this.targetLatency,E=this.levelDetails;if(R===null||_===null||E===null)return null;var g=E.edge,u=R-_-this.edgeStalled,a=g-E.totalduration,i=g-(this.config.lowLatencyMode&&E.partTarget||E.targetduration);return Math.min(Math.max(a,u),i)}},{key:"drift",get:function(){var R=this.levelDetails;return R===null?1:R.drift}},{key:"edgeStalled",get:function(){var R=this.levelDetails;if(R===null)return 0;var _=(this.config.lowLatencyMode&&R.partTarget||R.targetduration)*3;return Math.max(R.age-_,0)}},{key:"forwardBufferLength",get:function(){var R=this.media,_=this.levelDetails;if(!R||!_)return 0;var E=R.buffered.length;return E?R.buffered.end(E-1):_.edge-this.currentTime}}]),k}()},"./src/controller/level-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return u});var K=L("./src/types/level.ts"),I=L("./src/events.ts"),w=L("./src/errors.ts"),B=L("./src/utils/codecs.ts"),N=L("./src/controller/level-helper.ts"),A=L("./src/controller/base-playlist-controller.ts"),k=L("./src/types/loader.ts");function m(){return m=Object.assign||function(a){for(var i=1;i<arguments.length;i++){var c=arguments[i];for(var S in c)Object.prototype.hasOwnProperty.call(c,S)&&(a[S]=c[S])}return a},m.apply(this,arguments)}function O(a,i){for(var c=0;c<i.length;c++){var S=i[c];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(a,S.key,S)}}function R(a,i,c){return i&&O(a.prototype,i),c&&O(a,c),a}function _(a,i){a.prototype=Object.create(i.prototype),a.prototype.constructor=a,E(a,i)}function E(a,i){return E=Object.setPrototypeOf||function(S,v){return S.__proto__=v,S},E(a,i)}var g=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),u=function(a){_(i,a);function i(S){var v;return v=a.call(this,S,"[level-controller]")||this,v._levels=[],v._firstLevel=-1,v._startLevel=void 0,v.currentLevelIndex=-1,v.manualLevelIndex=-1,v.onParsedComplete=void 0,v._registerListeners(),v}var c=i.prototype;return c._registerListeners=function(){var v=this.hls;v.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.on(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),v.on(I.Events.ERROR,this.onError,this)},c._unregisterListeners=function(){var v=this.hls;v.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.off(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),v.off(I.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 v=this._levels;v.forEach(function(p){p.loadError=0}),a.prototype.startLoad.call(this)},c.onManifestLoaded=function(v,p){var D=[],b=[],h=[],d,o={},s,C=!1,y=!1,x=!1;if(p.levels.forEach(function(Q){var X=Q.attrs;C=C||!!(Q.width&&Q.height),y=y||!!Q.videoCodec,x=x||!!Q.audioCodec,g&&Q.audioCodec&&Q.audioCodec.indexOf("mp4a.40.34")!==-1&&(Q.audioCodec=void 0);var F=Q.bitrate+"-"+Q.attrs.RESOLUTION+"-"+Q.attrs.CODECS;s=o[F],s?s.url.push(Q.url):(s=new K.Level(Q),o[F]=s,D.push(s)),X&&(X.AUDIO&&Object(N.addGroupId)(s,"audio",X.AUDIO),X.SUBTITLES&&Object(N.addGroupId)(s,"text",X.SUBTITLES))}),(C||y)&&x&&(D=D.filter(function(Q){var X=Q.videoCodec,F=Q.width,$=Q.height;return!!X||!!(F&&$)})),D=D.filter(function(Q){var X=Q.audioCodec,F=Q.videoCodec;return(!X||Object(B.isCodecSupportedInMp4)(X,"audio"))&&(!F||Object(B.isCodecSupportedInMp4)(F,"video"))}),p.audioTracks&&(b=p.audioTracks.filter(function(Q){return!Q.audioCodec||Object(B.isCodecSupportedInMp4)(Q.audioCodec,"audio")}),Object(N.assignTrackIdsByGroup)(b)),p.subtitles&&(h=p.subtitles,Object(N.assignTrackIdsByGroup)(h)),D.length>0){d=D[0].bitrate,D.sort(function(Q,X){return Q.bitrate-X.bitrate}),this._levels=D;for(var P=0;P<D.length;P++)if(D[P].bitrate===d){this._firstLevel=P,this.log("manifest loaded, "+D.length+" level(s) found, first bitrate: "+d);break}var j=x&&!y,Y={levels:D,audioTracks:b,subtitleTracks:h,firstLevel:this._firstLevel,stats:p.stats,audio:x,video:y,altAudio:!j&&b.some(function(Q){return!!Q.url})};this.hls.trigger(I.Events.MANIFEST_PARSED,Y),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(I.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:p.url,reason:"no level with compatible codecs found in manifest"})},c.onError=function(v,p){if(a.prototype.onError.call(this,v,p),p.fatal)return;var D=p.context,b=this._levels[this.currentLevelIndex];if(D&&(D.type===k.PlaylistContextType.AUDIO_TRACK&&b.audioGroupIds&&D.groupId===b.audioGroupIds[b.urlId]||D.type===k.PlaylistContextType.SUBTITLE_TRACK&&b.textGroupIds&&D.groupId===b.textGroupIds[b.urlId])){this.redundantFailover(this.currentLevelIndex);return}var h=!1,d=!0,o;switch(p.details){case w.ErrorDetails.FRAG_LOAD_ERROR:case w.ErrorDetails.FRAG_LOAD_TIMEOUT:case w.ErrorDetails.KEY_LOAD_ERROR:case w.ErrorDetails.KEY_LOAD_TIMEOUT:if(p.frag){var s=this._levels[p.frag.level];s?(s.fragmentError++,s.fragmentError>this.hls.config.fragLoadingMaxRetry&&(o=p.frag.level)):o=p.frag.level}break;case w.ErrorDetails.LEVEL_LOAD_ERROR:case w.ErrorDetails.LEVEL_LOAD_TIMEOUT:D&&(D.deliveryDirectives&&(d=!1),o=D.level),h=!0;break;case w.ErrorDetails.REMUX_ALLOC_ERROR:o=p.level,h=!0;break}o!==void 0&&this.recoverLevel(p,o,h,d)},c.recoverLevel=function(v,p,D,b){var h=v.details,d=this._levels[p];if(d.loadError++,D){var o=this.retryLoadingOrFail(v);if(o)v.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(b){var s=d.url.length;if(s>1&&d.loadError<s)v.levelRetry=!0,this.redundantFailover(p);else if(this.manualLevelIndex===-1){var C=p===0?this._levels.length-1:p-1;this.currentLevelIndex!==C&&this._levels[C].loadError===0&&(this.warn(h+": switch to "+C),v.levelRetry=!0,this.hls.nextAutoLevel=C)}}},c.redundantFailover=function(v){var p=this._levels[v],D=p.url.length;if(D>1){var b=(p.urlId+1)%D;this.warn("Switching to redundant URL-id "+b),this._levels.forEach(function(h){h.urlId=b}),this.level=v}},c.onFragLoaded=function(v,p){var D=p.frag;if(D!==void 0&&D.type===k.PlaylistLevelType.MAIN){var b=this._levels[D.level];b!==void 0&&(b.fragmentError=0,b.loadError=0)}},c.onLevelLoaded=function(v,p){var D,b=p.level,h=p.details,d=this._levels[b];if(!d){var o;this.warn("Invalid level index "+b),(o=p.deliveryDirectives)!==null&&o!==void 0&&o.skip&&(h.deltaUpdateFailed=!0);return}b===this.currentLevelIndex?(d.fragmentError===0&&(d.loadError=0,this.retryCount=0),this.playlistLoaded(b,p,d.details)):(D=p.deliveryDirectives)!==null&&D!==void 0&&D.skip&&(h.deltaUpdateFailed=!0)},c.onAudioTrackSwitched=function(v,p){var D=this.hls.levels[this.currentLevelIndex];if(!D)return;if(D.audioGroupIds){for(var b=-1,h=this.hls.audioTracks[p.id].groupId,d=0;d<D.audioGroupIds.length;d++)if(D.audioGroupIds[d]===h){b=d;break}b!==D.urlId&&(D.urlId=b,this.startLoad())}},c.loadPlaylist=function(v){var p=this.currentLevelIndex,D=this._levels[p];if(this.canLoad&&D&&D.url.length>0){var b=D.urlId,h=D.url[b];if(v)try{h=v.addDirectives(h)}catch(d){this.warn("Could not construct new URL with HLS Delivery Directives: "+d)}this.log("Attempt loading level index "+p+(v?" at sn "+v.msn+" part "+v.part:"")+" with URL-id "+b+" "+h),this.clearTimer(),this.hls.trigger(I.Events.LEVEL_LOADING,{url:h,level:p,id:b,deliveryDirectives:v||null})}},c.removeLevel=function(v,p){var D=function(d,o){return o!==p},b=this._levels.filter(function(h,d){return d!==v?!0:h.url.length>1&&p!==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=b,this.hls.trigger(I.Events.LEVELS_UPDATED,{levels:b})},R(i,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(v){var p,D=this._levels;if(D.length===0)return;if(this.currentLevelIndex===v&&(p=D[v])!==null&&p!==void 0&&p.details)return;if(v<0||v>=D.length){var b=v<0;if(this.hls.trigger(I.Events.ERROR,{type:w.ErrorTypes.OTHER_ERROR,details:w.ErrorDetails.LEVEL_SWITCH_ERROR,level:v,fatal:b,reason:"invalid level idx"}),b)return;v=Math.min(v,D.length-1)}this.clearTimer();var h=this.currentLevelIndex,d=D[h],o=D[v];this.log("switching to level "+v+" from "+h),this.currentLevelIndex=v;var s=m({},o,{level:v,maxBitrate:o.maxBitrate,uri:o.uri,urlId:o.urlId});delete s._urlId,this.hls.trigger(I.Events.LEVEL_SWITCHING,s);var C=o.details;if(!C||C.live){var y=this.switchParams(o.uri,d==null?void 0:d.details);this.loadPlaylist(y)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(v){this.manualLevelIndex=v,this._startLevel===void 0&&(this._startLevel=v),v!==-1&&(this.level=v)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(v){this._firstLevel=v}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var v=this.hls.config.startLevel;return v!==void 0?v:this._firstLevel}else return this._startLevel},set:function(v){this._startLevel=v}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(v){this.level=v,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=v)}}]),i}(A.default)},"./src/controller/level-helper.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"addGroupId",function(){return w}),L.d(z,"assignTrackIdsByGroup",function(){return B}),L.d(z,"updatePTS",function(){return N}),L.d(z,"updateFragPTSDTS",function(){return k}),L.d(z,"mergeDetails",function(){return m}),L.d(z,"mapPartIntersection",function(){return O}),L.d(z,"mapFragmentIntersection",function(){return R}),L.d(z,"adjustSliding",function(){return _}),L.d(z,"addSliding",function(){return E}),L.d(z,"computeReloadInterval",function(){return g}),L.d(z,"getFragmentWithSN",function(){return u}),L.d(z,"getPartWith",function(){return a});var K=L("./src/polyfills/number.ts"),I=L("./src/utils/logger.ts");function w(i,c,S){switch(c){case"audio":i.audioGroupIds||(i.audioGroupIds=[]),i.audioGroupIds.push(S);break;case"text":i.textGroupIds||(i.textGroupIds=[]),i.textGroupIds.push(S);break}}function B(i){var c={};i.forEach(function(S){var v=S.groupId||"";S.id=c[v]=c[v]||0,c[v]++})}function N(i,c,S){var v=i[c],p=i[S];A(v,p)}function A(i,c){var S=c.startPTS;if(Object(K.isFiniteNumber)(S)){var v=0,p;c.sn>i.sn?(v=S-i.start,p=i):(v=i.start-S,p=c),p.duration!==v&&(p.duration=v)}else if(c.sn>i.sn){var D=i.cc===c.cc;D&&i.minEndPTS?c.start=i.start+(i.minEndPTS-i.start):c.start=i.start+i.duration}else c.start=Math.max(i.start-c.duration,0)}function k(i,c,S,v,p,D){var b=v-S;b<=0&&(I.logger.warn("Fragment should have a positive duration",c),v=S+c.duration,D=p+c.duration);var h=S,d=v,o=c.startPTS,s=c.endPTS;if(Object(K.isFiniteNumber)(o)){var C=Math.abs(o-S);Object(K.isFiniteNumber)(c.deltaPTS)?c.deltaPTS=Math.max(C,c.deltaPTS):c.deltaPTS=C,h=Math.max(S,o),S=Math.min(S,o),p=Math.min(p,c.startDTS),d=Math.min(v,s),v=Math.max(v,s),D=Math.max(D,c.endDTS)}c.duration=v-S;var y=S-c.start;c.appendedPTS=v,c.start=c.startPTS=S,c.maxStartPTS=h,c.startDTS=p,c.endPTS=v,c.minEndPTS=d,c.endDTS=D;var x=c.sn;if(!i||x<i.startSN||x>i.endSN)return 0;var P,j=x-i.startSN,Y=i.fragments;for(Y[j]=c,P=j;P>0;P--)A(Y[P],Y[P-1]);for(P=j;P<Y.length-1;P++)A(Y[P],Y[P+1]);return i.fragmentHint&&A(Y[Y.length-1],i.fragmentHint),i.PTSKnown=i.alignedSliding=!0,y}function m(i,c){for(var S=null,v=i.fragments,p=v.length-1;p>=0;p--){var D=v[p].initSegment;if(D){S=D;break}}i.fragmentHint&&delete i.fragmentHint.endPTS;var b=0,h;if(R(i,c,function(P,j){P.relurl&&(b=P.cc-j.cc),Object(K.isFiniteNumber)(P.startPTS)&&Object(K.isFiniteNumber)(P.endPTS)&&(j.start=j.startPTS=P.startPTS,j.startDTS=P.startDTS,j.appendedPTS=P.appendedPTS,j.maxStartPTS=P.maxStartPTS,j.endPTS=P.endPTS,j.endDTS=P.endDTS,j.minEndPTS=P.minEndPTS,j.duration=P.endPTS-P.startPTS,j.duration&&(h=j),c.PTSKnown=c.alignedSliding=!0),j.elementaryStreams=P.elementaryStreams,j.loader=P.loader,j.stats=P.stats,j.urlId=P.urlId,P.initSegment&&(j.initSegment=P.initSegment,S=P.initSegment)}),S){var d=c.fragmentHint?c.fragments.concat(c.fragmentHint):c.fragments;d.forEach(function(P){var j;(!P.initSegment||P.initSegment.relurl===((j=S)===null||j===void 0?void 0:j.relurl))&&(P.initSegment=S)})}if(c.skippedSegments&&(c.deltaUpdateFailed=c.fragments.some(function(P){return!P}),c.deltaUpdateFailed)){I.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(b){I.logger.warn("discontinuity sliding from playlist, take drift into account");for(var C=0;C<s.length;C++)s[C].cc+=b}c.skippedSegments&&(c.startCC=c.fragments[0].cc),O(i.partList,c.partList,function(P,j){j.elementaryStreams=P.elementaryStreams,j.stats=P.stats}),h?k(c,h,h.startPTS,h.endPTS,h.startDTS,h.endDTS):_(i,c),s.length&&(c.totalduration=c.edge-s[0].start),c.driftStartTime=i.driftStartTime,c.driftStart=i.driftStart;var y=c.advancedDateTime;if(c.advanced&&y){var x=c.edge;c.driftStart||(c.driftStartTime=y,c.driftStart=x),c.driftEndTime=y,c.driftEnd=x}else c.driftEndTime=i.driftEndTime,c.driftEnd=i.driftEnd,c.advancedDateTime=i.advancedDateTime}function O(i,c,S){if(i&&c)for(var v=0,p=0,D=i.length;p<=D;p++){var b=i[p],h=c[p+v];b&&h&&b.index===h.index&&b.fragment.sn===h.fragment.sn?S(b,h):v--}}function R(i,c,S){for(var v=c.skippedSegments,p=Math.max(i.startSN,c.startSN)-c.startSN,D=(i.fragmentHint?1:0)+(v?c.endSN:Math.min(i.endSN,c.endSN))-c.startSN,b=c.startSN-i.startSN,h=c.fragmentHint?c.fragments.concat(c.fragmentHint):c.fragments,d=i.fragmentHint?i.fragments.concat(i.fragmentHint):i.fragments,o=p;o<=D;o++){var s=d[b+o],C=h[o];v&&!C&&o<v&&(C=c.fragments[o]=s),s&&C&&S(s,C)}}function _(i,c){var S=c.startSN+c.skippedSegments-i.startSN,v=i.fragments;if(S<0||S>=v.length)return;E(c,v[S].start)}function E(i,c){if(c){for(var S=i.fragments,v=i.skippedSegments;v<S.length;v++)S[v].start+=c;i.fragmentHint&&(i.fragmentHint.start+=c)}}function g(i,c){var S=1e3*i.levelTargetDuration,v=S/2,p=i.age,D=p>0&&p<S*3,b=c.loading.end-c.loading.start,h,d=i.availabilityDelay;if(i.updated===!1)if(D){var o=333*i.misses;h=Math.max(Math.min(v,b*2),o),i.availabilityDelay=(i.availabilityDelay||0)+h}else h=v;else D?(d=Math.min(d||S/2,p),i.availabilityDelay=d,h=d+S-p):h=S-b;return Math.round(h)}function u(i,c,S){if(!i||!i.details)return null;var v=i.details,p=v.fragments[c-v.startSN];return p||(p=v.fragmentHint,p&&p.sn===c?p:c<v.startSN&&S&&S.sn===c?S:null)}function a(i,c,S){if(!i||!i.details)return null;var v=i.details.partList;if(v)for(var p=v.length;p--;){var D=v[p];if(D.index===S&&D.fragment.sn===c)return D}return null}},"./src/controller/stream-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return v});var K=L("./src/polyfills/number.ts"),I=L("./src/controller/base-stream-controller.ts"),w=L("./src/is-supported.ts"),B=L("./src/events.ts"),N=L("./src/utils/buffer-helper.ts"),A=L("./src/controller/fragment-tracker.ts"),k=L("./src/types/loader.ts"),m=L("./src/loader/fragment.ts"),O=L("./src/demux/transmuxer-interface.ts"),R=L("./src/types/transmuxer.ts"),_=L("./src/controller/gap-controller.ts"),E=L("./src/errors.ts"),g=L("./src/utils/logger.ts");function u(p,D){for(var b=0;b<D.length;b++){var h=D[b];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(p,h.key,h)}}function a(p,D,b){return D&&u(p.prototype,D),b&&u(p,b),p}function i(p,D){p.prototype=Object.create(D.prototype),p.prototype.constructor=p,c(p,D)}function c(p,D){return c=Object.setPrototypeOf||function(h,d){return h.__proto__=d,h},c(p,D)}var S=100,v=function(p){i(D,p);function D(h,d){var o;return o=p.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 b=D.prototype;return b._registerListeners=function(){var d=this.hls;d.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),d.on(B.Events.ERROR,this.onError,this),d.on(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.on(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),d.on(B.Events.BUFFER_CREATED,this.onBufferCreated,this),d.on(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.on(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),d.on(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b._unregisterListeners=function(){var d=this.hls;d.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),d.off(B.Events.ERROR,this.onError,this),d.off(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.off(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),d.off(B.Events.BUFFER_CREATED,this.onBufferCreated,this),d.off(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.off(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),d.off(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},b.startLoad=function(d){if(this.levels){var o=this.lastCurrentTime,s=this.hls;if(this.stopLoad(),this.setInterval(S),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var C=s.startLevel;C===-1&&(s.config.testBandwidth?(C=0,this.bitrateTest=!0):C=s.nextAutoLevel),this.level=s.nextLoadLevel=C,this.loadedmetadata=!1}o>0&&d===-1&&(this.log("Override startPosition with lastCurrentTime @"+o.toFixed(3)),d=o),this.state=I.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=d,this.tick()}else this._forceStartLoad=!0,this.state=I.State.STOPPED},b.stopLoad=function(){this._forceStartLoad=!1,p.prototype.stopLoad.call(this)},b.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_LEVEL:{var d,o=this.levels,s=this.level,C=o==null||((d=o[s])===null||d===void 0)?void 0:d.details;if(C&&(!C.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(C))break;this.state=I.State.IDLE;break}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var y,x=self.performance.now(),P=this.retryDate;(!P||x>=P||(y=this.media)!==null&&y!==void 0&&y.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=I.State.IDLE)}break;default:break}this.onTickEnd()},b.onTickEnd=function(){p.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},b.doTickIdle=function(){var d,o,s=this.hls,C=this.levelLastLoaded,y=this.levels,x=this.media,P=s.config,j=s.nextLoadLevel;if(C===null||!x&&(this.startFragRequested||!P.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!y||!y[j])return;var Y=y[j];this.level=s.nextLoadLevel=j;var Q=Y.details;if(!Q||this.state===I.State.WAITING_LEVEL||Q.live&&this.levelLastLoaded!==j){this.state=I.State.WAITING_LEVEL;return}var X=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:x,k.PlaylistLevelType.MAIN);if(X===null)return;var F=X.len,$=this.getMaxBufferLength(Y.maxBitrate);if(F>=$)return;if(this._streamEnded(X,Q)){var re={};this.altAudio&&(re.type="video"),this.hls.trigger(B.Events.BUFFER_EOS,re),this.state=I.State.ENDED;return}var se=X.end,he=this.getNextFragment(se,Q);if(this.couldBacktrack&&!this.fragPrevious&&he&&he.sn!=="initSegment"){var _e=he.sn-Q.startSN;_e>1&&(he=Q.fragments[_e-1],this.fragmentTracker.removeFragment(he))}if(he&&this.fragmentTracker.getState(he)===A.FragmentState.OK&&this.nextLoadPosition>se){var xe=this.audioOnly&&!this.altAudio?m.ElementaryStreamTypes.AUDIO:m.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(x,xe,k.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,se)},b.loadFragment=function(d,o,s){var C,y=this.fragmentTracker.getState(d);if(this.fragCurrent=d,y===A.FragmentState.BACKTRACKED){var x=this.fragmentTracker.getBacktrackData(d);if(x){this._handleFragmentLoadProgress(x),this._handleFragmentLoadComplete(x);return}else y=A.FragmentState.NOT_LOADED}y===A.FragmentState.NOT_LOADED||y===A.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,p.prototype.loadFragment.call(this,d,o,s)):y===A.FragmentState.APPENDING?this.reduceMaxBufferLength(d.duration)&&this.fragmentTracker.removeFragment(d):((C=this.media)===null||C===void 0?void 0:C.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},b.getAppendedFrag=function(d){var o=this.fragmentTracker.getAppendedFrag(d,k.PlaylistLevelType.MAIN);return o&&"fragment"in o?o.fragment:o},b.getBufferedFrag=function(d){return this.fragmentTracker.getBufferedFrag(d,k.PlaylistLevelType.MAIN)},b.followingBufferedFrag=function(d){return d?this.getBufferedFrag(d.end+.5):null},b.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},b.nextLevelSwitch=function(){var d=this.levels,o=this.media;if(o!=null&&o.readyState){var s,C=this.getAppendedFrag(o.currentTime);if(C&&C.start>1&&this.flushMainBuffer(0,C.start-1),!o.paused&&d){var y=this.hls.nextLoadLevel,x=d[y],P=this.fragLastKbps;P&&this.fragCurrent?s=this.fragCurrent.duration*x.maxBitrate/(1e3*P)+1:s=0}else s=0;var j=this.getBufferedFrag(o.currentTime+s);if(j){var Y=this.followingBufferedFrag(j);if(Y){this.abortCurrentFrag();var Q=Y.maxStartPTS?Y.maxStartPTS:Y.start,X=Y.duration,F=Math.max(j.end,Q+Math.min(Math.max(X-this.config.maxFragLookUpTolerance,X*.5),X*.75));this.flushMainBuffer(F,Number.POSITIVE_INFINITY)}}}},b.abortCurrentFrag=function(){var d=this.fragCurrent;this.fragCurrent=null,d!=null&&d.loader&&d.loader.abort(),this.state===I.State.KEY_LOADING&&(this.state=I.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},b.flushMainBuffer=function(d,o){p.prototype.flushMainBuffer.call(this,d,o,this.altAudio?"video":null)},b.onMediaAttached=function(d,o){p.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 _.default(this.config,s,this.fragmentTracker,this.hls)},b.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),p.prototype.onMediaDetaching.call(this)},b.onMediaPlaying=function(){this.tick()},b.onMediaSeeked=function(){var d=this.media,o=d?d.currentTime:null;Object(K.isFiniteNumber)(o)&&this.log("Media seeked to "+o.toFixed(3)),this.tick()},b.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(B.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},b.onManifestParsed=function(d,o){var s=!1,C=!1,y;o.levels.forEach(function(x){y=x.audioCodec,y&&(y.indexOf("mp4a.40.2")!==-1&&(s=!0),y.indexOf("mp4a.40.5")!==-1&&(C=!0))}),this.audioCodecSwitch=s&&C&&!Object(w.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},b.onLevelLoading=function(d,o){var s=this.levels;if(!s||this.state!==I.State.IDLE)return;var C=s[o.level];(!C.details||C.details.live&&this.levelLastLoaded!==o.level||this.waitForCdnTuneIn(C.details))&&(this.state=I.State.WAITING_LEVEL)},b.onLevelLoaded=function(d,o){var s,C=this.levels,y=o.level,x=o.details,P=x.totalduration;if(!C){this.warn("Levels were reset while loading level "+y);return}this.log("Level "+y+" loaded ["+x.startSN+","+x.endSN+"], cc ["+x.startCC+", "+x.endCC+"] duration:"+P);var j=this.fragCurrent;j&&(this.state===I.State.FRAG_LOADING||this.state===I.State.FRAG_LOADING_WAITING_RETRY)&&(j.level!==o.level&&j.loader&&(this.state=I.State.IDLE,j.loader.abort()));var Y=C[y],Q=0;if(x.live||(s=Y.details)!==null&&s!==void 0&&s.live){if(x.fragments[0]||(x.deltaUpdateFailed=!0),x.deltaUpdateFailed)return;Q=this.alignPlaylists(x,Y.details)}if(Y.details=x,this.levelLastLoaded=y,this.hls.trigger(B.Events.LEVEL_UPDATED,{details:x,level:y}),this.state===I.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(x))return;this.state=I.State.IDLE}this.startFragRequested?x.live&&this.synchronizeToLiveEdge(x):this.setStartPosition(x,Q),this.tick()},b._handleFragmentLoadProgress=function(d){var o,s=d.frag,C=d.part,y=d.payload,x=this.levels;if(!x){this.warn("Levels were reset while fragment load was in progress. Fragment "+s.sn+" of level "+s.level+" will not be buffered");return}var P=x[s.level],j=P.details;if(!j){this.warn("Dropping fragment "+s.sn+" of level "+s.level+" after level details were reset");return}var Y=P.videoCodec,Q=j.PTSKnown||!j.live,X=(o=s.initSegment)===null||o===void 0?void 0:o.data,F=this._getAudioCodec(P),$=this.transmuxer=this.transmuxer||new O.default(this.hls,k.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),re=C?C.index:-1,se=re!==-1,he=new R.ChunkMetadata(s.level,s.sn,s.stats.chunkCount,y.byteLength,re,se),_e=this.initPTS[s.cc];$.push(y,X,F,Y,s,C,j.totalduration,Q,he,_e)},b.onAudioTrackSwitching=function(d,o){var s=this.altAudio,C=!!o.url,y=o.id;if(!C){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var x=this.fragCurrent;x!=null&&x.loader&&(this.log("Switching to main audio track, cancel main fragment load"),x.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var P=this.hls;s&&P.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),P.trigger(B.Events.AUDIO_TRACK_SWITCHED,{id:y})}},b.onAudioTrackSwitched=function(d,o){var s=o.id,C=!!this.hls.audioTracks[s].url;if(C){var y=this.videoBuffer;y&&this.mediaBuffer!==y&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=y)}this.altAudio=C,this.tick()},b.onBufferCreated=function(d,o){var s=o.tracks,C,y,x=!1;for(var P in s){var j=s[P];if(j.id==="main"){if(y=P,C=j,P==="video"){var Y=s[P];Y&&(this.videoBuffer=Y.buffer)}}else x=!0}x&&C?(this.log("Alternate track found, use "+y+".buffered to schedule main fragment loading"),this.mediaBuffer=C.buffer):this.mediaBuffer=this.media},b.onFragBuffered=function(d,o){var s=o.frag,C=o.part;if(s&&s.type!==k.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(s)){this.warn("Fragment "+s.sn+(C?" p: "+C.index:"")+" of level "+s.level+" finished buffering, but was aborted. state: "+this.state),this.state===I.State.PARSED&&(this.state=I.State.IDLE);return}var y=C?C.stats:s.stats;this.fragLastKbps=Math.round(8*y.total/(y.buffering.end-y.loading.first)),s.sn!=="initSegment"&&(this.fragPrevious=s),this.fragBufferedComplete(s,C)},b.onError=function(d,o){switch(o.details){case E.ErrorDetails.FRAG_LOAD_ERROR:case E.ErrorDetails.FRAG_LOAD_TIMEOUT:case E.ErrorDetails.KEY_LOAD_ERROR:case E.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(k.PlaylistLevelType.MAIN,o);break;case E.ErrorDetails.LEVEL_LOAD_ERROR:case E.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==I.State.ERROR&&(o.fatal?(this.warn(""+o.details),this.state=I.State.ERROR):!o.levelRetry&&this.state===I.State.WAITING_LEVEL&&(this.state=I.State.IDLE));break;case E.ErrorDetails.BUFFER_FULL_ERROR:if(o.parent==="main"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var s=!0,C=this.getFwdBufferInfo(this.media,k.PlaylistLevelType.MAIN);C&&C.len>.5&&(s=!this.reduceMaxBufferLength(C.len)),s&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},b.checkBuffer=function(){var d=this.media,o=this.gapController;if(!d||!o||!d.readyState)return;var s=N.BufferHelper.getBuffered(d);!this.loadedmetadata&&s.length?(this.loadedmetadata=!0,this.seekToStartPos()):o.poll(this.lastCurrentTime),this.lastCurrentTime=d.currentTime},b.onFragLoadEmergencyAborted=function(){this.state=I.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},b.onBufferFlushed=function(d,o){var s=o.type;if(s!==m.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var C=(s===m.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(C,s,k.PlaylistLevelType.MAIN)}},b.onLevelsUpdated=function(d,o){this.levels=o.levels},b.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},b.seekToStartPos=function(){var d=this.media,o=d.currentTime,s=this.startPosition;if(s>=0&&o<s){if(d.seeking){g.logger.log("could not seek to "+s+", already seeking at "+o);return}var C=N.BufferHelper.getBuffered(d),y=C.length?C.start(0):0,x=y-s;x>0&&(x<this.config.maxBufferHole||x<this.config.maxFragLookUpTolerance)&&(g.logger.log("adjusting start position by "+x+" to match buffer start"),s+=x,this.startPosition=s),this.log("seek to target start position "+s+" from current time "+o),d.currentTime=s}},b._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},b._loadBitrateTestFrag=function(d){var o=this;this._doFragLoad(d).then(function(s){var C=o.hls;if(!s||C.nextLoadLevel||o.fragContextChanged(d))return;o.fragLoadError=0,o.state=I.State.IDLE,o.startFragRequested=!1,o.bitrateTest=!1;var y=d.stats;y.parsing.start=y.parsing.end=y.buffering.start=y.buffering.end=self.performance.now(),C.trigger(B.Events.FRAG_LOADED,s)})},b._handleTransmuxComplete=function(d){var o,s="main",C=this.hls,y=d.remuxResult,x=d.chunkMeta,P=this.getCurrentContext(x);if(!P){this.warn("The loading context changed while buffering fragment "+x.sn+" of level "+x.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(x.level);return}var j=P.frag,Y=P.part,Q=P.level,X=y.video,F=y.text,$=y.id3,re=y.initSegment,se=this.altAudio?void 0:y.audio;if(this.fragContextChanged(j))return;if(this.state=I.State.PARSING,re){re.tracks&&(this._bufferInitSegment(Q,re.tracks,j,x),C.trigger(B.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:s,tracks:re.tracks}));var he=re.initPTS,_e=re.timescale;Object(K.isFiniteNumber)(he)&&(this.initPTS[j.cc]=he,C.trigger(B.Events.INIT_PTS_FOUND,{frag:j,id:s,initPTS:he,timescale:_e}))}if(X&&y.independent!==!1){if(Q.details){var xe=X.startPTS,Ce=X.endPTS,Oe=X.startDTS,De=X.endDTS;if(Y)Y.elementaryStreams[X.type]={startPTS:xe,endPTS:Ce,startDTS:Oe,endDTS:De};else if(X.firstKeyFrame&&X.independent&&(this.couldBacktrack=!0),X.dropped&&X.independent){var pe=this.getLoadPosition()+this.config.maxBufferHole;if(pe<xe){this.backtrack(j);return}j.setElementaryStreamInfo(X.type,j.start,Ce,j.start,De,!0)}j.setElementaryStreamInfo(X.type,xe,Ce,Oe,De),this.bufferFragmentData(X,j,Y,x)}}else if(y.independent===!1){this.backtrack(j);return}if(se){var ue=se.startPTS,Me=se.endPTS,at=se.startDTS,lt=se.endDTS;Y&&(Y.elementaryStreams[m.ElementaryStreamTypes.AUDIO]={startPTS:ue,endPTS:Me,startDTS:at,endDTS:lt}),j.setElementaryStreamInfo(m.ElementaryStreamTypes.AUDIO,ue,Me,at,lt),this.bufferFragmentData(se,j,Y,x)}if($!=null&&(o=$.samples)!==null&&o!==void 0&&o.length){var et={frag:j,id:s,samples:$.samples};C.trigger(B.Events.FRAG_PARSING_METADATA,et)}if(F){var Qe={frag:j,id:s,samples:F.samples};C.trigger(B.Events.FRAG_PARSING_USERDATA,Qe)}},b._bufferInitSegment=function(d,o,s,C){var y=this;if(this.state!==I.State.PARSING)return;this.audioOnly=!!o.audio&&!o.video,this.altAudio&&!this.audioOnly&&delete o.audio;var x=o.audio,P=o.video,j=o.audiovideo;if(x){var Y=d.audioCodec,Q=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(Y&&(Y.indexOf("mp4a.40.5")!==-1?Y="mp4a.40.2":Y="mp4a.40.5"),x.metadata.channelCount!==1&&Q.indexOf("firefox")===-1&&(Y="mp4a.40.5")),Q.indexOf("android")!==-1&&x.container!=="audio/mpeg"&&(Y="mp4a.40.2",this.log("Android: force audio codec to "+Y)),d.audioCodec&&d.audioCodec!==Y&&this.log('Swapping manifest audio codec "'+d.audioCodec+'" for "'+Y+'"'),x.levelCodec=Y,x.id="main",this.log("Init audio buffer, container:"+x.container+", codecs[selected/level/parsed]=["+(Y||"")+"/"+(d.audioCodec||"")+"/"+x.codec+"]")}P&&(P.levelCodec=d.videoCodec,P.id="main",this.log("Init video buffer, container:"+P.container+", codecs[level/parsed]=["+(d.videoCodec||"")+"/"+P.codec+"]")),j&&this.log("Init audiovideo buffer, container:"+j.container+", codecs[level/parsed]=["+(d.attrs.CODECS||"")+"/"+j.codec+"]"),this.hls.trigger(B.Events.BUFFER_CODECS,o),Object.keys(o).forEach(function(X){var F=o[X],$=F.initSegment;$!=null&&$.byteLength&&y.hls.trigger(B.Events.BUFFER_APPENDING,{type:X,data:$,frag:s,part:null,chunkMeta:C,parent:s.type})}),this.tick()},b.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=I.State.BACKTRACKING},b.checkFragmentChanged=function(){var d=this.media,o=null;if(d&&d.readyState>1&&d.seeking===!1){var s=d.currentTime;if(N.BufferHelper.isBuffered(d,s)?o=this.getAppendedFrag(s):N.BufferHelper.isBuffered(d,s+.1)&&(o=this.getAppendedFrag(s+.1)),o){var C=this.fragPlaying,y=o.level;(!C||o.sn!==C.sn||C.level!==y||o.urlId!==C.urlId)&&(this.hls.trigger(B.Events.FRAG_CHANGED,{frag:o}),(!C||C.level!==y)&&this.hls.trigger(B.Events.LEVEL_SWITCHED,{level:y}),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}(I.default)},"./src/controller/subtitle-stream-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"SubtitleStreamController",function(){return i});var K=L("./src/events.ts"),I=L("./src/utils/logger.ts"),w=L("./src/utils/buffer-helper.ts"),B=L("./src/controller/fragment-finders.ts"),N=L("./src/utils/discontinuities.ts"),A=L("./src/controller/level-helper.ts"),k=L("./src/controller/fragment-tracker.ts"),m=L("./src/controller/base-stream-controller.ts"),O=L("./src/types/loader.ts"),R=L("./src/types/level.ts");function _(c,S){for(var v=0;v<S.length;v++){var p=S[v];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(c,p.key,p)}}function E(c,S,v){return S&&_(c.prototype,S),v&&_(c,v),c}function g(c,S){c.prototype=Object.create(S.prototype),c.prototype.constructor=c,u(c,S)}function u(c,S){return u=Object.setPrototypeOf||function(p,D){return p.__proto__=D,p},u(c,S)}var a=500,i=function(c){g(S,c);function S(p,D){var b;return b=c.call(this,p,D,"[subtitle-stream-controller]")||this,b.levels=[],b.currentTrackId=-1,b.tracksBuffered=[],b.mainDetails=null,b._registerListeners(),b}var v=S.prototype;return v.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},v._registerListeners=function(){var D=this.hls;D.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),D.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),D.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),D.on(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),D.on(K.Events.ERROR,this.onError,this),D.on(K.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),D.on(K.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),D.on(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),D.on(K.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),D.on(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v._unregisterListeners=function(){var D=this.hls;D.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),D.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),D.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),D.off(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),D.off(K.Events.ERROR,this.onError,this),D.off(K.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),D.off(K.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),D.off(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),D.off(K.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),D.off(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v.startLoad=function(){this.stopLoad(),this.state=m.State.IDLE,this.setInterval(a),this.tick()},v.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},v.onLevelLoaded=function(D,b){this.mainDetails=b.details},v.onSubtitleFragProcessed=function(D,b){var h=b.frag,d=b.success;if(this.fragPrevious=h,this.state=m.State.IDLE,!d)return;var o=this.tracksBuffered[this.currentTrackId];if(!o)return;for(var s,C=h.start,y=0;y<o.length;y++)if(C>=o[y].start&&C<=o[y].end){s=o[y];break}var x=h.start+h.duration;s?s.end=x:(s={start:C,end:x},o.push(s)),this.fragmentTracker.fragBuffered(h)},v.onBufferFlushing=function(D,b){var h=b.startOffset,d=b.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 C=s[o].details,y=C.targetduration,x=d-y;if(x<=0)return;b.endOffsetSubtitles=Math.max(0,x),this.tracksBuffered.forEach(function(P){for(var j=0;j<P.length;){if(P[j].end<=x){P.shift();continue}else if(P[j].start<x)P[j].start=x;else break;j++}}),this.fragmentTracker.removeFragmentsInRange(h,x,O.PlaylistLevelType.SUBTITLE)}},v.onError=function(D,b){var h,d=b.frag;if(!d||d.type!==O.PlaylistLevelType.SUBTITLE)return;(h=this.fragCurrent)!==null&&h!==void 0&&h.loader&&this.fragCurrent.loader.abort(),this.state=m.State.IDLE},v.onSubtitleTracksUpdated=function(D,b){var h=this,d=b.subtitleTracks;this.tracksBuffered=[],this.levels=d.map(function(o){return new R.Level(o)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(o){h.tracksBuffered[o.id]=[]}),this.mediaBuffer=null},v.onSubtitleTrackSwitch=function(D,b){if(this.currentTrackId=b.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)},v.onSubtitleTrackLoaded=function(D,b){var h,d=b.details,o=b.id,s=this.currentTrackId,C=this.levels;if(!C.length)return;var y=C[s];if(o>=C.length||o!==s||!y)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,d.live||(h=y.details)!==null&&h!==void 0&&h.live){var x=this.mainDetails;if(d.deltaUpdateFailed||!x)return;var P=x.fragments[0];if(!y.details)d.hasProgramDateTime&&x.hasProgramDateTime?Object(N.alignMediaPlaylistByPDT)(d,x):P&&Object(A.addSliding)(d,P.start);else{var j=this.alignPlaylists(d,y.details);j===0&&P&&Object(A.addSliding)(d,P.start)}}if(y.details=d,this.levelLastLoaded=o,this.tick(),d.live&&!this.fragCurrent&&this.media&&this.state===m.State.IDLE){var Y=Object(B.findFragmentByPTS)(null,d.fragments,this.media.currentTime,0);Y||(this.warn("Subtitle playlist not aligned with playback"),y.details=void 0)}},v._handleFragmentLoadComplete=function(D){var b=D.frag,h=D.payload,d=b.decryptdata,o=this.hls;if(this.fragContextChanged(b))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(C){var y=performance.now();o.trigger(K.Events.FRAG_DECRYPTED,{frag:b,payload:C,stats:{tstart:s,tdecrypt:y}})})}},v.doTick=function(){if(!this.media){this.state=m.State.IDLE;return}if(this.state===m.State.IDLE){var D,b=this.currentTrackId,h=this.levels;if(!h.length||!h[b]||!h[b].details)return;var d=h[b].details,o=d.targetduration,s=this.config,C=this.media,y=w.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,C.currentTime-o,s.maxBufferHole),x=y.end,P=y.len,j=this.getMaxBufferLength()+o;if(P>j)return;console.assert(d,"Subtitle track details are defined on idle subtitle stream controller tick");var Y=d.fragments,Q=Y.length,X=d.edge,F,$=this.fragPrevious;if(x<X){var re=s.maxFragLookUpTolerance;$&&d.hasProgramDateTime&&(F=Object(B.findFragmentByPDT)(Y,$.endProgramDateTime,re)),F||(F=Object(B.findFragmentByPTS)($,Y,x,re),!F&&$&&$.start<Y[0].start&&(F=Y[0]))}else F=Y[Q-1];(D=F)!==null&&D!==void 0&&D.encrypted?(I.logger.log("Loading key for "+F.sn),this.state=m.State.KEY_LOADING,this.hls.trigger(K.Events.KEY_LOADING,{frag:F})):F&&this.fragmentTracker.getState(F)===k.FragmentState.NOT_LOADED&&this.loadFragment(F,d,x)}},v.loadFragment=function(D,b,h){this.fragCurrent=D,c.prototype.loadFragment.call(this,D,b,h)},E(S,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),S}(m.default)},"./src/controller/subtitle-track-controller.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/events.ts"),I=L("./src/utils/texttrack-utils.ts"),w=L("./src/controller/base-playlist-controller.ts"),B=L("./src/types/loader.ts");function N(_,E){for(var g=0;g<E.length;g++){var u=E[g];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(_,u.key,u)}}function A(_,E,g){return E&&N(_.prototype,E),g&&N(_,g),_}function k(_,E){_.prototype=Object.create(E.prototype),_.prototype.constructor=_,m(_,E)}function m(_,E){return m=Object.setPrototypeOf||function(u,a){return u.__proto__=a,u},m(_,E)}var O=function(_){k(E,_);function E(u){var a;return a=_.call(this,u,"[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 g=E.prototype;return g.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,_.prototype.destroy.call(this)},g.registerListeners=function(){var a=this.hls;a.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(K.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.on(K.Events.ERROR,this.onError,this)},g.unregisterListeners=function(){var a=this.hls;a.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(K.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.off(K.Events.ERROR,this.onError,this)},g.onMediaAttached=function(a,i){if(this.media=i.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)},g.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},g.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=R(this.media.textTracks);a.forEach(function(i){Object(I.clearCurrentCues)(i)}),this.subtitleTrack=-1,this.media=null},g.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},g.onManifestParsed=function(a,i){this.tracks=i.subtitleTracks},g.onSubtitleTrackLoaded=function(a,i){var c=i.id,S=i.details,v=this.trackId,p=this.tracksInGroup[v];if(!p){this.warn("Invalid subtitle track id "+c);return}var D=p.details;p.details=i.details,this.log("subtitle track "+c+" loaded ["+S.startSN+"-"+S.endSN+"]"),c===this.trackId&&(this.retryCount=0,this.playlistLoaded(c,i,D))},g.onLevelLoading=function(a,i){this.switchLevel(i.level)},g.onLevelSwitching=function(a,i){this.switchLevel(i.level)},g.switchLevel=function(a){var i=this.hls.levels[a];if(!(i!=null&&i.textGroupIds))return;var c=i.textGroupIds[i.urlId];if(this.groupId!==c){var S=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,v=this.tracks.filter(function(b){return!c||b.groupId===c});this.tracksInGroup=v;var p=this.findTrackId(S==null?void 0:S.name)||this.findTrackId();this.groupId=c;var D={subtitleTracks:v};this.log("Updating subtitle tracks, "+v.length+' track(s) found in "'+c+'" group-id'),this.hls.trigger(K.Events.SUBTITLE_TRACKS_UPDATED,D),p!==-1&&this.setSubtitleTrack(p,S)}},g.findTrackId=function(a){for(var i=this.tracksInGroup,c=0;c<i.length;c++){var S=i[c];if((!this.selectDefaultTrack||S.default)&&(!a||a===S.name))return S.id}return-1},g.onError=function(a,i){if(_.prototype.onError.call(this,a,i),i.fatal||!i.context)return;i.context.type===B.PlaylistContextType.SUBTITLE_TRACK&&i.context.id===this.trackId&&i.context.groupId===this.groupId&&this.retryLoadingOrFail(i)},g.loadPlaylist=function(a){var i=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(i)){var c=i.id,S=i.groupId,v=i.url;if(a)try{v=a.addDirectives(v)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("Loading subtitle playlist for id "+c),this.hls.trigger(K.Events.SUBTITLE_TRACK_LOADING,{url:v,id:c,groupId:S,deliveryDirectives:a||null})}},g.toggleTrackModes=function(a){var i=this,c=this.media,S=this.subtitleDisplay,v=this.trackId;if(!c)return;var p=R(c.textTracks),D=p.filter(function(d){return d.groupId===i.groupId});if(a===-1)[].slice.call(p).forEach(function(d){d.mode="disabled"});else{var b=D[v];b&&(b.mode="disabled")}var h=D[a];h&&(h.mode=S?"showing":"hidden")},g.setSubtitleTrack=function(a,i){var c,S=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=a;return}if(this.trackId!==a&&this.toggleTrackModes(a),this.trackId===a&&(a===-1||(c=S[a])!==null&&c!==void 0&&c.details)||a<-1||a>=S.length)return;this.clearTimer();var v=S[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,v){var p=v.id,D=v.groupId,b=D===void 0?"":D,h=v.name,d=v.type,o=v.url;this.hls.trigger(K.Events.SUBTITLE_TRACK_SWITCH,{id:p,groupId:b,name:h,type:d,url:o});var s=this.switchParams(v.url,i==null?void 0:i.details);this.loadPlaylist(s)}else this.hls.trigger(K.Events.SUBTITLE_TRACK_SWITCH,{id:a})},g.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var a=-1,i=R(this.media.textTracks),c=0;c<i.length;c++)if(i[c].mode==="hidden")a=c;else if(i[c].mode==="showing"){a=c;break}this.subtitleTrack!==a&&(this.subtitleTrack=a)},A(E,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1;var i=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(a,i)}}]),E}(w.default);function R(_){for(var E=[],g=0;g<_.length;g++){var u=_[g];u.kind==="subtitles"&&u.label&&E.push(_[g])}return E}z.default=O},"./src/controller/timeline-controller.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"TimelineController",function(){return R});var K=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),w=L("./src/utils/cea-608-parser.ts"),B=L("./src/utils/output-filter.ts"),N=L("./src/utils/webvtt-parser.ts"),A=L("./src/utils/texttrack-utils.ts"),k=L("./src/utils/imsc1-ttml-parser.ts"),m=L("./src/types/loader.ts"),O=L("./src/utils/logger.ts"),R=function(){function u(i){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=g(),this.captionsProperties=void 0,this.hls=i,this.config=i.config,this.Cues=i.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 B.default(this,"textTrack1"),S=new B.default(this,"textTrack2"),v=new B.default(this,"textTrack3"),p=new B.default(this,"textTrack4");this.cea608Parser1=new w.default(1,c,S),this.cea608Parser2=new w.default(3,v,p)}i.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),i.on(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),i.on(I.Events.FRAG_LOADING,this.onFragLoading,this),i.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),i.on(I.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),i.on(I.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),i.on(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),i.on(I.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),i.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var a=u.prototype;return a.destroy=function(){var c=this.hls;c.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),c.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),c.off(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),c.off(I.Events.FRAG_LOADING,this.onFragLoading,this),c.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),c.off(I.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),c.off(I.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),c.off(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),c.off(I.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),c.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},a.addCues=function(c,S,v,p,D){for(var b=!1,h=D.length;h--;){var d=D[h],o=E(d[0],d[1],S,v);if(o>=0&&(d[0]=Math.min(d[0],S),d[1]=Math.max(d[1],v),b=!0,o/(v-S)>.5))return}if(b||D.push([S,v]),this.config.renderTextTracksNatively){var s=this.captionsTracks[c];this.Cues.newCue(s,S,v,p)}else{var C=this.Cues.newCue(null,S,v,p);this.hls.trigger(I.Events.CUES_PARSED,{type:"captions",cues:C,track:c})}},a.onInitPtsFound=function(c,S){var v=this,p=S.frag,D=S.id,b=S.initPTS,h=S.timescale,d=this.unparsedVttFrags;D==="main"&&(this.initPTS[p.cc]=b,this.timescale[p.cc]=h),d.length&&(this.unparsedVttFrags=[],d.forEach(function(o){v.onFragLoaded(I.Events.FRAG_LOADED,o)}))},a.getExistingTrack=function(c){var S=this.media;if(S)for(var v=0;v<S.textTracks.length;v++){var p=S.textTracks[v];if(p[c])return p}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 S=this.captionsProperties,v=this.captionsTracks,p=this.media,D=S[c],b=D.label,h=D.languageCode,d=this.getExistingTrack(c);if(d)v[c]=d,Object(A.clearCurrentCues)(v[c]),Object(A.sendAddTrackEvent)(v[c],p);else{var o=this.createTextTrack("captions",b,h);o&&(o[c]=!0,v[c]=o)}},a.createNonNativeTrack=function(c){if(this.nonNativeCaptionsTracks[c])return;var S=this.captionsProperties[c];if(!S)return;var v=S.label,p={_id:c,label:v,kind:"captions",default:S.media?!!S.media.default:!1,closedCaptions:S.media};this.nonNativeCaptionsTracks[c]=p,this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[p]})},a.createTextTrack=function(c,S,v){var p=this.media;return p?p.addTextTrack(c,S,v):void 0},a.onMediaAttaching=function(c,S){this.media=S.media,this._cleanTracks()},a.onMediaDetaching=function(){var c=this.captionsTracks;Object.keys(c).forEach(function(S){Object(A.clearCurrentCues)(c[S]),delete c[S]}),this.nonNativeCaptionsTracks={}},a.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=g(),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 S=c.textTracks;if(S)for(var v=0;v<S.length;v++)Object(A.clearCurrentCues)(S[v])},a.onSubtitleTracksUpdated=function(c,S){var v=this;this.textTracks=[];var p=S.subtitleTracks||[],D=p.some(function(o){return o.textCodec===k.IMSC1_CODEC});if(this.config.enableWebVTT||D&&this.config.enableIMSC1){var b=this.tracks&&p&&this.tracks.length===p.length;if(this.tracks=p||[],this.config.renderTextTracksNatively){var h=this.media?this.media.textTracks:[];this.tracks.forEach(function(o,s){var C;if(s<h.length){for(var y=null,x=0;x<h.length;x++)if(_(h[x],o)){y=h[x];break}y&&(C=y)}C?Object(A.clearCurrentCues)(C):(C=v.createTextTrack("subtitles",o.name,o.lang),C&&(C.mode="disabled")),C&&(C.groupId=o.groupId,v.textTracks.push(C))})}else if(!b&&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(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:d})}}},a.onManifestLoaded=function(c,S){var v=this;this.config.enableCEA708Captions&&S.captions&&S.captions.forEach(function(p){var D=/(?:CC|SERVICE)([1-4])/.exec(p.instreamId);if(!D)return;var b="textTrack"+D[1],h=v.captionsProperties[b];if(!h)return;h.label=p.name,p.lang&&(h.languageCode=p.lang),h.media=p})},a.onFragLoading=function(c,S){var v=this.cea608Parser1,p=this.cea608Parser2,D=this.lastSn,b=this.lastPartIndex;if(!this.enabled||!(v&&p))return;if(S.frag.type===m.PlaylistLevelType.MAIN){var h,d,o=S.frag.sn,s=(h=S==null||((d=S.part)===null||d===void 0)?void 0:d.index)!=null?h:-1;o===D+1||o===D&&s===b+1||(v.reset(),p.reset()),this.lastSn=o,this.lastPartIndex=s}},a.onFragLoaded=function(c,S){var v=S.frag,p=S.payload,D=this.initPTS,b=this.unparsedVttFrags;if(v.type===m.PlaylistLevelType.SUBTITLE)if(p.byteLength){if(!Object(K.isFiniteNumber)(D[v.cc])){b.push(S),D.length&&this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Missing initial subtitle PTS")});return}var h=v.decryptdata;if(h==null||h.key==null||h.method!=="AES-128"){var d=this.tracks[v.level],o=this.vttCCs;o[v.cc]||(o[v.cc]={start:v.start,prevCC:this.prevCC,new:!0},this.prevCC=v.cc),d&&d.textCodec===k.IMSC1_CODEC?this._parseIMSC1(v,p):this._parseVTTs(v,p,o)}}else this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Empty subtitle payload")})},a._parseIMSC1=function(c,S){var v=this,p=this.hls;Object(k.parseIMSC1)(S,this.initPTS[c.cc],this.timescale[c.cc],function(D){v._appendCues(D,c.level),p.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:c})},function(D){O.logger.log("Failed to parse IMSC1: "+D),p.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c,error:D})})},a._parseVTTs=function(c,S,v){var p=this,D=this.hls;Object(N.parseWebVTT)(S,this.initPTS[c.cc],this.timescale[c.cc],v,c.cc,c.start,function(b){p._appendCues(b,c.level),D.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:c})},function(b){p._fallbackToIMSC1(c,S),O.logger.log("Failed to parse VTT cue: "+b),D.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c,error:b})})},a._fallbackToIMSC1=function(c,S){var v=this,p=this.tracks[c.level];p.textCodec||Object(k.parseIMSC1)(S,this.initPTS[c.cc],this.timescale[c.cc],function(){p.textCodec=k.IMSC1_CODEC,v._parseIMSC1(c,S)},function(){p.textCodec="wvtt"})},a._appendCues=function(c,S){var v=this.hls;if(this.config.renderTextTracksNatively){var p=this.textTracks[S];if(p.mode==="disabled")return;c.forEach(function(h){return Object(A.addCueToTrack)(p,h)})}else{var D=this.tracks[S],b=D.default?"default":"subtitles"+S;v.trigger(I.Events.CUES_PARSED,{type:"subtitles",cues:c,track:b})}},a.onFragDecrypted=function(c,S){var v=S.frag;if(v.type===m.PlaylistLevelType.SUBTITLE){if(!Object(K.isFiniteNumber)(this.initPTS[v.cc])){this.unparsedVttFrags.push(S);return}this.onFragLoaded(I.Events.FRAG_LOADED,S)}},a.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},a.onFragParsingUserdata=function(c,S){var v=this.cea608Parser1,p=this.cea608Parser2;if(!this.enabled||!(v&&p))return;for(var D=0;D<S.samples.length;D++){var b=S.samples[D].bytes;if(b){var h=this.extractCea608Data(b);v.addData(S.samples[D].pts,h[0]),p.addData(S.samples[D].pts,h[1])}}},a.onBufferFlushing=function(c,S){var v=S.startOffset,p=S.endOffset,D=S.endOffsetSubtitles,b=S.type,h=this.media;if(!h||h.currentTime<p)return;if(!b||b==="video"){var d=this.captionsTracks;Object.keys(d).forEach(function(s){return Object(A.removeCuesInRange)(d[s],v,p)})}if(this.config.renderTextTracksNatively&&(v===0&&D!==void 0)){var o=this.textTracks;Object.keys(o).forEach(function(s){return Object(A.removeCuesInRange)(o[s],v,D)})}},a.extractCea608Data=function(c){for(var S=c[0]&31,v=2,p=[[],[]],D=0;D<S;D++){var b=c[v++],h=127&c[v++],d=127&c[v++],o=(4&b)!==0,s=3&b;if(h===0&&d===0)continue;o&&((s===0||s===1)&&(p[s].push(h),p[s].push(d)))}return p},u}();function _(u,a){return u&&u.label===a.name&&!(u.textTrack1||u.textTrack2)}function E(u,a,i,c){return Math.min(a,c)-Math.max(u,i)}function g(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return K});var K=function(){function I(B,N){this.subtle=void 0,this.aesIV=void 0,this.subtle=B,this.aesIV=N}var w=I.prototype;return w.decrypt=function(N,A){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},A,N)},I}()},"./src/crypt/aes-decryptor.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"removePadding",function(){return I}),L.d(z,"default",function(){return w});var K=L("./src/utils/typed-array.ts");function I(B){var N=B.byteLength,A=N&&new DataView(B.buffer).getUint8(N-1);return A?Object(K.sliceUint8)(B,0,N-A):B}var w=function(){function B(){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 N=B.prototype;return N.uint8ArrayToUint32Array_=function(k){for(var m=new DataView(k),O=new Uint32Array(4),R=0;R<4;R++)O[R]=m.getUint32(R*4);return O},N.initTable=function(){var k=this.sBox,m=this.invSBox,O=this.subMix,R=O[0],_=O[1],E=O[2],g=O[3],u=this.invSubMix,a=u[0],i=u[1],c=u[2],S=u[3],v=new Uint32Array(256),p=0,D=0,b=0;for(b=0;b<256;b++)b<128?v[b]=b<<1:v[b]=b<<1^283;for(b=0;b<256;b++){var h=D^D<<1^D<<2^D<<3^D<<4;h=h>>>8^h&255^99,k[p]=h,m[h]=p;var d=v[p],o=v[d],s=v[o],C=v[h]*257^h*16843008;R[p]=C<<24|C>>>8,_[p]=C<<16|C>>>16,E[p]=C<<8|C>>>24,g[p]=C,C=s*16843009^o*65537^d*257^p*16843008,a[h]=C<<24|C>>>8,i[h]=C<<16|C>>>16,c[h]=C<<8|C>>>24,S[h]=C,p?(p=d^v[v[v[s^d]]],D^=v[v[D]]):p=D=1}},N.expandKey=function(k){for(var m=this.uint8ArrayToUint32Array_(k),O=!0,R=0;R<m.length&&O;)O=m[R]===this.key[R],R++;if(O)return;this.key=m;var _=this.keySize=m.length;if(_!==4&&_!==6&&_!==8)throw new Error("Invalid aes key size="+_);var E=this.ksRows=(_+6+1)*4,g,u,a=this.keySchedule=new Uint32Array(E),i=this.invKeySchedule=new Uint32Array(E),c=this.sBox,S=this.rcon,v=this.invSubMix,p=v[0],D=v[1],b=v[2],h=v[3],d,o;for(g=0;g<E;g++){if(g<_){d=a[g]=m[g];continue}o=d,g%_===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^=S[g/_|0]<<24):_>6&&g%_===4&&(o=c[o>>>24]<<24|c[o>>>16&255]<<16|c[o>>>8&255]<<8|c[o&255]),a[g]=d=(a[g-_]^o)>>>0}for(u=0;u<E;u++)g=E-u,u&3?o=a[g]:o=a[g-4],u<4||g<=4?i[u]=o:i[u]=p[c[o>>>24]]^D[c[o>>>16&255]]^b[c[o>>>8&255]]^h[c[o&255]],i[u]=i[u]>>>0},N.networkToHostOrderSwap=function(k){return k<<24|(k&65280)<<8|(k&16711680)>>8|k>>>24},N.decrypt=function(k,m,O){for(var R=this.keySize+6,_=this.invKeySchedule,E=this.invSBox,g=this.invSubMix,u=g[0],a=g[1],i=g[2],c=g[3],S=this.uint8ArrayToUint32Array_(O),v=S[0],p=S[1],D=S[2],b=S[3],h=new Int32Array(k),d=new Int32Array(h.length),o,s,C,y,x,P,j,Y,Q,X,F,$,re,se,he=this.networkToHostOrderSwap;m<h.length;){for(Q=he(h[m]),X=he(h[m+1]),F=he(h[m+2]),$=he(h[m+3]),x=Q^_[0],P=$^_[1],j=F^_[2],Y=X^_[3],re=4,se=1;se<R;se++)o=u[x>>>24]^a[P>>16&255]^i[j>>8&255]^c[Y&255]^_[re],s=u[P>>>24]^a[j>>16&255]^i[Y>>8&255]^c[x&255]^_[re+1],C=u[j>>>24]^a[Y>>16&255]^i[x>>8&255]^c[P&255]^_[re+2],y=u[Y>>>24]^a[x>>16&255]^i[P>>8&255]^c[j&255]^_[re+3],x=o,P=s,j=C,Y=y,re=re+4;o=E[x>>>24]<<24^E[P>>16&255]<<16^E[j>>8&255]<<8^E[Y&255]^_[re],s=E[P>>>24]<<24^E[j>>16&255]<<16^E[Y>>8&255]<<8^E[x&255]^_[re+1],C=E[j>>>24]<<24^E[Y>>16&255]<<16^E[x>>8&255]<<8^E[P&255]^_[re+2],y=E[Y>>>24]<<24^E[x>>16&255]<<16^E[P>>8&255]<<8^E[j&255]^_[re+3],d[m]=he(o^v),d[m+1]=he(y^p),d[m+2]=he(C^D),d[m+3]=he(s^b),v=Q,p=X,D=F,b=$,m=m+4}return d.buffer},B}()},"./src/crypt/decrypter.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return m});var K=L("./src/crypt/aes-crypto.ts"),I=L("./src/crypt/fast-aes-key.ts"),w=L("./src/crypt/aes-decryptor.ts"),B=L("./src/utils/logger.ts"),N=L("./src/utils/mp4-tools.ts"),A=L("./src/utils/typed-array.ts"),k=16,m=function(){function O(_,E,g){var u=g===void 0?{}:g,a=u.removePKCS7Padding,i=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=_,this.config=E,this.removePKCS7Padding=i,i)try{var c=self.crypto;c&&(this.subtle=c.subtle||c.webkitSubtle)}catch(S){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var R=O.prototype;return R.destroy=function(){this.observer=null},R.isSync=function(){return this.config.enableSoftwareAES},R.flush=function(){var E=this.currentResult;if(!E){this.reset();return}var g=new Uint8Array(E);return this.reset(),this.removePKCS7Padding?Object(w.removePadding)(g):g},R.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},R.decrypt=function(E,g,u,a){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(E),g,u);var i=this.flush();i&&a(i.buffer)}else this.webCryptoDecrypt(new Uint8Array(E),g,u).then(a)},R.softwareDecrypt=function(E,g,u){var a=this.currentIV,i=this.currentResult,c=this.remainderData;this.logOnce("JS AES decrypt"),c&&(E=Object(N.appendUint8Array)(c,E),this.remainderData=null);var S=this.getValidChunk(E);if(!S.length)return null;a&&(u=a);var v=this.softwareDecrypter;v||(v=this.softwareDecrypter=new w.default),v.expandKey(g);var p=i;return this.currentResult=v.decrypt(S.buffer,0,u),this.currentIV=Object(A.sliceUint8)(S,-16).buffer,p||null},R.webCryptoDecrypt=function(E,g,u){var a=this,i=this.subtle;return(this.key!==g||!this.fastAesKey)&&(this.key=g,this.fastAesKey=new I.default(i,g)),this.fastAesKey.expandKey().then(function(c){if(!i)return Promise.reject(new Error("web crypto not initialized"));var S=new K.default(i,u);return S.decrypt(E.buffer,c)}).catch(function(c){return a.onWebCryptoError(c,E,g,u)})},R.onWebCryptoError=function(E,g,u,a){return B.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",E),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(g,u,a)},R.getValidChunk=function(E){var g=E,u=E.length-E.length%k;return u!==E.length&&(g=Object(A.sliceUint8)(E,0,u),this.remainderData=Object(A.sliceUint8)(E,u)),g},R.logOnce=function(E){if(!this.logEnabled)return;B.logger.log("[decrypter.ts]: "+E),this.logEnabled=!1},O}()},"./src/crypt/fast-aes-key.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return K});var K=function(){function I(B,N){this.subtle=void 0,this.key=void 0,this.subtle=B,this.key=N}var w=I.prototype;return w.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},I}()},"./src/demux/aacdemuxer.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/demux/base-audio-demuxer.ts"),I=L("./src/demux/adts.ts"),w=L("./src/utils/logger.ts"),B=L("./src/demux/id3.ts");function N(m,O){m.prototype=Object.create(O.prototype),m.prototype.constructor=m,A(m,O)}function A(m,O){return A=Object.setPrototypeOf||function(_,E){return _.__proto__=E,_},A(m,O)}var k=function(m){N(O,m);function O(_,E){var g;return g=m.call(this)||this,g.observer=void 0,g.config=void 0,g.observer=_,g.config=E,g}var R=O.prototype;return R.resetInitSegment=function(E,g,u){m.prototype.resetInitSegment.call(this,E,g,u),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:E,duration:u,inputTimeScale:9e4,dropped:0}},O.probe=function(E){if(!E)return!1;for(var g=B.getID3Data(E,0)||[],u=g.length,a=E.length;u<a;u++)if(I.probe(E,u))return w.logger.log("ADTS sync word found !"),!0;return!1},R.canParse=function(E,g){return I.canParse(E,g)},R.appendFrame=function(E,g,u){I.initTrackConfig(E,this.observer,g,u,E.manifestCodec);var a=I.appendFrame(E,g,u,this.initPTS,this.frameIndex);if(a&&a.missing===0)return a},O}(K.default);k.minProbeByteLength=9,z.default=k},"./src/demux/adts.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"getAudioConfig",function(){return B}),L.d(z,"isHeaderPattern",function(){return N}),L.d(z,"getHeaderLength",function(){return A}),L.d(z,"getFullFrameLength",function(){return k}),L.d(z,"canGetFrameLength",function(){return m}),L.d(z,"isHeader",function(){return O}),L.d(z,"canParse",function(){return R}),L.d(z,"probe",function(){return _}),L.d(z,"initTrackConfig",function(){return E}),L.d(z,"getFrameDuration",function(){return g}),L.d(z,"parseFrameHeader",function(){return u}),L.d(z,"appendFrame",function(){return a});var K=L("./src/utils/logger.ts"),I=L("./src/errors.ts"),w=L("./src/events.ts");function B(i,c,S,v){var p,D,b,h,d=navigator.userAgent.toLowerCase(),o=v,s=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];p=((c[S+2]&192)>>>6)+1;var C=(c[S+2]&60)>>>2;if(C>s.length-1){i.trigger(w.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+C});return}return b=(c[S+2]&1)<<2,b|=(c[S+3]&192)>>>6,K.logger.log("manifest codec:"+v+", ADTS type:"+p+", samplingIndex:"+C),/firefox/i.test(d)?C>=6?(p=5,h=new Array(4),D=C-3):(p=2,h=new Array(2),D=C):d.indexOf("android")!==-1?(p=2,h=new Array(2),D=C):(p=5,h=new Array(4),v&&(v.indexOf("mp4a.40.29")!==-1||v.indexOf("mp4a.40.5")!==-1)||!v&&C>=6?D=C-3:((v&&v.indexOf("mp4a.40.2")!==-1&&(C>=6&&b===1||/vivaldi/i.test(d))||!v&&b===1)&&(p=2,h=new Array(2)),D=C)),h[0]=p<<3,h[0]|=(C&14)>>1,h[1]|=(C&1)<<7,h[1]|=b<<3,p===5&&(h[1]|=(D&14)>>1,h[2]=(D&1)<<7,h[2]|=2<<2,h[3]=0),{config:h,samplerate:s[C],channelCount:b,codec:"mp4a.40."+p,manifestCodec:o}}function N(i,c){return i[c]===255&&(i[c+1]&246)===240}function A(i,c){return i[c+1]&1?7:9}function k(i,c){return(i[c+3]&3)<<11|i[c+4]<<3|(i[c+5]&224)>>>5}function m(i,c){return c+5<i.length}function O(i,c){return c+1<i.length&&N(i,c)}function R(i,c){return m(i,c)&&N(i,c)&&k(i,c)<=i.length-c}function _(i,c){if(O(i,c)){var S=A(i,c);if(c+S>=i.length)return!1;var v=k(i,c);if(v<=S)return!1;var p=c+v;return p===i.length||O(i,p)}return!1}function E(i,c,S,v,p){if(!i.samplerate){var D=B(c,S,v,p);if(!D)return;i.config=D.config,i.samplerate=D.samplerate,i.channelCount=D.channelCount,i.codec=D.codec,i.manifestCodec=D.manifestCodec,K.logger.log("parsed codec:"+i.codec+", rate:"+D.samplerate+", channels:"+D.channelCount)}}function g(i){return 1024*9e4/i}function u(i,c,S,v,p){var D=A(i,c),b=k(i,c);if(b-=D,b>0){var h=S+v*p;return{headerLength:D,frameLength:b,stamp:h}}}function a(i,c,S,v,p){var D=g(i.samplerate),b=u(c,S,v,p,D);if(b){var h=b.frameLength,d=b.headerLength,o=b.stamp,s=d+h,C=Math.max(0,S+s-c.length),y;C?(y=new Uint8Array(s-d),y.set(c.subarray(S+d,c.length),0)):y=c.subarray(S+d,S+s);var x={unit:y,pts:o};return C||i.samples.push(x),{sample:x,length:s,missing:C}}}},"./src/demux/base-audio-demuxer.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"initPTSFn",function(){return k});var K=L("./src/polyfills/number.ts"),I=L("./src/demux/id3.ts"),w=L("./src/demux/dummy-demuxed-track.ts"),B=L("./src/utils/mp4-tools.ts"),N=L("./src/utils/typed-array.ts"),A=function(){function m(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var O=m.prototype;return O.resetInitSegment=function(_,E,g){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},O.resetTimeStamp=function(){},O.resetContiguity=function(){},O.canParse=function(_,E){return!1},O.appendFrame=function(_,E,g){},O.demux=function(_,E){this.cachedData&&(_=Object(B.appendUint8Array)(this.cachedData,_),this.cachedData=null);var g=I.getID3Data(_,0),u=g?g.length:0,a,i,c=this._audioTrack,S=this._id3Track,v=g?I.getTimeStamp(g):void 0,p=_.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=k(v,E)),g&&g.length>0&&S.samples.push({pts:this.initPTS,dts:this.initPTS,data:g}),i=this.initPTS;u<p;){if(this.canParse(_,u)){var D=this.appendFrame(c,_,u);D?(this.frameIndex++,i=D.sample.pts,u+=D.length,a=u):u=p}else I.canParse(_,u)?(g=I.getID3Data(_,u),S.samples.push({pts:i,dts:i,data:g}),u+=g.length,a=u):u++;if(u===p&&a!==p){var b=Object(N.sliceUint8)(_,a);this.cachedData?this.cachedData=Object(B.appendUint8Array)(this.cachedData,b):this.cachedData=b}}return{audioTrack:c,avcTrack:Object(w.dummyTrack)(),id3Track:S,textTrack:Object(w.dummyTrack)()}},O.demuxSampleAes=function(_,E,g){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},O.flush=function(_){var E=this.cachedData;return E&&(this.cachedData=null,this.demux(E,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(w.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(w.dummyTrack)()}},O.destroy=function(){},m}(),k=function(O,R){return Object(K.isFiniteNumber)(O)?O*90:R*9e4};z.default=A},"./src/demux/chunk-cache.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return K});var K=function(){function w(){this.chunks=[],this.dataLength=0}var B=w.prototype;return B.push=function(A){this.chunks.push(A),this.dataLength+=A.length},B.flush=function(){var A=this.chunks,k=this.dataLength,m;if(A.length)A.length===1?m=A[0]:m=I(A,k);else return new Uint8Array(0);return this.reset(),m},B.reset=function(){this.chunks.length=0,this.dataLength=0},w}();function I(w,B){for(var N=new Uint8Array(B),A=0,k=0;k<w.length;k++){var m=w[k];N.set(m,A),A+=m.length}return N}},"./src/demux/dummy-demuxed-track.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"dummyTrack",function(){return K});function K(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/utils/logger.ts"),I=function(){function w(N){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=N,this.bytesAvailable=N.byteLength,this.word=0,this.bitsAvailable=0}var B=w.prototype;return B.loadWord=function(){var A=this.data,k=this.bytesAvailable,m=A.byteLength-k,O=new Uint8Array(4),R=Math.min(4,k);if(R===0)throw new Error("no bytes available");O.set(A.subarray(m,m+R)),this.word=new DataView(O.buffer).getUint32(0),this.bitsAvailable=R*8,this.bytesAvailable-=R},B.skipBits=function(A){var k;this.bitsAvailable>A?(this.word<<=A,this.bitsAvailable-=A):(A-=this.bitsAvailable,k=A>>3,A-=k>>3,this.bytesAvailable-=k,this.loadWord(),this.word<<=A,this.bitsAvailable-=A)},B.readBits=function(A){var k=Math.min(this.bitsAvailable,A),m=this.word>>>32-k;return A>32&&K.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=k,this.bitsAvailable>0?this.word<<=k:this.bytesAvailable>0&&this.loadWord(),k=A-k,k>0&&this.bitsAvailable?m<<k|this.readBits(k):m},B.skipLZ=function(){var A;for(A=0;A<this.bitsAvailable;++A)if((this.word&2147483648>>>A)!==0)return this.word<<=A,this.bitsAvailable-=A,A;return this.loadWord(),A+this.skipLZ()},B.skipUEG=function(){this.skipBits(1+this.skipLZ())},B.skipEG=function(){this.skipBits(1+this.skipLZ())},B.readUEG=function(){var A=this.skipLZ();return this.readBits(A+1)-1},B.readEG=function(){var A=this.readUEG();return 1&A?1+A>>>1:-1*(A>>>1)},B.readBoolean=function(){return this.readBits(1)===1},B.readUByte=function(){return this.readBits(8)},B.readUShort=function(){return this.readBits(16)},B.readUInt=function(){return this.readBits(32)},B.skipScalingList=function(A){for(var k=8,m=8,O,R=0;R<A;R++)m!==0&&(O=this.readEG(),m=(k+O+256)%256),k=m===0?k:m},B.readSPS=function(){var A=0,k=0,m=0,O=0,R,_,E,g=this.readUByte.bind(this),u=this.readBits.bind(this),a=this.readUEG.bind(this),i=this.readBoolean.bind(this),c=this.skipBits.bind(this),S=this.skipEG.bind(this),v=this.skipUEG.bind(this),p=this.skipScalingList.bind(this);g();var D=g();if(u(5),c(3),g(),v(),D===100||D===110||D===122||D===244||D===44||D===83||D===86||D===118||D===128){var b=a();if(b===3&&c(1),v(),v(),c(1),i())for(_=b!==3?8:12,E=0;E<_;E++)i()&&(E<6?p(16):p(64))}v();var h=a();if(h===0)a();else if(h===1)for(c(1),S(),S(),R=a(),E=0;E<R;E++)S();v(),c(1);var d=a(),o=a(),s=u(1);s===0&&c(1),c(1),i()&&(A=a(),k=a(),m=a(),O=a());var C=[1,1];if(i()&&i()){var y=g();switch(y){case 1:C=[1,1];break;case 2:C=[12,11];break;case 3:C=[10,11];break;case 4:C=[16,11];break;case 5:C=[40,33];break;case 6:C=[24,11];break;case 7:C=[20,11];break;case 8:C=[32,11];break;case 9:C=[80,33];break;case 10:C=[18,11];break;case 11:C=[15,11];break;case 12:C=[64,33];break;case 13:C=[160,99];break;case 14:C=[4,3];break;case 15:C=[3,2];break;case 16:C=[2,1];break;case 255:{C=[g()<<8|g(),g()<<8|g()];break}}}return{width:Math.ceil((d+1)*16-A*2-k*2),height:(2-s)*(o+1)*16-(s?2:4)*(m+O),pixelRatio:C}},B.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},w}();z.default=I},"./src/demux/id3.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"isHeader",function(){return K}),L.d(z,"isFooter",function(){return I}),L.d(z,"getID3Data",function(){return w}),L.d(z,"canParse",function(){return N}),L.d(z,"getTimeStamp",function(){return A}),L.d(z,"isTimeStampFrame",function(){return k}),L.d(z,"getID3Frames",function(){return O}),L.d(z,"decodeFrame",function(){return R}),L.d(z,"utf8ArrayToStr",function(){return a}),L.d(z,"testables",function(){return i});var K=function(p,D){return D+10<=p.length&&(p[D]===73&&p[D+1]===68&&p[D+2]===51&&(p[D+3]<255&&p[D+4]<255&&(p[D+6]<128&&p[D+7]<128&&p[D+8]<128&&p[D+9]<128)))},I=function(p,D){return D+10<=p.length&&(p[D]===51&&p[D+1]===68&&p[D+2]===73&&(p[D+3]<255&&p[D+4]<255&&(p[D+6]<128&&p[D+7]<128&&p[D+8]<128&&p[D+9]<128)))},w=function(p,D){for(var b=D,h=0;K(p,D);){h+=10;var d=B(p,D+6);h+=d,I(p,D+10)&&(h+=10),D+=h}return h>0?p.subarray(b,b+h):void 0},B=function(p,D){var b=0;return b=(p[D]&127)<<21,b|=(p[D+1]&127)<<14,b|=(p[D+2]&127)<<7,b|=p[D+3]&127,b},N=function(p,D){return K(p,D)&&B(p,D+6)+10<=p.length-D},A=function(p){for(var D=O(p),b=0;b<D.length;b++){var h=D[b];if(k(h))return u(h)}return},k=function(p){return p&&p.key==="PRIV"&&p.info==="com.apple.streaming.transportStreamTimestamp"},m=function(p){var D=String.fromCharCode(p[0],p[1],p[2],p[3]),b=B(p,4),h=10;return{type:D,size:b,data:p.subarray(h,h+b)}},O=function(p){for(var D=0,b=[];K(p,D);){var h=B(p,D+6);D+=10;for(var d=D+h;D+8<d;){var o=m(p.subarray(D)),s=R(o);s&&b.push(s),D+=o.size+10}I(p,D)&&(D+=10)}return b},R=function(p){return p.type==="PRIV"?_(p):p.type[0]==="W"?g(p):E(p)},_=function(p){if(p.size<2)return;var D=a(p.data,!0),b=new Uint8Array(p.data.subarray(D.length+1));return{key:p.type,info:D,data:b.buffer}},E=function(p){if(p.size<2)return;if(p.type==="TXXX"){var D=1,b=a(p.data.subarray(D),!0);D+=b.length+1;var h=a(p.data.subarray(D));return{key:p.type,info:b,data:h}}var d=a(p.data.subarray(1));return{key:p.type,data:d}},g=function(p){if(p.type==="WXXX"){if(p.size<2)return;var D=1,b=a(p.data.subarray(D),!0);D+=b.length+1;var h=a(p.data.subarray(D));return{key:p.type,info:b,data:h}}var d=a(p.data);return{key:p.type,data:d}},u=function(p){if(p.data.byteLength===8){var D=new Uint8Array(p.data),b=D[3]&1,h=(D[4]<<23)+(D[5]<<15)+(D[6]<<7)+D[7];return h/=45,b&&(h+=4772185884e-2),Math.round(h)}return},a=function(p,D){D===void 0&&(D=!1);var b=S();if(b){var h=b.decode(p);if(D){var d=h.indexOf("\0");return d!==-1?h.substring(0,d):h}return h.replace(/\0/g,"")}for(var o=p.length,s,C,y,x="",P=0;P<o;){if(s=p[P++],s===0&&D)return x;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:x+=String.fromCharCode(s);break;case 12:case 13:C=p[P++],x+=String.fromCharCode((s&31)<<6|C&63);break;case 14:C=p[P++],y=p[P++],x+=String.fromCharCode((s&15)<<12|(C&63)<<6|(y&63)<<0);break;default:}}return x},i={decodeTextFrame:E},c;function S(){return!c&&typeof self.TextDecoder!="undefined"&&(c=new self.TextDecoder("utf-8")),c}},"./src/demux/mp3demuxer.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/demux/base-audio-demuxer.ts"),I=L("./src/demux/id3.ts"),w=L("./src/utils/logger.ts"),B=L("./src/demux/mpegaudio.ts");function N(m,O){m.prototype=Object.create(O.prototype),m.prototype.constructor=m,A(m,O)}function A(m,O){return A=Object.setPrototypeOf||function(_,E){return _.__proto__=E,_},A(m,O)}var k=function(m){N(O,m);function O(){return m.apply(this,arguments)||this}var R=O.prototype;return R.resetInitSegment=function(E,g,u){m.prototype.resetInitSegment.call(this,E,g,u),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:E,duration:u,inputTimeScale:9e4,dropped:0}},O.probe=function(E){if(!E)return!1;for(var g=I.getID3Data(E,0)||[],u=g.length,a=E.length;u<a;u++)if(B.probe(E,u))return w.logger.log("MPEG Audio sync word found !"),!0;return!1},R.canParse=function(E,g){return B.canParse(E,g)},R.appendFrame=function(E,g,u){return this.initPTS===null?void 0:B.appendFrame(E,g,u,this.initPTS,this.frameIndex)},O}(K.default);k.minProbeByteLength=4,z.default=k},"./src/demux/mp4demuxer.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/utils/mp4-tools.ts"),I=L("./src/demux/dummy-demuxed-track.ts"),w=function(){function B(A,k){this.remainderData=null,this.config=void 0,this.config=k}var N=B.prototype;return N.resetTimeStamp=function(){},N.resetInitSegment=function(){},N.resetContiguity=function(){},B.probe=function(k){return Object(K.findBox)({data:k,start:0,end:Math.min(k.length,16384)},["moof"]).length>0},N.demux=function(k){var m=k,O=Object(I.dummyTrack)();if(this.config.progressive){this.remainderData&&(m=Object(K.appendUint8Array)(this.remainderData,k));var R=Object(K.segmentValidRange)(m);this.remainderData=R.remainder,O.samples=R.valid||new Uint8Array}else O.samples=m;return{audioTrack:Object(I.dummyTrack)(),avcTrack:O,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},N.flush=function(){var k=Object(I.dummyTrack)();return k.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(I.dummyTrack)(),avcTrack:k,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},N.demuxSampleAes=function(k,m,O){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},N.destroy=function(){},B}();w.minProbeByteLength=1024,z.default=w},"./src/demux/mpegaudio.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"appendFrame",function(){return A}),L.d(z,"parseHeader",function(){return k}),L.d(z,"isHeaderPattern",function(){return m}),L.d(z,"isHeader",function(){return O}),L.d(z,"canParse",function(){return R}),L.d(z,"probe",function(){return _});var K=null,I=[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],w=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],B=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],N=[0,1,1,4];function A(E,g,u,a,i){if(u+24>g.length)return;var c=k(g,u);if(c&&u+c.frameLength<=g.length){var S=c.samplesPerFrame*9e4/c.sampleRate,v=a+i*S,p={unit:g.subarray(u,u+c.frameLength),pts:v,dts:v};return E.config=[],E.channelCount=c.channelCount,E.samplerate=c.sampleRate,E.samples.push(p),{sample:p,length:c.frameLength,missing:0}}}function k(E,g){var u=E[g+1]>>3&3,a=E[g+1]>>1&3,i=E[g+2]>>4&15,c=E[g+2]>>2&3;if(u!==1&&i!==0&&i!==15&&c!==3){var S=E[g+2]>>1&1,v=E[g+3]>>6,p=u===3?3-a:a===3?3:4,D=I[p*14+i-1]*1e3,b=u===3?0:u===2?1:2,h=w[b*3+c],d=v===3?1:2,o=B[u][a],s=N[a],C=o*8*s,y=Math.floor(o*D/h+S)*s;if(K===null){var x=navigator.userAgent||"",P=x.match(/Chrome\/(\d+)/i);K=P?parseInt(P[1]):0}var j=!!K&&K<=87;return j&&a===2&&D>=224e3&&v===0&&(E[g+3]=E[g+3]|128),{sampleRate:h,channelCount:d,frameLength:y,samplesPerFrame:C}}}function m(E,g){return E[g]===255&&(E[g+1]&224)===224&&(E[g+1]&6)!==0}function O(E,g){return g+1<E.length&&m(E,g)}function R(E,g){var u=4;return m(E,g)&&u<=E.length-g}function _(E,g){if(g+1<E.length&&m(E,g)){var u=4,a=k(E,g),i=u;a!=null&&a.frameLength&&(i=a.frameLength);var c=g+i;return c===E.length||O(E,c)}return!1}},"./src/demux/sample-aes.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/crypt/decrypter.ts"),I=L("./src/demux/tsdemuxer.ts"),w=function(){function B(A,k,m){this.keyData=void 0,this.decrypter=void 0,this.keyData=m,this.decrypter=new K.default(A,k,{removePKCS7Padding:!1})}var N=B.prototype;return N.decryptBuffer=function(k,m){this.decrypter.decrypt(k,this.keyData.key.buffer,this.keyData.iv.buffer,m)},N.decryptAacSample=function(k,m,O,R){var _=k[m].unit,E=_.subarray(16,_.length-_.length%16),g=E.buffer.slice(E.byteOffset,E.byteOffset+E.length),u=this;this.decryptBuffer(g,function(a){var i=new Uint8Array(a);_.set(i,16),R||u.decryptAacSamples(k,m+1,O)})},N.decryptAacSamples=function(k,m,O){for(;;m++){if(m>=k.length){O();return}if(k[m].unit.length<32)continue;var R=this.decrypter.isSync();if(this.decryptAacSample(k,m,O,R),!R)return}},N.getAvcEncryptedData=function(k){for(var m=Math.floor((k.length-48)/160)*16+16,O=new Int8Array(m),R=0,_=32;_<=k.length-16;_+=160,R+=16)O.set(k.subarray(_,_+16),R);return O},N.getAvcDecryptedUnit=function(k,m){for(var O=new Uint8Array(m),R=0,_=32;_<=k.length-16;_+=160,R+=16)k.set(O.subarray(R,R+16),_);return k},N.decryptAvcSample=function(k,m,O,R,_,E){var g=Object(I.discardEPB)(_.data),u=this.getAvcEncryptedData(g),a=this;this.decryptBuffer(u.buffer,function(i){_.data=a.getAvcDecryptedUnit(g,i),E||a.decryptAvcSamples(k,m,O+1,R)})},N.decryptAvcSamples=function(k,m,O,R){if(k instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;m++,O=0){if(m>=k.length){R();return}for(var _=k[m].units;!(O>=_.length);O++){var E=_[O];if(E.data.length<=48||E.type!==1&&E.type!==5)continue;var g=this.decrypter.isSync();if(this.decryptAvcSample(k,m,O,R,E,g),!g)return}}},B}();z.default=w},"./src/demux/transmuxer-interface.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return _});var K=L("./node_modules/webworkify-webpack/index.js"),I=L.n(K),w=L("./src/events.ts"),B=L("./src/demux/transmuxer.ts"),N=L("./src/utils/logger.ts"),A=L("./src/errors.ts"),k=L("./src/utils/mediasource-helper.ts"),m=L("./node_modules/eventemitter3/index.js"),O=L.n(m),R=Object(k.getMediaSource)()||{isTypeSupported:function(){return!1}},_=function(){function E(u,a,i,c){var S=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=u,this.id=a,this.onTransmuxComplete=i,this.onFlush=c;var v=u.config,p=function(o,s){s=s||{},s.frag=S.frag,s.id=S.id,u.trigger(o,s)};this.observer=new m.EventEmitter,this.observer.on(w.Events.FRAG_DECRYPTED,p),this.observer.on(w.Events.ERROR,p);var D={mp4:R.isTypeSupported("video/mp4"),mpeg:R.isTypeSupported("audio/mpeg"),mp3:R.isTypeSupported('audio/mp4; codecs="mp3"')},b=navigator.vendor;if(v.enableWorker&&typeof Worker!="undefined"){N.logger.log("demuxing in webworker");var h;try{h=this.worker=K("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),h.addEventListener("message",this.onwmsg),h.onerror=function(d){u.trigger(w.Events.ERROR,{type:A.ErrorTypes.OTHER_ERROR,details:A.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(d.message+" ("+d.filename+":"+d.lineno+")")})},h.postMessage({cmd:"init",typeSupported:D,vendor:b,id:a,config:JSON.stringify(v)})}catch(d){N.logger.warn("Error in worker:",d),N.logger.error("Error while initializing DemuxerWorker, fallback to inline"),h&&self.URL.revokeObjectURL(h.objectURL),this.transmuxer=new B.default(this.observer,D,v,b,a),this.worker=null}}else this.transmuxer=new B.default(this.observer,D,v,b,a)}var g=E.prototype;return g.destroy=function(){var a=this.worker;if(a)a.removeEventListener("message",this.onwmsg),a.terminate(),this.worker=null;else{var i=this.transmuxer;i&&(i.destroy(),this.transmuxer=null)}var c=this.observer;c&&c.removeAllListeners(),this.observer=null},g.push=function(a,i,c,S,v,p,D,b,h,d){var o=this;h.transmuxing.start=self.performance.now();var s=this.transmuxer,C=this.worker,y=p?p.start:v.start,x=v.decryptdata,P=this.frag,j=!(P&&v.cc===P.cc),Y=!(P&&h.level===P.level),Q=P?h.sn-P.sn:-1,X=this.part?h.part-this.part.index:1,F=!Y&&(Q===1||Q===0&&X===1),$=self.performance.now();(Y||Q||v.stats.parsing.start===0)&&(v.stats.parsing.start=$),p&&(X||!F)&&(p.stats.parsing.start=$);var re=new B.TransmuxState(j,F,b,Y,y);if(!F||j){N.logger.log("[transmuxer-interface, "+v.type+"]: Starting new transmux session for sn: "+h.sn+" p: "+h.part+" level: "+h.level+" id: "+h.id+`
|
|
discontinuity: `+j+`
|
|
trackSwitch: `+Y+`
|
|
contiguous: `+F+`
|
|
accurateTimeOffset: `+b+`
|
|
timeOffset: `+y);var se=new B.TransmuxConfig(c,S,i,D,d);this.configureTransmuxer(se)}if(this.frag=v,this.part=p,C)C.postMessage({cmd:"demux",data:a,decryptdata:x,chunkMeta:h,state:re},a instanceof ArrayBuffer?[a]:[]);else if(s){var he=s.push(a,x,h,re);Object(B.isPromise)(he)?he.then(function(_e){o.handleTransmuxComplete(_e)}):this.handleTransmuxComplete(he)}},g.flush=function(a){var i=this;a.transmuxing.start=self.performance.now();var c=this.transmuxer,S=this.worker;if(S)S.postMessage({cmd:"flush",chunkMeta:a});else if(c){var v=c.flush(a);Object(B.isPromise)(v)?v.then(function(p){i.handleFlushResult(p,a)}):this.handleFlushResult(v,a)}},g.handleFlushResult=function(a,i){var c=this;a.forEach(function(S){c.handleTransmuxComplete(S)}),this.onFlush(i)},g.onWorkerMessage=function(a){var i=a.data,c=this.hls;switch(i.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(i.data);break}case"flush":{this.onFlush(i.data);break}default:{i.data=i.data||{},i.data.frag=this.frag,i.data.id=this.id,c.trigger(i.event,i.data);break}}},g.configureTransmuxer=function(a){var i=this.worker,c=this.transmuxer;i?i.postMessage({cmd:"configure",config:a}):c&&c.configure(a)},g.handleTransmuxComplete=function(a){a.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(a)},E}()},"./src/demux/transmuxer-worker.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return A});var K=L("./src/demux/transmuxer.ts"),I=L("./src/events.ts"),w=L("./src/utils/logger.ts"),B=L("./node_modules/eventemitter3/index.js"),N=L.n(B);function A(_){var E=new B.EventEmitter,g=function(a,i){_.postMessage({event:a,data:i})};E.on(I.Events.FRAG_DECRYPTED,g),E.on(I.Events.ERROR,g),_.addEventListener("message",function(u){var a=u.data;switch(a.cmd){case"init":{var i=JSON.parse(a.config);_.transmuxer=new K.default(E,a.typeSupported,i,a.vendor,a.id),Object(w.enableLogs)(i.debug),g("init",null);break}case"configure":{_.transmuxer.configure(a.config);break}case"demux":{var c=_.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(K.isPromise)(c)?c.then(function(p){k(_,p)}):k(_,c);break}case"flush":{var S=a.chunkMeta,v=_.transmuxer.flush(S);Object(K.isPromise)(v)?v.then(function(p){O(_,p,S)}):O(_,v,S);break}default:break}})}function k(_,E){if(R(E.remuxResult))return;var g=[],u=E.remuxResult,a=u.audio,i=u.video;a&&m(g,a),i&&m(g,i),_.postMessage({event:"transmuxComplete",data:E},g)}function m(_,E){E.data1&&_.push(E.data1.buffer),E.data2&&_.push(E.data2.buffer)}function O(_,E,g){E.forEach(function(u){k(_,u)}),_.postMessage({event:"flush",data:g})}function R(_){return!_.audio&&!_.video&&!_.text&&!_.id3&&!_.initSegment}},"./src/demux/transmuxer.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return i}),L.d(z,"isPromise",function(){return v}),L.d(z,"TransmuxConfig",function(){return p}),L.d(z,"TransmuxState",function(){return D});var K=L("./src/events.ts"),I=L("./src/errors.ts"),w=L("./src/crypt/decrypter.ts"),B=L("./src/demux/aacdemuxer.ts"),N=L("./src/demux/mp4demuxer.ts"),A=L("./src/demux/tsdemuxer.ts"),k=L("./src/demux/mp3demuxer.ts"),m=L("./src/remux/mp4-remuxer.ts"),O=L("./src/remux/passthrough-remuxer.ts"),R=L("./src/demux/chunk-cache.ts"),_=L("./src/utils/mp4-tools.ts"),E=L("./src/utils/logger.ts"),g;try{g=self.performance.now.bind(self.performance)}catch(b){E.logger.debug("Unable to use Performance API on this environment"),g=self.Date.now}var u=[{demux:A.default,remux:m.default},{demux:N.default,remux:O.default},{demux:B.default,remux:m.default},{demux:k.default,remux:m.default}],a=1024;u.forEach(function(b){var h=b.demux;a=Math.max(a,h.minProbeByteLength)});var i=function(){function b(d,o,s,C,y){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 R.default,this.observer=d,this.typeSupported=o,this.config=s,this.vendor=C,this.id=y}var h=b.prototype;return h.configure=function(o){this.transmuxConfig=o,this.decrypter&&this.decrypter.reset()},h.push=function(o,s,C,y){var x=this,P=C.transmuxing;P.executeStart=g();var j=new Uint8Array(o),Y=this.cache,Q=this.config,X=this.currentTransmuxState,F=this.transmuxConfig;y&&(this.currentTransmuxState=y);var $=c(j,s);if($&&$.method==="AES-128"){var re=this.getDecrypter();if(Q.enableSoftwareAES){var se=re.softwareDecrypt(j,$.key.buffer,$.iv.buffer);if(!se)return P.executeEnd=g(),S(C);j=new Uint8Array(se)}else return this.decryptionPromise=re.webCryptoDecrypt(j,$.key.buffer,$.iv.buffer).then(function(Ye){var rt=x.push(Ye,null,C);return x.decryptionPromise=null,rt}),this.decryptionPromise}var he=y||X,_e=he.contiguous,xe=he.discontinuity,Ce=he.trackSwitch,Oe=he.accurateTimeOffset,De=he.timeOffset,pe=F.audioCodec,ue=F.videoCodec,Me=F.defaultInitPts,at=F.duration,lt=F.initSegmentData;if((xe||Ce)&&this.resetInitSegment(lt,pe,ue,at),xe&&this.resetInitialTimestamp(Me),_e||this.resetContiguity(),this.needsProbing(j,xe,Ce)){if(Y.dataLength){var et=Y.flush();j=Object(_.appendUint8Array)(et,j)}this.configureTransmuxer(j,F)}var Qe=this.transmux(j,$,De,Oe,C),je=this.currentTransmuxState;return je.contiguous=!0,je.discontinuity=!1,je.trackSwitch=!1,P.executeEnd=g(),Qe},h.flush=function(o){var s=this,C=o.transmuxing;C.executeStart=g();var y=this.decrypter,x=this.cache,P=this.currentTransmuxState,j=this.decryptionPromise;if(j)return j.then(function(){return s.flush(o)});var Y=[],Q=P.timeOffset;if(y){var X=y.flush();X&&Y.push(this.push(X,null,o))}var F=x.dataLength;x.reset();var $=this.demuxer,re=this.remuxer;if(!$||!re)return F>=a&&this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),C.executeEnd=g(),[S(o)];var se=$.flush(Q);return v(se)?se.then(function(he){return s.flushRemux(Y,he,o),Y}):(this.flushRemux(Y,se,o),Y)},h.flushRemux=function(o,s,C){var y=s.audioTrack,x=s.avcTrack,P=s.id3Track,j=s.textTrack,Y=this.currentTransmuxState,Q=Y.accurateTimeOffset,X=Y.timeOffset;E.logger.log("[transmuxer.ts]: Flushed fragment "+C.sn+(C.part>-1?" p: "+C.part:"")+" of level "+C.level);var F=this.remuxer.remux(y,x,P,j,X,Q,!0,this.id);o.push({remuxResult:F,chunkMeta:C}),C.transmuxing.executeEnd=g()},h.resetInitialTimestamp=function(o){var s=this.demuxer,C=this.remuxer;if(!s||!C)return;s.resetTimeStamp(o),C.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,C,y){var x=this.demuxer,P=this.remuxer;if(!x||!P)return;x.resetInitSegment(s,C,y),P.resetInitSegment(o,s,C)},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,C,y,x){var P;return s&&s.method==="SAMPLE-AES"?P=this.transmuxSampleAes(o,s,C,y,x):P=this.transmuxUnencrypted(o,C,y,x),P},h.transmuxUnencrypted=function(o,s,C,y){var x=this.demuxer.demux(o,s,!1,!this.config.progressive),P=x.audioTrack,j=x.avcTrack,Y=x.id3Track,Q=x.textTrack,X=this.remuxer.remux(P,j,Y,Q,s,C,!1,this.id);return{remuxResult:X,chunkMeta:y}},h.transmuxSampleAes=function(o,s,C,y,x){var P=this;return this.demuxer.demuxSampleAes(o,s,C).then(function(j){var Y=P.remuxer.remux(j.audioTrack,j.avcTrack,j.id3Track,j.textTrack,C,y,!1,P.id);return{remuxResult:Y,chunkMeta:x}})},h.configureTransmuxer=function(o,s){for(var C=this.config,y=this.observer,x=this.typeSupported,P=this.vendor,j=s.audioCodec,Y=s.defaultInitPts,Q=s.duration,X=s.initSegmentData,F=s.videoCodec,$,re=0,se=u.length;re<se;re++)if(u[re].demux.probe(o)){$=u[re];break}$||(E.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),$={demux:N.default,remux:O.default});var he=this.demuxer,_e=this.remuxer,xe=$.remux,Ce=$.demux;(!_e||!(_e instanceof xe))&&(this.remuxer=new xe(y,C,x,P)),(!he||!(he instanceof Ce))&&(this.demuxer=new Ce(y,C,x),this.probe=Ce.probe),this.resetInitSegment(X,j,F,Q),this.resetInitialTimestamp(Y)},h.needsProbing=function(o,s,C){return!this.demuxer||!this.remuxer||s||C},h.getDecrypter=function(){var o=this.decrypter;return o||(o=this.decrypter=new w.default(this.observer,this.config)),o},b}();function c(b,h){var d=null;return b.byteLength>0&&h!=null&&h.key!=null&&h.iv!==null&&h.method!=null&&(d=h),d}var S=function(h){return{remuxResult:{},chunkMeta:h}};function v(b){return"then"in b&&b.then instanceof Function}var p=function(h,d,o,s,C){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=C},D=function(h,d,o,s,C){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=C}},"./src/demux/tsdemuxer.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"discardEPB",function(){return S});var K=L("./src/demux/adts.ts"),I=L("./src/demux/mpegaudio.ts"),w=L("./src/demux/exp-golomb.ts"),B=L("./src/demux/id3.ts"),N=L("./src/demux/sample-aes.ts"),A=L("./src/events.ts"),k=L("./src/utils/mp4-tools.ts"),m=L("./src/utils/logger.ts"),O=L("./src/errors.ts"),R={video:1,audio:2,id3:3,text:4},_=function(){function v(D,b,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=b,this.typeSupported=h}v.probe=function(b){var h=v.syncOffset(b);return h<0?!1:(h&&m.logger.warn("MPEG2-TS detected but first sync word found @ offset "+h+", junk ahead ?"),!0)},v.syncOffset=function(b){for(var h=Math.min(1e3,b.length-3*188),d=0;d<h;){if(b[d]===71&&b[d+188]===71&&b[d+2*188]===71)return d;d++}return-1},v.createTrack=function(b,h){return{container:b==="video"||b==="audio"?"video/mp2t":void 0,type:b,id:R[b],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:b==="audio"?h:void 0}};var p=v.prototype;return p.resetInitSegment=function(b,h,d){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=v.createTrack("video",d),this._audioTrack=v.createTrack("audio",d),this._id3Track=v.createTrack("id3",d),this._txtTrack=v.createTrack("text",d),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=b,this.videoCodec=h,this._duration=d},p.resetTimeStamp=function(){},p.resetContiguity=function(){var b=this._audioTrack,h=this._avcTrack,d=this._id3Track;b&&(b.pesData=null),h&&(h.pesData=null),d&&(d.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},p.demux=function(b,h,d,o){d===void 0&&(d=!1),o===void 0&&(o=!1),d||(this.sampleAes=null);var s,C=this._avcTrack,y=this._audioTrack,x=this._id3Track,P=C.pid,j=C.pesData,Y=y.pid,Q=x.pid,X=y.pesData,F=x.pesData,$=!1,re=this.pmtParsed,se=this._pmtId,he=b.length;if(this.remainderData&&(b=Object(k.appendUint8Array)(this.remainderData,b),he=b.length,this.remainderData=null),he<188&&!o)return this.remainderData=b,{audioTrack:y,avcTrack:C,id3Track:x,textTrack:this._txtTrack};var _e=Math.max(0,v.syncOffset(b));he-=(he+_e)%188,he<b.byteLength&&!o&&(this.remainderData=new Uint8Array(b.buffer,he,b.buffer.byteLength-he));for(var xe=_e;xe<he;xe+=188)if(b[xe]===71){var Ce=!!(b[xe+1]&64),Oe=((b[xe+1]&31)<<8)+b[xe+2],De=(b[xe+3]&48)>>4,pe=void 0;if(De>1){if(pe=xe+5+b[xe+4],pe===xe+188)continue}else pe=xe+4;switch(Oe){case P:Ce&&(j&&(s=a(j))&&this.parseAVCPES(s,!1),j={data:[],size:0}),j&&(j.data.push(b.subarray(pe,xe+188)),j.size+=xe+188-pe);break;case Y:Ce&&(X&&(s=a(X))&&(y.isAAC?this.parseAACPES(s):this.parseMPEGPES(s)),X={data:[],size:0}),X&&(X.data.push(b.subarray(pe,xe+188)),X.size+=xe+188-pe);break;case Q:Ce&&(F&&(s=a(F))&&this.parseID3PES(s),F={data:[],size:0}),F&&(F.data.push(b.subarray(pe,xe+188)),F.size+=xe+188-pe);break;case 0:Ce&&(pe+=b[pe]+1),se=this._pmtId=g(b,pe);break;case se:{Ce&&(pe+=b[pe]+1);var ue=u(b,pe,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,d);P=ue.avc,P>0&&(C.pid=P),Y=ue.audio,Y>0&&(y.pid=Y,y.isAAC=ue.isAAC),Q=ue.id3,Q>0&&(x.pid=Q),$&&!re&&(m.logger.log("reparse from beginning"),$=!1,xe=_e-188),re=this.pmtParsed=!0;break}case 17:case 8191:break;default:$=!0;break}}else this.observer.emit(A.Events.ERROR,A.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});C.pesData=j,y.pesData=X,x.pesData=F;var Me={audioTrack:y,avcTrack:C,id3Track:x,textTrack:this._txtTrack};return o&&this.extractRemainingSamples(Me),Me},p.flush=function(){var b=this.remainderData;this.remainderData=null;var h;return b?h=this.demux(b,-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},p.extractRemainingSamples=function(b){var h=b.audioTrack,d=b.avcTrack,o=b.id3Track,s=d.pesData,C=h.pesData,y=o.pesData,x;s&&(x=a(s))?(this.parseAVCPES(x,!0),d.pesData=null):d.pesData=s,C&&(x=a(C))?(h.isAAC?this.parseAACPES(x):this.parseMPEGPES(x),h.pesData=null):(C!=null&&C.size&&m.logger.log("last AAC PES packet truncated,might overlap between fragments"),h.pesData=C),y&&(x=a(y))?(this.parseID3PES(x),o.pesData=null):o.pesData=y},p.demuxSampleAes=function(b,h,d){var o=this.demux(b,d,!0,!this.config.progressive),s=this.sampleAes=new N.default(this.observer,this.config,h);return this.decrypt(o,s)},p.decrypt=function(b,h){return new Promise(function(d){var o=b.audioTrack,s=b.avcTrack;o.samples&&o.isAAC?h.decryptAacSamples(o.samples,0,function(){s.samples?h.decryptAvcSamples(s.samples,0,0,function(){d(b)}):d(b)}):s.samples&&h.decryptAvcSamples(s.samples,0,0,function(){d(b)})})},p.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},p.parseAVCPES=function(b,h){var d=this,o=this._avcTrack,s=this.parseAVCNALu(b.data),C=!1,y=this.avcSample,x,P=!1;b.data=null,y&&s.length&&!o.audFound&&(i(y,o),y=this.avcSample=E(!1,b.pts,b.dts,"")),s.forEach(function(j){switch(j.type){case 1:{x=!0,y||(y=d.avcSample=E(!0,b.pts,b.dts,"")),C&&(y.debug+="NDR "),y.frame=!0;var Y=j.data;if(P&&Y.length>4){var Q=new w.default(Y).readSliceType();(Q===2||Q===4||Q===7||Q===9)&&(y.key=!0)}break}case 5:x=!0,y||(y=d.avcSample=E(!0,b.pts,b.dts,"")),C&&(y.debug+="IDR "),y.key=!0,y.frame=!0;break;case 6:{x=!0,C&&y&&(y.debug+="SEI ");var X=new w.default(S(j.data));X.readUByte();for(var F=0,$=0,re=!1,se=0;!re&&X.bytesAvailable>1;){F=0;do se=X.readUByte(),F+=se;while(se===255);$=0;do se=X.readUByte(),$+=se;while(se===255);if(F===4&&X.bytesAvailable!==0){re=!0;var he=X.readUByte();if(he===181){var _e=X.readUShort();if(_e===49){var xe=X.readUInt();if(xe===1195456820){var Ce=X.readUByte();if(Ce===3){for(var Oe=X.readUByte(),De=X.readUByte(),pe=31&Oe,ue=[Oe,De],Me=0;Me<pe;Me++)ue.push(X.readUByte()),ue.push(X.readUByte()),ue.push(X.readUByte());c(d._txtTrack.samples,{type:3,pts:b.pts,bytes:ue})}}}}}else if(F===5&&X.bytesAvailable!==0){if(re=!0,$>16){for(var at=[],lt=0;lt<16;lt++)at.push(X.readUByte().toString(16)),(lt===3||lt===5||lt===7||lt===9)&&at.push("-");for(var et=$-16,Qe=new Uint8Array(et),je=0;je<et;je++)Qe[je]=X.readUByte();c(d._txtTrack.samples,{pts:b.pts,payloadType:F,uuid:at.join(""),userData:Object(B.utf8ArrayToStr)(Qe),userDataBytes:Qe})}}else if($<X.bytesAvailable)for(var Ye=0;Ye<$;Ye++)X.readUByte()}break}case 7:if(x=!0,P=!0,C&&y&&(y.debug+="SPS "),!o.sps){var rt=new w.default(j.data),mt=rt.readSPS();o.width=mt.width,o.height=mt.height,o.pixelRatio=mt.pixelRatio,o.sps=[j.data],o.duration=d._duration;for(var ot=j.data.subarray(1,4),qe="avc1.",Xe=0;Xe<3;Xe++){var Ct=ot[Xe].toString(16);Ct.length<2&&(Ct="0"+Ct),qe+=Ct}o.codec=qe}break;case 8:x=!0,C&&y&&(y.debug+="PPS "),o.pps||(o.pps=[j.data]);break;case 9:x=!1,o.audFound=!0,y&&i(y,o),y=d.avcSample=E(!1,b.pts,b.dts,C?"AUD ":"");break;case 12:x=!1;break;default:x=!1,y&&(y.debug+="unknown NAL "+j.type+" ");break}if(y&&x){var xt=y.units;xt.push(j)}}),h&&y&&(i(y,o),this.avcSample=null)},p.getLastNalUnit=function(){var b,h=this.avcSample,d;if(!h||h.units.length===0){var o=this._avcTrack.samples;h=o[o.length-1]}if((b=h)!==null&&b!==void 0&&b.units){var s=h.units;d=s[s.length-1]}return d},p.parseAVCNALu=function(b){var h=b.byteLength,d=this._avcTrack,o=d.naluState||0,s=o,C=[],y=0,x,P,j,Y=-1,Q=0;for(o===-1&&(Y=0,Q=b[0]&31,o=0,y=1);y<h;){if(x=b[y++],!o){o=x?0:1;continue}if(o===1){o=x?0:2;continue}if(!x)o=3;else if(x===1){if(Y>=0){var X={data:b.subarray(Y,y-o-1),type:Q};C.push(X)}else{var F=this.getLastNalUnit();if(F&&(s&&y<=4-s&&(F.state&&(F.data=F.data.subarray(0,F.data.byteLength-s))),P=y-o-1,P>0)){var $=new Uint8Array(F.data.byteLength+P);$.set(F.data,0),$.set(b.subarray(0,P),F.data.byteLength),F.data=$,F.state=0}}y<h?(j=b[y]&31,Y=y,Q=j,o=0):o=-1}else o=0}if(Y>=0&&o>=0){var re={data:b.subarray(Y,h),type:Q,state:o};C.push(re)}if(C.length===0){var se=this.getLastNalUnit();if(se){var he=new Uint8Array(se.data.byteLength+b.byteLength);he.set(se.data,0),he.set(b,se.data.byteLength),se.data=he}}return d.naluState=o,C},p.parseAACPES=function(b){var h=0,d=this._audioTrack,o=this.aacOverFlow,s=b.data;if(o){this.aacOverFlow=null;var C=o.sample.unit.byteLength,y=Math.min(o.missing,C),x=C-y;o.sample.unit.set(s.subarray(0,y),x),d.samples.push(o.sample),h=o.missing}var P,j;for(P=h,j=s.length;P<j-1&&!K.isHeader(s,P);P++);if(P!==h){var Y,Q;if(P<j-1?(Y="AAC PES did not start with ADTS header,offset:"+P,Q=!1):(Y="no ADTS header found in AAC PES",Q=!0),m.logger.warn("parsing error:"+Y),this.observer.emit(A.Events.ERROR,A.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.FRAG_PARSING_ERROR,fatal:Q,reason:Y}),Q)return}K.initTrackConfig(d,this.observer,s,P,this.audioCodec);var X;if(b.pts!==void 0)X=b.pts;else if(o){var F=K.getFrameDuration(d.samplerate);X=o.sample.pts+F}else{m.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var $=0;P<j;)if(K.isHeader(s,P)){if(P+5<j){var re=K.appendFrame(d,s,P,X,$);if(re)if(re.missing)this.aacOverFlow=re;else{P+=re.length,$++;continue}}break}else P++},p.parseMPEGPES=function(b){var h=b.data,d=h.length,o=0,s=0,C=b.pts;if(C===void 0){m.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;s<d;)if(I.isHeader(h,s)){var y=I.appendFrame(this._audioTrack,h,s,C,o);if(y)s+=y.length,o++;else break}else s++},p.parseID3PES=function(b){if(b.pts===void 0){m.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(b)},v}();_.minProbeByteLength=188;function E(v,p,D,b){return{key:v,frame:!1,pts:p,dts:D,units:[],debug:b,length:0}}function g(v,p){return(v[p+10]&31)<<8|v[p+11]}function u(v,p,D,b){var h={audio:-1,avc:-1,id3:-1,isAAC:!0},d=(v[p+1]&15)<<8|v[p+2],o=p+3+d-4,s=(v[p+10]&15)<<8|v[p+11];for(p+=12+s;p<o;){var C=(v[p+1]&31)<<8|v[p+2];switch(v[p]){case 207:if(!b){m.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:h.audio===-1&&(h.audio=C);break;case 21:h.id3===-1&&(h.id3=C);break;case 219:if(!b){m.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:h.avc===-1&&(h.avc=C);break;case 3:case 4:D?h.audio===-1&&(h.audio=C,h.isAAC=!1):m.logger.log("MPEG audio found, not supported in this browser");break;case 36:m.logger.warn("Unsupported HEVC stream type found");break;default:break}p+=((v[p+3]&15)<<8|v[p+4])+5}return h}function a(v){var p=0,D,b,h,d,o,s=v.data;if(!v||v.size===0)return null;for(;s[0].length<19&&s.length>1;){var C=new Uint8Array(s[0].length+s[1].length);C.set(s[0]),C.set(s[1],s[0].length),s[0]=C,s.splice(1,1)}D=s[0];var y=(D[0]<<16)+(D[1]<<8)+D[2];if(y===1){if(b=(D[4]<<8)+D[5],b&&b>v.size-6)return null;var x=D[7];x&192&&(d=(D[9]&14)*536870912+(D[10]&255)*4194304+(D[11]&254)*16384+(D[12]&255)*128+(D[13]&254)/2,x&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&&(m.logger.warn(Math.round((d-o)/9e4)+"s delta between PTS and DTS, align them"),d=o)):o=d),h=D[8];var P=h+9;if(v.size<=P)return null;v.size-=P;for(var j=new Uint8Array(v.size),Y=0,Q=s.length;Y<Q;Y++){D=s[Y];var X=D.byteLength;if(P)if(P>X){P-=X;continue}else D=D.subarray(P),X-=P,P=0;j.set(D,p),p+=X}return b&&(b-=h+3),{data:j,pts:d,dts:o,len:b}}return null}function i(v,p){if(v.units.length&&v.frame){if(v.pts===void 0){var D=p.samples,b=D.length;if(b){var h=D[b-1];v.pts=h.pts,v.dts=h.dts}else{p.dropped++;return}}p.samples.push(v)}v.debug.length&&m.logger.log(v.pts+"/"+v.dts+":"+v.debug)}function c(v,p){var D=v.length;if(D>0){if(p.pts>=v[D-1].pts)v.push(p);else for(var b=D-1;b>=0;b--)if(p.pts<v[b].pts){v.splice(b,0,p);break}}else v.push(p)}function S(v){for(var p=v.byteLength,D=[],b=1;b<p-2;)v[b]===0&&v[b+1]===0&&v[b+2]===3?(D.push(b+2),b+=2):b++;if(D.length===0)return v;var h=p-D.length,d=new Uint8Array(h),o=0;for(b=0;b<h;o++,b++)o===D[0]&&(o++,D.shift()),d[b]=v[o];return d}z.default=_},"./src/errors.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"ErrorTypes",function(){return K}),L.d(z,"ErrorDetails",function(){return I});var K;(function(w){w.NETWORK_ERROR="networkError",w.MEDIA_ERROR="mediaError",w.KEY_SYSTEM_ERROR="keySystemError",w.MUX_ERROR="muxError",w.OTHER_ERROR="otherError"})(K||(K={}));var I;(function(w){w.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",w.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",w.KEY_SYSTEM_NO_SESSION="keySystemNoSession",w.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",w.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",w.MANIFEST_LOAD_ERROR="manifestLoadError",w.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",w.MANIFEST_PARSING_ERROR="manifestParsingError",w.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",w.LEVEL_EMPTY_ERROR="levelEmptyError",w.LEVEL_LOAD_ERROR="levelLoadError",w.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",w.LEVEL_SWITCH_ERROR="levelSwitchError",w.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",w.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",w.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",w.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",w.FRAG_LOAD_ERROR="fragLoadError",w.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",w.FRAG_DECRYPT_ERROR="fragDecryptError",w.FRAG_PARSING_ERROR="fragParsingError",w.REMUX_ALLOC_ERROR="remuxAllocError",w.KEY_LOAD_ERROR="keyLoadError",w.KEY_LOAD_TIMEOUT="keyLoadTimeOut",w.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",w.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",w.BUFFER_APPEND_ERROR="bufferAppendError",w.BUFFER_APPENDING_ERROR="bufferAppendingError",w.BUFFER_STALLED_ERROR="bufferStalledError",w.BUFFER_FULL_ERROR="bufferFullError",w.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",w.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",w.INTERNAL_EXCEPTION="internalException",w.INTERNAL_ABORTED="aborted",w.UNKNOWN="unknown"})(I||(I={}))},"./src/events.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"Events",function(){return K});var K;(function(I){I.MEDIA_ATTACHING="hlsMediaAttaching",I.MEDIA_ATTACHED="hlsMediaAttached",I.MEDIA_DETACHING="hlsMediaDetaching",I.MEDIA_DETACHED="hlsMediaDetached",I.BUFFER_RESET="hlsBufferReset",I.BUFFER_CODECS="hlsBufferCodecs",I.BUFFER_CREATED="hlsBufferCreated",I.BUFFER_APPENDING="hlsBufferAppending",I.BUFFER_APPENDED="hlsBufferAppended",I.BUFFER_EOS="hlsBufferEos",I.BUFFER_FLUSHING="hlsBufferFlushing",I.BUFFER_FLUSHED="hlsBufferFlushed",I.MANIFEST_LOADING="hlsManifestLoading",I.MANIFEST_LOADED="hlsManifestLoaded",I.MANIFEST_PARSED="hlsManifestParsed",I.LEVEL_SWITCHING="hlsLevelSwitching",I.LEVEL_SWITCHED="hlsLevelSwitched",I.LEVEL_LOADING="hlsLevelLoading",I.LEVEL_LOADED="hlsLevelLoaded",I.LEVEL_UPDATED="hlsLevelUpdated",I.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",I.LEVELS_UPDATED="hlsLevelsUpdated",I.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",I.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",I.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",I.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",I.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",I.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",I.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",I.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",I.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",I.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",I.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",I.CUES_PARSED="hlsCuesParsed",I.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",I.INIT_PTS_FOUND="hlsInitPtsFound",I.FRAG_LOADING="hlsFragLoading",I.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",I.FRAG_LOADED="hlsFragLoaded",I.FRAG_DECRYPTED="hlsFragDecrypted",I.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",I.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",I.FRAG_PARSING_METADATA="hlsFragParsingMetadata",I.FRAG_PARSED="hlsFragParsed",I.FRAG_BUFFERED="hlsFragBuffered",I.FRAG_CHANGED="hlsFragChanged",I.FPS_DROP="hlsFpsDrop",I.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",I.ERROR="hlsError",I.DESTROYING="hlsDestroying",I.KEY_LOADING="hlsKeyLoading",I.KEY_LOADED="hlsKeyLoaded",I.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",I.BACK_BUFFER_REACHED="hlsBackBufferReached"})(K||(K={}))},"./src/hls.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return v});var K=L("./node_modules/url-toolkit/src/url-toolkit.js"),I=L.n(K),w=L("./src/loader/playlist-loader.ts"),B=L("./src/loader/key-loader.ts"),N=L("./src/controller/id3-track-controller.ts"),A=L("./src/controller/latency-controller.ts"),k=L("./src/controller/level-controller.ts"),m=L("./src/controller/fragment-tracker.ts"),O=L("./src/controller/stream-controller.ts"),R=L("./src/is-supported.ts"),_=L("./src/utils/logger.ts"),E=L("./src/config.ts"),g=L("./node_modules/eventemitter3/index.js"),u=L.n(g),a=L("./src/events.ts"),i=L("./src/errors.ts");function c(p,D){for(var b=0;b<D.length;b++){var h=D[b];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(p,h.key,h)}}function S(p,D,b){return D&&c(p.prototype,D),b&&c(p,b),p}var v=function(){p.isSupported=function(){return Object(R.isSupported)()};function p(b){b===void 0&&(b={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new g.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(E.mergeConfig)(p.DefaultConfig,b);this.userConfig=b,Object(_.enableLogs)(h.debug),this._autoLevelCapping=-1,h.progressive&&Object(E.enableStreamingMode)(h);var d=h.abrController,o=h.bufferController,s=h.capLevelController,C=h.fpsController,y=this.abrController=new d(this),x=this.bufferController=new o(this),P=this.capLevelController=new s(this),j=new C(this),Y=new w.default(this),Q=new B.default(this),X=new N.default(this),F=this.levelController=new k.default(this),$=new m.FragmentTracker(this),re=this.streamController=new O.default(this,$);P.setStreamController(re),j.setStreamController(re);var se=[F,re];this.networkControllers=se;var he=[Y,Q,y,x,P,j,X,$];this.audioTrackController=this.createController(h.audioTrackController,null,se),this.createController(h.audioStreamController,$,se),this.subtitleTrackController=this.createController(h.subtitleTrackController,null,se),this.createController(h.subtitleStreamController,$,se),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(A.default,null,he),this.coreComponents=he}var D=p.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){_.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:i.ErrorTypes.OTHER_ERROR,details:i.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:h,error:o})}return!1},D.listenerCount=function(h){return this._emitter.listenerCount(h)},D.destroy=function(){_.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){_.logger.log("attachMedia"),this._media=h,this.trigger(a.Events.MEDIA_ATTACHING,{media:h})},D.detachMedia=function(){_.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=K.buildAbsoluteURL(self.location.href,h,{alwaysNormalize:!0});_.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),_.logger.log("startLoad("+h+")"),this.networkControllers.forEach(function(d){d.startLoad(h)})},D.stopLoad=function(){_.logger.log("stopLoad"),this.networkControllers.forEach(function(h){h.stopLoad()})},D.swapAudioCodec=function(){_.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},D.recoverMediaError=function(){_.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)},S(p,[{key:"levels",get:function(){var h=this.levelController.levels;return h||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(h){_.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){_.logger.log("set nextLevel:"+h),this.levelController.manualLevel=h,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(h){_.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){_.logger.log("set firstLevel:"+h),this.levelController.firstLevel=h}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(h){_.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&&(_.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 i.ErrorTypes}},{key:"ErrorDetails",get:function(){return i.ErrorDetails}},{key:"DefaultConfig",get:function(){return p.defaultConfig?p.defaultConfig:E.hlsDefaultConfig},set:function(h){p.defaultConfig=h}}]),p}();v.defaultConfig=void 0},"./src/is-supported.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"isSupported",function(){return w}),L.d(z,"changeTypeSupported",function(){return B});var K=L("./src/utils/mediasource-helper.ts");function I(){return self.SourceBuffer||self.WebKitSourceBuffer}function w(){var N=Object(K.getMediaSource)();if(!N)return!1;var A=I(),k=N&&typeof N.isTypeSupported=="function"&&N.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),m=!A||A.prototype&&typeof A.prototype.appendBuffer=="function"&&typeof A.prototype.remove=="function";return!!k&&!!m}function B(){var N,A=I();return typeof(A==null||((N=A.prototype)===null||N===void 0)?void 0:N.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return _}),L.d(z,"LoadError",function(){return g});var K=L("./src/polyfills/number.ts"),I=L("./src/errors.ts");function w(u,a){u.prototype=Object.create(a.prototype),u.prototype.constructor=u,m(u,a)}function B(u){var a=typeof Map=="function"?new Map:void 0;return B=function(c){if(c===null||!k(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,S)}function S(){return N(c,arguments,O(this).constructor)}return S.prototype=Object.create(c.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),m(S,c)},B(u)}function N(u,a,i){return A()?N=Reflect.construct:N=function(S,v,p){var D=[null];D.push.apply(D,v);var b=Function.bind.apply(S,D),h=new b;return p&&m(h,p.prototype),h},N.apply(null,arguments)}function A(){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(u){return!1}}function k(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function m(u,a){return m=Object.setPrototypeOf||function(c,S){return c.__proto__=S,c},m(u,a)}function O(u){return O=Object.setPrototypeOf?Object.getPrototypeOf:function(i){return i.__proto__||Object.getPrototypeOf(i)},O(u)}var R=Math.pow(2,17),_=function(){function u(i){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=i}var a=u.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,S){var v=this,p=c.url;if(!p)return Promise.reject(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,networkDetails:null},"Fragment does not have a "+(p?"part list":"url")));this.abort();var D=this.config,b=D.fLoader,h=D.loader;return new Promise(function(d,o){v.loader&&v.loader.destroy();var s=v.loader=c.loader=b?new b(D):new h(D),C=E(c),y={timeout:D.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:D.fragLoadingMaxRetryTimeout,highWaterMark:R};c.stats=s.stats,s.load(C,y,{onSuccess:function(P,j,Y,Q){v.resetLoader(c,s),d({frag:c,part:null,payload:P.data,networkDetails:Q})},onError:function(P,j,Y){v.resetLoader(c,s),o(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,response:P,networkDetails:Y}))},onAbort:function(P,j,Y){v.resetLoader(c,s),o(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:c,networkDetails:Y}))},onTimeout:function(P,j,Y){v.resetLoader(c,s),o(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:c,networkDetails:Y}))},onProgress:function(P,j,Y,Q){S&&S({frag:c,part:null,payload:Y,networkDetails:Q})}})})},a.loadPart=function(c,S,v){var p=this;this.abort();var D=this.config,b=D.fLoader,h=D.loader;return new Promise(function(d,o){p.loader&&p.loader.destroy();var s=p.loader=c.loader=b?new b(D):new h(D),C=E(c,S),y={timeout:D.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:D.fragLoadingMaxRetryTimeout,highWaterMark:R};S.stats=s.stats,s.load(C,y,{onSuccess:function(P,j,Y,Q){p.resetLoader(c,s),p.updateStatsFromPart(c,S);var X={frag:c,part:S,payload:P.data,networkDetails:Q};v(X),d(X)},onError:function(P,j,Y){p.resetLoader(c,s),o(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,part:S,response:P,networkDetails:Y}))},onAbort:function(P,j,Y){c.stats.aborted=S.stats.aborted,p.resetLoader(c,s),o(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:c,part:S,networkDetails:Y}))},onTimeout:function(P,j,Y){p.resetLoader(c,s),o(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:c,part:S,networkDetails:Y}))}})})},a.updateStatsFromPart=function(c,S){var v=c.stats,p=S.stats,D=p.total;if(v.loaded+=p.loaded,D){var b=Math.round(c.duration/S.duration),h=Math.min(Math.round(v.loaded/D),b),d=b-h,o=d*Math.round(v.loaded/h);v.total=v.loaded+o}else v.total=Math.max(v.loaded,v.total);var s=v.loading,C=p.loading;s.start?s.first+=C.first-C.start:(s.start=C.start,s.first=C.first),s.end=C.end},a.resetLoader=function(c,S){c.loader=null,this.loader===S&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),S.destroy()},u}();function E(u,a){a===void 0&&(a=null);var i=a||u,c={frag:u,part:a,responseType:"arraybuffer",url:i.url,headers:{},rangeStart:0,rangeEnd:0},S=i.byteRangeStartOffset,v=i.byteRangeEndOffset;return Object(K.isFiniteNumber)(S)&&Object(K.isFiniteNumber)(v)&&(c.rangeStart=S,c.rangeEnd=v),c}var g=function(u){w(a,u);function a(i){for(var c,S=arguments.length,v=new Array(S>1?S-1:0),p=1;p<S;p++)v[p-1]=arguments[p];return c=u.call.apply(u,[this].concat(v))||this,c.data=void 0,c.data=i,c}return a}(B(Error))},"./src/loader/fragment.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"ElementaryStreamTypes",function(){return _}),L.d(z,"BaseSegment",function(){return E}),L.d(z,"Fragment",function(){return g}),L.d(z,"Part",function(){return u});var K=L("./src/polyfills/number.ts"),I=L("./node_modules/url-toolkit/src/url-toolkit.js"),w=L.n(I),B=L("./src/utils/logger.ts"),N=L("./src/loader/level-key.ts"),A=L("./src/loader/load-stats.ts");function k(a,i){a.prototype=Object.create(i.prototype),a.prototype.constructor=a,m(a,i)}function m(a,i){return m=Object.setPrototypeOf||function(S,v){return S.__proto__=v,S},m(a,i)}function O(a,i){for(var c=0;c<i.length;c++){var S=i[c];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(a,S.key,S)}}function R(a,i,c){return i&&O(a.prototype,i),c&&O(a,c),a}var _;(function(a){a.AUDIO="audio",a.VIDEO="video",a.AUDIOVIDEO="audiovideo"})(_||(_={}));var E=function(){function a(c){var S;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(S={},S[_.AUDIO]=null,S[_.VIDEO]=null,S[_.AUDIOVIDEO]=null,S),this.baseurl=c}var i=a.prototype;return i.setByteRange=function(S,v){var p=S.split("@",2),D=[];p.length===1?D[0]=v?v.byteRangeEndOffset:0:D[0]=parseInt(p[1]),D[1]=parseInt(p[0])+D[0],this._byteRange=D},R(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(I.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(S){this._url=S}}]),a}(),g=function(a){k(i,a);function i(S,v){var p;return p=a.call(this,v)||this,p._decryptdata=null,p.rawProgramDateTime=null,p.programDateTime=null,p.tagList=[],p.duration=0,p.sn=0,p.levelkey=void 0,p.type=void 0,p.loader=null,p.level=-1,p.cc=0,p.startPTS=void 0,p.endPTS=void 0,p.appendedPTS=void 0,p.startDTS=void 0,p.endDTS=void 0,p.start=0,p.deltaPTS=void 0,p.maxStartPTS=void 0,p.minEndPTS=void 0,p.stats=new A.LoadStats,p.urlId=0,p.data=void 0,p.bitrateTest=!1,p.title=null,p.initSegment=null,p.type=S,p}var c=i.prototype;return c.createInitializationVector=function(v){for(var p=new Uint8Array(16),D=12;D<16;D++)p[D]=v>>8*(15-D)&255;return p},c.setDecryptDataFromLevelKey=function(v,p){var D=v;return(v==null?void 0:v.method)==="AES-128"&&v.uri&&!v.iv&&(D=N.LevelKey.fromURI(v.uri),D.method=v.method,D.iv=this.createInitializationVector(p),D.keyFormat="identity"),D},c.setElementaryStreamInfo=function(v,p,D,b,h,d){d===void 0&&(d=!1);var o=this.elementaryStreams,s=o[v];if(!s){o[v]={startPTS:p,endPTS:D,startDTS:b,endDTS:h,partial:d};return}s.startPTS=Math.min(s.startPTS,p),s.endPTS=Math.max(s.endPTS,D),s.startDTS=Math.min(s.startDTS,b),s.endDTS=Math.max(s.endDTS,h)},c.clearElementaryStreamInfo=function(){var v=this.elementaryStreams;v[_.AUDIO]=null,v[_.VIDEO]=null,v[_.AUDIOVIDEO]=null},R(i,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var v=this.sn;typeof v!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&B.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),v=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,v)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(K.isFiniteNumber)(this.programDateTime))return null;var v=Object(K.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+v*1e3}},{key:"encrypted",get:function(){var v;return!!((v=this.decryptdata)!==null&&v!==void 0&&v.keyFormat&&this.decryptdata.uri)}}]),i}(E),u=function(a){k(i,a);function i(c,S,v,p,D){var b;b=a.call(this,v)||this,b.fragOffset=0,b.duration=0,b.gap=!1,b.independent=!1,b.relurl=void 0,b.fragment=void 0,b.index=void 0,b.stats=new A.LoadStats,b.duration=c.decimalFloatingPoint("DURATION"),b.gap=c.bool("GAP"),b.independent=c.bool("INDEPENDENT"),b.relurl=c.enumeratedString("URI"),b.fragment=S,b.index=p;var h=c.enumeratedString("BYTERANGE");return h&&b.setByteRange(h,D),D&&(b.fragOffset=D.fragOffset+D.duration),b}return R(i,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var S=this.elementaryStreams;return!!(S.audio||S.video||S.audiovideo)}}]),i}(E)},"./src/loader/key-loader.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return B});var K=L("./src/events.ts"),I=L("./src/errors.ts"),w=L("./src/utils/logger.ts"),B=function(){function N(k){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=k,this._registerListeners()}var A=N.prototype;return A._registerListeners=function(){this.hls.on(K.Events.KEY_LOADING,this.onKeyLoading,this)},A._unregisterListeners=function(){this.hls.off(K.Events.KEY_LOADING,this.onKeyLoading)},A.destroy=function(){this._unregisterListeners();for(var m in this.loaders){var O=this.loaders[m];O&&O.destroy()}this.loaders={}},A.onKeyLoading=function(m,O){var R=O.frag,_=R.type,E=this.loaders[_];if(!R.decryptdata){w.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var g=R.decryptdata.uri;if(g!==this.decrypturl||this.decryptkey===null){var u=this.hls.config;if(E&&(w.logger.warn("abort previous key loader for type:"+_),E.abort()),!g){w.logger.warn("key uri is falsy");return}var a=u.loader,i=R.loader=this.loaders[_]=new a(u);this.decrypturl=g,this.decryptkey=null;var c={url:g,frag:R,responseType:"arraybuffer"},S={timeout:u.fragLoadingTimeOut,maxRetry:0,retryDelay:u.fragLoadingRetryDelay,maxRetryDelay:u.fragLoadingMaxRetryTimeout,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};i.load(c,S,v)}else this.decryptkey&&(R.decryptdata.key=this.decryptkey,this.hls.trigger(K.Events.KEY_LOADED,{frag:R}))},A.loadsuccess=function(m,O,R){var _=R.frag;if(!_.decryptdata){w.logger.error("after key load, decryptdata unset");return}this.decryptkey=_.decryptdata.key=new Uint8Array(m.data),_.loader=null,delete this.loaders[_.type],this.hls.trigger(K.Events.KEY_LOADED,{frag:_})},A.loaderror=function(m,O){var R=O.frag,_=R.loader;_&&_.abort(),delete this.loaders[R.type],this.hls.trigger(K.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:R,response:m})},A.loadtimeout=function(m,O){var R=O.frag,_=R.loader;_&&_.abort(),delete this.loaders[R.type],this.hls.trigger(K.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:R})},N}()},"./src/loader/level-details.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"LevelDetails",function(){return N});var K=L("./src/polyfills/number.ts");function I(A,k){for(var m=0;m<k.length;m++){var O=k[m];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(A,O.key,O)}}function w(A,k,m){return k&&I(A.prototype,k),m&&I(A,m),A}var B=10,N=function(){function A(m){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=m}var k=A.prototype;return k.reloaded=function(O){if(!O){this.advanced=!0,this.updated=!0;return}var R=this.lastPartSn-O.lastPartSn,_=this.lastPartIndex-O.lastPartIndex;this.updated=this.endSN!==O.endSN||!!_||!!R,this.advanced=this.endSN>O.endSN||R>0||R===0&&_>0,this.updated||this.advanced?this.misses=Math.floor(O.misses*.6):this.misses=O.misses+1,this.availabilityDelay=O.availabilityDelay},w(A,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(K.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||B}},{key:"drift",get:function(){var O=this.driftEndTime-this.driftStartTime;if(O>0){var R=this.driftEnd-this.driftStart;return R*1e3/O}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var O;return(O=this.partList)!==null&&O!==void 0&&O.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var O;return(O=this.fragments)!==null&&O!==void 0&&O.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 O;return(O=this.partList)!==null&&O!==void 0&&O.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var O;return(O=this.partList)!==null&&O!==void 0&&O.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),A}()},"./src/loader/level-key.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"LevelKey",function(){return N});var K=L("./node_modules/url-toolkit/src/url-toolkit.js"),I=L.n(K);function w(A,k){for(var m=0;m<k.length;m++){var O=k[m];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(A,O.key,O)}}function B(A,k,m){return k&&w(A.prototype,k),m&&w(A,m),A}var N=function(){A.fromURL=function(m,O){return new A(m,O)},A.fromURI=function(m){return new A(m)};function A(k,m){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,m?this._uri=Object(K.buildAbsoluteURL)(k,m,{alwaysNormalize:!0}):this._uri=k}return B(A,[{key:"uri",get:function(){return this._uri}}]),A}()},"./src/loader/load-stats.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"LoadStats",function(){return K});var K=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(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return i});var K=L("./src/polyfills/number.ts"),I=L("./node_modules/url-toolkit/src/url-toolkit.js"),w=L.n(I),B=L("./src/loader/fragment.ts"),N=L("./src/loader/level-details.ts"),A=L("./src/loader/level-key.ts"),k=L("./src/utils/attr-list.ts"),m=L("./src/utils/logger.ts"),O=L("./src/utils/codecs.ts"),R=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,_=/#EXT-X-MEDIA:(.*)/g,E=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),g=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("|")),u=/\.(mp4|m4s|m4v|m4a)$/i;function a(D){var b,h;return u.test((b=(h=I.parseURL(D))===null||h===void 0?void 0:h.path)!=null?b:"")}var i=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 I.buildAbsoluteURL(d,h,{alwaysNormalize:!0})},D.parseMasterPlaylist=function(h,d){var o=[],s={},C=!1;R.lastIndex=0;for(var y;(y=R.exec(h))!=null;)if(y[1]){var x=new k.AttrList(y[1]),P={attrs:x,bitrate:x.decimalInteger("AVERAGE-BANDWIDTH")||x.decimalInteger("BANDWIDTH"),name:x.NAME,url:D.resolve(y[2],d)},j=x.decimalResolution("RESOLUTION");j&&(P.width=j.width,P.height=j.height),c((x.CODECS||"").split(/[ ,]+/).filter(function(Q){return Q}),P),P.videoCodec&&P.videoCodec.indexOf("avc1")!==-1&&(P.videoCodec=D.convertAVC1ToAVCOTI(P.videoCodec)),o.push(P)}else if(y[3]){var Y=new k.AttrList(y[3]);Y["DATA-ID"]&&(C=!0,s[Y["DATA-ID"]]=Y)}return{levels:o,sessionData:C?s:null}},D.parseMasterPlaylistMedia=function(h,d,o,s){s===void 0&&(s=[]);var C,y=[],x=0;for(_.lastIndex=0;(C=_.exec(h))!==null;){var P=new k.AttrList(C[1]);if(P.TYPE===o){var j={attrs:P,bitrate:0,id:x++,groupId:P["GROUP-ID"],instreamId:P["INSTREAM-ID"],name:P.NAME||P.LANGUAGE||"",type:o,default:P.bool("DEFAULT"),autoselect:P.bool("AUTOSELECT"),forced:P.bool("FORCED"),lang:P.LANGUAGE,url:P.URI?D.resolve(P.URI,d):""};if(s.length){var Y=D.findGroup(s,j.groupId)||s[0];S(j,Y,"audioCodec"),S(j,Y,"textCodec")}y.push(j)}}return y},D.parseLevelPlaylist=function(h,d,o,s,C){var y=new N.LevelDetails(d),x=y.fragments,P=null,j=0,Y=0,Q=0,X=0,F=null,$=new B.Fragment(s,d),re,se,he,_e=-1,xe=!1;for(E.lastIndex=0,y.m3u8=h;(re=E.exec(h))!==null;){xe&&(xe=!1,$=new B.Fragment(s,d),$.start=Q,$.sn=j,$.cc=X,$.level=o,P&&($.initSegment=P,$.rawProgramDateTime=P.rawProgramDateTime));var Ce=re[1];if(Ce){$.duration=parseFloat(Ce);var Oe=(" "+re[2]).slice(1);$.title=Oe||null,$.tagList.push(Oe?["INF",Ce,Oe]:["INF",Ce])}else if(re[3])Object(K.isFiniteNumber)($.duration)&&($.start=Q,he&&($.levelkey=he),$.sn=j,$.level=o,$.cc=X,$.urlId=C,x.push($),$.relurl=(" "+re[3]).slice(1),p($,F),F=$,Q+=$.duration,j++,Y=0,xe=!0);else if(re[4]){var De=(" "+re[4]).slice(1);F?$.setByteRange(De,F):$.setByteRange(De)}else if(re[5])$.rawProgramDateTime=(" "+re[5]).slice(1),$.tagList.push(["PROGRAM-DATE-TIME",$.rawProgramDateTime]),_e===-1&&(_e=x.length);else{if(re=re[0].match(g),!re){m.logger.warn("No matches on slow regex match for level playlist!");continue}for(se=1;se<re.length&&!(typeof re[se]!="undefined");se++);var pe=(" "+re[se]).slice(1),ue=(" "+re[se+1]).slice(1),Me=re[se+2]?(" "+re[se+2]).slice(1):"";switch(pe){case"PLAYLIST-TYPE":y.type=ue.toUpperCase();break;case"MEDIA-SEQUENCE":j=y.startSN=parseInt(ue);break;case"SKIP":{var at=new k.AttrList(ue),lt=at.decimalInteger("SKIPPED-SEGMENTS");if(Object(K.isFiniteNumber)(lt)){y.skippedSegments=lt;for(var et=lt;et--;)x.unshift(null);j+=lt}var Qe=at.enumeratedString("RECENTLY-REMOVED-DATERANGES");Qe&&(y.recentlyRemovedDateranges=Qe.split(" "));break}case"TARGETDURATION":y.targetduration=parseFloat(ue);break;case"VERSION":y.version=parseInt(ue);break;case"EXTM3U":break;case"ENDLIST":y.live=!1;break;case"#":(ue||Me)&&$.tagList.push(Me?[ue,Me]:[ue]);break;case"DIS":X++;case"GAP":$.tagList.push([pe]);break;case"BITRATE":$.tagList.push([pe,ue]);break;case"DISCONTINUITY-SEQ":X=parseInt(ue);break;case"KEY":{var je,Ye=new k.AttrList(ue),rt=Ye.enumeratedString("METHOD"),mt=Ye.URI,ot=Ye.hexadecimalInteger("IV"),qe=Ye.enumeratedString("KEYFORMATVERSIONS"),Xe=Ye.enumeratedString("KEYID"),Ct=(je=Ye.enumeratedString("KEYFORMAT"))!=null?je:"identity",xt=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(xt.indexOf(Ct)>-1){m.logger.warn("Keyformat "+Ct+" is not supported from the manifest");continue}else if(Ct!=="identity")continue;rt&&(he=A.LevelKey.fromURL(d,mt),mt&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(rt)>=0&&(he.method=rt,he.keyFormat=Ct,Xe&&(he.keyID=Xe),qe&&(he.keyFormatVersions=qe),he.iv=ot));break}case"START":{var bt=new k.AttrList(ue),Et=bt.decimalFloatingPoint("TIME-OFFSET");Object(K.isFiniteNumber)(Et)&&(y.startTimeOffset=Et);break}case"MAP":{var At=new k.AttrList(ue);$.relurl=At.URI,At.BYTERANGE&&$.setByteRange(At.BYTERANGE),$.level=o,$.sn="initSegment",he&&($.levelkey=he),$.initSegment=null,P=$,xe=!0;break}case"SERVER-CONTROL":{var St=new k.AttrList(ue);y.canBlockReload=St.bool("CAN-BLOCK-RELOAD"),y.canSkipUntil=St.optionalFloat("CAN-SKIP-UNTIL",0),y.canSkipDateRanges=y.canSkipUntil>0&&St.bool("CAN-SKIP-DATERANGES"),y.partHoldBack=St.optionalFloat("PART-HOLD-BACK",0),y.holdBack=St.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Se=new k.AttrList(ue);y.partTarget=Se.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ee=y.partList;Ee||(Ee=y.partList=[]);var He=Y>0?Ee[Ee.length-1]:void 0,Ge=Y++,Re=new B.Part(new k.AttrList(ue),$,d,Ge,He);Ee.push(Re),$.duration+=Re.duration;break}case"PRELOAD-HINT":{var Ue=new k.AttrList(ue);y.preloadHint=Ue;break}case"RENDITION-REPORT":{var ge=new k.AttrList(ue);y.renditionReports=y.renditionReports||[],y.renditionReports.push(ge);break}default:m.logger.warn("line parsed but not handled: "+re);break}}}F&&!F.relurl?(x.pop(),Q-=F.duration,y.partList&&(y.fragmentHint=F)):y.partList&&(p($,F),$.cc=X,y.fragmentHint=$);var de=x.length,ce=x[0],te=x[de-1];if(Q+=y.skippedSegments*y.targetduration,Q>0&&de&&te){y.averagetargetduration=Q/de;var ie=te.sn;y.endSN=ie!=="initSegment"?ie:0,ce&&(y.startCC=ce.cc,ce.initSegment||y.fragments.every(function(ae){return ae.relurl&&a(ae.relurl)})&&(m.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),$=new B.Fragment(s,d),$.relurl=te.relurl,$.level=o,$.sn="initSegment",ce.initSegment=$,y.needSidxRanges=!0))}else y.endSN=0,y.startCC=0;return y.fragmentHint&&(Q+=y.fragmentHint.duration),y.totalduration=Q,y.endCC=X,_e>0&&v(x,_e),y},D}();function c(D,b){["video","audio","text"].forEach(function(h){var d=D.filter(function(s){return Object(O.isCodecType)(s,h)});if(d.length){var o=d.filter(function(s){return s.lastIndexOf("avc1",0)===0||s.lastIndexOf("mp4a",0)===0});b[h+"Codec"]=o.length>0?o[0]:d[0],D=D.filter(function(s){return d.indexOf(s)===-1})}}),b.unknownCodecs=D}function S(D,b,h){var d=b[h];d&&(D[h]=d)}function v(D,b){for(var h=D[b],d=b;d--;){var o=D[d];if(!o)return;o.programDateTime=h.programDateTime-o.duration*1e3,h=o}}function p(D,b){D.rawProgramDateTime?D.programDateTime=Date.parse(D.rawProgramDateTime):b!=null&&b.programDateTime&&(D.programDateTime=b.endProgramDateTime),Object(K.isFiniteNumber)(D.programDateTime)||(D.programDateTime=null,D.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),w=L("./src/errors.ts"),B=L("./src/utils/logger.ts"),N=L("./src/utils/mp4-tools.ts"),A=L("./src/loader/m3u8-parser.ts"),k=L("./src/types/loader.ts"),m=L("./src/utils/attr-list.ts");function O(E){var g=E.type;switch(g){case k.PlaylistContextType.AUDIO_TRACK:return k.PlaylistLevelType.AUDIO;case k.PlaylistContextType.SUBTITLE_TRACK:return k.PlaylistLevelType.SUBTITLE;default:return k.PlaylistLevelType.MAIN}}function R(E,g){var u=E.url;return(u===void 0||u.indexOf("data:")===0)&&(u=g.url),u}var _=function(){function E(u){this.hls=void 0,this.loaders=Object.create(null),this.hls=u,this.registerListeners()}var g=E.prototype;return g.registerListeners=function(){var a=this.hls;a.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(I.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.on(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},g.unregisterListeners=function(){var a=this.hls;a.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(I.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.off(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},g.createInternalLoader=function(a){var i=this.hls.config,c=i.pLoader,S=i.loader,v=c||S,p=new v(i);return a.loader=p,this.loaders[a.type]=p,p},g.getInternalLoader=function(a){return this.loaders[a.type]},g.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},g.destroyInternalLoaders=function(){for(var a in this.loaders){var i=this.loaders[a];i&&i.destroy(),this.resetInternalLoader(a)}},g.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},g.onManifestLoading=function(a,i){var c=i.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:k.PlaylistContextType.MANIFEST,url:c,deliveryDirectives:null})},g.onLevelLoading=function(a,i){var c=i.id,S=i.level,v=i.url,p=i.deliveryDirectives;this.load({id:c,groupId:null,level:S,responseType:"text",type:k.PlaylistContextType.LEVEL,url:v,deliveryDirectives:p})},g.onAudioTrackLoading=function(a,i){var c=i.id,S=i.groupId,v=i.url,p=i.deliveryDirectives;this.load({id:c,groupId:S,level:null,responseType:"text",type:k.PlaylistContextType.AUDIO_TRACK,url:v,deliveryDirectives:p})},g.onSubtitleTrackLoading=function(a,i){var c=i.id,S=i.groupId,v=i.url,p=i.deliveryDirectives;this.load({id:c,groupId:S,level:null,responseType:"text",type:k.PlaylistContextType.SUBTITLE_TRACK,url:v,deliveryDirectives:p})},g.load=function(a){var i,c=this.hls.config,S=this.getInternalLoader(a);if(S){var v=S.context;if(v&&v.url===a.url){B.logger.trace("[playlist-loader]: playlist request ongoing");return}B.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),S.abort()}var p,D,b,h;switch(a.type){case k.PlaylistContextType.MANIFEST:p=c.manifestLoadingMaxRetry,D=c.manifestLoadingTimeOut,b=c.manifestLoadingRetryDelay,h=c.manifestLoadingMaxRetryTimeout;break;case k.PlaylistContextType.LEVEL:case k.PlaylistContextType.AUDIO_TRACK:case k.PlaylistContextType.SUBTITLE_TRACK:p=0,D=c.levelLoadingTimeOut;break;default:p=c.levelLoadingMaxRetry,D=c.levelLoadingTimeOut,b=c.levelLoadingRetryDelay,h=c.levelLoadingMaxRetryTimeout;break}if(S=this.createInternalLoader(a),(i=a.deliveryDirectives)!==null&&i!==void 0&&i.part){var d;if(a.type===k.PlaylistContextType.LEVEL&&a.level!==null?d=this.hls.levels[a.level].details:a.type===k.PlaylistContextType.AUDIO_TRACK&&a.id!==null?d=this.hls.audioTracks[a.id].details:a.type===k.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 C={timeout:D,maxRetry:p,retryDelay:b,maxRetryDelay:h,highWaterMark:0},y={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};S.load(a,C,y)},g.loadsuccess=function(a,i,c,S){if(S===void 0&&(S=null),c.isSidxRequest){this.handleSidxRequest(a,c),this.handlePlaylistLoaded(a,i,c,S);return}this.resetInternalLoader(c.type);var v=a.data;if(v.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,c,"no EXTM3U delimiter",S);return}i.parsing.start=performance.now(),v.indexOf("#EXTINF:")>0||v.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,i,c,S):this.handleMasterPlaylist(a,i,c,S)},g.loaderror=function(a,i,c){c===void 0&&(c=null),this.handleNetworkError(i,c,!1,a)},g.loadtimeout=function(a,i,c){c===void 0&&(c=null),this.handleNetworkError(i,c,!0)},g.handleMasterPlaylist=function(a,i,c,S){var v=this.hls,p=a.data,D=R(a,c),b=A.default.parseMasterPlaylist(p,D),h=b.levels,d=b.sessionData;if(!h.length){this.handleManifestParsingError(a,c,"no level found in manifest",S);return}var o=h.map(function(j){return{id:j.attrs.AUDIO,audioCodec:j.audioCodec}}),s=h.map(function(j){return{id:j.attrs.SUBTITLES,textCodec:j.textCodec}}),C=A.default.parseMasterPlaylistMedia(p,D,"AUDIO",o),y=A.default.parseMasterPlaylistMedia(p,D,"SUBTITLES",s),x=A.default.parseMasterPlaylistMedia(p,D,"CLOSED-CAPTIONS");if(C.length){var P=C.some(function(j){return!j.url});!P&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(B.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),C.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new m.AttrList({}),bitrate:0,url:""}))}v.trigger(I.Events.MANIFEST_LOADED,{levels:h,audioTracks:C,subtitles:y,captions:x,url:D,stats:i,networkDetails:S,sessionData:d})},g.handleTrackOrLevelPlaylist=function(a,i,c,S){var v=this.hls,p=c.id,D=c.level,b=c.type,h=R(a,c),d=Object(K.isFiniteNumber)(p)?p:0,o=Object(K.isFiniteNumber)(D)?D:d,s=O(c),C=A.default.parseLevelPlaylist(a.data,h,o,s,d);if(!C.fragments.length){v.trigger(I.Events.ERROR,{type:w.ErrorTypes.NETWORK_ERROR,details:w.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(b===k.PlaylistContextType.MANIFEST){var y={attrs:new m.AttrList({}),bitrate:0,details:C,name:"",url:h};v.trigger(I.Events.MANIFEST_LOADED,{levels:[y],audioTracks:[],url:h,stats:i,networkDetails:S,sessionData:null})}if(i.parsing.end=performance.now(),C.needSidxRanges){var x,P=(x=C.fragments[0].initSegment)===null||x===void 0?void 0:x.url;this.load({url:P,isSidxRequest:!0,type:b,level:D,levelDetails:C,id:p,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}c.levelDetails=C,this.handlePlaylistLoaded(a,i,c,S)},g.handleSidxRequest=function(a,i){var c=Object(N.parseSegmentIndex)(new Uint8Array(a.data));if(!c)return;var S=c.references,v=i.levelDetails;S.forEach(function(p,D){var b=p.info,h=v.fragments[D];h.byteRange.length===0&&h.setByteRange(String(1+b.end-b.start)+"@"+String(b.start)),h.initSegment&&h.initSegment.setByteRange(String(c.moovEndOffset)+"@0")})},g.handleManifestParsingError=function(a,i,c,S){this.hls.trigger(I.Events.ERROR,{type:w.ErrorTypes.NETWORK_ERROR,details:w.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:i.type===k.PlaylistContextType.MANIFEST,url:a.url,reason:c,response:a,context:i,networkDetails:S})},g.handleNetworkError=function(a,i,c,S){c===void 0&&(c=!1),B.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 v=w.ErrorDetails.UNKNOWN,p=!1,D=this.getInternalLoader(a);switch(a.type){case k.PlaylistContextType.MANIFEST:v=c?w.ErrorDetails.MANIFEST_LOAD_TIMEOUT:w.ErrorDetails.MANIFEST_LOAD_ERROR,p=!0;break;case k.PlaylistContextType.LEVEL:v=c?w.ErrorDetails.LEVEL_LOAD_TIMEOUT:w.ErrorDetails.LEVEL_LOAD_ERROR,p=!1;break;case k.PlaylistContextType.AUDIO_TRACK:v=c?w.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:w.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,p=!1;break;case k.PlaylistContextType.SUBTITLE_TRACK:v=c?w.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:w.ErrorDetails.SUBTITLE_LOAD_ERROR,p=!1;break}D&&this.resetInternalLoader(a.type);var b={type:w.ErrorTypes.NETWORK_ERROR,details:v,fatal:p,url:a.url,loader:D,context:a,networkDetails:i};S&&(b.response=S),this.hls.trigger(I.Events.ERROR,b)},g.handlePlaylistLoaded=function(a,i,c,S){var v=c.type,p=c.level,D=c.id,b=c.groupId,h=c.loader,d=c.levelDetails,o=c.deliveryDirectives;if(!(d!=null&&d.targetduration)){this.handleManifestParsingError(a,c,"invalid target duration",S);return}if(!h)return;d.live&&(h.getCacheAge&&(d.ageHeader=h.getCacheAge()||0),(!h.getCacheAge||isNaN(d.ageHeader))&&(d.ageHeader=0));switch(v){case k.PlaylistContextType.MANIFEST:case k.PlaylistContextType.LEVEL:this.hls.trigger(I.Events.LEVEL_LOADED,{details:d,level:p||0,id:D||0,stats:i,networkDetails:S,deliveryDirectives:o});break;case k.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(I.Events.AUDIO_TRACK_LOADED,{details:d,id:D||0,groupId:b||"",stats:i,networkDetails:S,deliveryDirectives:o});break;case k.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(I.Events.SUBTITLE_TRACK_LOADED,{details:d,id:D||0,groupId:b||"",stats:i,networkDetails:S,deliveryDirectives:o});break}},E}();z.default=_},"./src/polyfills/number.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"isFiniteNumber",function(){return K}),L.d(z,"MAX_SAFE_INTEGER",function(){return I});var K=Number.isFinite||function(w){return typeof w=="number"&&isFinite(w)},I=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(q,z,L){"use strict";L.r(z);var K=function(){function I(){}return I.getSilentFrame=function(B,N){switch(B){case"mp4a.40.2":if(N===1)return new Uint8Array([0,200,0,128,35,128]);if(N===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(N===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(N===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(N===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(N===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(N===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(N===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(N===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},I}();z.default=K},"./src/remux/mp4-generator.ts":function(q,z,L){"use strict";L.r(z);var K=Math.pow(2,32)-1,I=function(){function w(){}return w.init=function(){w.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 N;for(N in w.types)w.types.hasOwnProperty(N)&&(w.types[N]=[N.charCodeAt(0),N.charCodeAt(1),N.charCodeAt(2),N.charCodeAt(3)]);var A=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]),k=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]);w.HDLR_TYPES={video:A,audio:k};var m=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),O=new Uint8Array([0,0,0,0,0,0,0,0]);w.STTS=w.STSC=w.STCO=O,w.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),w.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),w.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),w.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var R=new Uint8Array([105,115,111,109]),_=new Uint8Array([97,118,99,49]),E=new Uint8Array([0,0,0,1]);w.FTYP=w.box(w.types.ftyp,R,E,R,_),w.DINF=w.box(w.types.dinf,w.box(w.types.dref,m))},w.box=function(N){for(var A=8,k=arguments.length,m=new Array(k>1?k-1:0),O=1;O<k;O++)m[O-1]=arguments[O];for(var R=m.length,_=R;R--;)A+=m[R].byteLength;var E=new Uint8Array(A);for(E[0]=A>>24&255,E[1]=A>>16&255,E[2]=A>>8&255,E[3]=A&255,E.set(N,4),R=0,A=8;R<_;R++)E.set(m[R],A),A+=m[R].byteLength;return E},w.hdlr=function(N){return w.box(w.types.hdlr,w.HDLR_TYPES[N])},w.mdat=function(N){return w.box(w.types.mdat,N)},w.mdhd=function(N,A){A*=N;var k=Math.floor(A/(K+1)),m=Math.floor(A%(K+1));return w.box(w.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,N>>24&255,N>>16&255,N>>8&255,N&255,k>>24,k>>16&255,k>>8&255,k&255,m>>24,m>>16&255,m>>8&255,m&255,85,196,0,0]))},w.mdia=function(N){return w.box(w.types.mdia,w.mdhd(N.timescale,N.duration),w.hdlr(N.type),w.minf(N))},w.mfhd=function(N){return w.box(w.types.mfhd,new Uint8Array([0,0,0,0,N>>24,N>>16&255,N>>8&255,N&255]))},w.minf=function(N){return N.type==="audio"?w.box(w.types.minf,w.box(w.types.smhd,w.SMHD),w.DINF,w.stbl(N)):w.box(w.types.minf,w.box(w.types.vmhd,w.VMHD),w.DINF,w.stbl(N))},w.moof=function(N,A,k){return w.box(w.types.moof,w.mfhd(N),w.traf(k,A))},w.moov=function(N){for(var A=N.length,k=[];A--;)k[A]=w.trak(N[A]);return w.box.apply(null,[w.types.moov,w.mvhd(N[0].timescale,N[0].duration)].concat(k).concat(w.mvex(N)))},w.mvex=function(N){for(var A=N.length,k=[];A--;)k[A]=w.trex(N[A]);return w.box.apply(null,[w.types.mvex].concat(k))},w.mvhd=function(N,A){A*=N;var k=Math.floor(A/(K+1)),m=Math.floor(A%(K+1)),O=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,N>>24&255,N>>16&255,N>>8&255,N&255,k>>24,k>>16&255,k>>8&255,k&255,m>>24,m>>16&255,m>>8&255,m&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 w.box(w.types.mvhd,O)},w.sdtp=function(N){var A=N.samples||[],k=new Uint8Array(4+A.length),m,O;for(m=0;m<A.length;m++)O=A[m].flags,k[m+4]=O.dependsOn<<4|O.isDependedOn<<2|O.hasRedundancy;return w.box(w.types.sdtp,k)},w.stbl=function(N){return w.box(w.types.stbl,w.stsd(N),w.box(w.types.stts,w.STTS),w.box(w.types.stsc,w.STSC),w.box(w.types.stsz,w.STSZ),w.box(w.types.stco,w.STCO))},w.avc1=function(N){var A=[],k=[],m,O,R;for(m=0;m<N.sps.length;m++)O=N.sps[m],R=O.byteLength,A.push(R>>>8&255),A.push(R&255),A=A.concat(Array.prototype.slice.call(O));for(m=0;m<N.pps.length;m++)O=N.pps[m],R=O.byteLength,k.push(R>>>8&255),k.push(R&255),k=k.concat(Array.prototype.slice.call(O));var _=w.box(w.types.avcC,new Uint8Array([1,A[3],A[4],A[5],252|3,224|N.sps.length].concat(A).concat([N.pps.length]).concat(k))),E=N.width,g=N.height,u=N.pixelRatio[0],a=N.pixelRatio[1];return w.box(w.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,E>>8&255,E&255,g>>8&255,g&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]),_,w.box(w.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),w.box(w.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,a>>24,a>>16&255,a>>8&255,a&255])))},w.esds=function(N){var A=N.config.length;return new Uint8Array([0,0,0,0,3,23+A,0,1,0,4,15+A,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([A]).concat(N.config).concat([6,1,2]))},w.mp4a=function(N){var A=N.samplerate;return w.box(w.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,N.channelCount,0,16,0,0,0,0,A>>8&255,A&255,0,0]),w.box(w.types.esds,w.esds(N)))},w.mp3=function(N){var A=N.samplerate;return w.box(w.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,N.channelCount,0,16,0,0,0,0,A>>8&255,A&255,0,0]))},w.stsd=function(N){return N.type==="audio"?!N.isAAC&&N.codec==="mp3"?w.box(w.types.stsd,w.STSD,w.mp3(N)):w.box(w.types.stsd,w.STSD,w.mp4a(N)):w.box(w.types.stsd,w.STSD,w.avc1(N))},w.tkhd=function(N){var A=N.id,k=N.duration*N.timescale,m=N.width,O=N.height,R=Math.floor(k/(K+1)),_=Math.floor(k%(K+1));return w.box(w.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,A>>24&255,A>>16&255,A>>8&255,A&255,0,0,0,0,R>>24,R>>16&255,R>>8&255,R&255,_>>24,_>>16&255,_>>8&255,_&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,m>>8&255,m&255,0,0,O>>8&255,O&255,0,0]))},w.traf=function(N,A){var k=w.sdtp(N),m=N.id,O=Math.floor(A/(K+1)),R=Math.floor(A%(K+1));return w.box(w.types.traf,w.box(w.types.tfhd,new Uint8Array([0,0,0,0,m>>24,m>>16&255,m>>8&255,m&255])),w.box(w.types.tfdt,new Uint8Array([1,0,0,0,O>>24,O>>16&255,O>>8&255,O&255,R>>24,R>>16&255,R>>8&255,R&255])),w.trun(N,k.length+16+20+8+16+8+8),k)},w.trak=function(N){return N.duration=N.duration||4294967295,w.box(w.types.trak,w.tkhd(N),w.mdia(N))},w.trex=function(N){var A=N.id;return w.box(w.types.trex,new Uint8Array([0,0,0,0,A>>24,A>>16&255,A>>8&255,A&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},w.trun=function(N,A){var k=N.samples||[],m=k.length,O=12+16*m,R=new Uint8Array(O),_,E,g,u,a,i;for(A+=8+O,R.set([0,0,15,1,m>>>24&255,m>>>16&255,m>>>8&255,m&255,A>>>24&255,A>>>16&255,A>>>8&255,A&255],0),_=0;_<m;_++)E=k[_],g=E.duration,u=E.size,a=E.flags,i=E.cts,R.set([g>>>24&255,g>>>16&255,g>>>8&255,g&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,a.degradPrio&240<<8,a.degradPrio&15,i>>>24&255,i>>>16&255,i>>>8&255,i&255],12+16*_);return w.box(w.types.trun,R)},w.initSegment=function(N){w.types||w.init();var A=w.moov(N),k=new Uint8Array(w.FTYP.byteLength+A.byteLength);return k.set(w.FTYP),k.set(A,w.FTYP.byteLength),k},w}();I.types=void 0,I.HDLR_TYPES=void 0,I.STTS=void 0,I.STSC=void 0,I.STCO=void 0,I.STSZ=void 0,I.VMHD=void 0,I.SMHD=void 0,I.STSD=void 0,I.FTYP=void 0,I.DINF=void 0,z.default=I},"./src/remux/mp4-remuxer.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return i}),L.d(z,"normalizePts",function(){return c});var K=L("./src/polyfills/number.ts"),I=L("./src/remux/aac-helper.ts"),w=L("./src/remux/mp4-generator.ts"),B=L("./src/events.ts"),N=L("./src/errors.ts"),A=L("./src/utils/logger.ts"),k=L("./src/types/loader.ts"),m=L("./src/utils/timescale-conversion.ts");function O(){return O=Object.assign||function(D){for(var b=1;b<arguments.length;b++){var h=arguments[b];for(var d in h)Object.prototype.hasOwnProperty.call(h,d)&&(D[d]=h[d])}return D},O.apply(this,arguments)}var R=10*1e3,_=1024,E=1152,g=null,u=null,a=!1,i=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,g===null){var C=navigator.userAgent||"",y=C.match(/Chrome\/(\d+)/i);g=y?parseInt(y[1]):0}if(u===null){var x=navigator.userAgent.match(/Safari\/(\d+)/i);u=x?parseInt(x[1]):0}a=!!g&&g<75||!!u&&u<600}var b=D.prototype;return b.destroy=function(){},b.resetTimeStamp=function(d){A.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=d},b.resetNextTimestamp=function(){A.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},b.resetInitSegment=function(){A.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},b.getVideoStartPts=function(d){var o=!1,s=d.reduce(function(C,y){var x=y.pts-C;return x<-4294967296?(o=!0,c(C,y.pts)):x>0?C:y.pts},d[0].pts);return o&&A.logger.debug("PTS rollover detected"),s},b.remux=function(d,o,s,C,y,x,P,j){var Y,Q,X,F,$,re,se=y,he=y,_e=d.pid>-1,xe=o.pid>-1,Ce=o.samples.length,Oe=d.samples.length>0,De=Ce>1,pe=(!_e||Oe)&&(!xe||De)||this.ISGenerated||P;if(pe){this.ISGenerated||(X=this.generateIS(d,o,y));var ue=this.isVideoContiguous,Me=-1;if(De&&(Me=S(o.samples),!ue&&this.config.forceKeyFrameOnDiscontinuity))if(re=!0,Me>0){A.logger.warn("[mp4-remuxer]: Dropped "+Me+" out of "+Ce+" video samples due to a missing keyframe");var at=this.getVideoStartPts(o.samples);o.samples=o.samples.slice(Me),o.dropped+=Me,he+=(o.samples[0].pts-at)/(o.timescale||9e4)}else Me===-1&&(A.logger.warn("[mp4-remuxer]: No keyframe found out of "+Ce+" video samples"),re=!1);if(this.ISGenerated){if(Oe&&De){var lt=this.getVideoStartPts(o.samples),et=c(d.samples[0].pts,lt)-lt,Qe=et/o.inputTimeScale;se+=Math.max(0,Qe),he+=Math.max(0,-Qe)}if(Oe){if(d.samplerate||(A.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),X=this.generateIS(d,o,y)),Q=this.remuxAudio(d,se,this.isAudioContiguous,x,xe||De||j===k.PlaylistLevelType.AUDIO?he:void 0),De){var je=Q?Q.endPTS-Q.startPTS:0;o.inputTimeScale||(A.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),X=this.generateIS(d,o,y)),Y=this.remuxVideo(o,he,ue,je)}}else De&&(Y=this.remuxVideo(o,he,ue,0));Y&&(Y.firstKeyFrame=Me,Y.independent=Me!==-1)}}return this.ISGenerated&&(s.samples.length&&($=this.remuxID3(s,y)),C.samples.length&&(F=this.remuxText(C,y))),{audio:Q,video:Y,initSegment:X,independent:re,text:F,id3:$}},b.generateIS=function(d,o,s){var C=d.samples,y=o.samples,x=this.typeSupported,P={},j=!Object(K.isFiniteNumber)(this._initPTS),Y="audio/mp4",Q,X,F;if(j&&(Q=X=Infinity),d.config&&C.length&&(d.timescale=d.samplerate,d.isAAC||(x.mpeg?(Y="audio/mpeg",d.codec=""):x.mp3&&(d.codec="mp3")),P.audio={id:"audio",container:Y,codec:d.codec,initSegment:!d.isAAC&&x.mpeg?new Uint8Array(0):w.default.initSegment([d]),metadata:{channelCount:d.channelCount}},j&&(F=d.inputTimeScale,Q=X=C[0].pts-Math.round(F*s))),o.sps&&o.pps&&y.length&&(o.timescale=o.inputTimeScale,P.video={id:"main",container:"video/mp4",codec:o.codec,initSegment:w.default.initSegment([o]),metadata:{width:o.width,height:o.height}},j)){F=o.inputTimeScale;var $=this.getVideoStartPts(y),re=Math.round(F*s);X=Math.min(X,c(y[0].dts,$)-re),Q=Math.min(Q,$-re)}if(Object.keys(P).length)return this.ISGenerated=!0,j&&(this._initPTS=Q,this._initDTS=X),{tracks:P,initPTS:Q,timescale:F}},b.remuxVideo=function(d,o,s,C){var y=d.inputTimeScale,x=d.samples,P=[],j=x.length,Y=this._initPTS,Q=this.nextAvcDts,X=8,F,$,re,se=Number.POSITIVE_INFINITY,he=Number.NEGATIVE_INFINITY,_e=0,xe=!1;if(!s||Q===null){var Ce=o*y,Oe=x[0].pts-c(x[0].dts,x[0].pts);Q=Ce-Oe}for(var De=0;De<j;De++){var pe=x[De];if(pe.pts=c(pe.pts-Y,Q),pe.dts=c(pe.dts-Y,Q),pe.dts>pe.pts){var ue=9e4*.2;_e=Math.max(Math.min(_e,pe.pts-pe.dts),-1*ue)}pe.dts<x[De>0?De-1:De].dts&&(xe=!0)}xe&&x.sort(function(st,Be){var Fe=st.dts-Be.dts,Pe=st.pts-Be.pts;return Fe||Pe}),$=x[0].dts,re=x[x.length-1].dts;var Me=Math.round((re-$)/(j-1));if(_e<0){if(_e<Me*-2){A.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(m.toMsFromMpegTsClock)(-Me,!0)+" ms");for(var at=_e,lt=0;lt<j;lt++)x[lt].dts=at=Math.max(at,x[lt].pts-Me),x[lt].pts=Math.max(at,x[lt].pts)}else{A.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(m.toMsFromMpegTsClock)(_e,!0)+" ms to overcome this issue");for(var et=0;et<j;et++)x[et].dts=x[et].dts+_e}$=x[0].dts}if(s){var Qe=$-Q,je=Qe>Me,Ye=Qe<-1;if(je||Ye){je?A.logger.warn("AVC: "+Object(m.toMsFromMpegTsClock)(Qe,!0)+" ms ("+Qe+"dts) hole between fragments detected, filling it"):A.logger.warn("AVC: "+Object(m.toMsFromMpegTsClock)(-Qe,!0)+" ms ("+Qe+"dts) overlapping between fragments detected"),$=Q;var rt=x[0].pts-Qe;x[0].dts=$,x[0].pts=rt,A.logger.log("Video: First PTS/DTS adjusted: "+Object(m.toMsFromMpegTsClock)(rt,!0)+"/"+Object(m.toMsFromMpegTsClock)($,!0)+", delta: "+Object(m.toMsFromMpegTsClock)(Qe,!0)+" ms")}}a&&($=Math.max(0,$));for(var mt=0,ot=0,qe=0;qe<j;qe++){for(var Xe=x[qe],Ct=Xe.units,xt=Ct.length,bt=0,Et=0;Et<xt;Et++)bt+=Ct[Et].data.length;ot+=bt,mt+=xt,Xe.length=bt,Xe.dts=Math.max(Xe.dts,$),Xe.pts=Math.max(Xe.pts,Xe.dts,0),se=Math.min(Xe.pts,se),he=Math.max(Xe.pts,he)}re=x[j-1].dts;var At=ot+4*mt+8,St;try{St=new Uint8Array(At)}catch(st){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:N.ErrorTypes.MUX_ERROR,details:N.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:At,reason:"fail allocating video mdat "+At});return}var Se=new DataView(St.buffer);Se.setUint32(0,At),St.set(w.default.types.mdat,4);for(var Ee=0;Ee<j;Ee++){for(var He=x[Ee],Ge=He.units,Re=0,Ue=0,ge=Ge.length;Ue<ge;Ue++){var de=Ge[Ue],ce=de.data,te=de.data.byteLength;Se.setUint32(X,te),X+=4,St.set(ce,X),X+=te,Re+=4+te}if(Ee<j-1)F=x[Ee+1].dts-He.dts;else{var ie=this.config,ae=He.dts-x[Ee>0?Ee-1:Ee].dts;if(ie.stretchShortVideoTrack&&this.nextAudioPts!==null){var le=Math.floor(ie.maxBufferHole*y),Te=(C?se+C*y:this.nextAudioPts)-He.pts;Te>le?(F=Te-ae,F<0&&(F=ae),A.logger.log("[mp4-remuxer]: It is approximately "+Te/90+" ms to the next segment; using duration "+F/90+" ms for the last video frame.")):F=ae}else F=ae}var be=Math.round(He.pts-He.dts);P.push(new v(He.key,F,Re,be))}if(P.length&&g&&g<70){var ze=P[0].flags;ze.dependsOn=2,ze.isNonSync=0}console.assert(F!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=Q=re+F,this.isVideoContiguous=!0;var dt=w.default.moof(d.sequenceNumber++,$,O({},d,{samples:P})),yt="video",ct={data1:dt,data2:St,startPTS:se/y,endPTS:(he+F)/y,startDTS:$/y,endDTS:Q/y,type:yt,hasAudio:!1,hasVideo:!0,nb:P.length,dropped:d.dropped};return d.samples=[],d.dropped=0,console.assert(St.length,"MDAT length must not be zero"),ct},b.remuxAudio=function(d,o,s,C,y){var x=d.inputTimeScale,P=d.samplerate?d.samplerate:x,j=x/P,Y=d.isAAC?_:E,Q=Y*j,X=this._initPTS,F=!d.isAAC&&this.typeSupported.mpeg,$=[],re=d.samples,se=F?0:8,he=this.nextAudioPts||-1,_e=o*x;if(this.isAudioContiguous=s=s||re.length&&he>0&&(C&&Math.abs(_e-he)<9e3||Math.abs(c(re[0].pts-X,_e)-he)<20*Q),re.forEach(function(ce){ce.pts=c(ce.pts-X,_e)}),!s||he<0){if(re=re.filter(function(ce){return ce.pts>=0}),!re.length)return;y===0?he=0:C?he=Math.max(0,_e):he=re[0].pts}if(d.isAAC)for(var xe=y!==void 0,Ce=this.config.maxAudioFramesDrift,Oe=0,De=he;Oe<re.length;Oe++){var pe=re[Oe],ue=pe.pts,Me=ue-De,at=Math.abs(1e3*Me/x);if(Me<=-Ce*Q&&xe)Oe===0&&(A.logger.warn("Audio frame @ "+(ue/x).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Me/x)+" ms."),this.nextAudioPts=he=De=ue);else if(Me>=Ce*Q&&at<R&&xe){var lt=Math.round(Me/Q);De=ue-lt*Q,De<0&&(lt--,De+=Q),Oe===0&&(this.nextAudioPts=he=De),A.logger.warn("[mp4-remuxer]: Injecting "+lt+" audio frame @ "+(De/x).toFixed(3)+"s due to "+Math.round(1e3*Me/x)+" ms gap.");for(var et=0;et<lt;et++){var Qe=Math.max(De,0),je=I.default.getSilentFrame(d.manifestCodec||d.codec,d.channelCount);je||(A.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),je=pe.unit.subarray()),re.splice(Oe,0,{unit:je,pts:Qe}),De+=Q,Oe++}}pe.pts=De,De+=Q}for(var Ye=null,rt=null,mt,ot=0,qe=re.length;qe--;)ot+=re[qe].unit.byteLength;for(var Xe=0,Ct=re.length;Xe<Ct;Xe++){var xt=re[Xe],bt=xt.unit,Et=xt.pts;if(rt!==null){var At=$[Xe-1];At.duration=Math.round((Et-rt)/j)}else if(s&&d.isAAC&&(Et=he),Ye=Et,ot>0){ot+=se;try{mt=new Uint8Array(ot)}catch(ce){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:N.ErrorTypes.MUX_ERROR,details:N.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ot,reason:"fail allocating audio mdat "+ot});return}if(!F){var St=new DataView(mt.buffer);St.setUint32(0,ot),mt.set(w.default.types.mdat,4)}}else return;mt.set(bt,se);var Se=bt.byteLength;se+=Se,$.push(new v(!0,Y,Se,0)),rt=Et}var Ee=$.length;if(!Ee)return;var He=$[$.length-1];this.nextAudioPts=he=rt+j*He.duration;var Ge=F?new Uint8Array(0):w.default.moof(d.sequenceNumber++,Ye/j,O({},d,{samples:$}));d.samples=[];var Re=Ye/x,Ue=he/x,ge="audio",de={data1:Ge,data2:mt,startPTS:Re,endPTS:Ue,startDTS:Re,endDTS:Ue,type:ge,hasAudio:!0,hasVideo:!1,nb:Ee};return this.isAudioContiguous=!0,console.assert(mt.length,"MDAT length must not be zero"),de},b.remuxEmptyAudio=function(d,o,s,C){var y=d.inputTimeScale,x=d.samplerate?d.samplerate:y,P=y/x,j=this.nextAudioPts,Y=(j!==null?j:C.startDTS*y)+this._initDTS,Q=C.endDTS*y+this._initDTS,X=P*_,F=Math.ceil((Q-Y)/X),$=I.default.getSilentFrame(d.manifestCodec||d.codec,d.channelCount);if(A.logger.warn("[mp4-remuxer]: remux empty Audio"),!$){A.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var re=[],se=0;se<F;se++){var he=Y+se*X;re.push({unit:$,pts:he,dts:he})}return d.samples=re,this.remuxAudio(d,o,s,!1)},b.remuxID3=function(d,o){var s=d.samples.length;if(!s)return;for(var C=d.inputTimeScale,y=this._initPTS,x=this._initDTS,P=0;P<s;P++){var j=d.samples[P];j.pts=c(j.pts-y,o*C)/C,j.dts=c(j.dts-x,o*C)/C}var Y=d.samples;return d.samples=[],{samples:Y}},b.remuxText=function(d,o){var s=d.samples.length;if(!s)return;for(var C=d.inputTimeScale,y=this._initPTS,x=0;x<s;x++){var P=d.samples[x];P.pts=c(P.pts-y,o*C)/C}d.samples.sort(function(Y,Q){return Y.pts-Q.pts});var j=d.samples;return d.samples=[],{samples:j}},D}();function c(D,b){var h;if(b===null)return D;for(b<D?h=-8589934592:h=8589934592;Math.abs(D-b)>4294967296;)D+=h;return D}function S(D){for(var b=0;b<D.length;b++)if(D[b].key)return b;return-1}var v=function(b,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 p(b)},p=function(b){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=b?2:1,this.isNonSync=b?0:1}},"./src/remux/passthrough-remuxer.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/polyfills/number.ts"),I=L("./src/utils/mp4-tools.ts"),w=L("./src/loader/fragment.ts"),B=L("./src/utils/logger.ts"),N=function(){function m(){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 O=m.prototype;return O.destroy=function(){},O.resetTimeStamp=function(_){this.initPTS=_,this.lastEndDTS=null},O.resetNextTimestamp=function(){this.lastEndDTS=null},O.resetInitSegment=function(_,E,g){this.audioCodec=E,this.videoCodec=g,this.generateInitSegment(_),this.emitInitSegment=!0},O.generateInitSegment=function(_){var E=this.audioCodec,g=this.videoCodec;if(!_||!_.byteLength){this.initTracks=void 0,this.initData=void 0;return}var u=this.initData=Object(I.parseInitSegment)(_);E||(E=k(u.audio,w.ElementaryStreamTypes.AUDIO)),g||(g=k(u.video,w.ElementaryStreamTypes.VIDEO));var a={};u.audio&&u.video?a.audiovideo={container:"video/mp4",codec:E+","+g,initSegment:_,id:"main"}:u.audio?a.audio={container:"audio/mp4",codec:E,initSegment:_,id:"audio"}:u.video?a.video={container:"video/mp4",codec:g,initSegment:_,id:"main"}:B.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a},O.remux=function(_,E,g,u,a){var i=this.initPTS,c=this.lastEndDTS,S={audio:void 0,video:void 0,text:u,id3:g,initSegment:void 0};Object(K.isFiniteNumber)(c)||(c=this.lastEndDTS=a||0);var v=E.samples;if(!v||!v.length)return S;var p={initPTS:void 0,timescale:1},D=this.initData;if((!D||!D.length)&&(this.generateInitSegment(v),D=this.initData),!D||!D.length)return B.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),S;this.emitInitSegment&&(p.tracks=this.initTracks,this.emitInitSegment=!1),Object(K.isFiniteNumber)(i)||(this.initPTS=p.initPTS=i=A(D,v,c));var b=Object(I.getDuration)(v,D),h=c,d=b+h;Object(I.offsetStartDTS)(D,v,i),b>0?this.lastEndDTS=d:(B.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var o=!!D.audio,s=!!D.video,C="";o&&(C+="audio"),s&&(C+="video");var y={data1:v,startPTS:h,startDTS:h,endPTS:d,endDTS:d,type:C,hasAudio:o,hasVideo:s,nb:1,dropped:0};return S.audio=y.type==="audio"?y:void 0,S.video=y.type!=="audio"?y:void 0,S.text=u,S.id3=g,S.initSegment=p,S},m}(),A=function(O,R,_){return Object(I.getStartDTS)(O,R)-_};function k(m,O){var R=m==null?void 0:m.codec;return R&&R.length>4?R:R==="hvc1"?"hvc1.1.c.L120.90":R==="av01"?"av01.0.04M.08":R==="avc1"||O===w.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}z.default=N},"./src/task-loop.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return K});var K=function(){function I(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var w=I.prototype;return w.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},w.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},w.onHandlerDestroyed=function(){},w.hasInterval=function(){return!!this._tickInterval},w.hasNextTick=function(){return!!this._tickTimer},w.setInterval=function(N){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,N),!0)},w.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},w.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},w.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},w.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},w.doTick=function(){},I}()},"./src/types/cmcd.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"CMCDVersion",function(){return K}),L.d(z,"CMCDObjectType",function(){return I}),L.d(z,"CMCDStreamingFormat",function(){return w}),L.d(z,"CMCDStreamType",function(){return B});var K=1,I;(function(N){N.MANIFEST="m",N.AUDIO="a",N.VIDEO="v",N.MUXED="av",N.INIT="i",N.CAPTION="c",N.TIMED_TEXT="tt",N.KEY="k",N.OTHER="o"})(I||(I={}));var w;(function(N){N.DASH="d",N.HLS="h",N.SMOOTH="s",N.OTHER="o"})(w||(w={}));var B;(function(N){N.VOD="v",N.LIVE="l"})(B||(B={}))},"./src/types/level.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"HlsSkip",function(){return w}),L.d(z,"getSkipValue",function(){return B}),L.d(z,"HlsUrlParameters",function(){return N}),L.d(z,"Level",function(){return A});function K(k,m){for(var O=0;O<m.length;O++){var R=m[O];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(k,R.key,R)}}function I(k,m,O){return m&&K(k.prototype,m),O&&K(k,O),k}var w;(function(k){k.No="",k.Yes="YES",k.v2="v2"})(w||(w={}));function B(k,m){var O=k.canSkipUntil,R=k.canSkipDateRanges,_=k.endSN,E=m!==void 0?m-_:0;return O&&E<O?R?w.v2:w.Yes:w.No}var N=function(){function k(O,R,_){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=O,this.part=R,this.skip=_}var m=k.prototype;return m.addDirectives=function(R){var _=new self.URL(R);return this.msn!==void 0&&_.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&_.searchParams.set("_HLS_part",this.part.toString()),this.skip&&_.searchParams.set("_HLS_skip",this.skip),_.toString()},k}(),A=function(){function k(m){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=[m.url],this.attrs=m.attrs,this.bitrate=m.bitrate,m.details&&(this.details=m.details),this.id=m.id||0,this.name=m.name,this.width=m.width||0,this.height=m.height||0,this.audioCodec=m.audioCodec,this.videoCodec=m.videoCodec,this.unknownCodecs=m.unknownCodecs,this.codecSet=[m.videoCodec,m.audioCodec].filter(function(O){return O}).join(",").replace(/\.[^.,]+/g,"")}return I(k,[{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(O){var R=O%this.url.length;this._urlId!==R&&(this.details=void 0,this._urlId=R)}}]),k}()},"./src/types/loader.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"PlaylistContextType",function(){return K}),L.d(z,"PlaylistLevelType",function(){return I});var K;(function(w){w.MANIFEST="manifest",w.LEVEL="level",w.AUDIO_TRACK="audioTrack",w.SUBTITLE_TRACK="subtitleTrack"})(K||(K={}));var I;(function(w){w.MAIN="main",w.AUDIO="audio",w.SUBTITLE="subtitle"})(I||(I={}))},"./src/types/transmuxer.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"ChunkMetadata",function(){return K});var K=function(B,N,A,k,m,O){k===void 0&&(k=0),m===void 0&&(m=-1),O===void 0&&(O=!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=I(),this.buffering={audio:I(),video:I(),audiovideo:I()},this.level=B,this.sn=N,this.id=A,this.size=k,this.part=m,this.partial=O};function I(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"AttrList",function(){return w});var K=/^(\d+)x(\d+)$/,I=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,w=function(){function B(A){typeof A=="string"&&(A=B.parseAttrList(A));for(var k in A)A.hasOwnProperty(k)&&(this[k]=A[k])}var N=B.prototype;return N.decimalInteger=function(k){var m=parseInt(this[k],10);return m>Number.MAX_SAFE_INTEGER?Infinity:m},N.hexadecimalInteger=function(k){if(this[k]){var m=(this[k]||"0x").slice(2);m=(m.length&1?"0":"")+m;for(var O=new Uint8Array(m.length/2),R=0;R<m.length/2;R++)O[R]=parseInt(m.slice(R*2,R*2+2),16);return O}else return null},N.hexadecimalIntegerAsNumber=function(k){var m=parseInt(this[k],16);return m>Number.MAX_SAFE_INTEGER?Infinity:m},N.decimalFloatingPoint=function(k){return parseFloat(this[k])},N.optionalFloat=function(k,m){var O=this[k];return O?parseFloat(O):m},N.enumeratedString=function(k){return this[k]},N.bool=function(k){return this[k]==="YES"},N.decimalResolution=function(k){var m=K.exec(this[k]);return m===null?void 0:{width:parseInt(m[1],10),height:parseInt(m[2],10)}},B.parseAttrList=function(k){var m,O={},R='"';for(I.lastIndex=0;(m=I.exec(k))!==null;){var _=m[2];_.indexOf(R)===0&&_.lastIndexOf(R)===_.length-1&&(_=_.slice(1,-1)),O[m[1]]=_}return O},B}()},"./src/utils/binary-search.ts":function(q,z,L){"use strict";L.r(z);var K={search:function(w,B){for(var N=0,A=w.length-1,k=null,m=null;N<=A;){k=(N+A)/2|0,m=w[k];var O=B(m);if(O>0)N=k+1;else if(O<0)A=k-1;else return m}return null}};z.default=K},"./src/utils/buffer-helper.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"BufferHelper",function(){return w});var K=L("./src/utils/logger.ts"),I={length:0,start:function(){return 0},end:function(){return 0}},w=function(){function B(){}return B.isBuffered=function(A,k){try{if(A){for(var m=B.getBuffered(A),O=0;O<m.length;O++)if(k>=m.start(O)&&k<=m.end(O))return!0}}catch(R){}return!1},B.bufferInfo=function(A,k,m){try{if(A){var O=B.getBuffered(A),R=[],_;for(_=0;_<O.length;_++)R.push({start:O.start(_),end:O.end(_)});return this.bufferedInfo(R,k,m)}}catch(E){}return{len:0,start:k,end:k,nextStart:void 0}},B.bufferedInfo=function(A,k,m){k=Math.max(0,k),A.sort(function(p,D){var b=p.start-D.start;return b||D.end-p.end});var O=[];if(m)for(var R=0;R<A.length;R++){var _=O.length;if(_){var E=O[_-1].end;A[R].start-E<m?A[R].end>E&&(O[_-1].end=A[R].end):O.push(A[R])}else O.push(A[R])}else O=A;for(var g=0,u,a=k,i=k,c=0;c<O.length;c++){var S=O[c].start,v=O[c].end;if(k+m>=S&&k<v)a=S,i=v,g=i-k;else if(k+m<S){u=S;break}}return{len:g,start:a||0,end:i||0,nextStart:u}},B.getBuffered=function(A){try{return A.buffered}catch(k){return K.logger.log("failed to get media.buffered",k),I}},B}()},"./src/utils/cea-608-parser.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"Row",function(){return i}),L.d(z,"CaptionScreen",function(){return c});var K=L("./src/utils/logger.ts"),I={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},w=function(d){var o=d;return I.hasOwnProperty(d)&&(o=I[d]),String.fromCharCode(o)},B=15,N=100,A={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},k={17:2,18:4,21:6,22:8,23:10,19:13,20:15},m={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},O={25:2,26:4,29:6,30:8,31:10,27:13,28:15},R=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],_;(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"})(_||(_={}));var E=function(){function h(){this.time=null,this.verboseLevel=_.ERROR}var d=h.prototype;return d.log=function(s,C){this.verboseLevel>=s&&K.logger.log(this.time+" ["+s+"] "+C)},h}(),g=function(d){for(var o=[],s=0;s<d.length;s++)o.push(d[s].toString(16));return o},u=function(){function h(o,s,C,y,x){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=C||!1,this.background=y||"black",this.flash=x||!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 C=["foreground","underline","italics","background","flash"],y=0;y<C.length;y++){var x=C[y];s.hasOwnProperty(x)&&(this[x]=s[x])}},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,C,y,x,P){this.uchar=void 0,this.penState=void 0,this.uchar=o||" ",this.penState=new u(s,C,y,x,P)}var d=h.prototype;return d.reset=function(){this.uchar=" ",this.penState.reset()},d.setChar=function(s,C){this.uchar=s,this.penState.copy(C)},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}(),i=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<N;s++)this.chars.push(new a);this.logger=o,this.pos=0,this.currPenState=new u}var d=h.prototype;return d.equals=function(s){for(var C=!0,y=0;y<N;y++)if(!this.chars[y].equals(s.chars[y])){C=!1;break}return C},d.copy=function(s){for(var C=0;C<N;C++)this.chars[C].copy(s.chars[C])},d.isEmpty=function(){for(var s=!0,C=0;C<N;C++)if(!this.chars[C].isEmpty()){s=!1;break}return s},d.setCursor=function(s){this.pos!==s&&(this.pos=s),this.pos<0?(this.logger.log(_.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>N&&(this.logger.log(_.DEBUG,"Too large cursor position "+this.pos),this.pos=N)},d.moveCursor=function(s){var C=this.pos+s;if(s>1)for(var y=this.pos+1;y<C+1;y++)this.chars[y].setPenState(this.currPenState);this.setCursor(C)},d.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},d.insertChar=function(s){s>=144&&this.backSpace();var C=w(s);if(this.pos>=N){this.logger.log(_.ERROR,"Cannot insert "+s.toString(16)+" ("+C+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(C,this.currPenState),this.moveCursor(1)},d.clearFromPos=function(s){var C;for(C=s;C<N;C++)this.chars[C].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=[],C=!0,y=0;y<N;y++){var x=this.chars[y].uchar;x!==" "&&(C=!1),s.push(x)}return C?"":s.join("")},d.setPenStyles=function(s){this.currPenState.setStyles(s);var C=this.chars[this.pos];C.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<B;s++)this.rows.push(new i(o));this.logger=o,this.currRow=B-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var d=h.prototype;return d.reset=function(){for(var s=0;s<B;s++)this.rows[s].clear();this.currRow=B-1},d.equals=function(s){for(var C=!0,y=0;y<B;y++)if(!this.rows[y].equals(s.rows[y])){C=!1;break}return C},d.copy=function(s){for(var C=0;C<B;C++)this.rows[C].copy(s.rows[C])},d.isEmpty=function(){for(var s=!0,C=0;C<B;C++)if(!this.rows[C].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 C=this.rows[this.currRow];C.insertChar(s)},d.setPen=function(s){var C=this.rows[this.currRow];C.setPenStyles(s)},d.moveCursor=function(s){var C=this.rows[this.currRow];C.moveCursor(s)},d.setCursor=function(s){this.logger.log(_.INFO,"setCursor: "+s);var C=this.rows[this.currRow];C.setCursor(s)},d.setPAC=function(s){this.logger.log(_.INFO,"pacData = "+JSON.stringify(s));var C=s.row-1;if(this.nrRollUpRows&&C<this.nrRollUpRows-1&&(C=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==C){for(var y=0;y<B;y++)this.rows[y].clear();var x=this.currRow+1-this.nrRollUpRows,P=this.lastOutputScreen;if(P){var j=P.rows[x].cueStartTime,Y=this.logger.time;if(j&&Y!==null&&j<Y)for(var Q=0;Q<this.nrRollUpRows;Q++)this.rows[C-this.nrRollUpRows+Q+1].copy(P.rows[x+Q])}}this.currRow=C;var X=this.rows[this.currRow];if(s.indent!==null){var F=s.indent,$=Math.max(F-1,0);X.setCursor(s.indent),s.color=X.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(_.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(_.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(_.TEXT,this.getDisplayText());var s=this.currRow+1-this.nrRollUpRows,C=this.rows.splice(s,1)[0];C.clear(),this.rows.splice(this.currRow,0,C),this.logger.log(_.INFO,"Rolling up")},d.getDisplayText=function(s){s=s||!1;for(var C=[],y="",x=-1,P=0;P<B;P++){var j=this.rows[P].getTextString();j&&(x=P+1,s?C.push("Row "+x+": '"+j+"'"):C.push(j.trim()))}return C.length>0&&(s?y="["+C.join(" | ")+"]":y=C.join(`
|
|
`)),y},d.getTextAndFormat=function(){return this.rows},h}(),S=function(){function h(o,s,C){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(C),this.nonDisplayedMemory=new c(C),this.lastOutputScreen=new c(C),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=C}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[B-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(_.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 C=0;C<s.length;C++)this.writeScreen.insertChar(s[C]);var y=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(_.INFO,y+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(_.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},d.ccRCL=function(){this.logger.log(_.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},d.ccBS=function(){if(this.logger.log(_.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(_.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},d.ccRU=function(s){this.logger.log(_.INFO,"RU("+s+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(s)},d.ccFON=function(){this.logger.log(_.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},d.ccRDC=function(){this.logger.log(_.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},d.ccTR=function(){this.logger.log(_.INFO,"TR"),this.setMode("MODE_TEXT")},d.ccRTD=function(){this.logger.log(_.INFO,"RTD"),this.setMode("MODE_TEXT")},d.ccEDM=function(){this.logger.log(_.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},d.ccCR=function(){this.logger.log(_.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},d.ccENM=function(){this.logger.log(_.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},d.ccEOC=function(){if(this.logger.log(_.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(_.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},d.ccTO=function(s){this.logger.log(_.INFO,"TO("+s+") - Tab Offset"),this.writeScreen.moveCursor(s)},d.ccMIDROW=function(s){var C={flash:!1};if(C.underline=s%2===1,C.italics=s>=46,C.italics)C.foreground="white";else{var y=Math.floor(s/2)-16,x=["white","green","blue","cyan","red","yellow","magenta"];C.foreground=x[y]}this.logger.log(_.INFO,"MIDROW: "+JSON.stringify(C)),this.writeScreen.setPen(C)},d.outputDataUpdate=function(s){s===void 0&&(s=!1);var C=this.logger.time;if(C===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=C:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,C,this.lastOutputScreen),s&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:C),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}(),v=function(){function h(o,s,C){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var y=new E;this.channels=[null,new S(o,s,y),new S(o+1,C,y)],this.cmdHistory=b(),this.logger=y}var d=h.prototype;return d.getHandler=function(s){return this.channels[s].getHandler()},d.setHandler=function(s,C){this.channels[s].setHandler(C)},d.addData=function(s,C){var y,x,P,j=!1;this.logger.time=s;for(var Y=0;Y<C.length;Y+=2){if(x=C[Y]&127,P=C[Y+1]&127,x===0&&P===0)continue;if(this.logger.log(_.DATA,"["+g([C[Y],C[Y+1]])+"] -> ("+g([x,P])+")"),y=this.parseCmd(x,P),y||(y=this.parseMidrow(x,P)),y||(y=this.parsePAC(x,P)),y||(y=this.parseBackgroundAttributes(x,P)),!y&&(j=this.parseChars(x,P),j)){var Q=this.currentChannel;if(Q&&Q>0){var X=this.channels[Q];X.insertChars(j)}else this.logger.log(_.WARNING,"No channel found yet. TEXT-MODE?")}!y&&!j&&this.logger.log(_.WARNING,"Couldn't parse cleaned data "+g([x,P])+" orig: "+g([C[Y],C[Y+1]]))}},d.parseCmd=function(s,C){var y=this.cmdHistory,x=(s===20||s===28||s===21||s===29)&&C>=32&&C<=47,P=(s===23||s===31)&&C>=33&&C<=35;if(!(x||P))return!1;if(D(s,C,y))return p(null,null,y),this.logger.log(_.DEBUG,"Repeated command ("+g([s,C])+") is dropped"),!0;var j=s===20||s===21||s===23?1:2,Y=this.channels[j];return s===20||s===21||s===28||s===29?C===32?Y.ccRCL():C===33?Y.ccBS():C===34?Y.ccAOF():C===35?Y.ccAON():C===36?Y.ccDER():C===37?Y.ccRU(2):C===38?Y.ccRU(3):C===39?Y.ccRU(4):C===40?Y.ccFON():C===41?Y.ccRDC():C===42?Y.ccTR():C===43?Y.ccRTD():C===44?Y.ccEDM():C===45?Y.ccCR():C===46?Y.ccENM():C===47&&Y.ccEOC():Y.ccTO(C-32),p(s,C,y),this.currentChannel=j,!0},d.parseMidrow=function(s,C){var y=0;if((s===17||s===25)&&C>=32&&C<=47){if(s===17?y=1:y=2,y!==this.currentChannel)return this.logger.log(_.ERROR,"Mismatch channel in midrow parsing"),!1;var x=this.channels[y];return x?(x.ccMIDROW(C),this.logger.log(_.DEBUG,"MIDROW ("+g([s,C])+")"),!0):!1}return!1},d.parsePAC=function(s,C){var y,x=this.cmdHistory,P=(s>=17&&s<=23||s>=25&&s<=31)&&C>=64&&C<=127,j=(s===16||s===24)&&C>=64&&C<=95;if(!(P||j))return!1;if(D(s,C,x))return p(null,null,x),!0;var Y=s<=23?1:2;C>=64&&C<=95?y=Y===1?A[s]:m[s]:y=Y===1?k[s]:O[s];var Q=this.channels[Y];return Q?(Q.setPAC(this.interpretPAC(y,C)),p(s,C,x),this.currentChannel=Y,!0):!1},d.interpretPAC=function(s,C){var y,x={color:null,italics:!1,indent:null,underline:!1,row:s};return C>95?y=C-96:y=C-64,x.underline=(y&1)===1,y<=13?x.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(y/2)]:y<=15?(x.italics=!0,x.color="white"):x.indent=Math.floor((y-16)/2)*4,x},d.parseChars=function(s,C){var y,x=null,P=null;if(s>=25?(y=2,P=s-8):(y=1,P=s),P>=17&&P<=19){var j;P===17?j=C+80:P===18?j=C+112:j=C+144,this.logger.log(_.INFO,"Special char '"+w(j)+"' in channel "+y),x=[j]}else s>=32&&s<=127&&(x=C===0?[s]:[s,C]);if(x){var Y=g(x);this.logger.log(_.DEBUG,"Char codes = "+Y.join(",")),p(s,C,this.cmdHistory)}return x},d.parseBackgroundAttributes=function(s,C){var y=(s===16||s===24)&&C>=32&&C<=47,x=(s===23||s===31)&&C>=45&&C<=47;if(!(y||x))return!1;var P,j={};s===16||s===24?(P=Math.floor((C-32)/2),j.background=R[P],C%2===1&&(j.background=j.background+"_semi")):C===45?j.background="transparent":(j.foreground="black",C===47&&(j.underline=!0));var Y=s<=23?1:2,Q=this.channels[Y];return Q.setBkgData(j),p(s,C,this.cmdHistory),!0},d.reset=function(){for(var s=0;s<Object.keys(this.channels).length;s++){var C=this.channels[s];C&&C.reset()}this.cmdHistory=b()},d.cueSplitAtTime=function(s){for(var C=0;C<this.channels.length;C++){var y=this.channels[C];y&&y.cueSplitAtTime(s)}},h}();function p(h,d,o){o.a=h,o.b=d}function D(h,d,o){return o.a===h&&o.b===d}function b(){return{a:null,b:null}}z.default=v},"./src/utils/codecs.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"isCodecType",function(){return I}),L.d(z,"isCodecSupportedInMp4",function(){return w});var K={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 I(B,N){var A=K[N];return!!A&&A[B.slice(0,4)]===!0}function w(B,N){return MediaSource.isTypeSupported((N||"video")+'/mp4;codecs="'+B+'"')}},"./src/utils/cues.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/utils/vttparser.ts"),I=L("./src/utils/webvtt-parser.ts"),w=L("./src/utils/texttrack-utils.ts"),B=/\s/,N={newCue:function(k,m,O,R){for(var _=[],E,g,u,a,i,c=self.VTTCue||self.TextTrackCue,S=0;S<R.rows.length;S++)if(E=R.rows[S],u=!0,a=0,i="",!E.isEmpty()){for(var v=0;v<E.chars.length;v++)B.test(E.chars[v].uchar)&&u?a++:(i+=E.chars[v].uchar,u=!1);E.cueStartTime=m,m===O&&(O+=1e-4),a>=16?a--:a++;var p=Object(K.fixLineBreaks)(i.trim()),D=Object(I.generateCueId)(m,O,p);(!k||!k.cues||!k.cues.getCueById(D))&&(g=new c(m,O,p),g.id=D,g.line=S+1,g.align="left",g.position=10+Math.min(80,Math.floor(a*8/32)*10),_.push(g))}return k&&_.length&&(_.sort(function(b,h){return b.line==="auto"||h.line==="auto"?0:b.line>8&&h.line>8?h.line-b.line:b.line-h.line}),_.forEach(function(b){return Object(w.addCueToTrack)(k,b)})),_}};z.default=N},"./src/utils/discontinuities.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"findFirstFragWithCC",function(){return B}),L.d(z,"shouldAlignOnDiscontinuities",function(){return N}),L.d(z,"findDiscontinuousReferenceFrag",function(){return A}),L.d(z,"adjustSlidingStart",function(){return m}),L.d(z,"alignStream",function(){return O}),L.d(z,"alignPDT",function(){return _}),L.d(z,"alignFragmentByPDTDelta",function(){return E}),L.d(z,"alignMediaPlaylistByPDT",function(){return g});var K=L("./src/polyfills/number.ts"),I=L("./src/utils/logger.ts"),w=L("./src/controller/level-helper.ts");function B(u,a){for(var i=null,c=0,S=u.length;c<S;c++){var v=u[c];if(v&&v.cc===a){i=v;break}}return i}function N(u,a,i){return!!(a.details&&(i.endCC>i.startCC||u&&u.cc<i.startCC))}function A(u,a){var i=u.fragments,c=a.fragments;if(!c.length||!i.length){I.logger.log("No fragments to align");return}var S=B(i,c[0].cc);if(!S||S&&!S.startPTS){I.logger.log("No frag in previous level to align on");return}return S}function k(u,a){if(u){var i=u.start+a;u.start=u.startPTS=i,u.endPTS=i+u.duration}}function m(u,a){for(var i=a.fragments,c=0,S=i.length;c<S;c++)k(i[c],u);a.fragmentHint&&k(a.fragmentHint,u),a.alignedSliding=!0}function O(u,a,i){if(!a)return;R(u,i,a),!i.alignedSliding&&a.details&&_(i,a.details),!i.alignedSliding&&a.details&&!i.skippedSegments&&Object(w.adjustSliding)(a.details,i)}function R(u,a,i){if(N(u,i,a)){var c=A(i.details,a);c&&Object(K.isFiniteNumber)(c.start)&&(I.logger.log("Adjusting PTS using last level due to CC increase within current level "+a.url),m(c.start,a))}}function _(u,a){if(!a.fragments.length||!u.hasProgramDateTime||!a.hasProgramDateTime)return;var i=a.fragments[0].programDateTime,c=u.fragments[0].programDateTime,S=(c-i)/1e3+a.fragments[0].start;S&&Object(K.isFiniteNumber)(S)&&(I.logger.log("Adjusting PTS using programDateTime delta "+(c-i)+"ms, sliding:"+S.toFixed(3)+" "+u.url+" "),m(S,u))}function E(u,a){var i=u.programDateTime;if(!i)return;var c=(i-a)/1e3;u.start=u.startPTS=c,u.endPTS=c+u.duration}function g(u,a){if(!a.fragments.length||!u.hasProgramDateTime||!a.hasProgramDateTime)return;var i=a.fragments[0].programDateTime,c=a.fragments[0].start,S=i-c*1e3;u.fragments.forEach(function(v){E(v,S)}),u.fragmentHint&&E(u.fragmentHint,S),u.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/utils/ewma.ts"),I=function(){function w(N,A,k){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=k,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new K.default(N),this.fast_=new K.default(A)}var B=w.prototype;return B.update=function(A,k){var m=this.slow_,O=this.fast_;this.slow_.halfLife!==A&&(this.slow_=new K.default(A,m.getEstimate(),m.getTotalWeight())),this.fast_.halfLife!==k&&(this.fast_=new K.default(k,O.getEstimate(),O.getTotalWeight()))},B.sample=function(A,k){A=Math.max(A,this.minDelayMs_);var m=8*k,O=A/1e3,R=m/O;this.fast_.sample(O,R),this.slow_.sample(O,R)},B.canEstimate=function(){var A=this.fast_;return A&&A.getTotalWeight()>=this.minWeight_},B.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},B.destroy=function(){},w}();z.default=I},"./src/utils/ewma.ts":function(q,z,L){"use strict";L.r(z);var K=function(){function I(B,N,A){N===void 0&&(N=0),A===void 0&&(A=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=B,this.alpha_=B?Math.exp(Math.log(.5)/B):0,this.estimate_=N,this.totalWeight_=A}var w=I.prototype;return w.sample=function(N,A){var k=Math.pow(this.alpha_,N);this.estimate_=A*(1-k)+k*this.estimate_,this.totalWeight_+=N},w.getTotalWeight=function(){return this.totalWeight_},w.getEstimate=function(){if(this.alpha_){var N=1-Math.pow(this.alpha_,this.totalWeight_);if(N)return this.estimate_/N}return this.estimate_},I}();z.default=K},"./src/utils/fetch-loader.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"fetchSupported",function(){return E});var K=L("./src/polyfills/number.ts"),I=L("./src/loader/load-stats.ts"),w=L("./src/demux/chunk-cache.ts");function B(c,S){c.prototype=Object.create(S.prototype),c.prototype.constructor=c,O(c,S)}function N(c){var S=typeof Map=="function"?new Map:void 0;return N=function(p){if(p===null||!m(p))return p;if(typeof p!="function")throw new TypeError("Super expression must either be null or a function");if(typeof S!="undefined"){if(S.has(p))return S.get(p);S.set(p,D)}function D(){return A(p,arguments,R(this).constructor)}return D.prototype=Object.create(p.prototype,{constructor:{value:D,enumerable:!1,writable:!0,configurable:!0}}),O(D,p)},N(c)}function A(c,S,v){return k()?A=Reflect.construct:A=function(D,b,h){var d=[null];d.push.apply(d,b);var o=Function.bind.apply(D,d),s=new o;return h&&O(s,h.prototype),s},A.apply(null,arguments)}function k(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(c){return!1}}function m(c){return Function.toString.call(c).indexOf("[native code]")!==-1}function O(c,S){return O=Object.setPrototypeOf||function(p,D){return p.__proto__=D,p},O(c,S)}function R(c){return R=Object.setPrototypeOf?Object.getPrototypeOf:function(v){return v.__proto__||Object.getPrototypeOf(v)},R(c)}function _(){return _=Object.assign||function(c){for(var S=1;S<arguments.length;S++){var v=arguments[S];for(var p in v)Object.prototype.hasOwnProperty.call(v,p)&&(c[p]=v[p])}return c},_.apply(this,arguments)}function E(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(c){}return!1}var g=function(){function c(v){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=v.fetchSetup||a,this.controller=new self.AbortController,this.stats=new I.LoadStats}var S=c.prototype;return S.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},S.abortInternal=function(){var p=this.response;(!p||!p.ok)&&(this.stats.aborted=!0,this.controller.abort())},S.abort=function(){var p;this.abortInternal(),(p=this.callbacks)!==null&&p!==void 0&&p.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},S.load=function(p,D,b){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=u(p,this.controller.signal),s=b.onProgress,C=p.responseType==="arraybuffer",y=C?"byteLength":"length";this.context=p,this.config=D,this.callbacks=b,this.request=this.fetchSetup(p,o),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){h.abortInternal(),b.onTimeout(d,p,h.response)},D.timeout),self.fetch(this.request).then(function(x){if(h.response=h.loader=x,!x.ok){var P=x.status,j=x.statusText;throw new i(j||"fetch, bad network response",P,x)}return d.loading.first=Math.max(self.performance.now(),d.loading.start),d.total=parseInt(x.headers.get("Content-Length")||"0"),s&&Object(K.isFiniteNumber)(D.highWaterMark)?h.loadProgressively(x,d,p,D.highWaterMark,s):C?x.arrayBuffer():x.text()}).then(function(x){var P=h.response;self.clearTimeout(h.requestTimeout),d.loading.end=Math.max(self.performance.now(),d.loading.first),d.loaded=d.total=x[y];var j={url:P.url,data:x};s&&!Object(K.isFiniteNumber)(D.highWaterMark)&&s(d,p,x,P),b.onSuccess(j,d,p,P)}).catch(function(x){if(self.clearTimeout(h.requestTimeout),d.aborted)return;var P=x.code||0;b.onError({code:P,text:x.message},p,x.details)})},S.getCacheAge=function(){var p=null;if(this.response){var D=this.response.headers.get("age");p=D?parseFloat(D):null}return p},S.loadProgressively=function(p,D,b,h,d){h===void 0&&(h=0);var o=new w.default,s=p.body.getReader(),C=function y(){return s.read().then(function(x){if(x.done)return o.dataLength&&d(D,b,o.flush(),p),Promise.resolve(new ArrayBuffer(0));var P=x.value,j=P.length;return D.loaded+=j,j<h||o.dataLength?(o.push(P),o.dataLength>=h&&d(D,b,o.flush(),p)):d(D,b,P,p),y()}).catch(function(){return Promise.reject()})};return C()},c}();function u(c,S){var v={method:"GET",mode:"cors",credentials:"same-origin",signal:S,headers:new self.Headers(_({},c.headers))};return c.rangeEnd&&v.headers.set("Range","bytes="+c.rangeStart+"-"+String(c.rangeEnd-1)),v}function a(c,S){return new self.Request(c.url,S)}var i=function(c){B(S,c);function S(v,p,D){var b;return b=c.call(this,v)||this,b.code=void 0,b.details=void 0,b.code=p,b.details=D,b}return S}(N(Error));z.default=g},"./src/utils/imsc1-ttml-parser.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"IMSC1_CODEC",function(){return m}),L.d(z,"parseIMSC1",function(){return E});var K=L("./src/utils/mp4-tools.ts"),I=L("./src/utils/vttparser.ts"),w=L("./src/utils/vttcue.ts"),B=L("./src/demux/id3.ts"),N=L("./src/utils/timescale-conversion.ts"),A=L("./src/utils/webvtt-parser.ts");function k(){return k=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},k.apply(this,arguments)}var m="stpp.ttml.im1t",O=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,R=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,_={left:"start",center:"center",right:"end",start:"start",end:"end"};function E(h,d,o,s,C){var y=Object(K.findBox)(new Uint8Array(h),["mdat"]);if(y.length===0){C(new Error("Could not parse IMSC1 mdat"));return}var x=y[0],P=Object(B.utf8ArrayToStr)(new Uint8Array(h,x.start,x.end-x.start)),j=Object(N.toTimescaleFromScale)(d,1,o);try{s(g(P,j))}catch(Y){C(Y)}}function g(h,d){var o=new DOMParser,s=o.parseFromString(h,"text/xml"),C=s.getElementsByTagName("tt")[0];if(!C)throw new Error("Invalid ttml");var y={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},x=Object.keys(y).reduce(function(X,F){return X[F]=C.getAttribute("ttp:"+F)||y[F],X},{}),P=C.getAttribute("xml:space")!=="preserve",j=a(u(C,"styling","style")),Y=a(u(C,"layout","region")),Q=u(C,"body","[begin]");return[].map.call(Q,function(X){var F=i(X,P);if(!F||!X.hasAttribute("begin"))return null;var $=p(X.getAttribute("begin"),x),re=p(X.getAttribute("dur"),x),se=p(X.getAttribute("end"),x);if($===null)throw v(X);if(se===null){if(re===null)throw v(X);se=$+re}var he=new w.default($-d,se-d,F);he.id=Object(A.generateCueId)(he.startTime,he.endTime,he.text);var _e=Y[X.getAttribute("region")],xe=j[X.getAttribute("style")];he.position=10,he.size=80;var Ce=c(_e,xe),Oe=Ce.textAlign;if(Oe){var De=_[Oe];De&&(he.lineAlign=De),he.align=Oe}return k(he,Ce),he}).filter(function(X){return X!==null})}function u(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 i(h,d){return[].slice.call(h.childNodes).reduce(function(o,s,C){var y;return s.nodeName==="br"&&C?o+`
|
|
`:(y=s.childNodes)!==null&&y!==void 0&&y.length?i(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(C,y){var x=S(d,o,y)||S(h,o,y);return x&&(C[y]=x),C},{})}function S(h,d,o){return h.hasAttributeNS(d,o)?h.getAttributeNS(d,o):null}function v(h){return new Error("Could not parse ttml timestamp "+h)}function p(h,d){if(!h)return null;var o=Object(I.parseTimeStamp)(h);return o===null&&(O.test(h)?o=D(h,d):R.test(h)&&(o=b(h,d))),o}function D(h,d){var o=O.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 b(h,d){var o=R.exec(h),s=Number(o[1]),C=o[2];switch(C){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(q,z,L){"use strict";L.r(z),L.d(z,"enableLogs",function(){return A}),L.d(z,"logger",function(){return k});var K=function(){},I={trace:K,debug:K,log:K,warn:K,info:K,error:K},w=I;function B(m){var O=self.console[m];return O?O.bind(self.console,"["+m+"] >"):K}function N(m){for(var O=arguments.length,R=new Array(O>1?O-1:0),_=1;_<O;_++)R[_-1]=arguments[_];R.forEach(function(E){w[E]=m[E]?m[E].bind(m):B(E)})}function A(m){if(self.console&&m===!0||typeof m=="object"){N(m,"debug","log","info","warn","error");try{w.log()}catch(O){w=I}}else w=I}var k=w},"./src/utils/mediakeys-helper.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"KeySystems",function(){return K}),L.d(z,"requestMediaKeySystemAccess",function(){return I});var K;(function(w){w.WIDEVINE="com.widevine.alpha",w.PLAYREADY="com.microsoft.playready"})(K||(K={}));var I=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"getMediaSource",function(){return K});function K(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"bin2str",function(){return N}),L.d(z,"readUint16",function(){return A}),L.d(z,"readUint32",function(){return k}),L.d(z,"writeUint32",function(){return m}),L.d(z,"findBox",function(){return O}),L.d(z,"parseSegmentIndex",function(){return R}),L.d(z,"parseInitSegment",function(){return _}),L.d(z,"getStartDTS",function(){return E}),L.d(z,"getDuration",function(){return g}),L.d(z,"computeRawDurationFromSamples",function(){return u}),L.d(z,"offsetStartDTS",function(){return a}),L.d(z,"segmentValidRange",function(){return i}),L.d(z,"appendUint8Array",function(){return c});var K=L("./src/utils/typed-array.ts"),I=L("./src/loader/fragment.ts"),w=Math.pow(2,32)-1,B=[].push;function N(S){return String.fromCharCode.apply(null,S)}function A(S,v){"data"in S&&(v+=S.start,S=S.data);var p=S[v]<<8|S[v+1];return p<0?65536+p:p}function k(S,v){"data"in S&&(v+=S.start,S=S.data);var p=S[v]<<24|S[v+1]<<16|S[v+2]<<8|S[v+3];return p<0?4294967296+p:p}function m(S,v,p){"data"in S&&(v+=S.start,S=S.data),S[v]=p>>24,S[v+1]=p>>16&255,S[v+2]=p>>8&255,S[v+3]=p&255}function O(S,v){var p=[];if(!v.length)return p;var D,b,h;"data"in S?(D=S.data,b=S.start,h=S.end):(D=S,b=0,h=D.byteLength);for(var d=b;d<h;){var o=k(D,d),s=N(D.subarray(d+4,d+8)),C=o>1?d+o:h;if(s===v[0])if(v.length===1)p.push({data:D,start:d+8,end:C});else{var y=O({data:D,start:d+8,end:C},v.slice(1));y.length&&B.apply(p,y)}d=C}return p}function R(S){var v=O(S,["moov"]),p=v[0],D=p?p.end:null,b=O(S,["sidx"]);if(!b||!b[0])return null;var h=[],d=b[0],o=d.data[0],s=o===0?8:16,C=k(d,s);s+=4;var y=0,x=0;o===0?s+=8:s+=16,s+=2;var P=d.end+x,j=A(d,s);s+=2;for(var Y=0;Y<j;Y++){var Q=s,X=k(d,Q);Q+=4;var F=X&2147483647,$=(X&2147483648)>>>31;if($===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var re=k(d,Q);Q+=4,h.push({referenceSize:F,subsegmentDuration:re,info:{duration:re/C,start:P,end:P+F-1}}),P+=F,Q+=4,s=Q}return{earliestPresentationTime:y,timescale:C,version:o,referencesCount:j,references:h,moovEndOffset:D}}function _(S){for(var v=[],p=O(S,["moov","trak"]),D=0;D<p.length;D++){var b=p[D],h=O(b,["tkhd"])[0];if(h){var d=h.data[h.start],o=d===0?12:20,s=k(h,o),C=O(b,["mdia","mdhd"])[0];if(C){d=C.data[C.start],o=d===0?12:20;var y=k(C,o),x=O(b,["mdia","hdlr"])[0];if(x){var P=N(x.data.subarray(x.start+8,x.start+12)),j={soun:I.ElementaryStreamTypes.AUDIO,vide:I.ElementaryStreamTypes.VIDEO}[P];if(j){var Y=O(b,["mdia","minf","stbl","stsd"])[0],Q=void 0;Y&&(Q=N(Y.data.subarray(Y.start+12,Y.start+16))),v[s]={timescale:y,type:j},v[j]={timescale:y,id:s,codec:Q}}}}}}var X=O(S,["moov","mvex","trex"]);return X.forEach(function(F){var $=k(F,4),re=v[$];re&&(re.default={duration:k(F,12),flags:k(F,20)})}),v}function E(S,v){return O(v,["moof","traf"]).reduce(function(p,D){var b=O(D,["tfdt"])[0],h=b.data[b.start],d=O(D,["tfhd"]).reduce(function(o,s){var C=k(s,4),y=S[C];if(y){var x=k(b,4);h===1&&(x*=Math.pow(2,32),x+=k(b,8));var P=y.timescale||9e4,j=x/P;if(isFinite(j)&&(o===null||j<o))return j}return o},null);return d!==null&&isFinite(d)&&(p===null||d<p)?d:p},null)||0}function g(S,v){for(var p=0,D=0,b=0,h=O(S,["moof","traf"]),d=0;d<h.length;d++){var o=h[d],s=O(o,["tfhd"])[0],C=k(s,4),y=v[C];if(!y)continue;var x=y.default,P=k(s,0)|(x==null?void 0:x.flags),j=x==null?void 0:x.duration;P&8&&(P&2?j=k(s,12):j=k(s,8));for(var Y=y.timescale||9e4,Q=O(o,["trun"]),X=0;X<Q.length;X++){if(j){var F=k(Q[X],4);p=j*F}else p=u(Q[X]);y.type===I.ElementaryStreamTypes.VIDEO?D+=p/Y:y.type===I.ElementaryStreamTypes.AUDIO&&(b+=p/Y)}}if(D===0&&b===0){var $=R(S);if($!=null&&$.references)return $.references.reduce(function(re,se){return re+se.info.duration||0},0)}return D||b}function u(S){var v=k(S,0),p=8;v&1&&(p+=4),v&4&&(p+=4);for(var D=0,b=k(S,4),h=0;h<b;h++){if(v&256){var d=k(S,p);D+=d,p+=4}v&512&&(p+=4),v&1024&&(p+=4),v&2048&&(p+=4)}return D}function a(S,v,p){O(v,["moof","traf"]).forEach(function(D){O(D,["tfhd"]).forEach(function(b){var h=k(b,4),d=S[h];if(!d)return;var o=d.timescale||9e4;O(D,["tfdt"]).forEach(function(s){var C=s.data[s.start],y=k(s,4);if(C===0)m(s,4,y-p*o);else{y*=Math.pow(2,32),y+=k(s,8),y-=p*o,y=Math.max(y,0);var x=Math.floor(y/(w+1)),P=Math.floor(y%(w+1));m(s,4,x),m(s,8,P)}})})})}function i(S){var v={valid:null,remainder:null},p=O(S,["moof"]);if(p){if(p.length<2)return v.remainder=S,v}else return v;var D=p[p.length-1];return v.valid=Object(K.sliceUint8)(S,0,D.start-8),v.remainder=Object(K.sliceUint8)(S,D.start-8),v}function c(S,v){var p=new Uint8Array(S.length+v.length);return p.set(S),p.set(v,S.length),p}},"./src/utils/output-filter.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"default",function(){return K});var K=function(){function I(B,N){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=B,this.trackName=N}var w=I.prototype;return w.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},w.newCue=function(N,A,k){(this.startTime===null||this.startTime>N)&&(this.startTime=N),this.endTime=A,this.screen=k,this.timelineController.createCaptionsTrack(this.trackName)},w.reset=function(){this.cueRanges=[]},I}()},"./src/utils/texttrack-utils.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"sendAddTrackEvent",function(){return I}),L.d(z,"addCueToTrack",function(){return w}),L.d(z,"clearCurrentCues",function(){return B}),L.d(z,"removeCuesInRange",function(){return N}),L.d(z,"getCuesInRange",function(){return k});var K=L("./src/utils/logger.ts");function I(m,O){var R;try{R=new Event("addtrack")}catch(_){R=document.createEvent("Event"),R.initEvent("addtrack",!1,!1)}R.track=m,O.dispatchEvent(R)}function w(m,O){var R=m.mode;if(R==="disabled"&&(m.mode="hidden"),m.cues&&!m.cues.getCueById(O.id))try{if(m.addCue(O),!m.cues.getCueById(O.id))throw new Error("addCue is failed for: "+O)}catch(E){K.logger.debug("[texttrack-utils]: "+E);var _=new self.TextTrackCue(O.startTime,O.endTime,O.text);_.id=O.id,m.addCue(_)}R==="disabled"&&(m.mode=R)}function B(m){var O=m.mode;if(O==="disabled"&&(m.mode="hidden"),m.cues)for(var R=m.cues.length;R--;)m.removeCue(m.cues[R]);O==="disabled"&&(m.mode=O)}function N(m,O,R){var _=m.mode;if(_==="disabled"&&(m.mode="hidden"),m.cues&&m.cues.length>0)for(var E=k(m.cues,O,R),g=0;g<E.length;g++)m.removeCue(E[g]);_==="disabled"&&(m.mode=_)}function A(m,O){if(O<m[0].startTime)return 0;var R=m.length-1;if(O>m[R].endTime)return-1;for(var _=0,E=R;_<=E;){var g=Math.floor((E+_)/2);if(O<m[g].startTime)E=g-1;else if(O>m[g].startTime&&_<R)_=g+1;else return g}return m[_].startTime-O<O-m[E].startTime?_:E}function k(m,O,R){var _=[],E=A(m,O);if(E>-1)for(var g=E,u=m.length;g<u;g++){var a=m[g];if(a.startTime>=O&&a.endTime<=R)_.push(a);else if(a.startTime>R)return _}return _}},"./src/utils/time-ranges.ts":function(q,z,L){"use strict";L.r(z);var K={toString:function(w){for(var B="",N=w.length,A=0;A<N;A++)B+="["+w.start(A).toFixed(3)+","+w.end(A).toFixed(3)+"]";return B}};z.default=K},"./src/utils/timescale-conversion.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"toTimescaleFromBase",function(){return I}),L.d(z,"toTimescaleFromScale",function(){return w}),L.d(z,"toMsFromMpegTsClock",function(){return B}),L.d(z,"toMpegTsClockFromTimescale",function(){return N});var K=9e4;function I(A,k,m,O){m===void 0&&(m=1),O===void 0&&(O=!1);var R=A*k*m;return O?Math.round(R):R}function w(A,k,m,O){return m===void 0&&(m=1),O===void 0&&(O=!1),I(A,k,1/m,O)}function B(A,k){return k===void 0&&(k=!1),I(A,1e3,1/K,k)}function N(A,k){return k===void 0&&(k=1),I(A,K,1/k)}},"./src/utils/typed-array.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"sliceUint8",function(){return K});function K(I,w,B){return Uint8Array.prototype.slice?I.slice(w,B):new Uint8Array(Array.prototype.slice.call(I,w,B))}},"./src/utils/vttcue.ts":function(q,z,L){"use strict";L.r(z),z.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var K=["","lr","rl"],I=["start","middle","end","left","right"];function w(m,O){if(typeof O!="string")return!1;if(!Array.isArray(m))return!1;var R=O.toLowerCase();return~m.indexOf(R)?R:!1}function B(m){return w(K,m)}function N(m){return w(I,m)}function A(m){for(var O=arguments.length,R=new Array(O>1?O-1:0),_=1;_<O;_++)R[_-1]=arguments[_];for(var E=1;E<arguments.length;E++){var g=arguments[E];for(var u in g)m[u]=g[u]}return m}function k(m,O,R){var _=this,E={enumerable:!0};_.hasBeenReset=!1;var g="",u=!1,a=m,i=O,c=R,S=null,v="",p=!0,D="auto",b="start",h=50,d="middle",o=50,s="middle";Object.defineProperty(_,"id",A({},E,{get:function(){return g},set:function(y){g=""+y}})),Object.defineProperty(_,"pauseOnExit",A({},E,{get:function(){return u},set:function(y){u=!!y}})),Object.defineProperty(_,"startTime",A({},E,{get:function(){return a},set:function(y){if(typeof y!="number")throw new TypeError("Start time must be set to a number.");a=y,this.hasBeenReset=!0}})),Object.defineProperty(_,"endTime",A({},E,{get:function(){return i},set:function(y){if(typeof y!="number")throw new TypeError("End time must be set to a number.");i=y,this.hasBeenReset=!0}})),Object.defineProperty(_,"text",A({},E,{get:function(){return c},set:function(y){c=""+y,this.hasBeenReset=!0}})),Object.defineProperty(_,"region",A({},E,{get:function(){return S},set:function(y){S=y,this.hasBeenReset=!0}})),Object.defineProperty(_,"vertical",A({},E,{get:function(){return v},set:function(y){var x=B(y);if(x===!1)throw new SyntaxError("An invalid or illegal string was specified.");v=x,this.hasBeenReset=!0}})),Object.defineProperty(_,"snapToLines",A({},E,{get:function(){return p},set:function(y){p=!!y,this.hasBeenReset=!0}})),Object.defineProperty(_,"line",A({},E,{get:function(){return D},set:function(y){if(typeof y!="number"&&y!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");D=y,this.hasBeenReset=!0}})),Object.defineProperty(_,"lineAlign",A({},E,{get:function(){return b},set:function(y){var x=N(y);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");b=x,this.hasBeenReset=!0}})),Object.defineProperty(_,"position",A({},E,{get:function(){return h},set:function(y){if(y<0||y>100)throw new Error("Position must be between 0 and 100.");h=y,this.hasBeenReset=!0}})),Object.defineProperty(_,"positionAlign",A({},E,{get:function(){return d},set:function(y){var x=N(y);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");d=x,this.hasBeenReset=!0}})),Object.defineProperty(_,"size",A({},E,{get:function(){return o},set:function(y){if(y<0||y>100)throw new Error("Size must be between 0 and 100.");o=y,this.hasBeenReset=!0}})),Object.defineProperty(_,"align",A({},E,{get:function(){return s},set:function(y){var x=N(y);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");s=x,this.hasBeenReset=!0}})),_.displayState=void 0}return k.prototype.getCueAsHTML=function(){var m=self.WebVTT;return m.convertCueToDOMTree(self,this.text)},k}()},"./src/utils/vttparser.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"parseTimeStamp",function(){return w}),L.d(z,"fixLineBreaks",function(){return O}),L.d(z,"VTTParser",function(){return R});var K=L("./src/utils/vttcue.ts"),I=function(){function _(){}var E=_.prototype;return E.decode=function(u,a){if(!u)return"";if(typeof u!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(u))},_}();function w(_){function E(u,a,i,c){return(u|0)*3600+(a|0)*60+(i|0)+parseFloat(c||0)}var g=_.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return g?parseFloat(g[2])>59?E(g[2],g[3],0,g[4]):E(g[1],g[2],g[3],g[4]):null}var B=function(){function _(){this.values=Object.create(null)}var E=_.prototype;return E.set=function(u,a){!this.get(u)&&a!==""&&(this.values[u]=a)},E.get=function(u,a,i){return i?this.has(u)?this.values[u]:a[i]:this.has(u)?this.values[u]:a},E.has=function(u){return u in this.values},E.alt=function(u,a,i){for(var c=0;c<i.length;++c)if(a===i[c]){this.set(u,a);break}},E.integer=function(u,a){/^-?\d+$/.test(a)&&this.set(u,parseInt(a,10))},E.percent=function(u,a){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(a)){var i=parseFloat(a);if(i>=0&&i<=100)return this.set(u,i),!0}return!1},_}();function N(_,E,g,u){var a=u?_.split(u):[_];for(var i in a){if(typeof a[i]!="string")continue;var c=a[i].split(g);if(c.length!==2)continue;var S=c[0],v=c[1];E(S,v)}}var A=new K.default(0,0,""),k=A.align==="middle"?"middle":"center";function m(_,E,g){var u=_;function a(){var S=w(_);if(S===null)throw new Error("Malformed timestamp: "+u);return _=_.replace(/^[^\sa-zA-Z-]+/,""),S}function i(S,v){var p=new B;N(S,function(h,d){var o;switch(h){case"region":for(var s=g.length-1;s>=0;s--)if(g[s].id===d){p.set(h,g[s].region);break}break;case"vertical":p.alt(h,d,["rl","lr"]);break;case"line":o=d.split(","),p.integer(h,o[0]),p.percent(h,o[0])&&p.set("snapToLines",!1),p.alt(h,o[0],["auto"]),o.length===2&&p.alt("lineAlign",o[1],["start",k,"end"]);break;case"position":o=d.split(","),p.percent(h,o[0]),o.length===2&&p.alt("positionAlign",o[1],["start",k,"end","line-left","line-right","auto"]);break;case"size":p.percent(h,d);break;case"align":p.alt(h,d,["start",k,"end","left","right"]);break}},/:/,/\s/),v.region=p.get("region",null),v.vertical=p.get("vertical","");var D=p.get("line","auto");D==="auto"&&A.line===-1&&(D=-1),v.line=D,v.lineAlign=p.get("lineAlign","start"),v.snapToLines=p.get("snapToLines",!0),v.size=p.get("size",100),v.align=p.get("align",k);var b=p.get("position","auto");b==="auto"&&A.position===50&&(b=v.align==="start"||v.align==="left"?0:v.align==="end"||v.align==="right"?100:50),v.position=b}function c(){_=_.replace(/^\s+/,"")}if(c(),E.startTime=a(),c(),_.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+u);_=_.substr(3),c(),E.endTime=a(),c(),i(_,E)}function O(_){return _.replace(/<br(?: \/)?>/gi,`
|
|
`)}var R=function(){function _(){this.state="INITIAL",this.buffer="",this.decoder=new I,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var E=_.prototype;return E.parse=function(u){var a=this;u&&(a.buffer+=a.decoder.decode(u,{stream:!0}));function i(){var b=a.buffer,h=0;for(b=O(b);h<b.length&&b[h]!=="\r"&&b[h]!==`
|
|
`;)++h;var d=b.substr(0,h);return b[h]==="\r"&&++h,b[h]===`
|
|
`&&++h,a.buffer=b.substr(h),d}function c(b){N(b,function(h,d){},/:/)}try{var S="";if(a.state==="INITIAL"){if(!/\r\n|\n/.test(a.buffer))return this;S=i();var v=S.match(/^()?WEBVTT([ \t].*)?$/);if(!v||!v[0])throw new Error("Malformed WebVTT signature.");a.state="HEADER"}for(var p=!1;a.buffer;){if(!/\r\n|\n/.test(a.buffer))return this;p?p=!1:S=i();switch(a.state){case"HEADER":/:/.test(S)?c(S):S||(a.state="ID");continue;case"NOTE":S||(a.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(S)){a.state="NOTE";break}if(!S)continue;if(a.cue=new K.default(0,0,""),a.state="CUE",S.indexOf("-->")===-1){a.cue.id=S;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{m(S,a.cue,a.regionList)}catch(b){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var D=S.indexOf("-->")!==-1;if(!S||D&&(p=!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+=S}continue;case"BADCUE":S||(a.state="ID")}}}catch(b){a.state==="CUETEXT"&&a.cue&&a.oncue&&a.oncue(a.cue),a.cue=null,a.state=a.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},E.flush=function(){var u=this;try{if((u.cue||u.state==="HEADER")&&(u.buffer+=`
|
|
|
|
`,u.parse()),u.state==="INITIAL"||u.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(a){u.onparsingerror&&u.onparsingerror(a)}return u.onflush&&u.onflush(),this},_}()},"./src/utils/webvtt-parser.ts":function(q,z,L){"use strict";L.r(z),L.d(z,"generateCueId",function(){return R}),L.d(z,"parseWebVTT",function(){return E});var K=L("./src/polyfills/number.ts"),I=L("./src/utils/vttparser.ts"),w=L("./src/demux/id3.ts"),B=L("./src/utils/timescale-conversion.ts"),N=L("./src/remux/mp4-remuxer.ts"),A=/\r\n|\n\r|\n|\r/g,k=function(u,a,i){return i===void 0&&(i=0),u.substr(i,a.length)===a},m=function(u){var a=parseInt(u.substr(-3)),i=parseInt(u.substr(-6,2)),c=parseInt(u.substr(-9,2)),S=u.length>9?parseInt(u.substr(0,u.indexOf(":"))):0;if(!Object(K.isFiniteNumber)(a)||!Object(K.isFiniteNumber)(i)||!Object(K.isFiniteNumber)(c)||!Object(K.isFiniteNumber)(S))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+u);return a+=1e3*i,a+=60*1e3*c,a+=60*60*1e3*S,a},O=function(u){for(var a=5381,i=u.length;i;)a=a*33^u.charCodeAt(--i);return(a>>>0).toString()};function R(g,u,a){return O(g.toString())+O(u.toString())+O(a)}var _=function(u,a,i){var c=u[a],S=u[c.prevCC];if(!S||!S.new&&c.new){u.ccOffset=u.presentationOffset=c.start,c.new=!1;return}for(;(v=S)!==null&&v!==void 0&&v.new;){var v;u.ccOffset+=c.start-S.start,c.new=!1,c=S,S=u[c.prevCC]}u.presentationOffset=i};function E(g,u,a,i,c,S,v,p){var D=new I.VTTParser,b=Object(w.utf8ArrayToStr)(new Uint8Array(g)).trim().replace(A,`
|
|
`).split(`
|
|
`),h=[],d=Object(B.toMpegTsClockFromTimescale)(u,a),o="00:00.000",s=0,C=0,y,x=!0,P=!1;D.oncue=function(j){var Y=i[c],Q=i.ccOffset,X=(s-d)/9e4;if(Y!=null&&Y.new&&(C!==void 0?Q=i.ccOffset=Y.start:_(i,c,X)),X&&(Q=X-i.presentationOffset),P){var F=j.endTime-j.startTime,$=Object(N.normalizePts)((j.startTime+Q-C)*9e4,S*9e4)/9e4;j.startTime=$,j.endTime=$+F}var re=j.text.trim();j.text=decodeURIComponent(encodeURIComponent(re)),j.id||(j.id=R(j.startTime,j.endTime,re)),j.endTime>0&&h.push(j)},D.onparsingerror=function(j){y=j},D.onflush=function(){if(y){p(y);return}v(h)},b.forEach(function(j){if(x)if(k(j,"X-TIMESTAMP-MAP=")){x=!1,P=!0,j.substr(16).split(",").forEach(function(Y){k(Y,"LOCAL:")?o=Y.substr(6):k(Y,"MPEGTS:")&&(s=parseInt(Y.substr(7)))});try{C=m(o)/1e3}catch(Y){P=!1,y=Y}return}else j===""&&(x=!1);D.parse(j+`
|
|
`)}),D.flush()}},"./src/utils/xhr-loader.ts":function(q,z,L){"use strict";L.r(z);var K=L("./src/utils/logger.ts"),I=L("./src/loader/load-stats.ts"),w=/^age:\s*[\d.]+\s*$/m,B=function(){function N(k){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=k?k.xhrSetup:null,this.stats=new I.LoadStats,this.retryDelay=0}var A=N.prototype;return A.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},A.abortInternal=function(){var m=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),m&&(m.onreadystatechange=null,m.onprogress=null,m.readyState!==4&&(this.stats.aborted=!0,m.abort()))},A.abort=function(){var m;this.abortInternal(),(m=this.callbacks)!==null&&m!==void 0&&m.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},A.load=function(m,O,R){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=m,this.config=O,this.callbacks=R,this.retryDelay=O.retryDelay,this.loadInternal()},A.loadInternal=function(){var m=this.config,O=this.context;if(!m)return;var R=this.loader=new self.XMLHttpRequest,_=this.stats;_.loading.first=0,_.loaded=0;var E=this.xhrSetup;try{if(E)try{E(R,O.url)}catch(a){R.open("GET",O.url,!0),E(R,O.url)}R.readyState||R.open("GET",O.url,!0);var g=this.context.headers;if(g)for(var u in g)R.setRequestHeader(u,g[u])}catch(a){this.callbacks.onError({code:R.status,text:a.message},O,R);return}O.rangeEnd&&R.setRequestHeader("Range","bytes="+O.rangeStart+"-"+(O.rangeEnd-1)),R.onreadystatechange=this.readystatechange.bind(this),R.onprogress=this.loadprogress.bind(this),R.responseType=O.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),m.timeout),R.send()},A.readystatechange=function(){var m=this.context,O=this.loader,R=this.stats;if(!m||!O)return;var _=O.readyState,E=this.config;if(R.aborted)return;if(_>=2)if(self.clearTimeout(this.requestTimeout),R.loading.first===0&&(R.loading.first=Math.max(self.performance.now(),R.loading.start)),_===4){O.onreadystatechange=null,O.onprogress=null;var g=O.status;if(g>=200&&g<300){R.loading.end=Math.max(self.performance.now(),R.loading.first);var u,a;if(m.responseType==="arraybuffer"?(u=O.response,a=u.byteLength):(u=O.responseText,a=u.length),R.loaded=R.total=a,!this.callbacks)return;var i=this.callbacks.onProgress;if(i&&i(R,m,u,O),!this.callbacks)return;var c={url:O.responseURL,data:u};this.callbacks.onSuccess(c,R,m,O)}else R.retry>=E.maxRetry||g>=400&&g<499?(K.logger.error(g+" while loading "+m.url),this.callbacks.onError({code:g,text:O.statusText},m,O)):(K.logger.warn(g+" while loading "+m.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,E.maxRetryDelay),R.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),E.timeout)},A.loadtimeout=function(){K.logger.warn("timeout while loading "+this.context.url);var m=this.callbacks;m&&(this.abortInternal(),m.onTimeout(this.stats,this.context,this.loader))},A.loadprogress=function(m){var O=this.stats;O.loaded=m.loaded,m.lengthComputable&&(O.total=m.total)},A.getCacheAge=function(){var m=null;if(this.loader&&w.test(this.loader.getAllResponseHeaders())){var O=this.loader.getResponseHeader("age");m=O?parseFloat(O):null}return m},N}();z.default=B}}).default})},vHTk:function(Ke,we,U){Ke.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wCXF:function(Ke,we,U){"use strict";U.d(we,"a",function(){return bt});var q=U("rePB"),z=U("VTBJ"),L=U("KQm4"),K=U("U8pU"),I=U("ODXe"),w=U("q1tI"),B=U("TSYQ"),N=U.n(B),A=U("Gytx"),k=U.n(A),m=U("Kwbf"),O=U("t23M"),R=U("qx4F"),_=U("6eGT"),E=U("IBYe"),g=U("Ff2n"),u=U("c+Xe"),a=U("fyJ8"),i=U("biw7");function c(Se,Ee,He,Ge,Re){var Ue=He[Se]||{},ge=He[Ee]||{},de,ce;Ue.fixed==="left"?de=Ge.left[Se]:ge.fixed==="right"&&(ce=Ge.right[Ee]);var te=!1,ie=!1,ae=!1,le=!1,Te=He[Ee+1],be=He[Se-1];if(Re==="rtl"){if(de!==void 0){var ze=be&&be.fixed==="left";le=!ze}else if(ce!==void 0){var dt=Te&&Te.fixed==="right";ae=!dt}}else if(de!==void 0){var yt=Te&&Te.fixed==="left";te=!yt}else if(ce!==void 0){var ct=be&&be.fixed==="right";ie=!ct}return{fixLeft:de,fixRight:ce,lastFixLeft:te,firstFixRight:ie,lastFixRight:ae,firstFixLeft:le,isSticky:Ge.isSticky}}var S=U("sR1s");function v(Se){var Ee=Se.cells,He=Se.stickyOffsets,Ge=Se.flattenColumns,Re=Se.rowComponent,Ue=Se.cellComponent,ge=Se.onHeaderRow,de=Se.index,ce=w.useContext(i.a),te=ce.prefixCls,ie=ce.direction,ae;ge&&(ae=ge(Ee.map(function(Te){return Te.column}),de));var le=Object(S.a)(Ee.map(function(Te){return Te.column}));return w.createElement(Re,Object.assign({},ae),Ee.map(function(Te,be){var ze=Te.column,dt=c(Te.colStart,Te.colEnd,Ge,He,ie),yt;return ze&&ze.onHeaderCell&&(yt=Te.column.onHeaderCell(ze)),w.createElement(a.a,Object.assign({},Te,{ellipsis:ze.ellipsis,align:ze.align,component:Ue,prefixCls:te,key:le[be]},dt,{additionalProps:yt,rowType:"header"}))}))}v.displayName="HeaderRow";var p=v;function D(Se){var Ee=[];function He(ge,de){var ce=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;Ee[ce]=Ee[ce]||[];var te=de,ie=ge.filter(Boolean).map(function(ae){var le={key:ae.key,className:ae.className||"",children:ae.title,column:ae,colStart:te},Te=1,be=ae.children;return be&&be.length>0&&(Te=He(be,te,ce+1).reduce(function(ze,dt){return ze+dt},0),le.hasSubColumns=!0),"colSpan"in ae&&(Te=ae.colSpan),"rowSpan"in ae&&(le.rowSpan=ae.rowSpan),le.colSpan=Te,le.colEnd=le.colStart+Te-1,Ee[ce].push(le),te+=Te,Te});return ie}He(Se,0);for(var Ge=Ee.length,Re=function(de){Ee[de].forEach(function(ce){!("rowSpan"in ce)&&!ce.hasSubColumns&&(ce.rowSpan=Ge-de)})},Ue=0;Ue<Ge;Ue+=1)Re(Ue);return Ee}function b(Se){var Ee=Se.stickyOffsets,He=Se.columns,Ge=Se.flattenColumns,Re=Se.onHeaderRow,Ue=w.useContext(i.a),ge=Ue.prefixCls,de=Ue.getComponent,ce=w.useMemo(function(){return D(He)},[He]),te=de(["header","wrapper"],"thead"),ie=de(["header","row"],"tr"),ae=de(["header","cell"],"th");return w.createElement(te,{className:"".concat(ge,"-thead")},ce.map(function(le,Te){var be=w.createElement(p,{key:Te,flattenColumns:Ge,cells:le,stickyOffsets:Ee,rowComponent:ie,cellComponent:ae,onHeaderRow:Re,index:Te});return be}))}var h=b,d=U("hW8S");function o(Se){for(var Ee=Se.colWidths,He=Se.columns,Ge=Se.columCount,Re=[],Ue=Ge||He.length,ge=!1,de=Ue-1;de>=0;de-=1){var ce=Ee[de],te=He&&He[de],ie=te&&te[d.a];(ce||ie||ge)&&(Re.unshift(w.createElement("col",Object.assign({key:de,style:{width:ce,minWidth:ce}},ie))),ge=!0)}return w.createElement("colgroup",null,Re)}var s=o;function C(Se,Ee){return Object(w.useMemo)(function(){for(var He=[],Ge=0;Ge<Ee;Ge+=1){var Re=Se[Ge];if(Re!==void 0)He[Ge]=Re;else return null}return He},[Se.join("_"),Ee])}var y=w.forwardRef(function(Se,Ee){var He=Se.noData,Ge=Se.columns,Re=Se.flattenColumns,Ue=Se.colWidths,ge=Se.columCount,de=Se.stickyOffsets,ce=Se.direction,te=Se.fixHeader,ie=Se.offsetHeader,ae=Se.stickyClassName,le=Se.onScroll,Te=Object(g.a)(Se,["noData","columns","flattenColumns","colWidths","columCount","stickyOffsets","direction","fixHeader","offsetHeader","stickyClassName","onScroll"]),be=w.useContext(i.a),ze=be.prefixCls,dt=be.scrollbarSize,yt=be.isSticky,ct=yt&&!te?0:dt,st=w.useRef(null),Be=w.useCallback(function(tt){Object(u.b)(Ee,tt),Object(u.b)(st,tt)},[]);w.useEffect(function(){var tt;function ft(Ae){var nt=Ae.currentTarget,gt=Ae.deltaX;gt&&(le({currentTarget:nt,scrollLeft:nt.scrollLeft+gt}),Ae.preventDefault())}return(tt=st.current)===null||tt===void 0||tt.addEventListener("wheel",ft),function(){var Ae;(Ae=st.current)===null||Ae===void 0||Ae.removeEventListener("wheel",ft)}},[]);var Fe=Re[Re.length-1],Pe={fixed:Fe?Fe.fixed:null,onHeaderCell:function(){return{className:"".concat(ze,"-cell-scrollbar")}}},oe=Object(w.useMemo)(function(){return ct?[].concat(Object(L.a)(Ge),[Pe]):Ge},[ct,Ge]),fe=Object(w.useMemo)(function(){return ct?[].concat(Object(L.a)(Re),[Pe]):Re},[ct,Re]),We=Object(w.useMemo)(function(){var tt=de.right,ft=de.left;return Object(z.a)(Object(z.a)({},de),{},{left:ce==="rtl"?[].concat(Object(L.a)(ft.map(function(Ae){return Ae+ct})),[0]):ft,right:ce==="rtl"?tt:[].concat(Object(L.a)(tt.map(function(Ae){return Ae+ct})),[0]),isSticky:yt})},[ct,de,yt]),Ie=C(Ue,ge);return w.createElement("div",{style:Object(z.a)({overflow:"hidden"},yt?{top:ie}:{}),ref:Be,className:N()("".concat(ze,"-header"),Object(q.a)({},ae,!!ae))},w.createElement("table",{style:{tableLayout:"fixed",visibility:He||Ie?null:"hidden"}},w.createElement(s,{colWidths:Ie?[].concat(Object(L.a)(Ie),[ct]):[],columCount:ge+1,columns:fe}),w.createElement(h,Object.assign({},Te,{stickyOffsets:We,columns:oe,flattenColumns:fe}))))});y.displayName="FixedHeader";var x=y,P=w.createContext(null),j=P;function Y(Se){var Ee=Se.prefixCls,He=Se.children,Ge=Se.component,Re=Se.cellComponent,Ue=Se.fixHeader,ge=Se.fixColumn,de=Se.horizonScroll,ce=Se.className,te=Se.expanded,ie=Se.componentWidth,ae=Se.colSpan,le=w.useContext(i.a),Te=le.scrollbarSize;return w.useMemo(function(){var be=He;return ge&&(be=w.createElement("div",{style:{width:ie-(Ue?Te:0),position:"sticky",left:0,overflow:"hidden"},className:"".concat(Ee,"-expanded-row-fixed")},be)),w.createElement(Ge,{className:ce,style:{display:te?null:"none"}},w.createElement(a.a,{component:Re,prefixCls:Ee,colSpan:ae},be))},[He,Ge,Ue,de,ce,te,ie,ae,Te])}var Q=Y;function X(Se){var Ee=Se.className,He=Se.style,Ge=Se.record,Re=Se.index,Ue=Se.rowKey,ge=Se.getRowKey,de=Se.rowExpandable,ce=Se.expandedKeys,te=Se.onRow,ie=Se.indent,ae=ie===void 0?0:ie,le=Se.rowComponent,Te=Se.cellComponent,be=Se.childrenColumnName,ze=w.useContext(i.a),dt=ze.prefixCls,yt=ze.fixedInfoList,ct=w.useContext(j),st=ct.fixHeader,Be=ct.fixColumn,Fe=ct.horizonScroll,Pe=ct.componentWidth,oe=ct.flattenColumns,fe=ct.expandableType,We=ct.expandRowByClick,Ie=ct.onTriggerExpand,tt=ct.rowClassName,ft=ct.expandedRowClassName,Ae=ct.indentSize,nt=ct.expandIcon,gt=ct.expandedRowRender,Bt=ct.expandIconColumnIndex,pt=w.useState(!1),sn=Object(I.a)(pt,2),gn=sn[0],en=sn[1],Dt=ce&&ce.has(Se.recordKey);w.useEffect(function(){Dt&&en(!0)},[Dt]);var Sn=fe==="row"&&(!de||de(Ge)),Nn=fe==="nest",Ne=be&&Ge&&Ge[be],it=Sn||Nn,Pt;te&&(Pt=te(Ge,Re));var Qt=function(f){if(We&&it&&Ie(Ge,f),Pt&&Pt.onClick){for(var T,W=arguments.length,J=new Array(W>1?W-1:0),G=1;G<W;G++)J[G-1]=arguments[G];(T=Pt).onClick.apply(T,[f].concat(J))}},un;typeof tt=="string"?un=tt:typeof tt=="function"&&(un=tt(Ge,Re,ae));var $e=Object(S.a)(oe),Ot=w.createElement(le,Object.assign({},Pt,{"data-row-key":Ue,className:N()(Ee,"".concat(dt,"-row"),"".concat(dt,"-row-level-").concat(ae),un,Pt&&Pt.className),style:Object(z.a)(Object(z.a)({},He),Pt?Pt.style:null),onClick:Qt}),oe.map(function(H,f){var T=H.render,W=H.dataIndex,J=H.className,G=$e[f],ve=yt[f],Ve;f===(Bt||0)&&Nn&&(Ve=w.createElement(w.Fragment,null,w.createElement("span",{style:{paddingLeft:"".concat(Ae*ae,"px")},className:"".concat(dt,"-row-indent indent-level-").concat(ae)}),nt({prefixCls:dt,expanded:Dt,expandable:Ne,record:Ge,onExpand:Ie})));var ht;return H.onCell&&(ht=H.onCell(Ge,Re)),w.createElement(a.a,Object.assign({className:J,ellipsis:H.ellipsis,align:H.align,component:Te,prefixCls:dt,key:G,record:Ge,index:Re,dataIndex:W,render:T,shouldCellUpdate:H.shouldCellUpdate},ve,{appendNode:Ve,additionalProps:ht}))})),Ht;if(Sn&&(gn||Dt)){var jt=gt(Ge,Re,ae+1,Dt),mn=ft&&ft(Ge,Re,ae);Ht=w.createElement(Q,{expanded:Dt,className:N()("".concat(dt,"-expanded-row"),"".concat(dt,"-expanded-row-level-").concat(ae+1),mn),prefixCls:dt,fixHeader:st,fixColumn:Be,horizonScroll:Fe,component:le,componentWidth:Pe,cellComponent:Te,colSpan:oe.length},jt)}var Jt;return Ne&&Dt&&(Jt=(Ge[be]||[]).map(function(H,f){var T=ge(H,f);return w.createElement(X,Object.assign({},Se,{key:T,rowKey:T,record:H,recordKey:T,index:f,indent:ae+1}))})),w.createElement(w.Fragment,null,Ot,Ht,Jt)}X.displayName="BodyRow";var F=X,$=w.createContext(null),re=$;function se(Se){var Ee=Se.columnKey,He=Se.onColumnResize,Ge=w.useRef();return w.useEffect(function(){Ge.current&&He(Ee,Ge.current.offsetWidth)},[]),w.createElement(O.a,{onResize:function(Ue){var ge=Ue.offsetWidth;He(Ee,ge)}},w.createElement("td",{ref:Ge,style:{padding:0,border:0,height:0}},w.createElement("div",{style:{height:0,overflow:"hidden"}},"\xA0")))}function he(Se){var Ee=Se.data,He=Se.getRowKey,Ge=Se.measureColumnWidth,Re=Se.expandedKeys,Ue=Se.onRow,ge=Se.rowExpandable,de=Se.emptyNode,ce=Se.childrenColumnName,te=w.useContext(re),ie=te.onColumnResize,ae=w.useContext(i.a),le=ae.prefixCls,Te=ae.getComponent,be=w.useContext(j),ze=be.fixHeader,dt=be.horizonScroll,yt=be.flattenColumns,ct=be.componentWidth;return w.useMemo(function(){var st=Te(["body","wrapper"],"tbody"),Be=Te(["body","row"],"tr"),Fe=Te(["body","cell"],"td"),Pe;Ee.length?Pe=Ee.map(function(fe,We){var Ie=He(fe,We);return w.createElement(F,{key:Ie,rowKey:Ie,record:fe,recordKey:Ie,index:We,rowComponent:Be,cellComponent:Fe,expandedKeys:Re,onRow:Ue,getRowKey:He,rowExpandable:ge,childrenColumnName:ce})}):Pe=w.createElement(Q,{expanded:!0,className:"".concat(le,"-placeholder"),prefixCls:le,fixHeader:ze,fixColumn:dt,horizonScroll:dt,component:Be,componentWidth:ct,cellComponent:Fe,colSpan:yt.length},de);var oe=Object(S.a)(yt);return w.createElement(st,{className:"".concat(le,"-tbody")},Ge&&w.createElement("tr",{"aria-hidden":"true",className:"".concat(le,"-measure-row"),style:{height:0}},oe.map(function(fe){return w.createElement(se,{key:fe,columnKey:fe,onColumnResize:ie})})),Pe)},[Ee,le,Ue,Ge,Re,He,Te,ct,de,yt])}var _e=w.memo(he);_e.displayName="Body";var xe=_e,Ce=U("wRmb"),Oe=U("xEkU"),De=U.n(Oe);function pe(Se){var Ee=Object(w.useRef)(Se),He=Object(w.useState)({}),Ge=Object(I.a)(He,2),Re=Ge[1],Ue=Object(w.useRef)(null),ge=Object(w.useRef)([]);function de(ce){Ue.current===null&&(ge.current=[],Ue.current=De()(function(){ge.current.forEach(function(te){Ee.current=te(Ee.current)}),Ue.current=null,Re({})})),ge.current.push(ce)}return Object(w.useEffect)(function(){return function(){De.a.cancel(Ue.current)}},[]),[Ee.current,de]}function ue(Se){var Ee=Object(w.useRef)(Se),He=Object(w.useRef)(null);function Ge(){window.clearTimeout(He.current)}function Re(ge){Ee.current=ge,Ge(),He.current=window.setTimeout(function(){Ee.current=null,He.current=null},100)}function Ue(){return Ee.current}return Object(w.useEffect)(function(){return Ge},[]),[Re,Ue]}function Me(Se,Ee,He){var Ge=Object(w.useMemo)(function(){for(var Re=[],Ue=[],ge=0,de=0,ce=0;ce<Ee;ce+=1)if(He==="rtl"){Ue[ce]=de,de+=Se[ce]||0;var te=Ee-ce-1;Re[te]=ge,ge+=Se[te]||0}else{Re[ce]=ge,ge+=Se[ce]||0;var ie=Ee-ce-1;Ue[ie]=de,de+=Se[ie]||0}return{left:Re,right:Ue}},[Se,Ee,He]);return Ge}var at=Me;function lt(Se){var Ee=Se.className,He=Se.children;return w.createElement("div",{className:Ee},He)}var et=lt,Qe=U("n6Qo");function je(Se){var Ee,He=Se.prefixCls,Ge=Se.record,Re=Se.onExpand,Ue=Se.expanded,ge=Se.expandable,de="".concat(He,"-row-expand-icon");if(!ge)return w.createElement("span",{className:N()(de,"".concat(He,"-row-spaced"))});var ce=function(ie){Re(Ge,ie),ie.stopPropagation()};return w.createElement("span",{className:N()(de,(Ee={},Object(q.a)(Ee,"".concat(He,"-row-expanded"),Ue),Object(q.a)(Ee,"".concat(He,"-row-collapsed"),!Ue),Ee)),onClick:ce})}function Ye(Se,Ee,He){var Ge=[];function Re(Ue){(Ue||[]).forEach(function(ge,de){Ge.push(Ee(ge,de)),Re(ge[He])})}return Re(Se),Ge}var rt=U("zT1h"),mt=U("y0+3"),ot=function(Ee,He){var Ge,Re,Ue=Ee.scrollBodyRef,ge=Ee.onScroll,de=Ee.offsetScroll,ce=w.useContext(i.a),te=ce.prefixCls,ie=((Ge=Ue.current)===null||Ge===void 0?void 0:Ge.scrollWidth)||0,ae=((Re=Ue.current)===null||Re===void 0?void 0:Re.clientWidth)||0,le=ie&&ae*(ae/ie),Te=w.useRef(),be=pe({scrollLeft:0,isHiddenScrollBar:!1}),ze=Object(I.a)(be,2),dt=ze[0],yt=ze[1],ct=w.useRef({delta:0,x:0}),st=w.useState(!1),Be=Object(I.a)(st,2),Fe=Be[0],Pe=Be[1],oe=function(){Pe(!1)},fe=function(Ae){Ae.persist(),ct.current.delta=Ae.pageX-dt.scrollLeft,ct.current.x=0,Pe(!0),Ae.preventDefault()},We=function(Ae){var nt,gt=Ae||((nt=window)===null||nt===void 0?void 0:nt.event),Bt=gt.buttons;if(!Fe||Bt===0){Fe&&Pe(!1);return}var pt=ct.current.x+Ae.pageX-ct.current.x-ct.current.delta;pt<=0&&(pt=0),pt+le>=ae&&(pt=ae-le),ge({scrollLeft:pt/ae*(ie+2)}),ct.current.x=Ae.pageX},Ie=function(){var Ae=Object(mt.b)(Ue.current).top,nt=Ae+Ue.current.offsetHeight,gt=document.documentElement.scrollTop+window.innerHeight;nt-Object(R.a)()<=gt||Ae>=gt-de?yt(function(Bt){return Object(z.a)(Object(z.a)({},Bt),{},{isHiddenScrollBar:!0})}):yt(function(Bt){return Object(z.a)(Object(z.a)({},Bt),{},{isHiddenScrollBar:!1})})},tt=function(Ae){yt(function(nt){return Object(z.a)(Object(z.a)({},nt),{},{scrollLeft:Ae/ie*ae||0})})};return w.useImperativeHandle(He,function(){return{setScrollLeft:tt}}),w.useEffect(function(){var ft=Object(rt.a)(document.body,"mouseup",oe,!1),Ae=Object(rt.a)(document.body,"mousemove",We,!1);return Ie(),function(){ft.remove(),Ae.remove()}},[le,Fe]),w.useEffect(function(){var ft=Object(rt.a)(window,"scroll",Ie,!1),Ae=Object(rt.a)(window,"resize",Ie,!1);return function(){ft.remove(),Ae.remove()}},[]),w.useEffect(function(){dt.isHiddenScrollBar||yt(function(ft){var Ae,nt;return Object(z.a)(Object(z.a)({},ft),{},{scrollLeft:Ue.current.scrollLeft/((Ae=Ue.current)===null||Ae===void 0?void 0:Ae.scrollWidth)*((nt=Ue.current)===null||nt===void 0?void 0:nt.clientWidth)})})},[dt.isHiddenScrollBar]),ie<=ae||!le||dt.isHiddenScrollBar?null:w.createElement("div",{style:{height:Object(R.a)(),width:ae,bottom:de},className:"".concat(te,"-sticky-scroll")},w.createElement("div",{onMouseDown:fe,ref:Te,className:N()("".concat(te,"-sticky-scroll-bar"),Object(q.a)({},"".concat(te,"-sticky-scroll-bar-active"),Fe)),style:{width:"".concat(le,"px"),transform:"translate3d(".concat(dt.scrollLeft,"px, 0, 0)")}}))},qe=w.forwardRef(ot);function Xe(Se,Ee){return w.useMemo(function(){var He=!!Se;return{isSticky:He,stickyClassName:He?"".concat(Ee,"-sticky-header"):"",offsetHeader:Object(K.a)(Se)==="object"&&Se.offsetHeader||0,offsetScroll:Object(K.a)(Se)==="object"&&Se.offsetScroll||0}},[Se,Ee])}var Ct=[],xt={},bt="rc-table-internal-hook",Et=w.memo(function(Se){var Ee=Se.children;return Ee},function(Se,Ee){return k()(Se.props,Ee.props)?Se.pingLeft!==Ee.pingLeft||Se.pingRight!==Ee.pingRight:!1});function At(Se){var Ee,He=Se.prefixCls,Ge=Se.className,Re=Se.rowClassName,Ue=Se.style,ge=Se.data,de=Se.rowKey,ce=Se.scroll,te=Se.tableLayout,ie=Se.direction,ae=Se.title,le=Se.footer,Te=Se.summary,be=Se.id,ze=Se.showHeader,dt=Se.components,yt=Se.emptyText,ct=Se.onRow,st=Se.onHeaderRow,Be=Se.internalHooks,Fe=Se.transformColumns,Pe=Se.internalRefs,oe=Se.sticky,fe=ge||Ct,We=!!fe.length,Ie=w.useState(0),tt=Object(I.a)(Ie,2),ft=tt[0],Ae=tt[1];w.useEffect(function(){Ae(Object(R.a)())});var nt=w.useMemo(function(){return Object(S.c)(dt,{})},[dt]),gt=w.useCallback(function(an,qt){return Object(S.b)(nt,an)||qt},[nt]),Bt=w.useMemo(function(){return typeof de=="function"?de:function(an){var qt=an&&an[de];return qt}},[de]),pt=Object(d.c)(Se),sn=pt.expandIcon,gn=pt.expandedRowKeys,en=pt.defaultExpandedRowKeys,Dt=pt.defaultExpandAllRows,Sn=pt.expandedRowRender,Nn=pt.onExpand,Ne=pt.onExpandedRowsChange,it=pt.expandRowByClick,Pt=pt.rowExpandable,Qt=pt.expandIconColumnIndex,un=pt.expandedRowClassName,$e=pt.childrenColumnName,Ot=pt.indentSize,Ht=sn||je,jt=$e||"children",mn=w.useMemo(function(){return Sn?"row":Se.expandable&&Be===bt&&Se.expandable.__PARENT_RENDER_ICON__||fe.some(function(an){return an&&Object(K.a)(an)==="object"&&an[jt]})?"nest":!1},[!!Sn,fe]),Jt=w.useState(function(){return en||(Dt?Ye(fe,Bt,jt):[])}),H=Object(I.a)(Jt,2),f=H[0],T=H[1],W=w.useMemo(function(){return new Set(gn||f||[])},[gn,f]),J=w.useCallback(function(an){var qt=Bt(an,fe.indexOf(an)),tn,kn=W.has(qt);kn?(W.delete(qt),tn=Object(L.a)(W)):tn=[].concat(Object(L.a)(W),[qt]),T(tn),Nn&&Nn(!kn,an),Ne&&Ne(tn)},[Bt,W,fe,Nn,Ne]),G=w.useState(0),ve=Object(I.a)(G,2),Ve=ve[0],ht=ve[1],Tt=Object(Ce.b)(Object(z.a)(Object(z.a)(Object(z.a)({},Se),pt),{},{expandable:!!Sn,expandedKeys:W,getRowKey:Bt,onTriggerExpand:J,expandIcon:Ht,expandIconColumnIndex:Qt,direction:ie}),Be===bt?Fe:null),Je=Object(I.a)(Tt,2),It=Je[0],kt=Je[1],rn=w.useMemo(function(){return{columns:It,flattenColumns:kt}},[It,kt]),An=w.useRef(),Vn=w.useRef(),vn=w.useRef(),hn=w.useState(!1),wn=Object(I.a)(hn,2),yn=wn[0],Cn=wn[1],fn=w.useState(!1),bn=Object(I.a)(fn,2),En=bn[0],Yn=bn[1],Kn=pe(new Map),Ar=Object(I.a)(Kn,2),Dn=Ar[0],fr=Ar[1],er=Object(S.a)(kt),lr=er.map(function(an){return Dn.get(an)}),_r=w.useMemo(function(){return lr},[lr.join("_")]),br=at(_r,kt.length,ie),pn=ce&&Object(S.d)(ce.y),Nt=ce&&Object(S.d)(ce.x),Rn=Nt&&kt.some(function(an){var qt=an.fixed;return qt}),dn=w.useRef(),_n=Xe(oe,He),cn=_n.isSticky,tr=_n.offsetHeader,Ln=_n.offsetScroll,$n=_n.stickyClassName,Er,Sr,ur;pn&&(Sr={overflowY:"scroll",maxHeight:ce.y}),Nt&&(Er={overflowX:"auto"},pn||(Sr={overflowY:"hidden"}),ur={width:ce.x===!0?"auto":ce.x,minWidth:"100%"});var Dr=w.useCallback(function(an,qt){fr(function(tn){var kn=new Map(tn);return kn.set(an,qt),kn})},[]),nr=ue(null),kr=Object(I.a)(nr,2),ir=kr[0],Rr=kr[1];function Ir(an,qt){if(!qt)return;typeof qt=="function"?qt(an):qt.scrollLeft!==an&&(qt.scrollLeft=an)}var dr=function(qt){var tn=qt.currentTarget,kn=qt.scrollLeft,ar=typeof kn=="number"?kn:tn.scrollLeft,Mn=tn||xt;if(!Rr()||Rr()===Mn){var Or;ir(Mn),Ir(ar,Vn.current),Ir(ar,vn.current),Ir(ar,(Or=dn.current)===null||Or===void 0?void 0:Or.setScrollLeft)}if(tn){var li=tn.scrollWidth,Wn=tn.clientWidth;Cn(ar>0),Yn(ar<li-Wn)}},Kr=function(){vn.current&&dr({currentTarget:vn.current})},jr=function(qt){var tn=qt.width;Kr(),ht(An.current?An.current.offsetWidth:tn)};w.useEffect(function(){return Kr},[]),w.useEffect(function(){Nt&&Kr()},[Nt]),w.useEffect(function(){Be===bt&&Pe&&(Pe.body.current=vn.current)});var Ft=gt(["table"],"table"),Yt=w.useMemo(function(){return te||(Rn?ce.x==="max-content"?"auto":"fixed":pn||kt.some(function(an){var qt=an.ellipsis;return qt})?"fixed":"auto")},[pn,Rn,kt,te]),zt,nn={colWidths:_r,columCount:kt.length,stickyOffsets:br,onHeaderRow:st,fixHeader:pn},Kt=w.useMemo(function(){return We?null:typeof yt=="function"?yt():yt},[We,yt]),Rt=w.createElement(xe,{data:fe,measureColumnWidth:pn||Nt||cn,expandedKeys:W,rowExpandable:Pt,getRowKey:Bt,onRow:ct,emptyNode:Kt,childrenColumnName:jt}),Wt=w.createElement(s,{colWidths:kt.map(function(an){var qt=an.width;return qt}),columns:kt}),Lt=Te&&w.createElement(Qe.b,null,Te(fe)),ln=gt(["body"]);if(pn||cn){var Gt;typeof ln=="function"?(Gt=ln(fe,{scrollbarSize:ft,ref:vn,onScroll:dr}),nn.colWidths=kt.map(function(an,qt){var tn=an.width,kn=qt===It.length-1?tn-ft:tn;return typeof kn=="number"&&!Number.isNaN(kn)?kn:(Object(m.a)(!1,"When use `components.body` with render props. Each column should have a fixed value."),0)})):Gt=w.createElement("div",{style:Object(z.a)(Object(z.a)({},Er),Sr),onScroll:dr,ref:vn,className:N()("".concat(He,"-body"))},w.createElement(Ft,{style:Object(z.a)(Object(z.a)({},ur),{},{tableLayout:Yt})},Wt,Rt,Lt),cn&&w.createElement(qe,{ref:dn,offsetScroll:Ln,scrollBodyRef:vn,onScroll:dr})),zt=w.createElement(w.Fragment,null,ze!==!1&&w.createElement(x,Object.assign({noData:!fe.length},nn,rn,{direction:ie,offsetHeader:tr,stickyClassName:$n,ref:Vn,onScroll:dr})),Gt)}else zt=w.createElement("div",{style:Object(z.a)(Object(z.a)({},Er),Sr),className:N()("".concat(He,"-content")),onScroll:dr,ref:vn},w.createElement(Ft,{style:Object(z.a)(Object(z.a)({},ur),{},{tableLayout:Yt})},Wt,ze!==!1&&w.createElement(h,Object.assign({},nn,rn)),Rt,Lt));var Un=Object(d.b)(Se),Zt=w.createElement("div",Object.assign({className:N()(He,Ge,(Ee={},Object(q.a)(Ee,"".concat(He,"-rtl"),ie==="rtl"),Object(q.a)(Ee,"".concat(He,"-ping-left"),yn),Object(q.a)(Ee,"".concat(He,"-ping-right"),En),Object(q.a)(Ee,"".concat(He,"-layout-fixed"),te==="fixed"),Object(q.a)(Ee,"".concat(He,"-fixed-header"),pn),Object(q.a)(Ee,"".concat(He,"-fixed-column"),Rn),Object(q.a)(Ee,"".concat(He,"-scroll-horizontal"),Nt),Object(q.a)(Ee,"".concat(He,"-has-fix-left"),kt[0]&&kt[0].fixed),Object(q.a)(Ee,"".concat(He,"-has-fix-right"),kt[kt.length-1]&&kt[kt.length-1].fixed==="right"),Ee)),style:Ue,id:be,ref:An},Un),w.createElement(Et,{pingLeft:yn,pingRight:En,props:Object(z.a)(Object(z.a)({},Se),{},{stickyOffsets:br,mergedExpandedKeys:W})},ae&&w.createElement(et,{className:"".concat(He,"-title")},ae(fe)),w.createElement("div",{className:"".concat(He,"-container")},zt),le&&w.createElement(et,{className:"".concat(He,"-footer")},le(fe))));Nt&&(Zt=w.createElement(O.a,{onResize:jr},Zt));var xn=w.useMemo(function(){return{prefixCls:He,getComponent:gt,scrollbarSize:ft,direction:ie,fixedInfoList:kt.map(function(an,qt){return c(qt,qt,kt,br,ie)}),isSticky:cn}},[He,gt,ft,ie,kt,br,ie,cn]),Vt=w.useMemo(function(){return Object(z.a)(Object(z.a)({},rn),{},{tableLayout:Yt,rowClassName:Re,expandedRowClassName:un,componentWidth:Ve,fixHeader:pn,fixColumn:Rn,horizonScroll:Nt,expandIcon:Ht,expandableType:mn,expandRowByClick:it,expandedRowRender:Sn,onTriggerExpand:J,expandIconColumnIndex:Qt,indentSize:Ot})},[rn,Yt,Re,un,Ve,pn,Rn,Nt,Ht,mn,it,Sn,J,Qt,Ot]),Fn=w.useMemo(function(){return{onColumnResize:Dr}},[Dr]);return w.createElement(i.a.Provider,{value:xn},w.createElement(j.Provider,{value:Vt},w.createElement(re.Provider,{value:Fn},Zt)))}At.Column=E.a,At.ColumnGroup=_.a,At.Summary=Qe.a,At.defaultProps={rowKey:"key",prefixCls:"rc-table",emptyText:function(){return"No Data"}};var St=we.b=At},wRmb:function(Ke,we,U){"use strict";U.d(we,"a",function(){return k});var q=U("rePB"),z=U("KQm4"),L=U("VTBJ"),K=U("Ff2n"),I=U("q1tI"),w=U.n(I),B=U("Kwbf"),N=U("Zm9Q"),A=U("hW8S");function k(E){return Object(N.a)(E).filter(function(g){return I.isValidElement(g)}).map(function(g){var u=g.key,a=g.props,i=a.children,c=Object(K.a)(a,["children"]),S=Object(L.a)({key:u},c);return i&&(S.children=k(i)),S})}function m(E){return E.reduce(function(g,u){var a=u.fixed,i=a===!0?"left":a,c=u.children;return c&&c.length>0?[].concat(Object(z.a)(g),Object(z.a)(m(c).map(function(S){return Object(L.a)({fixed:i},S)}))):[].concat(Object(z.a)(g),[Object(L.a)(Object(L.a)({},u),{},{fixed:i})])},[])}function O(E){for(var g=!0,u=0;u<E.length;u+=1){var a=E[u];if(g&&a.fixed!=="left")g=!1;else if(!g&&a.fixed==="left"){Object(B.a)(!1,"Index ".concat(u-1," of `columns` missing `fixed='left'` prop."));break}}for(var i=!0,c=E.length-1;c>=0;c-=1){var S=E[c];if(i&&S.fixed!=="right")i=!1;else if(!i&&S.fixed==="right"){Object(B.a)(!1,"Index ".concat(c+1," of `columns` missing `fixed='right'` prop."));break}}}function R(E){return E.map(function(g){var u=g.fixed,a=Object(K.a)(g,["fixed"]),i=u;return u==="left"?i="right":u==="right"&&(i="left"),Object(L.a)({fixed:i},a)})}function _(E,g){var u=E.prefixCls,a=E.columns,i=E.children,c=E.expandable,S=E.expandedKeys,v=E.getRowKey,p=E.onTriggerExpand,D=E.expandIcon,b=E.rowExpandable,h=E.expandIconColumnIndex,d=E.direction,o=E.expandRowByClick,s=I.useMemo(function(){return a||k(i)},[a,i]),C=I.useMemo(function(){if(c){var P,j=h||0,Y=s[j],Q=(P={},Object(q.a)(P,A.a,{className:"".concat(u,"-expand-icon-col")}),Object(q.a)(P,"title",""),Object(q.a)(P,"fixed",Y?Y.fixed:null),Object(q.a)(P,"className","".concat(u,"-row-expand-icon-cell")),Object(q.a)(P,"render",function($,re,se){var he=v(re,se),_e=S.has(he),xe=b?b(re):!0,Ce=D({prefixCls:u,expanded:_e,expandable:xe,record:re,onExpand:p});return o?I.createElement("span",{onClick:function(De){return De.stopPropagation()}},Ce):Ce}),P),X=s.slice();return j>=0&&X.splice(j,0,Q),X}return s},[c,s,v,S,D,d]),y=I.useMemo(function(){var P=C;return g&&(P=g(P)),P.length||(P=[{render:function(){return null}}]),P},[g,C,d]),x=I.useMemo(function(){return d==="rtl"?R(m(y)):m(y)},[y,d]);return[y,x]}we.b=_},"y0+3":function(Ke,we,U){"use strict";U.d(we,"a",function(){return m}),U.d(we,"b",function(){return R});var q=/margin|padding|width|height|max|min|offset/,z={left:!0,top:!0},L={cssFloat:1,styleFloat:1,float:1};function K(_){return _.nodeType===1?_.ownerDocument.defaultView.getComputedStyle(_,null):{}}function I(_,E,g){if(E=E.toLowerCase(),g==="auto"){if(E==="height")return _.offsetHeight;if(E==="width")return _.offsetWidth}return E in z||(z[E]=q.test(E)),z[E]?parseFloat(g)||0:g}function w(_,E){var g=arguments.length,u=K(_);return E=L[E]?"cssFloat"in _.style?"cssFloat":"styleFloat":E,g===1?u:I(_,E,u[E]||_.style[E])}function B(_,E,g){var u=arguments.length;if(E=L[E]?"cssFloat"in _.style?"cssFloat":"styleFloat":E,u===3)return typeof g=="number"&&q.test(E)&&(g="".concat(g,"px")),_.style[E]=g,g;for(var a in E)E.hasOwnProperty(a)&&B(_,a,E[a]);return K(_)}function N(_){return _===document.body?document.documentElement.clientWidth:_.offsetWidth}function A(_){return _===document.body?window.innerHeight||document.documentElement.clientHeight:_.offsetHeight}function k(){var _=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),E=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);return{width:_,height:E}}function m(){var _=document.documentElement.clientWidth,E=window.innerHeight||document.documentElement.clientHeight;return{width:_,height:E}}function O(){return{scrollLeft:Math.max(document.documentElement.scrollLeft,document.body.scrollLeft),scrollTop:Math.max(document.documentElement.scrollTop,document.body.scrollTop)}}function R(_){var E=_.getBoundingClientRect(),g=document.documentElement;return{left:E.left+(window.pageXOffset||g.scrollLeft)-(g.clientLeft||document.body.clientLeft||0),top:E.top+(window.pageYOffset||g.scrollTop)-(g.clientTop||document.body.clientTop||0)}}},ynwM:function(Ke,we,U){var q=U("MFOe"),z=q.Global;Ke.exports={name:"oldFF-globalStorage",read:K,write:I,each:w,remove:B,clearAll:N};var L=z.globalStorage;function K(A){return L[A]}function I(A,k){L[A]=k}function w(A){for(var k=L.length-1;k>=0;k--){var m=L.key(k);A(L[m],m)}}function B(A){return L.removeItem(A)}function N(){w(function(A,k){delete L[A]})}}}]);
|