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.
361 lines
962 KiB
361 lines
962 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[222,7,8,9],{"+NIl":function(yt,it,se){(function(he){he(se("VrN/"))})(function(he){"use strict";he.defineMode("stex",function(Y,L){"use strict";function X(_,A){_.cmdState.push(A)}function I(_){return _.cmdState.length>0?_.cmdState[_.cmdState.length-1]:null}function k(_){var A=_.cmdState.pop();A&&A.closeBracket()}function W(_){for(var A=_.cmdState,C=A.length-1;C>=0;C--){var c=A[C];if(c.name=="DEFAULT")continue;return c}return{styleIdentifier:function(){return null}}}function F(_,A,C){return function(){this.name=_,this.bracketNo=0,this.style=A,this.styles=C,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={};O.importmodule=F("importmodule","tag",["string","builtin"]),O.documentclass=F("documentclass","tag",["","atom"]),O.usepackage=F("usepackage","tag",["atom"]),O.begin=F("begin","tag",["atom"]),O.end=F("end","tag",["atom"]),O.label=F("label","tag",["atom"]),O.ref=F("ref","tag",["atom"]),O.eqref=F("eqref","tag",["atom"]),O.cite=F("cite","tag",["atom"]),O.bibitem=F("bibitem","tag",["atom"]),O.Bibitem=F("Bibitem","tag",["atom"]),O.RBibitem=F("RBibitem","tag",["atom"]),O.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function D(_,A){_.f=A}function E(_,A){var C;if(_.match(/^\\[a-zA-Z@]+/)){var c=_.current().slice(1);return C=O.hasOwnProperty(c)?O[c]:O.DEFAULT,C=new C,X(A,C),D(A,P),C.style}if(_.match(/^\\[$&%#{}_]/))return"tag";if(_.match(/^\\[,;!\/\\]/))return"tag";if(_.match("\\["))return D(A,function(u,d){return w(u,d,"\\]")}),"keyword";if(_.match("\\("))return D(A,function(u,d){return w(u,d,"\\)")}),"keyword";if(_.match("$$"))return D(A,function(u,d){return w(u,d,"$$")}),"keyword";if(_.match("$"))return D(A,function(u,d){return w(u,d,"$")}),"keyword";var o=_.next();if(o=="%")return _.skipToEnd(),"comment";if(o=="}"||o=="]"){if(C=I(A),C)C.closeBracket(o),D(A,P);else return"error";return"bracket"}else return o=="{"||o=="["?(C=O.DEFAULT,C=new C,X(A,C),"bracket"):/\d/.test(o)?(_.eatWhile(/[\w.%]/),"atom"):(_.eatWhile(/[\w\-_]/),C=W(A),C.name=="begin"&&(C.argument=_.current()),C.styleIdentifier())}function w(_,A,C){if(_.eatSpace())return null;if(C&&_.match(C))return D(A,E),"keyword";if(_.match(/^\\[a-zA-Z@]+/))return"tag";if(_.match(/^[a-zA-Z]+/))return"variable-2";if(_.match(/^\\[$&%#{}_]/))return"tag";if(_.match(/^\\[,;!\/]/))return"tag";if(_.match(/^[\^_&]/))return"tag";if(_.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(_.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var c=_.next();return c=="{"||c=="}"||c=="["||c=="]"||c=="("||c==")"?"bracket":c=="%"?(_.skipToEnd(),"comment"):"error"}function P(_,A){var C=_.peek(),c;return C=="{"||C=="["?(c=I(A),c.openBracket(C),_.eat(C),D(A,E),"bracket"):/[ \t\r]/.test(C)?(_.eat(C),null):(D(A,E),k(A),E(_,A))}return{startState:function(){var _=L.inMathMode?function(A,C){return w(A,C)}:E;return{cmdState:[],f:_}},copyState:function(_){return{cmdState:_.cmdState.slice(),f:_.f}},token:function(_,A){return A.f(_,A)},blankLine:function(_){_.f=E,_.cmdState.length=0},lineComment:"%"}}),he.defineMIME("text/x-stex","stex"),he.defineMIME("text/x-latex","stex")})},"+yhJ":function(yt,it,se){yt.exports=se.p+"static/xixi.d492fb65.svg"},"0eGx":function(yt,it,se){yt.exports=se.p+"static/zhong.c1924b73.svg"},"19Vz":function(yt,it,se){(function(he){he(se("VrN/"))})(function(he){he.defineOption("placeholder","",function(F,O,D){var E=D&&D!=he.Init;if(O&&!E)F.on("blur",I),F.on("change",k),F.on("swapDoc",k),he.on(F.getInputField(),"compositionupdate",F.state.placeholderCompose=function(){X(F)}),k(F);else if(!O&&E){F.off("blur",I),F.off("change",k),F.off("swapDoc",k),he.off(F.getInputField(),"compositionupdate",F.state.placeholderCompose),Y(F);var w=F.getWrapperElement();w.className=w.className.replace(" CodeMirror-empty","")}O&&!F.hasFocus()&&I(F)});function Y(F){F.state.placeholder&&(F.state.placeholder.parentNode.removeChild(F.state.placeholder),F.state.placeholder=null)}function L(F){Y(F);var O=F.state.placeholder=document.createElement("pre");O.style.cssText="height: 0; overflow: visible",O.style.direction=F.getOption("direction"),O.className="CodeMirror-placeholder CodeMirror-line-like";var D=F.getOption("placeholder");typeof D=="string"&&(D=document.createTextNode(D)),O.appendChild(D),F.display.lineSpace.insertBefore(O,F.display.lineSpace.firstChild)}function X(F){setTimeout(function(){var O=!1,D=F.getInputField();D.nodeName=="TEXTAREA"?O=!D.value:F.lineCount()==1&&(O=!/[^\u200b]/.test(D.querySelector(".CodeMirror-line").textContent)),O?L(F):Y(F)},20)}function I(F){W(F)&&L(F)}function k(F){var O=F.getWrapperElement(),D=W(F);O.className=O.className.replace(" CodeMirror-empty","")+(D?" CodeMirror-empty":""),D?L(F):Y(F)}function W(F){return F.lineCount()===1&&F.getLine(0)===""}})},"1eCo":function(yt,it,se){(function(he){he(se("VrN/"))})(function(he){"use strict";var Y={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},L={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};he.defineMode("xml",function(X,I){var k=X.indentUnit,W={},F=I.htmlMode?Y:L;for(var O in F)W[O]=F[O];for(var O in I)W[O]=I[O];var D,E;function w(a,g){function m(H){return g.tokenize=H,H(a,g)}var y=a.next();if(y=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?m(A("atom","]]>")):null:a.match("--")?m(A("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),m(C(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),g.tokenize=A("meta","?>"),"meta"):(D=a.eat("/")?"closeTag":"openTag",g.tokenize=P,"tag bracket");if(y=="&"){var M;return a.eat("#")?a.eat("x")?M=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):M=a.eatWhile(/[\d]/)&&a.eat(";"):M=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),M?"atom":"error"}else return a.eatWhile(/[^&<]/),null}w.isInText=!0;function P(a,g){var m=a.next();if(m==">"||m=="/"&&a.eat(">"))return g.tokenize=w,D=m==">"?"endTag":"selfcloseTag","tag bracket";if(m=="=")return D="equals",null;if(m=="<"){g.tokenize=w,g.state=d,g.tagName=g.tagStart=null;var y=g.tokenize(a,g);return y?y+" tag error":"tag error"}else return/[\'\"]/.test(m)?(g.tokenize=_(m),g.stringStartCol=a.column(),g.tokenize(a,g)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function _(a){var g=function(m,y){for(;!m.eol();)if(m.next()==a){y.tokenize=P;break}return"string"};return g.isInAttribute=!0,g}function A(a,g){return function(m,y){for(;!m.eol();){if(m.match(g)){y.tokenize=w;break}m.next()}return a}}function C(a){return function(g,m){for(var y;(y=g.next())!=null;){if(y=="<")return m.tokenize=C(a+1),m.tokenize(g,m);if(y==">")if(a==1){m.tokenize=w;break}else return m.tokenize=C(a-1),m.tokenize(g,m)}return"meta"}}function c(a,g,m){this.prev=a.context,this.tagName=g,this.indent=a.indented,this.startOfLine=m,(W.doNotIndent.hasOwnProperty(g)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function u(a,g){for(var m;;){if(!a.context)return;if(m=a.context.tagName,!W.contextGrabbers.hasOwnProperty(m)||!W.contextGrabbers[m].hasOwnProperty(g))return;o(a)}}function d(a,g,m){return a=="openTag"?(m.tagStart=g.column(),x):a=="closeTag"?v:d}function x(a,g,m){return a=="word"?(m.tagName=g.current(),E="tag",b):W.allowMissingTagName&&a=="endTag"?(E="tag bracket",b(a,g,m)):(E="error",x)}function v(a,g,m){if(a=="word"){var y=g.current();return m.context&&m.context.tagName!=y&&W.implicitlyClosed.hasOwnProperty(m.context.tagName)&&o(m),m.context&&m.context.tagName==y||W.matchClosing===!1?(E="tag",f):(E="tag error",l)}else return W.allowMissingTagName&&a=="endTag"?(E="tag bracket",f(a,g,m)):(E="error",l)}function f(a,g,m){return a!="endTag"?(E="error",f):(o(m),d)}function l(a,g,m){return E="error",f(a,g,m)}function b(a,g,m){if(a=="word")return E="attribute",h;if(a=="endTag"||a=="selfcloseTag"){var y=m.tagName,M=m.tagStart;return m.tagName=m.tagStart=null,a=="selfcloseTag"||W.autoSelfClosers.hasOwnProperty(y)?u(m,y):(u(m,y),m.context=new c(m,y,M==m.indented)),d}return E="error",b}function h(a,g,m){return a=="equals"?p:(W.allowMissing||(E="error"),b(a,g,m))}function p(a,g,m){return a=="string"?s:a=="word"&&W.allowUnquoted?(E="string",b):(E="error",b(a,g,m))}function s(a,g,m){return a=="string"?s:b(a,g,m)}return{startState:function(a){var g={tokenize:w,state:d,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(g.baseIndent=a),g},token:function(a,g){if(!g.tagName&&a.sol()&&(g.indented=a.indentation()),a.eatSpace())return null;D=null;var m=g.tokenize(a,g);return(m||D)&&m!="comment"&&(E=null,g.state=g.state(D||m,a,g),E&&(m=E=="error"?m+" error":E)),m},indent:function(a,g,m){var y=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+k;if(y&&y.noIndent)return he.Pass;if(a.tokenize!=P&&a.tokenize!=w)return m?m.match(/^(\s*)/)[0].length:0;if(a.tagName)return W.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+k*(W.multilineTagIndentFactor||1);if(W.alignCDATA&&/<!\[CDATA\[/.test(g))return 0;var M=g&&/^<(\/)?([\w_:\.-]*)/.exec(g);if(M&&M[1])for(;y;)if(y.tagName==M[2]){y=y.prev;break}else if(W.implicitlyClosed.hasOwnProperty(y.tagName))y=y.prev;else break;else if(M)for(;y;){var H=W.contextGrabbers[y.tagName];if(H&&H.hasOwnProperty(M[2]))y=y.prev;else break}for(;y&&y.prev&&!y.startOfLine;)y=y.prev;return y?y.indent+k:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:W.htmlMode?"html":"xml",helperType:W.htmlMode?"html":"xml",skipAttribute:function(a){a.state==p&&(a.state=b)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var g=[],m=a.context;m;m=m.prev)m.tagName&&g.push(m.tagName);return g.reverse()}}}),he.defineMIME("text/xml","xml"),he.defineMIME("application/xml","xml"),he.mimeModes.hasOwnProperty("text/html")||he.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"6+eU":function(yt,it,se){"use strict";se.d(it,"a",function(){return f});var he=se("wx14"),Y=se("rePB"),L=se("VTBJ"),X=se("1OyB"),I=se("vuIU"),k=se("Ji7U"),W=se("LK+K"),F=se("q1tI"),O=se.n(F),D=se("TSYQ"),E=se.n(D),w=function(b){var h,p="".concat(b.rootPrefixCls,"-item"),s=E()(p,"".concat(p,"-").concat(b.page),(h={},Object(Y.a)(h,"".concat(p,"-active"),b.active),Object(Y.a)(h,b.className,!!b.className),Object(Y.a)(h,"".concat(p,"-disabled"),!b.page),h)),a=function(){b.onClick(b.page)},g=function(y){b.onKeyPress(y,b.onClick,b.page)};return O.a.createElement("li",{title:b.showTitle?b.page:null,className:s,onClick:a,onKeyPress:g,tabIndex:"0"},b.itemRender(b.page,"page",O.a.createElement("a",{rel:"nofollow"},b.page)))},P=w,_={ZERO:48,NINE:57,NUMPAD_ZERO:96,NUMPAD_NINE:105,BACKSPACE:8,DELETE:46,ENTER:13,ARROW_UP:38,ARROW_DOWN:40},A=function(l){Object(k.a)(h,l);var b=Object(W.a)(h);function h(){var p;Object(X.a)(this,h);for(var s=arguments.length,a=new Array(s),g=0;g<s;g++)a[g]=arguments[g];return p=b.call.apply(b,[this].concat(a)),p.state={goInputText:""},p.buildOptionText=function(m){return"".concat(m," ").concat(p.props.locale.items_per_page)},p.changeSize=function(m){p.props.changeSize(Number(m))},p.handleChange=function(m){p.setState({goInputText:m.target.value})},p.handleBlur=function(m){var y=p.props,M=y.goButton,H=y.quickGo,V=y.rootPrefixCls,te=p.state.goInputText;if(M||te==="")return;if(m.relatedTarget&&(m.relatedTarget.className.indexOf("".concat(V,"-prev"))>=0||m.relatedTarget.className.indexOf("".concat(V,"-next"))>=0))return;p.setState({goInputText:""}),H(p.getValidValue())},p.go=function(m){var y=p.state.goInputText;if(y==="")return;(m.keyCode===_.ENTER||m.type==="click")&&(p.setState({goInputText:""}),p.props.quickGo(p.getValidValue()))},p}return Object(I.a)(h,[{key:"getValidValue",value:function(){var s=this.state,a=s.goInputText,g=s.current;return!a||isNaN(a)?g:Number(a)}},{key:"getPageSizeOptions",value:function(){var s=this.props,a=s.pageSize,g=s.pageSizeOptions;return g.some(function(m){return m.toString()===a.toString()})?g:g.concat([a.toString()]).sort(function(m,y){var M=isNaN(Number(m))?0:Number(m),H=isNaN(Number(y))?0:Number(y);return M-H})}},{key:"render",value:function(){var s=this,a=this.props,g=a.pageSize,m=a.locale,y=a.rootPrefixCls,M=a.changeSize,H=a.quickGo,V=a.goButton,te=a.selectComponentClass,G=a.buildOptionText,j=a.selectPrefixCls,ie=a.disabled,pe=this.state.goInputText,ge="".concat(y,"-options"),be=te,Ne=null,Se=null,Me=null;if(!M&&!H)return null;var Le=this.getPageSizeOptions();if(M&&be){var we=Le.map(function(ve,N){return O.a.createElement(be.Option,{key:N,value:ve.toString()},(G||s.buildOptionText)(ve))});Ne=O.a.createElement(be,{disabled:ie,prefixCls:j,showSearch:!1,className:"".concat(ge,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(g||Le[0]).toString(),onChange:this.changeSize,getPopupContainer:function(N){return N.parentNode}},we)}return H&&(V&&(Me=typeof V=="boolean"?O.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:ie,className:"".concat(ge,"-quick-jumper-button")},m.jump_to_confirm):O.a.createElement("span",{onClick:this.go,onKeyUp:this.go},V)),Se=O.a.createElement("div",{className:"".concat(ge,"-quick-jumper")},m.jump_to,O.a.createElement("input",{disabled:ie,type:"text",value:pe,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),m.page,Me)),O.a.createElement("li",{className:"".concat(ge)},Ne,Se)}}]),h}(O.a.Component);A.defaultProps={pageSizeOptions:["10","20","50","100"]};var C=A,c=se("N2Kk");function o(){}function u(l){return typeof l=="number"&&isFinite(l)&&Math.floor(l)===l}function d(l,b,h){return h}function x(l,b,h){var p=typeof l=="undefined"?b.pageSize:l;return Math.floor((h.total-1)/p)+1}var v=function(l){Object(k.a)(h,l);var b=Object(W.a)(h);function h(p){var s;Object(X.a)(this,h),s=b.call(this,p),s.getJumpPrevPage=function(){return Math.max(1,s.state.current-(s.props.showLessItems?3:5))},s.getJumpNextPage=function(){return Math.min(x(void 0,s.state,s.props),s.state.current+(s.props.showLessItems?3:5))},s.getItemIcon=function(M,H){var V=s.props.prefixCls,te=M||O.a.createElement("button",{type:"button","aria-label":H,className:"".concat(V,"-item-link")});return typeof M=="function"&&(te=O.a.createElement(M,Object(L.a)({},s.props))),te},s.savePaginationNode=function(M){s.paginationNode=M},s.isValid=function(M){return u(M)&&M!==s.state.current},s.shouldDisplayQuickJumper=function(){var M=s.props,H=M.showQuickJumper,V=M.pageSize,te=M.total;return te<=V?!1:H},s.handleKeyDown=function(M){(M.keyCode===_.ARROW_UP||M.keyCode===_.ARROW_DOWN)&&M.preventDefault()},s.handleKeyUp=function(M){var H=s.getValidValue(M),V=s.state.currentInputValue;H!==V&&s.setState({currentInputValue:H}),M.keyCode===_.ENTER?s.handleChange(H):M.keyCode===_.ARROW_UP?s.handleChange(H-1):M.keyCode===_.ARROW_DOWN&&s.handleChange(H+1)},s.changePageSize=function(M){var H=s.state.current,V=x(M,s.state,s.props);H=H>V?V:H,V===0&&(H=s.state.current),typeof M=="number"&&("pageSize"in s.props||s.setState({pageSize:M}),"current"in s.props||s.setState({current:H,currentInputValue:H})),s.props.onShowSizeChange(H,M),"onChange"in s.props&&s.props.onChange&&s.props.onChange(H,M)},s.handleChange=function(M){var H=s.props.disabled,V=M;if(s.isValid(V)&&!H){var te=x(void 0,s.state,s.props);V>te?V=te:V<1&&(V=1),"current"in s.props||s.setState({current:V,currentInputValue:V});var G=s.state.pageSize;return s.props.onChange(V,G),V}return s.state.current},s.prev=function(){s.hasPrev()&&s.handleChange(s.state.current-1)},s.next=function(){s.hasNext()&&s.handleChange(s.state.current+1)},s.jumpPrev=function(){s.handleChange(s.getJumpPrevPage())},s.jumpNext=function(){s.handleChange(s.getJumpNextPage())},s.hasPrev=function(){return s.state.current>1},s.hasNext=function(){return s.state.current<x(void 0,s.state,s.props)},s.runIfEnter=function(M,H){if(M.key==="Enter"||M.charCode===13){for(var V=arguments.length,te=new Array(V>2?V-2:0),G=2;G<V;G++)te[G-2]=arguments[G];H.apply(void 0,te)}},s.runIfEnterPrev=function(M){s.runIfEnter(M,s.prev)},s.runIfEnterNext=function(M){s.runIfEnter(M,s.next)},s.runIfEnterJumpPrev=function(M){s.runIfEnter(M,s.jumpPrev)},s.runIfEnterJumpNext=function(M){s.runIfEnter(M,s.jumpNext)},s.handleGoTO=function(M){(M.keyCode===_.ENTER||M.type==="click")&&s.handleChange(s.state.currentInputValue)};var a=p.onChange!==o,g="current"in p;g&&!a&&console.warn("Warning: You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component.");var m=p.defaultCurrent;"current"in p&&(m=p.current);var y=p.defaultPageSize;return"pageSize"in p&&(y=p.pageSize),m=Math.min(m,x(y,void 0,p)),s.state={current:m,currentInputValue:m,pageSize:y},s}return Object(I.a)(h,[{key:"componentDidUpdate",value:function(s,a){var g=this.props.prefixCls;if(a.current!==this.state.current&&this.paginationNode){var m=this.paginationNode.querySelector(".".concat(g,"-item-").concat(a.current));m&&document.activeElement===m&&m.blur()}}},{key:"getValidValue",value:function(s){var a=s.target.value,g=x(void 0,this.state,this.props),m=this.state.currentInputValue,y;return a===""?y=a:isNaN(Number(a))?y=m:a>=g?y=g:y=Number(a),y}},{key:"getShowSizeChanger",value:function(){var s=this.props,a=s.showSizeChanger,g=s.total,m=s.totalBoundaryShowSizeChanger;return typeof a!="undefined"?a:g>m}},{key:"renderPrev",value:function(s){var a=this.props,g=a.prevIcon,m=a.itemRender,y=m(s,"prev",this.getItemIcon(g,"prev page")),M=!this.hasPrev();return Object(F.isValidElement)(y)?Object(F.cloneElement)(y,{disabled:M}):y}},{key:"renderNext",value:function(s){var a=this.props,g=a.nextIcon,m=a.itemRender,y=m(s,"next",this.getItemIcon(g,"next page")),M=!this.hasNext();return Object(F.isValidElement)(y)?Object(F.cloneElement)(y,{disabled:M}):y}},{key:"render",value:function(){var s=this,a=this.props,g=a.prefixCls,m=a.className,y=a.style,M=a.disabled,H=a.hideOnSinglePage,V=a.total,te=a.locale,G=a.showQuickJumper,j=a.showLessItems,ie=a.showTitle,pe=a.showTotal,ge=a.simple,be=a.itemRender,Ne=a.showPrevNextJumpers,Se=a.jumpPrevIcon,Me=a.jumpNextIcon,Le=a.selectComponentClass,we=a.selectPrefixCls,ve=a.pageSizeOptions,N=this.state,T=N.current,R=N.pageSize,z=N.currentInputValue;if(H===!0&&V<=R)return null;var Z=x(void 0,this.state,this.props),B=[],ce=null,Ee=null,Ae=null,Oe=null,Re=null,De=G&&G.goButton,Pe=j?1:2,Ke=T-1>0?T-1:0,Xe=T+1<Z?T+1:Z,Ye=Object.keys(this.props).reduce(function(q,ee){return(ee.substr(0,5)==="data-"||ee.substr(0,5)==="aria-"||ee==="role")&&(q[ee]=s.props[ee]),q},{});if(ge)return De&&(typeof De=="boolean"?Re=O.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},te.jump_to_confirm):Re=O.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},De),Re=O.a.createElement("li",{title:ie?"".concat(te.jump_to).concat(T,"/").concat(Z):null,className:"".concat(g,"-simple-pager")},Re)),O.a.createElement("ul",Object(he.a)({className:E()(g,"".concat(g,"-simple"),Object(Y.a)({},"".concat(g,"-disabled"),M),m),style:y,ref:this.savePaginationNode},Ye),O.a.createElement("li",{title:ie?te.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:E()("".concat(g,"-prev"),Object(Y.a)({},"".concat(g,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(Ke)),O.a.createElement("li",{title:ie?"".concat(T,"/").concat(Z):null,className:"".concat(g,"-simple-pager")},O.a.createElement("input",{type:"text",value:z,disabled:M,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),O.a.createElement("span",{className:"".concat(g,"-slash")},"/"),Z),O.a.createElement("li",{title:ie?te.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:E()("".concat(g,"-next"),Object(Y.a)({},"".concat(g,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(Xe)),Re);if(Z<=3+Pe*2){var $e={locale:te,rootPrefixCls:g,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:ie,itemRender:be};Z||B.push(O.a.createElement(P,Object(he.a)({},$e,{key:"noPager",page:Z,className:"".concat(g,"-disabled")})));for(var ft=1;ft<=Z;ft+=1){var Je=T===ft;B.push(O.a.createElement(P,Object(he.a)({},$e,{key:ft,page:ft,active:Je})))}}else{var et=j?te.prev_3:te.prev_5,ke=j?te.next_3:te.next_5;Ne&&(ce=O.a.createElement("li",{title:ie?et:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:E()("".concat(g,"-jump-prev"),Object(Y.a)({},"".concat(g,"-jump-prev-custom-icon"),!!Se))},be(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(Se,"prev page"))),Ee=O.a.createElement("li",{title:ie?ke:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:E()("".concat(g,"-jump-next"),Object(Y.a)({},"".concat(g,"-jump-next-custom-icon"),!!Me))},be(this.getJumpNextPage(),"jump-next",this.getItemIcon(Me,"next page")))),Oe=O.a.createElement(P,{locale:te,last:!0,rootPrefixCls:g,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:Z,page:Z,active:!1,showTitle:ie,itemRender:be}),Ae=O.a.createElement(P,{locale:te,rootPrefixCls:g,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:ie,itemRender:be});var st=Math.max(1,T-Pe),nt=Math.min(T+Pe,Z);T-1<=Pe&&(nt=1+Pe*2),Z-T<=Pe&&(st=Z-Pe*2);for(var oe=st;oe<=nt;oe+=1){var J=T===oe;B.push(O.a.createElement(P,{locale:te,rootPrefixCls:g,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:oe,page:oe,active:J,showTitle:ie,itemRender:be}))}T-1>=Pe*2&&T!==1+2&&(B[0]=Object(F.cloneElement)(B[0],{className:"".concat(g,"-item-after-jump-prev")}),B.unshift(ce)),Z-T>=Pe*2&&T!==Z-2&&(B[B.length-1]=Object(F.cloneElement)(B[B.length-1],{className:"".concat(g,"-item-before-jump-next")}),B.push(Ee)),st!==1&&B.unshift(Ae),nt!==Z&&B.push(Oe)}var Q=null;pe&&(Q=O.a.createElement("li",{className:"".concat(g,"-total-text")},pe(V,[V===0?0:(T-1)*R+1,T*R>V?V:T*R])));var ne=!this.hasPrev()||!Z,le=!this.hasNext()||!Z;return O.a.createElement("ul",Object(he.a)({className:E()(g,m,Object(Y.a)({},"".concat(g,"-disabled"),M)),style:y,unselectable:"unselectable",ref:this.savePaginationNode},Ye),Q,O.a.createElement("li",{title:ie?te.prev_page:null,onClick:this.prev,tabIndex:ne?null:0,onKeyPress:this.runIfEnterPrev,className:E()("".concat(g,"-prev"),Object(Y.a)({},"".concat(g,"-disabled"),ne)),"aria-disabled":ne},this.renderPrev(Ke)),B,O.a.createElement("li",{title:ie?te.next_page:null,onClick:this.next,tabIndex:le?null:0,onKeyPress:this.runIfEnterNext,className:E()("".concat(g,"-next"),Object(Y.a)({},"".concat(g,"-disabled"),le)),"aria-disabled":le},this.renderNext(Xe)),O.a.createElement(C,{disabled:M,locale:te,rootPrefixCls:g,selectComponentClass:Le,selectPrefixCls:we,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:T,pageSize:R,pageSizeOptions:ve,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:De}))}}],[{key:"getDerivedStateFromProps",value:function(s,a){var g={};if("current"in s&&(g.current=s.current,s.current!==a.current&&(g.currentInputValue=g.current)),"pageSize"in s&&s.pageSize!==a.pageSize){var m=a.current,y=x(s.pageSize,a,s);m=m>y?y:m,"current"in s||(g.current=m,g.currentInputValue=m),g.pageSize=s.pageSize}return g}}]),h}(O.a.Component);v.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:o,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:o,locale:c.a,style:{},itemRender:d,totalBoundaryShowSizeChanger:50};var f=v},"6K3P":function(yt,it,se){yt.exports=se.p+"static/jinshi.9b74f304.svg"},"7Cbv":function(yt,it,se){"use strict";var he=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),Y=new Uint8Array(16);function L(){if(!he)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return he(Y)}var X=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function I(P){return typeof P=="string"&&X.test(P)}for(var k=I,W=[],F=0;F<256;++F)W.push((F+256).toString(16).substr(1));function O(P){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,A=(W[P[_+0]]+W[P[_+1]]+W[P[_+2]]+W[P[_+3]]+"-"+W[P[_+4]]+W[P[_+5]]+"-"+W[P[_+6]]+W[P[_+7]]+"-"+W[P[_+8]]+W[P[_+9]]+"-"+W[P[_+10]]+W[P[_+11]]+W[P[_+12]]+W[P[_+13]]+W[P[_+14]]+W[P[_+15]]).toLowerCase();if(!k(A))throw TypeError("Stringified UUID is invalid");return A}var D=O;function E(P,_,A){P=P||{};var C=P.random||(P.rng||L)();if(C[6]=C[6]&15|64,C[8]=C[8]&63|128,_){A=A||0;for(var c=0;c<16;++c)_[A+c]=C[c];return _}return D(C)}var w=it.a=E},"7ahc":function(yt,it,se){"use strict";se.d(it,"a",function(){return x});var he=se("k1fw"),Y=se("0Owb"),L=se("+L6B"),X=se("2/Rp"),I=se("y8nQ"),k=se("Vl3Y"),W=se("tJVT"),F=se("OaEy"),O=se("2fM7"),D=se("q1tI"),E=se.n(D),w=se("VrN/"),P=se.n(w),_=se("p77/"),A=se.n(_),C=se("c5Ni"),c=se.n(C),o=O.a.Option,u={labelCol:{span:4},wrapperCol:{span:20}},d={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"]};it.b=function(v){var f=v.callback,l=v.onCancel,b=Object(D.useState)("python"),h=Object(W.a)(b,2),p=h[0],s=h[1];function a(m){s(d[m][1])}function g(m){f(m)}return E.a.createElement(k.a,Object(Y.a)({},u,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:g}),E.a.createElement(k.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},E.a.createElement(O.a,{onChange:a},Object.keys(d).map(function(m){return E.a.createElement(o,{key:m,value:m},d[m][0])}))),E.a.createElement(k.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},E.a.createElement(x,{mode:p})),E.a.createElement("div",{className:"flex-container flex-end"},E.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),E.a.createElement(X.a,{type:"ghost",onClick:l},"\u53D6\u6D88")))};function x(v){var f=v.value,l=v.onChange,b=v.mode,h=v.options,p=h===void 0?{}:h,s=Object(D.useRef)(),a=Object(D.useState)(),g=Object(W.a)(a,2),m=g[0],y=g[1];return Object(D.useEffect)(function(){if(m){function M(H){var V=H.getValue();l&&l(V)}return m.on("change",M),function(){m.off("change",M)}}},[m,l]),Object(D.useEffect)(function(){m&&m.setOption("mode",b)},[m,b]),Object(D.useEffect)(function(){m&&((f!==m.getValue()||f==="")&&setTimeout(function(){m.setValue(f||" ")},300))},[m,f]),Object(D.useEffect)(function(){if(s.current&&!m){var M=P.a.fromTextArea(s.current,Object(he.a)({mode:b,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},p));y(M)}},[s.current,m]),E.a.createElement("div",{className:"my-codemirror-container"},E.a.createElement("textarea",{ref:s}))}},"7ixt":function(yt,it,se){"use strict";se.d(it,"a",function(){return L});var he={adjustX:1,adjustY:1},Y=[0,0],L={left:{points:["cr","cl"],overflow:he,offset:[-4,0],targetOffset:Y},right:{points:["cl","cr"],overflow:he,offset:[4,0],targetOffset:Y},top:{points:["bc","tc"],overflow:he,offset:[0,-4],targetOffset:Y},bottom:{points:["tc","bc"],overflow:he,offset:[0,4],targetOffset:Y},topLeft:{points:["bl","tl"],overflow:he,offset:[0,-4],targetOffset:Y},leftTop:{points:["tr","tl"],overflow:he,offset:[-4,0],targetOffset:Y},topRight:{points:["br","tr"],overflow:he,offset:[0,-4],targetOffset:Y},rightTop:{points:["tl","tr"],overflow:he,offset:[4,0],targetOffset:Y},bottomRight:{points:["tr","br"],overflow:he,offset:[0,4],targetOffset:Y},rightBottom:{points:["bl","br"],overflow:he,offset:[4,0],targetOffset:Y},bottomLeft:{points:["tl","bl"],overflow:he,offset:[0,4],targetOffset:Y},leftBottom:{points:["br","bl"],overflow:he,offset:[-4,0],targetOffset:Y}},X=L},"7qnI":function(yt,it,se){"use strict";var he=se("5Dmo"),Y=se("3S7+"),L=se("fWQN"),X=se("mtLc"),I=se("yKVA"),k=se("879j"),W=se("5NDa"),F=se("5rEg"),O=se("q1tI"),D=se.n(O),E=se("O2Wb"),w=se.n(E),P=F.a.TextArea,_=function(A){Object(I.a)(c,A);var C=Object(k.a)(c);function c(){return Object(L.a)(this,c),C.apply(this,arguments)}return Object(X.a)(c,[{key:"render",value:function(){var u=this,d=this.props,x=d.index,v=d.onAnswerChange,f=d.addChildAnswer,l=d.exerciseIsPublish,b=d.answers,h=d.activeOptionErrorIndex,p=d.flex,s=p===void 0?"0 0 1000px":p;return D.a.createElement("div",{className:w.a.flex},D.a.createElement("div",{className:"".concat(w.a.color666," mb5 mt6"),style:{flex:"0 0 90px"}},"\u7B54\u6848(\u586B\u7A7A",x+1,"):"),D.a.createElement("div",{className:"".concat(w.a.flex," ").concat(w.a.flex1),style:{flexDirection:"column"}},b.map(function(a,g){var m="".concat(x,"-").concat(g);return D.a.createElement("div",{className:"".concat(w.a.flex," ").concat(w.a.flex1),key:g},D.a.createElement("div",{className:w.a.flex1,style:{flex:s}},D.a.createElement("div",null,D.a.createElement(P,{className:m===h?w.a.error:"",spellCheck:!1,rows:4,value:a||"",defaultValue:"\u8BF7\u8F93\u5165\u53C2\u8003\u7B54\u6848".concat(g==0?"":"(\u53EF\u9009)"),onChange:function(M){return v(x,g,M.target.value)},style:{minHeight:95}}))),!l&&D.a.createElement(D.a.Fragment,null,g!=0&&D.a.createElement(Y.a,{title:"\u5220\u9664"},D.a.createElement("i",{className:"".concat(w.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return u.props.deleteChildAnswer(x,g)},style:{float:"right"}})),g===0&&D.a.createElement(Y.a,{title:"\u5220\u9664"},D.a.createElement("i",{className:"".concat(w.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return u.props.deleteChildAnswermain(x,g)},style:{float:"right"}})),D.a.createElement(Y.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},D.a.createElement("i",{className:"".concat(w.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return f(x)},style:{float:"right",visibility:g==b.length-1?"":"hidden"}}))))})))}}]),c}(O.Component);it.a=_},"8EBN":function(yt,it,se){(function(he){he(se("VrN/"))})(function(he){"use strict";he.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 Y=0;Y<he.modeInfo.length;Y++){var L=he.modeInfo[Y];L.mimes&&(L.mime=L.mimes[0])}he.findModeByMIME=function(X){X=X.toLowerCase();for(var I=0;I<he.modeInfo.length;I++){var k=he.modeInfo[I];if(k.mime==X)return k;if(k.mimes){for(var W=0;W<k.mimes.length;W++)if(k.mimes[W]==X)return k}}if(/\+xml$/.test(X))return he.findModeByMIME("application/xml");if(/\+json$/.test(X))return he.findModeByMIME("application/json")},he.findModeByExtension=function(X){X=X.toLowerCase();for(var I=0;I<he.modeInfo.length;I++){var k=he.modeInfo[I];if(k.ext){for(var W=0;W<k.ext.length;W++)if(k.ext[W]==X)return k}}},he.findModeByFileName=function(X){for(var I=0;I<he.modeInfo.length;I++){var k=he.modeInfo[I];if(k.file&&k.file.test(X))return k}var W=X.lastIndexOf("."),F=W>-1&&X.substring(W+1,X.length);if(F)return he.findModeByExtension(F)},he.findModeByName=function(X){X=X.toLowerCase();for(var I=0;I<he.modeInfo.length;I++){var k=he.modeInfo[I];if(k.name.toLowerCase()==X)return k;if(k.alias){for(var W=0;W<k.alias.length;W++)if(k.alias[W].toLowerCase()==X)return k}}}})},"8hTe":function(yt,it,se){yt.exports={button:"button___1wy9m"}},"9Bee":function(yt,it,se){"use strict";var he=se("DYRE"),Y=se("zeV3"),L=se("+L6B"),X=se("2/Rp"),I=se("k1fw"),k=se("9og8"),W=se("tJVT"),F=se("WmNS"),O=se.n(F),D=se("q1tI"),E=se.n(D),w=se("vg9a"),P=se("DlQD"),_=se.n(P),A=se("rUJ1");function C(oe,J){var Q=oe.match(/^(\s+)(?:```)/);if(Q===null)return J;var ne=Q[1];return J.split(`
|
|
`).map(function(le){var q=le.match(/^\s+/);if(q===null)return le;var ee=Object(W.a)(q,1),ae=ee[0];return ae.length>=ne.length?le.slice(ne.length):le}).join(`
|
|
`)}var c=[],o=["<ul>"],u=new _.a.Renderer,d=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function x(){c.length=0,o=["<ul>"]}var v={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function f(oe,J,Q,ne){if(J>=oe.length||oe[J].level<=Q)return J;var le=oe[J];ne.push("<li><a href='#"+le.anchor+"'>"+le.text+"</a>"),J++;var q=[];return J=f(oe,J,le.level,q),q.length>0&&(ne.push("<ul>"),q.forEach(function(ee){ne.push(ee)}),ne.push("</ul>")),ne.push("</li>"),J=f(oe,J,Q,ne),J}function l(){return f(c,0,0,o),o.push("</ul>"),o.join("")}var b={heading:function(J){var Q=d.exec(J);if(Q)return{type:"heading",raw:Q[0],depth:Q[1].length,text:Q[2]}},fences:function(J){var Q=this.rules.block.fences.exec(J);if(Q){var ne=Q[0],le=C(ne,Q[3]||""),q=Q[2]?Q[2].trim():Q[2];if(["latex","katex","math"].indexOf(q)>=0){var ee=s(),ae=le;le=ee,a[ee]={type:"block",expression:ae}}return{type:"code",raw:ne,lang:q,text:le}}}},h=/(?:\${2})([^\n`]+?)(?:\${2})/gi,p=0,s=function(){return"__special_katext_id_".concat(p++,"__")},a={};function g(){return a}function m(){p=0,a={}}function y(oe){return oe=oe.replace(h,function(J,Q){var ne=s();return a[ne]={type:"inline",expression:Q},ne}),oe}var M=u.listitem;u.listitem=function(oe){return M(y(oe))};var H=u.paragraph;u.paragraph=function(oe){return H(y(oe))};var V=u.tablecell;u.tablecell=function(oe,J){return V(y(oe),J)},u.code=function(oe,J,Q){var ne=(J||"").match(/\S*/)[0];return ne?["latex","katex","math"].indexOf(ne)>=0?"<p class='editormd-tex'>".concat(oe,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(J,'">').concat(Q?oe:Object(A.escape)(oe,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(Q?oe:Object(A.escape)(oe,!0))+"</code></pre>"},u.heading=function(oe,J,Q){var ne=this.options.headerPrefix+Q.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return c.push({anchor:ne,level:J,text:oe}),"<h"+J+' id="'+ne+'">'+oe+"</h"+J+">"},_.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),_.a.use({tokenizer:b,renderer:u});var te=_.a,G=se("SJMd"),j=se("ulZh"),ie=se.n(j),pe=se("m3rI"),ge=se("Oy/b"),be=se("p5ED"),Ne=se("ErOA"),Se=se("STEk");/* **********************************
|
|
cropro version 1.2.0
|
|
@license SEE LICENSE IN LICENSE
|
|
|
|
copyright Alan Mendelevich
|
|
see README and LICENSE for details
|
|
********************************** *//*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var Me=function(oe,J){return(Me=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(Q,ne){Q.__proto__=ne}||function(Q,ne){for(var le in ne)Object.prototype.hasOwnProperty.call(ne,le)&&(Q[le]=ne[le])})(oe,J)};function Le(oe,J){if(typeof J!="function"&&J!==null)throw new TypeError("Class extends value "+String(J)+" is not a constructor or null");function Q(){this.constructor=oe}Me(oe,J),oe.prototype=J===null?Object.create(J):(Q.prototype=J.prototype,new Q)}function we(oe,J,Q,ne){return new(Q||(Q=Promise))(function(le,q){function ee(de){try{ue(ne.next(de))}catch(ye){q(ye)}}function ae(de){try{ue(ne.throw(de))}catch(ye){q(ye)}}function ue(de){var ye;de.done?le(de.value):(ye=de.value,ye instanceof Q?ye:new Q(function(Te){Te(ye)})).then(ee,ae)}ue((ne=ne.apply(oe,J||[])).next())})}function ve(oe,J){var Q,ne,le,q,ee={label:0,sent:function(){if(1&le[0])throw le[1];return le[1]},trys:[],ops:[]};return q={next:ae(0),throw:ae(1),return:ae(2)},typeof Symbol=="function"&&(q[Symbol.iterator]=function(){return this}),q;function ae(ue){return function(de){return function(ye){if(Q)throw new TypeError("Generator is already executing.");for(;ee;)try{if(Q=1,ne&&(le=2&ye[0]?ne.return:ye[0]?ne.throw||((le=ne.return)&&le.call(ne),0):ne.next)&&!(le=le.call(ne,ye[1])).done)return le;switch(ne=0,le&&(ye=[2&ye[0],le.value]),ye[0]){case 0:case 1:le=ye;break;case 4:return ee.label++,{value:ye[1],done:!1};case 5:ee.label++,ne=ye[1],ye=[0];continue;case 7:ye=ee.ops.pop(),ee.trys.pop();continue;default:if(!(le=ee.trys,(le=le.length>0&&le[le.length-1])||ye[0]!==6&&ye[0]!==2)){ee=0;continue}if(ye[0]===3&&(!le||ye[1]>le[0]&&ye[1]<le[3])){ee.label=ye[1];break}if(ye[0]===6&&ee.label<le[1]){ee.label=le[1],le=ye;break}if(le&&ee.label<le[2]){ee.label=le[2],ee.ops.push(ye);break}le[2]&&ee.ops.pop(),ee.trys.pop();continue}ye=J.call(oe,ee)}catch(Te){ye=[6,Te],ne=0}finally{Q=le=0}if(5&ye[0])throw ye[1];return{value:ye[0]?ye[1]:void 0,done:!0}}([ue,de])}}}var N=function(){function oe(){}return oe.addKey=function(J){oe.key=J},Object.defineProperty(oe,"isLicensed",{get:function(){return!!oe.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(oe.key)},enumerable:!1,configurable:!0}),oe}(),T=function(){function oe(){}return oe.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},oe.setAttributes=function(J,Q){for(var ne=0,le=Q;ne<le.length;ne++){var q=le[ne],ee=q[0],ae=q[1];J.setAttribute(ee,ae)}},oe.createRect=function(J,Q,ne){var le=document.createElementNS("http://www.w3.org/2000/svg","rect");return le.setAttribute("width",J.toString()),le.setAttribute("height",Q.toString()),ne&&oe.setAttributes(le,ne),le},oe.createLine=function(J,Q,ne,le,q){var ee=document.createElementNS("http://www.w3.org/2000/svg","line");return ee.setAttribute("x1",J.toString()),ee.setAttribute("y1",Q.toString()),ee.setAttribute("x2",ne.toString()),ee.setAttribute("y2",le.toString()),q&&oe.setAttributes(ee,q),ee},oe.createPolygon=function(J,Q){var ne=document.createElementNS("http://www.w3.org/2000/svg","polygon");return ne.setAttribute("points",J),Q&&oe.setAttributes(ne,Q),ne},oe.createCircle=function(J,Q){var ne=document.createElementNS("http://www.w3.org/2000/svg","circle");return ne.setAttribute("cx",(J/2).toString()),ne.setAttribute("cy",(J/2).toString()),ne.setAttribute("r",J.toString()),Q&&oe.setAttributes(ne,Q),ne},oe.createEllipse=function(J,Q,ne){var le=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return le.setAttribute("cx",(J/2).toString()),le.setAttribute("cy",(Q/2).toString()),le.setAttribute("rx",(J/2).toString()),le.setAttribute("ry",(Q/2).toString()),ne&&oe.setAttributes(le,ne),le},oe.createGroup=function(J){var Q=document.createElementNS("http://www.w3.org/2000/svg","g");return J&&oe.setAttributes(Q,J),Q},oe.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},oe.createMarker=function(J,Q,ne,le,q,ee,ae){var ue=document.createElementNS("http://www.w3.org/2000/svg","marker");return oe.setAttributes(ue,[["id",J],["orient",Q],["markerWidth",ne.toString()],["markerHeight",le.toString()],["refX",q.toString()],["refY",ee.toString()]]),ue.appendChild(ae),ue},oe.createText=function(J){var Q=document.createElementNS("http://www.w3.org/2000/svg","text");return Q.setAttribute("x","0"),Q.setAttribute("y","0"),J&&oe.setAttributes(Q,J),Q},oe.createTSpan=function(J,Q){var ne=document.createElementNS("http://www.w3.org/2000/svg","tspan");return ne.textContent=J,Q&&oe.setAttributes(ne,Q),ne},oe.createImage=function(J){var Q=document.createElementNS("http://www.w3.org/2000/svg","image");return J&&oe.setAttributes(Q,J),Q},oe.createPoint=function(J,Q){var ne=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return ne.x=J,ne.y=Q,ne},oe.createPath=function(J,Q){var ne=document.createElementNS("http://www.w3.org/2000/svg","path");return ne.setAttribute("d",J),Q&&oe.setAttributes(ne,Q),ne},oe.createElement=function(J,Q){var ne=document.createElementNS("http://www.w3.org/2000/svg",J);return Q&&oe.setAttributes(ne,Q),ne},oe.getHollowRectanglePath=function(J,Q,ne,le,q,ee,ae,ue){return"M"+J+","+Q+"V"+(Q+le)+"H"+(J+ne)+"V"+Q+"H"+q+"V"+ee+"H"+(q+ae)+"V"+(ee+ue)+"H"+q+"V"+Q+"Z"},oe}(),R=function(){function oe(J){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+J+"_"}return Object.defineProperty(oe.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(oe.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(oe.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),oe.prototype.addClass=function(J){return this.styleSheet===void 0&&this.addStyleSheet(),J.name=""+this.classNamePrefix+J.localName,this.classes.push(J),this.styleSheet.sheet.insertRule("."+J.name+" {"+J.style+"}",this.styleSheet.sheet.cssRules.length),J},oe.prototype.addRule=function(J){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(J),this.styleSheet.sheet.insertRule(J.selector+" {"+J.style+"}",this.styleSheet.sheet.cssRules.length)},oe.prototype.addStyleSheet=function(){var J;this.styleSheet=document.createElement("style"),((J=this.styleSheetRoot)!==null&&J!==void 0?J:document.head).appendChild(this.styleSheet),this.addRule(new z("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new z("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new z("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new Z("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new Z("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},oe.prototype.removeStyleSheet=function(){var J;this.styleSheet&&(((J=this.styleSheetRoot)!==null&&J!==void 0?J:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},oe}(),z=function(oe,J){this.selector=oe,this.style=J},Z=function(oe,J){this.localName=oe,this.style=J},B=function(){function oe(){this.blocks=[],this.display=""}return oe.prototype.addButtonBlock=function(J){J.className=this.blockClassName,J.buttonClassName=this.buttonClassName,J.buttonColorsClassName=this.buttonColorsClassName,J.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(J)},oe.prototype.addElementBlock=function(J){J.className===void 0&&(J.className=this.blockClassName),this.blocks.push(J)},oe.prototype.getUI=function(){var J=document.createElement("div");return J.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,J.style.display=this.display,this.blocks.forEach(function(Q){return J.appendChild(Q.getUI())}),J},oe}(),ce=function(){function oe(){}return oe.prototype.getUI=function(){var J=document.createElement("div");if(J.className=this.className,this.minWidth!==void 0&&(J.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":J.style.justifyContent="flex-start";break;case"center":J.style.justifyContent="center";break;case"end":J.style.justifyContent="flex-end"}return J.style.whiteSpace="nowrap",J},oe}(),Ee=function(oe){function J(){var Q=oe!==null&&oe.apply(this,arguments)||this;return Q.buttons=[],Q}return Le(J,oe),J.prototype.addButton=function(Q){Q.className=this.buttonClassName,Q.colorsClassName=this.buttonColorsClassName,Q.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(Q)},J.prototype.getUI=function(){var Q=oe.prototype.getUI.call(this);return this.buttons.forEach(function(ne){return Q.appendChild(ne.getUI())}),Q},J}(ce),Ae=function(){function oe(J,Q){this._isActive=!1,this._isHidden=!1,this._icon=J,this.title=Q,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(oe.prototype,"icon",{get:function(){return this._icon},set:function(J){this._icon=J,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"isActive",{get:function(){return this._isActive},set:function(J){this._isActive=J,this.adjustClassName()},enumerable:!1,configurable:!0}),oe.prototype.getUI=function(){var J=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 J.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},oe.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,"")))},oe.prototype.hide=function(){this._isHidden=!0},oe}(),Oe=function(oe){function J(){var Q=oe!==null&&oe.apply(this,arguments)||this;return Q.elements=[],Q}return Le(J,oe),J.prototype.addElement=function(Q){this.elements.push(Q)},J.prototype.getUI=function(){var Q=oe.prototype.getUI.call(this);return this.elements.forEach(function(ne){return Q.appendChild(ne)}),Q},J}(ce),Re=function(){function oe(J,Q){this.horizontal=J,this.vertical=Q}return Object.defineProperty(oe.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),oe.prototype.getVerticalLength=function(J){return J/this.ratio},oe.prototype.getHorizontalLength=function(J){return J*this.ratio},oe}(),De=function(){function oe(){}return oe.getIcon=function(J,Q){if(J>0&&Q>0){var ne=new Re(J,Q),le=ne.ratio>=1?20:ne.getHorizontalLength(20),q=ne.ratio<1?20:ne.getVerticalLength(20),ee=document.createElementNS("http://www.w3.org/2000/svg","svg");ee.setAttribute("xmlns","http://www.w3.org/2000/svg"),ee.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ee);var ae=T.createDefs();ee.appendChild(ae);var ue=T.createElement("clipPath",[["id","text-bg-clip"]]);ae.appendChild(ue);var de=T.createPath(T.getHollowRectanglePath((24-le)/2,(24-q)/2,le,q,(24-le)/2+2,(24-q)/2+2,le-4,q-4));ee.appendChild(de);var ye=T.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);ye.appendChild(T.createTSpan(J+":"+Q)),ee.appendChild(ye);var Te=ye.getBBox();T.setAttributes(ye,[["x",((24-Te.width)/2).toString()],["y",((24-Te.height)/2-Te.y).toString()]]);var Fe=T.createPath(T.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Te.width))/2,(24-Math.ceil(Te.height))/2,Math.ceil(Te.width),Math.ceil(Te.height)));return ue.appendChild(Fe),T.setAttributes(de,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ee),ee.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>'},oe}(),Pe=function(oe){function J(Q,ne,le){var q=oe.call(this,Q,ne)||this;return q.isDropdownOpen=!1,q.onClick=q.dropdownButtonClicked,q.dropdownButtons=le,q}return Le(J,oe),J.prototype.setupDropdown=function(){var Q=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(ne){ne.className=Q.className,ne.colorsClassName=Q.colorsClassName,Q.dropdownBlock.appendChild(ne.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},J.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},J.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},J.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},J.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},J.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},J}(Ae),Ke=function(){function oe(J,Q){this.GRIP_SIZE=10,this.color=J,this.fillColor=Q,this.visual=T.createGroup(),this.visual.appendChild(T.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(T.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return oe.prototype.ownsTarget=function(J){return J===this.visual||J===this.visual.childNodes[0]||J===this.visual.childNodes[1]},oe.prototype.setCenter=function(J,Q){this.visual.childNodes.forEach(function(ne){return T.setAttributes(ne,[["cx",J.toString()],["cy",Q.toString()]])})},oe}(),Xe=function(){function oe(J,Q,ne,le){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=J,this.canvasHeight=Q,this.margin=ne,this.container=le,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(oe.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(J){this._aspectRatio=J,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(J){this._isGridVisible=J,this.gridContainer&&T.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(J){this._zoomFactor=J,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),oe.prototype.open=function(){var J=this;this.cropShadeElement=T.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=T.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var Q=0;Q<this.numberOfGridLines;Q++)this.horizontalGridLines.push(T.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(T.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(ne){return J.gridContainer.appendChild(ne)}),this.verticalGridLines.forEach(function(ne){return J.gridContainer.appendChild(ne)}),this.cropRectElement=T.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Ke(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Ke(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Ke(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Ke(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},oe.prototype.setCropRectangle=function(J){this.cropRect=J;var Q=Object.assign({},this.cropRect);this.zoomFactor!==1&&(Q.width=this.cropRect.width*this.zoomFactor,Q.height=this.cropRect.height*this.zoomFactor,Q.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-Q.width/2,Q.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-Q.height/2),T.setAttributes(this.cropRectElement,[["x",Q.x.toString()],["y",Q.y.toString()],["width",Q.width.toString()],["height",Q.height.toString()]]);var ne=Q.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(q,ee){var ae=Q.y+ne*(ee+1);T.setAttributes(q,[["x1",""+Q.x],["y1",""+ae],["x2",""+(Q.x+Q.width)],["y2",""+ae]])});var le=Q.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(q,ee){var ae=Q.x+le*(ee+1);T.setAttributes(q,[["x1",""+ae],["y1",""+Q.y],["x2",""+ae],["y2",""+(Q.y+Q.height)]])}),T.setAttributes(this.cropShadeElement,[["d",T.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,Q.x,Q.y,Q.width,Q.height)]]),this.topLeftGrip.setCenter(Q.x,Q.y),this.topRightGrip.setCenter(Q.x+Q.width,Q.y),this.bottomLeftGrip.setCenter(Q.x,Q.y+Q.height),this.bottomRightGrip.setCenter(Q.x+Q.width,Q.y+Q.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},oe.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)},oe.prototype.clientToLocalCoordinates=function(J,Q){var ne=this.container.getBoundingClientRect();return{x:J-ne.left+this.margin,y:Q-ne.top+this.margin}},oe.prototype.onPointerDown=function(J){this.container.setPointerCapture(J.pointerId),this.previousPoint=this.clientToLocalCoordinates(J.clientX,J.clientY),this.cropRectElement===J.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(J.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(J.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(J.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(J.target)&&(this.activeGrip=this.bottomRightGrip)},oe.prototype.onPointerMove=function(J){if(this.isMoving)this.move(this.clientToLocalCoordinates(J.clientX,J.clientY));else if(this.activeGrip){var Q=this.clientToLocalCoordinates(J.clientX,J.clientY);this.resize(Q)}J.preventDefault()},oe.prototype.onPointerUp=function(J){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(J.pointerId)},oe.prototype.move=function(J){var Q=J.x-this.previousPoint.x,ne=J.y-this.previousPoint.y;this.zoomFactor!==1&&(Q=-Q/this.zoomFactor,ne=-ne/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+Q),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+ne),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=J},oe.prototype.resize=function(J){var Q=Object.assign({},this.cropRect),ne=J.x-this.previousPoint.x,le=J.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:Q.x+ne<this.margin&&(ne=this.margin-Q.x),Q.x+=ne,Q.width=this.cropRect.x+this.cropRect.width-Q.x;break;case this.bottomRightGrip:case this.topRightGrip:Q.width+ne>this.canvasWidth*this.zoomFactor&&(ne=this.canvasWidth*this.zoomFactor-Q.width),Q.width+=ne}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(Q.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(ne),Q.height=this.aspectRatio.getVerticalLength(Q.width)):(Q.y+=le,Q.height=this.cropRect.y+this.cropRect.height-Q.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?Q.height=this.aspectRatio.getVerticalLength(Q.width):Q.height+=le}Q.width<10&&(Q.x=this.cropRect.x,Q.width=10),Q.height<10&&(Q.y=this.cropRect.y,Q.height=10),this.previousPoint=J,Q.x>=this.margin&&Q.y>=this.margin&&Q.x-this.margin+Q.width<=this.canvasWidth&&Q.y-this.margin+Q.height<=this.canvasHeight&&(this.cropRect=Q,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},oe.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var J=this.cropRect.x+this.cropRect.width/2,Q=this.cropRect.y+this.cropRect.height/2,ne=this.aspectRatio.getHorizontalLength(this.cropRect.height),le=this.aspectRatio.getVerticalLength(this.cropRect.width);ne/this.canvasWidth<le/this.canvasHeight?this.cropRect.width=ne:this.cropRect.height=le,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=J-this.cropRect.width/2,this.cropRect.y=Q-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)}},oe.prototype.getRescaledRect=function(J,Q,ne,le,q,ee){var ae=ne/J,ue=le/Q;return{x:(q.x-ee)*ae+ee,y:(q.y-ee)*ue+ee,width:q.width*ae,height:q.height*ue}},oe.prototype.scaleCanvas=function(J,Q){var ne=this.getRescaledRect(this.canvasWidth,this.canvasHeight,J,Q,this.cropRect,this.margin);this.canvasWidth=J,this.canvasHeight=Q,this.onCropChange&&this.onCropChange(ne),this.setCropRectangle(ne)},oe}(),Ye=function(){function oe(J){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=J,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(oe.prototype,"angle",{get:function(){return this._angle},set:function(J){this._angle=J,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),oe.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},oe.prototype.onPointerDown=function(J){this.controlContainer.setPointerCapture(J.pointerId),this.isDragging=!0,this.previousPoint={x:J.clientX,y:J.clientY}},oe.prototype.onPointerMove=function(J){this.isDragging&&(this.onAngleChange&&this.onAngleChange((J.clientX-this.previousPoint.x)/5),this.previousPoint.x=J.clientX)},oe.prototype.onPointerUp=function(J){this.isDragging&&this.onAngleChange&&this.onAngleChange((J.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(J.pointerId)},oe.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var J=this.angleLabelText.getBBox();T.setAttributes(this.angleLabelElement,[["x",((this.width-J.width)/2).toString()],["y",(this.height/2).toString()]])}},oe.prototype.positionScaleShape=function(){if(this.scaleShape){var J=this.scaleShape.transform.baseVal.getItem(0);J.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(J,0)}},oe.prototype.getVisual=function(){var J=document.createElementNS("http://www.w3.org/2000/svg","svg");J.setAttribute("xmlns","http://www.w3.org/2000/svg"),J.setAttribute("width",this.width+"px"),J.setAttribute("height",this.height+"px"),J.setAttribute("viewBox","0 0 "+this.width+" "+this.height),J.style.flexShrink="0",document.body.appendChild(J);for(var Q="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,ne=1;ne<=this.width/5+10;ne++){var le=ne%5==0?this.height/3:this.height/6;Q+="h4v"+-le+"h1v"+le}Q+="v1H0Z",this.scaleShape=T.createPath(Q);var q=T.createTransform();this.scaleShape.transform.baseVal.appendItem(q),J.appendChild(this.scaleShape),this.angleLabelElement=T.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=T.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ee=T.createTSpan("");return ee.innerHTML="°",this.angleLabelElement.appendChild(ee),J.appendChild(this.angleLabelElement),document.body.removeChild(J),J},oe}(),$e=function(){function oe(){this.naturalSize=!1,this.imageType="image/png"}return oe.prototype.rasterize=function(J,Q,ne,le,q,ee,ae){var ue=this;return new Promise(function(de){var ye=document.createElement("canvas");ye.width=J.width.baseVal.value-2*le,ye.height=J.height.baseVal.value-2*le;var Te=1,Fe=1;ue.naturalSize===!0?(Te=Q.naturalWidth/(J.width.baseVal.value-2*le)/ee,Fe=Q.naturalHeight/(J.height.baseVal.value-2*le)/ae,ye.width=Q.naturalWidth/ee,ye.height=Q.naturalHeight/ae):ue.width!==void 0&&ue.height!==void 0&&(Te=ue.width/ne.width,Fe=ue.height/ne.height,ye.width*=Te,ye.height*=Fe);var He=ye.getContext("2d");He.translate(ye.width/2,ye.height/2),He.rotate(q*Math.PI/180),He.scale(ee,ae),He.translate(-ye.width/2,-ye.height/2),He.drawImage(Q,0,0,ye.width,ye.height);var at=document.createElement("canvas");at.width=ne.width*Te,at.height=ne.height*Fe,at.getContext("2d").putImageData(He.getImageData((ne.x-le)*Te,(ne.y-le)*Fe,ne.width*Te,ne.height*Fe),0,0),de(at.toDataURL(ue.imageType,ue.imageQuality))})},oe}(),ft=function(){function oe(J){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=oe.instanceCounter++,this.styles=new R(this.instanceNo),this.target=J,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(oe.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(J){this._zoomToCropEnabled=J,J?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(J){this._isGridVisible=J,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"gridLines",{get:function(){return this._gridLines},set:function(J){this._gridLines=J,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(J){this._rotationAngle=J,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype,"aspectRatio",{get:function(){var J;return(J=this._aspectRatio)!==null&&J!==void 0?J:this.aspectRatios[0]},set:function(J){this._aspectRatio=J},enumerable:!1,configurable:!0}),oe.prototype.open=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.setupResizeObserver(),this.initCropCanvas(),this.setEditingTarget(),this.setTopLeft(),this.initCropLayer(),this.attachEvents(),this.applyAspectRatio(),this.displayMode==="popup"&&this.onPopupResize(),this._isOpen=!0},oe.prototype.show=function(){this.showUI(),this.open()},oe.prototype.close=function(J){J===void 0&&(J=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),J||this.closeEventListeners.forEach(function(Q){return Q()}),this._isOpen=!1)},oe.prototype.addRenderEventListener=function(J){this.renderEventListeners.push(J)},oe.prototype.removeRenderEventListener=function(J){this.renderEventListeners.indexOf(J)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(J),1)},oe.prototype.addCloseEventListener=function(J){this.closeEventListeners.push(J)},oe.prototype.removeCloseEventListener=function(J){this.closeEventListeners.indexOf(J)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(J),1)},oe.prototype.setupResizeObserver=function(){var J=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){J.resize(J.target.clientWidth,J.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},oe.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var J=1*this.target.clientWidth/this.target.clientHeight,Q=this.contentDiv.clientWidth/J>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*J:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,ne=Q+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/J;this.resize(Q,ne)}},oe.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},oe.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",T.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},oe.prototype.resize=function(J,Q){this.imageWidth=Math.round(J),this.imageHeight=Math.round(Q),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},oe.prototype.setEditingTarget=function(){var J=document.createElement("canvas");J.width=this.target.naturalWidth,J.height=this.target.naturalHeight,J.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var Q=J.toDataURL();T.setAttributes(this.editingTarget,[["href",Q]]),this.setEditingTargetSize()},oe.prototype.setTopLeft=function(){var J=this.target.getBoundingClientRect(),Q=this.editorCanvas.getBoundingClientRect();this.left=J.left-Q.left-this.CANVAS_MARGIN,this.top=J.top-Q.top-this.CANVAS_MARGIN},oe.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=T.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=T.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=T.createGroup(),this.editingTargetRotationScaleContainer=T.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var J=T.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(J);var Q=T.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(Q),this.editingTargetContainer=T.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)},oe.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},oe.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=T.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Xe(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()},oe.prototype.zoomToCrop=function(){if(this.cropRect){var J=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,Q=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=J+"px "+Q+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-J+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-Q+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},oe.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)},oe.prototype.cropRectChanged=function(J){this.cropRect=J,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},oe.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},oe.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"},oe.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},oe.prototype.showUI=function(){switch(this.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var J=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,Q=this.target.offsetTop>J+this.CANVAS_MARGIN?this.target.offsetTop-(J+this.CANVAS_MARGIN):0;this.coverDiv.style.top=Q+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},oe.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},oe.prototype.addTopToolbar=function(){var J=this;this.topToolbar=new B,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 Q=new Ee;Q.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(Q);var ne=[];this.aspectRatios.forEach(function(Fe){var He=new Ae(De.getIcon(Fe.horizontal,Fe.vertical),Fe.horizontal===0&&Fe.vertical===0?"FREE":Fe.horizontal+":"+Fe.vertical);He.onClick=function(){return J.ratioButtonClicked(Fe)},ne.push(He)}),this.aspectRatioButton=new Pe(De.getIcon(0,0),"Aspect ratio",ne),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,Q.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var le=new Ae('<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");le.isActive=this.isGridVisible,le.onClick=function(){J.isGridVisible=!J.isGridVisible,le.isActive=J.isGridVisible},Q.addButton(le);var q=new Ae('<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"Zoom to selection");if(q.isActive=this.zoomToCropEnabled,q.onClick=function(){J.zoomToCropEnabled=!J.zoomToCropEnabled,q.isActive=J.zoomToCropEnabled},Q.addButton(q),!N.isLicensed){var ee=new Oe;this.topToolbar.addElementBlock(ee);var ae=document.createElement("div");ae.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var ue=document.createElement("a");ue.style.color="currentColor",ue.href="https://markerjs.com/products/cropro",ue.target="_blank",ue.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>',ae.appendChild(ue),ee.addElement(ae)}var de=new Ee;de.minWidth=3*this.toolbarHeight+"px",de.contentAlign="end",this.topToolbar.addButtonBlock(de);var ye=new Ae('<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");ye.onClick=this.startRenderAndClose,de.addButton(ye),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(ye.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Te=new Ae('<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");Te.onClick=this.close,de.addButton(Te),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Te.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},oe.prototype.addBottomToolbar=function(){var J=this;this.bottomToolbar=new B,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 Q=new Ee;Q.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(Q);var ne=new Ae('<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");ne.onClick=this.rotateLeftButtonClicked,Q.addButton(ne);var le=new Ae('<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");le.onClick=this.rotateRightButtonClicked,Q.addButton(le);var q=new Oe;q.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(q),this.straightener=new Ye("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(de){J.rotateBy(de),J.straightener.angle=J.rotationAngle},q.addElement(this.straightener.getUI());var ee=new Ee;ee.minWidth=2*this.toolbarHeight+"px",ee.contentAlign="end",this.bottomToolbar.addButtonBlock(ee);var ae=new Ae('<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");ae.onClick=this.flipHorizontallyButtonClicked,ee.addButton(ae);var ue=new Ae('<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");ue.onClick=this.flipVerticallyButtonClicked,ee.addButton(ue)},oe.prototype.ratioButtonClicked=function(J){this.aspectRatio=J,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},oe.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=De.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},oe.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Re(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},oe.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},oe.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},oe.prototype.restoreState=function(J){if(J){var Q=this.cropLayer.getRescaledRect(J.width,J.height,this.imageWidth,this.imageHeight,J.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(Q),this.cropRectChanged(Q),this.flippedHorizontally=J.flippedHorizontally,this.flippedVertically=J.flippedVertically,this.applyFlip(),this.rotationAngle=J.rotationAngle,this.applyRotation()}},oe.prototype.clientToLocalCoordinates=function(J,Q){var ne=this.cropImage.getBoundingClientRect();return{x:J-ne.left,y:Q-ne.top}},oe.prototype.onWindowResize=function(){this.positionUI()},oe.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var J=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=J+"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()},oe.prototype.rotateLeftButtonClicked=function(){var J=this.rotationAngle-90;this.rotationAngle%90!=0&&(J+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(J)},oe.prototype.rotateRightButtonClicked=function(){var J=this.rotationAngle+90;this.rotationAngle%90!=0&&(J-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(J)},oe.prototype.rotateTo=function(J){J=(J=J>180?J-360:J)<=-180?J+360:J,this.rotationAngle=J,this.applyRotation()},oe.prototype.rotateBy=function(J){this.rotateTo((this.rotationAngle+J)%360)},oe.prototype.applyRotation=function(){var J=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var Q=this.editingTargetRotationContainer.transform.baseVal.getItem(0);Q.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(Q,0);var ne=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/ne.width,this.imageHeight/ne.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=J},oe.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},oe.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},oe.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},oe.prototype.startRenderAndClose=function(){return we(this,void 0,void 0,function(){var J,Q;return ve(this,function(ne){switch(ne.label){case 0:return[4,this.render()];case 1:return J=ne.sent(),Q=this.getState(),this.renderEventListeners.forEach(function(le){return le(J,Q)}),this.close(!0),[2]}})})},oe.prototype.render=function(){return we(this,void 0,void 0,function(){var J;return ve(this,function(Q){switch(Q.label){case 0:return(J=new $e).naturalSize=this.renderAtNaturalSize,J.imageType=this.renderImageType,J.imageQuality=this.renderImageQuality,J.width=this.renderWidth,J.height=this.renderHeight,this.unzoomFromCrop(),T.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,J.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 Q.sent(),[4,J.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,Q.sent()]}})})},oe.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Z("toolbar",`
|
|
width: `+(this.displayMode==="inline"?"100%":"calc(100vw - "+2*this.popupMargin+"px)")+`;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
height: `+this.toolbarHeight+`px;
|
|
box-sizing: content-box;
|
|
overflow: hidden;
|
|
line-height: 0px;
|
|
`)),this.toolbarStyleColorsClass=this.styles.addClass(new Z("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Z("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var J=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Z("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*J)+`px;
|
|
height: `+(this.toolbarHeight-2*J)+`px;
|
|
padding: `+J+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Z("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Z("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new z("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new z("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new Z("toolbar_dropdown",`
|
|
position: absolute;
|
|
max-width: `+4*this.toolbarHeight+`px;
|
|
z-index: 20;
|
|
white-space: normal;
|
|
box-sizing: content-box;
|
|
box-shadow: 3px 3px rgba(33, 33, 33, 0.1);
|
|
margin: `+(this.displayMode==="inline"?"0":this.popupMargin)+`px;
|
|
line-height: 0px;
|
|
`)),this.toolbarDropdownStyleColorsClass=this.styles.addClass(new Z("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Z("toolbar_straightener_block",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
-webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 30%, rgba(0,0,0,1) 70%, rgba(0,0,0,0) 100%);
|
|
`)),this.toolbarStraightenerStyleClass=this.styles.addClass(new Z("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*J)+`px;
|
|
padding: `+J+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Z("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},oe.instanceCounter=0,oe}(),Je=se("8hTe"),et=se.n(Je),ke=/<pre[^>]*>/g;function st(oe){var J=document.createElement("div");return J.innerHTML=oe,J.childNodes.length===0?"":J.childNodes[0].nodeValue}var nt=it.a=function(oe){var J=oe.value,Q=J===void 0?"":J,ne=oe.edit,le=ne===void 0?!1:ne,q=oe.className,ee=oe.showTextOnly,ae=oe.showLines,ue=oe.replaces,de=oe.zoomImg,ye=oe.hasMask,Te=oe.style,Fe=Te===void 0?{}:Te,He=oe.stylesPrev,at=He===void 0?{}:He,Lt=String(Q),Ge=Object(D.useRef)(),tt=Object(D.useRef)(),Dt=Object(D.useState)(""),ct=Object(W.a)(Dt,2),Rt=ct[0],jt=ct[1],xt=Object(D.useState)("office"),Kt=Object(W.a)(xt,2),Vt=Kt[0],Ut=Kt[1],Nt=function(){var St=new ft(tt.current);St.displayMode="popup",St.addRenderEventListener(function(){var Ot=Object(k.a)(O.a.mark(function vt(_t){var Ht;return O.a.wrap(function(ot){for(;;)switch(ot.prev=ot.next){case 0:return Ge.current.style.display="none",ot.next=3,Object(Ne.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:_t}});case 3:Ht=ot.sent,Ht!=null&&Ht.id&&ue(tt.current.getAttribute("src").replace(pe.a.API_SERVER,""),"/api/attachments/".concat(Ht==null?void 0:Ht.id,"?type=").concat(Ht.content_type));case 5:case"end":return ot.stop()}},vt)}));return function(vt){return Ot.apply(this,arguments)}}()),St.show()},It=function(){var St=new Se.a(tt.current);St.settings.displayMode="popup",St.addEventListener("render",function(){var Ot=Object(k.a)(O.a.mark(function vt(_t){var Ht;return O.a.wrap(function(ot){for(;;)switch(ot.prev=ot.next){case 0:if(Ge.current.style.display="none",!tt.current){ot.next=6;break}return ot.next=4,Object(Ne.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:_t.dataUrl}});case 4:Ht=ot.sent,Ht!=null&&Ht.id&&ue(tt.current.getAttribute("src").replace(pe.a.API_SERVER,""),"/api/attachments/".concat(Ht==null?void 0:Ht.id,"?type=").concat(Ht.content_type));case 6:case"end":return ot.stop()}},vt)}));return function(vt){return Ot.apply(this,arguments)}}()),St.show(),window.markerArea=St},Bt=Object(D.useMemo)(function(){Ge.current&&(Ge.current.style.zIndex=-1);try{var Ue=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,St=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Ot=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Lt=Lt.replace(Ue,"("+pe.a.API_SERVER+"/api/attachments/").replace(St,'"'+pe.a.API_SERVER+"/api/attachments/").replace(Ot,'"'+pe.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
`)}catch(Gt){}var vt=te(Lt),_t=g();if(Lt.match(/\[TOC\]/)&&(vt=vt.replace("<p>[TOC]</p>",l()),x()),vt=vt.replace(/(__special_katext_id_\d+__)/g,function(Gt,ot){var Be=_t[ot],dt=Be.type,yr=Be.expression;return Object(ge.renderToString)(st(yr)||"",{displayMode:dt==="block",throwOnError:!1,output:"html"})}),vt=vt.replace(/▁/g,"\u2581\u2581\u2581"),m(),ee){var Ht=document.createElement("div");return Ht.innerHTML=vt,Ht.innerText}return setTimeout(function(){return mt()},500),vt},[Lt]),Ct=Object(D.useRef)();v.WebkitLineClamp=ae,ae&&(Fe=Object(I.a)(Object(I.a)({},Fe),v));function wt(Ue){var St=Ue.target;if(St.tagName.toUpperCase()==="IMG"){if(de){var Ot=St.getAttribute("src");jt(Ot),Ut("image")}}else if(St.tagName.toUpperCase()==="A"){var vt=St.getAttribute("href");if(vt.indexOf("office")>-1)Ue.preventDefault(),jt(vt),Ut("office");else if(vt.indexOf("application/pdf")>-1)Ue.preventDefault(),jt(vt),Ut("pdf");else if(vt.indexOf("text/html")>-1)Ue.preventDefault(),jt(vt),Ut("html");else if(vt.startsWith("#")){Ue.preventDefault();var _t=document.getElementById(vt.replace("#",""));_t&&_t.scrollIntoView(!0)}}}var mt=function(){var St,Ot=(St=Ct.current)===null||St===void 0?void 0:St.querySelectorAll("video");Ot==null||Ot.forEach(function(vt){if(vt.oncontextmenu=function(){return!1},vt.src.indexOf(".m3u8")>-1&&!vt.canPlayType("application/vnd.apple.mpegurl")){if(ie.a.isSupported()){var _t=new ie.a;_t.loadSource(vt.src),_t.attachMedia(vt)}}})};Object(D.useEffect)(function(){if(Ct.current&&Bt&&(Bt.match(ke)&&window.PR.prettyPrint()),Ct.current)return Ct.current.addEventListener("click",wt),function(){Ct.current.removeEventListener("click",wt),m(),x()}},[Bt,Ct.current,wt]);var rt=function(St){if(!le)return;St.target.nodeName==="IMG"?(Ge.current.style.zIndex=1,Ge.current.style.display="flex",Ge.current.style.width=St.target.clientWidth+"px",Ge.current.style.height=St.target.clientHeight+"px",Ge.current.style.top=St.target.offsetTop+"px",Ge.current.style.left=St.target.offsetLeft+"px",tt.current.src=St.target.getAttribute("src")):Ge.current.style.display="none"};return E.a.createElement("div",{style:{position:"relative"}},E.a.createElement("div",{ref:Ct,style:Object(I.a)({},Fe),className:"".concat(q||""," markdown-body ").concat(et.a.mdBody),onMouseOver:rt,dangerouslySetInnerHTML:{__html:Bt}}),E.a.createElement("div",{ref:Ge,className:et.a.button},E.a.createElement(Y.a,null,E.a.createElement(X.a,{onClick:function(){return Nt()}},"\u88C1\u526A"),E.a.createElement(X.a,{onClick:function(){return It()}},"\u7F16\u8F91"))),E.a.createElement("img",{ref:tt,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),E.a.createElement(be.a,{close:!0,data:Rt,type:Rt!=null&&Rt.length?Vt:"",style:Object(I.a)({},at),onClose:function(){return jt("")}}))}},"9VGf":function(yt,it,se){"use strict";se.d(it,"a",function(){return L});var he=se("q1tI"),Y=se.n(he);function L(X,I){var k=Object(he.useRef)();Object(he.useEffect)(function(){k.current=X}),Object(he.useEffect)(function(){function W(){k.current()}if(I!==null){var F=setInterval(W,I);return function(){return clearInterval(F)}}},[I])}},Bd2K:function(yt,it,se){(function(he){he(se("VrN/"),se("osHv"))})(function(he){he.defineOption("autoCloseTags",!1,function(O,D,E){if(E!=he.Init&&E&&O.removeKeyMap("autoCloseTags"),!D)return;var w={name:"autoCloseTags"};(typeof D!="object"||D.whenClosing!==!1)&&(w["'/'"]=function(P){return k(P)}),(typeof D!="object"||D.whenOpening!==!1)&&(w["'>'"]=function(P){return X(P)}),O.addKeyMap(w)});var Y=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],L=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function X(O){if(O.getOption("disableInput"))return he.Pass;for(var D=O.listSelections(),E=[],w=O.getOption("autoCloseTags"),P=0;P<D.length;P++){if(!D[P].empty())return he.Pass;var _=D[P].head,A=O.getTokenAt(_),C=he.innerMode(O.getMode(),A.state),c=C.state,o=C.mode.xmlCurrentTag&&C.mode.xmlCurrentTag(c),u=o&&o.name;if(!u)return he.Pass;var d=C.mode.configuration=="html",x=typeof w=="object"&&w.dontCloseTags||d&&Y,v=typeof w=="object"&&w.indentTags||d&&L;A.end>_.ch&&(u=u.slice(0,u.length-A.end+_.ch));var f=u.toLowerCase();if(!u||A.type=="string"&&(A.end!=_.ch||!/[\"\']/.test(A.string.charAt(A.string.length-1))||A.string.length==1)||A.type=="tag"&&o.close||A.string.indexOf("/")==_.ch-A.start-1||x&&W(x,f)>-1||F(O,C.mode.xmlCurrentContext&&C.mode.xmlCurrentContext(c)||[],u,_,!0))return he.Pass;var l=typeof w=="object"&&w.emptyTags;if(l&&W(l,u)>-1){E[P]={text:"/>",newPos:he.Pos(_.line,_.ch+2)};continue}var b=v&&W(v,f)>-1;E[P]={indent:b,text:">"+(b?`
|
|
|
|
`:"")+"</"+u+">",newPos:b?he.Pos(_.line+1,0):he.Pos(_.line,_.ch+1)}}for(var h=typeof w=="object"&&w.dontIndentOnAutoClose,P=D.length-1;P>=0;P--){var p=E[P];O.replaceRange(p.text,D[P].head,D[P].anchor,"+insert");var s=O.listSelections().slice(0);s[P]={head:p.newPos,anchor:p.newPos},O.setSelections(s),!h&&p.indent&&(O.indentLine(p.newPos.line,null,!0),O.indentLine(p.newPos.line+1,null,!0))}}function I(O,D){for(var E=O.listSelections(),w=[],P=D?"/":"</",_=O.getOption("autoCloseTags"),A=typeof _=="object"&&_.dontIndentOnSlash,C=0;C<E.length;C++){if(!E[C].empty())return he.Pass;var c=E[C].head,o=O.getTokenAt(c),u=he.innerMode(O.getMode(),o.state),d=u.state;if(D&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=c.ch-1))return he.Pass;var x,v=u.mode.name!="xml"&&O.getMode().name=="htmlmixed";if(v&&u.mode.name=="javascript")x=P+"script";else if(v&&u.mode.name=="css")x=P+"style";else{var f=u.mode.xmlCurrentContext&&u.mode.xmlCurrentContext(d);if(!f||f.length&&F(O,f,f[f.length-1],c))return he.Pass;x=P+f[f.length-1]}O.getLine(c.line).charAt(o.end)!=">"&&(x+=">"),w[C]=x}if(O.replaceSelections(w),E=O.listSelections(),!A)for(var C=0;C<E.length;C++)(C==E.length-1||E[C].head.line<E[C+1].head.line)&&O.indentLine(E[C].head.line)}function k(O){return O.getOption("disableInput")?he.Pass:I(O,!0)}he.commands.closeTag=function(O){return I(O)};function W(O,D){if(O.indexOf)return O.indexOf(D);for(var E=0,w=O.length;E<w;++E)if(O[E]==D)return E;return-1}function F(O,D,E,w,P){if(!he.scanForClosingTag)return!1;var _=Math.min(O.lastLine()+1,w.line+500),A=he.scanForClosingTag(O,w,null,_);if(!A||A.tag!=E)return!1;for(var C=P?1:0,c=D.length-1;c>=0&&D[c]==E;c--)++C;w=A.to;for(var c=1;c<C;c++){var o=he.scanForClosingTag(O,w,null,_);if(!o||o.tag!=E)return!1;w=o.to}return!0}})},BjJ7:function(yt,it,se){"use strict";se.d(it,"d",function(){return Y}),se.d(it,"c",function(){return L}),se.d(it,"e",function(){return X}),se.d(it,"b",function(){return I}),se.d(it,"a",function(){return W});var he=se("m3rI");function Y(F){var O=!0;if(F.length>0){for(var D=0;D<F.length;D++)if(F[D].compile_success==0||!F[D].compile_success){O=!1;break}}else O=!1;return O}function L(F){for(var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",D=[],E=0;E<F.length;E++){var w=F[E],P=O?"".concat(O,"/").concat(w.name):"".concat(w.name);D.push({title:w.name,isLeaf:!(w.type==="tree"),key:P})}return D}function X(F,O,D){for(var E=0;E<F.length;E++){var w=F[E];if(w.key===O){w.children=D;break}w.children&&X(w.children,O,D)}return F}function I(F,O,D){var E;return function(){var w=this,P=arguments,_=function(){E=null,D||F.apply(w,P)},A=D&&!E;clearTimeout(E),E=setTimeout(_,O),A&&F.apply(w,P)}}var k=!0,W=he.a.API_SERVER},"C+DQ":function(yt,it,se){},DlQD:function(yt,it,se){(function(he,Y){yt.exports=Y()})(this,function(){"use strict";function he(Q,ne){for(var le=0;le<ne.length;le++){var q=ne[le];q.enumerable=q.enumerable||!1,q.configurable=!0,"value"in q&&(q.writable=!0),Object.defineProperty(Q,q.key,q)}}function Y(Q,ne,le){return ne&&he(Q.prototype,ne),le&&he(Q,le),Q}function L(Q,ne){if(!Q)return;if(typeof Q=="string")return X(Q,ne);var le=Object.prototype.toString.call(Q).slice(8,-1);if(le==="Object"&&Q.constructor&&(le=Q.constructor.name),le==="Map"||le==="Set")return Array.from(Q);if(le==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(le))return X(Q,ne)}function X(Q,ne){(ne==null||ne>Q.length)&&(ne=Q.length);for(var le=0,q=new Array(ne);le<ne;le++)q[le]=Q[le];return q}function I(Q,ne){var le;if(typeof Symbol=="undefined"||Q[Symbol.iterator]==null){if(Array.isArray(Q)||(le=L(Q))||ne&&Q&&typeof Q.length=="number"){le&&(Q=le);var q=0;return function(){return q>=Q.length?{done:!0}:{done:!1,value:Q[q++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return le=Q[Symbol.iterator](),le.next.bind(le)}function k(Q,ne){return ne={exports:{}},Q(ne,ne.exports),ne.exports}var W=k(function(Q){function ne(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function le(q){Q.exports.defaults=q}Q.exports={defaults:ne(),getDefaults:ne,changeDefaults:le}}),F=W.defaults,O=W.getDefaults,D=W.changeDefaults,E=/[&<>"']/,w=/[&<>"']/g,P=/[<>"']|&(?!#?\w+;)/,_=/[<>"']|&(?!#?\w+;)/g,A={"&":"&","<":"<",">":">",'"':""","'":"'"},C=function(ne){return A[ne]};function c(Q,ne){if(ne){if(E.test(Q))return Q.replace(w,C)}else if(P.test(Q))return Q.replace(_,C);return Q}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function u(Q){return Q.replace(o,function(ne,le){return le=le.toLowerCase(),le==="colon"?":":le.charAt(0)==="#"?le.charAt(1)==="x"?String.fromCharCode(parseInt(le.substring(2),16)):String.fromCharCode(+le.substring(1)):""})}var d=/(^|[^\[])\^/g;function x(Q,ne){Q=Q.source||Q,ne=ne||"";var le={replace:function(ee,ae){return ae=ae.source||ae,ae=ae.replace(d,"$1"),Q=Q.replace(ee,ae),le},getRegex:function(){return new RegExp(Q,ne)}};return le}var v=/[^\w:]/g,f=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function l(Q,ne,le){if(Q){var q;try{q=decodeURIComponent(u(le)).replace(v,"").toLowerCase()}catch(ee){return null}if(q.indexOf("javascript:")===0||q.indexOf("vbscript:")===0||q.indexOf("data:")===0)return null}ne&&!f.test(le)&&(le=a(ne,le));try{le=encodeURI(le).replace(/%25/g,"%")}catch(ee){return null}return le}var b={},h=/^[^:]+:\/*[^/]*$/,p=/^([^:]+:)[\s\S]*$/,s=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(Q,ne){b[" "+Q]||(h.test(Q)?b[" "+Q]=Q+"/":b[" "+Q]=M(Q,"/",!0)),Q=b[" "+Q];var le=Q.indexOf(":")===-1;return ne.substring(0,2)==="//"?le?ne:Q.replace(p,"$1")+ne:ne.charAt(0)==="/"?le?ne:Q.replace(s,"$1")+ne:Q+ne}var g={exec:function(){}};function m(Q){for(var ne=1,le,q;ne<arguments.length;ne++){le=arguments[ne];for(q in le)Object.prototype.hasOwnProperty.call(le,q)&&(Q[q]=le[q])}return Q}function y(Q,ne){var le=Q.replace(/\|/g,function(ae,ue,de){for(var ye=!1,Te=ue;--Te>=0&&de[Te]==="\\";)ye=!ye;return ye?"|":" |"}),q=le.split(/ \|/),ee=0;if(q.length>ne)q.splice(ne);else for(;q.length<ne;)q.push("");for(;ee<q.length;ee++)q[ee]=q[ee].trim().replace(/\\\|/g,"|");return q}function M(Q,ne,le){var q=Q.length;if(q===0)return"";for(var ee=0;ee<q;){var ae=Q.charAt(q-ee-1);if(ae===ne&&!le)ee++;else if(ae!==ne&&le)ee++;else break}return Q.substr(0,q-ee)}function H(Q,ne){if(Q.indexOf(ne[1])===-1)return-1;for(var le=Q.length,q=0,ee=0;ee<le;ee++)if(Q[ee]==="\\")ee++;else if(Q[ee]===ne[0])q++;else if(Q[ee]===ne[1]&&(q--,q<0))return ee;return-1}function V(Q){Q&&Q.sanitize&&!Q.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var te={escape:c,unescape:u,edit:x,cleanUrl:l,resolveUrl:a,noopTest:g,merge:m,splitCells:y,rtrim:M,findClosingBracket:H,checkSanitizeDeprecation:V},G=W.defaults,j=te.rtrim,ie=te.splitCells,pe=te.escape,ge=te.findClosingBracket;function be(Q,ne,le){var q=ne.href,ee=ne.title?pe(ne.title):null,ae=Q[1].replace(/\\([\[\]])/g,"$1");return Q[0].charAt(0)!=="!"?{type:"link",raw:le,href:q,title:ee,text:ae}:{type:"image",raw:le,href:q,title:ee,text:pe(ae)}}function Ne(Q,ne){var le=Q.match(/^(\s+)(?:```)/);if(le===null)return ne;var q=le[1];return ne.split(`
|
|
`).map(function(ee){var ae=ee.match(/^\s+/);if(ae===null)return ee;var ue=ae[0];return ue.length>=q.length?ee.slice(q.length):ee}).join(`
|
|
`)}var Se=function(){function Q(le){this.options=le||G}var ne=Q.prototype;return ne.space=function(q){var ee=this.rules.block.newline.exec(q);if(ee)return ee[0].length>1?{type:"space",raw:ee[0]}:{raw:`
|
|
`}},ne.code=function(q,ee){var ae=this.rules.block.code.exec(q);if(ae){var ue=ee[ee.length-1];if(ue&&ue.type==="paragraph")return{raw:ae[0],text:ae[0].trimRight()};var de=ae[0].replace(/^ {4}/gm,"");return{type:"code",raw:ae[0],codeBlockStyle:"indented",text:this.options.pedantic?de:j(de,`
|
|
`)}}},ne.fences=function(q){var ee=this.rules.block.fences.exec(q);if(ee){var ae=ee[0],ue=Ne(ae,ee[3]||"");return{type:"code",raw:ae,lang:ee[2]?ee[2].trim():ee[2],text:ue}}},ne.heading=function(q){var ee=this.rules.block.heading.exec(q);if(ee)return{type:"heading",raw:ee[0],depth:ee[1].length,text:ee[2]}},ne.nptable=function(q){var ee=this.rules.block.nptable.exec(q);if(ee){var ae={type:"table",header:ie(ee[1].replace(/^ *| *\| *$/g,"")),align:ee[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ee[3]?ee[3].replace(/\n$/,"").split(`
|
|
`):[],raw:ee[0]};if(ae.header.length===ae.align.length){var ue=ae.align.length,de;for(de=0;de<ue;de++)/^ *-+: *$/.test(ae.align[de])?ae.align[de]="right":/^ *:-+: *$/.test(ae.align[de])?ae.align[de]="center":/^ *:-+ *$/.test(ae.align[de])?ae.align[de]="left":ae.align[de]=null;for(ue=ae.cells.length,de=0;de<ue;de++)ae.cells[de]=ie(ae.cells[de],ae.header.length);return ae}}},ne.hr=function(q){var ee=this.rules.block.hr.exec(q);if(ee)return{type:"hr",raw:ee[0]}},ne.blockquote=function(q){var ee=this.rules.block.blockquote.exec(q);if(ee){var ae=ee[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ee[0],text:ae}}},ne.list=function(q){var ee=this.rules.block.list.exec(q);if(ee){for(var ae=ee[0],ue=ee[2],de=ue.length>1,ye=ue[ue.length-1]===")",Te={type:"list",raw:ae,ordered:de,start:de?+ue.slice(0,-1):"",loose:!1,items:[]},Fe=ee[0].match(this.rules.block.item),He=!1,at,Lt,Ge,tt,Dt,ct,Rt,jt=Fe.length,xt=0;xt<jt;xt++)at=Fe[xt],ae=at,Lt=at.length,at=at.replace(/^ *([*+-]|\d+[.)]) */,""),~at.indexOf(`
|
|
`)&&(Lt-=at.length,at=this.options.pedantic?at.replace(/^ {1,4}/gm,""):at.replace(new RegExp("^ {1,"+Lt+"}","gm"),"")),xt!==jt-1&&(Ge=this.rules.block.bullet.exec(Fe[xt+1])[0],(de?Ge.length===1||!ye&&Ge[Ge.length-1]===")":Ge.length>1||this.options.smartLists&&Ge!==ue)&&(tt=Fe.slice(xt+1).join(`
|
|
`),Te.raw=Te.raw.substring(0,Te.raw.length-tt.length),xt=jt-1)),Dt=He||/\n\n(?!\s*$)/.test(at),xt!==jt-1&&(He=at.charAt(at.length-1)===`
|
|
`,Dt||(Dt=He)),Dt&&(Te.loose=!0),ct=/^\[[ xX]\] /.test(at),Rt=void 0,ct&&(Rt=at[1]!==" ",at=at.replace(/^\[[ xX]\] +/,"")),Te.items.push({type:"list_item",raw:ae,task:ct,checked:Rt,loose:Dt,text:at});return Te}},ne.html=function(q){var ee=this.rules.block.html.exec(q);if(ee)return{type:this.options.sanitize?"paragraph":"html",raw:ee[0],pre:!this.options.sanitizer&&(ee[1]==="pre"||ee[1]==="script"||ee[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ee[0]):pe(ee[0]):ee[0]}},ne.def=function(q){var ee=this.rules.block.def.exec(q);if(ee){ee[3]&&(ee[3]=ee[3].substring(1,ee[3].length-1));var ae=ee[1].toLowerCase().replace(/\s+/g," ");return{tag:ae,raw:ee[0],href:ee[2],title:ee[3]}}},ne.table=function(q){var ee=this.rules.block.table.exec(q);if(ee){var ae={type:"table",header:ie(ee[1].replace(/^ *| *\| *$/g,"")),align:ee[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ee[3]?ee[3].replace(/\n$/,"").split(`
|
|
`):[]};if(ae.header.length===ae.align.length){ae.raw=ee[0];var ue=ae.align.length,de;for(de=0;de<ue;de++)/^ *-+: *$/.test(ae.align[de])?ae.align[de]="right":/^ *:-+: *$/.test(ae.align[de])?ae.align[de]="center":/^ *:-+ *$/.test(ae.align[de])?ae.align[de]="left":ae.align[de]=null;for(ue=ae.cells.length,de=0;de<ue;de++)ae.cells[de]=ie(ae.cells[de].replace(/^ *\| *| *\| *$/g,""),ae.header.length);return ae}}},ne.lheading=function(q){var ee=this.rules.block.lheading.exec(q);if(ee)return{type:"heading",raw:ee[0],depth:ee[2].charAt(0)==="="?1:2,text:ee[1]}},ne.paragraph=function(q){var ee=this.rules.block.paragraph.exec(q);if(ee)return{type:"paragraph",raw:ee[0],text:ee[1].charAt(ee[1].length-1)===`
|
|
`?ee[1].slice(0,-1):ee[1]}},ne.text=function(q,ee){var ae=this.rules.block.text.exec(q);if(ae){var ue=ee[ee.length-1];return ue&&ue.type==="text"?{raw:ae[0],text:ae[0]}:{type:"text",raw:ae[0],text:ae[0]}}},ne.escape=function(q){var ee=this.rules.inline.escape.exec(q);if(ee)return{type:"escape",raw:ee[0],text:pe(ee[1])}},ne.tag=function(q,ee,ae){var ue=this.rules.inline.tag.exec(q);if(ue)return!ee&&/^<a /i.test(ue[0])?ee=!0:ee&&/^<\/a>/i.test(ue[0])&&(ee=!1),!ae&&/^<(pre|code|kbd|script)(\s|>)/i.test(ue[0])?ae=!0:ae&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ue[0])&&(ae=!1),{type:this.options.sanitize?"text":"html",raw:ue[0],inLink:ee,inRawBlock:ae,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ue[0]):pe(ue[0]):ue[0]}},ne.link=function(q){var ee=this.rules.inline.link.exec(q);if(ee){var ae=ge(ee[2],"()");if(ae>-1){var ue=ee[0].indexOf("!")===0?5:4,de=ue+ee[1].length+ae;ee[2]=ee[2].substring(0,ae),ee[0]=ee[0].substring(0,de).trim(),ee[3]=""}var ye=ee[2],Te="";if(this.options.pedantic){var Fe=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(ye);Fe?(ye=Fe[1],Te=Fe[3]):Te=""}else Te=ee[3]?ee[3].slice(1,-1):"";ye=ye.trim().replace(/^<([\s\S]*)>$/,"$1");var He=be(ee,{href:ye&&ye.replace(this.rules.inline._escapes,"$1"),title:Te&&Te.replace(this.rules.inline._escapes,"$1")},ee[0]);return He}},ne.reflink=function(q,ee){var ae;if((ae=this.rules.inline.reflink.exec(q))||(ae=this.rules.inline.nolink.exec(q))){var ue=(ae[2]||ae[1]).replace(/\s+/g," ");if(ue=ee[ue.toLowerCase()],!ue||!ue.href){var de=ae[0].charAt(0);return{type:"text",raw:de,text:de}}var ye=be(ae,ue,ae[0]);return ye}},ne.strong=function(q,ee,ae){ae===void 0&&(ae="");var ue=this.rules.inline.strong.start.exec(q);if(ue&&(!ue[1]||ue[1]&&(ae===""||this.rules.inline.punctuation.exec(ae)))){ee=ee.slice(-1*q.length);var de=ue[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;de.lastIndex=0;for(var ye;(ue=de.exec(ee))!=null;)if(ye=this.rules.inline.strong.middle.exec(ee.slice(0,ue.index+3)),ye)return{type:"strong",raw:q.slice(0,ye[0].length),text:q.slice(2,ye[0].length-2)}}},ne.em=function(q,ee,ae){ae===void 0&&(ae="");var ue=this.rules.inline.em.start.exec(q);if(ue&&(!ue[1]||ue[1]&&(ae===""||this.rules.inline.punctuation.exec(ae)))){ee=ee.slice(-1*q.length);var de=ue[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;de.lastIndex=0;for(var ye;(ue=de.exec(ee))!=null;)if(ye=this.rules.inline.em.middle.exec(ee.slice(0,ue.index+2)),ye)return{type:"em",raw:q.slice(0,ye[0].length),text:q.slice(1,ye[0].length-1)}}},ne.codespan=function(q){var ee=this.rules.inline.code.exec(q);if(ee){var ae=ee[2].replace(/\n/g," "),ue=/[^ ]/.test(ae),de=ae.startsWith(" ")&&ae.endsWith(" ");return ue&&de&&(ae=ae.substring(1,ae.length-1)),ae=pe(ae,!0),{type:"codespan",raw:ee[0],text:ae}}},ne.br=function(q){var ee=this.rules.inline.br.exec(q);if(ee)return{type:"br",raw:ee[0]}},ne.del=function(q){var ee=this.rules.inline.del.exec(q);if(ee)return{type:"del",raw:ee[0],text:ee[1]}},ne.autolink=function(q,ee){var ae=this.rules.inline.autolink.exec(q);if(ae){var ue,de;return ae[2]==="@"?(ue=pe(this.options.mangle?ee(ae[1]):ae[1]),de="mailto:"+ue):(ue=pe(ae[1]),de=ue),{type:"link",raw:ae[0],text:ue,href:de,tokens:[{type:"text",raw:ue,text:ue}]}}},ne.url=function(q,ee){var ae;if(ae=this.rules.inline.url.exec(q)){var ue,de;if(ae[2]==="@")ue=pe(this.options.mangle?ee(ae[0]):ae[0]),de="mailto:"+ue;else{var ye;do ye=ae[0],ae[0]=this.rules.inline._backpedal.exec(ae[0])[0];while(ye!==ae[0]);ue=pe(ae[0]),ae[1]==="www."?de="http://"+ue:de=ue}return{type:"link",raw:ae[0],text:ue,href:de,tokens:[{type:"text",raw:ue,text:ue}]}}},ne.inlineText=function(q,ee,ae){var ue=this.rules.inline.text.exec(q);if(ue){var de;return ee?de=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ue[0]):pe(ue[0]):ue[0]:de=pe(this.options.smartypants?ae(ue[0]):ue[0]),{type:"text",raw:ue[0],text:de}}},Q}(),Me=te.noopTest,Le=te.edit,we=te.merge,ve={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:Me,table:Me,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ve._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ve._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ve.def=Le(ve.def).replace("label",ve._label).replace("title",ve._title).getRegex(),ve.bullet=/(?:[*+-]|\d{1,9}[.)])/,ve.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ve.item=Le(ve.item,"gm").replace(/bull/g,ve.bullet).getRegex(),ve.list=Le(ve.list).replace(/bull/g,ve.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ve.def.source+")").getRegex(),ve._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",ve._comment=/<!--(?!-?>)[\s\S]*?-->/,ve.html=Le(ve.html,"i").replace("comment",ve._comment).replace("tag",ve._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ve.paragraph=Le(ve._paragraph).replace("hr",ve.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",ve._tag).getRegex(),ve.blockquote=Le(ve.blockquote).replace("paragraph",ve.paragraph).getRegex(),ve.normal=we({},ve),ve.gfm=we({},ve.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*|$)"}),ve.gfm.nptable=Le(ve.gfm.nptable).replace("hr",ve.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",ve._tag).getRegex(),ve.gfm.table=Le(ve.gfm.table).replace("hr",ve.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",ve._tag).getRegex(),ve.pedantic=we({},ve.normal,{html:Le(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ve._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:Me,paragraph:Le(ve.normal._paragraph).replace("hr",ve.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ve.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var N={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Me,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:Me,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};N._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",N.punctuation=Le(N.punctuation).replace(/punctuation/g,N._punctuation).getRegex(),N._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",N._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",N.em.start=Le(N.em.start).replace(/punctuation/g,N._punctuation).getRegex(),N.em.middle=Le(N.em.middle).replace(/punctuation/g,N._punctuation).replace(/overlapSkip/g,N._overlapSkip).getRegex(),N.em.endAst=Le(N.em.endAst,"g").replace(/punctuation/g,N._punctuation).getRegex(),N.em.endUnd=Le(N.em.endUnd,"g").replace(/punctuation/g,N._punctuation).getRegex(),N.strong.start=Le(N.strong.start).replace(/punctuation/g,N._punctuation).getRegex(),N.strong.middle=Le(N.strong.middle).replace(/punctuation/g,N._punctuation).replace(/blockSkip/g,N._blockSkip).getRegex(),N.strong.endAst=Le(N.strong.endAst,"g").replace(/punctuation/g,N._punctuation).getRegex(),N.strong.endUnd=Le(N.strong.endUnd,"g").replace(/punctuation/g,N._punctuation).getRegex(),N.blockSkip=Le(N._blockSkip,"g").getRegex(),N.overlapSkip=Le(N._overlapSkip,"g").getRegex(),N._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,N._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,N._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])?)+(?![-_])/,N.autolink=Le(N.autolink).replace("scheme",N._scheme).replace("email",N._email).getRegex(),N._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,N.tag=Le(N.tag).replace("comment",ve._comment).replace("attribute",N._attribute).getRegex(),N._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,N._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,N._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,N.link=Le(N.link).replace("label",N._label).replace("href",N._href).replace("title",N._title).getRegex(),N.reflink=Le(N.reflink).replace("label",N._label).getRegex(),N.reflinkSearch=Le(N.reflinkSearch,"g").replace("reflink",N.reflink).replace("nolink",N.nolink).getRegex(),N.normal=we({},N),N.pedantic=we({},N.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:Le(/^!?\[(label)\]\((.*?)\)/).replace("label",N._label).getRegex(),reflink:Le(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",N._label).getRegex()}),N.gfm=we({},N.normal,{escape:Le(N.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),N.gfm.url=Le(N.gfm.url,"i").replace("email",N.gfm._extended_email).getRegex(),N.breaks=we({},N.gfm,{br:Le(N.br).replace("{2,}","*").getRegex(),text:Le(N.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var T={block:ve,inline:N},R=W.defaults,z=T.block,Z=T.inline;function B(Q){return Q.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function ce(Q){var ne="",le,q,ee=Q.length;for(le=0;le<ee;le++)q=Q.charCodeAt(le),Math.random()>.5&&(q="x"+q.toString(16)),ne+="&#"+q+";";return ne}var Ee=function(){function Q(le){this.tokens=[],this.tokens.links=Object.create(null),this.options=le||R,this.options.tokenizer=this.options.tokenizer||new Se,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var q={block:z.normal,inline:Z.normal};this.options.pedantic?(q.block=z.pedantic,q.inline=Z.pedantic):this.options.gfm&&(q.block=z.gfm,this.options.breaks?q.inline=Z.breaks:q.inline=Z.gfm),this.tokenizer.rules=q}Q.lex=function(q,ee){var ae=new Q(ee);return ae.lex(q)};var ne=Q.prototype;return ne.lex=function(q){return q=q.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(q,this.tokens,!0),this.inline(this.tokens),this.tokens},ne.blockTokens=function(q,ee,ae){ee===void 0&&(ee=[]),ae===void 0&&(ae=!0),q=q.replace(/^ +$/gm,"");for(var ue,de,ye,Te;q;){if(ue=this.tokenizer.space(q)){q=q.substring(ue.raw.length),ue.type&&ee.push(ue);continue}if(ue=this.tokenizer.code(q,ee)){q=q.substring(ue.raw.length),ue.type?ee.push(ue):(Te=ee[ee.length-1],Te.raw+=`
|
|
`+ue.raw,Te.text+=`
|
|
`+ue.text);continue}if(ue=this.tokenizer.fences(q)){q=q.substring(ue.raw.length),ee.push(ue);continue}if(ue=this.tokenizer.heading(q)){q=q.substring(ue.raw.length),ee.push(ue);continue}if(ue=this.tokenizer.nptable(q)){q=q.substring(ue.raw.length),ee.push(ue);continue}if(ue=this.tokenizer.hr(q)){q=q.substring(ue.raw.length),ee.push(ue);continue}if(ue=this.tokenizer.blockquote(q)){q=q.substring(ue.raw.length),ue.tokens=this.blockTokens(ue.text,[],ae),ee.push(ue);continue}if(ue=this.tokenizer.list(q)){for(q=q.substring(ue.raw.length),ye=ue.items.length,de=0;de<ye;de++)ue.items[de].tokens=this.blockTokens(ue.items[de].text,[],!1);ee.push(ue);continue}if(ue=this.tokenizer.html(q)){q=q.substring(ue.raw.length),ee.push(ue);continue}if(ae&&(ue=this.tokenizer.def(q))){q=q.substring(ue.raw.length),this.tokens.links[ue.tag]||(this.tokens.links[ue.tag]={href:ue.href,title:ue.title});continue}if(ue=this.tokenizer.table(q)){q=q.substring(ue.raw.length),ee.push(ue);continue}if(ue=this.tokenizer.lheading(q)){q=q.substring(ue.raw.length),ee.push(ue);continue}if(ae&&(ue=this.tokenizer.paragraph(q))){q=q.substring(ue.raw.length),ee.push(ue);continue}if(ue=this.tokenizer.text(q,ee)){q=q.substring(ue.raw.length),ue.type?ee.push(ue):(Te=ee[ee.length-1],Te.raw+=`
|
|
`+ue.raw,Te.text+=`
|
|
`+ue.text);continue}if(q){var Fe="Infinite loop on byte: "+q.charCodeAt(0);if(this.options.silent){console.error(Fe);break}else throw new Error(Fe)}}return ee},ne.inline=function(q){var ee,ae,ue,de,ye,Te,Fe=q.length;for(ee=0;ee<Fe;ee++){Te=q[ee];switch(Te.type){case"paragraph":case"text":case"heading":{Te.tokens=[],this.inlineTokens(Te.text,Te.tokens);break}case"table":{for(Te.tokens={header:[],cells:[]},de=Te.header.length,ae=0;ae<de;ae++)Te.tokens.header[ae]=[],this.inlineTokens(Te.header[ae],Te.tokens.header[ae]);for(de=Te.cells.length,ae=0;ae<de;ae++)for(ye=Te.cells[ae],Te.tokens.cells[ae]=[],ue=0;ue<ye.length;ue++)Te.tokens.cells[ae][ue]=[],this.inlineTokens(ye[ue],Te.tokens.cells[ae][ue]);break}case"blockquote":{this.inline(Te.tokens);break}case"list":{for(de=Te.items.length,ae=0;ae<de;ae++)this.inline(Te.items[ae].tokens);break}}}return q},ne.inlineTokens=function(q,ee,ae,ue,de){ee===void 0&&(ee=[]),ae===void 0&&(ae=!1),ue===void 0&&(ue=!1),de===void 0&&(de="");var ye,Te=q,Fe;if(this.tokens.links){var He=Object.keys(this.tokens.links);if(He.length>0)for(;(Fe=this.tokenizer.rules.inline.reflinkSearch.exec(Te))!=null;)He.includes(Fe[0].slice(Fe[0].lastIndexOf("[")+1,-1))&&(Te=Te.slice(0,Fe.index)+"["+"a".repeat(Fe[0].length-2)+"]"+Te.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Fe=this.tokenizer.rules.inline.blockSkip.exec(Te))!=null;)Te=Te.slice(0,Fe.index)+"["+"a".repeat(Fe[0].length-2)+"]"+Te.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;q;){if(ye=this.tokenizer.escape(q)){q=q.substring(ye.raw.length),ee.push(ye);continue}if(ye=this.tokenizer.tag(q,ae,ue)){q=q.substring(ye.raw.length),ae=ye.inLink,ue=ye.inRawBlock,ee.push(ye);continue}if(ye=this.tokenizer.link(q)){q=q.substring(ye.raw.length),ye.type==="link"&&(ye.tokens=this.inlineTokens(ye.text,[],!0,ue)),ee.push(ye);continue}if(ye=this.tokenizer.reflink(q,this.tokens.links)){q=q.substring(ye.raw.length),ye.type==="link"&&(ye.tokens=this.inlineTokens(ye.text,[],!0,ue)),ee.push(ye);continue}if(ye=this.tokenizer.strong(q,Te,de)){q=q.substring(ye.raw.length),ye.tokens=this.inlineTokens(ye.text,[],ae,ue),ee.push(ye);continue}if(ye=this.tokenizer.em(q,Te,de)){q=q.substring(ye.raw.length),ye.tokens=this.inlineTokens(ye.text,[],ae,ue),ee.push(ye);continue}if(ye=this.tokenizer.codespan(q)){q=q.substring(ye.raw.length),ee.push(ye);continue}if(ye=this.tokenizer.br(q)){q=q.substring(ye.raw.length),ee.push(ye);continue}if(ye=this.tokenizer.del(q)){q=q.substring(ye.raw.length),ye.tokens=this.inlineTokens(ye.text,[],ae,ue),ee.push(ye);continue}if(ye=this.tokenizer.autolink(q,ce)){q=q.substring(ye.raw.length),ee.push(ye);continue}if(!ae&&(ye=this.tokenizer.url(q,ce))){q=q.substring(ye.raw.length),ee.push(ye);continue}if(ye=this.tokenizer.inlineText(q,ue,B)){q=q.substring(ye.raw.length),de=ye.raw.slice(-1),ee.push(ye);continue}if(q){var at="Infinite loop on byte: "+q.charCodeAt(0);if(this.options.silent){console.error(at);break}else throw new Error(at)}}return ee},Y(Q,null,[{key:"rules",get:function(){return{block:z,inline:Z}}}]),Q}(),Ae=W.defaults,Oe=te.cleanUrl,Re=te.escape,De=function(){function Q(le){this.options=le||Ae}var ne=Q.prototype;return ne.code=function(q,ee,ae){var ue=(ee||"").match(/\S*/)[0];if(this.options.highlight){var de=this.options.highlight(q,ue);de!=null&&de!==q&&(ae=!0,q=de)}return ue?'<pre><code class="'+this.options.langPrefix+Re(ue,!0)+'">'+(ae?q:Re(q,!0))+`</code></pre>
|
|
`:"<pre><code>"+(ae?q:Re(q,!0))+`</code></pre>
|
|
`},ne.blockquote=function(q){return`<blockquote>
|
|
`+q+`</blockquote>
|
|
`},ne.html=function(q){return q},ne.heading=function(q,ee,ae,ue){return this.options.headerIds?"<h"+ee+' id="'+this.options.headerPrefix+ue.slug(ae)+'">'+q+"</h"+ee+`>
|
|
`:"<h"+ee+">"+q+"</h"+ee+`>
|
|
`},ne.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},ne.list=function(q,ee,ae){var ue=ee?"ol":"ul",de=ee&&ae!==1?' start="'+ae+'"':"";return"<"+ue+de+`>
|
|
`+q+"</"+ue+`>
|
|
`},ne.listitem=function(q){return"<li>"+q+`</li>
|
|
`},ne.checkbox=function(q){return"<input "+(q?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ne.paragraph=function(q){return"<p>"+q+`</p>
|
|
`},ne.table=function(q,ee){return ee&&(ee="<tbody>"+ee+"</tbody>"),`<table>
|
|
<thead>
|
|
`+q+`</thead>
|
|
`+ee+`</table>
|
|
`},ne.tablerow=function(q){return`<tr>
|
|
`+q+`</tr>
|
|
`},ne.tablecell=function(q,ee){var ae=ee.header?"th":"td",ue=ee.align?"<"+ae+' align="'+ee.align+'">':"<"+ae+">";return ue+q+"</"+ae+`>
|
|
`},ne.strong=function(q){return"<strong>"+q+"</strong>"},ne.em=function(q){return"<em>"+q+"</em>"},ne.codespan=function(q){return"<code>"+q+"</code>"},ne.br=function(){return this.options.xhtml?"<br/>":"<br>"},ne.del=function(q){return"<del>"+q+"</del>"},ne.link=function(q,ee,ae){if(q=Oe(this.options.sanitize,this.options.baseUrl,q),q===null)return ae;var ue='<a href="'+Re(q)+'"';return ee&&(ue+=' title="'+ee+'"'),ue+=">"+ae+"</a>",ue},ne.image=function(q,ee,ae){if(q=Oe(this.options.sanitize,this.options.baseUrl,q),q===null)return ae;var ue='<img src="'+q+'" alt="'+ae+'"';return ee&&(ue+=' title="'+ee+'"'),ue+=this.options.xhtml?"/>":">",ue},ne.text=function(q){return q},Q}(),Pe=function(){function Q(){}var ne=Q.prototype;return ne.strong=function(q){return q},ne.em=function(q){return q},ne.codespan=function(q){return q},ne.del=function(q){return q},ne.html=function(q){return q},ne.text=function(q){return q},ne.link=function(q,ee,ae){return""+ae},ne.image=function(q,ee,ae){return""+ae},ne.br=function(){return""},Q}(),Ke=function(){function Q(){this.seen={}}var ne=Q.prototype;return ne.slug=function(q){var ee=q.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ee)){var ae=ee;do this.seen[ae]++,ee=ae+"-"+this.seen[ae];while(this.seen.hasOwnProperty(ee))}return this.seen[ee]=0,ee},Q}(),Xe=W.defaults,Ye=te.unescape,$e=function(){function Q(le){this.options=le||Xe,this.options.renderer=this.options.renderer||new De,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Pe,this.slugger=new Ke}Q.parse=function(q,ee){var ae=new Q(ee);return ae.parse(q)};var ne=Q.prototype;return ne.parse=function(q,ee){ee===void 0&&(ee=!0);var ae="",ue,de,ye,Te,Fe,He,at,Lt,Ge,tt,Dt,ct,Rt,jt,xt,Kt,Vt,Ut,Nt=q.length;for(ue=0;ue<Nt;ue++){tt=q[ue];switch(tt.type){case"space":continue;case"hr":{ae+=this.renderer.hr();continue}case"heading":{ae+=this.renderer.heading(this.parseInline(tt.tokens),tt.depth,Ye(this.parseInline(tt.tokens,this.textRenderer)),this.slugger);continue}case"code":{ae+=this.renderer.code(tt.text,tt.lang,tt.escaped);continue}case"table":{for(Lt="",at="",Te=tt.header.length,de=0;de<Te;de++)at+=this.renderer.tablecell(this.parseInline(tt.tokens.header[de]),{header:!0,align:tt.align[de]});for(Lt+=this.renderer.tablerow(at),Ge="",Te=tt.cells.length,de=0;de<Te;de++){for(He=tt.tokens.cells[de],at="",Fe=He.length,ye=0;ye<Fe;ye++)at+=this.renderer.tablecell(this.parseInline(He[ye]),{header:!1,align:tt.align[ye]});Ge+=this.renderer.tablerow(at)}ae+=this.renderer.table(Lt,Ge);continue}case"blockquote":{Ge=this.parse(tt.tokens),ae+=this.renderer.blockquote(Ge);continue}case"list":{for(Dt=tt.ordered,ct=tt.start,Rt=tt.loose,Te=tt.items.length,Ge="",de=0;de<Te;de++)xt=tt.items[de],Kt=xt.checked,Vt=xt.task,jt="",xt.task&&(Ut=this.renderer.checkbox(Kt),Rt?xt.tokens.length>0&&xt.tokens[0].type==="text"?(xt.tokens[0].text=Ut+" "+xt.tokens[0].text,xt.tokens[0].tokens&&xt.tokens[0].tokens.length>0&&xt.tokens[0].tokens[0].type==="text"&&(xt.tokens[0].tokens[0].text=Ut+" "+xt.tokens[0].tokens[0].text)):xt.tokens.unshift({type:"text",text:Ut}):jt+=Ut),jt+=this.parse(xt.tokens,Rt),Ge+=this.renderer.listitem(jt,Vt,Kt);ae+=this.renderer.list(Ge,Dt,ct);continue}case"html":{ae+=this.renderer.html(tt.text);continue}case"paragraph":{ae+=this.renderer.paragraph(this.parseInline(tt.tokens));continue}case"text":{for(Ge=tt.tokens?this.parseInline(tt.tokens):tt.text;ue+1<Nt&&q[ue+1].type==="text";)tt=q[++ue],Ge+=`
|
|
`+(tt.tokens?this.parseInline(tt.tokens):tt.text);ae+=ee?this.renderer.paragraph(Ge):Ge;continue}default:{var It='Token with "'+tt.type+'" type was not found.';if(this.options.silent){console.error(It);return}else throw new Error(It)}}}return ae},ne.parseInline=function(q,ee){ee=ee||this.renderer;var ae="",ue,de,ye=q.length;for(ue=0;ue<ye;ue++){de=q[ue];switch(de.type){case"escape":{ae+=ee.text(de.text);break}case"html":{ae+=ee.html(de.text);break}case"link":{ae+=ee.link(de.href,de.title,this.parseInline(de.tokens,ee));break}case"image":{ae+=ee.image(de.href,de.title,de.text);break}case"strong":{ae+=ee.strong(this.parseInline(de.tokens,ee));break}case"em":{ae+=ee.em(this.parseInline(de.tokens,ee));break}case"codespan":{ae+=ee.codespan(de.text);break}case"br":{ae+=ee.br();break}case"del":{ae+=ee.del(this.parseInline(de.tokens,ee));break}case"text":{ae+=ee.text(de.text);break}default:{var Te='Token with "'+de.type+'" type was not found.';if(this.options.silent){console.error(Te);return}else throw new Error(Te)}}}return ae},Q}(),ft=te.merge,Je=te.checkSanitizeDeprecation,et=te.escape,ke=W.getDefaults,st=W.changeDefaults,nt=W.defaults;function oe(Q,ne,le){if(typeof Q=="undefined"||Q===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Q!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Q)+", string expected");if(typeof ne=="function"&&(le=ne,ne=null),ne=ft({},oe.defaults,ne||{}),Je(ne),le){var q=ne.highlight,ee;try{ee=Ee.lex(Q,ne)}catch(ye){return le(ye)}var ae=function(Te){var Fe;if(!Te)try{Fe=$e.parse(ee,ne)}catch(He){Te=He}return ne.highlight=q,Te?le(Te):le(null,Fe)};if(!q||q.length<3)return ae();if(delete ne.highlight,!ee.length)return ae();var ue=0;oe.walkTokens(ee,function(ye){ye.type==="code"&&(ue++,setTimeout(function(){q(ye.text,ye.lang,function(Te,Fe){if(Te)return ae(Te);Fe!=null&&Fe!==ye.text&&(ye.text=Fe,ye.escaped=!0),ue--,ue===0&&ae()})},0))}),ue===0&&ae();return}try{var de=Ee.lex(Q,ne);return ne.walkTokens&&oe.walkTokens(de,ne.walkTokens),$e.parse(de,ne)}catch(ye){if(ye.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,ne.silent)return"<p>An error occurred:</p><pre>"+et(ye.message+"",!0)+"</pre>";throw ye}}oe.options=oe.setOptions=function(Q){return ft(oe.defaults,Q),st(oe.defaults),oe},oe.getDefaults=ke,oe.defaults=nt,oe.use=function(Q){var ne=ft({},Q);if(Q.renderer&&function(){var q=oe.defaults.renderer||new De,ee=function(de){var ye=q[de];q[de]=function(){for(var Te=arguments.length,Fe=new Array(Te),He=0;He<Te;He++)Fe[He]=arguments[He];var at=Q.renderer[de].apply(q,Fe);return at===!1&&(at=ye.apply(q,Fe)),at}};for(var ae in Q.renderer)ee(ae);ne.renderer=q}(),Q.tokenizer&&function(){var q=oe.defaults.tokenizer||new Se,ee=function(de){var ye=q[de];q[de]=function(){for(var Te=arguments.length,Fe=new Array(Te),He=0;He<Te;He++)Fe[He]=arguments[He];var at=Q.tokenizer[de].apply(q,Fe);return at===!1&&(at=ye.apply(q,Fe)),at}};for(var ae in Q.tokenizer)ee(ae);ne.tokenizer=q}(),Q.walkTokens){var le=oe.defaults.walkTokens;ne.walkTokens=function(q){Q.walkTokens(q),le&&le(q)}}oe.setOptions(ne)},oe.walkTokens=function(Q,ne){for(var le=I(Q),q;!(q=le()).done;){var ee=q.value;ne(ee);switch(ee.type){case"table":{for(var ae=I(ee.tokens.header),ue;!(ue=ae()).done;){var de=ue.value;oe.walkTokens(de,ne)}for(var ye=I(ee.tokens.cells),Te;!(Te=ye()).done;)for(var Fe=Te.value,He=I(Fe),at;!(at=He()).done;){var Lt=at.value;oe.walkTokens(Lt,ne)}break}case"list":{oe.walkTokens(ee.items,ne);break}default:ee.tokens&&oe.walkTokens(ee.tokens,ne)}}},oe.Parser=$e,oe.parser=$e.parse,oe.Renderer=De,oe.TextRenderer=Pe,oe.Lexer=Ee,oe.lexer=Ee.lex,oe.Tokenizer=Se,oe.Slugger=Ke,oe.parse=oe;var J=oe;return J})},ELLl:function(yt,it,se){(function(he){he(se("VrN/"))})(function(he){var Y={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},L=he.Pos;he.defineOption("autoCloseBrackets",!1,function(A,C,c){c&&c!=he.Init&&(A.removeKeyMap(I),A.state.closeBrackets=null),C&&(k(X(C,"pairs")),A.state.closeBrackets=C,A.addKeyMap(I))});function X(A,C){return C=="pairs"&&typeof A=="string"?A:typeof A=="object"&&A[C]!=null?A[C]:Y[C]}var I={Backspace:O,Enter:D};function k(A){for(var C=0;C<A.length;C++){var c=A.charAt(C),o="'"+c+"'";I[o]||(I[o]=W(c))}}k(Y.pairs+"`");function W(A){return function(C){return w(C,A)}}function F(A){var C=A.state.closeBrackets;if(!C||C.override)return C;var c=A.getModeAt(A.getCursor());return c.closeBrackets||C}function O(A){var C=F(A);if(!C||A.getOption("disableInput"))return he.Pass;for(var c=X(C,"pairs"),o=A.listSelections(),u=0;u<o.length;u++){if(!o[u].empty())return he.Pass;var d=P(A,o[u].head);if(!d||c.indexOf(d)%2!=0)return he.Pass}for(var u=o.length-1;u>=0;u--){var x=o[u].head;A.replaceRange("",L(x.line,x.ch-1),L(x.line,x.ch+1),"+delete")}}function D(A){var C=F(A),c=C&&X(C,"explode");if(!c||A.getOption("disableInput"))return he.Pass;for(var o=A.listSelections(),u=0;u<o.length;u++){if(!o[u].empty())return he.Pass;var d=P(A,o[u].head);if(!d||c.indexOf(d)%2!=0)return he.Pass}A.operation(function(){var x=A.lineSeparator()||`
|
|
`;A.replaceSelection(x+x,null),A.execCommand("goCharLeft"),o=A.listSelections();for(var v=0;v<o.length;v++){var f=o[v].head.line;A.indentLine(f,null,!0),A.indentLine(f+1,null,!0)}})}function E(A){var C=he.cmpPos(A.anchor,A.head)>0;return{anchor:new L(A.anchor.line,A.anchor.ch+(C?-1:1)),head:new L(A.head.line,A.head.ch+(C?1:-1))}}function w(A,C){var c=F(A);if(!c||A.getOption("disableInput"))return he.Pass;var o=X(c,"pairs"),u=o.indexOf(C);if(u==-1)return he.Pass;for(var d=X(c,"closeBefore"),x=X(c,"triples"),v=o.charAt(u+1)==C,f=A.listSelections(),l=u%2==0,b,h=0;h<f.length;h++){var p=f[h],s=p.head,a,g=A.getRange(s,L(s.line,s.ch+1));if(l&&!p.empty())a="surround";else if((v||!l)&&g==C)v&&_(A,s)?a="both":x.indexOf(C)>=0&&A.getRange(s,L(s.line,s.ch+3))==C+C+C?a="skipThree":a="skip";else if(v&&s.ch>1&&x.indexOf(C)>=0&&A.getRange(L(s.line,s.ch-2),s)==C+C){if(s.ch>2&&/\bstring/.test(A.getTokenTypeAt(L(s.line,s.ch-2))))return he.Pass;a="addFour"}else if(v){var m=s.ch==0?" ":A.getRange(L(s.line,s.ch-1),s);if(!he.isWordChar(g)&&m!=C&&!he.isWordChar(m))a="both";else return he.Pass}else if(l&&(g.length===0||/\s/.test(g)||d.indexOf(g)>-1))a="both";else return he.Pass;if(!b)b=a;else if(b!=a)return he.Pass}var y=u%2?o.charAt(u-1):C,M=u%2?C:o.charAt(u+1);A.operation(function(){if(b=="skip")A.execCommand("goCharRight");else if(b=="skipThree")for(var H=0;H<3;H++)A.execCommand("goCharRight");else if(b=="surround"){for(var V=A.getSelections(),H=0;H<V.length;H++)V[H]=y+V[H]+M;A.replaceSelections(V,"around"),V=A.listSelections().slice();for(var H=0;H<V.length;H++)V[H]=E(V[H]);A.setSelections(V)}else b=="both"?(A.replaceSelection(y+M,null),A.triggerElectric(y+M),A.execCommand("goCharLeft")):b=="addFour"&&(A.replaceSelection(y+y+y+y,"before"),A.execCommand("goCharRight"))})}function P(A,C){var c=A.getRange(L(C.line,C.ch-1),L(C.line,C.ch+1));return c.length==2?c:null}function _(A,C){var c=A.getTokenAt(L(C.line,C.ch+1));return/\bstring/.test(c.type)&&c.start==C.ch&&(C.ch==0||!/\bstring/.test(A.getTokenTypeAt(C)))}})},FIWC:function(yt,it,se){yt.exports={flex_box_center:"flex_box_center___gdHkq",flex_space_between:"flex_space_between___lk_Gv",flex_box_vertical_center:"flex_box_vertical_center___2WNVo",flex_box_center_end:"flex_box_center_end___13O11",flex_box_column:"flex_box_column___kMb8L",wrap:"wrap___1y6rg",crumbs:"crumbs___1vKDo"}},Gytx:function(yt,it){yt.exports=function(he,Y,L,X){var I=L?L.call(X,he,Y):void 0;if(I!==void 0)return!!I;if(he===Y)return!0;if(typeof he!="object"||!he||typeof Y!="object"||!Y)return!1;var k=Object.keys(he),W=Object.keys(Y);if(k.length!==W.length)return!1;for(var F=Object.prototype.hasOwnProperty.bind(Y),O=0;O<k.length;O++){var D=k[O];if(!F(D))return!1;var E=he[D],w=Y[D];if(I=L?L.call(X,E,w,D):void 0,I===!1||I===void 0&&E!==w)return!1}return!0}},HmJG:function(yt,it,se){},LdHM:function(yt,it,se){"use strict";se.d(it,"b",function(){return d}),se.d(it,"a",function(){return v});var he=se("1OyB"),Y=se("vuIU"),L=se("Ji7U"),X=se("LK+K"),I=se("q1tI"),k=se("rePB"),W=se("Ff2n"),F=se("ODXe"),O=se("4IlW"),D=se("bX4T"),E=se("YrtM"),w=se("TSYQ"),P=se.n(w),_=se("+nKL"),A=se("8OUc"),C=function(ie,pe){var ge=ie.prefixCls,be=ie.id,Ne=ie.flattenOptions,Se=ie.childrenAsData,Me=ie.values,Le=ie.searchValue,we=ie.multiple,ve=ie.defaultActiveFirstOption,N=ie.height,T=ie.itemHeight,R=ie.notFoundContent,z=ie.open,Z=ie.menuItemSelectedIcon,B=ie.virtual,ce=ie.onSelect,Ee=ie.onToggleOpen,Ae=ie.onActiveValue,Oe=ie.onScroll,Re=ie.onMouseEnter,De="".concat(ge,"-item"),Pe=Object(E.a)(function(){return Ne},[z,Ne],function(J,Q){return Q[0]&&J[1]!==Q[1]}),Ke=I.useRef(null),Xe=function(Q){Q.preventDefault()},Ye=function(Q){Ke.current&&Ke.current.scrollTo({index:Q})},$e=function(Q){for(var ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,le=Pe.length,q=0;q<le;q+=1){var ee=(Q+q*ne+le)%le,ae=Pe[ee],ue=ae.group,de=ae.data;if(!ue&&!de.disabled)return ee}return-1},ft=I.useState(function(){return $e(0)}),Je=Object(F.a)(ft,2),et=Je[0],ke=Je[1],st=function(Q){ke(Q);var ne=Pe[Q];if(!ne){Ae(null,-1);return}Ae(ne.data.value,Q)};I.useEffect(function(){st(ve!==!1?$e(0):-1)},[Pe.length,Le]),I.useEffect(function(){var J=setTimeout(function(){if(!we&&z&&Me.size===1){var Q=Array.from(Me)[0],ne=Pe.findIndex(function(le){var q=le.data;return q.value===Q});st(ne),Ye(ne)}});return function(){return clearTimeout(J)}},[z]);var nt=function(Q){Q!==void 0&&ce(Q,{selected:!Me.has(Q)}),we||Ee(!1)};if(I.useImperativeHandle(pe,function(){return{onKeyDown:function(Q){var ne=Q.which;switch(ne){case O.a.UP:case O.a.DOWN:{var le=0;if(ne===O.a.UP?le=-1:ne===O.a.DOWN&&(le=1),le!==0){var q=$e(et+le,le);Ye(q),st(q)}break}case O.a.ENTER:{var ee=Pe[et];ee&&!ee.data.disabled?nt(ee.data.value):nt(void 0),z&&Q.preventDefault();break}case O.a.ESC:Ee(!1)}},onKeyUp:function(){},scrollTo:function(Q){Ye(Q)}}}),Pe.length===0)return I.createElement("div",{role:"listbox",id:"".concat(be,"_list"),className:"".concat(De,"-empty"),onMouseDown:Xe},R);function oe(J){var Q=Pe[J];if(!Q)return null;var ne=Q.data||{},le=ne.value,q=ne.label,ee=ne.children,ae=Object(D.a)(ne,!0),ue=Se?ee:q;return Q?I.createElement("div",Object.assign({"aria-label":typeof ue=="string"?ue:null},ae,{key:J,role:"option",id:"".concat(be,"_list_").concat(J),"aria-selected":Me.has(le)}),le):null}return I.createElement(I.Fragment,null,I.createElement("div",{role:"listbox",id:"".concat(be,"_list"),style:{height:0,width:0,overflow:"hidden"}},oe(et-1),oe(et),oe(et+1)),I.createElement(_.a,{itemKey:"key",ref:Ke,data:Pe,height:N,itemHeight:T,fullHeight:!1,onMouseDown:Xe,onScroll:Oe,virtual:B,onMouseEnter:Re},function(J,Q){var ne,le=J.group,q=J.groupOption,ee=J.data,ae=ee.label,ue=ee.key;if(le)return I.createElement("div",{className:P()(De,"".concat(De,"-group"))},ae!==void 0?ae:ue);var de=ee.disabled,ye=ee.value,Te=ee.title,Fe=ee.children,He=ee.style,at=ee.className,Lt=Object(W.a)(ee,["disabled","value","title","children","style","className"]),Ge=Me.has(ye),tt="".concat(De,"-option"),Dt=P()(De,tt,at,(ne={},Object(k.a)(ne,"".concat(tt,"-grouped"),q),Object(k.a)(ne,"".concat(tt,"-active"),et===Q&&!de),Object(k.a)(ne,"".concat(tt,"-disabled"),de),Object(k.a)(ne,"".concat(tt,"-selected"),Ge),ne)),ct=Se?Fe:ae,Rt=!Z||typeof Z=="function"||Ge;return I.createElement("div",Object.assign({},Lt,{"aria-selected":Ge,className:Dt,title:Te,onMouseMove:function(){if(et===Q||de)return;st(Q)},onClick:function(){de||nt(ye)},style:He}),I.createElement("div",{className:"".concat(tt,"-content")},ct||ye),I.isValidElement(Z)||Ge,Rt&&I.createElement(A.a,{className:"".concat(De,"-option-state"),customizeIcon:Z,customizeIconProps:{isSelected:Ge}},Ge?"\u2713":null))}))},c=I.forwardRef(C);c.displayName="OptionList";var o=c,u=function(){return null};u.isSelectOption=!0;var d=u,x=function(){return null};x.isSelectOptGroup=!0;var v=x,f=se("VTBJ"),l=se("Zm9Q");function b(j){var ie=j.key,pe=j.props,ge=pe.children,be=pe.value,Ne=Object(W.a)(pe,["children","value"]);return Object(f.a)({key:ie,value:be!==void 0?be:ie,children:ge},Ne)}function h(j){var ie=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(l.a)(j).map(function(pe,ge){if(!I.isValidElement(pe)||!pe.type)return null;var be=pe.type.isSelectOptGroup,Ne=pe.key,Se=pe.props,Me=Se.children,Le=Object(W.a)(Se,["children"]);return ie||!be?b(pe):Object(f.a)(Object(f.a)({key:"__RC_SELECT_GRP__".concat(Ne===null?ge:Ne,"__"),label:Ne},Le),{},{options:h(Me)})}).filter(function(pe){return pe})}var p=se("2Qr1"),s=se("qNPg"),a=se("U8pU"),g=se("Kwbf"),m=se("WKfj");function y(j){var ie=j.mode,pe=j.options,ge=j.children,be=j.backfill,Ne=j.allowClear,Se=j.placeholder,Me=j.getInputElement,Le=j.showSearch,we=j.onSearch,ve=j.defaultOpen,N=j.autoFocus,T=j.labelInValue,R=j.value,z=j.inputValue,Z=j.optionLabelProp,B=ie==="multiple"||ie==="tags",ce=Le!==void 0?Le:B||ie==="combobox",Ee=pe||h(ge);if(Object(g.a)(ie!=="tags"||Ee.every(function(De){return!De.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),ie==="tags"||ie==="combobox"){var Ae=Ee.some(function(De){return De.options?De.options.some(function(Pe){return typeof("value"in Pe?Pe.value:Pe.key)=="number"}):typeof("value"in De?De.value:De.key)=="number"});Object(g.a)(!Ae,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(g.a)(ie!=="combobox"||!Z,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(g.a)(ie==="combobox"||!be,"`backfill` only works with `combobox` mode."),Object(g.a)(ie==="combobox"||!Me,"`getInputElement` only work with `combobox` mode."),Object(g.b)(ie!=="combobox"||!Me||!Ne||!Se,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),we&&!ce&&ie!=="combobox"&&ie!=="tags"&&Object(g.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(g.b)(!ve||N,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),R!=null){var Oe=Object(m.d)(R);Object(g.a)(!T||Oe.every(function(De){return Object(a.a)(De)==="object"&&("key"in De||"value"in De)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(g.a)(!B||Array.isArray(R),"`value` should be array when `mode` is `multiple` or `tags`")}if(ge){var Re=null;Object(l.a)(ge).some(function(De){if(!I.isValidElement(De)||!De.type)return!1;var Pe=De.type;if(Pe.isSelectOption)return!1;if(Pe.isSelectOptGroup){var Ke=Object(l.a)(De.props.children).every(function(Xe){return!I.isValidElement(Xe)||!De.type||Xe.type.isSelectOption?!0:(Re=Xe.type,!1)});return!Ke}return Re=Pe,!0}),Re&&Object(g.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Re.displayName||Re.name||Re,"`.")),Object(g.a)(z===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var M=y,H=Object(s.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:h,flattenOptions:p.d,getLabeledValue:p.e,filterOptions:p.b,isValueDisabled:p.g,findValueOption:p.c,warningProps:M,fillOptionsWithMissingValue:p.a}),V=function(j){Object(L.a)(pe,j);var ie=Object(X.a)(pe);function pe(){var ge;return Object(he.a)(this,pe),ge=ie.apply(this,arguments),ge.selectRef=I.createRef(),ge.focus=function(){ge.selectRef.current.focus()},ge.blur=function(){ge.selectRef.current.blur()},ge}return Object(Y.a)(pe,[{key:"render",value:function(){return I.createElement(H,Object.assign({ref:this.selectRef},this.props))}}]),pe}(I.Component);V.Option=d,V.OptGroup=v;var te=V,G=it.c=te},M8RZ:function(yt,it,se){"use strict";se.d(it,"a",function(){return O});var he=se("fWQN"),Y=se("mtLc"),L=se("yKVA"),X=se("879j"),I=se("q1tI"),k=se.n(I),W=se("i8i4"),F=se.n(W),O=function(D){Object(L.a)(w,D);var E=Object(X.a)(w);function w(P){var _;Object(he.a)(this,w),_=E.call(this,P);var A=window.document;return _.node=A.createElement("div"),A.body.appendChild(_.node),_}return Object(Y.a)(w,[{key:"render",value:function(){var _=this.props.children;return Object(W.createPortal)(_,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),w}(k.a.Component)},O2Wb:function(yt,it,se){yt.exports={flex:"flex___2gmSR",flex1:"flex1___3Tu1g",color666:"color666___2uyGL",error:"error___yJ86W",deleteIcon:"deleteIcon___1D2tg",addIcon:"addIcon___2VIYB"}},OLES:function(yt,it,se){"use strict";var he=se("U8pU"),Y=se("VTBJ"),L=se("Ff2n"),X=se("q1tI"),I=se("uciX"),k=se("7ixt"),W=function(P){var _=P.overlay,A=P.prefixCls,C=P.id,c=P.overlayInnerStyle;return X.createElement("div",{className:"".concat(A,"-inner"),id:C,role:"tooltip",style:c},typeof _=="function"?_():_)},F=W,O=function(P,_){var A=P.overlayClassName,C=P.trigger,c=C===void 0?["hover"]:C,o=P.mouseEnterDelay,u=o===void 0?0:o,d=P.mouseLeaveDelay,x=d===void 0?.1:d,v=P.overlayStyle,f=P.prefixCls,l=f===void 0?"rc-tooltip":f,b=P.children,h=P.onVisibleChange,p=P.afterVisibleChange,s=P.transitionName,a=P.animation,g=P.placement,m=g===void 0?"right":g,y=P.align,M=y===void 0?{}:y,H=P.destroyTooltipOnHide,V=H===void 0?!1:H,te=P.defaultVisible,G=P.getTooltipContainer,j=P.overlayInnerStyle,ie=Object(L.a)(P,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),pe=Object(X.useRef)(null);Object(X.useImperativeHandle)(_,function(){return pe.current});var ge=Object(Y.a)({},ie);"visible"in P&&(ge.popupVisible=P.visible);var be=function(){var we=P.arrowContent,ve=we===void 0?null:we,N=P.overlay,T=P.id;return[X.createElement("div",{className:"".concat(l,"-arrow"),key:"arrow"},ve),X.createElement(F,{key:"content",prefixCls:l,id:T,overlay:N,overlayInnerStyle:j})]},Ne=!1,Se=!1;if(typeof V=="boolean")Ne=V;else if(V&&Object(he.a)(V)==="object"){var Me=V.keepParent;Ne=Me===!0,Se=Me===!1}return X.createElement(I.a,Object.assign({popupClassName:A,prefixCls:l,popup:be,action:c,builtinPlacements:k.a,popupPlacement:m,ref:pe,popupAlign:M,getPopupContainer:G,onPopupVisibleChange:h,afterPopupVisibleChange:p,popupTransitionName:s,popupAnimation:a,defaultPopupVisible:te,destroyPopupOnHide:Ne,autoDestroy:Se,mouseLeaveDelay:x,popupStyle:v,mouseEnterDelay:u},ge),b)},D=Object(X.forwardRef)(O),E=it.a=D},Ot1p:function(yt,it,se){"use strict";var he=se("2qtc"),Y=se("kLXV"),L=se("rAM+"),X=se("miYZ"),I=se("tsqr"),k=se("9og8"),W=se("tJVT"),F=se("jrin"),O=se("WmNS"),D=se.n(O),E=se("q1tI"),w=se.n(E),P=se("VrN/"),_=se.n(P),A=se("bdgK"),C=se("p77/"),c=se("Bd2K"),o=se("ELLl"),u=se("19Vz"),d=se("lZu9"),x=se("+NIl"),v=se("kSUc"),f=se("9Bee"),l=function(de){var ye=de.value,Te=ye===void 0?"":ye,Fe=de.className,He=de.showTextOnly,at=de.showLines,Lt=de.style,Ge=Lt===void 0?{}:Lt,tt=Object(E.useMemo)(function(){return""},[Te]);return w.a.createElement(w.a.Fragment,null,w.a.createElement("div",{dangerouslySetInnerHTML:{__html:tt}}))},b=se("0Owb"),h=se("dejd"),p=se("C+DQ"),s=se("1vsH"),a=se("m3rI"),g=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function m(de){var ye=de.onActionCallback,Te=de.title,Fe=de.icon,He=de.actionName,at=de.className,Lt=at===void 0?"":at,Ge=de.children;function tt(){ye(He)}return w.a.createElement("a",{title:Te,className:Lt,onClick:tt},w.a.createElement("i",{className:"md-iconfont ".concat(Fe)}),Ge)}var y=function(de){var ye=de.watch,Te=de.showNullButton,Fe=de.onActionCallback,He=de.fullScreen,at=de.insertTemp,Lt=de.hidetoolBar,Ge=de.uuid,tt=de.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(s.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(s.F)("_educoder_session"),"&key=").concat(Ge,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var Dt=[].concat(g,[{title:"".concat(ye?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(ye?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return w.a.createElement("ul",{className:"markdown-toolbar-container"},!Lt&&Dt.map(function(ct,Rt){return w.a.createElement("li",{key:Rt},ct.actionName?w.a.createElement(m,Object(b.a)({},ct,{onActionCallback:Fe})):w.a.createElement("span",{className:"v-line"}))}),Te?w.a.createElement("li",null,w.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Fe},w.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,at&&w.a.createElement("li",null,w.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(at),onActionCallback:Fe},w.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),w.a.createElement("li",{className:"btn-full-screen"},w.a.createElement(m,{icon:"".concat(He?"icon-shrink":"icon-enlarge"),title:He?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Fe})))},M=se("M8RZ"),H=se("+L6B"),V=se("2/Rp"),te=se("y8nQ"),G=se("Vl3Y"),j=se("5NDa"),ie=se("5rEg"),pe={labelCol:{span:4},wrapperCol:{span:20}},ge=function(de){var ye=de.callback,Te=de.onCancel;function Fe(He){ye(He)}return w.a.createElement(G.a,Object(b.a)({},pe,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Fe}),w.a.createElement(G.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},w.a.createElement(ie.a,null)),w.a.createElement(G.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},w.a.createElement(ie.a,null)),w.a.createElement("div",{className:"flex-container flex-end"},w.a.createElement(V.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),w.a.createElement(V.a,{type:"ghost",onClick:Te},"\u53D6\u6D88")))},be=se("7ahc"),Ne=se("HmJG"),Se=se("BjJ7"),Me=G.a.useForm,Le={width:280,marginRight:10},we={labelCol:{span:5},wrapperCol:{span:19}},ve=function(de){var ye=de.callback,Te=de.onCancel,Fe=Me(),He=Object(W.a)(Fe,1),at=He[0];function Lt(Dt){ye(Dt)}function Ge(Dt,ct){if(Dt.status===-1){I.b.error(Dt.message);return}at.setFieldsValue({src:"/api/attachments/".concat(Dt.id),type:ct.type})}function tt(Dt){var ct=Dt.target.files[0];T(ct,Ge)}return w.a.createElement(G.a,Object(b.a)({form:at},we,{className:"upload-image-panel",onFinish:Lt}),w.a.createElement(G.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},w.a.createElement("div",{className:"flex-container"},w.a.createElement(G.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},w.a.createElement(ie.a,{style:Le})),w.a.createElement(N,{onFileChange:tt}))),w.a.createElement(G.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},w.a.createElement(ie.a,{style:{width:264}})),w.a.createElement(G.a.Item,{style:{textAlign:"right"}},w.a.createElement(V.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),w.a.createElement(V.a,{type:"ghost",onClick:Te},"\u53D6\u6D88")))};function N(de){var ye=de.onFileChange;return w.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",w.a.createElement("input",{type:"file",onChange:ye}))}function T(de,ye){if(!de)throw new String("\u6CA1\u6709\u6587\u4EF6");var Te=new FormData;Te.append("editormd-image-file",de),Te.append("file_param_name","editormd-image-file"),Te.append("byxhr","true");var Fe=new window.XMLHttpRequest;Fe.withCredentials=!0,Fe.addEventListener("load",function(He){ye(JSON.parse(He.target.responseText),de)},!1),Fe.addEventListener("error",function(He){console.error(He)},!1),Fe.open("POST","".concat(Se.a,"/api/attachments.json")),Fe.send(Te)}var R=se("giR+"),z=se("fyUT"),Z=se("7Kak"),B=se("9yH6"),ce=B.a.Group,Ee={margin:"0 8px"},Ae=function(de){var ye=de.callback,Te=de.onCancel;function Fe(He){ye(He)}return w.a.createElement(G.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Fe},w.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},w.a.createElement("span",{style:Ee},"\u5355\u5143\u683C\u6570\uFF1A"),w.a.createElement("span",{style:Ee},"\u884C\u6570"),w.a.createElement(G.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},w.a.createElement(z.a,null)),w.a.createElement("span",{style:Ee},"\u5217\u6570"),w.a.createElement(G.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},w.a.createElement(z.a,null))),w.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},w.a.createElement("span",{style:Ee},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),w.a.createElement(G.a.Item,{name:"align"},w.a.createElement(ce,null,w.a.createElement(B.a,{value:"default"},w.a.createElement("i",{className:"fa fa-align-justify"})),w.a.createElement(B.a,{value:"left"},w.a.createElement("i",{className:"fa fa-align-left"})),w.a.createElement(B.a,{value:"center"},w.a.createElement("i",{className:"fa fa-align-center"})),w.a.createElement(B.a,{value:"right"},w.a.createElement("i",{className:"fa fa-align-right"}))))),w.a.createElement("div",{className:"flex-container flex-end"},w.a.createElement(V.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),w.a.createElement(V.a,{type:"ghost",onClick:Te},"\u53D6\u6D88")))},Oe=se("ErOA"),Re=se("7Cbv"),De="link",Pe="upload-image",Ke="code-block",Xe="add-table",Ye="------------",$e={default:Ye,left:":".concat(Ye),center:":".concat(Ye,":"),right:"".concat(Ye,":")},ft=se("9VGf"),Je,et;function ke(){}var st=0,nt=1e4,oe="\u2581",J=`
|
|
**\u6A21\u677F\u6807\u9898**
|
|
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function Q(de){return/^\d+$/.test(de)?"".concat(de,"px"):de}var ne=navigator.platform.toUpperCase().indexOf("MAC")>=0,le=ne?"Cmd":"Ctrl",q=["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"],ee=(Je={},Object(F.a)(Je,le+"-B","bold"),Object(F.a)(Je,le+"-I","italic"),Je),ae=(et={},Object(F.a)(et,De,"\u6DFB\u52A0\u94FE\u63A5"),Object(F.a)(et,Ke,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(F.a)(et,Pe,"\u6DFB\u52A0\u6587\u4EF6"),Object(F.a)(et,Xe,"\u6DFB\u52A0\u8868\u683C"),et),ue=it.a=function(de){var ye=de.defaultValue,Te=ye===void 0?"":ye,Fe=de.onChange,He=de.width,at=He===void 0?"100%":He,Lt=de.height,Ge=Lt===void 0?400:Lt,tt=de.miniToolbar,Dt=tt===void 0?!1:tt,ct=de.isFocus,Rt=ct===void 0?!1:ct,jt=de.watch,xt=de.insertTemp,Kt=de.mode,Vt=Kt===void 0?"markdown":Kt,Ut=de.id,Nt=Ut===void 0?"markdown-editor-id":Ut,It=de.showResizeBar,Bt=It===void 0?!1:It,Ct=de.noStorage,wt=Ct===void 0?!1:Ct,mt=de.showNullButton,rt=mt===void 0?!1:mt,Ue=de.hidetoolBar,St=Ue===void 0?!1:Ue,Ot=de.fullScreen,vt=Ot===void 0?!1:Ot,_t=de.onBlur,Ht=de.onCMBeforeChange,Gt=de.onFullScreen,ot=de.className,Be=ot===void 0?"":ot,dt=de.disablePaste,yr=dt===void 0?!1:dt,an=de.placeholder,on=an===void 0?"":an,or=de.values,Ft=or===void 0?"":or,gt=Object(E.useState)(null),ir=Object(W.a)(gt,2),We=ir[0],dr=ir[1],_r=Object(E.useState)(Te),sn=Object(W.a)(_r,2),fn=sn[0],zr=sn[1],Ln=Object(E.useState)(jt),Rn=Object(W.a)(Ln,2),Kr=Rn[0],ln=Rn[1],kn=Object(E.useState)(vt),yn=Object(W.a)(kn,2),Vr=yn[0],Gn=yn[1],Ui=Object(E.useState)(""),Pn=Object(W.a)(Ui,2),br=Pn[0],qe=Pn[1],Ce=Object(E.useState)(0),ze=Object(W.a)(Ce,2),bt=ze[0],lt=ze[1],ht=Object(E.useState)(Ge),kt=Object(W.a)(ht,2),tr=kt[0],rr=kt[1],sr=Object(E.useState)(!1),Lr=Object(W.a)(sr,2),cr=Lr[0],Dr=Lr[1],fr=Object(E.useRef)(Object(Re.a)()),Zr=Object(E.useRef)(!1),Tr=Object(E.useRef)(),lr=Object(E.useRef)(),Xr=Object(E.useRef)(),Yr=Object(E.useRef)(),zn=Object(E.useRef)(),Bi=function(){var Et=Object(k.a)(D.a.mark(function Mt(){var At,zt;return D.a.wrap(function(qt){for(;;)switch(qt.prev=qt.next){case 0:return qt.next=2,Object(Oe.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:fr.current}});case 2:zt=qt.sent,zt!=null&&(At=zt.attachments)!==null&&At!==void 0&&At.length&&(console.log("cm:",We,lr),zt.attachments.map(function(Yt){Yt.content_type.indexOf("image")>-1?We.replaceSelection(".concat(Yt.content_type,")")):Yt.content_type.indexOf("video")>-1?We.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Yt.content_type.indexOf("pdf")>-1?We.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Yt.id,"?type=").concat(Yt.content_type,'&disposition=inline" target="_blank">').concat(Yt.name,"</a>")):We.replaceSelection("[".concat(Yt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Yt.id,"?type=").concat(Yt.content_type,")"))}));case 4:case"end":return qt.stop()}},Mt)}));return function(){return Et.apply(this,arguments)}}();Object(E.useEffect)(function(){zr(Ft),We==null||We.setValue(Ft)},[Ft]),Object(E.useEffect)(function(){Gt==null||Gt(Vr)},[Vr]),Object(E.useEffect)(function(){if(lr.current){var Et=_.a.fromTextArea(lr.current,{mode:Vt,lineNumbers:!Dt,lineWrapping:!0,value:Te,autoCloseTags:!0,autoCloseBrackets:!0});Rt&&Et.focus();function Mt(At,zt){if(yr){zt.preventDefault();return}var $t=zt.clipboardData;if($t){var qt=$t.types.toString(),Yt=$t.items;if(qt==="Files"||$t.types.indexOf("Files")>-1){if(zt.preventDefault(),Vt=="stex")return;try{var gr,Ir=Yt[1];((gr=Yt[0])===null||gr===void 0?void 0:gr.kind)==="file"&&(Ir=Yt[0]);var Xt=Ir.getAsFile(),pn=Xt.name.split(".").pop();T(Xt,function(Jt){if(Jt.id){var Nr,Rr,qr;(Xt==null||((Nr=Xt.type)===null||Nr===void 0)?void 0:Nr.indexOf("image"))>-1?Et.replaceSelection(".concat(Jt.content_type,")")):(Xt==null||((Rr=Xt.type)===null||Rr===void 0)?void 0:Rr.indexOf("video"))>-1?Et.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Jt.id,'"></video>')):(Xt==null||((qr=Xt.type)===null||qr===void 0)?void 0:qr.indexOf("pdf"))>-1?Et.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Jt.id,"?type=").concat(Xt.type,'&disposition=inline" target="_blank">').concat(Xt.name,"</a>")):q.includes(pn)?Et.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Jt.id,'?type=office&disposition=inline" target="_blank">').concat(Xt.name,"</a>")):Et.replaceSelection("[".concat(Xt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Jt.id,"?type=").concat(Jt.content_type,")"))}else(Jt==null?void 0:Jt.status)===401&&(document.location.href="/user/login")})}catch(Jt){I.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return Et.on("paste",Mt),Et.on("dragleave",function(At,zt){Xr.current.classList.remove("mouse-hover-md")}),Et.on("dragover",function(At,zt){Xr.current.classList.add("mouse-hover-md")}),Et.on("drop",function(At,zt){Xr.current.classList.add("mouse-hover-md");var $t;if($t=zt.dataTransfer.files,$t.length>0){zt.preventDefault(),zt.stopPropagation();for(var qt=function(Ir){var Xt=$t[Ir],pn=Xt.name.split(".").pop();T(Xt,function(Jt){if(Jt.id){var Nr,Rr,qr;(Xt==null||((Nr=Xt.type)===null||Nr===void 0)?void 0:Nr.indexOf("image"))>-1?Et.replaceSelection(".concat(Jt.content_type,")")):(Xt==null||((Rr=Xt.type)===null||Rr===void 0)?void 0:Rr.indexOf("video"))>-1?Et.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Jt.id,'"></video>')):(Xt==null||((qr=Xt.type)===null||qr===void 0)?void 0:qr.indexOf("pdf"))>-1?Et.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Jt.id,"?type=").concat(Xt.type,'&disposition=inline" target="_blank">').concat(Xt.name,"</a>")):q.includes(pn)?Et.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Jt.id,'?type=office&disposition=inline" target="_blank">').concat(Xt.name,"</a>")):Et.replaceSelection("[".concat(Xt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Jt.id,"?type=").concat(Jt.content_type,")"))}else(Jt==null?void 0:Jt.status)===401&&(document.location.href="/user/login")})},Yt=0;Yt<$t.length;Yt++)qt(Yt)}}),dr(Et),function(){Et.off("paste",Mt)}}},[]);var $r=Object(E.useCallback)(function(){if(Xr.current)try{}catch(Et){console.log(Et,"---- to set md editor body height")}},[tr,Xr,Vr]);Object(E.useEffect)(function(){function Et(){var At=new A.default(function(zt){var $t=Object(L.a)(zt),qt;try{for($t.s();!(qt=$t.n()).done;){var Yt=qt.value;(Yt.target.offsetHeight>0||Yt.target.offsetWidth>0)&&($r(),We.setSize("100%","100%"),We.refresh())}}catch(gr){$t.e(gr)}finally{$t.f()}});return At.observe(lr.current.parentElement),At}if(We){var Mt=Et();return function(){Mt.unobserve(lr.current.parentElement)}}},[We,$r]),Object(E.useEffect)(function(){if(We){for(var Et=[],Mt=function(){var Yt=zt[At];$t=Object(W.a)(Yt,2);var gr=$t[0],Ir=$t[1],Xt=Object(F.a)({},gr,function(){Fi(Ir)});Et.push(Xt),We.addKeyMap(Xt)},At=0,zt=Object.entries(ee);At<zt.length;At++){var $t;Mt()}return Tr.current=setInterval(function(){Zr.current&&Bi()},4e3),function(){clearInterval(Tr.current);var qt=Object(L.a)(Et),Yt;try{for(qt.s();!(Yt=qt.n()).done;){var gr=Yt.value;We.removeKeyMap(gr)}}catch(Ir){qt.e(Ir)}finally{qt.f()}}}},[We]),Object(E.useEffect)(function(){vt!==Vr&&Gn(vt)},[vt]),Object(ft.a)(function(){if(!wt&&bt>0){var Et=new Date().getTime(),Mt=window.sessionStorage.getItem(Nt);Et>=bt+nt&&(!Mt||Mt!==fn)&&(window.sessionStorage.setItem(Nt,fn),Dr(!0))}},nt),Object(E.useEffect)(function(){ln(jt)},[We,jt]),Object(E.useEffect)(function(){We&&(Rt&&We.focus())},[We,Rt]),Object(E.useEffect)(function(){if(Kr&&We){var Et=We.getScrollerElement();function Mt(At){var zt=At.target;if(zn.current){var $t=zt.scrollTop/zt.scrollHeight;zn.current.scrollTop=zn.current.scrollHeight*$t}}return Et.addEventListener("scroll",Mt),function(){Et.removeEventListener("scroll",Mt)}}},[We,Kr]),Object(E.useEffect)(function(){if(We&&Ht){function Et(Mt,At){Ht(Mt,At)}return We.on("beforeChange",Et),function(){We.off("beforeChange",Et)}}},[We,Ht]),Object(E.useEffect)(function(){if(We&&_t){function Et(){_t(We.getValue())}return We.on("blur",Et),function(){We.off("blur",Et)}}},[We,_t]),Object(E.useEffect)(function(){if(We){function Et(Mt){var At=Mt.getValue();zr(At),lt(new Date().getTime()),Mt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Fe&&Fe(At)}return We.on("change",Et),function(){We.off("change",Et)}}},[We,Fe]),Object(E.useEffect)(function(){We&&(Te==null?(We.setValue(""),zr("")):Te!==We.getValue()&&(We.setValue(Te),zr(Te),We.setCursor(We.lineCount(),0)))},[We,Te]);var Fi=Object(E.useCallback)(function(Et){var Mt=We.getCursor(),At=We.getSelection(),zt=At.split(`
|
|
`);switch(Et){case"bold":return We.replaceSelection("**"+At+"**"),At===""&&We.setCursor(Mt.line,Mt.ch+2),We.focus();case"italic":return We.replaceSelection("*"+At+"*"),At===""&&We.setCursor(Mt.line,Mt.ch+1),We.focus();case"code":return We.replaceSelection("`"+At+"`"),At===""&&We.setCursor(Mt.line,Mt.ch+1),We.focus();case"inline-latex":return We.replaceSelection("`$$"+At+"$$`"),At===""&&We.setCursor(Mt.line,Mt.ch+3),We.focus();case"latex":return We.replaceSelection("```latex\n"+At+"\n```"),We.setCursor(Mt.line+1,At.length+1),We.focus();case"line-break":return We.replaceSelection(`<br/>
|
|
`),We.focus();case"list-ul":return At===""?We.replaceSelection("- "+At):We.replaceSelection(zt.map(function($t){return $t===""?"":"- ".concat($t)}).join(`
|
|
`)),We.focus();case"list-ol":return At===""?We.replaceSelection("1. "+At):We.replaceSelection(zt.map(function($t,qt){return $t===""?"":"".concat(qt+1,". ").concat($t)}).join(`
|
|
`)),We.focus();case"add-null-ch":return At===""&&We.setCursor(Mt.line,Mt.ch+1),We.replaceSelection(oe),We.focus();case"inster-template-1":return At===""&&We.setCursor(Mt.line,Mt.ch),We.replaceSelection(J),We.focus();case"eraser":return We.setValue(""),We.focus();case"trigger-watch":return ln(!Kr),We.focus();case"trigger-full-screen":return Gn(!Vr),We.focus();case De:qe(De);return;case Ke:qe(Ke);return;case Pe:qe(Pe);return;case Xe:qe(Xe);return;default:throw new Error}},[We,Kr,Vr]),Kn=Object(E.useCallback)(function(Et){qe("");switch(br){case De:var Mt=Et.title,At=Et.link;return We.replaceSelection("[".concat(Mt,"](").concat(At,")")),We.focus();case Ke:var zt=Et.language,$t=Et.content;return We.replaceSelection(["```"+zt,$t,"```"].join(`
|
|
`)),We.focus();case Pe:var qt=Et.src,Yt=Et.alt;return Yt?We.replaceSelection(".concat(qt,' "').concat(Yt,'" )')):We.replaceSelection("")),We.focus();case Xe:for(var gr=Et.row,Ir=Et.col,Xt=Et.align,pn=`
|
|
`,Jt=0;Jt<gr;Jt++){for(var Nr=[],Rr=[],qr=0;qr<Ir;qr++)Jt===1&&Rr.push($e[Xt]),Nr.push(" ");Jt===1&&(pn+="| ".concat(Rr.join(" | "),` |
|
|
`)),pn+="| ".concat(Nr.join(Ir===1?"":" | "),` |
|
|
`)}return We.replaceSelection(pn+`
|
|
`),We.focus();default:throw new Error}},[We,br]),ui=Object(E.useMemo)(function(){switch(br){case De:return w.a.createElement(ge,{callback:Kn,onCancel:bn});case Ke:return w.a.createElement(be.b,{callback:Kn,onCancel:bn});case Pe:return w.a.createElement(ve,{callback:Kn,onCancel:bn});case Xe:return w.a.createElement(Ae,{callback:Kn,onCancel:bn});default:return null}},[br]);function bn(){qe("")}Object(E.useEffect)(function(){if(Yr.current){var Et=Yr.current,Mt=!1,At=0;function zt(Yt){Mt=!0,At=Yt.pageY}function $t(){Mt=!1}function qt(Yt){if(Mt){var gr=Yt.pageY-At;gr<0&&(gr=0),gr>300&&(gr=300);var Ir=Ge+gr+"px";rr(Ir)}}return Et.addEventListener("mousedown",zt),document.addEventListener("mousemove",qt),document.addEventListener("mouseup",$t),function(){Et.removeEventListener("mousedown",zt),document.removeEventListener("mousemove",qt),document.removeEventListener("mouseup",$t)}}},[We,Yr]),Object(E.useEffect)(function(){rr(Ge)},[Ge]);var un=Q(at),di=Q(tr),en={width:un,height:di},ci=Object(E.useMemo)(function(){if(bt){var Et=new Date(bt),Mt=Et.getHours(),At=Et.getMinutes(),zt=Et.getSeconds();return Mt=Mt<10?"0"+Mt:Mt,At=At<10?"0"+At:At,zt=zt<10?"0"+zt:zt,"".concat(Mt,":").concat(At,":").concat(zt)}return 0},[bt]);function ji(){window.sessionStorage.removeItem(Nt),Dr(!1),lt(0)}function Dn(){Dr(!1),lt(0),We.setValue(window.sessionStorage.getItem(Nt))}function ua(Et,Mt){var At=We.getValue();At=At.replace(Et,Mt),zr(At),We==null||We.setValue(At)}return w.a.createElement(E.Fragment,null,w.a.createElement("div",{className:"markdown-editor-wrapper",ref:Xr},w.a.createElement("div",{className:"markdown-editor-container ".concat(Be," ").concat(Kr?"on-preview":""," ").concat(Dt?"mini":""," ").concat(Vr?"full-screen":""),style:en},w.a.createElement(y,{insertTemp:xt,watch:Kr,fullScreen:Vr,showNullButton:rt,onActionCallback:Fi,hidetoolBar:St,uuid:fr.current,setOpenPhones:function(){Zr.current=!0}}),w.a.createElement("div",{className:"markdown-editor-body"},w.a.createElement("div",{className:"codemirror-container"},w.a.createElement("textarea",{ref:lr,placeholder:on})),Kr?w.a.createElement("div",{ref:zn,className:"preview-container"},Vt==="stex"&&w.a.createElement(l,{value:fn}),Vt!=="stex"&&w.a.createElement(f.a,{edit:!0,value:fn,replaces:ua})):null))),Bt?w.a.createElement("a",{ref:Yr,className:"editor-resize"}):null,w.a.createElement(M.a,null,ae[br]?w.a.createElement(Y.a,{centered:!0,title:ae[br],visible:!0,onCancel:bn,footer:null,className:"markdown-popup-form"},ui):null))}},PGNT:function(yt,it,se){yt.exports={wrap:"wrap___orWmH",modal:"modal___142IN",titleWrap:"titleWrap___2UWGN",required:"required___lXOtq",title:"title___2wqMf",colorGray:"colorGray___3FkLm",choiceWrap:"choiceWrap___3pbic",answer:"answer___30LSv",activeAnswer:"activeAnswer___3ayAN",deleteIcon:"deleteIcon___2HHly",addIcon:"addIcon___29vcx",editorWrap:"editorWrap___ANVP6",htmlWrap:"htmlWrap___38sLf",radio:"radio___15wok",color333:"color333___sNPjh",color999:"color999___1ofkl",fold:"fold___6rnoE",head:"head___2muph"}},PsQE:function(yt,it,se){yt.exports={flex_box_center:"flex_box_center___2PkN_",flex_space_between:"flex_space_between___36cDA",flex_box_vertical_center:"flex_box_vertical_center___2c88u",flex_box_center_end:"flex_box_center_end___14cXO",flex_box_column:"flex_box_column___3nalt",wrap:"wrap___3xZrs",left:"left___19hOK",title:"title___3Ti2k",total:"total___3MRC5",list:"list___3pdfL",name:"name___2IcTs",b:"b___2W0Sn",r:"r___2Tpj8",l:"l___1rMKQ",tag:"tag___jj2X5",right:"right___16831",examName:"examName___2TmgX",t:"t___1CJZd",num:"num___1qX6C",topWarp:"topWarp___3WuSr",head:"head___3z9Hq",so:"so___m2B6Z",btn:"btn___20VL7",content:"content___2tTuo",titleWrap:"titleWrap___1cYdQ",single:"single___1BKtz",analysis:"analysis___1qm4Y",text:"text___1JQUf",btnsElse:"btnsElse___2IzAs",btnsWrap:"btnsWrap___3ib37",btns:"btns___2DbBT",modalColumn:"modalColumn___1zs36",modalRow:"modalRow___14b2N",sup:"sup___1CIjI",popover:"popover___Mmcvb"}},"RZ/O":function(yt,it,se){yt.exports=se.p+"static/bi.9c9b0364.svg"},SJMd:function(yt,it){/**
|
|
* @license
|
|
* Copyright (C) 2006 Google Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var se,he,Y,L=!1,X,I;window.PR_SHOULD_USE_CONTINUATION=!0;var k,W;(function(){var F=window,O=["break,continue,do,else,for,if,return,while"],D=[O,"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"],E=[D,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],w=[E,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],P=[E,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],_=[E,"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="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",C=[E,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],c="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",o=[O,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],u=[O,"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"],d=[O,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],x=[w,_,P,C,c,o,u,d],v=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,f="str",l="kwd",b="com",h="typ",p="lit",s="pun",a="pln",g="tag",m="dec",y="src",M="atn",H="atv",V="nocode",te="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function G(ce){for(var Ee=0,Ae=!1,Oe=!1,Re=0,De=ce.length;Re<De;++Re){var Pe=ce[Re];if(Pe.ignoreCase)Oe=!0;else if(/[a-z]/i.test(Pe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Ae=!0,Oe=!1;break}}var Ke={b:8,t:9,n:10,v:11,f:12,r:13};function Xe(et){var ke=et.charCodeAt(0);if(ke!==92)return ke;var st=et.charAt(1);return ke=Ke[st],ke||("0"<=st&&st<="7"?parseInt(et.substring(1),8):st==="u"||st==="x"?parseInt(et.substring(2),16):et.charCodeAt(1))}function Ye(et){if(et<32)return(et<16?"\\x0":"\\x")+et.toString(16);var ke=String.fromCharCode(et);return ke==="\\"||ke==="-"||ke==="]"||ke==="^"?"\\"+ke:ke}function $e(et){var ke=et.substring(1,et.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),st=[],nt=ke[0]==="^",oe=["["];nt&&oe.push("^");for(var J=nt?1:0,Q=ke.length;J<Q;++J){var ne=ke[J];if(/\\[bdsw]/i.test(ne))oe.push(ne);else{var le=Xe(ne),q;J+2<Q&&ke[J+1]==="-"?(q=Xe(ke[J+2]),J+=2):q=le,st.push([le,q]),q<65||le>122||(q<65||le>90||st.push([Math.max(65,le)|32,Math.min(q,90)|32]),q<97||le>122||st.push([Math.max(97,le)&~32,Math.min(q,122)&~32]))}}st.sort(function(de,ye){return de[0]-ye[0]||ye[1]-de[1]});for(var ee=[],ae=[],J=0;J<st.length;++J){var ue=st[J];ue[0]<=ae[1]+1?ae[1]=Math.max(ae[1],ue[1]):ee.push(ae=ue)}for(var J=0;J<ee.length;++J){var ue=ee[J];oe.push(Ye(ue[0])),ue[1]>ue[0]&&(ue[1]+1>ue[0]&&oe.push("-"),oe.push(Ye(ue[1])))}return oe.push("]"),oe.join("")}function ft(et){for(var ke=et.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),st=ke.length,nt=[],oe=0,J=0;oe<st;++oe){var Q=ke[oe];if(Q==="(")++J;else if(Q.charAt(0)==="\\"){var ne=+Q.substring(1);ne&&(ne<=J?nt[ne]=-1:ke[oe]=Ye(ne))}}for(var oe=1;oe<nt.length;++oe)nt[oe]===-1&&(nt[oe]=++Ee);for(var oe=0,J=0;oe<st;++oe){var Q=ke[oe];if(Q==="(")++J,nt[J]||(ke[oe]="(?:");else if(Q.charAt(0)==="\\"){var ne=+Q.substring(1);ne&&ne<=J&&(ke[oe]="\\"+nt[ne])}}for(var oe=0;oe<st;++oe)ke[oe]==="^"&&ke[oe+1]!=="^"&&(ke[oe]="");if(et.ignoreCase&&Ae)for(var oe=0;oe<st;++oe){var Q=ke[oe],le=Q.charAt(0);Q.length>=2&&le==="["?ke[oe]=$e(Q):le!=="\\"&&(ke[oe]=Q.replace(/[a-zA-Z]/g,function(ae){var ue=ae.charCodeAt(0);return"["+String.fromCharCode(ue&~32,ue|32)+"]"}))}return ke.join("")}for(var Je=[],Re=0,De=ce.length;Re<De;++Re){var Pe=ce[Re];if(Pe.global||Pe.multiline)throw new Error(""+Pe);Je.push("(?:"+ft(Pe)+")")}return new RegExp(Je.join("|"),Oe?"gi":"g")}function j(ce,Ee){var Ae=/(?:^|\s)nocode(?:\s|$)/,Oe=[],Re=0,De=[],Pe=0;function Ke(Xe){var Ye=Xe.nodeType;if(Ye==1){if(Ae.test(Xe.className))return;for(var $e=Xe.firstChild;$e;$e=$e.nextSibling)Ke($e);var ft=Xe.nodeName.toLowerCase();(ft==="br"||ft==="li")&&(Oe[Pe]=`
|
|
`,De[Pe<<1]=Re++,De[Pe++<<1|1]=Xe)}else if(Ye==3||Ye==4){var Je=Xe.nodeValue;Je.length&&(Ee?Je=Je.replace(/\r\n?/g,`
|
|
`):Je=Je.replace(/[ \t\r\n]+/g," "),Oe[Pe]=Je,De[Pe<<1]=Re,Re+=Je.length,De[Pe++<<1|1]=Xe)}}return Ke(ce),{sourceCode:Oe.join("").replace(/\n$/,""),spans:De}}function ie(ce,Ee,Ae,Oe,Re){if(!Ae)return;var De={sourceNode:ce,pre:1,langExtension:null,numberLines:null,sourceCode:Ae,spans:null,basePos:Ee,decorations:null};Oe(De),Re.push.apply(Re,De.decorations)}var pe=/\S/;function ge(ce){for(var Ee=void 0,Ae=ce.firstChild;Ae;Ae=Ae.nextSibling){var Oe=Ae.nodeType;Ee=Oe===1?Ee?ce:Ae:Oe===3&&pe.test(Ae.nodeValue)?ce:Ee}return Ee===ce?void 0:Ee}function be(ce,Ee){var Ae={},Oe;(function(){for(var Pe=ce.concat(Ee),Ke=[],Xe={},Ye=0,$e=Pe.length;Ye<$e;++Ye){var ft=Pe[Ye],Je=ft[3];if(Je)for(var et=Je.length;--et>=0;)Ae[Je.charAt(et)]=ft;var ke=ft[1],st=""+ke;Xe.hasOwnProperty(st)||(Ke.push(ke),Xe[st]=null)}Ke.push(/[\0-\uffff]/),Oe=G(Ke)})();var Re=Ee.length,De=function(Pe){for(var Ke=Pe.sourceCode,Xe=Pe.basePos,Ye=Pe.sourceNode,$e=[Xe,a],ft=0,Je=Ke.match(Oe)||[],et={},ke=0,st=Je.length;ke<st;++ke){var nt=Je[ke],oe=et[nt],J=void 0,Q;if(typeof oe=="string")Q=!1;else{var ne=Ae[nt.charAt(0)];if(ne)J=nt.match(ne[1]),oe=ne[0];else{for(var le=0;le<Re;++le)if(ne=Ee[le],J=nt.match(ne[1]),J){oe=ne[0];break}J||(oe=a)}Q=oe.length>=5&&oe.substring(0,5)==="lang-",Q&&!(J&&typeof J[1]=="string")&&(Q=!1,oe=y),Q||(et[nt]=oe)}var q=ft;if(ft+=nt.length,!Q)$e.push(Xe+q,oe);else{var ee=J[1],ae=nt.indexOf(ee),ue=ae+ee.length;J[2]&&(ue=nt.length-J[2].length,ae=ue-ee.length);var de=oe.substring(5);ie(Ye,Xe+q,nt.substring(0,ae),De,$e),ie(Ye,Xe+q+ae,ee,N(de,ee),$e),ie(Ye,Xe+q+ue,nt.substring(ue),De,$e)}}Pe.decorations=$e};return De}function Ne(ce){var Ee=[],Ae=[];ce.tripleQuotedStrings?Ee.push([f,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ce.multiLineStrings?Ee.push([f,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Ee.push([f,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ce.verbatimStrings&&Ae.push([f,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Oe=ce.hashComments;Oe&&(ce.cStyleComments?(Oe>1?Ee.push([b,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Ee.push([b,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Ae.push([f,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Ee.push([b,/^#[^\r\n]*/,null,"#"])),ce.cStyleComments&&(Ae.push([b,/^\/\/[^\r\n]*/,null]),Ae.push([b,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Re=ce.regexLiterals;if(Re){var De=Re>1?"":`
|
|
\r`,Pe=De?".":"[\\S\\s]",Ke="/(?=[^/*"+De+"])(?:[^/\\x5B\\x5C"+De+"]|\\x5C"+Pe+"|\\x5B(?:[^\\x5C\\x5D"+De+"]|\\x5C"+Pe+")*(?:\\x5D|$))+/";Ae.push(["lang-regex",RegExp("^"+te+"("+Ke+")")])}var Xe=ce.types;Xe&&Ae.push([h,Xe]);var Ye=(""+ce.keywords).replace(/^ | $/g,"");Ye.length&&Ae.push([l,new RegExp("^(?:"+Ye.replace(/[\s,]+/g,"|")+")\\b"),null]),Ee.push([a,/^\s+/,null,` \r
|
|
\xA0`]);var $e="^.[^\\s\\w.$@'\"`/\\\\]*";return ce.regexLiterals&&($e+="(?!s*/)"),Ae.push([p,/^@[a-z_$][a-z_$@0-9]*/i,null],[h,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[p,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[s,new RegExp($e),null]),be(Ee,Ae)}var Se=Ne({keywords:x,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Me(ce,Ee,Ae){for(var Oe=/(?:^|\s)nocode(?:\s|$)/,Re=/\r\n?|\n/,De=ce.ownerDocument,Pe=De.createElement("li");ce.firstChild;)Pe.appendChild(ce.firstChild);var Ke=[Pe];function Xe(ke){var st=ke.nodeType;if(st==1&&!Oe.test(ke.className))if(ke.nodeName==="br")Ye(ke),ke.parentNode&&ke.parentNode.removeChild(ke);else for(var nt=ke.firstChild;nt;nt=nt.nextSibling)Xe(nt);else if((st==3||st==4)&&Ae){var oe=ke.nodeValue,J=oe.match(Re);if(J){var Q=oe.substring(0,J.index);ke.nodeValue=Q;var ne=oe.substring(J.index+J[0].length);if(ne){var le=ke.parentNode;le.insertBefore(De.createTextNode(ne),ke.nextSibling)}Ye(ke),Q||ke.parentNode.removeChild(ke)}}}function Ye(ke){for(;!ke.nextSibling;)if(ke=ke.parentNode,!ke)return;function st(J,Q){var ne=Q?J.cloneNode(!1):J,le=J.parentNode;if(le){var q=st(le,1),ee=J.nextSibling;q.appendChild(ne);for(var ae=ee;ae;ae=ee)ee=ae.nextSibling,q.appendChild(ae)}return ne}for(var nt=st(ke.nextSibling,0),oe;(oe=nt.parentNode)&&oe.nodeType===1;)nt=oe;Ke.push(nt)}for(var $e=0;$e<Ke.length;++$e)Xe(Ke[$e]);Ee===(Ee|0)&&Ke[0].setAttribute("value",Ee);var ft=De.createElement("ol");ft.className="linenums";for(var Je=Math.max(0,Ee-1|0)||0,$e=0,et=Ke.length;$e<et;++$e)Pe=Ke[$e],Pe.className="L"+($e+Je)%10,Pe.firstChild||Pe.appendChild(De.createTextNode("\xA0")),ft.appendChild(Pe);ce.appendChild(ft)}function Le(ce){var Ee=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Ee=Ee&&+Ee[1]<=8;var Ae=/\n/g,Oe=ce.sourceCode,Re=Oe.length,De=0,Pe=ce.spans,Ke=Pe.length,Xe=0,Ye=ce.decorations,$e=Ye.length,ft=0;Ye[$e]=Re;var Je,et;for(et=Je=0;et<$e;)Ye[et]!==Ye[et+2]?(Ye[Je++]=Ye[et++],Ye[Je++]=Ye[et++]):et+=2;for($e=Je,et=Je=0;et<$e;){for(var ke=Ye[et],st=Ye[et+1],nt=et+2;nt+2<=$e&&Ye[nt+1]===st;)nt+=2;Ye[Je++]=ke,Ye[Je++]=st,et=nt}$e=Ye.length=Je;var oe=ce.sourceNode,J="";oe&&(J=oe.style.display,oe.style.display="none");try{for(var Q=null;Xe<Ke;){var ne=Pe[Xe],le=Pe[Xe+2]||Re,q=Ye[ft+2]||Re,nt=Math.min(le,q),ee=Pe[Xe+1],ae;if(ee.nodeType!==1&&(ae=Oe.substring(De,nt))){Ee&&(ae=ae.replace(Ae,"\r")),ee.nodeValue=ae;var ue=ee.ownerDocument,de=ue.createElement("span");de.className=Ye[ft+1];var ye=ee.parentNode;ye.replaceChild(de,ee),de.appendChild(ee),De<le&&(Pe[Xe+1]=ee=ue.createTextNode(Oe.substring(nt,le)),ye.insertBefore(ee,de.nextSibling))}De=nt,De>=le&&(Xe+=2),De>=q&&(ft+=2)}}finally{oe&&(oe.style.display=J)}}var we={};function ve(ce,Ee){for(var Ae=Ee.length;--Ae>=0;){var Oe=Ee[Ae];we.hasOwnProperty(Oe)?F.console&&console.warn("cannot override language handler %s",Oe):we[Oe]=ce}}function N(ce,Ee){return ce&&we.hasOwnProperty(ce)||(ce=/^\s*</.test(Ee)?"default-markup":"default-code"),we[ce]}ve(Se,["default-code"]),ve(be([],[[a,/^[^<?]+/],[m,/^<!\w[^>]*(?:>|$)/],[b,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[s,/^(?:<[%?]|[%?]>)/],["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"]),ve(be([[a,/^[\s]+/,null,` \r
|
|
`],[H,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[g,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[M,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[s,/^[=<>\/]+/],["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"]),ve(be([],[[H,/^[\s\S]+/]]),["uq.val"]),ve(Ne({keywords:w,hashComments:!0,cStyleComments:!0,types:v}),["c","cc","cpp","cxx","cyc","m"]),ve(Ne({keywords:"null,true,false"}),["json"]),ve(Ne({keywords:_,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:v}),["cs"]),ve(Ne({keywords:P,cStyleComments:!0}),["java"]),ve(Ne({keywords:d,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ve(Ne({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ve(Ne({keywords:c,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ve(Ne({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ve(Ne({keywords:C,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ve(Ne({keywords:A,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ve(be([],[[f,/^[\s\S]+/]]),["regex"]);function T(ce){var Ee=ce.langExtension;try{var Ae=j(ce.sourceNode,ce.pre),Oe=Ae.sourceCode;ce.sourceCode=Oe,ce.spans=Ae.spans,ce.basePos=0,N(Ee,Oe)(ce),Le(ce)}catch(Re){F.console&&console.log(Re&&Re.stack||Re)}}function R(ce,Ee,Ae){var Oe=Ae||!1,Re=Ee||null,De=document.createElement("div");De.innerHTML="<pre>"+ce+"</pre>",De=De.firstChild,Oe&&Me(De,Oe,!0);var Pe={langExtension:Re,numberLines:Oe,sourceNode:De,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return T(Pe),De.innerHTML}function z(ce,Ee){var Ae=Ee||document.body,Oe=Ae.ownerDocument||document;function Re(ne){return Ae.getElementsByTagName(ne)}for(var De=[Re("pre"),Re("code"),Re("xmp")],Pe=[],Ke=0;Ke<De.length;++Ke)for(var Xe=0,Ye=De[Ke].length;Xe<Ye;++Xe)Pe.push(De[Ke][Xe]);De=null;var $e=Date;$e.now||($e={now:function(){return+new Date}});var ft=0,Je=/\blang(?:uage)?-([\w.]+)(?!\S)/,et=/\bprettyprint\b/,ke=/\bprettyprinted\b/,st=/pre|xmp/i,nt=/^code$/i,oe=/^(?:pre|code|xmp)$/i,J={};function Q(){for(var ne=F.PR_SHOULD_USE_CONTINUATION?$e.now()+250:Infinity;ft<Pe.length&&$e.now()<ne;ft++){for(var le=Pe[ft],q=J,ee=le;ee=ee.previousSibling;){var ae=ee.nodeType,ue=(ae===7||ae===8)&&ee.nodeValue;if(ue?!/^\??prettify\b/.test(ue):ae!==3||/\S/.test(ee.nodeValue))break;if(ue){q={},ue.replace(/\b(\w+)=([\w:.%+-]+)/g,function(jt,xt,Kt){q[xt]=Kt});break}}var de=le.className;if((q!==J||et.test(de))&&!ke.test(de)){for(var ye=!1,Te=le.parentNode;Te;Te=Te.parentNode){var Fe=Te.tagName;if(oe.test(Fe)&&Te.className&&et.test(Te.className)){ye=!0;break}}if(!ye){le.className+=" prettyprinted";var He=q.lang;if(!He){He=de.match(Je);var at;!He&&(at=ge(le))&&nt.test(at.tagName)&&(He=at.className.match(Je)),He&&(He=He[1])}var Lt;if(st.test(le.tagName))Lt=1;else{var Ge=le.currentStyle,tt=Oe.defaultView,Dt=Ge?Ge.whiteSpace:tt&&tt.getComputedStyle?tt.getComputedStyle(le,null).getPropertyValue("white-space"):0;Lt=Dt&&Dt.substring(0,3)==="pre"}var ct=q.linenums;(ct=ct==="true"||+ct)||(ct=de.match(/\blinenums\b(?::(\d+))?/),ct=ct?ct[1]&&ct[1].length?+ct[1]:!0:!1),ct&&Me(le,ct,Lt);var Rt={langExtension:He,sourceNode:le,numberLines:ct,pre:Lt,sourceCode:null,basePos:null,spans:null,decorations:null};T(Rt)}}}ft<Pe.length?F.setTimeout(Q,250):typeof ce=="function"&&ce()}Q()}var Z=F.PR={createSimpleLexer:be,registerLangHandler:ve,sourceDecorator:Ne,PR_ATTRIB_NAME:M,PR_ATTRIB_VALUE:H,PR_COMMENT:b,PR_DECLARATION:m,PR_KEYWORD:l,PR_LITERAL:p,PR_NOCODE:V,PR_PLAIN:a,PR_PUNCTUATION:s,PR_SOURCE:y,PR_STRING:f,PR_TAG:g,PR_TYPE:h,prettyPrintOne:L?F.prettyPrintOne=R:k=R,prettyPrint:W=L?F.prettyPrint=z:W=z},B=F.define;typeof B=="function"&&B.amd&&B("google-code-prettify",[],function(){return Z})})()},STEk:function(yt,it,se){"use strict";se.d(it,"a",function(){return ve});/*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var he=function(N,T){return(he=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(R,z){R.__proto__=z}||function(R,z){for(var Z in z)Object.prototype.hasOwnProperty.call(z,Z)&&(R[Z]=z[Z])})(N,T)};function Y(N,T){function R(){this.constructor=N}he(N,T),N.prototype=T===null?Object.create(T):(R.prototype=T.prototype,new R)}function L(N,T,R,z){return new(R||(R=Promise))(function(Z,B){function ce(Oe){try{Ae(z.next(Oe))}catch(Re){B(Re)}}function Ee(Oe){try{Ae(z.throw(Oe))}catch(Re){B(Re)}}function Ae(Oe){var Re;Oe.done?Z(Oe.value):(Re=Oe.value,Re instanceof R?Re:new R(function(De){De(Re)})).then(ce,Ee)}Ae((z=z.apply(N,T||[])).next())})}function X(N,T){var R,z,Z,B,ce={label:0,sent:function(){if(1&Z[0])throw Z[1];return Z[1]},trys:[],ops:[]};return B={next:Ee(0),throw:Ee(1),return:Ee(2)},typeof Symbol=="function"&&(B[Symbol.iterator]=function(){return this}),B;function Ee(Ae){return function(Oe){return function(Re){if(R)throw new TypeError("Generator is already executing.");for(;ce;)try{if(R=1,z&&(Z=2&Re[0]?z.return:Re[0]?z.throw||((Z=z.return)&&Z.call(z),0):z.next)&&!(Z=Z.call(z,Re[1])).done)return Z;switch(z=0,Z&&(Re=[2&Re[0],Z.value]),Re[0]){case 0:case 1:Z=Re;break;case 4:return ce.label++,{value:Re[1],done:!1};case 5:ce.label++,z=Re[1],Re=[0];continue;case 7:Re=ce.ops.pop(),ce.trys.pop();continue;default:if(!(Z=ce.trys,(Z=Z.length>0&&Z[Z.length-1])||Re[0]!==6&&Re[0]!==2)){ce=0;continue}if(Re[0]===3&&(!Z||Re[1]>Z[0]&&Re[1]<Z[3])){ce.label=Re[1];break}if(Re[0]===6&&ce.label<Z[1]){ce.label=Z[1],Z=Re;break}if(Z&&ce.label<Z[2]){ce.label=Z[2],ce.ops.push(Re);break}Z[2]&&ce.ops.pop(),ce.trys.pop();continue}Re=T.call(N,ce)}catch(De){Re=[6,De],z=0}finally{R=Z=0}if(5&Re[0])throw Re[1];return{value:Re[0]?Re[1]:void 0,done:!0}}([Ae,Oe])}}}function I(){for(var N=0,T=0,R=arguments.length;T<R;T++)N+=arguments[T].length;var z=Array(N),Z=0;for(T=0;T<R;T++)for(var B=arguments[T],ce=0,Ee=B.length;ce<Ee;ce++,Z++)z[Z]=B[ce];return z}var k=function(){function N(){}return N.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},N.setAttributes=function(T,R){for(var z=0,Z=R;z<Z.length;z++){var B=Z[z],ce=B[0],Ee=B[1];T.setAttribute(ce,Ee)}},N.createRect=function(T,R,z){var Z=document.createElementNS("http://www.w3.org/2000/svg","rect");return Z.setAttribute("width",T.toString()),Z.setAttribute("height",R.toString()),z&&N.setAttributes(Z,z),Z},N.createLine=function(T,R,z,Z,B){var ce=document.createElementNS("http://www.w3.org/2000/svg","line");return ce.setAttribute("x1",T.toString()),ce.setAttribute("y1",R.toString()),ce.setAttribute("x2",z.toString()),ce.setAttribute("y2",Z.toString()),B&&N.setAttributes(ce,B),ce},N.createPolygon=function(T,R){var z=document.createElementNS("http://www.w3.org/2000/svg","polygon");return z.setAttribute("points",T),R&&N.setAttributes(z,R),z},N.createCircle=function(T,R){var z=document.createElementNS("http://www.w3.org/2000/svg","circle");return z.setAttribute("cx",(T/2).toString()),z.setAttribute("cy",(T/2).toString()),z.setAttribute("r",T.toString()),R&&N.setAttributes(z,R),z},N.createEllipse=function(T,R,z){var Z=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Z.setAttribute("cx",(T/2).toString()),Z.setAttribute("cy",(R/2).toString()),Z.setAttribute("rx",(T/2).toString()),Z.setAttribute("ry",(R/2).toString()),z&&N.setAttributes(Z,z),Z},N.createGroup=function(T){var R=document.createElementNS("http://www.w3.org/2000/svg","g");return T&&N.setAttributes(R,T),R},N.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},N.createMarker=function(T,R,z,Z,B,ce,Ee){var Ae=document.createElementNS("http://www.w3.org/2000/svg","marker");return N.setAttributes(Ae,[["id",T],["orient",R],["markerWidth",z.toString()],["markerHeight",Z.toString()],["refX",B.toString()],["refY",ce.toString()]]),Ae.appendChild(Ee),Ae},N.createText=function(T){var R=document.createElementNS("http://www.w3.org/2000/svg","text");return R.setAttribute("x","0"),R.setAttribute("y","0"),T&&N.setAttributes(R,T),R},N.createTSpan=function(T,R){var z=document.createElementNS("http://www.w3.org/2000/svg","tspan");return z.textContent=T,R&&N.setAttributes(z,R),z},N.createImage=function(T){var R=document.createElementNS("http://www.w3.org/2000/svg","image");return T&&N.setAttributes(R,T),R},N.createPoint=function(T,R){var z=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return z.x=T,z.y=R,z},N.createPath=function(T,R){var z=document.createElementNS("http://www.w3.org/2000/svg","path");return z.setAttribute("d",T),R&&N.setAttributes(z,R),z},N}(),W=function(){function N(){}return N.addKey=function(T){N.key=T},Object.defineProperty(N,"isLicensed",{get:function(){return!!N.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(N.key)},enumerable:!1,configurable:!0}),N}(),F=function(){function N(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return N.prototype.rasterize=function(T,R,z){var Z=this;return new Promise(function(B){var ce=z!==void 0?z:document.createElement("canvas");T===null&&(Z.markersOnly=!0,Z.naturalSize=!1);var Ee=document.createElementNS("http://www.w3.org/2000/svg","svg");Ee.setAttribute("xmlns","http://www.w3.org/2000/svg"),Ee.setAttribute("width",R.width.baseVal.valueAsString),Ee.setAttribute("height",R.height.baseVal.valueAsString),Ee.setAttribute("viewBox","0 0 "+R.viewBox.baseVal.width.toString()+" "+R.viewBox.baseVal.height.toString()),Ee.innerHTML=R.innerHTML,Z.naturalSize===!0?(Ee.width.baseVal.value=T.naturalWidth,Ee.height.baseVal.value=T.naturalHeight):Z.width!==void 0&&Z.height!==void 0&&(Ee.width.baseVal.value=Z.width,Ee.height.baseVal.value=Z.height),ce.width=Ee.width.baseVal.value,ce.height=Ee.height.baseVal.value;var Ae=Ee.outerHTML,Oe=ce.getContext("2d");Z.markersOnly!==!0&&Oe.drawImage(T,0,0,ce.width,ce.height);var Re=window.URL,De=new Image(ce.width,ce.height);De.setAttribute("crossOrigin","anonymous");var Pe=new Blob([Ae],{type:"image/svg+xml"}),Ke=Re.createObjectURL(Pe);De.onload=function(){Oe.drawImage(De,0,0),Re.revokeObjectURL(Ke);var Xe=ce.toDataURL(Z.imageType,Z.imageQuality);B(Xe)},De.src=Ke})},N}(),O=function(){},D=function(){function N(T){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+T+"_"}return Object.defineProperty(N.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(N.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(N.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),N.prototype.addClass=function(T){return this.styleSheet===void 0&&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},N.prototype.addRule=function(T){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(T),this.styleSheet.sheet.insertRule(T.selector+" {"+T.style+"}",this.styleSheet.sheet.cssRules.length)},N.prototype.addStyleSheet=function(){var T;this.styleSheet=document.createElement("style"),((T=this.styleSheetRoot)!==null&&T!==void 0?T:document.head).appendChild(this.styleSheet),this.addRule(new E("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new E("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new E("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new w("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new w("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},N.prototype.removeStyleSheet=function(){var T;this.styleSheet&&(((T=this.styleSheetRoot)!==null&&T!==void 0?T:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},N}(),E=function(N,T){this.selector=N,this.style=T},w=function(N,T){this.localName=N,this.style=T},P=function(){function N(T,R,z,Z,B){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=T,this.displayMode=R,this.markerItems=z,this.uiStyleSettings=Z,this.styles=B,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return N.prototype.show=function(T){var R=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 z=document.createElement("div");z.className=this.toolbarBlockStyleClass.name,z.style.whiteSpace="nowrap",this.uiContainer.appendChild(z),this.addActionButton(z,'<svg viewBox="0 0 24 24"><path d="M10.07 14.27a.997.997 0 011.33.48l2.3 4.99 1.8-.85-2.31-4.98c-.24-.5-.02-1.1.48-1.33l.28-.08 2.3-.45L8 5.12V15.9l1.82-1.47.25-.16m3.57 7.7a.99.99 0 01-1.33-.47l-2.18-4.74-2.51 2.02c-.17.14-.38.22-.62.22a1 1 0 01-1-1V3a1 1 0 011-1c.24 0 .47.09.64.23l.01-.01 11.49 9.64a1.001 1.001 0 01-.44 1.75l-3.16.62 2.2 4.73c.26.5.02 1.09-.48 1.32l-3.62 1.69z"/></svg>',"select"),this.addActionButton(z,'<svg viewBox="0 0 24 24"><path d="M9 3v1H4v2h1v13a2 2 0 002 2h10a2 2 0 002-2V6h1V4h-5V3H9M7 6h10v13H7V6m2 2v9h2V8H9m4 0v9h2V8h-2z"/></svg>',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(z,'<svg viewBox="0 0 24 24"><path d="M19.36 2.72l1.42 1.42-5.72 5.71c1.07 1.54 1.22 3.39.32 4.59L9.06 8.12c1.2-.9 3.05-.75 4.59.32l5.71-5.72M5.93 17.57c-2.01-2.01-3.24-4.41-3.58-6.65l4.88-2.09 7.44 7.44-2.09 4.88c-2.24-.34-4.64-1.57-6.65-3.58z"/></svg>',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(z,'<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(z,'<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 017.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(z,'<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(z,'<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 009.5 3 6.5 6.5 0 003 9.5 6.5 6.5 0 009.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5 1.5-1.5-5-5m-6 0C7 14 5 12 5 9.5S7 5 9.5 5 14 7 14 9.5 12 14 9.5 14M7 9h5v1H7V9z"/></svg>',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(z,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(B){var ce=document.createElement("div");ce.className=""+R.toolbarButtonStyleClass.name,ce.setAttribute("data-type-name",B.typeName),ce.innerHTML=B.icon,ce.addEventListener("click",function(){R.markerToolbarButtonClicked(ce,B)}),R.buttons.push(ce),R.markerButtons.push(ce)}),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 Z=document.createElement("div");Z.className=this.toolbarBlockStyleClass.name,Z.style.whiteSpace="nowrap",Z.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(Z),this.addActionButton(Z,'<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(Z,'<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()},N.prototype.addButtonClickListener=function(T){this.buttonClickListeners.push(T)},N.prototype.removeButtonClickListener=function(T){this.buttonClickListeners.indexOf(T)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(T),1)},N.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},N.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 R=0;R<this.markerButtons.length;R++)R<T||R===T&&this.markerButtons.length-1===T?this.markerButtonBlock.appendChild(this.markerButtons[R]):(R===T&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[R]))}},N.prototype.overflowButtonClicked=function(){this.markerButtonOverflowBlock.style.display!=="none"?(this.markerButtonOverflowBlock.className=this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName,""),this.markerButtonOverflowBlock.style.display="none"):(this.markerButtonOverflowBlock.className+=" "+this.styles.fadeInAnimationClassName,this.markerButtonOverflowBlock.style.top=this.uiContainer.offsetTop+this.overflowButton.offsetHeight+"px",this.markerButtonOverflowBlock.style.right=this.uiContainer.offsetWidth-this.overflowButton.offsetLeft-this.overflowButton.offsetWidth+2*this.uiContainer.offsetLeft+"px",this.markerButtonOverflowBlock.style.display="inline-block")},N.prototype.resetButtonStyles=function(){var T=this;this.buttons.forEach(function(R){R.className=R.className.replace(T.uiStyleSettings.toolbarButtonStyleColorsClassName?T.uiStyleSettings.toolbarButtonStyleColorsClassName:T.toolbarButtonStyleColorsClass.name,"").trim(),R.className=R.className.replace(T.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?T.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:T.toolbarActiveButtonStyleColorsClass.name,"").trim(),R.className+=" "+(T.uiStyleSettings.toolbarButtonStyleColorsClassName?T.uiStyleSettings.toolbarButtonStyleColorsClassName:T.toolbarButtonStyleColorsClass.name)})},N.prototype.addActionButton=function(T,R,z){var Z=this,B=document.createElement("div");switch(B.className=""+this.toolbarButtonStyleClass.name,B.innerHTML=R,B.setAttribute("data-action",z),B.addEventListener("click",function(){Z.actionToolbarButtonClicked(B,z)}),z){case"select":B.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":B.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":B.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":B.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":B.style.fill=this.uiStyleSettings.closeButtonColor}T.appendChild(B),this.buttons.push(B)},N.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new w("toolbar",`
|
|
width: 100%;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
height: `+this.uiStyleSettings.toolbarHeight+`px;
|
|
box-sizing: content-box;
|
|
`+(this.displayMode==="inline"?"border-top-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
`+(this.displayMode==="inline"?"border-top-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
overflow: hidden;
|
|
`)),this.toolbarStyleColorsClass=this.styles.addClass(new w("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new w("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new w("toolbar-overflow-block",`
|
|
position: absolute;
|
|
top: `+this.uiStyleSettings.toolbarHeight+`px;
|
|
max-width: `+2*this.uiStyleSettings.toolbarHeight+`px;
|
|
z-index: 10;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleColorsClass=this.styles.addClass(new w("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var T=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new w("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*T)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*T)+`px;
|
|
padding: `+T+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new w("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new w("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new E("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new E("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},N.prototype.markerToolbarButtonClicked=function(T,R){this.setActiveButton(T),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(z){return z("marker",R)}),this.markerButtonOverflowBlock.style.display="none"},N.prototype.actionToolbarButtonClicked=function(T,R){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(z){return z("action",R)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},N.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)},N.prototype.setActiveMarkerButton=function(T){var R=this.markerButtons.find(function(z){return z.getAttribute("data-type-name")===T});R&&this.setActiveButton(R)},N.prototype.setCurrentMarker=function(T){var R=this;this.currentMarker=T,this.buttons.filter(function(z){return/delete|notes/.test(z.getAttribute("data-action"))}).forEach(function(z){R.currentMarker===void 0?(z.style.fillOpacity="0.4",z.style.pointerEvents="none"):(z.style.fillOpacity="1",z.style.pointerEvents="all")})},N}(),_=function(){function N(T,R,z,Z){this.panels=[],this.panelButtons=[],this.markerjsContainer=T,this.displayMode=R,this.uiStyleSettings=z,this.styles=Z,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return N.prototype.addStyles=function(){var T;this.toolboxStyleClass=this.styles.addClass(new w("toolbox",`
|
|
width: 100%;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
font-family: sans-serif;
|
|
`+(this.displayMode==="popup"?"height:"+2.5*this.uiStyleSettings.toolbarHeight+"px;":"")+`
|
|
box-sizing: content-box;
|
|
`+(this.displayMode==="popup"?"background-color: "+this.uiStyleSettings.canvasBackgroundColor+";":"")+`
|
|
`+(this.displayMode==="inline"?"border-bottom-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
`+(this.displayMode==="inline"?"border-bottom-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
overflow: hidden;
|
|
`)),this.toolboxStyleColorsClass=this.styles.addClass(new w("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var R=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new w("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new w("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new w("toolbox-panel-row",`
|
|
display: flex;
|
|
`+(this.displayMode==="inline"?"position: absolute;":"")+`
|
|
`+(this.displayMode==="inline"?"bottom: "+this.uiStyleSettings.toolbarHeight+"px;":"")+`
|
|
cursor: default;
|
|
height: `+1.5*this.uiStyleSettings.toolbarHeight+`px;
|
|
`+(this.displayMode==="inline"?"width: 100%;":"")+`
|
|
box-sizing: content-box;
|
|
`)),this.toolboxPanelRowStyleColorsClass=this.styles.addClass(new w("toolbox-panel-row_colors",`
|
|
background-color: `+((T=this.uiStyleSettings.toolboxBackgroundColor)!==null&&T!==void 0?T:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new w("toolbox_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*R)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*R)+`px;
|
|
padding: `+R+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new w("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new w("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new E("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new E("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},N.prototype.show=function(T){var R;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=T,this.uiContainer.className=this.toolboxStyleClass.name+" "+((R=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&R!==void 0?R:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},N.prototype.setPanelButtons=function(T){var R,z,Z=this;this.panels=T,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((R=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&R!==void 0?R:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((z=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&z!==void 0?z:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(B){var ce;B.uiStyleSettings=Z.uiStyleSettings;var Ee=document.createElement("div");Ee.className=Z.toolboxButtonStyleClass.name+" "+((ce=Z.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ce!==void 0?ce:Z.toolboxButtonStyleColorsClass.name),Ee.innerHTML=B.icon,Ee.title=B.title,Ee.addEventListener("click",function(){Z.panelButtonClick(B)}),Z.panelButtons.push(Ee),Z.buttonRow.appendChild(Ee)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},N.prototype.panelButtonClick=function(T){var R=this,z=-1;if(T!==this.activePanel){z=this.panels.indexOf(T),this.panelRow.innerHTML="";var Z=T.getUi();Z.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(Z),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(){R.displayMode==="inline"?R.panelRow.style.display="none":R.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(B,ce){var Ee,Ae;B.className=R.toolboxButtonStyleClass.name+" "+(ce===z?""+((Ee=R.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Ee!==void 0?Ee:R.toolboxActiveButtonStyleColorsClass.name):""+((Ae=R.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Ae!==void 0?Ae:R.toolboxButtonStyleColorsClass.name))})},N}(),A=function(N,T){this.title=N,this.icon=T},C=function(N){function T(R,z,Z,B){var ce=N.call(this,R,B||'<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 ce.colors=[],ce.addTransparent=!1,ce.colorBoxes=[],ce.colors=z,ce.currentColor=Z,ce.setCurrentColor=ce.setCurrentColor.bind(ce),ce.getColorBox=ce.getColorBox.bind(ce),ce}return Y(T,N),T.prototype.getUi=function(){var R=this,z=document.createElement("div");return z.style.overflow="hidden",z.style.whiteSpace="nowrap",this.colors.forEach(function(Z){var B=R.getColorBox(Z);z.appendChild(B),R.colorBoxes.push(B)}),z},T.prototype.getColorBox=function(R){var z=this,Z=this.uiStyleSettings.toolbarHeight/4,B=this.uiStyleSettings.toolbarHeight-Z,ce=document.createElement("div");ce.style.display="inline-block",ce.style.boxSizing="content-box",ce.style.width=B-2+"px",ce.style.height=B-2+"px",ce.style.padding="1px",ce.style.marginRight="2px",ce.style.marginBottom="2px",ce.style.borderWidth="2px",ce.style.borderStyle="solid",ce.style.borderRadius=(B+2)/2+"px",ce.style.borderColor=R===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ce.addEventListener("click",function(){z.setCurrentColor(R,ce)});var Ee=document.createElement("div");return Ee.style.display="inline-block",Ee.style.width=B-2+"px",Ee.style.height=B-2+"px",Ee.style.backgroundColor=R,Ee.style.borderRadius=B/2+"px",R==="transparent"&&(Ee.style.fill=this.uiStyleSettings.toolboxAccentColor,Ee.innerHTML=`<svg viewBox="0 0 24 24">
|
|
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
|
|
</svg>`),ce.appendChild(Ee),ce},T.prototype.setCurrentColor=function(R,z){var Z=this;this.currentColor=R,this.colorBoxes.forEach(function(B){B.style.borderColor=B===z?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(R)},T}(A),c=function(){function N(T,R,z){this._state="new",this._isSelected=!1,this._container=T,this._overlayContainer=R,this.globalSettings=z,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(N.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),N.prototype.ownsTarget=function(T){return!1},Object.defineProperty(N.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),N.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},N.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},N.prototype.pointerDown=function(T,R){},N.prototype.dblClick=function(T,R){},N.prototype.manipulate=function(T){},N.prototype.pointerUp=function(T){this.stateChanged()},N.prototype.dispose=function(){},N.prototype.addMarkerVisualToContainer=function(T){this.container.childNodes.length>0?this.container.insertBefore(T,this.container.childNodes[0]):this.container.appendChild(T)},N.prototype.getState=function(){return{typeName:N.typeName,state:this.state,notes:this.notes}},N.prototype.restoreState=function(T){this._state=T.state,this.notes=T.notes},N.prototype.scale=function(T,R){},N.prototype.colorChanged=function(T){this.onColorChanged&&this.onColorChanged(T),this.stateChanged()},N.prototype.fillColorChanged=function(T){this.onFillColorChanged&&this.onFillColorChanged(T),this.stateChanged()},N.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var T=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),T.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(T)&&this.onStateChanged(this)}},N.typeName="MarkerBase",N}(),o=function(){function N(){this.findGripByVisual=this.findGripByVisual.bind(this)}return N.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},N}(),u=function(){function N(){this.GRIP_SIZE=10,this.visual=k.createGroup(),this.visual.appendChild(k.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(k.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return N.prototype.ownsTarget=function(T){return T===this.visual||T===this.visual.childNodes[0]||T===this.visual.childNodes[1]},N}(),d=function(){function N(){}return N.toITransformMatrix=function(T){return{a:T.a,b:T.b,c:T.c,d:T.d,e:T.e,f:T.f}},N.toSVGMatrix=function(T,R){return T.a=R.a,T.b=R.b,T.c=R.c,T.d=R.d,T.e=R.e,T.f=R.f,T},N}(),x=function(N){function T(R,z,Z){var B=N.call(this,R,z,Z)||this;return B.left=0,B.top=0,B.width=0,B.height=0,B.defaultSize={x:50,y:20},B.offsetX=0,B.offsetY=0,B.rotationAngle=0,B.CB_DISTANCE=10,B._suppressMarkerCreateEvent=!1,B.container.transform.baseVal.appendItem(k.createTransform()),B.setupControlBox(),B}return Y(T,N),Object.defineProperty(T.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"visual",{get:function(){return this._visual},set:function(R){this._visual=R;var z=k.createTransform();this._visual.transform.baseVal.appendItem(z)},enumerable:!1,configurable:!0}),T.prototype.ownsTarget=function(R){return!!N.prototype.ownsTarget.call(this,R)||!!(this.controlGrips.findGripByVisual(R)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(R))},T.prototype.pointerDown=function(R,z){N.prototype.pointerDown.call(this,R,z),this.state==="new"&&(this.left=R.x,this.top=R.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var Z=this.unrotatePoint(R);if(this.manipulationStartX=Z.x,this.manipulationStartY=Z.y,this.offsetX=Z.x-this.left,this.offsetY=Z.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(z),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(z)){this.activeGrip=this.rotatorGrip;var B=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=B.x-this.width/2,this.top=B.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ce=this.container.transform.baseVal.getItem(0);ce.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ce,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},T.prototype.pointerUp=function(R){var z=this.state;N.prototype.pointerUp.call(this,R),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(R),this._state="select",z==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},T.prototype.moveVisual=function(R){this.visual.style.transform="translate("+R.x+"px, "+R.y+"px)"},T.prototype.manipulate=function(R){var z=this.unrotatePoint(R);this.state==="creating"?this.resize(R):this.state==="move"?(this.left=this.manipulationStartLeft+(z.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(z.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(z):this.state==="rotate"&&this.rotate(R)},T.prototype.resize=function(R){var z=this.manipulationStartLeft,Z=this.manipulationStartWidth,B=this.manipulationStartTop,ce=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:z=this.manipulationStartLeft+R.x-this.manipulationStartX,Z=this.manipulationStartWidth+this.manipulationStartLeft-z;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:Z=this.manipulationStartWidth+R.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:B=this.manipulationStartTop+R.y-this.manipulationStartY,ce=this.manipulationStartHeight+this.manipulationStartTop-B;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ce=this.manipulationStartHeight+R.y-this.manipulationStartY}Z>=0?(this.left=z,this.width=Z):(this.left=z+Z,this.width=-Z),ce>=0?(this.top=B,this.height=ce):(this.top=B+ce,this.height=-ce),this.setSize()},T.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},T.prototype.rotate=function(R){if(Math.abs(R.x-this.centerX)>.1){var z=Math.sign(R.x-this.centerX);this.rotationAngle=180*Math.atan((R.y-this.centerY)/(R.x-this.centerX))/Math.PI+90*z,this.applyRotation()}},T.prototype.applyRotation=function(){var R=this.container.transform.baseVal.getItem(0);R.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(R,0)},T.prototype.rotatePoint=function(R){if(this.rotationAngle===0)return R;var z=this.container.getCTM(),Z=k.createPoint(R.x,R.y);return{x:(Z=Z.matrixTransform(z)).x,y:Z.y}},T.prototype.unrotatePoint=function(R){if(this.rotationAngle===0)return R;var z=this.container.getCTM();z=z.inverse();var Z=k.createPoint(R.x,R.y);return{x:(Z=Z.matrixTransform(z)).x,y:Z.y}},T.prototype.select=function(){N.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},T.prototype.deselect=function(){N.prototype.deselect.call(this),this.controlBox.style.display="none"},T.prototype.setupControlBox=function(){this.controlBox=k.createGroup();var R=k.createTransform();R.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(R),this.container.appendChild(this.controlBox),this.controlRect=k.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),this.globalSettings.disableRotation!==!0&&(this.rotatorGripLine=k.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 o,this.addControlGrips(),this.controlBox.style.display="none"},T.prototype.adjustControlBox=function(){var R=this.controlBox.transform.baseVal.getItem(0);R.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(R,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},T.prototype.addControlGrips=function(){this.controlGrips.topLeft=this.createGrip(),this.controlGrips.topCenter=this.createGrip(),this.controlGrips.topRight=this.createGrip(),this.controlGrips.centerLeft=this.createGrip(),this.controlGrips.centerRight=this.createGrip(),this.controlGrips.bottomLeft=this.createGrip(),this.controlGrips.bottomCenter=this.createGrip(),this.controlGrips.bottomRight=this.createGrip(),this.globalSettings.disableRotation!==!0&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},T.prototype.createGrip=function(){var R=new u;return R.visual.transform.baseVal.appendItem(k.createTransform()),this.controlBox.appendChild(R.visual),R},T.prototype.positionGrips=function(){var R=this.controlGrips.topLeft.GRIP_SIZE,z=-R/2,Z=z,B=(this.width+this.CB_DISTANCE)/2-R/2,ce=(this.height+this.CB_DISTANCE)/2-R/2,Ee=this.height+this.CB_DISTANCE-R/2,Ae=this.width+this.CB_DISTANCE-R/2;this.positionGrip(this.controlGrips.topLeft.visual,z,Z),this.positionGrip(this.controlGrips.topCenter.visual,B,Z),this.positionGrip(this.controlGrips.topRight.visual,Ae,Z),this.positionGrip(this.controlGrips.centerLeft.visual,z,ce),this.positionGrip(this.controlGrips.centerRight.visual,Ae,ce),this.positionGrip(this.controlGrips.bottomLeft.visual,z,Ee),this.positionGrip(this.controlGrips.bottomCenter.visual,B,Ee),this.positionGrip(this.controlGrips.bottomRight.visual,Ae,Ee),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,B,Z-3*this.CB_DISTANCE)},T.prototype.positionGrip=function(R,z,Z){var B=R.transform.baseVal.getItem(0);B.setTranslate(z,Z),R.transform.baseVal.replaceItem(B,0)},T.prototype.hideControlBox=function(){this.controlBox.style.display="none"},T.prototype.showControlBox=function(){this.controlBox.style.display=""},T.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:d.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:d.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},N.prototype.getState.call(this))},T.prototype.restoreState=function(R){N.prototype.restoreState.call(this,R);var z=R;this.left=z.left,this.top=z.top,this.width=z.width,this.height=z.height,this.rotationAngle=z.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(d.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,z.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(d.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,z.containerTransformMatrix))},T.prototype.scale=function(R,z){N.prototype.scale.call(this,R,z);var Z=this.rotatePoint({x:this.left,y:this.top}),B=this.unrotatePoint({x:Z.x*R,y:Z.y*z});this.left=B.x,this.top=B.y,this.width=this.width*R,this.height=this.height*z,this.adjustControlBox()},T}(c),v=function(N){function T(R,z,Z){var B=N.call(this,R,z,Z)||this;return B.fillColor="transparent",B.strokeColor="transparent",B.strokeWidth=0,B.strokeDasharray="",B.opacity=1,B.setStrokeColor=B.setStrokeColor.bind(B),B.setFillColor=B.setFillColor.bind(B),B.setStrokeWidth=B.setStrokeWidth.bind(B),B.setStrokeDasharray=B.setStrokeDasharray.bind(B),B.createVisual=B.createVisual.bind(B),B}return Y(T,N),T.prototype.ownsTarget=function(R){return!(!N.prototype.ownsTarget.call(this,R)&&R!==this.visual)},T.prototype.createVisual=function(){this.visual=k.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)},T.prototype.pointerDown=function(R,z){N.prototype.pointerDown.call(this,R,z),this.state==="new"&&(this.createVisual(),this.moveVisual(R),this._state="creating")},T.prototype.manipulate=function(R){N.prototype.manipulate.call(this,R)},T.prototype.resize=function(R){N.prototype.resize.call(this,R),this.setSize()},T.prototype.setSize=function(){N.prototype.setSize.call(this),k.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},T.prototype.pointerUp=function(R){N.prototype.pointerUp.call(this,R),this.setSize()},T.prototype.setStrokeColor=function(R){this.strokeColor=R,this.visual&&k.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(R),this.stateChanged()},T.prototype.setFillColor=function(R){this.fillColor=R,this.visual&&k.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},T.prototype.setStrokeWidth=function(R){this.strokeWidth=R,this.visual&&k.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},T.prototype.setStrokeDasharray=function(R){this.strokeDasharray=R,this.visual&&k.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},T.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},N.prototype.getState.call(this))},T.prototype.restoreState=function(R){var z=R;this.fillColor=z.fillColor,this.strokeColor=z.strokeColor,this.strokeWidth=z.strokeWidth,this.strokeDasharray=z.strokeDasharray,this.opacity=z.opacity,this.createVisual(),N.prototype.restoreState.call(this,R),this.setSize()},T.prototype.scale=function(R,z){N.prototype.scale.call(this,R,z),this.setSize()},T.title="Rectangle marker",T}(x),f=function(N){function T(R,z,Z,B){var ce=N.call(this,R,B||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return ce.widths=[],ce.widthBoxes=[],ce.widths=z,ce.currentWidth=Z,ce.setCurrentWidth=ce.setCurrentWidth.bind(ce),ce}return Y(T,N),T.prototype.getUi=function(){var R=this,z=document.createElement("div");return z.style.display="flex",z.style.overflow="hidden",z.style.flexGrow="2",this.widths.forEach(function(Z){var B=document.createElement("div");B.style.display="flex",B.style.flexGrow="2",B.style.alignItems="center",B.style.justifyContent="space-between",B.style.padding="5px",B.style.borderWidth="2px",B.style.borderStyle="solid",B.style.borderColor=Z===R.currentWidth?R.uiStyleSettings.toolboxAccentColor:"transparent",B.addEventListener("click",function(){R.setCurrentWidth(Z,B)}),z.appendChild(B);var ce=document.createElement("div");ce.innerText=Z.toString(),ce.style.marginRight="5px",B.appendChild(ce);var Ee=document.createElement("div");Ee.style.minHeight="20px",Ee.style.flexGrow="2",Ee.style.display="flex",Ee.style.alignItems="center";var Ae=document.createElement("hr");Ae.style.minWidth="20px",Ae.style.border="0px",Ae.style.borderTop=Z+"px solid "+R.uiStyleSettings.toolboxColor,Ae.style.flexGrow="2",Ee.appendChild(Ae),B.appendChild(Ee),R.widthBoxes.push(B)}),z},T.prototype.setCurrentWidth=function(R,z){var Z=this;this.currentWidth=R,this.widthBoxes.forEach(function(B){B.style.borderColor=B===z?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},T}(A),l=function(N){function T(R,z,Z,B){var ce=N.call(this,R,B||'<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 ce.styles=[],ce.styleBoxes=[],ce.styles=z,ce.currentStyle=Z,ce.setCurrentStyle=ce.setCurrentStyle.bind(ce),ce}return Y(T,N),T.prototype.getUi=function(){var R=this,z=document.createElement("div");return z.style.display="flex",z.style.overflow="hidden",z.style.flexGrow="2",this.styles.forEach(function(Z){var B=document.createElement("div");B.style.display="flex",B.style.alignItems="center",B.style.justifyContent="space-between",B.style.padding="5px",B.style.borderWidth="2px",B.style.borderStyle="solid",B.style.overflow="hidden",B.style.maxWidth=100/R.styles.length-5+"%",B.style.borderColor=Z===R.currentStyle?R.uiStyleSettings.toolboxAccentColor:"transparent",B.addEventListener("click",function(){R.setCurrentStyle(Z,B)}),z.appendChild(B);var ce=document.createElement("div");ce.style.minHeight="20px",ce.style.flexGrow="2",ce.style.overflow="hidden";var Ee=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+R.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(Z!==""?'stroke-dasharray="'+Z+'"':"")+` />
|
|
</svg>`;ce.innerHTML=Ee,B.appendChild(ce),R.styleBoxes.push(B)}),z},T.prototype.setCurrentStyle=function(R,z){var Z=this;this.currentStyle=R,this.styleBoxes.forEach(function(B){B.style.borderColor=B===z?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},T}(A),b=function(N){function T(R,z,Z){var B=N.call(this,R,z,Z)||this;return B.strokeColor=Z.defaultColor,B.strokeWidth=Z.defaultStrokeWidth,B.strokeDasharray=Z.defaultStrokeDasharray,B.strokePanel=new C("Line color",Z.defaultColorSet,Z.defaultColor),B.strokePanel.onColorChanged=B.setStrokeColor,B.strokeWidthPanel=new f("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),B.strokeWidthPanel.onWidthChanged=B.setStrokeWidth,B.strokeStylePanel=new l("Line style",Z.defaultStrokeDasharrays,Z.defaultStrokeDasharray),B.strokeStylePanel.onStyleChanged=B.setStrokeDasharray,B}return Y(T,N),Object.defineProperty(T.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),T.prototype.getState=function(){var R=N.prototype.getState.call(this);return R.typeName=T.typeName,R},T.typeName="FrameMarker",T.title="Frame marker",T.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',T}(v),h=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},p=function(N){function T(R,z,Z){var B=N.call(this,R,z,Z)||this;return B.x1=0,B.y1=0,B.x2=0,B.y2=0,B.defaultLength=50,B.manipulationStartX=0,B.manipulationStartY=0,B.manipulationStartX1=0,B.manipulationStartY1=0,B.manipulationStartX2=0,B.manipulationStartY2=0,B.setupControlBox(),B}return Y(T,N),T.prototype.ownsTarget=function(R){return!!N.prototype.ownsTarget.call(this,R)||!(!this.grip1.ownsTarget(R)&&!this.grip2.ownsTarget(R))},T.prototype.pointerDown=function(R,z){N.prototype.pointerDown.call(this,R,z),this.manipulationStartX=R.x,this.manipulationStartY=R.y,this.state==="new"&&(this.x1=R.x,this.y1=R.y,this.x2=R.x,this.y2=R.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget(z)?this.activeGrip=this.grip1:this.grip2.ownsTarget(z)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},T.prototype.pointerUp=function(R){var z=this.state;N.prototype.pointerUp.call(this,R),this.state==="creating"&&Math.abs(this.x1-this.x2)<10&&Math.abs(this.y1-this.y2)<10?(this.x2=this.x1+this.defaultLength,this.adjustVisual(),this.adjustControlBox()):this.manipulate(R),this._state="select",z==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},T.prototype.adjustVisual=function(){},T.prototype.manipulate=function(R){this.state==="creating"?this.resize(R):this.state==="move"?(this.x1=this.manipulationStartX1+R.x-this.manipulationStartX,this.y1=this.manipulationStartY1+R.y-this.manipulationStartY,this.x2=this.manipulationStartX2+R.x-this.manipulationStartX,this.y2=this.manipulationStartY2+R.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(R)},T.prototype.resize=function(R){switch(this.activeGrip){case this.grip1:this.x1=R.x,this.y1=R.y;break;case this.grip2:case void 0:this.x2=R.x,this.y2=R.y}this.adjustVisual(),this.adjustControlBox()},T.prototype.select=function(){N.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},T.prototype.deselect=function(){N.prototype.deselect.call(this),this.controlBox.style.display="none"},T.prototype.setupControlBox=function(){this.controlBox=k.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},T.prototype.adjustControlBox=function(){this.positionGrips()},T.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},T.prototype.createGrip=function(){var R=new u;return R.visual.transform.baseVal.appendItem(k.createTransform()),this.controlBox.appendChild(R.visual),R},T.prototype.positionGrips=function(){var R=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-R/2,this.y1-R/2),this.positionGrip(this.grip2.visual,this.x2-R/2,this.y2-R/2)},T.prototype.positionGrip=function(R,z,Z){var B=R.transform.baseVal.getItem(0);B.setTranslate(z,Z),R.transform.baseVal.replaceItem(B,0)},T.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},N.prototype.getState.call(this))},T.prototype.restoreState=function(R){N.prototype.restoreState.call(this,R);var z=R;this.x1=z.x1,this.y1=z.y1,this.x2=z.x2,this.y2=z.y2},T.prototype.scale=function(R,z){N.prototype.scale.call(this,R,z),this.x1=this.x1*R,this.y1=this.y1*z,this.x2=this.x2*R,this.y2=this.y2*z,this.adjustVisual(),this.adjustControlBox()},T}(c),s=function(N){function T(R,z,Z){var B=N.call(this,R,z,Z)||this;return B.strokeColor="transparent",B.strokeWidth=0,B.strokeDasharray="",B.setStrokeColor=B.setStrokeColor.bind(B),B.setStrokeWidth=B.setStrokeWidth.bind(B),B.setStrokeDasharray=B.setStrokeDasharray.bind(B),B.strokeColor=Z.defaultColor,B.strokeWidth=Z.defaultStrokeWidth,B.strokeDasharray=Z.defaultStrokeDasharray,B.strokePanel=new C("Line color",Z.defaultColorSet,Z.defaultColor),B.strokePanel.onColorChanged=B.setStrokeColor,B.strokeWidthPanel=new f("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),B.strokeWidthPanel.onWidthChanged=B.setStrokeWidth,B.strokeStylePanel=new l("Line style",Z.defaultStrokeDasharrays,Z.defaultStrokeDasharray),B.strokeStylePanel.onStyleChanged=B.setStrokeDasharray,B}return Y(T,N),T.prototype.ownsTarget=function(R){return!(!N.prototype.ownsTarget.call(this,R)&&R!==this.visual&&R!==this.selectorLine&&R!==this.visibleLine)},T.prototype.createVisual=function(){this.visual=k.createGroup(),this.selectorLine=k.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=k.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)},T.prototype.pointerDown=function(R,z){N.prototype.pointerDown.call(this,R,z),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},T.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()),k.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),k.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),k.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},T.prototype.setStrokeColor=function(R){this.strokeColor=R,this.adjustVisual(),this.colorChanged(R)},T.prototype.setStrokeWidth=function(R){this.strokeWidth=R,this.adjustVisual()},T.prototype.setStrokeDasharray=function(R){this.strokeDasharray=R,this.adjustVisual(),this.stateChanged()},Object.defineProperty(T.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),T.prototype.getState=function(){var R=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},N.prototype.getState.call(this));return R.typeName=T.typeName,R},T.prototype.restoreState=function(R){N.prototype.restoreState.call(this,R);var z=R;this.strokeColor=z.strokeColor,this.strokeWidth=z.strokeWidth,this.strokeDasharray=z.strokeDasharray,this.createVisual(),this.adjustVisual()},T.typeName="LineMarker",T.title="Line marker",T.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',T}(p),a=function(N){function T(R,z,Z,B){var ce=N.call(this,R,B||'<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 ce.fonts=[],ce.fontBoxes=[],ce.fonts=z,ce.currentFont=Z,ce.setCurrentFont=ce.setCurrentFont.bind(ce),ce}return Y(T,N),T.prototype.getUi=function(){var R=this,z=document.createElement("div");return z.style.overflow="hidden",z.style.flexGrow="2",this.fonts.forEach(function(Z){var B=document.createElement("div");B.style.display="inline-block",B.style.alignItems="center",B.style.justifyContent="space-between",B.style.padding="5px",B.style.borderWidth="2px",B.style.borderStyle="solid",B.style.overflow="hidden",B.style.maxWidth=100/R.fonts.length-5+"%",B.style.borderColor=Z===R.currentFont?R.uiStyleSettings.toolboxAccentColor:"transparent",B.addEventListener("click",function(){R.setCurrentFont(Z,B)}),z.appendChild(B);var ce=document.createElement("div");ce.style.display="flex",ce.style.minHeight="20px",ce.style.flexGrow="2",ce.style.fontFamily=Z,ce.style.overflow="hidden";var Ee=document.createElement("div");Ee.style.whiteSpace="nowrap",Ee.style.overflow="hidden",Ee.style.textOverflow="ellipsis",Ee.innerHTML="The quick brown fox jumps over the lazy dog",ce.appendChild(Ee),B.appendChild(ce),R.fontBoxes.push(B)}),z},T.prototype.setCurrentFont=function(R,z){var Z=this;this.currentFont=R,this.fontBoxes.forEach(function(B){B.style.borderColor=B===z?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},T}(A),g=function(N){function T(R,z,Z){var B=N.call(this,R,z,Z)||this;return B.color="transparent",B.padding=5,B.DEFAULT_TEXT="your text here",B.text=B.DEFAULT_TEXT,B.isMoved=!1,B.color=Z.defaultColor,B.fontFamily=Z.defaultFontFamily,B.defaultSize={x:100,y:30},B.setColor=B.setColor.bind(B),B.setFont=B.setFont.bind(B),B.renderText=B.renderText.bind(B),B.sizeText=B.sizeText.bind(B),B.textEditDivClicked=B.textEditDivClicked.bind(B),B.showTextEditor=B.showTextEditor.bind(B),B.setSize=B.setSize.bind(B),B.positionTextEditor=B.positionTextEditor.bind(B),B.colorPanel=new C("Color",Z.defaultColorSet,Z.defaultColor),B.colorPanel.onColorChanged=B.setColor,B.fontFamilyPanel=new a("Font",Z.defaultFontFamilies,Z.defaultFontFamily),B.fontFamilyPanel.onFontChanged=B.setFont,B}return Y(T,N),T.prototype.ownsTarget=function(R){if(N.prototype.ownsTarget.call(this,R)||R===this.visual||R===this.textElement||R===this.bgRectangle)return!0;var z=!1;return this.textElement.childNodes.forEach(function(Z){Z===R&&(z=!0)}),z},T.prototype.createVisual=function(){this.visual=k.createGroup(),this.bgRectangle=k.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=k.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(k.createTransform()),this.textElement.transform.baseVal.appendItem(k.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},T.prototype.pointerDown=function(R,z){N.prototype.pointerDown.call(this,R,z),this.isMoved=!1,this.pointerDownPoint=R,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(R),this._state="creating")},T.prototype.renderText=function(){var R=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(z){R.textElement.appendChild(k.createTSpan(z.trim()===""?" ":z.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},T.prototype.getTextScale=function(){var R=this.textElement.getBBox(),z=1;if(R.width>0&&R.height>0){var Z=(1*this.width-this.width*this.padding*2/100)/R.width,B=(1*this.height-this.height*this.padding*2/100)/R.height;z=Math.min(Z,B)}return z},T.prototype.getTextPosition=function(R){var z=this.textElement.getBBox(),Z=0,B=0;return z.width>0&&z.height>0&&(Z=(this.width-z.width*R)/2,B=this.height/2-z.height*R/2),{x:Z,y:B}},T.prototype.sizeText=function(){var R=this.textElement.getBBox(),z=this.getTextScale(),Z=this.getTextPosition(z);Z.y-=R.y*z,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+Z.x+"px, "+Z.y+"px) scale("+z+", "+z+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(Z.x,Z.y),this.textElement.transform.baseVal.getItem(1).setScale(z,z))},T.prototype.manipulate=function(R){N.prototype.manipulate.call(this,R),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(R.x-this.pointerDownPoint.x)>5||Math.abs(R.y-this.pointerDownPoint.y)>5)},T.prototype.resize=function(R){N.prototype.resize.call(this,R),this.isMoved=!0,this.setSize(),this.sizeText()},T.prototype.setSize=function(){N.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(k.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),k.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},T.prototype.pointerUp=function(R){var z=this.state;z==="creating"&&(this._suppressMarkerCreateEvent=!0),N.prototype.pointerUp.call(this,R),this.setSize(),(z==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},T.prototype.showTextEditor=function(){var R=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",function(z){z.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var z=Number.parseFloat(R.textEditor.style.fontSize);R.textEditor.clientWidth>=Number.parseInt(R.textEditor.style.maxWidth)&&z>.9;)z-=.1,R.textEditor.style.fontSize=Math.max(z,.9)+"em"}),this.textEditor.addEventListener("keyup",function(z){z.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(z){if(z.clipboardData){var Z=z.clipboardData.getData("text"),B=window.getSelection();if(!B.rangeCount)return!1;B.deleteFromDocument(),B.getRangeAt(0).insertNode(document.createTextNode(Z)),z.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){R.textEditDivClicked(R.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},T.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var R=this.getTextScale(),z=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),Z=this.textElement.getBBox(),B={x:Z.width*R,y:Z.height*R};z.x-=B.x/2,z.y-=B.y/2,this.textEditor.style.top=z.y+"px",this.textEditor.style.left=z.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-z.x+"px",this.textEditor.style.fontSize=Math.max(16*R,12)+"px",this.textElement.style.display="none"}},T.prototype.textEditDivClicked=function(R){this.text=R.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},T.prototype.select=function(){N.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},T.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),N.prototype.deselect.call(this)},T.prototype.dblClick=function(R,z){N.prototype.dblClick.call(this,R,z),this.showTextEditor()},T.prototype.setColor=function(R){this.textElement&&k.setAttributes(this.textElement,[["fill",R]]),this.color=R,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(R)},T.prototype.setFont=function(R){this.textElement&&k.setAttributes(this.textElement,[["font-family",R]]),this.fontFamily=R,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},T.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},T.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(T.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),T.prototype.getState=function(){var R=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},N.prototype.getState.call(this));return R.typeName=T.typeName,R},T.prototype.restoreState=function(R){var z=R;this.color=z.color,this.fontFamily=z.fontFamily,this.padding=z.padding,this.text=z.text,this.createVisual(),N.prototype.restoreState.call(this,R),this.setSize()},T.prototype.scale=function(R,z){N.prototype.scale.call(this,R,z),this.setSize(),this.sizeText(),this.positionTextEditor()},T.typeName="TextMarker",T.title="Text marker",T.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>',T}(x),m=function(N){function T(R,z,Z){var B=N.call(this,R,z,Z)||this;return B.color="transparent",B.lineWidth=3,B.drawing=!1,B.pixelRatio=1,B.color=Z.defaultColor,B.lineWidth=Z.defaultStrokeWidth,B.pixelRatio=Z.freehandPixelRatio,B.setColor=B.setColor.bind(B),B.addCanvas=B.addCanvas.bind(B),B.finishCreation=B.finishCreation.bind(B),B.setLineWidth=B.setLineWidth.bind(B),B.colorPanel=new C("Color",Z.defaultColorSet,Z.defaultColor),B.colorPanel.onColorChanged=B.setColor,B.lineWidthPanel=new f("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),B.lineWidthPanel.onWidthChanged=B.setLineWidth,B}return Y(T,N),T.prototype.ownsTarget=function(R){return!(!N.prototype.ownsTarget.call(this,R)&&R!==this.visual&&R!==this.drawingImage)},T.prototype.createVisual=function(){this.visual=k.createGroup(),this.drawingImage=k.createImage(),this.visual.appendChild(this.drawingImage);var R=k.createTransform();this.visual.transform.baseVal.appendItem(R),this.addMarkerVisualToContainer(this.visual)},T.prototype.pointerDown=function(R,z){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(R.x,R.y),this.drawing=!0):N.prototype.pointerDown.call(this,R,z)},T.prototype.manipulate=function(R){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(R.x,R.y),this.canvasContext.stroke()):N.prototype.manipulate.call(this,R)},T.prototype.resize=function(R){N.prototype.resize.call(this,R),k.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),k.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},T.prototype.pointerUp=function(R){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):N.prototype.pointerUp.call(this,R)},T.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)},T.prototype.select=function(){this.state==="creating"&&this.finishCreation(),N.prototype.select.call(this)},T.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),N.prototype.deselect.call(this)},T.prototype.finishCreation=function(){for(var R=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),z=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],Z=z[0],B=z[1],ce=z[2],Ee=z[3],Ae=!1,Oe=0;Oe<this.canvasElement.height;Oe++)for(var Re=0;Re<this.canvasElement.width;Re++)R.data[Oe*this.canvasElement.width*4+4*Re+3]>0&&(Ae=!0,Oe<B&&(B=Oe),Re<Z&&(Z=Re),Oe>Ee&&(Ee=Oe),Re>ce&&(ce=Re));if(Ae){this.left=Z/this.pixelRatio,this.top=B/this.pixelRatio,this.width=(ce-Z)/this.pixelRatio,this.height=(Ee-B)/this.pixelRatio;var De=document.createElement("canvas");De.width=ce-Z,De.height=Ee-B,De.getContext("2d").putImageData(this.canvasContext.getImageData(Z,B,ce-Z,Ee-B),0,0),this.drawingImgUrl=De.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},T.prototype.setDrawingImage=function(){k.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),k.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},T.prototype.setColor=function(R){this.color=R,this.colorChanged(R)},T.prototype.setLineWidth=function(R){this.lineWidth=R},Object.defineProperty(T.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),T.prototype.getState=function(){var R=Object.assign({drawingImgUrl:this.drawingImgUrl},N.prototype.getState.call(this));return R.typeName=T.typeName,R},T.prototype.restoreState=function(R){this.createVisual(),N.prototype.restoreState.call(this,R),this.drawingImgUrl=R.drawingImgUrl,this.setDrawingImage()},T.prototype.scale=function(R,z){N.prototype.scale.call(this,R,z),this.setDrawingImage()},T.typeName="FreehandMarker",T.title="Freehand marker",T.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>',T}(x),y=function(N){function T(R,z,Z){var B=N.call(this,R,Z||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return B.typeBoxes=[],B.currentType=z,B.setCurrentType=B.setCurrentType.bind(B),B}return Y(T,N),T.prototype.getUi=function(){var R=this,z=document.createElement("div");z.style.display="flex",z.style.overflow="hidden",z.style.flexGrow="2";for(var Z=function(Ee){var Ae="both";switch(Ee){case 0:Ae="both";break;case 1:Ae="start";break;case 2:Ae="end";break;case 3:Ae="none"}var Oe=document.createElement("div");if(Oe.style.display="flex",Oe.style.flexGrow="2",Oe.style.alignItems="center",Oe.style.justifyContent="space-between",Oe.style.padding="5px",Oe.style.borderWidth="2px",Oe.style.borderStyle="solid",Oe.style.borderColor=Ae===B.currentType?B.uiStyleSettings.toolboxAccentColor:"transparent",Oe.addEventListener("click",function(){R.setCurrentType(Ae,Oe)}),z.appendChild(Oe),Ae==="both"||Ae==="start"){var Re=document.createElement("div");Re.style.display="flex",Re.style.alignItems="center",Re.style.minHeight="20px",Re.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
<polygon points="0,5 10,0 10,10" fill="`+(B.uiStyleSettings!==void 0?B.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Re.style.marginLeft="5px",Oe.appendChild(Re)}var De=document.createElement("div");De.style.display="flex",De.style.alignItems="center",De.style.minHeight="20px",De.style.flexGrow="2";var Pe=document.createElement("hr");if(Pe.style.minWidth="20px",Pe.style.border="0px",Pe.style.borderTop="3px solid "+(B.uiStyleSettings!==void 0?B.uiStyleSettings.toolboxColor:"#eeeeee"),Pe.style.flexGrow="2",De.appendChild(Pe),Oe.appendChild(De),Ae==="both"||Ae==="end"){var Ke=document.createElement("div");Ke.style.display="flex",Ke.style.alignItems="center",Ke.style.minHeight="20px",Ke.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
<polygon points="0,0 10,5 0,10" fill="`+(B.uiStyleSettings!==void 0?B.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Ke.style.marginRight="5px",Oe.appendChild(Ke)}B.typeBoxes.push(Oe)},B=this,ce=0;ce<4;ce++)Z(ce);return z},T.prototype.setCurrentType=function(R,z){var Z=this;this.currentType=R,this.typeBoxes.forEach(function(B){B.style.borderColor=B===z?Z.uiStyleSettings!==void 0?Z.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},T}(A),M=function(N){function T(R,z,Z){var B=N.call(this,R,z,Z)||this;return B.arrowType="end",B.arrowBaseHeight=10,B.arrowBaseWidth=10,B.getArrowPoints=B.getArrowPoints.bind(B),B.setArrowType=B.setArrowType.bind(B),B.arrowTypePanel=new y("Arrow type","end"),B.arrowTypePanel.onArrowTypeChanged=B.setArrowType,B}return Y(T,N),T.prototype.ownsTarget=function(R){return!(!N.prototype.ownsTarget.call(this,R)&&R!==this.arrow1&&R!==this.arrow2)},T.prototype.getArrowPoints=function(R,z){var Z=this.arrowBaseWidth+2*this.strokeWidth,B=this.arrowBaseHeight+2*this.strokeWidth;return R-Z/2+","+(z+B/2)+" "+R+","+(z-B/2)+" "+(R+Z/2)+","+(z+B/2)},T.prototype.createTips=function(){this.arrow1=k.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(k.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=k.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(k.createTransform()),this.visual.appendChild(this.arrow2)},T.prototype.pointerDown=function(R,z){N.prototype.pointerDown.call(this,R,z),this.state==="creating"&&this.createTips()},T.prototype.adjustVisual=function(){if(N.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",k.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),k.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var R=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),z=this.arrow1.transform.baseVal.getItem(0);z.setRotate(R,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(z,0);var Z=this.arrow2.transform.baseVal.getItem(0);Z.setRotate(R+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(Z,0)}},T.prototype.setArrowType=function(R){this.arrowType=R,this.adjustVisual(),this.stateChanged()},Object.defineProperty(T.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),T.prototype.getState=function(){var R=Object.assign({arrowType:this.arrowType},N.prototype.getState.call(this));return R.typeName=T.typeName,R},T.prototype.restoreState=function(R){N.prototype.restoreState.call(this,R);var z=R;this.arrowType=z.arrowType,this.createTips(),this.adjustVisual()},T.typeName="ArrowMarker",T.title="Arrow marker",T.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',T}(s),H=function(N){function T(R,z,Z){var B=N.call(this,R,z,Z)||this;return B.fillColor=Z.defaultFillColor,B.strokeWidth=0,B.fillPanel=new C("Color",Z.defaultColorSet,Z.defaultFillColor),B.fillPanel.onColorChanged=B.setFillColor,B}return Y(T,N),Object.defineProperty(T.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),T.prototype.getState=function(){var R=N.prototype.getState.call(this);return R.typeName=T.typeName,R},T.typeName="CoverMarker",T.title="Cover marker",T.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',T}(v),V=function(N){function T(R,z,Z,B){var ce=N.call(this,R,B||'<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 ce.opacities=[],ce.opacityBoxes=[],ce.opacities=z,ce.currentOpacity=Z,ce.setCurrentOpacity=ce.setCurrentOpacity.bind(ce),ce}return Y(T,N),T.prototype.getUi=function(){var R=this,z=document.createElement("div");return z.style.display="flex",z.style.overflow="hidden",z.style.flexGrow="2",z.style.justifyContent="space-between",this.opacities.forEach(function(Z){var B=document.createElement("div");B.style.display="flex",B.style.alignItems="center",B.style.justifyContent="center",B.style.padding="5px",B.style.borderWidth="2px",B.style.borderStyle="solid",B.style.borderColor=Z===R.currentOpacity?R.uiStyleSettings.toolboxAccentColor:"transparent",B.addEventListener("click",function(){R.setCurrentOpacity(Z,B)}),z.appendChild(B);var ce=document.createElement("div");ce.innerText=100*Z+"%",B.appendChild(ce),R.opacityBoxes.push(B)}),z},T.prototype.setCurrentOpacity=function(R,z){var Z=this;this.currentOpacity=R,this.opacityBoxes.forEach(function(B){B.style.borderColor=B===z?Z.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},T}(A),te=function(N){function T(R,z,Z){var B=N.call(this,R,z,Z)||this;return B.setOpacity=B.setOpacity.bind(B),B.fillColor=Z.defaultHighlightColor,B.strokeWidth=0,B.opacity=Z.defaultHighlightOpacity,B.fillPanel=new C("Color",Z.defaultColorSet,B.fillColor),B.fillPanel.onColorChanged=B.setFillColor,B.opacityPanel=new V("Opacity",Z.defaultOpacitySteps,B.opacity),B.opacityPanel.onOpacityChanged=B.setOpacity,B}return Y(T,N),T.prototype.setOpacity=function(R){this.opacity=R,this.visual&&k.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(T.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),T.prototype.getState=function(){var R=N.prototype.getState.call(this);return R.typeName=T.typeName,R},T.typeName="HighlightMarker",T.title="Highlight marker",T.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>',T}(H),G='<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>',j=function(N){function T(R,z,Z){var B=N.call(this,R,z,Z)||this;return B.bgColor="transparent",B.tipPosition={x:0,y:0},B.tipBase1Position={x:0,y:0},B.tipBase2Position={x:0,y:0},B.tipMoving=!1,B.color=Z.defaultStrokeColor,B.bgColor=Z.defaultFillColor,B.fontFamily=Z.defaultFontFamily,B.defaultSize={x:100,y:30},B.setBgColor=B.setBgColor.bind(B),B.getTipPoints=B.getTipPoints.bind(B),B.positionTip=B.positionTip.bind(B),B.setTipPoints=B.setTipPoints.bind(B),B.colorPanel=new C("Text color",Z.defaultColorSet,B.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>'),B.colorPanel.onColorChanged=B.setColor,B.bgColorPanel=new C("Fill color",Z.defaultColorSet,B.bgColor,G),B.bgColorPanel.onColorChanged=B.setBgColor,B.fontFamilyPanel=new a("Font",Z.defaultFontFamilies,Z.defaultFontFamily),B.fontFamilyPanel.onFontChanged=B.setFont,B.tipGrip=new u,B.tipGrip.visual.transform.baseVal.appendItem(k.createTransform()),B.controlBox.appendChild(B.tipGrip.visual),B}return Y(T,N),T.prototype.ownsTarget=function(R){return N.prototype.ownsTarget.call(this,R)||this.tipGrip.ownsTarget(R)||this.tip===R},T.prototype.createTip=function(){k.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=k.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},T.prototype.pointerDown=function(R,z){this.state==="new"&&N.prototype.pointerDown.call(this,R,z),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(z)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):N.prototype.pointerDown.call(this,R,z)},T.prototype.pointerUp=function(R){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,N.prototype.pointerUp.call(this,R);else{var z=this.state==="creating";N.prototype.pointerUp.call(this,R),this.setTipPoints(z),this.positionTip()}},T.prototype.manipulate=function(R){if(this.tipMoving){var z=this.unrotatePoint(R);this.tipPosition={x:z.x-this.manipulationStartLeft,y:z.y-this.manipulationStartTop},this.positionTip()}else N.prototype.manipulate.call(this,R)},T.prototype.setBgColor=function(R){this.bgRectangle&&this.tip&&(k.setAttributes(this.bgRectangle,[["fill",R]]),k.setAttributes(this.tip,[["fill",R]])),this.bgColor=R,this.fillColorChanged(R)},T.prototype.getTipPoints=function(){return this.setTipPoints(this.state==="creating"),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},T.prototype.setTipPoints=function(R){R===void 0&&(R=!1);var z=Math.min(this.height/2,15),Z=this.height/5;R&&(this.tipPosition={x:z+Z/2,y:this.height+20});var B=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?B<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(Z=this.width/5,z=Math.min(this.width/2,15),this.tipBase1Position={x:z,y:0},this.tipBase2Position={x:z+Z,y:0}):(this.tipBase1Position={x:0,y:z},this.tipBase2Position={x:0,y:z+Z}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?B<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(Z=this.width/5,z=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-z-Z,y:0},this.tipBase2Position={x:this.width-z,y:0}):(this.tipBase1Position={x:this.width,y:z},this.tipBase2Position={x:this.width,y:z+Z}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?B<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(Z=this.width/5,z=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-z-Z,y:this.height},this.tipBase2Position={x:this.width-z,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-z-Z},this.tipBase2Position={x:this.width,y:this.height-z}):B<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(Z=this.width/5,z=Math.min(this.width/2,15),this.tipBase1Position={x:z,y:this.height},this.tipBase2Position={x:z+Z,y:this.height}):(this.tipBase1Position={x:0,y:this.height-z},this.tipBase2Position={x:0,y:this.height-z-Z})},T.prototype.resize=function(R){N.prototype.resize.call(this,R),this.positionTip()},T.prototype.positionTip=function(){k.setAttributes(this.tip,[["points",this.getTipPoints()]]);var R=this.tipGrip.visual.transform.baseVal.getItem(0);R.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(R,0)},Object.defineProperty(T.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),T.prototype.select=function(){this.positionTip(),N.prototype.select.call(this)},T.prototype.getState=function(){var R=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},N.prototype.getState.call(this));return R.typeName=T.typeName,R},T.prototype.restoreState=function(R){var z=R;this.bgColor=z.bgColor,this.tipPosition=z.tipPosition,N.prototype.restoreState.call(this,R),this.createTip(),this.setTipPoints()},T.prototype.scale=function(R,z){N.prototype.scale.call(this,R,z),this.tipPosition={x:this.tipPosition.x*R,y:this.tipPosition.y*z},this.positionTip()},T.typeName="CalloutMarker",T.title="Callout marker",T.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>',T}(g),ie=function(N){function T(R,z,Z){var B=N.call(this,R,z,Z)||this;return B.fillColor="transparent",B.strokeColor="transparent",B.strokeWidth=0,B.strokeDasharray="",B.opacity=1,B.strokeColor=Z.defaultColor,B.strokeWidth=Z.defaultStrokeWidth,B.strokeDasharray=Z.defaultStrokeDasharray,B.fillColor=Z.defaultFillColor,B.setStrokeColor=B.setStrokeColor.bind(B),B.setFillColor=B.setFillColor.bind(B),B.setStrokeWidth=B.setStrokeWidth.bind(B),B.setStrokeDasharray=B.setStrokeDasharray.bind(B),B.setOpacity=B.setOpacity.bind(B),B.createVisual=B.createVisual.bind(B),B.strokePanel=new C("Line color",I(Z.defaultColorSet,["transparent"]),Z.defaultColor),B.strokePanel.onColorChanged=B.setStrokeColor,B.fillPanel=new C("Fill color",I(Z.defaultColorSet,["transparent"]),B.fillColor,G),B.fillPanel.onColorChanged=B.setFillColor,B.strokeWidthPanel=new f("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),B.strokeWidthPanel.onWidthChanged=B.setStrokeWidth,B.strokeStylePanel=new l("Line style",Z.defaultStrokeDasharrays,Z.defaultStrokeDasharray),B.strokeStylePanel.onStyleChanged=B.setStrokeDasharray,B.opacityPanel=new V("Opacity",Z.defaultOpacitySteps,B.opacity),B.opacityPanel.onOpacityChanged=B.setOpacity,B}return Y(T,N),T.prototype.ownsTarget=function(R){return!(!N.prototype.ownsTarget.call(this,R)&&R!==this.visual)},T.prototype.createVisual=function(){this.visual=k.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)},T.prototype.pointerDown=function(R,z){N.prototype.pointerDown.call(this,R,z),this.state==="new"&&(this.createVisual(),this.moveVisual(R),this._state="creating")},T.prototype.manipulate=function(R){N.prototype.manipulate.call(this,R)},T.prototype.resize=function(R){N.prototype.resize.call(this,R),this.setSize()},T.prototype.setSize=function(){N.prototype.setSize.call(this),k.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},T.prototype.pointerUp=function(R){N.prototype.pointerUp.call(this,R),this.setSize()},T.prototype.setStrokeColor=function(R){this.strokeColor=R,this.visual&&k.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(R),this.stateChanged()},T.prototype.setFillColor=function(R){this.fillColor=R,this.visual&&k.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(R),this.stateChanged()},T.prototype.setStrokeWidth=function(R){this.strokeWidth=R,this.visual&&k.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},T.prototype.setStrokeDasharray=function(R){this.strokeDasharray=R,this.visual&&k.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},T.prototype.setOpacity=function(R){this.opacity=R,this.visual&&k.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(T.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),T.prototype.getState=function(){var R=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},N.prototype.getState.call(this));return R.typeName=T.typeName,R},T.prototype.restoreState=function(R){var z=R;this.fillColor=z.fillColor,this.strokeColor=z.strokeColor,this.strokeWidth=z.strokeWidth,this.strokeDasharray=z.strokeDasharray,this.opacity=z.opacity,this.createVisual(),N.prototype.restoreState.call(this,R),this.setSize()},T.prototype.scale=function(R,z){N.prototype.scale.call(this,R,z),this.setSize()},T.typeName="EllipseMarker",T.title="Ellipse marker",T.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>',T}(x),pe=function(N){function T(R,z,Z){return N.call(this,R,z,Z)||this}return Y(T,N),Object.defineProperty(T.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),T.prototype.ownsTarget=function(R){return!(!N.prototype.ownsTarget.call(this,R)&&R!==this.tip1&&R!==this.tip2)},T.prototype.createTips=function(){this.tip1=k.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(k.createTransform()),this.visual.appendChild(this.tip1),this.tip2=k.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(k.createTransform()),this.visual.appendChild(this.tip2)},T.prototype.pointerDown=function(R,z){N.prototype.pointerDown.call(this,R,z),this.state==="creating"&&this.createTips()},T.prototype.adjustVisual=function(){if(N.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(k.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()]]),k.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 R=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),z=this.tip1.transform.baseVal.getItem(0);z.setRotate(R,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(z,0);var Z=this.tip2.transform.baseVal.getItem(0);Z.setRotate(R+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(Z,0)}},Object.defineProperty(T.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),T.prototype.getState=function(){var R=N.prototype.getState.call(this);return R.typeName=T.typeName,R},T.prototype.restoreState=function(R){N.prototype.restoreState.call(this,R),this.createTips(),this.adjustVisual()},T.typeName="MeasurementMarker",T.title="Measurement marker",T.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>',T}(s),ge=function(N){function T(R,z,Z){var B=N.call(this,R,z,Z)||this;return B.strokePanel.colors=Z.defaultColorSet,B.fillColor="transparent",B}return Y(T,N),Object.defineProperty(T.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),T.prototype.getState=function(){var R=N.prototype.getState.call(this);return R.typeName=T.typeName,R},T.typeName="EllipseFrameMarker",T.title="Ellipse frame marker",T.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>',T}(ie),be=function(){function N(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(N.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),N.prototype.addUndoStep=function(T){this.undoStack.length!==0&&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))},N.prototype.replaceLastUndoStep=function(T){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=T)},N.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},N.prototype.undo=function(){if(this.undoStack.length>1){var T=this.undoStack.pop();return T!==void 0&&this.redoStack.push(T),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},N.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},N}(),Ne=function(N){function T(R,z,Z){var B=N.call(this,R,z,Z)||this;return B.strokeColor="transparent",B.strokeWidth=0,B.strokeDasharray="",B.curveX=0,B.curveY=0,B.manipulationStartCurveX=0,B.manipulationStartCurveY=0,B.setStrokeColor=B.setStrokeColor.bind(B),B.setStrokeWidth=B.setStrokeWidth.bind(B),B.setStrokeDasharray=B.setStrokeDasharray.bind(B),B.positionGrips=B.positionGrips.bind(B),B.addControlGrips=B.addControlGrips.bind(B),B.adjustVisual=B.adjustVisual.bind(B),B.setupControlBox=B.setupControlBox.bind(B),B.resize=B.resize.bind(B),B.strokeColor=Z.defaultColor,B.strokeWidth=Z.defaultStrokeWidth,B.strokeDasharray=Z.defaultStrokeDasharray,B.strokePanel=new C("Line color",Z.defaultColorSet,Z.defaultColor),B.strokePanel.onColorChanged=B.setStrokeColor,B.strokeWidthPanel=new f("Line width",Z.defaultStrokeWidths,Z.defaultStrokeWidth),B.strokeWidthPanel.onWidthChanged=B.setStrokeWidth,B.strokeStylePanel=new l("Line style",Z.defaultStrokeDasharrays,Z.defaultStrokeDasharray),B.strokeStylePanel.onStyleChanged=B.setStrokeDasharray,B}return Y(T,N),T.prototype.ownsTarget=function(R){return!(!N.prototype.ownsTarget.call(this,R)&&R!==this.visual&&R!==this.selectorCurve&&R!==this.visibleCurve&&!this.curveGrip.ownsTarget(R))},T.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},T.prototype.createVisual=function(){this.visual=k.createGroup(),this.selectorCurve=k.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=k.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)},T.prototype.pointerDown=function(R,z){N.prototype.pointerDown.call(this,R,z),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=R.x,this.curveY=R.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(z)&&(this.activeGrip=this.curveGrip,this._state="resize")},T.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),k.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),k.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),k.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},T.prototype.setupControlBox=function(){N.prototype.setupControlBox.call(this),this.curveControlLine1=k.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=k.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)},T.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,N.prototype.addControlGrips.call(this)},T.prototype.positionGrips=function(){N.prototype.positionGrips.call(this);var R=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-R/2,this.curveY-R/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()))},T.prototype.manipulate=function(R){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+R.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+R.y-this.manipulationStartY),N.prototype.manipulate.call(this,R)},T.prototype.resize=function(R){this.activeGrip===this.curveGrip&&(this.curveX=R.x,this.curveY=R.y),N.prototype.resize.call(this,R),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},T.prototype.setStrokeColor=function(R){this.strokeColor=R,this.adjustVisual(),this.colorChanged(R)},T.prototype.setStrokeWidth=function(R){this.strokeWidth=R,this.adjustVisual()},T.prototype.setStrokeDasharray=function(R){this.strokeDasharray=R,this.adjustVisual()},T.prototype.scale=function(R,z){this.curveX=this.curveX*R,this.curveY=this.curveY*z,N.prototype.scale.call(this,R,z)},Object.defineProperty(T.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),T.prototype.getState=function(){var R=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},N.prototype.getState.call(this));return R.typeName=T.typeName,R},T.prototype.restoreState=function(R){N.prototype.restoreState.call(this,R);var z=R;this.strokeColor=z.strokeColor,this.strokeWidth=z.strokeWidth,this.strokeDasharray=z.strokeDasharray,this.curveX=z.curveX,this.curveY=z.curveY,this.createVisual(),this.adjustVisual()},T.typeName="CurveMarker",T.title="Curve marker",T.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>',T}(p),Se=function(){function N(T,R){R===void 0&&(R=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=T,this.cancelable=R}return Object.defineProperty(N.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),N.prototype.preventDefault=function(){this._defaultPrevented=!0},N}(),Me=function(N){function T(R,z,Z){var B=N.call(this,R,!1)||this;return B.dataUrl=z,B.state=Z,B}return Y(T,N),T}(Se),Le=function(N){function T(R,z,Z){Z===void 0&&(Z=!1);var B=N.call(this,R,Z)||this;return B.marker=z,B}return Y(T,N),T}(Se),we=function(){function N(){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 N.prototype.addEventListener=function(T,R){this[T].push(R)},N.prototype.removeEventListener=function(T,R){var z=this[T].indexOf(R);z>-1&&this[T].splice(z,1)},N}(),ve=function(){function N(T){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new h,this._isOpen=!1,this.undoRedoManager=new be,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 we,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=N.instanceCounter++,this.styles=new D(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=T,this.targetRoot=document.body,this.width=T.clientWidth,this.height=T.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(N.prototype,"ALL_MARKER_TYPES",{get:function(){return[b,m,M,g,ge,ie,te,j,pe,H,s,Ne]},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[b,m,M,g,ie,te,j]},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"BASIC_MARKER_TYPES",{get:function(){return[b,m,M,g,te]},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(T){var R=this;this._availableMarkerTypes.splice(0),T.forEach(function(z){if(typeof z=="string"){var Z=R.ALL_MARKER_TYPES.find(function(B){return B.typeName===z});Z!==void 0&&R._availableMarkerTypes.push(Z)}else R._availableMarkerTypes.push(z)})},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(N.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(N.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),N.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),W.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},N.prototype.show=function(){var T=this;this.styles.styleSheetRoot===void 0&&O.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=O.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(R){return R(new Se(T))})},N.prototype.render=function(){return L(this,void 0,void 0,function(){var T;return X(this,function(R){switch(R.label){case 0:return this.setCurrentMarker(),(T=new F).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 R.sent(),[4,T.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,R.sent()]}})})},N.prototype.close=function(T){var R=this;if(T===void 0&&(T=!1),this.isOpen){var z=!1;T||this.eventListeners.beforeclose.forEach(function(Z){var B=new Se(R,!0);Z(B),B.defaultPrevented&&(z=!0)}),z||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(Z){return Z(new Se(R))}),this.detachEvents(),this._isOpen=!1)}},N.prototype.addMarkersToToolbar=function(){for(var T,R=[],z=0;z<arguments.length;z++)R[z]=arguments[z];(T=this._availableMarkerTypes).push.apply(T,R)},N.prototype.addRenderEventListener=function(T){this.addEventListener("render",function(R){T(R.dataUrl,R.state)})},N.prototype.removeRenderEventListener=function(T){},N.prototype.addCloseEventListener=function(T){this.addEventListener("close",function(){T()})},N.prototype.removeCloseEventListener=function(T){},N.prototype.setupResizeObserver=function(){var T=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){T.resize(T.target.clientWidth,T.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return T.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},N.prototype.onPopupTargetResize=function(){var T=1*this.target.clientWidth/this.target.clientHeight,R=this.editorCanvas.clientWidth/T>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*T:this.editorCanvas.clientWidth,z=R<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/T;this.resize(R,z)},N.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},N.prototype.resize=function(T,R){this._isResizing=!0;var z=T/this.imageWidth,Z=R/this.imageHeight;this.imageWidth=Math.round(T),this.imageHeight=Math.round(R),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(z,Z),this._isResizing=!1},N.prototype.scaleMarkers=function(T,R){var z,Z=this;this._currentMarker&&this._currentMarker instanceof g?this._currentMarker.scale(T,R):(z=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(B){B!==Z._currentMarker&&B.scale(T,R)}),z!==void 0&&this.setCurrentMarker(z)},N.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"},N.prototype.setTopLeft=function(){var T=this.editingTarget.getBoundingClientRect(),R=this.editorCanvas.getBoundingClientRect();this.left=T.left-R.left,this.top=T.top-R.top},N.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)},N.prototype.addDefs=function(){for(var T,R=[],z=0;z<arguments.length;z++)R[z]=arguments[z];this.defs=k.createDefs(),this.addDefsToImage(),(T=this.defs).append.apply(T,R)},N.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},N.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)},N.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},N.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},N.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)},N.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},N.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)},N.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()},N.prototype.positionLogo=function(){this.logoUI&&(this.uiStyleSettings.logoPosition!=="right"?this.logoUI.style.left=this.markerImageHolder.offsetLeft+10+"px":this.logoUI.style.left=this.markerImageHolder.offsetLeft+this.markerImageHolder.offsetWidth-this.logoUI.clientWidth-10+"px",this.logoUI.style.top=this.markerImageHolder.offsetTop+this.markerImageHolder.offsetHeight-this.logoUI.clientHeight-10+"px")},N.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"},N.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},N.prototype.showUI=function(){switch(this.settings.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var 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=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.settings.displayMode==="popup"?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new P(this.uiDiv,this.settings.displayMode,this._availableMarkerTypes,this.uiStyleSettings,this.styles),this.toolbar.addButtonClickListener(this.toolbarButtonClicked),this.toolbar.show(this._silentRenderMode||this.uiStyleSettings.hideToolbar?"hidden":"visible"),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.settings.displayMode==="popup"&&(this.contentDiv.style.backgroundColor=this.uiStyleSettings.canvasBackgroundColor,this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.uiStyleSettings.toolbarHeight+"px",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.settings.popupMargin+"px)"),this.contentDiv.style.overflow="auto",this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.settings.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.editorCanvas.style.transformOrigin="left top",this.editorCanvas.style.transform="scale("+this.zoomLevel+")",this.contentDiv.appendChild(this.editorCanvas),this.editingTarget=this.target instanceof HTMLImageElement?document.createElement("img"):document.createElement("canvas"),this.target.getClientRects().item(0).y<this.styles.settings.toolbarHeight&&(this.editingTarget.style.marginTop=this.target.offsetTop-this.styles.settings.toolbarHeight+"px"),this.editorCanvas.appendChild(this.editingTarget),this.toolbox=new _(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},N.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},N.prototype.removeMarker=function(T){this.markerImage.removeChild(T.container),this.markers.indexOf(T)>-1&&this.markers.splice(this.markers.indexOf(T),1),T.dispose()},N.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),this._currentMarker!==void 0&&(this._currentMarker.state!=="new"?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},N.prototype.toolbarButtonClicked=function(T,R){if(T==="marker"&&R!==void 0)this.createNewMarker(R);else if(T==="action")switch(R){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},N.prototype.deleteSelectedMarker=function(){var T=this;if(this._currentMarker!==void 0){var R=!1;if(this.eventListeners.markerbeforedelete.forEach(function(Z){var B=new Le(T,T._currentMarker,!0);Z(B),B.defaultPrevented&&(R=!0)}),!R){var z=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(Z){return Z(new Le(T,z))})}}},N.prototype.clear=function(){var T=this,R=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ce){var Ee=new Le(T,void 0,!0);ce(Ee),Ee.defaultPrevented&&(R=!0)}),!R)){this.setCurrentMarker();for(var z=function(ce){var Ee=Z.markers[ce];Z.setCurrentMarker(Z.markers[ce]),Z._currentMarker.dispose(),Z.markerImage.removeChild(Z._currentMarker.container),Z.markers.splice(Z.markers.indexOf(Z._currentMarker),1),Z.eventListeners.markerdelete.forEach(function(Ae){return Ae(new Le(T,Ee))})},Z=this,B=this.markers.length-1;B>=0;B--)z(B);this.addUndoStep()}},Object.defineProperty(N.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),N.prototype.showNotesEditor=function(){var T;this._currentMarker!==void 0&&(this.overlayContainer.innerHTML="",this.notesArea=document.createElement("textarea"),this.notesArea.className=this.uiStyleSettings.notesAreaStyleClassName,this.notesArea.style.pointerEvents="auto",this.notesArea.style.alignSelf="stretch",this.notesArea.style.width="100%",this.notesArea.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.notesArea.value=(T=this._currentMarker.notes)!==null&&T!==void 0?T:"",this.overlayContainer.appendChild(this.notesArea))},N.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(this._currentMarker!==void 0&&(this._currentMarker.notes=this.notesArea.value.trim()!==""?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},N.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},N.prototype.addUndoStep=function(){var T=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var R=this.getState(),z=this.undoRedoManager.getLastUndoStep();if(!z||z.width===R.width&&z.height===R.height){var Z=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(R),Z<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(B){return B(new Se(T))})}else this.undoRedoManager.replaceLastUndoStep(R),this.eventListeners.statechange.forEach(function(B){return B(new Se(T))})}},N.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},N.prototype.undoStep=function(){var T=this,R=this.undoRedoManager.undo();R!==void 0&&(this.restoreState(R),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(z){return z(new Se(T))}))},N.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},N.prototype.redoStep=function(){var T=this,R=this.undoRedoManager.redo();R!==void 0&&(this.restoreState(R),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(z){return z(new Se(T))}))},N.prototype.stepZoom=function(){var T=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=T<this.zoomSteps.length-1?this.zoomSteps[T+1]:this.zoomSteps[0]},N.prototype.panTo=function(T){this.contentDiv.scrollBy({left:this.prevPanPoint.x-T.x,top:this.prevPanPoint.y-T.y}),this.prevPanPoint=T},N.prototype.startRenderAndClose=function(){return L(this,void 0,void 0,function(){var T,R,z=this;return X(this,function(Z){switch(Z.label){case 0:return[4,this.render()];case 1:return T=Z.sent(),R=this.getState(),this.eventListeners.render.forEach(function(B){return B(new Me(z,T,R))}),this.close(!0),[2]}})})},N.prototype.getState=function(T){T===!0&&this.setCurrentMarker();var R={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(z){return R.markers.push(z.getState())}),R},N.prototype.restoreState=function(T){var R=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);T.markers.forEach(function(z){var Z=R._availableMarkerTypes.find(function(ce){return ce.typeName===z.typeName});if(Z!==void 0){var B=R.addNewMarker(Z);B.restoreState(z),R.markers.push(B)}}),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(z){return z(new Se(R))})},N.prototype.addNewMarker=function(T){var R=k.createGroup();return this.markerImage.appendChild(R),new T(R,this.overlayContainer,this.settings)},N.prototype.createNewMarker=function(T){var R,z=this;(R=typeof T=="string"?this._availableMarkerTypes.find(function(Z){return Z.typeName===T}):T)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(R),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(R.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(Z){return Z(new Le(z,z._currentMarker))}))},N.prototype.markerCreated=function(T){var R=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(T),this.setCurrentMarker(T),T instanceof m&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(m):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(z){return z(new Le(R,R._currentMarker))})},N.prototype.colorChanged=function(T){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=T,this.settings.defaultStrokeColor=T)},N.prototype.fillColorChanged=function(T){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=T)},N.prototype.markerStateChanged=function(T){var R=this;this.eventListeners.markerchange.forEach(function(z){return z(new Le(R,T))})},N.prototype.setCurrentMarker=function(T){var R=this;this._currentMarker!==T&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(z){return z(new Le(R,R._currentMarker))})),this._currentMarker=T,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(z){return z(new Le(R,R._currentMarker))}))},N.prototype.onPointerDown=function(T){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||T.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var R=this.markers.find(function(z){return z.ownsTarget(T.target)});R!==void 0?(this.setCurrentMarker(R),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))},N.prototype.onDblClick=function(T){if(this._isFocused||this.focus(),this.mode==="select"){var R=this.markers.find(function(z){return z.ownsTarget(T.target)});R!==void 0&&R!==this._currentMarker&&this.setCurrentMarker(R),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(T.clientX,T.clientY),T.target):this.setCurrentMarker()}},N.prototype.onPointerMove=function(T){this.touchPoints!==1&&T.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||T.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(T.clientX,T.clientY)):this.zoomLevel>1&&this.panTo({x:T.clientX,y:T.clientY}))},N.prototype.onPointerUp=function(T){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(T.clientX,T.clientY)),this.isDragging=!1,this.addUndoStep()},N.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},N.prototype.onKeyUp=function(T){this._currentMarker===void 0||this.notesArea!==void 0||T.key!=="Delete"&&T.key!=="Backspace"||this.deleteSelectedMarker()},N.prototype.clientToLocalCoordinates=function(T,R){var z=this.markerImage.getBoundingClientRect();return{x:(T-z.left)/this.zoomLevel,y:(R-z.top)/this.zoomLevel}},N.prototype.onWindowResize=function(){this.positionUI()},N.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()},N.prototype.addLicenseKey=function(T){W.addKey(T)},N.prototype.addEventListener=function(T,R){this.eventListeners.addEventListener(T,R)},N.prototype.removeEventListener=function(T,R){this.eventListeners.removeEventListener(T,R)},N.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(N.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),N.prototype.focus=function(){var T=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(R){return R(new Se(T))}))},N.prototype.blur=function(){var T=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(R){return R(new Se(T))}))},N.instanceCounter=0,N}()},"VrN/":function(yt,it,se){(function(he,Y){yt.exports=Y()})(this,function(){"use strict";var he=navigator.userAgent,Y=navigator.platform,L=/gecko\/\d/i.test(he),X=/MSIE \d/.test(he),I=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(he),k=/Edge\/(\d+)/.exec(he),W=X||I||k,F=W&&(X?document.documentMode||6:+(k||I)[1]),O=!k&&/WebKit\//.test(he),D=O&&/Qt\/\d+\.\d+/.test(he),E=!k&&/Chrome\//.test(he),w=/Opera\//.test(he),P=/Apple Computer/.test(navigator.vendor),_=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(he),A=/PhantomJS/.test(he),C=!k&&/AppleWebKit/.test(he)&&/Mobile\/\w+/.test(he),c=/Android/.test(he),o=C||c||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(he),u=C||/Mac/.test(Y),d=/\bCrOS\b/.test(he),x=/win/i.test(Y),v=w&&he.match(/Version\/(\d*\.\d*)/);v&&(v=Number(v[1])),v&&v>=15&&(w=!1,O=!0);var f=u&&(D||w&&(v==null||v<12.11)),l=L||W&&F>=9;function b(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var h=function(e,t){var n=e.className,r=b(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function p(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function s(e,t){return p(e).appendChild(t)}function a(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var S=0;S<t.length;++S)i.appendChild(t[S]);return i}function g(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var m;document.createRange?m=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:m=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function y(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function M(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function H(e,t){var n=e.className;b(t).test(n)||(e.className+=(n?" ":"")+t)}function V(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!b(n[r]).test(t)&&(t+=" "+n[r]);return t}var te=function(e){e.select()};C?te=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:W&&(te=function(e){try{e.select()}catch(t){}});function G(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function j(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function ie(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var S=r||0,U=i||0;;){var K=e.indexOf(" ",S);if(K<0||K>=t)return U+(t-S);U+=K-S,U+=n-U%n,S=K+1}}var pe=function(){this.id=null,this.f=null,this.time=0,this.handler=G(this.onTimeout,this)};pe.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},pe.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function ge(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var be=50,Ne={toString:function(){return"CodeMirror.Pass"}},Se={scroll:!1},Me={origin:"*mouse"},Le={origin:"+move"};function we(e,t,n){for(var r=0,i=0;;){var S=e.indexOf(" ",r);S==-1&&(S=e.length);var U=S-r;if(S==e.length||i+U>=t)return r+Math.min(U,t-i);if(i+=S-r,i+=n-i%n,r=S+1,i>=t)return r}}var ve=[""];function N(e){for(;ve.length<=e;)ve.push(T(ve)+" ");return ve[e]}function T(e){return e[e.length-1]}function R(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function z(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function Z(){}function B(e,t){var n;return Object.create?n=Object.create(e):(Z.prototype=e,n=new Z),t&&j(t,n),n}var ce=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Ee(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||ce.test(e))}function Ae(e,t){return t?t.source.indexOf("\\w")>-1&&Ee(e)?!0:t.test(e):Ee(e)}function Oe(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Re=/[\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 De(e){return e.charCodeAt(0)>=768&&Re.test(e)}function Pe(e,t,n){for(;(n<0?t>0:t<e.length)&&De(e.charAt(t));)t+=n;return t}function Ke(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,S=r<0?Math.ceil(i):Math.floor(i);if(S==t)return e(S)?t:n;e(S)?n=S:t=S+r}}function Xe(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,S=0;S<e.length;++S){var U=e[S];(U.from<n&&U.to>t||t==n&&U.to==t)&&(r(Math.max(U.from,t),Math.min(U.to,n),U.level==1?"rtl":"ltr",S),i=!0)}i||r(t,n,"ltr")}var Ye=null;function $e(e,t,n){var r;Ye=null;for(var i=0;i<e.length;++i){var S=e[i];if(S.from<t&&S.to>t)return i;S.to==t&&(S.from!=S.to&&n=="before"?r=i:Ye=i),S.from==t&&(S.from!=S.to&&n!="before"?r=i:Ye=i)}return r!=null?r:Ye}var ft=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(re){return re<=247?e.charAt(re):1424<=re&&re<=1524?"R":1536<=re&&re<=1785?t.charAt(re-1536):1774<=re&&re<=2220?"r":8192<=re&&re<=8203?"w":re==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,S=/[LRr]/,U=/[Lb1n]/,K=/[1n]/;function $(re,fe,me){this.level=re,this.from=fe,this.to=me}return function(re,fe){var me=fe=="ltr"?"L":"R";if(re.length==0||fe=="ltr"&&!r.test(re))return!1;for(var _e=re.length,xe=[],Ie=0;Ie<_e;++Ie)xe.push(n(re.charCodeAt(Ie)));for(var je=0,Ve=me;je<_e;++je){var Qe=xe[je];Qe=="m"?xe[je]=Ve:Ve=Qe}for(var ut=0,Ze=me;ut<_e;++ut){var pt=xe[ut];pt=="1"&&Ze=="r"?xe[ut]="n":S.test(pt)&&(Ze=pt,pt=="r"&&(xe[ut]="R"))}for(var Pt=1,Tt=xe[0];Pt<_e-1;++Pt){var Wt=xe[Pt];Wt=="+"&&Tt=="1"&&xe[Pt+1]=="1"?xe[Pt]="1":Wt==","&&Tt==xe[Pt+1]&&(Tt=="1"||Tt=="n")&&(xe[Pt]=Tt),Tt=Wt}for(var er=0;er<_e;++er){var Sr=xe[er];if(Sr==",")xe[er]="N";else if(Sr=="%"){var ar=void 0;for(ar=er+1;ar<_e&&xe[ar]=="%";++ar);for(var Gr=er&&xe[er-1]=="!"||ar<_e&&xe[ar]=="1"?"1":"N",Fr=er;Fr<ar;++Fr)xe[Fr]=Gr;er=ar-1}}for(var pr=0,jr=me;pr<_e;++pr){var Ar=xe[pr];jr=="L"&&Ar=="1"?xe[pr]="L":S.test(Ar)&&(jr=Ar)}for(var vr=0;vr<_e;++vr)if(i.test(xe[vr])){var mr=void 0;for(mr=vr+1;mr<_e&&i.test(xe[mr]);++mr);for(var ur=(vr?xe[vr-1]:me)=="L",Wr=(mr<_e?xe[mr]:me)=="L",si=ur==Wr?ur?"L":"R":me,An=vr;An<mr;++An)xe[An]=si;vr=mr-1}for(var Pr=[],hn,Cr=0;Cr<_e;)if(U.test(xe[Cr])){var Va=Cr;for(++Cr;Cr<_e&&U.test(xe[Cr]);++Cr);Pr.push(new $(0,Va,Cr))}else{var vn=Cr,Wn=Pr.length,Hn=fe=="rtl"?1:0;for(++Cr;Cr<_e&&xe[Cr]!="L";++Cr);for(var Mr=vn;Mr<Cr;)if(K.test(xe[Mr])){vn<Mr&&(Pr.splice(Wn,0,new $(1,vn,Mr)),Wn+=Hn);var li=Mr;for(++Mr;Mr<Cr&&K.test(xe[Mr]);++Mr);Pr.splice(Wn,0,new $(2,li,Mr)),Wn+=Hn,vn=Mr}else++Mr;vn<Cr&&Pr.splice(Wn,0,new $(1,vn,Cr))}return fe=="ltr"&&(Pr[0].level==1&&(hn=re.match(/^\s+/))&&(Pr[0].from=hn[0].length,Pr.unshift(new $(0,0,hn[0].length))),T(Pr).level==1&&(hn=re.match(/\s+$/))&&(T(Pr).to-=hn[0].length,Pr.push(new $(0,_e-hn[0].length,_e)))),fe=="rtl"?Pr.reverse():Pr}}();function Je(e,t){var n=e.order;return n==null&&(n=e.order=ft(e.text,t)),n}var et=[],ke=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||et).concat(n)}};function st(e,t){return e._handlers&&e._handlers[t]||et}function nt(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var S=ge(i,n);S>-1&&(r[t]=i.slice(0,S).concat(i.slice(S+1)))}}}function oe(e,t){var n=st(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function J(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),oe(e,n||t.type,e,t),ae(t)||t.codemirrorIgnore}function Q(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)ge(n,t[r])==-1&&n.push(t[r])}function ne(e,t){return st(e,t).length>0}function le(e){e.prototype.on=function(t,n){ke(this,t,n)},e.prototype.off=function(t,n){nt(this,t,n)}}function q(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ee(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ae(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ue(e){q(e),ee(e)}function de(e){return e.target||e.srcElement}function ye(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),u&&e.ctrlKey&&t==1&&(t=3),t}var Te=function(){if(W&&F<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),Fe;function He(e){if(Fe==null){var t=a("span","\u200B");s(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Fe=t.offsetWidth<=1&&t.offsetHeight>2&&!(W&&F<8))}var n=Fe?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var at;function Lt(e){if(at!=null)return at;var t=s(e,document.createTextNode("A\u062EA")),n=m(t,0,1).getBoundingClientRect(),r=m(t,1,2).getBoundingClientRect();return p(e),!n||n.left==n.right?!1:at=r.right-n.right<3}var Ge=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
|
|
`,t);i==-1&&(i=e.length);var S=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),U=S.indexOf("\r");U!=-1?(n.push(S.slice(0,U)),t+=U+1):(n.push(S),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},tt=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Dt=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ct=null;function Rt(e){if(ct!=null)return ct;var t=s(e,a("span","x")),n=t.getBoundingClientRect(),r=m(t,0,1).getBoundingClientRect();return ct=Math.abs(n.left-r.left)>1}var jt={},xt={};function Kt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),jt[e]=t}function Vt(e,t){xt[e]=t}function Ut(e){if(typeof e=="string"&&xt.hasOwnProperty(e))e=xt[e];else if(e&&typeof e.name=="string"&&xt.hasOwnProperty(e.name)){var t=xt[e.name];typeof t=="string"&&(t={name:t}),e=B(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ut("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ut("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Nt(e,t){t=Ut(t);var n=jt[t.name];if(!n)return Nt(e,"text/plain");var r=n(e,t);if(It.hasOwnProperty(t.name)){var i=It[t.name];for(var S in i){if(!i.hasOwnProperty(S))continue;r.hasOwnProperty(S)&&(r["_"+S]=r[S]),r[S]=i[S]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var U in t.modeProps)r[U]=t.modeProps[U];return r}var It={};function Bt(e,t){var n=It.hasOwnProperty(e)?It[e]:It[e]={};j(t,n)}function Ct(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function wt(e,t){for(var n;e.innerMode&&!(n=e.innerMode(t),!n||n.mode==e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function mt(e,t,n){return e.startState?e.startState(t,n):!0}var rt=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};rt.prototype.eol=function(){return this.pos>=this.string.length},rt.prototype.sol=function(){return this.pos==this.lineStart},rt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},rt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},rt.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},rt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},rt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},rt.prototype.skipToEnd=function(){this.pos=this.string.length},rt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},rt.prototype.backUp=function(e){this.pos-=e},rt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=ie(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?ie(this.string,this.lineStart,this.tabSize):0)},rt.prototype.indentation=function(){return ie(this.string,null,this.tabSize)-(this.lineStart?ie(this.string,this.lineStart,this.tabSize):0)},rt.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(U){return n?U.toLowerCase():U},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var S=this.string.slice(this.pos).match(e);return S&&S.index>0?null:(S&&t!==!1&&(this.pos+=S[0].length),S)}},rt.prototype.current=function(){return this.string.slice(this.start,this.pos)},rt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},rt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},rt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function Ue(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],S=i.chunkSize();if(t<S){n=i;break}t-=S}return n.lines[t]}function St(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(S){var U=S.text;i==n.line&&(U=U.slice(0,n.ch)),i==t.line&&(U=U.slice(t.ch)),r.push(U),++i}),r}function Ot(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function vt(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function _t(e){if(e.parent==null)return null;for(var t=e.parent,n=ge(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;!(r.children[i]==t);++i)n+=r.children[i].chunkSize();return n+t.first}function Ht(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],S=i.height;if(t<S){e=i;continue e}t-=S,n+=i.chunkSize()}return n}while(!e.lines);for(var U=0;U<e.lines.length;++U){var K=e.lines[U],$=K.height;if(t<$)break;t-=$}return n+U}function Gt(e,t){return t>=e.first&&t<e.first+e.size}function ot(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Be(e,t,n){if(n===void 0&&(n=null),!(this instanceof Be))return new Be(e,t,n);this.line=e,this.ch=t,this.sticky=n}function dt(e,t){return e.line-t.line||e.ch-t.ch}function yr(e,t){return e.sticky==t.sticky&&dt(e,t)==0}function an(e){return Be(e.line,e.ch)}function on(e,t){return dt(e,t)<0?t:e}function or(e,t){return dt(e,t)<0?e:t}function Ft(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function gt(e,t){if(t.line<e.first)return Be(e.first,0);var n=e.first+e.size-1;return t.line>n?Be(n,Ue(e,n).text.length):ir(t,Ue(e,t.line).text.length)}function ir(e,t){var n=e.ch;return n==null||n>t?Be(e.line,t):n<0?Be(e.line,0):e}function We(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=gt(e,t[r]);return n}var dr=function(e,t){this.state=e,this.lookAhead=t},_r=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};_r.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},_r.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},_r.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},_r.fromSaved=function(e,t,n){return t instanceof dr?new _r(e,Ct(e.mode,t.state),n,t.lookAhead):new _r(e,Ct(e.mode,t),n)},_r.prototype.save=function(e){var t=e!==!1?Ct(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new dr(t,this.maxLookAhead):t};function sn(e,t,n,r){var i=[e.state.modeGen],S={};Vr(e,t.text,e.doc.mode,n,function(re,fe){return i.push(re,fe)},S,r);for(var U=n.state,K=function(re){n.baseTokens=i;var fe=e.state.overlays[re],me=1,_e=0;n.state=!0,Vr(e,t.text,fe.mode,n,function(xe,Ie){for(var je=me;_e<xe;){var Ve=i[me];Ve>xe&&i.splice(me,1,xe,i[me+1],Ve),me+=2,_e=Math.min(xe,Ve)}if(!Ie)return;if(fe.opaque)i.splice(je,me-je,xe,"overlay "+Ie),me=je+2;else for(;je<me;je+=2){var Qe=i[je+1];i[je+1]=(Qe?Qe+" ":"")+"overlay "+Ie}},S),n.state=U,n.baseTokens=null,n.baseTokenPos=1},$=0;$<e.state.overlays.length;++$)K($);return{styles:i,classes:S.bgClass||S.textClass?S:null}}function fn(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=zr(e,_t(t)),i=t.text.length>e.options.maxHighlightLength&&Ct(e.doc.mode,r.state),S=sn(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=S.styles,S.classes?t.styleClasses=S.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function zr(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new _r(r,!0,t);var S=Gn(e,t,n),U=S>r.first&&Ue(r,S-1).stateAfter,K=U?_r.fromSaved(r,U,S):new _r(r,mt(r.mode),S);return r.iter(S,t,function($){Ln(e,$.text,K);var re=K.line;$.stateAfter=re==t-1||re%5==0||re>=i.viewFrom&&re<i.viewTo?K.save():null,K.nextLine()}),n&&(r.modeFrontier=K.line),K}function Ln(e,t,n,r){var i=e.doc.mode,S=new rt(t,e.options.tabSize,n);for(S.start=S.pos=r||0,t==""&&Rn(i,n.state);!S.eol();)Kr(i,S,n.state),S.start=S.pos}function Rn(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=wt(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function Kr(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=wt(e,n).mode);var S=e.token(t,n);if(t.pos>t.start)return S}throw new Error("Mode "+e.name+" failed to advance stream.")}var ln=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function kn(e,t,n,r){var i=e.doc,S=i.mode,U;t=gt(i,t);var K=Ue(i,t.line),$=zr(e,t.line,n),re=new rt(K.text,e.options.tabSize,$),fe;for(r&&(fe=[]);(r||re.pos<t.ch)&&!re.eol();)re.start=re.pos,U=Kr(S,re,$.state),r&&fe.push(new ln(re,U,Ct(i.mode,$.state)));return r?fe:new ln(re,U,$.state)}function yn(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function Vr(e,t,n,r,i,S,U){var K=n.flattenSpans;K==null&&(K=e.options.flattenSpans);var $=0,re=null,fe=new rt(t,e.options.tabSize,r),me,_e=e.options.addModeClass&&[null];for(t==""&&yn(Rn(n,r.state),S);!fe.eol();){if(fe.pos>e.options.maxHighlightLength?(K=!1,U&&Ln(e,t,r,fe.pos),fe.pos=t.length,me=null):me=yn(Kr(n,fe,r.state,_e),S),_e){var xe=_e[0].name;xe&&(me="m-"+(me?xe+" "+me:xe))}if(!K||re!=me){for(;$<fe.start;)$=Math.min(fe.start,$+5e3),i($,re);re=me}fe.start=fe.pos}for(;$<fe.pos;){var Ie=Math.min(fe.pos,$+5e3);i(Ie,re),$=Ie}}function Gn(e,t,n){for(var r,i,S=e.doc,U=n?-1:t-(e.doc.mode.innerMode?1e3:100),K=t;K>U;--K){if(K<=S.first)return S.first;var $=Ue(S,K-1),re=$.stateAfter;if(re&&(!n||K+(re instanceof dr?re.lookAhead:0)<=S.modeFrontier))return K;var fe=ie($.text,null,e.options.tabSize);(i==null||r>fe)&&(i=K-1,r=fe)}return i}function Ui(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var n=e.first,r=t-1;r>n;r--){var i=Ue(e,r).stateAfter;if(i&&(!(i instanceof dr)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Pn=!1,br=!1;function qe(){Pn=!0}function Ce(){br=!0}function ze(e,t,n){this.marker=e,this.from=t,this.to=n}function bt(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function lt(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function ht(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function kt(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var S=e[i],U=S.marker,K=S.from==null||(U.inclusiveLeft?S.from<=t:S.from<t);if(K||S.from==t&&U.type=="bookmark"&&(!n||!S.marker.insertLeft)){var $=S.to==null||(U.inclusiveRight?S.to>=t:S.to>t);(r||(r=[])).push(new ze(U,S.from,$?null:S.to))}}return r}function tr(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var S=e[i],U=S.marker,K=S.to==null||(U.inclusiveRight?S.to>=t:S.to>t);if(K||S.from==t&&U.type=="bookmark"&&(!n||S.marker.insertLeft)){var $=S.from==null||(U.inclusiveLeft?S.from<=t:S.from<t);(r||(r=[])).push(new ze(U,$?null:S.from-t,S.to==null?null:S.to-t))}}return r}function rr(e,t){if(t.full)return null;var n=Gt(e,t.from.line)&&Ue(e,t.from.line).markedSpans,r=Gt(e,t.to.line)&&Ue(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,S=t.to.ch,U=dt(t.from,t.to)==0,K=kt(n,i,U),$=tr(r,S,U),re=t.text.length==1,fe=T(t.text).length+(re?i:0);if(K)for(var me=0;me<K.length;++me){var _e=K[me];if(_e.to==null){var xe=bt($,_e.marker);xe?re&&(_e.to=xe.to==null?null:xe.to+fe):_e.to=i}}if($)for(var Ie=0;Ie<$.length;++Ie){var je=$[Ie];if(je.to!=null&&(je.to+=fe),je.from==null){var Ve=bt(K,je.marker);Ve||(je.from=fe,re&&(K||(K=[])).push(je))}else je.from+=fe,re&&(K||(K=[])).push(je)}K&&(K=sr(K)),$&&$!=K&&($=sr($));var Qe=[K];if(!re){var ut=t.text.length-2,Ze;if(ut>0&&K)for(var pt=0;pt<K.length;++pt)K[pt].to==null&&(Ze||(Ze=[])).push(new ze(K[pt].marker,null,null));for(var Pt=0;Pt<ut;++Pt)Qe.push(Ze);Qe.push($)}return Qe}function sr(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Lr(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(xe){if(xe.markedSpans)for(var Ie=0;Ie<xe.markedSpans.length;++Ie){var je=xe.markedSpans[Ie].marker;je.readOnly&&(!r||ge(r,je)==-1)&&(r||(r=[])).push(je)}}),!r)return null;for(var i=[{from:t,to:n}],S=0;S<r.length;++S)for(var U=r[S],K=U.find(0),$=0;$<i.length;++$){var re=i[$];if(dt(re.to,K.from)<0||dt(re.from,K.to)>0)continue;var fe=[$,1],me=dt(re.from,K.from),_e=dt(re.to,K.to);(me<0||!U.inclusiveLeft&&!me)&&fe.push({from:re.from,to:K.from}),(_e>0||!U.inclusiveRight&&!_e)&&fe.push({from:K.to,to:re.to}),i.splice.apply(i,fe),$+=fe.length-3}return i}function cr(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function Dr(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function fr(e){return e.inclusiveLeft?-1:0}function Zr(e){return e.inclusiveRight?1:0}function Tr(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),S=dt(r.from,i.from)||fr(e)-fr(t);if(S)return-S;var U=dt(r.to,i.to)||Zr(e)-Zr(t);return U||t.id-e.id}function lr(e,t){var n=br&&e.markedSpans,r;if(n)for(var i=void 0,S=0;S<n.length;++S)i=n[S],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||Tr(r,i.marker)<0)&&(r=i.marker);return r}function Xr(e){return lr(e,!0)}function Yr(e){return lr(e,!1)}function zn(e,t){var n=br&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var S=n[i];S.marker.collapsed&&(S.from==null||S.from<t)&&(S.to==null||S.to>t)&&(!r||Tr(r,S.marker)<0)&&(r=S.marker)}return r}function Bi(e,t,n,r,i){var S=Ue(e,t),U=br&&S.markedSpans;if(U)for(var K=0;K<U.length;++K){var $=U[K];if(!$.marker.collapsed)continue;var re=$.marker.find(0),fe=dt(re.from,n)||fr($.marker)-fr(i),me=dt(re.to,r)||Zr($.marker)-Zr(i);if(fe>=0&&me<=0||fe<=0&&me>=0)continue;if(fe<=0&&($.marker.inclusiveRight&&i.inclusiveLeft?dt(re.to,n)>=0:dt(re.to,n)>0)||fe>=0&&($.marker.inclusiveRight&&i.inclusiveLeft?dt(re.from,r)<=0:dt(re.from,r)<0))return!0}}function $r(e){for(var t;t=Xr(e);)e=t.find(-1,!0).line;return e}function Fi(e){for(var t;t=Yr(e);)e=t.find(1,!0).line;return e}function Kn(e){for(var t,n;t=Yr(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function ui(e,t){var n=Ue(e,t),r=$r(n);return n==r?t:_t(r)}function bn(e,t){if(t>e.lastLine())return t;var n=Ue(e,t),r;if(!un(e,n))return t;for(;r=Yr(n);)n=r.find(1,!0).line;return _t(n)+1}function un(e,t){var n=br&&t.markedSpans;if(n)for(var r=void 0,i=0;i<n.length;++i){if(r=n[i],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&di(e,t,r))return!0}}function di(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return di(e,r.line,bt(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,S=0;S<t.markedSpans.length;++S)if(i=t.markedSpans[S],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&di(e,t,i))return!0}function en(e){e=$r(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var S=n.parent;S;n=S,S=n.parent)for(var U=0;U<S.children.length;++U){var K=S.children[U];if(K==n)break;t+=K.height}return t}function ci(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Xr(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Yr(r);){var S=n.find(0,!0);t-=r.text.length-S.from.ch,r=S.to.line,t+=r.text.length-S.to.ch}return t}function ji(e){var t=e.display,n=e.doc;t.maxLine=Ue(n,n.first),t.maxLineLength=ci(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=ci(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Dn=function(e,t,n){this.text=e,Dr(this,t),this.height=n?n(this):1};Dn.prototype.lineNo=function(){return _t(this)},le(Dn);function ua(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),cr(e),Dr(e,n);var i=r?r(e):1;i!=e.height&&vt(e,i)}function Et(e){e.parent=null,cr(e)}var Mt={},At={};function zt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?At:Mt;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function $t(e,t){var n=g("span",null,null,O?"padding-right: .1px":null),r={pre:g("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var S=i?t.rest[i-1]:t.line,U=void 0;r.pos=0,r.addToken=Yt,Lt(e.display.measure)&&(U=Je(S,e.doc.direction))&&(r.addToken=Ir(r.addToken,U)),r.map=[];var K=t!=e.display.externalMeasured&&_t(S);pn(S,r,fn(e,S,K)),S.styleClasses&&(S.styleClasses.bgClass&&(r.bgClass=V(S.styleClasses.bgClass,r.bgClass||"")),S.styleClasses.textClass&&(r.textClass=V(S.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(He(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(O){var $=r.content.lastChild;(/\bcm-tab\b/.test($.className)||$.querySelector&&$.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return oe(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=V(r.pre.className,r.textClass||"")),r}function qt(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Yt(e,t,n,r,i,S,U){if(!t)return;var K=e.splitSpaces?gr(t,e.trailingSpace):t,$=e.cm.state.specialChars,re=!1,fe;if(!$.test(t))e.col+=t.length,fe=document.createTextNode(K),e.map.push(e.pos,e.pos+t.length,fe),W&&F<9&&(re=!0),e.pos+=t.length;else{fe=document.createDocumentFragment();for(var me=0;;){$.lastIndex=me;var _e=$.exec(t),xe=_e?_e.index-me:t.length-me;if(xe){var Ie=document.createTextNode(K.slice(me,me+xe));W&&F<9?fe.appendChild(a("span",[Ie])):fe.appendChild(Ie),e.map.push(e.pos,e.pos+xe,Ie),e.col+=xe,e.pos+=xe}if(!_e)break;me+=xe+1;var je=void 0;if(_e[0]==" "){var Ve=e.cm.options.tabSize,Qe=Ve-e.col%Ve;je=fe.appendChild(a("span",N(Qe),"cm-tab")),je.setAttribute("role","presentation"),je.setAttribute("cm-text"," "),e.col+=Qe}else _e[0]=="\r"||_e[0]==`
|
|
`?(je=fe.appendChild(a("span",_e[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),je.setAttribute("cm-text",_e[0]),e.col+=1):(je=e.cm.options.specialCharPlaceholder(_e[0]),je.setAttribute("cm-text",_e[0]),W&&F<9?fe.appendChild(a("span",[je])):fe.appendChild(je),e.col+=1);e.map.push(e.pos,e.pos+1,je),e.pos++}}if(e.trailingSpace=K.charCodeAt(t.length-1)==32,n||r||i||re||S||U){var ut=n||"";r&&(ut+=r),i&&(ut+=i);var Ze=a("span",[fe],ut,S);if(U)for(var pt in U)U.hasOwnProperty(pt)&&pt!="style"&&pt!="class"&&Ze.setAttribute(pt,U[pt]);return e.content.appendChild(Ze)}e.content.appendChild(fe)}function gr(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var S=e.charAt(i);S==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(S="\xA0"),r+=S,n=S==" "}return r}function Ir(e,t){return function(n,r,i,S,U,K,$){i=i?i+" cm-force-border":"cm-force-border";for(var re=n.pos,fe=re+r.length;;){for(var me=void 0,_e=0;_e<t.length&&!(me=t[_e],me.to>re&&me.from<=re);_e++);if(me.to>=fe)return e(n,r,i,S,U,K,$);e(n,r.slice(0,me.to-re),i,S,null,K,$),S=null,r=r.slice(me.to-re),re=me.to}}}function Xt(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function pn(e,t,n){var r=e.markedSpans,i=e.text,S=0;if(!r){for(var U=1;U<n.length;U+=2)t.addToken(t,i.slice(S,S=n[U]),zt(n[U+1],t.cm.options));return}for(var K=i.length,$=0,re=1,fe="",me,_e,xe=0,Ie,je,Ve,Qe,ut;;){if(xe==$){Ie=je=Ve=_e="",ut=null,Qe=null,xe=Infinity;for(var Ze=[],pt=void 0,Pt=0;Pt<r.length;++Pt){var Tt=r[Pt],Wt=Tt.marker;if(Wt.type=="bookmark"&&Tt.from==$&&Wt.widgetNode)Ze.push(Wt);else if(Tt.from<=$&&(Tt.to==null||Tt.to>$||Wt.collapsed&&Tt.to==$&&Tt.from==$)){if(Tt.to!=null&&Tt.to!=$&&xe>Tt.to&&(xe=Tt.to,je=""),Wt.className&&(Ie+=" "+Wt.className),Wt.css&&(_e=(_e?_e+";":"")+Wt.css),Wt.startStyle&&Tt.from==$&&(Ve+=" "+Wt.startStyle),Wt.endStyle&&Tt.to==xe&&(pt||(pt=[])).push(Wt.endStyle,Tt.to),Wt.title&&((ut||(ut={})).title=Wt.title),Wt.attributes)for(var er in Wt.attributes)(ut||(ut={}))[er]=Wt.attributes[er];Wt.collapsed&&(!Qe||Tr(Qe.marker,Wt)<0)&&(Qe=Tt)}else Tt.from>$&&xe>Tt.from&&(xe=Tt.from)}if(pt)for(var Sr=0;Sr<pt.length;Sr+=2)pt[Sr+1]==xe&&(je+=" "+pt[Sr]);if(!Qe||Qe.from==$)for(var ar=0;ar<Ze.length;++ar)Xt(t,0,Ze[ar]);if(Qe&&(Qe.from||0)==$){if(Xt(t,(Qe.to==null?K+1:Qe.to)-$,Qe.marker,Qe.from==null),Qe.to==null)return;Qe.to==$&&(Qe=!1)}}if($>=K)break;for(var Gr=Math.min(K,xe);;){if(fe){var Fr=$+fe.length;if(!Qe){var pr=Fr>Gr?fe.slice(0,Gr-$):fe;t.addToken(t,pr,me?me+Ie:Ie,Ve,$+pr.length==xe?je:"",_e,ut)}if(Fr>=Gr){fe=fe.slice(Gr-$),$=Gr;break}$=Fr,Ve=""}fe=i.slice(S,S=n[re++]),me=zt(n[re++],t.cm.options)}}}function Jt(e,t,n){this.line=t,this.rest=Kn(t),this.size=this.rest?_t(T(this.rest))-n+1:1,this.node=this.text=null,this.hidden=un(e,t)}function Nr(e,t,n){for(var r=[],i,S=t;S<n;S=i){var U=new Jt(e.doc,Ue(e.doc,S),S);i=S+U.size,r.push(U)}return r}var Rr=null;function qr(e){Rr?Rr.ops.push(e):e.ownsGroup=Rr={ops:[e],delayedCallbacks:[]}}function ks(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function Ps(e,t){var n=e.ownsGroup;if(!n)return;try{ks(n)}finally{Rr=null,t(n)}}var hi=null;function wr(e,t){var n=st(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;Rr?i=Rr.delayedCallbacks:hi?i=hi:(i=hi=[],setTimeout(Ds,0));for(var S=function(K){i.push(function(){return n[K].apply(null,r)})},U=0;U<n.length;++U)S(U)}function Ds(){var e=hi;hi=null;for(var t=0;t<e.length;++t)e[t]()}function Ya(e,t,n,r){for(var i=0;i<t.changes.length;i++){var S=t.changes[i];S=="text"?Ms(e,t):S=="gutter"?Ja(e,t,n,r):S=="class"?da(e,t):S=="widget"&&Is(e,t,r)}t.changes=null}function fi(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),W&&F<8&&(e.node.style.zIndex=2)),e.node}function Os(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=fi(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):$t(e,t)}function Ms(e,t){var n=t.text.className,r=$a(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,da(e,t)):n&&(t.text.className=n)}function da(e,t){Os(e,t),t.line.wrapClass?fi(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Ja(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=fi(t);t.gutterBackground=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var S=t.line.gutterMarkers;if(e.options.lineNumbers||S){var U=fi(t),K=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(K),U.insertBefore(K,t.text),t.line.gutterClass&&(K.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!S||!S["CodeMirror-linenumbers"])&&(t.lineNumber=K.appendChild(a("div",ot(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),S)for(var $=0;$<e.display.gutterSpecs.length;++$){var re=e.display.gutterSpecs[$].className,fe=S.hasOwnProperty(re)&&S[re];fe&&K.appendChild(a("div",[fe],"CodeMirror-gutter-elt","left: "+r.gutterLeft[re]+"px; width: "+r.gutterWidth[re]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=b("CodeMirror-linewidget"),i=t.node.firstChild,S=void 0;i;i=S)S=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);Qa(e,t,n)}function Ns(e,t,n,r){var i=$a(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),da(e,t),Ja(e,t,n,r),Qa(e,t,r),t.node}function Qa(e,t,n){if(Za(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Za(e,t.rest[r],t,n,!1)}function Za(e,t,n,r,i){if(!t.widgets)return;for(var S=fi(n),U=0,K=t.widgets;U<K.length;++U){var $=K[U],re=a("div",[$.node],"CodeMirror-linewidget"+($.className?" "+$.className:""));$.handleMouseEvents||re.setAttribute("cm-ignore-events","true"),Us($,re,n,r),e.display.input.setUneditable(re),i&&$.above?S.insertBefore(re,n.gutter||n.text):S.appendChild(re),wr($,"redraw")}}function Us(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function pi(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!y(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),s(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function mn(e,t){for(var n=de(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function Wi(e){return e.lineSpace.offsetTop}function ca(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=s(e.measure,a("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function dn(e){return be-e.display.nativeBarWidth}function On(e){return e.display.scroller.clientWidth-dn(e)-e.display.barWidth}function ha(e){return e.display.scroller.clientHeight-dn(e)-e.display.barHeight}function Bs(e,t,n){var r=e.options.lineWrapping,i=r&&On(e);if(!t.measure.heights||r&&t.measure.width!=i){var S=t.measure.heights=[];if(r){t.measure.width=i;for(var U=t.text.firstChild.getClientRects(),K=0;K<U.length-1;K++){var $=U[K],re=U[K+1];Math.abs($.bottom-re.bottom)>2&&S.push(($.bottom+re.top)/2-n.top)}}S.push(n.bottom-n.top)}}function eo(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(_t(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Fs(e,t){t=$r(t);var n=_t(t),r=e.display.externalMeasured=new Jt(e.doc,t,n);r.lineN=n;var i=r.built=$t(e,r);return r.text=i.pre,s(e.display.lineMeasure,i.pre),r}function to(e,t,n,r){return cn(e,Vn(e,t),n,r)}function fa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Nn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Vn(e,t){var n=_t(t),r=fa(e,n);r&&!r.text?r=null:r&&r.changes&&(Ya(e,r,n,ba(e)),e.curOp.forceUpdate=!0),r||(r=Fs(e,t));var i=eo(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function cn(e,t,n,r,i){t.before&&(n=-1);var S=n+(r||""),U;return t.cache.hasOwnProperty(S)?U=t.cache[S]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Bs(e,t.view,t.rect),t.hasHeights=!0),U=Ws(e,t,n,r),U.bogus||(t.cache[S]=U)),{left:U.left,right:U.right,top:i?U.rtop:U.top,bottom:i?U.rbottom:U.bottom}}var ro={left:0,right:0,top:0,bottom:0};function no(e,t,n){for(var r,i,S,U,K,$,re=0;re<e.length;re+=3)if(K=e[re],$=e[re+1],t<K?(i=0,S=1,U="left"):t<$?(i=t-K,S=i+1):(re==e.length-3||t==$&&e[re+3]>t)&&(S=$-K,i=S-1,t>=$&&(U="right")),i!=null){if(r=e[re+2],K==$&&n==(r.insertLeft?"left":"right")&&(U=n),n=="left"&&i==0)for(;re&&e[re-2]==e[re-3]&&e[re-1].insertLeft;)r=e[(re-=3)+2],U="left";if(n=="right"&&i==$-K)for(;re<e.length-3&&e[re+3]==e[re+4]&&!e[re+5].insertLeft;)r=e[(re+=3)+2],U="right";break}return{node:r,start:i,end:S,collapse:U,coverStart:K,coverEnd:$}}function js(e,t){var n=ro;if(t=="left")for(var r=0;r<e.length&&!((n=e[r]).left!=n.right);r++);else for(var i=e.length-1;i>=0&&!((n=e[i]).left!=n.right);i--);return n}function Ws(e,t,n,r){var i=no(t.map,n,r),S=i.node,U=i.start,K=i.end,$=i.collapse,re;if(S.nodeType==3){for(var fe=0;fe<4;fe++){for(;U&&De(t.line.text.charAt(i.coverStart+U));)--U;for(;i.coverStart+K<i.coverEnd&&De(t.line.text.charAt(i.coverStart+K));)++K;if(W&&F<9&&U==0&&K==i.coverEnd-i.coverStart?re=S.parentNode.getBoundingClientRect():re=js(m(S,U,K).getClientRects(),r),re.left||re.right||U==0)break;K=U,U=U-1,$="right"}W&&F<11&&(re=Hs(e.display.measure,re))}else{U>0&&($=r="right");var me;e.options.lineWrapping&&(me=S.getClientRects()).length>1?re=me[r=="right"?me.length-1:0]:re=S.getBoundingClientRect()}if(W&&F<9&&!U&&(!re||!re.left&&!re.right)){var _e=S.parentNode.getClientRects()[0];_e?re={left:_e.left,right:_e.left+Yn(e.display),top:_e.top,bottom:_e.bottom}:re=ro}for(var xe=re.top-t.rect.top,Ie=re.bottom-t.rect.top,je=(xe+Ie)/2,Ve=t.view.measure.heights,Qe=0;Qe<Ve.length-1&&!(je<Ve[Qe]);Qe++);var ut=Qe?Ve[Qe-1]:0,Ze=Ve[Qe],pt={left:($=="right"?re.right:re.left)-t.rect.left,right:($=="left"?re.left:re.right)-t.rect.left,top:ut,bottom:Ze};return!re.left&&!re.right&&(pt.bogus=!0),e.options.singleCursorHeightPerLine||(pt.rtop=xe,pt.rbottom=Ie),pt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Rt(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function io(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function ao(e){e.display.externalMeasure=null,p(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)io(e.display.view[t])}function mi(e){ao(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function oo(){return E&&c?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function so(){return E&&c?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pa(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=pi(e.widgets[n]));return t}function Hi(e,t,n,r,i){if(!i){var S=pa(t);n.top+=S,n.bottom+=S}if(r=="line")return n;r||(r="local");var U=en(t);if(r=="local"?U+=Wi(e.display):U-=e.display.viewOffset,r=="page"||r=="window"){var K=e.display.lineSpace.getBoundingClientRect();U+=K.top+(r=="window"?0:so());var $=K.left+(r=="window"?0:oo());n.left+=$,n.right+=$}return n.top+=U,n.bottom+=U,n}function lo(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=oo(),i-=so();else if(n=="local"||!n){var S=e.display.sizer.getBoundingClientRect();r+=S.left,i+=S.top}var U=e.display.lineSpace.getBoundingClientRect();return{left:r-U.left,top:i-U.top}}function ma(e,t,n,r,i){return r||(r=Ue(e.doc,t.line)),Hi(e,r,to(e,r,t.ch,i),n)}function tn(e,t,n,r,i,S){r=r||Ue(e.doc,t.line),i||(i=Vn(e,r));function U(Ie,je){var Ve=cn(e,i,Ie,je?"right":"left",S);return je?Ve.left=Ve.right:Ve.right=Ve.left,Hi(e,r,Ve,n)}var K=Je(r,e.doc.direction),$=t.ch,re=t.sticky;if($>=r.text.length?($=r.text.length,re="before"):$<=0&&($=0,re="after"),!K)return U(re=="before"?$-1:$,re=="before");function fe(Ie,je,Ve){var Qe=K[je],ut=Qe.level==1;return U(Ve?Ie-1:Ie,ut!=Ve)}var me=$e(K,$,re),_e=Ye,xe=fe($,me,re=="before");return _e!=null&&(xe.other=fe($,_e,re!="before")),xe}function uo(e,t){var n=0;t=gt(e.doc,t),e.options.lineWrapping||(n=Yn(e.display)*t.ch);var r=Ue(e.doc,t.line),i=en(r)+Wi(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function ga(e,t,n,r,i){var S=Be(e,t,n);return S.xRel=i,r&&(S.outside=r),S}function va(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return ga(r.first,0,null,-1,-1);var i=Ht(r,n),S=r.first+r.size-1;if(i>S)return ga(r.first+r.size-1,Ue(r,S).text.length,null,1,1);t<0&&(t=0);for(var U=Ue(r,i);;){var K=Gs(e,U,i,t,n),$=zn(U,K.ch+(K.xRel>0||K.outside>0?1:0));if(!$)return K;var re=$.find(1);if(re.line==i)return re;U=Ue(r,i=re.line)}}function co(e,t,n,r){r-=pa(t);var i=t.text.length,S=Ke(function(U){return cn(e,n,U-1).bottom<=r},i,0);return i=Ke(function(U){return cn(e,n,U).top>r},S,i),{begin:S,end:i}}function ho(e,t,n,r){n||(n=Vn(e,t));var i=Hi(e,t,cn(e,n,r),"line").top;return co(e,t,n,i)}function ya(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Gs(e,t,n,r,i){i-=en(t);var S=Vn(e,t),U=pa(t),K=0,$=t.text.length,re=!0,fe=Je(t,e.doc.direction);if(fe){var me=(e.options.lineWrapping?Ks:zs)(e,t,n,S,fe,r,i);re=me.level!=1,K=re?me.from:me.to-1,$=re?me.to:me.from-1}var _e=null,xe=null,Ie=Ke(function(Pt){var Tt=cn(e,S,Pt);return Tt.top+=U,Tt.bottom+=U,ya(Tt,r,i,!1)?(Tt.top<=i&&Tt.left<=r&&(_e=Pt,xe=Tt),!0):!1},K,$),je,Ve,Qe=!1;if(xe){var ut=r-xe.left<xe.right-r,Ze=ut==re;Ie=_e+(Ze?0:1),Ve=Ze?"after":"before",je=ut?xe.left:xe.right}else{!re&&(Ie==$||Ie==K)&&Ie++,Ve=Ie==0?"after":Ie==t.text.length?"before":cn(e,S,Ie-(re?1:0)).bottom+U<=i==re?"after":"before";var pt=tn(e,Be(n,Ie,Ve),"line",t,S);je=pt.left,Qe=i<pt.top?-1:i>=pt.bottom?1:0}return Ie=Pe(t.text,Ie,1),ga(n,Ie,Ve,Qe,r-je)}function zs(e,t,n,r,i,S,U){var K=Ke(function(me){var _e=i[me],xe=_e.level!=1;return ya(tn(e,Be(n,xe?_e.to:_e.from,xe?"before":"after"),"line",t,r),S,U,!0)},0,i.length-1),$=i[K];if(K>0){var re=$.level!=1,fe=tn(e,Be(n,re?$.from:$.to,re?"after":"before"),"line",t,r);ya(fe,S,U,!0)&&fe.top>U&&($=i[K-1])}return $}function Ks(e,t,n,r,i,S,U){var K=co(e,t,r,U),$=K.begin,re=K.end;/\s/.test(t.text.charAt(re-1))&&re--;for(var fe=null,me=null,_e=0;_e<i.length;_e++){var xe=i[_e];if(xe.from>=re||xe.to<=$)continue;var Ie=xe.level!=1,je=cn(e,r,Ie?Math.min(re,xe.to)-1:Math.max($,xe.from)).right,Ve=je<S?S-je+1e9:je-S;(!fe||me>Ve)&&(fe=xe,me=Ve)}return fe||(fe=i[i.length-1]),fe.from<$&&(fe={from:$,to:fe.to,level:fe.level}),fe.to>re&&(fe={from:fe.from,to:re,level:fe.level}),fe}var Mn;function Xn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Mn==null){Mn=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Mn.appendChild(document.createTextNode("x")),Mn.appendChild(a("br"));Mn.appendChild(document.createTextNode("x"))}s(e.measure,Mn);var n=Mn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),p(e.measure),n||1}function Yn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");s(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function ba(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,S=t.gutters.firstChild,U=0;S;S=S.nextSibling,++U){var K=e.display.gutterSpecs[U].className;n[K]=S.offsetLeft+S.clientLeft+i,r[K]=S.clientWidth}return{fixedPos:Ea(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ea(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function fo(e){var t=Xn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Yn(e.display)-3);return function(i){if(un(e.doc,i))return 0;var S=0;if(i.widgets)for(var U=0;U<i.widgets.length;U++)i.widgets[U].height&&(S+=i.widgets[U].height);return n?S+(Math.ceil(i.text.length/r)||1)*t:S+t}}function xa(e){var t=e.doc,n=fo(e);t.iter(function(r){var i=n(r);i!=r.height&&vt(r,i)})}function In(e,t,n,r){var i=e.display;if(!n&&de(t).getAttribute("cm-not-content")=="true")return null;var S,U,K=i.lineSpace.getBoundingClientRect();try{S=t.clientX-K.left,U=t.clientY-K.top}catch(me){return null}var $=va(e,S,U),re;if(r&&$.xRel>0&&(re=Ue(e.doc,$.line).text).length==$.ch){var fe=ie(re,re.length,e.options.tabSize)-re.length;$=Be($.line,Math.max(0,Math.round((S-qa(e.display).left)/Yn(e.display))-fe))}return $}function Nn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function Ur(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)br&&ui(e.doc,t)<i.viewTo&&xn(e);else if(n<=i.viewFrom)br&&bn(e.doc,n+r)>i.viewFrom?xn(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)xn(e);else if(t<=i.viewFrom){var S=Gi(e,n,n+r,1);S?(i.view=i.view.slice(S.index),i.viewFrom=S.lineN,i.viewTo+=r):xn(e)}else if(n>=i.viewTo){var U=Gi(e,t,t,-1);U?(i.view=i.view.slice(0,U.index),i.viewTo=U.lineN):xn(e)}else{var K=Gi(e,t,t,-1),$=Gi(e,n,n+r,1);K&&$?(i.view=i.view.slice(0,K.index).concat(Nr(e,K.lineN,$.lineN)).concat(i.view.slice($.index)),i.viewTo+=r):xn(e)}var re=i.externalMeasured;re&&(n<re.lineN?re.lineN+=r:t<re.lineN+re.size&&(i.externalMeasured=null))}function En(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var S=r.view[Nn(e,t)];if(S.node==null)return;var U=S.changes||(S.changes=[]);ge(U,n)==-1&&U.push(n)}function xn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Gi(e,t,n,r){var i=Nn(e,t),S,U=e.display.view;if(!br||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var K=e.display.viewFrom,$=0;$<i;$++)K+=U[$].size;if(K!=t){if(r>0){if(i==U.length-1)return null;S=K+U[i].size-t,i++}else S=K-t;t+=S,n+=S}for(;ui(e.doc,n)!=n;){if(i==(r<0?0:U.length-1))return null;n+=r*U[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Vs(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=Nr(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Nr(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Nn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(Nr(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,Nn(e,n)))),r.viewTo=n}function po(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function gi(e){e.display.input.showSelection(e.display.input.prepareSelection())}function mo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),S=r.selection=document.createDocumentFragment(),U=0;U<n.sel.ranges.length;U++){if(!t&&U==n.sel.primIndex)continue;var K=n.sel.ranges[U];if(K.from().line>=e.display.viewTo||K.to().line<e.display.viewFrom)continue;var $=K.empty();($||e.options.showCursorWhenSelecting)&&go(e,K.head,i),$||Xs(e,K,S)}return r}function go(e,t,n){var r=tn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(a("div","\xA0","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)*e.options.cursorHeight+"px",r.other){var S=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));S.style.display="",S.style.left=r.other.left+"px",S.style.top=r.other.top+"px",S.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function zi(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,i=e.doc,S=document.createDocumentFragment(),U=qa(e.display),K=U.left,$=Math.max(r.sizerWidth,On(e)-r.sizer.offsetLeft)-U.right,re=i.direction=="ltr";function fe(Ze,pt,Pt,Tt){pt<0&&(pt=0),pt=Math.round(pt),Tt=Math.round(Tt),S.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+Ze+`px;
|
|
top: `+pt+"px; width: "+(Pt==null?$-Ze:Pt)+`px;
|
|
height: `+(Tt-pt)+"px"))}function me(Ze,pt,Pt){var Tt=Ue(i,Ze),Wt=Tt.text.length,er,Sr;function ar(pr,jr){return ma(e,Be(Ze,pr),"div",Tt,jr)}function Gr(pr,jr,Ar){var vr=ho(e,Tt,null,pr),mr=jr=="ltr"==(Ar=="after")?"left":"right",ur=Ar=="after"?vr.begin:vr.end-(/\s/.test(Tt.text.charAt(vr.end-1))?2:1);return ar(ur,mr)[mr]}var Fr=Je(Tt,i.direction);return Xe(Fr,pt||0,Pt==null?Wt:Pt,function(pr,jr,Ar,vr){var mr=Ar=="ltr",ur=ar(pr,mr?"left":"right"),Wr=ar(jr-1,mr?"right":"left"),si=pt==null&&pr==0,An=Pt==null&&jr==Wt,Pr=vr==0,hn=!Fr||vr==Fr.length-1;if(Wr.top-ur.top<=3){var Cr=(re?si:An)&&Pr,Va=(re?An:si)&&hn,vn=Cr?K:(mr?ur:Wr).left,Wn=Va?$:(mr?Wr:ur).right;fe(vn,ur.top,Wn-vn,ur.bottom)}else{var Hn,Mr,li,Xa;mr?(Hn=re&&si&&Pr?K:ur.left,Mr=re?$:Gr(pr,Ar,"before"),li=re?K:Gr(jr,Ar,"after"),Xa=re&&An&&hn?$:Wr.right):(Hn=re?Gr(pr,Ar,"before"):K,Mr=!re&&si&&Pr?$:ur.right,li=!re&&An&&hn?K:Wr.left,Xa=re?Gr(jr,Ar,"after"):$),fe(Hn,ur.top,Mr-Hn,ur.bottom),ur.bottom<Wr.top&&fe(K,ur.bottom,null,Wr.top),fe(li,Wr.top,Xa-li,Wr.bottom)}(!er||zi(ur,er)<0)&&(er=ur),zi(Wr,er)<0&&(er=Wr),(!Sr||zi(ur,Sr)<0)&&(Sr=ur),zi(Wr,Sr)<0&&(Sr=Wr)}),{start:er,end:Sr}}var _e=t.from(),xe=t.to();if(_e.line==xe.line)me(_e.line,_e.ch,xe.ch);else{var Ie=Ue(i,_e.line),je=Ue(i,xe.line),Ve=$r(Ie)==$r(je),Qe=me(_e.line,_e.ch,Ve?Ie.text.length+1:null).end,ut=me(xe.line,Ve?0:null,xe.ch).start;Ve&&(Qe.top<ut.top-2?(fe(Qe.right,Qe.top,null,Qe.bottom),fe(K,ut.top,ut.left,ut.bottom)):fe(Qe.right,Qe.top,ut.left-Qe.right,Qe.bottom)),Qe.bottom<ut.top&&fe(K,Qe.bottom,null,ut.top)}n.appendChild(S)}function Sa(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||$n(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function vo(e){e.state.focused||(e.display.input.focus(),Ca(e))}function yo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,$n(e))},100)}function Ca(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(oe(e,"focus",e,t),e.state.focused=!0,H(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),O&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Sa(e)}function $n(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(oe(e,"blur",e,t),e.state.focused=!1,h(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Ki(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],S=e.options.lineWrapping,U=void 0,K=0;if(i.hidden)continue;if(W&&F<8){var $=i.node.offsetTop+i.node.offsetHeight;U=$-n,n=$}else{var re=i.node.getBoundingClientRect();U=re.bottom-re.top,!S&&i.text.firstChild&&(K=i.text.firstChild.getBoundingClientRect().right-re.left-1)}var fe=i.line.height-U;if((fe>.005||fe<-.005)&&(vt(i.line,U),bo(i.line),i.rest))for(var me=0;me<i.rest.length;me++)bo(i.rest[me]);if(K>e.display.sizerWidth){var _e=Math.ceil(K/Yn(e.display));_e>e.display.maxLineLength&&(e.display.maxLineLength=_e,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function bo(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function Vi(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Wi(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,S=Ht(t,r),U=Ht(t,i);if(n&&n.ensure){var K=n.ensure.from.line,$=n.ensure.to.line;K<S?(S=K,U=Ht(t,en(Ue(t,K))+e.wrapper.clientHeight)):Math.min($,t.lastLine())>=U&&(S=Ht(t,en(Ue(t,$))-e.wrapper.clientHeight),U=$)}return{from:S,to:Math.max(U,S+1)}}function Ys(e,t){if(J(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),i!=null&&!A){var S=a("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Wi(e.display))+`px;
|
|
height: `+(t.bottom-t.top+dn(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(S),S.scrollIntoView(i),e.display.lineSpace.removeChild(S)}}function $s(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Be(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Be(t.line,t.ch+1,"before"):t);for(var S=0;S<5;S++){var U=!1,K=tn(e,t),$=!n||n==t?K:tn(e,n);i={left:Math.min(K.left,$.left),top:Math.min(K.top,$.top)-r,right:Math.max(K.left,$.left),bottom:Math.max(K.bottom,$.bottom)+r};var re=_a(e,i),fe=e.doc.scrollTop,me=e.doc.scrollLeft;if(re.scrollTop!=null&&(yi(e,re.scrollTop),Math.abs(e.doc.scrollTop-fe)>1&&(U=!0)),re.scrollLeft!=null&&(Un(e,re.scrollLeft),Math.abs(e.doc.scrollLeft-me)>1&&(U=!0)),!U)break}return i}function Js(e,t){var n=_a(e,t);n.scrollTop!=null&&yi(e,n.scrollTop),n.scrollLeft!=null&&Un(e,n.scrollLeft)}function _a(e,t){var n=e.display,r=Xn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,S=ha(e),U={};t.bottom-t.top>S&&(t.bottom=t.top+S);var K=e.doc.height+ca(n),$=t.top<r,re=t.bottom>K-r;if(t.top<i)U.scrollTop=$?0:t.top;else if(t.bottom>i+S){var fe=Math.min(t.top,(re?K:t.bottom)-S);fe!=i&&(U.scrollTop=fe)}var me=e.options.fixedGutter?0:n.gutters.offsetWidth,_e=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-me,xe=On(e)-n.gutters.offsetWidth,Ie=t.right-t.left>xe;return Ie&&(t.right=t.left+xe),t.left<10?U.scrollLeft=0:t.left<_e?U.scrollLeft=Math.max(0,t.left+me-(Ie?0:10)):t.right>xe+_e-3&&(U.scrollLeft=t.right+(Ie?0:10)-xe),U}function Ta(e,t){if(t==null)return;Xi(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Jn(e){Xi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function vi(e,t,n){(t!=null||n!=null)&&Xi(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Qs(e,t){Xi(e),e.curOp.scrollToPos=t}function Xi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=uo(e,t.from),r=uo(e,t.to);Eo(e,n,r,t.margin)}}function Eo(e,t,n,r){var i=_a(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});vi(e,i.scrollLeft,i.scrollTop)}function yi(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;L||Aa(e,{top:t}),xo(e,t,!0),L&&Aa(e),xi(e,100)}function xo(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function Un(e,t,n,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,wo(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function bi(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ca(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+dn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Bn=function(e,t,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,e(r),e(i),ke(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),ke(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,W&&F<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Bn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var S=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+S)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},Bn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Bn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Bn.prototype.zeroWidthHack=function(){var e=u&&!_?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new pe,this.disableVert=new pe},Bn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),S=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);S!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Bn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Ei=function(){};Ei.prototype.update=function(){return{bottom:0,right:0}},Ei.prototype.setScrollLeft=function(){},Ei.prototype.setScrollTop=function(){},Ei.prototype.clear=function(){};function Qn(e,t){t||(t=bi(e));var n=e.display.barWidth,r=e.display.barHeight;So(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Ki(e),So(e,bi(e)),n=e.display.barWidth,r=e.display.barHeight}function So(e,t){var n=e.display,r=n.scrollbars.update(t);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&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var Co={native:Bn,null:Ei};function _o(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&h(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Co[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ke(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?Un(e,t):yi(e,t)},e),e.display.scrollbars.addClass&&H(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function Fn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Zs},qr(e.curOp)}function jn(e){var t=e.curOp;t&&Ps(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;qs(n)})}function qs(e){for(var t=e.ops,n=0;n<t.length;n++)el(t[n]);for(var r=0;r<t.length;r++)tl(t[r]);for(var i=0;i<t.length;i++)rl(t[i]);for(var S=0;S<t.length;S++)nl(t[S]);for(var U=0;U<t.length;U++)il(t[U])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&ji(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Yi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&wa(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&Ki(t),e.barMeasure=bi(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=to(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+dn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-On(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Un(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==M();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Qn(t,e.barMeasure),e.updatedDisplay&&Ra(t,e.barMeasure),e.selectionChanged&&Sa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&vo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&To(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&xo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Un(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$s(t,gt(r,e.scrollToPos.from),gt(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var S=e.maybeHiddenMarkers,U=e.maybeUnhiddenMarkers;if(S)for(var K=0;K<S.length;++K)S[K].lines.length||oe(S[K],"hide");if(U)for(var $=0;$<U.length;++$)U[$].lines.length&&oe(U[$],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&oe(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Hr(e,t){if(e.curOp)return t();Fn(e);try{return t()}finally{jn(e)}}function Er(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Fn(e);try{return t.apply(e,arguments)}finally{jn(e)}}}function Or(e){return function(){if(this.curOp)return e.apply(this,arguments);Fn(this);try{return e.apply(this,arguments)}finally{jn(this)}}}function xr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Fn(t);try{return e.apply(this,arguments)}finally{jn(t)}}}function xi(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,G(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=zr(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(S){if(r.line>=e.display.viewFrom){var U=S.styles,K=S.text.length>e.options.maxHighlightLength?Ct(t.mode,r.state):null,$=sn(e,S,r,!0);K&&(r.state=K),S.styles=$.styles;var re=S.styleClasses,fe=$.classes;fe?S.styleClasses=fe:re&&(S.styleClasses=null);for(var me=!U||U.length!=S.styles.length||re!=fe&&(!re||!fe||re.bgClass!=fe.bgClass||re.textClass!=fe.textClass),_e=0;!me&&_e<U.length;++_e)me=U[_e]!=S.styles[_e];me&&i.push(r.line),S.stateAfter=r.save(),r.nextLine()}else S.text.length<=e.options.maxHighlightLength&&Ln(e,S.text,r),S.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return xi(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&Hr(e,function(){for(var S=0;S<i.length;S++)En(e,i[S],"text")})}var Yi=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Vi(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=On(e),this.force=n,this.dims=ba(e),this.events=[]};Yi.prototype.signal=function(e,t){ne(e,t)&&this.events.push(arguments)},Yi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)oe.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=dn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=dn(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=M();if(!t||!y(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&y(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function ll(e){if(!e||!e.activeElt||e.activeElt==M())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&y(document.body,e.anchorNode)&&y(document.body,e.focusNode)){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function wa(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return xn(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&po(e)==0)return!1;Ao(e)&&(xn(e),t.dims=ba(e));var i=r.first+r.size,S=Math.max(t.visible.from-e.options.viewportMargin,r.first),U=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<S&&S-n.viewFrom<20&&(S=Math.max(r.first,n.viewFrom)),n.viewTo>U&&n.viewTo-U<20&&(U=Math.min(i,n.viewTo)),br&&(S=ui(e.doc,S),U=bn(e.doc,U));var K=S!=n.viewFrom||U!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,S,U),n.viewOffset=en(Ue(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var $=po(e);if(!K&&$==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var re=sl(e);return $>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),$>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(re),p(n.cursorDiv),p(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,K&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,xi(e,400)),n.updateLineNumbers=null,!0}function To(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==On(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ca(e.display)-ha(e),n.top)}),t.visible=Vi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Vi(e.display,e.doc,n));if(!wa(e,t))break;Ki(e);var i=bi(e);gi(e),Qn(e,i),Ra(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Aa(e,t){var n=new Yi(e,t);if(wa(e,n)){Ki(e),To(e,n);var r=bi(e);gi(e),Qn(e,r),Ra(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,S=r.lineDiv,U=S.firstChild;function K(Ie){var je=Ie.nextSibling;return O&&u&&e.display.currentWheelTarget==Ie?Ie.style.display="none":Ie.parentNode.removeChild(Ie),je}for(var $=r.view,re=r.viewFrom,fe=0;fe<$.length;fe++){var me=$[fe];if(!me.hidden)if(!me.node||me.node.parentNode!=S){var _e=Ns(e,me,re,n);S.insertBefore(_e,U)}else{for(;U!=me.node;)U=K(U);var xe=i&&t!=null&&t<=re&&me.lineNumber;me.changes&&(ge(me.changes,"gutter")>-1&&(xe=!1),Ya(e,me,re,n)),xe&&(p(me.lineNumber),me.lineNumber.appendChild(document.createTextNode(ot(e.options,re)))),U=me.node.nextSibling}re+=me.size}for(;U;)U=K(U)}function La(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Ra(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+dn(e)+"px"}function wo(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Ea(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,S=r+"px",U=0;U<n.length;U++)if(!n[U].hidden){e.options.fixedGutter&&(n[U].gutter&&(n[U].gutter.style.left=S),n[U].gutterBackground&&(n[U].gutterBackground.style.left=S));var K=n[U].alignable;if(K)for(var $=0;$<K.length;$++)K[$].style.left=S}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function Ao(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=ot(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(a("div",[a("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),S=i.firstChild.offsetWidth,U=i.offsetWidth-S;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(S,r.lineGutter.offsetWidth-U)+1,r.lineNumWidth=r.lineNumInnerWidth+U,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",La(e.display),!0}return!1}function ka(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var S=e[i],U=null;if(typeof S!="string"&&(U=S.style,S=S.className),S=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:S,style:U})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Lo(e){var t=e.gutters,n=e.gutterSpecs;p(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],S=i.className,U=i.style,K=t.appendChild(a("div",null,"CodeMirror-gutter "+S));U&&(K.style.cssText=U),S=="CodeMirror-linenumbers"&&(e.lineGutter=K,K.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",La(e)}function Si(e){Lo(e.display),Ur(e),wo(e)}function dl(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=g("div",null,"CodeMirror-code"),i.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=a("div",null,"CodeMirror-cursors"),i.measure=a("div",null,"CodeMirror-measure"),i.lineMeasure=a("div",null,"CodeMirror-measure"),i.lineSpace=g("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var S=g("div",[i.lineSpace],"CodeMirror-lines");i.mover=a("div",[S],null,"position: relative"),i.sizer=a("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=a("div",null,null,"position: absolute; height: "+be+"px; width: 1px;"),i.gutters=a("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=a("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=a("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),W&&F<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!O&&!(L&&o)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=ka(r.gutters,r.lineNumbers),Lo(i),n.init(i)}var $i=0,Jr=null;W?Jr=-.53:L?Jr=15:E?Jr=-.7:P&&(Jr=-1/3);function Ro(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function cl(e){var t=Ro(e);return t.x*=Jr,t.y*=Jr,t}function ko(e,t){var n=Ro(t),r=n.x,i=n.y,S=e.display,U=S.scroller,K=U.scrollWidth>U.clientWidth,$=U.scrollHeight>U.clientHeight;if(!(r&&K||i&&$))return;if(i&&u&&O){e:for(var re=t.target,fe=S.view;re!=U;re=re.parentNode)for(var me=0;me<fe.length;me++)if(fe[me].node==re){e.display.currentWheelTarget=re;break e}}if(r&&!L&&!w&&Jr!=null){i&&$&&yi(e,Math.max(0,U.scrollTop+i*Jr)),Un(e,Math.max(0,U.scrollLeft+r*Jr)),(!i||i&&$)&&q(t),S.wheelStartX=null;return}if(i&&Jr!=null){var _e=i*Jr,xe=e.doc.scrollTop,Ie=xe+S.wrapper.clientHeight;_e<0?xe=Math.max(0,xe+_e-50):Ie=Math.min(e.doc.height,Ie+_e+50),Aa(e,{top:xe,bottom:Ie})}$i<20&&(S.wheelStartX==null?(S.wheelStartX=U.scrollLeft,S.wheelStartY=U.scrollTop,S.wheelDX=r,S.wheelDY=i,setTimeout(function(){if(S.wheelStartX==null)return;var je=U.scrollLeft-S.wheelStartX,Ve=U.scrollTop-S.wheelStartY,Qe=Ve&&S.wheelDY&&Ve/S.wheelDY||je&&S.wheelDX&&je/S.wheelDX;if(S.wheelStartX=S.wheelStartY=null,!Qe)return;Jr=(Jr*$i+Qe)/($i+1),++$i},200)):(S.wheelDX+=r,S.wheelDY+=i))}var Qr=function(e,t){this.ranges=e,this.primIndex=t};Qr.prototype.primary=function(){return this.ranges[this.primIndex]},Qr.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!yr(n.anchor,r.anchor)||!yr(n.head,r.head))return!1}return!0},Qr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Qt(an(this.ranges[t].anchor),an(this.ranges[t].head));return new Qr(e,this.primIndex)},Qr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Qr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(dt(t,r.from())>=0&&dt(e,r.to())<=0)return n}return-1};var Qt=function(e,t){this.anchor=e,this.head=t};Qt.prototype.from=function(){return or(this.anchor,this.head)},Qt.prototype.to=function(){return on(this.anchor,this.head)},Qt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function rn(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(_e,xe){return dt(_e.from(),xe.from())}),n=ge(t,i);for(var S=1;S<t.length;S++){var U=t[S],K=t[S-1],$=dt(K.to(),U.from());if(r&&!U.empty()?$>0:$>=0){var re=or(K.from(),U.from()),fe=on(K.to(),U.to()),me=K.empty()?U.from()==U.head:K.from()==K.head;S<=n&&--n,t.splice(--S,2,new Qt(me?fe:re,me?re:fe))}}return new Qr(t,n)}function Sn(e,t){return new Qr([new Qt(e,t||e)],0)}function Cn(e){return e.text?Be(e.from.line+e.text.length-1,T(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Po(e,t){if(dt(e,t.from)<0)return e;if(dt(e,t.to)<=0)return Cn(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Cn(t).ch-t.to.ch),Be(n,r)}function Pa(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new Qt(Po(i.anchor,t),Po(i.head,t)))}return rn(e.cm,n,e.sel.primIndex)}function Do(e,t,n){return e.line==t.line?Be(n.line,e.ch-t.ch+n.ch):Be(n.line+(e.line-t.line),e.ch)}function hl(e,t,n){for(var r=[],i=Be(e.first,0),S=i,U=0;U<t.length;U++){var K=t[U],$=Do(K.from,i,S),re=Do(Cn(K),i,S);if(i=K.to,S=re,n=="around"){var fe=e.sel.ranges[U],me=dt(fe.head,fe.anchor)<0;r[U]=new Qt(me?re:$,me?$:re)}else r[U]=new Qt($,$)}return new Qr(r,e.sel.primIndex)}function Da(e){e.doc.mode=Nt(e.options,e.doc.modeOption),Ci(e)}function Ci(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,xi(e,100),e.state.modeGen++,e.curOp&&Ur(e)}function Oo(e,t){return t.from.ch==0&&t.to.ch==0&&T(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Oa(e,t,n,r){function i(ut){return n?n[ut]:null}function S(ut,Ze,pt){ua(ut,Ze,pt,r),wr(ut,"change",ut,t)}function U(ut,Ze){for(var pt=[],Pt=ut;Pt<Ze;++Pt)pt.push(new Dn(re[Pt],i(Pt),r));return pt}var K=t.from,$=t.to,re=t.text,fe=Ue(e,K.line),me=Ue(e,$.line),_e=T(re),xe=i(re.length-1),Ie=$.line-K.line;if(t.full)e.insert(0,U(0,re.length)),e.remove(re.length,e.size-re.length);else if(Oo(e,t)){var je=U(0,re.length-1);S(me,me.text,xe),Ie&&e.remove(K.line,Ie),je.length&&e.insert(K.line,je)}else if(fe==me)if(re.length==1)S(fe,fe.text.slice(0,K.ch)+_e+fe.text.slice($.ch),xe);else{var Ve=U(1,re.length-1);Ve.push(new Dn(_e+fe.text.slice($.ch),xe,r)),S(fe,fe.text.slice(0,K.ch)+re[0],i(0)),e.insert(K.line+1,Ve)}else if(re.length==1)S(fe,fe.text.slice(0,K.ch)+re[0]+me.text.slice($.ch),i(0)),e.remove(K.line+1,Ie);else{S(fe,fe.text.slice(0,K.ch)+re[0],i(0)),S(me,_e+me.text.slice($.ch),xe);var Qe=U(1,re.length-1);Ie>1&&e.remove(K.line+1,Ie-1),e.insert(K.line+1,Qe)}wr(e,"change",e,t)}function _n(e,t,n){function r(i,S,U){if(i.linked)for(var K=0;K<i.linked.length;++K){var $=i.linked[K];if($.doc==S)continue;var re=U&&$.sharedHist;if(n&&!re)continue;t($.doc,re),r($.doc,i,re)}}r(e,null,!0)}function Mo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,xa(e),Da(e),Io(e),e.options.lineWrapping||ji(e),e.options.mode=t.modeOption,Ur(e)}function Io(e){(e.doc.direction=="rtl"?H:h)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Hr(e,function(){Io(e),Ur(e)})}function Ji(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Ma(e,t){var n={from:an(t.from),to:Cn(t),text:St(e,t.from,t.to)};return Bo(e,n,t.from.line,t.to.line+1),_n(e,function(r){return Bo(r,n,t.from.line,t.to.line+1)},!0),n}function No(e){for(;e.length;){var t=T(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return No(e.done),T(e.done);if(e.done.length&&!T(e.done).ranges)return T(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),T(e.done)}function Uo(e,t,n,r){var i=e.history;i.undone.length=0;var S=+new Date,U,K;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>S-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(U=pl(i,i.lastOp==r)))K=T(U.changes),dt(t.from,t.to)==0&&dt(t.from,K.to)==0?K.to=Cn(t):U.changes.push(Ma(e,t));else{var $=T(i.done);for((!$||!$.ranges)&&Qi(e.sel,i.done),U={changes:[Ma(e,t)],generation:i.generation},i.done.push(U);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=t.origin,K||oe(e,"historyAdded")}function ml(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,r){var i=e.history,S=r&&r.origin;n==i.lastSelOp||S&&i.lastSelOrigin==S&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==S||ml(e,S,T(i.done),t))?i.done[i.done.length-1]=t:Qi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=S,i.lastSelOp=n,r&&r.clearRedo!==!1&&No(i.undone)}function Qi(e,t){var n=T(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Bo(e,t,n,r){var i=t["spans_"+e.id],S=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(U){U.markedSpans&&((i||(i=t["spans_"+e.id]={}))[S]=U.markedSpans),++S})}function vl(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function yl(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(vl(n[i]));return r}function Fo(e,t){var n=yl(e,t),r=rr(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var S=n[i],U=r[i];if(S&&U){e:for(var K=0;K<U.length;++K){for(var $=U[K],re=0;re<S.length;++re)if(S[re].marker==$.marker)continue e;S.push($)}}else U&&(n[i]=U)}return n}function Zn(e,t,n){for(var r=[],i=0;i<e.length;++i){var S=e[i];if(S.ranges){r.push(n?Qr.prototype.deepCopy.call(S):S);continue}var U=S.changes,K=[];r.push({changes:K});for(var $=0;$<U.length;++$){var re=U[$],fe=void 0;if(K.push({from:re.from,to:re.to,text:re.text}),t)for(var me in re)(fe=me.match(/^spans_(\d+)$/))&&(ge(t,Number(fe[1]))>-1&&(T(K)[me]=re[me],delete re[me]))}}return r}function Ia(e,t,n,r){if(r){var i=e.anchor;if(n){var S=dt(t,i)<0;S!=dt(n,i)<0?(i=t,t=n):S!=dt(t,n)<0&&(t=n)}return new Qt(i,t)}else return new Qt(n||t,t)}function Zi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),kr(e,new Qr([Ia(e.sel.primary(),t,n,i)],0),r)}function jo(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),S=0;S<e.sel.ranges.length;S++)r[S]=Ia(e.sel.ranges[S],t[S],null,i);var U=rn(e.cm,r,e.sel.primIndex);kr(e,U,n)}function Na(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,kr(e,rn(e.cm,i,e.sel.primIndex),r)}function Wo(e,t,n,r){kr(e,Sn(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var S=0;S<i.length;S++)this.ranges[S]=new Qt(gt(e,i[S].anchor),gt(e,i[S].head))},origin:n&&n.origin};return oe(e,"beforeSelectionChange",e,r),e.cm&&oe(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?rn(e.cm,r.ranges,r.ranges.length-1):t}function Ho(e,t,n){var r=e.history.done,i=T(r);i&&i.ranges?(r[r.length-1]=t,qi(e,t,n)):kr(e,t,n)}function kr(e,t,n){qi(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function qi(e,t,n){(ne(e,"beforeSelectionChange")||e.cm&&ne(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(dt(t.primary().head,e.sel.primary().head)<0?-1:1);Go(e,Ko(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&Jn(e.cm)}function Go(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Q(e.cm)),wr(e,"cursorActivity",e)}function zo(e){Go(e,Ko(e,e.sel,null,!1))}function Ko(e,t,n,r){for(var i,S=0;S<t.ranges.length;S++){var U=t.ranges[S],K=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[S],$=ea(e,U.anchor,K&&K.anchor,n,r),re=ea(e,U.head,K&&K.head,n,r);(i||$!=U.anchor||re!=U.head)&&(i||(i=t.ranges.slice(0,S)),i[S]=new Qt($,re))}return i?rn(e.cm,i,t.primIndex):t}function qn(e,t,n,r,i){var S=Ue(e,t.line);if(S.markedSpans)for(var U=0;U<S.markedSpans.length;++U){var K=S.markedSpans[U],$=K.marker,re="selectLeft"in $?!$.selectLeft:$.inclusiveLeft,fe="selectRight"in $?!$.selectRight:$.inclusiveRight;if((K.from==null||(re?K.from<=t.ch:K.from<t.ch))&&(K.to==null||(fe?K.to>=t.ch:K.to>t.ch))){if(i&&(oe($,"beforeCursorEnter"),$.explicitlyCleared))if(S.markedSpans){--U;continue}else break;if(!$.atomic)continue;if(n){var me=$.find(r<0?1:-1),_e=void 0;if((r<0?fe:re)&&(me=Vo(e,me,-r,me&&me.line==t.line?S:null)),me&&me.line==t.line&&(_e=dt(me,n))&&(r<0?_e<0:_e>0))return qn(e,me,t,r,i)}var xe=$.find(r<0?-1:1);return(r<0?re:fe)&&(xe=Vo(e,xe,r,xe.line==t.line?S:null)),xe?qn(e,xe,t,r,i):null}}return t}function ea(e,t,n,r,i){var S=r||1,U=qn(e,t,n,S,i)||!i&&qn(e,t,n,S,!0)||qn(e,t,n,-S,i)||!i&&qn(e,t,n,-S,!0);return U||(e.cantEdit=!0,Be(e.first,0))}function Vo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?gt(e,Be(t.line-1)):null:n>0&&t.ch==(r||Ue(e,t.line)).text.length?t.line<e.first+e.size-1?Be(t.line+1,0):null:new Be(t.line,t.ch+n)}function Xo(e){e.setSelection(Be(e.firstLine(),0),Be(e.lastLine()),Se)}function Yo(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(i,S,U,K){i&&(r.from=gt(e,i)),S&&(r.to=gt(e,S)),U&&(r.text=U),K!==void 0&&(r.origin=K)}),oe(e,"beforeChange",e,r),e.cm&&oe(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function ei(e,t,n){if(e.cm){if(!e.cm.curOp)return Er(e.cm,ei)(e,t,n);if(e.cm.state.suppressEdits)return}if((ne(e,"beforeChange")||e.cm&&ne(e.cm,"beforeChange"))&&(t=Yo(e,t,!0),!t))return;var r=Pn&&!n&&Lr(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)$o(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else $o(e,t)}function $o(e,t){if(t.text.length==1&&t.text[0]==""&&dt(t.from,t.to)==0)return;var n=Pa(e,t);Uo(e,t,n,e.cm?e.cm.curOp.id:NaN),_i(e,t,n,rr(e,t));var r=[];_n(e,function(i,S){!S&&ge(r,i.history)==-1&&(qo(i.history,t),r.push(i.history)),_i(i,t,null,rr(i,t))})}function ta(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,S,U=e.sel,K=t=="undo"?i.done:i.undone,$=t=="undo"?i.undone:i.done,re=0;re<K.length&&!(S=K[re],n?S.ranges&&!S.equals(e.sel):!S.ranges);re++);if(re==K.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(S=K.pop(),S.ranges){if(Qi(S,$),n&&!S.equals(e.sel)){kr(e,S,{clearRedo:!1});return}U=S}else if(r){K.push(S);return}else break;var fe=[];Qi(U,$),$.push({changes:fe,generation:i.generation}),i.generation=S.generation||++i.maxGeneration;for(var me=ne(e,"beforeChange")||e.cm&&ne(e.cm,"beforeChange"),_e=function(je){var Ve=S.changes[je];if(Ve.origin=t,me&&!Yo(e,Ve,!1))return K.length=0,{};fe.push(Ma(e,Ve));var Qe=je?Pa(e,Ve):T(K);_i(e,Ve,Qe,Fo(e,Ve)),!je&&e.cm&&e.cm.scrollIntoView({from:Ve.from,to:Cn(Ve)});var ut=[];_n(e,function(Ze,pt){!pt&&ge(ut,Ze.history)==-1&&(qo(Ze.history,Ve),ut.push(Ze.history)),_i(Ze,Ve,null,Fo(Ze,Ve))})},xe=S.changes.length-1;xe>=0;--xe){var Ie=_e(xe);if(Ie)return Ie.v}}function Jo(e,t){if(t==0)return;if(e.first+=t,e.sel=new Qr(R(e.sel.ranges,function(i){return new Qt(Be(i.anchor.line+t,i.anchor.ch),Be(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){Ur(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)En(e.cm,r,"gutter")}}function _i(e,t,n,r){if(e.cm&&!e.cm.curOp)return Er(e.cm,_i)(e,t,n,r);if(t.to.line<e.first){Jo(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Jo(e,i),t={from:Be(e.first,0),to:Be(t.to.line+i,t.to.ch),text:[T(t.text)],origin:t.origin}}var S=e.lastLine();t.to.line>S&&(t={from:t.from,to:Be(S,Ue(e,S).text.length),text:[t.text[0]],origin:t.origin}),t.removed=St(e,t.from,t.to),n||(n=Pa(e,t)),e.cm?El(e.cm,t,r):Oa(e,t,r),qi(e,n,Se),e.cantEdit&&ea(e,Be(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,S=t.from,U=t.to,K=!1,$=S.line;e.options.lineWrapping||($=_t($r(Ue(r,S.line))),r.iter($,U.line+1,function(xe){if(xe==i.maxLine)return K=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Q(e),Oa(r,t,n,fo(e)),e.options.lineWrapping||(r.iter($,S.line+t.text.length,function(xe){var Ie=ci(xe);Ie>i.maxLineLength&&(i.maxLine=xe,i.maxLineLength=Ie,i.maxLineChanged=!0,K=!1)}),K&&(e.curOp.updateMaxLine=!0)),Ui(r,S.line),xi(e,400);var re=t.text.length-(U.line-S.line)-1;t.full?Ur(e):S.line==U.line&&t.text.length==1&&!Oo(e.doc,t)?En(e,S.line,"text"):Ur(e,S.line,U.line+1,re);var fe=ne(e,"changes"),me=ne(e,"change");if(me||fe){var _e={from:S,to:U,text:t.text,removed:t.removed,origin:t.origin};me&&wr(e,"change",e,_e),fe&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(_e)}e.display.selForContextMenu=null}function ti(e,t,n,r,i){var S;r||(r=n),dt(r,n)<0&&(S=[r,n],n=S[0],r=S[1]),typeof t=="string"&&(t=e.splitLines(t)),ei(e,{from:n,to:r,text:t,origin:i})}function Qo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Zo(e,t,n,r){for(var i=0;i<e.length;++i){var S=e[i],U=!0;if(S.ranges){S.copied||(S=e[i]=S.deepCopy(),S.copied=!0);for(var K=0;K<S.ranges.length;K++)Qo(S.ranges[K].anchor,t,n,r),Qo(S.ranges[K].head,t,n,r);continue}for(var $=0;$<S.changes.length;++$){var re=S.changes[$];if(n<re.from.line)re.from=Be(re.from.line+r,re.from.ch),re.to=Be(re.to.line+r,re.to.ch);else if(t<=re.to.line){U=!1;break}}U||(e.splice(0,i+1),i=0)}}function qo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Zo(e.done,n,r,i),Zo(e.undone,n,r,i)}function Ti(e,t,n,r){var i=t,S=t;return typeof t=="number"?S=Ue(e,Ft(e,t)):i=_t(t),i==null?null:(r(S,i)&&e.cm&&En(e.cm,i,n),S)}function wi(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}wi.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,Et(i),wr(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}};function Ai(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}Ai.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var S=Math.min(t,i-e),U=r.height;if(r.removeInner(e,S),this.height-=U-r.height,i==S&&(this.children.splice(n--,1),r.parent=null),(t-=S)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof wi))){var K=[];this.collapse(K),this.children=[new wi(K)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],S=i.chunkSize();if(e<=S){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var U=i.lines.length%25+25,K=U;K<i.lines.length;){var $=new wi(i.lines.slice(K,K+=25));i.height-=$.height,this.children.splice(++r,0,$),$.parent=this}i.lines=i.lines.slice(0,U),this.maybeSpill()}break}e-=S}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new Ai(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=ge(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new Ai(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],S=i.chunkSize();if(e<S){var U=Math.min(t,S-e);if(i.iterN(e,U,n))return!0;if((t-=U)==0)break;e=0}else e-=S}}};var Li=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};Li.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=_t(n);if(r==null||!t)return;for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var S=pi(this);vt(n,Math.max(0,n.height-S)),e&&(Hr(e,function(){es(e,n,-S),En(e,r,"widget")}),wr(e,"lineWidgetCleared",e,this,r))},Li.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=pi(this)-t;if(!i)return;un(this.doc,r)||vt(r,r.height+i),n&&Hr(n,function(){n.curOp.forceUpdate=!0,es(n,r,i),wr(n,"lineWidgetChanged",n,e,_t(r))})},le(Li);function es(e,t,n){en(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Ta(e,n)}function xl(e,t,n,r){var i=new Li(e,n,r),S=e.cm;return S&&i.noHScroll&&(S.display.alignWidgets=!0),Ti(e,t,"widget",function(U){var K=U.widgets||(U.widgets=[]);if(i.insertAt==null?K.push(i):K.splice(Math.min(K.length-1,Math.max(0,i.insertAt)),0,i),i.line=U,S&&!un(e,U)){var $=en(U)<e.scrollTop;vt(U,U.height+pi(i)),$&&Ta(S,i.height),S.curOp.forceUpdate=!0}return!0}),S&&wr(S,"lineWidgetAdded",S,i,typeof t=="number"?t:_t(t)),i}var ts=0,Tn=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ts};Tn.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&Fn(e),ne(this,"clear")){var n=this.find();n&&wr(this,"clear",n.from,n.to)}for(var r=null,i=null,S=0;S<this.lines.length;++S){var U=this.lines[S],K=bt(U.markedSpans,this);e&&!this.collapsed?En(e,_t(U),"text"):e&&(K.to!=null&&(i=_t(U)),K.from!=null&&(r=_t(U))),U.markedSpans=lt(U.markedSpans,K),K.from==null&&this.collapsed&&!un(this.doc,U)&&e&&vt(U,Xn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var $=0;$<this.lines.length;++$){var re=$r(this.lines[$]),fe=ci(re);fe>e.display.maxLineLength&&(e.display.maxLine=re,e.display.maxLineLength=fe,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Ur(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&zo(e.doc)),e&&wr(e,"markerCleared",e,this,r,i),t&&jn(e),this.parent&&this.parent.clear()},Tn.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var S=this.lines[i],U=bt(S.markedSpans,this);if(U.from!=null&&(n=Be(t?S:_t(S),U.from),e==-1))return n;if(U.to!=null&&(r=Be(t?S:_t(S),U.to),e==1))return r}return n&&{from:n,to:r}},Tn.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;Hr(r,function(){var i=t.line,S=_t(t.line),U=fa(r,S);if(U&&(io(U),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!un(n.doc,i)&&n.height!=null){var K=n.height;n.height=null;var $=pi(n)-K;$&&vt(i,i.height+$)}wr(r,"markerChanged",r,e)})},Tn.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ge(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Tn.prototype.detachLine=function(e){if(this.lines.splice(ge(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},le(Tn);function ri(e,t,n,r,i){if(r&&r.shared)return Sl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Er(e.cm,ri)(e,t,n,r,i);var S=new Tn(e,i),U=dt(t,n);if(r&&j(r,S,!1),U>0||U==0&&S.clearWhenEmpty!==!1)return S;if(S.replacedWith&&(S.collapsed=!0,S.widgetNode=g("span",[S.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||S.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(S.widgetNode.insertLeft=!0)),S.collapsed){if(Bi(e,t.line,t,n,S)||t.line!=n.line&&Bi(e,n.line,t,n,S))throw new Error("Inserting collapsed marker partially overlapping an existing one");Ce()}S.addToHistory&&Uo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var K=t.line,$=e.cm,re;if(e.iter(K,n.line+1,function(me){$&&S.collapsed&&!$.options.lineWrapping&&$r(me)==$.display.maxLine&&(re=!0),S.collapsed&&K!=t.line&&vt(me,0),ht(me,new ze(S,K==t.line?t.ch:null,K==n.line?n.ch:null)),++K}),S.collapsed&&e.iter(t.line,n.line+1,function(me){un(e,me)&&vt(me,0)}),S.clearOnEnter&&ke(S,"beforeCursorEnter",function(){return S.clear()}),S.readOnly&&(qe(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),S.collapsed&&(S.id=++ts,S.atomic=!0),$){if(re&&($.curOp.updateMaxLine=!0),S.collapsed)Ur($,t.line,n.line+1);else if(S.className||S.startStyle||S.endStyle||S.css||S.attributes||S.title)for(var fe=t.line;fe<=n.line;fe++)En($,fe,"text");S.atomic&&zo($.doc),wr($,"markerAdded",$,S)}return S}var Ri=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};Ri.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();wr(this,"clear")},Ri.prototype.find=function(e,t){return this.primary.find(e,t)},le(Ri);function Sl(e,t,n,r,i){r=j(r),r.shared=!1;var S=[ri(e,t,n,r,i)],U=S[0],K=r.widgetNode;return _n(e,function($){K&&(r.widgetNode=K.cloneNode(!0)),S.push(ri($,gt($,t),gt($,n),r,i));for(var re=0;re<$.linked.length;++re)if($.linked[re].isParent)return;U=T(S)}),new Ri(S,U)}function rs(e){return e.findMarks(Be(e.first,0),e.clipPos(Be(e.lastLine())),function(t){return t.parent})}function Cl(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),S=e.clipPos(i.from),U=e.clipPos(i.to);if(dt(S,U)){var K=ri(e,S,U,r.primary,r.primary.type);r.markers.push(K),K.parent=r}}}function _l(e){for(var t=function(r){var i=e[r],S=[i.primary.doc];_n(i.primary.doc,function($){return S.push($)});for(var U=0;U<i.markers.length;U++){var K=i.markers[U];ge(S,K.doc)==-1&&(K.parent=null,i.markers.splice(U--,1))}},n=0;n<e.length;n++)t(n)}var Tl=0,Br=function(e,t,n,r,i){if(!(this instanceof Br))return new Br(e,t,n,r,i);n==null&&(n=0),Ai.call(this,[new wi([new Dn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var S=Be(n,0);this.sel=Sn(S),this.history=new Ji(null),this.id=++Tl,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Oa(this,{from:S,to:S,text:e}),kr(this,Sn(S),Se)};Br.prototype=B(Ai.prototype,{constructor:Br,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Ot(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:xr(function(e){var t=Be(this.first,0),n=this.first+this.size-1;ei(this,{from:t,to:Be(n,Ue(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&vi(this.cm,0,0),kr(this,Sn(t),Se)}),replaceRange:function(e,t,n,r){t=gt(this,t),n=n?gt(this,n):t,ti(this,e,t,n,r)},getRange:function(e,t,n){var r=St(this,gt(this,e),gt(this,t));return n===!1?r:r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Gt(this,e))return Ue(this,e)},getLineNumber:function(e){return _t(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=Ue(this,e)),$r(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return gt(this,e)},getCursor:function(e){var t=this.sel.primary(),n;return e==null||e=="head"?n=t.head:e=="anchor"?n=t.anchor:e=="end"||e=="to"||e===!1?n=t.to():n=t.from(),n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:xr(function(e,t,n){Wo(this,gt(this,typeof e=="number"?Be(e,t||0):e),null,n)}),setSelection:xr(function(e,t,n){Wo(this,gt(this,e),gt(this,t||e),n)}),extendSelection:xr(function(e,t,n){Zi(this,gt(this,e),t&>(this,t),n)}),extendSelections:xr(function(e,t){jo(this,We(this,e),t)}),extendSelectionsBy:xr(function(e,t){var n=R(this.sel.ranges,e);jo(this,We(this,n),t)}),setSelections:xr(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new Qt(gt(this,e[i].anchor),gt(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),kr(this,rn(this.cm,r,t),n)}),addSelection:xr(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new Qt(gt(this,e),gt(this,t||e))),kr(this,rn(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var i=St(this,t[r].from(),t[r].to());n=n?n.concat(i):i}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=St(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:xr(function(e,t,n){for(var r=[],i=this.sel,S=0;S<i.ranges.length;S++){var U=i.ranges[S];r[S]={from:U.from(),to:U.to(),text:this.splitLines(e[S]),origin:n}}for(var K=t&&t!="end"&&hl(this,r,t),$=r.length-1;$>=0;$--)ei(this,r[$]);K?Ho(this,K):this.cm&&Jn(this.cm)}),undo:xr(function(){ta(this,"undo")}),redo:xr(function(){ta(this,"redo")}),undoSelection:xr(function(){ta(this,"undo",!0)}),redoSelection:xr(function(){ta(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new Ji(this.history.maxGeneration),_n(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Zn(this.history.done),undone:Zn(this.history.undone)}},setHistory:function(e){var t=this.history=new Ji(this.history.maxGeneration);t.done=Zn(e.done.slice(0),null,!0),t.undone=Zn(e.undone.slice(0),null,!0)},setGutterMarker:xr(function(e,t,n){return Ti(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&Oe(i)&&(r.gutterMarkers=null),!0})}),clearGutter:xr(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&Ti(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Oe(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Gt(this,e))return null;if(t=e,e=Ue(this,e),!e)return null}else if(t=_t(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:xr(function(e,t,n){return Ti(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[i])r[i]=n;else{if(b(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:xr(function(e,t,n){return Ti(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",S=r[i];if(S)if(n==null)r[i]=null;else{var U=S.match(b(n));if(!U)return!1;var K=U.index+U[0].length;r[i]=S.slice(0,U.index)+(!U.index||K==S.length?"":" ")+S.slice(K)||null}else return!1;return!0})}),addLineWidget:xr(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return ri(this,gt(this,e),gt(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=gt(this,e),ri(this,e,e,n,"bookmark")},findMarksAt:function(e){e=gt(this,e);var t=[],n=Ue(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(i.from==null||i.from<=e.ch)&&(i.to==null||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=gt(this,e),t=gt(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(S){var U=S.markedSpans;if(U)for(var K=0;K<U.length;K++){var $=U[K];!($.to!=null&&i==e.line&&e.ch>=$.to||$.from==null&&i!=e.line||$.from!=null&&i==t.line&&$.from>=t.ch)&&(!n||n($.marker))&&r.push($.marker.parent||$.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var S=i.text.length+r;if(S>e)return t=e,!0;e-=S,++n}),gt(this,Be(n,t))},indexFromPos:function(e){e=gt(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+n}),t},copy:function(e){var t=new Br(Ot(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new Br(Ot(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Cl(r,rs(this)),r},unlinkDoc:function(e){if(e instanceof nr&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),_l(rs(this));break}if(e.history==this.history){var r=[e.id];_n(e,function(i){return r.push(i.id)},!0),e.history=new Ji(null),e.history.done=Zn(this.history.done,r),e.history.undone=Zn(this.history.undone,r)}},iterLinkedDocs:function(e){_n(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Ge(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:xr(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&fl(this.cm)})}),Br.prototype.eachLine=Br.prototype.iter;var ns=0;function wl(e){var t=this;if(is(t),J(t,e)||mn(t.display,e))return;q(e),W&&(ns=+new Date);var n=In(t,e,!0),r=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,S=Array(i),U=0,K=function(){++U==i&&Er(t,function(){n=gt(t.doc,n);var xe={from:n,to:n,text:t.doc.splitLines(S.filter(function(Ie){return Ie!=null}).join(t.doc.lineSeparator())),origin:"paste"};ei(t.doc,xe),Ho(t.doc,Sn(gt(t.doc,n),gt(t.doc,Cn(xe))))})()},$=function(xe,Ie){if(t.options.allowDropFileTypes&&ge(t.options.allowDropFileTypes,xe.type)==-1){K();return}var je=new FileReader;je.onerror=function(){return K()},je.onload=function(){var Ve=je.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Ve)){K();return}S[Ie]=Ve,K()},je.readAsText(xe)},re=0;re<r.length;re++)$(r[re],re);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var fe=e.dataTransfer.getData("Text");if(fe){var me;if(t.state.draggingText&&!t.state.draggingText.copy&&(me=t.listSelections()),qi(t.doc,Sn(n,n)),me)for(var _e=0;_e<me.length;++_e)ti(t.doc,"",me[_e].anchor,me[_e].head,"drag");t.replaceSelection(fe,"around","paste"),t.display.input.focus()}}catch(xe){}}}function Al(e,t){if(W&&(!e.state.draggingText||+new Date-ns<100)){ue(t);return}if(J(e,t)||mn(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!P){var n=a("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",w&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),w&&n.parentNode.removeChild(n)}}function Ll(e,t){var n=In(e,t);if(!n)return;var r=document.createDocumentFragment();go(e,n,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),s(e.display.dragCursor,r)}function is(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function as(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var S=0;S<n.length;S++)e(n[S])})}var os=!1;function Rl(){if(os)return;kl(),os=!0}function kl(){var e;ke(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,as(Pl)},100))}),ke(window,"blur",function(){return as($n)})}function Pl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var wn={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"},ki=0;ki<10;ki++)wn[ki+48]=wn[ki+96]=String(ki);for(var ra=65;ra<=90;ra++)wn[ra]=String.fromCharCode(ra);for(var Pi=1;Pi<=12;Pi++)wn[Pi+111]=wn[Pi+63235]="F"+Pi;var gn={};gn.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"},gn.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"},gn.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"},gn.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"]},gn.default=u?gn.macDefault:gn.pcDefault;function Dl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,S,U=0;U<t.length-1;U++){var K=t[U];if(/^(cmd|meta|m)$/i.test(K))S=!0;else if(/^a(lt)?$/i.test(K))n=!0;else if(/^(c|ctrl|control)$/i.test(K))r=!0;else if(/^s(hift)?$/i.test(K))i=!0;else throw new Error("Unrecognized modifier name: "+K)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),S&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Ol(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}for(var i=R(n.split(" "),Dl),S=0;S<i.length;S++){var U=void 0,K=void 0;S==i.length-1?(K=i.join(" "),U=r):(K=i.slice(0,S+1).join(" "),U="...");var $=t[K];if(!$)t[K]=U;else if($!=U)throw new Error("Inconsistent bindings for "+K)}delete e[n]}for(var re in t)e[re]=t[re];return e}function ni(e,t,n,r){t=na(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return ni(e,t.fallthrough,n,r);for(var S=0;S<t.fallthrough.length;S++){var U=ni(e,t.fallthrough[S],n,r);if(U)return U}}}function ss(e){var t=typeof e=="string"?e:wn[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ls(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(f?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(f?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function us(e,t){if(w&&e.keyCode==34&&e.char)return!1;var n=wn[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),ls(n,e,t))}function na(e){return typeof e=="string"?gn[e]:e}function ii(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var S=t(n[i]);r.length&&dt(S.from,T(r).to)<=0;){var U=r.pop();if(dt(U.from,S.from)<0){S.from=U.from;break}}r.push(S)}Hr(e,function(){for(var K=r.length-1;K>=0;K--)ti(e.doc,"",r[K].from,r[K].to,"+delete");Jn(e)})}function Ua(e,t,n){var r=Pe(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Ba(e,t,n){var r=Ua(e,t.ch,n);return r==null?null:new Be(t.line,r,n<0?"after":"before")}function Fa(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var S=Je(n,t.doc.direction);if(S){var U=i<0?T(S):S[0],K=i<0==(U.level==1),$=K?"after":"before",re;if(U.level>0||t.doc.direction=="rtl"){var fe=Vn(t,n);re=i<0?n.text.length-1:0;var me=cn(t,fe,re).top;re=Ke(function(_e){return cn(t,fe,_e).top==me},i<0==(U.level==1)?U.from:U.to-1,re),$=="before"&&(re=Ua(n,re,1))}else re=i<0?U.to:U.from;return new Be(r,re,$)}}return new Be(r,i<0?n.text.length:0,i<0?"before":"after")}function Ml(e,t,n,r){var i=Je(t,e.doc.direction);if(!i)return Ba(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var S=$e(i,n.ch,n.sticky),U=i[S];if(e.doc.direction=="ltr"&&U.level%2==0&&(r>0?U.to>n.ch:U.from<n.ch))return Ba(t,n,r);var K=function(Qe,ut){return Ua(t,Qe instanceof Be?Qe.ch:Qe,ut)},$,re=function(Qe){return e.options.lineWrapping?($=$||Vn(e,t),ho(e,t,$,Qe)):{begin:0,end:t.text.length}},fe=re(n.sticky=="before"?K(n,-1):n.ch);if(e.doc.direction=="rtl"||U.level==1){var me=U.level==1==r<0,_e=K(n,me?1:-1);if(_e!=null&&(me?_e<=U.to&&_e<=fe.end:_e>=U.from&&_e>=fe.begin)){var xe=me?"before":"after";return new Be(n.line,_e,xe)}}var Ie=function(Qe,ut,Ze){for(var pt=function(er,Sr){return Sr?new Be(n.line,K(er,1),"before"):new Be(n.line,er,"after")};Qe>=0&&Qe<i.length;Qe+=ut){var Pt=i[Qe],Tt=ut>0==(Pt.level!=1),Wt=Tt?Ze.begin:K(Ze.end,-1);if(Pt.from<=Wt&&Wt<Pt.to)return pt(Wt,Tt);if(Wt=Tt?Pt.from:K(Pt.to,-1),Ze.begin<=Wt&&Wt<Ze.end)return pt(Wt,Tt)}},je=Ie(S+r,r,fe);if(je)return je;var Ve=r>0?fe.end:K(fe.begin,-1);return Ve!=null&&!(r>0&&Ve==t.text.length)&&(je=Ie(r>0?0:i.length-1,r,re(Ve)),je)?je:null}var Di={selectAll:Xo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Se)},killLine:function(e){return ii(e,function(t){if(t.empty()){var n=Ue(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Be(t.head.line+1,0)}:{from:t.head,to:Be(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return ii(e,function(t){return{from:Be(t.from().line,0),to:gt(e.doc,Be(t.to().line+1,0))}})},delLineLeft:function(e){return ii(e,function(t){return{from:Be(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return ii(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return ii(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(Be(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Be(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return ds(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return cs(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},Le)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},Le)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?cs(e,t.head):r},Le)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var S=n[i].from(),U=ie(e.getLine(S.line),S.ch,r);t.push(N(r-U%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Hr(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,S=Ue(e.doc,i.line).text;if(S){if(i.ch==S.length&&(i=new Be(i.line,i.ch-1)),i.ch>0)i=new Be(i.line,i.ch+1),e.replaceRange(S.charAt(i.ch-1)+S.charAt(i.ch-2),Be(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var U=Ue(e.doc,i.line-1).text;U&&(i=new Be(i.line,1),e.replaceRange(S.charAt(0)+e.doc.lineSeparator()+U.charAt(U.length-1),Be(i.line-1,U.length-1),i,"+transpose"))}}n.push(new Qt(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return Hr(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);Jn(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function ds(e,t){var n=Ue(e.doc,t),r=$r(n);return r!=n&&(t=_t(r)),Fa(!0,e,r,t,1)}function Il(e,t){var n=Ue(e.doc,t),r=Fi(n);return r!=n&&(t=_t(r)),Fa(!0,e,n,t,-1)}function cs(e,t){var n=ds(e,t.line),r=Ue(e.doc,n.line),i=Je(r,e.doc.direction);if(!i||i[0].level==0){var S=Math.max(n.ch,r.text.search(/\S/)),U=t.line==n.line&&t.ch<=S&&t.ch;return Be(n.line,U?0:S,n.sticky)}return n}function ia(e,t,n){if(typeof t=="string"&&(t=Di[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Ne}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Nl(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=ni(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&ni(t,e.options.extraKeys,n,e)||ni(t,e.options.keyMap,n,e)}var Ul=new pe;function Oi(e,t,n,r){var i=e.state.keySeq;if(i){if(ss(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Ul.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),hs(e,i+" "+t,n,r))return!0}return hs(e,t,n,r)}function hs(e,t,n,r){var i=Nl(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&wr(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(q(n),Sa(e)),!!i}function fs(e,t){var n=us(t,!0);return n?t.shiftKey&&!e.state.keySeq?Oi(e,"Shift-"+n,t,function(r){return ia(e,r,!0)})||Oi(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return ia(e,r)}):Oi(e,n,t,function(r){return ia(e,r)}):!1}function Bl(e,t,n){return Oi(e,"'"+n+"'",t,function(r){return ia(e,r,!0)})}var ja=null;function ps(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=M(),J(t,e))return;W&&F<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=fs(t,e);w&&(ja=r?n:null,!r&&n==88&&!Dt&&(u?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),L&&!u&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Fl(t)}function Fl(e){var t=e.display.lineDiv;H(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(h(t,"CodeMirror-crosshair"),nt(document,"keyup",n),nt(document,"mouseover",n))}ke(document,"keyup",n),ke(document,"mouseover",n)}function ms(e){e.keyCode==16&&(this.doc.sel.shift=!1),J(this,e)}function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(mn(t.display,e)||J(t,e)||e.ctrlKey&&!e.altKey||u&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(w&&n==ja){ja=null,q(e);return}if(w&&(!e.which||e.which<10)&&fs(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Bl(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,Wa=function(e,t,n){this.time=e,this.pos=t,this.button=n};Wa.prototype.compare=function(e,t,n){return this.time+jl>e&&dt(t,this.pos)==0&&n==this.button};var Mi,Ii;function Wl(e,t){var n=+new Date;return Ii&&Ii.compare(n,e,t)?(Mi=Ii=null,"triple"):Mi&&Mi.compare(n,e,t)?(Ii=new Wa(n,e,t),Mi=null,"double"):(Mi=new Wa(n,e,t),Ii=null,"single")}function vs(e){var t=this,n=t.display;if(J(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,mn(n,e)){O||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ha(t,e))return;var r=In(t,e),i=ye(e),S=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,S,e))return;i==1?r?zl(t,r,S,e):de(e)==n.scroller&&q(e):i==2?(r&&Zi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(l?t.display.input.onContextMenu(e):yo(t))}function Hl(e,t,n,r,i){var S="Click";return r=="double"?S="Double"+S:r=="triple"&&(S="Triple"+S),S=(t==1?"Left":t==2?"Middle":"Right")+S,Oi(e,ls(S,i),i,function(U){if(typeof U=="string"&&(U=Di[U]),!U)return!1;var K=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),K=U(e,n)!=Ne}finally{e.state.suppressEdits=!1}return K})}function Gl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var S=d?n.shiftKey&&n.metaKey:n.altKey;i.unit=S?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=u?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(u?n.altKey:n.ctrlKey)),i}function zl(e,t,n,r){W?setTimeout(G(vo,e),0):e.curOp.focus=M();var i=Gl(e,n,r),S=e.doc.sel,U;e.options.dragDrop&&Te&&!e.isReadOnly()&&n=="single"&&(U=S.contains(t))>-1&&(dt((U=S.ranges[U]).from(),t)<0||t.xRel>0)&&(dt(U.to(),t)>0||t.xRel<0)?Kl(e,r,t,i):Vl(e,r,t,i)}function Kl(e,t,n,r){var i=e.display,S=!1,U=Er(e,function(re){O&&(i.scroller.draggable=!1),e.state.draggingText=!1,nt(i.wrapper.ownerDocument,"mouseup",U),nt(i.wrapper.ownerDocument,"mousemove",K),nt(i.scroller,"dragstart",$),nt(i.scroller,"drop",U),S||(q(re),r.addNew||Zi(e.doc,n,null,null,r.extend),O&&!P||W&&F==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),K=function(re){S=S||Math.abs(t.clientX-re.clientX)+Math.abs(t.clientY-re.clientY)>=10},$=function(){return S=!0};O&&(i.scroller.draggable=!0),e.state.draggingText=U,U.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),ke(i.wrapper.ownerDocument,"mouseup",U),ke(i.wrapper.ownerDocument,"mousemove",K),ke(i.scroller,"dragstart",$),ke(i.scroller,"drop",U),yo(e),setTimeout(function(){return i.input.focus()},20)}function ys(e,t,n){if(n=="char")return new Qt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new Qt(Be(t.line,0),gt(e.doc,Be(t.line+1,0)));var r=n(e,t);return new Qt(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,S=e.doc;q(t);var U,K,$=S.sel,re=$.ranges;if(r.addNew&&!r.extend?(K=S.sel.contains(n),K>-1?U=re[K]:U=new Qt(n,n)):(U=S.sel.primary(),K=S.sel.primIndex),r.unit=="rectangle")r.addNew||(U=new Qt(n,n)),n=In(e,t,!0,!0),K=-1;else{var fe=ys(e,n,r.unit);r.extend?U=Ia(U,fe.anchor,fe.head,r.extend):U=fe}r.addNew?K==-1?(K=re.length,kr(S,rn(e,re.concat([U]),K),{scroll:!1,origin:"*mouse"})):re.length>1&&re[K].empty()&&r.unit=="char"&&!r.extend?(kr(S,rn(e,re.slice(0,K).concat(re.slice(K+1)),0),{scroll:!1,origin:"*mouse"}),$=S.sel):Na(S,K,U,Me):(K=0,kr(S,new Qr([U],0),Me),$=S.sel);var me=n;function _e(Ze){if(dt(me,Ze)==0)return;if(me=Ze,r.unit=="rectangle"){for(var pt=[],Pt=e.options.tabSize,Tt=ie(Ue(S,n.line).text,n.ch,Pt),Wt=ie(Ue(S,Ze.line).text,Ze.ch,Pt),er=Math.min(Tt,Wt),Sr=Math.max(Tt,Wt),ar=Math.min(n.line,Ze.line),Gr=Math.min(e.lastLine(),Math.max(n.line,Ze.line));ar<=Gr;ar++){var Fr=Ue(S,ar).text,pr=we(Fr,er,Pt);er==Sr?pt.push(new Qt(Be(ar,pr),Be(ar,pr))):Fr.length>pr&&pt.push(new Qt(Be(ar,pr),Be(ar,we(Fr,Sr,Pt))))}pt.length||pt.push(new Qt(n,n)),kr(S,rn(e,$.ranges.slice(0,K).concat(pt),K),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Ze)}else{var jr=U,Ar=ys(e,Ze,r.unit),vr=jr.anchor,mr;dt(Ar.anchor,vr)>0?(mr=Ar.head,vr=or(jr.from(),Ar.anchor)):(mr=Ar.anchor,vr=on(jr.to(),Ar.head));var ur=$.ranges.slice(0);ur[K]=Xl(e,new Qt(gt(S,vr),mr)),kr(S,rn(e,ur,K),Me)}}var xe=i.wrapper.getBoundingClientRect(),Ie=0;function je(Ze){var pt=++Ie,Pt=In(e,Ze,!0,r.unit=="rectangle");if(!Pt)return;if(dt(Pt,me)!=0){e.curOp.focus=M(),_e(Pt);var Tt=Vi(i,S);(Pt.line>=Tt.to||Pt.line<Tt.from)&&setTimeout(Er(e,function(){Ie==pt&&je(Ze)}),150)}else{var Wt=Ze.clientY<xe.top?-20:Ze.clientY>xe.bottom?20:0;Wt&&setTimeout(Er(e,function(){if(Ie!=pt)return;i.scroller.scrollTop+=Wt,je(Ze)}),50)}}function Ve(Ze){e.state.selectingText=!1,Ie=Infinity,Ze&&(q(Ze),i.input.focus()),nt(i.wrapper.ownerDocument,"mousemove",Qe),nt(i.wrapper.ownerDocument,"mouseup",ut),S.history.lastSelOrigin=null}var Qe=Er(e,function(Ze){Ze.buttons===0||!ye(Ze)?Ve(Ze):je(Ze)}),ut=Er(e,Ve);e.state.selectingText=ut,ke(i.wrapper.ownerDocument,"mousemove",Qe),ke(i.wrapper.ownerDocument,"mouseup",ut)}function Xl(e,t){var n=t.anchor,r=t.head,i=Ue(e.doc,n.line);if(dt(n,r)==0&&n.sticky==r.sticky)return t;var S=Je(i);if(!S)return t;var U=$e(S,n.ch,n.sticky),K=S[U];if(K.from!=n.ch&&K.to!=n.ch)return t;var $=U+(K.from==n.ch==(K.level!=1)?0:1);if($==0||$==S.length)return t;var re;if(r.line!=n.line)re=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var fe=$e(S,r.ch,r.sticky),me=fe-U||(r.ch-n.ch)*(K.level==1?-1:1);fe==$-1||fe==$?re=me<0:re=me>0}var _e=S[$+(re?-1:0)],xe=re==(_e.level==1),Ie=xe?_e.from:_e.to,je=xe?"after":"before";return n.ch==Ie&&n.sticky==je?t:new Qt(new Be(n.line,Ie,je),r)}function bs(e,t,n,r){var i,S;if(t.touches)i=t.touches[0].clientX,S=t.touches[0].clientY;else try{i=t.clientX,S=t.clientY}catch(_e){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&q(t);var U=e.display,K=U.lineDiv.getBoundingClientRect();if(S>K.bottom||!ne(e,n))return ae(t);S-=K.top-U.viewOffset;for(var $=0;$<e.display.gutterSpecs.length;++$){var re=U.gutters.childNodes[$];if(re&&re.getBoundingClientRect().right>=i){var fe=Ht(e.doc,S),me=e.display.gutterSpecs[$];return oe(e,n,e,fe,me.className,t),ae(t)}}}function Ha(e,t){return bs(e,t,"gutterClick",!0)}function Es(e,t){if(mn(e.display,t)||Yl(e,t))return;if(J(e,t,"contextmenu"))return;l||e.display.input.onContextMenu(t)}function Yl(e,t){return ne(e,"gutterContextMenu")?bs(e,t,"gutterContextMenu",!1):!1}function xs(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),mi(e)}var ai={toString:function(){return"CodeMirror.Init"}},Ss={},aa={};function $l(e){var t=e.optionHandlers;function n(r,i,S,U){e.defaults[r]=i,S&&(t[r]=U?function(K,$,re){re!=ai&&S(K,$,re)}:S)}e.defineOption=n,e.Init=ai,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Da(r)},!0),n("indentUnit",2,Da,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){Ci(r),mi(r),Ur(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var S=[],U=r.doc.first;r.doc.iter(function($){for(var re=0;;){var fe=$.text.indexOf(i,re);if(fe==-1)break;re=fe+i.length,S.push(Be(U,fe))}U++});for(var K=S.length-1;K>=0;K--)ti(r.doc,i,S[K],Be(S[K].line,S[K].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,S){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),S!=ai&&r.refresh()}),n("specialCharPlaceholder",qt,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!x),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){xs(r),Si(r)},!0),n("keyMap","default",function(r,i,S){var U=na(i),K=S!=ai&&na(S);K&&K.detach&&K.detach(r,U),U.attach&&U.attach(r,K||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Ql,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=ka(i,r.options.lineNumbers),Si(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?Ea(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Qn(r)},!0),n("scrollbarStyle","native",function(r){_o(r),Qn(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=ka(r.options.gutters,i),Si(r)},!0),n("firstLineNumber",1,Si,!0),n("lineNumberFormatter",function(r){return r},Si,!0),n("showCursorWhenSelecting",!1,gi,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&($n(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Jl),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,gi,!0),n("singleCursorHeightPerLine",!0,gi,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Ci,!0),n("addModeClass",!1,Ci,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,Ci,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Jl(e,t,n){var r=n&&n!=ai;if(!t!=!r){var i=e.display.dragFunctions,S=t?ke:nt;S(e.display.scroller,"dragstart",i.start),S(e.display.scroller,"dragenter",i.enter),S(e.display.scroller,"dragover",i.over),S(e.display.scroller,"dragleave",i.leave),S(e.display.scroller,"drop",i.drop)}}function Ql(e){e.options.lineWrapping?(H(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(h(e.display.wrapper,"CodeMirror-wrap"),ji(e)),xa(e),Ur(e),mi(e),setTimeout(function(){return Qn(e)},100)}function nr(e,t){var n=this;if(!(this instanceof nr))return new nr(e,t);this.options=t=t?j(t):{},j(Ss,t,!1);var r=t.value;typeof r=="string"?r=new Br(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new nr.inputStyles[t.inputStyle](this),S=this.display=new dl(e,r,i,t);S.wrapper.CodeMirror=this,xs(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),_o(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 pe,keySeq:null,specialChars:null},t.autofocus&&!o&&S.input.focus(),W&&F<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),Rl(),Fn(this),this.curOp.forceUpdate=!0,Mo(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Ca(n)},20):$n(this);for(var U in aa)aa.hasOwnProperty(U)&&aa[U](this,t[U],ai);Ao(this),t.finishInit&&t.finishInit(this);for(var K=0;K<Ga.length;++K)Ga[K](this);jn(this),O&&t.lineWrapping&&getComputedStyle(S.lineDiv).textRendering=="optimizelegibility"&&(S.lineDiv.style.textRendering="auto")}nr.defaults=Ss,nr.optionHandlers=aa;function Zl(e){var t=e.display;ke(t.scroller,"mousedown",Er(e,vs)),W&&F<11?ke(t.scroller,"dblclick",Er(e,function($){if(J(e,$))return;var re=In(e,$);if(!re||Ha(e,$)||mn(e.display,$))return;q($);var fe=e.findWordAt(re);Zi(e.doc,fe.anchor,fe.head)})):ke(t.scroller,"dblclick",function($){return J(e,$)||q($)}),ke(t.scroller,"contextmenu",function($){return Es(e,$)}),ke(t.input.getField(),"contextmenu",function($){t.scroller.contains($.target)||Es(e,$)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function S($){if($.touches.length!=1)return!1;var re=$.touches[0];return re.radiusX<=1&&re.radiusY<=1}function U($,re){if(re.left==null)return!0;var fe=re.left-$.left,me=re.top-$.top;return fe*fe+me*me>20*20}ke(t.scroller,"touchstart",function($){if(!J(e,$)&&!S($)&&!Ha(e,$)){t.input.ensurePolled(),clearTimeout(n);var re=+new Date;t.activeTouch={start:re,moved:!1,prev:re-r.end<=300?r:null},$.touches.length==1&&(t.activeTouch.left=$.touches[0].pageX,t.activeTouch.top=$.touches[0].pageY)}}),ke(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ke(t.scroller,"touchend",function($){var re=t.activeTouch;if(re&&!mn(t,$)&&re.left!=null&&!re.moved&&new Date-re.start<300){var fe=e.coordsChar(t.activeTouch,"page"),me;!re.prev||U(re,re.prev)?me=new Qt(fe,fe):!re.prev.prev||U(re,re.prev.prev)?me=e.findWordAt(fe):me=new Qt(Be(fe.line,0),gt(e.doc,Be(fe.line+1,0))),e.setSelection(me.anchor,me.head),e.focus(),q($)}i()}),ke(t.scroller,"touchcancel",i),ke(t.scroller,"scroll",function(){t.scroller.clientHeight&&(yi(e,t.scroller.scrollTop),Un(e,t.scroller.scrollLeft,!0),oe(e,"scroll",e))}),ke(t.scroller,"mousewheel",function($){return ko(e,$)}),ke(t.scroller,"DOMMouseScroll",function($){return ko(e,$)}),ke(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function($){J(e,$)||ue($)},over:function($){J(e,$)||(Ll(e,$),ue($))},start:function($){return Al(e,$)},drop:Er(e,wl),leave:function($){J(e,$)||is(e)}};var K=t.input.getField();ke(K,"keyup",function($){return ms.call(e,$)}),ke(K,"keydown",Er(e,ps)),ke(K,"keypress",Er(e,gs)),ke(K,"focus",function($){return Ca(e,$)}),ke(K,"blur",function($){return $n(e,$)})}var Ga=[];nr.defineInitHook=function(e){return Ga.push(e)};function Ni(e,t,n,r){var i=e.doc,S;n==null&&(n="add"),n=="smart"&&(i.mode.indent?S=zr(e,t).state:n="prev");var U=e.options.tabSize,K=Ue(i,t),$=ie(K.text,null,U);K.stateAfter&&(K.stateAfter=null);var re=K.text.match(/^\s*/)[0],fe;if(!r&&!/\S/.test(K.text))fe=0,n="not";else if(n=="smart"&&(fe=i.mode.indent(S,K.text.slice(re.length),K.text),fe==Ne||fe>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?fe=ie(Ue(i,t-1).text,null,U):fe=0:n=="add"?fe=$+e.options.indentUnit:n=="subtract"?fe=$-e.options.indentUnit:typeof n=="number"&&(fe=$+n),fe=Math.max(0,fe);var me="",_e=0;if(e.options.indentWithTabs)for(var xe=Math.floor(fe/U);xe;--xe)_e+=U,me+=" ";if(_e<fe&&(me+=N(fe-_e)),me!=re)return ti(i,me,Be(t,0),Be(t,re.length),"+input"),K.stateAfter=null,!0;for(var Ie=0;Ie<i.sel.ranges.length;Ie++){var je=i.sel.ranges[Ie];if(je.head.line==t&&je.head.ch<re.length){var Ve=Be(t,re.length);Na(i,Ie,new Qt(Ve,Ve));break}}}var nn=null;function oa(e){nn=e}function za(e,t,n,r,i){var S=e.doc;e.display.shift=!1,r||(r=S.sel);var U=+new Date-200,K=i=="paste"||e.state.pasteIncoming>U,$=Ge(t),re=null;if(K&&r.ranges.length>1)if(nn&&nn.text.join(`
|
|
`)==t){if(r.ranges.length%nn.text.length==0){re=[];for(var fe=0;fe<nn.text.length;fe++)re.push(S.splitLines(nn.text[fe]))}}else $.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(re=R($,function(Qe){return[Qe]}));for(var me=e.curOp.updateInput,_e=r.ranges.length-1;_e>=0;_e--){var xe=r.ranges[_e],Ie=xe.from(),je=xe.to();xe.empty()&&(n&&n>0?Ie=Be(Ie.line,Ie.ch-n):e.state.overwrite&&!K?je=Be(je.line,Math.min(Ue(S,je.line).text.length,je.ch+T($).length)):K&&nn&&nn.lineWise&&nn.text.join(`
|
|
`)==$.join(`
|
|
`)&&(Ie=je=Be(Ie.line,0)));var Ve={from:Ie,to:je,text:re?re[_e%re.length]:$,origin:i||(K?"paste":e.state.cutIncoming>U?"cut":"+input")};ei(e.doc,Ve),wr(e,"inputRead",e,Ve)}t&&!K&&_s(e,t),Jn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=me),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Cs(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Hr(t,function(){return za(t,n,0,null,"paste")}),!0}function _s(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.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)continue;var S=e.getModeAt(i.head),U=!1;if(S.electricChars){for(var K=0;K<S.electricChars.length;K++)if(t.indexOf(S.electricChars.charAt(K))>-1){U=Ni(e,i.head.line,"smart");break}}else S.electricInput&&(S.electricInput.test(Ue(e.doc,i.head.line).text.slice(0,i.head.ch))&&(U=Ni(e,i.head.line,"smart")));U&&wr(e,"electricInput",e,i.head.line)}}function Ts(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,S={anchor:Be(i,0),head:Be(i+1,0)};n.push(S),t.push(e.getRange(S.anchor,S.head))}return{text:t,ranges:n}}function ws(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function As(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return O?e.style.width="1000px":e.setAttribute("wrap","off"),C&&(e.style.border="1px solid black"),ws(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,i){var S=this.options,U=S[r];if(S[r]==i&&r!="mode")return;S[r]=i,t.hasOwnProperty(r)&&Er(this,t[r])(this,i,U),oe(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](na(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,S=0;S<i.length;++S)if(i[S]==r||i[S].name==r)return i.splice(S,1),!0},addOverlay:Or(function(r,i){var S=r.token?r:e.getMode(this.options,r);if(S.startState)throw new Error("Overlays may not be stateful.");z(this.state.overlays,{mode:S,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(U){return U.priority}),this.state.modeGen++,Ur(this)}),removeOverlay:Or(function(r){for(var i=this.state.overlays,S=0;S<i.length;++S){var U=i[S].modeSpec;if(U==r||typeof r=="string"&&U.name==r){i.splice(S,1),this.state.modeGen++,Ur(this);return}}}),indentLine:Or(function(r,i,S){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Gt(this.doc,r)&&Ni(this,r,i,S)}),indentSelection:Or(function(r){for(var i=this.doc.sel.ranges,S=-1,U=0;U<i.length;U++){var K=i[U];if(K.empty())K.head.line>S&&(Ni(this,K.head.line,r,!0),S=K.head.line,U==this.doc.sel.primIndex&&Jn(this));else{var $=K.from(),re=K.to(),fe=Math.max(S,$.line);S=Math.min(this.lastLine(),re.line-(re.ch?0:1))+1;for(var me=fe;me<S;++me)Ni(this,me,r);var _e=this.doc.sel.ranges;$.ch==0&&i.length==_e.length&&_e[U].from().ch>0&&Na(this.doc,U,new Qt($,_e[U].to()),Se)}}}),getTokenAt:function(r,i){return kn(this,r,i)},getLineTokens:function(r,i){return kn(this,Be(r),i,!0)},getTokenTypeAt:function(r){r=gt(this.doc,r);var i=fn(this,Ue(this.doc,r.line)),S=0,U=(i.length-1)/2,K=r.ch,$;if(K==0)$=i[2];else for(;;){var re=S+U>>1;if((re?i[re*2-1]:0)>=K)U=re;else if(i[re*2+1]<K)S=re+1;else{$=i[re*2+2];break}}var fe=$?$.indexOf("overlay "):-1;return fe<0?$:fe==0?null:$.slice(0,fe-1)},getModeAt:function(r){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(r).state).mode:i},getHelper:function(r,i){return this.getHelpers(r,i)[0]},getHelpers:function(r,i){var S=[];if(!n.hasOwnProperty(i))return S;var U=n[i],K=this.getModeAt(r);if(typeof K[i]=="string")U[K[i]]&&S.push(U[K[i]]);else if(K[i])for(var $=0;$<K[i].length;$++){var re=U[K[i][$]];re&&S.push(re)}else K.helperType&&U[K.helperType]?S.push(U[K.helperType]):U[K.name]&&S.push(U[K.name]);for(var fe=0;fe<U._global.length;fe++){var me=U._global[fe];me.pred(K,this)&&ge(S,me.val)==-1&&S.push(me.val)}return S},getStateAfter:function(r,i){var S=this.doc;return r=Ft(S,r==null?S.first+S.size-1:r),zr(this,r+1,i).state},cursorCoords:function(r,i){var S,U=this.doc.sel.primary();return r==null?S=U.head:typeof r=="object"?S=gt(this.doc,r):S=r?U.from():U.to(),tn(this,S,i||"page")},charCoords:function(r,i){return ma(this,gt(this.doc,r),i||"page")},coordsChar:function(r,i){return r=lo(this,r,i||"page"),va(this,r.left,r.top)},lineAtHeight:function(r,i){return r=lo(this,{top:r,left:0},i||"page").top,Ht(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,S){var U=!1,K;if(typeof r=="number"){var $=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>$&&(r=$,U=!0),K=Ue(this.doc,r)}else K=r;return Hi(this,K,{top:0,left:0},i||"page",S||U).top+(U?this.doc.height-en(K):0)},defaultTextHeight:function(){return Xn(this.display)},defaultCharWidth:function(){return Yn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,S,U,K){var $=this.display;r=tn(this,gt(this.doc,r));var re=r.bottom,fe=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),$.sizer.appendChild(i),U=="over")re=r.top;else if(U=="above"||U=="near"){var me=Math.max($.wrapper.clientHeight,this.doc.height),_e=Math.max($.sizer.clientWidth,$.lineSpace.clientWidth);(U=="above"||r.bottom+i.offsetHeight>me)&&r.top>i.offsetHeight?re=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=me&&(re=r.bottom),fe+i.offsetWidth>_e&&(fe=_e-i.offsetWidth)}i.style.top=re+"px",i.style.left=i.style.right="",K=="right"?(fe=$.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(K=="left"?fe=0:K=="middle"&&(fe=($.sizer.clientWidth-i.offsetWidth)/2),i.style.left=fe+"px"),S&&Js(this,{left:fe,top:re,right:fe+i.offsetWidth,bottom:re+i.offsetHeight})},triggerOnKeyDown:Or(ps),triggerOnKeyPress:Or(gs),triggerOnKeyUp:ms,triggerOnMouseDown:Or(vs),execCommand:function(r){if(Di.hasOwnProperty(r))return Di[r].call(null,this)},triggerElectric:Or(function(r){_s(this,r)}),findPosH:function(r,i,S,U){var K=1;i<0&&(K=-1,i=-i);for(var $=gt(this.doc,r),re=0;re<i&&!($=Ka(this.doc,$,K,S,U),$.hitSide);++re);return $},moveH:Or(function(r,i){var S=this;this.extendSelectionsBy(function(U){return S.display.shift||S.doc.extend||U.empty()?Ka(S.doc,U.head,r,i,S.options.rtlMoveVisually):r<0?U.from():U.to()},Le)}),deleteH:Or(function(r,i){var S=this.doc.sel,U=this.doc;S.somethingSelected()?U.replaceSelection("",null,"+delete"):ii(this,function(K){var $=Ka(U,K.head,r,i,!1);return r<0?{from:$,to:K.head}:{from:K.head,to:$}})}),findPosV:function(r,i,S,U){var K=1,$=U;i<0&&(K=-1,i=-i);for(var re=gt(this.doc,r),fe=0;fe<i;++fe){var me=tn(this,re,"div");if($==null?$=me.left:me.left=$,re=Ls(this,me,K,S),re.hitSide)break}return re},moveV:Or(function(r,i){var S=this,U=this.doc,K=[],$=!this.display.shift&&!U.extend&&U.sel.somethingSelected();if(U.extendSelectionsBy(function(fe){if($)return r<0?fe.from():fe.to();var me=tn(S,fe.head,"div");fe.goalColumn!=null&&(me.left=fe.goalColumn),K.push(me.left);var _e=Ls(S,me,r,i);return i=="page"&&fe==U.sel.primary()&&Ta(S,ma(S,_e,"div").top-me.top),_e},Le),K.length)for(var re=0;re<U.sel.ranges.length;re++)U.sel.ranges[re].goalColumn=K[re]}),findWordAt:function(r){var i=this.doc,S=Ue(i,r.line).text,U=r.ch,K=r.ch;if(S){var $=this.getHelper(r,"wordChars");(r.sticky=="before"||K==S.length)&&U?--U:++K;for(var re=S.charAt(U),fe=Ae(re,$)?function(me){return Ae(me,$)}:/\s/.test(re)?function(me){return/\s/.test(me)}:function(me){return!/\s/.test(me)&&!Ae(me)};U>0&&fe(S.charAt(U-1));)--U;for(;K<S.length&&fe(S.charAt(K));)++K}return new Qt(Be(r.line,U),Be(r.line,K))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?H(this.display.cursorDiv,"CodeMirror-overwrite"):h(this.display.cursorDiv,"CodeMirror-overwrite"),oe(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==M()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Or(function(r,i){vi(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-dn(this)-this.display.barHeight,width:r.scrollWidth-dn(this)-this.display.barWidth,clientHeight:ha(this),clientWidth:On(this)}},scrollIntoView:Or(function(r,i){r==null?(r={from:this.doc.sel.primary().head,to:null},i==null&&(i=this.options.cursorScrollMargin)):typeof r=="number"?r={from:Be(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=i||0,r.from.line!=null?Qs(this,r):Eo(this,r.from,r.to,r.margin)}),setSize:Or(function(r,i){var S=this,U=function($){return typeof $=="number"||/^\d+$/.test(String($))?$+"px":$};r!=null&&(this.display.wrapper.style.width=U(r)),i!=null&&(this.display.wrapper.style.height=U(i)),this.options.lineWrapping&&ao(this);var K=this.display.viewFrom;this.doc.iter(K,this.display.viewTo,function($){if($.widgets){for(var re=0;re<$.widgets.length;re++)if($.widgets[re].noHScroll){En(S,K,"widget");break}}++K}),this.curOp.forceUpdate=!0,oe(this,"refresh",this)}),operation:function(r){return Hr(this,r)},startOperation:function(){return Fn(this)},endOperation:function(){return jn(this)},refresh:Or(function(){var r=this.display.cachedTextHeight;Ur(this),this.curOp.forceUpdate=!0,mi(this),vi(this,this.doc.scrollLeft,this.doc.scrollTop),La(this.display),(r==null||Math.abs(r-Xn(this.display))>.5||this.options.lineWrapping)&&xa(this),oe(this,"refresh",this)}),swapDoc:Or(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Mo(this,r),mi(this),this.display.input.reset(),vi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,wr(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:r},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}},le(e),e.registerHelper=function(r,i,S){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=S},e.registerGlobalHelper=function(r,i,S,U){e.registerHelper(r,i,U),n[r]._global.push({pred:S,val:U})}}function Ka(e,t,n,r,i){var S=t,U=n,K=Ue(e,t.line),$=i&&e.direction=="rtl"?-n:n;function re(){var ut=t.line+$;return ut<e.first||ut>=e.first+e.size?!1:(t=new Be(ut,t.ch,t.sticky),K=Ue(e,ut))}function fe(ut){var Ze;if(r=="codepoint"){var pt=K.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(pt)?Ze=null:Ze=new Be(t.line,Math.max(0,Math.min(K.text.length,t.ch+n*(pt>=55296&&pt<56320?2:1))),-n)}else i?Ze=Ml(e.cm,K,t,n):Ze=Ba(K,t,n);if(Ze==null)if(!ut&&re())t=Fa(i,e.cm,K,t.line,$);else return!1;else t=Ze;return!0}if(r=="char"||r=="codepoint")fe();else if(r=="column")fe(!0);else if(r=="word"||r=="group")for(var me=null,_e=r=="group",xe=e.cm&&e.cm.getHelper(t,"wordChars"),Ie=!0;!(n<0&&!fe(!Ie));Ie=!1){var je=K.text.charAt(t.ch)||`
|
|
`,Ve=Ae(je,xe)?"w":_e&&je==`
|
|
`?"n":!_e||/\s/.test(je)?null:"p";if(_e&&!Ie&&!Ve&&(Ve="s"),me&&me!=Ve){n<0&&(n=1,fe(),t.sticky="after");break}if(Ve&&(me=Ve),n>0&&!fe(!Ie))break}var Qe=ea(e,t,S,U,!0);return yr(S,Qe)&&(Qe.hitSide=!0),Qe}function Ls(e,t,n,r){var i=e.doc,S=t.left,U;if(r=="page"){var K=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),$=Math.max(K-.5*Xn(e.display),3);U=(n>0?t.bottom:t.top)+n*$}else r=="line"&&(U=n>0?t.bottom+3:t.top-3);for(var re;!(re=va(e,S,U),!re.outside);){if(n<0?U<=0:U>=i.height){re.hitSide=!0;break}U+=n*5}return re}var Zt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new pe,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Zt.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;ws(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function S(K){for(var $=K.target;$;$=$.parentNode){if($==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test($.className))break}return!1}ke(i,"paste",function(K){if(!S(K)||J(r,K)||Cs(K,r))return;F<=11&&setTimeout(Er(r,function(){return t.updateFromDOM()}),20)}),ke(i,"compositionstart",function(K){t.composing={data:K.data,done:!1}}),ke(i,"compositionupdate",function(K){t.composing||(t.composing={data:K.data,done:!1})}),ke(i,"compositionend",function(K){t.composing&&(K.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ke(i,"touchstart",function(){return n.forceCompositionEnd()}),ke(i,"input",function(){t.composing||t.readFromDOMSoon()});function U(K){if(!S(K)||J(r,K))return;if(r.somethingSelected())oa({lineWise:!1,text:r.getSelections()}),K.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var $=Ts(r);oa({lineWise:!0,text:$.text}),K.type=="cut"&&r.operation(function(){r.setSelections($.ranges,0,Se),r.replaceSelection("",null,"cut")})}else return;if(K.clipboardData){K.clipboardData.clearData();var re=nn.text.join(`
|
|
`);if(K.clipboardData.setData("Text",re),K.clipboardData.getData("Text")==re){K.preventDefault();return}}var fe=As(),me=fe.firstChild;r.display.lineSpace.insertBefore(fe,r.display.lineSpace.firstChild),me.value=nn.text.join(`
|
|
`);var _e=document.activeElement;te(me),setTimeout(function(){r.display.lineSpace.removeChild(fe),_e.focus(),_e==i&&n.showPrimarySelection()},50)}ke(i,"copy",U),ke(i,"cut",U)},Zt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Zt.prototype.prepareSelection=function(){var e=mo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Zt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Zt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Zt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom){e.removeAllRanges();return}var S=sa(t,e.anchorNode,e.anchorOffset),U=sa(t,e.focusNode,e.focusOffset);if(S&&!S.bad&&U&&!U.bad&&dt(or(S,U),r)==0&&dt(on(S,U),i)==0)return;var K=t.display.view,$=r.line>=t.display.viewFrom&&Rs(t,r)||{node:K[0].measure.map[2],offset:0},re=i.line<t.display.viewTo&&Rs(t,i);if(!re){var fe=K[K.length-1].measure,me=fe.maps?fe.maps[fe.maps.length-1]:fe.map;re={node:me[me.length-1],offset:me[me.length-2]-me[me.length-3]}}if(!$||!re){e.removeAllRanges();return}var _e=e.rangeCount&&e.getRangeAt(0),xe;try{xe=m($.node,$.offset,re.offset,re.node)}catch(Ie){}xe&&(!L&&t.state.focused?(e.collapse($.node,$.offset),xe.collapsed||(e.removeAllRanges(),e.addRange(xe))):(e.removeAllRanges(),e.addRange(xe)),_e&&e.anchorNode==null?e.addRange(_e):L&&this.startGracePeriod()),this.rememberSelection()},Zt.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},Zt.prototype.showMultipleSelections=function(e){s(this.cm.display.cursorDiv,e.cursors),s(this.cm.display.selectionDiv,e.selection)},Zt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Zt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return y(this.div,t)},Zt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Zt.prototype.blur=function(){this.div.blur()},Zt.prototype.getField=function(){return this.div},Zt.prototype.supportsTouch=function(){return!0},Zt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Hr(this.cm,function(){return e.cm.curOp.selectionChanged=!0});function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}this.polling.set(this.cm.options.pollInterval,t)},Zt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Zt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(c&&E&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var n=sa(t,e.anchorNode,e.anchorOffset),r=sa(t,e.focusNode,e.focusOffset);n&&r&&Hr(t,function(){kr(t.doc,Sn(n,r),Se),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Zt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=Be(r.line-1,Ue(e.doc,r.line-1).length)),i.ch==Ue(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Be(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var S,U,K;r.line==t.viewFrom||(S=Nn(e,r.line))==0?(U=_t(t.view[0].line),K=t.view[0].node):(U=_t(t.view[S].line),K=t.view[S-1].node.nextSibling);var $=Nn(e,i.line),re,fe;if($==t.view.length-1?(re=t.viewTo-1,fe=t.lineDiv.lastChild):(re=_t(t.view[$+1].line)-1,fe=t.view[$+1].node.previousSibling),!K)return!1;for(var me=e.doc.splitLines(tu(e,K,fe,U,re)),_e=St(e.doc,Be(U,0),Be(re,Ue(e.doc,re).text.length));me.length>1&&_e.length>1;)if(T(me)==T(_e))me.pop(),_e.pop(),re--;else if(me[0]==_e[0])me.shift(),_e.shift(),U++;else break;for(var xe=0,Ie=0,je=me[0],Ve=_e[0],Qe=Math.min(je.length,Ve.length);xe<Qe&&je.charCodeAt(xe)==Ve.charCodeAt(xe);)++xe;for(var ut=T(me),Ze=T(_e),pt=Math.min(ut.length-(me.length==1?xe:0),Ze.length-(_e.length==1?xe:0));Ie<pt&&ut.charCodeAt(ut.length-Ie-1)==Ze.charCodeAt(Ze.length-Ie-1);)++Ie;if(me.length==1&&_e.length==1&&U==r.line)for(;xe&&xe>r.ch&&ut.charCodeAt(ut.length-Ie-1)==Ze.charCodeAt(Ze.length-Ie-1);)xe--,Ie++;me[me.length-1]=ut.slice(0,ut.length-Ie).replace(/^\u200b+/,""),me[0]=me[0].slice(xe).replace(/\u200b+$/,"");var Pt=Be(U,xe),Tt=Be(re,_e.length?T(_e).length-Ie:0);if(me.length>1||me[0]||dt(Pt,Tt))return ti(e.doc,me,Pt,Tt,"+input"),!0},Zt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Zt.prototype.reset=function(){this.forceCompositionEnd()},Zt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Zt.prototype.readFromDOMSoon=function(){var e=this;if(this.readDOMTimeout!=null)return;this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80)},Zt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Hr(this.cm,function(){return Ur(e.cm)})},Zt.prototype.setUneditable=function(e){e.contentEditable="false"},Zt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Er(this.cm,za)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Zt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Zt.prototype.onContextMenu=function(){},Zt.prototype.resetPosition=function(){},Zt.prototype.needsContentAttribute=!0;function Rs(e,t){var n=fa(e,t.line);if(!n||n.hidden)return null;var r=Ue(e.doc,t.line),i=eo(n,r,t.line),S=Je(r,e.doc.direction),U="left";if(S){var K=$e(S,t.ch);U=K%2?"right":"left"}var $=no(i.map,t.ch,U);return $.offset=$.collapse=="right"?$.end:$.start,$}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function oi(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var S="",U=!1,K=e.doc.lineSeparator(),$=!1;function re(xe){return function(Ie){return Ie.id==xe}}function fe(){U&&(S+=K,$&&(S+=K),U=$=!1)}function me(xe){xe&&(fe(),S+=xe)}function _e(xe){if(xe.nodeType==1){var Ie=xe.getAttribute("cm-text");if(Ie){me(Ie);return}var je=xe.getAttribute("cm-marker"),Ve;if(je){var Qe=e.findMarks(Be(r,0),Be(i+1,0),re(+je));Qe.length&&(Ve=Qe[0].find(0))&&me(St(e.doc,Ve.from,Ve.to).join(K));return}if(xe.getAttribute("contenteditable")=="false")return;var ut=/^(pre|div|p|li|table|br)$/i.test(xe.nodeName);if(!/^br$/i.test(xe.nodeName)&&xe.textContent.length==0)return;ut&&fe();for(var Ze=0;Ze<xe.childNodes.length;Ze++)_e(xe.childNodes[Ze]);/^(pre|p)$/i.test(xe.nodeName)&&($=!0),ut&&(U=!0)}else xe.nodeType==3&&me(xe.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(_e(t),t==n);)t=t.nextSibling,$=!1;return S}function sa(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return oi(e.clipPos(Be(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var S=e.display.view[i];if(S.node==r)return ru(S,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!y(r,t))return oi(Be(_t(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var S=e.rest?T(e.rest):e.line;return oi(Be(_t(S),S.text.length),i)}var U=t.nodeType==3?t:null,K=t;for(!U&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(U=t.firstChild,n&&(n=U.nodeValue.length));K.parentNode!=r;)K=K.parentNode;var $=e.measure,re=$.maps;function fe(Ve,Qe,ut){for(var Ze=-1;Ze<(re?re.length:0);Ze++)for(var pt=Ze<0?$.map:re[Ze],Pt=0;Pt<pt.length;Pt+=3){var Tt=pt[Pt+2];if(Tt==Ve||Tt==Qe){var Wt=_t(Ze<0?e.line:e.rest[Ze]),er=pt[Pt]+ut;return(ut<0||Tt!=Ve)&&(er=pt[Pt+(ut?1:0)]),Be(Wt,er)}}}var me=fe(U,K,n);if(me)return oi(me,i);for(var _e=K.nextSibling,xe=U?U.nodeValue.length-n:0;_e;_e=_e.nextSibling){if(me=fe(_e,_e.firstChild,0),me)return oi(Be(me.line,me.ch-xe),i);xe+=_e.textContent.length}for(var Ie=K.previousSibling,je=n;Ie;Ie=Ie.previousSibling){if(me=fe(Ie,Ie.firstChild,-1),me)return oi(Be(me.line,me.ch+je),i);je+=Ie.textContent.length}}var hr=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new pe,this.hasSelection=!1,this.composing=null};hr.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),C&&(i.style.width="0px"),ke(i,"input",function(){W&&F>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),ke(i,"paste",function(U){if(J(r,U)||Cs(U,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function S(U){if(J(r,U))return;if(r.somethingSelected())oa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var K=Ts(r);oa({lineWise:!0,text:K.text}),U.type=="cut"?r.setSelections(K.ranges,null,Se):(n.prevInput="",i.value=K.text.join(`
|
|
`),te(i))}else return;U.type=="cut"&&(r.state.cutIncoming=+new Date)}ke(i,"cut",S),ke(i,"copy",S),ke(e.scroller,"paste",function(U){if(mn(e,U)||J(r,U))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var K=new Event("paste");K.clipboardData=U.clipboardData,i.dispatchEvent(K)}),ke(e.lineSpace,"selectstart",function(U){mn(e,U)||q(U)}),ke(i,"compositionstart",function(){var U=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:U,range:r.markText(U,r.getCursor("to"),{className:"CodeMirror-composing"})}}),ke(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},hr.prototype.createField=function(e){this.wrapper=As(),this.textarea=this.wrapper.firstChild},hr.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},hr.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=mo(e);if(e.options.moveInputWithCursor){var i=tn(e,n.sel.primary().head,"div"),S=t.wrapper.getBoundingClientRect(),U=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+U.top-S.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+U.left-S.left))}return r},hr.prototype.showSelection=function(e){var t=this.cm,n=t.display;s(n.cursorDiv,e.cursors),s(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},hr.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&te(this.textarea),W&&F>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",W&&F>=9&&(this.hasSelection=null))},hr.prototype.getField=function(){return this.textarea},hr.prototype.supportsTouch=function(){return!1},hr.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||M()!=this.textarea))try{this.textarea.focus()}catch(e){}},hr.prototype.blur=function(){this.textarea.blur()},hr.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},hr.prototype.receivedFocus=function(){this.slowPoll()},hr.prototype.slowPoll=function(){var e=this;if(this.pollingFast)return;this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},hr.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},hr.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||tt(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(W&&F>=9&&this.hasSelection===i||u&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var S=i.charCodeAt(0);if(S==8203&&!r&&(r="\u200B"),S==8666)return this.reset(),this.cm.execCommand("undo")}for(var U=0,K=Math.min(r.length,i.length);U<K&&r.charCodeAt(U)==i.charCodeAt(U);)++U;return Hr(t,function(){za(t,i.slice(U),r.length-U,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
|
|
`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},hr.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},hr.prototype.onKeyPress=function(){W&&F>=9&&(this.hasSelection=null),this.fastPoll()},hr.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var S=In(n,e),U=r.scroller.scrollTop;if(!S||w)return;var K=n.options.resetSelectionOnContextMenu;K&&n.doc.sel.contains(S)==-1&&Er(n,kr)(n.doc,Sn(S),Se);var $=i.style.cssText,re=t.wrapper.style.cssText,fe=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-fe.top-5)+"px; left: "+(e.clientX-fe.left-5)+`px;
|
|
z-index: 1000; background: `+(W?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var me;O&&(me=window.scrollY),r.input.focus(),O&&window.scrollTo(null,me),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=xe,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function _e(){if(i.selectionStart!=null){var je=n.somethingSelected(),Ve="\u200B"+(je?i.value:"");i.value="\u21DA",i.value=Ve,t.prevInput=je?"":"\u200B",i.selectionStart=1,i.selectionEnd=Ve.length,r.selForContextMenu=n.doc.sel}}function xe(){if(t.contextMenuPending!=xe)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=re,i.style.cssText=$,W&&F<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=U),i.selectionStart!=null){(!W||W&&F<9)&&_e();var je=0,Ve=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Er(n,Xo)(n):je++<10?r.detectingSelectAll=setTimeout(Ve,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Ve,200)}}if(W&&F>=9&&_e(),l){ue(e);var Ie=function(){nt(window,"mouseup",Ie),setTimeout(xe,20)};ke(window,"mouseup",Ie)}else setTimeout(xe,50)},hr.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},hr.prototype.setUneditable=function(){},hr.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?j(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=M();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=K.getValue()}var i;if(e.form&&(ke(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var S=e.form;i=S.submit;try{var U=S.submit=function(){r(),S.submit=i,S.submit(),S.submit=U}}catch($){}}t.finishInit=function($){$.save=r,$.getTextArea=function(){return e},$.toTextArea=function(){$.toTextArea=isNaN,r(),e.parentNode.removeChild($.getWrapperElement()),e.style.display="",e.form&&(nt(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var K=nr(function($){return e.parentNode.insertBefore($,e.nextSibling)},t);return K}function iu(e){e.off=nt,e.on=ke,e.wheelEventPixels=cl,e.Doc=Br,e.splitLines=Ge,e.countColumn=ie,e.findColumn=we,e.isWordChar=Ee,e.Pass=Ne,e.signal=oe,e.Line=Dn,e.changeEnd=Cn,e.scrollbarModel=Co,e.Pos=Be,e.cmpPos=dt,e.modes=jt,e.mimeModes=xt,e.resolveMode=Ut,e.getMode=Nt,e.modeExtensions=It,e.extendMode=Bt,e.copyState=Ct,e.startState=mt,e.innerMode=wt,e.commands=Di,e.keyMap=gn,e.keyName=us,e.isModifierKey=ss,e.lookupKey=ni,e.normalizeKeyMap=Ol,e.StringStream=rt,e.SharedTextMarker=Ri,e.TextMarker=Tn,e.LineWidget=Li,e.e_preventDefault=q,e.e_stopPropagation=ee,e.e_stop=ue,e.addClass=H,e.contains=y,e.rmClass=h,e.keyNames=wn}$l(nr),ql(nr);var au="iter insert remove copy getEditor constructor".split(" ");for(var la in Br.prototype)Br.prototype.hasOwnProperty(la)&&ge(au,la)<0&&(nr.prototype[la]=function(e){return function(){return e.apply(this.doc,arguments)}}(Br.prototype[la]));return le(Br),nr.inputStyles={textarea:hr,contenteditable:Zt},nr.defineMode=function(e){!nr.defaults.mode&&e!="null"&&(nr.defaults.mode=e),Kt.apply(this,arguments)},nr.defineMIME=Vt,nr.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),nr.defineMIME("text/plain","null"),nr.defineExtension=function(e,t){nr.prototype[e]=t},nr.defineDocExtension=function(e,t){Br.prototype[e]=t},nr.fromTextArea=nu,iu(nr),nr.version="5.58.2",nr})},Y1PL:function(yt,it,se){"use strict";se.r(it),se.d(it,"ResizableTextArea",function(){return ge});var he=se("wx14"),Y=se("1OyB"),L=se("vuIU"),X=se("Ji7U"),I=se("LK+K"),k=se("q1tI"),W=se("VTBJ"),F=se("rePB"),O=se("Zm9Q"),D=se("Kwbf"),E=se("c+Xe"),w=se("m+aA"),P=se("bdgK"),_=new Map;function A(Se){Se.forEach(function(Me){var Le,we=Me.target;(Le=_.get(we))===null||Le===void 0||Le.forEach(function(ve){return ve(we)})})}var C=new P.default(A),c=null,o=null;function u(Se,Me){_.has(Se)||(_.set(Se,new Set),C.observe(Se)),_.get(Se).add(Me)}function d(Se,Me){_.has(Se)&&(_.get(Se).delete(Me),_.get(Se).size||(C.unobserve(Se),_.delete(Se)))}var x=function(Se){Object(X.a)(Le,Se);var Me=Object(I.a)(Le);function Le(){return Object(Y.a)(this,Le),Me.apply(this,arguments)}return Object(L.a)(Le,[{key:"render",value:function(){return this.props.children}}]),Le}(k.Component),v=k.createContext(null);function f(Se){var Me=Se.children,Le=Se.onBatchResize,we=k.useRef(0),ve=k.useRef([]),N=k.useContext(v),T=k.useCallback(function(R,z,Z){we.current+=1;var B=we.current;ve.current.push({size:R,element:z,data:Z}),Promise.resolve().then(function(){B===we.current&&(Le==null||Le(ve.current),ve.current=[])}),N==null||N(R,z,Z)},[Le,N]);return k.createElement(v.Provider,{value:T},Me)}function l(Se){var Me=Se.children,Le=Se.disabled,we=k.useRef(null),ve=k.useRef(null),N=k.useContext(v),T=k.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),R=k.isValidElement(Me)&&Object(E.c)(Me),z=R?Me.ref:null,Z=k.useMemo(function(){return Object(E.a)(z,we)},[z,we]),B=k.useRef(Se);B.current=Se;var ce=k.useCallback(function(Ee){var Ae=B.current,Oe=Ae.onResize,Re=Ae.data,De=Ee.getBoundingClientRect(),Pe=De.width,Ke=De.height,Xe=Ee.offsetWidth,Ye=Ee.offsetHeight,$e=Math.floor(Pe),ft=Math.floor(Ke);if(T.current.width!==$e||T.current.height!==ft||T.current.offsetWidth!==Xe||T.current.offsetHeight!==Ye){var Je={width:$e,height:ft,offsetWidth:Xe,offsetHeight:Ye};T.current=Je;var et=Xe===Math.round(Pe)?Pe:Xe,ke=Ye===Math.round(Ke)?Ke:Ye,st=Object(W.a)(Object(W.a)({},Je),{},{offsetWidth:et,offsetHeight:ke});N==null||N(st,Ee,Re),Oe&&Promise.resolve().then(function(){Oe(st,Ee)})}},[]);return k.useEffect(function(){var Ee=Object(w.a)(we.current)||Object(w.a)(ve.current);return Ee&&!Le&&u(Ee,ce),function(){return d(Ee,ce)}},[we.current,Le]),k.createElement(x,{ref:ve},R?k.cloneElement(Me,{ref:Z}):Me)}var b="rc-observer-key";function h(Se){var Me=Se.children,Le=Object(O.a)(Me);return Le.map(function(we,ve){var N=(we==null?void 0:we.key)||"".concat(b,"-").concat(ve);return k.createElement(l,Object(he.a)({},Se,{key:N}),we)})}h.Collection=f;var p=h,s=se("bT9E"),a=se("TSYQ"),g=se.n(a),m=`
|
|
min-height:0 !important;
|
|
max-height:none !important;
|
|
height:0 !important;
|
|
visibility:hidden !important;
|
|
overflow:hidden !important;
|
|
position:absolute !important;
|
|
z-index:-1000 !important;
|
|
top:0 !important;
|
|
right:0 !important
|
|
`,y=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],M={},H;function V(Se){var Me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Le=Se.getAttribute("id")||Se.getAttribute("data-reactid")||Se.getAttribute("name");if(Me&&M[Le])return M[Le];var we=window.getComputedStyle(Se),ve=we.getPropertyValue("box-sizing")||we.getPropertyValue("-moz-box-sizing")||we.getPropertyValue("-webkit-box-sizing"),N=parseFloat(we.getPropertyValue("padding-bottom"))+parseFloat(we.getPropertyValue("padding-top")),T=parseFloat(we.getPropertyValue("border-bottom-width"))+parseFloat(we.getPropertyValue("border-top-width")),R=y.map(function(Z){return"".concat(Z,":").concat(we.getPropertyValue(Z))}).join(";"),z={sizingStyle:R,paddingSize:N,borderSize:T,boxSizing:ve};return Me&&Le&&(M[Le]=z),z}function te(Se){var Me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Le=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,we=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;H||(H=document.createElement("textarea"),H.setAttribute("tab-index","-1"),H.setAttribute("aria-hidden","true"),document.body.appendChild(H)),Se.getAttribute("wrap")?H.setAttribute("wrap",Se.getAttribute("wrap")):H.removeAttribute("wrap");var ve=V(Se,Me),N=ve.paddingSize,T=ve.borderSize,R=ve.boxSizing,z=ve.sizingStyle;H.setAttribute("style","".concat(z,";").concat(m)),H.value=Se.value||Se.placeholder||"";var Z=Number.MIN_SAFE_INTEGER,B=Number.MAX_SAFE_INTEGER,ce=H.scrollHeight,Ee;if(R==="border-box"?ce+=T:R==="content-box"&&(ce-=N),Le!==null||we!==null){H.value=" ";var Ae=H.scrollHeight-N;Le!==null&&(Z=Ae*Le,R==="border-box"&&(Z=Z+N+T),ce=Math.max(Z,ce)),we!==null&&(B=Ae*we,R==="border-box"&&(B=B+N+T),Ee=ce>B?"":"hidden",ce=Math.min(B,ce))}return{height:ce,minHeight:Z,maxHeight:B,overflowY:Ee,resize:"none"}}var G=se("Gytx"),j=se.n(G),ie;(function(Se){Se[Se.NONE=0]="NONE",Se[Se.RESIZING=1]="RESIZING",Se[Se.RESIZED=2]="RESIZED"})(ie||(ie={}));var pe=function(Se){Object(X.a)(Le,Se);var Me=Object(I.a)(Le);function Le(we){var ve;return Object(Y.a)(this,Le),ve=Me.call(this,we),ve.nextFrameActionId=void 0,ve.resizeFrameId=void 0,ve.textArea=void 0,ve.saveTextArea=function(N){ve.textArea=N},ve.handleResize=function(N){var T=ve.state.resizeStatus,R=ve.props,z=R.autoSize,Z=R.onResize;if(T!==ie.NONE)return;typeof Z=="function"&&Z(N),z&&ve.resizeOnNextFrame()},ve.resizeOnNextFrame=function(){cancelAnimationFrame(ve.nextFrameActionId),ve.nextFrameActionId=requestAnimationFrame(ve.resizeTextarea)},ve.resizeTextarea=function(){var N=ve.props.autoSize;if(!N||!ve.textArea)return;var T=N.minRows,R=N.maxRows,z=te(ve.textArea,!1,T,R);ve.setState({textareaStyles:z,resizeStatus:ie.RESIZING},function(){cancelAnimationFrame(ve.resizeFrameId),ve.resizeFrameId=requestAnimationFrame(function(){ve.setState({resizeStatus:ie.RESIZED},function(){ve.resizeFrameId=requestAnimationFrame(function(){ve.setState({resizeStatus:ie.NONE}),ve.fixFirefoxAutoScroll()})})})})},ve.renderTextArea=function(){var N=ve.props,T=N.prefixCls,R=T===void 0?"rc-textarea":T,z=N.autoSize,Z=N.onResize,B=N.className,ce=N.disabled,Ee=ve.state,Ae=Ee.textareaStyles,Oe=Ee.resizeStatus,Re=Object(s.a)(ve.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),De=g()(R,B,Object(F.a)({},"".concat(R,"-disabled"),ce));"value"in Re&&(Re.value=Re.value||"");var Pe=Object(W.a)(Object(W.a)(Object(W.a)({},ve.props.style),Ae),Oe===ie.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return k.createElement(p,{onResize:ve.handleResize,disabled:!(z||Z)},k.createElement("textarea",Object(he.a)({},Re,{className:De,style:Pe,ref:ve.saveTextArea})))},ve.state={textareaStyles:{},resizeStatus:ie.NONE},ve}return Object(L.a)(Le,[{key:"componentDidUpdate",value:function(ve){(ve.value!==this.props.value||!j()(ve.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 ve=this.textArea.selectionStart,N=this.textArea.selectionEnd;this.textArea.setSelectionRange(ve,N)}}catch(T){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Le}(k.Component),ge=pe,be=function(Se){Object(X.a)(Le,Se);var Me=Object(I.a)(Le);function Le(we){var ve;Object(Y.a)(this,Le),ve=Me.call(this,we),ve.resizableTextArea=void 0,ve.focus=function(){ve.resizableTextArea.textArea.focus()},ve.saveTextArea=function(T){ve.resizableTextArea=T},ve.handleChange=function(T){var R=ve.props.onChange;ve.setValue(T.target.value,function(){ve.resizableTextArea.resizeTextarea()}),R&&R(T)},ve.handleKeyDown=function(T){var R=ve.props,z=R.onPressEnter,Z=R.onKeyDown;T.keyCode===13&&z&&z(T),Z&&Z(T)};var N=typeof we.value=="undefined"||we.value===null?we.defaultValue:we.value;return ve.state={value:N},ve}return Object(L.a)(Le,[{key:"setValue",value:function(ve,N){"value"in this.props||this.setState({value:ve},N)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return k.createElement(ge,Object(he.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ve){return"value"in ve?{value:ve.value}:null}}]),Le}(k.Component),Ne=it.default=be},ZWs3:function(yt,it,se){"use strict";se.d(it,"a",function(){return E});var he=se("+L6B"),Y=se("2/Rp"),L=se("0Owb"),X=se("9og8"),I=se("tJVT"),k=se("PpiC"),W=se("WmNS"),F=se.n(W),O=se("q1tI"),D=se.n(O),E=function(P){var _=P.children,A=Object(k.a)(P,["children"]),C=Object(O.useState)(!1),c=Object(I.a)(C,2),o=c[0],u=c[1];return D.a.createElement(Y.a,Object(L.a)({},A,{loading:o,onClick:function(){var d=Object(X.a)(F.a.mark(function x(v){return F.a.wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.prev=0,u(!0),l.next=4,A.onClick(v);case 4:u(!1),l.next=10;break;case 7:l.prev=7,l.t0=l.catch(0),u(!1);case 10:case"end":return l.stop()}},x,null,[[0,7]])}));return function(x){return d.apply(this,arguments)}}()}),_)}},bT9E:function(yt,it,se){"use strict";se.d(it,"a",function(){return Y});var he=se("VTBJ");function Y(L,X){var I=Object(he.a)({},L);return Array.isArray(X)&&X.forEach(function(k){delete I[k]}),I}},c5Ni:function(yt,it,se){},dejd:function(yt,it,se){},dmUQ:function(yt,it,se){"use strict";var he=se("Ff2n"),Y=se("rePB"),L=se("1OyB"),X=se("vuIU"),I=se("Ji7U"),k=se("md7G"),W=se("foSv"),F=se("q1tI"),O=se.n(F),D=se("TSYQ"),E=se.n(D),w=se("4IlW");function P(s,a){var g=Object.keys(s);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(s);a&&(m=m.filter(function(y){return Object.getOwnPropertyDescriptor(s,y).enumerable})),g.push.apply(g,m)}return g}function _(s){for(var a=1;a<arguments.length;a++){var g=arguments[a]!=null?arguments[a]:{};a%2?P(Object(g),!0).forEach(function(m){Object(Y.a)(s,m,g[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(g)):P(Object(g)).forEach(function(m){Object.defineProperty(s,m,Object.getOwnPropertyDescriptor(g,m))})}return s}function A(s){var a=C();return function(){var m=Object(W.a)(s),y;if(a){var M=Object(W.a)(this).constructor;y=Reflect.construct(m,arguments,M)}else y=m.apply(this,arguments);return Object(k.a)(this,y)}}function C(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(s){return!1}}function c(){}function o(s){s.preventDefault()}var u=function(a){return a.replace(/[^\w.-]+/g,"")},d=200,x=600,v=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,f=function(a){return a!=null},l=function(a,g){return g===a||typeof g=="number"&&typeof a=="number"&&isNaN(g)&&isNaN(a)},b=function(s){Object(I.a)(g,s);var a=A(g);function g(m){var y;Object(L.a)(this,g),y=a.call(this,m),y.onKeyDown=function(V){var te=y.props,G=te.onKeyDown,j=te.onPressEnter;if(V.keyCode===w.a.UP){var ie=y.getRatio(V);y.up(V,ie,null),y.stop()}else if(V.keyCode===w.a.DOWN){var pe=y.getRatio(V);y.down(V,pe,null),y.stop()}else V.keyCode===w.a.ENTER&&j&&j(V);if(y.recordCursorPosition(),y.lastKeyCode=V.keyCode,G){for(var ge=arguments.length,be=new Array(ge>1?ge-1:0),Ne=1;Ne<ge;Ne++)be[Ne-1]=arguments[Ne];G.apply(void 0,[V].concat(be))}},y.onKeyUp=function(V){var te=y.props.onKeyUp;if(y.stop(),y.recordCursorPosition(),te){for(var G=arguments.length,j=new Array(G>1?G-1:0),ie=1;ie<G;ie++)j[ie-1]=arguments[ie];te.apply(void 0,[V].concat(j))}},y.onChange=function(V){var te=y.props.onChange;y.state.focused&&(y.inputting=!0),y.rawInput=y.props.parser(y.getValueFromEvent(V)),y.setState({inputValue:y.rawInput}),te(y.toNumber(y.rawInput))},y.onMouseUp=function(){var V=y.props.onMouseUp;y.recordCursorPosition(),V&&V.apply(void 0,arguments)},y.onFocus=function(){var V;y.setState({focused:!0}),(V=y.props).onFocus.apply(V,arguments)},y.onBlur=function(){var V=y.props.onBlur;y.inputting=!1,y.setState({focused:!1});var te=y.getCurrentValidValue(y.state.inputValue),G=y.setValue(te,c);if(V){var j=y.input.value,ie=y.getInputDisplayValue({focus:!1,value:G});y.input.value=ie&&Number(ie),V.apply(void 0,arguments),y.input.value=j}},y.getRatio=function(V){var te=1;return V.metaKey||V.ctrlKey?te=.1:V.shiftKey&&(te=10),te},y.getFullNum=function(V){return isNaN(V)?V:/e/i.test(String(V))?Number(V).toFixed(18).replace(/\.?0+$/,""):V},y.getPrecision=function(V){if(f(y.props.precision))return y.props.precision;var te=String(V);if(te.indexOf("e-")>=0)return parseInt(te.slice(te.indexOf("e-")+2),10);var G=0;return te.indexOf(".")>=0&&(G=te.length-te.indexOf(".")-1),G},y.getInputDisplayValue=function(V){var te=V||y.state,G=te.focused,j=te.inputValue,ie=te.value,pe;G?pe=j:pe=y.toPrecisionAsStep(ie),pe==null&&(pe="");var ge=y.formatWrapper(pe);return f(y.props.decimalSeparator)&&(ge=ge.toString().replace(".",y.props.decimalSeparator)),ge},y.recordCursorPosition=function(){try{y.cursorStart=y.input.selectionStart,y.cursorEnd=y.input.selectionEnd,y.currentValue=y.input.value,y.cursorBefore=y.input.value.substring(0,y.cursorStart),y.cursorAfter=y.input.value.substring(y.cursorEnd)}catch(V){}},y.restoreByAfter=function(V){if(V===void 0)return!1;var te=y.input.value,G=te.lastIndexOf(V);if(G===-1)return!1;var j=y.cursorBefore.length;return y.lastKeyCode===w.a.DELETE&&y.cursorBefore.charAt(j-1)===V[0]?(y.fixCaret(j,j),!0):G+V.length===te.length?(y.fixCaret(G,G),!0):!1},y.partRestoreByAfter=function(V){return V===void 0?!1:Array.prototype.some.call(V,function(te,G){var j=V.substring(G);return y.restoreByAfter(j)})},y.isNotCompleteNumber=function(V){return isNaN(V)||V===""||V===null||V&&V.toString().indexOf(".")===V.toString().length-1},y.stop=function(){y.autoStepTimer&&clearTimeout(y.autoStepTimer)},y.down=function(V,te,G){y.pressingUpOrDown=!0,y.step("down",V,te,G)},y.up=function(V,te,G){y.pressingUpOrDown=!0,y.step("up",V,te,G)},y.saveInput=function(V){y.input=V};var M=m.value;M===void 0&&(M=m.defaultValue),y.state={focused:m.autoFocus};var H=y.getValidValue(y.toNumber(M));return y.state=_(_({},y.state),{},{inputValue:y.toPrecisionAsStep(H),value:H}),y}return Object(X.a)(g,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(y){var M=this.props,H=M.value,V=M.onChange,te=M.max,G=M.min,j=this.state.focused;if(y){if(!l(y.value,H)||!l(y.max,te)||!l(y.min,G)){var ie=j?H:this.getValidValue(H),pe;this.pressingUpOrDown?pe=ie:this.inputting?pe=this.rawInput:pe=this.toPrecisionAsStep(ie),this.setState({value:ie,inputValue:pe})}var ge="value"in this.props?H:this.state.value;"max"in this.props&&y.max!==te&&typeof ge=="number"&&ge>te&&V&&V(te),"min"in this.props&&y.min!==G&&typeof ge=="number"&&ge<G&&V&&V(G)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var be=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===w.a.BACKSPACE?be=this.cursorStart-1:this.lastKeyCode===w.a.DELETE&&(be=this.cursorStart):be=this.input.value.length,this.fixCaret(be,be)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case w.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case w.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Ne){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(y){var M=y;return M===""?M="":this.isNotCompleteNumber(parseFloat(M))?M=this.state.value:M=this.getValidValue(M),this.toNumber(M)}},{key:"getValueFromEvent",value:function(y){var M=y.target.value.trim().replace(/。/g,".");return f(this.props.decimalSeparator)&&(M=M.replace(this.props.decimalSeparator,".")),M}},{key:"getValidValue",value:function(y){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,H=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,V=parseFloat(y);return isNaN(V)?y:(V<M&&(V=M),V>H&&(V=H),V)}},{key:"setValue",value:function(y,M){var H=this.props.precision,V=this.isNotCompleteNumber(parseFloat(y))?null:parseFloat(y),te=this.state.value,G=te===void 0?null:te,j=this.state.inputValue,ie=j===void 0?null:j,pe=typeof V=="number"?V.toFixed(H):"".concat(V),ge=V!==G||pe!=="".concat(ie);return"value"in this.props?(ie=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:ie},M)):this.setState({value:V,inputValue:this.toPrecisionAsStep(y)},M),ge&&this.props.onChange(V),V}},{key:"getMaxPrecision",value:function(y){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,H=this.props,V=H.precision,te=H.step;if(f(V))return V;var G=this.getPrecision(M),j=this.getPrecision(te),ie=this.getPrecision(y);return y?Math.max(ie,G+j):G+j}},{key:"getPrecisionFactor",value:function(y){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,H=this.getMaxPrecision(y,M);return Math.pow(10,H)}},{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(y){return this.props.formatter?this.props.formatter(y):y}},{key:"toPrecisionAsStep",value:function(y){if(this.isNotCompleteNumber(y)||y==="")return y;var M=Math.abs(this.getMaxPrecision(y));return isNaN(M)?y.toString():Number(y).toFixed(M)}},{key:"toNumber",value:function(y){var M=this.props.precision,H=this.state.focused,V=y&&y.length>16&&H;return this.isNotCompleteNumber(y)||V?y:f(M)?Math.round(y*Math.pow(10,M))/Math.pow(10,M):Number(y)}},{key:"upStep",value:function(y,M){var H=this.props.step,V=this.getPrecisionFactor(y,M),te=Math.abs(this.getMaxPrecision(y,M)),G=((V*y+V*H*M)/V).toFixed(te);return this.toNumber(G)}},{key:"downStep",value:function(y,M){var H=this.props.step,V=this.getPrecisionFactor(y,M),te=Math.abs(this.getMaxPrecision(y,M)),G=((V*y-V*H*M)/V).toFixed(te);return this.toNumber(G)}},{key:"step",value:function(y,M){var H=this,V=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,te=arguments.length>3?arguments[3]:void 0;this.stop(),M&&(M.persist(),M.preventDefault());var G=this.props;if(G.disabled)return;var j=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(j))return;var ie=this["".concat(y,"Step")](j,V),pe=ie>G.max||ie<G.min;if(ie>G.max?ie=G.max:ie<G.min&&(ie=G.min),this.setValue(ie,null),this.setState({focused:!0},function(){H.pressingUpOrDown=!1}),pe)return;this.autoStepTimer=setTimeout(function(){H[y](M,V,!0)},te?d:x)}},{key:"fixCaret",value:function(y,M){if(y===void 0||M===void 0||!this.input||!this.input.value)return;try{var H=this.input.selectionStart,V=this.input.selectionEnd;(y!==H||M!==V)&&this.input.setSelectionRange(y,M)}catch(te){}}},{key:"render",value:function(){var y,M=this.props,H=M.prefixCls,V=M.disabled,te=M.readOnly,G=M.useTouch,j=M.autoComplete,ie=M.upHandler,pe=M.downHandler,ge=M.className,be=M.max,Ne=M.min,Se=M.style,Me=M.title,Le=M.onMouseEnter,we=M.onMouseLeave,ve=M.onMouseOver,N=M.onMouseOut,T=M.required,R=M.onClick,z=M.tabIndex,Z=M.type,B=M.placeholder,ce=M.id,Ee=M.inputMode,Ae=M.pattern,Oe=M.step,Re=M.maxLength,De=M.autoFocus,Pe=M.name,Ke=M.onPaste,Xe=M.onInput,Ye=Object(he.a)(M,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),$e=this.state,ft=$e.value,Je=$e.focused,et=E()(H,(y={},Object(Y.a)(y,ge,!!ge),Object(Y.a)(y,"".concat(H,"-disabled"),V),Object(Y.a)(y,"".concat(H,"-focused"),Je),y)),ke={};Object.keys(Ye).forEach(function(ue){(ue.substr(0,5)==="data-"||ue.substr(0,5)==="aria-"||ue==="role")&&(ke[ue]=Ye[ue])});var st=!te&&!V,nt=this.getInputDisplayValue(null),oe=(ft||ft===0)&&(isNaN(ft)||Number(ft)>=be),J=(ft||ft===0)&&(isNaN(ft)||Number(ft)<=Ne),Q=oe||V||te,ne=J||V||te,le=E()("".concat(H,"-handler"),"".concat(H,"-handler-up"),Object(Y.a)({},"".concat(H,"-handler-up-disabled"),Q)),q=E()("".concat(H,"-handler"),"".concat(H,"-handler-down"),Object(Y.a)({},"".concat(H,"-handler-down-disabled"),ne)),ee=G?{onTouchStart:Q?c:this.up,onTouchEnd:this.stop}:{onMouseDown:Q?c:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ae=G?{onTouchStart:ne?c:this.down,onTouchEnd:this.stop}:{onMouseDown:ne?c:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return O.a.createElement("div",{className:et,style:Se,title:Me,onMouseEnter:Le,onMouseLeave:we,onMouseOver:ve,onMouseOut:N,onFocus:function(){return null},onBlur:function(){return null}},O.a.createElement("div",{className:"".concat(H,"-handler-wrap")},O.a.createElement("span",Object.assign({unselectable:"on"},ee,{role:"button","aria-label":"Increase Value","aria-disabled":Q,className:le}),ie||O.a.createElement("span",{unselectable:"on",className:"".concat(H,"-handler-up-inner"),onClick:o})),O.a.createElement("span",Object.assign({unselectable:"on"},ae,{role:"button","aria-label":"Decrease Value","aria-disabled":ne,className:q}),pe||O.a.createElement("span",{unselectable:"on",className:"".concat(H,"-handler-down-inner"),onClick:o}))),O.a.createElement("div",{className:"".concat(H,"-input-wrap")},O.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Ne,"aria-valuemax":be,"aria-valuenow":ft,required:T,type:Z,placeholder:B,onPaste:Ke,onClick:R,onMouseUp:this.onMouseUp,className:"".concat(H,"-input"),tabIndex:z,autoComplete:j,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:st?this.onKeyDown:c,onKeyUp:st?this.onKeyUp:c,autoFocus:De,maxLength:Re,readOnly:te,disabled:V,max:be,min:Ne,step:Oe,name:Pe,title:Me,id:ce,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(nt),pattern:Ae,inputMode:Ee,onInput:Xe},ke))))}}]),g}(O.a.Component);b.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:v,min:-v,step:1,style:{},onChange:c,onKeyDown:c,onPressEnter:c,onFocus:c,onBlur:c,parser:u,required:!1,autoComplete:"off"};var h=b,p=it.a=h},kSUc:function(yt,it,se){},kqOp:function(yt,it,se){"use strict";se.d(it,"a",function(){return D});var he=se("0Owb"),Y=se("fWQN"),L=se("mtLc"),X=se("yKVA"),I=se("879j"),k=se("q1tI"),W=se.n(k),F=se("Ot1p"),O="\u2581",D=function(E){Object(X.a)(P,E);var w=Object(I.a)(P);function P(){var _;Object(Y.a)(this,P);for(var A=arguments.length,C=new Array(A),c=0;c<A;c++)C[c]=arguments[c];return _=w.call.apply(w,[this].concat(C)),_.getChCountBeforeCursor=function(o,u){for(var d=u.line,x=0,v=0;v<d;v++)x+=o.getLine(v).split(O).length-1;var f=o.getLine(d).substring(0,u.ch);return x+=f.split(O).length-1,x},_.onCMBeforeChange=function(o,u){var d=o.getRange(u.from,u.to),x=0;if(u.text.forEach(function(b){x+=b.split(O).length-1}),d&&d.indexOf(O)!=-1){var v=d.split(O).length-1,f=_.getChCountBeforeCursor(o,u.from);console.log("\u5220\u9664".concat(v,"\u4E2A\uFF0C \u4E4B\u524D\u6709").concat(f,"\u4E2A\uFF0C\u65B0\u589E").concat(x,"\u4E2A")),_.props.deleteEmptyDisabled?u.cancel():_.props.onPlaceholderChange&&_.props.onPlaceholderChange(f,v,x)}else if(x){var l=_.getChCountBeforeCursor(o,u.from);console.log("\u65B0\u589E".concat(x,"\u4E2A\uFF0C\u4E4B\u524D\u6709").concat(l,"\u4E2A")),_.props.onPlaceholderChange&&_.props.onPlaceholderChange(l,0,x)}},_}return Object(L.a)(P,[{key:"render",value:function(){return W.a.createElement(F.a,Object(he.a)({},this.props,{onCMBeforeChange:this.onCMBeforeChange}))}}]),P}(k.Component)},lZu9:function(yt,it,se){(function(he){he(se("VrN/"),se("1eCo"),se("8EBN"))})(function(he){"use strict";he.defineMode("markdown",function(Y,L){var X=he.getMode(Y,"text/html"),I=X.name=="null";function k(G){if(he.findModeByName){var j=he.findModeByName(G);j&&(G=j.mime||j.mimes[0])}var ie=he.getMode(Y,G);return ie.name=="null"?null:ie}L.highlightFormatting===void 0&&(L.highlightFormatting=!1),L.maxBlockquoteDepth===void 0&&(L.maxBlockquoteDepth=0),L.taskLists===void 0&&(L.taskLists=!1),L.strikethrough===void 0&&(L.strikethrough=!1),L.emoji===void 0&&(L.emoji=!1),L.fencedCodeBlockHighlighting===void 0&&(L.fencedCodeBlockHighlighting=!0),L.fencedCodeBlockDefaultMode===void 0&&(L.fencedCodeBlockDefaultMode="text/plain"),L.xml===void 0&&(L.xml=!0),L.tokenTypeOverrides===void 0&&(L.tokenTypeOverrides={});var W={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 F in W)W.hasOwnProperty(F)&&L.tokenTypeOverrides[F]&&(W[F]=L.tokenTypeOverrides[F]);var O=/^([*\-_])(?:\s*\1){2,}\s*$/,D=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,E=/^\[(x| )\](?=\s)/i,w=L.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,P=/^ {0,3}(?:\={1,}|-{2,})\s*$/,_=/^[^#!\[\]*_\\<>` "'(~:]+/,A=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,C=/^\s*\[[^\]]+?\]:.*$/,c=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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]/,o=" ";function u(G,j,ie){return j.f=j.inline=ie,ie(G,j)}function d(G,j,ie){return j.f=j.block=ie,ie(G,j)}function x(G){return!G||!/\S/.test(G.string)}function v(G){if(G.linkTitle=!1,G.linkHref=!1,G.linkText=!1,G.em=!1,G.strong=!1,G.strikethrough=!1,G.quote=0,G.indentedCode=!1,G.f==l){var j=I;if(!j){var ie=he.innerMode(X,G.htmlState);j=ie.mode.name=="xml"&&ie.state.tagStart===null&&!ie.state.context&&ie.state.tokenize.isInText}j&&(G.f=s,G.block=f,G.htmlState=null)}return G.trailingSpace=0,G.trailingSpaceNewLine=!1,G.prevLine=G.thisLine,G.thisLine={stream:null},null}function f(G,j){var ie=G.column()===j.indentation,pe=x(j.prevLine.stream),ge=j.indentedCode,be=j.prevLine.hr,Ne=j.list!==!1,Se=(j.listStack[j.listStack.length-1]||0)+3;j.indentedCode=!1;var Me=j.indentation;if(j.indentationDiff===null&&(j.indentationDiff=j.indentation,Ne)){for(j.list=null;Me<j.listStack[j.listStack.length-1];)j.listStack.pop(),j.listStack.length?j.indentation=j.listStack[j.listStack.length-1]:j.list=!1;j.list!==!1&&(j.indentationDiff=Me-j.listStack[j.listStack.length-1])}var Le=!pe&&!be&&!j.prevLine.header&&(!Ne||!ge)&&!j.prevLine.fencedCodeEnd,we=(j.list===!1||be||pe)&&j.indentation<=Se&&G.match(O),ve=null;if(j.indentationDiff>=4&&(ge||j.prevLine.fencedCodeEnd||j.prevLine.header||pe))return G.skipToEnd(),j.indentedCode=!0,W.code;if(G.eatSpace())return null;if(ie&&j.indentation<=Se&&(ve=G.match(w))&&ve[1].length<=6)return j.quote=0,j.header=ve[1].length,j.thisLine.header=!0,L.highlightFormatting&&(j.formatting="header"),j.f=j.inline,h(j);if(j.indentation<=Se&&G.eat(">"))return j.quote=ie?1:j.quote+1,L.highlightFormatting&&(j.formatting="quote"),G.eatSpace(),h(j);if(!we&&!j.setext&&ie&&j.indentation<=Se&&(ve=G.match(D))){var N=ve[1]?"ol":"ul";return j.indentation=Me+G.current().length,j.list=!0,j.quote=0,j.listStack.push(j.indentation),j.em=!1,j.strong=!1,j.code=!1,j.strikethrough=!1,L.taskLists&&G.match(E,!1)&&(j.taskList=!0),j.f=j.inline,L.highlightFormatting&&(j.formatting=["list","list-"+N]),h(j)}else{if(ie&&j.indentation<=Se&&(ve=G.match(A,!0)))return j.quote=0,j.fencedEndRE=new RegExp(ve[1]+"+ *$"),j.localMode=L.fencedCodeBlockHighlighting&&k(ve[2]||L.fencedCodeBlockDefaultMode),j.localMode&&(j.localState=he.startState(j.localMode)),j.f=j.block=b,L.highlightFormatting&&(j.formatting="code-block"),j.code=-1,h(j);if(j.setext||(!Le||!Ne)&&!j.quote&&j.list===!1&&!j.code&&!we&&!C.test(G.string)&&(ve=G.lookAhead(1))&&(ve=ve.match(P)))return j.setext?(j.header=j.setext,j.setext=0,G.skipToEnd(),L.highlightFormatting&&(j.formatting="header")):(j.header=ve[0].charAt(0)=="="?1:2,j.setext=j.header),j.thisLine.header=!0,j.f=j.inline,h(j);if(we)return G.skipToEnd(),j.hr=!0,j.thisLine.hr=!0,W.hr;if(G.peek()==="[")return u(G,j,M)}return u(G,j,j.inline)}function l(G,j){var ie=X.token(G,j.htmlState);if(!I){var pe=he.innerMode(X,j.htmlState);(pe.mode.name=="xml"&&pe.state.tagStart===null&&!pe.state.context&&pe.state.tokenize.isInText||j.md_inside&&G.current().indexOf(">")>-1)&&(j.f=s,j.block=f,j.htmlState=null)}return ie}function b(G,j){var ie=j.listStack[j.listStack.length-1]||0,pe=j.indentation<ie,ge=ie+3;if(j.fencedEndRE&&j.indentation<=ge&&(pe||G.match(j.fencedEndRE))){L.highlightFormatting&&(j.formatting="code-block");var be;return pe||(be=h(j)),j.localMode=j.localState=null,j.block=f,j.f=s,j.fencedEndRE=null,j.code=0,j.thisLine.fencedCodeEnd=!0,pe?d(G,j,j.block):be}else return j.localMode?j.localMode.token(G,j.localState):(G.skipToEnd(),W.code)}function h(G){var j=[];if(G.formatting){j.push(W.formatting),typeof G.formatting=="string"&&(G.formatting=[G.formatting]);for(var ie=0;ie<G.formatting.length;ie++)j.push(W.formatting+"-"+G.formatting[ie]),G.formatting[ie]==="header"&&j.push(W.formatting+"-"+G.formatting[ie]+"-"+G.header),G.formatting[ie]==="quote"&&(!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=G.quote?j.push(W.formatting+"-"+G.formatting[ie]+"-"+G.quote):j.push("error"))}if(G.taskOpen)return j.push("meta"),j.length?j.join(" "):null;if(G.taskClosed)return j.push("property"),j.length?j.join(" "):null;if(G.linkHref?j.push(W.linkHref,"url"):(G.strong&&j.push(W.strong),G.em&&j.push(W.em),G.strikethrough&&j.push(W.strikethrough),G.emoji&&j.push(W.emoji),G.linkText&&j.push(W.linkText),G.code&&j.push(W.code),G.image&&j.push(W.image),G.imageAltText&&j.push(W.imageAltText,"link"),G.imageMarker&&j.push(W.imageMarker)),G.header&&j.push(W.header,W.header+"-"+G.header),G.quote&&(j.push(W.quote),!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=G.quote?j.push(W.quote+"-"+G.quote):j.push(W.quote+"-"+L.maxBlockquoteDepth)),G.list!==!1){var pe=(G.listStack.length-1)%3;pe?pe===1?j.push(W.list2):j.push(W.list3):j.push(W.list1)}return G.trailingSpaceNewLine?j.push("trailing-space-new-line"):G.trailingSpace&&j.push("trailing-space-"+(G.trailingSpace%2?"a":"b")),j.length?j.join(" "):null}function p(G,j){return G.match(_,!0)?h(j):void 0}function s(G,j){var ie=j.text(G,j);if(typeof ie!="undefined")return ie;if(j.list)return j.list=null,h(j);if(j.taskList){var pe=G.match(E,!0)[1]===" ";return pe?j.taskOpen=!0:j.taskClosed=!0,L.highlightFormatting&&(j.formatting="task"),j.taskList=!1,h(j)}if(j.taskOpen=!1,j.taskClosed=!1,j.header&&G.match(/^#+$/,!0))return L.highlightFormatting&&(j.formatting="header"),h(j);var ge=G.next();if(j.linkTitle){j.linkTitle=!1;var be=ge;ge==="("&&(be=")"),be=(be+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Ne="^\\s*(?:[^"+be+"\\\\]+|\\\\\\\\|\\\\.)"+be;if(G.match(new RegExp(Ne),!0))return W.linkHref}if(ge==="`"){var Se=j.formatting;L.highlightFormatting&&(j.formatting="code"),G.eatWhile("`");var Me=G.current().length;if(j.code==0&&(!j.quote||Me==1))return j.code=Me,h(j);if(Me==j.code){var Le=h(j);return j.code=0,Le}else return j.formatting=Se,h(j)}else if(j.code)return h(j);if(ge==="\\"&&(G.next(),L.highlightFormatting)){var we=h(j),ve=W.formatting+"-escape";return we?we+" "+ve:ve}if(ge==="!"&&G.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return j.imageMarker=!0,j.image=!0,L.highlightFormatting&&(j.formatting="image"),h(j);if(ge==="["&&j.imageMarker&&G.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return j.imageMarker=!1,j.imageAltText=!0,L.highlightFormatting&&(j.formatting="image"),h(j);if(ge==="]"&&j.imageAltText){L.highlightFormatting&&(j.formatting="image");var we=h(j);return j.imageAltText=!1,j.image=!1,j.inline=j.f=g,we}if(ge==="["&&!j.image)return j.linkText&&G.match(/^.*?\]/)||(j.linkText=!0,L.highlightFormatting&&(j.formatting="link")),h(j);if(ge==="]"&&j.linkText){L.highlightFormatting&&(j.formatting="link");var we=h(j);return j.linkText=!1,j.inline=j.f=G.match(/\(.*?\)| ?\[.*?\]/,!1)?g:s,we}if(ge==="<"&&G.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){j.f=j.inline=a,L.highlightFormatting&&(j.formatting="link");var we=h(j);return we?we+=" ":we="",we+W.linkInline}if(ge==="<"&&G.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){j.f=j.inline=a,L.highlightFormatting&&(j.formatting="link");var we=h(j);return we?we+=" ":we="",we+W.linkEmail}if(L.xml&&ge==="<"&&G.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var N=G.string.indexOf(">",G.pos);if(N!=-1){var T=G.string.substring(G.start,N);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(T)&&(j.md_inside=!0)}return G.backUp(1),j.htmlState=he.startState(X),d(G,j,l)}if(L.xml&&ge==="<"&&G.match(/^\/\w*?>/))return j.md_inside=!1,"tag";if(ge==="*"||ge==="_"){for(var R=1,z=G.pos==1?" ":G.string.charAt(G.pos-2);R<3&&G.eat(ge);)R++;var Z=G.peek()||" ",B=!/\s/.test(Z)&&(!c.test(Z)||/\s/.test(z)||c.test(z)),ce=!/\s/.test(z)&&(!c.test(z)||/\s/.test(Z)||c.test(Z)),Ee=null,Ae=null;if(R%2&&(!j.em&&B&&(ge==="*"||!ce||c.test(z))?Ee=!0:j.em==ge&&ce&&(ge==="*"||!B||c.test(Z))&&(Ee=!1)),R>1&&(!j.strong&&B&&(ge==="*"||!ce||c.test(z))?Ae=!0:j.strong==ge&&ce&&(ge==="*"||!B||c.test(Z))&&(Ae=!1)),Ae!=null||Ee!=null){L.highlightFormatting&&(j.formatting=Ee==null?"strong":Ae==null?"em":"strong em"),Ee===!0&&(j.em=ge),Ae===!0&&(j.strong=ge);var Le=h(j);return Ee===!1&&(j.em=!1),Ae===!1&&(j.strong=!1),Le}}else if(ge===" "&&(G.eat("*")||G.eat("_"))){if(G.peek()===" ")return h(j);G.backUp(1)}if(L.strikethrough){if(ge==="~"&&G.eatWhile(ge)){if(j.strikethrough){L.highlightFormatting&&(j.formatting="strikethrough");var Le=h(j);return j.strikethrough=!1,Le}else if(G.match(/^[^\s]/,!1))return j.strikethrough=!0,L.highlightFormatting&&(j.formatting="strikethrough"),h(j)}else if(ge===" "&&G.match(/^~~/,!0)){if(G.peek()===" ")return h(j);G.backUp(2)}}if(L.emoji&&ge===":"&&G.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){j.emoji=!0,L.highlightFormatting&&(j.formatting="emoji");var Oe=h(j);return j.emoji=!1,Oe}return ge===" "&&(G.match(/^ +$/,!1)?j.trailingSpace++:j.trailingSpace&&(j.trailingSpaceNewLine=!0)),h(j)}function a(G,j){var ie=G.next();if(ie===">"){j.f=j.inline=s,L.highlightFormatting&&(j.formatting="link");var pe=h(j);return pe?pe+=" ":pe="",pe+W.linkInline}return G.match(/^[^>]+/,!0),W.linkInline}function g(G,j){if(G.eatSpace())return null;var ie=G.next();return ie==="("||ie==="["?(j.f=j.inline=y(ie==="("?")":"]"),L.highlightFormatting&&(j.formatting="link-string"),j.linkHref=!0,h(j)):"error"}var m={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function y(G){return function(j,ie){var pe=j.next();if(pe===G){ie.f=ie.inline=s,L.highlightFormatting&&(ie.formatting="link-string");var ge=h(ie);return ie.linkHref=!1,ge}return j.match(m[G]),ie.linkHref=!0,h(ie)}}function M(G,j){return G.match(/^([^\]\\]|\\.)*\]:/,!1)?(j.f=H,G.next(),L.highlightFormatting&&(j.formatting="link"),j.linkText=!0,h(j)):u(G,j,s)}function H(G,j){if(G.match(/^\]:/,!0)){j.f=j.inline=V,L.highlightFormatting&&(j.formatting="link");var ie=h(j);return j.linkText=!1,ie}return G.match(/^([^\]\\]|\\.)+/,!0),W.linkText}function V(G,j){return G.eatSpace()?null:(G.match(/^[^\s]+/,!0),G.peek()===void 0?j.linkTitle=!0:G.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),j.f=j.inline=s,W.linkHref+" url")}var te={startState:function(){return{f,prevLine:{stream:null},thisLine:{stream:null},block:f,htmlState:null,indentation:0,inline:s,text:p,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(G){return{f:G.f,prevLine:G.prevLine,thisLine:G.thisLine,block:G.block,htmlState:G.htmlState&&he.copyState(X,G.htmlState),indentation:G.indentation,localMode:G.localMode,localState:G.localMode?he.copyState(G.localMode,G.localState):null,inline:G.inline,text:G.text,formatting:!1,linkText:G.linkText,linkTitle:G.linkTitle,linkHref:G.linkHref,code:G.code,em:G.em,strong:G.strong,strikethrough:G.strikethrough,emoji:G.emoji,header:G.header,setext:G.setext,hr:G.hr,taskList:G.taskList,list:G.list,listStack:G.listStack.slice(0),quote:G.quote,indentedCode:G.indentedCode,trailingSpace:G.trailingSpace,trailingSpaceNewLine:G.trailingSpaceNewLine,md_inside:G.md_inside,fencedEndRE:G.fencedEndRE}},token:function(G,j){if(j.formatting=!1,G!=j.thisLine.stream){if(j.header=0,j.hr=!1,G.match(/^\s*$/,!0))return v(j),null;if(j.prevLine=j.thisLine,j.thisLine={stream:G},j.taskList=!1,j.trailingSpace=0,j.trailingSpaceNewLine=!1,!j.localState&&(j.f=j.block,j.f!=l)){var ie=G.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(j.indentation=ie,j.indentationDiff=null,ie>0)return null}}return j.f(G,j)},innerMode:function(G){return G.block==l?{state:G.htmlState,mode:X}:G.localState?{state:G.localState,mode:G.localMode}:{state:G,mode:te}},indent:function(G,j,ie){return G.block==l&&X.indent?X.indent(G.htmlState,j,ie):G.localState&&G.localMode.indent?G.localMode.indent(G.localState,j,ie):he.Pass},blankLine:v,getType:h,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return te},"xml"),he.defineMIME("text/markdown","markdown"),he.defineMIME("text/x-markdown","markdown")})},osHv:function(yt,it,se){(function(he){he(se("VrN/"))})(function(he){"use strict";var Y=he.Pos;function L(c,o){return c.line-o.line||c.ch-o.ch}var X="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=X+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",k=new RegExp("<(/?)(["+X+"]["+I+"]*)","g");function W(c,o,u,d){this.line=o,this.ch=u,this.cm=c,this.text=c.getLine(o),this.min=d?Math.max(d.from,c.firstLine()):c.firstLine(),this.max=d?Math.min(d.to-1,c.lastLine()):c.lastLine()}function F(c,o){var u=c.cm.getTokenTypeAt(Y(c.line,o));return u&&/\btag\b/.test(u)}function O(c){return c.line>=c.max?void 0:(c.ch=0,c.text=c.cm.getLine(++c.line),!0)}function D(c){return c.line<=c.min?void 0:(c.text=c.cm.getLine(--c.line),c.ch=c.text.length,!0)}function E(c){for(;;){var o=c.text.indexOf(">",c.ch);if(o==-1){if(O(c))continue;return}if(!F(c,o+1)){c.ch=o+1;continue}var u=c.text.lastIndexOf("/",o),d=u>-1&&!/\S/.test(c.text.slice(u+1,o));return c.ch=o+1,d?"selfClose":"regular"}}function w(c){for(;;){var o=c.ch?c.text.lastIndexOf("<",c.ch-1):-1;if(o==-1){if(D(c))continue;return}if(!F(c,o+1)){c.ch=o;continue}k.lastIndex=o,c.ch=o;var u=k.exec(c.text);if(u&&u.index==o)return u}}function P(c){for(;;){k.lastIndex=c.ch;var o=k.exec(c.text);if(!o){if(O(c))continue;return}if(!F(c,o.index+1)){c.ch=o.index+1;continue}return c.ch=o.index+o[0].length,o}}function _(c){for(;;){var o=c.ch?c.text.lastIndexOf(">",c.ch-1):-1;if(o==-1){if(D(c))continue;return}if(!F(c,o+1)){c.ch=o;continue}var u=c.text.lastIndexOf("/",o),d=u>-1&&!/\S/.test(c.text.slice(u+1,o));return c.ch=o+1,d?"selfClose":"regular"}}function A(c,o){for(var u=[];;){var d=P(c),x,v=c.line,f=c.ch-(d?d[0].length:0);if(!d||!(x=E(c)))return;if(x=="selfClose")continue;if(d[1]){for(var l=u.length-1;l>=0;--l)if(u[l]==d[2]){u.length=l;break}if(l<0&&(!o||o==d[2]))return{tag:d[2],from:Y(v,f),to:Y(c.line,c.ch)}}else u.push(d[2])}}function C(c,o){for(var u=[];;){var d=_(c);if(!d)return;if(d=="selfClose"){w(c);continue}var x=c.line,v=c.ch,f=w(c);if(!f)return;if(f[1])u.push(f[2]);else{for(var l=u.length-1;l>=0;--l)if(u[l]==f[2]){u.length=l;break}if(l<0&&(!o||o==f[2]))return{tag:f[2],from:Y(c.line,c.ch),to:Y(x,v)}}}}he.registerHelper("fold","xml",function(c,o){for(var u=new W(c,o.line,0);;){var d=P(u);if(!d||u.line!=o.line)return;var x=E(u);if(!x)return;if(!d[1]&&x!="selfClose"){var v=Y(u.line,u.ch),f=A(u,d[2]);return f&&L(f.from,v)>0?{from:v,to:f.from}:null}}}),he.findMatchingTag=function(c,o,u){var d=new W(c,o.line,o.ch,u);if(d.text.indexOf(">")==-1&&d.text.indexOf("<")==-1)return;var x=E(d),v=x&&Y(d.line,d.ch),f=x&&w(d);if(!x||!f||L(d,o)>0)return;var l={from:Y(d.line,d.ch),to:v,tag:f[2]};return x=="selfClose"?{open:l,close:null,at:"open"}:f[1]?{open:C(d,f[2]),close:l,at:"close"}:(d=new W(c,v.line,v.ch,u),{open:l,close:A(d,f[2]),at:"open"})},he.findEnclosingTag=function(c,o,u,d){for(var x=new W(c,o.line,o.ch,u);;){var v=C(x,d);if(!v)break;var f=new W(c,o.line,o.ch,u),l=A(f,v.tag);if(l)return{open:v,close:l}}},he.scanForClosingTag=function(c,o,u,d){var x=new W(c,o.line,o.ch,d?{from:0,to:d}:null);return A(x,u)}})},p5ED:function(yt,it,se){"use strict";var he=se("+L6B"),Y=se("2/Rp"),L=se("5Dmo"),X=se("3S7+"),I=se("k1fw"),k=se("9og8"),W=se("tJVT"),F=se("WmNS"),O=se.n(F),D=se("q1tI"),E=se.n(D),w=se("vHTk"),P=se.n(w),_=se("yEEn"),A=se("ZW9T"),C=se("1vsH"),c=se("V0Rq"),o=se("m3rI");it.a=function(u){var d,x,v,f,l,b,h,p=u.editOffice,s=p===void 0?"view":p,a=u.data,g=u.theme,m=u.type,y=u.filename,M=u.monacoEditor,H=u.className,V=u.style,te=u.close,G=u.onClose,j=u.hasMask,ie=u.disabledDownload,pe=Object(D.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),ge=Object(W.a)(pe,2),be=ge[0],Ne=ge[1],Se=Object(D.useState)(""),Me=Object(W.a)(Se,2),Le=Me[0],we=Me[1],ve=Object(D.useState)(),N=Object(W.a)(ve,2),T=N[0],R=N[1],z=window.ENV==="build"?"/react/build":"",Z=o.a.PROXY_SERVER||location.origin,B,ce=1024*1024,Ee=10*ce,Ae=Object(D.useRef)();(d=a)!==null&&d!==void 0&&d.startsWith("/api")&&m!=="txt"&&(a=(o.a.API_SERVER||location.origin)+a),m==="office"&&(B=Object(C.T)(a).filesize,B>Ee&&(m="other")),y&&M&&(M.filename=y),Object(D.useEffect)(function(){var Pe,Ke,Xe=(Pe=document.cookie)===null||Pe===void 0||((Ke=Pe.replace(/\s/g,""))===null||Ke===void 0)?void 0:Ke.split(";");Xe==null||Xe.map(function(Ye){var $e=Ye.split("=");$e[0]==="_educoder_session"&&we($e[1])})},[]),Object(D.useEffect)(function(){m==="office"&&Oe()},[m,a]);var Oe=function(){var Pe=Object(k.a)(O.a.mark(function Ke(){var Xe,Ye,$e;return O.a.wrap(function(Je){for(;;)switch(Je.prev=Je.next){case 0:return console.log("data:",a),Xe=a,a.startsWith("http")||(Xe=location.origin+Xe),Ye=new URL(Xe).pathname.split("/").pop(),Je.next=6,Object(c.V)({attachment_id:Ye});case 6:$e=Je.sent,R($e);case 8:case"end":return Je.stop()}},Ke)}));return function(){return Pe.apply(this,arguments)}}(),Re=function(){if(a.startsWith("http")||a.startsWith("blob:")){De();return}Object(C.z)(y||"educoder",a,y)},De=function(){Object(C.x)(y||"educoder",decodeURIComponent(a))};return E.a.createElement("div",{style:Object(I.a)({},V||{}),className:"".concat(j&&P.a.bgBlack," ").concat(m?P.a.wrp:"hide")},te&&E.a.createElement("div",{className:P.a.close,ref:Ae},!ie&&E.a.createElement(X.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return Ae.current}},E.a.createElement("span",{onClick:De},E.a.createElement("i",{className:"icon-quxiaozhiding"}))),E.a.createElement(X.a,{title:"\u5173\u95ED",getPopupContainer:function(){return Ae.current}},E.a.createElement("span",{className:"",onClick:G},E.a.createElement("i",{className:"icon-guanbi1"})))),E.a.createElement("div",{className:"".concat(P.a[H]," ").concat(H," ").concat(P.a.monaco," ").concat(m==="txt"?"show":"hide")},m==="txt"&&E.a.createElement(A.b,M)),m==="audio"&&E.a.createElement("audio",{src:"".concat(((x=a)===null||x===void 0?void 0:x.indexOf("http://"))>-1||((v=a)===null||v===void 0?void 0:v.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(a),autoPlay:!0}),m==="video"&&E.a.createElement(E.a.Fragment,null,((f=a)===null||f===void 0?void 0:f.indexOf("http"))>-1?E.a.createElement("video",{controls:!0,src:"".concat(a),autoPlay:!0}):E.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(a),autoPlay:!0})),m==="office"&&T&&E.a.createElement("iframe",{src:"".concat(z,"/office.html?key=").concat(T.key,"&url=").concat(Z+T.url,"&callbackUrl=").concat(Z+T.callbackUrl,"&fileType=").concat(T.fileType,"&title=").concat(T.title,"&model=").concat(s,"&officeServer=").concat(o.a.OFFICE_SERVER,"&disabledDownload=").concat(!!ie)}),m==="html"&&E.a.createElement("iframe",{src:a+"&disposition=inline"}),m==="pdf"&&E.a.createElement("iframe",{src:"".concat(z,"/js/pdfview/index.html?url=").concat(a,"&disabledDownload=").concat(!!ie)}),m==="image"&&E.a.createElement("img",{src:"".concat(((l=a)===null||l===void 0?void 0:l.indexOf("http://"))>-1||((b=a)===null||b===void 0?void 0:b.indexOf("https://"))>-1||(h=a)!==null&&h!==void 0&&h.startsWith("/api")?"":"data:image/png;base64,").concat(a)}),m==="other"&&E.a.createElement("div",null,E.a.createElement(Y.a,{type:"primary",size:"large",onClick:Re},E.a.createElement(_.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),m==="download"&&E.a.createElement(Y.a,{type:"primary",size:"large",onClick:Re},E.a.createElement(_.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(yt,it,se){},rUJ1:function(yt,it){const se=/[&<>"']/,he=/[&<>"']/g,Y=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,X={"&":"&","<":"<",">":">",'"':""","'":"'"},I=b=>X[b];function k(b,h){if(h){if(se.test(b))return b.replace(he,I)}else if(Y.test(b))return b.replace(L,I);return b}const W=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function F(b){return b.replace(W,(h,p)=>(p=p.toLowerCase(),p==="colon"?":":p.charAt(0)==="#"?p.charAt(1)==="x"?String.fromCharCode(parseInt(p.substring(2),16)):String.fromCharCode(+p.substring(1)):""))}const O=/(^|[^\[])\^/g;function D(b,h){b=b.source||b,h=h||"";const p={replace:(s,a)=>(a=a.source||a,a=a.replace(O,"$1"),b=b.replace(s,a),p),getRegex:()=>new RegExp(b,h)};return p}const E=/[^\w:]/g,w=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function P(b,h,p){if(b){let s;try{s=decodeURIComponent(F(p)).replace(E,"").toLowerCase()}catch(a){return null}if(s.indexOf("javascript:")===0||s.indexOf("vbscript:")===0||s.indexOf("data:")===0)return null}h&&!w.test(p)&&(p=o(h,p));try{p=encodeURI(p).replace(/%25/g,"%")}catch(s){return null}return p}const _={},A=/^[^:]+:\/*[^/]*$/,C=/^([^:]+:)[\s\S]*$/,c=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(b,h){_[" "+b]||(A.test(b)?_[" "+b]=b+"/":_[" "+b]=v(b,"/",!0)),b=_[" "+b];const p=b.indexOf(":")===-1;return h.substring(0,2)==="//"?p?h:b.replace(C,"$1")+h:h.charAt(0)==="/"?p?h:b.replace(c,"$1")+h:b+h}const u={exec:function(){}};function d(b){let h=1,p,s;for(;h<arguments.length;h++){p=arguments[h];for(s in p)Object.prototype.hasOwnProperty.call(p,s)&&(b[s]=p[s])}return b}function x(b,h){const p=b.replace(/\|/g,(g,m,y)=>{let M=!1,H=m;for(;--H>=0&&y[H]==="\\";)M=!M;return M?"|":" |"}),s=p.split(/ \|/);let a=0;if(s.length>h)s.splice(h);else for(;s.length<h;)s.push("");for(;a<s.length;a++)s[a]=s[a].trim().replace(/\\\|/g,"|");return s}function v(b,h,p){const s=b.length;if(s===0)return"";let a=0;for(;a<s;){const g=b.charAt(s-a-1);if(g===h&&!p)a++;else if(g!==h&&p)a++;else break}return b.substr(0,s-a)}function f(b,h){if(b.indexOf(h[1])===-1)return-1;const p=b.length;let s=0,a=0;for(;a<p;a++)if(b[a]==="\\")a++;else if(b[a]===h[0])s++;else if(b[a]===h[1]&&(s--,s<0))return a;return-1}function l(b){b&&b.sanitize&&!b.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}yt.exports={escape:k,unescape:F,edit:D,cleanUrl:P,resolveUrl:o,noopTest:u,merge:d,splitCells:x,rtrim:v,findClosingBracket:f,checkSanitizeDeprecation:l}},sDPU:function(yt,it,se){"use strict";se.r(it);var he=se("cWXX"),Y=se("/ezw"),L=se("k1fw"),X=se("9og8"),I=se("tJVT"),k=se("WmNS"),W=se.n(k),F=se("q1tI"),O=se.n(F),D=se("Ty5D"),E=se("9kvl"),w=se("FIWC"),P=se.n(w),_=se("sbIO"),A=se("ErOA"),C=se("LvDl"),c=se.n(C),o=function(d){var x,v,f,l,b=d.paperlibrary,h=d.user,p=d.globalSetting,s=d.dispatch,a=d.location,g=(a==null||((x=a.query)===null||x===void 0)?void 0:x.select)||0,m=Object(F.useState)(!1),y=Object(I.a)(m,2),M=y[0],H=y[1],V=Object(F.useState)(!0),te=Object(I.a)(V,2),G=te[0],j=te[1],ie=Object(F.useState)(Number(g)),pe=Object(I.a)(ie,2),ge=pe[0],be=pe[1],Ne=Object(F.useState)({}),Se=Object(I.a)(Ne,2),Me=Se[0],Le=Se[1],we=Object(D.i)(),ve=h.userInfo;Object(F.useEffect)(function(){return s({type:"globalSetting/footerToggle",payload:!1}),function(){s({type:"globalSetting/footerToggle",payload:!0})}},[]),Object(F.useEffect)(function(){return s({type:"globalSetting/onlyShowBackTopToggle",payload:!1}),s({type:"globalSetting/onlyShowBackTopIconToggle",payload:!1}),function(){s({type:"globalSetting/onlyShowBackTopToggle",payload:!0}),s({type:"globalSetting/onlyShowBackTopIconToggle",payload:!0})}},[]),Object(F.useEffect)(function(){return document.body.setAttribute("data-custom","initial"),function(){document.body.removeAttribute("data-custom")}},[]),Object(F.useEffect)(function(){N(ge)},[]);var N=function(){var ce=Object(X.a)(W.a.mark(function Ee(){var Ae,Oe,Re=arguments;return W.a.wrap(function(Pe){for(;;)switch(Pe.prev=Pe.next){case 0:return Ae=Re.length>0&&Re[0]!==void 0?Re[0]:0,console.log(we),Pe.next=4,Object(A.a)("/api/exercises/".concat(we.categoryId,"/preview_random_exercise.json"),{method:"get",params:{num:Ae}});case 4:Oe=Pe.sent,j(!1),Le(T(Oe));case 7:case"end":return Pe.stop()}},Ee)}));return function(){return ce.apply(this,arguments)}}(),T=function(Ee){var Ae={1:"\u4E00",2:"\u4E8C",3:"\u4E09",4:"\u56DB",5:"\u4E94",6:"\u516D",7:"\u4E03"};if(!Ee)return;var Oe=Ee||{},Re=Oe.exam,De=Oe.single_questions,Pe=Oe.multiple_questions,Ke=Oe.judgement_questions,Xe=Oe.program_questions,Ye=Oe.completion_questions,$e=Oe.subjective_questions,ft=Oe.practical_questions,Je=Oe.combination_questions,et=[Object(L.a)({type:"SINGLE",name:"\u5355\u9009\u9898"},De),Object(L.a)({type:"MULTIPLE",name:"\u591A\u9009\u9898"},Pe),Object(L.a)({type:"COMPLETION",name:"\u586B\u7A7A\u9898"},Ye),Object(L.a)({type:"JUDGMENT",name:"\u5224\u65AD\u9898"},Ke),Object(L.a)({type:"SUBJECTIVE",name:"\u7B80\u7B54\u9898"},$e),Object(L.a)({type:"PROGRAM",name:"\u7F16\u7A0B\u9898"},Xe),Object(L.a)({type:"PRACTICAL",name:"\u5B9E\u8BAD\u9898"},ft),Object(L.a)({type:"COMBINATION",name:"\u7EC4\u5408\u9898"},Je)],ke=[],st=0,nt=0,oe=et.filter(function(J){return J.questions_count>0}).map(function(J,Q){var ne;return(ne=J.questions)===null||ne===void 0||ne.forEach(function(le){ke.push(le.id),st=st+le.score,nt=nt+1}),Object(L.a)(Object(L.a)({},J),{number:Ae[Q+1]})});return{all_questions_count:nt,all_score:st,questionList:oe,ids:ke,exam:Re}},R=function(){E.d.push("/classrooms/".concat(we.coursesId,"/exercise"))},z=function(){alert("\u4FDD\u5B58")},Z=function(){var ce=Object(X.a)(W.a.mark(function Ee(Ae,Oe){var Re,De,Pe;return W.a.wrap(function(Xe){for(;;)switch(Xe.prev=Xe.next){case 0:return Xe.next=2,Object(A.a)("/api/exercises/".concat(we.categoryId,"/toggle_random_question.json"),{method:"post",body:{question_id:Ae==null?void 0:Ae.single_question_id}});case 2:Re=Xe.sent,Re!=null&&Re.question&&(Pe=Object(C.cloneDeep)(Me),Pe.questionList=Pe==null||((De=Pe.questionList)===null||De===void 0)?void 0:De.map(function(Ye){if(Ye.type===Oe.type){var $e=Object(C.cloneDeep)(Ye==null?void 0:Ye.questions);return $e.splice(Oe.index,1,Re==null?void 0:Re.question),Object(L.a)(Object(L.a)({},Ye),{},{questions:$e})}return Ye}),Le(Pe));case 4:case"end":return Xe.stop()}},Ee)}));return function(Ae,Oe){return ce.apply(this,arguments)}}(),B=function(){var ce=Object(X.a)(W.a.mark(function Ee(Ae){return W.a.wrap(function(Re){for(;;)switch(Re.prev=Re.next){case 0:document.body.scrollIntoView(),N(Ae),be(Ae);case 3:case"end":return Re.stop()}},Ee)}));return function(Ae){return ce.apply(this,arguments)}}();return console.log(Object(D.h)(),"location333"),O.a.createElement("section",{className:P.a.wrap},O.a.createElement(Y.a,{loading:G,active:!0,paragraph:{rows:5}},((v=Object(D.h)())===null||v===void 0||((f=v.pathname)===null||f===void 0)?void 0:f.includes("preview"))&&O.a.createElement("div",{className:P.a.crumbs},O.a.createElement("b",null),O.a.createElement("span",{className:"current",onClick:function(){return E.d.push("/classrooms/".concat(we.coursesId,"/exercise"))}},"".concat(ve==null||((l=ve.course)===null||l===void 0)?void 0:l.course_name,">")),O.a.createElement("span",{className:"current",onClick:function(){return E.d.push("/classrooms/".concat(we.coursesId,"/exercise"))}},"\u8BD5\u5377\u5217\u8868>"),O.a.createElement("span",{style:{color:"#bebebe"}},"\u9884\u89C8")),O.a.createElement(_.a,{loading:M,submit:z,goBack:R,data:Me,selectValue:ge,editPreview:!0,onExchange:Z,onSkipExamination:B})))};it.default=Object(E.a)(function(u){var d=u.paperlibrary,x=u.user,v=u.globalSetting;return{paperlibrary:d,user:x,globalSetting:v}})(o)},sbIO:function(yt,it,se){"use strict";var he=se("DjyN"),Y=se("NUBc"),L=se("5Dmo"),X=se("3S7+"),I=se("/zsF"),k=se("PArb"),W=se("Q9mQ"),F=se("diRs"),O=se("+L6B"),D=se("2/Rp"),E=se("5NDa"),w=se("5rEg"),P=se("miYZ"),_=se("tsqr"),A=se("9og8"),C=se("giR+"),c=se("fyUT"),o=se("2qtc"),u=se("kLXV"),d=se("tJVT"),x=se("WmNS"),v=se.n(x),f=se("q1tI"),l=se.n(f),b=se("PsQE"),h=se.n(b),p=se("0eGx"),s=se.n(p),a=se("9Bee"),g=se("Ty5D"),m=se("9kvl"),y=se("ErOA"),M=se("+yhJ"),H=se.n(M),V=se("RZ/O"),te=se.n(V),G=se("LvDl"),j=se("6K3P"),ie=se.n(j),pe=se("sRBo"),ge=se("kaz8"),be=se("oBTY"),Ne=se("PpiC"),Se=se("Ot1p"),Me=se("kqOp"),Le=se("7qnI"),we=se("1vsH"),ve=se("PGNT"),N=se.n(ve),T=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],R=function(ae,ue){var de=ae.globalSetting,ye=ae.loading,Te=ae.dispatch,Fe=ae.isEdit,He=ae.editData,at=Object(Ne.a)(ae,["globalSetting","loading","dispatch","isEdit","editData"]),Lt=Object(f.useState)(""),Ge=Object(d.a)(Lt,2),tt=Ge[0],Dt=Ge[1],ct=Object(f.useState)(""),Rt=Object(d.a)(ct,2),jt=Rt[0],xt=Rt[1],Kt=Object(f.useState)([]),Vt=Object(d.a)(Kt,2),Ut=Vt[0],Nt=Vt[1],It=Object(f.useState)(""),Bt=Object(d.a)(It,2),Ct=Bt[0],wt=Bt[1],mt=Object(f.useState)(),rt=Object(d.a)(mt,2),Ue=rt[0],St=rt[1],Ot=Object(f.useState)(!1),vt=Object(d.a)(Ot,2),_t=vt[0],Ht=vt[1];Object(f.useEffect)(function(){if(!He||!Fe)return;Dt(He==null?void 0:He.name),xt(He==null?void 0:He.analysis),St(He==null?void 0:He.is_ordered),Ht(!0)},[He]),Object(f.useEffect)(function(){if(!_t)return;var or=He==null?void 0:He.standard_answer.map(function(Ft){return Ft.answer_text});Nt(or),Ht(!1)},[_t]),Object(f.useImperativeHandle)(ue,function(){return{onSave:Gt,Clear:ot}});var Gt=function(){var Ft=[],gt=!1;return tt?(Ut.forEach(function(ir,We){Ft.push({position:We+1,answer_text:[]}),ir.forEach(function(dr,_r){Ft[We].answer_text.push(dr),(!dr||!Object(we.eb)(dr,1e4))&&(wt("".concat(We,"-").concat(_r)),_.b.info(dr?"\u7B54\u6848\u4E0D\u80FD\u8D85\u8FC710000\u5B57\u7B26":"\u7B54\u6848\uFF1A\u4E0D\u80FD\u4E3A\u7A7A"),gt=!0)})}),gt?!1:(Ft==null?void 0:Ft.length)>20?(_.b.warn("\u586B\u7A7A\u9898\u6807\u51C6\u7B54\u6848\u4E0D\u80FD\u4E3A\u7A7A/\u4E0D\u80FD\u8D85\u8FC720\u4E2A\uFF01"),!1):{name:tt,analysis:jt,standard_answers:Ft,is_ordered:Ue}):(_.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1)},ot=function(){Dt(""),xt(""),Nt([]),St(!1)},Be=function(Ft,gt,ir){var We=Ut.slice();if(gt&&We.splice(Ft,gt),ir)for(var dr=0;dr<ir;dr++)We.splice(Ft+dr,0,[""]);Nt(We)},dt=function(Ft,gt,ir){wt("");var We=Ut.slice();We[Ft][gt]=ir,Nt(We)},yr=function(Ft){var gt=Ut.slice();gt[Ft]=[].concat(Object(be.a)(gt[Ft]),[""]),Nt(gt)},an=function(Ft,gt){var ir=Ut.slice();if(!ir[Ft][gt]){ir[Ft]=ir[Ft].filter(function(We,dr){return dr!==gt}),Nt(ir);return}u.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u53C2\u8003\u7B54\u6848\u5417\uFF1F",className:N.a.modal,onOk:function(){ir[Ft]=ir[Ft].filter(function(dr,_r){return _r!==gt}),Nt(ir)}})},on=function(Ft){u.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u53C2\u8003\u7B54\u6848\u5417\uFF1F",className:N.a.modal,onOk:function(){var ir=Ut.slice();ir=Ut.filter(function(We,dr){return Ft!==dr}),Nt(ir)}})};return l.a.createElement("section",{className:N.a.wrap},l.a.createElement("p",{className:N.a.titleWrap},l.a.createElement("span",{className:N.a.required},"*"),l.a.createElement("span",{className:N.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement("div",null,l.a.createElement(Me.a,{id:"completion-question-tittle",placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE",height:155,defaultValue:tt,onChange:function(Ft){return Dt(Ft)},showNullButton:!0,onPlaceholderChange:Be})),l.a.createElement("div",{className:"mt20"},Ut.map(function(or,Ft){return l.a.createElement(Le.a,{key:Ft,answers:or,index:Ft,flex:1,is_md:!0,activeOptionErrorIndex:Ct,onAnswerChange:dt,addChildAnswer:yr,deleteChildAnswer:an,deleteChildAnswermain:on})})),l.a.createElement("div",{className:"mt20"},Ut.length>1&&l.a.createElement("span",null,l.a.createElement(ge.a,{checked:Ue,onChange:function(Ft){return St(Ft.target.checked)},className:"".concat(N.a.color333," font14")},"\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"),l.a.createElement("span",{className:"".concat(N.a.color999," font12")},"\uFF08\u9009\u4E2D\uFF0C\u6BCF\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u987A\u5E8F\u5FC5\u987B\u4E0E\u53C2\u8003\u7B54\u6848\u4E00\u81F4\uFF09"))),l.a.createElement("p",{className:N.a.titleWrap},l.a.createElement("span",{className:N.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(Se.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:jt,onChange:function(Ft){return xt(Ft)}}))},z=Object(m.a)(function(ee){var ae=ee.loading,ue=ee.globalSetting;return{globalSetting:ue,loading:ae.effects}},null,null,{forwardRef:!0})(Object(f.forwardRef)(R)),Z=se("7Kak"),B=se("9yH6"),ce=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Ee=function(ae,ue){var de=ae.globalSetting,ye=ae.loading,Te=ae.editData,Fe=ae.dispatch,He=ae.onRef,at=He===void 0?function(){}:He,Lt=ae.isEdit,Ge=Object(Ne.a)(ae,["globalSetting","loading","editData","dispatch","onRef","isEdit"]),tt=Object(f.useState)(),Dt=Object(d.a)(tt,2),ct=Dt[0],Rt=Dt[1],jt=Object(f.useState)(""),xt=Object(d.a)(jt,2),Kt=xt[0],Vt=xt[1],Ut=Object(f.useState)(""),Nt=Object(d.a)(Ut,2),It=Nt[0],Bt=Nt[1];Object(f.useEffect)(function(){if(!Te||!Lt)return;Vt(Te==null?void 0:Te.name),Bt(Te==null?void 0:Te.analysis);var mt=Te==null?void 0:Te.choices.find(function(rt){return rt.is_answer});Rt(mt.choice_text==="\u6B63\u786E"?"0":"1")},[Te]),Object(f.useImperativeHandle)(ue,function(){return{onSave:Ct,Clear:wt}});var Ct=function(){if(!Kt)return _.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;if(!ct)return _.b.info("\u8BF7\u5148\u70B9\u51FB\u9009\u62E9\u672C\u9009\u62E9\u9898\u7684\u6B63\u786E\u9009\u9879"),!1;var rt=[{choice_text:"\u6B63\u786E",is_answer:ct==="0"?1:0},{choice_text:"\u9519\u8BEF",is_answer:ct==="1"?1:0}];return{name:Kt,choices:rt,analysis:It}},wt=function(){Vt(""),Bt(""),Rt("")};return l.a.createElement("section",{className:N.a.wrap},l.a.createElement("p",{className:N.a.titleWrap},l.a.createElement("span",{className:N.a.required},"*"),l.a.createElement("span",{className:N.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement(Se.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Kt,onChange:function(rt){return Vt(rt)}}),l.a.createElement("p",{className:N.a.titleWrap},l.a.createElement("span",{className:N.a.required},"*"),l.a.createElement("span",{className:N.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",l.a.createElement("span",{className:N.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),l.a.createElement(B.a.Group,{buttonStyle:"solid",value:ct,onChange:function(rt){return Rt(rt.target.value)}},l.a.createElement(B.a.Button,{value:"0",className:"".concat(N.a.radio," mr40")},"\u6B63\u786E"),l.a.createElement(B.a.Button,{value:"1",className:N.a.radio},"\u9519\u8BEF")),l.a.createElement("p",{className:N.a.titleWrap},l.a.createElement("span",{className:N.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(Se.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:It,onChange:function(rt){return Bt(rt)}}))},Ae=Object(m.a)(function(ee){var ae=ee.loading,ue=ee.globalSetting;return{globalSetting:ue,loading:ae.effects}},null,null,{forwardRef:!0})(Object(f.forwardRef)(Ee)),Oe=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Re=function(ae,ue){var de=ae.editData,ye=ae.globalSetting,Te=ae.loading,Fe=ae.dispatch,He=ae.onRef,at=He===void 0?function(){}:He,Lt=ae.isEdit,Ge=Object(Ne.a)(ae,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),tt=Object(f.useState)([]),Dt=Object(d.a)(tt,2),ct=Dt[0],Rt=Dt[1],jt=Object(f.useState)(),xt=Object(d.a)(jt,2),Kt=xt[0],Vt=xt[1],Ut=Object(f.useState)([]),Nt=Object(d.a)(Ut,2),It=Nt[0],Bt=Nt[1],Ct=Object(f.useState)(""),wt=Object(d.a)(Ct,2),mt=wt[0],rt=wt[1],Ue=Object(f.useState)(""),St=Object(d.a)(Ue,2),Ot=St[0],vt=St[1];Object(f.useEffect)(function(){Rt(["","","",""])},[]),Object(f.useEffect)(function(){if(!de||!Lt)return;rt(de==null?void 0:de.name),vt(de==null?void 0:de.analysis),Rt(de==null?void 0:de.choices.map(function(ot){return ot.choice_text}));var Gt=[];de==null||de.choices.map(function(ot,Be){ot.is_answer&&Gt.push(Be)}),Bt(Gt)},[de]),Object(f.useImperativeHandle)(ue,function(){return{onSave:_t,Clear:Ht}});var _t=function(){if(!mt)return _.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;var ot=ct.findIndex(function(dt){return!dt});if(ot>-1)return _.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(Oe[ot]," \u9009\u9879\u7684\u5185\u5BB9")),!1;if(!It.length)return _.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),!1;if(It.length<2)return _.b.info("\u591A\u9009\u9898\u6700\u5C0F\u6B63\u786E\u9009\u9879\u4E3A2\u4E2A"),!1;var Be=ct.map(function(dt,yr){return{choice_text:dt,is_answer:It.includes(yr)?1:0}});return{name:mt,choices:Be,analysis:Ot}},Ht=function(){Rt(["","","",""]),rt(""),vt(""),Bt("")};return l.a.createElement("section",{className:N.a.wrap},l.a.createElement("p",{className:N.a.titleWrap},l.a.createElement("span",{className:N.a.required},"*"),l.a.createElement("span",{className:N.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement(Se.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:mt,onChange:function(ot){return rt(ot)}}),l.a.createElement("p",{className:N.a.titleWrap},l.a.createElement("span",{className:N.a.required},"*"),l.a.createElement("span",{className:N.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",l.a.createElement("span",{className:N.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),ct.map(function(Gt,ot){return l.a.createElement("div",{className:N.a.choiceWrap,key:ot},l.a.createElement(X.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},l.a.createElement("div",{className:"".concat(N.a.answer," ").concat(It.includes(ot)?N.a.activeAnswer:""),onClick:function(){It.includes(ot)?Bt(It.filter(function(dt){return dt!==ot})):Bt([].concat(Object(be.a)(It),[ot]))}},Oe[ot])),l.a.createElement("div",{className:N.a.editorWrap},Kt===ot?l.a.createElement(Se.a,{id:"single-question-option-".concat(ot),watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:Gt,onChange:function(dt){ct[ot]=dt,Rt(ct)}}):l.a.createElement("div",{className:N.a.htmlWrap,onClick:function(){return Vt(ot)}},l.a.createElement(a.a,{value:Gt}))),ot>1&&l.a.createElement(X.a,{title:"\u5220\u9664"},l.a.createElement("i",{className:"".concat(N.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){Rt(ct.filter(function(dt,yr){return yr!==ot})),It.includes(ot)?Bt(It.filter(function(dt){return dt!==ot})):Bt([].concat(Object(be.a)(It),[ot]))}})),ot<7&&ot===ct.length-1&&l.a.createElement(X.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},l.a.createElement("i",{className:"".concat(N.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return Rt([].concat(Object(be.a)(ct),[""]))}})))}),l.a.createElement("p",{className:N.a.titleWrap},l.a.createElement("span",{className:N.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(Se.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Ot,onChange:function(ot){return vt(ot)}}))},De=Object(m.a)(function(ee){var ae=ee.loading,ue=ee.globalSetting;return{globalSetting:ue,loading:ae.effects}},null,null,{forwardRef:!0})(Object(f.forwardRef)(Re)),Pe=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Ke=function(ae,ue){var de=ae.editData,ye=ae.globalSetting,Te=ae.loading,Fe=ae.dispatch,He=ae.onRef,at=He===void 0?function(){}:He,Lt=ae.isEdit,Ge=Object(Ne.a)(ae,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),tt=Object(f.useState)([]),Dt=Object(d.a)(tt,2),ct=Dt[0],Rt=Dt[1],jt=Object(f.useState)(),xt=Object(d.a)(jt,2),Kt=xt[0],Vt=xt[1],Ut=Object(f.useState)(),Nt=Object(d.a)(Ut,2),It=Nt[0],Bt=Nt[1],Ct=Object(f.useState)(""),wt=Object(d.a)(Ct,2),mt=wt[0],rt=wt[1],Ue=Object(f.useState)(""),St=Object(d.a)(Ue,2),Ot=St[0],vt=St[1];Object(f.useEffect)(function(){Rt(["","","",""])},[]),Object(f.useEffect)(function(){if(!de||!Lt)return;rt(de==null?void 0:de.name),vt(de==null?void 0:de.analysis),Rt(de==null?void 0:de.choices.map(function(Gt){return Gt.choice_text})),Bt(de==null?void 0:de.choices.findIndex(function(Gt){return Gt.is_answer}))},[de]),Object(f.useImperativeHandle)(ue,function(){return{onSave:_t,Clear:Ht}});var _t=function(){if(!mt)return _.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;var ot=ct.findIndex(function(dt){return!dt});if(ot>-1)return _.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(Pe[ot]," \u9009\u9879\u7684\u5185\u5BB9")),!1;if(console.log("activeAnswer: ",It),!(typeof It=="number"))return _.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),!1;var Be=ct.map(function(dt,yr){return{choice_text:dt,is_answer:It===yr?1:0}});return{name:mt,choices:Be,analysis:Ot}},Ht=function(){Rt(["","","",""]),rt(""),vt(""),Bt("")};return l.a.createElement("section",{className:N.a.wrap},l.a.createElement("p",{className:N.a.titleWrap},l.a.createElement("span",{className:N.a.required},"*"),l.a.createElement("span",{className:N.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement(Se.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:mt,onChange:function(ot){return rt(ot)}}),l.a.createElement("p",{className:N.a.titleWrap},l.a.createElement("span",{className:N.a.required},"*"),l.a.createElement("span",{className:N.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",l.a.createElement("span",{className:N.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),ct.map(function(Gt,ot){return l.a.createElement("div",{className:N.a.choiceWrap,key:ot},l.a.createElement(X.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},l.a.createElement("div",{className:"".concat(N.a.answer," ").concat(It===ot?N.a.activeAnswer:""),onClick:function(){return Bt(ot)}},Pe[ot])),l.a.createElement("div",{className:N.a.editorWrap},Kt===ot?l.a.createElement(Se.a,{id:"single-question-option-".concat(ot),watch:!0,height:155,isFocus:!0,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:Gt,onChange:function(dt){ct[ot]=dt,Rt(ct)}}):l.a.createElement("div",{className:N.a.htmlWrap,onClick:function(){return Vt(ot)}},l.a.createElement(a.a,{value:Gt}))),ot>1&&l.a.createElement(X.a,{title:"\u5220\u9664"},l.a.createElement("i",{className:"".concat(N.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){Rt(ct.filter(function(dt,yr){return yr!==ot})),ot===It&&Bt(null)}})),ot<7&&ot===ct.length-1&&l.a.createElement(X.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},l.a.createElement("i",{className:"".concat(N.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return Rt([].concat(Object(be.a)(ct),[""]))}})))}),l.a.createElement("p",{className:N.a.titleWrap},l.a.createElement("span",{className:N.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(Se.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Ot,onChange:function(ot){return vt(ot)}}))},Xe=Object(m.a)(function(ee){var ae=ee.loading,ue=ee.globalSetting;return{globalSetting:ue,loading:ae.effects}},null,null,{forwardRef:!0})(Object(f.forwardRef)(Ke)),Ye=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],$e=function(ae,ue){var de=ae.editData,ye=ae.globalSetting,Te=ae.loading,Fe=ae.dispatch,He=ae.onRef,at=He===void 0?function(){}:He,Lt=ae.isEdit,Ge=Object(Ne.a)(ae,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),tt=Object(f.useState)(""),Dt=Object(d.a)(tt,2),ct=Dt[0],Rt=Dt[1],jt=Object(f.useState)(""),xt=Object(d.a)(jt,2),Kt=xt[0],Vt=xt[1],Ut=Object(f.useState)(""),Nt=Object(d.a)(Ut,2),It=Nt[0],Bt=Nt[1];Object(f.useEffect)(function(){var mt;if(!de||!Lt)return;Rt(de==null?void 0:de.name),Vt(de==null?void 0:de.analysis),Bt(de==null||((mt=de.answer_texts)===null||mt===void 0)?void 0:mt[0])},[de]),Object(f.useImperativeHandle)(ue,function(){return{onSave:Ct,Clear:wt}});var Ct=function(){return ct?It?{name:ct,answer_texts:[It],analysis:Kt}:(_.b.info("\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848"),!1):(_.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1)},wt=function(){Rt(""),Vt(""),Bt("")};return l.a.createElement("section",{className:N.a.wrap},l.a.createElement("p",{className:N.a.titleWrap},l.a.createElement("span",{className:N.a.required},"*"),l.a.createElement("span",{className:N.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement(Se.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:ct,onChange:function(rt){return Rt(rt)}}),l.a.createElement("p",{className:N.a.titleWrap},l.a.createElement("span",{className:N.a.title},"\u53C2\u8003\u7B54\u6848\uFF1A")),l.a.createElement(Se.a,{id:"single-question-reference-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848",defaultValue:It,onChange:function(rt){return Bt(rt)}}),l.a.createElement("p",{className:N.a.titleWrap},l.a.createElement("span",{className:N.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(Se.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Kt,onChange:function(rt){return Vt(rt)}}))},ft=Object(m.a)(function(ee){var ae=ee.loading,ue=ee.globalSetting;return{globalSetting:ue,loading:ae.effects}},null,null,{forwardRef:!0})(Object(f.forwardRef)($e)),Je=se("k1fw"),et=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],ke=function(ae,ue){var de=ae.globalSetting,ye=ae.loading,Te=ae.dispatch,Fe=ae.editData,He=ae.onRef,at=He===void 0?function(){}:He,Lt=ae.isEdit,Ge=Object(Ne.a)(ae,["globalSetting","loading","dispatch","editData","onRef","isEdit"]),tt=Object(f.useState)(""),Dt=Object(d.a)(tt,2),ct=Dt[0],Rt=Dt[1],jt=Object(f.useState)([]),xt=Object(d.a)(jt,2),Kt=xt[0],Vt=xt[1];console.log(Kt),Object(f.useEffect)(function(){var Ct;if(!Fe||!Lt)return;Rt(Fe==null?void 0:Fe.name);var wt=Fe==null||((Ct=Fe.sub_item_banks)===null||Ct===void 0)?void 0:Ct.map(function(mt){var rt,Ue,St;return Object(Je.a)(Object(Je.a)({},mt),{},{id:mt.id,open:!1,qusList:mt==null||((rt=mt.choices)===null||rt===void 0)?void 0:rt.map(function(Ot){return Ot.choice_text}),activeQusEditor:null,qusAnswer:(Ue=[mt==null||((St=mt.choices)===null||St===void 0)?void 0:St.findIndex(function(Ot){return Ot.is_answer})])===null||Ue===void 0?void 0:Ue.filter(function(Ot){return Ot!==-1})})});Vt(wt)},[Fe]),Object(f.useImperativeHandle)(ue,function(){return{onSave:Ut,Clear:Nt}});var Ut=function(){if(!ct)return _.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;if(Kt.length===0)return _.b.info("\u8BF7\u60A8\u6DFB\u52A0\u5C0F\u9898"),!1;for(var wt=0;wt<Kt.length;wt++){var mt,rt=Kt[wt];if(!(rt!=null&&rt.name))return _.b.info("\u8BF7\u60A8\u8F93\u5165\u7B2C".concat(wt+1,"\u5C0F\u9898\u9898\u5E72")),!1;var Ue=rt==null||((mt=rt.qusList)===null||mt===void 0)?void 0:mt.findIndex(function(Ot){return!Ot});if(Ue>-1)return _.b.info("\u8BF7\u5148\u8F93\u5165\u7B2C".concat(wt+1,"\u5C0F\u9898").concat(et[Ue],"\u9009\u9879\u7684\u5185\u5BB9")),!1;if(!(rt!=null&&rt.qusAnswer.length))return _.b.info("\u8BF7\u8BBE\u7F6E\u7B2C".concat(wt+1,"\u5C0F\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E")),!1}var St=Kt.map(function(Ot){return{id:Ot.id>1?Ot.id:null,name:Ot.name,item_type:Ot.item_type,analysis:Ot.analysis,choices:Ot.qusList.map(function(vt,_t){return{choice_text:vt,is_answer:Ot.qusAnswer[0]===_t?1:0}})}});return{name:ct,sub_item_banks:St}},Nt=function(){Rt(""),Vt([])},It=function(){var wt={id:Math.random(),item_type:"SINGLE",open:!1,name:"",qusList:["","","",""],activeQusEditor:null,qusAnswer:[],analysis:""};Vt(Kt.concat(wt))},Bt=function(wt,mt,rt){var Ue=Object(G.cloneDeep)(Kt);if(wt==="open"&&(Ue[mt].open=!Ue[mt].open),wt==="delete"&&Ue.splice(mt,1),wt==="value"&&(Ue[mt].name=rt),wt==="answer"&&(Ue[mt].qusAnswer=[rt]),wt==="edit"&&(Ue[mt].activeQusEditor=rt),wt==="details"&&(Ue[mt].qusList[Ue[mt].activeQusEditor]=rt),wt==="addQus"&&(Ue[mt].qusList=Ue[mt].qusList.concat("")),wt==="deleteQus"){var St;Ue[mt].qusList=Ue[mt].qusList.filter(function(Ot,vt){return vt!==rt}),Ue[mt].qusAnswer=(St=Ue[mt].qusAnswer)===null||St===void 0?void 0:St.filter(function(Ot){return Ot!==rt})}wt==="analysis"&&(Ue[mt].analysis=rt),Vt(Ue)};return l.a.createElement("section",{className:N.a.wrap},l.a.createElement("p",{className:N.a.titleWrap},l.a.createElement("span",{className:N.a.required},"*"),l.a.createElement("span",{className:N.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement(Se.a,{id:"combination-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:ct,onChange:function(wt){return Rt(wt)}}),Kt==null?void 0:Kt.map(function(Ct,wt){var mt;return l.a.createElement("div",{className:N.a.fold,key:Ct.id},l.a.createElement("div",{onClick:function(){return Bt("open",wt)},className:N.a.head},l.a.createElement("i",{className:"iconfont icon-sanjiaoxing",style:{transform:Ct.open?"initial":"rotate(270deg) translate(2px, 4px)"}}),l.a.createElement("span",null,"\u7B2C",wt+1,"\u5C0F\u9898\uFF08\u5355\u9009\u9898\uFF09"),l.a.createElement("b",{style:{visibility:"hidden"},onClick:function(Ue){Ue.stopPropagation(),Bt("delete",wt)},className:"iconfont icon-shanchu8"})),l.a.createElement("div",{className:"mb10",style:{display:Ct.open?"block":"none"}},l.a.createElement(Se.a,{watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Ct==null?void 0:Ct.name,onChange:function(Ue){return Bt("value",wt,Ue)}}),l.a.createElement("p",{className:N.a.titleWrap},l.a.createElement("span",{className:N.a.required},"*"),l.a.createElement("span",{className:N.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",l.a.createElement("span",{className:N.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),Ct==null||((mt=Ct.qusList)===null||mt===void 0)?void 0:mt.map(function(rt,Ue){var St,Ot;return l.a.createElement("div",{className:N.a.choiceWrap,key:Ue},l.a.createElement(X.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},l.a.createElement("div",{className:"".concat(N.a.answer," ").concat(Ct!=null&&(St=Ct.qusAnswer)!==null&&St!==void 0&&St.includes(Ue)?N.a.activeAnswer:""),onClick:function(){return Bt("answer",wt,Ue)}},et[Ue])),l.a.createElement("div",{className:N.a.editorWrap},(Ct==null?void 0:Ct.activeQusEditor)===Ue?l.a.createElement(Se.a,{id:"single-question-option-".concat(Ue),watch:!0,height:155,isFocus:!0,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:rt,onChange:function(_t){return Bt("details",wt,_t)}}):l.a.createElement("div",{className:N.a.htmlWrap,onClick:function(){return Bt("edit",wt,Ue)}},l.a.createElement(a.a,{value:rt}))),Ue>1&&l.a.createElement(X.a,{title:"\u5220\u9664"},l.a.createElement("i",{className:"".concat(N.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return Bt("deleteQus",wt,Ue)}})),Ue<7&&Ue===(Ct==null||((Ot=Ct.qusList)===null||Ot===void 0)?void 0:Ot.length)-1&&l.a.createElement(X.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},l.a.createElement("i",{className:"".concat(N.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return Bt("addQus",wt)}})))}),l.a.createElement("p",{className:"mb10 mt10"},l.a.createElement("span",{className:N.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(Se.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Ct.analysis,onChange:function(Ue){return Bt("analysis",wt,Ue)}})))}))},st=Object(m.a)(function(ee){var ae=ee.loading,ue=ee.globalSetting;return{globalSetting:ue,loading:ae.effects}},null,null,{forwardRef:!0})(Object(f.forwardRef)(ke)),nt=se("14J3"),oe=se("BMrR"),J=se("ZWs3"),Q=function(ae){var ue=ae.visible,de=ae.onCancel,ye=ae.onRandomExchange,Te=ae.selectFromProblemSet;return l.a.createElement(u.a,{title:"\u8BF7\u9009\u62E9\u66FF\u6362\u65B9\u5F0F",visible:ue,onCancel:de,centered:!0,maskClosable:!0,footer:null},l.a.createElement(oe.a,{justify:"center"},l.a.createElement(J.a,{onClick:ye},"\u968F\u673A\u66F4\u6362"),l.a.createElement(D.a,{style:{marginLeft:24},onClick:Te},"\u4ECE\u9898\u5E93\u4E2D\u9009\u62E9")))},ne=Q,le=function(ae){var ue,de,ye,Te,Fe,He,at,Lt,Ge=ae.data,tt=ae.submit,Dt=ae.goBack,ct=ae.loading,Rt=ae.onTypeScore,jt=ae.editPreview,xt=jt===void 0?!1:jt,Kt=ae.onSkipExamination,Vt=ae.selectValue,Ut=ae.onExchange,Nt=Object(f.useRef)(),It=Object(f.useRef)(Object(G.debounce)(function(){return or()},100,{leading:!0,trailing:!0})),Bt=Object(f.useState)(null),Ct=Object(d.a)(Bt,2),wt=Ct[0],mt=Ct[1],rt=Object(f.useState)(!1),Ue=Object(d.a)(rt,2),St=Ue[0],Ot=Ue[1],vt=Object(f.useState)(!1),_t=Object(d.a)(vt,2),Ht=_t[0],Gt=_t[1],ot=Object(f.useRef)(),Be=Object(g.i)();Object(f.useEffect)(function(){return window.addEventListener("scroll",It==null?void 0:It.current),function(){window.removeEventListener("scroll",It==null?void 0:It.current)}},[]),Object(f.useEffect)(function(){Ot(!0)},[]),Object(f.useEffect)(function(){var qe,Ce,ze,bt,lt=(qe=document.getElementById("examName"))===null||qe===void 0||((Ce=qe.getElementsByClassName("ant-pagination-options-quick-jumper"))===null||Ce===void 0||((ze=Ce[0])===null||ze===void 0||((bt=ze.childNodes)===null||bt===void 0)))?void 0:bt[2];lt&&(lt.nodeValue="\u4EFD")},[Ge]);var dt=function(Ce){var ze=parseInt(Ce);return isNaN(ze)?"":ze};function yr(){var qe=0,Ce=0,ze=0;return document.body&&(Ce=document.body.scrollTop),document.documentElement&&(ze=document.documentElement.scrollTop),qe=Ce-ze>0?Ce:ze,qe}function an(){var qe=0,Ce=0,ze=0;return document.body&&(Ce=document.body.scrollHeight),document.documentElement&&(ze=document.documentElement.scrollHeight),qe=Ce-ze>0?Ce:ze,qe}function on(){var qe=0;return document.compatMode=="CSS1Compat"?qe=document.documentElement.clientHeight:qe=document.body.clientHeight,qe}var or=function(){var Ce=document.getElementById("preview_btns"),ze=document.getElementById("preview_btns_else");yr()+on()>=an()-68?(Ce.style.visibility="hidden",ze.style.visibility="visible"):(Ce.style.visibility="visible",ze.style.visibility="hidden")},Ft=["\u5BB9\u6613","\u7B80\u5355","\u9002\u4E2D","\u56F0\u96BE"],gt=function(Ce){var ze,bt=[];return l.a.createElement(l.a.Fragment,null,l.a.createElement("aside",{className:h.a.single},Ce==null||((ze=Ce.choices)===null||ze===void 0)?void 0:ze.map(function(lt,ht){return lt.is_answer&&bt.push(sn[ht]),l.a.createElement("ul",{key:ht},l.a.createElement("li",null,sn[ht],"\u3001"),l.a.createElement("li",null,l.a.createElement(a.a,{value:lt.choice_text})))})),l.a.createElement("div",{className:h.a.analysis},l.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",bt.join(""),l.a.createElement("span",{className:"ml30"},"\u96BE\u5EA6\uFF1A",Ft[Ce.difficulty])),l.a.createElement("aside",null,l.a.createElement("span",{className:h.a.text},"\u89E3\u6790:"),l.a.createElement(a.a,{value:Ce.analysis?Ce.analysis:"\u6682\u65E0\u89E3\u6790"})),l.a.createElement("ul",null,l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(Ce==null?void 0:Ce.discipline_name,"/").concat(Ce==null?void 0:Ce.sub_discipline_name)),l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),Ce==null?void 0:Ce.tag_discipline_name))))},ir=function(Ce){var ze,bt=Ce==null||((ze=Ce.standard_answer)===null||ze===void 0)?void 0:ze.map(function(lt){var ht;return"\u7B54\u6848\uFF08\u586B\u7A7A".concat(lt.position,"\uFF09\uFF1A").concat(lt==null||((ht=lt.answer_text)===null||ht===void 0)?void 0:ht.join("\u3001"))});return l.a.createElement(l.a.Fragment,null,l.a.createElement("div",{className:h.a.analysis},l.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",bt),l.a.createElement("aside",null,l.a.createElement("span",{className:h.a.text},"\u89E3\u6790:"),l.a.createElement(a.a,{value:Ce.analysis?Ce.analysis:"\u6682\u65E0\u89E3\u6790"})),l.a.createElement("ul",null,l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(Ce==null?void 0:Ce.discipline_name,"/").concat(Ce==null?void 0:Ce.sub_discipline_name)),l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),Ce==null?void 0:Ce.tag_discipline_name))))},We=function(Ce){var ze;return l.a.createElement("div",{className:h.a.analysis},l.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",Ce==null||((ze=Ce.answer_texts)===null||ze===void 0)?void 0:ze[0]),l.a.createElement("aside",null,l.a.createElement("span",{className:h.a.text},"\u89E3\u6790:"),l.a.createElement(a.a,{value:Ce.analysis?Ce.analysis:"\u6682\u65E0\u89E3\u6790"})),l.a.createElement("ul",null,l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(Ce==null?void 0:Ce.discipline_name,"/").concat(Ce==null?void 0:Ce.sub_discipline_name)),l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),Ce==null?void 0:Ce.tag_discipline_name)))},dr=function(Ce){var ze;return l.a.createElement("div",{className:h.a.analysis},l.a.createElement("aside",null,l.a.createElement("span",{className:h.a.text},"\u9884\u671F\u8F93\u51FA:"),l.a.createElement(a.a,{value:Ce==null||((ze=Ce.program_attr)===null||ze===void 0)?void 0:ze.description})),l.a.createElement("ul",null,l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(Ce==null?void 0:Ce.discipline_name,"/").concat(Ce==null?void 0:Ce.sub_discipline_name)),l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),Ce==null?void 0:Ce.tag_discipline_name)))},_r=function(Ce,ze){var bt;return l.a.createElement("div",null,Ce==null||((bt=Ce.sub_item_banks)===null||bt===void 0)?void 0:bt.map(function(lt,ht){var kt,tr=[];return l.a.createElement(l.a.Fragment,null,l.a.createElement("div",{style:{marginLeft:25,fontSize:"16px",color:"#333"}},ze+1+"."+(ht+1),"\uFF08\u5355\u9009\u9898\uFF09",lt.name),l.a.createElement("aside",{className:h.a.single},lt==null||((kt=lt.choices)===null||kt===void 0)?void 0:kt.map(function(rr,sr){return rr.is_answer&&tr.push(sn[sr]),l.a.createElement("ul",{key:sr},l.a.createElement("li",null,sn[sr],"\u3001"),l.a.createElement("li",null,l.a.createElement(a.a,{value:rr.choice_text})))})),l.a.createElement("div",{className:h.a.analysis},l.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",tr.join(""),l.a.createElement("span",{className:"ml30"},"\u96BE\u5EA6\uFF1A",Ft[lt.difficulty])),l.a.createElement("aside",null,l.a.createElement("span",{className:h.a.text},"\u89E3\u6790:"),l.a.createElement(a.a,{value:lt.analysis?lt.analysis:"\u6682\u65E0\u89E3\u6790"})),l.a.createElement("ul",null,l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(Ce==null?void 0:Ce.discipline_name,"/").concat(Ce==null?void 0:Ce.sub_discipline_name)),l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),Ce==null?void 0:Ce.tag_discipline_name))))}))},sn=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],fn=function(Ce){var ze,bt=[];Ce==null||((ze=Ce.questions)===null||ze===void 0)||ze.map(function(ht){var kt;return ht==null||((kt=ht.sub_item_banks)===null||kt===void 0)?void 0:kt.map(function(tr){bt.push(tr)})});var lt=0;Ce.type==="COMBINATION"?lt=Ce.questions_score/bt.length:lt=Ce.questions_score/Ce.questions_count,u.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u5206\u6570\u8BBE\u7F6E",content:l.a.createElement("div",{className:h.a.modalColumn},l.a.createElement("div",{className:h.a.modalRow,style:{justifyContent:"flex-start"}},l.a.createElement("sup",{className:h.a.sup},"*"),l.a.createElement("span",null,Ce==null?void 0:Ce.name,(Ce==null?void 0:Ce.type)==="COMBINATION"&&"\u4E2D\u7684\u6BCF\u5C0F\u9898","\uFF1A"),l.a.createElement(c.a,{min:1,parser:dt,defaultValue:lt,onChange:function(kt){lt=kt}}),l.a.createElement("span",{className:"ml5"},"\u5206/\u9898"))),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var ht=Object(A.a)(v.a.mark(function tr(){var rr,sr;return v.a.wrap(function(cr){for(;;)switch(cr.prev=cr.next){case 0:if(lt){cr.next=3;break}return _.b.warn("\u5206\u6570\u4E0D\u80FD\u4E3A\u7A7A\u6216\u4E3A0"),cr.abrupt("return",Promise.reject());case 3:Ce.type==="COMBINATION"?(rr={type:Ce==null?void 0:Ce.type,score:lt,scoreTotal:lt*(bt==null?void 0:bt.length)},Rt(rr)):(sr={type:Ce==null?void 0:Ce.type,score:lt,scoreTotal:lt*Ce.questions_count},Rt(sr));case 4:case"end":return cr.stop()}},tr)}));function kt(){return ht.apply(this,arguments)}return kt}()})},zr=function(){var Ce="";u.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u4FDD\u5B58\u8BD5\u5377",content:l.a.createElement("div",{className:h.a.modalColumn},l.a.createElement("div",{style:{color:"#676A6C",display:"flex"},className:"font14 mt20"},l.a.createElement("img",{style:{marginRight:5},src:ie.a}),"\u4FDD\u5B58\u540E\u5355\u72EC\u751F\u6210\u4E00\u4EFD\u4EBA\u5DE5\u7EC4\u5377\u7C7B\u578B\u7684\u56FA\u5B9A\u8BD5\u5377\u3002"),l.a.createElement("div",{className:h.a.modalRow,style:{marginTop:20}},l.a.createElement("sup",{className:h.a.sup},"*"),l.a.createElement("span",{style:{flexShrink:0}},"\u8BD5\u5377\u540D\u79F0\uFF1A"),l.a.createElement(w.a,{placeholder:"\u8BF7\u8F93\u5165\u8BD5\u5377\u540D\u79F0",min:0,maxLength:60,defaultValue:Ce,onChange:function(bt){Ce=bt.target.value}}))),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var ze=Object(A.a)(v.a.mark(function lt(){var ht,kt,tr,rr,sr;return v.a.wrap(function(cr){for(;;)switch(cr.prev=cr.next){case 0:if(Ce){cr.next=3;break}return _.b.warn("\u8BD5\u5377\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A"),cr.abrupt("return",Promise.reject());case 3:return kt=[],tr=[],rr=[],Ge==null||((ht=Ge.questionList)===null||ht===void 0)||ht.forEach(function(Dr){var fr;(fr=Dr.questions)===null||fr===void 0||fr.forEach(function(Zr){kt.push(Zr.id),tr.push(Dr.questions_score/Dr.questions_count),Dr.type==="COMBINATION"&&rr.push({id:Zr.id,sub_item_bank_ids:Zr.sub_item_banks.map(function(Tr){return Tr.id})})})}),console.log("-----",rr),sr={item_bank_ids:kt,item_bank_scores:tr,name:Ce,combination_item_banks:rr},cr.next=11,tt(sr);case 11:case"end":return cr.stop()}},lt)}));function bt(){return ze.apply(this,arguments)}return bt}()})},Ln=function(Ce,ze,bt,lt){var ht,kt="".concat(location.pathname).concat(location.search),tr=(ht=lt.questions)===null||ht===void 0?void 0:ht.map(function(sr){return sr.id});if(kt.includes("exercise"))ot.current={id:Ce,ids:tr,type:ze,index:bt},Gt(!0);else var rr=u.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u6E29\u99A8\u63D0\u793A",content:"\u786E\u8BA4\u8981\u66F4\u6362\u8BE5\u8BD5\u9898\u5417\uFF1F",cancelButtonProps:{disabled:!1},maskClosable:!0,keyboard:!1,okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var sr=Object(A.a)(v.a.mark(function cr(){return v.a.wrap(function(fr){for(;;)switch(fr.prev=fr.next){case 0:return rr.update({cancelButtonProps:{disabled:!0}}),fr.next=3,Ut({single_question_id:Ce,seleted_item_bank_ids:tr},{type:ze,index:bt});case 3:rr.update({cancelButtonProps:{disabled:!1}}),_.b.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210\u8BD5\u9898");case 5:case"end":return fr.stop()}},cr)}));function Lr(){return sr.apply(this,arguments)}return Lr}()})},Rn=function(Ce){var ze,bt=(ze=Ce.questions)===null||ze===void 0?void 0:ze.map(function(kt){return kt.id}),lt=Ce.name,ht=u.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u6E29\u99A8\u63D0\u793A",content:"\u786E\u8BA4\u66F4\u6362".concat(lt,"\u4E2D\u7684\u6240\u6709\u8BD5\u9898\u5417\uFF1F"),cancelButtonProps:{disabled:!1},maskClosable:!1,keyboard:!1,okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var kt=Object(A.a)(v.a.mark(function rr(){return v.a.wrap(function(Lr){for(;;)switch(Lr.prev=Lr.next){case 0:return ht.update({cancelButtonProps:{disabled:!0}}),Lr.next=3,Ut({seleted_item_bank_ids:bt},{type:Ce.type});case 3:ht.update({cancelButtonProps:{disabled:!1}}),_.b.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210".concat(lt,"\u8BD5\u9898"));case 5:case"end":return Lr.stop()}},rr)}));function tr(){return kt.apply(this,arguments)}return tr}()})},Kr=function(){var Ce=u.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u6E29\u99A8\u63D0\u793A",content:"\u786E\u8BA4\u66F4\u6362\u9884\u89C8\u4E2D\u7684\u6240\u6709\u8BD5\u9898\u5417\uFF1F",cancelButtonProps:{disabled:!1},maskClosable:!1,keyboard:!1,okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var ze=Object(A.a)(v.a.mark(function lt(){return v.a.wrap(function(kt){for(;;)switch(kt.prev=kt.next){case 0:return Ce.update({cancelButtonProps:{disabled:!0}}),kt.next=3,Ut();case 3:Ce.update({cancelButtonProps:{disabled:!1}}),_.b.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210\u6574\u5F20\u8BD5\u9898");case 5:case"end":return kt.stop()}},lt)}));function bt(){return ze.apply(this,arguments)}return bt}()})},ln=function(Ce){console.log(Ce,"key"),Kt(Ce-1)},kn=function(){return l.a.createElement(l.a.Fragment,null,l.a.createElement(F.a,{color:"#55575D",overlayClassName:h.a.popover,visible:St,getPopupContainer:function(ze){return ze==null?void 0:ze.parentNode},content:"\u5982\u60A8\u5BF9\u6B64\u4EFD\u8BD5\u9898\u6EE1\u610F\uFF0C\u53EF\u5C06\u6B64\u4EFD\u8BD5\u9898\u4FDD\u5B58\u4E3A\u56FA\u5B9A\u8BD5\u5377"},l.a.createElement(D.a,{onMouseEnter:function(){return Ot(!0)},onMouseLeave:function(){return Ot(!1)},onClick:function(){zr()}},"\u4FDD\u5B58")),l.a.createElement(D.a,{onClick:function(){document.body.scrollIntoView(),Dt()}},"\u8FD4\u56DE"),l.a.createElement(D.a,{loading:ct,onClick:function(){return tt()},type:"primary"},"\u63D0\u4EA4"))},yn=function(){var Ce;return l.a.createElement(l.a.Fragment,null,l.a.createElement(D.a,{onClick:Dt},"\u8FD4\u56DE"),Vt>0&&l.a.createElement(D.a,{onClick:function(){return ln(Vt)},type:"primary"},"\u4E0A\u4E00\u4EFD"),Vt<(Ge==null||((Ce=Ge.exam)===null||Ce===void 0)?void 0:Ce.total_num)-1&&l.a.createElement(D.a,{onClick:function(){return ln(Vt+2)}},"\u4E0B\u4E00\u4EFD"))},Vr=function(Ce,ze){if(ze==="SINGLE")return l.a.createElement(l.a.Fragment,null,l.a.createElement(Xe,{ref:Nt,editData:Ce,isEdit:!0}),l.a.createElement(k.a,null));if(ze==="MULTIPLE")return l.a.createElement(l.a.Fragment,null,l.a.createElement(De,{ref:Nt,editData:Ce,isEdit:!0}),l.a.createElement(k.a,null));if(ze==="JUDGMENT")return l.a.createElement(l.a.Fragment,null,l.a.createElement(Ae,{ref:Nt,editData:Ce,isEdit:!0}),l.a.createElement(k.a,null));if(ze==="COMPLETION")return l.a.createElement(l.a.Fragment,null,l.a.createElement(z,{ref:Nt,editData:Ce,isEdit:!0}),l.a.createElement(k.a,null));if(ze==="SUBJECTIVE")return l.a.createElement(l.a.Fragment,null,l.a.createElement(ft,{ref:Nt,editData:Ce,isEdit:!0}),l.a.createElement(k.a,null));if(ze==="COMBINATION")return l.a.createElement(l.a.Fragment,null,l.a.createElement(st,{ref:Nt,editData:Ce,isEdit:!0}),l.a.createElement(k.a,null));if(ze==="PROGRAM"){var bt;m.d.push("/problems/".concat(Ce==null||((bt=Ce.program_attr)===null||bt===void 0)?void 0:bt.identifier,"/edit?type=exercises&express_id=").concat(Be.categoryId,"&question_id=").concat(Ce==null?void 0:Ce.id,"&score=").concat(Ce==null?void 0:Ce.score,"&callback_url=").concat(location.pathname,"&select=").concat(Vt,"&exercise=true"))}},Gn=function(){var qe=Object(A.a)(v.a.mark(function Ce(ze,bt){var lt,ht,kt,tr,rr,sr,Lr,cr,Dr,fr;return v.a.wrap(function(Tr){for(;;)switch(Tr.prev=Tr.next){case 0:return Tr.next=2,(lt=Nt.current)===null||lt===void 0?void 0:lt.onSave();case 2:if(ht=Tr.sent,ht){Tr.next=5;break}return Tr.abrupt("return");case 5:return kt={question_score:bt.score,analysis:ht.analysis},(ze==="SINGLE"||ze==="MULTIPLE"||ze==="JUDGMENT")&&(rr=[],sr=[],kt.question_type=ze==="JUDGMENT"?2:1,kt.question_title=ht==null?void 0:ht.name,ht==null||((tr=ht.choices)===null||tr===void 0)||tr.forEach(function(lr,Xr){rr.push(lr.choice_text),lr!=null&&lr.is_answer&&sr.push(Xr+1)}),kt.question_choices=rr,kt.standard_answers=sr),ze==="COMPLETION"&&(kt.is_ordered=ht.is_ordered,kt.question_title=ht==null?void 0:ht.name,kt.question_type=3,cr=[],ht==null||((Lr=ht.standard_answers)===null||Lr===void 0)||Lr.forEach(function(lr,Xr){cr.push({choice_id:lr.position,answer_text:lr.answer_text})}),kt.standard_answers=cr),ze==="SUBJECTIVE"&&(kt.question_title=ht==null?void 0:ht.name,kt.question_type=3,kt.standard_answers=ht==null?void 0:ht.answer_texts),ze==="COMBINATION"&&(kt.question_title=ht==null?void 0:ht.name,kt.question_type=7,kt.sub_questions=ht==null||((Dr=ht.sub_item_banks)===null||Dr===void 0)?void 0:Dr.map(function(lr,Xr){return{id:lr.id,question_title:lr.name,question_type:1,question_choices:lr.choices.map(function(Yr){return Yr.choice_text}),standard_answers:[lr.choices.findIndex(function(Yr){return Yr.is_answer})+1],analysis:lr.analysis}}),delete kt.analysis),Tr.next=12,Object(y.a)("/api/exercise_questions/".concat(bt.id,".json"),{method:"put",body:kt});case 12:fr=Tr.sent,(fr==null?void 0:fr.status)===0&&(_.b.success("\u7F16\u8F91\u6210\u529F"),ln(Vt+1)),mt(null);case 15:case"end":return Tr.stop()}},Ce)}));return function(ze,bt){return qe.apply(this,arguments)}}(),Ui=function(){for(var Ce=[],ze=0;ze<(Ge==null||((bt=Ge.exam)===null||bt===void 0)?void 0:bt.total_num);ze++){var bt;Ce.push({})}return Ce},Pn=Ge==null||((ue=Ge.questionList)===null||ue===void 0)?void 0:ue.reduce(function(qe,Ce){return qe+Ce.questions_score},0),br=xt&&(Ge==null||((de=Ge.exam)===null||de===void 0)?void 0:de.exercise_status)!==1;return l.a.createElement("section",{className:h.a.wrap},l.a.createElement("div",{id:"id_left_preview",className:h.a.left,onMouseEnter:function(Ce){var ze=document.getElementById("id_left_preview");ze.style.overflowY="auto"},onMouseLeave:function(Ce){var ze=document.getElementById("id_left_preview");ze.style.overflowY="hidden"}},l.a.createElement("div",{className:h.a.title},l.a.createElement("div",null,l.a.createElement("b",null),l.a.createElement("span",null,"\u7B54\u9898\u5361"))),l.a.createElement("div",{className:h.a.total},l.a.createElement("div",null,l.a.createElement("img",{src:H.a}),l.a.createElement("span",null,"\u9898\u6570(\u9053)"),l.a.createElement("aside",null,Ge==null?void 0:Ge.all_questions_count)),l.a.createElement("div",{className:"mr30 ml30"},l.a.createElement("img",{src:te.a}),l.a.createElement("span",null,"\u603B\u5206(\u5206)"),l.a.createElement("aside",null,Pn)),l.a.createElement("div",null,l.a.createElement("img",{src:s.a}),l.a.createElement("span",null,"\u65F6\u957F(\u5206)"),l.a.createElement("aside",null,Ge==null||((ye=Ge.exam)===null||ye===void 0)?void 0:ye.time))),Ge==null||((Te=Ge.questionList)===null||Te===void 0)?void 0:Te.map(function(qe,Ce){var ze;return l.a.createElement("div",{className:h.a.list,key:Ce},l.a.createElement("div",{className:h.a.name},l.a.createElement("b",null),l.a.createElement("span",null,qe.name)),l.a.createElement("aside",null,l.a.createElement("div",null,"\u5171",l.a.createElement("span",{className:h.a.b},qe.questions_count),"\u9898"," ",l.a.createElement("span",{className:h.a.l},"|"),"\u5171",l.a.createElement("span",{className:h.a.r},qe.questions_score),"\u5206"),l.a.createElement("div",{className:h.a.answerSheet},qe==null||((ze=qe.questions)===null||ze===void 0)?void 0:ze.map(function(bt,lt){return l.a.createElement("div",{onClick:function(){var kt="Anchor_".concat(bt.id),tr=document.getElementById(kt);tr&&setTimeout(function(){return tr.scrollIntoView({block:"center",behavior:"smooth"})})},key:bt.id,className:h.a.tag},lt+1)}))))})),l.a.createElement("div",{className:h.a.right},l.a.createElement("div",{className:h.a.examName,id:"examName"},l.a.createElement("div",{className:h.a.name},l.a.createElement(X.a,{title:Ge==null||((Fe=Ge.exam)===null||Fe===void 0)?void 0:Fe.name,getPopupContainer:function(Ce){return Ce.parentNode}},l.a.createElement("span",{className:h.a.t},Ge==null||((He=Ge.exam)===null||He===void 0)?void 0:He.name))),xt?l.a.createElement(Y.a,{showTotal:function(Ce){return l.a.createElement("span",{style:{color:"#656F87",fontSize:14}},"\u5171\u8BA1",l.a.createElement("span",{className:"c-light-primary"},Ce),"\u4EFD\u8BD5\u5377")},total:Ge==null||((at=Ge.exam)===null||at===void 0)?void 0:at.total_num,pageSize:1,current:Vt+1,showSizeChanger:!1,onChange:ln,showQuickJumper:!0,hideOnSinglePage:!1}):l.a.createElement(D.a,{onClick:Kr,type:"primary"},"\u968F\u673A\u66F4\u6362")),l.a.createElement("div",{className:h.a.topWarp},Ge==null||((Lt=Ge.questionList)===null||Lt===void 0)?void 0:Lt.map(function(qe,Ce){var ze,bt;return l.a.createElement(l.a.Fragment,{key:Ce},l.a.createElement("div",{className:h.a.head,style:Ce===0?{border:0,marginTop:-16}:{}},l.a.createElement("div",{className:h.a.name},l.a.createElement("b",null),l.a.createElement("span",null,qe.name)),l.a.createElement("div",{className:h.a.so},"\u5171",l.a.createElement("span",{className:h.a.b},qe.questions_count," "),"\u9898"," ",qe.type==="COMBINATION"&&"\uFF08\u5305\u542B".concat(qe==null||((ze=qe.questions)===null||ze===void 0)?void 0:ze.map(function(lt){var ht;return lt==null||((ht=lt.sub_item_banks)===null||ht===void 0)?void 0:ht.length}).reduce(function(lt,ht){return lt+ht}),"\u5C0F\u9898\uFF09"),l.a.createElement("span",{className:h.a.l},"|"),"\u5171",l.a.createElement("span",{className:h.a.r},qe.questions_score),"\u5206"),!xt&&l.a.createElement("div",{className:h.a.btn},l.a.createElement(D.a,{onClick:function(){fn(qe)},type:"primary",ghost:!0,className:"mr20"},"\u8BBE\u7F6E\u5F97\u5206"),l.a.createElement(D.a,{onClick:function(){return Rn(qe)},type:"primary",ghost:!0},"\u968F\u673A\u66F4\u6362"))),qe==null||((bt=qe.questions)===null||bt===void 0)?void 0:bt.map(function(lt,ht){return wt===lt.id?l.a.createElement("div",{id:"Anchor_".concat(lt.id),className:h.a.content,style:{padding:0,marginTop:10},key:lt.id},l.a.createElement("div",{style:{float:"right",marginTop:-6}},l.a.createElement(D.a,{onClick:function(){return mt(null)},className:"mr20",type:"primary",ghost:!0},"\u53D6\u6D88"),l.a.createElement(D.a,{onClick:function(){return Gn(qe==null?void 0:qe.type,lt)},type:"primary"},"\u4FDD\u5B58")),Vr(lt,qe.type)):l.a.createElement("div",{id:"Anchor_".concat(lt.id),className:h.a.content,key:lt.id},l.a.createElement("div",{className:h.a.titleWrap},l.a.createElement(a.a,{style:{paddingRight:10},className:h.a.titleHtml,value:ht+1+"\u3001"+"".concat((lt==null?void 0:lt.item_type)==="combination"?"\uFF08\u9898\u5E72\uFF09":"")+lt.name}),xt&&l.a.createElement(D.a,{disabled:br,onClick:function(){if(wt){_.b.warn("\u5148\u4FDD\u5B58\u6216\u53D6\u6D88\u5F53\u524D\u6B63\u5728\u7F16\u8F91\u7684\u8BD5\u9898");return}mt(lt.id)},type:"primary",className:"mr20",style:{marginLeft:"auto"},ghost:!0},"\u7F16\u8F91"),l.a.createElement(D.a,{disabled:br,onClick:function(){return Ln(lt.id,qe.type,ht,qe)},type:"primary",ghost:!0},"\u6362\u4E00\u9898")),(qe.type==="SINGLE"||qe.type==="JUDGMENT"||qe.type==="MULTIPLE")&>(lt),qe.type==="COMPLETION"&&ir(lt),qe.type==="SUBJECTIVE"&&We(lt),qe.type==="PROGRAM"&&dr(lt),qe.type==="COMBINATION"&&_r(lt,ht),l.a.createElement("div",null))}))})),l.a.createElement("div",{className:h.a.btnsElse,id:"preview_btns_else"},xt?yn():kn()),l.a.createElement("div",{className:h.a.btnsWrap,id:"preview_btns"},l.a.createElement("div",{className:h.a.btns},xt?yn():kn()))),l.a.createElement(ne,{visible:Ht,onRandomExchange:Object(A.a)(v.a.mark(function qe(){var Ce;return v.a.wrap(function(bt){for(;;)switch(bt.prev=bt.next){case 0:return Ce=ot.current,bt.next=3,Ut({single_question_id:Ce.id,seleted_item_bank_ids:Ce.ids},{type:Ce.type,index:Ce.index});case 3:Gt(!1);case 4:case"end":return bt.stop()}},qe)})),selectFromProblemSet:function(){var Ce=ot.current,ze="".concat(location.pathname).concat(location.search);ze.includes("exercise")&&m.d.push("/paperlibrary/exchangequestion?type=exercise&qid=".concat(Ce.id,"&qtype=").concat(Ce.type,"&exerciseid=").concat(Be.categoryId,"&from=").concat(ze))},onCancel:function(){Gt(!1)}}))},q=it.a=le},ulZh:function(yt,it,se){typeof window!="undefined"&&function(Y,L){yt.exports=L()}(this,function(){return function(he){var Y={};function L(X){if(Y[X])return Y[X].exports;var I=Y[X]={i:X,l:!1,exports:{}};return he[X].call(I.exports,I,I.exports,L),I.l=!0,I.exports}return L.m=he,L.c=Y,L.d=function(X,I,k){L.o(X,I)||Object.defineProperty(X,I,{enumerable:!0,get:k})},L.r=function(X){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(X,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(X,"__esModule",{value:!0})},L.t=function(X,I){if(I&1&&(X=L(X)),I&8)return X;if(I&4&&typeof X=="object"&&X&&X.__esModule)return X;var k=Object.create(null);if(L.r(k),Object.defineProperty(k,"default",{enumerable:!0,value:X}),I&2&&typeof X!="string")for(var W in X)L.d(k,W,function(F){return X[F]}.bind(null,W));return k},L.n=function(X){var I=X&&X.__esModule?function(){return X.default}:function(){return X};return L.d(I,"a",I),I},L.o=function(X,I){return Object.prototype.hasOwnProperty.call(X,I)},L.p="/dist/",L(L.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(he,Y,L){"use strict";var X=Object.prototype.hasOwnProperty,I="~";function k(){}Object.create&&(k.prototype=Object.create(null),new k().__proto__||(I=!1));function W(E,w,P){this.fn=E,this.context=w,this.once=P||!1}function F(E,w,P,_,A){if(typeof P!="function")throw new TypeError("The listener must be a function");var C=new W(P,_||E,A),c=I?I+w:w;return E._events[c]?E._events[c].fn?E._events[c]=[E._events[c],C]:E._events[c].push(C):(E._events[c]=C,E._eventsCount++),E}function O(E,w){--E._eventsCount===0?E._events=new k:delete E._events[w]}function D(){this._events=new k,this._eventsCount=0}D.prototype.eventNames=function(){var w=[],P,_;if(this._eventsCount===0)return w;for(_ in P=this._events)X.call(P,_)&&w.push(I?_.slice(1):_);return Object.getOwnPropertySymbols?w.concat(Object.getOwnPropertySymbols(P)):w},D.prototype.listeners=function(w){var P=I?I+w:w,_=this._events[P];if(!_)return[];if(_.fn)return[_.fn];for(var A=0,C=_.length,c=new Array(C);A<C;A++)c[A]=_[A].fn;return c},D.prototype.listenerCount=function(w){var P=I?I+w:w,_=this._events[P];return _?_.fn?1:_.length:0},D.prototype.emit=function(w,P,_,A,C,c){var o=I?I+w:w;if(!this._events[o])return!1;var u=this._events[o],d=arguments.length,x,v;if(u.fn){u.once&&this.removeListener(w,u.fn,void 0,!0);switch(d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,P),!0;case 3:return u.fn.call(u.context,P,_),!0;case 4:return u.fn.call(u.context,P,_,A),!0;case 5:return u.fn.call(u.context,P,_,A,C),!0;case 6:return u.fn.call(u.context,P,_,A,C,c),!0}for(v=1,x=new Array(d-1);v<d;v++)x[v-1]=arguments[v];u.fn.apply(u.context,x)}else{var f=u.length,l;for(v=0;v<f;v++){u[v].once&&this.removeListener(w,u[v].fn,void 0,!0);switch(d){case 1:u[v].fn.call(u[v].context);break;case 2:u[v].fn.call(u[v].context,P);break;case 3:u[v].fn.call(u[v].context,P,_);break;case 4:u[v].fn.call(u[v].context,P,_,A);break;default:if(!x)for(l=1,x=new Array(d-1);l<d;l++)x[l-1]=arguments[l];u[v].fn.apply(u[v].context,x)}}}return!0},D.prototype.on=function(w,P,_){return F(this,w,P,_,!1)},D.prototype.once=function(w,P,_){return F(this,w,P,_,!0)},D.prototype.removeListener=function(w,P,_,A){var C=I?I+w:w;if(!this._events[C])return this;if(!P)return O(this,C),this;var c=this._events[C];if(c.fn)c.fn===P&&(!A||c.once)&&(!_||c.context===_)&&O(this,C);else{for(var o=0,u=[],d=c.length;o<d;o++)(c[o].fn!==P||A&&!c[o].once||_&&c[o].context!==_)&&u.push(c[o]);u.length?this._events[C]=u.length===1?u[0]:u:O(this,C)}return this},D.prototype.removeAllListeners=function(w){var P;return w?(P=I?I+w:w,this._events[P]&&O(this,P)):(this._events=new k,this._eventsCount=0),this},D.prototype.off=D.prototype.removeListener,D.prototype.addListener=D.prototype.on,D.prefixed=I,D.EventEmitter=D,he.exports=D},"./node_modules/url-toolkit/src/url-toolkit.js":function(he,Y,L){(function(X){var I=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,k=/^([^\/?#]*)([^]*)$/,W=/(?:\/|^)\.(?=\/)/g,F=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,O={buildAbsoluteURL:function(D,E,w){if(w=w||{},D=D.trim(),E=E.trim(),!E){if(!w.alwaysNormalize)return D;var P=O.parseURL(D);if(!P)throw new Error("Error trying to parse base URL.");return P.path=O.normalizePath(P.path),O.buildURLFromParts(P)}var _=O.parseURL(E);if(!_)throw new Error("Error trying to parse relative URL.");if(_.scheme)return w.alwaysNormalize?(_.path=O.normalizePath(_.path),O.buildURLFromParts(_)):E;var A=O.parseURL(D);if(!A)throw new Error("Error trying to parse base URL.");if(!A.netLoc&&A.path&&A.path[0]!=="/"){var C=k.exec(A.path);A.netLoc=C[1],A.path=C[2]}A.netLoc&&!A.path&&(A.path="/");var c={scheme:A.scheme,netLoc:_.netLoc,path:null,params:_.params,query:_.query,fragment:_.fragment};if(!_.netLoc&&(c.netLoc=A.netLoc,_.path[0]!=="/"))if(!_.path)c.path=A.path,_.params||(c.params=A.params,_.query||(c.query=A.query));else{var o=A.path,u=o.substring(0,o.lastIndexOf("/")+1)+_.path;c.path=O.normalizePath(u)}return c.path===null&&(c.path=w.alwaysNormalize?O.normalizePath(_.path):_.path),O.buildURLFromParts(c)},parseURL:function(D){var E=I.exec(D);return E?{scheme:E[1]||"",netLoc:E[2]||"",path:E[3]||"",params:E[4]||"",query:E[5]||"",fragment:E[6]||""}:null},normalizePath:function(D){for(D=D.split("").reverse().join("").replace(W,"");D.length!==(D=D.replace(F,"")).length;);return D.split("").reverse().join("")},buildURLFromParts:function(D){return D.scheme+D.netLoc+D.path+D.params+D.query+D.fragment}};he.exports=O})(this)},"./node_modules/webworkify-webpack/index.js":function(he,Y,L){function X(w){var P={};function _(C){if(P[C])return P[C].exports;var c=P[C]={i:C,l:!1,exports:{}};return w[C].call(c.exports,c,c.exports,_),c.l=!0,c.exports}_.m=w,_.c=P,_.i=function(C){return C},_.d=function(C,c,o){_.o(C,c)||Object.defineProperty(C,c,{configurable:!1,enumerable:!0,get:o})},_.r=function(C){Object.defineProperty(C,"__esModule",{value:!0})},_.n=function(C){var c=C&&C.__esModule?function(){return C.default}:function(){return C};return _.d(c,"a",c),c},_.o=function(C,c){return Object.prototype.hasOwnProperty.call(C,c)},_.p="/",_.oe=function(C){throw console.error(C),C};var A=_(_.s=ENTRY_MODULE);return A.default||A}var I="[\\.|\\-|\\+|\\w|/|@]+",k="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+I+").*?\\)";function W(w){return(w+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function F(w){return!isNaN(1*w)}function O(w,P,_){var A={};A[_]=[];var C=P.toString(),c=C.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!c)return A;for(var o=c[1],u=new RegExp("(\\\\n|\\W)"+W(o)+k,"g"),d;d=u.exec(C);){if(d[3]==="dll-reference")continue;A[_].push(d[3])}for(u=new RegExp("\\("+W(o)+'\\("(dll-reference\\s('+I+'))"\\)\\)'+k,"g");d=u.exec(C);)w[d[2]]||(A[_].push(d[1]),w[d[2]]=L(d[1]).m),A[d[2]]=A[d[2]]||[],A[d[2]].push(d[4]);for(var x=Object.keys(A),v=0;v<x.length;v++)for(var f=0;f<A[x[v]].length;f++)F(A[x[v]][f])&&(A[x[v]][f]=1*A[x[v]][f]);return A}function D(w){var P=Object.keys(w);return P.reduce(function(_,A){return _||w[A].length>0},!1)}function E(w,P){for(var _={main:[P]},A={main:[]},C={main:{}};D(_);)for(var c=Object.keys(_),o=0;o<c.length;o++){var u=c[o],d=_[u],x=d.pop();if(C[u]=C[u]||{},C[u][x]||!w[u][x])continue;C[u][x]=!0,A[u]=A[u]||[],A[u].push(x);for(var v=O(w,w[u][x],u),f=Object.keys(v),l=0;l<f.length;l++)_[f[l]]=_[f[l]]||[],_[f[l]]=_[f[l]].concat(v[f[l]])}return A}he.exports=function(w,P){P=P||{};var _={main:L.m},A=P.all?{main:Object.keys(_.main)}:E(_,w),C="";Object.keys(A).filter(function(x){return x!=="main"}).forEach(function(x){for(var v=0;A[x][v];)v++;A[x].push(v),_[x][v]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",C=C+"var "+x+" = ("+X.toString().replace("ENTRY_MODULE",JSON.stringify(v))+")({"+A[x].map(function(f){return""+JSON.stringify(f)+": "+_[x][f].toString()}).join(",")+`});
|
|
`}),C=C+"new (("+X.toString().replace("ENTRY_MODULE",JSON.stringify(w))+")({"+A.main.map(function(x){return""+JSON.stringify(x)+": "+_.main[x].toString()}).join(",")+"}))(self);";var c=new window.Blob([C],{type:"text/javascript"});if(P.bare)return c;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,u=o.createObjectURL(c),d=new window.Worker(u);return d.objectURL=u,d}},"./src/config.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"hlsDefaultConfig",function(){return l}),L.d(Y,"mergeConfig",function(){return h}),L.d(Y,"enableStreamingMode",function(){return p});var X=L("./src/controller/abr-controller.ts"),I=L("./src/controller/audio-stream-controller.ts"),k=L("./src/controller/audio-track-controller.ts"),W=L("./src/controller/subtitle-stream-controller.ts"),F=L("./src/controller/subtitle-track-controller.ts"),O=L("./src/controller/buffer-controller.ts"),D=L("./src/controller/timeline-controller.ts"),E=L("./src/controller/cap-level-controller.ts"),w=L("./src/controller/fps-controller.ts"),P=L("./src/controller/eme-controller.ts"),_=L("./src/controller/cmcd-controller.ts"),A=L("./src/utils/xhr-loader.ts"),C=L("./src/utils/fetch-loader.ts"),c=L("./src/utils/cues.ts"),o=L("./src/utils/mediakeys-helper.ts"),u=L("./src/utils/logger.ts");function d(){return d=Object.assign||function(s){for(var a=1;a<arguments.length;a++){var g=arguments[a];for(var m in g)Object.prototype.hasOwnProperty.call(g,m)&&(s[m]=g[m])}return s},d.apply(this,arguments)}function x(s,a){var g=Object.keys(s);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(s);a&&(m=m.filter(function(y){return Object.getOwnPropertyDescriptor(s,y).enumerable})),g.push.apply(g,m)}return g}function v(s){for(var a=1;a<arguments.length;a++){var g=arguments[a]!=null?arguments[a]:{};a%2?x(Object(g),!0).forEach(function(m){f(s,m,g[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(g)):x(Object(g)).forEach(function(m){Object.defineProperty(s,m,Object.getOwnPropertyDescriptor(g,m))})}return s}function f(s,a,g){return a in s?Object.defineProperty(s,a,{value:g,enumerable:!0,configurable:!0,writable:!0}):s[a]=g,s}var l=v(v({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:A.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:X.default,bufferController:O.default,capLevelController:E.default,fpsController:w.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:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},b()),{},{subtitleStreamController:W.SubtitleStreamController,subtitleTrackController:F.default,timelineController:D.TimelineController,audioStreamController:I.default,audioTrackController:k.default,emeController:P.default,cmcdController:_.default});function b(){return{cueHandler:c.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function h(s,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return d({},s,a)}function p(s){var a=s.loader;if(a!==C.default&&a!==A.default)u.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1;else{var g=Object(C.fetchSupported)();g&&(s.loader=C.default,s.progressive=!0,s.enableSoftwareAES=!0,u.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(he,Y,L){"use strict";L.r(Y);var X=L("./src/polyfills/number.ts"),I=L("./src/utils/ewma-bandwidth-estimator.ts"),k=L("./src/events.ts"),W=L("./src/utils/buffer-helper.ts"),F=L("./src/errors.ts"),O=L("./src/types/loader.ts"),D=L("./src/utils/logger.ts");function E(_,A){for(var C=0;C<A.length;C++){var c=A[C];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(_,c.key,c)}}function w(_,A,C){return A&&E(_.prototype,A),C&&E(_,C),_}var P=function(){function _(C){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=C;var c=C.config;this.bwEstimator=new I.default(c.abrEwmaSlowVoD,c.abrEwmaFastVoD,c.abrEwmaDefaultEstimate),this.registerListeners()}var A=_.prototype;return A.registerListeners=function(){var c=this.hls;c.on(k.Events.FRAG_LOADING,this.onFragLoading,this),c.on(k.Events.FRAG_LOADED,this.onFragLoaded,this),c.on(k.Events.FRAG_BUFFERED,this.onFragBuffered,this),c.on(k.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(k.Events.ERROR,this.onError,this)},A.unregisterListeners=function(){var c=this.hls;c.off(k.Events.FRAG_LOADING,this.onFragLoading,this),c.off(k.Events.FRAG_LOADED,this.onFragLoaded,this),c.off(k.Events.FRAG_BUFFERED,this.onFragBuffered,this),c.off(k.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(k.Events.ERROR,this.onError,this)},A.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},A.onFragLoading=function(c,o){var u=o.frag;if(u.type===O.PlaylistLevelType.MAIN&&!this.timer){var d;this.fragCurrent=u,this.partCurrent=(d=o.part)!=null?d:null,this.timer=self.setInterval(this.onCheck,100)}},A.onLevelLoaded=function(c,o){var u=this.hls.config;o.details.live?this.bwEstimator.update(u.abrEwmaSlowLive,u.abrEwmaFastLive):this.bwEstimator.update(u.abrEwmaSlowVoD,u.abrEwmaFastVoD)},A._abandonRulesCheck=function(){var c=this.fragCurrent,o=this.partCurrent,u=this.hls,d=u.autoLevelEnabled,x=u.config,v=u.media;if(!c||!v)return;var f=o?o.stats:c.stats,l=o?o.duration:c.duration;if(f.aborted){D.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!d||v.paused||!v.playbackRate||!v.readyState)return;var b=performance.now()-f.loading.start,h=Math.abs(v.playbackRate);if(b<=500*l/h)return;var p=u.levels,s=u.minAutoLevel,a=p[c.level],g=f.total||Math.max(f.loaded,Math.round(l*a.maxBitrate/8)),m=Math.max(1,f.bwEstimate?f.bwEstimate/8:f.loaded*1e3/b),y=(g-f.loaded)/m,M=v.currentTime,H=(W.BufferHelper.bufferInfo(v,M,x.maxBufferHole).end-M)/h;if(H>=2*l/h||y<=H)return;var V=Number.POSITIVE_INFINITY,te;for(te=c.level-1;te>s;te--){var G=p[te].maxBitrate;if(V=l*G/(8*.8*m),V<H)break}if(V>=y)return;var j=this.bwEstimator.getEstimate();D.logger.warn("Fragment "+c.sn+(o?" part "+o.index:"")+" of level "+c.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+te+`
|
|
Current BW estimate: `+(Object(X.isFiniteNumber)(j)?(j/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+y.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+V.toFixed(3)+` s
|
|
Time to underbuffer: `+H.toFixed(3)+" s"),u.nextLoadLevel=te,this.bwEstimator.sample(b,f.loaded),this.clearTimer(),c.loader&&(this.fragCurrent=this.partCurrent=null,c.loader.abort()),u.trigger(k.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:c,part:o,stats:f})},A.onFragLoaded=function(c,o){var u=o.frag,d=o.part;if(u.type===O.PlaylistLevelType.MAIN&&Object(X.isFiniteNumber)(u.sn)){var x=d?d.stats:u.stats,v=d?d.duration:u.duration;if(this.clearTimer(),this.lastLoadedFragLevel=u.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var f=this.hls.levels[u.level],l=(f.loaded?f.loaded.bytes:0)+x.loaded,b=(f.loaded?f.loaded.duration:0)+v;f.loaded={bytes:l,duration:b},f.realBitrate=Math.round(8*l/b)}if(u.bitrateTest){var h={stats:x,frag:u,part:d,id:u.type};this.onFragBuffered(k.Events.FRAG_BUFFERED,h),u.bitrateTest=!1}}},A.onFragBuffered=function(c,o){var u=o.frag,d=o.part,x=d?d.stats:u.stats;if(x.aborted)return;if(u.type!==O.PlaylistLevelType.MAIN||u.sn==="initSegment")return;var v=x.parsing.end-x.loading.start;this.bwEstimator.sample(v,x.loaded),x.bwEstimate=this.bwEstimator.getEstimate(),u.bitrateTest?this.bitrateTestDelay=v/1e3:this.bitrateTestDelay=0},A.onError=function(c,o){switch(o.details){case F.ErrorDetails.FRAG_LOAD_ERROR:case F.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},A.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},A.getNextABRAutoLevel=function(){var c=this.fragCurrent,o=this.partCurrent,u=this.hls,d=u.maxAutoLevel,x=u.config,v=u.minAutoLevel,f=u.media,l=o?o.duration:c?c.duration:0,b=f?f.currentTime:0,h=f&&f.playbackRate!==0?Math.abs(f.playbackRate):1,p=this.bwEstimator?this.bwEstimator.getEstimate():x.abrEwmaDefaultEstimate,s=(W.BufferHelper.bufferInfo(f,b,x.maxBufferHole).end-b)/h,a=this.findBestLevel(p,v,d,s,x.abrBandWidthFactor,x.abrBandWidthUpFactor);if(a>=0)return a;D.logger.trace((s?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var g=l?Math.min(l,x.maxStarvationDelay):x.maxStarvationDelay,m=x.abrBandWidthFactor,y=x.abrBandWidthUpFactor;if(!s){var M=this.bitrateTestDelay;if(M){var H=l?Math.min(l,x.maxLoadingDelay):x.maxLoadingDelay;g=H-M,D.logger.trace("bitrate test took "+Math.round(1e3*M)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*g)+" ms"),m=y=1}}return a=this.findBestLevel(p,v,d,s+g,m,y),Math.max(a,0)},A.findBestLevel=function(c,o,u,d,x,v){for(var f,l=this.fragCurrent,b=this.partCurrent,h=this.lastLoadedFragLevel,p=this.hls.levels,s=p[h],a=!!(s!=null&&(f=s.details)!==null&&f!==void 0&&f.live),g=s==null?void 0:s.codecSet,m=b?b.duration:l?l.duration:0,y=u;y>=o;y--){var M=p[y];if(!M||g&&M.codecSet!==g)continue;var H=M.details,V=(b?H==null?void 0:H.partTarget:H==null?void 0:H.averagetargetduration)||m,te=void 0;y<=h?te=x*c:te=v*c;var G=p[y].maxBitrate,j=G*V/te;if(D.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+y+"/"+Math.round(te)+"/"+G+"/"+V+"/"+d+"/"+j),te>G&&(!j||a&&!this.bitrateTestDelay||j<d))return y}return-1},w(_,[{key:"nextAutoLevel",get:function(){var c=this._nextAutoLevel,o=this.bwEstimator;if(c!==-1&&(!o||!o.canEstimate()))return c;var u=this.getNextABRAutoLevel();return c!==-1&&(u=Math.min(c,u)),u},set:function(c){this._nextAutoLevel=c}}]),_}();Y.default=P},"./src/controller/audio-stream-controller.ts":function(he,Y,L){"use strict";L.r(Y);var X=L("./src/polyfills/number.ts"),I=L("./src/controller/base-stream-controller.ts"),k=L("./src/events.ts"),W=L("./src/utils/buffer-helper.ts"),F=L("./src/controller/fragment-tracker.ts"),O=L("./src/types/level.ts"),D=L("./src/types/loader.ts"),E=L("./src/loader/fragment.ts"),w=L("./src/demux/chunk-cache.ts"),P=L("./src/demux/transmuxer-interface.ts"),_=L("./src/types/transmuxer.ts"),A=L("./src/controller/fragment-finders.ts"),C=L("./src/utils/discontinuities.ts"),c=L("./src/errors.ts"),o=L("./src/utils/logger.ts");function u(){return u=Object.assign||function(l){for(var b=1;b<arguments.length;b++){var h=arguments[b];for(var p in h)Object.prototype.hasOwnProperty.call(h,p)&&(l[p]=h[p])}return l},u.apply(this,arguments)}function d(l,b){l.prototype=Object.create(b.prototype),l.prototype.constructor=l,x(l,b)}function x(l,b){return x=Object.setPrototypeOf||function(p,s){return p.__proto__=s,p},x(l,b)}var v=100,f=function(l){d(b,l);function b(p,s){var a;return a=l.call(this,p,s,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var h=b.prototype;return h.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},h._registerListeners=function(){var s=this.hls;s.on(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.on(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(k.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.on(k.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),s.on(k.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),s.on(k.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.on(k.Events.ERROR,this.onError,this),s.on(k.Events.BUFFER_RESET,this.onBufferReset,this),s.on(k.Events.BUFFER_CREATED,this.onBufferCreated,this),s.on(k.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),s.on(k.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(k.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h._unregisterListeners=function(){var s=this.hls;s.off(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.off(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(k.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.off(k.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),s.off(k.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),s.off(k.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.off(k.Events.ERROR,this.onError,this),s.off(k.Events.BUFFER_RESET,this.onBufferReset,this),s.off(k.Events.BUFFER_CREATED,this.onBufferCreated,this),s.off(k.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),s.off(k.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.off(k.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h.onInitPtsFound=function(s,a){var g=a.frag,m=a.id,y=a.initPTS;if(m==="main"){var M=g.cc;this.initPTS[g.cc]=y,this.log("InitPTS for cc: "+M+" found from main: "+y),this.videoTrackCC=M,this.state===I.State.WAITING_INIT_PTS&&this.tick()}},h.startLoad=function(s){if(!this.levels){this.startPosition=s,this.state=I.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(v),this.fragLoadError=0,a>0&&s===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=I.State.IDLE):(this.loadedmetadata=!1,this.state=I.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=s,this.tick()},h.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_TRACK:{var s,a=this.levels,g=this.trackId,m=a==null||((s=a[g])===null||s===void 0)?void 0:s.details;if(m){if(this.waitForCdnTuneIn(m))break;this.state=I.State.WAITING_INIT_PTS}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var y,M=performance.now(),H=this.retryDate;(!H||M>=H||(y=this.media)!==null&&y!==void 0&&y.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=I.State.IDLE);break}case I.State.WAITING_INIT_PTS:{var V=this.waitingData;if(V){var te=V.frag,G=V.part,j=V.cache,ie=V.complete;if(this.initPTS[te.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.FRAG_LOADING;var pe=j.flush(),ge={frag:te,part:G,payload:pe,networkDetails:null};this._handleFragmentLoadProgress(ge),ie&&l.prototype._handleFragmentLoadComplete.call(this,ge)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+te.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var be=this.getLoadPosition(),Ne=W.BufferHelper.bufferInfo(this.mediaBuffer,be,this.config.maxBufferHole),Se=Object(A.fragmentWithinToleranceTest)(Ne.end,this.config.maxFragLookUpTolerance,te);Se<0&&(o.logger.log("Waiting fragment cc ("+te.cc+") @ "+te.start+" cancelled because another fragment at "+Ne.end+" is needed"),this.clearWaitingFragment())}}else this.state=I.State.IDLE}}this.onTickEnd()},h.clearWaitingFragment=function(){var s=this.waitingData;s&&(this.fragmentTracker.removeFragment(s.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.IDLE)},h.onTickEnd=function(){var s=this.media;if(!s||!s.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:s,g=a.buffered;!this.loadedmetadata&&g.length&&(this.loadedmetadata=!0),this.lastCurrentTime=s.currentTime},h.doTickIdle=function(){var s,a,g=this.hls,m=this.levels,y=this.media,M=this.trackId,H=g.config;if(!m||!m[M])return;if(!y&&(this.startFragRequested||!H.startFragPrefetch))return;var V=m[M],te=V.details;if(!te||te.live&&this.levelLastLoaded!==M||this.waitForCdnTuneIn(te)){this.state=I.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,E.ElementaryStreamTypes.AUDIO,D.PlaylistLevelType.AUDIO));var G=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,D.PlaylistLevelType.AUDIO);if(G===null)return;var j=G.len,ie=this.getMaxBufferLength(),pe=this.audioSwitch;if(j>=ie&&!pe)return;if(!pe&&this._streamEnded(G,te)){g.trigger(k.Events.BUFFER_EOS,{type:"audio"}),this.state=I.State.ENDED;return}var ge=te.fragments,be=ge[0].start,Ne=G.end;if(pe){var Se=this.getLoadPosition();Ne=Se,te.PTSKnown&&Se<be&&((G.end>be||G.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),y.currentTime=be+.05))}var Me=this.getNextFragment(Ne,te);if(!Me){this.bufferFlushed=!0;return}((s=Me.decryptdata)===null||s===void 0?void 0:s.keyFormat)==="identity"&&!((a=Me.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(Me,te):this.loadFragment(Me,te,Ne)},h.getMaxBufferLength=function(){var s=l.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,D.PlaylistLevelType.MAIN);return a===null?s:Math.max(s,a.len)},h.onMediaDetaching=function(){this.videoBuffer=null,l.prototype.onMediaDetaching.call(this)},h.onAudioTracksUpdated=function(s,a){var g=a.audioTracks;this.resetTransmuxer(),this.levels=g.map(function(m){return new O.Level(m)})},h.onAudioTrackSwitching=function(s,a){var g=!!a.url;this.trackId=a.id;var m=this.fragCurrent;m!=null&&m.loader&&m.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),g?this.setInterval(v):this.resetTransmuxer(),g?(this.audioSwitch=!0,this.state=I.State.IDLE):this.state=I.State.STOPPED,this.tick()},h.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},h.onLevelLoaded=function(s,a){this.mainDetails=a.details},h.onAudioTrackLoaded=function(s,a){var g,m=this.levels,y=a.details,M=a.id;if(!m){this.warn("Audio tracks were reset while loading level "+M);return}this.log("Track "+M+" loaded ["+y.startSN+","+y.endSN+"],duration:"+y.totalduration);var H=m[M],V=0;if(y.live||(g=H.details)!==null&&g!==void 0&&g.live){var te=this.mainDetails;if(y.fragments[0]||(y.deltaUpdateFailed=!0),y.deltaUpdateFailed||!te)return;!H.details&&y.hasProgramDateTime&&te.hasProgramDateTime?(Object(C.alignMediaPlaylistByPDT)(y,te),V=y.fragments[0].start):V=this.alignPlaylists(y,H.details)}H.details=y,this.levelLastLoaded=M,!this.startFragRequested&&(this.mainDetails||!y.live)&&this.setStartPosition(H.details,V),this.state===I.State.WAITING_TRACK&&!this.waitForCdnTuneIn(y)&&(this.state=I.State.IDLE),this.tick()},h._handleFragmentLoadProgress=function(s){var a,g=s.frag,m=s.part,y=s.payload,M=this.config,H=this.trackId,V=this.levels;if(!V){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+g.sn+" of level "+g.level+" will not be buffered");return}var te=V[H];console.assert(te,"Audio track is defined on fragment load progress");var G=te.details;console.assert(G,"Audio track details are defined on fragment load progress");var j=M.defaultAudioCodec||te.audioCodec||"mp4a.40.2",ie=this.transmuxer;ie||(ie=this.transmuxer=new P.default(this.hls,D.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var pe=this.initPTS[g.cc],ge=(a=g.initSegment)===null||a===void 0?void 0:a.data;if(pe!==void 0){var be=!1,Ne=m?m.index:-1,Se=Ne!==-1,Me=new _.ChunkMetadata(g.level,g.sn,g.stats.chunkCount,y.byteLength,Ne,Se);ie.push(y,ge,j,"",g,m,G.totalduration,be,Me,pe)}else{o.logger.log("Unknown video PTS for cc "+g.cc+", waiting for video PTS before demuxing audio frag "+g.sn+" of ["+G.startSN+" ,"+G.endSN+"],track "+H);var Le=this.waitingData=this.waitingData||{frag:g,part:m,cache:new w.default,complete:!1},we=Le.cache;we.push(new Uint8Array(y)),this.waitingVideoCC=this.videoTrackCC,this.state=I.State.WAITING_INIT_PTS}},h._handleFragmentLoadComplete=function(s){if(this.waitingData){this.waitingData.complete=!0;return}l.prototype._handleFragmentLoadComplete.call(this,s)},h.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},h.onBufferCreated=function(s,a){var g=a.tracks.audio;g&&(this.mediaBuffer=g.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},h.onFragBuffered=function(s,a){var g=a.frag,m=a.part;if(g.type!==D.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(g)){this.warn("Fragment "+g.sn+(m?" p: "+m.index:"")+" of level "+g.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}g.sn!=="initSegment"&&(this.fragPrevious=g,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(k.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(g,m)},h.onError=function(s,a){switch(a.details){case c.ErrorDetails.FRAG_LOAD_ERROR:case c.ErrorDetails.FRAG_LOAD_TIMEOUT:case c.ErrorDetails.KEY_LOAD_ERROR:case c.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(D.PlaylistLevelType.AUDIO,a);break;case c.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case c.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==I.State.ERROR&&this.state!==I.State.STOPPED&&(this.state=a.fatal?I.State.ERROR:I.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case c.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var g=!0,m=this.getFwdBufferInfo(this.mediaBuffer,D.PlaylistLevelType.AUDIO);m&&m.len>.5&&(g=!this.reduceMaxBufferLength(m.len)),g&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,l.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},h.onBufferFlushed=function(s,a){var g=a.type;g===E.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},h._handleTransmuxComplete=function(s){var a,g="audio",m=this.hls,y=s.remuxResult,M=s.chunkMeta,H=this.getCurrentContext(M);if(!H){this.warn("The loading context changed while buffering fragment "+M.sn+" of level "+M.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(M.level);return}var V=H.frag,te=H.part,G=y.audio,j=y.text,ie=y.id3,pe=y.initSegment;if(this.fragContextChanged(V))return;if(this.state=I.State.PARSING,this.audioSwitch&&G&&this.completeAudioSwitch(),pe!=null&&pe.tracks&&(this._bufferInitSegment(pe.tracks,V,M),m.trigger(k.Events.FRAG_PARSING_INIT_SEGMENT,{frag:V,id:g,tracks:pe.tracks})),G){var ge=G.startPTS,be=G.endPTS,Ne=G.startDTS,Se=G.endDTS;te&&(te.elementaryStreams[E.ElementaryStreamTypes.AUDIO]={startPTS:ge,endPTS:be,startDTS:Ne,endDTS:Se}),V.setElementaryStreamInfo(E.ElementaryStreamTypes.AUDIO,ge,be,Ne,Se),this.bufferFragmentData(G,V,te,M)}if(ie!=null&&(a=ie.samples)!==null&&a!==void 0&&a.length){var Me=u({frag:V,id:g},ie);m.trigger(k.Events.FRAG_PARSING_METADATA,Me)}if(j){var Le=u({frag:V,id:g},j);m.trigger(k.Events.FRAG_PARSING_USERDATA,Le)}},h._bufferInitSegment=function(s,a,g){if(this.state!==I.State.PARSING)return;s.video&&delete s.video;var m=s.audio;if(!m)return;m.levelCodec=m.codec,m.id="audio",this.log("Init audio buffer, container:"+m.container+", codecs[parsed]=["+m.codec+"]"),this.hls.trigger(k.Events.BUFFER_CODECS,s);var y=m.initSegment;if(y!=null&&y.byteLength){var M={type:"audio",frag:a,part:null,chunkMeta:g,parent:a.type,data:y};this.hls.trigger(k.Events.BUFFER_APPENDING,M)}this.tick()},h.loadFragment=function(s,a,g){var m=this.fragmentTracker.getState(s);this.fragCurrent=s,(this.audioSwitch||m===F.FragmentState.NOT_LOADED||m===F.FragmentState.PARTIAL)&&(s.sn==="initSegment"?this._loadInitSegment(s):a.live&&!Object(X.isFiniteNumber)(this.initPTS[s.cc])?(this.log("Waiting for video PTS in continuity counter "+s.cc+" of live stream before loading audio fragment "+s.sn+" of level "+this.trackId),this.state=I.State.WAITING_INIT_PTS):(this.startFragRequested=!0,l.prototype.loadFragment.call(this,s,a,g)))},h.completeAudioSwitch=function(){var s=this.hls,a=this.media,g=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),l.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,s.trigger(k.Events.AUDIO_TRACK_SWITCHED,{id:g})},b}(I.default);Y.default=f},"./src/controller/audio-track-controller.ts":function(he,Y,L){"use strict";L.r(Y);var X=L("./src/events.ts"),I=L("./src/errors.ts"),k=L("./src/controller/base-playlist-controller.ts"),W=L("./src/types/loader.ts");function F(P,_){for(var A=0;A<_.length;A++){var C=_[A];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(P,C.key,C)}}function O(P,_,A){return _&&F(P.prototype,_),A&&F(P,A),P}function D(P,_){P.prototype=Object.create(_.prototype),P.prototype.constructor=P,E(P,_)}function E(P,_){return E=Object.setPrototypeOf||function(C,c){return C.__proto__=c,C},E(P,_)}var w=function(P){D(_,P);function _(C){var c;return c=P.call(this,C,"[audio-track-controller]")||this,c.tracks=[],c.groupId=null,c.tracksInGroup=[],c.trackId=-1,c.trackName="",c.selectDefaultTrack=!0,c.registerListeners(),c}var A=_.prototype;return A.registerListeners=function(){var c=this.hls;c.on(X.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(X.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(X.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(X.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),c.on(X.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),c.on(X.Events.ERROR,this.onError,this)},A.unregisterListeners=function(){var c=this.hls;c.off(X.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(X.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(X.Events.LEVEL_LOADING,this.onLevelLoading,this),c.off(X.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),c.off(X.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),c.off(X.Events.ERROR,this.onError,this)},A.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,P.prototype.destroy.call(this)},A.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},A.onManifestParsed=function(c,o){this.tracks=o.audioTracks||[]},A.onAudioTrackLoaded=function(c,o){var u=o.id,d=o.details,x=this.tracksInGroup[u];if(!x){this.warn("Invalid audio track id "+u);return}var v=x.details;x.details=o.details,this.log("audioTrack "+u+" loaded ["+d.startSN+"-"+d.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,o,v))},A.onLevelLoading=function(c,o){this.switchLevel(o.level)},A.onLevelSwitching=function(c,o){this.switchLevel(o.level)},A.switchLevel=function(c){var o=this.hls.levels[c];if(!(o!=null&&o.audioGroupIds))return;var u=o.audioGroupIds[o.urlId];if(this.groupId!==u){this.groupId=u;var d=this.tracks.filter(function(v){return!u||v.groupId===u});this.selectDefaultTrack&&!d.some(function(v){return v.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=d;var x={audioTracks:d};this.log("Updating audio tracks, "+d.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(X.Events.AUDIO_TRACKS_UPDATED,x),this.selectInitialTrack()}},A.onError=function(c,o){if(P.prototype.onError.call(this,c,o),o.fatal||!o.context)return;o.context.type===W.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},A.setAudioTrack=function(c){var o=this.tracksInGroup;if(c<0||c>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var u=o[this.trackId];this.log("Now switching to audio-track index "+c);var d=o[c],x=d.id,v=d.groupId,f=v===void 0?"":v,l=d.name,b=d.type,h=d.url;if(this.trackId=c,this.trackName=l,this.selectDefaultTrack=!1,this.hls.trigger(X.Events.AUDIO_TRACK_SWITCHING,{id:x,groupId:f,name:l,type:b,url:h}),d.details&&!d.details.live)return;var p=this.switchParams(d.url,u==null?void 0:u.details);this.loadPlaylist(p)},A.selectInitialTrack=function(){var c=this.tracksInGroup;console.assert(c.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,u=this.findTrackId(o)||this.findTrackId();u!==-1?this.setAudioTrack(u):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(X.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},A.findTrackId=function(c){for(var o=this.tracksInGroup,u=0;u<o.length;u++){var d=o[u];if((!this.selectDefaultTrack||d.default)&&(!c||c===d.name))return d.id}return-1},A.loadPlaylist=function(c){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var u=o.id,d=o.groupId,x=o.url;if(c)try{x=c.addDirectives(x)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("loading audio-track playlist for id: "+u),this.clearTimer(),this.hls.trigger(X.Events.AUDIO_TRACK_LOADING,{url:x,id:u,groupId:d,deliveryDirectives:c||null})}},O(_,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(c){this.selectDefaultTrack=!1,this.setAudioTrack(c)}}]),_}(k.default);Y.default=w},"./src/controller/base-playlist-controller.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return O});var X=L("./src/polyfills/number.ts"),I=L("./src/types/level.ts"),k=L("./src/controller/level-helper.ts"),W=L("./src/utils/logger.ts"),F=L("./src/errors.ts"),O=function(){function D(w,P){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=W.logger.log.bind(W.logger,P+":"),this.warn=W.logger.warn.bind(W.logger,P+":"),this.hls=w}var E=D.prototype;return E.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},E.onError=function(P,_){_.fatal&&_.type===F.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(P,_){var A=_==null?void 0:_.renditionReports;if(A)for(var C=0;C<A.length;C++){var c=A[C],o=""+c.URI;if(o===P.substr(-o.length)){var u=parseInt(c["LAST-MSN"]),d=parseInt(c["LAST-PART"]);if(_&&this.hls.config.lowLatencyMode){var x=Math.min(_.age-_.partTarget,_.targetduration);d!==void 0&&x>_.partTarget&&(d+=1)}if(Object(X.isFiniteNumber)(u))return new I.HlsUrlParameters(u,Object(X.isFiniteNumber)(d)?d:void 0,I.HlsSkip.No)}}},E.loadPlaylist=function(P){},E.shouldLoadTrack=function(P){return this.canLoad&&P&&!!P.url&&(!P.details||P.details.live)},E.playlistLoaded=function(P,_,A){var C=this,c=_.details,o=_.stats,u=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(c.advancedDateTime=Date.now()-u,c.live||A!=null&&A.live){if(c.reloaded(A),A&&this.log("live playlist "+P+" "+(c.advanced?"REFRESHED "+c.lastPartSn+"-"+c.lastPartIndex:"MISSED")),A&&c.fragments.length>0&&Object(k.mergeDetails)(A,c),!this.canLoad||!c.live)return;var d,x=void 0,v=void 0;if(c.canBlockReload&&c.endSN&&c.advanced){var f=this.hls.config.lowLatencyMode,l=c.lastPartSn,b=c.endSN,h=c.lastPartIndex,p=h!==-1,s=l===b,a=f?0:h;p?(x=s?b+1:l,v=s?a:h+1):x=b+1;var g=c.age,m=g+c.ageHeader,y=Math.min(m-c.partTarget,c.targetduration*1.5);if(y>0){if(A&&y>A.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+A.tuneInGoal+" to: "+y+" with playlist age: "+c.age),y=0;else{var M=Math.floor(y/c.targetduration);if(x+=M,v!==void 0){var H=Math.round(y%c.targetduration/c.partTarget);v+=H}this.log("CDN Tune-in age: "+c.ageHeader+"s last advanced "+g.toFixed(2)+"s goal: "+y+" skip sn "+M+" to part "+v)}c.tuneInGoal=y}if(d=this.getDeliveryDirectives(c,_.deliveryDirectives,x,v),f||!s){this.loadPlaylist(d);return}}else d=this.getDeliveryDirectives(c,_.deliveryDirectives,x,v);var V=Object(k.computeReloadInterval)(c,o);x!==void 0&&c.canBlockReload&&(V-=c.partTarget||1),this.log("reload live playlist "+P+" in "+Math.round(V)+" ms"),this.timer=self.setTimeout(function(){return C.loadPlaylist(d)},V)}else this.clearTimer()},E.getDeliveryDirectives=function(P,_,A,C){var c=Object(I.getSkipValue)(P,A);return _!=null&&_.skip&&P.deltaUpdateFailed&&(A=_.msn,C=_.part,c=I.HlsSkip.No),new I.HlsUrlParameters(A,C,c)},E.retryLoadingOrFail=function(P){var _=this,A=this.hls.config,C=this.retryCount<A.levelLoadingMaxRetry;if(C){var c;if(this.retryCount++,P.details.indexOf("LoadTimeOut")>-1&&(c=P.context)!==null&&c!==void 0&&c.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+P.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*A.levelLoadingRetryDelay,A.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return _.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+P.details+'"')}}else this.warn('cannot recover from error "'+P.details+'"'),this.clearTimer(),P.fatal=!0;return C},D}()},"./src/controller/base-stream-controller.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"State",function(){return b}),L.d(Y,"default",function(){return h});var X=L("./src/polyfills/number.ts"),I=L("./src/task-loop.ts"),k=L("./src/controller/fragment-tracker.ts"),W=L("./src/utils/buffer-helper.ts"),F=L("./src/utils/logger.ts"),O=L("./src/events.ts"),D=L("./src/errors.ts"),E=L("./src/types/transmuxer.ts"),w=L("./src/utils/mp4-tools.ts"),P=L("./src/utils/discontinuities.ts"),_=L("./src/controller/fragment-finders.ts"),A=L("./src/controller/level-helper.ts"),C=L("./src/loader/fragment-loader.ts"),c=L("./src/crypt/decrypter.ts"),o=L("./src/utils/time-ranges.ts"),u=L("./src/types/loader.ts");function d(p,s){for(var a=0;a<s.length;a++){var g=s[a];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(p,g.key,g)}}function x(p,s,a){return s&&d(p.prototype,s),a&&d(p,a),p}function v(p){if(p===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p}function f(p,s){p.prototype=Object.create(s.prototype),p.prototype.constructor=p,l(p,s)}function l(p,s){return l=Object.setPrototypeOf||function(g,m){return g.__proto__=m,g},l(p,s)}var b={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},h=function(p){f(s,p);function s(g,m,y){var M;return M=p.call(this)||this,M.hls=void 0,M.fragPrevious=null,M.fragCurrent=null,M.fragmentTracker=void 0,M.transmuxer=null,M._state=b.STOPPED,M.media=void 0,M.mediaBuffer=void 0,M.config=void 0,M.bitrateTest=!1,M.lastCurrentTime=0,M.nextLoadPosition=0,M.startPosition=0,M.loadedmetadata=!1,M.fragLoadError=0,M.retryDate=0,M.levels=null,M.fragmentLoader=void 0,M.levelLastLoaded=null,M.startFragRequested=!1,M.decrypter=void 0,M.initPTS=[],M.onvseeking=null,M.onvended=null,M.logPrefix="",M.log=void 0,M.warn=void 0,M.logPrefix=y,M.log=F.logger.log.bind(F.logger,y+":"),M.warn=F.logger.warn.bind(F.logger,y+":"),M.hls=g,M.fragmentLoader=new C.default(g.config),M.fragmentTracker=m,M.config=g.config,M.decrypter=new c.default(g,g.config),g.on(O.Events.KEY_LOADED,M.onKeyLoaded,v(M)),M}var a=s.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(m){},a.stopLoad=function(){this.fragmentLoader.abort();var m=this.fragCurrent;m&&this.fragmentTracker.removeFragment(m),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=b.STOPPED},a._streamEnded=function(m,y){var M=this.fragCurrent,H=this.fragmentTracker;if(!y.live&&M&&M.sn===y.endSN&&!m.nextStart){var V=H.getState(M);return V===k.FragmentState.PARTIAL||V===k.FragmentState.OK}return!1},a.onMediaAttached=function(m,y){var M=this.media=this.mediaBuffer=y.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),M.addEventListener("seeking",this.onvseeking),M.addEventListener("ended",this.onvended);var H=this.config;this.levels&&H.autoStartLoad&&this.state===b.STOPPED&&this.startLoad(H.startPosition)},a.onMediaDetaching=function(){var m=this.media;m!=null&&m.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),m&&(m.removeEventListener("seeking",this.onvseeking),m.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var m=this.config,y=this.fragCurrent,M=this.media,H=this.mediaBuffer,V=this.state,te=M?M.currentTime:0,G=W.BufferHelper.bufferInfo(H||M,te,m.maxBufferHole);if(this.log("media seeking to "+(Object(X.isFiniteNumber)(te)?te.toFixed(3):te)+", state: "+V),V===b.ENDED)this.resetLoadingState();else if(y&&!G.len){var j=m.maxFragLookUpTolerance,ie=y.start-j,pe=y.start+y.duration+j,ge=te>pe;(te<ie||ge)&&(ge&&y.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),y.loader.abort()),this.resetLoadingState())}M&&(this.lastCurrentTime=te),!this.loadedmetadata&&!G.len&&(this.nextLoadPosition=this.startPosition=te),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(m,y){if(this.state!==b.KEY_LOADING||y.frag!==this.fragCurrent||!this.levels)return;this.state=b.IDLE;var M=this.levels[y.frag.level].details;M&&this.loadFragment(y.frag,M,y.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),p.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=b.STOPPED,this.hls.off(O.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,p.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(m,y){this.log("Loading key for "+m.sn+" of ["+y.startSN+"-"+y.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level),this.state=b.KEY_LOADING,this.fragCurrent=m,this.hls.trigger(O.Events.KEY_LOADING,{frag:m})},a.loadFragment=function(m,y,M){this._loadFragForPlayback(m,y,M)},a._loadFragForPlayback=function(m,y,M){var H=this,V=function(G){if(H.fragContextChanged(m)){H.warn("Fragment "+m.sn+(G.part?" p: "+G.part.index:"")+" of level "+m.level+" was dropped during download."),H.fragmentTracker.removeFragment(m);return}m.stats.chunkCount++,H._handleFragmentLoadProgress(G)};this._doFragLoad(m,y,M,V).then(function(te){if(!te)return;H.fragLoadError=0;var G=H.state;if(H.fragContextChanged(m)){(G===b.FRAG_LOADING||G===b.BACKTRACKING||!H.fragCurrent&&G===b.PARSING)&&(H.fragmentTracker.removeFragment(m),H.state=b.IDLE);return}if("payload"in te&&(H.log("Loaded fragment "+m.sn+" of level "+m.level),H.hls.trigger(O.Events.FRAG_LOADED,te),H.state===b.BACKTRACKING)){H.fragmentTracker.backtrack(m,te),H.resetFragmentLoading(m);return}H._handleFragmentLoadComplete(te)}).catch(function(te){H.warn(te),H.resetFragmentLoading(m)})},a.flushMainBuffer=function(m,y,M){if(M===void 0&&(M=null),!(m-y))return;var H={startOffset:m,endOffset:y,type:M};this.fragLoadError=0,this.hls.trigger(O.Events.BUFFER_FLUSHING,H)},a._loadInitSegment=function(m){var y=this;this._doFragLoad(m).then(function(M){if(!M||y.fragContextChanged(m)||!y.levels)throw new Error("init load aborted");return M}).then(function(M){var H=y.hls,V=M.payload,te=m.decryptdata;if(V&&V.byteLength>0&&te&&te.key&&te.iv&&te.method==="AES-128"){var G=self.performance.now();return y.decrypter.webCryptoDecrypt(new Uint8Array(V),te.key.buffer,te.iv.buffer).then(function(j){var ie=self.performance.now();return H.trigger(O.Events.FRAG_DECRYPTED,{frag:m,payload:j,stats:{tstart:G,tdecrypt:ie}}),M.payload=j,M})}return M}).then(function(M){var H=y.fragCurrent,V=y.hls,te=y.levels;if(!te)throw new Error("init load aborted, missing levels");var G=te[m.level].details;console.assert(G,"Level details are defined when init segment is loaded");var j=m.stats;y.state=b.IDLE,y.fragLoadError=0,m.data=new Uint8Array(M.payload),j.parsing.start=j.buffering.start=self.performance.now(),j.parsing.end=j.buffering.end=self.performance.now(),M.frag===H&&V.trigger(O.Events.FRAG_BUFFERED,{stats:j,frag:H,part:null,id:m.type}),y.tick()}).catch(function(M){y.warn(M),y.resetFragmentLoading(m)})},a.fragContextChanged=function(m){var y=this.fragCurrent;return!m||!y||m.level!==y.level||m.sn!==y.sn||m.urlId!==y.urlId},a.fragBufferedComplete=function(m,y){var M=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+m.type+" sn: "+m.sn+(y?" part: "+y.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level+" "+o.default.toString(W.BufferHelper.getBuffered(M))),this.state=b.IDLE,this.tick()},a._handleFragmentLoadComplete=function(m){var y=this.transmuxer;if(!y)return;var M=m.frag,H=m.part,V=m.partsLoaded,te=!V||V.length===0||V.some(function(j){return!j}),G=new E.ChunkMetadata(M.level,M.sn,M.stats.chunkCount+1,0,H?H.index:-1,!te);y.flush(G)},a._handleFragmentLoadProgress=function(m){},a._doFragLoad=function(m,y,M,H){var V=this;if(M===void 0&&(M=null),!this.levels)throw new Error("frag load aborted, missing levels");if(M=Math.max(m.start,M||0),this.config.lowLatencyMode&&y){var te=y.partList;if(te&&H){M>m.end&&y.fragmentHint&&(m=y.fragmentHint);var G=this.getNextPart(te,m,M);if(G>-1){var j=te[G];return this.log("Loading part sn: "+m.sn+" p: "+j.index+" cc: "+m.cc+" of playlist ["+y.startSN+"-"+y.endSN+"] parts [0-"+G+"-"+(te.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(M.toFixed(3))),this.nextLoadPosition=j.start+j.duration,this.state=b.FRAG_LOADING,this.hls.trigger(O.Events.FRAG_LOADING,{frag:m,part:te[G],targetBufferTime:M}),this.doFragPartsLoad(m,te,G,H).catch(function(ie){return V.handleFragLoadError(ie)})}else if(!m.url||this.loadedEndOfParts(te,M))return Promise.resolve(null)}}return this.log("Loading fragment "+m.sn+" cc: "+m.cc+" "+(y?"of ["+y.startSN+"-"+y.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(M.toFixed(3))),Object(X.isFiniteNumber)(m.sn)&&!this.bitrateTest&&(this.nextLoadPosition=m.start+m.duration),this.state=b.FRAG_LOADING,this.hls.trigger(O.Events.FRAG_LOADING,{frag:m,targetBufferTime:M}),this.fragmentLoader.load(m,H).catch(function(ie){return V.handleFragLoadError(ie)})},a.doFragPartsLoad=function(m,y,M,H){var V=this;return new Promise(function(te,G){var j=[],ie=function pe(ge){var be=y[ge];V.fragmentLoader.loadPart(m,be,H).then(function(Ne){j[be.index]=Ne;var Se=Ne.part;V.hls.trigger(O.Events.FRAG_LOADED,Ne);var Me=y[ge+1];if(Me&&Me.fragment===m)pe(ge+1);else return te({frag:m,part:Se,partsLoaded:j})}).catch(G)};ie(M)})},a.handleFragLoadError=function(m){var y=m.data;return y&&y.details===D.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(y.frag,y.part):this.hls.trigger(O.Events.ERROR,y),null},a._handleTransmuxerFlush=function(m){var y=this.getCurrentContext(m);if(!y||this.state!==b.PARSING){this.fragCurrent||(this.state=b.IDLE);return}var M=y.frag,H=y.part,V=y.level,te=self.performance.now();M.stats.parsing.end=te,H&&(H.stats.parsing.end=te),this.updateLevelTiming(M,H,V,m.partial)},a.getCurrentContext=function(m){var y=this.levels,M=m.level,H=m.sn,V=m.part;if(!y||!y[M])return this.warn("Levels object was unset while buffering fragment "+H+" of level "+M+". The current chunk will not be buffered."),null;var te=y[M],G=V>-1?Object(A.getPartWith)(te,H,V):null,j=G?G.fragment:Object(A.getFragmentWithSN)(te,H,this.fragCurrent);return j?{frag:j,part:G,level:te}:null},a.bufferFragmentData=function(m,y,M,H){if(!m||this.state!==b.PARSING)return;var V=m.data1,te=m.data2,G=V;if(V&&te&&(G=Object(w.appendUint8Array)(V,te)),!G||!G.length)return;var j={type:m.type,frag:y,part:M,chunkMeta:H,parent:y.type,data:G};this.hls.trigger(O.Events.BUFFER_APPENDING,j),m.dropped&&m.independent&&!M&&this.flushBufferGap(y)},a.flushBufferGap=function(m){var y=this.media;if(!y)return;if(!W.BufferHelper.isBuffered(y,y.currentTime)){this.flushMainBuffer(0,m.start);return}var M=y.currentTime,H=W.BufferHelper.bufferInfo(y,M,0),V=m.duration,te=Math.min(this.config.maxFragLookUpTolerance*2,V*.25),G=Math.max(Math.min(m.start-te,H.end-te),M+te);m.start-G>te&&this.flushMainBuffer(G,m.start)},a.getFwdBufferInfo=function(m,y){var M=this.config,H=this.getLoadPosition();if(!Object(X.isFiniteNumber)(H))return null;var V=W.BufferHelper.bufferInfo(m,H,M.maxBufferHole);if(V.len===0&&V.nextStart!==void 0){var te=this.fragmentTracker.getBufferedFrag(H,y);if(te&&V.nextStart<te.end)return W.BufferHelper.bufferInfo(m,H,Math.max(V.nextStart,M.maxBufferHole))}return V},a.getMaxBufferLength=function(m){var y=this.config,M;return m?M=Math.max(8*y.maxBufferSize/m,y.maxBufferLength):M=y.maxBufferLength,Math.min(M,y.maxMaxBufferLength)},a.reduceMaxBufferLength=function(m){var y=this.config,M=m||y.maxBufferLength;return y.maxMaxBufferLength>=M?(y.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+y.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(m,y){var M,H,V=y.fragments,te=V.length;if(!te)return null;var G=this.config,j=V[0].start,ie;if(y.live){var pe=G.initialLiveManifestSize;if(te<pe)return this.warn("Not enough fragments to start playback (have: "+te+", need: "+pe+")"),null;!y.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(ie=this.getInitialLiveFragment(y,V),this.startPosition=ie?this.hls.liveSyncPosition||ie.start:m)}else m<=j&&(ie=V[0]);if(!ie){var ge=G.lowLatencyMode?y.partEnd:y.fragmentEnd;ie=this.getFragmentAtPosition(m,ge,y)}return(M=ie)!==null&&M!==void 0&&M.initSegment&&!((H=ie)!==null&&H!==void 0&&H.initSegment.data)&&!this.bitrateTest&&(ie=ie.initSegment),ie},a.getNextPart=function(m,y,M){for(var H=-1,V=!1,te=!0,G=0,j=m.length;G<j;G++){var ie=m[G];if(te=te&&!ie.independent,H>-1&&M<ie.start)break;var pe=ie.loaded;!pe&&(V||ie.independent||te)&&ie.fragment===y&&(H=G),V=pe}return H},a.loadedEndOfParts=function(m,y){var M=m[m.length-1];return M&&y>M.start&&M.loaded},a.getInitialLiveFragment=function(m,y){var M=this.fragPrevious,H=null;if(M){if(m.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+M.programDateTime),H=Object(_.findFragmentByPDT)(y,M.endProgramDateTime,this.config.maxFragLookUpTolerance)),!H){var V=M.sn+1;if(V>=m.startSN&&V<=m.endSN){var te=y[V-m.startSN];M.cc===te.cc&&(H=te,this.log("Live playlist, switching playlist, load frag with next SN: "+H.sn))}H||(H=Object(_.findFragWithCC)(y,M.cc),H&&this.log("Live playlist, switching playlist, load frag with same CC: "+H.sn))}}else{var G=this.hls.liveSyncPosition;G!==null&&(H=this.getFragmentAtPosition(G,this.bitrateTest?m.fragmentEnd:m.edge,m))}return H},a.getFragmentAtPosition=function(m,y,M){var H=this.config,V=this.fragPrevious,te=M.fragments,G=M.endSN,j=M.fragmentHint,ie=H.maxFragLookUpTolerance,pe=!!(H.lowLatencyMode&&M.partList&&j);pe&&j&&!this.bitrateTest&&(te=te.concat(j),G=j.sn);var ge;if(m<y){var be=m>y-ie?0:ie;ge=Object(_.findFragmentByPTS)(V,te,m,be)}else ge=te[te.length-1];if(ge){var Ne=ge.sn-M.startSN,Se=V&&ge.level===V.level,Me=te[Ne+1],Le=this.fragmentTracker.getState(ge);if(Le===k.FragmentState.BACKTRACKED){ge=null;for(var we=Ne;te[we]&&this.fragmentTracker.getState(te[we])===k.FragmentState.BACKTRACKED;)V?ge=te[we--]:ge=te[--we];ge||(ge=Me)}else V&&ge.sn===V.sn&&!pe&&(Se&&(ge.sn<G&&this.fragmentTracker.getState(Me)!==k.FragmentState.OK?(this.log("SN "+ge.sn+" just loaded, load next one: "+Me.sn),ge=Me):ge=null))}return ge},a.synchronizeToLiveEdge=function(m){var y=this.config,M=this.media;if(!M)return;var H=this.hls.liveSyncPosition,V=M.currentTime,te=m.fragments[0].start,G=m.edge,j=V>=te-y.maxFragLookUpTolerance&&V<=G;if(H!==null&&M.duration>H&&(V<H||!j)){var ie=y.liveMaxLatencyDuration!==void 0?y.liveMaxLatencyDuration:y.liveMaxLatencyDurationCount*m.targetduration;(!j&&M.readyState<4||V<G-ie)&&(this.loadedmetadata||(this.nextLoadPosition=H),M.readyState&&(this.warn("Playback: "+V.toFixed(3)+" is located too far from the end of live sliding playlist: "+G+", reset currentTime to : "+H.toFixed(3)),M.currentTime=H))}},a.alignPlaylists=function(m,y){var M=this.levels,H=this.levelLastLoaded,V=this.fragPrevious,te=H!==null?M[H]:null,G=m.fragments.length;if(!G)return this.warn("No fragments in live playlist"),0;var j=m.fragments[0].start,ie=!y,pe=m.alignedSliding&&Object(X.isFiniteNumber)(j);if(ie||!pe&&!j){Object(P.alignStream)(V,te,m);var ge=m.fragments[0].start;return this.log("Live playlist sliding: "+ge.toFixed(2)+" start-sn: "+(y?y.startSN:"na")+"->"+m.startSN+" prev-sn: "+(V?V.sn:"na")+" fragments: "+G),ge}return j},a.waitForCdnTuneIn=function(m){var y=3;return m.live&&m.canBlockReload&&m.tuneInGoal>Math.max(m.partHoldBack,m.partTarget*y)},a.setStartPosition=function(m,y){var M=this.startPosition;if(M<y&&(M=-1),M===-1||this.lastCurrentTime===-1){var H=m.startTimeOffset;Object(X.isFiniteNumber)(H)?(M=y+H,H<0&&(M+=m.totalduration),M=Math.min(Math.max(y,M),y+m.totalduration),this.log("Start time offset "+H+" found in playlist, adjust startPosition to "+M),this.startPosition=M):m.live?M=this.hls.liveSyncPosition||y:this.startPosition=M=0,this.lastCurrentTime=M}this.nextLoadPosition=M},a.getLoadPosition=function(){var m=this.media,y=0;return this.loadedmetadata&&m?y=m.currentTime:this.nextLoadPosition&&(y=this.nextLoadPosition),y},a.handleFragLoadAborted=function(m,y){this.transmuxer&&m.sn!=="initSegment"&&m.stats.aborted&&(this.warn("Fragment "+m.sn+(y?" part"+y.index:"")+" of level "+m.level+" was aborted"),this.resetFragmentLoading(m))},a.resetFragmentLoading=function(m){(!this.fragCurrent||!this.fragContextChanged(m))&&(this.state=b.IDLE)},a.onFragmentOrKeyLoadError=function(m,y){if(y.fatal)return;var M=y.frag;if(!M||M.type!==m)return;var H=this.fragCurrent;console.assert(H&&M.sn===H.sn&&M.level===H.level&&M.urlId===H.urlId,"Frag load error must match current frag to retry");var V=this.config;if(this.fragLoadError+1<=V.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(M.level))return;var te=Math.min(Math.pow(2,this.fragLoadError)*V.fragLoadingRetryDelay,V.fragLoadingMaxRetryTimeout);this.warn("Fragment "+M.sn+" of "+m+" "+M.level+" failed to load, retrying in "+te+"ms"),this.retryDate=self.performance.now()+te,this.fragLoadError++,this.state=b.FRAG_LOADING_WAITING_RETRY}else y.levelRetry?(m===u.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=b.IDLE):(F.logger.error(y.details+" reaches max retry, redispatch as fatal ..."),y.fatal=!0,this.hls.stopLoad(),this.state=b.ERROR)},a.afterBufferFlushed=function(m,y,M){if(!m)return;var H=W.BufferHelper.getBuffered(m);this.fragmentTracker.detectEvictedFragments(y,H,M),this.state===b.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=b.IDLE},a.resetLiveStartWhenNotLoaded=function(m){if(!this.loadedmetadata){this.startFragRequested=!1;var y=this.levels?this.levels[m].details:null;if(y!=null&&y.live)return this.startPosition=-1,this.setStartPosition(y,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(m,y,M,H){var V=this,te=M.details;console.assert(!!te,"level.details must be defined");var G=Object.keys(m.elementaryStreams).reduce(function(j,ie){var pe=m.elementaryStreams[ie];if(pe){var ge=pe.endPTS-pe.startPTS;if(ge<=0)return V.warn("Could not parse fragment "+m.sn+" "+ie+" duration reliably ("+ge+") resetting transmuxer to fallback to playlist timing"),V.resetTransmuxer(),j||!1;var be=H?0:Object(A.updateFragPTSDTS)(te,m,pe.startPTS,pe.endPTS,pe.startDTS,pe.endDTS);return V.hls.trigger(O.Events.LEVEL_PTS_UPDATED,{details:te,level:M,drift:be,type:ie,frag:m,start:pe.startPTS,end:pe.endPTS}),!0}return j},!1);G?(this.state=b.PARSED,this.hls.trigger(O.Events.FRAG_PARSED,{frag:m,part:y})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},x(s,[{key:"state",get:function(){return this._state},set:function(m){var y=this._state;y!==m&&(this._state=m,this.log(y+"->"+m))}}]),s}(I.default)},"./src/controller/buffer-controller.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return _});var X=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),k=L("./src/utils/logger.ts"),W=L("./src/errors.ts"),F=L("./src/utils/buffer-helper.ts"),O=L("./src/utils/mediasource-helper.ts"),D=L("./src/loader/fragment.ts"),E=L("./src/controller/buffer-operation-queue.ts"),w=Object(O.getMediaSource)(),P=/([ha]vc.)(?:\.[^.,]+)+/,_=function(){function A(c){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var u=o.hls,d=o.media,x=o.mediaSource;k.logger.log("[buffer-controller]: Media source opened"),d&&(o.updateMediaElementDuration(),u.trigger(I.Events.MEDIA_ATTACHED,{media:d})),x&&x.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){k.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){k.logger.log("[buffer-controller]: Media source ended")},this.hls=c,this._initSourceBuffer(),this.registerListeners()}var C=A.prototype;return C.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},C.destroy=function(){this.unregisterListeners(),this.details=null},C.registerListeners=function(){var o=this.hls;o.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(I.Events.BUFFER_RESET,this.onBufferReset,this),o.on(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(I.Events.BUFFER_EOS,this.onBufferEos,this),o.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(I.Events.FRAG_PARSED,this.onFragParsed,this),o.on(I.Events.FRAG_CHANGED,this.onFragChanged,this)},C.unregisterListeners=function(){var o=this.hls;o.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(I.Events.BUFFER_RESET,this.onBufferReset,this),o.off(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(I.Events.BUFFER_EOS,this.onBufferEos,this),o.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(I.Events.FRAG_PARSED,this.onFragParsed,this),o.off(I.Events.FRAG_CHANGED,this.onFragChanged,this)},C._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new E.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},C.onManifestParsed=function(o,u){var d=2;(u.audio&&!u.video||!u.altAudio)&&(d=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=d,this.details=null,k.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},C.onMediaAttaching=function(o,u){var d=this.media=u.media;if(d&&w){var x=this.mediaSource=new w;x.addEventListener("sourceopen",this._onMediaSourceOpen),x.addEventListener("sourceended",this._onMediaSourceEnded),x.addEventListener("sourceclose",this._onMediaSourceClose),d.src=self.URL.createObjectURL(x),this._objectUrl=d.src}},C.onMediaDetaching=function(){var o=this.media,u=this.mediaSource,d=this._objectUrl;if(u){if(k.logger.log("[buffer-controller]: media source detaching"),u.readyState==="open")try{u.endOfStream()}catch(x){k.logger.warn("[buffer-controller]: onMediaDetaching: "+x.message+" while calling endOfStream")}this.onBufferReset(),u.removeEventListener("sourceopen",this._onMediaSourceOpen),u.removeEventListener("sourceended",this._onMediaSourceEnded),u.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(d&&self.URL.revokeObjectURL(d),o.src===d?(o.removeAttribute("src"),o.load()):k.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)},C.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(u){var d=o.sourceBuffer[u];try{d&&(o.removeBufferListeners(u),o.mediaSource&&o.mediaSource.removeSourceBuffer(d),o.sourceBuffer[u]=void 0)}catch(x){k.logger.warn("[buffer-controller]: Failed to reset the "+u+" buffer",x)}}),this._initSourceBuffer()},C.onBufferCodecs=function(o,u){var d=this,x=this.getSourceBufferTypes().length;if(Object.keys(u).forEach(function(v){if(x){var f=d.tracks[v];if(f&&typeof f.buffer.changeType=="function"){var l=u[v],b=l.codec,h=l.levelCodec,p=l.container,s=(f.levelCodec||f.codec).replace(P,"$1"),a=(h||b).replace(P,"$1");if(s!==a){var g=p+";codecs="+(h||b);d.appendChangeType(v,g)}}}else d.pendingTracks[v]=u[v]}),x)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},C.appendChangeType=function(o,u){var d=this,x=this.operationQueue,v={execute:function(){var l=d.sourceBuffer[o];l&&(k.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+u),l.changeType(u)),x.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(l){k.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",l)}};x.append(v,o)},C.onBufferAppending=function(o,u){var d=this,x=this.hls,v=this.operationQueue,f=this.tracks,l=u.data,b=u.type,h=u.frag,p=u.part,s=u.chunkMeta,a=s.buffering[b],g=self.performance.now();a.start=g;var m=h.stats.buffering,y=p?p.stats.buffering:null;m.start===0&&(m.start=g),y&&y.start===0&&(y.start=g);var M=f.audio,H=b==="audio"&&s.id===1&&(M==null?void 0:M.container)==="audio/mpeg",V={execute:function(){if(a.executeStart=self.performance.now(),H){var G=d.sourceBuffer[b];if(G){var j=h.start-G.timestampOffset;Math.abs(j)>=.1&&(k.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+h.start+" (delta: "+j+") sn: "+h.sn+")"),G.timestampOffset=h.start)}}d.appendExecutor(l,b)},onStart:function(){},onComplete:function(){var G=self.performance.now();a.executeEnd=a.end=G,m.first===0&&(m.first=G),y&&y.first===0&&(y.first=G);var j=d.sourceBuffer,ie={};for(var pe in j)ie[pe]=F.BufferHelper.getBuffered(j[pe]);d.appendError=0,d.hls.trigger(I.Events.BUFFER_APPENDED,{type:b,frag:h,part:p,chunkMeta:s,parent:h.type,timeRanges:ie})},onError:function(G){k.logger.error("[buffer-controller]: Error encountered while trying to append to the "+b+" SourceBuffer",G);var j={type:W.ErrorTypes.MEDIA_ERROR,parent:h.type,details:W.ErrorDetails.BUFFER_APPEND_ERROR,err:G,fatal:!1};G.code===DOMException.QUOTA_EXCEEDED_ERR?j.details=W.ErrorDetails.BUFFER_FULL_ERROR:(d.appendError++,j.details=W.ErrorDetails.BUFFER_APPEND_ERROR,d.appendError>x.config.appendErrorMaxRetry&&(k.logger.error("[buffer-controller]: Failed "+x.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),j.fatal=!0)),x.trigger(I.Events.ERROR,j)}};v.append(V,b)},C.onBufferFlushing=function(o,u){var d=this,x=this.operationQueue,v=function(l){return{execute:d.removeExecutor.bind(d,l,u.startOffset,u.endOffset),onStart:function(){},onComplete:function(){d.hls.trigger(I.Events.BUFFER_FLUSHED,{type:l})},onError:function(h){k.logger.warn("[buffer-controller]: Failed to remove from "+l+" SourceBuffer",h)}}};u.type?x.append(v(u.type),u.type):this.getSourceBufferTypes().forEach(function(f){x.append(v(f),f)})},C.onFragParsed=function(o,u){var d=this,x=u.frag,v=u.part,f=[],l=v?v.elementaryStreams:x.elementaryStreams;l[D.ElementaryStreamTypes.AUDIOVIDEO]?f.push("audiovideo"):(l[D.ElementaryStreamTypes.AUDIO]&&f.push("audio"),l[D.ElementaryStreamTypes.VIDEO]&&f.push("video"));var b=function(){var p=self.performance.now();x.stats.buffering.end=p,v&&(v.stats.buffering.end=p);var s=v?v.stats:x.stats;d.hls.trigger(I.Events.FRAG_BUFFERED,{frag:x,part:v,stats:s,id:x.type})};f.length===0&&k.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+x.type+" level: "+x.level+" sn: "+x.sn),this.blockBuffers(b,f)},C.onFragChanged=function(o,u){this.flushBackBuffer()},C.onBufferEos=function(o,u){var d=this,x=this.getSourceBufferTypes().reduce(function(v,f){var l=d.sourceBuffer[f];return(!u.type||u.type===f)&&(l&&!l.ended&&(l.ended=!0,k.logger.log("[buffer-controller]: "+f+" sourceBuffer now EOS"))),v&&!!(!l||l.ended)},!0);x&&this.blockBuffers(function(){var v=d.mediaSource;if(!v||v.readyState!=="open")return;v.endOfStream()})},C.onLevelUpdated=function(o,u){var d=u.details;if(!d.fragments.length)return;this.details=d,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},C.flushBackBuffer=function(){var o=this.hls,u=this.details,d=this.media,x=this.sourceBuffer;if(!d||u===null)return;var v=this.getSourceBufferTypes();if(!v.length)return;var f=u.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(X.isFiniteNumber)(f)||f<0)return;var l=d.currentTime,b=u.levelTargetDuration,h=Math.max(f,b),p=Math.floor(l/b)*b-h;v.forEach(function(s){var a=x[s];if(a){var g=F.BufferHelper.getBuffered(a);g.length>0&&p>g.start(0)&&(o.trigger(I.Events.BACK_BUFFER_REACHED,{bufferEnd:p}),u.live&&o.trigger(I.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:p}),o.trigger(I.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:p,type:s}))}})},C.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,u=this.hls,d=this.media,x=this.mediaSource,v=o.fragments[0].start+o.totalduration,f=d.duration,l=Object(X.isFiniteNumber)(x.duration)?x.duration:0;o.live&&u.config.liveDurationInfinity?(k.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),x.duration=Infinity,this.updateSeekableRange(o)):(v>l&&v>f||!Object(X.isFiniteNumber)(f))&&(k.logger.log("[buffer-controller]: Updating Media Source duration to "+v.toFixed(3)),x.duration=v)},C.updateSeekableRange=function(o){var u=this.mediaSource,d=o.fragments,x=d.length;if(x&&o.live&&u!==null&&u!==void 0&&u.setLiveSeekableRange){var v=Math.max(0,d[0].start),f=Math.max(v,v+o.totalduration);u.setLiveSeekableRange(v,f)}},C.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,u=this.operationQueue,d=this.pendingTracks,x=Object.keys(d).length;if(x&&!o||x===2){this.createSourceBuffers(d),this.pendingTracks={};var v=this.getSourceBufferTypes();if(v.length===0){this.hls.trigger(I.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}v.forEach(function(f){u.executeNext(f)})}},C.createSourceBuffers=function(o){var u=this.sourceBuffer,d=this.mediaSource;if(!d)throw Error("createSourceBuffers called when mediaSource was null");var x=0;for(var v in o)if(!u[v]){var f=o[v];if(!f)throw Error("source buffer exists for track "+v+", however track does not");var l=f.levelCodec||f.codec,b=f.container+";codecs="+l;k.logger.log("[buffer-controller]: creating sourceBuffer("+b+")");try{var h=u[v]=d.addSourceBuffer(b),p=v;this.addBufferListener(p,"updatestart",this._onSBUpdateStart),this.addBufferListener(p,"updateend",this._onSBUpdateEnd),this.addBufferListener(p,"error",this._onSBUpdateError),this.tracks[v]={buffer:h,codec:l,container:f.container,levelCodec:f.levelCodec,id:f.id},x++}catch(s){k.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+s.message),this.hls.trigger(I.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:s,mimeType:b})}}x&&this.hls.trigger(I.Events.BUFFER_CREATED,{tracks:this.tracks})},C._onSBUpdateStart=function(o){var u=this.operationQueue,d=u.current(o);d.onStart()},C._onSBUpdateEnd=function(o){var u=this.operationQueue,d=u.current(o);d.onComplete(),u.shiftAndExecuteNext(o)},C._onSBUpdateError=function(o,u){k.logger.error("[buffer-controller]: "+o+" SourceBuffer error",u),this.hls.trigger(I.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var d=this.operationQueue.current(o);d&&d.onError(u)},C.removeExecutor=function(o,u,d){var x=this.media,v=this.mediaSource,f=this.operationQueue,l=this.sourceBuffer,b=l[o];if(!x||!v||!b){k.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),f.shiftAndExecuteNext(o);return}var h=Object(X.isFiniteNumber)(x.duration)?x.duration:Infinity,p=Object(X.isFiniteNumber)(v.duration)?v.duration:Infinity,s=Math.max(0,u),a=Math.min(d,h,p);a>s?(k.logger.log("[buffer-controller]: Removing ["+s+","+a+"] from the "+o+" SourceBuffer"),console.assert(!b.updating,o+" sourceBuffer must not be updating"),b.remove(s,a)):f.shiftAndExecuteNext(o)},C.appendExecutor=function(o,u){var d=this.operationQueue,x=this.sourceBuffer,v=x[u];if(!v){k.logger.warn("[buffer-controller]: Attempting to append to the "+u+" SourceBuffer, but it does not exist"),d.shiftAndExecuteNext(u);return}v.ended=!1,console.assert(!v.updating,u+" sourceBuffer must not be updating"),v.appendBuffer(o)},C.blockBuffers=function(o,u){var d=this;if(u===void 0&&(u=this.getSourceBufferTypes()),!u.length){k.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var x=this.operationQueue,v=u.map(function(f){return x.appendBlocker(f)});Promise.all(v).then(function(){o(),u.forEach(function(f){var l=d.sourceBuffer[f];(!l||!l.updating)&&x.shiftAndExecuteNext(f)})})},C.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},C.addBufferListener=function(o,u,d){var x=this.sourceBuffer[o];if(!x)return;var v=d.bind(this,o);this.listeners[o].push({event:u,listener:v}),x.addEventListener(u,v)},C.removeBufferListeners=function(o){var u=this.sourceBuffer[o];if(!u)return;this.listeners[o].forEach(function(d){u.removeEventListener(d.event,d.listener)})},A}()},"./src/controller/buffer-operation-queue.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return I});var X=L("./src/utils/logger.ts"),I=function(){function k(F){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=F}var W=k.prototype;return W.append=function(O,D){var E=this.queues[D];E.push(O),E.length===1&&this.buffers[D]&&this.executeNext(D)},W.insertAbort=function(O,D){var E=this.queues[D];E.unshift(O),this.executeNext(D)},W.appendBlocker=function(O){var D,E=new Promise(function(P){D=P}),w={execute:D,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(w,O),E},W.executeNext=function(O){var D=this.buffers,E=this.queues,w=D[O],P=E[O];if(P.length){var _=P[0];try{_.execute()}catch(A){X.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),_.onError(A),(!w||!w.updating)&&(P.shift(),this.executeNext(O))}}},W.shiftAndExecuteNext=function(O){this.queues[O].shift(),this.executeNext(O)},W.current=function(O){return this.queues[O][0]},k}()},"./src/controller/cap-level-controller.ts":function(he,Y,L){"use strict";L.r(Y);var X=L("./src/events.ts");function I(F,O){for(var D=0;D<O.length;D++){var E=O[D];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(F,E.key,E)}}function k(F,O,D){return O&&I(F.prototype,O),D&&I(F,D),F}var W=function(){function F(D){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=D,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var O=F.prototype;return O.setStreamController=function(E){this.streamController=E},O.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},O.registerListeners=function(){var E=this.hls;E.on(X.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),E.on(X.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),E.on(X.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.on(X.Events.BUFFER_CODECS,this.onBufferCodecs,this),E.on(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},O.unregisterListener=function(){var E=this.hls;E.off(X.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),E.off(X.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),E.off(X.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.off(X.Events.BUFFER_CODECS,this.onBufferCodecs,this),E.off(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},O.onFpsDropLevelCapping=function(E,w){F.isLevelAllowed(w.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(w.droppedLevel)},O.onMediaAttaching=function(E,w){this.media=w.media instanceof HTMLVideoElement?w.media:null},O.onManifestParsed=function(E,w){var P=this.hls;this.restrictedLevels=[],this.firstLevel=w.firstLevel,P.config.capLevelToPlayerSize&&w.video&&this.startCapping()},O.onBufferCodecs=function(E,w){var P=this.hls;P.config.capLevelToPlayerSize&&w.video&&this.startCapping()},O.onMediaDetaching=function(){this.stopCapping()},O.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var E=this.hls.levels;if(E.length){var w=this.hls;w.autoLevelCapping=this.getMaxLevel(E.length-1),w.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=w.autoLevelCapping}}},O.getMaxLevel=function(E){var w=this,P=this.hls.levels;if(!P.length)return-1;var _=P.filter(function(A,C){return F.isLevelAllowed(C,w.restrictedLevels)&&C<=E});return this.clientRect=null,F.getMaxLevelByMediaSize(_,this.mediaWidth,this.mediaHeight)},O.startCapping=function(){if(this.timer)return;this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize()},O.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},O.getDimensions=function(){if(this.clientRect)return this.clientRect;var E=this.media,w={width:0,height:0};if(E){var P=E.getBoundingClientRect();w.width=P.width,w.height=P.height,!w.width&&!w.height&&(w.width=P.right-P.left||E.width||0,w.height=P.bottom-P.top||E.height||0)}return this.clientRect=w,w},F.isLevelAllowed=function(E,w){return w===void 0&&(w=[]),w.indexOf(E)===-1},F.getMaxLevelByMediaSize=function(E,w,P){if(!E||!E.length)return-1;for(var _=function(u,d){return d?u.width!==d.width||u.height!==d.height:!0},A=E.length-1,C=0;C<E.length;C+=1){var c=E[C];if((c.width>=w||c.height>=P)&&_(c,E[C+1])){A=C;break}}return A},k(F,[{key:"mediaWidth",get:function(){return this.getDimensions().width*F.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*F.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var E=1;try{E=self.devicePixelRatio}catch(w){}return E}}]),F}();Y.default=W},"./src/controller/cmcd-controller.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return _});var X=L("./src/events.ts"),I=L("./src/types/cmcd.ts"),k=L("./src/utils/buffer-helper.ts"),W=L("./src/utils/logger.ts");function F(A,C){for(var c=0;c<C.length;c++){var o=C[c];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(A,o.key,o)}}function O(A,C,c){return C&&F(A.prototype,C),c&&F(A,c),A}function D(A,C){var c=typeof Symbol!="undefined"&&A[Symbol.iterator]||A["@@iterator"];if(c)return(c=c.call(A)).next.bind(c);if(Array.isArray(A)||(c=E(A))||C&&A&&typeof A.length=="number"){c&&(A=c);var o=0;return function(){return o>=A.length?{done:!0}:{done:!1,value:A[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function E(A,C){if(!A)return;if(typeof A=="string")return w(A,C);var c=Object.prototype.toString.call(A).slice(8,-1);if(c==="Object"&&A.constructor&&(c=A.constructor.name),c==="Map"||c==="Set")return Array.from(A);if(c==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c))return w(A,C)}function w(A,C){(C==null||C>A.length)&&(C=A.length);for(var c=0,o=new Array(C);c<C;c++)o[c]=A[c];return o}function P(){return P=Object.assign||function(A){for(var C=1;C<arguments.length;C++){var c=arguments[C];for(var o in c)Object.prototype.hasOwnProperty.call(c,o)&&(A[o]=c[o])}return A},P.apply(this,arguments)}var _=function(){function A(c){var o=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(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(x){try{o.apply(x,{ot:I.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(v){W.logger.warn("Could not generate manifest CMCD data.",v)}},this.applyFragmentData=function(x){try{var v=x.frag,f=o.hls.levels[v.level],l=o.getObjectType(v),b={d:v.duration*1e3,ot:l};(l===I.CMCDObjectType.VIDEO||l===I.CMCDObjectType.AUDIO||l==I.CMCDObjectType.MUXED)&&(b.br=f.bitrate/1e3,b.tb=o.getTopBandwidth(l),b.bl=o.getBufferLength(l)),o.apply(x,b)}catch(h){W.logger.warn("Could not generate segment CMCD data.",h)}},this.hls=c;var u=this.config=c.config,d=u.cmcd;d!=null&&(u.pLoader=this.createPlaylistLoader(),u.fLoader=this.createFragmentLoader(),this.sid=d.sessionId||A.uuid(),this.cid=d.contentId,this.useHeaders=d.useHeaders===!0,this.registerListeners())}var C=A.prototype;return C.registerListeners=function(){var o=this.hls;o.on(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(X.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(X.Events.BUFFER_CREATED,this.onBufferCreated,this)},C.unregisterListeners=function(){var o=this.hls;o.off(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(X.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(X.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},C.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},C.onMediaAttached=function(o,u){this.media=u.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},C.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},C.onBufferCreated=function(o,u){var d,x;this.audioBuffer=(d=u.tracks.audio)===null||d===void 0?void 0:d.buffer,this.videoBuffer=(x=u.tracks.video)===null||x===void 0?void 0:x.buffer},C.createData=function(){var o;return{v:I.CMCDVersion,sf:I.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},C.apply=function(o,u){u===void 0&&(u={}),P(u,this.createData());var d=u.ot===I.CMCDObjectType.INIT||u.ot===I.CMCDObjectType.VIDEO||u.ot===I.CMCDObjectType.MUXED;if(this.starved&&d&&(u.bs=!0,u.su=!0,this.starved=!1),u.su==null&&(u.su=this.buffering),this.useHeaders){var x=A.toHeaders(u);if(!Object.keys(x).length)return;o.headers||(o.headers={}),P(o.headers,x)}else{var v=A.toQuery(u);if(!v)return;o.url=A.appendQueryToUri(o.url,v)}},C.getObjectType=function(o){var u=o.type;return u==="subtitle"?I.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?I.CMCDObjectType.INIT:u==="audio"?I.CMCDObjectType.AUDIO:u==="main"?this.hls.audioTracks.length?I.CMCDObjectType.VIDEO:I.CMCDObjectType.MUXED:void 0},C.getTopBandwidth=function(o){for(var u=0,d=o===I.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,x=D(d),v;!(v=x()).done;){var f=v.value;f.bitrate>u&&(u=f.bitrate)}return u>0?u:NaN},C.getBufferLength=function(o){var u=this.hls.media,d=o===I.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!d||!u)return NaN;var x=k.BufferHelper.bufferInfo(d,u.currentTime,this.config.maxBufferHole);return x.len*1e3},C.createPlaylistLoader=function(){var o=this.config.pLoader,u=this.applyPlaylistData,d=o||this.config.loader;return function(){function x(f){this.loader=void 0,this.loader=new d(f)}var v=x.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(l,b,h){u(l),this.loader.load(l,b,h)},O(x,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),x}()},C.createFragmentLoader=function(){var o=this.config.fLoader,u=this.applyFragmentData,d=o||this.config.loader;return function(){function x(f){this.loader=void 0,this.loader=new d(f)}var v=x.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(l,b,h){u(l),this.loader.load(l,b,h)},O(x,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),x}()},A.uuid=function(){var o=URL.createObjectURL(new Blob),u=o.toString();return URL.revokeObjectURL(o),u.substr(u.lastIndexOf("/")+1)},A.serialize=function(o){for(var u=[],d=function(H){return!Number.isNaN(H)&&H!=null&&H!==""&&H!==!1},x=function(H){return Math.round(H)},v=function(H){return x(H/100)*100},f=function(H){return encodeURIComponent(H)},l={br:x,d:x,bl:v,dl:v,mtp:v,nor:f,rtp:v,tb:x},b=Object.keys(o||{}).sort(),h=D(b),p;!(p=h()).done;){var s=p.value,a=o[s];if(!d(a))continue;if(s==="v"&&a===1)continue;if(s=="pr"&&a===1)continue;var g=l[s];g&&(a=g(a));var m=typeof a,y=void 0;s==="ot"||s==="sf"||s==="st"?y=s+"="+a:m==="boolean"?y=s:m==="number"?y=s+"="+a:y=s+"="+JSON.stringify(a),u.push(y)}return u.join(",")},A.toHeaders=function(o){for(var u=Object.keys(o),d={},x=["Object","Request","Session","Status"],v=[{},{},{},{}],f={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},l=0,b=u;l<b.length;l++){var h=b[l],p=f[h]!=null?f[h]:1;v[p][h]=o[h]}for(var s=0;s<v.length;s++){var a=A.serialize(v[s]);a&&(d["CMCD-"+x[s]]=a)}return d},A.toQuery=function(o){return"CMCD="+encodeURIComponent(A.serialize(o))},A.appendQueryToUri=function(o,u){if(!u)return o;var d=o.includes("?")?"&":"?";return""+o+d+u},A}()},"./src/controller/eme-controller.ts":function(he,Y,L){"use strict";L.r(Y);var X=L("./src/events.ts"),I=L("./src/errors.ts"),k=L("./src/utils/logger.ts"),W=L("./src/utils/mediakeys-helper.ts");function F(_,A){for(var C=0;C<A.length;C++){var c=A[C];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(_,c.key,c)}}function O(_,A,C){return A&&F(_.prototype,A),C&&F(_,C),_}var D=3,E=function(A,C,c){var o={audioCapabilities:[],videoCapabilities:[]};return A.forEach(function(u){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+u+'"',robustness:c.audioRobustness||""})}),C.forEach(function(u){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+u+'"',robustness:c.videoRobustness||""})}),[o]},w=function(A,C,c,o){switch(A){case W.KeySystems.WIDEVINE:return E(C,c,o);default:throw new Error("Unknown key-system: "+A)}},P=function(){function _(C){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=C,this._config=C.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 A=_.prototype;return A.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},A._registerListeners=function(){this.hls.on(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(X.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(X.Events.MANIFEST_PARSED,this.onManifestParsed,this)},A._unregisterListeners=function(){this.hls.off(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(X.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(X.Events.MANIFEST_PARSED,this.onManifestParsed,this)},A.getLicenseServerUrl=function(c){switch(c){case W.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+c+'"')},A._attemptKeySystemAccess=function(c,o,u){var d=this,x=w(c,o,u,this._drmSystemOptions);k.logger.log("Requesting encrypted media key-system access");var v=this.requestMediaKeySystemAccess(c,x);this.mediaKeysPromise=v.then(function(f){return d._onMediaKeySystemAccessObtained(c,f)}),v.catch(function(f){k.logger.error('Failed to obtain key-system "'+c+'" access:',f)})},A._onMediaKeySystemAccessObtained=function(c,o){var u=this;k.logger.log('Access for key-system "'+c+'" obtained');var d={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:c};this._mediaKeysList.push(d);var x=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(v){return d.mediaKeys=v,k.logger.log('Media-keys created for key-system "'+c+'"'),u._onMediaKeysCreated(),v});return x.catch(function(v){k.logger.error("Failed to create media-keys:",v)}),x},A._onMediaKeysCreated=function(){var c=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),c._onNewMediaKeySession(o.mediaKeysSession))})},A._onNewMediaKeySession=function(c){var o=this;k.logger.log("New key-system session "+c.sessionId),c.addEventListener("message",function(u){o._onKeySessionMessage(c,u.message)},!1)},A._onKeySessionMessage=function(c,o){k.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(u){k.logger.log("Received license data (length: "+(u&&u.byteLength)+"), updating key-session"),c.update(u)})},A.onMediaEncrypted=function(c){var o=this;if(k.logger.log('Media is encrypted using "'+c.initDataType+'" init data type'),!this.mediaKeysPromise){k.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(X.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var u=function(x){if(!o._media)return;o._attemptSetMediaKeys(x),o._generateRequestWithPreferredKeySession(c.initDataType,c.initData)};this.mediaKeysPromise.then(u).catch(u)},A._attemptSetMediaKeys=function(c){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){k.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(X.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}k.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},A._generateRequestWithPreferredKeySession=function(c,o){var u=this,d=this._mediaKeysList[0];if(!d){k.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(X.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(d.mediaKeysSessionInitialized){k.logger.warn("Key-Session already initialized but requested again");return}var x=d.mediaKeysSession;if(!x){k.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(X.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){k.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(X.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}k.logger.log('Generating key-session request for "'+c+'" init data type'),d.mediaKeysSessionInitialized=!0,x.generateRequest(c,o).then(function(){k.logger.debug("Key-session generation succeeded")}).catch(function(v){k.logger.error("Error generating key-session request:",v),u.hls.trigger(X.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},A._createLicenseXhr=function(c,o,u){var d=new XMLHttpRequest;d.responseType="arraybuffer",d.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,d,c,o,u);var x=this._licenseXhrSetup;if(x)try{x.call(this.hls,d,c),x=void 0}catch(v){k.logger.error(v)}try{d.readyState||d.open("POST",c,!0),x&&x.call(this.hls,d,c)}catch(v){throw new Error("issue setting up KeySystem license XHR "+v)}return d},A._onLicenseRequestReadyStageChange=function(c,o,u,d){switch(c.readyState){case 4:if(c.status===200){this._requestLicenseFailureCount=0,k.logger.log("License request succeeded");var x=c.response,v=this._licenseResponseCallback;if(v)try{x=v.call(this.hls,c,o)}catch(l){k.logger.error(l)}d(x)}else{if(k.logger.error("License Request XHR failed ("+o+"). Status: "+c.status+" ("+c.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>D){this.hls.trigger(X.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var f=D-this._requestLicenseFailureCount+1;k.logger.warn("Retrying license request, "+f+" attempts left"),this._requestLicense(u,d)}break}},A._generateLicenseRequestChallenge=function(c,o){switch(c.mediaKeySystemDomain){case W.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+c.mediaKeySystemDomain)},A._requestLicense=function(c,o){k.logger.log("Requesting content license for key-system");var u=this._mediaKeysList[0];if(!u){k.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(X.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var d=this.getLicenseServerUrl(u.mediaKeySystemDomain),x=this._createLicenseXhr(d,c,o);k.logger.log("Sending license request to URL: "+d);var v=this._generateLicenseRequestChallenge(u,c);x.send(v)}catch(f){k.logger.error("Failure requesting DRM license: "+f),this.hls.trigger(X.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},A.onMediaAttached=function(c,o){if(!this._emeEnabled)return;var u=o.media;this._media=u,u.addEventListener("encrypted",this._onMediaEncrypted)},A.onMediaDetached=function(){var c=this._media,o=this._mediaKeysList;if(!c)return;c.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(u){if(u.mediaKeysSession)return u.mediaKeysSession.close().catch(function(){})})).then(function(){return c.setMediaKeys(null)}).catch(function(){})},A.onManifestParsed=function(c,o){if(!this._emeEnabled)return;var u=o.levels.map(function(x){return x.audioCodec}).filter(function(x){return!!x}),d=o.levels.map(function(x){return x.videoCodec}).filter(function(x){return!!x});this._attemptKeySystemAccess(W.KeySystems.WIDEVINE,u,d)},O(_,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),_}();Y.default=P},"./src/controller/fps-controller.ts":function(he,Y,L){"use strict";L.r(Y);var X=L("./src/events.ts"),I=L("./src/utils/logger.ts"),k=function(){function W(O){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=O,this.registerListeners()}var F=W.prototype;return F.setStreamController=function(D){this.streamController=D},F.registerListeners=function(){this.hls.on(X.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},F.unregisterListeners=function(){this.hls.off(X.Events.MEDIA_ATTACHING,this.onMediaAttaching)},F.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},F.onMediaAttaching=function(D,E){var w=this.hls.config;if(w.capLevelOnFPSDrop){var P=E.media instanceof self.HTMLVideoElement?E.media:null;this.media=P,P&&typeof P.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),w.fpsDroppedMonitoringPeriod)}},F.checkFPS=function(D,E,w){var P=performance.now();if(E){if(this.lastTime){var _=P-this.lastTime,A=w-this.lastDroppedFrames,C=E-this.lastDecodedFrames,c=1e3*A/_,o=this.hls;if(o.trigger(X.Events.FPS_DROP,{currentDropped:A,currentDecoded:C,totalDroppedFrames:w}),c>0&&A>o.config.fpsDroppedMonitoringThreshold*C){var u=o.currentLevel;I.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=u)&&(u=u-1,o.trigger(X.Events.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:o.currentLevel}),o.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=P,this.lastDroppedFrames=w,this.lastDecodedFrames=E}},F.checkFPSInterval=function(){var D=this.media;if(D)if(this.isVideoPlaybackQualityAvailable){var E=D.getVideoPlaybackQuality();this.checkFPS(D,E.totalVideoFrames,E.droppedVideoFrames)}else this.checkFPS(D,D.webkitDecodedFrameCount,D.webkitDroppedFrameCount)},W}();Y.default=k},"./src/controller/fragment-finders.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"findFragmentByPDT",function(){return k}),L.d(Y,"findFragmentByPTS",function(){return W}),L.d(Y,"fragmentWithinToleranceTest",function(){return F}),L.d(Y,"pdtWithinToleranceTest",function(){return O}),L.d(Y,"findFragWithCC",function(){return D});var X=L("./src/polyfills/number.ts"),I=L("./src/utils/binary-search.ts");function k(E,w,P){if(w===null||!Array.isArray(E)||!E.length||!Object(X.isFiniteNumber)(w))return null;var _=E[0].programDateTime;if(w<(_||0))return null;var A=E[E.length-1].endProgramDateTime;if(w>=(A||0))return null;P=P||0;for(var C=0;C<E.length;++C){var c=E[C];if(O(w,P,c))return c}return null}function W(E,w,P,_){P===void 0&&(P=0),_===void 0&&(_=0);var A=null;if(E?A=w[E.sn-w[0].sn+1]||null:P===0&&w[0].start===0&&(A=w[0]),A&&F(P,_,A)===0)return A;var C=I.default.search(w,F.bind(null,P,_));return C||A}function F(E,w,P){E===void 0&&(E=0),w===void 0&&(w=0);var _=Math.min(w,P.duration+(P.deltaPTS?P.deltaPTS:0));return P.start+P.duration-_<=E?1:P.start-_>E&&P.start?-1:0}function O(E,w,P){var _=Math.min(w,P.duration+(P.deltaPTS?P.deltaPTS:0))*1e3,A=P.endProgramDateTime||0;return A-_>E}function D(E,w){return I.default.search(E,function(P){return P.cc<w?1:P.cc>w?-1:0})}},"./src/controller/fragment-tracker.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"FragmentState",function(){return k}),L.d(Y,"FragmentTracker",function(){return W});var X=L("./src/events.ts"),I=L("./src/types/loader.ts"),k;(function(D){D.NOT_LOADED="NOT_LOADED",D.BACKTRACKED="BACKTRACKED",D.APPENDING="APPENDING",D.PARTIAL="PARTIAL",D.OK="OK"})(k||(k={}));var W=function(){function D(w){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=w,this._registerListeners()}var E=D.prototype;return E._registerListeners=function(){var P=this.hls;P.on(X.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.on(X.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.on(X.Events.FRAG_LOADED,this.onFragLoaded,this)},E._unregisterListeners=function(){var P=this.hls;P.off(X.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.off(X.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.off(X.Events.FRAG_LOADED,this.onFragLoaded,this)},E.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},E.getAppendedFrag=function(P,_){if(_===I.PlaylistLevelType.MAIN){var A=this.activeFragment,C=this.activeParts;if(!A)return null;if(C)for(var c=C.length;c--;){var o=C[c],u=o?o.end:A.appendedPTS;if(o.start<=P&&u!==void 0&&P<=u)return c>9&&(this.activeParts=C.slice(c-9)),o}else if(A.start<=P&&A.appendedPTS!==void 0&&P<=A.appendedPTS)return A}return this.getBufferedFrag(P,_)},E.getBufferedFrag=function(P,_){for(var A=this.fragments,C=Object.keys(A),c=C.length;c--;){var o=A[C[c]];if((o==null?void 0:o.body.type)===_&&o.buffered){var u=o.body;if(u.start<=P&&P<=u.end)return u}}return null},E.detectEvictedFragments=function(P,_,A){var C=this;Object.keys(this.fragments).forEach(function(c){var o=C.fragments[c];if(!o)return;if(!o.buffered){o.body.type===A&&C.removeFragment(o.body);return}var u=o.range[P];if(!u)return;u.time.some(function(d){var x=!C.isTimeBuffered(d.startPTS,d.endPTS,_);return x&&C.removeFragment(o.body),x})})},E.detectPartialFragments=function(P){var _=this,A=this.timeRanges,C=P.frag,c=P.part;if(!A||C.sn==="initSegment")return;var o=O(C),u=this.fragments[o];if(!u)return;Object.keys(A).forEach(function(d){var x=C.elementaryStreams[d];if(!x)return;var v=A[d],f=c!==null||x.partial===!0;u.range[d]=_.getBufferedTimes(C,c,f,v)}),u.backtrack=u.loaded=null,Object.keys(u.range).length?u.buffered=!0:this.removeFragment(u.body)},E.fragBuffered=function(P){var _=O(P),A=this.fragments[_];A&&(A.backtrack=A.loaded=null,A.buffered=!0)},E.getBufferedTimes=function(P,_,A,C){for(var c={time:[],partial:A},o=_?_.start:P.start,u=_?_.end:P.end,d=P.minEndPTS||u,x=P.maxStartPTS||o,v=0;v<C.length;v++){var f=C.start(v)-this.bufferPadding,l=C.end(v)+this.bufferPadding;if(x>=f&&d<=l){c.time.push({startPTS:Math.max(o,C.start(v)),endPTS:Math.min(u,C.end(v))});break}else if(o<l&&u>f)c.partial=!0,c.time.push({startPTS:Math.max(o,C.start(v)),endPTS:Math.min(u,C.end(v))});else if(u<=f)break}return c},E.getPartialFragment=function(P){var _=null,A,C,c,o=0,u=this.bufferPadding,d=this.fragments;return Object.keys(d).forEach(function(x){var v=d[x];if(!v)return;F(v)&&(C=v.body.start-u,c=v.body.end+u,P>=C&&P<=c&&(A=Math.min(P-C,c-P),o<=A&&(_=v.body,o=A)))}),_},E.getState=function(P){var _=O(P),A=this.fragments[_];return A?A.buffered?F(A)?k.PARTIAL:k.OK:A.backtrack?k.BACKTRACKED:k.APPENDING:k.NOT_LOADED},E.backtrack=function(P,_){var A=O(P),C=this.fragments[A];if(!C||C.backtrack)return null;var c=C.backtrack=_||C.loaded;return C.loaded=null,c},E.getBacktrackData=function(P){var _=O(P),A=this.fragments[_];if(A){var C,c=A.backtrack;if(c!=null&&(C=c.payload)!==null&&C!==void 0&&C.byteLength)return c;this.removeFragment(P)}return null},E.isTimeBuffered=function(P,_,A){for(var C,c,o=0;o<A.length;o++){if(C=A.start(o)-this.bufferPadding,c=A.end(o)+this.bufferPadding,P>=C&&_<=c)return!0;if(_<=C)return!1}return!1},E.onFragLoaded=function(P,_){var A=_.frag,C=_.part;if(A.sn==="initSegment"||A.bitrateTest||C)return;var c=O(A);this.fragments[c]={body:A,loaded:_,backtrack:null,buffered:!1,range:Object.create(null)}},E.onBufferAppended=function(P,_){var A=this,C=_.frag,c=_.part,o=_.timeRanges;if(C.type===I.PlaylistLevelType.MAIN)if(this.activeFragment=C,c){var u=this.activeParts;u||(this.activeParts=u=[]),u.push(c)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(d){var x=o[d];if(A.detectEvictedFragments(d,x),!c)for(var v=0;v<x.length;v++)C.appendedPTS=Math.max(x.end(v),C.appendedPTS||0)})},E.onFragBuffered=function(P,_){this.detectPartialFragments(_)},E.hasFragment=function(P){var _=O(P);return!!this.fragments[_]},E.removeFragmentsInRange=function(P,_,A){var C=this;Object.keys(this.fragments).forEach(function(c){var o=C.fragments[c];if(!o)return;if(o.buffered){var u=o.body;u.type===A&&u.start<_&&u.end>P&&C.removeFragment(u)}})},E.removeFragment=function(P){var _=O(P);P.stats.loaded=0,P.clearElementaryStreamInfo(),delete this.fragments[_]},E.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},D}();function F(D){var E,w;return D.buffered&&(((E=D.range.video)===null||E===void 0?void 0:E.partial)||((w=D.range.audio)===null||w===void 0?void 0:w.partial))}function O(D){return D.type+"_"+D.level+"_"+D.urlId+"_"+D.sn}},"./src/controller/gap-controller.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"STALL_MINIMUM_DURATION_MS",function(){return F}),L.d(Y,"MAX_START_GAP_JUMP",function(){return O}),L.d(Y,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return D}),L.d(Y,"SKIP_BUFFER_RANGE_START",function(){return E}),L.d(Y,"default",function(){return w});var X=L("./src/utils/buffer-helper.ts"),I=L("./src/errors.ts"),k=L("./src/events.ts"),W=L("./src/utils/logger.ts"),F=250,O=2,D=.1,E=.05,w=function(){function P(A,C,c,o){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=A,this.media=C,this.fragmentTracker=c,this.hls=o}var _=P.prototype;return _.destroy=function(){this.hls=this.fragmentTracker=this.media=null},_.poll=function(C){var c=this.config,o=this.media,u=this.stalled,d=o.currentTime,x=o.seeking,v=this.seeking&&!x,f=!this.seeking&&x;if(this.seeking=x,d!==C){if(this.moved=!0,u!==null){if(this.stallReported){var l=self.performance.now()-u;W.logger.warn("playback not stuck anymore @"+d+", after "+Math.round(l)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((f||v)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!X.BufferHelper.getBuffered(o).length)return;var b=X.BufferHelper.bufferInfo(o,d,0),h=b.len>0,p=b.nextStart||0;if(!h&&!p)return;if(x){var s=b.len>O,a=!p||p-d>O&&!this.fragmentTracker.getPartialFragment(d);if(s||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var g,m=Math.max(p,b.start||0)-d,y=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,M=y==null||((g=y.details)===null||g===void 0)?void 0:g.live,H=M?y.details.targetduration*2:O;if(m>0&&m<=H){this._trySkipBufferHole(null);return}}var V=self.performance.now();if(u===null){this.stalled=V;return}var te=V-u;!x&&te>=F&&this._reportStall(b.len);var G=X.BufferHelper.bufferInfo(o,d,c.maxBufferHole);this._tryFixBufferStall(G,te)},_._tryFixBufferStall=function(C,c){var o=this.config,u=this.fragmentTracker,d=this.media,x=d.currentTime,v=u.getPartialFragment(x);if(v){var f=this._trySkipBufferHole(v);if(f)return}C.len>o.maxBufferHole&&c>o.highBufferWatchdogPeriod*1e3&&(W.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},_._reportStall=function(C){var c=this.hls,o=this.media,u=this.stallReported;u||(this.stallReported=!0,W.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+C+")"),c.trigger(k.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:C}))},_._trySkipBufferHole=function(C){for(var c=this.config,o=this.hls,u=this.media,d=u.currentTime,x=0,v=X.BufferHelper.getBuffered(u),f=0;f<v.length;f++){var l=v.start(f);if(d+c.maxBufferHole>=x&&d<l){var b=Math.max(l+E,u.currentTime+D);return W.logger.warn("skipping hole, adjusting currentTime from "+d+" to "+b),this.moved=!0,this.stalled=null,u.currentTime=b,C&&o.trigger(k.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+d+" to "+b,frag:C}),b}x=v.end(f)}return 0},_._tryNudgeBuffer=function(){var C=this.config,c=this.hls,o=this.media,u=o.currentTime,d=(this.nudgeRetry||0)+1;if(this.nudgeRetry=d,d<C.nudgeMaxRetry){var x=u+d*C.nudgeOffset;W.logger.warn("Nudging 'currentTime' from "+u+" to "+x),o.currentTime=x,c.trigger(k.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else W.logger.error("Playhead still not moving while enough data buffered @"+u+" after "+C.nudgeMaxRetry+" nudges"),c.trigger(k.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},P}()},"./src/controller/id3-track-controller.ts":function(he,Y,L){"use strict";L.r(Y);var X=L("./src/events.ts"),I=L("./src/utils/texttrack-utils.ts"),k=L("./src/demux/id3.ts"),W=.25,F=function(){function O(E){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=E,this._registerListeners()}var D=O.prototype;return D.destroy=function(){this._unregisterListeners()},D._registerListeners=function(){var w=this.hls;w.on(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.on(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.on(X.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),w.on(X.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D._unregisterListeners=function(){var w=this.hls;w.off(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.off(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.off(X.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),w.off(X.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D.onMediaAttached=function(w,P){this.media=P.media},D.onMediaDetaching=function(){if(!this.id3Track)return;Object(I.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},D.getID3Track=function(w){if(!this.media)return;for(var P=0;P<w.length;P++){var _=w[P];if(_.kind==="metadata"&&_.label==="id3")return Object(I.sendAddTrackEvent)(_,this.media),_}return this.media.addTextTrack("metadata","id3")},D.onFragParsingMetadata=function(w,P){if(!this.media)return;var _=P.frag,A=P.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var C=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,c=0;c<A.length;c++){var o=k.getID3Frames(A[c].data);if(o){var u=A[c].pts,d=c<A.length-1?A[c+1].pts:_.end,x=d-u;x<=0&&(d=u+W);for(var v=0;v<o.length;v++){var f=o[v];if(!k.isTimeStampFrame(f)){var l=new C(u,d,"");l.value=f,this.id3Track.addCue(l)}}}}},D.onBufferFlushing=function(w,P){var _=P.startOffset,A=P.endOffset,C=P.type;if(!C||C==="audio"){var c=this.id3Track;c&&Object(I.removeCuesInRange)(c,_,A)}},O}();Y.default=F},"./src/controller/latency-controller.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return O});var X=L("./src/errors.ts"),I=L("./src/events.ts"),k=L("./src/utils/logger.ts");function W(D,E){for(var w=0;w<E.length;w++){var P=E[w];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(D,P.key,P)}}function F(D,E,w){return E&&W(D.prototype,E),w&&W(D,w),D}var O=function(){function D(w){var P=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return P.timeupdate()},this.hls=w,this.config=w.config,this.registerListeners()}var E=D.prototype;return E.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},E.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)},E.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)},E.onMediaAttached=function(P,_){this.media=_.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},E.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},E.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},E.onLevelUpdated=function(P,_){var A=_.details;this.levelDetails=A,A.advanced&&this.timeupdate(),!A.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},E.onError=function(P,_){if(_.details!==X.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,k.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},E.timeupdate=function(){var P=this.media,_=this.levelDetails;if(!P||!_)return;this.currentTime=P.currentTime;var A=this.computeLatency();if(A===null)return;this._latency=A;var C=this.config,c=C.lowLatencyMode,o=C.maxLiveSyncPlaybackRate;if(!c||o===1)return;var u=this.targetLatency;if(u===null)return;var d=A-u,x=Math.min(this.maxLatency,u+_.targetduration),v=d<x;if(_.live&&v&&d>.05&&this.forwardBufferLength>1){var f=Math.min(2,Math.max(1,o)),l=Math.round(2/(1+Math.exp(-.75*d-this.edgeStalled))*20)/20;P.playbackRate=Math.min(f,Math.max(1,l))}else P.playbackRate!==1&&P.playbackRate!==0&&(P.playbackRate=1)},E.estimateLiveEdge=function(){var P=this.levelDetails;return P===null?null:P.edge+P.age},E.computeLatency=function(){var P=this.estimateLiveEdge();return P===null?null:P-this.currentTime},F(D,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var P=this.config,_=this.levelDetails;return P.liveMaxLatencyDuration!==void 0?P.liveMaxLatencyDuration:_?P.liveMaxLatencyDurationCount*_.targetduration:0}},{key:"targetLatency",get:function(){var P=this.levelDetails;if(P===null)return null;var _=P.holdBack,A=P.partHoldBack,C=P.targetduration,c=this.config,o=c.liveSyncDuration,u=c.liveSyncDurationCount,d=c.lowLatencyMode,x=this.hls.userConfig,v=d&&A||_;(x.liveSyncDuration||x.liveSyncDurationCount||v===0)&&(v=o!==void 0?o:u*C);var f=C,l=1;return v+Math.min(this.stallCount*l,f)}},{key:"liveSyncPosition",get:function(){var P=this.estimateLiveEdge(),_=this.targetLatency,A=this.levelDetails;if(P===null||_===null||A===null)return null;var C=A.edge,c=P-_-this.edgeStalled,o=C-A.totalduration,u=C-(this.config.lowLatencyMode&&A.partTarget||A.targetduration);return Math.min(Math.max(o,c),u)}},{key:"drift",get:function(){var P=this.levelDetails;return P===null?1:P.drift}},{key:"edgeStalled",get:function(){var P=this.levelDetails;if(P===null)return 0;var _=(this.config.lowLatencyMode&&P.partTarget||P.targetduration)*3;return Math.max(P.age-_,0)}},{key:"forwardBufferLength",get:function(){var P=this.media,_=this.levelDetails;if(!P||!_)return 0;var A=P.buffered.length;return A?P.buffered.end(A-1):_.edge-this.currentTime}}]),D}()},"./src/controller/level-controller.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return c});var X=L("./src/types/level.ts"),I=L("./src/events.ts"),k=L("./src/errors.ts"),W=L("./src/utils/codecs.ts"),F=L("./src/controller/level-helper.ts"),O=L("./src/controller/base-playlist-controller.ts"),D=L("./src/types/loader.ts");function E(){return E=Object.assign||function(o){for(var u=1;u<arguments.length;u++){var d=arguments[u];for(var x in d)Object.prototype.hasOwnProperty.call(d,x)&&(o[x]=d[x])}return o},E.apply(this,arguments)}function w(o,u){for(var d=0;d<u.length;d++){var x=u[d];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(o,x.key,x)}}function P(o,u,d){return u&&w(o.prototype,u),d&&w(o,d),o}function _(o,u){o.prototype=Object.create(u.prototype),o.prototype.constructor=o,A(o,u)}function A(o,u){return A=Object.setPrototypeOf||function(x,v){return x.__proto__=v,x},A(o,u)}var C=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),c=function(o){_(u,o);function u(x){var v;return v=o.call(this,x,"[level-controller]")||this,v._levels=[],v._firstLevel=-1,v._startLevel=void 0,v.currentLevelIndex=-1,v.manualLevelIndex=-1,v.onParsedComplete=void 0,v._registerListeners(),v}var d=u.prototype;return d._registerListeners=function(){var v=this.hls;v.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.on(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),v.on(I.Events.ERROR,this.onError,this)},d._unregisterListeners=function(){var v=this.hls;v.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.off(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),v.off(I.Events.ERROR,this.onError,this)},d.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},d.startLoad=function(){var v=this._levels;v.forEach(function(f){f.loadError=0}),o.prototype.startLoad.call(this)},d.onManifestLoaded=function(v,f){var l=[],b=[],h=[],p,s={},a,g=!1,m=!1,y=!1;if(f.levels.forEach(function(te){var G=te.attrs;g=g||!!(te.width&&te.height),m=m||!!te.videoCodec,y=y||!!te.audioCodec,C&&te.audioCodec&&te.audioCodec.indexOf("mp4a.40.34")!==-1&&(te.audioCodec=void 0);var j=te.bitrate+"-"+te.attrs.RESOLUTION+"-"+te.attrs.CODECS;a=s[j],a?a.url.push(te.url):(a=new X.Level(te),s[j]=a,l.push(a)),G&&(G.AUDIO&&Object(F.addGroupId)(a,"audio",G.AUDIO),G.SUBTITLES&&Object(F.addGroupId)(a,"text",G.SUBTITLES))}),(g||m)&&y&&(l=l.filter(function(te){var G=te.videoCodec,j=te.width,ie=te.height;return!!G||!!(j&&ie)})),l=l.filter(function(te){var G=te.audioCodec,j=te.videoCodec;return(!G||Object(W.isCodecSupportedInMp4)(G,"audio"))&&(!j||Object(W.isCodecSupportedInMp4)(j,"video"))}),f.audioTracks&&(b=f.audioTracks.filter(function(te){return!te.audioCodec||Object(W.isCodecSupportedInMp4)(te.audioCodec,"audio")}),Object(F.assignTrackIdsByGroup)(b)),f.subtitles&&(h=f.subtitles,Object(F.assignTrackIdsByGroup)(h)),l.length>0){p=l[0].bitrate,l.sort(function(te,G){return te.bitrate-G.bitrate}),this._levels=l;for(var M=0;M<l.length;M++)if(l[M].bitrate===p){this._firstLevel=M,this.log("manifest loaded, "+l.length+" level(s) found, first bitrate: "+p);break}var H=y&&!m,V={levels:l,audioTracks:b,subtitleTracks:h,firstLevel:this._firstLevel,stats:f.stats,audio:y,video:m,altAudio:!H&&b.some(function(te){return!!te.url})};this.hls.trigger(I.Events.MANIFEST_PARSED,V),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(I.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:f.url,reason:"no level with compatible codecs found in manifest"})},d.onError=function(v,f){if(o.prototype.onError.call(this,v,f),f.fatal)return;var l=f.context,b=this._levels[this.currentLevelIndex];if(l&&(l.type===D.PlaylistContextType.AUDIO_TRACK&&b.audioGroupIds&&l.groupId===b.audioGroupIds[b.urlId]||l.type===D.PlaylistContextType.SUBTITLE_TRACK&&b.textGroupIds&&l.groupId===b.textGroupIds[b.urlId])){this.redundantFailover(this.currentLevelIndex);return}var h=!1,p=!0,s;switch(f.details){case k.ErrorDetails.FRAG_LOAD_ERROR:case k.ErrorDetails.FRAG_LOAD_TIMEOUT:case k.ErrorDetails.KEY_LOAD_ERROR:case k.ErrorDetails.KEY_LOAD_TIMEOUT:if(f.frag){var a=this._levels[f.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(s=f.frag.level)):s=f.frag.level}break;case k.ErrorDetails.LEVEL_LOAD_ERROR:case k.ErrorDetails.LEVEL_LOAD_TIMEOUT:l&&(l.deliveryDirectives&&(p=!1),s=l.level),h=!0;break;case k.ErrorDetails.REMUX_ALLOC_ERROR:s=f.level,h=!0;break}s!==void 0&&this.recoverLevel(f,s,h,p)},d.recoverLevel=function(v,f,l,b){var h=v.details,p=this._levels[f];if(p.loadError++,l){var s=this.retryLoadingOrFail(v);if(s)v.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(b){var a=p.url.length;if(a>1&&p.loadError<a)v.levelRetry=!0,this.redundantFailover(f);else if(this.manualLevelIndex===-1){var g=f===0?this._levels.length-1:f-1;this.currentLevelIndex!==g&&this._levels[g].loadError===0&&(this.warn(h+": switch to "+g),v.levelRetry=!0,this.hls.nextAutoLevel=g)}}},d.redundantFailover=function(v){var f=this._levels[v],l=f.url.length;if(l>1){var b=(f.urlId+1)%l;this.warn("Switching to redundant URL-id "+b),this._levels.forEach(function(h){h.urlId=b}),this.level=v}},d.onFragLoaded=function(v,f){var l=f.frag;if(l!==void 0&&l.type===D.PlaylistLevelType.MAIN){var b=this._levels[l.level];b!==void 0&&(b.fragmentError=0,b.loadError=0)}},d.onLevelLoaded=function(v,f){var l,b=f.level,h=f.details,p=this._levels[b];if(!p){var s;this.warn("Invalid level index "+b),(s=f.deliveryDirectives)!==null&&s!==void 0&&s.skip&&(h.deltaUpdateFailed=!0);return}b===this.currentLevelIndex?(p.fragmentError===0&&(p.loadError=0,this.retryCount=0),this.playlistLoaded(b,f,p.details)):(l=f.deliveryDirectives)!==null&&l!==void 0&&l.skip&&(h.deltaUpdateFailed=!0)},d.onAudioTrackSwitched=function(v,f){var l=this.hls.levels[this.currentLevelIndex];if(!l)return;if(l.audioGroupIds){for(var b=-1,h=this.hls.audioTracks[f.id].groupId,p=0;p<l.audioGroupIds.length;p++)if(l.audioGroupIds[p]===h){b=p;break}b!==l.urlId&&(l.urlId=b,this.startLoad())}},d.loadPlaylist=function(v){var f=this.currentLevelIndex,l=this._levels[f];if(this.canLoad&&l&&l.url.length>0){var b=l.urlId,h=l.url[b];if(v)try{h=v.addDirectives(h)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("Attempt loading level index "+f+(v?" at sn "+v.msn+" part "+v.part:"")+" with URL-id "+b+" "+h),this.clearTimer(),this.hls.trigger(I.Events.LEVEL_LOADING,{url:h,level:f,id:b,deliveryDirectives:v||null})}},d.removeLevel=function(v,f){var l=function(p,s){return s!==f},b=this._levels.filter(function(h,p){return p!==v?!0:h.url.length>1&&f!==void 0?(h.url=h.url.filter(l),h.audioGroupIds&&(h.audioGroupIds=h.audioGroupIds.filter(l)),h.textGroupIds&&(h.textGroupIds=h.textGroupIds.filter(l)),h.urlId=0,!0):!1}).map(function(h,p){var s=h.details;return s!=null&&s.fragments&&s.fragments.forEach(function(a){a.level=p}),h});this._levels=b,this.hls.trigger(I.Events.LEVELS_UPDATED,{levels:b})},P(u,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(v){var f,l=this._levels;if(l.length===0)return;if(this.currentLevelIndex===v&&(f=l[v])!==null&&f!==void 0&&f.details)return;if(v<0||v>=l.length){var b=v<0;if(this.hls.trigger(I.Events.ERROR,{type:k.ErrorTypes.OTHER_ERROR,details:k.ErrorDetails.LEVEL_SWITCH_ERROR,level:v,fatal:b,reason:"invalid level idx"}),b)return;v=Math.min(v,l.length-1)}this.clearTimer();var h=this.currentLevelIndex,p=l[h],s=l[v];this.log("switching to level "+v+" from "+h),this.currentLevelIndex=v;var a=E({},s,{level:v,maxBitrate:s.maxBitrate,uri:s.uri,urlId:s.urlId});delete a._urlId,this.hls.trigger(I.Events.LEVEL_SWITCHING,a);var g=s.details;if(!g||g.live){var m=this.switchParams(s.uri,p==null?void 0:p.details);this.loadPlaylist(m)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(v){this.manualLevelIndex=v,this._startLevel===void 0&&(this._startLevel=v),v!==-1&&(this.level=v)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(v){this._firstLevel=v}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var v=this.hls.config.startLevel;return v!==void 0?v:this._firstLevel}else return this._startLevel},set:function(v){this._startLevel=v}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(v){this.level=v,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=v)}}]),u}(O.default)},"./src/controller/level-helper.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"addGroupId",function(){return k}),L.d(Y,"assignTrackIdsByGroup",function(){return W}),L.d(Y,"updatePTS",function(){return F}),L.d(Y,"updateFragPTSDTS",function(){return D}),L.d(Y,"mergeDetails",function(){return E}),L.d(Y,"mapPartIntersection",function(){return w}),L.d(Y,"mapFragmentIntersection",function(){return P}),L.d(Y,"adjustSliding",function(){return _}),L.d(Y,"addSliding",function(){return A}),L.d(Y,"computeReloadInterval",function(){return C}),L.d(Y,"getFragmentWithSN",function(){return c}),L.d(Y,"getPartWith",function(){return o});var X=L("./src/polyfills/number.ts"),I=L("./src/utils/logger.ts");function k(u,d,x){switch(d){case"audio":u.audioGroupIds||(u.audioGroupIds=[]),u.audioGroupIds.push(x);break;case"text":u.textGroupIds||(u.textGroupIds=[]),u.textGroupIds.push(x);break}}function W(u){var d={};u.forEach(function(x){var v=x.groupId||"";x.id=d[v]=d[v]||0,d[v]++})}function F(u,d,x){var v=u[d],f=u[x];O(v,f)}function O(u,d){var x=d.startPTS;if(Object(X.isFiniteNumber)(x)){var v=0,f;d.sn>u.sn?(v=x-u.start,f=u):(v=u.start-x,f=d),f.duration!==v&&(f.duration=v)}else if(d.sn>u.sn){var l=u.cc===d.cc;l&&u.minEndPTS?d.start=u.start+(u.minEndPTS-u.start):d.start=u.start+u.duration}else d.start=Math.max(u.start-d.duration,0)}function D(u,d,x,v,f,l){var b=v-x;b<=0&&(I.logger.warn("Fragment should have a positive duration",d),v=x+d.duration,l=f+d.duration);var h=x,p=v,s=d.startPTS,a=d.endPTS;if(Object(X.isFiniteNumber)(s)){var g=Math.abs(s-x);Object(X.isFiniteNumber)(d.deltaPTS)?d.deltaPTS=Math.max(g,d.deltaPTS):d.deltaPTS=g,h=Math.max(x,s),x=Math.min(x,s),f=Math.min(f,d.startDTS),p=Math.min(v,a),v=Math.max(v,a),l=Math.max(l,d.endDTS)}d.duration=v-x;var m=x-d.start;d.appendedPTS=v,d.start=d.startPTS=x,d.maxStartPTS=h,d.startDTS=f,d.endPTS=v,d.minEndPTS=p,d.endDTS=l;var y=d.sn;if(!u||y<u.startSN||y>u.endSN)return 0;var M,H=y-u.startSN,V=u.fragments;for(V[H]=d,M=H;M>0;M--)O(V[M],V[M-1]);for(M=H;M<V.length-1;M++)O(V[M],V[M+1]);return u.fragmentHint&&O(V[V.length-1],u.fragmentHint),u.PTSKnown=u.alignedSliding=!0,m}function E(u,d){for(var x=null,v=u.fragments,f=v.length-1;f>=0;f--){var l=v[f].initSegment;if(l){x=l;break}}u.fragmentHint&&delete u.fragmentHint.endPTS;var b=0,h;if(P(u,d,function(M,H){M.relurl&&(b=M.cc-H.cc),Object(X.isFiniteNumber)(M.startPTS)&&Object(X.isFiniteNumber)(M.endPTS)&&(H.start=H.startPTS=M.startPTS,H.startDTS=M.startDTS,H.appendedPTS=M.appendedPTS,H.maxStartPTS=M.maxStartPTS,H.endPTS=M.endPTS,H.endDTS=M.endDTS,H.minEndPTS=M.minEndPTS,H.duration=M.endPTS-M.startPTS,H.duration&&(h=H),d.PTSKnown=d.alignedSliding=!0),H.elementaryStreams=M.elementaryStreams,H.loader=M.loader,H.stats=M.stats,H.urlId=M.urlId,M.initSegment&&(H.initSegment=M.initSegment,x=M.initSegment)}),x){var p=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments;p.forEach(function(M){var H;(!M.initSegment||M.initSegment.relurl===((H=x)===null||H===void 0?void 0:H.relurl))&&(M.initSegment=x)})}if(d.skippedSegments&&(d.deltaUpdateFailed=d.fragments.some(function(M){return!M}),d.deltaUpdateFailed)){I.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var s=d.skippedSegments;s--;)d.fragments.shift();d.startSN=d.fragments[0].sn,d.startCC=d.fragments[0].cc}var a=d.fragments;if(b){I.logger.warn("discontinuity sliding from playlist, take drift into account");for(var g=0;g<a.length;g++)a[g].cc+=b}d.skippedSegments&&(d.startCC=d.fragments[0].cc),w(u.partList,d.partList,function(M,H){H.elementaryStreams=M.elementaryStreams,H.stats=M.stats}),h?D(d,h,h.startPTS,h.endPTS,h.startDTS,h.endDTS):_(u,d),a.length&&(d.totalduration=d.edge-a[0].start),d.driftStartTime=u.driftStartTime,d.driftStart=u.driftStart;var m=d.advancedDateTime;if(d.advanced&&m){var y=d.edge;d.driftStart||(d.driftStartTime=m,d.driftStart=y),d.driftEndTime=m,d.driftEnd=y}else d.driftEndTime=u.driftEndTime,d.driftEnd=u.driftEnd,d.advancedDateTime=u.advancedDateTime}function w(u,d,x){if(u&&d)for(var v=0,f=0,l=u.length;f<=l;f++){var b=u[f],h=d[f+v];b&&h&&b.index===h.index&&b.fragment.sn===h.fragment.sn?x(b,h):v--}}function P(u,d,x){for(var v=d.skippedSegments,f=Math.max(u.startSN,d.startSN)-d.startSN,l=(u.fragmentHint?1:0)+(v?d.endSN:Math.min(u.endSN,d.endSN))-d.startSN,b=d.startSN-u.startSN,h=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments,p=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,s=f;s<=l;s++){var a=p[b+s],g=h[s];v&&!g&&s<v&&(g=d.fragments[s]=a),a&&g&&x(a,g)}}function _(u,d){var x=d.startSN+d.skippedSegments-u.startSN,v=u.fragments;if(x<0||x>=v.length)return;A(d,v[x].start)}function A(u,d){if(d){for(var x=u.fragments,v=u.skippedSegments;v<x.length;v++)x[v].start+=d;u.fragmentHint&&(u.fragmentHint.start+=d)}}function C(u,d){var x=1e3*u.levelTargetDuration,v=x/2,f=u.age,l=f>0&&f<x*3,b=d.loading.end-d.loading.start,h,p=u.availabilityDelay;if(u.updated===!1)if(l){var s=333*u.misses;h=Math.max(Math.min(v,b*2),s),u.availabilityDelay=(u.availabilityDelay||0)+h}else h=v;else l?(p=Math.min(p||x/2,f),u.availabilityDelay=p,h=p+x-f):h=x-b;return Math.round(h)}function c(u,d,x){if(!u||!u.details)return null;var v=u.details,f=v.fragments[d-v.startSN];return f||(f=v.fragmentHint,f&&f.sn===d?f:d<v.startSN&&x&&x.sn===d?x:null)}function o(u,d,x){if(!u||!u.details)return null;var v=u.details.partList;if(v)for(var f=v.length;f--;){var l=v[f];if(l.index===x&&l.fragment.sn===d)return l}return null}},"./src/controller/stream-controller.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return v});var X=L("./src/polyfills/number.ts"),I=L("./src/controller/base-stream-controller.ts"),k=L("./src/is-supported.ts"),W=L("./src/events.ts"),F=L("./src/utils/buffer-helper.ts"),O=L("./src/controller/fragment-tracker.ts"),D=L("./src/types/loader.ts"),E=L("./src/loader/fragment.ts"),w=L("./src/demux/transmuxer-interface.ts"),P=L("./src/types/transmuxer.ts"),_=L("./src/controller/gap-controller.ts"),A=L("./src/errors.ts"),C=L("./src/utils/logger.ts");function c(f,l){for(var b=0;b<l.length;b++){var h=l[b];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(f,h.key,h)}}function o(f,l,b){return l&&c(f.prototype,l),b&&c(f,b),f}function u(f,l){f.prototype=Object.create(l.prototype),f.prototype.constructor=f,d(f,l)}function d(f,l){return d=Object.setPrototypeOf||function(h,p){return h.__proto__=p,h},d(f,l)}var x=100,v=function(f){u(l,f);function l(h,p){var s;return s=f.call(this,h,p,"[stream-controller]")||this,s.audioCodecSwap=!1,s.gapController=null,s.level=-1,s._forceStartLoad=!1,s.altAudio=!1,s.audioOnly=!1,s.fragPlaying=null,s.onvplaying=null,s.onvseeked=null,s.fragLastKbps=0,s.stalled=!1,s.couldBacktrack=!1,s.audioCodecSwitch=!1,s.videoBuffer=null,s._registerListeners(),s}var b=l.prototype;return b._registerListeners=function(){var p=this.hls;p.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),p.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),p.on(W.Events.LEVEL_LOADING,this.onLevelLoading,this),p.on(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.on(W.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),p.on(W.Events.ERROR,this.onError,this),p.on(W.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),p.on(W.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.on(W.Events.BUFFER_CREATED,this.onBufferCreated,this),p.on(W.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),p.on(W.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),p.on(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b._unregisterListeners=function(){var p=this.hls;p.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),p.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),p.off(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.off(W.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),p.off(W.Events.ERROR,this.onError,this),p.off(W.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),p.off(W.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.off(W.Events.BUFFER_CREATED,this.onBufferCreated,this),p.off(W.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),p.off(W.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),p.off(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},b.startLoad=function(p){if(this.levels){var s=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(x),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var g=a.startLevel;g===-1&&(a.config.testBandwidth?(g=0,this.bitrateTest=!0):g=a.nextAutoLevel),this.level=a.nextLoadLevel=g,this.loadedmetadata=!1}s>0&&p===-1&&(this.log("Override startPosition with lastCurrentTime @"+s.toFixed(3)),p=s),this.state=I.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=p,this.tick()}else this._forceStartLoad=!0,this.state=I.State.STOPPED},b.stopLoad=function(){this._forceStartLoad=!1,f.prototype.stopLoad.call(this)},b.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_LEVEL:{var p,s=this.levels,a=this.level,g=s==null||((p=s[a])===null||p===void 0)?void 0:p.details;if(g&&(!g.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(g))break;this.state=I.State.IDLE;break}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var m,y=self.performance.now(),M=this.retryDate;(!M||y>=M||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=I.State.IDLE)}break;default:break}this.onTickEnd()},b.onTickEnd=function(){f.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},b.doTickIdle=function(){var p,s,a=this.hls,g=this.levelLastLoaded,m=this.levels,y=this.media,M=a.config,H=a.nextLoadLevel;if(g===null||!y&&(this.startFragRequested||!M.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!m||!m[H])return;var V=m[H];this.level=a.nextLoadLevel=H;var te=V.details;if(!te||this.state===I.State.WAITING_LEVEL||te.live&&this.levelLastLoaded!==H){this.state=I.State.WAITING_LEVEL;return}var G=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:y,D.PlaylistLevelType.MAIN);if(G===null)return;var j=G.len,ie=this.getMaxBufferLength(V.maxBitrate);if(j>=ie)return;if(this._streamEnded(G,te)){var pe={};this.altAudio&&(pe.type="video"),this.hls.trigger(W.Events.BUFFER_EOS,pe),this.state=I.State.ENDED;return}var ge=G.end,be=this.getNextFragment(ge,te);if(this.couldBacktrack&&!this.fragPrevious&&be&&be.sn!=="initSegment"){var Ne=be.sn-te.startSN;Ne>1&&(be=te.fragments[Ne-1],this.fragmentTracker.removeFragment(be))}if(be&&this.fragmentTracker.getState(be)===O.FragmentState.OK&&this.nextLoadPosition>ge){var Se=this.audioOnly&&!this.altAudio?E.ElementaryStreamTypes.AUDIO:E.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(y,Se,D.PlaylistLevelType.MAIN),be=this.getNextFragment(this.nextLoadPosition,te)}if(!be)return;be.initSegment&&!be.initSegment.data&&!this.bitrateTest&&(be=be.initSegment),((p=be.decryptdata)===null||p===void 0?void 0:p.keyFormat)==="identity"&&!((s=be.decryptdata)!==null&&s!==void 0&&s.key)?this.loadKey(be,te):this.loadFragment(be,te,ge)},b.loadFragment=function(p,s,a){var g,m=this.fragmentTracker.getState(p);if(this.fragCurrent=p,m===O.FragmentState.BACKTRACKED){var y=this.fragmentTracker.getBacktrackData(p);if(y){this._handleFragmentLoadProgress(y),this._handleFragmentLoadComplete(y);return}else m=O.FragmentState.NOT_LOADED}m===O.FragmentState.NOT_LOADED||m===O.FragmentState.PARTIAL?p.sn==="initSegment"?this._loadInitSegment(p):this.bitrateTest?(p.bitrateTest=!0,this.log("Fragment "+p.sn+" of level "+p.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(p)):(this.startFragRequested=!0,f.prototype.loadFragment.call(this,p,s,a)):m===O.FragmentState.APPENDING?this.reduceMaxBufferLength(p.duration)&&this.fragmentTracker.removeFragment(p):((g=this.media)===null||g===void 0?void 0:g.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},b.getAppendedFrag=function(p){var s=this.fragmentTracker.getAppendedFrag(p,D.PlaylistLevelType.MAIN);return s&&"fragment"in s?s.fragment:s},b.getBufferedFrag=function(p){return this.fragmentTracker.getBufferedFrag(p,D.PlaylistLevelType.MAIN)},b.followingBufferedFrag=function(p){return p?this.getBufferedFrag(p.end+.5):null},b.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},b.nextLevelSwitch=function(){var p=this.levels,s=this.media;if(s!=null&&s.readyState){var a,g=this.getAppendedFrag(s.currentTime);if(g&&g.start>1&&this.flushMainBuffer(0,g.start-1),!s.paused&&p){var m=this.hls.nextLoadLevel,y=p[m],M=this.fragLastKbps;M&&this.fragCurrent?a=this.fragCurrent.duration*y.maxBitrate/(1e3*M)+1:a=0}else a=0;var H=this.getBufferedFrag(s.currentTime+a);if(H){var V=this.followingBufferedFrag(H);if(V){this.abortCurrentFrag();var te=V.maxStartPTS?V.maxStartPTS:V.start,G=V.duration,j=Math.max(H.end,te+Math.min(Math.max(G-this.config.maxFragLookUpTolerance,G*.5),G*.75));this.flushMainBuffer(j,Number.POSITIVE_INFINITY)}}}},b.abortCurrentFrag=function(){var p=this.fragCurrent;this.fragCurrent=null,p!=null&&p.loader&&p.loader.abort(),this.state===I.State.KEY_LOADING&&(this.state=I.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},b.flushMainBuffer=function(p,s){f.prototype.flushMainBuffer.call(this,p,s,this.altAudio?"video":null)},b.onMediaAttached=function(p,s){f.prototype.onMediaAttached.call(this,p,s);var a=s.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new _.default(this.config,a,this.fragmentTracker,this.hls)},b.onMediaDetaching=function(){var p=this.media;p&&(p.removeEventListener("playing",this.onvplaying),p.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),f.prototype.onMediaDetaching.call(this)},b.onMediaPlaying=function(){this.tick()},b.onMediaSeeked=function(){var p=this.media,s=p?p.currentTime:null;Object(X.isFiniteNumber)(s)&&this.log("Media seeked to "+s.toFixed(3)),this.tick()},b.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(W.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},b.onManifestParsed=function(p,s){var a=!1,g=!1,m;s.levels.forEach(function(y){m=y.audioCodec,m&&(m.indexOf("mp4a.40.2")!==-1&&(a=!0),m.indexOf("mp4a.40.5")!==-1&&(g=!0))}),this.audioCodecSwitch=a&&g&&!Object(k.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=s.levels,this.startFragRequested=!1},b.onLevelLoading=function(p,s){var a=this.levels;if(!a||this.state!==I.State.IDLE)return;var g=a[s.level];(!g.details||g.details.live&&this.levelLastLoaded!==s.level||this.waitForCdnTuneIn(g.details))&&(this.state=I.State.WAITING_LEVEL)},b.onLevelLoaded=function(p,s){var a,g=this.levels,m=s.level,y=s.details,M=y.totalduration;if(!g){this.warn("Levels were reset while loading level "+m);return}this.log("Level "+m+" loaded ["+y.startSN+","+y.endSN+"], cc ["+y.startCC+", "+y.endCC+"] duration:"+M);var H=this.fragCurrent;H&&(this.state===I.State.FRAG_LOADING||this.state===I.State.FRAG_LOADING_WAITING_RETRY)&&(H.level!==s.level&&H.loader&&(this.state=I.State.IDLE,H.loader.abort()));var V=g[m],te=0;if(y.live||(a=V.details)!==null&&a!==void 0&&a.live){if(y.fragments[0]||(y.deltaUpdateFailed=!0),y.deltaUpdateFailed)return;te=this.alignPlaylists(y,V.details)}if(V.details=y,this.levelLastLoaded=m,this.hls.trigger(W.Events.LEVEL_UPDATED,{details:y,level:m}),this.state===I.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(y))return;this.state=I.State.IDLE}this.startFragRequested?y.live&&this.synchronizeToLiveEdge(y):this.setStartPosition(y,te),this.tick()},b._handleFragmentLoadProgress=function(p){var s,a=p.frag,g=p.part,m=p.payload,y=this.levels;if(!y){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var M=y[a.level],H=M.details;if(!H){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var V=M.videoCodec,te=H.PTSKnown||!H.live,G=(s=a.initSegment)===null||s===void 0?void 0:s.data,j=this._getAudioCodec(M),ie=this.transmuxer=this.transmuxer||new w.default(this.hls,D.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),pe=g?g.index:-1,ge=pe!==-1,be=new P.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,m.byteLength,pe,ge),Ne=this.initPTS[a.cc];ie.push(m,G,j,V,a,g,H.totalduration,te,be,Ne)},b.onAudioTrackSwitching=function(p,s){var a=this.altAudio,g=!!s.url,m=s.id;if(!g){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var y=this.fragCurrent;y!=null&&y.loader&&(this.log("Switching to main audio track, cancel main fragment load"),y.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var M=this.hls;a&&M.trigger(W.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),M.trigger(W.Events.AUDIO_TRACK_SWITCHED,{id:m})}},b.onAudioTrackSwitched=function(p,s){var a=s.id,g=!!this.hls.audioTracks[a].url;if(g){var m=this.videoBuffer;m&&this.mediaBuffer!==m&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=m)}this.altAudio=g,this.tick()},b.onBufferCreated=function(p,s){var a=s.tracks,g,m,y=!1;for(var M in a){var H=a[M];if(H.id==="main"){if(m=M,g=H,M==="video"){var V=a[M];V&&(this.videoBuffer=V.buffer)}}else y=!0}y&&g?(this.log("Alternate track found, use "+m+".buffered to schedule main fragment loading"),this.mediaBuffer=g.buffer):this.mediaBuffer=this.media},b.onFragBuffered=function(p,s){var a=s.frag,g=s.part;if(a&&a.type!==D.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(g?" p: "+g.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===I.State.PARSED&&(this.state=I.State.IDLE);return}var m=g?g.stats:a.stats;this.fragLastKbps=Math.round(8*m.total/(m.buffering.end-m.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,g)},b.onError=function(p,s){switch(s.details){case A.ErrorDetails.FRAG_LOAD_ERROR:case A.ErrorDetails.FRAG_LOAD_TIMEOUT:case A.ErrorDetails.KEY_LOAD_ERROR:case A.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(D.PlaylistLevelType.MAIN,s);break;case A.ErrorDetails.LEVEL_LOAD_ERROR:case A.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==I.State.ERROR&&(s.fatal?(this.warn(""+s.details),this.state=I.State.ERROR):!s.levelRetry&&this.state===I.State.WAITING_LEVEL&&(this.state=I.State.IDLE));break;case A.ErrorDetails.BUFFER_FULL_ERROR:if(s.parent==="main"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var a=!0,g=this.getFwdBufferInfo(this.media,D.PlaylistLevelType.MAIN);g&&g.len>.5&&(a=!this.reduceMaxBufferLength(g.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},b.checkBuffer=function(){var p=this.media,s=this.gapController;if(!p||!s||!p.readyState)return;var a=F.BufferHelper.getBuffered(p);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):s.poll(this.lastCurrentTime),this.lastCurrentTime=p.currentTime},b.onFragLoadEmergencyAborted=function(){this.state=I.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},b.onBufferFlushed=function(p,s){var a=s.type;if(a!==E.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var g=(a===E.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(g,a,D.PlaylistLevelType.MAIN)}},b.onLevelsUpdated=function(p,s){this.levels=s.levels},b.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},b.seekToStartPos=function(){var p=this.media,s=p.currentTime,a=this.startPosition;if(a>=0&&s<a){if(p.seeking){C.logger.log("could not seek to "+a+", already seeking at "+s);return}var g=F.BufferHelper.getBuffered(p),m=g.length?g.start(0):0,y=m-a;y>0&&(y<this.config.maxBufferHole||y<this.config.maxFragLookUpTolerance)&&(C.logger.log("adjusting start position by "+y+" to match buffer start"),a+=y,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+s),p.currentTime=a}},b._getAudioCodec=function(p){var s=this.config.defaultAudioCodec||p.audioCodec;return this.audioCodecSwap&&s&&(this.log("Swapping audio codec"),s.indexOf("mp4a.40.5")!==-1?s="mp4a.40.2":s="mp4a.40.5"),s},b._loadBitrateTestFrag=function(p){var s=this;this._doFragLoad(p).then(function(a){var g=s.hls;if(!a||g.nextLoadLevel||s.fragContextChanged(p))return;s.fragLoadError=0,s.state=I.State.IDLE,s.startFragRequested=!1,s.bitrateTest=!1;var m=p.stats;m.parsing.start=m.parsing.end=m.buffering.start=m.buffering.end=self.performance.now(),g.trigger(W.Events.FRAG_LOADED,a)})},b._handleTransmuxComplete=function(p){var s,a="main",g=this.hls,m=p.remuxResult,y=p.chunkMeta,M=this.getCurrentContext(y);if(!M){this.warn("The loading context changed while buffering fragment "+y.sn+" of level "+y.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(y.level);return}var H=M.frag,V=M.part,te=M.level,G=m.video,j=m.text,ie=m.id3,pe=m.initSegment,ge=this.altAudio?void 0:m.audio;if(this.fragContextChanged(H))return;if(this.state=I.State.PARSING,pe){pe.tracks&&(this._bufferInitSegment(te,pe.tracks,H,y),g.trigger(W.Events.FRAG_PARSING_INIT_SEGMENT,{frag:H,id:a,tracks:pe.tracks}));var be=pe.initPTS,Ne=pe.timescale;Object(X.isFiniteNumber)(be)&&(this.initPTS[H.cc]=be,g.trigger(W.Events.INIT_PTS_FOUND,{frag:H,id:a,initPTS:be,timescale:Ne}))}if(G&&m.independent!==!1){if(te.details){var Se=G.startPTS,Me=G.endPTS,Le=G.startDTS,we=G.endDTS;if(V)V.elementaryStreams[G.type]={startPTS:Se,endPTS:Me,startDTS:Le,endDTS:we};else if(G.firstKeyFrame&&G.independent&&(this.couldBacktrack=!0),G.dropped&&G.independent){var ve=this.getLoadPosition()+this.config.maxBufferHole;if(ve<Se){this.backtrack(H);return}H.setElementaryStreamInfo(G.type,H.start,Me,H.start,we,!0)}H.setElementaryStreamInfo(G.type,Se,Me,Le,we),this.bufferFragmentData(G,H,V,y)}}else if(m.independent===!1){this.backtrack(H);return}if(ge){var N=ge.startPTS,T=ge.endPTS,R=ge.startDTS,z=ge.endDTS;V&&(V.elementaryStreams[E.ElementaryStreamTypes.AUDIO]={startPTS:N,endPTS:T,startDTS:R,endDTS:z}),H.setElementaryStreamInfo(E.ElementaryStreamTypes.AUDIO,N,T,R,z),this.bufferFragmentData(ge,H,V,y)}if(ie!=null&&(s=ie.samples)!==null&&s!==void 0&&s.length){var Z={frag:H,id:a,samples:ie.samples};g.trigger(W.Events.FRAG_PARSING_METADATA,Z)}if(j){var B={frag:H,id:a,samples:j.samples};g.trigger(W.Events.FRAG_PARSING_USERDATA,B)}},b._bufferInitSegment=function(p,s,a,g){var m=this;if(this.state!==I.State.PARSING)return;this.audioOnly=!!s.audio&&!s.video,this.altAudio&&!this.audioOnly&&delete s.audio;var y=s.audio,M=s.video,H=s.audiovideo;if(y){var V=p.audioCodec,te=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(V&&(V.indexOf("mp4a.40.5")!==-1?V="mp4a.40.2":V="mp4a.40.5"),y.metadata.channelCount!==1&&te.indexOf("firefox")===-1&&(V="mp4a.40.5")),te.indexOf("android")!==-1&&y.container!=="audio/mpeg"&&(V="mp4a.40.2",this.log("Android: force audio codec to "+V)),p.audioCodec&&p.audioCodec!==V&&this.log('Swapping manifest audio codec "'+p.audioCodec+'" for "'+V+'"'),y.levelCodec=V,y.id="main",this.log("Init audio buffer, container:"+y.container+", codecs[selected/level/parsed]=["+(V||"")+"/"+(p.audioCodec||"")+"/"+y.codec+"]")}M&&(M.levelCodec=p.videoCodec,M.id="main",this.log("Init video buffer, container:"+M.container+", codecs[level/parsed]=["+(p.videoCodec||"")+"/"+M.codec+"]")),H&&this.log("Init audiovideo buffer, container:"+H.container+", codecs[level/parsed]=["+(p.attrs.CODECS||"")+"/"+H.codec+"]"),this.hls.trigger(W.Events.BUFFER_CODECS,s),Object.keys(s).forEach(function(G){var j=s[G],ie=j.initSegment;ie!=null&&ie.byteLength&&m.hls.trigger(W.Events.BUFFER_APPENDING,{type:G,data:ie,frag:a,part:null,chunkMeta:g,parent:a.type})}),this.tick()},b.backtrack=function(p){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(p);var s=this.fragmentTracker.backtrack(p);this.fragPrevious=null,this.nextLoadPosition=p.start,s?this.resetFragmentLoading(p):this.state=I.State.BACKTRACKING},b.checkFragmentChanged=function(){var p=this.media,s=null;if(p&&p.readyState>1&&p.seeking===!1){var a=p.currentTime;if(F.BufferHelper.isBuffered(p,a)?s=this.getAppendedFrag(a):F.BufferHelper.isBuffered(p,a+.1)&&(s=this.getAppendedFrag(a+.1)),s){var g=this.fragPlaying,m=s.level;(!g||s.sn!==g.sn||g.level!==m||s.urlId!==g.urlId)&&(this.hls.trigger(W.Events.FRAG_CHANGED,{frag:s}),(!g||g.level!==m)&&this.hls.trigger(W.Events.LEVEL_SWITCHED,{level:m}),this.fragPlaying=s)}}},o(l,[{key:"nextLevel",get:function(){var p=this.nextBufferedFrag;return p?p.level:-1}},{key:"currentLevel",get:function(){var p=this.media;if(p){var s=this.getAppendedFrag(p.currentTime);if(s)return s.level}return-1}},{key:"nextBufferedFrag",get:function(){var p=this.media;if(p){var s=this.getAppendedFrag(p.currentTime);return this.followingBufferedFrag(s)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),l}(I.default)},"./src/controller/subtitle-stream-controller.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"SubtitleStreamController",function(){return u});var X=L("./src/events.ts"),I=L("./src/utils/logger.ts"),k=L("./src/utils/buffer-helper.ts"),W=L("./src/controller/fragment-finders.ts"),F=L("./src/utils/discontinuities.ts"),O=L("./src/controller/level-helper.ts"),D=L("./src/controller/fragment-tracker.ts"),E=L("./src/controller/base-stream-controller.ts"),w=L("./src/types/loader.ts"),P=L("./src/types/level.ts");function _(d,x){for(var v=0;v<x.length;v++){var f=x[v];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(d,f.key,f)}}function A(d,x,v){return x&&_(d.prototype,x),v&&_(d,v),d}function C(d,x){d.prototype=Object.create(x.prototype),d.prototype.constructor=d,c(d,x)}function c(d,x){return c=Object.setPrototypeOf||function(f,l){return f.__proto__=l,f},c(d,x)}var o=500,u=function(d){C(x,d);function x(f,l){var b;return b=d.call(this,f,l,"[subtitle-stream-controller]")||this,b.levels=[],b.currentTrackId=-1,b.tracksBuffered=[],b.mainDetails=null,b._registerListeners(),b}var v=x.prototype;return v.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},v._registerListeners=function(){var l=this.hls;l.on(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.on(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(X.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(X.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(X.Events.ERROR,this.onError,this),l.on(X.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(X.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),l.on(X.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),l.on(X.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),l.on(X.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v._unregisterListeners=function(){var l=this.hls;l.off(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.off(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(X.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(X.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(X.Events.ERROR,this.onError,this),l.off(X.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.off(X.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),l.off(X.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),l.off(X.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),l.off(X.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v.startLoad=function(){this.stopLoad(),this.state=E.State.IDLE,this.setInterval(o),this.tick()},v.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},v.onLevelLoaded=function(l,b){this.mainDetails=b.details},v.onSubtitleFragProcessed=function(l,b){var h=b.frag,p=b.success;if(this.fragPrevious=h,this.state=E.State.IDLE,!p)return;var s=this.tracksBuffered[this.currentTrackId];if(!s)return;for(var a,g=h.start,m=0;m<s.length;m++)if(g>=s[m].start&&g<=s[m].end){a=s[m];break}var y=h.start+h.duration;a?a.end=y:(a={start:g,end:y},s.push(a)),this.fragmentTracker.fragBuffered(h)},v.onBufferFlushing=function(l,b){var h=b.startOffset,p=b.endOffset;if(h===0&&p!==Number.POSITIVE_INFINITY){var s=this.currentTrackId,a=this.levels;if(!a.length||!a[s]||!a[s].details)return;var g=a[s].details,m=g.targetduration,y=p-m;if(y<=0)return;b.endOffsetSubtitles=Math.max(0,y),this.tracksBuffered.forEach(function(M){for(var H=0;H<M.length;){if(M[H].end<=y){M.shift();continue}else if(M[H].start<y)M[H].start=y;else break;H++}}),this.fragmentTracker.removeFragmentsInRange(h,y,w.PlaylistLevelType.SUBTITLE)}},v.onError=function(l,b){var h,p=b.frag;if(!p||p.type!==w.PlaylistLevelType.SUBTITLE)return;(h=this.fragCurrent)!==null&&h!==void 0&&h.loader&&this.fragCurrent.loader.abort(),this.state=E.State.IDLE},v.onSubtitleTracksUpdated=function(l,b){var h=this,p=b.subtitleTracks;this.tracksBuffered=[],this.levels=p.map(function(s){return new P.Level(s)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(s){h.tracksBuffered[s.id]=[]}),this.mediaBuffer=null},v.onSubtitleTrackSwitch=function(l,b){if(this.currentTrackId=b.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var h=this.levels[this.currentTrackId];h!=null&&h.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,h&&this.setInterval(o)},v.onSubtitleTrackLoaded=function(l,b){var h,p=b.details,s=b.id,a=this.currentTrackId,g=this.levels;if(!g.length)return;var m=g[a];if(s>=g.length||s!==a||!m)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,p.live||(h=m.details)!==null&&h!==void 0&&h.live){var y=this.mainDetails;if(p.deltaUpdateFailed||!y)return;var M=y.fragments[0];if(!m.details)p.hasProgramDateTime&&y.hasProgramDateTime?Object(F.alignMediaPlaylistByPDT)(p,y):M&&Object(O.addSliding)(p,M.start);else{var H=this.alignPlaylists(p,m.details);H===0&&M&&Object(O.addSliding)(p,M.start)}}if(m.details=p,this.levelLastLoaded=s,this.tick(),p.live&&!this.fragCurrent&&this.media&&this.state===E.State.IDLE){var V=Object(W.findFragmentByPTS)(null,p.fragments,this.media.currentTime,0);V||(this.warn("Subtitle playlist not aligned with playback"),m.details=void 0)}},v._handleFragmentLoadComplete=function(l){var b=l.frag,h=l.payload,p=b.decryptdata,s=this.hls;if(this.fragContextChanged(b))return;if(h&&h.byteLength>0&&p&&p.key&&p.iv&&p.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(h),p.key.buffer,p.iv.buffer).then(function(g){var m=performance.now();s.trigger(X.Events.FRAG_DECRYPTED,{frag:b,payload:g,stats:{tstart:a,tdecrypt:m}})})}},v.doTick=function(){if(!this.media){this.state=E.State.IDLE;return}if(this.state===E.State.IDLE){var l,b=this.currentTrackId,h=this.levels;if(!h.length||!h[b]||!h[b].details)return;var p=h[b].details,s=p.targetduration,a=this.config,g=this.media,m=k.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,g.currentTime-s,a.maxBufferHole),y=m.end,M=m.len,H=this.getMaxBufferLength()+s;if(M>H)return;console.assert(p,"Subtitle track details are defined on idle subtitle stream controller tick");var V=p.fragments,te=V.length,G=p.edge,j,ie=this.fragPrevious;if(y<G){var pe=a.maxFragLookUpTolerance;ie&&p.hasProgramDateTime&&(j=Object(W.findFragmentByPDT)(V,ie.endProgramDateTime,pe)),j||(j=Object(W.findFragmentByPTS)(ie,V,y,pe),!j&&ie&&ie.start<V[0].start&&(j=V[0]))}else j=V[te-1];(l=j)!==null&&l!==void 0&&l.encrypted?(I.logger.log("Loading key for "+j.sn),this.state=E.State.KEY_LOADING,this.hls.trigger(X.Events.KEY_LOADING,{frag:j})):j&&this.fragmentTracker.getState(j)===D.FragmentState.NOT_LOADED&&this.loadFragment(j,p,y)}},v.loadFragment=function(l,b,h){this.fragCurrent=l,d.prototype.loadFragment.call(this,l,b,h)},A(x,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),x}(E.default)},"./src/controller/subtitle-track-controller.ts":function(he,Y,L){"use strict";L.r(Y);var X=L("./src/events.ts"),I=L("./src/utils/texttrack-utils.ts"),k=L("./src/controller/base-playlist-controller.ts"),W=L("./src/types/loader.ts");function F(_,A){for(var C=0;C<A.length;C++){var c=A[C];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(_,c.key,c)}}function O(_,A,C){return A&&F(_.prototype,A),C&&F(_,C),_}function D(_,A){_.prototype=Object.create(A.prototype),_.prototype.constructor=_,E(_,A)}function E(_,A){return E=Object.setPrototypeOf||function(c,o){return c.__proto__=o,c},E(_,A)}var w=function(_){D(A,_);function A(c){var o;return o=_.call(this,c,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var C=A.prototype;return C.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,_.prototype.destroy.call(this)},C.registerListeners=function(){var o=this.hls;o.on(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(X.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(X.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(X.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(X.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(X.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(X.Events.ERROR,this.onError,this)},C.unregisterListeners=function(){var o=this.hls;o.off(X.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(X.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(X.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(X.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(X.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(X.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(X.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(X.Events.ERROR,this.onError,this)},C.onMediaAttached=function(o,u){if(this.media=u.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},C.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},C.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var o=P(this.media.textTracks);o.forEach(function(u){Object(I.clearCurrentCues)(u)}),this.subtitleTrack=-1,this.media=null},C.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},C.onManifestParsed=function(o,u){this.tracks=u.subtitleTracks},C.onSubtitleTrackLoaded=function(o,u){var d=u.id,x=u.details,v=this.trackId,f=this.tracksInGroup[v];if(!f){this.warn("Invalid subtitle track id "+d);return}var l=f.details;f.details=u.details,this.log("subtitle track "+d+" loaded ["+x.startSN+"-"+x.endSN+"]"),d===this.trackId&&(this.retryCount=0,this.playlistLoaded(d,u,l))},C.onLevelLoading=function(o,u){this.switchLevel(u.level)},C.onLevelSwitching=function(o,u){this.switchLevel(u.level)},C.switchLevel=function(o){var u=this.hls.levels[o];if(!(u!=null&&u.textGroupIds))return;var d=u.textGroupIds[u.urlId];if(this.groupId!==d){var x=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,v=this.tracks.filter(function(b){return!d||b.groupId===d});this.tracksInGroup=v;var f=this.findTrackId(x==null?void 0:x.name)||this.findTrackId();this.groupId=d;var l={subtitleTracks:v};this.log("Updating subtitle tracks, "+v.length+' track(s) found in "'+d+'" group-id'),this.hls.trigger(X.Events.SUBTITLE_TRACKS_UPDATED,l),f!==-1&&this.setSubtitleTrack(f,x)}},C.findTrackId=function(o){for(var u=this.tracksInGroup,d=0;d<u.length;d++){var x=u[d];if((!this.selectDefaultTrack||x.default)&&(!o||o===x.name))return x.id}return-1},C.onError=function(o,u){if(_.prototype.onError.call(this,o,u),u.fatal||!u.context)return;u.context.type===W.PlaylistContextType.SUBTITLE_TRACK&&u.context.id===this.trackId&&u.context.groupId===this.groupId&&this.retryLoadingOrFail(u)},C.loadPlaylist=function(o){var u=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(u)){var d=u.id,x=u.groupId,v=u.url;if(o)try{v=o.addDirectives(v)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("Loading subtitle playlist for id "+d),this.hls.trigger(X.Events.SUBTITLE_TRACK_LOADING,{url:v,id:d,groupId:x,deliveryDirectives:o||null})}},C.toggleTrackModes=function(o){var u=this,d=this.media,x=this.subtitleDisplay,v=this.trackId;if(!d)return;var f=P(d.textTracks),l=f.filter(function(p){return p.groupId===u.groupId});if(o===-1)[].slice.call(f).forEach(function(p){p.mode="disabled"});else{var b=l[v];b&&(b.mode="disabled")}var h=l[o];h&&(h.mode=x?"showing":"hidden")},C.setSubtitleTrack=function(o,u){var d,x=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(d=x[o])!==null&&d!==void 0&&d.details)||o<-1||o>=x.length)return;this.clearTimer();var v=x[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,v){var f=v.id,l=v.groupId,b=l===void 0?"":l,h=v.name,p=v.type,s=v.url;this.hls.trigger(X.Events.SUBTITLE_TRACK_SWITCH,{id:f,groupId:b,name:h,type:p,url:s});var a=this.switchParams(v.url,u==null?void 0:u.details);this.loadPlaylist(a)}else this.hls.trigger(X.Events.SUBTITLE_TRACK_SWITCH,{id:o})},C.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,u=P(this.media.textTracks),d=0;d<u.length;d++)if(u[d].mode==="hidden")o=d;else if(u[d].mode==="showing"){o=d;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},O(A,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var u=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,u)}}]),A}(k.default);function P(_){for(var A=[],C=0;C<_.length;C++){var c=_[C];c.kind==="subtitles"&&c.label&&A.push(_[C])}return A}Y.default=w},"./src/controller/timeline-controller.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"TimelineController",function(){return P});var X=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),k=L("./src/utils/cea-608-parser.ts"),W=L("./src/utils/output-filter.ts"),F=L("./src/utils/webvtt-parser.ts"),O=L("./src/utils/texttrack-utils.ts"),D=L("./src/utils/imsc1-ttml-parser.ts"),E=L("./src/types/loader.ts"),w=L("./src/utils/logger.ts"),P=function(){function c(u){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=C(),this.captionsProperties=void 0,this.hls=u,this.config=u.config,this.Cues=u.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var d=new W.default(this,"textTrack1"),x=new W.default(this,"textTrack2"),v=new W.default(this,"textTrack3"),f=new W.default(this,"textTrack4");this.cea608Parser1=new k.default(1,d,x),this.cea608Parser2=new k.default(3,v,f)}u.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.on(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.on(I.Events.FRAG_LOADING,this.onFragLoading,this),u.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(I.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.on(I.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.on(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(I.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=c.prototype;return o.destroy=function(){var d=this.hls;d.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.off(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),d.off(I.Events.FRAG_LOADING,this.onFragLoading,this),d.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(I.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),d.off(I.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),d.off(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(I.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),d.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(d,x,v,f,l){for(var b=!1,h=l.length;h--;){var p=l[h],s=A(p[0],p[1],x,v);if(s>=0&&(p[0]=Math.min(p[0],x),p[1]=Math.max(p[1],v),b=!0,s/(v-x)>.5))return}if(b||l.push([x,v]),this.config.renderTextTracksNatively){var a=this.captionsTracks[d];this.Cues.newCue(a,x,v,f)}else{var g=this.Cues.newCue(null,x,v,f);this.hls.trigger(I.Events.CUES_PARSED,{type:"captions",cues:g,track:d})}},o.onInitPtsFound=function(d,x){var v=this,f=x.frag,l=x.id,b=x.initPTS,h=x.timescale,p=this.unparsedVttFrags;l==="main"&&(this.initPTS[f.cc]=b,this.timescale[f.cc]=h),p.length&&(this.unparsedVttFrags=[],p.forEach(function(s){v.onFragLoaded(I.Events.FRAG_LOADED,s)}))},o.getExistingTrack=function(d){var x=this.media;if(x)for(var v=0;v<x.textTracks.length;v++){var f=x.textTracks[v];if(f[d])return f}return null},o.createCaptionsTrack=function(d){this.config.renderTextTracksNatively?this.createNativeTrack(d):this.createNonNativeTrack(d)},o.createNativeTrack=function(d){if(this.captionsTracks[d])return;var x=this.captionsProperties,v=this.captionsTracks,f=this.media,l=x[d],b=l.label,h=l.languageCode,p=this.getExistingTrack(d);if(p)v[d]=p,Object(O.clearCurrentCues)(v[d]),Object(O.sendAddTrackEvent)(v[d],f);else{var s=this.createTextTrack("captions",b,h);s&&(s[d]=!0,v[d]=s)}},o.createNonNativeTrack=function(d){if(this.nonNativeCaptionsTracks[d])return;var x=this.captionsProperties[d];if(!x)return;var v=x.label,f={_id:d,label:v,kind:"captions",default:x.media?!!x.media.default:!1,closedCaptions:x.media};this.nonNativeCaptionsTracks[d]=f,this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[f]})},o.createTextTrack=function(d,x,v){var f=this.media;return f?f.addTextTrack(d,x,v):void 0},o.onMediaAttaching=function(d,x){this.media=x.media,this._cleanTracks()},o.onMediaDetaching=function(){var d=this.captionsTracks;Object.keys(d).forEach(function(x){Object(O.clearCurrentCues)(d[x]),delete d[x]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=C(),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())},o._cleanTracks=function(){var d=this.media;if(!d)return;var x=d.textTracks;if(x)for(var v=0;v<x.length;v++)Object(O.clearCurrentCues)(x[v])},o.onSubtitleTracksUpdated=function(d,x){var v=this;this.textTracks=[];var f=x.subtitleTracks||[],l=f.some(function(s){return s.textCodec===D.IMSC1_CODEC});if(this.config.enableWebVTT||l&&this.config.enableIMSC1){var b=this.tracks&&f&&this.tracks.length===f.length;if(this.tracks=f||[],this.config.renderTextTracksNatively){var h=this.media?this.media.textTracks:[];this.tracks.forEach(function(s,a){var g;if(a<h.length){for(var m=null,y=0;y<h.length;y++)if(_(h[y],s)){m=h[y];break}m&&(g=m)}g?Object(O.clearCurrentCues)(g):(g=v.createTextTrack("subtitles",s.name,s.lang),g&&(g.mode="disabled")),g&&(g.groupId=s.groupId,v.textTracks.push(g))})}else if(!b&&this.tracks&&this.tracks.length){var p=this.tracks.map(function(s){return{label:s.name,kind:s.type.toLowerCase(),default:s.default,subtitleTrack:s}});this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:p})}}},o.onManifestLoaded=function(d,x){var v=this;this.config.enableCEA708Captions&&x.captions&&x.captions.forEach(function(f){var l=/(?:CC|SERVICE)([1-4])/.exec(f.instreamId);if(!l)return;var b="textTrack"+l[1],h=v.captionsProperties[b];if(!h)return;h.label=f.name,f.lang&&(h.languageCode=f.lang),h.media=f})},o.onFragLoading=function(d,x){var v=this.cea608Parser1,f=this.cea608Parser2,l=this.lastSn,b=this.lastPartIndex;if(!this.enabled||!(v&&f))return;if(x.frag.type===E.PlaylistLevelType.MAIN){var h,p,s=x.frag.sn,a=(h=x==null||((p=x.part)===null||p===void 0)?void 0:p.index)!=null?h:-1;s===l+1||s===l&&a===b+1||(v.reset(),f.reset()),this.lastSn=s,this.lastPartIndex=a}},o.onFragLoaded=function(d,x){var v=x.frag,f=x.payload,l=this.initPTS,b=this.unparsedVttFrags;if(v.type===E.PlaylistLevelType.SUBTITLE)if(f.byteLength){if(!Object(X.isFiniteNumber)(l[v.cc])){b.push(x),l.length&&this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Missing initial subtitle PTS")});return}var h=v.decryptdata;if(h==null||h.key==null||h.method!=="AES-128"){var p=this.tracks[v.level],s=this.vttCCs;s[v.cc]||(s[v.cc]={start:v.start,prevCC:this.prevCC,new:!0},this.prevCC=v.cc),p&&p.textCodec===D.IMSC1_CODEC?this._parseIMSC1(v,f):this._parseVTTs(v,f,s)}}else this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(d,x){var v=this,f=this.hls;Object(D.parseIMSC1)(x,this.initPTS[d.cc],this.timescale[d.cc],function(l){v._appendCues(l,d.level),f.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(l){w.logger.log("Failed to parse IMSC1: "+l),f.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:l})})},o._parseVTTs=function(d,x,v){var f=this,l=this.hls;Object(F.parseWebVTT)(x,this.initPTS[d.cc],this.timescale[d.cc],v,d.cc,d.start,function(b){f._appendCues(b,d.level),l.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(b){f._fallbackToIMSC1(d,x),w.logger.log("Failed to parse VTT cue: "+b),l.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:b})})},o._fallbackToIMSC1=function(d,x){var v=this,f=this.tracks[d.level];f.textCodec||Object(D.parseIMSC1)(x,this.initPTS[d.cc],this.timescale[d.cc],function(){f.textCodec=D.IMSC1_CODEC,v._parseIMSC1(d,x)},function(){f.textCodec="wvtt"})},o._appendCues=function(d,x){var v=this.hls;if(this.config.renderTextTracksNatively){var f=this.textTracks[x];if(f.mode==="disabled")return;d.forEach(function(h){return Object(O.addCueToTrack)(f,h)})}else{var l=this.tracks[x],b=l.default?"default":"subtitles"+x;v.trigger(I.Events.CUES_PARSED,{type:"subtitles",cues:d,track:b})}},o.onFragDecrypted=function(d,x){var v=x.frag;if(v.type===E.PlaylistLevelType.SUBTITLE){if(!Object(X.isFiniteNumber)(this.initPTS[v.cc])){this.unparsedVttFrags.push(x);return}this.onFragLoaded(I.Events.FRAG_LOADED,x)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(d,x){var v=this.cea608Parser1,f=this.cea608Parser2;if(!this.enabled||!(v&&f))return;for(var l=0;l<x.samples.length;l++){var b=x.samples[l].bytes;if(b){var h=this.extractCea608Data(b);v.addData(x.samples[l].pts,h[0]),f.addData(x.samples[l].pts,h[1])}}},o.onBufferFlushing=function(d,x){var v=x.startOffset,f=x.endOffset,l=x.endOffsetSubtitles,b=x.type,h=this.media;if(!h||h.currentTime<f)return;if(!b||b==="video"){var p=this.captionsTracks;Object.keys(p).forEach(function(a){return Object(O.removeCuesInRange)(p[a],v,f)})}if(this.config.renderTextTracksNatively&&(v===0&&l!==void 0)){var s=this.textTracks;Object.keys(s).forEach(function(a){return Object(O.removeCuesInRange)(s[a],v,l)})}},o.extractCea608Data=function(d){for(var x=d[0]&31,v=2,f=[[],[]],l=0;l<x;l++){var b=d[v++],h=127&d[v++],p=127&d[v++],s=(4&b)!==0,a=3&b;if(h===0&&p===0)continue;s&&((a===0||a===1)&&(f[a].push(h),f[a].push(p)))}return f},c}();function _(c,o){return c&&c.label===o.name&&!(c.textTrack1||c.textTrack2)}function A(c,o,u,d){return Math.min(o,d)-Math.max(c,u)}function C(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return X});var X=function(){function I(W,F){this.subtle=void 0,this.aesIV=void 0,this.subtle=W,this.aesIV=F}var k=I.prototype;return k.decrypt=function(F,O){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},O,F)},I}()},"./src/crypt/aes-decryptor.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"removePadding",function(){return I}),L.d(Y,"default",function(){return k});var X=L("./src/utils/typed-array.ts");function I(W){var F=W.byteLength,O=F&&new DataView(W.buffer).getUint8(F-1);return O?Object(X.sliceUint8)(W,0,F-O):W}var k=function(){function W(){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 F=W.prototype;return F.uint8ArrayToUint32Array_=function(D){for(var E=new DataView(D),w=new Uint32Array(4),P=0;P<4;P++)w[P]=E.getUint32(P*4);return w},F.initTable=function(){var D=this.sBox,E=this.invSBox,w=this.subMix,P=w[0],_=w[1],A=w[2],C=w[3],c=this.invSubMix,o=c[0],u=c[1],d=c[2],x=c[3],v=new Uint32Array(256),f=0,l=0,b=0;for(b=0;b<256;b++)b<128?v[b]=b<<1:v[b]=b<<1^283;for(b=0;b<256;b++){var h=l^l<<1^l<<2^l<<3^l<<4;h=h>>>8^h&255^99,D[f]=h,E[h]=f;var p=v[f],s=v[p],a=v[s],g=v[h]*257^h*16843008;P[f]=g<<24|g>>>8,_[f]=g<<16|g>>>16,A[f]=g<<8|g>>>24,C[f]=g,g=a*16843009^s*65537^p*257^f*16843008,o[h]=g<<24|g>>>8,u[h]=g<<16|g>>>16,d[h]=g<<8|g>>>24,x[h]=g,f?(f=p^v[v[v[a^p]]],l^=v[v[l]]):f=l=1}},F.expandKey=function(D){for(var E=this.uint8ArrayToUint32Array_(D),w=!0,P=0;P<E.length&&w;)w=E[P]===this.key[P],P++;if(w)return;this.key=E;var _=this.keySize=E.length;if(_!==4&&_!==6&&_!==8)throw new Error("Invalid aes key size="+_);var A=this.ksRows=(_+6+1)*4,C,c,o=this.keySchedule=new Uint32Array(A),u=this.invKeySchedule=new Uint32Array(A),d=this.sBox,x=this.rcon,v=this.invSubMix,f=v[0],l=v[1],b=v[2],h=v[3],p,s;for(C=0;C<A;C++){if(C<_){p=o[C]=E[C];continue}s=p,C%_===0?(s=s<<8|s>>>24,s=d[s>>>24]<<24|d[s>>>16&255]<<16|d[s>>>8&255]<<8|d[s&255],s^=x[C/_|0]<<24):_>6&&C%_===4&&(s=d[s>>>24]<<24|d[s>>>16&255]<<16|d[s>>>8&255]<<8|d[s&255]),o[C]=p=(o[C-_]^s)>>>0}for(c=0;c<A;c++)C=A-c,c&3?s=o[C]:s=o[C-4],c<4||C<=4?u[c]=s:u[c]=f[d[s>>>24]]^l[d[s>>>16&255]]^b[d[s>>>8&255]]^h[d[s&255]],u[c]=u[c]>>>0},F.networkToHostOrderSwap=function(D){return D<<24|(D&65280)<<8|(D&16711680)>>8|D>>>24},F.decrypt=function(D,E,w){for(var P=this.keySize+6,_=this.invKeySchedule,A=this.invSBox,C=this.invSubMix,c=C[0],o=C[1],u=C[2],d=C[3],x=this.uint8ArrayToUint32Array_(w),v=x[0],f=x[1],l=x[2],b=x[3],h=new Int32Array(D),p=new Int32Array(h.length),s,a,g,m,y,M,H,V,te,G,j,ie,pe,ge,be=this.networkToHostOrderSwap;E<h.length;){for(te=be(h[E]),G=be(h[E+1]),j=be(h[E+2]),ie=be(h[E+3]),y=te^_[0],M=ie^_[1],H=j^_[2],V=G^_[3],pe=4,ge=1;ge<P;ge++)s=c[y>>>24]^o[M>>16&255]^u[H>>8&255]^d[V&255]^_[pe],a=c[M>>>24]^o[H>>16&255]^u[V>>8&255]^d[y&255]^_[pe+1],g=c[H>>>24]^o[V>>16&255]^u[y>>8&255]^d[M&255]^_[pe+2],m=c[V>>>24]^o[y>>16&255]^u[M>>8&255]^d[H&255]^_[pe+3],y=s,M=a,H=g,V=m,pe=pe+4;s=A[y>>>24]<<24^A[M>>16&255]<<16^A[H>>8&255]<<8^A[V&255]^_[pe],a=A[M>>>24]<<24^A[H>>16&255]<<16^A[V>>8&255]<<8^A[y&255]^_[pe+1],g=A[H>>>24]<<24^A[V>>16&255]<<16^A[y>>8&255]<<8^A[M&255]^_[pe+2],m=A[V>>>24]<<24^A[y>>16&255]<<16^A[M>>8&255]<<8^A[H&255]^_[pe+3],p[E]=be(s^v),p[E+1]=be(m^f),p[E+2]=be(g^l),p[E+3]=be(a^b),v=te,f=G,l=j,b=ie,E=E+4}return p.buffer},W}()},"./src/crypt/decrypter.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return E});var X=L("./src/crypt/aes-crypto.ts"),I=L("./src/crypt/fast-aes-key.ts"),k=L("./src/crypt/aes-decryptor.ts"),W=L("./src/utils/logger.ts"),F=L("./src/utils/mp4-tools.ts"),O=L("./src/utils/typed-array.ts"),D=16,E=function(){function w(_,A,C){var c=C===void 0?{}:C,o=c.removePKCS7Padding,u=o===void 0?!0:o;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=_,this.config=A,this.removePKCS7Padding=u,u)try{var d=self.crypto;d&&(this.subtle=d.subtle||d.webkitSubtle)}catch(x){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var P=w.prototype;return P.destroy=function(){this.observer=null},P.isSync=function(){return this.config.enableSoftwareAES},P.flush=function(){var A=this.currentResult;if(!A){this.reset();return}var C=new Uint8Array(A);return this.reset(),this.removePKCS7Padding?Object(k.removePadding)(C):C},P.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},P.decrypt=function(A,C,c,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(A),C,c);var u=this.flush();u&&o(u.buffer)}else this.webCryptoDecrypt(new Uint8Array(A),C,c).then(o)},P.softwareDecrypt=function(A,C,c){var o=this.currentIV,u=this.currentResult,d=this.remainderData;this.logOnce("JS AES decrypt"),d&&(A=Object(F.appendUint8Array)(d,A),this.remainderData=null);var x=this.getValidChunk(A);if(!x.length)return null;o&&(c=o);var v=this.softwareDecrypter;v||(v=this.softwareDecrypter=new k.default),v.expandKey(C);var f=u;return this.currentResult=v.decrypt(x.buffer,0,c),this.currentIV=Object(O.sliceUint8)(x,-16).buffer,f||null},P.webCryptoDecrypt=function(A,C,c){var o=this,u=this.subtle;return(this.key!==C||!this.fastAesKey)&&(this.key=C,this.fastAesKey=new I.default(u,C)),this.fastAesKey.expandKey().then(function(d){if(!u)return Promise.reject(new Error("web crypto not initialized"));var x=new X.default(u,c);return x.decrypt(A.buffer,d)}).catch(function(d){return o.onWebCryptoError(d,A,C,c)})},P.onWebCryptoError=function(A,C,c,o){return W.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",A),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(C,c,o)},P.getValidChunk=function(A){var C=A,c=A.length-A.length%D;return c!==A.length&&(C=Object(O.sliceUint8)(A,0,c),this.remainderData=Object(O.sliceUint8)(A,c)),C},P.logOnce=function(A){if(!this.logEnabled)return;W.logger.log("[decrypter.ts]: "+A),this.logEnabled=!1},w}()},"./src/crypt/fast-aes-key.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return X});var X=function(){function I(W,F){this.subtle=void 0,this.key=void 0,this.subtle=W,this.key=F}var k=I.prototype;return k.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},I}()},"./src/demux/aacdemuxer.ts":function(he,Y,L){"use strict";L.r(Y);var X=L("./src/demux/base-audio-demuxer.ts"),I=L("./src/demux/adts.ts"),k=L("./src/utils/logger.ts"),W=L("./src/demux/id3.ts");function F(E,w){E.prototype=Object.create(w.prototype),E.prototype.constructor=E,O(E,w)}function O(E,w){return O=Object.setPrototypeOf||function(_,A){return _.__proto__=A,_},O(E,w)}var D=function(E){F(w,E);function w(_,A){var C;return C=E.call(this)||this,C.observer=void 0,C.config=void 0,C.observer=_,C.config=A,C}var P=w.prototype;return P.resetInitSegment=function(A,C,c){E.prototype.resetInitSegment.call(this,A,C,c),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:A,duration:c,inputTimeScale:9e4,dropped:0}},w.probe=function(A){if(!A)return!1;for(var C=W.getID3Data(A,0)||[],c=C.length,o=A.length;c<o;c++)if(I.probe(A,c))return k.logger.log("ADTS sync word found !"),!0;return!1},P.canParse=function(A,C){return I.canParse(A,C)},P.appendFrame=function(A,C,c){I.initTrackConfig(A,this.observer,C,c,A.manifestCodec);var o=I.appendFrame(A,C,c,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},w}(X.default);D.minProbeByteLength=9,Y.default=D},"./src/demux/adts.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"getAudioConfig",function(){return W}),L.d(Y,"isHeaderPattern",function(){return F}),L.d(Y,"getHeaderLength",function(){return O}),L.d(Y,"getFullFrameLength",function(){return D}),L.d(Y,"canGetFrameLength",function(){return E}),L.d(Y,"isHeader",function(){return w}),L.d(Y,"canParse",function(){return P}),L.d(Y,"probe",function(){return _}),L.d(Y,"initTrackConfig",function(){return A}),L.d(Y,"getFrameDuration",function(){return C}),L.d(Y,"parseFrameHeader",function(){return c}),L.d(Y,"appendFrame",function(){return o});var X=L("./src/utils/logger.ts"),I=L("./src/errors.ts"),k=L("./src/events.ts");function W(u,d,x,v){var f,l,b,h,p=navigator.userAgent.toLowerCase(),s=v,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];f=((d[x+2]&192)>>>6)+1;var g=(d[x+2]&60)>>>2;if(g>a.length-1){u.trigger(k.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+g});return}return b=(d[x+2]&1)<<2,b|=(d[x+3]&192)>>>6,X.logger.log("manifest codec:"+v+", ADTS type:"+f+", samplingIndex:"+g),/firefox/i.test(p)?g>=6?(f=5,h=new Array(4),l=g-3):(f=2,h=new Array(2),l=g):p.indexOf("android")!==-1?(f=2,h=new Array(2),l=g):(f=5,h=new Array(4),v&&(v.indexOf("mp4a.40.29")!==-1||v.indexOf("mp4a.40.5")!==-1)||!v&&g>=6?l=g-3:((v&&v.indexOf("mp4a.40.2")!==-1&&(g>=6&&b===1||/vivaldi/i.test(p))||!v&&b===1)&&(f=2,h=new Array(2)),l=g)),h[0]=f<<3,h[0]|=(g&14)>>1,h[1]|=(g&1)<<7,h[1]|=b<<3,f===5&&(h[1]|=(l&14)>>1,h[2]=(l&1)<<7,h[2]|=2<<2,h[3]=0),{config:h,samplerate:a[g],channelCount:b,codec:"mp4a.40."+f,manifestCodec:s}}function F(u,d){return u[d]===255&&(u[d+1]&246)===240}function O(u,d){return u[d+1]&1?7:9}function D(u,d){return(u[d+3]&3)<<11|u[d+4]<<3|(u[d+5]&224)>>>5}function E(u,d){return d+5<u.length}function w(u,d){return d+1<u.length&&F(u,d)}function P(u,d){return E(u,d)&&F(u,d)&&D(u,d)<=u.length-d}function _(u,d){if(w(u,d)){var x=O(u,d);if(d+x>=u.length)return!1;var v=D(u,d);if(v<=x)return!1;var f=d+v;return f===u.length||w(u,f)}return!1}function A(u,d,x,v,f){if(!u.samplerate){var l=W(d,x,v,f);if(!l)return;u.config=l.config,u.samplerate=l.samplerate,u.channelCount=l.channelCount,u.codec=l.codec,u.manifestCodec=l.manifestCodec,X.logger.log("parsed codec:"+u.codec+", rate:"+l.samplerate+", channels:"+l.channelCount)}}function C(u){return 1024*9e4/u}function c(u,d,x,v,f){var l=O(u,d),b=D(u,d);if(b-=l,b>0){var h=x+v*f;return{headerLength:l,frameLength:b,stamp:h}}}function o(u,d,x,v,f){var l=C(u.samplerate),b=c(d,x,v,f,l);if(b){var h=b.frameLength,p=b.headerLength,s=b.stamp,a=p+h,g=Math.max(0,x+a-d.length),m;g?(m=new Uint8Array(a-p),m.set(d.subarray(x+p,d.length),0)):m=d.subarray(x+p,x+a);var y={unit:m,pts:s};return g||u.samples.push(y),{sample:y,length:a,missing:g}}}},"./src/demux/base-audio-demuxer.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"initPTSFn",function(){return D});var X=L("./src/polyfills/number.ts"),I=L("./src/demux/id3.ts"),k=L("./src/demux/dummy-demuxed-track.ts"),W=L("./src/utils/mp4-tools.ts"),F=L("./src/utils/typed-array.ts"),O=function(){function E(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var w=E.prototype;return w.resetInitSegment=function(_,A,C){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},w.resetTimeStamp=function(){},w.resetContiguity=function(){},w.canParse=function(_,A){return!1},w.appendFrame=function(_,A,C){},w.demux=function(_,A){this.cachedData&&(_=Object(W.appendUint8Array)(this.cachedData,_),this.cachedData=null);var C=I.getID3Data(_,0),c=C?C.length:0,o,u,d=this._audioTrack,x=this._id3Track,v=C?I.getTimeStamp(C):void 0,f=_.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=D(v,A)),C&&C.length>0&&x.samples.push({pts:this.initPTS,dts:this.initPTS,data:C}),u=this.initPTS;c<f;){if(this.canParse(_,c)){var l=this.appendFrame(d,_,c);l?(this.frameIndex++,u=l.sample.pts,c+=l.length,o=c):c=f}else I.canParse(_,c)?(C=I.getID3Data(_,c),x.samples.push({pts:u,dts:u,data:C}),c+=C.length,o=c):c++;if(c===f&&o!==f){var b=Object(F.sliceUint8)(_,o);this.cachedData?this.cachedData=Object(W.appendUint8Array)(this.cachedData,b):this.cachedData=b}}return{audioTrack:d,avcTrack:Object(k.dummyTrack)(),id3Track:x,textTrack:Object(k.dummyTrack)()}},w.demuxSampleAes=function(_,A,C){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},w.flush=function(_){var A=this.cachedData;return A&&(this.cachedData=null,this.demux(A,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(k.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(k.dummyTrack)()}},w.destroy=function(){},E}(),D=function(w,P){return Object(X.isFiniteNumber)(w)?w*90:P*9e4};Y.default=O},"./src/demux/chunk-cache.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return X});var X=function(){function k(){this.chunks=[],this.dataLength=0}var W=k.prototype;return W.push=function(O){this.chunks.push(O),this.dataLength+=O.length},W.flush=function(){var O=this.chunks,D=this.dataLength,E;if(O.length)O.length===1?E=O[0]:E=I(O,D);else return new Uint8Array(0);return this.reset(),E},W.reset=function(){this.chunks.length=0,this.dataLength=0},k}();function I(k,W){for(var F=new Uint8Array(W),O=0,D=0;D<k.length;D++){var E=k[D];F.set(E,O),O+=E.length}return F}},"./src/demux/dummy-demuxed-track.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"dummyTrack",function(){return X});function X(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(he,Y,L){"use strict";L.r(Y);var X=L("./src/utils/logger.ts"),I=function(){function k(F){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=F,this.bytesAvailable=F.byteLength,this.word=0,this.bitsAvailable=0}var W=k.prototype;return W.loadWord=function(){var O=this.data,D=this.bytesAvailable,E=O.byteLength-D,w=new Uint8Array(4),P=Math.min(4,D);if(P===0)throw new Error("no bytes available");w.set(O.subarray(E,E+P)),this.word=new DataView(w.buffer).getUint32(0),this.bitsAvailable=P*8,this.bytesAvailable-=P},W.skipBits=function(O){var D;this.bitsAvailable>O?(this.word<<=O,this.bitsAvailable-=O):(O-=this.bitsAvailable,D=O>>3,O-=D>>3,this.bytesAvailable-=D,this.loadWord(),this.word<<=O,this.bitsAvailable-=O)},W.readBits=function(O){var D=Math.min(this.bitsAvailable,O),E=this.word>>>32-D;return O>32&&X.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=D,this.bitsAvailable>0?this.word<<=D:this.bytesAvailable>0&&this.loadWord(),D=O-D,D>0&&this.bitsAvailable?E<<D|this.readBits(D):E},W.skipLZ=function(){var O;for(O=0;O<this.bitsAvailable;++O)if((this.word&2147483648>>>O)!==0)return this.word<<=O,this.bitsAvailable-=O,O;return this.loadWord(),O+this.skipLZ()},W.skipUEG=function(){this.skipBits(1+this.skipLZ())},W.skipEG=function(){this.skipBits(1+this.skipLZ())},W.readUEG=function(){var O=this.skipLZ();return this.readBits(O+1)-1},W.readEG=function(){var O=this.readUEG();return 1&O?1+O>>>1:-1*(O>>>1)},W.readBoolean=function(){return this.readBits(1)===1},W.readUByte=function(){return this.readBits(8)},W.readUShort=function(){return this.readBits(16)},W.readUInt=function(){return this.readBits(32)},W.skipScalingList=function(O){for(var D=8,E=8,w,P=0;P<O;P++)E!==0&&(w=this.readEG(),E=(D+w+256)%256),D=E===0?D:E},W.readSPS=function(){var O=0,D=0,E=0,w=0,P,_,A,C=this.readUByte.bind(this),c=this.readBits.bind(this),o=this.readUEG.bind(this),u=this.readBoolean.bind(this),d=this.skipBits.bind(this),x=this.skipEG.bind(this),v=this.skipUEG.bind(this),f=this.skipScalingList.bind(this);C();var l=C();if(c(5),d(3),C(),v(),l===100||l===110||l===122||l===244||l===44||l===83||l===86||l===118||l===128){var b=o();if(b===3&&d(1),v(),v(),d(1),u())for(_=b!==3?8:12,A=0;A<_;A++)u()&&(A<6?f(16):f(64))}v();var h=o();if(h===0)o();else if(h===1)for(d(1),x(),x(),P=o(),A=0;A<P;A++)x();v(),d(1);var p=o(),s=o(),a=c(1);a===0&&d(1),d(1),u()&&(O=o(),D=o(),E=o(),w=o());var g=[1,1];if(u()&&u()){var m=C();switch(m){case 1:g=[1,1];break;case 2:g=[12,11];break;case 3:g=[10,11];break;case 4:g=[16,11];break;case 5:g=[40,33];break;case 6:g=[24,11];break;case 7:g=[20,11];break;case 8:g=[32,11];break;case 9:g=[80,33];break;case 10:g=[18,11];break;case 11:g=[15,11];break;case 12:g=[64,33];break;case 13:g=[160,99];break;case 14:g=[4,3];break;case 15:g=[3,2];break;case 16:g=[2,1];break;case 255:{g=[C()<<8|C(),C()<<8|C()];break}}}return{width:Math.ceil((p+1)*16-O*2-D*2),height:(2-a)*(s+1)*16-(a?2:4)*(E+w),pixelRatio:g}},W.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},k}();Y.default=I},"./src/demux/id3.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"isHeader",function(){return X}),L.d(Y,"isFooter",function(){return I}),L.d(Y,"getID3Data",function(){return k}),L.d(Y,"canParse",function(){return F}),L.d(Y,"getTimeStamp",function(){return O}),L.d(Y,"isTimeStampFrame",function(){return D}),L.d(Y,"getID3Frames",function(){return w}),L.d(Y,"decodeFrame",function(){return P}),L.d(Y,"utf8ArrayToStr",function(){return o}),L.d(Y,"testables",function(){return u});var X=function(f,l){return l+10<=f.length&&(f[l]===73&&f[l+1]===68&&f[l+2]===51&&(f[l+3]<255&&f[l+4]<255&&(f[l+6]<128&&f[l+7]<128&&f[l+8]<128&&f[l+9]<128)))},I=function(f,l){return l+10<=f.length&&(f[l]===51&&f[l+1]===68&&f[l+2]===73&&(f[l+3]<255&&f[l+4]<255&&(f[l+6]<128&&f[l+7]<128&&f[l+8]<128&&f[l+9]<128)))},k=function(f,l){for(var b=l,h=0;X(f,l);){h+=10;var p=W(f,l+6);h+=p,I(f,l+10)&&(h+=10),l+=h}return h>0?f.subarray(b,b+h):void 0},W=function(f,l){var b=0;return b=(f[l]&127)<<21,b|=(f[l+1]&127)<<14,b|=(f[l+2]&127)<<7,b|=f[l+3]&127,b},F=function(f,l){return X(f,l)&&W(f,l+6)+10<=f.length-l},O=function(f){for(var l=w(f),b=0;b<l.length;b++){var h=l[b];if(D(h))return c(h)}return},D=function(f){return f&&f.key==="PRIV"&&f.info==="com.apple.streaming.transportStreamTimestamp"},E=function(f){var l=String.fromCharCode(f[0],f[1],f[2],f[3]),b=W(f,4),h=10;return{type:l,size:b,data:f.subarray(h,h+b)}},w=function(f){for(var l=0,b=[];X(f,l);){var h=W(f,l+6);l+=10;for(var p=l+h;l+8<p;){var s=E(f.subarray(l)),a=P(s);a&&b.push(a),l+=s.size+10}I(f,l)&&(l+=10)}return b},P=function(f){return f.type==="PRIV"?_(f):f.type[0]==="W"?C(f):A(f)},_=function(f){if(f.size<2)return;var l=o(f.data,!0),b=new Uint8Array(f.data.subarray(l.length+1));return{key:f.type,info:l,data:b.buffer}},A=function(f){if(f.size<2)return;if(f.type==="TXXX"){var l=1,b=o(f.data.subarray(l),!0);l+=b.length+1;var h=o(f.data.subarray(l));return{key:f.type,info:b,data:h}}var p=o(f.data.subarray(1));return{key:f.type,data:p}},C=function(f){if(f.type==="WXXX"){if(f.size<2)return;var l=1,b=o(f.data.subarray(l),!0);l+=b.length+1;var h=o(f.data.subarray(l));return{key:f.type,info:b,data:h}}var p=o(f.data);return{key:f.type,data:p}},c=function(f){if(f.data.byteLength===8){var l=new Uint8Array(f.data),b=l[3]&1,h=(l[4]<<23)+(l[5]<<15)+(l[6]<<7)+l[7];return h/=45,b&&(h+=4772185884e-2),Math.round(h)}return},o=function(f,l){l===void 0&&(l=!1);var b=x();if(b){var h=b.decode(f);if(l){var p=h.indexOf("\0");return p!==-1?h.substring(0,p):h}return h.replace(/\0/g,"")}for(var s=f.length,a,g,m,y="",M=0;M<s;){if(a=f[M++],a===0&&l)return y;if(a===0||a===3)continue;switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:y+=String.fromCharCode(a);break;case 12:case 13:g=f[M++],y+=String.fromCharCode((a&31)<<6|g&63);break;case 14:g=f[M++],m=f[M++],y+=String.fromCharCode((a&15)<<12|(g&63)<<6|(m&63)<<0);break;default:}}return y},u={decodeTextFrame:A},d;function x(){return!d&&typeof self.TextDecoder!="undefined"&&(d=new self.TextDecoder("utf-8")),d}},"./src/demux/mp3demuxer.ts":function(he,Y,L){"use strict";L.r(Y);var X=L("./src/demux/base-audio-demuxer.ts"),I=L("./src/demux/id3.ts"),k=L("./src/utils/logger.ts"),W=L("./src/demux/mpegaudio.ts");function F(E,w){E.prototype=Object.create(w.prototype),E.prototype.constructor=E,O(E,w)}function O(E,w){return O=Object.setPrototypeOf||function(_,A){return _.__proto__=A,_},O(E,w)}var D=function(E){F(w,E);function w(){return E.apply(this,arguments)||this}var P=w.prototype;return P.resetInitSegment=function(A,C,c){E.prototype.resetInitSegment.call(this,A,C,c),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:A,duration:c,inputTimeScale:9e4,dropped:0}},w.probe=function(A){if(!A)return!1;for(var C=I.getID3Data(A,0)||[],c=C.length,o=A.length;c<o;c++)if(W.probe(A,c))return k.logger.log("MPEG Audio sync word found !"),!0;return!1},P.canParse=function(A,C){return W.canParse(A,C)},P.appendFrame=function(A,C,c){return this.initPTS===null?void 0:W.appendFrame(A,C,c,this.initPTS,this.frameIndex)},w}(X.default);D.minProbeByteLength=4,Y.default=D},"./src/demux/mp4demuxer.ts":function(he,Y,L){"use strict";L.r(Y);var X=L("./src/utils/mp4-tools.ts"),I=L("./src/demux/dummy-demuxed-track.ts"),k=function(){function W(O,D){this.remainderData=null,this.config=void 0,this.config=D}var F=W.prototype;return F.resetTimeStamp=function(){},F.resetInitSegment=function(){},F.resetContiguity=function(){},W.probe=function(D){return Object(X.findBox)({data:D,start:0,end:Math.min(D.length,16384)},["moof"]).length>0},F.demux=function(D){var E=D,w=Object(I.dummyTrack)();if(this.config.progressive){this.remainderData&&(E=Object(X.appendUint8Array)(this.remainderData,D));var P=Object(X.segmentValidRange)(E);this.remainderData=P.remainder,w.samples=P.valid||new Uint8Array}else w.samples=E;return{audioTrack:Object(I.dummyTrack)(),avcTrack:w,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},F.flush=function(){var D=Object(I.dummyTrack)();return D.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(I.dummyTrack)(),avcTrack:D,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},F.demuxSampleAes=function(D,E,w){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},F.destroy=function(){},W}();k.minProbeByteLength=1024,Y.default=k},"./src/demux/mpegaudio.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"appendFrame",function(){return O}),L.d(Y,"parseHeader",function(){return D}),L.d(Y,"isHeaderPattern",function(){return E}),L.d(Y,"isHeader",function(){return w}),L.d(Y,"canParse",function(){return P}),L.d(Y,"probe",function(){return _});var X=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],k=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],W=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],F=[0,1,1,4];function O(A,C,c,o,u){if(c+24>C.length)return;var d=D(C,c);if(d&&c+d.frameLength<=C.length){var x=d.samplesPerFrame*9e4/d.sampleRate,v=o+u*x,f={unit:C.subarray(c,c+d.frameLength),pts:v,dts:v};return A.config=[],A.channelCount=d.channelCount,A.samplerate=d.sampleRate,A.samples.push(f),{sample:f,length:d.frameLength,missing:0}}}function D(A,C){var c=A[C+1]>>3&3,o=A[C+1]>>1&3,u=A[C+2]>>4&15,d=A[C+2]>>2&3;if(c!==1&&u!==0&&u!==15&&d!==3){var x=A[C+2]>>1&1,v=A[C+3]>>6,f=c===3?3-o:o===3?3:4,l=I[f*14+u-1]*1e3,b=c===3?0:c===2?1:2,h=k[b*3+d],p=v===3?1:2,s=W[c][o],a=F[o],g=s*8*a,m=Math.floor(s*l/h+x)*a;if(X===null){var y=navigator.userAgent||"",M=y.match(/Chrome\/(\d+)/i);X=M?parseInt(M[1]):0}var H=!!X&&X<=87;return H&&o===2&&l>=224e3&&v===0&&(A[C+3]=A[C+3]|128),{sampleRate:h,channelCount:p,frameLength:m,samplesPerFrame:g}}}function E(A,C){return A[C]===255&&(A[C+1]&224)===224&&(A[C+1]&6)!==0}function w(A,C){return C+1<A.length&&E(A,C)}function P(A,C){var c=4;return E(A,C)&&c<=A.length-C}function _(A,C){if(C+1<A.length&&E(A,C)){var c=4,o=D(A,C),u=c;o!=null&&o.frameLength&&(u=o.frameLength);var d=C+u;return d===A.length||w(A,d)}return!1}},"./src/demux/sample-aes.ts":function(he,Y,L){"use strict";L.r(Y);var X=L("./src/crypt/decrypter.ts"),I=L("./src/demux/tsdemuxer.ts"),k=function(){function W(O,D,E){this.keyData=void 0,this.decrypter=void 0,this.keyData=E,this.decrypter=new X.default(O,D,{removePKCS7Padding:!1})}var F=W.prototype;return F.decryptBuffer=function(D,E){this.decrypter.decrypt(D,this.keyData.key.buffer,this.keyData.iv.buffer,E)},F.decryptAacSample=function(D,E,w,P){var _=D[E].unit,A=_.subarray(16,_.length-_.length%16),C=A.buffer.slice(A.byteOffset,A.byteOffset+A.length),c=this;this.decryptBuffer(C,function(o){var u=new Uint8Array(o);_.set(u,16),P||c.decryptAacSamples(D,E+1,w)})},F.decryptAacSamples=function(D,E,w){for(;;E++){if(E>=D.length){w();return}if(D[E].unit.length<32)continue;var P=this.decrypter.isSync();if(this.decryptAacSample(D,E,w,P),!P)return}},F.getAvcEncryptedData=function(D){for(var E=Math.floor((D.length-48)/160)*16+16,w=new Int8Array(E),P=0,_=32;_<=D.length-16;_+=160,P+=16)w.set(D.subarray(_,_+16),P);return w},F.getAvcDecryptedUnit=function(D,E){for(var w=new Uint8Array(E),P=0,_=32;_<=D.length-16;_+=160,P+=16)D.set(w.subarray(P,P+16),_);return D},F.decryptAvcSample=function(D,E,w,P,_,A){var C=Object(I.discardEPB)(_.data),c=this.getAvcEncryptedData(C),o=this;this.decryptBuffer(c.buffer,function(u){_.data=o.getAvcDecryptedUnit(C,u),A||o.decryptAvcSamples(D,E,w+1,P)})},F.decryptAvcSamples=function(D,E,w,P){if(D instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;E++,w=0){if(E>=D.length){P();return}for(var _=D[E].units;!(w>=_.length);w++){var A=_[w];if(A.data.length<=48||A.type!==1&&A.type!==5)continue;var C=this.decrypter.isSync();if(this.decryptAvcSample(D,E,w,P,A,C),!C)return}}},W}();Y.default=k},"./src/demux/transmuxer-interface.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return _});var X=L("./node_modules/webworkify-webpack/index.js"),I=L.n(X),k=L("./src/events.ts"),W=L("./src/demux/transmuxer.ts"),F=L("./src/utils/logger.ts"),O=L("./src/errors.ts"),D=L("./src/utils/mediasource-helper.ts"),E=L("./node_modules/eventemitter3/index.js"),w=L.n(E),P=Object(D.getMediaSource)()||{isTypeSupported:function(){return!1}},_=function(){function A(c,o,u,d){var x=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=c,this.id=o,this.onTransmuxComplete=u,this.onFlush=d;var v=c.config,f=function(s,a){a=a||{},a.frag=x.frag,a.id=x.id,c.trigger(s,a)};this.observer=new E.EventEmitter,this.observer.on(k.Events.FRAG_DECRYPTED,f),this.observer.on(k.Events.ERROR,f);var l={mp4:P.isTypeSupported("video/mp4"),mpeg:P.isTypeSupported("audio/mpeg"),mp3:P.isTypeSupported('audio/mp4; codecs="mp3"')},b=navigator.vendor;if(v.enableWorker&&typeof Worker!="undefined"){F.logger.log("demuxing in webworker");var h;try{h=this.worker=X("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),h.addEventListener("message",this.onwmsg),h.onerror=function(p){c.trigger(k.Events.ERROR,{type:O.ErrorTypes.OTHER_ERROR,details:O.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(p.message+" ("+p.filename+":"+p.lineno+")")})},h.postMessage({cmd:"init",typeSupported:l,vendor:b,id:o,config:JSON.stringify(v)})}catch(p){F.logger.warn("Error in worker:",p),F.logger.error("Error while initializing DemuxerWorker, fallback to inline"),h&&self.URL.revokeObjectURL(h.objectURL),this.transmuxer=new W.default(this.observer,l,v,b,o),this.worker=null}}else this.transmuxer=new W.default(this.observer,l,v,b,o)}var C=A.prototype;return C.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var u=this.transmuxer;u&&(u.destroy(),this.transmuxer=null)}var d=this.observer;d&&d.removeAllListeners(),this.observer=null},C.push=function(o,u,d,x,v,f,l,b,h,p){var s=this;h.transmuxing.start=self.performance.now();var a=this.transmuxer,g=this.worker,m=f?f.start:v.start,y=v.decryptdata,M=this.frag,H=!(M&&v.cc===M.cc),V=!(M&&h.level===M.level),te=M?h.sn-M.sn:-1,G=this.part?h.part-this.part.index:1,j=!V&&(te===1||te===0&&G===1),ie=self.performance.now();(V||te||v.stats.parsing.start===0)&&(v.stats.parsing.start=ie),f&&(G||!j)&&(f.stats.parsing.start=ie);var pe=new W.TransmuxState(H,j,b,V,m);if(!j||H){F.logger.log("[transmuxer-interface, "+v.type+"]: Starting new transmux session for sn: "+h.sn+" p: "+h.part+" level: "+h.level+" id: "+h.id+`
|
|
discontinuity: `+H+`
|
|
trackSwitch: `+V+`
|
|
contiguous: `+j+`
|
|
accurateTimeOffset: `+b+`
|
|
timeOffset: `+m);var ge=new W.TransmuxConfig(d,x,u,l,p);this.configureTransmuxer(ge)}if(this.frag=v,this.part=f,g)g.postMessage({cmd:"demux",data:o,decryptdata:y,chunkMeta:h,state:pe},o instanceof ArrayBuffer?[o]:[]);else if(a){var be=a.push(o,y,h,pe);Object(W.isPromise)(be)?be.then(function(Ne){s.handleTransmuxComplete(Ne)}):this.handleTransmuxComplete(be)}},C.flush=function(o){var u=this;o.transmuxing.start=self.performance.now();var d=this.transmuxer,x=this.worker;if(x)x.postMessage({cmd:"flush",chunkMeta:o});else if(d){var v=d.flush(o);Object(W.isPromise)(v)?v.then(function(f){u.handleFlushResult(f,o)}):this.handleFlushResult(v,o)}},C.handleFlushResult=function(o,u){var d=this;o.forEach(function(x){d.handleTransmuxComplete(x)}),this.onFlush(u)},C.onWorkerMessage=function(o){var u=o.data,d=this.hls;switch(u.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(u.data);break}case"flush":{this.onFlush(u.data);break}default:{u.data=u.data||{},u.data.frag=this.frag,u.data.id=this.id,d.trigger(u.event,u.data);break}}},C.configureTransmuxer=function(o){var u=this.worker,d=this.transmuxer;u?u.postMessage({cmd:"configure",config:o}):d&&d.configure(o)},C.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},A}()},"./src/demux/transmuxer-worker.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return O});var X=L("./src/demux/transmuxer.ts"),I=L("./src/events.ts"),k=L("./src/utils/logger.ts"),W=L("./node_modules/eventemitter3/index.js"),F=L.n(W);function O(_){var A=new W.EventEmitter,C=function(o,u){_.postMessage({event:o,data:u})};A.on(I.Events.FRAG_DECRYPTED,C),A.on(I.Events.ERROR,C),_.addEventListener("message",function(c){var o=c.data;switch(o.cmd){case"init":{var u=JSON.parse(o.config);_.transmuxer=new X.default(A,o.typeSupported,u,o.vendor,o.id),Object(k.enableLogs)(u.debug),C("init",null);break}case"configure":{_.transmuxer.configure(o.config);break}case"demux":{var d=_.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(X.isPromise)(d)?d.then(function(f){D(_,f)}):D(_,d);break}case"flush":{var x=o.chunkMeta,v=_.transmuxer.flush(x);Object(X.isPromise)(v)?v.then(function(f){w(_,f,x)}):w(_,v,x);break}default:break}})}function D(_,A){if(P(A.remuxResult))return;var C=[],c=A.remuxResult,o=c.audio,u=c.video;o&&E(C,o),u&&E(C,u),_.postMessage({event:"transmuxComplete",data:A},C)}function E(_,A){A.data1&&_.push(A.data1.buffer),A.data2&&_.push(A.data2.buffer)}function w(_,A,C){A.forEach(function(c){D(_,c)}),_.postMessage({event:"flush",data:C})}function P(_){return!_.audio&&!_.video&&!_.text&&!_.id3&&!_.initSegment}},"./src/demux/transmuxer.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return u}),L.d(Y,"isPromise",function(){return v}),L.d(Y,"TransmuxConfig",function(){return f}),L.d(Y,"TransmuxState",function(){return l});var X=L("./src/events.ts"),I=L("./src/errors.ts"),k=L("./src/crypt/decrypter.ts"),W=L("./src/demux/aacdemuxer.ts"),F=L("./src/demux/mp4demuxer.ts"),O=L("./src/demux/tsdemuxer.ts"),D=L("./src/demux/mp3demuxer.ts"),E=L("./src/remux/mp4-remuxer.ts"),w=L("./src/remux/passthrough-remuxer.ts"),P=L("./src/demux/chunk-cache.ts"),_=L("./src/utils/mp4-tools.ts"),A=L("./src/utils/logger.ts"),C;try{C=self.performance.now.bind(self.performance)}catch(b){A.logger.debug("Unable to use Performance API on this environment"),C=self.Date.now}var c=[{demux:O.default,remux:E.default},{demux:F.default,remux:w.default},{demux:W.default,remux:E.default},{demux:D.default,remux:E.default}],o=1024;c.forEach(function(b){var h=b.demux;o=Math.max(o,h.minProbeByteLength)});var u=function(){function b(p,s,a,g,m){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new P.default,this.observer=p,this.typeSupported=s,this.config=a,this.vendor=g,this.id=m}var h=b.prototype;return h.configure=function(s){this.transmuxConfig=s,this.decrypter&&this.decrypter.reset()},h.push=function(s,a,g,m){var y=this,M=g.transmuxing;M.executeStart=C();var H=new Uint8Array(s),V=this.cache,te=this.config,G=this.currentTransmuxState,j=this.transmuxConfig;m&&(this.currentTransmuxState=m);var ie=d(H,a);if(ie&&ie.method==="AES-128"){var pe=this.getDecrypter();if(te.enableSoftwareAES){var ge=pe.softwareDecrypt(H,ie.key.buffer,ie.iv.buffer);if(!ge)return M.executeEnd=C(),x(g);H=new Uint8Array(ge)}else return this.decryptionPromise=pe.webCryptoDecrypt(H,ie.key.buffer,ie.iv.buffer).then(function(Ee){var Ae=y.push(Ee,null,g);return y.decryptionPromise=null,Ae}),this.decryptionPromise}var be=m||G,Ne=be.contiguous,Se=be.discontinuity,Me=be.trackSwitch,Le=be.accurateTimeOffset,we=be.timeOffset,ve=j.audioCodec,N=j.videoCodec,T=j.defaultInitPts,R=j.duration,z=j.initSegmentData;if((Se||Me)&&this.resetInitSegment(z,ve,N,R),Se&&this.resetInitialTimestamp(T),Ne||this.resetContiguity(),this.needsProbing(H,Se,Me)){if(V.dataLength){var Z=V.flush();H=Object(_.appendUint8Array)(Z,H)}this.configureTransmuxer(H,j)}var B=this.transmux(H,ie,we,Le,g),ce=this.currentTransmuxState;return ce.contiguous=!0,ce.discontinuity=!1,ce.trackSwitch=!1,M.executeEnd=C(),B},h.flush=function(s){var a=this,g=s.transmuxing;g.executeStart=C();var m=this.decrypter,y=this.cache,M=this.currentTransmuxState,H=this.decryptionPromise;if(H)return H.then(function(){return a.flush(s)});var V=[],te=M.timeOffset;if(m){var G=m.flush();G&&V.push(this.push(G,null,s))}var j=y.dataLength;y.reset();var ie=this.demuxer,pe=this.remuxer;if(!ie||!pe)return j>=o&&this.observer.emit(X.Events.ERROR,X.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),g.executeEnd=C(),[x(s)];var ge=ie.flush(te);return v(ge)?ge.then(function(be){return a.flushRemux(V,be,s),V}):(this.flushRemux(V,ge,s),V)},h.flushRemux=function(s,a,g){var m=a.audioTrack,y=a.avcTrack,M=a.id3Track,H=a.textTrack,V=this.currentTransmuxState,te=V.accurateTimeOffset,G=V.timeOffset;A.logger.log("[transmuxer.ts]: Flushed fragment "+g.sn+(g.part>-1?" p: "+g.part:"")+" of level "+g.level);var j=this.remuxer.remux(m,y,M,H,G,te,!0,this.id);s.push({remuxResult:j,chunkMeta:g}),g.transmuxing.executeEnd=C()},h.resetInitialTimestamp=function(s){var a=this.demuxer,g=this.remuxer;if(!a||!g)return;a.resetTimeStamp(s),g.resetTimeStamp(s)},h.resetContiguity=function(){var s=this.demuxer,a=this.remuxer;if(!s||!a)return;s.resetContiguity(),a.resetNextTimestamp()},h.resetInitSegment=function(s,a,g,m){var y=this.demuxer,M=this.remuxer;if(!y||!M)return;y.resetInitSegment(a,g,m),M.resetInitSegment(s,a,g)},h.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},h.transmux=function(s,a,g,m,y){var M;return a&&a.method==="SAMPLE-AES"?M=this.transmuxSampleAes(s,a,g,m,y):M=this.transmuxUnencrypted(s,g,m,y),M},h.transmuxUnencrypted=function(s,a,g,m){var y=this.demuxer.demux(s,a,!1,!this.config.progressive),M=y.audioTrack,H=y.avcTrack,V=y.id3Track,te=y.textTrack,G=this.remuxer.remux(M,H,V,te,a,g,!1,this.id);return{remuxResult:G,chunkMeta:m}},h.transmuxSampleAes=function(s,a,g,m,y){var M=this;return this.demuxer.demuxSampleAes(s,a,g).then(function(H){var V=M.remuxer.remux(H.audioTrack,H.avcTrack,H.id3Track,H.textTrack,g,m,!1,M.id);return{remuxResult:V,chunkMeta:y}})},h.configureTransmuxer=function(s,a){for(var g=this.config,m=this.observer,y=this.typeSupported,M=this.vendor,H=a.audioCodec,V=a.defaultInitPts,te=a.duration,G=a.initSegmentData,j=a.videoCodec,ie,pe=0,ge=c.length;pe<ge;pe++)if(c[pe].demux.probe(s)){ie=c[pe];break}ie||(A.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),ie={demux:F.default,remux:w.default});var be=this.demuxer,Ne=this.remuxer,Se=ie.remux,Me=ie.demux;(!Ne||!(Ne instanceof Se))&&(this.remuxer=new Se(m,g,y,M)),(!be||!(be instanceof Me))&&(this.demuxer=new Me(m,g,y),this.probe=Me.probe),this.resetInitSegment(G,H,j,te),this.resetInitialTimestamp(V)},h.needsProbing=function(s,a,g){return!this.demuxer||!this.remuxer||a||g},h.getDecrypter=function(){var s=this.decrypter;return s||(s=this.decrypter=new k.default(this.observer,this.config)),s},b}();function d(b,h){var p=null;return b.byteLength>0&&h!=null&&h.key!=null&&h.iv!==null&&h.method!=null&&(p=h),p}var x=function(h){return{remuxResult:{},chunkMeta:h}};function v(b){return"then"in b&&b.then instanceof Function}var f=function(h,p,s,a,g){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=h,this.videoCodec=p,this.initSegmentData=s,this.duration=a,this.defaultInitPts=g},l=function(h,p,s,a,g){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=h,this.contiguous=p,this.accurateTimeOffset=s,this.trackSwitch=a,this.timeOffset=g}},"./src/demux/tsdemuxer.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"discardEPB",function(){return x});var X=L("./src/demux/adts.ts"),I=L("./src/demux/mpegaudio.ts"),k=L("./src/demux/exp-golomb.ts"),W=L("./src/demux/id3.ts"),F=L("./src/demux/sample-aes.ts"),O=L("./src/events.ts"),D=L("./src/utils/mp4-tools.ts"),E=L("./src/utils/logger.ts"),w=L("./src/errors.ts"),P={video:1,audio:2,id3:3,text:4},_=function(){function v(l,b,h){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=l,this.config=b,this.typeSupported=h}v.probe=function(b){var h=v.syncOffset(b);return h<0?!1:(h&&E.logger.warn("MPEG2-TS detected but first sync word found @ offset "+h+", junk ahead ?"),!0)},v.syncOffset=function(b){for(var h=Math.min(1e3,b.length-3*188),p=0;p<h;){if(b[p]===71&&b[p+188]===71&&b[p+2*188]===71)return p;p++}return-1},v.createTrack=function(b,h){return{container:b==="video"||b==="audio"?"video/mp2t":void 0,type:b,id:P[b],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:b==="audio"?h:void 0}};var f=v.prototype;return f.resetInitSegment=function(b,h,p){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=v.createTrack("video",p),this._audioTrack=v.createTrack("audio",p),this._id3Track=v.createTrack("id3",p),this._txtTrack=v.createTrack("text",p),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=b,this.videoCodec=h,this._duration=p},f.resetTimeStamp=function(){},f.resetContiguity=function(){var b=this._audioTrack,h=this._avcTrack,p=this._id3Track;b&&(b.pesData=null),h&&(h.pesData=null),p&&(p.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},f.demux=function(b,h,p,s){p===void 0&&(p=!1),s===void 0&&(s=!1),p||(this.sampleAes=null);var a,g=this._avcTrack,m=this._audioTrack,y=this._id3Track,M=g.pid,H=g.pesData,V=m.pid,te=y.pid,G=m.pesData,j=y.pesData,ie=!1,pe=this.pmtParsed,ge=this._pmtId,be=b.length;if(this.remainderData&&(b=Object(D.appendUint8Array)(this.remainderData,b),be=b.length,this.remainderData=null),be<188&&!s)return this.remainderData=b,{audioTrack:m,avcTrack:g,id3Track:y,textTrack:this._txtTrack};var Ne=Math.max(0,v.syncOffset(b));be-=(be+Ne)%188,be<b.byteLength&&!s&&(this.remainderData=new Uint8Array(b.buffer,be,b.buffer.byteLength-be));for(var Se=Ne;Se<be;Se+=188)if(b[Se]===71){var Me=!!(b[Se+1]&64),Le=((b[Se+1]&31)<<8)+b[Se+2],we=(b[Se+3]&48)>>4,ve=void 0;if(we>1){if(ve=Se+5+b[Se+4],ve===Se+188)continue}else ve=Se+4;switch(Le){case M:Me&&(H&&(a=o(H))&&this.parseAVCPES(a,!1),H={data:[],size:0}),H&&(H.data.push(b.subarray(ve,Se+188)),H.size+=Se+188-ve);break;case V:Me&&(G&&(a=o(G))&&(m.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),G={data:[],size:0}),G&&(G.data.push(b.subarray(ve,Se+188)),G.size+=Se+188-ve);break;case te:Me&&(j&&(a=o(j))&&this.parseID3PES(a),j={data:[],size:0}),j&&(j.data.push(b.subarray(ve,Se+188)),j.size+=Se+188-ve);break;case 0:Me&&(ve+=b[ve]+1),ge=this._pmtId=C(b,ve);break;case ge:{Me&&(ve+=b[ve]+1);var N=c(b,ve,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,p);M=N.avc,M>0&&(g.pid=M),V=N.audio,V>0&&(m.pid=V,m.isAAC=N.isAAC),te=N.id3,te>0&&(y.pid=te),ie&&!pe&&(E.logger.log("reparse from beginning"),ie=!1,Se=Ne-188),pe=this.pmtParsed=!0;break}case 17:case 8191:break;default:ie=!0;break}}else this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});g.pesData=H,m.pesData=G,y.pesData=j;var T={audioTrack:m,avcTrack:g,id3Track:y,textTrack:this._txtTrack};return s&&this.extractRemainingSamples(T),T},f.flush=function(){var b=this.remainderData;this.remainderData=null;var h;return b?h=this.demux(b,-1,!1,!0):h={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(h),this.sampleAes?this.decrypt(h,this.sampleAes):h},f.extractRemainingSamples=function(b){var h=b.audioTrack,p=b.avcTrack,s=b.id3Track,a=p.pesData,g=h.pesData,m=s.pesData,y;a&&(y=o(a))?(this.parseAVCPES(y,!0),p.pesData=null):p.pesData=a,g&&(y=o(g))?(h.isAAC?this.parseAACPES(y):this.parseMPEGPES(y),h.pesData=null):(g!=null&&g.size&&E.logger.log("last AAC PES packet truncated,might overlap between fragments"),h.pesData=g),m&&(y=o(m))?(this.parseID3PES(y),s.pesData=null):s.pesData=m},f.demuxSampleAes=function(b,h,p){var s=this.demux(b,p,!0,!this.config.progressive),a=this.sampleAes=new F.default(this.observer,this.config,h);return this.decrypt(s,a)},f.decrypt=function(b,h){return new Promise(function(p){var s=b.audioTrack,a=b.avcTrack;s.samples&&s.isAAC?h.decryptAacSamples(s.samples,0,function(){a.samples?h.decryptAvcSamples(a.samples,0,0,function(){p(b)}):p(b)}):a.samples&&h.decryptAvcSamples(a.samples,0,0,function(){p(b)})})},f.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},f.parseAVCPES=function(b,h){var p=this,s=this._avcTrack,a=this.parseAVCNALu(b.data),g=!1,m=this.avcSample,y,M=!1;b.data=null,m&&a.length&&!s.audFound&&(u(m,s),m=this.avcSample=A(!1,b.pts,b.dts,"")),a.forEach(function(H){switch(H.type){case 1:{y=!0,m||(m=p.avcSample=A(!0,b.pts,b.dts,"")),g&&(m.debug+="NDR "),m.frame=!0;var V=H.data;if(M&&V.length>4){var te=new k.default(V).readSliceType();(te===2||te===4||te===7||te===9)&&(m.key=!0)}break}case 5:y=!0,m||(m=p.avcSample=A(!0,b.pts,b.dts,"")),g&&(m.debug+="IDR "),m.key=!0,m.frame=!0;break;case 6:{y=!0,g&&m&&(m.debug+="SEI ");var G=new k.default(x(H.data));G.readUByte();for(var j=0,ie=0,pe=!1,ge=0;!pe&&G.bytesAvailable>1;){j=0;do ge=G.readUByte(),j+=ge;while(ge===255);ie=0;do ge=G.readUByte(),ie+=ge;while(ge===255);if(j===4&&G.bytesAvailable!==0){pe=!0;var be=G.readUByte();if(be===181){var Ne=G.readUShort();if(Ne===49){var Se=G.readUInt();if(Se===1195456820){var Me=G.readUByte();if(Me===3){for(var Le=G.readUByte(),we=G.readUByte(),ve=31&Le,N=[Le,we],T=0;T<ve;T++)N.push(G.readUByte()),N.push(G.readUByte()),N.push(G.readUByte());d(p._txtTrack.samples,{type:3,pts:b.pts,bytes:N})}}}}}else if(j===5&&G.bytesAvailable!==0){if(pe=!0,ie>16){for(var R=[],z=0;z<16;z++)R.push(G.readUByte().toString(16)),(z===3||z===5||z===7||z===9)&&R.push("-");for(var Z=ie-16,B=new Uint8Array(Z),ce=0;ce<Z;ce++)B[ce]=G.readUByte();d(p._txtTrack.samples,{pts:b.pts,payloadType:j,uuid:R.join(""),userData:Object(W.utf8ArrayToStr)(B),userDataBytes:B})}}else if(ie<G.bytesAvailable)for(var Ee=0;Ee<ie;Ee++)G.readUByte()}break}case 7:if(y=!0,M=!0,g&&m&&(m.debug+="SPS "),!s.sps){var Ae=new k.default(H.data),Oe=Ae.readSPS();s.width=Oe.width,s.height=Oe.height,s.pixelRatio=Oe.pixelRatio,s.sps=[H.data],s.duration=p._duration;for(var Re=H.data.subarray(1,4),De="avc1.",Pe=0;Pe<3;Pe++){var Ke=Re[Pe].toString(16);Ke.length<2&&(Ke="0"+Ke),De+=Ke}s.codec=De}break;case 8:y=!0,g&&m&&(m.debug+="PPS "),s.pps||(s.pps=[H.data]);break;case 9:y=!1,s.audFound=!0,m&&u(m,s),m=p.avcSample=A(!1,b.pts,b.dts,g?"AUD ":"");break;case 12:y=!1;break;default:y=!1,m&&(m.debug+="unknown NAL "+H.type+" ");break}if(m&&y){var Xe=m.units;Xe.push(H)}}),h&&m&&(u(m,s),this.avcSample=null)},f.getLastNalUnit=function(){var b,h=this.avcSample,p;if(!h||h.units.length===0){var s=this._avcTrack.samples;h=s[s.length-1]}if((b=h)!==null&&b!==void 0&&b.units){var a=h.units;p=a[a.length-1]}return p},f.parseAVCNALu=function(b){var h=b.byteLength,p=this._avcTrack,s=p.naluState||0,a=s,g=[],m=0,y,M,H,V=-1,te=0;for(s===-1&&(V=0,te=b[0]&31,s=0,m=1);m<h;){if(y=b[m++],!s){s=y?0:1;continue}if(s===1){s=y?0:2;continue}if(!y)s=3;else if(y===1){if(V>=0){var G={data:b.subarray(V,m-s-1),type:te};g.push(G)}else{var j=this.getLastNalUnit();if(j&&(a&&m<=4-a&&(j.state&&(j.data=j.data.subarray(0,j.data.byteLength-a))),M=m-s-1,M>0)){var ie=new Uint8Array(j.data.byteLength+M);ie.set(j.data,0),ie.set(b.subarray(0,M),j.data.byteLength),j.data=ie,j.state=0}}m<h?(H=b[m]&31,V=m,te=H,s=0):s=-1}else s=0}if(V>=0&&s>=0){var pe={data:b.subarray(V,h),type:te,state:s};g.push(pe)}if(g.length===0){var ge=this.getLastNalUnit();if(ge){var be=new Uint8Array(ge.data.byteLength+b.byteLength);be.set(ge.data,0),be.set(b,ge.data.byteLength),ge.data=be}}return p.naluState=s,g},f.parseAACPES=function(b){var h=0,p=this._audioTrack,s=this.aacOverFlow,a=b.data;if(s){this.aacOverFlow=null;var g=s.sample.unit.byteLength,m=Math.min(s.missing,g),y=g-m;s.sample.unit.set(a.subarray(0,m),y),p.samples.push(s.sample),h=s.missing}var M,H;for(M=h,H=a.length;M<H-1&&!X.isHeader(a,M);M++);if(M!==h){var V,te;if(M<H-1?(V="AAC PES did not start with ADTS header,offset:"+M,te=!1):(V="no ADTS header found in AAC PES",te=!0),E.logger.warn("parsing error:"+V),this.observer.emit(O.Events.ERROR,O.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.FRAG_PARSING_ERROR,fatal:te,reason:V}),te)return}X.initTrackConfig(p,this.observer,a,M,this.audioCodec);var G;if(b.pts!==void 0)G=b.pts;else if(s){var j=X.getFrameDuration(p.samplerate);G=s.sample.pts+j}else{E.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var ie=0;M<H;)if(X.isHeader(a,M)){if(M+5<H){var pe=X.appendFrame(p,a,M,G,ie);if(pe)if(pe.missing)this.aacOverFlow=pe;else{M+=pe.length,ie++;continue}}break}else M++},f.parseMPEGPES=function(b){var h=b.data,p=h.length,s=0,a=0,g=b.pts;if(g===void 0){E.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<p;)if(I.isHeader(h,a)){var m=I.appendFrame(this._audioTrack,h,a,g,s);if(m)a+=m.length,s++;else break}else a++},f.parseID3PES=function(b){if(b.pts===void 0){E.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(b)},v}();_.minProbeByteLength=188;function A(v,f,l,b){return{key:v,frame:!1,pts:f,dts:l,units:[],debug:b,length:0}}function C(v,f){return(v[f+10]&31)<<8|v[f+11]}function c(v,f,l,b){var h={audio:-1,avc:-1,id3:-1,isAAC:!0},p=(v[f+1]&15)<<8|v[f+2],s=f+3+p-4,a=(v[f+10]&15)<<8|v[f+11];for(f+=12+a;f<s;){var g=(v[f+1]&31)<<8|v[f+2];switch(v[f]){case 207:if(!b){E.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:h.audio===-1&&(h.audio=g);break;case 21:h.id3===-1&&(h.id3=g);break;case 219:if(!b){E.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:h.avc===-1&&(h.avc=g);break;case 3:case 4:l?h.audio===-1&&(h.audio=g,h.isAAC=!1):E.logger.log("MPEG audio found, not supported in this browser");break;case 36:E.logger.warn("Unsupported HEVC stream type found");break;default:break}f+=((v[f+3]&15)<<8|v[f+4])+5}return h}function o(v){var f=0,l,b,h,p,s,a=v.data;if(!v||v.size===0)return null;for(;a[0].length<19&&a.length>1;){var g=new Uint8Array(a[0].length+a[1].length);g.set(a[0]),g.set(a[1],a[0].length),a[0]=g,a.splice(1,1)}l=a[0];var m=(l[0]<<16)+(l[1]<<8)+l[2];if(m===1){if(b=(l[4]<<8)+l[5],b&&b>v.size-6)return null;var y=l[7];y&192&&(p=(l[9]&14)*536870912+(l[10]&255)*4194304+(l[11]&254)*16384+(l[12]&255)*128+(l[13]&254)/2,y&64?(s=(l[14]&14)*536870912+(l[15]&255)*4194304+(l[16]&254)*16384+(l[17]&255)*128+(l[18]&254)/2,p-s>60*9e4&&(E.logger.warn(Math.round((p-s)/9e4)+"s delta between PTS and DTS, align them"),p=s)):s=p),h=l[8];var M=h+9;if(v.size<=M)return null;v.size-=M;for(var H=new Uint8Array(v.size),V=0,te=a.length;V<te;V++){l=a[V];var G=l.byteLength;if(M)if(M>G){M-=G;continue}else l=l.subarray(M),G-=M,M=0;H.set(l,f),f+=G}return b&&(b-=h+3),{data:H,pts:p,dts:s,len:b}}return null}function u(v,f){if(v.units.length&&v.frame){if(v.pts===void 0){var l=f.samples,b=l.length;if(b){var h=l[b-1];v.pts=h.pts,v.dts=h.dts}else{f.dropped++;return}}f.samples.push(v)}v.debug.length&&E.logger.log(v.pts+"/"+v.dts+":"+v.debug)}function d(v,f){var l=v.length;if(l>0){if(f.pts>=v[l-1].pts)v.push(f);else for(var b=l-1;b>=0;b--)if(f.pts<v[b].pts){v.splice(b,0,f);break}}else v.push(f)}function x(v){for(var f=v.byteLength,l=[],b=1;b<f-2;)v[b]===0&&v[b+1]===0&&v[b+2]===3?(l.push(b+2),b+=2):b++;if(l.length===0)return v;var h=f-l.length,p=new Uint8Array(h),s=0;for(b=0;b<h;s++,b++)s===l[0]&&(s++,l.shift()),p[b]=v[s];return p}Y.default=_},"./src/errors.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"ErrorTypes",function(){return X}),L.d(Y,"ErrorDetails",function(){return I});var X;(function(k){k.NETWORK_ERROR="networkError",k.MEDIA_ERROR="mediaError",k.KEY_SYSTEM_ERROR="keySystemError",k.MUX_ERROR="muxError",k.OTHER_ERROR="otherError"})(X||(X={}));var I;(function(k){k.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",k.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",k.KEY_SYSTEM_NO_SESSION="keySystemNoSession",k.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",k.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",k.MANIFEST_LOAD_ERROR="manifestLoadError",k.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",k.MANIFEST_PARSING_ERROR="manifestParsingError",k.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",k.LEVEL_EMPTY_ERROR="levelEmptyError",k.LEVEL_LOAD_ERROR="levelLoadError",k.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",k.LEVEL_SWITCH_ERROR="levelSwitchError",k.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",k.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",k.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",k.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",k.FRAG_LOAD_ERROR="fragLoadError",k.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",k.FRAG_DECRYPT_ERROR="fragDecryptError",k.FRAG_PARSING_ERROR="fragParsingError",k.REMUX_ALLOC_ERROR="remuxAllocError",k.KEY_LOAD_ERROR="keyLoadError",k.KEY_LOAD_TIMEOUT="keyLoadTimeOut",k.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",k.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",k.BUFFER_APPEND_ERROR="bufferAppendError",k.BUFFER_APPENDING_ERROR="bufferAppendingError",k.BUFFER_STALLED_ERROR="bufferStalledError",k.BUFFER_FULL_ERROR="bufferFullError",k.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",k.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",k.INTERNAL_EXCEPTION="internalException",k.INTERNAL_ABORTED="aborted",k.UNKNOWN="unknown"})(I||(I={}))},"./src/events.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"Events",function(){return X});var X;(function(I){I.MEDIA_ATTACHING="hlsMediaAttaching",I.MEDIA_ATTACHED="hlsMediaAttached",I.MEDIA_DETACHING="hlsMediaDetaching",I.MEDIA_DETACHED="hlsMediaDetached",I.BUFFER_RESET="hlsBufferReset",I.BUFFER_CODECS="hlsBufferCodecs",I.BUFFER_CREATED="hlsBufferCreated",I.BUFFER_APPENDING="hlsBufferAppending",I.BUFFER_APPENDED="hlsBufferAppended",I.BUFFER_EOS="hlsBufferEos",I.BUFFER_FLUSHING="hlsBufferFlushing",I.BUFFER_FLUSHED="hlsBufferFlushed",I.MANIFEST_LOADING="hlsManifestLoading",I.MANIFEST_LOADED="hlsManifestLoaded",I.MANIFEST_PARSED="hlsManifestParsed",I.LEVEL_SWITCHING="hlsLevelSwitching",I.LEVEL_SWITCHED="hlsLevelSwitched",I.LEVEL_LOADING="hlsLevelLoading",I.LEVEL_LOADED="hlsLevelLoaded",I.LEVEL_UPDATED="hlsLevelUpdated",I.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",I.LEVELS_UPDATED="hlsLevelsUpdated",I.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",I.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",I.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",I.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",I.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",I.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",I.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",I.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",I.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",I.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",I.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",I.CUES_PARSED="hlsCuesParsed",I.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",I.INIT_PTS_FOUND="hlsInitPtsFound",I.FRAG_LOADING="hlsFragLoading",I.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",I.FRAG_LOADED="hlsFragLoaded",I.FRAG_DECRYPTED="hlsFragDecrypted",I.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",I.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",I.FRAG_PARSING_METADATA="hlsFragParsingMetadata",I.FRAG_PARSED="hlsFragParsed",I.FRAG_BUFFERED="hlsFragBuffered",I.FRAG_CHANGED="hlsFragChanged",I.FPS_DROP="hlsFpsDrop",I.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",I.ERROR="hlsError",I.DESTROYING="hlsDestroying",I.KEY_LOADING="hlsKeyLoading",I.KEY_LOADED="hlsKeyLoaded",I.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",I.BACK_BUFFER_REACHED="hlsBackBufferReached"})(X||(X={}))},"./src/hls.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return v});var X=L("./node_modules/url-toolkit/src/url-toolkit.js"),I=L.n(X),k=L("./src/loader/playlist-loader.ts"),W=L("./src/loader/key-loader.ts"),F=L("./src/controller/id3-track-controller.ts"),O=L("./src/controller/latency-controller.ts"),D=L("./src/controller/level-controller.ts"),E=L("./src/controller/fragment-tracker.ts"),w=L("./src/controller/stream-controller.ts"),P=L("./src/is-supported.ts"),_=L("./src/utils/logger.ts"),A=L("./src/config.ts"),C=L("./node_modules/eventemitter3/index.js"),c=L.n(C),o=L("./src/events.ts"),u=L("./src/errors.ts");function d(f,l){for(var b=0;b<l.length;b++){var h=l[b];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(f,h.key,h)}}function x(f,l,b){return l&&d(f.prototype,l),b&&d(f,b),f}var v=function(){f.isSupported=function(){return Object(P.isSupported)()};function f(b){b===void 0&&(b={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new C.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var h=this.config=Object(A.mergeConfig)(f.DefaultConfig,b);this.userConfig=b,Object(_.enableLogs)(h.debug),this._autoLevelCapping=-1,h.progressive&&Object(A.enableStreamingMode)(h);var p=h.abrController,s=h.bufferController,a=h.capLevelController,g=h.fpsController,m=this.abrController=new p(this),y=this.bufferController=new s(this),M=this.capLevelController=new a(this),H=new g(this),V=new k.default(this),te=new W.default(this),G=new F.default(this),j=this.levelController=new D.default(this),ie=new E.FragmentTracker(this),pe=this.streamController=new w.default(this,ie);M.setStreamController(pe),H.setStreamController(pe);var ge=[j,pe];this.networkControllers=ge;var be=[V,te,m,y,M,H,G,ie];this.audioTrackController=this.createController(h.audioTrackController,null,ge),this.createController(h.audioStreamController,ie,ge),this.subtitleTrackController=this.createController(h.subtitleTrackController,null,ge),this.createController(h.subtitleStreamController,ie,ge),this.createController(h.timelineController,null,be),this.emeController=this.createController(h.emeController,null,be),this.cmcdController=this.createController(h.cmcdController,null,be),this.latencyController=this.createController(O.default,null,be),this.coreComponents=be}var l=f.prototype;return l.createController=function(h,p,s){if(h){var a=p?new h(this,p):new h(this);return s&&s.push(a),a}return null},l.on=function(h,p,s){s===void 0&&(s=this),this._emitter.on(h,p,s)},l.once=function(h,p,s){s===void 0&&(s=this),this._emitter.once(h,p,s)},l.removeAllListeners=function(h){this._emitter.removeAllListeners(h)},l.off=function(h,p,s,a){s===void 0&&(s=this),this._emitter.off(h,p,s,a)},l.listeners=function(h){return this._emitter.listeners(h)},l.emit=function(h,p,s){return this._emitter.emit(h,p,s)},l.trigger=function(h,p){if(this.config.debug)return this.emit(h,h,p);try{return this.emit(h,h,p)}catch(s){_.logger.error("An internal error happened while handling event "+h+'. Error message: "'+s.message+'". Here is a stacktrace:',s),this.trigger(o.Events.ERROR,{type:u.ErrorTypes.OTHER_ERROR,details:u.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:h,error:s})}return!1},l.listenerCount=function(h){return this._emitter.listenerCount(h)},l.destroy=function(){_.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(h){return h.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(h){return h.destroy()}),this.coreComponents.length=0},l.attachMedia=function(h){_.logger.log("attachMedia"),this._media=h,this.trigger(o.Events.MEDIA_ATTACHING,{media:h})},l.detachMedia=function(){_.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},l.loadSource=function(h){this.stopLoad();var p=this.media,s=this.url,a=this.url=X.buildAbsoluteURL(self.location.href,h,{alwaysNormalize:!0});_.logger.log("loadSource:"+a),p&&s&&s!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(p)),this.trigger(o.Events.MANIFEST_LOADING,{url:h})},l.startLoad=function(h){h===void 0&&(h=-1),_.logger.log("startLoad("+h+")"),this.networkControllers.forEach(function(p){p.startLoad(h)})},l.stopLoad=function(){_.logger.log("stopLoad"),this.networkControllers.forEach(function(h){h.stopLoad()})},l.swapAudioCodec=function(){_.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},l.recoverMediaError=function(){_.logger.log("recoverMediaError");var h=this._media;this.detachMedia(),h&&this.attachMedia(h)},l.removeLevel=function(h,p){p===void 0&&(p=0),this.levelController.removeLevel(h,p)},x(f,[{key:"levels",get:function(){var h=this.levelController.levels;return h||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(h){_.logger.log("set currentLevel:"+h),this.loadLevel=h,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(h){_.logger.log("set nextLevel:"+h),this.levelController.manualLevel=h,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(h){_.logger.log("set loadLevel:"+h),this.levelController.manualLevel=h}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(h){this.levelController.nextLoadLevel=h}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(h){_.logger.log("set firstLevel:"+h),this.levelController.firstLevel=h}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(h){_.logger.log("set startLevel:"+h),h!==-1&&(h=Math.max(h,this.minAutoLevel)),this.levelController.startLevel=h}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(h){var p=!!h;p!==this.config.capLevelToPlayerSize&&(p?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=p)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(h){this._autoLevelCapping!==h&&(_.logger.log("set autoLevelCapping:"+h),this._autoLevelCapping=h)}},{key:"bandwidthEstimate",get:function(){var h=this.abrController.bwEstimator;return h?h.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var h=this.levels,p=this.config.minAutoBitrate;if(!h)return 0;for(var s=h.length,a=0;a<s;a++)if(h[a].maxBitrate>p)return a;return 0}},{key:"maxAutoLevel",get:function(){var h=this.levels,p=this.autoLevelCapping,s;return p===-1&&h&&h.length?s=h.length-1:s=p,s}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(h){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,h)}},{key:"audioTracks",get:function(){var h=this.audioTrackController;return h?h.audioTracks:[]}},{key:"audioTrack",get:function(){var h=this.audioTrackController;return h?h.audioTrack:-1},set:function(h){var p=this.audioTrackController;p&&(p.audioTrack=h)}},{key:"subtitleTracks",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTrack:-1},set:function(h){var p=this.subtitleTrackController;p&&(p.subtitleTrack=h)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var h=this.subtitleTrackController;return h?h.subtitleDisplay:!1},set:function(h){var p=this.subtitleTrackController;p&&(p.subtitleDisplay=h)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(h){this.config.lowLatencyMode=h}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return o.Events}},{key:"ErrorTypes",get:function(){return u.ErrorTypes}},{key:"ErrorDetails",get:function(){return u.ErrorDetails}},{key:"DefaultConfig",get:function(){return f.defaultConfig?f.defaultConfig:A.hlsDefaultConfig},set:function(h){f.defaultConfig=h}}]),f}();v.defaultConfig=void 0},"./src/is-supported.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"isSupported",function(){return k}),L.d(Y,"changeTypeSupported",function(){return W});var X=L("./src/utils/mediasource-helper.ts");function I(){return self.SourceBuffer||self.WebKitSourceBuffer}function k(){var F=Object(X.getMediaSource)();if(!F)return!1;var O=I(),D=F&&typeof F.isTypeSupported=="function"&&F.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),E=!O||O.prototype&&typeof O.prototype.appendBuffer=="function"&&typeof O.prototype.remove=="function";return!!D&&!!E}function W(){var F,O=I();return typeof(O==null||((F=O.prototype)===null||F===void 0)?void 0:F.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return _}),L.d(Y,"LoadError",function(){return C});var X=L("./src/polyfills/number.ts"),I=L("./src/errors.ts");function k(c,o){c.prototype=Object.create(o.prototype),c.prototype.constructor=c,E(c,o)}function W(c){var o=typeof Map=="function"?new Map:void 0;return W=function(d){if(d===null||!D(d))return d;if(typeof d!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(d))return o.get(d);o.set(d,x)}function x(){return F(d,arguments,w(this).constructor)}return x.prototype=Object.create(d.prototype,{constructor:{value:x,enumerable:!1,writable:!0,configurable:!0}}),E(x,d)},W(c)}function F(c,o,u){return O()?F=Reflect.construct:F=function(x,v,f){var l=[null];l.push.apply(l,v);var b=Function.bind.apply(x,l),h=new b;return f&&E(h,f.prototype),h},F.apply(null,arguments)}function O(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(c){return!1}}function D(c){return Function.toString.call(c).indexOf("[native code]")!==-1}function E(c,o){return E=Object.setPrototypeOf||function(d,x){return d.__proto__=x,d},E(c,o)}function w(c){return w=Object.setPrototypeOf?Object.getPrototypeOf:function(u){return u.__proto__||Object.getPrototypeOf(u)},w(c)}var P=Math.pow(2,17),_=function(){function c(u){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=u}var o=c.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(d,x){var v=this,f=d.url;if(!f)return Promise.reject(new C({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,networkDetails:null},"Fragment does not have a "+(f?"part list":"url")));this.abort();var l=this.config,b=l.fLoader,h=l.loader;return new Promise(function(p,s){v.loader&&v.loader.destroy();var a=v.loader=d.loader=b?new b(l):new h(l),g=A(d),m={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:P};d.stats=a.stats,a.load(g,m,{onSuccess:function(M,H,V,te){v.resetLoader(d,a),p({frag:d,part:null,payload:M.data,networkDetails:te})},onError:function(M,H,V){v.resetLoader(d,a),s(new C({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,response:M,networkDetails:V}))},onAbort:function(M,H,V){v.resetLoader(d,a),s(new C({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,networkDetails:V}))},onTimeout:function(M,H,V){v.resetLoader(d,a),s(new C({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,networkDetails:V}))},onProgress:function(M,H,V,te){x&&x({frag:d,part:null,payload:V,networkDetails:te})}})})},o.loadPart=function(d,x,v){var f=this;this.abort();var l=this.config,b=l.fLoader,h=l.loader;return new Promise(function(p,s){f.loader&&f.loader.destroy();var a=f.loader=d.loader=b?new b(l):new h(l),g=A(d,x),m={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:P};x.stats=a.stats,a.load(g,m,{onSuccess:function(M,H,V,te){f.resetLoader(d,a),f.updateStatsFromPart(d,x);var G={frag:d,part:x,payload:M.data,networkDetails:te};v(G),p(G)},onError:function(M,H,V){f.resetLoader(d,a),s(new C({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,part:x,response:M,networkDetails:V}))},onAbort:function(M,H,V){d.stats.aborted=x.stats.aborted,f.resetLoader(d,a),s(new C({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,part:x,networkDetails:V}))},onTimeout:function(M,H,V){f.resetLoader(d,a),s(new C({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,part:x,networkDetails:V}))}})})},o.updateStatsFromPart=function(d,x){var v=d.stats,f=x.stats,l=f.total;if(v.loaded+=f.loaded,l){var b=Math.round(d.duration/x.duration),h=Math.min(Math.round(v.loaded/l),b),p=b-h,s=p*Math.round(v.loaded/h);v.total=v.loaded+s}else v.total=Math.max(v.loaded,v.total);var a=v.loading,g=f.loading;a.start?a.first+=g.first-g.start:(a.start=g.start,a.first=g.first),a.end=g.end},o.resetLoader=function(d,x){d.loader=null,this.loader===x&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),x.destroy()},c}();function A(c,o){o===void 0&&(o=null);var u=o||c,d={frag:c,part:o,responseType:"arraybuffer",url:u.url,headers:{},rangeStart:0,rangeEnd:0},x=u.byteRangeStartOffset,v=u.byteRangeEndOffset;return Object(X.isFiniteNumber)(x)&&Object(X.isFiniteNumber)(v)&&(d.rangeStart=x,d.rangeEnd=v),d}var C=function(c){k(o,c);function o(u){for(var d,x=arguments.length,v=new Array(x>1?x-1:0),f=1;f<x;f++)v[f-1]=arguments[f];return d=c.call.apply(c,[this].concat(v))||this,d.data=void 0,d.data=u,d}return o}(W(Error))},"./src/loader/fragment.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"ElementaryStreamTypes",function(){return _}),L.d(Y,"BaseSegment",function(){return A}),L.d(Y,"Fragment",function(){return C}),L.d(Y,"Part",function(){return c});var X=L("./src/polyfills/number.ts"),I=L("./node_modules/url-toolkit/src/url-toolkit.js"),k=L.n(I),W=L("./src/utils/logger.ts"),F=L("./src/loader/level-key.ts"),O=L("./src/loader/load-stats.ts");function D(o,u){o.prototype=Object.create(u.prototype),o.prototype.constructor=o,E(o,u)}function E(o,u){return E=Object.setPrototypeOf||function(x,v){return x.__proto__=v,x},E(o,u)}function w(o,u){for(var d=0;d<u.length;d++){var x=u[d];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(o,x.key,x)}}function P(o,u,d){return u&&w(o.prototype,u),d&&w(o,d),o}var _;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(_||(_={}));var A=function(){function o(d){var x;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(x={},x[_.AUDIO]=null,x[_.VIDEO]=null,x[_.AUDIOVIDEO]=null,x),this.baseurl=d}var u=o.prototype;return u.setByteRange=function(x,v){var f=x.split("@",2),l=[];f.length===1?l[0]=v?v.byteRangeEndOffset:0:l[0]=parseInt(f[1]),l[1]=parseInt(f[0])+l[0],this._byteRange=l},P(o,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(I.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(x){this._url=x}}]),o}(),C=function(o){D(u,o);function u(x,v){var f;return f=o.call(this,v)||this,f._decryptdata=null,f.rawProgramDateTime=null,f.programDateTime=null,f.tagList=[],f.duration=0,f.sn=0,f.levelkey=void 0,f.type=void 0,f.loader=null,f.level=-1,f.cc=0,f.startPTS=void 0,f.endPTS=void 0,f.appendedPTS=void 0,f.startDTS=void 0,f.endDTS=void 0,f.start=0,f.deltaPTS=void 0,f.maxStartPTS=void 0,f.minEndPTS=void 0,f.stats=new O.LoadStats,f.urlId=0,f.data=void 0,f.bitrateTest=!1,f.title=null,f.initSegment=null,f.type=x,f}var d=u.prototype;return d.createInitializationVector=function(v){for(var f=new Uint8Array(16),l=12;l<16;l++)f[l]=v>>8*(15-l)&255;return f},d.setDecryptDataFromLevelKey=function(v,f){var l=v;return(v==null?void 0:v.method)==="AES-128"&&v.uri&&!v.iv&&(l=F.LevelKey.fromURI(v.uri),l.method=v.method,l.iv=this.createInitializationVector(f),l.keyFormat="identity"),l},d.setElementaryStreamInfo=function(v,f,l,b,h,p){p===void 0&&(p=!1);var s=this.elementaryStreams,a=s[v];if(!a){s[v]={startPTS:f,endPTS:l,startDTS:b,endDTS:h,partial:p};return}a.startPTS=Math.min(a.startPTS,f),a.endPTS=Math.max(a.endPTS,l),a.startDTS=Math.min(a.startDTS,b),a.endDTS=Math.max(a.endDTS,h)},d.clearElementaryStreamInfo=function(){var v=this.elementaryStreams;v[_.AUDIO]=null,v[_.VIDEO]=null,v[_.AUDIOVIDEO]=null},P(u,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var v=this.sn;typeof v!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&W.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),v=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,v)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(X.isFiniteNumber)(this.programDateTime))return null;var v=Object(X.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+v*1e3}},{key:"encrypted",get:function(){var v;return!!((v=this.decryptdata)!==null&&v!==void 0&&v.keyFormat&&this.decryptdata.uri)}}]),u}(A),c=function(o){D(u,o);function u(d,x,v,f,l){var b;b=o.call(this,v)||this,b.fragOffset=0,b.duration=0,b.gap=!1,b.independent=!1,b.relurl=void 0,b.fragment=void 0,b.index=void 0,b.stats=new O.LoadStats,b.duration=d.decimalFloatingPoint("DURATION"),b.gap=d.bool("GAP"),b.independent=d.bool("INDEPENDENT"),b.relurl=d.enumeratedString("URI"),b.fragment=x,b.index=f;var h=d.enumeratedString("BYTERANGE");return h&&b.setByteRange(h,l),l&&(b.fragOffset=l.fragOffset+l.duration),b}return P(u,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var x=this.elementaryStreams;return!!(x.audio||x.video||x.audiovideo)}}]),u}(A)},"./src/loader/key-loader.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return W});var X=L("./src/events.ts"),I=L("./src/errors.ts"),k=L("./src/utils/logger.ts"),W=function(){function F(D){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=D,this._registerListeners()}var O=F.prototype;return O._registerListeners=function(){this.hls.on(X.Events.KEY_LOADING,this.onKeyLoading,this)},O._unregisterListeners=function(){this.hls.off(X.Events.KEY_LOADING,this.onKeyLoading)},O.destroy=function(){this._unregisterListeners();for(var E in this.loaders){var w=this.loaders[E];w&&w.destroy()}this.loaders={}},O.onKeyLoading=function(E,w){var P=w.frag,_=P.type,A=this.loaders[_];if(!P.decryptdata){k.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var C=P.decryptdata.uri;if(C!==this.decrypturl||this.decryptkey===null){var c=this.hls.config;if(A&&(k.logger.warn("abort previous key loader for type:"+_),A.abort()),!C){k.logger.warn("key uri is falsy");return}var o=c.loader,u=P.loader=this.loaders[_]=new o(c);this.decrypturl=C,this.decryptkey=null;var d={url:C,frag:P,responseType:"arraybuffer"},x={timeout:c.fragLoadingTimeOut,maxRetry:0,retryDelay:c.fragLoadingRetryDelay,maxRetryDelay:c.fragLoadingMaxRetryTimeout,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(d,x,v)}else this.decryptkey&&(P.decryptdata.key=this.decryptkey,this.hls.trigger(X.Events.KEY_LOADED,{frag:P}))},O.loadsuccess=function(E,w,P){var _=P.frag;if(!_.decryptdata){k.logger.error("after key load, decryptdata unset");return}this.decryptkey=_.decryptdata.key=new Uint8Array(E.data),_.loader=null,delete this.loaders[_.type],this.hls.trigger(X.Events.KEY_LOADED,{frag:_})},O.loaderror=function(E,w){var P=w.frag,_=P.loader;_&&_.abort(),delete this.loaders[P.type],this.hls.trigger(X.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:P,response:E})},O.loadtimeout=function(E,w){var P=w.frag,_=P.loader;_&&_.abort(),delete this.loaders[P.type],this.hls.trigger(X.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:P})},F}()},"./src/loader/level-details.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"LevelDetails",function(){return F});var X=L("./src/polyfills/number.ts");function I(O,D){for(var E=0;E<D.length;E++){var w=D[E];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(O,w.key,w)}}function k(O,D,E){return D&&I(O.prototype,D),E&&I(O,E),O}var W=10,F=function(){function O(E){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=E}var D=O.prototype;return D.reloaded=function(w){if(!w){this.advanced=!0,this.updated=!0;return}var P=this.lastPartSn-w.lastPartSn,_=this.lastPartIndex-w.lastPartIndex;this.updated=this.endSN!==w.endSN||!!_||!!P,this.advanced=this.endSN>w.endSN||P>0||P===0&&_>0,this.updated||this.advanced?this.misses=Math.floor(w.misses*.6):this.misses=w.misses+1,this.availabilityDelay=w.availabilityDelay},k(O,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(X.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||W}},{key:"drift",get:function(){var w=this.driftEndTime-this.driftStartTime;if(w>0){var P=this.driftEnd-this.driftStart;return P*1e3/w}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var w;return(w=this.partList)!==null&&w!==void 0&&w.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var w;return(w=this.fragments)!==null&&w!==void 0&&w.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 w;return(w=this.partList)!==null&&w!==void 0&&w.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var w;return(w=this.partList)!==null&&w!==void 0&&w.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),O}()},"./src/loader/level-key.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"LevelKey",function(){return F});var X=L("./node_modules/url-toolkit/src/url-toolkit.js"),I=L.n(X);function k(O,D){for(var E=0;E<D.length;E++){var w=D[E];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(O,w.key,w)}}function W(O,D,E){return D&&k(O.prototype,D),E&&k(O,E),O}var F=function(){O.fromURL=function(E,w){return new O(E,w)},O.fromURI=function(E){return new O(E)};function O(D,E){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,E?this._uri=Object(X.buildAbsoluteURL)(D,E,{alwaysNormalize:!0}):this._uri=D}return W(O,[{key:"uri",get:function(){return this._uri}}]),O}()},"./src/loader/load-stats.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"LoadStats",function(){return X});var X=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return u});var X=L("./src/polyfills/number.ts"),I=L("./node_modules/url-toolkit/src/url-toolkit.js"),k=L.n(I),W=L("./src/loader/fragment.ts"),F=L("./src/loader/level-details.ts"),O=L("./src/loader/level-key.ts"),D=L("./src/utils/attr-list.ts"),E=L("./src/utils/logger.ts"),w=L("./src/utils/codecs.ts"),P=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,_=/#EXT-X-MEDIA:(.*)/g,A=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),C=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("|")),c=/\.(mp4|m4s|m4v|m4a)$/i;function o(l){var b,h;return c.test((b=(h=I.parseURL(l))===null||h===void 0?void 0:h.path)!=null?b:"")}var u=function(){function l(){}return l.findGroup=function(h,p){for(var s=0;s<h.length;s++){var a=h[s];if(a.id===p)return a}},l.convertAVC1ToAVCOTI=function(h){var p=h.split(".");if(p.length>2){var s=p.shift()+".";return s+=parseInt(p.shift()).toString(16),s+=("000"+parseInt(p.shift()).toString(16)).substr(-4),s}return h},l.resolve=function(h,p){return I.buildAbsoluteURL(p,h,{alwaysNormalize:!0})},l.parseMasterPlaylist=function(h,p){var s=[],a={},g=!1;P.lastIndex=0;for(var m;(m=P.exec(h))!=null;)if(m[1]){var y=new D.AttrList(m[1]),M={attrs:y,bitrate:y.decimalInteger("AVERAGE-BANDWIDTH")||y.decimalInteger("BANDWIDTH"),name:y.NAME,url:l.resolve(m[2],p)},H=y.decimalResolution("RESOLUTION");H&&(M.width=H.width,M.height=H.height),d((y.CODECS||"").split(/[ ,]+/).filter(function(te){return te}),M),M.videoCodec&&M.videoCodec.indexOf("avc1")!==-1&&(M.videoCodec=l.convertAVC1ToAVCOTI(M.videoCodec)),s.push(M)}else if(m[3]){var V=new D.AttrList(m[3]);V["DATA-ID"]&&(g=!0,a[V["DATA-ID"]]=V)}return{levels:s,sessionData:g?a:null}},l.parseMasterPlaylistMedia=function(h,p,s,a){a===void 0&&(a=[]);var g,m=[],y=0;for(_.lastIndex=0;(g=_.exec(h))!==null;){var M=new D.AttrList(g[1]);if(M.TYPE===s){var H={attrs:M,bitrate:0,id:y++,groupId:M["GROUP-ID"],instreamId:M["INSTREAM-ID"],name:M.NAME||M.LANGUAGE||"",type:s,default:M.bool("DEFAULT"),autoselect:M.bool("AUTOSELECT"),forced:M.bool("FORCED"),lang:M.LANGUAGE,url:M.URI?l.resolve(M.URI,p):""};if(a.length){var V=l.findGroup(a,H.groupId)||a[0];x(H,V,"audioCodec"),x(H,V,"textCodec")}m.push(H)}}return m},l.parseLevelPlaylist=function(h,p,s,a,g){var m=new F.LevelDetails(p),y=m.fragments,M=null,H=0,V=0,te=0,G=0,j=null,ie=new W.Fragment(a,p),pe,ge,be,Ne=-1,Se=!1;for(A.lastIndex=0,m.m3u8=h;(pe=A.exec(h))!==null;){Se&&(Se=!1,ie=new W.Fragment(a,p),ie.start=te,ie.sn=H,ie.cc=G,ie.level=s,M&&(ie.initSegment=M,ie.rawProgramDateTime=M.rawProgramDateTime));var Me=pe[1];if(Me){ie.duration=parseFloat(Me);var Le=(" "+pe[2]).slice(1);ie.title=Le||null,ie.tagList.push(Le?["INF",Me,Le]:["INF",Me])}else if(pe[3])Object(X.isFiniteNumber)(ie.duration)&&(ie.start=te,be&&(ie.levelkey=be),ie.sn=H,ie.level=s,ie.cc=G,ie.urlId=g,y.push(ie),ie.relurl=(" "+pe[3]).slice(1),f(ie,j),j=ie,te+=ie.duration,H++,V=0,Se=!0);else if(pe[4]){var we=(" "+pe[4]).slice(1);j?ie.setByteRange(we,j):ie.setByteRange(we)}else if(pe[5])ie.rawProgramDateTime=(" "+pe[5]).slice(1),ie.tagList.push(["PROGRAM-DATE-TIME",ie.rawProgramDateTime]),Ne===-1&&(Ne=y.length);else{if(pe=pe[0].match(C),!pe){E.logger.warn("No matches on slow regex match for level playlist!");continue}for(ge=1;ge<pe.length&&!(typeof pe[ge]!="undefined");ge++);var ve=(" "+pe[ge]).slice(1),N=(" "+pe[ge+1]).slice(1),T=pe[ge+2]?(" "+pe[ge+2]).slice(1):"";switch(ve){case"PLAYLIST-TYPE":m.type=N.toUpperCase();break;case"MEDIA-SEQUENCE":H=m.startSN=parseInt(N);break;case"SKIP":{var R=new D.AttrList(N),z=R.decimalInteger("SKIPPED-SEGMENTS");if(Object(X.isFiniteNumber)(z)){m.skippedSegments=z;for(var Z=z;Z--;)y.unshift(null);H+=z}var B=R.enumeratedString("RECENTLY-REMOVED-DATERANGES");B&&(m.recentlyRemovedDateranges=B.split(" "));break}case"TARGETDURATION":m.targetduration=parseFloat(N);break;case"VERSION":m.version=parseInt(N);break;case"EXTM3U":break;case"ENDLIST":m.live=!1;break;case"#":(N||T)&&ie.tagList.push(T?[N,T]:[N]);break;case"DIS":G++;case"GAP":ie.tagList.push([ve]);break;case"BITRATE":ie.tagList.push([ve,N]);break;case"DISCONTINUITY-SEQ":G=parseInt(N);break;case"KEY":{var ce,Ee=new D.AttrList(N),Ae=Ee.enumeratedString("METHOD"),Oe=Ee.URI,Re=Ee.hexadecimalInteger("IV"),De=Ee.enumeratedString("KEYFORMATVERSIONS"),Pe=Ee.enumeratedString("KEYID"),Ke=(ce=Ee.enumeratedString("KEYFORMAT"))!=null?ce:"identity",Xe=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Xe.indexOf(Ke)>-1){E.logger.warn("Keyformat "+Ke+" is not supported from the manifest");continue}else if(Ke!=="identity")continue;Ae&&(be=O.LevelKey.fromURL(p,Oe),Oe&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Ae)>=0&&(be.method=Ae,be.keyFormat=Ke,Pe&&(be.keyID=Pe),De&&(be.keyFormatVersions=De),be.iv=Re));break}case"START":{var Ye=new D.AttrList(N),$e=Ye.decimalFloatingPoint("TIME-OFFSET");Object(X.isFiniteNumber)($e)&&(m.startTimeOffset=$e);break}case"MAP":{var ft=new D.AttrList(N);ie.relurl=ft.URI,ft.BYTERANGE&&ie.setByteRange(ft.BYTERANGE),ie.level=s,ie.sn="initSegment",be&&(ie.levelkey=be),ie.initSegment=null,M=ie,Se=!0;break}case"SERVER-CONTROL":{var Je=new D.AttrList(N);m.canBlockReload=Je.bool("CAN-BLOCK-RELOAD"),m.canSkipUntil=Je.optionalFloat("CAN-SKIP-UNTIL",0),m.canSkipDateRanges=m.canSkipUntil>0&&Je.bool("CAN-SKIP-DATERANGES"),m.partHoldBack=Je.optionalFloat("PART-HOLD-BACK",0),m.holdBack=Je.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var et=new D.AttrList(N);m.partTarget=et.decimalFloatingPoint("PART-TARGET");break}case"PART":{var ke=m.partList;ke||(ke=m.partList=[]);var st=V>0?ke[ke.length-1]:void 0,nt=V++,oe=new W.Part(new D.AttrList(N),ie,p,nt,st);ke.push(oe),ie.duration+=oe.duration;break}case"PRELOAD-HINT":{var J=new D.AttrList(N);m.preloadHint=J;break}case"RENDITION-REPORT":{var Q=new D.AttrList(N);m.renditionReports=m.renditionReports||[],m.renditionReports.push(Q);break}default:E.logger.warn("line parsed but not handled: "+pe);break}}}j&&!j.relurl?(y.pop(),te-=j.duration,m.partList&&(m.fragmentHint=j)):m.partList&&(f(ie,j),ie.cc=G,m.fragmentHint=ie);var ne=y.length,le=y[0],q=y[ne-1];if(te+=m.skippedSegments*m.targetduration,te>0&&ne&&q){m.averagetargetduration=te/ne;var ee=q.sn;m.endSN=ee!=="initSegment"?ee:0,le&&(m.startCC=le.cc,le.initSegment||m.fragments.every(function(ae){return ae.relurl&&o(ae.relurl)})&&(E.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),ie=new W.Fragment(a,p),ie.relurl=q.relurl,ie.level=s,ie.sn="initSegment",le.initSegment=ie,m.needSidxRanges=!0))}else m.endSN=0,m.startCC=0;return m.fragmentHint&&(te+=m.fragmentHint.duration),m.totalduration=te,m.endCC=G,Ne>0&&v(y,Ne),m},l}();function d(l,b){["video","audio","text"].forEach(function(h){var p=l.filter(function(a){return Object(w.isCodecType)(a,h)});if(p.length){var s=p.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});b[h+"Codec"]=s.length>0?s[0]:p[0],l=l.filter(function(a){return p.indexOf(a)===-1})}}),b.unknownCodecs=l}function x(l,b,h){var p=b[h];p&&(l[h]=p)}function v(l,b){for(var h=l[b],p=b;p--;){var s=l[p];if(!s)return;s.programDateTime=h.programDateTime-s.duration*1e3,h=s}}function f(l,b){l.rawProgramDateTime?l.programDateTime=Date.parse(l.rawProgramDateTime):b!=null&&b.programDateTime&&(l.programDateTime=b.endProgramDateTime),Object(X.isFiniteNumber)(l.programDateTime)||(l.programDateTime=null,l.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(he,Y,L){"use strict";L.r(Y);var X=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),k=L("./src/errors.ts"),W=L("./src/utils/logger.ts"),F=L("./src/utils/mp4-tools.ts"),O=L("./src/loader/m3u8-parser.ts"),D=L("./src/types/loader.ts"),E=L("./src/utils/attr-list.ts");function w(A){var C=A.type;switch(C){case D.PlaylistContextType.AUDIO_TRACK:return D.PlaylistLevelType.AUDIO;case D.PlaylistContextType.SUBTITLE_TRACK:return D.PlaylistLevelType.SUBTITLE;default:return D.PlaylistLevelType.MAIN}}function P(A,C){var c=A.url;return(c===void 0||c.indexOf("data:")===0)&&(c=C.url),c}var _=function(){function A(c){this.hls=void 0,this.loaders=Object.create(null),this.hls=c,this.registerListeners()}var C=A.prototype;return C.registerListeners=function(){var o=this.hls;o.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(I.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},C.unregisterListeners=function(){var o=this.hls;o.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(I.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},C.createInternalLoader=function(o){var u=this.hls.config,d=u.pLoader,x=u.loader,v=d||x,f=new v(u);return o.loader=f,this.loaders[o.type]=f,f},C.getInternalLoader=function(o){return this.loaders[o.type]},C.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},C.destroyInternalLoaders=function(){for(var o in this.loaders){var u=this.loaders[o];u&&u.destroy(),this.resetInternalLoader(o)}},C.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},C.onManifestLoading=function(o,u){var d=u.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:D.PlaylistContextType.MANIFEST,url:d,deliveryDirectives:null})},C.onLevelLoading=function(o,u){var d=u.id,x=u.level,v=u.url,f=u.deliveryDirectives;this.load({id:d,groupId:null,level:x,responseType:"text",type:D.PlaylistContextType.LEVEL,url:v,deliveryDirectives:f})},C.onAudioTrackLoading=function(o,u){var d=u.id,x=u.groupId,v=u.url,f=u.deliveryDirectives;this.load({id:d,groupId:x,level:null,responseType:"text",type:D.PlaylistContextType.AUDIO_TRACK,url:v,deliveryDirectives:f})},C.onSubtitleTrackLoading=function(o,u){var d=u.id,x=u.groupId,v=u.url,f=u.deliveryDirectives;this.load({id:d,groupId:x,level:null,responseType:"text",type:D.PlaylistContextType.SUBTITLE_TRACK,url:v,deliveryDirectives:f})},C.load=function(o){var u,d=this.hls.config,x=this.getInternalLoader(o);if(x){var v=x.context;if(v&&v.url===o.url){W.logger.trace("[playlist-loader]: playlist request ongoing");return}W.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),x.abort()}var f,l,b,h;switch(o.type){case D.PlaylistContextType.MANIFEST:f=d.manifestLoadingMaxRetry,l=d.manifestLoadingTimeOut,b=d.manifestLoadingRetryDelay,h=d.manifestLoadingMaxRetryTimeout;break;case D.PlaylistContextType.LEVEL:case D.PlaylistContextType.AUDIO_TRACK:case D.PlaylistContextType.SUBTITLE_TRACK:f=0,l=d.levelLoadingTimeOut;break;default:f=d.levelLoadingMaxRetry,l=d.levelLoadingTimeOut,b=d.levelLoadingRetryDelay,h=d.levelLoadingMaxRetryTimeout;break}if(x=this.createInternalLoader(o),(u=o.deliveryDirectives)!==null&&u!==void 0&&u.part){var p;if(o.type===D.PlaylistContextType.LEVEL&&o.level!==null?p=this.hls.levels[o.level].details:o.type===D.PlaylistContextType.AUDIO_TRACK&&o.id!==null?p=this.hls.audioTracks[o.id].details:o.type===D.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(p=this.hls.subtitleTracks[o.id].details),p){var s=p.partTarget,a=p.targetduration;s&&a&&(l=Math.min(Math.max(s*3,a*.8)*1e3,l))}}var g={timeout:l,maxRetry:f,retryDelay:b,maxRetryDelay:h,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};x.load(o,g,m)},C.loadsuccess=function(o,u,d,x){if(x===void 0&&(x=null),d.isSidxRequest){this.handleSidxRequest(o,d),this.handlePlaylistLoaded(o,u,d,x);return}this.resetInternalLoader(d.type);var v=o.data;if(v.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,d,"no EXTM3U delimiter",x);return}u.parsing.start=performance.now(),v.indexOf("#EXTINF:")>0||v.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,u,d,x):this.handleMasterPlaylist(o,u,d,x)},C.loaderror=function(o,u,d){d===void 0&&(d=null),this.handleNetworkError(u,d,!1,o)},C.loadtimeout=function(o,u,d){d===void 0&&(d=null),this.handleNetworkError(u,d,!0)},C.handleMasterPlaylist=function(o,u,d,x){var v=this.hls,f=o.data,l=P(o,d),b=O.default.parseMasterPlaylist(f,l),h=b.levels,p=b.sessionData;if(!h.length){this.handleManifestParsingError(o,d,"no level found in manifest",x);return}var s=h.map(function(H){return{id:H.attrs.AUDIO,audioCodec:H.audioCodec}}),a=h.map(function(H){return{id:H.attrs.SUBTITLES,textCodec:H.textCodec}}),g=O.default.parseMasterPlaylistMedia(f,l,"AUDIO",s),m=O.default.parseMasterPlaylistMedia(f,l,"SUBTITLES",a),y=O.default.parseMasterPlaylistMedia(f,l,"CLOSED-CAPTIONS");if(g.length){var M=g.some(function(H){return!H.url});!M&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(W.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),g.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new E.AttrList({}),bitrate:0,url:""}))}v.trigger(I.Events.MANIFEST_LOADED,{levels:h,audioTracks:g,subtitles:m,captions:y,url:l,stats:u,networkDetails:x,sessionData:p})},C.handleTrackOrLevelPlaylist=function(o,u,d,x){var v=this.hls,f=d.id,l=d.level,b=d.type,h=P(o,d),p=Object(X.isFiniteNumber)(f)?f:0,s=Object(X.isFiniteNumber)(l)?l:p,a=w(d),g=O.default.parseLevelPlaylist(o.data,h,s,a,p);if(!g.fragments.length){v.trigger(I.Events.ERROR,{type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:h,reason:"no fragments found in level",level:typeof d.level=="number"?d.level:void 0});return}if(b===D.PlaylistContextType.MANIFEST){var m={attrs:new E.AttrList({}),bitrate:0,details:g,name:"",url:h};v.trigger(I.Events.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:h,stats:u,networkDetails:x,sessionData:null})}if(u.parsing.end=performance.now(),g.needSidxRanges){var y,M=(y=g.fragments[0].initSegment)===null||y===void 0?void 0:y.url;this.load({url:M,isSidxRequest:!0,type:b,level:l,levelDetails:g,id:f,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}d.levelDetails=g,this.handlePlaylistLoaded(o,u,d,x)},C.handleSidxRequest=function(o,u){var d=Object(F.parseSegmentIndex)(new Uint8Array(o.data));if(!d)return;var x=d.references,v=u.levelDetails;x.forEach(function(f,l){var b=f.info,h=v.fragments[l];h.byteRange.length===0&&h.setByteRange(String(1+b.end-b.start)+"@"+String(b.start)),h.initSegment&&h.initSegment.setByteRange(String(d.moovEndOffset)+"@0")})},C.handleManifestParsingError=function(o,u,d,x){this.hls.trigger(I.Events.ERROR,{type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:u.type===D.PlaylistContextType.MANIFEST,url:o.url,reason:d,response:o,context:u,networkDetails:x})},C.handleNetworkError=function(o,u,d,x){d===void 0&&(d=!1),W.logger.warn("[playlist-loader]: A network "+(d?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var v=k.ErrorDetails.UNKNOWN,f=!1,l=this.getInternalLoader(o);switch(o.type){case D.PlaylistContextType.MANIFEST:v=d?k.ErrorDetails.MANIFEST_LOAD_TIMEOUT:k.ErrorDetails.MANIFEST_LOAD_ERROR,f=!0;break;case D.PlaylistContextType.LEVEL:v=d?k.ErrorDetails.LEVEL_LOAD_TIMEOUT:k.ErrorDetails.LEVEL_LOAD_ERROR,f=!1;break;case D.PlaylistContextType.AUDIO_TRACK:v=d?k.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:k.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,f=!1;break;case D.PlaylistContextType.SUBTITLE_TRACK:v=d?k.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:k.ErrorDetails.SUBTITLE_LOAD_ERROR,f=!1;break}l&&this.resetInternalLoader(o.type);var b={type:k.ErrorTypes.NETWORK_ERROR,details:v,fatal:f,url:o.url,loader:l,context:o,networkDetails:u};x&&(b.response=x),this.hls.trigger(I.Events.ERROR,b)},C.handlePlaylistLoaded=function(o,u,d,x){var v=d.type,f=d.level,l=d.id,b=d.groupId,h=d.loader,p=d.levelDetails,s=d.deliveryDirectives;if(!(p!=null&&p.targetduration)){this.handleManifestParsingError(o,d,"invalid target duration",x);return}if(!h)return;p.live&&(h.getCacheAge&&(p.ageHeader=h.getCacheAge()||0),(!h.getCacheAge||isNaN(p.ageHeader))&&(p.ageHeader=0));switch(v){case D.PlaylistContextType.MANIFEST:case D.PlaylistContextType.LEVEL:this.hls.trigger(I.Events.LEVEL_LOADED,{details:p,level:f||0,id:l||0,stats:u,networkDetails:x,deliveryDirectives:s});break;case D.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(I.Events.AUDIO_TRACK_LOADED,{details:p,id:l||0,groupId:b||"",stats:u,networkDetails:x,deliveryDirectives:s});break;case D.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(I.Events.SUBTITLE_TRACK_LOADED,{details:p,id:l||0,groupId:b||"",stats:u,networkDetails:x,deliveryDirectives:s});break}},A}();Y.default=_},"./src/polyfills/number.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"isFiniteNumber",function(){return X}),L.d(Y,"MAX_SAFE_INTEGER",function(){return I});var X=Number.isFinite||function(k){return typeof k=="number"&&isFinite(k)},I=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(he,Y,L){"use strict";L.r(Y);var X=function(){function I(){}return I.getSilentFrame=function(W,F){switch(W){case"mp4a.40.2":if(F===1)return new Uint8Array([0,200,0,128,35,128]);if(F===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(F===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(F===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(F===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(F===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(F===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(F===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(F===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},I}();Y.default=X},"./src/remux/mp4-generator.ts":function(he,Y,L){"use strict";L.r(Y);var X=Math.pow(2,32)-1,I=function(){function k(){}return k.init=function(){k.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var F;for(F in k.types)k.types.hasOwnProperty(F)&&(k.types[F]=[F.charCodeAt(0),F.charCodeAt(1),F.charCodeAt(2),F.charCodeAt(3)]);var O=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),D=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);k.HDLR_TYPES={video:O,audio:D};var E=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),w=new Uint8Array([0,0,0,0,0,0,0,0]);k.STTS=k.STSC=k.STCO=w,k.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),k.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),k.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),k.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var P=new Uint8Array([105,115,111,109]),_=new Uint8Array([97,118,99,49]),A=new Uint8Array([0,0,0,1]);k.FTYP=k.box(k.types.ftyp,P,A,P,_),k.DINF=k.box(k.types.dinf,k.box(k.types.dref,E))},k.box=function(F){for(var O=8,D=arguments.length,E=new Array(D>1?D-1:0),w=1;w<D;w++)E[w-1]=arguments[w];for(var P=E.length,_=P;P--;)O+=E[P].byteLength;var A=new Uint8Array(O);for(A[0]=O>>24&255,A[1]=O>>16&255,A[2]=O>>8&255,A[3]=O&255,A.set(F,4),P=0,O=8;P<_;P++)A.set(E[P],O),O+=E[P].byteLength;return A},k.hdlr=function(F){return k.box(k.types.hdlr,k.HDLR_TYPES[F])},k.mdat=function(F){return k.box(k.types.mdat,F)},k.mdhd=function(F,O){O*=F;var D=Math.floor(O/(X+1)),E=Math.floor(O%(X+1));return k.box(k.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,F>>24&255,F>>16&255,F>>8&255,F&255,D>>24,D>>16&255,D>>8&255,D&255,E>>24,E>>16&255,E>>8&255,E&255,85,196,0,0]))},k.mdia=function(F){return k.box(k.types.mdia,k.mdhd(F.timescale,F.duration),k.hdlr(F.type),k.minf(F))},k.mfhd=function(F){return k.box(k.types.mfhd,new Uint8Array([0,0,0,0,F>>24,F>>16&255,F>>8&255,F&255]))},k.minf=function(F){return F.type==="audio"?k.box(k.types.minf,k.box(k.types.smhd,k.SMHD),k.DINF,k.stbl(F)):k.box(k.types.minf,k.box(k.types.vmhd,k.VMHD),k.DINF,k.stbl(F))},k.moof=function(F,O,D){return k.box(k.types.moof,k.mfhd(F),k.traf(D,O))},k.moov=function(F){for(var O=F.length,D=[];O--;)D[O]=k.trak(F[O]);return k.box.apply(null,[k.types.moov,k.mvhd(F[0].timescale,F[0].duration)].concat(D).concat(k.mvex(F)))},k.mvex=function(F){for(var O=F.length,D=[];O--;)D[O]=k.trex(F[O]);return k.box.apply(null,[k.types.mvex].concat(D))},k.mvhd=function(F,O){O*=F;var D=Math.floor(O/(X+1)),E=Math.floor(O%(X+1)),w=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,F>>24&255,F>>16&255,F>>8&255,F&255,D>>24,D>>16&255,D>>8&255,D&255,E>>24,E>>16&255,E>>8&255,E&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return k.box(k.types.mvhd,w)},k.sdtp=function(F){var O=F.samples||[],D=new Uint8Array(4+O.length),E,w;for(E=0;E<O.length;E++)w=O[E].flags,D[E+4]=w.dependsOn<<4|w.isDependedOn<<2|w.hasRedundancy;return k.box(k.types.sdtp,D)},k.stbl=function(F){return k.box(k.types.stbl,k.stsd(F),k.box(k.types.stts,k.STTS),k.box(k.types.stsc,k.STSC),k.box(k.types.stsz,k.STSZ),k.box(k.types.stco,k.STCO))},k.avc1=function(F){var O=[],D=[],E,w,P;for(E=0;E<F.sps.length;E++)w=F.sps[E],P=w.byteLength,O.push(P>>>8&255),O.push(P&255),O=O.concat(Array.prototype.slice.call(w));for(E=0;E<F.pps.length;E++)w=F.pps[E],P=w.byteLength,D.push(P>>>8&255),D.push(P&255),D=D.concat(Array.prototype.slice.call(w));var _=k.box(k.types.avcC,new Uint8Array([1,O[3],O[4],O[5],252|3,224|F.sps.length].concat(O).concat([F.pps.length]).concat(D))),A=F.width,C=F.height,c=F.pixelRatio[0],o=F.pixelRatio[1];return k.box(k.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,A>>8&255,A&255,C>>8&255,C&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),_,k.box(k.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),k.box(k.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,c&255,o>>24,o>>16&255,o>>8&255,o&255])))},k.esds=function(F){var O=F.config.length;return new Uint8Array([0,0,0,0,3,23+O,0,1,0,4,15+O,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([O]).concat(F.config).concat([6,1,2]))},k.mp4a=function(F){var O=F.samplerate;return k.box(k.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,F.channelCount,0,16,0,0,0,0,O>>8&255,O&255,0,0]),k.box(k.types.esds,k.esds(F)))},k.mp3=function(F){var O=F.samplerate;return k.box(k.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,F.channelCount,0,16,0,0,0,0,O>>8&255,O&255,0,0]))},k.stsd=function(F){return F.type==="audio"?!F.isAAC&&F.codec==="mp3"?k.box(k.types.stsd,k.STSD,k.mp3(F)):k.box(k.types.stsd,k.STSD,k.mp4a(F)):k.box(k.types.stsd,k.STSD,k.avc1(F))},k.tkhd=function(F){var O=F.id,D=F.duration*F.timescale,E=F.width,w=F.height,P=Math.floor(D/(X+1)),_=Math.floor(D%(X+1));return k.box(k.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,O>>24&255,O>>16&255,O>>8&255,O&255,0,0,0,0,P>>24,P>>16&255,P>>8&255,P&255,_>>24,_>>16&255,_>>8&255,_&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,E>>8&255,E&255,0,0,w>>8&255,w&255,0,0]))},k.traf=function(F,O){var D=k.sdtp(F),E=F.id,w=Math.floor(O/(X+1)),P=Math.floor(O%(X+1));return k.box(k.types.traf,k.box(k.types.tfhd,new Uint8Array([0,0,0,0,E>>24,E>>16&255,E>>8&255,E&255])),k.box(k.types.tfdt,new Uint8Array([1,0,0,0,w>>24,w>>16&255,w>>8&255,w&255,P>>24,P>>16&255,P>>8&255,P&255])),k.trun(F,D.length+16+20+8+16+8+8),D)},k.trak=function(F){return F.duration=F.duration||4294967295,k.box(k.types.trak,k.tkhd(F),k.mdia(F))},k.trex=function(F){var O=F.id;return k.box(k.types.trex,new Uint8Array([0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},k.trun=function(F,O){var D=F.samples||[],E=D.length,w=12+16*E,P=new Uint8Array(w),_,A,C,c,o,u;for(O+=8+w,P.set([0,0,15,1,E>>>24&255,E>>>16&255,E>>>8&255,E&255,O>>>24&255,O>>>16&255,O>>>8&255,O&255],0),_=0;_<E;_++)A=D[_],C=A.duration,c=A.size,o=A.flags,u=A.cts,P.set([C>>>24&255,C>>>16&255,C>>>8&255,C&255,c>>>24&255,c>>>16&255,c>>>8&255,c&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,u>>>24&255,u>>>16&255,u>>>8&255,u&255],12+16*_);return k.box(k.types.trun,P)},k.initSegment=function(F){k.types||k.init();var O=k.moov(F),D=new Uint8Array(k.FTYP.byteLength+O.byteLength);return D.set(k.FTYP),D.set(O,k.FTYP.byteLength),D},k}();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,Y.default=I},"./src/remux/mp4-remuxer.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return u}),L.d(Y,"normalizePts",function(){return d});var X=L("./src/polyfills/number.ts"),I=L("./src/remux/aac-helper.ts"),k=L("./src/remux/mp4-generator.ts"),W=L("./src/events.ts"),F=L("./src/errors.ts"),O=L("./src/utils/logger.ts"),D=L("./src/types/loader.ts"),E=L("./src/utils/timescale-conversion.ts");function w(){return w=Object.assign||function(l){for(var b=1;b<arguments.length;b++){var h=arguments[b];for(var p in h)Object.prototype.hasOwnProperty.call(h,p)&&(l[p]=h[p])}return l},w.apply(this,arguments)}var P=10*1e3,_=1024,A=1152,C=null,c=null,o=!1,u=function(){function l(h,p,s,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=h,this.config=p,this.typeSupported=s,this.ISGenerated=!1,C===null){var g=navigator.userAgent||"",m=g.match(/Chrome\/(\d+)/i);C=m?parseInt(m[1]):0}if(c===null){var y=navigator.userAgent.match(/Safari\/(\d+)/i);c=y?parseInt(y[1]):0}o=!!C&&C<75||!!c&&c<600}var b=l.prototype;return b.destroy=function(){},b.resetTimeStamp=function(p){O.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=p},b.resetNextTimestamp=function(){O.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},b.resetInitSegment=function(){O.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},b.getVideoStartPts=function(p){var s=!1,a=p.reduce(function(g,m){var y=m.pts-g;return y<-4294967296?(s=!0,d(g,m.pts)):y>0?g:m.pts},p[0].pts);return s&&O.logger.debug("PTS rollover detected"),a},b.remux=function(p,s,a,g,m,y,M,H){var V,te,G,j,ie,pe,ge=m,be=m,Ne=p.pid>-1,Se=s.pid>-1,Me=s.samples.length,Le=p.samples.length>0,we=Me>1,ve=(!Ne||Le)&&(!Se||we)||this.ISGenerated||M;if(ve){this.ISGenerated||(G=this.generateIS(p,s,m));var N=this.isVideoContiguous,T=-1;if(we&&(T=x(s.samples),!N&&this.config.forceKeyFrameOnDiscontinuity))if(pe=!0,T>0){O.logger.warn("[mp4-remuxer]: Dropped "+T+" out of "+Me+" video samples due to a missing keyframe");var R=this.getVideoStartPts(s.samples);s.samples=s.samples.slice(T),s.dropped+=T,be+=(s.samples[0].pts-R)/(s.timescale||9e4)}else T===-1&&(O.logger.warn("[mp4-remuxer]: No keyframe found out of "+Me+" video samples"),pe=!1);if(this.ISGenerated){if(Le&&we){var z=this.getVideoStartPts(s.samples),Z=d(p.samples[0].pts,z)-z,B=Z/s.inputTimeScale;ge+=Math.max(0,B),be+=Math.max(0,-B)}if(Le){if(p.samplerate||(O.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),G=this.generateIS(p,s,m)),te=this.remuxAudio(p,ge,this.isAudioContiguous,y,Se||we||H===D.PlaylistLevelType.AUDIO?be:void 0),we){var ce=te?te.endPTS-te.startPTS:0;s.inputTimeScale||(O.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),G=this.generateIS(p,s,m)),V=this.remuxVideo(s,be,N,ce)}}else we&&(V=this.remuxVideo(s,be,N,0));V&&(V.firstKeyFrame=T,V.independent=T!==-1)}}return this.ISGenerated&&(a.samples.length&&(ie=this.remuxID3(a,m)),g.samples.length&&(j=this.remuxText(g,m))),{audio:te,video:V,initSegment:G,independent:pe,text:j,id3:ie}},b.generateIS=function(p,s,a){var g=p.samples,m=s.samples,y=this.typeSupported,M={},H=!Object(X.isFiniteNumber)(this._initPTS),V="audio/mp4",te,G,j;if(H&&(te=G=Infinity),p.config&&g.length&&(p.timescale=p.samplerate,p.isAAC||(y.mpeg?(V="audio/mpeg",p.codec=""):y.mp3&&(p.codec="mp3")),M.audio={id:"audio",container:V,codec:p.codec,initSegment:!p.isAAC&&y.mpeg?new Uint8Array(0):k.default.initSegment([p]),metadata:{channelCount:p.channelCount}},H&&(j=p.inputTimeScale,te=G=g[0].pts-Math.round(j*a))),s.sps&&s.pps&&m.length&&(s.timescale=s.inputTimeScale,M.video={id:"main",container:"video/mp4",codec:s.codec,initSegment:k.default.initSegment([s]),metadata:{width:s.width,height:s.height}},H)){j=s.inputTimeScale;var ie=this.getVideoStartPts(m),pe=Math.round(j*a);G=Math.min(G,d(m[0].dts,ie)-pe),te=Math.min(te,ie-pe)}if(Object.keys(M).length)return this.ISGenerated=!0,H&&(this._initPTS=te,this._initDTS=G),{tracks:M,initPTS:te,timescale:j}},b.remuxVideo=function(p,s,a,g){var m=p.inputTimeScale,y=p.samples,M=[],H=y.length,V=this._initPTS,te=this.nextAvcDts,G=8,j,ie,pe,ge=Number.POSITIVE_INFINITY,be=Number.NEGATIVE_INFINITY,Ne=0,Se=!1;if(!a||te===null){var Me=s*m,Le=y[0].pts-d(y[0].dts,y[0].pts);te=Me-Le}for(var we=0;we<H;we++){var ve=y[we];if(ve.pts=d(ve.pts-V,te),ve.dts=d(ve.dts-V,te),ve.dts>ve.pts){var N=9e4*.2;Ne=Math.max(Math.min(Ne,ve.pts-ve.dts),-1*N)}ve.dts<y[we>0?we-1:we].dts&&(Se=!0)}Se&&y.sort(function(Lt,Ge){var tt=Lt.dts-Ge.dts,Dt=Lt.pts-Ge.pts;return tt||Dt}),ie=y[0].dts,pe=y[y.length-1].dts;var T=Math.round((pe-ie)/(H-1));if(Ne<0){if(Ne<T*-2){O.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(E.toMsFromMpegTsClock)(-T,!0)+" ms");for(var R=Ne,z=0;z<H;z++)y[z].dts=R=Math.max(R,y[z].pts-T),y[z].pts=Math.max(R,y[z].pts)}else{O.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(E.toMsFromMpegTsClock)(Ne,!0)+" ms to overcome this issue");for(var Z=0;Z<H;Z++)y[Z].dts=y[Z].dts+Ne}ie=y[0].dts}if(a){var B=ie-te,ce=B>T,Ee=B<-1;if(ce||Ee){ce?O.logger.warn("AVC: "+Object(E.toMsFromMpegTsClock)(B,!0)+" ms ("+B+"dts) hole between fragments detected, filling it"):O.logger.warn("AVC: "+Object(E.toMsFromMpegTsClock)(-B,!0)+" ms ("+B+"dts) overlapping between fragments detected"),ie=te;var Ae=y[0].pts-B;y[0].dts=ie,y[0].pts=Ae,O.logger.log("Video: First PTS/DTS adjusted: "+Object(E.toMsFromMpegTsClock)(Ae,!0)+"/"+Object(E.toMsFromMpegTsClock)(ie,!0)+", delta: "+Object(E.toMsFromMpegTsClock)(B,!0)+" ms")}}o&&(ie=Math.max(0,ie));for(var Oe=0,Re=0,De=0;De<H;De++){for(var Pe=y[De],Ke=Pe.units,Xe=Ke.length,Ye=0,$e=0;$e<Xe;$e++)Ye+=Ke[$e].data.length;Re+=Ye,Oe+=Xe,Pe.length=Ye,Pe.dts=Math.max(Pe.dts,ie),Pe.pts=Math.max(Pe.pts,Pe.dts,0),ge=Math.min(Pe.pts,ge),be=Math.max(Pe.pts,be)}pe=y[H-1].dts;var ft=Re+4*Oe+8,Je;try{Je=new Uint8Array(ft)}catch(Lt){this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:F.ErrorTypes.MUX_ERROR,details:F.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ft,reason:"fail allocating video mdat "+ft});return}var et=new DataView(Je.buffer);et.setUint32(0,ft),Je.set(k.default.types.mdat,4);for(var ke=0;ke<H;ke++){for(var st=y[ke],nt=st.units,oe=0,J=0,Q=nt.length;J<Q;J++){var ne=nt[J],le=ne.data,q=ne.data.byteLength;et.setUint32(G,q),G+=4,Je.set(le,G),G+=q,oe+=4+q}if(ke<H-1)j=y[ke+1].dts-st.dts;else{var ee=this.config,ae=st.dts-y[ke>0?ke-1:ke].dts;if(ee.stretchShortVideoTrack&&this.nextAudioPts!==null){var ue=Math.floor(ee.maxBufferHole*m),de=(g?ge+g*m:this.nextAudioPts)-st.pts;de>ue?(j=de-ae,j<0&&(j=ae),O.logger.log("[mp4-remuxer]: It is approximately "+de/90+" ms to the next segment; using duration "+j/90+" ms for the last video frame.")):j=ae}else j=ae}var ye=Math.round(st.pts-st.dts);M.push(new v(st.key,j,oe,ye))}if(M.length&&C&&C<70){var Te=M[0].flags;Te.dependsOn=2,Te.isNonSync=0}console.assert(j!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=te=pe+j,this.isVideoContiguous=!0;var Fe=k.default.moof(p.sequenceNumber++,ie,w({},p,{samples:M})),He="video",at={data1:Fe,data2:Je,startPTS:ge/m,endPTS:(be+j)/m,startDTS:ie/m,endDTS:te/m,type:He,hasAudio:!1,hasVideo:!0,nb:M.length,dropped:p.dropped};return p.samples=[],p.dropped=0,console.assert(Je.length,"MDAT length must not be zero"),at},b.remuxAudio=function(p,s,a,g,m){var y=p.inputTimeScale,M=p.samplerate?p.samplerate:y,H=y/M,V=p.isAAC?_:A,te=V*H,G=this._initPTS,j=!p.isAAC&&this.typeSupported.mpeg,ie=[],pe=p.samples,ge=j?0:8,be=this.nextAudioPts||-1,Ne=s*y;if(this.isAudioContiguous=a=a||pe.length&&be>0&&(g&&Math.abs(Ne-be)<9e3||Math.abs(d(pe[0].pts-G,Ne)-be)<20*te),pe.forEach(function(le){le.pts=d(le.pts-G,Ne)}),!a||be<0){if(pe=pe.filter(function(le){return le.pts>=0}),!pe.length)return;m===0?be=0:g?be=Math.max(0,Ne):be=pe[0].pts}if(p.isAAC)for(var Se=m!==void 0,Me=this.config.maxAudioFramesDrift,Le=0,we=be;Le<pe.length;Le++){var ve=pe[Le],N=ve.pts,T=N-we,R=Math.abs(1e3*T/y);if(T<=-Me*te&&Se)Le===0&&(O.logger.warn("Audio frame @ "+(N/y).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*T/y)+" ms."),this.nextAudioPts=be=we=N);else if(T>=Me*te&&R<P&&Se){var z=Math.round(T/te);we=N-z*te,we<0&&(z--,we+=te),Le===0&&(this.nextAudioPts=be=we),O.logger.warn("[mp4-remuxer]: Injecting "+z+" audio frame @ "+(we/y).toFixed(3)+"s due to "+Math.round(1e3*T/y)+" ms gap.");for(var Z=0;Z<z;Z++){var B=Math.max(we,0),ce=I.default.getSilentFrame(p.manifestCodec||p.codec,p.channelCount);ce||(O.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ce=ve.unit.subarray()),pe.splice(Le,0,{unit:ce,pts:B}),we+=te,Le++}}ve.pts=we,we+=te}for(var Ee=null,Ae=null,Oe,Re=0,De=pe.length;De--;)Re+=pe[De].unit.byteLength;for(var Pe=0,Ke=pe.length;Pe<Ke;Pe++){var Xe=pe[Pe],Ye=Xe.unit,$e=Xe.pts;if(Ae!==null){var ft=ie[Pe-1];ft.duration=Math.round(($e-Ae)/H)}else if(a&&p.isAAC&&($e=be),Ee=$e,Re>0){Re+=ge;try{Oe=new Uint8Array(Re)}catch(le){this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:F.ErrorTypes.MUX_ERROR,details:F.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Re,reason:"fail allocating audio mdat "+Re});return}if(!j){var Je=new DataView(Oe.buffer);Je.setUint32(0,Re),Oe.set(k.default.types.mdat,4)}}else return;Oe.set(Ye,ge);var et=Ye.byteLength;ge+=et,ie.push(new v(!0,V,et,0)),Ae=$e}var ke=ie.length;if(!ke)return;var st=ie[ie.length-1];this.nextAudioPts=be=Ae+H*st.duration;var nt=j?new Uint8Array(0):k.default.moof(p.sequenceNumber++,Ee/H,w({},p,{samples:ie}));p.samples=[];var oe=Ee/y,J=be/y,Q="audio",ne={data1:nt,data2:Oe,startPTS:oe,endPTS:J,startDTS:oe,endDTS:J,type:Q,hasAudio:!0,hasVideo:!1,nb:ke};return this.isAudioContiguous=!0,console.assert(Oe.length,"MDAT length must not be zero"),ne},b.remuxEmptyAudio=function(p,s,a,g){var m=p.inputTimeScale,y=p.samplerate?p.samplerate:m,M=m/y,H=this.nextAudioPts,V=(H!==null?H:g.startDTS*m)+this._initDTS,te=g.endDTS*m+this._initDTS,G=M*_,j=Math.ceil((te-V)/G),ie=I.default.getSilentFrame(p.manifestCodec||p.codec,p.channelCount);if(O.logger.warn("[mp4-remuxer]: remux empty Audio"),!ie){O.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var pe=[],ge=0;ge<j;ge++){var be=V+ge*G;pe.push({unit:ie,pts:be,dts:be})}return p.samples=pe,this.remuxAudio(p,s,a,!1)},b.remuxID3=function(p,s){var a=p.samples.length;if(!a)return;for(var g=p.inputTimeScale,m=this._initPTS,y=this._initDTS,M=0;M<a;M++){var H=p.samples[M];H.pts=d(H.pts-m,s*g)/g,H.dts=d(H.dts-y,s*g)/g}var V=p.samples;return p.samples=[],{samples:V}},b.remuxText=function(p,s){var a=p.samples.length;if(!a)return;for(var g=p.inputTimeScale,m=this._initPTS,y=0;y<a;y++){var M=p.samples[y];M.pts=d(M.pts-m,s*g)/g}p.samples.sort(function(V,te){return V.pts-te.pts});var H=p.samples;return p.samples=[],{samples:H}},l}();function d(l,b){var h;if(b===null)return l;for(b<l?h=-8589934592:h=8589934592;Math.abs(l-b)>4294967296;)l+=h;return l}function x(l){for(var b=0;b<l.length;b++)if(l[b].key)return b;return-1}var v=function(b,h,p,s){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=h,this.size=p,this.cts=s,this.flags=new f(b)},f=function(b){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=b?2:1,this.isNonSync=b?0:1}},"./src/remux/passthrough-remuxer.ts":function(he,Y,L){"use strict";L.r(Y);var X=L("./src/polyfills/number.ts"),I=L("./src/utils/mp4-tools.ts"),k=L("./src/loader/fragment.ts"),W=L("./src/utils/logger.ts"),F=function(){function E(){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 w=E.prototype;return w.destroy=function(){},w.resetTimeStamp=function(_){this.initPTS=_,this.lastEndDTS=null},w.resetNextTimestamp=function(){this.lastEndDTS=null},w.resetInitSegment=function(_,A,C){this.audioCodec=A,this.videoCodec=C,this.generateInitSegment(_),this.emitInitSegment=!0},w.generateInitSegment=function(_){var A=this.audioCodec,C=this.videoCodec;if(!_||!_.byteLength){this.initTracks=void 0,this.initData=void 0;return}var c=this.initData=Object(I.parseInitSegment)(_);A||(A=D(c.audio,k.ElementaryStreamTypes.AUDIO)),C||(C=D(c.video,k.ElementaryStreamTypes.VIDEO));var o={};c.audio&&c.video?o.audiovideo={container:"video/mp4",codec:A+","+C,initSegment:_,id:"main"}:c.audio?o.audio={container:"audio/mp4",codec:A,initSegment:_,id:"audio"}:c.video?o.video={container:"video/mp4",codec:C,initSegment:_,id:"main"}:W.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},w.remux=function(_,A,C,c,o){var u=this.initPTS,d=this.lastEndDTS,x={audio:void 0,video:void 0,text:c,id3:C,initSegment:void 0};Object(X.isFiniteNumber)(d)||(d=this.lastEndDTS=o||0);var v=A.samples;if(!v||!v.length)return x;var f={initPTS:void 0,timescale:1},l=this.initData;if((!l||!l.length)&&(this.generateInitSegment(v),l=this.initData),!l||!l.length)return W.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),x;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1),Object(X.isFiniteNumber)(u)||(this.initPTS=f.initPTS=u=O(l,v,d));var b=Object(I.getDuration)(v,l),h=d,p=b+h;Object(I.offsetStartDTS)(l,v,u),b>0?this.lastEndDTS=p:(W.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var s=!!l.audio,a=!!l.video,g="";s&&(g+="audio"),a&&(g+="video");var m={data1:v,startPTS:h,startDTS:h,endPTS:p,endDTS:p,type:g,hasAudio:s,hasVideo:a,nb:1,dropped:0};return x.audio=m.type==="audio"?m:void 0,x.video=m.type!=="audio"?m:void 0,x.text=c,x.id3=C,x.initSegment=f,x},E}(),O=function(w,P,_){return Object(I.getStartDTS)(w,P)-_};function D(E,w){var P=E==null?void 0:E.codec;return P&&P.length>4?P:P==="hvc1"?"hvc1.1.c.L120.90":P==="av01"?"av01.0.04M.08":P==="avc1"||w===k.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}Y.default=F},"./src/task-loop.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return X});var X=function(){function I(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var k=I.prototype;return k.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},k.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},k.onHandlerDestroyed=function(){},k.hasInterval=function(){return!!this._tickInterval},k.hasNextTick=function(){return!!this._tickTimer},k.setInterval=function(F){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,F),!0)},k.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},k.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},k.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},k.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},k.doTick=function(){},I}()},"./src/types/cmcd.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"CMCDVersion",function(){return X}),L.d(Y,"CMCDObjectType",function(){return I}),L.d(Y,"CMCDStreamingFormat",function(){return k}),L.d(Y,"CMCDStreamType",function(){return W});var X=1,I;(function(F){F.MANIFEST="m",F.AUDIO="a",F.VIDEO="v",F.MUXED="av",F.INIT="i",F.CAPTION="c",F.TIMED_TEXT="tt",F.KEY="k",F.OTHER="o"})(I||(I={}));var k;(function(F){F.DASH="d",F.HLS="h",F.SMOOTH="s",F.OTHER="o"})(k||(k={}));var W;(function(F){F.VOD="v",F.LIVE="l"})(W||(W={}))},"./src/types/level.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"HlsSkip",function(){return k}),L.d(Y,"getSkipValue",function(){return W}),L.d(Y,"HlsUrlParameters",function(){return F}),L.d(Y,"Level",function(){return O});function X(D,E){for(var w=0;w<E.length;w++){var P=E[w];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(D,P.key,P)}}function I(D,E,w){return E&&X(D.prototype,E),w&&X(D,w),D}var k;(function(D){D.No="",D.Yes="YES",D.v2="v2"})(k||(k={}));function W(D,E){var w=D.canSkipUntil,P=D.canSkipDateRanges,_=D.endSN,A=E!==void 0?E-_:0;return w&&A<w?P?k.v2:k.Yes:k.No}var F=function(){function D(w,P,_){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=w,this.part=P,this.skip=_}var E=D.prototype;return E.addDirectives=function(P){var _=new self.URL(P);return this.msn!==void 0&&_.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&_.searchParams.set("_HLS_part",this.part.toString()),this.skip&&_.searchParams.set("_HLS_skip",this.skip),_.toString()},D}(),O=function(){function D(E){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=[E.url],this.attrs=E.attrs,this.bitrate=E.bitrate,E.details&&(this.details=E.details),this.id=E.id||0,this.name=E.name,this.width=E.width||0,this.height=E.height||0,this.audioCodec=E.audioCodec,this.videoCodec=E.videoCodec,this.unknownCodecs=E.unknownCodecs,this.codecSet=[E.videoCodec,E.audioCodec].filter(function(w){return w}).join(",").replace(/\.[^.,]+/g,"")}return I(D,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(w){var P=w%this.url.length;this._urlId!==P&&(this.details=void 0,this._urlId=P)}}]),D}()},"./src/types/loader.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"PlaylistContextType",function(){return X}),L.d(Y,"PlaylistLevelType",function(){return I});var X;(function(k){k.MANIFEST="manifest",k.LEVEL="level",k.AUDIO_TRACK="audioTrack",k.SUBTITLE_TRACK="subtitleTrack"})(X||(X={}));var I;(function(k){k.MAIN="main",k.AUDIO="audio",k.SUBTITLE="subtitle"})(I||(I={}))},"./src/types/transmuxer.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"ChunkMetadata",function(){return X});var X=function(W,F,O,D,E,w){D===void 0&&(D=0),E===void 0&&(E=-1),w===void 0&&(w=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=I(),this.buffering={audio:I(),video:I(),audiovideo:I()},this.level=W,this.sn=F,this.id=O,this.size=D,this.part=E,this.partial=w};function I(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"AttrList",function(){return k});var X=/^(\d+)x(\d+)$/,I=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,k=function(){function W(O){typeof O=="string"&&(O=W.parseAttrList(O));for(var D in O)O.hasOwnProperty(D)&&(this[D]=O[D])}var F=W.prototype;return F.decimalInteger=function(D){var E=parseInt(this[D],10);return E>Number.MAX_SAFE_INTEGER?Infinity:E},F.hexadecimalInteger=function(D){if(this[D]){var E=(this[D]||"0x").slice(2);E=(E.length&1?"0":"")+E;for(var w=new Uint8Array(E.length/2),P=0;P<E.length/2;P++)w[P]=parseInt(E.slice(P*2,P*2+2),16);return w}else return null},F.hexadecimalIntegerAsNumber=function(D){var E=parseInt(this[D],16);return E>Number.MAX_SAFE_INTEGER?Infinity:E},F.decimalFloatingPoint=function(D){return parseFloat(this[D])},F.optionalFloat=function(D,E){var w=this[D];return w?parseFloat(w):E},F.enumeratedString=function(D){return this[D]},F.bool=function(D){return this[D]==="YES"},F.decimalResolution=function(D){var E=X.exec(this[D]);return E===null?void 0:{width:parseInt(E[1],10),height:parseInt(E[2],10)}},W.parseAttrList=function(D){var E,w={},P='"';for(I.lastIndex=0;(E=I.exec(D))!==null;){var _=E[2];_.indexOf(P)===0&&_.lastIndexOf(P)===_.length-1&&(_=_.slice(1,-1)),w[E[1]]=_}return w},W}()},"./src/utils/binary-search.ts":function(he,Y,L){"use strict";L.r(Y);var X={search:function(k,W){for(var F=0,O=k.length-1,D=null,E=null;F<=O;){D=(F+O)/2|0,E=k[D];var w=W(E);if(w>0)F=D+1;else if(w<0)O=D-1;else return E}return null}};Y.default=X},"./src/utils/buffer-helper.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"BufferHelper",function(){return k});var X=L("./src/utils/logger.ts"),I={length:0,start:function(){return 0},end:function(){return 0}},k=function(){function W(){}return W.isBuffered=function(O,D){try{if(O){for(var E=W.getBuffered(O),w=0;w<E.length;w++)if(D>=E.start(w)&&D<=E.end(w))return!0}}catch(P){}return!1},W.bufferInfo=function(O,D,E){try{if(O){var w=W.getBuffered(O),P=[],_;for(_=0;_<w.length;_++)P.push({start:w.start(_),end:w.end(_)});return this.bufferedInfo(P,D,E)}}catch(A){}return{len:0,start:D,end:D,nextStart:void 0}},W.bufferedInfo=function(O,D,E){D=Math.max(0,D),O.sort(function(f,l){var b=f.start-l.start;return b||l.end-f.end});var w=[];if(E)for(var P=0;P<O.length;P++){var _=w.length;if(_){var A=w[_-1].end;O[P].start-A<E?O[P].end>A&&(w[_-1].end=O[P].end):w.push(O[P])}else w.push(O[P])}else w=O;for(var C=0,c,o=D,u=D,d=0;d<w.length;d++){var x=w[d].start,v=w[d].end;if(D+E>=x&&D<v)o=x,u=v,C=u-D;else if(D+E<x){c=x;break}}return{len:C,start:o||0,end:u||0,nextStart:c}},W.getBuffered=function(O){try{return O.buffered}catch(D){return X.logger.log("failed to get media.buffered",D),I}},W}()},"./src/utils/cea-608-parser.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"Row",function(){return u}),L.d(Y,"CaptionScreen",function(){return d});var X=L("./src/utils/logger.ts"),I={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},k=function(p){var s=p;return I.hasOwnProperty(p)&&(s=I[p]),String.fromCharCode(s)},W=15,F=100,O={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},D={17:2,18:4,21:6,22:8,23:10,19:13,20:15},E={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},w={25:2,26:4,29:6,30:8,31:10,27:13,28:15},P=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],_;(function(h){h[h.ERROR=0]="ERROR",h[h.TEXT=1]="TEXT",h[h.WARNING=2]="WARNING",h[h.INFO=2]="INFO",h[h.DEBUG=3]="DEBUG",h[h.DATA=3]="DATA"})(_||(_={}));var A=function(){function h(){this.time=null,this.verboseLevel=_.ERROR}var p=h.prototype;return p.log=function(a,g){this.verboseLevel>=a&&X.logger.log(this.time+" ["+a+"] "+g)},h}(),C=function(p){for(var s=[],a=0;a<p.length;a++)s.push(p[a].toString(16));return s},c=function(){function h(s,a,g,m,y){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=s||"white",this.underline=a||!1,this.italics=g||!1,this.background=m||"black",this.flash=y||!1}var p=h.prototype;return p.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},p.setStyles=function(a){for(var g=["foreground","underline","italics","background","flash"],m=0;m<g.length;m++){var y=g[m];a.hasOwnProperty(y)&&(this[y]=a[y])}},p.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},p.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},p.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},p.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},h}(),o=function(){function h(s,a,g,m,y,M){this.uchar=void 0,this.penState=void 0,this.uchar=s||" ",this.penState=new c(a,g,m,y,M)}var p=h.prototype;return p.reset=function(){this.uchar=" ",this.penState.reset()},p.setChar=function(a,g){this.uchar=a,this.penState.copy(g)},p.setPenState=function(a){this.penState.copy(a)},p.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},p.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},p.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},h}(),u=function(){function h(s){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<F;a++)this.chars.push(new o);this.logger=s,this.pos=0,this.currPenState=new c}var p=h.prototype;return p.equals=function(a){for(var g=!0,m=0;m<F;m++)if(!this.chars[m].equals(a.chars[m])){g=!1;break}return g},p.copy=function(a){for(var g=0;g<F;g++)this.chars[g].copy(a.chars[g])},p.isEmpty=function(){for(var a=!0,g=0;g<F;g++)if(!this.chars[g].isEmpty()){a=!1;break}return a},p.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(_.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>F&&(this.logger.log(_.DEBUG,"Too large cursor position "+this.pos),this.pos=F)},p.moveCursor=function(a){var g=this.pos+a;if(a>1)for(var m=this.pos+1;m<g+1;m++)this.chars[m].setPenState(this.currPenState);this.setCursor(g)},p.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},p.insertChar=function(a){a>=144&&this.backSpace();var g=k(a);if(this.pos>=F){this.logger.log(_.ERROR,"Cannot insert "+a.toString(16)+" ("+g+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(g,this.currPenState),this.moveCursor(1)},p.clearFromPos=function(a){var g;for(g=a;g<F;g++)this.chars[g].reset()},p.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},p.clearToEndOfRow=function(){this.clearFromPos(this.pos)},p.getTextString=function(){for(var a=[],g=!0,m=0;m<F;m++){var y=this.chars[m].uchar;y!==" "&&(g=!1),a.push(y)}return g?"":a.join("")},p.setPenStyles=function(a){this.currPenState.setStyles(a);var g=this.chars[this.pos];g.setPenState(this.currPenState)},h}(),d=function(){function h(s){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<W;a++)this.rows.push(new u(s));this.logger=s,this.currRow=W-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var p=h.prototype;return p.reset=function(){for(var a=0;a<W;a++)this.rows[a].clear();this.currRow=W-1},p.equals=function(a){for(var g=!0,m=0;m<W;m++)if(!this.rows[m].equals(a.rows[m])){g=!1;break}return g},p.copy=function(a){for(var g=0;g<W;g++)this.rows[g].copy(a.rows[g])},p.isEmpty=function(){for(var a=!0,g=0;g<W;g++)if(!this.rows[g].isEmpty()){a=!1;break}return a},p.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},p.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},p.insertChar=function(a){var g=this.rows[this.currRow];g.insertChar(a)},p.setPen=function(a){var g=this.rows[this.currRow];g.setPenStyles(a)},p.moveCursor=function(a){var g=this.rows[this.currRow];g.moveCursor(a)},p.setCursor=function(a){this.logger.log(_.INFO,"setCursor: "+a);var g=this.rows[this.currRow];g.setCursor(a)},p.setPAC=function(a){this.logger.log(_.INFO,"pacData = "+JSON.stringify(a));var g=a.row-1;if(this.nrRollUpRows&&g<this.nrRollUpRows-1&&(g=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==g){for(var m=0;m<W;m++)this.rows[m].clear();var y=this.currRow+1-this.nrRollUpRows,M=this.lastOutputScreen;if(M){var H=M.rows[y].cueStartTime,V=this.logger.time;if(H&&V!==null&&H<V)for(var te=0;te<this.nrRollUpRows;te++)this.rows[g-this.nrRollUpRows+te+1].copy(M.rows[y+te])}}this.currRow=g;var G=this.rows[this.currRow];if(a.indent!==null){var j=a.indent,ie=Math.max(j-1,0);G.setCursor(a.indent),a.color=G.chars[ie].penState.foreground}var pe={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(pe)},p.setBkgData=function(a){this.logger.log(_.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},p.setRollUpRows=function(a){this.nrRollUpRows=a},p.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(_.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(_.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,g=this.rows.splice(a,1)[0];g.clear(),this.rows.splice(this.currRow,0,g),this.logger.log(_.INFO,"Rolling up")},p.getDisplayText=function(a){a=a||!1;for(var g=[],m="",y=-1,M=0;M<W;M++){var H=this.rows[M].getTextString();H&&(y=M+1,a?g.push("Row "+y+": '"+H+"'"):g.push(H.trim()))}return g.length>0&&(a?m="["+g.join(" | ")+"]":m=g.join(`
|
|
`)),m},p.getTextAndFormat=function(){return this.rows},h}(),x=function(){function h(s,a,g){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=s,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new d(g),this.nonDisplayedMemory=new d(g),this.lastOutputScreen=new d(g),this.currRollUpRow=this.displayedMemory.rows[W-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=g}var p=h.prototype;return p.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[W-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},p.getHandler=function(){return this.outputFilter},p.setHandler=function(a){this.outputFilter=a},p.setPAC=function(a){this.writeScreen.setPAC(a)},p.setBkgData=function(a){this.writeScreen.setBkgData(a)},p.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(_.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},p.insertChars=function(a){for(var g=0;g<a.length;g++)this.writeScreen.insertChar(a[g]);var m=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(_.INFO,m+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(_.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},p.ccRCL=function(){this.logger.log(_.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},p.ccBS=function(){if(this.logger.log(_.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},p.ccAOF=function(){},p.ccAON=function(){},p.ccDER=function(){this.logger.log(_.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},p.ccRU=function(a){this.logger.log(_.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},p.ccFON=function(){this.logger.log(_.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},p.ccRDC=function(){this.logger.log(_.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},p.ccTR=function(){this.logger.log(_.INFO,"TR"),this.setMode("MODE_TEXT")},p.ccRTD=function(){this.logger.log(_.INFO,"RTD"),this.setMode("MODE_TEXT")},p.ccEDM=function(){this.logger.log(_.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},p.ccCR=function(){this.logger.log(_.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},p.ccENM=function(){this.logger.log(_.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},p.ccEOC=function(){if(this.logger.log(_.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(_.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},p.ccTO=function(a){this.logger.log(_.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},p.ccMIDROW=function(a){var g={flash:!1};if(g.underline=a%2===1,g.italics=a>=46,g.italics)g.foreground="white";else{var m=Math.floor(a/2)-16,y=["white","green","blue","cyan","red","yellow","magenta"];g.foreground=y[m]}this.logger.log(_.INFO,"MIDROW: "+JSON.stringify(g)),this.writeScreen.setPen(g)},p.outputDataUpdate=function(a){a===void 0&&(a=!1);var g=this.logger.time;if(g===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=g:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,g,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:g),this.lastOutputScreen.copy(this.displayedMemory))},p.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},h}(),v=function(){function h(s,a,g){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var m=new A;this.channels=[null,new x(s,a,m),new x(s+1,g,m)],this.cmdHistory=b(),this.logger=m}var p=h.prototype;return p.getHandler=function(a){return this.channels[a].getHandler()},p.setHandler=function(a,g){this.channels[a].setHandler(g)},p.addData=function(a,g){var m,y,M,H=!1;this.logger.time=a;for(var V=0;V<g.length;V+=2){if(y=g[V]&127,M=g[V+1]&127,y===0&&M===0)continue;if(this.logger.log(_.DATA,"["+C([g[V],g[V+1]])+"] -> ("+C([y,M])+")"),m=this.parseCmd(y,M),m||(m=this.parseMidrow(y,M)),m||(m=this.parsePAC(y,M)),m||(m=this.parseBackgroundAttributes(y,M)),!m&&(H=this.parseChars(y,M),H)){var te=this.currentChannel;if(te&&te>0){var G=this.channels[te];G.insertChars(H)}else this.logger.log(_.WARNING,"No channel found yet. TEXT-MODE?")}!m&&!H&&this.logger.log(_.WARNING,"Couldn't parse cleaned data "+C([y,M])+" orig: "+C([g[V],g[V+1]]))}},p.parseCmd=function(a,g){var m=this.cmdHistory,y=(a===20||a===28||a===21||a===29)&&g>=32&&g<=47,M=(a===23||a===31)&&g>=33&&g<=35;if(!(y||M))return!1;if(l(a,g,m))return f(null,null,m),this.logger.log(_.DEBUG,"Repeated command ("+C([a,g])+") is dropped"),!0;var H=a===20||a===21||a===23?1:2,V=this.channels[H];return a===20||a===21||a===28||a===29?g===32?V.ccRCL():g===33?V.ccBS():g===34?V.ccAOF():g===35?V.ccAON():g===36?V.ccDER():g===37?V.ccRU(2):g===38?V.ccRU(3):g===39?V.ccRU(4):g===40?V.ccFON():g===41?V.ccRDC():g===42?V.ccTR():g===43?V.ccRTD():g===44?V.ccEDM():g===45?V.ccCR():g===46?V.ccENM():g===47&&V.ccEOC():V.ccTO(g-32),f(a,g,m),this.currentChannel=H,!0},p.parseMidrow=function(a,g){var m=0;if((a===17||a===25)&&g>=32&&g<=47){if(a===17?m=1:m=2,m!==this.currentChannel)return this.logger.log(_.ERROR,"Mismatch channel in midrow parsing"),!1;var y=this.channels[m];return y?(y.ccMIDROW(g),this.logger.log(_.DEBUG,"MIDROW ("+C([a,g])+")"),!0):!1}return!1},p.parsePAC=function(a,g){var m,y=this.cmdHistory,M=(a>=17&&a<=23||a>=25&&a<=31)&&g>=64&&g<=127,H=(a===16||a===24)&&g>=64&&g<=95;if(!(M||H))return!1;if(l(a,g,y))return f(null,null,y),!0;var V=a<=23?1:2;g>=64&&g<=95?m=V===1?O[a]:E[a]:m=V===1?D[a]:w[a];var te=this.channels[V];return te?(te.setPAC(this.interpretPAC(m,g)),f(a,g,y),this.currentChannel=V,!0):!1},p.interpretPAC=function(a,g){var m,y={color:null,italics:!1,indent:null,underline:!1,row:a};return g>95?m=g-96:m=g-64,y.underline=(m&1)===1,m<=13?y.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(m/2)]:m<=15?(y.italics=!0,y.color="white"):y.indent=Math.floor((m-16)/2)*4,y},p.parseChars=function(a,g){var m,y=null,M=null;if(a>=25?(m=2,M=a-8):(m=1,M=a),M>=17&&M<=19){var H;M===17?H=g+80:M===18?H=g+112:H=g+144,this.logger.log(_.INFO,"Special char '"+k(H)+"' in channel "+m),y=[H]}else a>=32&&a<=127&&(y=g===0?[a]:[a,g]);if(y){var V=C(y);this.logger.log(_.DEBUG,"Char codes = "+V.join(",")),f(a,g,this.cmdHistory)}return y},p.parseBackgroundAttributes=function(a,g){var m=(a===16||a===24)&&g>=32&&g<=47,y=(a===23||a===31)&&g>=45&&g<=47;if(!(m||y))return!1;var M,H={};a===16||a===24?(M=Math.floor((g-32)/2),H.background=P[M],g%2===1&&(H.background=H.background+"_semi")):g===45?H.background="transparent":(H.foreground="black",g===47&&(H.underline=!0));var V=a<=23?1:2,te=this.channels[V];return te.setBkgData(H),f(a,g,this.cmdHistory),!0},p.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var g=this.channels[a];g&&g.reset()}this.cmdHistory=b()},p.cueSplitAtTime=function(a){for(var g=0;g<this.channels.length;g++){var m=this.channels[g];m&&m.cueSplitAtTime(a)}},h}();function f(h,p,s){s.a=h,s.b=p}function l(h,p,s){return s.a===h&&s.b===p}function b(){return{a:null,b:null}}Y.default=v},"./src/utils/codecs.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"isCodecType",function(){return I}),L.d(Y,"isCodecSupportedInMp4",function(){return k});var X={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(W,F){var O=X[F];return!!O&&O[W.slice(0,4)]===!0}function k(W,F){return MediaSource.isTypeSupported((F||"video")+'/mp4;codecs="'+W+'"')}},"./src/utils/cues.ts":function(he,Y,L){"use strict";L.r(Y);var X=L("./src/utils/vttparser.ts"),I=L("./src/utils/webvtt-parser.ts"),k=L("./src/utils/texttrack-utils.ts"),W=/\s/,F={newCue:function(D,E,w,P){for(var _=[],A,C,c,o,u,d=self.VTTCue||self.TextTrackCue,x=0;x<P.rows.length;x++)if(A=P.rows[x],c=!0,o=0,u="",!A.isEmpty()){for(var v=0;v<A.chars.length;v++)W.test(A.chars[v].uchar)&&c?o++:(u+=A.chars[v].uchar,c=!1);A.cueStartTime=E,E===w&&(w+=1e-4),o>=16?o--:o++;var f=Object(X.fixLineBreaks)(u.trim()),l=Object(I.generateCueId)(E,w,f);(!D||!D.cues||!D.cues.getCueById(l))&&(C=new d(E,w,f),C.id=l,C.line=x+1,C.align="left",C.position=10+Math.min(80,Math.floor(o*8/32)*10),_.push(C))}return D&&_.length&&(_.sort(function(b,h){return b.line==="auto"||h.line==="auto"?0:b.line>8&&h.line>8?h.line-b.line:b.line-h.line}),_.forEach(function(b){return Object(k.addCueToTrack)(D,b)})),_}};Y.default=F},"./src/utils/discontinuities.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"findFirstFragWithCC",function(){return W}),L.d(Y,"shouldAlignOnDiscontinuities",function(){return F}),L.d(Y,"findDiscontinuousReferenceFrag",function(){return O}),L.d(Y,"adjustSlidingStart",function(){return E}),L.d(Y,"alignStream",function(){return w}),L.d(Y,"alignPDT",function(){return _}),L.d(Y,"alignFragmentByPDTDelta",function(){return A}),L.d(Y,"alignMediaPlaylistByPDT",function(){return C});var X=L("./src/polyfills/number.ts"),I=L("./src/utils/logger.ts"),k=L("./src/controller/level-helper.ts");function W(c,o){for(var u=null,d=0,x=c.length;d<x;d++){var v=c[d];if(v&&v.cc===o){u=v;break}}return u}function F(c,o,u){return!!(o.details&&(u.endCC>u.startCC||c&&c.cc<u.startCC))}function O(c,o){var u=c.fragments,d=o.fragments;if(!d.length||!u.length){I.logger.log("No fragments to align");return}var x=W(u,d[0].cc);if(!x||x&&!x.startPTS){I.logger.log("No frag in previous level to align on");return}return x}function D(c,o){if(c){var u=c.start+o;c.start=c.startPTS=u,c.endPTS=u+c.duration}}function E(c,o){for(var u=o.fragments,d=0,x=u.length;d<x;d++)D(u[d],c);o.fragmentHint&&D(o.fragmentHint,c),o.alignedSliding=!0}function w(c,o,u){if(!o)return;P(c,u,o),!u.alignedSliding&&o.details&&_(u,o.details),!u.alignedSliding&&o.details&&!u.skippedSegments&&Object(k.adjustSliding)(o.details,u)}function P(c,o,u){if(F(c,u,o)){var d=O(u.details,o);d&&Object(X.isFiniteNumber)(d.start)&&(I.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),E(d.start,o))}}function _(c,o){if(!o.fragments.length||!c.hasProgramDateTime||!o.hasProgramDateTime)return;var u=o.fragments[0].programDateTime,d=c.fragments[0].programDateTime,x=(d-u)/1e3+o.fragments[0].start;x&&Object(X.isFiniteNumber)(x)&&(I.logger.log("Adjusting PTS using programDateTime delta "+(d-u)+"ms, sliding:"+x.toFixed(3)+" "+c.url+" "),E(x,c))}function A(c,o){var u=c.programDateTime;if(!u)return;var d=(u-o)/1e3;c.start=c.startPTS=d,c.endPTS=d+c.duration}function C(c,o){if(!o.fragments.length||!c.hasProgramDateTime||!o.hasProgramDateTime)return;var u=o.fragments[0].programDateTime,d=o.fragments[0].start,x=u-d*1e3;c.fragments.forEach(function(v){A(v,x)}),c.fragmentHint&&A(c.fragmentHint,x),c.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(he,Y,L){"use strict";L.r(Y);var X=L("./src/utils/ewma.ts"),I=function(){function k(F,O,D){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=D,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new X.default(F),this.fast_=new X.default(O)}var W=k.prototype;return W.update=function(O,D){var E=this.slow_,w=this.fast_;this.slow_.halfLife!==O&&(this.slow_=new X.default(O,E.getEstimate(),E.getTotalWeight())),this.fast_.halfLife!==D&&(this.fast_=new X.default(D,w.getEstimate(),w.getTotalWeight()))},W.sample=function(O,D){O=Math.max(O,this.minDelayMs_);var E=8*D,w=O/1e3,P=E/w;this.fast_.sample(w,P),this.slow_.sample(w,P)},W.canEstimate=function(){var O=this.fast_;return O&&O.getTotalWeight()>=this.minWeight_},W.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},W.destroy=function(){},k}();Y.default=I},"./src/utils/ewma.ts":function(he,Y,L){"use strict";L.r(Y);var X=function(){function I(W,F,O){F===void 0&&(F=0),O===void 0&&(O=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=W,this.alpha_=W?Math.exp(Math.log(.5)/W):0,this.estimate_=F,this.totalWeight_=O}var k=I.prototype;return k.sample=function(F,O){var D=Math.pow(this.alpha_,F);this.estimate_=O*(1-D)+D*this.estimate_,this.totalWeight_+=F},k.getTotalWeight=function(){return this.totalWeight_},k.getEstimate=function(){if(this.alpha_){var F=1-Math.pow(this.alpha_,this.totalWeight_);if(F)return this.estimate_/F}return this.estimate_},I}();Y.default=X},"./src/utils/fetch-loader.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"fetchSupported",function(){return A});var X=L("./src/polyfills/number.ts"),I=L("./src/loader/load-stats.ts"),k=L("./src/demux/chunk-cache.ts");function W(d,x){d.prototype=Object.create(x.prototype),d.prototype.constructor=d,w(d,x)}function F(d){var x=typeof Map=="function"?new Map:void 0;return F=function(f){if(f===null||!E(f))return f;if(typeof f!="function")throw new TypeError("Super expression must either be null or a function");if(typeof x!="undefined"){if(x.has(f))return x.get(f);x.set(f,l)}function l(){return O(f,arguments,P(this).constructor)}return l.prototype=Object.create(f.prototype,{constructor:{value:l,enumerable:!1,writable:!0,configurable:!0}}),w(l,f)},F(d)}function O(d,x,v){return D()?O=Reflect.construct:O=function(l,b,h){var p=[null];p.push.apply(p,b);var s=Function.bind.apply(l,p),a=new s;return h&&w(a,h.prototype),a},O.apply(null,arguments)}function D(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(d){return!1}}function E(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function w(d,x){return w=Object.setPrototypeOf||function(f,l){return f.__proto__=l,f},w(d,x)}function P(d){return P=Object.setPrototypeOf?Object.getPrototypeOf:function(v){return v.__proto__||Object.getPrototypeOf(v)},P(d)}function _(){return _=Object.assign||function(d){for(var x=1;x<arguments.length;x++){var v=arguments[x];for(var f in v)Object.prototype.hasOwnProperty.call(v,f)&&(d[f]=v[f])}return d},_.apply(this,arguments)}function A(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(d){}return!1}var C=function(){function d(v){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=v.fetchSetup||o,this.controller=new self.AbortController,this.stats=new I.LoadStats}var x=d.prototype;return x.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},x.abortInternal=function(){var f=this.response;(!f||!f.ok)&&(this.stats.aborted=!0,this.controller.abort())},x.abort=function(){var f;this.abortInternal(),(f=this.callbacks)!==null&&f!==void 0&&f.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},x.load=function(f,l,b){var h=this,p=this.stats;if(p.loading.start)throw new Error("Loader can only be used once.");p.loading.start=self.performance.now();var s=c(f,this.controller.signal),a=b.onProgress,g=f.responseType==="arraybuffer",m=g?"byteLength":"length";this.context=f,this.config=l,this.callbacks=b,this.request=this.fetchSetup(f,s),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){h.abortInternal(),b.onTimeout(p,f,h.response)},l.timeout),self.fetch(this.request).then(function(y){if(h.response=h.loader=y,!y.ok){var M=y.status,H=y.statusText;throw new u(H||"fetch, bad network response",M,y)}return p.loading.first=Math.max(self.performance.now(),p.loading.start),p.total=parseInt(y.headers.get("Content-Length")||"0"),a&&Object(X.isFiniteNumber)(l.highWaterMark)?h.loadProgressively(y,p,f,l.highWaterMark,a):g?y.arrayBuffer():y.text()}).then(function(y){var M=h.response;self.clearTimeout(h.requestTimeout),p.loading.end=Math.max(self.performance.now(),p.loading.first),p.loaded=p.total=y[m];var H={url:M.url,data:y};a&&!Object(X.isFiniteNumber)(l.highWaterMark)&&a(p,f,y,M),b.onSuccess(H,p,f,M)}).catch(function(y){if(self.clearTimeout(h.requestTimeout),p.aborted)return;var M=y.code||0;b.onError({code:M,text:y.message},f,y.details)})},x.getCacheAge=function(){var f=null;if(this.response){var l=this.response.headers.get("age");f=l?parseFloat(l):null}return f},x.loadProgressively=function(f,l,b,h,p){h===void 0&&(h=0);var s=new k.default,a=f.body.getReader(),g=function m(){return a.read().then(function(y){if(y.done)return s.dataLength&&p(l,b,s.flush(),f),Promise.resolve(new ArrayBuffer(0));var M=y.value,H=M.length;return l.loaded+=H,H<h||s.dataLength?(s.push(M),s.dataLength>=h&&p(l,b,s.flush(),f)):p(l,b,M,f),m()}).catch(function(){return Promise.reject()})};return g()},d}();function c(d,x){var v={method:"GET",mode:"cors",credentials:"same-origin",signal:x,headers:new self.Headers(_({},d.headers))};return d.rangeEnd&&v.headers.set("Range","bytes="+d.rangeStart+"-"+String(d.rangeEnd-1)),v}function o(d,x){return new self.Request(d.url,x)}var u=function(d){W(x,d);function x(v,f,l){var b;return b=d.call(this,v)||this,b.code=void 0,b.details=void 0,b.code=f,b.details=l,b}return x}(F(Error));Y.default=C},"./src/utils/imsc1-ttml-parser.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"IMSC1_CODEC",function(){return E}),L.d(Y,"parseIMSC1",function(){return A});var X=L("./src/utils/mp4-tools.ts"),I=L("./src/utils/vttparser.ts"),k=L("./src/utils/vttcue.ts"),W=L("./src/demux/id3.ts"),F=L("./src/utils/timescale-conversion.ts"),O=L("./src/utils/webvtt-parser.ts");function D(){return D=Object.assign||function(h){for(var p=1;p<arguments.length;p++){var s=arguments[p];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(h[a]=s[a])}return h},D.apply(this,arguments)}var E="stpp.ttml.im1t",w=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,P=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,_={left:"start",center:"center",right:"end",start:"start",end:"end"};function A(h,p,s,a,g){var m=Object(X.findBox)(new Uint8Array(h),["mdat"]);if(m.length===0){g(new Error("Could not parse IMSC1 mdat"));return}var y=m[0],M=Object(W.utf8ArrayToStr)(new Uint8Array(h,y.start,y.end-y.start)),H=Object(F.toTimescaleFromScale)(p,1,s);try{a(C(M,H))}catch(V){g(V)}}function C(h,p){var s=new DOMParser,a=s.parseFromString(h,"text/xml"),g=a.getElementsByTagName("tt")[0];if(!g)throw new Error("Invalid ttml");var m={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},y=Object.keys(m).reduce(function(G,j){return G[j]=g.getAttribute("ttp:"+j)||m[j],G},{}),M=g.getAttribute("xml:space")!=="preserve",H=o(c(g,"styling","style")),V=o(c(g,"layout","region")),te=c(g,"body","[begin]");return[].map.call(te,function(G){var j=u(G,M);if(!j||!G.hasAttribute("begin"))return null;var ie=f(G.getAttribute("begin"),y),pe=f(G.getAttribute("dur"),y),ge=f(G.getAttribute("end"),y);if(ie===null)throw v(G);if(ge===null){if(pe===null)throw v(G);ge=ie+pe}var be=new k.default(ie-p,ge-p,j);be.id=Object(O.generateCueId)(be.startTime,be.endTime,be.text);var Ne=V[G.getAttribute("region")],Se=H[G.getAttribute("style")];be.position=10,be.size=80;var Me=d(Ne,Se),Le=Me.textAlign;if(Le){var we=_[Le];we&&(be.lineAlign=we),be.align=Le}return D(be,Me),be}).filter(function(G){return G!==null})}function c(h,p,s){var a=h.getElementsByTagName(p)[0];return a?[].slice.call(a.querySelectorAll(s)):[]}function o(h){return h.reduce(function(p,s){var a=s.getAttribute("xml:id");return a&&(p[a]=s),p},{})}function u(h,p){return[].slice.call(h.childNodes).reduce(function(s,a,g){var m;return a.nodeName==="br"&&g?s+`
|
|
`:(m=a.childNodes)!==null&&m!==void 0&&m.length?u(a,p):p?s+a.textContent.trim().replace(/\s+/g," "):s+a.textContent},"")}function d(h,p){var s="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(g,m){var y=x(p,s,m)||x(h,s,m);return y&&(g[m]=y),g},{})}function x(h,p,s){return h.hasAttributeNS(p,s)?h.getAttributeNS(p,s):null}function v(h){return new Error("Could not parse ttml timestamp "+h)}function f(h,p){if(!h)return null;var s=Object(I.parseTimeStamp)(h);return s===null&&(w.test(h)?s=l(h,p):P.test(h)&&(s=b(h,p))),s}function l(h,p){var s=w.exec(h),a=(s[4]|0)+(s[5]|0)/p.subFrameRate;return(s[1]|0)*3600+(s[2]|0)*60+(s[3]|0)+a/p.frameRate}function b(h,p){var s=P.exec(h),a=Number(s[1]),g=s[2];switch(g){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/p.frameRate;case"t":return a/p.tickRate}return a}},"./src/utils/logger.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"enableLogs",function(){return O}),L.d(Y,"logger",function(){return D});var X=function(){},I={trace:X,debug:X,log:X,warn:X,info:X,error:X},k=I;function W(E){var w=self.console[E];return w?w.bind(self.console,"["+E+"] >"):X}function F(E){for(var w=arguments.length,P=new Array(w>1?w-1:0),_=1;_<w;_++)P[_-1]=arguments[_];P.forEach(function(A){k[A]=E[A]?E[A].bind(E):W(A)})}function O(E){if(self.console&&E===!0||typeof E=="object"){F(E,"debug","log","info","warn","error");try{k.log()}catch(w){k=I}}else k=I}var D=k},"./src/utils/mediakeys-helper.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"KeySystems",function(){return X}),L.d(Y,"requestMediaKeySystemAccess",function(){return I});var X;(function(k){k.WIDEVINE="com.widevine.alpha",k.PLAYREADY="com.microsoft.playready"})(X||(X={}));var I=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"getMediaSource",function(){return X});function X(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"bin2str",function(){return F}),L.d(Y,"readUint16",function(){return O}),L.d(Y,"readUint32",function(){return D}),L.d(Y,"writeUint32",function(){return E}),L.d(Y,"findBox",function(){return w}),L.d(Y,"parseSegmentIndex",function(){return P}),L.d(Y,"parseInitSegment",function(){return _}),L.d(Y,"getStartDTS",function(){return A}),L.d(Y,"getDuration",function(){return C}),L.d(Y,"computeRawDurationFromSamples",function(){return c}),L.d(Y,"offsetStartDTS",function(){return o}),L.d(Y,"segmentValidRange",function(){return u}),L.d(Y,"appendUint8Array",function(){return d});var X=L("./src/utils/typed-array.ts"),I=L("./src/loader/fragment.ts"),k=Math.pow(2,32)-1,W=[].push;function F(x){return String.fromCharCode.apply(null,x)}function O(x,v){"data"in x&&(v+=x.start,x=x.data);var f=x[v]<<8|x[v+1];return f<0?65536+f:f}function D(x,v){"data"in x&&(v+=x.start,x=x.data);var f=x[v]<<24|x[v+1]<<16|x[v+2]<<8|x[v+3];return f<0?4294967296+f:f}function E(x,v,f){"data"in x&&(v+=x.start,x=x.data),x[v]=f>>24,x[v+1]=f>>16&255,x[v+2]=f>>8&255,x[v+3]=f&255}function w(x,v){var f=[];if(!v.length)return f;var l,b,h;"data"in x?(l=x.data,b=x.start,h=x.end):(l=x,b=0,h=l.byteLength);for(var p=b;p<h;){var s=D(l,p),a=F(l.subarray(p+4,p+8)),g=s>1?p+s:h;if(a===v[0])if(v.length===1)f.push({data:l,start:p+8,end:g});else{var m=w({data:l,start:p+8,end:g},v.slice(1));m.length&&W.apply(f,m)}p=g}return f}function P(x){var v=w(x,["moov"]),f=v[0],l=f?f.end:null,b=w(x,["sidx"]);if(!b||!b[0])return null;var h=[],p=b[0],s=p.data[0],a=s===0?8:16,g=D(p,a);a+=4;var m=0,y=0;s===0?a+=8:a+=16,a+=2;var M=p.end+y,H=O(p,a);a+=2;for(var V=0;V<H;V++){var te=a,G=D(p,te);te+=4;var j=G&2147483647,ie=(G&2147483648)>>>31;if(ie===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var pe=D(p,te);te+=4,h.push({referenceSize:j,subsegmentDuration:pe,info:{duration:pe/g,start:M,end:M+j-1}}),M+=j,te+=4,a=te}return{earliestPresentationTime:m,timescale:g,version:s,referencesCount:H,references:h,moovEndOffset:l}}function _(x){for(var v=[],f=w(x,["moov","trak"]),l=0;l<f.length;l++){var b=f[l],h=w(b,["tkhd"])[0];if(h){var p=h.data[h.start],s=p===0?12:20,a=D(h,s),g=w(b,["mdia","mdhd"])[0];if(g){p=g.data[g.start],s=p===0?12:20;var m=D(g,s),y=w(b,["mdia","hdlr"])[0];if(y){var M=F(y.data.subarray(y.start+8,y.start+12)),H={soun:I.ElementaryStreamTypes.AUDIO,vide:I.ElementaryStreamTypes.VIDEO}[M];if(H){var V=w(b,["mdia","minf","stbl","stsd"])[0],te=void 0;V&&(te=F(V.data.subarray(V.start+12,V.start+16))),v[a]={timescale:m,type:H},v[H]={timescale:m,id:a,codec:te}}}}}}var G=w(x,["moov","mvex","trex"]);return G.forEach(function(j){var ie=D(j,4),pe=v[ie];pe&&(pe.default={duration:D(j,12),flags:D(j,20)})}),v}function A(x,v){return w(v,["moof","traf"]).reduce(function(f,l){var b=w(l,["tfdt"])[0],h=b.data[b.start],p=w(l,["tfhd"]).reduce(function(s,a){var g=D(a,4),m=x[g];if(m){var y=D(b,4);h===1&&(y*=Math.pow(2,32),y+=D(b,8));var M=m.timescale||9e4,H=y/M;if(isFinite(H)&&(s===null||H<s))return H}return s},null);return p!==null&&isFinite(p)&&(f===null||p<f)?p:f},null)||0}function C(x,v){for(var f=0,l=0,b=0,h=w(x,["moof","traf"]),p=0;p<h.length;p++){var s=h[p],a=w(s,["tfhd"])[0],g=D(a,4),m=v[g];if(!m)continue;var y=m.default,M=D(a,0)|(y==null?void 0:y.flags),H=y==null?void 0:y.duration;M&8&&(M&2?H=D(a,12):H=D(a,8));for(var V=m.timescale||9e4,te=w(s,["trun"]),G=0;G<te.length;G++){if(H){var j=D(te[G],4);f=H*j}else f=c(te[G]);m.type===I.ElementaryStreamTypes.VIDEO?l+=f/V:m.type===I.ElementaryStreamTypes.AUDIO&&(b+=f/V)}}if(l===0&&b===0){var ie=P(x);if(ie!=null&&ie.references)return ie.references.reduce(function(pe,ge){return pe+ge.info.duration||0},0)}return l||b}function c(x){var v=D(x,0),f=8;v&1&&(f+=4),v&4&&(f+=4);for(var l=0,b=D(x,4),h=0;h<b;h++){if(v&256){var p=D(x,f);l+=p,f+=4}v&512&&(f+=4),v&1024&&(f+=4),v&2048&&(f+=4)}return l}function o(x,v,f){w(v,["moof","traf"]).forEach(function(l){w(l,["tfhd"]).forEach(function(b){var h=D(b,4),p=x[h];if(!p)return;var s=p.timescale||9e4;w(l,["tfdt"]).forEach(function(a){var g=a.data[a.start],m=D(a,4);if(g===0)E(a,4,m-f*s);else{m*=Math.pow(2,32),m+=D(a,8),m-=f*s,m=Math.max(m,0);var y=Math.floor(m/(k+1)),M=Math.floor(m%(k+1));E(a,4,y),E(a,8,M)}})})})}function u(x){var v={valid:null,remainder:null},f=w(x,["moof"]);if(f){if(f.length<2)return v.remainder=x,v}else return v;var l=f[f.length-1];return v.valid=Object(X.sliceUint8)(x,0,l.start-8),v.remainder=Object(X.sliceUint8)(x,l.start-8),v}function d(x,v){var f=new Uint8Array(x.length+v.length);return f.set(x),f.set(v,x.length),f}},"./src/utils/output-filter.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"default",function(){return X});var X=function(){function I(W,F){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=W,this.trackName=F}var k=I.prototype;return k.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},k.newCue=function(F,O,D){(this.startTime===null||this.startTime>F)&&(this.startTime=F),this.endTime=O,this.screen=D,this.timelineController.createCaptionsTrack(this.trackName)},k.reset=function(){this.cueRanges=[]},I}()},"./src/utils/texttrack-utils.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"sendAddTrackEvent",function(){return I}),L.d(Y,"addCueToTrack",function(){return k}),L.d(Y,"clearCurrentCues",function(){return W}),L.d(Y,"removeCuesInRange",function(){return F}),L.d(Y,"getCuesInRange",function(){return D});var X=L("./src/utils/logger.ts");function I(E,w){var P;try{P=new Event("addtrack")}catch(_){P=document.createEvent("Event"),P.initEvent("addtrack",!1,!1)}P.track=E,w.dispatchEvent(P)}function k(E,w){var P=E.mode;if(P==="disabled"&&(E.mode="hidden"),E.cues&&!E.cues.getCueById(w.id))try{if(E.addCue(w),!E.cues.getCueById(w.id))throw new Error("addCue is failed for: "+w)}catch(A){X.logger.debug("[texttrack-utils]: "+A);var _=new self.TextTrackCue(w.startTime,w.endTime,w.text);_.id=w.id,E.addCue(_)}P==="disabled"&&(E.mode=P)}function W(E){var w=E.mode;if(w==="disabled"&&(E.mode="hidden"),E.cues)for(var P=E.cues.length;P--;)E.removeCue(E.cues[P]);w==="disabled"&&(E.mode=w)}function F(E,w,P){var _=E.mode;if(_==="disabled"&&(E.mode="hidden"),E.cues&&E.cues.length>0)for(var A=D(E.cues,w,P),C=0;C<A.length;C++)E.removeCue(A[C]);_==="disabled"&&(E.mode=_)}function O(E,w){if(w<E[0].startTime)return 0;var P=E.length-1;if(w>E[P].endTime)return-1;for(var _=0,A=P;_<=A;){var C=Math.floor((A+_)/2);if(w<E[C].startTime)A=C-1;else if(w>E[C].startTime&&_<P)_=C+1;else return C}return E[_].startTime-w<w-E[A].startTime?_:A}function D(E,w,P){var _=[],A=O(E,w);if(A>-1)for(var C=A,c=E.length;C<c;C++){var o=E[C];if(o.startTime>=w&&o.endTime<=P)_.push(o);else if(o.startTime>P)return _}return _}},"./src/utils/time-ranges.ts":function(he,Y,L){"use strict";L.r(Y);var X={toString:function(k){for(var W="",F=k.length,O=0;O<F;O++)W+="["+k.start(O).toFixed(3)+","+k.end(O).toFixed(3)+"]";return W}};Y.default=X},"./src/utils/timescale-conversion.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"toTimescaleFromBase",function(){return I}),L.d(Y,"toTimescaleFromScale",function(){return k}),L.d(Y,"toMsFromMpegTsClock",function(){return W}),L.d(Y,"toMpegTsClockFromTimescale",function(){return F});var X=9e4;function I(O,D,E,w){E===void 0&&(E=1),w===void 0&&(w=!1);var P=O*D*E;return w?Math.round(P):P}function k(O,D,E,w){return E===void 0&&(E=1),w===void 0&&(w=!1),I(O,D,1/E,w)}function W(O,D){return D===void 0&&(D=!1),I(O,1e3,1/X,D)}function F(O,D){return D===void 0&&(D=1),I(O,X,1/D)}},"./src/utils/typed-array.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"sliceUint8",function(){return X});function X(I,k,W){return Uint8Array.prototype.slice?I.slice(k,W):new Uint8Array(Array.prototype.slice.call(I,k,W))}},"./src/utils/vttcue.ts":function(he,Y,L){"use strict";L.r(Y),Y.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var X=["","lr","rl"],I=["start","middle","end","left","right"];function k(E,w){if(typeof w!="string")return!1;if(!Array.isArray(E))return!1;var P=w.toLowerCase();return~E.indexOf(P)?P:!1}function W(E){return k(X,E)}function F(E){return k(I,E)}function O(E){for(var w=arguments.length,P=new Array(w>1?w-1:0),_=1;_<w;_++)P[_-1]=arguments[_];for(var A=1;A<arguments.length;A++){var C=arguments[A];for(var c in C)E[c]=C[c]}return E}function D(E,w,P){var _=this,A={enumerable:!0};_.hasBeenReset=!1;var C="",c=!1,o=E,u=w,d=P,x=null,v="",f=!0,l="auto",b="start",h=50,p="middle",s=50,a="middle";Object.defineProperty(_,"id",O({},A,{get:function(){return C},set:function(m){C=""+m}})),Object.defineProperty(_,"pauseOnExit",O({},A,{get:function(){return c},set:function(m){c=!!m}})),Object.defineProperty(_,"startTime",O({},A,{get:function(){return o},set:function(m){if(typeof m!="number")throw new TypeError("Start time must be set to a number.");o=m,this.hasBeenReset=!0}})),Object.defineProperty(_,"endTime",O({},A,{get:function(){return u},set:function(m){if(typeof m!="number")throw new TypeError("End time must be set to a number.");u=m,this.hasBeenReset=!0}})),Object.defineProperty(_,"text",O({},A,{get:function(){return d},set:function(m){d=""+m,this.hasBeenReset=!0}})),Object.defineProperty(_,"region",O({},A,{get:function(){return x},set:function(m){x=m,this.hasBeenReset=!0}})),Object.defineProperty(_,"vertical",O({},A,{get:function(){return v},set:function(m){var y=W(m);if(y===!1)throw new SyntaxError("An invalid or illegal string was specified.");v=y,this.hasBeenReset=!0}})),Object.defineProperty(_,"snapToLines",O({},A,{get:function(){return f},set:function(m){f=!!m,this.hasBeenReset=!0}})),Object.defineProperty(_,"line",O({},A,{get:function(){return l},set:function(m){if(typeof m!="number"&&m!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");l=m,this.hasBeenReset=!0}})),Object.defineProperty(_,"lineAlign",O({},A,{get:function(){return b},set:function(m){var y=F(m);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");b=y,this.hasBeenReset=!0}})),Object.defineProperty(_,"position",O({},A,{get:function(){return h},set:function(m){if(m<0||m>100)throw new Error("Position must be between 0 and 100.");h=m,this.hasBeenReset=!0}})),Object.defineProperty(_,"positionAlign",O({},A,{get:function(){return p},set:function(m){var y=F(m);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");p=y,this.hasBeenReset=!0}})),Object.defineProperty(_,"size",O({},A,{get:function(){return s},set:function(m){if(m<0||m>100)throw new Error("Size must be between 0 and 100.");s=m,this.hasBeenReset=!0}})),Object.defineProperty(_,"align",O({},A,{get:function(){return a},set:function(m){var y=F(m);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");a=y,this.hasBeenReset=!0}})),_.displayState=void 0}return D.prototype.getCueAsHTML=function(){var E=self.WebVTT;return E.convertCueToDOMTree(self,this.text)},D}()},"./src/utils/vttparser.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"parseTimeStamp",function(){return k}),L.d(Y,"fixLineBreaks",function(){return w}),L.d(Y,"VTTParser",function(){return P});var X=L("./src/utils/vttcue.ts"),I=function(){function _(){}var A=_.prototype;return A.decode=function(c,o){if(!c)return"";if(typeof c!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(c))},_}();function k(_){function A(c,o,u,d){return(c|0)*3600+(o|0)*60+(u|0)+parseFloat(d||0)}var C=_.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return C?parseFloat(C[2])>59?A(C[2],C[3],0,C[4]):A(C[1],C[2],C[3],C[4]):null}var W=function(){function _(){this.values=Object.create(null)}var A=_.prototype;return A.set=function(c,o){!this.get(c)&&o!==""&&(this.values[c]=o)},A.get=function(c,o,u){return u?this.has(c)?this.values[c]:o[u]:this.has(c)?this.values[c]:o},A.has=function(c){return c in this.values},A.alt=function(c,o,u){for(var d=0;d<u.length;++d)if(o===u[d]){this.set(c,o);break}},A.integer=function(c,o){/^-?\d+$/.test(o)&&this.set(c,parseInt(o,10))},A.percent=function(c,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var u=parseFloat(o);if(u>=0&&u<=100)return this.set(c,u),!0}return!1},_}();function F(_,A,C,c){var o=c?_.split(c):[_];for(var u in o){if(typeof o[u]!="string")continue;var d=o[u].split(C);if(d.length!==2)continue;var x=d[0],v=d[1];A(x,v)}}var O=new X.default(0,0,""),D=O.align==="middle"?"middle":"center";function E(_,A,C){var c=_;function o(){var x=k(_);if(x===null)throw new Error("Malformed timestamp: "+c);return _=_.replace(/^[^\sa-zA-Z-]+/,""),x}function u(x,v){var f=new W;F(x,function(h,p){var s;switch(h){case"region":for(var a=C.length-1;a>=0;a--)if(C[a].id===p){f.set(h,C[a].region);break}break;case"vertical":f.alt(h,p,["rl","lr"]);break;case"line":s=p.split(","),f.integer(h,s[0]),f.percent(h,s[0])&&f.set("snapToLines",!1),f.alt(h,s[0],["auto"]),s.length===2&&f.alt("lineAlign",s[1],["start",D,"end"]);break;case"position":s=p.split(","),f.percent(h,s[0]),s.length===2&&f.alt("positionAlign",s[1],["start",D,"end","line-left","line-right","auto"]);break;case"size":f.percent(h,p);break;case"align":f.alt(h,p,["start",D,"end","left","right"]);break}},/:/,/\s/),v.region=f.get("region",null),v.vertical=f.get("vertical","");var l=f.get("line","auto");l==="auto"&&O.line===-1&&(l=-1),v.line=l,v.lineAlign=f.get("lineAlign","start"),v.snapToLines=f.get("snapToLines",!0),v.size=f.get("size",100),v.align=f.get("align",D);var b=f.get("position","auto");b==="auto"&&O.position===50&&(b=v.align==="start"||v.align==="left"?0:v.align==="end"||v.align==="right"?100:50),v.position=b}function d(){_=_.replace(/^\s+/,"")}if(d(),A.startTime=o(),d(),_.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+c);_=_.substr(3),d(),A.endTime=o(),d(),u(_,A)}function w(_){return _.replace(/<br(?: \/)?>/gi,`
|
|
`)}var P=function(){function _(){this.state="INITIAL",this.buffer="",this.decoder=new I,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var A=_.prototype;return A.parse=function(c){var o=this;c&&(o.buffer+=o.decoder.decode(c,{stream:!0}));function u(){var b=o.buffer,h=0;for(b=w(b);h<b.length&&b[h]!=="\r"&&b[h]!==`
|
|
`;)++h;var p=b.substr(0,h);return b[h]==="\r"&&++h,b[h]===`
|
|
`&&++h,o.buffer=b.substr(h),p}function d(b){F(b,function(h,p){},/:/)}try{var x="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;x=u();var v=x.match(/^()?WEBVTT([ \t].*)?$/);if(!v||!v[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var f=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;f?f=!1:x=u();switch(o.state){case"HEADER":/:/.test(x)?d(x):x||(o.state="ID");continue;case"NOTE":x||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(x)){o.state="NOTE";break}if(!x)continue;if(o.cue=new X.default(0,0,""),o.state="CUE",x.indexOf("-->")===-1){o.cue.id=x;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{E(x,o.cue,o.regionList)}catch(b){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var l=x.indexOf("-->")!==-1;if(!x||l&&(f=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
|
|
`),o.cue.text+=x}continue;case"BADCUE":x||(o.state="ID")}}}catch(b){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},A.flush=function(){var c=this;try{if((c.cue||c.state==="HEADER")&&(c.buffer+=`
|
|
|
|
`,c.parse()),c.state==="INITIAL"||c.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){c.onparsingerror&&c.onparsingerror(o)}return c.onflush&&c.onflush(),this},_}()},"./src/utils/webvtt-parser.ts":function(he,Y,L){"use strict";L.r(Y),L.d(Y,"generateCueId",function(){return P}),L.d(Y,"parseWebVTT",function(){return A});var X=L("./src/polyfills/number.ts"),I=L("./src/utils/vttparser.ts"),k=L("./src/demux/id3.ts"),W=L("./src/utils/timescale-conversion.ts"),F=L("./src/remux/mp4-remuxer.ts"),O=/\r\n|\n\r|\n|\r/g,D=function(c,o,u){return u===void 0&&(u=0),c.substr(u,o.length)===o},E=function(c){var o=parseInt(c.substr(-3)),u=parseInt(c.substr(-6,2)),d=parseInt(c.substr(-9,2)),x=c.length>9?parseInt(c.substr(0,c.indexOf(":"))):0;if(!Object(X.isFiniteNumber)(o)||!Object(X.isFiniteNumber)(u)||!Object(X.isFiniteNumber)(d)||!Object(X.isFiniteNumber)(x))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+c);return o+=1e3*u,o+=60*1e3*d,o+=60*60*1e3*x,o},w=function(c){for(var o=5381,u=c.length;u;)o=o*33^c.charCodeAt(--u);return(o>>>0).toString()};function P(C,c,o){return w(C.toString())+w(c.toString())+w(o)}var _=function(c,o,u){var d=c[o],x=c[d.prevCC];if(!x||!x.new&&d.new){c.ccOffset=c.presentationOffset=d.start,d.new=!1;return}for(;(v=x)!==null&&v!==void 0&&v.new;){var v;c.ccOffset+=d.start-x.start,d.new=!1,d=x,x=c[d.prevCC]}c.presentationOffset=u};function A(C,c,o,u,d,x,v,f){var l=new I.VTTParser,b=Object(k.utf8ArrayToStr)(new Uint8Array(C)).trim().replace(O,`
|
|
`).split(`
|
|
`),h=[],p=Object(W.toMpegTsClockFromTimescale)(c,o),s="00:00.000",a=0,g=0,m,y=!0,M=!1;l.oncue=function(H){var V=u[d],te=u.ccOffset,G=(a-p)/9e4;if(V!=null&&V.new&&(g!==void 0?te=u.ccOffset=V.start:_(u,d,G)),G&&(te=G-u.presentationOffset),M){var j=H.endTime-H.startTime,ie=Object(F.normalizePts)((H.startTime+te-g)*9e4,x*9e4)/9e4;H.startTime=ie,H.endTime=ie+j}var pe=H.text.trim();H.text=decodeURIComponent(encodeURIComponent(pe)),H.id||(H.id=P(H.startTime,H.endTime,pe)),H.endTime>0&&h.push(H)},l.onparsingerror=function(H){m=H},l.onflush=function(){if(m){f(m);return}v(h)},b.forEach(function(H){if(y)if(D(H,"X-TIMESTAMP-MAP=")){y=!1,M=!0,H.substr(16).split(",").forEach(function(V){D(V,"LOCAL:")?s=V.substr(6):D(V,"MPEGTS:")&&(a=parseInt(V.substr(7)))});try{g=E(s)/1e3}catch(V){M=!1,m=V}return}else H===""&&(y=!1);l.parse(H+`
|
|
`)}),l.flush()}},"./src/utils/xhr-loader.ts":function(he,Y,L){"use strict";L.r(Y);var X=L("./src/utils/logger.ts"),I=L("./src/loader/load-stats.ts"),k=/^age:\s*[\d.]+\s*$/m,W=function(){function F(D){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=D?D.xhrSetup:null,this.stats=new I.LoadStats,this.retryDelay=0}var O=F.prototype;return O.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},O.abortInternal=function(){var E=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),E&&(E.onreadystatechange=null,E.onprogress=null,E.readyState!==4&&(this.stats.aborted=!0,E.abort()))},O.abort=function(){var E;this.abortInternal(),(E=this.callbacks)!==null&&E!==void 0&&E.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},O.load=function(E,w,P){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=E,this.config=w,this.callbacks=P,this.retryDelay=w.retryDelay,this.loadInternal()},O.loadInternal=function(){var E=this.config,w=this.context;if(!E)return;var P=this.loader=new self.XMLHttpRequest,_=this.stats;_.loading.first=0,_.loaded=0;var A=this.xhrSetup;try{if(A)try{A(P,w.url)}catch(o){P.open("GET",w.url,!0),A(P,w.url)}P.readyState||P.open("GET",w.url,!0);var C=this.context.headers;if(C)for(var c in C)P.setRequestHeader(c,C[c])}catch(o){this.callbacks.onError({code:P.status,text:o.message},w,P);return}w.rangeEnd&&P.setRequestHeader("Range","bytes="+w.rangeStart+"-"+(w.rangeEnd-1)),P.onreadystatechange=this.readystatechange.bind(this),P.onprogress=this.loadprogress.bind(this),P.responseType=w.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),E.timeout),P.send()},O.readystatechange=function(){var E=this.context,w=this.loader,P=this.stats;if(!E||!w)return;var _=w.readyState,A=this.config;if(P.aborted)return;if(_>=2)if(self.clearTimeout(this.requestTimeout),P.loading.first===0&&(P.loading.first=Math.max(self.performance.now(),P.loading.start)),_===4){w.onreadystatechange=null,w.onprogress=null;var C=w.status;if(C>=200&&C<300){P.loading.end=Math.max(self.performance.now(),P.loading.first);var c,o;if(E.responseType==="arraybuffer"?(c=w.response,o=c.byteLength):(c=w.responseText,o=c.length),P.loaded=P.total=o,!this.callbacks)return;var u=this.callbacks.onProgress;if(u&&u(P,E,c,w),!this.callbacks)return;var d={url:w.responseURL,data:c};this.callbacks.onSuccess(d,P,E,w)}else P.retry>=A.maxRetry||C>=400&&C<499?(X.logger.error(C+" while loading "+E.url),this.callbacks.onError({code:C,text:w.statusText},E,w)):(X.logger.warn(C+" while loading "+E.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,A.maxRetryDelay),P.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),A.timeout)},O.loadtimeout=function(){X.logger.warn("timeout while loading "+this.context.url);var E=this.callbacks;E&&(this.abortInternal(),E.onTimeout(this.stats,this.context,this.loader))},O.loadprogress=function(E){var w=this.stats;w.loaded=E.loaded,E.lengthComputable&&(w.total=E.total)},O.getCacheAge=function(){var E=null;if(this.loader&&k.test(this.loader.getAllResponseHeaders())){var w=this.loader.getResponseHeader("age");E=w?parseFloat(w):null}return E},F}();Y.default=W}}).default})},vHTk:function(yt,it,se){yt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);
|