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

1003 lines
1.1 MiB

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

(window.webpackJsonp=window.webpackJsonp||[]).push([[72,5,7,8,10,17],{"+NIl":
/*!***************************************************!*\
!*** ./node_modules/codemirror/mode/stex/stex.js ***!
\***************************************************/
/*! no static exports found */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){!function(t){"use strict";t.defineMode("stex",(function(t,e){function n(t,e){t.cmdState.push(e)}function r(t){return t.cmdState.length>0?t.cmdState[t.cmdState.length-1]:null}function i(t,e,n){return function(){this.name=t,this.bracketNo=0,this.style=e,this.styles=n,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var o={};function a(t,e){t.f=e}function s(t,e){var i;if(t.match(/^\\[a-zA-Z@]+/)){var s=t.current().slice(1);return n(e,i=new(i=o.hasOwnProperty(s)?o[s]:o.DEFAULT)),a(e,c),i.style}if(t.match(/^\\[$&%#{}_]/))return"tag";if(t.match(/^\\[,;!\/\\]/))return"tag";if(t.match("\\["))return a(e,(function(t,e){return l(t,e,"\\]")})),"keyword";if(t.match("\\("))return a(e,(function(t,e){return l(t,e,"\\)")})),"keyword";if(t.match("$$"))return a(e,(function(t,e){return l(t,e,"$$")})),"keyword";if(t.match("$"))return a(e,(function(t,e){return l(t,e,"$")})),"keyword";var u=t.next();return"%"==u?(t.skipToEnd(),"comment"):"}"==u||"]"==u?(i=r(e))?(i.closeBracket(u),a(e,c),"bracket"):"error":"{"==u||"["==u?(n(e,i=new(i=o.DEFAULT)),"bracket"):/\d/.test(u)?(t.eatWhile(/[\w.%]/),"atom"):(t.eatWhile(/[\w\-_]/),"begin"==(i=function(t){for(var e=t.cmdState,n=e.length-1;n>=0;n--){var r=e[n];if("DEFAULT"!=r.name)return r}return{styleIdentifier:function(){return null}}}(e)).name&&(i.argument=t.current()),i.styleIdentifier())}function l(t,e,n){if(t.eatSpace())return null;if(n&&t.match(n))return a(e,s),"keyword";if(t.match(/^\\[a-zA-Z@]+/))return"tag";if(t.match(/^[a-zA-Z]+/))return"variable-2";if(t.match(/^\\[$&%#{}_]/))return"tag";if(t.match(/^\\[,;!\/]/))return"tag";if(t.match(/^[\^_&]/))return"tag";if(t.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(t.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var r=t.next();return"{"==r||"}"==r||"["==r||"]"==r||"("==r||")"==r?"bracket":"%"==r?(t.skipToEnd(),"comment"):"error"}function c(t,e){var n=t.peek();return"{"==n||"["==n?(r(e).openBracket(n),t.eat(n),a(e,s),"bracket"):/[ \t\r]/.test(n)?(t.eat(n),null):(a(e,s),function(t){var e=t.cmdState.pop();e&&e.closeBracket()}(e),s(t,e))}return o.importmodule=i("importmodule","tag",["string","builtin"]),o.documentclass=i("documentclass","tag",["","atom"]),o.usepackage=i("usepackage","tag",["atom"]),o.begin=i("begin","tag",["atom"]),o.end=i("end","tag",["atom"]),o.label=i("label","tag",["atom"]),o.ref=i("ref","tag",["atom"]),o.eqref=i("eqref","tag",["atom"]),o.cite=i("cite","tag",["atom"]),o.bibitem=i("bibitem","tag",["atom"]),o.Bibitem=i("Bibitem","tag",["atom"]),o.RBibitem=i("RBibitem","tag",["atom"]),o.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}},{startState:function(){return{cmdState:[],f:e.inMathMode?function(t,e){return l(t,e)}:s}},copyState:function(t){return{cmdState:t.cmdState.slice(),f:t.f}},token:function(t,e){return e.f(t,e)},blankLine:function(t){t.f=s,t.cmdState.length=0},lineComment:"%"}})),t.defineMIME("text/x-stex","stex"),t.defineMIME("text/x-latex","stex")}(n(/*! ../../lib/codemirror */"VrN/"))},"0Ru7":
/*!**********************************************************************************************************!*\
!*** ./src/pages/Classrooms/Lists/Graduation/Tasks/Detail/components/WorkDescription/index.less?modules ***!
\**********************************************************************************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){t.exports={flex_box_center:"flex_box_center___2c1-o",flex_space_between:"flex_space_between___3UEAt",flex_box_vertical_center:"flex_box_vertical_center___2nDIB",flex_box_center_end:"flex_box_center_end___qHyDn",flex_box_column:"flex_box_column___3DlE6",listItem:"listItem___3_YnU",description:"description___34fLF",liked:"liked___9er6D",likedActive:"likedActive___1sBf0",reply:"reply___3pywq",replyList:"replyList___2xs49",comment:"comment___33KCb"}},"19Vz":
/*!**************************************************************!*\
!*** ./node_modules/codemirror/addon/display/placeholder.js ***!
\**************************************************************/
/*! no static exports found */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){!function(t){function e(t){t.state.placeholder&&(t.state.placeholder.parentNode.removeChild(t.state.placeholder),t.state.placeholder=null)}function n(t){e(t);var n=t.state.placeholder=document.createElement("pre");n.style.cssText="height: 0; overflow: visible",n.style.direction=t.getOption("direction"),n.className="CodeMirror-placeholder CodeMirror-line-like";var r=t.getOption("placeholder");"string"==typeof r&&(r=document.createTextNode(r)),n.appendChild(r),t.display.lineSpace.insertBefore(n,t.display.lineSpace.firstChild)}function r(t){o(t)&&n(t)}function i(t){var r=t.getWrapperElement(),i=o(t);r.className=r.className.replace(" CodeMirror-empty","")+(i?" CodeMirror-empty":""),i?n(t):e(t)}function o(t){return 1===t.lineCount()&&""===t.getLine(0)}t.defineOption("placeholder","",(function(o,a,s){var l=s&&s!=t.Init;if(a&&!l)o.on("blur",r),o.on("change",i),o.on("swapDoc",i),t.on(o.getInputField(),"compositionupdate",o.state.placeholderCompose=function(){!function(t){setTimeout((function(){var r=!1,i=t.getInputField();"TEXTAREA"==i.nodeName?r=!i.value:1==t.lineCount()&&(r=!/[^\u200b]/.test(i.querySelector(".CodeMirror-line").textContent)),r?n(t):e(t)}),20)}(o)}),i(o);else if(!a&&l){o.off("blur",r),o.off("change",i),o.off("swapDoc",i),t.off(o.getInputField(),"compositionupdate",o.state.placeholderCompose),e(o);var c=o.getWrapperElement();c.className=c.className.replace(" CodeMirror-empty","")}a&&!o.hasFocus()&&r(o)}))}(n(/*! ../../lib/codemirror */"VrN/"))},"1eCo":
/*!*************************************************!*\
!*** ./node_modules/codemirror/mode/xml/xml.js ***!
\*************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){!function(t){"use strict";var e={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},n={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};t.defineMode("xml",(function(r,i){var o,a,s=r.indentUnit,l={},c=i.htmlMode?e:n;for(var u in c)l[u]=c[u];for(var u in i)l[u]=i[u];function h(t,e){function n(n){return e.tokenize=n,n(t,e)}var r=t.next();return"<"==r?t.eat("!")?t.eat("[")?t.match("CDATA[")?n(f("atom","]]>")):null:t.match("--")?n(f("comment","--\x3e")):t.match("DOCTYPE",!0,!0)?(t.eatWhile(/[\w\._\-]/),n(function t(e){return function(n,r){for(var i;null!=(i=n.next());){if("<"==i)return r.tokenize=t(e+1),r.tokenize(n,r);if(">"==i){if(1==e){r.tokenize=h;break}return r.tokenize=t(e-1),r.tokenize(n,r)}}return"meta"}}(1))):null:t.eat("?")?(t.eatWhile(/[\w\._\-]/),e.tokenize=f("meta","?>"),"meta"):(o=t.eat("/")?"closeTag":"openTag",e.tokenize=d,"tag bracket"):"&"==r?(t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w\.\-:]/)&&t.eat(";"))?"atom":"error":(t.eatWhile(/[^&<]/),null)}function d(t,e){var n,r,i=t.next();if(">"==i||"/"==i&&t.eat(">"))return e.tokenize=h,o=">"==i?"endTag":"selfcloseTag","tag bracket";if("="==i)return o="equals",null;if("<"==i){e.tokenize=h,e.state=v,e.tagName=e.tagStart=null;var a=e.tokenize(t,e);return a?a+" tag error":"tag error"}return/[\'\"]/.test(i)?(e.tokenize=(n=i,(r=function(t,e){for(;!t.eol();)if(t.next()==n){e.tokenize=d;break}return"string"}).isInAttribute=!0,r),e.stringStartCol=t.column(),e.tokenize(t,e)):(t.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function f(t,e){return function(n,r){for(;!n.eol();){if(n.match(e)){r.tokenize=h;break}n.next()}return t}}function p(t,e,n){this.prev=t.context,this.tagName=e,this.indent=t.indented,this.startOfLine=n,(l.doNotIndent.hasOwnProperty(e)||t.context&&t.context.noIndent)&&(this.noIndent=!0)}function g(t){t.context&&(t.context=t.context.prev)}function m(t,e){for(var n;;){if(!t.context)return;if(n=t.context.tagName,!l.contextGrabbers.hasOwnProperty(n)||!l.contextGrabbers[n].hasOwnProperty(e))return;g(t)}}function v(t,e,n){return"openTag"==t?(n.tagStart=e.column(),y):"closeTag"==t?b:v}function y(t,e,n){return"word"==t?(n.tagName=e.current(),a="tag",S):l.allowMissingTagName&&"endTag"==t?(a="tag bracket",S(t,0,n)):(a="error",y)}function b(t,e,n){if("word"==t){var r=e.current();return n.context&&n.context.tagName!=r&&l.implicitlyClosed.hasOwnProperty(n.context.tagName)&&g(n),n.context&&n.context.tagName==r||!1===l.matchClosing?(a="tag",x):(a="tag error",C)}return l.allowMissingTagName&&"endTag"==t?(a="tag bracket",x(t,0,n)):(a="error",C)}function x(t,e,n){return"endTag"!=t?(a="error",x):(g(n),v)}function C(t,e,n){return a="error",x(t,0,n)}function S(t,e,n){if("word"==t)return a="attribute",E;if("endTag"==t||"selfcloseTag"==t){var r=n.tagName,i=n.tagStart;return n.tagName=n.tagStart=null,"selfcloseTag"==t||l.autoSelfClosers.hasOwnProperty(r)?m(n,r):(m(n,r),n.context=new p(n,r,i==n.indented)),v}return a="error",S}function E(t,e,n){return"equals"==t?k:(l.allowMissing||(a="error"),S(t,0,n))}function k(t,e,n){return"string"==t?w:"word"==t&&l.allowUnquoted?(a="string",S):(a="error",S(t,0,n))}function w(t,e,n){return"string"==t?w:S(t,0,n)}return h.isInText=!0,{startState:function(t){var e={tokenize:h,state:v,indented:t||0,tagName:null,tagStart:null,context:null};return null!=t&&(e.baseIndent=t),e},token:function(t,e){if(!e.tagName&&t.sol()&&(e.indented=t.indentation()),t.eatSpace())return null;o=null;var n=e.tokenize(t,e);return(n||o)&&"comment"!=n&&(a=null,e.state=e.state(o||n,t,e),a&&(n="error"==a?n+" error":a)),n},indent:function(e,n,r){var i=e.context;if(e.tokenize.isInAttribute)return e.tagStart==e.indented?e.stringStartCol+1:e.indented+s;if(i&&i.noIndent)return t.Pass;if(e.tokenize!=d&&e.tokenize!=h)return r?r.match(/^(\s*)/)[0].length:0;if(e.tagName)return!1!==l.multilineTagIndentPastTag?e.tagStart+e.tagName.length+2:e.tagStart+s*(l.multilineTagIndentFactor||1);if(l.alignCDATA&&/<!\[CDATA\[/.test(n))return 0;var o=n&&/^<(\/)?([\w_:\.-]*)/.exec(n);if(o&&o[1])for(;i;){if(i.tagName==o[2]){i=i.prev;break}if(!l.implicitlyClosed.hasOwnProperty(i.tagName))break;i=i.prev}else if(o)for(;i;){var a=l.contextGrabbers[i.tagName];if(!a||!a.hasOwnProperty(o[2]))break;i=i.prev}for(;i&&i.prev&&!i.startOfLine;)i=i.prev;return i?i.indent+s:e.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:l.htmlMode?"html":"xml",helperType:l.htmlMode?"html":"xml",skipAttribute:function(t){t.state==k&&(t.state=S)},xmlCurrentTag:function(t){return t.tagName?{name:t.tagName,close:"closeTag"==t.type}:null},xmlCurrentContext:function(t){for(var e=[],n=t.context;n;n=n.prev)n.tagName&&e.push(n.tagName);return e.reverse()}}})),t.defineMIME("text/xml","xml"),t.defineMIME("application/xml","xml"),t.mimeModes.hasOwnProperty("text/html")||t.defineMIME("text/html",{name:"xml",htmlMode:!0})}(n(/*! ../../lib/codemirror */"VrN/"))},"2tmY":
/*!*******************************************************************************!*\
!*** ./src/pages/Classrooms/Lists/Graduation/Tasks/Detail/index.less?modules ***!
\*******************************************************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){t.exports={flex_box_center:"flex_box_center___3cCaq",flex_space_between:"flex_space_between___2qraC",flex_box_vertical_center:"flex_box_vertical_center___vX_NO",flex_box_center_end:"flex_box_center_end___32vQ4",flex_box_column:"flex_box_column___BRJOV",title:"title___22OaF",menuTabs:"menuTabs___WeHMl",rightMenu:"rightMenu___1epZf",shixunDetail:"shixunDetail___34j2C"}},"55Ip":
/*!***************************************************************!*\
!*** ./node_modules/react-router-dom/esm/react-router-dom.js ***!
\***************************************************************/
/*! exports provided: MemoryRouter, Prompt, Redirect, Route, Router, StaticRouter, Switch, generatePath, matchPath, useHistory, useLocation, useParams, useRouteMatch, withRouter, BrowserRouter, HashRouter, Link, NavLink */
/*! exports used: Link, NavLink */function(t,e,n){"use strict";n.d(e,"a",(function(){return m})),n.d(e,"b",(function(){return b}));var r=n(/*! react-router */"Ty5D"),i=n(/*! @babel/runtime/helpers/esm/inheritsLoose */"dI71"),o=n(/*! react */"q1tI"),a=n.n(o),s=n(/*! history */"YS25"),l=(n(/*! prop-types */"17x9"),n(/*! @babel/runtime/helpers/esm/extends */"wx14")),c=n(/*! @babel/runtime/helpers/esm/objectWithoutPropertiesLoose */"zLVn"),u=n(/*! tiny-invariant */"9R94");a.a.Component;a.a.Component;var h=function(t,e){return"function"==typeof t?t(e):t},d=function(t,e){return"string"==typeof t?Object(s.c)(t,null,null,e):t},f=function(t){return t},p=a.a.forwardRef;void 0===p&&(p=f);var g=p((function(t,e){var n=t.innerRef,r=t.navigate,i=t.onClick,o=Object(c.a)(t,["innerRef","navigate","onClick"]),s=o.target,u=Object(l.a)({},o,{onClick:function(t){try{i&&i(t)}catch(e){throw t.preventDefault(),e}t.defaultPrevented||0!==t.button||s&&"_self"!==s||function(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}(t)||(t.preventDefault(),r())}});return u.ref=f!==p&&e||n,a.a.createElement("a",u)}));var m=p((function(t,e){var n=t.component,i=void 0===n?g:n,o=t.replace,s=t.to,m=t.innerRef,v=Object(c.a)(t,["component","replace","to","innerRef"]);return a.a.createElement(r.e.Consumer,null,(function(t){t||Object(u.a)(!1);var n=t.history,r=d(h(s,t.location),t.location),c=r?n.createHref(r):"",g=Object(l.a)({},v,{href:c,navigate:function(){var e=h(s,t.location);(o?n.replace:n.push)(e)}});return f!==p?g.ref=e||m:g.innerRef=m,a.a.createElement(i,g)}))})),v=function(t){return t},y=a.a.forwardRef;void 0===y&&(y=v);var b=y((function(t,e){var n=t["aria-current"],i=void 0===n?"page":n,o=t.activeClassName,s=void 0===o?"active":o,f=t.activeStyle,p=t.className,g=t.exact,b=t.isActive,x=t.location,C=t.sensitive,S=t.strict,E=t.style,k=t.to,w=t.innerRef,T=Object(c.a)(t,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return a.a.createElement(r.e.Consumer,null,(function(t){t||Object(u.a)(!1);var n=x||t.location,o=d(h(k,n),n),c=o.pathname,O=c&&c.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),L=O?Object(r.f)(n.pathname,{path:O,exact:g,sensitive:C,strict:S}):null,A=!!(b?b(L,n):L),D=A?function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.filter((function(t){return t})).join(" ")}(p,s):p,R=A?Object(l.a)({},E,{},f):E,M=Object(l.a)({"aria-current":A&&i||null,className:D,style:R,to:o},T);return v!==y?M.ref=e||w:M.innerRef=w,a.a.createElement(m,M)}))}))},"6+eU":
/*!************************************************************!*\
!*** ./node_modules/rc-pagination/es/index.js + 4 modules ***!
\************************************************************/
/*! exports provided: default */
/*! exports used: default */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createClass.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createSuper.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/defineProperty.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/extends.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/inherits.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-pagination/es/locale/zh_CN.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */function(t,e,n){"use strict";n.d(e,"a",(function(){return k}));var r=n("wx14"),i=n("rePB"),o=n("VTBJ"),a=n("1OyB"),s=n("vuIU"),l=n("Ji7U"),c=n("LK+K"),u=n("q1tI"),h=n.n(u),d=n("TSYQ"),f=n.n(d),p=function(t){var e,n="".concat(t.rootPrefixCls,"-item"),r=f()(n,"".concat(n,"-").concat(t.page),(e={},Object(i.a)(e,"".concat(n,"-active"),t.active),Object(i.a)(e,t.className,!!t.className),Object(i.a)(e,"".concat(n,"-disabled"),!t.page),e));return h.a.createElement("li",{title:t.showTitle?t.page:null,className:r,onClick:function(){t.onClick(t.page)},onKeyPress:function(e){t.onKeyPress(e,t.onClick,t.page)},tabIndex:"0"},t.itemRender(t.page,"page",h.a.createElement("a",{rel:"nofollow"},t.page)))},g=13,m=38,v=40,y=function(t){Object(l.a)(n,t);var e=Object(c.a)(n);function n(){var t;Object(a.a)(this,n);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return(t=e.call.apply(e,[this].concat(i))).state={goInputText:""},t.buildOptionText=function(e){return"".concat(e," ").concat(t.props.locale.items_per_page)},t.changeSize=function(e){t.props.changeSize(Number(e))},t.handleChange=function(e){t.setState({goInputText:e.target.value})},t.handleBlur=function(e){var n=t.props,r=n.goButton,i=n.quickGo,o=n.rootPrefixCls,a=t.state.goInputText;r||""===a||e.relatedTarget&&(e.relatedTarget.className.indexOf("".concat(o,"-prev"))>=0||e.relatedTarget.className.indexOf("".concat(o,"-next"))>=0)||(t.setState({goInputText:""}),i(t.getValidValue()))},t.go=function(e){""!==t.state.goInputText&&(e.keyCode!==g&&"click"!==e.type||(t.setState({goInputText:""}),t.props.quickGo(t.getValidValue())))},t}return Object(s.a)(n,[{key:"getValidValue",value:function(){var t=this.state,e=t.goInputText,n=t.current;return!e||isNaN(e)?n:Number(e)}},{key:"getPageSizeOptions",value:function(){var t=this.props,e=t.pageSize,n=t.pageSizeOptions;return n.some((function(t){return t.toString()===e.toString()}))?n:n.concat([e.toString()]).sort((function(t,e){return(isNaN(Number(t))?0:Number(t))-(isNaN(Number(e))?0:Number(e))}))}},{key:"render",value:function(){var t=this,e=this.props,n=e.pageSize,r=e.locale,i=e.rootPrefixCls,o=e.changeSize,a=e.quickGo,s=e.goButton,l=e.selectComponentClass,c=e.buildOptionText,u=e.selectPrefixCls,d=e.disabled,f=this.state.goInputText,p="".concat(i,"-options"),g=l,m=null,v=null,y=null;if(!o&&!a)return null;var b=this.getPageSizeOptions();if(o&&g){var x=b.map((function(e,n){return h.a.createElement(g.Option,{key:n,value:e.toString()},(c||t.buildOptionText)(e))}));m=h.a.createElement(g,{disabled:d,prefixCls:u,showSearch:!1,className:"".concat(p,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(n||b[0]).toString(),onChange:this.changeSize,getPopupContainer:function(t){return t.parentNode}},x)}return a&&(s&&(y="boolean"==typeof s?h.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:d,className:"".concat(p,"-quick-jumper-button")},r.jump_to_confirm):h.a.createElement("span",{onClick:this.go,onKeyUp:this.go},s)),v=h.a.createElement("div",{className:"".concat(p,"-quick-jumper")},r.jump_to,h.a.createElement("input",{disabled:d,type:"text",value:f,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),r.page,y)),h.a.createElement("li",{className:"".concat(p)},m,v)}}]),n}(h.a.Component);y.defaultProps={pageSizeOptions:["10","20","50","100"]};var b=y,x=n("N2Kk");function C(){}function S(t,e,n){var r=void 0===t?e.pageSize:t;return Math.floor((n.total-1)/r)+1}var E=function(t){Object(l.a)(n,t);var e=Object(c.a)(n);function n(t){var r;Object(a.a)(this,n),(r=e.call(this,t)).getJumpPrevPage=function(){return Math.max(1,r.state.current-(r.props.showLessItems?3:5))},r.getJumpNextPage=function(){return Math.min(S(void 0,r.state,r.props),r.state.current+(r.props.showLessItems?3:5))},r.getItemIcon=function(t,e){var n=r.props.prefixCls,i=t||h.a.createElement("button",{type:"button","aria-label":e,className:"".concat(n,"-item-link")});return"function"==typeof t&&(i=h.a.createElement(t,Object(o.a)({},r.props))),i},r.savePaginationNode=function(t){r.paginationNode=t},r.isValid=function(t){return"number"==typeof(e=t)&&isFinite(e)&&Math.floor(e)===e&&t!==r.state.current;var e},r.shouldDisplayQuickJumper=function(){var t=r.props,e=t.showQuickJumper,n=t.pageSize;return!(t.total<=n)&&e},r.handleKeyDown=function(t){t.keyCode!==m&&t.keyCode!==v||t.preventDefault()},r.handleKeyUp=function(t){var e=r.getValidValue(t);e!==r.state.currentInputValue&&r.setState({currentInputValue:e}),t.keyCode===g?r.handleChange(e):t.keyCode===m?r.handleChange(e-1):t.keyCode===v&&r.handleChange(e+1)},r.changePageSize=function(t){var e=r.state.current,n=S(t,r.state,r.props);e=e>n?n:e,0===n&&(e=r.state.current),"number"==typeof t&&("pageSize"in r.props||r.setState({pageSize:t}),"current"in r.props||r.setState({current:e,currentInputValue:e})),r.props.onShowSizeChange(e,t),"onChange"in r.props&&r.props.onChange&&r.props.onChange(e,t)},r.handleChange=function(t){var e=r.props.disabled,n=t;if(r.isValid(n)&&!e){var i=S(void 0,r.state,r.props);n>i?n=i:n<1&&(n=1),"current"in r.props||r.setState({current:n,currentInputValue:n});var o=r.state.pageSize;return r.props.onChange(n,o),n}return r.state.current},r.prev=function(){r.hasPrev()&&r.handleChange(r.state.current-1)},r.next=function(){r.hasNext()&&r.handleChange(r.state.current+1)},r.jumpPrev=function(){r.handleChange(r.getJumpPrevPage())},r.jumpNext=function(){r.handleChange(r.getJumpNextPage())},r.hasPrev=function(){return r.state.current>1},r.hasNext=function(){return r.state.current<S(void 0,r.state,r.props)},r.runIfEnter=function(t,e){if("Enter"===t.key||13===t.charCode){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];e.apply(void 0,r)}},r.runIfEnterPrev=function(t){r.runIfEnter(t,r.prev)},r.runIfEnterNext=function(t){r.runIfEnter(t,r.next)},r.runIfEnterJumpPrev=function(t){r.runIfEnter(t,r.jumpPrev)},r.runIfEnterJumpNext=function(t){r.runIfEnter(t,r.jumpNext)},r.handleGoTO=function(t){t.keyCode!==g&&"click"!==t.type||r.handleChange(r.state.currentInputValue)};var i=t.onChange!==C;"current"in t&&!i&&console.warn("Warning: You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component.");var s=t.defaultCurrent;"current"in t&&(s=t.current);var l=t.defaultPageSize;return"pageSize"in t&&(l=t.pageSize),s=Math.min(s,S(l,void 0,t)),r.state={current:s,currentInputValue:s,pageSize:l},r}return Object(s.a)(n,[{key:"componentDidUpdate",value:function(t,e){var n=this.props.prefixCls;if(e.current!==this.state.current&&this.paginationNode){var r=this.paginationNode.querySelector(".".concat(n,"-item-").concat(e.current));r&&document.activeElement===r&&r.blur()}}},{key:"getValidValue",value:function(t){var e=t.target.value,n=S(void 0,this.state,this.props),r=this.state.currentInputValue;return""===e?e:isNaN(Number(e))?r:e>=n?n:Number(e)}},{key:"getShowSizeChanger",value:function(){var t=this.props,e=t.showSizeChanger,n=t.total,r=t.totalBoundaryShowSizeChanger;return void 0!==e?e:n>r}},{key:"renderPrev",value:function(t){var e=this.props,n=e.prevIcon,r=(0,e.itemRender)(t,"prev",this.getItemIcon(n,"prev page")),i=!this.hasPrev();return Object(u.isValidElement)(r)?Object(u.cloneElement)(r,{disabled:i}):r}},{key:"renderNext",value:function(t){var e=this.props,n=e.nextIcon,r=(0,e.itemRender)(t,"next",this.getItemIcon(n,"next page")),i=!this.hasNext();return Object(u.isValidElement)(r)?Object(u.cloneElement)(r,{disabled:i}):r}},{key:"render",value:function(){var t=this,e=this.props,n=e.prefixCls,o=e.className,a=e.style,s=e.disabled,l=e.hideOnSinglePage,c=e.total,d=e.locale,g=e.showQuickJumper,m=e.showLessItems,v=e.showTitle,y=e.showTotal,x=e.simple,C=e.itemRender,E=e.showPrevNextJumpers,k=e.jumpPrevIcon,w=e.jumpNextIcon,T=e.selectComponentClass,O=e.selectPrefixCls,L=e.pageSizeOptions,A=this.state,D=A.current,R=A.pageSize,M=A.currentInputValue;if(!0===l&&c<=R)return null;var I=S(void 0,this.state,this.props),_=[],P=null,N=null,j=null,F=null,B=null,U=g&&g.goButton,H=m?1:2,z=D-1>0?D-1:0,G=D+1<I?D+1:I,V=Object.keys(this.props).reduce((function(e,n){return"data-"!==n.substr(0,5)&&"aria-"!==n.substr(0,5)&&"role"!==n||(e[n]=t.props[n]),e}),{});if(x)return U&&(B="boolean"==typeof U?h.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},d.jump_to_confirm):h.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},U),B=h.a.createElement("li",{title:v?"".concat(d.jump_to).concat(D,"/").concat(I):null,className:"".concat(n,"-simple-pager")},B)),h.a.createElement("ul",Object(r.a)({className:f()(n,"".concat(n,"-simple"),Object(i.a)({},"".concat(n,"-disabled"),s),o),style:a,ref:this.savePaginationNode},V),h.a.createElement("li",{title:v?d.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:f()("".concat(n,"-prev"),Object(i.a)({},"".concat(n,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(z)),h.a.createElement("li",{title:v?"".concat(D,"/").concat(I):null,className:"".concat(n,"-simple-pager")},h.a.createElement("input",{type:"text",value:M,disabled:s,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),h.a.createElement("span",{className:"".concat(n,"-slash")},"/"),I),h.a.createElement("li",{title:v?d.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:f()("".concat(n,"-next"),Object(i.a)({},"".concat(n,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(G)),B);if(I<=3+2*H){var W={locale:d,rootPrefixCls:n,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:v,itemRender:C};I||_.push(h.a.createElement(p,Object(r.a)({},W,{key:"noPager",page:I,className:"".concat(n,"-disabled")})));for(var K=1;K<=I;K+=1){var q=D===K;_.push(h.a.createElement(p,Object(r.a)({},W,{key:K,page:K,active:q})))}}else{var Y=m?d.prev_3:d.prev_5,X=m?d.next_3:d.next_5;E&&(P=h.a.createElement("li",{title:v?Y:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:f()("".concat(n,"-jump-prev"),Object(i.a)({},"".concat(n,"-jump-prev-custom-icon"),!!k))},C(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(k,"prev page"))),N=h.a.createElement("li",{title:v?X:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:f()("".concat(n,"-jump-next"),Object(i.a)({},"".concat(n,"-jump-next-custom-icon"),!!w))},C(this.getJumpNextPage(),"jump-next",this.getItemIcon(w,"next page")))),F=h.a.createElement(p,{locale:d,last:!0,rootPrefixCls:n,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:I,page:I,active:!1,showTitle:v,itemRender:C}),j=h.a.createElement(p,{locale:d,rootPrefixCls:n,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:v,itemRender:C});var $=Math.max(1,D-H),Z=Math.min(D+H,I);D-1<=H&&(Z=1+2*H),I-D<=H&&($=I-2*H);for(var J=$;J<=Z;J+=1){var Q=D===J;_.push(h.a.createElement(p,{locale:d,rootPrefixCls:n,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:J,page:J,active:Q,showTitle:v,itemRender:C}))}D-1>=2*H&&3!==D&&(_[0]=Object(u.cloneElement)(_[0],{className:"".concat(n,"-item-after-jump-prev")}),_.unshift(P)),I-D>=2*H&&D!==I-2&&(_[_.length-1]=Object(u.cloneElement)(_[_.length-1],{className:"".concat(n,"-item-before-jump-next")}),_.push(N)),1!==$&&_.unshift(j),Z!==I&&_.push(F)}var tt=null;y&&(tt=h.a.createElement("li",{className:"".concat(n,"-total-text")},y(c,[0===c?0:(D-1)*R+1,D*R>c?c:D*R])));var et=!this.hasPrev()||!I,nt=!this.hasNext()||!I;return h.a.createElement("ul",Object(r.a)({className:f()(n,o,Object(i.a)({},"".concat(n,"-disabled"),s)),style:a,unselectable:"unselectable",ref:this.savePaginationNode},V),tt,h.a.createElement("li",{title:v?d.prev_page:null,onClick:this.prev,tabIndex:et?null:0,onKeyPress:this.runIfEnterPrev,className:f()("".concat(n,"-prev"),Object(i.a)({},"".concat(n,"-disabled"),et)),"aria-disabled":et},this.renderPrev(z)),_,h.a.createElement("li",{title:v?d.next_page:null,onClick:this.next,tabIndex:nt?null:0,onKeyPress:this.runIfEnterNext,className:f()("".concat(n,"-next"),Object(i.a)({},"".concat(n,"-disabled"),nt)),"aria-disabled":nt},this.renderNext(G)),h.a.createElement(b,{disabled:s,locale:d,rootPrefixCls:n,selectComponentClass:T,selectPrefixCls:O,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:D,pageSize:R,pageSizeOptions:L,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:U}))}}],[{key:"getDerivedStateFromProps",value:function(t,e){var n={};if("current"in t&&(n.current=t.current,t.current!==e.current&&(n.currentInputValue=n.current)),"pageSize"in t&&t.pageSize!==e.pageSize){var r=e.current,i=S(t.pageSize,e,t);r=r>i?i:r,"current"in t||(n.current=r,n.currentInputValue=r),n.pageSize=t.pageSize}return n}}]),n}(h.a.Component);E.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:C,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:C,locale:x.a,style:{},itemRender:function(t,e,n){return n},totalBoundaryShowSizeChanger:50};var k=E},"6RRn":
/*!*******************************************!*\
!*** ./node_modules/rc-table/es/index.js ***!
\*******************************************/
/*! exports provided: Summary, Column, ColumnGroup, INTERNAL_COL_DEFINE, default */
/*! exports used: INTERNAL_COL_DEFINE, Summary, default */function(t,e,n){"use strict";var r=n(/*! ./Table */"wCXF"),i=n(/*! ./Footer */"n6Qo");n.d(e,"b",(function(){return i.a}));n(/*! ./sugar/Column */"IBYe"),n(/*! ./sugar/ColumnGroup */"6eGT");var o=n(/*! ./utils/legacyUtil */"hW8S");n.d(e,"a",(function(){return o.a})),e.c=r.b},"6UeF":
/*!**********************************************************************************!*\
!*** ./src/pages/Classrooms/Lists/Graduation/Tasks/Detail/index.tsx + 5 modules ***!
\**********************************************************************************/
/*! exports provided: default */
/*! all exports used */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@ant-design/icons/es/icons/ArrowLeftOutlined.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@ant-design/icons/es/icons/DeleteOutlined.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@ant-design/icons/es/icons/LikeOutlined.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/regenerator/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./src/pages/Classrooms/Lists/Graduation/Tasks/Detail/components/WorkDescription/index.less?modules (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./src/pages/Classrooms/Lists/Graduation/Tasks/Detail/index.less?modules (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./src/.umi-production/core/umiExports.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/components/RenderHtml/index.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/components/markdown-editor/index.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/env.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/util.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/breadcrumb/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/breadcrumb/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/button/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/button/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/col/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/col/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/form/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/form/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/input/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/input/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/message/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/message/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/modal/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/modal/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/pagination/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/pagination/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/row/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/row/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/select/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/select/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/table/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/table/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/tabs/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/tabs/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/tooltip/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/tooltip/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/moment/moment.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react-router-dom/esm/react-router-dom.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react-router/esm/react-router.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */function(t,e,n){"use strict";n.r(e);n("Znn+");var r=n("ZTPi"),i=(n("sPJy"),n("bE4q")),o=n("k1fw"),a=n("tJVT"),s=n("q1tI"),l=n.n(s),c=n("Ty5D"),u=n("55Ip"),h=n("9kvl"),d=n("jhfD"),f=n("1vsH"),p=(n("DjyN"),n("NUBc")),g=(n("5Dmo"),n("3S7+")),m=(n("14J3"),n("BMrR")),v=(n("+L6B"),n("2/Rp")),y=(n("miYZ"),n("tsqr")),b=n("9og8"),x=(n("jCWc"),n("kPKH")),C=(n("5NDa"),n("5rEg")),S=n("WmNS"),E=n.n(S),k=n("Ot1p"),w=n("m3rI"),T=n("9Bee"),O=(n("2qtc"),n("kLXV")),L=Object(h.a)((function(t){return{shixunHomeworks:t.shixunHomeworks}}))((function(t){var e=t.shixunHomeworks,n=t.dispatch;Object(c.i)();return l.a.createElement(O.a,{centered:!0,title:"提示",visible:"删除"===e.actionTabs.key,okText:"确定",cancelText:"取消",onOk:Object(b.a)(E.a.mark((function t(){return E.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n({type:"shixunHomeworks/deleteReply",payload:{object_id:e.actionTabs.selectArr.id,object_type:"journals_for_message"}});case 2:0===t.sent.status&&(y.b.success("删除成功"),n({type:"shixunHomeworks/setActionTabs",payload:{}}),n({type:"shixunHomeworks/getReplyList",payload:Object(o.a)({},e.actionTabs.params)}));case 4:case"end":return t.stop()}}),t)}))),onCancel:function(){n({type:"shixunHomeworks/setActionTabs",payload:{}})}},l.a.createElement("p",null,"确定要删除该条回复吗?"))})),A=n("wd/R"),D=n.n(A),R=n("/MfK"),M=n("BtR2"),I=n("0Ru7"),_=n.n(I);D.a.lang("ZH-cn");var P=Object(h.a)((function(t){var e=t.graduation,n=t.classroomList,r=t.loading;return{graduation:e,globalSetting:t.globalSetting,classroomList:n,loading:r.effects}}))((function(t){var e,n=t.graduation,r=t.classroomList,i=(t.globalSetting,t.loading,t.dispatch),u=Object(s.useState)(Object(o.a)({},Object(c.i)())),h=Object(a.a)(u,2),d=h[0],f=(h[1],Object(s.useState)(!1)),S=Object(a.a)(f,2),O=S[0],A=S[1],I=Object(s.useState)(-1),P=Object(a.a)(I,2),N=P[0],j=P[1],F=Object(s.useState)(""),B=Object(a.a)(F,2),U=B[0],H=B[1],z=(r.detailLeftMenus,n.graduationDetail,n.replyList),G=n.detail,V=n.tasksDetail;return d.page_size=10,Object(s.useEffect)((function(){i({type:"graduation/getReplyList",payload:Object(o.a)({},d)}),i({type:"graduation/getTopisDetail",payload:Object(o.a)({},d)})}),[d.categoryId]),l.a.createElement("section",{className:_.a.bg},l.a.createElement("section",{className:" edu-container"},l.a.createElement("aside",{className:[_.a.desc,"c-black","font14","bg-white"].join(" ")},l.a.createElement("h1",{className:_.a.description},G.description),l.a.createElement("div",{className:"mt30"},l.a.createElement("ul",{className:_.a.listItem},l.a.createElement("li",null,l.a.createElement("span",{className:"c-light-black"},"课题类型:"),l.a.createElement("span",null,{1:"设计",2:"论文",3:"创作"}[null==G?void 0:G.topic_type]||"--")),l.a.createElement("li",null,l.a.createElement("span",{className:"c-light-black"},"课题来源:"),l.a.createElement("span",null,{1:"生产/社会实际",2:"结合科研",3:"其它"}[null==G?void 0:G.topic_source]||"--")),l.a.createElement("li",null,l.a.createElement("span",{className:"c-light-black"},"课题性质1"),l.a.createElement("span",null,{1:"真题",2:"模拟题"}[null==G?void 0:G.topic_property_first]||"--")),l.a.createElement("li",null,l.a.createElement("span",{className:"c-light-black"},"课题性质2"),l.a.createElement("span",null,{1:"纵向课题",2:"横向课题",3:"自选"}[null==G?void 0:G.topic_property_second]||"--")),l.a.createElement("li",null,l.a.createElement("span",{className:"c-light-black"},"课题重复情况:"),l.a.createElement("span",null,{1:"新题",2:"往届题,有新要求",3:"往届题,无新要求"}[null==G?void 0:G.topic_repeat]||"--")),l.a.createElement("li",null,l.a.createElement("span",{className:"c-light-black"},"调研或实习地点:"),l.a.createElement("span",null,G.city||"--")),l.a.createElement("li",{className:"fl with50"},l.a.createElement("span",{className:"c-light-black"},"课题来源单位:"),l.a.createElement("span",null,G.source_unit||"--")))),l.a.createElement("div",{className:"pl30"},null==V||null===(e=V.attachments)||void 0===e?void 0:e.map((function(t,e){return l.a.createElement("div",null,l.a.createElement("a",{href:"".concat(w.a.API_SERVER).concat(t.url)},l.a.createElement("span",{className:"iconfont icon-fujian c-green font14"}),l.a.createElement("span",{className:"ml10 c-black"},t.title),l.a.createElement("span",{className:"c-light-black ml20 font12"},t.filesize)))})))),l.a.createElement("aside",{className:[_.a.reply,"bg-white","mt20"].join(" ")},O&&l.a.createElement(k.a,{onChange:function(t){H(t)},height:200,isFocus:!0,watch:!0}),l.a.createElement(m.a,{onClick:function(){A(!0)}},l.a.createElement(x.a,{flex:"1"},!O&&l.a.createElement(C.a,{size:"large",className:"current",placeholder:"说点什么",disabled:!0})),l.a.createElement(x.a,null,l.a.createElement(v.a,{type:"primary",size:"large",onClick:Object(b.a)(E.a.mark((function t(){return E.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(""!==U){t.next=4;break}y.b.error("请输入内容"),t.next=8;break;case 4:return t.next=6,i({type:"graduation/createReply",payload:{journals_for_message:{jour_id:d.categoryId,jour_type:"HomeworkCommon",reply_id:1,notes:U}}});case 6:0===t.sent.status&&(y.b.success("发布成功"),i({type:"graduation/getReplyList",payload:Object(o.a)({},d)}),A(!1));case 8:case"end":return t.stop()}}),t)})))},"发表")))),(null==z?void 0:z.comments)&&""!=z.comments&&l.a.createElement("aside",{className:[_.a.replyList,"bg-white"].join(" ")},null==z?void 0:z.comments.map((function(t,e){var n,r;return l.a.createElement(m.a,{gutter:[12,12],key:e},l.a.createElement(x.a,{flex:"40px"},l.a.createElement("img",{width:"40",src:"".concat(w.a.IMG_SERVER,"/images/").concat(null==t||null===(n=t.author)||void 0===n?void 0:n.image_url)})),l.a.createElement(x.a,{flex:"1"},l.a.createElement(m.a,{align:"middle"},l.a.createElement(x.a,{span:24},l.a.createElement("span",{className:"c-light-black"},null==t||null===(r=t.author)||void 0===r?void 0:r.name),l.a.createElement("span",{className:"c-light-black ml10"},D()(null==t?void 0:t.created_on).fromNow()," 发布")),l.a.createElement(x.a,{span:24},l.a.createElement(T.a,{value:t.content})),t.children&&l.a.createElement("aside",{className:_.a.comment},t.children.map((function(e,n){return l.a.createElement(m.a,{key:n},l.a.createElement(x.a,{span:24},l.a.createElement(m.a,null,l.a.createElement(x.a,{flex:"1"},e.author.name,l.a.createElement("span",{className:"c-light-black ml10"},D()(null==e?void 0:e.created_on).fromNow())),l.a.createElement(x.a,null,l.a.createElement(g.a,{title:"删除"},l.a.createElement(R.a,{className:"current",onClick:function(){i({type:"graduation/setActionTabs",payload:{key:"删除",params:d,selectArr:t}})}}))))),l.a.createElement(x.a,null,l.a.createElement("strong",null,l.a.createElement(T.a,{value:e.content}))))}))),l.a.createElement(x.a,{span:24,className:"mt5 c-light-black"},N===e&&l.a.createElement("aside",null,l.a.createElement(k.a,{onChange:function(t){H(t)},height:150,isFocus:!0}),l.a.createElement(m.a,null,l.a.createElement(x.a,{span:24,className:"tr"},l.a.createElement(v.a,{type:"primary",size:"large",onClick:Object(b.a)(E.a.mark((function e(){return E.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(""!==U){e.next=4;break}y.b.error("请输入内容"),e.next=9;break;case 4:return e.next=6,i({type:"graduation/createReply",payload:{journals_for_message:{jour_id:d.categoryId,jour_type:"HomeworkCommon",m_parent_id:t.id,reply_id:1,notes:U}}});case 6:i({type:"graduation/getReplyList",payload:Object(o.a)({},d)}),y.b.success("发布成功"),j(-1);case 9:case"end":return e.stop()}}),e)})))},"发表")))),N!==e&&l.a.createElement("div",{className:"tr"},l.a.createElement("span",{className:"iconfont icon-huifu1 mr5 ml30",onClick:function(){return j(e)}}),t.liked&&l.a.createElement("span",{className:"c-orange"},l.a.createElement(M.a,{className:"mr5 ml30",onClick:Object(b.a)(E.a.mark((function e(){return E.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i({type:"graduation/replyUnLike",payload:{object_id:t.id,object_type:"message"}});case 2:i({type:"graduation/getReplyList",payload:Object(o.a)({},d)});case 3:case"end":return e.stop()}}),e)})))}),t.praises_count),!t.liked&&l.a.createElement("span",null,l.a.createElement(M.a,{className:"mr5 ml30",onClick:Object(b.a)(E.a.mark((function e(){return E.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i({type:"graduation/replyLike",payload:{object_id:t.id,object_type:"message"}});case 2:i({type:"graduation/getReplyList",payload:Object(o.a)({},d)});case 3:case"end":return e.stop()}}),e)})))}),t.praises_count))))))})))),l.a.createElement("aside",{className:"tc mt30 pb30"},l.a.createElement(p.a,{defaultCurrent:1,total:null==z?void 0:z.total_count,hideOnSinglePage:!0,current:d.page||1,onChange:function(t){d.page=t,i({type:"graduation/getReplyList",payload:Object(o.a)({},d)})}})),l.a.createElement(L,null))})),N=(n("g9YV"),n("wCAj")),j=(n("y8nQ"),n("Vl3Y")),F=n("PpiC"),B=Object(h.a)((function(t){return{graduation:t.graduation}}))((function(t){var e=t.graduation,n=t.dispatch,r=(Object(F.a)(t,["graduation","dispatch"]),Object(c.i)());return l.a.createElement(O.a,{centered:!0,title:"提示",visible:"拒绝"===e.actionTabs.key,okText:"确定",cancelText:"取消",onOk:Object(b.a)(E.a.mark((function t(){return E.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n({type:"graduation/refuseTopic",payload:Object(o.a)({student_graduation_topic:e.actionTabs.selectArrs.id},r)});case 2:0===t.sent.status&&(y.b.success("拒绝成功"),n({type:"graduation/setActionTabs",payload:{}}),n({type:"graduation/getTopisDetailList",payload:Object(o.a)({},e.actionTabs.params)}));case 4:case"end":return t.stop()}}),t)}))),onCancel:function(){n({type:"graduation/setActionTabs",payload:{}})}},l.a.createElement("p",null,"是否确认拒绝学生选题?"))})),U=(n("OaEy"),n("2fM7")),H=Object(h.a)((function(t){return{graduation:t.graduation}}))((function(t){var e,n=t.graduation,r=t.dispatch,i=(Object(F.a)(t,["graduation","dispatch"]),Object(c.i)()),s=n.detailList,u=j.a.useForm(),h=Object(a.a)(u,1)[0];return l.a.createElement(O.a,{centered:!0,title:"同意选题",visible:"同意"===n.actionTabs.key,okText:"确定",cancelText:"取消",onOk:Object(b.a)(E.a.mark((function t(){var e,a;return E.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,h.validateFields();case 2:return a=h.getFieldsValue(),t.next=5,r({type:"graduation/agreeTopic",payload:Object(o.a)({group_id:a.group_id,course_group_name:null==s||null===(e=s.group_list)||void 0===e?void 0:e.filter((function(t){return t.group_id==a.group_id}))[0].group_name,student_graduation_topic:n.actionTabs.selectArrs.id},i)});case 5:0===t.sent.status&&(y.b.success("同意成功"),r({type:"graduation/setActionTabs",payload:{}}),r({type:"graduation/getTopisDetailList",payload:Object(o.a)({},n.actionTabs.params)}));case 7:case"end":return t.stop()}}),t)}))),onCancel:function(){r({type:"graduation/setActionTabs",payload:{}})}},l.a.createElement("p",null,"确认同意学生的选题,将学生加入我的分班"),l.a.createElement(j.a,{form:h},l.a.createElement(j.a.Item,{name:"group_id",label:"选择:",rules:[{required:!0,message:"请选择分班"}]},l.a.createElement(U.a,{placeholder:"请选择分班",size:"large"},null==s||null===(e=s.group_list)||void 0===e?void 0:e.map((function(t,e){return l.a.createElement(U.a.Option,{value:t.group_id},t.group_name)}))))))})),z=Object(h.a)((function(t){return{graduation:t.graduation,loading:t.loading.effects}}))((function(t){var e=t.graduation,n=t.loading,r=t.dispatch,i=Object(s.useState)(Object(o.a)({},Object(c.i)())),u=Object(a.a)(i,2),h=u[0],d=(u[1],Object(c.h)(),e.detailList),f=Object(s.useState)({}),g=Object(a.a)(f,2),m=(g[0],g[1],j.a.useForm()),v=(Object(a.a)(m,1)[0],[{title:"序号",dataIndex:"name",width:200,align:"center",render:function(t,e,n){return n+1}},{title:"姓名",dataIndex:"student_name"},{title:"学号",dataIndex:"student_id"},{title:"分班",dataIndex:"class_group_name"},{title:"选题时间",dataIndex:"selected_time"},{title:"确认结果",dataIndex:"result",render:function(t){return"已拒绝"===t?l.a.createElement("span",{className:"c-orange"},"已拒绝"):t}},{title:"操作",dataInex:"action",render:function(t,e){return l.a.createElement("div",null,("待确认"===e.result||"已同意"===e.result)&&l.a.createElement("span",{className:"current",onClick:function(){r({type:"graduation/setActionTabs",payload:{key:"拒绝",selectArrs:e,params:h}})}},"拒绝"),"待确认"===e.result&&l.a.createElement("span",{className:"current ml20 c-blue",onClick:function(){r({type:"graduation/setActionTabs",payload:{key:"同意",selectArrs:e,params:h}})}},"同意"))}}]);return l.a.createElement(l.a.Fragment,null,l.a.createElement("section",{className:"minH500 bg-white "},l.a.createElement(N.a,{loading:n["graduation/getTopisDetailList"],pagination:!1,dataSource:d.users_list,columns:v}),l.a.createElement(B,null),l.a.createElement(H,null)),l.a.createElement("aside",{className:"tc mb50 mt30"},l.a.createElement(p.a,{hideOnSinglePage:!0,showSizeChanger:!1,onChange:function(t,e){h.page=t,h.limit=20,r({type:"graduation/getTopisDetailList",payload:Object(o.a)({},h)})},defaultCurrent:h.page||1,current:h.page||1,defaultPageSize:15,total:e.users_count})))})),G=n("2tmY"),V=n.n(G);e.default=Object(h.a)((function(t){var e=t.graduation,n=t.loading;return{graduation:e,globalSetting:t.globalSetting,loading:n.effects}}))((function(t){var e=t.graduation,n=(t.globalSetting,t.loading,t.dispatch),h=Object(c.i)(),p=Object(c.h)(),g=Object(s.useState)([]),m=Object(a.a)(g,2),v=(m[0],m[1],Object(s.useState)(p.query.tabs||0)),y=Object(a.a)(v,2),b=y[0],x=(y[1],e.detailTaskList);e.tasksDetail;h.category=p.query.category_id,Object(s.useEffect)((function(){n({type:"graduation/getTasksDetail",payload:Object(o.a)({},h)}),n({type:"graduation/getTasksListDetail",payload:Object(o.a)({},h)})}),[h.coursesId]);var C=[{name:"任务列表",id:0,compontent:l.a.createElement(z,null)},{name:"任务描述",id:1,compontent:l.a.createElement(P,null)}];return l.a.createElement("section",null,l.a.createElement("div",{className:"edu-container"},x.course_name&&l.a.createElement("section",{className:"animated fadeIn"},l.a.createElement("aside",{className:"mt10"},l.a.createElement(i.a,{separator:">"},l.a.createElement(i.a.Item,null,l.a.createElement(u.a,{to:"/classrooms/".concat(x.course_id,"/shixun_homework")},x.course_name)),l.a.createElement(i.a.Item,null,l.a.createElement(u.a,{to:"/classrooms/".concat(x.course_id,"/graduation_tasks")},"毕设任务")),l.a.createElement(i.a.Item,null,"任务详情"))),l.a.createElement("aside",{className:[V.a.title,"mt20"].join(" ")},l.a.createElement(u.a,{to:"/classrooms/".concat(x.course_id,"/graduation_tasks")},l.a.createElement(d.a,{className:"font16 c-black"})),l.a.createElement("strong",{className:"font20 ml5"},x.task_name),l.a.createElement(f.k,{status:[x.status_name]}))),l.a.createElement("aside",{className:"mt30 relative"},l.a.createElement("aside",{className:V.a.rightMenu},l.a.createElement(u.a,{className:V.a.shixunDetail,to:"/classrooms/".concat(h.coursesId,"/graduation_tasks/").concat(h.categoryId,"/edit")},l.a.createElement("span",{className:"iconfont icon-shixunxiangqing"}),"编辑任务")),l.a.createElement(r.a,{defaultActiveKey:b,className:V.a.menuTabs},C.map((function(t,e){return l.a.createElement(r.a.TabPane,{tab:t.name,key:t.id},t.compontent)}))))))}))},"6eGT":
/*!*******************************************************!*\
!*** ./node_modules/rc-table/es/sugar/ColumnGroup.js ***!
\*******************************************************/
/*! exports provided: default */
/*! exports used: default */function(t,e,n){"use strict";e.a=function(t){return null}},"7Cbv":
/*!**************************************************************!*\
!*** ./node_modules/uuid/dist/esm-browser/v4.js + 4 modules ***!
\**************************************************************/
/*! exports provided: default */
/*! exports used: default */function(t,e,n){"use strict";var r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),i=new Uint8Array(16);function o(){if(!r)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(i)}var a=/^(?:[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;for(var s=function(t){return"string"==typeof t&&a.test(t)},l=[],c=0;c<256;++c)l.push((c+256).toString(16).substr(1));var u=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(l[t[e+0]]+l[t[e+1]]+l[t[e+2]]+l[t[e+3]]+"-"+l[t[e+4]]+l[t[e+5]]+"-"+l[t[e+6]]+l[t[e+7]]+"-"+l[t[e+8]]+l[t[e+9]]+"-"+l[t[e+10]]+l[t[e+11]]+l[t[e+12]]+l[t[e+13]]+l[t[e+14]]+l[t[e+15]]).toLowerCase();if(!s(n))throw TypeError("Stringified UUID is invalid");return n};e.a=function(t,e,n){var r=(t=t||{}).random||(t.rng||o)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){n=n||0;for(var i=0;i<16;++i)e[n+i]=r[i];return e}return u(r)}},"7ahc":
/*!*************************************************************!*\
!*** ./src/components/markdown-editor/code-block/index.tsx ***!
\*************************************************************/
/*! exports provided: default, MyCodeMirror */
/*! exports used: MyCodeMirror, default */function(t,e,n){"use strict";n.d(e,"a",(function(){return m}));var r=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2 */"k1fw"),i=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/extends */"0Owb"),o=(n(/*! antd/es/button/style */"+L6B"),n(/*! antd/es/button */"2/Rp")),a=(n(/*! antd/es/form/style */"y8nQ"),n(/*! antd/es/form */"Vl3Y")),s=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray */"tJVT"),l=(n(/*! antd/es/select/style */"OaEy"),n(/*! antd/es/select */"2fM7")),c=n(/*! react */"q1tI"),u=n.n(c),h=n(/*! codemirror */"VrN/"),d=n.n(h),f=(n(/*! codemirror/lib/codemirror.css */"p77/"),n(/*! codemirror/theme/blackboard.css */"c5Ni"),l.a.Option),p={labelCol:{span:4},wrapperCol:{span:20}},g={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"]};function m(t){var e=t.value,n=t.onChange,i=t.mode,o=t.options,a=void 0===o?{}:o,l=Object(c.useRef)(),h=Object(c.useState)(),f=Object(s.a)(h,2),p=f[0],g=f[1];return Object(c.useEffect)((function(){if(p){function t(t){var e=t.getValue();n&&n(e)}return p.on("change",t),function(){p.off("change",t)}}}),[p,n]),Object(c.useEffect)((function(){p&&p.setOption("mode",i)}),[p,i]),Object(c.useEffect)((function(){p&&(e===p.getValue()&&""!==e||setTimeout((function(){p.setValue(e||" ")}),300))}),[p,e]),Object(c.useEffect)((function(){if(l.current&&!p){var t=d.a.fromTextArea(l.current,Object(r.a)({mode:i,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},a));g(t)}}),[l.current,p]),u.a.createElement("div",{className:"my-codemirror-container"},u.a.createElement("textarea",{ref:l}))}e.b=function(t){var e=t.callback,n=t.onCancel,r=Object(c.useState)("python"),h=Object(s.a)(r,2),d=h[0],v=h[1];return u.a.createElement(a.a,Object(i.a)({},p,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:function(t){e(t)}}),u.a.createElement(a.a.Item,{label:"代码语言",name:"language"},u.a.createElement(l.a,{onChange:function(t){v(g[t][1])}},Object.keys(g).map((function(t){return u.a.createElement(f,{key:t,value:t},g[t][0])})))),u.a.createElement(a.a.Item,{label:"代码内容",name:"content",rules:[{required:!0,message:"请输入代码内容"}]},u.a.createElement(m,{mode:d})),u.a.createElement("div",{className:"flex-container flex-end"},u.a.createElement(o.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"确定"),u.a.createElement(o.a,{type:"ghost",onClick:n},"取消")))}},"815F":
/*!***************************************************!*\
!*** ./node_modules/rc-tree/es/utils/treeUtil.js ***!
\***************************************************/
/*! exports provided: getKey, warningWithoutKey, convertTreeToData, flattenTreeData, traverseDataNodes, convertDataToEntities, getTreeNodeProps, convertNodePropsToEventData */
/*! exports used: convertDataToEntities, convertNodePropsToEventData, convertTreeToData, flattenTreeData, getKey, getTreeNodeProps */function(t,e,n){"use strict";n.d(e,"e",(function(){return c})),n.d(e,"c",(function(){return u})),n.d(e,"d",(function(){return h})),n.d(e,"a",(function(){return f})),n.d(e,"f",(function(){return p})),n.d(e,"b",(function(){return g}));var r=n(/*! @babel/runtime/helpers/esm/toConsumableArray */"KQm4"),i=n(/*! @babel/runtime/helpers/esm/objectSpread2 */"VTBJ"),o=n(/*! @babel/runtime/helpers/esm/objectWithoutProperties */"Ff2n"),a=n(/*! rc-util/es/Children/toArray */"Zm9Q"),s=n(/*! rc-util/es/warning */"Kwbf"),l=n(/*! ../util */"OZM5");function c(t,e){return null!=t?t:e}function u(t){return function t(e){return Object(a.a)(e).map((function(e){if(!Object(l.i)(e))return Object(s.a)(!e,"Tree/TreeNode can only accept TreeNode as children."),null;var n=e.key,r=e.props,a=r.children,c=Object(o.a)(r,["children"]),u=Object(i.a)({key:n},c),h=t(a);return h.length&&(u.children=h),u})).filter((function(t){return t}))}(t)}function h(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=new Set(!0===e?[]:e),o=[];function a(t){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return t.map((function(u,h){var d=Object(l.h)(s?s.pos:"0",h),f=c(u.key,d),p=Object(i.a)(Object(i.a)({},u),{},{parent:s,pos:d,children:null,data:u,isStart:[].concat(Object(r.a)(s?s.isStart:[]),[0===h]),isEnd:[].concat(Object(r.a)(s?s.isEnd:[]),[h===t.length-1])});return o.push(p),!0===e||n.has(f)?p.children=a(u.children||[],p):p.children=[],p}))}return a(t),o}function d(t,e,n){var r;n?"string"==typeof n?r=function(t){return t[n]}:"function"==typeof n&&(r=function(t){return n(t)}):r=function(t,e){return c(t.key,e)},function n(i,o,a){var s=i?i.children:t,c=i?Object(l.h)(a.pos,o):"0";if(i){var u=r(i,c),h={node:i,index:o,pos:c,key:u,parentPos:a.node?a.pos:null,level:a.level+1};e(h)}s&&s.forEach((function(t,e){n(t,e,{node:i,pos:c,level:a?a.level+1:-1})}))}(null)}function f(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.initWrapper,r=e.processEntity,i=e.onProcessFinished,o=arguments.length>2?arguments[2]:void 0,a={},s={},l={posEntities:a,keyEntities:s};return n&&(l=n(l)||l),d(t,(function(t){var e=t.node,n=t.index,i=t.pos,o=t.key,u=t.parentPos,h={node:e,index:n,key:o,pos:i,level:t.level},d=c(o,i);a[i]=h,s[d]=h,h.parent=a[u],h.parent&&(h.parent.children=h.parent.children||[],h.parent.children.push(h)),r&&r(h,l)}),o),i&&i(l),l}function p(t,e){var n=e.expandedKeys,r=e.selectedKeys,i=e.loadedKeys,o=e.loadingKeys,a=e.checkedKeys,s=e.halfCheckedKeys,l=e.dragOverNodeKey,c=e.dropPosition,u=e.keyEntities[t];return{eventKey:t,expanded:-1!==n.indexOf(t),selected:-1!==r.indexOf(t),loaded:-1!==i.indexOf(t),loading:-1!==o.indexOf(t),checked:-1!==a.indexOf(t),halfChecked:-1!==s.indexOf(t),pos:String(u?u.pos:""),dragOver:l===t&&0===c,dragOverGapTop:l===t&&-1===c,dragOverGapBottom:l===t&&1===c}}function g(t){var e=t.data,n=t.expanded,r=t.selected,o=t.checked,a=t.loaded,l=t.loading,c=t.halfChecked,u=t.dragOver,h=t.dragOverGapTop,d=t.dragOverGapBottom,f=t.pos,p=t.active,g=Object(i.a)(Object(i.a)({},e),{},{expanded:n,selected:r,checked:o,loaded:a,loading:l,halfChecked:c,dragOver:u,dragOverGapTop:h,dragOverGapBottom:d,pos:f,active:p});return"props"in g||Object.defineProperty(g,"props",{get:function(){return Object(s.a)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),t}}),g}},"8EBN":
/*!**********************************************!*\
!*** ./node_modules/codemirror/mode/meta.js ***!
\**********************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){!function(t){"use strict";t.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 e=0;e<t.modeInfo.length;e++){var n=t.modeInfo[e];n.mimes&&(n.mime=n.mimes[0])}t.findModeByMIME=function(e){e=e.toLowerCase();for(var n=0;n<t.modeInfo.length;n++){var r=t.modeInfo[n];if(r.mime==e)return r;if(r.mimes)for(var i=0;i<r.mimes.length;i++)if(r.mimes[i]==e)return r}return/\+xml$/.test(e)?t.findModeByMIME("application/xml"):/\+json$/.test(e)?t.findModeByMIME("application/json"):void 0},t.findModeByExtension=function(e){e=e.toLowerCase();for(var n=0;n<t.modeInfo.length;n++){var r=t.modeInfo[n];if(r.ext)for(var i=0;i<r.ext.length;i++)if(r.ext[i]==e)return r}},t.findModeByFileName=function(e){for(var n=0;n<t.modeInfo.length;n++){var r=t.modeInfo[n];if(r.file&&r.file.test(e))return r}var i=e.lastIndexOf("."),o=i>-1&&e.substring(i+1,e.length);if(o)return t.findModeByExtension(o)},t.findModeByName=function(e){e=e.toLowerCase();for(var n=0;n<t.modeInfo.length;n++){var r=t.modeInfo[n];if(r.name.toLowerCase()==e)return r;if(r.alias)for(var i=0;i<r.alias.length;i++)if(r.alias[i].toLowerCase()==e)return r}}}(n(/*! ../lib/codemirror */"VrN/"))},"8hTe":
/*!******************************************************!*\
!*** ./src/components/RenderHtml/index.less?modules ***!
\******************************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){t.exports={button:"button___1wy9m"}},"9Bee":
/*!*********************************************************!*\
!*** ./src/components/RenderHtml/index.tsx + 3 modules ***!
\*********************************************************/
/*! exports provided: default */
/*! exports used: default */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/regenerator/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./src/components/RenderHtml/index.less?modules (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./src/components/PreviewAll/index.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/env.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/fetch.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/button/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/button/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/space/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/space/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/hls.js/dist/hls.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/katex/dist/katex.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/marked/lib/marked.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/marked/src/helpers.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */function(t,e,n){"use strict";n("DYRE");var r=n("zeV3"),i=(n("+L6B"),n("2/Rp")),o=n("k1fw"),a=n("9og8"),s=n("tJVT"),l=n("WmNS"),c=n.n(l),u=n("q1tI"),h=n.n(u),d=(n("vg9a"),n("DlQD")),f=n.n(d),p=n("rUJ1");var g=[],m=["<ul>"],v=new f.a.Renderer,y=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function b(){g.length=0,m=["<ul>"]}var x={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function C(){return function t(e,n,r,i){if(n>=e.length||e[n].level<=r)return n;var o=e[n];i.push("<li><a href='#"+o.anchor+"'>"+o.text+"</a>");var a=[];return n=t(e,++n,o.level,a),a.length>0&&(i.push("<ul>"),a.forEach((function(t){i.push(t)})),i.push("</ul>")),i.push("</li>"),n=t(e,n,r,i)}(g,0,0,m),m.push("</ul>"),m.join("")}var S={heading:function(t){var e=y.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[1].length,text:e[2]}},fences:function(t){var e=this.rules.block.fences.exec(t);if(e){var n=e[0],r=function(t,e){var n=t.match(/^(\s+)(?:```)/);if(null===n)return e;var r=n[1];return e.split("\n").map((function(t){var e=t.match(/^\s+/);return null===e?t:Object(s.a)(e,1)[0].length>=r.length?t.slice(r.length):t})).join("\n")}(n,e[3]||""),i=e[2]?e[2].trim():e[2];if(["latex","katex","math"].indexOf(i)>=0){var o=w(),a=r;r=o,T[o]={type:"block",expression:a}}return{type:"code",raw:n,lang:i,text:r}}}},E=/(?:\${2})([^\n`]+?)(?:\${2})/gi,k=0,w=function(){return"__special_katext_id_".concat(k++,"__")},T={};function O(){k=0,T={}}function L(t){return t=t.replace(E,(function(t,e){var n=w();return T[n]={type:"inline",expression:e},n}))}var A=v.listitem;v.listitem=function(t){return A(L(t))};var D=v.paragraph;v.paragraph=function(t){return D(L(t))};var R=v.tablecell;v.tablecell=function(t,e){return R(L(t),e)},v.code=function(t,e,n){var r=(e||"").match(/\S*/)[0];return r?["latex","katex","math"].indexOf(r)>=0?"<p class='editormd-tex'>".concat(t,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(e,'">').concat(n?t:Object(p.escape)(t,!0),"</code></pre>\n"):'<pre class="prettyprint linenums"><code>'+(n?t:Object(p.escape)(t,!0))+"</code></pre>"},v.heading=function(t,e,n){var r=this.options.headerPrefix+n.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return g.push({anchor:r,level:e,text:t}),"<h"+e+' id="'+r+'">'+t+"</h"+e+">"},f.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),f.a.use({tokenizer:S,renderer:v});var M=f.a,I=(n("SJMd"),n("ulZh")),_=n.n(I),P=n("m3rI"),N=n("Oy/b"),j=n("p5ED"),F=n("ErOA"),B=function(t,e){return(B=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function U(t,e){function n(){this.constructor=t}B(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function H(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{l(r.next(t))}catch(t){o(t)}}function s(t){try{l(r.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}l((r=r.apply(t,e||[])).next())}))}function z(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function G(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}var V=function(){function t(){}return t.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},t.setAttributes=function(t,e){for(var n=0,r=e;n<r.length;n++){var i=r[n],o=i[0],a=i[1];t.setAttribute(o,a)}},t.createRect=function(e,n,r){var i=document.createElementNS("http://www.w3.org/2000/svg","rect");return i.setAttribute("width",e.toString()),i.setAttribute("height",n.toString()),r&&t.setAttributes(i,r),i},t.createLine=function(e,n,r,i,o){var a=document.createElementNS("http://www.w3.org/2000/svg","line");return a.setAttribute("x1",e.toString()),a.setAttribute("y1",n.toString()),a.setAttribute("x2",r.toString()),a.setAttribute("y2",i.toString()),o&&t.setAttributes(a,o),a},t.createPolygon=function(e,n){var r=document.createElementNS("http://www.w3.org/2000/svg","polygon");return r.setAttribute("points",e),n&&t.setAttributes(r,n),r},t.createCircle=function(e,n){var r=document.createElementNS("http://www.w3.org/2000/svg","circle");return r.setAttribute("cx",(e/2).toString()),r.setAttribute("cy",(e/2).toString()),r.setAttribute("r",e.toString()),n&&t.setAttributes(r,n),r},t.createEllipse=function(e,n,r){var i=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return i.setAttribute("cx",(e/2).toString()),i.setAttribute("cy",(n/2).toString()),i.setAttribute("rx",(e/2).toString()),i.setAttribute("ry",(n/2).toString()),r&&t.setAttributes(i,r),i},t.createGroup=function(e){var n=document.createElementNS("http://www.w3.org/2000/svg","g");return e&&t.setAttributes(n,e),n},t.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},t.createMarker=function(e,n,r,i,o,a,s){var l=document.createElementNS("http://www.w3.org/2000/svg","marker");return t.setAttributes(l,[["id",e],["orient",n],["markerWidth",r.toString()],["markerHeight",i.toString()],["refX",o.toString()],["refY",a.toString()]]),l.appendChild(s),l},t.createText=function(e){var n=document.createElementNS("http://www.w3.org/2000/svg","text");return n.setAttribute("x","0"),n.setAttribute("y","0"),e&&t.setAttributes(n,e),n},t.createTSpan=function(e,n){var r=document.createElementNS("http://www.w3.org/2000/svg","tspan");return r.textContent=e,n&&t.setAttributes(r,n),r},t.createImage=function(e){var n=document.createElementNS("http://www.w3.org/2000/svg","image");return e&&t.setAttributes(n,e),n},t.createPoint=function(t,e){var n=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return n.x=t,n.y=e,n},t.createPath=function(e,n){var r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d",e),n&&t.setAttributes(r,n),r},t}(),W=function(){function t(){}return t.addKey=function(e){t.key=e},Object.defineProperty(t,"isLicensed",{get:function(){return!!t.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(t.key)},enumerable:!1,configurable:!0}),t}(),K=function(){function t(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return t.prototype.rasterize=function(t,e,n){var r=this;return new Promise((function(i){var o=void 0!==n?n:document.createElement("canvas");null===t&&(r.markersOnly=!0,r.naturalSize=!1);var a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("xmlns","http://www.w3.org/2000/svg"),a.setAttribute("width",e.width.baseVal.valueAsString),a.setAttribute("height",e.height.baseVal.valueAsString),a.setAttribute("viewBox","0 0 "+e.viewBox.baseVal.width.toString()+" "+e.viewBox.baseVal.height.toString()),a.innerHTML=e.innerHTML,!0===r.naturalSize?(a.width.baseVal.value=t.naturalWidth,a.height.baseVal.value=t.naturalHeight):void 0!==r.width&&void 0!==r.height&&(a.width.baseVal.value=r.width,a.height.baseVal.value=r.height),o.width=a.width.baseVal.value,o.height=a.height.baseVal.value;var s=a.outerHTML,l=o.getContext("2d");!0!==r.markersOnly&&l.drawImage(t,0,0,o.width,o.height);var c=window.URL,u=new Image(o.width,o.height);u.setAttribute("crossOrigin","anonymous");var h=new Blob([s],{type:"image/svg+xml"}),d=c.createObjectURL(h);u.onload=function(){l.drawImage(u,0,0),c.revokeObjectURL(d);var t=o.toDataURL(r.imageType,r.imageQuality);i(t)},u.src=d}))},t}(),q=function(){},Y=function(){function t(t){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+t+"_"}return Object.defineProperty(t.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(t.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(t.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),t.prototype.addClass=function(t){return void 0===this.styleSheet&&this.addStyleSheet(),t.name=""+this.classNamePrefix+t.localName,this.classes.push(t),this.styleSheet.sheet.insertRule("."+t.name+" {"+t.style+"}",this.styleSheet.sheet.cssRules.length),t},t.prototype.addRule=function(t){void 0===this.styleSheet&&this.addStyleSheet(),this.rules.push(t),this.styleSheet.sheet.insertRule(t.selector+" {"+t.style+"}",this.styleSheet.sheet.cssRules.length)},t.prototype.addStyleSheet=function(){var t;this.styleSheet=document.createElement("style"),(null!==(t=this.styleSheetRoot)&&void 0!==t?t:document.head).appendChild(this.styleSheet),this.addRule(new X("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new X("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames","\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n ")),this.addRule(new X("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames","\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n ")),this.addClass(new $("fade_in","\n animation-duration: 0.3s;\n animation-name: "+this.classNamePrefix+"_fade_in_animation_frames;\n ")),this.addClass(new $("fade_out","\n animation-duration: 0.3s;\n animation-name: "+this.classNamePrefix+"_fade_out_animation_frames;\n "))},t.prototype.removeStyleSheet=function(){var t;this.styleSheet&&((null!==(t=this.styleSheetRoot)&&void 0!==t?t:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},t}(),X=function(t,e){this.selector=t,this.style=e},$=function(t,e){this.localName=t,this.style=e},Z=function(){function t(t,e,n,r,i){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=t,this.displayMode=e,this.markerItems=n,this.uiStyleSettings=r,this.styles=i,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return t.prototype.show=function(t){var e=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=t,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var n=document.createElement("div");n.className=this.toolbarBlockStyleClass.name,n.style.whiteSpace="nowrap",this.uiContainer.appendChild(n),this.addActionButton(n,'<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(n,'<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(n,'<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(n,'<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(n,'<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(n,'<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(n,'<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(n,'<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(t){var n=document.createElement("div");n.className=""+e.toolbarButtonStyleClass.name,n.setAttribute("data-type-name",t.typeName),n.innerHTML=t.icon,n.addEventListener("click",(function(){e.markerToolbarButtonClicked(n,t)})),e.buttons.push(n),e.markerButtons.push(n)})),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 r=document.createElement("div");r.className=this.toolbarBlockStyleClass.name,r.style.whiteSpace="nowrap",r.style.display=!1!==this.uiStyleSettings.resultButtonBlockVisible?"":"none",this.uiContainer.appendChild(r),this.addActionButton(r,'<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(r,'<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()},t.prototype.addButtonClickListener=function(t){this.buttonClickListeners.push(t)},t.prototype.removeButtonClickListener=function(t){this.buttonClickListeners.indexOf(t)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(t),1)},t.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},t.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var t=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var e=0;e<this.markerButtons.length;e++)e<t||e===t&&this.markerButtons.length-1===t?this.markerButtonBlock.appendChild(this.markerButtons[e]):(e===t&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[e]))}},t.prototype.overflowButtonClicked=function(){"none"!==this.markerButtonOverflowBlock.style.display?(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")},t.prototype.resetButtonStyles=function(){var t=this;this.buttons.forEach((function(e){e.className=e.className.replace(t.uiStyleSettings.toolbarButtonStyleColorsClassName?t.uiStyleSettings.toolbarButtonStyleColorsClassName:t.toolbarButtonStyleColorsClass.name,"").trim(),e.className=e.className.replace(t.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?t.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:t.toolbarActiveButtonStyleColorsClass.name,"").trim(),e.className+=" "+(t.uiStyleSettings.toolbarButtonStyleColorsClassName?t.uiStyleSettings.toolbarButtonStyleColorsClassName:t.toolbarButtonStyleColorsClass.name)}))},t.prototype.addActionButton=function(t,e,n){var r=this,i=document.createElement("div");switch(i.className=""+this.toolbarButtonStyleClass.name,i.innerHTML=e,i.setAttribute("data-action",n),i.addEventListener("click",(function(){r.actionToolbarButtonClicked(i,n)})),n){case"select":i.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":i.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":i.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":i.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":i.style.fill=this.uiStyleSettings.closeButtonColor}t.appendChild(i),this.buttons.push(i)},t.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new $("toolbar","\n width: 100%;\n flex-shrink: 0;\n display: flex;\n flex-direction: row;\n justify-content: space-between; \n height: "+this.uiStyleSettings.toolbarHeight+"px;\n box-sizing: content-box;\n "+("inline"===this.displayMode?"border-top-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+"\n "+("inline"===this.displayMode?"border-top-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+"\n overflow: hidden;\n ")),this.toolbarStyleColorsClass=this.styles.addClass(new $("toolbar_colors","\n background-color: "+this.uiStyleSettings.toolbarBackgroundColor+";\n box-shadow: 0px 3px rgba(33, 33, 33, 0.1);\n ")),this.toolbarBlockStyleClass=this.styles.addClass(new $("toolbar-block","\n display: inline-block;\n box-sizing: content-box;\n ")),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new $("toolbar-overflow-block","\n position: absolute;\n top: "+this.uiStyleSettings.toolbarHeight+"px;\n max-width: "+2*this.uiStyleSettings.toolbarHeight+"px;\n z-index: 10;\n box-sizing: content-box;\n ")),this.toolbarOverflowBlockStyleColorsClass=this.styles.addClass(new $("toolbar-overflow-block_colors","\n background-color: "+this.uiStyleSettings.toolbarBackgroundColor+";\n "));var t=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new $("toolbar_button","\n display: inline-block;\n width: "+(this.uiStyleSettings.toolbarHeight-2*t)+"px;\n height: "+(this.uiStyleSettings.toolbarHeight-2*t)+"px;\n padding: "+t+"px;\n box-sizing: content-box;\n ")),this.toolbarButtonStyleColorsClass=this.styles.addClass(new $("toolbar_button_colors","\n fill: "+this.uiStyleSettings.toolbarColor+";\n ")),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new $("toolbar_active_button","\n fill: "+this.uiStyleSettings.toolbarColor+";\n background-color: "+this.uiStyleSettings.toolbarBackgroundHoverColor+"\n ")),this.styles.addRule(new X("."+this.toolbarButtonStyleClass.name+" svg","\n height: "+this.uiStyleSettings.toolbarHeight/2+"px;\n ")),this.styles.addRule(new X("."+this.toolbarButtonStyleColorsClass.name+":hover","\n background-color: "+this.uiStyleSettings.toolbarBackgroundHoverColor+"\n "))},t.prototype.markerToolbarButtonClicked=function(t,e){this.setActiveButton(t),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach((function(t){return t("marker",e)})),this.markerButtonOverflowBlock.style.display="none"},t.prototype.actionToolbarButtonClicked=function(t,e){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach((function(t){return t("action",e)})),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},t.prototype.setActiveButton=function(t){this.resetButtonStyles(),t.className=t.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),t.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},t.prototype.setActiveMarkerButton=function(t){var e=this.markerButtons.find((function(e){return e.getAttribute("data-type-name")===t}));e&&this.setActiveButton(e)},t.prototype.setCurrentMarker=function(t){var e=this;this.currentMarker=t,this.buttons.filter((function(t){return/delete|notes/.test(t.getAttribute("data-action"))})).forEach((function(t){void 0===e.currentMarker?(t.style.fillOpacity="0.4",t.style.pointerEvents="none"):(t.style.fillOpacity="1",t.style.pointerEvents="all")}))},t}(),J=function(){function t(t,e,n,r){this.panels=[],this.panelButtons=[],this.markerjsContainer=t,this.displayMode=e,this.uiStyleSettings=n,this.styles=r,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return t.prototype.addStyles=function(){var t;this.toolboxStyleClass=this.styles.addClass(new $("toolbox","\n width: 100%;\n flex-shrink: 0;\n display: flex;\n flex-direction: column;\n font-family: sans-serif;\n "+("popup"===this.displayMode?"height:"+2.5*this.uiStyleSettings.toolbarHeight+"px;":"")+"\n box-sizing: content-box;\n "+("popup"===this.displayMode?"background-color: "+this.uiStyleSettings.canvasBackgroundColor+";":"")+"\n "+("inline"===this.displayMode?"border-bottom-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+"\n "+("inline"===this.displayMode?"border-bottom-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+"\n overflow: hidden;\n ")),this.toolboxStyleColorsClass=this.styles.addClass(new $("toolbox_colors","\n color: "+this.uiStyleSettings.toolboxColor+";\n "));var e=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new $("toolbox-button-row","\n display: flex;\n cursor: default;\n box-sizing: content-box;\n ")),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new $("toolbox-button-row_colors","\n background-color: "+this.uiStyleSettings.toolbarBackgroundColor+";\n ")),this.toolboxPanelRowStyleClass=this.styles.addClass(new $("toolbox-panel-row","\n display: flex;\n "+("inline"===this.displayMode?"position: absolute;":"")+"\n "+("inline"===this.displayMode?"bottom: "+this.uiStyleSettings.toolbarHeight+"px;":"")+"\n cursor: default;\n height: "+1.5*this.uiStyleSettings.toolbarHeight+"px;\n "+("inline"===this.displayMode?"width: 100%;":"")+"\n box-sizing: content-box;\n ")),this.toolboxPanelRowStyleColorsClass=this.styles.addClass(new $("toolbox-panel-row_colors","\n background-color: "+(null!==(t=this.uiStyleSettings.toolboxBackgroundColor)&&void 0!==t?t:this.uiStyleSettings.toolbarBackgroundHoverColor)+";\n ")),this.toolboxButtonStyleClass=this.styles.addClass(new $("toolbox_button","\n display: inline-block;\n width: "+(this.uiStyleSettings.toolbarHeight-2*e)+"px;\n height: "+(this.uiStyleSettings.toolbarHeight-2*e)+"px;\n padding: "+e+"px;\n box-sizing: content-box;\n ")),this.toolboxButtonStyleColorsClass=this.styles.addClass(new $("toolbox-button_colors","\n fill: "+this.uiStyleSettings.toolbarColor+";\n ")),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new $("toolbox-active-button_colors","\n background-color: "+this.uiStyleSettings.toolbarBackgroundHoverColor+";\n fill: "+this.uiStyleSettings.toolbarColor+";\n ")),this.styles.addRule(new X("."+this.toolboxButtonStyleColorsClass.name+":hover","\n background-color: "+this.uiStyleSettings.toolbarBackgroundHoverColor+"\n ")),this.styles.addRule(new X("."+this.toolboxButtonStyleClass.name+" svg","\n height: "+this.uiStyleSettings.toolbarHeight/2+"px;\n "))},t.prototype.show=function(t){var e;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=t,this.uiContainer.className=this.toolboxStyleClass.name+" "+(null!==(e=this.uiStyleSettings.toolboxStyleColorsClassName)&&void 0!==e?e:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},t.prototype.setPanelButtons=function(t){var e,n,r=this;this.panels=t,void 0!==this.uiContainer&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+(null!==(e=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)&&void 0!==e?e:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+(null!==(n=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)&&void 0!==n?n:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach((function(t){var e;t.uiStyleSettings=r.uiStyleSettings;var n=document.createElement("div");n.className=r.toolboxButtonStyleClass.name+" "+(null!==(e=r.uiStyleSettings.toolboxButtonStyleColorsClassName)&&void 0!==e?e:r.toolboxButtonStyleColorsClass.name),n.innerHTML=t.icon,n.title=t.title,n.addEventListener("click",(function(){r.panelButtonClick(t)})),r.panelButtons.push(n),r.buttonRow.appendChild(n)})),"inline"===this.displayMode?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},t.prototype.panelButtonClick=function(t){var e=this,n=-1;if(t!==this.activePanel){n=this.panels.indexOf(t),this.panelRow.innerHTML="";var r=t.getUi();r.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(r),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=t}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout((function(){"inline"===e.displayMode?e.panelRow.style.display="none":e.panelRow.style.visibility="hidden"}),200);this.panelButtons.forEach((function(t,r){var i,o;t.className=e.toolboxButtonStyleClass.name+" "+(r===n?""+(null!==(i=e.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)&&void 0!==i?i:e.toolboxActiveButtonStyleColorsClass.name):""+(null!==(o=e.uiStyleSettings.toolboxButtonStyleColorsClassName)&&void 0!==o?o:e.toolboxButtonStyleColorsClass.name))}))},t}(),Q=function(t,e){this.title=t,this.icon=e},tt=function(t){function e(e,n,r,i){var o=t.call(this,e,i||'<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 o.colors=[],o.addTransparent=!1,o.colorBoxes=[],o.colors=n,o.currentColor=r,o.setCurrentColor=o.setCurrentColor.bind(o),o.getColorBox=o.getColorBox.bind(o),o}return U(e,t),e.prototype.getUi=function(){var t=this,e=document.createElement("div");return e.style.overflow="hidden",e.style.whiteSpace="nowrap",this.colors.forEach((function(n){var r=t.getColorBox(n);e.appendChild(r),t.colorBoxes.push(r)})),e},e.prototype.getColorBox=function(t){var e=this,n=this.uiStyleSettings.toolbarHeight/4,r=this.uiStyleSettings.toolbarHeight-n,i=document.createElement("div");i.style.display="inline-block",i.style.boxSizing="content-box",i.style.width=r-2+"px",i.style.height=r-2+"px",i.style.padding="1px",i.style.marginRight="2px",i.style.marginBottom="2px",i.style.borderWidth="2px",i.style.borderStyle="solid",i.style.borderRadius=(r+2)/2+"px",i.style.borderColor=t===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",i.addEventListener("click",(function(){e.setCurrentColor(t,i)}));var o=document.createElement("div");return o.style.display="inline-block",o.style.width=r-2+"px",o.style.height=r-2+"px",o.style.backgroundColor=t,o.style.borderRadius=r/2+"px","transparent"===t&&(o.style.fill=this.uiStyleSettings.toolboxAccentColor,o.innerHTML='<svg viewBox="0 0 24 24">\n <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" />\n </svg>'),i.appendChild(o),i},e.prototype.setCurrentColor=function(t,e){var n=this;this.currentColor=t,this.colorBoxes.forEach((function(t){t.style.borderColor=t===e?n.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onColorChanged&&this.onColorChanged(t)},e}(Q),et=function(){function t(t,e,n){this._state="new",this._isSelected=!1,this._container=t,this._overlayContainer=e,this.globalSettings=n,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(t.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),t.prototype.ownsTarget=function(t){return!1},Object.defineProperty(t.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),t.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},t.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},t.prototype.pointerDown=function(t,e){},t.prototype.dblClick=function(t,e){},t.prototype.manipulate=function(t){},t.prototype.pointerUp=function(t){this.stateChanged()},t.prototype.dispose=function(){},t.prototype.addMarkerVisualToContainer=function(t){this.container.childNodes.length>0?this.container.insertBefore(t,this.container.childNodes[0]):this.container.appendChild(t)},t.prototype.getState=function(){return{typeName:t.typeName,state:this.state,notes:this.notes}},t.prototype.restoreState=function(t){this._state=t.state,this.notes=t.notes},t.prototype.scale=function(t,e){},t.prototype.colorChanged=function(t){this.onColorChanged&&this.onColorChanged(t),this.stateChanged()},t.prototype.fillColorChanged=function(t){this.onFillColorChanged&&this.onFillColorChanged(t),this.stateChanged()},t.prototype.stateChanged=function(){if(this.onStateChanged&&"creating"!==this.state&&"new"!==this.state){var t=this.getState();void 0!==this.manipulationStartState&&(this.manipulationStartState.state="select"),t.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(t)&&this.onStateChanged(this)}},t.typeName="MarkerBase",t}(),nt=function(){function t(){this.findGripByVisual=this.findGripByVisual.bind(this)}return t.prototype.findGripByVisual=function(t){return this.topLeft.ownsTarget(t)?this.topLeft:this.topCenter.ownsTarget(t)?this.topCenter:this.topRight.ownsTarget(t)?this.topRight:this.centerLeft.ownsTarget(t)?this.centerLeft:this.centerRight.ownsTarget(t)?this.centerRight:this.bottomLeft.ownsTarget(t)?this.bottomLeft:this.bottomCenter.ownsTarget(t)?this.bottomCenter:this.bottomRight.ownsTarget(t)?this.bottomRight:void 0},t}(),rt=function(){function t(){this.GRIP_SIZE=10,this.visual=V.createGroup(),this.visual.appendChild(V.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(V.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return t.prototype.ownsTarget=function(t){return t===this.visual||t===this.visual.childNodes[0]||t===this.visual.childNodes[1]},t}(),it=function(){function t(){}return t.toITransformMatrix=function(t){return{a:t.a,b:t.b,c:t.c,d:t.d,e:t.e,f:t.f}},t.toSVGMatrix=function(t,e){return t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f,t},t}(),ot=function(t){function e(e,n,r){var i=t.call(this,e,n,r)||this;return i.left=0,i.top=0,i.width=0,i.height=0,i.defaultSize={x:50,y:20},i.offsetX=0,i.offsetY=0,i.rotationAngle=0,i.CB_DISTANCE=10,i._suppressMarkerCreateEvent=!1,i.container.transform.baseVal.appendItem(V.createTransform()),i.setupControlBox(),i}return U(e,t),Object.defineProperty(e.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"visual",{get:function(){return this._visual},set:function(t){this._visual=t;var e=V.createTransform();this._visual.transform.baseVal.appendItem(e)},enumerable:!1,configurable:!0}),e.prototype.ownsTarget=function(e){return!!t.prototype.ownsTarget.call(this,e)||!!(void 0!==this.controlGrips.findGripByVisual(e)||void 0!==this.rotatorGrip&&this.rotatorGrip.ownsTarget(e))},e.prototype.pointerDown=function(e,n){t.prototype.pointerDown.call(this,e,n),"new"===this.state&&(this.left=e.x,this.top=e.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var r=this.unrotatePoint(e);if(this.manipulationStartX=r.x,this.manipulationStartY=r.y,this.offsetX=r.x-this.left,this.offsetY=r.y-this.top,"new"!==this.state)if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(n),void 0!==this.activeGrip)this._state="resize";else if(void 0!==this.rotatorGrip&&this.rotatorGrip.ownsTarget(n)){this.activeGrip=this.rotatorGrip;var i=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=i.x-this.width/2,this.top=i.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var o=this.container.transform.baseVal.getItem(0);o.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(o,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},e.prototype.pointerUp=function(e){var n=this.state;t.prototype.pointerUp.call(this,e),"creating"===this.state&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(e),this._state="select","creating"===n&&this.onMarkerCreated&&!1===this._suppressMarkerCreateEvent&&this.onMarkerCreated(this)},e.prototype.moveVisual=function(t){this.visual.style.transform="translate("+t.x+"px, "+t.y+"px)"},e.prototype.manipulate=function(t){var e=this.unrotatePoint(t);"creating"===this.state?this.resize(t):"move"===this.state?(this.left=this.manipulationStartLeft+(e.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(e.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):"resize"===this.state?this.resize(e):"rotate"===this.state&&this.rotate(t)},e.prototype.resize=function(t){var e=this.manipulationStartLeft,n=this.manipulationStartWidth,r=this.manipulationStartTop,i=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:e=this.manipulationStartLeft+t.x-this.manipulationStartX,n=this.manipulationStartWidth+this.manipulationStartLeft-e;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:n=this.manipulationStartWidth+t.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:r=this.manipulationStartTop+t.y-this.manipulationStartY,i=this.manipulationStartHeight+this.manipulationStartTop-r;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:i=this.manipulationStartHeight+t.y-this.manipulationStartY}n>=0?(this.left=e,this.width=n):(this.left=e+n,this.width=-n),i>=0?(this.top=r,this.height=i):(this.top=r+i,this.height=-i),this.setSize()},e.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},e.prototype.rotate=function(t){if(Math.abs(t.x-this.centerX)>.1){var e=Math.sign(t.x-this.centerX);this.rotationAngle=180*Math.atan((t.y-this.centerY)/(t.x-this.centerX))/Math.PI+90*e,this.applyRotation()}},e.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)},e.prototype.rotatePoint=function(t){if(0===this.rotationAngle)return t;var e=this.container.getCTM(),n=V.createPoint(t.x,t.y);return{x:(n=n.matrixTransform(e)).x,y:n.y}},e.prototype.unrotatePoint=function(t){if(0===this.rotationAngle)return t;var e=this.container.getCTM();e=e.inverse();var n=V.createPoint(t.x,t.y);return{x:(n=n.matrixTransform(e)).x,y:n.y}},e.prototype.select=function(){t.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},e.prototype.deselect=function(){t.prototype.deselect.call(this),this.controlBox.style.display="none"},e.prototype.setupControlBox=function(){this.controlBox=V.createGroup();var t=V.createTransform();t.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(t),this.container.appendChild(this.controlBox),this.controlRect=V.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),!0!==this.globalSettings.disableRotation&&(this.rotatorGripLine=V.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new nt,this.addControlGrips(),this.controlBox.style.display="none"},e.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()),void 0!==this.rotatorGripLine&&(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()},e.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(),!0!==this.globalSettings.disableRotation&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},e.prototype.createGrip=function(){var t=new rt;return t.visual.transform.baseVal.appendItem(V.createTransform()),this.controlBox.appendChild(t.visual),t},e.prototype.positionGrips=function(){var t=this.controlGrips.topLeft.GRIP_SIZE,e=-t/2,n=e,r=(this.width+this.CB_DISTANCE)/2-t/2,i=(this.height+this.CB_DISTANCE)/2-t/2,o=this.height+this.CB_DISTANCE-t/2,a=this.width+this.CB_DISTANCE-t/2;this.positionGrip(this.controlGrips.topLeft.visual,e,n),this.positionGrip(this.controlGrips.topCenter.visual,r,n),this.positionGrip(this.controlGrips.topRight.visual,a,n),this.positionGrip(this.controlGrips.centerLeft.visual,e,i),this.positionGrip(this.controlGrips.centerRight.visual,a,i),this.positionGrip(this.controlGrips.bottomLeft.visual,e,o),this.positionGrip(this.controlGrips.bottomCenter.visual,r,o),this.positionGrip(this.controlGrips.bottomRight.visual,a,o),void 0!==this.rotatorGrip&&this.positionGrip(this.rotatorGrip.visual,r,n-3*this.CB_DISTANCE)},e.prototype.positionGrip=function(t,e,n){var r=t.transform.baseVal.getItem(0);r.setTranslate(e,n),t.transform.baseVal.replaceItem(r,0)},e.prototype.hideControlBox=function(){this.controlBox.style.display="none"},e.prototype.showControlBox=function(){this.controlBox.style.display=""},e.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:it.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:it.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},t.prototype.getState.call(this))},e.prototype.restoreState=function(e){t.prototype.restoreState.call(this,e);var n=e;this.left=n.left,this.top=n.top,this.width=n.width,this.height=n.height,this.rotationAngle=n.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(it.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,n.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(it.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,n.containerTransformMatrix))},e.prototype.scale=function(e,n){t.prototype.scale.call(this,e,n);var r=this.rotatePoint({x:this.left,y:this.top}),i=this.unrotatePoint({x:r.x*e,y:r.y*n});this.left=i.x,this.top=i.y,this.width=this.width*e,this.height=this.height*n,this.adjustControlBox()},e}(et),at=function(t){function e(e,n,r){var i=t.call(this,e,n,r)||this;return i.fillColor="transparent",i.strokeColor="transparent",i.strokeWidth=0,i.strokeDasharray="",i.opacity=1,i.setStrokeColor=i.setStrokeColor.bind(i),i.setFillColor=i.setFillColor.bind(i),i.setStrokeWidth=i.setStrokeWidth.bind(i),i.setStrokeDasharray=i.setStrokeDasharray.bind(i),i.createVisual=i.createVisual.bind(i),i}return U(e,t),e.prototype.ownsTarget=function(e){return!(!t.prototype.ownsTarget.call(this,e)&&e!==this.visual)},e.prototype.createVisual=function(){this.visual=V.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)},e.prototype.pointerDown=function(e,n){t.prototype.pointerDown.call(this,e,n),"new"===this.state&&(this.createVisual(),this.moveVisual(e),this._state="creating")},e.prototype.manipulate=function(e){t.prototype.manipulate.call(this,e)},e.prototype.resize=function(e){t.prototype.resize.call(this,e),this.setSize()},e.prototype.setSize=function(){t.prototype.setSize.call(this),V.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},e.prototype.pointerUp=function(e){t.prototype.pointerUp.call(this,e),this.setSize()},e.prototype.setStrokeColor=function(t){this.strokeColor=t,this.visual&&V.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(t),this.stateChanged()},e.prototype.setFillColor=function(t){this.fillColor=t,this.visual&&V.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},e.prototype.setStrokeWidth=function(t){this.strokeWidth=t,this.visual&&V.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},e.prototype.setStrokeDasharray=function(t){this.strokeDasharray=t,this.visual&&V.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},e.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},t.prototype.getState.call(this))},e.prototype.restoreState=function(e){var n=e;this.fillColor=n.fillColor,this.strokeColor=n.strokeColor,this.strokeWidth=n.strokeWidth,this.strokeDasharray=n.strokeDasharray,this.opacity=n.opacity,this.createVisual(),t.prototype.restoreState.call(this,e),this.setSize()},e.prototype.scale=function(e,n){t.prototype.scale.call(this,e,n),this.setSize()},e.title="Rectangle marker",e}(ot),st=function(t){function e(e,n,r,i){var o=t.call(this,e,i||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return o.widths=[],o.widthBoxes=[],o.widths=n,o.currentWidth=r,o.setCurrentWidth=o.setCurrentWidth.bind(o),o}return U(e,t),e.prototype.getUi=function(){var t=this,e=document.createElement("div");return e.style.display="flex",e.style.overflow="hidden",e.style.flexGrow="2",this.widths.forEach((function(n){var r=document.createElement("div");r.style.display="flex",r.style.flexGrow="2",r.style.alignItems="center",r.style.justifyContent="space-between",r.style.padding="5px",r.style.borderWidth="2px",r.style.borderStyle="solid",r.style.borderColor=n===t.currentWidth?t.uiStyleSettings.toolboxAccentColor:"transparent",r.addEventListener("click",(function(){t.setCurrentWidth(n,r)})),e.appendChild(r);var i=document.createElement("div");i.innerText=n.toString(),i.style.marginRight="5px",r.appendChild(i);var o=document.createElement("div");o.style.minHeight="20px",o.style.flexGrow="2",o.style.display="flex",o.style.alignItems="center";var a=document.createElement("hr");a.style.minWidth="20px",a.style.border="0px",a.style.borderTop=n+"px solid "+t.uiStyleSettings.toolboxColor,a.style.flexGrow="2",o.appendChild(a),r.appendChild(o),t.widthBoxes.push(r)})),e},e.prototype.setCurrentWidth=function(t,e){var n=this;this.currentWidth=t,this.widthBoxes.forEach((function(t){t.style.borderColor=t===e?n.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},e}(Q),lt=function(t){function e(e,n,r,i){var o=t.call(this,e,i||'<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 o.styles=[],o.styleBoxes=[],o.styles=n,o.currentStyle=r,o.setCurrentStyle=o.setCurrentStyle.bind(o),o}return U(e,t),e.prototype.getUi=function(){var t=this,e=document.createElement("div");return e.style.display="flex",e.style.overflow="hidden",e.style.flexGrow="2",this.styles.forEach((function(n){var r=document.createElement("div");r.style.display="flex",r.style.alignItems="center",r.style.justifyContent="space-between",r.style.padding="5px",r.style.borderWidth="2px",r.style.borderStyle="solid",r.style.overflow="hidden",r.style.maxWidth=100/t.styles.length-5+"%",r.style.borderColor=n===t.currentStyle?t.uiStyleSettings.toolboxAccentColor:"transparent",r.addEventListener("click",(function(){t.setCurrentStyle(n,r)})),e.appendChild(r);var i=document.createElement("div");i.style.minHeight="20px",i.style.flexGrow="2",i.style.overflow="hidden";var o='<svg width="100" height="20">\n <line x1="0" y1="10" x2="100" y2="10" stroke="'+t.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(""!==n?'stroke-dasharray="'+n+'"':"")+" />\n </svg>";i.innerHTML=o,r.appendChild(i),t.styleBoxes.push(r)})),e},e.prototype.setCurrentStyle=function(t,e){var n=this;this.currentStyle=t,this.styleBoxes.forEach((function(t){t.style.borderColor=t===e?n.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},e}(Q),ct=function(t){function e(e,n,r){var i=t.call(this,e,n,r)||this;return i.strokeColor=r.defaultColor,i.strokeWidth=r.defaultStrokeWidth,i.strokeDasharray=r.defaultStrokeDasharray,i.strokePanel=new tt("Line color",r.defaultColorSet,r.defaultColor),i.strokePanel.onColorChanged=i.setStrokeColor,i.strokeWidthPanel=new st("Line width",r.defaultStrokeWidths,r.defaultStrokeWidth),i.strokeWidthPanel.onWidthChanged=i.setStrokeWidth,i.strokeStylePanel=new lt("Line style",r.defaultStrokeDasharrays,r.defaultStrokeDasharray),i.strokeStylePanel.onStyleChanged=i.setStrokeDasharray,i}return U(e,t),Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var n=t.prototype.getState.call(this);return n.typeName=e.typeName,n},e.typeName="FrameMarker",e.title="Frame marker",e.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',e}(at),ut=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},ht=function(t){function e(e,n,r){var i=t.call(this,e,n,r)||this;return i.x1=0,i.y1=0,i.x2=0,i.y2=0,i.defaultLength=50,i.manipulationStartX=0,i.manipulationStartY=0,i.manipulationStartX1=0,i.manipulationStartY1=0,i.manipulationStartX2=0,i.manipulationStartY2=0,i.setupControlBox(),i}return U(e,t),e.prototype.ownsTarget=function(e){return!!t.prototype.ownsTarget.call(this,e)||!(!this.grip1.ownsTarget(e)&&!this.grip2.ownsTarget(e))},e.prototype.pointerDown=function(e,n){t.prototype.pointerDown.call(this,e,n),this.manipulationStartX=e.x,this.manipulationStartY=e.y,"new"===this.state&&(this.x1=e.x,this.y1=e.y,this.x2=e.x,this.y2=e.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,"new"!==this.state&&(this.select(),this.grip1.ownsTarget(n)?this.activeGrip=this.grip1:this.grip2.ownsTarget(n)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},e.prototype.pointerUp=function(e){var n=this.state;t.prototype.pointerUp.call(this,e),"creating"===this.state&&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(e),this._state="select","creating"===n&&this.onMarkerCreated&&this.onMarkerCreated(this)},e.prototype.adjustVisual=function(){},e.prototype.manipulate=function(t){"creating"===this.state?this.resize(t):"move"===this.state?(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()):"resize"===this.state&&this.resize(t)},e.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()},e.prototype.select=function(){t.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},e.prototype.deselect=function(){t.prototype.deselect.call(this),this.controlBox.style.display="none"},e.prototype.setupControlBox=function(){this.controlBox=V.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},e.prototype.adjustControlBox=function(){this.positionGrips()},e.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},e.prototype.createGrip=function(){var t=new rt;return t.visual.transform.baseVal.appendItem(V.createTransform()),this.controlBox.appendChild(t.visual),t},e.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)},e.prototype.positionGrip=function(t,e,n){var r=t.transform.baseVal.getItem(0);r.setTranslate(e,n),t.transform.baseVal.replaceItem(r,0)},e.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},t.prototype.getState.call(this))},e.prototype.restoreState=function(e){t.prototype.restoreState.call(this,e);var n=e;this.x1=n.x1,this.y1=n.y1,this.x2=n.x2,this.y2=n.y2},e.prototype.scale=function(e,n){t.prototype.scale.call(this,e,n),this.x1=this.x1*e,this.y1=this.y1*n,this.x2=this.x2*e,this.y2=this.y2*n,this.adjustVisual(),this.adjustControlBox()},e}(et),dt=function(t){function e(e,n,r){var i=t.call(this,e,n,r)||this;return i.strokeColor="transparent",i.strokeWidth=0,i.strokeDasharray="",i.setStrokeColor=i.setStrokeColor.bind(i),i.setStrokeWidth=i.setStrokeWidth.bind(i),i.setStrokeDasharray=i.setStrokeDasharray.bind(i),i.strokeColor=r.defaultColor,i.strokeWidth=r.defaultStrokeWidth,i.strokeDasharray=r.defaultStrokeDasharray,i.strokePanel=new tt("Line color",r.defaultColorSet,r.defaultColor),i.strokePanel.onColorChanged=i.setStrokeColor,i.strokeWidthPanel=new st("Line width",r.defaultStrokeWidths,r.defaultStrokeWidth),i.strokeWidthPanel.onWidthChanged=i.setStrokeWidth,i.strokeStylePanel=new lt("Line style",r.defaultStrokeDasharrays,r.defaultStrokeDasharray),i.strokeStylePanel.onStyleChanged=i.setStrokeDasharray,i}return U(e,t),e.prototype.ownsTarget=function(e){return!(!t.prototype.ownsTarget.call(this,e)&&e!==this.visual&&e!==this.selectorLine&&e!==this.visibleLine)},e.prototype.createVisual=function(){this.visual=V.createGroup(),this.selectorLine=V.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=V.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)},e.prototype.pointerDown=function(e,n){t.prototype.pointerDown.call(this,e,n),"new"===this.state&&(this.createVisual(),this.adjustVisual(),this._state="creating")},e.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()),V.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),V.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),V.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},e.prototype.setStrokeColor=function(t){this.strokeColor=t,this.adjustVisual(),this.colorChanged(t)},e.prototype.setStrokeWidth=function(t){this.strokeWidth=t,this.adjustVisual()},e.prototype.setStrokeDasharray=function(t){this.strokeDasharray=t,this.adjustVisual(),this.stateChanged()},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var n=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},t.prototype.getState.call(this));return n.typeName=e.typeName,n},e.prototype.restoreState=function(e){t.prototype.restoreState.call(this,e);var n=e;this.strokeColor=n.strokeColor,this.strokeWidth=n.strokeWidth,this.strokeDasharray=n.strokeDasharray,this.createVisual(),this.adjustVisual()},e.typeName="LineMarker",e.title="Line marker",e.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',e}(ht),ft=function(t){function e(e,n,r,i){var o=t.call(this,e,i||'<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 o.fonts=[],o.fontBoxes=[],o.fonts=n,o.currentFont=r,o.setCurrentFont=o.setCurrentFont.bind(o),o}return U(e,t),e.prototype.getUi=function(){var t=this,e=document.createElement("div");return e.style.overflow="hidden",e.style.flexGrow="2",this.fonts.forEach((function(n){var r=document.createElement("div");r.style.display="inline-block",r.style.alignItems="center",r.style.justifyContent="space-between",r.style.padding="5px",r.style.borderWidth="2px",r.style.borderStyle="solid",r.style.overflow="hidden",r.style.maxWidth=100/t.fonts.length-5+"%",r.style.borderColor=n===t.currentFont?t.uiStyleSettings.toolboxAccentColor:"transparent",r.addEventListener("click",(function(){t.setCurrentFont(n,r)})),e.appendChild(r);var i=document.createElement("div");i.style.display="flex",i.style.minHeight="20px",i.style.flexGrow="2",i.style.fontFamily=n,i.style.overflow="hidden";var o=document.createElement("div");o.style.whiteSpace="nowrap",o.style.overflow="hidden",o.style.textOverflow="ellipsis",o.innerHTML="The quick brown fox jumps over the lazy dog",i.appendChild(o),r.appendChild(i),t.fontBoxes.push(r)})),e},e.prototype.setCurrentFont=function(t,e){var n=this;this.currentFont=t,this.fontBoxes.forEach((function(t){t.style.borderColor=t===e?n.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onFontChanged&&this.onFontChanged(this.currentFont)},e}(Q),pt=function(t){function e(e,n,r){var i=t.call(this,e,n,r)||this;return i.color="transparent",i.padding=5,i.DEFAULT_TEXT="your text here",i.text=i.DEFAULT_TEXT,i.isMoved=!1,i.color=r.defaultColor,i.fontFamily=r.defaultFontFamily,i.defaultSize={x:100,y:30},i.setColor=i.setColor.bind(i),i.setFont=i.setFont.bind(i),i.renderText=i.renderText.bind(i),i.sizeText=i.sizeText.bind(i),i.textEditDivClicked=i.textEditDivClicked.bind(i),i.showTextEditor=i.showTextEditor.bind(i),i.setSize=i.setSize.bind(i),i.positionTextEditor=i.positionTextEditor.bind(i),i.colorPanel=new tt("Color",r.defaultColorSet,r.defaultColor),i.colorPanel.onColorChanged=i.setColor,i.fontFamilyPanel=new ft("Font",r.defaultFontFamilies,r.defaultFontFamily),i.fontFamilyPanel.onFontChanged=i.setFont,i}return U(e,t),e.prototype.ownsTarget=function(e){if(t.prototype.ownsTarget.call(this,e)||e===this.visual||e===this.textElement||e===this.bgRectangle)return!0;var n=!1;return this.textElement.childNodes.forEach((function(t){t===e&&(n=!0)})),n},e.prototype.createVisual=function(){this.visual=V.createGroup(),this.bgRectangle=V.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=V.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(V.createTransform()),this.textElement.transform.baseVal.appendItem(V.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},e.prototype.pointerDown=function(e,n){t.prototype.pointerDown.call(this,e,n),this.isMoved=!1,this.pointerDownPoint=e,this.pointerDownTimestamp=Date.now(),"new"===this.state&&(this.createVisual(),this.moveVisual(e),this._state="creating")},e.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(e){t.textElement.appendChild(V.createTSpan(""===e.trim()?" ":e.trim(),[["x","0"],["dy","1.2em"]]))})),setTimeout(this.sizeText,10)}},e.prototype.getTextScale=function(){var t=this.textElement.getBBox(),e=1;if(t.width>0&&t.height>0){var n=(1*this.width-this.width*this.padding*2/100)/t.width,r=(1*this.height-this.height*this.padding*2/100)/t.height;e=Math.min(n,r)}return e},e.prototype.getTextPosition=function(t){var e=this.textElement.getBBox(),n=0,r=0;return e.width>0&&e.height>0&&(n=(this.width-e.width*t)/2,r=this.height/2-e.height*t/2),{x:n,y:r}},e.prototype.sizeText=function(){var t=this.textElement.getBBox(),e=this.getTextScale(),n=this.getTextPosition(e);n.y-=t.y*e,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+n.x+"px, "+n.y+"px) scale("+e+", "+e+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(n.x,n.y),this.textElement.transform.baseVal.getItem(1).setScale(e,e))},e.prototype.manipulate=function(e){t.prototype.manipulate.call(this,e),void 0!==this.pointerDownPoint&&(this.isMoved=Math.abs(e.x-this.pointerDownPoint.x)>5||Math.abs(e.y-this.pointerDownPoint.y)>5)},e.prototype.resize=function(e){t.prototype.resize.call(this,e),this.isMoved=!0,this.setSize(),this.sizeText()},e.prototype.setSize=function(){t.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(V.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),V.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},e.prototype.pointerUp=function(e){var n=this.state;"creating"===n&&(this._suppressMarkerCreateEvent=!0),t.prototype.pointerUp.call(this,e),this.setSize(),("creating"===n||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},e.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(t){t.stopPropagation()})),this.textEditor.addEventListener("input",(function(){for(var e=Number.parseFloat(t.textEditor.style.fontSize);t.textEditor.clientWidth>=Number.parseInt(t.textEditor.style.maxWidth)&&e>.9;)e-=.1,t.textEditor.style.fontSize=Math.max(e,.9)+"em"})),this.textEditor.addEventListener("keyup",(function(t){t.cancelBubble=!0})),this.textEditor.addEventListener("paste",(function(t){if(t.clipboardData){var e=t.clipboardData.getData("text"),n=window.getSelection();if(!n.rangeCount)return!1;n.deleteFromDocument(),n.getRangeAt(0).insertNode(document.createTextNode(e)),t.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")},e.prototype.positionTextEditor=function(){if("edit"===this.state)if(void 0===this.textEditor)this.showTextEditor();else{this.textElement.style.display="";var t=this.getTextScale(),e=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),n=this.textElement.getBBox(),r={x:n.width*t,y:n.height*t};e.x-=r.x/2,e.y-=r.y/2,this.textEditor.style.top=e.y+"px",this.textEditor.style.left=e.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-e.x+"px",this.textEditor.style.fontSize=Math.max(16*t,12)+"px",this.textElement.style.display="none"}},e.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()},e.prototype.select=function(){t.prototype.select.call(this),"edit"===this.state&&this.textEditDivClicked(this.textEditor.innerText)},e.prototype.deselect=function(){"edit"===this.state&&this.textEditDivClicked(this.textEditor.innerText),t.prototype.deselect.call(this)},e.prototype.dblClick=function(e,n){t.prototype.dblClick.call(this,e,n),this.showTextEditor()},e.prototype.setColor=function(t){this.textElement&&V.setAttributes(this.textElement,[["fill",t]]),this.color=t,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(t)},e.prototype.setFont=function(t){this.textElement&&V.setAttributes(this.textElement,[["font-family",t]]),this.fontFamily=t,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},e.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},e.prototype.showVisual=function(){"edit"===this.state&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var n=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},t.prototype.getState.call(this));return n.typeName=e.typeName,n},e.prototype.restoreState=function(e){var n=e;this.color=n.color,this.fontFamily=n.fontFamily,this.padding=n.padding,this.text=n.text,this.createVisual(),t.prototype.restoreState.call(this,e),this.setSize()},e.prototype.scale=function(e,n){t.prototype.scale.call(this,e,n),this.setSize(),this.sizeText(),this.positionTextEditor()},e.typeName="TextMarker",e.title="Text marker",e.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>',e}(ot),gt=function(t){function e(e,n,r){var i=t.call(this,e,n,r)||this;return i.color="transparent",i.lineWidth=3,i.drawing=!1,i.pixelRatio=1,i.color=r.defaultColor,i.lineWidth=r.defaultStrokeWidth,i.pixelRatio=r.freehandPixelRatio,i.setColor=i.setColor.bind(i),i.addCanvas=i.addCanvas.bind(i),i.finishCreation=i.finishCreation.bind(i),i.setLineWidth=i.setLineWidth.bind(i),i.colorPanel=new tt("Color",r.defaultColorSet,r.defaultColor),i.colorPanel.onColorChanged=i.setColor,i.lineWidthPanel=new st("Line width",r.defaultStrokeWidths,r.defaultStrokeWidth),i.lineWidthPanel.onWidthChanged=i.setLineWidth,i}return U(e,t),e.prototype.ownsTarget=function(e){return!(!t.prototype.ownsTarget.call(this,e)&&e!==this.visual&&e!==this.drawingImage)},e.prototype.createVisual=function(){this.visual=V.createGroup(),this.drawingImage=V.createImage(),this.visual.appendChild(this.drawingImage);var t=V.createTransform();this.visual.transform.baseVal.appendItem(t),this.addMarkerVisualToContainer(this.visual)},e.prototype.pointerDown=function(e,n){"new"===this.state&&(this.addCanvas(),this.createVisual(),this._state="creating"),"creating"===this.state?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(e.x,e.y),this.drawing=!0):t.prototype.pointerDown.call(this,e,n)},e.prototype.manipulate=function(e){"creating"===this.state?this.drawing&&(this.canvasContext.lineTo(e.x,e.y),this.canvasContext.stroke()):t.prototype.manipulate.call(this,e)},e.prototype.resize=function(e){t.prototype.resize.call(this,e),V.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),V.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},e.prototype.pointerUp=function(e){"creating"===this._state?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):t.prototype.pointerUp.call(this,e)},e.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)},e.prototype.select=function(){"creating"===this.state&&this.finishCreation(),t.prototype.select.call(this)},e.prototype.deselect=function(){"creating"===this.state&&this.finishCreation(),t.prototype.deselect.call(this)},e.prototype.finishCreation=function(){for(var t=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),e=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],n=e[0],r=e[1],i=e[2],o=e[3],a=!1,s=0;s<this.canvasElement.height;s++)for(var l=0;l<this.canvasElement.width;l++)t.data[s*this.canvasElement.width*4+4*l+3]>0&&(a=!0,s<r&&(r=s),l<n&&(n=l),s>o&&(o=s),l>i&&(i=l));if(a){this.left=n/this.pixelRatio,this.top=r/this.pixelRatio,this.width=(i-n)/this.pixelRatio,this.height=(o-r)/this.pixelRatio;var c=document.createElement("canvas");c.width=i-n,c.height=o-r,c.getContext("2d").putImageData(this.canvasContext.getImageData(n,r,i-n,o-r),0,0),this.drawingImgUrl=c.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},e.prototype.setDrawingImage=function(){V.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),V.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},e.prototype.setColor=function(t){this.color=t,this.colorChanged(t)},e.prototype.setLineWidth=function(t){this.lineWidth=t},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return"new"===this.state||"creating"===this.state?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var n=Object.assign({drawingImgUrl:this.drawingImgUrl},t.prototype.getState.call(this));return n.typeName=e.typeName,n},e.prototype.restoreState=function(e){this.createVisual(),t.prototype.restoreState.call(this,e),this.drawingImgUrl=e.drawingImgUrl,this.setDrawingImage()},e.prototype.scale=function(e,n){t.prototype.scale.call(this,e,n),this.setDrawingImage()},e.typeName="FreehandMarker",e.title="Freehand marker",e.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>',e}(ot),mt=function(t){function e(e,n,r){var i=t.call(this,e,r||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return i.typeBoxes=[],i.currentType=n,i.setCurrentType=i.setCurrentType.bind(i),i}return U(e,t),e.prototype.getUi=function(){var t=this,e=document.createElement("div");e.style.display="flex",e.style.overflow="hidden",e.style.flexGrow="2";for(var n=function(n){var i="both";switch(n){case 0:i="both";break;case 1:i="start";break;case 2:i="end";break;case 3:i="none"}var o=document.createElement("div");if(o.style.display="flex",o.style.flexGrow="2",o.style.alignItems="center",o.style.justifyContent="space-between",o.style.padding="5px",o.style.borderWidth="2px",o.style.borderStyle="solid",o.style.borderColor=i===r.currentType?r.uiStyleSettings.toolboxAccentColor:"transparent",o.addEventListener("click",(function(){t.setCurrentType(i,o)})),e.appendChild(o),"both"===i||"start"===i){var a=document.createElement("div");a.style.display="flex",a.style.alignItems="center",a.style.minHeight="20px",a.innerHTML='<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">\n <polygon points="0,5 10,0 10,10" fill="'+(void 0!==r.uiStyleSettings?r.uiStyleSettings.toolboxColor:"#eeeeee")+'" />\n </svg>',a.style.marginLeft="5px",o.appendChild(a)}var s=document.createElement("div");s.style.display="flex",s.style.alignItems="center",s.style.minHeight="20px",s.style.flexGrow="2";var l=document.createElement("hr");if(l.style.minWidth="20px",l.style.border="0px",l.style.borderTop="3px solid "+(void 0!==r.uiStyleSettings?r.uiStyleSettings.toolboxColor:"#eeeeee"),l.style.flexGrow="2",s.appendChild(l),o.appendChild(s),"both"===i||"end"===i){var c=document.createElement("div");c.style.display="flex",c.style.alignItems="center",c.style.minHeight="20px",c.innerHTML='<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">\n <polygon points="0,0 10,5 0,10" fill="'+(void 0!==r.uiStyleSettings?r.uiStyleSettings.toolboxColor:"#eeeeee")+'" />\n </svg>',c.style.marginRight="5px",o.appendChild(c)}r.typeBoxes.push(o)},r=this,i=0;i<4;i++)n(i);return e},e.prototype.setCurrentType=function(t,e){var n=this;this.currentType=t,this.typeBoxes.forEach((function(t){t.style.borderColor=t===e?void 0!==n.uiStyleSettings?n.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"})),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},e}(Q),vt=function(t){function e(e,n,r){var i=t.call(this,e,n,r)||this;return i.arrowType="end",i.arrowBaseHeight=10,i.arrowBaseWidth=10,i.getArrowPoints=i.getArrowPoints.bind(i),i.setArrowType=i.setArrowType.bind(i),i.arrowTypePanel=new mt("Arrow type","end"),i.arrowTypePanel.onArrowTypeChanged=i.setArrowType,i}return U(e,t),e.prototype.ownsTarget=function(e){return!(!t.prototype.ownsTarget.call(this,e)&&e!==this.arrow1&&e!==this.arrow2)},e.prototype.getArrowPoints=function(t,e){var n=this.arrowBaseWidth+2*this.strokeWidth,r=this.arrowBaseHeight+2*this.strokeWidth;return t-n/2+","+(e+r/2)+" "+t+","+(e-r/2)+" "+(t+n/2)+","+(e+r/2)},e.prototype.createTips=function(){this.arrow1=V.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(V.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=V.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(V.createTransform()),this.visual.appendChild(this.arrow2)},e.prototype.pointerDown=function(e,n){t.prototype.pointerDown.call(this,e,n),"creating"===this.state&&this.createTips()},e.prototype.adjustVisual=function(){if(t.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display="both"===this.arrowType||"start"===this.arrowType?"":"none",this.arrow2.style.display="both"===this.arrowType||"end"===this.arrowType?"":"none",V.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),V.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var e=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),n=this.arrow1.transform.baseVal.getItem(0);n.setRotate(e,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(n,0);var r=this.arrow2.transform.baseVal.getItem(0);r.setRotate(e+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(r,0)}},e.prototype.setArrowType=function(t){this.arrowType=t,this.adjustVisual(),this.stateChanged()},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var n=Object.assign({arrowType:this.arrowType},t.prototype.getState.call(this));return n.typeName=e.typeName,n},e.prototype.restoreState=function(e){t.prototype.restoreState.call(this,e);var n=e;this.arrowType=n.arrowType,this.createTips(),this.adjustVisual()},e.typeName="ArrowMarker",e.title="Arrow marker",e.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',e}(dt),yt=function(t){function e(e,n,r){var i=t.call(this,e,n,r)||this;return i.fillColor=r.defaultFillColor,i.strokeWidth=0,i.fillPanel=new tt("Color",r.defaultColorSet,r.defaultFillColor),i.fillPanel.onColorChanged=i.setFillColor,i}return U(e,t),Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var n=t.prototype.getState.call(this);return n.typeName=e.typeName,n},e.typeName="CoverMarker",e.title="Cover marker",e.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',e}(at),bt=function(t){function e(e,n,r,i){var o=t.call(this,e,i||'<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 o.opacities=[],o.opacityBoxes=[],o.opacities=n,o.currentOpacity=r,o.setCurrentOpacity=o.setCurrentOpacity.bind(o),o}return U(e,t),e.prototype.getUi=function(){var t=this,e=document.createElement("div");return e.style.display="flex",e.style.overflow="hidden",e.style.flexGrow="2",e.style.justifyContent="space-between",this.opacities.forEach((function(n){var r=document.createElement("div");r.style.display="flex",r.style.alignItems="center",r.style.justifyContent="center",r.style.padding="5px",r.style.borderWidth="2px",r.style.borderStyle="solid",r.style.borderColor=n===t.currentOpacity?t.uiStyleSettings.toolboxAccentColor:"transparent",r.addEventListener("click",(function(){t.setCurrentOpacity(n,r)})),e.appendChild(r);var i=document.createElement("div");i.innerText=100*n+"%",r.appendChild(i),t.opacityBoxes.push(r)})),e},e.prototype.setCurrentOpacity=function(t,e){var n=this;this.currentOpacity=t,this.opacityBoxes.forEach((function(t){t.style.borderColor=t===e?n.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},e}(Q),xt=function(t){function e(e,n,r){var i=t.call(this,e,n,r)||this;return i.setOpacity=i.setOpacity.bind(i),i.fillColor=r.defaultHighlightColor,i.strokeWidth=0,i.opacity=r.defaultHighlightOpacity,i.fillPanel=new tt("Color",r.defaultColorSet,i.fillColor),i.fillPanel.onColorChanged=i.setFillColor,i.opacityPanel=new bt("Opacity",r.defaultOpacitySteps,i.opacity),i.opacityPanel.onOpacityChanged=i.setOpacity,i}return U(e,t),e.prototype.setOpacity=function(t){this.opacity=t,this.visual&&V.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var n=t.prototype.getState.call(this);return n.typeName=e.typeName,n},e.typeName="HighlightMarker",e.title="Highlight marker",e.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>',e}(yt),Ct='<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>',St=function(t){function e(e,n,r){var i=t.call(this,e,n,r)||this;return i.bgColor="transparent",i.tipPosition={x:0,y:0},i.tipBase1Position={x:0,y:0},i.tipBase2Position={x:0,y:0},i.tipMoving=!1,i.color=r.defaultStrokeColor,i.bgColor=r.defaultFillColor,i.fontFamily=r.defaultFontFamily,i.defaultSize={x:100,y:30},i.setBgColor=i.setBgColor.bind(i),i.getTipPoints=i.getTipPoints.bind(i),i.positionTip=i.positionTip.bind(i),i.setTipPoints=i.setTipPoints.bind(i),i.colorPanel=new tt("Text color",r.defaultColorSet,i.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>'),i.colorPanel.onColorChanged=i.setColor,i.bgColorPanel=new tt("Fill color",r.defaultColorSet,i.bgColor,Ct),i.bgColorPanel.onColorChanged=i.setBgColor,i.fontFamilyPanel=new ft("Font",r.defaultFontFamilies,r.defaultFontFamily),i.fontFamilyPanel.onFontChanged=i.setFont,i.tipGrip=new rt,i.tipGrip.visual.transform.baseVal.appendItem(V.createTransform()),i.controlBox.appendChild(i.tipGrip.visual),i}return U(e,t),e.prototype.ownsTarget=function(e){return t.prototype.ownsTarget.call(this,e)||this.tipGrip.ownsTarget(e)||this.tip===e},e.prototype.createTip=function(){V.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=V.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},e.prototype.pointerDown=function(e,n){"new"===this.state&&t.prototype.pointerDown.call(this,e,n),"creating"===this.state?this.createTip():this.tipGrip.ownsTarget(n)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):t.prototype.pointerDown.call(this,e,n)},e.prototype.pointerUp=function(e){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,t.prototype.pointerUp.call(this,e);else{var n="creating"===this.state;t.prototype.pointerUp.call(this,e),this.setTipPoints(n),this.positionTip()}},e.prototype.manipulate=function(e){if(this.tipMoving){var n=this.unrotatePoint(e);this.tipPosition={x:n.x-this.manipulationStartLeft,y:n.y-this.manipulationStartTop},this.positionTip()}else t.prototype.manipulate.call(this,e)},e.prototype.setBgColor=function(t){this.bgRectangle&&this.tip&&(V.setAttributes(this.bgRectangle,[["fill",t]]),V.setAttributes(this.tip,[["fill",t]])),this.bgColor=t,this.fillColorChanged(t)},e.prototype.getTipPoints=function(){return this.setTipPoints("creating"===this.state),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},e.prototype.setTipPoints=function(t){void 0===t&&(t=!1);var e=Math.min(this.height/2,15),n=this.height/5;t&&(this.tipPosition={x:e+n/2,y:this.height+20});var r=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?r<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(n=this.width/5,e=Math.min(this.width/2,15),this.tipBase1Position={x:e,y:0},this.tipBase2Position={x:e+n,y:0}):(this.tipBase1Position={x:0,y:e},this.tipBase2Position={x:0,y:e+n}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?r<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(n=this.width/5,e=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-e-n,y:0},this.tipBase2Position={x:this.width-e,y:0}):(this.tipBase1Position={x:this.width,y:e},this.tipBase2Position={x:this.width,y:e+n}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?r<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(n=this.width/5,e=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-e-n,y:this.height},this.tipBase2Position={x:this.width-e,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-e-n},this.tipBase2Position={x:this.width,y:this.height-e}):r<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(n=this.width/5,e=Math.min(this.width/2,15),this.tipBase1Position={x:e,y:this.height},this.tipBase2Position={x:e+n,y:this.height}):(this.tipBase1Position={x:0,y:this.height-e},this.tipBase2Position={x:0,y:this.height-e-n})},e.prototype.resize=function(e){t.prototype.resize.call(this,e),this.positionTip()},e.prototype.positionTip=function(){V.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(e.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),e.prototype.select=function(){this.positionTip(),t.prototype.select.call(this)},e.prototype.getState=function(){var n=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},t.prototype.getState.call(this));return n.typeName=e.typeName,n},e.prototype.restoreState=function(e){var n=e;this.bgColor=n.bgColor,this.tipPosition=n.tipPosition,t.prototype.restoreState.call(this,e),this.createTip(),this.setTipPoints()},e.prototype.scale=function(e,n){t.prototype.scale.call(this,e,n),this.tipPosition={x:this.tipPosition.x*e,y:this.tipPosition.y*n},this.positionTip()},e.typeName="CalloutMarker",e.title="Callout marker",e.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>',e}(pt),Et=function(t){function e(e,n,r){var i=t.call(this,e,n,r)||this;return i.fillColor="transparent",i.strokeColor="transparent",i.strokeWidth=0,i.strokeDasharray="",i.opacity=1,i.strokeColor=r.defaultColor,i.strokeWidth=r.defaultStrokeWidth,i.strokeDasharray=r.defaultStrokeDasharray,i.fillColor=r.defaultFillColor,i.setStrokeColor=i.setStrokeColor.bind(i),i.setFillColor=i.setFillColor.bind(i),i.setStrokeWidth=i.setStrokeWidth.bind(i),i.setStrokeDasharray=i.setStrokeDasharray.bind(i),i.setOpacity=i.setOpacity.bind(i),i.createVisual=i.createVisual.bind(i),i.strokePanel=new tt("Line color",G(r.defaultColorSet,["transparent"]),r.defaultColor),i.strokePanel.onColorChanged=i.setStrokeColor,i.fillPanel=new tt("Fill color",G(r.defaultColorSet,["transparent"]),i.fillColor,Ct),i.fillPanel.onColorChanged=i.setFillColor,i.strokeWidthPanel=new st("Line width",r.defaultStrokeWidths,r.defaultStrokeWidth),i.strokeWidthPanel.onWidthChanged=i.setStrokeWidth,i.strokeStylePanel=new lt("Line style",r.defaultStrokeDasharrays,r.defaultStrokeDasharray),i.strokeStylePanel.onStyleChanged=i.setStrokeDasharray,i.opacityPanel=new bt("Opacity",r.defaultOpacitySteps,i.opacity),i.opacityPanel.onOpacityChanged=i.setOpacity,i}return U(e,t),e.prototype.ownsTarget=function(e){return!(!t.prototype.ownsTarget.call(this,e)&&e!==this.visual)},e.prototype.createVisual=function(){this.visual=V.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)},e.prototype.pointerDown=function(e,n){t.prototype.pointerDown.call(this,e,n),"new"===this.state&&(this.createVisual(),this.moveVisual(e),this._state="creating")},e.prototype.manipulate=function(e){t.prototype.manipulate.call(this,e)},e.prototype.resize=function(e){t.prototype.resize.call(this,e),this.setSize()},e.prototype.setSize=function(){t.prototype.setSize.call(this),V.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},e.prototype.pointerUp=function(e){t.prototype.pointerUp.call(this,e),this.setSize()},e.prototype.setStrokeColor=function(t){this.strokeColor=t,this.visual&&V.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(t),this.stateChanged()},e.prototype.setFillColor=function(t){this.fillColor=t,this.visual&&V.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(t),this.stateChanged()},e.prototype.setStrokeWidth=function(t){this.strokeWidth=t,this.visual&&V.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},e.prototype.setStrokeDasharray=function(t){this.strokeDasharray=t,this.visual&&V.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},e.prototype.setOpacity=function(t){this.opacity=t,this.visual&&V.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var n=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},t.prototype.getState.call(this));return n.typeName=e.typeName,n},e.prototype.restoreState=function(e){var n=e;this.fillColor=n.fillColor,this.strokeColor=n.strokeColor,this.strokeWidth=n.strokeWidth,this.strokeDasharray=n.strokeDasharray,this.opacity=n.opacity,this.createVisual(),t.prototype.restoreState.call(this,e),this.setSize()},e.prototype.scale=function(e,n){t.prototype.scale.call(this,e,n),this.setSize()},e.typeName="EllipseMarker",e.title="Ellipse marker",e.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>',e}(ot),kt=function(t){function e(e,n,r){return t.call(this,e,n,r)||this}return U(e,t),Object.defineProperty(e.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),e.prototype.ownsTarget=function(e){return!(!t.prototype.ownsTarget.call(this,e)&&e!==this.tip1&&e!==this.tip2)},e.prototype.createTips=function(){this.tip1=V.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(V.createTransform()),this.visual.appendChild(this.tip1),this.tip2=V.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(V.createTransform()),this.visual.appendChild(this.tip2)},e.prototype.pointerDown=function(e,n){t.prototype.pointerDown.call(this,e,n),"creating"===this.state&&this.createTips()},e.prototype.adjustVisual=function(){if(t.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(V.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()]]),V.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 e=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),n=this.tip1.transform.baseVal.getItem(0);n.setRotate(e,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(n,0);var r=this.tip2.transform.baseVal.getItem(0);r.setRotate(e+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(r,0)}},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var n=t.prototype.getState.call(this);return n.typeName=e.typeName,n},e.prototype.restoreState=function(e){t.prototype.restoreState.call(this,e),this.createTips(),this.adjustVisual()},e.typeName="MeasurementMarker",e.title="Measurement marker",e.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>',e}(dt),wt=function(t){function e(e,n,r){var i=t.call(this,e,n,r)||this;return i.strokePanel.colors=r.defaultColorSet,i.fillColor="transparent",i}return U(e,t),Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var n=t.prototype.getState.call(this);return n.typeName=e.typeName,n},e.typeName="EllipseFrameMarker",e.title="Ellipse frame marker",e.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>',e}(Et),Tt=function(){function t(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(t.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),t.prototype.addUndoStep=function(t){0!==this.undoStack.length&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(t)||(this.undoStack.push(t),JSON.stringify(this.lastRedoStep)!==JSON.stringify(t)&&this.redoStack.splice(0,this.redoStack.length))},t.prototype.replaceLastUndoStep=function(t){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=t)},t.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},t.prototype.undo=function(){if(this.undoStack.length>1){var t=this.undoStack.pop();return void 0!==t&&this.redoStack.push(t),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},t.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},t}(),Ot=function(t){function e(e,n,r){var i=t.call(this,e,n,r)||this;return i.strokeColor="transparent",i.strokeWidth=0,i.strokeDasharray="",i.curveX=0,i.curveY=0,i.manipulationStartCurveX=0,i.manipulationStartCurveY=0,i.setStrokeColor=i.setStrokeColor.bind(i),i.setStrokeWidth=i.setStrokeWidth.bind(i),i.setStrokeDasharray=i.setStrokeDasharray.bind(i),i.positionGrips=i.positionGrips.bind(i),i.addControlGrips=i.addControlGrips.bind(i),i.adjustVisual=i.adjustVisual.bind(i),i.setupControlBox=i.setupControlBox.bind(i),i.resize=i.resize.bind(i),i.strokeColor=r.defaultColor,i.strokeWidth=r.defaultStrokeWidth,i.strokeDasharray=r.defaultStrokeDasharray,i.strokePanel=new tt("Line color",r.defaultColorSet,r.defaultColor),i.strokePanel.onColorChanged=i.setStrokeColor,i.strokeWidthPanel=new st("Line width",r.defaultStrokeWidths,r.defaultStrokeWidth),i.strokeWidthPanel.onWidthChanged=i.setStrokeWidth,i.strokeStylePanel=new lt("Line style",r.defaultStrokeDasharrays,r.defaultStrokeDasharray),i.strokeStylePanel.onStyleChanged=i.setStrokeDasharray,i}return U(e,t),e.prototype.ownsTarget=function(e){return!(!t.prototype.ownsTarget.call(this,e)&&e!==this.visual&&e!==this.selectorCurve&&e!==this.visibleCurve&&!this.curveGrip.ownsTarget(e))},e.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},e.prototype.createVisual=function(){this.visual=V.createGroup(),this.selectorCurve=V.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=V.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)},e.prototype.pointerDown=function(e,n){t.prototype.pointerDown.call(this,e,n),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,"new"===this.state&&(this.curveX=e.x,this.curveY=e.y),"new"===this.state?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(n)&&(this.activeGrip=this.curveGrip,this._state="resize")},e.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),V.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),V.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),V.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},e.prototype.setupControlBox=function(){t.prototype.setupControlBox.call(this),this.curveControlLine1=V.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=V.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)},e.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,t.prototype.addControlGrips.call(this)},e.prototype.positionGrips=function(){t.prototype.positionGrips.call(this);var e=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-e/2,this.curveY-e/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()))},e.prototype.manipulate=function(e){"move"===this.state&&(this.curveX=this.manipulationStartCurveX+e.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+e.y-this.manipulationStartY),t.prototype.manipulate.call(this,e)},e.prototype.resize=function(e){this.activeGrip===this.curveGrip&&(this.curveX=e.x,this.curveY=e.y),t.prototype.resize.call(this,e),"creating"===this.state&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},e.prototype.setStrokeColor=function(t){this.strokeColor=t,this.adjustVisual(),this.colorChanged(t)},e.prototype.setStrokeWidth=function(t){this.strokeWidth=t,this.adjustVisual()},e.prototype.setStrokeDasharray=function(t){this.strokeDasharray=t,this.adjustVisual()},e.prototype.scale=function(e,n){this.curveX=this.curveX*e,this.curveY=this.curveY*n,t.prototype.scale.call(this,e,n)},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var n=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},t.prototype.getState.call(this));return n.typeName=e.typeName,n},e.prototype.restoreState=function(e){t.prototype.restoreState.call(this,e);var n=e;this.strokeColor=n.strokeColor,this.strokeWidth=n.strokeWidth,this.strokeDasharray=n.strokeDasharray,this.curveX=n.curveX,this.curveY=n.curveY,this.createVisual(),this.adjustVisual()},e.typeName="CurveMarker",e.title="Curve marker",e.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>',e}(ht),Lt=function(){function t(t,e){void 0===e&&(e=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=t,this.cancelable=e}return Object.defineProperty(t.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),t.prototype.preventDefault=function(){this._defaultPrevented=!0},t}(),At=function(t){function e(e,n,r){var i=t.call(this,e,!1)||this;return i.dataUrl=n,i.state=r,i}return U(e,t),e}(Lt),Dt=function(t){function e(e,n,r){void 0===r&&(r=!1);var i=t.call(this,e,r)||this;return i.marker=n,i}return U(e,t),e}(Lt),Rt=function(){function t(){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 t.prototype.addEventListener=function(t,e){this[t].push(e)},t.prototype.removeEventListener=function(t,e){var n=this[t].indexOf(e);n>-1&&this[t].splice(n,1)},t}(),Mt=function(){function t(e){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new ut,this._isOpen=!1,this.undoRedoManager=new Tt,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 Rt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=t.instanceCounter++,this.styles=new Y(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=e,this.targetRoot=document.body,this.width=e.clientWidth,this.height=e.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(t.prototype,"ALL_MARKER_TYPES",{get:function(){return[ct,gt,vt,pt,wt,Et,xt,St,kt,yt,dt,Ot]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[ct,gt,vt,pt,Et,xt,St]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"BASIC_MARKER_TYPES",{get:function(){return[ct,gt,vt,pt,xt]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(t){var e=this;this._availableMarkerTypes.splice(0),t.forEach((function(t){if("string"==typeof t){var n=e.ALL_MARKER_TYPES.find((function(e){return e.typeName===t}));void 0!==n&&e._availableMarkerTypes.push(n)}else e._availableMarkerTypes.push(t)}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(t){this._zoomLevel=t,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(t.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),t.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),"popup"===this.settings.displayMode&&this.onPopupTargetResize(),W.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},t.prototype.show=function(){var t=this;void 0===this.styles.styleSheetRoot&&void 0!==q.styleSheetRoot&&(this.styles.styleSheetRoot=q.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach((function(e){return e(new Lt(t))}))},t.prototype.render=function(){return H(this,void 0,void 0,(function(){var t;return z(this,(function(e){switch(e.label){case 0:return this.setCurrentMarker(),(t=new K).naturalSize=this.renderAtNaturalSize,t.imageType=this.renderImageType,t.imageQuality=this.renderImageQuality,t.markersOnly=this.renderMarkersOnly,t.width=this.renderWidth,t.height=this.renderHeight,[4,t.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return e.sent(),[4,t.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,e.sent()]}}))}))},t.prototype.close=function(t){var e=this;if(void 0===t&&(t=!1),this.isOpen){var n=!1;t||this.eventListeners.beforeclose.forEach((function(t){var r=new Lt(e,!0);t(r),r.defaultPrevented&&(n=!0)})),n||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),"popup"===this.settings.displayMode&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach((function(t){return t(new Lt(e))})),this.detachEvents(),this._isOpen=!1)}},t.prototype.addMarkersToToolbar=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];(t=this._availableMarkerTypes).push.apply(t,e)},t.prototype.addRenderEventListener=function(t){this.addEventListener("render",(function(e){t(e.dataUrl,e.state)}))},t.prototype.removeRenderEventListener=function(t){},t.prototype.addCloseEventListener=function(t){this.addEventListener("close",(function(){t()}))},t.prototype.removeCloseEventListener=function(t){},t.prototype.setupResizeObserver=function(){var t=this;"inline"===this.settings.displayMode?window.ResizeObserver&&(this.targetObserver=new ResizeObserver((function(){t.resize(t.target.clientWidth,t.target.clientHeight)})),this.targetObserver.observe(this.target)):"popup"===this.settings.displayMode&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver((function(){return t.onPopupTargetResize()})),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},t.prototype.onPopupTargetResize=function(){var t=1*this.target.clientWidth/this.target.clientHeight,e=this.editorCanvas.clientWidth/t>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*t:this.editorCanvas.clientWidth,n=e<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/t;this.resize(e,n)},t.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},t.prototype.resize=function(t,e){this._isResizing=!0;var n=t/this.imageWidth,r=e/this.imageHeight;this.imageWidth=Math.round(t),this.imageHeight=Math.round(e),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","popup"!==this.settings.displayMode?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),void 0!==this.toolbar&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(n,r),this._isResizing=!1},t.prototype.scaleMarkers=function(t,e){var n,r=this;this._currentMarker&&this._currentMarker instanceof pt?this._currentMarker.scale(t,e):(n=this._currentMarker,this.setCurrentMarker()),this.markers.forEach((function(n){n!==r._currentMarker&&n.scale(t,e)})),void 0!==n&&this.setCurrentMarker(n)},t.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"},t.prototype.setTopLeft=function(){var t=this.editingTarget.getBoundingClientRect(),e=this.editorCanvas.getBoundingClientRect();this.left=t.left-e.left,this.top=t.top-e.top},t.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)},t.prototype.addDefs=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.defs=V.createDefs(),this.addDefsToImage(),(t=this.defs).append.apply(t,e)},t.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},t.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)},t.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},t.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},t.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)},t.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},t.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)},t.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 t=document.createElement("a");t.href="https://markerjs.com/",t.target="_blank",t.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>',t.title="Powered by marker.js",t.style.display="grid",t.style.alignItems="center",t.style.justifyItems="center",t.style.padding="3px",t.style.width="20px",t.style.height="20px",this.logoUI.appendChild(t),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},t.prototype.positionLogo=function(){this.logoUI&&("right"!==this.uiStyleSettings.logoPosition?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")},t.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"},t.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},t.prototype.showUI=function(){switch("popup"===this.settings.displayMode&&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 t=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=t+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=void 0!==this.uiStyleSettings.zIndex?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=void 0!==this.uiStyleSettings.zIndex?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="popup"===this.settings.displayMode?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new Z(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","popup"===this.settings.displayMode&&(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","popup"===this.settings.displayMode&&(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 J(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},t.prototype.closeUI=function(){"popup"===this.settings.displayMode&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},t.prototype.removeMarker=function(t){this.markerImage.removeChild(t.container),this.markers.indexOf(t)>-1&&this.markers.splice(this.markers.indexOf(t),1),t.dispose()},t.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),void 0!==this._currentMarker&&("new"!==this._currentMarker.state?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},t.prototype.toolbarButtonClicked=function(t,e){if("marker"===t&&void 0!==e)this.createNewMarker(e);else if("action"===t)switch(e){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":void 0===this.notesArea?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},t.prototype.deleteSelectedMarker=function(){var t=this;if(void 0!==this._currentMarker){var e=!1;if(this.eventListeners.markerbeforedelete.forEach((function(n){var r=new Dt(t,t._currentMarker,!0);n(r),r.defaultPrevented&&(e=!0)})),!e){var n=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(e){return e(new Dt(t,n))}))}}},t.prototype.clear=function(){var t=this,e=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach((function(n){var r=new Dt(t,void 0,!0);n(r),r.defaultPrevented&&(e=!0)})),!e)){this.setCurrentMarker();for(var n=function(e){var n=r.markers[e];r.setCurrentMarker(r.markers[e]),r._currentMarker.dispose(),r.markerImage.removeChild(r._currentMarker.container),r.markers.splice(r.markers.indexOf(r._currentMarker),1),r.eventListeners.markerdelete.forEach((function(e){return e(new Dt(t,n))}))},r=this,i=this.markers.length-1;i>=0;i--)n(i);this.addUndoStep()}},Object.defineProperty(t.prototype,"isNotesAreaOpen",{get:function(){return void 0!==this.notesArea},enumerable:!1,configurable:!0}),t.prototype.showNotesEditor=function(){var t;void 0!==this._currentMarker&&(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=null!==(t=this._currentMarker.notes)&&void 0!==t?t:"",this.overlayContainer.appendChild(this.notesArea))},t.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(void 0!==this._currentMarker&&(this._currentMarker.notes=""!==this.notesArea.value.trim()?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},t.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},t.prototype.addUndoStep=function(){var t=this;if(void 0===this._currentMarker||"edit"!==this._currentMarker.state){var e=this.getState(),n=this.undoRedoManager.getLastUndoStep();if(!n||n.width===e.width&&n.height===e.height){var r=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(e),r<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach((function(e){return e(new Lt(t))}))}else this.undoRedoManager.replaceLastUndoStep(e),this.eventListeners.statechange.forEach((function(e){return e(new Lt(t))}))}},t.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},t.prototype.undoStep=function(){var t=this,e=this.undoRedoManager.undo();void 0!==e&&(this.restoreState(e),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach((function(e){return e(new Lt(t))})))},t.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},t.prototype.redoStep=function(){var t=this,e=this.undoRedoManager.redo();void 0!==e&&(this.restoreState(e),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach((function(e){return e(new Lt(t))})))},t.prototype.stepZoom=function(){var t=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=t<this.zoomSteps.length-1?this.zoomSteps[t+1]:this.zoomSteps[0]},t.prototype.panTo=function(t){this.contentDiv.scrollBy({left:this.prevPanPoint.x-t.x,top:this.prevPanPoint.y-t.y}),this.prevPanPoint=t},t.prototype.startRenderAndClose=function(){return H(this,void 0,void 0,(function(){var t,e,n=this;return z(this,(function(r){switch(r.label){case 0:return[4,this.render()];case 1:return t=r.sent(),e=this.getState(),this.eventListeners.render.forEach((function(r){return r(new At(n,t,e))})),this.close(!0),[2]}}))}))},t.prototype.getState=function(t){!0===t&&this.setCurrentMarker();var e={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach((function(t){return e.markers.push(t.getState())})),e},t.prototype.restoreState=function(t){var e=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);t.markers.forEach((function(t){var n=e._availableMarkerTypes.find((function(e){return e.typeName===t.typeName}));if(void 0!==n){var r=e.addNewMarker(n);r.restoreState(t),e.markers.push(r)}})),t.width&&t.height&&(t.width!==this.imageWidth||t.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/t.width,this.imageHeight/t.height),this.eventListeners.restorestate.forEach((function(t){return t(new Lt(e))}))},t.prototype.addNewMarker=function(t){var e=V.createGroup();return this.markerImage.appendChild(e),new t(e,this.overlayContainer,this.settings)},t.prototype.createNewMarker=function(t){var e,n=this;(e="string"==typeof t?this._availableMarkerTypes.find((function(e){return e.typeName===t})):t)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(e),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(e.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach((function(t){return t(new Dt(n,n._currentMarker))})))},t.prototype.markerCreated=function(t){var e=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(t),this.setCurrentMarker(t),t instanceof gt&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(gt):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach((function(t){return t(new Dt(e,e._currentMarker))}))},t.prototype.colorChanged=function(t){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=t,this.settings.defaultStrokeColor=t)},t.prototype.fillColorChanged=function(t){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=t)},t.prototype.markerStateChanged=function(t){var e=this;this.eventListeners.markerchange.forEach((function(n){return n(new Dt(e,t))}))},t.prototype.setCurrentMarker=function(t){var e=this;this._currentMarker!==t&&void 0!==this._currentMarker&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach((function(t){return t(new Dt(e,e._currentMarker))}))),this._currentMarker=t,void 0===this._currentMarker||this._currentMarker.isSelected||("new"!==this._currentMarker.state&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach((function(t){return t(new Dt(e,e._currentMarker))})))},t.prototype.onPointerDown=function(t){if(this._isFocused||this.focus(),this.touchPoints++,1===this.touchPoints||"touch"!==t.pointerType)if(void 0===this._currentMarker||"new"!==this._currentMarker.state&&"creating"!==this._currentMarker.state){if("select"===this.mode){var e=this.markers.find((function(e){return e.ownsTarget(t.target)}));void 0!==e?(this.setCurrentMarker(e),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(t.clientX,t.clientY),t.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:t.clientX,y:t.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(t.clientX,t.clientY))},t.prototype.onDblClick=function(t){if(this._isFocused||this.focus(),"select"===this.mode){var e=this.markers.find((function(e){return e.ownsTarget(t.target)}));void 0!==e&&e!==this._currentMarker&&this.setCurrentMarker(e),void 0!==this._currentMarker?this._currentMarker.dblClick(this.clientToLocalCoordinates(t.clientX,t.clientY),t.target):this.setCurrentMarker()}},t.prototype.onPointerMove=function(t){1!==this.touchPoints&&"touch"===t.pointerType||(void 0!==this._currentMarker||this.isDragging)&&(void 0!==this._currentMarker&&"edit"===this._currentMarker.state||t.preventDefault(),void 0!==this._currentMarker?this._currentMarker.manipulate(this.clientToLocalCoordinates(t.clientX,t.clientY)):this.zoomLevel>1&&this.panTo({x:t.clientX,y:t.clientY}))},t.prototype.onPointerUp=function(t){this.touchPoints>0&&this.touchPoints--,0===this.touchPoints&&this.isDragging&&void 0!==this._currentMarker&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(t.clientX,t.clientY)),this.isDragging=!1,this.addUndoStep()},t.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},t.prototype.onKeyUp=function(t){void 0===this._currentMarker||void 0!==this.notesArea||"Delete"!==t.key&&"Backspace"!==t.key||this.deleteSelectedMarker()},t.prototype.clientToLocalCoordinates=function(t,e){var n=this.markerImage.getBoundingClientRect();return{x:(t-n.left)/this.zoomLevel,y:(e-n.top)/this.zoomLevel}},t.prototype.onWindowResize=function(){this.positionUI()},t.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var t=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=t+"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()},t.prototype.addLicenseKey=function(t){W.addKey(t)},t.prototype.addEventListener=function(t,e){this.eventListeners.addEventListener(t,e)},t.prototype.removeEventListener=function(t,e){this.eventListeners.removeEventListener(t,e)},t.prototype.renderState=function(t){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(t),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(t.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),t.prototype.focus=function(){var t=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,void 0!==this._previousCurrentMarker&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach((function(e){return e(new Lt(t))})))},t.prototype.blur=function(){var t=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach((function(e){return e(new Lt(t))})))},t.instanceCounter=0,t}(),It=function(t,e){return(It=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};
/* **********************************
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.
***************************************************************************** */function _t(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}It(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function Pt(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{l(r.next(t))}catch(t){o(t)}}function s(t){try{l(r.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}l((r=r.apply(t,e||[])).next())}))}function Nt(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}var jt=function(){function t(){}return t.addKey=function(e){t.key=e},Object.defineProperty(t,"isLicensed",{get:function(){return!!t.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(t.key)},enumerable:!1,configurable:!0}),t}(),Ft=function(){function t(){}return t.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},t.setAttributes=function(t,e){for(var n=0,r=e;n<r.length;n++){var i=r[n],o=i[0],a=i[1];t.setAttribute(o,a)}},t.createRect=function(e,n,r){var i=document.createElementNS("http://www.w3.org/2000/svg","rect");return i.setAttribute("width",e.toString()),i.setAttribute("height",n.toString()),r&&t.setAttributes(i,r),i},t.createLine=function(e,n,r,i,o){var a=document.createElementNS("http://www.w3.org/2000/svg","line");return a.setAttribute("x1",e.toString()),a.setAttribute("y1",n.toString()),a.setAttribute("x2",r.toString()),a.setAttribute("y2",i.toString()),o&&t.setAttributes(a,o),a},t.createPolygon=function(e,n){var r=document.createElementNS("http://www.w3.org/2000/svg","polygon");return r.setAttribute("points",e),n&&t.setAttributes(r,n),r},t.createCircle=function(e,n){var r=document.createElementNS("http://www.w3.org/2000/svg","circle");return r.setAttribute("cx",(e/2).toString()),r.setAttribute("cy",(e/2).toString()),r.setAttribute("r",e.toString()),n&&t.setAttributes(r,n),r},t.createEllipse=function(e,n,r){var i=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return i.setAttribute("cx",(e/2).toString()),i.setAttribute("cy",(n/2).toString()),i.setAttribute("rx",(e/2).toString()),i.setAttribute("ry",(n/2).toString()),r&&t.setAttributes(i,r),i},t.createGroup=function(e){var n=document.createElementNS("http://www.w3.org/2000/svg","g");return e&&t.setAttributes(n,e),n},t.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},t.createMarker=function(e,n,r,i,o,a,s){var l=document.createElementNS("http://www.w3.org/2000/svg","marker");return t.setAttributes(l,[["id",e],["orient",n],["markerWidth",r.toString()],["markerHeight",i.toString()],["refX",o.toString()],["refY",a.toString()]]),l.appendChild(s),l},t.createText=function(e){var n=document.createElementNS("http://www.w3.org/2000/svg","text");return n.setAttribute("x","0"),n.setAttribute("y","0"),e&&t.setAttributes(n,e),n},t.createTSpan=function(e,n){var r=document.createElementNS("http://www.w3.org/2000/svg","tspan");return r.textContent=e,n&&t.setAttributes(r,n),r},t.createImage=function(e){var n=document.createElementNS("http://www.w3.org/2000/svg","image");return e&&t.setAttributes(n,e),n},t.createPoint=function(t,e){var n=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return n.x=t,n.y=e,n},t.createPath=function(e,n){var r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d",e),n&&t.setAttributes(r,n),r},t.createElement=function(e,n){var r=document.createElementNS("http://www.w3.org/2000/svg",e);return n&&t.setAttributes(r,n),r},t.getHollowRectanglePath=function(t,e,n,r,i,o,a,s){return"M"+t+","+e+"V"+(e+r)+"H"+(t+n)+"V"+e+"H"+i+"V"+o+"H"+(i+a)+"V"+(o+s)+"H"+i+"V"+e+"Z"},t}(),Bt=function(){function t(t){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+t+"_"}return Object.defineProperty(t.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(t.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(t.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),t.prototype.addClass=function(t){return void 0===this.styleSheet&&this.addStyleSheet(),t.name=""+this.classNamePrefix+t.localName,this.classes.push(t),this.styleSheet.sheet.insertRule("."+t.name+" {"+t.style+"}",this.styleSheet.sheet.cssRules.length),t},t.prototype.addRule=function(t){void 0===this.styleSheet&&this.addStyleSheet(),this.rules.push(t),this.styleSheet.sheet.insertRule(t.selector+" {"+t.style+"}",this.styleSheet.sheet.cssRules.length)},t.prototype.addStyleSheet=function(){var t;this.styleSheet=document.createElement("style"),(null!==(t=this.styleSheetRoot)&&void 0!==t?t:document.head).appendChild(this.styleSheet),this.addRule(new Ut("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Ut("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames","\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n ")),this.addRule(new Ut("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames","\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n ")),this.addClass(new Ht("_fade_in","\n animation-duration: 0.3s;\n animation-name: "+this.classNamePrefix+"_fade_in_animation_frames;\n ")),this.addClass(new Ht("_fade_out","\n animation-duration: 0.3s;\n animation-name: "+this.classNamePrefix+"_fade_out_animation_frames;\n "))},t.prototype.removeStyleSheet=function(){var t;this.styleSheet&&((null!==(t=this.styleSheetRoot)&&void 0!==t?t:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},t}(),Ut=function(t,e){this.selector=t,this.style=e},Ht=function(t,e){this.localName=t,this.style=e},zt=function(){function t(){this.blocks=[],this.display=""}return t.prototype.addButtonBlock=function(t){t.className=this.blockClassName,t.buttonClassName=this.buttonClassName,t.buttonColorsClassName=this.buttonColorsClassName,t.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(t)},t.prototype.addElementBlock=function(t){void 0===t.className&&(t.className=this.blockClassName),this.blocks.push(t)},t.prototype.getUI=function(){var t=document.createElement("div");return t.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,t.style.display=this.display,this.blocks.forEach((function(e){return t.appendChild(e.getUI())})),t},t}(),Gt=function(){function t(){}return t.prototype.getUI=function(){var t=document.createElement("div");if(t.className=this.className,void 0!==this.minWidth&&(t.style.minWidth=this.minWidth),void 0!==this.contentAlign)switch(this.contentAlign){case"start":t.style.justifyContent="flex-start";break;case"center":t.style.justifyContent="center";break;case"end":t.style.justifyContent="flex-end"}return t.style.whiteSpace="nowrap",t},t}(),Vt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.buttons=[],e}return _t(e,t),e.prototype.addButton=function(t){t.className=this.buttonClassName,t.colorsClassName=this.buttonColorsClassName,t.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(t)},e.prototype.getUI=function(){var e=t.prototype.getUI.call(this);return this.buttons.forEach((function(t){return e.appendChild(t.getUI())})),e},e}(Gt),Wt=function(){function t(t,e){this._isActive=!1,this._isHidden=!1,this._icon=t,this.title=e,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(t.prototype,"icon",{get:function(){return this._icon},set:function(t){this._icon=t,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isActive",{get:function(){return this._isActive},set:function(t){this._isActive=t,this.adjustClassName()},enumerable:!1,configurable:!0}),t.prototype.getUI=function(){var t=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 t.onClick()})),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},t.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,"")))},t.prototype.hide=function(){this._isHidden=!0},t}(),Kt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.elements=[],e}return _t(e,t),e.prototype.addElement=function(t){this.elements.push(t)},e.prototype.getUI=function(){var e=t.prototype.getUI.call(this);return this.elements.forEach((function(t){return e.appendChild(t)})),e},e}(Gt),qt=function(){function t(t,e){this.horizontal=t,this.vertical=e}return Object.defineProperty(t.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),t.prototype.getVerticalLength=function(t){return t/this.ratio},t.prototype.getHorizontalLength=function(t){return t*this.ratio},t}(),Yt=function(){function t(){}return t.getIcon=function(t,e){if(t>0&&e>0){var n=new qt(t,e),r=n.ratio>=1?20:n.getHorizontalLength(20),i=n.ratio<1?20:n.getVerticalLength(20),o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("xmlns","http://www.w3.org/2000/svg"),o.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(o);var a=Ft.createDefs();o.appendChild(a);var s=Ft.createElement("clipPath",[["id","text-bg-clip"]]);a.appendChild(s);var l=Ft.createPath(Ft.getHollowRectanglePath((24-r)/2,(24-i)/2,r,i,(24-r)/2+2,(24-i)/2+2,r-4,i-4));o.appendChild(l);var c=Ft.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);c.appendChild(Ft.createTSpan(t+":"+e)),o.appendChild(c);var u=c.getBBox();Ft.setAttributes(c,[["x",((24-u.width)/2).toString()],["y",((24-u.height)/2-u.y).toString()]]);var h=Ft.createPath(Ft.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(u.width))/2,(24-Math.ceil(u.height))/2,Math.ceil(u.width),Math.ceil(u.height)));return s.appendChild(h),Ft.setAttributes(l,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(o),o.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>'},t}(),Xt=function(t){function e(e,n,r){var i=t.call(this,e,n)||this;return i.isDropdownOpen=!1,i.onClick=i.dropdownButtonClicked,i.dropdownButtons=r,i}return _t(e,t),e.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(e){e.className=t.className,e.colorsClassName=t.colorsClassName,t.dropdownBlock.appendChild(e.getUI())})),this.uiContainer.appendChild(this.dropdownBlock)},e.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},e.prototype.dropdownButtonClicked=function(){void 0===this.dropdownBlock&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},e.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},e.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},e.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},e}(Wt),$t=function(){function t(t,e){this.GRIP_SIZE=10,this.color=t,this.fillColor=e,this.visual=Ft.createGroup(),this.visual.appendChild(Ft.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Ft.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return t.prototype.ownsTarget=function(t){return t===this.visual||t===this.visual.childNodes[0]||t===this.visual.childNodes[1]},t.prototype.setCenter=function(t,e){this.visual.childNodes.forEach((function(n){return Ft.setAttributes(n,[["cx",t.toString()],["cy",e.toString()]])}))},t}(),Zt=function(){function t(t,e,n,r){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=t,this.canvasHeight=e,this.margin=n,this.container=r,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(t.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(t){this._aspectRatio=t,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(t){this._isGridVisible=t,this.gridContainer&&Ft.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(t){this._zoomFactor=t,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),t.prototype.open=function(){var t=this;this.cropShadeElement=Ft.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=Ft.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var e=0;e<this.numberOfGridLines;e++)this.horizontalGridLines.push(Ft.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(Ft.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach((function(e){return t.gridContainer.appendChild(e)})),this.verticalGridLines.forEach((function(e){return t.gridContainer.appendChild(e)})),this.cropRectElement=Ft.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new $t(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new $t(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new $t(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new $t(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},t.prototype.setCropRectangle=function(t){this.cropRect=t;var e=Object.assign({},this.cropRect);1!==this.zoomFactor&&(e.width=this.cropRect.width*this.zoomFactor,e.height=this.cropRect.height*this.zoomFactor,e.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-e.width/2,e.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-e.height/2),Ft.setAttributes(this.cropRectElement,[["x",e.x.toString()],["y",e.y.toString()],["width",e.width.toString()],["height",e.height.toString()]]);var n=e.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach((function(t,r){var i=e.y+n*(r+1);Ft.setAttributes(t,[["x1",""+e.x],["y1",""+i],["x2",""+(e.x+e.width)],["y2",""+i]])}));var r=e.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach((function(t,n){var i=e.x+r*(n+1);Ft.setAttributes(t,[["x1",""+i],["y1",""+e.y],["x2",""+i],["y2",""+(e.y+e.height)]])})),Ft.setAttributes(this.cropShadeElement,[["d",Ft.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,e.x,e.y,e.width,e.height)]]),this.topLeftGrip.setCenter(e.x,e.y),this.topRightGrip.setCenter(e.x+e.width,e.y),this.bottomLeftGrip.setCenter(e.x,e.y+e.height),this.bottomRightGrip.setCenter(e.x+e.width,e.y+e.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},t.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)},t.prototype.clientToLocalCoordinates=function(t,e){var n=this.container.getBoundingClientRect();return{x:t-n.left+this.margin,y:e-n.top+this.margin}},t.prototype.onPointerDown=function(t){this.container.setPointerCapture(t.pointerId),this.previousPoint=this.clientToLocalCoordinates(t.clientX,t.clientY),this.cropRectElement===t.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(t.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(t.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(t.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(t.target)&&(this.activeGrip=this.bottomRightGrip)},t.prototype.onPointerMove=function(t){if(this.isMoving)this.move(this.clientToLocalCoordinates(t.clientX,t.clientY));else if(this.activeGrip){var e=this.clientToLocalCoordinates(t.clientX,t.clientY);this.resize(e)}t.preventDefault()},t.prototype.onPointerUp=function(t){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(t.pointerId)},t.prototype.move=function(t){var e=t.x-this.previousPoint.x,n=t.y-this.previousPoint.y;1!==this.zoomFactor&&(e=-e/this.zoomFactor,n=-n/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+e),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+n),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=t},t.prototype.resize=function(t){var e=Object.assign({},this.cropRect),n=t.x-this.previousPoint.x,r=t.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:e.x+n<this.margin&&(n=this.margin-e.x),e.x+=n,e.width=this.cropRect.x+this.cropRect.width-e.x;break;case this.bottomRightGrip:case this.topRightGrip:e.width+n>this.canvasWidth*this.zoomFactor&&(n=this.canvasWidth*this.zoomFactor-e.width),e.width+=n}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(e.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(n),e.height=this.aspectRatio.getVerticalLength(e.width)):(e.y+=r,e.height=this.cropRect.y+this.cropRect.height-e.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?e.height=this.aspectRatio.getVerticalLength(e.width):e.height+=r}e.width<10&&(e.x=this.cropRect.x,e.width=10),e.height<10&&(e.y=this.cropRect.y,e.height=10),this.previousPoint=t,e.x>=this.margin&&e.y>=this.margin&&e.x-this.margin+e.width<=this.canvasWidth&&e.y-this.margin+e.height<=this.canvasHeight&&(this.cropRect=e,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},t.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var t=this.cropRect.x+this.cropRect.width/2,e=this.cropRect.y+this.cropRect.height/2,n=this.aspectRatio.getHorizontalLength(this.cropRect.height),r=this.aspectRatio.getVerticalLength(this.cropRect.width);n/this.canvasWidth<r/this.canvasHeight?this.cropRect.width=n:this.cropRect.height=r,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=t-this.cropRect.width/2,this.cropRect.y=e-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)}},t.prototype.getRescaledRect=function(t,e,n,r,i,o){var a=n/t,s=r/e;return{x:(i.x-o)*a+o,y:(i.y-o)*s+o,width:i.width*a,height:i.height*s}},t.prototype.scaleCanvas=function(t,e){var n=this.getRescaledRect(this.canvasWidth,this.canvasHeight,t,e,this.cropRect,this.margin);this.canvasWidth=t,this.canvasHeight=e,this.onCropChange&&this.onCropChange(n),this.setCropRectangle(n)},t}(),Jt=function(){function t(t){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=t,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(t.prototype,"angle",{get:function(){return this._angle},set:function(t){this._angle=t,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),t.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},t.prototype.onPointerDown=function(t){this.controlContainer.setPointerCapture(t.pointerId),this.isDragging=!0,this.previousPoint={x:t.clientX,y:t.clientY}},t.prototype.onPointerMove=function(t){this.isDragging&&(this.onAngleChange&&this.onAngleChange((t.clientX-this.previousPoint.x)/5),this.previousPoint.x=t.clientX)},t.prototype.onPointerUp=function(t){this.isDragging&&this.onAngleChange&&this.onAngleChange((t.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(t.pointerId)},t.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var t=this.angleLabelText.getBBox();Ft.setAttributes(this.angleLabelElement,[["x",((this.width-t.width)/2).toString()],["y",(this.height/2).toString()]])}},t.prototype.positionScaleShape=function(){if(this.scaleShape){var t=this.scaleShape.transform.baseVal.getItem(0);t.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(t,0)}},t.prototype.getVisual=function(){var t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("width",this.width+"px"),t.setAttribute("height",this.height+"px"),t.setAttribute("viewBox","0 0 "+this.width+" "+this.height),t.style.flexShrink="0",document.body.appendChild(t);for(var e="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,n=1;n<=this.width/5+10;n++){var r=n%5==0?this.height/3:this.height/6;e+="h4v"+-r+"h1v"+r}e+="v1H0Z",this.scaleShape=Ft.createPath(e);var i=Ft.createTransform();this.scaleShape.transform.baseVal.appendItem(i),t.appendChild(this.scaleShape),this.angleLabelElement=Ft.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=Ft.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var o=Ft.createTSpan("");return o.innerHTML="&deg;",this.angleLabelElement.appendChild(o),t.appendChild(this.angleLabelElement),document.body.removeChild(t),t},t}(),Qt=function(){function t(){this.naturalSize=!1,this.imageType="image/png"}return t.prototype.rasterize=function(t,e,n,r,i,o,a){var s=this;return new Promise((function(l){var c=document.createElement("canvas");c.width=t.width.baseVal.value-2*r,c.height=t.height.baseVal.value-2*r;var u=1,h=1;!0===s.naturalSize?(u=e.naturalWidth/(t.width.baseVal.value-2*r)/o,h=e.naturalHeight/(t.height.baseVal.value-2*r)/a,c.width=e.naturalWidth/o,c.height=e.naturalHeight/a):void 0!==s.width&&void 0!==s.height&&(u=s.width/n.width,h=s.height/n.height,c.width*=u,c.height*=h);var d=c.getContext("2d");d.translate(c.width/2,c.height/2),d.rotate(i*Math.PI/180),d.scale(o,a),d.translate(-c.width/2,-c.height/2),d.drawImage(e,0,0,c.width,c.height);var f=document.createElement("canvas");f.width=n.width*u,f.height=n.height*h,f.getContext("2d").putImageData(d.getImageData((n.x-r)*u,(n.y-r)*h,n.width*u,n.height*h),0,0),l(f.toDataURL(s.imageType,s.imageQuality))}))},t}(),te=function(){function t(e){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=t.instanceCounter++,this.styles=new Bt(this.instanceNo),this.target=e,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(t.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(t){this._zoomToCropEnabled=t,t?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(t){this._isGridVisible=t,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"gridLines",{get:function(){return this._gridLines},set:function(t){this._gridLines=t,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(t){this._rotationAngle=t,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"aspectRatio",{get:function(){var t;return null!==(t=this._aspectRatio)&&void 0!==t?t:this.aspectRatios[0]},set:function(t){this._aspectRatio=t},enumerable:!1,configurable:!0}),t.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(),"popup"===this.displayMode&&this.onPopupResize(),this._isOpen=!0},t.prototype.show=function(){this.showUI(),this.open()},t.prototype.close=function(t){void 0===t&&(t=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),"popup"===this.displayMode&&window.removeEventListener("resize",this.setWindowHeight),t||this.closeEventListeners.forEach((function(t){return t()})),this._isOpen=!1)},t.prototype.addRenderEventListener=function(t){this.renderEventListeners.push(t)},t.prototype.removeRenderEventListener=function(t){this.renderEventListeners.indexOf(t)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(t),1)},t.prototype.addCloseEventListener=function(t){this.closeEventListeners.push(t)},t.prototype.removeCloseEventListener=function(t){this.closeEventListeners.indexOf(t)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(t),1)},t.prototype.setupResizeObserver=function(){var t=this;"inline"===this.displayMode?window.ResizeObserver&&(this.targetObserver=new ResizeObserver((function(){t.resize(t.target.clientWidth,t.target.clientHeight)})),this.targetObserver.observe(this.target)):"popup"===this.displayMode&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},t.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var t=1*this.target.clientWidth/this.target.clientHeight,e=this.contentDiv.clientWidth/t>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*t:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,n=e+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/t;this.resize(e,n)}},t.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},t.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",Ft.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},t.prototype.resize=function(t,e){this.imageWidth=Math.round(t),this.imageHeight=Math.round(e),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","popup"!==this.displayMode?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},t.prototype.setEditingTarget=function(){var t=document.createElement("canvas");t.width=this.target.naturalWidth,t.height=this.target.naturalHeight,t.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var e=t.toDataURL();Ft.setAttributes(this.editingTarget,[["href",e]]),this.setEditingTargetSize()},t.prototype.setTopLeft=function(){var t=this.target.getBoundingClientRect(),e=this.editorCanvas.getBoundingClientRect();this.left=t.left-e.left-this.CANVAS_MARGIN,this.top=t.top-e.top-this.CANVAS_MARGIN},t.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=Ft.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=Ft.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=Ft.createGroup(),this.editingTargetRotationScaleContainer=Ft.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var t=Ft.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(t);var e=Ft.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(e),this.editingTargetContainer=Ft.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)},t.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},t.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=Ft.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Zt(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()},t.prototype.zoomToCrop=function(){if(this.cropRect){var t=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,e=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=t+"px "+e+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-t+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-e+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},t.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)},t.prototype.cropRectChanged=function(t){this.cropRect=t,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},t.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},t.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"},t.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},t.prototype.showUI=function(){switch(this.addStyles(),"popup"===this.displayMode&&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 t=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,e=this.target.offsetTop>t+this.CANVAS_MARGIN?this.target.offsetTop-(t+this.CANVAS_MARGIN):0;this.coverDiv.style.top=e+"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=void 0!==this.styles.settings.zIndex?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=void 0!==this.styles.settings.zIndex?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="popup"===this.displayMode?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,"popup"===this.displayMode&&(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","popup"===this.displayMode&&(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},t.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},t.prototype.addTopToolbar=function(){var t=this;this.topToolbar=new zt,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 e=new Vt;e.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(e);var n=[];this.aspectRatios.forEach((function(e){var r=new Wt(Yt.getIcon(e.horizontal,e.vertical),0===e.horizontal&&0===e.vertical?"FREE":e.horizontal+":"+e.vertical);r.onClick=function(){return t.ratioButtonClicked(e)},n.push(r)})),this.aspectRatioButton=new Xt(Yt.getIcon(0,0),"Aspect ratio",n),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,e.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var r=new Wt('<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");r.isActive=this.isGridVisible,r.onClick=function(){t.isGridVisible=!t.isGridVisible,r.isActive=t.isGridVisible},e.addButton(r);var i=new Wt('<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(i.isActive=this.zoomToCropEnabled,i.onClick=function(){t.zoomToCropEnabled=!t.zoomToCropEnabled,i.isActive=t.zoomToCropEnabled},e.addButton(i),!jt.isLicensed){var o=new Kt;this.topToolbar.addElementBlock(o);var a=document.createElement("div");a.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var s=document.createElement("a");s.style.color="currentColor",s.href="https://markerjs.com/products/cropro",s.target="_blank",s.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>',a.appendChild(s),o.addElement(a)}var l=new Vt;l.minWidth=3*this.toolbarHeight+"px",l.contentAlign="end",this.topToolbar.addButtonBlock(l);var c=new Wt('<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");c.onClick=this.startRenderAndClose,l.addButton(c),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(c.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var u=new Wt('<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");u.onClick=this.close,l.addButton(u),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(u.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},t.prototype.addBottomToolbar=function(){var t=this;this.bottomToolbar=new zt,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 e=new Vt;e.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(e);var n=new Wt('<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");n.onClick=this.rotateLeftButtonClicked,e.addButton(n);var r=new Wt('<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");r.onClick=this.rotateRightButtonClicked,e.addButton(r);var i=new Kt;i.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(i),this.straightener=new Jt("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(e){t.rotateBy(e),t.straightener.angle=t.rotationAngle},i.addElement(this.straightener.getUI());var o=new Vt;o.minWidth=2*this.toolbarHeight+"px",o.contentAlign="end",this.bottomToolbar.addButtonBlock(o);var a=new Wt('<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");a.onClick=this.flipHorizontallyButtonClicked,o.addButton(a);var s=new Wt('<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");s.onClick=this.flipVerticallyButtonClicked,o.addButton(s)},t.prototype.ratioButtonClicked=function(t){this.aspectRatio=t,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},t.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Yt.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},t.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&0!==this.aspectRatio.horizontal&&0!==this.aspectRatio.vertical?this.cropLayer.aspectRatio=new qt(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},t.prototype.closeUI=function(){"popup"===this.displayMode&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},t.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},t.prototype.restoreState=function(t){if(t){var e=this.cropLayer.getRescaledRect(t.width,t.height,this.imageWidth,this.imageHeight,t.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(e),this.cropRectChanged(e),this.flippedHorizontally=t.flippedHorizontally,this.flippedVertically=t.flippedVertically,this.applyFlip(),this.rotationAngle=t.rotationAngle,this.applyRotation()}},t.prototype.clientToLocalCoordinates=function(t,e){var n=this.cropImage.getBoundingClientRect();return{x:t-n.left,y:e-n.top}},t.prototype.onWindowResize=function(){this.positionUI()},t.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var t=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=t+"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()},t.prototype.rotateLeftButtonClicked=function(){var t=this.rotationAngle-90;this.rotationAngle%90!=0&&(t+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(t)},t.prototype.rotateRightButtonClicked=function(){var t=this.rotationAngle+90;this.rotationAngle%90!=0&&(t-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(t)},t.prototype.rotateTo=function(t){t=(t=t>180?t-360:t)<=-180?t+360:t,this.rotationAngle=t,this.applyRotation()},t.prototype.rotateBy=function(t){this.rotateTo((this.rotationAngle+t)%360)},t.prototype.applyRotation=function(){var t=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var e=this.editingTargetRotationContainer.transform.baseVal.getItem(0);e.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(e,0);var n=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/n.width,this.imageHeight/n.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=t},t.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},t.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},t.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},t.prototype.startRenderAndClose=function(){return Pt(this,void 0,void 0,(function(){var t,e;return Nt(this,(function(n){switch(n.label){case 0:return[4,this.render()];case 1:return t=n.sent(),e=this.getState(),this.renderEventListeners.forEach((function(n){return n(t,e)})),this.close(!0),[2]}}))}))},t.prototype.render=function(){return Pt(this,void 0,void 0,(function(){var t;return Nt(this,(function(e){switch(e.label){case 0:return(t=new Qt).naturalSize=this.renderAtNaturalSize,t.imageType=this.renderImageType,t.imageQuality=this.renderImageQuality,t.width=this.renderWidth,t.height=this.renderHeight,this.unzoomFromCrop(),Ft.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,t.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 e.sent(),[4,t.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,e.sent()]}}))}))},t.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Ht("toolbar","\n width: "+("inline"===this.displayMode?"100%":"calc(100vw - "+2*this.popupMargin+"px)")+";\n flex-shrink: 0;\n display: flex;\n flex-direction: row;\n justify-content: space-between; \n height: "+this.toolbarHeight+"px;\n box-sizing: content-box;\n overflow: hidden;\n line-height: 0px;\n ")),this.toolbarStyleColorsClass=this.styles.addClass(new Ht("toolbar_colors","\n background-color: "+this.styles.settings.toolbarBackgroundColor+";\n ")),this.toolbarBlockStyleClass=this.styles.addClass(new Ht("toolbar-block","\n display: flex;\n align-items: center;\n box-sizing: content-box;\n "));var t=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Ht("toolbar_button","\n display: inline-block;\n width: "+(this.toolbarHeight-2*t)+"px;\n height: "+(this.toolbarHeight-2*t)+"px;\n padding: "+t+"px;\n cursor: default;\n user-select: none;\n box-sizing: content-box;\n ")),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Ht("toolbar_button_colors","\n color: "+this.styles.settings.toolbarColor+";\n fill: currentColor;\n ")),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Ht("toolbar_active_button","\n color: "+this.styles.settings.toolbarColor+";\n fill: currentColor;\n background-color: "+this.styles.settings.toolbarBackgroundActiveColor+"\n ")),this.styles.addRule(new Ut("."+this.toolbarButtonStyleClass.name+" svg","\n height: "+this.toolbarHeight/2+"px;\n ")),this.styles.addRule(new Ut("."+this.toolbarButtonStyleColorsClass.name+":hover","\n background-color: "+this.styles.settings.toolbarBackgroundHoverColor+"\n ")),this.toolbarDropdownStyleClass=this.styles.addClass(new Ht("toolbar_dropdown","\n position: absolute;\n max-width: "+4*this.toolbarHeight+"px;\n z-index: 20;\n white-space: normal;\n box-sizing: content-box;\n box-shadow: 3px 3px rgba(33, 33, 33, 0.1);\n margin: "+("inline"===this.displayMode?"0":this.popupMargin)+"px;\n line-height: 0px;\n ")),this.toolbarDropdownStyleColorsClass=this.styles.addClass(new Ht("toolbar_dropdown_colors","\n background-color: "+this.styles.settings.toolbarBackgroundColor+";\n ")),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Ht("toolbar_straightener_block","\n display: flex;\n overflow: hidden;\n justify-content: center;\n -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%);\n ")),this.toolbarStraightenerStyleClass=this.styles.addClass(new Ht("toolbar_straightener","\n display: flex;\n overflow: hidden;\n justify-content: center;\n height: "+(this.toolbarHeight-2*t)+"px;\n padding: "+t+"px;\n cursor: default;\n user-select: none;\n box-sizing: content-box;\n ")),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Ht("toolbar_straightener_colors","\n color: "+this.styles.settings.toolbarColor+";\n fill: currentColor;\n "))},t.instanceCounter=0,t}(),ee=n("8hTe"),ne=n.n(ee),re=/<pre[^>]*>/g;e.a=function(t){var e=t.value,n=void 0===e?"":e,l=t.edit,d=void 0!==l&&l,f=t.className,p=t.showTextOnly,g=t.showLines,m=t.replaces,v=t.zoomImg,y=t.hasMask,S=t.style,E=void 0===S?{}:S,k=t.stylesPrev,w=void 0===k?{}:k,L=String(n),A=Object(u.useRef)(),D=Object(u.useRef)(),R=Object(u.useState)(""),I=Object(s.a)(R,2),B=I[0],U=I[1],H=Object(u.useState)("office"),z=Object(s.a)(H,2),G=z[0],V=z[1],W=Object(u.useMemo)((function(){try{L=(L=L.replace(/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,"("+P.a.API_SERVER+"/api/attachments/").replace(/\"\/api\/attachments\/|\"\/attachments\/download\//g,'"'+P.a.API_SERVER+"/api/attachments/").replace(/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g,'"'+P.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,"\n")).replace(new RegExp("(?<!\\n)\\n(?!\\n)","g")," \n")}catch(t){}var t=M(L),e=T;if(L.match(/\[TOC\]/)&&(t=t.replace("<p>[TOC]</p>",C()),b()),t=(t=t.replace(/(__special_katext_id_\d+__)/g,(function(t,n){var r=e[n],i=r.type,o=r.expression;return Object(N.renderToString)(function(t){var e=document.createElement("div");return e.innerHTML=t,0===e.childNodes.length?"":e.childNodes[0].nodeValue}(o)||"",{displayMode:"block"===i,throwOnError:!1,output:"html"})}))).replace(/▁/g,"▁▁▁"),O(),p){var n=document.createElement("div");return n.innerHTML=t,n.innerText}return setTimeout((function(){return Y()}),500),t}),[L]),K=Object(u.useRef)();function q(t){var e=t.target;if("IMG"===e.tagName.toUpperCase()){if(v){var n=e.getAttribute("src");U(n),V("image")}}else if("A"===e.tagName.toUpperCase()){var r=e.getAttribute("href");if(r.indexOf("office")>-1)t.preventDefault(),U(r),V("office");else if(r.indexOf("application/pdf")>-1)t.preventDefault(),U(r),V("pdf");else if(r.indexOf("type=text")>-1)t.preventDefault(),U(r),V("html");else if(r.startsWith("#")){t.preventDefault();var i=document.getElementById(r.replace("#",""));i&&i.scrollIntoView(!0)}}}x.WebkitLineClamp=g,g&&(E=Object(o.a)(Object(o.a)({},E),x));var Y=function(){var t,e=null===(t=K.current)||void 0===t?void 0:t.querySelectorAll("video");null==e||e.forEach((function(t){if(t.oncontextmenu=function(){return!1},t.src.indexOf(".m3u8")>-1)if(t.canPlayType("application/vnd.apple.mpegurl"));else if(_.a.isSupported()){var e=new _.a;e.loadSource(t.src),e.attachMedia(t)}}))};Object(u.useEffect)((function(){if(K.current&&W&&W.match(re)&&window.PR.prettyPrint(),K.current)return K.current.addEventListener("click",q),function(){K.current.removeEventListener("click",q),O(),b()}}),[W,K.current,q]);return h.a.createElement("div",{style:{position:"relative"}},h.a.createElement("div",{ref:K,style:Object(o.a)({},E),className:"".concat(f||""," markdown-body ").concat(ne.a.mdBody),onMouseOver:function(t){d&&("IMG"===t.target.nodeName?(A.current.style.display="flex",A.current.style.width=t.target.clientWidth+"px",A.current.style.height=t.target.clientHeight+"px",A.current.style.top=t.target.offsetTop+"px",A.current.style.left=t.target.offsetLeft+"px",D.current.src=t.target.getAttribute("src")):A.current.style.display="none")},dangerouslySetInnerHTML:{__html:W}}),h.a.createElement("div",{ref:A,className:ne.a.button},h.a.createElement(r.a,null,h.a.createElement(i.a,{onClick:function(){return(t=new te(D.current)).displayMode="popup",t.addRenderEventListener(function(){var t=Object(a.a)(c.a.mark((function t(e){var n;return c.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return A.current.style.display="none",t.next=3,Object(F.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:e}});case 3:null!=(n=t.sent)&&n.id&&m(D.current.getAttribute("src").replace(P.a.API_SERVER,""),"/api/attachments/".concat(null==n?void 0:n.id,"?type=").concat(n.content_type));case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),void t.show();var t}},"裁剪"),h.a.createElement(i.a,{onClick:function(){return(t=new Mt(D.current)).settings.displayMode="popup",t.addEventListener("render",function(){var t=Object(a.a)(c.a.mark((function t(e){var n;return c.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(A.current.style.display="none",!D.current){t.next=6;break}return t.next=4,Object(F.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:e.dataUrl}});case 4:null!=(n=t.sent)&&n.id&&m(D.current.getAttribute("src").replace(P.a.API_SERVER,""),"/api/attachments/".concat(null==n?void 0:n.id,"?type=").concat(n.content_type));case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),t.show(),void(window.markerArea=t);var t}},"编辑"))),h.a.createElement("img",{ref:D,src:"https://ali-cdn.educoder.net/images/avatars/PortalImage/170?t=1659681136",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),h.a.createElement(j.a,{close:!0,data:B,hasMask:y,type:null!=B&&B.length?G:"",style:Object(o.a)({},w),onClose:function(){return U("")}}))}},"9VGf":
/*!****************************************!*\
!*** ./src/components/useInterval.tsx ***!
\****************************************/
/*! exports provided: default */
/*! exports used: default */function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(/*! react */"q1tI");function i(t,e){var n=Object(r.useRef)();Object(r.useEffect)((function(){n.current=t})),Object(r.useEffect)((function(){if(null!==e){var t=setInterval((function(){n.current()}),e);return function(){return clearInterval(t)}}}),[e])}},BU3w:
/*!***************************************************!*\
!*** ./node_modules/rc-util/es/Dom/dynamicCSS.js ***!
\***************************************************/
/*! exports provided: injectCSS, updateCSS */
/*! exports used: updateCSS */function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var r=n(/*! ./canUseDom */"MNnm");function i(t){return t.attachTo?t.attachTo:document.querySelector("head")||document.body}function o(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Object(r.a)())return null;var o,a=document.createElement("style");(null===(e=n.csp)||void 0===e?void 0:e.nonce)&&(a.nonce=null===(o=n.csp)||void 0===o?void 0:o.nonce);a.innerHTML=t;var s=i(n),l=s.firstChild;return n.prepend&&s.prepend?s.prepend(a):n.prepend&&l?s.insertBefore(a,l):s.appendChild(a),a}var a=new Map;function s(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=i(n);if(!a.has(r)){var s=o("",n),l=s.parentNode;a.set(r,l),l.removeChild(s)}var c=Array.from(a.get(r).children).find((function(t){return"STYLE"===t.tagName&&t["rc-util-key"]===e}));if(c){var u,h,d;if((null===(u=n.csp)||void 0===u?void 0:u.nonce)&&c.nonce!==(null===(h=n.csp)||void 0===h?void 0:h.nonce))c.nonce=null===(d=n.csp)||void 0===d?void 0:d.nonce;return c.innerHTML!==t&&(c.innerHTML=t),c}var f=o(t,n);return f["rc-util-key"]=e,f}},Bd2K:
/*!********************************************************!*\
!*** ./node_modules/codemirror/addon/edit/closetag.js ***!
\********************************************************/
/*! no static exports found */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){!function(t){t.defineOption("autoCloseTags",!1,(function(a,s,l){if(l!=t.Init&&l&&a.removeKeyMap("autoCloseTags"),s){var c={name:"autoCloseTags"};"object"==typeof s&&!1===s.whenClosing||(c["'/'"]=function(e){return function(e){return e.getOption("disableInput")?t.Pass:r(e,!0)}(e)}),"object"==typeof s&&!1===s.whenOpening||(c["'>'"]=function(r){return function(r){if(r.getOption("disableInput"))return t.Pass;for(var a=r.listSelections(),s=[],l=r.getOption("autoCloseTags"),c=0;c<a.length;c++){if(!a[c].empty())return t.Pass;var u=a[c].head,h=r.getTokenAt(u),d=t.innerMode(r.getMode(),h.state),f=d.state,p=d.mode.xmlCurrentTag&&d.mode.xmlCurrentTag(f),g=p&&p.name;if(!g)return t.Pass;var m="html"==d.mode.configuration,v="object"==typeof l&&l.dontCloseTags||m&&e,y="object"==typeof l&&l.indentTags||m&&n;h.end>u.ch&&(g=g.slice(0,g.length-h.end+u.ch));var b=g.toLowerCase();if(!g||"string"==h.type&&(h.end!=u.ch||!/[\"\']/.test(h.string.charAt(h.string.length-1))||1==h.string.length)||"tag"==h.type&&p.close||h.string.indexOf("/")==u.ch-h.start-1||v&&i(v,b)>-1||o(r,d.mode.xmlCurrentContext&&d.mode.xmlCurrentContext(f)||[],g,u,!0))return t.Pass;var x="object"==typeof l&&l.emptyTags;if(x&&i(x,g)>-1)s[c]={text:"/>",newPos:t.Pos(u.line,u.ch+2)};else{var C=y&&i(y,b)>-1;s[c]={indent:C,text:">"+(C?"\n\n":"")+"</"+g+">",newPos:C?t.Pos(u.line+1,0):t.Pos(u.line,u.ch+1)}}}var S="object"==typeof l&&l.dontIndentOnAutoClose;for(c=a.length-1;c>=0;c--){var E=s[c];r.replaceRange(E.text,a[c].head,a[c].anchor,"+insert");var k=r.listSelections().slice(0);k[c]={head:E.newPos,anchor:E.newPos},r.setSelections(k),!S&&E.indent&&(r.indentLine(E.newPos.line,null,!0),r.indentLine(E.newPos.line+1,null,!0))}}(r)}),a.addKeyMap(c)}}));var e=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],n=["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 r(e,n){for(var r=e.listSelections(),i=[],a=n?"/":"</",s=e.getOption("autoCloseTags"),l="object"==typeof s&&s.dontIndentOnSlash,c=0;c<r.length;c++){if(!r[c].empty())return t.Pass;var u=r[c].head,h=e.getTokenAt(u),d=t.innerMode(e.getMode(),h.state),f=d.state;if(n&&("string"==h.type||"<"!=h.string.charAt(0)||h.start!=u.ch-1))return t.Pass;var p,g="xml"!=d.mode.name&&"htmlmixed"==e.getMode().name;if(g&&"javascript"==d.mode.name)p=a+"script";else if(g&&"css"==d.mode.name)p=a+"style";else{var m=d.mode.xmlCurrentContext&&d.mode.xmlCurrentContext(f);if(!m||m.length&&o(e,m,m[m.length-1],u))return t.Pass;p=a+m[m.length-1]}">"!=e.getLine(u.line).charAt(h.end)&&(p+=">"),i[c]=p}if(e.replaceSelections(i),r=e.listSelections(),!l)for(c=0;c<r.length;c++)(c==r.length-1||r[c].head.line<r[c+1].head.line)&&e.indentLine(r[c].head.line)}function i(t,e){if(t.indexOf)return t.indexOf(e);for(var n=0,r=t.length;n<r;++n)if(t[n]==e)return n;return-1}function o(e,n,r,i,o){if(!t.scanForClosingTag)return!1;var a=Math.min(e.lastLine()+1,i.line+500),s=t.scanForClosingTag(e,i,null,a);if(!s||s.tag!=r)return!1;for(var l=o?1:0,c=n.length-1;c>=0&&n[c]==r;c--)++l;for(i=s.to,c=1;c<l;c++){var u=t.scanForClosingTag(e,i,null,a);if(!u||u.tag!=r)return!1;i=u.to}return!0}t.commands.closeTag=function(t){return r(t)}}(n(/*! ../../lib/codemirror */"VrN/"),n(/*! ../fold/xml-fold */"osHv"))},BjJ7:
/*!*********************************!*\
!*** ./src/pages/tasks/util.js ***!
\*********************************/
/*! exports provided: isCompileOk, getTreeData, processTreeData, debounce, isProd, apiPref */
/*! exports used: apiPref, debounce, getTreeData, isCompileOk, processTreeData */function(t,e,n){"use strict";function r(t){var e=!0;if(t.length>0){for(var n=0;n<t.length;n++)if(0==t[n].compile_success||!t[n].compile_success){e=!1;break}}else e=!1;return e}function i(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=[],r=0;r<t.length;r++){var i=t[r],o=e?"".concat(e,"/").concat(i.name):"".concat(i.name);n.push({title:i.name,isLeaf:"tree"!==i.type,key:o})}return n}function o(t,e,n){for(var r=0;r<t.length;r++){var i=t[r];if(i.key===e){i.children=n;break}i.children&&o(i.children,e,n)}return t}function a(t,e,n){var r;return function(){var i=this,o=arguments,a=function(){r=null,n||t.apply(i,o)},s=n&&!r;clearTimeout(r),r=setTimeout(a,e),s&&t.apply(i,o)}}n.d(e,"d",(function(){return r})),n.d(e,"c",(function(){return i})),n.d(e,"e",(function(){return o})),n.d(e,"b",(function(){return a})),n.d(e,"a",(function(){return s}));var s=n(/*! @/utils/env */"m3rI").a.API_SERVER},"C+DQ":
/*!*********************************************************!*\
!*** ./src/components/markdown-editor/css/iconfont.css ***!
\*********************************************************/
/*! no static exports found */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){},D1Df:
/*!************************************************!*\
!*** ./node_modules/qrcode.react/lib/index.js ***!
\************************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(){return(i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function a(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?o(n,!0).forEach((function(e){m(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o(n).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function s(t,e){if(null==t)return{};var n,r,i=function(t,e){if(null==t)return{};var n,r,i={},o=Object.keys(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function u(t,e,n){return e&&c(t.prototype,e),n&&c(t,n),t}function h(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?f(t):e}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function f(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function p(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&g(t,e)}function g(t,e){return(g=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function m(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var v=n(/*! react */"q1tI"),y=(n(/*! prop-types */"17x9"),n(/*! qr.js/lib/QRCode */"H38U")),b=n(/*! qr.js/lib/ErrorCorrectLevel */"aRTE");function x(t){for(var e="",n=0;n<t.length;n++){var r=t.charCodeAt(n);r<128?e+=String.fromCharCode(r):r<2048?(e+=String.fromCharCode(192|r>>6),e+=String.fromCharCode(128|63&r)):r<55296||r>=57344?(e+=String.fromCharCode(224|r>>12),e+=String.fromCharCode(128|r>>6&63),e+=String.fromCharCode(128|63&r)):(n++,r=65536+((1023&r)<<10|1023&t.charCodeAt(n)),e+=String.fromCharCode(240|r>>18),e+=String.fromCharCode(128|r>>12&63),e+=String.fromCharCode(128|r>>6&63),e+=String.fromCharCode(128|63&r))}return e}var C={size:128,level:"L",bgColor:"#FFFFFF",fgColor:"#000000",includeMargin:!1};function S(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=[];return t.forEach((function(t,r){var i=null;t.forEach((function(o,a){if(!o&&null!==i)return n.push("M".concat(i+e," ").concat(r+e,"h").concat(a-i,"v1H").concat(i+e,"z")),void(i=null);if(a!==t.length-1)o&&null===i&&(i=a);else{if(!o)return;null===i?n.push("M".concat(a+e,",").concat(r+e," h1v1H").concat(a+e,"z")):n.push("M".concat(i+e,",").concat(r+e," h").concat(a+1-i,"v1H").concat(i+e,"z"))}}))})),n.join("")}function E(t,e){return t.slice().map((function(t,n){return n<e.y||n>=e.y+e.h?t:t.map((function(t,n){return(n<e.x||n>=e.x+e.w)&&t}))}))}function k(t,e){var n=t.imageSettings,r=t.size,i=t.includeMargin;if(null==n)return null;var o=i?4:0,a=e.length+2*o,s=Math.floor(.1*r),l=a/r,c=(n.width||s)*l,u=(n.height||s)*l,h=null==n.x?e.length/2-c/2:n.x*l,d=null==n.y?e.length/2-u/2:n.y*l,f=null;if(n.excavate){var p=Math.floor(h),g=Math.floor(d);f={x:p,y:g,w:Math.ceil(c+h-p),h:Math.ceil(u+d-g)}}return{x:h,y:d,h:u,w:c,excavation:f}}var w=function(){try{(new Path2D).addPath(new Path2D)}catch(t){return!1}return!0}(),T=function(t){function e(){var t,n;l(this,e);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return m(f(n=h(this,(t=d(e)).call.apply(t,[this].concat(i)))),"_canvas",void 0),m(f(n),"_image",void 0),m(f(n),"state",{imgLoaded:!1}),m(f(n),"handleImageLoad",(function(){n.setState({imgLoaded:!0})})),n}return p(e,t),u(e,[{key:"componentDidMount",value:function(){this.update()}},{key:"componentDidUpdate",value:function(){this.update()}},{key:"update",value:function(){var t=this.props,e=t.value,n=t.size,r=t.level,i=t.bgColor,o=t.fgColor,a=t.includeMargin,s=t.imageSettings,l=new y(-1,b[r]);if(l.addData(x(e)),l.make(),null!=this._canvas){var c=this._canvas,u=c.getContext("2d");if(!u)return;var h=l.modules;if(null===h)return;var d=a?4:0,f=h.length+2*d,p=k(this.props,h);null!=s&&null!=p&&null!=p.excavation&&(h=E(h,p.excavation));var g=window.devicePixelRatio||1;c.height=c.width=n*g;var m=n/f*g;u.scale(m,m),u.fillStyle=i,u.fillRect(0,0,f,f),u.fillStyle=o,w?u.fill(new Path2D(S(h,d))):h.forEach((function(t,e){t.forEach((function(t,n){t&&u.fillRect(n+d,e+d,1,1)}))})),this.state.imgLoaded&&this._image&&null!=p&&u.drawImage(this._image,p.x+d,p.y+d,p.w,p.h)}}},{key:"render",value:function(){var t=this,e=this.props,n=(e.value,e.size),r=(e.level,e.bgColor,e.fgColor,e.style),o=(e.includeMargin,e.imageSettings),l=s(e,["value","size","level","bgColor","fgColor","style","includeMargin","imageSettings"]),c=a({height:n,width:n},r),u=null,h=o&&o.src;return null!=o&&null!=h&&(u=v.createElement("img",{src:h,style:{display:"none"},onLoad:this.handleImageLoad,ref:function(e){return t._image=e}})),v.createElement(v.Fragment,null,v.createElement("canvas",i({style:c,height:n,width:n,ref:function(e){return t._canvas=e}},l)),u)}}]),e}(v.PureComponent);m(T,"defaultProps",C);var O=function(t){function e(){return l(this,e),h(this,d(e).apply(this,arguments))}return p(e,t),u(e,[{key:"render",value:function(){var t=this.props,e=t.value,n=t.size,r=t.level,o=t.bgColor,a=t.fgColor,l=t.includeMargin,c=t.imageSettings,u=s(t,["value","size","level","bgColor","fgColor","includeMargin","imageSettings"]),h=new y(-1,b[r]);h.addData(x(e)),h.make();var d=h.modules;if(null===d)return null;var f=l?4:0,p=d.length+2*f,g=k(this.props,d),m=null;null!=c&&null!=g&&(null!=g.excavation&&(d=E(d,g.excavation)),m=v.createElement("image",{xlinkHref:c.src,height:g.h,width:g.w,x:g.x+f,y:g.y+f,preserveAspectRatio:"none"}));var C=S(d,f);return v.createElement("svg",i({shapeRendering:"crispEdges",height:n,width:n,viewBox:"0 0 ".concat(p," ").concat(p)},u),v.createElement("path",{fill:o,d:"M0,0 h".concat(p,"v").concat(p,"H0z")}),v.createElement("path",{fill:a,d:C}),m)}}]),e}(v.PureComponent);m(O,"defaultProps",C);var L=function(t){var e=t.renderAs,n=s(t,["renderAs"]),r="svg"===e?O:T;return v.createElement(r,n)};L.defaultProps=a({renderAs:"canvas"},C),t.exports=L},DlQD:
/*!*******************************************!*\
!*** ./node_modules/marked/lib/marked.js ***!
\*******************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){t.exports=function(){"use strict";function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function e(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function n(t,n){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,n){if(t){if("string"==typeof t)return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,n):void 0}}(t))||n&&t&&"number"==typeof t.length){r&&(t=r);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=t[Symbol.iterator]()).next.bind(r)}var r=function(t,e){return t(e={exports:{}},e.exports),e.exports}((function(t){function e(){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}}t.exports={defaults:{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},getDefaults:e,changeDefaults:function(e){t.exports.defaults=e}}})),i=(r.defaults,r.getDefaults,r.changeDefaults,/[&<>"']/),o=/[&<>"']/g,a=/[<>"']|&(?!#?\w+;)/,s=/[<>"']|&(?!#?\w+;)/g,l={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},c=function(t){return l[t]},u=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function h(t){return t.replace(u,(function(t,e){return"colon"===(e=e.toLowerCase())?":":"#"===e.charAt(0)?"x"===e.charAt(1)?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1)):""}))}var d=/(^|[^\[])\^/g,f=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i,g={},m=/^[^:]+:\/*[^/]*$/,v=/^([^:]+:)[\s\S]*$/,y=/^([^:]+:\/*[^/]*)[\s\S]*$/;function b(t,e){g[" "+t]||(m.test(t)?g[" "+t]=t+"/":g[" "+t]=x(t,"/",!0));var n=-1===(t=g[" "+t]).indexOf(":");return"//"===e.substring(0,2)?n?e:t.replace(v,"$1")+e:"/"===e.charAt(0)?n?e:t.replace(y,"$1")+e:t+e}function x(t,e,n){var r=t.length;if(0===r)return"";for(var i=0;i<r;){var o=t.charAt(r-i-1);if(o!==e||n){if(o===e||!n)break;i++}else i++}return t.substr(0,r-i)}var C=function(t,e){if(e){if(i.test(t))return t.replace(o,c)}else if(a.test(t))return t.replace(s,c);return t},S=h,E=function(t,e){t=t.source||t,e=e||"";var n={replace:function(e,r){return r=(r=r.source||r).replace(d,"$1"),t=t.replace(e,r),n},getRegex:function(){return new RegExp(t,e)}};return n},k=function(t,e,n){if(t){var r;try{r=decodeURIComponent(h(n)).replace(f,"").toLowerCase()}catch(t){return null}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:")||0===r.indexOf("data:"))return null}e&&!p.test(n)&&(n=b(e,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch(t){return null}return n},w={exec:function(){}},T=function(t){for(var e,n,r=1;r<arguments.length;r++)for(n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},O=function(t,e){var n=t.replace(/\|/g,(function(t,e,n){for(var r=!1,i=e;--i>=0&&"\\"===n[i];)r=!r;return r?"|":" |"})).split(/ \|/),r=0;if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(/\\\|/g,"|");return n},L=x,A=function(t,e){if(-1===t.indexOf(e[1]))return-1;for(var n=t.length,r=0,i=0;i<n;i++)if("\\"===t[i])i++;else if(t[i]===e[0])r++;else if(t[i]===e[1]&&--r<0)return i;return-1},D=function(t){t&&t.sanitize&&!t.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")},R=r.defaults,M=L,I=O,_=C,P=A;function N(t,e,n){var r=e.href,i=e.title?_(e.title):null,o=t[1].replace(/\\([\[\]])/g,"$1");return"!"!==t[0].charAt(0)?{type:"link",raw:n,href:r,title:i,text:o}:{type:"image",raw:n,href:r,title:i,text:_(o)}}var j=function(){function t(t){this.options=t||R}var e=t.prototype;return e.space=function(t){var e=this.rules.block.newline.exec(t);if(e)return e[0].length>1?{type:"space",raw:e[0]}:{raw:"\n"}},e.code=function(t,e){var n=this.rules.block.code.exec(t);if(n){var r=e[e.length-1];if(r&&"paragraph"===r.type)return{raw:n[0],text:n[0].trimRight()};var i=n[0].replace(/^ {4}/gm,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?i:M(i,"\n")}}},e.fences=function(t){var e=this.rules.block.fences.exec(t);if(e){var n=e[0],r=function(t,e){var n=t.match(/^(\s+)(?:```)/);if(null===n)return e;var r=n[1];return e.split("\n").map((function(t){var e=t.match(/^\s+/);return null===e?t:e[0].length>=r.length?t.slice(r.length):t})).join("\n")}(n,e[3]||"");return{type:"code",raw:n,lang:e[2]?e[2].trim():e[2],text:r}}},e.heading=function(t){var e=this.rules.block.heading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[1].length,text:e[2]}},e.nptable=function(t){var e=this.rules.block.nptable.exec(t);if(e){var n={type:"table",header:I(e[1].replace(/^ *| *\| *$/g,"")),align:e[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:e[3]?e[3].replace(/\n$/,"").split("\n"):[],raw:e[0]};if(n.header.length===n.align.length){var r,i=n.align.length;for(r=0;r<i;r++)/^ *-+: *$/.test(n.align[r])?n.align[r]="right":/^ *:-+: *$/.test(n.align[r])?n.align[r]="center":/^ *:-+ *$/.test(n.align[r])?n.align[r]="left":n.align[r]=null;for(i=n.cells.length,r=0;r<i;r++)n.cells[r]=I(n.cells[r],n.header.length);return n}}},e.hr=function(t){var e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:e[0]}},e.blockquote=function(t){var e=this.rules.block.blockquote.exec(t);if(e){var n=e[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:e[0],text:n}}},e.list=function(t){var e=this.rules.block.list.exec(t);if(e){for(var n,r,i,o,a,s,l,c=e[0],u=e[2],h=u.length>1,d=")"===u[u.length-1],f={type:"list",raw:c,ordered:h,start:h?+u.slice(0,-1):"",loose:!1,items:[]},p=e[0].match(this.rules.block.item),g=!1,m=p.length,v=0;v<m;v++)c=n=p[v],r=n.length,~(n=n.replace(/^ *([*+-]|\d+[.)]) */,"")).indexOf("\n ")&&(r-=n.length,n=this.options.pedantic?n.replace(/^ {1,4}/gm,""):n.replace(new RegExp("^ {1,"+r+"}","gm"),"")),v!==m-1&&(i=this.rules.block.bullet.exec(p[v+1])[0],(h?1===i.length||!d&&")"===i[i.length-1]:i.length>1||this.options.smartLists&&i!==u)&&(o=p.slice(v+1).join("\n"),f.raw=f.raw.substring(0,f.raw.length-o.length),v=m-1)),a=g||/\n\n(?!\s*$)/.test(n),v!==m-1&&(g="\n"===n.charAt(n.length-1),a||(a=g)),a&&(f.loose=!0),l=void 0,(s=/^\[[ xX]\] /.test(n))&&(l=" "!==n[1],n=n.replace(/^\[[ xX]\] +/,"")),f.items.push({type:"list_item",raw:c,task:s,checked:l,loose:a,text:n});return f}},e.html=function(t){var e=this.rules.block.html.exec(t);if(e)return{type:this.options.sanitize?"paragraph":"html",raw:e[0],pre:!this.options.sanitizer&&("pre"===e[1]||"script"===e[1]||"style"===e[1]),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(e[0]):_(e[0]):e[0]}},e.def=function(t){var e=this.rules.block.def.exec(t);if(e)return e[3]&&(e[3]=e[3].substring(1,e[3].length-1)),{tag:e[1].toLowerCase().replace(/\s+/g," "),raw:e[0],href:e[2],title:e[3]}},e.table=function(t){var e=this.rules.block.table.exec(t);if(e){var n={type:"table",header:I(e[1].replace(/^ *| *\| *$/g,"")),align:e[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:e[3]?e[3].replace(/\n$/,"").split("\n"):[]};if(n.header.length===n.align.length){n.raw=e[0];var r,i=n.align.length;for(r=0;r<i;r++)/^ *-+: *$/.test(n.align[r])?n.align[r]="right":/^ *:-+: *$/.test(n.align[r])?n.align[r]="center":/^ *:-+ *$/.test(n.align[r])?n.align[r]="left":n.align[r]=null;for(i=n.cells.length,r=0;r<i;r++)n.cells[r]=I(n.cells[r].replace(/^ *\| *| *\| *$/g,""),n.header.length);return n}}},e.lheading=function(t){var e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:"="===e[2].charAt(0)?1:2,text:e[1]}},e.paragraph=function(t){var e=this.rules.block.paragraph.exec(t);if(e)return{type:"paragraph",raw:e[0],text:"\n"===e[1].charAt(e[1].length-1)?e[1].slice(0,-1):e[1]}},e.text=function(t,e){var n=this.rules.block.text.exec(t);if(n){var r=e[e.length-1];return r&&"text"===r.type?{raw:n[0],text:n[0]}:{type:"text",raw:n[0],text:n[0]}}},e.escape=function(t){var e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:_(e[1])}},e.tag=function(t,e,n){var r=this.rules.inline.tag.exec(t);if(r)return!e&&/^<a /i.test(r[0])?e=!0:e&&/^<\/a>/i.test(r[0])&&(e=!1),!n&&/^<(pre|code|kbd|script)(\s|>)/i.test(r[0])?n=!0:n&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(r[0])&&(n=!1),{type:this.options.sanitize?"text":"html",raw:r[0],inLink:e,inRawBlock:n,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(r[0]):_(r[0]):r[0]}},e.link=function(t){var e=this.rules.inline.link.exec(t);if(e){var n=P(e[2],"()");if(n>-1){var r=(0===e[0].indexOf("!")?5:4)+e[1].length+n;e[2]=e[2].substring(0,n),e[0]=e[0].substring(0,r).trim(),e[3]=""}var i=e[2],o="";if(this.options.pedantic){var a=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);a?(i=a[1],o=a[3]):o=""}else o=e[3]?e[3].slice(1,-1):"";return N(e,{href:(i=i.trim().replace(/^<([\s\S]*)>$/,"$1"))?i.replace(this.rules.inline._escapes,"$1"):i,title:o?o.replace(this.rules.inline._escapes,"$1"):o},e[0])}},e.reflink=function(t,e){var n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){var r=(n[2]||n[1]).replace(/\s+/g," ");if(!(r=e[r.toLowerCase()])||!r.href){var i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return N(n,r,n[0])}},e.strong=function(t,e,n){void 0===n&&(n="");var r=this.rules.inline.strong.start.exec(t);if(r&&(!r[1]||r[1]&&(""===n||this.rules.inline.punctuation.exec(n)))){e=e.slice(-1*t.length);var i,o="**"===r[0]?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;for(o.lastIndex=0;null!=(r=o.exec(e));)if(i=this.rules.inline.strong.middle.exec(e.slice(0,r.index+3)))return{type:"strong",raw:t.slice(0,i[0].length),text:t.slice(2,i[0].length-2)}}},e.em=function(t,e,n){void 0===n&&(n="");var r=this.rules.inline.em.start.exec(t);if(r&&(!r[1]||r[1]&&(""===n||this.rules.inline.punctuation.exec(n)))){e=e.slice(-1*t.length);var i,o="*"===r[0]?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;for(o.lastIndex=0;null!=(r=o.exec(e));)if(i=this.rules.inline.em.middle.exec(e.slice(0,r.index+2)))return{type:"em",raw:t.slice(0,i[0].length),text:t.slice(1,i[0].length-1)}}},e.codespan=function(t){var e=this.rules.inline.code.exec(t);if(e){var n=e[2].replace(/\n/g," "),r=/[^ ]/.test(n),i=n.startsWith(" ")&&n.endsWith(" ");return r&&i&&(n=n.substring(1,n.length-1)),n=_(n,!0),{type:"codespan",raw:e[0],text:n}}},e.br=function(t){var e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}},e.del=function(t){var e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[1]}},e.autolink=function(t,e){var n,r,i=this.rules.inline.autolink.exec(t);if(i)return r="@"===i[2]?"mailto:"+(n=_(this.options.mangle?e(i[1]):i[1])):n=_(i[1]),{type:"link",raw:i[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}},e.url=function(t,e){var n;if(n=this.rules.inline.url.exec(t)){var r,i;if("@"===n[2])i="mailto:"+(r=_(this.options.mangle?e(n[0]):n[0]));else{var o;do{o=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0]}while(o!==n[0]);r=_(n[0]),i="www."===n[1]?"http://"+r:r}return{type:"link",raw:n[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}},e.inlineText=function(t,e,n){var r,i=this.rules.inline.text.exec(t);if(i)return r=e?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):_(i[0]):i[0]:_(this.options.smartypants?n(i[0]):i[0]),{type:"text",raw:i[0],text:r}},t}(),F=w,B=E,U=T,H={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:F,table:F,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};H.def=B(H.def).replace("label",H._label).replace("title",H._title).getRegex(),H.bullet=/(?:[*+-]|\d{1,9}[.)])/,H.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,H.item=B(H.item,"gm").replace(/bull/g,H.bullet).getRegex(),H.list=B(H.list).replace(/bull/g,H.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+H.def.source+")").getRegex(),H._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",H._comment=/<!--(?!-?>)[\s\S]*?-->/,H.html=B(H.html,"i").replace("comment",H._comment).replace("tag",H._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),H.paragraph=B(H._paragraph).replace("hr",H.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",H._tag).getRegex(),H.blockquote=B(H.blockquote).replace("paragraph",H.paragraph).getRegex(),H.normal=U({},H),H.gfm=U({},H.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*|$)"}),H.gfm.nptable=B(H.gfm.nptable).replace("hr",H.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",H._tag).getRegex(),H.gfm.table=B(H.gfm.table).replace("hr",H.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",H._tag).getRegex(),H.pedantic=U({},H.normal,{html:B("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",H._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:F,paragraph:B(H.normal._paragraph).replace("hr",H.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",H.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var z={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:F,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:F,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/,_punctuation:"!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~"};z.punctuation=B(z.punctuation).replace(/punctuation/g,z._punctuation).getRegex(),z._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",z._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",z.em.start=B(z.em.start).replace(/punctuation/g,z._punctuation).getRegex(),z.em.middle=B(z.em.middle).replace(/punctuation/g,z._punctuation).replace(/overlapSkip/g,z._overlapSkip).getRegex(),z.em.endAst=B(z.em.endAst,"g").replace(/punctuation/g,z._punctuation).getRegex(),z.em.endUnd=B(z.em.endUnd,"g").replace(/punctuation/g,z._punctuation).getRegex(),z.strong.start=B(z.strong.start).replace(/punctuation/g,z._punctuation).getRegex(),z.strong.middle=B(z.strong.middle).replace(/punctuation/g,z._punctuation).replace(/blockSkip/g,z._blockSkip).getRegex(),z.strong.endAst=B(z.strong.endAst,"g").replace(/punctuation/g,z._punctuation).getRegex(),z.strong.endUnd=B(z.strong.endUnd,"g").replace(/punctuation/g,z._punctuation).getRegex(),z.blockSkip=B(z._blockSkip,"g").getRegex(),z.overlapSkip=B(z._overlapSkip,"g").getRegex(),z._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,z._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,z._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])?)+(?![-_])/,z.autolink=B(z.autolink).replace("scheme",z._scheme).replace("email",z._email).getRegex(),z._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,z.tag=B(z.tag).replace("comment",H._comment).replace("attribute",z._attribute).getRegex(),z._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,z._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,z._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,z.link=B(z.link).replace("label",z._label).replace("href",z._href).replace("title",z._title).getRegex(),z.reflink=B(z.reflink).replace("label",z._label).getRegex(),z.reflinkSearch=B(z.reflinkSearch,"g").replace("reflink",z.reflink).replace("nolink",z.nolink).getRegex(),z.normal=U({},z),z.pedantic=U({},z.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:B(/^!?\[(label)\]\((.*?)\)/).replace("label",z._label).getRegex(),reflink:B(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",z._label).getRegex()}),z.gfm=U({},z.normal,{escape:B(z.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),z.gfm.url=B(z.gfm.url,"i").replace("email",z.gfm._extended_email).getRegex(),z.breaks=U({},z.gfm,{br:B(z.br).replace("{2,}","*").getRegex(),text:B(z.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var G={block:H,inline:z},V=r.defaults,W=G.block,K=G.inline;function q(t){return t.replace(/---/g,"—").replace(/--/g,"").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1").replace(/'/g,"").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")}function Y(t){var e,n,r="",i=t.length;for(e=0;e<i;e++)n=t.charCodeAt(e),Math.random()>.5&&(n="x"+n.toString(16)),r+="&#"+n+";";return r}var X=function(){function e(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||V,this.options.tokenizer=this.options.tokenizer||new j,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var e={block:W.normal,inline:K.normal};this.options.pedantic?(e.block=W.pedantic,e.inline=K.pedantic):this.options.gfm&&(e.block=W.gfm,this.options.breaks?e.inline=K.breaks:e.inline=K.gfm),this.tokenizer.rules=e}e.lex=function(t,n){return new e(n).lex(t)};var n,r,i,o=e.prototype;return o.lex=function(t){return t=t.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),this.blockTokens(t,this.tokens,!0),this.inline(this.tokens),this.tokens},o.blockTokens=function(t,e,n){var r,i,o,a;for(void 0===e&&(e=[]),void 0===n&&(n=!0),t=t.replace(/^ +$/gm,"");t;)if(r=this.tokenizer.space(t))t=t.substring(r.raw.length),r.type&&e.push(r);else if(r=this.tokenizer.code(t,e))t=t.substring(r.raw.length),r.type?e.push(r):((a=e[e.length-1]).raw+="\n"+r.raw,a.text+="\n"+r.text);else if(r=this.tokenizer.fences(t))t=t.substring(r.raw.length),e.push(r);else if(r=this.tokenizer.heading(t))t=t.substring(r.raw.length),e.push(r);else if(r=this.tokenizer.nptable(t))t=t.substring(r.raw.length),e.push(r);else if(r=this.tokenizer.hr(t))t=t.substring(r.raw.length),e.push(r);else if(r=this.tokenizer.blockquote(t))t=t.substring(r.raw.length),r.tokens=this.blockTokens(r.text,[],n),e.push(r);else if(r=this.tokenizer.list(t)){for(t=t.substring(r.raw.length),o=r.items.length,i=0;i<o;i++)r.items[i].tokens=this.blockTokens(r.items[i].text,[],!1);e.push(r)}else if(r=this.tokenizer.html(t))t=t.substring(r.raw.length),e.push(r);else if(n&&(r=this.tokenizer.def(t)))t=t.substring(r.raw.length),this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title});else if(r=this.tokenizer.table(t))t=t.substring(r.raw.length),e.push(r);else if(r=this.tokenizer.lheading(t))t=t.substring(r.raw.length),e.push(r);else if(n&&(r=this.tokenizer.paragraph(t)))t=t.substring(r.raw.length),e.push(r);else if(r=this.tokenizer.text(t,e))t=t.substring(r.raw.length),r.type?e.push(r):((a=e[e.length-1]).raw+="\n"+r.raw,a.text+="\n"+r.text);else if(t){var s="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(s);break}throw new Error(s)}return e},o.inline=function(t){var e,n,r,i,o,a,s=t.length;for(e=0;e<s;e++)switch((a=t[e]).type){case"paragraph":case"text":case"heading":a.tokens=[],this.inlineTokens(a.text,a.tokens);break;case"table":for(a.tokens={header:[],cells:[]},i=a.header.length,n=0;n<i;n++)a.tokens.header[n]=[],this.inlineTokens(a.header[n],a.tokens.header[n]);for(i=a.cells.length,n=0;n<i;n++)for(o=a.cells[n],a.tokens.cells[n]=[],r=0;r<o.length;r++)a.tokens.cells[n][r]=[],this.inlineTokens(o[r],a.tokens.cells[n][r]);break;case"blockquote":this.inline(a.tokens);break;case"list":for(i=a.items.length,n=0;n<i;n++)this.inline(a.items[n].tokens)}return t},o.inlineTokens=function(t,e,n,r,i){var o;void 0===e&&(e=[]),void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===i&&(i="");var a,s=t;if(this.tokens.links){var l=Object.keys(this.tokens.links);if(l.length>0)for(;null!=(a=this.tokenizer.rules.inline.reflinkSearch.exec(s));)l.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(a=this.tokenizer.rules.inline.blockSkip.exec(s));)s=s.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;t;)if(o=this.tokenizer.escape(t))t=t.substring(o.raw.length),e.push(o);else if(o=this.tokenizer.tag(t,n,r))t=t.substring(o.raw.length),n=o.inLink,r=o.inRawBlock,e.push(o);else if(o=this.tokenizer.link(t))t=t.substring(o.raw.length),"link"===o.type&&(o.tokens=this.inlineTokens(o.text,[],!0,r)),e.push(o);else if(o=this.tokenizer.reflink(t,this.tokens.links))t=t.substring(o.raw.length),"link"===o.type&&(o.tokens=this.inlineTokens(o.text,[],!0,r)),e.push(o);else if(o=this.tokenizer.strong(t,s,i))t=t.substring(o.raw.length),o.tokens=this.inlineTokens(o.text,[],n,r),e.push(o);else if(o=this.tokenizer.em(t,s,i))t=t.substring(o.raw.length),o.tokens=this.inlineTokens(o.text,[],n,r),e.push(o);else if(o=this.tokenizer.codespan(t))t=t.substring(o.raw.length),e.push(o);else if(o=this.tokenizer.br(t))t=t.substring(o.raw.length),e.push(o);else if(o=this.tokenizer.del(t))t=t.substring(o.raw.length),o.tokens=this.inlineTokens(o.text,[],n,r),e.push(o);else if(o=this.tokenizer.autolink(t,Y))t=t.substring(o.raw.length),e.push(o);else if(n||!(o=this.tokenizer.url(t,Y))){if(o=this.tokenizer.inlineText(t,r,q))t=t.substring(o.raw.length),i=o.raw.slice(-1),e.push(o);else if(t){var c="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(c);break}throw new Error(c)}}else t=t.substring(o.raw.length),e.push(o);return e},n=e,i=[{key:"rules",get:function(){return{block:W,inline:K}}}],(r=null)&&t(n.prototype,r),i&&t(n,i),e}(),$=r.defaults,Z=k,J=C,Q=function(){function t(t){this.options=t||$}var e=t.prototype;return e.code=function(t,e,n){var r=(e||"").match(/\S*/)[0];if(this.options.highlight){var i=this.options.highlight(t,r);null!=i&&i!==t&&(n=!0,t=i)}return r?'<pre><code class="'+this.options.langPrefix+J(r,!0)+'">'+(n?t:J(t,!0))+"</code></pre>\n":"<pre><code>"+(n?t:J(t,!0))+"</code></pre>\n"},e.blockquote=function(t){return"<blockquote>\n"+t+"</blockquote>\n"},e.html=function(t){return t},e.heading=function(t,e,n,r){return this.options.headerIds?"<h"+e+' id="'+this.options.headerPrefix+r.slug(n)+'">'+t+"</h"+e+">\n":"<h"+e+">"+t+"</h"+e+">\n"},e.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},e.list=function(t,e,n){var r=e?"ol":"ul";return"<"+r+(e&&1!==n?' start="'+n+'"':"")+">\n"+t+"</"+r+">\n"},e.listitem=function(t){return"<li>"+t+"</li>\n"},e.checkbox=function(t){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},e.paragraph=function(t){return"<p>"+t+"</p>\n"},e.table=function(t,e){return e&&(e="<tbody>"+e+"</tbody>"),"<table>\n<thead>\n"+t+"</thead>\n"+e+"</table>\n"},e.tablerow=function(t){return"<tr>\n"+t+"</tr>\n"},e.tablecell=function(t,e){var n=e.header?"th":"td";return(e.align?"<"+n+' align="'+e.align+'">':"<"+n+">")+t+"</"+n+">\n"},e.strong=function(t){return"<strong>"+t+"</strong>"},e.em=function(t){return"<em>"+t+"</em>"},e.codespan=function(t){return"<code>"+t+"</code>"},e.br=function(){return this.options.xhtml?"<br/>":"<br>"},e.del=function(t){return"<del>"+t+"</del>"},e.link=function(t,e,n){if(null===(t=Z(this.options.sanitize,this.options.baseUrl,t)))return n;var r='<a href="'+J(t)+'"';return e&&(r+=' title="'+e+'"'),r+=">"+n+"</a>"},e.image=function(t,e,n){if(null===(t=Z(this.options.sanitize,this.options.baseUrl,t)))return n;var r='<img src="'+t+'" alt="'+n+'"';return e&&(r+=' title="'+e+'"'),r+=this.options.xhtml?"/>":">"},e.text=function(t){return t},t}(),tt=function(){function t(){}var e=t.prototype;return e.strong=function(t){return t},e.em=function(t){return t},e.codespan=function(t){return t},e.del=function(t){return t},e.html=function(t){return t},e.text=function(t){return t},e.link=function(t,e,n){return""+n},e.image=function(t,e,n){return""+n},e.br=function(){return""},t}(),et=function(){function t(){this.seen={}}return t.prototype.slug=function(t){var e=t.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(e)){var n=e;do{this.seen[n]++,e=n+"-"+this.seen[n]}while(this.seen.hasOwnProperty(e))}return this.seen[e]=0,e},t}(),nt=r.defaults,rt=S,it=function(){function t(t){this.options=t||nt,this.options.renderer=this.options.renderer||new Q,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new tt,this.slugger=new et}t.parse=function(e,n){return new t(n).parse(e)};var e=t.prototype;return e.parse=function(t,e){void 0===e&&(e=!0);var n,r,i,o,a,s,l,c,u,h,d,f,p,g,m,v,y,b,x="",C=t.length;for(n=0;n<C;n++)switch((h=t[n]).type){case"space":continue;case"hr":x+=this.renderer.hr();continue;case"heading":x+=this.renderer.heading(this.parseInline(h.tokens),h.depth,rt(this.parseInline(h.tokens,this.textRenderer)),this.slugger);continue;case"code":x+=this.renderer.code(h.text,h.lang,h.escaped);continue;case"table":for(c="",l="",o=h.header.length,r=0;r<o;r++)l+=this.renderer.tablecell(this.parseInline(h.tokens.header[r]),{header:!0,align:h.align[r]});for(c+=this.renderer.tablerow(l),u="",o=h.cells.length,r=0;r<o;r++){for(l="",a=(s=h.tokens.cells[r]).length,i=0;i<a;i++)l+=this.renderer.tablecell(this.parseInline(s[i]),{header:!1,align:h.align[i]});u+=this.renderer.tablerow(l)}x+=this.renderer.table(c,u);continue;case"blockquote":u=this.parse(h.tokens),x+=this.renderer.blockquote(u);continue;case"list":for(d=h.ordered,f=h.start,p=h.loose,o=h.items.length,u="",r=0;r<o;r++)v=(m=h.items[r]).checked,y=m.task,g="",m.task&&(b=this.renderer.checkbox(v),p?m.tokens.length>0&&"text"===m.tokens[0].type?(m.tokens[0].text=b+" "+m.tokens[0].text,m.tokens[0].tokens&&m.tokens[0].tokens.length>0&&"text"===m.tokens[0].tokens[0].type&&(m.tokens[0].tokens[0].text=b+" "+m.tokens[0].tokens[0].text)):m.tokens.unshift({type:"text",text:b}):g+=b),g+=this.parse(m.tokens,p),u+=this.renderer.listitem(g,y,v);x+=this.renderer.list(u,d,f);continue;case"html":x+=this.renderer.html(h.text);continue;case"paragraph":x+=this.renderer.paragraph(this.parseInline(h.tokens));continue;case"text":for(u=h.tokens?this.parseInline(h.tokens):h.text;n+1<C&&"text"===t[n+1].type;)u+="\n"+((h=t[++n]).tokens?this.parseInline(h.tokens):h.text);x+=e?this.renderer.paragraph(u):u;continue;default:var S='Token with "'+h.type+'" type was not found.';if(this.options.silent)return void console.error(S);throw new Error(S)}return x},e.parseInline=function(t,e){e=e||this.renderer;var n,r,i="",o=t.length;for(n=0;n<o;n++)switch((r=t[n]).type){case"escape":i+=e.text(r.text);break;case"html":i+=e.html(r.text);break;case"link":i+=e.link(r.href,r.title,this.parseInline(r.tokens,e));break;case"image":i+=e.image(r.href,r.title,r.text);break;case"strong":i+=e.strong(this.parseInline(r.tokens,e));break;case"em":i+=e.em(this.parseInline(r.tokens,e));break;case"codespan":i+=e.codespan(r.text);break;case"br":i+=e.br();break;case"del":i+=e.del(this.parseInline(r.tokens,e));break;case"text":i+=e.text(r.text);break;default:var a='Token with "'+r.type+'" type was not found.';if(this.options.silent)return void console.error(a);throw new Error(a)}return i},t}(),ot=T,at=D,st=C,lt=r.getDefaults,ct=r.changeDefaults,ut=r.defaults;function ht(t,e,n){if(null==t)throw new Error("marked(): input parameter is undefined or null");if("string"!=typeof t)throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected");if("function"==typeof e&&(n=e,e=null),e=ot({},ht.defaults,e||{}),at(e),n){var r,i=e.highlight;try{r=X.lex(t,e)}catch(t){return n(t)}var o=function(t){var o;if(!t)try{o=it.parse(r,e)}catch(e){t=e}return e.highlight=i,t?n(t):n(null,o)};if(!i||i.length<3)return o();if(delete e.highlight,!r.length)return o();var a=0;return ht.walkTokens(r,(function(t){"code"===t.type&&(a++,setTimeout((function(){i(t.text,t.lang,(function(e,n){if(e)return o(e);null!=n&&n!==t.text&&(t.text=n,t.escaped=!0),0==--a&&o()}))}),0))})),void(0===a&&o())}try{var s=X.lex(t,e);return e.walkTokens&&ht.walkTokens(s,e.walkTokens),it.parse(s,e)}catch(t){if(t.message+="\nPlease report this to https://github.com/markedjs/marked.",e.silent)return"<p>An error occurred:</p><pre>"+st(t.message+"",!0)+"</pre>";throw t}}return ht.options=ht.setOptions=function(t){return ot(ht.defaults,t),ct(ht.defaults),ht},ht.getDefaults=lt,ht.defaults=ut,ht.use=function(t){var e=ot({},t);if(t.renderer&&function(){var n=ht.defaults.renderer||new Q,r=function(e){var r=n[e];n[e]=function(){for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];var s=t.renderer[e].apply(n,o);return!1===s&&(s=r.apply(n,o)),s}};for(var i in t.renderer)r(i);e.renderer=n}(),t.tokenizer&&function(){var n=ht.defaults.tokenizer||new j,r=function(e){var r=n[e];n[e]=function(){for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];var s=t.tokenizer[e].apply(n,o);return!1===s&&(s=r.apply(n,o)),s}};for(var i in t.tokenizer)r(i);e.tokenizer=n}(),t.walkTokens){var n=ht.defaults.walkTokens;e.walkTokens=function(e){t.walkTokens(e),n&&n(e)}}ht.setOptions(e)},ht.walkTokens=function(t,e){for(var r,i=n(t);!(r=i()).done;){var o=r.value;switch(e(o),o.type){case"table":for(var a,s=n(o.tokens.header);!(a=s()).done;){var l=a.value;ht.walkTokens(l,e)}for(var c,u=n(o.tokens.cells);!(c=u()).done;)for(var h,d=n(c.value);!(h=d()).done;){var f=h.value;ht.walkTokens(f,e)}break;case"list":ht.walkTokens(o.items,e);break;default:o.tokens&&ht.walkTokens(o.tokens,e)}}},ht.Parser=it,ht.parser=it.parse,ht.Renderer=Q,ht.TextRenderer=tt,ht.Lexer=X,ht.lexer=X.lex,ht.Tokenizer=j,ht.Slugger=et,ht.parse=ht,ht}()},ELLl:
/*!*************************************************************!*\
!*** ./node_modules/codemirror/addon/edit/closebrackets.js ***!
\*************************************************************/
/*! no static exports found */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){!function(t){var e={pairs:"()[]{}''\"\"",closeBefore:")]}'\":;>",triples:"",explode:"[]{}"},n=t.Pos;function r(t,n){return"pairs"==n&&"string"==typeof t?t:"object"==typeof t&&null!=t[n]?t[n]:e[n]}t.defineOption("autoCloseBrackets",!1,(function(e,n,a){a&&a!=t.Init&&(e.removeKeyMap(i),e.state.closeBrackets=null),n&&(o(r(n,"pairs")),e.state.closeBrackets=n,e.addKeyMap(i))}));var i={Backspace:function(e){var i=s(e);if(!i||e.getOption("disableInput"))return t.Pass;for(var o=r(i,"pairs"),a=e.listSelections(),c=0;c<a.length;c++){if(!a[c].empty())return t.Pass;var u=l(e,a[c].head);if(!u||o.indexOf(u)%2!=0)return t.Pass}for(c=a.length-1;c>=0;c--){var h=a[c].head;e.replaceRange("",n(h.line,h.ch-1),n(h.line,h.ch+1),"+delete")}},Enter:function(e){var n=s(e),i=n&&r(n,"explode");if(!i||e.getOption("disableInput"))return t.Pass;for(var o=e.listSelections(),a=0;a<o.length;a++){if(!o[a].empty())return t.Pass;var c=l(e,o[a].head);if(!c||i.indexOf(c)%2!=0)return t.Pass}e.operation((function(){var t=e.lineSeparator()||"\n";e.replaceSelection(t+t,null),e.execCommand("goCharLeft"),o=e.listSelections();for(var n=0;n<o.length;n++){var r=o[n].head.line;e.indentLine(r,null,!0),e.indentLine(r+1,null,!0)}}))}};function o(t){for(var e=0;e<t.length;e++){var n=t.charAt(e),r="'"+n+"'";i[r]||(i[r]=a(n))}}function a(e){return function(i){return function(e,i){var o=s(e);if(!o||e.getOption("disableInput"))return t.Pass;var a=r(o,"pairs"),l=a.indexOf(i);if(-1==l)return t.Pass;for(var u,h=r(o,"closeBefore"),d=r(o,"triples"),f=a.charAt(l+1)==i,p=e.listSelections(),g=l%2==0,m=0;m<p.length;m++){var v,y=p[m],b=y.head,x=e.getRange(b,n(b.line,b.ch+1));if(g&&!y.empty())v="surround";else if(!f&&g||x!=i)if(f&&b.ch>1&&d.indexOf(i)>=0&&e.getRange(n(b.line,b.ch-2),b)==i+i){if(b.ch>2&&/\bstring/.test(e.getTokenTypeAt(n(b.line,b.ch-2))))return t.Pass;v="addFour"}else if(f){var C=0==b.ch?" ":e.getRange(n(b.line,b.ch-1),b);if(t.isWordChar(x)||C==i||t.isWordChar(C))return t.Pass;v="both"}else{if(!g||!(0===x.length||/\s/.test(x)||h.indexOf(x)>-1))return t.Pass;v="both"}else v=f&&c(e,b)?"both":d.indexOf(i)>=0&&e.getRange(b,n(b.line,b.ch+3))==i+i+i?"skipThree":"skip";if(u){if(u!=v)return t.Pass}else u=v}var S=l%2?a.charAt(l-1):i,E=l%2?i:a.charAt(l+1);e.operation((function(){if("skip"==u)e.execCommand("goCharRight");else if("skipThree"==u)for(var r=0;r<3;r++)e.execCommand("goCharRight");else if("surround"==u){var i=e.getSelections();for(r=0;r<i.length;r++)i[r]=S+i[r]+E;for(e.replaceSelections(i,"around"),i=e.listSelections().slice(),r=0;r<i.length;r++)i[r]=(o=i[r],a=void 0,a=t.cmpPos(o.anchor,o.head)>0,{anchor:new n(o.anchor.line,o.anchor.ch+(a?-1:1)),head:new n(o.head.line,o.head.ch+(a?1:-1))});e.setSelections(i)}else"both"==u?(e.replaceSelection(S+E,null),e.triggerElectric(S+E),e.execCommand("goCharLeft")):"addFour"==u&&(e.replaceSelection(S+S+S+S,"before"),e.execCommand("goCharRight"));var o,a}))}(i,e)}}function s(t){var e=t.state.closeBrackets;return!e||e.override?e:t.getModeAt(t.getCursor()).closeBrackets||e}function l(t,e){var r=t.getRange(n(e.line,e.ch-1),n(e.line,e.ch+1));return 2==r.length?r:null}function c(t,e){var r=t.getTokenAt(n(e.line,e.ch+1));return/\bstring/.test(r.type)&&r.start==e.ch&&(0==e.ch||!/\bstring/.test(t.getTokenTypeAt(e)))}o(e.pairs+"`")}(n(/*! ../../lib/codemirror */"VrN/"))},H38U:
/*!******************************************!*\
!*** ./node_modules/qr.js/lib/QRCode.js ***!
\******************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r=n(/*! ./8BitByte */"f4xo"),i=n(/*! ./RSBlock */"rcnY"),o=n(/*! ./BitBuffer */"wU8J"),a=n(/*! ./util */"Iq15"),s=n(/*! ./Polynomial */"dWSS");function l(t,e){this.typeNumber=t,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var c=l.prototype;c.addData=function(t){var e=new r(t);this.dataList.push(e),this.dataCache=null},c.isDark=function(t,e){if(t<0||this.moduleCount<=t||e<0||this.moduleCount<=e)throw new Error(t+","+e);return this.modules[t][e]},c.getModuleCount=function(){return this.moduleCount},c.make=function(){if(this.typeNumber<1){var t=1;for(t=1;t<40;t++){for(var e=i.getRSBlocks(t,this.errorCorrectLevel),n=new o,r=0,s=0;s<e.length;s++)r+=e[s].dataCount;for(s=0;s<this.dataList.length;s++){var l=this.dataList[s];n.put(l.mode,4),n.put(l.getLength(),a.getLengthInBits(l.mode,t)),l.write(n)}if(n.getLengthInBits()<=8*r)break}this.typeNumber=t}this.makeImpl(!1,this.getBestMaskPattern())},c.makeImpl=function(t,e){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var n=0;n<this.moduleCount;n++){this.modules[n]=new Array(this.moduleCount);for(var r=0;r<this.moduleCount;r++)this.modules[n][r]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(t,e),this.typeNumber>=7&&this.setupTypeNumber(t),null==this.dataCache&&(this.dataCache=l.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},c.setupPositionProbePattern=function(t,e){for(var n=-1;n<=7;n++)if(!(t+n<=-1||this.moduleCount<=t+n))for(var r=-1;r<=7;r++)e+r<=-1||this.moduleCount<=e+r||(this.modules[t+n][e+r]=0<=n&&n<=6&&(0==r||6==r)||0<=r&&r<=6&&(0==n||6==n)||2<=n&&n<=4&&2<=r&&r<=4)},c.getBestMaskPattern=function(){for(var t=0,e=0,n=0;n<8;n++){this.makeImpl(!0,n);var r=a.getLostPoint(this);(0==n||t>r)&&(t=r,e=n)}return e},c.createMovieClip=function(t,e,n){var r=t.createEmptyMovieClip(e,n);this.make();for(var i=0;i<this.modules.length;i++)for(var o=1*i,a=0;a<this.modules[i].length;a++){var s=1*a;this.modules[i][a]&&(r.beginFill(0,100),r.moveTo(s,o),r.lineTo(s+1,o),r.lineTo(s+1,o+1),r.lineTo(s,o+1),r.endFill())}return r},c.setupTimingPattern=function(){for(var t=8;t<this.moduleCount-8;t++)null==this.modules[t][6]&&(this.modules[t][6]=t%2==0);for(var e=8;e<this.moduleCount-8;e++)null==this.modules[6][e]&&(this.modules[6][e]=e%2==0)},c.setupPositionAdjustPattern=function(){for(var t=a.getPatternPosition(this.typeNumber),e=0;e<t.length;e++)for(var n=0;n<t.length;n++){var r=t[e],i=t[n];if(null==this.modules[r][i])for(var o=-2;o<=2;o++)for(var s=-2;s<=2;s++)this.modules[r+o][i+s]=-2==o||2==o||-2==s||2==s||0==o&&0==s}},c.setupTypeNumber=function(t){for(var e=a.getBCHTypeNumber(this.typeNumber),n=0;n<18;n++){var r=!t&&1==(e>>n&1);this.modules[Math.floor(n/3)][n%3+this.moduleCount-8-3]=r}for(n=0;n<18;n++){r=!t&&1==(e>>n&1);this.modules[n%3+this.moduleCount-8-3][Math.floor(n/3)]=r}},c.setupTypeInfo=function(t,e){for(var n=this.errorCorrectLevel<<3|e,r=a.getBCHTypeInfo(n),i=0;i<15;i++){var o=!t&&1==(r>>i&1);i<6?this.modules[i][8]=o:i<8?this.modules[i+1][8]=o:this.modules[this.moduleCount-15+i][8]=o}for(i=0;i<15;i++){o=!t&&1==(r>>i&1);i<8?this.modules[8][this.moduleCount-i-1]=o:i<9?this.modules[8][15-i-1+1]=o:this.modules[8][15-i-1]=o}this.modules[this.moduleCount-8][8]=!t},c.mapData=function(t,e){for(var n=-1,r=this.moduleCount-1,i=7,o=0,s=this.moduleCount-1;s>0;s-=2)for(6==s&&s--;;){for(var l=0;l<2;l++)if(null==this.modules[r][s-l]){var c=!1;o<t.length&&(c=1==(t[o]>>>i&1)),a.getMask(e,r,s-l)&&(c=!c),this.modules[r][s-l]=c,-1==--i&&(o++,i=7)}if((r+=n)<0||this.moduleCount<=r){r-=n,n=-n;break}}},l.PAD0=236,l.PAD1=17,l.createData=function(t,e,n){for(var r=i.getRSBlocks(t,e),s=new o,c=0;c<n.length;c++){var u=n[c];s.put(u.mode,4),s.put(u.getLength(),a.getLengthInBits(u.mode,t)),u.write(s)}var h=0;for(c=0;c<r.length;c++)h+=r[c].dataCount;if(s.getLengthInBits()>8*h)throw new Error("code length overflow. ("+s.getLengthInBits()+">"+8*h+")");for(s.getLengthInBits()+4<=8*h&&s.put(0,4);s.getLengthInBits()%8!=0;)s.putBit(!1);for(;!(s.getLengthInBits()>=8*h||(s.put(l.PAD0,8),s.getLengthInBits()>=8*h));)s.put(l.PAD1,8);return l.createBytes(s,r)},l.createBytes=function(t,e){for(var n=0,r=0,i=0,o=new Array(e.length),l=new Array(e.length),c=0;c<e.length;c++){var u=e[c].dataCount,h=e[c].totalCount-u;r=Math.max(r,u),i=Math.max(i,h),o[c]=new Array(u);for(var d=0;d<o[c].length;d++)o[c][d]=255&t.buffer[d+n];n+=u;var f=a.getErrorCorrectPolynomial(h),p=new s(o[c],f.getLength()-1).mod(f);l[c]=new Array(f.getLength()-1);for(d=0;d<l[c].length;d++){var g=d+p.getLength()-l[c].length;l[c][d]=g>=0?p.get(g):0}}var m=0;for(d=0;d<e.length;d++)m+=e[d].totalCount;var v=new Array(m),y=0;for(d=0;d<r;d++)for(c=0;c<e.length;c++)d<o[c].length&&(v[y++]=o[c][d]);for(d=0;d<i;d++)for(c=0;c<e.length;c++)d<l[c].length&&(v[y++]=l[c][d]);return v},t.exports=l},HmJG:
/*!****************************************************************!*\
!*** ./src/components/markdown-editor/upload-image/index.less ***!
\****************************************************************/
/*! no static exports found */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){},IBYe:
/*!**************************************************!*\
!*** ./node_modules/rc-table/es/sugar/Column.js ***!
\**************************************************/
/*! exports provided: default */
/*! exports used: default */function(t,e,n){"use strict";e.a=function(t){return null}},Iq15:
/*!****************************************!*\
!*** ./node_modules/qr.js/lib/util.js ***!
\****************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r=n(/*! ./mode */"nVVt"),i=n(/*! ./Polynomial */"dWSS"),o=n(/*! ./math */"dQei"),a=0,s=1,l=2,c=3,u=4,h=5,d=6,f=7,p={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(t){for(var e=t<<10;p.getBCHDigit(e)-p.getBCHDigit(p.G15)>=0;)e^=p.G15<<p.getBCHDigit(e)-p.getBCHDigit(p.G15);return(t<<10|e)^p.G15_MASK},getBCHTypeNumber:function(t){for(var e=t<<12;p.getBCHDigit(e)-p.getBCHDigit(p.G18)>=0;)e^=p.G18<<p.getBCHDigit(e)-p.getBCHDigit(p.G18);return t<<12|e},getBCHDigit:function(t){for(var e=0;0!=t;)e++,t>>>=1;return e},getPatternPosition:function(t){return p.PATTERN_POSITION_TABLE[t-1]},getMask:function(t,e,n){switch(t){case a:return(e+n)%2==0;case s:return e%2==0;case l:return n%3==0;case c:return(e+n)%3==0;case u:return(Math.floor(e/2)+Math.floor(n/3))%2==0;case h:return e*n%2+e*n%3==0;case d:return(e*n%2+e*n%3)%2==0;case f:return(e*n%3+(e+n)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}},getErrorCorrectPolynomial:function(t){for(var e=new i([1],0),n=0;n<t;n++)e=e.multiply(new i([1,o.gexp(n)],0));return e},getLengthInBits:function(t,e){if(1<=e&&e<10)switch(t){case r.MODE_NUMBER:return 10;case r.MODE_ALPHA_NUM:return 9;case r.MODE_8BIT_BYTE:case r.MODE_KANJI:return 8;default:throw new Error("mode:"+t)}else if(e<27)switch(t){case r.MODE_NUMBER:return 12;case r.MODE_ALPHA_NUM:return 11;case r.MODE_8BIT_BYTE:return 16;case r.MODE_KANJI:return 10;default:throw new Error("mode:"+t)}else{if(!(e<41))throw new Error("type:"+e);switch(t){case r.MODE_NUMBER:return 14;case r.MODE_ALPHA_NUM:return 13;case r.MODE_8BIT_BYTE:return 16;case r.MODE_KANJI:return 12;default:throw new Error("mode:"+t)}}},getLostPoint:function(t){for(var e=t.getModuleCount(),n=0,r=0;r<e;r++)for(var i=0;i<e;i++){for(var o=0,a=t.isDark(r,i),s=-1;s<=1;s++)if(!(r+s<0||e<=r+s))for(var l=-1;l<=1;l++)i+l<0||e<=i+l||0==s&&0==l||a==t.isDark(r+s,i+l)&&o++;o>5&&(n+=3+o-5)}for(r=0;r<e-1;r++)for(i=0;i<e-1;i++){var c=0;t.isDark(r,i)&&c++,t.isDark(r+1,i)&&c++,t.isDark(r,i+1)&&c++,t.isDark(r+1,i+1)&&c++,0!=c&&4!=c||(n+=3)}for(r=0;r<e;r++)for(i=0;i<e-6;i++)t.isDark(r,i)&&!t.isDark(r,i+1)&&t.isDark(r,i+2)&&t.isDark(r,i+3)&&t.isDark(r,i+4)&&!t.isDark(r,i+5)&&t.isDark(r,i+6)&&(n+=40);for(i=0;i<e;i++)for(r=0;r<e-6;r++)t.isDark(r,i)&&!t.isDark(r+1,i)&&t.isDark(r+2,i)&&t.isDark(r+3,i)&&t.isDark(r+4,i)&&!t.isDark(r+5,i)&&t.isDark(r+6,i)&&(n+=40);var u=0;for(i=0;i<e;i++)for(r=0;r<e;r++)t.isDark(r,i)&&u++;return n+=10*(Math.abs(100*u/e/e-50)/5)}};t.exports=p},LdHM:
/*!********************************************************!*\
!*** ./node_modules/rc-select/es/index.js + 6 modules ***!
\********************************************************/
/*! exports provided: Option, OptGroup, default */
/*! exports used: OptGroup, Option, default */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createClass.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createSuper.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/defineProperty.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/inherits.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/typeof.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/TransBtn.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/generate.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/utils/commonUtil.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/utils/valueUtil.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Children/toArray.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/KeyCode.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/hooks/useMemo.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/pickAttrs.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/warning.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-virtual-list/es/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */function(t,e,n){"use strict";n.d(e,"b",(function(){return C})),n.d(e,"a",(function(){return E}));var r=n("1OyB"),i=n("vuIU"),o=n("Ji7U"),a=n("LK+K"),s=n("q1tI"),l=n("rePB"),c=n("Ff2n"),u=n("ODXe"),h=n("4IlW"),d=n("bX4T"),f=n("YrtM"),p=n("TSYQ"),g=n.n(p),m=n("+nKL"),v=n("8OUc"),y=s.forwardRef((function(t,e){var n=t.prefixCls,r=t.id,i=t.flattenOptions,o=t.childrenAsData,a=t.values,p=t.searchValue,y=t.multiple,b=t.defaultActiveFirstOption,x=t.height,C=t.itemHeight,S=t.notFoundContent,E=t.open,k=t.menuItemSelectedIcon,w=t.virtual,T=t.onSelect,O=t.onToggleOpen,L=t.onActiveValue,A=t.onScroll,D=t.onMouseEnter,R="".concat(n,"-item"),M=Object(f.a)((function(){return i}),[E,i],(function(t,e){return e[0]&&t[1]!==e[1]})),I=s.useRef(null),_=function(t){t.preventDefault()},P=function(t){I.current&&I.current.scrollTo({index:t})},N=function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=M.length,r=0;r<n;r+=1){var i=(t+r*e+n)%n,o=M[i],a=o.group,s=o.data;if(!a&&!s.disabled)return i}return-1},j=s.useState((function(){return N(0)})),F=Object(u.a)(j,2),B=F[0],U=F[1],H=function(t){U(t);var e=M[t];e?L(e.data.value,t):L(null,-1)};s.useEffect((function(){H(!1!==b?N(0):-1)}),[M.length,p]),s.useEffect((function(){var t=setTimeout((function(){if(!y&&E&&1===a.size){var t=Array.from(a)[0],e=M.findIndex((function(e){return e.data.value===t}));H(e),P(e)}}));return function(){return clearTimeout(t)}}),[E]);var z=function(t){void 0!==t&&T(t,{selected:!a.has(t)}),y||O(!1)};if(s.useImperativeHandle(e,(function(){return{onKeyDown:function(t){var e=t.which;switch(e){case h.a.UP:case h.a.DOWN:var n=0;if(e===h.a.UP?n=-1:e===h.a.DOWN&&(n=1),0!==n){var r=N(B+n,n);P(r),H(r)}break;case h.a.ENTER:var i=M[B];i&&!i.data.disabled?z(i.data.value):z(void 0),E&&t.preventDefault();break;case h.a.ESC:O(!1)}},onKeyUp:function(){},scrollTo:function(t){P(t)}}})),0===M.length)return s.createElement("div",{role:"listbox",id:"".concat(r,"_list"),className:"".concat(R,"-empty"),onMouseDown:_},S);function G(t){var e=M[t];if(!e)return null;var n=e.data||{},i=n.value,l=n.label,c=n.children,u=Object(d.a)(n,!0),h=o?c:l;return e?s.createElement("div",Object.assign({"aria-label":"string"==typeof h?h:null},u,{key:t,role:"option",id:"".concat(r,"_list_").concat(t),"aria-selected":a.has(i)}),i):null}return s.createElement(s.Fragment,null,s.createElement("div",{role:"listbox",id:"".concat(r,"_list"),style:{height:0,width:0,overflow:"hidden"}},G(B-1),G(B),G(B+1)),s.createElement(m.a,{itemKey:"key",ref:I,data:M,height:x,itemHeight:C,fullHeight:!1,onMouseDown:_,onScroll:A,virtual:w,onMouseEnter:D},(function(t,e){var n,r=t.group,i=t.groupOption,u=t.data,h=u.label,d=u.key;if(r)return s.createElement("div",{className:g()(R,"".concat(R,"-group"))},void 0!==h?h:d);var f=u.disabled,p=u.value,m=u.title,y=u.children,b=u.style,x=u.className,C=Object(c.a)(u,["disabled","value","title","children","style","className"]),S=a.has(p),E="".concat(R,"-option"),w=g()(R,E,x,(n={},Object(l.a)(n,"".concat(E,"-grouped"),i),Object(l.a)(n,"".concat(E,"-active"),B===e&&!f),Object(l.a)(n,"".concat(E,"-disabled"),f),Object(l.a)(n,"".concat(E,"-selected"),S),n)),T=o?y:h,O=!k||"function"==typeof k||S;return s.createElement("div",Object.assign({},C,{"aria-selected":S,className:w,title:m,onMouseMove:function(){B===e||f||H(e)},onClick:function(){f||z(p)},style:b}),s.createElement("div",{className:"".concat(E,"-content")},T||p),s.isValidElement(k)||S,O&&s.createElement(v.a,{className:"".concat(R,"-option-state"),customizeIcon:k,customizeIconProps:{isSelected:S}},S?"✓":null))})))}));y.displayName="OptionList";var b=y,x=function(){return null};x.isSelectOption=!0;var C=x,S=function(){return null};S.isSelectOptGroup=!0;var E=S,k=n("VTBJ"),w=n("Zm9Q");function T(t){var e=t.key,n=t.props,r=n.children,i=n.value,o=Object(c.a)(n,["children","value"]);return Object(k.a)({key:e,value:void 0!==i?i:e,children:r},o)}function O(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Object(w.a)(t).map((function(t,n){if(!s.isValidElement(t)||!t.type)return null;var r=t.type.isSelectOptGroup,i=t.key,o=t.props,a=o.children,l=Object(c.a)(o,["children"]);return e||!r?T(t):Object(k.a)(Object(k.a)({key:"__RC_SELECT_GRP__".concat(null===i?n:i,"__"),label:i},l),{},{options:O(a)})})).filter((function(t){return t}))}var L=n("2Qr1"),A=n("qNPg"),D=n("U8pU"),R=n("Kwbf"),M=n("WKfj");var I=function(t){var e=t.mode,n=t.options,r=t.children,i=t.backfill,o=t.allowClear,a=t.placeholder,l=t.getInputElement,c=t.showSearch,u=t.onSearch,h=t.defaultOpen,d=t.autoFocus,f=t.labelInValue,p=t.value,g=t.inputValue,m=t.optionLabelProp,v="multiple"===e||"tags"===e,y=void 0!==c?c:v||"combobox"===e,b=n||O(r);if(Object(R.a)("tags"!==e||b.every((function(t){return!t.disabled})),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),"tags"===e||"combobox"===e){var x=b.some((function(t){return t.options?t.options.some((function(t){return"number"==typeof("value"in t?t.value:t.key)})):"number"==typeof("value"in t?t.value:t.key)}));Object(R.a)(!x,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(R.a)("combobox"!==e||!m,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(R.a)("combobox"===e||!i,"`backfill` only works with `combobox` mode."),Object(R.a)("combobox"===e||!l,"`getInputElement` only work with `combobox` mode."),Object(R.b)("combobox"!==e||!l||!o||!a,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),u&&!y&&"combobox"!==e&&"tags"!==e&&Object(R.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(R.b)(!h||d,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),null!=p){var C=Object(M.d)(p);Object(R.a)(!f||C.every((function(t){return"object"===Object(D.a)(t)&&("key"in t||"value"in t)})),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(R.a)(!v||Array.isArray(p),"`value` should be array when `mode` is `multiple` or `tags`")}if(r){var S=null;Object(w.a)(r).some((function(t){if(!s.isValidElement(t)||!t.type)return!1;var e=t.type;return!e.isSelectOption&&(e.isSelectOptGroup?!Object(w.a)(t.props.children).every((function(e){return!(s.isValidElement(e)&&t.type&&!e.type.isSelectOption)||(S=e.type,!1)})):(S=e,!0))})),S&&Object(R.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(S.displayName||S.name||S,"`.")),Object(R.a)(void 0===g,"`inputValue` is deprecated, please use `searchValue` instead.")}},_=Object(A.a)({prefixCls:"rc-select",components:{optionList:b},convertChildrenToData:O,flattenOptions:L.d,getLabeledValue:L.e,filterOptions:L.b,isValueDisabled:L.g,findValueOption:L.c,warningProps:I,fillOptionsWithMissingValue:L.a}),P=function(t){Object(o.a)(n,t);var e=Object(a.a)(n);function n(){var t;return Object(r.a)(this,n),(t=e.apply(this,arguments)).selectRef=s.createRef(),t.focus=function(){t.selectRef.current.focus()},t.blur=function(){t.selectRef.current.blur()},t}return Object(i.a)(n,[{key:"render",value:function(){return s.createElement(_,Object.assign({ref:this.selectRef},this.props))}}]),n}(s.Component);P.Option=C,P.OptGroup=E;var N=P;e.c=N},M8RZ:
/*!**********************************!*\
!*** ./src/components/modal.tsx ***!
\**********************************/
/*! exports provided: default */
/*! exports used: default */function(t,e,n){"use strict";n.d(e,"a",(function(){return u}));var r=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/classCallCheck */"fWQN"),i=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/createClass */"mtLc"),o=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/inherits */"yKVA"),a=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/createSuper */"879j"),s=n(/*! react */"q1tI"),l=n.n(s),c=n(/*! react-dom */"i8i4"),u=function(t){Object(o.a)(n,t);var e=Object(a.a)(n);function n(t){var i;Object(r.a)(this,n),i=e.call(this,t);var o=window.document;return i.node=o.createElement("div"),o.body.appendChild(i.node),i}return Object(i.a)(n,[{key:"render",value:function(){var t=this.props.children;return Object(c.createPortal)(t,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),n}(l.a.Component)},NvD2:
/*!******************************************************!*\
!*** ./node_modules/rc-tree/es/utils/conductUtil.js ***!
\******************************************************/
/*! exports provided: isCheckDisabled, conductCheck */
/*! exports used: conductCheck */function(t,e,n){"use strict";n.d(e,"a",(function(){return a}));var r=n(/*! rc-util/es/warning */"Kwbf");function i(t,e){var n=new Set;return t.forEach((function(t){e.has(t)||n.add(t)})),n}function o(t){var e=t||{},n=e.disabled,r=e.disableCheckbox,i=e.checkable;return!(!n&&!r)||!1===i}function a(t,e,n,a){var s,l=[];s=a||o;var c=new Set(t.filter((function(t){var e=!!n[t];return e||l.push(t),e}))),u=new Map,h=0;return Object.keys(n).forEach((function(t){var e=n[t],r=e.level,i=u.get(r);i||(i=new Set,u.set(r,i)),i.add(e),h=Math.max(h,r)})),Object(r.a)(!l.length,"Tree missing follow keys: ".concat(l.slice(0,100).map((function(t){return"'".concat(t,"'")})).join(", "))),!0===e?function(t,e,n,r){for(var o=new Set(t),a=new Set,s=0;s<=n;s+=1){(e.get(s)||new Set).forEach((function(t){var e=t.key,n=t.node,i=t.children,a=void 0===i?[]:i;o.has(e)&&!r(n)&&a.filter((function(t){return!r(t.node)})).forEach((function(t){o.add(t.key)}))}))}for(var l=new Set,c=n;c>=0;c-=1){(e.get(c)||new Set).forEach((function(t){var e=t.parent,n=t.node;if(!r(n)&&t.parent&&!l.has(t.parent.key))if(r(t.parent.node))l.add(e.key);else{var i=!0,s=!1;(e.children||[]).filter((function(t){return!r(t.node)})).forEach((function(t){var e=t.key,n=o.has(e);i&&!n&&(i=!1),s||!n&&!a.has(e)||(s=!0)})),i&&o.add(e.key),s&&a.add(e.key),l.add(e.key)}}))}return{checkedKeys:Array.from(o),halfCheckedKeys:Array.from(i(a,o))}}(c,u,h,s):function(t,e,n,r,o){for(var a=new Set(t),s=new Set(e),l=0;l<=r;l+=1){(n.get(l)||new Set).forEach((function(t){var e=t.key,n=t.node,r=t.children,i=void 0===r?[]:r;a.has(e)||s.has(e)||o(n)||i.filter((function(t){return!o(t.node)})).forEach((function(t){a.delete(t.key)}))}))}s=new Set;for(var c=new Set,u=r;u>=0;u-=1){(n.get(u)||new Set).forEach((function(t){var e=t.parent,n=t.node;if(!o(n)&&t.parent&&!c.has(t.parent.key))if(o(t.parent.node))c.add(e.key);else{var r=!0,i=!1;(e.children||[]).filter((function(t){return!o(t.node)})).forEach((function(t){var e=t.key,n=a.has(e);r&&!n&&(r=!1),i||!n&&!s.has(e)||(i=!0)})),r||a.delete(e.key),i&&s.add(e.key),c.add(e.key)}}))}return{checkedKeys:Array.from(a),halfCheckedKeys:Array.from(i(s,a))}}(c,e.halfCheckedKeys,u,h,s)}},OZM5:
/*!*****************************************!*\
!*** ./node_modules/rc-tree/es/util.js ***!
\*****************************************/
/*! exports provided: arrDel, arrAdd, posToArr, getPosition, isTreeNode, getDragNodesKeys, calcDropPosition, calcSelectedKeys, convertDataToTree, parseCheckedKeys, conductExpandParent, getDataAndAria */
/*! exports used: arrAdd, arrDel, calcDropPosition, calcSelectedKeys, conductExpandParent, getDataAndAria, getDragNodesKeys, getPosition, isTreeNode, parseCheckedKeys, posToArr */function(t,e,n){"use strict";n.d(e,"b",(function(){return a})),n.d(e,"a",(function(){return s})),n.d(e,"k",(function(){return l})),n.d(e,"h",(function(){return c})),n.d(e,"i",(function(){return u})),n.d(e,"g",(function(){return h})),n.d(e,"c",(function(){return d})),n.d(e,"d",(function(){return f})),n.d(e,"j",(function(){return p})),n.d(e,"e",(function(){return g})),n.d(e,"f",(function(){return m}));var r=n(/*! @babel/runtime/helpers/esm/toConsumableArray */"KQm4"),i=n(/*! @babel/runtime/helpers/esm/typeof */"U8pU"),o=(n(/*! @babel/runtime/helpers/esm/objectWithoutProperties */"Ff2n"),n(/*! react */"q1tI"),n(/*! rc-util/es/warning */"Kwbf"));n(/*! ./TreeNode */"WaYH");function a(t,e){var n=t.slice(),r=n.indexOf(e);return r>=0&&n.splice(r,1),n}function s(t,e){var n=t.slice();return-1===n.indexOf(e)&&n.push(e),n}function l(t){return t.split("-")}function c(t,e){return"".concat(t,"-").concat(e)}function u(t){return t&&t.type&&t.type.isTreeNode}function h(t,e){var n=[t];return function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.forEach((function(e){var r=e.key,i=e.children;n.push(r),t(i)}))}(e[t].children),n}function d(t,e){var n=t.clientY,r=e.selectHandle.getBoundingClientRect(),i=r.top,o=r.bottom,a=r.height,s=Math.max(.25*a,2);return n<=i+s?-1:n>=o-s?1:0}function f(t,e){if(t)return e.multiple?t.slice():t.length?[t[0]]:t}function p(t){if(!t)return null;var e;if(Array.isArray(t))e={checkedKeys:t,halfCheckedKeys:void 0};else{if("object"!==Object(i.a)(t))return Object(o.a)(!1,"`checkedKeys` is not an array or an object"),null;e={checkedKeys:t.checked||void 0,halfCheckedKeys:t.halfChecked||void 0}}return e}function g(t,e){var n=new Set;return(t||[]).forEach((function(t){!function t(r){if(!n.has(r)){var i=e[r];if(i){n.add(r);var o=i.parent;i.node.disabled||o&&t(o.key)}}}(t)})),Object(r.a)(n)}function m(t){var e={};return Object.keys(t).forEach((function(n){(n.startsWith("data-")||n.startsWith("aria-"))&&(e[n]=t[n])})),e}},Ot1p:
/*!**************************************************************!*\
!*** ./src/components/markdown-editor/index.tsx + 6 modules ***!
\**************************************************************/
/*! exports provided: default */
/*! exports used: default */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/defineProperty.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/extends.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/regenerator/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./src/components/RenderHtml/index.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/components/markdown-editor/code-block/index.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/components/modal.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/components/useInterval.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/pages/tasks/util.js because of ./src/pages/tasks/index.jsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/env.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/fetch.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/util.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/button/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/button/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/form/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/form/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/input-number/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/input-number/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/input/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/input/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/message/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/message/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/modal/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/modal/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/popover/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/popover/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/radio/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/radio/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/codemirror/lib/codemirror.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/qrcode.react/lib/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js (<- Module uses injected variables (global)) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/uuid/dist/esm-browser/v4.js */function(t,e,n){"use strict";n("2qtc");var r=n("kLXV"),i=n("rAM+"),o=(n("miYZ"),n("tsqr")),a=n("9og8"),s=n("tJVT"),l=n("jrin"),c=n("WmNS"),u=n.n(c),h=n("q1tI"),d=n.n(h),f=n("VrN/"),p=n.n(f),g=n("bdgK"),m=(n("p77/"),n("Bd2K"),n("ELLl"),n("19Vz"),n("lZu9"),n("+NIl"),n("kSUc"),n("9Bee")),v=function(t){var e=t.value,n=void 0===e?"":e,r=(t.className,t.showTextOnly,t.showLines,t.style,Object(h.useMemo)((function(){return""}),[n]));return d.a.createElement(d.a.Fragment,null,d.a.createElement("div",{dangerouslySetInnerHTML:{__html:r}}))},y=(n("Q9mQ"),n("diRs")),b=n("0Owb"),x=(n("dejd"),n("C+DQ"),n("D1Df")),C=n.n(x),S=n("1vsH"),E=n("m3rI"),k=[{title:"粗体",icon:"icon-bold",actionName:"bold"},{title:"斜体",icon:"icon-italic",actionName:"italic"},"|",{title:"无序列表",icon:"icon-unorder-list",actionName:"list-ul"},{title:"有序列表",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"行内代码",icon:"icon-code",actionName:"code"},{title:"代码块(多语言风格)",icon:"icon-file-code",actionName:"code-block"},{title:"链接",icon:"icon-link",actionName:"link"},"|",{title:"行内公式",icon:"icon-sum",actionName:"inline-latex"},{title:"多行公式",icon:"icon-formula",actionName:"latex"},"|",{title:"添加图片",icon:"icon-picture",actionName:"upload-image"},{title:"表格",icon:"icon-table",actionName:"add-table"},"|",{title:"换行",icon:"icon-minus",actionName:"line-break"},{title:"清空",icon:"icon-eraser",actionName:"eraser"}];function w(t){var e=t.onActionCallback,n=t.title,r=t.icon,i=t.actionName,o=t.className,a=void 0===o?"":o,s=t.children;return d.a.createElement("a",{title:n,className:a,onClick:function(){e(i)}},d.a.createElement("i",{className:"md-iconfont ".concat(r)}),s)}var T=function(t){var e=t.watch,n=t.showNullButton,r=t.onActionCallback,i=t.fullScreen,o=t.insertTemp,a=t.hidetoolBar,s=t.uuid,l=t.setOpenPhones,c=Object(S.E)("_educoder_session_login"),u=Object(S.E)("_educoder_session"),h=[].concat(k,[{title:"".concat(e?"关闭实时预览":"开启实时预览"),icon:"".concat(e?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return d.a.createElement("ul",{className:"markdown-toolbar-container"},!a&&h.map((function(t,e){return d.a.createElement("li",{key:e},t.actionName?d.a.createElement(w,Object(b.a)({},t,{onActionCallback:r})):d.a.createElement("span",{className:"v-line"}))})),n?d.a.createElement("li",null,d.a.createElement(w,{icon:"icon-edit",className:"btn-null",title:"增加填空",actionName:"add-null-ch",onActionCallback:r},d.a.createElement("span",{className:"fill-tip"},"点击插入\b填空项"))):null,o&&d.a.createElement("li",null,d.a.createElement(w,{icon:"icon-edit",className:"btn-null",title:"插入模板",actionName:"inster-template-".concat(o),onActionCallback:r},d.a.createElement("span",{className:"fill-tip"},"插入模板"))),d.a.createElement("li",null,d.a.createElement(y.a,{title:"打开手机扫一扫",content:d.a.createElement("div",null,d.a.createElement("span",{style:{display:"none"}},"test----",location.origin+"/upload.html?_educoder_session_login="+c+"&_educoder_session="+u+"&key="+s+"&api="+encodeURIComponent(E.a.API_SERVER)),d.a.createElement(C.a,{size:150,fgColor:"#000",value:location.origin+"/upload.html?_educoder_session_login="+c+"&_educoder_session="+u+"&key="+s+"&api="+encodeURIComponent(E.a.API_SERVER)}))},d.a.createElement("span",{className:"fill-tip",onMouseOver:function(){return l(!0)}},"手机上传文件"))),d.a.createElement("li",{className:"btn-full-screen"},d.a.createElement(w,{icon:"".concat(i?"icon-shrink":"icon-enlarge"),title:i?"关闭全屏":"开启全屏",actionName:"trigger-full-screen",onActionCallback:r})))},O=n("M8RZ"),L=(n("+L6B"),n("2/Rp")),A=(n("y8nQ"),n("Vl3Y")),D=(n("5NDa"),n("5rEg")),R={labelCol:{span:4},wrapperCol:{span:20}},M=function(t){var e=t.callback,n=t.onCancel;return d.a.createElement(A.a,Object(b.a)({},R,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:function(t){e(t)}}),d.a.createElement(A.a.Item,{label:"链接地址",name:"link",rules:[{required:!0,message:"请输入链接地址"}]},d.a.createElement(D.a,null)),d.a.createElement(A.a.Item,{label:"链接标题",name:"title",rules:[{required:!0,message:"请输入链接标题"}]},d.a.createElement(D.a,null)),d.a.createElement("div",{className:"flex-container flex-end"},d.a.createElement(L.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"确定"),d.a.createElement(L.a,{type:"ghost",onClick:n},"取消")))},I=n("7ahc"),_=n("k1fw"),P=(n("HmJG"),n("BjJ7")),N=A.a.useForm,j={width:280,marginRight:10},F={labelCol:{span:5},wrapperCol:{span:19}},B=function(t){var e=t.callback,n=t.onCancel,r=N(),i=Object(s.a)(r,1)[0],o=Object(h.useRef)();function a(t,e){i.setFieldsValue({src:"/api/attachments/".concat(t.id,"?type=").concat(t.content_type),type:e.type})}return d.a.createElement(A.a,Object(b.a)({form:i},F,{className:"upload-image-panel",onFinish:function(t){e(Object(_.a)(Object(_.a)({},t),{},{name:o.current}))}}),d.a.createElement(A.a.Item,{label:"文件地址",required:!0},d.a.createElement("div",{className:"flex-container"},d.a.createElement(A.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"请输入文件地址"}]},d.a.createElement(D.a,{style:j})),d.a.createElement(U,{onFileChange:function(t){var e=t.target.files[0];o.current=e.name,H(e,a)}}))),d.a.createElement(A.a.Item,{label:"文件描述",name:"alt"},d.a.createElement(D.a,{style:{width:264}})),d.a.createElement(A.a.Item,{style:{textAlign:"right"}},d.a.createElement(L.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"确定"),d.a.createElement(L.a,{type:"ghost",onClick:n},"取消")))};function U(t){var e=t.onFileChange;return d.a.createElement("a",{className:"upload-button"},"本地上传",d.a.createElement("input",{type:"file",onChange:e}))}function H(t,e){if(!t)throw new String("没有文件");var n=new FormData;n.append("editormd-image-file",t),n.append("file_param_name","editormd-image-file"),n.append("byxhr","true");var r=new window.XMLHttpRequest;r.withCredentials=!0,r.addEventListener("load",(function(n){e(JSON.parse(n.target.responseText),t)}),!1),r.addEventListener("error",(function(t){console.error(t)}),!1),r.open("POST","".concat(P.a,"/api/attachments.json")),r.send(n)}n("giR+");var z,G,V=n("fyUT"),W=(n("7Kak"),n("9yH6")),K=W.a.Group,q={margin:"0 8px"},Y=function(t){var e=t.callback,n=t.onCancel;return d.a.createElement(A.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:function(t){e(t)}},d.a.createElement("div",{className:"flex-container"},d.a.createElement("span",{style:q},"单元格数:"),d.a.createElement("span",{style:q},"行数"),d.a.createElement(A.a.Item,{name:"row",rules:[{required:!0,message:"请输入行数"}]},d.a.createElement(V.a,null)),d.a.createElement("span",{style:q},"列数"),d.a.createElement(A.a.Item,{name:"col",rules:[{required:!0,message:"请输入列数"}]},d.a.createElement(V.a,null))),d.a.createElement("div",{className:"flex-container",style:{marginTop:12}},d.a.createElement("span",{style:q},"对齐方式:"),d.a.createElement(A.a.Item,{name:"align"},d.a.createElement(K,null,d.a.createElement(W.a,{value:"default"},d.a.createElement("i",{className:"fa fa-align-justify"})),d.a.createElement(W.a,{value:"left"},d.a.createElement("i",{className:"fa fa-align-left"})),d.a.createElement(W.a,{value:"center"},d.a.createElement("i",{className:"fa fa-align-center"})),d.a.createElement(W.a,{value:"right"},d.a.createElement("i",{className:"fa fa-align-right"}))))),d.a.createElement("div",{className:"flex-container flex-end"},d.a.createElement(L.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"确定"),d.a.createElement(L.a,{type:"ghost",onClick:n},"取消")))},X=n("ErOA"),$=n("7Cbv"),Z="------------",J={default:Z,left:":".concat(Z),center:":".concat(Z,":"),right:"".concat(Z,":")},Q=n("9VGf");function tt(t){return/^\d+$/.test(t)?"".concat(t,"px"):t}var et=navigator.platform.toUpperCase().indexOf("MAC")>=0?"Cmd":"Ctrl",nt=["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"],rt=(z={},Object(l.a)(z,et+"-B","bold"),Object(l.a)(z,et+"-I","italic"),z),it=(G={},Object(l.a)(G,"link","添加链接"),Object(l.a)(G,"code-block","添加代码块"),Object(l.a)(G,"upload-image","添加文件"),Object(l.a)(G,"add-table","添加表格"),G);e.a=function(t){var e=t.defaultValue,n=void 0===e?"":e,c=t.onChange,f=t.width,y=void 0===f?"100%":f,b=t.height,x=void 0===b?400:b,C=t.miniToolbar,S=void 0!==C&&C,k=t.isFocus,w=void 0!==k&&k,L=t.watch,A=t.insertTemp,D=t.mode,R=void 0===D?"markdown":D,_=t.id,P=void 0===_?"markdown-editor-id":_,N=t.showResizeBar,j=void 0!==N&&N,F=t.noStorage,U=void 0!==F&&F,z=t.showNullButton,G=void 0!==z&&z,V=t.hidetoolBar,W=void 0!==V&&V,K=t.fullScreen,q=void 0!==K&&K,Z=t.onBlur,et=t.onCMBeforeChange,ot=t.onFullScreen,at=t.className,st=void 0===at?"":at,lt=t.disablePaste,ct=void 0!==lt&&lt,ut=t.placeholder,ht=void 0===ut?"":ut,dt=t.values,ft=void 0===dt?"":dt,pt=Object(h.useState)(null),gt=Object(s.a)(pt,2),mt=gt[0],vt=gt[1],yt=Object(h.useState)(n),bt=Object(s.a)(yt,2),xt=bt[0],Ct=bt[1],St=Object(h.useState)(L),Et=Object(s.a)(St,2),kt=Et[0],wt=Et[1],Tt=Object(h.useState)(q),Ot=Object(s.a)(Tt,2),Lt=Ot[0],At=Ot[1],Dt=Object(h.useState)(""),Rt=Object(s.a)(Dt,2),Mt=Rt[0],It=Rt[1],_t=Object(h.useState)(0),Pt=Object(s.a)(_t,2),Nt=Pt[0],jt=Pt[1],Ft=Object(h.useState)(x),Bt=Object(s.a)(Ft,2),Ut=Bt[0],Ht=Bt[1],zt=Object(h.useState)(!1),Gt=Object(s.a)(zt,2),Vt=(Gt[0],Gt[1]),Wt=Object(h.useRef)(Object($.a)()),Kt=Object(h.useRef)(!1),qt=Object(h.useRef)(),Yt=Object(h.useRef)(),Xt=Object(h.useRef)(),$t=Object(h.useRef)(),Zt=Object(h.useRef)(),Jt=function(){var t=Object(a.a)(u.a.mark((function t(){var e,n;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(X.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Wt.current}});case 2:null!=(n=t.sent)&&null!==(e=n.attachments)&&void 0!==e&&e.length&&(console.log("cm:",mt,Yt),n.attachments.map((function(t){t.content_type.indexOf("image")>-1?mt.replaceSelection("![,](/api/attachments/".concat(t.id,"?type=").concat(t.content_type,")")):t.content_type.indexOf("video")>-1?mt.replaceSelection('<video width="100%" controls src="'.concat(E.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):t.content_type.indexOf("pdf")>-1?mt.replaceSelection('<a href="'.concat(E.a.API_SERVER,"/api/attachments/").concat(t.id,"?type=").concat(t.content_type,'&disposition=inline" target="_blank">').concat(t.name,"</a>")):mt.replaceSelection("[".concat(t.name,"](").concat(E.a.API_SERVER,"/api/attachments/").concat(t.id,"?type=").concat(t.content_type,")"))})));case 4:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();Object(h.useEffect)((function(){Ct(ft),null==mt||mt.setValue(ft)}),[ft]),Object(h.useEffect)((function(){null==ot||ot(Lt)}),[Lt]),Object(h.useEffect)((function(){if(Yt.current){var t=p.a.fromTextArea(Yt.current,{mode:R,lineNumbers:!S,lineWrapping:!0,value:n,autoCloseTags:!0,autoCloseBrackets:!0});function e(e,n){if(!ct){var r=n.clipboardData;if(r){var i=r.types.toString(),a=r.items;if("Files"===i||r.types.indexOf("Files")>-1){if(n.preventDefault(),"stex"==R)return;try{var s,l=a[1];"file"===(null===(s=a[0])||void 0===s?void 0:s.kind)&&(l=a[0]);var c=l.getAsFile(),u=c.name.split(".").pop();H(c,(function(e){var n,r,i;e.id?(null==c||null===(n=c.type)||void 0===n?void 0:n.indexOf("image"))>-1?t.replaceSelection("![,](/api/attachments/".concat(e.id,"?type=").concat(e.content_type,")")):(null==c||null===(r=c.type)||void 0===r?void 0:r.indexOf("video"))>-1?t.replaceSelection('<video width="100%" controls src="'.concat(E.a.API_SERVER,"/api/attachments/").concat(e.id,'"></video>')):(null==c||null===(i=c.type)||void 0===i?void 0:i.indexOf("pdf"))>-1?t.replaceSelection('<a href="'.concat(E.a.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(c.type,'&disposition=inline" target="_blank">').concat(c.name,"</a>")):nt.includes(u)?t.replaceSelection('<a href="'.concat(E.a.API_SERVER,"/api/attachments/").concat(e.id,'?type=office&disposition=inline" target="_blank">').concat(c.name,"</a>")):t.replaceSelection("[".concat(c.name,"](").concat(E.a.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(e.content_type,")")):401===(null==e?void 0:e.status)&&(document.location.href="/user/login")}))}catch(n){o.b.warn("请使用chrome浏览器粘贴")}return!0}return!0}return!0}n.preventDefault()}return w&&t.focus(),t.on("paste",e),t.on("dragleave",(function(t,e){Xt.current.classList.remove("mouse-hover-md")})),t.on("dragover",(function(t,e){Xt.current.classList.add("mouse-hover-md")})),t.on("drop",(function(e,n){var r;if(Xt.current.classList.add("mouse-hover-md"),(r=n.dataTransfer.files).length>0){n.preventDefault(),n.stopPropagation();for(var i=function(e){var n=r[e],i=n.name.split(".").pop();H(n,(function(e){var r,o,a;e.id?(null==n||null===(r=n.type)||void 0===r?void 0:r.indexOf("image"))>-1?t.replaceSelection("![,](/api/attachments/".concat(e.id,"?type=").concat(e.content_type,")")):(null==n||null===(o=n.type)||void 0===o?void 0:o.indexOf("video"))>-1?t.replaceSelection('<video width="100%" controls src="'.concat(E.a.API_SERVER,"/api/attachments/").concat(e.id,'"></video>')):(null==n||null===(a=n.type)||void 0===a?void 0:a.indexOf("pdf"))>-1?t.replaceSelection('<a href="'.concat(E.a.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(n.type,'&disposition=inline" target="_blank">').concat(n.name,"</a>")):nt.includes(i)?t.replaceSelection('<a href="'.concat(E.a.API_SERVER,"/api/attachments/").concat(e.id,'?type=office&disposition=inline" target="_blank">').concat(n.name,"</a>")):t.replaceSelection("[".concat(n.name,"](").concat(E.a.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(e.content_type,")")):401===(null==e?void 0:e.status)&&(document.location.href="/user/login")}))},o=0;o<r.length;o++)i(o)}})),vt(t),function(){t.off("paste",e)}}}),[]);var Qt=Object(h.useCallback)((function(){Xt.current}),[Ut,Xt,Lt]);Object(h.useEffect)((function(){if(mt){var t=function(){var t=new g.default((function(t){var e,n=Object(i.a)(t);try{for(n.s();!(e=n.n()).done;){var r=e.value;(r.target.offsetHeight>0||r.target.offsetWidth>0)&&(Qt(),mt.setSize("100%","100%"),mt.refresh())}}catch(t){n.e(t)}finally{n.f()}}));return t.observe(Yt.current.parentElement),t}();return function(){t.unobserve(Yt.current.parentElement)}}}),[mt,Qt]),Object(h.useEffect)((function(){if(mt){for(var t=[],e=function(){var e=r[n],i=(o=Object(s.a)(e,2))[0],a=o[1],c=Object(l.a)({},i,(function(){te(a)}));t.push(c),mt.addKeyMap(c)},n=0,r=Object.entries(rt);n<r.length;n++){var o;e()}return qt.current=setInterval((function(){Kt.current&&Jt()}),4e3),function(){clearInterval(qt.current);var e,n=Object(i.a)(t);try{for(n.s();!(e=n.n()).done;){var r=e.value;mt.removeKeyMap(r)}}catch(t){n.e(t)}finally{n.f()}}}}),[mt]),Object(h.useEffect)((function(){q!==Lt&&At(q)}),[q]),Object(Q.a)((function(){if(!U&&Nt>0){var t=(new Date).getTime(),e=window.sessionStorage.getItem(P);t>=Nt+1e4&&(!e||e!==xt)&&(window.sessionStorage.setItem(P,xt),Vt(!0))}}),1e4),Object(h.useEffect)((function(){wt(L)}),[mt,L]),Object(h.useEffect)((function(){mt&&w&&mt.focus()}),[mt,w]),Object(h.useEffect)((function(){if(kt&&mt){var t=mt.getScrollerElement();function e(t){var e=t.target;if(Zt.current){var n=e.scrollTop/e.scrollHeight;Zt.current.scrollTop=Zt.current.scrollHeight*n}}return t.addEventListener("scroll",e),function(){t.removeEventListener("scroll",e)}}}),[mt,kt]),Object(h.useEffect)((function(){if(mt&&et){function t(t,e){et(t,e)}return mt.on("beforeChange",t),function(){mt.off("beforeChange",t)}}}),[mt,et]),Object(h.useEffect)((function(){if(mt&&Z){function t(){Z(mt.getValue())}return mt.on("blur",t),function(){mt.off("blur",t)}}}),[mt,Z]),Object(h.useEffect)((function(){if(mt){function t(t){var e=t.getValue();Ct(e),jt((new Date).getTime()),t.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),c&&c(e)}return mt.on("change",t),function(){mt.off("change",t)}}}),[mt,c]),Object(h.useEffect)((function(){mt&&(null==n?(mt.setValue(""),Ct("")):n!==mt.getValue()&&(mt.setValue(n),Ct(n),mt.setCursor(mt.lineCount(),0)))}),[mt,n]);var te=Object(h.useCallback)((function(t){var e=mt.getCursor(),n=mt.getSelection(),r=n.split("\n");switch(t){case"bold":return mt.replaceSelection("**"+n+"**"),""===n&&mt.setCursor(e.line,e.ch+2),mt.focus();case"italic":return mt.replaceSelection("*"+n+"*"),""===n&&mt.setCursor(e.line,e.ch+1),mt.focus();case"code":return mt.replaceSelection("`"+n+"`"),""===n&&mt.setCursor(e.line,e.ch+1),mt.focus();case"inline-latex":return mt.replaceSelection("`$$"+n+"$$`"),""===n&&mt.setCursor(e.line,e.ch+3),mt.focus();case"latex":return mt.replaceSelection("```latex\n"+n+"\n```"),mt.setCursor(e.line+1,n.length+1),mt.focus();case"line-break":return mt.replaceSelection("<br/>\n"),mt.focus();case"list-ul":return""===n?mt.replaceSelection("- "+n):mt.replaceSelection(r.map((function(t){return""===t?"":"- ".concat(t)})).join("\n")),mt.focus();case"list-ol":return""===n?mt.replaceSelection("1. "+n):mt.replaceSelection(r.map((function(t,e){return""===t?"":"".concat(e+1,". ").concat(t)})).join("\n")),mt.focus();case"add-null-ch":return""===n&&mt.setCursor(e.line,e.ch+1),mt.replaceSelection("▁"),mt.focus();case"inster-template-1":return""===n&&mt.setCursor(e.line,e.ch),mt.replaceSelection("\n**模板标题**\n模板正文内容可输入文本内容和粘贴图片等操作"),mt.focus();case"eraser":return mt.setValue(""),mt.focus();case"trigger-watch":return wt(!kt),mt.focus();case"trigger-full-screen":return At(!Lt),mt.focus();case"link":return void It("link");case"code-block":return void It("code-block");case"upload-image":return void It("upload-image");case"add-table":return void It("add-table");default:throw new Error}}),[mt,kt,Lt]),ee=Object(h.useCallback)((function(t){switch(It(""),Mt){case"link":var e=t.title,n=t.link;return mt.replaceSelection("[".concat(e,"](").concat(n,")")),mt.focus();case"code-block":var r=t.language,i=t.content;return mt.replaceSelection(["```"+r,i,"```"].join("\n")),mt.focus();case"upload-image":var o=t.src,a=t.alt,s=t.name;return o.indexOf("type=image")>-1?mt.replaceSelection("![ ".concat(a||""," ]( ").concat(o,' "').concat(a||"",'" )')):o.indexOf("type=application/pdf")>-1?mt.replaceSelection('<a href="'.concat(o,'&disposition=inline" target="_blank">').concat(s,"</a>")):mt.replaceSelection('<a href="'.concat(o,'" target="_blank">').concat(s,"</a>")),mt.focus();case"add-table":for(var l=t.row,c=t.col,u=t.align,h="\n",d=0;d<l;d++){for(var f=[],p=[],g=0;g<c;g++)1===d&&p.push(J[u]),f.push(" ");1===d&&(h+="| ".concat(p.join(" | ")," |\n")),h+="| ".concat(f.join(1===c?"":" | ")," |\n")}return mt.replaceSelection(h+"\n"),mt.focus();default:throw new Error}}),[mt,Mt]),ne=Object(h.useMemo)((function(){switch(Mt){case"link":return d.a.createElement(M,{callback:ee,onCancel:re});case"code-block":return d.a.createElement(I.b,{callback:ee,onCancel:re});case"upload-image":return d.a.createElement(B,{callback:ee,onCancel:re});case"add-table":return d.a.createElement(Y,{callback:ee,onCancel:re});default:return null}}),[Mt]);function re(){It("")}Object(h.useEffect)((function(){if($t.current){var t=$t.current,e=!1,n=0;function r(t){e=!0,n=t.pageY}function i(){e=!1}function o(t){if(e){var r=t.pageY-n;r<0&&(r=0),r>300&&(r=300),Ht(x+r+"px")}}return t.addEventListener("mousedown",r),document.addEventListener("mousemove",o),document.addEventListener("mouseup",i),function(){t.removeEventListener("mousedown",r),document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",i)}}}),[mt,$t]),Object(h.useEffect)((function(){Ht(x)}),[x]);var ie={width:tt(y),height:tt(Ut)};Object(h.useMemo)((function(){if(Nt){var t=new Date(Nt),e=t.getHours(),n=t.getMinutes(),r=t.getSeconds();return n=n<10?"0"+n:n,r=r<10?"0"+r:r,"".concat(e=e<10?"0"+e:e,":").concat(n,":").concat(r)}return 0}),[Nt]);return d.a.createElement(h.Fragment,null,d.a.createElement("div",{className:"markdown-editor-wrapper",ref:Xt},d.a.createElement("div",{className:"markdown-editor-container ".concat(st," ").concat(kt?"on-preview":""," ").concat(S?"mini":""," ").concat(Lt?"full-screen":""),style:ie},d.a.createElement(T,{insertTemp:A,watch:kt,fullScreen:Lt,showNullButton:G,onActionCallback:te,hidetoolBar:W,uuid:Wt.current,setOpenPhones:function(){Kt.current=!0}}),d.a.createElement("div",{className:"markdown-editor-body"},d.a.createElement("div",{className:"codemirror-container"},d.a.createElement("textarea",{ref:Yt,placeholder:ht})),kt?d.a.createElement("div",{ref:Zt,className:"preview-container"},"stex"===R&&d.a.createElement(v,{value:xt}),"stex"!==R&&d.a.createElement(m.a,{edit:!0,value:xt,replaces:function(t,e){var n=mt.getValue();n=n.replace(t,e),Ct(n),null==mt||mt.setValue(n)}})):null))),j?d.a.createElement("a",{ref:$t,className:"editor-resize"}):null,d.a.createElement(O.a,null,it[Mt]?d.a.createElement(r.a,{centered:!0,title:it[Mt],visible:!0,onCancel:re,footer:null},ne):null))}},"SA+Z":
/*!********************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/toArray.js ***!
\********************************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r=n(/*! ./arrayWithHoles.js */"wTVA"),i=n(/*! ./iterableToArray.js */"EbDI"),o=n(/*! ./unsupportedIterableToArray.js */"ZhPi"),a=n(/*! ./nonIterableRest.js */"wkBT");t.exports=function(t){return r(t)||i(t)||o(t)||a()},t.exports.__esModule=!0,t.exports.default=t.exports},SJMd:
/*!****************************************************!*\
!*** ./node_modules/code-prettify/src/prettify.js ***!
\****************************************************/
/*! no static exports found */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e){window.PR_SHOULD_USE_CONTINUATION=!0,function(){var t=window,e=["break,continue,do,else,for,if,return,while"],n=[[e,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],r=[n,"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"],i=[n,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],o=[n,"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"],a=[n,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],s="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",l=[e,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],c=[e,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],u=[e,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],h=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/;function d(t,e,n,r,i){if(n){var o={sourceNode:t,pre:1,langExtension:null,numberLines:null,sourceCode:n,spans:null,basePos:e,decorations:null};r(o),i.push.apply(i,o.decorations)}}var f=/\S/;function p(t){for(var e=void 0,n=t.firstChild;n;n=n.nextSibling){var r=n.nodeType;e=1===r?e?t:n:3===r&&f.test(n.nodeValue)?t:e}return e===t?void 0:e}function g(t,e){var n,r={};!function(){for(var i=t.concat(e),o=[],a={},s=0,l=i.length;s<l;++s){var c=i[s],u=c[3];if(u)for(var h=u.length;--h>=0;)r[u.charAt(h)]=c;var d=c[1],f=""+d;a.hasOwnProperty(f)||(o.push(d),a[f]=null)}o.push(/[\0-\uffff]/),n=function(t){for(var e=0,n=!1,r=!1,i=0,o=t.length;i<o;++i){if((d=t[i]).ignoreCase)r=!0;else if(/[a-z]/i.test(d.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){n=!0,r=!1;break}}var a={b:8,t:9,n:10,v:11,f:12,r:13};function s(t){var e=t.charCodeAt(0);if(92!==e)return e;var n=t.charAt(1);return(e=a[n])||("0"<=n&&n<="7"?parseInt(t.substring(1),8):"u"===n||"x"===n?parseInt(t.substring(2),16):t.charCodeAt(1))}function l(t){if(t<32)return(t<16?"\\x0":"\\x")+t.toString(16);var e=String.fromCharCode(t);return"\\"===e||"-"===e||"]"===e||"^"===e?"\\"+e:e}function c(t){var e=t.substring(1,t.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")),n=[],r="^"===e[0],i=["["];r&&i.push("^");for(var o=r?1:0,a=e.length;o<a;++o){var c=e[o];if(/\\[bdsw]/i.test(c))i.push(c);else{var u,h=s(c);o+2<a&&"-"===e[o+1]?(u=s(e[o+2]),o+=2):u=h,n.push([h,u]),u<65||h>122||(u<65||h>90||n.push([32|Math.max(65,h),32|Math.min(u,90)]),u<97||h>122||n.push([-33&Math.max(97,h),-33&Math.min(u,122)]))}}n.sort((function(t,e){return t[0]-e[0]||e[1]-t[1]}));var d=[],f=[];for(o=0;o<n.length;++o){(p=n[o])[0]<=f[1]+1?f[1]=Math.max(f[1],p[1]):d.push(f=p)}for(o=0;o<d.length;++o){var p=d[o];i.push(l(p[0])),p[1]>p[0]&&(p[1]+1>p[0]&&i.push("-"),i.push(l(p[1])))}return i.push("]"),i.join("")}function u(t){for(var r=t.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")),i=r.length,o=[],a=0,s=0;a<i;++a){if("("===(h=r[a]))++s;else if("\\"===h.charAt(0)){(u=+h.substring(1))&&(u<=s?o[u]=-1:r[a]=l(u))}}for(a=1;a<o.length;++a)-1===o[a]&&(o[a]=++e);for(a=0,s=0;a<i;++a){if("("===(h=r[a]))o[++s]||(r[a]="(?:");else if("\\"===h.charAt(0)){var u;(u=+h.substring(1))&&u<=s&&(r[a]="\\"+o[u])}}for(a=0;a<i;++a)"^"===r[a]&&"^"!==r[a+1]&&(r[a]="");if(t.ignoreCase&&n)for(a=0;a<i;++a){var h,d=(h=r[a]).charAt(0);h.length>=2&&"["===d?r[a]=c(h):"\\"!==d&&(r[a]=h.replace(/[a-zA-Z]/g,(function(t){var e=t.charCodeAt(0);return"["+String.fromCharCode(-33&e,32|e)+"]"})))}return r.join("")}var h=[];for(i=0,o=t.length;i<o;++i){var d;if((d=t[i]).global||d.multiline)throw new Error(""+d);h.push("(?:"+u(d)+")")}return new RegExp(h.join("|"),r?"gi":"g")}(o)}();var i=e.length,o=function(t){for(var a=t.sourceCode,s=t.basePos,l=t.sourceNode,c=[s,"pln"],u=0,h=a.match(n)||[],f={},p=0,g=h.length;p<g;++p){var m,v=h[p],y=f[v],b=void 0;if("string"==typeof y)m=!1;else{var x=r[v.charAt(0)];if(x)b=v.match(x[1]),y=x[0];else{for(var S=0;S<i;++S)if(x=e[S],b=v.match(x[1])){y=x[0];break}b||(y="pln")}!(m=y.length>=5&&"lang-"===y.substring(0,5))||b&&"string"==typeof b[1]||(m=!1,y="src"),m||(f[v]=y)}var E=u;if(u+=v.length,m){var k=b[1],w=v.indexOf(k),T=w+k.length;b[2]&&(w=(T=v.length-b[2].length)-k.length);var O=y.substring(5);d(l,s+E,v.substring(0,w),o,c),d(l,s+E+w,k,C(O,k),c),d(l,s+E+T,v.substring(T),o,c)}else c.push(s+E,y)}t.decorations=c};return o}function m(t){var e=[],n=[];t.tripleQuotedStrings?e.push(["str",/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""]):t.multiLineStrings?e.push(["str",/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):e.push(["str",/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"]),t.verbatimStrings&&n.push(["str",/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var r=t.hashComments;r&&(t.cStyleComments?(r>1?e.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):e.push(["com",/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),n.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):e.push(["com",/^#[^\r\n]*/,null,"#"])),t.cStyleComments&&(n.push(["com",/^\/\/[^\r\n]*/,null]),n.push(["com",/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var i=t.regexLiterals;if(i){var o=i>1?"":"\n\r",a=o?".":"[\\S\\s]",s="/(?=[^/*"+o+"])(?:[^/\\x5B\\x5C"+o+"]|\\x5C"+a+"|\\x5B(?:[^\\x5C\\x5D"+o+"]|\\x5C"+a+")*(?:\\x5D|$))+/";n.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+s+")")])}var l=t.types;l&&n.push(["typ",l]);var c=(""+t.keywords).replace(/^ | $/g,"");c.length&&n.push(["kwd",new RegExp("^(?:"+c.replace(/[\s,]+/g,"|")+")\\b"),null]),e.push(["pln",/^\s+/,null," \r\n\t "]);var u="^.[^\\s\\w.$@'\"`/\\\\]*";return t.regexLiterals&&(u+="(?!s*/)"),n.push(["lit",/^@[a-z_$][a-z_$@0-9]*/i,null],["typ",/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],["pln",/^[a-z_$][a-z_$@0-9]*/i,null],["lit",new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],["pln",/^\\[\s\S]?/,null],["pun",new RegExp(u),null]),g(e,n)}var v=m({keywords:[r,o,i,a,s,l,c,u],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function y(t,e,n){for(var r=/(?:^|\s)nocode(?:\s|$)/,i=/\r\n?|\n/,o=t.ownerDocument,a=o.createElement("li");t.firstChild;)a.appendChild(t.firstChild);var s=[a];function l(t){var e=t.nodeType;if(1!=e||r.test(t.className)){if((3==e||4==e)&&n){var a=t.nodeValue,s=a.match(i);if(s){var u=a.substring(0,s.index);t.nodeValue=u;var h=a.substring(s.index+s[0].length);if(h)t.parentNode.insertBefore(o.createTextNode(h),t.nextSibling);c(t),u||t.parentNode.removeChild(t)}}}else if("br"===t.nodeName)c(t),t.parentNode&&t.parentNode.removeChild(t);else for(var d=t.firstChild;d;d=d.nextSibling)l(d)}function c(t){for(;!t.nextSibling;)if(!(t=t.parentNode))return;for(var e,n=function t(e,n){var r=n?e.cloneNode(!1):e,i=e.parentNode;if(i){var o=t(i,1),a=e.nextSibling;o.appendChild(r);for(var s=a;s;s=a)a=s.nextSibling,o.appendChild(s)}return r}(t.nextSibling,0);(e=n.parentNode)&&1===e.nodeType;)n=e;s.push(n)}for(var u=0;u<s.length;++u)l(s[u]);e===(0|e)&&s[0].setAttribute("value",e);var h=o.createElement("ol");h.className="linenums";for(var d=Math.max(0,e-1|0)||0,f=(u=0,s.length);u<f;++u)(a=s[u]).className="L"+(u+d)%10,a.firstChild||a.appendChild(o.createTextNode(" ")),h.appendChild(a);t.appendChild(h)}var b={};function x(e,n){for(var r=n.length;--r>=0;){var i=n[r];b.hasOwnProperty(i)?t.console&&console.warn("cannot override language handler %s",i):b[i]=e}}function C(t,e){return t&&b.hasOwnProperty(t)||(t=/^\s*</.test(e)?"default-markup":"default-code"),b[t]}function S(e){var n,r,i,o,a,s,l,c=e.langExtension;try{var u=(n=e.sourceNode,r=e.pre,i=/(?:^|\s)nocode(?:\s|$)/,o=[],a=0,s=[],l=0,function t(e){var n=e.nodeType;if(1==n){if(i.test(e.className))return;for(var c=e.firstChild;c;c=c.nextSibling)t(c);var u=e.nodeName.toLowerCase();"br"!==u&&"li"!==u||(o[l]="\n",s[l<<1]=a++,s[l++<<1|1]=e)}else if(3==n||4==n){var h=e.nodeValue;h.length&&(h=r?h.replace(/\r\n?/g,"\n"):h.replace(/[ \t\r\n]+/g," "),o[l]=h,s[l<<1]=a,a+=h.length,s[l++<<1|1]=e)}}(n),{sourceCode:o.join("").replace(/\n$/,""),spans:s}),h=u.sourceCode;e.sourceCode=h,e.spans=u.spans,e.basePos=0,C(c,h)(e),function(t){var e=/\bMSIE\s(\d+)/.exec(navigator.userAgent);e=e&&+e[1]<=8;var n,r,i=/\n/g,o=t.sourceCode,a=o.length,s=0,l=t.spans,c=l.length,u=0,h=t.decorations,d=h.length,f=0;for(h[d]=a,r=n=0;r<d;)h[r]!==h[r+2]?(h[n++]=h[r++],h[n++]=h[r++]):r+=2;for(d=n,r=n=0;r<d;){for(var p=h[r],g=h[r+1],m=r+2;m+2<=d&&h[m+1]===g;)m+=2;h[n++]=p,h[n++]=g,r=m}d=h.length=n;var v=t.sourceNode,y="";v&&(y=v.style.display,v.style.display="none");try{for(;u<c;){l[u];var b,x=l[u+2]||a,C=h[f+2]||a,S=(m=Math.min(x,C),l[u+1]);if(1!==S.nodeType&&(b=o.substring(s,m))){e&&(b=b.replace(i,"\r")),S.nodeValue=b;var E=S.ownerDocument,k=E.createElement("span");k.className=h[f+1];var w=S.parentNode;w.replaceChild(k,S),k.appendChild(S),s<x&&(l[u+1]=S=E.createTextNode(o.substring(m,x)),w.insertBefore(S,k.nextSibling))}(s=m)>=x&&(u+=2),s>=C&&(f+=2)}}finally{v&&(v.style.display=y)}}(e)}catch(e){t.console&&console.log(e&&e.stack||e)}}function E(t,e,n){var r=n||!1,i=e||null,o=document.createElement("div");return o.innerHTML="<pre>"+t+"</pre>",o=o.firstChild,r&&y(o,r,!0),S({langExtension:i,numberLines:r,sourceNode:o,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null}),o.innerHTML}function k(e,n){var r=n||document.body,i=r.ownerDocument||document;function o(t){return r.getElementsByTagName(t)}for(var a=[o("pre"),o("code"),o("xmp")],s=[],l=0;l<a.length;++l)for(var c=0,u=a[l].length;c<u;++c)s.push(a[l][c]);a=null;var h=Date;h.now||(h={now:function(){return+new Date}});var d=0,f=/\blang(?:uage)?-([\w.]+)(?!\S)/,g=/\bprettyprint\b/,m=/\bprettyprinted\b/,v=/pre|xmp/i,b=/^code$/i,x=/^(?:pre|code|xmp)$/i,C={};!function n(){for(var r=t.PR_SHOULD_USE_CONTINUATION?h.now()+250:1/0;d<s.length&&h.now()<r;d++){for(var o=s[d],a=C,l=o;l=l.previousSibling;){var c=l.nodeType,u=(7===c||8===c)&&l.nodeValue;if(u?!/^\??prettify\b/.test(u):3!==c||/\S/.test(l.nodeValue))break;if(u){a={},u.replace(/\b(\w+)=([\w:.%+-]+)/g,(function(t,e,n){a[e]=n}));break}}var E=o.className;if((a!==C||g.test(E))&&!m.test(E)){for(var k=!1,w=o.parentNode;w;w=w.parentNode){var T=w.tagName;if(x.test(T)&&w.className&&g.test(w.className)){k=!0;break}}if(!k){o.className+=" prettyprinted";var O,L,A=a.lang;if(!A)!(A=E.match(f))&&(O=p(o))&&b.test(O.tagName)&&(A=O.className.match(f)),A&&(A=A[1]);if(v.test(o.tagName))L=1;else{var D=o.currentStyle,R=i.defaultView,M=D?D.whiteSpace:R&&R.getComputedStyle?R.getComputedStyle(o,null).getPropertyValue("white-space"):0;L=M&&"pre"===M.substring(0,3)}var I=a.linenums;(I="true"===I||+I)||(I=!!(I=E.match(/\blinenums\b(?::(\d+))?/))&&(!I[1]||!I[1].length||+I[1])),I&&y(o,I,L),S({langExtension:A,sourceNode:o,numberLines:I,pre:L,sourceCode:null,basePos:null,spans:null,decorations:null})}}}d<s.length?t.setTimeout(n,250):"function"==typeof e&&e()}()}x(v,["default-code"]),x(g([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["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"]),x(g([["pln",/^[\s]+/,null," \t\r\n"],["atv",/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],["pun",/^[=<>\/]+/],["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"]),x(g([],[["atv",/^[\s\S]+/]]),["uq.val"]),x(m({keywords:r,hashComments:!0,cStyleComments:!0,types:h}),["c","cc","cpp","cxx","cyc","m"]),x(m({keywords:"null,true,false"}),["json"]),x(m({keywords:o,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:h}),["cs"]),x(m({keywords:i,cStyleComments:!0}),["java"]),x(m({keywords:u,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),x(m({keywords:l,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),x(m({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),x(m({keywords:c,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),x(m({keywords:a,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),x(m({keywords:"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",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),x(g([],[["str",/^[\s\S]+/]]),["regex"]);var w=t.PR={createSimpleLexer:g,registerLangHandler:x,sourceDecorator:m,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ",prettyPrintOne:E,prettyPrint:k},T=t.define;"function"==typeof T&&T.amd&&T("google-code-prettify",[],(function(){return w}))}()},"VrN/":
/*!***************************************************!*\
!*** ./node_modules/codemirror/lib/codemirror.js ***!
\***************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){t.exports=function(){"use strict";var t=navigator.userAgent,e=navigator.platform,n=/gecko\/\d/i.test(t),r=/MSIE \d/.test(t),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(t),o=/Edge\/(\d+)/.exec(t),a=r||i||o,s=a&&(r?document.documentMode||6:+(o||i)[1]),l=!o&&/WebKit\//.test(t),c=l&&/Qt\/\d+\.\d+/.test(t),u=!o&&/Chrome\//.test(t),h=/Opera\//.test(t),d=/Apple Computer/.test(navigator.vendor),f=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(t),p=/PhantomJS/.test(t),g=!o&&/AppleWebKit/.test(t)&&/Mobile\/\w+/.test(t),m=/Android/.test(t),v=g||m||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(t),y=g||/Mac/.test(e),b=/\bCrOS\b/.test(t),x=/win/i.test(e),C=h&&t.match(/Version\/(\d*\.\d*)/);C&&(C=Number(C[1])),C&&C>=15&&(h=!1,l=!0);var S=y&&(c||h&&(null==C||C<12.11)),E=n||a&&s>=9;function k(t){return new RegExp("(^|\\s)"+t+"(?:$|\\s)\\s*")}var w,T=function(t,e){var n=t.className,r=k(e).exec(n);if(r){var i=n.slice(r.index+r[0].length);t.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function O(t){for(var e=t.childNodes.length;e>0;--e)t.removeChild(t.firstChild);return t}function L(t,e){return O(t).appendChild(e)}function A(t,e,n,r){var i=document.createElement(t);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof e)i.appendChild(document.createTextNode(e));else if(e)for(var o=0;o<e.length;++o)i.appendChild(e[o]);return i}function D(t,e,n,r){var i=A(t,e,n,r);return i.setAttribute("role","presentation"),i}function R(t,e){if(3==e.nodeType&&(e=e.parentNode),t.contains)return t.contains(e);do{if(11==e.nodeType&&(e=e.host),e==t)return!0}while(e=e.parentNode)}function M(){var t;try{t=document.activeElement}catch(e){t=document.body||null}for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t}function I(t,e){var n=t.className;k(e).test(n)||(t.className+=(n?" ":"")+e)}function _(t,e){for(var n=t.split(" "),r=0;r<n.length;r++)n[r]&&!k(n[r]).test(e)&&(e+=" "+n[r]);return e}w=document.createRange?function(t,e,n,r){var i=document.createRange();return i.setEnd(r||t,n),i.setStart(t,e),i}:function(t,e,n){var r=document.body.createTextRange();try{r.moveToElementText(t.parentNode)}catch(t){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",e),r};var P=function(t){t.select()};function N(t){var e=Array.prototype.slice.call(arguments,1);return function(){return t.apply(null,e)}}function j(t,e,n){for(var r in e||(e={}),t)!t.hasOwnProperty(r)||!1===n&&e.hasOwnProperty(r)||(e[r]=t[r]);return e}function F(t,e,n,r,i){null==e&&-1==(e=t.search(/[^\s\u00a0]/))&&(e=t.length);for(var o=r||0,a=i||0;;){var s=t.indexOf("\t",o);if(s<0||s>=e)return a+(e-o);a+=s-o,a+=n-a%n,o=s+1}}g?P=function(t){t.selectionStart=0,t.selectionEnd=t.value.length}:a&&(P=function(t){try{t.select()}catch(t){}});var B=function(){this.id=null,this.f=null,this.time=0,this.handler=N(this.onTimeout,this)};function U(t,e){for(var n=0;n<t.length;++n)if(t[n]==e)return n;return-1}B.prototype.onTimeout=function(t){t.id=0,t.time<=+new Date?t.f():setTimeout(t.handler,t.time-+new Date)},B.prototype.set=function(t,e){this.f=e;var n=+new Date+t;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,t),this.time=n)};var H={toString:function(){return"CodeMirror.Pass"}},z={scroll:!1},G={origin:"*mouse"},V={origin:"+move"};function W(t,e,n){for(var r=0,i=0;;){var o=t.indexOf("\t",r);-1==o&&(o=t.length);var a=o-r;if(o==t.length||i+a>=e)return r+Math.min(a,e-i);if(i+=o-r,r=o+1,(i+=n-i%n)>=e)return r}}var K=[""];function q(t){for(;K.length<=t;)K.push(Y(K)+" ");return K[t]}function Y(t){return t[t.length-1]}function X(t,e){for(var n=[],r=0;r<t.length;r++)n[r]=e(t[r],r);return n}function $(){}function Z(t,e){var n;return Object.create?n=Object.create(t):($.prototype=t,n=new $),e&&j(e,n),n}var J=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Q(t){return/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||J.test(t))}function tt(t,e){return e?!!(e.source.indexOf("\\w")>-1&&Q(t))||e.test(t):Q(t)}function et(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e])return!1;return!0}var nt=/[\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 rt(t){return t.charCodeAt(0)>=768&&nt.test(t)}function it(t,e,n){for(;(n<0?e>0:e<t.length)&&rt(t.charAt(e));)e+=n;return e}function ot(t,e,n){for(var r=e>n?-1:1;;){if(e==n)return e;var i=(e+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==e)return t(o)?e:n;t(o)?n=o:e=o+r}}var at=null;function st(t,e,n){var r;at=null;for(var i=0;i<t.length;++i){var o=t[i];if(o.from<e&&o.to>e)return i;o.to==e&&(o.from!=o.to&&"before"==n?r=i:at=i),o.from==e&&(o.from!=o.to&&"before"!=n?r=i:at=i)}return null!=r?r:at}var lt=function(){var t=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,e=/[stwN]/,n=/[LRr]/,r=/[Lb1n]/,i=/[1n]/;function o(t,e,n){this.level=t,this.from=e,this.to=n}return function(a,s){var l="ltr"==s?"L":"R";if(0==a.length||"ltr"==s&&!t.test(a))return!1;for(var c,u=a.length,h=[],d=0;d<u;++d)h.push((c=a.charCodeAt(d))<=247?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(c):1424<=c&&c<=1524?"R":1536<=c&&c<=1785?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(c-1536):1774<=c&&c<=2220?"r":8192<=c&&c<=8203?"w":8204==c?"b":"L");for(var f=0,p=l;f<u;++f){var g=h[f];"m"==g?h[f]=p:p=g}for(var m=0,v=l;m<u;++m){var y=h[m];"1"==y&&"r"==v?h[m]="n":n.test(y)&&(v=y,"r"==y&&(h[m]="R"))}for(var b=1,x=h[0];b<u-1;++b){var C=h[b];"+"==C&&"1"==x&&"1"==h[b+1]?h[b]="1":","!=C||x!=h[b+1]||"1"!=x&&"n"!=x||(h[b]=x),x=C}for(var S=0;S<u;++S){var E=h[S];if(","==E)h[S]="N";else if("%"==E){var k=void 0;for(k=S+1;k<u&&"%"==h[k];++k);for(var w=S&&"!"==h[S-1]||k<u&&"1"==h[k]?"1":"N",T=S;T<k;++T)h[T]=w;S=k-1}}for(var O=0,L=l;O<u;++O){var A=h[O];"L"==L&&"1"==A?h[O]="L":n.test(A)&&(L=A)}for(var D=0;D<u;++D)if(e.test(h[D])){var R=void 0;for(R=D+1;R<u&&e.test(h[R]);++R);for(var M="L"==(D?h[D-1]:l),I=M==("L"==(R<u?h[R]:l))?M?"L":"R":l,_=D;_<R;++_)h[_]=I;D=R-1}for(var P,N=[],j=0;j<u;)if(r.test(h[j])){var F=j;for(++j;j<u&&r.test(h[j]);++j);N.push(new o(0,F,j))}else{var B=j,U=N.length,H="rtl"==s?1:0;for(++j;j<u&&"L"!=h[j];++j);for(var z=B;z<j;)if(i.test(h[z])){B<z&&(N.splice(U,0,new o(1,B,z)),U+=H);var G=z;for(++z;z<j&&i.test(h[z]);++z);N.splice(U,0,new o(2,G,z)),U+=H,B=z}else++z;B<j&&N.splice(U,0,new o(1,B,j))}return"ltr"==s&&(1==N[0].level&&(P=a.match(/^\s+/))&&(N[0].from=P[0].length,N.unshift(new o(0,0,P[0].length))),1==Y(N).level&&(P=a.match(/\s+$/))&&(Y(N).to-=P[0].length,N.push(new o(0,u-P[0].length,u)))),"rtl"==s?N.reverse():N}}();function ct(t,e){var n=t.order;return null==n&&(n=t.order=lt(t.text,e)),n}var ut=[],ht=function(t,e,n){if(t.addEventListener)t.addEventListener(e,n,!1);else if(t.attachEvent)t.attachEvent("on"+e,n);else{var r=t._handlers||(t._handlers={});r[e]=(r[e]||ut).concat(n)}};function dt(t,e){return t._handlers&&t._handlers[e]||ut}function ft(t,e,n){if(t.removeEventListener)t.removeEventListener(e,n,!1);else if(t.detachEvent)t.detachEvent("on"+e,n);else{var r=t._handlers,i=r&&r[e];if(i){var o=U(i,n);o>-1&&(r[e]=i.slice(0,o).concat(i.slice(o+1)))}}}function pt(t,e){var n=dt(t,e);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function gt(t,e,n){return"string"==typeof e&&(e={type:e,preventDefault:function(){this.defaultPrevented=!0}}),pt(t,n||e.type,t,e),Ct(e)||e.codemirrorIgnore}function mt(t){var e=t._handlers&&t._handlers.cursorActivity;if(e)for(var n=t.curOp.cursorActivityHandlers||(t.curOp.cursorActivityHandlers=[]),r=0;r<e.length;++r)-1==U(n,e[r])&&n.push(e[r])}function vt(t,e){return dt(t,e).length>0}function yt(t){t.prototype.on=function(t,e){ht(this,t,e)},t.prototype.off=function(t,e){ft(this,t,e)}}function bt(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function xt(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}function Ct(t){return null!=t.defaultPrevented?t.defaultPrevented:0==t.returnValue}function St(t){bt(t),xt(t)}function Et(t){return t.target||t.srcElement}function kt(t){var e=t.which;return null==e&&(1&t.button?e=1:2&t.button?e=3:4&t.button&&(e=2)),y&&t.ctrlKey&&1==e&&(e=3),e}var wt,Tt,Ot=function(){if(a&&s<9)return!1;var t=A("div");return"draggable"in t||"dragDrop"in t}();function Lt(t){if(null==wt){var e=A("span","");L(t,A("span",[e,document.createTextNode("x")])),0!=t.firstChild.offsetHeight&&(wt=e.offsetWidth<=1&&e.offsetHeight>2&&!(a&&s<8))}var n=wt?A("span",""):A("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function At(t){if(null!=Tt)return Tt;var e=L(t,document.createTextNode("AخA")),n=w(e,0,1).getBoundingClientRect(),r=w(e,1,2).getBoundingClientRect();return O(t),!(!n||n.left==n.right)&&(Tt=r.right-n.right<3)}var Dt,Rt=3!="\n\nb".split(/\n/).length?function(t){for(var e=0,n=[],r=t.length;e<=r;){var i=t.indexOf("\n",e);-1==i&&(i=t.length);var o=t.slice(e,"\r"==t.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(n.push(o.slice(0,a)),e+=a+1):(n.push(o),e=i+1)}return n}:function(t){return t.split(/\r\n?|\n/)},Mt=window.getSelection?function(t){try{return t.selectionStart!=t.selectionEnd}catch(t){return!1}}:function(t){var e;try{e=t.ownerDocument.selection.createRange()}catch(t){}return!(!e||e.parentElement()!=t)&&0!=e.compareEndPoints("StartToEnd",e)},It="oncopy"in(Dt=A("div"))||(Dt.setAttribute("oncopy","return;"),"function"==typeof Dt.oncopy),_t=null,Pt={},Nt={};function jt(t,e){arguments.length>2&&(e.dependencies=Array.prototype.slice.call(arguments,2)),Pt[t]=e}function Ft(t){if("string"==typeof t&&Nt.hasOwnProperty(t))t=Nt[t];else if(t&&"string"==typeof t.name&&Nt.hasOwnProperty(t.name)){var e=Nt[t.name];"string"==typeof e&&(e={name:e}),(t=Z(e,t)).name=e.name}else{if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return Ft("application/xml");if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+json$/.test(t))return Ft("application/json")}return"string"==typeof t?{name:t}:t||{name:"null"}}function Bt(t,e){e=Ft(e);var n=Pt[e.name];if(!n)return Bt(t,"text/plain");var r=n(t,e);if(Ut.hasOwnProperty(e.name)){var i=Ut[e.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=e.name,e.helperType&&(r.helperType=e.helperType),e.modeProps)for(var a in e.modeProps)r[a]=e.modeProps[a];return r}var Ut={};function Ht(t,e){j(e,Ut.hasOwnProperty(t)?Ut[t]:Ut[t]={})}function zt(t,e){if(!0===e)return e;if(t.copyState)return t.copyState(e);var n={};for(var r in e){var i=e[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Gt(t,e){for(var n;t.innerMode&&(n=t.innerMode(e))&&n.mode!=t;)e=n.state,t=n.mode;return n||{mode:t,state:e}}function Vt(t,e,n){return!t.startState||t.startState(e,n)}var Wt=function(t,e,n){this.pos=this.start=0,this.string=t,this.tabSize=e||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};function Kt(t,e){if((e-=t.first)<0||e>=t.size)throw new Error("There is no line "+(e+t.first)+" in the document.");for(var n=t;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(e<o){n=i;break}e-=o}return n.lines[e]}function qt(t,e,n){var r=[],i=e.line;return t.iter(e.line,n.line+1,(function(t){var o=t.text;i==n.line&&(o=o.slice(0,n.ch)),i==e.line&&(o=o.slice(e.ch)),r.push(o),++i})),r}function Yt(t,e,n){var r=[];return t.iter(e,n,(function(t){r.push(t.text)})),r}function Xt(t,e){var n=e-t.height;if(n)for(var r=t;r;r=r.parent)r.height+=n}function $t(t){if(null==t.parent)return null;for(var e=t.parent,n=U(e.lines,t),r=e.parent;r;e=r,r=r.parent)for(var i=0;r.children[i]!=e;++i)n+=r.children[i].chunkSize();return n+e.first}function Zt(t,e){var n=t.first;t:do{for(var r=0;r<t.children.length;++r){var i=t.children[r],o=i.height;if(e<o){t=i;continue t}e-=o,n+=i.chunkSize()}return n}while(!t.lines);for(var a=0;a<t.lines.length;++a){var s=t.lines[a].height;if(e<s)break;e-=s}return n+a}function Jt(t,e){return e>=t.first&&e<t.first+t.size}function Qt(t,e){return String(t.lineNumberFormatter(e+t.firstLineNumber))}function te(t,e,n){if(void 0===n&&(n=null),!(this instanceof te))return new te(t,e,n);this.line=t,this.ch=e,this.sticky=n}function ee(t,e){return t.line-e.line||t.ch-e.ch}function ne(t,e){return t.sticky==e.sticky&&0==ee(t,e)}function re(t){return te(t.line,t.ch)}function ie(t,e){return ee(t,e)<0?e:t}function oe(t,e){return ee(t,e)<0?t:e}function ae(t,e){return Math.max(t.first,Math.min(e,t.first+t.size-1))}function se(t,e){if(e.line<t.first)return te(t.first,0);var n=t.first+t.size-1;return e.line>n?te(n,Kt(t,n).text.length):function(t,e){var n=t.ch;return null==n||n>e?te(t.line,e):n<0?te(t.line,0):t}(e,Kt(t,e.line).text.length)}function le(t,e){for(var n=[],r=0;r<e.length;r++)n[r]=se(t,e[r]);return n}Wt.prototype.eol=function(){return this.pos>=this.string.length},Wt.prototype.sol=function(){return this.pos==this.lineStart},Wt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Wt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Wt.prototype.eat=function(t){var e=this.string.charAt(this.pos);if("string"==typeof t?e==t:e&&(t.test?t.test(e):t(e)))return++this.pos,e},Wt.prototype.eatWhile=function(t){for(var e=this.pos;this.eat(t););return this.pos>e},Wt.prototype.eatSpace=function(){for(var t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t},Wt.prototype.skipToEnd=function(){this.pos=this.string.length},Wt.prototype.skipTo=function(t){var e=this.string.indexOf(t,this.pos);if(e>-1)return this.pos=e,!0},Wt.prototype.backUp=function(t){this.pos-=t},Wt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=F(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?F(this.string,this.lineStart,this.tabSize):0)},Wt.prototype.indentation=function(){return F(this.string,null,this.tabSize)-(this.lineStart?F(this.string,this.lineStart,this.tabSize):0)},Wt.prototype.match=function(t,e,n){if("string"!=typeof t){var r=this.string.slice(this.pos).match(t);return r&&r.index>0?null:(r&&!1!==e&&(this.pos+=r[0].length),r)}var i=function(t){return n?t.toLowerCase():t};if(i(this.string.substr(this.pos,t.length))==i(t))return!1!==e&&(this.pos+=t.length),!0},Wt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Wt.prototype.hideFirstChars=function(t,e){this.lineStart+=t;try{return e()}finally{this.lineStart-=t}},Wt.prototype.lookAhead=function(t){var e=this.lineOracle;return e&&e.lookAhead(t)},Wt.prototype.baseToken=function(){var t=this.lineOracle;return t&&t.baseToken(this.pos)};var ce=function(t,e){this.state=t,this.lookAhead=e},ue=function(t,e,n,r){this.state=e,this.doc=t,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};function he(t,e,n,r){var i=[t.state.modeGen],o={};xe(t,e.text,t.doc.mode,n,(function(t,e){return i.push(t,e)}),o,r);for(var a=n.state,s=function(r){n.baseTokens=i;var s=t.state.overlays[r],l=1,c=0;n.state=!0,xe(t,e.text,s.mode,n,(function(t,e){for(var n=l;c<t;){var r=i[l];r>t&&i.splice(l,1,t,i[l+1],r),l+=2,c=Math.min(t,r)}if(e)if(s.opaque)i.splice(n,l-n,t,"overlay "+e),l=n+2;else for(;n<l;n+=2){var o=i[n+1];i[n+1]=(o?o+" ":"")+"overlay "+e}}),o),n.state=a,n.baseTokens=null,n.baseTokenPos=1},l=0;l<t.state.overlays.length;++l)s(l);return{styles:i,classes:o.bgClass||o.textClass?o:null}}function de(t,e,n){if(!e.styles||e.styles[0]!=t.state.modeGen){var r=fe(t,$t(e)),i=e.text.length>t.options.maxHighlightLength&&zt(t.doc.mode,r.state),o=he(t,e,r);i&&(r.state=i),e.stateAfter=r.save(!i),e.styles=o.styles,o.classes?e.styleClasses=o.classes:e.styleClasses&&(e.styleClasses=null),n===t.doc.highlightFrontier&&(t.doc.modeFrontier=Math.max(t.doc.modeFrontier,++t.doc.highlightFrontier))}return e.styles}function fe(t,e,n){var r=t.doc,i=t.display;if(!r.mode.startState)return new ue(r,!0,e);var o=function(t,e,n){for(var r,i,o=t.doc,a=n?-1:e-(t.doc.mode.innerMode?1e3:100),s=e;s>a;--s){if(s<=o.first)return o.first;var l=Kt(o,s-1),c=l.stateAfter;if(c&&(!n||s+(c instanceof ce?c.lookAhead:0)<=o.modeFrontier))return s;var u=F(l.text,null,t.options.tabSize);(null==i||r>u)&&(i=s-1,r=u)}return i}(t,e,n),a=o>r.first&&Kt(r,o-1).stateAfter,s=a?ue.fromSaved(r,a,o):new ue(r,Vt(r.mode),o);return r.iter(o,e,(function(n){pe(t,n.text,s);var r=s.line;n.stateAfter=r==e-1||r%5==0||r>=i.viewFrom&&r<i.viewTo?s.save():null,s.nextLine()})),n&&(r.modeFrontier=s.line),s}function pe(t,e,n,r){var i=t.doc.mode,o=new Wt(e,t.options.tabSize,n);for(o.start=o.pos=r||0,""==e&&ge(i,n.state);!o.eol();)me(i,o,n.state),o.start=o.pos}function ge(t,e){if(t.blankLine)return t.blankLine(e);if(t.innerMode){var n=Gt(t,e);return n.mode.blankLine?n.mode.blankLine(n.state):void 0}}function me(t,e,n,r){for(var i=0;i<10;i++){r&&(r[0]=Gt(t,n).mode);var o=t.token(e,n);if(e.pos>e.start)return o}throw new Error("Mode "+t.name+" failed to advance stream.")}ue.prototype.lookAhead=function(t){var e=this.doc.getLine(this.line+t);return null!=e&&t>this.maxLookAhead&&(this.maxLookAhead=t),e},ue.prototype.baseToken=function(t){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=t;)this.baseTokenPos+=2;var e=this.baseTokens[this.baseTokenPos+1];return{type:e&&e.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-t}},ue.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ue.fromSaved=function(t,e,n){return e instanceof ce?new ue(t,zt(t.mode,e.state),n,e.lookAhead):new ue(t,zt(t.mode,e),n)},ue.prototype.save=function(t){var e=!1!==t?zt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ce(e,this.maxLookAhead):e};var ve=function(t,e,n){this.start=t.start,this.end=t.pos,this.string=t.current(),this.type=e||null,this.state=n};function ye(t,e,n,r){var i,o,a=t.doc,s=a.mode,l=Kt(a,(e=se(a,e)).line),c=fe(t,e.line,n),u=new Wt(l.text,t.options.tabSize,c);for(r&&(o=[]);(r||u.pos<e.ch)&&!u.eol();)u.start=u.pos,i=me(s,u,c.state),r&&o.push(new ve(u,i,zt(a.mode,c.state)));return r?o:new ve(u,i,c.state)}function be(t,e){if(t)for(;;){var n=t.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;t=t.slice(0,n.index)+t.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";null==e[r]?e[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(e[r])||(e[r]+=" "+n[2])}return t}function xe(t,e,n,r,i,o,a){var s=n.flattenSpans;null==s&&(s=t.options.flattenSpans);var l,c=0,u=null,h=new Wt(e,t.options.tabSize,r),d=t.options.addModeClass&&[null];for(""==e&&be(ge(n,r.state),o);!h.eol();){if(h.pos>t.options.maxHighlightLength?(s=!1,a&&pe(t,e,r,h.pos),h.pos=e.length,l=null):l=be(me(n,h,r.state,d),o),d){var f=d[0].name;f&&(l="m-"+(l?f+" "+l:f))}if(!s||u!=l){for(;c<h.start;)i(c=Math.min(h.start,c+5e3),u);u=l}h.start=h.pos}for(;c<h.pos;){var p=Math.min(h.pos,c+5e3);i(p,u),c=p}}var Ce=!1,Se=!1;function Ee(t,e,n){this.marker=t,this.from=e,this.to=n}function ke(t,e){if(t)for(var n=0;n<t.length;++n){var r=t[n];if(r.marker==e)return r}}function we(t,e){for(var n,r=0;r<t.length;++r)t[r]!=e&&(n||(n=[])).push(t[r]);return n}function Te(t,e){if(e.full)return null;var n=Jt(t,e.from.line)&&Kt(t,e.from.line).markedSpans,r=Jt(t,e.to.line)&&Kt(t,e.to.line).markedSpans;if(!n&&!r)return null;var i=e.from.ch,o=e.to.ch,a=0==ee(e.from,e.to),s=function(t,e,n){var r;if(t)for(var i=0;i<t.length;++i){var o=t[i],a=o.marker;if(null==o.from||(a.inclusiveLeft?o.from<=e:o.from<e)||o.from==e&&"bookmark"==a.type&&(!n||!o.marker.insertLeft)){var s=null==o.to||(a.inclusiveRight?o.to>=e:o.to>e);(r||(r=[])).push(new Ee(a,o.from,s?null:o.to))}}return r}(n,i,a),l=function(t,e,n){var r;if(t)for(var i=0;i<t.length;++i){var o=t[i],a=o.marker;if(null==o.to||(a.inclusiveRight?o.to>=e:o.to>e)||o.from==e&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var s=null==o.from||(a.inclusiveLeft?o.from<=e:o.from<e);(r||(r=[])).push(new Ee(a,s?null:o.from-e,null==o.to?null:o.to-e))}}return r}(r,o,a),c=1==e.text.length,u=Y(e.text).length+(c?i:0);if(s)for(var h=0;h<s.length;++h){var d=s[h];if(null==d.to){var f=ke(l,d.marker);f?c&&(d.to=null==f.to?null:f.to+u):d.to=i}}if(l)for(var p=0;p<l.length;++p){var g=l[p];null!=g.to&&(g.to+=u),null==g.from?ke(s,g.marker)||(g.from=u,c&&(s||(s=[])).push(g)):(g.from+=u,c&&(s||(s=[])).push(g))}s&&(s=Oe(s)),l&&l!=s&&(l=Oe(l));var m=[s];if(!c){var v,y=e.text.length-2;if(y>0&&s)for(var b=0;b<s.length;++b)null==s[b].to&&(v||(v=[])).push(new Ee(s[b].marker,null,null));for(var x=0;x<y;++x)m.push(v);m.push(l)}return m}function Oe(t){for(var e=0;e<t.length;++e){var n=t[e];null!=n.from&&n.from==n.to&&!1!==n.marker.clearWhenEmpty&&t.splice(e--,1)}return t.length?t:null}function Le(t){var e=t.markedSpans;if(e){for(var n=0;n<e.length;++n)e[n].marker.detachLine(t);t.markedSpans=null}}function Ae(t,e){if(e){for(var n=0;n<e.length;++n)e[n].marker.attachLine(t);t.markedSpans=e}}function De(t){return t.inclusiveLeft?-1:0}function Re(t){return t.inclusiveRight?1:0}function Me(t,e){var n=t.lines.length-e.lines.length;if(0!=n)return n;var r=t.find(),i=e.find(),o=ee(r.from,i.from)||De(t)-De(e);if(o)return-o;var a=ee(r.to,i.to)||Re(t)-Re(e);return a||e.id-t.id}function Ie(t,e){var n,r=Se&&t.markedSpans;if(r)for(var i=void 0,o=0;o<r.length;++o)(i=r[o]).marker.collapsed&&null==(e?i.from:i.to)&&(!n||Me(n,i.marker)<0)&&(n=i.marker);return n}function _e(t){return Ie(t,!0)}function Pe(t){return Ie(t,!1)}function Ne(t,e){var n,r=Se&&t.markedSpans;if(r)for(var i=0;i<r.length;++i){var o=r[i];o.marker.collapsed&&(null==o.from||o.from<e)&&(null==o.to||o.to>e)&&(!n||Me(n,o.marker)<0)&&(n=o.marker)}return n}function je(t,e,n,r,i){var o=Kt(t,e),a=Se&&o.markedSpans;if(a)for(var s=0;s<a.length;++s){var l=a[s];if(l.marker.collapsed){var c=l.marker.find(0),u=ee(c.from,n)||De(l.marker)-De(i),h=ee(c.to,r)||Re(l.marker)-Re(i);if(!(u>=0&&h<=0||u<=0&&h>=0)&&(u<=0&&(l.marker.inclusiveRight&&i.inclusiveLeft?ee(c.to,n)>=0:ee(c.to,n)>0)||u>=0&&(l.marker.inclusiveRight&&i.inclusiveLeft?ee(c.from,r)<=0:ee(c.from,r)<0)))return!0}}}function Fe(t){for(var e;e=_e(t);)t=e.find(-1,!0).line;return t}function Be(t,e){var n=Kt(t,e),r=Fe(n);return n==r?e:$t(r)}function Ue(t,e){if(e>t.lastLine())return e;var n,r=Kt(t,e);if(!He(t,r))return e;for(;n=Pe(r);)r=n.find(1,!0).line;return $t(r)+1}function He(t,e){var n=Se&&e.markedSpans;if(n)for(var r=void 0,i=0;i<n.length;++i)if((r=n[i]).marker.collapsed){if(null==r.from)return!0;if(!r.marker.widgetNode&&0==r.from&&r.marker.inclusiveLeft&&ze(t,e,r))return!0}}function ze(t,e,n){if(null==n.to){var r=n.marker.find(1,!0);return ze(t,r.line,ke(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==e.text.length)return!0;for(var i=void 0,o=0;o<e.markedSpans.length;++o)if((i=e.markedSpans[o]).marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(null==i.to||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&ze(t,e,i))return!0}function Ge(t){for(var e=0,n=(t=Fe(t)).parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==t)break;e+=i.height}for(var o=n.parent;o;o=(n=o).parent)for(var a=0;a<o.children.length;++a){var s=o.children[a];if(s==n)break;e+=s.height}return e}function Ve(t){if(0==t.height)return 0;for(var e,n=t.text.length,r=t;e=_e(r);){var i=e.find(0,!0);r=i.from.line,n+=i.from.ch-i.to.ch}for(r=t;e=Pe(r);){var o=e.find(0,!0);n-=r.text.length-o.from.ch,n+=(r=o.to.line).text.length-o.to.ch}return n}function We(t){var e=t.display,n=t.doc;e.maxLine=Kt(n,n.first),e.maxLineLength=Ve(e.maxLine),e.maxLineChanged=!0,n.iter((function(t){var n=Ve(t);n>e.maxLineLength&&(e.maxLineLength=n,e.maxLine=t)}))}var Ke=function(t,e,n){this.text=t,Ae(this,e),this.height=n?n(this):1};function qe(t){t.parent=null,Le(t)}Ke.prototype.lineNo=function(){return $t(this)},yt(Ke);var Ye={},Xe={};function $e(t,e){if(!t||/^\s*$/.test(t))return null;var n=e.addModeClass?Xe:Ye;return n[t]||(n[t]=t.replace(/\S+/g,"cm-$&"))}function Ze(t,e){var n=D("span",null,null,l?"padding-right: .1px":null),r={pre:D("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:t,trailingSpace:!1,splitSpaces:t.getOption("lineWrapping")};e.measure={};for(var i=0;i<=(e.rest?e.rest.length:0);i++){var o=i?e.rest[i-1]:e.line,a=void 0;r.pos=0,r.addToken=Qe,At(t.display.measure)&&(a=ct(o,t.doc.direction))&&(r.addToken=tn(r.addToken,a)),r.map=[],nn(o,r,de(t,o,e!=t.display.externalMeasured&&$t(o))),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=_(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=_(o.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(Lt(t.display.measure))),0==i?(e.measure.map=r.map,e.measure.cache={}):((e.measure.maps||(e.measure.maps=[])).push(r.map),(e.measure.caches||(e.measure.caches=[])).push({}))}if(l){var s=r.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return pt(t,"renderLine",t,e.line,r.pre),r.pre.className&&(r.textClass=_(r.pre.className,r.textClass||"")),r}function Je(t){var e=A("span","•","cm-invalidchar");return e.title="\\u"+t.charCodeAt(0).toString(16),e.setAttribute("aria-label",e.title),e}function Qe(t,e,n,r,i,o,l){if(e){var c,u=t.splitSpaces?function(t,e){if(t.length>1&&!/ /.test(t))return t;for(var n=e,r="",i=0;i<t.length;i++){var o=t.charAt(i);" "!=o||!n||i!=t.length-1&&32!=t.charCodeAt(i+1)||(o=" "),r+=o,n=" "==o}return r}(e,t.trailingSpace):e,h=t.cm.state.specialChars,d=!1;if(h.test(e)){c=document.createDocumentFragment();for(var f=0;;){h.lastIndex=f;var p=h.exec(e),g=p?p.index-f:e.length-f;if(g){var m=document.createTextNode(u.slice(f,f+g));a&&s<9?c.appendChild(A("span",[m])):c.appendChild(m),t.map.push(t.pos,t.pos+g,m),t.col+=g,t.pos+=g}if(!p)break;f+=g+1;var v=void 0;if("\t"==p[0]){var y=t.cm.options.tabSize,b=y-t.col%y;(v=c.appendChild(A("span",q(b),"cm-tab"))).setAttribute("role","presentation"),v.setAttribute("cm-text","\t"),t.col+=b}else"\r"==p[0]||"\n"==p[0]?((v=c.appendChild(A("span","\r"==p[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",p[0]),t.col+=1):((v=t.cm.options.specialCharPlaceholder(p[0])).setAttribute("cm-text",p[0]),a&&s<9?c.appendChild(A("span",[v])):c.appendChild(v),t.col+=1);t.map.push(t.pos,t.pos+1,v),t.pos++}}else t.col+=e.length,c=document.createTextNode(u),t.map.push(t.pos,t.pos+e.length,c),a&&s<9&&(d=!0),t.pos+=e.length;if(t.trailingSpace=32==u.charCodeAt(e.length-1),n||r||i||d||o||l){var x=n||"";r&&(x+=r),i&&(x+=i);var C=A("span",[c],x,o);if(l)for(var S in l)l.hasOwnProperty(S)&&"style"!=S&&"class"!=S&&C.setAttribute(S,l[S]);return t.content.appendChild(C)}t.content.appendChild(c)}}function tn(t,e){return function(n,r,i,o,a,s,l){i=i?i+" cm-force-border":"cm-force-border";for(var c=n.pos,u=c+r.length;;){for(var h=void 0,d=0;d<e.length&&!((h=e[d]).to>c&&h.from<=c);d++);if(h.to>=u)return t(n,r,i,o,a,s,l);t(n,r.slice(0,h.to-c),i,o,null,s,l),o=null,r=r.slice(h.to-c),c=h.to}}}function en(t,e,n,r){var i=!r&&n.widgetNode;i&&t.map.push(t.pos,t.pos+e,i),!r&&t.cm.display.input.needsContentAttribute&&(i||(i=t.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(t.cm.display.input.setUneditable(i),t.content.appendChild(i)),t.pos+=e,t.trailingSpace=!1}function nn(t,e,n){var r=t.markedSpans,i=t.text,o=0;if(r)for(var a,s,l,c,u,h,d,f=i.length,p=0,g=1,m="",v=0;;){if(v==p){l=c=u=s="",d=null,h=null,v=1/0;for(var y=[],b=void 0,x=0;x<r.length;++x){var C=r[x],S=C.marker;if("bookmark"==S.type&&C.from==p&&S.widgetNode)y.push(S);else if(C.from<=p&&(null==C.to||C.to>p||S.collapsed&&C.to==p&&C.from==p)){if(null!=C.to&&C.to!=p&&v>C.to&&(v=C.to,c=""),S.className&&(l+=" "+S.className),S.css&&(s=(s?s+";":"")+S.css),S.startStyle&&C.from==p&&(u+=" "+S.startStyle),S.endStyle&&C.to==v&&(b||(b=[])).push(S.endStyle,C.to),S.title&&((d||(d={})).title=S.title),S.attributes)for(var E in S.attributes)(d||(d={}))[E]=S.attributes[E];S.collapsed&&(!h||Me(h.marker,S)<0)&&(h=C)}else C.from>p&&v>C.from&&(v=C.from)}if(b)for(var k=0;k<b.length;k+=2)b[k+1]==v&&(c+=" "+b[k]);if(!h||h.from==p)for(var w=0;w<y.length;++w)en(e,0,y[w]);if(h&&(h.from||0)==p){if(en(e,(null==h.to?f+1:h.to)-p,h.marker,null==h.from),null==h.to)return;h.to==p&&(h=!1)}}if(p>=f)break;for(var T=Math.min(f,v);;){if(m){var O=p+m.length;if(!h){var L=O>T?m.slice(0,T-p):m;e.addToken(e,L,a?a+l:l,u,p+L.length==v?c:"",s,d)}if(O>=T){m=m.slice(T-p),p=T;break}p=O,u=""}m=i.slice(o,o=n[g++]),a=$e(n[g++],e.cm.options)}}else for(var A=1;A<n.length;A+=2)e.addToken(e,i.slice(o,o=n[A]),$e(n[A+1],e.cm.options))}function rn(t,e,n){this.line=e,this.rest=function(t){for(var e,n;e=Pe(t);)t=e.find(1,!0).line,(n||(n=[])).push(t);return n}(e),this.size=this.rest?$t(Y(this.rest))-n+1:1,this.node=this.text=null,this.hidden=He(t,e)}function on(t,e,n){for(var r,i=[],o=e;o<n;o=r){var a=new rn(t.doc,Kt(t.doc,o),o);r=o+a.size,i.push(a)}return i}var an=null,sn=null;function ln(t,e){var n=dt(t,e);if(n.length){var r,i=Array.prototype.slice.call(arguments,2);an?r=an.delayedCallbacks:sn?r=sn:(r=sn=[],setTimeout(cn,0));for(var o=function(t){r.push((function(){return n[t].apply(null,i)}))},a=0;a<n.length;++a)o(a)}}function cn(){var t=sn;sn=null;for(var e=0;e<t.length;++e)t[e]()}function un(t,e,n,r){for(var i=0;i<e.changes.length;i++){var o=e.changes[i];"text"==o?fn(t,e):"gutter"==o?gn(t,e,n,r):"class"==o?pn(t,e):"widget"==o&&mn(t,e,r)}e.changes=null}function hn(t){return t.node==t.text&&(t.node=A("div",null,null,"position: relative"),t.text.parentNode&&t.text.parentNode.replaceChild(t.node,t.text),t.node.appendChild(t.text),a&&s<8&&(t.node.style.zIndex=2)),t.node}function dn(t,e){var n=t.display.externalMeasured;return n&&n.line==e.line?(t.display.externalMeasured=null,e.measure=n.measure,n.built):Ze(t,e)}function fn(t,e){var n=e.text.className,r=dn(t,e);e.text==e.node&&(e.node=r.pre),e.text.parentNode.replaceChild(r.pre,e.text),e.text=r.pre,r.bgClass!=e.bgClass||r.textClass!=e.textClass?(e.bgClass=r.bgClass,e.textClass=r.textClass,pn(t,e)):n&&(e.text.className=n)}function pn(t,e){!function(t,e){var n=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),e.background)n?e.background.className=n:(e.background.parentNode.removeChild(e.background),e.background=null);else if(n){var r=hn(e);e.background=r.insertBefore(A("div",null,n),r.firstChild),t.display.input.setUneditable(e.background)}}(t,e),e.line.wrapClass?hn(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var n=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=n||""}function gn(t,e,n,r){if(e.gutter&&(e.node.removeChild(e.gutter),e.gutter=null),e.gutterBackground&&(e.node.removeChild(e.gutterBackground),e.gutterBackground=null),e.line.gutterClass){var i=hn(e);e.gutterBackground=A("div",null,"CodeMirror-gutter-background "+e.line.gutterClass,"left: "+(t.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),t.display.input.setUneditable(e.gutterBackground),i.insertBefore(e.gutterBackground,e.text)}var o=e.line.gutterMarkers;if(t.options.lineNumbers||o){var a=hn(e),s=e.gutter=A("div",null,"CodeMirror-gutter-wrapper","left: "+(t.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(t.display.input.setUneditable(s),a.insertBefore(s,e.text),e.line.gutterClass&&(s.className+=" "+e.line.gutterClass),!t.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(e.lineNumber=s.appendChild(A("div",Qt(t.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+t.display.lineNumInnerWidth+"px"))),o)for(var l=0;l<t.display.gutterSpecs.length;++l){var c=t.display.gutterSpecs[l].className,u=o.hasOwnProperty(c)&&o[c];u&&s.appendChild(A("div",[u],"CodeMirror-gutter-elt","left: "+r.gutterLeft[c]+"px; width: "+r.gutterWidth[c]+"px"))}}}function mn(t,e,n){e.alignable&&(e.alignable=null);for(var r=k("CodeMirror-linewidget"),i=e.node.firstChild,o=void 0;i;i=o)o=i.nextSibling,r.test(i.className)&&e.node.removeChild(i);yn(t,e,n)}function vn(t,e,n,r){var i=dn(t,e);return e.text=e.node=i.pre,i.bgClass&&(e.bgClass=i.bgClass),i.textClass&&(e.textClass=i.textClass),pn(t,e),gn(t,e,n,r),yn(t,e,r),e.node}function yn(t,e,n){if(bn(t,e.line,e,n,!0),e.rest)for(var r=0;r<e.rest.length;r++)bn(t,e.rest[r],e,n,!1)}function bn(t,e,n,r,i){if(e.widgets)for(var o=hn(n),a=0,s=e.widgets;a<s.length;++a){var l=s[a],c=A("div",[l.node],"CodeMirror-linewidget"+(l.className?" "+l.className:""));l.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),xn(l,c,n,r),t.display.input.setUneditable(c),i&&l.above?o.insertBefore(c,n.gutter||n.text):o.appendChild(c),ln(l,"redraw")}}function xn(t,e,n,r){if(t.noHScroll){(n.alignable||(n.alignable=[])).push(e);var i=r.wrapperWidth;e.style.left=r.fixedPos+"px",t.coverGutter||(i-=r.gutterTotalWidth,e.style.paddingLeft=r.gutterTotalWidth+"px"),e.style.width=i+"px"}t.coverGutter&&(e.style.zIndex=5,e.style.position="relative",t.noHScroll||(e.style.marginLeft=-r.gutterTotalWidth+"px"))}function Cn(t){if(null!=t.height)return t.height;var e=t.doc.cm;if(!e)return 0;if(!R(document.body,t.node)){var n="position: relative;";t.coverGutter&&(n+="margin-left: -"+e.display.gutters.offsetWidth+"px;"),t.noHScroll&&(n+="width: "+e.display.wrapper.clientWidth+"px;"),L(e.display.measure,A("div",[t.node],null,n))}return t.height=t.node.parentNode.offsetHeight}function Sn(t,e){for(var n=Et(e);n!=t.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==t.sizer&&n!=t.mover)return!0}function En(t){return t.lineSpace.offsetTop}function kn(t){return t.mover.offsetHeight-t.lineSpace.offsetHeight}function wn(t){if(t.cachedPaddingH)return t.cachedPaddingH;var e=L(t.measure,A("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(e):e.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return isNaN(r.left)||isNaN(r.right)||(t.cachedPaddingH=r),r}function Tn(t){return 50-t.display.nativeBarWidth}function On(t){return t.display.scroller.clientWidth-Tn(t)-t.display.barWidth}function Ln(t){return t.display.scroller.clientHeight-Tn(t)-t.display.barHeight}function An(t,e,n){if(t.line==e)return{map:t.measure.map,cache:t.measure.cache};for(var r=0;r<t.rest.length;r++)if(t.rest[r]==e)return{map:t.measure.maps[r],cache:t.measure.caches[r]};for(var i=0;i<t.rest.length;i++)if($t(t.rest[i])>n)return{map:t.measure.maps[i],cache:t.measure.caches[i],before:!0}}function Dn(t,e,n,r){return In(t,Mn(t,e),n,r)}function Rn(t,e){if(e>=t.display.viewFrom&&e<t.display.viewTo)return t.display.view[ur(t,e)];var n=t.display.externalMeasured;return n&&e>=n.lineN&&e<n.lineN+n.size?n:void 0}function Mn(t,e){var n=$t(e),r=Rn(t,n);r&&!r.text?r=null:r&&r.changes&&(un(t,r,n,or(t)),t.curOp.forceUpdate=!0),r||(r=function(t,e){var n=$t(e=Fe(e)),r=t.display.externalMeasured=new rn(t.doc,e,n);r.lineN=n;var i=r.built=Ze(t,r);return r.text=i.pre,L(t.display.lineMeasure,i.pre),r}(t,e));var i=An(r,e,n);return{line:e,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function In(t,e,n,r,i){e.before&&(n=-1);var o,l=n+(r||"");return e.cache.hasOwnProperty(l)?o=e.cache[l]:(e.rect||(e.rect=e.view.text.getBoundingClientRect()),e.hasHeights||(function(t,e,n){var r=t.options.lineWrapping,i=r&&On(t);if(!e.measure.heights||r&&e.measure.width!=i){var o=e.measure.heights=[];if(r){e.measure.width=i;for(var a=e.text.firstChild.getClientRects(),s=0;s<a.length-1;s++){var l=a[s],c=a[s+1];Math.abs(l.bottom-c.bottom)>2&&o.push((l.bottom+c.top)/2-n.top)}}o.push(n.bottom-n.top)}}(t,e.view,e.rect),e.hasHeights=!0),(o=function(t,e,n,r){var i,o=Nn(e.map,n,r),l=o.node,c=o.start,u=o.end,h=o.collapse;if(3==l.nodeType){for(var d=0;d<4;d++){for(;c&&rt(e.line.text.charAt(o.coverStart+c));)--c;for(;o.coverStart+u<o.coverEnd&&rt(e.line.text.charAt(o.coverStart+u));)++u;if((i=a&&s<9&&0==c&&u==o.coverEnd-o.coverStart?l.parentNode.getBoundingClientRect():jn(w(l,c,u).getClientRects(),r)).left||i.right||0==c)break;u=c,c-=1,h="right"}a&&s<11&&(i=function(t,e){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(t){if(null!=_t)return _t;var e=L(t,A("span","x")),n=e.getBoundingClientRect(),r=w(e,0,1).getBoundingClientRect();return _t=Math.abs(n.left-r.left)>1}(t))return e;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:e.left*n,right:e.right*n,top:e.top*r,bottom:e.bottom*r}}(t.display.measure,i))}else{var f;c>0&&(h=r="right"),i=t.options.lineWrapping&&(f=l.getClientRects()).length>1?f["right"==r?f.length-1:0]:l.getBoundingClientRect()}if(a&&s<9&&!c&&(!i||!i.left&&!i.right)){var p=l.parentNode.getClientRects()[0];i=p?{left:p.left,right:p.left+ir(t.display),top:p.top,bottom:p.bottom}:Pn}for(var g=i.top-e.rect.top,m=i.bottom-e.rect.top,v=(g+m)/2,y=e.view.measure.heights,b=0;b<y.length-1&&!(v<y[b]);b++);var x=b?y[b-1]:0,C=y[b],S={left:("right"==h?i.right:i.left)-e.rect.left,right:("left"==h?i.left:i.right)-e.rect.left,top:x,bottom:C};return i.left||i.right||(S.bogus=!0),t.options.singleCursorHeightPerLine||(S.rtop=g,S.rbottom=m),S}(t,e,n,r)).bogus||(e.cache[l]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}var _n,Pn={left:0,right:0,top:0,bottom:0};function Nn(t,e,n){for(var r,i,o,a,s,l,c=0;c<t.length;c+=3)if(s=t[c],l=t[c+1],e<s?(i=0,o=1,a="left"):e<l?o=1+(i=e-s):(c==t.length-3||e==l&&t[c+3]>e)&&(i=(o=l-s)-1,e>=l&&(a="right")),null!=i){if(r=t[c+2],s==l&&n==(r.insertLeft?"left":"right")&&(a=n),"left"==n&&0==i)for(;c&&t[c-2]==t[c-3]&&t[c-1].insertLeft;)r=t[2+(c-=3)],a="left";if("right"==n&&i==l-s)for(;c<t.length-3&&t[c+3]==t[c+4]&&!t[c+5].insertLeft;)r=t[(c+=3)+2],a="right";break}return{node:r,start:i,end:o,collapse:a,coverStart:s,coverEnd:l}}function jn(t,e){var n=Pn;if("left"==e)for(var r=0;r<t.length&&(n=t[r]).left==n.right;r++);else for(var i=t.length-1;i>=0&&(n=t[i]).left==n.right;i--);return n}function Fn(t){if(t.measure&&(t.measure.cache={},t.measure.heights=null,t.rest))for(var e=0;e<t.rest.length;e++)t.measure.caches[e]={}}function Bn(t){t.display.externalMeasure=null,O(t.display.lineMeasure);for(var e=0;e<t.display.view.length;e++)Fn(t.display.view[e])}function Un(t){Bn(t),t.display.cachedCharWidth=t.display.cachedTextHeight=t.display.cachedPaddingH=null,t.options.lineWrapping||(t.display.maxLineChanged=!0),t.display.lineNumChars=null}function Hn(){return u&&m?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function zn(){return u&&m?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Gn(t){var e=0;if(t.widgets)for(var n=0;n<t.widgets.length;++n)t.widgets[n].above&&(e+=Cn(t.widgets[n]));return e}function Vn(t,e,n,r,i){if(!i){var o=Gn(e);n.top+=o,n.bottom+=o}if("line"==r)return n;r||(r="local");var a=Ge(e);if("local"==r?a+=En(t.display):a-=t.display.viewOffset,"page"==r||"window"==r){var s=t.display.lineSpace.getBoundingClientRect();a+=s.top+("window"==r?0:zn());var l=s.left+("window"==r?0:Hn());n.left+=l,n.right+=l}return n.top+=a,n.bottom+=a,n}function Wn(t,e,n){if("div"==n)return e;var r=e.left,i=e.top;if("page"==n)r-=Hn(),i-=zn();else if("local"==n||!n){var o=t.display.sizer.getBoundingClientRect();r+=o.left,i+=o.top}var a=t.display.lineSpace.getBoundingClientRect();return{left:r-a.left,top:i-a.top}}function Kn(t,e,n,r,i){return r||(r=Kt(t.doc,e.line)),Vn(t,r,Dn(t,r,e.ch,i),n)}function qn(t,e,n,r,i,o){function a(e,a){var s=In(t,i,e,a?"right":"left",o);return a?s.left=s.right:s.right=s.left,Vn(t,r,s,n)}r=r||Kt(t.doc,e.line),i||(i=Mn(t,r));var s=ct(r,t.doc.direction),l=e.ch,c=e.sticky;if(l>=r.text.length?(l=r.text.length,c="before"):l<=0&&(l=0,c="after"),!s)return a("before"==c?l-1:l,"before"==c);function u(t,e,n){return a(n?t-1:t,1==s[e].level!=n)}var h=st(s,l,c),d=at,f=u(l,h,"before"==c);return null!=d&&(f.other=u(l,d,"before"!=c)),f}function Yn(t,e){var n=0;e=se(t.doc,e),t.options.lineWrapping||(n=ir(t.display)*e.ch);var r=Kt(t.doc,e.line),i=Ge(r)+En(t.display);return{left:n,right:n,top:i,bottom:i+r.height}}function Xn(t,e,n,r,i){var o=te(t,e,n);return o.xRel=i,r&&(o.outside=r),o}function $n(t,e,n){var r=t.doc;if((n+=t.display.viewOffset)<0)return Xn(r.first,0,null,-1,-1);var i=Zt(r,n),o=r.first+r.size-1;if(i>o)return Xn(r.first+r.size-1,Kt(r,o).text.length,null,1,1);e<0&&(e=0);for(var a=Kt(r,i);;){var s=tr(t,a,i,e,n),l=Ne(a,s.ch+(s.xRel>0||s.outside>0?1:0));if(!l)return s;var c=l.find(1);if(c.line==i)return c;a=Kt(r,i=c.line)}}function Zn(t,e,n,r){r-=Gn(e);var i=e.text.length,o=ot((function(e){return In(t,n,e-1).bottom<=r}),i,0);return{begin:o,end:i=ot((function(e){return In(t,n,e).top>r}),o,i)}}function Jn(t,e,n,r){return n||(n=Mn(t,e)),Zn(t,e,n,Vn(t,e,In(t,n,r),"line").top)}function Qn(t,e,n,r){return!(t.bottom<=n)&&(t.top>n||(r?t.left:t.right)>e)}function tr(t,e,n,r,i){i-=Ge(e);var o=Mn(t,e),a=Gn(e),s=0,l=e.text.length,c=!0,u=ct(e,t.doc.direction);if(u){var h=(t.options.lineWrapping?nr:er)(t,e,n,o,u,r,i);s=(c=1!=h.level)?h.from:h.to-1,l=c?h.to:h.from-1}var d,f,p=null,g=null,m=ot((function(e){var n=In(t,o,e);return n.top+=a,n.bottom+=a,!!Qn(n,r,i,!1)&&(n.top<=i&&n.left<=r&&(p=e,g=n),!0)}),s,l),v=!1;if(g){var y=r-g.left<g.right-r,b=y==c;m=p+(b?0:1),f=b?"after":"before",d=y?g.left:g.right}else{c||m!=l&&m!=s||m++,f=0==m?"after":m==e.text.length?"before":In(t,o,m-(c?1:0)).bottom+a<=i==c?"after":"before";var x=qn(t,te(n,m,f),"line",e,o);d=x.left,v=i<x.top?-1:i>=x.bottom?1:0}return Xn(n,m=it(e.text,m,1),f,v,r-d)}function er(t,e,n,r,i,o,a){var s=ot((function(s){var l=i[s],c=1!=l.level;return Qn(qn(t,te(n,c?l.to:l.from,c?"before":"after"),"line",e,r),o,a,!0)}),0,i.length-1),l=i[s];if(s>0){var c=1!=l.level,u=qn(t,te(n,c?l.from:l.to,c?"after":"before"),"line",e,r);Qn(u,o,a,!0)&&u.top>a&&(l=i[s-1])}return l}function nr(t,e,n,r,i,o,a){var s=Zn(t,e,r,a),l=s.begin,c=s.end;/\s/.test(e.text.charAt(c-1))&&c--;for(var u=null,h=null,d=0;d<i.length;d++){var f=i[d];if(!(f.from>=c||f.to<=l)){var p=In(t,r,1!=f.level?Math.min(c,f.to)-1:Math.max(l,f.from)).right,g=p<o?o-p+1e9:p-o;(!u||h>g)&&(u=f,h=g)}}return u||(u=i[i.length-1]),u.from<l&&(u={from:l,to:u.to,level:u.level}),u.to>c&&(u={from:u.from,to:c,level:u.level}),u}function rr(t){if(null!=t.cachedTextHeight)return t.cachedTextHeight;if(null==_n){_n=A("pre",null,"CodeMirror-line-like");for(var e=0;e<49;++e)_n.appendChild(document.createTextNode("x")),_n.appendChild(A("br"));_n.appendChild(document.createTextNode("x"))}L(t.measure,_n);var n=_n.offsetHeight/50;return n>3&&(t.cachedTextHeight=n),O(t.measure),n||1}function ir(t){if(null!=t.cachedCharWidth)return t.cachedCharWidth;var e=A("span","xxxxxxxxxx"),n=A("pre",[e],"CodeMirror-line-like");L(t.measure,n);var r=e.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(t.cachedCharWidth=i),i||10}function or(t){for(var e=t.display,n={},r={},i=e.gutters.clientLeft,o=e.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var s=t.display.gutterSpecs[a].className;n[s]=o.offsetLeft+o.clientLeft+i,r[s]=o.clientWidth}return{fixedPos:ar(e),gutterTotalWidth:e.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:e.wrapper.clientWidth}}function ar(t){return t.scroller.getBoundingClientRect().left-t.sizer.getBoundingClientRect().left}function sr(t){var e=rr(t.display),n=t.options.lineWrapping,r=n&&Math.max(5,t.display.scroller.clientWidth/ir(t.display)-3);return function(i){if(He(t.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height);return n?o+(Math.ceil(i.text.length/r)||1)*e:o+e}}function lr(t){var e=t.doc,n=sr(t);e.iter((function(t){var e=n(t);e!=t.height&&Xt(t,e)}))}function cr(t,e,n,r){var i=t.display;if(!n&&"true"==Et(e).getAttribute("cm-not-content"))return null;var o,a,s=i.lineSpace.getBoundingClientRect();try{o=e.clientX-s.left,a=e.clientY-s.top}catch(t){return null}var l,c=$n(t,o,a);if(r&&c.xRel>0&&(l=Kt(t.doc,c.line).text).length==c.ch){var u=F(l,l.length,t.options.tabSize)-l.length;c=te(c.line,Math.max(0,Math.round((o-wn(t.display).left)/ir(t.display))-u))}return c}function ur(t,e){if(e>=t.display.viewTo)return null;if((e-=t.display.viewFrom)<0)return null;for(var n=t.display.view,r=0;r<n.length;r++)if((e-=n[r].size)<0)return r}function hr(t,e,n,r){null==e&&(e=t.doc.first),null==n&&(n=t.doc.first+t.doc.size),r||(r=0);var i=t.display;if(r&&n<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>e)&&(i.updateLineNumbers=e),t.curOp.viewChanged=!0,e>=i.viewTo)Se&&Be(t.doc,e)<i.viewTo&&fr(t);else if(n<=i.viewFrom)Se&&Ue(t.doc,n+r)>i.viewFrom?fr(t):(i.viewFrom+=r,i.viewTo+=r);else if(e<=i.viewFrom&&n>=i.viewTo)fr(t);else if(e<=i.viewFrom){var o=pr(t,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):fr(t)}else if(n>=i.viewTo){var a=pr(t,e,e,-1);a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):fr(t)}else{var s=pr(t,e,e,-1),l=pr(t,n,n+r,1);s&&l?(i.view=i.view.slice(0,s.index).concat(on(t,s.lineN,l.lineN)).concat(i.view.slice(l.index)),i.viewTo+=r):fr(t)}var c=i.externalMeasured;c&&(n<c.lineN?c.lineN+=r:e<c.lineN+c.size&&(i.externalMeasured=null))}function dr(t,e,n){t.curOp.viewChanged=!0;var r=t.display,i=t.display.externalMeasured;if(i&&e>=i.lineN&&e<i.lineN+i.size&&(r.externalMeasured=null),!(e<r.viewFrom||e>=r.viewTo)){var o=r.view[ur(t,e)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==U(a,n)&&a.push(n)}}}function fr(t){t.display.viewFrom=t.display.viewTo=t.doc.first,t.display.view=[],t.display.viewOffset=0}function pr(t,e,n,r){var i,o=ur(t,e),a=t.display.view;if(!Se||n==t.doc.first+t.doc.size)return{index:o,lineN:n};for(var s=t.display.viewFrom,l=0;l<o;l++)s+=a[l].size;if(s!=e){if(r>0){if(o==a.length-1)return null;i=s+a[o].size-e,o++}else i=s-e;e+=i,n+=i}for(;Be(t.doc,n)!=n;){if(o==(r<0?0:a.length-1))return null;n+=r*a[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function gr(t){for(var e=t.display.view,n=0,r=0;r<e.length;r++){var i=e[r];i.hidden||i.node&&!i.changes||++n}return n}function mr(t){t.display.input.showSelection(t.display.input.prepareSelection())}function vr(t,e){void 0===e&&(e=!0);for(var n=t.doc,r={},i=r.cursors=document.createDocumentFragment(),o=r.selection=document.createDocumentFragment(),a=0;a<n.sel.ranges.length;a++)if(e||a!=n.sel.primIndex){var s=n.sel.ranges[a];if(!(s.from().line>=t.display.viewTo||s.to().line<t.display.viewFrom)){var l=s.empty();(l||t.options.showCursorWhenSelecting)&&yr(t,s.head,i),l||xr(t,s,o)}}return r}function yr(t,e,n){var r=qn(t,e,"div",null,null,!t.options.singleCursorHeightPerLine),i=n.appendChild(A("div"," ","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*t.options.cursorHeight+"px",r.other){var o=n.appendChild(A("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=r.other.left+"px",o.style.top=r.other.top+"px",o.style.height=.85*(r.other.bottom-r.other.top)+"px"}}function br(t,e){return t.top-e.top||t.left-e.left}function xr(t,e,n){var r=t.display,i=t.doc,o=document.createDocumentFragment(),a=wn(t.display),s=a.left,l=Math.max(r.sizerWidth,On(t)-r.sizer.offsetLeft)-a.right,c="ltr"==i.direction;function u(t,e,n,r){e<0&&(e=0),e=Math.round(e),r=Math.round(r),o.appendChild(A("div",null,"CodeMirror-selected","position: absolute; left: "+t+"px;\n top: "+e+"px; width: "+(null==n?l-t:n)+"px;\n height: "+(r-e)+"px"))}function h(e,n,r){var o,a,h=Kt(i,e),d=h.text.length;function f(n,r){return Kn(t,te(e,n),"div",h,r)}function p(e,n,r){var i=Jn(t,h,null,e),o="ltr"==n==("after"==r)?"left":"right";return f("after"==r?i.begin:i.end-(/\s/.test(h.text.charAt(i.end-1))?2:1),o)[o]}var g=ct(h,i.direction);return function(t,e,n,r){if(!t)return r(e,n,"ltr",0);for(var i=!1,o=0;o<t.length;++o){var a=t[o];(a.from<n&&a.to>e||e==n&&a.to==e)&&(r(Math.max(a.from,e),Math.min(a.to,n),1==a.level?"rtl":"ltr",o),i=!0)}i||r(e,n,"ltr")}(g,n||0,null==r?d:r,(function(t,e,i,h){var m="ltr"==i,v=f(t,m?"left":"right"),y=f(e-1,m?"right":"left"),b=null==n&&0==t,x=null==r&&e==d,C=0==h,S=!g||h==g.length-1;if(y.top-v.top<=3){var E=(c?x:b)&&S,k=(c?b:x)&&C?s:(m?v:y).left,w=E?l:(m?y:v).right;u(k,v.top,w-k,v.bottom)}else{var T,O,L,A;m?(T=c&&b&&C?s:v.left,O=c?l:p(t,i,"before"),L=c?s:p(e,i,"after"),A=c&&x&&S?l:y.right):(T=c?p(t,i,"before"):s,O=!c&&b&&C?l:v.right,L=!c&&x&&S?s:y.left,A=c?p(e,i,"after"):l),u(T,v.top,O-T,v.bottom),v.bottom<y.top&&u(s,v.bottom,null,y.top),u(L,y.top,A-L,y.bottom)}(!o||br(v,o)<0)&&(o=v),br(y,o)<0&&(o=y),(!a||br(v,a)<0)&&(a=v),br(y,a)<0&&(a=y)})),{start:o,end:a}}var d=e.from(),f=e.to();if(d.line==f.line)h(d.line,d.ch,f.ch);else{var p=Kt(i,d.line),g=Kt(i,f.line),m=Fe(p)==Fe(g),v=h(d.line,d.ch,m?p.text.length+1:null).end,y=h(f.line,m?0:null,f.ch).start;m&&(v.top<y.top-2?(u(v.right,v.top,null,v.bottom),u(s,y.top,y.left,y.bottom)):u(v.right,v.top,y.left-v.right,v.bottom)),v.bottom<y.top&&u(s,v.bottom,null,y.top)}n.appendChild(o)}function Cr(t){if(t.state.focused){var e=t.display;clearInterval(e.blinker);var n=!0;e.cursorDiv.style.visibility="",t.options.cursorBlinkRate>0?e.blinker=setInterval((function(){t.hasFocus()||wr(t),e.cursorDiv.style.visibility=(n=!n)?"":"hidden"}),t.options.cursorBlinkRate):t.options.cursorBlinkRate<0&&(e.cursorDiv.style.visibility="hidden")}}function Sr(t){t.state.focused||(t.display.input.focus(),kr(t))}function Er(t){t.state.delayingBlurEvent=!0,setTimeout((function(){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1,wr(t))}),100)}function kr(t,e){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1),"nocursor"!=t.options.readOnly&&(t.state.focused||(pt(t,"focus",t,e),t.state.focused=!0,I(t.display.wrapper,"CodeMirror-focused"),t.curOp||t.display.selForContextMenu==t.doc.sel||(t.display.input.reset(),l&&setTimeout((function(){return t.display.input.reset(!0)}),20)),t.display.input.receivedFocus()),Cr(t))}function wr(t,e){t.state.delayingBlurEvent||(t.state.focused&&(pt(t,"blur",t,e),t.state.focused=!1,T(t.display.wrapper,"CodeMirror-focused")),clearInterval(t.display.blinker),setTimeout((function(){t.state.focused||(t.display.shift=!1)}),150))}function Tr(t){for(var e=t.display,n=e.lineDiv.offsetTop,r=0;r<e.view.length;r++){var i=e.view[r],o=t.options.lineWrapping,l=void 0,c=0;if(!i.hidden){if(a&&s<8){var u=i.node.offsetTop+i.node.offsetHeight;l=u-n,n=u}else{var h=i.node.getBoundingClientRect();l=h.bottom-h.top,!o&&i.text.firstChild&&(c=i.text.firstChild.getBoundingClientRect().right-h.left-1)}var d=i.line.height-l;if((d>.005||d<-.005)&&(Xt(i.line,l),Or(i.line),i.rest))for(var f=0;f<i.rest.length;f++)Or(i.rest[f]);if(c>t.display.sizerWidth){var p=Math.ceil(c/ir(t.display));p>t.display.maxLineLength&&(t.display.maxLineLength=p,t.display.maxLine=i.line,t.display.maxLineChanged=!0)}}}}function Or(t){if(t.widgets)for(var e=0;e<t.widgets.length;++e){var n=t.widgets[e],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function Lr(t,e,n){var r=n&&null!=n.top?Math.max(0,n.top):t.scroller.scrollTop;r=Math.floor(r-En(t));var i=n&&null!=n.bottom?n.bottom:r+t.wrapper.clientHeight,o=Zt(e,r),a=Zt(e,i);if(n&&n.ensure){var s=n.ensure.from.line,l=n.ensure.to.line;s<o?(o=s,a=Zt(e,Ge(Kt(e,s))+t.wrapper.clientHeight)):Math.min(l,e.lastLine())>=a&&(o=Zt(e,Ge(Kt(e,l))-t.wrapper.clientHeight),a=l)}return{from:o,to:Math.max(a,o+1)}}function Ar(t,e){var n=t.display,r=rr(t.display);e.top<0&&(e.top=0);var i=t.curOp&&null!=t.curOp.scrollTop?t.curOp.scrollTop:n.scroller.scrollTop,o=Ln(t),a={};e.bottom-e.top>o&&(e.bottom=e.top+o);var s=t.doc.height+kn(n),l=e.top<r,c=e.bottom>s-r;if(e.top<i)a.scrollTop=l?0:e.top;else if(e.bottom>i+o){var u=Math.min(e.top,(c?s:e.bottom)-o);u!=i&&(a.scrollTop=u)}var h=t.options.fixedGutter?0:n.gutters.offsetWidth,d=t.curOp&&null!=t.curOp.scrollLeft?t.curOp.scrollLeft:n.scroller.scrollLeft-h,f=On(t)-n.gutters.offsetWidth,p=e.right-e.left>f;return p&&(e.right=e.left+f),e.left<10?a.scrollLeft=0:e.left<d?a.scrollLeft=Math.max(0,e.left+h-(p?0:10)):e.right>f+d-3&&(a.scrollLeft=e.right+(p?0:10)-f),a}function Dr(t,e){null!=e&&(Ir(t),t.curOp.scrollTop=(null==t.curOp.scrollTop?t.doc.scrollTop:t.curOp.scrollTop)+e)}function Rr(t){Ir(t);var e=t.getCursor();t.curOp.scrollToPos={from:e,to:e,margin:t.options.cursorScrollMargin}}function Mr(t,e,n){null==e&&null==n||Ir(t),null!=e&&(t.curOp.scrollLeft=e),null!=n&&(t.curOp.scrollTop=n)}function Ir(t){var e=t.curOp.scrollToPos;e&&(t.curOp.scrollToPos=null,_r(t,Yn(t,e.from),Yn(t,e.to),e.margin))}function _r(t,e,n,r){var i=Ar(t,{left:Math.min(e.left,n.left),top:Math.min(e.top,n.top)-r,right:Math.max(e.right,n.right),bottom:Math.max(e.bottom,n.bottom)+r});Mr(t,i.scrollLeft,i.scrollTop)}function Pr(t,e){Math.abs(t.doc.scrollTop-e)<2||(n||li(t,{top:e}),Nr(t,e,!0),n&&li(t),ri(t,100))}function Nr(t,e,n){e=Math.max(0,Math.min(t.display.scroller.scrollHeight-t.display.scroller.clientHeight,e)),(t.display.scroller.scrollTop!=e||n)&&(t.doc.scrollTop=e,t.display.scrollbars.setScrollTop(e),t.display.scroller.scrollTop!=e&&(t.display.scroller.scrollTop=e))}function jr(t,e,n,r){e=Math.max(0,Math.min(e,t.display.scroller.scrollWidth-t.display.scroller.clientWidth)),(n?e==t.doc.scrollLeft:Math.abs(t.doc.scrollLeft-e)<2)&&!r||(t.doc.scrollLeft=e,hi(t),t.display.scroller.scrollLeft!=e&&(t.display.scroller.scrollLeft=e),t.display.scrollbars.setScrollLeft(e))}function Fr(t){var e=t.display,n=e.gutters.offsetWidth,r=Math.round(t.doc.height+kn(t.display));return{clientHeight:e.scroller.clientHeight,viewHeight:e.wrapper.clientHeight,scrollWidth:e.scroller.scrollWidth,clientWidth:e.scroller.clientWidth,viewWidth:e.wrapper.clientWidth,barLeft:t.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Tn(t)+e.barHeight,nativeBarWidth:e.nativeBarWidth,gutterWidth:n}}var Br=function(t,e,n){this.cm=n;var r=this.vert=A("div",[A("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=A("div",[A("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,t(r),t(i),ht(r,"scroll",(function(){r.clientHeight&&e(r.scrollTop,"vertical")})),ht(i,"scroll",(function(){i.clientWidth&&e(i.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,a&&s<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Br.prototype.update=function(t){var e=t.scrollWidth>t.clientWidth+1,n=t.scrollHeight>t.clientHeight+1,r=t.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=e?r+"px":"0";var i=t.viewHeight-(e?r:0);this.vert.firstChild.style.height=Math.max(0,t.scrollHeight-t.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(e){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=t.barLeft+"px";var o=t.viewWidth-t.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,t.scrollWidth-t.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&t.clientHeight>0&&(0==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:e?r:0}},Br.prototype.setScrollLeft=function(t){this.horiz.scrollLeft!=t&&(this.horiz.scrollLeft=t),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Br.prototype.setScrollTop=function(t){this.vert.scrollTop!=t&&(this.vert.scrollTop=t),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Br.prototype.zeroWidthHack=function(){var t=y&&!f?"12px":"18px";this.horiz.style.height=this.vert.style.width=t,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new B,this.disableVert=new B},Br.prototype.enableZeroWidthBar=function(t,e,n){t.style.pointerEvents="auto",e.set(1e3,(function r(){var i=t.getBoundingClientRect();("vert"==n?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1))!=t?t.style.pointerEvents="none":e.set(1e3,r)}))},Br.prototype.clear=function(){var t=this.horiz.parentNode;t.removeChild(this.horiz),t.removeChild(this.vert)};var Ur=function(){};function Hr(t,e){e||(e=Fr(t));var n=t.display.barWidth,r=t.display.barHeight;zr(t,e);for(var i=0;i<4&&n!=t.display.barWidth||r!=t.display.barHeight;i++)n!=t.display.barWidth&&t.options.lineWrapping&&Tr(t),zr(t,Fr(t)),n=t.display.barWidth,r=t.display.barHeight}function zr(t,e){var n=t.display,r=n.scrollbars.update(e);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&t.options.coverGutterNextToScrollbar&&t.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=e.gutterWidth+"px"):n.gutterFiller.style.display=""}Ur.prototype.update=function(){return{bottom:0,right:0}},Ur.prototype.setScrollLeft=function(){},Ur.prototype.setScrollTop=function(){},Ur.prototype.clear=function(){};var Gr={native:Br,null:Ur};function Vr(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&T(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new Gr[t.options.scrollbarStyle]((function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),ht(e,"mousedown",(function(){t.state.focused&&setTimeout((function(){return t.display.input.focus()}),0)})),e.setAttribute("cm-not-content","true")}),(function(e,n){"horizontal"==n?jr(t,e):Pr(t,e)}),t),t.display.scrollbars.addClass&&I(t.display.wrapper,t.display.scrollbars.addClass)}var Wr=0;function Kr(t){var e;t.curOp={cm:t,viewChanged:!1,startHeight:t.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:++Wr},e=t.curOp,an?an.ops.push(e):e.ownsGroup=an={ops:[e],delayedCallbacks:[]}}function qr(t){var e=t.curOp;e&&function(t,e){var n=t.ownsGroup;if(n)try{!function(t){var e=t.delayedCallbacks,n=0;do{for(;n<e.length;n++)e[n].call(null);for(var r=0;r<t.ops.length;r++){var i=t.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<e.length)}(n)}finally{an=null,e(n)}}(e,(function(t){for(var e=0;e<t.ops.length;e++)t.ops[e].cm.curOp=null;!function(t){for(var e=t.ops,n=0;n<e.length;n++)Yr(e[n]);for(var r=0;r<e.length;r++)Xr(e[r]);for(var i=0;i<e.length;i++)$r(e[i]);for(var o=0;o<e.length;o++)Zr(e[o]);for(var a=0;a<e.length;a++)Jr(e[a])}(t)}))}function Yr(t){var e=t.cm,n=e.display;!function(t){var e=t.display;!e.scrollbarsClipped&&e.scroller.offsetWidth&&(e.nativeBarWidth=e.scroller.offsetWidth-e.scroller.clientWidth,e.heightForcer.style.height=Tn(t)+"px",e.sizer.style.marginBottom=-e.nativeBarWidth+"px",e.sizer.style.borderRightWidth=Tn(t)+"px",e.scrollbarsClipped=!0)}(e),t.updateMaxLine&&We(e),t.mustUpdate=t.viewChanged||t.forceUpdate||null!=t.scrollTop||t.scrollToPos&&(t.scrollToPos.from.line<n.viewFrom||t.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&e.options.lineWrapping,t.update=t.mustUpdate&&new oi(e,t.mustUpdate&&{top:t.scrollTop,ensure:t.scrollToPos},t.forceUpdate)}function Xr(t){t.updatedDisplay=t.mustUpdate&&ai(t.cm,t.update)}function $r(t){var e=t.cm,n=e.display;t.updatedDisplay&&Tr(e),t.barMeasure=Fr(e),n.maxLineChanged&&!e.options.lineWrapping&&(t.adjustWidthTo=Dn(e,n.maxLine,n.maxLine.text.length).left+3,e.display.sizerWidth=t.adjustWidthTo,t.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+t.adjustWidthTo+Tn(e)+e.display.barWidth),t.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+t.adjustWidthTo-On(e))),(t.updatedDisplay||t.selectionChanged)&&(t.preparedSelection=n.input.prepareSelection())}function Zr(t){var e=t.cm;null!=t.adjustWidthTo&&(e.display.sizer.style.minWidth=t.adjustWidthTo+"px",t.maxScrollLeft<e.doc.scrollLeft&&jr(e,Math.min(e.display.scroller.scrollLeft,t.maxScrollLeft),!0),e.display.maxLineChanged=!1);var n=t.focus&&t.focus==M();t.preparedSelection&&e.display.input.showSelection(t.preparedSelection,n),(t.updatedDisplay||t.startHeight!=e.doc.height)&&Hr(e,t.barMeasure),t.updatedDisplay&&ui(e,t.barMeasure),t.selectionChanged&&Cr(e),e.state.focused&&t.updateInput&&e.display.input.reset(t.typing),n&&Sr(t.cm)}function Jr(t){var e=t.cm,n=e.display,r=e.doc;t.updatedDisplay&&si(e,t.update),null==n.wheelStartX||null==t.scrollTop&&null==t.scrollLeft&&!t.scrollToPos||(n.wheelStartX=n.wheelStartY=null),null!=t.scrollTop&&Nr(e,t.scrollTop,t.forceScroll),null!=t.scrollLeft&&jr(e,t.scrollLeft,!0,!0),t.scrollToPos&&function(t,e){if(!gt(t,"scrollCursorIntoView")){var n=t.display,r=n.sizer.getBoundingClientRect(),i=null;if(e.top+r.top<0?i=!0:e.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!p){var o=A("div","",null,"position: absolute;\n top: "+(e.top-n.viewOffset-En(t.display))+"px;\n height: "+(e.bottom-e.top+Tn(t)+n.barHeight)+"px;\n left: "+e.left+"px; width: "+Math.max(2,e.right-e.left)+"px;");t.display.lineSpace.appendChild(o),o.scrollIntoView(i),t.display.lineSpace.removeChild(o)}}}(e,function(t,e,n,r){var i;null==r&&(r=0),t.options.lineWrapping||e!=n||(n="before"==(e=e.ch?te(e.line,"before"==e.sticky?e.ch-1:e.ch,"after"):e).sticky?te(e.line,e.ch+1,"before"):e);for(var o=0;o<5;o++){var a=!1,s=qn(t,e),l=n&&n!=e?qn(t,n):s,c=Ar(t,i={left:Math.min(s.left,l.left),top:Math.min(s.top,l.top)-r,right:Math.max(s.left,l.left),bottom:Math.max(s.bottom,l.bottom)+r}),u=t.doc.scrollTop,h=t.doc.scrollLeft;if(null!=c.scrollTop&&(Pr(t,c.scrollTop),Math.abs(t.doc.scrollTop-u)>1&&(a=!0)),null!=c.scrollLeft&&(jr(t,c.scrollLeft),Math.abs(t.doc.scrollLeft-h)>1&&(a=!0)),!a)break}return i}(e,se(r,t.scrollToPos.from),se(r,t.scrollToPos.to),t.scrollToPos.margin));var i=t.maybeHiddenMarkers,o=t.maybeUnhiddenMarkers;if(i)for(var a=0;a<i.length;++a)i[a].lines.length||pt(i[a],"hide");if(o)for(var s=0;s<o.length;++s)o[s].lines.length&&pt(o[s],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=e.display.scroller.scrollTop),t.changeObjs&&pt(e,"changes",e,t.changeObjs),t.update&&t.update.finish()}function Qr(t,e){if(t.curOp)return e();Kr(t);try{return e()}finally{qr(t)}}function ti(t,e){return function(){if(t.curOp)return e.apply(t,arguments);Kr(t);try{return e.apply(t,arguments)}finally{qr(t)}}}function ei(t){return function(){if(this.curOp)return t.apply(this,arguments);Kr(this);try{return t.apply(this,arguments)}finally{qr(this)}}}function ni(t){return function(){var e=this.cm;if(!e||e.curOp)return t.apply(this,arguments);Kr(e);try{return t.apply(this,arguments)}finally{qr(e)}}}function ri(t,e){t.doc.highlightFrontier<t.display.viewTo&&t.state.highlight.set(e,N(ii,t))}function ii(t){var e=t.doc;if(!(e.highlightFrontier>=t.display.viewTo)){var n=+new Date+t.options.workTime,r=fe(t,e.highlightFrontier),i=[];e.iter(r.line,Math.min(e.first+e.size,t.display.viewTo+500),(function(o){if(r.line>=t.display.viewFrom){var a=o.styles,s=o.text.length>t.options.maxHighlightLength?zt(e.mode,r.state):null,l=he(t,o,r,!0);s&&(r.state=s),o.styles=l.styles;var c=o.styleClasses,u=l.classes;u?o.styleClasses=u:c&&(o.styleClasses=null);for(var h=!a||a.length!=o.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),d=0;!h&&d<a.length;++d)h=a[d]!=o.styles[d];h&&i.push(r.line),o.stateAfter=r.save(),r.nextLine()}else o.text.length<=t.options.maxHighlightLength&&pe(t,o.text,r),o.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return ri(t,t.options.workDelay),!0})),e.highlightFrontier=r.line,e.modeFrontier=Math.max(e.modeFrontier,r.line),i.length&&Qr(t,(function(){for(var e=0;e<i.length;e++)dr(t,i[e],"text")}))}}var oi=function(t,e,n){var r=t.display;this.viewport=e,this.visible=Lr(r,t.doc,e),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=On(t),this.force=n,this.dims=or(t),this.events=[]};function ai(t,e){var n=t.display,r=t.doc;if(e.editorIsHidden)return fr(t),!1;if(!e.force&&e.visible.from>=n.viewFrom&&e.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==gr(t))return!1;di(t)&&(fr(t),e.dims=or(t));var i=r.first+r.size,o=Math.max(e.visible.from-t.options.viewportMargin,r.first),a=Math.min(i,e.visible.to+t.options.viewportMargin);n.viewFrom<o&&o-n.viewFrom<20&&(o=Math.max(r.first,n.viewFrom)),n.viewTo>a&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo)),Se&&(o=Be(t.doc,o),a=Ue(t.doc,a));var s=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=e.wrapperHeight||n.lastWrapWidth!=e.wrapperWidth;!function(t,e,n){var r=t.display;0==r.view.length||e>=r.viewTo||n<=r.viewFrom?(r.view=on(t,e,n),r.viewFrom=e):(r.viewFrom>e?r.view=on(t,e,r.viewFrom).concat(r.view):r.viewFrom<e&&(r.view=r.view.slice(ur(t,e))),r.viewFrom=e,r.viewTo<n?r.view=r.view.concat(on(t,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,ur(t,n)))),r.viewTo=n}(t,o,a),n.viewOffset=Ge(Kt(t.doc,n.viewFrom)),t.display.mover.style.top=n.viewOffset+"px";var c=gr(t);if(!s&&0==c&&!e.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var u=function(t){if(t.hasFocus())return null;var e=M();if(!e||!R(t.display.lineDiv,e))return null;var n={activeElt:e};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&R(t.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}(t);return c>4&&(n.lineDiv.style.display="none"),function(t,e,n){var r=t.display,i=t.options.lineNumbers,o=r.lineDiv,a=o.firstChild;function s(e){var n=e.nextSibling;return l&&y&&t.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),n}for(var c=r.view,u=r.viewFrom,h=0;h<c.length;h++){var d=c[h];if(d.hidden);else if(d.node&&d.node.parentNode==o){for(;a!=d.node;)a=s(a);var f=i&&null!=e&&e<=u&&d.lineNumber;d.changes&&(U(d.changes,"gutter")>-1&&(f=!1),un(t,d,u,n)),f&&(O(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(Qt(t.options,u)))),a=d.node.nextSibling}else{var p=vn(t,d,u,n);o.insertBefore(p,a)}u+=d.size}for(;a;)a=s(a)}(t,n.updateLineNumbers,e.dims),c>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,function(t){if(t&&t.activeElt&&t.activeElt!=M()&&(t.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(t.activeElt.nodeName)&&t.anchorNode&&R(document.body,t.anchorNode)&&R(document.body,t.focusNode))){var e=window.getSelection(),n=document.createRange();n.setEnd(t.anchorNode,t.anchorOffset),n.collapse(!1),e.removeAllRanges(),e.addRange(n),e.extend(t.focusNode,t.focusOffset)}}(u),O(n.cursorDiv),O(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,s&&(n.lastWrapHeight=e.wrapperHeight,n.lastWrapWidth=e.wrapperWidth,ri(t,400)),n.updateLineNumbers=null,!0}function si(t,e){for(var n=e.viewport,r=!0;;r=!1){if(r&&t.options.lineWrapping&&e.oldDisplayWidth!=On(t))r&&(e.visible=Lr(t.display,t.doc,n));else if(n&&null!=n.top&&(n={top:Math.min(t.doc.height+kn(t.display)-Ln(t),n.top)}),e.visible=Lr(t.display,t.doc,n),e.visible.from>=t.display.viewFrom&&e.visible.to<=t.display.viewTo)break;if(!ai(t,e))break;Tr(t);var i=Fr(t);mr(t),Hr(t,i),ui(t,i),e.force=!1}e.signal(t,"update",t),t.display.viewFrom==t.display.reportedViewFrom&&t.display.viewTo==t.display.reportedViewTo||(e.signal(t,"viewportChange",t,t.display.viewFrom,t.display.viewTo),t.display.reportedViewFrom=t.display.viewFrom,t.display.reportedViewTo=t.display.viewTo)}function li(t,e){var n=new oi(t,e);if(ai(t,n)){Tr(t),si(t,n);var r=Fr(t);mr(t),Hr(t,r),ui(t,r),n.finish()}}function ci(t){var e=t.gutters.offsetWidth;t.sizer.style.marginLeft=e+"px"}function ui(t,e){t.display.sizer.style.minHeight=e.docHeight+"px",t.display.heightForcer.style.top=e.docHeight+"px",t.display.gutters.style.height=e.docHeight+t.display.barHeight+Tn(t)+"px"}function hi(t){var e=t.display,n=e.view;if(e.alignWidgets||e.gutters.firstChild&&t.options.fixedGutter){for(var r=ar(e)-e.scroller.scrollLeft+t.doc.scrollLeft,i=e.gutters.offsetWidth,o=r+"px",a=0;a<n.length;a++)if(!n[a].hidden){t.options.fixedGutter&&(n[a].gutter&&(n[a].gutter.style.left=o),n[a].gutterBackground&&(n[a].gutterBackground.style.left=o));var s=n[a].alignable;if(s)for(var l=0;l<s.length;l++)s[l].style.left=o}t.options.fixedGutter&&(e.gutters.style.left=r+i+"px")}}function di(t){if(!t.options.lineNumbers)return!1;var e=t.doc,n=Qt(t.options,e.first+e.size-1),r=t.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(A("div",[A("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,a=i.offsetWidth-o;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(o,r.lineGutter.offsetWidth-a)+1,r.lineNumWidth=r.lineNumInnerWidth+a,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",ci(t.display),!0}return!1}function fi(t,e){for(var n=[],r=!1,i=0;i<t.length;i++){var o=t[i],a=null;if("string"!=typeof o&&(a=o.style,o=o.className),"CodeMirror-linenumbers"==o){if(!e)continue;r=!0}n.push({className:o,style:a})}return e&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function pi(t){var e=t.gutters,n=t.gutterSpecs;O(e),t.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],o=i.className,a=i.style,s=e.appendChild(A("div",null,"CodeMirror-gutter "+o));a&&(s.style.cssText=a),"CodeMirror-linenumbers"==o&&(t.lineGutter=s,s.style.width=(t.lineNumWidth||1)+"px")}e.style.display=n.length?"":"none",ci(t)}function gi(t){pi(t.display),hr(t),hi(t)}function mi(t,e,r,i){var o=this;this.input=r,o.scrollbarFiller=A("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=A("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=D("div",null,"CodeMirror-code"),o.selectionDiv=A("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=A("div",null,"CodeMirror-cursors"),o.measure=A("div",null,"CodeMirror-measure"),o.lineMeasure=A("div",null,"CodeMirror-measure"),o.lineSpace=D("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var c=D("div",[o.lineSpace],"CodeMirror-lines");o.mover=A("div",[c],null,"position: relative"),o.sizer=A("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=A("div",null,null,"position: absolute; height: 50px; width: 1px;"),o.gutters=A("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=A("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=A("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),a&&s<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),l||n&&v||(o.scroller.draggable=!0),t&&(t.appendChild?t.appendChild(o.wrapper):t(o.wrapper)),o.viewFrom=o.viewTo=e.first,o.reportedViewFrom=o.reportedViewTo=e.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,o.gutterSpecs=fi(i.gutters,i.lineNumbers),pi(o),r.init(o)}oi.prototype.signal=function(t,e){vt(t,e)&&this.events.push(arguments)},oi.prototype.finish=function(){for(var t=0;t<this.events.length;t++)pt.apply(null,this.events[t])};var vi=0,yi=null;function bi(t){var e=t.wheelDeltaX,n=t.wheelDeltaY;return null==e&&t.detail&&t.axis==t.HORIZONTAL_AXIS&&(e=t.detail),null==n&&t.detail&&t.axis==t.VERTICAL_AXIS?n=t.detail:null==n&&(n=t.wheelDelta),{x:e,y:n}}function xi(t){var e=bi(t);return e.x*=yi,e.y*=yi,e}function Ci(t,e){var r=bi(e),i=r.x,o=r.y,a=t.display,s=a.scroller,c=s.scrollWidth>s.clientWidth,u=s.scrollHeight>s.clientHeight;if(i&&c||o&&u){if(o&&y&&l)t:for(var d=e.target,f=a.view;d!=s;d=d.parentNode)for(var p=0;p<f.length;p++)if(f[p].node==d){t.display.currentWheelTarget=d;break t}if(i&&!n&&!h&&null!=yi)return o&&u&&Pr(t,Math.max(0,s.scrollTop+o*yi)),jr(t,Math.max(0,s.scrollLeft+i*yi)),(!o||o&&u)&&bt(e),void(a.wheelStartX=null);if(o&&null!=yi){var g=o*yi,m=t.doc.scrollTop,v=m+a.wrapper.clientHeight;g<0?m=Math.max(0,m+g-50):v=Math.min(t.doc.height,v+g+50),li(t,{top:m,bottom:v})}vi<20&&(null==a.wheelStartX?(a.wheelStartX=s.scrollLeft,a.wheelStartY=s.scrollTop,a.wheelDX=i,a.wheelDY=o,setTimeout((function(){if(null!=a.wheelStartX){var t=s.scrollLeft-a.wheelStartX,e=s.scrollTop-a.wheelStartY,n=e&&a.wheelDY&&e/a.wheelDY||t&&a.wheelDX&&t/a.wheelDX;a.wheelStartX=a.wheelStartY=null,n&&(yi=(yi*vi+n)/(vi+1),++vi)}}),200)):(a.wheelDX+=i,a.wheelDY+=o))}}a?yi=-.53:n?yi=15:u?yi=-.7:d&&(yi=-1/3);var Si=function(t,e){this.ranges=t,this.primIndex=e};Si.prototype.primary=function(){return this.ranges[this.primIndex]},Si.prototype.equals=function(t){if(t==this)return!0;if(t.primIndex!=this.primIndex||t.ranges.length!=this.ranges.length)return!1;for(var e=0;e<this.ranges.length;e++){var n=this.ranges[e],r=t.ranges[e];if(!ne(n.anchor,r.anchor)||!ne(n.head,r.head))return!1}return!0},Si.prototype.deepCopy=function(){for(var t=[],e=0;e<this.ranges.length;e++)t[e]=new Ei(re(this.ranges[e].anchor),re(this.ranges[e].head));return new Si(t,this.primIndex)},Si.prototype.somethingSelected=function(){for(var t=0;t<this.ranges.length;t++)if(!this.ranges[t].empty())return!0;return!1},Si.prototype.contains=function(t,e){e||(e=t);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(ee(e,r.from())>=0&&ee(t,r.to())<=0)return n}return-1};var Ei=function(t,e){this.anchor=t,this.head=e};function ki(t,e,n){var r=t&&t.options.selectionsMayTouch,i=e[n];e.sort((function(t,e){return ee(t.from(),e.from())})),n=U(e,i);for(var o=1;o<e.length;o++){var a=e[o],s=e[o-1],l=ee(s.to(),a.from());if(r&&!a.empty()?l>0:l>=0){var c=oe(s.from(),a.from()),u=ie(s.to(),a.to()),h=s.empty()?a.from()==a.head:s.from()==s.head;o<=n&&--n,e.splice(--o,2,new Ei(h?u:c,h?c:u))}}return new Si(e,n)}function wi(t,e){return new Si([new Ei(t,e||t)],0)}function Ti(t){return t.text?te(t.from.line+t.text.length-1,Y(t.text).length+(1==t.text.length?t.from.ch:0)):t.to}function Oi(t,e){if(ee(t,e.from)<0)return t;if(ee(t,e.to)<=0)return Ti(e);var n=t.line+e.text.length-(e.to.line-e.from.line)-1,r=t.ch;return t.line==e.to.line&&(r+=Ti(e).ch-e.to.ch),te(n,r)}function Li(t,e){for(var n=[],r=0;r<t.sel.ranges.length;r++){var i=t.sel.ranges[r];n.push(new Ei(Oi(i.anchor,e),Oi(i.head,e)))}return ki(t.cm,n,t.sel.primIndex)}function Ai(t,e,n){return t.line==e.line?te(n.line,t.ch-e.ch+n.ch):te(n.line+(t.line-e.line),t.ch)}function Di(t){t.doc.mode=Bt(t.options,t.doc.modeOption),Ri(t)}function Ri(t){t.doc.iter((function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)})),t.doc.modeFrontier=t.doc.highlightFrontier=t.doc.first,ri(t,100),t.state.modeGen++,t.curOp&&hr(t)}function Mi(t,e){return 0==e.from.ch&&0==e.to.ch&&""==Y(e.text)&&(!t.cm||t.cm.options.wholeLineUpdateBefore)}function Ii(t,e,n,r){function i(t){return n?n[t]:null}function o(t,n,i){!function(t,e,n,r){t.text=e,t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null),null!=t.order&&(t.order=null),Le(t),Ae(t,n);var i=r?r(t):1;i!=t.height&&Xt(t,i)}(t,n,i,r),ln(t,"change",t,e)}function a(t,e){for(var n=[],o=t;o<e;++o)n.push(new Ke(c[o],i(o),r));return n}var s=e.from,l=e.to,c=e.text,u=Kt(t,s.line),h=Kt(t,l.line),d=Y(c),f=i(c.length-1),p=l.line-s.line;if(e.full)t.insert(0,a(0,c.length)),t.remove(c.length,t.size-c.length);else if(Mi(t,e)){var g=a(0,c.length-1);o(h,h.text,f),p&&t.remove(s.line,p),g.length&&t.insert(s.line,g)}else if(u==h)if(1==c.length)o(u,u.text.slice(0,s.ch)+d+u.text.slice(l.ch),f);else{var m=a(1,c.length-1);m.push(new Ke(d+u.text.slice(l.ch),f,r)),o(u,u.text.slice(0,s.ch)+c[0],i(0)),t.insert(s.line+1,m)}else if(1==c.length)o(u,u.text.slice(0,s.ch)+c[0]+h.text.slice(l.ch),i(0)),t.remove(s.line+1,p);else{o(u,u.text.slice(0,s.ch)+c[0],i(0)),o(h,d+h.text.slice(l.ch),f);var v=a(1,c.length-1);p>1&&t.remove(s.line+1,p-1),t.insert(s.line+1,v)}ln(t,"change",t,e)}function _i(t,e,n){!function t(r,i,o){if(r.linked)for(var a=0;a<r.linked.length;++a){var s=r.linked[a];if(s.doc!=i){var l=o&&s.sharedHist;n&&!l||(e(s.doc,l),t(s.doc,r,l))}}}(t,null,!0)}function Pi(t,e){if(e.cm)throw new Error("This document is already in use.");t.doc=e,e.cm=t,lr(t),Di(t),Ni(t),t.options.lineWrapping||We(t),t.options.mode=e.modeOption,hr(t)}function Ni(t){("rtl"==t.doc.direction?I:T)(t.display.lineDiv,"CodeMirror-rtl")}function ji(t){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=t||1}function Fi(t,e){var n={from:re(e.from),to:Ti(e),text:qt(t,e.from,e.to)};return Gi(t,n,e.from.line,e.to.line+1),_i(t,(function(t){return Gi(t,n,e.from.line,e.to.line+1)}),!0),n}function Bi(t){for(;t.length&&Y(t).ranges;)t.pop()}function Ui(t,e,n,r){var i=t.history;i.undone.length=0;var o,a,s=+new Date;if((i.lastOp==r||i.lastOrigin==e.origin&&e.origin&&("+"==e.origin.charAt(0)&&i.lastModTime>s-(t.cm?t.cm.options.historyEventDelay:500)||"*"==e.origin.charAt(0)))&&(o=function(t,e){return e?(Bi(t.done),Y(t.done)):t.done.length&&!Y(t.done).ranges?Y(t.done):t.done.length>1&&!t.done[t.done.length-2].ranges?(t.done.pop(),Y(t.done)):void 0}(i,i.lastOp==r)))a=Y(o.changes),0==ee(e.from,e.to)&&0==ee(e.from,a.to)?a.to=Ti(e):o.changes.push(Fi(t,e));else{var l=Y(i.done);for(l&&l.ranges||zi(t.sel,i.done),o={changes:[Fi(t,e)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=s,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=e.origin,a||pt(t,"historyAdded")}function Hi(t,e,n,r){var i=t.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||function(t,e,n,r){var i=e.charAt(0);return"*"==i||"+"==i&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-t.history.lastSelTime<=(t.cm?t.cm.options.historyEventDelay:500)}(t,o,Y(i.done),e))?i.done[i.done.length-1]=e:zi(e,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&!1!==r.clearRedo&&Bi(i.undone)}function zi(t,e){var n=Y(e);n&&n.ranges&&n.equals(t)||e.push(t)}function Gi(t,e,n,r){var i=e["spans_"+t.id],o=0;t.iter(Math.max(t.first,n),Math.min(t.first+t.size,r),(function(n){n.markedSpans&&((i||(i=e["spans_"+t.id]={}))[o]=n.markedSpans),++o}))}function Vi(t){if(!t)return null;for(var e,n=0;n<t.length;++n)t[n].marker.explicitlyCleared?e||(e=t.slice(0,n)):e&&e.push(t[n]);return e?e.length?e:null:t}function Wi(t,e){var n=function(t,e){var n=e["spans_"+t.id];if(!n)return null;for(var r=[],i=0;i<e.text.length;++i)r.push(Vi(n[i]));return r}(t,e),r=Te(t,e);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var o=n[i],a=r[i];if(o&&a)t:for(var s=0;s<a.length;++s){for(var l=a[s],c=0;c<o.length;++c)if(o[c].marker==l.marker)continue t;o.push(l)}else a&&(n[i]=a)}return n}function Ki(t,e,n){for(var r=[],i=0;i<t.length;++i){var o=t[i];if(o.ranges)r.push(n?Si.prototype.deepCopy.call(o):o);else{var a=o.changes,s=[];r.push({changes:s});for(var l=0;l<a.length;++l){var c=a[l],u=void 0;if(s.push({from:c.from,to:c.to,text:c.text}),e)for(var h in c)(u=h.match(/^spans_(\d+)$/))&&U(e,Number(u[1]))>-1&&(Y(s)[h]=c[h],delete c[h])}}}return r}function qi(t,e,n,r){if(r){var i=t.anchor;if(n){var o=ee(e,i)<0;o!=ee(n,i)<0?(i=e,e=n):o!=ee(e,n)<0&&(e=n)}return new Ei(i,e)}return new Ei(n||e,e)}function Yi(t,e,n,r,i){null==i&&(i=t.cm&&(t.cm.display.shift||t.extend)),Qi(t,new Si([qi(t.sel.primary(),e,n,i)],0),r)}function Xi(t,e,n){for(var r=[],i=t.cm&&(t.cm.display.shift||t.extend),o=0;o<t.sel.ranges.length;o++)r[o]=qi(t.sel.ranges[o],e[o],null,i);Qi(t,ki(t.cm,r,t.sel.primIndex),n)}function $i(t,e,n,r){var i=t.sel.ranges.slice(0);i[e]=n,Qi(t,ki(t.cm,i,t.sel.primIndex),r)}function Zi(t,e,n,r){Qi(t,wi(e,n),r)}function Ji(t,e,n){var r=t.history.done,i=Y(r);i&&i.ranges?(r[r.length-1]=e,to(t,e,n)):Qi(t,e,n)}function Qi(t,e,n){to(t,e,n),Hi(t,t.sel,t.cm?t.cm.curOp.id:NaN,n)}function to(t,e,n){(vt(t,"beforeSelectionChange")||t.cm&&vt(t.cm,"beforeSelectionChange"))&&(e=function(t,e,n){var r={ranges:e.ranges,update:function(e){this.ranges=[];for(var n=0;n<e.length;n++)this.ranges[n]=new Ei(se(t,e[n].anchor),se(t,e[n].head))},origin:n&&n.origin};return pt(t,"beforeSelectionChange",t,r),t.cm&&pt(t.cm,"beforeSelectionChange",t.cm,r),r.ranges!=e.ranges?ki(t.cm,r.ranges,r.ranges.length-1):e}(t,e,n));var r=n&&n.bias||(ee(e.primary().head,t.sel.primary().head)<0?-1:1);eo(t,ro(t,e,r,!0)),n&&!1===n.scroll||!t.cm||Rr(t.cm)}function eo(t,e){e.equals(t.sel)||(t.sel=e,t.cm&&(t.cm.curOp.updateInput=1,t.cm.curOp.selectionChanged=!0,mt(t.cm)),ln(t,"cursorActivity",t))}function no(t){eo(t,ro(t,t.sel,null,!1))}function ro(t,e,n,r){for(var i,o=0;o<e.ranges.length;o++){var a=e.ranges[o],s=e.ranges.length==t.sel.ranges.length&&t.sel.ranges[o],l=oo(t,a.anchor,s&&s.anchor,n,r),c=oo(t,a.head,s&&s.head,n,r);(i||l!=a.anchor||c!=a.head)&&(i||(i=e.ranges.slice(0,o)),i[o]=new Ei(l,c))}return i?ki(t.cm,i,e.primIndex):e}function io(t,e,n,r,i){var o=Kt(t,e.line);if(o.markedSpans)for(var a=0;a<o.markedSpans.length;++a){var s=o.markedSpans[a],l=s.marker,c="selectLeft"in l?!l.selectLeft:l.inclusiveLeft,u="selectRight"in l?!l.selectRight:l.inclusiveRight;if((null==s.from||(c?s.from<=e.ch:s.from<e.ch))&&(null==s.to||(u?s.to>=e.ch:s.to>e.ch))){if(i&&(pt(l,"beforeCursorEnter"),l.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!l.atomic)continue;if(n){var h=l.find(r<0?1:-1),d=void 0;if((r<0?u:c)&&(h=ao(t,h,-r,h&&h.line==e.line?o:null)),h&&h.line==e.line&&(d=ee(h,n))&&(r<0?d<0:d>0))return io(t,h,e,r,i)}var f=l.find(r<0?-1:1);return(r<0?c:u)&&(f=ao(t,f,r,f.line==e.line?o:null)),f?io(t,f,e,r,i):null}}return e}function oo(t,e,n,r,i){var o=r||1,a=io(t,e,n,o,i)||!i&&io(t,e,n,o,!0)||io(t,e,n,-o,i)||!i&&io(t,e,n,-o,!0);return a||(t.cantEdit=!0,te(t.first,0))}function ao(t,e,n,r){return n<0&&0==e.ch?e.line>t.first?se(t,te(e.line-1)):null:n>0&&e.ch==(r||Kt(t,e.line)).text.length?e.line<t.first+t.size-1?te(e.line+1,0):null:new te(e.line,e.ch+n)}function so(t){t.setSelection(te(t.firstLine(),0),te(t.lastLine()),z)}function lo(t,e,n){var r={canceled:!1,from:e.from,to:e.to,text:e.text,origin:e.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(e,n,i,o){e&&(r.from=se(t,e)),n&&(r.to=se(t,n)),i&&(r.text=i),void 0!==o&&(r.origin=o)}),pt(t,"beforeChange",t,r),t.cm&&pt(t.cm,"beforeChange",t.cm,r),r.canceled?(t.cm&&(t.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function co(t,e,n){if(t.cm){if(!t.cm.curOp)return ti(t.cm,co)(t,e,n);if(t.cm.state.suppressEdits)return}if(!(vt(t,"beforeChange")||t.cm&&vt(t.cm,"beforeChange"))||(e=lo(t,e,!0))){var r=Ce&&!n&&function(t,e,n){var r=null;if(t.iter(e.line,n.line+1,(function(t){if(t.markedSpans)for(var e=0;e<t.markedSpans.length;++e){var n=t.markedSpans[e].marker;!n.readOnly||r&&-1!=U(r,n)||(r||(r=[])).push(n)}})),!r)return null;for(var i=[{from:e,to:n}],o=0;o<r.length;++o)for(var a=r[o],s=a.find(0),l=0;l<i.length;++l){var c=i[l];if(!(ee(c.to,s.from)<0||ee(c.from,s.to)>0)){var u=[l,1],h=ee(c.from,s.from),d=ee(c.to,s.to);(h<0||!a.inclusiveLeft&&!h)&&u.push({from:c.from,to:s.from}),(d>0||!a.inclusiveRight&&!d)&&u.push({from:s.to,to:c.to}),i.splice.apply(i,u),l+=u.length-3}}return i}(t,e.from,e.to);if(r)for(var i=r.length-1;i>=0;--i)uo(t,{from:r[i].from,to:r[i].to,text:i?[""]:e.text,origin:e.origin});else uo(t,e)}}function uo(t,e){if(1!=e.text.length||""!=e.text[0]||0!=ee(e.from,e.to)){var n=Li(t,e);Ui(t,e,n,t.cm?t.cm.curOp.id:NaN),po(t,e,n,Te(t,e));var r=[];_i(t,(function(t,n){n||-1!=U(r,t.history)||(yo(t.history,e),r.push(t.history)),po(t,e,null,Te(t,e))}))}}function ho(t,e,n){var r=t.cm&&t.cm.state.suppressEdits;if(!r||n){for(var i,o=t.history,a=t.sel,s="undo"==e?o.done:o.undone,l="undo"==e?o.undone:o.done,c=0;c<s.length&&(i=s[c],n?!i.ranges||i.equals(t.sel):i.ranges);c++);if(c!=s.length){for(o.lastOrigin=o.lastSelOrigin=null;;){if(!(i=s.pop()).ranges){if(r)return void s.push(i);break}if(zi(i,l),n&&!i.equals(t.sel))return void Qi(t,i,{clearRedo:!1});a=i}var u=[];zi(a,l),l.push({changes:u,generation:o.generation}),o.generation=i.generation||++o.maxGeneration;for(var h=vt(t,"beforeChange")||t.cm&&vt(t.cm,"beforeChange"),d=function(n){var r=i.changes[n];if(r.origin=e,h&&!lo(t,r,!1))return s.length=0,{};u.push(Fi(t,r));var o=n?Li(t,r):Y(s);po(t,r,o,Wi(t,r)),!n&&t.cm&&t.cm.scrollIntoView({from:r.from,to:Ti(r)});var a=[];_i(t,(function(t,e){e||-1!=U(a,t.history)||(yo(t.history,r),a.push(t.history)),po(t,r,null,Wi(t,r))}))},f=i.changes.length-1;f>=0;--f){var p=d(f);if(p)return p.v}}}}function fo(t,e){if(0!=e&&(t.first+=e,t.sel=new Si(X(t.sel.ranges,(function(t){return new Ei(te(t.anchor.line+e,t.anchor.ch),te(t.head.line+e,t.head.ch))})),t.sel.primIndex),t.cm)){hr(t.cm,t.first,t.first-e,e);for(var n=t.cm.display,r=n.viewFrom;r<n.viewTo;r++)dr(t.cm,r,"gutter")}}function po(t,e,n,r){if(t.cm&&!t.cm.curOp)return ti(t.cm,po)(t,e,n,r);if(e.to.line<t.first)fo(t,e.text.length-1-(e.to.line-e.from.line));else if(!(e.from.line>t.lastLine())){if(e.from.line<t.first){var i=e.text.length-1-(t.first-e.from.line);fo(t,i),e={from:te(t.first,0),to:te(e.to.line+i,e.to.ch),text:[Y(e.text)],origin:e.origin}}var o=t.lastLine();e.to.line>o&&(e={from:e.from,to:te(o,Kt(t,o).text.length),text:[e.text[0]],origin:e.origin}),e.removed=qt(t,e.from,e.to),n||(n=Li(t,e)),t.cm?function(t,e,n){var r=t.doc,i=t.display,o=e.from,a=e.to,s=!1,l=o.line;t.options.lineWrapping||(l=$t(Fe(Kt(r,o.line))),r.iter(l,a.line+1,(function(t){if(t==i.maxLine)return s=!0,!0}))),r.sel.contains(e.from,e.to)>-1&&mt(t),Ii(r,e,n,sr(t)),t.options.lineWrapping||(r.iter(l,o.line+e.text.length,(function(t){var e=Ve(t);e>i.maxLineLength&&(i.maxLine=t,i.maxLineLength=e,i.maxLineChanged=!0,s=!1)})),s&&(t.curOp.updateMaxLine=!0)),function(t,e){if(t.modeFrontier=Math.min(t.modeFrontier,e),!(t.highlightFrontier<e-10)){for(var n=t.first,r=e-1;r>n;r--){var i=Kt(t,r).stateAfter;if(i&&(!(i instanceof ce)||r+i.lookAhead<e)){n=r+1;break}}t.highlightFrontier=Math.min(t.highlightFrontier,n)}}(r,o.line),ri(t,400);var c=e.text.length-(a.line-o.line)-1;e.full?hr(t):o.line!=a.line||1!=e.text.length||Mi(t.doc,e)?hr(t,o.line,a.line+1,c):dr(t,o.line,"text");var u=vt(t,"changes"),h=vt(t,"change");if(h||u){var d={from:o,to:a,text:e.text,removed:e.removed,origin:e.origin};h&&ln(t,"change",t,d),u&&(t.curOp.changeObjs||(t.curOp.changeObjs=[])).push(d)}t.display.selForContextMenu=null}(t.cm,e,r):Ii(t,e,r),to(t,n,z),t.cantEdit&&oo(t,te(t.firstLine(),0))&&(t.cantEdit=!1)}}function go(t,e,n,r,i){var o;r||(r=n),ee(r,n)<0&&(n=(o=[r,n])[0],r=o[1]),"string"==typeof e&&(e=t.splitLines(e)),co(t,{from:n,to:r,text:e,origin:i})}function mo(t,e,n,r){n<t.line?t.line+=r:e<t.line&&(t.line=e,t.ch=0)}function vo(t,e,n,r){for(var i=0;i<t.length;++i){var o=t[i],a=!0;if(o.ranges){o.copied||((o=t[i]=o.deepCopy()).copied=!0);for(var s=0;s<o.ranges.length;s++)mo(o.ranges[s].anchor,e,n,r),mo(o.ranges[s].head,e,n,r)}else{for(var l=0;l<o.changes.length;++l){var c=o.changes[l];if(n<c.from.line)c.from=te(c.from.line+r,c.from.ch),c.to=te(c.to.line+r,c.to.ch);else if(e<=c.to.line){a=!1;break}}a||(t.splice(0,i+1),i=0)}}}function yo(t,e){var n=e.from.line,r=e.to.line,i=e.text.length-(r-n)-1;vo(t.done,n,r,i),vo(t.undone,n,r,i)}function bo(t,e,n,r){var i=e,o=e;return"number"==typeof e?o=Kt(t,ae(t,e)):i=$t(e),null==i?null:(r(o,i)&&t.cm&&dr(t.cm,i,n),o)}function xo(t){this.lines=t,this.parent=null;for(var e=0,n=0;n<t.length;++n)t[n].parent=this,e+=t[n].height;this.height=e}function Co(t){this.children=t;for(var e=0,n=0,r=0;r<t.length;++r){var i=t[r];e+=i.chunkSize(),n+=i.height,i.parent=this}this.size=e,this.height=n,this.parent=null}Ei.prototype.from=function(){return oe(this.anchor,this.head)},Ei.prototype.to=function(){return ie(this.anchor,this.head)},Ei.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},xo.prototype={chunkSize:function(){return this.lines.length},removeInner:function(t,e){for(var n=t,r=t+e;n<r;++n){var i=this.lines[n];this.height-=i.height,qe(i),ln(i,"delete")}this.lines.splice(t,e)},collapse:function(t){t.push.apply(t,this.lines)},insertInner:function(t,e,n){this.height+=n,this.lines=this.lines.slice(0,t).concat(e).concat(this.lines.slice(t));for(var r=0;r<e.length;++r)e[r].parent=this},iterN:function(t,e,n){for(var r=t+e;t<r;++t)if(n(this.lines[t]))return!0}},Co.prototype={chunkSize:function(){return this.size},removeInner:function(t,e){this.size-=e;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(t<i){var o=Math.min(e,i-t),a=r.height;if(r.removeInner(t,o),this.height-=a-r.height,i==o&&(this.children.splice(n--,1),r.parent=null),0==(e-=o))break;t=0}else t-=i}if(this.size-e<25&&(this.children.length>1||!(this.children[0]instanceof xo))){var s=[];this.collapse(s),this.children=[new xo(s)],this.children[0].parent=this}},collapse:function(t){for(var e=0;e<this.children.length;++e)this.children[e].collapse(t)},insertInner:function(t,e,n){this.size+=e.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(t<=o){if(i.insertInner(t,e,n),i.lines&&i.lines.length>50){for(var a=i.lines.length%25+25,s=a;s<i.lines.length;){var l=new xo(i.lines.slice(s,s+=25));i.height-=l.height,this.children.splice(++r,0,l),l.parent=this}i.lines=i.lines.slice(0,a),this.maybeSpill()}break}t-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var t=this;do{var e=new Co(t.children.splice(t.children.length-5,5));if(t.parent){t.size-=e.size,t.height-=e.height;var n=U(t.parent.children,t);t.parent.children.splice(n+1,0,e)}else{var r=new Co(t.children);r.parent=t,t.children=[r,e],t=r}e.parent=t.parent}while(t.children.length>10);t.parent.maybeSpill()}},iterN:function(t,e,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(t<o){var a=Math.min(e,o-t);if(i.iterN(t,a,n))return!0;if(0==(e-=a))break;t=0}else t-=o}}};var So=function(t,e,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=t,this.node=e};function Eo(t,e,n){Ge(e)<(t.curOp&&t.curOp.scrollTop||t.doc.scrollTop)&&Dr(t,n)}So.prototype.clear=function(){var t=this.doc.cm,e=this.line.widgets,n=this.line,r=$t(n);if(null!=r&&e){for(var i=0;i<e.length;++i)e[i]==this&&e.splice(i--,1);e.length||(n.widgets=null);var o=Cn(this);Xt(n,Math.max(0,n.height-o)),t&&(Qr(t,(function(){Eo(t,n,-o),dr(t,r,"widget")})),ln(t,"lineWidgetCleared",t,this,r))}},So.prototype.changed=function(){var t=this,e=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=Cn(this)-e;i&&(He(this.doc,r)||Xt(r,r.height+i),n&&Qr(n,(function(){n.curOp.forceUpdate=!0,Eo(n,r,i),ln(n,"lineWidgetChanged",n,t,$t(r))})))},yt(So);var ko=0,wo=function(t,e){this.lines=[],this.type=e,this.doc=t,this.id=++ko};function To(t,e,n,r,i){if(r&&r.shared)return function(t,e,n,r,i){(r=j(r)).shared=!1;var o=[To(t,e,n,r,i)],a=o[0],s=r.widgetNode;return _i(t,(function(t){s&&(r.widgetNode=s.cloneNode(!0)),o.push(To(t,se(t,e),se(t,n),r,i));for(var l=0;l<t.linked.length;++l)if(t.linked[l].isParent)return;a=Y(o)})),new Oo(o,a)}(t,e,n,r,i);if(t.cm&&!t.cm.curOp)return ti(t.cm,To)(t,e,n,r,i);var o=new wo(t,i),a=ee(e,n);if(r&&j(r,o,!1),a>0||0==a&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=D("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(je(t,e.line,e,n,o)||e.line!=n.line&&je(t,n.line,e,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Se=!0}o.addToHistory&&Ui(t,{from:e,to:n,origin:"markText"},t.sel,NaN);var s,l=e.line,c=t.cm;if(t.iter(l,n.line+1,(function(t){c&&o.collapsed&&!c.options.lineWrapping&&Fe(t)==c.display.maxLine&&(s=!0),o.collapsed&&l!=e.line&&Xt(t,0),function(t,e){t.markedSpans=t.markedSpans?t.markedSpans.concat([e]):[e],e.marker.attachLine(t)}(t,new Ee(o,l==e.line?e.ch:null,l==n.line?n.ch:null)),++l})),o.collapsed&&t.iter(e.line,n.line+1,(function(e){He(t,e)&&Xt(e,0)})),o.clearOnEnter&&ht(o,"beforeCursorEnter",(function(){return o.clear()})),o.readOnly&&(Ce=!0,(t.history.done.length||t.history.undone.length)&&t.clearHistory()),o.collapsed&&(o.id=++ko,o.atomic=!0),c){if(s&&(c.curOp.updateMaxLine=!0),o.collapsed)hr(c,e.line,n.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var u=e.line;u<=n.line;u++)dr(c,u,"text");o.atomic&&no(c.doc),ln(c,"markerAdded",c,o)}return o}wo.prototype.clear=function(){if(!this.explicitlyCleared){var t=this.doc.cm,e=t&&!t.curOp;if(e&&Kr(t),vt(this,"clear")){var n=this.find();n&&ln(this,"clear",n.from,n.to)}for(var r=null,i=null,o=0;o<this.lines.length;++o){var a=this.lines[o],s=ke(a.markedSpans,this);t&&!this.collapsed?dr(t,$t(a),"text"):t&&(null!=s.to&&(i=$t(a)),null!=s.from&&(r=$t(a))),a.markedSpans=we(a.markedSpans,s),null==s.from&&this.collapsed&&!He(this.doc,a)&&t&&Xt(a,rr(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var l=0;l<this.lines.length;++l){var c=Fe(this.lines[l]),u=Ve(c);u>t.display.maxLineLength&&(t.display.maxLine=c,t.display.maxLineLength=u,t.display.maxLineChanged=!0)}null!=r&&t&&this.collapsed&&hr(t,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&no(t.doc)),t&&ln(t,"markerCleared",t,this,r,i),e&&qr(t),this.parent&&this.parent.clear()}},wo.prototype.find=function(t,e){var n,r;null==t&&"bookmark"==this.type&&(t=1);for(var i=0;i<this.lines.length;++i){var o=this.lines[i],a=ke(o.markedSpans,this);if(null!=a.from&&(n=te(e?o:$t(o),a.from),-1==t))return n;if(null!=a.to&&(r=te(e?o:$t(o),a.to),1==t))return r}return n&&{from:n,to:r}},wo.prototype.changed=function(){var t=this,e=this.find(-1,!0),n=this,r=this.doc.cm;e&&r&&Qr(r,(function(){var i=e.line,o=$t(e.line),a=Rn(r,o);if(a&&(Fn(a),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!He(n.doc,i)&&null!=n.height){var s=n.height;n.height=null;var l=Cn(n)-s;l&&Xt(i,i.height+l)}ln(r,"markerChanged",r,t)}))},wo.prototype.attachLine=function(t){if(!this.lines.length&&this.doc.cm){var e=this.doc.cm.curOp;e.maybeHiddenMarkers&&-1!=U(e.maybeHiddenMarkers,this)||(e.maybeUnhiddenMarkers||(e.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(t)},wo.prototype.detachLine=function(t){if(this.lines.splice(U(this.lines,t),1),!this.lines.length&&this.doc.cm){var e=this.doc.cm.curOp;(e.maybeHiddenMarkers||(e.maybeHiddenMarkers=[])).push(this)}},yt(wo);var Oo=function(t,e){this.markers=t,this.primary=e;for(var n=0;n<t.length;++n)t[n].parent=this};function Lo(t){return t.findMarks(te(t.first,0),t.clipPos(te(t.lastLine())),(function(t){return t.parent}))}function Ao(t){for(var e=function(e){var n=t[e],r=[n.primary.doc];_i(n.primary.doc,(function(t){return r.push(t)}));for(var i=0;i<n.markers.length;i++){var o=n.markers[i];-1==U(r,o.doc)&&(o.parent=null,n.markers.splice(i--,1))}},n=0;n<t.length;n++)e(n)}Oo.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var t=0;t<this.markers.length;++t)this.markers[t].clear();ln(this,"clear")}},Oo.prototype.find=function(t,e){return this.primary.find(t,e)},yt(Oo);var Do=0,Ro=function(t,e,n,r,i){if(!(this instanceof Ro))return new Ro(t,e,n,r,i);null==n&&(n=0),Co.call(this,[new xo([new Ke("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var o=te(n,0);this.sel=wi(o),this.history=new ji(null),this.id=++Do,this.modeOption=e,this.lineSep=r,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof t&&(t=this.splitLines(t)),Ii(this,{from:o,to:o,text:t}),Qi(this,wi(o),z)};Ro.prototype=Z(Co.prototype,{constructor:Ro,iter:function(t,e,n){n?this.iterN(t-this.first,e-t,n):this.iterN(this.first,this.first+this.size,t)},insert:function(t,e){for(var n=0,r=0;r<e.length;++r)n+=e[r].height;this.insertInner(t-this.first,e,n)},remove:function(t,e){this.removeInner(t-this.first,e)},getValue:function(t){var e=Yt(this,this.first,this.first+this.size);return!1===t?e:e.join(t||this.lineSeparator())},setValue:ni((function(t){var e=te(this.first,0),n=this.first+this.size-1;co(this,{from:e,to:te(n,Kt(this,n).text.length),text:this.splitLines(t),origin:"setValue",full:!0},!0),this.cm&&Mr(this.cm,0,0),Qi(this,wi(e),z)})),replaceRange:function(t,e,n,r){go(this,t,e=se(this,e),n=n?se(this,n):e,r)},getRange:function(t,e,n){var r=qt(this,se(this,t),se(this,e));return!1===n?r:r.join(n||this.lineSeparator())},getLine:function(t){var e=this.getLineHandle(t);return e&&e.text},getLineHandle:function(t){if(Jt(this,t))return Kt(this,t)},getLineNumber:function(t){return $t(t)},getLineHandleVisualStart:function(t){return"number"==typeof t&&(t=Kt(this,t)),Fe(t)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(t){return se(this,t)},getCursor:function(t){var e=this.sel.primary();return null==t||"head"==t?e.head:"anchor"==t?e.anchor:"end"==t||"to"==t||!1===t?e.to():e.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:ni((function(t,e,n){Zi(this,se(this,"number"==typeof t?te(t,e||0):t),null,n)})),setSelection:ni((function(t,e,n){Zi(this,se(this,t),se(this,e||t),n)})),extendSelection:ni((function(t,e,n){Yi(this,se(this,t),e&&se(this,e),n)})),extendSelections:ni((function(t,e){Xi(this,le(this,t),e)})),extendSelectionsBy:ni((function(t,e){Xi(this,le(this,X(this.sel.ranges,t)),e)})),setSelections:ni((function(t,e,n){if(t.length){for(var r=[],i=0;i<t.length;i++)r[i]=new Ei(se(this,t[i].anchor),se(this,t[i].head));null==e&&(e=Math.min(t.length-1,this.sel.primIndex)),Qi(this,ki(this.cm,r,e),n)}})),addSelection:ni((function(t,e,n){var r=this.sel.ranges.slice(0);r.push(new Ei(se(this,t),se(this,e||t))),Qi(this,ki(this.cm,r,r.length-1),n)})),getSelection:function(t){for(var e,n=this.sel.ranges,r=0;r<n.length;r++){var i=qt(this,n[r].from(),n[r].to());e=e?e.concat(i):i}return!1===t?e:e.join(t||this.lineSeparator())},getSelections:function(t){for(var e=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=qt(this,n[r].from(),n[r].to());!1!==t&&(i=i.join(t||this.lineSeparator())),e[r]=i}return e},replaceSelection:function(t,e,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=t;this.replaceSelections(r,e,n||"+input")},replaceSelections:ni((function(t,e,n){for(var r=[],i=this.sel,o=0;o<i.ranges.length;o++){var a=i.ranges[o];r[o]={from:a.from(),to:a.to(),text:this.splitLines(t[o]),origin:n}}for(var s=e&&"end"!=e&&function(t,e,n){for(var r=[],i=te(t.first,0),o=i,a=0;a<e.length;a++){var s=e[a],l=Ai(s.from,i,o),c=Ai(Ti(s),i,o);if(i=s.to,o=c,"around"==n){var u=t.sel.ranges[a],h=ee(u.head,u.anchor)<0;r[a]=new Ei(h?c:l,h?l:c)}else r[a]=new Ei(l,l)}return new Si(r,t.sel.primIndex)}(this,r,e),l=r.length-1;l>=0;l--)co(this,r[l]);s?Ji(this,s):this.cm&&Rr(this.cm)})),undo:ni((function(){ho(this,"undo")})),redo:ni((function(){ho(this,"redo")})),undoSelection:ni((function(){ho(this,"undo",!0)})),redoSelection:ni((function(){ho(this,"redo",!0)})),setExtending:function(t){this.extend=t},getExtending:function(){return this.extend},historySize:function(){for(var t=this.history,e=0,n=0,r=0;r<t.done.length;r++)t.done[r].ranges||++e;for(var i=0;i<t.undone.length;i++)t.undone[i].ranges||++n;return{undo:e,redo:n}},clearHistory:function(){var t=this;this.history=new ji(this.history.maxGeneration),_i(this,(function(e){return e.history=t.history}),!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(t){return t&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(t){return this.history.generation==(t||this.cleanGeneration)},getHistory:function(){return{done:Ki(this.history.done),undone:Ki(this.history.undone)}},setHistory:function(t){var e=this.history=new ji(this.history.maxGeneration);e.done=Ki(t.done.slice(0),null,!0),e.undone=Ki(t.undone.slice(0),null,!0)},setGutterMarker:ni((function(t,e,n){return bo(this,t,"gutter",(function(t){var r=t.gutterMarkers||(t.gutterMarkers={});return r[e]=n,!n&&et(r)&&(t.gutterMarkers=null),!0}))})),clearGutter:ni((function(t){var e=this;this.iter((function(n){n.gutterMarkers&&n.gutterMarkers[t]&&bo(e,n,"gutter",(function(){return n.gutterMarkers[t]=null,et(n.gutterMarkers)&&(n.gutterMarkers=null),!0}))}))})),lineInfo:function(t){var e;if("number"==typeof t){if(!Jt(this,t))return null;if(e=t,!(t=Kt(this,t)))return null}else if(null==(e=$t(t)))return null;return{line:e,handle:t,text:t.text,gutterMarkers:t.gutterMarkers,textClass:t.textClass,bgClass:t.bgClass,wrapClass:t.wrapClass,widgets:t.widgets}},addLineClass:ni((function(t,e,n){return bo(this,t,"gutter"==e?"gutter":"class",(function(t){var r="text"==e?"textClass":"background"==e?"bgClass":"gutter"==e?"gutterClass":"wrapClass";if(t[r]){if(k(n).test(t[r]))return!1;t[r]+=" "+n}else t[r]=n;return!0}))})),removeLineClass:ni((function(t,e,n){return bo(this,t,"gutter"==e?"gutter":"class",(function(t){var r="text"==e?"textClass":"background"==e?"bgClass":"gutter"==e?"gutterClass":"wrapClass",i=t[r];if(!i)return!1;if(null==n)t[r]=null;else{var o=i.match(k(n));if(!o)return!1;var a=o.index+o[0].length;t[r]=i.slice(0,o.index)+(o.index&&a!=i.length?" ":"")+i.slice(a)||null}return!0}))})),addLineWidget:ni((function(t,e,n){return function(t,e,n,r){var i=new So(t,n,r),o=t.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),bo(t,e,"widget",(function(e){var n=e.widgets||(e.widgets=[]);if(null==i.insertAt?n.push(i):n.splice(Math.min(n.length-1,Math.max(0,i.insertAt)),0,i),i.line=e,o&&!He(t,e)){var r=Ge(e)<t.scrollTop;Xt(e,e.height+Cn(i)),r&&Dr(o,i.height),o.curOp.forceUpdate=!0}return!0})),o&&ln(o,"lineWidgetAdded",o,i,"number"==typeof e?e:$t(e)),i}(this,t,e,n)})),removeLineWidget:function(t){t.clear()},markText:function(t,e,n){return To(this,se(this,t),se(this,e),n,n&&n.type||"range")},setBookmark:function(t,e){var n={replacedWith:e&&(null==e.nodeType?e.widget:e),insertLeft:e&&e.insertLeft,clearWhenEmpty:!1,shared:e&&e.shared,handleMouseEvents:e&&e.handleMouseEvents};return To(this,t=se(this,t),t,n,"bookmark")},findMarksAt:function(t){var e=[],n=Kt(this,(t=se(this,t)).line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(null==i.from||i.from<=t.ch)&&(null==i.to||i.to>=t.ch)&&e.push(i.marker.parent||i.marker)}return e},findMarks:function(t,e,n){t=se(this,t),e=se(this,e);var r=[],i=t.line;return this.iter(t.line,e.line+1,(function(o){var a=o.markedSpans;if(a)for(var s=0;s<a.length;s++){var l=a[s];null!=l.to&&i==t.line&&t.ch>=l.to||null==l.from&&i!=t.line||null!=l.from&&i==e.line&&l.from>=e.ch||n&&!n(l.marker)||r.push(l.marker.parent||l.marker)}++i})),r},getAllMarks:function(){var t=[];return this.iter((function(e){var n=e.markedSpans;if(n)for(var r=0;r<n.length;++r)null!=n[r].from&&t.push(n[r].marker)})),t},posFromIndex:function(t){var e,n=this.first,r=this.lineSeparator().length;return this.iter((function(i){var o=i.text.length+r;if(o>t)return e=t,!0;t-=o,++n})),se(this,te(n,e))},indexFromPos:function(t){var e=(t=se(this,t)).ch;if(t.line<this.first||t.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,t.line,(function(t){e+=t.text.length+n})),e},copy:function(t){var e=new Ro(Yt(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return e.scrollTop=this.scrollTop,e.scrollLeft=this.scrollLeft,e.sel=this.sel,e.extend=!1,t&&(e.history.undoDepth=this.history.undoDepth,e.setHistory(this.getHistory())),e},linkedDoc:function(t){t||(t={});var e=this.first,n=this.first+this.size;null!=t.from&&t.from>e&&(e=t.from),null!=t.to&&t.to<n&&(n=t.to);var r=new Ro(Yt(this,e,n),t.mode||this.modeOption,e,this.lineSep,this.direction);return t.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:t.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:t.sharedHist}],function(t,e){for(var n=0;n<e.length;n++){var r=e[n],i=r.find(),o=t.clipPos(i.from),a=t.clipPos(i.to);if(ee(o,a)){var s=To(t,o,a,r.primary,r.primary.type);r.markers.push(s),s.parent=r}}}(r,Lo(this)),r},unlinkDoc:function(t){if(t instanceof Oa&&(t=t.doc),this.linked)for(var e=0;e<this.linked.length;++e)if(this.linked[e].doc==t){this.linked.splice(e,1),t.unlinkDoc(this),Ao(Lo(this));break}if(t.history==this.history){var n=[t.id];_i(t,(function(t){return n.push(t.id)}),!0),t.history=new ji(null),t.history.done=Ki(this.history.done,n),t.history.undone=Ki(this.history.undone,n)}},iterLinkedDocs:function(t){_i(this,t)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(t){return this.lineSep?t.split(this.lineSep):Rt(t)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:ni((function(t){var e;"rtl"!=t&&(t="ltr"),t!=this.direction&&(this.direction=t,this.iter((function(t){return t.order=null})),this.cm&&Qr(e=this.cm,(function(){Ni(e),hr(e)})))}))}),Ro.prototype.eachLine=Ro.prototype.iter;var Mo=0;function Io(t){var e=this;if(_o(e),!gt(e,t)&&!Sn(e.display,t)){bt(t),a&&(Mo=+new Date);var n=cr(e,t,!0),r=t.dataTransfer.files;if(n&&!e.isReadOnly())if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,o=Array(i),s=0,l=function(){++s==i&&ti(e,(function(){var t={from:n=se(e.doc,n),to:n,text:e.doc.splitLines(o.filter((function(t){return null!=t})).join(e.doc.lineSeparator())),origin:"paste"};co(e.doc,t),Ji(e.doc,wi(se(e.doc,n),se(e.doc,Ti(t))))}))()},c=function(t,n){if(e.options.allowDropFileTypes&&-1==U(e.options.allowDropFileTypes,t.type))l();else{var r=new FileReader;r.onerror=function(){return l()},r.onload=function(){var t=r.result;/[\x00-\x08\x0e-\x1f]{2}/.test(t)||(o[n]=t),l()},r.readAsText(t)}},u=0;u<r.length;u++)c(r[u],u);else{if(e.state.draggingText&&e.doc.sel.contains(n)>-1)return e.state.draggingText(t),void setTimeout((function(){return e.display.input.focus()}),20);try{var h=t.dataTransfer.getData("Text");if(h){var d;if(e.state.draggingText&&!e.state.draggingText.copy&&(d=e.listSelections()),to(e.doc,wi(n,n)),d)for(var f=0;f<d.length;++f)go(e.doc,"",d[f].anchor,d[f].head,"drag");e.replaceSelection(h,"around","paste"),e.display.input.focus()}}catch(t){}}}}function _o(t){t.display.dragCursor&&(t.display.lineSpace.removeChild(t.display.dragCursor),t.display.dragCursor=null)}function Po(t){if(document.getElementsByClassName){for(var e=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<e.length;r++){var i=e[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation((function(){for(var e=0;e<n.length;e++)t(n[e])}))}}var No=!1;function jo(){var t;No||(ht(window,"resize",(function(){null==t&&(t=setTimeout((function(){t=null,Po(Fo)}),100))})),ht(window,"blur",(function(){return Po(wr)})),No=!0)}function Fo(t){var e=t.display;e.cachedCharWidth=e.cachedTextHeight=e.cachedPaddingH=null,e.scrollbarsClipped=!1,t.setSize()}for(var Bo={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"},Uo=0;Uo<10;Uo++)Bo[Uo+48]=Bo[Uo+96]=String(Uo);for(var Ho=65;Ho<=90;Ho++)Bo[Ho]=String.fromCharCode(Ho);for(var zo=1;zo<=12;zo++)Bo[zo+111]=Bo[zo+63235]="F"+zo;var Go={};function Vo(t){var e,n,r,i,o=t.split(/-(?!$)/);t=o[o.length-1];for(var a=0;a<o.length-1;a++){var s=o[a];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))e=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else{if(!/^s(hift)?$/i.test(s))throw new Error("Unrecognized modifier name: "+s);r=!0}}return e&&(t="Alt-"+t),n&&(t="Ctrl-"+t),i&&(t="Cmd-"+t),r&&(t="Shift-"+t),t}function Wo(t){var e={};for(var n in t)if(t.hasOwnProperty(n)){var r=t[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if("..."==r){delete t[n];continue}for(var i=X(n.split(" "),Vo),o=0;o<i.length;o++){var a=void 0,s=void 0;o==i.length-1?(s=i.join(" "),a=r):(s=i.slice(0,o+1).join(" "),a="...");var l=e[s];if(l){if(l!=a)throw new Error("Inconsistent bindings for "+s)}else e[s]=a}delete t[n]}for(var c in e)t[c]=e[c];return t}function Ko(t,e,n,r){var i=(e=$o(e)).call?e.call(t,r):e[t];if(!1===i)return"nothing";if("..."===i)return"multi";if(null!=i&&n(i))return"handled";if(e.fallthrough){if("[object Array]"!=Object.prototype.toString.call(e.fallthrough))return Ko(t,e.fallthrough,n,r);for(var o=0;o<e.fallthrough.length;o++){var a=Ko(t,e.fallthrough[o],n,r);if(a)return a}}}function qo(t){var e="string"==typeof t?t:Bo[t.keyCode];return"Ctrl"==e||"Alt"==e||"Shift"==e||"Mod"==e}function Yo(t,e,n){var r=t;return e.altKey&&"Alt"!=r&&(t="Alt-"+t),(S?e.metaKey:e.ctrlKey)&&"Ctrl"!=r&&(t="Ctrl-"+t),(S?e.ctrlKey:e.metaKey)&&"Mod"!=r&&(t="Cmd-"+t),!n&&e.shiftKey&&"Shift"!=r&&(t="Shift-"+t),t}function Xo(t,e){if(h&&34==t.keyCode&&t.char)return!1;var n=Bo[t.keyCode];return null!=n&&!t.altGraphKey&&(3==t.keyCode&&t.code&&(n=t.code),Yo(n,t,e))}function $o(t){return"string"==typeof t?Go[t]:t}function Zo(t,e){for(var n=t.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var o=e(n[i]);r.length&&ee(o.from,Y(r).to)<=0;){var a=r.pop();if(ee(a.from,o.from)<0){o.from=a.from;break}}r.push(o)}Qr(t,(function(){for(var e=r.length-1;e>=0;e--)go(t.doc,"",r[e].from,r[e].to,"+delete");Rr(t)}))}function Jo(t,e,n){var r=it(t.text,e+n,n);return r<0||r>t.text.length?null:r}function Qo(t,e,n){var r=Jo(t,e.ch,n);return null==r?null:new te(e.line,r,n<0?"after":"before")}function ta(t,e,n,r,i){if(t){"rtl"==e.doc.direction&&(i=-i);var o=ct(n,e.doc.direction);if(o){var a,s=i<0?Y(o):o[0],l=i<0==(1==s.level)?"after":"before";if(s.level>0||"rtl"==e.doc.direction){var c=Mn(e,n);a=i<0?n.text.length-1:0;var u=In(e,c,a).top;a=ot((function(t){return In(e,c,t).top==u}),i<0==(1==s.level)?s.from:s.to-1,a),"before"==l&&(a=Jo(n,a,1))}else a=i<0?s.to:s.from;return new te(r,a,l)}}return new te(r,i<0?n.text.length:0,i<0?"before":"after")}Go.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"},Go.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"},Go.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"},Go.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"]},Go.default=y?Go.macDefault:Go.pcDefault;var ea={selectAll:so,singleSelection:function(t){return t.setSelection(t.getCursor("anchor"),t.getCursor("head"),z)},killLine:function(t){return Zo(t,(function(e){if(e.empty()){var n=Kt(t.doc,e.head.line).text.length;return e.head.ch==n&&e.head.line<t.lastLine()?{from:e.head,to:te(e.head.line+1,0)}:{from:e.head,to:te(e.head.line,n)}}return{from:e.from(),to:e.to()}}))},deleteLine:function(t){return Zo(t,(function(e){return{from:te(e.from().line,0),to:se(t.doc,te(e.to().line+1,0))}}))},delLineLeft:function(t){return Zo(t,(function(t){return{from:te(t.from().line,0),to:t.from()}}))},delWrappedLineLeft:function(t){return Zo(t,(function(e){var n=t.charCoords(e.head,"div").top+5;return{from:t.coordsChar({left:0,top:n},"div"),to:e.from()}}))},delWrappedLineRight:function(t){return Zo(t,(function(e){var n=t.charCoords(e.head,"div").top+5,r=t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:n},"div");return{from:e.from(),to:r}}))},undo:function(t){return t.undo()},redo:function(t){return t.redo()},undoSelection:function(t){return t.undoSelection()},redoSelection:function(t){return t.redoSelection()},goDocStart:function(t){return t.extendSelection(te(t.firstLine(),0))},goDocEnd:function(t){return t.extendSelection(te(t.lastLine()))},goLineStart:function(t){return t.extendSelectionsBy((function(e){return na(t,e.head.line)}),{origin:"+move",bias:1})},goLineStartSmart:function(t){return t.extendSelectionsBy((function(e){return ra(t,e.head)}),{origin:"+move",bias:1})},goLineEnd:function(t){return t.extendSelectionsBy((function(e){return function(t,e){var n=Kt(t.doc,e),r=function(t){for(var e;e=Pe(t);)t=e.find(1,!0).line;return t}(n);return r!=n&&(e=$t(r)),ta(!0,t,n,e,-1)}(t,e.head.line)}),{origin:"+move",bias:-1})},goLineRight:function(t){return t.extendSelectionsBy((function(e){var n=t.cursorCoords(e.head,"div").top+5;return t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:n},"div")}),V)},goLineLeft:function(t){return t.extendSelectionsBy((function(e){var n=t.cursorCoords(e.head,"div").top+5;return t.coordsChar({left:0,top:n},"div")}),V)},goLineLeftSmart:function(t){return t.extendSelectionsBy((function(e){var n=t.cursorCoords(e.head,"div").top+5,r=t.coordsChar({left:0,top:n},"div");return r.ch<t.getLine(r.line).search(/\S/)?ra(t,e.head):r}),V)},goLineUp:function(t){return t.moveV(-1,"line")},goLineDown:function(t){return t.moveV(1,"line")},goPageUp:function(t){return t.moveV(-1,"page")},goPageDown:function(t){return t.moveV(1,"page")},goCharLeft:function(t){return t.moveH(-1,"char")},goCharRight:function(t){return t.moveH(1,"char")},goColumnLeft:function(t){return t.moveH(-1,"column")},goColumnRight:function(t){return t.moveH(1,"column")},goWordLeft:function(t){return t.moveH(-1,"word")},goGroupRight:function(t){return t.moveH(1,"group")},goGroupLeft:function(t){return t.moveH(-1,"group")},goWordRight:function(t){return t.moveH(1,"word")},delCharBefore:function(t){return t.deleteH(-1,"codepoint")},delCharAfter:function(t){return t.deleteH(1,"char")},delWordBefore:function(t){return t.deleteH(-1,"word")},delWordAfter:function(t){return t.deleteH(1,"word")},delGroupBefore:function(t){return t.deleteH(-1,"group")},delGroupAfter:function(t){return t.deleteH(1,"group")},indentAuto:function(t){return t.indentSelection("smart")},indentMore:function(t){return t.indentSelection("add")},indentLess:function(t){return t.indentSelection("subtract")},insertTab:function(t){return t.replaceSelection("\t")},insertSoftTab:function(t){for(var e=[],n=t.listSelections(),r=t.options.tabSize,i=0;i<n.length;i++){var o=n[i].from(),a=F(t.getLine(o.line),o.ch,r);e.push(q(r-a%r))}t.replaceSelections(e)},defaultTab:function(t){t.somethingSelected()?t.indentSelection("add"):t.execCommand("insertTab")},transposeChars:function(t){return Qr(t,(function(){for(var e=t.listSelections(),n=[],r=0;r<e.length;r++)if(e[r].empty()){var i=e[r].head,o=Kt(t.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new te(i.line,i.ch-1)),i.ch>0)i=new te(i.line,i.ch+1),t.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),te(i.line,i.ch-2),i,"+transpose");else if(i.line>t.doc.first){var a=Kt(t.doc,i.line-1).text;a&&(i=new te(i.line,1),t.replaceRange(o.charAt(0)+t.doc.lineSeparator()+a.charAt(a.length-1),te(i.line-1,a.length-1),i,"+transpose"))}n.push(new Ei(i,i))}t.setSelections(n)}))},newlineAndIndent:function(t){return Qr(t,(function(){for(var e=t.listSelections(),n=e.length-1;n>=0;n--)t.replaceRange(t.doc.lineSeparator(),e[n].anchor,e[n].head,"+input");e=t.listSelections();for(var r=0;r<e.length;r++)t.indentLine(e[r].from().line,null,!0);Rr(t)}))},openLine:function(t){return t.replaceSelection("\n","start")},toggleOverwrite:function(t){return t.toggleOverwrite()}};function na(t,e){var n=Kt(t.doc,e),r=Fe(n);return r!=n&&(e=$t(r)),ta(!0,t,r,e,1)}function ra(t,e){var n=na(t,e.line),r=Kt(t.doc,n.line),i=ct(r,t.doc.direction);if(!i||0==i[0].level){var o=Math.max(n.ch,r.text.search(/\S/)),a=e.line==n.line&&e.ch<=o&&e.ch;return te(n.line,a?0:o,n.sticky)}return n}function ia(t,e,n){if("string"==typeof e&&!(e=ea[e]))return!1;t.display.input.ensurePolled();var r=t.display.shift,i=!1;try{t.isReadOnly()&&(t.state.suppressEdits=!0),n&&(t.display.shift=!1),i=e(t)!=H}finally{t.display.shift=r,t.state.suppressEdits=!1}return i}var oa=new B;function aa(t,e,n,r){var i=t.state.keySeq;if(i){if(qo(e))return"handled";if(/\'$/.test(e)?t.state.keySeq=null:oa.set(50,(function(){t.state.keySeq==i&&(t.state.keySeq=null,t.display.input.reset())})),sa(t,i+" "+e,n,r))return!0}return sa(t,e,n,r)}function sa(t,e,n,r){var i=function(t,e,n){for(var r=0;r<t.state.keyMaps.length;r++){var i=Ko(e,t.state.keyMaps[r],n,t);if(i)return i}return t.options.extraKeys&&Ko(e,t.options.extraKeys,n,t)||Ko(e,t.options.keyMap,n,t)}(t,e,r);return"multi"==i&&(t.state.keySeq=e),"handled"==i&&ln(t,"keyHandled",t,e,n),"handled"!=i&&"multi"!=i||(bt(n),Cr(t)),!!i}function la(t,e){var n=Xo(e,!0);return!!n&&(e.shiftKey&&!t.state.keySeq?aa(t,"Shift-"+n,e,(function(e){return ia(t,e,!0)}))||aa(t,n,e,(function(e){if("string"==typeof e?/^go[A-Z]/.test(e):e.motion)return ia(t,e)})):aa(t,n,e,(function(e){return ia(t,e)})))}var ca=null;function ua(t){var e=this;if(!(t.target&&t.target!=e.display.input.getField()||(e.curOp.focus=M(),gt(e,t)))){a&&s<11&&27==t.keyCode&&(t.returnValue=!1);var r=t.keyCode;e.display.shift=16==r||t.shiftKey;var i=la(e,t);h&&(ca=i?r:null,i||88!=r||It||!(y?t.metaKey:t.ctrlKey)||e.replaceSelection("",null,"cut")),n&&!y&&!i&&46==r&&t.shiftKey&&!t.ctrlKey&&document.execCommand&&document.execCommand("cut"),18!=r||/\bCodeMirror-crosshair\b/.test(e.display.lineDiv.className)||function(t){var e=t.display.lineDiv;function n(t){18!=t.keyCode&&t.altKey||(T(e,"CodeMirror-crosshair"),ft(document,"keyup",n),ft(document,"mouseover",n))}I(e,"CodeMirror-crosshair"),ht(document,"keyup",n),ht(document,"mouseover",n)}(e)}}function ha(t){16==t.keyCode&&(this.doc.sel.shift=!1),gt(this,t)}function da(t){var e=this;if(!(t.target&&t.target!=e.display.input.getField()||Sn(e.display,t)||gt(e,t)||t.ctrlKey&&!t.altKey||y&&t.metaKey)){var n=t.keyCode,r=t.charCode;if(h&&n==ca)return ca=null,void bt(t);if(!h||t.which&&!(t.which<10)||!la(e,t)){var i=String.fromCharCode(null==r?n:r);"\b"!=i&&(function(t,e,n){return aa(t,"'"+n+"'",e,(function(e){return ia(t,e,!0)}))}(e,t,i)||e.display.input.onKeyPress(t))}}}var fa,pa,ga=function(t,e,n){this.time=t,this.pos=e,this.button=n};function ma(t){var e=this,n=e.display;if(!(gt(e,t)||n.activeTouch&&n.input.supportsTouch()))if(n.input.ensurePolled(),n.shift=t.shiftKey,Sn(n,t))l||(n.scroller.draggable=!1,setTimeout((function(){return n.scroller.draggable=!0}),100));else if(!ba(e,t)){var r=cr(e,t),i=kt(t),o=r?function(t,e){var n=+new Date;return pa&&pa.compare(n,t,e)?(fa=pa=null,"triple"):fa&&fa.compare(n,t,e)?(pa=new ga(n,t,e),fa=null,"double"):(fa=new ga(n,t,e),pa=null,"single")}(r,i):"single";window.focus(),1==i&&e.state.selectingText&&e.state.selectingText(t),r&&function(t,e,n,r,i){var o="Click";return"double"==r?o="Double"+o:"triple"==r&&(o="Triple"+o),aa(t,Yo(o=(1==e?"Left":2==e?"Middle":"Right")+o,i),i,(function(e){if("string"==typeof e&&(e=ea[e]),!e)return!1;var r=!1;try{t.isReadOnly()&&(t.state.suppressEdits=!0),r=e(t,n)!=H}finally{t.state.suppressEdits=!1}return r}))}(e,i,r,o,t)||(1==i?r?function(t,e,n,r){a?setTimeout(N(Sr,t),0):t.curOp.focus=M();var i,o=function(t,e,n){var r=t.getOption("configureMouse"),i=r?r(t,e,n):{};if(null==i.unit){var o=b?n.shiftKey&&n.metaKey:n.altKey;i.unit=o?"rectangle":"single"==e?"char":"double"==e?"word":"line"}return(null==i.extend||t.doc.extend)&&(i.extend=t.doc.extend||n.shiftKey),null==i.addNew&&(i.addNew=y?n.metaKey:n.ctrlKey),null==i.moveOnDrag&&(i.moveOnDrag=!(y?n.altKey:n.ctrlKey)),i}(t,n,r),c=t.doc.sel;t.options.dragDrop&&Ot&&!t.isReadOnly()&&"single"==n&&(i=c.contains(e))>-1&&(ee((i=c.ranges[i]).from(),e)<0||e.xRel>0)&&(ee(i.to(),e)>0||e.xRel<0)?function(t,e,n,r){var i=t.display,o=!1,c=ti(t,(function(e){l&&(i.scroller.draggable=!1),t.state.draggingText=!1,ft(i.wrapper.ownerDocument,"mouseup",c),ft(i.wrapper.ownerDocument,"mousemove",u),ft(i.scroller,"dragstart",h),ft(i.scroller,"drop",c),o||(bt(e),r.addNew||Yi(t.doc,n,null,null,r.extend),l&&!d||a&&9==s?setTimeout((function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()}),20):i.input.focus())})),u=function(t){o=o||Math.abs(e.clientX-t.clientX)+Math.abs(e.clientY-t.clientY)>=10},h=function(){return o=!0};l&&(i.scroller.draggable=!0),t.state.draggingText=c,c.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),ht(i.wrapper.ownerDocument,"mouseup",c),ht(i.wrapper.ownerDocument,"mousemove",u),ht(i.scroller,"dragstart",h),ht(i.scroller,"drop",c),Er(t),setTimeout((function(){return i.input.focus()}),20)}(t,r,e,o):function(t,e,n,r){var i=t.display,o=t.doc;bt(e);var a,s,l=o.sel,c=l.ranges;if(r.addNew&&!r.extend?(s=o.sel.contains(n),a=s>-1?c[s]:new Ei(n,n)):(a=o.sel.primary(),s=o.sel.primIndex),"rectangle"==r.unit)r.addNew||(a=new Ei(n,n)),n=cr(t,e,!0,!0),s=-1;else{var u=va(t,n,r.unit);a=r.extend?qi(a,u.anchor,u.head,r.extend):u}r.addNew?-1==s?(s=c.length,Qi(o,ki(t,c.concat([a]),s),{scroll:!1,origin:"*mouse"})):c.length>1&&c[s].empty()&&"char"==r.unit&&!r.extend?(Qi(o,ki(t,c.slice(0,s).concat(c.slice(s+1)),0),{scroll:!1,origin:"*mouse"}),l=o.sel):$i(o,s,a,G):(s=0,Qi(o,new Si([a],0),G),l=o.sel);var h=n;function d(e){if(0!=ee(h,e))if(h=e,"rectangle"==r.unit){for(var i=[],c=t.options.tabSize,u=F(Kt(o,n.line).text,n.ch,c),d=F(Kt(o,e.line).text,e.ch,c),f=Math.min(u,d),p=Math.max(u,d),g=Math.min(n.line,e.line),m=Math.min(t.lastLine(),Math.max(n.line,e.line));g<=m;g++){var v=Kt(o,g).text,y=W(v,f,c);f==p?i.push(new Ei(te(g,y),te(g,y))):v.length>y&&i.push(new Ei(te(g,y),te(g,W(v,p,c))))}i.length||i.push(new Ei(n,n)),Qi(o,ki(t,l.ranges.slice(0,s).concat(i),s),{origin:"*mouse",scroll:!1}),t.scrollIntoView(e)}else{var b,x=a,C=va(t,e,r.unit),S=x.anchor;ee(C.anchor,S)>0?(b=C.head,S=oe(x.from(),C.anchor)):(b=C.anchor,S=ie(x.to(),C.head));var E=l.ranges.slice(0);E[s]=function(t,e){var n=e.anchor,r=e.head,i=Kt(t.doc,n.line);if(0==ee(n,r)&&n.sticky==r.sticky)return e;var o=ct(i);if(!o)return e;var a=st(o,n.ch,n.sticky),s=o[a];if(s.from!=n.ch&&s.to!=n.ch)return e;var l,c=a+(s.from==n.ch==(1!=s.level)?0:1);if(0==c||c==o.length)return e;if(r.line!=n.line)l=(r.line-n.line)*("ltr"==t.doc.direction?1:-1)>0;else{var u=st(o,r.ch,r.sticky),h=u-a||(r.ch-n.ch)*(1==s.level?-1:1);l=u==c-1||u==c?h<0:h>0}var d=o[c+(l?-1:0)],f=l==(1==d.level),p=f?d.from:d.to,g=f?"after":"before";return n.ch==p&&n.sticky==g?e:new Ei(new te(n.line,p,g),r)}(t,new Ei(se(o,S),b)),Qi(o,ki(t,E,s),G)}}var f=i.wrapper.getBoundingClientRect(),p=0;function g(e){t.state.selectingText=!1,p=1/0,e&&(bt(e),i.input.focus()),ft(i.wrapper.ownerDocument,"mousemove",m),ft(i.wrapper.ownerDocument,"mouseup",v),o.history.lastSelOrigin=null}var m=ti(t,(function(e){0!==e.buttons&&kt(e)?function e(n){var a=++p,s=cr(t,n,!0,"rectangle"==r.unit);if(s)if(0!=ee(s,h)){t.curOp.focus=M(),d(s);var l=Lr(i,o);(s.line>=l.to||s.line<l.from)&&setTimeout(ti(t,(function(){p==a&&e(n)})),150)}else{var c=n.clientY<f.top?-20:n.clientY>f.bottom?20:0;c&&setTimeout(ti(t,(function(){p==a&&(i.scroller.scrollTop+=c,e(n))})),50)}}(e):g(e)})),v=ti(t,g);t.state.selectingText=v,ht(i.wrapper.ownerDocument,"mousemove",m),ht(i.wrapper.ownerDocument,"mouseup",v)}(t,r,e,o)}(e,r,o,t):Et(t)==n.scroller&&bt(t):2==i?(r&&Yi(e.doc,r),setTimeout((function(){return n.input.focus()}),20)):3==i&&(E?e.display.input.onContextMenu(t):Er(e)))}}function va(t,e,n){if("char"==n)return new Ei(e,e);if("word"==n)return t.findWordAt(e);if("line"==n)return new Ei(te(e.line,0),se(t.doc,te(e.line+1,0)));var r=n(t,e);return new Ei(r.from,r.to)}function ya(t,e,n,r){var i,o;if(e.touches)i=e.touches[0].clientX,o=e.touches[0].clientY;else try{i=e.clientX,o=e.clientY}catch(t){return!1}if(i>=Math.floor(t.display.gutters.getBoundingClientRect().right))return!1;r&&bt(e);var a=t.display,s=a.lineDiv.getBoundingClientRect();if(o>s.bottom||!vt(t,n))return Ct(e);o-=s.top-a.viewOffset;for(var l=0;l<t.display.gutterSpecs.length;++l){var c=a.gutters.childNodes[l];if(c&&c.getBoundingClientRect().right>=i)return pt(t,n,t,Zt(t.doc,o),t.display.gutterSpecs[l].className,e),Ct(e)}}function ba(t,e){return ya(t,e,"gutterClick",!0)}function xa(t,e){Sn(t.display,e)||function(t,e){return!!vt(t,"gutterContextMenu")&&ya(t,e,"gutterContextMenu",!1)}(t,e)||gt(t,e,"contextmenu")||E||t.display.input.onContextMenu(e)}function Ca(t){t.display.wrapper.className=t.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+t.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Un(t)}ga.prototype.compare=function(t,e,n){return this.time+400>t&&0==ee(e,this.pos)&&n==this.button};var Sa={toString:function(){return"CodeMirror.Init"}},Ea={},ka={};function wa(t,e,n){if(!e!=!(n&&n!=Sa)){var r=t.display.dragFunctions,i=e?ht:ft;i(t.display.scroller,"dragstart",r.start),i(t.display.scroller,"dragenter",r.enter),i(t.display.scroller,"dragover",r.over),i(t.display.scroller,"dragleave",r.leave),i(t.display.scroller,"drop",r.drop)}}function Ta(t){t.options.lineWrapping?(I(t.display.wrapper,"CodeMirror-wrap"),t.display.sizer.style.minWidth="",t.display.sizerWidth=null):(T(t.display.wrapper,"CodeMirror-wrap"),We(t)),lr(t),hr(t),Un(t),setTimeout((function(){return Hr(t)}),100)}function Oa(t,e){var n=this;if(!(this instanceof Oa))return new Oa(t,e);this.options=e=e?j(e):{},j(Ea,e,!1);var r=e.value;"string"==typeof r?r=new Ro(r,e.mode,null,e.lineSeparator,e.direction):e.mode&&(r.modeOption=e.mode),this.doc=r;var i=new Oa.inputStyles[e.inputStyle](this),o=this.display=new mi(t,r,i,e);for(var c in o.wrapper.CodeMirror=this,Ca(this),e.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Vr(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 B,keySeq:null,specialChars:null},e.autofocus&&!v&&o.input.focus(),a&&s<11&&setTimeout((function(){return n.display.input.reset(!0)}),20),function(t){var e=t.display;ht(e.scroller,"mousedown",ti(t,ma)),ht(e.scroller,"dblclick",a&&s<11?ti(t,(function(e){if(!gt(t,e)){var n=cr(t,e);if(n&&!ba(t,e)&&!Sn(t.display,e)){bt(e);var r=t.findWordAt(n);Yi(t.doc,r.anchor,r.head)}}})):function(e){return gt(t,e)||bt(e)}),ht(e.scroller,"contextmenu",(function(e){return xa(t,e)})),ht(e.input.getField(),"contextmenu",(function(n){e.scroller.contains(n.target)||xa(t,n)}));var n,r={end:0};function i(){e.activeTouch&&(n=setTimeout((function(){return e.activeTouch=null}),1e3),(r=e.activeTouch).end=+new Date)}function o(t,e){if(null==e.left)return!0;var n=e.left-t.left,r=e.top-t.top;return n*n+r*r>400}ht(e.scroller,"touchstart",(function(i){if(!gt(t,i)&&!function(t){if(1!=t.touches.length)return!1;var e=t.touches[0];return e.radiusX<=1&&e.radiusY<=1}(i)&&!ba(t,i)){e.input.ensurePolled(),clearTimeout(n);var o=+new Date;e.activeTouch={start:o,moved:!1,prev:o-r.end<=300?r:null},1==i.touches.length&&(e.activeTouch.left=i.touches[0].pageX,e.activeTouch.top=i.touches[0].pageY)}})),ht(e.scroller,"touchmove",(function(){e.activeTouch&&(e.activeTouch.moved=!0)})),ht(e.scroller,"touchend",(function(n){var r=e.activeTouch;if(r&&!Sn(e,n)&&null!=r.left&&!r.moved&&new Date-r.start<300){var a,s=t.coordsChar(e.activeTouch,"page");a=!r.prev||o(r,r.prev)?new Ei(s,s):!r.prev.prev||o(r,r.prev.prev)?t.findWordAt(s):new Ei(te(s.line,0),se(t.doc,te(s.line+1,0))),t.setSelection(a.anchor,a.head),t.focus(),bt(n)}i()})),ht(e.scroller,"touchcancel",i),ht(e.scroller,"scroll",(function(){e.scroller.clientHeight&&(Pr(t,e.scroller.scrollTop),jr(t,e.scroller.scrollLeft,!0),pt(t,"scroll",t))})),ht(e.scroller,"mousewheel",(function(e){return Ci(t,e)})),ht(e.scroller,"DOMMouseScroll",(function(e){return Ci(t,e)})),ht(e.wrapper,"scroll",(function(){return e.wrapper.scrollTop=e.wrapper.scrollLeft=0})),e.dragFunctions={enter:function(e){gt(t,e)||St(e)},over:function(e){gt(t,e)||(function(t,e){var n=cr(t,e);if(n){var r=document.createDocumentFragment();yr(t,n,r),t.display.dragCursor||(t.display.dragCursor=A("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),t.display.lineSpace.insertBefore(t.display.dragCursor,t.display.cursorDiv)),L(t.display.dragCursor,r)}}(t,e),St(e))},start:function(e){return function(t,e){if(a&&(!t.state.draggingText||+new Date-Mo<100))St(e);else if(!gt(t,e)&&!Sn(t.display,e)&&(e.dataTransfer.setData("Text",t.getSelection()),e.dataTransfer.effectAllowed="copyMove",e.dataTransfer.setDragImage&&!d)){var n=A("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",h&&(n.width=n.height=1,t.display.wrapper.appendChild(n),n._top=n.offsetTop),e.dataTransfer.setDragImage(n,0,0),h&&n.parentNode.removeChild(n)}}(t,e)},drop:ti(t,Io),leave:function(e){gt(t,e)||_o(t)}};var l=e.input.getField();ht(l,"keyup",(function(e){return ha.call(t,e)})),ht(l,"keydown",ti(t,ua)),ht(l,"keypress",ti(t,da)),ht(l,"focus",(function(e){return kr(t,e)})),ht(l,"blur",(function(e){return wr(t,e)}))}(this),jo(),Kr(this),this.curOp.forceUpdate=!0,Pi(this,r),e.autofocus&&!v||this.hasFocus()?setTimeout((function(){n.hasFocus()&&!n.state.focused&&kr(n)}),20):wr(this),ka)ka.hasOwnProperty(c)&&ka[c](this,e[c],Sa);di(this),e.finishInit&&e.finishInit(this);for(var u=0;u<La.length;++u)La[u](this);qr(this),l&&e.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}Oa.defaults=Ea,Oa.optionHandlers=ka;var La=[];function Aa(t,e,n,r){var i,o=t.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?i=fe(t,e).state:n="prev");var a=t.options.tabSize,s=Kt(o,e),l=F(s.text,null,a);s.stateAfter&&(s.stateAfter=null);var c,u=s.text.match(/^\s*/)[0];if(r||/\S/.test(s.text)){if("smart"==n&&((c=o.mode.indent(i,s.text.slice(u.length),s.text))==H||c>150)){if(!r)return;n="prev"}}else c=0,n="not";"prev"==n?c=e>o.first?F(Kt(o,e-1).text,null,a):0:"add"==n?c=l+t.options.indentUnit:"subtract"==n?c=l-t.options.indentUnit:"number"==typeof n&&(c=l+n),c=Math.max(0,c);var h="",d=0;if(t.options.indentWithTabs)for(var f=Math.floor(c/a);f;--f)d+=a,h+="\t";if(d<c&&(h+=q(c-d)),h!=u)return go(o,h,te(e,0),te(e,u.length),"+input"),s.stateAfter=null,!0;for(var p=0;p<o.sel.ranges.length;p++){var g=o.sel.ranges[p];if(g.head.line==e&&g.head.ch<u.length){var m=te(e,u.length);$i(o,p,new Ei(m,m));break}}}Oa.defineInitHook=function(t){return La.push(t)};var Da=null;function Ra(t){Da=t}function Ma(t,e,n,r,i){var o=t.doc;t.display.shift=!1,r||(r=o.sel);var a=+new Date-200,s="paste"==i||t.state.pasteIncoming>a,l=Rt(e),c=null;if(s&&r.ranges.length>1)if(Da&&Da.text.join("\n")==e){if(r.ranges.length%Da.text.length==0){c=[];for(var u=0;u<Da.text.length;u++)c.push(o.splitLines(Da.text[u]))}}else l.length==r.ranges.length&&t.options.pasteLinesPerSelection&&(c=X(l,(function(t){return[t]})));for(var h=t.curOp.updateInput,d=r.ranges.length-1;d>=0;d--){var f=r.ranges[d],p=f.from(),g=f.to();f.empty()&&(n&&n>0?p=te(p.line,p.ch-n):t.state.overwrite&&!s?g=te(g.line,Math.min(Kt(o,g.line).text.length,g.ch+Y(l).length)):s&&Da&&Da.lineWise&&Da.text.join("\n")==l.join("\n")&&(p=g=te(p.line,0)));var m={from:p,to:g,text:c?c[d%c.length]:l,origin:i||(s?"paste":t.state.cutIncoming>a?"cut":"+input")};co(t.doc,m),ln(t,"inputRead",t,m)}e&&!s&&_a(t,e),Rr(t),t.curOp.updateInput<2&&(t.curOp.updateInput=h),t.curOp.typing=!0,t.state.pasteIncoming=t.state.cutIncoming=-1}function Ia(t,e){var n=t.clipboardData&&t.clipboardData.getData("Text");if(n)return t.preventDefault(),e.isReadOnly()||e.options.disableInput||Qr(e,(function(){return Ma(e,n,0,null,"paste")})),!0}function _a(t,e){if(t.options.electricChars&&t.options.smartIndent)for(var n=t.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=t.getModeAt(i.head),a=!1;if(o.electricChars){for(var s=0;s<o.electricChars.length;s++)if(e.indexOf(o.electricChars.charAt(s))>-1){a=Aa(t,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Kt(t.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Aa(t,i.head.line,"smart"));a&&ln(t,"electricInput",t,i.head.line)}}}function Pa(t){for(var e=[],n=[],r=0;r<t.doc.sel.ranges.length;r++){var i=t.doc.sel.ranges[r].head.line,o={anchor:te(i,0),head:te(i+1,0)};n.push(o),e.push(t.getRange(o.anchor,o.head))}return{text:e,ranges:n}}function Na(t,e,n,r){t.setAttribute("autocorrect",n?"":"off"),t.setAttribute("autocapitalize",r?"":"off"),t.setAttribute("spellcheck",!!e)}function ja(){var t=A("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),e=A("div",[t],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return l?t.style.width="1000px":t.setAttribute("wrap","off"),g&&(t.style.border="1px solid black"),Na(t),e}function Fa(t,e,n,r,i){var o=e,a=n,s=Kt(t,e.line),l=i&&"rtl"==t.direction?-n:n;function c(o){var a,c;if("codepoint"==r){var u=s.text.charCodeAt(e.ch+(r>0?0:-1));a=isNaN(u)?null:new te(e.line,Math.max(0,Math.min(s.text.length,e.ch+n*(u>=55296&&u<56320?2:1))),-n)}else a=i?function(t,e,n,r){var i=ct(e,t.doc.direction);if(!i)return Qo(e,n,r);n.ch>=e.text.length?(n.ch=e.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=st(i,n.ch,n.sticky),a=i[o];if("ltr"==t.doc.direction&&a.level%2==0&&(r>0?a.to>n.ch:a.from<n.ch))return Qo(e,n,r);var s,l=function(t,n){return Jo(e,t instanceof te?t.ch:t,n)},c=function(n){return t.options.lineWrapping?(s=s||Mn(t,e),Jn(t,e,s,n)):{begin:0,end:e.text.length}},u=c("before"==n.sticky?l(n,-1):n.ch);if("rtl"==t.doc.direction||1==a.level){var h=1==a.level==r<0,d=l(n,h?1:-1);if(null!=d&&(h?d<=a.to&&d<=u.end:d>=a.from&&d>=u.begin)){var f=h?"before":"after";return new te(n.line,d,f)}}var p=function(t,e,r){for(var o=function(t,e){return e?new te(n.line,l(t,1),"before"):new te(n.line,t,"after")};t>=0&&t<i.length;t+=e){var a=i[t],s=e>0==(1!=a.level),c=s?r.begin:l(r.end,-1);if(a.from<=c&&c<a.to)return o(c,s);if(c=s?a.from:l(a.to,-1),r.begin<=c&&c<r.end)return o(c,s)}},g=p(o+r,r,u);if(g)return g;var m=r>0?u.end:l(u.begin,-1);return null==m||r>0&&m==e.text.length||!(g=p(r>0?0:i.length-1,r,c(m)))?null:g}(t.cm,s,e,n):Qo(s,e,n);if(null==a){if(o||(c=e.line+l)<t.first||c>=t.first+t.size||(e=new te(c,e.ch,e.sticky),!(s=Kt(t,c))))return!1;e=ta(i,t.cm,s,e.line,l)}else e=a;return!0}if("char"==r||"codepoint"==r)c();else if("column"==r)c(!0);else if("word"==r||"group"==r)for(var u=null,h="group"==r,d=t.cm&&t.cm.getHelper(e,"wordChars"),f=!0;!(n<0)||c(!f);f=!1){var p=s.text.charAt(e.ch)||"\n",g=tt(p,d)?"w":h&&"\n"==p?"n":!h||/\s/.test(p)?null:"p";if(!h||f||g||(g="s"),u&&u!=g){n<0&&(n=1,c(),e.sticky="after");break}if(g&&(u=g),n>0&&!c(!f))break}var m=oo(t,e,o,a,!0);return ne(o,m)&&(m.hitSide=!0),m}function Ba(t,e,n,r){var i,o,a=t.doc,s=e.left;if("page"==r){var l=Math.min(t.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),c=Math.max(l-.5*rr(t.display),3);i=(n>0?e.bottom:e.top)+n*c}else"line"==r&&(i=n>0?e.bottom+3:e.top-3);for(;(o=$n(t,s,i)).outside;){if(n<0?i<=0:i>=a.height){o.hitSide=!0;break}i+=5*n}return o}var Ua=function(t){this.cm=t,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new B,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Ha(t,e){var n=Rn(t,e.line);if(!n||n.hidden)return null;var r=Kt(t.doc,e.line),i=An(n,r,e.line),o=ct(r,t.doc.direction),a="left";o&&(a=st(o,e.ch)%2?"right":"left");var s=Nn(i.map,e.ch,a);return s.offset="right"==s.collapse?s.end:s.start,s}function za(t,e){return e&&(t.bad=!0),t}function Ga(t,e,n){var r;if(e==t.display.lineDiv){if(!(r=t.display.lineDiv.childNodes[n]))return za(t.clipPos(te(t.display.viewTo-1)),!0);e=null,n=0}else for(r=e;;r=r.parentNode){if(!r||r==t.display.lineDiv)return null;if(r.parentNode&&r.parentNode==t.display.lineDiv)break}for(var i=0;i<t.display.view.length;i++){var o=t.display.view[i];if(o.node==r)return Va(o,e,n)}}function Va(t,e,n){var r=t.text.firstChild,i=!1;if(!e||!R(r,e))return za(te($t(t.line),0),!0);if(e==r&&(i=!0,e=r.childNodes[n],n=0,!e)){var o=t.rest?Y(t.rest):t.line;return za(te($t(o),o.text.length),i)}var a=3==e.nodeType?e:null,s=e;for(a||1!=e.childNodes.length||3!=e.firstChild.nodeType||(a=e.firstChild,n&&(n=a.nodeValue.length));s.parentNode!=r;)s=s.parentNode;var l=t.measure,c=l.maps;function u(e,n,r){for(var i=-1;i<(c?c.length:0);i++)for(var o=i<0?l.map:c[i],a=0;a<o.length;a+=3){var s=o[a+2];if(s==e||s==n){var u=$t(i<0?t.line:t.rest[i]),h=o[a]+r;return(r<0||s!=e)&&(h=o[a+(r?1:0)]),te(u,h)}}}var h=u(a,s,n);if(h)return za(h,i);for(var d=s.nextSibling,f=a?a.nodeValue.length-n:0;d;d=d.nextSibling){if(h=u(d,d.firstChild,0))return za(te(h.line,h.ch-f),i);f+=d.textContent.length}for(var p=s.previousSibling,g=n;p;p=p.previousSibling){if(h=u(p,p.firstChild,-1))return za(te(h.line,h.ch+g),i);g+=p.textContent.length}}Ua.prototype.init=function(t){var e=this,n=this,r=n.cm,i=n.div=t.lineDiv;function o(t){for(var e=t.target;e;e=e.parentNode){if(e==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(e.className))break}return!1}function a(t){if(o(t)&&!gt(r,t)){if(r.somethingSelected())Ra({lineWise:!1,text:r.getSelections()}),"cut"==t.type&&r.replaceSelection("",null,"cut");else{if(!r.options.lineWiseCopyCut)return;var e=Pa(r);Ra({lineWise:!0,text:e.text}),"cut"==t.type&&r.operation((function(){r.setSelections(e.ranges,0,z),r.replaceSelection("",null,"cut")}))}if(t.clipboardData){t.clipboardData.clearData();var a=Da.text.join("\n");if(t.clipboardData.setData("Text",a),t.clipboardData.getData("Text")==a)return void t.preventDefault()}var s=ja(),l=s.firstChild;r.display.lineSpace.insertBefore(s,r.display.lineSpace.firstChild),l.value=Da.text.join("\n");var c=document.activeElement;P(l),setTimeout((function(){r.display.lineSpace.removeChild(s),c.focus(),c==i&&n.showPrimarySelection()}),50)}}Na(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize),ht(i,"paste",(function(t){!o(t)||gt(r,t)||Ia(t,r)||s<=11&&setTimeout(ti(r,(function(){return e.updateFromDOM()})),20)})),ht(i,"compositionstart",(function(t){e.composing={data:t.data,done:!1}})),ht(i,"compositionupdate",(function(t){e.composing||(e.composing={data:t.data,done:!1})})),ht(i,"compositionend",(function(t){e.composing&&(t.data!=e.composing.data&&e.readFromDOMSoon(),e.composing.done=!0)})),ht(i,"touchstart",(function(){return n.forceCompositionEnd()})),ht(i,"input",(function(){e.composing||e.readFromDOMSoon()})),ht(i,"copy",a),ht(i,"cut",a)},Ua.prototype.screenReaderLabelChanged=function(t){t?this.div.setAttribute("aria-label",t):this.div.removeAttribute("aria-label")},Ua.prototype.prepareSelection=function(){var t=vr(this.cm,!1);return t.focus=document.activeElement==this.div,t},Ua.prototype.showSelection=function(t,e){t&&this.cm.display.view.length&&((t.focus||e)&&this.showPrimarySelection(),this.showMultipleSelections(t))},Ua.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Ua.prototype.showPrimarySelection=function(){var t=this.getSelection(),e=this.cm,r=e.doc.sel.primary(),i=r.from(),o=r.to();if(e.display.viewTo==e.display.viewFrom||i.line>=e.display.viewTo||o.line<e.display.viewFrom)t.removeAllRanges();else{var a=Ga(e,t.anchorNode,t.anchorOffset),s=Ga(e,t.focusNode,t.focusOffset);if(!a||a.bad||!s||s.bad||0!=ee(oe(a,s),i)||0!=ee(ie(a,s),o)){var l=e.display.view,c=i.line>=e.display.viewFrom&&Ha(e,i)||{node:l[0].measure.map[2],offset:0},u=o.line<e.display.viewTo&&Ha(e,o);if(!u){var h=l[l.length-1].measure,d=h.maps?h.maps[h.maps.length-1]:h.map;u={node:d[d.length-1],offset:d[d.length-2]-d[d.length-3]}}if(c&&u){var f,p=t.rangeCount&&t.getRangeAt(0);try{f=w(c.node,c.offset,u.offset,u.node)}catch(t){}f&&(!n&&e.state.focused?(t.collapse(c.node,c.offset),f.collapsed||(t.removeAllRanges(),t.addRange(f))):(t.removeAllRanges(),t.addRange(f)),p&&null==t.anchorNode?t.addRange(p):n&&this.startGracePeriod()),this.rememberSelection()}else t.removeAllRanges()}}},Ua.prototype.startGracePeriod=function(){var t=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout((function(){t.gracePeriod=!1,t.selectionChanged()&&t.cm.operation((function(){return t.cm.curOp.selectionChanged=!0}))}),20)},Ua.prototype.showMultipleSelections=function(t){L(this.cm.display.cursorDiv,t.cursors),L(this.cm.display.selectionDiv,t.selection)},Ua.prototype.rememberSelection=function(){var t=this.getSelection();this.lastAnchorNode=t.anchorNode,this.lastAnchorOffset=t.anchorOffset,this.lastFocusNode=t.focusNode,this.lastFocusOffset=t.focusOffset},Ua.prototype.selectionInEditor=function(){var t=this.getSelection();if(!t.rangeCount)return!1;var e=t.getRangeAt(0).commonAncestorContainer;return R(this.div,e)},Ua.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()&&document.activeElement==this.div||this.showSelection(this.prepareSelection(),!0),this.div.focus())},Ua.prototype.blur=function(){this.div.blur()},Ua.prototype.getField=function(){return this.div},Ua.prototype.supportsTouch=function(){return!0},Ua.prototype.receivedFocus=function(){var t=this;this.selectionInEditor()?this.pollSelection():Qr(this.cm,(function(){return t.cm.curOp.selectionChanged=!0})),this.polling.set(this.cm.options.pollInterval,(function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))}))},Ua.prototype.selectionChanged=function(){var t=this.getSelection();return t.anchorNode!=this.lastAnchorNode||t.anchorOffset!=this.lastAnchorOffset||t.focusNode!=this.lastFocusNode||t.focusOffset!=this.lastFocusOffset},Ua.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var t=this.getSelection(),e=this.cm;if(m&&u&&this.cm.display.gutterSpecs.length&&function(t){for(var e=t;e;e=e.parentNode)if(/CodeMirror-gutter-wrapper/.test(e.className))return!0;return!1}(t.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var n=Ga(e,t.anchorNode,t.anchorOffset),r=Ga(e,t.focusNode,t.focusOffset);n&&r&&Qr(e,(function(){Qi(e.doc,wi(n,r),z),(n.bad||r.bad)&&(e.curOp.selectionChanged=!0)}))}}},Ua.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var t,e,n,r=this.cm,i=r.display,o=r.doc.sel.primary(),a=o.from(),s=o.to();if(0==a.ch&&a.line>r.firstLine()&&(a=te(a.line-1,Kt(r.doc,a.line-1).length)),s.ch==Kt(r.doc,s.line).text.length&&s.line<r.lastLine()&&(s=te(s.line+1,0)),a.line<i.viewFrom||s.line>i.viewTo-1)return!1;a.line==i.viewFrom||0==(t=ur(r,a.line))?(e=$t(i.view[0].line),n=i.view[0].node):(e=$t(i.view[t].line),n=i.view[t-1].node.nextSibling);var l,c,u=ur(r,s.line);if(u==i.view.length-1?(l=i.viewTo-1,c=i.lineDiv.lastChild):(l=$t(i.view[u+1].line)-1,c=i.view[u+1].node.previousSibling),!n)return!1;for(var h=r.doc.splitLines(function(t,e,n,r,i){var o="",a=!1,s=t.doc.lineSeparator(),l=!1;function c(){a&&(o+=s,l&&(o+=s),a=l=!1)}function u(t){t&&(c(),o+=t)}function h(e){if(1==e.nodeType){var n=e.getAttribute("cm-text");if(n)return void u(n);var o,d=e.getAttribute("cm-marker");if(d){var f=t.findMarks(te(r,0),te(i+1,0),(m=+d,function(t){return t.id==m}));return void(f.length&&(o=f[0].find(0))&&u(qt(t.doc,o.from,o.to).join(s)))}if("false"==e.getAttribute("contenteditable"))return;var p=/^(pre|div|p|li|table|br)$/i.test(e.nodeName);if(!/^br$/i.test(e.nodeName)&&0==e.textContent.length)return;p&&c();for(var g=0;g<e.childNodes.length;g++)h(e.childNodes[g]);/^(pre|p)$/i.test(e.nodeName)&&(l=!0),p&&(a=!0)}else 3==e.nodeType&&u(e.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "));var m}for(;h(e),e!=n;)e=e.nextSibling,l=!1;return o}(r,n,c,e,l)),d=qt(r.doc,te(e,0),te(l,Kt(r.doc,l).text.length));h.length>1&&d.length>1;)if(Y(h)==Y(d))h.pop(),d.pop(),l--;else{if(h[0]!=d[0])break;h.shift(),d.shift(),e++}for(var f=0,p=0,g=h[0],m=d[0],v=Math.min(g.length,m.length);f<v&&g.charCodeAt(f)==m.charCodeAt(f);)++f;for(var y=Y(h),b=Y(d),x=Math.min(y.length-(1==h.length?f:0),b.length-(1==d.length?f:0));p<x&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)++p;if(1==h.length&&1==d.length&&e==a.line)for(;f&&f>a.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)f--,p++;h[h.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),h[0]=h[0].slice(f).replace(/\u200b+$/,"");var C=te(e,f),S=te(l,d.length?Y(d).length-p:0);return h.length>1||h[0]||ee(C,S)?(go(r.doc,h,C,S,"+input"),!0):void 0},Ua.prototype.ensurePolled=function(){this.forceCompositionEnd()},Ua.prototype.reset=function(){this.forceCompositionEnd()},Ua.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Ua.prototype.readFromDOMSoon=function(){var t=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(t.readDOMTimeout=null,t.composing){if(!t.composing.done)return;t.composing=null}t.updateFromDOM()}),80))},Ua.prototype.updateFromDOM=function(){var t=this;!this.cm.isReadOnly()&&this.pollContent()||Qr(this.cm,(function(){return hr(t.cm)}))},Ua.prototype.setUneditable=function(t){t.contentEditable="false"},Ua.prototype.onKeyPress=function(t){0==t.charCode||this.composing||(t.preventDefault(),this.cm.isReadOnly()||ti(this.cm,Ma)(this.cm,String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),0))},Ua.prototype.readOnlyChanged=function(t){this.div.contentEditable=String("nocursor"!=t)},Ua.prototype.onContextMenu=function(){},Ua.prototype.resetPosition=function(){},Ua.prototype.needsContentAttribute=!0;var Wa=function(t){this.cm=t,this.prevInput="",this.pollingFast=!1,this.polling=new B,this.hasSelection=!1,this.composing=null};Wa.prototype.init=function(t){var e=this,n=this,r=this.cm;this.createField(t);var i=this.textarea;function o(t){if(!gt(r,t)){if(r.somethingSelected())Ra({lineWise:!1,text:r.getSelections()});else{if(!r.options.lineWiseCopyCut)return;var e=Pa(r);Ra({lineWise:!0,text:e.text}),"cut"==t.type?r.setSelections(e.ranges,null,z):(n.prevInput="",i.value=e.text.join("\n"),P(i))}"cut"==t.type&&(r.state.cutIncoming=+new Date)}}t.wrapper.insertBefore(this.wrapper,t.wrapper.firstChild),g&&(i.style.width="0px"),ht(i,"input",(function(){a&&s>=9&&e.hasSelection&&(e.hasSelection=null),n.poll()})),ht(i,"paste",(function(t){gt(r,t)||Ia(t,r)||(r.state.pasteIncoming=+new Date,n.fastPoll())})),ht(i,"cut",o),ht(i,"copy",o),ht(t.scroller,"paste",(function(e){if(!Sn(t,e)&&!gt(r,e)){if(!i.dispatchEvent)return r.state.pasteIncoming=+new Date,void n.focus();var o=new Event("paste");o.clipboardData=e.clipboardData,i.dispatchEvent(o)}})),ht(t.lineSpace,"selectstart",(function(e){Sn(t,e)||bt(e)})),ht(i,"compositionstart",(function(){var t=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:t,range:r.markText(t,r.getCursor("to"),{className:"CodeMirror-composing"})}})),ht(i,"compositionend",(function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)}))},Wa.prototype.createField=function(t){this.wrapper=ja(),this.textarea=this.wrapper.firstChild},Wa.prototype.screenReaderLabelChanged=function(t){t?this.textarea.setAttribute("aria-label",t):this.textarea.removeAttribute("aria-label")},Wa.prototype.prepareSelection=function(){var t=this.cm,e=t.display,n=t.doc,r=vr(t);if(t.options.moveInputWithCursor){var i=qn(t,n.sel.primary().head,"div"),o=e.wrapper.getBoundingClientRect(),a=e.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(e.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(e.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},Wa.prototype.showSelection=function(t){var e=this.cm.display;L(e.cursorDiv,t.cursors),L(e.selectionDiv,t.selection),null!=t.teTop&&(this.wrapper.style.top=t.teTop+"px",this.wrapper.style.left=t.teLeft+"px")},Wa.prototype.reset=function(t){if(!this.contextMenuPending&&!this.composing){var e=this.cm;if(e.somethingSelected()){this.prevInput="";var n=e.getSelection();this.textarea.value=n,e.state.focused&&P(this.textarea),a&&s>=9&&(this.hasSelection=n)}else t||(this.prevInput=this.textarea.value="",a&&s>=9&&(this.hasSelection=null))}},Wa.prototype.getField=function(){return this.textarea},Wa.prototype.supportsTouch=function(){return!1},Wa.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!v||M()!=this.textarea))try{this.textarea.focus()}catch(t){}},Wa.prototype.blur=function(){this.textarea.blur()},Wa.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Wa.prototype.receivedFocus=function(){this.slowPoll()},Wa.prototype.slowPoll=function(){var t=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){t.poll(),t.cm.state.focused&&t.slowPoll()}))},Wa.prototype.fastPoll=function(){var t=!1,e=this;e.pollingFast=!0,e.polling.set(20,(function n(){e.poll()||t?(e.pollingFast=!1,e.slowPoll()):(t=!0,e.polling.set(60,n))}))},Wa.prototype.poll=function(){var t=this,e=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!e.state.focused||Mt(n)&&!r&&!this.composing||e.isReadOnly()||e.options.disableInput||e.state.keySeq)return!1;var i=n.value;if(i==r&&!e.somethingSelected())return!1;if(a&&s>=9&&this.hasSelection===i||y&&/[\uf700-\uf7ff]/.test(i))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||r||(r=""),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var l=0,c=Math.min(r.length,i.length);l<c&&r.charCodeAt(l)==i.charCodeAt(l);)++l;return Qr(e,(function(){Ma(e,i.slice(l),r.length-l,null,t.composing?"*compose":null),i.length>1e3||i.indexOf("\n")>-1?n.value=t.prevInput="":t.prevInput=i,t.composing&&(t.composing.range.clear(),t.composing.range=e.markText(t.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},Wa.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Wa.prototype.onKeyPress=function(){a&&s>=9&&(this.hasSelection=null),this.fastPoll()},Wa.prototype.onContextMenu=function(t){var e=this,n=e.cm,r=n.display,i=e.textarea;e.contextMenuPending&&e.contextMenuPending();var o=cr(n,t),c=r.scroller.scrollTop;if(o&&!h){n.options.resetSelectionOnContextMenu&&-1==n.doc.sel.contains(o)&&ti(n,Qi)(n.doc,wi(o),z);var u,d=i.style.cssText,f=e.wrapper.style.cssText,p=e.wrapper.offsetParent.getBoundingClientRect();if(e.wrapper.style.cssText="position: static",i.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(t.clientY-p.top-5)+"px; left: "+(t.clientX-p.left-5)+"px;\n z-index: 1000; background: "+(a?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",l&&(u=window.scrollY),r.input.focus(),l&&window.scrollTo(null,u),r.input.reset(),n.somethingSelected()||(i.value=e.prevInput=" "),e.contextMenuPending=v,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll),a&&s>=9&&m(),E){St(t);var g=function(){ft(window,"mouseup",g),setTimeout(v,20)};ht(window,"mouseup",g)}else setTimeout(v,50)}function m(){if(null!=i.selectionStart){var t=n.somethingSelected(),o=""+(t?i.value:"");i.value="⇚",i.value=o,e.prevInput=t?"":"",i.selectionStart=1,i.selectionEnd=o.length,r.selForContextMenu=n.doc.sel}}function v(){if(e.contextMenuPending==v&&(e.contextMenuPending=!1,e.wrapper.style.cssText=f,i.style.cssText=d,a&&s<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=c),null!=i.selectionStart)){(!a||a&&s<9)&&m();var t=0,o=function(){r.selForContextMenu==n.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&""==e.prevInput?ti(n,so)(n):t++<10?r.detectingSelectAll=setTimeout(o,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(o,200)}}},Wa.prototype.readOnlyChanged=function(t){t||this.reset(),this.textarea.disabled="nocursor"==t,this.textarea.readOnly=!!t},Wa.prototype.setUneditable=function(){},Wa.prototype.needsContentAttribute=!1,function(t){var e=t.optionHandlers;function n(n,r,i,o){t.defaults[n]=r,i&&(e[n]=o?function(t,e,n){n!=Sa&&i(t,e,n)}:i)}t.defineOption=n,t.Init=Sa,n("value","",(function(t,e){return t.setValue(e)}),!0),n("mode",null,(function(t,e){t.doc.modeOption=e,Di(t)}),!0),n("indentUnit",2,Di,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,(function(t){Ri(t),Un(t),hr(t)}),!0),n("lineSeparator",null,(function(t,e){if(t.doc.lineSep=e,e){var n=[],r=t.doc.first;t.doc.iter((function(t){for(var i=0;;){var o=t.text.indexOf(e,i);if(-1==o)break;i=o+e.length,n.push(te(r,o))}r++}));for(var i=n.length-1;i>=0;i--)go(t.doc,e,n[i],te(n[i].line,n[i].ch+e.length))}})),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,(function(t,e,n){t.state.specialChars=new RegExp(e.source+(e.test("\t")?"":"|\t"),"g"),n!=Sa&&t.refresh()})),n("specialCharPlaceholder",Je,(function(t){return t.refresh()}),!0),n("electricChars",!0),n("inputStyle",v?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),n("spellcheck",!1,(function(t,e){return t.getInputField().spellcheck=e}),!0),n("autocorrect",!1,(function(t,e){return t.getInputField().autocorrect=e}),!0),n("autocapitalize",!1,(function(t,e){return t.getInputField().autocapitalize=e}),!0),n("rtlMoveVisually",!x),n("wholeLineUpdateBefore",!0),n("theme","default",(function(t){Ca(t),gi(t)}),!0),n("keyMap","default",(function(t,e,n){var r=$o(e),i=n!=Sa&&$o(n);i&&i.detach&&i.detach(t,r),r.attach&&r.attach(t,i||null)})),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Ta,!0),n("gutters",[],(function(t,e){t.display.gutterSpecs=fi(e,t.options.lineNumbers),gi(t)}),!0),n("fixedGutter",!0,(function(t,e){t.display.gutters.style.left=e?ar(t.display)+"px":"0",t.refresh()}),!0),n("coverGutterNextToScrollbar",!1,(function(t){return Hr(t)}),!0),n("scrollbarStyle","native",(function(t){Vr(t),Hr(t),t.display.scrollbars.setScrollTop(t.doc.scrollTop),t.display.scrollbars.setScrollLeft(t.doc.scrollLeft)}),!0),n("lineNumbers",!1,(function(t,e){t.display.gutterSpecs=fi(t.options.gutters,e),gi(t)}),!0),n("firstLineNumber",1,gi,!0),n("lineNumberFormatter",(function(t){return t}),gi,!0),n("showCursorWhenSelecting",!1,mr,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,(function(t,e){"nocursor"==e&&(wr(t),t.display.input.blur()),t.display.input.readOnlyChanged(e)})),n("screenReaderLabel",null,(function(t,e){e=""===e?null:e,t.display.input.screenReaderLabelChanged(e)})),n("disableInput",!1,(function(t,e){e||t.display.input.reset()}),!0),n("dragDrop",!0,wa),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,mr,!0),n("singleCursorHeightPerLine",!0,mr,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Ri,!0),n("addModeClass",!1,Ri,!0),n("pollInterval",100),n("undoDepth",200,(function(t,e){return t.doc.history.undoDepth=e})),n("historyEventDelay",1250),n("viewportMargin",10,(function(t){return t.refresh()}),!0),n("maxHighlightLength",1e4,Ri,!0),n("moveInputWithCursor",!0,(function(t,e){e||t.display.input.resetPosition()})),n("tabindex",null,(function(t,e){return t.display.input.getField().tabIndex=e||""})),n("autofocus",null),n("direction","ltr",(function(t,e){return t.doc.setDirection(e)}),!0),n("phrases",null)}(Oa),function(t){var e=t.optionHandlers,n=t.helpers={};t.prototype={constructor:t,focus:function(){window.focus(),this.display.input.focus()},setOption:function(t,n){var r=this.options,i=r[t];r[t]==n&&"mode"!=t||(r[t]=n,e.hasOwnProperty(t)&&ti(this,e[t])(this,n,i),pt(this,"optionChange",this,t))},getOption:function(t){return this.options[t]},getDoc:function(){return this.doc},addKeyMap:function(t,e){this.state.keyMaps[e?"push":"unshift"]($o(t))},removeKeyMap:function(t){for(var e=this.state.keyMaps,n=0;n<e.length;++n)if(e[n]==t||e[n].name==t)return e.splice(n,1),!0},addOverlay:ei((function(e,n){var r=e.token?e:t.getMode(this.options,e);if(r.startState)throw new Error("Overlays may not be stateful.");!function(t,e,n){for(var r=0,i=n(e);r<t.length&&n(t[r])<=i;)r++;t.splice(r,0,e)}(this.state.overlays,{mode:r,modeSpec:e,opaque:n&&n.opaque,priority:n&&n.priority||0},(function(t){return t.priority})),this.state.modeGen++,hr(this)})),removeOverlay:ei((function(t){for(var e=this.state.overlays,n=0;n<e.length;++n){var r=e[n].modeSpec;if(r==t||"string"==typeof t&&r.name==t)return e.splice(n,1),this.state.modeGen++,void hr(this)}})),indentLine:ei((function(t,e,n){"string"!=typeof e&&"number"!=typeof e&&(e=null==e?this.options.smartIndent?"smart":"prev":e?"add":"subtract"),Jt(this.doc,t)&&Aa(this,t,e,n)})),indentSelection:ei((function(t){for(var e=this.doc.sel.ranges,n=-1,r=0;r<e.length;r++){var i=e[r];if(i.empty())i.head.line>n&&(Aa(this,i.head.line,t,!0),n=i.head.line,r==this.doc.sel.primIndex&&Rr(this));else{var o=i.from(),a=i.to(),s=Math.max(n,o.line);n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var l=s;l<n;++l)Aa(this,l,t);var c=this.doc.sel.ranges;0==o.ch&&e.length==c.length&&c[r].from().ch>0&&$i(this.doc,r,new Ei(o,c[r].to()),z)}}})),getTokenAt:function(t,e){return ye(this,t,e)},getLineTokens:function(t,e){return ye(this,te(t),e,!0)},getTokenTypeAt:function(t){t=se(this.doc,t);var e,n=de(this,Kt(this.doc,t.line)),r=0,i=(n.length-1)/2,o=t.ch;if(0==o)e=n[2];else for(;;){var a=r+i>>1;if((a?n[2*a-1]:0)>=o)i=a;else{if(!(n[2*a+1]<o)){e=n[2*a+2];break}r=a+1}}var s=e?e.indexOf("overlay "):-1;return s<0?e:0==s?null:e.slice(0,s-1)},getModeAt:function(e){var n=this.doc.mode;return n.innerMode?t.innerMode(n,this.getTokenAt(e).state).mode:n},getHelper:function(t,e){return this.getHelpers(t,e)[0]},getHelpers:function(t,e){var r=[];if(!n.hasOwnProperty(e))return r;var i=n[e],o=this.getModeAt(t);if("string"==typeof o[e])i[o[e]]&&r.push(i[o[e]]);else if(o[e])for(var a=0;a<o[e].length;a++){var s=i[o[e][a]];s&&r.push(s)}else o.helperType&&i[o.helperType]?r.push(i[o.helperType]):i[o.name]&&r.push(i[o.name]);for(var l=0;l<i._global.length;l++){var c=i._global[l];c.pred(o,this)&&-1==U(r,c.val)&&r.push(c.val)}return r},getStateAfter:function(t,e){var n=this.doc;return fe(this,(t=ae(n,null==t?n.first+n.size-1:t))+1,e).state},cursorCoords:function(t,e){var n=this.doc.sel.primary();return qn(this,null==t?n.head:"object"==typeof t?se(this.doc,t):t?n.from():n.to(),e||"page")},charCoords:function(t,e){return Kn(this,se(this.doc,t),e||"page")},coordsChar:function(t,e){return $n(this,(t=Wn(this,t,e||"page")).left,t.top)},lineAtHeight:function(t,e){return t=Wn(this,{top:t,left:0},e||"page").top,Zt(this.doc,t+this.display.viewOffset)},heightAtLine:function(t,e,n){var r,i=!1;if("number"==typeof t){var o=this.doc.first+this.doc.size-1;t<this.doc.first?t=this.doc.first:t>o&&(t=o,i=!0),r=Kt(this.doc,t)}else r=t;return Vn(this,r,{top:0,left:0},e||"page",n||i).top+(i?this.doc.height-Ge(r):0)},defaultTextHeight:function(){return rr(this.display)},defaultCharWidth:function(){return ir(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(t,e,n,r,i){var o,a,s,l=this.display,c=(t=qn(this,se(this.doc,t))).bottom,u=t.left;if(e.style.position="absolute",e.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(e),l.sizer.appendChild(e),"over"==r)c=t.top;else if("above"==r||"near"==r){var h=Math.max(l.wrapper.clientHeight,this.doc.height),d=Math.max(l.sizer.clientWidth,l.lineSpace.clientWidth);("above"==r||t.bottom+e.offsetHeight>h)&&t.top>e.offsetHeight?c=t.top-e.offsetHeight:t.bottom+e.offsetHeight<=h&&(c=t.bottom),u+e.offsetWidth>d&&(u=d-e.offsetWidth)}e.style.top=c+"px",e.style.left=e.style.right="","right"==i?(u=l.sizer.clientWidth-e.offsetWidth,e.style.right="0px"):("left"==i?u=0:"middle"==i&&(u=(l.sizer.clientWidth-e.offsetWidth)/2),e.style.left=u+"px"),n&&(o=this,a={left:u,top:c,right:u+e.offsetWidth,bottom:c+e.offsetHeight},null!=(s=Ar(o,a)).scrollTop&&Pr(o,s.scrollTop),null!=s.scrollLeft&&jr(o,s.scrollLeft))},triggerOnKeyDown:ei(ua),triggerOnKeyPress:ei(da),triggerOnKeyUp:ha,triggerOnMouseDown:ei(ma),execCommand:function(t){if(ea.hasOwnProperty(t))return ea[t].call(null,this)},triggerElectric:ei((function(t){_a(this,t)})),findPosH:function(t,e,n,r){var i=1;e<0&&(i=-1,e=-e);for(var o=se(this.doc,t),a=0;a<e&&!(o=Fa(this.doc,o,i,n,r)).hitSide;++a);return o},moveH:ei((function(t,e){var n=this;this.extendSelectionsBy((function(r){return n.display.shift||n.doc.extend||r.empty()?Fa(n.doc,r.head,t,e,n.options.rtlMoveVisually):t<0?r.from():r.to()}),V)})),deleteH:ei((function(t,e){var n=this.doc.sel,r=this.doc;n.somethingSelected()?r.replaceSelection("",null,"+delete"):Zo(this,(function(n){var i=Fa(r,n.head,t,e,!1);return t<0?{from:i,to:n.head}:{from:n.head,to:i}}))})),findPosV:function(t,e,n,r){var i=1,o=r;e<0&&(i=-1,e=-e);for(var a=se(this.doc,t),s=0;s<e;++s){var l=qn(this,a,"div");if(null==o?o=l.left:l.left=o,(a=Ba(this,l,i,n)).hitSide)break}return a},moveV:ei((function(t,e){var n=this,r=this.doc,i=[],o=!this.display.shift&&!r.extend&&r.sel.somethingSelected();if(r.extendSelectionsBy((function(a){if(o)return t<0?a.from():a.to();var s=qn(n,a.head,"div");null!=a.goalColumn&&(s.left=a.goalColumn),i.push(s.left);var l=Ba(n,s,t,e);return"page"==e&&a==r.sel.primary()&&Dr(n,Kn(n,l,"div").top-s.top),l}),V),i.length)for(var a=0;a<r.sel.ranges.length;a++)r.sel.ranges[a].goalColumn=i[a]})),findWordAt:function(t){var e=Kt(this.doc,t.line).text,n=t.ch,r=t.ch;if(e){var i=this.getHelper(t,"wordChars");"before"!=t.sticky&&r!=e.length||!n?++r:--n;for(var o=e.charAt(n),a=tt(o,i)?function(t){return tt(t,i)}:/\s/.test(o)?function(t){return/\s/.test(t)}:function(t){return!/\s/.test(t)&&!tt(t)};n>0&&a(e.charAt(n-1));)--n;for(;r<e.length&&a(e.charAt(r));)++r}return new Ei(te(t.line,n),te(t.line,r))},toggleOverwrite:function(t){null!=t&&t==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?I(this.display.cursorDiv,"CodeMirror-overwrite"):T(this.display.cursorDiv,"CodeMirror-overwrite"),pt(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==M()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:ei((function(t,e){Mr(this,t,e)})),getScrollInfo:function(){var t=this.display.scroller;return{left:t.scrollLeft,top:t.scrollTop,height:t.scrollHeight-Tn(this)-this.display.barHeight,width:t.scrollWidth-Tn(this)-this.display.barWidth,clientHeight:Ln(this),clientWidth:On(this)}},scrollIntoView:ei((function(t,e){null==t?(t={from:this.doc.sel.primary().head,to:null},null==e&&(e=this.options.cursorScrollMargin)):"number"==typeof t?t={from:te(t,0),to:null}:null==t.from&&(t={from:t,to:null}),t.to||(t.to=t.from),t.margin=e||0,null!=t.from.line?function(t,e){Ir(t),t.curOp.scrollToPos=e}(this,t):_r(this,t.from,t.to,t.margin)})),setSize:ei((function(t,e){var n=this,r=function(t){return"number"==typeof t||/^\d+$/.test(String(t))?t+"px":t};null!=t&&(this.display.wrapper.style.width=r(t)),null!=e&&(this.display.wrapper.style.height=r(e)),this.options.lineWrapping&&Bn(this);var i=this.display.viewFrom;this.doc.iter(i,this.display.viewTo,(function(t){if(t.widgets)for(var e=0;e<t.widgets.length;e++)if(t.widgets[e].noHScroll){dr(n,i,"widget");break}++i})),this.curOp.forceUpdate=!0,pt(this,"refresh",this)})),operation:function(t){return Qr(this,t)},startOperation:function(){return Kr(this)},endOperation:function(){return qr(this)},refresh:ei((function(){var t=this.display.cachedTextHeight;hr(this),this.curOp.forceUpdate=!0,Un(this),Mr(this,this.doc.scrollLeft,this.doc.scrollTop),ci(this.display),(null==t||Math.abs(t-rr(this.display))>.5||this.options.lineWrapping)&&lr(this),pt(this,"refresh",this)})),swapDoc:ei((function(t){var e=this.doc;return e.cm=null,this.state.selectingText&&this.state.selectingText(),Pi(this,t),Un(this),this.display.input.reset(),Mr(this,t.scrollLeft,t.scrollTop),this.curOp.forceScroll=!0,ln(this,"swapDoc",this,e),e})),phrase:function(t){var e=this.options.phrases;return e&&Object.prototype.hasOwnProperty.call(e,t)?e[t]:t},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}},yt(t),t.registerHelper=function(e,r,i){n.hasOwnProperty(e)||(n[e]=t[e]={_global:[]}),n[e][r]=i},t.registerGlobalHelper=function(e,r,i,o){t.registerHelper(e,r,o),n[e]._global.push({pred:i,val:o})}}(Oa);var Ka="iter insert remove copy getEditor constructor".split(" ");for(var qa in Ro.prototype)Ro.prototype.hasOwnProperty(qa)&&U(Ka,qa)<0&&(Oa.prototype[qa]=function(t){return function(){return t.apply(this.doc,arguments)}}(Ro.prototype[qa]));return yt(Ro),Oa.inputStyles={textarea:Wa,contenteditable:Ua},Oa.defineMode=function(t){Oa.defaults.mode||"null"==t||(Oa.defaults.mode=t),jt.apply(this,arguments)},Oa.defineMIME=function(t,e){Nt[t]=e},Oa.defineMode("null",(function(){return{token:function(t){return t.skipToEnd()}}})),Oa.defineMIME("text/plain","null"),Oa.defineExtension=function(t,e){Oa.prototype[t]=e},Oa.defineDocExtension=function(t,e){Ro.prototype[t]=e},Oa.fromTextArea=function(t,e){if((e=e?j(e):{}).value=t.value,!e.tabindex&&t.tabIndex&&(e.tabindex=t.tabIndex),!e.placeholder&&t.placeholder&&(e.placeholder=t.placeholder),null==e.autofocus){var n=M();e.autofocus=n==t||null!=t.getAttribute("autofocus")&&n==document.body}function r(){t.value=s.getValue()}var i;if(t.form&&(ht(t.form,"submit",r),!e.leaveSubmitMethodAlone)){var o=t.form;i=o.submit;try{var a=o.submit=function(){r(),o.submit=i,o.submit(),o.submit=a}}catch(t){}}e.finishInit=function(n){n.save=r,n.getTextArea=function(){return t},n.toTextArea=function(){n.toTextArea=isNaN,r(),t.parentNode.removeChild(n.getWrapperElement()),t.style.display="",t.form&&(ft(t.form,"submit",r),e.leaveSubmitMethodAlone||"function"!=typeof t.form.submit||(t.form.submit=i))}},t.style.display="none";var s=Oa((function(e){return t.parentNode.insertBefore(e,t.nextSibling)}),e);return s},function(t){t.off=ft,t.on=ht,t.wheelEventPixels=xi,t.Doc=Ro,t.splitLines=Rt,t.countColumn=F,t.findColumn=W,t.isWordChar=Q,t.Pass=H,t.signal=pt,t.Line=Ke,t.changeEnd=Ti,t.scrollbarModel=Gr,t.Pos=te,t.cmpPos=ee,t.modes=Pt,t.mimeModes=Nt,t.resolveMode=Ft,t.getMode=Bt,t.modeExtensions=Ut,t.extendMode=Ht,t.copyState=zt,t.startState=Vt,t.innerMode=Gt,t.commands=ea,t.keyMap=Go,t.keyName=Xo,t.isModifierKey=qo,t.lookupKey=Ko,t.normalizeKeyMap=Wo,t.StringStream=Wt,t.SharedTextMarker=Oo,t.TextMarker=wo,t.LineWidget=So,t.e_preventDefault=bt,t.e_stopPropagation=xt,t.e_stop=St,t.addClass=I,t.contains=R,t.rmClass=T,t.keyNames=Bo}(Oa),Oa.version="5.58.2",Oa}()},WaYH:
/*!*********************************************************!*\
!*** ./node_modules/rc-tree/es/TreeNode.js + 1 modules ***!
\*********************************************************/
/*! exports provided: InternalTreeNode, default */
/*! exports used: default */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createClass.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createSuper.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/defineProperty.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/inherits.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-tree/es/contextTypes.js because of ./node_modules/rc-tree/es/Tree.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-tree/es/util.js because of ./node_modules/antd/es/table/hooks/useSelection.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-tree/es/utils/treeUtil.js because of ./node_modules/antd/es/table/hooks/useSelection.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */function(t,e,n){"use strict";var r=n("rePB"),i=n("Ff2n"),o=n("VTBJ"),a=n("1OyB"),s=n("vuIU"),l=n("JX7q"),c=n("Ji7U"),u=n("LK+K"),h=n("q1tI"),d=n("TSYQ"),f=n.n(d),p=n("sboe"),g=n("OZM5"),m=function(t){var e=t.prefixCls,n=t.level,i=t.isStart,o=t.isEnd;if(!n)return null;for(var a="".concat(e,"-indent-unit"),s=[],l=0;l<n;l+=1){var c;s.push(h.createElement("span",{key:l,className:f()(a,(c={},Object(r.a)(c,"".concat(a,"-start"),i[l+1]),Object(r.a)(c,"".concat(a,"-end"),o[l+1]),Object(r.a)(c,"".concat(a,"-end-first-level"),!l&&o[0]),c))}))}return h.createElement("span",{"aria-hidden":"true",className:"".concat(e,"-indent")},s)},v=n("815F"),y=function(t){Object(c.a)(n,t);var e=Object(u.a)(n);function n(){var t;return Object(a.a)(this,n),(t=e.apply(this,arguments)).state={dragNodeHighlight:!1},t.onSelectorClick=function(e){(0,t.props.context.onNodeClick)(e,Object(v.b)(t.props)),t.isSelectable()?t.onSelect(e):t.onCheck(e)},t.onSelectorDoubleClick=function(e){(0,t.props.context.onNodeDoubleClick)(e,Object(v.b)(t.props))},t.onSelect=function(e){if(!t.isDisabled()){var n=t.props.context.onNodeSelect;e.preventDefault(),n(e,Object(v.b)(t.props))}},t.onCheck=function(e){if(!t.isDisabled()){var n=t.props,r=n.disableCheckbox,i=n.checked,o=t.props.context.onNodeCheck;if(t.isCheckable()&&!r){e.preventDefault();var a=!i;o(e,Object(v.b)(t.props),a)}}},t.onMouseEnter=function(e){(0,t.props.context.onNodeMouseEnter)(e,Object(v.b)(t.props))},t.onMouseLeave=function(e){(0,t.props.context.onNodeMouseLeave)(e,Object(v.b)(t.props))},t.onContextMenu=function(e){(0,t.props.context.onNodeContextMenu)(e,Object(v.b)(t.props))},t.onDragStart=function(e){var n=t.props.context.onNodeDragStart;e.stopPropagation(),t.setState({dragNodeHighlight:!0}),n(e,Object(l.a)(t));try{e.dataTransfer.setData("text/plain","")}catch(t){}},t.onDragEnter=function(e){var n=t.props.context.onNodeDragEnter;e.preventDefault(),e.stopPropagation(),n(e,Object(l.a)(t))},t.onDragOver=function(e){var n=t.props.context.onNodeDragOver;e.preventDefault(),e.stopPropagation(),n(e,Object(l.a)(t))},t.onDragLeave=function(e){var n=t.props.context.onNodeDragLeave;e.stopPropagation(),n(e,Object(l.a)(t))},t.onDragEnd=function(e){var n=t.props.context.onNodeDragEnd;e.stopPropagation(),t.setState({dragNodeHighlight:!1}),n(e,Object(l.a)(t))},t.onDrop=function(e){var n=t.props.context.onNodeDrop;e.preventDefault(),e.stopPropagation(),t.setState({dragNodeHighlight:!1}),n(e,Object(l.a)(t))},t.onExpand=function(e){(0,t.props.context.onNodeExpand)(e,Object(v.b)(t.props))},t.setSelectHandle=function(e){t.selectHandle=e},t.getNodeState=function(){var e=t.props.expanded;return t.isLeaf()?null:e?"open":"close"},t.hasChildren=function(){var e=t.props.eventKey;return!!((t.props.context.keyEntities[e]||{}).children||[]).length},t.isLeaf=function(){var e=t.props,n=e.isLeaf,r=e.loaded,i=t.props.context.loadData,o=t.hasChildren();return!1!==n&&(n||!i&&!o||i&&r&&!o)},t.isDisabled=function(){var e=t.props.disabled;return!(!t.props.context.disabled&&!e)},t.isCheckable=function(){var e=t.props.checkable,n=t.props.context.checkable;return!(!n||!1===e)&&n},t.syncLoadData=function(e){var n=e.expanded,r=e.loading,i=e.loaded,o=t.props.context,a=o.loadData,s=o.onNodeLoad;r||a&&n&&!t.isLeaf()&&(t.hasChildren()||i||s(Object(v.b)(t.props)))},t.renderSwitcher=function(){var e=t.props,n=e.expanded,r=e.switcherIcon,i=t.props.context,a=i.prefixCls,s=i.switcherIcon,l=r||s;if(t.isLeaf())return h.createElement("span",{className:f()("".concat(a,"-switcher"),"".concat(a,"-switcher-noop"))},"function"==typeof l?l(Object(o.a)(Object(o.a)({},t.props),{},{isLeaf:!0})):l);var c=f()("".concat(a,"-switcher"),"".concat(a,"-switcher_").concat(n?"open":"close"));return h.createElement("span",{onClick:t.onExpand,className:c},"function"==typeof l?l(Object(o.a)(Object(o.a)({},t.props),{},{isLeaf:!1})):l)},t.renderCheckbox=function(){var e=t.props,n=e.checked,r=e.halfChecked,i=e.disableCheckbox,o=t.props.context.prefixCls,a=t.isDisabled(),s=t.isCheckable();if(!s)return null;var l="boolean"!=typeof s?s:null;return h.createElement("span",{className:f()("".concat(o,"-checkbox"),n&&"".concat(o,"-checkbox-checked"),!n&&r&&"".concat(o,"-checkbox-indeterminate"),(a||i)&&"".concat(o,"-checkbox-disabled")),onClick:t.onCheck},l)},t.renderIcon=function(){var e=t.props.loading,n=t.props.context.prefixCls;return h.createElement("span",{className:f()("".concat(n,"-iconEle"),"".concat(n,"-icon__").concat(t.getNodeState()||"docu"),e&&"".concat(n,"-icon_loading"))})},t.renderSelector=function(){var e,n,r=t.state.dragNodeHighlight,i=t.props,o=i.title,a=i.selected,s=i.icon,l=i.loading,c=i.data,u=t.props.context,d=u.prefixCls,p=u.showIcon,g=u.icon,m=u.draggable,v=u.loadData,y=u.titleRender,b=t.isDisabled(),x="".concat(d,"-node-content-wrapper");if(p){var C=s||g;e=C?h.createElement("span",{className:f()("".concat(d,"-iconEle"),"".concat(d,"-icon__customize"))},"function"==typeof C?C(t.props):C):t.renderIcon()}else v&&l&&(e=t.renderIcon());n="function"==typeof o?o(c):y?y(c):o;var S=h.createElement("span",{className:"".concat(d,"-title")},n);return h.createElement("span",{ref:t.setSelectHandle,title:"string"==typeof o?o:"",className:f()("".concat(x),"".concat(x,"-").concat(t.getNodeState()||"normal"),!b&&(a||r)&&"".concat(d,"-node-selected"),!b&&m&&"draggable"),draggable:!b&&m||void 0,"aria-grabbed":!b&&m||void 0,onMouseEnter:t.onMouseEnter,onMouseLeave:t.onMouseLeave,onContextMenu:t.onContextMenu,onClick:t.onSelectorClick,onDoubleClick:t.onSelectorDoubleClick,onDragStart:m?t.onDragStart:void 0},e,S)},t}return Object(s.a)(n,[{key:"componentDidMount",value:function(){this.syncLoadData(this.props)}},{key:"componentDidUpdate",value:function(){this.syncLoadData(this.props)}},{key:"isSelectable",value:function(){var t=this.props.selectable,e=this.props.context.selectable;return"boolean"==typeof t?t:e}},{key:"render",value:function(){var t,e=this.props,n=e.eventKey,o=e.className,a=e.style,s=e.dragOver,l=e.dragOverGapTop,c=e.dragOverGapBottom,u=e.isLeaf,d=e.isStart,p=e.isEnd,y=e.expanded,b=e.selected,x=e.checked,C=e.halfChecked,S=e.loading,E=e.domRef,k=e.active,w=e.onMouseMove,T=Object(i.a)(e,["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","onMouseMove"]),O=this.props.context,L=O.prefixCls,A=O.filterTreeNode,D=O.draggable,R=O.keyEntities,M=this.isDisabled(),I=Object(g.f)(T),_=(R[n]||{}).level,P=p[p.length-1];return h.createElement("div",Object.assign({ref:E,className:f()(o,"".concat(L,"-treenode"),(t={},Object(r.a)(t,"".concat(L,"-treenode-disabled"),M),Object(r.a)(t,"".concat(L,"-treenode-switcher-").concat(y?"open":"close"),!u),Object(r.a)(t,"".concat(L,"-treenode-checkbox-checked"),x),Object(r.a)(t,"".concat(L,"-treenode-checkbox-indeterminate"),C),Object(r.a)(t,"".concat(L,"-treenode-selected"),b),Object(r.a)(t,"".concat(L,"-treenode-loading"),S),Object(r.a)(t,"".concat(L,"-treenode-active"),k),Object(r.a)(t,"".concat(L,"-treenode-leaf-last"),P),Object(r.a)(t,"drag-over",!M&&s),Object(r.a)(t,"drag-over-gap-top",!M&&l),Object(r.a)(t,"drag-over-gap-bottom",!M&&c),Object(r.a)(t,"filter-node",A&&A(Object(v.b)(this.props))),t)),style:a,onDragEnter:D?this.onDragEnter:void 0,onDragOver:D?this.onDragOver:void 0,onDragLeave:D?this.onDragLeave:void 0,onDrop:D?this.onDrop:void 0,onDragEnd:D?this.onDragEnd:void 0,onMouseMove:w},I),h.createElement(m,{prefixCls:L,level:_,isStart:d,isEnd:p}),this.renderSwitcher(),this.renderCheckbox(),this.renderSelector())}}]),n}(h.Component),b=function(t){return h.createElement(p.a.Consumer,null,(function(e){return h.createElement(y,Object.assign({},t,{context:e}))}))};b.displayName="TreeNode",b.defaultProps={title:"---"},b.isTreeNode=1;e.a=b},Y1PL:
/*!**********************************************************!*\
!*** ./node_modules/rc-textarea/es/index.js + 7 modules ***!
\**********************************************************/
/*! exports provided: ResizableTextArea, default */
/*! all exports used */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createClass.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createSuper.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/defineProperty.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/extends.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/inherits.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Children/toArray.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Dom/findDOMNode.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/omit.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/ref.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/warning.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js (<- Module uses injected variables (global)) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/shallowequal/index.js (<- Module is not an ECMAScript module) */function(t,e,n){"use strict";n.r(e),n.d(e,"ResizableTextArea",(function(){return I}));var r=n("wx14"),i=n("1OyB"),o=n("vuIU"),a=n("Ji7U"),s=n("LK+K"),l=n("q1tI"),c=n("VTBJ"),u=n("rePB"),h=n("Zm9Q"),d=(n("Kwbf"),n("c+Xe")),f=n("m+aA"),p=n("bdgK"),g=new Map;var m=new p.default((function(t){t.forEach((function(t){var e,n=t.target;null===(e=g.get(n))||void 0===e||e.forEach((function(t){return t(n)}))}))}));var v=function(t){Object(a.a)(n,t);var e=Object(s.a)(n);function n(){return Object(i.a)(this,n),e.apply(this,arguments)}return Object(o.a)(n,[{key:"render",value:function(){return this.props.children}}]),n}(l.Component),y=l.createContext(null);function b(t){var e=t.children,n=t.disabled,r=l.useRef(null),i=l.useRef(null),o=l.useContext(y),a=l.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),s=l.isValidElement(e)&&Object(d.c)(e),u=s?e.ref:null,h=l.useMemo((function(){return Object(d.a)(u,r)}),[u,r]),p=l.useRef(t);p.current=t;var b=l.useCallback((function(t){var e=p.current,n=e.onResize,r=e.data,i=t.getBoundingClientRect(),s=i.width,l=i.height,u=t.offsetWidth,h=t.offsetHeight,d=Math.floor(s),f=Math.floor(l);if(a.current.width!==d||a.current.height!==f||a.current.offsetWidth!==u||a.current.offsetHeight!==h){var g={width:d,height:f,offsetWidth:u,offsetHeight:h};a.current=g;var m=u===Math.round(s)?s:u,v=h===Math.round(l)?l:h,y=Object(c.a)(Object(c.a)({},g),{},{offsetWidth:m,offsetHeight:v});null==o||o(y,t,r),n&&Promise.resolve().then((function(){n(y,t)}))}}),[]);return l.useEffect((function(){var t,e,o=Object(f.a)(r.current)||Object(f.a)(i.current);return o&&!n&&(t=o,e=b,g.has(t)||(g.set(t,new Set),m.observe(t)),g.get(t).add(e)),function(){return function(t,e){g.has(t)&&(g.get(t).delete(e),g.get(t).size||(m.unobserve(t),g.delete(t)))}(o,b)}}),[r.current,n]),l.createElement(v,{ref:i},s?l.cloneElement(e,{ref:h}):e)}function x(t){var e=t.children;return Object(h.a)(e).map((function(e,n){var i=(null==e?void 0:e.key)||"".concat("rc-observer-key","-").concat(n);return l.createElement(b,Object(r.a)({},t,{key:i}),e)}))}x.Collection=function(t){var e=t.children,n=t.onBatchResize,r=l.useRef(0),i=l.useRef([]),o=l.useContext(y),a=l.useCallback((function(t,e,a){r.current+=1;var s=r.current;i.current.push({size:t,element:e,data:a}),Promise.resolve().then((function(){s===r.current&&(null==n||n(i.current),i.current=[])})),null==o||o(t,e,a)}),[n,o]);return l.createElement(y.Provider,{value:a},e)};var C,S=x,E=n("bT9E"),k=n("TSYQ"),w=n.n(k),T="\n min-height:0 !important;\n max-height:none !important;\n height:0 !important;\n visibility:hidden !important;\n overflow:hidden !important;\n position:absolute !important;\n z-index:-1000 !important;\n top:0 !important;\n right:0 !important\n",O=["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"],L={};function A(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.getAttribute("id")||t.getAttribute("data-reactid")||t.getAttribute("name");if(e&&L[n])return L[n];var r=window.getComputedStyle(t),i=r.getPropertyValue("box-sizing")||r.getPropertyValue("-moz-box-sizing")||r.getPropertyValue("-webkit-box-sizing"),o=parseFloat(r.getPropertyValue("padding-bottom"))+parseFloat(r.getPropertyValue("padding-top")),a=parseFloat(r.getPropertyValue("border-bottom-width"))+parseFloat(r.getPropertyValue("border-top-width")),s=O.map((function(t){return"".concat(t,":").concat(r.getPropertyValue(t))})).join(";"),l={sizingStyle:s,paddingSize:o,borderSize:a,boxSizing:i};return e&&n&&(L[n]=l),l}var D,R=n("Gytx"),M=n.n(R);!function(t){t[t.NONE=0]="NONE",t[t.RESIZING=1]="RESIZING",t[t.RESIZED=2]="RESIZED"}(D||(D={}));var I=function(t){Object(a.a)(n,t);var e=Object(s.a)(n);function n(t){var o;return Object(i.a)(this,n),(o=e.call(this,t)).nextFrameActionId=void 0,o.resizeFrameId=void 0,o.textArea=void 0,o.saveTextArea=function(t){o.textArea=t},o.handleResize=function(t){var e=o.state.resizeStatus,n=o.props,r=n.autoSize,i=n.onResize;e===D.NONE&&("function"==typeof i&&i(t),r&&o.resizeOnNextFrame())},o.resizeOnNextFrame=function(){cancelAnimationFrame(o.nextFrameActionId),o.nextFrameActionId=requestAnimationFrame(o.resizeTextarea)},o.resizeTextarea=function(){var t=o.props.autoSize;if(t&&o.textArea){var e=t.minRows,n=t.maxRows,r=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;C||((C=document.createElement("textarea")).setAttribute("tab-index","-1"),C.setAttribute("aria-hidden","true"),document.body.appendChild(C)),t.getAttribute("wrap")?C.setAttribute("wrap",t.getAttribute("wrap")):C.removeAttribute("wrap");var i=A(t,e),o=i.paddingSize,a=i.borderSize,s=i.boxSizing,l=i.sizingStyle;C.setAttribute("style","".concat(l,";").concat(T)),C.value=t.value||t.placeholder||"";var c,u=Number.MIN_SAFE_INTEGER,h=Number.MAX_SAFE_INTEGER,d=C.scrollHeight;if("border-box"===s?d+=a:"content-box"===s&&(d-=o),null!==n||null!==r){C.value=" ";var f=C.scrollHeight-o;null!==n&&(u=f*n,"border-box"===s&&(u=u+o+a),d=Math.max(u,d)),null!==r&&(h=f*r,"border-box"===s&&(h=h+o+a),c=d>h?"":"hidden",d=Math.min(h,d))}return{height:d,minHeight:u,maxHeight:h,overflowY:c,resize:"none"}}(o.textArea,!1,e,n);o.setState({textareaStyles:r,resizeStatus:D.RESIZING},(function(){cancelAnimationFrame(o.resizeFrameId),o.resizeFrameId=requestAnimationFrame((function(){o.setState({resizeStatus:D.RESIZED},(function(){o.resizeFrameId=requestAnimationFrame((function(){o.setState({resizeStatus:D.NONE}),o.fixFirefoxAutoScroll()}))}))}))}))}},o.renderTextArea=function(){var t=o.props,e=t.prefixCls,n=void 0===e?"rc-textarea":e,i=t.autoSize,a=t.onResize,s=t.className,h=t.disabled,d=o.state,f=d.textareaStyles,p=d.resizeStatus,g=Object(E.a)(o.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),m=w()(n,s,Object(u.a)({},"".concat(n,"-disabled"),h));"value"in g&&(g.value=g.value||"");var v=Object(c.a)(Object(c.a)(Object(c.a)({},o.props.style),f),p===D.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return l.createElement(S,{onResize:o.handleResize,disabled:!(i||a)},l.createElement("textarea",Object(r.a)({},g,{className:m,style:v,ref:o.saveTextArea})))},o.state={textareaStyles:{},resizeStatus:D.NONE},o}return Object(o.a)(n,[{key:"componentDidUpdate",value:function(t){t.value===this.props.value&&M()(t.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 t=this.textArea.selectionStart,e=this.textArea.selectionEnd;this.textArea.setSelectionRange(t,e)}}catch(t){}}},{key:"render",value:function(){return this.renderTextArea()}}]),n}(l.Component),_=function(t){Object(a.a)(n,t);var e=Object(s.a)(n);function n(t){var r;Object(i.a)(this,n),(r=e.call(this,t)).resizableTextArea=void 0,r.focus=function(){r.resizableTextArea.textArea.focus()},r.saveTextArea=function(t){r.resizableTextArea=t},r.handleChange=function(t){var e=r.props.onChange;r.setValue(t.target.value,(function(){r.resizableTextArea.resizeTextarea()})),e&&e(t)},r.handleKeyDown=function(t){var e=r.props,n=e.onPressEnter,i=e.onKeyDown;13===t.keyCode&&n&&n(t),i&&i(t)};var o=void 0===t.value||null===t.value?t.defaultValue:t.value;return r.state={value:o},r}return Object(o.a)(n,[{key:"setValue",value:function(t,e){"value"in this.props||this.setState({value:t},e)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return l.createElement(I,Object(r.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(t){return"value"in t?{value:t.value}:null}}]),n}(l.Component);e.default=_},ZW9T:
/*!************************************************************!*\
!*** ./src/components/monaco-editor/index.jsx + 1 modules ***!
\************************************************************/
/*! exports provided: getLanguageByMirrorName, default, DiffEditor */
/*! exports used: DiffEditor, default */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/message/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/message/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js (<- Module uses injected variables (global)) */function(t,e,n){"use strict";n.d(e,"a",(function(){return v}));var r=n("k1fw"),i=(n("miYZ"),n("tsqr")),o=n("rAM+"),a=n("tJVT"),s=n("PpiC"),l=n("q1tI"),c=n.n(l),u=n("bdgK");function h(t,e,n,i,o){var a=e.getWordUntilPosition(n),s={startLineNumber:n.lineNumber,endLineNumber:n.lineNumber,startColumn:a.startColumn,endColumn:a.endColumn},l=i.map((function(e){return{label:e,kind:t.languages.CompletionItemKind.Keyword,insertText:e,insertTextRules:t.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:s}}));return o.map((function(t){l.push(Object(r.a)(Object(r.a)({},t),{},{range:s}))})),l}n("LvDl");function d(t){return/^\d+$/.test(t)?"".concat(t,"px"):t}function f(){}var p={"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 g(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=t;if(Array.isArray(t)){for(var n=0;n<t.length;n++){var r=p[t[n]];if(r)return r}return e[0]}return p[e]||e}var m=null;e.b=function(t){var e=t.width,p=void 0===e?"100%":e,v=t.height,y=void 0===v?"100%":v,b=t.value,x=t.language,C=void 0===x?"javascript":x,S=t.style,E=void 0===S?{}:S,k=t.options,w=void 0===k?{}:k,T=t.overrideServices,O=void 0===T?{}:T,L=t.theme,A=void 0===L?"vs-dark":L,D=t.onEditBlur,R=t.onSave,M=t.autoHeight,I=void 0!==M&&M,_=t.forbidCopy,P=void 0!==_&&_,N=t.onChange,j=void 0===N?f:N,F=t.editorDidMount,B=void 0===F?f:F,U=t.onFocus,H=void 0===U?f:U,z=t.filename,G=void 0===z?"educoder.txt":z,V=(Object(s.a)(t,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),Object(l.useRef)()),W=Object(l.useRef)({}),K=Object(l.useRef)(),q=Object(l.useRef)(!1),Y=Object(l.useRef)(),X=Object(l.useState)(!1),$=Object(a.a)(X,2),Z=$[0],J=$[1];function Q(){i.b.warn(decodeURIComponent("该任务关卡设置了禁止复制粘贴,请手动输入代码。"))}function tt(){var t=W.current.instance;if(t){var e=t.getSelection(),n=W.current.pastePos||{},r=new m.Range(n.startLineNumber||e.endLineNumber,n.startColumn||e.endColumn,n.endLineNumber||e.endLineNumber,n.endColumn||e.endColumn);setTimeout((function(){t.executeEdits("",[{range:r,text:""}])}),300)}}function et(t){(window.navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)&&83==t.keyCode&&(t.preventDefault(),R())}Object(l.useEffect)((function(){K.current&&clearTimeout(K.current),K.current=setTimeout((function(){!function(){var t=W.current.instance;if(null!=b&&t&&Z){var e=t.getModel();e&&b!==e.getValue()&&(!0,e.setValue(b),t.layout(),!1)}}()}),500)}),[b,Z,W.current]);var nt=function(){if(I&&W.current.instance){var t=W.current.instance.getContentHeight();ut(t<y?y:t)}else ut(y)};function rt(t,e){var n,r,i=window.URL||window.webkitURL||window,o=new Blob([e]),a=document.createElementNS("http://www.w3.org/1999/xhtml","a");a.href=i.createObjectURL(o),a.download=t,n=a,(r=document.createEvent("MouseEvents")).initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),n.dispatchEvent(r)}Object(l.useEffect)((function(){nt()}),[nt]),Object(l.useEffect)((function(){V.current&&!Z&&n.e(/*! import() | monaco-editor */27).then(n.t.bind(null,/*! monaco-editor/esm/vs/editor/editor.api.js */"M/lh",7)).then((function(t){try{m=t,W.current.instance=m.editor.create(V.current,{value:b,language:g(C),theme:A,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},O);var e=W.current.instance;if(B(e,m),setTimeout((function(){nt(),W.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){rt(G||"educoder.txt",e.getValue())}})}),500),W.current.subscription=e.onDidChangeModelContent((function(t){q.current?clearTimeout(Y.current):(nt(),j(e.getValue(),t)),Y.current=setTimeout((function(){q.current=!1}),500)})),window.Monaco||function(t){var e={label:"ifelse",kind:t.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {","\t$0","} else {","\t","}"].join("\n"),insertTextRules:t.languages.CompletionItemInsertTextRule.InsertAsSnippet},n=["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"];t.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(r,i){return{suggestions:h(t,r,i,n,[e])}}});var r=["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"];t.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(e,n){var i=[{label:"print",kind:t.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join("\n"),insertTextRules:t.languages.CompletionItemInsertTextRule.InsertAsSnippet}];return{suggestions:h(t,e,n,r,i)}}});var i=["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"];t.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(n,r){var o=[e,{label:"main",kind:t.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {","\t$0","}"].join("\n"),insertTextRules:t.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:t.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join("\n"),insertTextRules:t.languages.CompletionItemInsertTextRule.InsertAsSnippet}];return{suggestions:h(t,n,r,i,o)}}})}(m),P&&(e.addCommand(m.KeyMod.CtrlCmd|m.KeyMod.Shift|m.KeyCode.KEY_V,(function(){return Q(),null})),e.addCommand(m.KeyMod.CtrlCmd|m.KeyCode.KEY_C,(function(){return Q(),null}))),window.Monaco=m,D&&e.onDidBlurEditorWidget((function(){D(e.getValue())})),H&&e.onDidFocusEditorText((function(){H(e.getValue())})),P){e.addCommand(m.KeyMod.CtrlCmd|m.KeyCode.KEY_V,(function(){return Q(),null})),e.onDidPaste((function(t){W.current.pastePos=t}));try{window.addEventListener("paste",tt)}catch(t){}}var n=function(){var t;return V.current&&(t=new u.default((function(t){var e,n=Object(o.a)(t);try{for(n.s();!(e=n.n()).done;){var r=e.value;(r.target.offsetHeight>0||r.target.offsetWidth>0)&&W.current.instance.layout()}}catch(t){n.e(t)}finally{n.f()}}))).observe(V.current),t}();return J(!0),function(){var t=W.current.instance;t.dispose();var e=t.getModel();e&&e.dispose(),W.current.subscription&&W.current.subscription.dispose(),P&&window.removeEventListener("paste",tt),n.unobserve(V.current)}}catch(t){}}))}),[]),Object(l.useEffect)((function(){if(W.current.instance&&Z)return document.addEventListener("keydown",et,!1),function(){document.removeEventListener("keydown",et)}}),[R,Z]),Object(l.useEffect)((function(){var t=W.current.instance;if(t&&Z){var e=g(C);m.editor.setModelLanguage(t.getModel(),e),console.log("language:",C,t.getModel(),e)}}),[C,Z]),Object(l.useEffect)((function(){W.current.instance&&Z&&m.editor.setTheme(A)}),[A,Z]),Object(l.useEffect)((function(){var t=W.current.instance;t&&Z&&(t.updateOptions(Object(r.a)({},w)),setTimeout((function(){t.getModel().updateOptions(Object(r.a)({},w))}),200))}),[JSON.stringify(w),Z]),Object(l.useEffect)((function(){var t=W.current.instance;t&&Z&&t.layout()}),[p,y,Z]);var it=Object(l.useState)(d(p)),ot=Object(a.a)(it,2),at=ot[0],st=(ot[1],Object(l.useState)(d(y))),lt=Object(a.a)(st,2),ct=lt[0],ut=lt[1],ht=Object(r.a)(Object(r.a)({},E),{},{width:at,height:ct});return c.a.createElement("div",{className:"my-monaco-editor",ref:V,style:ht})};function v(t){var e=t.width,i=void 0===e?"100%":e,s=t.height,h=void 0===s?"100%":s,f=t.original,p=t.modified,g=t.language,v=t.options,y=void 0===v?{}:v,b=Object(l.useRef)(),x=Object(l.useState)(null),C=Object(a.a)(x,2),S=C[0],E=C[1];Object(l.useEffect)((function(){b.current&&n.e(/*! import() | monaco-editor */27).then(n.t.bind(null,/*! monaco-editor/esm/vs/editor/editor.api.js */"M/lh",7)).then((function(t){var e=(m=t).editor.createDiffEditor(b.current,Object(r.a)(Object(r.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}));E(e);var n=function(t){var e;return b.current&&(e=new u.default((function(e){var n,r=Object(o.a)(e);try{for(r.s();!(n=r.n()).done;){var i=n.value;(i.target.offsetHeight>0||i.target.offsetWidth>0)&&t.layout()}}catch(t){r.e(t)}finally{r.f()}}))).observe(b.current),e}(e);return function(){e.dispose();var t=e.getModel();t&&t.dispose(),n.unobserve(b.current)}}))}),[]),Object(l.useEffect)((function(){S&&S.setModel({original:m.editor.createModel(f,g),modified:m.editor.createModel(p,g)})}),[f,p,g,S]);var k={width:d(i),height:d(h)};return c.a.createElement("div",{className:"my-diff-editor",ref:b,style:k})}},ZpRC:
/*!*************************************************************************!*\
!*** ./node_modules/scroll-into-view-if-needed/es/index.js + 1 modules ***!
\*************************************************************************/
/*! exports provided: default */
/*! exports used: default */function(t,e,n){"use strict";function r(t){return"object"==typeof t&&null!=t&&1===t.nodeType}function i(t,e){return(!e||"hidden"!==t)&&"visible"!==t&&"clip"!==t}function o(t,e){if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){var n=getComputedStyle(t,null);return i(n.overflowY,e)||i(n.overflowX,e)||function(t){var e=function(t){if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}}(t);return!!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)}(t)}return!1}function a(t,e,n,r,i,o,a,s){return o<t&&a>e||o>t&&a<e?0:o<=t&&s<=n||a>=e&&s>=n?o-t-r:a>e&&s<n||o<t&&s>n?a-e+i:0}var s=function(t,e){var n=window,i=e.scrollMode,s=e.block,l=e.inline,c=e.boundary,u=e.skipOverflowHiddenElements,h="function"==typeof c?c:function(t){return t!==c};if(!r(t))throw new TypeError("Invalid target");for(var d=document.scrollingElement||document.documentElement,f=[],p=t;r(p)&&h(p);){if((p=p.parentElement)===d){f.push(p);break}null!=p&&p===document.body&&o(p)&&!o(document.documentElement)||null!=p&&o(p,u)&&f.push(p)}for(var g=n.visualViewport?n.visualViewport.width:innerWidth,m=n.visualViewport?n.visualViewport.height:innerHeight,v=window.scrollX||pageXOffset,y=window.scrollY||pageYOffset,b=t.getBoundingClientRect(),x=b.height,C=b.width,S=b.top,E=b.right,k=b.bottom,w=b.left,T="start"===s||"nearest"===s?S:"end"===s?k:S+x/2,O="center"===l?w+C/2:"end"===l?E:w,L=[],A=0;A<f.length;A++){var D=f[A],R=D.getBoundingClientRect(),M=R.height,I=R.width,_=R.top,P=R.right,N=R.bottom,j=R.left;if("if-needed"===i&&S>=0&&w>=0&&k<=m&&E<=g&&S>=_&&k<=N&&w>=j&&E<=P)return L;var F=getComputedStyle(D),B=parseInt(F.borderLeftWidth,10),U=parseInt(F.borderTopWidth,10),H=parseInt(F.borderRightWidth,10),z=parseInt(F.borderBottomWidth,10),G=0,V=0,W="offsetWidth"in D?D.offsetWidth-D.clientWidth-B-H:0,K="offsetHeight"in D?D.offsetHeight-D.clientHeight-U-z:0;if(d===D)G="start"===s?T:"end"===s?T-m:"nearest"===s?a(y,y+m,m,U,z,y+T,y+T+x,x):T-m/2,V="start"===l?O:"center"===l?O-g/2:"end"===l?O-g:a(v,v+g,g,B,H,v+O,v+O+C,C),G=Math.max(0,G+y),V=Math.max(0,V+v);else{G="start"===s?T-_-U:"end"===s?T-N+z+K:"nearest"===s?a(_,N,M,U,z+K,T,T+x,x):T-(_+M/2)+K/2,V="start"===l?O-j-B:"center"===l?O-(j+I/2)+W/2:"end"===l?O-P+H+W:a(j,P,I,B,H+W,O,O+C,C);var q=D.scrollLeft,Y=D.scrollTop;T+=Y-(G=Math.max(0,Math.min(Y+G,D.scrollHeight-M+K))),O+=q-(V=Math.max(0,Math.min(q+V,D.scrollWidth-I+W)))}L.push({el:D,top:G,left:V})}return L};function l(t){return t===Object(t)&&0!==Object.keys(t).length}e.a=function(t,e){var n=!t.ownerDocument.documentElement.contains(t);if(l(e)&&"function"==typeof e.behavior)return e.behavior(n?[]:s(t,e));if(!n){var r=function(t){return!1===t?{block:"end",inline:"nearest"}:l(t)?t:{block:"start",inline:"nearest"}}(e);return function(t,e){void 0===e&&(e="auto");var n="scrollBehavior"in document.body.style;t.forEach((function(t){var r=t.el,i=t.top,o=t.left;r.scroll&&n?r.scroll({top:i,left:o,behavior:e}):(r.scrollTop=i,r.scrollLeft=o)}))}(s(t,r),r.behavior)}}},aRTE:
/*!*****************************************************!*\
!*** ./node_modules/qr.js/lib/ErrorCorrectLevel.js ***!
\*****************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e){t.exports={L:1,M:0,Q:3,H:2}},bT9E:
/*!*****************************************!*\
!*** ./node_modules/rc-util/es/omit.js ***!
\*****************************************/
/*! exports provided: default */
/*! exports used: default */function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(/*! @babel/runtime/helpers/esm/objectSpread2 */"VTBJ");function i(t,e){var n=Object(r.a)({},t);return Array.isArray(e)&&e.forEach((function(t){delete n[t]})),n}},biw7:
/*!**********************************************************!*\
!*** ./node_modules/rc-table/es/context/TableContext.js ***!
\**********************************************************/
/*! exports provided: default */
/*! exports used: default */function(t,e,n){"use strict";var r=n(/*! react */"q1tI"),i=r.createContext(null);e.a=i},c5Ni:
/*!******************************************************!*\
!*** ./node_modules/codemirror/theme/blackboard.css ***!
\******************************************************/
/*! no static exports found */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){},dQei:
/*!****************************************!*\
!*** ./node_modules/qr.js/lib/math.js ***!
\****************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e){for(var n={glog:function(t){if(t<1)throw new Error("glog("+t+")");return n.LOG_TABLE[t]},gexp:function(t){for(;t<0;)t+=255;for(;t>=256;)t-=255;return n.EXP_TABLE[t]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},r=0;r<8;r++)n.EXP_TABLE[r]=1<<r;for(r=8;r<256;r++)n.EXP_TABLE[r]=n.EXP_TABLE[r-4]^n.EXP_TABLE[r-5]^n.EXP_TABLE[r-6]^n.EXP_TABLE[r-8];for(r=0;r<255;r++)n.LOG_TABLE[n.EXP_TABLE[r]]=r;t.exports=n},dWSS:
/*!**********************************************!*\
!*** ./node_modules/qr.js/lib/Polynomial.js ***!
\**********************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r=n(/*! ./math */"dQei");function i(t,e){if(null==t.length)throw new Error(t.length+"/"+e);for(var n=0;n<t.length&&0==t[n];)n++;this.num=new Array(t.length-n+e);for(var r=0;r<t.length-n;r++)this.num[r]=t[r+n]}i.prototype={get:function(t){return this.num[t]},getLength:function(){return this.num.length},multiply:function(t){for(var e=new Array(this.getLength()+t.getLength()-1),n=0;n<this.getLength();n++)for(var o=0;o<t.getLength();o++)e[n+o]^=r.gexp(r.glog(this.get(n))+r.glog(t.get(o)));return new i(e,0)},mod:function(t){if(this.getLength()-t.getLength()<0)return this;for(var e=r.glog(this.get(0))-r.glog(t.get(0)),n=new Array(this.getLength()),o=0;o<this.getLength();o++)n[o]=this.get(o);for(o=0;o<t.getLength();o++)n[o]^=r.gexp(r.glog(t.get(o))+e);return new i(n,0).mod(t)}},t.exports=i},dejd:
/*!***********************************************************!*\
!*** ./src/components/markdown-editor/toolbar/index.less ***!
\***********************************************************/
/*! no static exports found */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){},dmUQ:
/*!**************************************************************!*\
!*** ./node_modules/rc-input-number/es/index.js + 1 modules ***!
\**************************************************************/
/*! exports provided: default */
/*! exports used: default */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createClass.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/defineProperty.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/inherits.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/KeyCode.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */function(t,e,n){"use strict";var r=n("Ff2n"),i=n("rePB"),o=n("1OyB"),a=n("vuIU"),s=n("Ji7U"),l=n("md7G"),c=n("foSv"),u=n("q1tI"),h=n.n(u),d=n("TSYQ"),f=n.n(d),p=n("4IlW");function g(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function m(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?g(Object(n),!0).forEach((function(e){Object(i.a)(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):g(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function v(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=Object(c.a)(t);if(e){var i=Object(c.a)(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Object(l.a)(this,n)}}function y(){}function b(t){t.preventDefault()}var x=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,C=function(t){return null!=t},S=function(t,e){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)},E=function(t){Object(s.a)(n,t);var e=v(n);function n(t){var r;Object(o.a)(this,n),(r=e.call(this,t)).onKeyDown=function(t){var e=r.props,n=e.onKeyDown,i=e.onPressEnter;if(t.keyCode===p.a.UP){var o=r.getRatio(t);r.up(t,o,null),r.stop()}else if(t.keyCode===p.a.DOWN){var a=r.getRatio(t);r.down(t,a,null),r.stop()}else t.keyCode===p.a.ENTER&&i&&i(t);if(r.recordCursorPosition(),r.lastKeyCode=t.keyCode,n){for(var s=arguments.length,l=new Array(s>1?s-1:0),c=1;c<s;c++)l[c-1]=arguments[c];n.apply(void 0,[t].concat(l))}},r.onKeyUp=function(t){var e=r.props.onKeyUp;if(r.stop(),r.recordCursorPosition(),e){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];e.apply(void 0,[t].concat(i))}},r.onChange=function(t){var e=r.props.onChange;r.state.focused&&(r.inputting=!0),r.rawInput=r.props.parser(r.getValueFromEvent(t)),r.setState({inputValue:r.rawInput}),e(r.toNumber(r.rawInput))},r.onMouseUp=function(){var t=r.props.onMouseUp;r.recordCursorPosition(),t&&t.apply(void 0,arguments)},r.onFocus=function(){var t;r.setState({focused:!0}),(t=r.props).onFocus.apply(t,arguments)},r.onBlur=function(){var t=r.props.onBlur;r.inputting=!1,r.setState({focused:!1});var e=r.getCurrentValidValue(r.state.inputValue),n=r.setValue(e,y);if(t){var i=r.input.value,o=r.getInputDisplayValue({focus:!1,value:n});r.input.value=o?Number(o):o,t.apply(void 0,arguments),r.input.value=i}},r.getRatio=function(t){var e=1;return t.metaKey||t.ctrlKey?e=.1:t.shiftKey&&(e=10),e},r.getFullNum=function(t){return isNaN(t)?t:/e/i.test(String(t))?Number(t).toFixed(18).replace(/\.?0+$/,""):t},r.getPrecision=function(t){if(C(r.props.precision))return r.props.precision;var e=String(t);if(e.indexOf("e-")>=0)return parseInt(e.slice(e.indexOf("e-")+2),10);var n=0;return e.indexOf(".")>=0&&(n=e.length-e.indexOf(".")-1),n},r.getInputDisplayValue=function(t){var e,n=t||r.state,i=n.focused,o=n.inputValue,a=n.value;null==(e=i?o:r.toPrecisionAsStep(a))&&(e="");var s=r.formatWrapper(e);return C(r.props.decimalSeparator)&&(s=s.toString().replace(".",r.props.decimalSeparator)),s},r.recordCursorPosition=function(){try{r.cursorStart=r.input.selectionStart,r.cursorEnd=r.input.selectionEnd,r.currentValue=r.input.value,r.cursorBefore=r.input.value.substring(0,r.cursorStart),r.cursorAfter=r.input.value.substring(r.cursorEnd)}catch(t){}},r.restoreByAfter=function(t){if(void 0===t)return!1;var e=r.input.value,n=e.lastIndexOf(t);if(-1===n)return!1;var i=r.cursorBefore.length;return r.lastKeyCode===p.a.DELETE&&r.cursorBefore.charAt(i-1)===t[0]?(r.fixCaret(i,i),!0):n+t.length===e.length&&(r.fixCaret(n,n),!0)},r.partRestoreByAfter=function(t){return void 0!==t&&Array.prototype.some.call(t,(function(e,n){var i=t.substring(n);return r.restoreByAfter(i)}))},r.isNotCompleteNumber=function(t){return isNaN(t)||""===t||null===t||t&&t.toString().indexOf(".")===t.toString().length-1},r.stop=function(){r.autoStepTimer&&clearTimeout(r.autoStepTimer)},r.down=function(t,e,n){r.pressingUpOrDown=!0,r.step("down",t,e,n)},r.up=function(t,e,n){r.pressingUpOrDown=!0,r.step("up",t,e,n)},r.saveInput=function(t){r.input=t};var i=t.value;void 0===i&&(i=t.defaultValue),r.state={focused:t.autoFocus};var a=r.getValidValue(r.toNumber(i));return r.state=m(m({},r.state),{},{inputValue:r.toPrecisionAsStep(a),value:a}),r}return Object(a.a)(n,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(t){var e=this.props,n=e.value,r=e.onChange,i=e.max,o=e.min,a=this.state.focused;if(t){if(!S(t.value,n)||!S(t.max,i)||!S(t.min,o)){var s,l=a?n:this.getValidValue(n);s=this.pressingUpOrDown?l:this.inputting?this.rawInput:this.toPrecisionAsStep(l),this.setState({value:l,inputValue:s})}var c="value"in this.props?n:this.state.value;"max"in this.props&&t.max!==i&&"number"==typeof c&&c>i&&r&&r(i),"min"in this.props&&t.min!==o&&"number"==typeof c&&c<o&&r&&r(o)}try{if(void 0!==this.cursorStart&&this.state.focused)if(this.partRestoreByAfter(this.cursorAfter)||this.state.value===this.props.value){if(this.currentValue===this.input.value)switch(this.lastKeyCode){case p.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case p.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1)}}else{var u=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===p.a.BACKSPACE?u=this.cursorStart-1:this.lastKeyCode===p.a.DELETE&&(u=this.cursorStart):u=this.input.value.length,this.fixCaret(u,u)}}catch(t){}this.lastKeyCode=null,this.pressingUpOrDown&&this.props.focusOnUpDown&&this.state.focused&&document.activeElement!==this.input&&this.focus()}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(t){var e=t;return e=""===e?"":this.isNotCompleteNumber(parseFloat(e))?this.state.value:this.getValidValue(e),this.toNumber(e)}},{key:"getValueFromEvent",value:function(t){var e=t.target.value.trim().replace(/。/g,".");return C(this.props.decimalSeparator)&&(e=e.replace(this.props.decimalSeparator,".")),e}},{key:"getValidValue",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.props.min,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.props.max,r=parseFloat(t);return isNaN(r)?t:(r<e&&(r=e),r>n&&(r=n),r)}},{key:"setValue",value:function(t,e){var n=this.props.precision,r=this.isNotCompleteNumber(parseFloat(t))?null:parseFloat(t),i=this.state.value,o=void 0===i?null:i,a=this.state.inputValue,s=void 0===a?null:a,l="number"==typeof r?r.toFixed(n):"".concat(r),c=r!==o||l!=="".concat(s);return"value"in this.props?(s=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:s},e)):this.setState({value:r,inputValue:this.toPrecisionAsStep(t)},e),c&&this.props.onChange(r),r}},{key:"getMaxPrecision",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=this.props,r=n.precision,i=n.step;if(C(r))return r;var o=this.getPrecision(e),a=this.getPrecision(i),s=this.getPrecision(t);return t?Math.max(s,o+a):o+a}},{key:"getPrecisionFactor",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=this.getMaxPrecision(t,e);return Math.pow(10,n)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(t){return this.props.formatter?this.props.formatter(t):t}},{key:"toPrecisionAsStep",value:function(t){if(this.isNotCompleteNumber(t)||""===t)return t;var e=Math.abs(this.getMaxPrecision(t));return isNaN(e)?t.toString():Number(t).toFixed(e)}},{key:"toNumber",value:function(t){var e=this.props.precision,n=this.state.focused,r=t&&t.length>16&&n;return this.isNotCompleteNumber(t)||r?t:C(e)?Math.round(t*Math.pow(10,e))/Math.pow(10,e):Number(t)}},{key:"upStep",value:function(t,e){var n=this.props.step,r=this.getPrecisionFactor(t,e),i=Math.abs(this.getMaxPrecision(t,e)),o=((r*t+r*n*e)/r).toFixed(i);return this.toNumber(o)}},{key:"downStep",value:function(t,e){var n=this.props.step,r=this.getPrecisionFactor(t,e),i=Math.abs(this.getMaxPrecision(t,e)),o=((r*t-r*n*e)/r).toFixed(i);return this.toNumber(o)}},{key:"step",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3?arguments[3]:void 0;this.stop(),e&&(e.persist(),e.preventDefault());var o=this.props;if(!o.disabled){var a=this.getCurrentValidValue(this.state.inputValue)||0;if(!this.isNotCompleteNumber(a)){var s=this["".concat(t,"Step")](a,r),l=s>o.max||s<o.min;s>o.max?s=o.max:s<o.min&&(s=o.min),this.setValue(s,null),this.setState({focused:!0},(function(){n.pressingUpOrDown=!1})),l||(this.autoStepTimer=setTimeout((function(){n[t](e,r,!0)}),i?200:600))}}}},{key:"fixCaret",value:function(t,e){if(void 0!==t&&void 0!==e&&this.input&&this.input.value)try{var n=this.input.selectionStart,r=this.input.selectionEnd;t===n&&e===r||this.input.setSelectionRange(t,e)}catch(t){}}},{key:"render",value:function(){var t,e=this.props,n=e.prefixCls,o=e.disabled,a=e.readOnly,s=e.useTouch,l=e.autoComplete,c=e.upHandler,u=e.downHandler,d=e.className,p=e.max,g=e.min,m=e.style,v=e.title,x=e.onMouseEnter,C=e.onMouseLeave,S=e.onMouseOver,E=e.onMouseOut,k=e.required,w=e.onClick,T=e.tabIndex,O=e.type,L=e.placeholder,A=e.id,D=e.inputMode,R=e.pattern,M=e.step,I=e.maxLength,_=e.autoFocus,P=e.name,N=e.onPaste,j=e.onInput,F=Object(r.a)(e,["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"]),B=this.state,U=B.value,H=B.focused,z=f()(n,(t={},Object(i.a)(t,d,!!d),Object(i.a)(t,"".concat(n,"-disabled"),o),Object(i.a)(t,"".concat(n,"-focused"),H),t)),G={};Object.keys(F).forEach((function(t){"data-"!==t.substr(0,5)&&"aria-"!==t.substr(0,5)&&"role"!==t||(G[t]=F[t])}));var V=!a&&!o,W=this.getInputDisplayValue(null),K=(U||0===U)&&(isNaN(U)||Number(U)>=p)||o||a,q=(U||0===U)&&(isNaN(U)||Number(U)<=g)||o||a,Y=f()("".concat(n,"-handler"),"".concat(n,"-handler-up"),Object(i.a)({},"".concat(n,"-handler-up-disabled"),K)),X=f()("".concat(n,"-handler"),"".concat(n,"-handler-down"),Object(i.a)({},"".concat(n,"-handler-down-disabled"),q)),$=s?{onTouchStart:K?y:this.up,onTouchEnd:this.stop}:{onMouseDown:K?y:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},Z=s?{onTouchStart:q?y:this.down,onTouchEnd:this.stop}:{onMouseDown:q?y:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return h.a.createElement("div",{className:z,style:m,title:v,onMouseEnter:x,onMouseLeave:C,onMouseOver:S,onMouseOut:E,onFocus:function(){return null},onBlur:function(){return null}},h.a.createElement("div",{className:"".concat(n,"-handler-wrap")},h.a.createElement("span",Object.assign({unselectable:"on"},$,{role:"button","aria-label":"Increase Value","aria-disabled":K,className:Y}),c||h.a.createElement("span",{unselectable:"on",className:"".concat(n,"-handler-up-inner"),onClick:b})),h.a.createElement("span",Object.assign({unselectable:"on"},Z,{role:"button","aria-label":"Decrease Value","aria-disabled":q,className:X}),u||h.a.createElement("span",{unselectable:"on",className:"".concat(n,"-handler-down-inner"),onClick:b}))),h.a.createElement("div",{className:"".concat(n,"-input-wrap")},h.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":g,"aria-valuemax":p,"aria-valuenow":U,required:k,type:O,placeholder:L,onPaste:N,onClick:w,onMouseUp:this.onMouseUp,className:"".concat(n,"-input"),tabIndex:T,autoComplete:l,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:V?this.onKeyDown:y,onKeyUp:V?this.onKeyUp:y,autoFocus:_,maxLength:I,readOnly:a,disabled:o,max:p,min:g,step:M,name:P,title:v,id:A,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(W),pattern:R,inputMode:D,onInput:j},G))))}}]),n}(h.a.Component);E.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:x,min:-x,step:1,style:{},onChange:y,onKeyDown:y,onPressEnter:y,onFocus:y,onBlur:y,parser:function(t){return t.replace(/[^\w.-]+/g,"")},required:!1,autoComplete:"off"};var k=E;e.a=k},f4xo:
/*!********************************************!*\
!*** ./node_modules/qr.js/lib/8BitByte.js ***!
\********************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r=n(/*! ./mode */"nVVt");function i(t){this.mode=r.MODE_8BIT_BYTE,this.data=t}i.prototype={getLength:function(t){return this.data.length},write:function(t){for(var e=0;e<this.data.length;e++)t.put(this.data.charCodeAt(e),8)}},t.exports=i},fyJ8:
/*!************************************************!*\
!*** ./node_modules/rc-table/es/Cell/index.js ***!
\************************************************/
/*! exports provided: default */
/*! exports used: default */function(t,e,n){"use strict";var r=n(/*! @babel/runtime/helpers/esm/defineProperty */"rePB"),i=n(/*! @babel/runtime/helpers/esm/objectSpread2 */"VTBJ"),o=n(/*! @babel/runtime/helpers/esm/objectWithoutProperties */"Ff2n"),a=n(/*! @babel/runtime/helpers/esm/typeof */"U8pU"),s=n(/*! react */"q1tI"),l=n(/*! classnames */"TSYQ"),c=n.n(l),u=n(/*! rc-util/es/ref */"c+Xe"),h=n(/*! ../utils/valueUtil */"sR1s");var d=s.forwardRef((function(t,e){var n,l,d,f=t.prefixCls,p=t.className,g=t.record,m=t.index,v=t.dataIndex,y=t.render,b=t.children,x=t.component,C=void 0===x?"td":x,S=t.colSpan,E=t.rowSpan,k=t.fixLeft,w=t.fixRight,T=t.firstFixLeft,O=t.lastFixLeft,L=t.firstFixRight,A=t.lastFixRight,D=t.appendNode,R=t.additionalProps,M=void 0===R?{}:R,I=t.ellipsis,_=t.align,P=t.rowType,N=t.isSticky,j="".concat(f,"-cell");if(b)d=b;else{var F=Object(h.b)(g,v);if(d=F,y){var B=y(F,g,m);!function(t){return t&&"object"===Object(a.a)(t)&&!Array.isArray(t)&&!s.isValidElement(t)}(B)?d=B:(d=B.children,l=B.props)}}"object"!==Object(a.a)(d)||Array.isArray(d)||s.isValidElement(d)||(d=null),I&&(O||L)&&(d=s.createElement("span",{className:"".concat(j,"-content")},d));var U=l||{},H=U.colSpan,z=U.rowSpan,G=U.style,V=U.className,W=Object(o.a)(U,["colSpan","rowSpan","style","className"]),K=void 0!==H?H:S,q=void 0!==z?z:E;if(0===K||0===q)return null;var Y={},X="number"==typeof k,$="number"==typeof w;X&&(Y.position="sticky",Y.left=k),$&&(Y.position="sticky",Y.right=w);var Z,J={};_&&(J.textAlign=_);var Q=!0===I?{showTitle:!0}:I;Q&&(Q.showTitle||"header"===P)&&("string"==typeof d||"number"==typeof d?Z=d.toString():s.isValidElement(d)&&"string"==typeof d.props.children&&(Z=d.props.children));var tt,et=Object(i.a)(Object(i.a)(Object(i.a)({title:Z},W),M),{},{colSpan:K&&1!==K?K:null,rowSpan:q&&1!==q?q:null,className:c()(j,p,(n={},Object(r.a)(n,"".concat(j,"-fix-left"),X),Object(r.a)(n,"".concat(j,"-fix-left-first"),T),Object(r.a)(n,"".concat(j,"-fix-left-last"),O),Object(r.a)(n,"".concat(j,"-fix-right"),$),Object(r.a)(n,"".concat(j,"-fix-right-first"),L),Object(r.a)(n,"".concat(j,"-fix-right-last"),A),Object(r.a)(n,"".concat(j,"-ellipsis"),I),Object(r.a)(n,"".concat(j,"-with-append"),D),Object(r.a)(n,"".concat(j,"-fix-sticky"),(X||$)&&N),n),M.className,V),style:Object(i.a)(Object(i.a)(Object(i.a)(Object(i.a)({},M.style),J),Y),G),ref:(tt=C,"string"==typeof tt||Object(u.c)(tt)?e:null)});return s.createElement(C,Object.assign({},et),D,d)}));d.displayName="Cell";var f=s.memo(d,(function(t,e){return!!e.shouldCellUpdate&&!e.shouldCellUpdate(e.record,t.record)}));e.a=f},hW8S:
/*!******************************************************!*\
!*** ./node_modules/rc-table/es/utils/legacyUtil.js ***!
\******************************************************/
/*! exports provided: INTERNAL_COL_DEFINE, getExpandableProps, getDataAndAriaProps */
/*! exports used: INTERNAL_COL_DEFINE, getDataAndAriaProps, getExpandableProps */function(t,e,n){"use strict";n.d(e,"a",(function(){return o})),n.d(e,"c",(function(){return a})),n.d(e,"b",(function(){return s}));var r=n(/*! @babel/runtime/helpers/esm/objectSpread2 */"VTBJ"),i=n(/*! @babel/runtime/helpers/esm/objectWithoutProperties */"Ff2n"),o=(n(/*! rc-util/es/warning */"Kwbf"),"RC_TABLE_INTERNAL_COL_DEFINE");function a(t){var e=t.expandable,n=Object(i.a)(t,["expandable"]);return"expandable"in t?Object(r.a)(Object(r.a)({},n),e):n}function s(t){return Object.keys(t).reduce((function(e,n){return"data-"!==n.substr(0,5)&&"aria-"!==n.substr(0,5)||(e[n]=t[n]),e}),{})}},k3GJ:
/*!*******************************************************!*\
!*** ./node_modules/rc-tabs/es/index.js + 50 modules ***!
\*******************************************************/
/*! exports provided: TabPane, default */
/*! exports used: TabPane, default */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createClass.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createSuper.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/defineProperty.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/extends.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/inherits.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/typeof.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/regenerator/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/mini-store/esm/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/raf/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-align/es/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-dropdown/es/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-resize-observer/es/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Children/toArray.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Dom/addEventListener.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Dom/canUseDom.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Dom/contains.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Dom/findDOMNode.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/KeyCode.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Portal.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/createChainedFunction.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/hooks/useMergedState.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/omit.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/raf.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/ref.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/warning.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react-dom/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js (<- Module uses injected variables (global)) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/shallowequal/index.js (<- Module is not an ECMAScript module) */function(t,e,n){"use strict";n.d(e,"a",(function(){return We}));var r=n("rePB"),i=n("ODXe"),o=n("Ff2n"),a=n("VTBJ"),s=n("q1tI"),l=n("TSYQ"),c=n.n(l),u=n("Zm9Q"),h=n("6cGi"),d=n("KQm4"),f=n("xEkU"),p=n.n(f),g=n("t23M");function m(t){var e=Object(s.useRef)(),n=Object(s.useRef)(!1);return Object(s.useEffect)((function(){return function(){n.current=!0,p.a.cancel(e.current)}}),[]),function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];n.current||(p.a.cancel(e.current),e.current=p()((function(){t.apply(void 0,i)})))}}var v=n("4IlW");var y=s.forwardRef((function(t,e){var n,i=t.prefixCls,o=t.id,a=t.active,l=t.rtl,u=t.tab,h=u.key,d=u.tab,f=u.disabled,p=u.closeIcon,g=t.tabBarGutter,m=t.tabPosition,y=t.closable,b=t.renderWrapper,x=t.removeAriaLabel,C=t.editable,S=t.onClick,E=t.onRemove,k=t.onFocus,w="".concat(i,"-tab");s.useEffect((function(){return E}),[]);var T={};"top"===m||"bottom"===m?T[l?"marginLeft":"marginRight"]=g:T.marginBottom=g;var O=C&&!1!==y&&!f;function L(t){f||S(t)}var A=s.createElement("div",{key:h,ref:e,className:c()(w,(n={},Object(r.a)(n,"".concat(w,"-with-remove"),O),Object(r.a)(n,"".concat(w,"-active"),a),Object(r.a)(n,"".concat(w,"-disabled"),f),n)),style:T,onClick:L},s.createElement("div",{role:"tab","aria-selected":a,id:o&&"".concat(o,"-tab-").concat(h),className:"".concat(w,"-btn"),"aria-controls":o&&"".concat(o,"-panel-").concat(h),"aria-disabled":f,tabIndex:f?null:0,onClick:function(t){t.stopPropagation(),L(t)},onKeyDown:function(t){[v.a.SPACE,v.a.ENTER].includes(t.which)&&(t.preventDefault(),L(t))},onFocus:k},d),O&&s.createElement("button",{type:"button","aria-label":x||"remove",tabIndex:0,className:"".concat(w,"-remove"),onClick:function(t){var e;t.stopPropagation(),(e=t).preventDefault(),e.stopPropagation(),C.onEdit("remove",{key:h,event:e})}},p||C.removeIcon||"×"));return b&&(A=b(A)),A})),b={width:0,height:0,left:0,top:0};var x={width:0,height:0,left:0,top:0,right:0};var C=n("wx14"),S=n("1OyB"),E=n("vuIU"),k=n("JX7q"),w=n("Ji7U"),T=n("LK+K"),O=n("I8Z2"),L=n("bT9E"),A=n("2GS6"),D=n("Gytx"),R=n.n(D),M=n("U8pU"),I=/iPhone/i,_=/iPod/i,P=/iPad/i,N=/\bAndroid(?:.+)Mobile\b/i,j=/Android/i,F=/\bAndroid(?:.+)SD4930UR\b/i,B=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,U=/Windows Phone/i,H=/\bWindows(?:.+)ARM\b/i,z=/BlackBerry/i,G=/BB10/i,V=/Opera Mini/i,W=/\b(CriOS|Chrome)(?:.+)Mobile/i,K=/Mobile(?:.+)Firefox\b/i;function q(t,e){return t.test(e)}function Y(t){var e=t||("undefined"!=typeof navigator?navigator.userAgent:""),n=(e||"").split("[FBAN");if(void 0!==n[1]){var r=n;e=Object(i.a)(r,1)[0]}if(void 0!==(n=e.split("Twitter"))[1]){var o=n;e=Object(i.a)(o,1)[0]}var a={apple:{phone:q(I,e)&&!q(U,e),ipod:q(_,e),tablet:!q(I,e)&&q(P,e)&&!q(U,e),device:(q(I,e)||q(_,e)||q(P,e))&&!q(U,e)},amazon:{phone:q(F,e),tablet:!q(F,e)&&q(B,e),device:q(F,e)||q(B,e)},android:{phone:!q(U,e)&&q(F,e)||!q(U,e)&&q(N,e),tablet:!q(U,e)&&!q(F,e)&&!q(N,e)&&(q(B,e)||q(j,e)),device:!q(U,e)&&(q(F,e)||q(B,e)||q(N,e)||q(j,e))||q(/\bokhttp\b/i,e)},windows:{phone:q(U,e),tablet:q(H,e),device:q(U,e)||q(H,e)},other:{blackberry:q(z,e),blackberry10:q(G,e),opera:q(V,e),firefox:q(K,e),chrome:q(W,e),device:q(z,e)||q(G,e)||q(V,e)||q(K,e)||q(W,e)},any:null,phone:null,tablet:null};return a.any=a.apple.device||a.android.device||a.windows.device||a.other.device,a.phone=a.apple.phone||a.android.phone||a.windows.phone,a.tablet=a.apple.tablet||a.android.tablet||a.windows.tablet,a}var X=Object(a.a)(Object(a.a)({},Y()),{},{isMobile:Y});function $(){}function Z(t,e,n){var r=e||"";return t.key||"".concat(r,"item_").concat(n)}function J(t){return"".concat(t,"-menu-")}function Q(t,e){var n=-1;s.Children.forEach(t,(function(t){n+=1,t&&t.type&&t.type.isMenuItemGroup?s.Children.forEach(t.props.children,(function(t){e(t,n+=1)})):e(t,n)}))}var tt=["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"],et=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t&&"function"==typeof t.getBoundingClientRect&&t.getBoundingClientRect().width;if(n){if(e){var r=getComputedStyle(t),i=r.marginLeft,o=r.marginRight;n+=+i.replace("px","")+ +o.replace("px","")}n=+n.toFixed(6)}return n||0},nt=function(t,e,n){t&&"object"===Object(M.a)(t.style)&&(t.style[e]=n)},rt=n("bdgK"),it=n("i8i4"),ot=n.n(it),at=n("wgJM"),st=n("l4aY"),lt=n("m+aA"),ct=n("c+Xe"),ut=n("zT1h"),ht=n("QC+M");function dt(t,e,n){return n?t[0]===e[0]:t[0]===e[0]&&t[1]===e[1]}var ft=n("MNnm");function pt(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit".concat(t)]="webkit".concat(e),n["Moz".concat(t)]="moz".concat(e),n["ms".concat(t)]="MS".concat(e),n["O".concat(t)]="o".concat(e.toLowerCase()),n}var gt,mt,vt,yt=(gt=Object(ft.a)(),mt="undefined"!=typeof window?window:{},vt={animationend:pt("Animation","AnimationEnd"),transitionend:pt("Transition","TransitionEnd")},gt&&("AnimationEvent"in mt||delete vt.animationend.animation,"TransitionEvent"in mt||delete vt.transitionend.transition),vt),bt={};if(Object(ft.a)()){var xt=document.createElement("div");bt=xt.style}var Ct={};function St(t){if(Ct[t])return Ct[t];var e=yt[t];if(e)for(var n=Object.keys(e),r=n.length,i=0;i<r;i+=1){var o=n[i];if(Object.prototype.hasOwnProperty.call(e,o)&&o in bt)return Ct[t]=e[o],Ct[t]}return""}var Et=St("animationend"),kt=St("transitionend"),wt=!(!Et||!kt),Tt=Et||"animationend",Ot=kt||"transitionend";function Lt(t,e){return t?"object"===Object(M.a)(t)?t[e.replace(/-\w/g,(function(t){return t[1].toUpperCase()}))]:"".concat(t,"-").concat(e):null}function At(t){var e=Object(s.useRef)(!1),n=Object(s.useState)(t),r=Object(i.a)(n,2),o=r[0],a=r[1];return Object(s.useEffect)((function(){return function(){e.current=!0}}),[]),[o,function(t){e.current||a(t)}]}var Dt=Object(ft.a)()?s.useLayoutEffect:s.useEffect,Rt=["prepare","start","active","end"];function Mt(t){return"active"===t||"end"===t}var It=function(t,e){var n=s.useState("none"),r=Object(i.a)(n,2),o=r[0],a=r[1],l=function(){var t=s.useRef(null);function e(){at.a.cancel(t.current)}return s.useEffect((function(){return function(){e()}}),[]),[function n(r){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;e();var o=Object(at.a)((function(){i<=1?r({isCanceled:function(){return o!==t.current}}):n(r,i-1)}));t.current=o},e]}(),c=Object(i.a)(l,2),u=c[0],h=c[1];return Dt((function(){if("none"!==o&&"end"!==o){var t=Rt.indexOf(o),n=Rt[t+1],r=e(o);!1===r?a(n):u((function(t){function e(){t.isCanceled()||a(n)}!0===r?e():Promise.resolve(r).then(e)}))}}),[t,o]),s.useEffect((function(){return function(){h()}}),[]),[function(){a("prepare")},o]};function _t(t,e,n,o){var l=o.motionEnter,c=void 0===l||l,u=o.motionAppear,h=void 0===u||u,d=o.motionLeave,f=void 0===d||d,p=o.motionDeadline,g=o.motionLeaveImmediately,m=o.onAppearPrepare,v=o.onEnterPrepare,y=o.onLeavePrepare,b=o.onAppearStart,x=o.onEnterStart,C=o.onLeaveStart,S=o.onAppearActive,E=o.onEnterActive,k=o.onLeaveActive,w=o.onAppearEnd,T=o.onEnterEnd,O=o.onLeaveEnd,L=o.onVisibleChanged,A=At(),D=Object(i.a)(A,2),R=D[0],M=D[1],I=At("none"),_=Object(i.a)(I,2),P=_[0],N=_[1],j=At(null),F=Object(i.a)(j,2),B=F[0],U=F[1],H=Object(s.useRef)(!1),z=Object(s.useRef)(null),G=Object(s.useRef)(!1),V=Object(s.useRef)(null);function W(){return n()||V.current}var K=Object(s.useRef)(!1);function q(t){var e,n=W();t&&!t.deadline&&t.target!==n||("appear"===P&&K.current?e=null==w?void 0:w(n,t):"enter"===P&&K.current?e=null==T?void 0:T(n,t):"leave"===P&&K.current&&(e=null==O?void 0:O(n,t)),!1===e||G.current||(N("none"),U(null)))}var Y=function(t){var e=Object(s.useRef)(),n=Object(s.useRef)(t);n.current=t;var r=s.useCallback((function(t){n.current(t)}),[]);function i(t){t&&(t.removeEventListener(Ot,r),t.removeEventListener(Tt,r))}return s.useEffect((function(){return function(){i(e.current)}}),[]),[function(t){e.current&&e.current!==t&&i(e.current),t&&t!==e.current&&(t.addEventListener(Ot,r),t.addEventListener(Tt,r),e.current=t)},i]}(q),X=Object(i.a)(Y,1)[0],$=s.useMemo((function(){var t,e,n;switch(P){case"appear":return t={},Object(r.a)(t,"prepare",m),Object(r.a)(t,"start",b),Object(r.a)(t,"active",S),t;case"enter":return e={},Object(r.a)(e,"prepare",v),Object(r.a)(e,"start",x),Object(r.a)(e,"active",E),e;case"leave":return n={},Object(r.a)(n,"prepare",y),Object(r.a)(n,"start",C),Object(r.a)(n,"active",k),n;default:return{}}}),[P]),Z=It(P,(function(t){if("prepare"===t){var e=$.prepare;return!!e&&e(W())}var n;tt in $&&U((null===(n=$[tt])||void 0===n?void 0:n.call($,W(),null))||null);return"active"===tt&&(X(W()),p>0&&(clearTimeout(z.current),z.current=setTimeout((function(){q({deadline:!0})}),p))),!0})),J=Object(i.a)(Z,2),Q=J[0],tt=J[1],et=Mt(tt);K.current=et,Dt((function(){M(e);var n,r=H.current;(H.current=!0,t)&&(!r&&e&&h&&(n="appear"),r&&e&&c&&(n="enter"),(r&&!e&&f||!r&&g&&!e&&f)&&(n="leave"),n&&(N(n),Q()))}),[e]),Object(s.useEffect)((function(){("appear"===P&&!h||"enter"===P&&!c||"leave"===P&&!f)&&N("none")}),[h,c,f]),Object(s.useEffect)((function(){return function(){clearTimeout(z.current),G.current=!0}}),[]),Object(s.useEffect)((function(){void 0!==R&&"none"===P&&(null==L||L(R))}),[R,P]);var nt=B;return $.prepare&&"start"===tt&&(nt=Object(a.a)({transition:"none"},nt)),[P,tt,nt,null!=R?R:e]}var Pt=function(t){Object(w.a)(n,t);var e=Object(T.a)(n);function n(){return Object(S.a)(this,n),e.apply(this,arguments)}return Object(E.a)(n,[{key:"render",value:function(){return this.props.children}}]),n}(s.Component);var Nt=function(t){var e=t;function n(t){return!(!t.motionName||!e)}"object"===Object(M.a)(t)&&(e=t.transitionSupport);var o=s.forwardRef((function(t,e){var o=t.visible,l=void 0===o||o,u=t.removeOnLeave,h=void 0===u||u,d=t.forceRender,f=t.children,p=t.motionName,g=t.leavedClassName,m=t.eventProps,v=n(t),y=Object(s.useRef)(),b=Object(s.useRef)();var x=_t(v,l,(function(){try{return Object(lt.a)(y.current||b.current)}catch(t){return null}}),t),C=Object(i.a)(x,4),S=C[0],E=C[1],k=C[2],w=C[3],T=s.useRef(w);w&&(T.current=!0);var O=Object(s.useRef)(e);O.current=e;var L,A=s.useCallback((function(t){y.current=t,Object(ct.b)(O.current,t)}),[]),D=Object(a.a)(Object(a.a)({},m),{},{visible:l});if(f)if("none"!==S&&n(t)){var R,M;"prepare"===E?M="prepare":Mt(E)?M="active":"start"===E&&(M="start"),L=f(Object(a.a)(Object(a.a)({},D),{},{className:c()(Lt(p,S),(R={},Object(r.a)(R,Lt(p,"".concat(S,"-").concat(M)),M),Object(r.a)(R,p,"string"==typeof p),R)),style:k}),A)}else L=w?f(Object(a.a)({},D),A):!h&&T.current?f(Object(a.a)(Object(a.a)({},D),{},{className:g}),A):d?f(Object(a.a)(Object(a.a)({},D),{},{style:{display:"none"}}),A):null;else L=null;return s.createElement(Pt,{ref:b},L)}));return o.displayName="CSSMotion",o}(wt);function jt(t){var e;return e=t&&"object"===Object(M.a)(t)&&"key"in t?t:{key:t},Object(a.a)(Object(a.a)({},e),{},{key:String(e.key)})}function Ft(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return t.map(jt)}function Bt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=[],r=0,i=e.length,o=Ft(t),s=Ft(e);o.forEach((function(t){for(var e=!1,o=r;o<i;o+=1){var l=s[o];if(l.key===t.key){r<o&&(n=n.concat(s.slice(r,o).map((function(t){return Object(a.a)(Object(a.a)({},t),{},{status:"add"})}))),r=o),n.push(Object(a.a)(Object(a.a)({},l),{},{status:"keep"})),r+=1,e=!0;break}}e||n.push(Object(a.a)(Object(a.a)({},t),{},{status:"remove"}))})),r<i&&(n=n.concat(s.slice(r).map((function(t){return Object(a.a)(Object(a.a)({},t),{},{status:"add"})}))));var l={};n.forEach((function(t){var e=t.key;l[e]=(l[e]||0)+1}));var c=Object.keys(l).filter((function(t){return l[t]>1}));return c.forEach((function(t){(n=n.filter((function(e){var n=e.key,r=e.status;return n!==t||"remove"!==r}))).forEach((function(e){e.key===t&&(e.status="keep")}))})),n}var Ut=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];!function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Nt,n=function(t){Object(w.a)(r,t);var n=Object(T.a)(r);function r(){var t;return Object(S.a)(this,r),(t=n.apply(this,arguments)).state={keyEntities:[]},t.removeKey=function(e){t.setState((function(t){return{keyEntities:t.keyEntities.map((function(t){return t.key!==e?t:Object(a.a)(Object(a.a)({},t),{},{status:"removed"})}))}}))},t}return Object(E.a)(r,[{key:"render",value:function(){var t=this,n=this.state.keyEntities,r=this.props,i=r.component,a=r.children,l=r.onVisibleChanged,c=Object(o.a)(r,["component","children","onVisibleChanged"]),u=i||s.Fragment,h={};return Ut.forEach((function(t){h[t]=c[t],delete c[t]})),delete c.keys,s.createElement(u,c,n.map((function(n){var r=n.status,i=Object(o.a)(n,["status"]),c="add"===r||"keep"===r;return s.createElement(e,Object(C.a)({},h,{key:i.key,visible:c,eventProps:i,onVisibleChanged:function(e){null==l||l(e,{key:i.key}),e||t.removeKey(i.key)}}),a)})))}}],[{key:"getDerivedStateFromProps",value:function(t,e){var n=t.keys,r=e.keyEntities,i=Ft(n);return{keyEntities:Bt(r,i).filter((function(t){var e=r.find((function(e){var n=e.key;return t.key===n}));return!e||"removed"!==e.status||"remove"!==t.status}))}}}]),r}(s.Component);n.defaultProps={component:"div"}}(wt);var Ht=Nt;function zt(t){var e=t.prefixCls,n=t.motion,r=t.animation,i=t.transitionName;return n||(r?{motionName:"".concat(e,"-").concat(r)}:i?{motionName:i}:null)}function Gt(t){var e=t.prefixCls,n=t.visible,r=t.zIndex,i=t.mask,o=t.maskMotion,l=t.maskAnimation,u=t.maskTransitionName;if(!i)return null;var h={};return(o||u||l)&&(h=Object(a.a)({motionAppear:!0},zt({motion:o,prefixCls:e,transitionName:u,animation:l}))),s.createElement(Ht,Object(C.a)({},h,{visible:n,removeOnLeave:!0}),(function(t){var n=t.className;return s.createElement("div",{style:{zIndex:r},className:c()("".concat(e,"-mask"),n)})}))}var Vt=n("9mu1"),Wt=n("o0o1"),Kt=n.n(Wt),qt=n("HaE+"),Yt=["measure","align",null,"motion"],Xt=s.forwardRef((function(t,e){var n=t.visible,r=t.prefixCls,o=t.className,l=t.style,u=t.children,h=t.zIndex,d=t.stretch,f=t.destroyPopupOnHide,p=t.forceRender,g=t.align,m=t.point,v=t.getRootDomNode,y=t.getClassNameFromAlign,b=t.onAlign,x=t.onMouseEnter,S=t.onMouseLeave,E=t.onMouseDown,k=t.onTouchStart,w=Object(s.useRef)(),T=Object(s.useRef)(),O=Object(s.useState)(),L=Object(i.a)(O,2),A=L[0],D=L[1],R=function(t){var e=s.useState({width:0,height:0}),n=Object(i.a)(e,2),r=n[0],o=n[1];return[s.useMemo((function(){var e={};if(t){var n=r.width,i=r.height;-1!==t.indexOf("height")&&i?e.height=i:-1!==t.indexOf("minHeight")&&i&&(e.minHeight=i),-1!==t.indexOf("width")&&n?e.width=n:-1!==t.indexOf("minWidth")&&n&&(e.minWidth=n)}return e}),[t,r]),function(t){o({width:t.offsetWidth,height:t.offsetHeight})}]}(d),M=Object(i.a)(R,2),I=M[0],_=M[1];var P=function(t,e){var n=Object(s.useState)(null),r=Object(i.a)(n,2),o=r[0],a=r[1],l=Object(s.useRef)(),c=Object(s.useRef)(!1);function u(t){c.current||a(t)}function h(){at.a.cancel(l.current)}return Object(s.useEffect)((function(){u("measure")}),[t]),Object(s.useEffect)((function(){switch(o){case"measure":e()}o&&(l.current=Object(at.a)(Object(qt.a)(Kt.a.mark((function t(){var e,n;return Kt.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=Yt.indexOf(o),(n=Yt[e+1])&&-1!==e&&u(n);case 3:case"end":return t.stop()}}),t)})))))}),[o]),Object(s.useEffect)((function(){return function(){c.current=!0,h()}}),[]),[o,function(t){h(),l.current=Object(at.a)((function(){u((function(t){switch(o){case"align":return"motion";case"motion":return"stable"}return t})),null==t||t()}))}]}(n,(function(){d&&_(v())})),N=Object(i.a)(P,2),j=N[0],F=N[1],B=Object(s.useRef)();function U(){var t;null===(t=w.current)||void 0===t||t.forceAlign()}function H(t,e){var n=y(e);A!==n&&D(n),"align"===j&&(A!==n?Promise.resolve().then((function(){U()})):F((function(){var t;null===(t=B.current)||void 0===t||t.call(B)})),null==b||b(t,e))}var z=Object(a.a)({},zt(t));function G(){return new Promise((function(t){B.current=t}))}["onAppearEnd","onEnterEnd","onLeaveEnd"].forEach((function(t){var e=z[t];z[t]=function(t,n){return F(),null==e?void 0:e(t,n)}})),s.useEffect((function(){z.motionName||"motion"!==j||F()}),[z.motionName,j]),s.useImperativeHandle(e,(function(){return{forceAlign:U,getElement:function(){return T.current}}}));var V=Object(a.a)(Object(a.a)({},I),{},{zIndex:h,opacity:"motion"!==j&&"stable"!==j&&n?0:void 0,pointerEvents:"stable"===j?void 0:"none"},l),W=!0;!(null==g?void 0:g.points)||"align"!==j&&"stable"!==j||(W=!1);var K=u;return s.Children.count(u)>1&&(K=s.createElement("div",{className:"".concat(r,"-content")},u)),s.createElement(Ht,Object(C.a)({visible:n,ref:T,leavedClassName:"".concat(r,"-hidden")},z,{onAppearPrepare:G,onEnterPrepare:G,removeOnLeave:f,forceRender:p}),(function(t,e){var n=t.className,i=t.style,l=c()(r,o,A,n);return s.createElement(Vt.a,{target:m||v,key:"popup",ref:w,monitorWindowResize:!0,disabled:W,align:g,onAlign:H},s.createElement("div",{ref:e,className:l,onMouseEnter:x,onMouseLeave:S,onMouseDownCapture:E,onTouchStartCapture:k,style:Object(a.a)(Object(a.a)({},i),V)},K))}))}));Xt.displayName="PopupInner";var $t=Xt,Zt=s.forwardRef((function(t,e){var n=t.prefixCls,r=t.visible,i=t.zIndex,o=t.children,l=t.mobile,u=(l=void 0===l?{}:l).popupClassName,h=l.popupStyle,d=l.popupMotion,f=void 0===d?{}:d,p=l.popupRender,g=s.useRef();s.useImperativeHandle(e,(function(){return{forceAlign:function(){},getElement:function(){return g.current}}}));var m=Object(a.a)({zIndex:i},h),v=o;return s.Children.count(o)>1&&(v=s.createElement("div",{className:"".concat(n,"-content")},o)),p&&(v=p(v)),s.createElement(Ht,Object(C.a)({visible:r,ref:g,removeOnLeave:!0},f),(function(t,e){var r=t.className,i=t.style,o=c()(n,u,r);return s.createElement("div",{ref:e,className:o,style:Object(a.a)(Object(a.a)({},i),m)},v)}))}));Zt.displayName="MobilePopupInner";var Jt=Zt,Qt=["visible","mobile"],te=s.forwardRef((function(t,e){var n=t.visible,r=t.mobile,l=Object(o.a)(t,Qt),c=Object(s.useState)(n),u=Object(i.a)(c,2),h=u[0],d=u[1],f=Object(s.useState)(!1),p=Object(i.a)(f,2),g=p[0],m=p[1],v=Object(a.a)(Object(a.a)({},l),{},{visible:h});Object(s.useEffect)((function(){d(n),n&&r&&m(function(){if("undefined"==typeof navigator||"undefined"==typeof window)return!1;var t=navigator.userAgent||navigator.vendor||window.opera;return!(!/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(t)&&!/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(null==t?void 0:t.substr(0,4)))}())}),[n,r]);var y=g?s.createElement(Jt,Object(C.a)({},v,{mobile:r,ref:e})):s.createElement($t,Object(C.a)({},v,{ref:e}));return s.createElement("div",null,s.createElement(Gt,v),y)}));te.displayName="Popup";var ee=te,ne=s.createContext(null);function re(){}function ie(){return""}function oe(t){return t?t.ownerDocument:window.document}var ae=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur","onContextMenu"];var se,le,ce=(se=ht.a,(le=function(t){Object(w.a)(n,t);var e=Object(T.a)(n);function n(t){var r,i;return Object(S.a)(this,n),(r=e.call(this,t)).popupRef=s.createRef(),r.triggerRef=s.createRef(),r.attachId=void 0,r.clickOutsideHandler=void 0,r.touchOutsideHandler=void 0,r.contextMenuOutsideHandler1=void 0,r.contextMenuOutsideHandler2=void 0,r.mouseDownTimeout=void 0,r.focusTime=void 0,r.preClickTime=void 0,r.preTouchTime=void 0,r.delayTimer=void 0,r.hasPopupMouseDown=void 0,r.onMouseEnter=function(t){var e=r.props.mouseEnterDelay;r.fireEvents("onMouseEnter",t),r.delaySetPopupVisible(!0,e,e?null:t)},r.onMouseMove=function(t){r.fireEvents("onMouseMove",t),r.setPoint(t)},r.onMouseLeave=function(t){r.fireEvents("onMouseLeave",t),r.delaySetPopupVisible(!1,r.props.mouseLeaveDelay)},r.onPopupMouseEnter=function(){r.clearDelayTimer()},r.onPopupMouseLeave=function(t){var e;t.relatedTarget&&!t.relatedTarget.setTimeout&&Object(st.a)(null===(e=r.popupRef.current)||void 0===e?void 0:e.getElement(),t.relatedTarget)||r.delaySetPopupVisible(!1,r.props.mouseLeaveDelay)},r.onFocus=function(t){r.fireEvents("onFocus",t),r.clearDelayTimer(),r.isFocusToShow()&&(r.focusTime=Date.now(),r.delaySetPopupVisible(!0,r.props.focusDelay))},r.onMouseDown=function(t){r.fireEvents("onMouseDown",t),r.preClickTime=Date.now()},r.onTouchStart=function(t){r.fireEvents("onTouchStart",t),r.preTouchTime=Date.now()},r.onBlur=function(t){r.fireEvents("onBlur",t),r.clearDelayTimer(),r.isBlurToHide()&&r.delaySetPopupVisible(!1,r.props.blurDelay)},r.onContextMenu=function(t){t.preventDefault(),r.fireEvents("onContextMenu",t),r.setPopupVisible(!0,t)},r.onContextMenuClose=function(){r.isContextMenuToShow()&&r.close()},r.onClick=function(t){if(r.fireEvents("onClick",t),r.focusTime){var e;if(r.preClickTime&&r.preTouchTime?e=Math.min(r.preClickTime,r.preTouchTime):r.preClickTime?e=r.preClickTime:r.preTouchTime&&(e=r.preTouchTime),Math.abs(e-r.focusTime)<20)return;r.focusTime=0}r.preClickTime=0,r.preTouchTime=0,r.isClickToShow()&&(r.isClickToHide()||r.isBlurToHide())&&t&&t.preventDefault&&t.preventDefault();var n=!r.state.popupVisible;(r.isClickToHide()&&!n||n&&r.isClickToShow())&&r.setPopupVisible(!r.state.popupVisible,t)},r.onPopupMouseDown=function(){var t;r.hasPopupMouseDown=!0,clearTimeout(r.mouseDownTimeout),r.mouseDownTimeout=window.setTimeout((function(){r.hasPopupMouseDown=!1}),0),r.context&&(t=r.context).onPopupMouseDown.apply(t,arguments)},r.onDocumentClick=function(t){if(!r.props.mask||r.props.maskClosable){var e=t.target,n=r.getRootDomNode(),i=r.getPopupDomNode();Object(st.a)(n,e)&&!r.isContextMenuOnly()||Object(st.a)(i,e)||r.hasPopupMouseDown||r.close()}},r.getRootDomNode=function(){var t=r.props.getTriggerDOMNode;if(t)return t(r.triggerRef.current);try{var e=Object(lt.a)(r.triggerRef.current);if(e)return e}catch(t){}return ot.a.findDOMNode(Object(k.a)(r))},r.getPopupClassNameFromAlign=function(t){var e=[],n=r.props,i=n.popupPlacement,o=n.builtinPlacements,a=n.prefixCls,s=n.alignPoint,l=n.getPopupClassNameFromAlign;return i&&o&&e.push(function(t,e,n,r){for(var i=n.points,o=Object.keys(t),a=0;a<o.length;a+=1){var s=o[a];if(dt(t[s].points,i,r))return"".concat(e,"-placement-").concat(s)}return""}(o,a,t,s)),l&&e.push(l(t)),e.join(" ")},r.getComponent=function(){var t=r.props,e=t.prefixCls,n=t.destroyPopupOnHide,i=t.popupClassName,o=t.onPopupAlign,a=t.popupMotion,l=t.popupAnimation,c=t.popupTransitionName,u=t.popupStyle,h=t.mask,d=t.maskAnimation,f=t.maskTransitionName,p=t.maskMotion,g=t.zIndex,m=t.popup,v=t.stretch,y=t.alignPoint,b=t.mobile,x=t.forceRender,S=r.state,E=S.popupVisible,k=S.point,w=r.getPopupAlign(),T={};return r.isMouseEnterToShow()&&(T.onMouseEnter=r.onPopupMouseEnter),r.isMouseLeaveToHide()&&(T.onMouseLeave=r.onPopupMouseLeave),T.onMouseDown=r.onPopupMouseDown,T.onTouchStart=r.onPopupMouseDown,s.createElement(ee,Object(C.a)({prefixCls:e,destroyPopupOnHide:n,visible:E,point:y&&k,className:i,align:w,onAlign:o,animation:l,getClassNameFromAlign:r.getPopupClassNameFromAlign},T,{stretch:v,getRootDomNode:r.getRootDomNode,style:u,mask:h,zIndex:g,transitionName:c,maskAnimation:d,maskTransitionName:f,maskMotion:p,ref:r.popupRef,motion:a,mobile:b,forceRender:x}),"function"==typeof m?m():m)},r.attachParent=function(t){at.a.cancel(r.attachId);var e,n=r.props,i=n.getPopupContainer,o=n.getDocument,a=r.getRootDomNode();i?(a||0===i.length)&&(e=i(a)):e=o(r.getRootDomNode()).body,e?e.appendChild(t):r.attachId=Object(at.a)((function(){r.attachParent(t)}))},r.getContainer=function(){var t=(0,r.props.getDocument)(r.getRootDomNode()).createElement("div");return t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.width="100%",r.attachParent(t),t},r.setPoint=function(t){r.props.alignPoint&&t&&r.setState({point:{pageX:t.pageX,pageY:t.pageY}})},r.handlePortalUpdate=function(){r.state.prevPopupVisible!==r.state.popupVisible&&r.props.afterPopupVisibleChange(r.state.popupVisible)},r.triggerContextValue={onPopupMouseDown:r.onPopupMouseDown},i="popupVisible"in t?!!t.popupVisible:!!t.defaultPopupVisible,r.state={prevPopupVisible:i,popupVisible:i},ae.forEach((function(t){r["fire".concat(t)]=function(e){r.fireEvents(t,e)}})),r}return Object(E.a)(n,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var t,e=this.props;if(this.state.popupVisible)return this.clickOutsideHandler||!this.isClickToHide()&&!this.isContextMenuToShow()||(t=e.getDocument(this.getRootDomNode()),this.clickOutsideHandler=Object(ut.a)(t,"mousedown",this.onDocumentClick)),this.touchOutsideHandler||(t=t||e.getDocument(this.getRootDomNode()),this.touchOutsideHandler=Object(ut.a)(t,"touchstart",this.onDocumentClick)),!this.contextMenuOutsideHandler1&&this.isContextMenuToShow()&&(t=t||e.getDocument(this.getRootDomNode()),this.contextMenuOutsideHandler1=Object(ut.a)(t,"scroll",this.onContextMenuClose)),void(!this.contextMenuOutsideHandler2&&this.isContextMenuToShow()&&(this.contextMenuOutsideHandler2=Object(ut.a)(window,"blur",this.onContextMenuClose)));this.clearOutsideHandler()}},{key:"componentWillUnmount",value:function(){this.clearDelayTimer(),this.clearOutsideHandler(),clearTimeout(this.mouseDownTimeout),at.a.cancel(this.attachId)}},{key:"getPopupDomNode",value:function(){var t;return(null===(t=this.popupRef.current)||void 0===t?void 0:t.getElement())||null}},{key:"getPopupAlign",value:function(){var t=this.props,e=t.popupPlacement,n=t.popupAlign,r=t.builtinPlacements;return e&&r?function(t,e,n){var r=t[e]||{};return Object(a.a)(Object(a.a)({},r),n)}(r,e,n):n}},{key:"setPopupVisible",value:function(t,e){var n=this.props.alignPoint,r=this.state.popupVisible;this.clearDelayTimer(),r!==t&&("popupVisible"in this.props||this.setState({popupVisible:t,prevPopupVisible:r}),this.props.onPopupVisibleChange(t)),n&&e&&t&&this.setPoint(e)}},{key:"delaySetPopupVisible",value:function(t,e,n){var r=this,i=1e3*e;if(this.clearDelayTimer(),i){var o=n?{pageX:n.pageX,pageY:n.pageY}:null;this.delayTimer=window.setTimeout((function(){r.setPopupVisible(t,o),r.clearDelayTimer()}),i)}else this.setPopupVisible(t,n)}},{key:"clearDelayTimer",value:function(){this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null)}},{key:"clearOutsideHandler",value:function(){this.clickOutsideHandler&&(this.clickOutsideHandler.remove(),this.clickOutsideHandler=null),this.contextMenuOutsideHandler1&&(this.contextMenuOutsideHandler1.remove(),this.contextMenuOutsideHandler1=null),this.contextMenuOutsideHandler2&&(this.contextMenuOutsideHandler2.remove(),this.contextMenuOutsideHandler2=null),this.touchOutsideHandler&&(this.touchOutsideHandler.remove(),this.touchOutsideHandler=null)}},{key:"createTwoChains",value:function(t){var e=this.props.children.props,n=this.props;return e[t]&&n[t]?this["fire".concat(t)]:e[t]||n[t]}},{key:"isClickToShow",value:function(){var t=this.props,e=t.action,n=t.showAction;return-1!==e.indexOf("click")||-1!==n.indexOf("click")}},{key:"isContextMenuOnly",value:function(){var t=this.props.action;return"contextMenu"===t||1===t.length&&"contextMenu"===t[0]}},{key:"isContextMenuToShow",value:function(){var t=this.props,e=t.action,n=t.showAction;return-1!==e.indexOf("contextMenu")||-1!==n.indexOf("contextMenu")}},{key:"isClickToHide",value:function(){var t=this.props,e=t.action,n=t.hideAction;return-1!==e.indexOf("click")||-1!==n.indexOf("click")}},{key:"isMouseEnterToShow",value:function(){var t=this.props,e=t.action,n=t.showAction;return-1!==e.indexOf("hover")||-1!==n.indexOf("mouseEnter")}},{key:"isMouseLeaveToHide",value:function(){var t=this.props,e=t.action,n=t.hideAction;return-1!==e.indexOf("hover")||-1!==n.indexOf("mouseLeave")}},{key:"isFocusToShow",value:function(){var t=this.props,e=t.action,n=t.showAction;return-1!==e.indexOf("focus")||-1!==n.indexOf("focus")}},{key:"isBlurToHide",value:function(){var t=this.props,e=t.action,n=t.hideAction;return-1!==e.indexOf("focus")||-1!==n.indexOf("blur")}},{key:"forcePopupAlign",value:function(){var t;this.state.popupVisible&&(null===(t=this.popupRef.current)||void 0===t||t.forceAlign())}},{key:"fireEvents",value:function(t,e){var n=this.props.children.props[t];n&&n(e);var r=this.props[t];r&&r(e)}},{key:"close",value:function(){this.setPopupVisible(!1)}},{key:"render",value:function(){var t=this.state.popupVisible,e=this.props,n=e.children,r=e.forceRender,i=e.alignPoint,o=e.className,l=e.autoDestroy,u=s.Children.only(n),h={key:"trigger"};this.isContextMenuToShow()?h.onContextMenu=this.onContextMenu:h.onContextMenu=this.createTwoChains("onContextMenu"),this.isClickToHide()||this.isClickToShow()?(h.onClick=this.onClick,h.onMouseDown=this.onMouseDown,h.onTouchStart=this.onTouchStart):(h.onClick=this.createTwoChains("onClick"),h.onMouseDown=this.createTwoChains("onMouseDown"),h.onTouchStart=this.createTwoChains("onTouchStart")),this.isMouseEnterToShow()?(h.onMouseEnter=this.onMouseEnter,i&&(h.onMouseMove=this.onMouseMove)):h.onMouseEnter=this.createTwoChains("onMouseEnter"),this.isMouseLeaveToHide()?h.onMouseLeave=this.onMouseLeave:h.onMouseLeave=this.createTwoChains("onMouseLeave"),this.isFocusToShow()||this.isBlurToHide()?(h.onFocus=this.onFocus,h.onBlur=this.onBlur):(h.onFocus=this.createTwoChains("onFocus"),h.onBlur=this.createTwoChains("onBlur"));var d=c()(u&&u.props&&u.props.className,o);d&&(h.className=d);var f=Object(a.a)({},h);Object(ct.c)(u)&&(f.ref=Object(ct.a)(this.triggerRef,u.ref));var p,g=s.cloneElement(u,f);return(t||this.popupRef.current||r)&&(p=s.createElement(se,{key:"portal",getContainer:this.getContainer,didUpdate:this.handlePortalUpdate},this.getComponent())),!t&&l&&(p=null),s.createElement(ne.Provider,{value:this.triggerContextValue},g,p)}}],[{key:"getDerivedStateFromProps",value:function(t,e){var n=t.popupVisible,r={};return void 0!==n&&e.popupVisible!==n&&(r.popupVisible=n,r.prevPopupVisible=e.popupVisible),r}}]),n}(s.Component)).contextType=ne,le.defaultProps={prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:ie,getDocument:oe,onPopupVisibleChange:re,afterPopupVisibleChange:re,onPopupAlign:re,popupClassName:"",mouseEnterDelay:0,mouseLeaveDelay:.1,focusDelay:0,blurDelay:.15,popupStyle:{},destroyPopupOnHide:!1,popupAlign:{},defaultPopupVisible:!1,mask:!1,maskClosable:!0,action:[],showAction:[],hideAction:[],autoDestroy:!1},le),ue={adjustX:1,adjustY:1},he={topLeft:{points:["bl","tl"],overflow:ue,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:ue,offset:[0,7]},leftTop:{points:["tr","tl"],overflow:ue,offset:[-4,0]},rightTop:{points:["tl","tr"],overflow:ue,offset:[4,0]}},de={topLeft:{points:["bl","tl"],overflow:ue,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:ue,offset:[0,7]},rightTop:{points:["tr","tl"],overflow:ue,offset:[-4,0]},leftTop:{points:["tl","tr"],overflow:ue,offset:[4,0]}},fe=0,pe={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"},ge=function(t,e,n){var i=J(e),o=t.getState();t.setState({defaultActiveFirst:Object(a.a)(Object(a.a)({},o.defaultActiveFirst),{},Object(r.a)({},i,n))})},me=function(t){Object(w.a)(n,t);var e=Object(T.a)(n);function n(t){var r;Object(S.a)(this,n),(r=e.call(this,t)).onDestroy=function(t){r.props.onDestroy(t)},r.onKeyDown=function(t){var e=t.keyCode,n=r.menuInstance,i=r.props.store,o=r.getVisible();if(e===v.a.ENTER)return r.onTitleClick(t),ge(i,r.props.eventKey,!0),!0;if(e===v.a.RIGHT)return o?n.onKeyDown(t):(r.triggerOpenChange(!0),ge(i,r.props.eventKey,!0)),!0;if(e===v.a.LEFT){var a;if(!o)return;return(a=n.onKeyDown(t))||(r.triggerOpenChange(!1),a=!0),a}return!o||e!==v.a.UP&&e!==v.a.DOWN?void 0:n.onKeyDown(t)},r.onOpenChange=function(t){r.props.onOpenChange(t)},r.onPopupVisibleChange=function(t){r.triggerOpenChange(t,t?"mouseenter":"mouseleave")},r.onMouseEnter=function(t){var e=r.props,n=e.eventKey,i=e.onMouseEnter,o=e.store;ge(o,r.props.eventKey,!1),i({key:n,domEvent:t})},r.onMouseLeave=function(t){var e=r.props,n=e.parentMenu,i=e.eventKey,o=e.onMouseLeave;n.subMenuInstance=Object(k.a)(r),o({key:i,domEvent:t})},r.onTitleMouseEnter=function(t){var e=r.props,n=e.eventKey,i=e.onItemHover,o=e.onTitleMouseEnter;i({key:n,hover:!0}),o({key:n,domEvent:t})},r.onTitleMouseLeave=function(t){var e=r.props,n=e.parentMenu,i=e.eventKey,o=e.onItemHover,a=e.onTitleMouseLeave;n.subMenuInstance=Object(k.a)(r),o({key:i,hover:!1}),a({key:i,domEvent:t})},r.onTitleClick=function(t){var e=Object(k.a)(r).props;e.onTitleClick({key:e.eventKey,domEvent:t}),"hover"!==e.triggerSubMenuAction&&(r.triggerOpenChange(!r.getVisible(),"click"),ge(e.store,r.props.eventKey,!1))},r.onSubMenuClick=function(t){"function"==typeof r.props.onClick&&r.props.onClick(r.addKeyPath(t))},r.onSelect=function(t){r.props.onSelect(t)},r.onDeselect=function(t){r.props.onDeselect(t)},r.getPrefixCls=function(){return"".concat(r.props.rootPrefixCls,"-submenu")},r.getActiveClassName=function(){return"".concat(r.getPrefixCls(),"-active")},r.getDisabledClassName=function(){return"".concat(r.getPrefixCls(),"-disabled")},r.getSelectedClassName=function(){return"".concat(r.getPrefixCls(),"-selected")},r.getOpenClassName=function(){return"".concat(r.props.rootPrefixCls,"-submenu-open")},r.getVisible=function(){return r.state.isOpen},r.getMode=function(){return r.state.mode},r.saveMenuInstance=function(t){r.menuInstance=t},r.addKeyPath=function(t){return Object(a.a)(Object(a.a)({},t),{},{keyPath:(t.keyPath||[]).concat(r.props.eventKey)})},r.triggerOpenChange=function(t,e){var n=r.props.eventKey,i=function(){r.onOpenChange({key:n,item:Object(k.a)(r),trigger:e,open:t})};"mouseenter"===e?r.mouseenterTimeout=setTimeout((function(){i()}),0):i()},r.isChildrenSelected=function(){var t={find:!1};return function t(e,n,r){e&&!r.find&&s.Children.forEach(e,(function(e){if(e){var i=e.type;if(!i||!(i.isSubMenu||i.isMenuItem||i.isMenuItemGroup))return;-1!==n.indexOf(e.key)?r.find=!0:e.props.children&&t(e.props.children,n,r)}}))}(r.props.children,r.props.selectedKeys,t),t.find},r.isInlineMode=function(){return"inline"===r.getMode()},r.adjustWidth=function(){if(r.subMenuTitle&&r.menuInstance){var t=it.findDOMNode(r.menuInstance);t.offsetWidth>=r.subMenuTitle.offsetWidth||(t.style.minWidth="".concat(r.subMenuTitle.offsetWidth,"px"))}},r.saveSubMenuTitle=function(t){r.subMenuTitle=t},r.getBaseProps=function(){var t=Object(k.a)(r).props,e=r.getMode();return{mode:"horizontal"===e?"vertical":e,visible:r.getVisible(),level:t.level+1,inlineIndent:t.inlineIndent,focusable:!1,onClick:r.onSubMenuClick,onSelect:r.onSelect,onDeselect:r.onDeselect,onDestroy:r.onDestroy,selectedKeys:t.selectedKeys,eventKey:"".concat(t.eventKey,"-menu-"),openKeys:t.openKeys,motion:t.motion,onOpenChange:r.onOpenChange,subMenuOpenDelay:t.subMenuOpenDelay,parentMenu:Object(k.a)(r),subMenuCloseDelay:t.subMenuCloseDelay,forceSubMenuRender:t.forceSubMenuRender,triggerSubMenuAction:t.triggerSubMenuAction,builtinPlacements:t.builtinPlacements,defaultActiveFirst:t.store.getState().defaultActiveFirst[J(t.eventKey)],multiple:t.multiple,prefixCls:t.rootPrefixCls,id:r.internalMenuId,manualRef:r.saveMenuInstance,itemIcon:t.itemIcon,expandIcon:t.expandIcon,direction:t.direction}},r.getMotion=function(t,e){var n=Object(k.a)(r).haveRendered,i=r.props,o=i.motion,s=i.rootPrefixCls;return Object(a.a)(Object(a.a)({},o),{},{leavedClassName:"".concat(s,"-hidden"),removeOnLeave:!1,motionAppear:n||!e||"inline"!==t})};var i=t.store,o=t.eventKey,l=i.getState().defaultActiveFirst;r.isRootMenu=!1;var c=!1;return l&&(c=l[o]),ge(i,o,c),r.state={mode:t.mode,isOpen:t.isOpen},r}return Object(E.a)(n,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var t=this,e=this.props,n=e.mode,r=e.parentMenu,i=e.manualRef,o=e.isOpen,a=function(){t.setState({mode:n,isOpen:o})},s=o!==this.state.isOpen,l=n!==this.state.mode;(l||s)&&(at.a.cancel(this.updateStateRaf),l?this.updateStateRaf=Object(at.a)(a):a()),i&&i(this),"horizontal"===n&&(null==r?void 0:r.isRootMenu)&&o&&(this.minWidthTimeout=setTimeout((function(){return t.adjustWidth()}),0))}},{key:"componentWillUnmount",value:function(){var t=this.props,e=t.onDestroy,n=t.eventKey;e&&e(n),this.minWidthTimeout&&clearTimeout(this.minWidthTimeout),this.mouseenterTimeout&&clearTimeout(this.mouseenterTimeout),at.a.cancel(this.updateStateRaf)}},{key:"renderPopupMenu",value:function(t,e){var n=this.getBaseProps();return s.createElement(Te,Object(C.a)({},n,{id:this.internalMenuId,className:t,style:e}),this.props.children)}},{key:"renderChildren",value:function(){var t=this,e=this.getBaseProps(),n=e.mode,i=e.visible,o=e.forceSubMenuRender,a=e.direction,l=this.getMotion(n,i);if(this.haveRendered=!0,this.haveOpened=this.haveOpened||i||o,!this.haveOpened)return s.createElement("div",null);var u=c()("".concat(e.prefixCls,"-sub"),Object(r.a)({},"".concat(e.prefixCls,"-rtl"),"rtl"===a));return this.isInlineMode()?s.createElement(Ht,Object(C.a)({visible:e.visible,forceRender:o},l),(function(e){var n=e.className,r=e.style,i=c()(u,n);return t.renderPopupMenu(i,r)})):this.renderPopupMenu(u)}},{key:"render",value:function(){var t,e,n,i=Object(a.a)({},this.props),o=this.getVisible(),l=this.getPrefixCls(),u=this.isInlineMode(),h=this.getMode(),d=c()(l,"".concat(l,"-").concat(h),(t={},Object(r.a)(t,i.className,!!i.className),Object(r.a)(t,this.getOpenClassName(),o),Object(r.a)(t,this.getActiveClassName(),i.active||o&&!u),Object(r.a)(t,this.getDisabledClassName(),i.disabled),Object(r.a)(t,this.getSelectedClassName(),this.isChildrenSelected()),t));this.internalMenuId||(i.eventKey?this.internalMenuId="".concat(i.eventKey,"$Menu"):(fe+=1,this.internalMenuId="$__$".concat(fe,"$Menu")));var f={},p={},g={};i.disabled||(f={onMouseLeave:this.onMouseLeave,onMouseEnter:this.onMouseEnter},p={onClick:this.onTitleClick},g={onMouseEnter:this.onTitleMouseEnter,onMouseLeave:this.onTitleMouseLeave});var m={},v="rtl"===i.direction;u&&(v?m.paddingRight=i.inlineIndent*i.level:m.paddingLeft=i.inlineIndent*i.level);var y={};this.getVisible()&&(y={"aria-owns":this.internalMenuId});var b=null;"horizontal"!==h&&(b=this.props.expandIcon,"function"==typeof this.props.expandIcon&&(b=s.createElement(this.props.expandIcon,Object(a.a)({},this.props))));var x=s.createElement("div",Object(C.a)({ref:this.saveSubMenuTitle,style:m,className:"".concat(l,"-title"),role:"button"},g,p,{"aria-expanded":o},y,{"aria-haspopup":"true",title:"string"==typeof i.title?i.title:void 0}),i.title,b||s.createElement("i",{className:"".concat(l,"-arrow")})),S=this.renderChildren(),E=(null===(e=i.parentMenu)||void 0===e?void 0:e.isRootMenu)?i.parentMenu.props.getPopupContainer:function(t){return t.parentNode},k=pe[h],w=i.popupOffset?{offset:i.popupOffset}:{},T=c()((n={},Object(r.a)(n,i.popupClassName,i.popupClassName&&!u),Object(r.a)(n,"".concat(l,"-rtl"),v),n)),O=i.disabled,L=i.triggerSubMenuAction,A=i.subMenuOpenDelay,D=i.forceSubMenuRender,R=i.subMenuCloseDelay,M=i.builtinPlacements;tt.forEach((function(t){return delete i[t]})),delete i.onClick;var I=v?Object(a.a)(Object(a.a)({},de),M):Object(a.a)(Object(a.a)({},he),M);delete i.direction;var _=this.getBaseProps(),P=u?null:this.getMotion(_.mode,_.visible);return s.createElement("li",Object(C.a)({},i,f,{className:d,role:"menuitem"}),s.createElement(ce,{prefixCls:l,popupClassName:c()("".concat(l,"-popup"),T),getPopupContainer:E,builtinPlacements:I,popupPlacement:k,popupVisible:!u&&o,popupAlign:w,popup:u?null:S,action:O||u?[]:[L],mouseEnterDelay:A,mouseLeaveDelay:R,onPopupVisibleChange:this.onPopupVisibleChange,forceRender:D,popupMotion:P},x),u?S:null)}}]),n}(s.Component);me.defaultProps={onMouseEnter:$,onMouseLeave:$,onTitleMouseEnter:$,onTitleMouseLeave:$,onTitleClick:$,manualRef:$,mode:"vertical",title:""};var ve=Object(O.b)((function(t,e){var n=t.openKeys,r=t.activeKey,i=t.selectedKeys,o=e.eventKey,a=e.subMenuKey;return{isOpen:n.indexOf(o)>-1,active:r[a]===o,selectedKeys:i}}))(me);ve.isSubMenu=!0;var ye=ve,be=function(t){Object(w.a)(n,t);var e=Object(T.a)(n);function n(){var t;return Object(S.a)(this,n),(t=e.apply(this,arguments)).resizeObserver=null,t.mutationObserver=null,t.originalTotalWidth=0,t.overflowedItems=[],t.menuItemSizes=[],t.cancelFrameId=null,t.state={lastVisibleIndex:void 0},t.childRef=s.createRef(),t.getMenuItemNodes=function(){var e=t.props.prefixCls,n=t.childRef.current;return n?[].slice.call(n.children).filter((function(t){return t.className.split(" ").indexOf("".concat(e,"-overflowed-submenu"))<0})):[]},t.getOverflowedSubMenuItem=function(e,n,r){var i=t.props,l=i.overflowedIndicator,c=i.level,u=i.mode,h=i.prefixCls,d=i.theme;if(1!==c||"horizontal"!==u)return null;var f=t.props.children[0].props,p=(f.children,f.title,f.style),g=Object(o.a)(f,["children","title","style"]),m=Object(a.a)({},p),v="".concat(e,"-overflowed-indicator"),y="".concat(e,"-overflowed-indicator");0===n.length&&!0!==r?m=Object(a.a)(Object(a.a)({},m),{},{display:"none"}):r&&(m=Object(a.a)(Object(a.a)({},m),{},{visibility:"hidden",position:"absolute"}),v="".concat(v,"-placeholder"),y="".concat(y,"-placeholder"));var b=d?"".concat(h,"-").concat(d):"",x={};return tt.forEach((function(t){void 0!==g[t]&&(x[t]=g[t])})),s.createElement(ye,Object(C.a)({title:l,className:"".concat(h,"-overflowed-submenu"),popupClassName:b},x,{key:v,eventKey:y,disabled:!1,style:m}),n)},t.setChildrenWidthAndResize=function(){if("horizontal"===t.props.mode){var e=t.childRef.current;if(e){var n=e.children;if(n&&0!==n.length){var r=e.children[n.length-1];nt(r,"display","inline-block");var i=t.getMenuItemNodes(),o=i.filter((function(t){return t.className.split(" ").indexOf("menuitem-overflowed")>=0}));o.forEach((function(t){nt(t,"display","inline-block")})),t.menuItemSizes=i.map((function(t){return et(t,!0)})),o.forEach((function(t){nt(t,"display","none")})),t.overflowedIndicatorWidth=et(e.children[e.children.length-1],!0),t.originalTotalWidth=t.menuItemSizes.reduce((function(t,e){return t+e}),0),t.handleResize(),nt(r,"display","none")}}}},t.handleResize=function(){if("horizontal"===t.props.mode){var e=t.childRef.current;if(e){var n=et(e);t.overflowedItems=[];var r,i=0;t.originalTotalWidth>n+.5&&(r=-1,t.menuItemSizes.forEach((function(e){(i+=e)+t.overflowedIndicatorWidth<=n&&(r+=1)}))),t.setState({lastVisibleIndex:r})}}},t}return Object(E.a)(n,[{key:"componentDidMount",value:function(){var t=this;if(this.setChildrenWidthAndResize(),1===this.props.level&&"horizontal"===this.props.mode){var e=this.childRef.current;if(!e)return;this.resizeObserver=new rt.default((function(e){e.forEach((function(){var e=t.cancelFrameId;cancelAnimationFrame(e),t.cancelFrameId=requestAnimationFrame(t.setChildrenWidthAndResize)}))})),[].slice.call(e.children).concat(e).forEach((function(e){t.resizeObserver.observe(e)})),"undefined"!=typeof MutationObserver&&(this.mutationObserver=new MutationObserver((function(){t.resizeObserver.disconnect(),[].slice.call(e.children).concat(e).forEach((function(e){t.resizeObserver.observe(e)})),t.setChildrenWidthAndResize()})),this.mutationObserver.observe(e,{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(t){var e=this,n=this.state.lastVisibleIndex;return(t||[]).reduce((function(r,i,o){var a=i;if("horizontal"===e.props.mode){var l=e.getOverflowedSubMenuItem(i.props.eventKey,[]);void 0!==n&&-1!==e.props.className.indexOf("".concat(e.props.prefixCls,"-root"))&&(o>n&&(a=s.cloneElement(i,{style:{display:"none"},eventKey:"".concat(i.props.eventKey,"-hidden"),className:"".concat("menuitem-overflowed")})),o===n+1&&(e.overflowedItems=t.slice(n+1).map((function(t){return s.cloneElement(t,{key:t.props.eventKey,mode:"vertical-left"})})),l=e.getOverflowedSubMenuItem(i.props.eventKey,e.overflowedItems)));var c=[].concat(Object(d.a)(r),[l,a]);return o===t.length-1&&c.push(e.getOverflowedSubMenuItem(i.props.eventKey,[],!0)),c}return[].concat(Object(d.a)(r),[a])}),[])}},{key:"render",value:function(){var t=this.props,e=(t.visible,t.prefixCls,t.overflowedIndicator,t.mode,t.level,t.tag),n=t.children,r=(t.theme,Object(o.a)(t,["visible","prefixCls","overflowedIndicator","mode","level","tag","children","theme"])),i=e;return s.createElement(i,Object(C.a)({ref:this.childRef},r),this.renderChildren(n))}}]),n}(s.Component);be.defaultProps={tag:"div",className:""};var xe=be;function Ce(t,e,n){var i=t.getState();t.setState({activeKey:Object(a.a)(Object(a.a)({},i.activeKey),{},Object(r.a)({},e,n))})}function Se(t){return t.eventKey||"0-menu-"}function Ee(t,e){var n,r=e,i=t.children,o=t.eventKey;if(r&&(Q(i,(function(t,e){t&&t.props&&!t.props.disabled&&r===Z(t,o,e)&&(n=!0)})),n))return r;return r=null,t.defaultActiveFirst?(Q(i,(function(t,e){r||!t||t.props.disabled||(r=Z(t,o,e))})),r):r}function ke(t){if(t){var e=this.instanceArray.indexOf(t);-1!==e?this.instanceArray[e]=t:this.instanceArray.push(t)}}var we=function(t){Object(w.a)(n,t);var e=Object(T.a)(n);function n(t){var i;return Object(S.a)(this,n),(i=e.call(this,t)).onKeyDown=function(t,e){var n,r=t.keyCode;if(i.getFlatInstanceArray().forEach((function(e){e&&e.props.active&&e.onKeyDown&&(n=e.onKeyDown(t))})),n)return 1;var o=null;return r!==v.a.UP&&r!==v.a.DOWN||(o=i.step(r===v.a.UP?-1:1)),o?(t.preventDefault(),Ce(i.props.store,Se(i.props),o.props.eventKey),"function"==typeof e&&e(o),1):void 0},i.onItemHover=function(t){var e=t.key,n=t.hover;Ce(i.props.store,Se(i.props),n?e:null)},i.onDeselect=function(t){i.props.onDeselect(t)},i.onSelect=function(t){i.props.onSelect(t)},i.onClick=function(t){i.props.onClick(t)},i.onOpenChange=function(t){i.props.onOpenChange(t)},i.onDestroy=function(t){i.props.onDestroy(t)},i.getFlatInstanceArray=function(){return i.instanceArray},i.step=function(t){var e=i.getFlatInstanceArray(),n=i.props.store.getState().activeKey[Se(i.props)],r=e.length;if(!r)return null;t<0&&(e=e.concat().reverse());var o=-1;if(e.every((function(t,e){return!t||t.props.eventKey!==n||(o=e,!1)})),i.props.defaultActiveFirst||-1===o||(a=e.slice(o,r-1)).length&&!a.every((function(t){return!!t.props.disabled}))){var a,s=(o+1)%r,l=s;do{var c=e[l];if(c&&!c.props.disabled)return c;l=(l+1)%r}while(l!==s);return null}},i.renderCommonMenuItem=function(t,e,n){var r=i.props.store.getState(),o=Object(k.a)(i).props,l=Z(t,o.eventKey,e),c=t.props;if(!c||"string"==typeof t.type)return t;var u=l===r.activeKey,h=Object(a.a)(Object(a.a)({mode:c.mode||o.mode,level:o.level,inlineIndent:o.inlineIndent,renderMenuItem:i.renderMenuItem,rootPrefixCls:o.prefixCls,index:e,parentMenu:o.parentMenu,manualRef:c.disabled?void 0:Object(A.a)(t.ref,ke.bind(Object(k.a)(i))),eventKey:l,active:!c.disabled&&u,multiple:o.multiple,onClick:function(t){(c.onClick||$)(t),i.onClick(t)},onItemHover:i.onItemHover,motion:o.motion,subMenuOpenDelay:o.subMenuOpenDelay,subMenuCloseDelay:o.subMenuCloseDelay,forceSubMenuRender:o.forceSubMenuRender,onOpenChange:i.onOpenChange,onDeselect:i.onDeselect,onSelect:i.onSelect,builtinPlacements:o.builtinPlacements,itemIcon:c.itemIcon||i.props.itemIcon,expandIcon:c.expandIcon||i.props.expandIcon},n),{},{direction:o.direction});return("inline"===o.mode||X.any)&&(h.triggerSubMenuAction="click"),s.cloneElement(t,Object(a.a)(Object(a.a)({},h),{},{key:l||e}))},i.renderMenuItem=function(t,e,n){if(!t)return null;var r=i.props.store.getState(),o={openKeys:r.openKeys,selectedKeys:r.selectedKeys,triggerSubMenuAction:i.props.triggerSubMenuAction,subMenuKey:n};return i.renderCommonMenuItem(t,e,o)},t.store.setState({activeKey:Object(a.a)(Object(a.a)({},t.store.getState().activeKey),{},Object(r.a)({},t.eventKey,Ee(t,t.activeKey)))}),i.instanceArray=[],i}return Object(E.a)(n,[{key:"componentDidMount",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"shouldComponentUpdate",value:function(t){return this.props.visible||t.visible||this.props.className!==t.className||!R()(this.props.style,t.style)}},{key:"componentDidUpdate",value:function(t){var e=this.props,n="activeKey"in e?e.activeKey:e.store.getState().activeKey[Se(e)],r=Ee(e,n);if(r!==n)Ce(e.store,Se(e),r);else if("activeKey"in t){r!==Ee(t,t.activeKey)&&Ce(e.store,Se(e),r)}}},{key:"render",value:function(){var t=this,e=Object(C.a)({},this.props);this.instanceArray=[];var n={className:c()(e.prefixCls,e.className,"".concat(e.prefixCls,"-").concat(e.mode)),role:e.role||"menu"};e.id&&(n.id=e.id),e.focusable&&(n.tabIndex=0,n.onKeyDown=this.onKeyDown);var r=e.prefixCls,i=e.eventKey,o=e.visible,a=e.level,l=e.mode,h=e.overflowedIndicator,d=e.theme;return tt.forEach((function(t){return delete e[t]})),delete e.onClick,s.createElement(xe,Object(C.a)({},e,{prefixCls:r,mode:l,tag:"ul",level:a,theme:d,visible:o,overflowedIndicator:h},n),Object(u.a)(e.children).map((function(e,n){return t.renderMenuItem(e,n,i||"0-menu-")})))}}]),n}(s.Component);we.defaultProps={prefixCls:"rc-menu",className:"",mode:"vertical",level:1,inlineIndent:24,visible:!0,focusable:!0,style:{},manualRef:$};var Te=Object(O.b)()(we),Oe=n("Kwbf");function Le(t,e,n){var r=t.prefixCls,i=t.motion,o=t.defaultMotions,a=void 0===o?{}:o,s=t.openAnimation,l=t.openTransitionName,c=e.switchingModeFromInline;if(i)return i;if("object"===Object(M.a)(s)&&s)Object(Oe.a)(!1,"Object type of `openAnimation` is removed. Please use `motion` instead.");else if("string"==typeof s)return{motionName:"".concat(r,"-open-").concat(s)};if(l)return{motionName:l};var u=a[n];return u||(c?null:a.other)}var Ae=function(t){Object(w.a)(n,t);var e=Object(T.a)(n);function n(t){var r;Object(S.a)(this,n),(r=e.call(this,t)).onSelect=function(t){var e=Object(k.a)(r).props;if(e.selectable){var n=r.store.getState().selectedKeys,i=t.key;n=e.multiple?n.concat([i]):[i],"selectedKeys"in e||r.store.setState({selectedKeys:n}),e.onSelect(Object(a.a)(Object(a.a)({},t),{},{selectedKeys:n}))}},r.onClick=function(t){var e=r.getRealMenuMode(),n=Object(k.a)(r),i=n.store,o=n.props.onOpenChange;"inline"===e||"openKeys"in r.props||(i.setState({openKeys:[]}),o([])),r.props.onClick(t)},r.onKeyDown=function(t,e){r.innerMenu.getWrappedInstance().onKeyDown(t,e)},r.onOpenChange=function(t){var e=Object(k.a)(r).props,n=r.store.getState().openKeys.concat(),i=!1,o=function(t){var e=!1;if(t.open)(e=-1===n.indexOf(t.key))&&n.push(t.key);else{var r=n.indexOf(t.key);(e=-1!==r)&&n.splice(r,1)}i=i||e};Array.isArray(t)?t.forEach(o):o(t),i&&("openKeys"in r.props||r.store.setState({openKeys:n}),e.onOpenChange(n))},r.onDeselect=function(t){var e=Object(k.a)(r).props;if(e.selectable){var n=r.store.getState().selectedKeys.concat(),i=t.key,o=n.indexOf(i);-1!==o&&n.splice(o,1),"selectedKeys"in e||r.store.setState({selectedKeys:n}),e.onDeselect(Object(a.a)(Object(a.a)({},t),{},{selectedKeys:n}))}},r.onMouseEnter=function(t){r.restoreModeVerticalFromInline();var e=r.props.onMouseEnter;e&&e(t)},r.onTransitionEnd=function(t){var e="width"===t.propertyName&&t.target===t.currentTarget,n=t.target.className,i="[object SVGAnimatedString]"===Object.prototype.toString.call(n)?n.animVal:n,o="font-size"===t.propertyName&&i.indexOf("anticon")>=0;(e||o)&&r.restoreModeVerticalFromInline()},r.setInnerMenu=function(t){r.innerMenu=t},r.isRootMenu=!0;var i=t.defaultSelectedKeys,o=t.defaultOpenKeys;return"selectedKeys"in t&&(i=t.selectedKeys||[]),"openKeys"in t&&(o=t.openKeys||[]),r.store=Object(O.c)({selectedKeys:i,openKeys:o,activeKey:{"0-menu-":Ee(t,t.activeKey)}}),r.state={switchingModeFromInline:!1,prevProps:t,inlineOpenKeys:[],store:r.store},r}return Object(E.a)(n,[{key:"componentDidMount",value:function(){this.updateMiniStore(),this.updateMenuDisplay()}},{key:"componentDidUpdate",value:function(t){var e=this.props,n=e.siderCollapsed,r=e.inlineCollapsed,i=e.onOpenChange;(!t.inlineCollapsed&&r||!t.siderCollapsed&&n)&&i([]),this.updateMiniStore(),this.updateMenuDisplay()}},{key:"updateMenuDisplay",value:function(){var t=this.props.collapsedWidth,e=this.store,n=this.prevOpenKeys;this.getInlineCollapsed()&&(0===t||"0"===t||"0px"===t)?(this.prevOpenKeys=e.getState().openKeys.concat(),this.store.setState({openKeys:[]})):n&&(this.store.setState({openKeys:n}),this.prevOpenKeys=null)}},{key:"getRealMenuMode",value:function(){var t=this.props.mode,e=this.state.switchingModeFromInline,n=this.getInlineCollapsed();return e&&n?"inline":n?"vertical":t}},{key:"getInlineCollapsed",value:function(){var t=this.props,e=t.inlineCollapsed,n=t.siderCollapsed;return void 0!==n?n:e}},{key:"restoreModeVerticalFromInline",value:function(){this.state.switchingModeFromInline&&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 t=Object(a.a)({},Object(L.a)(this.props,["collapsedWidth","siderCollapsed","defaultMotions"])),e=this.getRealMenuMode();return t.className+=" ".concat(t.prefixCls,"-root"),"rtl"===t.direction&&(t.className+=" ".concat(t.prefixCls,"-rtl")),delete(t=Object(a.a)(Object(a.a)({},t),{},{mode:e,onClick:this.onClick,onOpenChange:this.onOpenChange,onDeselect:this.onDeselect,onSelect:this.onSelect,onMouseEnter:this.onMouseEnter,onTransitionEnd:this.onTransitionEnd,parentMenu:this,motion:Le(this.props,this.state,e)})).openAnimation,delete t.openTransitionName,s.createElement(O.a,{store:this.store},s.createElement(Te,Object(C.a)({},t,{ref:this.setInnerMenu}),this.props.children))}}],[{key:"getDerivedStateFromProps",value:function(t,e){var n=e.prevProps,r=e.store,i=r.getState(),o={},a={prevProps:t};return"inline"===n.mode&&"inline"!==t.mode&&(a.switchingModeFromInline=!0),"openKeys"in t?o.openKeys=t.openKeys||[]:((t.inlineCollapsed&&!n.inlineCollapsed||t.siderCollapsed&&!n.siderCollapsed)&&(a.switchingModeFromInline=!0,a.inlineOpenKeys=i.openKeys,o.openKeys=[]),(!t.inlineCollapsed&&n.inlineCollapsed||!t.siderCollapsed&&n.siderCollapsed)&&(o.openKeys=e.inlineOpenKeys,a.inlineOpenKeys=[])),Object.keys(o).length&&r.setState(o),a}}]),n}(s.Component);Ae.defaultProps={selectable:!0,onClick:$,onSelect:$,onOpenChange:$,onDeselect:$,defaultSelectedKeys:[],defaultOpenKeys:[],subMenuOpenDelay:.1,subMenuCloseDelay:.1,triggerSubMenuAction:"hover",prefixCls:"rc-menu",className:"",mode:"vertical",style:{},builtinPlacements:{},overflowedIndicator:s.createElement("span",null,"···")};var De=Ae,Re=function(t){Object(w.a)(n,t);var e=Object(T.a)(n);function n(){var t;return Object(S.a)(this,n),(t=e.apply(this,arguments)).onKeyDown=function(e){if(e.keyCode===v.a.ENTER)return t.onClick(e),!0},t.onMouseLeave=function(e){var n=t.props,r=n.eventKey,i=n.onItemHover,o=n.onMouseLeave;i({key:r,hover:!1}),o({key:r,domEvent:e})},t.onMouseEnter=function(e){var n=t.props,r=n.eventKey,i=n.onItemHover,o=n.onMouseEnter;i({key:r,hover:!0}),o({key:r,domEvent:e})},t.onClick=function(e){var n=t.props,r=n.eventKey,i=n.multiple,o=n.onClick,a=n.onSelect,s=n.onDeselect,l=n.isSelected,c={key:r,keyPath:[r],item:Object(k.a)(t),domEvent:e};o(c),i?l?s(c):a(c):l||a(c)},t.saveNode=function(e){t.node=e},t}return Object(E.a)(n,[{key:"componentDidMount",value:function(){this.callRef()}},{key:"componentDidUpdate",value:function(){this.callRef()}},{key:"componentWillUnmount",value:function(){var t=this.props;t.onDestroy&&t.onDestroy(t.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 t,e=Object(a.a)({},this.props),n=c()(this.getPrefixCls(),e.className,(t={},Object(r.a)(t,this.getActiveClassName(),!e.disabled&&e.active),Object(r.a)(t,this.getSelectedClassName(),e.isSelected),Object(r.a)(t,this.getDisabledClassName(),e.disabled),t)),i=Object(a.a)(Object(a.a)({},e.attribute),{},{title:"string"==typeof e.title?e.title:void 0,className:n,role:e.role||"menuitem","aria-disabled":e.disabled});"option"===e.role?i=Object(a.a)(Object(a.a)({},i),{},{role:"option","aria-selected":e.isSelected}):null!==e.role&&"none"!==e.role||(i.role="none");var o={onClick:e.disabled?null:this.onClick,onMouseLeave:e.disabled?null:this.onMouseLeave,onMouseEnter:e.disabled?null:this.onMouseEnter},l=Object(a.a)({},e.style);"inline"===e.mode&&("rtl"===e.direction?l.paddingRight=e.inlineIndent*e.level:l.paddingLeft=e.inlineIndent*e.level),tt.forEach((function(t){return delete e[t]})),delete e.direction;var u=this.props.itemIcon;return"function"==typeof this.props.itemIcon&&(u=s.createElement(this.props.itemIcon,this.props)),s.createElement("li",Object(C.a)({},Object(L.a)(e,["onClick","onMouseEnter","onMouseLeave","onSelect"]),i,o,{style:l,ref:this.saveNode}),e.children,u)}}]),n}(s.Component);Re.isMenuItem=!0,Re.defaultProps={onSelect:$,onMouseEnter:$,onMouseLeave:$,manualRef:$};var Me=Object(O.b)((function(t,e){var n=t.activeKey,r=t.selectedKeys,i=e.eventKey;return{active:n[e.subMenuKey]===i,isSelected:Array.isArray(r)?-1!==r.indexOf(i):r===i}}))(Re),Ie=function(t){Object(w.a)(n,t);var e=Object(T.a)(n);function n(){var t;return Object(S.a)(this,n),(t=e.apply(this,arguments)).renderInnerMenuItem=function(e){var n=t.props;return(0,n.renderMenuItem)(e,n.index,t.props.subMenuKey)},t}return Object(E.a)(n,[{key:"render",value:function(){var t=Object(C.a)({},this.props),e=t.className,n=void 0===e?"":e,r=t.rootPrefixCls,i="".concat(r,"-item-group-title"),o="".concat(r,"-item-group-list"),a=t.title,l=t.children;return tt.forEach((function(e){return delete t[e]})),delete t.direction,s.createElement("li",Object(C.a)({},t,{onClick:function(t){return t.stopPropagation()},className:"".concat(n," ").concat(r,"-item-group")}),s.createElement("div",{className:i,title:"string"==typeof a?a:void 0},a),s.createElement("ul",{className:o},s.Children.map(l,this.renderInnerMenuItem)))}}]),n}(s.Component);Ie.isMenuItemGroup=!0,Ie.defaultProps={disabled:!0};var _e=function(t){var e=t.className,n=t.rootPrefixCls,r=t.style;return s.createElement("li",{className:"".concat(e," ").concat(n,"-item-divider"),style:r})};_e.defaultProps={disabled:!0,className:"",style:{}};var Pe=De,Ne=n("eDIo");var je=s.forwardRef((function(t,e){var n=t.prefixCls,r=t.editable,i=t.locale,o=t.style;return r&&!1!==r.showAdd?s.createElement("button",{ref:e,type:"button",className:"".concat(n,"-nav-add"),style:o,"aria-label":(null==i?void 0:i.addAriaLabel)||"Add tab",onClick:function(t){r.onEdit("add",{event:t})}},r.addIcon||"+"):null}));var Fe=s.forwardRef((function(t,e){var n=t.prefixCls,o=t.id,a=t.tabs,l=t.locale,u=t.mobile,h=t.moreIcon,d=void 0===h?"More":h,f=t.moreTransitionName,p=t.style,g=t.className,m=t.editable,y=t.tabBarGutter,b=t.rtl,x=t.onTabClick,C=Object(s.useState)(!1),S=Object(i.a)(C,2),E=S[0],k=S[1],w=Object(s.useState)(null),T=Object(i.a)(w,2),O=T[0],L=T[1],A="".concat(o,"-more-popup"),D="".concat(n,"-dropdown"),R=null!==O?"".concat(A,"-").concat(O):null,M=null==l?void 0:l.dropdownAriaLabel,I=s.createElement(Pe,{onClick:function(t){var e=t.key,n=t.domEvent;x(e,n),k(!1)},id:A,tabIndex:-1,role:"listbox","aria-activedescendant":R,selectedKeys:[O],"aria-label":void 0!==M?M:"expanded dropdown"},a.map((function(t){return s.createElement(Me,{key:t.key,id:"".concat(A,"-").concat(t.key),role:"option","aria-controls":o&&"".concat(o,"-panel-").concat(t.key),disabled:t.disabled},t.tab)})));function _(t){for(var e=a.filter((function(t){return!t.disabled})),n=e.findIndex((function(t){return t.key===O}))||0,r=e.length,i=0;i<r;i+=1){var o=e[n=(n+t+r)%r];if(!o.disabled)return void L(o.key)}}Object(s.useEffect)((function(){var t=document.getElementById(R);t&&t.scrollIntoView&&t.scrollIntoView(!1)}),[O]),Object(s.useEffect)((function(){E||L(null)}),[E]);var P=Object(r.a)({},b?"marginLeft":"marginRight",y);a.length||(P.visibility="hidden",P.order=1);var N=c()(Object(r.a)({},"".concat(D,"-rtl"),b)),j=u?null:s.createElement(Ne.a,{prefixCls:D,overlay:I,trigger:["hover"],visible:E,transitionName:f,onVisibleChange:k,overlayClassName:N,mouseEnterDelay:.1,mouseLeaveDelay:.1},s.createElement("button",{type:"button",className:"".concat(n,"-nav-more"),style:P,tabIndex:-1,"aria-hidden":"true","aria-haspopup":"listbox","aria-controls":A,id:"".concat(o,"-more"),"aria-expanded":E,onKeyDown:function(t){var e=t.which;if(E)switch(e){case v.a.UP:_(-1),t.preventDefault();break;case v.a.DOWN:_(1),t.preventDefault();break;case v.a.ESC:k(!1);break;case v.a.SPACE:case v.a.ENTER:null!==O&&x(O,t)}else[v.a.DOWN,v.a.SPACE,v.a.ENTER].includes(e)&&(k(!0),t.preventDefault())}},d));return s.createElement("div",{className:c()("".concat(n,"-nav-operations"),g),style:p,ref:e},j,s.createElement(je,{prefixCls:n,locale:l,editable:m}))})),Be=Object(s.createContext)(null),Ue=Math.pow(.995,20);function He(t,e){var n=s.useRef(t),r=s.useState({}),o=Object(i.a)(r,2)[1];return[n.current,function(t){var r="function"==typeof t?t(n.current):t;r!==n.current&&e(r,n.current),n.current=r,o({})}]}var ze=function(t){var e,n=t.position,r=t.prefixCls,i=t.extra;if(!i)return null;var o=i;return"right"===n&&(e=o.right||!o.left&&o||null),"left"===n&&(e=o.left||null),e?s.createElement("div",{className:"".concat(r,"-extra-content")},e):null};var Ge=s.forwardRef((function(t,e){var n,o,l=s.useContext(Be),u=l.prefixCls,h=l.tabs,f=t.className,v=t.style,C=t.id,S=t.animated,E=t.activeKey,k=t.rtl,w=t.extra,T=t.editable,O=t.locale,L=t.tabPosition,A=t.tabBarGutter,D=t.children,R=t.onTabClick,M=t.onTabScroll,I=Object(s.useRef)(),_=Object(s.useRef)(),P=Object(s.useRef)(),N=Object(s.useRef)(),j=(o=Object(s.useRef)(new Map),[function(t){return o.current.has(t)||o.current.set(t,s.createRef()),o.current.get(t)},function(t){o.current.delete(t)}]),F=Object(i.a)(j,2),B=F[0],U=F[1],H="top"===L||"bottom"===L,z=He(0,(function(t,e){H&&M&&M({direction:t>e?"left":"right"})})),G=Object(i.a)(z,2),V=G[0],W=G[1],K=He(0,(function(t,e){!H&&M&&M({direction:t>e?"top":"bottom"})})),q=Object(i.a)(K,2),Y=q[0],X=q[1],$=Object(s.useState)(0),Z=Object(i.a)($,2),J=Z[0],Q=Z[1],tt=Object(s.useState)(0),et=Object(i.a)(tt,2),nt=et[0],rt=et[1],it=Object(s.useState)(0),ot=Object(i.a)(it,2),at=ot[0],st=ot[1],lt=Object(s.useState)(0),ct=Object(i.a)(lt,2),ut=ct[0],ht=ct[1],dt=Object(s.useState)(null),ft=Object(i.a)(dt,2),pt=ft[0],gt=ft[1],mt=Object(s.useState)(null),vt=Object(i.a)(mt,2),yt=vt[0],bt=vt[1],xt=Object(s.useState)(0),Ct=Object(i.a)(xt,2),St=Ct[0],Et=Ct[1],kt=Object(s.useState)(0),wt=Object(i.a)(kt,2),Tt=wt[0],Ot=wt[1],Lt=function(t){var e=Object(s.useRef)([]),n=Object(s.useState)({}),r=Object(i.a)(n,2)[1],o=Object(s.useRef)("function"==typeof t?t():t),a=m((function(){var t=o.current;e.current.forEach((function(e){t=e(t)})),e.current=[],o.current=t,r({})}));return[o.current,function(t){e.current.push(t),a()}]}(new Map),At=Object(i.a)(Lt,2),Dt=At[0],Rt=At[1],Mt=function(t,e,n){return Object(s.useMemo)((function(){for(var n,r=new Map,i=e.get(null===(n=t[0])||void 0===n?void 0:n.key)||b,o=i.left+i.width,s=0;s<t.length;s+=1){var l,c=t[s].key,u=e.get(c);if(!u)u=e.get(null===(l=t[s-1])||void 0===l?void 0:l.key)||b;var h=r.get(c)||Object(a.a)({},u);h.right=o-h.left-h.width,r.set(c,h)}return r}),[t.map((function(t){return t.key})).join("_"),e,n])}(h,Dt,J),It="".concat(u,"-nav-operations-hidden"),_t=0,Pt=0;function Nt(t){return t<_t?[_t,!1]:t>Pt?[Pt,!1]:[t,!0]}H?k?(_t=0,Pt=Math.max(0,J-pt)):(_t=Math.min(0,pt-J),Pt=0):(_t=Math.min(0,yt-nt),Pt=0);var jt=Object(s.useRef)(),Ft=Object(s.useState)(),Bt=Object(i.a)(Ft,2),Ut=Bt[0],Ht=Bt[1];function zt(){Ht(Date.now())}function Gt(){window.clearTimeout(jt.current)}function Vt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:E,e=Mt.get(t);if(e)if(H){var n=V;k?e.right<V?n=e.right:e.right+e.width>V+pt&&(n=e.right+e.width-pt):e.left<-V?n=-e.left:e.left+e.width>-V+pt&&(n=-(e.left+e.width-pt)),X(0),W(Nt(n)[0])}else{var r=Y;e.top<-Y?r=-e.top:e.top+e.height>-Y+yt&&(r=-(e.top+e.height-yt)),W(0),X(Nt(r)[0])}}!function(t,e){var n=Object(s.useState)(),r=Object(i.a)(n,2),o=r[0],a=r[1],l=Object(s.useState)(0),c=Object(i.a)(l,2),u=c[0],h=c[1],d=Object(s.useState)(0),f=Object(i.a)(d,2),p=f[0],g=f[1],m=Object(s.useState)(),v=Object(i.a)(m,2),y=v[0],b=v[1],x=Object(s.useRef)(),C=Object(s.useRef)(0),S=Object(s.useRef)(!1),E=Object(s.useRef)(),k=Object(s.useRef)(null);k.current={onTouchStart:function(t){var e=t.touches[0],n=e.screenX,r=e.screenY;a({x:n,y:r}),window.clearInterval(x.current)},onTouchMove:function(t){if(o){t.preventDefault();var n=t.touches[0],r=n.screenX,i=n.screenY;a({x:r,y:i});var s=r-o.x,l=i-o.y;e(s,l);var c=Date.now();h(c),g(c-u),b({x:s,y:l})}},onTouchEnd:function(){if(o&&(a(null),b(null),y)){var t=y.x/p,n=y.y/p,r=Math.abs(t),i=Math.abs(n);if(Math.max(r,i)<.1)return;var s=t,l=n;x.current=window.setInterval((function(){Math.abs(s)<.01&&Math.abs(l)<.01?window.clearInterval(x.current):e(20*(s*=Ue),20*(l*=Ue))}),20)}},onWheel:function(t){var n=t.deltaX,r=t.deltaY,i=0,o=Math.abs(n),a=Math.abs(r);o===a?i="x"===E.current?n:r:o>a?(i=n,E.current="x"):(i=r,E.current="y");var s=Date.now();s-C.current>100&&(S.current=!1),(e(-i,-i)||S.current)&&(t.preventDefault(),S.current=!0),C.current=s}},s.useEffect((function(){function e(t){k.current.onTouchMove(t)}function n(t){k.current.onTouchEnd(t)}return document.addEventListener("touchmove",e,{passive:!1}),document.addEventListener("touchend",n,{passive:!1}),t.current.addEventListener("touchstart",(function(t){k.current.onTouchStart(t)}),{passive:!1}),t.current.addEventListener("wheel",(function(t){k.current.onWheel(t)})),function(){document.removeEventListener("touchmove",e),document.removeEventListener("touchend",n)}}),[])}(I,(function(t,e){var n=!1;function r(t,e){t((function(t){var r=Nt(t+e),o=Object(i.a)(r,2),a=o[0],s=o[1];return n=s,a}))}if(H){if(pt>=J)return n;r(W,t)}else{if(yt>=nt)return n;r(X,e)}return Gt(),zt(),n})),Object(s.useEffect)((function(){return Gt(),Ut&&(jt.current=window.setTimeout((function(){Ht(0)}),100)),Gt}),[Ut]);var Wt=function(t,e,n,r,i){var o,a,l,c=i.tabs,u=i.tabPosition,h=i.rtl;["top","bottom"].includes(u)?(o="width",a=h?"right":"left",l=Math.abs(e.left)):(o="height",a="top",l=-e.top);var d=e[o],f=n[o],p=r[o],g=d;return f+p>d&&(g=d-p),Object(s.useMemo)((function(){if(!c.length)return[0,0];for(var e=c.length,n=e,r=0;r<e;r+=1){var i=t.get(c[r].key)||x;if(i[a]+i[o]>l+g){n=r-1;break}}for(var s=0,u=e-1;u>=0;u-=1){if((t.get(c[u].key)||x)[a]<l){s=u+1;break}}return[s,n]}),[t,l,g,u,c.map((function(t){return t.key})).join("_"),h])}(Mt,{width:pt,height:yt,left:V,top:Y},{width:at,height:ut},{width:St,height:Tt},Object(a.a)(Object(a.a)({},t),{},{tabs:h})),Kt=Object(i.a)(Wt,2),qt=Kt[0],Yt=Kt[1],Xt=h.map((function(t){var e=t.key;return s.createElement(y,{id:C,prefixCls:u,key:e,rtl:k,tab:t,closable:t.closable,editable:T,active:e===E,tabPosition:L,tabBarGutter:A,renderWrapper:D,removeAriaLabel:null==O?void 0:O.removeAriaLabel,ref:B(e),onClick:function(t){R(e,t)},onRemove:function(){U(e)},onFocus:function(){Vt(e),zt(),k||(I.current.scrollLeft=0),I.current.scrollTop=0}})})),$t=m((function(){var t,e,n,r,i,o,a,s,l,c=(null===(t=I.current)||void 0===t?void 0:t.offsetWidth)||0,u=(null===(e=I.current)||void 0===e?void 0:e.offsetHeight)||0,d=(null===(n=N.current)||void 0===n?void 0:n.offsetWidth)||0,f=(null===(r=N.current)||void 0===r?void 0:r.offsetHeight)||0,p=(null===(i=P.current)||void 0===i?void 0:i.offsetWidth)||0,g=(null===(o=P.current)||void 0===o?void 0:o.offsetHeight)||0;gt(c),bt(u),Et(d),Ot(f);var m=((null===(a=_.current)||void 0===a?void 0:a.offsetWidth)||0)-d,v=((null===(s=_.current)||void 0===s?void 0:s.offsetHeight)||0)-f;Q(m),rt(v);var y=null===(l=P.current)||void 0===l?void 0:l.className.includes(It);st(m-(y?0:p)),ht(v-(y?0:g)),Rt((function(){var t=new Map;return h.forEach((function(e){var n=e.key,r=B(n).current;r&&t.set(n,{width:r.offsetWidth,height:r.offsetHeight,left:r.offsetLeft,top:r.offsetTop})})),t}))})),Zt=h.slice(0,qt),Jt=h.slice(Yt+1),Qt=[].concat(Object(d.a)(Zt),Object(d.a)(Jt)),te=Object(s.useState)(),ee=Object(i.a)(te,2),ne=ee[0],re=ee[1],ie=Mt.get(E),oe=Object(s.useRef)();function ae(){p.a.cancel(oe.current)}Object(s.useEffect)((function(){var t={};return ie&&(H?(k?t.right=ie.right:t.left=ie.left,t.width=ie.width):(t.top=ie.top,t.height=ie.height)),ae(),oe.current=p()((function(){re(t)})),ae}),[ie,H,k]),Object(s.useEffect)((function(){Vt()}),[E,ie,Mt,H]),Object(s.useEffect)((function(){$t()}),[k,A,E,h.map((function(t){return t.key})).join("_")]);var se,le,ce,ue,he=!!Qt.length,de="".concat(u,"-nav-wrap");return H?k?(le=V>0,se=V+pt<J):(se=V<0,le=-V+pt<J):(ce=Y<0,ue=-Y+yt<nt),s.createElement("div",{ref:e,role:"tablist",className:c()("".concat(u,"-nav"),f),style:v,onKeyDown:function(){zt()}},s.createElement(ze,{position:"left",extra:w,prefixCls:u}),s.createElement(g.a,{onResize:$t},s.createElement("div",{className:c()(de,(n={},Object(r.a)(n,"".concat(de,"-ping-left"),se),Object(r.a)(n,"".concat(de,"-ping-right"),le),Object(r.a)(n,"".concat(de,"-ping-top"),ce),Object(r.a)(n,"".concat(de,"-ping-bottom"),ue),n)),ref:I},s.createElement(g.a,{onResize:$t},s.createElement("div",{ref:_,className:"".concat(u,"-nav-list"),style:{transform:"translate(".concat(V,"px, ").concat(Y,"px)"),transition:Ut?"none":void 0}},Xt,s.createElement(je,{ref:N,prefixCls:u,locale:O,editable:T,style:{visibility:he?"hidden":null}}),s.createElement("div",{className:c()("".concat(u,"-ink-bar"),Object(r.a)({},"".concat(u,"-ink-bar-animated"),S.inkBar)),style:ne}))))),s.createElement(Fe,Object.assign({},t,{ref:P,prefixCls:u,tabs:Qt,className:!he&&It})),s.createElement(ze,{position:"right",extra:w,prefixCls:u}))}));function Ve(t){var e=t.id,n=t.activeKey,i=t.animated,o=t.tabPosition,a=t.rtl,l=t.destroyInactiveTabPane,u=s.useContext(Be),h=u.prefixCls,d=u.tabs,f=i.tabPane,p=d.findIndex((function(t){return t.key===n}));return s.createElement("div",{className:c()("".concat(h,"-content-holder"))},s.createElement("div",{className:c()("".concat(h,"-content"),"".concat(h,"-content-").concat(o),Object(r.a)({},"".concat(h,"-content-animated"),f)),style:p&&f?Object(r.a)({},a?"marginRight":"marginLeft","-".concat(p,"00%")):null},d.map((function(t){return s.cloneElement(t.node,{key:t.key,prefixCls:h,tabKey:t.key,id:e,animated:f,active:t.key===n,destroyInactiveTabPane:l})}))))}function We(t){var e=t.prefixCls,n=t.forceRender,r=t.className,o=t.style,l=t.id,u=t.active,h=t.animated,d=t.destroyInactiveTabPane,f=t.tabKey,p=t.children,g=s.useState(n),m=Object(i.a)(g,2),v=m[0],y=m[1];s.useEffect((function(){u?y(!0):d&&y(!1)}),[u,d]);var b={};return u||(h?(b.visibility="hidden",b.height=0,b.overflowY="hidden"):b.display="none"),s.createElement("div",{id:l&&"".concat(l,"-panel-").concat(f),role:"tabpanel",tabIndex:u?0:-1,"aria-labelledby":l&&"".concat(l,"-tab-").concat(f),"aria-hidden":!u,style:Object(a.a)(Object(a.a)({},b),o),className:c()("".concat(e,"-tabpane"),u&&"".concat(e,"-tabpane-active"),r)},(u||v||n)&&p)}var Ke=0;var qe=s.forwardRef((function(t,e){var n,l,d=t.id,f=t.prefixCls,p=void 0===f?"rc-tabs":f,g=t.className,m=t.children,v=t.direction,y=t.activeKey,b=t.defaultActiveKey,x=t.editable,C=t.animated,S=t.tabPosition,E=void 0===S?"top":S,k=t.tabBarGutter,w=t.tabBarStyle,T=t.tabBarExtraContent,O=t.locale,L=t.moreIcon,A=t.moreTransitionName,D=t.destroyInactiveTabPane,R=t.renderTabBar,M=t.onChange,I=t.onTabClick,_=t.onTabScroll,P=Object(o.a)(t,["id","prefixCls","className","children","direction","activeKey","defaultActiveKey","editable","animated","tabPosition","tabBarGutter","tabBarStyle","tabBarExtraContent","locale","moreIcon","moreTransitionName","destroyInactiveTabPane","renderTabBar","onChange","onTabClick","onTabScroll"]),N=function(t){return Object(u.a)(t).map((function(t){if(s.isValidElement(t)){var e=void 0!==t.key?String(t.key):void 0;return Object(a.a)(Object(a.a)({key:e},t.props),{},{node:t})}return null})).filter((function(t){return t}))}(m),j="rtl"===v;l=!1===C?{inkBar:!1,tabPane:!1}:Object(a.a)({inkBar:!0,tabPane:!1},!0!==C?C:null);var F=Object(s.useState)(!1),B=Object(i.a)(F,2),U=B[0],H=B[1];Object(s.useEffect)((function(){var t;H((t=navigator.userAgent||navigator.vendor||window.opera,!(!/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(t)&&!/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(t.substr(0,4)))))}),[]);var z=Object(h.a)((function(){var t;return null===(t=N[0])||void 0===t?void 0:t.key}),{value:y,defaultValue:b}),G=Object(i.a)(z,2),V=G[0],W=G[1],K=Object(s.useState)((function(){return N.findIndex((function(t){return t.key===V}))})),q=Object(i.a)(K,2),Y=q[0],X=q[1];Object(s.useEffect)((function(){var t,e=N.findIndex((function(t){return t.key===V}));-1===e&&(e=Math.max(0,Math.min(Y,N.length-1)),W(null===(t=N[e])||void 0===t?void 0:t.key));X(e)}),[N.map((function(t){return t.key})).join("_"),V,Y]);var $=Object(h.a)(null,{value:d}),Z=Object(i.a)($,2),J=Z[0],Q=Z[1],tt=E;U&&!["left","right"].includes(E)&&(tt="top"),Object(s.useEffect)((function(){d||(Q("rc-tabs-".concat(Ke)),Ke+=1)}),[]);var et,nt={id:J,activeKey:V,animated:l,tabPosition:tt,rtl:j,mobile:U},rt=Object(a.a)(Object(a.a)({},nt),{},{editable:x,locale:O,moreIcon:L,moreTransitionName:A,tabBarGutter:k,onTabClick:function(t,e){null==I||I(t,e),W(t),null==M||M(t)},onTabScroll:_,extra:T,style:w,panes:m});return et=R?R(rt,Ge):s.createElement(Ge,Object.assign({},rt)),s.createElement(Be.Provider,{value:{tabs:N,prefixCls:p}},s.createElement("div",Object.assign({ref:e,id:d,className:c()(p,"".concat(p,"-").concat(tt),(n={},Object(r.a)(n,"".concat(p,"-mobile"),U),Object(r.a)(n,"".concat(p,"-editable"),x),Object(r.a)(n,"".concat(p,"-rtl"),j),n),g)},P),et,s.createElement(Ve,Object.assign({destroyInactiveTabPane:D},nt,{animated:l}))))}));qe.TabPane=We;var Ye=qe;e.b=Ye},kSUc:
/*!***************************************************!*\
!*** ./src/components/markdown-editor/index.less ***!
\***************************************************/
/*! no static exports found */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){},lZu9:
/*!***********************************************************!*\
!*** ./node_modules/codemirror/mode/markdown/markdown.js ***!
\***********************************************************/
/*! no static exports found */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){!function(t){"use strict";t.defineMode("markdown",(function(e,n){var r=t.getMode(e,"text/html"),i="null"==r.name;void 0===n.highlightFormatting&&(n.highlightFormatting=!1),void 0===n.maxBlockquoteDepth&&(n.maxBlockquoteDepth=0),void 0===n.taskLists&&(n.taskLists=!1),void 0===n.strikethrough&&(n.strikethrough=!1),void 0===n.emoji&&(n.emoji=!1),void 0===n.fencedCodeBlockHighlighting&&(n.fencedCodeBlockHighlighting=!0),void 0===n.fencedCodeBlockDefaultMode&&(n.fencedCodeBlockDefaultMode="text/plain"),void 0===n.xml&&(n.xml=!0),void 0===n.tokenTypeOverrides&&(n.tokenTypeOverrides={});var o={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 a in o)o.hasOwnProperty(a)&&n.tokenTypeOverrides[a]&&(o[a]=n.tokenTypeOverrides[a]);var s=/^([*\-_])(?:\s*\1){2,}\s*$/,l=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,c=/^\[(x| )\](?=\s)/i,u=n.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,h=/^ {0,3}(?:\={1,}|-{2,})\s*$/,d=/^[^#!\[\]*_\\<>` "'(~:]+/,f=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,p=/^\s*\[[^\]]+?\]:.*$/,g=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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]/;function m(t,e,n){return e.f=e.inline=n,n(t,e)}function v(t,e,n){return e.f=e.block=n,n(t,e)}function y(e){if(e.linkTitle=!1,e.linkHref=!1,e.linkText=!1,e.em=!1,e.strong=!1,e.strikethrough=!1,e.quote=0,e.indentedCode=!1,e.f==x){var n=i;if(!n){var o=t.innerMode(r,e.htmlState);n="xml"==o.mode.name&&null===o.state.tagStart&&!o.state.context&&o.state.tokenize.isInText}n&&(e.f=k,e.block=b,e.htmlState=null)}return e.trailingSpace=0,e.trailingSpaceNewLine=!1,e.prevLine=e.thisLine,e.thisLine={stream:null},null}function b(r,i){var a,d=r.column()===i.indentation,g=!(a=i.prevLine.stream)||!/\S/.test(a.string),v=i.indentedCode,y=i.prevLine.hr,b=!1!==i.list,x=(i.listStack[i.listStack.length-1]||0)+3;i.indentedCode=!1;var E=i.indentation;if(null===i.indentationDiff&&(i.indentationDiff=i.indentation,b)){for(i.list=null;E<i.listStack[i.listStack.length-1];)i.listStack.pop(),i.listStack.length?i.indentation=i.listStack[i.listStack.length-1]:i.list=!1;!1!==i.list&&(i.indentationDiff=E-i.listStack[i.listStack.length-1])}var k=!(g||y||i.prevLine.header||b&&v||i.prevLine.fencedCodeEnd),w=(!1===i.list||y||g)&&i.indentation<=x&&r.match(s),T=null;if(i.indentationDiff>=4&&(v||i.prevLine.fencedCodeEnd||i.prevLine.header||g))return r.skipToEnd(),i.indentedCode=!0,o.code;if(r.eatSpace())return null;if(d&&i.indentation<=x&&(T=r.match(u))&&T[1].length<=6)return i.quote=0,i.header=T[1].length,i.thisLine.header=!0,n.highlightFormatting&&(i.formatting="header"),i.f=i.inline,S(i);if(i.indentation<=x&&r.eat(">"))return i.quote=d?1:i.quote+1,n.highlightFormatting&&(i.formatting="quote"),r.eatSpace(),S(i);if(!w&&!i.setext&&d&&i.indentation<=x&&(T=r.match(l))){var O=T[1]?"ol":"ul";return i.indentation=E+r.current().length,i.list=!0,i.quote=0,i.listStack.push(i.indentation),i.em=!1,i.strong=!1,i.code=!1,i.strikethrough=!1,n.taskLists&&r.match(c,!1)&&(i.taskList=!0),i.f=i.inline,n.highlightFormatting&&(i.formatting=["list","list-"+O]),S(i)}return d&&i.indentation<=x&&(T=r.match(f,!0))?(i.quote=0,i.fencedEndRE=new RegExp(T[1]+"+ *$"),i.localMode=n.fencedCodeBlockHighlighting&&function(n){if(t.findModeByName){var r=t.findModeByName(n);r&&(n=r.mime||r.mimes[0])}var i=t.getMode(e,n);return"null"==i.name?null:i}(T[2]||n.fencedCodeBlockDefaultMode),i.localMode&&(i.localState=t.startState(i.localMode)),i.f=i.block=C,n.highlightFormatting&&(i.formatting="code-block"),i.code=-1,S(i)):i.setext||!(k&&b||i.quote||!1!==i.list||i.code||w||p.test(r.string))&&(T=r.lookAhead(1))&&(T=T.match(h))?(i.setext?(i.header=i.setext,i.setext=0,r.skipToEnd(),n.highlightFormatting&&(i.formatting="header")):(i.header="="==T[0].charAt(0)?1:2,i.setext=i.header),i.thisLine.header=!0,i.f=i.inline,S(i)):w?(r.skipToEnd(),i.hr=!0,i.thisLine.hr=!0,o.hr):"["===r.peek()?m(r,i,L):m(r,i,i.inline)}function x(e,n){var o=r.token(e,n.htmlState);if(!i){var a=t.innerMode(r,n.htmlState);("xml"==a.mode.name&&null===a.state.tagStart&&!a.state.context&&a.state.tokenize.isInText||n.md_inside&&e.current().indexOf(">")>-1)&&(n.f=k,n.block=b,n.htmlState=null)}return o}function C(t,e){var r,i=e.listStack[e.listStack.length-1]||0,a=e.indentation<i,s=i+3;return e.fencedEndRE&&e.indentation<=s&&(a||t.match(e.fencedEndRE))?(n.highlightFormatting&&(e.formatting="code-block"),a||(r=S(e)),e.localMode=e.localState=null,e.block=b,e.f=k,e.fencedEndRE=null,e.code=0,e.thisLine.fencedCodeEnd=!0,a?v(t,e,e.block):r):e.localMode?e.localMode.token(t,e.localState):(t.skipToEnd(),o.code)}function S(t){var e=[];if(t.formatting){e.push(o.formatting),"string"==typeof t.formatting&&(t.formatting=[t.formatting]);for(var r=0;r<t.formatting.length;r++)e.push(o.formatting+"-"+t.formatting[r]),"header"===t.formatting[r]&&e.push(o.formatting+"-"+t.formatting[r]+"-"+t.header),"quote"===t.formatting[r]&&(!n.maxBlockquoteDepth||n.maxBlockquoteDepth>=t.quote?e.push(o.formatting+"-"+t.formatting[r]+"-"+t.quote):e.push("error"))}if(t.taskOpen)return e.push("meta"),e.length?e.join(" "):null;if(t.taskClosed)return e.push("property"),e.length?e.join(" "):null;if(t.linkHref?e.push(o.linkHref,"url"):(t.strong&&e.push(o.strong),t.em&&e.push(o.em),t.strikethrough&&e.push(o.strikethrough),t.emoji&&e.push(o.emoji),t.linkText&&e.push(o.linkText),t.code&&e.push(o.code),t.image&&e.push(o.image),t.imageAltText&&e.push(o.imageAltText,"link"),t.imageMarker&&e.push(o.imageMarker)),t.header&&e.push(o.header,o.header+"-"+t.header),t.quote&&(e.push(o.quote),!n.maxBlockquoteDepth||n.maxBlockquoteDepth>=t.quote?e.push(o.quote+"-"+t.quote):e.push(o.quote+"-"+n.maxBlockquoteDepth)),!1!==t.list){var i=(t.listStack.length-1)%3;i?1===i?e.push(o.list2):e.push(o.list3):e.push(o.list1)}return t.trailingSpaceNewLine?e.push("trailing-space-new-line"):t.trailingSpace&&e.push("trailing-space-"+(t.trailingSpace%2?"a":"b")),e.length?e.join(" "):null}function E(t,e){if(t.match(d,!0))return S(e)}function k(e,i){var a=i.text(e,i);if(void 0!==a)return a;if(i.list)return i.list=null,S(i);if(i.taskList)return" "===e.match(c,!0)[1]?i.taskOpen=!0:i.taskClosed=!0,n.highlightFormatting&&(i.formatting="task"),i.taskList=!1,S(i);if(i.taskOpen=!1,i.taskClosed=!1,i.header&&e.match(/^#+$/,!0))return n.highlightFormatting&&(i.formatting="header"),S(i);var s=e.next();if(i.linkTitle){i.linkTitle=!1;var l=s;"("===s&&(l=")");var u="^\\s*(?:[^"+(l=(l+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1"))+"\\\\]+|\\\\\\\\|\\\\.)"+l;if(e.match(new RegExp(u),!0))return o.linkHref}if("`"===s){var h=i.formatting;n.highlightFormatting&&(i.formatting="code"),e.eatWhile("`");var d=e.current().length;if(0!=i.code||i.quote&&1!=d){if(d==i.code){var f=S(i);return i.code=0,f}return i.formatting=h,S(i)}return i.code=d,S(i)}if(i.code)return S(i);if("\\"===s&&(e.next(),n.highlightFormatting)){var p=S(i),m=o.formatting+"-escape";return p?p+" "+m:m}if("!"===s&&e.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return i.imageMarker=!0,i.image=!0,n.highlightFormatting&&(i.formatting="image"),S(i);if("["===s&&i.imageMarker&&e.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return i.imageMarker=!1,i.imageAltText=!0,n.highlightFormatting&&(i.formatting="image"),S(i);if("]"===s&&i.imageAltText){n.highlightFormatting&&(i.formatting="image");var p=S(i);return i.imageAltText=!1,i.image=!1,i.inline=i.f=T,p}if("["===s&&!i.image)return i.linkText&&e.match(/^.*?\]/)||(i.linkText=!0,n.highlightFormatting&&(i.formatting="link")),S(i);if("]"===s&&i.linkText){n.highlightFormatting&&(i.formatting="link");var p=S(i);return i.linkText=!1,i.inline=i.f=e.match(/\(.*?\)| ?\[.*?\]/,!1)?T:k,p}if("<"===s&&e.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1))return i.f=i.inline=w,n.highlightFormatting&&(i.formatting="link"),(p=S(i))?p+=" ":p="",p+o.linkInline;if("<"===s&&e.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1))return i.f=i.inline=w,n.highlightFormatting&&(i.formatting="link"),(p=S(i))?p+=" ":p="",p+o.linkEmail;if(n.xml&&"<"===s&&e.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var y=e.string.indexOf(">",e.pos);if(-1!=y){var b=e.string.substring(e.start,y);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(b)&&(i.md_inside=!0)}return e.backUp(1),i.htmlState=t.startState(r),v(e,i,x)}if(n.xml&&"<"===s&&e.match(/^\/\w*?>/))return i.md_inside=!1,"tag";if("*"===s||"_"===s){for(var C=1,E=1==e.pos?" ":e.string.charAt(e.pos-2);C<3&&e.eat(s);)C++;var O=e.peek()||" ",L=!/\s/.test(O)&&(!g.test(O)||/\s/.test(E)||g.test(E)),A=!/\s/.test(E)&&(!g.test(E)||/\s/.test(O)||g.test(O)),D=null,R=null;if(C%2&&(i.em||!L||"*"!==s&&A&&!g.test(E)?i.em!=s||!A||"*"!==s&&L&&!g.test(O)||(D=!1):D=!0),C>1&&(i.strong||!L||"*"!==s&&A&&!g.test(E)?i.strong!=s||!A||"*"!==s&&L&&!g.test(O)||(R=!1):R=!0),null!=R||null!=D)return n.highlightFormatting&&(i.formatting=null==D?"strong":null==R?"em":"strong em"),!0===D&&(i.em=s),!0===R&&(i.strong=s),f=S(i),!1===D&&(i.em=!1),!1===R&&(i.strong=!1),f}else if(" "===s&&(e.eat("*")||e.eat("_"))){if(" "===e.peek())return S(i);e.backUp(1)}if(n.strikethrough)if("~"===s&&e.eatWhile(s)){if(i.strikethrough)return n.highlightFormatting&&(i.formatting="strikethrough"),f=S(i),i.strikethrough=!1,f;if(e.match(/^[^\s]/,!1))return i.strikethrough=!0,n.highlightFormatting&&(i.formatting="strikethrough"),S(i)}else if(" "===s&&e.match(/^~~/,!0)){if(" "===e.peek())return S(i);e.backUp(2)}if(n.emoji&&":"===s&&e.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){i.emoji=!0,n.highlightFormatting&&(i.formatting="emoji");var M=S(i);return i.emoji=!1,M}return" "===s&&(e.match(/^ +$/,!1)?i.trailingSpace++:i.trailingSpace&&(i.trailingSpaceNewLine=!0)),S(i)}function w(t,e){if(">"===t.next()){e.f=e.inline=k,n.highlightFormatting&&(e.formatting="link");var r=S(e);return r?r+=" ":r="",r+o.linkInline}return t.match(/^[^>]+/,!0),o.linkInline}function T(t,e){if(t.eatSpace())return null;var r,i=t.next();return"("===i||"["===i?(e.f=e.inline=(r="("===i?")":"]",function(t,e){if(t.next()===r){e.f=e.inline=k,n.highlightFormatting&&(e.formatting="link-string");var i=S(e);return e.linkHref=!1,i}return t.match(O[r]),e.linkHref=!0,S(e)}),n.highlightFormatting&&(e.formatting="link-string"),e.linkHref=!0,S(e)):"error"}var O={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function L(t,e){return t.match(/^([^\]\\]|\\.)*\]:/,!1)?(e.f=A,t.next(),n.highlightFormatting&&(e.formatting="link"),e.linkText=!0,S(e)):m(t,e,k)}function A(t,e){if(t.match(/^\]:/,!0)){e.f=e.inline=D,n.highlightFormatting&&(e.formatting="link");var r=S(e);return e.linkText=!1,r}return t.match(/^([^\]\\]|\\.)+/,!0),o.linkText}function D(t,e){return t.eatSpace()?null:(t.match(/^[^\s]+/,!0),void 0===t.peek()?e.linkTitle=!0:t.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),e.f=e.inline=k,o.linkHref+" url")}var R={startState:function(){return{f:b,prevLine:{stream:null},thisLine:{stream:null},block:b,htmlState:null,indentation:0,inline:k,text:E,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(e){return{f:e.f,prevLine:e.prevLine,thisLine:e.thisLine,block:e.block,htmlState:e.htmlState&&t.copyState(r,e.htmlState),indentation:e.indentation,localMode:e.localMode,localState:e.localMode?t.copyState(e.localMode,e.localState):null,inline:e.inline,text:e.text,formatting:!1,linkText:e.linkText,linkTitle:e.linkTitle,linkHref:e.linkHref,code:e.code,em:e.em,strong:e.strong,strikethrough:e.strikethrough,emoji:e.emoji,header:e.header,setext:e.setext,hr:e.hr,taskList:e.taskList,list:e.list,listStack:e.listStack.slice(0),quote:e.quote,indentedCode:e.indentedCode,trailingSpace:e.trailingSpace,trailingSpaceNewLine:e.trailingSpaceNewLine,md_inside:e.md_inside,fencedEndRE:e.fencedEndRE}},token:function(t,e){if(e.formatting=!1,t!=e.thisLine.stream){if(e.header=0,e.hr=!1,t.match(/^\s*$/,!0))return y(e),null;if(e.prevLine=e.thisLine,e.thisLine={stream:t},e.taskList=!1,e.trailingSpace=0,e.trailingSpaceNewLine=!1,!e.localState&&(e.f=e.block,e.f!=x)){var n=t.match(/^\s*/,!0)[0].replace(/\t/g," ").length;if(e.indentation=n,e.indentationDiff=null,n>0)return null}}return e.f(t,e)},innerMode:function(t){return t.block==x?{state:t.htmlState,mode:r}:t.localState?{state:t.localState,mode:t.localMode}:{state:t,mode:R}},indent:function(e,n,i){return e.block==x&&r.indent?r.indent(e.htmlState,n,i):e.localState&&e.localMode.indent?e.localMode.indent(e.localState,n,i):t.Pass},blankLine:y,getType:S,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return R}),"xml"),t.defineMIME("text/markdown","markdown"),t.defineMIME("text/x-markdown","markdown")}(n(/*! ../../lib/codemirror */"VrN/"),n(/*! ../xml/xml */"1eCo"),n(/*! ../meta */"8EBN"))},n6Qo:
/*!**************************************************************!*\
!*** ./node_modules/rc-table/es/Footer/index.js + 2 modules ***!
\**************************************************************/
/*! exports provided: default, FooterComponents */
/*! exports used: FooterComponents, default */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/Cell/index.js because of ./node_modules/antd/es/table/Table.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/context/TableContext.js because of ./node_modules/antd/es/table/Table.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */function(t,e,n){"use strict";n.d(e,"a",(function(){return a}));var r=n("q1tI"),i=n("biw7"),o=n("fyJ8");e.b=function(t){var e=t.children,n=r.useContext(i.a).prefixCls;return r.createElement("tfoot",{className:"".concat(n,"-summary")},e)};var a={Cell:function(t){var e=t.className,n=t.index,a=t.children,s=t.colSpan,l=t.rowSpan,c=r.useContext(i.a),u=c.prefixCls,h=c.fixedInfoList[n];return r.createElement(o.a,Object.assign({className:e,index:n,component:"td",prefixCls:u,record:null,dataIndex:null,render:function(){return{children:a,props:{colSpan:s,rowSpan:l}}}},h))},Row:function(t){return r.createElement("tr",Object.assign({},t))}}},nVVt:
/*!****************************************!*\
!*** ./node_modules/qr.js/lib/mode.js ***!
\****************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e){t.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}},osHv:
/*!********************************************************!*\
!*** ./node_modules/codemirror/addon/fold/xml-fold.js ***!
\********************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){!function(t){"use strict";var e=t.Pos;function n(t,e){return t.line-e.line||t.ch-e.ch}var r="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=new RegExp("<(/?)(["+r+"]["+r+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*)","g");function o(t,e,n,r){this.line=e,this.ch=n,this.cm=t,this.text=t.getLine(e),this.min=r?Math.max(r.from,t.firstLine()):t.firstLine(),this.max=r?Math.min(r.to-1,t.lastLine()):t.lastLine()}function a(t,n){var r=t.cm.getTokenTypeAt(e(t.line,n));return r&&/\btag\b/.test(r)}function s(t){if(!(t.line>=t.max))return t.ch=0,t.text=t.cm.getLine(++t.line),!0}function l(t){if(!(t.line<=t.min))return t.text=t.cm.getLine(--t.line),t.ch=t.text.length,!0}function c(t){for(;;){var e=t.text.indexOf(">",t.ch);if(-1==e){if(s(t))continue;return}if(a(t,e+1)){var n=t.text.lastIndexOf("/",e),r=n>-1&&!/\S/.test(t.text.slice(n+1,e));return t.ch=e+1,r?"selfClose":"regular"}t.ch=e+1}}function u(t){for(;;){var e=t.ch?t.text.lastIndexOf("<",t.ch-1):-1;if(-1==e){if(l(t))continue;return}if(a(t,e+1)){i.lastIndex=e,t.ch=e;var n=i.exec(t.text);if(n&&n.index==e)return n}else t.ch=e}}function h(t){for(;;){i.lastIndex=t.ch;var e=i.exec(t.text);if(!e){if(s(t))continue;return}if(a(t,e.index+1))return t.ch=e.index+e[0].length,e;t.ch=e.index+1}}function d(t){for(;;){var e=t.ch?t.text.lastIndexOf(">",t.ch-1):-1;if(-1==e){if(l(t))continue;return}if(a(t,e+1)){var n=t.text.lastIndexOf("/",e),r=n>-1&&!/\S/.test(t.text.slice(n+1,e));return t.ch=e+1,r?"selfClose":"regular"}t.ch=e}}function f(t,n){for(var r=[];;){var i,o=h(t),a=t.line,s=t.ch-(o?o[0].length:0);if(!o||!(i=c(t)))return;if("selfClose"!=i)if(o[1]){for(var l=r.length-1;l>=0;--l)if(r[l]==o[2]){r.length=l;break}if(l<0&&(!n||n==o[2]))return{tag:o[2],from:e(a,s),to:e(t.line,t.ch)}}else r.push(o[2])}}function p(t,n){for(var r=[];;){var i=d(t);if(!i)return;if("selfClose"!=i){var o=t.line,a=t.ch,s=u(t);if(!s)return;if(s[1])r.push(s[2]);else{for(var l=r.length-1;l>=0;--l)if(r[l]==s[2]){r.length=l;break}if(l<0&&(!n||n==s[2]))return{tag:s[2],from:e(t.line,t.ch),to:e(o,a)}}}else u(t)}}t.registerHelper("fold","xml",(function(t,r){for(var i=new o(t,r.line,0);;){var a=h(i);if(!a||i.line!=r.line)return;var s=c(i);if(!s)return;if(!a[1]&&"selfClose"!=s){var l=e(i.line,i.ch),u=f(i,a[2]);return u&&n(u.from,l)>0?{from:l,to:u.from}:null}}})),t.findMatchingTag=function(t,r,i){var a=new o(t,r.line,r.ch,i);if(-1!=a.text.indexOf(">")||-1!=a.text.indexOf("<")){var s=c(a),l=s&&e(a.line,a.ch),h=s&&u(a);if(s&&h&&!(n(a,r)>0)){var d={from:e(a.line,a.ch),to:l,tag:h[2]};return"selfClose"==s?{open:d,close:null,at:"open"}:h[1]?{open:p(a,h[2]),close:d,at:"close"}:{open:d,close:f(a=new o(t,l.line,l.ch,i),h[2]),at:"open"}}}},t.findEnclosingTag=function(t,e,n,r){for(var i=new o(t,e.line,e.ch,n);;){var a=p(i,r);if(!a)break;var s=f(new o(t,e.line,e.ch,n),a.tag);if(s)return{open:a,close:s}}},t.scanForClosingTag=function(t,e,n,r){return f(new o(t,e.line,e.ch,r?{from:0,to:r}:null),n)}}(n(/*! ../../lib/codemirror */"VrN/"))},p5ED:
/*!*********************************************!*\
!*** ./src/components/PreviewAll/index.tsx ***!
\*********************************************/
/*! exports provided: default */
/*! exports used: default */function(t,e,n){"use strict";n(/*! antd/es/button/style */"+L6B");var r=n(/*! antd/es/button */"2/Rp"),i=(n(/*! antd/es/tooltip/style */"5Dmo"),n(/*! antd/es/tooltip */"3S7+")),o=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2 */"k1fw"),a=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray */"tJVT"),s=n(/*! react */"q1tI"),l=n.n(s),c=n(/*! ./index.less?modules */"vHTk"),u=n.n(c),h=n(/*! @ant-design/icons */"yEEn"),d=n(/*! @/components/monaco-editor */"ZW9T"),f=n(/*! @/utils/util */"1vsH");e.a=function(t){var e=t.name,n=t.data,c=(t.theme,t.type),p=t.filename,g=t.monacoEditor,m=t.className,v=t.style,y=t.close,b=t.onClose,x=t.hasMask,C=Object(s.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),S=Object(a.a)(C,2),E=(S[0],S[1],Object(s.useState)("")),k=Object(a.a)(E,2),w=(k[0],k[1]),T=Object(s.useRef)();p&&(g.filename=p),Object(s.useEffect)((function(){var t,e,n=null===(t=document.cookie)||void 0===t||null===(e=t.replace(/\s/g,""))||void 0===e?void 0:e.split(";");null==n||n.map((function(t){var e=t.split("=");"_educoder_session"===e[0]&&w(e[1])}))}),[]);var O=function(){n.startsWith("http")||n.startsWith("/")?L():Object(f.x)(p||"educoder",n,p)},L=function(){Object(f.v)(p||e,n)};return console.log("data:",n,"fileanme:",p," name:",e),l.a.createElement("div",{style:Object(o.a)({},v||{}),className:"".concat(x&&u.a.bgBlack," ").concat(c?u.a.wrp:"hide")},y&&l.a.createElement("div",{className:u.a.close,ref:T},l.a.createElement(i.a,{title:"点击下载此文件",getPopupContainer:function(){return T.current}},l.a.createElement("span",{onClick:L},l.a.createElement("i",{className:"icon-quxiaozhiding"}))),l.a.createElement(i.a,{title:"关闭",getPopupContainer:function(){return T.current}},l.a.createElement("span",{className:"",onClick:b},l.a.createElement("i",{className:"icon-guanbi1"})))),l.a.createElement("div",{className:"".concat(u.a[m]," ").concat(m," ").concat(u.a.monaco," ").concat("txt"===c?"show":"hide")},"txt"===c&&l.a.createElement(d.b,g)),"audio"===c&&l.a.createElement("audio",{src:"".concat(null!=n&&n.startsWith("/")||(null==n?void 0:n.indexOf("https://"))>-1?n:"data:audio/mp3;base64,").concat(n),autoPlay:!0}),"video"===c&&l.a.createElement(l.a.Fragment,null,null!=n&&n.startsWith("/")?l.a.createElement("video",{controls:!0,src:"".concat(n),autoPlay:!0}):l.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(n),autoPlay:!0})),"html"===c&&l.a.createElement("iframe",{src:n+"&disposition=inline"}),"pdf"===c&&l.a.createElement("embed",{className:u.a.embed,src:n}),"pdfeditor"===c&&l.a.createElement("div",null,l.a.createElement("iframe",{src:"https://a1office.co/solutions/editor/pdf-editor/查重文档1-8839d79b81e8bda0d298ca058913ab88.pdf"}),l.a.createElement("div",{style:{position:"absolute",left:"1px",top:"1px",width:180,height:60,background:"#f9f9f9"}})),"image"===c&&l.a.createElement(l.a.Fragment,null,l.a.createElement("img",{src:"".concat(null!=n&&n.startsWith("/")||(null==n?void 0:n.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(n)})),"other"===c&&l.a.createElement("div",null,l.a.createElement(r.a,{type:"primary",size:"large",onClick:O},l.a.createElement(h.a,null),"点击下载")),("download"===c||"office"===c)&&l.a.createElement(r.a,{type:"primary",size:"large",onClick:O},l.a.createElement(h.a,null),"点击下载"))}},"p77/":
/*!****************************************************!*\
!*** ./node_modules/codemirror/lib/codemirror.css ***!
\****************************************************/
/*! no static exports found */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){},"rAM+":
/*!*******************************************************************************************************************!*\
!*** ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js ***!
\*******************************************************************************************************************/
/*! exports provided: default */
/*! exports used: default */function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(/*! @babel/runtime/helpers/esm/unsupportedIterableToArray */"Qw5x");function i(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=Object(r.a)(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,o=function(){};return{s:o,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,l=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return s=t.done,t},e:function(t){l=!0,a=t},f:function(){try{s||null==n.return||n.return()}finally{if(l)throw a}}}}},rUJ1:
/*!********************************************!*\
!*** ./node_modules/marked/src/helpers.js ***!
\********************************************/
/*! no static exports found */
/*! exports used: escape */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e){const n=/[&<>"']/,r=/[&<>"']/g,i=/[<>"']|&(?!#?\w+;)/,o=/[<>"']|&(?!#?\w+;)/g,a={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},s=t=>a[t];const l=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function c(t){return t.replace(l,(t,e)=>"colon"===(e=e.toLowerCase())?":":"#"===e.charAt(0)?"x"===e.charAt(1)?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1)):"")}const u=/(^|[^\[])\^/g;const h=/[^\w:]/g,d=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;const f={},p=/^[^:]+:\/*[^/]*$/,g=/^([^:]+:)[\s\S]*$/,m=/^([^:]+:\/*[^/]*)[\s\S]*$/;function v(t,e){f[" "+t]||(p.test(t)?f[" "+t]=t+"/":f[" "+t]=y(t,"/",!0));const n=-1===(t=f[" "+t]).indexOf(":");return"//"===e.substring(0,2)?n?e:t.replace(g,"$1")+e:"/"===e.charAt(0)?n?e:t.replace(m,"$1")+e:t+e}function y(t,e,n){const r=t.length;if(0===r)return"";let i=0;for(;i<r;){const o=t.charAt(r-i-1);if(o!==e||n){if(o===e||!n)break;i++}else i++}return t.substr(0,r-i)}t.exports={escape:function(t,e){if(e){if(n.test(t))return t.replace(r,s)}else if(i.test(t))return t.replace(o,s);return t},unescape:c,edit:function(t,e){t=t.source||t,e=e||"";const n={replace:(e,r)=>(r=(r=r.source||r).replace(u,"$1"),t=t.replace(e,r),n),getRegex:()=>new RegExp(t,e)};return n},cleanUrl:function(t,e,n){if(t){let t;try{t=decodeURIComponent(c(n)).replace(h,"").toLowerCase()}catch(t){return null}if(0===t.indexOf("javascript:")||0===t.indexOf("vbscript:")||0===t.indexOf("data:"))return null}e&&!d.test(n)&&(n=v(e,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch(t){return null}return n},resolveUrl:v,noopTest:{exec:function(){}},merge:function(t){let e,n,r=1;for(;r<arguments.length;r++)for(n in e=arguments[r],e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},splitCells:function(t,e){const n=t.replace(/\|/g,(t,e,n)=>{let r=!1,i=e;for(;--i>=0&&"\\"===n[i];)r=!r;return r?"|":" |"}).split(/ \|/);let r=0;if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(/\\\|/g,"|");return n},rtrim:y,findClosingBracket:function(t,e){if(-1===t.indexOf(e[1]))return-1;const n=t.length;let r=0,i=0;for(;i<n;i++)if("\\"===t[i])i++;else if(t[i]===e[0])r++;else if(t[i]===e[1]&&(r--,r<0))return i;return-1},checkSanitizeDeprecation:function(t){t&&t.sanitize&&!t.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")}}},rcnY:
/*!*******************************************!*\
!*** ./node_modules/qr.js/lib/RSBlock.js ***!
\*******************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r=n(/*! ./ErrorCorrectLevel */"aRTE");function i(t,e){this.totalCount=t,this.dataCount=e}i.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],i.getRSBlocks=function(t,e){var n=i.getRsBlockTable(t,e);if(null==n)throw new Error("bad rs block @ typeNumber:"+t+"/errorCorrectLevel:"+e);for(var r=n.length/3,o=new Array,a=0;a<r;a++)for(var s=n[3*a+0],l=n[3*a+1],c=n[3*a+2],u=0;u<s;u++)o.push(new i(l,c));return o},i.getRsBlockTable=function(t,e){switch(e){case r.L:return i.RS_BLOCK_TABLE[4*(t-1)+0];case r.M:return i.RS_BLOCK_TABLE[4*(t-1)+1];case r.Q:return i.RS_BLOCK_TABLE[4*(t-1)+2];case r.H:return i.RS_BLOCK_TABLE[4*(t-1)+3];default:return}},t.exports=i},sR1s:
/*!*****************************************************!*\
!*** ./node_modules/rc-table/es/utils/valueUtil.js ***!
\*****************************************************/
/*! exports provided: getPathValue, getColumnsKey, mergeObject, validateValue */
/*! exports used: getColumnsKey, getPathValue, mergeObject, validateValue */function(t,e,n){"use strict";n.d(e,"b",(function(){return o})),n.d(e,"a",(function(){return a})),n.d(e,"c",(function(){return s})),n.d(e,"d",(function(){return l}));var r=n(/*! @babel/runtime/helpers/esm/typeof */"U8pU");function i(t){return null==t?[]:Array.isArray(t)?t:[t]}function o(t,e){if(!e&&"number"!=typeof e)return t;for(var n=i(e),r=t,o=0;o<n.length;o+=1){if(!r)return null;r=r[n[o]]}return r}function a(t){var e=[],n={};return t.forEach((function(t){for(var r=t||{},o=r.key,a=r.dataIndex,s=o||i(a).join("-")||"RC_TABLE_KEY";n[s];)s="".concat(s,"_next");n[s]=!0,e.push(s)})),e}function s(){var t={};function e(t,n){n&&Object.keys(n).forEach((function(i){var o=n[i];o&&"object"===Object(r.a)(o)?(t[i]=t[i]||{},e(t[i],o)):t[i]=o}))}for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return i.forEach((function(n){e(t,n)})),t}function l(t){return null!=t}},sboe:
/*!*************************************************!*\
!*** ./node_modules/rc-tree/es/contextTypes.js ***!
\*************************************************/
/*! exports provided: TreeContext */
/*! exports used: TreeContext */function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(/*! react */"q1tI"),i=r.createContext(null)},t23M:
/*!*****************************************************!*\
!*** ./node_modules/rc-resize-observer/es/index.js ***!
\*****************************************************/
/*! exports provided: default */
/*! exports used: default */function(t,e,n){"use strict";var r=n(/*! @babel/runtime/helpers/esm/objectSpread2 */"VTBJ"),i=n(/*! @babel/runtime/helpers/esm/classCallCheck */"1OyB"),o=n(/*! @babel/runtime/helpers/esm/createClass */"vuIU"),a=n(/*! @babel/runtime/helpers/esm/inherits */"Ji7U"),s=n(/*! @babel/runtime/helpers/esm/createSuper */"LK+K"),l=n(/*! react */"q1tI"),c=n(/*! rc-util/es/Dom/findDOMNode */"m+aA"),u=n(/*! rc-util/es/Children/toArray */"Zm9Q"),h=n(/*! rc-util/es/warning */"Kwbf"),d=n(/*! rc-util/es/ref */"c+Xe"),f=n(/*! resize-observer-polyfill */"bdgK"),p=function(t){Object(a.a)(n,t);var e=Object(s.a)(n);function n(){var t;return Object(i.a)(this,n),(t=e.apply(this,arguments)).resizeObserver=null,t.childNode=null,t.currentElement=null,t.state={width:0,height:0,offsetHeight:0,offsetWidth:0},t.onResize=function(e){var n=t.props.onResize,i=e[0].target,o=i.getBoundingClientRect(),a=o.width,s=o.height,l=i.offsetWidth,c=i.offsetHeight,u=Math.floor(a),h=Math.floor(s);if(t.state.width!==u||t.state.height!==h||t.state.offsetWidth!==l||t.state.offsetHeight!==c){var d={width:u,height:h,offsetWidth:l,offsetHeight:c};t.setState(d),n&&Promise.resolve().then((function(){n(Object(r.a)(Object(r.a)({},d),{},{offsetWidth:l,offsetHeight:c}))}))}},t.setChildNode=function(e){t.childNode=e},t}return Object(o.a)(n,[{key:"componentDidMount",value:function(){this.onComponentUpdated()}},{key:"componentDidUpdate",value:function(){this.onComponentUpdated()}},{key:"componentWillUnmount",value:function(){this.destroyObserver()}},{key:"onComponentUpdated",value:function(){if(this.props.disabled)this.destroyObserver();else{var t=Object(c.a)(this.childNode||this);t!==this.currentElement&&(this.destroyObserver(),this.currentElement=t),!this.resizeObserver&&t&&(this.resizeObserver=new f.default(this.onResize),this.resizeObserver.observe(t))}}},{key:"destroyObserver",value:function(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}},{key:"render",value:function(){var t=this.props.children,e=Object(u.a)(t);if(e.length>1)Object(h.a)(!1,"Find more than one child node with `children` in ResizeObserver. Will only observe first one.");else if(0===e.length)return Object(h.a)(!1,"`children` of ResizeObserver is empty. Nothing is in observe."),null;var n=e[0];if(l.isValidElement(n)&&Object(d.c)(n)){var r=n.ref;e[0]=l.cloneElement(n,{ref:Object(d.a)(r,this.setChildNode)})}return 1===e.length?e[0]:e.map((function(t,e){return!l.isValidElement(t)||"key"in t&&null!==t.key?t:l.cloneElement(t,{key:"".concat("rc-observer-key","-").concat(e)})}))}}]),n}(l.Component);p.displayName="ResizeObserver",e.a=p},ulZh:
/*!*****************************************!*\
!*** ./node_modules/hls.js/dist/hls.js ***!
\*****************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r;"undefined"!=typeof window&&(r=function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":
/*!*********************************************!*\
!*** ./node_modules/eventemitter3/index.js ***!
\*********************************************/
/*! no static exports found */function(t,e,n){"use strict";var r=Object.prototype.hasOwnProperty,i="~";function o(){}function a(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function s(t,e,n,r,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new a(n,r||t,o),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],s]:t._events[l].push(s):(t._events[l]=s,t._eventsCount++),t}function l(t,e){0==--t._eventsCount?t._events=new o:delete t._events[e]}function c(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(i=!1)),c.prototype.eventNames=function(){var t,e,n=[];if(0===this._eventsCount)return n;for(e in t=this._events)r.call(t,e)&&n.push(i?e.slice(1):e);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},c.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,o=n.length,a=new Array(o);r<o;r++)a[r]=n[r].fn;return a},c.prototype.listenerCount=function(t){var e=i?i+t:t,n=this._events[e];return n?n.fn?1:n.length:0},c.prototype.emit=function(t,e,n,r,o,a){var s=i?i+t:t;if(!this._events[s])return!1;var l,c,u=this._events[s],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,n),!0;case 4:return u.fn.call(u.context,e,n,r),!0;case 5:return u.fn.call(u.context,e,n,r,o),!0;case 6:return u.fn.call(u.context,e,n,r,o,a),!0}for(c=1,l=new Array(h-1);c<h;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var d,f=u.length;for(c=0;c<f;c++)switch(u[c].once&&this.removeListener(t,u[c].fn,void 0,!0),h){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,e);break;case 3:u[c].fn.call(u[c].context,e,n);break;case 4:u[c].fn.call(u[c].context,e,n,r);break;default:if(!l)for(d=1,l=new Array(h-1);d<h;d++)l[d-1]=arguments[d];u[c].fn.apply(u[c].context,l)}}return!0},c.prototype.on=function(t,e,n){return s(this,t,e,n,!1)},c.prototype.once=function(t,e,n){return s(this,t,e,n,!0)},c.prototype.removeListener=function(t,e,n,r){var o=i?i+t:t;if(!this._events[o])return this;if(!e)return l(this,o),this;var a=this._events[o];if(a.fn)a.fn!==e||r&&!a.once||n&&a.context!==n||l(this,o);else{for(var s=0,c=[],u=a.length;s<u;s++)(a[s].fn!==e||r&&!a[s].once||n&&a[s].context!==n)&&c.push(a[s]);c.length?this._events[o]=1===c.length?c[0]:c:l(this,o)}return this},c.prototype.removeAllListeners=function(t){var e;return t?(e=i?i+t:t,this._events[e]&&l(this,e)):(this._events=new o,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=i,c.EventEmitter=c,t.exports=c},"./node_modules/url-toolkit/src/url-toolkit.js":
/*!*****************************************************!*\
!*** ./node_modules/url-toolkit/src/url-toolkit.js ***!
\*****************************************************/
/*! no static exports found */function(t,e,n){var r,i,o,a,s;r=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,i=/^([^\/?#]*)([^]*)$/,o=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,s={buildAbsoluteURL:function(t,e,n){if(n=n||{},t=t.trim(),!(e=e.trim())){if(!n.alwaysNormalize)return t;var r=s.parseURL(t);if(!r)throw new Error("Error trying to parse base URL.");return r.path=s.normalizePath(r.path),s.buildURLFromParts(r)}var o=s.parseURL(e);if(!o)throw new Error("Error trying to parse relative URL.");if(o.scheme)return n.alwaysNormalize?(o.path=s.normalizePath(o.path),s.buildURLFromParts(o)):e;var a=s.parseURL(t);if(!a)throw new Error("Error trying to parse base URL.");if(!a.netLoc&&a.path&&"/"!==a.path[0]){var l=i.exec(a.path);a.netLoc=l[1],a.path=l[2]}a.netLoc&&!a.path&&(a.path="/");var c={scheme:a.scheme,netLoc:o.netLoc,path:null,params:o.params,query:o.query,fragment:o.fragment};if(!o.netLoc&&(c.netLoc=a.netLoc,"/"!==o.path[0]))if(o.path){var u=a.path,h=u.substring(0,u.lastIndexOf("/")+1)+o.path;c.path=s.normalizePath(h)}else c.path=a.path,o.params||(c.params=a.params,o.query||(c.query=a.query));return null===c.path&&(c.path=n.alwaysNormalize?s.normalizePath(o.path):o.path),s.buildURLFromParts(c)},parseURL:function(t){var e=r.exec(t);return e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null},normalizePath:function(t){for(t=t.split("").reverse().join("").replace(o,"");t.length!==(t=t.replace(a,"")).length;);return t.split("").reverse().join("")},buildURLFromParts:function(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}},t.exports=s},"./node_modules/webworkify-webpack/index.js":
/*!**************************************************!*\
!*** ./node_modules/webworkify-webpack/index.js ***!
\**************************************************/
/*! no static exports found */function(t,e,n){function r(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.i=function(t){return t},n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/",n.oe=function(t){throw console.error(t),t};var r=n(n.s=ENTRY_MODULE);return r.default||r}function i(t){return(t+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function o(t,e,r){var o={};o[r]=[];var a=e.toString(),s=a.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!s)return o;for(var l,c=s[1],u=new RegExp("(\\\\n|\\W)"+i(c)+"\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)","g");l=u.exec(a);)"dll-reference"!==l[3]&&o[r].push(l[3]);for(u=new RegExp("\\("+i(c)+'\\("(dll-reference\\s([\\.|\\-|\\+|\\w|/|@]+))"\\)\\)\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)',"g");l=u.exec(a);)t[l[2]]||(o[r].push(l[1]),t[l[2]]=n(l[1]).m),o[l[2]]=o[l[2]]||[],o[l[2]].push(l[4]);for(var h,d=Object.keys(o),f=0;f<d.length;f++)for(var p=0;p<o[d[f]].length;p++)h=o[d[f]][p],isNaN(1*h)||(o[d[f]][p]=1*o[d[f]][p]);return o}function a(t){return Object.keys(t).reduce((function(e,n){return e||t[n].length>0}),!1)}t.exports=function(t,e){e=e||{};var i={main:n.m},s=e.all?{main:Object.keys(i.main)}:function(t,e){for(var n={main:[e]},r={main:[]},i={main:{}};a(n);)for(var s=Object.keys(n),l=0;l<s.length;l++){var c=s[l],u=n[c].pop();if(i[c]=i[c]||{},!i[c][u]&&t[c][u]){i[c][u]=!0,r[c]=r[c]||[],r[c].push(u);for(var h=o(t,t[c][u],c),d=Object.keys(h),f=0;f<d.length;f++)n[d[f]]=n[d[f]]||[],n[d[f]]=n[d[f]].concat(h[d[f]])}}return r}(i,t),l="";Object.keys(s).filter((function(t){return"main"!==t})).forEach((function(t){for(var e=0;s[t][e];)e++;s[t].push(e),i[t][e]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",l=l+"var "+t+" = ("+r.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+s[t].map((function(e){return JSON.stringify(e)+": "+i[t][e].toString()})).join(",")+"});\n"})),l=l+"new (("+r.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+s.main.map((function(t){return JSON.stringify(t)+": "+i.main[t].toString()})).join(",")+"}))(self);";var c=new window.Blob([l],{type:"text/javascript"});if(e.bare)return c;var u=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(c),h=new window.Worker(u);return h.objectURL=u,h}},"./src/config.ts":
/*!***********************!*\
!*** ./src/config.ts ***!
\***********************/
/*! exports provided: hlsDefaultConfig, mergeConfig, enableStreamingMode */function(t,e,n){"use strict";n.r(e),n.d(e,"hlsDefaultConfig",(function(){return E})),n.d(e,"mergeConfig",(function(){return k})),n.d(e,"enableStreamingMode",(function(){return w}));var r=n(/*! ./controller/abr-controller */"./src/controller/abr-controller.ts"),i=n(/*! ./controller/audio-stream-controller */"./src/controller/audio-stream-controller.ts"),o=n(/*! ./controller/audio-track-controller */"./src/controller/audio-track-controller.ts"),a=n(/*! ./controller/subtitle-stream-controller */"./src/controller/subtitle-stream-controller.ts"),s=n(/*! ./controller/subtitle-track-controller */"./src/controller/subtitle-track-controller.ts"),l=n(/*! ./controller/buffer-controller */"./src/controller/buffer-controller.ts"),c=n(/*! ./controller/timeline-controller */"./src/controller/timeline-controller.ts"),u=n(/*! ./controller/cap-level-controller */"./src/controller/cap-level-controller.ts"),h=n(/*! ./controller/fps-controller */"./src/controller/fps-controller.ts"),d=n(/*! ./controller/eme-controller */"./src/controller/eme-controller.ts"),f=n(/*! ./controller/cmcd-controller */"./src/controller/cmcd-controller.ts"),p=n(/*! ./utils/xhr-loader */"./src/utils/xhr-loader.ts"),g=n(/*! ./utils/fetch-loader */"./src/utils/fetch-loader.ts"),m=n(/*! ./utils/cues */"./src/utils/cues.ts"),v=n(/*! ./utils/mediakeys-helper */"./src/utils/mediakeys-helper.ts"),y=n(/*! ./utils/logger */"./src/utils/logger.ts");function b(){return(b=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function x(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function C(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?x(Object(n),!0).forEach((function(e){S(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):x(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function S(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var E=C(C({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:p.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:r.default,bufferController:l.default,capLevelController:u.default,fpsController:h.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:v.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},{cueHandler:m.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}),{},{subtitleStreamController:a.SubtitleStreamController,subtitleTrackController:s.default,timelineController:c.TimelineController,audioStreamController:i.default,audioTrackController:o.default,emeController:d.default,cmcdController:f.default});function k(t,e){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==e.liveMaxLatencyDurationCount&&(void 0===e.liveSyncDurationCount||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==e.liveMaxLatencyDuration&&(void 0===e.liveSyncDuration||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return b({},t,e)}function w(t){var e=t.loader;e!==g.default&&e!==p.default?(y.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),t.progressive=!1):Object(g.fetchSupported)()&&(t.loader=g.default,t.progressive=!0,t.enableSoftwareAES=!0,y.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}},"./src/controller/abr-controller.ts":
/*!******************************************!*\
!*** ./src/controller/abr-controller.ts ***!
\******************************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e);var r=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=n(/*! ../utils/ewma-bandwidth-estimator */"./src/utils/ewma-bandwidth-estimator.ts"),o=n(/*! ../events */"./src/events.ts"),a=n(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),s=n(/*! ../errors */"./src/errors.ts"),l=n(/*! ../types/loader */"./src/types/loader.ts"),c=n(/*! ../utils/logger */"./src/utils/logger.ts");function u(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var h=function(){function t(t){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=t;var e=t.config;this.bwEstimator=new i.default(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate),this.registerListeners()}var e,n,h,d=t.prototype;return d.registerListeners=function(){var t=this.hls;t.on(o.Events.FRAG_LOADING,this.onFragLoading,this),t.on(o.Events.FRAG_LOADED,this.onFragLoaded,this),t.on(o.Events.FRAG_BUFFERED,this.onFragBuffered,this),t.on(o.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.on(o.Events.ERROR,this.onError,this)},d.unregisterListeners=function(){var t=this.hls;t.off(o.Events.FRAG_LOADING,this.onFragLoading,this),t.off(o.Events.FRAG_LOADED,this.onFragLoaded,this),t.off(o.Events.FRAG_BUFFERED,this.onFragBuffered,this),t.off(o.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.off(o.Events.ERROR,this.onError,this)},d.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},d.onFragLoading=function(t,e){var n,r=e.frag;r.type===l.PlaylistLevelType.MAIN&&(this.timer||(this.fragCurrent=r,this.partCurrent=null!=(n=e.part)?n:null,this.timer=self.setInterval(this.onCheck,100)))},d.onLevelLoaded=function(t,e){var n=this.hls.config;e.details.live?this.bwEstimator.update(n.abrEwmaSlowLive,n.abrEwmaFastLive):this.bwEstimator.update(n.abrEwmaSlowVoD,n.abrEwmaFastVoD)},d._abandonRulesCheck=function(){var t=this.fragCurrent,e=this.partCurrent,n=this.hls,i=n.autoLevelEnabled,s=n.config,l=n.media;if(t&&l){var u=e?e.stats:t.stats,h=e?e.duration:t.duration;if(u.aborted)return c.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),void(this._nextAutoLevel=-1);if(i&&!l.paused&&l.playbackRate&&l.readyState){var d=performance.now()-u.loading.start,f=Math.abs(l.playbackRate);if(!(d<=500*h/f)){var p=n.levels,g=n.minAutoLevel,m=p[t.level],v=u.total||Math.max(u.loaded,Math.round(h*m.maxBitrate/8)),y=Math.max(1,u.bwEstimate?u.bwEstimate/8:1e3*u.loaded/d),b=(v-u.loaded)/y,x=l.currentTime,C=(a.BufferHelper.bufferInfo(l,x,s.maxBufferHole).end-x)/f;if(!(C>=2*h/f||b<=C)){var S,E=Number.POSITIVE_INFINITY;for(S=t.level-1;S>g&&!((E=h*p[S].maxBitrate/(6.4*y))<C);S--);if(!(E>=b)){var k=this.bwEstimator.getEstimate();c.logger.warn("Fragment "+t.sn+(e?" part "+e.index:"")+" of level "+t.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+S+"\n Current BW estimate: "+(Object(r.isFiniteNumber)(k)?(k/1024).toFixed(3):"Unknown")+" Kb/s\n Estimated load time for current fragment: "+b.toFixed(3)+" s\n Estimated load time for the next fragment: "+E.toFixed(3)+" s\n Time to underbuffer: "+C.toFixed(3)+" s"),n.nextLoadLevel=S,this.bwEstimator.sample(d,u.loaded),this.clearTimer(),t.loader&&(this.fragCurrent=this.partCurrent=null,t.loader.abort()),n.trigger(o.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:e,stats:u})}}}}}},d.onFragLoaded=function(t,e){var n=e.frag,i=e.part;if(n.type===l.PlaylistLevelType.MAIN&&Object(r.isFiniteNumber)(n.sn)){var a=i?i.stats:n.stats,s=i?i.duration:n.duration;if(this.clearTimer(),this.lastLoadedFragLevel=n.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var c=this.hls.levels[n.level],u=(c.loaded?c.loaded.bytes:0)+a.loaded,h=(c.loaded?c.loaded.duration:0)+s;c.loaded={bytes:u,duration:h},c.realBitrate=Math.round(8*u/h)}if(n.bitrateTest){var d={stats:a,frag:n,part:i,id:n.type};this.onFragBuffered(o.Events.FRAG_BUFFERED,d),n.bitrateTest=!1}}},d.onFragBuffered=function(t,e){var n=e.frag,r=e.part,i=r?r.stats:n.stats;if(!i.aborted&&n.type===l.PlaylistLevelType.MAIN&&"initSegment"!==n.sn){var o=i.parsing.end-i.loading.start;this.bwEstimator.sample(o,i.loaded),i.bwEstimate=this.bwEstimator.getEstimate(),n.bitrateTest?this.bitrateTestDelay=o/1e3:this.bitrateTestDelay=0}},d.onError=function(t,e){switch(e.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer()}},d.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},d.getNextABRAutoLevel=function(){var t=this.fragCurrent,e=this.partCurrent,n=this.hls,r=n.maxAutoLevel,i=n.config,o=n.minAutoLevel,s=n.media,l=e?e.duration:t?t.duration:0,u=s?s.currentTime:0,h=s&&0!==s.playbackRate?Math.abs(s.playbackRate):1,d=this.bwEstimator?this.bwEstimator.getEstimate():i.abrEwmaDefaultEstimate,f=(a.BufferHelper.bufferInfo(s,u,i.maxBufferHole).end-u)/h,p=this.findBestLevel(d,o,r,f,i.abrBandWidthFactor,i.abrBandWidthUpFactor);if(p>=0)return p;c.logger.trace((f?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var g=l?Math.min(l,i.maxStarvationDelay):i.maxStarvationDelay,m=i.abrBandWidthFactor,v=i.abrBandWidthUpFactor;if(!f){var y=this.bitrateTestDelay;y&&(g=(l?Math.min(l,i.maxLoadingDelay):i.maxLoadingDelay)-y,c.logger.trace("bitrate test took "+Math.round(1e3*y)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*g)+" ms"),m=v=1)}return p=this.findBestLevel(d,o,r,f+g,m,v),Math.max(p,0)},d.findBestLevel=function(t,e,n,r,i,o){for(var a,s=this.fragCurrent,l=this.partCurrent,u=this.lastLoadedFragLevel,h=this.hls.levels,d=h[u],f=!(null==d||null===(a=d.details)||void 0===a||!a.live),p=null==d?void 0:d.codecSet,g=l?l.duration:s?s.duration:0,m=n;m>=e;m--){var v=h[m];if(v&&(!p||v.codecSet===p)){var y=v.details,b=(l?null==y?void 0:y.partTarget:null==y?void 0:y.averagetargetduration)||g,x=void 0;x=m<=u?i*t:o*t;var C=h[m].maxBitrate,S=C*b/x;if(c.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+m+"/"+Math.round(x)+"/"+C+"/"+b+"/"+r+"/"+S),x>C&&(!S||f&&!this.bitrateTestDelay||S<r))return m}}return-1},e=t,(n=[{key:"nextAutoLevel",get:function(){var t=this._nextAutoLevel,e=this.bwEstimator;if(!(-1===t||e&&e.canEstimate()))return t;var n=this.getNextABRAutoLevel();return-1!==t&&(n=Math.min(t,n)),n},set:function(t){this._nextAutoLevel=t}}])&&u(e.prototype,n),h&&u(e,h),t}();e.default=h},"./src/controller/audio-stream-controller.ts":
/*!***************************************************!*\
!*** ./src/controller/audio-stream-controller.ts ***!
\***************************************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e);var r=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=n(/*! ./base-stream-controller */"./src/controller/base-stream-controller.ts"),o=n(/*! ../events */"./src/events.ts"),a=n(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),s=n(/*! ./fragment-tracker */"./src/controller/fragment-tracker.ts"),l=n(/*! ../types/level */"./src/types/level.ts"),c=n(/*! ../types/loader */"./src/types/loader.ts"),u=n(/*! ../loader/fragment */"./src/loader/fragment.ts"),h=n(/*! ../demux/chunk-cache */"./src/demux/chunk-cache.ts"),d=n(/*! ../demux/transmuxer-interface */"./src/demux/transmuxer-interface.ts"),f=n(/*! ../types/transmuxer */"./src/types/transmuxer.ts"),p=n(/*! ./fragment-finders */"./src/controller/fragment-finders.ts"),g=n(/*! ../utils/discontinuities */"./src/utils/discontinuities.ts"),m=n(/*! ../errors */"./src/errors.ts"),v=n(/*! ../utils/logger */"./src/utils/logger.ts");function y(){return(y=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function b(t,e){return(b=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var x=function(t){var e,n;function x(e,n){var r;return(r=t.call(this,e,n,"[audio-stream-controller]")||this).videoBuffer=null,r.videoTrackCC=-1,r.waitingVideoCC=-1,r.audioSwitch=!1,r.trackId=-1,r.waitingData=null,r.mainDetails=null,r.bufferFlushed=!1,r._registerListeners(),r}n=t,(e=x).prototype=Object.create(n.prototype),e.prototype.constructor=e,b(e,n);var C=x.prototype;return C.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},C._registerListeners=function(){var t=this.hls;t.on(o.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(o.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(o.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(o.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.on(o.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.on(o.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(o.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(o.Events.ERROR,this.onError,this),t.on(o.Events.BUFFER_RESET,this.onBufferReset,this),t.on(o.Events.BUFFER_CREATED,this.onBufferCreated,this),t.on(o.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(o.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(o.Events.FRAG_BUFFERED,this.onFragBuffered,this)},C._unregisterListeners=function(){var t=this.hls;t.off(o.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(o.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(o.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(o.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.off(o.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.off(o.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(o.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(o.Events.ERROR,this.onError,this),t.off(o.Events.BUFFER_RESET,this.onBufferReset,this),t.off(o.Events.BUFFER_CREATED,this.onBufferCreated,this),t.off(o.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(o.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(o.Events.FRAG_BUFFERED,this.onFragBuffered,this)},C.onInitPtsFound=function(t,e){var n=e.frag,r=e.id,o=e.initPTS;if("main"===r){var a=n.cc;this.initPTS[n.cc]=o,this.log("InitPTS for cc: "+a+" found from main: "+o),this.videoTrackCC=a,this.state===i.State.WAITING_INIT_PTS&&this.tick()}},C.startLoad=function(t){if(!this.levels)return this.startPosition=t,void(this.state=i.State.STOPPED);var e=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),this.fragLoadError=0,e>0&&-1===t?(this.log("Override startPosition with lastCurrentTime @"+e.toFixed(3)),this.state=i.State.IDLE):(this.loadedmetadata=!1,this.state=i.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()},C.doTick=function(){switch(this.state){case i.State.IDLE:this.doTickIdle();break;case i.State.WAITING_TRACK:var e,n=this.levels,r=this.trackId,o=null==n||null===(e=n[r])||void 0===e?void 0:e.details;if(o){if(this.waitForCdnTuneIn(o))break;this.state=i.State.WAITING_INIT_PTS}break;case i.State.FRAG_LOADING_WAITING_RETRY:var s,l=performance.now(),c=this.retryDate;(!c||l>=c||null!==(s=this.media)&&void 0!==s&&s.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=i.State.IDLE);break;case i.State.WAITING_INIT_PTS:var u=this.waitingData;if(u){var h=u.frag,d=u.part,f=u.cache,g=u.complete;if(void 0!==this.initPTS[h.cc]){this.waitingData=null,this.waitingVideoCC=-1,this.state=i.State.FRAG_LOADING;var m={frag:h,part:d,payload:f.flush(),networkDetails:null};this._handleFragmentLoadProgress(m),g&&t.prototype._handleFragmentLoadComplete.call(this,m)}else if(this.videoTrackCC!==this.waitingVideoCC)v.logger.log("Waiting fragment cc ("+h.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var y=this.getLoadPosition(),b=a.BufferHelper.bufferInfo(this.mediaBuffer,y,this.config.maxBufferHole);Object(p.fragmentWithinToleranceTest)(b.end,this.config.maxFragLookUpTolerance,h)<0&&(v.logger.log("Waiting fragment cc ("+h.cc+") @ "+h.start+" cancelled because another fragment at "+b.end+" is needed"),this.clearWaitingFragment())}}else this.state=i.State.IDLE}this.onTickEnd()},C.clearWaitingFragment=function(){var t=this.waitingData;t&&(this.fragmentTracker.removeFragment(t.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=i.State.IDLE)},C.onTickEnd=function(){var t=this.media;if(t&&t.readyState){var e=(this.mediaBuffer?this.mediaBuffer:t).buffered;!this.loadedmetadata&&e.length&&(this.loadedmetadata=!0),this.lastCurrentTime=t.currentTime}},C.doTickIdle=function(){var t,e,n=this.hls,r=this.levels,a=this.media,s=this.trackId,l=n.config;if(r&&r[s]&&(a||!this.startFragRequested&&l.startFragPrefetch)){var h=r[s].details;if(!h||h.live&&this.levelLastLoaded!==s||this.waitForCdnTuneIn(h))this.state=i.State.WAITING_TRACK;else{this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,u.ElementaryStreamTypes.AUDIO,c.PlaylistLevelType.AUDIO));var d=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,c.PlaylistLevelType.AUDIO);if(null!==d){var f=d.len,p=this.getMaxBufferLength(),g=this.audioSwitch;if(!(f>=p)||g){if(!g&&this._streamEnded(d,h))return n.trigger(o.Events.BUFFER_EOS,{type:"audio"}),void(this.state=i.State.ENDED);var m=h.fragments[0].start,v=d.end;if(g){var y=this.getLoadPosition();v=y,h.PTSKnown&&y<m&&(d.end>m||d.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),a.currentTime=m+.05)}var b=this.getNextFragment(v,h);b?"identity"!==(null===(t=b.decryptdata)||void 0===t?void 0:t.keyFormat)||null!==(e=b.decryptdata)&&void 0!==e&&e.key?this.loadFragment(b,h,v):this.loadKey(b,h):this.bufferFlushed=!0}}}}},C.getMaxBufferLength=function(){var e=t.prototype.getMaxBufferLength.call(this),n=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,c.PlaylistLevelType.MAIN);return null===n?e:Math.max(e,n.len)},C.onMediaDetaching=function(){this.videoBuffer=null,t.prototype.onMediaDetaching.call(this)},C.onAudioTracksUpdated=function(t,e){var n=e.audioTracks;this.resetTransmuxer(),this.levels=n.map((function(t){return new l.Level(t)}))},C.onAudioTrackSwitching=function(t,e){var n=!!e.url;this.trackId=e.id;var r=this.fragCurrent;null!=r&&r.loader&&r.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),n?this.setInterval(100):this.resetTransmuxer(),n?(this.audioSwitch=!0,this.state=i.State.IDLE):this.state=i.State.STOPPED,this.tick()},C.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},C.onLevelLoaded=function(t,e){this.mainDetails=e.details},C.onAudioTrackLoaded=function(t,e){var n,r=this.levels,o=e.details,a=e.id;if(r){this.log("Track "+a+" loaded ["+o.startSN+","+o.endSN+"],duration:"+o.totalduration);var s=r[a],l=0;if(o.live||null!==(n=s.details)&&void 0!==n&&n.live){var c=this.mainDetails;if(o.fragments[0]||(o.deltaUpdateFailed=!0),o.deltaUpdateFailed||!c)return;!s.details&&o.hasProgramDateTime&&c.hasProgramDateTime?(Object(g.alignMediaPlaylistByPDT)(o,c),l=o.fragments[0].start):l=this.alignPlaylists(o,s.details)}s.details=o,this.levelLastLoaded=a,this.startFragRequested||!this.mainDetails&&o.live||this.setStartPosition(s.details,l),this.state!==i.State.WAITING_TRACK||this.waitForCdnTuneIn(o)||(this.state=i.State.IDLE),this.tick()}else this.warn("Audio tracks were reset while loading level "+a)},C._handleFragmentLoadProgress=function(t){var e,n=t.frag,r=t.part,o=t.payload,a=this.config,s=this.trackId,l=this.levels;if(l){var u=l[s];console.assert(u,"Audio track is defined on fragment load progress");var p=u.details;console.assert(p,"Audio track details are defined on fragment load progress");var g=a.defaultAudioCodec||u.audioCodec||"mp4a.40.2",m=this.transmuxer;m||(m=this.transmuxer=new d.default(this.hls,c.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var y=this.initPTS[n.cc],b=null===(e=n.initSegment)||void 0===e?void 0:e.data;if(void 0!==y){var x=r?r.index:-1,C=-1!==x,S=new f.ChunkMetadata(n.level,n.sn,n.stats.chunkCount,o.byteLength,x,C);m.push(o,b,g,"",n,r,p.totalduration,!1,S,y)}else v.logger.log("Unknown video PTS for cc "+n.cc+", waiting for video PTS before demuxing audio frag "+n.sn+" of ["+p.startSN+" ,"+p.endSN+"],track "+s),(this.waitingData=this.waitingData||{frag:n,part:r,cache:new h.default,complete:!1}).cache.push(new Uint8Array(o)),this.waitingVideoCC=this.videoTrackCC,this.state=i.State.WAITING_INIT_PTS}else this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+n.sn+" of level "+n.level+" will not be buffered")},C._handleFragmentLoadComplete=function(e){this.waitingData?this.waitingData.complete=!0:t.prototype._handleFragmentLoadComplete.call(this,e)},C.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},C.onBufferCreated=function(t,e){var n=e.tracks.audio;n&&(this.mediaBuffer=n.buffer),e.tracks.video&&(this.videoBuffer=e.tracks.video.buffer)},C.onFragBuffered=function(t,e){var n=e.frag,r=e.part;n.type===c.PlaylistLevelType.AUDIO&&(this.fragContextChanged(n)?this.warn("Fragment "+n.sn+(r?" p: "+r.index:"")+" of level "+n.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch):("initSegment"!==n.sn&&(this.fragPrevious=n,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(o.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(n,r)))},C.onError=function(e,n){switch(n.details){case m.ErrorDetails.FRAG_LOAD_ERROR:case m.ErrorDetails.FRAG_LOAD_TIMEOUT:case m.ErrorDetails.KEY_LOAD_ERROR:case m.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(c.PlaylistLevelType.AUDIO,n);break;case m.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case m.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==i.State.ERROR&&this.state!==i.State.STOPPED&&(this.state=n.fatal?i.State.ERROR:i.State.IDLE,this.warn(n.details+" while loading frag, switching to "+this.state+" state"));break;case m.ErrorDetails.BUFFER_FULL_ERROR:if("audio"===n.parent&&(this.state===i.State.PARSING||this.state===i.State.PARSED)){var r=!0,o=this.getFwdBufferInfo(this.mediaBuffer,c.PlaylistLevelType.AUDIO);o&&o.len>.5&&(r=!this.reduceMaxBufferLength(o.len)),r&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,t.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}}},C.onBufferFlushed=function(t,e){e.type===u.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},C._handleTransmuxComplete=function(t){var e,n="audio",r=this.hls,a=t.remuxResult,s=t.chunkMeta,l=this.getCurrentContext(s);if(!l)return this.warn("The loading context changed while buffering fragment "+s.sn+" of level "+s.level+". This chunk will not be buffered."),void this.resetLiveStartWhenNotLoaded(s.level);var c=l.frag,h=l.part,d=a.audio,f=a.text,p=a.id3,g=a.initSegment;if(!this.fragContextChanged(c)){if(this.state=i.State.PARSING,this.audioSwitch&&d&&this.completeAudioSwitch(),null!=g&&g.tracks&&(this._bufferInitSegment(g.tracks,c,s),r.trigger(o.Events.FRAG_PARSING_INIT_SEGMENT,{frag:c,id:n,tracks:g.tracks})),d){var m=d.startPTS,v=d.endPTS,b=d.startDTS,x=d.endDTS;h&&(h.elementaryStreams[u.ElementaryStreamTypes.AUDIO]={startPTS:m,endPTS:v,startDTS:b,endDTS:x}),c.setElementaryStreamInfo(u.ElementaryStreamTypes.AUDIO,m,v,b,x),this.bufferFragmentData(d,c,h,s)}if(null!=p&&null!==(e=p.samples)&&void 0!==e&&e.length){var C=y({frag:c,id:n},p);r.trigger(o.Events.FRAG_PARSING_METADATA,C)}if(f){var S=y({frag:c,id:n},f);r.trigger(o.Events.FRAG_PARSING_USERDATA,S)}}},C._bufferInitSegment=function(t,e,n){if(this.state===i.State.PARSING){t.video&&delete t.video;var r=t.audio;if(r){r.levelCodec=r.codec,r.id="audio",this.log("Init audio buffer, container:"+r.container+", codecs[parsed]=["+r.codec+"]"),this.hls.trigger(o.Events.BUFFER_CODECS,t);var a=r.initSegment;if(null!=a&&a.byteLength){var s={type:"audio",frag:e,part:null,chunkMeta:n,parent:e.type,data:a};this.hls.trigger(o.Events.BUFFER_APPENDING,s)}this.tick()}}},C.loadFragment=function(e,n,o){var a=this.fragmentTracker.getState(e);this.fragCurrent=e,(this.audioSwitch||a===s.FragmentState.NOT_LOADED||a===s.FragmentState.PARTIAL)&&("initSegment"===e.sn?this._loadInitSegment(e):n.live&&!Object(r.isFiniteNumber)(this.initPTS[e.cc])?(this.log("Waiting for video PTS in continuity counter "+e.cc+" of live stream before loading audio fragment "+e.sn+" of level "+this.trackId),this.state=i.State.WAITING_INIT_PTS):(this.startFragRequested=!0,t.prototype.loadFragment.call(this,e,n,o)))},C.completeAudioSwitch=function(){var e=this.hls,n=this.media,r=this.trackId;n&&(this.log("Switching audio track : flushing all audio"),t.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,e.trigger(o.Events.AUDIO_TRACK_SWITCHED,{id:r})},x}(i.default);e.default=x},"./src/controller/audio-track-controller.ts":
/*!**************************************************!*\
!*** ./src/controller/audio-track-controller.ts ***!
\**************************************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e);var r=n(/*! ../events */"./src/events.ts"),i=n(/*! ../errors */"./src/errors.ts"),o=n(/*! ./base-playlist-controller */"./src/controller/base-playlist-controller.ts"),a=n(/*! ../types/loader */"./src/types/loader.ts");function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var c=function(t){var e,n;function o(e){var n;return(n=t.call(this,e,"[audio-track-controller]")||this).tracks=[],n.groupId=null,n.tracksInGroup=[],n.trackId=-1,n.trackName="",n.selectDefaultTrack=!0,n.registerListeners(),n}n=t,(e=o).prototype=Object.create(n.prototype),e.prototype.constructor=e,l(e,n);var c,u,h,d=o.prototype;return d.registerListeners=function(){var t=this.hls;t.on(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.on(r.Events.LEVEL_LOADING,this.onLevelLoading,this),t.on(r.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(r.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(r.Events.ERROR,this.onError,this)},d.unregisterListeners=function(){var t=this.hls;t.off(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.off(r.Events.LEVEL_LOADING,this.onLevelLoading,this),t.off(r.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(r.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(r.Events.ERROR,this.onError,this)},d.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,t.prototype.destroy.call(this)},d.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},d.onManifestParsed=function(t,e){this.tracks=e.audioTracks||[]},d.onAudioTrackLoaded=function(t,e){var n=e.id,r=e.details,i=this.tracksInGroup[n];if(i){var o=i.details;i.details=e.details,this.log("audioTrack "+n+" loaded ["+r.startSN+"-"+r.endSN+"]"),n===this.trackId&&(this.retryCount=0,this.playlistLoaded(n,e,o))}else this.warn("Invalid audio track id "+n)},d.onLevelLoading=function(t,e){this.switchLevel(e.level)},d.onLevelSwitching=function(t,e){this.switchLevel(e.level)},d.switchLevel=function(t){var e=this.hls.levels[t];if(null!=e&&e.audioGroupIds){var n=e.audioGroupIds[e.urlId];if(this.groupId!==n){this.groupId=n;var i=this.tracks.filter((function(t){return!n||t.groupId===n}));this.selectDefaultTrack&&!i.some((function(t){return t.default}))&&(this.selectDefaultTrack=!1),this.tracksInGroup=i;var o={audioTracks:i};this.log("Updating audio tracks, "+i.length+' track(s) found in "'+n+'" group-id'),this.hls.trigger(r.Events.AUDIO_TRACKS_UPDATED,o),this.selectInitialTrack()}}},d.onError=function(e,n){t.prototype.onError.call(this,e,n),!n.fatal&&n.context&&n.context.type===a.PlaylistContextType.AUDIO_TRACK&&n.context.id===this.trackId&&n.context.groupId===this.groupId&&this.retryLoadingOrFail(n)},d.setAudioTrack=function(t){var e=this.tracksInGroup;if(t<0||t>=e.length)this.warn("Invalid id passed to audio-track controller");else{this.clearTimer();var n=e[this.trackId];this.log("Now switching to audio-track index "+t);var i=e[t],o=i.id,a=i.groupId,s=void 0===a?"":a,l=i.name,c=i.type,u=i.url;if(this.trackId=t,this.trackName=l,this.selectDefaultTrack=!1,this.hls.trigger(r.Events.AUDIO_TRACK_SWITCHING,{id:o,groupId:s,name:l,type:c,url:u}),!i.details||i.details.live){var h=this.switchParams(i.url,null==n?void 0:n.details);this.loadPlaylist(h)}}},d.selectInitialTrack=function(){var t=this.tracksInGroup;console.assert(t.length,"Initial audio track should be selected when tracks are known");var e=this.trackName,n=this.findTrackId(e)||this.findTrackId();-1!==n?this.setAudioTrack(n):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(r.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},d.findTrackId=function(t){for(var e=this.tracksInGroup,n=0;n<e.length;n++){var r=e[n];if((!this.selectDefaultTrack||r.default)&&(!t||t===r.name))return r.id}return-1},d.loadPlaylist=function(t){var e=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(e)){var n=e.id,i=e.groupId,o=e.url;if(t)try{o=t.addDirectives(o)}catch(t){this.warn("Could not construct new URL with HLS Delivery Directives: "+t)}this.log("loading audio-track playlist for id: "+n),this.clearTimer(),this.hls.trigger(r.Events.AUDIO_TRACK_LOADING,{url:o,id:n,groupId:i,deliveryDirectives:t||null})}},c=o,(u=[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(t){this.selectDefaultTrack=!1,this.setAudioTrack(t)}}])&&s(c.prototype,u),h&&s(c,h),o}(o.default);e.default=c},"./src/controller/base-playlist-controller.ts":
/*!****************************************************!*\
!*** ./src/controller/base-playlist-controller.ts ***!
\****************************************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return l}));var r=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=n(/*! ../types/level */"./src/types/level.ts"),o=n(/*! ./level-helper */"./src/controller/level-helper.ts"),a=n(/*! ../utils/logger */"./src/utils/logger.ts"),s=n(/*! ../errors */"./src/errors.ts"),l=function(){function t(t,e){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=a.logger.log.bind(a.logger,e+":"),this.warn=a.logger.warn.bind(a.logger,e+":"),this.hls=t}var e=t.prototype;return e.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},e.onError=function(t,e){e.fatal&&e.type===s.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},e.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},e.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},e.stopLoad=function(){this.canLoad=!1,this.clearTimer()},e.switchParams=function(t,e){var n=null==e?void 0:e.renditionReports;if(n)for(var o=0;o<n.length;o++){var a=n[o],s=""+a.URI;if(s===t.substr(-s.length)){var l=parseInt(a["LAST-MSN"]),c=parseInt(a["LAST-PART"]);if(e&&this.hls.config.lowLatencyMode){var u=Math.min(e.age-e.partTarget,e.targetduration);void 0!==c&&u>e.partTarget&&(c+=1)}if(Object(r.isFiniteNumber)(l))return new i.HlsUrlParameters(l,Object(r.isFiniteNumber)(c)?c:void 0,i.HlsSkip.No)}}},e.loadPlaylist=function(t){},e.shouldLoadTrack=function(t){return this.canLoad&&t&&!!t.url&&(!t.details||t.details.live)},e.playlistLoaded=function(t,e,n){var r=this,i=e.details,a=e.stats,s=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(i.advancedDateTime=Date.now()-s,i.live||null!=n&&n.live){if(i.reloaded(n),n&&this.log("live playlist "+t+" "+(i.advanced?"REFRESHED "+i.lastPartSn+"-"+i.lastPartIndex:"MISSED")),n&&i.fragments.length>0&&Object(o.mergeDetails)(n,i),!this.canLoad||!i.live)return;var l,c=void 0,u=void 0;if(i.canBlockReload&&i.endSN&&i.advanced){var h=this.hls.config.lowLatencyMode,d=i.lastPartSn,f=i.endSN,p=i.lastPartIndex,g=d===f;-1!==p?(c=g?f+1:d,u=g?h?0:p:p+1):c=f+1;var m=i.age,v=m+i.ageHeader,y=Math.min(v-i.partTarget,1.5*i.targetduration);if(y>0){if(n&&y>n.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+n.tuneInGoal+" to: "+y+" with playlist age: "+i.age),y=0;else{var b=Math.floor(y/i.targetduration);c+=b,void 0!==u&&(u+=Math.round(y%i.targetduration/i.partTarget)),this.log("CDN Tune-in age: "+i.ageHeader+"s last advanced "+m.toFixed(2)+"s goal: "+y+" skip sn "+b+" to part "+u)}i.tuneInGoal=y}if(l=this.getDeliveryDirectives(i,e.deliveryDirectives,c,u),h||!g)return void this.loadPlaylist(l)}else l=this.getDeliveryDirectives(i,e.deliveryDirectives,c,u);var x=Object(o.computeReloadInterval)(i,a);void 0!==c&&i.canBlockReload&&(x-=i.partTarget||1),this.log("reload live playlist "+t+" in "+Math.round(x)+" ms"),this.timer=self.setTimeout((function(){return r.loadPlaylist(l)}),x)}else this.clearTimer()},e.getDeliveryDirectives=function(t,e,n,r){var o=Object(i.getSkipValue)(t,n);return null!=e&&e.skip&&t.deltaUpdateFailed&&(n=e.msn,r=e.part,o=i.HlsSkip.No),new i.HlsUrlParameters(n,r,o)},e.retryLoadingOrFail=function(t){var e,n=this,r=this.hls.config,i=this.retryCount<r.levelLoadingMaxRetry;if(i)if(this.retryCount++,t.details.indexOf("LoadTimeOut")>-1&&null!==(e=t.context)&&void 0!==e&&e.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+t.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*r.levelLoadingRetryDelay,r.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout((function(){return n.loadPlaylist()}),o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+t.details+'"')}else this.warn('cannot recover from error "'+t.details+'"'),this.clearTimer(),t.fatal=!0;return i},t}()},"./src/controller/base-stream-controller.ts":
/*!**************************************************!*\
!*** ./src/controller/base-stream-controller.ts ***!
\**************************************************/
/*! exports provided: State, default */function(t,e,n){"use strict";n.r(e),n.d(e,"State",(function(){return C})),n.d(e,"default",(function(){return S}));var r=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=n(/*! ../task-loop */"./src/task-loop.ts"),o=n(/*! ./fragment-tracker */"./src/controller/fragment-tracker.ts"),a=n(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),s=n(/*! ../utils/logger */"./src/utils/logger.ts"),l=n(/*! ../events */"./src/events.ts"),c=n(/*! ../errors */"./src/errors.ts"),u=n(/*! ../types/transmuxer */"./src/types/transmuxer.ts"),h=n(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),d=n(/*! ../utils/discontinuities */"./src/utils/discontinuities.ts"),f=n(/*! ./fragment-finders */"./src/controller/fragment-finders.ts"),p=n(/*! ./level-helper */"./src/controller/level-helper.ts"),g=n(/*! ../loader/fragment-loader */"./src/loader/fragment-loader.ts"),m=n(/*! ../crypt/decrypter */"./src/crypt/decrypter.ts"),v=n(/*! ../utils/time-ranges */"./src/utils/time-ranges.ts"),y=n(/*! ../types/loader */"./src/types/loader.ts");function b(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function x(t,e){return(x=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var C={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"},S=function(t){var e,n;function i(e,n,r){var i;return(i=t.call(this)||this).hls=void 0,i.fragPrevious=null,i.fragCurrent=null,i.fragmentTracker=void 0,i.transmuxer=null,i._state=C.STOPPED,i.media=void 0,i.mediaBuffer=void 0,i.config=void 0,i.bitrateTest=!1,i.lastCurrentTime=0,i.nextLoadPosition=0,i.startPosition=0,i.loadedmetadata=!1,i.fragLoadError=0,i.retryDate=0,i.levels=null,i.fragmentLoader=void 0,i.levelLastLoaded=null,i.startFragRequested=!1,i.decrypter=void 0,i.initPTS=[],i.onvseeking=null,i.onvended=null,i.logPrefix="",i.log=void 0,i.warn=void 0,i.logPrefix=r,i.log=s.logger.log.bind(s.logger,r+":"),i.warn=s.logger.warn.bind(s.logger,r+":"),i.hls=e,i.fragmentLoader=new g.default(e.config),i.fragmentTracker=n,i.config=e.config,i.decrypter=new m.default(e,e.config),e.on(l.Events.KEY_LOADED,i.onKeyLoaded,function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(i)),i}n=t,(e=i).prototype=Object.create(n.prototype),e.prototype.constructor=e,x(e,n);var S,E,k,w=i.prototype;return w.doTick=function(){this.onTickEnd()},w.onTickEnd=function(){},w.startLoad=function(t){},w.stopLoad=function(){this.fragmentLoader.abort();var t=this.fragCurrent;t&&this.fragmentTracker.removeFragment(t),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=C.STOPPED},w._streamEnded=function(t,e){var n=this.fragCurrent,r=this.fragmentTracker;if(!e.live&&n&&n.sn===e.endSN&&!t.nextStart){var i=r.getState(n);return i===o.FragmentState.PARTIAL||i===o.FragmentState.OK}return!1},w.onMediaAttached=function(t,e){var n=this.media=this.mediaBuffer=e.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),n.addEventListener("seeking",this.onvseeking),n.addEventListener("ended",this.onvended);var r=this.config;this.levels&&r.autoStartLoad&&this.state===C.STOPPED&&this.startLoad(r.startPosition)},w.onMediaDetaching=function(){var t=this.media;null!=t&&t.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),t&&(t.removeEventListener("seeking",this.onvseeking),t.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},w.onMediaSeeking=function(){var t=this.config,e=this.fragCurrent,n=this.media,i=this.mediaBuffer,o=this.state,s=n?n.currentTime:0,l=a.BufferHelper.bufferInfo(i||n,s,t.maxBufferHole);if(this.log("media seeking to "+(Object(r.isFiniteNumber)(s)?s.toFixed(3):s)+", state: "+o),o===C.ENDED)this.resetLoadingState();else if(e&&!l.len){var c=t.maxFragLookUpTolerance,u=e.start-c,h=s>e.start+e.duration+c;(s<u||h)&&(h&&e.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),e.loader.abort()),this.resetLoadingState())}n&&(this.lastCurrentTime=s),this.loadedmetadata||l.len||(this.nextLoadPosition=this.startPosition=s),this.tickImmediate()},w.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},w.onKeyLoaded=function(t,e){if(this.state===C.KEY_LOADING&&e.frag===this.fragCurrent&&this.levels){this.state=C.IDLE;var n=this.levels[e.frag.level].details;n&&this.loadFragment(e.frag,n,e.frag.start)}},w.onHandlerDestroying=function(){this.stopLoad(),t.prototype.onHandlerDestroying.call(this)},w.onHandlerDestroyed=function(){this.state=C.STOPPED,this.hls.off(l.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,t.prototype.onHandlerDestroyed.call(this)},w.loadKey=function(t,e){this.log("Loading key for "+t.sn+" of ["+e.startSN+"-"+e.endSN+"], "+("[stream-controller]"===this.logPrefix?"level":"track")+" "+t.level),this.state=C.KEY_LOADING,this.fragCurrent=t,this.hls.trigger(l.Events.KEY_LOADING,{frag:t})},w.loadFragment=function(t,e,n){this._loadFragForPlayback(t,e,n)},w._loadFragForPlayback=function(t,e,n){var r=this;this._doFragLoad(t,e,n,(function(e){if(r.fragContextChanged(t))return r.warn("Fragment "+t.sn+(e.part?" p: "+e.part.index:"")+" of level "+t.level+" was dropped during download."),void r.fragmentTracker.removeFragment(t);t.stats.chunkCount++,r._handleFragmentLoadProgress(e)})).then((function(e){if(e){r.fragLoadError=0;var n=r.state;if(!r.fragContextChanged(t))return"payload"in e&&(r.log("Loaded fragment "+t.sn+" of level "+t.level),r.hls.trigger(l.Events.FRAG_LOADED,e),r.state===C.BACKTRACKING)?(r.fragmentTracker.backtrack(t,e),void r.resetFragmentLoading(t)):void r._handleFragmentLoadComplete(e);(n===C.FRAG_LOADING||n===C.BACKTRACKING||!r.fragCurrent&&n===C.PARSING)&&(r.fragmentTracker.removeFragment(t),r.state=C.IDLE)}})).catch((function(e){r.warn(e),r.resetFragmentLoading(t)}))},w.flushMainBuffer=function(t,e,n){if(void 0===n&&(n=null),t-e){var r={startOffset:t,endOffset:e,type:n};this.fragLoadError=0,this.hls.trigger(l.Events.BUFFER_FLUSHING,r)}},w._loadInitSegment=function(t){var e=this;this._doFragLoad(t).then((function(n){if(!n||e.fragContextChanged(t)||!e.levels)throw new Error("init load aborted");return n})).then((function(n){var r=e.hls,i=n.payload,o=t.decryptdata;if(i&&i.byteLength>0&&o&&o.key&&o.iv&&"AES-128"===o.method){var a=self.performance.now();return e.decrypter.webCryptoDecrypt(new Uint8Array(i),o.key.buffer,o.iv.buffer).then((function(e){var i=self.performance.now();return r.trigger(l.Events.FRAG_DECRYPTED,{frag:t,payload:e,stats:{tstart:a,tdecrypt:i}}),n.payload=e,n}))}return n})).then((function(n){var r=e.fragCurrent,i=e.hls,o=e.levels;if(!o)throw new Error("init load aborted, missing levels");var a=o[t.level].details;console.assert(a,"Level details are defined when init segment is loaded");var s=t.stats;e.state=C.IDLE,e.fragLoadError=0,t.data=new Uint8Array(n.payload),s.parsing.start=s.buffering.start=self.performance.now(),s.parsing.end=s.buffering.end=self.performance.now(),n.frag===r&&i.trigger(l.Events.FRAG_BUFFERED,{stats:s,frag:r,part:null,id:t.type}),e.tick()})).catch((function(n){e.warn(n),e.resetFragmentLoading(t)}))},w.fragContextChanged=function(t){var e=this.fragCurrent;return!t||!e||t.level!==e.level||t.sn!==e.sn||t.urlId!==e.urlId},w.fragBufferedComplete=function(t,e){var n=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+t.type+" sn: "+t.sn+(e?" part: "+e.index:"")+" of "+("[stream-controller]"===this.logPrefix?"level":"track")+" "+t.level+" "+v.default.toString(a.BufferHelper.getBuffered(n))),this.state=C.IDLE,this.tick()},w._handleFragmentLoadComplete=function(t){var e=this.transmuxer;if(e){var n=t.frag,r=t.part,i=t.partsLoaded,o=!i||0===i.length||i.some((function(t){return!t})),a=new u.ChunkMetadata(n.level,n.sn,n.stats.chunkCount+1,0,r?r.index:-1,!o);e.flush(a)}},w._handleFragmentLoadProgress=function(t){},w._doFragLoad=function(t,e,n,i){var o=this;if(void 0===n&&(n=null),!this.levels)throw new Error("frag load aborted, missing levels");if(n=Math.max(t.start,n||0),this.config.lowLatencyMode&&e){var a=e.partList;if(a&&i){n>t.end&&e.fragmentHint&&(t=e.fragmentHint);var s=this.getNextPart(a,t,n);if(s>-1){var c=a[s];return this.log("Loading part sn: "+t.sn+" p: "+c.index+" cc: "+t.cc+" of playlist ["+e.startSN+"-"+e.endSN+"] parts [0-"+s+"-"+(a.length-1)+"] "+("[stream-controller]"===this.logPrefix?"level":"track")+": "+t.level+", target: "+parseFloat(n.toFixed(3))),this.nextLoadPosition=c.start+c.duration,this.state=C.FRAG_LOADING,this.hls.trigger(l.Events.FRAG_LOADING,{frag:t,part:a[s],targetBufferTime:n}),this.doFragPartsLoad(t,a,s,i).catch((function(t){return o.handleFragLoadError(t)}))}if(!t.url||this.loadedEndOfParts(a,n))return Promise.resolve(null)}}return this.log("Loading fragment "+t.sn+" cc: "+t.cc+" "+(e?"of ["+e.startSN+"-"+e.endSN+"] ":"")+("[stream-controller]"===this.logPrefix?"level":"track")+": "+t.level+", target: "+parseFloat(n.toFixed(3))),Object(r.isFiniteNumber)(t.sn)&&!this.bitrateTest&&(this.nextLoadPosition=t.start+t.duration),this.state=C.FRAG_LOADING,this.hls.trigger(l.Events.FRAG_LOADING,{frag:t,targetBufferTime:n}),this.fragmentLoader.load(t,i).catch((function(t){return o.handleFragLoadError(t)}))},w.doFragPartsLoad=function(t,e,n,r){var i=this;return new Promise((function(o,a){var s=[];!function n(c){var u=e[c];i.fragmentLoader.loadPart(t,u,r).then((function(r){s[u.index]=r;var a=r.part;i.hls.trigger(l.Events.FRAG_LOADED,r);var h=e[c+1];if(!h||h.fragment!==t)return o({frag:t,part:a,partsLoaded:s});n(c+1)})).catch(a)}(n)}))},w.handleFragLoadError=function(t){var e=t.data;return e&&e.details===c.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(e.frag,e.part):this.hls.trigger(l.Events.ERROR,e),null},w._handleTransmuxerFlush=function(t){var e=this.getCurrentContext(t);if(e&&this.state===C.PARSING){var n=e.frag,r=e.part,i=e.level,o=self.performance.now();n.stats.parsing.end=o,r&&(r.stats.parsing.end=o),this.updateLevelTiming(n,r,i,t.partial)}else this.fragCurrent||(this.state=C.IDLE)},w.getCurrentContext=function(t){var e=this.levels,n=t.level,r=t.sn,i=t.part;if(!e||!e[n])return this.warn("Levels object was unset while buffering fragment "+r+" of level "+n+". The current chunk will not be buffered."),null;var o=e[n],a=i>-1?Object(p.getPartWith)(o,r,i):null,s=a?a.fragment:Object(p.getFragmentWithSN)(o,r,this.fragCurrent);return s?{frag:s,part:a,level:o}:null},w.bufferFragmentData=function(t,e,n,r){if(t&&this.state===C.PARSING){var i=t.data1,o=t.data2,a=i;if(i&&o&&(a=Object(h.appendUint8Array)(i,o)),a&&a.length){var s={type:t.type,frag:e,part:n,chunkMeta:r,parent:e.type,data:a};this.hls.trigger(l.Events.BUFFER_APPENDING,s),t.dropped&&t.independent&&!n&&this.flushBufferGap(e)}}},w.flushBufferGap=function(t){var e=this.media;if(e)if(a.BufferHelper.isBuffered(e,e.currentTime)){var n=e.currentTime,r=a.BufferHelper.bufferInfo(e,n,0),i=t.duration,o=Math.min(2*this.config.maxFragLookUpTolerance,.25*i),s=Math.max(Math.min(t.start-o,r.end-o),n+o);t.start-s>o&&this.flushMainBuffer(s,t.start)}else this.flushMainBuffer(0,t.start)},w.getFwdBufferInfo=function(t,e){var n=this.config,i=this.getLoadPosition();if(!Object(r.isFiniteNumber)(i))return null;var o=a.BufferHelper.bufferInfo(t,i,n.maxBufferHole);if(0===o.len&&void 0!==o.nextStart){var s=this.fragmentTracker.getBufferedFrag(i,e);if(s&&o.nextStart<s.end)return a.BufferHelper.bufferInfo(t,i,Math.max(o.nextStart,n.maxBufferHole))}return o},w.getMaxBufferLength=function(t){var e,n=this.config;return e=t?Math.max(8*n.maxBufferSize/t,n.maxBufferLength):n.maxBufferLength,Math.min(e,n.maxMaxBufferLength)},w.reduceMaxBufferLength=function(t){var e=this.config,n=t||e.maxBufferLength;return e.maxMaxBufferLength>=n&&(e.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+e.maxMaxBufferLength+"s"),!0)},w.getNextFragment=function(t,e){var n,r,i=e.fragments,o=i.length;if(!o)return null;var a,s=this.config,l=i[0].start;if(e.live){var c=s.initialLiveManifestSize;if(o<c)return this.warn("Not enough fragments to start playback (have: "+o+", need: "+c+")"),null;e.PTSKnown||this.startFragRequested||-1!==this.startPosition||(a=this.getInitialLiveFragment(e,i),this.startPosition=a?this.hls.liveSyncPosition||a.start:t)}else t<=l&&(a=i[0]);if(!a){var u=s.lowLatencyMode?e.partEnd:e.fragmentEnd;a=this.getFragmentAtPosition(t,u,e)}return null===(n=a)||void 0===n||!n.initSegment||null!==(r=a)&&void 0!==r&&r.initSegment.data||this.bitrateTest||(a=a.initSegment),a},w.getNextPart=function(t,e,n){for(var r=-1,i=!1,o=!0,a=0,s=t.length;a<s;a++){var l=t[a];if(o=o&&!l.independent,r>-1&&n<l.start)break;var c=l.loaded;!c&&(i||l.independent||o)&&l.fragment===e&&(r=a),i=c}return r},w.loadedEndOfParts=function(t,e){var n=t[t.length-1];return n&&e>n.start&&n.loaded},w.getInitialLiveFragment=function(t,e){var n=this.fragPrevious,r=null;if(n){if(t.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+n.programDateTime),r=Object(f.findFragmentByPDT)(e,n.endProgramDateTime,this.config.maxFragLookUpTolerance)),!r){var i=n.sn+1;if(i>=t.startSN&&i<=t.endSN){var o=e[i-t.startSN];n.cc===o.cc&&(r=o,this.log("Live playlist, switching playlist, load frag with next SN: "+r.sn))}r||(r=Object(f.findFragWithCC)(e,n.cc))&&this.log("Live playlist, switching playlist, load frag with same CC: "+r.sn)}}else{var a=this.hls.liveSyncPosition;null!==a&&(r=this.getFragmentAtPosition(a,this.bitrateTest?t.fragmentEnd:t.edge,t))}return r},w.getFragmentAtPosition=function(t,e,n){var r,i=this.config,a=this.fragPrevious,s=n.fragments,l=n.endSN,c=n.fragmentHint,u=i.maxFragLookUpTolerance,h=!!(i.lowLatencyMode&&n.partList&&c);if(h&&c&&!this.bitrateTest&&(s=s.concat(c),l=c.sn),t<e){var d=t>e-u?0:u;r=Object(f.findFragmentByPTS)(a,s,t,d)}else r=s[s.length-1];if(r){var p=r.sn-n.startSN,g=a&&r.level===a.level,m=s[p+1];if(this.fragmentTracker.getState(r)===o.FragmentState.BACKTRACKED){r=null;for(var v=p;s[v]&&this.fragmentTracker.getState(s[v])===o.FragmentState.BACKTRACKED;)r=a?s[v--]:s[--v];r||(r=m)}else a&&r.sn===a.sn&&!h&&g&&(r.sn<l&&this.fragmentTracker.getState(m)!==o.FragmentState.OK?(this.log("SN "+r.sn+" just loaded, load next one: "+m.sn),r=m):r=null)}return r},w.synchronizeToLiveEdge=function(t){var e=this.config,n=this.media;if(n){var r=this.hls.liveSyncPosition,i=n.currentTime,o=t.fragments[0].start,a=t.edge,s=i>=o-e.maxFragLookUpTolerance&&i<=a;if(null!==r&&n.duration>r&&(i<r||!s)){var l=void 0!==e.liveMaxLatencyDuration?e.liveMaxLatencyDuration:e.liveMaxLatencyDurationCount*t.targetduration;(!s&&n.readyState<4||i<a-l)&&(this.loadedmetadata||(this.nextLoadPosition=r),n.readyState&&(this.warn("Playback: "+i.toFixed(3)+" is located too far from the end of live sliding playlist: "+a+", reset currentTime to : "+r.toFixed(3)),n.currentTime=r))}}},w.alignPlaylists=function(t,e){var n=this.levels,i=this.levelLastLoaded,o=this.fragPrevious,a=null!==i?n[i]:null,s=t.fragments.length;if(!s)return this.warn("No fragments in live playlist"),0;var l=t.fragments[0].start,c=!e,u=t.alignedSliding&&Object(r.isFiniteNumber)(l);if(c||!u&&!l){Object(d.alignStream)(o,a,t);var h=t.fragments[0].start;return this.log("Live playlist sliding: "+h.toFixed(2)+" start-sn: "+(e?e.startSN:"na")+"->"+t.startSN+" prev-sn: "+(o?o.sn:"na")+" fragments: "+s),h}return l},w.waitForCdnTuneIn=function(t){return t.live&&t.canBlockReload&&t.tuneInGoal>Math.max(t.partHoldBack,3*t.partTarget)},w.setStartPosition=function(t,e){var n=this.startPosition;if(n<e&&(n=-1),-1===n||-1===this.lastCurrentTime){var i=t.startTimeOffset;Object(r.isFiniteNumber)(i)?(n=e+i,i<0&&(n+=t.totalduration),n=Math.min(Math.max(e,n),e+t.totalduration),this.log("Start time offset "+i+" found in playlist, adjust startPosition to "+n),this.startPosition=n):t.live?n=this.hls.liveSyncPosition||e:this.startPosition=n=0,this.lastCurrentTime=n}this.nextLoadPosition=n},w.getLoadPosition=function(){var t=this.media,e=0;return this.loadedmetadata&&t?e=t.currentTime:this.nextLoadPosition&&(e=this.nextLoadPosition),e},w.handleFragLoadAborted=function(t,e){this.transmuxer&&"initSegment"!==t.sn&&t.stats.aborted&&(this.warn("Fragment "+t.sn+(e?" part"+e.index:"")+" of level "+t.level+" was aborted"),this.resetFragmentLoading(t))},w.resetFragmentLoading=function(t){this.fragCurrent&&this.fragContextChanged(t)||(this.state=C.IDLE)},w.onFragmentOrKeyLoadError=function(t,e){if(!e.fatal){var n=e.frag;if(n&&n.type===t){var r=this.fragCurrent;console.assert(r&&n.sn===r.sn&&n.level===r.level&&n.urlId===r.urlId,"Frag load error must match current frag to retry");var i=this.config;if(this.fragLoadError+1<=i.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(n.level))return;var o=Math.min(Math.pow(2,this.fragLoadError)*i.fragLoadingRetryDelay,i.fragLoadingMaxRetryTimeout);this.warn("Fragment "+n.sn+" of "+t+" "+n.level+" failed to load, retrying in "+o+"ms"),this.retryDate=self.performance.now()+o,this.fragLoadError++,this.state=C.FRAG_LOADING_WAITING_RETRY}else e.levelRetry?(t===y.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=C.IDLE):(s.logger.error(e.details+" reaches max retry, redispatch as fatal ..."),e.fatal=!0,this.hls.stopLoad(),this.state=C.ERROR)}}},w.afterBufferFlushed=function(t,e,n){if(t){var r=a.BufferHelper.getBuffered(t);this.fragmentTracker.detectEvictedFragments(e,r,n),this.state===C.ENDED&&this.resetLoadingState()}},w.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=C.IDLE},w.resetLiveStartWhenNotLoaded=function(t){if(!this.loadedmetadata){this.startFragRequested=!1;var e=this.levels?this.levels[t].details:null;if(null!=e&&e.live)return this.startPosition=-1,this.setStartPosition(e,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},w.updateLevelTiming=function(t,e,n,r){var i=this,o=n.details;console.assert(!!o,"level.details must be defined"),Object.keys(t.elementaryStreams).reduce((function(e,a){var s=t.elementaryStreams[a];if(s){var c=s.endPTS-s.startPTS;if(c<=0)return i.warn("Could not parse fragment "+t.sn+" "+a+" duration reliably ("+c+") resetting transmuxer to fallback to playlist timing"),i.resetTransmuxer(),e||!1;var u=r?0:Object(p.updateFragPTSDTS)(o,t,s.startPTS,s.endPTS,s.startDTS,s.endDTS);return i.hls.trigger(l.Events.LEVEL_PTS_UPDATED,{details:o,level:n,drift:u,type:a,frag:t,start:s.startPTS,end:s.endPTS}),!0}return e}),!1)?(this.state=C.PARSED,this.hls.trigger(l.Events.FRAG_PARSED,{frag:t,part:e})):this.resetLoadingState()},w.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},S=i,(E=[{key:"state",get:function(){return this._state},set:function(t){var e=this._state;e!==t&&(this._state=t,this.log(e+"->"+t))}}])&&b(S.prototype,E),k&&b(S,k),i}(i.default)},"./src/controller/buffer-controller.ts":
/*!*********************************************!*\
!*** ./src/controller/buffer-controller.ts ***!
\*********************************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return f}));var r=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=n(/*! ../events */"./src/events.ts"),o=n(/*! ../utils/logger */"./src/utils/logger.ts"),a=n(/*! ../errors */"./src/errors.ts"),s=n(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),l=n(/*! ../utils/mediasource-helper */"./src/utils/mediasource-helper.ts"),c=n(/*! ../loader/fragment */"./src/loader/fragment.ts"),u=n(/*! ./buffer-operation-queue */"./src/controller/buffer-operation-queue.ts"),h=Object(l.getMediaSource)(),d=/([ha]vc.)(?:\.[^.,]+)+/,f=function(){function t(t){var e=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 t=e.hls,n=e.media,r=e.mediaSource;o.logger.log("[buffer-controller]: Media source opened"),n&&(e.updateMediaElementDuration(),t.trigger(i.Events.MEDIA_ATTACHED,{media:n})),r&&r.removeEventListener("sourceopen",e._onMediaSourceOpen),e.checkPendingTracks()},this._onMediaSourceClose=function(){o.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){o.logger.log("[buffer-controller]: Media source ended")},this.hls=t,this._initSourceBuffer(),this.registerListeners()}var e=t.prototype;return e.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},e.destroy=function(){this.unregisterListeners(),this.details=null},e.registerListeners=function(){var t=this.hls;t.on(i.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(i.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.on(i.Events.BUFFER_RESET,this.onBufferReset,this),t.on(i.Events.BUFFER_APPENDING,this.onBufferAppending,this),t.on(i.Events.BUFFER_CODECS,this.onBufferCodecs,this),t.on(i.Events.BUFFER_EOS,this.onBufferEos,this),t.on(i.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(i.Events.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(i.Events.FRAG_PARSED,this.onFragParsed,this),t.on(i.Events.FRAG_CHANGED,this.onFragChanged,this)},e.unregisterListeners=function(){var t=this.hls;t.off(i.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(i.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.off(i.Events.BUFFER_RESET,this.onBufferReset,this),t.off(i.Events.BUFFER_APPENDING,this.onBufferAppending,this),t.off(i.Events.BUFFER_CODECS,this.onBufferCodecs,this),t.off(i.Events.BUFFER_EOS,this.onBufferEos,this),t.off(i.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(i.Events.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(i.Events.FRAG_PARSED,this.onFragParsed,this),t.off(i.Events.FRAG_CHANGED,this.onFragChanged,this)},e._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new u.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},e.onManifestParsed=function(t,e){var n=2;(e.audio&&!e.video||!e.altAudio)&&(n=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=n,this.details=null,o.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},e.onMediaAttaching=function(t,e){var n=this.media=e.media;if(n&&h){var r=this.mediaSource=new h;r.addEventListener("sourceopen",this._onMediaSourceOpen),r.addEventListener("sourceended",this._onMediaSourceEnded),r.addEventListener("sourceclose",this._onMediaSourceClose),n.src=self.URL.createObjectURL(r),this._objectUrl=n.src}},e.onMediaDetaching=function(){var t=this.media,e=this.mediaSource,n=this._objectUrl;if(e){if(o.logger.log("[buffer-controller]: media source detaching"),"open"===e.readyState)try{e.endOfStream()}catch(t){o.logger.warn("[buffer-controller]: onMediaDetaching: "+t.message+" while calling endOfStream")}this.onBufferReset(),e.removeEventListener("sourceopen",this._onMediaSourceOpen),e.removeEventListener("sourceended",this._onMediaSourceEnded),e.removeEventListener("sourceclose",this._onMediaSourceClose),t&&(n&&self.URL.revokeObjectURL(n),t.src===n?(t.removeAttribute("src"),t.load()):o.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)},e.onBufferReset=function(){var t=this;this.getSourceBufferTypes().forEach((function(e){var n=t.sourceBuffer[e];try{n&&(t.removeBufferListeners(e),t.mediaSource&&t.mediaSource.removeSourceBuffer(n),t.sourceBuffer[e]=void 0)}catch(t){o.logger.warn("[buffer-controller]: Failed to reset the "+e+" buffer",t)}})),this._initSourceBuffer()},e.onBufferCodecs=function(t,e){var n=this,r=this.getSourceBufferTypes().length;Object.keys(e).forEach((function(t){if(r){var i=n.tracks[t];if(i&&"function"==typeof i.buffer.changeType){var o=e[t],a=o.codec,s=o.levelCodec,l=o.container;if((i.levelCodec||i.codec).replace(d,"$1")!==(s||a).replace(d,"$1")){var c=l+";codecs="+(s||a);n.appendChangeType(t,c)}}}else n.pendingTracks[t]=e[t]})),r||(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks())},e.appendChangeType=function(t,e){var n=this,r=this.operationQueue,i={execute:function(){var i=n.sourceBuffer[t];i&&(o.logger.log("[buffer-controller]: changing "+t+" sourceBuffer type to "+e),i.changeType(e)),r.shiftAndExecuteNext(t)},onStart:function(){},onComplete:function(){},onError:function(e){o.logger.warn("[buffer-controller]: Failed to change "+t+" SourceBuffer type",e)}};r.append(i,t)},e.onBufferAppending=function(t,e){var n=this,r=this.hls,l=this.operationQueue,c=this.tracks,u=e.data,h=e.type,d=e.frag,f=e.part,p=e.chunkMeta,g=p.buffering[h],m=self.performance.now();g.start=m;var v=d.stats.buffering,y=f?f.stats.buffering:null;0===v.start&&(v.start=m),y&&0===y.start&&(y.start=m);var b=c.audio,x="audio"===h&&1===p.id&&"audio/mpeg"===(null==b?void 0:b.container),C={execute:function(){if(g.executeStart=self.performance.now(),x){var t=n.sourceBuffer[h];if(t){var e=d.start-t.timestampOffset;Math.abs(e)>=.1&&(o.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+d.start+" (delta: "+e+") sn: "+d.sn+")"),t.timestampOffset=d.start)}}n.appendExecutor(u,h)},onStart:function(){},onComplete:function(){var t=self.performance.now();g.executeEnd=g.end=t,0===v.first&&(v.first=t),y&&0===y.first&&(y.first=t);var e=n.sourceBuffer,r={};for(var o in e)r[o]=s.BufferHelper.getBuffered(e[o]);n.appendError=0,n.hls.trigger(i.Events.BUFFER_APPENDED,{type:h,frag:d,part:f,chunkMeta:p,parent:d.type,timeRanges:r})},onError:function(t){o.logger.error("[buffer-controller]: Error encountered while trying to append to the "+h+" SourceBuffer",t);var e={type:a.ErrorTypes.MEDIA_ERROR,parent:d.type,details:a.ErrorDetails.BUFFER_APPEND_ERROR,err:t,fatal:!1};t.code===DOMException.QUOTA_EXCEEDED_ERR?e.details=a.ErrorDetails.BUFFER_FULL_ERROR:(n.appendError++,e.details=a.ErrorDetails.BUFFER_APPEND_ERROR,n.appendError>r.config.appendErrorMaxRetry&&(o.logger.error("[buffer-controller]: Failed "+r.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),e.fatal=!0)),r.trigger(i.Events.ERROR,e)}};l.append(C,h)},e.onBufferFlushing=function(t,e){var n=this,r=this.operationQueue,a=function(t){return{execute:n.removeExecutor.bind(n,t,e.startOffset,e.endOffset),onStart:function(){},onComplete:function(){n.hls.trigger(i.Events.BUFFER_FLUSHED,{type:t})},onError:function(e){o.logger.warn("[buffer-controller]: Failed to remove from "+t+" SourceBuffer",e)}}};e.type?r.append(a(e.type),e.type):this.getSourceBufferTypes().forEach((function(t){r.append(a(t),t)}))},e.onFragParsed=function(t,e){var n=this,r=e.frag,a=e.part,s=[],l=a?a.elementaryStreams:r.elementaryStreams;l[c.ElementaryStreamTypes.AUDIOVIDEO]?s.push("audiovideo"):(l[c.ElementaryStreamTypes.AUDIO]&&s.push("audio"),l[c.ElementaryStreamTypes.VIDEO]&&s.push("video")),0===s.length&&o.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+r.type+" level: "+r.level+" sn: "+r.sn),this.blockBuffers((function(){var t=self.performance.now();r.stats.buffering.end=t,a&&(a.stats.buffering.end=t);var e=a?a.stats:r.stats;n.hls.trigger(i.Events.FRAG_BUFFERED,{frag:r,part:a,stats:e,id:r.type})}),s)},e.onFragChanged=function(t,e){this.flushBackBuffer()},e.onBufferEos=function(t,e){var n=this;this.getSourceBufferTypes().reduce((function(t,r){var i=n.sourceBuffer[r];return e.type&&e.type!==r||i&&!i.ended&&(i.ended=!0,o.logger.log("[buffer-controller]: "+r+" sourceBuffer now EOS")),t&&!(i&&!i.ended)}),!0)&&this.blockBuffers((function(){var t=n.mediaSource;t&&"open"===t.readyState&&t.endOfStream()}))},e.onLevelUpdated=function(t,e){var n=e.details;n.fragments.length&&(this.details=n,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())},e.flushBackBuffer=function(){var t=this.hls,e=this.details,n=this.media,o=this.sourceBuffer;if(n&&null!==e){var a=this.getSourceBufferTypes();if(a.length){var l=e.live&&null!==t.config.liveBackBufferLength?t.config.liveBackBufferLength:t.config.backBufferLength;if(Object(r.isFiniteNumber)(l)&&!(l<0)){var c=n.currentTime,u=e.levelTargetDuration,h=Math.max(l,u),d=Math.floor(c/u)*u-h;a.forEach((function(n){var r=o[n];if(r){var a=s.BufferHelper.getBuffered(r);a.length>0&&d>a.start(0)&&(t.trigger(i.Events.BACK_BUFFER_REACHED,{bufferEnd:d}),e.live&&t.trigger(i.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:d}),t.trigger(i.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:d,type:n}))}}))}}}},e.updateMediaElementDuration=function(){if(this.details&&this.media&&this.mediaSource&&"open"===this.mediaSource.readyState){var t=this.details,e=this.hls,n=this.media,i=this.mediaSource,a=t.fragments[0].start+t.totalduration,s=n.duration,l=Object(r.isFiniteNumber)(i.duration)?i.duration:0;t.live&&e.config.liveDurationInfinity?(o.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),i.duration=1/0,this.updateSeekableRange(t)):(a>l&&a>s||!Object(r.isFiniteNumber)(s))&&(o.logger.log("[buffer-controller]: Updating Media Source duration to "+a.toFixed(3)),i.duration=a)}},e.updateSeekableRange=function(t){var e=this.mediaSource,n=t.fragments;if(n.length&&t.live&&null!=e&&e.setLiveSeekableRange){var r=Math.max(0,n[0].start),i=Math.max(r,r+t.totalduration);e.setLiveSeekableRange(r,i)}},e.checkPendingTracks=function(){var t=this.bufferCodecEventsExpected,e=this.operationQueue,n=this.pendingTracks,r=Object.keys(n).length;if(r&&!t||2===r){this.createSourceBuffers(n),this.pendingTracks={};var o=this.getSourceBufferTypes();if(0===o.length)return void this.hls.trigger(i.Events.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});o.forEach((function(t){e.executeNext(t)}))}},e.createSourceBuffers=function(t){var e=this.sourceBuffer,n=this.mediaSource;if(!n)throw Error("createSourceBuffers called when mediaSource was null");var r=0;for(var s in t)if(!e[s]){var l=t[s];if(!l)throw Error("source buffer exists for track "+s+", however track does not");var c=l.levelCodec||l.codec,u=l.container+";codecs="+c;o.logger.log("[buffer-controller]: creating sourceBuffer("+u+")");try{var h=e[s]=n.addSourceBuffer(u),d=s;this.addBufferListener(d,"updatestart",this._onSBUpdateStart),this.addBufferListener(d,"updateend",this._onSBUpdateEnd),this.addBufferListener(d,"error",this._onSBUpdateError),this.tracks[s]={buffer:h,codec:c,container:l.container,levelCodec:l.levelCodec,id:l.id},r++}catch(t){o.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+t.message),this.hls.trigger(i.Events.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:t,mimeType:u})}}r&&this.hls.trigger(i.Events.BUFFER_CREATED,{tracks:this.tracks})},e._onSBUpdateStart=function(t){this.operationQueue.current(t).onStart()},e._onSBUpdateEnd=function(t){var e=this.operationQueue;e.current(t).onComplete(),e.shiftAndExecuteNext(t)},e._onSBUpdateError=function(t,e){o.logger.error("[buffer-controller]: "+t+" SourceBuffer error",e),this.hls.trigger(i.Events.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var n=this.operationQueue.current(t);n&&n.onError(e)},e.removeExecutor=function(t,e,n){var i=this.media,a=this.mediaSource,s=this.operationQueue,l=this.sourceBuffer[t];if(!i||!a||!l)return o.logger.warn("[buffer-controller]: Attempting to remove from the "+t+" SourceBuffer, but it does not exist"),void s.shiftAndExecuteNext(t);var c=Object(r.isFiniteNumber)(i.duration)?i.duration:1/0,u=Object(r.isFiniteNumber)(a.duration)?a.duration:1/0,h=Math.max(0,e),d=Math.min(n,c,u);d>h?(o.logger.log("[buffer-controller]: Removing ["+h+","+d+"] from the "+t+" SourceBuffer"),console.assert(!l.updating,t+" sourceBuffer must not be updating"),l.remove(h,d)):s.shiftAndExecuteNext(t)},e.appendExecutor=function(t,e){var n=this.operationQueue,r=this.sourceBuffer[e];if(!r)return o.logger.warn("[buffer-controller]: Attempting to append to the "+e+" SourceBuffer, but it does not exist"),void n.shiftAndExecuteNext(e);r.ended=!1,console.assert(!r.updating,e+" sourceBuffer must not be updating"),r.appendBuffer(t)},e.blockBuffers=function(t,e){var n=this;if(void 0===e&&(e=this.getSourceBufferTypes()),!e.length)return o.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve(t);var r=this.operationQueue,i=e.map((function(t){return r.appendBlocker(t)}));Promise.all(i).then((function(){t(),e.forEach((function(t){var e=n.sourceBuffer[t];e&&e.updating||r.shiftAndExecuteNext(t)}))}))},e.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},e.addBufferListener=function(t,e,n){var r=this.sourceBuffer[t];if(r){var i=n.bind(this,t);this.listeners[t].push({event:e,listener:i}),r.addEventListener(e,i)}},e.removeBufferListeners=function(t){var e=this.sourceBuffer[t];e&&this.listeners[t].forEach((function(t){e.removeEventListener(t.event,t.listener)}))},t}()},"./src/controller/buffer-operation-queue.ts":
/*!**************************************************!*\
!*** ./src/controller/buffer-operation-queue.ts ***!
\**************************************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return i}));var r=n(/*! ../utils/logger */"./src/utils/logger.ts"),i=function(){function t(t){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=t}var e=t.prototype;return e.append=function(t,e){var n=this.queues[e];n.push(t),1===n.length&&this.buffers[e]&&this.executeNext(e)},e.insertAbort=function(t,e){this.queues[e].unshift(t),this.executeNext(e)},e.appendBlocker=function(t){var e,n=new Promise((function(t){e=t})),r={execute:e,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(r,t),n},e.executeNext=function(t){var e=this.buffers,n=this.queues,i=e[t],o=n[t];if(o.length){var a=o[0];try{a.execute()}catch(e){r.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),a.onError(e),i&&i.updating||(o.shift(),this.executeNext(t))}}},e.shiftAndExecuteNext=function(t){this.queues[t].shift(),this.executeNext(t)},e.current=function(t){return this.queues[t][0]},t}()},"./src/controller/cap-level-controller.ts":
/*!************************************************!*\
!*** ./src/controller/cap-level-controller.ts ***!
\************************************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e);var r=n(/*! ../events */"./src/events.ts");function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=function(){function t(t){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=t,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var e,n,o,a=t.prototype;return a.setStreamController=function(t){this.streamController=t},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 t=this.hls;t.on(r.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.on(r.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.on(r.Events.BUFFER_CODECS,this.onBufferCodecs,this),t.on(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},a.unregisterListener=function(){var t=this.hls;t.off(r.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.off(r.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.off(r.Events.BUFFER_CODECS,this.onBufferCodecs,this),t.off(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},a.onFpsDropLevelCapping=function(e,n){t.isLevelAllowed(n.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(n.droppedLevel)},a.onMediaAttaching=function(t,e){this.media=e.media instanceof HTMLVideoElement?e.media:null},a.onManifestParsed=function(t,e){var n=this.hls;this.restrictedLevels=[],this.firstLevel=e.firstLevel,n.config.capLevelToPlayerSize&&e.video&&this.startCapping()},a.onBufferCodecs=function(t,e){this.hls.config.capLevelToPlayerSize&&e.video&&this.startCapping()},a.onMediaDetaching=function(){this.stopCapping()},a.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var t=this.hls.levels;if(t.length){var e=this.hls;e.autoLevelCapping=this.getMaxLevel(t.length-1),e.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=e.autoLevelCapping}}},a.getMaxLevel=function(e){var n=this,r=this.hls.levels;if(!r.length)return-1;var i=r.filter((function(r,i){return t.isLevelAllowed(i,n.restrictedLevels)&&i<=e}));return this.clientRect=null,t.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)},a.startCapping=function(){this.timer||(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 t=this.media,e={width:0,height:0};if(t){var n=t.getBoundingClientRect();e.width=n.width,e.height=n.height,e.width||e.height||(e.width=n.right-n.left||t.width||0,e.height=n.bottom-n.top||t.height||0)}return this.clientRect=e,e},t.isLevelAllowed=function(t,e){return void 0===e&&(e=[]),-1===e.indexOf(t)},t.getMaxLevelByMediaSize=function(t,e,n){if(!t||!t.length)return-1;for(var r,i,o=t.length-1,a=0;a<t.length;a+=1){var s=t[a];if((s.width>=e||s.height>=n)&&(r=s,!(i=t[a+1])||r.width!==i.width||r.height!==i.height)){o=a;break}}return o},e=t,o=[{key:"contentScaleFactor",get:function(){var t=1;try{t=self.devicePixelRatio}catch(t){}return t}}],(n=[{key:"mediaWidth",get:function(){return this.getDimensions().width*t.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*t.contentScaleFactor}}])&&i(e.prototype,n),o&&i(e,o),t}();e.default=o},"./src/controller/cmcd-controller.ts":
/*!*******************************************!*\
!*** ./src/controller/cmcd-controller.ts ***!
\*******************************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return d}));var r=n(/*! ../events */"./src/events.ts"),i=n(/*! ../types/cmcd */"./src/types/cmcd.ts"),o=n(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),a=n(/*! ../utils/logger */"./src/utils/logger.ts");function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function l(t,e,n){return e&&s(t.prototype,e),n&&s(t,n),t}function c(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return u(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function h(){return(h=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}var d=function(){function t(e){var n=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(){n.initialized&&(n.starved=!0),n.buffering=!0},this.onPlaying=function(){n.initialized||(n.initialized=!0),n.buffering=!1},this.applyPlaylistData=function(t){try{n.apply(t,{ot:i.CMCDObjectType.MANIFEST,su:!n.initialized})}catch(t){a.logger.warn("Could not generate manifest CMCD data.",t)}},this.applyFragmentData=function(t){try{var e=t.frag,r=n.hls.levels[e.level],o=n.getObjectType(e),s={d:1e3*e.duration,ot:o};o!==i.CMCDObjectType.VIDEO&&o!==i.CMCDObjectType.AUDIO&&o!=i.CMCDObjectType.MUXED||(s.br=r.bitrate/1e3,s.tb=n.getTopBandwidth(o),s.bl=n.getBufferLength(o)),n.apply(t,s)}catch(t){a.logger.warn("Could not generate segment CMCD data.",t)}},this.hls=e;var r=this.config=e.config,o=r.cmcd;null!=o&&(r.pLoader=this.createPlaylistLoader(),r.fLoader=this.createFragmentLoader(),this.sid=o.sessionId||t.uuid(),this.cid=o.contentId,this.useHeaders=!0===o.useHeaders,this.registerListeners())}var e=t.prototype;return e.registerListeners=function(){var t=this.hls;t.on(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(r.Events.MEDIA_DETACHED,this.onMediaDetached,this),t.on(r.Events.BUFFER_CREATED,this.onBufferCreated,this)},e.unregisterListeners=function(){var t=this.hls;t.off(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(r.Events.MEDIA_DETACHED,this.onMediaDetached,this),t.off(r.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},e.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},e.onMediaAttached=function(t,e){this.media=e.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},e.onMediaDetached=function(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)},e.onBufferCreated=function(t,e){var n,r;this.audioBuffer=null===(n=e.tracks.audio)||void 0===n?void 0:n.buffer,this.videoBuffer=null===(r=e.tracks.video)||void 0===r?void 0:r.buffer},e.createData=function(){var t;return{v:i.CMCDVersion,sf:i.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:null===(t=this.media)||void 0===t?void 0:t.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},e.apply=function(e,n){void 0===n&&(n={}),h(n,this.createData());var r=n.ot===i.CMCDObjectType.INIT||n.ot===i.CMCDObjectType.VIDEO||n.ot===i.CMCDObjectType.MUXED;if(this.starved&&r&&(n.bs=!0,n.su=!0,this.starved=!1),null==n.su&&(n.su=this.buffering),this.useHeaders){var o=t.toHeaders(n);if(!Object.keys(o).length)return;e.headers||(e.headers={}),h(e.headers,o)}else{var a=t.toQuery(n);if(!a)return;e.url=t.appendQueryToUri(e.url,a)}},e.getObjectType=function(t){var e=t.type;return"subtitle"===e?i.CMCDObjectType.TIMED_TEXT:"initSegment"===t.sn?i.CMCDObjectType.INIT:"audio"===e?i.CMCDObjectType.AUDIO:"main"===e?this.hls.audioTracks.length?i.CMCDObjectType.VIDEO:i.CMCDObjectType.MUXED:void 0},e.getTopBandwidth=function(t){for(var e,n=0,r=c(t===i.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels);!(e=r()).done;){var o=e.value;o.bitrate>n&&(n=o.bitrate)}return n>0?n:NaN},e.getBufferLength=function(t){var e=this.hls.media,n=t===i.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;return n&&e?1e3*o.BufferHelper.bufferInfo(n,e.currentTime,this.config.maxBufferHole).len:NaN},e.createPlaylistLoader=function(){var t=this.config.pLoader,e=this.applyPlaylistData,n=t||this.config.loader;return function(){function t(t){this.loader=void 0,this.loader=new n(t)}var r=t.prototype;return r.destroy=function(){this.loader.destroy()},r.abort=function(){this.loader.abort()},r.load=function(t,n,r){e(t),this.loader.load(t,n,r)},l(t,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),t}()},e.createFragmentLoader=function(){var t=this.config.fLoader,e=this.applyFragmentData,n=t||this.config.loader;return function(){function t(t){this.loader=void 0,this.loader=new n(t)}var r=t.prototype;return r.destroy=function(){this.loader.destroy()},r.abort=function(){this.loader.abort()},r.load=function(t,n,r){e(t),this.loader.load(t,n,r)},l(t,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),t}()},t.uuid=function(){var t=URL.createObjectURL(new Blob),e=t.toString();return URL.revokeObjectURL(t),e.substr(e.lastIndexOf("/")+1)},t.serialize=function(t){for(var e,n=[],r=function(t){return!Number.isNaN(t)&&null!=t&&""!==t&&!1!==t},i=function(t){return Math.round(t)},o=function(t){return 100*i(t/100)},a={br:i,d:i,bl:o,dl:o,mtp:o,nor:function(t){return encodeURIComponent(t)},rtp:o,tb:i},s=c(Object.keys(t||{}).sort());!(e=s()).done;){var l=e.value,u=t[l];if(r(u)&&!("v"===l&&1===u||"pr"==l&&1===u)){var h=a[l];h&&(u=h(u));var d=typeof u,f=void 0;f="ot"===l||"sf"===l||"st"===l?l+"="+u:"boolean"===d?l:"number"===d?l+"="+u:l+"="+JSON.stringify(u),n.push(f)}}return n.join(",")},t.toHeaders=function(e){for(var n={},r=["Object","Request","Session","Status"],i=[{},{},{},{}],o={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},a=0,s=Object.keys(e);a<s.length;a++){var l=s[a];i[null!=o[l]?o[l]:1][l]=e[l]}for(var c=0;c<i.length;c++){var u=t.serialize(i[c]);u&&(n["CMCD-"+r[c]]=u)}return n},t.toQuery=function(e){return"CMCD="+encodeURIComponent(t.serialize(e))},t.appendQueryToUri=function(t,e){if(!e)return t;var n=t.includes("?")?"&":"?";return""+t+n+e},t}()},"./src/controller/eme-controller.ts":
/*!******************************************!*\
!*** ./src/controller/eme-controller.ts ***!
\******************************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e);var r=n(/*! ../events */"./src/events.ts"),i=n(/*! ../errors */"./src/errors.ts"),o=n(/*! ../utils/logger */"./src/utils/logger.ts"),a=n(/*! ../utils/mediakeys-helper */"./src/utils/mediakeys-helper.ts");function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var l=function(){function t(t){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=t,this._config=t.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,n,l,c=t.prototype;return c.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},c._registerListeners=function(){this.hls.on(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(r.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(r.Events.MANIFEST_PARSED,this.onManifestParsed,this)},c._unregisterListeners=function(){this.hls.off(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(r.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(r.Events.MANIFEST_PARSED,this.onManifestParsed,this)},c.getLicenseServerUrl=function(t){switch(t){case a.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+t+'"')},c._attemptKeySystemAccess=function(t,e,n){var r=this,i=function(t,e,n,r){switch(t){case a.KeySystems.WIDEVINE:return function(t,e,n){var r={audioCapabilities:[],videoCapabilities:[]};return t.forEach((function(t){r.audioCapabilities.push({contentType:'audio/mp4; codecs="'+t+'"',robustness:n.audioRobustness||""})})),e.forEach((function(t){r.videoCapabilities.push({contentType:'video/mp4; codecs="'+t+'"',robustness:n.videoRobustness||""})})),[r]}(e,n,r);default:throw new Error("Unknown key-system: "+t)}}(t,e,n,this._drmSystemOptions);o.logger.log("Requesting encrypted media key-system access");var s=this.requestMediaKeySystemAccess(t,i);this.mediaKeysPromise=s.then((function(e){return r._onMediaKeySystemAccessObtained(t,e)})),s.catch((function(e){o.logger.error('Failed to obtain key-system "'+t+'" access:',e)}))},c._onMediaKeySystemAccessObtained=function(t,e){var n=this;o.logger.log('Access for key-system "'+t+'" obtained');var r={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:e,mediaKeySystemDomain:t};this._mediaKeysList.push(r);var i=Promise.resolve().then((function(){return e.createMediaKeys()})).then((function(e){return r.mediaKeys=e,o.logger.log('Media-keys created for key-system "'+t+'"'),n._onMediaKeysCreated(),e}));return i.catch((function(t){o.logger.error("Failed to create media-keys:",t)})),i},c._onMediaKeysCreated=function(){var t=this;this._mediaKeysList.forEach((function(e){e.mediaKeysSession||(e.mediaKeysSession=e.mediaKeys.createSession(),t._onNewMediaKeySession(e.mediaKeysSession))}))},c._onNewMediaKeySession=function(t){var e=this;o.logger.log("New key-system session "+t.sessionId),t.addEventListener("message",(function(n){e._onKeySessionMessage(t,n.message)}),!1)},c._onKeySessionMessage=function(t,e){o.logger.log("Got EME message event, creating license request"),this._requestLicense(e,(function(e){o.logger.log("Received license data (length: "+(e?e.byteLength:e)+"), updating key-session"),t.update(e)}))},c.onMediaEncrypted=function(t){var e=this;if(o.logger.log('Media is encrypted using "'+t.initDataType+'" init data type'),!this.mediaKeysPromise)return o.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),void this.hls.trigger(r.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});var n=function(n){e._media&&(e._attemptSetMediaKeys(n),e._generateRequestWithPreferredKeySession(t.initDataType,t.initData))};this.mediaKeysPromise.then(n).catch(n)},c._attemptSetMediaKeys=function(t){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var e=this._mediaKeysList[0];if(!e||!e.mediaKeys)return o.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),void this.hls.trigger(r.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});o.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(e.mediaKeys),this._hasSetMediaKeys=!0}},c._generateRequestWithPreferredKeySession=function(t,e){var n=this,a=this._mediaKeysList[0];if(!a)return o.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),void this.hls.trigger(r.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});if(a.mediaKeysSessionInitialized)o.logger.warn("Key-Session already initialized but requested again");else{var s=a.mediaKeysSession;if(!s)return o.logger.error("Fatal: Media is encrypted but no key-session existing"),void this.hls.trigger(r.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});if(!e)return o.logger.warn("Fatal: initData required for generating a key session is null"),void this.hls.trigger(r.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});o.logger.log('Generating key-session request for "'+t+'" init data type'),a.mediaKeysSessionInitialized=!0,s.generateRequest(t,e).then((function(){o.logger.debug("Key-session generation succeeded")})).catch((function(t){o.logger.error("Error generating key-session request:",t),n.hls.trigger(r.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})}))}},c._createLicenseXhr=function(t,e,n){var r=new XMLHttpRequest;r.responseType="arraybuffer",r.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,r,t,e,n);var i=this._licenseXhrSetup;if(i)try{i.call(this.hls,r,t),i=void 0}catch(t){o.logger.error(t)}try{r.readyState||r.open("POST",t,!0),i&&i.call(this.hls,r,t)}catch(t){throw new Error("issue setting up KeySystem license XHR "+t)}return r},c._onLicenseRequestReadyStageChange=function(t,e,n,a){switch(t.readyState){case 4:if(200===t.status){this._requestLicenseFailureCount=0,o.logger.log("License request succeeded");var s=t.response,l=this._licenseResponseCallback;if(l)try{s=l.call(this.hls,t,e)}catch(t){o.logger.error(t)}a(s)}else{if(o.logger.error("License Request XHR failed ("+e+"). Status: "+t.status+" ("+t.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>3)return void this.hls.trigger(r.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});var c=3-this._requestLicenseFailureCount+1;o.logger.warn("Retrying license request, "+c+" attempts left"),this._requestLicense(n,a)}}},c._generateLicenseRequestChallenge=function(t,e){switch(t.mediaKeySystemDomain){case a.KeySystems.WIDEVINE:return e}throw new Error("unsupported key-system: "+t.mediaKeySystemDomain)},c._requestLicense=function(t,e){o.logger.log("Requesting content license for key-system");var n=this._mediaKeysList[0];if(!n)return o.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),void this.hls.trigger(r.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});try{var a=this.getLicenseServerUrl(n.mediaKeySystemDomain),s=this._createLicenseXhr(a,t,e);o.logger.log("Sending license request to URL: "+a);var l=this._generateLicenseRequestChallenge(n,t);s.send(l)}catch(t){o.logger.error("Failure requesting DRM license: "+t),this.hls.trigger(r.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},c.onMediaAttached=function(t,e){if(this._emeEnabled){var n=e.media;this._media=n,n.addEventListener("encrypted",this._onMediaEncrypted)}},c.onMediaDetached=function(){var t=this._media,e=this._mediaKeysList;t&&(t.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(e.map((function(t){if(t.mediaKeysSession)return t.mediaKeysSession.close().catch((function(){}))}))).then((function(){return t.setMediaKeys(null)})).catch((function(){})))},c.onManifestParsed=function(t,e){if(this._emeEnabled){var n=e.levels.map((function(t){return t.audioCodec})).filter((function(t){return!!t})),r=e.levels.map((function(t){return t.videoCodec})).filter((function(t){return!!t}));this._attemptKeySystemAccess(a.KeySystems.WIDEVINE,n,r)}},e=t,(n=[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}])&&s(e.prototype,n),l&&s(e,l),t}();e.default=l},"./src/controller/fps-controller.ts":
/*!******************************************!*\
!*** ./src/controller/fps-controller.ts ***!
\******************************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e);var r=n(/*! ../events */"./src/events.ts"),i=n(/*! ../utils/logger */"./src/utils/logger.ts"),o=function(){function t(t){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=t,this.registerListeners()}var e=t.prototype;return e.setStreamController=function(t){this.streamController=t},e.registerListeners=function(){this.hls.on(r.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},e.unregisterListeners=function(){this.hls.off(r.Events.MEDIA_ATTACHING,this.onMediaAttaching)},e.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},e.onMediaAttaching=function(t,e){var n=this.hls.config;if(n.capLevelOnFPSDrop){var r=e.media instanceof self.HTMLVideoElement?e.media:null;this.media=r,r&&"function"==typeof r.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),n.fpsDroppedMonitoringPeriod)}},e.checkFPS=function(t,e,n){var o=performance.now();if(e){if(this.lastTime){var a=o-this.lastTime,s=n-this.lastDroppedFrames,l=e-this.lastDecodedFrames,c=1e3*s/a,u=this.hls;if(u.trigger(r.Events.FPS_DROP,{currentDropped:s,currentDecoded:l,totalDroppedFrames:n}),c>0&&s>u.config.fpsDroppedMonitoringThreshold*l){var h=u.currentLevel;i.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+h),h>0&&(-1===u.autoLevelCapping||u.autoLevelCapping>=h)&&(h-=1,u.trigger(r.Events.FPS_DROP_LEVEL_CAPPING,{level:h,droppedLevel:u.currentLevel}),u.autoLevelCapping=h,this.streamController.nextLevelSwitch())}}this.lastTime=o,this.lastDroppedFrames=n,this.lastDecodedFrames=e}},e.checkFPSInterval=function(){var t=this.media;if(t)if(this.isVideoPlaybackQualityAvailable){var e=t.getVideoPlaybackQuality();this.checkFPS(t,e.totalVideoFrames,e.droppedVideoFrames)}else this.checkFPS(t,t.webkitDecodedFrameCount,t.webkitDroppedFrameCount)},t}();e.default=o},"./src/controller/fragment-finders.ts":
/*!********************************************!*\
!*** ./src/controller/fragment-finders.ts ***!
\********************************************/
/*! exports provided: findFragmentByPDT, findFragmentByPTS, fragmentWithinToleranceTest, pdtWithinToleranceTest, findFragWithCC */function(t,e,n){"use strict";n.r(e),n.d(e,"findFragmentByPDT",(function(){return o})),n.d(e,"findFragmentByPTS",(function(){return a})),n.d(e,"fragmentWithinToleranceTest",(function(){return s})),n.d(e,"pdtWithinToleranceTest",(function(){return l})),n.d(e,"findFragWithCC",(function(){return c}));var r=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=n(/*! ../utils/binary-search */"./src/utils/binary-search.ts");function o(t,e,n){if(null===e||!Array.isArray(t)||!t.length||!Object(r.isFiniteNumber)(e))return null;if(e<(t[0].programDateTime||0))return null;if(e>=(t[t.length-1].endProgramDateTime||0))return null;n=n||0;for(var i=0;i<t.length;++i){var o=t[i];if(l(e,n,o))return o}return null}function a(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=0);var o=null;if(t?o=e[t.sn-e[0].sn+1]||null:0===n&&0===e[0].start&&(o=e[0]),o&&0===s(n,r,o))return o;var a=i.default.search(e,s.bind(null,n,r));return a||o}function s(t,e,n){void 0===t&&(t=0),void 0===e&&(e=0);var r=Math.min(e,n.duration+(n.deltaPTS?n.deltaPTS:0));return n.start+n.duration-r<=t?1:n.start-r>t&&n.start?-1:0}function l(t,e,n){var r=1e3*Math.min(e,n.duration+(n.deltaPTS?n.deltaPTS:0));return(n.endProgramDateTime||0)-r>t}function c(t,e){return i.default.search(t,(function(t){return t.cc<e?1:t.cc>e?-1:0}))}},"./src/controller/fragment-tracker.ts":
/*!********************************************!*\
!*** ./src/controller/fragment-tracker.ts ***!
\********************************************/
/*! exports provided: FragmentState, FragmentTracker */function(t,e,n){"use strict";n.r(e),n.d(e,"FragmentState",(function(){return r})),n.d(e,"FragmentTracker",(function(){return a}));var r,i=n(/*! ../events */"./src/events.ts"),o=n(/*! ../types/loader */"./src/types/loader.ts");!function(t){t.NOT_LOADED="NOT_LOADED",t.BACKTRACKED="BACKTRACKED",t.APPENDING="APPENDING",t.PARTIAL="PARTIAL",t.OK="OK"}(r||(r={}));var a=function(){function t(t){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=t,this._registerListeners()}var e=t.prototype;return e._registerListeners=function(){var t=this.hls;t.on(i.Events.BUFFER_APPENDED,this.onBufferAppended,this),t.on(i.Events.FRAG_BUFFERED,this.onFragBuffered,this),t.on(i.Events.FRAG_LOADED,this.onFragLoaded,this)},e._unregisterListeners=function(){var t=this.hls;t.off(i.Events.BUFFER_APPENDED,this.onBufferAppended,this),t.off(i.Events.FRAG_BUFFERED,this.onFragBuffered,this),t.off(i.Events.FRAG_LOADED,this.onFragLoaded,this)},e.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},e.getAppendedFrag=function(t,e){if(e===o.PlaylistLevelType.MAIN){var n=this.activeFragment,r=this.activeParts;if(!n)return null;if(r)for(var i=r.length;i--;){var a=r[i],s=a?a.end:n.appendedPTS;if(a.start<=t&&void 0!==s&&t<=s)return i>9&&(this.activeParts=r.slice(i-9)),a}else if(n.start<=t&&void 0!==n.appendedPTS&&t<=n.appendedPTS)return n}return this.getBufferedFrag(t,e)},e.getBufferedFrag=function(t,e){for(var n=this.fragments,r=Object.keys(n),i=r.length;i--;){var o=n[r[i]];if((null==o?void 0:o.body.type)===e&&o.buffered){var a=o.body;if(a.start<=t&&t<=a.end)return a}}return null},e.detectEvictedFragments=function(t,e,n){var r=this;Object.keys(this.fragments).forEach((function(i){var o=r.fragments[i];if(o)if(o.buffered){var a=o.range[t];a&&a.time.some((function(t){var n=!r.isTimeBuffered(t.startPTS,t.endPTS,e);return n&&r.removeFragment(o.body),n}))}else o.body.type===n&&r.removeFragment(o.body)}))},e.detectPartialFragments=function(t){var e=this,n=this.timeRanges,r=t.frag,i=t.part;if(n&&"initSegment"!==r.sn){var o=l(r),a=this.fragments[o];a&&(Object.keys(n).forEach((function(t){var o=r.elementaryStreams[t];if(o){var s=n[t],l=null!==i||!0===o.partial;a.range[t]=e.getBufferedTimes(r,i,l,s)}})),a.backtrack=a.loaded=null,Object.keys(a.range).length?a.buffered=!0:this.removeFragment(a.body))}},e.fragBuffered=function(t){var e=l(t),n=this.fragments[e];n&&(n.backtrack=n.loaded=null,n.buffered=!0)},e.getBufferedTimes=function(t,e,n,r){for(var i={time:[],partial:n},o=e?e.start:t.start,a=e?e.end:t.end,s=t.minEndPTS||a,l=t.maxStartPTS||o,c=0;c<r.length;c++){var u=r.start(c)-this.bufferPadding,h=r.end(c)+this.bufferPadding;if(l>=u&&s<=h){i.time.push({startPTS:Math.max(o,r.start(c)),endPTS:Math.min(a,r.end(c))});break}if(o<h&&a>u)i.partial=!0,i.time.push({startPTS:Math.max(o,r.start(c)),endPTS:Math.min(a,r.end(c))});else if(a<=u)break}return i},e.getPartialFragment=function(t){var e,n,r,i=null,o=0,a=this.bufferPadding,l=this.fragments;return Object.keys(l).forEach((function(c){var u=l[c];u&&s(u)&&(n=u.body.start-a,r=u.body.end+a,t>=n&&t<=r&&(e=Math.min(t-n,r-t),o<=e&&(i=u.body,o=e)))})),i},e.getState=function(t){var e=l(t),n=this.fragments[e];return n?n.buffered?s(n)?r.PARTIAL:r.OK:n.backtrack?r.BACKTRACKED:r.APPENDING:r.NOT_LOADED},e.backtrack=function(t,e){var n=l(t),r=this.fragments[n];if(!r||r.backtrack)return null;var i=r.backtrack=e||r.loaded;return r.loaded=null,i},e.getBacktrackData=function(t){var e=l(t),n=this.fragments[e];if(n){var r,i=n.backtrack;if(null!=i&&null!==(r=i.payload)&&void 0!==r&&r.byteLength)return i;this.removeFragment(t)}return null},e.isTimeBuffered=function(t,e,n){for(var r,i,o=0;o<n.length;o++){if(r=n.start(o)-this.bufferPadding,i=n.end(o)+this.bufferPadding,t>=r&&e<=i)return!0;if(e<=r)return!1}return!1},e.onFragLoaded=function(t,e){var n=e.frag,r=e.part;if("initSegment"!==n.sn&&!n.bitrateTest&&!r){var i=l(n);this.fragments[i]={body:n,loaded:e,backtrack:null,buffered:!1,range:Object.create(null)}}},e.onBufferAppended=function(t,e){var n=this,r=e.frag,i=e.part,a=e.timeRanges;if(r.type===o.PlaylistLevelType.MAIN)if(this.activeFragment=r,i){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(i)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach((function(t){var e=a[t];if(n.detectEvictedFragments(t,e),!i)for(var o=0;o<e.length;o++)r.appendedPTS=Math.max(e.end(o),r.appendedPTS||0)}))},e.onFragBuffered=function(t,e){this.detectPartialFragments(e)},e.hasFragment=function(t){var e=l(t);return!!this.fragments[e]},e.removeFragmentsInRange=function(t,e,n){var r=this;Object.keys(this.fragments).forEach((function(i){var o=r.fragments[i];if(o&&o.buffered){var a=o.body;a.type===n&&a.start<e&&a.end>t&&r.removeFragment(a)}}))},e.removeFragment=function(t){var e=l(t);t.stats.loaded=0,t.clearElementaryStreamInfo(),delete this.fragments[e]},e.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},t}();function s(t){var e,n;return t.buffered&&((null===(e=t.range.video)||void 0===e?void 0:e.partial)||(null===(n=t.range.audio)||void 0===n?void 0:n.partial))}function l(t){return t.type+"_"+t.level+"_"+t.urlId+"_"+t.sn}},"./src/controller/gap-controller.ts":
/*!******************************************!*\
!*** ./src/controller/gap-controller.ts ***!
\******************************************/
/*! exports provided: STALL_MINIMUM_DURATION_MS, MAX_START_GAP_JUMP, SKIP_BUFFER_HOLE_STEP_SECONDS, SKIP_BUFFER_RANGE_START, default */function(t,e,n){"use strict";n.r(e),n.d(e,"STALL_MINIMUM_DURATION_MS",(function(){return s})),n.d(e,"MAX_START_GAP_JUMP",(function(){return l})),n.d(e,"SKIP_BUFFER_HOLE_STEP_SECONDS",(function(){return c})),n.d(e,"SKIP_BUFFER_RANGE_START",(function(){return u})),n.d(e,"default",(function(){return h}));var r=n(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),i=n(/*! ../errors */"./src/errors.ts"),o=n(/*! ../events */"./src/events.ts"),a=n(/*! ../utils/logger */"./src/utils/logger.ts"),s=250,l=2,c=.1,u=.05,h=function(){function t(t,e,n,r){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=t,this.media=e,this.fragmentTracker=n,this.hls=r}var e=t.prototype;return e.destroy=function(){this.hls=this.fragmentTracker=this.media=null},e.poll=function(t){var e=this.config,n=this.media,i=this.stalled,o=n.currentTime,c=n.seeking,u=this.seeking&&!c,h=!this.seeking&&c;if(this.seeking=c,o===t){if((h||u)&&(this.stalled=null),!n.paused&&!n.ended&&0!==n.playbackRate&&r.BufferHelper.getBuffered(n).length){var d=r.BufferHelper.bufferInfo(n,o,0),f=d.len>0,p=d.nextStart||0;if(f||p){if(c){var g=d.len>l,m=!p||p-o>l&&!this.fragmentTracker.getPartialFragment(o);if(g||m)return;this.moved=!1}if(!this.moved&&null!==this.stalled){var v,y=Math.max(p,d.start||0)-o,b=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,x=(null==b||null===(v=b.details)||void 0===v?void 0:v.live)?2*b.details.targetduration:l;if(y>0&&y<=x)return void this._trySkipBufferHole(null)}var C=self.performance.now();if(null!==i){var S=C-i;!c&&S>=s&&this._reportStall(d.len);var E=r.BufferHelper.bufferInfo(n,o,e.maxBufferHole);this._tryFixBufferStall(E,S)}else this.stalled=C}}}else if(this.moved=!0,null!==i){if(this.stallReported){var k=self.performance.now()-i;a.logger.warn("playback not stuck anymore @"+o+", after "+Math.round(k)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}},e._tryFixBufferStall=function(t,e){var n=this.config,r=this.fragmentTracker,i=this.media.currentTime,o=r.getPartialFragment(i);o&&this._trySkipBufferHole(o)||t.len>n.maxBufferHole&&e>1e3*n.highBufferWatchdogPeriod&&(a.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},e._reportStall=function(t){var e=this.hls,n=this.media;this.stallReported||(this.stallReported=!0,a.logger.warn("Playback stalling at @"+n.currentTime+" due to low buffer (buffer="+t+")"),e.trigger(o.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:t}))},e._trySkipBufferHole=function(t){for(var e=this.config,n=this.hls,s=this.media,l=s.currentTime,h=0,d=r.BufferHelper.getBuffered(s),f=0;f<d.length;f++){var p=d.start(f);if(l+e.maxBufferHole>=h&&l<p){var g=Math.max(p+u,s.currentTime+c);return a.logger.warn("skipping hole, adjusting currentTime from "+l+" to "+g),this.moved=!0,this.stalled=null,s.currentTime=g,t&&n.trigger(o.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+l+" to "+g,frag:t}),g}h=d.end(f)}return 0},e._tryNudgeBuffer=function(){var t=this.config,e=this.hls,n=this.media,r=n.currentTime,s=(this.nudgeRetry||0)+1;if(this.nudgeRetry=s,s<t.nudgeMaxRetry){var l=r+s*t.nudgeOffset;a.logger.warn("Nudging 'currentTime' from "+r+" to "+l),n.currentTime=l,e.trigger(o.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else a.logger.error("Playhead still not moving while enough data buffered @"+r+" after "+t.nudgeMaxRetry+" nudges"),e.trigger(o.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},t}()},"./src/controller/id3-track-controller.ts":
/*!************************************************!*\
!*** ./src/controller/id3-track-controller.ts ***!
\************************************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e);var r=n(/*! ../events */"./src/events.ts"),i=n(/*! ../utils/texttrack-utils */"./src/utils/texttrack-utils.ts"),o=n(/*! ../demux/id3 */"./src/demux/id3.ts"),a=function(){function t(t){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=t,this._registerListeners()}var e=t.prototype;return e.destroy=function(){this._unregisterListeners()},e._registerListeners=function(){var t=this.hls;t.on(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(r.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.on(r.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},e._unregisterListeners=function(){var t=this.hls;t.off(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(r.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.off(r.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},e.onMediaAttached=function(t,e){this.media=e.media},e.onMediaDetaching=function(){this.id3Track&&(Object(i.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null)},e.getID3Track=function(t){if(this.media){for(var e=0;e<t.length;e++){var n=t[e];if("metadata"===n.kind&&"id3"===n.label)return Object(i.sendAddTrackEvent)(n,this.media),n}return this.media.addTextTrack("metadata","id3")}},e.onFragParsingMetadata=function(t,e){if(this.media){var n=e.frag,r=e.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var i=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,a=0;a<r.length;a++){var s=o.getID3Frames(r[a].data);if(s){var l=r[a].pts,c=a<r.length-1?r[a+1].pts:n.end;c-l<=0&&(c=l+.25);for(var u=0;u<s.length;u++){var h=s[u];if(!o.isTimeStampFrame(h)){var d=new i(l,c,"");d.value=h,this.id3Track.addCue(d)}}}}}},e.onBufferFlushing=function(t,e){var n=e.startOffset,r=e.endOffset,o=e.type;if(!o||"audio"===o){var a=this.id3Track;a&&Object(i.removeCuesInRange)(a,n,r)}},t}();e.default=a},"./src/controller/latency-controller.ts":
/*!**********************************************!*\
!*** ./src/controller/latency-controller.ts ***!
\**********************************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return s}));var r=n(/*! ../errors */"./src/errors.ts"),i=n(/*! ../events */"./src/events.ts"),o=n(/*! ../utils/logger */"./src/utils/logger.ts");function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var s=function(){function t(t){var e=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 e.timeupdate()},this.hls=t,this.config=t.config,this.registerListeners()}var e,n,s,l=t.prototype;return l.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},l.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)},l.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)},l.onMediaAttached=function(t,e){this.media=e.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},l.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},l.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},l.onLevelUpdated=function(t,e){var n=e.details;this.levelDetails=n,n.advanced&&this.timeupdate(),!n.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},l.onError=function(t,e){e.details===r.ErrorDetails.BUFFER_STALLED_ERROR&&(this.stallCount++,o.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))},l.timeupdate=function(){var t=this.media,e=this.levelDetails;if(t&&e){this.currentTime=t.currentTime;var n=this.computeLatency();if(null!==n){this._latency=n;var r=this.config,i=r.lowLatencyMode,o=r.maxLiveSyncPlaybackRate;if(i&&1!==o){var a=this.targetLatency;if(null!==a){var s=n-a,l=s<Math.min(this.maxLatency,a+e.targetduration);if(e.live&&l&&s>.05&&this.forwardBufferLength>1){var c=Math.min(2,Math.max(1,o)),u=Math.round(2/(1+Math.exp(-.75*s-this.edgeStalled))*20)/20;t.playbackRate=Math.min(c,Math.max(1,u))}else 1!==t.playbackRate&&0!==t.playbackRate&&(t.playbackRate=1)}}}}},l.estimateLiveEdge=function(){var t=this.levelDetails;return null===t?null:t.edge+t.age},l.computeLatency=function(){var t=this.estimateLiveEdge();return null===t?null:t-this.currentTime},e=t,(n=[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var t=this.config,e=this.levelDetails;return void 0!==t.liveMaxLatencyDuration?t.liveMaxLatencyDuration:e?t.liveMaxLatencyDurationCount*e.targetduration:0}},{key:"targetLatency",get:function(){var t=this.levelDetails;if(null===t)return null;var e=t.holdBack,n=t.partHoldBack,r=t.targetduration,i=this.config,o=i.liveSyncDuration,a=i.liveSyncDurationCount,s=i.lowLatencyMode,l=this.hls.userConfig,c=s&&n||e;(l.liveSyncDuration||l.liveSyncDurationCount||0===c)&&(c=void 0!==o?o:a*r);var u=r;return c+Math.min(1*this.stallCount,u)}},{key:"liveSyncPosition",get:function(){var t=this.estimateLiveEdge(),e=this.targetLatency,n=this.levelDetails;if(null===t||null===e||null===n)return null;var r=n.edge,i=t-e-this.edgeStalled,o=r-n.totalduration,a=r-(this.config.lowLatencyMode&&n.partTarget||n.targetduration);return Math.min(Math.max(o,i),a)}},{key:"drift",get:function(){var t=this.levelDetails;return null===t?1:t.drift}},{key:"edgeStalled",get:function(){var t=this.levelDetails;if(null===t)return 0;var e=3*(this.config.lowLatencyMode&&t.partTarget||t.targetduration);return Math.max(t.age-e,0)}},{key:"forwardBufferLength",get:function(){var t=this.media,e=this.levelDetails;if(!t||!e)return 0;var n=t.buffered.length;return n?t.buffered.end(n-1):e.edge-this.currentTime}}])&&a(e.prototype,n),s&&a(e,s),t}()},"./src/controller/level-controller.ts":
/*!********************************************!*\
!*** ./src/controller/level-controller.ts ***!
\********************************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return p}));var r=n(/*! ../types/level */"./src/types/level.ts"),i=n(/*! ../events */"./src/events.ts"),o=n(/*! ../errors */"./src/errors.ts"),a=n(/*! ../utils/codecs */"./src/utils/codecs.ts"),s=n(/*! ./level-helper */"./src/controller/level-helper.ts"),l=n(/*! ./base-playlist-controller */"./src/controller/base-playlist-controller.ts"),c=n(/*! ../types/loader */"./src/types/loader.ts");function u(){return(u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function h(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function d(t,e){return(d=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var f=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),p=function(t){var e,n;function l(e){var n;return(n=t.call(this,e,"[level-controller]")||this)._levels=[],n._firstLevel=-1,n._startLevel=void 0,n.currentLevelIndex=-1,n.manualLevelIndex=-1,n.onParsedComplete=void 0,n._registerListeners(),n}n=t,(e=l).prototype=Object.create(n.prototype),e.prototype.constructor=e,d(e,n);var p,g,m,v=l.prototype;return v._registerListeners=function(){var t=this.hls;t.on(i.Events.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(i.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.on(i.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(i.Events.FRAG_LOADED,this.onFragLoaded,this),t.on(i.Events.ERROR,this.onError,this)},v._unregisterListeners=function(){var t=this.hls;t.off(i.Events.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(i.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.off(i.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(i.Events.FRAG_LOADED,this.onFragLoaded,this),t.off(i.Events.ERROR,this.onError,this)},v.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,t.prototype.destroy.call(this)},v.startLoad=function(){this._levels.forEach((function(t){t.loadError=0})),t.prototype.startLoad.call(this)},v.onManifestLoaded=function(t,e){var n,l,c=[],u=[],h=[],d={},p=!1,g=!1,m=!1;if(e.levels.forEach((function(t){var e=t.attrs;p=p||!(!t.width||!t.height),g=g||!!t.videoCodec,m=m||!!t.audioCodec,f&&t.audioCodec&&-1!==t.audioCodec.indexOf("mp4a.40.34")&&(t.audioCodec=void 0);var n=t.bitrate+"-"+t.attrs.RESOLUTION+"-"+t.attrs.CODECS;(l=d[n])?l.url.push(t.url):(l=new r.Level(t),d[n]=l,c.push(l)),e&&(e.AUDIO&&Object(s.addGroupId)(l,"audio",e.AUDIO),e.SUBTITLES&&Object(s.addGroupId)(l,"text",e.SUBTITLES))})),(p||g)&&m&&(c=c.filter((function(t){var e=t.videoCodec,n=t.width,r=t.height;return!!e||!(!n||!r)}))),c=c.filter((function(t){var e=t.audioCodec,n=t.videoCodec;return(!e||Object(a.isCodecSupportedInMp4)(e,"audio"))&&(!n||Object(a.isCodecSupportedInMp4)(n,"video"))})),e.audioTracks&&(u=e.audioTracks.filter((function(t){return!t.audioCodec||Object(a.isCodecSupportedInMp4)(t.audioCodec,"audio")})),Object(s.assignTrackIdsByGroup)(u)),e.subtitles&&(h=e.subtitles,Object(s.assignTrackIdsByGroup)(h)),c.length>0){n=c[0].bitrate,c.sort((function(t,e){return t.bitrate-e.bitrate})),this._levels=c;for(var v=0;v<c.length;v++)if(c[v].bitrate===n){this._firstLevel=v,this.log("manifest loaded, "+c.length+" level(s) found, first bitrate: "+n);break}var y=m&&!g,b={levels:c,audioTracks:u,subtitleTracks:h,firstLevel:this._firstLevel,stats:e.stats,audio:m,video:g,altAudio:!y&&u.some((function(t){return!!t.url}))};this.hls.trigger(i.Events.MANIFEST_PARSED,b),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(i.Events.ERROR,{type:o.ErrorTypes.MEDIA_ERROR,details:o.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:e.url,reason:"no level with compatible codecs found in manifest"})},v.onError=function(e,n){if(t.prototype.onError.call(this,e,n),!n.fatal){var r=n.context,i=this._levels[this.currentLevelIndex];if(r&&(r.type===c.PlaylistContextType.AUDIO_TRACK&&i.audioGroupIds&&r.groupId===i.audioGroupIds[i.urlId]||r.type===c.PlaylistContextType.SUBTITLE_TRACK&&i.textGroupIds&&r.groupId===i.textGroupIds[i.urlId]))this.redundantFailover(this.currentLevelIndex);else{var a,s=!1,l=!0;switch(n.details){case o.ErrorDetails.FRAG_LOAD_ERROR:case o.ErrorDetails.FRAG_LOAD_TIMEOUT:case o.ErrorDetails.KEY_LOAD_ERROR:case o.ErrorDetails.KEY_LOAD_TIMEOUT:if(n.frag){var u=this._levels[n.frag.level];u?(u.fragmentError++,u.fragmentError>this.hls.config.fragLoadingMaxRetry&&(a=n.frag.level)):a=n.frag.level}break;case o.ErrorDetails.LEVEL_LOAD_ERROR:case o.ErrorDetails.LEVEL_LOAD_TIMEOUT:r&&(r.deliveryDirectives&&(l=!1),a=r.level),s=!0;break;case o.ErrorDetails.REMUX_ALLOC_ERROR:a=n.level,s=!0}void 0!==a&&this.recoverLevel(n,a,s,l)}}},v.recoverLevel=function(t,e,n,r){var i=t.details,o=this._levels[e];if(o.loadError++,n){if(!this.retryLoadingOrFail(t))return void(this.currentLevelIndex=-1);t.levelRetry=!0}if(r){var a=o.url.length;if(a>1&&o.loadError<a)t.levelRetry=!0,this.redundantFailover(e);else if(-1===this.manualLevelIndex){var s=0===e?this._levels.length-1:e-1;this.currentLevelIndex!==s&&0===this._levels[s].loadError&&(this.warn(i+": switch to "+s),t.levelRetry=!0,this.hls.nextAutoLevel=s)}}},v.redundantFailover=function(t){var e=this._levels[t],n=e.url.length;if(n>1){var r=(e.urlId+1)%n;this.warn("Switching to redundant URL-id "+r),this._levels.forEach((function(t){t.urlId=r})),this.level=t}},v.onFragLoaded=function(t,e){var n=e.frag;if(void 0!==n&&n.type===c.PlaylistLevelType.MAIN){var r=this._levels[n.level];void 0!==r&&(r.fragmentError=0,r.loadError=0)}},v.onLevelLoaded=function(t,e){var n,r,i=e.level,o=e.details,a=this._levels[i];if(!a)return this.warn("Invalid level index "+i),void(null!==(r=e.deliveryDirectives)&&void 0!==r&&r.skip&&(o.deltaUpdateFailed=!0));i===this.currentLevelIndex?(0===a.fragmentError&&(a.loadError=0,this.retryCount=0),this.playlistLoaded(i,e,a.details)):null!==(n=e.deliveryDirectives)&&void 0!==n&&n.skip&&(o.deltaUpdateFailed=!0)},v.onAudioTrackSwitched=function(t,e){var n=this.hls.levels[this.currentLevelIndex];if(n&&n.audioGroupIds){for(var r=-1,i=this.hls.audioTracks[e.id].groupId,o=0;o<n.audioGroupIds.length;o++)if(n.audioGroupIds[o]===i){r=o;break}r!==n.urlId&&(n.urlId=r,this.startLoad())}},v.loadPlaylist=function(t){var e=this.currentLevelIndex,n=this._levels[e];if(this.canLoad&&n&&n.url.length>0){var r=n.urlId,o=n.url[r];if(t)try{o=t.addDirectives(o)}catch(t){this.warn("Could not construct new URL with HLS Delivery Directives: "+t)}this.log("Attempt loading level index "+e+(t?" at sn "+t.msn+" part "+t.part:"")+" with URL-id "+r+" "+o),this.clearTimer(),this.hls.trigger(i.Events.LEVEL_LOADING,{url:o,level:e,id:r,deliveryDirectives:t||null})}},v.removeLevel=function(t,e){var n=function(t,n){return n!==e},r=this._levels.filter((function(r,i){return i!==t||r.url.length>1&&void 0!==e&&(r.url=r.url.filter(n),r.audioGroupIds&&(r.audioGroupIds=r.audioGroupIds.filter(n)),r.textGroupIds&&(r.textGroupIds=r.textGroupIds.filter(n)),r.urlId=0,!0)})).map((function(t,e){var n=t.details;return null!=n&&n.fragments&&n.fragments.forEach((function(t){t.level=e})),t}));this._levels=r,this.hls.trigger(i.Events.LEVELS_UPDATED,{levels:r})},p=l,(g=[{key:"levels",get:function(){return 0===this._levels.length?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(t){var e,n=this._levels;if(0!==n.length&&(this.currentLevelIndex!==t||null===(e=n[t])||void 0===e||!e.details)){if(t<0||t>=n.length){var r=t<0;if(this.hls.trigger(i.Events.ERROR,{type:o.ErrorTypes.OTHER_ERROR,details:o.ErrorDetails.LEVEL_SWITCH_ERROR,level:t,fatal:r,reason:"invalid level idx"}),r)return;t=Math.min(t,n.length-1)}this.clearTimer();var a=this.currentLevelIndex,s=n[a],l=n[t];this.log("switching to level "+t+" from "+a),this.currentLevelIndex=t;var c=u({},l,{level:t,maxBitrate:l.maxBitrate,uri:l.uri,urlId:l.urlId});delete c._urlId,this.hls.trigger(i.Events.LEVEL_SWITCHING,c);var h=l.details;if(!h||h.live){var d=this.switchParams(l.uri,null==s?void 0:s.details);this.loadPlaylist(d)}}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(t){this.manualLevelIndex=t,void 0===this._startLevel&&(this._startLevel=t),-1!==t&&(this.level=t)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(t){this._firstLevel=t}},{key:"startLevel",get:function(){if(void 0===this._startLevel){var t=this.hls.config.startLevel;return void 0!==t?t:this._firstLevel}return this._startLevel},set:function(t){this._startLevel=t}},{key:"nextLoadLevel",get:function(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(t){this.level=t,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=t)}}])&&h(p.prototype,g),m&&h(p,m),l}(l.default)},"./src/controller/level-helper.ts":
/*!****************************************!*\
!*** ./src/controller/level-helper.ts ***!
\****************************************/
/*! exports provided: addGroupId, assignTrackIdsByGroup, updatePTS, updateFragPTSDTS, mergeDetails, mapPartIntersection, mapFragmentIntersection, adjustSliding, addSliding, computeReloadInterval, getFragmentWithSN, getPartWith */function(t,e,n){"use strict";n.r(e),n.d(e,"addGroupId",(function(){return o})),n.d(e,"assignTrackIdsByGroup",(function(){return a})),n.d(e,"updatePTS",(function(){return s})),n.d(e,"updateFragPTSDTS",(function(){return c})),n.d(e,"mergeDetails",(function(){return u})),n.d(e,"mapPartIntersection",(function(){return h})),n.d(e,"mapFragmentIntersection",(function(){return d})),n.d(e,"adjustSliding",(function(){return f})),n.d(e,"addSliding",(function(){return p})),n.d(e,"computeReloadInterval",(function(){return g})),n.d(e,"getFragmentWithSN",(function(){return m})),n.d(e,"getPartWith",(function(){return v}));var r=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=n(/*! ../utils/logger */"./src/utils/logger.ts");function o(t,e,n){switch(e){case"audio":t.audioGroupIds||(t.audioGroupIds=[]),t.audioGroupIds.push(n);break;case"text":t.textGroupIds||(t.textGroupIds=[]),t.textGroupIds.push(n)}}function a(t){var e={};t.forEach((function(t){var n=t.groupId||"";t.id=e[n]=e[n]||0,e[n]++}))}function s(t,e,n){l(t[e],t[n])}function l(t,e){var n=e.startPTS;if(Object(r.isFiniteNumber)(n)){var i,o=0;e.sn>t.sn?(o=n-t.start,i=t):(o=t.start-n,i=e),i.duration!==o&&(i.duration=o)}else e.sn>t.sn?t.cc===e.cc&&t.minEndPTS?e.start=t.start+(t.minEndPTS-t.start):e.start=t.start+t.duration:e.start=Math.max(t.start-e.duration,0)}function c(t,e,n,o,a,s){o-n<=0&&(i.logger.warn("Fragment should have a positive duration",e),o=n+e.duration,s=a+e.duration);var c=n,u=o,h=e.startPTS,d=e.endPTS;if(Object(r.isFiniteNumber)(h)){var f=Math.abs(h-n);Object(r.isFiniteNumber)(e.deltaPTS)?e.deltaPTS=Math.max(f,e.deltaPTS):e.deltaPTS=f,c=Math.max(n,h),n=Math.min(n,h),a=Math.min(a,e.startDTS),u=Math.min(o,d),o=Math.max(o,d),s=Math.max(s,e.endDTS)}e.duration=o-n;var p=n-e.start;e.appendedPTS=o,e.start=e.startPTS=n,e.maxStartPTS=c,e.startDTS=a,e.endPTS=o,e.minEndPTS=u,e.endDTS=s;var g,m=e.sn;if(!t||m<t.startSN||m>t.endSN)return 0;var v=m-t.startSN,y=t.fragments;for(y[v]=e,g=v;g>0;g--)l(y[g],y[g-1]);for(g=v;g<y.length-1;g++)l(y[g],y[g+1]);return t.fragmentHint&&l(y[y.length-1],t.fragmentHint),t.PTSKnown=t.alignedSliding=!0,p}function u(t,e){for(var n=null,o=t.fragments,a=o.length-1;a>=0;a--){var s=o[a].initSegment;if(s){n=s;break}}t.fragmentHint&&delete t.fragmentHint.endPTS;var l,u=0;if(d(t,e,(function(t,i){t.relurl&&(u=t.cc-i.cc),Object(r.isFiniteNumber)(t.startPTS)&&Object(r.isFiniteNumber)(t.endPTS)&&(i.start=i.startPTS=t.startPTS,i.startDTS=t.startDTS,i.appendedPTS=t.appendedPTS,i.maxStartPTS=t.maxStartPTS,i.endPTS=t.endPTS,i.endDTS=t.endDTS,i.minEndPTS=t.minEndPTS,i.duration=t.endPTS-t.startPTS,i.duration&&(l=i),e.PTSKnown=e.alignedSliding=!0),i.elementaryStreams=t.elementaryStreams,i.loader=t.loader,i.stats=t.stats,i.urlId=t.urlId,t.initSegment&&(i.initSegment=t.initSegment,n=t.initSegment)})),n&&(e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments).forEach((function(t){var e;t.initSegment&&t.initSegment.relurl!==(null===(e=n)||void 0===e?void 0:e.relurl)||(t.initSegment=n)})),e.skippedSegments&&(e.deltaUpdateFailed=e.fragments.some((function(t){return!t})),e.deltaUpdateFailed)){i.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var p=e.skippedSegments;p--;)e.fragments.shift();e.startSN=e.fragments[0].sn,e.startCC=e.fragments[0].cc}var g=e.fragments;if(u){i.logger.warn("discontinuity sliding from playlist, take drift into account");for(var m=0;m<g.length;m++)g[m].cc+=u}e.skippedSegments&&(e.startCC=e.fragments[0].cc),h(t.partList,e.partList,(function(t,e){e.elementaryStreams=t.elementaryStreams,e.stats=t.stats})),l?c(e,l,l.startPTS,l.endPTS,l.startDTS,l.endDTS):f(t,e),g.length&&(e.totalduration=e.edge-g[0].start),e.driftStartTime=t.driftStartTime,e.driftStart=t.driftStart;var v=e.advancedDateTime;if(e.advanced&&v){var y=e.edge;e.driftStart||(e.driftStartTime=v,e.driftStart=y),e.driftEndTime=v,e.driftEnd=y}else e.driftEndTime=t.driftEndTime,e.driftEnd=t.driftEnd,e.advancedDateTime=t.advancedDateTime}function h(t,e,n){if(t&&e)for(var r=0,i=0,o=t.length;i<=o;i++){var a=t[i],s=e[i+r];a&&s&&a.index===s.index&&a.fragment.sn===s.fragment.sn?n(a,s):r--}}function d(t,e,n){for(var r=e.skippedSegments,i=Math.max(t.startSN,e.startSN)-e.startSN,o=(t.fragmentHint?1:0)+(r?e.endSN:Math.min(t.endSN,e.endSN))-e.startSN,a=e.startSN-t.startSN,s=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,l=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,c=i;c<=o;c++){var u=l[a+c],h=s[c];r&&!h&&c<r&&(h=e.fragments[c]=u),u&&h&&n(u,h)}}function f(t,e){var n=e.startSN+e.skippedSegments-t.startSN,r=t.fragments;n<0||n>=r.length||p(e,r[n].start)}function p(t,e){if(e){for(var n=t.fragments,r=t.skippedSegments;r<n.length;r++)n[r].start+=e;t.fragmentHint&&(t.fragmentHint.start+=e)}}function g(t,e){var n,r=1e3*t.levelTargetDuration,i=r/2,o=t.age,a=o>0&&o<3*r,s=e.loading.end-e.loading.start,l=t.availabilityDelay;if(!1===t.updated)if(a){var c=333*t.misses;n=Math.max(Math.min(i,2*s),c),t.availabilityDelay=(t.availabilityDelay||0)+n}else n=i;else a?(l=Math.min(l||r/2,o),t.availabilityDelay=l,n=l+r-o):n=r-s;return Math.round(n)}function m(t,e,n){if(!t||!t.details)return null;var r=t.details,i=r.fragments[e-r.startSN];return i||((i=r.fragmentHint)&&i.sn===e?i:e<r.startSN&&n&&n.sn===e?n:null)}function v(t,e,n){if(!t||!t.details)return null;var r=t.details.partList;if(r)for(var i=r.length;i--;){var o=r[i];if(o.index===n&&o.fragment.sn===e)return o}return null}},"./src/controller/stream-controller.ts":
/*!*********************************************!*\
!*** ./src/controller/stream-controller.ts ***!
\*********************************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return y}));var r=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=n(/*! ./base-stream-controller */"./src/controller/base-stream-controller.ts"),o=n(/*! ../is-supported */"./src/is-supported.ts"),a=n(/*! ../events */"./src/events.ts"),s=n(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),l=n(/*! ./fragment-tracker */"./src/controller/fragment-tracker.ts"),c=n(/*! ../types/loader */"./src/types/loader.ts"),u=n(/*! ../loader/fragment */"./src/loader/fragment.ts"),h=n(/*! ../demux/transmuxer-interface */"./src/demux/transmuxer-interface.ts"),d=n(/*! ../types/transmuxer */"./src/types/transmuxer.ts"),f=n(/*! ./gap-controller */"./src/controller/gap-controller.ts"),p=n(/*! ../errors */"./src/errors.ts"),g=n(/*! ../utils/logger */"./src/utils/logger.ts");function m(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function v(t,e){return(v=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var y=function(t){var e,n;function y(e,n){var r;return(r=t.call(this,e,n,"[stream-controller]")||this).audioCodecSwap=!1,r.gapController=null,r.level=-1,r._forceStartLoad=!1,r.altAudio=!1,r.audioOnly=!1,r.fragPlaying=null,r.onvplaying=null,r.onvseeked=null,r.fragLastKbps=0,r.stalled=!1,r.couldBacktrack=!1,r.audioCodecSwitch=!1,r.videoBuffer=null,r._registerListeners(),r}n=t,(e=y).prototype=Object.create(n.prototype),e.prototype.constructor=e,v(e,n);var b,x,C,S=y.prototype;return S._registerListeners=function(){var t=this.hls;t.on(a.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(a.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(a.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(a.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.on(a.Events.LEVEL_LOADING,this.onLevelLoading,this),t.on(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.on(a.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.on(a.Events.ERROR,this.onError,this),t.on(a.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(a.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(a.Events.BUFFER_CREATED,this.onBufferCreated,this),t.on(a.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(a.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(a.Events.FRAG_BUFFERED,this.onFragBuffered,this)},S._unregisterListeners=function(){var t=this.hls;t.off(a.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(a.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(a.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(a.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.off(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.off(a.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.off(a.Events.ERROR,this.onError,this),t.off(a.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(a.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(a.Events.BUFFER_CREATED,this.onBufferCreated,this),t.off(a.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(a.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(a.Events.FRAG_BUFFERED,this.onFragBuffered,this)},S.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},S.startLoad=function(t){if(this.levels){var e=this.lastCurrentTime,n=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var r=n.startLevel;-1===r&&(n.config.testBandwidth?(r=0,this.bitrateTest=!0):r=n.nextAutoLevel),this.level=n.nextLoadLevel=r,this.loadedmetadata=!1}e>0&&-1===t&&(this.log("Override startPosition with lastCurrentTime @"+e.toFixed(3)),t=e),this.state=i.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()}else this._forceStartLoad=!0,this.state=i.State.STOPPED},S.stopLoad=function(){this._forceStartLoad=!1,t.prototype.stopLoad.call(this)},S.doTick=function(){switch(this.state){case i.State.IDLE:this.doTickIdle();break;case i.State.WAITING_LEVEL:var t,e=this.levels,n=this.level,r=null==e||null===(t=e[n])||void 0===t?void 0:t.details;if(r&&(!r.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(r))break;this.state=i.State.IDLE;break}break;case i.State.FRAG_LOADING_WAITING_RETRY:var o,a=self.performance.now(),s=this.retryDate;(!s||a>=s||null!==(o=this.media)&&void 0!==o&&o.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=i.State.IDLE)}this.onTickEnd()},S.onTickEnd=function(){t.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},S.doTickIdle=function(){var t,e,n=this.hls,r=this.levelLastLoaded,o=this.levels,s=this.media,h=n.config,d=n.nextLoadLevel;if(null!==r&&(s||!this.startFragRequested&&h.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)&&o&&o[d]){var f=o[d];this.level=n.nextLoadLevel=d;var p=f.details;if(!p||this.state===i.State.WAITING_LEVEL||p.live&&this.levelLastLoaded!==d)this.state=i.State.WAITING_LEVEL;else{var g=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:s,c.PlaylistLevelType.MAIN);if(null!==g&&!(g.len>=this.getMaxBufferLength(f.maxBitrate))){if(this._streamEnded(g,p)){var m={};return this.altAudio&&(m.type="video"),this.hls.trigger(a.Events.BUFFER_EOS,m),void(this.state=i.State.ENDED)}var v=g.end,y=this.getNextFragment(v,p);if(this.couldBacktrack&&!this.fragPrevious&&y&&"initSegment"!==y.sn){var b=y.sn-p.startSN;b>1&&(y=p.fragments[b-1],this.fragmentTracker.removeFragment(y))}if(y&&this.fragmentTracker.getState(y)===l.FragmentState.OK&&this.nextLoadPosition>v){var x=this.audioOnly&&!this.altAudio?u.ElementaryStreamTypes.AUDIO:u.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(s,x,c.PlaylistLevelType.MAIN),y=this.getNextFragment(this.nextLoadPosition,p)}y&&(!y.initSegment||y.initSegment.data||this.bitrateTest||(y=y.initSegment),"identity"!==(null===(t=y.decryptdata)||void 0===t?void 0:t.keyFormat)||null!==(e=y.decryptdata)&&void 0!==e&&e.key?this.loadFragment(y,p,v):this.loadKey(y,p))}}}},S.loadFragment=function(e,n,r){var i,o=this.fragmentTracker.getState(e);if(this.fragCurrent=e,o===l.FragmentState.BACKTRACKED){var a=this.fragmentTracker.getBacktrackData(e);if(a)return this._handleFragmentLoadProgress(a),void this._handleFragmentLoadComplete(a);o=l.FragmentState.NOT_LOADED}o===l.FragmentState.NOT_LOADED||o===l.FragmentState.PARTIAL?"initSegment"===e.sn?this._loadInitSegment(e):this.bitrateTest?(e.bitrateTest=!0,this.log("Fragment "+e.sn+" of level "+e.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(e)):(this.startFragRequested=!0,t.prototype.loadFragment.call(this,e,n,r)):o===l.FragmentState.APPENDING?this.reduceMaxBufferLength(e.duration)&&this.fragmentTracker.removeFragment(e):0===(null===(i=this.media)||void 0===i?void 0:i.buffered.length)&&this.fragmentTracker.removeAllFragments()},S.getAppendedFrag=function(t){var e=this.fragmentTracker.getAppendedFrag(t,c.PlaylistLevelType.MAIN);return e&&"fragment"in e?e.fragment:e},S.getBufferedFrag=function(t){return this.fragmentTracker.getBufferedFrag(t,c.PlaylistLevelType.MAIN)},S.followingBufferedFrag=function(t){return t?this.getBufferedFrag(t.end+.5):null},S.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},S.nextLevelSwitch=function(){var t=this.levels,e=this.media;if(null!=e&&e.readyState){var n,r=this.getAppendedFrag(e.currentTime);if(r&&r.start>1&&this.flushMainBuffer(0,r.start-1),!e.paused&&t){var i=t[this.hls.nextLoadLevel],o=this.fragLastKbps;n=o&&this.fragCurrent?this.fragCurrent.duration*i.maxBitrate/(1e3*o)+1:0}else n=0;var a=this.getBufferedFrag(e.currentTime+n);if(a){var s=this.followingBufferedFrag(a);if(s){this.abortCurrentFrag();var l=s.maxStartPTS?s.maxStartPTS:s.start,c=s.duration,u=Math.max(a.end,l+Math.min(Math.max(c-this.config.maxFragLookUpTolerance,.5*c),.75*c));this.flushMainBuffer(u,Number.POSITIVE_INFINITY)}}}},S.abortCurrentFrag=function(){var t=this.fragCurrent;this.fragCurrent=null,null!=t&&t.loader&&t.loader.abort(),this.state===i.State.KEY_LOADING&&(this.state=i.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},S.flushMainBuffer=function(e,n){t.prototype.flushMainBuffer.call(this,e,n,this.altAudio?"video":null)},S.onMediaAttached=function(e,n){t.prototype.onMediaAttached.call(this,e,n);var r=n.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),r.addEventListener("playing",this.onvplaying),r.addEventListener("seeked",this.onvseeked),this.gapController=new f.default(this.config,r,this.fragmentTracker,this.hls)},S.onMediaDetaching=function(){var e=this.media;e&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),t.prototype.onMediaDetaching.call(this)},S.onMediaPlaying=function(){this.tick()},S.onMediaSeeked=function(){var t=this.media,e=t?t.currentTime:null;Object(r.isFiniteNumber)(e)&&this.log("Media seeked to "+e.toFixed(3)),this.tick()},S.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(a.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},S.onManifestParsed=function(t,e){var n,r=!1,i=!1;e.levels.forEach((function(t){(n=t.audioCodec)&&(-1!==n.indexOf("mp4a.40.2")&&(r=!0),-1!==n.indexOf("mp4a.40.5")&&(i=!0))})),this.audioCodecSwitch=r&&i&&!Object(o.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=e.levels,this.startFragRequested=!1},S.onLevelLoading=function(t,e){var n=this.levels;if(n&&this.state===i.State.IDLE){var r=n[e.level];(!r.details||r.details.live&&this.levelLastLoaded!==e.level||this.waitForCdnTuneIn(r.details))&&(this.state=i.State.WAITING_LEVEL)}},S.onLevelLoaded=function(t,e){var n,r=this.levels,o=e.level,s=e.details,l=s.totalduration;if(r){this.log("Level "+o+" loaded ["+s.startSN+","+s.endSN+"], cc ["+s.startCC+", "+s.endCC+"] duration:"+l);var c=this.fragCurrent;!c||this.state!==i.State.FRAG_LOADING&&this.state!==i.State.FRAG_LOADING_WAITING_RETRY||c.level!==e.level&&c.loader&&(this.state=i.State.IDLE,c.loader.abort());var u=r[o],h=0;if(s.live||null!==(n=u.details)&&void 0!==n&&n.live){if(s.fragments[0]||(s.deltaUpdateFailed=!0),s.deltaUpdateFailed)return;h=this.alignPlaylists(s,u.details)}if(u.details=s,this.levelLastLoaded=o,this.hls.trigger(a.Events.LEVEL_UPDATED,{details:s,level:o}),this.state===i.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(s))return;this.state=i.State.IDLE}this.startFragRequested?s.live&&this.synchronizeToLiveEdge(s):this.setStartPosition(s,h),this.tick()}else this.warn("Levels were reset while loading level "+o)},S._handleFragmentLoadProgress=function(t){var e,n=t.frag,r=t.part,i=t.payload,o=this.levels;if(o){var a=o[n.level],s=a.details;if(s){var l=a.videoCodec,u=s.PTSKnown||!s.live,f=null===(e=n.initSegment)||void 0===e?void 0:e.data,p=this._getAudioCodec(a),g=this.transmuxer=this.transmuxer||new h.default(this.hls,c.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),m=r?r.index:-1,v=-1!==m,y=new d.ChunkMetadata(n.level,n.sn,n.stats.chunkCount,i.byteLength,m,v),b=this.initPTS[n.cc];g.push(i,f,p,l,n,r,s.totalduration,u,y,b)}else this.warn("Dropping fragment "+n.sn+" of level "+n.level+" after level details were reset")}else this.warn("Levels were reset while fragment load was in progress. Fragment "+n.sn+" of level "+n.level+" will not be buffered")},S.onAudioTrackSwitching=function(t,e){var n=this.altAudio,r=!!e.url,i=e.id;if(!r){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var o=this.fragCurrent;null!=o&&o.loader&&(this.log("Switching to main audio track, cancel main fragment load"),o.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var s=this.hls;n&&s.trigger(a.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),s.trigger(a.Events.AUDIO_TRACK_SWITCHED,{id:i})}},S.onAudioTrackSwitched=function(t,e){var n=e.id,r=!!this.hls.audioTracks[n].url;if(r){var i=this.videoBuffer;i&&this.mediaBuffer!==i&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=i)}this.altAudio=r,this.tick()},S.onBufferCreated=function(t,e){var n,r,i=e.tracks,o=!1;for(var a in i){var s=i[a];if("main"===s.id){if(r=a,n=s,"video"===a){var l=i[a];l&&(this.videoBuffer=l.buffer)}}else o=!0}o&&n?(this.log("Alternate track found, use "+r+".buffered to schedule main fragment loading"),this.mediaBuffer=n.buffer):this.mediaBuffer=this.media},S.onFragBuffered=function(t,e){var n=e.frag,r=e.part;if(!n||n.type===c.PlaylistLevelType.MAIN){if(this.fragContextChanged(n))return this.warn("Fragment "+n.sn+(r?" p: "+r.index:"")+" of level "+n.level+" finished buffering, but was aborted. state: "+this.state),void(this.state===i.State.PARSED&&(this.state=i.State.IDLE));var o=r?r.stats:n.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),"initSegment"!==n.sn&&(this.fragPrevious=n),this.fragBufferedComplete(n,r)}},S.onError=function(t,e){switch(e.details){case p.ErrorDetails.FRAG_LOAD_ERROR:case p.ErrorDetails.FRAG_LOAD_TIMEOUT:case p.ErrorDetails.KEY_LOAD_ERROR:case p.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(c.PlaylistLevelType.MAIN,e);break;case p.ErrorDetails.LEVEL_LOAD_ERROR:case p.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==i.State.ERROR&&(e.fatal?(this.warn(""+e.details),this.state=i.State.ERROR):e.levelRetry||this.state!==i.State.WAITING_LEVEL||(this.state=i.State.IDLE));break;case p.ErrorDetails.BUFFER_FULL_ERROR:if("main"===e.parent&&(this.state===i.State.PARSING||this.state===i.State.PARSED)){var n=!0,r=this.getFwdBufferInfo(this.media,c.PlaylistLevelType.MAIN);r&&r.len>.5&&(n=!this.reduceMaxBufferLength(r.len)),n&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}}},S.checkBuffer=function(){var t=this.media,e=this.gapController;if(t&&e&&t.readyState){var n=s.BufferHelper.getBuffered(t);!this.loadedmetadata&&n.length?(this.loadedmetadata=!0,this.seekToStartPos()):e.poll(this.lastCurrentTime),this.lastCurrentTime=t.currentTime}},S.onFragLoadEmergencyAborted=function(){this.state=i.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},S.onBufferFlushed=function(t,e){var n=e.type;if(n!==u.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var r=(n===u.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(r,n,c.PlaylistLevelType.MAIN)}},S.onLevelsUpdated=function(t,e){this.levels=e.levels},S.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},S.seekToStartPos=function(){var t=this.media,e=t.currentTime,n=this.startPosition;if(n>=0&&e<n){if(t.seeking)return void g.logger.log("could not seek to "+n+", already seeking at "+e);var r=s.BufferHelper.getBuffered(t),i=(r.length?r.start(0):0)-n;i>0&&(i<this.config.maxBufferHole||i<this.config.maxFragLookUpTolerance)&&(g.logger.log("adjusting start position by "+i+" to match buffer start"),n+=i,this.startPosition=n),this.log("seek to target start position "+n+" from current time "+e),t.currentTime=n}},S._getAudioCodec=function(t){var e=this.config.defaultAudioCodec||t.audioCodec;return this.audioCodecSwap&&e&&(this.log("Swapping audio codec"),e=-1!==e.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),e},S._loadBitrateTestFrag=function(t){var e=this;this._doFragLoad(t).then((function(n){var r=e.hls;if(n&&!r.nextLoadLevel&&!e.fragContextChanged(t)){e.fragLoadError=0,e.state=i.State.IDLE,e.startFragRequested=!1,e.bitrateTest=!1;var o=t.stats;o.parsing.start=o.parsing.end=o.buffering.start=o.buffering.end=self.performance.now(),r.trigger(a.Events.FRAG_LOADED,n)}}))},S._handleTransmuxComplete=function(t){var e,n="main",o=this.hls,s=t.remuxResult,l=t.chunkMeta,c=this.getCurrentContext(l);if(!c)return this.warn("The loading context changed while buffering fragment "+l.sn+" of level "+l.level+". This chunk will not be buffered."),void this.resetLiveStartWhenNotLoaded(l.level);var h=c.frag,d=c.part,f=c.level,p=s.video,g=s.text,m=s.id3,v=s.initSegment,y=this.altAudio?void 0:s.audio;if(!this.fragContextChanged(h)){if(this.state=i.State.PARSING,v){v.tracks&&(this._bufferInitSegment(f,v.tracks,h,l),o.trigger(a.Events.FRAG_PARSING_INIT_SEGMENT,{frag:h,id:n,tracks:v.tracks}));var b=v.initPTS,x=v.timescale;Object(r.isFiniteNumber)(b)&&(this.initPTS[h.cc]=b,o.trigger(a.Events.INIT_PTS_FOUND,{frag:h,id:n,initPTS:b,timescale:x}))}if(p&&!1!==s.independent){if(f.details){var C=p.startPTS,S=p.endPTS,E=p.startDTS,k=p.endDTS;if(d)d.elementaryStreams[p.type]={startPTS:C,endPTS:S,startDTS:E,endDTS:k};else if(p.firstKeyFrame&&p.independent&&(this.couldBacktrack=!0),p.dropped&&p.independent){if(this.getLoadPosition()+this.config.maxBufferHole<C)return void this.backtrack(h);h.setElementaryStreamInfo(p.type,h.start,S,h.start,k,!0)}h.setElementaryStreamInfo(p.type,C,S,E,k),this.bufferFragmentData(p,h,d,l)}}else if(!1===s.independent)return void this.backtrack(h);if(y){var w=y.startPTS,T=y.endPTS,O=y.startDTS,L=y.endDTS;d&&(d.elementaryStreams[u.ElementaryStreamTypes.AUDIO]={startPTS:w,endPTS:T,startDTS:O,endDTS:L}),h.setElementaryStreamInfo(u.ElementaryStreamTypes.AUDIO,w,T,O,L),this.bufferFragmentData(y,h,d,l)}if(null!=m&&null!==(e=m.samples)&&void 0!==e&&e.length){var A={frag:h,id:n,samples:m.samples};o.trigger(a.Events.FRAG_PARSING_METADATA,A)}if(g){var D={frag:h,id:n,samples:g.samples};o.trigger(a.Events.FRAG_PARSING_USERDATA,D)}}},S._bufferInitSegment=function(t,e,n,r){var o=this;if(this.state===i.State.PARSING){this.audioOnly=!!e.audio&&!e.video,this.altAudio&&!this.audioOnly&&delete e.audio;var s=e.audio,l=e.video,c=e.audiovideo;if(s){var u=t.audioCodec,h=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(u&&(u=-1!==u.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),1!==s.metadata.channelCount&&-1===h.indexOf("firefox")&&(u="mp4a.40.5")),-1!==h.indexOf("android")&&"audio/mpeg"!==s.container&&(u="mp4a.40.2",this.log("Android: force audio codec to "+u)),t.audioCodec&&t.audioCodec!==u&&this.log('Swapping manifest audio codec "'+t.audioCodec+'" for "'+u+'"'),s.levelCodec=u,s.id="main",this.log("Init audio buffer, container:"+s.container+", codecs[selected/level/parsed]=["+(u||"")+"/"+(t.audioCodec||"")+"/"+s.codec+"]")}l&&(l.levelCodec=t.videoCodec,l.id="main",this.log("Init video buffer, container:"+l.container+", codecs[level/parsed]=["+(t.videoCodec||"")+"/"+l.codec+"]")),c&&this.log("Init audiovideo buffer, container:"+c.container+", codecs[level/parsed]=["+(t.attrs.CODECS||"")+"/"+c.codec+"]"),this.hls.trigger(a.Events.BUFFER_CODECS,e),Object.keys(e).forEach((function(t){var i=e[t].initSegment;null!=i&&i.byteLength&&o.hls.trigger(a.Events.BUFFER_APPENDING,{type:t,data:i,frag:n,part:null,chunkMeta:r,parent:n.type})})),this.tick()}},S.backtrack=function(t){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(t);var e=this.fragmentTracker.backtrack(t);this.fragPrevious=null,this.nextLoadPosition=t.start,e?this.resetFragmentLoading(t):this.state=i.State.BACKTRACKING},S.checkFragmentChanged=function(){var t=this.media,e=null;if(t&&t.readyState>1&&!1===t.seeking){var n=t.currentTime;if(s.BufferHelper.isBuffered(t,n)?e=this.getAppendedFrag(n):s.BufferHelper.isBuffered(t,n+.1)&&(e=this.getAppendedFrag(n+.1)),e){var r=this.fragPlaying,i=e.level;r&&e.sn===r.sn&&r.level===i&&e.urlId===r.urlId||(this.hls.trigger(a.Events.FRAG_CHANGED,{frag:e}),r&&r.level===i||this.hls.trigger(a.Events.LEVEL_SWITCHED,{level:i}),this.fragPlaying=e)}}},b=y,(x=[{key:"nextLevel",get:function(){var t=this.nextBufferedFrag;return t?t.level:-1}},{key:"currentLevel",get:function(){var t=this.media;if(t){var e=this.getAppendedFrag(t.currentTime);if(e)return e.level}return-1}},{key:"nextBufferedFrag",get:function(){var t=this.media;if(t){var e=this.getAppendedFrag(t.currentTime);return this.followingBufferedFrag(e)}return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}])&&m(b.prototype,x),C&&m(b,C),y}(i.default)},"./src/controller/subtitle-stream-controller.ts":
/*!******************************************************!*\
!*** ./src/controller/subtitle-stream-controller.ts ***!
\******************************************************/
/*! exports provided: SubtitleStreamController */function(t,e,n){"use strict";n.r(e),n.d(e,"SubtitleStreamController",(function(){return g}));var r=n(/*! ../events */"./src/events.ts"),i=n(/*! ../utils/logger */"./src/utils/logger.ts"),o=n(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),a=n(/*! ./fragment-finders */"./src/controller/fragment-finders.ts"),s=n(/*! ../utils/discontinuities */"./src/utils/discontinuities.ts"),l=n(/*! ./level-helper */"./src/controller/level-helper.ts"),c=n(/*! ./fragment-tracker */"./src/controller/fragment-tracker.ts"),u=n(/*! ./base-stream-controller */"./src/controller/base-stream-controller.ts"),h=n(/*! ../types/loader */"./src/types/loader.ts"),d=n(/*! ../types/level */"./src/types/level.ts");function f(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function p(t,e){return(p=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var g=function(t){var e,n;function g(e,n){var r;return(r=t.call(this,e,n,"[subtitle-stream-controller]")||this).levels=[],r.currentTrackId=-1,r.tracksBuffered=[],r.mainDetails=null,r._registerListeners(),r}n=t,(e=g).prototype=Object.create(n.prototype),e.prototype.constructor=e,p(e,n);var m,v,y,b=g.prototype;return b.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},b._registerListeners=function(){var t=this.hls;t.on(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(r.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.on(r.Events.ERROR,this.onError,this),t.on(r.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(r.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.on(r.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(r.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.on(r.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},b._unregisterListeners=function(){var t=this.hls;t.off(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(r.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.off(r.Events.ERROR,this.onError,this),t.off(r.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(r.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.off(r.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(r.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.off(r.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},b.startLoad=function(){this.stopLoad(),this.state=u.State.IDLE,this.setInterval(500),this.tick()},b.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},b.onLevelLoaded=function(t,e){this.mainDetails=e.details},b.onSubtitleFragProcessed=function(t,e){var n=e.frag,r=e.success;if(this.fragPrevious=n,this.state=u.State.IDLE,r){var i=this.tracksBuffered[this.currentTrackId];if(i){for(var o,a=n.start,s=0;s<i.length;s++)if(a>=i[s].start&&a<=i[s].end){o=i[s];break}var l=n.start+n.duration;o?o.end=l:(o={start:a,end:l},i.push(o)),this.fragmentTracker.fragBuffered(n)}}},b.onBufferFlushing=function(t,e){var n=e.startOffset,r=e.endOffset;if(0===n&&r!==Number.POSITIVE_INFINITY){var i=this.currentTrackId,o=this.levels;if(!o.length||!o[i]||!o[i].details)return;var a=r-o[i].details.targetduration;if(a<=0)return;e.endOffsetSubtitles=Math.max(0,a),this.tracksBuffered.forEach((function(t){for(var e=0;e<t.length;)if(t[e].end<=a)t.shift();else{if(!(t[e].start<a))break;t[e].start=a,e++}})),this.fragmentTracker.removeFragmentsInRange(n,a,h.PlaylistLevelType.SUBTITLE)}},b.onError=function(t,e){var n,r=e.frag;r&&r.type===h.PlaylistLevelType.SUBTITLE&&(null!==(n=this.fragCurrent)&&void 0!==n&&n.loader&&this.fragCurrent.loader.abort(),this.state=u.State.IDLE)},b.onSubtitleTracksUpdated=function(t,e){var n=this,r=e.subtitleTracks;this.tracksBuffered=[],this.levels=r.map((function(t){return new d.Level(t)})),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach((function(t){n.tracksBuffered[t.id]=[]})),this.mediaBuffer=null},b.onSubtitleTrackSwitch=function(t,e){if(this.currentTrackId=e.id,this.levels.length&&-1!==this.currentTrackId){var n=this.levels[this.currentTrackId];null!=n&&n.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,n&&this.setInterval(500)}else this.clearInterval()},b.onSubtitleTrackLoaded=function(t,e){var n,r=e.details,i=e.id,o=this.currentTrackId,c=this.levels;if(c.length){var h=c[o];if(!(i>=c.length||i!==o)&&h){if(this.mediaBuffer=this.mediaBufferTimeRanges,r.live||null!==(n=h.details)&&void 0!==n&&n.live){var d=this.mainDetails;if(r.deltaUpdateFailed||!d)return;var f=d.fragments[0];h.details?0===this.alignPlaylists(r,h.details)&&f&&Object(l.addSliding)(r,f.start):r.hasProgramDateTime&&d.hasProgramDateTime?Object(s.alignMediaPlaylistByPDT)(r,d):f&&Object(l.addSliding)(r,f.start)}h.details=r,this.levelLastLoaded=i,this.tick(),r.live&&!this.fragCurrent&&this.media&&this.state===u.State.IDLE&&(Object(a.findFragmentByPTS)(null,r.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),h.details=void 0))}}},b._handleFragmentLoadComplete=function(t){var e=t.frag,n=t.payload,i=e.decryptdata,o=this.hls;if(!this.fragContextChanged(e)&&n&&n.byteLength>0&&i&&i.key&&i.iv&&"AES-128"===i.method){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(n),i.key.buffer,i.iv.buffer).then((function(t){var n=performance.now();o.trigger(r.Events.FRAG_DECRYPTED,{frag:e,payload:t,stats:{tstart:a,tdecrypt:n}})}))}},b.doTick=function(){if(this.media){if(this.state===u.State.IDLE){var t,e=this.currentTrackId,n=this.levels;if(!n.length||!n[e]||!n[e].details)return;var s=n[e].details,l=s.targetduration,h=this.config,d=this.media,f=o.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,d.currentTime-l,h.maxBufferHole),p=f.end;if(f.len>this.getMaxBufferLength()+l)return;console.assert(s,"Subtitle track details are defined on idle subtitle stream controller tick");var g,m=s.fragments,v=m.length,y=s.edge,b=this.fragPrevious;if(p<y){var x=h.maxFragLookUpTolerance;b&&s.hasProgramDateTime&&(g=Object(a.findFragmentByPDT)(m,b.endProgramDateTime,x)),g||!(g=Object(a.findFragmentByPTS)(b,m,p,x))&&b&&b.start<m[0].start&&(g=m[0])}else g=m[v-1];null!==(t=g)&&void 0!==t&&t.encrypted?(i.logger.log("Loading key for "+g.sn),this.state=u.State.KEY_LOADING,this.hls.trigger(r.Events.KEY_LOADING,{frag:g})):g&&this.fragmentTracker.getState(g)===c.FragmentState.NOT_LOADED&&this.loadFragment(g,s,p)}}else this.state=u.State.IDLE},b.loadFragment=function(e,n,r){this.fragCurrent=e,t.prototype.loadFragment.call(this,e,n,r)},m=g,(v=[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}])&&f(m.prototype,v),y&&f(m,y),g}(u.default)},"./src/controller/subtitle-track-controller.ts":
/*!*****************************************************!*\
!*** ./src/controller/subtitle-track-controller.ts ***!
\*****************************************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e);var r=n(/*! ../events */"./src/events.ts"),i=n(/*! ../utils/texttrack-utils */"./src/utils/texttrack-utils.ts"),o=n(/*! ./base-playlist-controller */"./src/controller/base-playlist-controller.ts"),a=n(/*! ../types/loader */"./src/types/loader.ts");function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var c=function(t){var e,n;function o(e){var n;return(n=t.call(this,e,"[subtitle-track-controller]")||this).media=null,n.tracks=[],n.groupId=null,n.tracksInGroup=[],n.trackId=-1,n.selectDefaultTrack=!0,n.queuedDefaultTrack=-1,n.trackChangeListener=function(){return n.onTextTracksChanged()},n.asyncPollTrackChange=function(){return n.pollTrackChange(0)},n.useTextTrackPolling=!1,n.subtitlePollingInterval=-1,n.subtitleDisplay=!0,n.registerListeners(),n}n=t,(e=o).prototype=Object.create(n.prototype),e.prototype.constructor=e,l(e,n);var c,h,d,f=o.prototype;return f.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,t.prototype.destroy.call(this)},f.registerListeners=function(){var t=this.hls;t.on(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.on(r.Events.LEVEL_LOADING,this.onLevelLoading,this),t.on(r.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(r.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(r.Events.ERROR,this.onError,this)},f.unregisterListeners=function(){var t=this.hls;t.off(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.off(r.Events.LEVEL_LOADING,this.onLevelLoading,this),t.off(r.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(r.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(r.Events.ERROR,this.onError,this)},f.onMediaAttached=function(t,e){this.media=e.media,this.media&&(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))},f.pollTrackChange=function(t){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,t)},f.onMediaDetaching=function(){this.media&&(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),u(this.media.textTracks).forEach((function(t){Object(i.clearCurrentCues)(t)})),this.subtitleTrack=-1,this.media=null)},f.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},f.onManifestParsed=function(t,e){this.tracks=e.subtitleTracks},f.onSubtitleTrackLoaded=function(t,e){var n=e.id,r=e.details,i=this.trackId,o=this.tracksInGroup[i];if(o){var a=o.details;o.details=e.details,this.log("subtitle track "+n+" loaded ["+r.startSN+"-"+r.endSN+"]"),n===this.trackId&&(this.retryCount=0,this.playlistLoaded(n,e,a))}else this.warn("Invalid subtitle track id "+n)},f.onLevelLoading=function(t,e){this.switchLevel(e.level)},f.onLevelSwitching=function(t,e){this.switchLevel(e.level)},f.switchLevel=function(t){var e=this.hls.levels[t];if(null!=e&&e.textGroupIds){var n=e.textGroupIds[e.urlId];if(this.groupId!==n){var i=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,o=this.tracks.filter((function(t){return!n||t.groupId===n}));this.tracksInGroup=o;var a=this.findTrackId(null==i?void 0:i.name)||this.findTrackId();this.groupId=n;var s={subtitleTracks:o};this.log("Updating subtitle tracks, "+o.length+' track(s) found in "'+n+'" group-id'),this.hls.trigger(r.Events.SUBTITLE_TRACKS_UPDATED,s),-1!==a&&this.setSubtitleTrack(a,i)}}},f.findTrackId=function(t){for(var e=this.tracksInGroup,n=0;n<e.length;n++){var r=e[n];if((!this.selectDefaultTrack||r.default)&&(!t||t===r.name))return r.id}return-1},f.onError=function(e,n){t.prototype.onError.call(this,e,n),!n.fatal&&n.context&&n.context.type===a.PlaylistContextType.SUBTITLE_TRACK&&n.context.id===this.trackId&&n.context.groupId===this.groupId&&this.retryLoadingOrFail(n)},f.loadPlaylist=function(t){var e=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(e)){var n=e.id,i=e.groupId,o=e.url;if(t)try{o=t.addDirectives(o)}catch(t){this.warn("Could not construct new URL with HLS Delivery Directives: "+t)}this.log("Loading subtitle playlist for id "+n),this.hls.trigger(r.Events.SUBTITLE_TRACK_LOADING,{url:o,id:n,groupId:i,deliveryDirectives:t||null})}},f.toggleTrackModes=function(t){var e=this,n=this.media,r=this.subtitleDisplay,i=this.trackId;if(n){var o=u(n.textTracks),a=o.filter((function(t){return t.groupId===e.groupId}));if(-1===t)[].slice.call(o).forEach((function(t){t.mode="disabled"}));else{var s=a[i];s&&(s.mode="disabled")}var l=a[t];l&&(l.mode=r?"showing":"hidden")}},f.setSubtitleTrack=function(t,e){var n,i=this.tracksInGroup;if(this.media){if(this.trackId!==t&&this.toggleTrackModes(t),!(this.trackId===t&&(-1===t||null!==(n=i[t])&&void 0!==n&&n.details)||t<-1||t>=i.length)){this.clearTimer();var o=i[t];if(this.log("Switching to subtitle track "+t),this.trackId=t,o){var a=o.id,s=o.groupId,l=void 0===s?"":s,c=o.name,u=o.type,h=o.url;this.hls.trigger(r.Events.SUBTITLE_TRACK_SWITCH,{id:a,groupId:l,name:c,type:u,url:h});var d=this.switchParams(o.url,null==e?void 0:e.details);this.loadPlaylist(d)}else this.hls.trigger(r.Events.SUBTITLE_TRACK_SWITCH,{id:t})}}else this.queuedDefaultTrack=t},f.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),this.media&&this.hls.config.renderTextTracksNatively){for(var t=-1,e=u(this.media.textTracks),n=0;n<e.length;n++)if("hidden"===e[n].mode)t=n;else if("showing"===e[n].mode){t=n;break}this.subtitleTrack!==t&&(this.subtitleTrack=t)}},c=o,(h=[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(t){this.selectDefaultTrack=!1;var e=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(t,e)}}])&&s(c.prototype,h),d&&s(c,d),o}(o.default);function u(t){for(var e=[],n=0;n<t.length;n++){var r=t[n];"subtitles"===r.kind&&r.label&&e.push(t[n])}return e}e.default=c},"./src/controller/timeline-controller.ts":
/*!***********************************************!*\
!*** ./src/controller/timeline-controller.ts ***!
\***********************************************/
/*! exports provided: TimelineController */function(t,e,n){"use strict";n.r(e),n.d(e,"TimelineController",(function(){return d}));var r=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=n(/*! ../events */"./src/events.ts"),o=n(/*! ../utils/cea-608-parser */"./src/utils/cea-608-parser.ts"),a=n(/*! ../utils/output-filter */"./src/utils/output-filter.ts"),s=n(/*! ../utils/webvtt-parser */"./src/utils/webvtt-parser.ts"),l=n(/*! ../utils/texttrack-utils */"./src/utils/texttrack-utils.ts"),c=n(/*! ../utils/imsc1-ttml-parser */"./src/utils/imsc1-ttml-parser.ts"),u=n(/*! ../types/loader */"./src/types/loader.ts"),h=n(/*! ../utils/logger */"./src/utils/logger.ts"),d=function(){function t(t){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={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}},this.captionsProperties=void 0,this.hls=t,this.config=t.config,this.Cues=t.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 e=new a.default(this,"textTrack1"),n=new a.default(this,"textTrack2"),r=new a.default(this,"textTrack3"),s=new a.default(this,"textTrack4");this.cea608Parser1=new o.default(1,e,n),this.cea608Parser2=new o.default(3,r,s)}t.on(i.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(i.Events.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(i.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(i.Events.FRAG_LOADING,this.onFragLoading,this),t.on(i.Events.FRAG_LOADED,this.onFragLoaded,this),t.on(i.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.on(i.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),t.on(i.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(i.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.on(i.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var e=t.prototype;return e.destroy=function(){var t=this.hls;t.off(i.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(i.Events.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(i.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(i.Events.FRAG_LOADING,this.onFragLoading,this),t.off(i.Events.FRAG_LOADED,this.onFragLoaded,this),t.off(i.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.off(i.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),t.off(i.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(i.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.off(i.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},e.addCues=function(t,e,n,r,o){for(var a,s,l,c,u=!1,h=o.length;h--;){var d=o[h],f=(a=d[0],s=d[1],l=e,c=n,Math.min(s,c)-Math.max(a,l));if(f>=0&&(d[0]=Math.min(d[0],e),d[1]=Math.max(d[1],n),u=!0,f/(n-e)>.5))return}if(u||o.push([e,n]),this.config.renderTextTracksNatively){var p=this.captionsTracks[t];this.Cues.newCue(p,e,n,r)}else{var g=this.Cues.newCue(null,e,n,r);this.hls.trigger(i.Events.CUES_PARSED,{type:"captions",cues:g,track:t})}},e.onInitPtsFound=function(t,e){var n=this,r=e.frag,o=e.id,a=e.initPTS,s=e.timescale,l=this.unparsedVttFrags;"main"===o&&(this.initPTS[r.cc]=a,this.timescale[r.cc]=s),l.length&&(this.unparsedVttFrags=[],l.forEach((function(t){n.onFragLoaded(i.Events.FRAG_LOADED,t)})))},e.getExistingTrack=function(t){var e=this.media;if(e)for(var n=0;n<e.textTracks.length;n++){var r=e.textTracks[n];if(r[t])return r}return null},e.createCaptionsTrack=function(t){this.config.renderTextTracksNatively?this.createNativeTrack(t):this.createNonNativeTrack(t)},e.createNativeTrack=function(t){if(!this.captionsTracks[t]){var e=this.captionsProperties,n=this.captionsTracks,r=this.media,i=e[t],o=i.label,a=i.languageCode,s=this.getExistingTrack(t);if(s)n[t]=s,Object(l.clearCurrentCues)(n[t]),Object(l.sendAddTrackEvent)(n[t],r);else{var c=this.createTextTrack("captions",o,a);c&&(c[t]=!0,n[t]=c)}}},e.createNonNativeTrack=function(t){if(!this.nonNativeCaptionsTracks[t]){var e=this.captionsProperties[t];if(e){var n={_id:t,label:e.label,kind:"captions",default:!!e.media&&!!e.media.default,closedCaptions:e.media};this.nonNativeCaptionsTracks[t]=n,this.hls.trigger(i.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[n]})}}},e.createTextTrack=function(t,e,n){var r=this.media;if(r)return r.addTextTrack(t,e,n)},e.onMediaAttaching=function(t,e){this.media=e.media,this._cleanTracks()},e.onMediaDetaching=function(){var t=this.captionsTracks;Object.keys(t).forEach((function(e){Object(l.clearCurrentCues)(t[e]),delete t[e]})),this.nonNativeCaptionsTracks={}},e.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}},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())},e._cleanTracks=function(){var t=this.media;if(t){var e=t.textTracks;if(e)for(var n=0;n<e.length;n++)Object(l.clearCurrentCues)(e[n])}},e.onSubtitleTracksUpdated=function(t,e){var n=this;this.textTracks=[];var r=e.subtitleTracks||[],o=r.some((function(t){return t.textCodec===c.IMSC1_CODEC}));if(this.config.enableWebVTT||o&&this.config.enableIMSC1){var a=this.tracks&&r&&this.tracks.length===r.length;if(this.tracks=r||[],this.config.renderTextTracksNatively){var s=this.media?this.media.textTracks:[];this.tracks.forEach((function(t,e){var r;if(e<s.length){for(var i=null,o=0;o<s.length;o++)if(f(s[o],t)){i=s[o];break}i&&(r=i)}r?Object(l.clearCurrentCues)(r):(r=n.createTextTrack("subtitles",t.name,t.lang))&&(r.mode="disabled"),r&&(r.groupId=t.groupId,n.textTracks.push(r))}))}else if(!a&&this.tracks&&this.tracks.length){var u=this.tracks.map((function(t){return{label:t.name,kind:t.type.toLowerCase(),default:t.default,subtitleTrack:t}}));this.hls.trigger(i.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:u})}}},e.onManifestLoaded=function(t,e){var n=this;this.config.enableCEA708Captions&&e.captions&&e.captions.forEach((function(t){var e=/(?:CC|SERVICE)([1-4])/.exec(t.instreamId);if(e){var r="textTrack"+e[1],i=n.captionsProperties[r];i&&(i.label=t.name,t.lang&&(i.languageCode=t.lang),i.media=t)}}))},e.onFragLoading=function(t,e){var n=this.cea608Parser1,r=this.cea608Parser2,i=this.lastSn,o=this.lastPartIndex;if(this.enabled&&n&&r&&e.frag.type===u.PlaylistLevelType.MAIN){var a,s,l=e.frag.sn,c=null!=(a=null==e||null===(s=e.part)||void 0===s?void 0:s.index)?a:-1;l===i+1||l===i&&c===o+1||(n.reset(),r.reset()),this.lastSn=l,this.lastPartIndex=c}},e.onFragLoaded=function(t,e){var n=e.frag,o=e.payload,a=this.initPTS,s=this.unparsedVttFrags;if(n.type===u.PlaylistLevelType.SUBTITLE)if(o.byteLength){if(!Object(r.isFiniteNumber)(a[n.cc]))return s.push(e),void(a.length&&this.hls.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:new Error("Missing initial subtitle PTS")}));var l=n.decryptdata;if(null==l||null==l.key||"AES-128"!==l.method){var h=this.tracks[n.level],d=this.vttCCs;d[n.cc]||(d[n.cc]={start:n.start,prevCC:this.prevCC,new:!0},this.prevCC=n.cc),h&&h.textCodec===c.IMSC1_CODEC?this._parseIMSC1(n,o):this._parseVTTs(n,o,d)}}else this.hls.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:new Error("Empty subtitle payload")})},e._parseIMSC1=function(t,e){var n=this,r=this.hls;Object(c.parseIMSC1)(e,this.initPTS[t.cc],this.timescale[t.cc],(function(e){n._appendCues(e,t.level),r.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:t})}),(function(e){h.logger.log("Failed to parse IMSC1: "+e),r.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t,error:e})}))},e._parseVTTs=function(t,e,n){var r=this,o=this.hls;Object(s.parseWebVTT)(e,this.initPTS[t.cc],this.timescale[t.cc],n,t.cc,t.start,(function(e){r._appendCues(e,t.level),o.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:t})}),(function(n){r._fallbackToIMSC1(t,e),h.logger.log("Failed to parse VTT cue: "+n),o.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t,error:n})}))},e._fallbackToIMSC1=function(t,e){var n=this,r=this.tracks[t.level];r.textCodec||Object(c.parseIMSC1)(e,this.initPTS[t.cc],this.timescale[t.cc],(function(){r.textCodec=c.IMSC1_CODEC,n._parseIMSC1(t,e)}),(function(){r.textCodec="wvtt"}))},e._appendCues=function(t,e){var n=this.hls;if(this.config.renderTextTracksNatively){var r=this.textTracks[e];if("disabled"===r.mode)return;t.forEach((function(t){return Object(l.addCueToTrack)(r,t)}))}else{var o=this.tracks[e].default?"default":"subtitles"+e;n.trigger(i.Events.CUES_PARSED,{type:"subtitles",cues:t,track:o})}},e.onFragDecrypted=function(t,e){var n=e.frag;if(n.type===u.PlaylistLevelType.SUBTITLE){if(!Object(r.isFiniteNumber)(this.initPTS[n.cc]))return void this.unparsedVttFrags.push(e);this.onFragLoaded(i.Events.FRAG_LOADED,e)}},e.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},e.onFragParsingUserdata=function(t,e){var n=this.cea608Parser1,r=this.cea608Parser2;if(this.enabled&&n&&r)for(var i=0;i<e.samples.length;i++){var o=e.samples[i].bytes;if(o){var a=this.extractCea608Data(o);n.addData(e.samples[i].pts,a[0]),r.addData(e.samples[i].pts,a[1])}}},e.onBufferFlushing=function(t,e){var n=e.startOffset,r=e.endOffset,i=e.endOffsetSubtitles,o=e.type,a=this.media;if(a&&!(a.currentTime<r)){if(!o||"video"===o){var s=this.captionsTracks;Object.keys(s).forEach((function(t){return Object(l.removeCuesInRange)(s[t],n,r)}))}if(this.config.renderTextTracksNatively&&0===n&&void 0!==i){var c=this.textTracks;Object.keys(c).forEach((function(t){return Object(l.removeCuesInRange)(c[t],n,i)}))}}},e.extractCea608Data=function(t){for(var e=31&t[0],n=2,r=[[],[]],i=0;i<e;i++){var o=t[n++],a=127&t[n++],s=127&t[n++],l=3&o;0===a&&0===s||0!=(4&o)&&(0!==l&&1!==l||(r[l].push(a),r[l].push(s)))}return r},t}();function f(t,e){return t&&t.label===e.name&&!(t.textTrack1||t.textTrack2)}},"./src/crypt/aes-crypto.ts":
/*!*********************************!*\
!*** ./src/crypt/aes-crypto.ts ***!
\*********************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return r}));var r=function(){function t(t,e){this.subtle=void 0,this.aesIV=void 0,this.subtle=t,this.aesIV=e}return t.prototype.decrypt=function(t,e){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},e,t)},t}()},"./src/crypt/aes-decryptor.ts":
/*!************************************!*\
!*** ./src/crypt/aes-decryptor.ts ***!
\************************************/
/*! exports provided: removePadding, default */function(t,e,n){"use strict";n.r(e),n.d(e,"removePadding",(function(){return i})),n.d(e,"default",(function(){return o}));var r=n(/*! ../utils/typed-array */"./src/utils/typed-array.ts");function i(t){var e=t.byteLength,n=e&&new DataView(t.buffer).getUint8(e-1);return n?Object(r.sliceUint8)(t,0,e-n):t}var o=function(){function t(){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 e=t.prototype;return e.uint8ArrayToUint32Array_=function(t){for(var e=new DataView(t),n=new Uint32Array(4),r=0;r<4;r++)n[r]=e.getUint32(4*r);return n},e.initTable=function(){var t=this.sBox,e=this.invSBox,n=this.subMix,r=n[0],i=n[1],o=n[2],a=n[3],s=this.invSubMix,l=s[0],c=s[1],u=s[2],h=s[3],d=new Uint32Array(256),f=0,p=0,g=0;for(g=0;g<256;g++)d[g]=g<128?g<<1:g<<1^283;for(g=0;g<256;g++){var m=p^p<<1^p<<2^p<<3^p<<4;m=m>>>8^255&m^99,t[f]=m,e[m]=f;var v=d[f],y=d[v],b=d[y],x=257*d[m]^16843008*m;r[f]=x<<24|x>>>8,i[f]=x<<16|x>>>16,o[f]=x<<8|x>>>24,a[f]=x,x=16843009*b^65537*y^257*v^16843008*f,l[m]=x<<24|x>>>8,c[m]=x<<16|x>>>16,u[m]=x<<8|x>>>24,h[m]=x,f?(f=v^d[d[d[b^v]]],p^=d[d[p]]):f=p=1}},e.expandKey=function(t){for(var e=this.uint8ArrayToUint32Array_(t),n=!0,r=0;r<e.length&&n;)n=e[r]===this.key[r],r++;if(!n){this.key=e;var i=this.keySize=e.length;if(4!==i&&6!==i&&8!==i)throw new Error("Invalid aes key size="+i);var o,a,s,l,c=this.ksRows=4*(i+6+1),u=this.keySchedule=new Uint32Array(c),h=this.invKeySchedule=new Uint32Array(c),d=this.sBox,f=this.rcon,p=this.invSubMix,g=p[0],m=p[1],v=p[2],y=p[3];for(o=0;o<c;o++)o<i?s=u[o]=e[o]:(l=s,o%i==0?(l=d[(l=l<<8|l>>>24)>>>24]<<24|d[l>>>16&255]<<16|d[l>>>8&255]<<8|d[255&l],l^=f[o/i|0]<<24):i>6&&o%i==4&&(l=d[l>>>24]<<24|d[l>>>16&255]<<16|d[l>>>8&255]<<8|d[255&l]),u[o]=s=(u[o-i]^l)>>>0);for(a=0;a<c;a++)o=c-a,l=3&a?u[o]:u[o-4],h[a]=a<4||o<=4?l:g[d[l>>>24]]^m[d[l>>>16&255]]^v[d[l>>>8&255]]^y[d[255&l]],h[a]=h[a]>>>0}},e.networkToHostOrderSwap=function(t){return t<<24|(65280&t)<<8|(16711680&t)>>8|t>>>24},e.decrypt=function(t,e,n){for(var r,i,o,a,s,l,c,u,h,d,f,p,g,m,v=this.keySize+6,y=this.invKeySchedule,b=this.invSBox,x=this.invSubMix,C=x[0],S=x[1],E=x[2],k=x[3],w=this.uint8ArrayToUint32Array_(n),T=w[0],O=w[1],L=w[2],A=w[3],D=new Int32Array(t),R=new Int32Array(D.length),M=this.networkToHostOrderSwap;e<D.length;){for(h=M(D[e]),d=M(D[e+1]),f=M(D[e+2]),p=M(D[e+3]),s=h^y[0],l=p^y[1],c=f^y[2],u=d^y[3],g=4,m=1;m<v;m++)r=C[s>>>24]^S[l>>16&255]^E[c>>8&255]^k[255&u]^y[g],i=C[l>>>24]^S[c>>16&255]^E[u>>8&255]^k[255&s]^y[g+1],o=C[c>>>24]^S[u>>16&255]^E[s>>8&255]^k[255&l]^y[g+2],a=C[u>>>24]^S[s>>16&255]^E[l>>8&255]^k[255&c]^y[g+3],s=r,l=i,c=o,u=a,g+=4;r=b[s>>>24]<<24^b[l>>16&255]<<16^b[c>>8&255]<<8^b[255&u]^y[g],i=b[l>>>24]<<24^b[c>>16&255]<<16^b[u>>8&255]<<8^b[255&s]^y[g+1],o=b[c>>>24]<<24^b[u>>16&255]<<16^b[s>>8&255]<<8^b[255&l]^y[g+2],a=b[u>>>24]<<24^b[s>>16&255]<<16^b[l>>8&255]<<8^b[255&c]^y[g+3],R[e]=M(r^T),R[e+1]=M(a^O),R[e+2]=M(o^L),R[e+3]=M(i^A),T=h,O=d,L=f,A=p,e+=4}return R.buffer},t}()},"./src/crypt/decrypter.ts":
/*!********************************!*\
!*** ./src/crypt/decrypter.ts ***!
\********************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return c}));var r=n(/*! ./aes-crypto */"./src/crypt/aes-crypto.ts"),i=n(/*! ./fast-aes-key */"./src/crypt/fast-aes-key.ts"),o=n(/*! ./aes-decryptor */"./src/crypt/aes-decryptor.ts"),a=n(/*! ../utils/logger */"./src/utils/logger.ts"),s=n(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),l=n(/*! ../utils/typed-array */"./src/utils/typed-array.ts"),c=function(){function t(t,e,n){var r=(void 0===n?{}:n).removePKCS7Padding,i=void 0===r||r;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=t,this.config=e,this.removePKCS7Padding=i,i)try{var o=self.crypto;o&&(this.subtle=o.subtle||o.webkitSubtle)}catch(t){}null===this.subtle&&(this.config.enableSoftwareAES=!0)}var e=t.prototype;return e.destroy=function(){this.observer=null},e.isSync=function(){return this.config.enableSoftwareAES},e.flush=function(){var t=this.currentResult;if(t){var e=new Uint8Array(t);return this.reset(),this.removePKCS7Padding?Object(o.removePadding)(e):e}this.reset()},e.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},e.decrypt=function(t,e,n,r){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(t),e,n);var i=this.flush();i&&r(i.buffer)}else this.webCryptoDecrypt(new Uint8Array(t),e,n).then(r)},e.softwareDecrypt=function(t,e,n){var r=this.currentIV,i=this.currentResult,a=this.remainderData;this.logOnce("JS AES decrypt"),a&&(t=Object(s.appendUint8Array)(a,t),this.remainderData=null);var c=this.getValidChunk(t);if(!c.length)return null;r&&(n=r);var u=this.softwareDecrypter;u||(u=this.softwareDecrypter=new o.default),u.expandKey(e);var h=i;return this.currentResult=u.decrypt(c.buffer,0,n),this.currentIV=Object(l.sliceUint8)(c,-16).buffer,h||null},e.webCryptoDecrypt=function(t,e,n){var o=this,a=this.subtle;return this.key===e&&this.fastAesKey||(this.key=e,this.fastAesKey=new i.default(a,e)),this.fastAesKey.expandKey().then((function(e){return a?new r.default(a,n).decrypt(t.buffer,e):Promise.reject(new Error("web crypto not initialized"))})).catch((function(r){return o.onWebCryptoError(r,t,e,n)}))},e.onWebCryptoError=function(t,e,n,r){return a.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",t),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(e,n,r)},e.getValidChunk=function(t){var e=t,n=t.length-t.length%16;return n!==t.length&&(e=Object(l.sliceUint8)(t,0,n),this.remainderData=Object(l.sliceUint8)(t,n)),e},e.logOnce=function(t){this.logEnabled&&(a.logger.log("[decrypter.ts]: "+t),this.logEnabled=!1)},t}()},"./src/crypt/fast-aes-key.ts":
/*!***********************************!*\
!*** ./src/crypt/fast-aes-key.ts ***!
\***********************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return r}));var r=function(){function t(t,e){this.subtle=void 0,this.key=void 0,this.subtle=t,this.key=e}return t.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},t}()},"./src/demux/aacdemuxer.ts":
/*!*********************************!*\
!*** ./src/demux/aacdemuxer.ts ***!
\*********************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e);var r=n(/*! ./base-audio-demuxer */"./src/demux/base-audio-demuxer.ts"),i=n(/*! ./adts */"./src/demux/adts.ts"),o=n(/*! ../utils/logger */"./src/utils/logger.ts"),a=n(/*! ../demux/id3 */"./src/demux/id3.ts");function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var l=function(t){var e,n;function r(e,n){var r;return(r=t.call(this)||this).observer=void 0,r.config=void 0,r.observer=e,r.config=n,r}n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,s(e,n);var l=r.prototype;return l.resetInitSegment=function(e,n,r){t.prototype.resetInitSegment.call(this,e,n,r),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:e,duration:r,inputTimeScale:9e4,dropped:0}},r.probe=function(t){if(!t)return!1;for(var e=(a.getID3Data(t,0)||[]).length,n=t.length;e<n;e++)if(i.probe(t,e))return o.logger.log("ADTS sync word found !"),!0;return!1},l.canParse=function(t,e){return i.canParse(t,e)},l.appendFrame=function(t,e,n){i.initTrackConfig(t,this.observer,e,n,t.manifestCodec);var r=i.appendFrame(t,e,n,this.initPTS,this.frameIndex);if(r&&0===r.missing)return r},r}(r.default);l.minProbeByteLength=9,e.default=l},"./src/demux/adts.ts":
/*!***************************!*\
!*** ./src/demux/adts.ts ***!
\***************************/
/*! exports provided: getAudioConfig, isHeaderPattern, getHeaderLength, getFullFrameLength, canGetFrameLength, isHeader, canParse, probe, initTrackConfig, getFrameDuration, parseFrameHeader, appendFrame */function(t,e,n){"use strict";n.r(e),n.d(e,"getAudioConfig",(function(){return a})),n.d(e,"isHeaderPattern",(function(){return s})),n.d(e,"getHeaderLength",(function(){return l})),n.d(e,"getFullFrameLength",(function(){return c})),n.d(e,"canGetFrameLength",(function(){return u})),n.d(e,"isHeader",(function(){return h})),n.d(e,"canParse",(function(){return d})),n.d(e,"probe",(function(){return f})),n.d(e,"initTrackConfig",(function(){return p})),n.d(e,"getFrameDuration",(function(){return g})),n.d(e,"parseFrameHeader",(function(){return m})),n.d(e,"appendFrame",(function(){return v}));var r=n(/*! ../utils/logger */"./src/utils/logger.ts"),i=n(/*! ../errors */"./src/errors.ts"),o=n(/*! ../events */"./src/events.ts");function a(t,e,n,a){var s,l,c,u,h=navigator.userAgent.toLowerCase(),d=a,f=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];s=1+((192&e[n+2])>>>6);var p=(60&e[n+2])>>>2;if(!(p>f.length-1))return c=(1&e[n+2])<<2,c|=(192&e[n+3])>>>6,r.logger.log("manifest codec:"+a+", ADTS type:"+s+", samplingIndex:"+p),/firefox/i.test(h)?p>=6?(s=5,u=new Array(4),l=p-3):(s=2,u=new Array(2),l=p):-1!==h.indexOf("android")?(s=2,u=new Array(2),l=p):(s=5,u=new Array(4),a&&(-1!==a.indexOf("mp4a.40.29")||-1!==a.indexOf("mp4a.40.5"))||!a&&p>=6?l=p-3:((a&&-1!==a.indexOf("mp4a.40.2")&&(p>=6&&1===c||/vivaldi/i.test(h))||!a&&1===c)&&(s=2,u=new Array(2)),l=p)),u[0]=s<<3,u[0]|=(14&p)>>1,u[1]|=(1&p)<<7,u[1]|=c<<3,5===s&&(u[1]|=(14&l)>>1,u[2]=(1&l)<<7,u[2]|=8,u[3]=0),{config:u,samplerate:f[p],channelCount:c,codec:"mp4a.40."+s,manifestCodec:d};t.trigger(o.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+p})}function s(t,e){return 255===t[e]&&240==(246&t[e+1])}function l(t,e){return 1&t[e+1]?7:9}function c(t,e){return(3&t[e+3])<<11|t[e+4]<<3|(224&t[e+5])>>>5}function u(t,e){return e+5<t.length}function h(t,e){return e+1<t.length&&s(t,e)}function d(t,e){return u(t,e)&&s(t,e)&&c(t,e)<=t.length-e}function f(t,e){if(h(t,e)){var n=l(t,e);if(e+n>=t.length)return!1;var r=c(t,e);if(r<=n)return!1;var i=e+r;return i===t.length||h(t,i)}return!1}function p(t,e,n,i,o){if(!t.samplerate){var s=a(e,n,i,o);if(!s)return;t.config=s.config,t.samplerate=s.samplerate,t.channelCount=s.channelCount,t.codec=s.codec,t.manifestCodec=s.manifestCodec,r.logger.log("parsed codec:"+t.codec+", rate:"+s.samplerate+", channels:"+s.channelCount)}}function g(t){return 9216e4/t}function m(t,e,n,r,i){var o=l(t,e),a=c(t,e);if((a-=o)>0)return{headerLength:o,frameLength:a,stamp:n+r*i}}function v(t,e,n,r,i){var o=m(e,n,r,i,g(t.samplerate));if(o){var a,s=o.frameLength,l=o.headerLength,c=o.stamp,u=l+s,h=Math.max(0,n+u-e.length);h?(a=new Uint8Array(u-l)).set(e.subarray(n+l,e.length),0):a=e.subarray(n+l,n+u);var d={unit:a,pts:c};return h||t.samples.push(d),{sample:d,length:u,missing:h}}}},"./src/demux/base-audio-demuxer.ts":
/*!*****************************************!*\
!*** ./src/demux/base-audio-demuxer.ts ***!
\*****************************************/
/*! exports provided: initPTSFn, default */function(t,e,n){"use strict";n.r(e),n.d(e,"initPTSFn",(function(){return c}));var r=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=n(/*! ../demux/id3 */"./src/demux/id3.ts"),o=n(/*! ./dummy-demuxed-track */"./src/demux/dummy-demuxed-track.ts"),a=n(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),s=n(/*! ../utils/typed-array */"./src/utils/typed-array.ts"),l=function(){function t(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var e=t.prototype;return e.resetInitSegment=function(t,e,n){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},e.resetTimeStamp=function(){},e.resetContiguity=function(){},e.canParse=function(t,e){return!1},e.appendFrame=function(t,e,n){},e.demux=function(t,e){this.cachedData&&(t=Object(a.appendUint8Array)(this.cachedData,t),this.cachedData=null);var n,r,l=i.getID3Data(t,0),u=l?l.length:0,h=this._audioTrack,d=this._id3Track,f=l?i.getTimeStamp(l):void 0,p=t.length;for(0!==this.frameIndex&&null!==this.initPTS||(this.initPTS=c(f,e)),l&&l.length>0&&d.samples.push({pts:this.initPTS,dts:this.initPTS,data:l}),r=this.initPTS;u<p;){if(this.canParse(t,u)){var g=this.appendFrame(h,t,u);g?(this.frameIndex++,r=g.sample.pts,n=u+=g.length):u=p}else i.canParse(t,u)?(l=i.getID3Data(t,u),d.samples.push({pts:r,dts:r,data:l}),n=u+=l.length):u++;if(u===p&&n!==p){var m=Object(s.sliceUint8)(t,n);this.cachedData?this.cachedData=Object(a.appendUint8Array)(this.cachedData,m):this.cachedData=m}}return{audioTrack:h,avcTrack:Object(o.dummyTrack)(),id3Track:d,textTrack:Object(o.dummyTrack)()}},e.demuxSampleAes=function(t,e,n){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},e.flush=function(t){var e=this.cachedData;return e&&(this.cachedData=null,this.demux(e,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(o.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(o.dummyTrack)()}},e.destroy=function(){},t}(),c=function(t,e){return Object(r.isFiniteNumber)(t)?90*t:9e4*e};e.default=l},"./src/demux/chunk-cache.ts":
/*!**********************************!*\
!*** ./src/demux/chunk-cache.ts ***!
\**********************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return r}));var r=function(){function t(){this.chunks=[],this.dataLength=0}var e=t.prototype;return e.push=function(t){this.chunks.push(t),this.dataLength+=t.length},e.flush=function(){var t,e=this.chunks,n=this.dataLength;return e.length?(t=1===e.length?e[0]:function(t,e){for(var n=new Uint8Array(e),r=0,i=0;i<t.length;i++){var o=t[i];n.set(o,r),r+=o.length}return n}(e,n),this.reset(),t):new Uint8Array(0)},e.reset=function(){this.chunks.length=0,this.dataLength=0},t}()},"./src/demux/dummy-demuxed-track.ts":
/*!******************************************!*\
!*** ./src/demux/dummy-demuxed-track.ts ***!
\******************************************/
/*! exports provided: dummyTrack */function(t,e,n){"use strict";function r(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}n.r(e),n.d(e,"dummyTrack",(function(){return r}))},"./src/demux/exp-golomb.ts":
/*!*********************************!*\
!*** ./src/demux/exp-golomb.ts ***!
\*********************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e);var r=n(/*! ../utils/logger */"./src/utils/logger.ts"),i=function(){function t(t){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=t,this.bytesAvailable=t.byteLength,this.word=0,this.bitsAvailable=0}var e=t.prototype;return e.loadWord=function(){var t=this.data,e=this.bytesAvailable,n=t.byteLength-e,r=new Uint8Array(4),i=Math.min(4,e);if(0===i)throw new Error("no bytes available");r.set(t.subarray(n,n+i)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=8*i,this.bytesAvailable-=i},e.skipBits=function(t){var e;this.bitsAvailable>t?(this.word<<=t,this.bitsAvailable-=t):(t-=this.bitsAvailable,t-=(e=t>>3)>>3,this.bytesAvailable-=e,this.loadWord(),this.word<<=t,this.bitsAvailable-=t)},e.readBits=function(t){var e=Math.min(this.bitsAvailable,t),n=this.word>>>32-e;return t>32&&r.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=e,this.bitsAvailable>0?this.word<<=e:this.bytesAvailable>0&&this.loadWord(),(e=t-e)>0&&this.bitsAvailable?n<<e|this.readBits(e):n},e.skipLZ=function(){var t;for(t=0;t<this.bitsAvailable;++t)if(0!=(this.word&2147483648>>>t))return this.word<<=t,this.bitsAvailable-=t,t;return this.loadWord(),t+this.skipLZ()},e.skipUEG=function(){this.skipBits(1+this.skipLZ())},e.skipEG=function(){this.skipBits(1+this.skipLZ())},e.readUEG=function(){var t=this.skipLZ();return this.readBits(t+1)-1},e.readEG=function(){var t=this.readUEG();return 1&t?1+t>>>1:-1*(t>>>1)},e.readBoolean=function(){return 1===this.readBits(1)},e.readUByte=function(){return this.readBits(8)},e.readUShort=function(){return this.readBits(16)},e.readUInt=function(){return this.readBits(32)},e.skipScalingList=function(t){for(var e=8,n=8,r=0;r<t;r++)0!==n&&(n=(e+this.readEG()+256)%256),e=0===n?e:n},e.readSPS=function(){var t,e,n,r=0,i=0,o=0,a=0,s=this.readUByte.bind(this),l=this.readBits.bind(this),c=this.readUEG.bind(this),u=this.readBoolean.bind(this),h=this.skipBits.bind(this),d=this.skipEG.bind(this),f=this.skipUEG.bind(this),p=this.skipScalingList.bind(this);s();var g=s();if(l(5),h(3),s(),f(),100===g||110===g||122===g||244===g||44===g||83===g||86===g||118===g||128===g){var m=c();if(3===m&&h(1),f(),f(),h(1),u())for(e=3!==m?8:12,n=0;n<e;n++)u()&&p(n<6?16:64)}f();var v=c();if(0===v)c();else if(1===v)for(h(1),d(),d(),t=c(),n=0;n<t;n++)d();f(),h(1);var y=c(),b=c(),x=l(1);0===x&&h(1),h(1),u()&&(r=c(),i=c(),o=c(),a=c());var C=[1,1];if(u()&&u())switch(s()){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=[s()<<8|s(),s()<<8|s()]}return{width:Math.ceil(16*(y+1)-2*r-2*i),height:(2-x)*(b+1)*16-(x?2:4)*(o+a),pixelRatio:C}},e.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},t}();e.default=i},"./src/demux/id3.ts":
/*!**************************!*\
!*** ./src/demux/id3.ts ***!
\**************************/
/*! exports provided: isHeader, isFooter, getID3Data, canParse, getTimeStamp, isTimeStampFrame, getID3Frames, decodeFrame, utf8ArrayToStr, testables */function(t,e,n){"use strict";n.r(e),n.d(e,"isHeader",(function(){return i})),n.d(e,"isFooter",(function(){return o})),n.d(e,"getID3Data",(function(){return a})),n.d(e,"canParse",(function(){return l})),n.d(e,"getTimeStamp",(function(){return c})),n.d(e,"isTimeStampFrame",(function(){return u})),n.d(e,"getID3Frames",(function(){return d})),n.d(e,"decodeFrame",(function(){return f})),n.d(e,"utf8ArrayToStr",(function(){return y})),n.d(e,"testables",(function(){return b}));var r,i=function(t,e){return e+10<=t.length&&73===t[e]&&68===t[e+1]&&51===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128},o=function(t,e){return e+10<=t.length&&51===t[e]&&68===t[e+1]&&73===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128},a=function(t,e){for(var n=e,r=0;i(t,e);)r+=10,r+=s(t,e+6),o(t,e+10)&&(r+=10),e+=r;if(r>0)return t.subarray(n,n+r)},s=function(t,e){var n=0;return n=(127&t[e])<<21,n|=(127&t[e+1])<<14,n|=(127&t[e+2])<<7,n|=127&t[e+3]},l=function(t,e){return i(t,e)&&s(t,e+6)+10<=t.length-e},c=function(t){for(var e=d(t),n=0;n<e.length;n++){var r=e[n];if(u(r))return v(r)}},u=function(t){return t&&"PRIV"===t.key&&"com.apple.streaming.transportStreamTimestamp"===t.info},h=function(t){var e=String.fromCharCode(t[0],t[1],t[2],t[3]),n=s(t,4);return{type:e,size:n,data:t.subarray(10,10+n)}},d=function(t){for(var e=0,n=[];i(t,e);){for(var r=s(t,e+6),a=(e+=10)+r;e+8<a;){var l=h(t.subarray(e)),c=f(l);c&&n.push(c),e+=l.size+10}o(t,e)&&(e+=10)}return n},f=function(t){return"PRIV"===t.type?p(t):"W"===t.type[0]?m(t):g(t)},p=function(t){if(!(t.size<2)){var e=y(t.data,!0),n=new Uint8Array(t.data.subarray(e.length+1));return{key:t.type,info:e,data:n.buffer}}},g=function(t){if(!(t.size<2)){if("TXXX"===t.type){var e=1,n=y(t.data.subarray(e),!0);e+=n.length+1;var r=y(t.data.subarray(e));return{key:t.type,info:n,data:r}}var i=y(t.data.subarray(1));return{key:t.type,data:i}}},m=function(t){if("WXXX"===t.type){if(t.size<2)return;var e=1,n=y(t.data.subarray(e),!0);e+=n.length+1;var r=y(t.data.subarray(e));return{key:t.type,info:n,data:r}}var i=y(t.data);return{key:t.type,data:i}},v=function(t){if(8===t.data.byteLength){var e=new Uint8Array(t.data),n=1&e[3],r=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return r/=45,n&&(r+=47721858.84),Math.round(r)}},y=function(t,e){void 0===e&&(e=!1);var n=x();if(n){var r=n.decode(t);if(e){var i=r.indexOf("\0");return-1!==i?r.substring(0,i):r}return r.replace(/\0/g,"")}for(var o,a,s,l=t.length,c="",u=0;u<l;){if(0===(o=t[u++])&&e)return c;if(0!==o&&3!==o)switch(o>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:c+=String.fromCharCode(o);break;case 12:case 13:a=t[u++],c+=String.fromCharCode((31&o)<<6|63&a);break;case 14:a=t[u++],s=t[u++],c+=String.fromCharCode((15&o)<<12|(63&a)<<6|(63&s)<<0)}}return c},b={decodeTextFrame:g};function x(){return r||void 0===self.TextDecoder||(r=new self.TextDecoder("utf-8")),r}},"./src/demux/mp3demuxer.ts":
/*!*********************************!*\
!*** ./src/demux/mp3demuxer.ts ***!
\*********************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e);var r=n(/*! ./base-audio-demuxer */"./src/demux/base-audio-demuxer.ts"),i=n(/*! ../demux/id3 */"./src/demux/id3.ts"),o=n(/*! ../utils/logger */"./src/utils/logger.ts"),a=n(/*! ./mpegaudio */"./src/demux/mpegaudio.ts");function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var l=function(t){var e,n;function r(){return t.apply(this,arguments)||this}n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,s(e,n);var l=r.prototype;return l.resetInitSegment=function(e,n,r){t.prototype.resetInitSegment.call(this,e,n,r),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:e,duration:r,inputTimeScale:9e4,dropped:0}},r.probe=function(t){if(!t)return!1;for(var e=(i.getID3Data(t,0)||[]).length,n=t.length;e<n;e++)if(a.probe(t,e))return o.logger.log("MPEG Audio sync word found !"),!0;return!1},l.canParse=function(t,e){return a.canParse(t,e)},l.appendFrame=function(t,e,n){if(null!==this.initPTS)return a.appendFrame(t,e,n,this.initPTS,this.frameIndex)},r}(r.default);l.minProbeByteLength=4,e.default=l},"./src/demux/mp4demuxer.ts":
/*!*********************************!*\
!*** ./src/demux/mp4demuxer.ts ***!
\*********************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e);var r=n(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),i=n(/*! ./dummy-demuxed-track */"./src/demux/dummy-demuxed-track.ts"),o=function(){function t(t,e){this.remainderData=null,this.config=void 0,this.config=e}var e=t.prototype;return e.resetTimeStamp=function(){},e.resetInitSegment=function(){},e.resetContiguity=function(){},t.probe=function(t){return Object(r.findBox)({data:t,start:0,end:Math.min(t.length,16384)},["moof"]).length>0},e.demux=function(t){var e=t,n=Object(i.dummyTrack)();if(this.config.progressive){this.remainderData&&(e=Object(r.appendUint8Array)(this.remainderData,t));var o=Object(r.segmentValidRange)(e);this.remainderData=o.remainder,n.samples=o.valid||new Uint8Array}else n.samples=e;return{audioTrack:Object(i.dummyTrack)(),avcTrack:n,id3Track:Object(i.dummyTrack)(),textTrack:Object(i.dummyTrack)()}},e.flush=function(){var t=Object(i.dummyTrack)();return t.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(i.dummyTrack)(),avcTrack:t,id3Track:Object(i.dummyTrack)(),textTrack:Object(i.dummyTrack)()}},e.demuxSampleAes=function(t,e,n){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},e.destroy=function(){},t}();o.minProbeByteLength=1024,e.default=o},"./src/demux/mpegaudio.ts":
/*!********************************!*\
!*** ./src/demux/mpegaudio.ts ***!
\********************************/
/*! exports provided: appendFrame, parseHeader, isHeaderPattern, isHeader, canParse, probe */function(t,e,n){"use strict";n.r(e),n.d(e,"appendFrame",(function(){return l})),n.d(e,"parseHeader",(function(){return c})),n.d(e,"isHeaderPattern",(function(){return u})),n.d(e,"isHeader",(function(){return h})),n.d(e,"canParse",(function(){return d})),n.d(e,"probe",(function(){return f}));var r=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],o=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],a=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],s=[0,1,1,4];function l(t,e,n,r,i){if(!(n+24>e.length)){var o=c(e,n);if(o&&n+o.frameLength<=e.length){var a=r+i*(9e4*o.samplesPerFrame/o.sampleRate),s={unit:e.subarray(n,n+o.frameLength),pts:a,dts:a};return t.config=[],t.channelCount=o.channelCount,t.samplerate=o.sampleRate,t.samples.push(s),{sample:s,length:o.frameLength,missing:0}}}}function c(t,e){var n=t[e+1]>>3&3,l=t[e+1]>>1&3,c=t[e+2]>>4&15,u=t[e+2]>>2&3;if(1!==n&&0!==c&&15!==c&&3!==u){var h=t[e+2]>>1&1,d=t[e+3]>>6,f=1e3*i[14*(3===n?3-l:3===l?3:4)+c-1],p=o[3*(3===n?0:2===n?1:2)+u],g=3===d?1:2,m=a[n][l],v=s[l],y=8*m*v,b=Math.floor(m*f/p+h)*v;if(null===r){var x=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);r=x?parseInt(x[1]):0}return!!r&&r<=87&&2===l&&f>=224e3&&0===d&&(t[e+3]=128|t[e+3]),{sampleRate:p,channelCount:g,frameLength:b,samplesPerFrame:y}}}function u(t,e){return 255===t[e]&&224==(224&t[e+1])&&0!=(6&t[e+1])}function h(t,e){return e+1<t.length&&u(t,e)}function d(t,e){return u(t,e)&&4<=t.length-e}function f(t,e){if(e+1<t.length&&u(t,e)){var n=c(t,e),r=4;null!=n&&n.frameLength&&(r=n.frameLength);var i=e+r;return i===t.length||h(t,i)}return!1}},"./src/demux/sample-aes.ts":
/*!*********************************!*\
!*** ./src/demux/sample-aes.ts ***!
\*********************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e);var r=n(/*! ../crypt/decrypter */"./src/crypt/decrypter.ts"),i=n(/*! ./tsdemuxer */"./src/demux/tsdemuxer.ts"),o=function(){function t(t,e,n){this.keyData=void 0,this.decrypter=void 0,this.keyData=n,this.decrypter=new r.default(t,e,{removePKCS7Padding:!1})}var e=t.prototype;return e.decryptBuffer=function(t,e){this.decrypter.decrypt(t,this.keyData.key.buffer,this.keyData.iv.buffer,e)},e.decryptAacSample=function(t,e,n,r){var i=t[e].unit,o=i.subarray(16,i.length-i.length%16),a=o.buffer.slice(o.byteOffset,o.byteOffset+o.length),s=this;this.decryptBuffer(a,(function(o){var a=new Uint8Array(o);i.set(a,16),r||s.decryptAacSamples(t,e+1,n)}))},e.decryptAacSamples=function(t,e,n){for(;;e++){if(e>=t.length)return void n();if(!(t[e].unit.length<32)){var r=this.decrypter.isSync();if(this.decryptAacSample(t,e,n,r),!r)return}}},e.getAvcEncryptedData=function(t){for(var e=16*Math.floor((t.length-48)/160)+16,n=new Int8Array(e),r=0,i=32;i<=t.length-16;i+=160,r+=16)n.set(t.subarray(i,i+16),r);return n},e.getAvcDecryptedUnit=function(t,e){for(var n=new Uint8Array(e),r=0,i=32;i<=t.length-16;i+=160,r+=16)t.set(n.subarray(r,r+16),i);return t},e.decryptAvcSample=function(t,e,n,r,o,a){var s=Object(i.discardEPB)(o.data),l=this.getAvcEncryptedData(s),c=this;this.decryptBuffer(l.buffer,(function(i){o.data=c.getAvcDecryptedUnit(s,i),a||c.decryptAvcSamples(t,e,n+1,r)}))},e.decryptAvcSamples=function(t,e,n,r){if(t instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;e++,n=0){if(e>=t.length)return void r();for(var i=t[e].units;!(n>=i.length);n++){var o=i[n];if(!(o.data.length<=48||1!==o.type&&5!==o.type)){var a=this.decrypter.isSync();if(this.decryptAvcSample(t,e,n,r,o,a),!a)return}}}},t}();e.default=o},"./src/demux/transmuxer-interface.ts":
/*!*******************************************!*\
!*** ./src/demux/transmuxer-interface.ts ***!
\*******************************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return h}));var r=n(/*! webworkify-webpack */"./node_modules/webworkify-webpack/index.js"),i=n(/*! ../events */"./src/events.ts"),o=n(/*! ../demux/transmuxer */"./src/demux/transmuxer.ts"),a=n(/*! ../utils/logger */"./src/utils/logger.ts"),s=n(/*! ../errors */"./src/errors.ts"),l=n(/*! ../utils/mediasource-helper */"./src/utils/mediasource-helper.ts"),c=n(/*! eventemitter3 */"./node_modules/eventemitter3/index.js"),u=Object(l.getMediaSource)()||{isTypeSupported:function(){return!1}},h=function(){function t(t,e,n,l){var h=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=t,this.id=e,this.onTransmuxComplete=n,this.onFlush=l;var d=t.config,f=function(e,n){(n=n||{}).frag=h.frag,n.id=h.id,t.trigger(e,n)};this.observer=new c.EventEmitter,this.observer.on(i.Events.FRAG_DECRYPTED,f),this.observer.on(i.Events.ERROR,f);var p={mp4:u.isTypeSupported("video/mp4"),mpeg:u.isTypeSupported("audio/mpeg"),mp3:u.isTypeSupported('audio/mp4; codecs="mp3"')},g=navigator.vendor;if(d.enableWorker&&"undefined"!=typeof Worker){var m;a.logger.log("demuxing in webworker");try{m=this.worker=r(/*! ../demux/transmuxer-worker.ts */"./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),m.addEventListener("message",this.onwmsg),m.onerror=function(e){t.trigger(i.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(e.message+" ("+e.filename+":"+e.lineno+")")})},m.postMessage({cmd:"init",typeSupported:p,vendor:g,id:e,config:JSON.stringify(d)})}catch(t){a.logger.warn("Error in worker:",t),a.logger.error("Error while initializing DemuxerWorker, fallback to inline"),m&&self.URL.revokeObjectURL(m.objectURL),this.transmuxer=new o.default(this.observer,p,d,g,e),this.worker=null}}else this.transmuxer=new o.default(this.observer,p,d,g,e)}var e=t.prototype;return e.destroy=function(){var t=this.worker;if(t)t.removeEventListener("message",this.onwmsg),t.terminate(),this.worker=null;else{var e=this.transmuxer;e&&(e.destroy(),this.transmuxer=null)}var n=this.observer;n&&n.removeAllListeners(),this.observer=null},e.push=function(t,e,n,r,i,s,l,c,u,h){var d=this;u.transmuxing.start=self.performance.now();var f=this.transmuxer,p=this.worker,g=s?s.start:i.start,m=i.decryptdata,v=this.frag,y=!(v&&i.cc===v.cc),b=!(v&&u.level===v.level),x=v?u.sn-v.sn:-1,C=this.part?u.part-this.part.index:1,S=!b&&(1===x||0===x&&1===C),E=self.performance.now();(b||x||0===i.stats.parsing.start)&&(i.stats.parsing.start=E),!s||!C&&S||(s.stats.parsing.start=E);var k=new o.TransmuxState(y,S,c,b,g);if(!S||y){a.logger.log("[transmuxer-interface, "+i.type+"]: Starting new transmux session for sn: "+u.sn+" p: "+u.part+" level: "+u.level+" id: "+u.id+"\n discontinuity: "+y+"\n trackSwitch: "+b+"\n contiguous: "+S+"\n accurateTimeOffset: "+c+"\n timeOffset: "+g);var w=new o.TransmuxConfig(n,r,e,l,h);this.configureTransmuxer(w)}if(this.frag=i,this.part=s,p)p.postMessage({cmd:"demux",data:t,decryptdata:m,chunkMeta:u,state:k},t instanceof ArrayBuffer?[t]:[]);else if(f){var T=f.push(t,m,u,k);Object(o.isPromise)(T)?T.then((function(t){d.handleTransmuxComplete(t)})):this.handleTransmuxComplete(T)}},e.flush=function(t){var e=this;t.transmuxing.start=self.performance.now();var n=this.transmuxer,r=this.worker;if(r)r.postMessage({cmd:"flush",chunkMeta:t});else if(n){var i=n.flush(t);Object(o.isPromise)(i)?i.then((function(n){e.handleFlushResult(n,t)})):this.handleFlushResult(i,t)}},e.handleFlushResult=function(t,e){var n=this;t.forEach((function(t){n.handleTransmuxComplete(t)})),this.onFlush(e)},e.onWorkerMessage=function(t){var e=t.data,n=this.hls;switch(e.event){case"init":self.URL.revokeObjectURL(this.worker.objectURL);break;case"transmuxComplete":this.handleTransmuxComplete(e.data);break;case"flush":this.onFlush(e.data);break;default:e.data=e.data||{},e.data.frag=this.frag,e.data.id=this.id,n.trigger(e.event,e.data)}},e.configureTransmuxer=function(t){var e=this.worker,n=this.transmuxer;e?e.postMessage({cmd:"configure",config:t}):n&&n.configure(t)},e.handleTransmuxComplete=function(t){t.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(t)},t}()},"./src/demux/transmuxer-worker.ts":
/*!****************************************!*\
!*** ./src/demux/transmuxer-worker.ts ***!
\****************************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return s}));var r=n(/*! ../demux/transmuxer */"./src/demux/transmuxer.ts"),i=n(/*! ../events */"./src/events.ts"),o=n(/*! ../utils/logger */"./src/utils/logger.ts"),a=n(/*! eventemitter3 */"./node_modules/eventemitter3/index.js");function s(t){var e=new a.EventEmitter,n=function(e,n){t.postMessage({event:e,data:n})};e.on(i.Events.FRAG_DECRYPTED,n),e.on(i.Events.ERROR,n),t.addEventListener("message",(function(i){var a=i.data;switch(a.cmd){case"init":var s=JSON.parse(a.config);t.transmuxer=new r.default(e,a.typeSupported,s,a.vendor,a.id),Object(o.enableLogs)(s.debug),n("init",null);break;case"configure":t.transmuxer.configure(a.config);break;case"demux":var c=t.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(r.isPromise)(c)?c.then((function(e){l(t,e)})):l(t,c);break;case"flush":var h=a.chunkMeta,d=t.transmuxer.flush(h);Object(r.isPromise)(d)?d.then((function(e){u(t,e,h)})):u(t,d,h)}}))}function l(t,e){if((n=e.remuxResult).audio||n.video||n.text||n.id3||n.initSegment){var n,r=[],i=e.remuxResult,o=i.audio,a=i.video;o&&c(r,o),a&&c(r,a),t.postMessage({event:"transmuxComplete",data:e},r)}}function c(t,e){e.data1&&t.push(e.data1.buffer),e.data2&&t.push(e.data2.buffer)}function u(t,e,n){e.forEach((function(e){l(t,e)})),t.postMessage({event:"flush",data:n})}},"./src/demux/transmuxer.ts":
/*!*********************************!*\
!*** ./src/demux/transmuxer.ts ***!
\*********************************/
/*! exports provided: default, isPromise, TransmuxConfig, TransmuxState */function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return y})),n.d(e,"isPromise",(function(){return x})),n.d(e,"TransmuxConfig",(function(){return C})),n.d(e,"TransmuxState",(function(){return S}));var r,i=n(/*! ../events */"./src/events.ts"),o=n(/*! ../errors */"./src/errors.ts"),a=n(/*! ../crypt/decrypter */"./src/crypt/decrypter.ts"),s=n(/*! ../demux/aacdemuxer */"./src/demux/aacdemuxer.ts"),l=n(/*! ../demux/mp4demuxer */"./src/demux/mp4demuxer.ts"),c=n(/*! ../demux/tsdemuxer */"./src/demux/tsdemuxer.ts"),u=n(/*! ../demux/mp3demuxer */"./src/demux/mp3demuxer.ts"),h=n(/*! ../remux/mp4-remuxer */"./src/remux/mp4-remuxer.ts"),d=n(/*! ../remux/passthrough-remuxer */"./src/remux/passthrough-remuxer.ts"),f=n(/*! ./chunk-cache */"./src/demux/chunk-cache.ts"),p=n(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),g=n(/*! ../utils/logger */"./src/utils/logger.ts");try{r=self.performance.now.bind(self.performance)}catch(t){g.logger.debug("Unable to use Performance API on this environment"),r=self.Date.now}var m=[{demux:c.default,remux:h.default},{demux:l.default,remux:d.default},{demux:s.default,remux:h.default},{demux:u.default,remux:h.default}],v=1024;m.forEach((function(t){var e=t.demux;v=Math.max(v,e.minProbeByteLength)}));var y=function(){function t(t,e,n,r,i){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 f.default,this.observer=t,this.typeSupported=e,this.config=n,this.vendor=r,this.id=i}var e=t.prototype;return e.configure=function(t){this.transmuxConfig=t,this.decrypter&&this.decrypter.reset()},e.push=function(t,e,n,i){var o=this,a=n.transmuxing;a.executeStart=r();var s=new Uint8Array(t),l=this.cache,c=this.config,u=this.currentTransmuxState,h=this.transmuxConfig;i&&(this.currentTransmuxState=i);var d=function(t,e){var n=null;return t.byteLength>0&&null!=e&&null!=e.key&&null!==e.iv&&null!=e.method&&(n=e),n}(s,e);if(d&&"AES-128"===d.method){var f=this.getDecrypter();if(!c.enableSoftwareAES)return this.decryptionPromise=f.webCryptoDecrypt(s,d.key.buffer,d.iv.buffer).then((function(t){var e=o.push(t,null,n);return o.decryptionPromise=null,e})),this.decryptionPromise;var g=f.softwareDecrypt(s,d.key.buffer,d.iv.buffer);if(!g)return a.executeEnd=r(),b(n);s=new Uint8Array(g)}var m=i||u,v=m.contiguous,y=m.discontinuity,x=m.trackSwitch,C=m.accurateTimeOffset,S=m.timeOffset,E=h.audioCodec,k=h.videoCodec,w=h.defaultInitPts,T=h.duration,O=h.initSegmentData;if((y||x)&&this.resetInitSegment(O,E,k,T),y&&this.resetInitialTimestamp(w),v||this.resetContiguity(),this.needsProbing(s,y,x)){if(l.dataLength){var L=l.flush();s=Object(p.appendUint8Array)(L,s)}this.configureTransmuxer(s,h)}var A=this.transmux(s,d,S,C,n),D=this.currentTransmuxState;return D.contiguous=!0,D.discontinuity=!1,D.trackSwitch=!1,a.executeEnd=r(),A},e.flush=function(t){var e=this,n=t.transmuxing;n.executeStart=r();var a=this.decrypter,s=this.cache,l=this.currentTransmuxState,c=this.decryptionPromise;if(c)return c.then((function(){return e.flush(t)}));var u=[],h=l.timeOffset;if(a){var d=a.flush();d&&u.push(this.push(d,null,t))}var f=s.dataLength;s.reset();var p=this.demuxer,g=this.remuxer;if(!p||!g)return f>=v&&this.observer.emit(i.Events.ERROR,i.Events.ERROR,{type:o.ErrorTypes.MEDIA_ERROR,details:o.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),n.executeEnd=r(),[b(t)];var m=p.flush(h);return x(m)?m.then((function(n){return e.flushRemux(u,n,t),u})):(this.flushRemux(u,m,t),u)},e.flushRemux=function(t,e,n){var i=e.audioTrack,o=e.avcTrack,a=e.id3Track,s=e.textTrack,l=this.currentTransmuxState,c=l.accurateTimeOffset,u=l.timeOffset;g.logger.log("[transmuxer.ts]: Flushed fragment "+n.sn+(n.part>-1?" p: "+n.part:"")+" of level "+n.level);var h=this.remuxer.remux(i,o,a,s,u,c,!0,this.id);t.push({remuxResult:h,chunkMeta:n}),n.transmuxing.executeEnd=r()},e.resetInitialTimestamp=function(t){var e=this.demuxer,n=this.remuxer;e&&n&&(e.resetTimeStamp(t),n.resetTimeStamp(t))},e.resetContiguity=function(){var t=this.demuxer,e=this.remuxer;t&&e&&(t.resetContiguity(),e.resetNextTimestamp())},e.resetInitSegment=function(t,e,n,r){var i=this.demuxer,o=this.remuxer;i&&o&&(i.resetInitSegment(e,n,r),o.resetInitSegment(t,e,n))},e.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},e.transmux=function(t,e,n,r,i){return e&&"SAMPLE-AES"===e.method?this.transmuxSampleAes(t,e,n,r,i):this.transmuxUnencrypted(t,n,r,i)},e.transmuxUnencrypted=function(t,e,n,r){var i=this.demuxer.demux(t,e,!1,!this.config.progressive),o=i.audioTrack,a=i.avcTrack,s=i.id3Track,l=i.textTrack;return{remuxResult:this.remuxer.remux(o,a,s,l,e,n,!1,this.id),chunkMeta:r}},e.transmuxSampleAes=function(t,e,n,r,i){var o=this;return this.demuxer.demuxSampleAes(t,e,n).then((function(t){return{remuxResult:o.remuxer.remux(t.audioTrack,t.avcTrack,t.id3Track,t.textTrack,n,r,!1,o.id),chunkMeta:i}}))},e.configureTransmuxer=function(t,e){for(var n,r=this.config,i=this.observer,o=this.typeSupported,a=this.vendor,s=e.audioCodec,c=e.defaultInitPts,u=e.duration,h=e.initSegmentData,f=e.videoCodec,p=0,v=m.length;p<v;p++)if(m[p].demux.probe(t)){n=m[p];break}n||(g.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),n={demux:l.default,remux:d.default});var y=this.demuxer,b=this.remuxer,x=n.remux,C=n.demux;b&&b instanceof x||(this.remuxer=new x(i,r,o,a)),y&&y instanceof C||(this.demuxer=new C(i,r,o),this.probe=C.probe),this.resetInitSegment(h,s,f,u),this.resetInitialTimestamp(c)},e.needsProbing=function(t,e,n){return!this.demuxer||!this.remuxer||e||n},e.getDecrypter=function(){var t=this.decrypter;return t||(t=this.decrypter=new a.default(this.observer,this.config)),t},t}(),b=function(t){return{remuxResult:{},chunkMeta:t}};function x(t){return"then"in t&&t.then instanceof Function}var C=function(t,e,n,r,i){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=t,this.videoCodec=e,this.initSegmentData=n,this.duration=r,this.defaultInitPts=i},S=function(t,e,n,r,i){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=t,this.contiguous=e,this.accurateTimeOffset=n,this.trackSwitch=r,this.timeOffset=i}},"./src/demux/tsdemuxer.ts":
/*!********************************!*\
!*** ./src/demux/tsdemuxer.ts ***!
\********************************/
/*! exports provided: discardEPB, default */function(t,e,n){"use strict";n.r(e),n.d(e,"discardEPB",(function(){return x}));var r=n(/*! ./adts */"./src/demux/adts.ts"),i=n(/*! ./mpegaudio */"./src/demux/mpegaudio.ts"),o=n(/*! ./exp-golomb */"./src/demux/exp-golomb.ts"),a=n(/*! ./id3 */"./src/demux/id3.ts"),s=n(/*! ./sample-aes */"./src/demux/sample-aes.ts"),l=n(/*! ../events */"./src/events.ts"),c=n(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),u=n(/*! ../utils/logger */"./src/utils/logger.ts"),h=n(/*! ../errors */"./src/errors.ts"),d={video:1,audio:2,id3:3,text:4},f=function(){function t(t,e,n){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=t,this.config=e,this.typeSupported=n}t.probe=function(e){var n=t.syncOffset(e);return!(n<0||(n&&u.logger.warn("MPEG2-TS detected but first sync word found @ offset "+n+", junk ahead ?"),0))},t.syncOffset=function(t){for(var e=Math.min(1e3,t.length-564),n=0;n<e;){if(71===t[n]&&71===t[n+188]&&71===t[n+376])return n;n++}return-1},t.createTrack=function(t,e){return{container:"video"===t||"audio"===t?"video/mp2t":void 0,type:t,id:d[t],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===t?e:void 0}};var e=t.prototype;return e.resetInitSegment=function(e,n,r){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=t.createTrack("video",r),this._audioTrack=t.createTrack("audio",r),this._id3Track=t.createTrack("id3",r),this._txtTrack=t.createTrack("text",r),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=e,this.videoCodec=n,this._duration=r},e.resetTimeStamp=function(){},e.resetContiguity=function(){var t=this._audioTrack,e=this._avcTrack,n=this._id3Track;t&&(t.pesData=null),e&&(e.pesData=null),n&&(n.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},e.demux=function(e,n,r,i){var o;void 0===r&&(r=!1),void 0===i&&(i=!1),r||(this.sampleAes=null);var a=this._avcTrack,s=this._audioTrack,d=this._id3Track,f=a.pid,p=a.pesData,y=s.pid,b=d.pid,x=s.pesData,C=d.pesData,S=!1,E=this.pmtParsed,k=this._pmtId,w=e.length;if(this.remainderData&&(w=(e=Object(c.appendUint8Array)(this.remainderData,e)).length,this.remainderData=null),w<188&&!i)return this.remainderData=e,{audioTrack:s,avcTrack:a,id3Track:d,textTrack:this._txtTrack};var T=Math.max(0,t.syncOffset(e));(w-=(w+T)%188)<e.byteLength&&!i&&(this.remainderData=new Uint8Array(e.buffer,w,e.buffer.byteLength-w));for(var O=T;O<w;O+=188)if(71===e[O]){var L=!!(64&e[O+1]),A=((31&e[O+1])<<8)+e[O+2],D=void 0;if((48&e[O+3])>>4>1){if((D=O+5+e[O+4])===O+188)continue}else D=O+4;switch(A){case f:L&&(p&&(o=v(p))&&this.parseAVCPES(o,!1),p={data:[],size:0}),p&&(p.data.push(e.subarray(D,O+188)),p.size+=O+188-D);break;case y:L&&(x&&(o=v(x))&&(s.isAAC?this.parseAACPES(o):this.parseMPEGPES(o)),x={data:[],size:0}),x&&(x.data.push(e.subarray(D,O+188)),x.size+=O+188-D);break;case b:L&&(C&&(o=v(C))&&this.parseID3PES(o),C={data:[],size:0}),C&&(C.data.push(e.subarray(D,O+188)),C.size+=O+188-D);break;case 0:L&&(D+=e[D]+1),k=this._pmtId=g(e,D);break;case k:L&&(D+=e[D]+1);var R=m(e,D,!0===this.typeSupported.mpeg||!0===this.typeSupported.mp3,r);(f=R.avc)>0&&(a.pid=f),(y=R.audio)>0&&(s.pid=y,s.isAAC=R.isAAC),(b=R.id3)>0&&(d.pid=b),S&&!E&&(u.logger.log("reparse from beginning"),S=!1,O=T-188),E=this.pmtParsed=!0;break;case 17:case 8191:break;default:S=!0}}else this.observer.emit(l.Events.ERROR,l.Events.ERROR,{type:h.ErrorTypes.MEDIA_ERROR,details:h.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});a.pesData=p,s.pesData=x,d.pesData=C;var M={audioTrack:s,avcTrack:a,id3Track:d,textTrack:this._txtTrack};return i&&this.extractRemainingSamples(M),M},e.flush=function(){var t,e=this.remainderData;return this.remainderData=null,t=e?this.demux(e,-1,!1,!0):{audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t},e.extractRemainingSamples=function(t){var e,n=t.audioTrack,r=t.avcTrack,i=t.id3Track,o=r.pesData,a=n.pesData,s=i.pesData;o&&(e=v(o))?(this.parseAVCPES(e,!0),r.pesData=null):r.pesData=o,a&&(e=v(a))?(n.isAAC?this.parseAACPES(e):this.parseMPEGPES(e),n.pesData=null):(null!=a&&a.size&&u.logger.log("last AAC PES packet truncated,might overlap between fragments"),n.pesData=a),s&&(e=v(s))?(this.parseID3PES(e),i.pesData=null):i.pesData=s},e.demuxSampleAes=function(t,e,n){var r=this.demux(t,n,!0,!this.config.progressive),i=this.sampleAes=new s.default(this.observer,this.config,e);return this.decrypt(r,i)},e.decrypt=function(t,e){return new Promise((function(n){var r=t.audioTrack,i=t.avcTrack;r.samples&&r.isAAC?e.decryptAacSamples(r.samples,0,(function(){i.samples?e.decryptAvcSamples(i.samples,0,0,(function(){n(t)})):n(t)})):i.samples&&e.decryptAvcSamples(i.samples,0,0,(function(){n(t)}))}))},e.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},e.parseAVCPES=function(t,e){var n,r=this,i=this._avcTrack,s=this.parseAVCNALu(t.data),l=this.avcSample,c=!1;t.data=null,l&&s.length&&!i.audFound&&(y(l,i),l=this.avcSample=p(!1,t.pts,t.dts,"")),s.forEach((function(e){switch(e.type){case 1:n=!0,l||(l=r.avcSample=p(!0,t.pts,t.dts,"")),l.frame=!0;var s=e.data;if(c&&s.length>4){var u=new o.default(s).readSliceType();2!==u&&4!==u&&7!==u&&9!==u||(l.key=!0)}break;case 5:n=!0,l||(l=r.avcSample=p(!0,t.pts,t.dts,"")),l.key=!0,l.frame=!0;break;case 6:n=!0;var h=new o.default(x(e.data));h.readUByte();for(var d=0,f=0,g=!1,m=0;!g&&h.bytesAvailable>1;){d=0;do{d+=m=h.readUByte()}while(255===m);f=0;do{f+=m=h.readUByte()}while(255===m);if(4===d&&0!==h.bytesAvailable){if(g=!0,181===h.readUByte()&&49===h.readUShort()&&1195456820===h.readUInt()&&3===h.readUByte()){for(var v=h.readUByte(),C=31&v,S=[v,h.readUByte()],E=0;E<C;E++)S.push(h.readUByte()),S.push(h.readUByte()),S.push(h.readUByte());b(r._txtTrack.samples,{type:3,pts:t.pts,bytes:S})}}else if(5===d&&0!==h.bytesAvailable){if(g=!0,f>16){for(var k=[],w=0;w<16;w++)k.push(h.readUByte().toString(16)),3!==w&&5!==w&&7!==w&&9!==w||k.push("-");for(var T=f-16,O=new Uint8Array(T),L=0;L<T;L++)O[L]=h.readUByte();b(r._txtTrack.samples,{pts:t.pts,payloadType:d,uuid:k.join(""),userData:Object(a.utf8ArrayToStr)(O),userDataBytes:O})}}else if(f<h.bytesAvailable)for(var A=0;A<f;A++)h.readUByte()}break;case 7:if(n=!0,c=!0,!i.sps){var D=new o.default(e.data).readSPS();i.width=D.width,i.height=D.height,i.pixelRatio=D.pixelRatio,i.sps=[e.data],i.duration=r._duration;for(var R=e.data.subarray(1,4),M="avc1.",I=0;I<3;I++){var _=R[I].toString(16);_.length<2&&(_="0"+_),M+=_}i.codec=M}break;case 8:n=!0,i.pps||(i.pps=[e.data]);break;case 9:n=!1,i.audFound=!0,l&&y(l,i),l=r.avcSample=p(!1,t.pts,t.dts,"");break;case 12:n=!1;break;default:n=!1,l&&(l.debug+="unknown NAL "+e.type+" ")}l&&n&&l.units.push(e)})),e&&l&&(y(l,i),this.avcSample=null)},e.getLastNalUnit=function(){var t,e,n=this.avcSample;if(!n||0===n.units.length){var r=this._avcTrack.samples;n=r[r.length-1]}if(null!==(t=n)&&void 0!==t&&t.units){var i=n.units;e=i[i.length-1]}return e},e.parseAVCNALu=function(t){var e,n,r=t.byteLength,i=this._avcTrack,o=i.naluState||0,a=o,s=[],l=0,c=-1,u=0;for(-1===o&&(c=0,u=31&t[0],o=0,l=1);l<r;)if(e=t[l++],o)if(1!==o)if(e)if(1===e){if(c>=0){var h={data:t.subarray(c,l-o-1),type:u};s.push(h)}else{var d=this.getLastNalUnit();if(d&&(a&&l<=4-a&&d.state&&(d.data=d.data.subarray(0,d.data.byteLength-a)),(n=l-o-1)>0)){var f=new Uint8Array(d.data.byteLength+n);f.set(d.data,0),f.set(t.subarray(0,n),d.data.byteLength),d.data=f,d.state=0}}l<r?(c=l,u=31&t[l],o=0):o=-1}else o=0;else o=3;else o=e?0:2;else o=e?0:1;if(c>=0&&o>=0){var p={data:t.subarray(c,r),type:u,state:o};s.push(p)}if(0===s.length){var g=this.getLastNalUnit();if(g){var m=new Uint8Array(g.data.byteLength+t.byteLength);m.set(g.data,0),m.set(t,g.data.byteLength),g.data=m}}return i.naluState=o,s},e.parseAACPES=function(t){var e,n,i,o,a,s=0,c=this._audioTrack,d=this.aacOverFlow,f=t.data;if(d){this.aacOverFlow=null;var p=d.sample.unit.byteLength,g=Math.min(d.missing,p),m=p-g;d.sample.unit.set(f.subarray(0,g),m),c.samples.push(d.sample),s=d.missing}for(e=s,n=f.length;e<n-1&&!r.isHeader(f,e);e++);if(e===s||(e<n-1?(i="AAC PES did not start with ADTS header,offset:"+e,o=!1):(i="no ADTS header found in AAC PES",o=!0),u.logger.warn("parsing error:"+i),this.observer.emit(l.Events.ERROR,l.Events.ERROR,{type:h.ErrorTypes.MEDIA_ERROR,details:h.ErrorDetails.FRAG_PARSING_ERROR,fatal:o,reason:i}),!o)){if(r.initTrackConfig(c,this.observer,f,e,this.audioCodec),void 0!==t.pts)a=t.pts;else{if(!d)return void u.logger.warn("[tsdemuxer]: AAC PES unknown PTS");var v=r.getFrameDuration(c.samplerate);a=d.sample.pts+v}for(var y=0;e<n;){if(r.isHeader(f,e)){if(e+5<n){var b=r.appendFrame(c,f,e,a,y);if(b){if(!b.missing){e+=b.length,y++;continue}this.aacOverFlow=b}}break}e++}}},e.parseMPEGPES=function(t){var e=t.data,n=e.length,r=0,o=0,a=t.pts;if(void 0!==a)for(;o<n;)if(i.isHeader(e,o)){var s=i.appendFrame(this._audioTrack,e,o,a,r);if(!s)break;o+=s.length,r++}else o++;else u.logger.warn("[tsdemuxer]: MPEG PES unknown PTS")},e.parseID3PES=function(t){void 0!==t.pts?this._id3Track.samples.push(t):u.logger.warn("[tsdemuxer]: ID3 PES unknown PTS")},t}();function p(t,e,n,r){return{key:t,frame:!1,pts:e,dts:n,units:[],debug:r,length:0}}function g(t,e){return(31&t[e+10])<<8|t[e+11]}function m(t,e,n,r){var i={audio:-1,avc:-1,id3:-1,isAAC:!0},o=e+3+((15&t[e+1])<<8|t[e+2])-4;for(e+=12+((15&t[e+10])<<8|t[e+11]);e<o;){var a=(31&t[e+1])<<8|t[e+2];switch(t[e]){case 207:if(!r){u.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:-1===i.audio&&(i.audio=a);break;case 21:-1===i.id3&&(i.id3=a);break;case 219:if(!r){u.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:-1===i.avc&&(i.avc=a);break;case 3:case 4:n?-1===i.audio&&(i.audio=a,i.isAAC=!1):u.logger.log("MPEG audio found, not supported in this browser");break;case 36:u.logger.warn("Unsupported HEVC stream type found")}e+=5+((15&t[e+3])<<8|t[e+4])}return i}function v(t){var e,n,r,i,o,a=0,s=t.data;if(!t||0===t.size)return null;for(;s[0].length<19&&s.length>1;){var l=new Uint8Array(s[0].length+s[1].length);l.set(s[0]),l.set(s[1],s[0].length),s[0]=l,s.splice(1,1)}if(1===((e=s[0])[0]<<16)+(e[1]<<8)+e[2]){if((n=(e[4]<<8)+e[5])&&n>t.size-6)return null;var c=e[7];192&c&&(i=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,64&c?i-(o=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2)>54e5&&(u.logger.warn(Math.round((i-o)/9e4)+"s delta between PTS and DTS, align them"),i=o):o=i);var h=(r=e[8])+9;if(t.size<=h)return null;t.size-=h;for(var d=new Uint8Array(t.size),f=0,p=s.length;f<p;f++){var g=(e=s[f]).byteLength;if(h){if(h>g){h-=g;continue}e=e.subarray(h),g-=h,h=0}d.set(e,a),a+=g}return n&&(n-=r+3),{data:d,pts:i,dts:o,len:n}}return null}function y(t,e){if(t.units.length&&t.frame){if(void 0===t.pts){var n=e.samples,r=n.length;if(!r)return void e.dropped++;var i=n[r-1];t.pts=i.pts,t.dts=i.dts}e.samples.push(t)}t.debug.length&&u.logger.log(t.pts+"/"+t.dts+":"+t.debug)}function b(t,e){var n=t.length;if(n>0){if(e.pts>=t[n-1].pts)t.push(e);else for(var r=n-1;r>=0;r--)if(e.pts<t[r].pts){t.splice(r,0,e);break}}else t.push(e)}function x(t){for(var e=t.byteLength,n=[],r=1;r<e-2;)0===t[r]&&0===t[r+1]&&3===t[r+2]?(n.push(r+2),r+=2):r++;if(0===n.length)return t;var i=e-n.length,o=new Uint8Array(i),a=0;for(r=0;r<i;a++,r++)a===n[0]&&(a++,n.shift()),o[r]=t[a];return o}f.minProbeByteLength=188,e.default=f},"./src/errors.ts":
/*!***********************!*\
!*** ./src/errors.ts ***!
\***********************/
/*! exports provided: ErrorTypes, ErrorDetails */function(t,e,n){"use strict";var r,i;n.r(e),n.d(e,"ErrorTypes",(function(){return r})),n.d(e,"ErrorDetails",(function(){return i})),function(t){t.NETWORK_ERROR="networkError",t.MEDIA_ERROR="mediaError",t.KEY_SYSTEM_ERROR="keySystemError",t.MUX_ERROR="muxError",t.OTHER_ERROR="otherError"}(r||(r={})),function(t){t.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",t.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",t.KEY_SYSTEM_NO_SESSION="keySystemNoSession",t.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",t.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",t.MANIFEST_LOAD_ERROR="manifestLoadError",t.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",t.MANIFEST_PARSING_ERROR="manifestParsingError",t.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",t.LEVEL_EMPTY_ERROR="levelEmptyError",t.LEVEL_LOAD_ERROR="levelLoadError",t.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",t.LEVEL_SWITCH_ERROR="levelSwitchError",t.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",t.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",t.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",t.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",t.FRAG_LOAD_ERROR="fragLoadError",t.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",t.FRAG_DECRYPT_ERROR="fragDecryptError",t.FRAG_PARSING_ERROR="fragParsingError",t.REMUX_ALLOC_ERROR="remuxAllocError",t.KEY_LOAD_ERROR="keyLoadError",t.KEY_LOAD_TIMEOUT="keyLoadTimeOut",t.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",t.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",t.BUFFER_APPEND_ERROR="bufferAppendError",t.BUFFER_APPENDING_ERROR="bufferAppendingError",t.BUFFER_STALLED_ERROR="bufferStalledError",t.BUFFER_FULL_ERROR="bufferFullError",t.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",t.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",t.INTERNAL_EXCEPTION="internalException",t.INTERNAL_ABORTED="aborted",t.UNKNOWN="unknown"}(i||(i={}))},"./src/events.ts":
/*!***********************!*\
!*** ./src/events.ts ***!
\***********************/
/*! exports provided: Events */function(t,e,n){"use strict";var r;n.r(e),n.d(e,"Events",(function(){return r})),function(t){t.MEDIA_ATTACHING="hlsMediaAttaching",t.MEDIA_ATTACHED="hlsMediaAttached",t.MEDIA_DETACHING="hlsMediaDetaching",t.MEDIA_DETACHED="hlsMediaDetached",t.BUFFER_RESET="hlsBufferReset",t.BUFFER_CODECS="hlsBufferCodecs",t.BUFFER_CREATED="hlsBufferCreated",t.BUFFER_APPENDING="hlsBufferAppending",t.BUFFER_APPENDED="hlsBufferAppended",t.BUFFER_EOS="hlsBufferEos",t.BUFFER_FLUSHING="hlsBufferFlushing",t.BUFFER_FLUSHED="hlsBufferFlushed",t.MANIFEST_LOADING="hlsManifestLoading",t.MANIFEST_LOADED="hlsManifestLoaded",t.MANIFEST_PARSED="hlsManifestParsed",t.LEVEL_SWITCHING="hlsLevelSwitching",t.LEVEL_SWITCHED="hlsLevelSwitched",t.LEVEL_LOADING="hlsLevelLoading",t.LEVEL_LOADED="hlsLevelLoaded",t.LEVEL_UPDATED="hlsLevelUpdated",t.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",t.LEVELS_UPDATED="hlsLevelsUpdated",t.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",t.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",t.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",t.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",t.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",t.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",t.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",t.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",t.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",t.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",t.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",t.CUES_PARSED="hlsCuesParsed",t.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",t.INIT_PTS_FOUND="hlsInitPtsFound",t.FRAG_LOADING="hlsFragLoading",t.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",t.FRAG_LOADED="hlsFragLoaded",t.FRAG_DECRYPTED="hlsFragDecrypted",t.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",t.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",t.FRAG_PARSING_METADATA="hlsFragParsingMetadata",t.FRAG_PARSED="hlsFragParsed",t.FRAG_BUFFERED="hlsFragBuffered",t.FRAG_CHANGED="hlsFragChanged",t.FPS_DROP="hlsFpsDrop",t.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",t.ERROR="hlsError",t.DESTROYING="hlsDestroying",t.KEY_LOADING="hlsKeyLoading",t.KEY_LOADED="hlsKeyLoaded",t.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",t.BACK_BUFFER_REACHED="hlsBackBufferReached"}(r||(r={}))},"./src/hls.ts":
/*!********************!*\
!*** ./src/hls.ts ***!
\********************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return y}));var r=n(/*! url-toolkit */"./node_modules/url-toolkit/src/url-toolkit.js"),i=n(/*! ./loader/playlist-loader */"./src/loader/playlist-loader.ts"),o=n(/*! ./loader/key-loader */"./src/loader/key-loader.ts"),a=n(/*! ./controller/id3-track-controller */"./src/controller/id3-track-controller.ts"),s=n(/*! ./controller/latency-controller */"./src/controller/latency-controller.ts"),l=n(/*! ./controller/level-controller */"./src/controller/level-controller.ts"),c=n(/*! ./controller/fragment-tracker */"./src/controller/fragment-tracker.ts"),u=n(/*! ./controller/stream-controller */"./src/controller/stream-controller.ts"),h=n(/*! ./is-supported */"./src/is-supported.ts"),d=n(/*! ./utils/logger */"./src/utils/logger.ts"),f=n(/*! ./config */"./src/config.ts"),p=n(/*! eventemitter3 */"./node_modules/eventemitter3/index.js"),g=n(/*! ./events */"./src/events.ts"),m=n(/*! ./errors */"./src/errors.ts");function v(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var y=function(){function t(e){void 0===e&&(e={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new p.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 n=this.config=Object(f.mergeConfig)(t.DefaultConfig,e);this.userConfig=e,Object(d.enableLogs)(n.debug),this._autoLevelCapping=-1,n.progressive&&Object(f.enableStreamingMode)(n);var r=n.abrController,h=n.bufferController,g=n.capLevelController,m=n.fpsController,v=this.abrController=new r(this),y=this.bufferController=new h(this),b=this.capLevelController=new g(this),x=new m(this),C=new i.default(this),S=new o.default(this),E=new a.default(this),k=this.levelController=new l.default(this),w=new c.FragmentTracker(this),T=this.streamController=new u.default(this,w);b.setStreamController(T),x.setStreamController(T);var O=[k,T];this.networkControllers=O;var L=[C,S,v,y,b,x,E,w];this.audioTrackController=this.createController(n.audioTrackController,null,O),this.createController(n.audioStreamController,w,O),this.subtitleTrackController=this.createController(n.subtitleTrackController,null,O),this.createController(n.subtitleStreamController,w,O),this.createController(n.timelineController,null,L),this.emeController=this.createController(n.emeController,null,L),this.cmcdController=this.createController(n.cmcdController,null,L),this.latencyController=this.createController(s.default,null,L),this.coreComponents=L}t.isSupported=function(){return Object(h.isSupported)()};var e,n,y,b=t.prototype;return b.createController=function(t,e,n){if(t){var r=e?new t(this,e):new t(this);return n&&n.push(r),r}return null},b.on=function(t,e,n){void 0===n&&(n=this),this._emitter.on(t,e,n)},b.once=function(t,e,n){void 0===n&&(n=this),this._emitter.once(t,e,n)},b.removeAllListeners=function(t){this._emitter.removeAllListeners(t)},b.off=function(t,e,n,r){void 0===n&&(n=this),this._emitter.off(t,e,n,r)},b.listeners=function(t){return this._emitter.listeners(t)},b.emit=function(t,e,n){return this._emitter.emit(t,e,n)},b.trigger=function(t,e){if(this.config.debug)return this.emit(t,t,e);try{return this.emit(t,t,e)}catch(e){d.logger.error("An internal error happened while handling event "+t+'. Error message: "'+e.message+'". Here is a stacktrace:',e),this.trigger(g.Events.ERROR,{type:m.ErrorTypes.OTHER_ERROR,details:m.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:t,error:e})}return!1},b.listenerCount=function(t){return this._emitter.listenerCount(t)},b.destroy=function(){d.logger.log("destroy"),this.trigger(g.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach((function(t){return t.destroy()})),this.networkControllers.length=0,this.coreComponents.forEach((function(t){return t.destroy()})),this.coreComponents.length=0},b.attachMedia=function(t){d.logger.log("attachMedia"),this._media=t,this.trigger(g.Events.MEDIA_ATTACHING,{media:t})},b.detachMedia=function(){d.logger.log("detachMedia"),this.trigger(g.Events.MEDIA_DETACHING,void 0),this._media=null},b.loadSource=function(t){this.stopLoad();var e=this.media,n=this.url,i=this.url=r.buildAbsoluteURL(self.location.href,t,{alwaysNormalize:!0});d.logger.log("loadSource:"+i),e&&n&&n!==i&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(e)),this.trigger(g.Events.MANIFEST_LOADING,{url:t})},b.startLoad=function(t){void 0===t&&(t=-1),d.logger.log("startLoad("+t+")"),this.networkControllers.forEach((function(e){e.startLoad(t)}))},b.stopLoad=function(){d.logger.log("stopLoad"),this.networkControllers.forEach((function(t){t.stopLoad()}))},b.swapAudioCodec=function(){d.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},b.recoverMediaError=function(){d.logger.log("recoverMediaError");var t=this._media;this.detachMedia(),t&&this.attachMedia(t)},b.removeLevel=function(t,e){void 0===e&&(e=0),this.levelController.removeLevel(t,e)},e=t,y=[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return g.Events}},{key:"ErrorTypes",get:function(){return m.ErrorTypes}},{key:"ErrorDetails",get:function(){return m.ErrorDetails}},{key:"DefaultConfig",get:function(){return t.defaultConfig?t.defaultConfig:f.hlsDefaultConfig},set:function(e){t.defaultConfig=e}}],(n=[{key:"levels",get:function(){var t=this.levelController.levels;return t||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(t){d.logger.log("set currentLevel:"+t),this.loadLevel=t,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(t){d.logger.log("set nextLevel:"+t),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(t){d.logger.log("set loadLevel:"+t),this.levelController.manualLevel=t}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(t){this.levelController.nextLoadLevel=t}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(t){d.logger.log("set firstLevel:"+t),this.levelController.firstLevel=t}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(t){d.logger.log("set startLevel:"+t),-1!==t&&(t=Math.max(t,this.minAutoLevel)),this.levelController.startLevel=t}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(t){var e=!!t;e!==this.config.capLevelToPlayerSize&&(e?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=e)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(t){this._autoLevelCapping!==t&&(d.logger.log("set autoLevelCapping:"+t),this._autoLevelCapping=t)}},{key:"bandwidthEstimate",get:function(){var t=this.abrController.bwEstimator;return t?t.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var t=this.levels,e=this.config.minAutoBitrate;if(!t)return 0;for(var n=t.length,r=0;r<n;r++)if(t[r].maxBitrate>e)return r;return 0}},{key:"maxAutoLevel",get:function(){var t=this.levels,e=this.autoLevelCapping;return-1===e&&t&&t.length?t.length-1:e}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(t){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,t)}},{key:"audioTracks",get:function(){var t=this.audioTrackController;return t?t.audioTracks:[]}},{key:"audioTrack",get:function(){var t=this.audioTrackController;return t?t.audioTrack:-1},set:function(t){var e=this.audioTrackController;e&&(e.audioTrack=t)}},{key:"subtitleTracks",get:function(){var t=this.subtitleTrackController;return t?t.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var t=this.subtitleTrackController;return t?t.subtitleTrack:-1},set:function(t){var e=this.subtitleTrackController;e&&(e.subtitleTrack=t)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var t=this.subtitleTrackController;return!!t&&t.subtitleDisplay},set:function(t){var e=this.subtitleTrackController;e&&(e.subtitleDisplay=t)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(t){this.config.lowLatencyMode=t}},{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}}])&&v(e.prototype,n),y&&v(e,y),t}();y.defaultConfig=void 0},"./src/is-supported.ts":
/*!*****************************!*\
!*** ./src/is-supported.ts ***!
\*****************************/
/*! exports provided: isSupported, changeTypeSupported */function(t,e,n){"use strict";n.r(e),n.d(e,"isSupported",(function(){return o})),n.d(e,"changeTypeSupported",(function(){return a}));var r=n(/*! ./utils/mediasource-helper */"./src/utils/mediasource-helper.ts");function i(){return self.SourceBuffer||self.WebKitSourceBuffer}function o(){var t=Object(r.getMediaSource)();if(!t)return!1;var e=i(),n=t&&"function"==typeof t.isTypeSupported&&t.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),o=!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove;return!!n&&!!o}function a(){var t,e=i();return"function"==typeof(null==e||null===(t=e.prototype)||void 0===t?void 0:t.changeType)}},"./src/loader/fragment-loader.ts":
/*!***************************************!*\
!*** ./src/loader/fragment-loader.ts ***!
\***************************************/
/*! exports provided: default, LoadError */function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return h})),n.d(e,"LoadError",(function(){return f}));var r=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=n(/*! ../errors */"./src/errors.ts");function o(t){var e="function"==typeof Map?new Map:void 0;return(o=function(t){if(null===t||(n=t,-1===Function.toString.call(n).indexOf("[native code]")))return t;var n;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return a(t,arguments,c(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),l(r,t)})(t)}function a(t,e,n){return(a=s()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&l(i,n.prototype),i}).apply(null,arguments)}function s(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var u=Math.pow(2,17),h=function(){function t(t){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=t}var e=t.prototype;return e.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},e.abort=function(){this.loader&&this.loader.abort()},e.load=function(t,e){var n=this,r=t.url;if(!r)return Promise.reject(new f({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:t,networkDetails:null},"Fragment does not have a "+(r?"part list":"url")));this.abort();var o=this.config,a=o.fLoader,s=o.loader;return new Promise((function(r,l){n.loader&&n.loader.destroy();var c=n.loader=t.loader=a?new a(o):new s(o),h=d(t),p={timeout:o.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:o.fragLoadingMaxRetryTimeout,highWaterMark:u};t.stats=c.stats,c.load(h,p,{onSuccess:function(e,i,o,a){n.resetLoader(t,c),r({frag:t,part:null,payload:e.data,networkDetails:a})},onError:function(e,r,o){n.resetLoader(t,c),l(new f({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:t,response:e,networkDetails:o}))},onAbort:function(e,r,o){n.resetLoader(t,c),l(new f({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:t,networkDetails:o}))},onTimeout:function(e,r,o){n.resetLoader(t,c),l(new f({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,networkDetails:o}))},onProgress:function(n,r,i,o){e&&e({frag:t,part:null,payload:i,networkDetails:o})}})}))},e.loadPart=function(t,e,n){var r=this;this.abort();var o=this.config,a=o.fLoader,s=o.loader;return new Promise((function(l,c){r.loader&&r.loader.destroy();var h=r.loader=t.loader=a?new a(o):new s(o),p=d(t,e),g={timeout:o.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:o.fragLoadingMaxRetryTimeout,highWaterMark:u};e.stats=h.stats,h.load(p,g,{onSuccess:function(i,o,a,s){r.resetLoader(t,h),r.updateStatsFromPart(t,e);var c={frag:t,part:e,payload:i.data,networkDetails:s};n(c),l(c)},onError:function(n,o,a){r.resetLoader(t,h),c(new f({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:t,part:e,response:n,networkDetails:a}))},onAbort:function(n,o,a){t.stats.aborted=e.stats.aborted,r.resetLoader(t,h),c(new f({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:t,part:e,networkDetails:a}))},onTimeout:function(n,o,a){r.resetLoader(t,h),c(new f({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,part:e,networkDetails:a}))}})}))},e.updateStatsFromPart=function(t,e){var n=t.stats,r=e.stats,i=r.total;if(n.loaded+=r.loaded,i){var o=Math.round(t.duration/e.duration),a=Math.min(Math.round(n.loaded/i),o),s=(o-a)*Math.round(n.loaded/a);n.total=n.loaded+s}else n.total=Math.max(n.loaded,n.total);var l=n.loading,c=r.loading;l.start?l.first+=c.first-c.start:(l.start=c.start,l.first=c.first),l.end=c.end},e.resetLoader=function(t,e){t.loader=null,this.loader===e&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),e.destroy()},t}();function d(t,e){void 0===e&&(e=null);var n=e||t,i={frag:t,part:e,responseType:"arraybuffer",url:n.url,headers:{},rangeStart:0,rangeEnd:0},o=n.byteRangeStartOffset,a=n.byteRangeEndOffset;return Object(r.isFiniteNumber)(o)&&Object(r.isFiniteNumber)(a)&&(i.rangeStart=o,i.rangeEnd=a),i}var f=function(t){var e,n;function r(e){for(var n,r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return(n=t.call.apply(t,[this].concat(i))||this).data=void 0,n.data=e,n}return n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,l(e,n),r}(o(Error))},"./src/loader/fragment.ts":
/*!********************************!*\
!*** ./src/loader/fragment.ts ***!
\********************************/
/*! exports provided: ElementaryStreamTypes, BaseSegment, Fragment, Part */function(t,e,n){"use strict";n.r(e),n.d(e,"ElementaryStreamTypes",(function(){return r})),n.d(e,"BaseSegment",(function(){return f})),n.d(e,"Fragment",(function(){return p})),n.d(e,"Part",(function(){return g}));var r,i=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),o=n(/*! url-toolkit */"./node_modules/url-toolkit/src/url-toolkit.js"),a=n(/*! ../utils/logger */"./src/utils/logger.ts"),s=n(/*! ./level-key */"./src/loader/level-key.ts"),l=n(/*! ./load-stats */"./src/loader/load-stats.ts");function c(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,u(t,e)}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function h(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function d(t,e,n){return e&&h(t.prototype,e),n&&h(t,n),t}!function(t){t.AUDIO="audio",t.VIDEO="video",t.AUDIOVIDEO="audiovideo"}(r||(r={}));var f=function(){function t(t){var e;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((e={})[r.AUDIO]=null,e[r.VIDEO]=null,e[r.AUDIOVIDEO]=null,e),this.baseurl=t}return t.prototype.setByteRange=function(t,e){var n=t.split("@",2),r=[];1===n.length?r[0]=e?e.byteRangeEndOffset:0:r[0]=parseInt(n[1]),r[1]=parseInt(n[0])+r[0],this._byteRange=r},d(t,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(o.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(t){this._url=t}}]),t}(),p=function(t){function e(e,n){var r;return(r=t.call(this,n)||this)._decryptdata=null,r.rawProgramDateTime=null,r.programDateTime=null,r.tagList=[],r.duration=0,r.sn=0,r.levelkey=void 0,r.type=void 0,r.loader=null,r.level=-1,r.cc=0,r.startPTS=void 0,r.endPTS=void 0,r.appendedPTS=void 0,r.startDTS=void 0,r.endDTS=void 0,r.start=0,r.deltaPTS=void 0,r.maxStartPTS=void 0,r.minEndPTS=void 0,r.stats=new l.LoadStats,r.urlId=0,r.data=void 0,r.bitrateTest=!1,r.title=null,r.initSegment=null,r.type=e,r}c(e,t);var n=e.prototype;return n.createInitializationVector=function(t){for(var e=new Uint8Array(16),n=12;n<16;n++)e[n]=t>>8*(15-n)&255;return e},n.setDecryptDataFromLevelKey=function(t,e){var n=t;return"AES-128"===(null==t?void 0:t.method)&&t.uri&&!t.iv&&((n=s.LevelKey.fromURI(t.uri)).method=t.method,n.iv=this.createInitializationVector(e),n.keyFormat="identity"),n},n.setElementaryStreamInfo=function(t,e,n,r,i,o){void 0===o&&(o=!1);var a=this.elementaryStreams,s=a[t];s?(s.startPTS=Math.min(s.startPTS,e),s.endPTS=Math.max(s.endPTS,n),s.startDTS=Math.min(s.startDTS,r),s.endDTS=Math.max(s.endDTS,i)):a[t]={startPTS:e,endPTS:n,startDTS:r,endDTS:i,partial:o}},n.clearElementaryStreamInfo=function(){var t=this.elementaryStreams;t[r.AUDIO]=null,t[r.VIDEO]=null,t[r.AUDIOVIDEO]=null},d(e,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var t=this.sn;"number"!=typeof t&&(this.levelkey&&"AES-128"===this.levelkey.method&&!this.levelkey.iv&&a.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),t=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,t)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(null===this.programDateTime)return null;if(!Object(i.isFiniteNumber)(this.programDateTime))return null;var t=Object(i.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+1e3*t}},{key:"encrypted",get:function(){var t;return!(null===(t=this.decryptdata)||void 0===t||!t.keyFormat||!this.decryptdata.uri)}}]),e}(f),g=function(t){function e(e,n,r,i,o){var a;(a=t.call(this,r)||this).fragOffset=0,a.duration=0,a.gap=!1,a.independent=!1,a.relurl=void 0,a.fragment=void 0,a.index=void 0,a.stats=new l.LoadStats,a.duration=e.decimalFloatingPoint("DURATION"),a.gap=e.bool("GAP"),a.independent=e.bool("INDEPENDENT"),a.relurl=e.enumeratedString("URI"),a.fragment=n,a.index=i;var s=e.enumeratedString("BYTERANGE");return s&&a.setByteRange(s,o),o&&(a.fragOffset=o.fragOffset+o.duration),a}return c(e,t),d(e,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var t=this.elementaryStreams;return!!(t.audio||t.video||t.audiovideo)}}]),e}(f)},"./src/loader/key-loader.ts":
/*!**********************************!*\
!*** ./src/loader/key-loader.ts ***!
\**********************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return a}));var r=n(/*! ../events */"./src/events.ts"),i=n(/*! ../errors */"./src/errors.ts"),o=n(/*! ../utils/logger */"./src/utils/logger.ts"),a=function(){function t(t){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=t,this._registerListeners()}var e=t.prototype;return e._registerListeners=function(){this.hls.on(r.Events.KEY_LOADING,this.onKeyLoading,this)},e._unregisterListeners=function(){this.hls.off(r.Events.KEY_LOADING,this.onKeyLoading)},e.destroy=function(){for(var t in this._unregisterListeners(),this.loaders){var e=this.loaders[t];e&&e.destroy()}this.loaders={}},e.onKeyLoading=function(t,e){var n=e.frag,i=n.type,a=this.loaders[i];if(n.decryptdata){var s=n.decryptdata.uri;if(s!==this.decrypturl||null===this.decryptkey){var l=this.hls.config;if(a&&(o.logger.warn("abort previous key loader for type:"+i),a.abort()),!s)return void o.logger.warn("key uri is falsy");var c=l.loader,u=n.loader=this.loaders[i]=new c(l);this.decrypturl=s,this.decryptkey=null;var h={url:s,frag:n,responseType:"arraybuffer"},d={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:l.fragLoadingRetryDelay,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:0},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(h,d,f)}else this.decryptkey&&(n.decryptdata.key=this.decryptkey,this.hls.trigger(r.Events.KEY_LOADED,{frag:n}))}else o.logger.warn("Missing decryption data on fragment in onKeyLoading")},e.loadsuccess=function(t,e,n){var i=n.frag;i.decryptdata?(this.decryptkey=i.decryptdata.key=new Uint8Array(t.data),i.loader=null,delete this.loaders[i.type],this.hls.trigger(r.Events.KEY_LOADED,{frag:i})):o.logger.error("after key load, decryptdata unset")},e.loaderror=function(t,e){var n=e.frag,o=n.loader;o&&o.abort(),delete this.loaders[n.type],this.hls.trigger(r.Events.ERROR,{type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:n,response:t})},e.loadtimeout=function(t,e){var n=e.frag,o=n.loader;o&&o.abort(),delete this.loaders[n.type],this.hls.trigger(r.Events.ERROR,{type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:n})},t}()},"./src/loader/level-details.ts":
/*!*************************************!*\
!*** ./src/loader/level-details.ts ***!
\*************************************/
/*! exports provided: LevelDetails */function(t,e,n){"use strict";n.r(e),n.d(e,"LevelDetails",(function(){return o}));var r=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts");function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=function(){function t(t){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=t}var e,n,o;return t.prototype.reloaded=function(t){if(!t)return this.advanced=!0,void(this.updated=!0);var e=this.lastPartSn-t.lastPartSn,n=this.lastPartIndex-t.lastPartIndex;this.updated=this.endSN!==t.endSN||!!n||!!e,this.advanced=this.endSN>t.endSN||e>0||0===e&&n>0,this.updated||this.advanced?this.misses=Math.floor(.6*t.misses):this.misses=t.misses+1,this.availabilityDelay=t.availabilityDelay},e=t,(n=[{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&Object(r.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime)}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||10}},{key:"drift",get:function(){var t=this.driftEndTime-this.driftStartTime;return t>0?1e3*(this.driftEnd-this.driftStart)/t:1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var t;return null!==(t=this.partList)&&void 0!==t&&t.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var t;return null!==(t=this.fragments)&&void 0!==t&&t.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 t;return null!==(t=this.partList)&&void 0!==t&&t.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var t;return null!==(t=this.partList)&&void 0!==t&&t.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}])&&i(e.prototype,n),o&&i(e,o),t}()},"./src/loader/level-key.ts":
/*!*********************************!*\
!*** ./src/loader/level-key.ts ***!
\*********************************/
/*! exports provided: LevelKey */function(t,e,n){"use strict";n.r(e),n.d(e,"LevelKey",(function(){return o}));var r=n(/*! url-toolkit */"./node_modules/url-toolkit/src/url-toolkit.js");function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=function(){function t(t,e){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,this._uri=e?Object(r.buildAbsoluteURL)(t,e,{alwaysNormalize:!0}):t}var e,n,o;return t.fromURL=function(e,n){return new t(e,n)},t.fromURI=function(e){return new t(e)},e=t,(n=[{key:"uri",get:function(){return this._uri}}])&&i(e.prototype,n),o&&i(e,o),t}()},"./src/loader/load-stats.ts":
/*!**********************************!*\
!*** ./src/loader/load-stats.ts ***!
\**********************************/
/*! exports provided: LoadStats */function(t,e,n){"use strict";n.r(e),n.d(e,"LoadStats",(function(){return r}));var r=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":
/*!***********************************!*\
!*** ./src/loader/m3u8-parser.ts ***!
\***********************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return m}));var r=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=n(/*! url-toolkit */"./node_modules/url-toolkit/src/url-toolkit.js"),o=n(/*! ./fragment */"./src/loader/fragment.ts"),a=n(/*! ./level-details */"./src/loader/level-details.ts"),s=n(/*! ./level-key */"./src/loader/level-key.ts"),l=n(/*! ../utils/attr-list */"./src/utils/attr-list.ts"),c=n(/*! ../utils/logger */"./src/utils/logger.ts"),u=n(/*! ../utils/codecs */"./src/utils/codecs.ts"),h=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,d=/#EXT-X-MEDIA:(.*)/g,f=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),p=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("|")),g=/\.(mp4|m4s|m4v|m4a)$/i,m=function(){function t(){}return t.findGroup=function(t,e){for(var n=0;n<t.length;n++){var r=t[n];if(r.id===e)return r}},t.convertAVC1ToAVCOTI=function(t){var e=t.split(".");if(e.length>2){var n=e.shift()+".";return n+=parseInt(e.shift()).toString(16),n+=("000"+parseInt(e.shift()).toString(16)).substr(-4)}return t},t.resolve=function(t,e){return i.buildAbsoluteURL(e,t,{alwaysNormalize:!0})},t.parseMasterPlaylist=function(e,n){var r,i=[],o={},a=!1;for(h.lastIndex=0;null!=(r=h.exec(e));)if(r[1]){var s=new l.AttrList(r[1]),c={attrs:s,bitrate:s.decimalInteger("AVERAGE-BANDWIDTH")||s.decimalInteger("BANDWIDTH"),name:s.NAME,url:t.resolve(r[2],n)},u=s.decimalResolution("RESOLUTION");u&&(c.width=u.width,c.height=u.height),v((s.CODECS||"").split(/[ ,]+/).filter((function(t){return t})),c),c.videoCodec&&-1!==c.videoCodec.indexOf("avc1")&&(c.videoCodec=t.convertAVC1ToAVCOTI(c.videoCodec)),i.push(c)}else if(r[3]){var d=new l.AttrList(r[3]);d["DATA-ID"]&&(a=!0,o[d["DATA-ID"]]=d)}return{levels:i,sessionData:a?o:null}},t.parseMasterPlaylistMedia=function(e,n,r,i){var o;void 0===i&&(i=[]);var a=[],s=0;for(d.lastIndex=0;null!==(o=d.exec(e));){var c=new l.AttrList(o[1]);if(c.TYPE===r){var u={attrs:c,bitrate:0,id:s++,groupId:c["GROUP-ID"],instreamId:c["INSTREAM-ID"],name:c.NAME||c.LANGUAGE||"",type:r,default:c.bool("DEFAULT"),autoselect:c.bool("AUTOSELECT"),forced:c.bool("FORCED"),lang:c.LANGUAGE,url:c.URI?t.resolve(c.URI,n):""};if(i.length){var h=t.findGroup(i,u.groupId)||i[0];y(u,h,"audioCodec"),y(u,h,"textCodec")}a.push(u)}}return a},t.parseLevelPlaylist=function(t,e,n,u,h){var d,m,v,y=new a.LevelDetails(e),x=y.fragments,C=null,S=0,E=0,k=0,w=0,T=null,O=new o.Fragment(u,e),L=-1,A=!1;for(f.lastIndex=0,y.m3u8=t;null!==(d=f.exec(t));){A&&(A=!1,(O=new o.Fragment(u,e)).start=k,O.sn=S,O.cc=w,O.level=n,C&&(O.initSegment=C,O.rawProgramDateTime=C.rawProgramDateTime));var D=d[1];if(D){O.duration=parseFloat(D);var R=(" "+d[2]).slice(1);O.title=R||null,O.tagList.push(R?["INF",D,R]:["INF",D])}else if(d[3])Object(r.isFiniteNumber)(O.duration)&&(O.start=k,v&&(O.levelkey=v),O.sn=S,O.level=n,O.cc=w,O.urlId=h,x.push(O),O.relurl=(" "+d[3]).slice(1),b(O,T),T=O,k+=O.duration,S++,E=0,A=!0);else if(d[4]){var M=(" "+d[4]).slice(1);T?O.setByteRange(M,T):O.setByteRange(M)}else if(d[5])O.rawProgramDateTime=(" "+d[5]).slice(1),O.tagList.push(["PROGRAM-DATE-TIME",O.rawProgramDateTime]),-1===L&&(L=x.length);else{if(!(d=d[0].match(p))){c.logger.warn("No matches on slow regex match for level playlist!");continue}for(m=1;m<d.length&&void 0===d[m];m++);var I=(" "+d[m]).slice(1),_=(" "+d[m+1]).slice(1),P=d[m+2]?(" "+d[m+2]).slice(1):"";switch(I){case"PLAYLIST-TYPE":y.type=_.toUpperCase();break;case"MEDIA-SEQUENCE":S=y.startSN=parseInt(_);break;case"SKIP":var N=new l.AttrList(_),j=N.decimalInteger("SKIPPED-SEGMENTS");if(Object(r.isFiniteNumber)(j)){y.skippedSegments=j;for(var F=j;F--;)x.unshift(null);S+=j}var B=N.enumeratedString("RECENTLY-REMOVED-DATERANGES");B&&(y.recentlyRemovedDateranges=B.split("\t"));break;case"TARGETDURATION":y.targetduration=parseFloat(_);break;case"VERSION":y.version=parseInt(_);break;case"EXTM3U":break;case"ENDLIST":y.live=!1;break;case"#":(_||P)&&O.tagList.push(P?[_,P]:[_]);break;case"DIS":w++;case"GAP":O.tagList.push([I]);break;case"BITRATE":O.tagList.push([I,_]);break;case"DISCONTINUITY-SEQ":w=parseInt(_);break;case"KEY":var U,H=new l.AttrList(_),z=H.enumeratedString("METHOD"),G=H.URI,V=H.hexadecimalInteger("IV"),W=H.enumeratedString("KEYFORMATVERSIONS"),K=H.enumeratedString("KEYID"),q=null!=(U=H.enumeratedString("KEYFORMAT"))?U:"identity";if(["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"].indexOf(q)>-1){c.logger.warn("Keyformat "+q+" is not supported from the manifest");continue}if("identity"!==q)continue;z&&(v=s.LevelKey.fromURL(e,G),G&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(z)>=0&&(v.method=z,v.keyFormat=q,K&&(v.keyID=K),W&&(v.keyFormatVersions=W),v.iv=V));break;case"START":var Y=new l.AttrList(_).decimalFloatingPoint("TIME-OFFSET");Object(r.isFiniteNumber)(Y)&&(y.startTimeOffset=Y);break;case"MAP":var X=new l.AttrList(_);O.relurl=X.URI,X.BYTERANGE&&O.setByteRange(X.BYTERANGE),O.level=n,O.sn="initSegment",v&&(O.levelkey=v),O.initSegment=null,C=O,A=!0;break;case"SERVER-CONTROL":var $=new l.AttrList(_);y.canBlockReload=$.bool("CAN-BLOCK-RELOAD"),y.canSkipUntil=$.optionalFloat("CAN-SKIP-UNTIL",0),y.canSkipDateRanges=y.canSkipUntil>0&&$.bool("CAN-SKIP-DATERANGES"),y.partHoldBack=$.optionalFloat("PART-HOLD-BACK",0),y.holdBack=$.optionalFloat("HOLD-BACK",0);break;case"PART-INF":var Z=new l.AttrList(_);y.partTarget=Z.decimalFloatingPoint("PART-TARGET");break;case"PART":var J=y.partList;J||(J=y.partList=[]);var Q=E>0?J[J.length-1]:void 0,tt=E++,et=new o.Part(new l.AttrList(_),O,e,tt,Q);J.push(et),O.duration+=et.duration;break;case"PRELOAD-HINT":var nt=new l.AttrList(_);y.preloadHint=nt;break;case"RENDITION-REPORT":var rt=new l.AttrList(_);y.renditionReports=y.renditionReports||[],y.renditionReports.push(rt);break;default:c.logger.warn("line parsed but not handled: "+d)}}}T&&!T.relurl?(x.pop(),k-=T.duration,y.partList&&(y.fragmentHint=T)):y.partList&&(b(O,T),O.cc=w,y.fragmentHint=O);var it=x.length,ot=x[0],at=x[it-1];if((k+=y.skippedSegments*y.targetduration)>0&&it&&at){y.averagetargetduration=k/it;var st=at.sn;y.endSN="initSegment"!==st?st:0,ot&&(y.startCC=ot.cc,ot.initSegment||y.fragments.every((function(t){return t.relurl&&(e=t.relurl,g.test(null!=(n=null===(r=i.parseURL(e))||void 0===r?void 0:r.path)?n:""));var e,n,r}))&&(c.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),(O=new o.Fragment(u,e)).relurl=at.relurl,O.level=n,O.sn="initSegment",ot.initSegment=O,y.needSidxRanges=!0))}else y.endSN=0,y.startCC=0;return y.fragmentHint&&(k+=y.fragmentHint.duration),y.totalduration=k,y.endCC=w,L>0&&function(t,e){for(var n=t[e],r=e;r--;){var i=t[r];if(!i)return;i.programDateTime=n.programDateTime-1e3*i.duration,n=i}}(x,L),y},t}();function v(t,e){["video","audio","text"].forEach((function(n){var r=t.filter((function(t){return Object(u.isCodecType)(t,n)}));if(r.length){var i=r.filter((function(t){return 0===t.lastIndexOf("avc1",0)||0===t.lastIndexOf("mp4a",0)}));e[n+"Codec"]=i.length>0?i[0]:r[0],t=t.filter((function(t){return-1===r.indexOf(t)}))}})),e.unknownCodecs=t}function y(t,e,n){var r=e[n];r&&(t[n]=r)}function b(t,e){t.rawProgramDateTime?t.programDateTime=Date.parse(t.rawProgramDateTime):null!=e&&e.programDateTime&&(t.programDateTime=e.endProgramDateTime),Object(r.isFiniteNumber)(t.programDateTime)||(t.programDateTime=null,t.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":
/*!***************************************!*\
!*** ./src/loader/playlist-loader.ts ***!
\***************************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e);var r=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=n(/*! ../events */"./src/events.ts"),o=n(/*! ../errors */"./src/errors.ts"),a=n(/*! ../utils/logger */"./src/utils/logger.ts"),s=n(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),l=n(/*! ./m3u8-parser */"./src/loader/m3u8-parser.ts"),c=n(/*! ../types/loader */"./src/types/loader.ts"),u=n(/*! ../utils/attr-list */"./src/utils/attr-list.ts");function h(t,e){var n=t.url;return void 0!==n&&0!==n.indexOf("data:")||(n=e.url),n}var d=function(){function t(t){this.hls=void 0,this.loaders=Object.create(null),this.hls=t,this.registerListeners()}var e=t.prototype;return e.registerListeners=function(){var t=this.hls;t.on(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(i.Events.LEVEL_LOADING,this.onLevelLoading,this),t.on(i.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.on(i.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},e.unregisterListeners=function(){var t=this.hls;t.off(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(i.Events.LEVEL_LOADING,this.onLevelLoading,this),t.off(i.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.off(i.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},e.createInternalLoader=function(t){var e=this.hls.config,n=e.pLoader,r=e.loader,i=new(n||r)(e);return t.loader=i,this.loaders[t.type]=i,i},e.getInternalLoader=function(t){return this.loaders[t.type]},e.resetInternalLoader=function(t){this.loaders[t]&&delete this.loaders[t]},e.destroyInternalLoaders=function(){for(var t in this.loaders){var e=this.loaders[t];e&&e.destroy(),this.resetInternalLoader(t)}},e.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},e.onManifestLoading=function(t,e){var n=e.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:c.PlaylistContextType.MANIFEST,url:n,deliveryDirectives:null})},e.onLevelLoading=function(t,e){var n=e.id,r=e.level,i=e.url,o=e.deliveryDirectives;this.load({id:n,groupId:null,level:r,responseType:"text",type:c.PlaylistContextType.LEVEL,url:i,deliveryDirectives:o})},e.onAudioTrackLoading=function(t,e){var n=e.id,r=e.groupId,i=e.url,o=e.deliveryDirectives;this.load({id:n,groupId:r,level:null,responseType:"text",type:c.PlaylistContextType.AUDIO_TRACK,url:i,deliveryDirectives:o})},e.onSubtitleTrackLoading=function(t,e){var n=e.id,r=e.groupId,i=e.url,o=e.deliveryDirectives;this.load({id:n,groupId:r,level:null,responseType:"text",type:c.PlaylistContextType.SUBTITLE_TRACK,url:i,deliveryDirectives:o})},e.load=function(t){var e,n,r,i,o,s,l=this.hls.config,u=this.getInternalLoader(t);if(u){var h=u.context;if(h&&h.url===t.url)return void a.logger.trace("[playlist-loader]: playlist request ongoing");a.logger.log("[playlist-loader]: aborting previous loader for type: "+t.type),u.abort()}switch(t.type){case c.PlaylistContextType.MANIFEST:n=l.manifestLoadingMaxRetry,r=l.manifestLoadingTimeOut,i=l.manifestLoadingRetryDelay,o=l.manifestLoadingMaxRetryTimeout;break;case c.PlaylistContextType.LEVEL:case c.PlaylistContextType.AUDIO_TRACK:case c.PlaylistContextType.SUBTITLE_TRACK:n=0,r=l.levelLoadingTimeOut;break;default:n=l.levelLoadingMaxRetry,r=l.levelLoadingTimeOut,i=l.levelLoadingRetryDelay,o=l.levelLoadingMaxRetryTimeout}if(u=this.createInternalLoader(t),null!==(e=t.deliveryDirectives)&&void 0!==e&&e.part&&(t.type===c.PlaylistContextType.LEVEL&&null!==t.level?s=this.hls.levels[t.level].details:t.type===c.PlaylistContextType.AUDIO_TRACK&&null!==t.id?s=this.hls.audioTracks[t.id].details:t.type===c.PlaylistContextType.SUBTITLE_TRACK&&null!==t.id&&(s=this.hls.subtitleTracks[t.id].details),s)){var d=s.partTarget,f=s.targetduration;d&&f&&(r=Math.min(1e3*Math.max(3*d,.8*f),r))}var p={timeout:r,maxRetry:n,retryDelay:i,maxRetryDelay:o,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(t,p,g)},e.loadsuccess=function(t,e,n,r){if(void 0===r&&(r=null),n.isSidxRequest)return this.handleSidxRequest(t,n),void this.handlePlaylistLoaded(t,e,n,r);this.resetInternalLoader(n.type);var i=t.data;0===i.indexOf("#EXTM3U")?(e.parsing.start=performance.now(),i.indexOf("#EXTINF:")>0||i.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(t,e,n,r):this.handleMasterPlaylist(t,e,n,r)):this.handleManifestParsingError(t,n,"no EXTM3U delimiter",r)},e.loaderror=function(t,e,n){void 0===n&&(n=null),this.handleNetworkError(e,n,!1,t)},e.loadtimeout=function(t,e,n){void 0===n&&(n=null),this.handleNetworkError(e,n,!0)},e.handleMasterPlaylist=function(t,e,n,r){var o=this.hls,s=t.data,c=h(t,n),d=l.default.parseMasterPlaylist(s,c),f=d.levels,p=d.sessionData;if(f.length){var g=f.map((function(t){return{id:t.attrs.AUDIO,audioCodec:t.audioCodec}})),m=f.map((function(t){return{id:t.attrs.SUBTITLES,textCodec:t.textCodec}})),v=l.default.parseMasterPlaylistMedia(s,c,"AUDIO",g),y=l.default.parseMasterPlaylistMedia(s,c,"SUBTITLES",m),b=l.default.parseMasterPlaylistMedia(s,c,"CLOSED-CAPTIONS");v.length&&(v.some((function(t){return!t.url}))||!f[0].audioCodec||f[0].attrs.AUDIO||(a.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),v.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new u.AttrList({}),bitrate:0,url:""}))),o.trigger(i.Events.MANIFEST_LOADED,{levels:f,audioTracks:v,subtitles:y,captions:b,url:c,stats:e,networkDetails:r,sessionData:p})}else this.handleManifestParsingError(t,n,"no level found in manifest",r)},e.handleTrackOrLevelPlaylist=function(t,e,n,a){var s=this.hls,d=n.id,f=n.level,p=n.type,g=h(t,n),m=Object(r.isFiniteNumber)(d)?d:0,v=Object(r.isFiniteNumber)(f)?f:m,y=function(t){switch(t.type){case c.PlaylistContextType.AUDIO_TRACK:return c.PlaylistLevelType.AUDIO;case c.PlaylistContextType.SUBTITLE_TRACK:return c.PlaylistLevelType.SUBTITLE;default:return c.PlaylistLevelType.MAIN}}(n),b=l.default.parseLevelPlaylist(t.data,g,v,y,m);if(b.fragments.length){if(p===c.PlaylistContextType.MANIFEST){var x={attrs:new u.AttrList({}),bitrate:0,details:b,name:"",url:g};s.trigger(i.Events.MANIFEST_LOADED,{levels:[x],audioTracks:[],url:g,stats:e,networkDetails:a,sessionData:null})}if(e.parsing.end=performance.now(),b.needSidxRanges){var C,S=null===(C=b.fragments[0].initSegment)||void 0===C?void 0:C.url;this.load({url:S,isSidxRequest:!0,type:p,level:f,levelDetails:b,id:d,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null})}else n.levelDetails=b,this.handlePlaylistLoaded(t,e,n,a)}else s.trigger(i.Events.ERROR,{type:o.ErrorTypes.NETWORK_ERROR,details:o.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:g,reason:"no fragments found in level",level:"number"==typeof n.level?n.level:void 0})},e.handleSidxRequest=function(t,e){var n=Object(s.parseSegmentIndex)(new Uint8Array(t.data));if(n){var r=n.references,i=e.levelDetails;r.forEach((function(t,e){var r=t.info,o=i.fragments[e];0===o.byteRange.length&&o.setByteRange(String(1+r.end-r.start)+"@"+String(r.start)),o.initSegment&&o.initSegment.setByteRange(String(n.moovEndOffset)+"@0")}))}},e.handleManifestParsingError=function(t,e,n,r){this.hls.trigger(i.Events.ERROR,{type:o.ErrorTypes.NETWORK_ERROR,details:o.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:e.type===c.PlaylistContextType.MANIFEST,url:t.url,reason:n,response:t,context:e,networkDetails:r})},e.handleNetworkError=function(t,e,n,r){void 0===n&&(n=!1),a.logger.warn("[playlist-loader]: A network "+(n?"timeout":"error")+" occurred while loading "+t.type+" level: "+t.level+" id: "+t.id+' group-id: "'+t.groupId+'"');var s=o.ErrorDetails.UNKNOWN,l=!1,u=this.getInternalLoader(t);switch(t.type){case c.PlaylistContextType.MANIFEST:s=n?o.ErrorDetails.MANIFEST_LOAD_TIMEOUT:o.ErrorDetails.MANIFEST_LOAD_ERROR,l=!0;break;case c.PlaylistContextType.LEVEL:s=n?o.ErrorDetails.LEVEL_LOAD_TIMEOUT:o.ErrorDetails.LEVEL_LOAD_ERROR,l=!1;break;case c.PlaylistContextType.AUDIO_TRACK:s=n?o.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:o.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case c.PlaylistContextType.SUBTITLE_TRACK:s=n?o.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:o.ErrorDetails.SUBTITLE_LOAD_ERROR,l=!1}u&&this.resetInternalLoader(t.type);var h={type:o.ErrorTypes.NETWORK_ERROR,details:s,fatal:l,url:t.url,loader:u,context:t,networkDetails:e};r&&(h.response=r),this.hls.trigger(i.Events.ERROR,h)},e.handlePlaylistLoaded=function(t,e,n,r){var o=n.type,a=n.level,s=n.id,l=n.groupId,u=n.loader,h=n.levelDetails,d=n.deliveryDirectives;if(null!=h&&h.targetduration){if(u)switch(h.live&&(u.getCacheAge&&(h.ageHeader=u.getCacheAge()||0),u.getCacheAge&&!isNaN(h.ageHeader)||(h.ageHeader=0)),o){case c.PlaylistContextType.MANIFEST:case c.PlaylistContextType.LEVEL:this.hls.trigger(i.Events.LEVEL_LOADED,{details:h,level:a||0,id:s||0,stats:e,networkDetails:r,deliveryDirectives:d});break;case c.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(i.Events.AUDIO_TRACK_LOADED,{details:h,id:s||0,groupId:l||"",stats:e,networkDetails:r,deliveryDirectives:d});break;case c.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(i.Events.SUBTITLE_TRACK_LOADED,{details:h,id:s||0,groupId:l||"",stats:e,networkDetails:r,deliveryDirectives:d})}}else this.handleManifestParsingError(t,n,"invalid target duration",r)},t}();e.default=d},"./src/polyfills/number.ts":
/*!*********************************!*\
!*** ./src/polyfills/number.ts ***!
\*********************************/
/*! exports provided: isFiniteNumber, MAX_SAFE_INTEGER */function(t,e,n){"use strict";n.r(e),n.d(e,"isFiniteNumber",(function(){return r})),n.d(e,"MAX_SAFE_INTEGER",(function(){return i}));var r=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},i=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":
/*!*********************************!*\
!*** ./src/remux/aac-helper.ts ***!
\*********************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e);var r=function(){function t(){}return t.getSilentFrame=function(t,e){switch(t){case"mp4a.40.2":if(1===e)return new Uint8Array([0,200,0,128,35,128]);if(2===e)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===e)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(6===e)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(1===e)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(2===e)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(3===e)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])}},t}();e.default=r},"./src/remux/mp4-generator.ts":
/*!************************************!*\
!*** ./src/remux/mp4-generator.ts ***!
\************************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e);var r=Math.pow(2,32)-1,i=function(){function t(){}return t.init=function(){var e;for(e in t.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:[]},t.types)t.types.hasOwnProperty(e)&&(t.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);var n=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]),r=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]);t.HDLR_TYPES={video:n,audio:r};var i=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]);t.STTS=t.STSC=t.STCO=o,t.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),t.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),t.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),t.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var a=new Uint8Array([105,115,111,109]),s=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);t.FTYP=t.box(t.types.ftyp,a,l,a,s),t.DINF=t.box(t.types.dinf,t.box(t.types.dref,i))},t.box=function(t){for(var e=8,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];for(var o=r.length,a=o;o--;)e+=r[o].byteLength;var s=new Uint8Array(e);for(s[0]=e>>24&255,s[1]=e>>16&255,s[2]=e>>8&255,s[3]=255&e,s.set(t,4),o=0,e=8;o<a;o++)s.set(r[o],e),e+=r[o].byteLength;return s},t.hdlr=function(e){return t.box(t.types.hdlr,t.HDLR_TYPES[e])},t.mdat=function(e){return t.box(t.types.mdat,e)},t.mdhd=function(e,n){n*=e;var i=Math.floor(n/(r+1)),o=Math.floor(n%(r+1));return t.box(t.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,o>>24,o>>16&255,o>>8&255,255&o,85,196,0,0]))},t.mdia=function(e){return t.box(t.types.mdia,t.mdhd(e.timescale,e.duration),t.hdlr(e.type),t.minf(e))},t.mfhd=function(e){return t.box(t.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))},t.minf=function(e){return"audio"===e.type?t.box(t.types.minf,t.box(t.types.smhd,t.SMHD),t.DINF,t.stbl(e)):t.box(t.types.minf,t.box(t.types.vmhd,t.VMHD),t.DINF,t.stbl(e))},t.moof=function(e,n,r){return t.box(t.types.moof,t.mfhd(e),t.traf(r,n))},t.moov=function(e){for(var n=e.length,r=[];n--;)r[n]=t.trak(e[n]);return t.box.apply(null,[t.types.moov,t.mvhd(e[0].timescale,e[0].duration)].concat(r).concat(t.mvex(e)))},t.mvex=function(e){for(var n=e.length,r=[];n--;)r[n]=t.trex(e[n]);return t.box.apply(null,[t.types.mvex].concat(r))},t.mvhd=function(e,n){n*=e;var i=Math.floor(n/(r+1)),o=Math.floor(n%(r+1)),a=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,o>>24,o>>16&255,o>>8&255,255&o,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 t.box(t.types.mvhd,a)},t.sdtp=function(e){var n,r,i=e.samples||[],o=new Uint8Array(4+i.length);for(n=0;n<i.length;n++)r=i[n].flags,o[n+4]=r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy;return t.box(t.types.sdtp,o)},t.stbl=function(e){return t.box(t.types.stbl,t.stsd(e),t.box(t.types.stts,t.STTS),t.box(t.types.stsc,t.STSC),t.box(t.types.stsz,t.STSZ),t.box(t.types.stco,t.STCO))},t.avc1=function(e){var n,r,i,o=[],a=[];for(n=0;n<e.sps.length;n++)i=(r=e.sps[n]).byteLength,o.push(i>>>8&255),o.push(255&i),o=o.concat(Array.prototype.slice.call(r));for(n=0;n<e.pps.length;n++)i=(r=e.pps[n]).byteLength,a.push(i>>>8&255),a.push(255&i),a=a.concat(Array.prototype.slice.call(r));var s=t.box(t.types.avcC,new Uint8Array([1,o[3],o[4],o[5],255,224|e.sps.length].concat(o).concat([e.pps.length]).concat(a))),l=e.width,c=e.height,u=e.pixelRatio[0],h=e.pixelRatio[1];return t.box(t.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,l>>8&255,255&l,c>>8&255,255&c,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]),s,t.box(t.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),t.box(t.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,h>>24,h>>16&255,h>>8&255,255&h])))},t.esds=function(t){var e=t.config.length;return new Uint8Array([0,0,0,0,3,23+e,0,1,0,4,15+e,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([e]).concat(t.config).concat([6,1,2]))},t.mp4a=function(e){var n=e.samplerate;return t.box(t.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,n>>8&255,255&n,0,0]),t.box(t.types.esds,t.esds(e)))},t.mp3=function(e){var n=e.samplerate;return t.box(t.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,n>>8&255,255&n,0,0]))},t.stsd=function(e){return"audio"===e.type?e.isAAC||"mp3"!==e.codec?t.box(t.types.stsd,t.STSD,t.mp4a(e)):t.box(t.types.stsd,t.STSD,t.mp3(e)):t.box(t.types.stsd,t.STSD,t.avc1(e))},t.tkhd=function(e){var n=e.id,i=e.duration*e.timescale,o=e.width,a=e.height,s=Math.floor(i/(r+1)),l=Math.floor(i%(r+1));return t.box(t.types.tkhd,new Uint8Array([1,0,0,7,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,255&n,0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,l>>24,l>>16&255,l>>8&255,255&l,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,o>>8&255,255&o,0,0,a>>8&255,255&a,0,0]))},t.traf=function(e,n){var i=t.sdtp(e),o=e.id,a=Math.floor(n/(r+1)),s=Math.floor(n%(r+1));return t.box(t.types.traf,t.box(t.types.tfhd,new Uint8Array([0,0,0,0,o>>24,o>>16&255,o>>8&255,255&o])),t.box(t.types.tfdt,new Uint8Array([1,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,s>>24,s>>16&255,s>>8&255,255&s])),t.trun(e,i.length+16+20+8+16+8+8),i)},t.trak=function(e){return e.duration=e.duration||4294967295,t.box(t.types.trak,t.tkhd(e),t.mdia(e))},t.trex=function(e){var n=e.id;return t.box(t.types.trex,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},t.trun=function(e,n){var r,i,o,a,s,l,c=e.samples||[],u=c.length,h=12+16*u,d=new Uint8Array(h);for(n+=8+h,d.set([0,0,15,1,u>>>24&255,u>>>16&255,u>>>8&255,255&u,n>>>24&255,n>>>16&255,n>>>8&255,255&n],0),r=0;r<u;r++)o=(i=c[r]).duration,a=i.size,s=i.flags,l=i.cts,d.set([o>>>24&255,o>>>16&255,o>>>8&255,255&o,a>>>24&255,a>>>16&255,a>>>8&255,255&a,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.paddingValue<<1|s.isNonSync,61440&s.degradPrio,15&s.degradPrio,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*r);return t.box(t.types.trun,d)},t.initSegment=function(e){t.types||t.init();var n=t.moov(e),r=new Uint8Array(t.FTYP.byteLength+n.byteLength);return r.set(t.FTYP),r.set(n,t.FTYP.byteLength),r},t}();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,e.default=i},"./src/remux/mp4-remuxer.ts":
/*!**********************************!*\
!*** ./src/remux/mp4-remuxer.ts ***!
\**********************************/
/*! exports provided: default, normalizePts */function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return g})),n.d(e,"normalizePts",(function(){return m}));var r=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=n(/*! ./aac-helper */"./src/remux/aac-helper.ts"),o=n(/*! ./mp4-generator */"./src/remux/mp4-generator.ts"),a=n(/*! ../events */"./src/events.ts"),s=n(/*! ../errors */"./src/errors.ts"),l=n(/*! ../utils/logger */"./src/utils/logger.ts"),c=n(/*! ../types/loader */"./src/types/loader.ts"),u=n(/*! ../utils/timescale-conversion */"./src/utils/timescale-conversion.ts");function h(){return(h=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}var d=null,f=null,p=!1,g=function(){function t(t,e,n,r){if(void 0===r&&(r=""),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=t,this.config=e,this.typeSupported=n,this.ISGenerated=!1,null===d){var i=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);d=i?parseInt(i[1]):0}if(null===f){var o=navigator.userAgent.match(/Safari\/(\d+)/i);f=o?parseInt(o[1]):0}p=!!d&&d<75||!!f&&f<600}var e=t.prototype;return e.destroy=function(){},e.resetTimeStamp=function(t){l.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=t},e.resetNextTimestamp=function(){l.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},e.resetInitSegment=function(){l.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},e.getVideoStartPts=function(t){var e=!1,n=t.reduce((function(t,n){var r=n.pts-t;return r<-4294967296?(e=!0,m(t,n.pts)):r>0?t:n.pts}),t[0].pts);return e&&l.logger.debug("PTS rollover detected"),n},e.remux=function(t,e,n,r,i,o,a,s){var u,h,d,f,p,g,v=i,y=i,b=t.pid>-1,x=e.pid>-1,C=e.samples.length,S=t.samples.length>0,E=C>1;if((!b||S)&&(!x||E)||this.ISGenerated||a){this.ISGenerated||(d=this.generateIS(t,e,i));var k=this.isVideoContiguous,w=-1;if(E&&(w=function(t){for(var e=0;e<t.length;e++)if(t[e].key)return e;return-1}(e.samples),!k&&this.config.forceKeyFrameOnDiscontinuity))if(g=!0,w>0){l.logger.warn("[mp4-remuxer]: Dropped "+w+" out of "+C+" video samples due to a missing keyframe");var T=this.getVideoStartPts(e.samples);e.samples=e.samples.slice(w),e.dropped+=w,y+=(e.samples[0].pts-T)/(e.timescale||9e4)}else-1===w&&(l.logger.warn("[mp4-remuxer]: No keyframe found out of "+C+" video samples"),g=!1);if(this.ISGenerated){if(S&&E){var O=this.getVideoStartPts(e.samples),L=(m(t.samples[0].pts,O)-O)/e.inputTimeScale;v+=Math.max(0,L),y+=Math.max(0,-L)}if(S){if(t.samplerate||(l.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),d=this.generateIS(t,e,i)),h=this.remuxAudio(t,v,this.isAudioContiguous,o,x||E||s===c.PlaylistLevelType.AUDIO?y:void 0),E){var A=h?h.endPTS-h.startPTS:0;e.inputTimeScale||(l.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),d=this.generateIS(t,e,i)),u=this.remuxVideo(e,y,k,A)}}else E&&(u=this.remuxVideo(e,y,k,0));u&&(u.firstKeyFrame=w,u.independent=-1!==w)}}return this.ISGenerated&&(n.samples.length&&(p=this.remuxID3(n,i)),r.samples.length&&(f=this.remuxText(r,i))),{audio:h,video:u,initSegment:d,independent:g,text:f,id3:p}},e.generateIS=function(t,e,n){var i,a,s,l=t.samples,c=e.samples,u=this.typeSupported,h={},d=!Object(r.isFiniteNumber)(this._initPTS),f="audio/mp4";if(d&&(i=a=1/0),t.config&&l.length&&(t.timescale=t.samplerate,t.isAAC||(u.mpeg?(f="audio/mpeg",t.codec=""):u.mp3&&(t.codec="mp3")),h.audio={id:"audio",container:f,codec:t.codec,initSegment:!t.isAAC&&u.mpeg?new Uint8Array(0):o.default.initSegment([t]),metadata:{channelCount:t.channelCount}},d&&(s=t.inputTimeScale,i=a=l[0].pts-Math.round(s*n))),e.sps&&e.pps&&c.length&&(e.timescale=e.inputTimeScale,h.video={id:"main",container:"video/mp4",codec:e.codec,initSegment:o.default.initSegment([e]),metadata:{width:e.width,height:e.height}},d)){s=e.inputTimeScale;var p=this.getVideoStartPts(c),g=Math.round(s*n);a=Math.min(a,m(c[0].dts,p)-g),i=Math.min(i,p-g)}if(Object.keys(h).length)return this.ISGenerated=!0,d&&(this._initPTS=i,this._initDTS=a),{tracks:h,initPTS:i,timescale:s}},e.remuxVideo=function(t,e,n,r){var i,c,f,g=t.inputTimeScale,y=t.samples,b=[],x=y.length,C=this._initPTS,S=this.nextAvcDts,E=8,k=Number.POSITIVE_INFINITY,w=Number.NEGATIVE_INFINITY,T=0,O=!1;n&&null!==S||(S=e*g-(y[0].pts-m(y[0].dts,y[0].pts)));for(var L=0;L<x;L++){var A=y[L];A.pts=m(A.pts-C,S),A.dts=m(A.dts-C,S),A.dts>A.pts&&(T=Math.max(Math.min(T,A.pts-A.dts),-18e3)),A.dts<y[L>0?L-1:L].dts&&(O=!0)}O&&y.sort((function(t,e){var n=t.dts-e.dts,r=t.pts-e.pts;return n||r})),c=y[0].dts,f=y[y.length-1].dts;var D=Math.round((f-c)/(x-1));if(T<0){if(T<-2*D){l.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(u.toMsFromMpegTsClock)(-D,!0)+" ms");for(var R=T,M=0;M<x;M++)y[M].dts=R=Math.max(R,y[M].pts-D),y[M].pts=Math.max(R,y[M].pts)}else{l.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(u.toMsFromMpegTsClock)(T,!0)+" ms to overcome this issue");for(var I=0;I<x;I++)y[I].dts=y[I].dts+T}c=y[0].dts}if(n){var _=c-S,P=_>D;if(P||_<-1){P?l.logger.warn("AVC: "+Object(u.toMsFromMpegTsClock)(_,!0)+" ms ("+_+"dts) hole between fragments detected, filling it"):l.logger.warn("AVC: "+Object(u.toMsFromMpegTsClock)(-_,!0)+" ms ("+_+"dts) overlapping between fragments detected"),c=S;var N=y[0].pts-_;y[0].dts=c,y[0].pts=N,l.logger.log("Video: First PTS/DTS adjusted: "+Object(u.toMsFromMpegTsClock)(N,!0)+"/"+Object(u.toMsFromMpegTsClock)(c,!0)+", delta: "+Object(u.toMsFromMpegTsClock)(_,!0)+" ms")}}p&&(c=Math.max(0,c));for(var j=0,F=0,B=0;B<x;B++){for(var U=y[B],H=U.units,z=H.length,G=0,V=0;V<z;V++)G+=H[V].data.length;F+=G,j+=z,U.length=G,U.dts=Math.max(U.dts,c),U.pts=Math.max(U.pts,U.dts,0),k=Math.min(U.pts,k),w=Math.max(U.pts,w)}f=y[x-1].dts;var W,K=F+4*j+8;try{W=new Uint8Array(K)}catch(t){return void this.observer.emit(a.Events.ERROR,a.Events.ERROR,{type:s.ErrorTypes.MUX_ERROR,details:s.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:K,reason:"fail allocating video mdat "+K})}var q=new DataView(W.buffer);q.setUint32(0,K),W.set(o.default.types.mdat,4);for(var Y=0;Y<x;Y++){for(var X=y[Y],$=X.units,Z=0,J=0,Q=$.length;J<Q;J++){var tt=$[J],et=tt.data,nt=tt.data.byteLength;q.setUint32(E,nt),E+=4,W.set(et,E),E+=nt,Z+=4+nt}if(Y<x-1)i=y[Y+1].dts-X.dts;else{var rt=this.config,it=X.dts-y[Y>0?Y-1:Y].dts;if(rt.stretchShortVideoTrack&&null!==this.nextAudioPts){var ot=Math.floor(rt.maxBufferHole*g),at=(r?k+r*g:this.nextAudioPts)-X.pts;at>ot?((i=at-it)<0&&(i=it),l.logger.log("[mp4-remuxer]: It is approximately "+at/90+" ms to the next segment; using duration "+i/90+" ms for the last video frame.")):i=it}else i=it}var st=Math.round(X.pts-X.dts);b.push(new v(X.key,i,Z,st))}if(b.length&&d&&d<70){var lt=b[0].flags;lt.dependsOn=2,lt.isNonSync=0}console.assert(void 0!==i,"mp4SampleDuration must be computed"),this.nextAvcDts=S=f+i,this.isVideoContiguous=!0;var ct={data1:o.default.moof(t.sequenceNumber++,c,h({},t,{samples:b})),data2:W,startPTS:k/g,endPTS:(w+i)/g,startDTS:c/g,endDTS:S/g,type:"video",hasAudio:!1,hasVideo:!0,nb:b.length,dropped:t.dropped};return t.samples=[],t.dropped=0,console.assert(W.length,"MDAT length must not be zero"),ct},e.remuxAudio=function(t,e,n,r,c){var u=t.inputTimeScale,d=u/(t.samplerate?t.samplerate:u),f=t.isAAC?1024:1152,p=f*d,g=this._initPTS,y=!t.isAAC&&this.typeSupported.mpeg,b=[],x=t.samples,C=y?0:8,S=this.nextAudioPts||-1,E=e*u;if(this.isAudioContiguous=n=n||x.length&&S>0&&(r&&Math.abs(E-S)<9e3||Math.abs(m(x[0].pts-g,E)-S)<20*p),x.forEach((function(t){t.pts=m(t.pts-g,E)})),!n||S<0){if(!(x=x.filter((function(t){return t.pts>=0}))).length)return;S=0===c?0:r?Math.max(0,E):x[0].pts}if(t.isAAC)for(var k=void 0!==c,w=this.config.maxAudioFramesDrift,T=0,O=S;T<x.length;T++){var L=x[T],A=L.pts,D=A-O,R=Math.abs(1e3*D/u);if(D<=-w*p&&k)0===T&&(l.logger.warn("Audio frame @ "+(A/u).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*D/u)+" ms."),this.nextAudioPts=S=O=A);else if(D>=w*p&&R<1e4&&k){var M=Math.round(D/p);(O=A-M*p)<0&&(M--,O+=p),0===T&&(this.nextAudioPts=S=O),l.logger.warn("[mp4-remuxer]: Injecting "+M+" audio frame @ "+(O/u).toFixed(3)+"s due to "+Math.round(1e3*D/u)+" ms gap.");for(var I=0;I<M;I++){var _=Math.max(O,0),P=i.default.getSilentFrame(t.manifestCodec||t.codec,t.channelCount);P||(l.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),P=L.unit.subarray()),x.splice(T,0,{unit:P,pts:_}),O+=p,T++}}L.pts=O,O+=p}for(var N,j=null,F=null,B=0,U=x.length;U--;)B+=x[U].unit.byteLength;for(var H=0,z=x.length;H<z;H++){var G=x[H],V=G.unit,W=G.pts;if(null!==F)b[H-1].duration=Math.round((W-F)/d);else{if(n&&t.isAAC&&(W=S),j=W,!(B>0))return;B+=C;try{N=new Uint8Array(B)}catch(t){return void this.observer.emit(a.Events.ERROR,a.Events.ERROR,{type:s.ErrorTypes.MUX_ERROR,details:s.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:B,reason:"fail allocating audio mdat "+B})}y||(new DataView(N.buffer).setUint32(0,B),N.set(o.default.types.mdat,4))}N.set(V,C);var K=V.byteLength;C+=K,b.push(new v(!0,f,K,0)),F=W}var q=b.length;if(q){var Y=b[b.length-1];this.nextAudioPts=S=F+d*Y.duration;var X=y?new Uint8Array(0):o.default.moof(t.sequenceNumber++,j/d,h({},t,{samples:b}));t.samples=[];var $=j/u,Z=S/u,J={data1:X,data2:N,startPTS:$,endPTS:Z,startDTS:$,endDTS:Z,type:"audio",hasAudio:!0,hasVideo:!1,nb:q};return this.isAudioContiguous=!0,console.assert(N.length,"MDAT length must not be zero"),J}},e.remuxEmptyAudio=function(t,e,n,r){var o=t.inputTimeScale,a=o/(t.samplerate?t.samplerate:o),s=this.nextAudioPts,c=(null!==s?s:r.startDTS*o)+this._initDTS,u=r.endDTS*o+this._initDTS,h=1024*a,d=Math.ceil((u-c)/h),f=i.default.getSilentFrame(t.manifestCodec||t.codec,t.channelCount);if(l.logger.warn("[mp4-remuxer]: remux empty Audio"),f){for(var p=[],g=0;g<d;g++){var m=c+g*h;p.push({unit:f,pts:m,dts:m})}return t.samples=p,this.remuxAudio(t,e,n,!1)}l.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec")},e.remuxID3=function(t,e){var n=t.samples.length;if(n){for(var r=t.inputTimeScale,i=this._initPTS,o=this._initDTS,a=0;a<n;a++){var s=t.samples[a];s.pts=m(s.pts-i,e*r)/r,s.dts=m(s.dts-o,e*r)/r}var l=t.samples;return t.samples=[],{samples:l}}},e.remuxText=function(t,e){var n=t.samples.length;if(n){for(var r=t.inputTimeScale,i=this._initPTS,o=0;o<n;o++){var a=t.samples[o];a.pts=m(a.pts-i,e*r)/r}t.samples.sort((function(t,e){return t.pts-e.pts}));var s=t.samples;return t.samples=[],{samples:s}}},t}();function m(t,e){var n;if(null===e)return t;for(n=e<t?-8589934592:8589934592;Math.abs(t-e)>4294967296;)t+=n;return t}var v=function(t,e,n,r){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=e,this.size=n,this.cts=r,this.flags=new y(t)},y=function(t){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=t?2:1,this.isNonSync=t?0:1}},"./src/remux/passthrough-remuxer.ts":
/*!******************************************!*\
!*** ./src/remux/passthrough-remuxer.ts ***!
\******************************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e);var r=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=n(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),o=n(/*! ../loader/fragment */"./src/loader/fragment.ts"),a=n(/*! ../utils/logger */"./src/utils/logger.ts"),s=function(){function t(){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 e=t.prototype;return e.destroy=function(){},e.resetTimeStamp=function(t){this.initPTS=t,this.lastEndDTS=null},e.resetNextTimestamp=function(){this.lastEndDTS=null},e.resetInitSegment=function(t,e,n){this.audioCodec=e,this.videoCodec=n,this.generateInitSegment(t),this.emitInitSegment=!0},e.generateInitSegment=function(t){var e=this.audioCodec,n=this.videoCodec;if(!t||!t.byteLength)return this.initTracks=void 0,void(this.initData=void 0);var r=this.initData=Object(i.parseInitSegment)(t);e||(e=c(r.audio,o.ElementaryStreamTypes.AUDIO)),n||(n=c(r.video,o.ElementaryStreamTypes.VIDEO));var s={};r.audio&&r.video?s.audiovideo={container:"video/mp4",codec:e+","+n,initSegment:t,id:"main"}:r.audio?s.audio={container:"audio/mp4",codec:e,initSegment:t,id:"audio"}:r.video?s.video={container:"video/mp4",codec:n,initSegment:t,id:"main"}:a.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=s},e.remux=function(t,e,n,o,s){var c=this.initPTS,u=this.lastEndDTS,h={audio:void 0,video:void 0,text:o,id3:n,initSegment:void 0};Object(r.isFiniteNumber)(u)||(u=this.lastEndDTS=s||0);var d=e.samples;if(!d||!d.length)return h;var f={initPTS:void 0,timescale:1},p=this.initData;if(p&&p.length||(this.generateInitSegment(d),p=this.initData),!p||!p.length)return a.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),h;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1),Object(r.isFiniteNumber)(c)||(this.initPTS=f.initPTS=c=l(p,d,u));var g=Object(i.getDuration)(d,p),m=u,v=g+m;Object(i.offsetStartDTS)(p,d,c),g>0?this.lastEndDTS=v:(a.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var y=!!p.audio,b=!!p.video,x="";y&&(x+="audio"),b&&(x+="video");var C={data1:d,startPTS:m,startDTS:m,endPTS:v,endDTS:v,type:x,hasAudio:y,hasVideo:b,nb:1,dropped:0};return h.audio="audio"===C.type?C:void 0,h.video="audio"!==C.type?C:void 0,h.text=o,h.id3=n,h.initSegment=f,h},t}(),l=function(t,e,n){return Object(i.getStartDTS)(t,e)-n};function c(t,e){var n=null==t?void 0:t.codec;return n&&n.length>4?n:"hvc1"===n?"hvc1.1.c.L120.90":"av01"===n?"av01.0.04M.08":"avc1"===n||e===o.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}e.default=s},"./src/task-loop.ts":
/*!**************************!*\
!*** ./src/task-loop.ts ***!
\**************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return r}));var r=function(){function t(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var e=t.prototype;return e.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},e.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},e.onHandlerDestroyed=function(){},e.hasInterval=function(){return!!this._tickInterval},e.hasNextTick=function(){return!!this._tickTimer},e.setInterval=function(t){return!this._tickInterval&&(this._tickInterval=self.setInterval(this._boundTick,t),!0)},e.clearInterval=function(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)},e.clearNextTick=function(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)},e.tick=function(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},e.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},e.doTick=function(){},t}()},"./src/types/cmcd.ts":
/*!***************************!*\
!*** ./src/types/cmcd.ts ***!
\***************************/
/*! exports provided: CMCDVersion, CMCDObjectType, CMCDStreamingFormat, CMCDStreamType */function(t,e,n){"use strict";n.r(e),n.d(e,"CMCDVersion",(function(){return a})),n.d(e,"CMCDObjectType",(function(){return r})),n.d(e,"CMCDStreamingFormat",(function(){return i})),n.d(e,"CMCDStreamType",(function(){return o}));var r,i,o,a=1;!function(t){t.MANIFEST="m",t.AUDIO="a",t.VIDEO="v",t.MUXED="av",t.INIT="i",t.CAPTION="c",t.TIMED_TEXT="tt",t.KEY="k",t.OTHER="o"}(r||(r={})),function(t){t.DASH="d",t.HLS="h",t.SMOOTH="s",t.OTHER="o"}(i||(i={})),function(t){t.VOD="v",t.LIVE="l"}(o||(o={}))},"./src/types/level.ts":
/*!****************************!*\
!*** ./src/types/level.ts ***!
\****************************/
/*! exports provided: HlsSkip, getSkipValue, HlsUrlParameters, Level */function(t,e,n){"use strict";function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var i;function o(t,e){var n=t.canSkipUntil,r=t.canSkipDateRanges,o=t.endSN;return n&&(void 0!==e?e-o:0)<n?r?i.v2:i.Yes:i.No}n.r(e),n.d(e,"HlsSkip",(function(){return i})),n.d(e,"getSkipValue",(function(){return o})),n.d(e,"HlsUrlParameters",(function(){return a})),n.d(e,"Level",(function(){return s})),function(t){t.No="",t.Yes="YES",t.v2="v2"}(i||(i={}));var a=function(){function t(t,e,n){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=t,this.part=e,this.skip=n}return t.prototype.addDirectives=function(t){var e=new self.URL(t);return void 0!==this.msn&&e.searchParams.set("_HLS_msn",this.msn.toString()),void 0!==this.part&&e.searchParams.set("_HLS_part",this.part.toString()),this.skip&&e.searchParams.set("_HLS_skip",this.skip),e.toString()},t}(),s=function(){function t(t){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=[t.url],this.attrs=t.attrs,this.bitrate=t.bitrate,t.details&&(this.details=t.details),this.id=t.id||0,this.name=t.name,this.width=t.width||0,this.height=t.height||0,this.audioCodec=t.audioCodec,this.videoCodec=t.videoCodec,this.unknownCodecs=t.unknownCodecs,this.codecSet=[t.videoCodec,t.audioCodec].filter((function(t){return t})).join(",").replace(/\.[^.,]+/g,"")}var e,n,i;return e=t,(n=[{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(t){var e=t%this.url.length;this._urlId!==e&&(this.details=void 0,this._urlId=e)}}])&&r(e.prototype,n),i&&r(e,i),t}()},"./src/types/loader.ts":
/*!*****************************!*\
!*** ./src/types/loader.ts ***!
\*****************************/
/*! exports provided: PlaylistContextType, PlaylistLevelType */function(t,e,n){"use strict";var r,i;n.r(e),n.d(e,"PlaylistContextType",(function(){return r})),n.d(e,"PlaylistLevelType",(function(){return i})),function(t){t.MANIFEST="manifest",t.LEVEL="level",t.AUDIO_TRACK="audioTrack",t.SUBTITLE_TRACK="subtitleTrack"}(r||(r={})),function(t){t.MAIN="main",t.AUDIO="audio",t.SUBTITLE="subtitle"}(i||(i={}))},"./src/types/transmuxer.ts":
/*!*********************************!*\
!*** ./src/types/transmuxer.ts ***!
\*********************************/
/*! exports provided: ChunkMetadata */function(t,e,n){"use strict";n.r(e),n.d(e,"ChunkMetadata",(function(){return r}));var r=function(t,e,n,r,i,o){void 0===r&&(r=0),void 0===i&&(i=-1),void 0===o&&(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={start:0,executeStart:0,executeEnd:0,end:0},this.buffering={audio:{start:0,executeStart:0,executeEnd:0,end:0},video:{start:0,executeStart:0,executeEnd:0,end:0},audiovideo:{start:0,executeStart:0,executeEnd:0,end:0}},this.level=t,this.sn=e,this.id=n,this.size=r,this.part=i,this.partial=o}},"./src/utils/attr-list.ts":
/*!********************************!*\
!*** ./src/utils/attr-list.ts ***!
\********************************/
/*! exports provided: AttrList */function(t,e,n){"use strict";n.r(e),n.d(e,"AttrList",(function(){return o}));var r=/^(\d+)x(\d+)$/,i=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,o=function(){function t(e){for(var n in"string"==typeof e&&(e=t.parseAttrList(e)),e)e.hasOwnProperty(n)&&(this[n]=e[n])}var e=t.prototype;return e.decimalInteger=function(t){var e=parseInt(this[t],10);return e>Number.MAX_SAFE_INTEGER?1/0:e},e.hexadecimalInteger=function(t){if(this[t]){var e=(this[t]||"0x").slice(2);e=(1&e.length?"0":"")+e;for(var n=new Uint8Array(e.length/2),r=0;r<e.length/2;r++)n[r]=parseInt(e.slice(2*r,2*r+2),16);return n}return null},e.hexadecimalIntegerAsNumber=function(t){var e=parseInt(this[t],16);return e>Number.MAX_SAFE_INTEGER?1/0:e},e.decimalFloatingPoint=function(t){return parseFloat(this[t])},e.optionalFloat=function(t,e){var n=this[t];return n?parseFloat(n):e},e.enumeratedString=function(t){return this[t]},e.bool=function(t){return"YES"===this[t]},e.decimalResolution=function(t){var e=r.exec(this[t]);if(null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}},t.parseAttrList=function(t){var e,n={};for(i.lastIndex=0;null!==(e=i.exec(t));){var r=e[2];0===r.indexOf('"')&&r.lastIndexOf('"')===r.length-1&&(r=r.slice(1,-1)),n[e[1]]=r}return n},t}()},"./src/utils/binary-search.ts":
/*!************************************!*\
!*** ./src/utils/binary-search.ts ***!
\************************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e),e.default={search:function(t,e){for(var n=0,r=t.length-1,i=null,o=null;n<=r;){var a=e(o=t[i=(n+r)/2|0]);if(a>0)n=i+1;else{if(!(a<0))return o;r=i-1}}return null}}},"./src/utils/buffer-helper.ts":
/*!************************************!*\
!*** ./src/utils/buffer-helper.ts ***!
\************************************/
/*! exports provided: BufferHelper */function(t,e,n){"use strict";n.r(e),n.d(e,"BufferHelper",(function(){return o}));var r=n(/*! ./logger */"./src/utils/logger.ts"),i={length:0,start:function(){return 0},end:function(){return 0}},o=function(){function t(){}return t.isBuffered=function(e,n){try{if(e)for(var r=t.getBuffered(e),i=0;i<r.length;i++)if(n>=r.start(i)&&n<=r.end(i))return!0}catch(t){}return!1},t.bufferInfo=function(e,n,r){try{if(e){var i,o=t.getBuffered(e),a=[];for(i=0;i<o.length;i++)a.push({start:o.start(i),end:o.end(i)});return this.bufferedInfo(a,n,r)}}catch(t){}return{len:0,start:n,end:n,nextStart:void 0}},t.bufferedInfo=function(t,e,n){e=Math.max(0,e),t.sort((function(t,e){var n=t.start-e.start;return n||e.end-t.end}));var r=[];if(n)for(var i=0;i<t.length;i++){var o=r.length;if(o){var a=r[o-1].end;t[i].start-a<n?t[i].end>a&&(r[o-1].end=t[i].end):r.push(t[i])}else r.push(t[i])}else r=t;for(var s,l=0,c=e,u=e,h=0;h<r.length;h++){var d=r[h].start,f=r[h].end;if(e+n>=d&&e<f)c=d,l=(u=f)-e;else if(e+n<d){s=d;break}}return{len:l,start:c||0,end:u||0,nextStart:s}},t.getBuffered=function(t){try{return t.buffered}catch(t){return r.logger.log("failed to get media.buffered",t),i}},t}()},"./src/utils/cea-608-parser.ts":
/*!*************************************!*\
!*** ./src/utils/cea-608-parser.ts ***!
\*************************************/
/*! exports provided: Row, CaptionScreen, default */function(t,e,n){"use strict";n.r(e),n.d(e,"Row",(function(){return m})),n.d(e,"CaptionScreen",(function(){return v}));var r,i=n(/*! ../utils/logger */"./src/utils/logger.ts"),o={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},a=function(t){var e=t;return o.hasOwnProperty(t)&&(e=o[t]),String.fromCharCode(e)},s={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},l={17:2,18:4,21:6,22:8,23:10,19:13,20:15},c={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},u={25:2,26:4,29:6,30:8,31:10,27:13,28:15},h=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];!function(t){t[t.ERROR=0]="ERROR",t[t.TEXT=1]="TEXT",t[t.WARNING=2]="WARNING",t[t.INFO=2]="INFO",t[t.DEBUG=3]="DEBUG",t[t.DATA=3]="DATA"}(r||(r={}));var d=function(){function t(){this.time=null,this.verboseLevel=r.ERROR}return t.prototype.log=function(t,e){this.verboseLevel>=t&&i.logger.log(this.time+" ["+t+"] "+e)},t}(),f=function(t){for(var e=[],n=0;n<t.length;n++)e.push(t[n].toString(16));return e},p=function(){function t(t,e,n,r,i){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=t||"white",this.underline=e||!1,this.italics=n||!1,this.background=r||"black",this.flash=i||!1}var e=t.prototype;return e.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},e.setStyles=function(t){for(var e=["foreground","underline","italics","background","flash"],n=0;n<e.length;n++){var r=e[n];t.hasOwnProperty(r)&&(this[r]=t[r])}},e.isDefault=function(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash},e.equals=function(t){return this.foreground===t.foreground&&this.underline===t.underline&&this.italics===t.italics&&this.background===t.background&&this.flash===t.flash},e.copy=function(t){this.foreground=t.foreground,this.underline=t.underline,this.italics=t.italics,this.background=t.background,this.flash=t.flash},e.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},t}(),g=function(){function t(t,e,n,r,i,o){this.uchar=void 0,this.penState=void 0,this.uchar=t||" ",this.penState=new p(e,n,r,i,o)}var e=t.prototype;return e.reset=function(){this.uchar=" ",this.penState.reset()},e.setChar=function(t,e){this.uchar=t,this.penState.copy(e)},e.setPenState=function(t){this.penState.copy(t)},e.equals=function(t){return this.uchar===t.uchar&&this.penState.equals(t.penState)},e.copy=function(t){this.uchar=t.uchar,this.penState.copy(t.penState)},e.isEmpty=function(){return" "===this.uchar&&this.penState.isDefault()},t}(),m=function(){function t(t){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var e=0;e<100;e++)this.chars.push(new g);this.logger=t,this.pos=0,this.currPenState=new p}var e=t.prototype;return e.equals=function(t){for(var e=!0,n=0;n<100;n++)if(!this.chars[n].equals(t.chars[n])){e=!1;break}return e},e.copy=function(t){for(var e=0;e<100;e++)this.chars[e].copy(t.chars[e])},e.isEmpty=function(){for(var t=!0,e=0;e<100;e++)if(!this.chars[e].isEmpty()){t=!1;break}return t},e.setCursor=function(t){this.pos!==t&&(this.pos=t),this.pos<0?(this.logger.log(r.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>100&&(this.logger.log(r.DEBUG,"Too large cursor position "+this.pos),this.pos=100)},e.moveCursor=function(t){var e=this.pos+t;if(t>1)for(var n=this.pos+1;n<e+1;n++)this.chars[n].setPenState(this.currPenState);this.setCursor(e)},e.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},e.insertChar=function(t){t>=144&&this.backSpace();var e=a(t);this.pos>=100?this.logger.log(r.ERROR,"Cannot insert "+t.toString(16)+" ("+e+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(e,this.currPenState),this.moveCursor(1))},e.clearFromPos=function(t){var e;for(e=t;e<100;e++)this.chars[e].reset()},e.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},e.clearToEndOfRow=function(){this.clearFromPos(this.pos)},e.getTextString=function(){for(var t=[],e=!0,n=0;n<100;n++){var r=this.chars[n].uchar;" "!==r&&(e=!1),t.push(r)}return e?"":t.join("")},e.setPenStyles=function(t){this.currPenState.setStyles(t),this.chars[this.pos].setPenState(this.currPenState)},t}(),v=function(){function t(t){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var e=0;e<15;e++)this.rows.push(new m(t));this.logger=t,this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var e=t.prototype;return e.reset=function(){for(var t=0;t<15;t++)this.rows[t].clear();this.currRow=14},e.equals=function(t){for(var e=!0,n=0;n<15;n++)if(!this.rows[n].equals(t.rows[n])){e=!1;break}return e},e.copy=function(t){for(var e=0;e<15;e++)this.rows[e].copy(t.rows[e])},e.isEmpty=function(){for(var t=!0,e=0;e<15;e++)if(!this.rows[e].isEmpty()){t=!1;break}return t},e.backSpace=function(){this.rows[this.currRow].backSpace()},e.clearToEndOfRow=function(){this.rows[this.currRow].clearToEndOfRow()},e.insertChar=function(t){this.rows[this.currRow].insertChar(t)},e.setPen=function(t){this.rows[this.currRow].setPenStyles(t)},e.moveCursor=function(t){this.rows[this.currRow].moveCursor(t)},e.setCursor=function(t){this.logger.log(r.INFO,"setCursor: "+t),this.rows[this.currRow].setCursor(t)},e.setPAC=function(t){this.logger.log(r.INFO,"pacData = "+JSON.stringify(t));var e=t.row-1;if(this.nrRollUpRows&&e<this.nrRollUpRows-1&&(e=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==e){for(var n=0;n<15;n++)this.rows[n].clear();var i=this.currRow+1-this.nrRollUpRows,o=this.lastOutputScreen;if(o){var a=o.rows[i].cueStartTime,s=this.logger.time;if(a&&null!==s&&a<s)for(var l=0;l<this.nrRollUpRows;l++)this.rows[e-this.nrRollUpRows+l+1].copy(o.rows[i+l])}}this.currRow=e;var c=this.rows[this.currRow];if(null!==t.indent){var u=t.indent,h=Math.max(u-1,0);c.setCursor(t.indent),t.color=c.chars[h].penState.foreground}var d={foreground:t.color,underline:t.underline,italics:t.italics,background:"black",flash:!1};this.setPen(d)},e.setBkgData=function(t){this.logger.log(r.INFO,"bkgData = "+JSON.stringify(t)),this.backSpace(),this.setPen(t),this.insertChar(32)},e.setRollUpRows=function(t){this.nrRollUpRows=t},e.rollUp=function(){if(null!==this.nrRollUpRows){this.logger.log(r.TEXT,this.getDisplayText());var t=this.currRow+1-this.nrRollUpRows,e=this.rows.splice(t,1)[0];e.clear(),this.rows.splice(this.currRow,0,e),this.logger.log(r.INFO,"Rolling up")}else this.logger.log(r.DEBUG,"roll_up but nrRollUpRows not set yet")},e.getDisplayText=function(t){t=t||!1;for(var e=[],n="",r=-1,i=0;i<15;i++){var o=this.rows[i].getTextString();o&&(r=i+1,t?e.push("Row "+r+": '"+o+"'"):e.push(o.trim()))}return e.length>0&&(n=t?"["+e.join(" | ")+"]":e.join("\n")),n},e.getTextAndFormat=function(){return this.rows},t}(),y=function(){function t(t,e,n){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=t,this.outputFilter=e,this.mode=null,this.verbose=0,this.displayedMemory=new v(n),this.nonDisplayedMemory=new v(n),this.lastOutputScreen=new v(n),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=n}var e=t.prototype;return e.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},e.getHandler=function(){return this.outputFilter},e.setHandler=function(t){this.outputFilter=t},e.setPAC=function(t){this.writeScreen.setPAC(t)},e.setBkgData=function(t){this.writeScreen.setBkgData(t)},e.setMode=function(t){t!==this.mode&&(this.mode=t,this.logger.log(r.INFO,"MODE="+t),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=t)},e.insertChars=function(t){for(var e=0;e<t.length;e++)this.writeScreen.insertChar(t[e]);var n=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(r.INFO,n+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(this.logger.log(r.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},e.ccRCL=function(){this.logger.log(r.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},e.ccBS=function(){this.logger.log(r.INFO,"BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},e.ccAOF=function(){},e.ccAON=function(){},e.ccDER=function(){this.logger.log(r.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},e.ccRU=function(t){this.logger.log(r.INFO,"RU("+t+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(t)},e.ccFON=function(){this.logger.log(r.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},e.ccRDC=function(){this.logger.log(r.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},e.ccTR=function(){this.logger.log(r.INFO,"TR"),this.setMode("MODE_TEXT")},e.ccRTD=function(){this.logger.log(r.INFO,"RTD"),this.setMode("MODE_TEXT")},e.ccEDM=function(){this.logger.log(r.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},e.ccCR=function(){this.logger.log(r.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},e.ccENM=function(){this.logger.log(r.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},e.ccEOC=function(){if(this.logger.log(r.INFO,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode){var t=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=t,this.writeScreen=this.nonDisplayedMemory,this.logger.log(r.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},e.ccTO=function(t){this.logger.log(r.INFO,"TO("+t+") - Tab Offset"),this.writeScreen.moveCursor(t)},e.ccMIDROW=function(t){var e={flash:!1};if(e.underline=t%2==1,e.italics=t>=46,e.italics)e.foreground="white";else{var n=Math.floor(t/2)-16;e.foreground=["white","green","blue","cyan","red","yellow","magenta"][n]}this.logger.log(r.INFO,"MIDROW: "+JSON.stringify(e)),this.writeScreen.setPen(e)},e.outputDataUpdate=function(t){void 0===t&&(t=!1);var e=this.logger.time;null!==e&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,e,this.lastOutputScreen),t&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:e):this.cueStartTime=e,this.lastOutputScreen.copy(this.displayedMemory))},e.cueSplitAtTime=function(t){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,t,this.displayedMemory),this.cueStartTime=t))},t}(),b=function(){function t(t,e,n){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var r=new d;this.channels=[null,new y(t,e,r),new y(t+1,n,r)],this.cmdHistory={a:null,b:null},this.logger=r}var e=t.prototype;return e.getHandler=function(t){return this.channels[t].getHandler()},e.setHandler=function(t,e){this.channels[t].setHandler(e)},e.addData=function(t,e){var n,i,o,a=!1;this.logger.time=t;for(var s=0;s<e.length;s+=2)if(i=127&e[s],o=127&e[s+1],0!==i||0!==o){if(this.logger.log(r.DATA,"["+f([e[s],e[s+1]])+"] -> ("+f([i,o])+")"),(n=this.parseCmd(i,o))||(n=this.parseMidrow(i,o)),n||(n=this.parsePAC(i,o)),n||(n=this.parseBackgroundAttributes(i,o)),!n&&(a=this.parseChars(i,o))){var l=this.currentChannel;l&&l>0?this.channels[l].insertChars(a):this.logger.log(r.WARNING,"No channel found yet. TEXT-MODE?")}n||a||this.logger.log(r.WARNING,"Couldn't parse cleaned data "+f([i,o])+" orig: "+f([e[s],e[s+1]]))}},e.parseCmd=function(t,e){var n=this.cmdHistory;if(!((20===t||28===t||21===t||29===t)&&e>=32&&e<=47||(23===t||31===t)&&e>=33&&e<=35))return!1;if(C(t,e,n))return x(null,null,n),this.logger.log(r.DEBUG,"Repeated command ("+f([t,e])+") is dropped"),!0;var i=20===t||21===t||23===t?1:2,o=this.channels[i];return 20===t||21===t||28===t||29===t?32===e?o.ccRCL():33===e?o.ccBS():34===e?o.ccAOF():35===e?o.ccAON():36===e?o.ccDER():37===e?o.ccRU(2):38===e?o.ccRU(3):39===e?o.ccRU(4):40===e?o.ccFON():41===e?o.ccRDC():42===e?o.ccTR():43===e?o.ccRTD():44===e?o.ccEDM():45===e?o.ccCR():46===e?o.ccENM():47===e&&o.ccEOC():o.ccTO(e-32),x(t,e,n),this.currentChannel=i,!0},e.parseMidrow=function(t,e){var n=0;if((17===t||25===t)&&e>=32&&e<=47){if((n=17===t?1:2)!==this.currentChannel)return this.logger.log(r.ERROR,"Mismatch channel in midrow parsing"),!1;var i=this.channels[n];return!!i&&(i.ccMIDROW(e),this.logger.log(r.DEBUG,"MIDROW ("+f([t,e])+")"),!0)}return!1},e.parsePAC=function(t,e){var n,r=this.cmdHistory;if(!((t>=17&&t<=23||t>=25&&t<=31)&&e>=64&&e<=127||(16===t||24===t)&&e>=64&&e<=95))return!1;if(C(t,e,r))return x(null,null,r),!0;var i=t<=23?1:2;n=e>=64&&e<=95?1===i?s[t]:c[t]:1===i?l[t]:u[t];var o=this.channels[i];return!!o&&(o.setPAC(this.interpretPAC(n,e)),x(t,e,r),this.currentChannel=i,!0)},e.interpretPAC=function(t,e){var n,r={color:null,italics:!1,indent:null,underline:!1,row:t};return n=e>95?e-96:e-64,r.underline=1==(1&n),n<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(n/2)]:n<=15?(r.italics=!0,r.color="white"):r.indent=4*Math.floor((n-16)/2),r},e.parseChars=function(t,e){var n,i,o=null,s=null;if(t>=25?(n=2,s=t-8):(n=1,s=t),s>=17&&s<=19?(i=17===s?e+80:18===s?e+112:e+144,this.logger.log(r.INFO,"Special char '"+a(i)+"' in channel "+n),o=[i]):t>=32&&t<=127&&(o=0===e?[t]:[t,e]),o){var l=f(o);this.logger.log(r.DEBUG,"Char codes = "+l.join(",")),x(t,e,this.cmdHistory)}return o},e.parseBackgroundAttributes=function(t,e){var n;if(!((16===t||24===t)&&e>=32&&e<=47||(23===t||31===t)&&e>=45&&e<=47))return!1;var r={};16===t||24===t?(n=Math.floor((e-32)/2),r.background=h[n],e%2==1&&(r.background=r.background+"_semi")):45===e?r.background="transparent":(r.foreground="black",47===e&&(r.underline=!0));var i=t<=23?1:2;return this.channels[i].setBkgData(r),x(t,e,this.cmdHistory),!0},e.reset=function(){for(var t=0;t<Object.keys(this.channels).length;t++){var e=this.channels[t];e&&e.reset()}this.cmdHistory={a:null,b:null}},e.cueSplitAtTime=function(t){for(var e=0;e<this.channels.length;e++){var n=this.channels[e];n&&n.cueSplitAtTime(t)}},t}();function x(t,e,n){n.a=t,n.b=e}function C(t,e,n){return n.a===t&&n.b===e}e.default=b},"./src/utils/codecs.ts":
/*!*****************************!*\
!*** ./src/utils/codecs.ts ***!
\*****************************/
/*! exports provided: isCodecType, isCodecSupportedInMp4 */function(t,e,n){"use strict";n.r(e),n.d(e,"isCodecType",(function(){return i})),n.d(e,"isCodecSupportedInMp4",(function(){return o}));var r={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(t,e){var n=r[e];return!!n&&!0===n[t.slice(0,4)]}function o(t,e){return MediaSource.isTypeSupported((e||"video")+'/mp4;codecs="'+t+'"')}},"./src/utils/cues.ts":
/*!***************************!*\
!*** ./src/utils/cues.ts ***!
\***************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e);var r=n(/*! ./vttparser */"./src/utils/vttparser.ts"),i=n(/*! ./webvtt-parser */"./src/utils/webvtt-parser.ts"),o=n(/*! ./texttrack-utils */"./src/utils/texttrack-utils.ts"),a=/\s/,s={newCue:function(t,e,n,s){for(var l,c,u,h,d,f=[],p=self.VTTCue||self.TextTrackCue,g=0;g<s.rows.length;g++)if(u=!0,h=0,d="",!(l=s.rows[g]).isEmpty()){for(var m=0;m<l.chars.length;m++)a.test(l.chars[m].uchar)&&u?h++:(d+=l.chars[m].uchar,u=!1);l.cueStartTime=e,e===n&&(n+=1e-4),h>=16?h--:h++;var v=Object(r.fixLineBreaks)(d.trim()),y=Object(i.generateCueId)(e,n,v);t&&t.cues&&t.cues.getCueById(y)||((c=new p(e,n,v)).id=y,c.line=g+1,c.align="left",c.position=10+Math.min(80,10*Math.floor(8*h/32)),f.push(c))}return t&&f.length&&(f.sort((function(t,e){return"auto"===t.line||"auto"===e.line?0:t.line>8&&e.line>8?e.line-t.line:t.line-e.line})),f.forEach((function(e){return Object(o.addCueToTrack)(t,e)}))),f}};e.default=s},"./src/utils/discontinuities.ts":
/*!**************************************!*\
!*** ./src/utils/discontinuities.ts ***!
\**************************************/
/*! exports provided: findFirstFragWithCC, shouldAlignOnDiscontinuities, findDiscontinuousReferenceFrag, adjustSlidingStart, alignStream, alignPDT, alignFragmentByPDTDelta, alignMediaPlaylistByPDT */function(t,e,n){"use strict";n.r(e),n.d(e,"findFirstFragWithCC",(function(){return a})),n.d(e,"shouldAlignOnDiscontinuities",(function(){return s})),n.d(e,"findDiscontinuousReferenceFrag",(function(){return l})),n.d(e,"adjustSlidingStart",(function(){return u})),n.d(e,"alignStream",(function(){return h})),n.d(e,"alignPDT",(function(){return d})),n.d(e,"alignFragmentByPDTDelta",(function(){return f})),n.d(e,"alignMediaPlaylistByPDT",(function(){return p}));var r=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=n(/*! ./logger */"./src/utils/logger.ts"),o=n(/*! ../controller/level-helper */"./src/controller/level-helper.ts");function a(t,e){for(var n=null,r=0,i=t.length;r<i;r++){var o=t[r];if(o&&o.cc===e){n=o;break}}return n}function s(t,e,n){return!(!e.details||!(n.endCC>n.startCC||t&&t.cc<n.startCC))}function l(t,e){var n=t.fragments,r=e.fragments;if(r.length&&n.length){var o=a(n,r[0].cc);if(o&&(!o||o.startPTS))return o;i.logger.log("No frag in previous level to align on")}else i.logger.log("No fragments to align")}function c(t,e){if(t){var n=t.start+e;t.start=t.startPTS=n,t.endPTS=n+t.duration}}function u(t,e){for(var n=e.fragments,r=0,i=n.length;r<i;r++)c(n[r],t);e.fragmentHint&&c(e.fragmentHint,t),e.alignedSliding=!0}function h(t,e,n){e&&(function(t,e,n){if(s(t,n,e)){var o=l(n.details,e);o&&Object(r.isFiniteNumber)(o.start)&&(i.logger.log("Adjusting PTS using last level due to CC increase within current level "+e.url),u(o.start,e))}}(t,n,e),!n.alignedSliding&&e.details&&d(n,e.details),n.alignedSliding||!e.details||n.skippedSegments||Object(o.adjustSliding)(e.details,n))}function d(t,e){if(e.fragments.length&&t.hasProgramDateTime&&e.hasProgramDateTime){var n=e.fragments[0].programDateTime,o=t.fragments[0].programDateTime,a=(o-n)/1e3+e.fragments[0].start;a&&Object(r.isFiniteNumber)(a)&&(i.logger.log("Adjusting PTS using programDateTime delta "+(o-n)+"ms, sliding:"+a.toFixed(3)+" "+t.url+" "),u(a,t))}}function f(t,e){var n=t.programDateTime;if(n){var r=(n-e)/1e3;t.start=t.startPTS=r,t.endPTS=r+t.duration}}function p(t,e){if(e.fragments.length&&t.hasProgramDateTime&&e.hasProgramDateTime){var n=e.fragments[0].programDateTime-1e3*e.fragments[0].start;t.fragments.forEach((function(t){f(t,n)})),t.fragmentHint&&f(t.fragmentHint,n),t.alignedSliding=!0}}},"./src/utils/ewma-bandwidth-estimator.ts":
/*!***********************************************!*\
!*** ./src/utils/ewma-bandwidth-estimator.ts ***!
\***********************************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e);var r=n(/*! ../utils/ewma */"./src/utils/ewma.ts"),i=function(){function t(t,e,n){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=n,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new r.default(t),this.fast_=new r.default(e)}var e=t.prototype;return e.update=function(t,e){var n=this.slow_,i=this.fast_;this.slow_.halfLife!==t&&(this.slow_=new r.default(t,n.getEstimate(),n.getTotalWeight())),this.fast_.halfLife!==e&&(this.fast_=new r.default(e,i.getEstimate(),i.getTotalWeight()))},e.sample=function(t,e){var n=(t=Math.max(t,this.minDelayMs_))/1e3,r=8*e/n;this.fast_.sample(n,r),this.slow_.sample(n,r)},e.canEstimate=function(){var t=this.fast_;return t&&t.getTotalWeight()>=this.minWeight_},e.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},e.destroy=function(){},t}();e.default=i},"./src/utils/ewma.ts":
/*!***************************!*\
!*** ./src/utils/ewma.ts ***!
\***************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e);var r=function(){function t(t,e,n){void 0===e&&(e=0),void 0===n&&(n=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=t,this.alpha_=t?Math.exp(Math.log(.5)/t):0,this.estimate_=e,this.totalWeight_=n}var e=t.prototype;return e.sample=function(t,e){var n=Math.pow(this.alpha_,t);this.estimate_=e*(1-n)+n*this.estimate_,this.totalWeight_+=t},e.getTotalWeight=function(){return this.totalWeight_},e.getEstimate=function(){if(this.alpha_){var t=1-Math.pow(this.alpha_,this.totalWeight_);if(t)return this.estimate_/t}return this.estimate_},t}();e.default=r},"./src/utils/fetch-loader.ts":
/*!***********************************!*\
!*** ./src/utils/fetch-loader.ts ***!
\***********************************/
/*! exports provided: fetchSupported, default */function(t,e,n){"use strict";n.r(e),n.d(e,"fetchSupported",(function(){return d}));var r=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=n(/*! ../loader/load-stats */"./src/loader/load-stats.ts"),o=n(/*! ../demux/chunk-cache */"./src/demux/chunk-cache.ts");function a(t){var e="function"==typeof Map?new Map:void 0;return(a=function(t){if(null===t||(n=t,-1===Function.toString.call(n).indexOf("[native code]")))return t;var n;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return s(t,arguments,u(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),c(r,t)})(t)}function s(t,e,n){return(s=l()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&c(i,n.prototype),i}).apply(null,arguments)}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function h(){return(h=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function d(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(t){}return!1}var f=function(){function t(t){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=t.fetchSetup||p,this.controller=new self.AbortController,this.stats=new i.LoadStats}var e=t.prototype;return e.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},e.abortInternal=function(){var t=this.response;t&&t.ok||(this.stats.aborted=!0,this.controller.abort())},e.abort=function(){var t;this.abortInternal(),null!==(t=this.callbacks)&&void 0!==t&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},e.load=function(t,e,n){var i=this,o=this.stats;if(o.loading.start)throw new Error("Loader can only be used once.");o.loading.start=self.performance.now();var a=function(t,e){var n={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(h({},t.headers))};return t.rangeEnd&&n.headers.set("Range","bytes="+t.rangeStart+"-"+String(t.rangeEnd-1)),n}(t,this.controller.signal),s=n.onProgress,l="arraybuffer"===t.responseType,c=l?"byteLength":"length";this.context=t,this.config=e,this.callbacks=n,this.request=this.fetchSetup(t,a),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout((function(){i.abortInternal(),n.onTimeout(o,t,i.response)}),e.timeout),self.fetch(this.request).then((function(n){if(i.response=i.loader=n,!n.ok){var a=n.status,c=n.statusText;throw new g(c||"fetch, bad network response",a,n)}return o.loading.first=Math.max(self.performance.now(),o.loading.start),o.total=parseInt(n.headers.get("Content-Length")||"0"),s&&Object(r.isFiniteNumber)(e.highWaterMark)?i.loadProgressively(n,o,t,e.highWaterMark,s):l?n.arrayBuffer():n.text()})).then((function(a){var l=i.response;self.clearTimeout(i.requestTimeout),o.loading.end=Math.max(self.performance.now(),o.loading.first),o.loaded=o.total=a[c];var u={url:l.url,data:a};s&&!Object(r.isFiniteNumber)(e.highWaterMark)&&s(o,t,a,l),n.onSuccess(u,o,t,l)})).catch((function(e){if(self.clearTimeout(i.requestTimeout),!o.aborted){var r=e.code||0;n.onError({code:r,text:e.message},t,e.details)}}))},e.getCacheAge=function(){var t=null;if(this.response){var e=this.response.headers.get("age");t=e?parseFloat(e):null}return t},e.loadProgressively=function(t,e,n,r,i){void 0===r&&(r=0);var a=new o.default,s=t.body.getReader();return function o(){return s.read().then((function(s){if(s.done)return a.dataLength&&i(e,n,a.flush(),t),Promise.resolve(new ArrayBuffer(0));var l=s.value,c=l.length;return e.loaded+=c,c<r||a.dataLength?(a.push(l),a.dataLength>=r&&i(e,n,a.flush(),t)):i(e,n,l,t),o()})).catch((function(){return Promise.reject()}))}()},t}();function p(t,e){return new self.Request(t.url,e)}var g=function(t){var e,n;function r(e,n,r){var i;return(i=t.call(this,e)||this).code=void 0,i.details=void 0,i.code=n,i.details=r,i}return n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,c(e,n),r}(a(Error));e.default=f},"./src/utils/imsc1-ttml-parser.ts":
/*!****************************************!*\
!*** ./src/utils/imsc1-ttml-parser.ts ***!
\****************************************/
/*! exports provided: IMSC1_CODEC, parseIMSC1 */function(t,e,n){"use strict";n.r(e),n.d(e,"IMSC1_CODEC",(function(){return u})),n.d(e,"parseIMSC1",(function(){return p}));var r=n(/*! ./mp4-tools */"./src/utils/mp4-tools.ts"),i=n(/*! ./vttparser */"./src/utils/vttparser.ts"),o=n(/*! ./vttcue */"./src/utils/vttcue.ts"),a=n(/*! ../demux/id3 */"./src/demux/id3.ts"),s=n(/*! ./timescale-conversion */"./src/utils/timescale-conversion.ts"),l=n(/*! ./webvtt-parser */"./src/utils/webvtt-parser.ts");function c(){return(c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}var u="stpp.ttml.im1t",h=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,d=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,f={left:"start",center:"center",right:"end",start:"start",end:"end"};function p(t,e,n,i,u){var h=Object(r.findBox)(new Uint8Array(t),["mdat"]);if(0!==h.length){var d=h[0],p=Object(a.utf8ArrayToStr)(new Uint8Array(t,d.start,d.end-d.start)),x=Object(s.toTimescaleFromScale)(e,1,n);try{i(function(t,e){var n=(new DOMParser).parseFromString(t,"text/xml").getElementsByTagName("tt")[0];if(!n)throw new Error("Invalid ttml");var r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},i=Object.keys(r).reduce((function(t,e){return t[e]=n.getAttribute("ttp:"+e)||r[e],t}),{}),a="preserve"!==n.getAttribute("xml:space"),s=m(g(n,"styling","style")),u=m(g(n,"layout","region")),h=g(n,"body","[begin]");return[].map.call(h,(function(t){var n=function t(e,n){return[].slice.call(e.childNodes).reduce((function(e,r,i){var o;return"br"===r.nodeName&&i?e+"\n":null!==(o=r.childNodes)&&void 0!==o&&o.length?t(r,n):n?e+r.textContent.trim().replace(/\s+/g," "):e+r.textContent}),"")}(t,a);if(!n||!t.hasAttribute("begin"))return null;var r=b(t.getAttribute("begin"),i),h=b(t.getAttribute("dur"),i),d=b(t.getAttribute("end"),i);if(null===r)throw y(t);if(null===d){if(null===h)throw y(t);d=r+h}var p=new o.default(r-e,d-e,n);p.id=Object(l.generateCueId)(p.startTime,p.endTime,p.text);var g=u[t.getAttribute("region")],m=s[t.getAttribute("style")];p.position=10,p.size=80;var x=function(t,e){var n="http://www.w3.org/ns/ttml#styling";return["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"].reduce((function(r,i){var o=v(e,n,i)||v(t,n,i);return o&&(r[i]=o),r}),{})}(g,m),C=x.textAlign;if(C){var S=f[C];S&&(p.lineAlign=S),p.align=C}return c(p,x),p})).filter((function(t){return null!==t}))}(p,x))}catch(t){u(t)}}else u(new Error("Could not parse IMSC1 mdat"))}function g(t,e,n){var r=t.getElementsByTagName(e)[0];return r?[].slice.call(r.querySelectorAll(n)):[]}function m(t){return t.reduce((function(t,e){var n=e.getAttribute("xml:id");return n&&(t[n]=e),t}),{})}function v(t,e,n){return t.hasAttributeNS(e,n)?t.getAttributeNS(e,n):null}function y(t){return new Error("Could not parse ttml timestamp "+t)}function b(t,e){if(!t)return null;var n=Object(i.parseTimeStamp)(t);return null===n&&(h.test(t)?n=function(t,e){var n=h.exec(t),r=(0|n[4])+(0|n[5])/e.subFrameRate;return 3600*(0|n[1])+60*(0|n[2])+(0|n[3])+r/e.frameRate}(t,e):d.test(t)&&(n=function(t,e){var n=d.exec(t),r=Number(n[1]);switch(n[2]){case"h":return 3600*r;case"m":return 60*r;case"ms":return 1e3*r;case"f":return r/e.frameRate;case"t":return r/e.tickRate}return r}(t,e))),n}},"./src/utils/logger.ts":
/*!*****************************!*\
!*** ./src/utils/logger.ts ***!
\*****************************/
/*! exports provided: enableLogs, logger */function(t,e,n){"use strict";n.r(e),n.d(e,"enableLogs",(function(){return s})),n.d(e,"logger",(function(){return l}));var r=function(){},i={trace:r,debug:r,log:r,warn:r,info:r,error:r},o=i;function a(t){var e=self.console[t];return e?e.bind(self.console,"["+t+"] >"):r}function s(t){if(self.console&&!0===t||"object"==typeof t){!function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];n.forEach((function(e){o[e]=t[e]?t[e].bind(t):a(e)}))}(t,"debug","log","info","warn","error");try{o.log()}catch(t){o=i}}else o=i}var l=i},"./src/utils/mediakeys-helper.ts":
/*!***************************************!*\
!*** ./src/utils/mediakeys-helper.ts ***!
\***************************************/
/*! exports provided: KeySystems, requestMediaKeySystemAccess */function(t,e,n){"use strict";var r;n.r(e),n.d(e,"KeySystems",(function(){return r})),n.d(e,"requestMediaKeySystemAccess",(function(){return i})),function(t){t.WIDEVINE="com.widevine.alpha",t.PLAYREADY="com.microsoft.playready"}(r||(r={}));var i="undefined"!=typeof self&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null},"./src/utils/mediasource-helper.ts":
/*!*****************************************!*\
!*** ./src/utils/mediasource-helper.ts ***!
\*****************************************/
/*! exports provided: getMediaSource */function(t,e,n){"use strict";function r(){return self.MediaSource||self.WebKitMediaSource}n.r(e),n.d(e,"getMediaSource",(function(){return r}))},"./src/utils/mp4-tools.ts":
/*!********************************!*\
!*** ./src/utils/mp4-tools.ts ***!
\********************************/
/*! exports provided: bin2str, readUint16, readUint32, writeUint32, findBox, parseSegmentIndex, parseInitSegment, getStartDTS, getDuration, computeRawDurationFromSamples, offsetStartDTS, segmentValidRange, appendUint8Array */function(t,e,n){"use strict";n.r(e),n.d(e,"bin2str",(function(){return s})),n.d(e,"readUint16",(function(){return l})),n.d(e,"readUint32",(function(){return c})),n.d(e,"writeUint32",(function(){return u})),n.d(e,"findBox",(function(){return h})),n.d(e,"parseSegmentIndex",(function(){return d})),n.d(e,"parseInitSegment",(function(){return f})),n.d(e,"getStartDTS",(function(){return p})),n.d(e,"getDuration",(function(){return g})),n.d(e,"computeRawDurationFromSamples",(function(){return m})),n.d(e,"offsetStartDTS",(function(){return v})),n.d(e,"segmentValidRange",(function(){return y})),n.d(e,"appendUint8Array",(function(){return b}));var r=n(/*! ./typed-array */"./src/utils/typed-array.ts"),i=n(/*! ../loader/fragment */"./src/loader/fragment.ts"),o=Math.pow(2,32)-1,a=[].push;function s(t){return String.fromCharCode.apply(null,t)}function l(t,e){"data"in t&&(e+=t.start,t=t.data);var n=t[e]<<8|t[e+1];return n<0?65536+n:n}function c(t,e){"data"in t&&(e+=t.start,t=t.data);var n=t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3];return n<0?4294967296+n:n}function u(t,e,n){"data"in t&&(e+=t.start,t=t.data),t[e]=n>>24,t[e+1]=n>>16&255,t[e+2]=n>>8&255,t[e+3]=255&n}function h(t,e){var n,r,i,o=[];if(!e.length)return o;"data"in t?(n=t.data,r=t.start,i=t.end):(r=0,i=(n=t).byteLength);for(var l=r;l<i;){var u=c(n,l),d=u>1?l+u:i;if(s(n.subarray(l+4,l+8))===e[0])if(1===e.length)o.push({data:n,start:l+8,end:d});else{var f=h({data:n,start:l+8,end:d},e.slice(1));f.length&&a.apply(o,f)}l=d}return o}function d(t){var e=h(t,["moov"])[0],n=e?e.end:null,r=h(t,["sidx"]);if(!r||!r[0])return null;var i=[],o=r[0],a=o.data[0],s=0===a?8:16,u=c(o,s);s+=4,s+=0===a?8:16,s+=2;var d=o.end+0,f=l(o,s);s+=2;for(var p=0;p<f;p++){var g=s,m=c(o,g);g+=4;var v=2147483647&m;if(1==(2147483648&m)>>>31)return console.warn("SIDX has hierarchical references (not supported)"),null;var y=c(o,g);g+=4,i.push({referenceSize:v,subsegmentDuration:y,info:{duration:y/u,start:d,end:d+v-1}}),d+=v,s=g+=4}return{earliestPresentationTime:0,timescale:u,version:a,referencesCount:f,references:i,moovEndOffset:n}}function f(t){for(var e=[],n=h(t,["moov","trak"]),r=0;r<n.length;r++){var o=n[r],a=h(o,["tkhd"])[0];if(a){var l=a.data[a.start],u=0===l?12:20,d=c(a,u),f=h(o,["mdia","mdhd"])[0];if(f){var p=c(f,u=0===(l=f.data[f.start])?12:20),g=h(o,["mdia","hdlr"])[0];if(g){var m=s(g.data.subarray(g.start+8,g.start+12)),v={soun:i.ElementaryStreamTypes.AUDIO,vide:i.ElementaryStreamTypes.VIDEO}[m];if(v){var y=h(o,["mdia","minf","stbl","stsd"])[0],b=void 0;y&&(b=s(y.data.subarray(y.start+12,y.start+16))),e[d]={timescale:p,type:v},e[v]={timescale:p,id:d,codec:b}}}}}}return h(t,["moov","mvex","trex"]).forEach((function(t){var n=c(t,4),r=e[n];r&&(r.default={duration:c(t,12),flags:c(t,20)})})),e}function p(t,e){return h(e,["moof","traf"]).reduce((function(e,n){var r=h(n,["tfdt"])[0],i=r.data[r.start],o=h(n,["tfhd"]).reduce((function(e,n){var o=c(n,4),a=t[o];if(a){var s=c(r,4);1===i&&(s*=Math.pow(2,32),s+=c(r,8));var l=s/(a.timescale||9e4);if(isFinite(l)&&(null===e||l<e))return l}return e}),null);return null!==o&&isFinite(o)&&(null===e||o<e)?o:e}),null)||0}function g(t,e){for(var n=0,r=0,o=0,a=h(t,["moof","traf"]),s=0;s<a.length;s++){var l=a[s],u=h(l,["tfhd"])[0],f=e[c(u,4)];if(f){var p=f.default,g=c(u,0)|(null==p?void 0:p.flags),v=null==p?void 0:p.duration;8&g&&(v=c(u,2&g?12:8));for(var y=f.timescale||9e4,b=h(l,["trun"]),x=0;x<b.length;x++)n=v?v*c(b[x],4):m(b[x]),f.type===i.ElementaryStreamTypes.VIDEO?r+=n/y:f.type===i.ElementaryStreamTypes.AUDIO&&(o+=n/y)}}if(0===r&&0===o){var C=d(t);if(null!=C&&C.references)return C.references.reduce((function(t,e){return t+e.info.duration||0}),0)}return r||o}function m(t){var e=c(t,0),n=8;1&e&&(n+=4),4&e&&(n+=4);for(var r=0,i=c(t,4),o=0;o<i;o++)256&e&&(r+=c(t,n),n+=4),512&e&&(n+=4),1024&e&&(n+=4),2048&e&&(n+=4);return r}function v(t,e,n){h(e,["moof","traf"]).forEach((function(e){h(e,["tfhd"]).forEach((function(r){var i=c(r,4),a=t[i];if(a){var s=a.timescale||9e4;h(e,["tfdt"]).forEach((function(t){var e=t.data[t.start],r=c(t,4);if(0===e)u(t,4,r-n*s);else{r*=Math.pow(2,32),r+=c(t,8),r-=n*s,r=Math.max(r,0);var i=Math.floor(r/(o+1)),a=Math.floor(r%(o+1));u(t,4,i),u(t,8,a)}}))}}))}))}function y(t){var e={valid:null,remainder:null},n=h(t,["moof"]);if(!n)return e;if(n.length<2)return e.remainder=t,e;var i=n[n.length-1];return e.valid=Object(r.sliceUint8)(t,0,i.start-8),e.remainder=Object(r.sliceUint8)(t,i.start-8),e}function b(t,e){var n=new Uint8Array(t.length+e.length);return n.set(t),n.set(e,t.length),n}},"./src/utils/output-filter.ts":
/*!************************************!*\
!*** ./src/utils/output-filter.ts ***!
\************************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return r}));var r=function(){function t(t,e){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=t,this.trackName=e}var e=t.prototype;return e.dispatchCue=function(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)},e.newCue=function(t,e,n){(null===this.startTime||this.startTime>t)&&(this.startTime=t),this.endTime=e,this.screen=n,this.timelineController.createCaptionsTrack(this.trackName)},e.reset=function(){this.cueRanges=[]},t}()},"./src/utils/texttrack-utils.ts":
/*!**************************************!*\
!*** ./src/utils/texttrack-utils.ts ***!
\**************************************/
/*! exports provided: sendAddTrackEvent, addCueToTrack, clearCurrentCues, removeCuesInRange, getCuesInRange */function(t,e,n){"use strict";n.r(e),n.d(e,"sendAddTrackEvent",(function(){return i})),n.d(e,"addCueToTrack",(function(){return o})),n.d(e,"clearCurrentCues",(function(){return a})),n.d(e,"removeCuesInRange",(function(){return s})),n.d(e,"getCuesInRange",(function(){return l}));var r=n(/*! ./logger */"./src/utils/logger.ts");function i(t,e){var n;try{n=new Event("addtrack")}catch(t){(n=document.createEvent("Event")).initEvent("addtrack",!1,!1)}n.track=t,e.dispatchEvent(n)}function o(t,e){var n=t.mode;if("disabled"===n&&(t.mode="hidden"),t.cues&&!t.cues.getCueById(e.id))try{if(t.addCue(e),!t.cues.getCueById(e.id))throw new Error("addCue is failed for: "+e)}catch(n){r.logger.debug("[texttrack-utils]: "+n);var i=new self.TextTrackCue(e.startTime,e.endTime,e.text);i.id=e.id,t.addCue(i)}"disabled"===n&&(t.mode=n)}function a(t){var e=t.mode;if("disabled"===e&&(t.mode="hidden"),t.cues)for(var n=t.cues.length;n--;)t.removeCue(t.cues[n]);"disabled"===e&&(t.mode=e)}function s(t,e,n){var r=t.mode;if("disabled"===r&&(t.mode="hidden"),t.cues&&t.cues.length>0)for(var i=l(t.cues,e,n),o=0;o<i.length;o++)t.removeCue(i[o]);"disabled"===r&&(t.mode=r)}function l(t,e,n){var r=[],i=function(t,e){if(e<t[0].startTime)return 0;var n=t.length-1;if(e>t[n].endTime)return-1;for(var r=0,i=n;r<=i;){var o=Math.floor((i+r)/2);if(e<t[o].startTime)i=o-1;else{if(!(e>t[o].startTime&&r<n))return o;r=o+1}}return t[r].startTime-e<e-t[i].startTime?r:i}(t,e);if(i>-1)for(var o=i,a=t.length;o<a;o++){var s=t[o];if(s.startTime>=e&&s.endTime<=n)r.push(s);else if(s.startTime>n)return r}return r}},"./src/utils/time-ranges.ts":
/*!**********************************!*\
!*** ./src/utils/time-ranges.ts ***!
\**********************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e),e.default={toString:function(t){for(var e="",n=t.length,r=0;r<n;r++)e+="["+t.start(r).toFixed(3)+","+t.end(r).toFixed(3)+"]";return e}}},"./src/utils/timescale-conversion.ts":
/*!*******************************************!*\
!*** ./src/utils/timescale-conversion.ts ***!
\*******************************************/
/*! exports provided: toTimescaleFromBase, toTimescaleFromScale, toMsFromMpegTsClock, toMpegTsClockFromTimescale */function(t,e,n){"use strict";function r(t,e,n,r){void 0===n&&(n=1),void 0===r&&(r=!1);var i=t*e*n;return r?Math.round(i):i}function i(t,e,n,i){return void 0===n&&(n=1),void 0===i&&(i=!1),r(t,e,1/n,i)}function o(t,e){return void 0===e&&(e=!1),r(t,1e3,1/9e4,e)}function a(t,e){return void 0===e&&(e=1),r(t,9e4,1/e)}n.r(e),n.d(e,"toTimescaleFromBase",(function(){return r})),n.d(e,"toTimescaleFromScale",(function(){return i})),n.d(e,"toMsFromMpegTsClock",(function(){return o})),n.d(e,"toMpegTsClockFromTimescale",(function(){return a}))},"./src/utils/typed-array.ts":
/*!**********************************!*\
!*** ./src/utils/typed-array.ts ***!
\**********************************/
/*! exports provided: sliceUint8 */function(t,e,n){"use strict";function r(t,e,n){return Uint8Array.prototype.slice?t.slice(e,n):new Uint8Array(Array.prototype.slice.call(t,e,n))}n.r(e),n.d(e,"sliceUint8",(function(){return r}))},"./src/utils/vttcue.ts":
/*!*****************************!*\
!*** ./src/utils/vttcue.ts ***!
\*****************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e),e.default=function(){if("undefined"!=typeof self&&self.VTTCue)return self.VTTCue;var t=["","lr","rl"],e=["start","middle","end","left","right"];function n(t,e){if("string"!=typeof e)return!1;if(!Array.isArray(t))return!1;var n=e.toLowerCase();return!!~t.indexOf(n)&&n}function r(t){return n(e,t)}function i(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];for(var i=1;i<arguments.length;i++){var o=arguments[i];for(var a in o)t[a]=o[a]}return t}function o(e,o,a){var s=this,l={enumerable:!0};s.hasBeenReset=!1;var c="",u=!1,h=e,d=o,f=a,p=null,g="",m=!0,v="auto",y="start",b=50,x="middle",C=50,S="middle";Object.defineProperty(s,"id",i({},l,{get:function(){return c},set:function(t){c=""+t}})),Object.defineProperty(s,"pauseOnExit",i({},l,{get:function(){return u},set:function(t){u=!!t}})),Object.defineProperty(s,"startTime",i({},l,{get:function(){return h},set:function(t){if("number"!=typeof t)throw new TypeError("Start time must be set to a number.");h=t,this.hasBeenReset=!0}})),Object.defineProperty(s,"endTime",i({},l,{get:function(){return d},set:function(t){if("number"!=typeof t)throw new TypeError("End time must be set to a number.");d=t,this.hasBeenReset=!0}})),Object.defineProperty(s,"text",i({},l,{get:function(){return f},set:function(t){f=""+t,this.hasBeenReset=!0}})),Object.defineProperty(s,"region",i({},l,{get:function(){return p},set:function(t){p=t,this.hasBeenReset=!0}})),Object.defineProperty(s,"vertical",i({},l,{get:function(){return g},set:function(e){var r=function(e){return n(t,e)}(e);if(!1===r)throw new SyntaxError("An invalid or illegal string was specified.");g=r,this.hasBeenReset=!0}})),Object.defineProperty(s,"snapToLines",i({},l,{get:function(){return m},set:function(t){m=!!t,this.hasBeenReset=!0}})),Object.defineProperty(s,"line",i({},l,{get:function(){return v},set:function(t){if("number"!=typeof t&&"auto"!==t)throw new SyntaxError("An invalid number or illegal string was specified.");v=t,this.hasBeenReset=!0}})),Object.defineProperty(s,"lineAlign",i({},l,{get:function(){return y},set:function(t){var e=r(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");y=e,this.hasBeenReset=!0}})),Object.defineProperty(s,"position",i({},l,{get:function(){return b},set:function(t){if(t<0||t>100)throw new Error("Position must be between 0 and 100.");b=t,this.hasBeenReset=!0}})),Object.defineProperty(s,"positionAlign",i({},l,{get:function(){return x},set:function(t){var e=r(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");x=e,this.hasBeenReset=!0}})),Object.defineProperty(s,"size",i({},l,{get:function(){return C},set:function(t){if(t<0||t>100)throw new Error("Size must be between 0 and 100.");C=t,this.hasBeenReset=!0}})),Object.defineProperty(s,"align",i({},l,{get:function(){return S},set:function(t){var e=r(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");S=e,this.hasBeenReset=!0}})),s.displayState=void 0}return o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o}()},"./src/utils/vttparser.ts":
/*!********************************!*\
!*** ./src/utils/vttparser.ts ***!
\********************************/
/*! exports provided: parseTimeStamp, fixLineBreaks, VTTParser */function(t,e,n){"use strict";n.r(e),n.d(e,"parseTimeStamp",(function(){return o})),n.d(e,"fixLineBreaks",(function(){return h})),n.d(e,"VTTParser",(function(){return d}));var r=n(/*! ./vttcue */"./src/utils/vttcue.ts"),i=function(){function t(){}return t.prototype.decode=function(t,e){if(!t)return"";if("string"!=typeof t)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))},t}();function o(t){function e(t,e,n,r){return 3600*(0|t)+60*(0|e)+(0|n)+parseFloat(r||0)}var n=t.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return n?parseFloat(n[2])>59?e(n[2],n[3],0,n[4]):e(n[1],n[2],n[3],n[4]):null}var a=function(){function t(){this.values=Object.create(null)}var e=t.prototype;return e.set=function(t,e){this.get(t)||""===e||(this.values[t]=e)},e.get=function(t,e,n){return n?this.has(t)?this.values[t]:e[n]:this.has(t)?this.values[t]:e},e.has=function(t){return t in this.values},e.alt=function(t,e,n){for(var r=0;r<n.length;++r)if(e===n[r]){this.set(t,e);break}},e.integer=function(t,e){/^-?\d+$/.test(e)&&this.set(t,parseInt(e,10))},e.percent=function(t,e){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(e)){var n=parseFloat(e);if(n>=0&&n<=100)return this.set(t,n),!0}return!1},t}();function s(t,e,n,r){var i=r?t.split(r):[t];for(var o in i)if("string"==typeof i[o]){var a=i[o].split(n);2===a.length&&e(a[0],a[1])}}var l=new r.default(0,0,""),c="middle"===l.align?"middle":"center";function u(t,e,n){var r=t;function i(){var e=o(t);if(null===e)throw new Error("Malformed timestamp: "+r);return t=t.replace(/^[^\sa-zA-Z-]+/,""),e}function u(){t=t.replace(/^\s+/,"")}if(u(),e.startTime=i(),u(),"--\x3e"!==t.substr(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+r);t=t.substr(3),u(),e.endTime=i(),u(),function(t,e){var r=new a;s(t,(function(t,e){var i;switch(t){case"region":for(var o=n.length-1;o>=0;o--)if(n[o].id===e){r.set(t,n[o].region);break}break;case"vertical":r.alt(t,e,["rl","lr"]);break;case"line":i=e.split(","),r.integer(t,i[0]),r.percent(t,i[0])&&r.set("snapToLines",!1),r.alt(t,i[0],["auto"]),2===i.length&&r.alt("lineAlign",i[1],["start",c,"end"]);break;case"position":i=e.split(","),r.percent(t,i[0]),2===i.length&&r.alt("positionAlign",i[1],["start",c,"end","line-left","line-right","auto"]);break;case"size":r.percent(t,e);break;case"align":r.alt(t,e,["start",c,"end","left","right"])}}),/:/,/\s/),e.region=r.get("region",null),e.vertical=r.get("vertical","");var i=r.get("line","auto");"auto"===i&&-1===l.line&&(i=-1),e.line=i,e.lineAlign=r.get("lineAlign","start"),e.snapToLines=r.get("snapToLines",!0),e.size=r.get("size",100),e.align=r.get("align",c);var o=r.get("position","auto");"auto"===o&&50===l.position&&(o="start"===e.align||"left"===e.align?0:"end"===e.align||"right"===e.align?100:50),e.position=o}(t,e)}function h(t){return t.replace(/<br(?: \/)?>/gi,"\n")}var d=function(){function t(){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=t.prototype;return e.parse=function(t){var e=this;function n(){var t=e.buffer,n=0;for(t=h(t);n<t.length&&"\r"!==t[n]&&"\n"!==t[n];)++n;var r=t.substr(0,n);return"\r"===t[n]&&++n,"\n"===t[n]&&++n,e.buffer=t.substr(n),r}t&&(e.buffer+=e.decoder.decode(t,{stream:!0}));try{var i="";if("INITIAL"===e.state){if(!/\r\n|\n/.test(e.buffer))return this;var o=(i=n()).match(/^()?WEBVTT([ \t].*)?$/);if(!o||!o[0])throw new Error("Malformed WebVTT signature.");e.state="HEADER"}for(var a=!1;e.buffer;){if(!/\r\n|\n/.test(e.buffer))return this;switch(a?a=!1:i=n(),e.state){case"HEADER":/:/.test(i)?s(i,(function(t,e){}),/:/):i||(e.state="ID");continue;case"NOTE":i||(e.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(i)){e.state="NOTE";break}if(!i)continue;if(e.cue=new r.default(0,0,""),e.state="CUE",-1===i.indexOf("--\x3e")){e.cue.id=i;continue}case"CUE":if(!e.cue){e.state="BADCUE";continue}try{u(i,e.cue,e.regionList)}catch(t){e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":var l=-1!==i.indexOf("--\x3e");if(!i||l&&(a=!0)){e.oncue&&e.cue&&e.oncue(e.cue),e.cue=null,e.state="ID";continue}if(null===e.cue)continue;e.cue.text&&(e.cue.text+="\n"),e.cue.text+=i;continue;case"BADCUE":i||(e.state="ID")}}}catch(t){"CUETEXT"===e.state&&e.cue&&e.oncue&&e.oncue(e.cue),e.cue=null,e.state="INITIAL"===e.state?"BADWEBVTT":"BADCUE"}return this},e.flush=function(){try{if((this.cue||"HEADER"===this.state)&&(this.buffer+="\n\n",this.parse()),"INITIAL"===this.state||"BADWEBVTT"===this.state)throw new Error("Malformed WebVTT signature.")}catch(t){this.onparsingerror&&this.onparsingerror(t)}return this.onflush&&this.onflush(),this},t}()},"./src/utils/webvtt-parser.ts":
/*!************************************!*\
!*** ./src/utils/webvtt-parser.ts ***!
\************************************/
/*! exports provided: generateCueId, parseWebVTT */function(t,e,n){"use strict";n.r(e),n.d(e,"generateCueId",(function(){return h})),n.d(e,"parseWebVTT",(function(){return d}));var r=n(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=n(/*! ./vttparser */"./src/utils/vttparser.ts"),o=n(/*! ../demux/id3 */"./src/demux/id3.ts"),a=n(/*! ./timescale-conversion */"./src/utils/timescale-conversion.ts"),s=n(/*! ../remux/mp4-remuxer */"./src/remux/mp4-remuxer.ts"),l=/\r\n|\n\r|\n|\r/g,c=function(t,e,n){return void 0===n&&(n=0),t.substr(n,e.length)===e},u=function(t){for(var e=5381,n=t.length;n;)e=33*e^t.charCodeAt(--n);return(e>>>0).toString()};function h(t,e,n){return u(t.toString())+u(e.toString())+u(n)}function d(t,e,n,u,d,f,p,g){var m,v=new i.VTTParser,y=Object(o.utf8ArrayToStr)(new Uint8Array(t)).trim().replace(l,"\n").split("\n"),b=[],x=Object(a.toMpegTsClockFromTimescale)(e,n),C="00:00.000",S=0,E=0,k=!0,w=!1;v.oncue=function(t){var e=u[d],n=u.ccOffset,r=(S-x)/9e4;if(null!=e&&e.new&&(void 0!==E?n=u.ccOffset=e.start:function(t,e,n){var r=t[e],i=t[r.prevCC];if(!i||!i.new&&r.new)return t.ccOffset=t.presentationOffset=r.start,void(r.new=!1);for(;null!==(o=i)&&void 0!==o&&o.new;){var o;t.ccOffset+=r.start-i.start,r.new=!1,i=t[(r=i).prevCC]}t.presentationOffset=n}(u,d,r)),r&&(n=r-u.presentationOffset),w){var i=t.endTime-t.startTime,o=Object(s.normalizePts)(9e4*(t.startTime+n-E),9e4*f)/9e4;t.startTime=o,t.endTime=o+i}var a=t.text.trim();t.text=decodeURIComponent(encodeURIComponent(a)),t.id||(t.id=h(t.startTime,t.endTime,a)),t.endTime>0&&b.push(t)},v.onparsingerror=function(t){m=t},v.onflush=function(){m?g(m):p(b)},y.forEach((function(t){if(k){if(c(t,"X-TIMESTAMP-MAP=")){k=!1,w=!0,t.substr(16).split(",").forEach((function(t){c(t,"LOCAL:")?C=t.substr(6):c(t,"MPEGTS:")&&(S=parseInt(t.substr(7)))}));try{E=function(t){var e=parseInt(t.substr(-3)),n=parseInt(t.substr(-6,2)),i=parseInt(t.substr(-9,2)),o=t.length>9?parseInt(t.substr(0,t.indexOf(":"))):0;if(!(Object(r.isFiniteNumber)(e)&&Object(r.isFiniteNumber)(n)&&Object(r.isFiniteNumber)(i)&&Object(r.isFiniteNumber)(o)))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+t);return e+=1e3*n,e+=6e4*i,e+=36e5*o}(C)/1e3}catch(t){w=!1,m=t}return}""===t&&(k=!1)}v.parse(t+"\n")})),v.flush()}},"./src/utils/xhr-loader.ts":
/*!*********************************!*\
!*** ./src/utils/xhr-loader.ts ***!
\*********************************/
/*! exports provided: default */function(t,e,n){"use strict";n.r(e);var r=n(/*! ../utils/logger */"./src/utils/logger.ts"),i=n(/*! ../loader/load-stats */"./src/loader/load-stats.ts"),o=/^age:\s*[\d.]+\s*$/m,a=function(){function t(t){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=t?t.xhrSetup:null,this.stats=new i.LoadStats,this.retryDelay=0}var e=t.prototype;return e.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},e.abortInternal=function(){var t=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),t&&(t.onreadystatechange=null,t.onprogress=null,4!==t.readyState&&(this.stats.aborted=!0,t.abort()))},e.abort=function(){var t;this.abortInternal(),null!==(t=this.callbacks)&&void 0!==t&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},e.load=function(t,e,n){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=t,this.config=e,this.callbacks=n,this.retryDelay=e.retryDelay,this.loadInternal()},e.loadInternal=function(){var t=this.config,e=this.context;if(t){var n=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0;var i=this.xhrSetup;try{if(i)try{i(n,e.url)}catch(t){n.open("GET",e.url,!0),i(n,e.url)}n.readyState||n.open("GET",e.url,!0);var o=this.context.headers;if(o)for(var a in o)n.setRequestHeader(a,o[a])}catch(t){return void this.callbacks.onError({code:n.status,text:t.message},e,n)}e.rangeEnd&&n.setRequestHeader("Range","bytes="+e.rangeStart+"-"+(e.rangeEnd-1)),n.onreadystatechange=this.readystatechange.bind(this),n.onprogress=this.loadprogress.bind(this),n.responseType=e.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),t.timeout),n.send()}},e.readystatechange=function(){var t=this.context,e=this.loader,n=this.stats;if(t&&e){var i=e.readyState,o=this.config;if(!n.aborted&&i>=2)if(self.clearTimeout(this.requestTimeout),0===n.loading.first&&(n.loading.first=Math.max(self.performance.now(),n.loading.start)),4===i){e.onreadystatechange=null,e.onprogress=null;var a=e.status;if(a>=200&&a<300){var s,l;if(n.loading.end=Math.max(self.performance.now(),n.loading.first),l="arraybuffer"===t.responseType?(s=e.response).byteLength:(s=e.responseText).length,n.loaded=n.total=l,!this.callbacks)return;var c=this.callbacks.onProgress;if(c&&c(n,t,s,e),!this.callbacks)return;var u={url:e.responseURL,data:s};this.callbacks.onSuccess(u,n,t,e)}else n.retry>=o.maxRetry||a>=400&&a<499?(r.logger.error(a+" while loading "+t.url),this.callbacks.onError({code:a,text:e.statusText},t,e)):(r.logger.warn(a+" while loading "+t.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,o.maxRetryDelay),n.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),o.timeout)}},e.loadtimeout=function(){r.logger.warn("timeout while loading "+this.context.url);var t=this.callbacks;t&&(this.abortInternal(),t.onTimeout(this.stats,this.context,this.loader))},e.loadprogress=function(t){var e=this.stats;e.loaded=t.loaded,t.lengthComputable&&(e.total=t.total)},e.getCacheAge=function(){var t=null;if(this.loader&&o.test(this.loader.getAllResponseHeaders())){var e=this.loader.getResponseHeader("age");t=e?parseFloat(e):null}return t},t}();e.default=a}}).default},t.exports=r())},vHTk:
/*!******************************************************!*\
!*** ./src/components/PreviewAll/index.less?modules ***!
\******************************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){t.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wCXF:
/*!********************************************************!*\
!*** ./node_modules/rc-table/es/Table.js + 17 modules ***!
\********************************************************/
/*! exports provided: INTERNAL_HOOKS, default */
/*! exports used: INTERNAL_HOOKS, default */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/defineProperty.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/typeof.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/raf/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-resize-observer/es/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/Cell/index.js because of ./node_modules/antd/es/table/Table.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/Footer/index.js because of ./node_modules/antd/es/table/Table.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/context/TableContext.js because of ./node_modules/antd/es/table/Table.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/hooks/useColumns.js because of ./node_modules/antd/es/table/Table.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/sugar/Column.js because of ./node_modules/antd/es/table/Table.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/sugar/ColumnGroup.js because of ./node_modules/antd/es/table/Table.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/utils/legacyUtil.js because of ./node_modules/antd/es/table/Table.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/utils/valueUtil.js because of ./node_modules/antd/es/table/Table.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Dom/addEventListener.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Dom/css.js because of ./node_modules/rc-image/es/Image.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/getScrollBarSize.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/ref.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/warning.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/shallowequal/index.js (<- Module is not an ECMAScript module) */function(t,e,n){"use strict";n.d(e,"a",(function(){return J}));var r=n("rePB"),i=n("VTBJ"),o=n("KQm4"),a=n("U8pU"),s=n("ODXe"),l=n("q1tI"),c=n("TSYQ"),u=n.n(c),h=n("Gytx"),d=n.n(h),f=n("Kwbf"),p=n("t23M"),g=n("qx4F"),m=n("6eGT"),v=n("IBYe"),y=n("Ff2n"),b=n("c+Xe"),x=n("fyJ8"),C=n("biw7");function S(t,e,n,r,i){var o,a,s=n[t]||{},l=n[e]||{};"left"===s.fixed?o=r.left[t]:"right"===l.fixed&&(a=r.right[e]);var c=!1,u=!1,h=!1,d=!1,f=n[e+1],p=n[t-1];if("rtl"===i){if(void 0!==o)d=!(p&&"left"===p.fixed);else if(void 0!==a){h=!(f&&"right"===f.fixed)}}else if(void 0!==o){c=!(f&&"left"===f.fixed)}else if(void 0!==a){u=!(p&&"right"===p.fixed)}return{fixLeft:o,fixRight:a,lastFixLeft:c,firstFixRight:u,lastFixRight:h,firstFixLeft:d,isSticky:r.isSticky}}var E=n("sR1s");function k(t){var e,n=t.cells,r=t.stickyOffsets,i=t.flattenColumns,o=t.rowComponent,a=t.cellComponent,s=t.onHeaderRow,c=t.index,u=l.useContext(C.a),h=u.prefixCls,d=u.direction;s&&(e=s(n.map((function(t){return t.column})),c));var f=Object(E.a)(n.map((function(t){return t.column})));return l.createElement(o,Object.assign({},e),n.map((function(t,e){var n,o=t.column,s=S(t.colStart,t.colEnd,i,r,d);return o&&o.onHeaderCell&&(n=t.column.onHeaderCell(o)),l.createElement(x.a,Object.assign({},t,{ellipsis:o.ellipsis,align:o.align,component:a,prefixCls:h,key:f[e]},s,{additionalProps:n,rowType:"header"}))})))}k.displayName="HeaderRow";var w=k;var T=function(t){var e=t.stickyOffsets,n=t.columns,r=t.flattenColumns,i=t.onHeaderRow,o=l.useContext(C.a),a=o.prefixCls,s=o.getComponent,c=l.useMemo((function(){return function(t){var e=[];!function t(n,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;e[i]=e[i]||[];var o=r,a=n.filter(Boolean).map((function(n){var r={key:n.key,className:n.className||"",children:n.title,column:n,colStart:o},a=1,s=n.children;return s&&s.length>0&&(a=t(s,o,i+1).reduce((function(t,e){return t+e}),0),r.hasSubColumns=!0),"colSpan"in n&&(a=n.colSpan),"rowSpan"in n&&(r.rowSpan=n.rowSpan),r.colSpan=a,r.colEnd=r.colStart+a-1,e[i].push(r),o+=a,a}));return a}(t,0);for(var n=e.length,r=function(t){e[t].forEach((function(e){"rowSpan"in e||e.hasSubColumns||(e.rowSpan=n-t)}))},i=0;i<n;i+=1)r(i);return e}(n)}),[n]),u=s(["header","wrapper"],"thead"),h=s(["header","row"],"tr"),d=s(["header","cell"],"th");return l.createElement(u,{className:"".concat(a,"-thead")},c.map((function(t,n){return l.createElement(w,{key:n,flattenColumns:r,cells:t,stickyOffsets:e,rowComponent:h,cellComponent:d,onHeaderRow:i,index:n})})))},O=n("hW8S");var L=function(t){for(var e=t.colWidths,n=t.columns,r=[],i=!1,o=(t.columCount||n.length)-1;o>=0;o-=1){var a=e[o],s=n&&n[o],c=s&&s[O.a];(a||c||i)&&(r.unshift(l.createElement("col",Object.assign({key:o,style:{width:a,minWidth:a}},c))),i=!0)}return l.createElement("colgroup",null,r)};var A=l.forwardRef((function(t,e){var n=t.noData,a=t.columns,s=t.flattenColumns,c=t.colWidths,h=t.columCount,d=t.stickyOffsets,f=t.direction,p=t.fixHeader,g=t.offsetHeader,m=t.stickyClassName,v=t.onScroll,x=Object(y.a)(t,["noData","columns","flattenColumns","colWidths","columCount","stickyOffsets","direction","fixHeader","offsetHeader","stickyClassName","onScroll"]),S=l.useContext(C.a),E=S.prefixCls,k=S.scrollbarSize,w=S.isSticky,O=w&&!p?0:k,A=l.useRef(null),D=l.useCallback((function(t){Object(b.b)(e,t),Object(b.b)(A,t)}),[]);l.useEffect((function(){var t;function e(t){var e=t.currentTarget,n=t.deltaX;n&&(v({currentTarget:e,scrollLeft:e.scrollLeft+n}),t.preventDefault())}return null===(t=A.current)||void 0===t||t.addEventListener("wheel",e),function(){var t;null===(t=A.current)||void 0===t||t.removeEventListener("wheel",e)}}),[]);var R=s[s.length-1],M={fixed:R?R.fixed:null,onHeaderCell:function(){return{className:"".concat(E,"-cell-scrollbar")}}},I=Object(l.useMemo)((function(){return O?[].concat(Object(o.a)(a),[M]):a}),[O,a]),_=Object(l.useMemo)((function(){return O?[].concat(Object(o.a)(s),[M]):s}),[O,s]),P=Object(l.useMemo)((function(){var t=d.right,e=d.left;return Object(i.a)(Object(i.a)({},d),{},{left:"rtl"===f?[].concat(Object(o.a)(e.map((function(t){return t+O}))),[0]):e,right:"rtl"===f?t:[].concat(Object(o.a)(t.map((function(t){return t+O}))),[0]),isSticky:w})}),[O,d,w]),N=function(t,e){return Object(l.useMemo)((function(){for(var n=[],r=0;r<e;r+=1){var i=t[r];if(void 0===i)return null;n[r]=i}return n}),[t.join("_"),e])}(c,h);return l.createElement("div",{style:Object(i.a)({overflow:"hidden"},w?{top:g}:{}),ref:D,className:u()("".concat(E,"-header"),Object(r.a)({},m,!!m))},l.createElement("table",{style:{tableLayout:"fixed",visibility:n||N?null:"hidden"}},l.createElement(L,{colWidths:N?[].concat(Object(o.a)(N),[O]):[],columCount:h+1,columns:_}),l.createElement(T,Object.assign({},x,{stickyOffsets:P,columns:I,flattenColumns:_}))))}));A.displayName="FixedHeader";var D=A,R=l.createContext(null);var M=function(t){var e=t.prefixCls,n=t.children,r=t.component,i=t.cellComponent,o=t.fixHeader,a=t.fixColumn,s=t.horizonScroll,c=t.className,u=t.expanded,h=t.componentWidth,d=t.colSpan,f=l.useContext(C.a).scrollbarSize;return l.useMemo((function(){var t=n;return a&&(t=l.createElement("div",{style:{width:h-(o?f:0),position:"sticky",left:0,overflow:"hidden"},className:"".concat(e,"-expanded-row-fixed")},t)),l.createElement(r,{className:c,style:{display:u?null:"none"}},l.createElement(x.a,{component:i,prefixCls:e,colSpan:d},t))}),[n,r,o,s,c,u,h,d,f])};function I(t){var e=t.className,n=t.style,r=t.record,o=t.index,a=t.rowKey,c=t.getRowKey,h=t.rowExpandable,d=t.expandedKeys,f=t.onRow,p=t.indent,g=void 0===p?0:p,m=t.rowComponent,v=t.cellComponent,y=t.childrenColumnName,b=l.useContext(C.a),S=b.prefixCls,k=b.fixedInfoList,w=l.useContext(R),T=w.fixHeader,O=w.fixColumn,L=w.horizonScroll,A=w.componentWidth,D=w.flattenColumns,_=w.expandableType,P=w.expandRowByClick,N=w.onTriggerExpand,j=w.rowClassName,F=w.expandedRowClassName,B=w.indentSize,U=w.expandIcon,H=w.expandedRowRender,z=w.expandIconColumnIndex,G=l.useState(!1),V=Object(s.a)(G,2),W=V[0],K=V[1],q=d&&d.has(t.recordKey);l.useEffect((function(){q&&K(!0)}),[q]);var Y,X="row"===_&&(!h||h(r)),$="nest"===_,Z=y&&r&&r[y],J=X||$;f&&(Y=f(r,o));var Q;"string"==typeof j?Q=j:"function"==typeof j&&(Q=j(r,o,g));var tt,et,nt=Object(E.a)(D),rt=l.createElement(m,Object.assign({},Y,{"data-row-key":a,className:u()(e,"".concat(S,"-row"),"".concat(S,"-row-level-").concat(g),Q,Y&&Y.className),style:Object(i.a)(Object(i.a)({},n),Y?Y.style:null),onClick:function(t){if(P&&J&&N(r,t),Y&&Y.onClick){for(var e,n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];(e=Y).onClick.apply(e,[t].concat(i))}}}),D.map((function(t,e){var n,i,a=t.render,s=t.dataIndex,c=t.className,u=nt[e],h=k[e];return e===(z||0)&&$&&(n=l.createElement(l.Fragment,null,l.createElement("span",{style:{paddingLeft:"".concat(B*g,"px")},className:"".concat(S,"-row-indent indent-level-").concat(g)}),U({prefixCls:S,expanded:q,expandable:Z,record:r,onExpand:N}))),t.onCell&&(i=t.onCell(r,o)),l.createElement(x.a,Object.assign({className:c,ellipsis:t.ellipsis,align:t.align,component:v,prefixCls:S,key:u,record:r,index:o,dataIndex:s,render:a,shouldCellUpdate:t.shouldCellUpdate},h,{appendNode:n,additionalProps:i}))})));if(X&&(W||q)){var it=H(r,o,g+1,q),ot=F&&F(r,o,g);tt=l.createElement(M,{expanded:q,className:u()("".concat(S,"-expanded-row"),"".concat(S,"-expanded-row-level-").concat(g+1),ot),prefixCls:S,fixHeader:T,fixColumn:O,horizonScroll:L,component:m,componentWidth:A,cellComponent:v,colSpan:D.length},it)}return Z&&q&&(et=(r[y]||[]).map((function(e,n){var r=c(e,n);return l.createElement(I,Object.assign({},t,{key:r,rowKey:r,record:e,recordKey:r,index:n,indent:g+1}))}))),l.createElement(l.Fragment,null,rt,tt,et)}I.displayName="BodyRow";var _=I,P=l.createContext(null);function N(t){var e=t.columnKey,n=t.onColumnResize,r=l.useRef();return l.useEffect((function(){r.current&&n(e,r.current.offsetWidth)}),[]),l.createElement(p.a,{onResize:function(t){var r=t.offsetWidth;n(e,r)}},l.createElement("td",{ref:r,style:{padding:0,border:0,height:0}},l.createElement("div",{style:{height:0,overflow:"hidden"}}," ")))}var j=l.memo((function(t){var e=t.data,n=t.getRowKey,r=t.measureColumnWidth,i=t.expandedKeys,o=t.onRow,a=t.rowExpandable,s=t.emptyNode,c=t.childrenColumnName,u=l.useContext(P).onColumnResize,h=l.useContext(C.a),d=h.prefixCls,f=h.getComponent,p=l.useContext(R),g=p.fixHeader,m=p.horizonScroll,v=p.flattenColumns,y=p.componentWidth;return l.useMemo((function(){var t,h=f(["body","wrapper"],"tbody"),p=f(["body","row"],"tr"),b=f(["body","cell"],"td");t=e.length?e.map((function(t,e){var r=n(t,e);return l.createElement(_,{key:r,rowKey:r,record:t,recordKey:r,index:e,rowComponent:p,cellComponent:b,expandedKeys:i,onRow:o,getRowKey:n,rowExpandable:a,childrenColumnName:c})})):l.createElement(M,{expanded:!0,className:"".concat(d,"-placeholder"),prefixCls:d,fixHeader:g,fixColumn:m,horizonScroll:m,component:p,componentWidth:y,cellComponent:b,colSpan:v.length},s);var x=Object(E.a)(v);return l.createElement(h,{className:"".concat(d,"-tbody")},r&&l.createElement("tr",{"aria-hidden":"true",className:"".concat(d,"-measure-row"),style:{height:0}},x.map((function(t){return l.createElement(N,{key:t,columnKey:t,onColumnResize:u})}))),t)}),[e,d,o,r,i,n,f,y,s,v])}));j.displayName="Body";var F=j,B=n("wRmb"),U=n("xEkU"),H=n.n(U);function z(t){var e=Object(l.useRef)(t),n=Object(l.useState)({}),r=Object(s.a)(n,2)[1],i=Object(l.useRef)(null),o=Object(l.useRef)([]);return Object(l.useEffect)((function(){return function(){H.a.cancel(i.current)}}),[]),[e.current,function(t){null===i.current&&(o.current=[],i.current=H()((function(){o.current.forEach((function(t){e.current=t(e.current)})),i.current=null,r({})}))),o.current.push(t)}]}var G=function(t,e,n){return Object(l.useMemo)((function(){for(var r=[],i=[],o=0,a=0,s=0;s<e;s+=1)if("rtl"===n){i[s]=a,a+=t[s]||0;var l=e-s-1;r[l]=o,o+=t[l]||0}else{r[s]=o,o+=t[s]||0;var c=e-s-1;i[c]=a,a+=t[c]||0}return{left:r,right:i}}),[t,e,n])};var V=function(t){var e=t.className,n=t.children;return l.createElement("div",{className:e},n)},W=n("n6Qo");function K(t){var e,n=t.prefixCls,i=t.record,o=t.onExpand,a=t.expanded,s=t.expandable,c="".concat(n,"-row-expand-icon");if(!s)return l.createElement("span",{className:u()(c,"".concat(n,"-row-spaced"))});return l.createElement("span",{className:u()(c,(e={},Object(r.a)(e,"".concat(n,"-row-expanded"),a),Object(r.a)(e,"".concat(n,"-row-collapsed"),!a),e)),onClick:function(t){o(i,t),t.stopPropagation()}})}var q=n("zT1h"),Y=n("y0+3"),X=l.forwardRef((function(t,e){var n,o,a=t.scrollBodyRef,c=t.onScroll,h=t.offsetScroll,d=l.useContext(C.a).prefixCls,f=(null===(n=a.current)||void 0===n?void 0:n.scrollWidth)||0,p=(null===(o=a.current)||void 0===o?void 0:o.clientWidth)||0,m=f&&p*(p/f),v=l.useRef(),y=z({scrollLeft:0,isHiddenScrollBar:!1}),b=Object(s.a)(y,2),x=b[0],S=b[1],E=l.useRef({delta:0,x:0}),k=l.useState(!1),w=Object(s.a)(k,2),T=w[0],O=w[1],L=function(){O(!1)},A=function(t){var e,n=(t||(null===(e=window)||void 0===e?void 0:e.event)).buttons;if(T&&0!==n){var r=E.current.x+t.pageX-E.current.x-E.current.delta;r<=0&&(r=0),r+m>=p&&(r=p-m),c({scrollLeft:r/p*(f+2)}),E.current.x=t.pageX}else T&&O(!1)},D=function(){var t=Object(Y.b)(a.current).top,e=t+a.current.offsetHeight,n=document.documentElement.scrollTop+window.innerHeight;e-Object(g.a)()<=n||t>=n-h?S((function(t){return Object(i.a)(Object(i.a)({},t),{},{isHiddenScrollBar:!0})})):S((function(t){return Object(i.a)(Object(i.a)({},t),{},{isHiddenScrollBar:!1})}))},R=function(t){S((function(e){return Object(i.a)(Object(i.a)({},e),{},{scrollLeft:t/f*p||0})}))};return l.useImperativeHandle(e,(function(){return{setScrollLeft:R}})),l.useEffect((function(){var t=Object(q.a)(document.body,"mouseup",L,!1),e=Object(q.a)(document.body,"mousemove",A,!1);return D(),function(){t.remove(),e.remove()}}),[m,T]),l.useEffect((function(){var t=Object(q.a)(window,"scroll",D,!1),e=Object(q.a)(window,"resize",D,!1);return function(){t.remove(),e.remove()}}),[]),l.useEffect((function(){x.isHiddenScrollBar||S((function(t){var e,n;return Object(i.a)(Object(i.a)({},t),{},{scrollLeft:a.current.scrollLeft/(null===(e=a.current)||void 0===e?void 0:e.scrollWidth)*(null===(n=a.current)||void 0===n?void 0:n.clientWidth)})}))}),[x.isHiddenScrollBar]),f<=p||!m||x.isHiddenScrollBar?null:l.createElement("div",{style:{height:Object(g.a)(),width:p,bottom:h},className:"".concat(d,"-sticky-scroll")},l.createElement("div",{onMouseDown:function(t){t.persist(),E.current.delta=t.pageX-x.scrollLeft,E.current.x=0,O(!0),t.preventDefault()},ref:v,className:u()("".concat(d,"-sticky-scroll-bar"),Object(r.a)({},"".concat(d,"-sticky-scroll-bar-active"),T)),style:{width:"".concat(m,"px"),transform:"translate3d(".concat(x.scrollLeft,"px, 0, 0)")}}))}));var $=[],Z={},J="rc-table-internal-hook",Q=l.memo((function(t){return t.children}),(function(t,e){return!!d()(t.props,e.props)&&(t.pingLeft!==e.pingLeft||t.pingRight!==e.pingRight)}));function tt(t){var e,n=t.prefixCls,c=t.className,h=t.rowClassName,d=t.style,m=t.data,v=t.rowKey,y=t.scroll,b=t.tableLayout,x=t.direction,k=t.title,w=t.footer,A=t.summary,M=t.id,I=t.showHeader,_=t.components,N=t.emptyText,j=t.onRow,U=t.onHeaderRow,H=t.internalHooks,q=t.transformColumns,Y=t.internalRefs,tt=t.sticky,et=m||$,nt=!!et.length,rt=l.useState(0),it=Object(s.a)(rt,2),ot=it[0],at=it[1];l.useEffect((function(){at(Object(g.a)())}));var st,lt,ct,ut=l.useMemo((function(){return Object(E.c)(_,{})}),[_]),ht=l.useCallback((function(t,e){return Object(E.b)(ut,t)||e}),[ut]),dt=l.useMemo((function(){return"function"==typeof v?v:function(t){return t&&t[v]}}),[v]),ft=Object(O.c)(t),pt=ft.expandIcon,gt=ft.expandedRowKeys,mt=ft.defaultExpandedRowKeys,vt=ft.defaultExpandAllRows,yt=ft.expandedRowRender,bt=ft.onExpand,xt=ft.onExpandedRowsChange,Ct=ft.expandRowByClick,St=ft.rowExpandable,Et=ft.expandIconColumnIndex,kt=ft.expandedRowClassName,wt=ft.childrenColumnName,Tt=ft.indentSize,Ot=pt||K,Lt=wt||"children",At=l.useMemo((function(){return yt?"row":!!(t.expandable&&H===J&&t.expandable.__PARENT_RENDER_ICON__||et.some((function(t){return t&&"object"===Object(a.a)(t)&&t[Lt]})))&&"nest"}),[!!yt,et]),Dt=l.useState((function(){return mt||(vt?function(t,e,n){var r=[];return function t(i){(i||[]).forEach((function(i,o){r.push(e(i,o)),t(i[n])}))}(t),r}(et,dt,Lt):[])})),Rt=Object(s.a)(Dt,2),Mt=Rt[0],It=Rt[1],_t=l.useMemo((function(){return new Set(gt||Mt||[])}),[gt,Mt]),Pt=l.useCallback((function(t){var e,n=dt(t,et.indexOf(t)),r=_t.has(n);r?(_t.delete(n),e=Object(o.a)(_t)):e=[].concat(Object(o.a)(_t),[n]),It(e),bt&&bt(!r,t),xt&&xt(e)}),[dt,_t,et,bt,xt]),Nt=l.useState(0),jt=Object(s.a)(Nt,2),Ft=jt[0],Bt=jt[1],Ut=Object(B.b)(Object(i.a)(Object(i.a)(Object(i.a)({},t),ft),{},{expandable:!!yt,expandedKeys:_t,getRowKey:dt,onTriggerExpand:Pt,expandIcon:Ot,expandIconColumnIndex:Et,direction:x}),H===J?q:null),Ht=Object(s.a)(Ut,2),zt=Ht[0],Gt=Ht[1],Vt=l.useMemo((function(){return{columns:zt,flattenColumns:Gt}}),[zt,Gt]),Wt=l.useRef(),Kt=l.useRef(),qt=l.useRef(),Yt=l.useState(!1),Xt=Object(s.a)(Yt,2),$t=Xt[0],Zt=Xt[1],Jt=l.useState(!1),Qt=Object(s.a)(Jt,2),te=Qt[0],ee=Qt[1],ne=z(new Map),re=Object(s.a)(ne,2),ie=re[0],oe=re[1],ae=Object(E.a)(Gt).map((function(t){return ie.get(t)})),se=l.useMemo((function(){return ae}),[ae.join("_")]),le=G(se,Gt.length,x),ce=y&&Object(E.d)(y.y),ue=y&&Object(E.d)(y.x),he=ue&&Gt.some((function(t){return t.fixed})),de=l.useRef(),fe=function(t,e){return l.useMemo((function(){var n=!!t;return{isSticky:n,stickyClassName:n?"".concat(e,"-sticky-header"):"",offsetHeader:"object"===Object(a.a)(t)&&t.offsetHeader||0,offsetScroll:"object"===Object(a.a)(t)&&t.offsetScroll||0}}),[t,e])}(tt,n),pe=fe.isSticky,ge=fe.offsetHeader,me=fe.offsetScroll,ve=fe.stickyClassName;ce&&(lt={overflowY:"scroll",maxHeight:y.y}),ue&&(st={overflowX:"auto"},ce||(lt={overflowY:"hidden"}),ct={width:!0===y.x?"auto":y.x,minWidth:"100%"});var ye=l.useCallback((function(t,e){oe((function(n){var r=new Map(n);return r.set(t,e),r}))}),[]),be=function(t){var e=Object(l.useRef)(t),n=Object(l.useRef)(null);function r(){window.clearTimeout(n.current)}return Object(l.useEffect)((function(){return r}),[]),[function(t){e.current=t,r(),n.current=window.setTimeout((function(){e.current=null,n.current=null}),100)},function(){return e.current}]}(null),xe=Object(s.a)(be,2),Ce=xe[0],Se=xe[1];function Ee(t,e){e&&("function"==typeof e?e(t):e.scrollLeft!==t&&(e.scrollLeft=t))}var ke=function(t){var e,n=t.currentTarget,r=t.scrollLeft,i="number"==typeof r?r:n.scrollLeft,o=n||Z;Se()&&Se()!==o||(Ce(o),Ee(i,Kt.current),Ee(i,qt.current),Ee(i,null===(e=de.current)||void 0===e?void 0:e.setScrollLeft));if(n){var a=n.scrollWidth,s=n.clientWidth;Zt(i>0),ee(i<a-s)}},we=function(){qt.current&&ke({currentTarget:qt.current})};l.useEffect((function(){return we}),[]),l.useEffect((function(){ue&&we()}),[ue]),l.useEffect((function(){H===J&&Y&&(Y.body.current=qt.current)}));var Te,Oe,Le=ht(["table"],"table"),Ae=l.useMemo((function(){return b||(he?"max-content"===y.x?"auto":"fixed":ce||Gt.some((function(t){return t.ellipsis}))?"fixed":"auto")}),[ce,he,Gt,b]),De={colWidths:se,columCount:Gt.length,stickyOffsets:le,onHeaderRow:U,fixHeader:ce},Re=l.useMemo((function(){return nt?null:"function"==typeof N?N():N}),[nt,N]),Me=l.createElement(F,{data:et,measureColumnWidth:ce||ue||pe,expandedKeys:_t,rowExpandable:St,getRowKey:dt,onRow:j,emptyNode:Re,childrenColumnName:Lt}),Ie=l.createElement(L,{colWidths:Gt.map((function(t){return t.width})),columns:Gt}),_e=A&&l.createElement(W.b,null,A(et)),Pe=ht(["body"]);ce||pe?("function"==typeof Pe?(Oe=Pe(et,{scrollbarSize:ot,ref:qt,onScroll:ke}),De.colWidths=Gt.map((function(t,e){var n=t.width,r=e===zt.length-1?n-ot:n;return"number"!=typeof r||Number.isNaN(r)?(Object(f.a)(!1,"When use `components.body` with render props. Each column should have a fixed value."),0):r}))):Oe=l.createElement("div",{style:Object(i.a)(Object(i.a)({},st),lt),onScroll:ke,ref:qt,className:u()("".concat(n,"-body"))},l.createElement(Le,{style:Object(i.a)(Object(i.a)({},ct),{},{tableLayout:Ae})},Ie,Me,_e),pe&&l.createElement(X,{ref:de,offsetScroll:me,scrollBodyRef:qt,onScroll:ke})),Te=l.createElement(l.Fragment,null,!1!==I&&l.createElement(D,Object.assign({noData:!et.length},De,Vt,{direction:x,offsetHeader:ge,stickyClassName:ve,ref:Kt,onScroll:ke})),Oe)):Te=l.createElement("div",{style:Object(i.a)(Object(i.a)({},st),lt),className:u()("".concat(n,"-content")),onScroll:ke,ref:qt},l.createElement(Le,{style:Object(i.a)(Object(i.a)({},ct),{},{tableLayout:Ae})},Ie,!1!==I&&l.createElement(T,Object.assign({},De,Vt)),Me,_e));var Ne=Object(O.b)(t),je=l.createElement("div",Object.assign({className:u()(n,c,(e={},Object(r.a)(e,"".concat(n,"-rtl"),"rtl"===x),Object(r.a)(e,"".concat(n,"-ping-left"),$t),Object(r.a)(e,"".concat(n,"-ping-right"),te),Object(r.a)(e,"".concat(n,"-layout-fixed"),"fixed"===b),Object(r.a)(e,"".concat(n,"-fixed-header"),ce),Object(r.a)(e,"".concat(n,"-fixed-column"),he),Object(r.a)(e,"".concat(n,"-scroll-horizontal"),ue),Object(r.a)(e,"".concat(n,"-has-fix-left"),Gt[0]&&Gt[0].fixed),Object(r.a)(e,"".concat(n,"-has-fix-right"),Gt[Gt.length-1]&&"right"===Gt[Gt.length-1].fixed),e)),style:d,id:M,ref:Wt},Ne),l.createElement(Q,{pingLeft:$t,pingRight:te,props:Object(i.a)(Object(i.a)({},t),{},{stickyOffsets:le,mergedExpandedKeys:_t})},k&&l.createElement(V,{className:"".concat(n,"-title")},k(et)),l.createElement("div",{className:"".concat(n,"-container")},Te),w&&l.createElement(V,{className:"".concat(n,"-footer")},w(et))));ue&&(je=l.createElement(p.a,{onResize:function(t){var e=t.width;we(),Bt(Wt.current?Wt.current.offsetWidth:e)}},je));var Fe=l.useMemo((function(){return{prefixCls:n,getComponent:ht,scrollbarSize:ot,direction:x,fixedInfoList:Gt.map((function(t,e){return S(e,e,Gt,le,x)})),isSticky:pe}}),[n,ht,ot,x,Gt,le,x,pe]),Be=l.useMemo((function(){return Object(i.a)(Object(i.a)({},Vt),{},{tableLayout:Ae,rowClassName:h,expandedRowClassName:kt,componentWidth:Ft,fixHeader:ce,fixColumn:he,horizonScroll:ue,expandIcon:Ot,expandableType:At,expandRowByClick:Ct,expandedRowRender:yt,onTriggerExpand:Pt,expandIconColumnIndex:Et,indentSize:Tt})}),[Vt,Ae,h,kt,Ft,ce,he,ue,Ot,At,Ct,yt,Pt,Et,Tt]),Ue=l.useMemo((function(){return{onColumnResize:ye}}),[ye]);return l.createElement(C.a.Provider,{value:Fe},l.createElement(R.Provider,{value:Be},l.createElement(P.Provider,{value:Ue},je)))}tt.Column=v.a,tt.ColumnGroup=m.a,tt.Summary=W.a,tt.defaultProps={rowKey:"key",prefixCls:"rc-table",emptyText:function(){return"No Data"}};e.b=tt},wRmb:
/*!******************************************************!*\
!*** ./node_modules/rc-table/es/hooks/useColumns.js ***!
\******************************************************/
/*! exports provided: convertChildrenToColumns, default */
/*! exports used: convertChildrenToColumns, default */function(t,e,n){"use strict";n.d(e,"a",(function(){return u}));var r=n(/*! @babel/runtime/helpers/esm/defineProperty */"rePB"),i=n(/*! @babel/runtime/helpers/esm/toConsumableArray */"KQm4"),o=n(/*! @babel/runtime/helpers/esm/objectSpread2 */"VTBJ"),a=n(/*! @babel/runtime/helpers/esm/objectWithoutProperties */"Ff2n"),s=n(/*! react */"q1tI"),l=(n(/*! rc-util/es/warning */"Kwbf"),n(/*! rc-util/es/Children/toArray */"Zm9Q")),c=n(/*! ../utils/legacyUtil */"hW8S");function u(t){return Object(l.a)(t).filter((function(t){return s.isValidElement(t)})).map((function(t){var e=t.key,n=t.props,r=n.children,i=Object(a.a)(n,["children"]),s=Object(o.a)({key:e},i);return r&&(s.children=u(r)),s}))}function h(t){return t.reduce((function(t,e){var n=e.fixed,r=!0===n?"left":n,a=e.children;return a&&a.length>0?[].concat(Object(i.a)(t),Object(i.a)(h(a).map((function(t){return Object(o.a)({fixed:r},t)})))):[].concat(Object(i.a)(t),[Object(o.a)(Object(o.a)({},e),{},{fixed:r})])}),[])}e.b=function(t,e){var n=t.prefixCls,i=t.columns,l=t.children,d=t.expandable,f=t.expandedKeys,p=t.getRowKey,g=t.onTriggerExpand,m=t.expandIcon,v=t.rowExpandable,y=t.expandIconColumnIndex,b=t.direction,x=t.expandRowByClick,C=s.useMemo((function(){return i||u(l)}),[i,l]),S=s.useMemo((function(){if(d){var t,e=y||0,i=C[e],o=(t={},Object(r.a)(t,c.a,{className:"".concat(n,"-expand-icon-col")}),Object(r.a)(t,"title",""),Object(r.a)(t,"fixed",i?i.fixed:null),Object(r.a)(t,"className","".concat(n,"-row-expand-icon-cell")),Object(r.a)(t,"render",(function(t,e,r){var i=p(e,r),o=f.has(i),a=!v||v(e),l=m({prefixCls:n,expanded:o,expandable:a,record:e,onExpand:g});return x?s.createElement("span",{onClick:function(t){return t.stopPropagation()}},l):l})),t),a=C.slice();return e>=0&&a.splice(e,0,o),a}return C}),[d,C,p,f,m,b]),E=s.useMemo((function(){var t=S;return e&&(t=e(t)),t.length||(t=[{render:function(){return null}}]),t}),[e,S,b]),k=s.useMemo((function(){return"rtl"===b?function(t){return t.map((function(t){var e=t.fixed,n=Object(a.a)(t,["fixed"]),r=e;return"left"===e?r="right":"right"===e&&(r="left"),Object(o.a)({fixed:r},n)}))}(h(E)):h(E)}),[E,b]);return[E,k]}},wU8J:
/*!*********************************************!*\
!*** ./node_modules/qr.js/lib/BitBuffer.js ***!
\*********************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e){function n(){this.buffer=new Array,this.length=0}n.prototype={get:function(t){var e=Math.floor(t/8);return 1==(this.buffer[e]>>>7-t%8&1)},put:function(t,e){for(var n=0;n<e;n++)this.putBit(1==(t>>>e-n-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}},t.exports=n},"y0+3":
/*!********************************************!*\
!*** ./node_modules/rc-util/es/Dom/css.js ***!
\********************************************/
/*! exports provided: get, set, getOuterWidth, getOuterHeight, getDocSize, getClientSize, getScroll, getOffset */
/*! exports used: getClientSize, getOffset */function(t,e,n){"use strict";n.d(e,"a",(function(){return r})),n.d(e,"b",(function(){return i}));function r(){return{width:document.documentElement.clientWidth,height:window.innerHeight||document.documentElement.clientHeight}}function i(t){var e=t.getBoundingClientRect(),n=document.documentElement;return{left:e.left+(window.pageXOffset||n.scrollLeft)-(n.clientLeft||document.body.clientLeft||0),top:e.top+(window.pageYOffset||n.scrollTop)-(n.clientTop||document.body.clientTop||0)}}}}]);